
{"id":320805,"date":"2025-09-26T15:56:30","date_gmt":"2025-09-26T07:56:30","guid":{"rendered":"https:\/\/tzuchiculture.org\/dsignup\/"},"modified":"2025-09-26T22:19:23","modified_gmt":"2025-09-26T14:19:23","slug":"en-dsignup","status":"publish","type":"page","link":"https:\/\/culture.daaimobile.org\/en\/en-dsignup\/","title":{"rendered":"dsignup"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; theme_builder_area=&#8221;post_content&#8221; _builder_version=&#8221;4.27.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;0px|0px|0px|0px|false|false&#8221; custom_padding=&#8221;0px|0px|0px|0px|false|false&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243; da_is_popup=&#8221;off&#8221; da_exit_intent=&#8221;off&#8221; da_has_close=&#8221;on&#8221; da_alt_close=&#8221;off&#8221; da_dark_close=&#8221;off&#8221; da_not_modal=&#8221;on&#8221; da_is_singular=&#8221;off&#8221; da_with_loader=&#8221;off&#8221; da_has_shadow=&#8221;on&#8221; da_disable_devices=&#8221;off|off|off&#8221;][et_pb_row _builder_version=&#8221;4.27.4&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; custom_margin=&#8221;0px|auto|0px|auto|false|false&#8221; custom_padding=&#8221;0px|0px|0px|0px|false|false&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;][et_pb_column _builder_version=&#8221;4.27.4&#8243; _module_preset=&#8221;default&#8221; type=&#8221;4_4&#8243; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.27.4&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]            <div class=\"form-wrapper\">\n                <div class=\"title-wrapper\">\n                  <div class=\"main-title\">\n                    Master, I want to say something to you...                  <\/div>\n                  <div class=\"subtitle-wrapper\">\n                    <div class=\"subtitle-text\">\n                        In just a few steps, your heartfelt words to Master can be seen by the whole world!                    <\/div>\n                  <\/div>\n                <\/div>\n                <div class=\"custom-register-form\">\n                    <form method=\"post\" action=\"\" id=\"supabase-register-form\">\n                        <input type=\"hidden\" id=\"supabase_register_nonce\" name=\"supabase_register_nonce\" value=\"3da377c0a5\" \/><input type=\"hidden\" name=\"_wp_http_referer\" value=\"\/en\/wp-json\/wp\/v2\/pages\/320805\" \/>                        <div id=\"step-1\">\n                            <div class=\"contact-type-wrapper\">\n\t    \t    \t\t\t    <label for=\"contact_type\" class=\"form-label\" style=\"display:block;\">Please choose your registration method<\/label>\n\t\t\t\t\t\t\t\t<div style=\"display:flex;justify-content:flex-end;\">\n                                    <!-- <div class=\"login-link\">&quot;Already a member? Click here to sign in&quot;<\/div> -->\t\n                                    <a href=\"https:\/\/culture.daaimobile.org\/en\/join-us\/\" class=\"login-link\" style=\"color:#000\">&quot;Already a member? Click here to sign in&quot;<\/a>\n\t\t\t\t\t\t\t\t<\/div>\n                                <div style=\"margin-top:1em;\">\n                                    <label class=\"form-label\"><input type=\"radio\" name=\"contact_type\" value=\"phone\" onchange=\"switchMethod()\" checked \/>Phone<\/label>\n                                    <label class=\"form-label\"><input type=\"radio\" name=\"contact_type\" value=\"email\" onchange=\"switchMethod()\" \/>Email<\/label>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom: 1em;\">\n                                <div class=\"acf-custom-wrapper input-button-row\" style=\"margin-bottom:1em;\">\n                                    <input type=\"text\" name=\"acf[custom_email_phone]\" id=\"acf-custom_email_phone\" placeholder=\"Please enter your phone number\" \/>\n                                <\/div>\n     \t    \t    \t\t\t<label id=\"verify-phone-label\" for=\"acf[custom_email_phone]\" >\n                                    <span class=\"line\">After entering,<\/span>\n                                    <span class=\"line\">please click the [Send Verification Code] button\u25bc<\/span>\n                                <\/label>\n                                <button type=\"button\" id=\"send-otp\" class=\"btn-center\" >Send verification code<\/button>\n                            <\/div>\n                            <div id=\"otp-section\" style=\"margin-bottom: 1em;\">\n\t    \t    \t\t\t\t<label for=\"otp_code\" class=\"form-label\">Enter the verification code you received<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <input type=\"text\" id=\"otp_code\" name=\"otp_code\" placeholder=\"Enter your verification code\" maxlength=\"6\" \/>\n                                <\/div>\n                                <p id=\"otp-timer\" style=\"text-align:center; margin-top:0.5em; color: #888;\"><\/p>\n                            <\/div>\n                            <input type=\"hidden\" name=\"verified_phone\" id=\"verified_phone\" value=\"\">\n                            <div style=\"margin-bottom: 1em;\">\n\t    \t    \t\t\t\t<label for=\"acf[custom_password]\" class=\"form-label required\">Set a password<\/label>\n                                <div class=\"acf-password-wrapper\">\n                                    <div class=\"acf-custom-wrapper input-button-row\" id=\"acf-custom-password-wrapper\">\n                                        <input type=\"password\" name=\"acf[custom_password]\" id=\"acf-custom_password\" placeholder=\"8 characters, letters and numbers, case insensitive\" \/>\n                                    <\/div>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;display:inline-flex;align-items:flex-start\">\n                                <input type=\"checkbox\" id=\"confirmShowCredit\" name=\"confirmShowCredit\" style=\"transform:scale(1.6);margin-left:20px;margin-top:6px;\">\n                                <label id=\"agreement\" for=\"confirmShowCredit\" class=\"form-label agree required\" style=\"margin-left:0.5em!important;\"><span class=\"line\">I have read and agree to the<\/span>\n                                    <span class=\"line\" style=\"display:inline;\"><a href=\"https:\/\/dharma.daai.tv\/wp-content\/uploads\/2025\/07\/private.pdf\" target=\"_blank\" rel=\"noopener\">Data Collection Consent Form<\/a><\/span>\n                                <\/label>\n                            <\/div>\n                            <input type=\"hidden\" name=\"supabase_uid\" id=\"supabase_uid\" \/>\n                            <input type=\"hidden\" name=\"supabase_token\" id=\"supabase_token\" \/>\n                            <input type=\"hidden\" name=\"display_name\" id=\"display_name\" value=\"\" \/>\n                            <input type=\"hidden\" name=\"picture\" id=\"picture\"  value=\"\" \/>\n                            <button type=\"button\" id=\"go-to-step-2\" class=\"btn-disabled\" disabled >Confirm and Continue<\/button>\n                        <\/div>\n                        <div id=\"step-2\" style=\"display:none;\">\n                            <div style=\"margin-bottom:1em;\">\n\t    \t    \t\t\t\t<label for=\"acf[custom_username]\" class=\"form-label required\">Tell Master your name<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <input type=\"text\" name=\"acf[custom_username]\" id=\"acf-custom_username\" required \/>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;\">\n                                <label for=\"acf-field_682d66cb8755b\" class=\"form-label required\">Tell Master where you are from<\/label>\n                                <div id=\"location\" class=\"acf-custom-wrapper input-button-row two-column\">\n                                    <input type=\"text\" id=\"acf-field_682d66cb8755b\" name=\"acf[field_682d66cb8755b]\" class=\"field\" placeholder=\"\u570b\u5bb6\u3001\u5730\u5340 Country\u3001Region\" required \/>\n                                    <!-- <input type=\"text\" id=\"acf-field_682d670c8755c\" name=\"acf[field_682d670c8755c]\" class=\"field\" style=\"display:none;\" placeholder=\"\u57ce\u5e02 City\" \/> -->\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;\">\n                                <label for=\"acf-field_687db6613103a\" class=\"form-label\">How did you get to know Tzu Chi?<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <ul class=\"radio-list acf-custom-wrapper\">\n                                        <li>\n                                            <label class=\"radio-label\"><input type=\"radio\" name=\"acf[field_687db6613103a]\" value=\"\u6211\u662f\u6148\u6fdf\u5fd7\u5de5\" style=\"transform:scale(1.6);margin-left:20px;font-size:1.4em;\" \/>I am a Tzu Chi volunteer<\/label>\n                                        <\/li>\n                                        <li>\n                                            <label class=\"radio-label\"><input type=\"radio\" name=\"acf[field_687db6613103a]\" value=\"\u6211\u53c3\u8207\u904e\u6148\u6fdf\u6d3b\u52d5\" style=\"transform:scale(1.6);margin-left:20px;font-size:1.4em;\" \/>I have participated in Tzu Chi activities<\/label>\n                                        <\/li>\n                                        <li>\n                                            <label class=\"radio-label\"><input type=\"radio\" name=\"acf[field_687db6613103a]\" value=\"\u6211\u5c0d\u6148\u6fdf\u6709\u8208\u8da3\u4e86\u89e3\" style=\"transform:scale(1.6);margin-left:20px;font-size:1.4em;\" \/>I am interested in learning about Tzu Chi<\/label>\n                                        <\/li>\n                                    <\/ul>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;\">\n                                <label for=\"acf-field_682d67298755d\" class=\"form-label required\">Write your heartfelt words to Master<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <textarea id=\"acf-field_682d67298755d\" name=\"acf[field_682d67298755d]\" placeholder=\"(Within 30 characters, only one message per person)\" rows=\"5\" class=\"textarea\" maxlength=\"45\" required ><\/textarea>\n                                <\/div>\n                            <\/div>\n                            <input type=\"submit\" id=\"register-submit\" name=\"custom_register_submit\" value=\"Submit Message\" class=\"register-btn btn-disabled\" disabled \/>\n                        <\/div>\n                    <\/form>\n                <\/div>\n                <div id=\"social-signup\" style=\"margin-top:2em;display:none;\">\n                    <p>Or register with<\/p>\n                    <div style=\"text-align:center;padding-top:0.5em;padding-bottom:2em;\">\n                        <button type=\"button\" class=\"social-login-button\" onclick=\"loginWithProvider('line')\">\n                          <img decoding=\"async\" src=\"https:\/\/culture.daaimobile.org\/wp-content\/plugins\/supabase-register-loginer\/assets\/LINE.png\" alt=\"LINE Icon\" \/>\n                        <\/button>\n                        <button type=\"button\" class=\"social-login-button\" onclick=\"loginWithProvider('facebook')\">\n                          <img decoding=\"async\" src=\"https:\/\/culture.daaimobile.org\/wp-content\/plugins\/supabase-register-loginer\/assets\/FB.png\" alt=\"Facebook Icon\" \/>\n                        <\/button>                        \n                        <button type=\"button\" class=\"social-login-button\" onclick=\"loginWithProvider('google')\">\n                          <img decoding=\"async\" src=\"https:\/\/culture.daaimobile.org\/wp-content\/plugins\/supabase-register-loginer\/assets\/GOOGLE.png\" alt=\"Google Icon\" \/>\n                        <\/button>                        \n                    <\/div>\n                <\/div>\n                <div id=\"note-signup\" class=\"note-signup\" >\n                    <p>*By clicking [Submit Message], you agree to make your message and location public on this site.<br \/>\n*Your message will be published after editorial review.<\/p>\n                <\/div>\n            <\/div>\n            <link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/css\/intlTelInput.min.css\" \/>\n            <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/js\/intlTelInput.min.js\"><\/script>\n            <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@supabase\/supabase-js@2\"><\/script>\n            <script>\n                const client = supabase.createClient(\"https:\/\/jxnqpnlyieukvpehurgl.supabase.co\", \"sb_publishable_vb5kvkB5cSa-M6oq5iUDtQ_dJuDKZs5\");\n                async function loginWithProvider(provider) {\n                    const confirmCheckbox = document.getElementById(\"confirmShowCredit\");\n                    const isConfirmed = confirmCheckbox?.checked;\n                    if (isConfirmed) {\n                        if(provider == 'line') {\n                            window.location.href='https:\/\/s.no8.io\/link\/channels\/qLITg7BLoq';\n                        } else {\n                            confirmCheckbox.classList.remove(\"field-error\");\n                            const redirectUrl = window.location.origin + window.location.pathname + \"?from_oauth=1\";\n                            const { data, error } = await client.auth.signInWithOAuth({\n                                provider: provider,\n                                options: {\n                                    redirectTo: redirectUrl\n                                }\n                            });\n                            if (error) {\n                                alert('\u793e\u7fa4\u8a3b\u518a\u932f\u8aa4\uff1a' + error.message);\n                            } else {\n                                sessionStorage.setItem(\"register_submitted\", \"0\");\n                            }\n                        }\n                    } else {\n                        confirmCheckbox.classList.add(\"field-error\");\n                        alert(\"Please check &quot;I have read and agree to the Data Collection Consent Form&quot; first\");\n                    }\n                }\n                const regions = {\n                    \"Taiwan\": [\"\u81fa\u5317\u5e02\", \"\u65b0\u5317\u5e02\", \"\u6843\u5712\u5e02\", \"\u81fa\u4e2d\u5e02\", \"\u81fa\u5357\u5e02\", \"\u9ad8\u96c4\u5e02\", \"\u57fa\u9686\u5e02\", \"\u65b0\u7af9\u5e02\", \"\u5609\u7fa9\u5e02\", \"\u65b0\u7af9\u7e23\", \"\u82d7\u6817\u7e23\", \"\u5f70\u5316\u7e23\",\n                               \"\u5357\u6295\u7e23\", \"\u96f2\u6797\u7e23\", \"\u5609\u7fa9\u7e23\", \"\u5c4f\u6771\u7e23\", \"\u5b9c\u862d\u7e23\", \"\u82b1\u84ee\u7e23\", \"\u81fa\u6771\u7e23\", \"\u6f8e\u6e56\u7e23\", \"\u91d1\u9580\u7e23\", \"\u9023\u6c5f\u7e23\" ],\n                }\n                function createRegionSelect(key, container) {\n                  if (!regions[key]) {\n                    container.textContent = `\u627e\u4e0d\u5230 ${key} \u7684\u5730\u5340\u8cc7\u6599`;\n                    return;\n                  }                \n                  const select = document.createElement('select');\n                  select.name = 'acf[field_682d670c8755c]';\n                  select.id = 'acf-field_682d670c8755c';\n                  select.style.display = 'none';\n                  select.classList.add('field');\n                  const defaultOption = document.createElement('option');\n                  defaultOption.value = '';\n                  defaultOption.textContent = '\u8acb\u9078\u64c7\u57ce\u5e02';\n                  select.appendChild(defaultOption);\n                  regions[key].forEach(region => {\n                    const option = document.createElement('option');\n                    option.value = region;\n                    option.textContent = region;\n                    select.appendChild(option);\n                  });                \n                  container.appendChild(select);\n                }\n                const locationRow  = document.getElementById('location');\n                createRegionSelect(\"Taiwan\", locationRow);\n                const phoneInput = document.getElementById(\"acf-custom_email_phone\");\n                const countryInput = document.getElementById('acf-field_682d66cb8755b');\n                const regionInput  = document.getElementById('acf-field_682d670c8755c');\n                const i18n = {\n                    selectedCountryAriaLabel: \"\u9078\u64c7\u570b\u5bb6\u3001\u5730\u5340\",\n                    noCountrySelected: \"\u7121\u570b\u5bb6\u3001\u5730\u5340\u5099\u9078\",\n                    countryListAriaLabel: \"\u570b\u5bb6\u3001\u5730\u5340\u6e05\u55ae\",\n                    searchPlaceholder: \"\u641c\u5c0b\",\n                    zeroSearchResults: \"\u7121\u641c\u5c0b\u7d50\u679c\",\n                    oneSearchResult: \"\u641c\u5c0b\u5230 1 \u500b\u7d50\u679c\",\n                    multipleSearchResults: \"\u641c\u5c0b\u5230 ${count} \u500b\u7d50\u679c\",\n                }\n                let iti = null;\n                function initPhoneIti() {\n                    iti = window.intlTelInput(phoneInput, {\n                        initialCountry: \"tw\",\n                        countryOrder: [\"tw\", \"us\", \"cn\", \"hk\", \"sg\", \"my\", \"id\", \"jp\"],\n                        i18n: i18n,\n\t\t\t\t\t    loadUtils: () => import(\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/js\/utils.js\")\n                    });\n\t\t\t\t}\n                const itic = window.intlTelInput(countryInput, {\n                    initialCountry: \"auto\",\n                    countryOrder: [\"tw\", \"us\", \"cn\", \"hk\", \"sg\", \"my\", \"id\", \"jp\"],\n                    i18n: i18n,\n\t\t\t\t\tloadUtils: () => import(\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/js\/utils.js\")\n                });\n                countryInput.style.paddingLeft = \"88px\";\n                countryInput.addEventListener('countrychange', () => {\n                    const data = itic.getSelectedCountryData();\n                    if (data && data.name) {\n                        countryInput.value = data.name;\n\t\t\t\t  \t    if(data.name == \"Taiwan\") {\n                            regionInput.style.display = \"\";\n                            locationRow.classList.add('show-region');\n\t\t\t\t  \t    }\n                    } else {\n                        countryInput.value = \"\";\n                        regionInput.style.display = \"none\";\n                        locationRow.classList.remove('show-region');\n                    }\n                });\n                countryInput.addEventListener('input', () => {\n                    const data = countryInput.value.trim();\n                    if (!data) {\n                        regionInput.style.display = \"none\";\n                        locationRow.classList.remove('show-region');\n                        try { itic.setCountry(''); } catch (e) {}\n                    } else if(data == \"Taiwan\" || data == \"\u53f0\u7063\" || data == \"\u81fa\u7063\") {\n                        regionInput.style.display = \"\";\n                        locationRow.classList.add('show-region');\n                    }\n                });\n                function switchMethod() {\n                    const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                    if(method === 'email') {\n\t\t\t\t\t\titi.destroy();\n\t\t\t\t\t\titi = null;\n\t\t\t\t\t\tphoneInput.style.padding = \"10px\";\n                        document.getElementById('send-otp').style.display = 'none';\n                        document.getElementById('otp-section').style.display = 'none';\n                        document.getElementById('verify-phone-label').innerHTML = \"\";\n                        document.getElementById('acf-custom_email_phone').placeholder=\"Please enter your email address\";\n                    } else {\n                        initPhoneIti();\n\t\t\t\t\t\tphoneInput.style.padding = \"\";\n\t\t\t\t\t\tphoneInput.style.paddingLeft = \"88px\";\n                        document.getElementById('send-otp').style.display = 'block';\n                        document.getElementById('otp-section').style.display = 'block';\n                        document.getElementById('verify-phone-label').innerHTML = \"<span class='line'>After entering,<\/span><span class='line'>please click the [Send Verification Code] button\u25bc<\/span>\";\n                        document.getElementById('acf-custom_email_phone').placeholder=\"Please enter your phone number\";\n                    }\n                }\n                document.addEventListener('DOMContentLoaded', function () {\n                    const wrapper = document.querySelector('.acf-password-wrapper');\n                    if (wrapper) {\n                        const input = wrapper.querySelector('input[type=\"password\"], input[type=\"text\"]');\n                        if (input) {\n                            const button = document.createElement('button');\n                            button.type = 'button';\n                            button.className = 'dashicons dashicons-visibility acf-toggle-password';\n                            button.setAttribute('aria-label', '\u5207\u63db\u5bc6\u78bc\u53ef\u898b');\n                            button.addEventListener('click', function () {\n                                const isPassword = input.type === 'password';\n                                input.type = isPassword ? 'text' : 'password';\n                                button.classList.toggle('dashicons-visibility');\n                                button.classList.toggle('dashicons-hidden');\n                            });\n                            wrapper.style.position = 'relative';\n                            wrapper.appendChild(button);\n                        }\n                    }\n                    switchMethod();\n\n                    const phoneInput = document.getElementById(\"acf-custom_email_phone\");\n                    const sendOTPBtn = document.getElementById(\"send-otp\");\n                    const verifyOTPBtn = document.getElementById(\"verify-otp\");\n                    const otpSection = document.getElementById(\"otp-section\");\n                    const verifiedPhoneInput = document.getElementById(\"verified_phone\");\n                    let countdown = null;\n\n                    function startResendCountdown(duration, button, timerText) {\n                        let seconds = duration;\n                        button.disabled = true;\n                        button.classList.add(\"btn-disabled\");\n                        button.style.opacity = 0.6;\n                        timerText.textContent = seconds + ' ' + ` seconds remaining before you can resend`;\n                    \n                        countdown = setInterval(() => {\n                            seconds--;\n                            if (seconds <= 0) {\n                                clearInterval(countdown);\n                                timerText.textContent = '';\n                                button.disabled = false;\n                                button.classList.remove(\"btn-disabled\");\n                                button.style.opacity = 1;\n                                button.textContent = 'Resend verification code';\n                            } else {\n                                timerText.textContent = seconds + ' ' + ` seconds remaining before you can resend`;\n                            }\n                        }, 1000);\n                    }\n\n                    async function checkEmailVerified() {\n                        const userId = document.getElementById('supabase_uid')?.value;\n                        const nonce = document.querySelector('input[name=\"supabase_register_nonce\"]')?.value;\n                    \n                        const formData = new FormData();\n                        formData.append('action', 'supabase_check_email_verified'); \n                        formData.append('user_id', userId);\n                        formData.append('supabase_register_nonce', nonce);\n                        sendOTPBtn.disabled = true;\n                        sendOTPBtn.classList.add(\"loading\");\n                        const originalText = sendOTPBtn.innerHTML;\n                        sendOTPBtn.innerHTML = `\n                            <span class=\"spinner\"><\/span> Processing\u2026                        `;\n                    \n                        try {\n                            const resp = await fetch(\"https:\/\/culture.daaimobile.org\/wp-admin\/admin-ajax.php\", {\n                                method: 'POST',\n                                body: formData\n                            });\n                            const result = await resp.json();\n                            if (result.success) {\n                                if(result.data.email_confirmed) {\n                                    enableStep2();\n                                } else {\n                                    alert(\"\u60a8\u5c1a\u672a\u9a57\u8b49\u96fb\u5b50\u4fe1\u7bb1\uff0c\u8acb\u81f3\u60a8\u7684\u96fb\u5b50\u4fe1\u7bb1\u9ede\u64ca\u300c\u9a57\u8b49\u90f5\u4ef6\u300d\u7684\u9023\u7d50\uff0c\u4ee5\u78ba\u8a8d\u96fb\u5b50\u4fe1\u7bb1\u5730\u5740\\nYour email address has not been verified. Please check your inbox and click the link in the verification email to confirm your email address.\");\n                                }\n                            } else {\n                                alert(\"\u53d6\u5f97\u8a3b\u518a\u8cc7\u6599\u5931\u6557\uff0c\u8acb\u518d\u8a66\u4e00\u6b21\u6216\u806f\u7d61\u5ba2\u670d\uff1a\\nFailed to retrieve registration data. Please try again or contact customer service\uff1a\\n\" + (result.data?.message ?? '\u672a\u77e5\u932f\u8aa4'));\n                            }\n                        } catch (err) {\n                            alert('\u547c\u53eb\u5f8c\u53f0\u932f\u8aa4\uff1a' + err);\n                        } finally {\n                            sendOTPBtn.disabled = false;\n                            sendOTPBtn.classList.remove(\"loading\");\n                            sendOTPBtn.innerHTML = originalText;\n                        }\n                    }\n\n                    const AJAX_URL = \"https:\/\/culture.daaimobile.org\/wp-admin\/admin-ajax.php\";\n                    async function checkUserExists(value, type) {\n                      const sites = [\n                        \"https:\/\/tzuchiculture.org\",\n                        \"https:\/\/dharma.daai.tv\",\n                        \/\/\"https:\/\/crm.daaimobile.org\"\n                      ];\n                      let errMsg = \"\";\n                      for (let site of sites) {\n                        try {\n                          const apiUrl = site.replace(\/\\\/$\/, '') + '\/wp-json\/supabase-sso\/v1\/check_user_exists';\n                          const res = await fetch(apiUrl, {\n                            method: \"POST\",\n                            headers: {\n                              \"Content-Type\": \"application\/json\",\n                            },\n                            body: JSON.stringify({ value, type })\n                          });\n                          if (!res.ok) {\n                            errMsg += site + \" \u56de\u61c9\u5931\u6557:\" + res.status;\n                            continue;\n                          }\n                          const json = await res.json();\n                          if (json.success) {\n                            if (json.data?.exists) {\n                              return true;\n                            }\n                            continue;\n                          } else {\n                            errMsg += `${site} \u56de\u61c9\u5931\u6557: ${json.data?.message || '\u672a\u77e5\u932f\u8aa4'}\\n`;\n                          }\n                        } catch (err) {\n                          errMsg += site + \" \u547c\u53eb\u5931\u6557:\" + (err.message || err);\n                          continue;\n                        }\n                      }\n                      if(errMsg != \"\") {\n                        alert(\"\u6aa2\u67e5\u5e33\u865f\u5931\u6557\uff1a\\n\" + errMsg);\n                        return null;\n                      } else {\n                        return false;\n                      }\n                    }\n                    sendOTPBtn.addEventListener(\"click\", async function () {\n                        const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                        if(method === 'email') {\n                            checkEmailVerified();\n                        } else {\n                            const phone = iti.getNumber();\n                            if (!iti.isValidNumber()) {\n                                alert(\"\u8acb\u8f38\u5165\u6b63\u78ba\u7684\u624b\u6a5f\u865f\u78bc Enter your valid phone number\");\n                                return;\n                            }\n                            sendOTPBtn.disabled = true;\n                            sendOTPBtn.classList.add(\"loading\", \"btn-disabled\");\n                            const originalText = sendOTPBtn.innerHTML;\n                            sendOTPBtn.innerHTML = `\n                                <span class=\"spinner\"><\/span> Processing\u2026                            `;\n                            \n                            const exists = await checkUserExists(phone, 'phone');\n                            if (exists === null) {\n                                sendOTPBtn.disabled = false;\n                                sendOTPBtn.classList.remove(\"loading\", \"btn-disabled\");\n                                sendOTPBtn.innerHTML = originalText;\n                                return;\n                            }\n                            if (exists) {\n                                alert(\"\u624b\u6a5f\u96fb\u8a71\/Email\u5df2\u8a3b\u518a\u70ba\u6703\u54e1 User already registered\");\n                                sendOTPBtn.classList.remove(\"loading\");\n                                sendOTPBtn.innerHTML = originalText;\n                                return;\n                            }\n                            \n                            try {\n                                fetch(AJAX_URL, {\n                                    method: \"POST\",\n                                    headers: { 'Content-Type': 'application\/x-www-form-urlencoded' },\n                                    body: new URLSearchParams({\n                                        action: 'send_custom_otp_sms',\n                                        phone: phone\n                                    })\n                                }).then(r => r.json()).then(result => {\n                                    if (result.success) {\n                                        alert(\"\u9a57\u8b49\u78bc\u5df2\u767c\u9001\uff01 Verification code has been sent.\");\n                                        otpSection.style.display = \"block\";\n                                        const timerText = document.getElementById(\"otp-timer\");\n                                        startResendCountdown(60, sendOTPBtn, timerText);\n                                    } else {\n                                        alert(\"\u767c\u9001\u9a57\u8b49\u78bc\u5931\u6557\uff1a\" + result.data);\n                                    }\n                                });\n                            } catch (err) {\n                                alert('\u767c\u9001\u9a57\u8b49\u78bc\uff0c\u547c\u53eb\u5f8c\u53f0\u932f\u8aa4\uff1a' + err);\n                            } finally {\n                                sendOTPBtn.disabled = false;\n                                sendOTPBtn.classList.remove(\"loading\", \"btn-disabled\");\n                                sendOTPBtn.innerHTML = originalText;\n                            }\n                        }\n                    });\n\n                    function verifyOTP(otp) {\n                        const phone = iti.getNumber();\n                    \n                        if (!otp || !phone) {\n                            alert(\"\u8acb\u8f38\u5165\u624b\u6a5f\u8207\u9a57\u8b49\u78bc\\nEnter your phone number and Verification Code\");\n                            return;\n                        }\n                    \n                        const formData = new FormData();\n                        formData.append(\"action\", \"verify_otp\");\n                        formData.append(\"phone\", phone);\n                        formData.append(\"otp\", otp);\n                    \n                        fetch(AJAX_URL, {\n                            method: \"POST\",\n                            body: formData\n                        })\n                        .then(res => res.json())\n                        .then(res => {\n                            if (res.success) {\n                                alert(\"\u624b\u6a5f\u9a57\u8b49\u6210\u529f\uff01 Successfully verified\");\n                                clearInterval(countdown);\n                                verifiedPhoneInput.value = phone;\n                                sendOTPBtn.disabled = true;\n                                sendOTPBtn.classList.add(\"btn-disabled\");\n                                \/\/otpSection.style.display = \"none\";\n                                checkEnableStep2();\n                            } else {\n                                alert(\"\u9a57\u8b49\u5931\u6557\uff1a\" + (res.message || \"\u672a\u77e5\u932f\u8aa4\"));\n                            }\n                        })\n                        .catch(() => alert(\"\u767c\u9001\u5931\u6557\uff0c\u8acb\u91cd\u8a66\"));\n                    }\n\n                    const step1 = document.getElementById('step-1');\n                    const step2Btn = document.getElementById(\"go-to-step-2\");\n                    const confirmCheckbox = document.getElementById(\"confirmShowCredit\");\n                    confirmCheckbox?.addEventListener(\"input\", checkEnableStep2);\n    \n                    function verifyStep1(data = '') {\n                        const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                        let   email = \"\";\n\t\t\t\t\t    if(iti) {\n                            email = iti.getNumber();\n\t\t\t\t        } else {\n                            email = phoneInput?.value?.trim();\n\t\t\t\t        }\n                        const isValidEmail = email && \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/.test(email);\n                        const otpInput = document.getElementById(\"otp_code\");\n                        const otp = otpInput?.value?.trim();\n                        const verifiedPhone = verifiedPhoneInput?.value?.trim();\n                        const isConfirmed = confirmCheckbox?.checked;\n                        const passwordInput = document.getElementById(\"acf-custom_password\");\n                        const password = passwordInput?.value?.trim();\n                        const isValidPassword = password && password.length >= 8 && \/[a-zA-Z]\/.test(password) && \/\\d\/.test(password);\n\t\t\t\t\t    if(data != '') {\n\t\t\t\t\t        email = data;\n\t\t\t\t        }\n                        if (!verifiedPhone && !isValidEmail && otp.length == 6) {\n                            verifyOTP(otp);\n                            return false;\n                        }\n                        if (isValidPassword) {\n                            passwordInput?.classList.remove(\"field-error\");\n                        } else if(password) {\n                            passwordInput?.classList.add(\"field-error\");\n                        }\n                        if (isConfirmed) {\n                            confirmCheckbox.classList.remove(\"field-error\");\n                        } else {\n                            confirmCheckbox.classList.add(\"field-error\");\n                        }\n                        if(email && method == 'phone') {\n\t\t\t\t\t\t    if(!email.match(\/^\\+\\d{10,15}$\/)) {\n                                phoneInput?.classList.add(\"field-error\");\n\t\t\t\t\t\t    } else {\n                                phoneInput?.classList.remove(\"field-error\");\n\t\t\t\t\t\t    }\n\t\t\t\t\t\t    if (otp) {\n\t\t\t\t\t\t        if(verifiedPhone) {\n                                    otpInput?.classList.remove(\"field-error\");\n\t\t\t\t\t\t        } else {\n                                    otpInput?.classList.add(\"field-error\");\n\t\t\t\t\t\t        }\n\t\t\t\t\t\t    }\n                           return verifiedPhone && isValidPassword && isConfirmed;\n                        } else if(email && method == 'email') {\n\t\t\t\t\t\t    if(!isValidEmail) {\n                                phoneInput?.classList.add(\"field-error\");\n\t\t\t\t\t\t    } else {\n                                phoneInput?.classList.remove(\"field-error\");\n\t\t\t\t\t\t    }\n                           return isValidEmail && isValidPassword && isConfirmed;\n                        } else {\n                            phoneInput?.classList.remove(\"field-error\");\n                        }\n\t\t\t\t\t    return false;\n                    }\n    \n                    function checkEnableStep2() {\n                        if (verifyStep1()) {\n                            step2Btn.disabled = false;\n                            step2Btn.classList.remove(\"btn-disabled\");\n                            step2Btn.classList.add(\"btn-enabled\");\n                        } else {\n                            step2Btn.disabled = true;\n                            step2Btn.classList.remove(\"btn-enabled\");\n                            step2Btn.classList.add(\"btn-disabled\");\n                        }\n                    }\n                    step1.addEventListener('input', checkEnableStep2);\n                    step1.addEventListener('change', checkEnableStep2);\n    \n                    function enableStep2() {\n                        document.getElementById(\"step-1\").style.display = \"none\";\n                        document.getElementById(\"social-signup\").style.display = \"none\";\n                        document.querySelector(\".subtitle-wrapper\").style.display = \"none\";\n                        document.getElementById(\"step-2\").style.display = \"block\";\n                        document.getElementById(\"note-signup\").style.display = \"block\";\n                    }\n\n                    step2Btn.addEventListener(\"click\", async function () {\n                        if (verifyStep1()) {\n                            const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                            const nonce = document.querySelector('input[name=\"supabase_register_nonce\"]')?.value;\n                            let phone = '';\n                            let email = '';\n                            step2Btn.disabled = true;\n                            step2Btn.classList.add(\"loading\", \"btn-disabled\");\n                            const originalText = step2Btn.innerHTML;\n                            step2Btn.innerHTML = `\n                                <span class=\"spinner\"><\/span> Processing\u2026                            `;\n\n                            if(method == 'email') {\n                                email = phoneInput?.value.trim();\n                                \n                                const exists = await checkUserExists(email, 'email');\n                                if (exists === null) {\n                                    step2Btn.disabled = false;\n                                    step2Btn.classList.remove(\"loading\", \"btn-disabled\");\n                                    step2Btn.innerHTML = originalText;\n                                    return;\n                                }\n                                if (exists) {\n                                    alert(\"\u624b\u6a5f\u96fb\u8a71\/Email\u5df2\u8a3b\u518a\u70ba\u6703\u54e1 User already registered\");\n                                    step2Btn.classList.remove(\"loading\");\n                                    step2Btn.innerHTML = originalText;\n                                    return;\n                                }\n                                \n                            } else {\n                                phone = iti.getNumber();\n                            }\n                            const password = document.getElementById('acf-custom_password').value.trim();\n                            const formData = new FormData();\n                            formData.append(\"action\", \"supabase_ajax_register\");\n                            formData.append(\"phone\", phone);\n                            formData.append(\"email\", email);\n                            formData.append(\"password\", password);\n                            formData.append(\"supabase_register_nonce\", nonce);\n                            try {\n                                const response = await fetch(AJAX_URL, {\n                                    method: \"POST\",\n                                    body: formData\n                                });\n                                const result = await response.json();\n                                const data = result.data;\n                                if (result.success) {\n                                    document.getElementById('supabase_uid').value = data?.user_id || '';\n                                    document.getElementById('supabase_token').value = data?.token || '';\n                                    if(method == 'email') {\n                                        document.getElementById('verify-phone-label').innerHTML = \"<span class='line'>Please check your email inbox and click the link in<\/span><span class='line'>the verification email to confirm your email address.<\/span>\";\n                                        document.getElementById('send-otp').innerText = 'I have clicked the link in the verification email.';\n                                        document.getElementById('send-otp').style.display = 'block';\n                                        document.getElementById('send-otp').disabled = false;; \/\/\u4fdd\u96aa\n                                    } else {\n                                        enableStep2();\n                                    }\n                                } else {\n                                    let msg = (result.data?.message || \"\u8a3b\u518a\u5931\u6557\");\n                                    if(msg.includes(\"User already registered\")) {\n                                        msg = \"\u624b\u6a5f\u96fb\u8a71\/Email\u5df2\u8a3b\u518a\u70ba\u6703\u54e1 User already registered\";\n                                    }\n                                    alert(\"\u8a3b\u518a\u932f\u8aa4\uff1a\" + msg);\n                                }\n                            } catch (error) {\n                              alert(\"\u8acb\u6c42\u932f\u8aa4\uff1a\" + error);\n                            } finally {\n                                step2Btn.disabled = false;\n                                step2Btn.classList.remove(\"loading\", \"btn-disabled\");\n                                step2Btn.innerHTML = originalText;\n                            }\n                        }\n                    });\n    \n                    document.querySelectorAll('input[type=\"radio\"][name=\"acf[field_687db6613103a]\"]').forEach(radio => {\n                        const handleDown = () => {\n                            if (radio.checked) {\n                                radio.dataset.wasChecked = \"true\";\n                            } else {\n                                delete radio.dataset.wasChecked;\n                            }\n                        };                  \n                        const handleClick = () => {\n                            if (radio.dataset.wasChecked === \"true\") {\n                                radio.checked = false;\n                                delete radio.dataset.wasChecked;\n                            }\n                        };\n                        radio.addEventListener('mousedown', handleDown);\n                        radio.addEventListener('touchstart', handleDown, { passive: true });\n                        radio.addEventListener('click', handleClick);\n                    });\n    \n                    const submitBtn = document.getElementById(\"register-submit\");\n                    const step2 = document.getElementById('step-2');\n                    const requiredFields = Array.from(\n                        step2.querySelectorAll('input[required], textarea[required], select[required], .acf-required input, .acf-required textarea, .acf-required select')\n                    );\n\n                    function validateField(field) {\n                        const type = field.type;\n                        let valid = true;\n                        if (type === 'radio') {\n                            const name = field.name;\n                            const group = step2.querySelectorAll(`input[type=\"radio\"][name=\"${CSS.escape(name)}\"]`);\n                            const anyChecked = Array.from(group).some(el => el.checked);\n                            valid = anyChecked;\n                            group.forEach(el => el.classList.toggle('field-error', !valid));\n                        } else if (type === 'checkbox') {\n                            valid = field.checked;\n                            field.classList.toggle('field-error', !valid);\n                        } else {\n                            const v = (field.value || '').trim();\n                            valid = v.length > 0;\n                            field.classList.toggle('field-error', !valid);\n                        }                  \n                        return valid;\n                    }\n\n                    function updateSubmitState() {\n                        const allValid = requiredFields.every(validateField);\n                        if (allValid) {\n                            submitBtn.disabled = false;\n                            submitBtn.classList.remove('btn-disabled');\n                            submitBtn.classList.add('btn-enabled');\n                        } else {\n                            submitBtn.disabled = true;\n                            submitBtn.classList.add('btn-disabled');\n                            submitBtn.classList.remove('btn-enabled');\n                        }\n                    }\n\n                    requiredFields.forEach(field => {\n                        const handler = () => {\n                            validateField(field);\n                            updateSubmitState();\n                        };\n                        field.addEventListener('input', handler);\n                        field.addEventListener('change', handler);\n                        if (field.type === 'radio') {\n                            const group = step2.querySelectorAll(`input[type=\"radio\"][name=\"${CSS.escape(field.name)}\"]`);\n                            group.forEach(radio => {\n                                radio.addEventListener('change', handler);\n                            });\n                        }\n                    });\n\n                    const urlParams = new URLSearchParams(window.location.search);\n                    const fromOAuth = urlParams.get(\"from_oauth\");\n                    const token = urlParams.get(\"token\");\n                    const sid = urlParams.get(\"sid\");\n                    if(token && sid) {\n                        const emailP = \"\"; \n                        const phoneP = \"\"; \n                        const passwordP = \"\"; \n\t\t\t\t\t\tlet data = phoneP;\n                        if(emailP) {\n                            phoneInput.value = emailP;\n\t\t\t\t\t\t\tdata = emailP;\n                        } else {\n\t\t\t\t\t\t\titi.setNumber(phoneP);\n                            verifiedPhoneInput.value = phoneP;\n                        }\n                        document.getElementById('acf-custom_password').value = passwordP;\n                        confirmCheckbox.checked = true;\n                        if (verifyStep1(data)) {\n                            enableStep2();\n                        }\n                    } else if (fromOAuth && sessionStorage.getItem(\"register_submitted\") == \"0\") {\n                        client.auth.onAuthStateChange((event, session) => {\n                            if (event === \"SIGNED_IN\" && session?.user && session?.access_token) {\n                                document.getElementById('supabase_uid').value = session.user.id;\n                                document.getElementById('supabase_token').value = session.access_token;\n                                document.getElementById('acf-custom_email_phone').value = session.user.email || \"\";\n                                document.getElementById('acf-custom_password').value = \"\";\n                            }\n                        });\n                        enableStep2();\n                    } else {\n                        sessionStorage.removeItem(\"register_submitted\");\n                    }\n                });\n            <\/script>\n            [\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"            <div class=\"form-wrapper\">\n                <div class=\"title-wrapper\">\n                  <div class=\"main-title\">\n                    Master, I want to say something to you...                  <\/div>\n                  <div class=\"subtitle-wrapper\">\n                    <div class=\"subtitle-text\">\n                        In just a few steps, your heartfelt words to Master can be seen by the whole world!                    <\/div>\n                  <\/div>\n                <\/div>\n                <div class=\"custom-register-form\">\n                    <form method=\"post\" action=\"\" id=\"supabase-register-form\">\n                        <input type=\"hidden\" id=\"supabase_register_nonce\" name=\"supabase_register_nonce\" value=\"3da377c0a5\" \/><input type=\"hidden\" name=\"_wp_http_referer\" value=\"\/en\/wp-json\/wp\/v2\/pages\/320805\" \/>                        <div id=\"step-1\">\n                            <div class=\"contact-type-wrapper\">\n\t    \t    \t\t\t    <label for=\"contact_type\" class=\"form-label\" style=\"display:block;\">Please choose your registration method<\/label>\n\t\t\t\t\t\t\t\t<div style=\"display:flex;justify-content:flex-end;\">\n                                    <!-- <div class=\"login-link\">&quot;Already a member? Click here to sign in&quot;<\/div> -->\t\n                                    <a href=\"https:\/\/culture.daaimobile.org\/en\/join-us\/\" class=\"login-link\" style=\"color:#000\">&quot;Already a member? Click here to sign in&quot;<\/a>\n\t\t\t\t\t\t\t\t<\/div>\n                                <div style=\"margin-top:1em;\">\n                                    <label class=\"form-label\"><input type=\"radio\" name=\"contact_type\" value=\"phone\" onchange=\"switchMethod()\" checked \/>Phone<\/label>\n                                    <label class=\"form-label\"><input type=\"radio\" name=\"contact_type\" value=\"email\" onchange=\"switchMethod()\" \/>Email<\/label>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom: 1em;\">\n                                <div class=\"acf-custom-wrapper input-button-row\" style=\"margin-bottom:1em;\">\n                                    <input type=\"text\" name=\"acf[custom_email_phone]\" id=\"acf-custom_email_phone\" placeholder=\"Please enter your phone number\" \/>\n                                <\/div>\n     \t    \t    \t\t\t<label id=\"verify-phone-label\" for=\"acf[custom_email_phone]\" >\n                                    <span class=\"line\">After entering,<\/span>\n                                    <span class=\"line\">please click the [Send Verification Code] button\u25bc<\/span>\n                                <\/label>\n                                <button type=\"button\" id=\"send-otp\" class=\"btn-center\" >Send verification code<\/button>\n                            <\/div>\n                            <div id=\"otp-section\" style=\"margin-bottom: 1em;\">\n\t    \t    \t\t\t\t<label for=\"otp_code\" class=\"form-label\">Enter the verification code you received<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <input type=\"text\" id=\"otp_code\" name=\"otp_code\" placeholder=\"Enter your verification code\" maxlength=\"6\" \/>\n                                <\/div>\n                                <p id=\"otp-timer\" style=\"text-align:center; margin-top:0.5em; color: #888;\"><\/p>\n                            <\/div>\n                            <input type=\"hidden\" name=\"verified_phone\" id=\"verified_phone\" value=\"\">\n                            <div style=\"margin-bottom: 1em;\">\n\t    \t    \t\t\t\t<label for=\"acf[custom_password]\" class=\"form-label required\">Set a password<\/label>\n                                <div class=\"acf-password-wrapper\">\n                                    <div class=\"acf-custom-wrapper input-button-row\" id=\"acf-custom-password-wrapper\">\n                                        <input type=\"password\" name=\"acf[custom_password]\" id=\"acf-custom_password\" placeholder=\"8 characters, letters and numbers, case insensitive\" \/>\n                                    <\/div>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;display:inline-flex;align-items:flex-start\">\n                                <input type=\"checkbox\" id=\"confirmShowCredit\" name=\"confirmShowCredit\" style=\"transform:scale(1.6);margin-left:20px;margin-top:6px;\">\n                                <label id=\"agreement\" for=\"confirmShowCredit\" class=\"form-label agree required\" style=\"margin-left:0.5em!important;\"><span class=\"line\">I have read and agree to the<\/span>\n                                    <span class=\"line\" style=\"display:inline;\"><a href=\"https:\/\/dharma.daai.tv\/wp-content\/uploads\/2025\/07\/private.pdf\" target=\"_blank\" >Data Collection Consent Form<\/a><\/span>\n                                <\/label>\n                            <\/div>\n                            <input type=\"hidden\" name=\"supabase_uid\" id=\"supabase_uid\" \/>\n                            <input type=\"hidden\" name=\"supabase_token\" id=\"supabase_token\" \/>\n                            <input type=\"hidden\" name=\"display_name\" id=\"display_name\" value=\"\" \/>\n                            <input type=\"hidden\" name=\"picture\" id=\"picture\"  value=\"\" \/>\n                            <button type=\"button\" id=\"go-to-step-2\" class=\"btn-disabled\" disabled >Confirm and Continue<\/button>\n                        <\/div>\n                        <div id=\"step-2\" style=\"display:none;\">\n                            <div style=\"margin-bottom:1em;\">\n\t    \t    \t\t\t\t<label for=\"acf[custom_username]\" class=\"form-label required\">Tell Master your name<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <input type=\"text\" name=\"acf[custom_username]\" id=\"acf-custom_username\" required \/>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;\">\n                                <label for=\"acf-field_682d66cb8755b\" class=\"form-label required\">Tell Master where you are from<\/label>\n                                <div id=\"location\" class=\"acf-custom-wrapper input-button-row two-column\">\n                                    <input type=\"text\" id=\"acf-field_682d66cb8755b\" name=\"acf[field_682d66cb8755b]\" class=\"field\" placeholder=\"\u570b\u5bb6\u3001\u5730\u5340 Country\u3001Region\" required \/>\n                                    <!-- <input type=\"text\" id=\"acf-field_682d670c8755c\" name=\"acf[field_682d670c8755c]\" class=\"field\" style=\"display:none;\" placeholder=\"\u57ce\u5e02 City\" \/> -->\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;\">\n                                <label for=\"acf-field_687db6613103a\" class=\"form-label\">How did you get to know Tzu Chi?<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <ul class=\"radio-list acf-custom-wrapper\">\n                                        <li>\n                                            <label class=\"radio-label\"><input type=\"radio\" name=\"acf[field_687db6613103a]\" value=\"\u6211\u662f\u6148\u6fdf\u5fd7\u5de5\" style=\"transform:scale(1.6);margin-left:20px;font-size:1.4em;\" \/>I am a Tzu Chi volunteer<\/label>\n                                        <\/li>\n                                        <li>\n                                            <label class=\"radio-label\"><input type=\"radio\" name=\"acf[field_687db6613103a]\" value=\"\u6211\u53c3\u8207\u904e\u6148\u6fdf\u6d3b\u52d5\" style=\"transform:scale(1.6);margin-left:20px;font-size:1.4em;\" \/>I have participated in Tzu Chi activities<\/label>\n                                        <\/li>\n                                        <li>\n                                            <label class=\"radio-label\"><input type=\"radio\" name=\"acf[field_687db6613103a]\" value=\"\u6211\u5c0d\u6148\u6fdf\u6709\u8208\u8da3\u4e86\u89e3\" style=\"transform:scale(1.6);margin-left:20px;font-size:1.4em;\" \/>I am interested in learning about Tzu Chi<\/label>\n                                        <\/li>\n                                    <\/ul>\n                                <\/div>\n                            <\/div>\n                            <div style=\"margin-bottom:1em;\">\n                                <label for=\"acf-field_682d67298755d\" class=\"form-label required\">Write your heartfelt words to Master<\/label>\n                                <div class=\"acf-custom-wrapper input-button-row\">\n                                    <textarea id=\"acf-field_682d67298755d\" name=\"acf[field_682d67298755d]\" placeholder=\"(Within 30 characters, only one message per person)\" rows=\"5\" class=\"textarea\" maxlength=\"45\" required ><\/textarea>\n                                <\/div>\n                            <\/div>\n                            <input type=\"submit\" id=\"register-submit\" name=\"custom_register_submit\" value=\"Submit Message\" class=\"register-btn btn-disabled\" disabled \/>\n                        <\/div>\n                    <\/form>\n                <\/div>\n                <div id=\"social-signup\" style=\"margin-top:2em;display:none;\">\n                    <p>Or register with<\/p>\n                    <div style=\"text-align:center;padding-top:0.5em;padding-bottom:2em;\">\n                        <button type=\"button\" class=\"social-login-button\" onclick=\"loginWithProvider('line')\">\n                          <img decoding=\"async\" src=\"https:\/\/culture.daaimobile.org\/wp-content\/plugins\/supabase-register-loginer\/assets\/LINE.png\" alt=\"LINE Icon\" \/>\n                        <\/button>\n                        <button type=\"button\" class=\"social-login-button\" onclick=\"loginWithProvider('facebook')\">\n                          <img decoding=\"async\" src=\"https:\/\/culture.daaimobile.org\/wp-content\/plugins\/supabase-register-loginer\/assets\/FB.png\" alt=\"Facebook Icon\" \/>\n                        <\/button>                        \n                        <button type=\"button\" class=\"social-login-button\" onclick=\"loginWithProvider('google')\">\n                          <img decoding=\"async\" src=\"https:\/\/culture.daaimobile.org\/wp-content\/plugins\/supabase-register-loginer\/assets\/GOOGLE.png\" alt=\"Google Icon\" \/>\n                        <\/button>                        \n                    <\/div>\n                <\/div>\n                <div id=\"note-signup\" class=\"note-signup\" >\n                    <p>*By clicking [Submit Message], you agree to make your message and location public on this site.<br \/>\n*Your message will be published after editorial review.<\/p>\n                <\/div>\n            <\/div>\n            <link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/css\/intlTelInput.min.css\" \/>\n            <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/js\/intlTelInput.min.js\"><\/script>\n            <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@supabase\/supabase-js@2\"><\/script>\n            <script>\n                const client = supabase.createClient(\"https:\/\/jxnqpnlyieukvpehurgl.supabase.co\", \"sb_publishable_vb5kvkB5cSa-M6oq5iUDtQ_dJuDKZs5\");\n                async function loginWithProvider(provider) {\n                    const confirmCheckbox = document.getElementById(\"confirmShowCredit\");\n                    const isConfirmed = confirmCheckbox?.checked;\n                    if (isConfirmed) {\n                        if(provider == 'line') {\n                            window.location.href='https:\/\/s.no8.io\/link\/channels\/qLITg7BLoq';\n                        } else {\n                            confirmCheckbox.classList.remove(\"field-error\");\n                            const redirectUrl = window.location.origin + window.location.pathname + \"?from_oauth=1\";\n                            const { data, error } = await client.auth.signInWithOAuth({\n                                provider: provider,\n                                options: {\n                                    redirectTo: redirectUrl\n                                }\n                            });\n                            if (error) {\n                                alert('\u793e\u7fa4\u8a3b\u518a\u932f\u8aa4\uff1a' + error.message);\n                            } else {\n                                sessionStorage.setItem(\"register_submitted\", \"0\");\n                            }\n                        }\n                    } else {\n                        confirmCheckbox.classList.add(\"field-error\");\n                        alert(\"Please check &quot;I have read and agree to the Data Collection Consent Form&quot; first\");\n                    }\n                }\n                const regions = {\n                    \"Taiwan\": [\"\u81fa\u5317\u5e02\", \"\u65b0\u5317\u5e02\", \"\u6843\u5712\u5e02\", \"\u81fa\u4e2d\u5e02\", \"\u81fa\u5357\u5e02\", \"\u9ad8\u96c4\u5e02\", \"\u57fa\u9686\u5e02\", \"\u65b0\u7af9\u5e02\", \"\u5609\u7fa9\u5e02\", \"\u65b0\u7af9\u7e23\", \"\u82d7\u6817\u7e23\", \"\u5f70\u5316\u7e23\",\n                               \"\u5357\u6295\u7e23\", \"\u96f2\u6797\u7e23\", \"\u5609\u7fa9\u7e23\", \"\u5c4f\u6771\u7e23\", \"\u5b9c\u862d\u7e23\", \"\u82b1\u84ee\u7e23\", \"\u81fa\u6771\u7e23\", \"\u6f8e\u6e56\u7e23\", \"\u91d1\u9580\u7e23\", \"\u9023\u6c5f\u7e23\" ],\n                }\n                function createRegionSelect(key, container) {\n                  if (!regions[key]) {\n                    container.textContent = `\u627e\u4e0d\u5230 ${key} \u7684\u5730\u5340\u8cc7\u6599`;\n                    return;\n                  }                \n                  const select = document.createElement('select');\n                  select.name = 'acf[field_682d670c8755c]';\n                  select.id = 'acf-field_682d670c8755c';\n                  select.style.display = 'none';\n                  select.classList.add('field');\n                  const defaultOption = document.createElement('option');\n                  defaultOption.value = '';\n                  defaultOption.textContent = '\u8acb\u9078\u64c7\u57ce\u5e02';\n                  select.appendChild(defaultOption);\n                  regions[key].forEach(region => {\n                    const option = document.createElement('option');\n                    option.value = region;\n                    option.textContent = region;\n                    select.appendChild(option);\n                  });                \n                  container.appendChild(select);\n                }\n                const locationRow  = document.getElementById('location');\n                createRegionSelect(\"Taiwan\", locationRow);\n                const phoneInput = document.getElementById(\"acf-custom_email_phone\");\n                const countryInput = document.getElementById('acf-field_682d66cb8755b');\n                const regionInput  = document.getElementById('acf-field_682d670c8755c');\n                const i18n = {\n                    selectedCountryAriaLabel: \"\u9078\u64c7\u570b\u5bb6\u3001\u5730\u5340\",\n                    noCountrySelected: \"\u7121\u570b\u5bb6\u3001\u5730\u5340\u5099\u9078\",\n                    countryListAriaLabel: \"\u570b\u5bb6\u3001\u5730\u5340\u6e05\u55ae\",\n                    searchPlaceholder: \"\u641c\u5c0b\",\n                    zeroSearchResults: \"\u7121\u641c\u5c0b\u7d50\u679c\",\n                    oneSearchResult: \"\u641c\u5c0b\u5230 1 \u500b\u7d50\u679c\",\n                    multipleSearchResults: \"\u641c\u5c0b\u5230 ${count} \u500b\u7d50\u679c\",\n                }\n                let iti = null;\n                function initPhoneIti() {\n                    iti = window.intlTelInput(phoneInput, {\n                        initialCountry: \"tw\",\n                        countryOrder: [\"tw\", \"us\", \"cn\", \"hk\", \"sg\", \"my\", \"id\", \"jp\"],\n                        i18n: i18n,\n\t\t\t\t\t    loadUtils: () => import(\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/js\/utils.js\")\n                    });\n\t\t\t\t}\n                const itic = window.intlTelInput(countryInput, {\n                    initialCountry: \"auto\",\n                    countryOrder: [\"tw\", \"us\", \"cn\", \"hk\", \"sg\", \"my\", \"id\", \"jp\"],\n                    i18n: i18n,\n\t\t\t\t\tloadUtils: () => import(\"https:\/\/cdn.jsdelivr.net\/npm\/intl-tel-input@25.3.2\/build\/js\/utils.js\")\n                });\n                countryInput.style.paddingLeft = \"88px\";\n                countryInput.addEventListener('countrychange', () => {\n                    const data = itic.getSelectedCountryData();\n                    if (data && data.name) {\n                        countryInput.value = data.name;\n\t\t\t\t  \t    if(data.name == \"Taiwan\") {\n                            regionInput.style.display = \"\";\n                            locationRow.classList.add('show-region');\n\t\t\t\t  \t    }\n                    } else {\n                        countryInput.value = \"\";\n                        regionInput.style.display = \"none\";\n                        locationRow.classList.remove('show-region');\n                    }\n                });\n                countryInput.addEventListener('input', () => {\n                    const data = countryInput.value.trim();\n                    if (!data) {\n                        regionInput.style.display = \"none\";\n                        locationRow.classList.remove('show-region');\n                        try { itic.setCountry(''); } catch (e) {}\n                    } else if(data == \"Taiwan\" || data == \"\u53f0\u7063\" || data == \"\u81fa\u7063\") {\n                        regionInput.style.display = \"\";\n                        locationRow.classList.add('show-region');\n                    }\n                });\n                function switchMethod() {\n                    const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                    if(method === 'email') {\n\t\t\t\t\t\titi.destroy();\n\t\t\t\t\t\titi = null;\n\t\t\t\t\t\tphoneInput.style.padding = \"10px\";\n                        document.getElementById('send-otp').style.display = 'none';\n                        document.getElementById('otp-section').style.display = 'none';\n                        document.getElementById('verify-phone-label').innerHTML = \"\";\n                        document.getElementById('acf-custom_email_phone').placeholder=\"Please enter your email address\";\n                    } else {\n                        initPhoneIti();\n\t\t\t\t\t\tphoneInput.style.padding = \"\";\n\t\t\t\t\t\tphoneInput.style.paddingLeft = \"88px\";\n                        document.getElementById('send-otp').style.display = 'block';\n                        document.getElementById('otp-section').style.display = 'block';\n                        document.getElementById('verify-phone-label').innerHTML = \"<span class='line'>After entering,<\/span><span class='line'>please click the [Send Verification Code] button\u25bc<\/span>\";\n                        document.getElementById('acf-custom_email_phone').placeholder=\"Please enter your phone number\";\n                    }\n                }\n                document.addEventListener('DOMContentLoaded', function () {\n                    const wrapper = document.querySelector('.acf-password-wrapper');\n                    if (wrapper) {\n                        const input = wrapper.querySelector('input[type=\"password\"], input[type=\"text\"]');\n                        if (input) {\n                            const button = document.createElement('button');\n                            button.type = 'button';\n                            button.className = 'dashicons dashicons-visibility acf-toggle-password';\n                            button.setAttribute('aria-label', '\u5207\u63db\u5bc6\u78bc\u53ef\u898b');\n                            button.addEventListener('click', function () {\n                                const isPassword = input.type === 'password';\n                                input.type = isPassword ? 'text' : 'password';\n                                button.classList.toggle('dashicons-visibility');\n                                button.classList.toggle('dashicons-hidden');\n                            });\n                            wrapper.style.position = 'relative';\n                            wrapper.appendChild(button);\n                        }\n                    }\n                    switchMethod();\n\n                    const phoneInput = document.getElementById(\"acf-custom_email_phone\");\n                    const sendOTPBtn = document.getElementById(\"send-otp\");\n                    const verifyOTPBtn = document.getElementById(\"verify-otp\");\n                    const otpSection = document.getElementById(\"otp-section\");\n                    const verifiedPhoneInput = document.getElementById(\"verified_phone\");\n                    let countdown = null;\n\n                    function startResendCountdown(duration, button, timerText) {\n                        let seconds = duration;\n                        button.disabled = true;\n                        button.classList.add(\"btn-disabled\");\n                        button.style.opacity = 0.6;\n                        timerText.textContent = seconds + ' ' + ` seconds remaining before you can resend`;\n                    \n                        countdown = setInterval(() => {\n                            seconds--;\n                            if (seconds <= 0) {\n                                clearInterval(countdown);\n                                timerText.textContent = '';\n                                button.disabled = false;\n                                button.classList.remove(\"btn-disabled\");\n                                button.style.opacity = 1;\n                                button.textContent = 'Resend verification code';\n                            } else {\n                                timerText.textContent = seconds + ' ' + ` seconds remaining before you can resend`;\n                            }\n                        }, 1000);\n                    }\n\n                    async function checkEmailVerified() {\n                        const userId = document.getElementById('supabase_uid')?.value;\n                        const nonce = document.querySelector('input[name=\"supabase_register_nonce\"]')?.value;\n                    \n                        const formData = new FormData();\n                        formData.append('action', 'supabase_check_email_verified'); \n                        formData.append('user_id', userId);\n                        formData.append('supabase_register_nonce', nonce);\n                        sendOTPBtn.disabled = true;\n                        sendOTPBtn.classList.add(\"loading\");\n                        const originalText = sendOTPBtn.innerHTML;\n                        sendOTPBtn.innerHTML = `\n                            <span class=\"spinner\"><\/span> Processing\u2026                        `;\n                    \n                        try {\n                            const resp = await fetch(\"https:\/\/culture.daaimobile.org\/wp-admin\/admin-ajax.php\", {\n                                method: 'POST',\n                                body: formData\n                            });\n                            const result = await resp.json();\n                            if (result.success) {\n                                if(result.data.email_confirmed) {\n                                    enableStep2();\n                                } else {\n                                    alert(\"\u60a8\u5c1a\u672a\u9a57\u8b49\u96fb\u5b50\u4fe1\u7bb1\uff0c\u8acb\u81f3\u60a8\u7684\u96fb\u5b50\u4fe1\u7bb1\u9ede\u64ca\u300c\u9a57\u8b49\u90f5\u4ef6\u300d\u7684\u9023\u7d50\uff0c\u4ee5\u78ba\u8a8d\u96fb\u5b50\u4fe1\u7bb1\u5730\u5740\\nYour email address has not been verified. Please check your inbox and click the link in the verification email to confirm your email address.\");\n                                }\n                            } else {\n                                alert(\"\u53d6\u5f97\u8a3b\u518a\u8cc7\u6599\u5931\u6557\uff0c\u8acb\u518d\u8a66\u4e00\u6b21\u6216\u806f\u7d61\u5ba2\u670d\uff1a\\nFailed to retrieve registration data. Please try again or contact customer service\uff1a\\n\" + (result.data?.message ?? '\u672a\u77e5\u932f\u8aa4'));\n                            }\n                        } catch (err) {\n                            alert('\u547c\u53eb\u5f8c\u53f0\u932f\u8aa4\uff1a' + err);\n                        } finally {\n                            sendOTPBtn.disabled = false;\n                            sendOTPBtn.classList.remove(\"loading\");\n                            sendOTPBtn.innerHTML = originalText;\n                        }\n                    }\n\n                    const AJAX_URL = \"https:\/\/culture.daaimobile.org\/wp-admin\/admin-ajax.php\";\n                    async function checkUserExists(value, type) {\n                      const sites = [\n                        \"https:\/\/tzuchiculture.org\",\n                        \"https:\/\/dharma.daai.tv\",\n                        \/\/\"https:\/\/crm.daaimobile.org\"\n                      ];\n                      let errMsg = \"\";\n                      for (let site of sites) {\n                        try {\n                          const apiUrl = site.replace(\/\\\/$\/, '') + '\/wp-json\/supabase-sso\/v1\/check_user_exists';\n                          const res = await fetch(apiUrl, {\n                            method: \"POST\",\n                            headers: {\n                              \"Content-Type\": \"application\/json\",\n                            },\n                            body: JSON.stringify({ value, type })\n                          });\n                          if (!res.ok) {\n                            errMsg += site + \" \u56de\u61c9\u5931\u6557:\" + res.status;\n                            continue;\n                          }\n                          const json = await res.json();\n                          if (json.success) {\n                            if (json.data?.exists) {\n                              return true;\n                            }\n                            continue;\n                          } else {\n                            errMsg += `${site} \u56de\u61c9\u5931\u6557: ${json.data?.message || '\u672a\u77e5\u932f\u8aa4'}\\n`;\n                          }\n                        } catch (err) {\n                          errMsg += site + \" \u547c\u53eb\u5931\u6557:\" + (err.message || err);\n                          continue;\n                        }\n                      }\n                      if(errMsg != \"\") {\n                        alert(\"\u6aa2\u67e5\u5e33\u865f\u5931\u6557\uff1a\\n\" + errMsg);\n                        return null;\n                      } else {\n                        return false;\n                      }\n                    }\n                    sendOTPBtn.addEventListener(\"click\", async function () {\n                        const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                        if(method === 'email') {\n                            checkEmailVerified();\n                        } else {\n                            const phone = iti.getNumber();\n                            if (!iti.isValidNumber()) {\n                                alert(\"\u8acb\u8f38\u5165\u6b63\u78ba\u7684\u624b\u6a5f\u865f\u78bc Enter your valid phone number\");\n                                return;\n                            }\n                            sendOTPBtn.disabled = true;\n                            sendOTPBtn.classList.add(\"loading\", \"btn-disabled\");\n                            const originalText = sendOTPBtn.innerHTML;\n                            sendOTPBtn.innerHTML = `\n                                <span class=\"spinner\"><\/span> Processing\u2026                            `;\n                            \n                            const exists = await checkUserExists(phone, 'phone');\n                            if (exists === null) {\n                                sendOTPBtn.disabled = false;\n                                sendOTPBtn.classList.remove(\"loading\", \"btn-disabled\");\n                                sendOTPBtn.innerHTML = originalText;\n                                return;\n                            }\n                            if (exists) {\n                                alert(\"\u624b\u6a5f\u96fb\u8a71\/Email\u5df2\u8a3b\u518a\u70ba\u6703\u54e1 User already registered\");\n                                sendOTPBtn.classList.remove(\"loading\");\n                                sendOTPBtn.innerHTML = originalText;\n                                return;\n                            }\n                            \n                            try {\n                                fetch(AJAX_URL, {\n                                    method: \"POST\",\n                                    headers: { 'Content-Type': 'application\/x-www-form-urlencoded' },\n                                    body: new URLSearchParams({\n                                        action: 'send_custom_otp_sms',\n                                        phone: phone\n                                    })\n                                }).then(r => r.json()).then(result => {\n                                    if (result.success) {\n                                        alert(\"\u9a57\u8b49\u78bc\u5df2\u767c\u9001\uff01 Verification code has been sent.\");\n                                        otpSection.style.display = \"block\";\n                                        const timerText = document.getElementById(\"otp-timer\");\n                                        startResendCountdown(60, sendOTPBtn, timerText);\n                                    } else {\n                                        alert(\"\u767c\u9001\u9a57\u8b49\u78bc\u5931\u6557\uff1a\" + result.data);\n                                    }\n                                });\n                            } catch (err) {\n                                alert('\u767c\u9001\u9a57\u8b49\u78bc\uff0c\u547c\u53eb\u5f8c\u53f0\u932f\u8aa4\uff1a' + err);\n                            } finally {\n                                sendOTPBtn.disabled = false;\n                                sendOTPBtn.classList.remove(\"loading\", \"btn-disabled\");\n                                sendOTPBtn.innerHTML = originalText;\n                            }\n                        }\n                    });\n\n                    function verifyOTP(otp) {\n                        const phone = iti.getNumber();\n                    \n                        if (!otp || !phone) {\n                            alert(\"\u8acb\u8f38\u5165\u624b\u6a5f\u8207\u9a57\u8b49\u78bc\\nEnter your phone number and Verification Code\");\n                            return;\n                        }\n                    \n                        const formData = new FormData();\n                        formData.append(\"action\", \"verify_otp\");\n                        formData.append(\"phone\", phone);\n                        formData.append(\"otp\", otp);\n                    \n                        fetch(AJAX_URL, {\n                            method: \"POST\",\n                            body: formData\n                        })\n                        .then(res => res.json())\n                        .then(res => {\n                            if (res.success) {\n                                alert(\"\u624b\u6a5f\u9a57\u8b49\u6210\u529f\uff01 Successfully verified\");\n                                clearInterval(countdown);\n                                verifiedPhoneInput.value = phone;\n                                sendOTPBtn.disabled = true;\n                                sendOTPBtn.classList.add(\"btn-disabled\");\n                                \/\/otpSection.style.display = \"none\";\n                                checkEnableStep2();\n                            } else {\n                                alert(\"\u9a57\u8b49\u5931\u6557\uff1a\" + (res.message || \"\u672a\u77e5\u932f\u8aa4\"));\n                            }\n                        })\n                        .catch(() => alert(\"\u767c\u9001\u5931\u6557\uff0c\u8acb\u91cd\u8a66\"));\n                    }\n\n                    const step1 = document.getElementById('step-1');\n                    const step2Btn = document.getElementById(\"go-to-step-2\");\n                    const confirmCheckbox = document.getElementById(\"confirmShowCredit\");\n                    confirmCheckbox?.addEventListener(\"input\", checkEnableStep2);\n    \n                    function verifyStep1(data = '') {\n                        const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                        let   email = \"\";\n\t\t\t\t\t    if(iti) {\n                            email = iti.getNumber();\n\t\t\t\t        } else {\n                            email = phoneInput?.value?.trim();\n\t\t\t\t        }\n                        const isValidEmail = email && \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/.test(email);\n                        const otpInput = document.getElementById(\"otp_code\");\n                        const otp = otpInput?.value?.trim();\n                        const verifiedPhone = verifiedPhoneInput?.value?.trim();\n                        const isConfirmed = confirmCheckbox?.checked;\n                        const passwordInput = document.getElementById(\"acf-custom_password\");\n                        const password = passwordInput?.value?.trim();\n                        const isValidPassword = password && password.length >= 8 && \/[a-zA-Z]\/.test(password) && \/\\d\/.test(password);\n\t\t\t\t\t    if(data != '') {\n\t\t\t\t\t        email = data;\n\t\t\t\t        }\n                        if (!verifiedPhone && !isValidEmail && otp.length == 6) {\n                            verifyOTP(otp);\n                            return false;\n                        }\n                        if (isValidPassword) {\n                            passwordInput?.classList.remove(\"field-error\");\n                        } else if(password) {\n                            passwordInput?.classList.add(\"field-error\");\n                        }\n                        if (isConfirmed) {\n                            confirmCheckbox.classList.remove(\"field-error\");\n                        } else {\n                            confirmCheckbox.classList.add(\"field-error\");\n                        }\n                        if(email && method == 'phone') {\n\t\t\t\t\t\t    if(!email.match(\/^\\+\\d{10,15}$\/)) {\n                                phoneInput?.classList.add(\"field-error\");\n\t\t\t\t\t\t    } else {\n                                phoneInput?.classList.remove(\"field-error\");\n\t\t\t\t\t\t    }\n\t\t\t\t\t\t    if (otp) {\n\t\t\t\t\t\t        if(verifiedPhone) {\n                                    otpInput?.classList.remove(\"field-error\");\n\t\t\t\t\t\t        } else {\n                                    otpInput?.classList.add(\"field-error\");\n\t\t\t\t\t\t        }\n\t\t\t\t\t\t    }\n                           return verifiedPhone && isValidPassword && isConfirmed;\n                        } else if(email && method == 'email') {\n\t\t\t\t\t\t    if(!isValidEmail) {\n                                phoneInput?.classList.add(\"field-error\");\n\t\t\t\t\t\t    } else {\n                                phoneInput?.classList.remove(\"field-error\");\n\t\t\t\t\t\t    }\n                           return isValidEmail && isValidPassword && isConfirmed;\n                        } else {\n                            phoneInput?.classList.remove(\"field-error\");\n                        }\n\t\t\t\t\t    return false;\n                    }\n    \n                    function checkEnableStep2() {\n                        if (verifyStep1()) {\n                            step2Btn.disabled = false;\n                            step2Btn.classList.remove(\"btn-disabled\");\n                            step2Btn.classList.add(\"btn-enabled\");\n                        } else {\n                            step2Btn.disabled = true;\n                            step2Btn.classList.remove(\"btn-enabled\");\n                            step2Btn.classList.add(\"btn-disabled\");\n                        }\n                    }\n                    step1.addEventListener('input', checkEnableStep2);\n                    step1.addEventListener('change', checkEnableStep2);\n    \n                    function enableStep2() {\n                        document.getElementById(\"step-1\").style.display = \"none\";\n                        document.getElementById(\"social-signup\").style.display = \"none\";\n                        document.querySelector(\".subtitle-wrapper\").style.display = \"none\";\n                        document.getElementById(\"step-2\").style.display = \"block\";\n                        document.getElementById(\"note-signup\").style.display = \"block\";\n                    }\n\n                    step2Btn.addEventListener(\"click\", async function () {\n                        if (verifyStep1()) {\n                            const method = document.querySelector('input[name=\"contact_type\"]:checked').value;\n                            const nonce = document.querySelector('input[name=\"supabase_register_nonce\"]')?.value;\n                            let phone = '';\n                            let email = '';\n                            step2Btn.disabled = true;\n                            step2Btn.classList.add(\"loading\", \"btn-disabled\");\n                            const originalText = step2Btn.innerHTML;\n                            step2Btn.innerHTML = `\n                                <span class=\"spinner\"><\/span> Processing\u2026                            `;\n\n                            if(method == 'email') {\n                                email = phoneInput?.value.trim();\n                                \n                                const exists = await checkUserExists(email, 'email');\n                                if (exists === null) {\n                                    step2Btn.disabled = false;\n                                    step2Btn.classList.remove(\"loading\", \"btn-disabled\");\n                                    step2Btn.innerHTML = originalText;\n                                    return;\n                                }\n                                if (exists) {\n                                    alert(\"\u624b\u6a5f\u96fb\u8a71\/Email\u5df2\u8a3b\u518a\u70ba\u6703\u54e1 User already registered\");\n                                    step2Btn.classList.remove(\"loading\");\n                                    step2Btn.innerHTML = originalText;\n                                    return;\n                                }\n                                \n                            } else {\n                                phone = iti.getNumber();\n                            }\n                            const password = document.getElementById('acf-custom_password').value.trim();\n                            const formData = new FormData();\n                            formData.append(\"action\", \"supabase_ajax_register\");\n                            formData.append(\"phone\", phone);\n                            formData.append(\"email\", email);\n                            formData.append(\"password\", password);\n                            formData.append(\"supabase_register_nonce\", nonce);\n                            try {\n                                const response = await fetch(AJAX_URL, {\n                                    method: \"POST\",\n                                    body: formData\n                                });\n                                const result = await response.json();\n                                const data = result.data;\n                                if (result.success) {\n                                    document.getElementById('supabase_uid').value = data?.user_id || '';\n                                    document.getElementById('supabase_token').value = data?.token || '';\n                                    if(method == 'email') {\n                                        document.getElementById('verify-phone-label').innerHTML = \"<span class='line'>Please check your email inbox and click the link in<\/span><span class='line'>the verification email to confirm your email address.<\/span>\";\n                                        document.getElementById('send-otp').innerText = 'I have clicked the link in the verification email.';\n                                        document.getElementById('send-otp').style.display = 'block';\n                                        document.getElementById('send-otp').disabled = false;; \/\/\u4fdd\u96aa\n                                    } else {\n                                        enableStep2();\n                                    }\n                                } else {\n                                    let msg = (result.data?.message || \"\u8a3b\u518a\u5931\u6557\");\n                                    if(msg.includes(\"User already registered\")) {\n                                        msg = \"\u624b\u6a5f\u96fb\u8a71\/Email\u5df2\u8a3b\u518a\u70ba\u6703\u54e1 User already registered\";\n                                    }\n                                    alert(\"\u8a3b\u518a\u932f\u8aa4\uff1a\" + msg);\n                                }\n                            } catch (error) {\n                              alert(\"\u8acb\u6c42\u932f\u8aa4\uff1a\" + error);\n                            } finally {\n                                step2Btn.disabled = false;\n                                step2Btn.classList.remove(\"loading\", \"btn-disabled\");\n                                step2Btn.innerHTML = originalText;\n                            }\n                        }\n                    });\n    \n                    document.querySelectorAll('input[type=\"radio\"][name=\"acf[field_687db6613103a]\"]').forEach(radio => {\n                        const handleDown = () => {\n                            if (radio.checked) {\n                                radio.dataset.wasChecked = \"true\";\n                            } else {\n                                delete radio.dataset.wasChecked;\n                            }\n                        };                  \n                        const handleClick = () => {\n                            if (radio.dataset.wasChecked === \"true\") {\n                                radio.checked = false;\n                                delete radio.dataset.wasChecked;\n                            }\n                        };\n                        radio.addEventListener('mousedown', handleDown);\n                        radio.addEventListener('touchstart', handleDown, { passive: true });\n                        radio.addEventListener('click', handleClick);\n                    });\n    \n                    const submitBtn = document.getElementById(\"register-submit\");\n                    const step2 = document.getElementById('step-2');\n                    const requiredFields = Array.from(\n                        step2.querySelectorAll('input[required], textarea[required], select[required], .acf-required input, .acf-required textarea, .acf-required select')\n                    );\n\n                    function validateField(field) {\n                        const type = field.type;\n                        let valid = true;\n                        if (type === 'radio') {\n                            const name = field.name;\n                            const group = step2.querySelectorAll(`input[type=\"radio\"][name=\"${CSS.escape(name)}\"]`);\n                            const anyChecked = Array.from(group).some(el => el.checked);\n                            valid = anyChecked;\n                            group.forEach(el => el.classList.toggle('field-error', !valid));\n                        } else if (type === 'checkbox') {\n                            valid = field.checked;\n                            field.classList.toggle('field-error', !valid);\n                        } else {\n                            const v = (field.value || '').trim();\n                            valid = v.length > 0;\n                            field.classList.toggle('field-error', !valid);\n                        }                  \n                        return valid;\n                    }\n\n                    function updateSubmitState() {\n                        const allValid = requiredFields.every(validateField);\n                        if (allValid) {\n                            submitBtn.disabled = false;\n                            submitBtn.classList.remove('btn-disabled');\n                            submitBtn.classList.add('btn-enabled');\n                        } else {\n                            submitBtn.disabled = true;\n                            submitBtn.classList.add('btn-disabled');\n                            submitBtn.classList.remove('btn-enabled');\n                        }\n                    }\n\n                    requiredFields.forEach(field => {\n                        const handler = () => {\n                            validateField(field);\n                            updateSubmitState();\n                        };\n                        field.addEventListener('input', handler);\n                        field.addEventListener('change', handler);\n                        if (field.type === 'radio') {\n                            const group = step2.querySelectorAll(`input[type=\"radio\"][name=\"${CSS.escape(field.name)}\"]`);\n                            group.forEach(radio => {\n                                radio.addEventListener('change', handler);\n                            });\n                        }\n                    });\n\n                    const urlParams = new URLSearchParams(window.location.search);\n                    const fromOAuth = urlParams.get(\"from_oauth\");\n                    const token = urlParams.get(\"token\");\n                    const sid = urlParams.get(\"sid\");\n                    if(token && sid) {\n                        const emailP = \"\"; \n                        const phoneP = \"\"; \n                        const passwordP = \"\"; \n\t\t\t\t\t\tlet data = phoneP;\n                        if(emailP) {\n                            phoneInput.value = emailP;\n\t\t\t\t\t\t\tdata = emailP;\n                        } else {\n\t\t\t\t\t\t\titi.setNumber(phoneP);\n                            verifiedPhoneInput.value = phoneP;\n                        }\n                        document.getElementById('acf-custom_password').value = passwordP;\n                        confirmCheckbox.checked = true;\n                        if (verifyStep1(data)) {\n                            enableStep2();\n                        }\n                    } else if (fromOAuth && sessionStorage.getItem(\"register_submitted\") == \"0\") {\n                        client.auth.onAuthStateChange((event, session) => {\n                            if (event === \"SIGNED_IN\" && session?.user && session?.access_token) {\n                                document.getElementById('supabase_uid').value = session.user.id;\n                                document.getElementById('supabase_token').value = session.access_token;\n                                document.getElementById('acf-custom_email_phone').value = session.user.email || \"\";\n                                document.getElementById('acf-custom_password').value = \"\";\n                            }\n                        });\n                        enableStep2();\n                    } else {\n                        sessionStorage.removeItem(\"register_submitted\");\n                    }\n                });\n            <\/script>\n            \n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","pgc_sgb_lightbox_settings":"","footnotes":"","_links_to":"","_links_to_target":""},"dipi_cpt_category":[],"class_list":["post-320805","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/pages\/320805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/comments?post=320805"}],"version-history":[{"count":1,"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/pages\/320805\/revisions"}],"predecessor-version":[{"id":320806,"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/pages\/320805\/revisions\/320806"}],"wp:attachment":[{"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/media?parent=320805"}],"wp:term":[{"taxonomy":"dipi_cpt_category","embeddable":true,"href":"https:\/\/culture.daaimobile.org\/en\/wp-json\/wp\/v2\/dipi_cpt_category?post=320805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}