(self.webpackChunk_klaviyo_onsite_modules=self.webpackChunk_klaviyo_onsite_modules||[]).push([[7913],{68785:function(e,t,n){"use strict";n.d(t,{Po:function(){return r},fK:function(){return o},xr:function(){return i}});const r="triggering-state-update",i="form-triggered-with-timing";class o extends CustomEvent{constructor(e){super(r,{detail:e})}}},23823:function(e,t,n){"use strict";n.d(t,{Gi:function(){return a},KS:function(){return i}});var r=n(90144);class i extends CustomEvent{constructor(e){super(r.Rc,{detail:e})}}const o=[],s=e=>{const t=new i(e);window.dispatchEvent(t)},a=e=>{if(window.onsiteTelemetryLoaded){for(;o.length>0;){const e=o.shift();e&&s(e)}s(e)}else o.push(e)}},90144:function(e,t,n){"use strict";n.d(t,{Rc:function(){return r},T4:function(){return s},Xf:function(){return o},lv:function(){return i}});const r="ONSITE_TELEMETRICS_EVENT",i="visitor-tracking",o="signup-forms",s="onsite_visitor_tracking"},21090:function(e,t,n){"use strict";n.d(t,{UF:function(){return N},mq:function(){return P},oO:function(){return L},rN:function(){return x}});const r="qualify",i="open",o="close",s="closeTeaser",a="submit",c="stepSubmit",u="embedOpen",d="redirectedToUrl",l="subscribedViaSMS",f="subscribedViaWhatsApp",v="failedAgeGate",p="viewedStep",m="redirectedToUrlFromStep",g="submitOptInCode",y="triggeredBotProtection",h="falsePositiveBotProtection",w="requestBlockedByWAF",_="redirectedToDeepLink",b="clickedRedirectToInbox",S="hideRedirectToInbox",E="failedToRedirectToInbox",k="submitBackInStockForm",T="dynamicButtonBackInStockClicked",I="dynamicButtonBackInStockPlaced",O="submitBackInStockStep",j="customerHubLoyaltyProviderLoaded",L="klaviyojsSessionStarted",P="userIdentified",x={[r]:"qualifyModal",[i]:"openModal",[o]:"closeModal",[s]:"closeTeaser",[a]:"submitModal",[c]:"stepSubmit",errorView:"showErrorView",[u]:"loadedEmbed",[d]:"redirectedToUrl",[l]:"subscribedViaSMS",submitRateLimit:"submitRateLimit",klaviyoBranding:"clickedKlaviyoBranding",showEmailField:"showEmailField",showShopLogin:"showShopLogin",shopLoginSuccess:"shopLoginSuccess",[v]:"failedAgeGate",[p]:"viewedStep",[m]:"redirectedToUrlFromStep",[g]:"submitOptInCode",resendOptInCode:"resendOptInCode",openFormActionFormOpened:"openFormActionFormOpened",[y]:"triggeredBotProtection",[h]:"falsePositiveBotProtection",[w]:"requestBlockedByWAF",submitSpinToWin:"submitSpinToWin",receivedOutcomeView:"receivedOutcomeView",receivedOutcomeViewAndCouponCode:"receivedOutcomeViewAndCouponCode",[_]:"redirectedToDeepLink",[b]:b,[S]:S,[E]:E,[k]:"submitBackInStockForm",[T]:"dynamicButtonBackInStockClicked",[I]:"dynamicButtonBackInStockPlaced",[O]:"submitBackInStockStep",[L]:L,[P]:P,[f]:"subscribedViaWhatsApp",[j]:"customerHubLoyaltyProviderLoaded"},H="viewed_form",B="engaged_with_form",C="submitted_form_step",U="bot_protection",N={[r]:"qualified_form",[i]:H,[o]:"closed_form",[s]:"closed_teaser",[u]:H,[a]:B,[d]:B,[l]:B,[g]:B,[v]:"failed_age_gate",[p]:"viewed_form_step",[c]:C,[m]:C,[y]:U,[h]:U,[w]:U,[_]:B,[k]:"submitted_back_in_stock_form",[T]:"dynamic_button_back_in_stock_clicked",[I]:"dynamic_button_back_in_stock_placed",[O]:"submitted_back_in_stock_form_step",[L]:"klaviyojs_session_started",[P]:"user_identified",[f]:B,[j]:"customer_hub_loyalty_provider_loaded"}},33220:function(e,t,n){"use strict";n.d(t,{ec:function(){return r}});const r={enabled:!0,config:{debug:!1,dsn:"https://1c229484acf242009679912c93360783@o19233.ingest.sentry.io/1188273",allowUrls:["https?://static-tracking.klaviyo.com","https?://static.klaviyo.com"],denyUrls:["https?://vehla.com"],ignoreErrors:["Non-Error promise rejection captured with keys","Proxy handler's 'get' result of a non-configurable and non-writable property should be the same value as the target's property"],sampleRate:1}}},91892:function(e,t,n){"use strict";t.Z=()=>{var e;const t="https://static.klaviyo.com/onsite/js/",r=null==(e=window.klaviyoModulesObject)?void 0:e.assetSource;n.p=r?`${t}${r}`:t}},74369:function(e,t,n){"use strict";var r=n(91892),i=n(90144),o=n(21090),s=n(68785),a=n(92719),c=n(82734),u=n(46456),d=n(27655),l=function(){return d.Z.Date.now()},f=/\s/;var v=function(e){for(var t=e.length;t--&&f.test(e.charAt(t)););return t},p=/^\s+/;var m=function(e){return e?e.slice(0,v(e)+1).replace(p,""):e},g=n(11412),y=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,w=/^0o[0-7]+$/i,_=parseInt;var b=function(e){if("number"==typeof e)return e;if((0,g.Z)(e))return NaN;if((0,u.Z)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,u.Z)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=m(e);var n=h.test(e);return n||w.test(e)?_(e.slice(2),n?2:8):y.test(e)?NaN:+e},S=Math.max,E=Math.min;var k=function(e,t,n){var r,i,o,s,a,c,d=0,f=!1,v=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=r,o=i;return r=i=void 0,d=t,s=e.apply(o,n)}function g(e){return d=e,a=setTimeout(h,t),f?m(e):s}function y(e){var n=e-c;return void 0===c||n>=t||n<0||v&&e-d>=o}function h(){var e=l();if(y(e))return w(e);a=setTimeout(h,function(e){var n=t-(e-c);return v?E(n,o-(e-d)):n}(e))}function w(e){return a=void 0,p&&r?m(e):(r=i=void 0,s)}function _(){var e=l(),n=y(e);if(r=arguments,i=this,c=e,n){if(void 0===a)return g(c);if(v)return clearTimeout(a),a=setTimeout(h,t),m(c)}return void 0===a&&(a=setTimeout(h,t)),s}return t=b(t)||0,(0,u.Z)(n)&&(f=!!n.leading,o=(v="maxWait"in n)?S(b(n.maxWait)||0,t):o,p="trailing"in n?!!n.trailing:p),_.cancel=function(){void 0!==a&&clearTimeout(a),d=0,r=c=i=a=void 0},_.flush=function(){return void 0===a?s:w(l())},_},T=n(5645),I=n.n(T),O=(n(92461),n(60873),n(87100)),j=n(34560),L=n(28847),P=n(2609),x=n(98072),H=n(95413),B=n(47896),C=n(16320);const U="__kla_session",N=(()=>{const e="https:"===window.location.protocol;return{path:"/",sameSite:e?"None":"Lax",secure:e}})(),M=(e,t)=>{(0,B.zP)(e,t,1800,Object.assign({},N))},$=async({updateExpiryTime:e=!0,_isRecoveryAttempt:t=!1}={})=>{if(!await(async()=>{var e,t;if("true"===(0,B.ej)("__kla_off"))return!1;const n=null==(e=window.Shopify)||null==(e=e.customerPrivacy)||null==e.userCanBeTracked?void 0:e.userCanBeTracked(),r=await(null==(t=window.klaviyo)||null==t.account?void 0:t.account()),i="string"==typeof r&&r.length>0;return n||i})())return;const n=(0,B.ej)(U);if(!n){const e={sessionId:(0,C.V)(),sentSessionStartedEvent:!1,sentUserIdentifiedEvent:!1};return r=U,i=JSON.stringify(e),(0,B.d8)(r,i,1800,Object.assign({},N)),e}var r,i;try{e&&M(U,n);const r=JSON.parse(n);if((e=>"object"==typeof e&&null!==e&&"sessionId"in e&&"string"==typeof e.sessionId&&"sentSessionStartedEvent"in e&&"boolean"==typeof e.sentSessionStartedEvent&&"sentUserIdentifiedEvent"in e&&"boolean"==typeof e.sentUserIdentifiedEvent)(r))return r;if(!t)return(0,a.Yd)("Malformed session cookie detected, attempting recovery"),(e=>{(0,B.kT)(e,Object.assign({},N))})(U),$({updateExpiryTime:e,_isRecoveryAttempt:!0});throw new Error(`Malformed session cookie: ${r}`)}catch(e){return void(0,a.Yd)("Error parsing session cookie",{error:e,stack:e instanceof Error?e.stack:void 0})}};let R=Promise.resolve(!1);const A=({sentSessionStartedEvent:e=!1,sentUserIdentifiedEvent:t=!1})=>(R=R.then((async()=>{const n=await $({updateExpiryTime:!1});if(!n)return!1;const r=Object.assign({},n);let i=!1;return e&&!n.sentSessionStartedEvent&&(r.sentSessionStartedEvent=!0,i=!0),t&&!n.sentUserIdentifiedEvent&&(r.sentUserIdentifiedEvent=!0,i=!0),i&&M(U,JSON.stringify(r)),i})).catch((e=>((0,a.Yd)("Error updating session cookie",{error:e,stack:null==e?void 0:e.stack}),!1))),R),F=["formId","form_id"],q=async(e,t)=>{const n=(0,L.$j)(window.location.toString()),r=(0,P.af)(),i=(0,P.FU)(),s=(0,x.Z)()?"MOBILE":"DESKTOP",a=Object.keys(o.rN),c=Object.values(o.rN),u=t?await(async({updateExpiryTime:e=!0}={})=>{const t=await $({updateExpiryTime:e});return null==t?void 0:t.sessionId})():void 0;return e.map((e=>{var t,d,l,f,v,p;const m=(e=>e in o.rN)(e.metric)?o.rN[e.metric]:e.metric;if(!a.includes(m)&&!c.includes(m))throw new Error(`Invalid metric: ${m}`);const g=o.UF[e.metric],y=e.eventDetails||{},{formId:h,form_id:w}=y,_=I()(y,F),b=null!=h?h:w;return{metric:m,metric_service_event_name:null!=(t=e.metricServiceEventName)?t:g,log_to_statsd:null==(d=e.logToStatsd)||d,statsd_info:e.statsdInfo,log_to_s3:null==(l=e.logToS3)||l,log_to_metrics_service:null!=(f=e.logToMetricsService)?f:!!g,event_details:Object.assign({},_,n,{form_id:b,device_type:s,hostname:window.location.hostname,href:window.location.href,page_url:`${window.location.origin}${window.location.pathname}`,first_referrer:null==i||null==(v=i.$referrer)?void 0:v.first_page,referrer:null==i||null==(p=i.$last_referrer)?void 0:p.first_page,user_agent:navigator.userAgent,locale:navigator.language},r||{},{klaviyo_js_session_id:u})}}))},z=async e=>{const{metricGroup:t,events:n,companyId:r,sample:o=1,useSession:s=!0}=e.detail;try{const e=await q(n,s),a=await(({metricGroup:e,events:t,companyId:n,sample:r=1})=>Math.random()>r?Promise.resolve(null):(0,O.Z)(`https://a.klaviyo.com/onsite/track-analytics?company_id=${n}`,{method:"POST",mode:"no-cors",body:JSON.stringify((0,j.Y)({metricGroup:e,events:t})),headers:{"Content-Type":"application/json",accept:"application/json"}}))({metricGroup:t||i.Xf,companyId:r,sample:o,events:e});return a}catch(e){return((e,t)=>{const n="undefined"!=typeof ProgressEvent&&e instanceof ProgressEvent||void 0!==window.XMLHttpRequestProgressEvent&&e instanceof window.XMLHttpRequestProgressEvent,r=e instanceof Error;!n&&r&&(0,H.T)(e,{tags:{logMetric:"True"},extra:{events:t}})})(e,n),null}};var Z=n(23823);const Y=()=>{const e=window.klaviyoModulesObject;return null==e?void 0:e.companyId},V=(e,t,n)=>{var r;if(!o.UF[e])return null;const i=null==(r=(0,P.zy)())?void 0:r.$exchange_id;return[Object.assign({metric:e,metricServiceEventName:o.UF[e],logToMetricsService:!0,logToS3:!0,logToStatsd:!0,statsdInfo:void 0},n,{eventDetails:{exchangeId:i,isIdentified:t.isIdentified,isClient:!0}})]};var K=new class{constructor(){this._eventHandlers=new Map}get eventHandlers(){return this._eventHandlers}registerEventHandler(e,t,n){this._eventHandlers.has(e)&&this.unregisterEventHandler(e),this._eventHandlers.set(e,{eventType:t,callback:n}),window.addEventListener(t,n)}unregisterEventHandler(e){const t=this._eventHandlers.get(e);t&&(this._eventHandlers.delete(e),window.removeEventListener(t.eventType,t.callback))}clear(){for(const e of this._eventHandlers.values())window.removeEventListener(e.eventType,e.callback);this._eventHandlers.clear()}};const G="sentSessionStartedEvent";let J=!1;const W=()=>{if(J)return!0;try{var e;return JSON.parse(null!=(e=sessionStorage.getItem(G))?e:"false")}catch(e){return(0,a.Yd)(`Error getting session started event in session storage: ${e}`),!0}},D="sentUserIdentifiedEvent";let X=!1;const Q=()=>{if(X)return!0;try{var e;return JSON.parse(null!=(e=sessionStorage.getItem(D))?e:"false")}catch(e){return(0,a.Yd)(`Error getting user identified event in session storage: ${e}`),!0}},ee=e=>{let t=!1;return k((async n=>{if(!t){t=!0;try{await e(n)}catch(e){(0,a.Yd)("Error visitor tracking event handler",{error:e,stack:e instanceof Error?e.stack:void 0})}finally{t=!1}}}),500)},te=ee((async({detail:e})=>{if(W())return void K.unregisterEventHandler(o.oO);if(!(({visitedUrls:e,elapsedTime:t,scrollPercentage:n})=>{var r;return(null!=(r=null==e?void 0:e.length)?r:0)>=2||t>=1e4||n>=50})(e.state))return;if(!await A({sentSessionStartedEvent:!0}))return;const t=i.lv,n=Y(),r=V(o.oO,e.state);if(!r||!n)return;const s=new Z.KS({metricGroup:t,companyId:n,events:r});window.dispatchEvent(s),(e=>{J=e;try{sessionStorage.setItem(G,JSON.stringify(e))}catch(e){(0,a.Yd)(`Error setting session started event in session storage: ${e}`)}})(!0),K.unregisterEventHandler(o.oO),(0,a.Yd)(`Session started event sent. Unregistering event handler. Event handlers remaining: ${K.eventHandlers.size}`)})),ne=ee((async({detail:e})=>{if(Q())return void K.unregisterEventHandler(o.mq);if(!e.state.isIdentified)return;if(!await A({sentUserIdentifiedEvent:!0}))return;const t=i.lv,n=Y(),r=V(o.mq,e.state);if(!r||!n)return;const s=new Z.KS({metricGroup:t,companyId:n,events:r});window.dispatchEvent(s),(e=>{X=e;try{sessionStorage.setItem(D,JSON.stringify(e))}catch(e){(0,a.Yd)(`Error setting user identified event in session storage: ${e}`)}})(!0),K.unregisterEventHandler(o.mq),(0,a.Yd)(`User identified event sent. Unregistering event handler. Event handlers remaining: ${K.eventHandlers.size}`)})),re=()=>{(0,c.O)(i.T4)&&(K.clear(),window.onsiteTelemetryLoaded=!1)};let ie=!1;const oe=async()=>{if(ie)(0,a.Yd)("Telemetry already initialized, skipping.");else{ie=!0;try{if(re(),!(0,c.O)(i.T4))return;K.registerEventHandler(i.Rc,i.Rc,z);const e=await $({updateExpiryTime:!1}),t=!1===(null==e?void 0:e.sentSessionStartedEvent)&&!W(),n=!1===(null==e?void 0:e.sentUserIdentifiedEvent)&&!Q();t&&K.registerEventHandler(o.oO,s.Po,te),n&&K.registerEventHandler(o.mq,s.Po,ne),window.onsiteTelemetryLoaded=!0}catch(e){(0,a.Yd)("Error during onsite telemetry setup",{error:e,stack:e instanceof Error?e.stack:void 0}),re()}}};(0,r.Z)(),(async()=>{oe()})()},51311:function(e,t,n){var r,i,o,s,a,c,u,d,l,f,v,p,m,g,y,h;o=function(e,t,n){if(!l(t)||v(t)||p(t)||m(t)||d(t))return t;var r,i=0,s=0;if(f(t))for(r=[],s=t.length;i