{"version":3,"file":"Validations.C91_69O2.mjs","names":[],"sources":["https:/framerusercontent.com/modules/cBZmbfdiKgqs6VZIDqgh/wkscNVBVhya6w5CoDWL5/Validations.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";/**\n@framerDisableUnlink\n@framerIntrinsicWidth 100\n@framerIntrinsicHeight 100\n*/export function withPhoneMaskAndNameValidation(Component){return props=>{useEffect(()=>{const applyPhoneMask=event=>{const matrix=\"+38 (0__) ___-__-__\"// Adjust phone matrix as needed\n;let i=0;const def=matrix.replace(/\\D/g,\"\");let currentValue=event.target.value.replace(/\\D/g,\"\");if(def.length>=currentValue.length){currentValue=def;}const newValue=matrix.replace(/./g,a=>{return/[_\\d]/.test(a)&&i<currentValue.length?currentValue.charAt(i++):i>=currentValue.length?\"\":a;});event.target.value=newValue;};const handleBlur=event=>{const currentValue=event.target.value;// Adjust to 2 for country codes with two digits (e.g., +38)\nif(currentValue.length<=4){event.target.value=\"\";const customEvent=new Event(\"change\");event.target.dispatchEvent(customEvent);}};const restrictNameInput=event=>{const regex=/^[a-zA-Z\\u0400-\\u04FF\\s]*$/// Latin, Cyrillic, and spaces\n;if(!regex.test(event.target.value)){event.target.value=event.target.value.replace(/[^a-zA-Z\\u0400-\\u04FF\\s]/g,\"\");}};const phoneFields=document.querySelectorAll('input[type=\"tel\"]');const nameFields=document.querySelectorAll('input[name=\"name\"]');phoneFields.forEach(phoneField=>{phoneField.addEventListener(\"input\",applyPhoneMask);phoneField.addEventListener(\"blur\",handleBlur);});nameFields.forEach(nameField=>{nameField.addEventListener(\"input\",restrictNameInput);});// Cleanup on unmount\nreturn()=>{phoneFields.forEach(phoneField=>{phoneField.removeEventListener(\"input\",applyPhoneMask);phoneField.removeEventListener(\"blur\",handleBlur);});nameFields.forEach(nameField=>{nameField.removeEventListener(\"input\",restrictNameInput);});};},[]);return /*#__PURE__*/_jsx(Component,{...props});};}// Adjusted based on all three screenshots to ensure completeness and alignment with the expected structure.\n\nexport const __FramerMetadata__ = {\"exports\":{\"withPhoneMaskAndNameValidation\":{\"type\":\"reactHoc\",\"name\":\"withPhoneMaskAndNameValidation\",\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"@framerIntrinsicWidth 100\",\"framerIntrinsicHeight\":\"100\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Validations.map"],"mappings":"kHAIE,SAAgB,EAA+B,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,IAAM,EAAe,GAAO,CAAC,IAAM,EAAO,sBAC/H,EAAE,EAAQ,EAAI,EAAO,QAAQ,MAAM,GAAG,CAAK,EAAa,EAAM,OAAO,MAAM,QAAQ,MAAM,GAAG,CAAI,EAAI,QAAQ,EAAa,SAAQ,EAAa,GAAK,IAAM,EAAS,EAAO,QAAQ,KAAK,GAAU,QAAQ,KAAK,EAAE,EAAE,EAAE,EAAa,OAAO,EAAa,OAAO,IAAI,CAAC,GAAG,EAAa,OAAO,GAAG,EAAI,CAAC,EAAM,OAAO,MAAM,GAAiB,EAAW,GAAO,CAC1V,GAD8W,EAAM,OAAO,MAC3W,QAAQ,EAAE,CAAC,EAAM,OAAO,MAAM,GAAG,IAAM,EAAY,IAAI,MAAM,SAAS,CAAC,EAAM,OAAO,cAAc,EAAY,GAAU,EAAkB,GAAO,CAAa,6BACnK,KAAK,EAAM,OAAO,MAAM,GAAE,EAAM,OAAO,MAAM,EAAM,OAAO,MAAM,QAAQ,4BAA4B,GAAG,GAAU,EAAY,SAAS,iBAAiB,oBAAoB,CAAO,EAAW,SAAS,iBAAiB,qBAAqB,CACvP,OADwP,EAAY,QAAQ,GAAY,CAAC,EAAW,iBAAiB,QAAQ,EAAe,CAAC,EAAW,iBAAiB,OAAO,EAAW,EAAG,CAAC,EAAW,QAAQ,GAAW,CAAC,EAAU,iBAAiB,QAAQ,EAAkB,EAAG,KAC5c,CAAC,EAAY,QAAQ,GAAY,CAAC,EAAW,oBAAoB,QAAQ,EAAe,CAAC,EAAW,oBAAoB,OAAO,EAAW,EAAG,CAAC,EAAW,QAAQ,GAAW,CAAC,EAAU,oBAAoB,QAAQ,EAAkB,EAAG,GAAK,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,mBAR9P,IAA6B"}