1import{r as h,j as E}from"./index-BYbhg4ys.js";const v="https://js.hsforms.net/forms/embed/v2.js",S=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gbraid","wbraid"],L=t=>{var n;if(typeof window>"u")return"";try{return((n=window.sessionStorage)==null?void 0:n.getItem(`lp_${t}`))||""}catch{return""}},k=()=>new Promise(t=>{if(typeof window>"u"||window.hbspt)return t();const n=document.querySelector(`script[src="${v}"]`);if(n){n.addEventListener("load",()=>t(),{once:!0});return}const e=document.createElement("script");e.src=v,e.async=!0,e.charset="utf-8",e.onload=()=>t(),document.head.appendChild(e)}),x=()=>{if(typeof window>"u")return{};const t={},n=new URLSearchParams(window.location.search);for(const e of S){const o=n.get(e);o&&(t[e]=o)}for(const e of["gclid","gbraid","wbraid"])if(!t[e]){const o=L(e);o&&(t[e]=o)}return t},j=(t,n)=>{for(const[e,o]of Object.entries(n)){if(!o)continue;const c=t.querySelector(`input[name="${CSS.escape(e)}"]`);c&&(c.value=o,c.dispatchEvent(new Event("input",{bubbles:!0})),c.dispatchEvent(new Event("change",{bubbles:!0})))}},C=({portalId:t,formId:n,region:e="na1",className:o,hiddenFields:c})=>{const p=h.useRef(null),l=`hs-form-${n}`,[u,b]=h.useState(!1);return h.useEffect(()=>{if(u)return;const d=p.current;if(!d)return;if(typeof IntersectionObserver>"u"){b(!0);return}const m=new IntersectionObserver(r=>{for(const s of r)if(s.isIntersecting){b(!0),m.disconnect();break}},{rootMargin:"200px 0px"});m.observe(d);const a=()=>b(!0),i={once:!0,passive:!0};return window.addEventListener("pointerdown",a,i),window.addEventListener("keydown",a,i),()=>{m.disconnect(),window.removeEventListener("pointerdown",a),window.removeEventListener("keydown",a)}},[u]),h.useEffect(()=>{if(!u)return;let d=!1;k().then(()=>{if(d||!p.current||!window.hbspt)return;p.current.innerHTML="";const i={...x(),...c??{}};window.hbspt.forms.create({portalId:t,formId:n,region:e,target:`#${l}`,onFormReady:r=>{Object.keys(i).length&&j(r,i)}})});const m=i=>{try{const{protocol:r,hostname:s}=new URL(i);return r!=="https:"?!1:s==="hubspot.com"||s.endsWith(".hubspot.com")||s==="hsforms.com"||s.endsWith(".hsforms.com")||s==="hsforms.net"||s.endsWith(".hsforms.net")||s.endsWith(".hubspotusercontent.com")||s.endsWith(".hsappstatic.net")}catch{return!1}},a=i=>{var s;if(!m(i.origin))return;const r=i.data;if(!(!r||r.type!=="hsFormCallback")&&!(r.eventName!=="onFormSubmitted"||r.id!==n))try{const f=((s=r.data)==null?void 0:s.submissionValues)??{},w=f.email||f.work_email||"",_=f.phone||"",g=f.firstname||"",y=f.lastname||"";window.dataLayer??(window.dataLayer=[]),window.dataLayer.push({event:"lp_form_submit",lp_event:"form_submit",hs_form_id:n,lp_path:window.location.pathname,enhanced_conversion_data:{email:w,phone_number:_,first_name:g,last_name:y},user_email:w});try{w&&sessionStorage.setItem("lp_user_email",w)}catch{}}catch{}};return window.addEventListener("message",a),()=>{d=!0,window.removeEventListener("message",a)}},[u,t,n,e,l,c]),E.jsx("div",{id:l,ref:p,className:o,style:u?void 0:{minHeight:320}})};export{C as HubSpotForm,C as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.