{"version":3,"file":"Form_Parmas.De_O2CBq.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/f5RzEwXMFRJfX1Dfodxl/nk0nf5SOUWBibY2YRdNa/Form_Parmas.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";function withParams(Component,filter){return function Wrapped(props){const rootRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const getParams=()=>new URLSearchParams(window.location.search);// Add/update hidden inputs on a specific form\nconst applyParamsToForm=form=>{const params=getParams();params.forEach((value,key)=>{if(!filter(key))return;// De-dupe by name; update value if it exists\nconst existing=form.querySelector(`input[name=\"${cssEscape(key)}\"]`);const input=existing??document.createElement(\"input\");input.type=\"hidden\";input.name=key;input.value=value;if(!existing)form.appendChild(input);});};// Attach a submit-capture handler so we always inject right before submit\nconst onSubmitCapture=ev=>{const form=ev.target;if(form&&form.tagName===\"FORM\")applyParamsToForm(form);};// Observe for forms being mounted later inside our subtree\nconst observeTarget=rootRef.current??document;const ensureListeners=()=>{const forms=(rootRef.current??document).querySelectorAll(\"form\");forms.forEach(f=>{f.removeEventListener(\"submit\",onSubmitCapture,true);f.addEventListener(\"submit\",onSubmitCapture,true);});};const mo=new MutationObserver(()=>ensureListeners());mo.observe(observeTarget,{childList:true,subtree:true});// Initial pass\nensureListeners();return()=>{mo.disconnect();const forms=(rootRef.current??document).querySelectorAll(\"form\");forms.forEach(f=>f.removeEventListener(\"submit\",onSubmitCapture,true));};},[]);return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,children:/*#__PURE__*/_jsx(Component,{...props})});};}/** Public HOCs */export function withAllParams(Component){return withParams(Component,()=>true);}export function withUTMParams(Component){return withParams(Component,key=>key.toLowerCase().startsWith(\"utm\"));}/** CSS escape helper for querySelector attribute values */function cssEscape(value){// Use native CSS.escape if available\n// @ts-ignore\nif(typeof CSS!==\"undefined\"&&typeof CSS.escape===\"function\")return CSS.escape(value);// Minimal fallback (handles quotes and backslashes)\nreturn value.replace(/[\"\\\\]/g,\"\\\\$&\");}\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_Parmas.map"],"mappings":"uIAA+E,SAAS,EAAW,EAAU,EAAO,CAAC,OAAO,SAAiB,EAAM,CAAC,IAAM,EAAQA,EAAO,KAAK,CAKe,OALd,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,MAAc,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAC7R,EAAkB,GAAM,CAAc,GAAW,CAAQ,SAAS,EAAM,IAAM,CAAC,GAAG,CAAC,EAAO,EAAI,CAAC,OACrG,IAAM,EAAS,EAAK,cAAc,eAAe,EAAU,EAAI,CAAC,IAAI,CAAO,EAAM,GAAU,SAAS,cAAc,QAAQ,CAAC,EAAM,KAAK,SAAS,EAAM,KAAK,EAAI,EAAM,MAAM,EAAU,GAAS,EAAK,YAAY,EAAM,EAAG,EACjN,EAAgB,GAAI,CAAC,IAAM,EAAK,EAAG,OAAU,GAAM,EAAK,UAAU,QAAO,EAAkB,EAAK,EAChG,EAAc,EAAQ,SAAS,SAAe,MAAoB,EAAc,EAAQ,SAAS,UAAU,iBAAiB,OAAO,CAAO,QAAQ,GAAG,CAAC,EAAE,oBAAoB,SAAS,EAAgB,GAAK,CAAC,EAAE,iBAAiB,SAAS,EAAgB,GAAK,EAAG,EAAS,EAAG,IAAI,qBAAqB,GAAiB,CAAC,CAC1S,OAD2S,EAAG,QAAQ,EAAc,CAAC,UAAU,GAAK,QAAQ,GAAK,CAAC,CACpX,GAAiB,KAAW,CAAC,EAAG,YAAY,EAAc,EAAQ,SAAS,UAAU,iBAAiB,OAAO,CAAO,QAAQ,GAAG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