(function(){Object.values({City:`city`,Country:`country`,DateOfBirth:`date_of_birth`,Department:`department`,Description:`description`,Email:`email`,Fax:`fax`,FirstName:`first_name`,JobTitle:`job_title`,LastName:`last_name`,LeadSource:`lead_source`,MobilePhone:`mobile_phone`,OwnerId:`owner_id`,Phone:`phone`,PostalCode:`postal_code`,Salutation:`salutation`,State:`state`,LeadStatus:`lead_status`,Street:`street`,OriginalTimezone:`original_timezone`,OriginalTrafficChannel:`original_traffic_channel`,OriginalWebReferrer:`original_web_referrer`,OriginalUtmSource:`original_utm_source`,OriginalUtmCampaign:`original_utm_campaign`,OriginalUtmMedium:`original_utm_medium`,OriginalUtmTerm:`original_utm_term`,CnvId:`_cnv_id`,CnvSystemSource:`_cnv_system_source`,CnvCreatedDate:`_cnv_created_date`,CnvUpdatedDate:`_cnv_updated_date`,SfId:`_sf_id`,SfObjectType:`_sf_object_type`,SfCreatedDate:`_sf_created_date`}),Object.values({AccountSource:`account_source`,AnnualRevenue:`annual_revenue`,BillingAddress:`billing_address`,BillingCity:`billing_city`,BillingCountry:`billing_country`,BillingPostalCode:`billing_postal_code`,BillingState:`billing_state`,BillingStateCode:`billing_state_code`,CompanyName:`company_name`,Description:`description`,Industry:`industry`,OwnerId:`owner_id`,Phone:`phone`,NumberOfEmployees:`number_of_employees`,Website:`website`,AccountType:`account_type`,CnvId:`_cnv_id`,CnvCreatedDate:`_cnv_created_date`,CnvUpdatedDate:`_cnv_updated_date`,SfId:`_sf_id`,SfCreatedDate:`_sf_created_date`});let e=async(e,t)=>{try{let n=new FormData;return Object.entries(t).forEach(([e,t])=>{n.append(e,t)}),(await fetch(`https://forms.conversion.ai/api/v1/forms/${e}/submit`,{method:`POST`,keepalive:!0,body:n})).ok}catch(e){return console.error(e),!1}};var t=`_s__t`,n=`_s__s`;let r=()=>document.cookie.split(`; `).find(e=>e.startsWith(`${n}=`))?.split(`=`)[1],i=()=>document.cookie.split(`; `).find(e=>e.startsWith(`${t}=`))?.split(`=`)[1];var a=class{static submit=async(t,n)=>{if(typeof t!=`string`)throw Error(`Form ID must be a string`);if(typeof n!=`object`||!n)throw Error(`Fields must be an object`);let a=Object.entries(n).reduce((e,[t,n])=>(typeof n==`string`&&e.push([t,n]),e),[]),o=i();o&&a.push([`tracking_id`,o]);let s=r();s&&a.push([`session_id`,s]);let c=window.location.origin+window.location.pathname;a.push([`page_url`,c]);let l=document.referrer;return l&&a.push([`referrer`,l]),await e(t,Object.fromEntries(a))}},o=()=>{window.ConversionFormsV1||(window.ConversionFormsV1=a)};let s={Debug:0,Success:1,Warning:2,Error:3};var c=e=>e===s.Error?`#fb2c36`:e===s.Warning?`#fe9a00`:e===s.Success?`#00bc7d`:`#2b7fff`;function l(e,t,...n){console.log(`%c[Conversion]`,`color: ${c(e)};`,t,...n),window.postMessage({id:`conversion`,type:`log`,data:{level:e,message:t,data:n}})}var u=async(e,t,n=!0)=>{let a=i(),o=r();if(!n&&!a&&(l(s.Warning,`Unable to find tracking ID, generating a fallback ID`),a=crypto.randomUUID()),!n&&!o&&(l(s.Warning,`Unable to find session ID, generating a fallback ID`),o=crypto.randomUUID()),!a)return l(s.Error,`Failed to send request`,`No tracking ID found`),!1;try{return await fetch(e,{...t,keepalive:!0,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pageUrl:window.location.origin+window.location.pathname,trackingId:a,sessionId:o,referrer:document.referrer,...t?.body})}),!0}catch{return!1}};let d={PageVisit:`PAGE_VISIT`,FormSubmission:`FORM_SUBMISSION`},f={Custom:`CUSTOM`};async function p(e,t){let n=await u(`https://p.conversion.ai/api/v1/e/t`,{body:{data:t,type:e}},e!==d.FormSubmission);return n?l(s.Success,`Successfully tracked engagement`,{type:e,data:t}):l(s.Error,`Failed to track engagement`,{type:e,data:t}),n}var m=e=>{if(e.id)return[e.id];if(e.name)return[e.name];let t=Array.from(e.classList);if(t.length>0)return t;let n=e.getAttribute(`action`);if(n)return[n]},h=e=>{let t=e.target;return t.id?.startsWith(`hsForm_`)||t.action?.includes(`hsforms.com`)?!0:window.HubSpotFormsV4?(window.HubSpotFormsV4.getForms?.())?.some(e=>t.id.includes(e.getInstanceId?.())||t.id.includes(e.getFormId?.()))??!1:!1},g=e=>{l(s.Debug,`Detected a form submission`);let t=e.target,n=new FormData(t);if(h(e)){l(s.Debug,`Skipping HubSpot form submission tracking`,{formId:t.id});return}let r=Array.from(n.entries()).reduce((e,[n,r])=>{if(typeof r!=`string`||r.trim().length===0)return e;let i=t.querySelector(`[name="${n}"]`);return n.toLowerCase().includes(`password`)||i&&i.type===`password`?(l(s.Debug,`Detected a sensitive form field`,{name:n}),e):(e.push({name:n,value:r}),e)},[]),i=m(t);if(!i){l(s.Warning,`Did not track form submission for a form without a key`,{fields:r});return}p(d.FormSubmission,{type:f.Custom,key:i,name:t.name,submission:{fields:r}})},_=()=>{document.addEventListener(`submit`,g,!0)},v=e=>{if(!window.HubSpotFormsV4)return;let t=window.HubSpotFormsV4.getFormFromEvent(e);t&&p(d.FormSubmission,{name:``,type:f.Custom,key:[t.getFormId()],submission:{fields:t.getFormFieldValues().reduce((e,{name:t,value:n})=>{if(n===void 0)return e;let r=typeof n==`object`?JSON.stringify(n):n.toString();return r.trim().length===0||e.push({name:t,value:r}),e},[])}})},y=()=>{window.addEventListener(`hs-form-event:on-submission:success`,v)},b={OnBeforeFormInit:`onBeforeFormInit`,OnFormReady:`onFormReady`,OnBeforeFormSubmit:`onBeforeFormSubmit`,OnFormSubmit:`onFormSubmit`,OnFormSubmitted:`onFormSubmitted`},x=e=>{if(e.data?.type!==`hsFormCallback`)return;let t=e.data;t.eventName===b.OnBeforeFormSubmit&&p(d.FormSubmission,{name:``,type:f.Custom,key:[t.id],submission:{fields:t.data.filter(({value:e})=>typeof e==`string`&&e.trim().length>0)}})},S=()=>{window.addEventListener(`message`,x)},C=`https://forms.conversion.ai`,w=()=>{document.querySelectorAll(`iframe`).forEach(e=>{e.src.startsWith(C)&&e.contentWindow?.postMessage({type:`conversion-forms-ping`},C)}),window.addEventListener(`message`,e=>{if(e.origin===C){if(e.data.type===`conversion-forms-height-adjustment`&&e.data.data)try{let{height:t}=e.data.data;window.requestAnimationFrame(()=>{document.querySelectorAll(`iframe`).forEach(n=>{n.contentWindow===e.source&&(n.style.height=`${t}px`)})})}catch(t){console.warn(`Invalid message from child iframe`,e,t)}if(e.data.type===`conversion-forms-ping`&&e.source?.postMessage({type:`conversion-forms-pong`,data:{trackingId:i(),sessionId:r(),referrer:document.referrer,pageUrl:window.location.origin+window.location.pathname}},{targetOrigin:C}),e.data.type===`conversion-forms`)try{let t=e.data;t.data.eventName===`submitted`&&t.data.redirectUrl&&(window.location.href=t.data.redirectUrl)}catch(t){console.warn(`Invalid message from child iframe`,e,t)}}})};window.__conversion_forms_loaded||(window.__conversion_forms_loaded=!0,y(),S(),_(),w()),o()})();