(()=>{var K=Object.create;var I=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var u=(t,e)=>()=>(t&&(e=t(t=0)),e);var H=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var D=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of A(e))!B.call(t,n)&&n!==r&&I(t,n,{get:()=>e[n],enumerable:!(s=L(e,n))||s.enumerable});return t};var V=(t,e,r)=>(r=t!=null?K(j(t)):{},D(e||!t||!t.__esModule?I(r,"default",{value:t,enumerable:!0}):r,t));var l=(t,e,r)=>new Promise((s,n)=>{var m=o=>{try{a(r.next(o))}catch(i){n(i)}},c=o=>{try{a(r.throw(o))}catch(i){n(i)}},a=o=>o.done?s(o.value):Promise.resolve(o.value).then(m,c);a((r=r.apply(t,e)).next())});var x,h=u(()=>{x="WebPixel::Render"});var P,b=u(()=>{h();P=t=>shopify.extend(x,t)});var y=u(()=>{b()});var _=u(()=>{y()});var w=u(()=>{});var X,$,k,N,O=u(()=>{w();X=(t,e,r)=>l(null,null,function*(){let{settings:{endpoint:s},Log:n,browser:m}=t;fetch(`${s}/v2/storefront/checkout/ping`,{keepalive:!0,method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({token:"",shop:t.init.data.shop.myshopifyDomain,discount:e.discountApplications,order:{id:e.order.id,total_price:e.totalPrice.amount,currency:e.totalPrice.currencyCode},productInfo:r})}).then(c=>l(null,null,function*(){return{status:c.status,data:yield c.json()}})).then(({status:c,data:a})=>{if(c!==200){n.error("[ParcelPanel] checkout_ping failed",c,a);return}n.info("[ParcelPanel] checkout_ping successfully",a)}).catch(c=>{n.error("[ParcelPanel] checkout_ping Request failed",c)}).finally(()=>{$(m.localStorage,n)})}),$=(t,e)=>l(null,null,function*(){yield Promise.all([t.removeItem("pp_click_link_from"),t.removeItem("ppProCheck")]).then(()=>{e.log("[ParcelPanel] clear localStorage [successfully]")}).catch(()=>{e.warn("[ParcelPanel] clear localStorage [failed]")})}),k=(n,m,c)=>l(null,[n,m,c],function*({browser:t,Log:e},r,s){var C;let a=(C=yield t.localStorage.getItem("pp_click_link_from"))!=null?C:"4",o=yield t.localStorage.getItem("ppProCheck");if(typeof o!="string"||!o.includes("@")){e.info("[STOP] localStorage::getItem ppProCheck is_empty");return}let i=o.split("|"),d=i[i.length-1];if(typeof d!="string"){e.info('[ParcelPanel] [STOP] typeof productMetadata !== "string"',d);return}let[p=null,f=null]=d.split("@");if(!p||!f||isNaN(Number(p))||isNaN(Number(f))){e.info("[ParcelPanel] [STOP] productMetadata parse_failed");return}let g={id:p,viewedAt:Number(f),clickFrom:Number(a),timestamp:s};if(r.lineItems.findIndex((F=>F.variant.product.id===g.id))<0){e.warn(`[ParcelPanel] [STOP] Not found [product_id=${g.id}] in checkout`,r);return}return g}),N=X});var v,S,R,T=u(()=>{v={},S=t=>{v=t},R=()=>v});var E=H(M=>{_();O();T();P(n=>l(null,[n],function*({analytics:t,browser:e,settings:r,init:s}){let{endpoint:m,debugMode:c="false"}=r,a=(o=>{let i=()=>{},d={debug:console.debug.bind(console),log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console)};return o?d:new Proxy(d,{get:()=>i})})(c==="true");S({settings:{endpoint:m,debugMode:c==="true"},browser:e,Log:a,init:s}),c==="true"&&t.subscribe("product_viewed",function(o){let i=o.data.productVariant;a.info("[ParcelPanel] product_viewed",i)}),t.subscribe("checkout_completed",function(o){return l(this,null,function*(){let i=R(),d=o.timestamp,p=o.data.checkout;a.info("[ParcelPanel] checkout_completed",p);let f=yield k(i,p,o.timestamp);f&&(yield N(i,p,f))})})}))});var ut=V(E());})();