{"version":3,"file":"Validation.DdT46ebr.mjs","names":[],"sources":["https:/framerusercontent.com/modules/46opomEnbMdef7miv4BA/dBI1IMNZ79un147qa4ke/Form_utm.js","https:/framerusercontent.com/modules/fV2aRjcj3OVMDC0eZUIU/zS7tFuo4mCJpwker8iD5/Validation.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";// Made with love by Clément: https://lionneclement.com/\n// Full tutorial: https://framermart.com/tutorial/how-to-track-utm-parameters-in-framer-forms\nexport function withAllParams(Component){return props=>{useEffect(()=>{if(typeof window!==\"undefined\"){const params=new URLSearchParams(window.location.search);const form=document.querySelector(`form.${props.className}`);if(form){params.forEach((value,key)=>{const input=document.createElement(\"input\");input.type=\"hidden\";input.name=key;input.value=value;form.appendChild(input);});}}},[props.className]);return /*#__PURE__*/_jsx(Component,{...props});};}export function withUTMParams(Component){return props=>{useEffect(()=>{if(typeof window!==\"undefined\"){const params=new URLSearchParams(window.location.search);const form=document.querySelector(`form.${props.className}`);if(form){params.forEach((value,key)=>{if(key.startsWith(\"utm\")){const input=document.createElement(\"input\");input.type=\"hidden\";input.name=key;input.value=value;form.appendChild(input);}});}}},[props.className]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withUTMParams\":{\"type\":\"reactHoc\",\"name\":\"withUTMParams\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAllParams\":{\"type\":\"reactHoc\",\"name\":\"withAllParams\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Form_utm.map","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=\"+91 __ ____ ____\"// 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,function(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 2 to 3 for country codes with two digits (e.g., +38)\nif(currentValue.length<=2){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});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withPhoneMaskAndNameValidation\":{\"type\":\"reactHoc\",\"name\":\"withPhoneMaskAndNameValidation\",\"annotations\":{\"framerIntrinsicHeight\":\"100\",\"framerDisableUnlink\":\"@framerIntrinsicWidth 100\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Validation.map"],"mappings":"mMAEA,SAAgB,EAAc,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,GAAU,IAAS,OAAY,CAAC,IAAM,EAAO,IAAI,gBAAgB,EAAO,SAAS,OAA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