import.meta;var Xa=Object.defineProperty,Za=Object.defineProperties,ei=Object.getOwnPropertyDescriptors,_t=Object.getOwnPropertySymbols,Wr=Object.prototype.hasOwnProperty,jr=Object.prototype.propertyIsEnumerable,Xt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Yr=t=>{throw TypeError(t)},Zt=(t,e,n)=>e in t?Xa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,w=(t,e)=>{for(var n in e||(e={}))Wr.call(e,n)&&Zt(t,n,e[n]);if(_t)for(var n of _t(e))jr.call(e,n)&&Zt(t,n,e[n]);return t},T=(t,e)=>Za(t,ei(e)),er=(t,e)=>{var n={};for(var r in t)Wr.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&_t)for(var r of _t(t))e.indexOf(r)<0&&jr.call(t,r)&&(n[r]=t[r]);return n},c=(t,e,n)=>Zt(t,typeof e!="symbol"?e+"":e,n),Kr=(t,e,n)=>e.has(t)||Yr("Cannot "+n),A=(t,e,n)=>(Kr(t,e,"read from private field"),n?n.call(t):e.get(t)),M=(t,e,n)=>e.has(t)?Yr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),k=(t,e,n,r)=>(Kr(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),te=function(t,e){this[0]=t,this[1]=e},xe=(t,e,n)=>{var r=(o,s,l,d)=>{try{var u=n[o](s),h=(s=u.value)instanceof te,p=u.done;Promise.resolve(h?s[0]:s).then(y=>h?r(o==="return"?o:"next",s[1]?{done:y.done,value:y.value}:y,l,d):l({value:y,done:p})).catch(y=>r("throw",y,l,d))}catch(y){d(y)}},a=o=>i[o]=s=>new Promise((l,d)=>r(o,s,l,d)),i={};return n=n.apply(t,e),i[Xt("asyncIterator")]=()=>i,a("next"),a("throw"),a("return"),i},re=(t,e,n)=>(e=t[Xt("asyncIterator")])?e.call(t):(t=t[Xt("iterator")](),e={},n=(r,a)=>(a=t[r])&&(e[r]=i=>new Promise((o,s,l)=>(i=a.call(t,i),l=i.done,Promise.resolve(i.value).then(d=>o({value:d,done:l}),s)))),n("next"),n("return"),e);const ti=":host{display:flex;align-items:center;justify-content:center}";class ri extends HTMLElement{constructor(){var e,n;super(),c(this,"size"),c(this,"color"),this.size=(e=this.getAttribute("size"))!=null?e:"18px",this.color=(n=this.getAttribute("color"))!=null?n:"gray",this.attachShadow({mode:"open"})}connectedCallback(){this.render();const e=document.createElement("style");e.textContent=ti,this.shadowRoot.appendChild(e)}render(){const e=this.shadowRoot,n='\n width="'.concat(this.size,'"\n height="').concat(this.size,'"\n xmlns="http://www.w3.org/2000/svg"\n aria-hidden="true"\n ');e.innerHTML="\n \n ')}}const ni="#overlay{position:fixed;width:100%;height:100%;background:#0006;top:0;left:0;z-index:2147483647;animation:modalPop .3s ease-out}#modal{position:fixed;top:20%;left:50%;width:100%;max-width:383px;transform:translate(-50%,-100%);background:#fff;color:#000;border-radius:5px;animation:modalSlideInFromTop .3s forwards}@keyframes modalPop{0%{opacity:0}to{opacity:1}}@keyframes modalSlideInFromTop{0%{transform:translate(-50%,-100%)}to{transform:translate(-50%)}}@keyframes modalSlideInFromBottom{0%{transform:translate(-50%,100%)}to{transform:translate(-50%)}}@media only screen and (max-width: 640px){#modal{top:auto;bottom:0;animation:modalSlideInFromBottom .3s forwards}}#modal footer{padding:0 21px 21px}#modal header{display:flex;justify-content:space-between;padding:21px 21px 16px}#title{font-size:21px;font-weight:600;line-height:25.2px;margin:0}.capitalize:first-letter{display:inline-block;text-transform:capitalize}#content{text-align:left;padding:0 21px 16px;overflow:auto;max-height:50vh}#modal #content p{margin:0;font-size:14px;line-height:21px}#close-icon,#close-button{cursor:pointer}#close-icon{min-width:24px;background:transparent;padding:0;border:none}#close-button{width:100%;padding:16px 21px;color:#fff;background-color:#1773b0;border:none;border-radius:5px;font-size:14px;line-height:21px;font-family:inherit}#close-button:hover,#close-button:active{background:#136f99}#close-button:active,#close-button:focus{box-shadow:0 0 0 4px #1990c640}";function ai(t){return kn(t).map(e=>e instanceof Error?e:new Ln("[".concat(typeof e,"] ").concat(ii(e).slice(0,10240))))}function kn(t,e=0){return e>=20?[t,"Truncated cause stack"]:t instanceof Error&&t.cause?[t,...kn(t.cause,e+1)]:[t]}function ii(t){var e;if(typeof t!="string")try{return(e=JSON.stringify(t))!=null?e:typeof t}catch(n){}return"".concat(t)}var Ln=class extends Error{constructor(){super(...arguments),c(this,"name","BugsnagInvalidError")}},xn=/^\s*at .*(\S+:\d+|\(native\))/m,oi=/^(eval@)?(\[native code])?$/;function si(t){return t.stack?t.stack.match(xn)?li(t):ci(t):[]}function On(t){if(t.indexOf(":")===-1)return[t];let e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[e[1],e[2]?Number(e[2]):void 0,e[3]?Number(e[3]):void 0]}function li(t){return t.stack.split("\n").filter(e=>!!e.match(xn)).map(e=>{let n=e.replace(/^\s+/,"").replace(/^.*?\s+/,""),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],""):n;let a=On(r?r[1]:n),i=r&&n||void 0,o=["eval",""].indexOf(a[0])>-1?void 0:a[0];return{method:i,file:o,lineNumber:a[1],columnNumber:a[2]}})}function ci(t){return t.stack.split("\n").filter(e=>!e.match(oi)).map(e=>{if(e.indexOf("@")===-1&&e.indexOf(":")===-1)return{method:e};let n=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(n),a=r&&r[1]?r[1]:void 0,i=On(e.replace(n,""));return{method:a,file:i[0],lineNumber:i[1],columnNumber:i[2]}})}var tr="5",di=class{constructor(t){c(this,"breadcrumbs",[]),c(this,"apiKey"),c(this,"plugins"),c(this,"appId"),c(this,"appType"),c(this,"appVersion"),c(this,"releaseStage"),c(this,"locale"),c(this,"userAgent"),c(this,"metadata"),c(this,"persistedMetadata"),c(this,"onError"),c(this,"onPostErrorListeners",[]),c(this,"endpoints"),c(this,"session");var e,n,r;this.apiKey=t.apiKey,this.appType=t.appType,this.appId=t.appId,this.appVersion=t.appVersion,this.releaseStage=t.releaseStage,this.locale=t.locale,this.userAgent=t.userAgent,this.metadata=t.metadata,this.onError=t.onError,this.persistedMetadata={},this.endpoints=(e=t.endpoints)!=null?e:{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com/observeonly"},this.plugins=(n=t.plugins)!=null?n:[],this.plugins.forEach(a=>a.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state"),((r=t.withSessionTracking)==null||r)&&(this.session={id:this.getRandomUUID(),startedAt:new Date().toISOString(),events:{handled:0,unhandled:0}},this.startSession())}addMetadata(t){for(let e of Object.keys(t))this.persistedMetadata[e]=t[e]}getSessionId(){var t;return(t=this.session)==null?void 0:t.id}leaveBreadcrumb(t,e,n="manual"){this.breadcrumbs.push({name:t,metaData:e,type:n,timestamp:new Date().toISOString()})}notify(t,{errorClass:e,severity:n,severityType:r,handled:a=!0,metadata:i,context:o,groupingHash:s}={}){var l,d;let u=ai(t),h=w(w(w({},this.metadata),this.persistedMetadata),i),p=this.buildBugsnagEvent(u,{errorClass:e,severityType:r,handled:a,severity:n,metadata:h,context:o,groupingHash:s});if(((d=(l=this.onError)==null?void 0:l.call(this,p,t))==null||d)&&this.releaseStage!=="development"){this.updateAndAppendSessionInformation(p);let y=this.sendToBugsnag(p);return this.onPostErrorListeners.forEach(C=>C(p)),y}return Promise.resolve()}addOnPostError(t){this.onPostErrorListeners.push(t)}updateAndAppendSessionInformation(t){this.session&&(t.unhandled?this.session.events.unhandled++:this.session.events.handled++,t.session=this.session)}buildBugsnagEvent(t,{errorClass:e,severity:n="error",severityType:r="handledException",handled:a,metadata:i={},context:o,groupingHash:s}){let l=new Date().toISOString(),{breadcrumbs:d,appId:u,appType:h,appVersion:p,releaseStage:y,locale:C,userAgent:_}=this,E=t.map((P,$)=>({errorClass:$===0&&e!=null?e:P.name,stacktrace:Mn(u,P),message:P.message,type:"browserjs"}));return{payloadVersion:tr,exceptions:E,severity:n,severityReason:{type:r},unhandled:!a,app:{id:u,type:h,version:p,releaseStage:y},device:{time:l,locale:C,userAgent:_},breadcrumbs:d,context:o,metaData:i,groupingHash:s}}async startSession(){var t,e;if(this.releaseStage==="development"){console.log("Skipping error logging session tracking in development mode");return}let{apiKey:n}=this,r={notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},app:{version:this.appVersion,releaseStage:this.releaseStage,type:this.appType},device:{id:this.appId,locale:this.locale,userAgent:this.userAgent},sessions:[this.session]};try{await fetch(this.endpoints.sessions,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":n,"Bugsnag-Payload-Version":tr,"Bugsnag-Sent-At":(e=(t=this.session)==null?void 0:t.startedAt)!=null?e:new Date().toISOString()},body:JSON.stringify(r)})}catch(a){console.warn("[bugsnag-light] failed to start session"),console.warn(a)}}async sendToBugsnag(t){let{apiKey:e}=this,n={apiKey:e,notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},events:[t]};try{await fetch(this.endpoints.notify,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":tr,"Bugsnag-Sent-At":t.device.time},body:JSON.stringify(n)})}catch(r){console.warn("[bugsnag-light] failed to send an event"),console.warn(r)}}getRandomUUID(){try{return crypto.randomUUID()}catch(t){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)})}}};function Mn(t,e){let n=si(e).map(r=>{var a,i,o,s;let l=(a=r.file)==null?void 0:a.includes(t);return{method:(i=r.method)!=null?i:"",file:(o=r.file)!=null?o:"",lineNumber:(s=r.lineNumber)!=null?s:0,columnNumber:r.columnNumber,inProject:l}});if(e instanceof Ln){let r=n.findIndex(a=>a.method.endsWith("notify"));r>-1&&(n=n.slice(r+1))}return n}var ui=class uu extends Error{constructor(e){super(e),c(this,"reason"),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,uu.prototype)}};function hi(t,{metadata:e}={}){let n=window.onerror;window.onerror=(r,a,i,o,s)=>{s&&t.notify(s,{severityType:"unhandledException",handled:!1,metadata:e}),typeof n=="function"&&n.apply(window.onerror,[r,a,i,o,s])}}function pi(t,{metadata:e}={}){window.addEventListener("unhandledrejection",n=>{n.reason&&!(n.reason instanceof ui)&&t.notify(n.reason,{severityType:"unhandledPromiseRejection",handled:!1,metadata:e})})}function dt(t){try{const e=new RegExp("(^| )".concat(t,"=([^;]+)")).exec(document.cookie);if(e){const n=e[2];try{return decodeURIComponent(n)}catch(r){return n}}return null}catch(e){return null}}const yr={BRANDED_BUTTON:"shopify-payment-button__button shopify-payment-button__button--branded",UNBRANDED_BUTTON:"shopify-payment-button__button shopify-payment-button__button--unbranded",MORE_PAYMENT_OPTION_BUTTON:"shopify-payment-button__more-options"},mi={DARK:"apple-pay--dark",LIGHT:"apple-pay--light"},yi=44,gi="_shopify_y",Un=6,fi="discount_code",Sr="https://static-na.payments-amazon.com",Ir="".concat(Sr,"/checkout.js"),Bn="https://www.paypal.com",$n="https://pay.google.com",fe={CURRENCY_CHANGE:"wallet_currency_change",CAPTCHA_REQUIRED:"wallet_captcha_required",NOT_ENOUGH_STOCK:"wallet_not_enough_stock",CART_NOT_READY:"wallet_cart_not_ready",DYNAMIC_TAX:"wallet_dynamic_tax",PAYMENT_METHOD_NOT_APPLICABLE:"wallet_payment_method_not_applicable",INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED:"wallet_invalid_payment_deferred_payment_required"},It="VALIDATION_CUSTOM",Hn="portable-wallets",Ne={BUTTON:"accelerated-checkout-button",CONTAINER:"accelerated-checkout-button-container"},Gn="unknown",zn={name:"buy_it_now",wallet_params:{}};function Vn(t){try{return!t.toString().includes("[native code]")}catch(e){return!0}}const rr=new Map,bi={checkDuplicate({errorClass:t,message:e}){if(rr.has(t)){const n=rr.get(t);if(n.has(e))return!0;n.add(e)}else rr.set(t,new Set([e]));return!1},reset(){}},ft="DeveloperError";class ee extends Error{constructor({code:e,message:n},r){const a="An unexpected error happened likely because of customizations made to HTML/JavaScript on this site ".concat(n);super("[".concat(e,"]: ").concat(a),r),c(this,"name",ft),c(this,"code"),this.code=e}}const qn="SilencedError";class Ut extends Error{constructor(){super(...arguments),c(this,"name",qn)}}class wi extends Error{constructor(){super(...arguments),c(this,"name","MissingConfigError")}}class be extends Error{constructor(){super(...arguments),c(this,"name","NoResponseError")}}class Pr extends Error{constructor(e,{errorDetails:n,bugsnagGroupingHash:r}){super(e),c(this,"errorDetails"),c(this,"bugsnagGroupingHash"),this.name="GraphQLResponseError",this.errorDetails=n,this.bugsnagGroupingHash=r}}const Wn="IgnoredGraphQLResponseError";class jn extends Pr{constructor(e,{reason:n,errorDetails:r}){super(e,{errorDetails:r}),c(this,"reason"),this.name=Wn,this.reason=n}}function R(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var _i=0;function pe(t){return"__private_"+_i+++"_"+t}function Bt(t){return Object.entries(t).map(([e,n])=>({key:e,value:{stringValue:String(n)}}))}function Ei(t){return Object.entries(t).map(([e,n])=>({key:e,value:Yn(n)}))}function Yn(t){if(Array.isArray(t))return{arrayValue:{values:t.map(e=>Yn(e))}};switch(typeof t){case"boolean":return{boolValue:!!t};case"number":return{doubleValue:Number(t)};case"string":default:return{stringValue:String(t)}}}const vr=1,Ai=Ci(5,2,12);function Ci(t,e,n){const r=[0];for(let a=0;a{switch(r.attributes=w(w({},R(this,J)[J]),r.attributes),r.type){case"histogram":Ii(e,r);break;case"exponential_histogram":Pi(e,r);break;case"counter":vi(e,r);break;case"gauge":Di(e,r);break}});const n=Object.values(e);n.length!==0&&(R(this,q)[q]=[],await R(this,we)[we].exportMetrics(n))}async exportLogs(){const e=R(this,_e)[_e].map(n=>{const r={timeUnixNano:n.timeUnixNano,observedTimeUnixNano:n.timeUnixNano,attributes:Ei(w(w({},R(this,J)[J]),n.attributes))};return n.body&&(r.body={stringValue:n.body}),r});e.length!==0&&(R(this,_e)[_e]=[],await R(this,we)[we].exportLogs(e))}}function Ii(t,e){var n;const{name:r,value:a,unit:i,timeUnixNano:o,attributes:s}=e,l=(n=e.bounds)!==null&&n!==void 0?n:Ai,d=new Array(l.length+1).fill(0);t[r]||(t[r]={name:r,unit:i||"1",histogram:{aggregationTemporality:vr,dataPoints:[]}});for(let u=0;u0?h:0,bucketCounts:r>0?[1]:[]};t[n].exponentialHistogram.dataPoints.push({attributes:Bt(o!=null?o:{}),startTimeUnixNano:i,timeUnixNano:i,count:1,sum:l,scale:d,zeroCount:p,positive:C,negative:y,min:l,max:l,zeroThreshold:0})}function vi(t,e){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o}=e;t[n]||(t[n]={name:n,unit:a||"1",sum:{aggregationTemporality:vr,isMonotonic:!0,dataPoints:[]}}),t[n].sum.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:r,attributes:Bt(o!=null?o:{})})}function Di(t,e){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o}=e;t[n]||(t[n]={name:n,unit:a||"1",gauge:{dataPoints:[]}}),t[n].gauge.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:r,attributes:Bt(o!=null?o:{})})}var Xe=pe("url"),Ee=pe("serviceName"),Ze=pe("logger"),et=pe("fetchFn");class Ri{constructor(e,n,r){Object.defineProperty(this,Xe,{writable:!0,value:void 0}),Object.defineProperty(this,Ee,{writable:!0,value:void 0}),Object.defineProperty(this,Ze,{writable:!0,value:void 0}),Object.defineProperty(this,et,{writable:!0,value:void 0}),R(this,Xe)[Xe]=e.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),R(this,Ee)[Ee]=n,R(this,Ze)[Ze]=r==null?void 0:r.logger,R(this,et)[et]=r==null?void 0:r.fetchFn}async exportMetrics(e){const n={resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,Ee)[Ee]}}]},scopeMetrics:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},metrics:e}]}]};await this.exportTo(n,"/v1/metrics")}async exportLogs(e){const n={resourceLogs:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,Ee)[Ee]}}]},scopeLogs:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},logRecords:e}]}]};await this.exportTo(n,"/v1/logs")}async exportTo(e,n){var r;const a=await this.exporterFetch()("".concat(R(this,Xe)[Xe]).concat(n),{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if((r=R(this,Ze)[Ze])===null||r===void 0||r.log({status:a.status}),!a.ok){if(a.status===400){const i=await a.text();throw new ot("Invalid OpenTelemetry Data: ".concat(i))}if(a.status===429||a.status===503){const i=await a.text(),o=a.headers.get("Retry-After"),s=o?{seconds:Number(o)}:void 0;throw new ot("Server did not accept data",{errorData:i,retryAfter:s,body:e})}throw new ot("Server responded with ".concat(a.status))}}exporterFetch(){return R(this,et)[et]||fetch}}class ot extends Error{constructor(e,n){super(e),this.metadata=void 0,this.name="OpenTelemetryClientError",this.metadata=n}}const Ni="https://otlp-http-production.shopifysvc.com",Ti="portable_wallets";var He;class ki{constructor(e){M(this,He),k(this,He,e)}async exportMetrics(e){var n;try{await A(this,He).exportMetrics(e)}catch(r){if(r instanceof ot){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(i=>{setTimeout(()=>{this.exportMetrics(e),i()},a.seconds*1e3)});return}}throw new Qr("Unable to export metrics",{cause:r})}}async exportLogs(e){var n;try{await A(this,He).exportLogs(e)}catch(r){if(r instanceof ot){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(i=>{setTimeout(()=>{this.exportLogs(e),i()},a.seconds*1e3)});return}}throw new Qr("Unable to export logs",{cause:r})}}}He=new WeakMap;const Li=new Ri(Ni,Ti),xi=new ki(Li),I=new Si({exporter:xi}),Kn="TelemetryExportError";class Qr extends Error{constructor(){super(...arguments),c(this,"name",Kn)}}const $t="GraphQL Client",Jr=0,Xr=3,Qn="An error occurred while fetching from the API. Review 'graphQLErrors' for details.",Jn="Response returned unexpected Content-Type:",Xn="An unknown error has occurred. The API did not return a data object or any errors in its response.",gr={json:"application/json",multipart:"multipart/mixed"},Zr="X-SDK-Variant",en="X-SDK-Version",Oi="shopify-graphql-client",Mi="1.3.0",Zn=1e3,Fi=[429,503],ea=/@(defer)\b/i,tn="\r\n",Ui=/boundary="?([^=";]+)"?/i,rn=tn+tn;function ue(t,e=$t){return t.startsWith("".concat(e))?t:"".concat(e,": ").concat(t)}function Qe(t){return t instanceof Error?t.message:JSON.stringify(t)}function ta(t){return t instanceof Error&&t.cause?t.cause:void 0}function ra(t){return t.flatMap(({errors:e})=>e!=null?e:[])}function na({client:t,retries:e}){if(e!==void 0&&(typeof e!="number"||eXr))throw new Error("".concat(t,': The provided "retries" value (').concat(e,") is invalid - it cannot be less than ").concat(Jr," or greater than ").concat(Xr))}function z(t,e){return e&&(typeof e!="object"||Array.isArray(e)||typeof e=="object"&&Object.keys(e).length>0)?{[t]:e}:{}}function aa(t,e){if(t.length===0)return e;const n={[t.pop()]:e};return t.length===0?n:aa(t,n)}function ia(t,e){return Object.keys(e||{}).reduce((n,r)=>(typeof e[r]=="object"||Array.isArray(e[r]))&&t[r]?(n[r]=ia(t[r],e[r]),n):(n[r]=e[r],n),Array.isArray(t)?[...t]:w({},t))}function oa([t,...e]){return e.reduce(ia,w({},t))}function Bi({clientLogger:t,customFetchApi:e=fetch,client:n=$t,defaultRetryWaitTime:r=Zn,retriableCodes:a=Fi}){const i=async(o,s,l)=>{const d=s+1,u=l+1;let h;try{if(h=await e(...o),t({type:"HTTP-Response",content:{requestParams:o,response:h}}),!h.ok&&a.includes(h.status)&&d<=u)throw new Error;return h}catch(p){if(d<=u){const y=h==null?void 0:h.headers.get("Retry-After");return await $i(y?parseInt(y,10):r),t({type:"HTTP-Retry",content:{requestParams:o,lastResponse:h,retryAttempt:s,maxRetries:l}}),i(o,d,l)}throw new Error(ue("".concat(l>0?"Attempted maximum number of ".concat(l," network retries. Last message - "):"").concat(Qe(p)),n))}};return i}async function $i(t){return new Promise(e=>setTimeout(e,t))}function Hi({headers:t,url:e,customFetchApi:n=fetch,retries:r=0,logger:a}){na({client:$t,retries:r});const i={headers:t,url:e,retries:r},o=Gi(a),s=Bi({customFetchApi:n,clientLogger:o,defaultRetryWaitTime:Zn}),l=zi(s,i),d=Vi(l),u=Ji(l);return{config:i,fetch:l,request:d,requestStream:u}}function Gi(t){return e=>{t&&t(e)}}async function sa(t){const{errors:e,data:n,extensions:r}=await t.json();return w(T(w(w({},z("data",n)),z("extensions",r)),{headers:t.headers}),e||!n?{errors:T(w({networkStatusCode:t.status,message:ue(e?Qn:Xn)},z("graphQLErrors",e)),{response:t})}:{})}function zi(t,{url:e,headers:n,retries:r}){return async(a,i={})=>{const{variables:o,headers:s,url:l,retries:d,keepalive:u,signal:h}=i,p=JSON.stringify({query:a,variables:o});na({client:$t,retries:d});const y=Object.entries(w(w({},n),s)).reduce((_,[E,P])=>(_[E]=Array.isArray(P)?P.join(", "):P.toString(),_),{});!y[Zr]&&!y[en]&&(y[Zr]=Oi,y[en]=Mi);const C=[l!=null?l:e,{method:"POST",headers:y,body:p,signal:h,keepalive:u}];return t(C,1,d!=null?d:r)}}function Vi(t){return async(...e)=>{if(ea.test(e[0]))throw new Error(ue("This operation will result in a streamable response - use requestStream() instead."));try{const n=await t(...e),{status:r,statusText:a}=n,i=n.headers.get("content-type")||"";return n.ok?i.includes(gr.json)?sa(n):{errors:{networkStatusCode:r,message:ue("".concat(Jn," ").concat(i)),response:n}}:{errors:{networkStatusCode:r,message:ue(a),response:n}}}catch(n){return{errors:{message:Qe(n)}}}}}function qi(t){return xe(this,null,function*(){const e=new TextDecoder;if(t.body[Symbol.asyncIterator])try{for(var n=re(t.body),r,a,i;r=!(a=yield new te(n.next())).done;r=!1){const o=a.value;yield e.decode(o)}}catch(o){i=[o]}finally{try{r&&(a=n.return)&&(yield new te(a.call(n)))}finally{if(i)throw i[0]}}else{const o=t.body.getReader();let s;try{for(;!(s=yield new te(o.read())).done;)yield e.decode(s.value)}finally{o.cancel()}}})}function Wi(t,e){return{[Symbol.asyncIterator](){return xe(this,null,function*(){try{let o="";try{for(var n=re(t),r,a,i;r=!(a=yield new te(n.next())).done;r=!1){const s=a.value;if(o+=s,o.indexOf(e)>-1){const l=o.lastIndexOf(e),d=o.slice(0,l).split(e).filter(u=>u.trim().length>0).map(u=>u.slice(u.indexOf(rn)+rn.length).trim());d.length>0&&(yield d),o=o.slice(l+e.length),o.trim()==="--"&&(o="")}}}catch(s){i=[s]}finally{try{r&&(a=n.return)&&(yield new te(a.call(n)))}finally{if(i)throw i[0]}}}catch(o){throw new Error("Error occured while processing stream payload - ".concat(Qe(o)))}})}}}function ji(t){return{[Symbol.asyncIterator](){return xe(this,null,function*(){const e=yield new te(sa(t));yield T(w({},e),{hasNext:!1})})}}}function Yi(t){return t.map(e=>{try{return JSON.parse(e)}catch(n){throw new Error("Error in parsing multipart response - ".concat(Qe(n)))}}).map(e=>{const{data:n,incremental:r,hasNext:a,extensions:i,errors:o}=e;if(!r)return T(w(w({data:n||{}},z("errors",o)),z("extensions",i)),{hasNext:a});const s=r.map(({data:l,path:d,errors:u})=>w({data:l&&d?aa(d,l):{}},z("errors",u)));return T(w({data:s.length===1?s[0].data:oa([...s.map(({data:l})=>l)])},z("errors",ra(s))),{hasNext:a})})}function Ki(t,e){if(t.length>0)throw new Error(Qn,{cause:{graphQLErrors:t}});if(Object.keys(e).length===0)throw new Error(Xn)}function Qi(t,e){var n,r;const a=(e!=null?e:"").match(Ui),i="--".concat(a?a[1]:"-");if(!((n=t.body)!=null&&n.getReader)&&!((r=t.body)!=null&&r[Symbol.asyncIterator]))throw new Error("API multipart response did not return an iterable body",{cause:t});const o=qi(t);let s={},l;return{[Symbol.asyncIterator](){return xe(this,null,function*(){var d,u;try{let _=!0;try{for(var h=re(Wi(o,i)),p,y,C;p=!(y=yield new te(h.next())).done;p=!1){const E=y.value,P=Yi(E);l=(u=(d=P.find(B=>B.extensions))==null?void 0:d.extensions)!=null?u:l;const $=ra(P);s=oa([s,...P.map(({data:B})=>B)]),_=P.slice(-1)[0].hasNext,Ki($,s),yield T(w(w({},z("data",s)),z("extensions",l)),{hasNext:_})}}catch(E){C=[E]}finally{try{p&&(y=h.return)&&(yield new te(y.call(h)))}finally{if(C)throw C[0]}}if(_)throw new Error("Response stream terminated unexpectedly")}catch(_){const E=ta(_);yield T(w(w({},z("data",s)),z("extensions",l)),{errors:T(w({message:ue(Qe(_)),networkStatusCode:t.status},z("graphQLErrors",E==null?void 0:E.graphQLErrors)),{response:t}),hasNext:!1})}})}}}function Ji(t){return async(...e)=>{if(!ea.test(e[0]))throw new Error(ue("This operation does not result in a streamable response - use request() instead."));try{const n=await t(...e),{statusText:r}=n;if(!n.ok)throw new Error(r,{cause:n});const a=n.headers.get("content-type")||"";switch(!0){case a.includes(gr.json):return ji(n);case a.includes(gr.multipart):return Qi(n,a);default:throw new Error("".concat(Jn," ").concat(a),{cause:n})}}catch(n){return{[Symbol.asyncIterator](){return xe(this,null,function*(){const r=ta(n);yield{errors:w(w({message:ue(Qe(n))},z("networkStatusCode",r==null?void 0:r.status)),z("response",r)),hasNext:!1}})}}}}}var g=(t=>(t.InvalidLanguage="Variable $language of type LanguageCode was provided invalid value",t.InvalidCountry="Variable $country of type CountryCode was provided invalid value",t.MissingCartId="Variable $cartId of type ID! was provided invalid value",t.BuyerIdentityInvalidCountry="Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode",t.BuyerIdentityInvalidPhone="INVALID: buyerIdentity.phone",t.BuyerIdentityEmailRequired="BUYER_IDENTITY_EMAIL_REQUIRED",t.BuyerIdentityEmailDomainInvalid="BUYER_IDENTITY_EMAIL_DOMAIN_IS_INVALID",t.BuyerIdentityEmailNotExpectedPattern="BUYER_IDENTITY_EMAIL_DOES_NOT_MATCH_EXPECTED_PATTERN",t.BuyerIdentityEmailInvalid="INVALID: buyerIdentity.email",t.CaptchaCompletionRequired="CAPTCHA_COMPLETION_REQUIRED",t.CustomValidation="".concat(It),t.DeliveryFirstNameInvalid="DELIVERY_FIRST_NAME_INVALID",t.DeliveryFirstNameRequired="DELIVERY_FIRST_NAME_REQUIRED",t.BuyerIdentityDeliveryFirstNameRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameContainsUrl="ADDRESS_FIELD_CONTAINS_URL: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryLastNameInvalid="DELIVERY_LAST_NAME_INVALID",t.DeliveryLastNameRequired="DELIVERY_LAST_NAME_REQUIRED",t.BuyerIdentityDeliveryLastNameRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameContainsUrl="ADDRESS_FIELD_CONTAINS_URL: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.BuyerIdentityDeliveryAddress1Required="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress1Required="DELIVERY_ADDRESS1_REQUIRED",t.DeliveryAddress1Invalid="DELIVERY_ADDRESS1_INVALID",t.DeliveryAddress1TooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress1ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress1ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress2Required="DELIVERY_ADDRESS2_REQUIRED",t.DeliveryAddress2AddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryAddress2Invalid="DELIVERY_ADDRESS2_INVALID",t.DeliveryAddress2TooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryAddress2ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryAddress2ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryCityRequired="DELIVERY_CITY_REQUIRED",t.DeliveryCityAddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryCityInvalid="DELIVERY_CITY_INVALID",t.DeliveryCityTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryCityContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryCityContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryZoneNotFound="DELIVERY_ZONE_NOT_FOUND",t.DeliveryZoneRequiredForCountry="DELIVERY_ZONE_REQUIRED_FOR_COUNTRY",t.DeliveryProvinceRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.province",t.DeliveryPostalCodeInvalid="DELIVERY_POSTAL_CODE_INVALID",t.DeliveryInvalidPostalCodeForZone="DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE",t.DeliveryInvalidPostalCodeForCountry="DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY",t.DeliveryPostalCodeRequired="DELIVERY_POSTAL_CODE_REQUIRED",t.DeliveryPostalCodeAddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE",t.BuyerIdentityDeliveryZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryZipInvalidForCountry="INVALID_ZIP_CODE_FOR_COUNTRY: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryPostalCodeContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryCountryRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country",t.DeliveryCountryInvalid="INVALID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country",t.DeliveryPhoneNumberRequired="DELIVERY_PHONE_NUMBER_REQUIRED",t.BuyerIdentityDeliveryPhoneNumberRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone",t.DeliveryOptionsPhoneNumberRequired="DELIVERY_OPTIONS_PHONE_NUMBER_REQUIRED",t.DeliveryPhoneNumberInvalid="DELIVERY_PHONE_NUMBER_INVALID",t.DeliveryPhoneDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone",t.MerchandiseOutOfStock="MERCHANDISE_OUT_OF_STOCK",t.MerchandiseNotEnoughStock="MERCHANDISE_NOT_ENOUGH_STOCK",t.InvalidQuantity="INVALID: input.lines.0.quantity",t.DeliveryOutOfStockAtOrigin="DELIVERY_OUT_OF_STOCK_AT_ORIGIN_LOCATION",t.DeliveryExternalPromiseUnfulfillable="DELIVERY_EXTERNAL_PROMISE_UNFULFILLABLE",t.MerchandiseNotApplicable="MERCHANDISE_NOT_APPLICABLE",t.MerchandiseVariantNotFound="MERCHANDISE_PRODUCT_VARIANT_NOT_FOUND",t.MerchandiseNotFound="MERCHANDISE_NOT_FOUND",t.MerchandiseNotPublished="MERCHANDISE_PRODUCT_NOT_PUBLISHED",t.MerchandiseNotSupportedForB2B="MERCHANDISE_SELLING_PLANS_NOT_SUPPORTED_FOR_B2B",t.MerchandiseBundleRequiresComponents="MERCHANDISE_BUNDLE_REQUIRES_COMPONENTS",t.MerchandiseGiftCardsNotSupported="MERCHANDISE_GIFT_CARDS_COMPONENTS_NOT_SUPPORTED",t.MerchandiseGiftCardGreaterThanZero="MERCHANDISE_GIFT_CARD_PRICE_MUST_BE_GREATER_THAN_ZERO",t.MerchandiseGiftCardCannotExceedLimit="MERCHANDISE_GIFT_CARD_PRICE_MUST_NOT_EXCEED_LIMIT",t.UnacceptablePaymentsAmount="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT",t.DiscountNotApplicable="DISCOUNT_NOT_APPLICABLE",t.DeliveryNotAvailable="DELIVERY_NO_DELIVERY_AVAILABLE",t.DeliveryNoStrategyAvailable="DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE",t.DeliveryNoLocalPickupStrategyAvailable="DELIVERY_LOCAL_PICKUP_NO_DELIVERY_STRATEGY_AVAILABLE",t.DeliveryLineChanged="DELIVERY_DELIVERY_LINE_DETAIL_CHANGED",t.DeliveryLocalPickupLineChanged="DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED",t.DeliveryNoDeliveryAvailableForMerchandise="DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE_FOR_MERCHANDISE_LINE",t.DeliveryFulfillmentConstraintNotSatisfied="DELIVERY_MUST_FULFILL_FROM_CONSTRAINT_NOT_SATISFIED",t.DeliveryFulfillmentLocationConstraint="DELIVERY_MUST_FULFILL_FROM_SAME_LOCATION_CONSTRAINT_NOT_SATISFIED",t.NoDeliveryGroupSelected="NO_DELIVERY_GROUP_SELECTED",t.DeliveryOptionInvalid="INVALID_DELIVERY_OPTION: selectedDeliveryOptions",t.DeliveryGroupInvalid="INVALID_DELIVERY_GROUP: selectedDeliveryOptions",t.DeliveryDetailChanged="DELIVERY_DETAIL_CHANGED",t.PendingDeliveryGroups="PENDING_DELIVERY_GROUPS",t.InvalidPaymentAmount="INVALID_PAYMENT: amount",t.InvalidPaymentPaymentAmount="INVALID_PAYMENT: payment.amount",t.NewTaxMustBeAccepted="TAX_NEW_TAX_MUST_BE_ACCEPTED",t.MerchandiseExpectedPriceMismatch="MERCHANDISE_EXPECTED_PRICE_MISMATCH",t.InvalidPaymentApplePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress",t.InvalidPaymentGooglePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.googlePayWalletContent.billingAddress",t.InvalidPaymentBillingAddress="INVALID_PAYMENT: payment.freePaymentMethod.billingAddress",t.UnsupportedGooglePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.googlePayWalletContent",t.UnsupportedApplePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.applePayWalletContent",t.PaymentMethodNotApplicable="PAYMENT_METHOD_NOT_APPLICABLE: payment",t.InvalidPaymentDeferredPaymentRequired="INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED: payment",t))(g||{});const Xi=["DELIVERY_FIRST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],Zi=["DELIVERY_FIRST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],eo=["DELIVERY_LAST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],to=["DELIVERY_LAST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],ro=["DELIVERY_ADDRESS1_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1"],no=["DELIVERY_ADDRESS2_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2"],ao=["DELIVERY_CITY_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city"],io=["DELIVERY_POSTAL_CODE_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],la=["DELIVERY_POSTAL_CODE_INVALID","INVALID_ZIP_CODE_FOR_COUNTRY: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip","INVALID_ZIP_CODE_FOR_PROVINCE","DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE","DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY","INVALID_ZIP_CODE_FOR_PROVINCE: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],oo=["DELIVERY_PHONE_NUMBER_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],so=["INVALID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country","Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode"],lo=["DELIVERY_PHONE_NUMBER_INVALID","INVALID: buyerIdentity.phone","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],ca=["INVALID_DELIVERY_OPTION: selectedDeliveryOptions","INVALID_DELIVERY_GROUP: selectedDeliveryOptions","DELIVERY_NO_DELIVERY_AVAILABLE","DELIVERY_DETAIL_CHANGED","NO_DELIVERY_GROUP_SELECTED","DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE","DELIVERY_LOCAL_PICKUP_NO_DELIVERY_STRATEGY_AVAILABLE"],da=["INVALID_PAYMENT: amount","INVALID_PAYMENT: payment.amount"],Dr=["TAX_NEW_TAX_MUST_BE_ACCEPTED","PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"],co=["DELIVERY_DELIVERY_LINE_DETAIL_CHANGED","DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED"],uo=["INVALID_PAYMENT: payment.freePaymentMethod.billingAddress","INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress"],ua=["DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE_FOR_MERCHANDISE_LINE","DELIVERY_OUT_OF_STOCK_AT_ORIGIN_LOCATION","DELIVERY_MUST_FULFILL_FROM_CONSTRAINT_NOT_SATISFIED","DELIVERY_MUST_FULFILL_FROM_SAME_LOCATION_CONSTRAINT_NOT_SATISFIED","DELIVERY_EXTERNAL_PROMISE_UNFULFILLABLE","MERCHANDISE_OUT_OF_STOCK","MERCHANDISE_PRODUCT_VARIANT_NOT_FOUND","MERCHANDISE_NOT_FOUND","MERCHANDISE_PRODUCT_NOT_PUBLISHED","MERCHANDISE_SELLING_PLANS_NOT_SUPPORTED_FOR_B2B","MERCHANDISE_BUNDLE_REQUIRES_COMPONENTS","MERCHANDISE_GIFT_CARDS_COMPONENTS_NOT_SUPPORTED","MERCHANDISE_GIFT_CARD_PRICE_MUST_BE_GREATER_THAN_ZERO","MERCHANDISE_GIFT_CARD_PRICE_MUST_NOT_EXCEED_LIMIT","INVALID: input.lines.0.quantity","MERCHANDISE_NOT_APPLICABLE"],ho="mutation cartCreate($input:CartInput!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false)@inContext(country:$country language:$language){result:cartCreate(input:$input){...@defer(if:$withCarrierRates){cart{...CartParts}errors:userErrors{...on CartUserError{message field code}}warnings:warnings{...on CartWarning{code}}}}}",po="mutation cartAttributesUpdate($cartId:ID!$attributes:[AttributeInput!]!$country:CountryCode=CA$language:LanguageCode=EN$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartAttributesUpdate(cartId:$cartId attributes:$attributes){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",mo="mutation cartBillingAddressUpdate($cartId:ID!$billingAddress:MailingAddressInput$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartBillingAddressUpdate(cartId:$cartId billingAddress:$billingAddress){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",yo="mutation cartBuyerIdentityUpdate($cartId:ID!$buyerIdentity:CartBuyerIdentityInput!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartBuyerIdentityUpdate(cartId:$cartId buyerIdentity:$buyerIdentity){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",go="mutation cartSelectedDeliveryOptionsUpdate($cartId:ID!$selectedDeliveryOptions:[CartSelectedDeliveryOptionInput!]!$country:CountryCode=CA$language:LanguageCode=EN$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartSelectedDeliveryOptionsUpdate(cartId:$cartId selectedDeliveryOptions:$selectedDeliveryOptions){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",fo="mutation applePaySessionCreate($validationUrl:URL!){applePaySessionCreate(validationUrl:$validationUrl){...@defer{applePaySession{body}}}}",bo="mutation PayPalBuyerDetailsFetch($token:String!$cartId:ID){paypalBuyerDetailsFetch(token:$token cartId:$cartId){...@defer{paypalDetails{email expiresAt remoteOrderId destinationAddress{...on MailingAddress{address1 address2 city company country firstName lastName phone province zip}}billingAddress{...on MailingAddress{address1 address2 city company country firstName lastName phone province zip}}}}}}",wo="mutation PayPalTokenCreate($cartId:ID!){paypalTokenCreate(cartId:$cartId){...@defer{paypalToken{token}}}}",_o="query cartQuery($id:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false)@inContext(country:$country language:$language){cart(id:$id){...@defer(if:$withCarrierRates){...CartParts}}}",Eo="query limitedCartQuery($id:ID!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){cart(id:$id){id lines(first:50){edges{node{merchandise{...on ProductVariant{requiresShipping}}sellingPlanAllocation{sellingPlan{id}}}}}}}",Ao="query subscriptionPolicyQuery($country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){shop{subscriptionPolicy(sanitized:true){body}}}",Co="mutation cartPaymentUpdate($cartId:ID!$input:CartPaymentInput!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartPaymentUpdate(cartId:$cartId payment:$input){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",Et="fragment CartParts on Cart{id checkoutUrl deliveryGroups(first:10 withCarrierRates:$withCarrierRates){edges{node{id groupType selectedDeliveryOption{code title handle deliveryPromise deliveryMethodType estimatedCost{amount currencyCode}}deliveryOptions{code title handle deliveryPromise deliveryMethodType estimatedCost{amount currencyCode}}}}}cost{subtotalAmount{amount currencyCode}totalAmount{amount currencyCode}totalTaxAmount{amount currencyCode}totalDutyAmount{amount currencyCode}}discountAllocations{discountedAmount{amount currencyCode}...on CartCodeDiscountAllocation{code}...on CartAutomaticDiscountAllocation{title}...on CartCustomDiscountAllocation{title}}discountCodes{code applicable}lines(first:10){edges{node{quantity cost{subtotalAmount{amount currencyCode}totalAmount{amount currencyCode}}discountAllocations{discountedAmount{amount currencyCode}...on CartCodeDiscountAllocation{code}...on CartAutomaticDiscountAllocation{title}...on CartCustomDiscountAllocation{title}}merchandise{...on ProductVariant{requiresShipping}}sellingPlanAllocation{priceAdjustments{price{amount currencyCode}}sellingPlan{billingPolicy{...on SellingPlanRecurringBillingPolicy{interval intervalCount}}priceAdjustments{orderCount}recurringDeliveries}}}}}}",nr="fragment CartErrorParts on CartUserError{message field code}",nn="fragment PreparedCartFragment on Mutation{preparedCart:cartPrepareForCompletion(cartId:$cartId)@include(if:$prepareCart){...@defer{result{__typename ...on CartStatusReady{cart{...CartParts}}...on CartStatusNotReady{cart{...CartParts}errors{code message}}...on CartThrottled{cart{...CartParts}pollAfter}}errors:userErrors{...CartErrorParts}}}}",So="mutation prepareCart($cartId:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=true)@inContext(country:$country language:$language){...PreparedCartFragment}",Io="mutation cartSubmitForCompletion($cartId:ID!$attemptToken:String!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){cartSubmitForCompletion(cartId:$cartId attemptToken:$attemptToken){result{__typename ...on SubmitSuccess{redirectUrl}...on SubmitThrottled{pollAfterV2:pollAfter}...on SubmitFailed{errors{code message}checkoutUrl}}errors:userErrors{...on CartUserError{code field message}}}}",Po="mutation cartRemovePersonalData($cartId:ID!){cartRemovePersonalData(cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}";async function vo(t,e){var n,r;if(!e.errors)return;const a=Lo(e.errors,t),i=await ko(e.errors.response),o=((r=(n=e.errors.response)==null?void 0:n.headers)==null?void 0:r.get("content-type"))||void 0,s=[];if(e.errors.graphQLErrors)for(const l of e.errors.graphQLErrors)l.code&&s.push(l.code);return{operationName:t,statusCode:e.errors.networkStatusCode,contentType:o,message:a,responseBody:i,errorCodes:s}}const Do=[/API multipart response did not return an iterable body/],Ro=[/signal is aborted/i,/fetch is aborted/i,/operation was aborted/i],No=[/timed?.out/i,/error occured while processing stream payload/i,/response stream terminated/i];function To(t,{hasBeenVisible:e=!1}={}){if(t.statusCode&&t.statusCode!==200)return{isIgnorable:!0,reason:"statusCode-".concat(t.statusCode)};if(t.message){if(No.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"timeout"};if(Ro.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"abort"};if(Do.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"message"}}return e?{isIgnorable:!1,reason:void 0}:{isIgnorable:!0,reason:"component-not-visible"}}async function ko(t){if(!t||t.bodyUsed)return"";try{return(await t.text()).slice(0,1024)}catch(e){return console.error("Failed to read response body:",e),""}}function Lo(t,e){var n,r;if(!t)return"";const a=(r=(n=t.graphQLErrors)==null?void 0:n.map(s=>s.message).join(", "))!=null?r:"",i="".concat(t.message).concat(a.length>0?" - ".concat(a):""),o=t.networkStatusCode?"with status ".concat(t.networkStatusCode," => ").concat(i):"=> ".concat(i);return"GraphQL response error for ".concat(e,": ").concat(o)}function xo(t){const{operationName:e,errorCodes:n}=t,r=n.join("-")||"unknown";return"".concat(e,"-").concat(r)}const an="UNKNOWN";function Oo({url:t,accessToken:e}){return{headers:{"Content-Type":"application/json",Accept:"application/json","X-Shopify-Storefront-Access-Token":e,"X-SDK-Variant":"portable-wallets"},url:t,retries:0,customFetchApi:(n,r)=>(b.leaveBreadcrumb("Request ".concat((r==null?void 0:r.method)||an,": ").concat(n),{url:n,method:r==null?void 0:r.method},"request"),fetch(n,r)),logger:n=>{if(n.type==="HTTP-Response"){const[r,a]=n.content.requestParams,{status:i,statusText:o,headers:s,type:l}=n.content.response;b.leaveBreadcrumb("Response ".concat((a==null?void 0:a.method)||an,": ").concat(r),{statusCode:i,statusText:o,responseHeaders:Mo(s),responseType:l,url:r,method:a==null?void 0:a.method,headers:a==null?void 0:a.headers,body:a==null?void 0:a.body},"log")}}}}function Mo(t){if("fromEntries"in Object)return Object.fromEntries(t);const e={};for(const[n,r]of t.entries())e[n]=r;return e}var f=(t=>(t.BuyItNow="BuyItNow",t.MoreOptions="MoreOptions",t.ApplePay="ApplePay",t.PayPal="PayPal",t.Venmo="Venmo",t.GooglePay="GooglePay",t.ShopPay="ShopPay",t.MetaPay="FacebookPay",t.BuyWithPrime="BuyWithPrime",t.AmazonPay="AmazonPay",t.Unknown="Unknown",t))(f||{}),Ht=(t=>(t.InvalidQuantity="InvalidQuantity",t))(Ht||{}),S=(t=>(t.CartPage="cart_page",t.CartAjax="cart_ajax",t.ProductPage="product",t.Checkout="checkout",t.Unknown="unknown",t))(S||{}),rt=(t=>(t.CartChange="/cart/change",t.CartUpdate="/cart/update",t.CartAdd="/cart/add",t.CartClear="/cart/clear",t))(rt||{}),Re=(t=>(t.OneTimePurchase="ONE_TIME_PURCHASE",t.Subscription="SUBSCRIPTION",t))(Re||{});function Fo(t){const e=document.querySelectorAll("shopify-accelerated-checkout .shopify-payment-button__skeleton, shopify-accelerated-checkout-cart .wallet-cart-button__skeleton"),n=document.getElementById("shopify-buyer-consent");for(let r=0;re.toString(16)).join("")}function Vo(t,e=!0){return t&&Object.keys(t).length&&e?Object.keys(t).map(n=>({[qo(n)]:t[n]})).reduce((n,r)=>sn(sn({},n),r)):t}function qo(t){return t.split(/(?=[A-Z])/).join("_").toLowerCase()}function Wo(t){const e={"Content-Type":"application/json; charset=utf-8","X-Monorail-Edge-Event-Created-At-Ms":(t&&t.eventCreatedAtMs||Date.now()).toString(),"X-Monorail-Edge-Event-Sent-At-Ms":Date.now().toString(),"X-Monorail-Edge-Client-Message-Id":(t&&t.clientMessageId||zo()).toString()};return t&&t.userAgent&&(e["User-Agent"]=t.userAgent),t&&t.remoteIp&&(e["X-Forwarded-For"]=t.remoteIp),t&&t.deviceInstallId&&(e["X-Monorail-Edge-Device-Install-Id"]=t.deviceInstallId),t&&t.client&&(e["X-Monorail-Edge-Client"]=t.client),t&&t.clientOs&&(e["X-Monorail-Edge-Client-OS"]=t.clientOs),e}async function jo({endpoint:t,event:e,keepalive:n}){var r,a,i,o,s;const l=e.metadata?{clientMessageId:(r=e.metadata)===null||r===void 0?void 0:r.clientMessageId,eventCreatedAtMs:(a=e.metadata)===null||a===void 0?void 0:a.eventCreatedAtMs,consent:(i=e.metadata)===null||i===void 0?void 0:i.consent,consent_provider:(o=e.metadata)===null||o===void 0?void 0:o.consent_provider,consent_version:(s=e.metadata)===null||s===void 0?void 0:s.consent_version}:void 0;return fetch(t!=null?t:Ho+Go,{method:"post",headers:Wo(e.metadata),body:JSON.stringify({schema_id:e.schemaId,payload:e.payload,metadata:l&&Vo(l,!0)}),keepalive:n})}const Yo="2.1",Ko="3",ar={NO_VALUE:"",ACCEPTED:"1",DECLINED:"0"},K={PREFERENCES:"p",ANALYTICS:"a",MARKETING:"m",SALE_OF_DATA:"t"},se={MARKETING:"m",ANALYTICS:"a",PREFERENCES:"p",SALE_OF_DATA:"s"},Qo=()=>typeof __CtaTestEnv__>"u"?!1:__CtaTestEnv__==="true",Jo="_tracking_consent";function ln(t){try{return decodeURIComponent(t)}catch(e){return""}}function pa(t,e=!1){const n=document.cookie?document.cookie.split("; "):[];for(let r=0;ry.charCodeAt(0).toString(16).padStart(2,"0")).join("");l=[8,13,18,23].reduce((y,C)=>y.slice(0,C)+"-"+y.slice(C),p)}function d(h){const p=n.split(".")[0];return p.includes(h.toLowerCase())?ar.DECLINED:p.includes(h.toUpperCase())?ar.ACCEPTED:ar.NO_VALUE}function u(h){return n.includes(h.replace("t","s").toUpperCase())}return{v:Ko,con:{CMP:{[se.ANALYTICS]:d(se.ANALYTICS),[se.PREFERENCES]:d(se.PREFERENCES),[se.MARKETING]:d(se.MARKETING),[se.SALE_OF_DATA]:d(se.SALE_OF_DATA)}},region:r||"",cus:s,purposes:{[K.ANALYTICS]:u(K.ANALYTICS),[K.PREFERENCES]:u(K.PREFERENCES),[K.MARKETING]:u(K.MARKETING),[K.SALE_OF_DATA]:u(K.SALE_OF_DATA)},sale_of_data_region:i=="t",display_banner:a=="t",consent_id:l}}function Gt(t){const e=rs();if(!e||!e.purposes)return!0;const n=e.purposes[t];return typeof n=="boolean"?n:!0}function os(){return Gt(K.PREFERENCES)}function ss(){return Gt(K.ANALYTICS)}function ls(){return Gt(K.MARKETING)}function cs(){return Gt(K.SALE_OF_DATA)}function ds(){return ss()}function us(){return os()}function hs(){return ls()}function ps(){return cs()}function ms(){return hs()}function ys(){return ds()}function gs(){return us()}function fs(){return ps()}function bs(){const t=[];return ys()&&t.push("analytics"),ms()&&t.push("marketing"),fs()&&t.push("sale_of_data"),gs()&&t.push("preferences"),t}function ws(t,e){switch(e){case"v1":{const n=bs();return T(w({},t),{metadata:T(w({},t==null?void 0:t.metadata),{consent:n,consent_provider:"consent-tracking-api",consent_version:e})})}default:throw new Rr(e)}}class Rr extends Error{constructor(e){super("Version ".concat(e," is not supported by the consent-tracking-api provider")),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,Rr.prototype)}}var D=(t=>(t.ButtonRender="portable_wallets_button_render",t.Decelerated="portable_wallets_decelerated",t.InitCompleted="portable_wallets_init_completed",t.InstrumentLoadEligibility="portable_wallets_instrument_load_eligibility",t.InstrumentLoadTime="portable_wallets_instrument_load_time",t.InstrumentLoadTimeFromPageLoad="portable_wallets_instrument_load_time_from_page_load",t.MonorailProduceError="portable_wallets_monorail_produce_error",t.SheetClicked="portable_wallets_sheet_clicked",t.SheetCancelled="portable_wallets_sheet_cancelled",t.SheetFailed="portable_wallets_sheet_failed",t.UpdateFailed="portable_wallets_update_failed",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.CartTokenMissing="portable_wallets_cart_token_missing",t.RemovePersonalDataResult="portable_wallets_cart_remove_personal_data_result",t.GooglePayNotEligibleWebview="portable_wallets_google_pay_not_eligible_webview",t.WalletConfigDeveloperError="portable_wallets_wallet_config_developer_error",t.LegacyCartCookie="portable_wallets_legacy_cart_cookie",t.StyleBackwardsCompatibility="portable_wallets_style_backwards_compatibility",t.StyleBackwardsCompatibilityExecutionTime="portable_wallets_style_backwards_compatibility_execution_time",t.StyleBackwardsCompatibilityRules="portable_wallets_style_backwards_compatibility_rules",t.AmazonPayLoadRetries="portable_wallets_amazon_pay_sdk_load_retries",t.DynamicTaxFailed="portable_wallets_dynamic_tax_failed",t.DynamicShippingFailed="portable_wallets_dynamic_shipping_failed",t.SheetLoaded="portable_wallets_sheet_loaded",t.ErrorTriggered="portable_wallets_error_triggered",t.AmazonAdExperimentAcceleratedCheckoutButtonClicked="portable_wallets_amazon_ad_experiment_accelerated_checkout_button_clicked",t.AmazonAdExperimentAcceleratedCheckoutButtonSetup="portable_wallets_amazon_ad_experiment_accelerated_checkout_button_setup",t.AmazonAdExperimentPaymentButtonHidden="portable_wallets_amazon_ad_experiment_payment_button_hidden",t.AmazonAdExperimentRecommendedWalletOverriden="portable_wallets_amazon_ad_experiment_recommended_wallet_overriden",t))(D||{}),ve=(t=>(t.InstrumentSdkLoaded="portable_wallets_instrument_sdk_loaded",t.InstrumentSdkFailed="portable_wallets_instrument_sdk_failed",t.InstrumentSdkEligible="portable_wallets_instrument_sdk_eligible",t.InstrumentSdkNotEligible="portable_wallets_instrument_sdk_not_eligible",t))(ve||{});const _s=["Chrome-Lighthouse","Googlebot"];function Es(){const t=navigator.userAgent;return _s.some(e=>t.includes(e))}async function As(t){if(Es())return;const e=ws(t,"v1");let n;try{n=await jo({event:e})}catch(r){}if(!(n!=null&&n.ok))try{I.counter({name:D.MonorailProduceError,value:1,attributes:{schemaId:e.schemaId}})}catch(r){}}const ir="shopify_wallet_checkout_track/6.2";async function V(t){var e,n,r,a,i,o,s;const l=await Cs();if(!l)return;const d={schemaId:ir,payload:{app_name:"storefront",page_type:ll(),checkout_one:!0,event:t.event,event_subtype:t.eventSubtype,checkout_token:t.checkoutToken,instrument_id:t.instrumentId,ttl:t.ttl,error_reason:t.errorReason,uniq_token:(e=l==null?void 0:l.uniqToken)!=null?e:"",visit_token:(n=l==null?void 0:l.visitToken)!=null?n:"",micro_session_id:(r=l==null?void 0:l.microSessionId)!=null?r:"",micro_session_count:(a=l==null?void 0:l.microSessionCount)!=null?a:0,shop_id:(i=l==null?void 0:l.shopId)!=null?i:0,theme_id:l==null?void 0:l.themeId,theme_city_hash:(o=l==null?void 0:l.themeCityHash)!=null?o:"",content_language:(s=l==null?void 0:l.contentLanguage)!=null?s:"",referer:l==null?void 0:l.referer}};b.leaveBreadcrumb("monorail event produced to ".concat(ir),{schemaId:ir,payload:t});try{await As(d)}catch(u){b.notify(new Ss("Failed to send monorail event: ".concat(u),{cause:u}),{metadata:{request:{monorail:{payload:JSON.stringify(d)}}}})}}async function Cs(){var t,e,n,r,a;return(e=(t=window==null?void 0:window.ShopifyAnalytics)==null?void 0:t.lib)!=null&&e.trekkie||await new Promise(i=>{const o=setInterval(()=>{var l,d;(d=(l=window==null?void 0:window.ShopifyAnalytics)==null?void 0:l.lib)!=null&&d.trekkie&&(clearInterval(o),i())},100),s=setTimeout(()=>{clearInterval(o),clearTimeout(s),i()},7e3)}),(a=(r=(n=window.ShopifyAnalytics)==null?void 0:n.lib)==null?void 0:r.trekkie)==null?void 0:a.defaultAttributes}class Ss extends Error{constructor(){super(...arguments),c(this,"name","MonorailError")}}var H=(t=>(t.CartInitCalled="portable_wallets_cart_init_called",t.ClickSheetCancelled="portable_wallets_instrument_click_sheet_cancelled",t.ClickSheetFailed="portable_wallets_instrument_click_sheet_failure",t.ClickSheetSuccess="portable_wallets_instrument_click_sheet_success",t.SheetFailed="portable_wallets_instrument_sheet_failed",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.InitCalled="portable_wallets_init_called",t.InitFailed="portable_wallets_init_failed",t.InitSuccess="portable_wallets_init_success",t.UpdateFailed="portable_wallets_instrument_update_failed",t.InstrumentLoaded="portable_wallets_instrument_loaded",t.InstrumentLoadFailed="portable_wallets_instrument_load_failed",t.FirstVisible="portable_wallets_first_visible",t.FirstVisibleNotAvailable="portable_wallets_first_visible_not_available",t.SheetLoaded="portable_wallets_sheet_loaded",t))(H||{});const cn={[S.Checkout]:"bwp_checkout_widget_click",[S.CartAjax]:"bwp_cart_widget_click",[S.CartPage]:"bwp_cart_widget_click",[S.ProductPage]:"bwp_widget_click",[S.Unknown]:"bwp_widget_click"};function Is({apiClientId:t,skus:e,pageType:n}){var r;if(!((r=window.Shopify)!=null&&r.analytics))return;const a=n&&cn[n]||"bwp_widget_click";a===cn[S.Checkout]&&window.Shopify.analytics.publish("shopify:app:pixels:load:".concat(t),{},{sendTo:"PIXEL-LOADER"}),e&&window.Shopify.analytics.publish(a,{skus:e},{sendTo:t})}let zt=Ps();function Ps(){return{shopId:Gn,debug:!1,pageType:S.Unknown}}function vs(t){Object.assign(zt,t)}function Nr(){const t=zt,{debug:e}=t;return er(t,["debug"])}function Ds(){return zt.debug}function ma(){return zt.pageType}function x(t){return w({pageType:ma()},t)}function Rs(){const t=ma()===S.CartPage?H.CartInitCalled:H.InitCalled;V({event:t})}function Ns(t){var e,n;const r=t?"Failed":"Success",a=t&&Ks(t)?"[".concat(t.name,"]: ").concat(t.code):void 0,i=H["Init".concat(r)];V({event:i,eventSubtype:a}),I.counter({name:D.InitCompleted,value:1,attributes:x({result:r.toLowerCase(),eventType:a,recoveredFailure:!!((n=(e=window.Shopify)==null?void 0:e.PaymentButton)!=null&&n.failedToLoad)})})}function Ts({instrumentOrComponentName:t,result:e,measurement:n}){V({event:e==="success"?H.InstrumentLoaded:H.InstrumentLoadFailed,instrumentId:t,ttl:n}),n!=null&&(I.histogram({name:D.InstrumentLoadTime,value:n,attributes:x({instrument:t}),unit:"ms"}),I.histogram({name:D.InstrumentLoadTimeFromPageLoad,value:window.performance.now(),attributes:x({instrument:t}),unit:"ms"}))}function ks({instrument:t,measurement:e,result:n}){const r=n==="success"?ve.InstrumentSdkLoaded:ve.InstrumentSdkFailed;V({event:r,instrumentId:t,ttl:e,errorReason:n==="success"?void 0:n}),e!=null&&I.histogram({name:ve.InstrumentSdkLoaded,value:e,attributes:x({instrument:t,result:n}),unit:"ms"})}function Ls({instrument:t,result:e,reason:n}){const r=e==="success"?ve.InstrumentSdkEligible:ve.InstrumentSdkNotEligible;V({event:r,instrumentId:t}),I.counter({name:ve.InstrumentSdkEligible,value:1,attributes:x({instrument:t,reason:n,result:e})})}function xs({instrument:t,result:e,reason:n}){I.counter({name:D.InstrumentLoadEligibility,value:1,attributes:x({instrument:t,result:e,reason:n})})}function Os(t){I.counter({name:D.ButtonRender,value:1,attributes:x({result:"success",instrument:t})})}function Ms(t){I.counter({name:D.ButtonRender,value:1,attributes:x({result:"failed",instrument:t})})}function Fs({instrument:t,result:e,webPixelMetaData:n}){V({event:e==="success"?H.ClickSheetSuccess:H.ClickSheetFailed,instrumentId:t}),I.counter({name:D.SheetClicked,value:1,attributes:x({instrument:t,result:e})}),t===f.BuyWithPrime&&n&&Is(n)}function Us(t,e){V({event:"".concat(H.UpdateFailed,"-").concat(e),instrumentId:t}),I.counter({name:D.UpdateFailed,value:1,attributes:x({instrument:t,request:e})})}function Bs(t){V({event:H.ClickSheetCancelled,instrumentId:t}),I.counter({name:D.SheetCancelled,value:1,attributes:x({instrument:t})})}function $s(t,e){V({event:H.SheetFailed,instrumentId:t,errorReason:e==null?void 0:e.message}),I.counter({name:D.SheetFailed,value:1,attributes:x({instrument:t})})}function Hs(t){V({event:H.AuthorizationAttempt,instrumentId:t}),I.counter({name:D.AuthorizationAttempt,value:1,attributes:x({instrument:t})})}function Gs({instrument:t,measurement:e,result:n}){V({event:H.AuthorizationComplete,eventSubtype:n,ttl:e,instrumentId:t}),e!=null&&I.histogram({name:D.AuthorizationComplete,value:e,attributes:x({instrument:t,result:n}),unit:"ms"})}function zs({instrument:t,reason:e}){I.counter({name:D.Decelerated,value:1,attributes:x({instrument:t,reason:e})}),m.flushTelemetry()}function Vs({reason:t}){I.counter({name:D.CartTokenMissing,value:1,attributes:{reason:t}})}function qs({success:t}){I.counter({name:D.RemovePersonalDataResult,value:1,attributes:x({success:t})})}function Ws(){I.counter({name:D.WalletConfigDeveloperError,value:1})}function js(){I.counter({name:D.LegacyCartCookie,value:1})}function Ys(){window.setInterval(()=>{ya()},1e3)}function Ks(t){return(t==null?void 0:t.name)===ft}function ya(){I.exportMetrics(),I.exportLogs()}function Qs(t){const{body:e,attributes:n}=t;I.log({body:e,attributes:w(w({},Nr()),n)})}function Js({usedBackwardsCompatibility:t}){I.counter({name:D.StyleBackwardsCompatibility,value:1,attributes:{usedBackwardsCompatibility:t}})}function Xs({measurement:t,pageType:e,stylesWritten:n}){I.histogram({name:D.StyleBackwardsCompatibilityExecutionTime,value:t,attributes:x({pageType:e,stylesWritten:n}),unit:"ms"})}function Zs({rule:t,count:e,pageType:n}){I.counter({name:D.StyleBackwardsCompatibilityRules,value:e,attributes:x({rule:t,pageType:n})})}function el({retries:t}){I.counter({name:D.AmazonPayLoadRetries,value:1,attributes:{retries:t}})}function tl({instrument:t}){I.counter({name:D.DynamicTaxFailed,value:1,attributes:{instrument:t}}),m.log({body:"Dynamic tax failed",attributes:{instrument:t}})}function rl({instrument:t}){I.counter({name:D.DynamicShippingFailed,value:1,attributes:{instrument:t}}),m.log({body:"Dynamic shipping failed",attributes:{instrument:t}})}function nl({instrument:t,measurement:e}){I.histogram({name:D.SheetLoaded,value:e,attributes:x({instrument:t}),unit:"ms"})}function al({instrument:t,result:e}){I.counter({name:D.AmazonAdExperimentAcceleratedCheckoutButtonClicked,value:1,attributes:x({instrument:t,result:e})})}function il({instrument:t,result:e}){I.counter({name:D.AmazonAdExperimentAcceleratedCheckoutButtonSetup,value:1,attributes:x({instrument:t,result:e})})}function ol({instrument:t}){I.counter({name:D.AmazonAdExperimentPaymentButtonHidden,value:1,attributes:{instrument:t}}),m.log({body:"Payment button hidden",attributes:{instrument:t}})}function sl({instrument:t}){I.counter({name:D.AmazonAdExperimentRecommendedWalletOverriden,value:1,attributes:{instrument:t}}),m.log({body:"Recommended wallet overriden",attributes:{instrument:t}})}const m={initStarted:v(Rs),initCompleted:v(Ns),instrumentLoaded:v(Ts),instrumentLoadEligibility:v(xs),instrumentSDKLoaded:v(ks),instrumentSDKEligible:v(Ls),renderSucceeded:v(Os),renderFailed:v(Ms),sheetClicked:v(Fs),sheetCancelled:v(Bs),sheetFailed:v($s),updateFailed:v(Us),authorizationAttempt:v(Hs),authorizationComplete:v(Gs),startExporter:v(Ys),decelerated:v(zs),cartTokenMissing:v(Vs),removePersonalDataResult:v(qs),walletConfigDeveloperError:v(Ws),legacyCartCookie:v(js),flushTelemetry:v(ya),styleBackwardsCompatibility:v(Js),styleBackwardsCompatibilityExecutionTime:v(Xs),styleBackwardsCompatibilityRules:v(Zs),amazonPaySDKLoadRetries:v(el),dynamicTaxFailed:v(tl),dynamicShippingFailed:v(rl),sheetLoaded:v(nl),amazonAdExperimentAcceleratedCheckoutButtonClicked:v(al),amazonAdExperimentAcceleratedCheckoutButtonSetup:v(il),amazonAdExperimentPaymentButtonHidden:v(ol),amazonAdExperimentRecommendedWalletOverriden:v(sl),log:v(Qs,{logErrors:!1})};function v(t,{logErrors:e=!0}={}){return(...n)=>{try{t(...n)}catch(r){e&&m.log({body:"Error calling telemetry function",attributes:{error:"".concat(r)}})}}}const nt=[];function me(t,e,n){if(window.customElements!=null)try{const r=e;window.customElements.get(t)||(window.customElements.define(t,r),n!=null&&n.isChildCustomElement&&nt.push(t))}catch(r){b.notify(r),Fo()}}function Pt(){const t=new URLSearchParams(window.location.search);return function(e){return!!t.get(e)}}function ll(){var t,e,n,r;const a=(t=window.Shopify)==null?void 0:t.CartType;if(a===S.CartAjax)return S.CartAjax;if(a===S.CartPage)return S.CartPage;const i=(r=(n=(e=window.ShopifyAnalytics)==null?void 0:e.meta)==null?void 0:n.page)==null?void 0:r.pageType;if(i)switch(i.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}const o=document.querySelector("#shop-js-analytics");if(o)try{const s=JSON.parse(o.textContent||"{}");if(s.pageType)switch(s.pageType.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}}catch(s){console.error("Error parsing JSON script tag:",s)}return S.Unknown}function De(t){return Number(t).toFixed(2)}function Tr(t){if(!(!t||!t.id||!t.id.includes("gid://shopify/Cart/")))return t.id.replace("gid://shopify/Cart/","").split("?")[0]}function le(){let t;return[new Promise(e=>t=e),t]}const cl={force_shop_pay_product:"direct_checkout_product",force_shop_pay_cart:"direct_checkout_cart"};function he(t,e="no_redirect_for_checkout"){m.flushTelemetry();const n=new URL(t);switch(e){case"skip_shop_pay":n.searchParams.set("skip_shop_pay","true");break;case"no_redirect_for_checkout":n.searchParams.set("storefront_wallet","true");break;case"force_shop_pay_cart":case"force_shop_pay_product":case"force_shop_pay":{n.searchParams.set("payment","shop_pay");const r=cl[e];r&&n.searchParams.set("redirect_source",r);break}}window.location.assign(n.toString())}function ga(){return!!document.querySelector('[data-source-attribution="shopify.shop-promise-pdp"]')}function at(){return new Date().getTime()}function kr(t){return t.find(e=>typeof e=="object"&&(e==null?void 0:e.code)===It)}const dl={currency_changed:fe.CURRENCY_CHANGE,captcha_required:fe.CAPTCHA_REQUIRED,not_enough_stock:fe.NOT_ENOUGH_STOCK,cart_not_ready:fe.CART_NOT_READY,dynamic_tax:fe.DYNAMIC_TAX,payment_method_not_applicable:fe.PAYMENT_METHOD_NOT_APPLICABLE,invalid_payment_deferred_payment_required:fe.INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED,cart_throttled:null,out_of_stock:null};function St({warnings:t,cartStatus:e,errors:n}){if(n!=null&&n.includes(g.PaymentMethodNotApplicable))return"payment_method_not_applicable";if(n!=null&&n.includes(g.InvalidPaymentDeferredPaymentRequired))return"invalid_payment_deferred_payment_required";if(e==="CartStatusNotReady")return"cart_not_ready";if(e==="CartThrottled")return"cart_throttled";if(!(!t||t.length===0)){if(t.includes("MERCHANDISE_OUT_OF_STOCK"))return"out_of_stock";if(t.includes("MERCHANDISE_NOT_ENOUGH_STOCK"))return"not_enough_stock"}}function Lr({currentCartTotal:t,initialBuyerCurrency:e}){const n=t.amount;return!(!n||Number(n)===0||e.toUpperCase()===t.currencyCode.toUpperCase())}function U({checkoutUrl:t,instrumentName:e,reason:n}){if(!t)throw new Error("Invalid Checkout URL");const r=new URL(t),a=dl[n];a&&r.searchParams.set(a,"true"),m.decelerated({instrument:e,reason:n}),he(r.toString())}const ul="unstable",dn="RESTRICTED_WALLET_ACCOUNT";class Vt{constructor({accessToken:e,country:n,locale:r,apiVersion:a=ul,withCarrierRates:i=!1,cartPrepareMigrationEnabled:o=!1}){if(c(this,"OPERATION_NAME_REGEX",/[^ ]+ (\w+)/),c(this,"LANGUAGES_WITH_REGION",["zh-CN","zh-TW","pt-BR","pt-PT"]),c(this,"client"),c(this,"country"),c(this,"url"),c(this,"locale"),c(this,"withCarrierRates"),c(this,"lastValidCart"),c(this,"cartPrepareMigrationEnabled"),c(this,"hasBeenVisible",!1),!e||!n)throw new ee({code:"invalid-webcomponent",message:"accelerated checkout rendered without required webcomponent attributes"});if(!r)throw new Error("StorefrontApiClient constructed with no locale");this.country=n,this.locale=r,this.withCarrierRates=i,this.cartPrepareMigrationEnabled=o,this.url="/api/".concat(a,"/graphql.json"),this.client=Hi(Oo({url:this.url,accessToken:e}))}async createCart(e){var n,r,a;const i=await this.requestStream([ho,Et],{input:{lines:[{merchandiseId:e.merchandiseId,quantity:e.quantity,sellingPlanId:e.sellingPlanId,attributes:e.lineItemProperties}],discountCodes:e.discountCodes,buyerIdentity:e.buyerIdentity},country:this.country,language:this.formatLanguage(this.locale)},{instrumentName:e.instrumentName,startingCheckout:!0,operationName:"createCart"});try{for(var o=re(i),s,l,d;s=!(l=await o.next()).done;s=!1){const u=l.value;u.errors&&await this.onError("createCart",u);const h=(n=u.data)==null?void 0:n.result;if(h&&!u.hasNext){h.errors&&this.onResultError(h.errors);const p=this.parseMutationWarnings((a=(r=u.data)==null?void 0:r.result)==null?void 0:a.warnings);return{data:h.cart?this.parseCartResponse(h.cart):null,errors:this.parseMutationErrors(u,"result"),warnings:p,decelerationReason:St({warnings:p})}}}}catch(u){d=[u]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(d)throw d[0]}}throw new be("Cart create operation returned no response")}async updateCartBillingAddress(e){const{cartId:n,billingAddress:r,instrumentName:a}=e;return this.requestDeferredCart(mo,{cartId:n,billingAddress:r},{instrumentName:a,operationName:"updateCartBillingAddress"})}async updateCartBuyerIdentity(e,n){const{cartId:r,instrumentName:a}=e;return this.requestDeferredCart(yo,{cartId:r,buyerIdentity:pl(e)},{instrumentName:a,operationName:"updateCartBuyerIdentity",abortSignal:n})}async updateSelectedDeliveryOptions(e,n,r,a){let i=n;const o=at()+2e4;for(;at()typeof d=="string"&&d.startsWith(g.PendingDeliveryGroups))))return s;const l=s.data.deliveryGroups.flatMap(d=>d.deliveryOptions.map(u=>({deliveryOptionHandle:u.handle,deliveryGroupId:d.id})));i=i.map(d=>{var u;return(u=l.find(h=>h.deliveryOptionHandle===d.deliveryOptionHandle))!=null?u:d})}throw new Error("Selected delivery options update operation timed out")}async applePaySessionCreate(e){var n,r,a;const i=await this.requestStream([fo],{validationUrl:e.toString()},{instrumentName:f.ApplePay,operationName:"applePaySessionCreate"});try{for(var o=re(i),s,l,d;s=!(l=await o.next()).done;s=!1){const u=l.value;u.errors&&await this.onError("applePaySessionCreate",u);const h=(a=(r=(n=u.data)==null?void 0:n.applePaySessionCreate)==null?void 0:r.applePaySession)==null?void 0:a.body;if(h)return h}}catch(u){d=[u]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(d)throw d[0]}}throw new be("Apple Pay session create operation returned no response")}async paypalBuyerDetailsFetch(e,n){var r,a;const i=await this.requestStream([bo],{token:e,cartId:n},{instrumentName:f.PayPal,operationName:"paypalBuyerDetailsFetch"});try{for(var o=re(i),s,l,d;s=!(l=await o.next()).done;s=!1){const u=l.value;if(u.hasNext)continue;u.errors&&await this.onError("paypalBuyerDetailsFetch",u);const h=(a=(r=u.data)==null?void 0:r.paypalBuyerDetailsFetch)==null?void 0:a.paypalDetails;if(h)return h}}catch(u){d=[u]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(d)throw d[0]}}throw new be("PayPal buyer details fetch operation returned no response")}async paypalTokenCreate(e){var n,r,a,i;const o=await this.requestStream([wo],{cartId:e},{instrumentName:f.PayPal,operationName:"paypalTokenCreate"});try{for(var s=re(o),l,d,u;l=!(d=await s.next()).done;l=!1){const h=d.value;if(h.errors){if((n=h.errors.graphQLErrors)!=null&&n.find(y=>{var C;return((C=y.extensions)==null?void 0:C.code)===dn}))throw new Ut(dn);await this.onError("paypalTokenCreate",h)}const p=(i=(a=(r=h.data)==null?void 0:r.paypalTokenCreate)==null?void 0:a.paypalToken)==null?void 0:i.token;if(p)return p}}catch(h){u=[h]}finally{try{l&&(d=s.return)&&await d.call(s)}finally{if(u)throw u[0]}}throw new be("PayPal token create operation returned no response")}async fetchLimitedCart({id:e,startingCheckout:n,instrumentName:r}){var a,i;const o=await this.request([Eo],{id:e},{instrumentName:r,startingCheckout:n});if(o.errors&&await this.onError("limitedCartQuery",o),!((a=o.data)!=null&&a.cart))throw new ml("Limited cart query returned no response");return b.leaveBreadcrumb("limitedCartQuery response",{operationName:"limitedCartQuery",body:(i=o.data)==null?void 0:i.cart},"log"),{id:o.data.cart.id,shippingRequired:o.data.cart.lines.edges.some(s=>s.node.merchandise.requiresShipping),sellingPlan:o.data.cart.lines.edges.some(s=>s.node.sellingPlanAllocation!=null)}}async fetchCart({id:e,startingCheckout:n,instrumentName:r}){var a;const i=this.formatLanguage(this.locale),o=this.cartPrepareMigrationEnabled?"Prepare cart":"Fetch cart",s=this.cartPrepareMigrationEnabled?So:_o,l=this.cartPrepareMigrationEnabled?[Et,nr,nn]:[Et],d=this.cartPrepareMigrationEnabled?{cartId:e,country:this.country,language:i,withCarrierRates:this.withCarrierRates,prepareCart:!0}:{id:e,country:this.country,language:i,withCarrierRates:this.withCarrierRates},u=await this.requestStream([s,...l],d,{instrumentName:r,startingCheckout:n,operationName:"fetchCart"});try{for(var h=re(u),p,y,C;p=!(y=await h.next()).done;p=!1){const _=y.value;_.errors&&await this.onError("fetchCart",_);let E=null,P;if(!_.data)throw new be("".concat(o," operation returned no data in response"));if(hl(_.data)){const $=_.data.preparedCart;E=(a=$==null?void 0:$.result)==null?void 0:a.cart,P=this.parsePreparedCartMutationErrors(_.errors,this.extractPreparedCartMutationErrors($))}else E=_.data.cart;if(b.leaveBreadcrumb("".concat(o," response"),{operationName:o,body:E,errors:P,hasNext:_.hasNext},"log"),E&&!_.hasNext){const $=this.parseCartResponse(E);return this.lastValidCart=$,$}}}catch(_){C=[_]}finally{try{p&&(y=h.return)&&await y.call(h)}finally{if(C)throw C[0]}}throw new be("".concat(o," operation returned no response"))}async updateCartPayment(e,n,r,a){var i,o;const s={cartId:e,input:n},{amount:l,currencyCode:d}=n.amount;let u;const h=at()+1e4;for(;at()setTimeout(y,500)),s.input.amount={amount:p.data.totalAmount.amount,currencyCode:p.data.totalAmount.currencyCode};continue}return(p.data.totalAmount.amount===l||parseFloat(p.data.totalAmount.amount)<=parseFloat(l))&&p.data.totalAmount.currencyCode===d?p:u}throw new Error("Payment update operation timed out")}async updateCartAttributes({cartId:e,attributes:n,instrumentName:r,startingCheckout:a}){const i={cartId:e,attributes:n};return await this.requestDeferredCart(po,i,{instrumentName:r,operationName:"updateCartAttributes",startingCheckout:a})}async submitForCompletion(e,n,r){var a,i;const o=this.formatLanguage(this.locale),s=await this.request([Io],{cartId:e,attemptToken:n,country:this.country,language:o,withCarrierRates:this.withCarrierRates},{instrumentName:r,operationName:"submitForCompletion"});return{data:(i=(a=s.data)==null?void 0:a.cartSubmitForCompletion)==null?void 0:i.result,errors:this.parseCompletionErrors(s)}}async fetchSubscriptionPolicy(){var e,n;const{data:r}=await this.request([Ao],{country:this.country,language:this.formatLanguage(this.locale)},{operationName:"fetchSubscriptionPolicy"});return(n=(e=r==null?void 0:r.shop)==null?void 0:e.subscriptionPolicy)==null?void 0:n.body}async cartRemovePersonalData({cartId:e,shopId:n,instrumentName:r}){var a,i;let o,s,l;try{const u=await this.request([Po,nr],{cartId:e},{instrumentName:r,keepalive:!0});o=this.parseMutationWarnings((i=(a=u.data)==null?void 0:a.cartRemovePersonalData)==null?void 0:i.warnings),s=this.parseMutationErrors(u,"cartRemovePersonalData")}catch(u){l=u.toString()}const d=!(o!=null&&o.length||s!=null&&s.length||l);m.removePersonalDataResult({success:d}),d||m.log({body:"cartRemovePersonalData failed",attributes:{cartId:e,shopId:n,warnings:o,errors:s,exception:l}})}setVisible(){this.hasBeenVisible=!0}generateURLWithOperationName(e){const n=e.match(this.OPERATION_NAME_REGEX);if(n){const r=this.url.includes("?")?"&":"?",a="operation_name=".concat(n[1]);return"".concat(this.url).concat(r).concat(a)}return this.url}async request(e,n,r){return this.client.request(e.join(""),{variables:n,headers:un(r),url:this.generateURLWithOperationName(e[0]),keepalive:r.keepalive})}async requestStream(e,n,r){return this.client.requestStream(e.join(""),{variables:n,headers:un(r),url:this.generateURLWithOperationName(e[0]),signal:r.abortSignal})}async requestDeferredCart(e,n,r){var a,i,o,s,l,d,u,h,p;const y=this.formatLanguage(this.locale),C=await this.requestStream([e,Et,nr,nn],T(w({},n),{country:this.country,language:y,withCarrierRates:this.withCarrierRates,prepareCart:this.cartPrepareMigrationEnabled}),r);try{for(var _=re(C),E,P,$;E=!(P=await _.next()).done;E=!1){const B=P.value;B.errors&&await this.onError(r.operationName,B);const oe=this.extractMutationErrors(B),N=(i=(a=B.data)==null?void 0:a.preparedCart)==null?void 0:i.result,G=(l=(s=(o=B.data)==null?void 0:o.result)==null?void 0:s.cart)!=null?l:N==null?void 0:N.cart;if(G&&!B.hasNext){let F;this.cartPrepareMigrationEnabled||(F=await this.fetchCart({id:G.id,instrumentName:r.instrumentName,startingCheckout:!1}));const O=this.parseMutationWarnings((u=(d=B.data)==null?void 0:d.result)==null?void 0:u.warnings),ie=this.parsePreparedCartMutationErrors(B.errors,oe);return{data:F!=null?F:this.parseCartResponse(G),errors:ie,warnings:O,decelerationReason:St({warnings:O,cartStatus:N==null?void 0:N.__typename,errors:ie})}}if(this.lastValidCart&&oe.length>0){this.onResultError(oe);const F=this.parseMutationWarnings((p=(h=B.data)==null?void 0:h.result)==null?void 0:p.warnings);return{data:this.lastValidCart,errors:this.parsePreparedCartMutationErrors(B.errors,oe),warnings:F,decelerationReason:St({warnings:F})}}}}catch(B){$=[B]}finally{try{E&&(P=_.return)&&await P.call(_)}finally{if($)throw $[0]}}throw new be("Deferred cart operation returned no response")}async onError(e,n){const r=await vo(e,n);if(!r)return;const a=r,{message:i}=a,o=er(a,["message"]),{isIgnorable:s,reason:l}=To(r,{hasBeenVisible:this.hasBeenVisible});throw b.leaveBreadcrumb(i,w(w({ignored:s,ignoredReason:l},n),o),"error"),s?new jn(i,{reason:l,errorDetails:o}):new Pr(i,{errorDetails:o,bugsnagGroupingHash:xo(o)})}onResultError(e){b.leaveBreadcrumb("GraphQL result error",e,"error")}formatLanguage(e){return e.includes("-")?this.LANGUAGES_WITH_REGION.includes(e)?e.toUpperCase().replace("-","_"):e.split("-")[0].toUpperCase():e.toUpperCase()}parseCartResponse(e){var n,r,a;const i=e.lines.edges.map(s=>{var l,d;const u=s.node;return{quantity:u.quantity,totalAmount:{amount:u.cost.totalAmount.amount,currencyCode:u.cost.totalAmount.currencyCode},subtotalAmount:{amount:(l=u.cost.subtotalAmount)==null?void 0:l.amount,currencyCode:(d=u.cost.subtotalAmount)==null?void 0:d.currencyCode},merchandise:{requiresShipping:u.merchandise.requiresShipping},discountAllocations:u.discountAllocations,sellingPlanAllocation:u.sellingPlanAllocation}}),o=e.deliveryGroups.edges.map(s=>s.node);return{id:e.id,totalAmount:e.cost.totalAmount,subtotalAmount:(n=e.cost.subtotalAmount)!=null?n:void 0,totalTaxAmount:(r=e.cost.totalTaxAmount)!=null?r:void 0,totalDutyAmount:(a=e.cost.totalDutyAmount)!=null?a:void 0,discountAllocations:e.discountAllocations,discountCodes:e.discountCodes,lineItems:i,deliveryGroups:o,checkoutUrl:e.checkoutUrl}}parseGraphQlErrors(e){var n,r;return(r=(n=e==null?void 0:e.graphQLErrors)==null?void 0:n.map(a=>a.message.replace(/\(Expected.*\)/,"").trim()))!=null?r:[]}parseMutationError(e){return e.code===It?{code:It,message:e.message}:e.field&&e.field.length>0?"".concat(e.code,": ").concat(e.field.join(".")):e.code}parseMutationErrors(e,n){var r,a,i;const o=this.parseGraphQlErrors(e.errors),s=((i=(a=(r=e.data)==null?void 0:r[n])==null?void 0:a.errors)==null?void 0:i.map(this.parseMutationError).filter(d=>d))||[],l=[...o,...s];return b.leaveBreadcrumb("GraphQL errors on mutation",l,"error"),l}parseMutationWarnings(e){return!e||e.length===0?[]:e.map(n=>n.code)}filterErrors(e){var n;return!((n=e.code)!=null&&n.startsWith("PENDING_DELIVERY_GROUPS")||e.code==="INVALID_PAYMENT")}extractPreparedCartMutationErrors(e){var n,r;const a=(n=e==null?void 0:e.errors)!=null?n:[];return((r=e==null?void 0:e.result)==null?void 0:r.__typename)==="CartStatusNotReady"&&a.push(...e.result.errors),a}extractMutationErrors(e){var n,r,a,i;let o=(a=(r=(n=e.data)==null?void 0:n.result)==null?void 0:r.errors)!=null?a:[];return this.cartPrepareMigrationEnabled&&(o=o.filter(this.filterErrors)),[...o,...this.extractPreparedCartMutationErrors((i=e.data)==null?void 0:i.preparedCart)]}parsePreparedCartMutationErrors(e,n){const r=this.parseGraphQlErrors(e),a=n.map(this.parseMutationError).filter(o=>o),i=[...r,...a];return b.leaveBreadcrumb("GraphQL errors on mutation",i,"error"),i}parseCompletionErrors(e){var n,r,a,i;const o=this.parseGraphQlErrors(e.errors);let s=[];((a=(r=(n=e.data)==null?void 0:n.cartSubmitForCompletion)==null?void 0:r.result)==null?void 0:a.__typename)==="SubmitFailed"&&(s=(i=e.data.cartSubmitForCompletion.result.errors.map(d=>d.code))!=null?i:[]);const l=[...o,...s];return b.leaveBreadcrumb("GraphQL errors on completion",l,"error"),l}}function hl(t){return!("cart"in t)}function pl({emailAddress:t,countryCode:e,phone:n,streetAddress:r,validateAddress:a,preferences:i}){return{email:t,countryCode:e!=null?e:r==null?void 0:r.country,phone:n!=null?n:r==null?void 0:r.phone,deliveryAddressPreferences:r?[{deliveryAddressValidationStrategy:a?"STRICT":"COUNTRY_CODE_ONLY",deliveryAddress:r}]:[],preferences:i}}function un({instrumentName:t,startingCheckout:e}){const n={};return t&&(n["X-Wallet-Name"]="".concat(t)),e&&(n["X-Start-Wallet-Checkout"]="".concat(e)),n}const fa="LimitedCartQueryError";class ml extends Error{constructor(){super(...arguments),c(this,"name",fa)}}const ba=["OpenTelemetryClientError",qn,Kn,Wn,ft],yl=["Load failed","Failed to fetch","when attempting to fetch resource","GraphQL mutation failed with status 404","Component closed",...ba],hn=new Map([["TypeError","Illegal constructor"],["BugsnagInvalidError",'"isTrusted":true'],[fa,"Limited cart query returned no response"],["AbortError","Fetch is aborted"]]),gl=["Chrome-Lighthouse","Googlebot"];function fl(t){const e=t.exceptions[0];return bl()?"silenced-user-agent":wl(t)?"empty-stack-trace":_l(e)?"spin":El()?"monkey-patch":Sl(t)?"external-error":Pl(t)?"developer-error":Il(e.message)?"discarded-message":vl(t)?"discarded-error-class":Dl(e)?"discarded-class-message":Rl(t)?"unactionable-invalid-error":Al(t)||null}function bl(){return gl.some(t=>navigator.userAgent.includes(t))}function wl(t){return t.exceptions[0].stacktrace.length===0}function _l(t){return t.stacktrace.some(e=>{var n;return(n=e.file)==null?void 0:n.includes("spin.dev")})}function El(){return[HTMLElement,Event,document.createElement].some(Vn)}function Al(t){const e=t.exceptions.map(n=>n.stacktrace.filter(r=>!Cl(r)));return e.some(n=>{var r;return!((r=n[0])!=null&&r.inProject)})?"external-trigger":e.some(n=>n.every(r=>[Bn,Sr,$n].some(a=>r.file.startsWith(a))))?"wallet-sdk-stack-trace":null}function Cl(t){return t.file.includes("native code")||t.file.includes("/cdn/wpm/")}function Sl(t){return!t.exceptions[0].stacktrace.some(e=>e.inProject)}function Il(t){return yl.some(e=>t==null?void 0:t.includes(e))}function Pl(t){const e=t.exceptions.some(n=>n.errorClass===ft);return e&&console.error(t.exceptions[0]),e}function vl(t){return t.exceptions.some(e=>ba.includes(e.errorClass))}function Dl(t){const e=t.errorClass,n=t.message;return hn.has(e)&&(n==null?void 0:n.includes(hn.get(e)))}function Rl(t){return t.exceptions[0].errorClass==="BugsnagInvalidError"&&t.unhandled}function Nl(t,e){const n=t.exceptions[0];if(!n||!n.message||bi.checkDuplicate(n))return!1;const r=Ll(e);Tl(t,r);let a=null;try{a=fl(t)}catch(i){const o=i;console.error(o);const s={errorClass:"UnfilterableError",message:"Could not properly filter error with message: ".concat(o.message),stacktrace:Mn(Hn,o)};t.exceptions.unshift(s)}return Ol(a),Ds()&&Ml({errorClass:n.errorClass,message:n.message,stacktrace:JSON.stringify(n.stacktrace),filterResult:a,metadata:JSON.stringify(t.metaData)}),a==null}function Tl(t,e){var n,r,a,i,o;const s=(a=(r=(n=window.ShopifyAnalytics)==null?void 0:n.lib)==null?void 0:r.trekkie)==null?void 0:a.defaultAttributes;t.context=window.location.pathname,t.request||(t.request={}),t.request.url=window.location.href,t.device.orientation=(o=(i=window.screen)==null?void 0:i.orientation)==null?void 0:o.type,xl(t),t.groupingHash=kl(e),t.metaData=T(w({},t.metaData),{shop:w(w({},Nr()),t.metaData.shop),custom:T(w({},t.metaData.custom),{customFetch:Vn(fetch)}),monorail:s}),e[0]instanceof Pr&&(t.metaData.graphql=w({},e[0].errorDetails),e[0]instanceof jn&&(t.metaData.graphql.reason=e[0].reason))}function kl(t){for(const e of t)if("bugsnagGroupingHash"in e&&e.bugsnagGroupingHash)return e.bugsnagGroupingHash.toString()}function Ll(t){const e=[];let n=t;for(;n instanceof Error&&e.length<20;){e.push(n);const r="cause"in n?n.cause:null;if(!r)break;n=r}return e}function xl(t){for(const e of t.exceptions)for(const n of e.stacktrace)[Bn,Sr,$n].some(r=>n.file.startsWith(r))&&(n.inProject=!0)}function Ol(t){I.counter({name:D.ErrorTriggered,value:1,attributes:{filterResult:t||"valid-error"}})}function Ml(t){I.log({body:"Bugsnag Error",attributes:w(w({},Nr()),t)})}var Tn;const Fl={apiKey:"cb577dc231be1c7494db8a63441ef66b",appId:Hn,appVersion:"0.0.0-efe4ab8f1d760042cce46bf56c59ef0209d9162f",releaseStage:"production",locale:"es",userAgent:navigator.userAgent,metadata:{user:{id:(Tn=dt(gi))!=null?Tn:"unknown"}},withSessionTracking:!1,onError:Nl},b=new di(Fl);b.addOnPostError(t=>{b.leaveBreadcrumb("Bugsnag Error Notified",{errorClass:t.exceptions[0].errorClass,message:t.exceptions[0].message},"error")});var wa={es:{instruments_copy:{checkout:{buy_now:"Comprar ahora"}},error_dialogs:{checkout:{title:"Transacci\xF3n fallida",generic_error:"La pantalla de pago no est\xE1 disponible actualmente debido a problemas t\xE9cnicos. Int\xE9ntalo de nuevo dentro de unos minutos.",button_text:"Cerrar"},wallet:{title:"%{wallet} no disponible",generic_error:"Ha habido un problema con %{wallet}. Int\xE9ntalo de nuevo o utiliza otra forma de pago.",eligibility_error:"Los art\xEDculos que eran elegibles para %{wallet} ya no est\xE1n en tu carrito."}},more_payment_options:"M\xE1s opciones de pago",brand:{apple_pay:"Apple Pay",amazon_pay:"Amazon Pay",shop_pay:"Shop Pay",buy_with_prime:"Buy with Prime",paypal:"PayPal",google_pay:"Google Pay"},buy_with_button_content:"Comprar con %{wallet}",order_summary:{total:"Total",subtotal:"Subtotal",duties:"Aranceles",taxes:"Impuestos",shipping:"Env\xEDo",discount:"Descuento",shipping_one_time_purchase:"Env\xEDo (compra \xFAnica)",shipping_subscription:"Env\xEDo (suscripci\xF3n)",subscriptions:{recurring_total_tooltip_line:"No incluye env\xEDo, impuestos, aranceles ni descuentos aplicables.",recurring_totals:"%{fixedPrice} cada %{interval}",recurring_totals_with_policies:{one:"Primer pago de %{fixedPrice} y luego %{recurringPrice} cada %{interval}",other:"Primeros %{count} pagos de %{fixedPrice} cada uno y luego %{recurringPrice} cada %{interval}",many:"Primeros %{count} pagos de %{fixedPrice} cada uno y luego %{recurringPrice} cada %{interval}"},recurring_total_intervals:{day:{one:"d\xEDa",other:"%{count} d\xEDas",many:"%{count} d\xEDas"},month:{one:"mes",other:"%{count} meses",many:"%{count} meses"},week:{one:"semana",other:"%{count} semanas",many:"%{count} semanas"},year:{one:"a\xF1o",other:"%{count} a\xF1os",many:"%{count} a\xF1os"}}}},errors:{missing:{address2:"Introduce un apartamento, oficina, etc.",phone:"Introduce un n\xFAmero de tel\xE9fono",first_name:"Introduce un nombre.",email:"Introduce una direcci\xF3n de correo electr\xF3nico",last_name:"Introduce un apellido.",address1:"Introduce una direcci\xF3n.",city:"Introduce una ciudad.",zone:"Selecciona un estado o una provincia.",postal_code:"Introduce un c\xF3digo postal.",shipping_option:"Selecciona un m\xE9todo de env\xEDo",country:"Selecciona un pa\xEDs",emirate:"Ingresa un emirato"},invalid:{email:"Introduce un correo electr\xF3nico v\xE1lido",country:"Selecciona un pa\xEDs o una regi\xF3n.",phone:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",first_name:"Introduce un nombre v\xE1lido",last_name:"Introduce un apellido v\xE1lido",address1:"Introduce una direcci\xF3n v\xE1lida",address2:"Introduce un departamento, una suite, etc. v\xE1lidos",city:"Introduce una ciudad v\xE1lida",zone:"Selecciona un estado o una provincia v\xE1lidos.",postal_code:"Introduce un c\xF3digo postal v\xE1lido",billing_address:"Direcci\xF3n de facturaci\xF3n no v\xE1lida",shipping_address:"Direcci\xF3n de env\xEDo no v\xE1lida",payment_method:"Forma de pago no v\xE1lida",discount:"Descuento no v\xE1lido",emirate:"Ingresa un emirato v\xE1lido"},emojis:{first_name:"El nombre no puede contener emojis.",last_name:"El apellido no puede contener emojis",city:"La ciudad no puede contener emojis.",address1:"La l\xEDnea de la direcci\xF3n no puede contener emojis.",address2:"La segunda l\xEDnea de la direcci\xF3n no puede contener emojis.",postal_code:"El c\xF3digo postal no puede contener emojis."},too_long:{address1:"La l\xEDnea de la direcci\xF3n es demasiado larga.",address2:"La segunda l\xEDnea de la direcci\xF3n es demasiado larga.",first_name:"El nombre es demasiado largo.",last_name:"El apellido es demasiado largo.",city:"El nombre de la ciudad es demasiado largo."},url:{first_name:"El nombre no puede contener una URL.",last_name:"El apellido no puede contener una URL."},html_tags:{first_name:"El nombre no puede contener etiquetas HTML.",last_name:"El apellido no puede contener etiquetas HTML.",city:"La ciudad no puede contener etiquetas HTML.",address1:"La l\xEDnea de direcci\xF3n no puede contener etiquetas HTML.",address2:"La segunda l\xEDnea de la direcci\xF3n no puede contener etiquetas HTML."},currency:{mismatch:"Tu carrito y tu moneda se modificaron en funci\xF3n del pa\xEDs de env\xEDo."},address_unserviceable:"%{shopName} no ofrece entregas en esta direcci\xF3n actualmente. Usa otra direcci\xF3n para completar tu compra."},subscriptions:{cancellation_policy:"Pol\xEDtica de cancelaci\xF3n",policy_not_found:"No se ha podido encontrar la pol\xEDtica de suscripci\xF3n. Vuelve a cargar la p\xE1gina o cont\xE1ctanos para obtener m\xE1s informaci\xF3n."},shipping_methods:{connect_shipping_methods:"%{methodOne} y %{methodTwo}",choose_delivery_strategy:"Elige una forma de entrega"},shop_promise_delivery:{same_day:"Entrega el mismo d\xEDa",next_day:"Entrega al d\xEDa siguiente",two_day:"Entrega en dos d\xEDas"},action:{view:"Ver %{content}"},express_checkout:"Pago expr\xE9s",delivery_promises:{connect_delivery_promises:"%{promiseOne} y %{promiseTwo}"}}};wa.es;let or;class pn extends Error{constructor(e,n){const r="i18n: Missing or invalid translation '".concat(e,"' in '").concat(n,"'");super(r)}}class Ul extends Error{constructor(e,n,r){const a="i18n: Missing translation template key '".concat(e,"' for '").concat(n,"' in '").concat(r,"'");super(a)}}class Bl extends Error{constructor(e,n,r){const a="i18n: Invalid pluralization for '".concat(e,"':'").concat(n,"' in '").concat(r,"'");super(a)}}function qt(){return or==null&&(or=$l(wa)),or}function $l(t){const e=(i,o)=>typeof i!="string"&&o.count!=="undefined",n=(i,o)=>{let s=o===1?"one":"other";return o===0&&typeof i!="string"&&i.zero!=="undefined"&&(s="zero"),s},r=(i,o={})=>{const s=i.match(/%\{.+?\}/g);return s?s.reduce((l,d)=>{const u=d.replace(/%\{(.*)\}/,"$1");return o[u]?l.replace(d,o[u]):(b.notify(new Ul(u,i,a)),l)},i):i},a=Hl();return{locale:a,translate(i,o={}){var s;const l=i.split(".");let d=t[a];try{for(const u of l)switch(typeof d){case"object":d=d[u];break;case"string":case"undefined":throw new pn(i,a)}if(e(d,o)){if(typeof d=="string")throw new Bl(i,d,a);d=d[n(d,o.count)]}if(typeof d!="string")throw new pn(i,a);return r(d,o)}catch(u){return b.notify(u),(s=o.defaultValue)!=null?s:i}}}}function Hl(){return"es"}class Gl extends HTMLElement{constructor(){super(),c(this,"overflow"),c(this,"formerFocus"),this.attachShadow({mode:"open"}),this.overflow="",this.formerFocus=document.activeElement}connectedCallback(){const e=qt();this.render(e);const n=this.shadowRoot,r=n.getElementById("modal");n.querySelectorAll("button").forEach(o=>o.addEventListener("click",this.closeModal.bind(this)));const a=n.getElementById("overlay");a==null||a.addEventListener("click",o=>this.handleOutsideClick(o,r)),document.addEventListener("keydown",this.handleEscapeKey.bind(this));const i=document.createElement("style");i.textContent=ni,n.appendChild(i),this.overflow=document.body.style.overflow,document.body.style.overflow="hidden",this.trapFocus(r,n),me("svg-icon",ri)}trapFocus(e,n){if(!e)return;const r=e.querySelectorAll("a[href], button"),a=Array.from(r),i=a[0],o=a[a.length-1];e.addEventListener("keydown",s=>{s.key==="Tab"&&!s.shiftKey&&n.activeElement===o&&(s.preventDefault(),i.focus()),s.key==="Tab"&&s.shiftKey&&n.activeElement===i&&(s.preventDefault(),o.focus())}),i.focus()}handleOutsideClick(e,n){n&&(n.contains(e.target)||this.closeModal())}handleEscapeKey(e){e.key==="Escape"&&this.closeModal()}closeModal(){var e;document.body.style.overflow=this.overflow,this.remove(),this.formerFocus&&"focus"in(this==null?void 0:this.formerFocus)&&typeof this.formerFocus.focus=="function"&&((e=this.formerFocus)==null||e.focus())}render(e){const n=this.getAttribute("title"),r=this.getAttribute("has-close-button"),a=e.translate("error_dialogs.checkout.button_text"),i='\n \n ");this.shadowRoot.innerHTML='\n
\n
\n \n
\n '.concat(n,'\n
\n \n \n
\n
\n
\n ').concat(r?i:"","\n
\n
\n ")}}const zl="@keyframes topLevelModalLoadingSkeleton{50%{opacity:1}75%{opacity:.5}to{opacity:1}}top-level-modal .text-skeleton{display:inline-block;width:100%;height:14px;margin-bottom:7px;animation:topLevelModalLoadingSkeleton 4s ease infinite;animation-delay:-.168s;text-decoration:none!important;background-color:#dedede}top-level-modal .text-skeleton:last-of-type{width:50%}";function Wt({type:t="button",label:e=void 0}={}){const n=document.createElement("button");return n.type=t,e&&n.setAttribute("aria-label",e),n}function jt(t,e){for(const[n,r]of Object.entries(e))t.setAttribute(n,r)}function mn(t,e){for(const[n,r]of Object.entries(e))t.style.setProperty(n,r)}function Yt(t,e){const n=document.createElement("top-level-modal");n.textContent=e,jt(n,{"data-testid":"top-level-modal","has-close-button":"true",title:t}),document.body.appendChild(n)}function xr(t,e,n){const r=document.createElement("top-level-modal");jt(r,{"data-testid":"top-level-modal",title:t}),e instanceof Promise?(r.innerHTML="\n \n \n \n \n \n \n '),e.then(a=>{a&&a!==""?r.innerHTML=a:r.innerHTML=n!=null?n:""}).catch(()=>{r.innerHTML=n!=null?n:""})):r.innerHTML=e,document.body.appendChild(r)}function Q(t,e){Yt(e.translate("error_dialogs.wallet.title",{wallet:t}),e.translate("error_dialogs.wallet.generic_error",{wallet:t}))}function bt(t){Yt(t.translate("error_dialogs.checkout.title"),t.translate("error_dialogs.checkout.generic_error"))}function Te(t,e){Yt(t.translate("error_dialogs.checkout.title"),e)}function ke(t,e){switch(e){case Ht.InvalidQuantity:bt(t);break}}me("top-level-modal",Gl);class Kt extends HTMLElement{get buyerCountry(){return this.getAttribute("buyer-country")}get recommendedInstrument(){return this.getAttribute("recommended-instrument")}get buyerCurrency(){const e=this.getAttribute("buyer-currency");if(e==null)throw new Error("WalletElement buyer-currency is null");return e}get accessToken(){return this.getAttribute("access-token")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get hasSellingPlan(){const e=this.getAttribute("has-selling-plan");return e==="true"||e===""}set hasSellingPlan(e){e?this.setAttribute("has-selling-plan",""):this.removeAttribute("has-selling-plan")}get isShippingRequired(){const e=this.getAttribute("requires-shipping");return e==="true"||e===""}set isShippingRequired(e){e?this.setAttribute("requires-shipping",""):this.removeAttribute("requires-shipping")}get pciEnabled(){return this.hasAttribute("pci-enabled")}}const Vl="#more-payment-options-link{cursor:pointer}";function ql(t){const e=n=>{n.persisted&&(t(),window.removeEventListener("pageshow",e))};window.addEventListener("pageshow",e)}class Wl extends Error{constructor(e){e instanceof Error?(super("[".concat(e.name,"] ").concat(e.message),{cause:e.cause}),this.stack=e.stack):super("[HandleCreateCartError] ".concat(String(e))),this.name="HandleCreateCartError"}}async function ye({element:t,instrumentName:e,dataSource:n}){try{const r=await n.getInitialCart(e),{cart:a,errors:i,warnings:o}=r;ql(()=>{t&&(t.disabled=!1)});const s=kr(i),l=i.length===1&&i[0]===g.InvalidQuantity,d=l||s;if(!a&&!d)throw new Error("[".concat(e,"] Failed to create cart: ").concat(JSON.stringify(i)));if(a){if(!a.id)throw new Error("[".concat(e,"] received invalid cart"));if(!a.checkoutUrl)throw new Error("[".concat(e,"] Created cart with no checkout URL"))}if(i.length>0&&!d)throw new Error("Errors present after cart creation: ".concat(JSON.stringify(i)));return w({cart:a,customValidationError:s,decelerationReason:St({warnings:o})},l?{unrecoverableError:Ht.InvalidQuantity}:{})}catch(r){throw new Wl(r)}finally{t.disabled=!1}}class jl extends Kt{constructor(){super(),c(this,"name",f.MoreOptions),c(this,"anchor"),c(this,"i18n"),c(this,"dataSource"),c(this,"classNames"),c(this,"setI18n"),c(this,"setDataSource"),c(this,"setClassNames"),[this.i18n,this.setI18n]=le(),[this.dataSource,this.setDataSource]=le(),[this.classNames,this.setClassNames]=le()}static get observedAttributes(){return["disabled"]}connectedCallback(){this.anchor||this.render()}attributeChangedCallback(e,n,r){n!==r&&e==="disabled"&&this.anchor&&(r===""?this.anchor.setAttribute("aria-disabled","true"):this.anchor.removeAttribute("aria-disabled"),this.setAccessibilityAttributes())}async handleClick(e){var n,r;if(e.preventDefault(),this.disabled||!this.anchor)return;this.disabled=!0;const[a,i]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:o,cart:s,customValidationError:l,unrecoverableError:d}=await ye({element:this,instrumentName:f.MoreOptions,dataSource:i});if(d){m.sheetClicked({instrument:this.name,result:"failed"}),ke(a,d);return}if(l){Te(a,l.message);return}if(o){U({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:f.MoreOptions,reason:o});return}const u=this.recommendedInstrument===f.ShopPay?"skip_shop_pay":"allow_redirect";m.sheetClicked({instrument:f.MoreOptions,result:"success"}),he((r=s==null?void 0:s.checkoutUrl)!=null?r:"",u)}catch(o){m.sheetClicked({instrument:f.MoreOptions,result:"failed"}),b.notify(o),bt(a)}}async render(){const e=await this.i18n,n=await this.classNames;this.anchor=document.createElement("a"),this.anchor.textContent=e.translate("more_payment_options"),this.anchor.className=n,this.anchor.setAttribute("id","more-payment-options-link"),this.anchor.onclick=a=>this.handleClick(a),this.setAccessibilityAttributes(),this.appendChild(this.anchor);const r=document.createElement("style");r.textContent=Vl,this.appendChild(r)}setAccessibilityAttributes(){this.anchor&&(this.disabled?(this.anchor.removeAttribute("href"),this.anchor.role="link"):(this.anchor.removeAttribute("role"),this.anchor.href="#"))}}var L=(t=>(t.ButtonDisplay="buttonDisplay",t.LoadInstrument="loadInstrument",t.LoadSdk="loadSDK",t.AuthorizationLatency="authorizationLatency",t.SheetLoad="sheetLoad",t.StyleExtract="styleExtract",t))(L||{});function _a(){var t,e;return!!((t=window.performance)!=null&&t.mark)&&!!((e=window.performance)!=null&&e.measure)}function Ye(t,e){return Je(t,e),()=>Z(t,e)}function Je(t,e){_a()&&window.performance.mark("".concat(t,"-").concat(e,"-start"))}function Z(t,e){var n,r;if(_a())try{const a="".concat(t,"-").concat(e,"-start"),i="".concat(t,"-").concat(e,"-end"),o="".concat(t,"-").concat(e,"-duration");window.performance.mark(i);const s=(r=window.performance.measure(o,a,i))!=null?r:(n=window.performance.getEntriesByName(o,"measure"))==null?void 0:n[0],l=s==null?void 0:s.duration;return l==null?void 0:l}catch(a){return}}function Or(t,e,n){if(nt!=null&&nt.length){const r=nt.join(",");t.querySelectorAll(r).forEach(a=>{n===null?a.removeAttribute(e):a.setAttribute(e,n)})}}function Yl(t,e){try{const n=JSON.parse(t!=null?t:"[]");if(!(n instanceof Array))throw new ee({code:"invalid-wallet-configs",message:"[".concat(e,"] invalid walletConfigs found")});return n}catch(n){throw new ee({code:"invalid-wallet-configs",message:"[".concat(e,"] Error while parsing walletConfigs JSON: ").concat(n)},{cause:n})}}function Kl(t,e){try{return t?JSON.parse(t):null}catch(n){throw new ee({code:"invalid-wallet-config",message:"[".concat(e,"] Error while parsing walletConfig JSON: ").concat(n)},{cause:n})}}function vt(t,e){var n;const r=e==null?void 0:e.getLoadEligibility(t);return m.instrumentLoadEligibility({instrument:e==null?void 0:e.getInstrumentName(),result:r!=null&&r.eligible?"success":"failed",reason:r!=null&&r.eligible||r==null?void 0:r.reason}),(n=r==null?void 0:r.eligible)!=null?n:!1}function Ql(t,e){return e.filter(n=>vt(t,n))}async function Ea({walletInstrument:t,instanceNumber:e}){const n=t.getInstrumentName(),r=Ye(L.LoadSdk,"".concat(n,":").concat(e));try{await t.loadWalletSDK(),m.instrumentSDKLoaded({instrument:n,measurement:r(),result:"success"})}catch(i){return b.notify(i),m.instrumentSDKLoaded({instrument:n,measurement:r(),result:"failed"}),null}let a;try{a=t.getPartnerSDKEligibility()}catch(i){b.notify(i),a={eligible:!1,reason:"uncaught exception"}}return a.eligible?(m.instrumentSDKEligible({instrument:n,result:"success"}),t):(m.instrumentSDKEligible({instrument:n,reason:a.reason,result:"failed"}),null)}function Ke(t,...e){try{const n=window[t];if(typeof n=="function")return new n(...e)}catch(n){}return null}const Aa="d6d12da0",Oe="0402dc2d";var Ge;class Mr extends Kt{constructor(){super(),c(this,"apiClient"),c(this,"i18n"),c(this,"policy"),c(this,"isFetchingPolicy",!1),c(this,"intersectionObserver",null),M(this,Ge),c(this,"handleIntersection",(e,n)=>{e.some(r=>r.isIntersecting)&&(this.apiClient&&this.apiClient.setVisible(),n.disconnect(),V({event:H.FirstVisible}))}),this.mountIntersectionObserver()}get shopId(){return this.getAttribute("shop-id")}get cartId(){return this.getAttribute("cart-id")}get walletConfigs(){return this.getAttribute("wallet-configs")}get recommendedWallet(){return this.getAttribute("recommended")}get amazonWallet(){return this.isFlagEnabled(Oe)?this.getAttribute("amazon-wallet"):null}get fallbackWallet(){return this.getAttribute("fallback")}get isBuyWithPrimeEligible(){return this.isFlagEnabled(Oe)?this.hasAttribute("is-buy-with-prime-eligible"):!1}get variantParams(){var e;try{return JSON.parse((e=this.getAttribute("variant-params"))!=null?e:"[]")}catch(n){throw new ee({code:"invalid-variant-params",message:"variant-params must be a valid JSON string. Received variant-params: ".concat(this.getAttribute("variant-params"),", received error: ").concat(n)})}}get styleExtractorDisabled(){return this.hasAttribute("disable-compat")}get onlySdk(){return this.hasAttribute("only-sdk")}get debug(){return this.hasAttribute("debug")}get hidePaymentButton(){return this.isFlagEnabled(Oe)?this.isBuyWithPrimeEligible&&this.isRedirectedFromAmazon:!1}get isRedirectedFromAmazon(){return this.isFlagEnabled(Oe)?sessionStorage.getItem("shopify_amazon_referral")==="mShop":!1}triggerLoadedEvent(){document.dispatchEvent(new Event("shopify:payment_button:loaded",{bubbles:!0,cancelable:!0}))}async attributeChangedCallback(e,n,r){n!==r&&Or(this,e,r)}showBuyerConsent(e,n){var r,a,i;!e||!n||(i=(a=(r=window.Shopify)==null?void 0:r.PaymentButton)==null?void 0:a.showBuyerConsent)==null||i.call(a,o=>this.onClickSubscriptionPolicy(o,e,n))}hideBuyerConsent(){var e,n,r;(r=(n=(e=window.Shopify)==null?void 0:e.PaymentButton)==null?void 0:n.hideBuyerConsent)==null||r.call(n)}clearUI(){this.innerHTML=""}isFlagEnabled(e){return A(this,Ge)==null&&k(this,Ge,this.getEnabledFlags()),A(this,Ge).includes(e)}getEnabledFlags(){const e=this.getAttribute("enabled-flags");if(!e)return[];try{return JSON.parse(e)}catch(n){return console.warn("Invalid enabled-flags attribute value:",e),[]}}async onClickSubscriptionPolicy(e,n,r){if(e.preventDefault(),this.isFetchingPolicy)return;if(this.policy){this.showPolicy(this.policy,r);return}this.isFetchingPolicy=!0;const a=this.fetchSubscriptionPolicy(n).then(i=>(this.policy=i,i)).catch(i=>(b.notify(i),r.translate("subscriptions.policy_not_found"))).finally(()=>{this.isFetchingPolicy=!1});this.showPolicy(a,r)}async fetchSubscriptionPolicy(e){const n=await e.fetchSubscriptionPolicy();return this.policy=n,n}showPolicy(e,n){xr(n.translate("subscriptions.cancellation_policy"),e,n.translate("subscriptions.policy_not_found"))}mountIntersectionObserver(){this.intersectionObserver=Ke("IntersectionObserver",this.handleIntersection),this.intersectionObserver?this.intersectionObserver.observe(this):V({event:H.FirstVisibleNotAvailable})}}Ge=new WeakMap;function Fr(t){var e,n;vs({shopId:(e=t.shopId)!=null?e:Gn,cartId:(n=t.cartId)!=null?n:void 0,debug:t.debug,pageType:t.pageType})}function Ca({type:t,form:e}){if(!e)return[];const n=document.querySelectorAll('[name^="'.concat(t,'"][form^="').concat(CSS.escape(e.getAttribute("id")||""),'"]')),r=e.querySelectorAll('[name^="'.concat(t,'"]')),a=[...n,...r],i={};return a.forEach(o=>{const s=Jl(o),l=Xl(o);s&&typeof l<"u"&&l.trim()!==""&&(i[s]=l)}),Object.entries(i!=null?i:{}).map(([o,s])=>({key:o,value:s}))}function Qt({page:t,element:e}){const n=t==="product"?'[data-shopify="payment-button"]':'[data-shopify="dynamic-checkout-cart"]',r=yn(e,n)||document.querySelector(n);return yn(r,"form")}const tt=Element.prototype;function yn(t,e){if(tt.matches=tt.matches||tt.webkitMatchesSelector||tt.msMatchesSelector||tt.mozMatchesSelector,!t||t.matches(e))return t;let n=t;for(;n&&n!==document.body;)if(n=n.parentElement,n&&n.matches(e))return n;return null}function Jl(t){const e=t.getAttribute("name");if(e===null)return null;const n=e.indexOf("["),r=e.lastIndexOf("]");return n===-1||r===-1?null:e.substring(n+1,r)}function Xl(t){if(!(["radio","checkbox"].includes(t.type)&&!t.checked)&&!(t.value===""||typeof t.value>"u"))return t.value}function Ur(t){const e=Qt({page:"product",element:t});return Sa(e)}function Sa(t){var e;const n=t==null?void 0:t.elements;if(!n)return null;const r=Dt(n,"id");if(!r||isNaN(Number(r)))return null;const a=Number((e=Dt(n,"quantity"))!=null?e:"1"),i="gid://shopify/ProductVariant/".concat(r),o=ec(n),s=Ca({type:"properties",form:t});return{variantId:r,quantity:a,merchandiseId:i,sellingPlanId:o,lineItemProperties:s}}function Zl(t){const e=t==null?void 0:t.elements;return e?!!Dt(e,"selling_plan"):!1}function Dt(t,e){var n,r;let a=t.namedItem(e);return a instanceof HTMLSelectElement?(n=a.value)!=null?n:null:(a&&"length"in a&&(a=a.item(0)),(a instanceof HTMLInputElement||a instanceof HTMLSelectElement)&&(r=a.value)!=null?r:null)}function ec(t){const e=Dt(t,"selling_plan");if(!(!e||e==="undefined"))return"gid://shopify/SellingPlan/".concat(e)}class Ia{constructor(e,n){c(this,"addToCartMutationObserver"),c(this,"addToCartForm"),c(this,"addToCartButtons"),this.element=e,this.onFormChanged=n,this.addToCartMutationObserver=null,this.addToCartForm=null,this.addToCartButtons=[]}setupMutationObservers(){if(this.findAndSetAddToCartButtons(),!this.addToCartForm)return;this.syncComponentStateWithForm();const e=new MutationObserver(()=>this.reobserveOnFormChanges());this.addToCartMutationObserver=new MutationObserver(()=>this.syncComponentStateWithForm()),e.observe(this.addToCartForm,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),this.observeAddToCartButtons()}syncComponentStateWithForm(){if(!this.addToCartForm){this.onFormChanged({disabled:!0,hasSellingPlan:!1});return}const e=Sa(this.addToCartForm),n=!!(this.addToCartButtons.length>0&&this.addToCartButtons.every(r=>r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"));this.onFormChanged({disabled:n||e===null,hasSellingPlan:Zl(this.addToCartForm),variantId:e==null?void 0:e.variantId,sellingPlanId:e==null?void 0:e.sellingPlanId})}observeAddToCartButtons(){this.addToCartButtons.forEach(e=>{this.addToCartMutationObserver.observe(e,{attributes:!0})})}reobserveOnFormChanges(){var e;(e=this.addToCartMutationObserver)==null||e.disconnect(),this.findAndSetAddToCartButtons(),this.observeAddToCartButtons(),this.syncComponentStateWithForm()}findAndSetAddToCartButtons(){this.addToCartForm=Qt({page:"product",element:this.element}),this.addToCartForm&&(this.addToCartButtons=[...this.addToCartForm.querySelectorAll("[type=submit]")])}}function tc(t,e,n){try{const r=JSON.parse(t!=null?t:"{}"),a=JSON.parse(e!=null?e:JSON.stringify(zn));if(r===null||Object.keys(r).length===0){if(!(a instanceof Object))throw m.walletConfigDeveloperError(),new ee({code:"invalid-fallback-wallet-config",message:"[".concat(n,"] Invalid fallback wallet configs JSON")});return{recommendedWallet:null,fallbackWallet:a}}return{recommendedWallet:r,fallbackWallet:a}}catch(r){throw m.walletConfigDeveloperError(),new ee({code:"invalid-recommended-fallback-config",message:"[".concat(n,"] Error while parsing recommended/fallback JSON: ").concat(r)},{cause:r})}}const rc=".shopify-payment-button__button--hidden{visibility:hidden}.shopify-payment-button__button{height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 44px),55px);min-height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 44px),55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius, 0px);width:100%;border:none;box-shadow:0 0 0 0 transparent;color:#fff;cursor:pointer;display:block;font-size:1em;font-weight:500;line-height:1;text-align:center;transition:background .2s ease-in-out}.shopify-payment-button__button[disabled]{opacity:.6;cursor:default}.shopify-payment-button__button--unbranded{background-color:#1990c6;padding:1em 2em}.shopify-payment-button__button--unbranded:hover:not([disabled]){background-color:#136f99}.shopify-payment-button__more-options{background:transparent;border:0 none;cursor:pointer;display:block;font-size:1em;margin-top:1em;text-align:center;text-decoration:underline;width:100%}.shopify-payment-button__more-options.shopify-payment-button__skeleton{height:auto!important;min-height:0!important;border-radius:4px!important;width:50%;margin-left:25%;margin-right:25%}.shopify-payment-button__more-options[disabled]{opacity:.6;cursor:default!important}.shopify-payment-button__button.shopify-payment-button__button--branded{display:flex;flex-direction:column;position:relative;z-index:1}.shopify-payment-button__button.shopify-payment-button__button--branded .shopify-cleanslate{flex:1!important;display:flex!important;flex-direction:column!important}.shopify-payment-button__button.button.loading{position:relative;color:transparent}.shopify-payment-button__button.button.loading>.loading-overlay__spinner{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;height:100%;display:flex;align-items:center}.shopify-payment-button__button.button.loading>.loading-overlay__spinner .spinner{width:-moz-fit-content;width:-webkit-fit-content;width:fit-content}.button.loading>.loading-overlay__spinner .path{stroke:#fff}.shopify-payment-button__button .loading-overlay__spinner{width:1.8rem;display:inline-block}.shopify-payment-button__button .spinner{animation:shopify-rotator 1.4s linear infinite}@keyframes shopify-rotator{0%{transform:rotate(0)}to{transform:rotate(270deg)}}.shopify-payment-button__button .path{stroke-dasharray:280;stroke-dashoffset:0;transform-origin:center;stroke:#121212;animation:shopify-dash 1.4s ease-in-out infinite}@media screen and (forced-colors: active){.shopify-payment-button__button .path{stroke:CanvasText}}@keyframes shopify-dash{0%{stroke-dashoffset:280}50%{stroke-dashoffset:75;transform:rotate(135deg)}to{stroke-dashoffset:280;transform:rotate(450deg)}}#shopify-buyer-consent{margin-top:1em;display:inline-block;width:100%}#shopify-buyer-consent.hidden{display:none}#shopify-subscription-policy-button{background:none;border:none;padding:0;text-decoration:underline;font-size:inherit;cursor:pointer}#shopify-subscription-policy-button:before{box-shadow:none}@keyframes acceleratedCheckoutLoadingSkeleton{50%{opacity:var(--shopify-accelerated-checkout-skeleton-animation-opacity-start, 1)}75%{opacity:var(--shopify-accelerated-checkout-skeleton-animation-opacity-end, .5)}to{opacity:var(--shopify-accelerated-checkout-skeleton-animation-opacity-start, 1)}}.shopify-payment-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration, 4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function, ease) infinite;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede);box-sizing:border-box;text-decoration:none!important;height:var(--shopify-accelerated-checkout-button-block-size, inherit);min-height:25px;max-height:55px;border-radius:var( --shopify-accelerated-checkout-button-border-radius, inherit )}",nc='.accelerated-checkout-button{height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 44px),55px);min-height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 44px),55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius, 0px);box-shadow:var(--shopify-accelerated-checkout-button-box-shadow);min-width:150px}:host([page-type="cart_page"]) .accelerated-checkout-button{height:100%;width:100%;border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}@media (forced-colors: active){.accelerated-checkout-button{border:1px solid transparent!important}:host([page-type="cart_page"]) .accelerated-checkout-button{border:1px solid transparent!important}}',ac=70;class st{constructor(e,n,r,a){c(this,"red"),c(this,"green"),c(this,"blue"),c(this,"opacity"),this.red=e||0,this.green=n||0,this.blue=r||0,this.opacity=typeof a>"u"?1:a}getLuminance(){const e=this.red&255,n=this.green&255,r=this.blue&255;return e*.2126+n*.7152+r*.0722}isDark(){return this.opacity===0?!1:this.getLuminance()/this.opacity0&&a.opacity>0?(r=new st(0,0,0,0),r.blendWith(a,n)):a.opacity>0?r=a:r=n,n=r,a=e.shift();return r}const fr=new st(255,255,255,1);function oc(t){const e=[];let n=t;for(;n.parentElement;){n=n.parentElement;const r=window.getComputedStyle(n).backgroundColor,a=sc(r);if(r&&e.push(a),a.opacity===1)break}try{return ic(e.reverse())}catch(r){return b.notify(new Pa("[BackgroundDetection] Failed to blend colors for element ".concat(t.outerHTML),{cause:r})),fr}}function sc(t){if(!t)return fr;try{const e=t.split("(")[1].split(")")[0].replace(" ","").split(",");return new st(Number(e[0]),Number(e[1]),Number(e[2]),typeof e[3]>"u"?1:Number(e[3]))}catch(e){b.notify(new Pa("[BackgroundDetection] Failed to convert rgbString to array ".concat(t),{cause:e}))}return fr}class Pa extends Error{constructor(){super(...arguments),c(this,"name","ColorProcessingError")}}class Le extends Kt{constructor(){super(),c(this,"name",f.Unknown),c(this,"i18n"),c(this,"dataSource"),c(this,"apiClient"),c(this,"classNames"),c(this,"containerInstanceNumber"),c(this,"onRendered"),c(this,"setI18n"),c(this,"setDataSource"),c(this,"setApiClient"),c(this,"setClassNames"),c(this,"setContainerInstanceNumber"),c(this,"parsedWalletParams"),this.onRendered=()=>{},[this.i18n,this.setI18n]=le(),[this.dataSource,this.setDataSource]=le(),[this.apiClient,this.setApiClient]=le(),[this.classNames,this.setClassNames]=le(),[this.containerInstanceNumber,this.setContainerInstanceNumber]=le()}async cleanupOnFailure(e,n){var r;try{await e()}catch(a){b.notify(new lc("An error occurred requiring cleanup when attempting to render the ".concat(n," instrument: ").concat(a),{cause:a}));const i=await this.containerInstanceNumber;m.instrumentLoaded({instrumentOrComponentName:n,result:"failed",measurement:Z(L.ButtonDisplay,"".concat(n,":").concat(i))}),(r=this.parentElement)==null||r.remove()}}attributeChangedCallback(e,n,r,a){n!==r&&e==="disabled"&&a&&(r===""?(a.setAttribute("aria-disabled","true"),a.setAttribute("disabled","")):(a.removeAttribute("aria-disabled"),a.removeAttribute("disabled")))}get pageType(){return this.getAttribute("page-type")||S.Unknown}get buttonTheme(){return oc(this).isDark()?"LIGHT":"DARK"}get isCTA(){return this.hasAttribute("call-to-action")}get walletParams(){var e;if(this.parsedWalletParams===void 0)try{this.parsedWalletParams=JSON.parse((e=this.getAttribute("wallet-params"))!=null?e:"{}")}catch(n){throw new ee({code:"invalid-wallet-params",message:"[".concat(this.name,"] Error while parsing wallet-params JSON: ").concat(n)},{cause:n})}return this.parsedWalletParams}async initializeShadowStyles(e,n=""){const r=document.createElement("style");r.innerHTML=[nc,n].join("\n"),e.appendChild(r)}async ensureLightDOMIsNotEmpty(){this.textContent="\xA0"}dispatchWalletEvent({eventName:e,detail:n={}}){var r;(r=this.parentElement)==null||r.dispatchEvent(new CustomEvent(e,{detail:n}))}}class lc extends Error{constructor(){super(...arguments),c(this,"name","CleanupOnFailureError")}}class cc extends Le{constructor(){super(...arguments),c(this,"name",f.BuyItNow),c(this,"button",null)}static get observedAttributes(){return["disabled"]}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(e,n,r){super.attributeChangedCallback(e,n,r,this.button)}async handleClick(){var e,n;if(this.disabled||!this.button||this.button.getAttribute("aria-disabled"))return;this.disabled=!0;const[r,a]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:i,cart:o,customValidationError:s,unrecoverableError:l}=await ye({element:this,instrumentName:this.name,dataSource:a});if(l){m.sheetClicked({instrument:this.name,result:"failed"}),ke(r,l);return}if(m.sheetClicked({instrument:this.name,result:"success"}),s){Te(r,s.message);return}if(i){U({checkoutUrl:(e=o==null?void 0:o.checkoutUrl)!=null?e:"",instrumentName:this.name,reason:i});return}he((n=o==null?void 0:o.checkoutUrl)!=null?n:"","allow_redirect")}catch(i){b.notify(i),m.sheetClicked({instrument:this.name,result:"failed"}),bt(r)}}async render(){var e;this.button||(this.button=Wt());const n=await this.classNames;this.button.textContent=(await this.i18n).translate("instruments_copy.checkout.buy_now"),this.button.className=n,this.disabled&&this.button.setAttribute("aria-disabled","true"),this.button.onclick=()=>this.handleClick(),this.appendChild(this.button),(e=this.onRendered)==null||e.call(this)}}function dc(){const t=navigator.userAgent,e=t.indexOf("Android")>-1,n=t.indexOf("Chrome/")>-1,r=parseInt((/Chrome\/([0-9]+)/.exec(t)||["0","0"])[1],10);return e&&n&&r===114}class ge{constructor(e){c(this,"walletParams"),this.walletParams=e.wallet_params}static walletName(){throw new Error("Must define walletName for WalletInstrument subclass")}createWebComponent({walletContainer:e,dataSource:n,i18n:r,apiClient:a,containerInstanceNumber:i,classNames:o="",callToAction:s,pageType:l=S.ProductPage,slot:d="button",onRendered:u=()=>{}}){var h,p,y;const C=this.getWebComponentName();me(C,this.getWebComponentClass(),{isChildCustomElement:!0});const _=document.createElement(C),E={"access-token":(h=e.accessToken)!=null?h:"","buyer-country":(p=e.buyerCountry)!=null?p:"","buyer-currency":e.buyerCurrency,"wallet-params":JSON.stringify((y=this.walletParams)!=null?y:{}),"page-type":l,slot:d};try{e.disabled&&_.setAttribute("disabled",""),jt(_,E),e.isShippingRequired&&_.setAttribute("requires-shipping",""),e.hasSellingPlan&&_.setAttribute("has-selling-plan",""),e.pciEnabled&&_.setAttribute("pci-enabled","")}catch(P){const $=P;throw $.message.includes("setAttribute is not a function")&&dc()?new Ut($.message):$}return s&&_.setAttribute("call-to-action",""),_.setDataSource(n),_.setApiClient(a),_.setI18n(r),_.setClassNames(o),_.setContainerInstanceNumber(i),_.onRendered=u,_}loadWalletSDK(){return Promise.resolve()}getLoadEligibility(e){return{eligible:!0}}getPartnerSDKEligibility(){return{eligible:!0}}}class uc extends ge{static walletName(){return"buy_it_now"}getWebComponentName(){return"shopify-buy-it-now-button"}getInstrumentName(){return f.BuyItNow}getWebComponentClass(){return cc}}const hc="shopify-paypal-button[disabled]{opacity:.5;cursor:not-allowed}shopify-paypal-button div.paypal-buttons>iframe{z-index:auto!important;border-radius:0!important;box-shadow:none}",pc="::slotted(div){height:100%}";async function $e(t){const{cartId:e,cartClient:n,instrumentName:r,abortSignal:a}=t;try{if(!e)throw new Error("[".concat(r,"] provided no cart ID when updating buyer identity"));if(!n)throw new Error("[".concat(r,"] provided invalid cart client when updating buyer identity"));return await n.updateCartBuyerIdentity(t,a)}catch(i){throw m.updateFailed(r,"updateBuyerIdentity"),i}}async function Br({cartId:t,totalAmount:e,paymentMethod:n,billingAddress:r,cartClient:a,instrumentName:i,abortSignal:o,hasSellingPlan:s,canUsePaymentMethodForFreeOrder:l}){try{if(!t)throw new Error("[".concat(i,"] provided no cart ID when updating payment"));if(!e)throw new Error("[".concat(i,"] provided no total amount when updating payment"));if(!n)throw new Error("[".concat(i,"] provided no apple pay wallet content when updating payment"));if(!a)throw new Error("[".concat(i,"] provided invalid cart client when updating payment"));const d={freePaymentMethod:{billingAddress:r}};return await a.updateCartPayment(t,w({amount:{amount:e.amount,currencyCode:e.currencyCode}},Number(e.amount)<=0&&!l&&!s?d:n),i,o)}catch(d){throw m.updateFailed(i,"updatePayment"),d}}function va(t){return window[Da(t)]}function Da(t){return"paypal-".concat(t.replace(/[^a-zA-Z0-9]/g,""))}function Rt(t){if(!t)return null;const e=getComputedStyle(t).borderRadius;return e.includes("px")?parseInt(e,10):null}function Nt(t){if(!t)return null;const e=getComputedStyle(t).height;return e.includes("px")?parseInt(e,10):null}const sr=25,gn=55,mc=["cart_not_ready","cart_throttled","payment_method_not_applicable","invalid_payment_deferred_payment_required"],lr="PAYPAL_CALLBACK_HANDLED_ERROR";var Ae,ce;class yc extends Le{constructor(){super(),c(this,"name",f.PayPal),c(this,"abortController",null),c(this,"cartId"),c(this,"sdkButtonsComponent"),c(this,"container",null),c(this,"resizeObserver",null),c(this,"buttonHeight"),c(this,"rendering",!1),c(this,"prevBorderRadius",0),c(this,"prevHeight",0),M(this,Ae),M(this,ce,!1),k(this,Ae,this.attachShadow({mode:"closed"})),this.resizeObserver=Ke("ResizeObserver",()=>this.onResize())}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){this.innerHTML="",A(this,Ae).innerHTML="",await this.teardownPayPalButton(),this.resizeObserver&&this.resizeObserver.disconnect()}async teardownPayPalButton(){var e;try{await((e=this.sdkButtonsComponent)==null?void 0:e.close().catch(()=>{}))}catch(n){}finally{this.sdkButtonsComponent=void 0}}async onResize(){const e=Rt(this.container),n=Nt(this.container),r=e!==null&&this.prevBorderRadius!==e||n!==null&&this.pre