1(()=>{var I=(n,e,t)=>new Promise((r,a)=>{var i=l=>{try{s(t.next(l))}catch(c){a(c)}},u=l=>{try{s(t.throw(l))}catch(c){a(c)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,u);s((t=t.apply(n,e)).next())});var Se="WebPixel::Render";var pe=n=>shopify.extend(Se,n);var Le=Object.defineProperty,Ge=(n,e,t)=>e in n?Le(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,C=(n,e,t)=>Ge(n,typeof e!="symbol"?e+"":e,t),N=Uint8Array,D=Uint16Array,Ue=Int32Array,xe=new N([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ce=new N([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ne=new N([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Be=function(n,e){for(var t=new D(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];var a=new Ue(t[30]);for(r=1;r<30;++r)for(var i=t[r];i<t[r+1];++i)a[i]=i-t[r]<<5|r;return{b:t,r:a}},He=Be(xe,2),Qe=He.b,Ae=He.r;Qe[28]=258,Ae[258]=28;for(Te=Be(Ce,0).r,le=new D(32768),g=0;g<32768;++g)W=(43690&g)>>1|(21845&g)<<1,W=(61680&(W=(52428&W)>>2|(13107&W)<<2))>>4|(3855&W)<<4,le[g]=((65280&W)>>8|(255&W)<<8)>>1;var W,Te,le,g,ne=function(n,e,t){for(var r=n.length,a=0,i=new D(e);a<r;++a)n[a]&&++i[n[a]-1];var u,s=new D(e);for(a=1;a<e;++a)s[a]=s[a-1]+i[a-1]<<1;if(t){u=new D(1<<e);var l=15-e;for(a=0;a<r;++a)if(n[a])for(var c=a<<4|n[a],o=e-n[a],f=s[n[a]-1]++<<o,h=f|(1<<o)-1;f<=h;++f)u[le[f]>>l]=c}else for(u=new D(r),a=0;a<r;++a)n[a]&&(u[a]=le[s[n[a]-1]++]>>15-n[a]);return u},V=new N(288);for(g=0;g<144;++g)V[g]=8;for(g=144;g<256;++g)V[g]=9;for(g=256;g<280;++g)V[g]=7;for(g=280;g<288;++g)V[g]=8;var ue=new N(32);for(g=0;g<32;++g)ue[g]=5;var et=ne(V,9,0),tt=ne(ue,5,0),qe=function(n){return(n+7)/8|0},B=function(n,e,t){t<<=7&e;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8},ee=function(n,e,t){t<<=7&e;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8,n[r+2]|=t>>16},ge=function(n,e){for(var t=[],r=0;r<n.length;++r)n[r]&&t.push({s:r,f:n[r]});var a=t.length,i=t.slice();if(!a)return{t:ze,l:0};if(a==1){var u=new N(t[0].s+1);return u[t[0].s]=1,{t:u,l:1}}t.sort(function(m,P){return m.f-P.f}),t.push({s:-1,f:25001});var s=t[0],l=t[1],c=0,o=1,f=2;for(t[0]={s:-1,f:s.f+l.f,l:s,r:l};o!=a-1;)s=t[t[c].f<t[f].f?c++:f++],l=t[c!=o&&t[c].f<t[f].f?c++:f++],t[o++]={s:-1,f:s.f+l.f,l:s,r:l};var h=i[0].s;for(r=1;r<a;++r)i[r].s>h&&(h=i[r].s);var d=new D(h+1),w=be(t[o-1],d,0);if(w>e){r=0;var y=0,E=w-e,M=1<<E;for(i.sort(function(m,P){return d[P.s]-d[m.s]||m.f-P.f});r<a;++r){var b=i[r].s;if(!(d[b]>e))break;y+=M-(1<<w-d[b]),d[b]=e}for(y>>=E;y>0;){var j=i[r].s;d[j]<e?y-=1<<e-d[j]++-1:++r}for(;r>=0&&y;--r){var A=i[r].s;d[A]==e&&(--d[A],++y)}w=e}return{t:new N(d),l:w}},be=function(n,e,t){return n.s==-1?Math.max(be(n.l,e,t+1),be(n.r,e,t+1)):e[n.s]=t},Re=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new D(++e),r=0,a=n[0],i=1,u=function(l){t[r++]=l},s=1;s<=e;++s)if(n[s]==a&&s!=e)++i;else{if(!a&&i>2){for(;i>138;i-=138)u(32754);i>2&&(u(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(u(a),--i;i>6;i-=6)u(8304);i>2&&(u(i-3<<5|8208),i=0)}for(;i--;)u(a);i=1,a=n[s]}return{c:t.subarray(0,r),n:e}},te=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},We=function(n,e,t){var r=t.length,a=qe(e+2);n[a]=255&r,n[a+1]=r>>8,n[a+2]=255^n[a],n[a+3]=255^n[a+1];for(var i=0;i<r;++i)n[a+i+4]=t[i];return 8*(a+4+r)},$e=function(n,e,t,r,a,i,u,s,l,c,o){B(e,o++,t),++a[256];for(var f=ge(a,15),h=f.t,d=f.l,w=ge(i,15),y=w.t,E=w.l,M=Re(h),b=M.c,j=M.n,A=Re(y),m=A.c,P=A.n,J=new D(19),p=0;p<b.length;++p)++J[31&b[p]];for(p=0;p<m.length;++p)++J[31&m[p]];for(var v=ge(J,7),U=v.t,X=v.l,x=19;x>4&&!U[Ne[x-1]];--x);var K,O,R,H,k=c+5<<3,S=te(a,V)+te(i,ue)+u,q=te(a,h)+te(i,y)+u+14+3*x+te(J,U)+2*J[16]+3*J[17]+7*J[18];if(l>=0&&k<=S&&k<=q)return We(e,o,n.subarray(l,l+c));if(B(e,o,1+(q<S)),o+=2,q<S){K=ne(h,d,0),O=h,R=ne(y,E,0),H=y;var he=ne(U,X,0);for(B(e,o,j-257),B(e,o+5,P-1),B(e,o+10,x-4),o+=14,p=0;p<x;
vendor: 1,299 bytes, line 1
1++p)B(e,o+3*p,U[Ne[p]]);o+=3*x;for(var $=[b,m],Q=0;Q<2;++Q){var L=$[Q];for(p=0;p<L.length;++p){var Y=31&L[p];B(e,o,he[Y]),o+=U[Y],Y>15&&(B(e,o,L[p]>>5&127),o+=L[p]>>12)}}}else K=et,O=V,R=tt,H=ue;for(p=0;p<s;++p){var T=r[p];if(T>255){ee(e,o,K[(Y=T>>18&31)+257]),o+=O[Y+257],Y>7&&(B(e,o,T>>23&31),o+=xe[Y]);var G=31&T;ee(e,o,R[G]),o+=H[G],G>3&&(ee(e,o,T>>5&8191),o+=Ce[G])}else ee(e,o,K[T]),o+=O[T]}return ee(e,o,K[256]),o+O[256]},nt=new Ue([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ze=new N(0),rt=function(n,e,t,r,a,i){var u=i.z||n.length,s=new N(r+u+5*(1+Math.ceil(u/7e3))+a),l=s.subarray(r,s.length-a),c=i.l,o=7&(i.r||0);if(e){o&&(l[0]=i.r>>3);for(var f=nt[e-1],h=f>>13,d=8191&f,w=(1<<t)-1,y=i.p||new D(32768),E=i.h||new D(w+1),M=Math.ceil(t/3),b=2*M,j=function(z){return(n[z]^n[z+1]<<M^n[z+2]<<b)&w},A=new Ue(25e3),m=new D(288),P=new D(32),J=0,p=0,v=i.i||0,U=0,X=i.w||0,x=0;v+2<u;++v){var K=j(v),O=32767&v,R=E[K];if(y[O]=R,E[K]=O,X<=v){var H=u-v;if((J>7e3||U>24576)&&(H>423||!c)){o=$e(n,l,0,A,m,P,p,U,x,v-x,o),U=J=p=0,x=v;for(var k=0;k<286;++k)m[k]=0;for(k=0;k<30;++k)P[k]=0}var S=2,q=0,he=d,$=O-R&32767;if(H>2&&K==j(v-$))for(var Q=Math.min(h,H)-1,L=Math.min(32767,v),Y=Math.min(258,H);$<=L&&--he&&O!=R;){if(n[v+S]==n[v+S-$]){for(var T=0;T<Y&&n[v+T]==n[v+T-$];++T);if(T>
1S){if(S=T,q=$,T>Q)break;var G=Math.min($,T-2),Me=0;for(k=0;k<G;++k){var de=v-$+k&32767,Oe=de-y[de]&32767;Oe>Me&&(Me=Oe,R=de)}}}$+=(O=R)-(R=y[O])&32767}if(q){A[U++]=268435456|Ae[S]<<18|Te[q];var je=31&Ae[S],Je=31&Te[q];p+=xe[je]+Ce[Je],++m[257+je],++P[Je],X=v+S,++J}else A[U++]=n[v],++m[n[v]]}}for(v=Math.max(v,X);v<u;++v)A[U++]=n[v],++m[n[v]];o=$e(n,l,c,A,m,P,p,U,x,v-x,o),c||(i.r=7&o|l[o/8|0]<<3,o-=7,i.h=E,i.p=y,i.i=v,i.w=X)}else{for(v=i.w||0;v<u+c;v+=65535){var ve=v+65535;ve>=u&&(l[o/8|0]=c,ve=u),o=We(l,o+1,n.subarray(v,ve))}i.i=u}return(function(z,Xe,re){return(re==null||re>z.length)&&(re=z.length),new N(z.subarray(Xe,re))})(s,0,r+qe(o)+a)},at=(function(){for(var n=new Int32Array(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&-306674912)^t>>>1;n[e]=t}return n})(),ye=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8};function it(n,e){e||(e={});var t=(function(){var s=-1;return{p:function(l){for(var c=s,o=0;o<l.length;++o)c=at[255&c^l[o]]^c>>>8;s=c},d:function(){return~s}}})(),r=n.length;t.p(n);var a,i=(function(s,l,c,o,f){if(!f&&(f={l:1},l.dictionary)){var h=l.dictionary.subarray(-32768),d=new N(h.length+s.length);d.set(h),d.set(s,h.length),s=d,f.w=h.length}return rt(s,l.level==null?6:l.level,l.mem==null?f.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+l.mem,c,o,f)})(n,e,10+((a=e).filename?a.filename.length+1:0),8),u=i.length;return(function(s,l){var c=l.filename;if(s[0]=31,s[1]=139,s[2]=8,s[8]=l.level<2?4:l.level==9?2:0,s[9]=3,l.mtime!=0&&ye(s,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){s[3]=8;for(var o=0;o<=c.length;++o)s[o+10]=c.charCodeAt(o)}})(i,e),ye(i,u-8,t.d()),ye(i,u-4,r),i}var ot=typeof TextDecoder<"u"&&new TextDecoder;try{ot.decode(ze,{stream:!0})}catch(n){}function Ze(){return performance!=null&&performance.now?performance.now():0}var Z=new class{constructor(n="YTL"){this.prefix=n}info(n,e){this.log("info",n,e)}warn(n,e){this.log("warn",n,e)}error(n,e){this.log("error",n,e)}log(n,e,t){}},ce=class{constructor(e){C(this,"_authToken",""),this.baseUrl=e}set authToken(e){this._authToken=e||""}post(e,t,r){return I(this,null,function*(){let a=this.buildUrl(e),i=new Headers({"Content-Type":"application/json"});this._authToken&&i.set("Authorization",`Bearer ${this._authToken}`);let u=JSON.stringify(t);var s;r!=null&&r.gzip&&(u=yield(s=u,it(new TextEncoder().encode(s))),i.set("Content-Encoding","gzip"));let l=null,c=(r==null?void 0:r.retries)||0;for(let o=0;o<=c;o++)try{let f=yield fetch(a,{method:"POST",headers:i,body:u});if(f.ok||f.status<500)return f;throw l=f,new Error(`Server error with status ${f.status}`)}catch(f){if(Z.info(`Attempt ${o+1} failed with error: ${f.message}. Retrying...`),o>=c&&l)return l}throw new Error(`Request failed after ${c+1} attempts`)})}buildUrl(e){return`${this.baseUrl.trim().replace(/\/$/,"")}/${e.trim().replace(/^\//,"")}`}},ke=class{constructor(e,t){C(this,"http"),this.config=e,this.tokenManager=t,this.http=new ce(this.config.defaultDataPlaneUrl||"")}createBundle(e){return I(this,null,function*(){return this.requestWrapper(()=>this.http.post("/v2/pixel-bundles",e,{retries:3,gzip:!0}))})}requestWrapper(e,t=0){return I(this,null,function*(){let r=yield this.tokenManager.getAppAccessToken();this.http.authToken=r;let a=yield e();return t===0&&a.status===401?(yield this.tokenManager.expireToken(),this.requestWrapper(e,1)):a})}},Fe="v0.0.6",Ee=class{constructor(e,t){C(this,"http"),C(this,"APP_ACCESS_TOKEN_CACHE_KEY","_yo_pat"),C(this,"tokenPromise"),C(this,"authToken",""),this.config=e,this.uuidManager=t,this.http=new ce(this.config.defaultDataPlaneUrl||"")}getAppAccessToken(){return I(this,null,function*(){if(this.authToken)return this.authToken;let e=yield this.getCachedAccessToken();return e?(this.authToken=e,e):this.tokenPromise?this.tokenPromise:this.upgradeAppAccessToken()})}expireToken(){return I(this,null,function*(){yield this.setCachedAccessToken("")})}getCachedAccessToken(){return I(this,null,function*(){try{let e=yield this.storage.getItem(this.APP_ACCESS_TOKEN_CACHE_KEY);if(e){let t=JSON.parse(e);return t==null?void 0:t.token}}catch(e){}return null})}setCachedAccessToken(e){return I(this,null,function*(){this.authToken=e,e?yield this.storage.setItem(this.APP_ACCESS_TOKEN_CACHE_KEY,JSON.stringify({token:e})):yield this.storage.removeItem(this.APP_ACCESS_TOKEN_CACHE_KEY)})}upgradeAppAccessToken(){return I(this,null,function*(){let e=yield this.getAuthPayload();return this.tokenPromise=this.http.post("/v2/tokens/upgrade",e,{retries:3,gzip:!0}).then(t=>t==null?void 0:t.json()).then(r=>I(this,[r],function*({app_access_token:t}){return yield this.setCachedAccessToken(t),t})).catch(()=>{}),this.tokenPromise})}getAuthPayload(){return I(this,null,function*(){var e,t,r,a,i,u;let s=yield this.uuidManager.getJourneyId(),l=yield this.uuidManager.getInstallId(),c="telemetry_token_upgrade",o={journey_id:s,token:((r=(t=(e=this.config.webPixelApi.init)==null?void 0:e.data)==null?void 0:t.cart)==null?void 0:r.id)||s||"",shop_url:((u=(i=(a=this.config.webPixelApi.init)==null?void 0:a.data)==null?void 0:i.shop)==null?void 0:u.myshopifyDomain)||"",event_name:c,client_id:l,determined_at:Ze(),event_data:{event_id:`${s||new Date().getTime()}`,event_name:c,sdk_version:Fe}},f={webPixel:[o]};return{public_token:this.config.publicToken,journey_id:s,client_id:l,client_domain:o.shop_url,lite_bundle:o.token?f:null}})}get storage(){var e,t;return(t=(e=this.config.webPixelApi)==null?void 0:e.browser)==null?void 0:t.localStorage}},st=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function lt(n){if(!(function(r){return typeof r=="string"&&st.test(r)})(n))throw TypeError("Invalid UUID");var e,t=new Uint8Array(16);return t[0]=(e=parseInt(n.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=255&e,t[4]=(e=parseInt(n.slice(9,13),16))>>>8,t[5]=255&e,t[6]=(e=parseInt(n.slice(14,18),16))>>>8,t[7]=255&e,t[8]=(e=parseInt(n.slice(19,23),16))>>>8,t[9]=255&e,t[10]=(e=parseInt(n.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=255&e,t}for(_=[],ae=0;ae<256;++ae)_.push((ae+256).toString(16).slice(1));var se,_,ae;function De(n,e=0){return(_[n[e+0]]+_[n[e+1]]+_[n[e+2]]+_[n[e+3]]+"-"+_[n[e+4]]+_[n[e+5]]+"-"+_[n[e+6]]+_[n[e+7]]+"-"+_[n[e+8]]+_[n[e+9]]+"-"+_[n[e+10]]+_[n[e+11]]+_[n[e+12]]+_[n[e+13]]+_[n[e+14]]+_[n[e+15]]).toLowerCase()}var we,ie,ut=new Uint8Array(16);
1function Ve(){if(!se&&!(se=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return se(ut)}var me=0,_e=0;function Ke(n,e,t){var r=e&&t||0,a=e||new Array(16),i=(n=n||{}).node,u=n.clockseq;if(n._v6||(i||(i=we),u==null&&(u=ie)),i==null||u==null){var s=n.random||(n.rng||Ve)();i==null&&(i=[s[0],s[1],s[2],s[3],s[4],s[5]],we||n._v6||(i[0]|=1,we=i)),u==null&&(u=16383&(s[6]<<8|s[7]),ie!==void 0||n._v6||(ie=u))}var l=n.msecs!==void 0?n.msecs:Date.now(),c=n.nsecs!==void 0?n.nsecs:_e+1,o=l-me+(c-_e)/1e4;if(o<0&&n.clockseq===void 0&&(u=u+1&16383),(o<0||l>me)&&n.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");me=l,_e=c,ie=u;var f=(1e4*(268435455&(l+=122192928e5))+c)%4294967296;a[r++]=f>>>24&255,a[r++]=f>>>16&255,a[r++]=f>>>8&255,a[r++]=255&f;var h=l/4294967296*1e4&268435455;a[r++]=h>>>8&255,a[r++]=255&h,a[r++]=h>>>24&15|16,a[r++]=h>>>16&255,a[r++]=u>>>8|128,a[r++]=255&u;for(var d=0;d<6;++d)a[r+d]=i[d];return e||De(a)}var Ye={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function oe(n,e,t){if(Ye.randomUUID&&!e&&!n)return Ye.randomUUID();var r=(n=n||{}).random||(n.rng||Ve)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,De(r)}function ct(n,e,t,r){switch(n){case 0:return e&t^~e&r;case 1:case 3:return e^t^r;case 2:return e&t^e&r^t&r}}function Ie(n,e){return n<<e|n>>>32-e}var ft=(function(n,e,t){function r(a,i,u,s){var l;if(typeof a=="string"&&(a=(function(f){f=unescape(encodeURIComponent(f));for(var h=[],d=0;d<f.length;++d)h.push(f.charCodeAt(d));return h})(a)),typeof i=="string"&&(i=lt(i)),((l=i)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var c=new Uint8Array(16+a.length);if(c.set(i),c.set(a,i.length),(c=t(c))[6]=15&c[6]|e,c[8]=63&c[8]|128,u){s=s||0;for(var o=0;o<16;++o)u[s+o]=c[o];return u}return De(c)}try{r.name=n}catch(a){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r})("v5",80,function(n){var e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof n=="string"){var r=unescape(encodeURIComponent(n));n=[];for(var a=0;a<r.length;++a)n.push(r.charCodeAt(a))}else Array.isArray(n)||(n=Array.prototype.slice.call(n));n.push(128);for(var i=n.length/4+2,u=Math.ceil(i/16),s=new Array(u),l=0;l<u;++l){for(var c=new Uint32Array(16),o=0;o<16;++o)c[o]=n[64*l+4*o]<<24|n[64*l+4*o+1]<<16|n[64*l+4*o+2]<<8|n[64*l+4*o+3];s[l]=c}s[u-1][14]=8*(n.length-1)/Math.pow(2,32),s[u-1][14]=Math.floor(s[u-1][14]),s[u-1][15]=8*(n.length-1)&4294967295;for(var f=0;f<u;++f){for(var h=new Uint32Array(80),d=0;d<16;++d)h[d]=s[f][d];for(var w=16;w<80;++w)h[w]=Ie(h[w-3]^h[w-8]^h[w-14]^h[w-16],1);for(var y=t[0],E=t[1],M=t[2],b=t[3],j=t[4],A=0;A<80;++A){var m=Math.floor(A/20),P=Ie(y,5)+ct(m,E,M,b)+j+e[m]+h[A]>>>0;j=b,b=M,M=Ie(E,30)>>>0,E=y,y=P}t[0]=t[0]+y>>>0,t[1]=t[1]+E>>>0,t[2]=t[2]+M>>>0,t[3]=t[3]+b>>>0,t[4]=t[4]+j>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]}),F=class extends Error{};function ht(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return(function(t){return decodeURIComponent(atob(t).replace(/(.)/g,(r,a)=>{let i=a.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))})(e)}catch(t){return atob(e)}}F.prototype.name="InvalidTokenError";var Pe=class{constructor(e){C(this,"JOURNEY_ID_KEY","_yo_jid"),C(this,"yofiInstallIdKey","_yo_iid"),C(this,"JOURNEY_TIMEOUT",18e5),C(this,"JOURNEY_FORCE_TIMEOUT",432e5),this.config=e}getCachedJourneyId(){return I(this,null,function*(){let e=null;try{let t=yield this.storage.getItem(this.JOURNEY_ID_KEY);t&&(e=JSON.parse(t))}catch(t){Z.warn("Error looking up journey id from cache")}return e})}setCachedJourneyId(e){return I(this,null,function*(){try{let t=Date.now();e.expireAt=t+this.JOURNEY_TIMEOUT,yield this.storage.setItem(this.JOURNEY_ID_KEY,JSON.stringify(e))}catch(t){Z.warn("Error caching journey id")}})}getJourneyId(){return I(this,null,function*(){let e="",t=!1,r=yield this.getCachedJourneyId(),a=Date.now();if(r&&a<r.expireAt&&a<r.forceExpireAt)e=r.journeyId;else{if(!this.config.journeyIdSalt){let i="journeyIdSalt required if journeyId is empty";throw Z.warn(i),new Error(i)}e=`jid-${ft(this.config.journeyIdSalt+this.getInstallId(),oe())}`,r={journeyId:e,forceExpireAt:a+this.JOURNEY_FORCE_TIMEOUT,expireAt:0},t=!0}return yield this.setCachedJourneyId(r),t&&Z.info("created new journey id",e),e})}getInstallId(){return I(this,null,function*(){var e;let t=`cid-${oe()}-${Ke()}`;try{let r=yield(e=this.storage)==null?void 0:e.getItem(this.yofiInstallIdKey);r||(r=`cid-${(function(a,i){if(typeof a!="string")throw new F("Invalid token specified: must be a string");i||(i={});let u=i.header===!0?0:1,s=a.split(".")[u];
1if(typeof s!="string")throw new F(`Invalid token specified: missing part #${u+1}`);let l;try{l=ht(s)}catch(c){throw new F(`Invalid token specified: invalid base64 for part #${u+1} (${c.message})`)}try{return JSON.parse(l)}catch(c){throw new F(`Invalid token specified: invalid json for part #${u+1} (${c.message})`)}})(this.config.publicToken).app_id||oe()}-${oe()}-${Ke()}`,yield this.setInstallId(r)),t=r}catch(r){Z.warn("install id error",r==null?void 0:r.message)}return t})}setInstallId(e){return I(this,null,function*(){yield this.storage.setItem(this.yofiInstallIdKey,e)})}get storage(){var e,t;return(t=(e=this.config.webPixelApi)==null?void 0:e.browser)==null?void 0:t.localStorage}},fe=class{constructor(e){C(this,"dataPlane"),C(this,"uuidManager"),C(this,"tokenManager");var t,r,a,i;this.config=e,e.defaultDataPlaneUrl||(e.defaultDataPlaneUrl="https://server.telemetry.services.yofi.ai"),e.journeyIdSalt||(e.journeyIdSalt=((i=(a=(r=(t=e.webPixelApi)==null?void 0:t.init)==null?void 0:r.data)==null?void 0:a.shop)==null?void 0:i.myshopifyDomain)||""),this.uuidManager=new Pe(e),this.tokenManager=new Ee(e,this.uuidManager),this.dataPlane=new ke(e,this.tokenManager)}start(){var e,t,r,a;(a=(r=(t=(e=this.config.webPixelApi)==null?void 0:e.init)==null?void 0:t.data)==null?void 0:r.cart)!=null&&a.id&&this.tokenManager.getAppAccessToken(),["checkout_address_info_submitted","checkout_completed","checkout_contact_info_submitted","checkout_shipping_info_submitted","checkout_started"].forEach(i=>{var u,s;(s=(u=this.config.webPixelApi)==null?void 0:u.analytics)==null||s.subscribe(i,l=>{this.reportBundle(l)})})}reportBundle(e){return I(this,null,function*(){var t,r,a,i,u,s,l,c,o,f;try{let h=yield this.uuidManager.getJourneyId(),d=yield this.uuidManager.getInstallId(),w={journey_id:h,token:((r=(t=e==null?void 0:e.data)==null?void 0:t.checkout)==null?void 0:r.token)||((u=(i=(a=this.config.webPixelApi.init)==null?void 0:a.data)==null?void 0:i.cart)==null?void 0:u.id)||"",shop_url:((c=(l=(s=this.config.webPixelApi.init)==null?void 0:s.data)==null?void 0:l.shop)==null?void 0:c.myshopifyDomain)||"",event_name:e.name,client_id:d,determined_at:Ze(),event_data:{event_id:e.id,event_name:e.name,sdk_version:Fe,navigator:{userAgent:((f=(o=e.context)==null?void 0:o.navigator)==null?void 0:f.userAgent)||""}}};if(!w.token)return;let y={webPixel:[w]};yield this.dataPlane.createBundle(y)}catch(h){Z.warn("Failed to create bundle",h)}})}stop(){}};pe(n=>{var e;(e=n.settings)!=null&&e.publicToken&&new fe({publicToken:n.settings.publicToken,defaultDataPlaneUrl:n.settings.defaultDataPlaneUrl,webPixelApi:n}).start()});})();
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.