{"version":3,"file":"HubspotForm.C146LSlu.mjs","names":["useRef","useState","style"],"sources":["https:/framerusercontent.com/modules/zsYGETgrUhR6TxueMCIf/qGDwIGBSTYq6ACnkD6Mx/HubspotForm.js"],"sourcesContent":["// HubSpot Form Embed Component for Framer\n// Allows Form ID and Redirect URL to be set via Framer property controls\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * HubSpot Form Embed\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function HubspotForm(props){const{formId,style}=props;const containerRef=useRef(null);const[isSubmitting,setIsSubmitting]=useState(false);const PORTAL_ID=\"24432600\";const ZEROBOUNCE_API_KEY=\"8134cbee87174cbe8e52d30b859e2fd2\";useEffect(()=>{if(typeof window===\"undefined\"||!formId)return;// Load HubSpot script if not already present\nif(!document.querySelector('script[src*=\"js.hsforms.net/forms/embed/v2.js\"]')){const script=document.createElement(\"script\");script.src=\"//js.hsforms.net/forms/embed/v2.js\";script.async=true;script.charset=\"utf-8\";document.body.appendChild(script);script.onload=createForm;}else{createForm();}function createForm(){// @ts-ignore\nif(!window[\"hbspt\"]||!containerRef.current)return;// Remove any previous form\ncontainerRef.current.innerHTML=\"\";// @ts-ignore\nwindow[\"hbspt\"].forms.create({portalId:PORTAL_ID,formId:formId,region:\"na1\",target:`#${containerRef.current.id}`,onFormSubmit:function(){console.log(\"Form submitted.\");// Show loading state\nstartTransition(()=>setIsSubmitting(true));},onFormReady:function($form){// Add global style for full width\nconst styleId=\"global-hubspot-form-style\";if(!document.getElementById(styleId)){const style=document.createElement(\"style\");style.id=styleId;style.textContent=`\n              .hbspt-form, .hbspt-form form, .hbspt-form .hs-form {\n                width: 100% !important;\n                max-width: 100% !important;\n              }\n              .hbspt-form .form-columns-2 fieldset {\n                display: flex;\n                flex-wrap: wrap;\n                gap: 1rem;\n              }\n              .hbspt-form .form-columns-2 .hs-form-field {\n                flex: 1 1 48%;\n                box-sizing: border-box;\n              }\n              @media (max-width: 768px) {\n                .hbspt-form .hs-form-field {\n                  flex: 1 1 100%;\n                }\n              }\n            `;document.head.appendChild(style);}// ZeroBounce Validation\nconst config={apiKey:ZEROBOUNCE_API_KEY,disableSubmitOnError:true,hubspotFormId:formId};const zbScript=document.createElement(\"script\");zbScript.src=\"https://www.zerobounce.net/widget/ZeroBounceHubSpotValidationWidget.js\";zbScript.async=true;zbScript.onload=function(){// @ts-ignore\nif(typeof initializeZeroBounce===\"function\"){// @ts-ignore\ninitializeZeroBounce(config);}else{console.error(\"initializeZeroBounce function not found.\");}};document.head.appendChild(zbScript);}});}// Cleanup on unmount\nreturn()=>{if(containerRef.current)containerRef.current.innerHTML=\"\";};},[formId]);// Unique ID for the container\nconst containerId=`hubspot-form-container-${formId||\"default\"}`;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",minHeight:200,...style},children:[/*#__PURE__*/_jsx(\"div\",{ref:containerRef,id:containerId,style:{width:\"100%\",minHeight:200,filter:isSubmitting?\"blur(2px)\":\"none\",transition:\"filter 0.3s ease\"},\"aria-live\":\"polite\"}),isSubmitting&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:1e3},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:40,height:40,border:\"4px solid #f3f3f3\",borderTop:\"4px solid #3498db\",borderRadius:\"50%\",animation:\"spin 1s linear infinite\"}}),/*#__PURE__*/_jsx(\"style\",{children:`\n              @keyframes spin {\n                0% { transform: rotate(0deg); }\n                100% { transform: rotate(360deg); }\n              }\n            `})]})]});}addPropertyControls(HubspotForm,{formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\",placeholder:\"Paste HubSpot Form ID\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubspotForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubspotForm.map"],"mappings":"wUAOG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,SAAO,QAAM,CAAC,EAAY,EAAaA,EAAO,MAAW,CAAC,EAAa,EAAgB,CAACC,EAAS,IAA8F,MAAc,CAAC,GAAU,IAAS,QAAa,CAAC,EAAO,OAC1S,GAAI,SAAS,cAAc,mDAA4P,QAAzM,CAAC,IAAM,EAAO,SAAS,cAAc,UAAU,EAAO,IAAI,qCAAqC,EAAO,MAAM,GAAK,EAAO,QAAQ,QAAQ,SAAS,KAAK,YAAY,GAAQ,EAAO,OAAO,CAAY,CAAmB,SAAS,GAAY,CACvT,CAAC,EAAO,OAAU,CAAC,EAAa,UACnC,EAAa,QAAQ,UAAU,GAC/B,EAAO,MAAS,MAAM,OAAO,CAAC,SAAS,WAAiB,SAAO,OAAO,MAAM,OAAO,IAAI,EAAa,QAAQ,KAAK,aAAa,UAAU,CAAC,QAAQ,IAAI,mBACrJ,MAAoB,EAAgB,IAAQ,EAAC,YAAY,SAAS,EAAM,CACxE,IAAM,EAAQ,4BAA4B,GAAG,CAAC,SAAS,eAAe,GAAS,CAAC,IAAMC,EAAM,SAAS,cAAc,SAAS,EAAM,GAAG,EAAQ,EAAM,YAAY;;;;;;;;;;;;;;;;;;;cAmBjJ,SAAS,KAAK,YAAYA,EAAQ,CAChD,IAAM,EAAO,CAAC,OAAO,mCAAmB,qBAAqB,GAAK,cAAc,EAAO,CAAO,EAAS,SAAS,cAAc,UAAU,EAAS,IAAI,yEAAyE,EAAS,MAAM,GAAK,EAAS,OAAO,UAAU,CACzQ,OAAO,sBAAuB,WACjC,qBAAqB,GAAc,QAAQ,MAAM,2CAA8C,EAAC,SAAS,KAAK,YAAY,EAAW,EAAC,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