1import.meta;function zo(){Array.prototype.flatMap||(Array.prototype.flatMap=function(t,e){const r=[];for(let n=0;n<this.length;n++){const a=t.call(e,this[n],n,this);if(Array.isArray(a))for(const o of a)r.push(o);else r.push(a)}return r})}zo();var Fo=":host{justify-content:center;align-items:center;display:flex}",Uo=class extends HTMLElement{size="18px";color="gray";connectedCallback(){this.attachShadow({mode:"open"}),this.size=this.getAttribute("size")??this.size,this.color=this.getAttribute("color")??this.color,this.render();const t=document.createElement("style");t.textContent=Fo,this.shadowRoot.appendChild(t)}render(){const t=this.shadowRoot;t.innerHTML=` 2 <svg ${` 3 width="${this.size}" 4 height="${this.size}" 5 xmlns="http://www.w3.org/2000/svg" 6 aria-hidden="true" 7 `} viewBox="0 0 20 20" fill="${this.color}"> 8 <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"/> 9 </svg> 10 `}},Bo="#overlay{z-index:2147483647;background:#0006;width:100%;height:100%;animation:.3s ease-out modalPop;position:fixed;top:0;left:0}#modal{color:#000;background:#fff;border-radius:5px;width:100%;max-width:383px;animation:.3s forwards modalSlideInFromTop;position:fixed;top:20%;left:50%;transform:translate(-50%,-100%)}@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 (width<=640px){#modal{animation:.3s forwards modalSlideInFromBottom;top:auto;bottom:0}}#modal footer{padding:0 21px 21px}#modal header{justify-content:space-between;padding:21px 21px 16px;display:flex}#title{word-wrap:break-word;overflow-wrap:break-word;margin:0;font-size:21px;font-weight:600;line-height:25.2px}.capitalize:first-letter{text-transform:capitalize;display:inline-block}#content{text-align:left;max-height:50vh;padding:0 21px 16px;overflow:auto}#modal #content p{margin:0;font-size:14px;line-height:21px}#close-icon,#close-button{cursor:pointer}#close-icon{background:0 0;border:none;min-width:24px;padding:0}#close-button{color:#fff;background-color:#1773b0;border:none;border-radius:5px;width:100%;padding:16px 21px;font-family:inherit;font-size:14px;line-height:21px}#close-button:hover,#close-button:active{background:#136f99}#close-button:active,#close-button:focus{box-shadow:0 0 0 4px #1990c640}";function Ho(t){return Fa(t).map(e=>e instanceof Error?e:new Ua(`[${typeof e}] ${Go(e).slice(0,10240)}`))}function Fa(t,e=0){return e>=20?[t,"Truncated cause stack"]:t instanceof Error&&t.cause?[t,...Fa(t.cause,e+1)]:[t]}function Go(t){if(typeof t=="function")return`${t.name||"anonymous"}`;if(typeof t!="string")try{return JSON.stringify(t)??typeof t}catch{}return`${t}`}var Ua=class extends Error{name="BugsnagInvalidError"},Ba=/^\s*at .*(\S+:\d+|\(native\))/m,$o=/^(eval@)?(\[native code])?$/;function Vo(t){return t.stack?t.stack.match(Ba)?Wo(t):jo(t):[]}function Ha(t){if(t.indexOf(":")===-1)return[t];let e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[e[1],e[2]?Number(e[2]):void 0,e[3]?Number(e[3]):void 0]}function Wo(t){return t.stack.split(` 11`).filter(e=>!!e.match(Ba)).map(e=>{let r=e.replace(/^\s+/,"").replace(/^.*?\s+/,""),n=r.match(/ (\(.+\)$)/);r=n?r.replace(n[0],""):r;let a=Ha(n?n[1]:r);return{method:n&&r||void 0,file:["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0],lineNumber:a[1],columnNumber:a[2]}})}function jo(t){return t.stack.split(` 12`).filter(e=>!e.match($o)).map(e=>{if(e.indexOf("@")===-1&&e.indexOf(":")===-1)return{method:e};let r=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(r),a=n&&n[1]?n[1]:void 0,o=Ha(e.replace(r,""));return{method:a,file:o[0],lineNumber:o[1],columnNumber:o[2]}})}var $e="5",qo=class{breadcrumbs=[];apiKey;plugins;appId;appType;appVersion;releaseStage;locale;userAgent;metadata;persistedMetadata;onError;onPostErrorListeners=[];endpoints;session;constructor(t){this.apiKey=t.apiKey,this.appType=t.appType,this.appId=t.appId,this.appVersion=t.appVersion,this.releaseStage=t.releaseStage,this.locale=t.locale,this.userAgent=t.userAgent,this.metadata=t.metadata,this.onError=t.onError,this.persistedMetadata={},this.endpoints=t.endpoints??{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com/observeonly"}
12,this.plugins=t.plugins??[],this.plugins.forEach(e=>e.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state"),(t.withSessionTracking??!0)&&(this.session={id:this.getRandomUUID(),startedAt:new Date().toISOString(),events:{handled:0,unhandled:0}},this.startSession())}addMetadata(t){for(let e of Object.keys(t))this.persistedMetadata[e]=t[e]}getSessionId(){return this.session?.id}leaveBreadcrumb(t,e,r="manual"){this.breadcrumbs.push({name:t,metaData:e,type:r,timestamp:new Date().toISOString()})}notify(t,{errorClass:e,severity:r,severityType:n,handled:a=!0,metadata:o,context:i,groupingHash:s}={}){let l=Ho(t),d={...this.metadata,...this.persistedMetadata,...o},u=this.buildBugsnagEvent(l,{errorClass:e,severityType:n,handled:a,severity:r,metadata:d,context:i,groupingHash:s});if((this.onError?.(u,t)??!0)&&this.releaseStage!=="development"){this.updateAndAppendSessionInformation(u);let h=this.sendToBugsnag(u);return this.onPostErrorListeners.forEach(m=>m(u,t)),h}return Promise.resolve()}addOnPostError(t){this.onPostErrorListeners.push(t)}updateAndAppendSessionInformation(t){this.session&&(t.unhandled?this.session.events.unhandled++:this.session.events.handled++,t.session=this.session)}buildBugsnagEvent(t,{errorClass:e,severity:r="error",severityType:n="handledException",handled:a,metadata:o={},context:i,groupingHash:s}){let l=new Date().toISOString(),{breadcrumbs:d,appId:u,appType:h,appVersion:m,releaseStage:y,locale:b,userAgent:A}=this;return{payloadVersion:$e,exceptions:t.map((T,_)=>({errorClass:_===0?e??T.name:T.name,stacktrace:Ga(u,T),message:T.message,type:"browserjs"})),severity:r,severityReason:{type:n},unhandled:!a,app:{id:u,type:h,version:m,releaseStage:y},device:{time:l,locale:b,userAgent:A},breadcrumbs:d,context:i,metaData:o,groupingHash:s}}async startSession(){if(this.releaseStage==="development"){console.log("Skipping error logging session tracking in development mode");return}let{apiKey:t}=this,e={notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},app:{version:this.appVersion,releaseStage:this.releaseStage,type:this.appType},device:{id:this.appId,locale:this.locale,userAgent:this.userAgent},sessions:[this.session]};try{await fetch(this.endpoints.sessions,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":t,"Bugsnag-Payload-Version":$e,"Bugsnag-Sent-At":this.session?.startedAt??new Date().toISOString()},body:JSON.stringify(e,jr())})}catch(r){console.warn("[bugsnag-light] failed to start session"),console.warn(r)}}async sendToBugsnag(t){let{apiKey:e}=this,r={apiKey:e,notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},events:[t]};try{await fetch(this.endpoints.notify,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":$e,"Bugsnag-Sent-At":t.device.time},body:JSON.stringify(r,jr())})}catch(n){console.warn("[bugsnag-light] failed to send an event"),console.warn(n)}}getRandomUUID(){try{return crypto.randomUUID()}catch{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}}};function Ga(t,e){let r=Vo(e).map(n=>{let a=n.file?.includes(t);return{method:n.method??"",file:n.file??"",lineNumber:n.lineNumber??0,columnNumber:n.columnNumber,inProject:a}});if(e instanceof Ua){let n=r.findIndex(a=>a.method.endsWith("notify"));n>-1&&(r=r.slice(n+1))}return r}function jr(){let t=new WeakSet;return function(e,r){if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return r}}
12var Yo=class yn extends Error{reason;constructor(e){super(e),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,yn.prototype)}};function Ko(t,{metadata:e}={}){let r=window.onerror;window.onerror=(n,a,o,i,s)=>{s&&t.notify(s,{severityType:"unhandledException",handled:!1,metadata:e}),typeof r=="function"&&r.apply(window.onerror,[n,a,o,i,s])}}function Qo(t,{metadata:e}={}){window.addEventListener("unhandledrejection",r=>{r.reason&&r.reason instanceof Error&&r.reason.stack&&!(r.reason instanceof Yo)&&t.notify(r.reason,{severityType:"unhandledPromiseRejection",handled:!1,metadata:e})})}function wr(t){try{const e=new RegExp(`(^| )${t}=([^;]+)`).exec(document.cookie);if(e){const r=e[2];try{return decodeURIComponent(r)}catch{return r}}return null}catch{return null}}var ar={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",HIDDEN:"shopify-payment-button__button--hidden"},Xo={DARK:"apple-pay--dark",LIGHT:"apple-pay--light"},Jo="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",Zo="discount_code",ti="https://static-na.payments-amazon.com",_r=`${ti}/checkout.js`,D={CURRENCY_CHANGE:"wallet_currency_change",CAPTCHA_REQUIRED:"wallet_captcha_required",NOT_ENOUGH_STOCK:"wallet_not_enough_stock",PRICE_INCREASED:"wallet_price_increased",PAYMENT_METHOD_NOT_APPLICABLE:"wallet_payment_method_not_applicable",INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED:"wallet_invalid_payment_deferred_payment_required",WALLET_PROCESSING_FAILED:"wallet_processing_failed",UNSUPPORTED_APPLE_PAY_PAYMENT_METHOD:"wallet_unsupported_apple_pay_payment_method",UNSUPPORTED_GOOGLE_PAY_PAYMENT_METHOD:"wallet_unsupported_google_pay_payment_method",PAYMENTS_COUNTRY_INVALID:"wallet_payments_country_invalid",LOCALIZATION_EXTENSION_FIELD_ERROR:"wallet_localization_extension_field_error",SUBSCRIPTION_REVIEW_REQUIRED:"wallet_subscription_review_required",SUBSCRIPTION_REVIEW_REQUIRED_BANNER_LESS:"wallet_subscription_review_required_banner_less",SHIPPING_COUNTRY_UNAVAILABLE:"wallet_shipping_country_unavailable"},Va="portable-wallets",_t={BUTTON:"accelerated-checkout-button",BUTTON_ON_CART:"accelerated-checkout-button-cart",CONTAINER:"accelerated-checkout-button-container"},ei="unknown",Wa={name:"buy_it_now",supports_subs:!0,supports_def_opts:!0,wallet_params:{}};function ja(t){try{return!t.toString().includes("[native code]")}catch{return!0}}var Ve=new Map,ri={checkDuplicate({errorClass:t,message:e}){if(Ve.has(t)){const r=Ve.get(t);if(r.has(e))return!0;r.add(e)}else Ve.set(t,new Set([e]));return!1},reset(){}},Z=class extends Error{#t;get autogenerateHash(){return!1}get useHashPrefix(){return!1}constructor(t,{groupingHash:e,...r}={}){super(t,r),this.#t=e}get groupingHash(){const t=this.#t??(this.autogenerateHash?ai(this.message):"");return(this.useHashPrefix?`${this.name}-${t}`:t)||void 0}};function ai(t){return t.toLowerCase().slice(0,100).replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")}var Er="DeveloperError",W=class extends Error{#t;constructor({code:t,message:e},r){const n=`An unexpected error happened likely because of customizations made to HTML/JavaScript on this site ${e}`;super(`[${t}]: ${n}`,r),this.#t=t}get code(){return this.#t}};W.prototype.name=Er;var qa="SilencedError",Ya="[silenced]",q=class extends Error{constructor(t,e){super(`${Ya} ${t}`,e)}};q.prototype.name=qa;var Ka=class extends Error{};Ka.prototype.name="MissingConfigError";var et=class extends Z{get useHashPrefix(){return!0}get autogenerateHash(){return!0}};et.prototype.name="NoResponseError";var Re=class $a extends Z{static generateGraphQLGroupingHash(e,r){const{operationName:n}=r,a=this.getErrorMessageCategoryFromMessage(e);return n?`${n}-${a}`:a}static getErrorMessageCategoryFromMessage(e){for(const[n,a]of[[/Variable \$\w+ of type \w+!? was provided invalid value/i,"graphql-input-validation"],[/Cannot read propert(?:y|ies)(?: .+)? of (?:null|undefined)/i,"null-property-access"],[/(?:null|undefined) is not an object/i,"null-not-object"]]){const o=e.match(n);if(o){const i=o[1];return i?`${a}-${i}`:a}}let r=e;for(const n of[/^GraphQL response error for \w+:\s*(with status \d+\s*=>\s*|=>\s*)?/i,/^GraphQL\s+Client:\s*/i,/^GraphQL\s+response\s+error\s+for\s+\w+:\s*with\s+status\s+\d+\s*=>\s*/i,/An error occurred while fetching from the API. Review 'graphQLErrors' for details./i])r=r.replace(n,"");return r=r.slice(0,100),r.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")||"unknown-error"}#t;get useHashPrefix(){return!0}constructor(e,{errorDetails:r}){const n=$a.generateGraphQLGroupingHash(e,r);super(e,{groupingHash:n}),this.#t=r}get errorDetails(){return this.#t}};Re.prototype.name="GraphQLResponseError";var Xa="IgnoredGraphQLResponseError",Tt=class extends Re{#t;constructor(t,{reason:e,errorDetails:r}){super(t,{errorDetails:r}),this.#t=e}get reason(){return this.#t}};Tt.prototype.name=Xa;var Ja=class extends Z{constructor(t){const e=`[${t}] completion returned null result`;super(e,{groupingHash:`${t}-expected-completion-null-result`})}};function R(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var ni=0;function ct(t){return"__private_"+ni+++"_"+t}function Ne(t){return Object.entries(t).map(([e,r])=>({key:e,value:{stringValue:String(r)}}))}function oi(t){return Object.entries(t).map(([e,r])=>({key:e,value:Za(r)}))}function Za(t){if(Array.isArray(t))return{arrayValue:{values:t.map(e=>Za(e))}};switch(typeof t){case"boolean":return{boolValue:!!t};case"number":return{doubleValue:Number(t)};default:return{stringValue:String(t)}}}var Ar=1,ii=si(5,2,12);function si(t,e,r){const n=[0];for(let a=0;a<r;a++){const o=Math.floor(t*e**a);n.push(o)}return n}var mt=ct("exporter"),K=ct("attributes"),V=ct("metrics"),gt=ct("logs"),li=class{constructor({exporter:t,attributes:e}){Object.defineProperty(this,mt,{writable:!0,value:void 0}),Object.defineProperty(this,K,{writable:!0,value:void 0}),Object.defineProperty(this,V,{writable:!0,value:[]}),Object.defineProperty(this,gt,{writable:!0,value:[]}),R(this,mt)[mt]=t,R(this,K)[K]=e??{}}addAttributes(t){R(this,K)[K]={...R(this,K)[K],...t}}
12histogram({name:t,value:e,unit:r,bounds:n,attributes:a,scale:o}){const i=Date.now()*1e6;n?R(this,V)[V].push({name:t,type:"histogram",value:e,unit:r,timeUnixNano:i,attributes:a,bounds:n}):R(this,V)[V].push({name:t,type:"exponential_histogram",value:e,unit:r,timeUnixNano:i,attributes:a,scale:o})}counter({name:t,value:e,unit:r,attributes:n}){const a=Date.now()*1e6;R(this,V)[V].push({name:t,type:"counter",value:e,unit:r,timeUnixNano:a,attributes:n})}gauge({name:t,value:e,unit:r,attributes:n}){const a=Date.now()*1e6;R(this,V)[V].push({name:t,type:"gauge",value:e,unit:r,timeUnixNano:a,attributes:n})}log({body:t,attributes:e}){const r=Date.now()*1e6;R(this,gt)[gt].push({timeUnixNano:r,body:t,attributes:e})}async exportMetrics(){const t={};R(this,V)[V].forEach(r=>{switch(r.attributes={...R(this,K)[K],...r.attributes},r.type){case"histogram":ci(t,r);break;case"exponential_histogram":di(t,r);break;case"counter":ui(t,r);break;case"gauge":hi(t,r)}});const e=Object.values(t);e.length!==0&&(R(this,V)[V]=[],await R(this,mt)[mt].exportMetrics(e))}async exportLogs(){const t=R(this,gt)[gt].map(e=>{const r={timeUnixNano:e.timeUnixNano,observedTimeUnixNano:e.timeUnixNano,attributes:oi({...R(this,K)[K],...e.attributes})};return e.body&&(r.body={stringValue:e.body}),r});t.length!==0&&(R(this,gt)[gt]=[],await R(this,mt)[mt].exportLogs(t))}};function ci(t,e){var r;const{name:n,value:a,unit:o,timeUnixNano:i,attributes:s}=e,l=(r=e.bounds)!==null&&r!==void 0?r:ii,d=new Array(l.length+1).fill(0);t[n]||={name:n,unit:o||"1",histogram:{aggregationTemporality:Ar,dataPoints:[]}};for(let u=0;u<d.length;u++){const h=l[u];if(h===void 0)d[u]=1;else if(a<=h){d[u]=1;break}}t[n].histogram.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,count:1,sum:a,min:a,max:a,bucketCounts:d,explicitBounds:l,attributes:Ne(s??{})})}function di(t,e){const{name:r,value:n,unit:a,timeUnixNano:o,attributes:i,scale:s}=e;t[r]||={name:r,unit:a||"1",exponentialHistogram:{aggregationTemporality:Ar,dataPoints:[]}};const l=n<=0?0:n,d=s||3,u=2**d/Math.log(2),h=Math.ceil(Math.log(n)*u)-1,m=n<=0?1:0,y={offset:0,bucketCounts:[]},b={offset:n>0?h:0,bucketCounts:n>0?[1]:[]};t[r].exponentialHistogram.dataPoints.push({attributes:Ne(i??{}),startTimeUnixNano:o,timeUnixNano:o,count:1,sum:l,scale:d,zeroCount:m,positive:b,negative:y,min:l,max:l,zeroThreshold:0})}function ui(t,e){const{name:r,value:n,unit:a,timeUnixNano:o,attributes:i}=e;t[r]||={name:r,unit:a||"1",sum:{aggregationTemporality:Ar,isMonotonic:!0,dataPoints:[]}},t[r].sum.dataPoints.push({startTimeUnixNano:o,timeUnixNano:o,asDouble:n,attributes:Ne(i??{})})}function hi(t,e){const{name:r,value:n,unit:a,timeUnixNano:o,attributes:i}=e;t[r]||={name:r,unit:a||"1",gauge:{dataPoints:[]}},t[r].gauge.dataPoints.push({startTimeUnixNano:o,timeUnixNano:o,asDouble:n,attributes:Ne(i??{})})}var zt=ct("url"),ft=ct("serviceName"),Ft=ct("logger"),Ut=ct("fetchFn"),pi=class{constructor(t,e,r){Object.defineProperty(this,zt,{writable:!0,value:void 0}),Object.defineProperty(this,ft,{writable:!0,value:void 0}),Object.defineProperty(this,Ft,{writable:!0,value:void 0}),Object.defineProperty(this,Ut,{writable:!0,value:void 0}),R(this,zt)[zt]=t.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),R(this,ft)[ft]=e,R(this,Ft)[Ft]=r?.logger,R(this,Ut)[Ut]=r?.fetchFn}async exportMetrics(t){const e={resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,ft)[ft]}}]},scopeMetrics:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},metrics:t}]}]};await this.exportTo(e,"/v1/metrics")}async exportLogs(t){const e={resourceLogs:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,ft)[ft]}}]},scopeLogs:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},logRecords:t}]}]};await this.exportTo(e,"/v1/logs")}async exportTo(t,e){var r;const n=await this.exporterFetch()(`${R(this,zt)[zt]}${e}`,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if((r=R(this,Ft)[Ft])===null||r===void 0||r.log({status:n.status}),!n.ok){if(n.status===400){const a=await n.text();throw new $t(`Invalid OpenTelemetry Data: ${a}`)}if(n.status===429||n.status===503){const a=await n.text(),o=n.headers.get("Retry-After"),i=o?{seconds:Number(o)}:void 0;throw new $t("Server did not accept data",{errorData:a,retryAfter:i,body:t})}throw new $t(`Server responded with ${n.status}`)}}exporterFetch(){return R(this,Ut)[Ut]||fetch}}
12,$t=class extends Error{constructor(t,e){super(t),this.metadata=void 0,this.name="OpenTelemetryClientError",this.metadata=e}},mi="https://otlp-http-production.shopifysvc.com",gi="portable_wallets",fi=class{#t;constructor(t){this.#t=t}async exportMetrics(t){try{await this.#t.exportMetrics(t)}catch(e){if(e instanceof $t){const r=e.metadata?.retryAfter;if(r){await new Promise(n=>{setTimeout(()=>{this.exportMetrics(t),n()},r.seconds*1e3)});return}}console.error("Suppressed error while exporting metrics:",e,e instanceof Error?e.cause:void 0)}}async exportLogs(t){try{await this.#t.exportLogs(t)}catch(e){if(e instanceof $t){const r=e.metadata?.retryAfter;if(r){await new Promise(n=>{setTimeout(()=>{this.exportLogs(t),n()},r.seconds*1e3)});return}}console.error("Suppressed error while exporting logs:",e,e instanceof Error?e.cause:void 0)}}},yi=new fi(new pi(mi,gi)),E=new li({exporter:yi}),tn="TelemetryExportError",bi=class extends Error{};bi.prototype.name=tn;var en="LimitedCartQueryError",rn=class extends Error{};rn.prototype.name=en;var wi=["log","error","debug","warn","info","table"],an=["OpenTelemetryClientError",qa,tn,Xa,Er],_i=["Load failed","Failed to fetch","when attempting to fetch resource","GraphQL mutation failed with status 404","Component closed",'"isTrusted":true',"CSS.escape is not a function",Ya,...an],qr=new Map([["TypeError","Illegal constructor"],[en,"Limited cart query returned no response"],["AbortError","Fetch is aborted"]]),Ei=["replaceProperty","replaceWithProxy"],Ai=["chrome-lighthouse","meta-externalads","crawler","spider","scraper","facebookexternalhit","googleother","bot"],vi=["lightpanda"],nn="silenced-logged-user-agent";function Ci(t){return t===nn}function Si(t){const e=t.exceptions[0],r=Pi();return r||(Ii(t)?"empty-stack-trace":ki(e)?"spin":Ti()?"monkey-patch":Oi(t)?"external-error":Ri(t)?"injected-code":Mi(t)?"developer-error":xi(e.message)?"discarded-message":zi(t)?"discarded-error-class":Fi(e)?"discarded-class-message":Ui(t)?"unactionable-invalid-error":Ni(t)||null)}function Pi(){const t=navigator.userAgent.toLowerCase();return vi.some(e=>t.includes(e))?nn:Ai.some(e=>t.includes(e))?"silenced-user-agent":null}function Ii(t){return t.exceptions[0].stacktrace.length===0}function ki(t){return t.stacktrace.some(e=>e.file?.includes("spin.dev"))}function Ti(){return[HTMLElement,Event,document.createElement,URL].some(ja)||Di()}function Di(){return wi.some(t=>typeof console[t]!="function")}function Ri(t){return t.exceptions.some(e=>e.stacktrace.some(r=>r.inProject&&"method"in r&&Ei.some(n=>r.method===n||r.method.endsWith(`.${n}`))))}function Ni(t){const e=t.exceptions.map(r=>r.stacktrace.filter(n=>!Li(n)));return e.some(r=>!r[0]?.inProject)?"external-trigger":e.some(r=>r.filter(n=>n.inProject).every(n=>["https://www.paypal.com","https://static-na.payments-amazon.com","https://pay.google.com"].some(a=>n.file.startsWith(a))))?"wallet-sdk-stack-trace":null}function Li(t){return t.file.includes("native code")||t.file.includes("/cdn/wpm/")}function Oi(t){return!t.exceptions[0].stacktrace.some(e=>e.inProject)}function xi(t){return _i.some(e=>t?.includes(e))}function Mi(t){const e=t.exceptions.some(r=>r.errorClass===Er);return e&&console.error(t.exceptions[0]),e}function zi(t){return t.exceptions.some(e=>an.includes(e.errorClass))}function Fi(t){const e=t.errorClass,r=t.message;return qr.has(e)&&r?.includes(qr.get(e))}function Ui(t){return t.exceptions[0].errorClass==="BugsnagInvalidError"&&t.unhandled}var p=(function(t){return t.BuyItNow="BuyItNow",t.MoreOptions="MoreOptions",t.ApplePay="ApplePay",t.PayPal="PayPal",t.Venmo="Venmo",t.GooglePay="GooglePay",t.ShopPay="ShopPay",t.MetaPay="FacebookPay",t.BuyWithPrime="BuyWithPrime",t.AmazonPay="AmazonPay",t.Unknown="Unknown",t})({}),F=(function(t){return t.InvalidQuantity="InvalidQuantity",t.VariantRequiresSellingPlan="VariantRequiresSellingPlan",t.SellingPlanNotApplicable="SellingPlanNotApplicable",t.MerchandiseIdInvalid="MerchandiseIdInvalid",t.IgnoredResponseError="IgnoredGraphQLResponseError",t.NoResponse="NoResponse",t.InvalidInput="InvalidInput",t.MerchandiseNotApplicable="MerchandiseNotApplicable",t.ProductFormError="ProductFormError",t.MerchandiseLineTransformersRunError="MerchandiseLineTransformersRunError",t.GiftCardRecipientInvalid="GiftCardRecipientInvalid",t})({}),S=(function(t){return t.CartPage="cart_page",t.CartAjax="cart_ajax",t.ProductPage="product",t.Checkout="checkout",t.Unknown="unknown",t})({}),oe=(function(t){return t.CartChange="/cart/change",t.CartUpdate="/cart/update",t.CartAdd="/cart/add",t.CartClear="/cart/clear",t})({}),Dt=(function(t){return t.OneTimePurchase="ONE_TIME_PURCHASE",t.Subscription="SUBSCRIPTION",t})({}),Le=Bi();function Bi(){return{shop_id:ei,debug:!1,pageType:S.Unknown}}function on(t){Object.assign(Le,t)}function vr(){const{debug:t,...e}=Le;return e}function sn(){return Le.debug}function Cr(){return Le.pageType}function Hi(){return{appVersion:"0.1.96",userAgent:navigator.userAgent}}function ln(t={}){const e={...vr(),...Hi(),...t};return{...e,shopId:e.shop_id}}var C=(function(t){return t.ButtonRender="portable_wallets_button_render",t.ButtonRenderTimeFromFcp="portable_wallets_button_render_time_from_fcp",t.Decelerated="portable_wallets_decelerated",t.DeliveryWrongNumberOfLines="portable_wallets_delivery_wrong_number_of_lines",t.DigitalPhysicalMismatch="portable_wallets_digital_physical_mismatch",t.InitCompleted="portable_wallets_init_completed",t.InstrumentLoadEligibility="portable_wallets_instrument_load_eligibility",t.InstrumentLoaded="portable_wallets_instrument_loaded",t.InstrumentLoadTime="portable_wallets_instrument_load_time",t.InstrumentLoadTimeFromPageLoad="portable_wallets_instrument_load_time_from_page_load",t.MonorailProduceError="portable_wallets_monorail_produce_error",t.SheetClicked="portable_wallets_sheet_clicked",t.SheetCancelled="portable_wallets_sheet_cancelled",t.SheetFailed="portable_wallets_sheet_failed",t.UpdateFailed="portable_wallets_update_failed",t.PayPalTokenCreationError="portable_wallets_paypal_token_creation_error",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.CartTokenMissing="portable_wallets_cart_token_missing",t.RemovePersonalDataResult="portable_wallets_cart_remove_personal_data_result",t.GooglePayNotEligibleWebview="portable_wallets_google_pay_not_eligible_webview",t.WalletConfigDeveloperError="portable_wallets_wallet_config_developer_error",t.TopLevelErrorHandlerDeveloperError="portable_wallets_top_level_error_handler_developer_error",t.LegacyCartCookie="portable_wallets_legacy_cart_cookie",t.StyleBackwardsCompatibility="portable_wallets_style_backwards_compatibility",t.StyleBackwardsCompatibilityExecutionTime="portable_wallets_style_backwards_compatibility_execution_time",t.StyleBackwardsCompatibilityRules="portable_wallets_style_backwards_compatibility_rules",t.AmazonPayLoadRetries="portable_wallets_amazon_pay_sdk_load_retries",t.DynamicTaxFailed="portable_wallets_dynamic_tax_failed",t.SheetLoaded="portable_wallets_sheet_loaded",t.ErrorTriggered="portable_wallets_error_triggered",t.GooglePayNullCartOnAuthorize="portable_wallets_google_pay_null_cart_on_authorize",t.UnrecoverableCartError="portable_wallets_unrecoverable_cart_error",t.ShopPayPersonalizedIframeLoadTime="portable_wallets_shop_pay_personalized_iframe_load_time",t.ShopPayPersonalizedIframeLoadTimeFromPageLoad="portable_wallets_shop_pay_personalized_iframe_load_time_from_page_load",t.PaymentCompletedAfterAbort="portable_wallets_payment_completed_after_abort",t.WalletSessionAbortError="portable_wallets_wallet_session_abort_error",t.CartPaymentUpdateRetryResult="portable_wallets_cart_payment_update_retry_result",t.ProductFormError="portable_wallets_product_form_error",t.CardsinkDepositResult="portable_wallets_cardsink_deposit_result",t.AddressFieldError="portable_wallets_address_field_error",t.WalletsPlatformConfigResult="portable_wallets_wallets_platform_config_result",t})({}),Pt=(function(t){return t.InstrumentSdkLoaded="portable_wallets_instrument_sdk_loaded",t.InstrumentSdkFailed="portable_wallets_instrument_sdk_failed",t.InstrumentSdkEligible="portable_wallets_instrument_sdk_eligible",t.InstrumentSdkNotEligible="portable_wallets_instrument_sdk_not_eligible",t})({});function Gi(t,e){const r=t.exceptions[0];if(!r||!r.message||ri.checkDuplicate(r))return!1;$i(t,Wi(e),e);let n=null;try{n=Si(t)}catch(o){const i=o;console.error(i);const s={errorClass:"UnfilterableError",message:`Could not properly filter error with message: ${i.message}`,stacktrace:Ga(Va,i)};t.exceptions.unshift(s)}Ki(n);const a=n==null;return(a||sn()||Ci(n))&&Qi({errorClass:r.errorClass,message:r.message,stacktrace:JSON.stringify(r.stacktrace),filterResult:n,metadata:JSON.stringify(t.metaData)}),a}function $i(t,e,r){const n=window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes;t.context=window.location.pathname,t.request||={},t.request.url=window.location.href,t.device.orientation=window.screen?.orientation?.type,ji(t),qi(t),t.groupingHash=Vi(e);const{shop_id:a,...o}=vr();t.metaData={...t.metaData,shop:{shopId:a,...o,...t.metaData.shop},custom:{...t.metaData.custom,customFetch:ja(fetch),...Yi(r)},error_source:{shop_id:a},monorail:n},e[0]instanceof Re&&(t.metaData.graphql={...e[0].errorDetails},e[0]instanceof Tt&&(t.metaData.graphql.reason=e[0].reason))}function Vi(t){for(const e of t)if("groupingHash"in e&&e.groupingHash)return e.groupingHash.toString()}function Wi(t){const e=[];let r=t;for(;r instanceof Error&&e.length<20;){e.push(r);const n="cause"in r?r.cause:null;if(!n)break;r=n}return e}function ji(t){for(const e of t.exceptions)for(const r of e.stacktrace)["https://www.paypal.com","https://static-na.payments-amazon.com","https://pay.google.com"].some(n=>r.file.startsWith(n))&&(r.inProject=!0)}function qi(t){for(const e of t.exceptions)for(const r of e.stacktrace)r.file?.includes("portable-wallets")&&(r.file=r.file.split("#")[0].split("?")[0])}function Yi(t){if(sn()&&!(!(t instanceof Error)||!t.stack))return{rawStack:t.stack}}function Ki(t){E.counter({name:C.ErrorTriggered,value:1,attributes:{filterResult:t||"valid-error"}})}function Qi(t){E.log({body:"Bugsnag Error",attributes:ln(t)})}var Xi={apiKey:"e6b446c1ebe782e2b2fc7eb8ef0dc791",appId:Va,appVersion:"0.1.96",releaseStage:"production",locale:"de",userAgent:navigator.userAgent,metadata:{user:{id:wr("_shopify_y")??"unknown"},app:{release:"c24f842902a16d3e20e91813db3a546e49b21511"}},onError:Gi},g=new qo(Xi);g.addOnPostError(t=>{g.leaveBreadcrumb("Bugsnag Error Notified",{errorClass:t.exceptions[0].errorClass,message:t.exceptions[0].message},"error")});
12var Ji={de:{instruments_copy:{checkout:{buy_now:"Jetzt zum Checkout"}},error_dialogs:{checkout:{title:"Transaktion fehlgeschlagen",generic_error:"Checkout ist derzeit aufgrund technischer Probleme nicht verf\xFCgbar. Bitte versuche es in ein paar Minuten noch einmal.",button_text:"Schlie\xDFen"},wallet:{title:"%{wallet} nicht verf\xFCgbar",generic_error:"Es ist ein Problem mit %{wallet} aufgetreten. Versuche es erneut oder verwende eine andere Zahlungsmethode.",eligibility_error:"Artikel, die f\xFCr %{wallet} berechtigt waren, befinden sich nicht mehr in deinem Warenkorb."},product:{out_of_stock:"Dieser Artikel ist nicht mehr lieferbar.",gift_card_recipient_validation_error:"Die Person, die den Geschenkgutschein empfangen soll, ist ung\xFCltig."}},more_payment_options:"Weitere Bezahlm\xF6glichkeiten",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:"Mit\xA0%{wallet}\xA0kaufen",order_summary:{total:"Gesamtsumme",subtotal:"Zwischensumme",duties:"Zollgeb\xFChren",taxes:"Gesch\xE4tzte Steuern",shipping:"Versand",discount:"Rabatt",shipping_one_time_purchase:"Versand (einmaliger Kauf)",shipping_subscription:"Versand (Abonnement)",subscriptions:{recurring_total_tooltip_line:"Beinhaltet keine Versandkosten, Steuern, Zollgeb\xFChren oder anwendbaren Rabatte",recurring_totals:"%{fixedPrice} jede/n/s %{interval}",recurring_totals_with_policies:{one:"Die erste Zahlung betr\xE4gt %{fixedPrice}, danach %{recurringPrice} alle %{interval}",other:"Die ersten %{count} Zahlungen betragen jeweils %{fixedPrice}, danach %{recurringPrice} alle %{interval}"},recurring_total_intervals:{day:{one:"Tag",other:"%{count}\xA0Tage"},month:{one:"Monat",other:"%{count}\xA0Monate"},week:{one:"Woche",other:"%{count}\xA0Wochen"},year:{one:"Jahr",other:"%{count}\xA0Jahre"}}}},errors:{missing:{address2:"Gib eine Wohnung, ein Zimmer usw. ein",phone:"Gib eine Telefonnummer ein",first_name:"Gib einen Vornamen ein",email:"Gib eine E-Mail-Adresse ein.",last_name:"Gib einen Nachnamen ein",address1:"Gib eine Adresse ein",city:"Gib eine Stadt ein",zone:"W\xE4hle ein Bundesland/eine Provinz aus",postal_code:"Gib eine Postleitzahl ein",shipping_option:"Eine Versandart ausw\xE4hlen",country:"Land ausw\xE4hlen",emirate:"Ein Emirat eingeben"},invalid:{email:"Gib eine g\xFCltige E-Mail-Adresse ein",country:"W\xE4hle ein Land / eine Region aus",phone:"Eine g\xFCltige Telefonnummer eingeben",first_name:"Gib einen g\xFCltigen Vornamen ein",last_name:"Gib einen g\xFCltigen Nachnamen ein",address1:"Gib eine g\xFCltige Adresse ein",address2:"Gib eine g\xFCltige Wohnung, ein g\xFCltiges Zimmer usw. ein",city:"Eine g\xFCltige Stadt eingeben",zone:"Ein g\xFCltiges Bundesland / eine g\xFCltige Provinz ausw\xE4hlen",postal_code:"Gib eine g\xFCltige Postleitzahl ein",billing_address:"Ung\xFCltige Rechnungsadresse",shipping_address:"Ung\xFCltige Lieferadresse",payment_method:"Ung\xFCltige Zahlungsmethode",discount:"Ung\xFCltiger Rabatt",emirate:"G\xFCltiges Emirat eingeben"},emojis:{first_name:"Vorname darf keine Emojis enthalten",last_name:"Nachname darf keine Emojis enthalten",city:"Stadt darf keine Emojis enthalten",address1:"Adresszeile darf keine Emojis enthalten",address2:"Zweite Adresszeile darf keine Emojis enthalten",postal_code:"Postleitzahl darf keine Emojis enthalten",phone:"Telefonnummer darf keine Emojis enthalten"},too_long:{address1:"Adresszeile ist zu lang",address2:"Zweite Adresszeile ist zu lang",first_name:"Vorname ist zu lang",last_name:"Nachname ist zu lang",city:"Stadt ist zu lang"},url:{first_name:"Vorname darf keine URL enthalten",last_name:"Nachname darf keine URL enthalten"},html_tags:{first_name:"Der Vorname darf keine HTML-Tags enthalten",last_name:"Der Nachname darf keine HTML-Tags enthalten",city:"Stadt darf keine HTML-Tags enthalten",address1:"Adresszeile darf keine HTML-Tags enthalten",address2:"Zweite Adresszeile darf keine HTML-Tags enthalten"},currency:{mismatch:"Dein Warenkorb und deine W\xE4hrung wurden anhand deines Versandlands aktualisiert."},address_unserviceable:"%{shopName} liefert derzeit nicht an diese Adresse. Verwende eine andere Adresse, um deinen Kauf abzuschlie\xDFen."},subscriptions:{cancellation_policy:"Stornierungsrichtlinie",policy_not_found:"Die Abonnement-Richtlinie konnte nicht gefunden werden. Aktualisiere die Seite oder kontaktiere uns, um weitere Informationen zu erhalten."},shipping_methods:{connect_shipping_methods:"%{methodOne} und %{methodTwo}",choose_delivery_strategy:"Eine Zustellmethode ausw\xE4hlen"},shop_promise_delivery:{same_day:"Zustellung am selben Tag",next_day:"Zustellung am n\xE4chsten Tag",two_day:"2-Tages-Zustellung"},action:{view:"%{content} anzeigen"},express_checkout:"Express-Checkout",delivery_promises:{connect_delivery_promises:"%{promiseOne} und %{promiseTwo}"},managed_markets:{terms_and_conditions:"Gesch\xE4ftsbedingungen des eingetragenen H\xE4ndlers",privacy_policy:"Datenschutzerkl\xE4rung des eingetragenen H\xE4ndlers",policy_not_found:"Die Richtlinie konnte nicht gefunden werden. Aktualisiere die Seite oder kontaktiere uns, um weitere Informationen zu erhalten"},pay_with_button_content:"Mit %{wallet} bezahlen",show_more_options:"Mehr anzeigen",hide_more_options:"Mehr ausblenden",google_pay_in_progress_scrim:{continue_purchase:"Setze deinen Kauf in %{wallet} fort",cancel:"Abbrechen"}}}
12,We,Yr=class extends Error{constructor(t,e){const r=`i18n: Missing or invalid translation '${t}' in '${e}'`;super(r)}},Zi=class extends Error{constructor(t,e,r){const n=`i18n: Missing translation template key '${t}' for '${e}' in '${r}'`;super(n)}},ts=class extends Error{constructor(t,e,r){const n=`i18n: Invalid pluralization for '${t}':'${e}' in '${r}'`;super(n)}};function Oe(){return We==null&&(We=es(Ji)),We}function es(t){const e=(o,i)=>typeof o!="string"&&i.count!==void 0,r=(o,i)=>{let s=i===1?"one":"other";return i===0&&typeof o!="string"&&o.zero!==void 0&&(s="zero"),s},n=(o,i={})=>{const s=o.match(/%\{.+?\}/g);return s?s.reduce((l,d)=>{const u=d.replace(/%\{(.*)\}/,"$1");return i[u]?l.replace(d,i[u]):(g.notify(new Zi(u,o,a)),l)},o):o},a=rs();return{locale:a,translate(o,i={}){const s=o.split(".");let l=t[a];try{for(const d of s)switch(typeof l){case"object":l=l[d];break;case"string":case"undefined":throw new Yr(o,a)}if(e(l,i)){if(typeof l=="string")throw new ts(o,l,a);l=l[r(l,i.count)]}if(typeof l!="string")throw new Yr(o,a);return n(l,i)}catch(d){return g.notify(d),i.defaultValue??o}}}}function rs(){return"de"}function Kr(t){t&&t.src&&console.error(`Failed to load portable wallets script ${t.src}`);const e=document.querySelectorAll("shopify-accelerated-checkout .shopify-payment-button__skeleton, shopify-accelerated-checkout-cart .wallet-cart-button__skeleton"),r=document.getElementById("shopify-buyer-consent");for(let n=0;n<e.length;n++)e[n].remove();r&&r.remove()}function cn(t){!(t instanceof ErrorEvent)||!(typeof t.message=="string"&&t.message.includes("import.meta"))||!(typeof t.filename=="string"&&t.filename.includes("portable-wallets"))||(window.removeEventListener("error",cn),window.Shopify.PaymentButton.failedToLoad=t,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",window.Shopify.PaymentButton.init):window.Shopify.PaymentButton.init())}window.addEventListener("error",cn);var nr=[];function tt(t,e,r){if(window.customElements==null)return g.leaveBreadcrumb("customElements is null on window"),Kr(),!1;try{const n=e;return window.customElements.get(t)||(window.customElements.define(t,n),r?.isChildCustomElement&&nr.push(t)),!0}catch(n){return g.notify(n),Kr(),!1}}function me(){const t=new URLSearchParams(window.location.search);return function(e){return!!t.get(e)}}function Sr(){try{const t=window.__WALLET_TIMEOUT_MULTIPLIER;if(t==null)return 1;const e=Number(t);return!Number.isFinite(e)||e<1?1:Math.min(e,10)}catch{return 1}}function xe(){const t=window.Shopify?.CartType;if(t===S.CartAjax)return S.CartAjax;if(t===S.CartPage)return S.CartPage;const e=window.ShopifyAnalytics?.meta?.page?.pageType;if(e)switch(e.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}const r=document.querySelector("#shop-js-analytics");if(r)try{const n=JSON.parse(r.textContent||"{}");if(n.pageType)switch(n.pageType.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}}catch(n){console.error("Error parsing JSON script tag:",n)}return S.Unknown}function st(t){return Number(t).toFixed(2)}function Pr(t){return Qt(t?.id)}function Qt(t){if(t?.includes("gid://shopify/Cart/"))return t.replace("gid://shopify/Cart/","").split("?")[0]}function J(){let t;return[new Promise(e=>t=e),t]}function dn(){return!!document.querySelector('[data-source-attribution="shopify.shop-promise-pdp"]')}function Vt(){return new Date().getTime()}function Ir(t){return t.find(e=>e.code==="VALIDATION_CUSTOM"&&!!e.message)}function Qr(){const t=window.navigator.userAgent,e=t.includes("iPhone OS 26_0"),r=t.includes("Version/26.0"),n=t.includes("iPhone OS");return e||r&&n}function as(t){return t.title==="Default Title"?t.product.title:`${t.product.title} - ${t.title}`}function un(t,e){return t.map(r=>{let n=as(r.merchandise);r.quantity>1&&(n=`${r.quantity} \xD7 ${n}`),r.isNestedLine&&(n=`\u2937 ${n}`);const a=st(r.totalAmount.amount);return e(n,a)})}function ns(){return window.scheduler?.yield?window.scheduler.yield():new Promise(t=>{window.scheduler?.postTask?window.scheduler.postTask(t):setTimeout(t,0)})}var os=class extends HTMLElement{originalStyle={position:"",overflow:"",top:""};scrollPosition=0;formerFocus=null;connectedCallback(){this.shadowRoot||this.attachShadow({mode:"open"}),this.formerFocus=document.activeElement;const t=Oe();this.render(t);const e=this.shadowRoot,r=e.getElementById("modal");e.querySelectorAll("button").forEach(a=>a.addEventListener("click",this.closeModal.bind(this))),e.getElementById("overlay")?.addEventListener("click",a=>this.handleOutsideClick(a,r)),document.addEventListener("keydown",this.handleEscapeKey.bind(this));const n=document.createElement("style");n.textContent=Bo,e.appendChild(n),this.applyScrollLock(),this.trapFocus(r,e),tt("svg-icon",Uo)}trapFocus(t,e){if(!t)return;const r=t.querySelectorAll("a[href], button"),n=Array.from(r),a=n[0],o=n[n.length-1];t.addEventListener("keydown",i=>{i.key==="Tab"&&!i.shiftKey&&e.activeElement===o&&(i.preventDefault(),a.focus()),i.key==="Tab"&&i.shiftKey&&e.activeElement===a&&(i.preventDefault(),o.focus())}),a.focus()}handleOutsideClick(t,e){e&&(e.contains(t.target)||this.closeModal())}handleEscapeKey(t){t.key==="Escape"&&this.closeModal()}closeModal(){this.removeScrollLock(),this.remove(),this.formerFocus&&"focus"in this?.formerFocus&&typeof this.formerFocus.focus=="function"&&this.formerFocus?.focus()}applyScrollLock(){this.originalStyle={position:document.body.style.position,overflow:document.body.style.overflow,top:document.body.style.top},document.body.style.overflow="hidden",Qr()&&(this.scrollPosition=window.scrollY,document.body.style.position="fixed",document.body.style.top=`-${this.scrollPosition}px`)}removeScrollLock(){document.body.style.overflow=this.originalStyle?.overflow??"",Qr()&&(document.body.style.position=this.originalStyle?.position??"",document.body.style.top=this.originalStyle?.top??"",window.scrollTo({top:this.scrollPosition,behavior:"instant"}))}render(t){const e=this.getAttribute("title"),r=this.getAttribute("has-close-button"),n=t.translate("error_dialogs.checkout.button_text"),a=` 13 <footer> 14 <button type="button" id="close-button" tabindex="0">${n}</button> 15 </footer> 16 `;this.shadowRoot.innerHTML=` 17 <div id="overlay"> 18 <div id="modal" role="dialog" aria-modal="true" aria-labelledby="title"> 19 <header> 20 <h2 id="title">
21 <span class="capitalize">${e}</span> 22 </h2> 23 <button type="button" id="close-icon" aria-label=${n} tabindex="0"> 24 <svg-icon color="gray"></svg-icon> 25 </button> 26 </header> 27 <div id="content"> 28 <p><slot></slot></p> 29 </div> 30 ${r?a:""} 31 </div> 32 </div> 33 `}},is="@keyframes topLevelModalLoadingSkeleton{50%{opacity:1}75%{opacity:.5}to{opacity:1}}top-level-modal .text-skeleton{background-color:#dedede;width:100%;height:14px;margin-bottom:7px;animation:4s -.168s infinite topLevelModalLoadingSkeleton;display:inline-block;text-decoration:none!important}top-level-modal .text-skeleton:last-of-type{width:50%}";function ss(t,e,r){return(e=cs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Jr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Xr(Object(r),!0).forEach(function(n){ss(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ls(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cs(t){var e=ls(t,"string");return typeof e=="symbol"?e:e+""}var ds="https://monorail-edge.shopifysvc.com",us="/v1/produce";function hs(){if(typeof crypto<"u"&&crypto&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Array(36);for(let e=0;e<36;e++)t[e]=Math.floor(Math.random()*16);return t[14]=4,t[19]=t[19]&=-5,t[19]=t[19]|=8,t[8]=t[13]=t[18]=t[23]="-",t.map(e=>e.toString(16)).join("")}function ps(t,e=!0){return t&&Object.keys(t).length&&e?Object.keys(t).map(r=>({[ms(r)]:t[r]})).reduce((r,n)=>Jr(Jr({},r),n)):t}function ms(t){return t.split(/(?=[A-Z])/).join("_").toLowerCase()}function gs(t){const e={"Content-Type":"application/json; charset=utf-8","X-Monorail-Edge-Event-Created-At-Ms":(t&&t.eventCreatedAtMs||Date.now()).toString(),"X-Monorail-Edge-Event-Sent-At-Ms":Date.now().toString(),"X-Monorail-Edge-Client-Message-Id":(t&&t.clientMessageId||hs()).toString()};return t&&t.userAgent&&(e["User-Agent"]=t.userAgent),t&&t.remoteIp&&(e["X-Forwarded-For"]=t.remoteIp),t&&t.deviceInstallId&&(e["X-Monorail-Edge-Device-Install-Id"]=t.deviceInstallId),t&&t.client&&(e["X-Monorail-Edge-Client"]=t.client),t&&t.clientOs&&(e["X-Monorail-Edge-Client-OS"]=t.clientOs),e}async function fs({endpoint:t,event:e,keepalive:r}){var n,a,o,i,s;const l=e.metadata?{clientMessageId:(n=e.metadata)===null||n===void 0?void 0:n.clientMessageId,eventCreatedAtMs:(a=e.metadata)===null||a===void 0?void 0:a.eventCreatedAtMs,consent:(o=e.metadata)===null||o===void 0?void 0:o.consent,consent_provider:(i=e.metadata)===null||i===void 0?void 0:i.consent_provider,consent_version:(s=e.metadata)===null||s===void 0?void 0:s.consent_version}:void 0;return fetch(t??ds+us,{method:"post",headers:gs(e.metadata),body:JSON.stringify({schema_id:e.schemaId,payload:e.payload,metadata:l&&ps(l,!0)}),keepalive:r})}var je={NO_VALUE:"",ACCEPTED:"1",DECLINED:"0"},j={PREFERENCES:"p",ANALYTICS:"a",MARKETING:"m",SALE_OF_DATA:"t"},ot={MARKETING:"m",ANALYTICS:"a",PREFERENCES:"p",SALE_OF_DATA:"s"},Bt={MARKETING:"marketing",ANALYTICS:"analytics",PREFERENCES:"preferences",SALE_OF_DATA:"sale_of_data",EMAIL:"email"},it={HEADLESS_STOREFRONT:"headlessStorefront",ROOT_DOMAIN:"rootDomain",CHECKOUT_ROOT_DOMAIN:"checkoutRootDomain",STOREFRONT_ROOT_DOMAIN:"storefrontRootDomain",STOREFRONT_ACCESS_TOKEN:"storefrontAccessToken",IS_EXTENSION_TOKEN:"isExtensionToken",METAFIELDS:"metafields",CUSTOMER_ACCOUNT_REQUEST_INFO:"customerAccountRequestInfo"},kr=()=>typeof window>"u",Lt=()=>typeof __CtaTestEnv__>"u"?!1:__CtaTestEnv__==="true",te=class{};te.warn=t=>{Lt()||console.warn(t)},te.error=t=>{Lt()||console.error(t)},te.info=t=>{Lt()||console.info(t)},te.debug=t=>{Lt()||console.debug(t)},te.trace=t=>{Lt()||console.trace(t)};function ge(t){try{return decodeURIComponent(t)}catch{return""}}var ys="_tracking_consent";function bs(){try{return document.cookie}catch{return!1}}function hn(t,e=!1){const r=bs()?document.cookie.split("; "):[];for(let n=0;n<r.length;n++){const[a,o]=r[n].split("=");if(t===ge(a))return ge(o)}if(e&&t==="_tracking_consent"&&!window.localStorage.getItem("tracking_consent_fetched"))return Lt()?void 0:(console.debug("_tracking_consent missing"),ws(),window.localStorage.setItem("tracking_consent_fetched","true"),hn(t,!1))}function ws(t="/"){const e=new XMLHttpRequest;e.open("HEAD",t,!1),e.withCredentials=!0,e.send()}function _s(){return hn(ys)}var Es="customer_privacy_api_events/2.0",pn=class de{constructor(){if(de.instance)return de.instance;de.instance=this}produce(e,r){if(!kr())try{const n={schema_id:Es,payload:{shop_domain:window.location.host,method_name:e,call_details:r||null}},a={accept:"*/*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8","content-type":"application/json; charset=utf-8","x-monorail-edge-event-created-at-ms":String(Date.now()),"x-monorail-edge-event-sent-at-ms":String(Date.now())};if(window.location.host.endsWith("spin.dev"))console.log("Monorail event from consent API:",a,n);else return fetch("https://monorail-edge.shopifysvc.com/v1/produce",{headers:a,body:JSON.stringify(n),method:"POST",mode:"cors",credentials:"omit"})}catch{}}};pn.instance=void 0;var As="_cmp";function vs(){let t;if(Ss()?t=qe(Cs)||qe(Zr):t=qe(Zr),!t){let e;try{e=sessionStorage.getItem("consentHeader")}catch{}return e||void 0}try{t=decodeURIComponent(t)}catch{}return t}function qe(t){try{return t()}catch{return}}function Zr(){var t,e;if(!gn()&&!Is()){const a=new pn;let o="failed_to_fetch";try{o=navigator.userAgent}catch{}a.produce("navigationServerTiming",JSON.stringify({failed:!0,userAgent:o})),Ps()}const r=(t=performance)===null||t===void 0||(e=t.getEntriesByType)===null||e===void 0?void 0:e.call(t,"navigation");if(!r)return;const n=r.map(mn).find(a=>a);if(n)try{sessionStorage.setItem("consentHeader",n)}catch{}return n}var ta=void 0;function Cs(){var t,e;const r=(t=performance)===null||t===void 0||(e=t.getEntriesByType)===null||e===void 0?void 0:e.call(t,"resource");let n=ta;for(let a=r.length-1;a>=0;a--){let o=mn(r[a]);if(o){n=o;break}}return ta=n,n}function mn(t){var e,r;if(t)return(e=t.serverTiming)===null||e===void 0||(r=e.find(n=>n.name==As))===null||r===void 0?void 0:r.description}function Tr(){return window}
33function Ss(){var t,e;const r=Tr();return(r==null||(t=r.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.backendConsentEnabled)===!0}function gn(){var t,e;const r=Tr();return r==null||(t=r.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.serverTimingSupportVerified}function Ps(){if(gn())return;const t=Tr();t.Shopify||(t.Shopify={}),t.Shopify.customerPrivacy||(t.Shopify.customerPrivacy={}),t.Shopify.customerPrivacy.serverTimingSupportVerified=!0}function Is(){try{const t=performance.getEntriesByType("navigation")[0].serverTiming;return!(!t||t.length==0)}catch{return!1}}var ks="_cs";function Ts(){return new URLSearchParams(window.location.search).get(ks)||void 0}function Ds(){var t,e;const r=(t=window.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.cachedConsent;return r?ge(r):void 0}var Rs;function ea(){if(kr())return Rs;{var t,e;const r=(t=window.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.injectedConsent;return r?ge(r):void 0}}function Ns(){let t;if(kr()?t=ea():t=Ds()||ea()||Ts()||_s()||vs(),t!==void 0)return Os(t)}function Ls(){try{return Ns()||void 0}catch{return}}function Os(t){if(t.slice(0,1)=="%")try{t=decodeURIComponent(t)}catch{}const e=t.slice(0,1);if(e=="{")return xs(t);if(e=="3")return Ms(t)}function xs(t){var e;let r;try{r=JSON.parse(t)}catch{return}if(r.v==="2.1"&&(e=r.con)!==null&&e!==void 0&&e.CMP)return r}function Ms(t){const e=t.slice(1).split("_"),[r,n,a,o,i]=e;let s;try{s=e[5]?JSON.parse(e.slice(5).join("_")):void 0}catch{}let l;if(i){const h=i.replace(/\*/g,"/").replace(/-/g,"+"),m=atob(h);let y="";for(let b=0;b<m.length;b++){const A=m.charCodeAt(b).toString(16);y+=A.length===1?"0"+A:A}l=[8,13,18,23].reduce((b,A)=>b.slice(0,A)+"-"+b.slice(A),y)}function d(h){const m=r.split(".")[0];return m.includes(h.toLowerCase())?je.DECLINED:m.includes(h.toUpperCase())?je.ACCEPTED:je.NO_VALUE}function u(h){return r.includes(h.replace("t","s").toUpperCase())}return{v:"3",con:{CMP:{[ot.ANALYTICS]:d(ot.ANALYTICS),[ot.PREFERENCES]:d(ot.PREFERENCES),[ot.MARKETING]:d(ot.MARKETING),[ot.SALE_OF_DATA]:d(ot.SALE_OF_DATA)}},region:n||"",cus:s,purposes:{[j.ANALYTICS]:u(j.ANALYTICS),[j.PREFERENCES]:u(j.PREFERENCES),[j.MARKETING]:u(j.MARKETING),[j.SALE_OF_DATA]:u(j.SALE_OF_DATA)},sale_of_data_region:o=="t",display_banner:a=="t",consent_id:l}}function Me(t){const e=Ls();if(!e||!e.purposes)return!0;const r=e.purposes[t];return typeof r=="boolean"?r:!0}function zs(){return Me(j.PREFERENCES)}function Fs(){return Me(j.ANALYTICS)}function Us(){return Me(j.MARKETING)}function Bs(){return Me(j.SALE_OF_DATA)}var fn=[Bt.MARKETING,Bt.ANALYTICS,Bt.PREFERENCES,Bt.SALE_OF_DATA],$p=[...fn,Bt.EMAIL,it.ROOT_DOMAIN,it.CHECKOUT_ROOT_DOMAIN,it.STOREFRONT_ROOT_DOMAIN,it.STOREFRONT_ACCESS_TOKEN,it.HEADLESS_STOREFRONT,it.IS_EXTENSION_TOKEN,it.METAFIELDS,it.CUSTOMER_ACCOUNT_REQUEST_INFO],Vp=fn.map(t=>`"${t}"`).join(", ");function Hs(){return Fs()}function Gs(){return zs()}function $s(){return Us()}function Vs(){return Bs()}function Ws(){return $s()}function js(){return Hs()}function qs(){return Gs()}function Ys(){return Vs()}function Ks(){const t=[];return js()&&t.push("analytics"),Ws()&&t.push("marketing"),Ys()&&t.push("sale_of_data"),qs()&&t.push("preferences"),t}function Qs(t,e){if(e==="v1"){const r=Ks();return{...t,metadata:{...t?.metadata,consent:r,consent_provider:"consent-tracking-api",consent_version:e}}}else throw new Xs(e||"unknown")}var Xs=class Qa extends Error{constructor(e){super(`Version ${e} is not supported by the consent-tracking-api provider`),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,Qa.prototype)}},Js=["Chrome-Lighthouse","Googlebot"];function bn(){const t=navigator.userAgent;return Js.some(e=>t.includes(e))}async function Zs(t){if(bn())return;const e=Qs(t,"v1");let r;try{r=await fs({event:e})}catch{}if(!r?.ok)try{E.counter({name:C.MonorailProduceError,value:1,attributes:{schemaId:e.schemaId}})}catch{}}var tl="shopify_wallet_checkout_track/6.3";async function G(t){const e=await _n();e&&await wn({schemaId:tl,payload:{app_name:"storefront",page_type:xe(),checkout_one:!0,event:t.event,event_subtype:t.eventSubtype,checkout_token:t.checkoutToken,instrument_id:t.instrumentId,ttl:t.ttl,error_reason:t.errorReason,uniq_token:e?.uniqToken??"",visit_token:e?.visitToken??"",micro_session_id:e?.microSessionId??"",micro_session_count:e?.microSessionCount??0,shop_id:e?.shopId??0,theme_id:e?.themeId,theme_city_hash:e?.themeCityHash??"",content_language:e?.contentLanguage??"",referer:e?.referer}},t)}async function wn(t,e){g.leaveBreadcrumb(`monorail event produced to ${t.schemaId}`,{schemaId:t.schemaId,payload:e});try{await Zs(t)}catch(r){g.notify(new En(`Failed to send monorail event: ${r}`,{cause:r}),{metadata:{request:{monorail:{payload:JSON.stringify(t)}}}})}}async function _n(){return window?.ShopifyAnalytics?.lib?.trekkie||await new Promise(t=>{const e=setInterval(()=>{window?.ShopifyAnalytics?.lib?.trekkie&&(clearInterval(e),t())},100),r=setTimeout(()=>{clearInterval(e),clearTimeout(r),t()},7e3)}),window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes}
33var En=class extends Error{};En.prototype.name="MonorailError";var z=(function(t){return t.CartInitCalled="portable_wallets_cart_init_called",t.ClickSheetCancelled="portable_wallets_instrument_click_sheet_cancelled",t.ClickSheetFailed="portable_wallets_instrument_click_sheet_failure",t.ClickSheetSuccess="portable_wallets_instrument_click_sheet_success",t.SheetFailed="portable_wallets_instrument_sheet_failed",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.InitCalled="portable_wallets_init_called",t.InitFailed="portable_wallets_init_failed",t.InitSuccess="portable_wallets_init_success",t.UpdateFailed="portable_wallets_instrument_update_failed",t.InstrumentLoaded="portable_wallets_instrument_loaded",t.InstrumentLoadFailed="portable_wallets_instrument_load_failed",t.FirstVisible="portable_wallets_first_visible",t.FirstVisibleNotAvailable="portable_wallets_first_visible_not_available",t.SheetLoaded="portable_wallets_sheet_loaded",t.ShopPayButtonInView="portable_wallets_shop_pay_button_in_view",t.RecoveryFlowInitiated="portable_wallets_recovery_flow_initiated",t})({}),el="checkout_next_performance_metrics/1.0",rl={api_client_id:0,checkout_token:"",source_design:"portable_wallets",source_type:"cart"};async function al({eventName:t,eventValue:e,eventUnit:r="ms"}){const n=await _n();if(!n)return;const{shop_id:a,cartId:o}=vr(),i={schemaId:el,payload:{...rl,shop_id:a,source_id:o??"",locale:n.contentLanguage??"",device_type:nl()?"mobile":"desktop",browser:window.navigator.userAgent,step:xe(),event_name:t,event_value:e.toString(),event_unit:r,event_type:"component_load",frontend_event_timestamp_epoch_ms:Vt()}};await wn(i,{eventName:t,eventValue:e,eventUnit:r})}function nl(){return/Mobi|Android/i.test(window.navigator.userAgent)}var O=(function(t){return t.ButtonDisplay="buttonDisplay",t.LoadInstrument="loadInstrument",t.LoadSdk="loadSDK",t.AuthorizationLatency="authorizationLatency",t.SheetLoad="sheetLoad",t.StyleExtract="styleExtract",t})({}),ol="first-contentful-paint";function An(){return!!window.performance?.mark&&!!window.performance?.measure}function il(){return!!window.performance?.now&&!!window.performance?.getEntriesByName}function sl(){if(il())try{const t=window.performance.getEntriesByName(ol,"paint")[0]?.startTime;return t===void 0?void 0:window.performance.now()-t}catch{return}}function Rt(t,e){return Ot(t,e),()=>Y(t,e)}function Ot(t,e){An()&&window.performance.mark(`${t}-${e}-start`)}function Y(t,e){if(An())try{const r=`${t}-${e}-start`,n=`${t}-${e}-end`,a=`${t}-${e}-duration`;return window.performance.mark(n),(window.performance.measure(a,r,n)??window.performance.getEntriesByName(a,"measure")?.[0])?.duration??void 0}catch{return}}var ll=class extends Error{};ll.prototype.name="BenchmarkError";var ra={[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 cl({apiClientId:t,skus:e,pageType:r}){if(!window.Shopify?.analytics)return;const n=r&&ra[r]||"bwp_widget_click";n===ra[S.Checkout]&&window.Shopify.analytics.publish(`shopify:app:pixels:load:${t}`,{},{sendTo:"PIXEL-LOADER"}),e&&window.Shopify.analytics.publish(n,{skus:e},{sendTo:t})}var Ye=new Set,aa=!1,Q={register:t=>{aa||(aa=!0,t.forEach(e=>Ye.add(e)))},enabled:t=>Ye.has(t),allEnabled:()=>Array.from(Ye),reset:()=>{}},na="61de4ecc",vn="1172c16a",dl="a1d1f9a1",ul="f5afabb3",hl="370070f3",Cn="fefb6171",pl=typeof window<"u"&&window.ApplePaySession!==void 0;function ml(){return pl?"native":Q.enabled(Cn)?"sdk":"native"}function I(t){return{pageType:Cr(),...t.instrument===p.ApplePay&&{sessionMode:ml()},...t}}function gl(){const t=Cr()===S.CartPage?z.CartInitCalled:z.InitCalled;G({event:t})}function fl(t){const e=t?"Failed":"Success",r=Fl(t)?`[${t.name}]: ${t.code}`:void 0,n=z[`Init${e}`];G({event:n,eventSubtype:r}),E.counter({name:C.InitCompleted,value:1,attributes:I({result:e.toLowerCase(),eventType:r,recoveredFailure:!!window.Shopify?.PaymentButton?.failedToLoad})})}function yl({instrumentOrComponentName:t,result:e,measurement:r}){G({event:e==="success"?z.InstrumentLoaded:z.InstrumentLoadFailed,instrumentId:t,ttl:r}),E.counter({name:C.InstrumentLoaded,value:1,attributes:I({instrument:t,result:e})}),r!=null&&(E.histogram({name:C.InstrumentLoadTime,value:r,attributes:I({instrument:t,result:e}),unit:"ms"}),E.histogram({name:C.InstrumentLoadTimeFromPageLoad,value:window.performance.now(),attributes:I({instrument:t,result:e}),unit:"ms"}))}function bl({instrumentOrComponentName:t}){if(bn())return;const e=sl();if(e===void 0)return;const r=Math.round(e);E.histogram({name:C.ButtonRenderTimeFromFcp,value:r,attributes:I({instrument:t}),unit:"ms"}),al({eventName:C.ButtonRenderTimeFromFcp,eventValue:r})}function wl({instrument:t,measurement:e,result:r}){const n=r==="success"?Pt.InstrumentSdkLoaded:Pt.InstrumentSdkFailed;G({event:n,instrumentId:t,ttl:e,errorReason:r==="success"?void 0:r}),e!=null&&E.histogram({name:Pt.InstrumentSdkLoaded,value:e,attributes:I({instrument:t,result:r}),unit:"ms"})}function _l({instrument:t,result:e,reason:r}){const n=e==="success"?Pt.InstrumentSdkEligible:Pt.InstrumentSdkNotEligible;G({event:n,instrumentId:t}),E.counter({name:Pt.InstrumentSdkEligible,value:1,attributes:I({instrument:t,reason:r,result:e})})}function El({instrument:t,result:e,reason:r}){E.counter({name:C.InstrumentLoadEligibility,value:1,attributes:I({instrument:t,result:e,reason:r})})}function Al(t){E.counter({name:C.ButtonRender,value:1,attributes:I({result:"success",instrument:t})})}function vl(t){E.counter({name:C.ButtonRender,value:1,attributes:I({result:"failed",instrument:t})})}function Cl({instrument:t,result:e,webPixelMetaData:r,reason:n}){G({event:e==="success"?z.ClickSheetSuccess:z.ClickSheetFailed,instrumentId:t}),E.counter({name:C.SheetClicked,value:1,attributes:I({instrument:t,result:e,...n&&{reason:n}})}),t===p.BuyWithPrime&&r&&cl(r)}function Sl({instrument:t,request:e,error:r}){G({event:`${z.UpdateFailed}-${e}`,instrumentId:t}),r&&c.log({body:"Update failed with error",attributes:{instrument:t,request:e,error:String(r)}}),E.counter({name:C.UpdateFailed,value:1,attributes:I({instrument:t,request:e})})}function Pl({errorCode:t}){E.counter({name:C.PayPalTokenCreationError,value:1,attributes:I({errorCode:t})})}function Il(t){G({event:z.ClickSheetCancelled,instrumentId:t}),E.counter({name:C.SheetCancelled,value:1,attributes:I({instrument:t})})}function kl(t,e,r){G({event:z.SheetFailed,instrumentId:t,errorReason:e?.message??String(e)}),E.counter({name:C.SheetFailed,value:1,attributes:I({instrument:t,...r&&{reason:r}})})}function Tl(t){G({event:z.AuthorizationAttempt,instrumentId:t}),E.counter({name:C.AuthorizationAttempt,value:1,attributes:I({instrument:t})})}function Dl({instrument:t,measurement:e,result:r}){G({event:z.AuthorizationComplete,eventSubtype:r,ttl:e,instrumentId:t}),e!=null&&E.histogram({name:C.AuthorizationComplete,value:e,attributes:I({instrument:t,result:r}),unit:"ms"})}function Rl({instrument:t,reason:e,stage:r}){E.counter({name:C.Decelerated,value:1,attributes:I({instrument:t,reason:e,...r&&{stage:r}}
33)}),c.log({body:"Checkout decelerate",attributes:{instrument:t,reason:e,...r&&{stage:r}}}),c.flushTelemetry()}function Nl({reason:t}){E.counter({name:C.CartTokenMissing,value:1,attributes:{reason:t}})}function Ll({success:t}){E.counter({name:C.RemovePersonalDataResult,value:1,attributes:I({success:t})})}function Ol(){E.counter({name:C.WalletConfigDeveloperError,value:1})}function xl({instrument:t,code:e}){E.counter({name:C.TopLevelErrorHandlerDeveloperError,value:1,attributes:I({instrument:t,code:e})}),c.log({body:"Top level error handler failed",attributes:{instrument:t,code:e}})}function Ml(){E.counter({name:C.LegacyCartCookie,value:1})}function zl(){window.setInterval(()=>{Sn()},1e3)}function Fl(t){return t instanceof Error&&t.name==="DeveloperError"}function Sn(){E.exportMetrics(),E.exportLogs()}function Ul(t){const{body:e,attributes:r}=t;E.log({body:e,attributes:ln(r)})}function Bl({usedBackwardsCompatibility:t}){E.counter({name:C.StyleBackwardsCompatibility,value:1,attributes:{usedBackwardsCompatibility:t}})}function Hl({measurement:t,pageType:e,stylesWritten:r}){E.histogram({name:C.StyleBackwardsCompatibilityExecutionTime,value:t,attributes:I({pageType:e,stylesWritten:r}),unit:"ms"})}function Gl({rule:t,count:e,pageType:r}){E.counter({name:C.StyleBackwardsCompatibilityRules,value:e,attributes:I({rule:t,pageType:r})})}function $l({retries:t}){E.counter({name:C.AmazonPayLoadRetries,value:1,attributes:{retries:t}})}function Vl({instrument:t}){E.counter({name:C.DynamicTaxFailed,value:1,attributes:I({instrument:t})}),c.log({body:"Dynamic tax failed",attributes:{instrument:t}})}function Wl({instrument:t,measurement:e}){E.histogram({name:C.SheetLoaded,value:e,attributes:I({instrument:t}),unit:"ms"})}function jl({instrument:t,errorName:e}
33){E.counter({name:C.UnrecoverableCartError,value:1,attributes:I({instrument:t,errorName:e})}),c.log({body:"Unrecoverable error detected",attributes:{instrument:t,errorName:e}})}function ql({instrument:t,error:e}){E.counter({name:C.PaymentCompletedAfterAbort,value:1,attributes:I({instrument:t,error:e})})}function Yl(){E.counter({name:C.GooglePayNullCartOnAuthorize,value:1,attributes:I({instrument:p.GooglePay})})}function Kl({instrument:t,errorName:e,methodName:r}){E.counter({name:C.WalletSessionAbortError,value:1,attributes:I({instrument:t,errorName:e,methodName:r})}),c.log({body:`Wallet session abort error: ${e}`,attributes:{instrument:t,methodName:r}})}function Ql({instrument:t,retryCount:e,retryDuration:r,success:n,totalAmountChange:a,...o}){E.histogram({name:C.CartPaymentUpdateRetryResult,value:r,attributes:I({instrument:t,retryCount:e,success:n,totalAmountChange:a}),unit:"ms"}),c.log({body:"Cart payment update retry completed",attributes:{instrument:t,retryCount:e,retryDuration:r,success:n,totalAmountChange:a,...o}})}function Xl({reason:t}){E.counter({name:C.ProductFormError,value:1,attributes:I({reason:t})})}function Jl({instrument:t}){c.log({body:"Cart payment update timed out",attributes:{instrument:t}})}function Zl({instrument:t}){c.log({body:"DELIVERY_WRONG_NUMBER_OF_LINES error detected and filtered out",attributes:{instrument:t}}),E.counter({name:C.DeliveryWrongNumberOfLines,value:1,attributes:I({instrument:t})})}function tc({cartRequiresShipping:t}){c.log({body:"Digital physical mismatch detected",attributes:{url:window.location.href,cartRequiresShipping:t}}),E.counter({name:C.DigitalPhysicalMismatch,value:1,attributes:I({cartRequiresShipping:t})})}function ec({instrument:t,errorCode:e,errorField:r,countryCode:n,zip:a,province:o,city:i}){E.counter({name:C.AddressFieldError,value:1,attributes:I({instrument:t,errorCode:e,errorField:r})}),c.log({body:"Address field error from wallet payment sheet",attributes:{instrument:t,errorCode:e,errorField:r,countryCode:n,zip:a,province:o,city:i}})}function rc({result:t,error:e,attempt:r}){c.log({body:"Cardsink deposit result",attributes:{result:t,error:e,attempt:r}}),E.counter({name:C.CardsinkDepositResult,value:1,attributes:I({result:t,attempt:r})})}function ac({instrument:t,error:e,endpoint:r,sourceId:n}){c.log({body:"Failed to fetch Wallets Platform Config",attributes:{instrument:t,endpoint:r,sourceId:n,error:e}}),E.counter({name:C.WalletsPlatformConfigResult,value:1,attributes:I({instrument:t})})}var c={initStarted:v(gl),initCompleted:v(fl),instrumentLoaded:v(yl),recordWalletsLoadedFromFCP:v(bl),instrumentLoadEligibility:v(El),instrumentSDKLoaded:v(wl),instrumentSDKEligible:v(_l),renderSucceeded:v(Al),renderFailed:v(vl),sheetClicked:v(Cl),sheetCancelled:v(Il),sheetFailed:v(kl),updateFailed:v(Sl),authorizationAttempt:v(Tl),authorizationComplete:v(Dl),startExporter:v(zl),decelerated:v(Rl),cartTokenMissing:v(Nl),removePersonalDataResult:v(Ll),walletConfigDeveloperError:v(Ol),topLevelErrorHandlerDeveloperError:v(xl),legacyCartCookie:v(Ml),flushTelemetry:v(Sn),styleBackwardsCompatibility:v(Bl),styleBackwardsCompatibilityExecutionTime:v(Hl),styleBackwardsCompatibilityRules:v(Gl),amazonPaySDKLoadRetries:v($l),dynamicTaxFailed:v(Vl),sheetLoaded:v(Wl),unrecoverableCartError:v(jl),paymentCompletedAfterAbort:v(ql),googlePayNullCartOnAuthorize:v(Yl),log:v(Ul,{logErrors:!1}),paypalTokenCreationError:v(Pl),walletSessionAbortError:v(Kl),cartPaymentUpdateRetryResult:v(Ql),productFormError:v(Xl),updateCartPaymentTimeout:v(Jl),deliveryWrongNumberOfLines:v(Zl),digitalPhysicalMismatch:v(tc),cardsinkDepositResult:v(rc),addressFieldError:v(ec),walletsPlatformConfigRequestFailure:v(ac)};function v(t,{logErrors:e=!0}={}){return(...r)=>{try{t(...r)}catch(n){e&&c.log({body:"Error calling telemetry function",attributes:{error:`${n}`}})}}}function ze({type:t="button",label:e=void 0}={}){const r=document.createElement("button");return r.type=t,e&&r.setAttribute("aria-label",e),r}function xt(t,e){for(const[r,n]of Object.entries(e))t.setAttribute(r,n)}function Wt(t,e){for(const[r,n]of Object.entries(e))t.style.setProperty(r,n)}function Pn(){return` 34 <style>${is}</style> 35 <span class="text-skeleton"> </span> 36 <span class="text-skeleton"> </span> 37 <span class="text-skeleton"> </span> 38 <span class="text-skeleton"> </span> 39 <span class="text-skeleton"> </span> 40 `}function nc(){const t=document.querySelector("top-level-modal");t&&"closeModal"in t&&typeof t.closeModal=="function"&&t.closeModal()}function In(t){nc();const e=document.createElement("top-level-modal");return xt(e,{"data-testid":"top-level-modal",title:t}),e}function oc(t,e){t.innerHTML=`<div style="text-align: center;">${e}</div>`}function ic(t,e){const r=document.createElement("top-level-modal");r.textContent=e,xt(r,{"data-testid":"top-level-modal","has-close-button":"true",title:t}),document.body?.appendChild(r)}var sc=()=>({onTerminalError:({title:t,localizedMessage:e})=>{ic(t,e)}});function lc(t,e,r){const n=In(t);e instanceof Promise?(n.innerHTML=Pn(),e.then(a=>{a&&a!==""?n.innerHTML=a:n.innerHTML=r??""}).catch(()=>{n.innerHTML=r??""})):n.innerHTML=e,document.body?.appendChild(n)}function ee(t,e){try{Promise.resolve(t.onTerminalError(e)).catch(r=>oa(e,r))}catch(r){oa(e,r)}}function oa({code:t,wallet:e},r){c.topLevelErrorHandlerDeveloperError({instrument:e,code:t}),console.error(new W({code:"top-level-error-handler-failed",message:`[TopLevelErrorHandler] onTerminalError failed while handling ${t} for ${e}`},{cause:r}))}function U({i18n:t,topLevelErrorHandler:e,wallet:r,brand:n}){ee(e,{code:"wallet_generic_error",wallet:r,title:n?t.translate("error_dialogs.wallet.title",{wallet:n}):t.translate("error_dialogs.checkout.title"),localizedMessage:n?t.translate("error_dialogs.wallet.generic_error",{wallet:n}):t.translate("error_dialogs.checkout.generic_error")})}function nt({i18n:t,topLevelErrorHandler:e,wallet:r,brand:n,message:a}){ee(e,{code:"wallet_custom_validation_error",wallet:r,title:n?t.translate("error_dialogs.wallet.title",{wallet:n}):t.translate("error_dialogs.checkout.title"),localizedMessage:a})}function cc({i18n:t,topLevelErrorHandler:e,wallet:r,brand:n}){ee(e,{code:"wallet_eligibility_error",wallet:r,title:t.translate("error_dialogs.wallet.title",{wallet:n}),localizedMessage:t.translate("error_dialogs.wallet.eligibility_error",{wallet:n})})}function Et({i18n:t,topLevelErrorHandler:e,wallet:r,unrecoverableError:n}){n===F.GiftCardRecipientInvalid?ee(e,{code:"wallet_gift_card_recipient_invalid_error",wallet:r,title:t.translate("error_dialogs.checkout.title"),localizedMessage:t.translate("error_dialogs.product.gift_card_recipient_validation_error")}):U({i18n:t,topLevelErrorHandler:e,wallet:r})}function lt({i18n:t,topLevelErrorHandler:e,wallet:r}){ee(e,{code:"wallet_out_of_stock_error",wallet:r,title:t.translate("error_dialogs.checkout.title"),localizedMessage:t.translate("error_dialogs.product.out_of_stock")})}tt("top-level-modal",os);var re=class extends HTMLElement{disconnectedCallback(){}get buyerCountry(){return this.getAttribute("buyer-country")}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")}},dc="#more-payment-options-link{cursor:pointer}
40#more-payment-options-link[aria-disabled=true]{cursor:default;opacity:.6}";function dt(t,e=S.Unknown){const r={instrument:t,pageType:e};g.leaveBreadcrumb(`${t} handleClick`,r,"log"),c.log({body:`${t} handleClick`,attributes:r})}function uc(t){const e=r=>{r.persisted&&(t(),window.removeEventListener("pageshow",e))};window.addEventListener("pageshow",e)}function kn({type:t,form:e}){if(!e)return[];const r=document.querySelectorAll(`[name^="${t}"][form^="${CSS.escape(e.getAttribute("id")||"")}"]`),n=e.querySelectorAll(`[name^="${t}"]`),a=Array.from(r).concat(Array.from(n)),o={};return a.forEach(i=>{const s=hc(i),l=pc(i);s&&typeof l<"u"&&l.trim()!==""&&(o[s]=l)}),Object.entries(o??{}).map(([i,s])=>({key:i,value:s}))}function ae({page:t,element:e}){const r=t==="product"?'[data-shopify="payment-button"]':'[data-shopify="dynamic-checkout-cart"]';return ia(ia(e,r)||document.querySelector(r),"form")}var yt=Element.prototype;function ia(t,e){if(yt.matches=yt.matches||yt.webkitMatchesSelector||yt.msMatchesSelector||yt.mozMatchesSelector,!t||yt.matches.call(t,e))return t;let r=t;for(;r&&r!==document.body;)if(r=r.parentElement,r&&yt.matches.call(r,e))return r;return null}function hc(t){const e=t.getAttribute("name");if(e===null)return null;const r=e.indexOf("["),n=e.lastIndexOf("]");return r===-1||n===-1?null:e.substring(r+1,n)}function pc(t){if(!(["radio","checkbox"].includes(t.type)&&!t.checked))try{return t.value===""||typeof t.value>"u"?void 0:t.value}catch{return}}function Tn(t){return Dn(ae({page:"product",element:t}))?.[0]??null}function mc(t){return Dn(ae({page:"product",element:t}))}function Dn(t){const e=Rn(t);return e?[e,...fc(t)]:null}function Rn(t){const e=t?.elements;if(!e)return g.leaveBreadcrumb("[ProductForm] No form elements found"),c.productFormError({reason:"missing_form_elements"}),c.log({body:"Product form error: missing form elements",attributes:{}}),null;const r=fe(e,"id");return!r||isNaN(Number(r))||Number(r)<=0?(g.leaveBreadcrumb("[ProductForm] Invalid variant ID found",{variantId:r}),c.productFormError({reason:"invalid_variant_id"}),c.log({body:"Product form error: invalid variant ID",attributes:{variantId:r??"null"}}),null):{variantId:r,quantity:Number(fe(e,"quantity")??"1"),merchandiseId:`gid://shopify/ProductVariant/${r}`,sellingPlanId:yc(e),lineItemProperties:kn({type:"properties",form:t})}}function gc(t){const e=t?.elements;return e?!!fe(e,"selling_plan"):!1}function fc(t){try{const e=new FormData(t??void 0),r=new Map;for(const[n,a]of e.entries()){if(!n.startsWith("shopify-additional-items["))continue;const o=n.split(/[[\]]{1,2}/),i=Number(o[1])-1;r.has(i)||r.set(i,{});const s=r.get(i);switch(o[2]){case"id":s.variantId=a.toString(),s.merchandiseId=`gid://shopify/ProductVariant/${a.toString()}`;break;case"quantity":s.quantity=Number(a??1);break;case"selling_plan":s.sellingPlanId=`gid://shopify/SellingPlan/${a.toString()}`;break;case"properties":s.lineItemProperties=JSON.parse(a);break;case"parent_id":s.parent={merchandiseId:`gid://shopify/ProductVariant/${a.toString()}`}}}return[...r.values()].map(n=>{if(!n.variantId)throw new Error("Missing variant ID for additional item");return{quantity:1,lineItemProperties:[],...n}})}catch(e){return console.error("[Accelerated Checkout] Could not read additional items from the product form. Check that your shopify-additional-items fields are correctly defined.",e),[]}}function fe(t,e){let r=t.namedItem(e);if(r instanceof HTMLSelectElement)try{return r.value??null}catch{return null}if(r&&"length"in r&&(r=r.item(0)),r instanceof HTMLInputElement||r instanceof HTMLSelectElement)try{return r.value??null}catch{return null}return null}function yc(t){const e=fe(t,"selling_plan");if(!(!e||e==="undefined"))return`gid://shopify/SellingPlan/${e}`}var bc=class{element;apiClient;instrumentName;constructor(t,e,r){this.element=t,this.apiClient=e,this.instrumentName=r}async getInitialCart(t,e,r){const n=mc(this.element);if(!n)throw new Dr(`[${this.instrumentName}] unable to find product form`,{groupingHash:"unable-to-find-product-form"});const a=wr(Zo),o={lines:[...n],discountCodes:a?[a]:[],instrumentName:t},{data:i,errors:s,abortReason:l,decelerationReason:d}=await this.apiClient.createCart(o,e,r);return{cart:i,errors:s,abortReason:l,decelerationReason:d}}},Dr=class extends Z{get useHashPrefix(){return!0}};Dr.prototype.name="ProductFormError";var wc={firstName:"firstName",lastName:"lastName",address1:"address1",address2:"address2",city:"city",province:"province",postalCode:"zip",phoneNumber:"phone",companyName:"company",country:"country"},or=["firstName","lastName","address1","address2","city","province","postalCode","phoneNumber","companyName","country"];function ue(t,e){return`${t}.${wc[e]}`}function vt(t,e){const r={};
40for(const n of or)r[n]=[{code:e,field:ue(t,n)}];return r}function Nn(t){return{required:vt(t,"ADDRESS_FIELD_IS_REQUIRED"),invalid:{...vt(t,"ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN"),postalCode:[{code:"ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN",field:ue(t,"postalCode")},{code:"INVALID_ZIP_CODE_FOR_COUNTRY",field:ue(t,"postalCode")},{code:"INVALID_ZIP_CODE_FOR_PROVINCE",field:ue(t,"postalCode")}]},emojis:vt(t,"ADDRESS_FIELD_CONTAINS_EMOJIS"),tooLong:vt(t,"ADDRESS_FIELD_IS_TOO_LONG"),htmlTags:vt(t,"ADDRESS_FIELD_CONTAINS_HTML_TAGS"),containsUrl:vt(t,"ADDRESS_FIELD_CONTAINS_URL")}}var _c={firstName:"DELIVERY_FIRST_NAME_REQUIRED",lastName:"DELIVERY_LAST_NAME_REQUIRED",address1:"DELIVERY_ADDRESS1_REQUIRED",address2:"DELIVERY_ADDRESS2_REQUIRED",city:"DELIVERY_CITY_REQUIRED",province:"DELIVERY_ZONE_REQUIRED_FOR_COUNTRY",postalCode:"DELIVERY_POSTAL_CODE_REQUIRED",phoneNumber:"DELIVERY_PHONE_NUMBER_REQUIRED",companyName:"DELIVERY_COMPANY_REQUIRED",country:"DELIVERY_COUNTRY_REQUIRED"},Ec={firstName:"DELIVERY_FIRST_NAME_INVALID",lastName:"DELIVERY_LAST_NAME_INVALID",address1:"DELIVERY_ADDRESS1_INVALID",address2:"DELIVERY_ADDRESS2_INVALID",city:"DELIVERY_CITY_INVALID",province:"DELIVERY_ZONE_NOT_FOUND",postalCode:"DELIVERY_POSTAL_CODE_INVALID",phoneNumber:"DELIVERY_PHONE_NUMBER_INVALID",companyName:"DELIVERY_COMPANY_INVALID",country:"DELIVERY_COUNTRY_INVALID"};function Ac(){const t=Nn("deliveryAddress");for(const e of or)t.required[e]=[{code:_c[e]},...t.required[e]];t.required.country=[...t.required.country,{code:"ADDRESS_FIELD_IS_REQUIRED",field:"deliveryAddress.countryCode"}],t.required.province=[...t.required.province,{code:"ADDRESS_FIELD_IS_REQUIRED",field:"deliveryAddress.provinceCode"}];for(const e of or){const r=Ec[e];r&&(t.invalid[e]=[{code:r},...t.invalid[e]])}return t.invalid.country=[...t.invalid.country,{code:"Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode"},{code:"INVALID",field:"deliveryAddress.country"},{code:"INVALID",field:"deliveryAddress.countryCode"}],t.invalid.postalCode=[...t.invalid.postalCode,{code:"DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY"},{code:"DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE"}],t.invalid.phoneNumber=[...t.invalid.phoneNumber,{code:"INVALID",field:"buyerIdentity.phone"}],t}var f=Ac();function vc(){const t=Nn("billingAddress");return{...t,invalid:{...t.invalid,generic:[{code:"INVALID_PAYMENT",field:"billingAddress"},{code:"ADDRESS_FIELD_IS_REQUIRED",field:"billingAddress"},{code:"UNSPECIFIED_ADDRESS_ERROR",field:"billingAddress"}]}}}
40var w=vc(),Xt={invalid:[{code:"INVALID",field:"buyerIdentity.email"}],required:[{code:"BUYER_IDENTITY_EMAIL_REQUIRED"}]},Ln=[{code:"INVALID_DELIVERY_OPTION"},{code:"INVALID_DELIVERY_GROUP"},{code:"DELIVERY_DETAIL_CHANGED"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE"},{code:"NO_DELIVERY_GROUP_SELECTED"}],On=[{code:"INVALID_PAYMENT",field:"amount"},{code:"INVALID_PAYMENT",field:"payment.amount"},{code:"INVALID_PAYMENT",field:"payment"}],Rr=[{code:"TAXES_DELIVERY_GROUP_ID_NOT_FOUND"},{code:"TAXES_LINE_ID_NOT_FOUND"},{code:"TAXES_MUST_BE_DEFINED"},{code:"PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"}],Nr=[{code:"MERCHANDISE_OUT_OF_STOCK"},{code:"MERCHANDISE_PRODUCT_NOT_PUBLISHED"}],xn=[{code:"MERCHANDISE_NOT_APPLICABLE"},{code:"MERCHANDISE_NOT_ENOUGH_STOCK_AVAILABLE"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE_FOR_MERCHANDISE_LINE"},{code:"INVALID",field:"quantity"}],Mn={code:"PAYMENTS_METHOD_REQUIRED"},Cc={code:"PAYMENTS_METHOD_UNAVAILABLE"},ye={code:"VALIDATION_CUSTOM"},zn={code:"MERCHANDISE_LINE_TRANSFORMERS_RUN_ERROR"},Fn=[Cc,zn],Sc=[...Fn,Mn],Pc=[...f.required.firstName,...f.required.lastName,...f.required.address1,...f.required.address2,...f.required.phoneNumber,...f.required.companyName,...Xt.required],be={code:"CAPTCHA_COMPLETION_REQUIRED"},we={code:"LOCALIZATION_EXTENSION_FIELD_ERROR"},sa={code:"BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE"},_e={code:"Variable $language of type LanguageCode was provided invalid value"},Ee={code:"Variable $country of type CountryCode was provided invalid value"},Ae={code:"Variable $cartId of type ID! was provided invalid value"},ir={code:"DISCOUNT_NOT_APPLICABLE"},la={code:"PAYMENTS_COUNTRY_INVALID"},ca={code:"INVALID_PAYMENT_EMPTY_CART"},ve={code:"PAYMENT_METHOD_NOT_SUPPORTED"},Ce={code:"REDIRECT_TO_CHECKOUT_REQUIRED"},Ic={code:"INVALID",field:"quantity"},kc={code:"VARIANT_REQUIRES_SELLING_PLAN"},Tc={code:"SELLING_PLAN_NOT_APPLICABLE"},Dc={code:"INVALID",field:"merchandiseId"},Rc={code:"NO_RESPONSE"},Nc={code:"INVALID",field:"input"},Lc={code:"MERCHANDISE_NOT_APPLICABLE"},Oc={code:"NO_DELIVERY_GROUP_SELECTED"},xc={code:"GIFT_CARD_RECIPIENT_INVALID"},Se={code:"TAXES_INCLUSIVITY_MISMATCH"},da={code:"ERROR"},ua=[{code:"DELIVERY_WRONG_NUMBER_OF_LINES"},{code:"DELIVERY_ADDRESS_REQUIRED"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE_FOR_MERCHANDISE_LINE"}],Mc=[{code:"PENDING_PROCESS"},{code:"PENDING_DELIVERY_GROUPS"}],zc=[{code:"PENDING_DELIVERY_GROUPS"}],Fc=[{code:"PENDING_PROCESS"}],Uc={building:[...Pc,...ua,...Mc],authorized:ua};function jt(t,e){const r=e.field?t.field===e.field:!0,n=t.code===e.code;return r&&n}function Un(t,e){return t.length>0&&e.length>0&&t.some(r=>e.some(n=>jt(r,n)))}function St({code:t,field:e}){return`${t}${e?`:${e}`:""}`}var Bn=class extends Z{#t;get stack(){return this.#t}set stack(t){this.#t=t}constructor(t){t instanceof Error?(super(`[${t.name}] ${t.message}`,{cause:t.cause,groupingHash:t instanceof Z?t.groupingHash:void 0}),this.stack=t.stack):super(`[HandleCreateCartError] ${String(t)}`)}};Bn.prototype.name="HandleCreateCartError";async function ut({element:t,instrumentName:e,dataSource:r,isShippingRequired:n}){const{supportsSubscriptions:a,supportsDeferredPurchaseOptions:o}=t;try{const{cart:i,errors:s,abortReason:l,decelerationReason:d}=await r.getInitialCart(e,a??!0,o??!0);uc(()=>{t&&(t.disabled=!1)});const u=Ir(s),h=Hc(s),m=h||u;if(h&&c.unrecoverableCartError({instrument:e,errorName:h}),!i&&!m)throw new Error(`[${e}] Failed to create cart: ${JSON.stringify(s)}`);if(i){if(!i.id)throw new Error(`[${e}] received invalid cart`);if(!i.checkoutUrl)throw new Error(`[${e}] Created cart with no checkout URL`)}if(s.length>0&&!m)throw new Error(`Errors present after cart creation: ${JSON.stringify(s)}`);return{cart:i,customValidationError:u,decelerationReason:Gc(i,n)??d,abortReason:l,...h?{unrecoverableError:h}:{}}}catch(i){if(i instanceof Tt)return{cart:null,customValidationError:void 0,unrecoverableError:F.IgnoredResponseError,abortReason:void 0,decelerationReason:void 0};if(i instanceof Dr)return{cart:null,customValidationError:void 0,unrecoverableError:F.ProductFormError,abortReason:void 0,decelerationReason:void 0};throw new Bn(i)}finally{t&&(t.disabled=!1)}}var Bc=[{matcher:Ic,unrecoverableError:F.InvalidQuantity},{matcher:kc,unrecoverableError:F.VariantRequiresSellingPlan},{matcher:Tc,unrecoverableError:F.SellingPlanNotApplicable}
40,{matcher:Dc,unrecoverableError:F.MerchandiseIdInvalid},{matcher:Rc,unrecoverableError:F.NoResponse},{matcher:Nc,unrecoverableError:F.InvalidInput},{matcher:Lc,unrecoverableError:F.MerchandiseNotApplicable},{matcher:zn,unrecoverableError:F.MerchandiseLineTransformersRunError},{matcher:xc,unrecoverableError:F.GiftCardRecipientInvalid}];function Hc(t){if(t.length!==1)return null;const[e]=t;return e.code==="VALIDATION_CUSTOM"&&e.message?null:Bc.find(({matcher:r})=>jt(e,r))?.unrecoverableError||null}function Gc(t,e){if(t&&e!==void 0){const r=t.lineItems.some(n=>n.merchandise.requiresShipping);if(e!==r)return c.digitalPhysicalMismatch({cartRequiresShipping:r}),"digital_physical_mismatch"}}var $c={force_shop_pay_product:"direct_checkout_product",force_shop_pay_cart:"direct_checkout_cart"};function rt(t,e="no_redirect_for_checkout"){c.flushTelemetry();const r=new URL(t);switch(e){case"skip_shop_pay":r.searchParams.set("skip_shop_pay","true");break;case"no_redirect_for_checkout":r.searchParams.set("storefront_wallet","true");break;case"force_shop_pay_cart":case"force_shop_pay_product":case"force_shop_pay":{r.searchParams.set("payment","shop_pay");const n=$c[e];n&&r.searchParams.set("redirect_source",n);break}}window.location.assign(r.toString())}var Vc={currency_changed:D.CURRENCY_CHANGE,captcha_required:D.CAPTCHA_REQUIRED,not_enough_stock:D.NOT_ENOUGH_STOCK,dynamic_tax:D.WALLET_PROCESSING_FAILED,payment_method_not_applicable:D.PAYMENT_METHOD_NOT_APPLICABLE,invalid_payment_deferred_payment_required:D.INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED,localization_extension_field_error:D.LOCALIZATION_EXTENSION_FIELD_ERROR,account_info_mismatch:D.WALLET_PROCESSING_FAILED,invalid_language:D.WALLET_PROCESSING_FAILED,invalid_country:D.WALLET_PROCESSING_FAILED,missing_cart_id:D.WALLET_PROCESSING_FAILED,redirect_to_checkout_required:D.WALLET_PROCESSING_FAILED,invalid_payment_amount:D.WALLET_PROCESSING_FAILED,price_increased:D.PRICE_INCREASED,unsupported_apple_pay_payment_method:D.UNSUPPORTED_APPLE_PAY_PAYMENT_METHOD,unsupported_google_pay_payment_method:D.UNSUPPORTED_GOOGLE_PAY_PAYMENT_METHOD,custom_validation:D.WALLET_PROCESSING_FAILED,discount_not_applicable:D.WALLET_PROCESSING_FAILED,cart_empty:D.WALLET_PROCESSING_FAILED,payments_country_invalid:D.PAYMENTS_COUNTRY_INVALID,generic_error:D.WALLET_PROCESSING_FAILED,nested_line_subscription:D.WALLET_PROCESSING_FAILED,nested_line_deferred_payment:D.WALLET_PROCESSING_FAILED,cardsink_deposit_failed:D.WALLET_PROCESSING_FAILED,digital_physical_mismatch:D.WALLET_PROCESSING_FAILED,subscription_review_required:D.SUBSCRIPTION_REVIEW_REQUIRED,subscription_review_required_banner_less:D.SUBSCRIPTION_REVIEW_REQUIRED_BANNER_LESS,shipping_country_unavailable:D.SHIPPING_COUNTRY_UNAVAILABLE,cart_throttled:null};function Ke({cart:t,warnings:e}){const r=t&&t.lineItems.length>0&&t.lineItems.every(n=>n.quantity===0);if(e?.includes("MERCHANDISE_OUT_OF_STOCK")&&(r||!t))return"out_of_stock"}function ie({warnings:t,cart:e,cartStatus:r,errors:n,supportsSubscriptions:a,supportsDeferredPurchaseOptions:o}){for(const s of n||[]){if(s.code==="PAYMENT_METHOD_NOT_APPLICABLE")return"payment_method_not_applicable";if(s.code==="INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED")return"invalid_payment_deferred_payment_required"}if(r==="CartThrottled")return"cart_throttled";if(!t||t.length===0)return ha(a??!0,o??!0,e);if(t.includes("MERCHANDISE_NOT_ENOUGH_STOCK"))return"not_enough_stock";const i=e?.lineItems.some(s=>s.quantity>0);return t.includes("MERCHANDISE_OUT_OF_STOCK")&&i?"not_enough_stock":ha(a??!0,o??!0,e)}function ha(t,e,r){if(!t&&r?.lineItems.some(n=>n.sellingPlanAllocation?.sellingPlan.billingPolicy))return"nested_line_subscription";if(!e&&r?.lineItems.some(n=>n.sellingPlanAllocation?.remainingBalanceChargeAmount&&!n.sellingPlanAllocation?.sellingPlan.billingPolicy))return"nested_line_deferred_payment"}function Lr({currentCartTotal:t,initialBuyerCurrency:e}){const r=t.amount;return!(!r||Number(r)===0||e.toUpperCase()===t.currencyCode.toUpperCase())}function Hn({previousCart:t,currentCart:e}){if(!t||!e)return;const r=parseFloat(t.totalAmount.amount),n=parseFloat(e.totalAmount.amount);let a;return n>r?a="inc":n<r?a="dec":a="eq",a}function N({checkoutUrl:t,instrumentName:e,reason:r,stage:n,forceLegacySplitShippingMode:a=!1}){if(!t)throw new Error("Invalid Checkout URL");const o=new URL(t),i=Vc[r];i&&o.searchParams.set(i,"true"),a&&o.searchParams.set("wallet_deceleration","true"),c.decelerated({instrument:e,reason:r,stage:n}),rt(o.toString())}function pa(t){return t.key===" "||t.code==="Space"}var Wc=class extends re{name=p.MoreOptions;anchor;i18n;dataSource;topLevelErrorHandler;classNames;setI18n;setDataSource;setTopLevelErrorHandler;setClassNames;static get observedAttributes(){return["disabled"]}constructor(){super(),[this.i18n,this.setI18n]=J(),[this.dataSource,this.setDataSource]=J(),[this.topLevelErrorHandler,this.setTopLevelErrorHandler]=J(),[this.classNames,this.setClassNames]=J()}get pageType(){return this.getAttribute("page-type")||S.Unknown}get walletInstrumentName(){return this.getAttribute("wallet-instrument-name")||null}connectedCallback(){this.anchor||this.render()}attributeChangedCallback(t,e,r){e!==r&&t==="disabled"&&this.anchor&&this.setAccessibilityAttributes()}async handleClick(t){if(t.preventDefault(),this.disabled||!this.anchor)return;this.disabled=!0,dt(this.name,this.pageType);const[e,r,n]=await Promise.all([this.i18n,this.dataSource,this.topLevelErrorHandler]);try{const{decelerationReason:a,cart:o,customValidationError:i,unrecoverableError:s,abortReason:l}=await ut({element:this,instrumentName:p.MoreOptions,dataSource:r});if(s){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),c.log({body:"Unrecoverable error detected in More Options sheet clicked",attributes:{unrecoverableError:s}}),Et({i18n:e,topLevelErrorHandler:n,wallet:this.name,unrecoverableError:s});return}if(i){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),c.log({body:"Custom validation error detected in More Options sheet clicked",attributes:{errorMessage:i?.message}}),nt({i18n:e,topLevelErrorHandler:n,wallet:this.name,message:i.message});return}if(l==="out_of_stock"){c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),lt({i18n:e,topLevelErrorHandler:n,wallet:this.name});return}if(a){c.sheetClicked({instrument:p.MoreOptions,result:"success",reason:"deceleration"}),N({checkoutUrl:o?.checkoutUrl??"",instrumentName:p.MoreOptions,reason:a});return}c.sheetClicked({instrument:p.MoreOptions,result:"success"}),rt(o?.checkoutUrl??"",this.walletInstrumentName===p.ShopPay?"skip_shop_pay":"allow_redirect")}catch(a){c.sheetClicked({instrument:p.MoreOptions,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in More Options sheet clicked",attributes:{error:String(a)}}),g.notify(a),U({i18n:e,topLevelErrorHandler:n,wallet:this.name})}}handleKeyDown(t){pa(t)&&t.preventDefault()}handleKeyUp(t){pa(t)&&(t.preventDefault(),!(this.disabled||!this.anchor)&&this.anchor.click())}async render(){const t=await this.i18n,e=await this.classNames;
40this.anchor=document.createElement("a"),this.anchor.textContent=t.translate("more_payment_options"),this.anchor.className=e,this.anchor.setAttribute("id","more-payment-options-link"),this.anchor.onclick=n=>this.handleClick(n),this.anchor.onkeydown=n=>this.handleKeyDown(n),this.anchor.onkeyup=n=>this.handleKeyUp(n),this.setAccessibilityAttributes(),this.appendChild(this.anchor);const r=document.createElement("style");r.textContent=dc,this.appendChild(r)}setAccessibilityAttributes(){this.anchor&&(this.disabled?(this.anchor.removeAttribute("href"),this.anchor.role="link",this.anchor.setAttribute("aria-disabled","true")):(this.anchor.removeAttribute("role"),this.anchor.removeAttribute("aria-disabled"),this.anchor.href="#"))}};function Or(t,e,r){if(nr?.length){const n=nr.join(",");t.querySelectorAll(n).forEach(a=>{r===null?a.removeAttribute(e):a.setAttribute(e,r)})}}function jc(t,e){try{const r=JSON.parse(t??"[]");if(!(r instanceof Array))throw new W({code:"invalid-wallet-configs",message:`[${e}] invalid walletConfigs found`});return r}catch(r){throw new W({code:"invalid-wallet-configs",message:`[${e}] Error while parsing walletConfigs JSON: ${r}`},{cause:r})}}function qc(t,e){try{return t?JSON.parse(t):null}catch(r){throw new W({code:"invalid-wallet-config",message:`[${e}] Error while parsing walletConfig JSON: ${r}`},{cause:r})}}function Pe(t,e){if(!e)return!1;const r=e.getWalletParamsEligibility();if(!r.eligible)return c.instrumentLoadEligibility({instrument:e.getInstrumentName(),result:"failed",reason:r.reason}),!1;const n=e.getLoadEligibility(t);return n.eligible?(c.instrumentLoadEligibility({instrument:e.getInstrumentName(),result:"success",reason:void 0}),!0):(c.instrumentLoadEligibility({instrument:e.getInstrumentName(),result:"failed",reason:n.reason}),!1)}function Yc(t,e){return e.filter(r=>Pe(t,r))}async function Gn({walletInstrument:t,instanceNumber:e}){const r=t.getInstrumentName(),n=Rt(O.LoadSdk,`${r}:${e}`);try{await t.loadWalletSDK(),c.instrumentSDKLoaded({instrument:r,measurement:n(),result:"success"})}catch(o){return g.leaveBreadcrumb("Failed to load wallet SDK",{instrumentName:r,instanceNumber:e},"error"),g.notify(o),c.log({body:"Error loading wallet SDK",attributes:{instrumentName:r,instanceNumber:e,error:String(o),walletParams:JSON.stringify(t.walletParams)}}),c.instrumentSDKLoaded({instrument:r,measurement:n(),result:"failed"}),null}let a;try{a=t.getPartnerSDKEligibility()}catch(o){g.notify(o),a={eligible:!1,reason:"uncaught exception"}}return a.eligible?(c.instrumentSDKEligible({instrument:r,result:"success"}),t):(c.instrumentSDKEligible({instrument:r,reason:a.reason,result:"failed"}),null)}function wt(t,...e){try{const r=window[t];if(typeof r=="function")return new r(...e)}catch{}return null}var qt=G,ma="https://content.global-e.com/shopper-terms",Kc="https://content.global-e.com/shopper-terms-v2",Qc="https://content.global-e.com/privacy-policy",xr=class extends re{apiClient;i18n;assignedTopLevelErrorHandler;policy;isFetchingPolicy=!1;intersectionObserver=null;managedMarketsTermsLink=ma;connectedCallback(){this.assignedTopLevelErrorHandler??=sc(),this.mountIntersectionObserver(),Q.register(this.getEnabledFlags()),this.i18n&&this.setupManagedMarketsHandlers(this.i18n)}disconnectedCallback(){super.disconnectedCallback(),this.cleanupManagedMarketsHandlers()}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(){try{return JSON.parse(this.getAttribute("variant-params")??"[]")}catch(t){throw new W({code:"invalid-variant-params",message:`variant-params must be a valid JSON string. Received variant-params: ${this.getAttribute("variant-params")}, received error: ${t}`})}}get styleExtractorDisabled(){return this.hasAttribute("disable-compat")}get onlySdk(){return this.hasAttribute("only-sdk")}get debug(){return this.hasAttribute("debug")}get topLevelErrorHandler(){if(!this.assignedTopLevelErrorHandler)throw new Error("Top level error handler has not been initialized.");return this.assignedTopLevelErrorHandler}setTopLevelErrorHandler(t){if(this.assignedTopLevelErrorHandler!==t){if(this.assignedTopLevelErrorHandler!==void 0){c.log({body:"Top level error handler registration ignored: a different handler is already registered"});return}this.assignedTopLevelErrorHandler=t}}triggerLoadedEvent(){document.dispatchEvent(new Event("shopify:payment_button:loaded",{bubbles:!0,cancelable:!0}))}async attributeChangedCallback(t,e,r){e!==r&&Or(this,t,r)}showBuyerConsent(t,e){t&&window.Shopify?.PaymentButton?.showBuyerConsent?.(r=>this.onClickSubscriptionPolicy(r,t,e))}hideBuyerConsent(){window.Shopify?.PaymentButton?.hideBuyerConsent?.()}clearUI(){this.innerHTML=""}setupManagedMarketsHandlers(t){const e=document.getElementById("shopify-buyer-consent")?.getAttribute("data-consent-type");if(e!=="managed-markets"&&e!=="managed-markets-v2")return;const r=document.getElementById("shopify-managed-markets-terms-and-conditions-button"),n=document.getElementById("shopify-managed-markets-privacy-policy-button");!r||!n||(this.managedMarketsTermsLink=e==="managed-markets"?ma:Kc,this.i18n=t,document.addEventListener("click",this.handleManagedMarketsClick,!0))}cleanupManagedMarketsHandlers(){document.removeEventListener("click",this.handleManagedMarketsClick,!0)}handleManagedMarketsClick=t=>{if(!this.i18n)return;const e=t.target;if(e.id==="shopify-managed-markets-terms-and-conditions-button"){t.preventDefault(),t.stopImmediatePropagation(),this.showModalWithIframe(this.managedMarketsTermsLink,this.i18n.translate("managed_markets.terms_and_conditions"),this.i18n);return}e.id==="shopify-managed-markets-privacy-policy-button"&&(t.preventDefault(),t.stopImmediatePropagation(),this.showModalWithIframe(Qc,this.i18n.translate("managed_markets.privacy_policy"),this.i18n))};showModalWithIframe(t,e,r){const n=r.translate("managed_markets.policy_not_found"),a=1e4*Sr(),o=800,i=In(e);document.body.appendChild(i);const s=document.createElement("div");Wt(s,{position:"relative",width:"100%"});const l=document.createElement("iframe");xt(l,{width:"100%",height:"100%",title:e,frameborder:"no"}),Wt(l,{border:"none","min-height":"50vh",display:"none"});const d=document.createElement("div");d.className="skeleton-overlay",d.innerHTML=Pn(),Wt(d,{background:"white"}),s.appendChild(l),s.appendChild(d),i.appendChild(s);let u=!1,h=!1,m=!1;const y=()=>{!m&&u&&h&&(d.remove(),l.style.display="block")},b=setTimeout(()=>{u||(m=!0,oc(i,n))},a);l.addEventListener("load",()=>{clearTimeout(b),u=!0,y()}),setTimeout(()=>{h=!0,y()},o),l.src=t}getEnabledFlags(){const t=this.getAttribute("enabled-flags");if(!t)return[];try{return JSON.parse(t)}catch{return console.warn("Invalid enabled-flags attribute value:",t),[]}}async onClickSubscriptionPolicy(t,e,r){if(t.preventDefault(),this.isFetchingPolicy)return;if(this.policy){this.showPolicy(this.policy,r);return}this.isFetchingPolicy=!0;
40const n=this.fetchSubscriptionPolicy(e).then(a=>(this.policy=a,a)).catch(a=>(g.notify(a),r.translate("subscriptions.policy_not_found"))).finally(()=>{this.isFetchingPolicy=!1});this.showPolicy(n,r)}async fetchSubscriptionPolicy(t){const e=await t.fetchSubscriptionPolicy();return this.policy=e,e}showPolicy(t,e){lc(e.translate("subscriptions.cancellation_policy"),t,e.translate("subscriptions.policy_not_found"))}mountIntersectionObserver(){this.intersectionObserver=wt("IntersectionObserver",this.handleIntersection),this.intersectionObserver?this.intersectionObserver.observe(this):qt({event:z.FirstVisibleNotAvailable})}handleIntersection=(t,e)=>{t.some(r=>r.isIntersecting)&&(this.apiClient&&this.apiClient.setVisible(),e.disconnect(),qt({event:z.FirstVisible}))}};function Mr(t){on({shop_id:t.shopId??"unknown",cartId:t.cartId??void 0,debug:t.debug,enabledFlags:Q.allEnabled().join(","),pageType:t.pageType})}var zr=class{element;onFormChanged;addToCartMutationObserver;addToCartForm;addToCartButtons;constructor(t,e){this.element=t,this.onFormChanged=e,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=Rn(this.addToCartForm),e=!!(this.addToCartButtons.length>0&&this.addToCartButtons.every(r=>r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"));this.onFormChanged({disabled:e||t===null,hasSellingPlan:gc(this.addToCartForm),variantId:t?.variantId,sellingPlanId:t?.sellingPlanId})}observeAddToCartButtons(){this.addToCartButtons.forEach(t=>{this.addToCartMutationObserver.observe(t,{attributes:!0})})}reobserveOnFormChanges(){this.addToCartMutationObserver?.disconnect(),this.findAndSetAddToCartButtons(),this.observeAddToCartButtons(),this.syncComponentStateWithForm()}findAndSetAddToCartButtons(){if(this.addToCartForm=ae({page:"product",element:this.element}),this.addToCartForm){const t=this.addToCartForm.querySelectorAll("[type=submit]");t instanceof NodeList&&(this.addToCartButtons=[...t])}}};function Xc(t,e,r){try{const n=JSON.parse(t??"{}"),a=JSON.parse(e??JSON.stringify(Wa));if(n===null||Object.keys(n).length===0){if(!(a instanceof Object))throw c.walletConfigDeveloperError(),new W({code:"invalid-fallback-wallet-config",message:`[${r}] Invalid fallback wallet configs JSON`});return{recommendedWallet:null,fallbackWallet:a}}return{recommendedWallet:n,fallbackWallet:a}}catch(n){throw c.walletConfigDeveloperError(),new W({code:"invalid-recommended-fallback-config",message:`[${r}] Error while parsing recommended/fallback JSON: ${n}`},{cause:n})}}var Jc=".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);color:#fff;cursor:pointer;text-align:center;border:none;width:100%;font-size:1em;font-weight:500;line-height:1;transition:background .2s ease-in-out;display:block;box-shadow:0 0 #0000}.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{cursor:pointer;text-align:center;background:0 0;border:0;width:100%;margin-top:1em;font-size:1em;text-decoration:underline;display:block}.shopify-payment-button__more-options.shopify-payment-button__skeleton{width:50%;margin-left:25%;margin-right:25%;border-radius:4px!important;height:auto!important;min-height:0!important}.shopify-payment-button__button.shopify-payment-button__button--branded{z-index:1;flex-direction:column;display:flex;position:relative}.shopify-payment-button__button.shopify-payment-button__button--branded .shopify-cleanslate{flex-direction:column!important;flex:1!important;display:flex!important}.shopify-payment-button__button.button.loading{color:#0000;position:relative}.shopify-payment-button__button.button.loading>.loading-overlay__spinner{align-items:center;height:100%;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.shopify-payment-button__button.button.loading>.loading-overlay__spinner .spinner{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:1.4s linear infinite shopify-rotator}@keyframes shopify-rotator{0%{transform:rotate(0)}to{transform:rotate(270deg)}}.shopify-payment-button__button .path{stroke-dasharray:280;stroke-dashoffset:0;transform-origin:50%;
40stroke:#121212;animation:1.4s ease-in-out infinite shopify-dash}@media screen and (forced-colors:active){.shopify-payment-button__button .path{stroke:canvastext}}@keyframes shopify-dash{0%{stroke-dashoffset:280px}50%{stroke-dashoffset:75px;transform:rotate(135deg)}to{stroke-dashoffset:280px;transform:rotate(450deg)}}#shopify-buyer-consent{width:100%;margin-top:1em;display:inline-block}#shopify-buyer-consent.hidden{display:none}#shopify-subscription-policy-button,#shopify-managed-markets-terms-and-conditions-button,#shopify-managed-markets-privacy-policy-button{font-size:inherit;cursor:pointer;background:0 0;border:none;padding:0;text-decoration:underline}#shopify-subscription-policy-button:before,#shopify-managed-markets-terms-and-conditions-button:before,#shopify-managed-markets-privacy-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;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);box-sizing:border-box;height:var(--shopify-accelerated-checkout-button-block-size,inherit);border-radius:var(--shopify-accelerated-checkout-button-border-radius,inherit);min-height:25px;max-height:55px;animation-delay:-.168s;text-decoration:none!important}",Zc=".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)}:host([page-type=cart_page]){height:100%;display:block}:host([page-type=cart_page]) .accelerated-checkout-button{border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);width:100%;height:100%;min-height:0;box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type=product]) .accelerated-checkout-button{min-width:150px}@media (forced-colors:active){.accelerated-checkout-button,:host([page-type=cart_page]) .accelerated-checkout-button{border:1px solid #0000!important}}",It=class{red;green;blue;opacity;constructor(t,e,r,n){this.red=t||0,this.green=e||0,this.blue=r||0,this.opacity=typeof n>"u"?1:n}getLuminance(){const t=this.red&255,e=this.green&255,r=this.blue&255;return t*.2126+e*.7152+r*.0722}isDark(){return this.opacity===0?!1:this.getLuminance()/this.opacity<70}blendWith(t,e){this.opacity=1-(1-t.opacity)*(1-e.opacity),this.red=this.blend(t.red,e.red,t,e),this.green=this.blend(t.green,e.green,t,e),this.blue=this.blend(t.blue,e.blue,t,e)}blend(t,e,r,n){return Math.round(t*r.opacity/this.opacity+e*n.opacity*(1-r.opacity)/this.opacity)}};function td(t){const e=[...t];let r=new It(0,0,0,0),n=new It(255,255,255,1),a=e.shift();for(;a;)r.opacity>0&&a.opacity>0?(n=new It(0,0,0,0),n.blendWith(a,r)):a.opacity>0?n=a:n=r,r=n,a=e.shift();return n}var sr=new It(255,255,255,1);function ed(t){const e=[];let r=t;for(;r.parentElement;){r=r.parentElement;const n=window.getComputedStyle(r).backgroundColor,a=ad(n);if(n&&e.push(a),a.opacity===1)break}try{return td(e.reverse())}catch(n){return g.notify(new Fr(`[BackgroundDetection] Failed to blend colors for element ${t.outerHTML}`,{cause:n})),sr}}var rd=new It(0,0,0,0);function ad(t){if(!t)return sr;if(t==="transparent")return rd;try{const e=t.split("(")[1].split(")")[0].replace(" ","").split(",");return new It(Number(e[0]),Number(e[1]),Number(e[2]),typeof e[3]>"u"?1:Number(e[3]))}catch(e){g.notify(new Fr(`[BackgroundDetection] Failed to convert rgbString to array ${t}`,{cause:e}))}return sr}var Fr=class extends Error{};Fr.prototype.name="ColorProcessingError";var ht=class extends re{name=p.Unknown;i18n;dataSource;apiClient;topLevelErrorHandler;classNames;containerInstanceNumber;supportsSubscriptions;
40supportsDeferredPurchaseOptions;onRendered;onRenderFailed;setI18n;setDataSource;setApiClient;setTopLevelErrorHandler;setClassNames;setContainerInstanceNumber;parsedWalletParams;#t;#e;constructor(){super(),this.onRendered=()=>{},this.onRenderFailed=()=>{},this.supportsSubscriptions=!1,this.supportsDeferredPurchaseOptions=!1,[this.i18n,this.setI18n]=J(),[this.dataSource,this.setDataSource]=J(),[this.apiClient,this.setApiClient]=J(),[this.topLevelErrorHandler,this.setTopLevelErrorHandler]=J(),[this.classNames,this.setClassNames]=J(),[this.containerInstanceNumber,this.setContainerInstanceNumber]=J()}async cleanupOnFailure(t,e){try{await t()}catch(r){g.notify(new $n(`An error occurred requiring cleanup when attempting to render the ${e} instrument: ${r}`,{cause:r}));const n=await this.containerInstanceNumber;c.instrumentLoaded({instrumentOrComponentName:e,result:"failed",measurement:Y(O.ButtonDisplay,`${e}:${n}`)}),this.parentElement?.remove(),this.onRenderFailed()}}attributeChangedCallback(t,e,r,n){e!==r&&t==="disabled"&&n&&(r===""?(n.setAttribute("aria-disabled","true"),n.setAttribute("disabled","")):(n.removeAttribute("aria-disabled"),n.removeAttribute("disabled")))}disconnectedCallback(){this.#e?.disconnect(),this.#e=void 0}get pageType(){return this.getAttribute("page-type")||S.Unknown}get buttonTheme(){return ed(this).isDark()?"LIGHT":"DARK"}get isCTA(){return this.hasAttribute("call-to-action")}get walletParams(){if(this.parsedWalletParams===void 0)try{this.parsedWalletParams=JSON.parse(this.getAttribute("wallet-params")??"{}")}catch(t){throw new W({code:"invalid-wallet-params",message:`[${this.name}] Error while parsing wallet-params JSON: ${t}`},{cause:t})}return this.parsedWalletParams}async initializeShadowStyles(t,e=""){const r=document.createElement("style");r.innerHTML=[Zc,e].join(` 41`),t.appendChild(r)}async ensureLightDOMIsNotEmpty(){this.textContent="\xA0"}
41dispatchWalletEvent({eventName:t,detail:e={}}){this.parentElement?.dispatchEvent(new CustomEvent(t,{detail:e}))}getOrCreateShadowRoot(){return this.#t||(this.#t=this.attachShadow({mode:"closed"})),this.guardAgainstTPOOverlays(this.#t),this.#t}clearShadowRoot(){this.#t&&(this.#t.innerHTML="")}guardAgainstTPOOverlays(t){this.#e||!window.TPOConfigs||(c.log({body:"Guard against TPO overlay triggered"}),this.#e=new MutationObserver(e=>{for(const r of e)for(const n of Array.from(r.addedNodes))n instanceof HTMLElement&&n.classList.contains("tpo-buy-it-now-btn")&&n.remove()}),this.#e.observe(t,{childList:!0,subtree:!0}))}},$n=class extends Error{};$n.prototype.name="CleanupOnFailureError";var nd=class extends ht{name=p.BuyItNow;button=null;static get observedAttributes(){return["disabled"]}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button)}async handleClick(){if(this.disabled||!this.button||this.button.getAttribute("aria-disabled"))return;this.disabled=!0,dt(this.name,this.pageType);const[t,e,r]=await Promise.all([this.i18n,this.dataSource,this.topLevelErrorHandler]);try{const{decelerationReason:n,cart:a,customValidationError:o,unrecoverableError:i,abortReason:s}=await ut({element:this,instrumentName:this.name,dataSource:e});if(i){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),Et({i18n:t,topLevelErrorHandler:r,wallet:this.name,unrecoverableError:i});return}if(s==="out_of_stock"){c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),lt({i18n:t,topLevelErrorHandler:r,wallet:this.name});return}if(o){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),nt({i18n:t,topLevelErrorHandler:r,wallet:this.name,message:o.message});return}if(n){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:a?.checkoutUrl??"",instrumentName:this.name,reason:n});return}c.sheetClicked({instrument:this.name,result:"success"}),rt(a?.checkoutUrl??"","allow_redirect")}catch(n){g.notify(n),c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Buy It Now Button click",attributes:{error:String(n)}}),U({i18n:t,topLevelErrorHandler:r,wallet:this.name})}}async render(){this.button||(this.button=ze());const t=await this.classNames;this.button.textContent=(await this.i18n).translate("instruments_copy.checkout.buy_now"),this.button.className=t,this.disabled&&this.button.setAttribute("aria-disabled","true"),this.button.onclick=()=>this.handleClick(),this.appendChild(this.button),this.onRendered?.()}},od=1e3,id=()=>od*Sr();function sd(){const t=navigator.userAgent,e=t.indexOf("Android")>-1,r=t.indexOf("Chrome/")>-1,n=parseInt((/Chrome\/([0-9]+)/.exec(t)||["0","0"])[1],10);return e&&r&&n===114}function ld(t){let e=()=>{},r;const n=new Promise((i,s)=>{e=s}),a=Promise.race([t,n]).finally(()=>clearTimeout(r)),o=()=>e(new Error("timed out"));try{r=setTimeout(o,id())}catch{o()}return a}
41var pt=class{static walletName(){throw new Error("Must define walletName for WalletInstrument subclass")}walletParams;supportsSubscriptions;supportsDeferredPurchaseOptions;constructor(t){this.walletParams=t.wallet_params,this.supportsSubscriptions=t.supports_subs??!1,this.supportsDeferredPurchaseOptions=t.supports_def_opts??!1}async createWebComponent({walletContainer:t,dataSource:e,i18n:r,apiClient:n,topLevelErrorHandler:a,containerInstanceNumber:o,classNames:i="",callToAction:s,pageType:l=S.ProductPage,slot:d="button",onRendered:u=()=>{},onRenderFailed:h=()=>{}}){const m=this.getWebComponentName();if(!tt(m,this.getWebComponentClass(),{isChildCustomElement:!0}))throw new q(`Failed to define custom element ${m}, aborting execution`);try{await ld(customElements.whenDefined(m))}catch{throw new q(`Timeout waiting for custom element ${m} to be defined`)}const y=document.createElement(m);if(!(y instanceof ht))throw new q(`Failed to create web component instance for ${m}, element is not a WalletButtonElement`);const b={"access-token":t.accessToken??"","buyer-country":t.buyerCountry??"","buyer-currency":t.buyerCurrency,"wallet-params":JSON.stringify(this.walletParams??{}),"page-type":l,slot:d};try{t.disabled&&y.setAttribute("disabled",""),xt(y,b),t.isShippingRequired&&y.setAttribute("requires-shipping",""),t.hasSellingPlan&&y.setAttribute("has-selling-plan",""),t.pciEnabled&&y.setAttribute("pci-enabled","")}catch(A){throw A instanceof Error&&A.message.includes("setAttribute is not a function")&&sd()?new q(A.message):A}if(s&&y.setAttribute("call-to-action",""),typeof y.setDataSource!="function")throw new q(`Custom element ${m} is not properly upgraded, aborting execution`);return y.setDataSource(e),y.setApiClient(n),y.setTopLevelErrorHandler(a),y.setI18n(r),y.setClassNames(i),y.setContainerInstanceNumber(o),y.supportsSubscriptions=this.supportsSubscriptions,y.supportsDeferredPurchaseOptions=this.supportsDeferredPurchaseOptions,y.onRendered=u,y.onRenderFailed=h,y}getWalletParamsEligibility(){return{eligible:!0}}loadWalletSDK(){return Promise.resolve()}getLoadEligibility(t){return{eligible:!0}}getPartnerSDKEligibility(){return{eligible:!0}}isInIframe(){return typeof window>"u"||window.self!==window.top}},cd=class extends pt{static walletName(){return"buy_it_now"}getWebComponentName(){return"shopify-buy-it-now-button"}getInstrumentName(){return p.BuyItNow}getWebComponentClass(){return nd}},dd="shopify-paypal-button[disabled]{opacity:.5;cursor:not-allowed}shopify-paypal-button div.paypal-buttons>iframe{box-shadow:none;z-index:auto!important;border-radius:0!important}",ud="::slotted(div){height:100%}:host([page-type=cart_page]) ::slotted(div){justify-content:center;width:100%;min-width:100px;display:flex}:host([page-type=cart_page]) .accelerated-checkout-button{justify-content:center;display:flex;overflow:hidden}";async function kt(t){const{cartId:e,cartClient:r,instrumentName:n,abortSignal:a}=t;try{if(!e)throw new Error(`[${n}] provided no cart ID when updating buyer identity`);if(!r)throw new Error(`[${n}] provided invalid cart client when updating buyer identity`);return await r.updateCartBuyerIdentity(t,a)}catch(o){throw c.updateFailed({instrument:n,request:"updateBuyerIdentity",error:o}),o}}async function Ur({cartId:t,totalAmount:e,paymentMethod:r,billingAddress:n,cartClient:a,instrumentName:o,abortSignal:i,hasSellingPlan:s,canUsePaymentMethodForFreeOrder:l}){try{if(!t)throw new Error(`[${o}] provided no cart ID when updating payment`);if(!e)throw new Error(`[${o}] provided no total amount when updating payment`);if(!r)throw new Error(`[${o}] provided no apple pay wallet content when updating payment`);if(!a)throw new Error(`[${o}] provided invalid cart client when updating payment`);const d={freePaymentMethod:{billingAddress:n}};return await a.updateCartPayment(t,{amount:{amount:e.amount,currencyCode:e.currencyCode},...Number(e.amount)<=0&&!l&&!s?d:r},o,i)}catch(d){throw c.updateFailed({instrument:o,request:"updatePayment",error:d}),d}}function Vn(t){return window[Wn(t)]}function Wn(t){return`paypal-${t.replace(/[^a-zA-Z0-9]/g,"")}`}var hd="GENERIC_ERROR",pd="NO_PENDING_TASK",md="WALLET_SERVICE_DISABLED",gd="FAILED_TO_ENQUEUE_BACKGROUND_JOB",fd="REQUEST_MISSING_VALID_MERCHANDISE_SOURCE",yd="THROTTLE_EXCEEDED",bd="INTERNAL_SERVER_ERROR",wd=[hd,pd,md,gd,fd,yd,bd];function ga(t){return t?.map(e=>({code:e.extensions?.code,isLoggable:wd.includes(e.extensions?.code)})).find(({code:e,isLoggable:r})=>e==="RESTRICTED_WALLET_ACCOUNT"||r)}function Ie(t){if(!t)return null;const e=getComputedStyle(t).borderRadius;return e.includes("px")?parseInt(e,10):null}function lr(t){if(!t)return null;const e=getComputedStyle(t).height;return e.includes("px")?parseInt(e,10):null}var _d=["cart_throttled","payment_method_not_applicable","invali
41d_payment_deferred_payment_required","nested_line_subscription","nested_line_deferred_payment"],Qe="PAYPAL_CALLBACK_HANDLED_ERROR",Ed=["Can not set name for cross-domain window","too much recursion"],Ad=class extends ht{name=p.PayPal;abortController=null;cartId;sdkButtonsComponent=void 0;container=null;resizeObserver=null;buttonHeight;rendering=!1;pendingResize=!1;prevBorderRadius=0;prevHeight=0;#t=!1;#e="";#r=0;#n;connectedCallback(){this.resizeObserver=wt("ResizeObserver",()=>this.onResize()),this.cleanupOnFailure(this.render.bind(this),this.name),window.addEventListener("pageshow",this.onPageShowHandler)}async disconnectedCallback(){window.removeEventListener("pageshow",this.onPageShowHandler),super.disconnectedCallback(),this.innerHTML="",this.clearShadowRoot(),await this.teardownPayPalButton(),this.resizeObserver?.disconnect()}onPageShowHandler=t=>{t.persisted&&!this.rendering&&(this.rendering=!0,this.cleanupOnFailure(async()=>{await this.teardownPayPalButton(),this.container&&(this.container.innerHTML=""),await this.renderFromPayPalSDK()},this.name))};async teardownPayPalButton(){try{await this.sdkButtonsComponent?.close().catch(()=>{})}catch{}finally{this.sdkButtonsComponent=void 0}}async onResize(){const t=Ie(this.container),e=this.getHeight(),r=t!==null&&this.prevBorderRadius!==t||this.prevHeight!==e;!this.rendering&&r?(this.rendering=!0,await this.teardownPayPalButton(),this.container.innerHTML="",await this.cleanupOnFailure(()=>this.renderFromPayPalSDK(),this.name)):this.rendering&&r&&(this.pendingResize=!0)}async render(){const t=this.getOrCreateShadowRoot(),e=document.createElement("div");e.className=_t.BUTTON;const r=document.createElement("style");r.innerHTML=dd,this.appendChild(r),await this.initializeShadowStyles(t,ud),t.appendChild(e),this.container=e,await ns();const n=this.renderFromPayPalSDK();this.resizeObserver?.observe(this.container),await n}getHeight(){const t=lr(this.container);return t?t>=25&&t<=55?t:t<25?(console.debug("[PayPalButton] Container height is less than the minimum height of the PayPal button. Using the minimum height of 25px."),25):(console.debug("[PayPalButton] Container height is greater than the maximum height of the PayPal button. Using the maximum height of 55px."),55):44}async renderFromPayPalSDK(){if(!this.container)throw new Error("button container not set when attempting to render");this.rendering=!0;const t=this.requiresBillingAgreement(),e=this.isVaultWithPurchaseOrder(),r=async()=>this.createToken({apiClientPromise:this.apiClient,requiresBillingAgreement:t,isVaultWithPurchaseOrder:e});let n,a;t&&!e?a=r:n=r;const o=Ie(this.container),i=this.getHeight();this.prevHeight=i;const s={color:"gold",label:this.isCTA?"pay":"paypal",disableMaxWidth:!0,height:i,shape:"sharp"};o&&o>0&&(s.borderRadius=o,this.prevBorderRadius=o);const[l,d]=await Promise.all([this.i18n,this.topLevelErrorHandler]);this.sdkButtonsComponent=Vn(this.walletParams.sdkUrl)?.Buttons?.({fundingSource:"paypal",style:s,createOrder:n,createBillingAgreement:a,onApprove:async h=>{await this.onApprove(h)},onCancel:()=>{this.cancelPaymentSheet("Payment sheet cancelled")},onClick:this.onClick.bind(this),onError:h=>{this.onError(h,l,d)}});let u=!1;try{await this.sdkButtonsComponent?.render(this.container),u=!0}catch(h){c.renderFailed(this.name),c.log({body:"PayPal Button not able to render into container.",attributes:{pageType:this.pageType,error:h?.toString()}})}finally{this.rendering=!1}u?this.onRendered?.():this.onRenderFailed?.(),this.pendingResize&&(this.pendingResize=!1,await this.onResize())}cancelPaymentSheet(t){this.#t=!0,c.sheetCancelled(this.name),this.abortController?.abort(`[PayPal] ${t}`)}async onClick(t,e){if(this.disabled)return e.reject();dt(this.name,this.pageType),this.#t=!1,this.abortController=wt("AbortController");
41const r=this.getBoundingClientRect(),n=r.left+r.width/2,a=r.top+r.height/2,o=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,clientX:n,clientY:a,screenX:window.screenX+n,screenY:window.screenY+a});this.dispatchEvent(o);const[i,s,l]=await Promise.all([this.dataSource,this.i18n,this.topLevelErrorHandler]);try{const{decelerationReason:d,cart:u,customValidationError:h,unrecoverableError:m,abortReason:y}=await ut({element:this,instrumentName:this.name,dataSource:i});return m?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),c.log({body:"Unrecoverable error detected in PayPal sheet clicked",attributes:{unrecoverableError:m}}),Et({i18n:s,topLevelErrorHandler:l,wallet:this.name,unrecoverableError:m}),e.reject()):y==="out_of_stock"?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),lt({i18n:s,topLevelErrorHandler:l,wallet:this.name}),e.reject()):h?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),c.log({body:"Custom validation error detected in PayPal sheet clicked",attributes:{errorMessage:h?.message}}),nt({i18n:s,topLevelErrorHandler:l,wallet:this.name,message:h.message}),e.reject()):this.hasSellingPlanConflict(u)?(c.sheetClicked({instrument:this.name,result:"success",reason:"redirected_to_checkout"}),rt(u?.checkoutUrl??""),e.reject()):this.isVaultWithPurchaseOrder()&&Number(u.totalAmount.amount)<=0?(c.sheetClicked({instrument:this.name,result:"success",reason:"redirected_to_checkout"}),rt(u.checkoutUrl),e.reject()):d?(c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:u?.checkoutUrl??"",instrumentName:this.name,reason:d}),e.reject()):(this.cartId=u.id,this.#e=u.checkoutUrl,e.resolve())}catch(d){return c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in PayPal sheet clicked",attributes:{error:String(d),location:"onClick",...this.cartId&&{cartId:Qt(this.cartId)}}}),g.notify(d),U({i18n:s,topLevelErrorHandler:l,wallet:this.name}),e.reject()}}async createToken({apiClientPromise:t,requiresBillingAgreement:e,isVaultWithPurchaseOrder:r}){const n=++this.#r;this.#n=void 0;const a=await t;try{if(!this.cartId)throw new Error("cartId not found when creating token");const o=await a.paypalTokenCreate({cartId:this.cartId,billingAgreement:e,isVaultWithPurchaseOrder:r});return c.sheetClicked({instrument:this.name,result:"success"}),n===this.#r&&(this.#n=o.authAssertionContext?{orderId:o.token,value:o.authAssertionContext}:void 0),o.token}catch(o){throw this.#t||(o instanceof q?c.sheetClicked({instrument:this.name,result:"rejected",reason:"silenced_error"}):(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in PayPal sheet clicked",attributes:{error:String(o),location:"createToken",...this.cartId&&{cartId:Qt(this.cartId)}}}),g.notify(o))),U({i18n:await this.i18n,topLevelErrorHandler:await this.topLevelErrorHandler,wallet:this.name}),new Error(Qe)}}async onApprove({orderID:t,payerID:e,billingToken:r}){try{if(c.authorizationAttempt(this.name),Ot(O.AuthorizationLatency,this.name),!this.cartId)throw new Error("Cart not found");const n=await this.apiClient,a=this.isVaultWithPurchaseOrder(),o=this.requiresBillingAgreement()&&!a?r??t:t,i=this.#n?.orderId===t?this.#n.value:void 0,{billingAddress:s,destinationAddress:l,expiresAt:d,email:u,remoteOrderId:h,payerApprovedAmount:m}=i?await n.paypalBuyerDetailsFetch(o,this.cartId,i):await n.paypalBuyerDetailsFetch(o,this.cartId),y=h??t,b=y===t?i:void 0;if(this.isShippingRequired&&!this.isShippingCountrySupported(l?.country)){N({checkoutUrl:this.#e,instrumentName:this.name,reason:"shipping_country_unavailable"});return}const A=await kt({cartId:this.cartId,cartClient:n,instrumentName:this.name,emailAddress:u,streetAddress:l});if(!A?.data)throw new Error("Cart not found");if(await this.decelerateOrAbort(A,{detectCurrencyChange:!1}))return;const{id:T,totalAmount:_,checkoutUrl:P}=A.data,k=this.parseAddress({billingAddress:s,destinationAddress:l}),L=await Ur({abortSignal:this.abortController?.signal,cartClient:n,cartId:T,instrumentName:p.PayPal,billingAddress:k,paymentMethod:{walletPaymentMethod:{paypalWalletContent:{...b&&{authAssertionContext:b},billingAddress:k,email:u,expiresAt:d,payerId:e,token:y,acceptedSubscriptionTerms:!1,vaultingAgreement:!1,merchantId:this.walletParams.merchantId,currencyCode:this.buyerCurrency,...m&&{payerApprovedAmount:m},...a&&{isVaultWithPurchaseOrder:a}}}},canUsePaymentMethodForFreeOrder:!0,totalAmount:_});if(await this.decelerateOrAbort(L))return;c.authorizationComplete({instrument:this.name,result:"success",measurement:Y(O.AuthorizationLatency,this.name)}),rt(P)}catch(n){throw this.#t||(c.authorizationComplete({instrument:this.name,result:"failed",measurement:Y(O.AuthorizationLatency,this.name)}),g.notify(n)),U({i18n:await this.i18n,topLevelErrorHandler:await this.topLevelErrorHandler,wallet:this.name}),new Error(Qe)}}onError(t,e,r){if(this.#t||t.message.includes(Qe))return;if(t.message==="Window is closed, can not determine type"){this.cancelPaymentSheet("Window Closed Error");return}if(t.message==="Detected popup close"){this.cancelPaymentSheet("Popup Closed Error");return}t.message==="RESTRICTED_WALLET_ACCOUNT"?c.log({body:`PayPal modal closed due to error: ${t}`}):Ed.some(a=>t.message.includes(a))?c.log({body:"Internal PayPal error occurred"}):g.notify(new jn(t)),c.sheetFailed(this.name,t),this.abortController?.abort("[PayPal] Error occurred");const n=e.translate("brand.paypal");U({i18n:e,topLevelErrorHandler:r,wallet:this.name,brand:n})}requiresBillingAgreement(){return!!(this.walletParams.hasManagedSellingPlanState||this.walletParams.requiresBillingAgreement)}isVaultWithPurchaseOrder(){const t=this.walletParams.gatewayType==="CONNECTED"&&Q.enabled(ul),e=this.walletParams.gatewayType==="MANAGED"&&Q.enabled(hl);
41return this.requiresBillingAgreement()&&(t||e)}get serviceableCountries(){const t=this.walletParams.serviceableCountryCodes;return!Array.isArray(t)||t.length===0?null:new Set(t)}isShippingCountrySupported(t){const e=this.serviceableCountries;return!e||!t?!0:e.has(t)}async decelerateOrAbort(t,{detectCurrencyChange:e=!0}={}){if(t.abortReason==="out_of_stock")return await this.handleOutOfStock(),!0;if(Un(t.errors,Nr))return await this.handleOutOfStock(),!0;if(!t.data)return!1;const{totalAmount:r,checkoutUrl:n}=t.data;let a;return t.decelerationReason&&_d.includes(t.decelerationReason)?a=t.decelerationReason:e&&Lr({currentCartTotal:r,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a?(N({checkoutUrl:n,instrumentName:this.name,reason:a}),!0):!1}async handleOutOfStock(){c.authorizationComplete({instrument:this.name,result:"failed",measurement:Y(O.AuthorizationLatency,this.name)}),lt({i18n:await this.i18n,topLevelErrorHandler:await this.topLevelErrorHandler,wallet:this.name})}hasSellingPlanConflict(t){const{hasManagedSellingPlanState:e}=this.walletParams;return e==null||!t?!1:t.lineItems.some(r=>r.sellingPlanAllocation!=null)!==e}parseAddress({billingAddress:t,destinationAddress:e}){const r=t??e;return r.country?r:this.buyerCountry?{...r,country:this.buyerCountry}:(g.notify(new Error("PayPal address missing country and buyer country is not set")),{...r,country:"ZZ"})}},jn=class extends Z{#t;get stack(){return this.#t}set stack(t){this.#t=t}get useHashPrefix(){return!0}constructor(t){super(t.message,{cause:t.cause}),this.stack=t.stack}};jn.prototype.name="PayPalError";function Fe(t,e){const r=e instanceof Event?e.type:String(e);return new q(`Error loading ${t} script: ${r}`)}var vd=class he extends pt{static paypalSDKPromiseByUrl=new Map;static walletName(){return"paypal"}constructor(e){super(e)}getWebComponentName(){return"shopify-paypal-button"}getInstrumentName(){return p.PayPal}getWebComponentClass(){return Ad}getWalletParamsEligibility(){return typeof this.walletParams?.sdkUrl!="string"||this.walletParams.sdkUrl.length===0?{eligible:!1,reason:"walletParams.sdkUrl is missing or invalid"}:{eligible:!0}}loadWalletSDK(){let e=he.paypalSDKPromiseByUrl.get(this.walletParams.sdkUrl);if(e)return c.log({body:"Returning cached PayPal SDK promise",attributes:{sdkUrl:this.walletParams.sdkUrl}}),e;const r=document.createElement("script");return r.setAttribute("src",this.walletParams.sdkUrl),e=new Promise((n,a)=>{r.setAttribute("data-namespace",Wn(this.walletParams.sdkUrl)),r.onload=()=>n(),r.onerror=o=>{he.paypalSDKPromiseByUrl.delete(this.walletParams.sdkUrl),r&&document.body?.contains(r)&&document.body.removeChild(r),a(Fe("PayPal",o))},document.body.appendChild(r)}),he.paypalSDKPromiseByUrl.set(this.walletParams.sdkUrl,e),e}getLoadEligibility(){return this.isInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){try{return Vn(this.walletParams.sdkUrl)?.Buttons?.().isEligible()?{eligible:!0}:{eligible:!1,reason:"PayPal SDK not eligible"}}catch(e){throw new W({code:"paypal-sdk-eligibility-check-failed",message:`PayPal SDK 'isEligible' method failed unexpectedly: ${e}`})}}}
41,Cd=".apple-pay-button{cursor:pointer;border:none;justify-content:center;align-items:center;width:100%;display:flex;padding:0!important;&:hover:not(:disabled){filter:brightness(92%)}&:disabled{opacity:.5;cursor:not-allowed}}.apple-pay-button svg{flex-shrink:0;height:100%}.apple-pay--content{white-space:pre;flex-grow:1;justify-content:center;align-items:center;width:100%;height:100%;font-family:San Francisco,sans-serif;font-size:16px;display:flex}.apple-pay--light{color:#000;background:#fff;& svg{fill:#000}}.apple-pay--dark{color:#fff;background:#000;& svg{fill:#fff}}",cr={UK:"GB",JA:"JP"},Sd=new Set(["EG","AE"]),qn=["AS","GU","MP","PR","VI"];qn.forEach(t=>{cr[t]="US"});var Pd=/^[A-Z]{1,2}[0-9]{1,2}[A-Z]?$/,Id=/^[A-Z][0-9][A-Z]$/;function kd({postalCode:t,countryCode:e}){let r=t;const n=t.trim().toUpperCase();return e==="CA"&&Id.test(n)?r=`${n} 0Z0`:e==="GB"&&Pd.test(n)&&(r=`${n} 0ZZ`),r}function se(t,{applyPostalCodePadding:e}){const r=t.countryCode,n={firstName:t.givenName||void 0,lastName:t.familyName||void 0,address1:t?.addressLines?.[0],address2:t?.addressLines?.[1]||void 0,city:t.locality||void 0,zip:t.postalCode||void 0,province:t.administrativeArea||t.subLocality||void 0,country:Td(t.countryCode),phone:t.phoneNumber||void 0};return r&&Sd.has(r.toUpperCase())&&(n.province=t.locality||void 0,n.city=t.administrativeArea||t.subLocality||void 0),e&&n.zip&&(n.zip=kd({postalCode:n.zip,countryCode:n.country})),n.country==="HK"&&(n.zip=void 0,n.province=t.postalCode),r&&qn.includes(r)&&(n.province=r),n.lastName||(n.lastName=n.firstName),n}function Td(t){if(!t)return"ZZ";const e=t.toUpperCase();return Object.keys(cr).includes(e)?cr[e]:e}function Dd(t,e){return t.map(r=>{const{title:n,deliveryPromise:a}=Ld(r,e);return{title:n,estimatedCost:{amount:Nd(r),currencyCode:r[0].estimatedCost.currencyCode},handle:Qn(r),deliveryPromise:a}})}function Rd(t,e){return t.map(r=>{const{title:n,description:a}=Od(r,e);return{title:n,description:a,handle:Qn(r)}})}function Yn({deliveryGroups:t}){return t.map(e=>e.deliveryOptions.filter(({deliveryMethodType:r})=>r==="SHIPPING").map(r=>({...r,groupType:e.groupType}))).reduce((e,r)=>e.flatMap(n=>r.map(a=>[...n,a])),[[]])}function Nd(t){return t.reduce((e,r)=>e+Number(r.estimatedCost.amount),0).toFixed(2)}function Ld(t,e){const r=[...t.filter(o=>o.groupType===Dt.OneTimePurchase),...t.filter(o=>o.groupType===Dt.Subscription)],n=[...new Set(r.map(({title:o})=>o))].filter(o=>!!o),a=[...new Set(r.map(({deliveryPromise:o})=>o))].filter(o=>!!o);return{title:Kn(n,e),deliveryPromise:a.reduce((o,i)=>o?e.translate("delivery_promises.connect_delivery_promises",{promiseOne:o,promiseTwo:i}):i,"")}}function Od(t,e){const r=[...t.filter(a=>a.groupType===Dt.OneTimePurchase),...t.filter(a=>a.groupType===Dt.Subscription)],n=r.map(xd).filter(Boolean).join(", ");return{title:Kn(r.map(({title:a})=>a).filter(a=>!!a),e),description:n}}function Kn(t,e){return t.reduce((r,n)=>r?e.translate("shipping_methods.connect_shipping_methods",{methodOne:r,methodTwo:n}):n,"")}function xd(t){const e=Number(t.estimatedCost.amount).toFixed(2),r=t.estimatedCost.currencyCode,n=t.deliveryPromise;return n?`(${n}) ${e} ${r}`:`${e} ${r}`}function Qn(t){return t.map(e=>e.handle).join(",")}function Xn({deliveryGroups:t,i18n:e}){const r=t.some(n=>n.groupType===Dt.Subscription);return t.map(n=>{let a=e.translate("order_summary.shipping");return r&&(a=n.groupType===Dt.Subscription?e.translate("order_summary.shipping_subscription"):e.translate("order_summary.shipping_one_time_purchase")),{label:a,amount:st(n.selectedDeliveryOption?.estimatedCost.amount||0)}})}function Md(t,e){return Ht({label:t,possibleLines:[e]})[0]}function zd({subtotal:t,deliveryGroups:e,duties:r,taxes:n,discountApplications:a,i18n:o,formattedRecurringTotals:i,lineItems:s}){const l=Ht({label:o.translate("order_summary.subtotal"),possibleLines:[t]}),d=Xn({deliveryGroups:e,i18n:o}),u=Ht({label:o.translate("order_summary.duties"),possibleLines:[r]}),h=Ht({label:o.translate("order_summary.taxes"),possibleLines:[n]}),m=i.map(A=>({label:A,amount:"0.00",type:"pending"})),y=m.length?[{label:o.translate("order_summary.subscriptions.recurring_total_tooltip_line"),amount:"0.00",type:"pending"}]:[],b=a?.flatMap(A=>Ht({label:A.title??A.code??o.translate("order_summary.discount"),possibleLines:["totalAllocatedAmount"in A?A.totalAllocatedAmount:A.discountedAmount],isDiscount:!0}))??[];return[...un(s,(A,T)=>({label:A,amount:T,type:"final"})),...l,...d,...u,...h,...b,...m,...y]}function Ht({label:t,possibleLines:e,isDiscount:r=!1}){return e.filter(n=>n?.amount!==void 0).map(n=>({label:t,amount:r?`-${st(n.amount)}`:st(n.amount)}))}function fa(t,e){if(!t.length)return[];const r=Yn({deliveryGroups:t});return Dd(r,e).map(n=>({label:n.title||"",amount:n.estimatedCost.amount,identifier:n.handle,detail
41:n.deliveryPromise??""}))}var Fd=["decelerate","abort","show_error","complete","update"],ke=class extends Z{};ke.prototype.name="UnhandledActionError";var Jn=class{getMergedPaymentSheetAction({result:t,errorActions:e}){const r=new Map;e.forEach(a=>{a.matchers.forEach(o=>{const i=t.errors.find(s=>jt(s,o));i&&r.set(i,a.generateAction)})});let n;for(const a of t.errors){const o=r.get(a);if(o){n=o();break}}return{firstPaymentSheetAction:n,prioritizedPaymentSheetAction:this.generatePrioritizedPaymentSheetAction(r,t.errors)}}getUnhandledErrors(t,e){const r=e.flatMap(a=>a.matchers),n=t.filter(a=>!r.some(o=>jt(a,o)));return this.filterIncidentalErrors(n,t)}decelerateOrAbort({reason:t,instrumentName:e,errorOrWarning:r,checkoutUrl:n,requestType:a}){return n?{action:"decelerate",redirectUrl:n,reason:t}:{action:"abort",effects:[()=>{g.notify(new Error(`[${e}] unexpected ${r} received in ${a} response, aborting`))}]}}filterIncidentalErrors(t,e){return e.length>t.length?t.filter(r=>!Fc.some(n=>jt(r,n))):t}generatePrioritizedPaymentSheetAction=(t,e)=>{let r;const n=[],a=[],o=[],i=e.filter(l=>l.code!=="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT").some(l=>t.get(l)!==void 0);for(const l of t.keys())if(!(l.code==="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"&&i)){const d=t.get(l)();d.effects&&a.push(...d.effects),d.action!=="complete"&&d.errors&&o.push(...d.errors),n.push(d)}const s=(l=>Fd.map(d=>l.find(u=>u.action===d)).find(d=>!!d))(n);return s&&(r=s,r.effects=a,r.action!=="complete"&&(r.errors=o)),r}},Ud=class extends Jn{i18n;topLevelErrorHandler;constructor(t,e){super(),this.i18n=t,this.topLevelErrorHandler=e}mapMutationResultToPaymentSheetAction({result:t,context:e,checkoutUrl:r,requestType:n}){const a=this.mapCustomValidationFunctionErrorToAction(t.errors);if(a)return a;const o=this.getErrorActions({shippingCountryCode:e?.shippingCountryCode,shippingZip:e?.shippingZip,shippingProvince:e?.shippingProvince,shippingCity:e?.shippingCity,billingCountryCode:e?.billingCountryCode,billingZip:e?.billingZip,billingProvince:e?.billingProvince,billingCity:e?.billingCity,checkoutUrl:r,requestType:n}),i=t.errors,s=this.processUnhandledErrors({errors:i,errorActions:o,resultType:"mutation"}),{firstPaymentSheetAction:l}=this.getMergedPaymentSheetAction({result:t,errorActions:o});return!l&&t.data?.deliveryGroups.length===0&&e?.shippingRequired?{action:"show_error",errors:[new ApplePayError("addressUnserviceable")]}:l||s||{action:"update",errors:[]}}mapCompletionResultToPaymentSheetAction({result:t,context:e,checkoutUrl:r}){if(!t.data)throw new Ja(p.ApplePay);switch(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 a=this.getErrorActions({shippingCountryCode:e?.shippingCountryCode,shippingZip:e?.shippingZip,shippingProvince:e?.shippingProvince,shippingCity:e?.shippingCity,billingCountryCode:e?.billingCountryCode,billingZip:e?.billingZip,billingProvince:e?.billingProvince,billingCity:e?.billingCity,checkoutUrl:r,requestType:"completion"}),o=t.errors;this.processUnhandledErrors({errors:o,errorActions:a,resultType:"completion"});const{prioritizedPaymentSheetAction:i}=this.getMergedPaymentSheetAction({result:t,errorActions:a});return i||this.createGenericAbortAction()}default:throw new Error(`[${p.ApplePay}] unknown completion result type: ${t.data.__typename}`)}}decelerateOrAbort(...t){const e=super.decelerateOrAbort(...t);return e.action==="abort"&&e.effects?.push(()=>{U({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.ApplePay,brand:this.i18n.translate("brand.apple_pay")})}),e}getAbortActions(){return[{matchers:Nr,generateAction:()=>({action:"abort",effects:[()=>lt({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.ApplePay})]})},{matchers:Fn,generateAction:()=>({action:"abort",effects:[()=>U({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.ApplePay,brand:this.i18n.translate("brand.apple_pay")})]})}]}getDecelerateActions({checkoutUrl:t,requestType:e}){return[{matchers:[be],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:p.ApplePay,errorOrWarning:be.code,checkoutUrl:t,requestType:e})},{matchers:[we],generateAction:()=>this.decelerateOrAbort({reason:"localization_extension_field_error",instrumentName:p.ApplePay,errorOrWarning:we.code,checkoutUrl:t,requestType:e})},{matchers:[sa],generateAction:()=>this.decelerateOrAbort({reason:"account_info_mismatch",instrumentName:p.ApplePay,errorOrWarning:sa.code,checkoutUrl:t,requestType:e})},{matchers:[_e],generateAction:()=>this.decelerateOrAbort({reason:"invalid_language",instrumentName:p.ApplePay,errorOrWarning:_e.code,checkoutUrl:t,requestType:e})},{matchers:[Ee],generateAction:()=>this.decelerateOrAbort({reason:"invalid_country",instrumentName:p.ApplePay,errorOrWarning:Ee.code,checkoutUrl:t,requestType:e})},{matchers:[la],generateAction:()=>this.decelerateOrAbort({reason:"payments_country_invalid",instrumentName:p.ApplePay,errorOrWarning:la.code,checkoutUrl:t,requestType:e})},{matchers:[ca],generateAction:()=>this.decelerateOrAbort({reason:"cart_empty",instrumentName:p.ApplePay,errorOrWarning:ca.code,checkoutUrl:t,requestType:e})},{matchers:[Ae],generateAction:()=>this.decelerateOrAbort({reason:"missing_cart_id",instrumentName:p.ApplePay,errorOrWarning:Ae.code,checkoutUrl:t,requestType:e})},{matchers:[Ce],generateAction:()=>this.decelerateOrAbort({reason:"redirect_to_checkout_required",instrumentName:p.ApplePay,errorOrWarning:Ce.code,checkoutUrl:t,requestType:e})},{matchers:[ve],generateAction:()=>this.decelerateOrAbort({reason:"unsupported_apple_pay_payment_method",instrumentName:p.ApplePay,errorOrWarning:ve.code,checkoutUrl:t,requestType:e})},{matchers:[ye],generateAction:()=>this.decelerateOrAbort({reason:"custom_validation",instrumentName:p.ApplePay,errorOrWarning:ye.code,checkoutUrl:t,requestType:e})},{matchers:On,generateAction:()=>this.decelerateOrAbort({reason:"invalid_payment_amount",instrumentName:p.ApplePay,errorOrWarning:"INVALID_PAYMENT",checkoutUrl:t,requestType:e})},{matchers:Rr,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:p.ApplePay,errorOrWarning:"TAX_NEW_TAX_MUST_BE_ACCEPTED",checkoutUrl:t,requestType:e})},{matchers:[Se],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:p.ApplePay,errorOrWarning:Se.code,checkoutUrl:t,requestType:e})},{matchers:[da],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:p.ApplePay,errorOrWarning:da.code,checkoutUrl:t,requestType:e})},{matchers:xn,generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:p.ApplePay,errorOrWarning:"MERCHANDISE_NOT_ENOUGH_STOCK",checkoutUrl:t,requestType:e})}]}getShowErrorActions({shippingCountryCode:t,shippingZip:e,shippingProvince:r,shippingCity:n,billingCountryCode:a,billingZip:o,billingProvince:i,billingCity:s}
41){const l=(d,u)=>()=>{const h=u.startsWith("billingAddress");c.addressFieldError({instrument:p.ApplePay,errorCode:d,errorField:u,countryCode:h?a:t,zip:h?o:e,province:h?i:r,city:h?s:n})};return[{matchers:Xt.required,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.missing.email"))]})},{matchers:Xt.invalid,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.invalid.email"))]})},{matchers:f.required.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.firstName")]})},{matchers:f.invalid.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.firstName")]})},{matchers:f.required.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.lastName")]})},{matchers:f.invalid.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.lastName")]})},{matchers:Ln,generateAction:()=>({action:"show_error",errors:[new ApplePayError("addressUnserviceable")]})},{matchers:f.required.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address1")]})},{matchers:f.invalid.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address1")]})},{matchers:f.emojis.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{matchers:f.emojis.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{matchers:f.tooLong.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address1"))]})},{matchers:f.tooLong.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address2"))]})},{matchers:f.tooLong.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.first_name"))]})},{matchers:f.tooLong.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.last_name"))]})},{matchers:f.tooLong.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.too_long.city"))]})},{matchers:f.containsUrl.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.first_name"))]})},{matchers:f.containsUrl.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.last_name"))]})},{matchers:f.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{matchers:f.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{matchers:f.htmlTags.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{matchers:f.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{matchers:f.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{matchers:f.emojis.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{matchers:f.emojis.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{matchers:f.emojis.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{matchers:f.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{matchers:f.required.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address2")]})}
41,{matchers:f.invalid.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address2")]})},{matchers:f.required.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.missing.city"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.city")]})},{matchers:f.invalid.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.city")]})},{matchers:f.invalid.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.invalid.zone"),this.i18n.translate("errors.invalid.emirate"),"shippingContactInvalid",t)],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.province")]})},{matchers:f.required.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"shippingContactInvalid",t)],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.province")]})},{matchers:f.required.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.zip")]})},{matchers:f.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:f.required.country,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.missing.country"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.country")]})},{matchers:f.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.phone")]})},{matchers:f.invalid.country,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.invalid.country"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.country")]})},{matchers:f.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.phone")]})},{matchers:w.invalid.generic,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid")],effects:[l("INVALID_PAYMENT","billingAddress")]})},{matchers:w.required.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.firstName")]})},{matchers:w.required.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.lastName")]})},{matchers:w.required.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address1")]})},{matchers:w.required.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address2")]})},{matchers:w.required.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.missing.city"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.city")]})},{matchers:w.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.phone")]})},{matchers:w.required.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.zip")]})},{matchers:w.required.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"billingContactInvalid",a)],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.province")]})},{matchers:w.emojis.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{matchers:w.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{matchers:w.invalid.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.firstName")]})},{matchers:w.emojis.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{matchers:w.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{matchers:w.invalid.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.lastName")]})},{matchers:w.emojis.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{matchers:w.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{matchers:w.invalid.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address1")]})},{matchers:w.emojis.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{matchers:w.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{matchers:w.invalid.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address2")]})},{matchers:w.emojis.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{matchers:w.htmlTags.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{matchers:w.invalid.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.city")]})},{matchers:w.emojis.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.emojis.phone"))]})},{matchers:w.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.phone")]})},{matchers:w.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{matchers:w.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})},{matchers:[Mn],generateAction:()=>({action:"show_error",errors:[new ApplePayError("unknown")]})},{matchers:[ir],generateAction:()=>({action:"show_error",errors:[new ApplePayError("couponCodeInvalid",void 0,this.i18n.translate("errors.invalid.discount"))]})}]}getErrorActions({shippingCountryCode:t,shippingZip:e,shippingProvince:r,shippingCity:n,billingCountryCode:a,billingZip:o,billingProvince:i,billingCity:s,checkoutUrl:l,requestType:d}){return[...this.getAbortActions(),...this.getDecelerateActions({checkoutUrl:l,requestType:d}
41),...this.getShowErrorActions({shippingCountryCode:t,shippingZip:e,shippingProvince:r,shippingCity:n,billingCountryCode:a,billingZip:o,billingProvince:i,billingCity:s})]}processUnhandledErrors({errors:t,errorActions:e,resultType:r}){const n=this.getUnhandledErrors(t,e);return n.forEach(a=>{g.notify(new ke(`[${p.ApplePay}] ${r} result error not handled: ${St(a)}`,{groupingHash:`UnhandledActionError:${p.ApplePay}:${St(a)}`}))}),n.length>0?this.createGenericAbortAction():null}createGenericAbortAction(){return{action:"abort",effects:[()=>{U({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.ApplePay,brand:this.i18n.translate("brand.apple_pay")})}]}}mapCustomValidationFunctionErrorToAction(t){const e=Ir(t);return e?{action:"abort",effects:[()=>{const r=this.i18n.translate("brand.apple_pay");nt({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.ApplePay,brand:r,message:e.message})}]}:null}createApplePayZoneError(t,e,r,n){const a=n==="AE"?"subLocality":"administrativeArea";return new ApplePayError(r,a,n==="AE"?e:t)}},ya=["name","postalAddress"];function Bd({shippingRequired:t,walletParams:e,buyerCurrency:r}){const{phoneRequired:n,emailRequired:a}=e,o=[...a?["email"]:[],...n?["phone"]:[]],i=t?[...ya,...o]:o;return{countryCode:e.countryCode,currencyCode:r,merchantCapabilities:e.merchantCapabilities,supportedNetworks:e.supportedNetworks,total:{type:"pending",label:e.merchantName,amount:"1.00"},requiredBillingContactFields:ya,requiredShippingContactFields:i,shippingType:e.shippingType}}function Zn(t){const e=[],r=[],n=[];for(const a of t)a.targetType==="SHIPPING_LINE"?e.push(a):a.targetType==="LINE_ITEM"&&(a.targetSelection==="ALL"?r.push(a):n.push(a));return{shipping:e,order:r,product:n}}function Hd(t){const{shipping:e,order:r,product:n}=Zn(t.discountApplications);return[...e,...r,...n]}var Gd=t=>{const e=t.lineItems.flatMap(r=>r.discountAllocations);return[...t.discountCodes.filter(r=>r.applicable&&t.discountAllocations.findIndex(n=>n.code===r.code)===-1&&e.findIndex(n=>n.code===r.code)===-1).map(r=>({code:r.code,discountedAmount:{amount:"0",currencyCode:t.totalAmount.currencyCode}})),...t.discountAllocations,...e]},to=class extends Z{get useHashPrefix(){return!0}get autogenerateHash(){return!0}};to.prototype.name="ApplePaySessionCreationError";var eo=t=>{const e=t.lineItems.reduce((r,n)=>r+Number(n.subtotalAmount.amount),0);return{amount:String(e),currencyCode:t.totalAmount.currencyCode}};function $d(t,e){return t.reduce((r,n)=>{if(!n.sellingPlanAllocation)return r;const{sellingPlanAllocation:{sellingPlan:a,priceAdjustments:o},quantity:i}=n;if(!a.recurringDeliveries||!a.billingPolicy)return r;const s=Vd({billingPolicy:a.billingPolicy,i18n:e});if(o.length===0){const l=le({price:Number(n.subtotalAmount.amount)*i,currencyCode:n.subtotalAmount.currencyCode,locale:e.locale});return[...r,e.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(o.length===1){const l=le({price:Number(o[0].price.amount)*i,currencyCode:o[0].price.currencyCode,locale:e.locale});return[...r,e.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(o.length===2){const l=le({price:Number(o[0].price.amount)*i,currencyCode:o[0].price.currencyCode,locale:e.locale}),d=le({price:Number(o[1].price.amount)*i,currencyCode:o[1].price.currencyCode,locale:e.locale}),u=a.priceAdjustments[0].orderCount;return[...r,e.translate("order_summary.subscriptions.recurring_totals_with_policies",{count:u,fixedPrice:l,recurringPrice:d,interval:s})]}return r},[])}function le({price:t,currencyCode:e,locale:r}){return Intl.NumberFormat(r,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).format(t)}function Vd({billingPolicy:t,i18n:e}){const{interval:r,intervalCount:n}=t,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"}[r];if(!a)throw new Error(`Unknown selling plan interval provided: ${r}`);return e.translate(a,{count:n})}var Ue="GraphQL Client",ro="An error occurred while fetching from the API. Review 'graphQLErrors' for details.",ao="Response returned unexpected Content-Type:",no="An unknown error has occurred. The API did not return a data object or any errors in its response.",dr={json:"application/json",multipart:"multipart/mixed"},Wd="X-SDK-Variant",jd="X-SDK-Version",qd="shopify-graphql-client",Yd="1.4.2",oo=1e3,Kd=[429,503],io=/@(defer)\b/i,Qd=/boundary="?([^=";]+)"?/i,ba=`\r 42\r 43`;function at(t,e=Ue){return t.startsWith(`${e}`)?t:`${e}: ${t}`}function At(t){return t instanceof Error?t.message:JSON.stringify(t)}function so(t){return t instanceof Error&&t.cause?t.cause:void 0}function lo(t){return t.flatMap(({errors:e})=>e??[])}function co({client:t,retries:e}){if(e!==void 0&&(typeof e!="number"||e<0||e>3))throw new Error(`${t}: The provided "retries" value (${e}
43) is invalid - it cannot be less than 0 or greater than 3`)}function H(t,e){return e&&(typeof e!="object"||Array.isArray(e)||typeof e=="object"&&Object.keys(e).length>0)?{[t]:e}:{}}function uo(t,e){if(t.length===0)return e;const r={[t.pop()]:e};return t.length===0?r:uo(t,r)}function ho(t,e){return Object.keys(e||{}).reduce((r,n)=>(typeof e[n]=="object"||Array.isArray(e[n]))&&t[n]?(r[n]=ho(t[n],e[n]),r):(r[n]=e[n],r),Array.isArray(t)?[...t]:{...t})}function po([t,...e]){return e.reduce(ho,{...t})}function Xd({clientLogger:t,customFetchApi:e=fetch,client:r=Ue,defaultRetryWaitTime:n=oo,retriableCodes:a=Kd}){const o=async(i,s,l)=>{const d=s+1,u=l+1;let h;try{if(h=await e(...i),t({type:"HTTP-Response",content:{requestParams:i,response:h}}),!h.ok&&a.includes(h.status)&&d<=u)throw new Error;const m=h?.headers.get("X-Shopify-API-Deprecated-Reason")||"";return m&&t({type:"HTTP-Response-GraphQL-Deprecation-Notice",content:{requestParams:i,deprecationNotice:m}}),h}catch(m){if(d<=u){const y=h?.headers.get("Retry-After");return await Jd(y?parseInt(y,10):n),t({type:"HTTP-Retry",content:{requestParams:i,lastResponse:h,retryAttempt:s,maxRetries:l}}),o(i,d,l)}throw new Error(at(`${l>0?`Attempted maximum number of ${l} network retries. Last message - `:""}${At(m)}`,r))}};return o}async function Jd(t){return new Promise(e=>setTimeout(e,t))}function Zd({headers:t,url:e,customFetchApi:r=fetch,retries:n=0,logger:a}){co({client:Ue,retries:n});const o={headers:t,url:e,retries:n},i=tu(a),s=eu(Xd({customFetchApi:r,clientLogger:i,defaultRetryWaitTime:oo}),o);return{config:o,fetch:s,request:ru(s),requestStream:cu(s)}}function tu(t){return e=>{t&&t(e)}}async function mo(t){const{errors:e,data:r,extensions:n}=await t.json();return{...H("data",r),...H("extensions",n),headers:t.headers,...e||!r?{errors:{networkStatusCode:t.status,message:at(e?ro:no),...H("graphQLErrors",e),response:t}}:{}}}function eu(t,{url:e,headers:r,retries:n}){return async(a,o={})=>{const{variables:i,headers:s,url:l,retries:d,keepalive:u,signal:h}=o,m=JSON.stringify({query:a,variables:i});co({client:Ue,retries:d});const y=Object.entries({...r,...s}).reduce((b,[A,T])=>(b[A]=Array.isArray(T)?T.join(", "):T.toString(),b),{});return!y["X-SDK-Variant"]&&!y["X-SDK-Version"]&&(y[Wd]=qd,y[jd]=Yd),t([l??e,{method:"POST",headers:y,body:m,signal:h,keepalive:u}],1,d??n)}}function ru(t){return async(...e)=>{if(io.test(e[0]))throw new Error(at("This operation will result in a streamable response - use requestStream() instead."));let r=null;try{r=await t(...e);const{status:n,statusText:a}=r,o=r.headers.get("content-type")||"";return r.ok?o.includes(dr.json)?await mo(r):{errors:{networkStatusCode:n,message:at(`${ao} ${o}`),response:r}}:{errors:{networkStatusCode:n,message:at(a),response:r}}}catch(n){return{errors:{message:At(n),...r==null?{}:{networkStatusCode:r.status,response:r}}}}}}async function*au(t){const e=new TextDecoder;if(t.body[Symbol.asyncIterator])for await(const r of t.body)yield e.decode(r);else{const r=t.body.getReader();let n;try{for(;!(n=await r.read()).done;)yield e.decode(n.value)}finally{r.cancel()}}}function nu(t,e){return{async*[Symbol.asyncIterator](){try{let r="";for await(const n of t)if(r+=n,r.indexOf(e)>-1){const a=r.lastIndexOf(e),o=r.slice(0,a).split(e).filter(i=>i.trim().length>0).map(i=>i.slice(i.indexOf(ba)+ba.length).trim());o.length>0&&(yield o),r=r.slice(a+e.length),r.trim()==="--"&&(r="")}}catch(r){throw new Error(`Error occured while processing stream payload - ${At(r)}`)}}}}function ou(t){return{async*[Symbol.asyncIterator](){try{yield{...await mo(t),hasNext:!1}}catch(e){yield{errors:{message:at(At(e)),networkStatusCode:t.status,response:t},hasNext:!1}}}}}function iu(t){return t.map(e=>{try{return JSON.parse(e)}catch(r){throw new Error(`Error in parsing multipart response - ${At(r)}`)}}).map(e=>{const{data:r,incremental:n,hasNext:a,extensions:o,errors:i}=e;if(!n)return{data:r||{},...H("errors",i),...H("extensions",o),hasNext:a};const s=n.map(({data:l,path:d,errors:u})=>({data:l&&d?uo(d,l):{},...H("errors",u)}));return{data:s.length===1?s[0].data:po([...s.map(({data:l})=>l)]),...H("errors",lo(s)),hasNext:a}})}function su(t,e){if(t.length>0)throw new Error(ro,{cause:{graphQLErrors:t}});if(Object.keys(e).length===0)throw new Error(no)}function lu(t,e){const r=(e??"").match(Qd),n=`--${r?r[1]:"-"}`;if(!t.body?.getReader&&!t.body?.[Symbol.asyncIterator])throw new Error("API multipart response did not return an iterable body",{cause:t});const a=au(t);let o={},i;return{async*[Symbol.asyncIterator](){try{let s=!0;for await(const l of nu(a,n)){const d=iu(l);i=d.find(h=>h.extensions)?.extensions??i;const u=lo(d);o=po([o,...d.map(({data:h})=>h)]),s=d.slice(-1)[0].hasNext,su(u,o),yield{...H("data",o),...H("extensions",i),hasNext:s}}if(s)throw new Error("Response stream terminated unexpectedly")}catch(s){const l=so(s);yield{...H("data",o),...H("extensions",i),errors:{message:at(At(s)),networkStatusCode:t.status,...H("graphQLErrors",l?.graphQLErrors),response:t},hasNext:!1}}}}}function cu(t){return async(...e)=>{if(!io.test(e[0]))throw new Error(at("This operation does not result in a streamable response - use request() instead."));try{const r=await t(...e),{statusText:n}=r;if(!r.ok)throw new Error(n,{cause:r});const a=r.headers.get("content-type")||"";switch(!0){case a.includes(dr.json):return ou(r);case a.includes(dr.multipart):return lu(r,a);default:throw new Error(`${ao} ${a}`,{cause:r})}}catch(r){return{async*[Symbol.asyncIterator](){const n=so(r);yield{errors:{message:at(At(r)),...H("networkStatusCode",n?.status),...H("response",n)},hasNext:!1}}}}}}var du="mutation cartCreate($input:CartInput!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){result:cartCreate(input:$input){cart{...CartParts}errors:userErrors{...on CartUserError{message field code}}warnings:warnings{...on CartWarning{code}}}}",uu="mutation cartUpdateDeliveryAddressAndContact($cartId:ID!$addressInput
43:[CartSelectableAddressInput!]!$buyerIdentityInput:CartBuyerIdentityInput!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){buyerIdentityUpdateResult:cartBuyerIdentityUpdate(cartId:$cartId buyerIdentity:$buyerIdentityInput){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}addressUpdateResult:cartDeliveryAddressesReplace(addresses:$addressInput cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",hu="mutation cartAttributesUpdate($cartId:ID!$attributes:[AttributeInput!]!$country:CountryCode=CA$language:LanguageCode=EN)@inContext(country:$country language:$language){result:cartAttributesUpdate(cartId:$cartId attributes:$attributes){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",pu="mutation cartBillingAddressUpdate($cartId:ID!$billingAddress:MailingAddressInput$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){result:cartBillingAddressUpdate(cartId:$cartId billingAddress:$billingAddress){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",mu="mutation cartSelectedDeliveryOptionsUpdate($cartId:ID!$selectedDeliveryOptions:[CartSelectedDeliveryOptionInput!]!$country:CountryCode=CA$language:LanguageCode=EN)@inContext(country:$country language:$language){result:cartSelectedDeliveryOptionsUpdate(cartId:$cartId selectedDeliveryOptions:$selectedDeliveryOptions){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}
43",gu="mutation applePaySessionCreate($validationUrl:URL!){applePaySessionCreate(validationUrl:$validationUrl){...@defer{applePaySession{body}}}}",fu="mutation PayPalBuyerDetailsFetch($token:String!$cartId:ID$authAssertionContext:String){paypalBuyerDetailsFetch(token:$token cartId:$cartId authAssertionContext:$authAssertionContext){...@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}}payerApprovedAmount{currencyCode amount}}}}}",yu="mutation PayPalTokenCreate($cartId:ID!$billingAgreement:Boolean!){paypalTokenCreate(cartId:$cartId billingAgreement:$billingAgreement){...@defer{paypalToken{authAssertionContext token}}}}",bu="mutation PayPalVaultWithPurchaseOrderTokenCreate($cartId:ID!$billingAgreement:Boolean!){paypalTokenCreate(cartId:$cartId billingAgreement:$billingAgreement isVaultWithPurchaseOrder:true){...@defer{paypalToken{authAssertionContext token}}}}",wu="query cartQuery($id:ID!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){cart(id:$id){...CartParts}}",_u="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}}}}}}}",Eu="query subscriptionPolicyQuery($country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){shop{subscriptionPolicy(sanitized:true){body}}}",Au="mutation cartPaymentUpdate($cartId:ID!$input:CartPaymentInput!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){result:cartPaymentUpdate(cartId:$cartId payment:$input){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",Xe="fragment CartParts on Cart{id checkoutUrl deliveryGroups(first:10){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}}discountApplications{targetType targetSelection totalAllocatedAmount{amount currencyCode}...on CartCodeDiscountApplication{code}...on CartAutomaticDiscountApplication{title}...on CartCustomDiscountApplication{title}}discountCodes{code applicable}lines(first:10){edges{node{...on CartLine{parentRelationship{parent{id}}}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 title product{title}}}sellingPlanAllocation{remainingBalanceChargeAmount{amount}priceAdjustments{price{amount currencyCode}}sellingPlan{billingPolicy{...on SellingPlanRecurringBillingPolicy{interval intervalCount}}priceAdjustments{orderCount}recurringDeliveries}}}}}}",wa="fragment CartErrorParts on CartUserError{message field code}",vu="fragment PreparedCartFragment on Mutation{preparedCart:cartPrepareForCompletion(cartId:$cartId){result{__typename ...on CartStatusReady{cart{...CartParts}}...on CartStatusNotReady{cart{...CartParts}errors{code message}}...on CartThrottled{cart{...CartParts}pollAfter}}errors:userErrors{...CartErrorParts}}}",Cu="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}}}}",Su="mutation cartRemovePersonalData($cartId:ID!){cartRemovePersonalData(cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}";async function Pu(t,e){if(!e.errors)return;const r=zu(e.errors,t),n=await Mu(e.errors.response),a=e.errors.response?.headers?.get("content-type")||void 0,o=[];if(e.errors.graphQLErrors)for(const i of e.errors.graphQLErrors)i.code&&o.push(i.code);return{operationName:t,statusCode:e.errors.networkStatusCode,contentType:a,message:r,responseBody:n,errorCodes:o,problemExplanations:Iu(e.errors.graphQLErrors??[])}}function Je(t){return typeof t=="object"&&t!==null}function Iu(t){const e=[];for(const r of t){if(!Je(r))continue;const{extensions:n}=r;if(!Je(n))continue;const{problems:a}=n;if(Array.isArray(a))for(const o of a){if(!Je(o))continue;const{explanation:i}=o;typeof i=="string"&&e.push(i)}}return e}var ku=[/API multipart response did not return an iterable body/,/Error in parsing multipart response/,/GraphQL Client: Response returned unexpected Content-Type:/,/GraphQL Client: (?:null|undefined) is not an object/i,/GraphQL Client: [A-Za-z_$][\w$]* is not defined/i,/GraphQL Client: Can't find variable: [A-Za-z_$][\w$]*/i,/GraphQL Client: HTTP error! status: \d{3}/,/Internal error/,/Throttled/,/Request blocked/,/Network request failed/,/Load failed/,/The string did n
43ot match the expected pattern/,/Failed to fetch/,/when attempting to fetch resource/,/GraphQL Client: İptal edildi$/],Tu=[/signal is aborted/i,/fetch is aborted/i,/operation was aborted/i,/\[Apple Pay\] Payment sheet cancelled/],Du=[/timed?.out/i,/error occured while processing stream payload/i,/response stream terminated/i],Ru=/provided invalid value/,Nu=/Integer out of bounds/,Lu=["quantity","sellingPlanId","attributes"];function Ou(t){return Ru.test(t)?Lu.find(e=>t.includes(e))??null:null}function xu(t,{hasBeenVisible:e=!1}={}){if(t.statusCode&&t.statusCode!==200)return{isIgnorable:!0,reason:`statusCode-${t.statusCode}`};if(t.message){if(Du.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"timeout"};if(Tu.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"abort"};if(ku.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"message"};const r=Ou(t.message);if(r)return{isIgnorable:!0,reason:`graphql-input-validation-${r}`}}return t.problemExplanations.some(r=>Nu.test(r))?{isIgnorable:!0,reason:"graphql-input-validation-integer-out-of-bounds"}:e?{isIgnorable:!1,reason:void 0}:{isIgnorable:!0,reason:"component-not-visible"}}async function Mu(t){if(!t||t.bodyUsed)return"";try{return(await t.text()).slice(0,1024)}catch(e){return console.error("Failed to read response body:",e),""}}function zu(t,e){if(!t)return"";const r=t.graphQLErrors?.map(a=>a.message).join(", ")??"",n=`${t.message}${r.length>0?` - ${r}`:""}`;return`GraphQL response error for ${e}: ${t.networkStatusCode?`with status ${t.networkStatusCode} => ${n}`:`=> ${n}`}`}var ur="UNKNOWN";function Fu({url:t,accessToken:e}){return{headers:{"Content-Type":"application/json",Accept:"application/json","X-Shopify-Storefront-Access-Token":e,"X-SDK-Variant":"portable-wallets"},url:t,retries:0,customFetchApi:(r,n)=>(g.leaveBreadcrumb(`Request ${n?.method||ur}: ${r}`,{url:r,method:n?.method},"request"),fetch(r,n)),logger:r=>{try{switch(r.type){case"HTTP-Response":{const[n,a]=r.content.requestParams,{status:o,statusText:i,headers:s,type:l}=r.content.response;g.leaveBreadcrumb(`Response ${a?.method||ur}: ${n}`,{statusCode:o,statusText:i,requestId:Uu(s),responseHeaders:Bu(s),responseType:l,url:n,method:a?.method,headers:a?.headers},"log");break}case"HTTP-Retry":{const{retryAttempt:n,maxRetries:a,lastResponse:o,requestParams:[i,s]=[]}=r.content;g.leaveBreadcrumb(`GraphQL Retry Attempt ${n}/${a}: ${i}`,{retryAttempt:n,maxRetries:a,url:i,method:s?.method,lastResponseStatus:o?.status},"log");break}case"HTTP-Response-GraphQL-Deprecation-Notice":{const{deprecationNotice:n,requestParams:a}=r.content,[o,i]=a||[];g.leaveBreadcrumb(`GraphQL Deprecation Notice: ${o}`,{deprecationNotice:n,url:o,method:i?.method},"log");break}default:{const n=r;g.leaveBreadcrumb(`GraphQL Logger: ${n.type}`,{type:n.type,content:n.content},"log")}}}catch{}}}}function Uu(t){return t.get("x-request-id")||ur}function Bu(t){if("fromEntries"in Object)return Object.fromEntries(t);const e={};for(const[r,n]of t.entries())e[r]=n;return e}function go(t){return t.trim().toUpperCase()}function fo(t){return t?.trim()?go(t):void 0}function Hu({streetAddress:t,validateAddress:e}){return[{selected:!0,oneTimeUse:!0,validationStrategy:e?"STRICT":"COUNTRY_CODE_ONLY",address:{deliveryAddress:Gu(t)}}]}function Gu(t){return{address1:t.address1,address2:t.address2,city:t.city,firstName:t.firstName,lastName:t.lastName,phone:t.phone,zip:t.zip,company:t.company,countryCode:fo(t.country),provinceCode:t.province}}var $u="unstable",Be=class{OPERATION_NAME_REGEX=/[^ ]+ (\w+)/;LANGUAGES_WITH_REGION=["zh-CN","zh-TW","pt-BR","pt-PT"];client;country;url;locale;lastValidCart=null;hasBeenVisible=!1;checkoutState="building";constructor({accessToken:t,country:e,locale:r,apiVersion:n=$u}){if(!t||!e)throw new W({code:"invalid-webcomponent",message:"accelerated checkout rendered without required webcomponent attributes"});if(!r)throw new Error("StorefrontApiClient constructed with no locale");this.country=go(e),this.locale=r,this.url=`/api/${n}/graphql.json`,this.client=Zd(Fu({url:this.url,accessToken:t}))}async createCart(t,e,r){const n=await this.request([du,Xe],{input:{lines:t.lines.map(o=>({merchandiseId:o.merchandiseId,quantity:o.quantity,sellingPlanId:o.sellingPlanId,attributes:this.stringifyAttributes(o.lineItemProperties),parent:o.parent})),discountCodes:t.discountCodes,buyerIdentity:t.buyerIdentity},country:this.country,language:this.formatLanguage(this.locale)},{instrumentName:t.instrumentName,startingCheckout:!0,operationName:"
43createCart"});n.errors&&await this.onError({operationName:"createCart",response:n});const a=n.data?.result;if(a){a.errors.length>0&&this.onResultError(a.errors);const o=this.parseMutationWarnings(n.data?.result?.warnings);o.length>0&&this.onResultWarnings(o);const i=a.cart?this.parseCartResponse(a.cart):null;return i&&(this.lastValidCart=i),{data:i,errors:this.parseMutationErrors({result:n,key:"result",operationName:"cartCreate"}),decelerationReason:ie({cart:i,warnings:o,supportsSubscriptions:e,supportsDeferredPurchaseOptions:r}),abortReason:Ke({cart:i,warnings:o})}}throw new et("Cart create operation returned no response")}async updateCartBillingAddress(t,e){const{cartId:r,billingAddress:n,instrumentName:a}=t;return this.requestUpdatedCart(pu,{cartId:r,billingAddress:n},{instrumentName:a,operationName:"updateCartBillingAddress",abortSignal:e})}async updateCartBuyerIdentity(t,e){const{cartId:r,instrumentName:n,validateAddress:a=!1,streetAddress:o}=t;this.checkoutState=a?"authorized":"building";const{deliveryAddressPreferences:i,...s}=Vu(t);return await this.requestUpdatedCart(uu,{cartId:r,buyerIdentityInput:s,addressInput:o?Hu({streetAddress:o,validateAddress:a}):[]},{instrumentName:n,operationName:"cartUpdateDeliveryAddressAndContact",abortSignal:e})}async updateSelectedDeliveryOptions(t,e,r,n){return await this.requestUpdatedCart(mu,{cartId:t,selectedDeliveryOptions:e},{instrumentName:r,operationName:"updateSelectedDeliveryOptions",abortSignal:n})}async applePaySessionCreate(t){const e=await this.requestStream([gu],{validationUrl:t.toString()},{instrumentName:p.ApplePay,operationName:"applePaySessionCreate"});for await(const r of e){r.errors&&await this.onError({operationName:"applePaySessionCreate",response:r});const n=r.data?.applePaySessionCreate?.applePaySession?.body;if(n)return n}throw new et("Apple Pay session create operation returned no response")}async paypalBuyerDetailsFetch(t,e,r){const n=await this.requestStream([fu],{token:t,cartId:e,authAssertionContext:r},{instrumentName:p.PayPal,operationName:"paypalBuyerDetailsFetch"});for await(const a of n){if(a.hasNext)continue;if(a.errors){if(a.errors.graphQLErrors){const i=ga(a.errors.graphQLErrors);if(i?.code)throw new q(i.code)}await this.onError({operationName:"paypalBuyerDetailsFetch",response:a})}const o=a.data?.paypalBuyerDetailsFetch?.paypalDetails;if(o)return o}throw new et("PayPal buyer details fetch operation returned no response")}async paypalTokenCreate({cartId:t,billingAgreement:e,isVaultWithPurchaseOrder:r=!1}){const n=r?bu:yu,a=await this.requestStream([n],{cartId:t,billingAgreement:e},{instrumentName:p.PayPal,operationName:"paypalTokenCreate"});for await(const o of a){if(o.errors){if(o.errors.graphQLErrors){const s=ga(o.errors.graphQLErrors);if(s?.code)throw s.isLoggable&&(c.log({body:`PayPal Token Create ${s.code} Error`}),c.paypalTokenCreationError({errorCode:s.code})),new q(s.code)}await this.onError({operationName:"paypalTokenCreate",response:o})}const i=o.data?.paypalTokenCreate?.paypalToken;if(i?.token)return{token:i.token,...i.authAssertionContext&&{authAssertionContext:i.authAssertionContext}}}throw new et("PayPal token create operation returned no response")}async fetchLimitedCart({id:t,startingCheckout:e,instrumentName:r}){const n=await this.request([_u],{id:t},{instrumentName:r,startingCheckout:e});if(n.errors&&await this.onError({operationName:"limitedCartQuery",response:n}),!n.data?.cart)throw new rn("Limited cart query returned no response");return g.leaveBreadcrumb("limitedCartQuery response",{operationName:"limitedCartQuery",body:n.data?.cart},"log"),{id:n.data.cart.id,shippingRequired:n.data.cart.lines.edges.some(a=>a.node.merchandise.requiresShipping),sellingPlan:n.data.cart.lines.edges.some(a=>a.node.sellingPlanAllocation!=null)}}async fetchCart({id:t,startingCheckout:e,instrumentName:r}){const n=this.formatLanguage(this.locale),a=await this.request([wu,Xe],{id:t,country:this.country,language:n},{instrumentName:r,startingCheckout:e,operationName:"fetchCart"});if(a.errors&&await this.onError({operationName:"fetchCart",response:a}),!a.data)throw new et("Fetch cart operation returned no data in response");const o=a.data.cart;if(g.leaveBreadcrumb("Fetch cart response",{body:o},"log"),o){const i=this.parseCartResponse(o);return this.lastValidCart=i,i}throw new et("Fetch cart operation returned no response")}async updateCartPayment(t,e,r,n){return this.checkoutState="authorized",this.requestUpdatedCart(Au,{cartId:t,input:e},{instrumentName:r,operationName:"updateCartPayment",abortSignal:n})}async updateCartAttributes({cartId:t,attributes:e,instrumentName:r,startingCheckout:n}){const a={cartId:t,attributes:e};return await this.requestUpdatedCart(hu,a,{instrumentName:r,operationName:"updateCartAttributes",startingCheckout:n})}async submitForCompletion(t,e,r){const n=this.formatLanguage(this.locale),a=await this.request([Cu],{cartId:t,attemptToken:e,country:this.country,language:n},{instrumentName:r,operationName:"submitForCompletion"});return a.errors&&await this.handleGraphQLErrorResponse("submitForCompletion",a),{data:a.data?.cartSubmitForCompletion?.result,errors:this.parseCompletionErrors(a)}}
43async fetchSubscriptionPolicy(){const{data:t}=await this.request([Eu],{country:this.country,language:this.formatLanguage(this.locale)},{operationName:"fetchSubscriptionPolicy"});return t?.shop?.subscriptionPolicy?.body}async cartRemovePersonalData({cartId:t,instrumentName:e}){let r,n,a;try{const i=await this.request([Su,wa],{cartId:t},{instrumentName:e,keepalive:!0});r=this.parseMutationWarnings(i.data?.cartRemovePersonalData?.warnings),n=this.parseMutationErrors({result:i,key:"cartRemovePersonalData",operationName:"cartRemovePersonalData"})}catch(i){a=String(i)}const o=!(r?.length||n?.length||a);c.removePersonalDataResult({success:o}),o||c.log({body:"cartRemovePersonalData failed",attributes:{cartId:t,warnings:r,errors:n,exception:a}})}setVisible(){this.hasBeenVisible=!0}generateURLWithOperationName(t){const e=t.match(this.OPERATION_NAME_REGEX);if(e){const r=this.url.includes("?")?"&":"?",n=`operation_name=${e[1]}`;return`${this.url}${r}${n}`}return this.url}async request(t,e,r){return this.client.request(t.join(""),{variables:e,headers:_a(r),url:this.generateURLWithOperationName(t[0]),keepalive:r.keepalive})}async requestStream(t,e,r){return this.client.requestStream(t.join(""),{variables:e,headers:_a(r),url:this.generateURLWithOperationName(t[0]),signal:r.abortSignal})}async requestUpdatedCart(t,e,r){const n=this.formatLanguage(this.locale),a=await this.request([t,Xe,wa,vu],{...e,country:this.country,language:n},r);a.errors&&await this.onError({operationName:r.operationName,response:a,abortSignal:r.abortSignal});const o=this.extractMutationErrors(a,r),i=this.parsePreparedCartMutationErrors(a.errors,o,r.operationName),s=this.extractMutationWarnings(a),l=a.data?.preparedCart?.result,d=a.data?.result?.cart??l?.cart;if(d){const m=this.parseCartResponse(d);return this.lastValidCart=m,{data:m,errors:i,abortReason:Ke({cart:m,warnings:s}),decelerationReason:ie({warnings:s,cart:m,cartStatus:l?.__typename,errors:i})}}const u=o.length>0,h=s.length>0;if(this.lastValidCart&&(u||h))return u&&this.onResultError(o),h&&this.onResultWarnings(s),{data:this.lastValidCart,errors:i,abortReason:Ke({warnings:s}),decelerationReason:ie({warnings:s,errors:i})};if(c.log({body:"Cart update response missing body",attributes:{operationName:r.operationName,hasData:!!a.data,hasResultCart:!!a.data?.result?.cart,hasPreparedCart:!!a.data?.preparedCart,responseErrors:a.errors?.graphQLErrors?.map(m=>m.message)??[],preparedCartResultTypename:l?.__typename??"null",hasLastValidCart:!!this.lastValidCart,aggregatedErrorCount:o.length}}),this.lastValidCart&&a.data?.preparedCart&&l==null)return c.log({body:"Cart prepare returned null result, falling back to last valid cart",attributes:{operationName:r.operationName}}),{data:this.lastValidCart,errors:i,decelerationReason:ie({warnings:s,cart:this.lastValidCart})};throw new et("Cart update operation returned no response")}async handleGraphQLErrorResponse(t,e){const r=await Pu(t,e);if(!r)return;const{message:n,...a}=r,{isIgnorable:o,reason:i}=xu(r,{hasBeenVisible:this.hasBeenVisible});if(g.leaveBreadcrumb(n,{ignored:o,ignoredReason:i,hasData:!!e.data,...a},"error"),o)throw c.log({body:"Ignored GraphQL response error",attributes:{message:n,reason:i,...a}}),new Tt(n,{reason:i,errorDetails:a});return{message:n,errorDetails:a}}async onError({operationName:t,response:e,abortSignal:r}){if(r?.aborted)throw c.log({body:"Request aborted",attributes:{operationName:t,reason:r.reason}}),new Tt("Request aborted",{reason:"abort",errorDetails:{operationName:t}});const n=await this.handleGraphQLErrorResponse(t,e);if(!n)return;const{message:a,errorDetails:o}=n;throw new Re(a,{errorDetails:o})}onResultError(t){g.leaveBreadcrumb("GraphQL result error",t,"error")}onResultWarnings(t){g.leaveBreadcrumb("GraphQL result warnings",t,"error")}formatLanguage(t){return t.includes("-")?this.LANGUAGES_WITH_REGION.includes(t)?t.toUpperCase().replace("-","_"):t.split("-")[0].toUpperCase():t.toUpperCase()}parseCartResponse(t){const e=t.lines.edges.map(n=>{const a=n.node,o="parentRelationship"in a&&a.parentRelationship?.parent?.id!==void 0;return{quantity:a.quantity,totalAmount:{amount:a.cost.totalAmount.amount,currencyCode:a.cost.totalAmount.currencyCode},subtotalAmount:{amount:a.cost.subtotalAmount?.amount,currencyCode:a.cost.subtotalAmount?.currencyCode},merchandise:{requiresShipping:a.merchandise.requiresShipping,title:a.merchandise.title,product:{title:a.merchandise.product.title}},discountAllocations:a.discountAllocations,sellingPlanAllocation:a.sellingPlanAllocation,isNestedLine:o}}),r=t.deliveryGroups.edges.map(n=>n.node);return{id:t.id,totalAmount:t.cost.totalAmount,subtotalAmount:t.cost.subtotalAmount??void 0,totalTaxAmount:t.cost.totalTaxAmount??void 0,totalDutyAmount:t.cost.totalDutyAmount??void 0,discountAllocations:t.discountAllocations,discountApplications:t.discountApplications,discountCodes:t.discountCodes,lineItems:e,deliveryGroups:r,checkoutUrl:t.checkoutUrl}}parseGraphQlErrors(t){return t?.graphQLErrors?.map(e=>({code:e.message.replace(/\(Expected.*\)/,"").trim()}))??[]}parseErrorIntoCartError({message:t,code:e,field:r}){let n;if(r&&r.length===1)n=r.at(0);else if(r&&r.length>1){const a=r[r.length-1];n=["billingAddress","deliveryAddress"].includes(a)?a:r.slice(-2).filter(o=>!o.match(/^\d+$/)).join(".")}return{code:e===null?void 0:e,field:n,message:t}}parseMutationErrors({result:t,key:e,operationName:r}){const n=this.parseGraphQlErrors(t.errors),a=t.data?.[e]?.errors?.map(this.parseErrorIntoCartError).filter(i=>i)||[],o=[...n,...a];return o.length>0&&g.leaveBreadcrumb(`GraphQL errors on mutation '${r}'`,o,"error"),o}parseMutationWarnings(t){return!t||t.length===0?[]:t.map(e=>e.code)}stringifyAttributes(t){return t&&t.map(e=>({key:e.key,value:typeof e.value=="string"?e.value:JSON.stringify(e.value)}))}extractUpdateMutationErrors(t){const e=Object.values(t).flatMap(a=>a?.errors??[]);if(this.checkoutState!=="building")return e;const r=[],n=e.filter(a=>zc.some(o=>o.code===a.code)?(r.push(a.code),!1):!0);return r.length>0&&g.leaveBreadcrumb("Filtered errors on update mutation",r,"log"),n}extractPreparedCartMutationErrors(t,e){const r=t?.errors??[];if(t?.result?.__typename==="CartStatusNotReady"){const n=[];r.push(...t.result.errors.filter(a=>Uc[this.checkoutState].some(o=>o.code===a.code)?(n.push(a.code),!1):!0)),n.includes("DELIVERY_WRONG_NUMBER_OF_LINES")&&
43c.deliveryWrongNumberOfLines({instrument:e}),n.length>0&&g.leaveBreadcrumb("Filtered errors on mutation prepareCart",n,"log")}return r}extractMutationErrors(t,{instrumentName:e,operationName:r}){if(!t.data)return[];const{preparedCart:n,__typename:a,...o}=t.data,i=this.extractUpdateMutationErrors(o),s=this.extractPreparedCartMutationErrors(t.data?.preparedCart,e);return s.length>0&&r==="updateCartAttributes"?(c.log({body:"Update cart attributes errors from prepareCart mutation",attributes:{instrumentName:e,errors:JSON.stringify(s)}}),i):[...i,...s]}extractMutationWarnings(t){if(!t.data)return[];const{preparedCart:e,__typename:r,...n}=t.data;return Object.values(n).map(a=>this.parseMutationWarnings(a?.warnings??[])).flat()}parsePreparedCartMutationErrors(t,e,r){const n=this.parseGraphQlErrors(t),a=e.map(this.parseErrorIntoCartError).filter(i=>i),o=[...n,...a];return o.length>0&&g.leaveBreadcrumb(`GraphQL errors on mutation '${r}'`,o,"error"),o}parseCompletionErrors(t){const e=this.parseGraphQlErrors(t.errors);let r=[];t.data?.cartSubmitForCompletion?.result?.__typename==="SubmitFailed"&&(r=t.data.cartSubmitForCompletion.result.errors.map(a=>({code:a.code}))??[]);const n=[...e,...r];return n.length>0?g.leaveBreadcrumb("GraphQL errors on completion",n,"error"):t.errors&&g.leaveBreadcrumb("Errors on submitForCompletion",{errors:t.errors,hasData:!!t.data,hasResult:!!t.data?.cartSubmitForCompletion?.result},"error"),n}};function Vu({emailAddress:t,countryCode:e,phone:r,streetAddress:n,validateAddress:a,preferences:o}){return{email:t,countryCode:fo(e??n?.country),phone:r??n?.phone,deliveryAddressPreferences:n?[{deliveryAddressValidationStrategy:a?"STRICT":"COUNTRY_CODE_ONLY",deliveryAddress:n}]:[],preferences:o}}function _a({instrumentName:t,startingCheckout:e}){const r={};return t&&(r["X-Wallet-Name"]=`${t}`),e&&(r["X-Start-Wallet-Checkout"]=`${e}`),r}async function yo({cartId:t,cartClient:e,instrumentName:r,selectedDeliveryOptions:n,abortSignal:a}){try{if(!t)throw new Error(`[${r}] provided no cart ID when updating shipping method`);
43if(!e)throw new Error(`[${r}] provided invalid cart client when updating shipping method`);return await e.updateSelectedDeliveryOptions(t,n,r,a)}catch(o){throw c.updateFailed({instrument:r,request:"updateSelectedDeliveryOptions",error:o}),o}}async function bo({cartId:t,token:e,cartClient:r,instrumentName:n}){try{if(!t)throw new Error(`[${n}] provided no cart ID when submitting for completion`);if(!r)throw new Error(`[${n}] provided invalid cart client when submitting for completion`);if(!e)throw new Error(`[${n}] provided no token when submitting for completion`);return await r.submitForCompletion(t,e,n)}catch(a){throw c.updateFailed({instrument:n,request:"submitForCompletion",error:a}),a}}function wo({selectedDeliveryOptionHandles:t,deliveryGroups:e,instrumentName:r}){return e.map(n=>{const a=n.deliveryOptions.filter(o=>t.includes(o.handle));if(!a.length)return{deliveryGroupId:"",deliveryOptionHandle:""};if(a.length>1)throw new _o(`[${r}] found multiple delivery options with selectedDeliverOptionHandle in group: ${n.id}`,{groupingHash:"getSelectedDeliveryOptions::MultipleOptions"});return{deliveryGroupId:n.id,deliveryOptionHandle:a[0].handle}}).filter(n=>!!n.deliveryGroupId)}var _o=class extends Z{};_o.prototype.name="GetSelectedDeliveryOptionsError";async function Wu(t){const{cartClient:e,instrumentName:r,abortSignal:n}=t;try{if(!t.cartId)throw new Error(`[${r}] provided no cart ID when updating billing address`);if(!e)throw new Error(`[${r}] provided invalid cart client when updating billing address`);return await e.updateCartBillingAddress(t,n)}catch(a){throw c.updateFailed({instrument:r,request:"updateBillingAddress",error:a}),a}}function Yt({result:t,instrument:e}){const r=t.errors??[];Un(r,Rr)&&c.dynamicTaxFailed({instrument:e})}var Ea=t=>{if(t?.countryCode?.toUpperCase()!=="US")return!1;const e=(t.iso3166AdministrativeArea||t.administrativeArea||"").toUpperCase();return e==="US-CA"||e==="CA"},ju=class{#t=null;#e;#r;#n;constructor(){this.#e=new Promise((t,e)=>{this.#r=t,this.#n=e}),this.#e.catch(()=>{})}async fetch(){if(this.#t)return this.#t;try{return await this.#e,this.#t??void 0}catch{return}}getLatest(){return this.#t}update(t){t!==null&&(this.#t=t,this.#r())}reject(){this.#n()}},Aa=["cart_throttled","not_enough_stock","payment_method_not_applicable","account_info_mismatch","price_increased","nested_line_subscription","nested_line_deferred_payment","digital_physical_mismatch"],qu=class{name=p.ApplePay;accessToken;button;buyerCountry;cartContainer;apiClient;dataSource;i18n;topLevelErrorHandler;merchantName;session;paymentSheetActionGenerator;cancelled;buyerCurrency;customerAccountEmail;abortController=null;isPersonalDataCleared=!1;
43isSheetLoaded=!1;walletParams;constructor({accessToken:t,buyerCountry:e,buyerCurrency:r,button:n,i18n:a,topLevelErrorHandler:o,merchantName:i,dataSource:s,apiClient:l,walletParams:d}){this.accessToken=t,this.buyerCountry=e,this.button=n,this.cartContainer=new ju,this.apiClient=l,this.dataSource=s,this.i18n=a,this.topLevelErrorHandler=o,this.merchantName=i,this.cancelled=!1,this.buyerCurrency=r,this.customerAccountEmail=d.customerAccountEmail,this.walletParams=d;try{this.session=new ApplePaySession(6,Bd({shippingRequired:this.isShippingRequired,walletParams:d,buyerCurrency:r}))}catch(u){throw new to(String(u),{cause:u})}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 Ud(a,o)}begin(){g.leaveBreadcrumb("ApplePay Session begin",{shippingRequired:this.isShippingRequired,buyerCurrency:this.buyerCurrency,walletParams:this.walletParams},"log"),this.abortController=wt("AbortController"),this.session.begin()}onvalidatemerchant=async t=>{try{g.leaveBreadcrumb("ApplePay onvalidatemerchant: Starting merchant validation",{validationURL:t.validationURL},"log");const e=new URL(t.validationURL),r=this.getMerchantSession(e);r.catch(()=>{}),g.leaveBreadcrumb("ApplePay onvalidatemerchant: Calling handleCreateCart",{},"log");const n=await ut({element:this.button,instrumentName:this.name,dataSource:this.dataSource,isShippingRequired:this.isShippingRequired});g.leaveBreadcrumb("ApplePay onvalidatemerchant: handleCreateCart result",{hasCart:!!n.cart,cartId:n.cart?.id??"null"},"log");const a=await this.handleCreateCartResult({createCartResult:n,stage:"onValidateMerchant::createCart"});if(a===void 0){this.cartContainer.reject();return}this.cartContainer.update(a),on({cart_token:Pr(a)});const o=await r;if(g.leaveBreadcrumb("ApplePay Session completeMerchantValidation",{session:o},"log"),this.sessionIsTerminated()){c.sheetClicked({instrument:this.name,result:"rejected",reason:"cancelled"});return}this.withActiveSession("completeMerchantValidation",()=>this.session.completeMerchantValidation(o)),c.sheetClicked({instrument:this.name,result:"success"})}catch(e){this.cartContainer.reject(),c.sheetClicked({instrument:p.ApplePay,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Apple Pay sheet clicked",attributes:{error:String(e),location:"onvalidatemerchant"}}),this.terminateSession({error:e})}};onshippingcontactselected=async t=>{const e=await this.#t();if(e!==void 0)try{const r=se(t.shippingContact,{applyPostalCodePadding:!0}),n=await kt({cartId:e.id,streetAddress:r,cartClient:this.apiClient,instrumentName:this.name,...this.abortController?.signal?{abortSignal:this.abortController.signal}:{}});if(await this.decelerateOrAbort({result:n,stage:"onShippingContactSelected::updateBuyerIdentity"}))return;await this.applyPaymentSheetActions({result:n,onProceed:a=>this.completeShippingContactSelection({fallbackCart:e,updatedCart:n.data,errors:a}),context:{shippingRequired:this.isShippingRequired,shippingCountryCode:r.country,shippingZip:r.zip??void 0,shippingProvince:r.province??void 0,shippingCity:r.city??void 0},checkoutUrl:e.checkoutUrl,requestType:"onShippingContactSelected::updateBuyerIdentity",afterAuthorization:!1})}catch(r){this.terminateSession({error:r})}};onshippingmethodselected=async t=>{const e=await this.#t();if(e!==void 0){g.leaveBreadcrumb("ApplePay onshippingmethodselected: START",{cartId:e.id,shippingMethodId:t.shippingMethod.identifier},"log");try{const r=t.shippingMethod.identifier.split(","),n=wo({selectedDeliveryOptionHandles:r,deliveryGroups:e.deliveryGroups,instrumentName:this.name});if(n.length===0){this.handleShippingMethodNotFoundInCart(r,e);return}const a=await yo({cartId:e.id,cartClient:this.apiClient,instrumentName:this.name,selectedDeliveryOptions:n,abortSignal:this.abortController?.signal});if(await this.decelerateOrAbort({result:a,stage:"onShippingMethodSelected::updateSelectedDeliveryOptions"}))return;await this.applyPaymentSheetActions({result:a,onProceed:()=>this.completeShippingMethodSelection(a.data),context:{shippingRequired:this.isShippingRequired,shippingCountryCode:void 0},checkoutUrl:e.checkoutUrl,requestType:"onShippingMethodSelected::updateSelectedDeliveryOptions",afterAuthorization:!1}),this.onSheetLoaded()}catch(r){this.terminateSession({error:r})}}};onpaymentmethodselected=async t=>{let e=await this.#t();if(e!==void 0){g.leaveBreadcrumb("ApplePay onpaymentmethodselected: START",{cartId:e.id},"log");try{const{billingContact:r}=t.paymentMethod;if(!this.isShippingRequired&&r){const i=se(r,{applyPostalCodePadding:!1}),s=await kt({cartId:e.id,countryCode:i.country,cartClient:this.apiClient,instrumentName:this.name,abortSignal:this.abortController?.signal});if(await this.decelerateOrAbort({result:s,stage:"onPaymentMethodSelected::updateBuyerIdentity"}))return;await this.applyPaymentSheetActions({result:s,onProceed:()=>{this.cartContainer.update(s.data)},context:{shippingRequired:this.isShippingRequired,shippingCountryCode:i.country,shippingZip:i.zip??void 0,shippingProvince:i.province??void 0,shippingCity:i.city??void 0},checkoutUrl:e.checkoutUrl,requestType:"onPaymentMethodSelected::updateBuyerIdentity",afterAuthorization:!1});const l=await this.#t();if(l===void 0)return;e=l;const d=await Wu({billingAddress:i,cartId:e.id,cartClient:this.apiClient,instrumentName:this.name,abortSignal:this.abortController?.signal});if(await this.decelerateOrAbort({result:d,stage:"onPaymentMethodSelected::updateBillingAddress"}))return;await this.applyPaymentSheetActions({result:d,onProceed:()=>{this.cartContainer.update(d.data)},context:{shippingRequired:this.isShippingRequired,shippingCountryCode:i.country,billingCountryCode:i.country,billingZip:i.zip??void 0,billingProvince:i.province??void 0,billingCity:i.city??void 0},checkoutUrl:e.checkoutUrl,requestType:"onPaymentMethodSelected::updateBillingAddress",afterAuthorization:!1})}const n=await this.#t();if(n===void 0)return;e=n;const{newTotal:a,newLineItems:o}=this.getNewTotalAndLineItems(e);if(g.leaveBreadcrumb("ApplePay Session completePaymentMethodSelection",{newTotal:a,newLineItems:o},"log"),this.sessionIsTerminated())return;this.withActiveSession("completePaymentMethodSelection",()=>this.session.completePaymentMethodSelection({newTotal:a,newLineItems:o})),this.isShippingRequired||this.onSheetLoaded()}catch(r){this.terminateSession({error:r})}}};oncancel=()=>{this.cancelled=!0,this.cartContainer.reject(),this.removePersonalData(),Y(O.SheetLoad,this.name),c.sheetCancelled(this.name),this.button.disabled=!1,this.abortController?.abort("[Apple Pay] Payment sheet cancelled")};onpaymentauthorized=async t=>{const e=await this.#t();if(e===void 0)return;g.leaveBreadcrumb("ApplePay onpaymentauthorized: START",{cartId:e.id,hasToken:!!t.payment.token},"log"),c.authorizationAttempt(this.name),Ot(O.AuthorizationLatency,this.name);const r=async _=>{switch(_.effects?.forEach(P=>P()),_.action){case"complete":{const P=ApplePaySession.STATUS_SUCCESS;try{await this.completePayment(P),rt(_.redirectUrl)}catch(k){this.terminateSession({error:k,afterAuthorization:!0})}break}case"show_error":{const P=_.errors??[];try{await this.completePayment(ApplePaySession.STATUS_FAILURE,P)}catch(k){this.terminateSession({error:k,afterAuthorization:!0})}break}case"abort":this.terminateSession({afterAuthorization:!0});break;case"decelerate":try{await this.completePayment(ApplePaySession.STATUS_FAILURE),qt({event:z.RecoveryFlowInitiated,checkoutToken:Qt(e.id),instrumentId:this.name}),N({checkoutUrl:_.redirectUrl,instrumentName:this.name,reason:_.reason,stage:"onPaymentAuthorized::submitForCompletion"})}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}break;default:this.terminateSession({error:new Error(`[${this.name}] completion action not handled: ${_.action}`),afterAuthorization:!0})}},{token:n,billingContact:a,shippingContact:o}=t.payment;let i=null,s=null;try{if(!a){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}if(i=se({...a,phoneNumber:o?.phoneNumber},{applyPostalCodePadding:!1}),this.isShippingRequired){if(!o){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}s=se(o,{applyPostalCodePadding:!0})}}catch(_){this.terminateSession({error:_,afterAuthorization:!0});return}const l=s?.zip??void 0,d=s?.province??void 0,u=s?.city??void 0,h=i?.zip??void 0,m=i?.province??void 0,y=i?.city??void 0,b=async()=>{let _=await this.#t();if(_!==void 0)try{const P=this.isShippingRequired?{validateAddress:!0,streetAddress:s}:{},k=this.customerAccountEmail??o?.emailAddress,L=await kt({cartId:_.id,emailAddress:k,cartClient:this.apiClient,instrumentName:this.name,...P});Yt({result:L,instrument:this.name});const x=Hn({currentCart:L.data,previousCart:_});if(L.data&&x!=="inc"&&(this.cartContainer.update(L.data),_=L.data),x==="inc"&&(L.decelerationReason||="price_increased"),await this.decelerateOrAbort({result:L,stage:"onPaymentAuthorized::updateBuyerIdentity"}))return;const B=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:L,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:s?.country,shippingZip:l,shippingProvince:d,shippingCity:u,billingCountryCode:i?.country,billingZip:h,billingProvince:m,billingCity:y},checkoutUrl:_.checkoutUrl,requestType:"onPaymentAuthorized::updateBuyerIdentity"});B.effects?.forEach(M=>M()),await this.handlePaymentSheetAction({paymentSheetAction:B,onProceed:async M=>{M&&M.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,M):await A()},afterAuthorization:!0,stage:"onPaymentAuthorized::updateBuyerIdentity"})}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}},A=async()=>{const _=await this.#t();if(_!==void 0)try{const P=_.lineItems.some(x=>!!x.sellingPlanAllocation),k=await Ur({cartId:_.id,totalAmount:_.totalAmount,paymentMethod:{walletPaymentMethod:{applePayWalletContent:{billingAddress:i,data:n.paymentData.data,header:n.paymentData.header,lastDigits:n.paymentMethod.displayName.split(" ")[1],signature:n.paymentData.signature,version:n.paymentData.version}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:i,cartClient:this.apiClient,instrumentName:this.name,hasSellingPlan:P,abortSignal:this.abortController?.signal});if(Yt({result:k,instrument:this.name}),await this.decelerateOrAbort({result:k,stage:"onPaymentAuthorized::updatePayment"}))return;const L=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:k,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:s?.country,shippingZip:l,shippingProvince:d,shippingCity:u,billingCountryCode:i?.country,billingZip:h,billingProvince:m,billingCity:y},checkoutUrl:_.checkoutUrl,requestType:"onPaymentAuthorized::updatePayment"});L.effects?.forEach(x=>x()),await this.handlePaymentSheetAction({paymentSheetAction:L,onProceed:async x=>{x&&x.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,x):await T()},afterAuthorization:!0,stage:"onPaymentAuthorized::updatePayment"})}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}},T=async()=>{const _=await this.#t();if(_!==void 0)try{const P=Q.enabled(dl);if(this.button.hasSellingPlan&&(Ea(o)||Ea(a))&&P){await this.completePayment(ApplePaySession.STATUS_SUCCESS),qt({event:z.RecoveryFlowInitiated,checkoutToken:Qt(_.id),instrumentId:this.name}),N({checkoutUrl:_.checkoutUrl??"",instrumentName:this.name,reason:"subscription_review_required",stage:"onPaymentAuthorized::submitForCompletion",forceLegacySplitShippingMode:!0});return}const k=await bo({cartId:_.id,token:n.transactionIdentifier,cartClient:this.apiClient,instrumentName:this.name});Yt({result:k,instrument:this.name}),k.errors?.some(x=>x.code==="ERROR")&&(g.leaveBreadcrumb("ApplePay Generic ERROR encountered during completion",{errorCodes:k.errors},"error"),c.log({body:"[ApplePay] Generic ERROR code encountered during completion",attributes:{errorCodes:k.errors}}));const L=this.paymentSheetActionGenerator.mapCompletionResultToPaymentSheetAction({result:k,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:s?.country,shippingZip:l,shippingProvince:d,shippingCity:u,billingCountryCode:i?.country,billingZip:h,billingProvince:m,billingCity:y},checkoutUrl:k.data&&"checkoutUrl"in k.data&&k.data.checkoutUrl?k.data.checkoutUrl:_.checkoutUrl});await r(L)}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}};await b()};terminateSession=async({error:t,afterAuthorization:e=!1,reason:r}={})=>
43{if(this.button.disabled=!1,!(this.cancelled&&!e))try{t&&g.notify(t),e?c.authorizationComplete({instrument:this.name,measurement:Y(O.AuthorizationLatency,this.name),result:"failed"}):(Y(O.SheetLoad,this.name),c.sheetFailed(this.name,t,r)),g.leaveBreadcrumb("ApplePay Session abort",{afterAuthorization:e},"log");try{this.withActiveSession("abort",()=>this.session.abort()),this.abortController?.abort("[Apple Pay] Payment sheet terminated")}catch{}if(t){const n=this.i18n.translate("brand.apple_pay");U({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:this.name,brand:n})}}finally{await this.removePersonalData()}};handleShippingMethodNotFoundInCart(t,e){const r=fa(e.deliveryGroups,this.i18n);g.leaveBreadcrumb("ApplePay Session selected shipping method(s) not found in current cart, updating payment sheet",{attemptedDeliveryOptionHandles:t,currentShippingMethods:r},"log"),this.completeShippingMethodSelection(e)}async applyPaymentSheetActions({result:t,onProceed:e,context:r,checkoutUrl:n,requestType:a,afterAuthorization:o}){const i=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:t,context:r,checkoutUrl:n,requestType:a});i.effects?.forEach(s=>s()),!this.sessionIsTerminated()&&await this.handlePaymentSheetAction({paymentSheetAction:i,onProceed:e,afterAuthorization:o,stage:a})}getMostRecentNonNullCart=(t,e)=>t?(this.cartContainer.update(t),t):e;handleNullCart=t=>{if(!t)throw new Error(`[${this.name}] no cart returned on mutation, aborting`);return t};completeShippingContactSelection=({fallbackCart:t,updatedCart:e,errors:r})=>{try{const n=this.getMostRecentNonNullCart(e,t),{newTotal:a,newLineItems:o}=this.getNewTotalAndLineItems(n),i=fa(n.deliveryGroups,this.i18n);g.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{errors:r,newTotal:a,newLineItems:o,newShippingMethods:i},"log"),this.withActiveSession("completeShippingContactSelection",()=>this.session.completeShippingContactSelection({errors:r??[],newTotal:a,newLineItems:o,newShippingMethods:i}))}catch(n){this.terminateSession({error:n})}};completeShippingMethodSelection=t=>{try{const e=this.handleNullCart(t);this.cartContainer.update(e);const{newTotal:r,newLineItems:n}=this.getNewTotalAndLineItems(e);g.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{newTotal:r,newLineItems:n},"log"),this.withActiveSession("completeShippingMethodSelection",()=>this.session.completeShippingMethodSelection({newTotal:r,newLineItems:n}))}catch(e){this.terminateSession({error:e})}};sessionIsTerminated=()=>this.cancelled||this.abortController?.signal.aborted===!0;#t=async()=>{if(this.sessionIsTerminated())return;const t=await this.cartContainer.fetch();if(!this.sessionIsTerminated())return t};async getMerchantSession(t){const e=await new Be({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,apiVersion:"unstable"}).applePaySessionCreate(t);return JSON.parse(e)}abortPaymentSheetAndShowOutOfStockModal({stage:t}){this.terminateSession({afterAuthorization:t.includes("onPaymentAuthorized"),reason:"out_of_stock"}),lt({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:this.name})}emitPaymentCompleteTelemetry(t){c.authorizationComplete({instrument:this.name,measurement:Y(O.AuthorizationLatency,this.name),result:t===ApplePaySession.STATUS_SUCCESS?"success":"failed"})}async completePayment(t,e=void 0){g.leaveBreadcrumb("ApplePay Session completePayment",{status:t,errors:e},"log");let r=!1;this.withActiveSession("completePayment",()=>{this.session.completePayment({status:t,errors:e}),r=!0}),this.emitPaymentCompleteTelemetry(t),!r&&t===ApplePaySession.STATUS_SUCCESS&&c.paymentCompletedAfterAbort({instrument:this.name,error:"Session already terminated"})}getNewTotalAndLineItems(t){return{newTotal:Md(this.merchantName,t.totalAmount),newLineItems:zd({subtotal:eo(t),discountApplications:Q.enabled(vn)?Hd(t):Gd(t),deliveryGroups:t.deliveryGroups,duties:t.totalDutyAmount,taxes:t.totalTaxAmount,i18n:this.i18n,formattedRecurringTotals:$d(t.lineItems,this.i18n),lineItems:t.lineItems})}}async decelerateOrAbort({result:t,stage:e}){return t.abortReason==="out_of_stock"?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),this.abortPaymentSheetAndShowOutOfStockModal({stage:e}),!0):this.decelerateIfNeeded({result:t,stage:e})}async decelerateIfNeeded({result:t,stage:e}){if(!t.data)return!1;const{checkoutUrl:r,totalAmount:n}=t.data;let a;if(t.decelerationReason&&Aa.includes(t.decelerationReason)?a=t.decelerationReason:Lr({currentCartTotal:n,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"});try{await this.terminateSession({reason:a})}finally{N({checkoutUrl:r,instrumentName:this.name,reason:a,stage:e})}return!0}return!1}get isShippingRequired(){return this.button.isShippingRequired}async handleCreateCartResult({createCartResult:t,stage:e}){const{cart:r,unrecoverableError:n,customValidationError:a,decelerationReason:o}=t;if(n){g.leaveBreadcrumb("ApplePay Session unrecoverable error",{unrecoverableError:n},"error"),c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),this.withActiveSession("abort",()=>this.session.abort()),this.abortController?.abort(`[Apple Pay] Unrecoverable error ${n}`),Et({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:this.name,unrecoverableError:n});return}if(a){g.leaveBreadcrumb("ApplePay Session custom validation error",{customValidationError:a},"error"),c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),this.withActiveSession("abort",()=>this.session.abort()),this.abortController?.abort("[Apple Pay] Custom validation error"),nt({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:this.name,message:a.message});return}if(o&&Aa.includes(o)){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),this.cartContainer.update(r);try{await this.terminateSession({reason:o})}finally{N({checkoutUrl:r?.checkoutUrl??"",instrumentName:this.name,reason:o,stage:e})}return}return this.handleNullCart(r)}async removePersonalData(){const t=this.cartContainer.getLatest();this.isPersonalDataCleared||!t||(this.abortController?.signal.aborted===!1&&this.abortController.abort("[Apple Pay] Payment session cleared for other reason"),await this.apiClient.cartRemovePersonalData({cartId:t.id,instrumentName:this.name}),this.isPersonalDataCleared=!0)}
43onSheetLoaded(){if(this.isSheetLoaded)return;this.isSheetLoaded=!0;const t=Y(O.SheetLoad,this.name);t&&(qt({event:z.SheetLoaded,ttl:t}),c.sheetLoaded({instrument:this.name,measurement:t}))}withActiveSession(t,e){if(this.abortController?.signal?.aborted){c.walletSessionAbortError({instrument:this.name,errorName:"SessionAlreadyTerminated",methodName:t});return}try{return e()}catch(r){if(r instanceof Error&&r.name==="InvalidAccessError"){c.walletSessionAbortError({instrument:this.name,errorName:"InvalidAccessError",methodName:t});return}throw r}}async handlePaymentSheetAction({paymentSheetAction:t,onProceed:e,afterAuthorization:r,stage:n}){switch(t.action){case"abort":this.terminateSession({afterAuthorization:r});break;case"show_error":await e(t.errors);break;case"update":await e(t.errors);break;case"decelerate":try{await this.terminateSession({afterAuthorization:r})}finally{N({instrumentName:this.name,checkoutUrl:t.redirectUrl,reason:t.reason,stage:n})}break;default:throw new Error(`Missing handler for payment sheet action "${t.action}"`)}}};function Br({translate:t,logoElement:e,setAriaHidden:r}){const n=document.createElement("div");return t("buy_with_button_content",{wallet:"LOGO_PLACEHOLDER"}).split(new RegExp("(LOGO_PLACEHOLDER)")).filter(Boolean).forEach(a=>{let o;a==="LOGO_PLACEHOLDER"?o=e:(o=document.createElement("span"),o.innerText=a,r&&o.setAttribute("aria-hidden","true")),n.appendChild(o)}),n}var Te=new Map;function Yu({instrumentName:t,logoType:e="LIGHT",logoContent:r}){const n=Te.get(t)||{};n[e]||(n[e]=r,Te.set(t,n))}function Jt({instrumentName:t,logoType:e="LIGHT"}){const r=Te.get(t)?.[e];if(!r)throw new Error(`${t} ${e} logo not loaded`);return r}var Ku=class extends ht{name=p.ApplePay;button=null;static get observedAttributes(){return["disabled"]}get merchantName(){return this.walletParams.merchantName}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button)}async handleClick(t){if(t.preventDefault(),this.disabled||!this.button||this.button.hasAttribute("aria-disabled"))return;this.disabled=!0,dt(this.name,this.pageType);const[e,r,n,a]=await Promise.all([this.i18n,this.dataSource,this.apiClient,this.topLevelErrorHandler]);Ot(O.SheetLoad,this.name);let o;try{if(o=new qu({accessToken:this.accessToken,buyerCountry:this.buyerCountry,buyerCurrency:this.buyerCurrency,button:this,i18n:e,topLevelErrorHandler:a,merchantName:this.merchantName,dataSource:r,apiClient:n,walletParams:this.walletParams}),!o)throw new Error("missing ApplePaySession");o.begin()}catch(i){g.leaveBreadcrumb("Failed to create ApplePay Session",{error:i},"error"),o||(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Apple Pay session creation",attributes:{error:String(i),location:"handleClick"}})),o?.terminateSession(),U({i18n:e,topLevelErrorHandler:a,wallet:this.name,brand:e.translate("brand.apple_pay")}),this.disabled=!1}}async render(){const t=this.getOrCreateShadowRoot(),{translate:e}=await this.i18n,r=Jt({instrumentName:p.ApplePay}),n=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(!this.button){const a=this.isCTA?e("buy_with_button_content",{wallet:e("brand.apple_pay")}):e("brand.apple_pay");if(this.button=ze({label:a}),this.button.onclick=o=>this.handleClick(o),this.button.classList.add("apple-pay-button",Xo[this.buttonTheme],_t.BUTTON),this.isCTA){const o=Br({translate:e,logoElement:n,setAriaHidden:!0});o.classList.add("apple-pay--content"),this.button.appendChild(o)}else this.button.appendChild(n);this.initializeShadowStyles(t,Cd),t.appendChild(this.button),this.ensureLightDOMIsNotEmpty(),this.onRendered?.()}this.disabled&&(this.button.setAttribute("disabled",""),this.button.setAttribute("aria-disabled","true"))}};function Hr(t){return function(e,r,n){const a=n.value;return n.value=function(...o){const i=a.apply(this,o);return i.eligible||console.debug(`[DEBUG] ${t} could not be rendered. Reason: ${i.reason}`),i},n}}async function Nt({svg:t,instrumentName:e,logoType:r="LIGHT"}){if(Te.get(e)?.[r])return;let n,a,o;try{if(o=Qu(t),n=await fetch(o,{headers:{Accept:"image/svg+xml"}}),!n.ok)throw new Error(`Failed to fetch SVG: ${n.status} ${n.statusText}`);if(a=await n.text(),!a||!a.includes("<svg"))throw new Error("Invalid SVG content received");Yu({instrumentName:e,logoType:r,logoContent:a})}catch(i){const s=i instanceof Error?i.message:String(i);throw g.leaveBreadcrumb("SVG fetch failed",{error:s,responseStatus:n?.status,responseHeaders:n?.headers,responseBody:a?.slice(0,100),assetUrl:o}),new q("SVG fetch failed",{cause:s})}}function Qu(t){const e=new URL(import.meta.url);return new URL(`assets/${t}`,e).href}function Gr(t,e,r,n){var a=arguments.length,o=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(o=(a<3?i(o):a>3?i(e,r,o):i(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o}var $r=class Ct extends pt{static applePaySDKPromise;static walletName(){return"apple_pay"}companyFieldRequired;constructor(e){super(e),this.companyFieldRequired=!!this.walletParams.companyRequired}getWebComponentName(){return"shopify-apple-pay-button"}getWebComponentClass(){return Ku}getInstrumentName(){return p.ApplePay}getLoadEligibility(){return this.isInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){if(typeof window>"u"||window.ApplePaySession===void 0)return{eligible:!1,reason:"window or ApplePaySession is undefined"};try{if(!window.ApplePaySession.supportsVersion?.(6))return{eligible:!1,reason:"SDK does not meet minimum version requirement"};if(!window.ApplePaySession.canMakePayments?.())return{eligible:!1,reason:"failed SDK eligibility check"}}catch{return{eligible:!1,reason:"error in SDK eligibility checks"}}return{eligible:!0}}async loadWalletSDK(){await Promise.all([this.loadAppleLogo(),this.loadApplePaySDK()])}loadApplePaySDK(){if(typeof window>"u"||window.ApplePaySession!==void 0||!Q.enabled(Cn))return Promise.resolve();if(Ct.applePaySDKPromise)return Ct.applePaySDKPromise;const e=document.createElement("script");return e.setAttribute("src",Jo),Ct.applePaySDKPromise=new Promise((r,n)=>{e.onload=()=>r(),e.onerror=a=>{Ct.applePaySDKPromise=void 0,e.remove(),n(Fe("Apple Pay",a))},document.body.appendChild(e)}),Ct.applePaySDKPromise}async loadAppleLogo(){await Nt({svg:"apple-pay-logo.svg",instrumentName:p.ApplePay}
43)}};Gr([Hr("Apple Pay")],$r.prototype,"getLoadEligibility",null),Gr([Hr("Apple Pay")],$r.prototype,"getPartnerSDKEligibility",null);var Xu=".buy-with-prime-button{opacity:1;border-width:0;justify-content:center;align-items:center;gap:5px;width:100%;height:100%;padding:12px 10px 8px;display:flex}.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{box-shadow:none!important;background-color:#0066cd!important}.buy-with-prime-button>svg{min-width:85px}",Zt=class extends Error{};Zt.prototype.name="MissingAccessTokenError";var He=class extends Error{};He.prototype.name="FetchingWalletsPlatformConfigError";var Ge=class extends Error{};Ge.prototype.name="EmptyLineItemsWalletsPlatformConfigError";var Ju="2025-01-01";async function Eo({configOptionsEndpoint:t,checkoutUrl:e,sourceId:r,accessToken:n,instrument:a}){try{const o=JSON.stringify({checkout_url:e,checkout_cancel_url:window.location.href,cart_id:r}),i=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":n,"X-Shopify-Checkout-Version":Ju},body:o});if(i.ok)return i.json();const s=await i.json();throw s.error?new Error(s.error):new Error(`Could not fetch wallets platform configs: [${i.status}] ${i.statusText}`)}catch(o){const i=Zu(o);throw i==="empty_line_items"?new Ge(`[Fetch Pay Config][${a}] No eligible line items provided in the config request.`):(c.walletsPlatformConfigRequestFailure({endpoint:t,instrument:a,error:i,sourceId:r}),new He(`[Fetch Pay Config][${a}] ${i}`,{cause:o}))}}function Zu(t){if(t instanceof Error)return t.message;try{if(t instanceof Object)return JSON.stringify(t)}catch(e){g.leaveBreadcrumb("Could not safely extract Wallets Platform error message due to JSON stringify error",{stringifyError:String(e)},"error")}return String(t)}var th={[S.Checkout]:"Checkout",[S.CartAjax]:"Cart",[S.CartPage]:"Cart",[S.ProductPage]:"Product",[S.Unknown]:"Product"},eh=class hr extends ht{static OPTIMUS_CONFIG_REST_API_URL=`${window.location.origin}/wallets/config/optimus`;static EXPECTED_ERRORS=[He,Zt,Ge];name=p.BuyWithPrime;button=null;apiClientId="";connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name),this.handleOnSendCheckoutAction=this.handleOnSendCheckoutAction.bind(this)}async createButton(){const{translate:e}=await this.i18n,r=ze({label:e("brand.buy_with_prime")});return r.type="button",r.className="buy-with-prime-button",this.applyEnabledStyles(r),r}applyEnabledStyles(e){e.innerHTML=Jt({instrumentName:p.BuyWithPrime}),e.disabled=!1,Wt(e,{"background-color":"#1A98FF",color:"#FFFFFF",cursor:"pointer"})}applyDisabledStyles(e){e.innerHTML=Jt({instrumentName:p.BuyWithPrime,logoType:"DARK"}),e.disabled=!0,Wt(e,{"background-color":"#C0E3FF",color:"#7292AC",cursor:"not-allowed"})}async handleClick(){if(!this.button)return;dt(this.name,this.pageType);const[e,r,n]=await Promise.all([this.i18n,this.dataSource,this.topLevelErrorHandler]);let a;try{this.applyDisabledStyles(this.button);let o=this.walletParams;if(this.apiClientId=this.apiClientId||o.appId||"",a=this.apiClientId?{apiClientId:this.apiClientId,pageType:this.pageType}:void 0,!o.createCheckoutSessionConfig){const{cart:l,decelerationReason:d,customValidationError:u,unrecoverableError:h}=await ut({element:this,instrumentName:this.name,dataSource:r});if(h){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error",webPixelMetaData:a}),Et({i18n:e,topLevelErrorHandler:n,wallet:this.name,unrecoverableError:h});return}if(u){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error",webPixelMetaData:a}),nt({i18n:e,topLevelErrorHandler:n,wallet:this.name,message:u.message});return}if(d){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration",webPixelMetaData:a}),N({checkoutUrl:l?.checkoutUrl??"",instrumentName:this.name,reason:d});return}if(!this.accessToken)throw new Zt("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");o={...await Eo({configOptionsEndpoint:hr.OPTIMUS_CONFIG_REST_API_URL,checkoutUrl:l?.checkoutUrl??"",sourceId:Pr(l)??"",accessToken:this.accessToken,instrument:this.name})}}o.placement=this.getPlacement();const i=this.extractSKUs(o);a&&i&&(a.skus=i),delete o.checkoutSupportsSplitCart,delete o.appId;const s=o;this.pciEnabled&&(s.onSendCheckoutAction=this.handleOnSendCheckoutAction),window.amazon.buywithprime.initCheckout({amazonPayOptions:s}),c.sheetClicked({instrument:this.name,result:"success",webPixelMetaData:a})}catch(o){a&&(a.skus=a.skus||[]),hr.EXPECTED_ERRORS.some(l=>o instanceof l)?c.sheetClicked({instrument:this.name,result:"rejected",reason:"expected_error",webPixelMetaData:a}):(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error",webPixelMetaData:a}),c.log({body:"Unhandled error detected in Buy with Prime sheet clicked",attributes:{error:String(o),location:"handleClick"}}),g.notify(o));const i=o instanceof Error?o.name:"unknown",s=e.translate("brand.buy_with_prime");i==="EmptyLineItemsWalletsPlatformConfigError"?cc({i18n:e,topLevelErrorHandler:n,wallet:this.name,brand:s}):U({i18n:e,topLevelErrorHandler:n,wallet:this.name,brand:s})}finally{this.applyEnabledStyles(this.button)}}extractSKUs(e){return e.createCheckoutSessionConfig?.payloadJSON?JSON.parse(e.createCheckoutSessionConfig.payloadJSON).cartDetails.lineItems.map(r=>r&&r.sku).filter(r=>r):[]}getPlacement(){return this.pageType&&th[this.pageType]||"Other"}async render(){const e=this.getOrCreateShadowRoot();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(_t.BUTTON),await this.initializeShadowStyles(e,Xu),e.appendChild(this.button),this.onRendered?.())}buildBwpEventData(e){const r={};return e.createCheckoutSessionConfig&&(r.skus=this.extractSKUs(e),r.apiClientId=this.apiClientId),r}async handleOnSendCheckoutAction(e){const{eventName:r,redirect:n,redirectUrl:a,requestPayload:o}=e;if(n&&a){this.dispatchWalletEvent({eventName:"wallet-redirect",detail:{redirectUrl:a,requestPayload:o}});return}switch(r){case"initCheckout":{const i=this.walletParams;
43this.dispatchWalletEvent({eventName:"wallet-clicked",detail:{bwpEventData:this.buildBwpEventData(i)}});break}case"initChange":this.dispatchWalletEvent({eventName:"wallet-clicked"});break;case"cancelCheckout":this.dispatchWalletEvent({eventName:"wallet-cancel"})}}};async function Ao({fn:t,maxRetries:e=3,delay:r=1e3,retryPolicyFn:n=()=>!0,onFinishedFn:a=()=>{}}){const o=()=>new Promise(l=>{setTimeout(l,r)});let i=0;const s=async()=>{try{return await t()}catch(l){if(i++,i<e&&n(l))return await o(),s();throw l}};try{return await s()}finally{a(i)}}async function rh(t){return new Promise((e,r)=>{if(document.querySelector(`script[src="${t}"]`)&&window.amazon){e();return}const n=document.createElement("script");n.src=t,n.onload=()=>{window.amazon?e():r(new Error("Amazon SDK not present after loading"))},n.onerror=a=>{r(Fe("Amazon",a))},document.head.append(n)})}async function vo({sdkUrl:t=_r,maxRetries:e=3}){return Ao({fn:()=>rh(t),maxRetries:e,delay:200,retryPolicyFn:()=>!0,onFinishedFn:r=>{c.amazonPaySDKLoadRetries({retries:r})}})}var ah=class pr extends pt{static MAX_RETRIES=3;static SDK_URL=_r;static walletName(){return"buy_with_prime"}constructor(e){super(e)}getWebComponentName(){return"shopify-buy-with-prime-button"}getInstrumentName(){return p.BuyWithPrime}getWebComponentClass(){return eh}async loadWalletSDK(){await vo({sdkUrl:pr.SDK_URL,maxRetries:pr.MAX_RETRIES}),await this.loadLogos()}async loadLogos(){await Promise.all([this.loadPrimeLogo(),this.loadPrimeLogoDark()])}async loadPrimeLogo(){await Nt({svg:"prime-logo.svg",instrumentName:p.BuyWithPrime})}async loadPrimeLogoDark(){await Nt({svg:"prime-logo-dark.svg",instrumentName:p.BuyWithPrime,logoType:"DARK"})}},nh="shopify-amazon-pay-button div[role=button][slot=amazon-pay-slot][data-testid=amazon-pay-button]{border-radius:0!important;width:100%!important}",oh=":host([page-type=cart_page]) .accelerated-checkout-button{justify-content:center;display:flex;overflow:hidden}",va="amazon-pay-slot",ih=class mr extends ht{static CV2_CONFIG_REST_API_URL=`${window.location.origin}/wallets/config/amazon_pay`;static EXPECTED_ERRORS=[He,Zt,Ge];name=p.AmazonPay;resizeObserver=null;#t=0;#e=0;#r=!1;#n=null;#a=null;#o=null;sdkButton=null;connectedCallback(){this.resizeObserver=wt("ResizeObserver",()=>this.onResize()),this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){super.disconnectedCallback(),this.innerHTML="",this.clearShadowRoot(),this.teardownAmazonButtonContainer(),this.resizeObserver?.disconnect()}async handleClick(e){dt(this.name,this.pageType);const[r,n,a]=await Promise.all([this.i18n,this.dataSource,this.topLevelErrorHandler]);try{const{cart:o,decelerationReason:i,customValidationError:s,unrecoverableError:l}=await ut({element:this,instrumentName:this.name,dataSource:n});if(l){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),Et({i18n:r,topLevelErrorHandler:a,wallet:this.name,unrecoverableError:l});return}if(s){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),nt({i18n:r,topLevelErrorHandler:a,wallet:this.name,message:s.message});return}if(i){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:o?.checkoutUrl??"",instrumentName:this.name,reason:i});return}const{totalAmount:{amount:d},checkoutUrl:u}=o;let h=this.walletParams;if(!h.createCheckoutSessionConfig){if(!this.accessToken)throw new Zt("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");h={...await Eo({configOptionsEndpoint:mr.CV2_CONFIG_REST_API_URL,checkoutUrl:u,sourceId:Pr(o)??"",accessToken:this.accessToken,instrument:this.name}),placement:this.pageType===S.ProductPage?"Product":"Cart"}}delete h.appId,e.initCheckout({...h,...Number(d)!==0&&{estimatedOrderAmount:{amount:d,currencyCode:this.buyerCurrency}}}),c.sheetClicked({instrument:this.name,result:"success"})}catch(o){mr.EXPECTED_ERRORS.some(s=>o instanceof s)?c.sheetClicked({instrument:this.name,result:"rejected",reason:"expected_error"}):(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Amazon Pay sheet clicked",attributes:{error:String(o),location:"handleClick"}}),g.notify(o));const i=r.translate("brand.amazon_pay");U({i18n:r,topLevelErrorHandler:a,wallet:this.name,brand:i})}}createContainer({containerID:e,height:r}){const n=document.createElement("div");return n.id=e,n.style.display="flex",n.style.minWidth="140px",r!=null&&(n.style.height=`${r}px`),n.slot=va,n.setAttribute("data-testid","amazon-pay-button"),n}async onResize(){const e=Ie(this.#n)||0,r=lr(this.#n)||0,n=this.#t!==e||this.#e!==r;!this.#r&&n&&(this.teardownAmazonButtonContainer(),await this.cleanupOnFailure(()=>this.renderFromAmazonSDK(),this.name))}async render(){const e=this.getOrCreateShadowRoot();try{const r=document.createElement("slot");r.name=va;const n=document.createElement("style");n.textContent=nh,this.appendChild(n),await this.initializeShadowStyles(e,oh);const a=await this.containerInstanceNumber;this.#a=`AcceleratedCheckoutAmazonPayButtonContainer${this.pageType}${a}`,this.#n=document.createElement("div"),this.#n.classList.add(_t.BUTTON),this.#n.appendChild(r),e.a
43ppendChild(this.#n),this.resizeObserver?.observe(this.#n),await this.renderFromAmazonSDK()}catch(r){g.notify(r)}}async renderFromAmazonSDK(){this.#r=!0;const e=lr(this.#n)||0;this.#o=this.createContainer({containerID:this.#a,height:e}),this.appendChild(this.#o);const r=Ie(this.#n)||0,n={buttonBorderRadius:`${r}px`};let a=!1;try{if(this.sdkButton=window.amazon.Pay.renderButton(`#${this.#a}`,{...this.walletParams,style:n,placement:this.pageType===S.ProductPage?"Product":"Cart"}),this.sdkButton){const o=this.sdkButton;this.sdkButton.onClick(()=>this.handleClick(o))}else c.log({body:"Amazon Pay Button rendered null SDK button",attributes:{pageType:this.pageType,containerID:this.#a}});this.#e=e,this.#t=r,c.renderSucceeded(this.name),a=!0}catch(o){c.renderFailed(this.name);const i=`Amazon Pay Button not able to render into container #${this.#a}.`;console.error(i),c.log({body:i,attributes:{pageType:this.pageType,containerID:this.#a,error:o?.toString()}})}finally{this.#r=!1}a&&this.sdkButton?this.onRendered?.():this.onRenderFailed?.()}teardownAmazonButtonContainer(){this.#o?.remove(),this.#o=null}},sh=class gr extends pt{static MAX_RETRIES=3;static SDK_URL=_r;static walletName(){return"amazon_pay"}constructor(e){super(e)}getWebComponentName(){return"shopify-amazon-pay-button"}getInstrumentName(){return p.AmazonPay}getWebComponentClass(){return ih}async loadWalletSDK(){await vo({sdkUrl:gr.SDK_URL,maxRetries:gr.MAX_RETRIES})}getLoadEligibility(e){return e.getRootNode()instanceof ShadowRoot?{eligible:!1,reason:"Cannot load Amazon Pay within Shadow DOM"}:{eligible:!0}}},Ze={Purple:{D80:"#1B163B",D60:"#322C7D",D50:"#4524DB",P40:"#5433EB",L30:"#6445ED",L20:"#9C83F8",L10:"#DBD1FF",L5:"#EEEAFF",L2:"#F7F5FF"},Grayscale:{D100:"#000000",D93:"#121212",D90:"#1A1A1A",D80:"#2A2A2A",D70:"#404040",D60:"#656667",D50:"#6F7071",L40:"#A6A8A9",L20:"#C9CBCC",L10:"#E1E4E5",L6:"#EEF0F1",L5:"#F2F4F5",L0:"#FFFFFF"},Green:{D90:"#002E24",D80:"#004839",D70:"#008552",L30:"#92D08D",L20:"#BAEBCB",L10:"#D2F2DE",L5:"#E4F6EB"},Poppy:{D80:"#481609",D70:"#832711",D50:"#D92A0F",L40:"#F05D38",L20:"#FF967D",L10:"#FFD2C2",L4:"#FFECE9"},Ochre:{D90:"#443600",D70:"#8C6E01",D60:"#C29D05",L50:"#E3BE2B",L30:"#F8DB67",L20:"#FFEC9F",L10:"#FFF4CB",L6:"#FFF9E2"},Brand:{Aqua:"#8DC0C6",Lime:"#C7DE00",Magenta:"#D354FF",Olive:"#8B8F01",Sage:"#D8E59D",Sand:"#F4F4ED",Violet:"#A327C2"},transparent:"transparent"},lh={0:0,none:0,px:1,2:2,4:4,8:8,10:10,12:12,16:16,20:20,24:24,32:32,36:36,40:40,48:48,64:64,auto:"auto"},Ca="gravity-font-faces",ch=` 44@font-face { 45 font-family: 'GTStandard-M'; 46 src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MRegular.woff2') 47 format('woff2'); 48 font-style: normal; 49 font-weight: 450; 50 font-display: fallback; 51} 52 53@font-face { 54 font-family: 'GTStandard-M'; 55 src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MMedium.woff2') 56 format('woff2'); 57 font-style: normal; 58 font-weight: 500; 59 font-display: fallback; 60} 61 62@font-face { 63 font-family: 'GTStandard-M'; 64 src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MSemibold.woff2') 65 format('woff2'); 66 font-style: normal; 67 font-weight: 600; 68 font-display: fallback; 69}`,dh=class extends HTMLElement{static get observedAttributes(){return["disabled"]}connectedCallback(){this._loadFonts(),this._updateButton()}attributeChangedCallback(){this._updateButton()}_loadFonts(){if(document.querySelector(`style[data-description="${Ca}"], style[data-description="shop-js-font-faces"]`))return;let t=document.head??document.documentElement;if(!t)return;let e=document.createElement("style");e.dataset.description=Ca,e.appendChild(document.createTextNode(ch)),t.appendChild(e)}_updateButton(){let t=this._getOrCreateShadowRoot();t.innerHTML=hh,this.hasAttribute("disabled")&&t.querySelector("button")?.setAttribute("disabled","")}_getOrCreateShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}};function uh(){window.customElements&&(customElements.get("gravity-button")||customElements.define("gravity-button",dh))}var hh=` 70<style> 71 * { 72 box-sizing: border-box; 73 border-width: 0; 74 border-style: solid; 75 border-color: currentColor;
76 --focused-box-shadow: 0 0 0 3px #DBD1FF, 0 0 #0000; 77 } 78 79 button { 80 text-transform: none; 81 -webkit-appearance: button; 82 background-color: transparent; 83 background-image: none; 84 font-family: GTStandard-M; 85 font-feature-settings: inherit; 86 font-variation-settings: inherit; 87 font-size: 100%; 88 font-weight: inherit; 89 line-height: inherit; 90 letter-spacing: inherit; 91 color: inherit; 92 margin: 0; 93 padding: 0; 94 cursor: pointer; 95 } 96 97 button:disabled { 98 cursor: default; 99 opacity: 0.5; 100 } 101 102 .gravity-button { 103 position: relative; 104 display: flex; 105 min-height: var(--gravity-button-min-height); 106 height: var(--gravity-button-height); 107 width: var(--gravity-button-width, 260px); 108 justify-content: center; 109 color: ${Ze.Grayscale.L0}; 110 align-items: center; 111 overflow: visible; 112 padding: var(--gravity-button-padding, ${lh[16]}px 10px); 113 border-radius: var(--gravity-button-border-radius); 114 border: none; 115 background-color: ${Ze.Purple.P40}; 116 transition: all; 117 } 118 119 .gravity-button:not([disabled]):focus-visible { 120 box-shadow: var(--focused-base-box-shadow, var(--focused-box-shadow)); 121 outline: var(--focused-base-outline, 2px solid transparent); 122 outline-offset: var(--focused-base-outline-offset, 2px); 123 } 124 125 .gravity-button:not([disabled]):hover { 126 background-color: ${Ze.Purple.D50}; 127 } 128</style> 129 130<button class="gravity-button"> 131 <slot id="button-content"></slot> 132</button> 133`,ph=".button-content{white-space:nowrap;justify-content:center;align-items:center;gap:3px;width:100%;height:100%;display:flex;container:bc/inline-size}.button-content>span{font-size:16px}.ShopPromise>.separator{margin:0 8px}@container bc (width<=300px){.ShopPromise{display:none!important}}gravity-button{display:block}shop-pay-iframe-content{height:100%}.credit-card-iframe-container{visibility:hidden;opacity:0;width:0;height:100%;transition:width .35s cubic-bezier(.33,0,0,1) .2s;position:relative;left:0}shop-pay-iframe-content,.credit-card-iframe-container>iframe.credit-card-iframe{pointer-events:none;-webkit-user-select:none;user-select:none}.credit-card-iframe-visible{opacity:1;visibility:visible;width:72px}.credit-card-iframe{object-position:left top;object-fit:none;width:80px;height:100%;position:absolute;top:0;left:0}",mh=".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)}:host([page-type=cart_page]){height:100%;display:block}:host([page-type=cart_page]) .accelerated-checkout-button{border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);width:100%;height:100%;min-height:0;box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type=product]) .accelerated-checkout-button{min-width:150px}@media (forced-colors:active){.accelerated-checkout-button,:host([page-type=cart_page]) .accelerated-checkout-button{border:1px solid #0000!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%}",Vr=class extends Error{constructor(){super("deliveryEstimates is null or undefined")}};Vr.prototype.name="DeliveryEstimatesResponseIsNullError";var pe=class extends Error{constructor(){super("window.Shopify.ShopPromise.deliveryPromiseAPIClient is undefined")}};pe.prototype.name="DeliveryPromiseAPIClientError";var gh=15,fh=200,yh=class{storefrontAPIToken;constructor(t){this.storefrontAPIToken=t}async fetchDeliveryPromise({variant:t,sellingPlanId:e}){const r=await Ao({fn:async()=>this.fetchDeliveryOptions(t,e),maxRetries:gh,delay:fh,retryPolicyFn:n=>
133n instanceof pe}).catch(n=>{if(n instanceof pe)throw n;return null});if(!r)throw new Vr;return r}async fetchDeliveryOptions(t,e){const r={variantId:t,sellingPlanId:e},n=window?.Shopify?.ShopPromise?.deliveryPromiseAPIClient;if(!n)throw new pe;return n(r,this.storefrontAPIToken)}};function bh(t,e){switch(t){case 0:return e?.translate("shop_promise_delivery.same_day")||null;case 1:return e?.translate("shop_promise_delivery.next_day")||null;case 2:return e?.translate("shop_promise_delivery.two_day")||null;default:return null}}var Sa="delivery-promise:postal-code-changed",wh=class extends re{lastFetchedProductVariantId;lastFetchSellingPlan;lastFetchPostalCode;fetching=!1;i18n=null;daysToDelivery;formObserver=null;async connectedCallback(){this.formObserver=new zr(this,({variantId:t,sellingPlanId:e})=>{this.fetchDeliveryPromise(t,e)}),this.formObserver.setupMutationObservers(),window.addEventListener(Sa,this.handlePostalCodeChange)}disconnectedCallback(){window.removeEventListener(Sa,this.handlePostalCodeChange)}setTranslations(t){this.i18n=t,this.render()}async fetchDeliveryPromise(t,e,r=""){if(!(!t||!this.accessToken)&&!(t===this.lastFetchedProductVariantId&&e===this.lastFetchSellingPlan&&r===this.lastFetchPostalCode))try{this.lastFetchedProductVariantId=t,this.lastFetchSellingPlan=e,this.lastFetchPostalCode=r;const n=await new yh(this.accessToken).fetchDeliveryPromise({variant:t,sellingPlanId:e||""}),a=Tn(this),o=n?.selectedShippingOption?.brandedPromise?.handle;if(a?.sellingPlanId!==e||a?.variantId!==t||this.lastFetchPostalCode!==r||o!=="shop_promise")return;this.daysToDelivery=n?.selectedShippingOption?.maxCalendarDaysToDelivery,this.render()}catch(n){n instanceof Vr&&(this.daysToDelivery=null)}}render(){const t=bh(this.daysToDelivery,this.i18n);this.classList.add("ShopPromise"),this.innerHTML=t?`<span class="separator">|</span><span>${t}</span>`:""}handlePostalCodeChange=t=>{const e=t.detail?.postalCode??"";this.fetchDeliveryPromise(this.lastFetchedProductVariantId,this.lastFetchSellingPlan,e)}};function _h({flow:t="default"}){const e=new URLSearchParams({target_origin:window.location.origin,flow:t});return`${window.location.origin}/services/login_with_shop/authorize?${e.toString()}`}function Eh(t,e,r){const n=r??window.location.origin;if(t.origin!==n||!e)return!1;try{return t.source===e.contentWindow}catch{return!1}}var Ah=class fr extends re{static iframeCreated=!1;_userRecognized;iframe=null;iframeContainer=null;iframeCreationStart=null;iframeOrigin=null;shopLogo=null;iframeState="hidden";impressionTracked=!1;pendingAnimation=!1;get userRecognized(){return this._userRecognized}async createIframe(){if(this.iframeContainer)return this.iframeC
133ontainer;const e=Vt();return this.iframeCreationStart=e,this.iframeContainer=document.createElement("div"),this.iframeContainer.classList.add("credit-card-iframe-container"),this.iframeContainer.setAttribute("data-test-id","shop-pay-iframe-container"),this.iframe=document.createElement("iframe"),this.iframe.src=_h({flow:"shop_pay_button"}),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("frameborder","no"),this.iframe.setAttribute("loading","lazy"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("allowfullscreen","false"),this.iframe.classList.add("credit-card-iframe"),this.iframeContainer.appendChild(this.iframe),this.iframeContainer}async connectedCallback(){if(fr.iframeCreated)return;const e=this.querySelector(".credit-card-iframe-container");e&&e.remove(),fr.iframeCreated=!0;const r=await this.createIframe();this.appendChild(r),this.setupMessageListener()}disconnectedCallback(){this.cleanup()}setShopLogo(e){this.shopLogo=e}setDisabled(e){this.disabled=e,e&&this.iframeState!=="personalized"&&this.hideIframe()}hasPersonalizationOccurred(){return this.iframeState==="personalized"}triggerAnimation(e){const r=this.style.display!=="none";if(!(this.disabled||this.iframeState==="personalized"||!r)){if(this.iframeState==="loaded"){this.trackButtonImpression();return}if(this.iframeState==="ready"){this.showIframe(e);return}this.pendingAnimation=!0}}stopPendingAnimation(){this.pendingAnimation=!1}resetToOriginalState(){this.iframeState="hidden",this.pendingAnimation=!1,this.iframeC
133ontainer?.classList.remove("credit-card-iframe-visible")}trackButtonImpression(){this.impressionTracked||(G({event:z.ShopPayButtonInView,instrumentId:p.ShopPay,eventSubtype:this.userRecognized?"personalized":"not_personalized"}),this.impressionTracked=!0)}setupMessageListener(){window.addEventListener("message",this.handleMessage)}handleMessage=e=>{if(Eh(e,this.iframe,e.origin)&&e.data?.type==="loaded"&&(this.iframeOrigin!==e.origin&&(this.iframeOrigin=e.origin),e.data.type==="loaded")){const r=e.data.recognized===!0;if(this._userRecognized=r,this.iframeCreationStart){const n=Vt()-this.iframeCreationStart,a={instrument:p.ShopPay,pageType:Cr()};E.histogram({name:C.ShopPayPersonalizedIframeLoadTime,value:n,attributes:a,unit:"ms"}),E.histogram({name:C.ShopPayPersonalizedIframeLoadTimeFromPageLoad,value:window.performance.now(),attributes:a,unit:"ms"})}if(r){this.handleRecognizedUser();return}this.handleUnrecognizedUser()}};handleRecognizedUser(){const e=this.iframeState==="hidden";e&&(this.iframeState="ready"),this.style.display!=="none"&&e&&!this.disabled&&this.pendingAnimation&&(this.pendingAnimation=!1,this.showIframe())}handleUnrecognizedUser(){this.iframeState="loaded",this.pendingAnimation&&this.trackButtonImpression(),this.cleanup()}animateIn(){this.disabled||!this.iframeContainer||this.iframeState!=="ready"||!this.shopLogo||(this.iframeContainer.classList.add("credit-card-iframe-visible"),this.sendMessageToIframe(),this.iframeState="personalized")}showIframe(e){if(this.trackButtonImpression(),!e){this.animateIn();return}const r=setTimeout(()=>{this.animateIn()},500);return()=>clearTimeout(r)}hideIframe(){this.iframeState!=="hidden"&&this.iframeState!=="personalized"&&(this.iframeState="hidden",this.iframeC
133ontainer?.classList.remove("credit-card-iframe-visible"))}cleanup(){window.removeEventListener("message",this.handleMessage),this.iframeContainer?.remove(),this.iframeContainer=null,this.iframe=null,this.iframeOrigin=null,this.shopLogo=null}sendMessageToIframe(){if(!this.iframe?.contentWindow||!this.iframeOrigin)return;const e={timestamp:Vt(),type:"animate-in"};this.iframe.contentWindow.postMessage(e,this.iframeOrigin)}};function vh(t){const e=t.querySelector(".button-content span");if(!e)return 0;const r=window.getComputedStyle(e);return parseFloat(r.fontSize)}function Pa(){const t=window.TPOConfigs,e=window.optionizeSettings;return!!(t||e)}var ce=220,Ch=class{cachedFontSize=null;cachedWidth=0;element;formObserver=null;formState={disabled:!1,variantId:void 0};initialWidth=null;isCTA;lockedNonPersonalized=!1;onFormStateChange;pendingFormStateUpdate=null;personalized;resizeObserver=null;shopPromiseEligible;shopPromiseProductPageContent;constructor({element:t,isCTA:e,onFormStateChange:r,personalized:n,shopPromiseEligible:a,shopPromiseProductPageContent:o}){this.element=t,this.isCTA=e,this.onFormStateChange=r,this.personalized=n,this.shopPromiseEligible=a,this.shopPromiseProductPageContent=o,this.personalized&&(Pa()||(this.formObserver=new zr(this.element,({disabled:i,variantId:s})=>{this.formState={disabled:i,variantId:s},this.scheduleFormStateChange()}),this.formObserver.setupMutationObservers(),this.resizeObserver=wt("ResizeObserver",i=>this.handleResize(i)),this.resizeObserver?.observe(this.element)))}cleanup(){this.formObserver?.addToCartMutationObserver?.disconnect(),this.resizeObserver?.disconnect(),this.pendingFormStateUpdate!==null&&(cancelAnimationFrame(this.pendingFormStateUpdate),this.pendingFormStateUpdate=null)}shouldRender(){if(!this.personalized||Pa())return!1;const t=this.cachedWidth;if(this.lockedNonPersonalized)return!1;const e=this.shopPromiseEligible&&this.shopPromiseProductPageContent,r=this.formState.disabled&&this.formState.variantId!==void 0;if(e||r||t<ce)return!1;if(this.isCTA){const n=this.getFontSizeCached();if(n<10||n>18)return!1}return!0}getFontSizeCached(){return this.cachedFontSize!==null?this.cachedFontSize:(this.cachedFontSize=vh(this.element),this.cachedFontSize)}scheduleFormStateChange(){this.pendingFormStateUpdate===null&&(this.pendingFormStateUpdate=requestAnimationFrame(()=>{this.pendingFormStateUpdate=null,this.onFormStateChange?.()}))}get locked(){return this.lockedNonPersonalized}get soldOut(){return this.formState.disabled&&this.formState.variantId!==void 0}handleResize(t){const e=t[0]?.contentRect.width??0;if(this.cachedWidth=e,this.initialWidth===null&&e>0){this.initialWidth=e,this.initialWidth<ce&&(this.lockedNonPersonalized=!0),this.scheduleFormStateChange();return}if(this.initialWidth!==null&&this.initialWidth>=ce&&e>0&&e<ce&&!this.lockedNonPersonalized){this.lockedNonPersonalized=!0,this.scheduleFormStateChange();return}this.scheduleFormStateChange()}},Sh=class extends ht{name=p.ShopPay;button=null;shopPromiseProductPageContent=null;shopPromiseEligible=!1;shopLogo=null;buttonContentDiv=null;iframeContent=null;iframeRenderEligibility=null;intersectionObserver=null;inView=!1;impressionTracked=!1;static get observedAttributes(){return["disabled"]}connectedCallback(){this.shopPromiseEligible=dn(),this.setupIntersectionObserver(),this.cleanupOnFailure(async()=>{uh(),await this.render()},this.name)}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver?.disconnect(),this.intersectionObserver=null,this.iframeRenderEligibility?.cleanup(),this.iframeRenderEligibility=null}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button),t==="disabled"&&this.onDisabledChanged(r)}setupIntersectionObserver(){if("IntersectionObserver"in window){const t=(this.button?.offsetHeight??46)*-1;this.intersectionObserver=new IntersectionObserver(e=>{e.forEach(r=>
133{r.isIntersecting&&!this.inView&&(this.inView=!0,this.onButtonInView(!0),this.intersectionObserver?.unobserve(this))})},{threshold:.1,rootMargin:`${t}px`}),this.intersectionObserver.observe(this)}else this.inView=!0,this.onButtonInView()}onButtonInView(t){const e=this.iframeRenderEligibility?.shouldRender();if(e&&this.iframeContent){this.iframeContent.triggerAnimation(t);return}if(e){this.createAndAttachIframe();return}this.impressionTracked||(G({event:z.ShopPayButtonInView,instrumentId:p.ShopPay,eventSubtype:"not_personalized"}),this.impressionTracked=!0)}onDisabledChanged(t){this.iframeContent?.setDisabled(t!==null)}async addButtonContent(){if(!this.button)return;let t;const e=await this.i18n,r=Jt({instrumentName:p.ShopPay}),n=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;this.shopLogo=n,this.isCTA?t=Br({translate:e.translate,logoElement:n,setAriaHidden:!1}):(t=document.createElement("div"),t.appendChild(n)),t.classList.add("button-content"),this.shopPromiseEligible&&!this.shopPromiseProductPageContent&&(this.shopPromiseProductPageContent=document.createElement("shop-promise-product-page-content"),this.shopPromiseProductPageContent.setTranslations(e),this.shopPromiseProductPageContent.setAttribute("access-token",this.accessToken||""),t.appendChild(this.shopPromiseProductPageContent));const a=this.getAttribute("personalized")==="true",o=()=>{const i=this.iframeContent,s=this.iframeRenderEligibility,l=s?.shouldRender()||!1;if(!i){l&&this.createAndAttachIframe();return}if(!l){if(i.hasPersonalizationOccurred()&&s?.soldOut&&!s?.locked){i.style.display="";return}i.style.display="none",s?.locked?i.resetToOriginalState():i.stopPendingAnimation();return}i.style.display="",this.inView&&i.triggerAnimation()};this.iframeRenderEligibility=new Ch({element:this.button,isCTA:this.isCTA,onFormStateChange:o,personalized:a,shopPromiseEligible:this.shopPromiseEligible,shopPromiseProductPageContent:this.shopPromiseProductPageContent}),this.buttonContentDiv=t,this.button.appendChild(t)}
133createAndAttachIframe(){!this.buttonContentDiv||this.iframeContent||(this.iframeContent=document.createElement("shop-pay-iframe-content"),this.iframeContent.setShopLogo(this.shopLogo),this.iframeContent.setDisabled(this.disabled),this.shopLogo.insertAdjacentElement("afterend",this.iframeContent),this.inView&&this.iframeContent.triggerAnimation())}handleIframeRenderLogic(){if(!this.iframeRenderEligibility)return;const t=this.iframeRenderEligibility.shouldRender();if(!this.iframeContent&&t){this.createAndAttachIframe();return}this.iframeContent&&(this.iframeContent.style.display=t?"":"none",t&&this.inView?this.iframeContent.triggerAnimation():t||this.iframeContent.stopPendingAnimation())}getShopPayBehavior(){return this.pageType===S.ProductPage?"force_shop_pay_product":this.pageType===S.CartPage?"force_shop_pay_cart":"force_shop_pay"}async handleClick(t){if(t.preventDefault(),this.disabled||!this.button||this.button.getAttribute("disabled"))return;this.disabled=!0,dt(this.name,this.pageType);const[e,r,n]=await Promise.all([this.i18n,this.dataSource,this.topLevelErrorHandler]);try{const{decelerationReason:a,cart:o,customValidationError:i,unrecoverableError:s}=await ut({element:this,instrumentName:p.ShopPay,dataSource:r});if(s){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),c.log({body:"Unrecoverable error detected in Shop Pay Button click",attributes:{pageType:this.pageType,error:s}}),Et({i18n:e,topLevelErrorHandler:n,wallet:this.name,unrecoverableError:s});return}if(i){c.log({body:"Custom validation error detected in Shop Pay Button click",attributes:{pageType:this.pageType,errorCode:i.code,errorMessage:i.message}}),c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),nt({i18n:e,topLevelErrorHandler:n,wallet:this.name,message:i.message});return}if(a){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:o?.checkoutUrl??"",instrumentName:this.name,reason:a});return}c.sheetClicked({instrument:this.name,result:"success"}),rt(o?.checkoutUrl??"",this.getShopPayBehavior())}catch(a){g.notify(new Co(`An error occurred when attempting to create a cart using the Shop Pay Button. Details: ${a}`,{cause:a})),c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Shop Pay sheet clicked",attributes:{error:String(a),location:"handleClick"}}),U({i18n:e,topLevelErrorHandler:n,wallet:this.name})}}async render(){const t=this.getOrCreateShadowRoot();if(t.innerHTML)return;this.button||(this.button=document.createElement("gravity-button"));const e=document.createElement("style");e.innerHTML=[mh,ph].join(` 134`),t.appendChild(e),await this.addButtonContent(),this.disabled&&this.button.setAttribute("disabled",""),this.button.classList.add(_t.BUTTON),this.button.onclick=r=>this.handleClick(r),t.appendChild(this.button),this.ensureLightDOMIsNotEmpty(),this.handleIframeRenderLogic(),this.onRendered()}};tt("shop-promise-product-page-content",wh),tt("shop-pay-iframe-content",Ah);var Co=class extends Error{};Co.prototype.name="ShopPayButtonError";var So=class extends pt{static walletName(){return"shop_pay"}constructor(t){super(t)}getWebComponentName(){return"shop-pay-wallet-button"}getWebComponentClass(){return Sh}getInstrumentName(){return p.ShopPay}async createWebComponent(t){const e=await super.createWebComponent(t);return this.walletParams?.personalized&&e.setAttribute("personalized","true"),e}async loadWalletSDK(){await this.loadLogo()}getLoadEligibility(){return{eligible:!0}}async loadLogo(){await Nt({svg:"shop-logo.svg",instrumentName:p.ShopPay})}};Gr([Hr("Shop Pay")],So.prototype,"getLoadEligibility",null);var Ph="dialog#scrim{color:#fff;background:#0009;border:none;justify-content:center;align-items:center;width:100%;max-width:100%;height:100%;max-height:100%;margin:0;padding:0;display:flex;position:fixed;inset:0;overflow:hidden}#content{box-sizing:border-box;text-align:center;flex-direction:column;align-items:center;gap:20px;width:100%;max-width:393px;padding:0 21px;display:flex}#message{margin:0;font-family:inherit;font-size:16px;line-height:1.5}#cancel-button{color:inherit;cursor:pointer;background:0 0;border:none;padding:0;font-family:inherit;font-size:17px;line-height:1.5;text-decoration:underline}#cancel-button:focus-visible{outline-offset:2px;border-radius:2px;outline:2px solid #fff}",Po=class extends HTMLElement{onCancel;originalFocus=null;returnFocusTo=null;originalStyle={position:"",overflow:"",top:""};scrollPosition=0;connectedCallback(){this.shadowRoot||this.attachShadow({mode:"open"}),this.originalFocus=this.returnFocusTo??document.activeElement,this.render(),this.applyScrollLock();const t=this.shadowRoot,e=document.createElement("style");e.textContent=Ph,t.appendChild(e);const r=t.getElementById("cancel-button");r||g.leaveBreadcrumb("Google Pay in-progress scrim: cancel button not found after render",{hasDialog:!!t.getElementById("scrim")},"error"),r?.addEventListener("click",this.handleCancelClick);const n=t.getElementById("scrim");if(n){n.addEventListener("cancel",this.handleDialogCancel),n.addEventListener("close",this.handleDialogClose);try{n.setAttribute("aria-modal","true"),n.showModal()}catch{n.setAttribute("open",""),document.addEventListener("keydown",this.handleEscapeKey),this.trapFocus(n)}}else g.leaveBreadcrumb("Google Pay in-progress scrim: dialog element not found after render",{hasCancelButton:!!r},"error");r?.focus()}disconnectedCallback(){document.removeEventListener("keydown",this.handleEscapeKey),this.removeScrollLock()}dismiss=()=>{this.removeScrollLock(),this.isConnected&&this.remove();const t=this.onCancel;this.onCancel=void 0,t?.(),this.restoreFocus()};handleCancelClick=()=>{this.dismiss()};handleDialogCancel=t=>{t.preventDefault(),this.dismiss()};handleDialogClose=()=>{this.dismiss()};handleEscapeKey=t=>{t.key==="Escape"&&(t.preventDefault(),this.dismiss())};trapFocus(t){const e=Array.from(t.querySelectorAll("a[href], button"));if(e.length===0)return;const r=e[0],n=e[e.length-1],a=this.shadowRoot;t.addEventListener("keydown",o=>
134{o.key==="Tab"&&(o.shiftKey?a.activeElement===r&&(o.preventDefault(),n.focus()):a.activeElement===n&&(o.preventDefault(),r.focus()))})}render(){const t=this.getAttribute("message")??"",e=this.getAttribute("cancel-label")??"Cancel",r=document.createElement("dialog");r.id="scrim",r.setAttribute("role","alertdialog"),r.setAttribute("aria-labelledby","message");const n=document.createElement("div");n.id="content";const a=document.createElement("p");a.id="message",a.textContent=t;const o=document.createElement("button");o.type="button",o.id="cancel-button",o.textContent=e,n.append(a,o),r.appendChild(n);const i=this.shadowRoot;for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(r)}applyScrollLock(){this.originalStyle={position:document.body.style.position,overflow:document.body.style.overflow,top:document.body.style.top},document.body.style.overflow="hidden"}removeScrollLock(){document.body.style.overflow=this.originalStyle?.overflow??""}restoreFocus(){this.originalFocus&&"focus"in this.originalFocus&&typeof this.originalFocus.focus=="function"&&this.originalFocus.focus()}},De="google-pay-in-progress-scrim";function Ih({i18n:t,onCancel:e,returnFocusTo:r}){kh();const n=document.createElement(De);return xt(n,{"data-testid":De,message:t.translate("google_pay_in_progress_scrim.continue_purchase",{wallet:t.translate("brand.google_pay")}),"cancel-label":t.translate("google_pay_in_progress_scrim.cancel")}),e&&(n.onCancel=e),n.returnFocusTo=r??null,document.body.appendChild(n),n}function Ia(){document.querySelectorAll("gpay-graypane").forEach(t=>t.remove())}function kh(){const t=document.querySelector(De);t instanceof Po?t.dismiss():t&&t.remove()}tt(De,Po);var Th=".button{border:none;justify-content:center;align-items:center;width:100%;display:flex;&:hover:not(:disabled){filter:brightness(92%);cursor:pointer}&:disabled{opacity:.5;cursor:not-allowed}&:focus-visible{outline:none;box-shadow:inset 0 0 0 2px #1773b0,inset 0 0 0 3px #f8f8f8!important}}.logo-only>svg{width:50px}.dark{color:#fff;background:#000}.light{color:#000;background:#fff;outline:1px solid #3c4043}@media (forced-colors:active){.light{outline:none}}@media (prefers-contrast:high),(forced-colors:active){.button:focus-visible{outline-offset:.1rem;outline:.2rem solid}}.content{white-space:pre;justify-content:center;align-items:center;display:flex}";function tr({cart:t,i18n:e,transactionId:r}){const n=eo(t),a={label:e.translate("order_summary.subtotal"),type:"SUBTOTAL",price:st(n.amount)},o=Xn({deliveryGroups:t.deliveryGroups,i18n:e}).map(d=>Dh({lineItem:d,type:"LINE_ITEM"})),i=Rh(t,e),s=[...un(t.lineItems,(d,u)=>({label:d,type:"LINE_ITEM",price:u})),a,...o,...i];if(t.totalDutyAmount){const d={label:e.translate("order_summary.duties"),type:"LINE_ITEM",price:st(t.totalDutyAmount.amount)};s.push(d)}if(t.totalTaxAmount){const d={label:e.translate("order_summary.taxes"),t
134ype:"TAX",price:st(t.totalTaxAmount.amount)};s.push(d)}const l={totalPrice:t.totalAmount.amount,currencyCode:t.totalAmount.currencyCode,totalPriceStatus:"ESTIMATED",totalPriceLabel:e.translate("order_summary.total"),displayItems:s};return r&&(l.transactionId=r),l}function Dh({lineItem:t,type:e,status:r="FINAL"}){return{label:t.label,type:e,price:t.amount,status:r}}function Rh(t,e){let r;if(Q.enabled(vn)){const{product:n,order:a,shipping:o}=Zn(t.discountApplications);r=[...n,...a,...o]}else r=[...t.lineItems.flatMap(n=>n.discountAllocations),...t.discountAllocations];return r.map(n=>{const a=n.title??n.code,o="totalAllocatedAmount"in n?n.totalAllocatedAmount.amount:Number(n.discountedAmount.amount);return{label:a??e.translate("order_summary.discount"),type:"LINE_ITEM",price:`-${st(o)}`}})}function Nh(t=8){const e=Math.ceil(t/2),r=new Uint8Array(e);return crypto.getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("").slice(0,t)}function Lh(){try{const t=window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes?.microSessionId;return t?`pw-${t}-${Nh()}`:void 0}catch{return}}var Io=["PAYMENT_AUTHORIZATION"],Oh=Io.concat(["SHIPPING_ADDRESS","SHIPPING_OPTION"]),xh=["PAN_ONLY"];function Mh({walletParams:t,isShippingRequired:e,hasSellingPlan:r,i18n:n,buyerCurrency:a,authJwt:o,transactionId:i}){const s=r,l={totalPrice:"0.01",currencyCode:a,totalPriceStatus:"ESTIMATED",totalPriceLabel:n.translate("order_summary.total"),displayItems:[{label:n.translate("order_summary.subtotal"),type:"SUBTOTAL",price:"0.01"}],...s&&{checkoutOption:"CONTINUE_TO_REVIEW"}};i&&(l.transactionId=i);const d={...t.paymentData,shippingAddressRequired:e,shippingOptionRequired:e,transactionInfo:l};return d.merchantInfo.authJwt=o,e||delete d.shippingAddressParameters,d.callbackIntents=e?Oh:Io,r&&zh(d),d}function zh(t){t.allowedPaymentMethods.forEach(e=>{e.parameters.allowedAuthMethods=e.parameters.allowedAuthMethods.filter(r=>xh.includes(r))})}var Fh=class extends Jn{i18n;topLevelErrorHandler;brandName;completionResult;constructor(t,e){super(),this.i18n=t,this.topLevelErrorHandler=e,this.brandName=this.i18n.translate("brand.google_pay"),this.completionResult=void 0}mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:o,shippingCity:i,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}){const h=this.mapCustomValidationFunctionErrorToAction(t.errors);if(h)return h;const m=this.getErrorActions({checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:o,shippingCity:i,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}),y=t.errors,b=this.getUnhandledErrors(y,m);b.forEach(T=>{g.notify(new ke(`[${p.GooglePay}] mutation result error not handled: ${St(T)}`,{groupingHash:`UnhandledActionError:${p.GooglePay}:${St(T)}`}))});const{firstPaymentSheetAction:A}=this.getMergedPaymentSheetAction({result:t,errorActions:m});return A||(b.length>0?{action:"abort"}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:o,shippingCity:i,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}){if(!t.data)throw new Ja(p.GooglePay);switch(this.completionResult=t,t.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:t.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const h=this.mapCustomValidationFunctionErrorToAction(t.errors);if(h)return h;const m=this.getErrorActions({checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:o,shippingCity:i,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}),y=t.errors;this.getUnhandledErrors(y,m).forEach(A=>{g.notify(new ke(`[${p.GooglePay}] completion result error not handled: ${St(A)}`,{groupingHash:`UnhandledActionError:${p.GooglePay}:${St(A)}`}))});const{prioritizedPaymentSheetAction:b}=this.getMergedPaymentSheetAction({result:t,errorActions:m});return b||(U({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.GooglePay,brand:this.brandName}),{action:"abort"})}default:throw new Error(`[${p.GooglePay}] unknown completion result type: ${t.data.__typename}`)}}getErrorActions({checkoutUrl:t,requestType:e,shippingCountryCode:r,shippingZip:n,shippingProvince:a,shippingCity:o,billingCountryCode:i,billingZip:s,billingProvince:l,billingCity:d}){const u=(h,m)=>()=>{const y=m.startsWith("billingAddress");c.addressFieldError({instrument:p.GooglePay,errorCode:h,errorField:m,countryCode:y?i:r,zip:y?s:n,province:y?l:a,city:y?d:o})};return[{matchers:[be],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:p.GooglePay,errorOrWarning:be.code,checkoutUrl:t,requestType:e})},{matchers:[_e],generateAction:()=>this.decelerateOrAbort({reason:"invalid_language",instrumentName:p.GooglePay,errorOrWarning:_e.code,checkoutUrl:t,requestType:e})},{matchers:[Ee],generateAction:()=>this.decelerateOrAbort({reason:"invalid_country",instrumentName:p.GooglePay,errorOrWarning:Ee.code,checkoutUrl:t,requestType:e})},{matchers:[Ae],generateAction:()=>this.decelerateOrAbort({reason:"missing_cart_id",instrumentName:p.GooglePay,errorOrWarning:Ae.code,checkoutUrl:t,requestType:e})},{matchers:[Ce],generateAction:()=>this.decelerateOrAbort({reason:"redirect_to_checkout_required",instrumentName:p.GooglePay,errorOrWarning:Ce.code,checkoutUrl:t,requestType:e})},{matchers:Rr,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:p.GooglePay,errorOrWarning:"TAX_NEW_TAX_MUST_BE_ACCEPTED",checkoutUrl:t,requestType:e})},{matchers:[Se],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:p.GooglePay,errorOrWarning:Se.code,checkoutUrl:t,requestType:e})},{matchers:[ve],generateAction:()=>this.decelerateOrAbort({reason:"unsupported_google_pay_payment_method",instrumentName:p.GooglePay,errorOrWarning:ve.code,checkoutUrl:t,requestType:e})},{matchers:On,generateAction:()=>this.decelerateOrAbort({reason:"invalid_payment_amount",instrumentName:p.GooglePay,errorOrWarning:"INVALID_PAYMENT",checkoutUrl:t,requestType:e})},{matchers:[ye],generateAction:()=>this.decelerateOrAbort({reason:"custom_validation",instrumentName:p.GooglePay,errorOrWarning:ye.code,checkoutUrl:t,requestType:e})},{matchers:[ir],generateAction:()=>this.decelerateOrAbort({reason:"discount_not_applicable",instrumentName:p.GooglePay,errorOrWarning:ir.code,checkoutUrl:t,requestType:e})},{matchers:Sc,generateAction:()=>({action:"abort",effects:[()=>U({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.GooglePay,brand:this.brandName})]})},{matchers:Nr,generateAction:()=>({action:"abort",effects:[()=>lt({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.GooglePay})]})},{matchers:xn,generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:p.GooglePay,errorOrWarning:"MERCHANDISE_NOT_ENOUGH_STOCK",checkoutUrl:t,requestType:e})},{matchers:Ln,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.shipping_address")}]})}
134,{matchers:f.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:[Oc],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_OPTION_INVALID",intent:"SHIPPING_OPTION",message:this.i18n.translate("errors.missing.shipping_option")}]})},{matchers:Xt.invalid,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.email")}]})},{matchers:Xt.required,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.email")}]})},{matchers:f.required.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address2")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address2")]})},{matchers:f.invalid.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address2")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address2")]})},{matchers:f.required.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.city")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.city")]})},{matchers:f.invalid.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.city")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.city")]})},{matchers:f.required.province,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.zone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.province")]})},{matchers:f.invalid.province,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.zone")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.province")]})},{matchers:f.required.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.postal_code")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.zip")]})},{matchers:f.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:f.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.phone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.phone")]})},{matchers:f.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.phone")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.phone")]})},{matchers:f.invalid.country,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.country")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.country")]})},{matchers:f.required.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.first_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.firstName")]})}
134,{matchers:f.invalid.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.first_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.firstName")]})},{matchers:f.required.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.last_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.lastName")]})},{matchers:f.invalid.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.last_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.lastName")]})},{matchers:f.required.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address1")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address1")]})},{matchers:f.invalid.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address1")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address1")]})},{matchers:f.emojis.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.last_name")}]})},{matchers:f.emojis.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.city")}]})},{matchers:f.emojis.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address1")}]})},{matchers:f.emojis.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address2")}]})},{matchers:f.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.postal_code")}]})},{matchers:f.tooLong.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address1")}]})},{matchers:f.tooLong.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address2")}]})},{matchers:f.tooLong.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.first_name")}]})},{matchers:f.tooLong.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.last_name")}]})},{matchers:f.tooLong.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.city")}]})},{matchers:f.containsUrl.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.first_name")}]})},{matchers:f.containsUrl.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.last_name")}]})},{matchers:f.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address1")}]})},{matchers:f.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address2")}]})},{matchers:f.htmlTags.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.city")}]})},{matchers:f.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.first_name")}]})},{matchers:f.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.last_name")}]})},{matchers:w.invalid.generic,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.billing_address")}],effects:[u("INVALID_PAYMENT","billingAddress")]})},{matchers:[we],generateAction:()=>this.decelerateOrAbort({reason:"localization_extension_field_error",instrumentName:p.GooglePay,errorOrWarning:we.code,checkoutUrl:t,requestType:e})},{matchers:w.required.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.first_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.firstName")]})},{matchers:w.required.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.last_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.lastName")]})},{matchers:w.required.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.address1")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address1")]})},{matchers:w.required.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.address2")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address2")]})},{matchers:w.required.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.city")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.city")]})},{matchers:w.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.phone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.phone")]})},{matchers:w.required.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.postal_code")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.zip")]})},{matchers:w.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})},{matchers:w.required.province,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.zone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.province")]})},{matchers:w.emojis.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.first_name")}]})},{matchers:w.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.first_name")}]})},{matchers:w.invalid.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.first_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.firstName")]})},{matchers:w.emojis.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.last_name")}]})},{matchers:w.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.last_name")}]})},{matchers:w.invalid.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.last_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.lastName")]})},{matchers:w.emojis.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.address1")}]})},{matchers:w.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.address1")}]})},{matchers:w.invalid.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.address1")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address1")]})},{matchers:w.emojis.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.address2")}]})},{matchers:w.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.address2")}]})},{matchers:w.invalid.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.address2")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address2")]})},{matchers:w.emojis.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.city")}]})},{matchers:w.htmlTags.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.city")}]})},{matchers:w.invalid.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.city")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.city")]})},{matchers:w.emojis.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.phone")}]})},{matchers:w.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.phone")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.phone")]})},{matchers:w.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.postal_code")}]})},{matchers:w.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})}]}mapCustomValidationFunctionErrorToAction(t){const e=Ir(t);return e?(nt({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:p.GooglePay,brand:this.brandName,message:e.message}),{action:"abort"}):null}};function Uh({deliveryGroups:t,i18n:e}){const r=Rd(Yn({deliveryGroups:t}),e),n=r.map(({handle:o,title:i,description:s})=>({id:o,label:i??"",description:s})),a=t.map(({selectedDeliveryOption:o})=>o?.handle).join(",");return{shippingOptions:n,defaultSelectedOptionId:r.find(({handle:o})=>o===a)?.handle}}function er(t){const e=t.iso3166AdministrativeArea||void 0,r=t.countryCode==="AE"?t.administrativeArea:t.locality;let n,a;if(t.name){const[o,...i]=(t.name||"").split(" ");i.length===0?a=o:a=i.join(" "),n=o}return{firstName:n,lastName:a,address1:t.address1,address2:t.address2,city:r,province:e,country:t.countryCode,phone:t.phoneNumber,zip:t.postalCode}}
134var yr=class extends Error{};yr.prototype.name="GooglePayError";function ko(t){const e=t.auth;if(!(Array.isArray(e)&&e.length>0))return{result:"error",reason:"invalidAuthParams"};const r=Vt();for(const n of e)if(r<n.expiresAt*1e3)return{result:"success",jwt:n.jwt};return{result:"error",reason:"authJwtExpired"}}var Bh=["https://checkout.pci.shopifyinc.com/sessions","https://checkout.pci.shopifyinc.ninja/sessions"],bt=class extends Error{#t;#e;constructor(t,e,r){super(t),this.#t=e,this.#e=r}get statusCode(){return this.#t}get responseBody(){return this.#e}};bt.prototype.name="CardsinkError";function Hh(t){if(!Bh.includes(t))throw new bt(`Untrusted cardsink url: ${t}`)}async function Gh({cardsinkUrl:t,payload:e,clientIdentificationJwt:r,abortSignal:n}){Hh(t);const a={"Content-Type":"application/json"};r&&(a["Shopify-Identification-Signature"]=r);let o;try{o=await fetch(t,{method:"POST",headers:a,body:JSON.stringify(e),signal:n})}catch(s){throw new bt(`Network error while calling Cardsink: ${s instanceof Error?s.message:String(s)}`)}if(!o.ok){const s=await o.text().catch(()=>"Unable to read response body");throw new bt(`Cardsink request failed with status ${o.status}`,o.status,s)}let i;try{i=await o.json()}catch(s){throw new bt(`Failed to parse Cardsink response: ${s instanceof Error?s.message:String(s)}`,o.status)}return i}var rr=1,$h=500;async function Vh(t,e,r){let n="";for(let a=0;a<=rr;a++)try{const o=await Gh({cardsinkUrl:t.cardsinkUrl,payload:e,clientIdentificationJwt:t.callerIdentificationJwt,abortSignal:r});return c.cardsinkDepositResult({result:"success",attempt:a}),{sessionId:o.id}}catch(o){if(n=o instanceof bt?o.message:"Cardsink deposit failed with unexpected error",a<rr){if(r?.aborted)break;await new Promise(i=>setTimeout(i,$h))}}return c.cardsinkDepositResult({result:r?.aborted?"cancelled":"failed",error:n,attempt:rr}),{error:n}}var Wh=27e3,ka="Google Pay Timeout",jh=class{name=p.GooglePay;walletParams;cart=null;isShippingRequired;hasSellingPlan;dataSource;button;paymentsClient;i18n;topLevelErrorHandler;actionGenerator;cartClient;initialBuyerCurrency;cardsinkUrl;cardsinkCallerIdentificationJwt;dismissLoadingScrim;#t=Lh();get transactionId(){return this.#t}terminalCartCreationError;#e;#r;#n;constructor({walletParams:t,isShippingRequired:e,hasSellingPlan:r,dataSource:n,button:a,i18n:o,topLevelErrorHandler:i,cartClient:s,buyerCurrency:l,abortController:d,cardsinkUrl:u,cardsinkCallerIdentificationJwt:h}){this.walletParams=t,this.isShippingRequired=e,this.hasSellingPlan=r,this.dataSource=n,this.button=a,this.i18n=o,this.topLevelErrorHandler=i,this.cartClient=s,this.initialBuyerCurrency=l,this.cardsinkUrl=u,this.cardsinkCallerIdentificationJwt=h,this.#e=t.customerAccountEmail,this.#r=d;const m=ko(this.walletParams);if(m.result==="error")throw g.leaveBreadcrumb("Google Pay Invalid AuthJwt detected on click",{reason:m.reason,walletParams:this.walletParams},"error"),new yr(m.reason);this.#n=m.jwt;const y={environment:this.walletParams.environment,merchantInfo:{...this.walletParams.paymentData.merchantInfo,authJwt:this.#n},paymentDataCallbacks:{onPaymentDataChanged:this.isShippingRequired?this.onPaymentDataChanged:void 0,onPaymentAuthorized:this.onPaymentAuthorized}};this.paymentsClient=new window.google.payments.api.PaymentsClient(y),this.actionGenerator=new Fh(this.i18n,this.topLevelErrorHandler)}async handleClick(){if(!this.isShippingRequired)throw new q("Google Pay checkout started for digital cart");const t=Mh({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,i18n:this.i18n,buyerCurrency:this.initialBuyerCurrency,authJwt:this.#n,transactionId:this.transactionId});await this.paymentsClient.loadPaymentData(t)}onPaymentDataChanged=async t=>{const{callbackTrigger:e,shippingAddress:r,shippingOptionData:n}=t,{translate:a}=this.i18n;switch(g.leaveBreadcrumb("Google Pay onPaymentDataChanged",{callbackTrigger:e},"log"),e){case"INITIALIZE":{if(!this.cart)try{const{cart:i,customValidationError:s,decelerationReason:l,unrecoverableError:d}=await ut({element:this.button,instrumentName:p.GooglePay,dataSource:this.dataSource,isShippingRequired:this.isShippingRequired});if(s||d)return c.sheetClicked({instrument:this.name,result:"rejected",reason:s?"custom_validation_error":"unrecoverable_error"}),this.terminalCartCreationError=s?s.message:qh(this.i18n,d),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}});if(this.cart=i,this.#r?.signal?.aborted)return this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});if(l)return c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:i?.checkoutUrl??"",instrumentName:this.name,reason:l,stage:"onValidateMerchant::createCart"}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});c.sheetClicked({instrument:this.name,result:"success"})}catch(i){return c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),this.logTelemetry("Unhandled error detected in Google Pay sheet clicked",{error:String(i),location:"onPaymentDataChanged_INITIALIZE"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}let o=!1;if(r)try{return await this.handleShippingAddressChange(this.cart.id,r)}catch{o=!0}return{newTransactionInfo:tr({cart:this.cart,i18n:this.i18n,transactionId:this.transactionId}),...o?this.showPaymentDataRequestError():{}}}case"SHIPPING_ADDRESS":return this.terminalCartCreationError?this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}}):this.cart?r?this.handleShippingAddressChange(this.cart.id,r):{newTransactionInfo:tr({cart:this.cart,i18n:this.i18n,transactionId:this.transactionId})}:this.showPaymentDataRequestError({intent:e});case"SHIPPING_OPTION":{if(!this.cart)return this.showPaymentDataRequestError({intent:e});
134if(!n||!n.id)return{error:{reason:"SHIPPING_OPTION_INVALID",message:a("shipping_methods.choose_delivery_strategy"),intent:"SHIPPING_OPTION"}};const o=await this.handleDeliveryOptionChange(n.id.split(","));return o.data?(this.cart=o.data,o.abortReason==="out_of_stock"?this.showPaymentDataRequestError({error:{intent:"SHIPPING_OPTION",reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.product.out_of_stock")}}):o.decelerationReason?(N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:o.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_OPTION",reason:"OTHER_ERROR",message:""}})):this.handlePaymentDataRequestUpdate({result:o,intent:e,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentDataChanged::updateCartDeliveryOptions",shippingCountryCode:r?.countryCode,shippingZip:r?.postalCode||void 0,shippingProvince:r?.iso3166AdministrativeArea||void 0,shippingCity:r?.locality||void 0})):this.showPaymentDataRequestError({intent:e})}default:return this.logException(`Payment data changed callback returned unexpected intent: ${e}`,{severity:"warning"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}};onPaymentAuthorized=async t=>{if(this.dismissLoadingScrim?.(),c.authorizationAttempt(this.name),Ot(O.AuthorizationLatency,this.name),!this.cart)return c.googlePayNullCartOnAuthorize(),this.handlePaymentAuthorizationError({reason:"null_cart_on_authorize"});const e=t.paymentMethodData.info?.billingAddress,r=t.shippingAddress,{signature:n,signedMessage:a,protocolVersion:o}=JSON.parse(t.paymentMethodData.tokenizationData.token);if(!e)return this.handlePaymentAuthorizationError({error:{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.billing_address")},reason:"missing_billing_address"});if(this.isShippingRequired&&!r)return this.handlePaymentAuthorizationError({error:{reason:"SHIPPING_ADDRESS_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.shipping_address")},reason:"missing_shipping_address"});const i=r?.postalCode||void 0,s=r?.iso3166AdministrativeArea||void 0,l=r?.locality||void 0,d=e?.postalCode||void 0,u=e?.iso3166AdministrativeArea||void 0,h=e?.locality||void 0,m=await Vh({cardsinkUrl:this.cardsinkUrl,callerIdentificationJwt:this.cardsinkCallerIdentificationJwt},{payment_data_source:"google-pay-ecv1",encrypted_payment_data:{protocol_version:o,signature:n,signed_message:a},name:e.name??""},this.#r?.signal);if(this.#r?.signal?.aborted)return this.handlePaymentAuthorizationError({reason:"cardsink_deposit_cancelled"});if(!("sessionId"in m))return g.notify(new bt(m.error),{severity:"warning"}),N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:"cardsink_deposit_failed"}),{transactionState:"SUCCESS"};const{sessionId:y}=m,b=async()=>{const _=this.#e??t.email,P=this.isShippingRequired?{validateAddress:!0,streetAddress:er(r)}:{};return await kt({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:this.name,emailAddress:_,abortSignal:this.#r?.signal,...P})},A=async()=>{const _=er(e),P={billingAddress:_,sessionId:y,signature:"",signedMessage:"",protocolVersion:""};return await Ur({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{googlePayWalletContent:P}},canUsePaymentMethodForFreeOrder:!1,billingAddress:_,cartClient:this.cartClient,instrumentName:this.name,hasSellingPlan:this.hasSellingPlan,abortSignal:this.#r?.signal})},T=setTimeout(()=>{this.#r?.abort(ka)},Wh);try{const _=await b(),P=Hn({currentCart:_.data,previousCart:this.cart});_.data&&(this.cart=_.data);const k=this.handleIntermediatePaymentAuthorizationResult({result:_,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updateBuyerIdentity",shippingCountryCode:r?.countryCode,shippingZip:i,shippingProvince:s,shippingCity:l,billingCountryCode:e?.countryCode,billingZip:d,billingProvince:u,billingCity:h});if(k)return clearTimeout(T),k;const L=await A();P==="inc"&&(L.decelerationReason||="price_increased");const x=this.handleIntermediatePaymentAuthorizationResult({result:L,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updateCartPayment",shippingCountryCode:r?.countryCode,shippingZip:i,shippingProvince:s,shippingCity:l,billingCountryCode:e?.countryCode,billingZip:d,billingProvince:u,billingCity:h});if(x)return clearTimeout(T),x;
134if(clearTimeout(T),this.#r?.signal?.aborted)return this.handlePaymentAuthorizationError({reason:"aborted_before_completion"});if(this.hasSellingPlan)return N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:"subscription_review_required_banner_less",forceLegacySplitShippingMode:!0}),{transactionState:"SUCCESS"};const B=await bo({cartId:this.cart.id,token:n,cartClient:this.cartClient,instrumentName:this.name});Yt({result:B,instrument:this.name});const M=this.actionGenerator.mapCompletionResultToPaymentSheetAction({result:B,checkoutUrl:B.data&&"checkoutUrl"in B.data&&B.data.checkoutUrl?B.data.checkoutUrl:this.cart.checkoutUrl,requestType:"completion",shippingCountryCode:r?.countryCode,shippingZip:i,shippingProvince:s,shippingCity:l,billingCountryCode:e?.countryCode,billingZip:d,billingProvince:u,billingCity:h});return this.handlePaymentAuthorizationResult(M)}catch(_){clearTimeout(T);const P=_ instanceof Error?_.message:String(_);return P?.includes(ka)?(this.logTelemetry("Google Pay onPaymentAuthorized timed out",{requestType:"onPaymentAuthorized"}),this.handlePaymentAuthorizationError({status:"timeout",reason:"timeout"})):(!(_ instanceof Tt)&&!this.#r?.signal?.aborted&&(this.logTelemetry("Google Pay authorization exception",{error:P}),this.logException(P)),this.handlePaymentAuthorizationError({reason:"unhandled_exception"}))}};showPaymentDataRequestError({error:t,intent:e="SHIPPING_ADDRESS"}={}){return t?{error:t}:{error:{intent:e,reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.wallet.generic_error",{wallet:this.i18n.translate("brand.google_pay")})}}}handlePaymentAuthorizationError({error:t,status:e="failed",reason:r}={}){return this.emitAuthorizationCompleteMetric(e),this.logTelemetry("Google Pay authorization failed",{status:e,...r&&{reason:r},...t&&{errorReason:t.reason,errorMessage:t.message,errorIntent:t.intent}}),{transactionState:"ERROR",...this.showPaymentDataRequestError({error:t,intent:"PAYMENT_AUTHORIZATION"})}}handlePaymentDataRequestUpdate({result:t,intent:e,checkoutUrl:r,requestType:n,shippingCountryCode:a,shippingZip:o,shippingProvince:i,shippingCity:s,billingCountryCode:l,billingZip:d,billingProvince:u,billingCity:h}){const m=this.actionGenerator.mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:r,requestType:n,shippingCountryCode:a,shippingZip:o,shippingProvince:i,shippingCity:s,billingCountryCode:l,billingZip:d,billingProvince:u,billingCity:h});switch(m.effects?.forEach(y=>y()),m.action){case"update":{const y=m,{data:b,decelerationReason:A}=t;if(!b)return this.showPaymentDataRequestError({intent:e});if(A)return N({checkoutUrl:b.checkoutUrl,instrumentName:this.name,reason:A}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}});if(this.isShippingRequired&&b.deliveryGroups.length===0)return this.showPaymentDataRequestError({error:{reason:"SHIPPING_ADDRESS_INVALID",message:this.i18n.translate("errors.address_unserviceable",{shopName:this.walletParams.paymentData.merchantInfo.merchantName}),intent:"SHIPPING_ADDRESS"}});const T=this.isShippingRequired?Uh({deliveryGroups:b.deliveryGroups,i18n:this.i18n}):void 0;if(this.isShippingRequired&&b.deliveryGroups.length>0&&(T?.shippingOptions.length??0)===0){const _=b.deliveryGroups.reduce((P,k)=>P+(k.deliveryOptions?.length??0),0);this.logTelemetry("Google Pay resolved with no shipping options",{location:"handlePaymentDataRequestUpdate",intent:e,deliveryGroupCount:String(b.deliveryGroups.length),deliveryOptionCount:String(_),...a&&{destinationCountry:a},...i&&{destinationRegion:i}}),g.leaveBreadcrumb("Google Pay resolved with no shipping options",{deliveryGroupCount:b.deliveryGroups.length,deliveryOptionCount:_,intent:e,...this.transactionId&&{transactionId:this.transactionId},...a&&{destinationCountry:a},...i&&{destinationRegion:i}},"log")}return{newTransactionInfo:tr({cart:b,i18n:this.i18n,transactionId:this.transactionId}),newShippingOptionParameters:T,error:y.errors?.[0]}}case"show_error":return{error:m.errors?.[0]};case"decelerate":return N({checkoutUrl:m.redirectUrl,instrumentName:this.name,reason:m.reason}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}});case"abort":return this.showPaymentDataRequestError({intent:e});default:return this.logException("Payment sheet update returned unexpected action (see request tab for details)",{metadata:{request:{action:m.action,intent:e}}}),this.showPaymentDataRequestError({intent:e})}}handleIntermediatePaymentAuthorizationResult({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:o,shippingCity:i,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}){if(Yt({result:t,instrument:this.name}),t.abortReason==="out_of_stock")return lt({i18n:this.i18n,topLevelErrorHandler:this.topLevelErrorHandler,wallet:this.name}),{transactionState:"SUCCESS"};if(t.decelerationReason)return N({checkoutUrl:t.data?.checkoutUrl??"",instrumentName:this.name,reason:t.decelerationReason}),{transactionState:"SUCCESS"};const h=this.actionGenerator.mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:o,shippingCity:i,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u});switch(h.effects?.forEach(m=>m()),h.action){case"show_error":return this.handlePaymentAuthorizationError({error:h.errors?.[0],reason:`${r}_show_error`});case"abort":return this.handlePaymentAuthorizationError({error:h.errors?.at(0),reason:`${r}_abort`});case"decelerate":return this.emitAuthorizationCompleteMetric("success"),N({checkoutUrl:h.redirectUrl,instrumentName:this.name,reason:h.reason}),{transactionState:"SUCCESS"};default:return}}handlePaymentAuthorizationResult=async t=>
134{switch(t.effects?.forEach(e=>e()),t.action){case"complete":return this.emitAuthorizationCompleteMetric("success"),rt(t.redirectUrl),{transactionState:"SUCCESS"};case"show_error":return this.handlePaymentAuthorizationError({error:t.errors?.[0],reason:"completion_show_error"});case"decelerate":return N({checkoutUrl:t.redirectUrl,instrumentName:this.name,reason:t.reason}),this.emitAuthorizationCompleteMetric("failed"),this.logTelemetry("Google Pay authorization failed",{status:"failed",reason:"completion_decelerate"}),{transactionState:"SUCCESS"};default:return this.emitAuthorizationCompleteMetric("failed"),this.logTelemetry("Google Pay authorization failed",{status:"failed",reason:"completion_abort"}),{transactionState:"SUCCESS"}}};handleCurrencyChange(t,e){Lr({currentCartTotal:e,initialBuyerCurrency:this.initialBuyerCurrency})&&N({checkoutUrl:t,instrumentName:this.name,reason:"currency_changed"})}async handleShippingAddressChange(t,e){let r=await kt({cartClient:this.cartClient,cartId:t,streetAddress:e?er(e):{},instrumentName:p.GooglePay,abortSignal:this.#r?.signal});if(!r.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});if(this.cart=r.data,r.abortReason==="out_of_stock")return this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.product.out_of_stock")}});if(r.decelerationReason)return N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:r.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});const n=this.cart.deliveryGroups.map(({selectedDeliveryOption:a,deliveryOptions:o})=>a?.handle&&a.deliveryMethodType!=="LOCAL"?a.handle:o.filter(({deliveryMethodType:i})=>i==="SHIPPING")[0]?.handle).filter(Boolean);if(n.length>0){if(r=await this.handleDeliveryOptionChange(n),!r.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});this.cart=r.data}return this.handleCurrencyChange(this.cart.checkoutUrl,this.cart.totalAmount),this.handlePaymentDataRequestUpdate({result:r,intent:"SHIPPING_ADDRESS",checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentDataChanged::updateBuyerIdentity",shippingCountryCode:e?.countryCode,shippingZip:e?.postalCode||void 0,shippingProvince:e?.iso3166AdministrativeArea||void 0,shippingCity:e?.locality||void 0})}async handleDeliveryOptionChange(t){const e=wo({deliveryGroups:this.cart.deliveryGroups,instrumentName:p.GooglePay,selectedDeliveryOptionHandles:t});return await yo({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:p.GooglePay,selectedDeliveryOptions:e,abortSignal:this.#r?.signal})}logTelemetry(t,e={}){c.log({body:t,attributes:{instrument:this.name,...this.transactionId&&{transactionId:this.transactionId},...e}})}logException(t,{severity:e,metadata:r}={}){g.notify(new yr(t),{severity:e??"error",metadata:r})}emitAuthorizationCompleteMetric(t){c.authorizationComplete({instrument:this.name,measurement:Y(O.AuthorizationLatency,this.name),result:t})}};function qh(t,e){switch(e){case F.VariantRequiresSellingPlan:case F.SellingPlanNotApplicable:case F.InvalidQuantity:case F.MerchandiseIdInvalid:case F.IgnoredResponseError:case F.NoResponse:return t.translate("error_dialogs.checkout.generic_error");default:return t.translate("error_dialogs.checkout.generic_error")}}var Yh={LIGHT:"light",DARK:"dark"};function Kh(){return/SamsungBrowser\//.test(navigator.userAgent)}var Qh=class extends ht{name=p.GooglePay;paymentsClient=null;button=null;static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button)}async connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}handleClick=async()=>{if(this.disabled)return;this.disabled=!0,dt(this.name,this.pageType);const t=wt("AbortController");let e=!1,r=null,n=!1;const a=()=>{r&&(r.onCancel=void 0,r.dismiss(),Ia(),r=null)};try{await this.createPaymentsClient(t),e=!0,Kh()&&(r=Ih({i18n:await this.i18n,returnFocusTo:this.button,onCancel:()=>{n=!0,t?.abort("[Google Pay] User cancelled via Shopify scrim"),c.sheetCancelled(p.GooglePay),Ia(),this.disabled=!1,r=null}}),this.paymentsClient.dismissLoadingScrim=a),await this.paymentsClient.handleClick()}catch(o){if(a(),n)return;if(this.disabled=!1,o.statusCode==="CANCELED"){t?.abort("[Google Pay] Payment sheet cancelled"),c.sheetCancelled(p.GooglePay);return}t?.abort("[Google Pay] Payment sheet failure"),this.expectedError(o)?c.sheetClicked({instrument:this.name,result:"failed",reason:"expected_error"}):g.notify(o),e||(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Google Pay client creation",attributes:{error:String(o),location:"handleClick"}}));const[i,s]=await Promise.all([this.i18n,this.topLevelErrorHandler]),l=i.translate("brand.google_pay");U({i18n:i,topLevelErrorHandler:s,wallet:this.name,brand:l})}finally{a()}};async createPaymentsClient(t){this.paymentsClient=new jh({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,dataSource:await this.dataSource,button:this,cartClient:await this.apiClient,i18n:await this.i18n,topLevelErrorHandler:await this.topLevelErrorHandler,buyerCurrency:this.buyerCurrency,abortController:t,cardsinkUrl:this.walletParams.cardsinkUrl,cardsinkCallerIdentificationJwt:this.walletParams.cardsinkCallerIdentificationJwt})}async render(){const t=this.getOrCreateShadowRoot();if(this.button)return;await this.initializeShadowStyles(t,Th);const{translate:e}=await this.i18n,r=this.isCTA?e("buy_with_button_content",{wallet:e("brand.google_pay")}):e("brand.google_pay"),n=ze({label:r});this.disabled&&n.setAttribute("disabled",""),n.classList.add("button",_t.BUTTON,Yh[this.buttonTheme]),n.onclick=this.handleClick,await this.renderButtonContent(n,e),this.button=n,t.appendChild(n),this.ensureLightDOMIsNotEmpty(),this.onRendered()}async renderButtonContent(t,e){const r=Jt({instrumentName:p.GooglePay,logoType:this.buttonTheme}),n=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(t.style.font=window.getComputedStyle(this).font,this.isCTA){const a=Br({translate:e,logoElement:n,setAriaHidden:!0});a.classList.add("content"),t.appendChild(a)}else t.classList.add("logo-only"),t.appendChild(n)}expectedError(t){const e=typeof t=="string"?t:t?.message;return e==="failed to open window"||e==="(0 , $jscomp.asyncExecutePromiseGeneratorProgram) is not a function"}},Xh=class Gt extends pt{static googlePaySDKPromise;static walletName(){return"google_pay"}constructor(e){super(e)}getWebComponentName(){return"shopify-google-pay-button"}getInstrumentName(){return p.GooglePay}getWebComponentClass(){return Qh}async loadWalletSDK(){if(Gt.googlePaySDKPromise)return Gt.googlePaySDKPromise;const e=document.createElement("script");e.setAttribute("src",this.walletParams.sdkUrl);const r=new Promise((n,a)=>{e.onload=()=>n(),e.onerror=o=>{e.remove(),a(Fe("Google Pay",o))},document.body.appendChild(e)});return Gt.googlePaySDKPromise=Promise.all([r,this.loadLogos()]),Gt.googlePaySDKPromise}getLoadEligibility(){const e=ko(this.walletParams);switch(e.result){case"success":return{eligible:!0};case"error":return{eligible:!1,reason:e.reason}}}getPartnerSDKEligibility(){return{eligible:!0}}async loadLogos(){return Promise.all([this.loadGooglePayLogo(),this.loadGooglePayLogoDark()])}async loadGooglePayLogo(){await Nt({svg:"google-pay-logo.svg",instrumentName:p.GooglePay})}async loadGooglePayLogoDark(){await Nt({svg:"google-pay-logo-dark.svg",instrumentName:p.GooglePay,logoType:"DARK"})}},Jh=new Map([cd,vd,$r,Xh,ah,sh,So].map(t=>[t.walletName(),e=>new t(e)]));function Kt(t){if(!t)return null;const e=Jh.get(t.name);return e?e(t):(console.debug(`Can't build wallet with name ${t.name}`),null)}function Zh(t){return t.map(e=>Kt(e)).filter(e=>e!=null)}var To="*{box-sizing:border-box}
134.wallet-button-fade-in{animation:.3s cubic-bezier(.1,.79,1,1) animation-fade-in}@keyframes animation-fade-in{0%{opacity:0}to{opacity:1}}button[aria-disabled=true]{opacity:.5;cursor:not-allowed}";function tp({styleId:t,styles:e,cssFileName:r}){window.Shopify?.PaymentButton?.isStorefrontPortableWallets&&(ep({styleId:t,styles:e,cssFileName:r})||rp({styleId:t,styles:e}))}function ep({styleId:t}){const e=document.querySelector(`style#${t}`),r=document.querySelector(`link#${t}`);return!!(e||r)}function rp({styleId:t,styles:e}){const r=document.createElement("style");r.id=t,r.innerHTML=e,document.head.insertBefore(r,document.head.firstChild)}var 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 Ta(t){let e=0,r=0,n=0;const a=t.split(/\s+/);for(let o=0;o<a.length;o++){const i=a[o];i!==">"&&(i.includes("#")&&(e+=(i.match(/#/g)||[]).length),i.includes(".")&&(r+=(i.match(/\./g)||[]).length),i.includes("[")&&(r+=(i.match(/\[/g)||[]).length),i.includes(":")&&(r+=(i.match(/:[^:]/g)||[]).length),/^[A-Za-z]/.test(i)&&(n+=1))}return[e,r,n]}function ap(t,e){for(let r=0;r<3;r++)if(t[r]!==e[r])return e[r]-t[r];return 0}function Da(t){return[...t].sort((e,r)=>ap(Ta(e.selector),Ta(r.selector)))}var np=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*(>\s*)?li(?![a-zA-Z0-9_.:#-])/,op=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*\[role="?button"?\](?![:\w-])/,ip=/\.additional-checkout-buttons\s*(?:div\s*)?\[role="?button"?\](?![:\w-])/,Do=/\[data-shopify-buttoncontainer\](?![:\w-])/,Ro=/.dynamic-checkout-buttons .shopify-payment-button__button/,sp=/(?!.*\.shopify-cleanslate)\.shopify-payment-button__button(?:--branded)?(?![\w-:.#>])/,lp=/\.(shopify-payment-button|shopify-payment-button__button|shopify-payment-button__button--branded)\s*\[role="?button"?\](?![:\w-])/,cp=/(?:only\s+)?(?:screen\s+and\s+)?\((?:min|max)-(?:width|height):\s*\d+px\)/,dp=[op,Do,np,ip,Ro],up=[sp,lp,Ro],hp=.001;function Ra(t){return t.split(",").map(e=>e.trim())}function No(t){const e=t.pageType,r=e===S.ProductPage?up:dp,n=document.styleSheets;if(typeof n?.[Symbol.iterator]!="function")return"";const a=[...n].filter(pp),o=new Set;function i(B){for(const M of r){const $=B.match(M);if($)return o.add($[0]),!0}return!1}const s=[],l=[];a.forEach(B=>{try{for(const M of B.cssRules)if(M instanceof CSSMediaRule){const $=M;if(!cp.test($.conditionText))continue;for(const Mt of $.cssRules){if(!(Mt instanceof CSSStyleRule))continue;const ne=Ra(Mt.selectorText);for(const Wr of ne)i(Wr)&&l.push({selector:Wr,conditionText:$.conditionText,...za(Mt)})}}else if(M instanceof CSSStyleRule){const $=M,Mt=Ra($.selectorText);for(const ne of Mt)i(ne)&&s.push({selector:ne,...za($)})}}catch(M){me()("shopify-support-debug")&&(console.debug(`[shopify-support-debug] stylesheet origin: ${B.href}`),console.debug(M))}});const d=me()("shopify-support-debug");d&&console.table(Array.from(o));const u=s.reverse(),h=l.reverse(),m=Da(u),y=Da(h),b={},A=Na(e)?document.querySelector(".cart__blocks .button"):document.querySelector(".product-form__buttons .button");A&&(b.boxShadow=getComputedStyle(A,":before").boxShadow);for(const B of m){const M=["height","minHeight","borderRadius","marginTop"];Na(e)&&B.selector.match(Do)&&M.push("justifyContent");for(const $ of M)b[$]=Ep({rule:B,property:$,currentPropertyValue:b[$]})}const{height:T,borderRadius:_,minHeight:P,marginTop:k,justifyContent:L,boxShadow:x}=b;return d&&console.table([{property:"height",value:T},{property:"borderRadius",value:_},{property:"minHeight",value:P},{property:"marginTop",value:k},{property:"justifyContent",value:L},{property:"boxShadow",value:x}]),e===S.ProductPage?Ma({styles:{height:T,minHeight:P,borderRadius:_,marginTop:k,boxShadow:x},mediaRules:y,element:t}):Ma({styles:{borderRadius:_,boxShadow:x,justifyContent:L},mediaRules:y,element:t})}function Lo({element:t,styles:e,debug:r=!1}){if(!e)return;vp(e,t,r);const n=`global-${t.tagName.toLowerCase()}-styles`;if(document.head.querySelector(`style#${n}`)==null){const a=document.createElement("style");a.id=n,a.innerHTML=e,document.head.appendChild(a)}}function pp(t){const e=t.ownerNode instanceof HTMLLinkElement&&(t.ownerNode.getAttribute("crossorigin")==="anonymous"||t.ownerNode.getAttribute("crossorigin")==="");return t.href==null||t.href.startsWith(window.location.origin)||e}function Na(t){return t===S.CartPage||t===S.CartAjax}var mp=/\s*!important$/,gp=/(?:\d*\.)?\d+[a-z%]*/gi,fp=/^[\d.]+/;function yp(t){const e=t.replace(mp,"").trim();if(e.includes("var("))return!1;const r=(e.match(gp)??[]).map(n=>n.replace(fp,"").toLowerCase());return r.includes("%")&&r.every(n=>n==="%"||n==="")}function La(t,e){return t?t.includes(`var(${X.buttonBlockSize}`)||t==="auto"?!0:e&&yp(t):!1}function Oa({height:t,minHeight:e,dropPercentages:r=!1}){let n=t,a=e;return La(n,r)&&(n=null),La(a,r)&&(a=null),n===a?n:a&&n?`max(${n},${a})`:n||a}function xa({existingProperties:t,mediaCondition:e,selector:r,styles:n}){const a={...n};t.forEach(o=>{delete a[o]});for(const[o,i]of Object.entries(a))i?.startsWith(`var(${o}`)&&delete a[o];for(const[o,i]of Object.entries(a))(i==null||i==="")&&delete a[o];return Object.keys(a).length===0?"":bp({mediaCondition:e,selector:r,styles:a})}function bp({mediaCondition:t,selector:e,styles:r}){let n=`${t?`@media ${t} { `:""}${e} {`;
134for(const[a,o]of Object.entries(r))o&&(n+=` 135 ${a}: ${o};`);return n+=` 136}`,t&&(n+="}"),n+=` 137`,n}function Ma({styles:t,element:e,mediaRules:r}){const{height:n,minHeight:a,borderRadius:o,marginTop:i,justifyContent:s,boxShadow:l}=t,d=e.tagName.toLowerCase(),u=e.pageType===S.ProductPage,h=getComputedStyle(e),m=new Set;for(const b of Object.values(X))h.getPropertyValue(b)&&m.add(b);let y=xa({existingProperties:m,selector:d,styles:{[X.buttonBlockSize]:Oa({height:n,minHeight:a,dropPercentages:u}),[X.buttonBorderRadius]:o,[X.buttonBoxShadow]:l,[X.inlineAlignment]:s,"margin-top":i,display:i?"block":void 0}});return r.forEach(b=>{(b.height||b.minHeight||b.borderRadius||b.boxShadow||b.justifyContent||b.marginTop)&&(y+=xa({existingProperties:m,mediaCondition:b.conditionText,selector:d,styles:{[X.buttonBlockSize]:Oa({height:b.height,minHeight:b.minHeight,dropPercentages:u}),[X.buttonBorderRadius]:b.borderRadius,[X.buttonBoxShadow]:b.boxShadow,[X.inlineAlignment]:b.justifyContent,"margin-top":b.marginTop,display:b.marginTop?"block":void 0}}))}),y.trim()}var wp=[["height"],["minHeight","min-height"],["borderRadius","border-radius"],["marginTop","margin-top"],["justifyContent","justify-content"]];function za(t){return wp.reduce((e,[r,n])=>(e[r]=_p({rule:t,property:n??r}),e),{})}function _p({rule:t,property:e}){const r=t.style.getPropertyValue(e);return r!==""&&t.style.getPropertyPriority(e)?`${r} !important`:r||null}function Ep({rule:t,property:e,currentPropertyValue:r}){const n=t[e];return!r?.includes("!important")&&n?.includes("!important")?n:r??n}function Ap(t){const e=/(--[\w-]+)\s*:/g;let r;const n={};for(;(r=e.exec(t))!==null;){const a=r[1];n[a]=(n[a]||0)+1}return{properties:n,mediaQueryCount:(t.match(/@media\s+([^{]+)/g)||[]).length,marginTopCount:(t.match(/margin-top\s*:/g)||[]).length}}function vp(t,e,r){const n=window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes?.themeId;if(n&&(r&&c.log({body:"Style backwards compatibility used",attributes:{themeId:`${n}`}}),Math.random()<hp)){const a=Ap(t);for(const[o,i]of Object.entries(a.properties))c.styleBackwardsCompatibilityRules({rule:o,count:i,pageType:e.pageType});a.mediaQueryCount>0&&c.styleBackwardsCompatibilityRules({rule:"@media",count:a.mediaQueryCount,pageType:e.pageType}),a.marginTopCount>0&&c.styleBackwardsCompatibilityRules({rule:"margin-top",count:a.marginTopCount,pageType:e.pageType}),c.log({body:"Style backwards compatibility details",attributes:{themeId:`${n}`,pageType:e.pageType,stylesString:t.length>2e3?t.substring(0,2e3):t}})}}var Cp=2e3,Sp=()=>Cp*Sr(),br=class extends Error{};br.prototype.name="AcceleratedCheckoutError";var Pp=class xo extends xr{static instanceCount=0;instanceNumber=++xo.instanceCount;pageType=S.ProductPage;formObserver;dataSource;wrapper;shopPromiseEligible=!1;didInitiateRender=!1;didRecordWalletsLoadedFromFCP=!1;#t;static get observedAttributes(){return["access-token","disabled","has-selling-plan","requires-shipping"]}async connectedCallback(){super.connectedCallback();try{if(this.wrapper?.children?.length||this.didInitiateRender)return;if(!this.validateRenderingSurface()){this.clearUI();return}this.instanceNumber===1&&(Mr(this),c.initStarted(),tp({styleId:"shopify-accelerated-checkout-styles",styles:Jc,cssFileName:"AcceleratedCheckout.css"}),this.extractStyles()),this.shopPromiseEligible=dn();const e=Rt(O.ButtonDisplay,`dc:${this.instanceNumber}`);this.i18n=Oe(),this.setupFormObserver(),this.didInitiateRender=!0;const r=await this.loadWallet(),n=r.getInstrumentName();this.apiClient=new Be({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale}),this.dataSource=new bc(this,this.apiClient,n);const a=await this.getWebComponentInstance({wallet:r,instrumentName:n,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,topLevelErrorHandler:this.topLevelErrorHandler,buttonDisplayBenchmark:e});this.render(a,n),c.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(e){if(this.clearUI(),c.initCompleted(e),e instanceof Error&&e.name==="DeveloperError")throw e;g.notify(new br(`An error occurred while attempting to render AcceleratedCheckout: ${e}`,{cause:e}))}}async attributeChangedCallback(e,r,n){r!==n&&(Or(this,e,n),e==="has-selling-plan"&&n===""?this.showBuyerConsent(this.apiClient,this.i18n):e==="has-selling-plan"&&n===null&&this.hideBuyerConsent())}async getWebComponentInstance({wallet:e,instrumentName:r,dataSource:n,i18n:a,apiClient:o,topLevelErrorHandler:i,buttonDisplayBenc
137hmark:s}){const l=await e.createWebComponent({walletContainer:this,dataSource:n,i18n:a,apiClient:o,topLevelErrorHandler:i,classNames:Ip(r),callToAction:"true",pageType:this.pageType,containerInstanceNumber:this.instanceNumber,supportsSubscriptions:e.supportsSubscriptions,supportsDeferredPurchaseOptions:e.supportsDeferredPurchaseOptions,onRendered:()=>{c.instrumentLoaded({instrumentOrComponentName:r,result:"success",measurement:s()}),this.recordWalletsLoadedFromFCP(r)}});if(!l)throw new br(`No web component instance found for instrument ${r}`);return l}async render(e,r){this.clearUI();const n=this.getOrCreateShadowRoot(),a=document.createElement("style");a.innerHTML=To,n.appendChild(a),this.wrapper=document.createElement("div"),this.wrapper.className="wallet-button-fade-in wallet-button-wrapper";const o=document.createElement("slot");o.name="button",this.wrapper.appendChild(o);const i=document.createElement("slot");i.name="promise",this.wrapper.appendChild(i);const s=document.createElement("slot");s.name="more-options",this.wrapper.appendChild(s),n?.appendChild(this.wrapper),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),this.setupManagedMarketsHandlers(this.i18n);const l=new DocumentFragment;e&&l.appendChild(e);const d=this.getShopPromiseSlot();d&&l.appendChild(d);const u=this.getMorePaymentOptionsLink(r);u&&l.appendChild(u),this.appendChild(l)}recordWalletsLoadedFromFCP(e){this.didRecordWalletsLoadedFromFCP||!this.isPageLoadRender()||(this.didRecordWalletsLoadedFromFCP=!0,c.recordWalletsLoadedFromFCP({instrumentOrComponentName:e}))}isPageLoadRender(){return xe()===S.ProductPage}getMorePaymentOptionsLink(e){if(e===p.BuyItNow)return null;const r=document.createElement("more-payment-options-link");return xt(r,{"buyer-country":this.buyerCountry??"","access-token":this.accessToken??"","page-type":this.pageType,"wallet-instrument-name":e,slot:"more-options"}),r.disabled=this.disabled,r.setDataSource(this.dataSource),r.setI18n(this.i18n),r.setTopLevelErrorHandler(this.topLevelErrorHandler),r.setClassNames(ar.MORE_PAYMENT_OPTION_BUTTON),r}getShopPromiseSlot(){if(!this.shopPromiseEligible)return null;const e=document.createElement("div");return e.setAttribute("data-shopify","shop-promise-payment-button-slot"),e.style.height="100%",e.slot="promise",e}validateRenderingSurface(){return ae({page:"product",element:this})!=null}async loadWallet(){const e=this.recommendedWallet,r=Xc(e,this.fallbackWallet,"AcceleratedCheckout");return await Tp(this,{...r,instanceNumber:this.instanceNumber})}setupFormObserver(){this.formObserver||(this.formObserver=new zr(this,({disabled:e,hasSellingPlan:r})=>{this.disabled=e,this.hasSellingPlan=r,this.isShippingRequired=kp(this,this.variantParams)}),this.formObserver.setupMutationObservers())}getOrCreateShadowRoot(){return this.#t||(this.#t=this.attachShadow({mode:"closed"})),this.#t}extractStyles(){if(this.styleExtractorDisabled){me()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled"),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!1});return}const e=Rt(O.StyleExtract,`dc:${this.instanceNumber}`),r=No(this);r&&Lo({element:this,styles:r,debug:this.debug});const n=e();n&&c.styleBackwardsCompatibilityExecutionTime({measurement:n,pageType:this.pageType,stylesWritten:!!r}),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!!r})}};function Ip(t){return t===p.BuyItNow?ar.UNBRANDED_BUTTON:ar.BRANDED_BUTTON}function kp(t,e){const r=Tn(t);return!!e.find(n=>n.id===Number(r?.variantId))?.requiresShipping}async function Tp(t,{recommendedWallet:e,fallbackWallet:r,instanceNumber:n}){const a=e?Kt(e):null,o=Kt(r),i=async s=>{const l=Gn({walletInstrument:s,instanceNumber:n}),d="timeout",u=Sp(),h=await Promise.race([l,new Promise(m=>setTimeout(()=>m(d),u))]);if(h===d)c.instrumentSDKLoaded({instrument:s.getInstrumentName(),measurement:u,result:"timeout"});else if(h instanceof pt)return h;return null};if(Pe(t,a)){const s=await i(a);if(s)return s}if(Pe(t,o)){const s=await i(o);if(s)return s}return Kt(Wa)}tt("shopify-accelerated-checkout",Pp),tt("more-payment-options-link",Wc,{isChildCustomElement:!0});var Dp=t=>{if(typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?.includes("resource"))return null;const e=new PerformanceObserver(r=>{r.getEntriesByType("resource").some(n=>n.name.includes(oe.CartUpdate)||n.name.includes(oe.CartChange)||n.name.includes(oe.CartAdd)||n.name.includes(oe.CartClear))&&t()});return e.observe({entryTypes:["resource"]}),e},Rp=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:center;column-gap:10px;row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:repeat(auto-fit,minmax(min(100px,100%),1fr));margin:0;padding:0;display:grid}.wallet-cart-button-container{position:relative}.wallet-cart-button-container,.wallet-cart-button{min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;list-style-type:none!important}.wallet-cart-button{width:100%}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:1fr;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: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)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{grid-template-columns:none;grid-auto-columns:1fr;grid-auto-flow:column;justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width<210px){.wallet-cart-grid{grid-template-columns:1fr}.wallet-cart-button-container,.wallet-cart-button{min-width:0}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+3){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))~.wallet-cart-drawer-toggle{display:block}}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7)){grid-template-columns:1fr}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7))>.wallet-cart-button-container{min-width:0}@container wrapper (width>=210px) and (width<320px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n){justify-self:var(--shopify-accelerated-checkout-inline-alignment,center);grid-column:1/-1;width:calc(50% - 5px)}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+5){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle{display:block}}@container wrapper (width>=320px) and (width<430px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))){grid-template-columns:repeat(2,1fr)}}@container wrapper (width>=320px) and (width<540px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(6,1fr)}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container{grid-column:span 2;justify-self:stretch;width:auto}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4){grid-column:2/span 2}}@container wrapper (width>=430px) and (width<650px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(3,1fr)}}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child,shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child{grid-column:1/-1}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)){grid-template-columns:repeat(auto-fit,minmax(max(100px,33.3333% - 6.66667px),1fr))}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(auto-fit,minmax(max(100px,50% - 5px),1fr))}@container wrapper (width>=320px){:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(6,1fr)}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child){grid-column:span 2}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5){grid-column:2/span 2}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5){display:none}}.wallet-cart-drawer-toggle{cursor:pointer;text-align:center;width:100%;padding:var(--shopify-accelerated-checkout-row-gap,8px) 0 0;color:inherit;background:0 0;border:none;font-size:.875em;text-decoration:underline;display:none}::slotted(.wallet-cart-drawer-toggle){cursor:pointer;text-align:center;width:100%;color:inherit;background:0 0;border:none;padding:0;font-size:.875em;text-decoration:underline}.wallet-cart-drawer-toggle--skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);width:140px;height:20px;margin:var(--shopify-accelerated-checkout-row-gap,8px) auto 0;color:#0000;border-radius:4px;text-decoration:none;animation-delay:-.168s;overflow:hidden}@media screen and (width<=750px){.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports not (display:grid){.wallet-cart-grid{flex-direction:column;display:flex}.wallet-cart-button-container{width:100%}}.screen-reader-text{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}",Np=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:center;column-gap:10px;row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:repeat(auto-fit,minmax(min(100px,100%),1fr));margin:0;padding:0;display:grid}.wallet-cart-button-container{position:relative}.wallet-cart-button-container,.wallet-cart-button{min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;list-style-type:none!important}.wallet-cart-button{width:100%}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:1fr;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: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)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{grid-template-columns:none;grid-auto-columns:1fr;grid-auto-flow:column;justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width<210px){.wallet-cart-grid{grid-template-columns:1fr}.wallet-cart-button-container,.wallet-cart-button{min-width:0}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+3){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))~.wallet-cart-drawer-toggle{display:block}}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7)){grid-template-columns:1fr}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7))>.wallet-cart-button-container{min-width:0}@container wrapper (width>=210px) and (width<320px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n){justify-self:var(--shopify-accelerated-checkout-inline-alignment,center);grid-column:1/-1;width:calc(50% - 5px)}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+5){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle{display:block}}@container wrapper (width>=320px) and (width<430px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))){grid-template-columns:repeat(2,1fr)}}@container wrapper (width>=320px) and (width<540px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(6,1fr)}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container{grid-column:span 2;justify-self:stretch;width:auto}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4){grid-column:2/span 2}}@container wrapper (width>=430px) and (width<650px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(3,1fr)}}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child,shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child{grid-column:1/-1}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)){grid-template-columns:repeat(auto-fit,minmax(max(100px,33.3333% - 6.66667px),1fr))}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(auto-fit,minmax(max(100px,50% - 5px),1fr))}@container wrapper (width>=320px){:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(6,1fr)}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child){grid-column:span 2}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5){grid-column:2/span 2}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5){display:none}}.wallet-cart-drawer-toggle{cursor:pointer;text-align:center;width:100%;padding:var(--shopify-accelerated-checkout-row-gap,8px) 0 0;color:inherit;background:0 0;border:none;font-size:.875em;text-decoration:underline;display:none}::slotted(.wallet-cart-drawer-toggle){cursor:pointer;text-align:center;width:100%;color:inherit;background:0 0;border:none;padding:0;font-size:.875em;text-decoration:underline}.wallet-cart-drawer-toggle--skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);width:140px;height:20px;margin:var(--shopify-accelerated-checkout-row-gap,8px) auto 0;color:#0000;border-radius:4px;text-decoration:none;animation-delay:-.168s;overflow:hidden}@media screen and (width<=750px){.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports not (display:grid){.wallet-cart-grid{flex-direction:column;display:flex}.wallet-cart-button-container{width:100%}}.screen-reader-text{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}",Lp=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:var(--shopify-accelerated-checkout-inline-alignment,start);flex-direction:row;margin:0 -5px -5px;padding:0;display:flex}.wallet-cart-button-container{margin:0 5px 5px;position:relative}.wallet-cart-button-container,.wallet-cart-button{width:auto;min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;flex:1 1 0;list-style-type:none!important}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{flex-direction:column;justify-content:flex-start;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:var(--shopify-accelerated-checkout-row-gap,8px) 0 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)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width>=100px) and (width<=500px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).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<=210px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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<=320px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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<=430px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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<=540px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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 (width<=750px){.wallet-cart-grid{justify-content:stretch}.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports (not (container-type:inline-size)) or (not selector(:has(*))){.wallet-cart-grid{flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 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{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}",Op=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:var(--shopify-accelerated-checkout-inline-alignment,start);flex-direction:row;margin:0 -5px -5px;padding:0;display:flex}.wallet-cart-button-container{margin:0 5px 5px;position:relative}.wallet-cart-button-container,.wallet-cart-button{width:auto;min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;flex:1 1 0;list-style-type:none!important}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{flex-direction:column;justify-content:flex-start;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:var(--shopify-accelerated-checkout-row-gap,8px) 0 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)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width>=100px) and (width<=500px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-b
137utton-container:nth-of-type(2))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).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:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).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<=210px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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<=320px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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<=430px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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<=540px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):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:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):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 (width<=750px){.wallet-cart-grid{justify-content:stretch}.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports (not (container-type:inline-size)) or (not selector(:has(*))){.wallet-cart-grid{flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 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{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}";function xp(t){const e=ae({page:"cart",element:t});return kn({type:"attributes",form:e})}var Mp=class{element;cartToken;apiClient;constructor(t,e,r){this.element=t,this.cartToken=e,this.apiClient=r}async getInitialCart(t){try{const e=`gid://shopify/Cart/${this.cartToken}`,r=xp(this.element);let n,a=[];if(r.length){const o=await this.apiClient.updateCartAttributes({cartId:e,attributes:r,instrumentName:t,startingCheckout:!0});n=o.data,a=o.errors}else n=await this.apiClient.fetchCart({id:e,instrumentName:t,startingCheckout:!0});return{cart:n,errors:a}}
137catch(e){if(e instanceof et)return{cart:null,errors:[{code:"NO_RESPONSE"}]};throw e}}},zp=class Oo extends xr{static instanceCount=0;instanceNumber=++Oo.instanceCount;pageType=S.CartPage;cartObserver=null;dataSource=null;wrapper;didInitiateRender=!1;didDeferRenderUntilCartChange=!1;didRecordWalletsLoadedFromFCP=!1;didRenderAnyWallet=!1;#t;constructor(){super()}static get observedAttributes(){return["access-token","has-selling-plan","requires-shipping","shop-pay-emphasis"]}createDataSource(){if(!this.cartToken){c.cartTokenMissing({reason:"createDataSource"});return}this.apiClient=new Be({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale}),this.dataSource=new Mp(this,this.cartToken,this.apiClient)}async createWebComponents({shouldRefetchCartAttributes:e}){if(!this.walletConfigs)throw new W({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] walletConfigs does not exist"});const r=jc(this.walletConfigs,"AcceleratedCheckoutCart");if(!(r instanceof Array))throw new W({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] invalid walletConfigs found"});const n=O.ButtonDisplay,a=s=>`${s}:${this.instanceNumber}`,o=await Fp(this,{walletConfigs:r,startButtonDisplayBenchmark:s=>Ot(n,a(s))});if(this.createDataSource(),!this.dataSource)return[];e&&await this.updateAttributes();const i=new Set(o.map((s,l)=>l));return await Promise.all(o.map(async(s,l)=>{const d=s.getInstrumentName();return await s.createWebComponent({walletContainer:this,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,topLevelErrorHandler:this.topLevelErrorHandler,pageType:this.pageType,containerInstanceNumber:this.instanceNumber,slot:`button-${s.getInstrumentName()}`,supportsSubscriptions:s.supportsSubscriptions,supportsDeferredPurchaseOptions:s.supportsDeferredPurchaseOptions,onRendered:(()=>{let u=!1;return()=>{u||(u=!0,c.instrumentLoaded({instrumentOrComponentName:d,result:"success",measurement:Y(n,a(d))}),this.settleWalletRender(l,i,"success"))}})(),onRenderFailed:()=>this.settleWalletRender(l,i,"failed")})}))}async cartChangedCallback(){try{if(!this.dataSource&&this.cartToken){this.didDeferRenderUntilCartChange=!0,await this.render({shouldRefetchCartAttributes:!0}),c.initCompleted();return}else if(!this.cartToken){c.cartTokenMissing({reason:"cartChangedCallback"});return}await this.updateAttributes()}catch(e){this.clearUI(),g.notify(e)}}async updateAttributes(){if(!this.cartToken||!this.apiClient)return;const e=await this.apiClient.fetchLimitedCart({id:`gid://shopify/Cart/${this.cartToken}`,instrumentName:p.Unknown});this.hasSellingPlan=e.sellingPlan??!1,this.isShippingRequired=e.shippingRequired??!1}async connectedCallback(){super.connectedCallback();try{if(this.didInitiateRender)return;if(this.instanceNumber===1&&Mr(this),c.initStarted(),this.cartObserver=Dp(()=>this.cartChangedCallback()),!this.cartObserver){c.log({body:"Cart observer unavailable - PerformanceObserver not supported"}),this.clearUI();return}if(!this.cartToken){c.cartTokenMissing({reason:"connectedCallback"});return}await this.render({shouldRefetchCartAttributes:!1}),c.initCompleted()}catch(e){this.clearUI(),c.initCompleted(e),g.notify(e)}}disconnectedCallback(){super.disconnectedCallback(),this.cartObserver?.disconnect()}async attributeChangedCallback(e,r,n){r!==n&&(Or(this,e,n),e==="has-selling-plan"&&n===""?this.showBuyerConsent(this.apiClient,this.i18n):e==="has-selling-plan"&&n===null&&this.hideBuyerConsent())}get cartToken(){return wr("cart")}async render({shouldRefetchCartAttributes:e}){if(this.i18n=Oe(),this.hasLegacyCartCookie()){c.legacyCartCookie(),this.clearUI();return}this.didInitiateRender=!0;const r=Rt(O.ButtonDisplay,`cart:${this.instanceNumber}`),n=await this.createWebComponents({shouldRefetchCartAttributes:e});if(this.clearUI(),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),this.setupManagedMarketsHandlers(this.i18n),n.length===0)return;const a=new DocumentFragment,o=this.getOrCreateShadowRoot(),i=Q.enabled(na)?Rp:Lp,s=document.createElement("style");s.innerHTML=[To,i].join(` 138`),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=this.i18n.translate("express_checkout"),this.wrapper.appendChild(l);const d=document.createElement("div");d.className=`wallet-cart-grid ${_t.CONTAINER}
138`,Object.entries(Up).forEach(([u,h])=>{document.querySelector(u)&&d.classList.add(h)}),n.forEach(u=>{const h=document.createElement("div"),m=document.createElement("div"),y=document.createElement("slot");y.name=`button-${u.name}`,h.className="wallet-cart-button-container",m.className="wallet-cart-button",h.setAttribute("data-testid","grid-cell"),h.appendChild(m),m.appendChild(y),d.appendChild(h),a.appendChild(u)}),this.wrapper.appendChild(d),o.appendChild(this.wrapper),this.appendChild(a),c.instrumentLoaded({instrumentOrComponentName:"AcceleratedCheckoutCart",result:"success",measurement:r()})}settleWalletRender(e,r,n){r.delete(e)&&(n==="success"&&(this.didRenderAnyWallet=!0),!(r.size>0||this.didRecordWalletsLoadedFromFCP)&&(!this.didRenderAnyWallet||!this.isConnected||!this.isPageLoadRender()||(this.didRecordWalletsLoadedFromFCP=!0,c.recordWalletsLoadedFromFCP({instrumentOrComponentName:"AcceleratedCheckoutCart"}))))}isPageLoadRender(){return!this.didDeferRenderUntilCartChange&&xe()===S.CartPage}getOrCreateShadowRoot(){return this.#t||(this.#t=this.attachShadow({mode:"closed"})),this.#t}hasLegacyCartCookie(){return this.cartToken?this.cartToken?.match(/^[a-z0-9]+$/):!1}extractStyles(){if(this.styleExtractorDisabled){me()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled"),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!1});return}const e=Rt(O.StyleExtract,`cart:${this.instanceNumber}`),r=No(this);if(r){Lo({element:this,styles:r,debug:this.debug});const a=this.getOrCreateShadowRoot(),o=Q.enabled(na),i=document.createElement("style");i.innerHTML=o?Np:Op,a.appendChild(i)}const n=e();n&&c.styleBackwardsCompatibilityExecutionTime({measurement:n,pageType:this.pageType,stylesWritten:!!r}),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!!r})}};async function Fp(t,{walletConfigs:e,startButtonDisplayBenchmark:r=()=>{}}){const n=Yc(t,Zh(e));return(await Promise.all(n.map(a=>(r(a.getInstrumentName()),Gn({walletInstrument:a,instanceNumber:t.instanceNumber}))))).filter(a=>a!=null)}var Up={".additional-checkout-buttons--vertical shopify-accelerated-checkout-cart":"wallet-cart-grid--vertical",".additional-checkout-buttons--horizontal shopify-accelerated-checkout-cart":"wallet-cart-grid--horizontal"};tt("shopify-accelerated-checkout-cart",zp);var Bp=class{getInitialCart(){throw new Error('[NoOpDataSource] Unexpected call to "getCart"')}},Hp=class Mo extends xr{static instanceCount=0;instanceNumber=++Mo.instanceCount;pageType=S.Checkout;get walletConfig(){return this.getAttribute("wallet-config")}async connectedCallback(){super.connectedCallback();try{if(this.i18n=Oe(),this.children.length)return;this.instanceNumber===1&&(Mr(this),c.initStarted());const e=Rt(O.ButtonDisplay,`dc:${this.instanceNumber}`),r=qc(this.walletConfig,"WalletButton");if(!r)throw new Ka("[WalletButton] No config provided.");const n=Kt(r);if(!n)return;if(!await this.eligibleToShow(n)){this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:"ineligible"}}));return}if(this.onlySdk){c.initCompleted(),this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}}));return}const a=n.getInstrumentName();this.apiClient=new Be({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale});const o=await this.createWebComponent(n,this.i18n,this.apiClient,this.topLevelErrorHandler,a,e);this.innerHTML="",this.appendChild(o),c.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(e){this.innerHTML="",this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:Gp(e)}})),c.initCompleted(e),g.notify(e)}}async createWebComponent(e,r,n,a,o,i){const s=await e.createWebComponent({walletContainer:this,dataSource:new Bp,i18n:r,apiClient:n,topLevelErrorHandler:a,containerInstanceNumber:this.instanceNumber,pageType:this.pageType});return s.onRendered=()=>{this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}})),c.instrumentLoaded({instrumentOrComponentName:o,result:"success",measurement:i()})},s}async eligibleToShow(e){return!(!Pe(this,e)||(await e.loadWalletSDK(),!e.getPartnerSDKEligibility().eligible))}};function Gp(t){if(t instanceof Error)return t.message;try{return JSON.stringify(t)??String(t)}catch{return String(t)}}tt("shopify-wallet-button",Hp),Ko(g,{metadata:{custom:{"notify-origin":"window-onerror"}}}),Qo(g,{metadata:{custom:{"notify-origin":"unhandled-promise-rejection-handler"}}}),c.startExporter();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.