(()=>{var w=Object.defineProperty;var I=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var h=(i,e,t)=>e in i?w(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,v=(i,e)=>{for(var t in e||(e={}))A.call(e,t)&&h(i,t,e[t]);if(I)for(var t of I(e))N.call(e,t)&&h(i,t,e[t]);return i};var l=(i,e,t)=>(h(i,typeof e!="symbol"?e+"":e,t),t);var y=(i,e,t)=>new Promise((o,d)=>{var m=r=>{try{s(t.next(r))}catch(a){d(a)}},g=r=>{try{s(t.throw(r))}catch(a){d(a)}},s=r=>r.done?o(r.value):Promise.resolve(r.value).then(m,g);s((t=t.apply(i,e)).next())});var O="WebPixel::Render";var b=i=>shopify.extend(O,i);var _=class{constructor(e){l(this,"api");l(this,"collectOrder",e=>y(this,null,function*(){var r,a,f,x,P,E;let{checkout:t}=e.data,{order:o,lineItems:d,currencyCode:m}=t;if(!o)return;let g=yield this.initPayload(),s=v({id:(r=o.id)==null?void 0:r.toString(),order_subtotal:t.lineItems.reduce((u,n)=>{var c,p;return u+Number((p=(c=n.variant)==null?void 0:c.price)==null?void 0:p.amount)*Number(n.quantity)},0),order_discount_total:(a=t.discountsAmount)==null?void 0:a.amount,order_shipping_total:(x=(f=t.shippingLine)==null?void 0:f.price)==null?void 0:x.amount,order_tax_total:(P=t.totalTax)==null?void 0:P.amount,order_total:(E=t.totalPrice)==null?void 0:E.amount,line_items:[],currency:m},g);for(let u=0;uy(this,null,function*(){let e=yield this.api.browser.cookie.get("_shg_user_id"),t=yield this.api.browser.cookie.get("_shg_session_id"),o=`${this.api.init.context.window.innerWidth}x${this.api.init.context.window.innerHeight}`;return{user_id:e||"",session_id:t||"",site_id:this.api.settings.site_id,screen_size:o,platform_type:"shopify"}}));l(this,"collectEvent",(e,t)=>{fetch(`${this.api.settings.analytics_endpoint}/${e}`,{method:"POST",body:JSON.stringify(t),keepalive:!0})});this.api=e}};b(i=>{let e=new _(i);i.analytics.subscribe("checkout_completed",e.collectOrder)});})();