import.meta;var Va=Object.defineProperty,za=Object.defineProperties,qa=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,Ur=Object.prototype.propertyIsEnumerable,zt=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),$r=e=>{throw TypeError(e)},qt=(e,t,n)=>t in e?Va(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))Fr.call(t,n)&&qt(e,n,t[n]);if(yt)for(var n of yt(t))Ur.call(t,n)&&qt(e,n,t[n]);return e},T=(e,t)=>za(e,qa(t)),jt=(e,t)=>{var n={};for(var r in e)Fr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yt)for(var r of yt(e))t.indexOf(r)<0&&Ur.call(e,r)&&(n[r]=e[r]);return n},c=(e,t,n)=>qt(e,typeof t!="symbol"?t+"":t,n),Br=(e,t,n)=>t.has(e)||$r("Cannot "+n),C=(e,t,n)=>(Br(e,t,"read from private field"),n?n.call(e):t.get(e)),x=(e,t,n)=>t.has(e)?$r("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),k=(e,t,n,r)=>(Br(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ee=function(e,t){this[0]=e,this[1]=t},Ne=(e,t,n)=>{var r=(o,s,l,u)=>{try{var d=n[o](s),h=(s=d.value)instanceof ee,p=d.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,u):l({value:y,done:p})).catch(y=>r("throw",y,l,u))}catch(y){u(y)}},a=o=>i[o]=s=>new Promise((l,u)=>r(o,s,l,u)),i={};return n=n.apply(e,t),i[zt("asyncIterator")]=()=>i,a("next"),a("throw"),a("return"),i},te=(e,t,n)=>(t=e[zt("asyncIterator")])?t.call(e):(e=e[zt("iterator")](),t={},n=(r,a)=>(a=e[r])&&(t[r]=i=>new Promise((o,s,l)=>(i=a.call(e,i),l=i.done,Promise.resolve(i.value).then(u=>o({value:u,done:l}),s)))),n("next"),n("return"),t);const ja=":host{display:flex;align-items:center;justify-content:center}";class Ya extends HTMLElement{constructor(){var t,n;super(),c(this,"size"),c(this,"color"),this.size=(t=this.getAttribute("size"))!=null?t:"18px",this.color=(n=this.getAttribute("color"))!=null?n:"gray",this.attachShadow({mode:"open"})}connectedCallback(){this.render();const t=document.createElement("style");t.textContent=ja,this.shadowRoot.appendChild(t)}render(){const t=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 ');t.innerHTML="\n <svg ".concat(n,' viewBox="0 0 20 20" fill="').concat(this.color,'">\n <path d="M17.1 4.3l-1.4-1.4-5.7 5.7-5.7-5.7-1.4 1.4 5.7 5.7-5.7 5.7 1.4 1.4 5.7-5.7 5.7 5.7 1.4-1.4-5.7-5.7z"/>\n </svg>\n ')}}const Wa="#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 Ka(e){return An(e).map(t=>t instanceof Error?t:new Cn("[".concat(typeof t,"] ").concat(Qa(t).slice(0,10240))))}function An(e,t=0){return t>=20?[e,"Truncated cause stack"]:e instanceof Error&&"cause"in e?[e,...An(e.cause,t+1)]:[e]}function Qa(e){var t;if(typeof e!="string")try{return(t=JSON.stringify(e))!=null?t:typeof e}catch(n){}return"".concat(e)}var Cn=class extends Error{constructor(){super(...arguments),c(this,"name","BugsnagInvalidError")}},Sn=/^\s*at .*(\S+:\d+|\(native\))/m,Xa=/^(eval@)?(\[native code])?$/;function Ja(e){return e.stack?e.stack.match(Sn)?Za(e):ei(e):[]}function In(e){if(e.indexOf(":")===-1)return[e];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]?Number(t[2]):void 0,t[3]?Number(t[3]):void 0]}function Za(e){return e.stack.split("\n").filter(t=>!!t.match(Sn)).map(t=>{let n=t.replace(/^\s+/,"").replace(/^.*?\s+/,""),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],""):n;let a=In(r?r[1]:n),i=r&&n||void 0,o=["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0];return{method:i,file:o,lineNumber:a[1],columnNumber:a[2]}})}function ei(e){return e.stack.split("\n").filter(t=>!t.match(Xa)).map(t=>{if(t.indexOf("@")===-1&&t.indexOf(":")===-1)return{method:t};let n=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(n),a=r&&r[1]?r[1]:void 0,i=In(t.replace(n,""));return{method:a,file:i[0],lineNumber:i[1],columnNumber:i[2]}})}var Hr="5",ti=class{constructor(e){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");var t,n;this.apiKey=e.apiKey,this.appType=e.appType,this.appId=e.appId,this.appVersion=e.appVersion,this.releaseStage=e.releaseStage,this.locale=e.locale,this.userAgent=e.userAgent,this.metadata=e.metadata,this.onError=e.onError,this.persistedMetadata={},this.endpoints=(t=e.endpoints)!=null?t:{notify:"https://notify.bugsnag.com/",sessions:"https://sessions.bugsnag.com"},this.plugins=(n=e.plugins)!=null?n:[],this.plugins.forEach(r=>r.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state")}addMetadata(e){for(let t of Object.keys(e))this.persistedMetadata[t]=e[t]}leaveBreadcrumb(e,t,n="manual"){this.breadcrumbs.push({name:e,metaData:t,type:n,timestamp:new Date().toISOString()})}notify(e,{errorClass:t,severity:n,severityType:r,handled:a=!0,metadata:i,context:o,groupingHash:s}={}){var l,u;let d=Ka(e),h=b(b(b({},this.metadata),this.persistedMetadata),i),p=this.buildBugsnagEvent(d,{errorClass:t,severityType:r,handled:a,severity:n,metadata:h,context:o,groupingHash:s});if(((u=(l=this.onError)==null?void 0:l.call(this,p,e))==null||u)&&this.releaseStage!=="development"){let y=this.sendToBugsnag(p);return this.onPostErrorListeners.forEach(E=>E(p)),y}return Promise.resolve()}addOnPostError(e){this.onPostErrorListeners.push(e)}buildBugsnagEvent(e,{errorClass:t,severity:n="error",severityType:r="handledException",handled:a,metadata:i={},context:o,groupingHash:s}){let l=new Date().toISOString(),{breadcrumbs:u,appId:d,appType:h,appVersion:p,releaseStage:y,locale:E,userAgent:f}=this,A=e.map((I,O)=>({errorClass:O===0&&t!=null?t:I.name,stacktrace:Pn(d,I),message:I.message}));return{payloadVersion:Hr,exceptions:A,severity:n,severityReason:{type:r},unhandled:!a,app:{id:d,type:h,version:p,releaseStage:y},device:{time:l,locale:E,userAgent:f},breadcrumbs:u,context:o,metaData:i,groupingHash:s}}async sendToBugsnag(e){let{apiKey:t}=this,n={apiKey:t,notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},events:[e]};try{await fetch(this.endpoints.notify,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":t,"Bugsnag-Payload-Version":Hr,"Bugsnag-Sent-At":e.device.time},body:JSON.stringify(n)})}catch(r){console.warn("[bugsnag-light] failed to send an event"),console.warn(r)}}};function Pn(e,t){let n=Ja(t).map(r=>{var a,i,o,s;let l=(a=r.file)==null?void 0:a.includes(e);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(t instanceof Cn){let r=n.findIndex(a=>a.method.endsWith("notify"));r>-1&&(n=n.slice(r+1))}return n}var ri=class Bd extends Error{constructor(t){super(t),c(this,"reason"),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,Bd.prototype)}};function ni(e){let t=window.onerror;window.onerror=(n,r,a,i,o)=>{o&&e.notify(o,{severityType:"unhandledException",handled:!1}),typeof t=="function"&&t.apply(window.onerror,[n,r,a,i,o])}}function ai(e){window.addEventListener("unhandledrejection",t=>{t.reason&&!(t.reason instanceof ri)&&e.notify(t.reason,{severityType:"unhandledPromiseRejection",handled:!1})})}function ot(e){try{const t=new RegExp("(^| )".concat(e,"=([^;]+)")).exec(document.cookie);if(t){const n=t[2];try{return decodeURIComponent(n)}catch(r){return n}}return null}catch(t){return null}}const ir={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"},ii={DARK:"apple-pay--dark",LIGHT:"apple-pay--light"},oi=44,si="_shopify_y",vn=6,li="discount_code",gr="https://static-na.payments-amazon.com",fr="".concat(gr,"/checkout.js"),Rn="https://www.paypal.com",Nn="https://pay.google.com",Ye={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"},Et="VALIDATION_CUSTOM",Tn="portable-wallets",Pe={BUTTON:"accelerated-checkout-button",CONTAINER:"accelerated-checkout-button-container"},Ln="unknown",kn={name:"buy_it_now",wallet_params:{}};function On(e){try{return!e.toString().includes("[native code]")}catch(t){return!0}}const Yt=new Map,ci={checkDuplicate({errorClass:e,message:t}){if(Yt.has(e)){const n=Yt.get(e);if(n.has(t))return!0;n.add(t)}else Yt.set(e,new Set([t]));return!1},reset(){}},pt="DeveloperError";class br extends Error{constructor({code:t,message:n}){const r="An unexpected error happened likely because of customizations made to HTML/JavaScript on this site ".concat(n);super("[".concat(t,"]: ").concat(r)),c(this,"name",pt),c(this,"code","unknown"),this.code=t}}const xn="SilencedError";class Tt extends Error{constructor(){super(...arguments),c(this,"name",xn)}}class di extends Error{constructor(){super(...arguments),c(this,"name","MissingConfigError")}}class ae extends Error{constructor(t="No response"){super(t),this.name="NoResponseError"}}class wr extends Error{constructor(t,{errorDetails:n,bugsnagGroupingHash:r}){super(t),c(this,"errorDetails"),c(this,"bugsnagGroupingHash"),this.name="GraphQLResponseError",this.errorDetails=n,this.bugsnagGroupingHash=r}}const Mn="IgnoredGraphQLResponseError";class Fn extends wr{constructor(t,{reason:n,errorDetails:r}){super(t,{errorDetails:r}),c(this,"reason"),this.name=Mn,this.reason=n}}function v(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var ui=0;function ue(e){return"__private_"+ui+++"_"+e}function Lt(e){return Object.entries(e).map(([t,n])=>({key:t,value:{stringValue:String(n)}}))}function hi(e){return Object.entries(e).map(([t,n])=>({key:t,value:Un(n)}))}function Un(e){if(Array.isArray(e))return{arrayValue:{values:e.map(t=>Un(t))}};switch(typeof e){case"boolean":return{boolValue:!!e};case"number":return{doubleValue:Number(e)};case"string":default:return{stringValue:String(e)}}}const _r=1,pi=mi(5,2,12);function mi(e,t,n){const r=[0];for(let a=0;a<n;a++){const i=Math.floor(e*t**a);r.push(i)}return r}var ye=ue("exporter"),Q=ue("attributes"),z=ue("metrics"),ge=ue("logs");class yi{constructor({exporter:t,attributes:n}){Object.defineProperty(this,ye,{writable:!0,value:void 0}),Object.defineProperty(this,Q,{writable:!0,value:void 0}),Object.defineProperty(this,z,{writable:!0,value:[]}),Object.defineProperty(this,ge,{writable:!0,value:[]}),v(this,ye)[ye]=t,v(this,Q)[Q]=n!=null?n:{}}addAttributes(t){v(this,Q)[Q]=b(b({},v(this,Q)[Q]),t)}histogram({name:t,value:n,unit:r,bounds:a,attributes:i,scale:o}){const s=Date.now()*1e6;a?v(this,z)[z].push({name:t,type:"histogram",value:n,unit:r,timeUnixNano:s,attributes:i,bounds:a}):v(this,z)[z].push({name:t,type:"exponential_histogram",value:n,unit:r,timeUnixNano:s,attributes:i,scale:o})}counter({name:t,value:n,unit:r,attributes:a}){const i=Date.now()*1e6;v(this,z)[z].push({name:t,type:"counter",value:n,unit:r,timeUnixNano:i,attributes:a})}gauge({name:t,value:n,unit:r,attributes:a}){const i=Date.now()*1e6;v(this,z)[z].push({name:t,type:"gauge",value:n,unit:r,timeUnixNano:i,attributes:a})}log({body:t,attributes:n}){const r=Date.now()*1e6;v(this,ge)[ge].push({timeUnixNano:r,body:t,attributes:n})}async exportMetrics(){const t={};v(this,z)[z].forEach(r=>{switch(r.attributes=b(b({},v(this,Q)[Q]),r.attributes),r.type){case"histogram":gi(t,r);break;case"exponential_histogram":fi(t,r);break;case"counter":bi(t,r);break;case"gauge":wi(t,r);break}});const n=Object.values(t);n.length!==0&&(v(this,z)[z]=[],await v(this,ye)[ye].exportMetrics(n))}async exportLogs(){const t=v(this,ge)[ge].map(n=>{const r={timeUnixNano:n.timeUnixNano,observedTimeUnixNano:n.timeUnixNano,attributes:hi(b(b({},v(this,Q)[Q]),n.attributes))};return n.body&&(r.body={stringValue:n.body}),r});t.length!==0&&(v(this,ge)[ge]=[],await v(this,ye)[ye].exportLogs(t))}}function gi(e,t){var n;const{name:r,value:a,unit:i,timeUnixNano:o,attributes:s}=t,l=(n=t.bounds)!==null&&n!==void 0?n:pi,u=new Array(l.length+1).fill(0);e[r]||(e[r]={name:r,unit:i||"1",histogram:{aggregationTemporality:_r,dataPoints:[]}});for(let d=0;d<u.length;d++){const h=l[d];if(h===void 0)u[d]=1;else if(a<=h){u[d]=1;break}}e[r].histogram.dataPoints.push({startTimeUnixNano:o,timeUnixNano:o,count:1,sum:a,min:a,max:a,bucketCounts:u,explicitBounds:l,attributes:Lt(s!=null?s:{})})}function fi(e,t){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o,scale:s}=t;e[n]||(e[n]={name:n,unit:a||"1",exponentialHistogram:{aggregationTemporality:_r,dataPoints:[]}});const l=r<=0?0:r,u=s||3,d=2**u/Math.log(2),h=Math.ceil(Math.log(r)*d)-1,p=r<=0?1:0,y={offset:0,bucketCounts:[]},E={offset:r>0?h:0,bucketCounts:r>0?[1]:[]};e[n].exponentialHistogram.dataPoints.push({attributes:Lt(o!=null?o:{}),startTimeUnixNano:i,timeUnixNano:i,count:1,sum:l,scale:u,zeroCount:p,positive:E,negative:y,min:l,max:l,zeroThreshold:0})}function bi(e,t){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o}=t;e[n]||(e[n]={name:n,unit:a||"1",sum:{aggregationTemporality:_r,isMonotonic:!0,dataPoints:[]}}),e[n].sum.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:r,attributes:Lt(o!=null?o:{})})}function wi(e,t){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o}=t;e[n]||(e[n]={name:n,unit:a||"1",gauge:{dataPoints:[]}}),e[n].gauge.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:r,attributes:Lt(o!=null?o:{})})}var We=ue("url"),fe=ue("serviceName"),Ke=ue("logger"),Qe=ue("fetchFn");class _i{constructor(t,n,r){Object.defineProperty(this,We,{writable:!0,value:void 0}),Object.defineProperty(this,fe,{writable:!0,value:void 0}),Object.defineProperty(this,Ke,{writable:!0,value:void 0}),Object.defineProperty(this,Qe,{writable:!0,value:void 0}),v(this,We)[We]=t.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),v(this,fe)[fe]=n,v(this,Ke)[Ke]=r==null?void 0:r.logger,v(this,Qe)[Qe]=r==null?void 0:r.fetchFn}async exportMetrics(t){const n={resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:v(this,fe)[fe]}}]},scopeMetrics:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},metrics:t}]}]};await this.exportTo(n,"/v1/metrics")}async exportLogs(t){const n={resourceLogs:[{resource:{attributes:[{key:"service.name",value:{stringValue:v(this,fe)[fe]}}]},scopeLogs:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},logRecords:t}]}]};await this.exportTo(n,"/v1/logs")}async exportTo(t,n){var r;const a=await this.exporterFetch()("".concat(v(this,We)[We]).concat(n),{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if((r=v(this,Ke)[Ke])===null||r===void 0||r.log({status:a.status}),!a.ok){if(a.status===400){const i=await a.text();throw new rt("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 rt("Server did not accept data",{errorData:i,retryAfter:s,body:t})}throw new rt("Server responded with ".concat(a.status))}}exporterFetch(){return v(this,Qe)[Qe]||fetch}}class rt extends Error{constructor(t,n){super(t),this.metadata=void 0,this.name="OpenTelemetryClientError",this.metadata=n}}const Ei="https://otlp-http-production.shopifysvc.com",Ai="portable_wallets";var Me;class Ci{constructor(t){x(this,Me),k(this,Me,t)}async exportMetrics(t){var n;try{await C(this,Me).exportMetrics(t)}catch(r){if(r instanceof rt){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(i=>{setTimeout(()=>{this.exportMetrics(t),i()},a.seconds*1e3)});return}}throw new Gr("Unable to export metrics",{cause:r})}}async exportLogs(t){var n;try{await C(this,Me).exportLogs(t)}catch(r){if(r instanceof rt){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(i=>{setTimeout(()=>{this.exportLogs(t),i()},a.seconds*1e3)});return}}throw new Gr("Unable to export logs",{cause:r})}}}Me=new WeakMap;const Si=new _i(Ei,Ai),Ii=new Ci(Si),P=new yi({exporter:Ii}),$n="TelemetryExportError";class Gr extends Error{constructor(){super(...arguments),c(this,"name",$n)}}const Bn=["OpenTelemetryClientError",xn,$n,Mn,pt],Pi=["Load failed","Failed to fetch","when attempting to fetch resource","GraphQL mutation failed with status 404","Component closed",...Bn],Vr=new Map([["TypeError","Illegal constructor"],["BugsnagInvalidError",'"isTrusted":true']]),Di=["Chrome-Lighthouse"];function vi(e){const t=e.exceptions[0];return Ri()?"silenced-user-agent":Ni(e)?"empty-stack-trace":Ti(t)?"spin":Li()?"monkey-patch":xi(e)?"external-error":Fi(e)?"developer-error":Mi(t.message)?"discarded-message":Ui(e)?"discarded-error-class":$i(t)?"discarded-class-message":Bi(e)?"unactionable-invalid-error":ki(e)||null}function Ri(){return Di.some(e=>navigator.userAgent.includes(e))}function Ni(e){return e.exceptions[0].stacktrace.length===0}function Ti(e){return e.stacktrace.some(t=>{var n;return(n=t.file)==null?void 0:n.includes("spin.dev")})}function Li(){return[HTMLElement,Event,document.createElement].some(On)}function ki(e){const t=e.exceptions.map(n=>n.stacktrace.filter(r=>!Oi(r)));return t.some(n=>{var r;return!((r=n[0])!=null&&r.inProject)})?"external-trigger":t.some(n=>n.every(r=>[Rn,gr,Nn].some(a=>r.file.startsWith(a))))?"wallet-sdk-stack-trace":null}function Oi(e){return e.file.includes("native code")||e.file.includes("/cdn/wpm/")}function xi(e){return!e.exceptions[0].stacktrace.some(t=>t.inProject)}function Mi(e){return Pi.some(t=>e==null?void 0:e.includes(t))}function Fi(e){const t=e.exceptions.some(n=>n.errorClass===pt);return t&&console.error(e.exceptions[0]),t}function Ui(e){return e.exceptions.some(t=>Bn.includes(t.errorClass))}function $i(e){const t=e.errorClass,n=e.message;return Vr.has(t)&&(n==null?void 0:n.includes(Vr.get(t)))}function Bi(e){return e.exceptions[0].errorClass==="BugsnagInvalidError"&&e.unhandled}var R=(e=>(e.ButtonRender="portable_wallets_button_render",e.Decelerated="portable_wallets_decelerated",e.InitCompleted="portable_wallets_init_completed",e.InstrumentLoadEligibility="portable_wallets_instrument_load_eligibility",e.InstrumentLoadTime="portable_wallets_instrument_load_time",e.InstrumentLoadTimeFromPageLoad="portable_wallets_instrument_load_time_from_page_load",e.MonorailProduceError="portable_wallets_monorail_produce_error",e.SheetClicked="portable_wallets_sheet_clicked",e.SheetCancelled="portable_wallets_sheet_cancelled",e.SheetFailed="portable_wallets_sheet_failed",e.UpdateFailed="portable_wallets_update_failed",e.AuthorizationAttempt="portable_wallets_authorization_attempt",e.AuthorizationComplete="portable_wallets_authorization_complete",e.CartTokenMissing="portable_wallets_cart_token_missing",e.RemovePersonalDataResult="portable_wallets_cart_remove_personal_data_result",e.GooglePayNotEligibleWebview="portable_wallets_google_pay_not_eligible_webview",e.WalletConfigDeveloperError="portable_wallets_wallet_config_developer_error",e.LegacyCartCookie="portable_wallets_legacy_cart_cookie",e.StyleBackwardsCompatibility="portable_wallets_style_backwards_compatibility",e.AmazonPayLoadRetries="portable_wallets_amazon_pay_sdk_load_retries",e.DynamicTaxFailed="portable_wallets_dynamic_tax_failed",e.DynamicShippingFailed="portable_wallets_dynamic_shipping_failed",e.SheetLoaded="portable_wallets_sheet_loaded",e.ErrorTriggered="portable_wallets_error_triggered",e))(R||{}),Ce=(e=>(e.InstrumentSdkLoaded="portable_wallets_instrument_sdk_loaded",e.InstrumentSdkFailed="portable_wallets_instrument_sdk_failed",e.InstrumentSdkEligible="portable_wallets_instrument_sdk_eligible",e.InstrumentSdkNotEligible="portable_wallets_instrument_sdk_not_eligible",e))(Ce||{}),w=(e=>(e.BuyItNow="BuyItNow",e.MoreOptions="MoreOptions",e.ApplePay="ApplePay",e.PayPal="PayPal",e.Venmo="Venmo",e.GooglePay="GooglePay",e.ShopPay="ShopPay",e.MetaPay="FacebookPay",e.BuyWithPrime="BuyWithPrime",e.AmazonPay="AmazonPay",e.Unknown="Unknown",e))(w||{}),S=(e=>(e.CartPage="cart_page",e.CartAjax="cart_ajax",e.ProductPage="product",e.Checkout="checkout",e.Unknown="unknown",e))(S||{}),Je=(e=>(e.CartChange="/cart/change",e.CartUpdate="/cart/update",e.CartAdd="/cart/add",e.CartClear="/cart/clear",e))(Je||{}),Ie=(e=>(e.OneTimePurchase="ONE_TIME_PURCHASE",e.Subscription="SUBSCRIPTION",e))(Ie||{});let kt=Hi();function Hi(){return{shopId:Ln,debug:!1,pageType:S.Unknown}}function Gi(e){Object.assign(kt,e)}function Er(){const e=kt,{debug:t}=e;return jt(e,["debug"])}function Vi(){return kt.debug}function Hn(){return kt.pageType}function zi(e,t){const n=e.exceptions[0];if(!n||!n.message||ci.checkDuplicate(n))return!1;const r=Yi(t);qi(e,r);let a=null;try{a=vi(e)}catch(i){const o=i;console.error(o);const s={errorClass:"UnfilterableError",message:"Could not properly filter error with message: ".concat(o.message),stacktrace:Pn(Tn,o)};e.exceptions.unshift(s)}return Ki(a),Vi()&&Qi({errorClass:n.errorClass,message:n.message,stacktrace:JSON.stringify(n.stacktrace),filterResult:a,metadata:JSON.stringify(e.metaData)}),a==null}function qi(e,t){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;e.context=window.location.pathname,e.request||(e.request={}),e.request.url=window.location.href,e.device.orientation=(o=(i=window.screen)==null?void 0:i.orientation)==null?void 0:o.type,Wi(e),e.groupingHash=ji(t),e.metaData=T(b({},e.metaData),{shop:b(b({},Er()),e.metaData.shop),custom:T(b({},e.metaData.custom),{customFetch:On(fetch)}),monorail:s}),t[0]instanceof wr&&(e.metaData.graphql=b({},t[0].errorDetails),t[0]instanceof Fn&&(e.metaData.graphql.reason=t[0].reason))}function ji(e){for(const t of e)if("bugsnagGroupingHash"in t&&t.bugsnagGroupingHash)return t.bugsnagGroupingHash.toString()}function Yi(e){const t=[];let n=e;for(;n instanceof Error&&t.length<20;){t.push(n);const r="cause"in n?n.cause:null;if(!r)break;n=r}return t}function Wi(e){for(const t of e.exceptions)for(const n of t.stacktrace)[Rn,gr,Nn].some(r=>n.file.startsWith(r))&&(n.inProject=!0)}function Ki(e){P.counter({name:R.ErrorTriggered,value:1,attributes:{filterResult:e||"valid-error"}})}function Qi(e){P.log({body:"Bugsnag Error",attributes:b(b({},Er()),e)})}var En;const Xi={apiKey:"cb577dc231be1c7494db8a63441ef66b",appId:Tn,appVersion:"0.0.0-1282c582071d2c7b35b8ff9517a714894db32086",releaseStage:"production",locale:"es",userAgent:navigator.userAgent,metadata:{user:{id:(En=ot(si))!=null?En:"unknown"}},onError:zi},_=new ti(Xi);_.addOnPostError(e=>{_.leaveBreadcrumb("Bugsnag Error Notified",{errorClass:e.exceptions[0].errorClass,message:e.exceptions[0].message},"error")});var Gn={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."},product:{out_of_stock:"Este art\xEDculo ya no est\xE1 disponible."}},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}"}}};Gn.es;let Wt;class zr extends Error{constructor(t,n){const r="i18n: Missing or invalid translation '".concat(t,"' in '").concat(n,"'");super(r)}}class Ji extends Error{constructor(t,n,r){const a="i18n: Missing translation template key '".concat(t,"' for '").concat(n,"' in '").concat(r,"'");super(a)}}class Zi extends Error{constructor(t,n,r){const a="i18n: Invalid pluralization for '".concat(t,"':'").concat(n,"' in '").concat(r,"'");super(a)}}function Ot(){return Wt==null&&(Wt=eo(Gn)),Wt}function eo(e){const t=(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,u)=>{const d=u.replace(/%\{(.*)\}/,"$1");return o[d]?l.replace(u,o[d]):(_.notify(new Ji(d,i,a)),l)},i):i},a=to();return{locale:a,translate(i,o={}){var s;const l=i.split(".");let u=e[a];try{for(const d of l)switch(typeof u){case"object":u=u[d];break;case"string":case"undefined":throw new zr(i,a)}if(t(u,o)){if(typeof u=="string")throw new Zi(i,u,a);u=u[n(u,o.count)]}if(typeof u!="string")throw new zr(i,a);return r(u,o)}catch(d){return _.notify(d),(s=o.defaultValue)!=null?s:i}}}}function to(){return"es"}function ro(e){const t=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;r<t.length;r++)t[r].remove();n&&n.remove()}function Vn(e){!(e instanceof ErrorEvent)||!(typeof e.message=="string"&&e.message.includes("import.meta"))||!(typeof e.filename=="string"&&e.filename.includes("portable-wallets"))||(window.removeEventListener("error",Vn),window.Shopify.PaymentButton.failedToLoad=e,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",window.Shopify.PaymentButton.init):window.Shopify.PaymentButton.init())}window.addEventListener("error",Vn);function no(e,t,n){return(t=io(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function jr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qr(Object(n),!0).forEach(function(r){no(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ao(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function io(e){var t=ao(e,"string");return typeof t=="symbol"?t:t+""}const oo="https://monorail-edge.shopifysvc.com",so="/v1/produce";function lo(){if(typeof crypto<"u"&&crypto&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=new Array(36);for(let t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",e.map(t=>t.toString(16)).join("")}function co(e){const t={"Content-Type":"application/json; charset=utf-8","X-Monorail-Edge-Event-Created-At-Ms":(e&&e.eventCreatedAtMs||Date.now()).toString(),"X-Monorail-Edge-Event-Sent-At-Ms":Date.now().toString(),"X-Monorail-Edge-Client-Message-Id":(e&&e.clientMessageId||lo()).toString()};return e&&e.userAgent&&(t["User-Agent"]=e.userAgent),e&&e.remoteIp&&(t["X-Forwarded-For"]=e.remoteIp),e&&e.deviceInstallId&&(t["X-Monorail-Edge-Device-Install-Id"]=e.deviceInstallId),e&&e.client&&(t["X-Monorail-Edge-Client"]=e.client),e&&e.clientOs&&(t["X-Monorail-Edge-Client-OS"]=e.clientOs),t}async function uo({endpoint:e,event:t,keepalive:n}){return fetch(e!=null?e:oo+so,{method:"post",headers:co(t.metadata),body:JSON.stringify(jr(jr({schema_id:t.schemaId,payload:t.payload},t.metadata&&{metadata:{client_message_id:t.metadata.clientMessageId,event_created_at_ms:t.metadata.eventCreatedAtMs}}),t.consent&&{consent:t.consent,consent_provider:t.consent_provider,consent_version:t.consent_version})),keepalive:n})}const ho="2.1",po="3",Kt={NO_VALUE:"",ACCEPTED:"1",DECLINED:"0"},K={PREFERENCES:"p",ANALYTICS:"a",MARKETING:"m",SALE_OF_DATA:"t"},ie={MARKETING:"m",ANALYTICS:"a",PREFERENCES:"p",SALE_OF_DATA:"s"},mo=()=>typeof __CtaTestEnv__>"u"?!1:__CtaTestEnv__==="true",yo="_tracking_consent";function zn(e,t=!1){const n=document.cookie?document.cookie.split("; "):[];for(let r=0;r<n.length;r++){const[a,i]=n[r].split("=");if(e===decodeURIComponent(a))return decodeURIComponent(i)}if(t&&e==="_tracking_consent"&&!window.localStorage.getItem("tracking_consent_fetched"))return mo()?void 0:(console.debug("_tracking_consent missing"),go(),window.localStorage.setItem("tracking_consent_fetched","true"),zn(e,!1))}function go(e="/"){const t=new XMLHttpRequest;t.open("HEAD",e,!1),t.withCredentials=!0,t.send()}function fo(){return zn(yo)}const bo="_cs";function wo(){return new URLSearchParams(window.location.search).get(bo)}function _o(){const e=wo()||fo();if(e!==void 0)return Eo(e)}function Eo(e){const t=e.slice(0,1);if(t=="{")return Ao(e);if(t=="3")return Co(e)}function Ao(e){var t;let n;try{n=JSON.parse(e)}catch(r){return}if(n.v===ho&&(t=n.con)!==null&&t!==void 0&&t.CMP)return n}function Co(e){const t=e.slice(1).split("_"),[n,r,a,i,o]=t;let s;try{s=t[5]?JSON.parse(t.slice(5).join("_")):void 0}catch(h){}let l;if(o){const h=o.replace(/\*/g,"/").replace(/-/g,"+"),p=Array.from(atob(h)).map(y=>y.charCodeAt(0).toString(16).padStart(2,"0")).join("");l=[8,13,18,23].reduce((y,E)=>y.slice(0,E)+"-"+y.slice(E),p)}function u(h){const p=n.split(".")[0];return p.includes(h.toLowerCase())?Kt.DECLINED:p.includes(h.toUpperCase())?Kt.ACCEPTED:Kt.NO_VALUE}function d(h){return n.includes(h.replace("t","s").toUpperCase())}return{v:po,con:{CMP:{[ie.ANALYTICS]:u(ie.ANALYTICS),[ie.PREFERENCES]:u(ie.PREFERENCES),[ie.MARKETING]:u(ie.MARKETING),[ie.SALE_OF_DATA]:u(ie.SALE_OF_DATA)}},region:r||"",cus:s,purposes:{[K.ANALYTICS]:d(K.ANALYTICS),[K.PREFERENCES]:d(K.PREFERENCES),[K.MARKETING]:d(K.MARKETING),[K.SALE_OF_DATA]:d(K.SALE_OF_DATA)},sale_of_data_region:i=="t",display_banner:a=="t",consent_id:l}}function xt(e){const t=_o();if(!t||!t.purposes)return!0;const n=t.purposes[e];return typeof n=="boolean"?n:!0}function So(){return xt(K.PREFERENCES)}function Io(){return xt(K.ANALYTICS)}function Po(){return xt(K.MARKETING)}function Do(){return xt(K.SALE_OF_DATA)}function vo(){return Io()}function Ro(){return So()}function No(){return Po()}function To(){return Do()}function Lo(){return No()}function ko(){return vo()}function Oo(){return Ro()}function xo(){return To()}function Mo(){const e=[];return ko()&&e.push("analytics"),Lo()&&e.push("marketing"),xo()&&e.push("sale_of_data"),Oo()&&e.push("preferences"),e}function Fo(e,t){switch(t){case"v1":{const n=Mo();return T(b({},e),{metadata:T(b({},e==null?void 0:e.metadata),{consent:n,consent_provider:"consent-tracking-api",consent_version:t})})}default:throw new Ar(t)}}class Ar extends Error{constructor(t){super("Version ".concat(t," is not supported by the consent-tracking-api provider")),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,Ar.prototype)}}const Uo=["Chrome-Lighthouse"];function $o(){const e=navigator.userAgent;return Uo.some(t=>e.includes(t))}async function Bo(e){if($o())return;const t=Fo(e,"v1");let n;try{n=await uo({event:t})}catch(r){}if(!(n!=null&&n.ok))try{P.counter({name:R.MonorailProduceError,value:1,attributes:{schemaId:t.schemaId}})}catch(r){}}const Qt="shopify_wallet_checkout_track/6.2";async function j(e){var t,n,r,a,i,o,s;const l=await Ho();if(!l)return;const u={schemaId:Qt,payload:{app_name:"storefront",page_type:fs(),checkout_one:!0,event:e.event,event_subtype:e.eventSubtype,checkout_token:e.checkoutToken,instrument_id:e.instrumentId,ttl:e.ttl,error_reason:e.errorReason,uniq_token:(t=l==null?void 0:l.uniqToken)!=null?t:"",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}};_.leaveBreadcrumb("monorail event produced to ".concat(Qt),{schemaId:Qt,payload:e});try{await Bo(u)}catch(d){_.notify(new Go("Failed to send monorail event: ".concat(d),{cause:d}),{metadata:{request:{monorail:{payload:JSON.stringify(u)}}}})}}async function Ho(){var e,t,n,r,a;return(t=(e=window==null?void 0:window.ShopifyAnalytics)==null?void 0:e.lib)!=null&&t.trekkie||await new Promise(i=>{const o=setInterval(()=>{var l,u;(u=(l=window==null?void 0:window.ShopifyAnalytics)==null?void 0:l.lib)!=null&&u.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 Go extends Error{constructor(){super(...arguments),c(this,"name","MonorailError")}}var H=(e=>(e.CartInitCalled="portable_wallets_cart_init_called",e.ClickSheetCancelled="portable_wallets_instrument_click_sheet_cancelled",e.ClickSheetFailed="portable_wallets_instrument_click_sheet_failure",e.ClickSheetSuccess="portable_wallets_instrument_click_sheet_success",e.SheetFailed="portable_wallets_instrument_sheet_failed",e.AuthorizationAttempt="portable_wallets_authorization_attempt",e.AuthorizationComplete="portable_wallets_authorization_complete",e.InitCalled="portable_wallets_init_called",e.InitFailed="portable_wallets_init_failed",e.InitSuccess="portable_wallets_init_success",e.UpdateFailed="portable_wallets_instrument_update_failed",e.InstrumentLoaded="portable_wallets_instrument_loaded",e.InstrumentLoadFailed="portable_wallets_instrument_load_failed",e.FirstVisible="portable_wallets_first_visible",e.FirstVisibleNotAvailable="portable_wallets_first_visible_not_available",e))(H||{});const Yr={[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 Vo({apiClientId:e,skus:t,pageType:n}){var r;if(!((r=window.Shopify)!=null&&r.analytics))return;const a=n&&Yr[n]||"bwp_widget_click";a===Yr[S.Checkout]&&window.Shopify.analytics.publish("shopify:app:pixels:load:".concat(e),{},{sendTo:"PIXEL-LOADER"}),window.Shopify.analytics.publish(a,{skus:t},{sendTo:e})}function U(e){return b({pageType:Hn()},e)}function zo(){const e=Hn()===S.CartPage?H.CartInitCalled:H.InitCalled;j({event:e})}function qo(e){var t,n;const r=e?"Failed":"Success",a=e&&ds(e)?"[".concat(e.name,"]: ").concat(e.code):void 0,i=H["Init".concat(r)];j({event:i,eventSubtype:a}),P.counter({name:R.InitCompleted,value:1,attributes:U({result:r.toLowerCase(),eventType:a,recoveredFailure:!!((n=(t=window.Shopify)==null?void 0:t.PaymentButton)!=null&&n.failedToLoad)})})}function jo({instrumentOrComponentName:e,result:t,measurement:n}){j({event:t==="success"?H.InstrumentLoaded:H.InstrumentLoadFailed,instrumentId:e,ttl:n}),n!=null&&(P.histogram({name:R.InstrumentLoadTime,value:n,attributes:U({instrument:e}),unit:"ms"}),P.histogram({name:R.InstrumentLoadTimeFromPageLoad,value:window.performance.now(),attributes:U({instrument:e}),unit:"ms"}))}function Yo({instrument:e,measurement:t,result:n}){const r=n==="success"?Ce.InstrumentSdkLoaded:Ce.InstrumentSdkFailed;j({event:r,instrumentId:e,ttl:t,errorReason:n==="success"?void 0:n}),t!=null&&P.histogram({name:Ce.InstrumentSdkLoaded,value:t,attributes:U({instrument:e,result:n}),unit:"ms"})}function Wo({instrument:e,result:t,reason:n}){const r=t==="success"?Ce.InstrumentSdkEligible:Ce.InstrumentSdkNotEligible;j({event:r,instrumentId:e}),P.counter({name:Ce.InstrumentSdkEligible,value:1,attributes:U({instrument:e,reason:n,result:t})})}function Ko({instrument:e,result:t,reason:n}){P.counter({name:R.InstrumentLoadEligibility,value:1,attributes:U({instrument:e,result:t,reason:n})})}function Qo(e){P.counter({name:R.ButtonRender,value:1,attributes:U({result:"success",instrument:e})})}function Xo(e){P.counter({name:R.ButtonRender,value:1,attributes:U({result:"failed",instrument:e})})}function Jo({instrument:e,result:t,webPixelMetaData:n}){j({event:t==="success"?H.ClickSheetSuccess:H.ClickSheetFailed,instrumentId:e}),P.counter({name:R.SheetClicked,value:1,attributes:U({instrument:e,result:t})}),e===w.BuyWithPrime&&n&&Vo(n)}function Zo(e,t){j({event:"".concat(H.UpdateFailed,"-").concat(t),instrumentId:e}),P.counter({name:R.UpdateFailed,value:1,attributes:U({instrument:e,request:t})})}function es(e){j({event:H.ClickSheetCancelled,instrumentId:e}),P.counter({name:R.SheetCancelled,value:1,attributes:U({instrument:e})})}function ts(e,t){j({event:H.SheetFailed,instrumentId:e,errorReason:t==null?void 0:t.message}),P.counter({name:R.SheetFailed,value:1,attributes:U({instrument:e})})}function rs(e){j({event:H.AuthorizationAttempt,instrumentId:e}),P.counter({name:R.AuthorizationAttempt,value:1,attributes:U({instrument:e})})}function ns({instrument:e,measurement:t,result:n}){j({event:H.AuthorizationComplete,eventSubtype:n,ttl:t,instrumentId:e}),t!=null&&P.histogram({name:R.AuthorizationComplete,value:t,attributes:U({instrument:e,result:n}),unit:"ms"})}function as({instrument:e,reason:t}){P.counter({name:R.Decelerated,value:1,attributes:U({instrument:e,reason:t})}),g.flushTelemetry()}function is({reason:e}){P.counter({name:R.CartTokenMissing,value:1,attributes:{reason:e}})}function os({success:e}){P.counter({name:R.RemovePersonalDataResult,value:1,attributes:U({success:e})})}function ss(){P.counter({name:R.WalletConfigDeveloperError,value:1})}function ls(){P.counter({name:R.LegacyCartCookie,value:1})}function cs(){window.setInterval(()=>{qn()},1e3)}function ds(e){return(e==null?void 0:e.name)===pt}function qn(){P.exportMetrics(),P.exportLogs()}function us(e){const{body:t,attributes:n}=e;P.log({body:t,attributes:b(b({},Er()),n)})}function hs(){P.counter({name:R.StyleBackwardsCompatibility,value:1})}function ps({retries:e}){P.counter({name:R.AmazonPayLoadRetries,value:1,attributes:{retries:e}})}function ms({instrument:e}){P.counter({name:R.DynamicTaxFailed,value:1,attributes:{instrument:e}}),g.log({body:"Dynamic tax failed",attributes:{instrument:e}})}function ys({instrument:e}){P.counter({name:R.DynamicShippingFailed,value:1,attributes:{instrument:e}}),g.log({body:"Dynamic shipping failed",attributes:{instrument:e}})}function gs({instrument:e,measurement:t}){P.histogram({name:R.SheetLoaded,value:t,attributes:U({instrument:e}),unit:"ms"})}const g={initStarted:D(zo),initCompleted:D(qo),instrumentLoaded:D(jo),instrumentLoadEligibility:D(Ko),instrumentSDKLoaded:D(Yo),instrumentSDKEligible:D(Wo),renderSucceeded:D(Qo),renderFailed:D(Xo),sheetClicked:D(Jo),sheetCancelled:D(es),sheetFailed:D(ts),updateFailed:D(Zo),authorizationAttempt:D(rs),authorizationComplete:D(ns),startExporter:D(cs),decelerated:D(as),cartTokenMissing:D(is),removePersonalDataResult:D(os),walletConfigDeveloperError:D(ss),legacyCartCookie:D(ls),flushTelemetry:D(qn),styleBackwardsCompatibility:D(hs),amazonPaySDKLoadRetries:D(ps),dynamicTaxFailed:D(ms),dynamicShippingFailed:D(ys),sheetLoaded:D(gs),log:D(us,{logErrors:!1})};function D(e,{logErrors:t=!0}={}){return(...n)=>{try{e(...n)}catch(r){t&&g.log({body:"Error calling telemetry function",attributes:{error:"".concat(r)}})}}}const Ze=[];function he(e,t,n){if(window.customElements!=null)try{const r=t;window.customElements.get(e)||(window.customElements.define(e,r),n!=null&&n.isChildCustomElement&&Ze.push(e))}catch(r){_.notify(r),ro()}}function At(){const e=new URLSearchParams(window.location.search);return function(t){return!!e.get(t)}}function fs(){var e,t,n,r;const a=(e=window.Shopify)==null?void 0:e.CartType;if(a===S.CartAjax)return S.CartAjax;if(a===S.CartPage)return S.CartPage;const i=(r=(n=(t=window.ShopifyAnalytics)==null?void 0:t.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 Se(e){return Number(e).toFixed(2)}function jn(e){if(!(!e||!e.id||!e.id.includes("gid://shopify/Cart/")))return e.id.replace("gid://shopify/Cart/","").split("?")[0]}function oe(){let e;return[new Promise(t=>e=t),e]}const bs={force_shop_pay_product:"direct_checkout_product",force_shop_pay_cart:"direct_checkout_cart"};function de(e,t="no_redirect_for_checkout"){g.flushTelemetry();const n=new URL(e);switch(t){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=bs[t];r&&n.searchParams.set("redirect_source",r);break}}window.location.assign(n.toString())}function Yn(){return!!document.querySelector('[data-source-attribution="shopify.shop-promise-pdp"]')}function et(){return new Date().getTime()}function Cr(e){return e.find(t=>typeof t=="object"&&(t==null?void 0:t.code)===Et)}class ws extends HTMLElement{constructor(){super(),c(this,"overflow"),c(this,"formerFocus"),this.attachShadow({mode:"open"}),this.overflow="",this.formerFocus=document.activeElement}connectedCallback(){const t=Ot();this.render(t);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=Wa,n.appendChild(i),this.overflow=document.body.style.overflow,document.body.style.overflow="hidden",this.trapFocus(r,n),he("svg-icon",Ya)}trapFocus(t,n){if(!t)return;const r=t.querySelectorAll("a[href], button"),a=Array.from(r),i=a[0],o=a[a.length-1];t.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(t,n){n&&(n.contains(t.target)||this.closeModal())}handleEscapeKey(t){t.key==="Escape"&&this.closeModal()}closeModal(){var t;document.body.style.overflow=this.overflow,this.remove(),this.formerFocus&&"focus"in(this==null?void 0:this.formerFocus)&&typeof this.formerFocus.focus=="function"&&((t=this.formerFocus)==null||t.focus())}render(t){const n=this.getAttribute("title"),r=this.getAttribute("has-close-button"),a=t.translate("error_dialogs.checkout.button_text"),i='\n <footer>\n <button type="button" id="close-button" tabindex="0">'.concat(a,"</button>\n </footer>\n ");this.shadowRoot.innerHTML='\n <div id="overlay">\n <div id="modal" role="dialog" aria-modal="true" aria-labelledby="title">\n <header>\n <h2 id="title">\n <span class="capitalize">'.concat(n,'</span>\n </h2>\n <button type="button" id="close-icon" aria-label=').concat(a,' tabindex="0">\n <svg-icon color="gray"></svg-icon>\n </button>\n </header>\n <div id="content">\n <p><slot></slot></p>\n </div>\n ').concat(r?i:"","\n </div>\n </div>\n ")}}const _s="@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 Mt({type:e="button",label:t=void 0}={}){const n=document.createElement("button");return n.type=e,t&&n.setAttribute("aria-label",t),n}function Ft(e,t){for(const[n,r]of Object.entries(t))e.setAttribute(n,r)}function Wr(e,t){for(const[n,r]of Object.entries(t))e.style.setProperty(n,r)}function De(e,t){const n=document.createElement("top-level-modal");n.textContent=t,Ft(n,{"data-testid":"top-level-modal","has-close-button":"true",title:e}),document.body.appendChild(n)}function Sr(e,t,n){const r=document.createElement("top-level-modal");Ft(r,{"data-testid":"top-level-modal",title:e}),t instanceof Promise?(r.innerHTML="\n <style>".concat(_s,'</style>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n '),t.then(a=>{a&&a!==""?r.innerHTML=a:r.innerHTML=n!=null?n:""}).catch(()=>{r.innerHTML=n!=null?n:""})):r.innerHTML=t,document.body.appendChild(r)}function J(e,t){De(t.translate("error_dialogs.wallet.title",{wallet:e}),t.translate("error_dialogs.wallet.generic_error",{wallet:e}))}function ve(e,t){De(e.translate("error_dialogs.checkout.title"),t)}he("top-level-modal",ws);class Ut extends HTMLElement{get buyerCountry(){return this.getAttribute("buyer-country")}get recommendedInstrument(){return this.getAttribute("recommended-instrument")}get buyerCurrency(){const t=this.getAttribute("buyer-currency");if(t==null)throw new Error("WalletElement buyer-currency is null");return t}get accessToken(){return this.getAttribute("access-token")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get hasSellingPlan(){const t=this.getAttribute("has-selling-plan");return t==="true"||t===""}set hasSellingPlan(t){t?this.setAttribute("has-selling-plan",""):this.removeAttribute("has-selling-plan")}get isShippingRequired(){const t=this.getAttribute("requires-shipping");return t==="true"||t===""}set isShippingRequired(t){t?this.setAttribute("requires-shipping",""):this.removeAttribute("requires-shipping")}get pciEnabled(){return this.hasAttribute("pci-enabled")}}const Es="#more-payment-options-link{cursor:pointer}";function As(e){const t=n=>{n.persisted&&(e(),window.removeEventListener("pageshow",t))};window.addEventListener("pageshow",t)}var m=(e=>(e.InvalidLanguage="Variable $language of type LanguageCode was provided invalid value",e.InvalidCountry="Variable $country of type CountryCode was provided invalid value",e.MissingCartId="Variable $cartId of type ID! was provided invalid value",e.BuyerIdentityInvalidCountry="Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode",e.BuyerIdentityInvalidPhone="INVALID: buyerIdentity.phone",e.BuyerIdentityEmailRequired="BUYER_IDENTITY_EMAIL_REQUIRED",e.BuyerIdentityEmailDomainInvalid="BUYER_IDENTITY_EMAIL_DOMAIN_IS_INVALID",e.BuyerIdentityEmailNotExpectedPattern="BUYER_IDENTITY_EMAIL_DOES_NOT_MATCH_EXPECTED_PATTERN",e.BuyerIdentityEmailInvalid="INVALID: buyerIdentity.email",e.CaptchaCompletionRequired="CAPTCHA_COMPLETION_REQUIRED",e.CustomValidation="".concat(Et),e.DeliveryFirstNameInvalid="DELIVERY_FIRST_NAME_INVALID",e.DeliveryFirstNameRequired="DELIVERY_FIRST_NAME_REQUIRED",e.BuyerIdentityDeliveryFirstNameRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",e.DeliveryFirstNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",e.DeliveryFirstNameTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",e.DeliveryFirstNameContainsUrl="ADDRESS_FIELD_CONTAINS_URL: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",e.DeliveryFirstNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",e.DeliveryFirstNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",e.DeliveryLastNameInvalid="DELIVERY_LAST_NAME_INVALID",e.DeliveryLastNameRequired="DELIVERY_LAST_NAME_REQUIRED",e.BuyerIdentityDeliveryLastNameRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",e.DeliveryLastNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",e.DeliveryLastNameTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",e.DeliveryLastNameContainsUrl="ADDRESS_FIELD_CONTAINS_URL: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",e.DeliveryLastNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",e.DeliveryLastNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",e.BuyerIdentityDeliveryAddress1Required="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",e.DeliveryAddress1Required="DELIVERY_ADDRESS1_REQUIRED",e.DeliveryAddress1Invalid="DELIVERY_ADDRESS1_INVALID",e.DeliveryAddress1TooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",e.DeliveryAddress1ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",e.DeliveryAddress1ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",e.DeliveryAddress2Required="DELIVERY_ADDRESS2_REQUIRED",e.DeliveryAddress2AddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",e.DeliveryAddress2Invalid="DELIVERY_ADDRESS2_INVALID",e.DeliveryAddress2TooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",e.DeliveryAddress2ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",e.DeliveryAddress2ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",e.DeliveryCityRequired="DELIVERY_CITY_REQUIRED",e.DeliveryCityAddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",e.DeliveryCityInvalid="DELIVERY_CITY_INVALID",e.DeliveryCityTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",e.DeliveryCityContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",e.DeliveryCityContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",e.DeliveryZoneNotFound="DELIVERY_ZONE_NOT_FOUND",e.DeliveryZoneRequiredForCountry="DELIVERY_ZONE_REQUIRED_FOR_COUNTRY",e.DeliveryProvinceRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.province",e.DeliveryPostalCodeInvalid="DELIVERY_POSTAL_CODE_INVALID",e.DeliveryInvalidPostalCodeForZone="DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE",e.DeliveryInvalidPostalCodeForCountry="DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY",e.DeliveryPostalCodeRequired="DELIVERY_POSTAL_CODE_REQUIRED",e.DeliveryPostalCodeAddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",e.DeliveryZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE",e.BuyerIdentityDeliveryZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",e.DeliveryZipInvalidForCountry="INVALID_ZIP_CODE_FOR_COUNTRY: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",e.DeliveryPostalCodeContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",e.DeliveryCountryRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country",e.DeliveryCountryInvalid="INVALID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country",e.DeliveryPhoneNumberRequired="DELIVERY_PHONE_NUMBER_REQUIRED",e.BuyerIdentityDeliveryPhoneNumberRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone",e.DeliveryOptionsPhoneNumberRequired="DELIVERY_OPTIONS_PHONE_NUMBER_REQUIRED",e.DeliveryPhoneNumberInvalid="DELIVERY_PHONE_NUMBER_INVALID",e.DeliveryPhoneDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone",e.MerchandiseOutOfStock="MERCHANDISE_OUT_OF_STOCK",e.MerchandiseNotEnoughStock="MERCHANDISE_NOT_ENOUGH_STOCK",e.InvalidQuantity="INVALID: input.lines.0.quantity",e.DeliveryOutOfStockAtOrigin="DELIVERY_OUT_OF_STOCK_AT_ORIGIN_LOCATION",e.DeliveryExternalPromiseUnfulfillable="DELIVERY_EXTERNAL_PROMISE_UNFULFILLABLE",e.MerchandiseNotApplicable="MERCHANDISE_NOT_APPLICABLE",e.MerchandiseVariantNotFound="MERCHANDISE_PRODUCT_VARIANT_NOT_FOUND",e.MerchandiseNotFound="MERCHANDISE_NOT_FOUND",e.MerchandiseNotPublished="MERCHANDISE_PRODUCT_NOT_PUBLISHED",e.MerchandiseNotSupportedForB2B="MERCHANDISE_SELLING_PLANS_NOT_SUPPORTED_FOR_B2B",e.MerchandiseBundleRequiresComponents="MERCHANDISE_BUNDLE_REQUIRES_COMPONENTS",e.MerchandiseGiftCardsNotSupported="MERCHANDISE_GIFT_CARDS_COMPONENTS_NOT_SUPPORTED",e.MerchandiseGiftCardGreaterThanZero="MERCHANDISE_GIFT_CARD_PRICE_MUST_BE_GREATER_THAN_ZERO",e.MerchandiseGiftCardCannotExceedLimit="MERCHANDISE_GIFT_CARD_PRICE_MUST_NOT_EXCEED_LIMIT",e.UnacceptablePaymentsAmount="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT",e.DiscountNotApplicable="DISCOUNT_NOT_APPLICABLE",e.DeliveryNotAvailable="DELIVERY_NO_DELIVERY_AVAILABLE",e.DeliveryNoStrategyAvailable="DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE",e.DeliveryNoLocalPickupStrategyAvailable="DELIVERY_LOCAL_PICKUP_NO_DELIVERY_STRATEGY_AVAILABLE",e.DeliveryLineChanged="DELIVERY_DELIVERY_LINE_DETAIL_CHANGED",e.DeliveryLocalPickupLineChanged="DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED",e.DeliveryNoDeliveryAvailableForMerchandise="DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE_FOR_MERCHANDISE_LINE",e.DeliveryFulfillmentConstraintNotSatisfied="DELIVERY_MUST_FULFILL_FROM_CONSTRAINT_NOT_SATISFIED",e.DeliveryFulfillmentLocationConstraint="DELIVERY_MUST_FULFILL_FROM_SAME_LOCATION_CONSTRAINT_NOT_SATISFIED",e.NoDeliveryGroupSelected="NO_DELIVERY_GROUP_SELECTED",e.DeliveryOptionInvalid="INVALID_DELIVERY_OPTION: selectedDeliveryOptions",e.DeliveryGroupInvalid="INVALID_DELIVERY_GROUP: selectedDeliveryOptions",e.DeliveryDetailChanged="DELIVERY_DETAIL_CHANGED",e.PendingDeliveryGroups="PENDING_DELIVERY_GROUPS",e.InvalidPaymentAmount="INVALID_PAYMENT: amount",e.InvalidPaymentPaymentAmount="INVALID_PAYMENT: payment.amount",e.NewTaxMustBeAccepted="TAX_NEW_TAX_MUST_BE_ACCEPTED",e.MerchandiseExpectedPriceMismatch="MERCHANDISE_EXPECTED_PRICE_MISMATCH",e.InvalidPaymentApplePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress",e.InvalidPaymentGooglePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.googlePayWalletContent.billingAddress",e.InvalidPaymentBillingAddress="INVALID_PAYMENT: payment.freePaymentMethod.billingAddress",e.UnsupportedGooglePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.googlePayWalletContent",e.UnsupportedApplePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.applePayWalletContent",e))(m||{});const Cs=["DELIVERY_FIRST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],Ss=["DELIVERY_FIRST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],Is=["DELIVERY_LAST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],Ps=["DELIVERY_LAST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],Ds=["DELIVERY_ADDRESS1_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1"],vs=["DELIVERY_ADDRESS2_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2"],Rs=["DELIVERY_CITY_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city"],Ns=["DELIVERY_POSTAL_CODE_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],Wn=["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"],Ts=["DELIVERY_PHONE_NUMBER_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],Ls=["INVALID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country","Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode"],ks=["DELIVERY_PHONE_NUMBER_INVALID","INVALID: buyerIdentity.phone","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],Kn=["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"],Qn=["INVALID_PAYMENT: amount","INVALID_PAYMENT: payment.amount"],Ir=["TAX_NEW_TAX_MUST_BE_ACCEPTED","PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"],Os=["DELIVERY_DELIVERY_LINE_DETAIL_CHANGED","DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED"],xs=["INVALID_PAYMENT: payment.freePaymentMethod.billingAddress","INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress"],Xn=["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"],Ms={currency_changed:Ye.CURRENCY_CHANGE,captcha_required:Ye.CAPTCHA_REQUIRED,not_enough_stock:Ye.NOT_ENOUGH_STOCK,cart_not_ready:Ye.CART_NOT_READY,dynamic_tax:Ye.DYNAMIC_TAX,cart_throttled:null,out_of_stock:null};function wt({warnings:e,cartStatus:t}){if(t==="CartStatusNotReady")return"cart_not_ready";if(t==="CartThrottled")return"cart_throttled";if(!(!e||e.length===0)){if(e.includes("MERCHANDISE_OUT_OF_STOCK"))return"out_of_stock";if(e.includes("MERCHANDISE_NOT_ENOUGH_STOCK"))return"not_enough_stock"}}function Pr({currentCartTotal:e,initialBuyerCurrency:t}){const n=e.amount;return!(!n||Number(n)===0||t.toUpperCase()===e.currencyCode.toUpperCase())}function F({checkoutUrl:e,instrumentName:t,reason:n}){if(!e)throw new Error("Invalid Checkout URL");const r=new URL(e),a=Ms[n];a&&r.searchParams.set(a,"true"),g.decelerated({instrument:t,reason:n}),de(r.toString())}class Fs extends Error{constructor(t){super("[".concat(t.name,"] ").concat(t.message)),this.stack=t.stack,this.name="HandleCreateCartError"}}async function pe({element:e,instrumentName:t,dataSource:n}){try{const r=await n.getInitialCart(t),{cart:a,errors:i,warnings:o}=r;As(()=>{e&&(e.disabled=!1)});const s=Cr(i);if(!a&&!s)throw new Error("[".concat(t,"] Failed to create cart"));if(a&&!a.id)throw new Error("[".concat(t,"] received invalid cart"));if(a&&!a.checkoutUrl)throw new Error("[".concat(t,"] Created cart with no checkout URL"));const l=i.length===1&&i[0]===m.InvalidQuantity;if(i.length>0&&!(l||s))throw new Error("Failed to create cart: ".concat(JSON.stringify(i)));return{cart:a,warnings:o,customValidationError:s,decelerationReason:wt({warnings:o})}}catch(r){throw new Fs(r)}finally{e.disabled=!1}}class Us extends Ut{constructor(){super(),c(this,"name",w.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]=oe(),[this.dataSource,this.setDataSource]=oe(),[this.classNames,this.setClassNames]=oe()}static get observedAttributes(){return["disabled"]}connectedCallback(){this.anchor||this.render()}attributeChangedCallback(t,n,r){n!==r&&t==="disabled"&&this.anchor&&(r===""?this.anchor.setAttribute("aria-disabled","true"):this.anchor.removeAttribute("aria-disabled"),this.setAccessibilityAttributes())}async handleClick(t){var n,r;if(t.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}=await pe({element:this,instrumentName:w.MoreOptions,dataSource:i});if(l){ve(a,l.message);return}if(o){F({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:w.MoreOptions,reason:o});return}const u=this.recommendedInstrument===w.ShopPay?"skip_shop_pay":"allow_redirect";g.sheetClicked({instrument:w.MoreOptions,result:"success"}),de((r=s==null?void 0:s.checkoutUrl)!=null?r:"",u)}catch(o){g.sheetClicked({instrument:w.MoreOptions,result:"failed"}),_.notify(o),De(a.translate("error_dialogs.checkout.title"),a.translate("error_dialogs.checkout.generic_error"))}}async render(){const t=await this.i18n,n=await this.classNames;this.anchor=document.createElement("a"),this.anchor.textContent=t.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=Es,this.appendChild(r)}setAccessibilityAttributes(){this.anchor&&(this.disabled?(this.anchor.removeAttribute("href"),this.anchor.role="link"):(this.anchor.removeAttribute("role"),this.anchor.href="#"))}}var M=(e=>(e.ButtonDisplay="buttonDisplay",e.LoadInstrument="loadInstrument",e.LoadSdk="loadSDK",e.AuthorizationLatency="authorizationLatency",e.SheetLoad="sheetLoad",e))(M||{});function Jn(){var e,t;return!!((e=window.performance)!=null&&e.mark)&&!!((t=window.performance)!=null&&t.measure)}function $t(e,t){return ze(e,t),()=>Z(e,t)}function ze(e,t){Jn()&&window.performance.mark("".concat(e,"-").concat(t,"-start"))}function Z(e,t){var n,r;if(Jn())try{const a="".concat(e,"-").concat(t,"-start"),i="".concat(e,"-").concat(t,"-end"),o="".concat(e,"-").concat(t,"-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 Dr(e,t,n){if(Ze!=null&&Ze.length){const r=Ze.join(",");e.querySelectorAll(r).forEach(a=>{n===null?a.removeAttribute(t):a.setAttribute(t,n)})}}function $s(e,t){try{const n=JSON.parse(e!=null?e:"[]");if(!(n instanceof Array))throw new Error("[".concat(t,"] invalid walletConfigs found"));return n}catch(n){throw new Error("[".concat(t,"] Error while parsing walletConfigs JSON: ").concat(n))}}function Bs(e,t){try{return e?JSON.parse(e):null}catch(n){throw new Error("[".concat(t,"] Error while parsing walletConfig JSON: ").concat(n))}}function Ct(e,t){var n;const r=t==null?void 0:t.getLoadEligibility(e);return g.instrumentLoadEligibility({instrument:t==null?void 0:t.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 Hs(e,t){return t.filter(n=>Ct(e,n))}async function Zn({walletInstrument:e,instanceNumber:t}){const n=e.getInstrumentName(),r=$t(M.LoadSdk,"".concat(n,":").concat(t));try{await e.loadWalletSDK(),g.instrumentSDKLoaded({instrument:n,measurement:r(),result:"success"})}catch(i){return _.notify(i),g.instrumentSDKLoaded({instrument:n,measurement:r(),result:"failed"}),null}let a;try{a=e.getPartnerSDKEligibility()}catch(i){_.notify(i),a={eligible:!1,reason:"uncaught exception"}}return a.eligible?(g.instrumentSDKEligible({instrument:n,result:"success"}),e):(g.instrumentSDKEligible({instrument:n,reason:a.reason,result:"failed"}),null)}function Ve(e,...t){try{const n=window[e];if(typeof n=="function")return new n(...t)}catch(n){}return null}var Fe;class vr extends Ut{constructor(){super(),c(this,"apiClient"),c(this,"i18n"),c(this,"policy"),c(this,"isFetchingPolicy",!1),c(this,"intersectionObserver",null),x(this,Fe),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 fallbackWallet(){return this.getAttribute("fallback")}get variantParams(){var t;try{return JSON.parse((t=this.getAttribute("variant-params"))!=null?t:"[]")}catch(n){throw new br({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")}triggerLoadedEvent(){document.dispatchEvent(new Event("shopify:payment_button:loaded",{bubbles:!0,cancelable:!0}))}async attributeChangedCallback(t,n,r){n!==r&&Dr(this,t,r)}showBuyerConsent(t,n){var r,a,i;!t||!n||(i=(a=(r=window.Shopify)==null?void 0:r.PaymentButton)==null?void 0:a.showBuyerConsent)==null||i.call(a,o=>this.onClickSubscriptionPolicy(o,t,n))}hideBuyerConsent(){var t,n,r;(r=(n=(t=window.Shopify)==null?void 0:t.PaymentButton)==null?void 0:n.hideBuyerConsent)==null||r.call(n)}clearUI(){this.innerHTML=""}isFlagEnabled(t){return C(this,Fe)==null&&k(this,Fe,this.getEnabledFlags()),C(this,Fe).includes(t)}getEnabledFlags(){const t=this.getAttribute("enabled-flags");if(!t)return[];try{return JSON.parse(t)}catch(n){return console.warn("Invalid enabled-flags attribute value:",t),[]}}async onClickSubscriptionPolicy(t,n,r){if(t.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=>(_.notify(i),r.translate("subscriptions.policy_not_found"))).finally(()=>{this.isFetchingPolicy=!1});this.showPolicy(a,r)}async fetchSubscriptionPolicy(t){const n=await t.fetchSubscriptionPolicy();return this.policy=n,n}showPolicy(t,n){Sr(n.translate("subscriptions.cancellation_policy"),t,n.translate("subscriptions.policy_not_found"))}mountIntersectionObserver(){this.intersectionObserver=Ve("IntersectionObserver",this.handleIntersection),this.intersectionObserver?this.intersectionObserver.observe(this):j({event:H.FirstVisibleNotAvailable})}handleIntersection(t,n){t.some(r=>r.isIntersecting)&&(n.disconnect(),j({event:H.FirstVisible}))}}Fe=new WeakMap;function Rr(e){var t,n;Gi({shopId:(t=e.shopId)!=null?t:Ln,cartId:(n=e.cartId)!=null?n:void 0,debug:e.debug,pageType:e.pageType})}function ea({type:e,form:t}){if(!t)return[];const n=document.querySelectorAll('[name^="'.concat(e,'"][form^="').concat(CSS.escape(t.getAttribute("id")||""),'"]')),r=t.querySelectorAll('[name^="'.concat(e,'"]')),a=[...n,...r],i={};return a.forEach(o=>{const s=Gs(o),l=Vs(o);s&&typeof l<"u"&&l.trim()!==""&&(i[s]=l)}),Object.entries(i!=null?i:{}).map(([o,s])=>({key:o,value:s}))}function Bt({page:e,element:t}){const n=e==="product"?'[data-shopify="payment-button"]':'[data-shopify="dynamic-checkout-cart"]',r=Kr(t,n)||document.querySelector(n);return Kr(r,"form")}const Xe=Element.prototype;function Kr(e,t){if(Xe.matches=Xe.matches||Xe.webkitMatchesSelector||Xe.msMatchesSelector||Xe.mozMatchesSelector,!e||e.matches(t))return e;let n=e;for(;n&&n!==document.body;)if(n=n.parentElement,n&&n.matches(t))return n;return null}function Gs(e){const t=e.getAttribute("name");if(t===null)return null;const n=t.indexOf("["),r=t.lastIndexOf("]");return n===-1||r===-1?null:t.substring(n+1,r)}function Vs(e){if(!(["radio","checkbox"].includes(e.type)&&!e.checked)&&!(e.value===""||typeof e.value>"u"))return e.value}function Nr(e){const t=Bt({page:"product",element:e});return ta(t)}function ta(e){var t;const n=e==null?void 0:e.elements;if(!n)return null;const r=_t(n,"id");if(!r||isNaN(Number(r)))return null;const a=Number((t=_t(n,"quantity"))!=null?t:"1"),i="gid://shopify/ProductVariant/".concat(r),o=_t(n,"selling_plan"),s=o?"gid://shopify/SellingPlan/".concat(o):void 0,l=ea({type:"properties",form:e});return{variantId:r,quantity:a,merchandiseId:i,sellingPlanId:s,lineItemProperties:l}}function zs(e){const t=e==null?void 0:e.elements;return t?!!_t(t,"selling_plan"):!1}function _t(e,t){var n;const r=e.namedItem(t);return r&&"value"in r&&(n=r.value)!=null?n:null}class ra{constructor(t,n){c(this,"addToCartMutationObserver"),c(this,"addToCartForm"),c(this,"addToCartButtons"),this.element=t,this.onFormChanged=n,this.addToCartMutationObserver=null,this.addToCartForm=null,this.addToCartButtons=[]}setupMutationObservers(){if(this.findAndSetAddToCartButtons(),!this.addToCartForm)return;this.syncComponentStateWithForm();const t=new MutationObserver(()=>this.reobserveOnFormChanges());this.addToCartMutationObserver=new MutationObserver(()=>this.syncComponentStateWithForm()),t.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 t=ta(this.addToCartForm),n=!!(this.addToCartButtons.length>0&&this.addToCartButtons.every(r=>r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"));this.onFormChanged({disabled:n||t===null,hasSellingPlan:zs(this.addToCartForm),variantId:t==null?void 0:t.variantId,sellingPlanId:t==null?void 0:t.sellingPlanId})}observeAddToCartButtons(){this.addToCartButtons.forEach(t=>{this.addToCartMutationObserver.observe(t,{attributes:!0})})}reobserveOnFormChanges(){var t;(t=this.addToCartMutationObserver)==null||t.disconnect(),this.findAndSetAddToCartButtons(),this.observeAddToCartButtons(),this.syncComponentStateWithForm()}findAndSetAddToCartButtons(){this.addToCartForm=Bt({page:"product",element:this.element}),this.addToCartForm&&(this.addToCartButtons=[...this.addToCartForm.querySelectorAll("[type=submit]")])}}function qs(e,t,n){try{const r=JSON.parse(e!=null?e:"{}"),a=JSON.parse(t!=null?t:JSON.stringify(kn));if(r===null||Object.keys(r).length===0){if(!(a instanceof Object))throw new Error("[".concat(n,"] Invalid fallback wallet configs JSON"));return{recommendedWallet:null,fallbackWallet:a}}return{recommendedWallet:r,fallbackWallet:a}}catch(r){throw r instanceof SyntaxError?(g.walletConfigDeveloperError(),new br({code:"invalid-recommended-fallback-json",message:"recommended / fallback must be valid JSON"})):new Error("[".concat(n,"] Error while parsing recommended/fallback JSON: ").concat(r))}}const js=".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 )}",Ys='.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}}',Ws=70;class nt{constructor(t,n,r,a){c(this,"red"),c(this,"green"),c(this,"blue"),c(this,"opacity"),this.red=t||0,this.green=n||0,this.blue=r||0,this.opacity=typeof a>"u"?1:a}getLuminance(){const t=this.red&255,n=this.green&255,r=this.blue&255;return t*.2126+n*.7152+r*.0722}isDark(){return this.opacity===0?!1:this.getLuminance()/this.opacity<Ws}blendWith(t,n){this.opacity=1-(1-t.opacity)*(1-n.opacity),this.red=this.blend(t.red,n.red,t,n),this.green=this.blend(t.green,n.green,t,n),this.blue=this.blend(t.blue,n.blue,t,n)}blend(t,n,r,a){return Math.round(t*r.opacity/this.opacity+n*a.opacity*(1-r.opacity)/this.opacity)}}function Ks(e){const t=[...e];let n=new nt(0,0,0,0),r=new nt(255,255,255,1),a=t.shift();for(;a;)n.opacity>0&&a.opacity>0?(r=new nt(0,0,0,0),r.blendWith(a,n)):a.opacity>0?r=a:r=n,n=r,a=t.shift();return r}const or=new nt(255,255,255,1);function Qs(e){const t=[];let n=e;for(;n.parentElement;){n=n.parentElement;const r=window.getComputedStyle(n).backgroundColor,a=Xs(r);if(r&&t.push(a),a.opacity===1)break}try{return Ks(t.reverse())}catch(r){return _.notify(new na("[BackgroundDetection] Failed to blend colors for element ".concat(e.outerHTML),{cause:r})),or}}function Xs(e){if(!e)return or;try{const t=e.split("(")[1].split(")")[0].replace(" ","").split(",");return new nt(Number(t[0]),Number(t[1]),Number(t[2]),typeof t[3]>"u"?1:Number(t[3]))}catch(t){_.notify(new na("[BackgroundDetection] Failed to convert rgbString to array ".concat(e),{cause:t}))}return or}class na extends Error{constructor(){super(...arguments),c(this,"name","ColorProcessingError")}}class Re extends Ut{constructor(){super(),c(this,"name",null),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]=oe(),[this.dataSource,this.setDataSource]=oe(),[this.apiClient,this.setApiClient]=oe(),[this.classNames,this.setClassNames]=oe(),[this.containerInstanceNumber,this.setContainerInstanceNumber]=oe()}async cleanupOnFailure(t,n){var r;try{await t()}catch(a){_.notify(new Js("An error occurred requiring cleanup when attempting to render the ".concat(n," instrument: ").concat(a),{cause:a}));const i=await this.containerInstanceNumber;g.instrumentLoaded({instrumentOrComponentName:n,result:"failed",measurement:Z(M.ButtonDisplay,"".concat(n,":").concat(i))}),(r=this.parentElement)==null||r.remove()}}attributeChangedCallback(t,n,r,a){n!==r&&t==="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 Qs(this).isDark()?"LIGHT":"DARK"}get isCTA(){return this.hasAttribute("call-to-action")}get walletParams(){var t;if(this.parsedWalletParams===void 0)try{this.parsedWalletParams=JSON.parse((t=this.getAttribute("wallet-params"))!=null?t:"{}")}catch(n){throw new Error("Error while parsing wallet-params JSON: ".concat(n))}return this.parsedWalletParams}async initializeShadowStyles(t,n=""){const r=document.createElement("style");r.innerHTML=[Ys,n].join("\n"),t.appendChild(r)}async ensureLightDOMIsNotEmpty(){this.textContent="\xA0"}dispatchWalletEvent({eventName:t,detail:n={}}){var r;(r=this.parentElement)==null||r.dispatchEvent(new CustomEvent(t,{detail:n}))}}class Js extends Error{constructor(){super(...arguments),c(this,"name","CleanupOnFailureError")}}class Zs extends Re{constructor(){super(...arguments),c(this,"name",w.BuyItNow),c(this,"button",null)}static get observedAttributes(){return["disabled"]}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button)}async handleClick(){var t,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}=await pe({element:this,instrumentName:this.name,dataSource:a});if(g.sheetClicked({instrument:this.name,result:"success"}),s){ve(r,s.message);return}if(i){F({checkoutUrl:(t=o==null?void 0:o.checkoutUrl)!=null?t:"",instrumentName:this.name,reason:i});return}de((n=o==null?void 0:o.checkoutUrl)!=null?n:"","allow_redirect")}catch(i){_.notify(i),g.sheetClicked({instrument:this.name,result:"failed"}),De(r.translate("error_dialogs.checkout.title"),r.translate("error_dialogs.checkout.generic_error"))}}async render(){var t;this.button||(this.button=Mt());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),(t=this.onRendered)==null||t.call(this)}}function el(){const e=navigator.userAgent,t=e.indexOf("Android")>-1,n=e.indexOf("Chrome/")>-1,r=parseInt((/Chrome\/([0-9]+)/.exec(e)||["0","0"])[1],10);return t&&n&&r===114}class me{constructor(t){c(this,"walletParams"),this.walletParams=t.wallet_params}static walletName(){throw new Error("Must define walletName for WalletInstrument subclass")}createWebComponent({walletContainer:t,dataSource:n,i18n:r,apiClient:a,containerInstanceNumber:i,classNames:o="",callToAction:s,pageType:l=S.ProductPage,slot:u="button",onRendered:d=()=>{}}){var h,p,y;const E=this.getWebComponentName();he(E,this.getWebComponentClass(),{isChildCustomElement:!0});const f=document.createElement(E),A={"access-token":(h=t.accessToken)!=null?h:"","buyer-country":(p=t.buyerCountry)!=null?p:"","buyer-currency":t.buyerCurrency,"wallet-params":JSON.stringify((y=this.walletParams)!=null?y:{}),"page-type":l,slot:u};try{t.disabled&&f.setAttribute("disabled",""),Ft(f,A),t.isShippingRequired&&f.setAttribute("requires-shipping",""),t.hasSellingPlan&&f.setAttribute("has-selling-plan",""),t.pciEnabled&&f.setAttribute("pci-enabled","")}catch(I){const O=I;throw O.message.includes("setAttribute is not a function")&&el()?new Tt(O.message):O}return s&&f.setAttribute("call-to-action",""),f.setDataSource(n),f.setApiClient(a),f.setI18n(r),f.setClassNames(o),f.setContainerInstanceNumber(i),f.onRendered=d,f}loadWalletSDK(){return Promise.resolve()}getLoadEligibility(t){return{eligible:!0}}getPartnerSDKEligibility(){return{eligible:!0}}}class tl extends me{static walletName(){return"buy_it_now"}getWebComponentName(){return"shopify-buy-it-now-button"}getInstrumentName(){return w.BuyItNow}getWebComponentClass(){return Zs}}const rl="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}",nl="::slotted(div){height:100%}";async function xe(e){const{cartId:t,cartClient:n,instrumentName:r,abortSignal:a}=e;try{if(!t)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(e,a)}catch(i){throw g.updateFailed(r,"updateBuyerIdentity"),i}}async function Tr({cartId:e,totalAmount:t,paymentMethod:n,billingAddress:r,cartClient:a,instrumentName:i,abortSignal:o,hasSellingPlan:s,canUsePaymentMethodForFreeOrder:l}){try{if(!e)throw new Error("[".concat(i,"] provided no cart ID when updating payment"));if(!t)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 u={freePaymentMethod:{billingAddress:r}};return await a.updateCartPayment(e,b({amount:{amount:t.amount,currencyCode:t.currencyCode}},Number(t.amount)<=0&&!l&&!s?u:n),i,o)}catch(u){throw g.updateFailed(i,"updatePayment"),u}}function aa(e){return window[ia(e)]}function ia(e){return"paypal-".concat(e.replace(/[^a-zA-Z0-9]/g,""))}function St(e){if(!e)return null;const t=getComputedStyle(e).borderRadius;return t.includes("px")?parseInt(t,10):null}function It(e){if(!e)return null;const t=getComputedStyle(e).height;return t.includes("px")?parseInt(t,10):null}const Xt=25,Qr=55,al=["cart_not_ready","cart_throttled"];var be;class il extends Re{constructor(){super(),c(this,"name",w.PayPal),c(this,"abortController"),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),x(this,be),k(this,be,this.attachShadow({mode:"closed"})),this.abortController=Ve("AbortController"),this.resizeObserver=Ve("ResizeObserver",()=>this.onResize())}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){this.innerHTML="",C(this,be).innerHTML="",await this.teardownPayPalButton(),this.resizeObserver&&this.resizeObserver.disconnect()}async teardownPayPalButton(){var t;try{await((t=this.sdkButtonsComponent)==null?void 0:t.close().catch(()=>{}))}catch(n){}finally{this.sdkButtonsComponent=void 0}}async onResize(){const t=St(this.container),n=It(this.container),r=t!==null&&this.prevBorderRadius!==t||n!==null&&this.prevHeight!==n;!this.rendering&&r&&(await this.teardownPayPalButton(),this.container.innerHTML="",await this.cleanupOnFailure(()=>this.renderFromPayPalSDK(),this.name))}async render(){var t;const n=document.createElement("div");n.className=Pe.BUTTON;const r=document.createElement("style");r.innerHTML=rl,this.appendChild(r),await this.initializeShadowStyles(C(this,be),nl),C(this,be).appendChild(n),this.container=n,this.renderFromPayPalSDK(),(t=this.resizeObserver)==null||t.observe(this.container)}getHeight(){const t=It(this.container);return t?t>=Xt&&t<=Qr?t:t<Xt?(console.debug("[PayPalButton] Container height is less than the minimum height of the PayPal button. Using the minimum height of 25px."),Xt):(console.debug("[PayPalButton] Container height is greater than the maximum height of the PayPal button. Using the maximum height of 55px."),Qr):oi}async renderFromPayPalSDK(){var t,n,r;if(!this.container)throw new Error("button container not set when attempting to render");this.rendering=!0;const a=()=>this.createToken(this.apiClient);let i,o;this.requiresBillingAgreement()?o=a:i=a;const s=St(this.container),l=this.getHeight();this.prevHeight=l;const u={color:"gold",label:this.isCTA?"pay":"paypal",disableMaxWidth:!0,height:l,shape:"sharp"};s&&s>0&&(u.borderRadius=s,this.prevBorderRadius=s),this.sdkButtonsComponent=(n=(t=aa(this.walletParams.sdkUrl))==null?void 0:t.Buttons)==null?void 0:n.call(t,{fundingSource:"paypal",style:u,createOrder:i,createBillingAgreement:o,onApprove:async d=>{await this.onApprove(d)},onCancel:()=>{var d;g.sheetCancelled(this.name),(d=this.abortController)==null||d.abort()},onClick:this.onClick.bind(this),onError:this.onError.bind(this)}),await((r=this.sdkButtonsComponent)==null?void 0:r.render(this.container)),this.rendering=!1,this.onRendered()}async onClick(t,n){var r,a;if(this.disabled)return n.reject();const i=this.getBoundingClientRect(),o=i.left+i.width/2,s=i.top+i.height/2,l=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,clientX:o,clientY:s,screenX:window.screenX+o,screenY:window.screenY+s});this.dispatchEvent(l);const[u,d]=await Promise.all([this.dataSource,this.i18n]);try{const{decelerationReason:h,cart:p,customValidationError:y}=await pe({element:this,instrumentName:this.name,dataSource:u});if(y)return ve(d,y.message),n.reject();const{hasManagedSellingPlanState:E}=this.walletParams;return E!=null&&E!==this.hasSellingPlan?(de((r=p==null?void 0:p.checkoutUrl)!=null?r:""),n.reject()):h?(F({checkoutUrl:(a=p==null?void 0:p.checkoutUrl)!=null?a:"",instrumentName:this.name,reason:h}),n.reject()):(this.cartId=p.id,n.resolve())}catch(h){return g.sheetClicked({instrument:this.name,result:"failed"}),_.notify(h),De(d.translate("error_dialogs.checkout.title"),d.translate("error_dialogs.checkout.generic_error")),n.reject()}}async createToken(t){const n=await t;try{if(!this.cartId)throw new Error("cartId not found when creating token");const r=await n.paypalTokenCreate(this.cartId);return g.sheetClicked({instrument:this.name,result:"success"}),r}catch(r){throw g.sheetClicked({instrument:this.name,result:"failed"}),r}}async onApprove({orderID:t,payerID:n,billingToken:r}){var a;try{if(g.authorizationAttempt(this.name),ze(M.AuthorizationLatency,this.name),!this.cartId)throw new Error("Cart not found");const i=await this.apiClient,o=this.requiresBillingAgreement()&&r!=null?r:t,{billingAddress:s,destinationAddress:l,expiresAt:u,email:d,remoteOrderId:h}=await i.paypalBuyerDetailsFetch(o,this.cartId),{data:p,decelerationReason:y}=await xe({cartId:this.cartId,cartClient:i,instrumentName:this.name,emailAddress:d,streetAddress:l});if(!p)throw new Error("Cart not found");const{id:E,checkoutUrl:f,totalAmount:A}=p;if(this.shouldDecelerate(y)){F({checkoutUrl:f,instrumentName:this.name,reason:y});return}const{decelerationReason:I}=await Tr({abortSignal:(a=this.abortController)==null?void 0:a.signal,cartClient:i,cartId:E,instrumentName:w.PayPal,billingAddress:s!=null?s:l,paymentMethod:{walletPaymentMethod:{paypalWalletContent:{billingAddress:s!=null?s:l,email:d,expiresAt:u,payerId:n,token:h!=null?h:t,acceptedSubscriptionTerms:!1,vaultingAgreement:!1,merchantId:this.walletParams.merchantId}}},canUsePaymentMethodForFreeOrder:!0,totalAmount:A});if(this.shouldDecelerate(I)){F({checkoutUrl:f,instrumentName:this.name,reason:I});return}if(Pr({currentCartTotal:A,initialBuyerCurrency:this.buyerCurrency})){F({checkoutUrl:f,instrumentName:this.name,reason:"currency_changed"});return}g.authorizationComplete({instrument:this.name,result:"success",measurement:Z(M.AuthorizationLatency,this.name)}),de(f)}catch(i){throw g.authorizationComplete({instrument:this.name,result:"failed",measurement:Z(M.AuthorizationLatency,this.name)}),i}}async onError(t){var n;if(t.message==="Window is closed, can not determine type"){g.sheetCancelled(this.name),(n=this.abortController)==null||n.abort();return}t.message==="RESTRICTED_WALLET_ACCOUNT"?g.log({body:"PayPal modal closed due to error: ".concat(t)}):_.notify(t);const r=await this.i18n,a=r.translate("brand.paypal");J(a,r)}requiresBillingAgreement(){return this.walletParams.hasManagedSellingPlanState||this.walletParams.requiresBillingAgreement}shouldDecelerate(t){return!!(t&&al.includes(t))}}be=new WeakMap;const Te=class kd extends me{static walletName(){return"paypal"}constructor(t){super(t)}getWebComponentName(){return"shopify-paypal-button"}getInstrumentName(){return w.PayPal}getWebComponentClass(){return il}loadWalletSDK(){let t=kd.paypalSDKPromiseByUrl.get(this.walletParams.sdkUrl);if(t)return t;const n=document.createElement("script");return n.setAttribute("src",this.walletParams.sdkUrl),t=new Promise((r,a)=>{n.setAttribute("data-namespace",ia(this.walletParams.sdkUrl)),n.onload=()=>r(),n.onerror=i=>{kd.paypalSDKPromiseByUrl.delete(this.walletParams.sdkUrl),n&&document.body.contains(n)&&document.body.removeChild(n),a(i)},document.body.appendChild(n)}),kd.paypalSDKPromiseByUrl.set(this.walletParams.sdkUrl,t),t}getLoadEligibility(){return{eligible:!0}}getPartnerSDKEligibility(){var t,n;try{return(n=(t=aa(this.walletParams.sdkUrl))==null?void 0:t.Buttons)!=null&&n.call(t).isEligible()?{eligible:!0}:{eligible:!1,reason:"PayPal SDK not eligible"}}catch(r){throw new br({code:"paypal-sdk-eligibility-check-failed",message:"PayPal SDK 'isEligible' method failed unexpectedly: ".concat(r)})}}};c(Te,"paypalSDKPromiseByUrl",new Map);let sr=Te;const ol=".apple-pay-button{display:flex;align-items:center;justify-content:center;width:100%;padding:0!important;cursor:pointer;border:none}.apple-pay-button:hover:not(:disabled){filter:brightness(92%)}.apple-pay-button:disabled{opacity:.5;cursor:not-allowed}.apple-pay-button svg{height:100%;flex-shrink:0}.apple-pay--content{font-size:16px;font-family:San Francisco,sans-serif;width:100%;height:100%;flex-grow:1;display:flex;align-items:center;justify-content:center;white-space:pre}.apple-pay--light{background:#fff;color:#000}.apple-pay--light svg{fill:#000}.apple-pay--dark{background:#000;color:#fff}.apple-pay--dark svg{fill:#fff}",lr={UK:"GB",JA:"JP"},oa=["AS","GU","MP","PR","VI"];oa.forEach(e=>{lr[e]="US"});function gt(e){var t,n;const r=e.countryCode,a={firstName:e.givenName||void 0,lastName:e.familyName||void 0,address1:(t=e==null?void 0:e.addressLines)==null?void 0:t[0],address2:((n=e==null?void 0:e.addressLines)==null?void 0:n[1])||void 0,city:e.locality||void 0,zip:e.postalCode||void 0,province:e.administrativeArea||e.subLocality||void 0,country:sl(e.countryCode),phone:e.phoneNumber||void 0};return a.country==="HK"&&(a.zip=void 0,a.province=e.postalCode),r&&oa.includes(r)&&(a.province=r),a.lastName||(a.lastName=a.firstName),a}function sl(e){if(!e)return"ZZ";const t=e.toUpperCase();return Object.keys(lr).includes(t)?lr[t]:t}function ll(e,t){return e.map(n=>{const{title:r,deliveryPromise:a}=ul(n,t);return{title:r,estimatedCost:{amount:dl(n),currencyCode:n[0].estimatedCost.currencyCode},handle:la(n),deliveryPromise:a}})}function cl(e,t){return e.map(n=>{const{title:r,description:a}=hl(n,t);return{title:r,description:a,handle:la(n)}})}function sa({deliveryGroups:e}){return e.map(t=>t.deliveryOptions.filter(({deliveryMethodType:n})=>n==="SHIPPING").map(n=>T(b({},n),{groupType:t.groupType}))).reduce((t,n)=>t.flatMap(r=>n.map(a=>[...r,a])),[[]])}function dl(e){return e.reduce((t,n)=>t+Number(n.estimatedCost.amount),0).toFixed(2)}function ul(e,t){const n=e.find(l=>l.groupType===Ie.OneTimePurchase),r=e.find(l=>l.groupType===Ie.Subscription),a=[...new Set([n==null?void 0:n.title,r==null?void 0:r.title])].filter(Boolean),i=[...new Set([n==null?void 0:n.deliveryPromise,r==null?void 0:r.deliveryPromise])].filter(Boolean),o=a.length===2?t.translate("shipping_methods.connect_shipping_methods",{methodOne:a[0],methodTwo:a[1]}):a[0],s=i.length===2?t.translate("delivery_promises.connect_delivery_promises",{promiseOne:i[0],promiseTwo:i[1]}):i[0];return{title:o,deliveryPromise:s}}function hl(e,t){const n=e.find(o=>o.groupType===Ie.OneTimePurchase),r=e.find(o=>o.groupType===Ie.Subscription),a=e.map(pl).filter(Boolean).join(", ");let i=(n==null?void 0:n.title)||(r==null?void 0:r.title);return n&&r&&(i=t.translate("shipping_methods.connect_shipping_methods",{methodOne:n.title,methodTwo:r.title})),{title:i,description:a}}function pl(e){const t=Number(e.estimatedCost.amount).toFixed(2),n=e.estimatedCost.currencyCode,r=e.deliveryPromise;return r?"(".concat(r,") ").concat(t," ").concat(n):"".concat(t," ").concat(n)}function la(e){return e.map(t=>t.handle).join(",")}function ca({deliveryGroups:e,i18n:t}){const n=e.some(r=>r.groupType===Ie.Subscription);return e.map(r=>{var a;let i=t.translate("order_summary.shipping");return n&&(i=r.groupType===Ie.Subscription?t.translate("order_summary.shipping_subscription"):t.translate("order_summary.shipping_one_time_purchase")),{label:i,amount:Se(((a=r.selectedDeliveryOption)==null?void 0:a.estimatedCost.amount)||0)}})}function ml(e,t){return tt({label:e,possibleLines:[t]})[0]}function yl({subtotal:e,deliveryGroups:t,duties:n,taxes:r,discountAllocations:a,i18n:i,formattedRecurringTotals:o}){var s;const l=tt({label:i.translate("order_summary.subtotal"),possibleLines:[e]}),u=ca({deliveryGroups:t,i18n:i}),d=tt({label:i.translate("order_summary.duties"),possibleLines:[n]}),h=tt({label:i.translate("order_summary.taxes"),possibleLines:[r]}),p=o.map(f=>({label:f,amount:"0.00",type:"pending"})),y=p.length?[{label:i.translate("order_summary.subscriptions.recurring_total_tooltip_line"),amount:"0.00",type:"pending"}]:[],E=(s=a==null?void 0:a.flatMap(f=>{var A;const I=(A=f.title)!=null?A:f.code;return tt({label:I!=null?I:i.translate("order_summary.discount"),possibleLines:[f.discountedAmount],isDiscount:!0})}))!=null?s:[];return[...l,...u,...d,...h,...E,...p,...y]}function tt({label:e,possibleLines:t,isDiscount:n=!1}){return t.filter(r=>(r==null?void 0:r.amount)!==void 0).map(r=>({label:e,amount:n?"-".concat(Se(r.amount)):Se(r.amount)}))}function gl(e,t){if(!e.length)return[];const n=sa({deliveryGroups:e});return ll(n,t).map(r=>{var a;return{label:r.title||"",amount:r.estimatedCost.amount,identifier:r.handle,detail:(a=r.deliveryPromise)!=null?a:""}})}const Jt=async({paymentSheetAction:e,onProceed:t,terminateSession:n})=>{switch(e.action){case"abort":n();break;case"show_error":await t(e.errors);break;case"update":await t(e.errors);break;default:throw new Error('Missing handler for payment sheet action "'.concat(e.action,'"'))}},fl=["decelerate","abort","show_error","complete","update"];class Pt extends Error{constructor(){super(...arguments),c(this,"name","UnhandledActionError")}}class da{constructor(){c(this,"generatePrioritizedPaymentSheetAction",(t,n)=>{let r;const a=[],i=[],o=[],s=n.filter(u=>u!==m.UnacceptablePaymentsAmount).some(u=>t[u]!==void 0);for(const u of Object.keys(t))if(!(u===m.UnacceptablePaymentsAmount&&s)){const d=t[u]();d.effects&&i.push(...d.effects),d.action!=="complete"&&d.errors&&o.push(...d.errors),a.push(d)}const l=(u=>fl.map(d=>u.find(h=>h.action===d)).find(d=>!!d))(a);return l&&(r=l,r.effects=i,r.action!=="complete"&&(r.errors=o)),r})}getMergedPaymentSheetAction({result:t,errorActions:n}){const r={};n.forEach(i=>{i.errors.forEach(o=>{t.errors.includes(o)&&(r[o]=i.generateAction)})});let a;for(const i of t.errors){const o=r[i];if(o){a=o();break}}return{firstPaymentSheetAction:a,prioritizedPaymentSheetAction:this.generatePrioritizedPaymentSheetAction(r,t.errors)}}getUnhandledErrors(t,n){const r=n.flatMap(a=>a.errors);return t.filter(a=>!r.includes(a))}decelerateOrAbort({reason:t,instrumentName:n,errorOrWarning:r,result:a}){var i,o;return a?((i=a.data)==null?void 0:i.__typename)==="SubmitFailed"?{action:"decelerate",redirectUrl:(o=a.data)==null?void 0:o.checkoutUrl,reason:t}:{action:"abort",effects:[()=>{var s;_.notify(new Error("[".concat(n,"] unexpected ").concat(r," received in ").concat((s=a.data)==null?void 0:s.__typename," response, aborting")))}]}:{action:"abort"}}}class bl extends da{constructor(t){super(),c(this,"completionResult"),this.i18n=t,this.completionResult=null}mapMutationResultToPaymentSheetAction(t,n){var r;const a=this.mapCustomValidationFunctionErrorToAction(t.errors);if(a)return a;const i=this.getErrorActions({shippingCountryCode:n==null?void 0:n.shippingCountryCode}),o=t.errors,s=this.getUnhandledErrors(o,i);if(s.forEach(u=>{_.notify(new Pt("[".concat(w.ApplePay,"] mutation result error not handled: ").concat(u)))}),((r=t.data)==null?void 0:r.deliveryGroups.length)===0&&n!=null&&n.shippingRequired)return{action:"show_error",errors:[new ApplePayError("addressUnserviceable")]};const{firstPaymentSheetAction:l}=this.getMergedPaymentSheetAction({result:t,errorActions:i});return l||(s.length>0?{action:"abort"}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction(t,n){if(!t.data)throw new Error("[".concat(w.ApplePay,"] completion returned null result"));switch(this.completionResult=t,t.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:t.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const r=this.mapCustomValidationFunctionErrorToAction(t.errors);if(r)return r;const a=this.getErrorActions({shippingCountryCode:n==null?void 0:n.shippingCountryCode}),i=t.errors;this.getUnhandledErrors(i,a).forEach(s=>{_.notify(new Error("[".concat(w.ApplePay,"] completion result error not handled: ").concat(s)))});const{prioritizedPaymentSheetAction:o}=this.getMergedPaymentSheetAction({result:t,errorActions:a});return o||{action:"abort"}}default:throw new Error("[".concat(w.ApplePay,"] unknown completion result type: ").concat(t.data.__typename))}}getErrorActions({shippingCountryCode:t}){return[{errors:[m.CaptchaCompletionRequired],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:w.ApplePay,errorOrWarning:m.CaptchaCompletionRequired,result:this.completionResult})},{errors:[m.InvalidLanguage],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(w.ApplePay,"] mutation provided invalid language, aborting")))}]})},{errors:[m.InvalidCountry],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(w.ApplePay,"] mutation provided invalid country, aborting")))}]})},{errors:[m.MissingCartId],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(w.ApplePay,"] mutation provided invalid cart ID, aborting")))}]})},{errors:Ir,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:w.ApplePay,errorOrWarning:m.NewTaxMustBeAccepted,result:this.completionResult})},{errors:Qn,generateAction:()=>({action:"abort"})},{errors:[m.MerchandiseNotEnoughStock],generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:w.ApplePay,errorOrWarning:m.MerchandiseNotEnoughStock,result:this.completionResult})},{errors:Xn,generateAction:()=>this.decelerateOrAbort({reason:"out_of_stock",instrumentName:w.ApplePay,errorOrWarning:m.MerchandiseOutOfStock,result:this.completionResult})},{errors:Kn,generateAction:()=>({action:"show_error",errors:[new ApplePayError("addressUnserviceable")]})},{errors:[m.BuyerIdentityEmailRequired],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.missing.email"))]})},{errors:Cs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))]})},{errors:Ss,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))]})},{errors:Is,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))]})},{errors:Ps,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))]})},{errors:Ds,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))]})},{errors:[m.DeliveryAddress1Invalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))]})},{errors:vs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))]})},{errors:[m.DeliveryAddress2Invalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))]})},{errors:Rs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.missing.city"))]})},{errors:[m.DeliveryCityInvalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))]})},{errors:[m.DeliveryZoneRequiredForCountry],generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"shippingContactInvalid",t)]})},{errors:[m.DeliveryZoneNotFound],generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.invalid.zone"),this.i18n.translate("errors.invalid.emirate"),"shippingContactInvalid",t)]})},{errors:Ns,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))]})},{errors:Wn,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))]})},{errors:[m.DeliveryCountryRequired],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.missing.country"))]})},{errors:Ts,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))]})},{errors:ks,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))]})},{errors:Ls,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.invalid.country"))]})},{errors:xs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid")]})},{errors:[m.UnsupportedApplePayPaymentMethod],generateAction:()=>({action:"abort",effects:[()=>{J(this.i18n.translate("brand.apple_pay"),this.i18n)},()=>{_.notify(new Pt("[".concat(w.ApplePay,"] payment method is not supported")))}]})},{errors:[m.DeliveryLastNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{errors:[m.DeliveryFirstNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{errors:[m.DeliveryAddress1TooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address1"))]})},{errors:[m.DeliveryAddress2TooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address2"))]})},{errors:[m.DeliveryFirstNameTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.first_name"))]})},{errors:[m.DeliveryLastNameTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.last_name"))]})},{errors:[m.DeliveryCityTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.too_long.city"))]})},{errors:[m.DeliveryFirstNameContainsUrl],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.first_name"))]})},{errors:[m.DeliveryLastNameContainsUrl],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.last_name"))]})},{errors:[m.DeliveryAddress1ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{errors:[m.DeliveryAddress2ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{errors:[m.DeliveryCityContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{errors:[m.DeliveryFirstNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{errors:[m.DeliveryLastNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{errors:[m.DeliveryCityContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{errors:[m.DeliveryAddress1ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{errors:[m.DeliveryAddress2ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{errors:[m.DeliveryPostalCodeContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{errors:[m.BuyerIdentityEmailInvalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.invalid.email"))]})},{errors:[m.DiscountNotApplicable],generateAction:()=>({action:"show_error",errors:[new ApplePayError("couponCodeInvalid",void 0,this.i18n.translate("errors.invalid.discount"))]})}]}mapCustomValidationFunctionErrorToAction(t){const n=Cr(t);return n?{action:"abort",effects:[()=>{const r=this.i18n.translate("brand.apple_pay");Sr(this.i18n.translate("error_dialogs.wallet.title",{wallet:r}),n.message)}]}:null}createApplePayZoneError(t,n,r,a){const i=a==="AE"?"subLocality":"administrativeArea";return new ApplePayError(r,i,a==="AE"?n:t)}}const Xr=["name","postalAddress"];function wl({shippingRequired:e,walletParams:t,buyerCurrency:n}){const{phoneRequired:r,emailRequired:a}=t,i=[...a?["email"]:[],...r?["phone"]:[]],o=e?[...Xr,...i]:i;return{countryCode:t.countryCode,currencyCode:n,merchantCapabilities:t.merchantCapabilities,supportedNetworks:t.supportedNetworks,total:{type:"pending",label:t.merchantName,amount:"1.00"},requiredBillingContactFields:Xr,requiredShippingContactFields:o,shippingType:t.shippingType}}const _l=e=>{const t=e.lineItems.flatMap(n=>n.discountAllocations);return[...e.discountCodes.filter(n=>n.applicable&&e.discountAllocations.findIndex(r=>r.code===n.code)===-1&&t.findIndex(r=>r.code===n.code)===-1).map(n=>({code:n.code,discountedAmount:{amount:"0",currencyCode:e.totalAmount.currencyCode}})),...e.discountAllocations,...t]},ua=e=>{const t=e.lineItems.reduce((n,r)=>n+Number(r.subtotalAmount.amount),0);return{amount:String(t),currencyCode:e.totalAmount.currencyCode}};function El(e,t){return e.reduce((n,r)=>{if(!r.sellingPlanAllocation)return n;const{sellingPlanAllocation:{sellingPlan:a,priceAdjustments:i},quantity:o}=r;if(!a.recurringDeliveries||!a.billingPolicy)return n;const s=Al({billingPolicy:a.billingPolicy,i18n:t});if(i.length===0){const l=ft({price:Number(r.subtotalAmount.amount)*o,currencyCode:r.subtotalAmount.currencyCode,locale:t.locale});return[...n,t.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(i.length===1){const l=ft({price:Number(i[0].price.amount)*o,currencyCode:i[0].price.currencyCode,locale:t.locale});return[...n,t.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(i.length===2){const l=ft({price:Number(i[0].price.amount)*o,currencyCode:i[0].price.currencyCode,locale:t.locale}),u=ft({price:Number(i[1].price.amount)*o,currencyCode:i[1].price.currencyCode,locale:t.locale}),d=a.priceAdjustments[0].orderCount;return[...n,t.translate("order_summary.subscriptions.recurring_totals_with_policies",{count:d,fixedPrice:l,recurringPrice:u,interval:s})]}return n},[])}function ft({price:e,currencyCode:t,locale:n}){return Intl.NumberFormat(n,{style:"currency",currency:t,currencyDisplay:"narrowSymbol"}).format(e)}function Al({billingPolicy:e,i18n:t}){const{interval:n,intervalCount:r}=e,a={YEAR:"order_summary.subscriptions.recurring_total_intervals.year",MONTH:"order_summary.subscriptions.recurring_total_intervals.month",WEEK:"order_summary.subscriptions.recurring_total_intervals.week",DAY:"order_summary.subscriptions.recurring_total_intervals.day"}[n];if(!a)throw new Error("Unknown selling plan interval provided: ".concat(n));return t.translate(a,{count:r})}const Ht="GraphQL Client",Jr=0,Zr=3,ha="An error occurred while fetching from the API. Review 'graphQLErrors' for details.",pa="Response returned unexpected Content-Type:",ma="An unknown error has occurred. The API did not return a data object or any errors in its response.",cr={json:"application/json",multipart:"multipart/mixed"},en="X-SDK-Variant",tn="X-SDK-Version",Cl="shopify-graphql-client",Sl="1.3.0",ya=1e3,Il=[429,503],ga=/@(defer)\b/i,rn="\r\n",Pl=/boundary="?([^=";]+)"?/i,nn=rn+rn;function ce(e,t=Ht){return e.startsWith("".concat(t))?e:"".concat(t,": ").concat(e)}function qe(e){return e instanceof Error?e.message:JSON.stringify(e)}function fa(e){return e instanceof Error&&e.cause?e.cause:void 0}function ba(e){return e.flatMap(({errors:t})=>t!=null?t:[])}function wa({client:e,retries:t}){if(t!==void 0&&(typeof t!="number"||t<Jr||t>Zr))throw new Error("".concat(e,': The provided "retries" value (').concat(t,") is invalid - it cannot be less than ").concat(Jr," or greater than ").concat(Zr))}function V(e,t){return t&&(typeof t!="object"||Array.isArray(t)||typeof t=="object"&&Object.keys(t).length>0)?{[e]:t}:{}}function _a(e,t){if(e.length===0)return t;const n={[e.pop()]:t};return e.length===0?n:_a(e,n)}function Ea(e,t){return Object.keys(t||{}).reduce((n,r)=>(typeof t[r]=="object"||Array.isArray(t[r]))&&e[r]?(n[r]=Ea(e[r],t[r]),n):(n[r]=t[r],n),Array.isArray(e)?[...e]:b({},e))}function Aa([e,...t]){return t.reduce(Ea,b({},e))}function Dl({clientLogger:e,customFetchApi:t=fetch,client:n=Ht,defaultRetryWaitTime:r=ya,retriableCodes:a=Il}){const i=async(o,s,l)=>{const u=s+1,d=l+1;let h;try{if(h=await t(...o),e({type:"HTTP-Response",content:{requestParams:o,response:h}}),!h.ok&&a.includes(h.status)&&u<=d)throw new Error;return h}catch(p){if(u<=d){const y=h==null?void 0:h.headers.get("Retry-After");return await vl(y?parseInt(y,10):r),e({type:"HTTP-Retry",content:{requestParams:o,lastResponse:h,retryAttempt:s,maxRetries:l}}),i(o,u,l)}throw new Error(ce("".concat(l>0?"Attempted maximum number of ".concat(l," network retries. Last message - "):"").concat(qe(p)),n))}};return i}async function vl(e){return new Promise(t=>setTimeout(t,e))}function Rl({headers:e,url:t,customFetchApi:n=fetch,retries:r=0,logger:a}){wa({client:Ht,retries:r});const i={headers:e,url:t,retries:r},o=Nl(a),s=Dl({customFetchApi:n,clientLogger:o,defaultRetryWaitTime:ya}),l=Tl(s,i),u=Ll(l),d=$l(l);return{config:i,fetch:l,request:u,requestStream:d}}function Nl(e){return t=>{e&&e(t)}}async function Ca(e){const{errors:t,data:n,extensions:r}=await e.json();return b(T(b(b({},V("data",n)),V("extensions",r)),{headers:e.headers}),t||!n?{errors:T(b({networkStatusCode:e.status,message:ce(t?ha:ma)},V("graphQLErrors",t)),{response:e})}:{})}function Tl(e,{url:t,headers:n,retries:r}){return async(a,i={})=>{const{variables:o,headers:s,url:l,retries:u,keepalive:d,signal:h}=i,p=JSON.stringify({query:a,variables:o});wa({client:Ht,retries:u});const y=Object.entries(b(b({},n),s)).reduce((f,[A,I])=>(f[A]=Array.isArray(I)?I.join(", "):I.toString(),f),{});!y[en]&&!y[tn]&&(y[en]=Cl,y[tn]=Sl);const E=[l!=null?l:t,{method:"POST",headers:y,body:p,signal:h,keepalive:d}];return e(E,1,u!=null?u:r)}}function Ll(e){return async(...t)=>{if(ga.test(t[0]))throw new Error(ce("This operation will result in a streamable response - use requestStream() instead."));try{const n=await e(...t),{status:r,statusText:a}=n,i=n.headers.get("content-type")||"";return n.ok?i.includes(cr.json)?Ca(n):{errors:{networkStatusCode:r,message:ce("".concat(pa," ").concat(i)),response:n}}:{errors:{networkStatusCode:r,message:ce(a),response:n}}}catch(n){return{errors:{message:qe(n)}}}}}function kl(e){return Ne(this,null,function*(){const t=new TextDecoder;if(e.body[Symbol.asyncIterator])try{for(var n=te(e.body),r,a,i;r=!(a=yield new ee(n.next())).done;r=!1){const o=a.value;yield t.decode(o)}}catch(o){i=[o]}finally{try{r&&(a=n.return)&&(yield new ee(a.call(n)))}finally{if(i)throw i[0]}}else{const o=e.body.getReader();let s;try{for(;!(s=yield new ee(o.read())).done;)yield t.decode(s.value)}finally{o.cancel()}}})}function Ol(e,t){return{[Symbol.asyncIterator](){return Ne(this,null,function*(){try{let o="";try{for(var n=te(e),r,a,i;r=!(a=yield new ee(n.next())).done;r=!1){const s=a.value;if(o+=s,o.indexOf(t)>-1){const l=o.lastIndexOf(t),u=o.slice(0,l).split(t).filter(d=>d.trim().length>0).map(d=>d.slice(d.indexOf(nn)+nn.length).trim());u.length>0&&(yield u),o=o.slice(l+t.length),o.trim()==="--"&&(o="")}}}catch(s){i=[s]}finally{try{r&&(a=n.return)&&(yield new ee(a.call(n)))}finally{if(i)throw i[0]}}}catch(o){throw new Error("Error occured while processing stream payload - ".concat(qe(o)))}})}}}function xl(e){return{[Symbol.asyncIterator](){return Ne(this,null,function*(){const t=yield new ee(Ca(e));yield T(b({},t),{hasNext:!1})})}}}function Ml(e){return e.map(t=>{try{return JSON.parse(t)}catch(n){throw new Error("Error in parsing multipart response - ".concat(qe(n)))}}).map(t=>{const{data:n,incremental:r,hasNext:a,extensions:i,errors:o}=t;if(!r)return T(b(b({data:n||{}},V("errors",o)),V("extensions",i)),{hasNext:a});const s=r.map(({data:l,path:u,errors:d})=>b({data:l&&u?_a(u,l):{}},V("errors",d)));return T(b({data:s.length===1?s[0].data:Aa([...s.map(({data:l})=>l)])},V("errors",ba(s))),{hasNext:a})})}function Fl(e,t){if(e.length>0)throw new Error(ha,{cause:{graphQLErrors:e}});if(Object.keys(t).length===0)throw new Error(ma)}function Ul(e,t){var n,r;const a=(t!=null?t:"").match(Pl),i="--".concat(a?a[1]:"-");if(!((n=e.body)!=null&&n.getReader)&&!((r=e.body)!=null&&r[Symbol.asyncIterator]))throw new Error("API multipart response did not return an iterable body",{cause:e});const o=kl(e);let s={},l;return{[Symbol.asyncIterator](){return Ne(this,null,function*(){var u,d;try{let f=!0;try{for(var h=te(Ol(o,i)),p,y,E;p=!(y=yield new ee(h.next())).done;p=!1){const A=y.value,I=Ml(A);l=(d=(u=I.find(G=>G.extensions))==null?void 0:u.extensions)!=null?d:l;const O=ba(I);s=Aa([s,...I.map(({data:G})=>G)]),f=I.slice(-1)[0].hasNext,Fl(O,s),yield T(b(b({},V("data",s)),V("extensions",l)),{hasNext:f})}}catch(A){E=[A]}finally{try{p&&(y=h.return)&&(yield new ee(y.call(h)))}finally{if(E)throw E[0]}}if(f)throw new Error("Response stream terminated unexpectedly")}catch(f){const A=fa(f);yield T(b(b({},V("data",s)),V("extensions",l)),{errors:T(b({message:ce(qe(f)),networkStatusCode:e.status},V("graphQLErrors",A==null?void 0:A.graphQLErrors)),{response:e}),hasNext:!1})}})}}}function $l(e){return async(...t)=>{if(!ga.test(t[0]))throw new Error(ce("This operation does not result in a streamable response - use request() instead."));try{const n=await e(...t),{statusText:r}=n;if(!n.ok)throw new Error(r,{cause:n});const a=n.headers.get("content-type")||"";switch(!0){case a.includes(cr.json):return xl(n);case a.includes(cr.multipart):return Ul(n,a);default:throw new Error("".concat(pa," ").concat(a),{cause:n})}}catch(n){return{[Symbol.asyncIterator](){return Ne(this,null,function*(){const r=fa(n);yield{errors:b(b({message:ce(qe(n))},V("networkStatusCode",r==null?void 0:r.status)),V("response",r)),hasNext:!1}})}}}}}const Bl="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}}}}}",Hl="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}",Gl="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}",Vl="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}",zl="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}",ql="mutation applePaySessionCreate($validationUrl:URL!){applePaySessionCreate(validationUrl:$validationUrl){...@defer{applePaySession{body}}}}",jl="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}}}}}}",Yl="mutation PayPalTokenCreate($cartId:ID!){paypalTokenCreate(cartId:$cartId){...@defer{paypalToken{token}}}}",Wl="query cartQuery($id:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false)@inContext(country:$country language:$language){cart(id:$id){...@defer(if:$withCarrierRates){...CartParts}}}",Kl="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}}}}}}}",Ql="query subscriptionPolicyQuery($country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){shop{subscriptionPolicy(sanitized:true){body}}}",Xl="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}",bt="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}}}}}}",Zt="fragment CartErrorParts on CartUserError{message field code}",an="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}}}}",Jl="mutation prepareCart($cartId:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=true)@inContext(country:$country language:$language){...PreparedCartFragment}",Zl="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}}}}",ec="mutation cartRemovePersonalData($cartId:ID!){cartRemovePersonalData(cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}";async function tc(e,t){var n,r;if(!t.errors)return;const a=sc(t.errors,e),i=await oc(t.errors.response),o=((r=(n=t.errors.response)==null?void 0:n.headers)==null?void 0:r.get("content-type"))||void 0,s=[];if(t.errors.graphQLErrors)for(const l of t.errors.graphQLErrors)l.code&&s.push(l.code);return{operationName:e,statusCode:t.errors.networkStatusCode,contentType:o,message:a,responseBody:i,errorCodes:s}}const rc=[/API multipart response did not return an iterable body/],nc=[/signal is aborted/i,/fetch is aborted/i,/operation was aborted/i],ac=[/timed?.out/i,/error occured while processing stream payload/i,/response stream terminated/i];function ic(e){if(e.contentType&&!e.contentType.includes("application/json"))return{isIgnorable:!0,reason:"contentType"};if(e.statusCode&&e.statusCode!==200)return{isIgnorable:!0,reason:"statusCode-".concat(e.statusCode)};if(e.message){if(ac.some(t=>t.test(e.message)))return{isIgnorable:!0,reason:"timeout"};if(nc.some(t=>t.test(e.message)))return{isIgnorable:!0,reason:"abort"};if(rc.some(t=>t.test(e.message)))return{isIgnorable:!0,reason:"message"}}return{isIgnorable:!1,reason:void 0}}async function oc(e){if(!e||e.bodyUsed)return"";try{return(await e.text()).slice(0,1024)}catch(t){return console.error("Failed to read response body:",t),""}}function sc(e,t){var n,r;if(!e)return"";const a=(r=(n=e.graphQLErrors)==null?void 0:n.map(s=>s.message).join(", "))!=null?r:"",i="".concat(e.message).concat(a.length>0?" - ".concat(a):""),o=e.networkStatusCode?"with status ".concat(e.networkStatusCode," => ").concat(i):"=> ".concat(i);return"GraphQL response error for ".concat(t,": ").concat(o)}function lc(e){const{operationName:t,errorCodes:n}=e,r=n.join("-")||"unknown";return"".concat(t,"-").concat(r)}const cc="unstable",on="UNKNOWN",sn="RESTRICTED_WALLET_ACCOUNT";class Gt{constructor({accessToken:t,country:n,locale:r,apiVersion:a=cc,withCarrierRates:i=!1,cartPrepareMigrationEnabled:o=!1}){if(c(this,"OPERATION_NAME_REGEX",/[^ ]+ (\w+)/),c(this,"client"),c(this,"country"),c(this,"url"),c(this,"locale"),c(this,"withCarrierRates"),c(this,"lastValidCart"),c(this,"cartPrepareMigrationEnabled"),!t)throw new Error("StorefrontApiClient constructed with no access token");if(!n)throw new Error("StorefrontApiClient constructed with no buyer country");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=Rl({headers:{"Content-Type":"application/json",Accept:"application/json","X-Shopify-Storefront-Access-Token":t,"X-SDK-Variant":"portable-wallets"},url:this.url,retries:0,customFetchApi:(s,l)=>(_.leaveBreadcrumb("".concat((l==null?void 0:l.method)||on,": ").concat(s),{url:s,method:l==null?void 0:l.method},"request"),fetch(s,l)),logger:s=>{if(s.type==="HTTP-Response"){const[l,u]=s.content.requestParams,{status:d,statusText:h,headers:p,type:y}=s.content.response;_.leaveBreadcrumb("".concat((u==null?void 0:u.method)||on,": ").concat(l),{statusCode:d,statusText:h,responseHeaders:p,responseType:y,url:l,method:u==null?void 0:u.method,headers:u==null?void 0:u.headers,body:u==null?void 0:u.body},"request")}}})}async createCart(t){var n,r,a;const i=await this.requestStream([Bl,bt],{input:{lines:[{merchandiseId:t.merchandiseId,quantity:t.quantity,sellingPlanId:t.sellingPlanId,attributes:t.lineItemProperties}],discountCodes:t.discountCodes,buyerIdentity:t.buyerIdentity},country:this.country,language:this.formatLanguage(this.locale)},{instrumentName:t.instrumentName,startingCheckout:!0,operationName:"createCart"});try{for(var o=te(i),s,l,u;s=!(l=await o.next()).done;s=!1){const d=l.value;d.errors&&await this.onError("createCart",d);const h=(n=d.data)==null?void 0:n.result;if(h&&!d.hasNext){h.errors&&this.onResultError(h.errors);const p=this.parseMutationWarnings((a=(r=d.data)==null?void 0:r.result)==null?void 0:a.warnings);return{data:h.cart?this.parseCartResponse(h.cart):null,errors:this.parseMutationErrors(d,"result"),warnings:p,decelerationReason:wt({warnings:p})}}}}catch(d){u=[d]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(u)throw u[0]}}throw new ae("Cart create operation returned no response")}async updateCartBillingAddress(t){const{cartId:n,billingAddress:r,instrumentName:a}=t;return this.requestDeferredCart(Gl,{cartId:n,billingAddress:r},{instrumentName:a,operationName:"updateCartBillingAddress"})}async updateCartBuyerIdentity(t,n){const{cartId:r,instrumentName:a}=t;return this.requestDeferredCart(Vl,{cartId:r,buyerIdentity:uc(t)},{instrumentName:a,operationName:"updateCartBuyerIdentity",abortSignal:n})}async updateSelectedDeliveryOptions(t,n,r,a){let i=n;const o=et()+2e4;for(;et()<o;){const s=await this.requestDeferredCart(zl,{cartId:t,selectedDeliveryOptions:i},{instrumentName:r,operationName:"updateSelectedDeliveryOptions",abortSignal:a});if(!(!this.cartPrepareMigrationEnabled&&s.errors.some(u=>typeof u=="string"&&u.startsWith(m.PendingDeliveryGroups))))return s;const l=s.data.deliveryGroups.flatMap(u=>u.deliveryOptions.map(d=>({deliveryOptionHandle:d.handle,deliveryGroupId:u.id})));i=i.map(u=>{var d;return(d=l.find(h=>h.deliveryOptionHandle===u.deliveryOptionHandle))!=null?d:u})}throw new Error("Selected delivery options update operation timed out")}async applePaySessionCreate(t){var n,r,a;const i=await this.requestStream([ql],{validationUrl:t.toString()},{instrumentName:w.ApplePay,operationName:"applePaySessionCreate"});try{for(var o=te(i),s,l,u;s=!(l=await o.next()).done;s=!1){const d=l.value;d.errors&&await this.onError("applePaySessionCreate",d);const h=(a=(r=(n=d.data)==null?void 0:n.applePaySessionCreate)==null?void 0:r.applePaySession)==null?void 0:a.body;if(h)return h}}catch(d){u=[d]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(u)throw u[0]}}throw new ae("Apple Pay session create operation returned no response")}async paypalBuyerDetailsFetch(t,n){var r,a;const i=await this.requestStream([jl],{token:t,cartId:n},{instrumentName:w.PayPal,operationName:"paypalBuyerDetailsFetch"});try{for(var o=te(i),s,l,u;s=!(l=await o.next()).done;s=!1){const d=l.value;if(d.hasNext)continue;d.errors&&await this.onError("paypalBuyerDetailsFetch",d);const h=(a=(r=d.data)==null?void 0:r.paypalBuyerDetailsFetch)==null?void 0:a.paypalDetails;if(h)return h}}catch(d){u=[d]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(u)throw u[0]}}throw new ae("PayPal buyer details fetch operation returned no response")}async paypalTokenCreate(t){var n,r,a,i;const o=await this.requestStream([Yl],{cartId:t},{instrumentName:w.PayPal,operationName:"paypalTokenCreate"});try{for(var s=te(o),l,u,d;l=!(u=await s.next()).done;l=!1){const h=u.value;if(h.errors){if((n=h.errors.graphQLErrors)!=null&&n.find(y=>{var E;return((E=y.extensions)==null?void 0:E.code)===sn}))throw new Tt(sn);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){d=[h]}finally{try{l&&(u=s.return)&&await u.call(s)}finally{if(d)throw d[0]}}throw new ae("PayPal token create operation returned no response")}async fetchLimitedCart({id:t,startingCheckout:n,instrumentName:r}){var a;const i=await this.request([Kl],{id:t},{instrumentName:r,startingCheckout:n});if(i.errors&&await this.onError("limitedCartQuery",i),!((a=i.data)!=null&&a.cart))throw new ae("Limited cart query returned no response");return _.leaveBreadcrumb("limitedCartQuery response",{operationName:"limitedCartQuery",body:i.data.cart},"log"),{id:i.data.cart.id,shippingRequired:i.data.cart.lines.edges.some(o=>o.node.merchandise.requiresShipping),sellingPlan:i.data.cart.lines.edges.some(o=>o.node.sellingPlanAllocation!=null)}}async fetchCart({id:t,startingCheckout:n,instrumentName:r}){var a;const i=this.formatLanguage(this.locale),o=this.cartPrepareMigrationEnabled?"Prepare cart":"Fetch cart",s=this.cartPrepareMigrationEnabled?Jl:Wl,l=this.cartPrepareMigrationEnabled?[bt,Zt,an]:[bt],u=this.cartPrepareMigrationEnabled?{cartId:t,country:this.country,language:i,withCarrierRates:this.withCarrierRates,prepareCart:!0}:{id:t,country:this.country,language:i,withCarrierRates:this.withCarrierRates},d=await this.requestStream([s,...l],u,{instrumentName:r,startingCheckout:n,operationName:"fetchCart"});try{for(var h=te(d),p,y,E;p=!(y=await h.next()).done;p=!1){const f=y.value;f.errors&&await this.onError("fetchCart",f);let A=null,I;if(!f.data)throw new ae("".concat(o," operation returned no data in response"));if(dc(f.data)){const O=f.data.preparedCart;A=(a=O==null?void 0:O.result)==null?void 0:a.cart,I=this.parsePreparedCartMutationErrors(f.errors,this.extractPreparedCartMutationErrors(O))}else A=f.data.cart;if(_.leaveBreadcrumb("".concat(o," response"),{operationName:o,body:A,errors:I,hasNext:f.hasNext},"log"),A&&!f.hasNext){const O=this.parseCartResponse(A);return this.lastValidCart=O,O}}}catch(f){E=[f]}finally{try{p&&(y=h.return)&&await y.call(h)}finally{if(E)throw E[0]}}throw new ae("".concat(o," operation returned no response"))}async updateCartPayment(t,n,r,a){var i,o;const s={cartId:t,input:n},{amount:l,currencyCode:u}=n.amount;let d;const h=et()+1e4;for(;et()<h;){const p=await this.requestDeferredCart(Xl,s,{instrumentName:r,operationName:"updateCartPayment",abortSignal:a});if(d||(d=p),!this.cartPrepareMigrationEnabled&&p.errors.includes(m.InvalidPaymentAmount)){parseFloat((o=(i=p.data.totalTaxAmount)==null?void 0:i.amount)!=null?o:"0")===0&&await new Promise(y=>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===u?p:d}throw new Error("Payment update operation timed out")}async updateCartAttributes({cartId:t,attributes:n,instrumentName:r,startingCheckout:a}){const i={cartId:t,attributes:n};return await this.requestDeferredCart(Hl,i,{instrumentName:r,operationName:"updateCartAttributes",startingCheckout:a})}async submitForCompletion(t,n,r){var a,i;const o=this.formatLanguage(this.locale),s=await this.request([Zl],{cartId:t,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 t,n;const{data:r}=await this.request([Ql],{country:this.country,language:this.formatLanguage(this.locale)},{operationName:"fetchSubscriptionPolicy"});return(n=(t=r==null?void 0:r.shop)==null?void 0:t.subscriptionPolicy)==null?void 0:n.body}async cartRemovePersonalData({cartId:t,shopId:n,instrumentName:r}){var a,i;let o,s,l;try{const d=await this.request([ec,Zt],{cartId:t},{instrumentName:r,keepalive:!0});o=this.parseMutationWarnings((i=(a=d.data)==null?void 0:a.cartRemovePersonalData)==null?void 0:i.warnings),s=this.parseMutationErrors(d,"cartRemovePersonalData")}catch(d){l=d.toString()}const u=!(o!=null&&o.length||s!=null&&s.length||l);g.removePersonalDataResult({success:u}),u||g.log({body:"cartRemovePersonalData failed",attributes:{cartId:t,shopId:n,warnings:o,errors:s,exception:l}})}generateURLWithOperationName(t){const n=t.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(t,n,r){return this.client.request(t.join(""),{variables:n,headers:ln(r),url:this.generateURLWithOperationName(t[0]),keepalive:r.keepalive})}async requestStream(t,n,r){return this.client.requestStream(t.join(""),{variables:n,headers:ln(r),url:this.generateURLWithOperationName(t[0]),signal:r.abortSignal})}async requestDeferredCart(t,n,r){var a,i,o,s,l,u,d,h,p;const y=this.formatLanguage(this.locale),E=await this.requestStream([t,bt,Zt,an],T(b({},n),{country:this.country,language:y,withCarrierRates:this.withCarrierRates,prepareCart:this.cartPrepareMigrationEnabled}),r);try{for(var f=te(E),A,I,O;A=!(I=await f.next()).done;A=!1){const G=I.value;G.errors&&await this.onError(r.operationName,G);const Vt=this.extractMutationErrors(G),N=(i=(a=G.data)==null?void 0:a.preparedCart)==null?void 0:i.result,$=(l=(s=(o=G.data)==null?void 0:o.result)==null?void 0:s.cart)!=null?l:N==null?void 0:N.cart;if($&&!G.hasNext){let B;this.cartPrepareMigrationEnabled||(B=await this.fetchCart({id:$.id,instrumentName:r.instrumentName,startingCheckout:!1}));const L=this.parseMutationWarnings((d=(u=G.data)==null?void 0:u.result)==null?void 0:d.warnings);return{data:B!=null?B:this.parseCartResponse($),errors:this.parsePreparedCartMutationErrors(G.errors,Vt),warnings:L,decelerationReason:wt({warnings:L,cartStatus:N==null?void 0:N.__typename})}}if(this.lastValidCart&&Vt.length>0){this.onResultError(Vt);const B=this.parseMutationWarnings((p=(h=G.data)==null?void 0:h.result)==null?void 0:p.warnings);return{data:this.lastValidCart,errors:this.parsePreparedCartMutationErrors(G.errors,Vt),warnings:B,decelerationReason:wt({warnings:B})}}}}catch(G){O=[G]}finally{try{A&&(I=f.return)&&await I.call(f)}finally{if(O)throw O[0]}}throw new ae("Deferred cart operation returned no response")}async onError(t,n){const r=await tc(t,n);if(!r)return;const a=r,{message:i}=a,o=jt(a,["message"]),{isIgnorable:s,reason:l}=ic(r);throw _.leaveBreadcrumb(i,b(b({ignored:s,ignoredReason:l},n),o),"error"),s?new Fn(i,{reason:l,errorDetails:o}):new wr(i,{errorDetails:o,bugsnagGroupingHash:lc(o)})}onResultError(t){_.leaveBreadcrumb("GraphQL result error",t,"error")}formatLanguage(t){return t.includes("-")?t.split("-")[0].toUpperCase():t.toUpperCase()}parseCartResponse(t){var n,r,a;const i=t.lines.edges.map(s=>{var l,u;const d=s.node;return{quantity:d.quantity,totalAmount:{amount:d.cost.totalAmount.amount,currencyCode:d.cost.totalAmount.currencyCode},subtotalAmount:{amount:(l=d.cost.subtotalAmount)==null?void 0:l.amount,currencyCode:(u=d.cost.subtotalAmount)==null?void 0:u.currencyCode},merchandise:{requiresShipping:d.merchandise.requiresShipping},discountAllocations:d.discountAllocations,sellingPlanAllocation:d.sellingPlanAllocation}}),o=t.deliveryGroups.edges.map(s=>s.node);return{id:t.id,totalAmount:t.cost.totalAmount,subtotalAmount:(n=t.cost.subtotalAmount)!=null?n:void 0,totalTaxAmount:(r=t.cost.totalTaxAmount)!=null?r:void 0,totalDutyAmount:(a=t.cost.totalDutyAmount)!=null?a:void 0,discountAllocations:t.discountAllocations,discountCodes:t.discountCodes,lineItems:i,deliveryGroups:o,checkoutUrl:t.checkoutUrl}}parseGraphQlErrors(t){var n,r;return(r=(n=t==null?void 0:t.graphQLErrors)==null?void 0:n.map(a=>a.message.replace(/\(Expected.*\)/,"").trim()))!=null?r:[]}parseMutationError(t){return t.code===Et?{code:Et,message:t.message}:t.field&&t.field.length>0?"".concat(t.code,": ").concat(t.field.join(".")):t.code}parseMutationErrors(t,n){var r,a,i;const o=this.parseGraphQlErrors(t.errors),s=((i=(a=(r=t.data)==null?void 0:r[n])==null?void 0:a.errors)==null?void 0:i.map(this.parseMutationError).filter(u=>u))||[],l=[...o,...s];return _.leaveBreadcrumb("GraphQL errors on mutation",l,"error"),l}parseMutationWarnings(t){return!t||t.length===0?[]:t.map(n=>n.code)}filterErrors(t){var n;return!((n=t.code)!=null&&n.startsWith("PENDING_DELIVERY_GROUPS")||t.code==="INVALID_PAYMENT")}extractPreparedCartMutationErrors(t){var n,r;const a=(n=t==null?void 0:t.errors)!=null?n:[];return((r=t==null?void 0:t.result)==null?void 0:r.__typename)==="CartStatusNotReady"&&a.push(...t.result.errors),a}extractMutationErrors(t){var n,r,a,i;let o=(a=(r=(n=t.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=t.data)==null?void 0:i.preparedCart)]}parsePreparedCartMutationErrors(t,n){const r=this.parseGraphQlErrors(t),a=n.map(this.parseMutationError).filter(o=>o),i=[...r,...a];return _.leaveBreadcrumb("GraphQL errors on mutation",i,"error"),i}parseCompletionErrors(t){var n,r,a,i;const o=this.parseGraphQlErrors(t.errors);let s=[];((a=(r=(n=t.data)==null?void 0:n.cartSubmitForCompletion)==null?void 0:r.result)==null?void 0:a.__typename)==="SubmitFailed"&&(s=(i=t.data.cartSubmitForCompletion.result.errors.map(u=>u.code))!=null?i:[]);const l=[...o,...s];return _.leaveBreadcrumb("GraphQL errors on completion",l,"error"),l}}function dc(e){return!("cart"in e)}function uc({emailAddress:e,countryCode:t,phone:n,streetAddress:r,validateAddress:a,preferences:i}){return{email:e,countryCode:t!=null?t: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 ln({instrumentName:e,startingCheckout:t}){const n={};return e&&(n["X-Wallet-Name"]="".concat(e)),t&&(n["X-Start-Wallet-Checkout"]="".concat(t)),n}async function Sa({cartId:e,cartClient:t,instrumentName:n,selectedDeliveryOptions:r,abortSignal:a}){try{if(!e)throw new Error("[".concat(n,"] provided no cart ID when updating shipping method"));if(!t)throw new Error("[".concat(n,"] provided invalid cart client when updating shipping method"));return await t.updateSelectedDeliveryOptions(e,r,n,a)}catch(i){throw g.updateFailed(n,"updateSelectedDeliveryOptions"),i}}async function Ia({cartId:e,token:t,cartClient:n,instrumentName:r}){try{if(!e)throw new Error("[".concat(r,"] provided no cart ID when submitting for completion"));if(!n)throw new Error("[".concat(r,"] provided invalid cart client when submitting for completion"));if(!t)throw new Error("[".concat(r,"] provided no token when submitting for completion"));return await n.submitForCompletion(e,t,r)}catch(a){throw g.updateFailed(r,"submitForCompletion"),a}}function Pa({selectedDeliveryOptionHandles:e,deliveryGroups:t,instrumentName:n}){return t.map(r=>{const a=r.deliveryOptions.filter(i=>e.includes(i.handle));if(!a.length)throw new Error("[".concat(n,"] could not find delivery option for group: ").concat(r.id));if(a.length>1)throw new Error("[".concat(n,"] found multiple delivery options with selectedDeliverOptionHandle in group: ").concat(r.id));return{deliveryGroupId:r.id,deliveryOptionHandle:a[0].handle}})}async function hc(e){const{cartClient:t,instrumentName:n}=e;try{if(!e.cartId)throw new Error("[".concat(n,"] provided no cart ID when updating billing address"));if(!t)throw new Error("[".concat(n,"] provided invalid cart client when updating billing address"));return await t.updateCartBillingAddress(e)}catch(r){throw g.updateFailed(n,"updateBillingAddress"),r}}function cn(e,t){return e.some(n=>t.includes(n))}function at({result:e,instrument:t}){var n;const r=(n=e.errors)!=null?n:[];cn(r,Ir)&&g.dynamicTaxFailed({instrument:t}),cn(r,Os)&&g.dynamicShippingFailed({instrument:t})}const pc=["cart_not_ready","cart_throttled"];class mc{constructor({accessToken:t,buyerCountry:n,buyerCurrency:r,button:a,i18n:i,merchantName:o,dataSource:s,apiClient:l,walletParams:u}){c(this,"name",w.ApplePay),c(this,"accessToken"),c(this,"button"),c(this,"buyerCountry"),c(this,"cart"),c(this,"apiClient"),c(this,"dataSource"),c(this,"i18n"),c(this,"merchantName"),c(this,"session"),c(this,"paymentSheetActionGenerator"),c(this,"cancelled"),c(this,"buyerCurrency"),c(this,"customerAccountEmail"),c(this,"abortController",null),c(this,"isPersonalDataCleared",!1),c(this,"onvalidatemerchant",async d=>{var h,p,y;try{const E=new URL(d.validationURL),f=this.getMerchantSession(E),{cart:A,decelerationReason:I,customValidationError:O}=await pe({element:this.button,instrumentName:this.name,dataSource:this.dataSource});if(O){this.session.abort(),(h=this.abortController)==null||h.abort(),ve(this.i18n,O.message);return}this.cart=A;const G=await f;if(_.leaveBreadcrumb("ApplePay Session completeMerchantValidation",{session:G},"log"),I){this.session.abort(),(p=this.abortController)==null||p.abort(),F({checkoutUrl:(y=A==null?void 0:A.checkoutUrl)!=null?y:"",instrumentName:this.name,reason:I});return}if(this.sessionIsCancelled())return;this.session.completeMerchantValidation(G)}catch(E){g.sheetClicked({instrument:w.ApplePay,result:"failed"}),this.terminateSession(E)}}),c(this,"onshippingcontactselected",async d=>{try{const h=gt(d.shippingContact),p=await xe({cartId:this.cart.id,streetAddress:h,cartClient:this.apiClient,instrumentName:this.name});if(!p.data)throw new Error("Missing cart during Apple Pay Session creation");if(await this.decelerateIfNeeded(p))return;await this.applyPaymentSheetActions(p,y=>this.completeShippingContactSelection(p.data,y),{shippingRequired:this.isShippingRequired,shippingCountryCode:h.country})}catch(h){this.terminateSession(h)}}),c(this,"onshippingmethodselected",async d=>{var h;try{const p=d.shippingMethod.identifier.split(","),y=Pa({selectedDeliveryOptionHandles:p,deliveryGroups:this.cart.deliveryGroups,instrumentName:this.name}),E=await Sa({cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name,selectedDeliveryOptions:y,abortSignal:(h=this.abortController)==null?void 0:h.signal});await this.applyPaymentSheetActions(E,()=>this.completeShippingMethodSelection(E.data),{shippingRequired:this.isShippingRequired,shippingCountryCode:void 0}),this.onSheetLoaded()}catch(p){this.terminateSession(p)}}),c(this,"onpaymentmethodselected",async d=>{try{const{billingContact:h}=d.paymentMethod;if(!this.isShippingRequired&&h){const E=gt(h),f=await xe({cartId:this.cart.id,countryCode:E.country,cartClient:this.apiClient,instrumentName:this.name});if(!f.data)throw new Error("Missing cart during Apple Pay Session creation");if(await this.decelerateIfNeeded(f))return;await this.applyPaymentSheetActions(f,()=>this.cart=f.data,{shippingRequired:this.isShippingRequired,shippingCountryCode:E.country});const A=await hc({billingAddress:E,cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name});await this.applyPaymentSheetActions(A,()=>this.cart=A.data,{shippingRequired:this.isShippingRequired,shippingCountryCode:E.country})}const{newTotal:p,newLineItems:y}=this.getNewTotalAndLineItems(this.cart);if(_.leaveBreadcrumb("ApplePay Session completePaymentMethodSelection",{newTotal:p,newLineItems:y},"log"),this.sessionIsCancelled())return;this.session.completePaymentMethodSelection({newTotal:p,newLineItems:y}),this.isShippingRequired||this.onSheetLoaded()}catch(h){this.terminateSession(h)}}),c(this,"oncancel",()=>{var d;this.cancelled=!0,this.removePersonalData(),Z(M.SheetLoad,this.name),g.sheetCancelled(this.name),this.button.disabled=!1,(d=this.abortController)==null||d.abort()}),c(this,"onpaymentauthorized",async d=>{g.authorizationAttempt(this.name),ze(M.AuthorizationLatency,this.name);const h=N=>{g.authorizationComplete({instrument:this.name,measurement:Z(M.AuthorizationLatency,this.name),result:"failed"}),this.terminateSession(N)},p=async N=>{var $,B;switch(($=N.effects)==null||$.forEach(L=>L()),N.action){case"complete":{const L=ApplePaySession.STATUS_SUCCESS;try{await this.completePayment(L),de(N.redirectUrl)}catch(mt){h(mt)}break}case"show_error":{const L=(B=N.errors)!=null?B:[];try{await this.completePayment(ApplePaySession.STATUS_FAILURE,L)}catch(mt){h(mt)}break}case"abort":{try{await this.completePayment(ApplePaySession.STATUS_FAILURE),this.button.disabled=!1,this.removePersonalData()}catch(L){h(L)}break}case"decelerate":{try{await this.completePayment(ApplePaySession.STATUS_FAILURE),await this.removePersonalData(),F({checkoutUrl:N.redirectUrl,instrumentName:this.name,reason:N.reason})}catch(L){h(L)}break}default:h(new Error("[".concat(this.name,"] completion action not handled: ").concat(N.action)))}},{token:y,billingContact:E,shippingContact:f}=d.payment;let A=null,I=null;try{if(!E){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}if(A=gt(T(b({},E),{phoneNumber:f==null?void 0:f.phoneNumber})),this.isShippingRequired){if(!f){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}I=gt(f)}}catch(N){h(N);return}const O=async()=>{var N;try{const $=this.isShippingRequired?{validateAddress:!0,streetAddress:I}:{},B=(N=this.customerAccountEmail)!=null?N:f==null?void 0:f.emailAddress,L=await xe(b({cartId:this.cart.id,emailAddress:B,cartClient:this.apiClient,instrumentName:this.name},$));if(at({result:L,instrument:this.name}),await this.decelerateIfNeeded(L))return;const mt=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(L,{shippingRequired:this.isShippingRequired,shippingCountryCode:I==null?void 0:I.country});await Jt({paymentSheetAction:mt,onProceed:async ne=>{ne&&ne.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,ne):await G()},terminateSession:h})}catch($){h($)}},G=async()=>{var N;try{const $=this.cart.lineItems.some(mt=>!!mt.sellingPlanAllocation),B=await Tr({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{applePayWalletContent:{billingAddress:A,data:y.paymentData.data,header:y.paymentData.header,lastDigits:y.paymentMethod.displayName.split(" ")[1],signature:y.paymentData.signature,version:y.paymentData.version}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:A,cartClient:this.apiClient,instrumentName:this.name,hasSellingPlan:$,abortSignal:(N=this.abortController)==null?void 0:N.signal});if(at({result:B,instrument:this.name}),await this.decelerateIfNeeded(B))return;const L=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(B,{shippingRequired:this.isShippingRequired,shippingCountryCode:I==null?void 0:I.country});await Jt({paymentSheetAction:L,onProceed:async mt=>{mt&&mt.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,mt):await Vt()},terminateSession:h})}catch($){h($)}},Vt=async()=>{try{const N=await Ia({cartId:this.cart.id,token:y.transactionIdentifier,cartClient:this.apiClient,instrumentName:this.name});at({result:N,instrument:this.name});const $=this.paymentSheetActionGenerator.mapCompletionResultToPaymentSheetAction(N,{shippingRequired:this.isShippingRequired,shippingCountryCode:I==null?void 0:I.country});await p($)}catch(N){h(N)}};await O()}),c(this,"terminateSession",async d=>{var h;try{this.button.disabled=!1,Z(M.SheetLoad,this.name),d&&_.notify(d),g.sheetFailed(this.name,d);try{_.leaveBreadcrumb("ApplePay Session abort",{},"log"),this.session.abort(),(h=this.abortController)==null||h.abort()}catch(p){console.debug("[DEBUG] InvalidAccessError occurred during Apple Pay terminateSession")}if(d){const p=this.i18n.translate("brand.apple_pay");J(p,this.i18n)}}finally{await this.removePersonalData()}}),c(this,"getMostRecentNonNullCart",(d,h)=>d?(this.cart=d,d):h),c(this,"handleNullCart",d=>{if(!d)throw new Error("[".concat(this.name,"] no cart returned on mutation, aborting"))}),c(this,"completeShippingContactSelection",(d,h)=>{try{const p=this.getMostRecentNonNullCart(d,this.cart),{newTotal:y,newLineItems:E}=this.getNewTotalAndLineItems(p),f=gl(p.deliveryGroups,this.i18n);_.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{errors:h,newTotal:y,newLineItems:E,newShippingMethods:f},"log"),this.session.completeShippingContactSelection({errors:h!=null?h:[],newTotal:y,newLineItems:E,newShippingMethods:f})}catch(p){this.terminateSession(p)}}),c(this,"completeShippingMethodSelection",d=>{try{this.handleNullCart(d),this.cart=d;const{newTotal:h,newLineItems:p}=this.getNewTotalAndLineItems(d);_.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{newTotal:h,newLineItems:p},"log"),this.session.completeShippingMethodSelection({newTotal:h,newLineItems:p})}catch(h){this.terminateSession(h)}}),c(this,"sessionIsCancelled",()=>this.cancelled),this.accessToken=t,this.buyerCountry=n,this.button=a,this.cart=null,this.apiClient=l,this.dataSource=s,this.i18n=i,this.merchantName=o,this.cancelled=!1,this.buyerCurrency=r,this.customerAccountEmail=u.customerAccountEmail,this.session=new ApplePaySession(vn,wl({shippingRequired:this.isShippingRequired,walletParams:u,buyerCurrency:r})),this.session.onvalidatemerchant=this.onvalidatemerchant,this.session.onshippingcontactselected=this.onshippingcontactselected,this.session.onshippingmethodselected=this.onshippingmethodselected,this.session.onpaymentmethodselected=this.onpaymentmethodselected,this.session.oncancel=this.oncancel,this.session.onpaymentauthorized=this.onpaymentauthorized,this.paymentSheetActionGenerator=new bl(i)}begin(){_.leaveBreadcrumb("ApplePay Session begin",{},"log"),this.abortController=Ve("AbortController"),this.session.begin()}async applyPaymentSheetActions(t,n,r){var a;const i=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(t,r);(a=i.effects)==null||a.forEach(o=>o()),!this.sessionIsCancelled()&&await Jt({paymentSheetAction:i,onProceed:n,terminateSession:this.terminateSession})}async getMerchantSession(t){const n=await new Gt({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,apiVersion:"unstable"}).applePaySessionCreate(t);return JSON.parse(n)}async completePayment(t,n=void 0){_.leaveBreadcrumb("ApplePay Session completePayment",{status:t,errors:n},"log"),this.session.completePayment({status:t,errors:n}),g.authorizationComplete({instrument:this.name,measurement:Z(M.AuthorizationLatency,this.name),result:t===ApplePaySession.STATUS_SUCCESS?"success":"failed"})}getNewTotalAndLineItems(t){return{newTotal:ml(this.merchantName,t.totalAmount),newLineItems:yl({subtotal:ua(t),discountAllocations:_l(t),deliveryGroups:t.deliveryGroups,duties:t.totalDutyAmount,taxes:t.totalTaxAmount,i18n:this.i18n,formattedRecurringTotals:El(this.cart.lineItems,this.i18n)})}}async decelerateIfNeeded(t){if(!t.data)return!1;const{checkoutUrl:n,totalAmount:r}=t.data;let a;if(t.decelerationReason&&pc.includes(t.decelerationReason)?a=t.decelerationReason:Pr({currentCartTotal:r,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a){try{await this.terminateSession()}finally{F({checkoutUrl:n,instrumentName:this.name,reason:a})}return!0}return!1}get isShippingRequired(){return this.button.isShippingRequired}async removePersonalData(){this.isPersonalDataCleared||(await this.apiClient.cartRemovePersonalData({cartId:this.cart.id,instrumentName:this.name}),this.isPersonalDataCleared=!0)}onSheetLoaded(){let t=!1;(()=>{if(t)return;t=!0;const n=Z(M.SheetLoad,this.name);n&&g.sheetLoaded({instrument:this.name,measurement:n})})()}}function Lr({translate:e,logoElement:t,setAriaHidden:n}){const r=document.createElement("div");return e("buy_with_button_content",{wallet:"LOGO_PLACEHOLDER"}).split(new RegExp("(LOGO_PLACEHOLDER)")).filter(Boolean).forEach(a=>{let i;a==="LOGO_PLACEHOLDER"?i=t:(i=document.createElement("span"),i.innerText=a,n&&i.setAttribute("aria-hidden","true")),r.appendChild(i)}),r}var Ue;class yc extends Re{constructor(){super(),c(this,"name",w.ApplePay),c(this,"button",null),x(this,Ue),k(this,Ue,this.attachShadow({mode:"closed"}))}static get observedAttributes(){return["disabled"]}get merchantName(){return this.walletParams.merchantName}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button)}async handleClick(t){if(t.preventDefault(),this.disabled||!this.button||this.button.hasAttribute("aria-disabled"))return;this.disabled=!0;const[n,r,a]=await Promise.all([this.i18n,this.dataSource,this.apiClient]);ze(M.SheetLoad,this.name);let i;try{if(i=new mc({accessToken:this.accessToken,buyerCountry:this.buyerCountry,buyerCurrency:this.buyerCurrency,button:this,i18n:n,merchantName:this.merchantName,dataSource:r,apiClient:a,walletParams:this.walletParams}),!i)throw new Error("missing ApplePaySession");i.begin(),g.sheetClicked({instrument:this.name,result:"success"})}catch(o){_.notify(o),g.sheetClicked({instrument:this.name,result:"failed"}),i==null||i.terminateSession()}}async render(){var t;const{translate:n}=await this.i18n,r=new DOMParser().parseFromString(va.applePayLogo,"image/svg+xml").documentElement;if(!this.button){const a=this.isCTA?n("buy_with_button_content",{wallet:n("brand.apple_pay")}):n("brand.apple_pay");if(this.button=Mt({label:a}),this.button.onclick=i=>this.handleClick(i),this.button.classList.add("apple-pay-button",ii[this.buttonTheme],Pe.BUTTON),this.isCTA){const i=Lr({translate:n,logoElement:r,setAriaHidden:!0});i.classList.add("apple-pay--content"),this.button.appendChild(i)}else this.button.appendChild(r);this.initializeShadowStyles(C(this,Ue),ol),C(this,Ue).appendChild(this.button),this.ensureLightDOMIsNotEmpty(),(t=this.onRendered)==null||t.call(this)}this.disabled&&(this.button.setAttribute("disabled",""),this.button.setAttribute("aria-disabled","true"))}}Ue=new WeakMap;function kr(e){return function(t,n,r){const a=r.value;return r.value=function(...i){const o=a.apply(this,i);return o.eligible||console.debug("[DEBUG] ".concat(e," could not be rendered. Reason: ").concat(o.reason)),o},r}}var gc=Object.defineProperty,fc=Object.getOwnPropertyDescriptor,Da=(e,t,n,r)=>{for(var a=fc(t,n),i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=o(t,n,a)||a);return a&&gc(t,n,a),a},le;const Or=(le=class extends me{constructor(e){super(e),c(this,"companyFieldRequired"),this.companyFieldRequired=!!this.walletParams.companyRequired}static walletName(){return"apple_pay"}getWebComponentName(){return"shopify-apple-pay-button"}getWebComponentClass(){return yc}getInstrumentName(){return w.ApplePay}applePayInIframe(){return typeof window>"u"||window.self!==window.top}getLoadEligibility(){return this.applePayInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){var e,t,n,r;return typeof window>"u"||window.ApplePaySession===void 0?{eligible:!1,reason:"window or ApplePaySession is undefined"}:(t=(e=window.ApplePaySession).supportsVersion)!=null&&t.call(e,vn)?(r=(n=window.ApplePaySession).canMakePayments)!=null&&r.call(n)?{eligible:!0}:{eligible:!1,reason:"failed SDK eligibility check"}:{eligible:!1,reason:"SDK does not meet minimum version requirement"}}async loadWalletSDK(){await this.loadAppleLogo()}async loadAppleLogo(){if(le.applePayLogo=(await import("./apple-pay-logo-BZB6IYWC.js")).default,!le.applePayLogo)throw new Error("Apple Pay logo is empty")}},c(le,"applePayLogo",""),le);Da([kr("Apple Pay")],Or.prototype,"getLoadEligibility"),Da([kr("Apple Pay")],Or.prototype,"getPartnerSDKEligibility");let va=Or;const bc=".buy-with-prime-button{width:100%;height:100%;padding:12px 10px 8px;display:flex;align-items:center;justify-content:center;gap:5px;opacity:1;border-width:0px}.buy-with-prime-button:hover:enabled{background-color:#0684eb!important}.buy-with-prime-button:focus{box-shadow:0 0 0 2px #1a98ff,inset 0 0 0 2px rgb(var(--color-background))!important;outline:none!important}.buy-with-prime-button:active,.buy-with-prime-button:hover:enabled:active{background-color:#0066cd!important;box-shadow:none!important}";class Dt extends Error{constructor(){super(...arguments),c(this,"name","MissingAccessTokenError")}}class xr extends Error{constructor(){super(...arguments),c(this,"name","FetchingWalletsPlatformConfigError")}}class Mr extends Error{constructor(){super(...arguments),c(this,"name","EmptyLineItemsWalletsPlatformConfigError")}}async function Ra({configOptionsEndpoint:e,checkoutUrl:t,sourceId:n,accessToken:r,instrument:a}){try{const i=JSON.stringify({checkout_url:t,checkout_cancel_url:window.location.href,cart_id:n}),o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":r},body:i});if(o.ok)return o.json();const s=await o.json();throw s.error?new Error(s.error):new Error("Could not fetch wallets platform configs: [".concat(o.status,"] ").concat(o.statusText))}catch(i){const{message:o}=i!=null?i:{};switch(o){case"empty_line_items":throw new Mr("[Fetch Pay Config][".concat(a,"] No eligible line items provided in the config request."));default:throw new xr("[Fetch Pay Config][".concat(a,"] ").concat(o))}}}const wc={[S.Checkout]:"Checkout",[S.CartAjax]:"Cart",[S.CartPage]:"Cart",[S.ProductPage]:"Product",[S.Unknown]:"Product"};var ct;const Le=class xd extends Re{constructor(){super(...arguments),c(this,"name",w.BuyWithPrime),c(this,"button",null),c(this,"apiClientId",""),x(this,ct,this.attachShadow({mode:"closed"}))}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name),this.handleOnSendCheckoutAction=this.handleOnSendCheckoutAction.bind(this)}async createButton(){const{translate:t}=await this.i18n,n=Mt({label:t("brand.buy_with_prime")});return n.type="button",n.className="buy-with-prime-button",this.applyEnabledStyles(n),n}applyEnabledStyles(t){t.innerHTML=st.primeLogo,t.disabled=!1,Wr(t,{"background-color":"#1A98FF",color:"#FFFFFF",cursor:"pointer"})}applyDisabledStyles(t){t.innerHTML=st.primeLogoDark,t.disabled=!0,Wr(t,{"background-color":"#C0E3FF",color:"#7292AC",cursor:"not-allowed"})}async handleClick(){var t,n,r;if(!this.button)return;const[a,i]=await Promise.all([this.i18n,this.dataSource]);let o=[];try{this.applyDisabledStyles(this.button);let s=this.walletParams;if(this.apiClientId=this.apiClientId||s.appId||"",!s.createCheckoutSessionConfig){const{cart:u,decelerationReason:d,customValidationError:h}=await pe({element:this,instrumentName:this.name,dataSource:i});if(h){ve(a,h.message);return}if(d){F({checkoutUrl:(t=u==null?void 0:u.checkoutUrl)!=null?t:"",instrumentName:this.name,reason:d});return}if(!this.accessToken)throw new Dt("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");s=b({},await Ra({configOptionsEndpoint:xd.OPTIMUS_CONFIG_REST_API_URL,checkoutUrl:(n=u==null?void 0:u.checkoutUrl)!=null?n:"",sourceId:(r=jn(u))!=null?r:"",accessToken:this.accessToken,instrument:this.name}))}s.placement=this.getPlacement(),o=this.extractSKUs(s),delete s.checkoutSupportsSplitCart,delete s.appId;const l=s;this.pciEnabled&&(l.onSendCheckoutAction=this.handleOnSendCheckoutAction),window.amazon.buywithprime.initCheckout({amazonPayOptions:l}),g.sheetClicked({instrument:this.name,result:"success",webPixelMetaData:this.apiClientId?{apiClientId:this.apiClientId,skus:o,pageType:this.pageType}:void 0})}catch(s){xd.EXPECTED_ERRORS.some(d=>s instanceof d)||_.notify(s),g.sheetClicked({instrument:this.name,result:"failed",webPixelMetaData:this.apiClientId?{apiClientId:this.apiClientId,skus:o,pageType:this.pageType}:void 0});const{name:l}=s!=null?s:{name:"unknown"},{translate:u}=a;De(u("error_dialogs.wallet.title",{wallet:u("brand.buy_with_prime")}),this.getModalContent(l,u))}finally{this.applyEnabledStyles(this.button)}}getModalContent(t,n){return t==="EmptyLineItemsWalletsPlatformConfigError"?n("error_dialogs.wallet.eligibility_error",{wallet:n("brand.buy_with_prime")}):n("error_dialogs.wallet.generic_error",{wallet:n("brand.buy_with_prime")})}extractSKUs(t){var n;return(n=t.createCheckoutSessionConfig)!=null&&n.payloadJSON?JSON.parse(t.createCheckoutSessionConfig.payloadJSON).cartDetails.lineItems.map(r=>r&&r.sku).filter(r=>r):[]}getPlacement(){return this.pageType&&wc[this.pageType]||"Other"}async render(){var t;this.button||(this.button=await this.createButton(),this.button.onclick=()=>this.handleClick(),this.button.classList.add("buy-with-prime-button"),this.getPlacement().includes("Checkout")||this.button.classList.add(Pe.BUTTON),await this.initializeShadowStyles(C(this,ct),bc),C(this,ct).appendChild(this.button),(t=this.onRendered)==null||t.call(this))}buildBwpEventData(t){const n={};return t.createCheckoutSessionConfig&&(n.skus=this.extractSKUs(t),n.apiClientId=this.apiClientId),n}async handleOnSendCheckoutAction(t){const{eventName:n,redirect:r,redirectUrl:a,requestPayload:i}=t;if(r&&a){this.dispatchWalletEvent({eventName:"wallet-redirect",detail:{redirectUrl:a,requestPayload:i}});return}switch(n){case"initCheckout":{const o=this.walletParams;this.dispatchWalletEvent({eventName:"wallet-clicked",detail:{bwpEventData:this.buildBwpEventData(o)}});break}case"initChange":this.dispatchWalletEvent({eventName:"wallet-clicked"});break;case"cancelCheckout":this.dispatchWalletEvent({eventName:"wallet-cancel"});break}}};ct=new WeakMap,c(Le,"OPTIMUS_CONFIG_REST_API_URL","".concat(window.location.origin,"/wallets/config/optimus")),c(Le,"EXPECTED_ERRORS",[xr,Dt,Mr]);let dr=Le;async function Na({fn:e,maxRetries:t=3,delay:n=1e3,retryPolicyFn:r=()=>!0,onFinishedFn:a=()=>{}}){const i=()=>new Promise(l=>{setTimeout(l,n)});let o=0;const s=async()=>{try{return await e()}catch(l){if(o++,o<t&&r(l))return await i(),s();throw l}};try{return await s()}finally{a(o)}}async function _c(e){return new Promise((t,n)=>{if(document.querySelector('script[src="'.concat(e,'"]'))&&window.amazon){t();return}const r=document.createElement("script");r.src=e,r.onload=()=>{window.amazon?t():n(new Error("Amazon SDK not present after loading"))},r.onerror=()=>{n(new Tt("Error loading Amazon SDK"))},document.head.append(r)})}async function Ta({sdkUrl:e=fr,maxRetries:t=3}){return Na({fn:()=>_c(e),maxRetries:t,delay:200,retryPolicyFn:()=>!0,onFinishedFn:n=>{g.amazonPaySDKLoadRetries({retries:n})}})}const Y=class Dn extends me{static walletName(){return"buy_with_prime"}constructor(t){super(t)}getWebComponentName(){return"shopify-buy-with-prime-button"}getInstrumentName(){return w.BuyWithPrime}getWebComponentClass(){return dr}async loadWalletSDK(){await Ta({sdkUrl:Dn.SDK_URL,maxRetries:Dn.MAX_RETRIES}),await this.loadLogos()}async loadLogos(){await Promise.all([this.loadPrimeLogo(),this.loadPrimeLogoDark()])}async loadPrimeLogo(){if(Dn.primeLogo=(await import("./prime-logo-DoVHKBSO.js")).default,!Dn.primeLogo)throw new Error("Buy with Prime logo is empty")}async loadPrimeLogoDark(){if(Dn.primeLogoDark=(await import("./prime-logo-dark-DJIA6J0w.js")).default,!Dn.primeLogoDark)throw new Error("Buy with Prime logo dark is empty")}};c(Y,"MAX_RETRIES",3),c(Y,"SDK_URL",fr),c(Y,"primeLogo",""),c(Y,"primeLogoDark","");let st=Y;const Ec="shopify-amazon-pay-button div[role=button][slot=amazon-pay-slot][data-testid=amazon-pay-button]{border-radius:0!important}",dn="amazon-pay-slot";var dt,ut,$e,W,se,we,_e;const ke=class Ld extends Re{constructor(){super(),c(this,"name",w.AmazonPay),c(this,"resizeObserver",null),x(this,dt,0),x(this,ut,0),x(this,$e,!1),x(this,W,null),x(this,se,null),x(this,we,null),x(this,_e),k(this,_e,this.attachShadow({mode:"closed"})),this.resizeObserver=Ve("ResizeObserver",()=>this.onResize())}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){var t;this.innerHTML="",C(this,_e).innerHTML="",this.teardownAmazonButtonContainer(),(t=this.resizeObserver)==null||t.disconnect()}async handleClick(t){var n,r;const[a,i]=await Promise.all([this.i18n,this.dataSource]);try{const{cart:o,decelerationReason:s,customValidationError:l}=await pe({element:this,instrumentName:this.name,dataSource:i});if(l){ve(a,l.message);return}if(s){F({checkoutUrl:(n=o==null?void 0:o.checkoutUrl)!=null?n:"",instrumentName:this.name,reason:s});return}const{totalAmount:{amount:u},checkoutUrl:d}=o;let h=this.walletParams;if(!h.createCheckoutSessionConfig){if(!this.accessToken)throw new Dt("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");h=T(b({},await Ra({configOptionsEndpoint:Ld.CV2_CONFIG_REST_API_URL,checkoutUrl:d,sourceId:(r=jn(o))!=null?r:"",accessToken:this.accessToken,instrument:this.name})),{placement:this.pageType===S.ProductPage?"Product":"Cart"})}delete h.appId,t.initCheckout(b(b({},h),Number(u)!==0&&{estimatedOrderAmount:{amount:u,currencyCode:this.buyerCurrency}})),g.sheetClicked({instrument:this.name,result:"success"})}catch(o){Ld.EXPECTED_ERRORS.some(l=>o instanceof l)||_.notify(o),g.sheetClicked({instrument:this.name,result:"failed"});const s=a.translate("brand.amazon_pay");J(s,a)}}createContainer({containerID:t,height:n}){const r=document.createElement("div");return r.id=t,r.style.display="flex",n!=null&&(r.style.height="".concat(n,"px")),r.slot=dn,r.setAttribute("data-testid","amazon-pay-button"),r}async onResize(){const t=St(C(this,W))||0,n=It(C(this,W))||0,r=C(this,dt)!==t||C(this,ut)!==n;!C(this,$e)&&r&&(this.teardownAmazonButtonContainer(),await this.cleanupOnFailure(()=>this.renderFromAmazonSDK(),this.name))}async render(){var t;try{const n=document.createElement("slot");n.name=dn;const r=document.createElement("style");r.textContent=Ec,this.appendChild(r),await this.initializeShadowStyles(C(this,_e));const a=await this.containerInstanceNumber;k(this,se,"AcceleratedCheckoutAmazonPayButtonContainer".concat(this.pageType).concat(a)),k(this,W,document.createElement("div")),C(this,W).classList.add(Pe.BUTTON),C(this,W).appendChild(n),C(this,_e).appendChild(C(this,W)),(t=this.resizeObserver)==null||t.observe(C(this,W)),await this.renderFromAmazonSDK()}catch(n){_.notify(n)}}async renderFromAmazonSDK(){var t;try{k(this,$e,!0);const n=It(C(this,W))||0;k(this,we,this.createContainer({containerID:C(this,se),height:n})),this.appendChild(C(this,we));const r=St(C(this,W))||0,a={buttonBorderRadius:"".concat(r,"px")},i=window.amazon.Pay.renderButton("#".concat(C(this,se)),T(b({},this.walletParams),{style:a,placement:this.pageType===S.ProductPage?"Product":"Cart"}));i==null||i.onClick(()=>this.handleClick(i)),k(this,ut,n),k(this,dt,r),g.renderSucceeded(this.name),(t=this.onRendered)==null||t.call(this)}catch(n){g.renderFailed(this.name);const r="Amazon Pay Button not able to render into container #".concat(C(this,se),".");console.error(r),g.log({body:r,attributes:{pageType:this.pageType,containerID:C(this,se),error:n==null?void 0:n.toString()}})}finally{k(this,$e,!1)}}teardownAmazonButtonContainer(){var t;(t=C(this,we))==null||t.remove(),k(this,we,null)}};dt=new WeakMap,ut=new WeakMap,$e=new WeakMap,W=new WeakMap,se=new WeakMap,we=new WeakMap,_e=new WeakMap,c(ke,"CV2_CONFIG_REST_API_URL","".concat(window.location.origin,"/wallets/config/amazon_pay")),c(ke,"EXPECTED_ERRORS",[xr,Dt,Mr]);let ur=ke;const Oe=class Od extends me{static walletName(){return"amazon_pay"}constructor(t){super(t)}getWebComponentName(){return"shopify-amazon-pay-button"}getInstrumentName(){return w.AmazonPay}getWebComponentClass(){return ur}async loadWalletSDK(){await Ta({sdkUrl:Od.SDK_URL,maxRetries:Od.MAX_RETRIES})}getLoadEligibility(t){return t.getRootNode()instanceof ShadowRoot?{eligible:!1,reason:"Cannot load Amazon Pay within Shadow DOM"}:{eligible:!0}}};c(Oe,"MAX_RETRIES",3),c(Oe,"SDK_URL",fr);let hr=Oe;var er={Purple:{D0:"#4524DB",Primary:"#5433EB"},Grayscale:{White:"#FFFFFF"}},Ac={s:16},Cc=class extends HTMLElement{static get observedAttributes(){return["disabled"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this._updateButton()}attributeChangedCallback(){this._updateButton()}_updateButton(){var e;let t=this.shadowRoot;t&&(t.innerHTML=Ic,this.hasAttribute("disabled")&&((e=this.shadowRoot.querySelector("button"))==null||e.setAttribute("disabled","")))}};function Sc(){window.customElements&&(customElements.get("gravity-button")||customElements.define("gravity-button",Cc))}var Ic="\n<style>\n * {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n --focused-box-shadow: 0 0 0 3px #DBD1FF, 0 0 #0000;\n }\n\n button {\n text-transform: none;\n -webkit-appearance: button;\n background-color: transparent;\n background-image: none;\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n\n button:disabled {\n cursor: default;\n opacity: 0.5;\n }\n\n .gravity-button {\n position: relative;\n display: flex;\n min-height: var(--gravity-button-min-height);\n height: var(--gravity-button-height);\n width: var(--gravity-button-width, 260px);\n justify-content: center;\n color: ".concat(er.Grayscale.White,";\n align-items: center;\n overflow: visible;\n padding: var(--gravity-button-padding, ").concat(Ac.s,"px 10px);\n border-radius: var(--gravity-button-border-radius);\n border: none;\n background-color: ").concat(er.Purple.Primary,";\n transition: all;\n }\n\n .gravity-button:not([disabled]):focus-visible {\n box-shadow: var(--focused-base-box-shadow, var(--focused-box-shadow));\n outline: var(--focused-base-outline, 2px solid transparent);\n outline-offset: var(--focused-base-outline-offset, 2px);\n }\n\n .gravity-button:not([disabled]):hover {\n background-color: ").concat(er.Purple.D0,';\n }\n</style>\n\n<button class="gravity-button">\n <slot id="button-content"></slot>\n</button>\n');const Pc=".button-content{display:flex;align-items:center;justify-content:center;width:100%;height:100%;gap:3px;white-space:nowrap;container-type:inline-size;container-name:bc}.ShopPromise>.separator{margin:0 8px}@container bc (width <= 338px){.ShopPromise{display:none!important}}gravity-button{display:block}",Dc='.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}}.accelerated-checkout-button{--gravity-button-height: clamp(25px, var(--shopify-accelerated-checkout-button-block-size, 44px), 55px);--gravity-button-min-height: clamp(25px, var(--shopify-accelerated-checkout-button-block-size, 44px), 55px);--gravity-button-border-radius: var(--shopify-accelerated-checkout-button-border-radius, 0px);--gravity-button-padding: 0px 10px;--gravity-button-width: 100%}:host([page-type="cart_page"]) .accelerated-checkout-button{--gravity-button-height: 100%;--gravity-button-min-height: 100%;--gravity-button-border-radius: var(--shopify-accelerated-checkout-button-border-radius, 4px);--gravity-button-width: 100%}';class La extends Error{constructor(){const t="DeliveryEstimatesResponseIsNullError";super("deliveryEstimates is null or undefined"),this.name=t}}class tr extends Error{constructor(){const t="DeliveryPromiseAPIClientError";super("window.Shopify.ShopPromise.deliveryPromiseAPIClient is undefined"),this.name=t}}const vc=15,Rc=200;class Nc{constructor(t){c(this,"storefrontAPIToken"),this.storefrontAPIToken=t}async fetchDeliveryPromise({variant:t,postalCode:n,defaultPostalCode:r,sellingPlanId:a}){const i=await Na({fn:async()=>this.fetchDeliveryOptions(t,n,r,a),maxRetries:vc,delay:Rc,retryPolicyFn:o=>o instanceof tr}).catch(o=>{if(o instanceof tr)throw o;return null});if(!i)throw new La;return i}async fetchDeliveryOptions(t,n,r,a){var i,o;const s={variantId:t,sellingPlanId:a,postalCode:n||r,isPostalCodeOverride:!!n},l=(o=(i=window==null?void 0:window.Shopify)==null?void 0:i.ShopPromise)==null?void 0:o.deliveryPromiseAPIClient;if(!l)throw new tr;return l(s,this.storefrontAPIToken)}}function Tc(e,t){switch(e){case 0:return(t==null?void 0:t.translate("shop_promise_delivery.same_day"))||null;case 1:return(t==null?void 0:t.translate("shop_promise_delivery.next_day"))||null;case 2:return(t==null?void 0:t.translate("shop_promise_delivery.two_day"))||null;default:return null}}const Lc="delivery_promise_default_address",kc="delivery_promise_postal_code";class Oc extends Ut{constructor(){super(...arguments),c(this,"lastFetchedProductVariantId"),c(this,"lastFetchSellingPlan"),c(this,"fetching",!1),c(this,"i18n",null),c(this,"daysToDelivery"),c(this,"formObserver",null)}async connectedCallback(){this.formObserver=new ra(this,({variantId:t,sellingPlanId:n})=>{this.fetchDeliveryPromise(t,n)}),this.formObserver.setupMutationObservers()}setTranslations(t){this.i18n=t,this.render()}get postalCode(){try{return JSON.parse(ot(kc)||"null")||null}catch(t){return null}}get defaultDeliveryAddress(){try{return JSON.parse(ot(Lc)||"null")}catch(t){return null}}async fetchDeliveryPromise(t,n){var r,a,i,o;if(!(!t||!this.accessToken)&&!(t===this.lastFetchedProductVariantId&&n===this.lastFetchSellingPlan))try{this.lastFetchedProductVariantId=t,this.lastFetchSellingPlan=n;const s=((r=this.defaultDeliveryAddress)==null?void 0:r.zip)||"",l=await new Nc(this.accessToken).fetchDeliveryPromise({variant:t,postalCode:this.postalCode||"",defaultPostalCode:s,sellingPlanId:n||""}),u=Nr(this),d=(i=(a=l==null?void 0:l.selectedShippingOption)==null?void 0:a.brandedPromise)==null?void 0:i.handle;if((u==null?void 0:u.sellingPlanId)!==n||(u==null?void 0:u.variantId)!==t||d!=="shop_promise")return;this.daysToDelivery=(o=l==null?void 0:l.selectedShippingOption)==null?void 0:o.maxCalendarDaysToDelivery,this.render()}catch(s){s instanceof La&&(this.daysToDelivery=null)}}render(){const t=Tc(this.daysToDelivery,this.i18n);this.classList.add("ShopPromise"),this.innerHTML=t?'<span class="separator">|</span><span>'.concat(t,"</span>"):""}}var Ee;class xc extends Re{constructor(){super(),c(this,"name",w.ShopPay),c(this,"button",null),c(this,"shopPromiseProductPageContent",null),c(this,"shopPromiseEligible",!1),x(this,Ee),k(this,Ee,this.attachShadow({mode:"closed"}))}static get observedAttributes(){return["disabled"]}connectedCallback(){this.shopPromiseEligible=Yn(),this.cleanupOnFailure(async()=>{Sc(),await this.render()},this.name)}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button)}async addButtonContent(){if(!this.button)return;let t;const n=await this.i18n,r=new DOMParser().parseFromString(Oa.shopPayLogoElement,"image/svg+xml").documentElement;this.isCTA?t=Lr({translate:n.translate,logoElement:r,setAriaHidden:!1}):(t=document.createElement("div"),t.appendChild(r)),t.classList.add("button-content"),this.shopPromiseEligible&&!this.shopPromiseProductPageContent&&(this.shopPromiseProductPageContent=document.createElement("shop-promise-product-page-content"),this.shopPromiseProductPageContent.setTranslations(n),this.shopPromiseProductPageContent.setAttribute("access-token",this.accessToken||""),t.appendChild(this.shopPromiseProductPageContent)),this.button.appendChild(t)}getShopPayBehavior(){return this.pageType===S.ProductPage?"force_shop_pay_product":this.pageType===S.CartPage?"force_shop_pay_cart":"force_shop_pay"}async handleClick(t){var n,r;if(t.preventDefault(),this.disabled||!this.button||this.button.getAttribute("disabled"))return;this.disabled=!0;const[a,i]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:o,cart:s,customValidationError:l}=await pe({element:this,instrumentName:w.ShopPay,dataSource:i});if(g.sheetClicked({instrument:this.name,result:"success"}),l){ve(a,l.message);return}if(o){F({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:this.name,reason:o});return}de((r=s==null?void 0:s.checkoutUrl)!=null?r:"",this.getShopPayBehavior())}catch(o){_.notify(new Mc("An error occurred when attempting to create a cart using the Shop Pay Button. Details: ".concat(o),{cause:o})),g.sheetClicked({instrument:this.name,result:"failed"}),De(a.translate("error_dialogs.checkout.title"),a.translate("error_dialogs.checkout.generic_error"))}}async render(){if(C(this,Ee).innerHTML)return;this.button||(this.button=document.createElement("gravity-button"));const t=document.createElement("style");t.innerHTML=[Dc,Pc].join("\n"),C(this,Ee).appendChild(t),await this.addButtonContent(),this.disabled&&this.button.setAttribute("disabled",""),this.button.classList.add(Pe.BUTTON),this.button.onclick=n=>this.handleClick(n),C(this,Ee).appendChild(this.button),this.ensureLightDOMIsNotEmpty(),this.onRendered()}}Ee=new WeakMap,he("shop-promise-product-page-content",Oc);class Mc extends Error{constructor(){super(...arguments),c(this,"name","ShopPayButtonError")}}var Fc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,$c=(e,t,n,r)=>{for(var a=Uc(t,n),i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=o(t,n,a)||a);return a&&Fc(t,n,a),a},Ae;const ka=(Ae=class extends me{static walletName(){return"shop_pay"}constructor(e){super(e)}getWebComponentName(){return"shop-pay-wallet-button"}getWebComponentClass(){return xc}getInstrumentName(){return w.ShopPay}async loadWalletSDK(){await this.loadLogo()}getLoadEligibility(){return{eligible:!0}}async loadLogo(){Ae.shopPayLogoElement=(await import("./shop-pay-logo-CYhOC7ye.js")).default}},c(Ae,"shopPayLogoElement"),Ae);$c([kr("Shop Pay")],ka.prototype,"getLoadEligibility");let Oa=ka;const Bc=".button{display:flex;justify-content:center;align-items:center;width:100%;border:none}.button:hover:not(:disabled){filter:brightness(92%);cursor:pointer}.button:disabled{opacity:.5;cursor:not-allowed}.logo-only>svg{width:50px}.dark{background:#000;color:#fff}.light{background:#fff;color:#000;outline:1px solid #3c4043}@media (forced-colors: active){.light{outline:none}}.content{display:flex;justify-content:center;align-items:center;white-space:pre}";function rr({cart:e,i18n:t}){const n=ua(e),r={label:t.translate("order_summary.subtotal"),type:"SUBTOTAL",price:Se(n.amount)},a=ca({deliveryGroups:e.deliveryGroups,i18n:t}).map(s=>Hc({lineItem:s,type:"LINE_ITEM"})),i=Gc(e,t),o=[r,...a,...i];if(e.totalDutyAmount){const s={label:t.translate("order_summary.duties"),type:"LINE_ITEM",price:Se(e.totalDutyAmount.amount)};o.push(s)}if(e.totalTaxAmount){const s={label:t.translate("order_summary.taxes"),type:"TAX",price:Se(e.totalTaxAmount.amount)};o.push(s)}return{totalPrice:e.totalAmount.amount,currencyCode:e.totalAmount.currencyCode,totalPriceStatus:"ESTIMATED",totalPriceLabel:t.translate("order_summary.total"),displayItems:o}}function Hc({lineItem:e,type:t,status:n="FINAL"}){return{label:e.label,type:t,price:e.amount,status:n}}function Gc(e,t){return[...e.lineItems.flatMap(n=>n.discountAllocations),...e.discountAllocations].flatMap(n=>{var r;const a=(r=n.title)!=null?r:n.code;return{label:a!=null?a:t.translate("order_summary.discount"),type:"LINE_ITEM",price:"-".concat(Se(Number(n.discountedAmount.amount)))}})}const xa=["PAYMENT_AUTHORIZATION"],Vc=xa.concat(["SHIPPING_ADDRESS","SHIPPING_OPTION"]),zc=["PAN_ONLY"];function qc({walletParams:e,isShippingRequired:t,hasSellingPlan:n,i18n:r,buyerCurrency:a,authJwt:i}){const o={totalPrice:"0.01",currencyCode:a,totalPriceStatus:"ESTIMATED",totalPriceLabel:r.translate("order_summary.total"),displayItems:[{label:r.translate("order_summary.subtotal"),type:"SUBTOTAL",price:"0.01"}]},s=T(b({},e.paymentData),{shippingAddressRequired:t,shippingOptionRequired:t,transactionInfo:o});return s.merchantInfo.authJwt=i,t||delete s.shippingAddressParameters,s.callbackIntents=t?Vc:xa,n&&jc(s),s}function jc(e){e.allowedPaymentMethods.forEach(t=>{t.parameters.allowedAuthMethods=t.parameters.allowedAuthMethods.filter(n=>zc.includes(n))})}class Yc extends da{constructor(t){super(),c(this,"brandName"),c(this,"completionResult"),this.i18n=t,this.brandName=this.i18n.translate("brand.google_pay"),this.completionResult=void 0}mapMutationResultToPaymentSheetAction(t){const n=this.mapCustomValidationFunctionErrorToAction(t.errors);if(n)return n;const r=this.getErrorActions(),a=t.errors,i=this.getUnhandledErrors(a,r);i.forEach(s=>{_.notify(new Pt("[".concat(w.GooglePay,"] mutation result error not handled: ").concat(s)))});const{firstPaymentSheetAction:o}=this.getMergedPaymentSheetAction({result:t,errorActions:r});return o||(i.length>0?{action:"abort"}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction(t){if(!t.data)throw new Error("[".concat(w.GooglePay,"] completion returned null result"));switch(this.completionResult=t,t.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:t.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const n=this.mapCustomValidationFunctionErrorToAction(t.errors);if(n)return n;const r=this.getErrorActions(),a=t.errors;this.getUnhandledErrors(a,r).forEach(o=>{_.notify(new Error("[".concat(w.GooglePay,"] completion result error not handled: ").concat(o)))});const{prioritizedPaymentSheetAction:i}=this.getMergedPaymentSheetAction({result:t,errorActions:r});return i||(J(this.brandName,this.i18n),{action:"abort"})}default:throw new Error("[".concat(w.GooglePay,"] unknown completion result type: ").concat(t.data.__typename))}}getErrorActions(){return[{errors:[m.CaptchaCompletionRequired],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:w.GooglePay,errorOrWarning:m.CaptchaCompletionRequired,result:this.completionResult})},{errors:[m.InvalidLanguage],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(w.GooglePay,"] mutation provided invalid language, aborting")))},()=>J(this.brandName,this.i18n)]})},{errors:[m.InvalidCountry],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(w.GooglePay,"] mutation provided invalid country, aborting")))},()=>J(this.brandName,this.i18n)]})},{errors:[m.MissingCartId],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(w.GooglePay,"] mutation provided invalid cart ID, aborting")))},()=>J(this.brandName,this.i18n)]})},{errors:Ir,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:w.GooglePay,errorOrWarning:m.NewTaxMustBeAccepted,result:this.completionResult})},{errors:[m.MerchandiseExpectedPriceMismatch,m.DeliveryLineChanged,m.DeliveryLocalPickupLineChanged,...Qn],generateAction:()=>({action:"abort",effects:[()=>J(this.brandName,this.i18n)]})},{errors:[m.UnsupportedGooglePayPaymentMethod],generateAction:()=>({action:"abort",effects:[()=>J(this.brandName,this.i18n),()=>{_.notify(new Pt("[".concat(w.GooglePay,"] payment method is not supported")))}]})},{errors:[m.MerchandiseNotEnoughStock],generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:w.GooglePay,errorOrWarning:m.MerchandiseNotEnoughStock,result:this.completionResult})},{errors:Xn,generateAction:()=>this.decelerateOrAbort({reason:"out_of_stock",instrumentName:w.GooglePay,errorOrWarning:m.MerchandiseOutOfStock,result:this.completionResult})},{errors:Kn,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.shipping_address")}]})},{errors:Wn,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}]})},{errors:[m.NoDeliveryGroupSelected],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_OPTION_INVALID",intent:"SHIPPING_OPTION",message:this.i18n.translate("errors.missing.shipping_option")}]})},{errors:[m.BuyerIdentityEmailDomainInvalid,m.BuyerIdentityEmailNotExpectedPattern,m.BuyerIdentityEmailInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.email")}]})},{errors:[m.BuyerIdentityEmailRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.email")}]})},{errors:[m.DeliveryAddress2Required,m.DeliveryAddress2AddressFieldRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address2")}]})},{errors:[m.DeliveryAddress2Invalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address2")}]})},{errors:[m.DeliveryCityAddressFieldRequired,m.DeliveryCityRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.city")}]})},{errors:[m.DeliveryCityInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.city")}]})},{errors:[m.DeliveryZoneRequiredForCountry],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.zone")}]})},{errors:[m.DeliveryZoneNotFound],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.zone")}]})},{errors:[m.DeliveryPostalCodeRequired,m.DeliveryPostalCodeAddressFieldRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.postal_code")}]})},{errors:[m.DeliveryPostalCodeInvalid,m.DeliveryInvalidPostalCodeForZone,m.DeliveryInvalidPostalCodeForCountry,m.DeliveryZipInvalidForCountry],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}]})},{errors:[m.DeliveryPhoneNumberRequired],generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.phone_number")}]})},{errors:[m.DeliveryPhoneNumberInvalid,m.BuyerIdentityInvalidPhone,m.DeliveryPhoneDoesNotMatchExpectedPattern],generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.phone_number")}]})},{errors:[m.BuyerIdentityInvalidCountry,m.DeliveryCountryInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.country")}]})},{errors:[m.DeliveryFirstNameRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.first_name")}]})},{errors:[m.DeliveryFirstNameInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.first_name")}]})},{errors:[m.DeliveryLastNameRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.last_name")}]})},{errors:[m.DeliveryLastNameInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.last_name")}]})},{errors:[m.DeliveryAddress1Required],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address1")}]})},{errors:[m.DeliveryAddress1Invalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address1")}]})},{errors:[m.DeliveryLastNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.last_name")}]})},{errors:[m.DeliveryCityContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.city")}]})},{errors:[m.DeliveryAddress1ContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address1")}]})},{errors:[m.DeliveryAddress2ContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address2")}]})},{errors:[m.DeliveryPostalCodeContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.postal_code")}]})},{errors:[m.DeliveryAddress1TooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address1")}]})},{errors:[m.DeliveryAddress2TooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address2")}]})},{errors:[m.DeliveryFirstNameTooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.first_name")}]})},{errors:[m.DeliveryLastNameTooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.last_name")}]})},{errors:[m.DeliveryCityTooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.city")}]})},{errors:[m.DeliveryFirstNameContainsUrl],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.first_name")}]})},{errors:[m.DeliveryLastNameContainsUrl],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.last_name")}]})},{errors:[m.DeliveryAddress1ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address1")}]})},{errors:[m.DeliveryAddress2ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address2")}]})},{errors:[m.DeliveryCityContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.city")}]})},{errors:[m.DeliveryFirstNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.first_name")}]})},{errors:[m.DeliveryLastNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.last_name")}]})},{errors:[m.InvalidPaymentGooglePayBillingAddress],generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.billing_address")}]})}]}mapCustomValidationFunctionErrorToAction(t){const n=Cr(t);return n?(_.notify(new Error("[".concat(w.GooglePay,"] custom validation function error: ").concat(JSON.stringify(t)))),Sr(this.i18n.translate("error_dialogs.wallet.title",{wallet:this.brandName}),n.message),{action:"abort"}):null}}function Wc({deliveryGroups:e,i18n:t}){var n;const r=cl(sa({deliveryGroups:e}),t),a=r.map(({handle:o,title:s,description:l})=>({id:o,label:s!=null?s:"",description:l})),i=(n=r.find(o=>{var s;return o.handle.includes(((s=e[0].selectedDeliveryOption)==null?void 0:s.handle)||"")}))==null?void 0:n.handle;return{shippingOptions:a,defaultSelectedOptionId:i}}function nr(e){let t=e.administrativeArea,n=e.locality;e.countryCode==="AE"&&(n=e.administrativeArea,e.administrativeArea in un&&(t=un[e.administrativeArea])),e.countryCode==="MX"&&t&&(t=Kc(t));let r,a;if(e.name){const[i,...o]=(e.name||"").split(" ");o.length===0?a=i:a=o.join(" "),r=i}return{firstName:r,lastName:a,address1:e.address1,address2:e.address2,city:n,province:t,country:e.countryCode,phone:e.phoneNumber,zip:e.postalCode}}const un={"\u0623\u0628\u0648 \u0638\u0628\u064A":"AZ","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651":"SH",\u0627\u0644\u0641\u062C\u064A\u0631\u0629:"FU",\u0639\u062C\u0645\u0627\u0646:"AJ","\u0631\u0623\u0633 \u0627\u0644\u062E\u064A\u0645\u0629":"RK","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062E\u064A\u0645\u0629":"RK","\u0623\u0645 \u0627\u0644\u0642\u064A\u0648\u064A\u0646":"UQ","\u0627\u0645 \u0627\u0644\u0642\u064A\u0648\u064A\u0646":"UQ",\u062F\u0628\u064A:"DU","\u0625\u0645\u0627\u0631\u0629 \u062F\u0628\u064A\u0651":"DU"},Kc=e=>e==="M\xE9x."?"MEX":e==="Q.R."?"Q ROO":e.replace(/\./g,"").toUpperCase();class ar extends Error{constructor(){super(...arguments),c(this,"name","GooglePayError")}}function Ma(e){const t=e.auth;if(!(Array.isArray(t)&&t.length>0))return{result:"error",reason:"invalidAuthParams"};const n=et();for(const r of t)if(n<r.expiresAt*1e3)return{result:"success",jwt:r.jwt};return{result:"error",reason:"authJwtExpired"}}const Qc=27e3,Xc="Google Pay Timeout";var ht,re,Be;class Jc{constructor({walletParams:t,isShippingRequired:n,hasSellingPlan:r,dataSource:a,button:i,i18n:o,cartClient:s,buyerCurrency:l,abortController:u}){c(this,"name",w.GooglePay),c(this,"walletParams"),c(this,"cart",null),c(this,"isShippingRequired"),c(this,"hasSellingPlan"),c(this,"dataSource"),c(this,"button"),c(this,"paymentsClient"),c(this,"i18n"),c(this,"actionGenerator"),c(this,"cartClient"),c(this,"initialBuyerCurrency"),c(this,"customValidationError"),x(this,ht),x(this,re),x(this,Be),c(this,"onPaymentDataChanged",async p=>{var y;const{callbackTrigger:E,shippingAddress:f,shippingOptionData:A}=p,{translate:I}=this.i18n;switch(E){case"INITIALIZE":{if(!this.cart)try{const{cart:G,customValidationError:Vt,decelerationReason:N}=await pe({element:this.button,instrumentName:w.GooglePay,dataSource:this.dataSource});if(Vt)return this.customValidationError=Vt,this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.customValidationError.message,intent:"SHIPPING_ADDRESS"}});if(N)return F({checkoutUrl:(y=G==null?void 0:G.checkoutUrl)!=null?y:"",instrumentName:this.name,reason:N}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});this.cart=G,g.sheetClicked({instrument:this.name,result:"success"})}catch(G){return g.sheetClicked({instrument:this.name,result:"failed"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}let O=!1;if(f)try{return await this.handleShippingAddressChange(this.cart.id,f)}catch(G){O=!0}return b({newTransactionInfo:rr({cart:this.cart,i18n:this.i18n})},O?this.showPaymentDataRequestError():{})}case"SHIPPING_ADDRESS":return this.customValidationError?this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.customValidationError.message,intent:"SHIPPING_ADDRESS"}}):this.cart?f?this.handleShippingAddressChange(this.cart.id,f):{newTransactionInfo:rr({cart:this.cart,i18n:this.i18n})}:this.showPaymentDataRequestError({intent:E});case"SHIPPING_OPTION":{if(!this.cart)return this.showPaymentDataRequestError({intent:E});if(!A||!A.id)return{error:{reason:"SHIPPING_OPTION_INVALID",message:I("shipping_methods.choose_delivery_strategy"),intent:"SHIPPING_OPTION"}};const O=await this.handleDeliveryOptionChange(A.id.split(","));return O.data?(this.cart=O.data,this.handlePaymentDataRequestUpdate({result:O,intent:E})):this.showPaymentDataRequestError({intent:E})}default:return this.logException("Payment data changed callback returned unexpected intent: ".concat(E),{severity:"warning"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}}),c(this,"onPaymentAuthorized",async p=>{var y,E,f;g.authorizationAttempt(this.name),ze(M.AuthorizationLatency,this.name);const A=(y=p.paymentMethodData.info)==null?void 0:y.billingAddress,I=p.shippingAddress,{signature:O,signedMessage:G,protocolVersion:Vt}=JSON.parse(p.paymentMethodData.tokenizationData.token);if(!A)return this.handlePaymentAuthorizationError({error:{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.billing_address")}});if(this.isShippingRequired&&!I)return this.handlePaymentAuthorizationError({error:{reason:"SHIPPING_ADDRESS_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.shipping_address")}});const N=async()=>{var B,L;const mt=(B=C(this,ht))!=null?B:p.email,ne=this.isShippingRequired?{validateAddress:!0,streetAddress:nr(I)}:{};return await xe(b({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:this.name,emailAddress:mt,abortSignal:(L=C(this,re))==null?void 0:L.signal},ne))},$=async()=>{var B;const L=nr(A);return await Tr({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{googlePayWalletContent:{billingAddress:L,signature:O,signedMessage:G,protocolVersion:Vt}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:L,cartClient:this.cartClient,instrumentName:this.name,hasSellingPlan:this.hasSellingPlan,abortSignal:(B=C(this,re))==null?void 0:B.signal})};try{const B=setTimeout(()=>{var Fd;(Fd=C(this,re))==null||Fd.abort("Google Pay Timeout")},Qc),L=await N(),mt=this.handleIntermediatePaymentAuthorizationResult(L);if(mt)return mt;const ne=await $(),Md=this.handleIntermediatePaymentAuthorizationResult(ne);if(Md)return Md;if(clearTimeout(B),(f=(E=C(this,re))==null?void 0:E.signal)!=null&&f.aborted)throw new ar("Abort Controller was not aborted");const Ud=await Ia({cartId:this.cart.id,token:O,cartClient:this.cartClient,instrumentName:this.name});at({result:Ud,instrument:this.name});const zd=this.actionGenerator.mapCompletionResultToPaymentSheetAction(Ud);return this.handlePaymentAuthorizationResult(zd)}catch(B){const{message:L}=B;return L!=null&&L.includes(Xc)?this.handlePaymentAuthorizationError({status:"timeout"}):(this.logException(L),this.handlePaymentAuthorizationError())}}),c(this,"handlePaymentAuthorizationResult",async p=>{var y,E;switch((y=p.effects)==null||y.forEach(f=>f()),p.action){case"complete":return this.emitAuthorizationCompleteMetric("success"),de(p.redirectUrl),{transactionState:"SUCCESS"};case"show_error":return this.handlePaymentAuthorizationError({error:(E=p.errors)==null?void 0:E[0]});case"decelerate":return F({checkoutUrl:p.redirectUrl,instrumentName:this.name,reason:p.reason}),this.emitAuthorizationCompleteMetric("failed"),{transactionState:"SUCCESS"};case"abort":default:return this.emitAuthorizationCompleteMetric("failed"),{transactionState:"SUCCESS"}}}),this.walletParams=t,this.isShippingRequired=n,this.hasSellingPlan=r,this.dataSource=a,this.button=i,this.i18n=o,this.cartClient=s,this.initialBuyerCurrency=l,k(this,ht,t.customerAccountEmail),k(this,re,u);const d=Ma(this.walletParams);if(d.result==="error")throw _.leaveBreadcrumb("Google Pay Invalid AuthJwt detected on click",{reason:d.reason,walletParams:this.walletParams},"error"),new ar(d.reason);k(this,Be,d.jwt);const h={environment:this.walletParams.environment,merchantInfo:T(b({},this.walletParams.paymentData.merchantInfo),{authJwt:C(this,Be)}),paymentDataCallbacks:{onPaymentDataChanged:this.isShippingRequired?this.onPaymentDataChanged:void 0,onPaymentAuthorized:this.onPaymentAuthorized}};this.paymentsClient=new window.google.payments.api.PaymentsClient(h),this.actionGenerator=new Yc(this.i18n)}async handleClick(){if(!this.isShippingRequired)throw new Tt("Google Pay checkout started for digital cart");const t=qc({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,i18n:this.i18n,buyerCurrency:this.initialBuyerCurrency,authJwt:C(this,Be)});await this.paymentsClient.loadPaymentData(t)}showPaymentDataRequestError({error:t,intent:n="SHIPPING_ADDRESS"}={}){return t?{error:t}:{error:{intent:n,reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.wallet.generic_error",{wallet:this.i18n.translate("brand.google_pay")})}}}handlePaymentAuthorizationError({error:t,status:n="failed"}={}){return this.emitAuthorizationCompleteMetric(n),b({transactionState:"ERROR"},this.showPaymentDataRequestError({error:t,intent:"PAYMENT_AUTHORIZATION"}))}handlePaymentDataRequestUpdate({result:t,intent:n}){var r,a;const i=this.actionGenerator.mapMutationResultToPaymentSheetAction(t);switch(i.action){case"update":{const o=i,{data:s,decelerationReason:l}=t;return s?l?(F({checkoutUrl:s.checkoutUrl,instrumentName:this.name,reason:l}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}})):this.isShippingRequired&&s.deliveryGroups.length===0?this.showPaymentDataRequestError({error:{reason:"SHIPPING_ADDRESS_INVALID",message:this.i18n.translate("errors.address_unserviceable",{shopName:this.walletParams.paymentData.merchantInfo.merchantName}),intent:"SHIPPING_ADDRESS"}}):{newTransactionInfo:rr({cart:s,i18n:this.i18n}),newShippingOptionParameters:this.isShippingRequired?Wc({deliveryGroups:s.deliveryGroups,i18n:this.i18n}):void 0,error:(r=o.errors)==null?void 0:r[0]}:this.showPaymentDataRequestError({intent:n})}case"show_error":return{error:(a=i.errors)==null?void 0:a[0]};case"abort":return this.showPaymentDataRequestError({intent:n});default:return this.logException("Payment sheet update returned unexpected action (see request tab for details)",{metadata:{request:{action:i.action,intent:n}}}),this.showPaymentDataRequestError({intent:n})}}handleIntermediatePaymentAuthorizationResult(t){var n,r,a,i;if(at({result:t,instrument:this.name}),t.decelerationReason)return F({checkoutUrl:(r=(n=t.data)==null?void 0:n.checkoutUrl)!=null?r:"",instrumentName:this.name,reason:t.decelerationReason}),{transactionState:"SUCCESS"};const o=this.actionGenerator.mapMutationResultToPaymentSheetAction(t);if(((a=t.errors)==null?void 0:a.length)>0){const s=o;if(s.action==="show_error")return this.handlePaymentAuthorizationError({error:(i=s.errors)==null?void 0:i[0]})}}handleCurrencyChange(t,n){Pr({currentCartTotal:n,initialBuyerCurrency:this.initialBuyerCurrency})&&F({checkoutUrl:t,instrumentName:this.name,reason:"currency_changed"})}async handleShippingAddressChange(t,n){var r;let a=await xe({cartClient:this.cartClient,cartId:t,streetAddress:n?nr(n):{},instrumentName:w.GooglePay,abortSignal:(r=C(this,re))==null?void 0:r.signal});if(!a.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});this.cart=a.data;const i=this.cart.deliveryGroups.length>0&&(this.cart.deliveryGroups.some(s=>{var l;return((l=s.selectedDeliveryOption)==null?void 0:l.deliveryMethodType)==="LOCAL"})||this.cart.deliveryGroups.every(s=>s.selectedDeliveryOption==null));let o=[];if(i?o=this.cart.deliveryGroups.map(s=>s.deliveryOptions.filter(({deliveryMethodType:l})=>l==="SHIPPING")).map(s=>{var l;return(l=s[0])==null?void 0:l.handle}).filter(Boolean):o=this.cart.deliveryGroups.map(({selectedDeliveryOption:s,deliveryOptions:l})=>{var u;return s!=null&&s.handle?s.handle:(u=l.filter(({deliveryMethodType:d})=>d==="SHIPPING")[0])==null?void 0:u.handle}).filter(Boolean),o.length>0){if(a=await this.handleDeliveryOptionChange(o),!a.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});this.cart=a.data}return this.handleCurrencyChange(this.cart.checkoutUrl,this.cart.totalAmount),this.handlePaymentDataRequestUpdate({result:a,intent:"SHIPPING_ADDRESS"})}async handleDeliveryOptionChange(t){var n;const r=Pa({deliveryGroups:this.cart.deliveryGroups,instrumentName:w.GooglePay,selectedDeliveryOptionHandles:t});return await Sa({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:w.GooglePay,selectedDeliveryOptions:r,abortSignal:(n=C(this,re))==null?void 0:n.signal})}logException(t,{severity:n,metadata:r}={}){_.notify(new ar(t),{severity:n!=null?n:"error",metadata:r})}emitAuthorizationCompleteMetric(t){g.authorizationComplete({instrument:this.name,measurement:Z(M.AuthorizationLatency,this.name),result:t})}}ht=new WeakMap,re=new WeakMap,Be=new WeakMap;const Zc={LIGHT:"light",DARK:"dark"};var He;class ed extends Re{constructor(){super(),c(this,"name",w.GooglePay),c(this,"paymentsClient",null),c(this,"button",null),x(this,He),c(this,"handleClick",async()=>{if(this.disabled)return;this.disabled=!0;const t=Ve("AbortController");try{await this.createPaymentsClient(t),await this.paymentsClient.handleClick()}catch(n){if(this.disabled=!1,n.statusCode==="CANCELED"){t==null||t.abort("Payment sheet cancelled"),g.sheetCancelled(w.GooglePay);return}t==null||t.abort("Payment sheet failure"),_.notify(n),g.sheetClicked({instrument:this.name,result:"failed"});const r=await this.i18n,a=r.translate("brand.google_pay");J(a,r)}}),k(this,He,this.attachShadow({mode:"closed"}))}static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button)}async connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async createPaymentsClient(t){this.paymentsClient=new Jc({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,dataSource:await this.dataSource,button:this,cartClient:await this.apiClient,i18n:await this.i18n,buyerCurrency:this.buyerCurrency,abortController:t})}async render(){if(this.button)return;await this.initializeShadowStyles(C(this,He),Bc);const{translate:t}=await this.i18n,n=this.isCTA?t("buy_with_button_content",{wallet:t("brand.google_pay")}):t("brand.google_pay"),r=Mt({label:n});this.disabled&&r.setAttribute("disabled",""),r.classList.add("button",Pe.BUTTON,Zc[this.buttonTheme]),r.onclick=this.handleClick,await this.renderButtonContent(r,t),this.button=r,C(this,He).appendChild(r),this.ensureLightDOMIsNotEmpty(),this.onRendered()}async renderButtonContent(t,n){const r=this.buttonTheme==="DARK"?lt.googlePayLogoDark:lt.googlePayLogo,a=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(t.style.font=window.getComputedStyle(this).font,this.isCTA){const i=Lr({translate:n,logoElement:a,setAriaHidden:!0});i.classList.add("content"),t.appendChild(i)}else t.classList.add("logo-only"),t.appendChild(a)}}He=new WeakMap;const q=class je extends me{static walletName(){return"google_pay"}constructor(t){super(t)}getWebComponentName(){return"shopify-google-pay-button"}getInstrumentName(){return w.GooglePay}getWebComponentClass(){return ed}async loadWalletSDK(){if(je.googlePaySDKPromise)return je.googlePaySDKPromise;const t=document.createElement("script");t.setAttribute("src",this.walletParams.sdkUrl);const n=new Promise((r,a)=>{t.onload=()=>r(),t.onerror=i=>{document.body.removeChild(t),a(i)},document.body.appendChild(t)});return je.googlePaySDKPromise=Promise.all([n,this.loadLogos()]),je.googlePaySDKPromise}getLoadEligibility(){const t=Ma(this.walletParams);switch(t.result){case"success":return{eligible:!0};case"error":return{eligible:!1,reason:t.reason}}}getPartnerSDKEligibility(){return{eligible:!0}}async loadLogos(){return Promise.all([this.loadGooglePayLogo(),this.loadGooglePayLogoDark()])}async loadGooglePayLogo(){if(je.googlePayLogo=(await import("./google-pay-logo-BgkSiJGq.js")).default,!je.googlePayLogo)throw new Error("Google Pay logo is empty")}async loadGooglePayLogoDark(){if(je.googlePayLogoDark=(await import("./google-pay-logo-dark-DmTdfep2.js")).default,!je.googlePayLogoDark)throw new Error("Google Pay logo dark is empty")}};c(q,"googlePaySDKPromise"),c(q,"googlePayLogo",""),c(q,"googlePayLogoDark","");let lt=q;const td=[tl,sr,va,lt,st,hr,Oa],rd=new Map(td.map(e=>[e.walletName(),t=>new e(t)]));function it(e){if(!e)return null;const t=rd.get(e.name);return t?t(e):(console.debug("Can't build wallet with name ".concat(e.name)),null)}function nd(e){return e.map(t=>it(t)).filter(t=>t!=null)}const Fa="*{box-sizing:border-box}.wallet-button-fade-in{animation:animation-fade-in .3s cubic-bezier(.1,.79,1,1)}@keyframes animation-fade-in{0%{opacity:0}to{opacity:1}}button[aria-disabled=true]{opacity:.5;cursor:not-allowed}";class ad{constructor(t,n,r){this.element=t,this.apiClient=n,this.instrumentName=r}async getInitialCart(t){const n=Nr(this.element);if(!n)throw new Error("[".concat(this.instrumentName,"] unable to find product form"));const r=ot(li),{data:a,errors:i,warnings:o}=await this.apiClient.createCart(T(b({},n),{discountCodes:r?[r]:[],instrumentName:t}));return{cart:a,errors:i,warnings:o}}}function id({instanceNumber:e,styleId:t,styles:n,cssFileName:r}){var a,i;e===1&&(i=(a=window.Shopify)==null?void 0:a.PaymentButton)!=null&&i.isStorefrontPortableWallets&&(od({styleId:t})||sd({styleId:t,styles:n}))}function od({styleId:e}){return!!document.querySelector("style#".concat(e))}function sd({styleId:e,styles:t}){const n=document.createElement("style");n.id=e,n.innerHTML=t,document.head.appendChild(n)}const X={buttonBlockSize:"--shopify-accelerated-checkout-button-block-size",buttonBorderRadius:"--shopify-accelerated-checkout-button-border-radius",buttonBoxShadow:"--shopify-accelerated-checkout-button-box-shadow",inlineAlignment:"--shopify-accelerated-checkout-inline-alignment"};function hn(e){let t=0,n=0,r=0;const a=e.split(/\s+/);for(let i=0;i<a.length;i++){const o=a[i];o!==">"&&(o.includes("#")&&(t+=(o.match(/#/g)||[]).length),o.includes(".")&&(n+=(o.match(/\./g)||[]).length),o.includes("[")&&(n+=(o.match(/\[/g)||[]).length),o.includes(":")&&(n+=(o.match(/:[^:]/g)||[]).length),/^[A-Za-z]/.test(o)&&(r+=1))}return[t,n,r]}function ld(e,t){for(let n=0;n<3;n++)if(e[n]!==t[n])return t[n]-e[n];return 0}function pn(e){return[...e].sort((t,n)=>{const r=hn(t.selector),a=hn(n.selector);return ld(r,a)})}const cd=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*(>\s*)?li(?![a-zA-Z0-9_.:#-])/,dd=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*\[role="?button"?\](?![:\w-])/,ud=/\.additional-checkout-buttons\s*(?:div\s*)?\[role="?button"?\](?![:\w-])/,Ua=/\[data-shopify-buttoncontainer\](?![:\w-])/,$a=/.dynamic-checkout-buttons .shopify-payment-button__button/,hd=/(?!.*\.shopify-cleanslate)\.shopify-payment-button__button(?:--branded)?(?![\w-:.#>])/,pd=/\.(shopify-payment-button|shopify-payment-button__button|shopify-payment-button__button--branded)\s*\[role="?button"?\](?![:\w-])/,md=/(?:only\s+)?(?:screen\s+and\s+)?\((?:min|max)-(?:width|height):\s*\d+px\)/,yd=[dd,Ua,cd,ud,$a],gd=[hd,pd,$a];function Ba(e){const t=e.pageType,n=[...document.styleSheets].filter(fd),r=[],a=[];n.forEach(N=>{try{const $=[...N.cssRules].filter(L=>L instanceof CSSMediaRule),B=[...N.cssRules].filter(L=>L instanceof CSSStyleRule);a.push(...$.filter(L=>md.test(L.conditionText)).flatMap(L=>[...L.cssRules].filter(mt=>mt instanceof CSSStyleRule).flatMap(mt=>mt.selectorText.split(",").map(ne=>ne.trim()).map(ne=>b({selector:ne,conditionText:L.conditionText},bn(mt)))))),r.push(...B.flatMap(L=>L.selectorText.split(",").map(mt=>mt.trim()).map(mt=>b({selector:mt},bn(L)))))}catch($){At()("shopify-support-debug")&&(console.debug("[shopify-support-debug] stylesheet origin: ".concat(N.href)),console.debug($))}});const i=t===S.ProductPage?gd:yd,o=new Set;function s(N,$){const B=$.selector.match(N);return B?(o.add(B[0]),!0):!1}const l=r.filter(N=>i.some($=>s($,N))).reverse(),u=a.filter(N=>i.some($=>s($,N))).reverse(),d=At()("shopify-support-debug");d&&console.table(Array.from(o));const h=pn(l),p=pn(u),y={},E=mn(t)?document.querySelector(".cart__blocks .button"):document.querySelector(".product-form__buttons .button");E&&(y.boxShadow=getComputedStyle(E,":before").boxShadow);for(const N of h){const $=["height","minHeight","borderRadius","marginTop"];mn(t)&&N.selector.match(Ua)&&$.push("justifyContent");for(const B of $)y[B]=_d({rule:N,property:B,currentPropertyValue:y[B]})}const{height:f,borderRadius:A,minHeight:I,marginTop:O,justifyContent:G,boxShadow:Vt}=y;return d&&console.table([{property:"height",value:f},{property:"borderRadius",value:A},{property:"minHeight",value:I},{property:"marginTop",value:O},{property:"justifyContent",value:G},{property:"boxShadow",value:Vt}]),t===S.ProductPage?fn({styles:{height:f,minHeight:I,borderRadius:A,marginTop:O,boxShadow:Vt},mediaRules:p,element:e}):fn({styles:{borderRadius:A,boxShadow:Vt,justifyContent:G},mediaRules:p,element:e})}function Ha(e,t){var n,r,a;if(!t)return;g.styleBackwardsCompatibility();const i=(a=(r=(n=window.ShopifyAnalytics)==null?void 0:n.lib)==null?void 0:r.trekkie)==null?void 0:a.defaultAttributes,o=i==null?void 0:i.shopId,s=i==null?void 0:i.themeId;o&&s&&g.log({body:"Style backwards compatibility used",attributes:{shopId:"".concat(o),themeId:"".concat(s)}});const l="global-".concat(e.tagName.toLowerCase(),"-styles");if(document.head.querySelector("style#".concat(l))==null){const u=document.createElement("style");u.id=l,u.innerHTML=t,document.head.appendChild(u)}}function fd(e){const t=e.ownerNode instanceof HTMLLinkElement&&(e.ownerNode.getAttribute("crossorigin")==="anonymous"||e.ownerNode.getAttribute("crossorigin")==="");return e.href==null||e.href.startsWith(window.location.origin)||t}function mn(e){return e===S.CartPage||e===S.CartAjax}function yn({height:e,minHeight:t}){let n=e,r=t;return(n!=null&&n.includes("var(".concat(X.buttonBlockSize))||n==="auto")&&(n=null),(r!=null&&r.includes("var(".concat(X.buttonBlockSize))||r==="auto")&&(r=null),n===r?n:r&&n?"max(".concat(n,",").concat(r,")"):n||r}function gn({existingProperties:e,mediaCondition:t,selector:n,styles:r}){const a=b({},r);for(const i of e)delete a[i];for(const[i,o]of Object.entries(a))o!=null&&o.startsWith("var(".concat(i))&&delete a[i];return Object.keys(a).length===0?"":bd({mediaCondition:t,selector:n,styles:a})}function bd({mediaCondition:e,selector:t,styles:n}){let r="".concat(e?"@media ".concat(e," { "):"").concat(t," {");for(const[a,i]of Object.entries(n))i&&(r+="\n ".concat(a,": ").concat(i,";"));return r+="\n}",e&&(r+="}"),r+="\n",r}function fn({styles:e,element:t,mediaRules:n}){const{height:r,minHeight:a,borderRadius:i,marginTop:o,justifyContent:s,boxShadow:l}=e,u=t.tagName.toLowerCase(),d=getComputedStyle(t),h=new Set;for(const y of Object.values(X))d.getPropertyValue(y)&&h.add(y);let p=gn({existingProperties:h,selector:u,styles:{[X.buttonBlockSize]:yn({height:r,minHeight:a}),[X.buttonBorderRadius]:i,[X.buttonBoxShadow]:l,[X.inlineAlignment]:s,"margin-top":o,display:o?"block":void 0}});return n.forEach(y=>{(y.height||y.minHeight||y.borderRadius||y.boxShadow||y.justifyContent||y.marginTop)&&(p+=gn({existingProperties:h,mediaCondition:y.conditionText,selector:u,styles:{[X.buttonBlockSize]:yn({height:y.height,minHeight:y.minHeight}),[X.buttonBorderRadius]:y.borderRadius,[X.buttonBoxShadow]:y.boxShadow,[X.inlineAlignment]:y.justifyContent,"margin-top":y.marginTop,display:y.marginTop?"block":void 0}}))}),p.trim()}function bn(e){return[["height"],["minHeight","min-height"],["borderRadius","border-radius"],["marginTop","margin-top"],["justifyContent","justify-content"]].reduce((t,[n,r])=>(t[n]=wd({rule:e,property:r!=null?r:n}),t),{})}function wd({rule:e,property:t}){const n=e.style.getPropertyValue(t);return e.style.getPropertyPriority(t)?"".concat(n," !important"):n||null}function _d({rule:e,property:t,currentPropertyValue:n}){const r=e[t];return!(n!=null&&n.includes("!important"))&&r!=null&&r.includes("!important")?r:n!=null?n:r}const Ga="d6d12da0",wn=2e3;class _n extends Error{constructor(){super(...arguments),c(this,"name","AcceleratedCheckoutError")}}const vt=class Hd extends vr{constructor(){super(),c(this,"instanceNumber",++Hd.instanceCount),c(this,"pageType",S.ProductPage),c(this,"formObserver"),c(this,"dataSource"),c(this,"wrapper"),c(this,"shopPromiseEligible"),c(this,"didInitiateRender",!1),this.wrapper=document.createElement("div"),id({instanceNumber:this.instanceNumber,styleId:"shopify-accelerated-checkout",styles:js,cssFileName:"AcceleratedCheckout.css"}),this.shopPromiseEligible=Yn()}static get observedAttributes(){return["access-token","disabled","has-selling-plan","requires-shipping"]}async connectedCallback(){var t,n;try{if((n=(t=this.wrapper)==null?void 0:t.children)!=null&&n.length||this.didInitiateRender)return;if(!this.validateRenderingSurface()){this.clearUI();return}this.instanceNumber===1&&(Rr(this),g.initStarted(),this.extractStyles());const r=$t(M.ButtonDisplay,"dc:".concat(this.instanceNumber));this.i18n=Ot(),this.setupFormObserver(),this.didInitiateRender=!0;const a=await this.loadWallet(),i=a.getInstrumentName();this.apiClient=new Gt({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,withCarrierRates:!0,cartPrepareMigrationEnabled:this.isFlagEnabled(Ga)}),this.dataSource=new ad(this,this.apiClient,i);const o=a.createWebComponent({walletContainer:this,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,classNames:Ed(i),callToAction:"true",pageType:this.pageType,containerInstanceNumber:this.instanceNumber,onRendered:()=>g.instrumentLoaded({instrumentOrComponentName:i,result:"success",measurement:r()})});if(!o)throw new _n("No web component instance found for instrument ".concat(i));this.render(o,i),g.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(r){if(this.clearUI(),g.initCompleted(r),r.name===pt)throw r;_.notify(new _n("An error occurred while attempting to render AcceleratedCheckout: ".concat(r),{cause:r}))}}async attributeChangedCallback(t,n,r){n!==r&&(Dr(this,t,r),t==="has-selling-plan"&&r===""?this.showBuyerConsent(this.apiClient,this.i18n):t==="has-selling-plan"&&r===null&&this.hideBuyerConsent())}async render(t,n){this.clearUI();const r=this.attachShadow({mode:"closed"}),a=document.createElement("style");a.innerHTML=Fa,r.appendChild(a),this.wrapper.className="wallet-button-fade-in wallet-button-wrapper";const i=document.createElement("slot");i.name="button",this.wrapper.appendChild(i);const o=document.createElement("slot");o.name="promise",this.wrapper.appendChild(o);const s=document.createElement("slot");s.name="more-options",this.wrapper.appendChild(s),r==null||r.appendChild(this.wrapper),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent();const l=new DocumentFragment;l.appendChild(t);const u=this.getShopPromiseSlot();u&&l.appendChild(u);const d=this.getMorePaymentOptionsLink(n);d&&l.appendChild(d),this.appendChild(l)}getMorePaymentOptionsLink(t){var n,r;if(t===w.BuyItNow)return null;const a=document.createElement("more-payment-options-link");return Ft(a,{"buyer-country":(n=this.buyerCountry)!=null?n:"","access-token":(r=this.accessToken)!=null?r:"","recommended-instrument":t,slot:"more-options"}),a.disabled=this.disabled,a.setDataSource(this.dataSource),a.setI18n(this.i18n),a.setClassNames(ir.MORE_PAYMENT_OPTION_BUTTON),a}getShopPromiseSlot(){if(!this.shopPromiseEligible)return null;const t=document.createElement("div");return t.setAttribute("data-shopify","shop-promise-payment-button-slot"),t.style.height="100%",t.slot="promise",t}validateRenderingSurface(){return Bt({page:"product",element:this})!=null}async loadWallet(){const t=qs(this.recommendedWallet,this.fallbackWallet,"AcceleratedCheckout");return await Cd(this,T(b({},t),{instanceNumber:this.instanceNumber}))}setupFormObserver(){this.formObserver||(this.formObserver=new ra(this,({disabled:t,hasSellingPlan:n})=>{this.disabled=t,this.hasSellingPlan=n,this.isShippingRequired=Ad(this,this.variantParams)}),this.formObserver.setupMutationObservers())}extractStyles(){if(this.styleExtractorDisabled){At()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled");return}const t=Ba(this);t&&Ha(this,t)}};c(vt,"instanceCount",0);let pr=vt;function Ed(e){return e===w.BuyItNow?ir.UNBRANDED_BUTTON:ir.BRANDED_BUTTON}function Ad(e,t){var n;const r=Nr(e);return!!((n=t.find(a=>a.id===Number(r==null?void 0:r.variantId)))!=null&&n.requiresShipping)}async function Cd(e,{recommendedWallet:t,fallbackWallet:n,instanceNumber:r}){const a=t?it(t):null,i=it(n),o=async s=>{const l=Zn({walletInstrument:s,instanceNumber:r}),u="timeout",d=await Promise.race([l,new Promise(h=>setTimeout(()=>h(u),wn))]);if(d===u)g.instrumentSDKLoaded({instrument:s.getInstrumentName(),measurement:wn,result:"timeout"});else if(d instanceof me)return d;return null};if(Ct(e,a)){const s=await o(a);if(s)return s}if(Ct(e,i)){const s=await o(i);if(s)return s}return it(kn)}he("shopify-accelerated-checkout",pr),he("more-payment-options-link",Us,{isChildCustomElement:!0});const Sd=e=>{const t=new PerformanceObserver(n=>{n.getEntriesByType("resource").some(r=>r.name.includes(Je.CartUpdate)||r.name.includes(Je.CartChange)||r.name.includes(Je.CartAdd)||r.name.includes(Je.CartClear))&&e()});return t.observe({entryTypes:["resource"]}),t},Id=".wallet-cart-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)}.wallet-button-wrapper{container-type:inline-size;container-name:wrapper;width:100%}.wallet-cart-grid{margin:0 -5px -5px;padding:0;display:flex;justify-content:var(--shopify-accelerated-checkout-inline-alignment, start)}.wallet-cart-button-container{position:relative;margin:0 5px 5px}.wallet-cart-button-container,.wallet-cart-button{width:150px;height:clamp(25px,var(--shopify-accelerated-checkout-button-inline-size, 42px),55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);list-style-type:none!important;text-align:center;flex-shrink:0;flex-grow:0}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container:first-child,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}@container wrapper (width >= 150px) and (width <= 500px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 310px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 470px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 630px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 790px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}@media screen and (max-width: 750px){.wallet-cart-grid{justify-content:flex-start;flex-direction:column;margin:0;max-width:none}.wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0;max-width:none}.wallet-cart-button-container:first-child{margin:0}.wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@supports (not (container-type: inline-size)) or (not (selector(:has(*)))){.wallet-cart-grid{justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-button-container:first-child{margin:0}.wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}.screen-reader-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}",Pd=".wallet-cart-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)}.wallet-button-wrapper{container-type:inline-size;container-name:wrapper;width:100%}.wallet-cart-grid{margin:0 -5px -5px;padding:0;display:flex;justify-content:var(--shopify-accelerated-checkout-inline-alignment, start)}.wallet-cart-button-container{position:relative;margin:0 5px 5px}.wallet-cart-button-container,.wallet-cart-button{width:150px;height:clamp(25px,var(--shopify-accelerated-checkout-button-inline-size, 42px),55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);list-style-type:none!important;text-align:center;flex-shrink:0;flex-grow:0}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container:first-child,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}@container wrapper (width >= 150px) and (width <= 500px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 310px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 470px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 630px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@container wrapper (width <= 790px){.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}@media screen and (max-width: 750px){.wallet-cart-grid{justify-content:flex-start;flex-direction:column;margin:0;max-width:none}.wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0;max-width:none}.wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@supports (not (container-type: inline-size)) or (not (selector(:has(*)))){.wallet-cart-grid{justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0}.wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}.screen-reader-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}";function Dd(e){const t=Bt({page:"cart",element:e});return ea({type:"attributes",form:t})}class vd{constructor(t,n,r){this.element=t,this.cartToken=n,this.apiClient=r}async getInitialCart(t){const n="gid://shopify/Cart/".concat(this.cartToken),r=Dd(this.element);let a,i=[];if(r.length){const o=await this.apiClient.updateCartAttributes({cartId:n,attributes:r,instrumentName:t,startingCheckout:!0});a=o.data,i=o.errors}else a=await this.apiClient.fetchCart({id:n,instrumentName:t,startingCheckout:!0});return{cart:a,errors:i}}}var Ge;const Rt=class Gd extends vr{constructor(){super(),c(this,"instanceNumber",++Gd.instanceCount),c(this,"pageType",S.CartPage),c(this,"cartObserver",null),c(this,"dataSource",null),c(this,"wrapper"),c(this,"didInitiateRender",!1),x(this,Ge),this.wrapper=document.createElement("div")}static get observedAttributes(){return["access-token","has-selling-plan","requires-shipping"]}createDataSource(){if(!this.cartToken)throw new Error("[AcceleratedCheckoutCart] cart cookie does not exist");this.i18n=Ot(),this.apiClient=new Gt({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,withCarrierRates:!0,cartPrepareMigrationEnabled:this.isFlagEnabled(Ga)}),this.dataSource=new vd(this,this.cartToken,this.apiClient)}async createWebComponents({shouldRefetchCartAttributes:t}){if(!this.walletConfigs)throw new Error("[AcceleratedCheckoutCart] walletConfigs does not exist");const n=$s(this.walletConfigs,"AcceleratedCheckoutCart");if(!(n instanceof Array))throw new Error("[AcceleratedCheckoutCart] invalid walletConfigs found");const r=M.ButtonDisplay,a=o=>"".concat(o,":").concat(this.instanceNumber),i=await Rd(this,{walletConfigs:n,startButtonDisplayBenchmark:o=>ze(r,a(o))});return this.createDataSource(),t&&await this.updateAttributes(),i.map(o=>{const s=o.getInstrumentName();return o.createWebComponent({walletContainer:this,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,pageType:this.pageType,containerInstanceNumber:this.instanceNumber,slot:"button-".concat(o.getInstrumentName()),onRendered:(()=>{let l=!1;return()=>{l||(l=!0,g.instrumentLoaded({instrumentOrComponentName:s,result:"success",measurement:Z(r,a(s))}))}})()})})}async cartChangedCallback(){try{if(!this.dataSource&&this.cartToken){await this.render({shouldRefetchCartAttributes:!0}),g.initCompleted();return}else if(!this.cartToken){g.cartTokenMissing({reason:"cartChangedCallback"});return}await this.updateAttributes()}catch(t){this.clearUI(),_.notify(t)}}async updateAttributes(){var t,n;if(!this.cartToken||!this.apiClient)return;const r=await this.apiClient.fetchLimitedCart({id:"gid://shopify/Cart/".concat(this.cartToken),instrumentName:w.Unknown});if(!r.id)throw new Error("[".concat(this.updateAttributes,"] received invalid cart"));this.hasSellingPlan=(t=r.sellingPlan)!=null?t:!1,this.isShippingRequired=(n=r.shippingRequired)!=null?n:!1}async connectedCallback(){try{if(this.didInitiateRender)return;if(this.instanceNumber===1&&Rr(this),g.initStarted(),this.cartObserver=Sd(()=>this.cartChangedCallback()),!this.cartToken){g.cartTokenMissing({reason:"connectedCallback"});return}await this.render({shouldRefetchCartAttributes:!1}),g.initCompleted()}catch(t){this.clearUI(),g.initCompleted(t),_.notify(t)}}disconnectedCallback(){var t;(t=this.cartObserver)==null||t.disconnect()}async attributeChangedCallback(t,n,r){n!==r&&(Dr(this,t,r),t==="has-selling-plan"&&r===""?this.showBuyerConsent(this.apiClient,this.i18n):t==="has-selling-plan"&&r===null&&this.hideBuyerConsent())}get cartToken(){return ot("cart")}async render({shouldRefetchCartAttributes:t}){var n;if(this.hasLegacyCartCookie()){g.legacyCartCookie(),this.clearUI();return}this.didInitiateRender=!0;const r=$t(M.ButtonDisplay,"cart:".concat(this.instanceNumber)),a=await this.createWebComponents({shouldRefetchCartAttributes:t});if(this.clearUI(),a.length===0)return;const i=new DocumentFragment,o=this.getOrCreateShadowRoot(),s=document.createElement("style");s.innerHTML=[Fa,Id].join("\n"),o.appendChild(s),this.extractStyles(),this.wrapper=document.createElement("div"),this.wrapper.className="wallet-button-fade-in wallet-button-wrapper";const l=document.createElement("h2");l.className="screen-reader-text",l.textContent=((n=this.i18n)==null?void 0:n.translate("express_checkout"))||"",this.wrapper.appendChild(l);const u=document.createElement("div");u.className="wallet-cart-grid ".concat(Pe.CONTAINER),Nd()&&u.classList.add("wallet-cart-grid--vertical"),a.forEach(d=>{const h=document.createElement("div"),p=document.createElement("div"),y=document.createElement("slot");y.name="button-".concat(d.name),h.className="wallet-cart-button-container",p.className="wallet-cart-button",h.setAttribute("data-testid","grid-cell"),h.appendChild(p),p.appendChild(y),u.appendChild(h),i.appendChild(d)}),this.wrapper.appendChild(u),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),o.appendChild(this.wrapper),this.appendChild(i),g.instrumentLoaded({instrumentOrComponentName:"AcceleratedCheckoutCart",result:"success",measurement:r()})}getOrCreateShadowRoot(){return C(this,Ge)||k(this,Ge,this.attachShadow({mode:"closed"})),C(this,Ge)}hasLegacyCartCookie(){var t;return this.cartToken?(t=this.cartToken)==null?void 0:t.match(/^[a-z0-9]+$/):!1}extractStyles(){if(this.styleExtractorDisabled){At()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled");return}const t=Ba(this);if(t){Ha(this,t);const n=this.getOrCreateShadowRoot(),r=document.createElement("style");r.innerHTML=Pd,n.appendChild(r)}}};Ge=new WeakMap,c(Rt,"instanceCount",0);let mr=Rt;async function Rd(e,{walletConfigs:t,startButtonDisplayBenchmark:n=()=>{}}){const r=Hs(e,nd(t));return(await Promise.all(r.map(a=>(n(a.getInstrumentName()),Zn({walletInstrument:a,instanceNumber:e.instanceNumber}))))).filter(a=>a!=null)}function Nd(){return!!document.querySelector(".additional-checkout-buttons--vertical shopify-accelerated-checkout-cart")}he("shopify-accelerated-checkout-cart",mr);class Td{getInitialCart(){throw new Error('[NoOpDataSource] Unexpected call to "getCart"')}}const Nt=class Vd extends vr{constructor(){super(...arguments),c(this,"instanceNumber",++Vd.instanceCount),c(this,"pageType",S.Checkout)}get walletConfig(){return this.getAttribute("wallet-config")}async connectedCallback(){var t;try{if(this.children.length)return;this.instanceNumber===1&&(Rr(this),g.initStarted());const n=$t(M.ButtonDisplay,"dc:".concat(this.instanceNumber)),r=Bs(this.walletConfig,"WalletButton");if(!r)throw new di("[WalletButton] No config provided.");const a=it(r);if(!a)return;if(!await this.eligibleToShow(a)){this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:"ineligible"}}));return}if(this.onlySdk){g.initCompleted(),this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}}));return}const i=a.getInstrumentName();this.i18n=Ot(),this.apiClient=new Gt({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale});const o=this.createWebComponent(a,this.i18n,this.apiClient,i,n);this.innerHTML="",this.appendChild(o),g.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(n){this.innerHTML="",this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:(t=n.message)!=null?t:"Error loading wallet SDK"}})),g.initCompleted(n),_.notify(n)}}createWebComponent(t,n,r,a,i){const o=t.createWebComponent({walletContainer:this,dataSource:new Td,i18n:n,apiClient:r,containerInstanceNumber:this.instanceNumber,pageType:this.pageType});return o.onRendered=()=>{this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}})),g.instrumentLoaded({instrumentOrComponentName:a,result:"success",measurement:i()})},o}async eligibleToShow(t){return!(!Ct(this,t)||(await t.loadWalletSDK(),!t.getPartnerSDKEligibility().eligible))}};c(Nt,"instanceCount",0);let yr=Nt;he("shopify-wallet-button",yr),ni(_),ai(_),g.startExporter();