{"version":3,"file":"PhoneNumber.DG8udXTq.mjs","names":["useRef","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/gNQSdsoUyfI9AlunaJsK/n9tlzlRjm0IwxfInQshB/PhoneNumber.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function PhoneNumberWithCountryCode(){const containerRef=useRef(null);const itiRef=useRef(null);useEffect(()=>{const isArabic=window.location.pathname.includes(\"/ar/\")||window.location.pathname.endsWith(\"/ar\");let form=null;let input=null;let wrapper=null;const cssLink=document.createElement(\"link\");cssLink.rel=\"stylesheet\";cssLink.href=\"https://cdn.jsdelivr.net/npm/intl-tel-input@18.1.1/build/css/intlTelInput.css\";document.head.appendChild(cssLink);const customStyle=document.createElement(\"style\");customStyle.innerHTML=`\n            .custom-phone-wrapper {\n                overflow: visible;\n                display: flex;\n                transition: all 0.3s ease;\n                direction: ${isArabic?\"rtl\":\"ltr\"};\n            }\n\n            .custom-phone-wrapper.invalid {\n                border-color: red !important;\n                background-color: #ffe6e6 !important;\n            }\n\n            .custom-phone-wrapper .iti {\n                width: 100%;\n            }\n\n            .custom-phone-wrapper .iti input {\n                border: none;\n                outline: none;\n                background: transparent;\n                width: 100%;\n                font-size: 16px;\n                text-align: ${isArabic?\"right\":\"left\"};\n            }\n\n            /* Position country code selector */\n            .custom-phone-wrapper .iti--allow-dropdown .iti__flag-container,\n            .custom-phone-wrapper .iti--separate-dial-code .iti__flag-container {\n                right: ${isArabic?\"0\":\"auto\"};\n                left: ${isArabic?\"auto\":\"0\"};\n            }\n\n            /* Show country code instead of flag */\n            .custom-phone-wrapper .iti__flag,\n            .custom-phone-wrapper .iti__flag-box {\n                display: none !important;\n            }\n\n            .custom-phone-wrapper .iti__selected-flag {\n                padding: 0 12px !important;\n                background: transparent !important;\n            }\n\n            .custom-phone-wrapper .iti__selected-dial-code {\n                margin-left: 0 !important;\n                margin-right: 0 !important;\n                font-size: 16px;\n                color: inherit;\n                direction: ltr;\n            }\n\n            /* Input spacing */\n            .custom-phone-wrapper .iti--allow-dropdown input[type=\"tel\"],\n            .custom-phone-wrapper .iti--allow-dropdown input[type=\"text\"],\n            .custom-phone-wrapper .iti--separate-dial-code input[type=\"tel\"],\n            .custom-phone-wrapper .iti--separate-dial-code input[type=\"text\"] {\n                padding-right: ${isArabic?\"70px !important\":\"6px !important\"};\n                padding-left: ${isArabic?\"6px !important\":\"70px !important\"};\n            }\n\n            /* Dropdown direction */\n            .custom-phone-wrapper .iti__country-list {\n                direction: ltr;\n                text-align: left;\n            }\n        `;document.head.appendChild(customStyle);const script=document.createElement(\"script\");script.src=\"https://cdn.jsdelivr.net/npm/intl-tel-input@18.1.1/build/js/intlTelInput.min.js\";const handleSubmit=e=>{if(!itiRef.current||!input)return;const isValid=itiRef.current.isValidNumber();if(!isValid){e.preventDefault();e.stopPropagation();wrapper?.classList.add(\"invalid\");return;}wrapper?.classList.remove(\"invalid\");// Submit full number with country code\ninput.value=itiRef.current.getNumber();};script.onload=()=>{input=containerRef.current?.querySelector(\"input\")||null;if(input&&window.intlTelInput){itiRef.current=window.intlTelInput(input,{initialCountry:\"sa\",separateDialCode:true,nationalMode:false,utilsScript:\"https://cdn.jsdelivr.net/npm/intl-tel-input@18.1.1/build/js/utils.js\"});window.phoneInput=itiRef.current;wrapper=input.closest(\".framer-form-input-wrapper\");if(wrapper){wrapper.classList.add(\"custom-phone-wrapper\");}form=input.closest(\"form\");if(form){form.addEventListener(\"submit\",handleSubmit,true);}}};document.body.appendChild(script);return()=>{if(form){form.removeEventListener(\"submit\",handleSubmit,true);}if(itiRef.current){itiRef.current.destroy();itiRef.current=null;}if(cssLink.parentNode){cssLink.parentNode.removeChild(cssLink);}if(customStyle.parentNode){customStyle.parentNode.removeChild(customStyle);}if(script.parentNode){script.parentNode.removeChild(script);}};},[]);return{ref:containerRef};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withPhoneNumberWithCountryCode(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...PhoneNumberWithCountryCode(props)});};}withPhoneNumberWithCountryCode.displayName=\"PhoneNumberWithCountryCode\";\nexport const __FramerMetadata__ = {\"exports\":{\"withPhoneNumberWithCountryCode\":{\"type\":\"reactHoc\",\"name\":\"withPhoneNumberWithCountryCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PhoneNumberWithCountryCode\":{\"type\":\"override\",\"name\":\"PhoneNumberWithCountryCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PhoneNumber.map"],"mappings":"sLAA+E,SAAgB,GAA4B,CAAC,IAAM,EAAaA,EAAO,KAAK,CAAO,EAAOA,EAAO,KAAK,CAmEmwB,OAnElwB,MAAc,CAAC,IAAM,EAAS,EAAO,SAAS,SAAS,SAAS,OAAO,EAAE,EAAO,SAAS,SAAS,SAAS,MAAM,CAAK,EAAK,KAAS,EAAM,KAAS,EAAQ,KAAW,EAAQ,SAAS,cAAc,OAAO,CAAC,EAAQ,IAAI,aAAa,EAAQ,KAAK,gFAAgF,SAAS,KAAK,YAAY,EAAQ,CAAC,IAAM,EAAY,SAAS,cAAc,QAAQ,CAAC,EAAY,UAAU;;;;;6BAKvkB,EAAS,MAAM,MAAM;;;;;;;;;;;;;;;;;;8BAkBpB,EAAS,QAAQ,OAAO;;;;;;yBAM7B,EAAS,IAAI,OAAO;wBACrB,EAAS,OAAO,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA2BX,EAAS,kBAAkB,iBAAiB;gCAC7C,EAAS,iBAAiB,kBAAkB;;;;;;;;UAQlE,SAAS,KAAK,YAAY,EAAY,CAAC,IAAM,EAAO,SAAS,cAAc,SAAS,CAAC,EAAO,IAAI,kFAAkF,IAAM,EAAa,GAAG,CAAI,MAAC,EAAO,SAAS,CA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