"use strict";(self.webpackChunk_klaviyo_onsite_modules=self.webpackChunk_klaviyo_onsite_modules||[]).push([[9179],{34666:function(e,t,i){i.d(t,{ec:function(){return n}});const n={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}}},49890:function(e,t,i){var n=i(15957),s=i(2609),o=i(82734),r=i(92719);i(92461),i(70818),i(83362);i(60873);const d=e=>{const t=document.cookie,i=t.split(";").map((e=>e.split("="))).reduce(((e,t)=>(t[0]&&t[1]&&(e[decodeURIComponent(t[0].trim())]=decodeURIComponent(t[1].trim())),e)),{});return e.map((e=>e.key)).filter((e=>void 0!==i[e])).map((e=>({[e]:i[e]})))},a=()=>(0,s.W6)(),c="extendedIdIdentifiers",l=e=>e.map((e=>e.key)).filter((e=>void 0!==localStorage[e])).map((e=>({[e]:String(localStorage[e])}))),f=e=>{var t,i;t=c,i=JSON.stringify(e),localStorage.setItem(t,i)},p=e=>{const t=localStorage.getItem(c);e(t?JSON.parse(t):{})};i(26650),i(60624),i(75479);const y=e=>{const t=new URLSearchParams(window.location.search);return e.map((e=>e.key)).filter((e=>t.has(e))).map((e=>({[e]:t.get(e)||void 0})))};i(61099);const u=({_kx:e,companyId:t,clientIdentifiers:i,extendedIdIdentifiers:n,sscRefresh:o=!1})=>{fetch(`https://a.klaviyo.com/client/sessions/?company_id=${t}`,{method:"POST",body:JSON.stringify({data:{type:"session",attributes:Object.assign({identifiers:Object.assign({},i,{_kx:e})},o&&{ssc_refresh:!0})}}),headers:{"X-Klaviyo-Onsite":"1",revision:"2024-07-15.pre","Content-Type":"application/json",accept:"application/json"}}).then((e=>e.json())).then((e=>{const{id:t,attributes:{kx:i,identifiers:o}}=e.data,d=Object.keys(o),a={};var c;n.filter((e=>d.some((t=>t===e.key))&&!1===e.is_warming&&!0===e.enabled&&!0===e.valid)).reduce(((e,t)=>(e[t.key]=o[t.key],e)),a),(0,s.pN)()?(0,r.B2)("Identifier and _kx pairs set in backend. Not identifying onsite, already identified."):Object.keys(a).length>0?((0,r.B2)(`Setting klSessionId: ${t}`),c=t,(0,s.p2)(c),(0,r.B2)(`Identified: ${JSON.stringify(a)}`),(0,s.ro)({fields:{$exchange_id:i,klSessionId:t}}),f(a)):(0,r.B2)("Could not identify via extended ID based on available identifiers")})).catch((e=>{(0,r.B2)("Failed to create client identity",e)}))},h=()=>{var e;if(void 0===window.klaviyoModulesObject)return void(0,r.B2)("klaviyoModulesObject is not defined");if(a()&&(0,s.pN)())return void(0,r.B2)("Client session already exists and user is identified, should not set a new session");const{companyId:t,extendedIdIdentifiers:i}=window.klaviyoModulesObject,{$exchange_id:n}=(0,s.zy)(),o=!(null==(e=(0,s.FU)())||!e.sscRefreshed),c=(e=>{let t=[];const i=e.filter((e=>1===e.identifier_type)),n=e.filter((e=>2===e.identifier_type)),s=e.filter((e=>0===e.identifier_type));return i.length>0&&(t=[...t,...d(i)]),n.length>0&&(t=[...t,...l(n)]),s.length>0&&(t=[...t,...y(s)]),t.reduce(((e,t)=>{const i=Object.keys(t)[0];return void 0===i||void 0===t[i]||(e[i]=t[i]),e}),{})})(i);null!==c&&0!==Object.keys(c).length?u({companyId:t,_kx:n,clientIdentifiers:c,extendedIdIdentifiers:i,sscRefresh:o}):(0,r.B2)("No identifiers found")};(0,n.e)("createClientSession",h),(0,n.e)("getClientIdentifiers",p),window.cookieStore&&(0,o.O)("onsite_shopify_cookie_listener")&&window.cookieStore.addEventListener("change",(e=>{for(const t of e.changed)if("shopify_client_id"===t.name){a()&&(0,s.gL)(),h();break}}))}},function(e){e.O(0,[2462,4224,6648],(function(){return t=49890,e(e.s=t);var t}));e.O()}]);