{"version":3,"file":"FormSubmit.Dqlb-ifY.mjs","names":[],"sources":["https:/framerusercontent.com/modules/Ea6pWEzSVyRlC3hF3IgN/46ZRuqLEGxUGVGhJV5jd/FormSubmit.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";export function withFormSubmit(Component){return props=>{useEffect(()=>{if(document.getElementById(\"form-submit-styles\"))return;const styleEl=document.createElement(\"style\");styleEl.id=\"form-submit-styles\";styleEl.textContent=`\n                @keyframes dotBounce {\n                    0%, 100% { transform: translateY(0); opacity: 0.4; }\n                    50% { transform: translateY(-6px); opacity: 1; }\n                }\n                .dots-loader {\n                    position: fixed;\n                    display: flex;\n                    gap: 6px;\n                    align-items: center;\n                    justify-content: center;\n                    pointer-events: none;\n                    z-index: 9999;\n                }\n                .dots-loader span {\n                    width: 8px;\n                    height: 8px;\n                    border-radius: 50%;\n                    background: white;\n                    display: inline-block;\n                    animation: dotBounce 0.6s ease-in-out infinite;\n                }\n                .dots-loader span:nth-child(2) { animation-delay: 0.15s; }\n                .dots-loader span:nth-child(3) { animation-delay: 0.3s; }\n                button[data-reset=\"button\"] { cursor: pointer !important; }\n            `;document.head.appendChild(styleEl);},[]);const handleSubmit=async()=>{const getValue=name=>document.querySelector(`[name='${name}']`)?.value??\"\";const data={product:getValue(\"product\"),website:getValue(\"website\"),category:getValue(\"category\"),email:getValue(\"email\"),units:getValue(\"units\")};if(!data.email){alert(\"Please enter your email.\");return;}const btn=document.getElementById(\"submit-btn\");console.log(\"btn found:\",btn);console.log(\"rect:\",btn?.getBoundingClientRect());let loader=null;if(btn){const rect=btn.getBoundingClientRect();loader=document.createElement(\"div\");loader.className=\"dots-loader\";loader.innerHTML=\"<span></span><span></span><span></span>\";loader.style.top=`${rect.top+rect.height/2-8}px`;loader.style.left=`${rect.left+rect.width/2-20}px`;btn.style.opacity=\"0.6\";btn.style.pointerEvents=\"none\";document.body.appendChild(loader);}const cleanup=()=>{if(loader)loader.remove();if(btn){btn.style.opacity=\"1\";btn.style.pointerEvents=\"auto\";}};try{const res=await fetch(\"https://formspree.io/f/mnjboryb\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(data)});if(res.ok){cleanup();const form=document.getElementById(\"contact-form-wrapper\");if(form){form.style.transition=\"opacity 0.4s ease\";form.style.opacity=\"0\";setTimeout(()=>form.style.display=\"none\",400);}const msg=document.getElementById(\"success-message\");if(msg){msg.style.pointerEvents=\"auto\";msg.style.display=\"block\";requestAnimationFrame(()=>{msg.style.transition=\"opacity 0.4s ease\";msg.style.opacity=\"1\";});}}else{cleanup();const json=await res.json();alert(json?.errors?.[0]?.message??\"Something went wrong.\");}}catch(err){cleanup();alert(\"Network error — please try again.\");}};return /*#__PURE__*/_jsx(Component,{...props,id:\"submit-btn\",onClick:handleSubmit});};}export function withFormId(Component){return props=>/*#__PURE__*/_jsx(Component,{...props,id:\"contact-form-wrapper\"});}export function withSuccessId(Component){return props=>/*#__PURE__*/_jsx(Component,{...props,id:\"success-message\",style:{...props.style,pointerEvents:\"none\",opacity:0}});}\nexport const __FramerMetadata__ = {\"exports\":{\"withSuccessId\":{\"type\":\"reactHoc\",\"name\":\"withSuccessId\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFormSubmit\":{\"type\":\"reactHoc\",\"name\":\"withFormSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFormId\":{\"type\":\"reactHoc\",\"name\":\"withFormId\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormSubmit.map"],"mappings":"kHAAwE,SAAgB,EAAe,EAAU,CAAC,MAAO,IAAO,CAAC,MAAc,CAAC,GAAG,SAAS,eAAe,qBAAqB,CAAC,OAAO,IAAM,EAAQ,SAAS,cAAc,QAAQ,CAAC,EAAQ,GAAG,qBAAqB,EAAQ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;cAyB5R,SAAS,KAAK,YAAY,E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