"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),o=i(2609),s=i(82734),d=i(92719);i(92461),i(70818),i(83362);i(60873);const r=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,o.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})=>{fetch(`https://a.klaviyo.com/client/sessions/?company_id=${t}`,{method:"POST",body:JSON.stringify({data:{type:"session",attributes:{identifiers:Object.assign({},i,{_kx:e})}}}),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:s}}=e.data,r=Object.keys(s),a={};var c;n.filter((e=>r.some((t=>t===e.key))&&!1===e.is_warming&&!0===e.enabled&&!0===e.valid)).reduce(((e,t)=>(e[t.key]=s[t.key],e)),a),(0,o.pN)()?(0,d.B2)("Identifier and _kx pairs set in backend. Not identifying onsite, already identified."):Object.keys(a).length>0?((0,d.B2)(`Setting klSessionId: ${t}`),c=t,(0,o.p2)(c),(0,d.B2)(`Identified: ${JSON.stringify(a)}`),(0,o.ro)({fields:{$exchange_id:i,klSessionId:t}}),f(a)):(0,d.B2)("Could not identify via extended ID based on available identifiers")})).catch((e=>{(0,d.B2)("Failed to create client identity",e)}))},k=()=>{if(void 0===window.klaviyoModulesObject)return void(0,d.B2)("klaviyoModulesObject is not defined");if(a()&&(0,o.pN)())return void(0,d.B2)("Client session already exists and user is identified, should not set a new session");const{companyId:e,extendedIdIdentifiers:t}=window.klaviyoModulesObject,{$exchange_id:i}=(0,o.zy)(),n=(e=>{let t=[];const i=e.filter((e=>1===e.identifier_type)),n=e.filter((e=>2===e.identifier_type)),o=e.filter((e=>0===e.identifier_type));return i.length>0&&(t=[...t,...r(i)]),n.length>0&&(t=[...t,...l(n)]),o.length>0&&(t=[...t,...y(o)]),t.reduce(((e,t)=>{const i=Object.keys(t)[0];return void 0===i||void 0===t[i]||(e[i]=t[i]),e}),{})})(t);null!==n&&0!==Object.keys(n).length?u({companyId:e,_kx:i,clientIdentifiers:n,extendedIdIdentifiers:t}):(0,d.B2)("No identifiers found")};(0,n.e)("createClientSession",k),(0,n.e)("getClientIdentifiers",p),window.cookieStore&&(0,s.O)("onsite_shopify_cookie_listener")&&window.cookieStore.addEventListener("change",(e=>{for(const t of e.changed)if("shopify_client_id"===t.name){a()&&(0,o.gL)(),k();break}}))}},function(e){e.O(0,[2462,4224,6648],(function(){return t=49890,e(e.s=t);var t}));e.O()}]);