PageSourceSearch

https://www.tristanstyle.com/cdn/shopifycloud/checkout-web/assets/…ets-rendering-extension-targets.CtUkCn-H.js

js tristanstyle.com collected 2026-09-25 23:41:06 UTC 91,158 bytes, 8 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["apply-cart-line-change.Cbl-yI6B.js","addresses-is-address-empty.Bn2lNY_L.js","esnext-vendor.B9Da21W6.js","app.DbSrjjlA.js","assets/app.Sxsz5knT.css","assets/is-address-empty.DJksNKpk.css","graphql-PaymentSessionMutation.CAXCwUvV.js","utilities-extension-execution-errors.Bov3aYbn.js","hydrate.DZ4YTm7p.js","hooks-useShopPayExternalAppContext.DWwMuRnz.js","hooks-useReplaceShopPayInHistory.DPpLejwu.js","assets/previous.owLoDmpy.css","dist-v4.EwEgHOG0.js","AnnouncementRuntimeExtensions.CyqR_T7y.js","QRCode.CJw16n0F.js","assets/QRCode.BZ_m5G5a.css","Pressable.ZFaj0-Rx.js","assets/Pressable.D9SfDfsb.css","Checkbox.DQyvbr9E.js","assets/Checkbox.SrYMuQu4.css","Choice.DSKmQsTS.js","assets/Choice.aPApdPe_.css","utilities-dates.ChO2GdxN.js","Popover.BScgzCsS.js","assets/Popover.Bi1nHaU-.css","PaymentIcon.CIva5Q4J.js","assets/PaymentIcon.gzvCNwz_.css","NumberField.C_TDDWmw.js","assets/NumberField.CRpcZnVJ.css","Switch.jEKUIqPZ.js","assets/Switch.BS8yVgoP.css","extensions-remote-dom.MLww-Mka.js","EmailField.M5oHXAvJ.js","TextArea.C1mMoZ65.js","Sheet.CvqBdJB1.js","assets/Sheet.CpR5hiDV.css","styles-floating-layer.module.BCoSmdvP.js","assets/floating-layer.DfWUBaTh.css","hooks-useForceShopPayUrl.BFRInJvm.js","AddressPresenter.BIgrto4P.js","PhoneField.C0TeiZrn.js","components-RedirectionNotice.module.CsVdFi0g.js","amazon-pay-useAmazonPayPaymentLine.Ju006AId.js","assets/RedirectionNotice.B8v_QGNW.css","hooks-useSuppressShopPayModalOnLoad.DFOLDSdS.js","assets/PhoneField.uZEuHncj.css","hooks-useShowShopPayOptin.Br0M25ky.js","assets/AnnouncementRuntimeExtensions.D2R3fBzd.css","consent-manager-shared.DROIEFP2.js","performance-index.mu6MOGR9.js","Page.jjGbeNkl.js","assets/Page.BYM12A8B.css"])))=>i.map(i=>d[i]);
2import{A as D,i as Bn,t as _e,b as Yn,d as Me}from"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";import{cJ as y,j0 as $n,S as Fn,fY as qe,aP as ns,dH as Hn,g as ts,H as Ce,dX as Ye,e0 as zn,bg as Jn,cl as jn,bi as is,bf as qn,j1 as Kn,cK as Ke,bx as fn,bk as Qn,h as mn,bX as rs,bY as os,i9 as Wn,aL as yn}from"./addresses-is-address-empty.Bn2lNY_L.js";import{o as hn,p as ze,q as vn,r as An,s as Ae,d as Xn,U as Zn,S as as,t as gn,I as xn,D as et,u as En,O as st}from"./utilities-extension-execution-errors.Bov3aYbn.js";import{d_ as ne,cT as nt,fX as tt,fU as Qe,hg as it,hh as $e,hi as De,hj as rt,hk as In,dI as pe,aw as Ee,bC as Fe,bD as He,hl as ot,cS as at,hm as ut,gO as us,hn as dt}from"./hydrate.DZ4YTm7p.js";import{o as b,f as ct,T as lt,e as pt,h as ft,j as mt,y as ye,R as _n,a4 as Rn,aw as yt,r as ht}from"./esnext-vendor.B9Da21W6.js";import{c as vt,i as At,e as gt}from"./graphql-PaymentSessionMutation.CAXCwUvV.js";import{g as Et,b as It,a as B}from"./AnnouncementRuntimeExtensions.CyqR_T7y.js";import{_ as _t}from"./app.DbSrjjlA.js";import{p as Rt,c as be,g as Dt,q as bt}from"./consent-manager-shared.DROIEFP2.js";import{e as ds}from"./performance-index.mu6MOGR9.js";import{e as St,g as Tt}from"./Page.jjGbeNkl.js";import{v as Ot}from"./dist-v4.EwEgHOG0.js";const Dn=e=>e??[];function Ar(e){const s=e.merchantVisitorConsent();return{allowedProcessing:e.merchantAllowedProcessing(),visitorConsent:{analytics:be(s.analytics),marketing:be(s.marketing),preferences:be(s.preferences),saleOfData:be(s.sale_of_data)},shouldShowBanner:e.shouldShowBanner.value,saleOfDataRegion:e.saleOfDataRegion.value,region:Rt(e.getRegion.value),metafields:Dn(e.merchantMetafields())}}const gr={allowedProcessing:{analytics:!1,marketing:!1,preferences:!1,saleOfData:!1},visitorConsent:{analytics:void 0,marketing:void 0,preferences:void 0,saleOfData:void 0},shouldShowBanner:!1,saleOfDataRegion:!1,region:void 0,metafields:[]},Nt="Capability not specified: Please declare this in your config: collect_buyer_consent.customer_privacy = true.",Lt="Personal data approval scope missing",Pt="The Customer Privacy API is not supported in Shop Pay.";function kt(){return typeof navigator<"u"&&$n(navigator.userAgent)}function wt(e,s){const n=s!=null&&s>=400?`Failed to set tracking consent: ${e} (HTTP ${s})`:`Failed to set tracking consent: ${e}`;return s===401?new vn(n):s!=null&&s>
2=400?new An(n):kt()&&e.includes("The string did not match the expected pattern")?new hn(n):new ze(n)}function re({customerPrivacySignal:e,createSubscribableFromSignal:s,extension:n,storefrontTokens:t,applyChange:i,extensionInstance:r,checkout:o,consentManager:u}){const l=n.capabilities.collectBuyerConsent?.customerPrivacy===!0,d=ne(n.approvalScopes,D.CustomerPersonalData);async function a(p){return i({unknownChange:p,extension:n,extensionInstanceId:r.id,allowChangeAfterJourneyCompletion:!0,allowChangeDuringAcceleratedWallet:!0,handlers:{async changeVisitorConsent({change:c}){if(!l)throw new y(Nt);if(!d)throw new y(Lt);if(o.identity.current.value==="shopPay")throw new y(Pt);const f=(c.metafields||[]).filter(v=>v.value!==void 0);if(!!!f.length&&c.analytics===void 0&&c.marketing===void 0&&c.preferences===void 0&&c.saleOfData===void 0)return{type:"success"};const h=await t.get(n.appId,n.type,"customerPrivacy"),E=e.peek();return new Promise((v,g)=>{u.setTrackingConsent({analytics:c.analytics,marketing:c.marketing,preferences:c.preferences,saleOfData:c.saleOfData,isExtensionToken:!0,storefrontAccessToken:h??void 0,...f.length&&{metafields:f}},(...[A,P])=>{if(P)e.value={...E,allowedProcessing:u.merchantAllowedProcessing(),metafields:Dn(u.merchantMetafields()),visitorConsent:{analytics:c.analytics,marketing:c.marketing,preferences:c.preferences,saleOfData:c.saleOfData}},v({type:"success"});else if(A instanceof Error)g(new y(`Failed to set tracking consent: ${A.message}`));else if(A&&"error"in A){const I=String(A.error),k=A.statusCode,R=wt(I,k);g(R)}else g(new ze("Received unexpected callback from setTrackingConsent()"))})})}},errorResult:c=>c instanceof y||c instanceof hn||c instanceof ze||c instanceof vn||c instanceof An?{type:"error",message:c.message}:{type:"error",message:`Failed to set tracking consent: ${c.message}`}})}return{applyTrackingConsentChange:a,customerPrivacy:s(b(()=>{const{region:p,...c}=e.value,{countryCode:f,provinceCode:m}=p||{};return{...c,region:f||m?{countryCode:d?f:void 0,provinceCode:d?m:void 0}:void 0}}))}}function Er(){const{source:e,checkout:s}=Fn(),n=nt();return ct(()=>
2{const t=s.addressManager.shipping.value.applyAddressChangeBlockReason("ui-extension");return Mt({sourceType:e.type,canUpdateDiscountCodes:n.value,canSelectCustomAddress:!t.value})})}function Mt({sourceType:e="checkout",canUpdateDiscountCodes:s,canSelectCustomAddress:n}){const t=e==="draftOrder";return{attributes:{canUpdateAttributes:!0},delivery:{canSelectCustomAddress:n},discounts:{canUpdateDiscountCodes:s},lines:{canAddCartLine:!t,canRemoveCartLine:!t,canUpdateCartLine:!t},metafields:{canSetCartMetafields:!0,canDeleteCartMetafield:!0},notes:{canUpdateNote:!t}}}function he(e,s){return`${e} is not supported on this checkout. Consider checking "instructions.${s}" first.`}function Ir(e){const s=lt(()=>new Map,[]),n=pt(s);return ft(()=>{Ct(s,e)},[e,s]),n}function Ct(e,s){for(const n of s)Vt(e,n.id)}function Vt(e,s){const n=e.get(s);if(n)return n;let t=()=>{};const r={promise:new Promise(o=>{t=o}),resolve:t};return e.set(s,r),r}function _r(e,s,n){e.get(s)===n&&e.delete(s)}function Ut(e,s,n){return!n||e.get(s)!==n?!1:(n.resolve(),!0)}function cs(e){const s=e.type==="local"?void 0:e.registrationId;return{appId:e.appId,appName:e.appName,extensionId:Qe(e),extensionRegistrationId:s,extensionName:e.name,extensionVersion:e.version,extensionApiVersion:e.apiVersion,extensionTarget:e.extensionPoint.target,extensionPlacement:e.placementReference,extensionType:e.type,isHighValueExtension:s!=null&&tt.has(s),isRemoteDom:e.apiVersion?Bn(e.apiVersion):!1}}function Te(e,s=bn){let n,t=!1;return b(()=>{const i=e();return t?s(n,i)?n:(n=i,i):(t=!0,n=i,i)})}function Gt(e){return Te(e,qe)}function Bt(e){return Te(e,Yt)}function Yt(e,s){if(e===s)return!0;if(!Array.isArray(e)||!Array.isArray(s)||e.length!==s.length)return!1;for(let n=0;n<e.length;n++)if(!bn(e[n],s[n]))return!1;return!0}function bn(e,s){if(e===s)return!0;if(e==null||s==null||typeof e!="object"||typeof s!="object")return!1;const n=Object.keys(e),t=Object.keys(s);return n.length!==t.length?!1:n.every(i=>e[i]===s[i])}const $t={name:D.CustomerName,firstName:D.CustomerName,lastName:D.CustomerName,company:void 0,address1:D.CustomerAddress,address2:D.CustomerAddress,city:void 0,zip:D.CustomerAddress,countryCode:D.CustomerPersonalData,provinceCode:void 0,phone:D.CustomerPhone,oneTimeUse:void 0},Ft=["DELIVERY_FIRST_NAME_REQUIRED","DELIVERY_FIRST_NAME_TOO_LONG","DELIVERY_FIRST_NAME_CONTAINS_EMOJIS","DELIVERY_FIRST_NAME_CONTAINS_HTML_TAGS","DELIVERY_FIRST_NAME_CONTAINS_URL","DELIVERY_FIRST_NAME_CONTAINS_MATHEMATICAL_SYMBOLS"],Ht=["DELIVERY_LAST_NAME_REQUIRED","DELIVERY_LAST_NAME_TOO_LONG","DELIVERY_LAST_NAME_CONTAINS_EMOJIS","DELIVERY_LAST_NAME_CONTAINS_HTML_TAGS","DELIVERY_LAST_NAME_CONTAINS_URL","DELIVERY_LAST_NAME_CONTAINS_MATHEMATICAL_SYMBOLS"],zt=["DELIVERY_COMPANY_REQUIRED","DELIVERY_COMPANY_TOO_LONG","DELIVERY_COMPANY_CONTAINS_EMOJIS","DELIVERY_COMPANY_CONTAINS_HTML_TAGS","DELIVERY_COMPANY_CONTAINS_MATHEMATICAL_SYMBOLS"],Jt=["DELIVERY_ADDRESS1_REQUIRED","DELIVERY_ADDRESS1_TOO_LONG","DELIVERY_ADDRESS1_CONTAINS_EMOJIS","DELIVERY_ADDRESS1_CONTAINS_HTML_TAGS","DELIVERY_ADDRESS1_CONTAINS_MATHEMATICAL_SYMBOLS"],jt=["DELIVERY_ADDRESS2_REQUIRED","DELIVERY_ADDRESS2_TOO_LONG","DELIVERY_ADDRESS2_CONTAINS_EMOJIS","DELIVERY_ADDRESS2_CONTAINS_HTML_TAGS","DELIVERY_ADDRESS2_CONTAINS_MATHEMATICAL_SYMBOLS"],qt=["DELIVERY_CITY_REQUIRED","DELIVERY_CITY_TOO_LONG","DELIVERY_CITY_CONTAINS_EMOJIS","DELIVERY_CITY_CONTAINS_HTML_TAGS","DELIVERY_CITY_CONTAINS_MATHEMATICAL_SYMBOLS"],Kt=["DELIVERY_PHONE_NUMBER_REQUIRED","DELIVERY_PHONE_NUMBER_CONTAINS_EMOJIS","DELIVERY_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"],Qt=["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY","DELIVERY_ZONE_NOT_FOUND"],Wt=["DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY","DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE","DELIVERY_POSTAL_CODE_CONTAINS_EMOJIS","DELIVERY_POSTAL_CODE_REQUIRED","DELIVERY_POSTAL_CODE_NOT_SUPPORTED","DELIVERY_POSTAL_CODE_CONTAINS_MATHEMATICAL_SYMBOLS"],Xt=["DELIVERY_COUNTRY_REQUIRED"],Je={firstName:Ft,lastName:Ht,company:zt,address1:Jt,address2:jt,city:qt,provinceCode:Qt,zip:Wt,phone:Kt,countryCode:Xt,oneTimeUse:[]},Zt=new Map(Object.entries(Je).flatMap(([e,s])=>s.map(n=>[n,e])));function xt(e){return Object.keys(e).length===0}function w({createSubscribableFromSignal:e,extension:s,negotiated:n,proposed:t,journeyCompletedSignal:i,cartInstructionsSignal:r,applyChange:o,extensionInstance:u,captureEvent:l,observability:d,checkout:a}){if(!ne(s.approvalScopes,D.CustomerPersonalData))return{billingAddress:void 0,shippingAddress:void 0};const p=(v,g)=>ne(s.approvalScopes,g)?v:void 0;let c;const f=Te(()=>{const v=R=>{if(R===void 0||xt(R))return;const{address1:ie,address2:Z,city:fe,company:me,countryCode:ce,firstName:T,lastName:S,name:N,phone:L,oneTimeUse:Re,zoneCode:Ge,postalCode:Be}=R;return{address1:p(ie,D.CustomerAddress),address2:p(Z,D.CustomerAddress),city:fe,company:me,countryCode:p(ce,D.CustomerPersonalData),firstName:p(T,D.CustomerName),lastName:p(S,D.CustomerName),name:p(N,D.CustomerName),phone:p(L,D.CustomerPhone),provinceCode:Ge,zip:p(Be,D.CustomerAddress),oneTimeUse:Re}};
2if(n.fields.isShippingRequired.value===!1)return;if(i.value)return v(n.fields.shippingAddress.peek());const A=v(t.shippingAddress.value),P=t.shippingAddress.value?.countryCode,I=c?.countryCode;return t.shippingAddress.dirtyFields.value.has("countryCode")&&I&&P!==I?c:(c=A,A)}),m=Te(()=>{const v=A=>{if(A===void 0)return;const{address1:P,address2:I,city:k,company:R,countryCode:ie,firstName:Z,lastName:fe,name:me,phone:ce,zoneCode:T,postalCode:S}=A;return{address1:p(P,D.CustomerAddress),address2:p(I,D.CustomerAddress),city:k,company:R,countryCode:p(ie,D.CustomerPersonalData),firstName:p(Z,D.CustomerName),lastName:p(fe,D.CustomerName),name:p(me,D.CustomerName),phone:p(ce,D.CustomerPhone),provinceCode:T,zip:p(S,D.CustomerAddress)}};if(i.value)return v(n.fields.billingAddress.peek());const g=t.billingAddress.value;switch(t.billingAddressOption.value){case"shipping":{const A=n.fields.buyerIdentity.value?.purchasingCompany;if(A)return v(A?.location?.shippingAddress??g);if(f.value){const{oneTimeUse:P,...I}=f.value;return I}return v(g)}case"billing":{const A=n.fields.buyerIdentity.value?.purchasingCompany?.location.billingAddress;return v(A??g)}default:return v(g)}});async function h(v){return o({unknownChange:v,extension:s,extensionInstanceId:u.id,handlers:{async updateShippingAddress({change:g,negotiate:A}){if(!r.peek().delivery.canSelectCustomAddress){const T=a.addressManager.shipping.value.a
2pplyAddressChangeBlockReason("ui-extension").value,S=T?ls[T]:he("applyShippingAddressChange","delivery");throw new Ae(S,{cause:{errors:[{message:S}]}})}const P=E(g);if(P)throw new Ae(P,{cause:{errors:[{message:P}]}});const I=new Set,R={...t.shippingAddress.peek()};let ie=!1,Z=!1;for(const T of Object.keys(g.address)){const S=g.address[T];if(T!=="oneTimeUse"){if(S!==void 0&&typeof S!="string"){const L=`Invalid shipping address value for property "${T}". Expected type string or undefined.`;throw new Ae(L,{cause:{errors:[{message:L}]}})}}else if(S!==void 0&&typeof S!="boolean"){const L=`Invalid shipping address value for property "${T}". Expected type boolean or undefined.`;throw new Ae(L,{cause:{errors:[{message:L}]}})}Je[T]&&Je[T].forEach(L=>I.add(L));const N=$t[T];N&&!ne(s.approvalScopes,N)||(T==="zip"?R.postalCode=S:T==="provinceCode"?R.zoneCode=S:T==="countryCode"?R.countryCode=S:T==="oneTimeUse"?R.oneTimeUse=S:(R[T]=S,T==="address1"?ie=!0:T==="address2"&&(Z=!0)))}ie&&(delete R.streetName,delete R.streetNumber),Z&&(delete R.line2,delete R.neighborhood),t.shippingAddress.value?.countryCode!==R?.countryCode&&l("extensionInteraction",{interaction:"marketDriverChangeShippingAddressCountryCode",extension:s,section:"extension",extensionInstanceId:u.id,timestamp:new Date}),d.log("wallets_shipping_address_update","Extensions: update to proposed shipping address",{extensionInstanceId:u.id,isPostalCodePadded:ns(R.postalCode,R.countryCode),isPreviousPostalCodePadded:ns(t.shippingAddress.value?.postalCode,t.shippingAddress.value?.countryCode),countryCode:R.countryCode});
2const me=await a.addressManager.shipping.value.applyAddressChange({source:"ui-extension",address:R});if(me.type==="failure"){const T=ls[me.reason];throw new Ae(T,{cause:{errors:[{message:T}]}})}const ce=await A({silenceViolations:["non-delivery-address"],runListenersOnError:!1});if(ce.status==="error"||ce.status==="success"){const T=ce.errors.reduce((S,N)=>{if(!I.has(N.code))return S;const L=Zt.get(N.code);return S.concat({message:si(N),field:L})},[]);if(T.length>0)throw new Ae(T.map(({message:S})=>S).join(", "),{cause:{errors:T}})}return{type:"success",errors:null}}},errorResult:g=>({type:"error",errors:g instanceof Ae?g.cause?.errors??[{message:g.message}]:[{message:g.message}]})})}return{billingAddress:e(m),shippingAddress:e(f),applyShippingAddressChange:h};function E(v){return typeof v.address!="object"||v.address===null?'Missing "address" property value.':v.address.countryCode&&!Hn(v.address.countryCode)?"Invalid country code.":null}}const ls={MUST_SELECT_PROVIDED_ADDRESS:"Could not apply shipping address changes: the buyer must use the provided shipping address",ADDRESS_CHANGES_UNAVAILABLE:"Could not apply shipping address changes: current checkout state does not allow address changes",DELIVERY_ADDRESS_NOT_EDITABLE:he("applyShippingAddressChange","delivery"),ADDRESS_COUNTRY_NOT_SUPPORTED:"Could not apply shipping address changes: this checkout cannot ship to the address country"},ei=new Map([["DELIVERY_ZONE_NOT_FOUND","The specified province was not found within the country"],["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY","The specified country requires a province"]]);function si(e){return ei.get(e.code)??e.localizedMessage??e.nonLocalizedMessage}async function Oe(e){try{return await e()}catch(s){if(ni(s))return;throw s}}function ni(e){return e instanceof Xn&&typeof e.cause=="object"&&e.cause!==null&&"code"in e.cause&&e.cause.code==="INVALID_NEGOTIATION"}function M({proposed:e,negotiated:s,createSubscribableFromSignal:n,cartInstructionsSignal:t,extension:i,extensionInstance:r,applyChange:o}){async function u(l){return o({unknownChange:l,extension:i,extensionInstanceId:r.id,handlers:{async updateAttribute({negotiate:d,change:a,markChangeAsNoOp:p}){if(ps(a),!t.peek().attributes.canUpdateAttributes)throw new y(
2he("applyAttributeChange","attributes"));const c=e.attributes.peek();return ti(a,c,s.fields.customAttributes.peek())?(p(),{type:"success"}):(e.attributes.value=fs(c,a),await Oe(()=>d({silenceViolations:["all"]})),{type:"success"})},async removeAttribute({negotiate:d,change:a}){if(ps(a),!t.peek().attributes.canUpdateAttributes)throw new y(he("applyAttributeChange","attributes"));const p=e.attributes.peek();if(!p?.find(c=>c.key===a.key))throw new y(`Invalid AttributeChange: no attribute with specified key found: "${a.key}"`);return e.attributes.value=fs(p,a),await Oe(()=>d({silenceViolations:["all"]})),{type:"success"}}},errorResult:d=>({type:"error",message:`Could not apply attribute changes. Error: ${d.message}`})})}return{applyAttributeChange:u,attributes:n(Bt(()=>(e.attributes.value||s.fields.customAttributes.value?.map(({key:l,value:d})=>({key:l,value:d})))??[]))}}function ps(e){if(typeof e.key!="string"||e.key.length<3||e.key.length>30)throw new y('Invalid AttributeChange: attribute key must be of type "string" and between 3 and 30 characters in length (inclusive)');if(e.type==="updateAttribute"&&typeof e.value!="string")throw new y('Invalid AttributeChange: attribute value must be of type "string"')}function ti(e,s,n){const t=o=>{const u=o?.find(l=>l.key===e.key);return u!==void 0&&u.value===e.value},i=t(n),r=s===void 0?i:t(s);return i&&r}function fs(e,s){const n=e?[...e]:[],t=n.findIndex(({key:i})=>i===s.key);return s.type==="updateAttribute"&&(t>-1?n[t]={key:s.key,value:s.value}:n.push({key:s.key,value:s.value})),s.type==="removeAttribute"&&n.splice(t,1),n}const ii=/^\$app|^app--\d+--/,ri=/^app--\d+--/,oi=/^app--\d+$/,Ne="$app",Sn=":";function ai(e){return oi.test(e)?Ne:e.replace(ri,Ne+Sn)}function ui(e,s){if(e.trim()===Ne)return`app--${s}`;const n=Ne+Sn;return e.trim().startsWith(n)?`app--${s}--${e.slice(n.length)}`:e}const Tn="2026-01";function te({proposed:e,createSubscribableFromSignal:s,extension:n,cartInstructionsSignal:t,applyChange:i,extensionInstance:r,checkout:o}){const{extensibility:u}=o,l=n.type==="local"&&_e(n.apiVersion).equalTo(Tn);return{metafields:s(b(()=>{const d=o.latestReceipt.value?.status==="processed"?o.latestReceipt.value?.purchaseOrder.metafields:[];return(d&&d.length>0?d:u.ui.metafields.value).map(({key:a,namespace:p,value:c,valueType:f})=>({key:a,namespace:p,value:c,valueType:f}))})),async applyMetafieldChange(d){return i({unknownChange:d,extension:n,extensionInstanceId:r.id,handlers:{async updateMetafield({change:a}){if(!hs(n.apiVersion))throw new y("Change type `updateMetafield` is no longer supported. Use `updateCartMetafield` instead.");l&&console.warn("Change type `updateMetafield` is deprecated and will be removed in a future API version. Use `updateCartMetafield` instead. See https://shopify.dev/docs/api/checkout-ui-extensions/2026-01/apis/metafields#methods-propertydetail-applymetafieldchange for more details."),di(a);const{key:p,namespace:c,value:f,valueType:m}=a,h=u.ui.metafields.value,E=h.findIndex(A=>A.key===p&&A.namespace===c),v=[...h],g=v[E];return g?v[E]={...g,value:f,valueType:m,appId:n.appId}:v.push({key:p,namespace:c,value:f,valueType:m,appId:n.appId}),u.ui.updateMetafields(v),{type:"success"}},async removeMetafield({change:a}){if(!hs(n.apiVersion))throw new y("Change type `removeMetafield` is no longer supported. Use `removeCartMetafield` instead.");l&&console.warn("Change type `removeMetafield` is deprecated and will be removed in a future API version. Use `removeCartMetafield` instead. See https://shopify.dev/docs/api/checkout-ui-extensions/2026-01/apis/metafields#methods-propertydetail-applymetafieldchange for more details.");const{key:p,namespace:c}=a,f=u.ui.metafields.value.filter(m=>m.key!==p||m.namespace!==c);return u.ui.updateMetafields(f),{type:"success"}},async updateCartMetafield({change:a,negotiate:p}){ms(a.type,t.peek().metafields),ci(a);const c=typeof a.metafield.value=="string"?a.metafield.value:String(a.metafield.value);e.cartMetafields.value=[...e.cartMetafields.peek(),{update:{key:a.metafield.key,namespace:a.metafield.namespace,value:c,type:a.metafield.type,appId:n.appId}}];const f=await p({fieldsToResolve:["cartMetafields"],silenceViolations:["all"]});return ys(f,e,a),{type:"success"}},async removeCartMetafield({change:a,negotiate:p}){ms(a.type,t.peek().metafields),li(a),e.cartMetafields.value=[...e.cartMetafields.peek(),{delete:{appId:n.appId,key:a.key,namespace:a.namespace}}];const c=await p({fieldsToResolve:["cartMetafields"],silenceViolations:["all"]});return ys(c,e,a),{type:"success"}}},errorResult:a=>({type:"error",message:a.message})})}}}function ms(e,{canSetCartMetafields:s,canDeleteCartMetafield:n}){const t=`applyMetafieldChange with type ${e}`;
2if(e==="updateCartMetafield"&&!s)throw new y(he(t,"metafields"));if(e==="removeCartMetafield"&&!n)throw new y(he(t,"metafields"))}function di(e){const{key:s,namespace:n,value:t,valueType:i}=e;if(typeof s!="string"||s.length<3||s.length>30)throw new y(`Invalid property key: "${s}". It must be between 3 and 30 characters in length (inclusive).`);if(typeof n!="string")throw new y(`Invalid property namespace: "${n}". It must be a string between 2 and 20 characters (inclusive).`);if(n.length<2||n.length>20)throw new y(`Invalid property namespace: "${n}". It must be between 2 and 20 characters in length (inclusive).`);if(ii.test(n))throw new y(`Invalid property namespace: "${n}". App reserved namespaces not supported.`);switch(i){case"integer":if(typeof t!="number")throw new y(`Invalid property value: "${t}". It must be a number.`);break;case"string":if(typeof t!="string")throw new y(`Invalid property value: "${t}". It must be a string.`);if(t.length<=0)throw new y(`Invalid property value: "${t}". It must not be empty.`);break;case"json_string":if(!pi(t))throw new y(`Invalid property value: "${t}". It must be a json_string.`);break;default:throw new y(`Invalid property valueType: "${i}". It must be in one of these values: integer, string, json_string.`)}return!0}function ci(e){const{metafield:s}=e;if(s==null)throw new y(`Invalid property metafield: "${s}". It must be an object.`);const{key:n,namespace:t,value:i,type:r}=s;if(typeof n!="string"||n.length<2||n.length>64)throw new y(`Invalid property key: "${n}". It must be between 2 and 64 characters in length (inclusive).`);if(t!==null&&typeof t!="string"&&typeof t<"u")throw new y(`Invalid property namespace: "${t}". namespace must be null, undefined, or a string between 3 and 255 characters (inclusive).`);if(typeof t=="string"&&(t.length<3||t.length>255))throw new y(`Invalid property namespace: "${t}". It must be between 3 and 255 characters in length (inclusive).`);if(typeof r!="string")throw new y(`Invalid property type: "${r}". It must be a string. Received type: ${typeof r}.`);if(r==="integer"){if(typeof i!="number"&&typeof i!="string")throw new y(`Invalid property value: "${i}". It must be a number or a string when type is "integer". Received type: ${typeof i}.`)}else if(typeof i!="string")throw new y(`Invalid property value: "${i}". It must be a string when type ("${r}") is not "integer". Received type: ${typeof i}.`)}function li(e){const{key:s,namespace:n}=e;if(typeof s!="string")throw new y(`Invalid property key: "${s}". It must be a string.`);if(n!=null&&typeof n!="string")throw new y(`Invalid property namespace: "${n}". The namespace must be either null, undefined, or a string.`)}function pi(e){if(typeof e!="string")return!1;try{return JSON.parse(e),!0}catch{}return!1}function fi(e){const n=e.match(/\[(\d+)\]$/)?.[1];return n!==void 0?parseInt(n,10):-1}function ys(e,s,n){const t=[...s.cartMetafields.peek()],i=e.errors.filter(l=>it.has(l.code));if(i.length===0)return;const r=i.reduce((l,d)=>{if("target"in d){const a=fi(d.target);a>=0&&!l[a]&&(l[a]=d)}return l},{}),o=t.findIndex((l,d)=>r[d]?n.type==="updateCartMetafield"&&l.update?.key===n.metafield.key&&l.update?.namespace===n.metafield.namespace&&l.update?.value===n.metafield.value||n.type==="removeCartMetafield"&&l.delete?.key===n.key&&l.delete?.namespace===n.namespace:!1),u=r[o];if(o>-1&&u)throw s.cartMetafields.value=t.slice(0,o),new y(u.nonLocalizedMessage,{cause:{code:u.code}})}function hs(e){return!_e(e).laterThan(Tn)}function Y({webPixels:e,extension:s}){const n=ts(s.appId)||"unknown-app",t=ts(Qe(s))||"unknown-extension";return{analytics:{publish:(i,r={})=>e.publishCustomEvent(i,r,{extension:{extensionId:t,appId:n,type:s.type||"unknown-type"}}),visitor:i=>e.visitor(i,{apiClientId:n})}}}const mi={id:"be4fa5a8e92c26d115e34073b486a58fc317388a2eedddb82d02eeccb9573278",type:"query",name:"ExtensionMetafields",source:""},vs=async({withCache:e=!0,coreGraphql:s,extension:n,observability:t,negotiated:i,checkoutProfileId:r,appMetafieldsSignal:o})=>{let u=[];const l=Dt(i),d=await bt({withCache:e,coreGraphql:s,resourceIds:l,checkoutProfileId:r}),a=d.data?.globalCheckoutUiExtensions??[],f=[...d.data?.checkoutProfile?.activatedExtensions??[],...a].map(({extension:h})=>h)?.find(h=>h.uuid===n.extensionId);let m=f?.metafields??[];if(!f){const h={resourceIds:l};
2n.type==="local"?h.extensionHandles=[{handle:n.handle,apiKey:n.appApiKey}]:h.extensionIds=[`gid://shopify/UiExtension/${n.extensionId}`];const{data:E}=await s.staticQuery(mi,{variables:h,cache:e});E?.extensionMetafields&&(m=E?.extensionMetafields)}u=yi({extension:n,queryResult:d,metafields:m,observability:t}),o.value={...o.peek(),[n.id]:u}};function $({coreGraphql:e,extension:s,extensionInstance:n,negotiated:t,observability:i,createSubscribableFromSignal:r,sourceId:o,checkout:u,appMetafieldsSignal:l}){const d=mt(()=>{vs({withCache:!0,coreGraphql:e,extension:s,observability:i,negotiated:t,appMetafieldsSignal:l,checkoutProfileId:u.configuration.profileId.value})});n.on("destroy",()=>{d()});const a={type:"extension",extension:s,instanceId:n.id};return(async()=>{ds.markStarted("app-metafields-load",a);try{await vs({withCache:!0,coreGraphql:e,extension:s,observability:i,negotiated:t,appMetafieldsSignal:l,checkoutProfileId:u.configuration.profileId.value})}finally{ds.markFinished("app-metafields-load",a)}})(),{appMetafields:r(b(()=>{const f=l.value[s.id]??[],m=s.extensionPoint.metafields??[],h=t.fields.buyerIdentity.value,E=h?.shopUser?.metafields??[],v=h?.shopUser?.publicId??"",g=E.flatMap(I=>!I||!v?[]:m.some(R=>R.key===I.key&&R.namespace===I.namespace)?[{target:{type:"shopUser",id:v},metafield:{key:I.key,namespace:je(s.apiVersion,I.namespace??""),value:
2I.value,type:I.type,valueType:I.valueType.toLowerCase()}}]:[]),A=t.fields.cartMetafields.value,P=Ce(s.appId);return[...f,...A?A?.flatMap(I=>I?m.some(R=>R.key===I.key&&ui(R.namespace,P)===I.namespace&&(!I.namespaceAppId||s.appId===I.namespaceAppId))?[{target:{type:"cart",id:o},metafield:{key:I.key,namespace:je(s.apiVersion,I.namespace??""),value:I.value,type:I.type,valueType:I.valueType.toLowerCase()}}]:[]:[]):[],...g]}))}}function je(e,s){return _e(e).laterThan("2025-01")?ai(s):s}function yi({queryResult:e,metafields:s,observability:n,extension:t}){if(e.error)return n.leaveErrorBreadcrumb("Extensions::GraphQL",{reason:"Failed to fetch extension metafields.",message:String(e.error),extensionId:t.id,extensionVersion:t.type==="persisted"?t.version:void 0}),[];const i=[];for(const r of s){if(!hi(t,r.ownerType))continue;const o=je(t.apiVersion,r.namespace);i.push({target:vi(r.ownerId,r.ownerType),metafield:{key:r.key,namespace:o,value:r.value,type:r.type.toLowerCase(),valueType:r.valueType.toLowerCase()}})}return i}function hi(e,s){switch(s){case"CART":case"PRODUCT":case"PRODUCTVARIANT":case"SHOP":case"SHOPUSER":return!0;case"CUSTOMER":case"COMPANY":case"COMPANYLOCATION":return ne(e.approvalScopes,D.CustomerPersonalData);default:return(t=>!1)()}}function vi(e,s){const n=Ce(e);switch(s){case"CUSTOMER":return{type:"customer",id:n};case"PRODUCT":return{type:"product",id:n};case"PRODUCTVARIANT":return{type:"variant",id:n};case"SHOP":return{type:"shop",id:n};case"COMPANY":return{type:"company",id:n};case"COMPANYLOCATION":return{type:"companyLocation",id:n};case"CART":return{type:"cart",id:n};case"SHOPUSER":return{type:"shopUser",id:n};default:return(i=>{throw new Zn(`Metafield ownerType "${s}" with id "${e}" cannot be resolved`)})()}}function ee({publicCheckoutSessionId:e,createSubscribableFromSignal:s}){return{checkoutToken:s(ye(e))}}function Ai(e){return{initial:e.current,subscribe(n){_n(n);const t=e.subscribe((r=e.current)=>n(r));return[()=>{t(),Rn(n)},e.current]}}}function F({extension:e,extensionInstance:s,createSubscribableFromSignal:n,isCheckoutEditor:t,observability:i}){const r=b(()=>{const u=e.behaviors.value,l=new Set;return u.blockProgress||l.add("blockProgress"),gi(e.capabilities,l)}),o=Ai({get current(){return s.rendered},subscribe:u=>{const l=s.on("render",()=>{u(s.rendered)}),d=s.on("remove",()=>{try{u(s.rendered)}catch(f){throw i.leaveErrorBreadcrumb("Error removing rendered subscription on remove event",{isDestroyed:s.isDestroyed,rendered:s.rendered,extensionId:s.id}),f}}),a=s.on("restart",()=>{c()}),p=s.on("destroy",()=>{c()}),c=()=>{l(),d(),a(),p()};return c}});return{scriptUrl:e.scriptUrl,version:e.type==="persisted"?e.version:void 0,apiVersion:e.apiVersion,rendered:o,capabilities:n(r),editor:t?{type:"checkout"}:void 0,target:s.target}}function gi(e,s){const n=[];return Object.keys(e).forEach(t=>{const i=t;i in e&&(typeof e[i]!="object"&&!s.has(i)&&e[i]&&n.push($e(i)),typeof e[i]=="object"&&Object.entries(e[i]).forEach(([r,o])=>{if(Array.isArray(o)&&o.length>0||!Array.isArray(o)&&o){const u=`${$e(t)}.${$e(r)}`;n.push(u)}}))}),n}function H({locale:e,currencySignal:s,timezone:n,extension:t,createSubscribableFromSignal:i,negotiated:r}){return{localization:{language:i(ye({isoCode:e})),extensionLanguage:i(ye({isoCode:t.extensionLocale})),currency:i(s),timezone:i(ye(n??new Intl.DateTimeFormat().resolvedOptions().timeZone)),country:i(b(()=>{const o=r.fields.buyerIdentity.value?.countryCode;if(o)return{isoCode:o}})),market:i(b(()=>{const o=r.fields.buyerIdentity.value?.market;if(!o)return;const{id:u,handle:l}=o;return{id:u,handle:l}}))}}}function z({captureEvent:e,extension:s,locale:n,shop:t,storefrontTokens:i,extensionInstance:r}){const o=s.capabilities.apiAccess;async function u(l,d=!1,a){if(!o)throw new y(`permission to access the storefront API must be specified under [capabilities] with flag "api_access = true"; this can be done within your extension's configuration. View the docs for more information:
3
4https://shopify.dev/docs/api/checkout-ui-extensions/configuration#api-access`);const p=await i.get(s.appId,s.type,"fetchWithToken");if(!p)throw new zn(`Could not get a storefront token for app ${s.appId} to query ${l}`);try{const c=await fetch(`https://${t.myshopifyDomain}/api/${a?.version??Yn(s.apiVersion)}/graphql.json`,{method:"POST",headers:{"Content-Type":"application/json","Accept-Language":n,"Shopify-Storefront-Extension-Token":p},body:JSON.stringify({query:l,variables:a?.variables})});return c?.status===401&&d?(i.cache.delete(i.cacheKey(s.appId,s.type)),u(l,!1,a)):c}catch(c){if(c.name==="BreadcrumbsPluginFetchError"&&d)return u(l,!1,a);throw new Ye(`An error occurred when attempting to fetch the extension api: ${c}`,{cause:c})}}return{query:async(l,d)=>{if(!s.capabilities.apiAccess)throw new y(`Extension is not allowed to use the Storefront API; permission to use the Storefront API must be specified under [capabilities] with:"api_access = true; see:
5
6https://shopify.dev/docs/api/checkout-ui-extensions/configuration#api-access`);const a=performance.now();e("extensionInteraction",{interaction:"storefrontApiQueryStart",extension:s,section:"extension",timestamp:new Date,extensionInstanceId:r.id});try{const p=await u(l,!0,d);if(p&&p.ok){e("extensionInteraction",{interaction:"storefrontApiQuerySuccess",extension:s,section:"extension",timestamp:new Date,duration:performance.now()-a,extensionInstanceId:r.id});try{return await p.json()}catch(f){throw new as("Failed to parse Storefront API response",{cause:f})}}throw new Ye(`Failed to query storefront API: status=${p?.status} ${p?.statusText}`.trim())}catch(p){let c="storefrontApiQueryError";throw p instanceof Ye&&p?.cause instanceof Error&&p.cause?.name==="BreadcrumbsPluginFetchError"?c="storefrontApiQuerySuccess":p instanceof as&&(c="storefrontResponseParseError"),e("extensionInteraction",{interaction:c,extension:s,section:"extension",timestamp:new Date,duration:performance.now()-a,error:p instanceof Error?p:void 0,extensionInstanceId:r.id}),p}}}}function J({extension:{configuration:e},createSubscribableFromSignal:s}){return s(e)}function oe(e){return{id:e.id,name:e.name,storefrontUrl:e.storefrontUrl??void 0,myshopifyDomain:e.myshopifyDomain}}function Se(e){return{id:e.id,name:e.name,storefrontUrl:e.storefrontUrl?Ei(e.storefrontUrl):void 0,myshopifyDomain:e.myshopifyDomain}}function Ei(e){return e.endsWith("/")?e:`${e}/`}const On="v1";function As({extension:e}){const s=Qe(e);return Nn(`${On}-${s}-${e.extensionPoint.target}`)}function se({extension:e}){return Nn(`${On}
6-${e.appId}-${e.extensionId}`)}function Nn(e){const s=Jn.ExtensionStorage,n=i=>`${e}-${i}`,t=()=>qn(s)??{};return{async read(i){De(typeof i=="string",'Missing "key" argument. Please pass a key to read from to storage.');const r=n(i),o=t();return Object.keys(o).length&&o[r]||null},async write(i,r){De(typeof i=="string",'Missing "key" argument. Please pass a key to write to to storage.'),De(arguments.length>1,`Missing "data" argument. Please pass a value to write to "${i}" `);const o=n(i),u=t();u[o]=r,is(s,u)},async delete(i){De(typeof i=="string",'Missing "key" argument. Please pass a key to delete from storage.');const r=n(i),o=t();delete o[r],Object.keys(o).length===0?jn(s):is(s,o)}}}function Rr(e){return e}function Ii(e,s){return e.filter(n=>At(n)&&n.discount.presentationLevel===s).map(n=>{const{discount:t,amount:i,title:r}=n;return t.type==="code"?{type:"code",code:r,discountedAmount:i}:t.type==="automatic"?{type:"automatic",title:r,discountedAmount:i}:{type:"custom",title:r,discountedAmount:i}})}function _i(e,s){return e.filter(n=>vt(n.discountDetails.discount)&&n.discountDetails.discount.presentationLevel===s).map(n=>{const{discount:t,title:i}=n.discountDetails;return t.type==="code"?{type:"code",code:i,discountedAmount:n.amount}:t.type==="automatic"?{type:"automatic",title:i,discountedAmount:n.amount}:{type:"custom",title:i,discountedAmount:n.amount}})}const Ri=new Set(["DISCOUNTS_ONLY_EMPTY_TERMS_ACCEPTED","DISCOUNTS_DISCOUNTS_NOT_ALLOWED_FOR_B2B","DISCOUNTS_DISCOUNT_CODE_NOT_HONOURED","DISCOUNTS_CUSTOM_DISCOUNT_NOT_HONOURED","DISCOUNTS_UNSUPPORTED_EXPECTATION","DISCOUNTS_ALLOCATIONS_MISMATCH","DISCOUNTS_ADDITIONAL_REQUESTED_DISCOUNT_CODE_DISCARDED","DISCOUNTS_NOT_FOUND","DISCOUNTS_CURRENTLY_INACTIVE","DISCOUNTS_USAGE_LIMIT_REACHED","DISCOUNTS_CUSTOMER_USAGE_LIMIT_REACHED","DISCOUNTS_CUSTOMER_NOT_ELIGIBLE","DISCOUNTS_QUANTITY_NOT_IN_RANGE","DISCOUNTS_PURCHASE_NOT_IN_RANGE","DISCOUNTS_NO_ENTITLED_LINE_ITEMS","DISCOUNTS_NO_ENTITLED_SHIPPING_LINES","DISCOUNTS_INCOMPATIBLE_PURCHASE_TYPE","DISCOUNTS_DISCOUNT_ALREADY_APPLIED","DISCOUNTS_HIGHER_VALUE_DISCOUNT_APPLIED","DISCOUNTS_MAXIMUM_DISCOUNT_CODE_LIMIT_REACHED","DISCOUNTS_INVALID_SIGNATURE","REDUCTION_INVALID_CODE","REDUCTION_INVALID_DISCOUNT_CODE"]);function C({negotiated:e,proposed:s,extension:n,createSubscribableFromSignal:t,cartInstructionsSignal:i,applyChange:r,extensionInstance:o,currentDiscountCodeAttemptSignal:u}){const l=t(b(()=>{const p=e.fields.discountLines.value?.lines;return p?p.filter(c=>c.discount.type==="code").map(c=>({code:c.title})):[]})),d=t(b(()=>{const p=e.fields.discountLines.value?.lines;return p?Ii(p,"CART"):[]})),a=["non-merchandise"];return{discountCodes:l,discountAllocations:d,async applyDiscountCodeChange(p){return r({unknownChange:p,extension:n,extensionInstanceId:o.id,handlers:{async addDiscountCode({negotiate:f,change:m}){c(),gs(m);const h=await f({customizeNegotiation:E=>(u.value=m.code,{...E,reduction:{code:m.code}}),silenceViolations:a});return Es(h,m.code),u.value=null,{type:"success"}},async removeDiscountCode({negotiate:f,change:m}){c(),gs(m);const h=s.discountLines.peek(),E=m.code.toUpperCase(),v=h.find(({discount:A})=>A.type==="code"&&A.title.toUpperCase()===E);if(!v)throw new y(`The discount code "${m.code}" is not allocated to this checkout and cannot be removed.`,{cause:{code:"DISCOUNT_NOT_FOUND"}});s.discountLines.value=h.filter(({discount:A})=>A.title.toUpperCase()!==v.title.toUpperCase());const g=await f({fieldsToResolve:[...rt],silenceViolations:a});return Es(g,m.code),{type:"success"}}},errorResult:f=>({type:"error",message:`Could not apply discount code changes. Error: ${f.message}`})});function c(){if(!i.peek().discounts.canUpdateDiscountCodes)throw new y(
6he("applyDiscountCodeChange","discounts"))}}}}function gs(e){if(typeof e.code!="string")throw new y('Discount code must be of type "string"')}function Es(e,s){const n=e.errors.find(t=>{if(!(t.type==="RemoveTermViolation"&&gt(t.targetEntity)?.title!==s))return Ri.has(t.code)});if(n)throw new y(n.nonLocalizedMessage,{cause:{code:n.code}})}function Di({extension:e,checkout:s}){return{experimentalIsShopAppStyle:Et({allowLocal:!0,extension:e})?s.identity.current.value==="shopPay":void 0}}const bi=new Set(["REDUCTION_INVALID_CODE","PAYMENT_GIFT_CARDS_NOT_ALLOWED_FOR_B2B","PAYMENT_GIFT_CARDS_NOT_ALLOWED_FOR_FIXED_SELLING_PLANS","PAYMENTS_GIFT_CARD_ALREADY_APPLIED","PAYMENTS_GIFT_CARD_BUYING_GIFT_CARD","PAYMENTS_GIFT_CARD_CURRENCY_MISMATCH","PAYMENTS_GIFT_CARD_DISABLED","PAYMENTS_GIFT_CARD_NON_SUFFICIENT_FUNDS","PAYMENTS_GIFT_CARD_NOT_FOUND","REDUCTION_GIFT_CARD_ALREADY_APPLIED","PAYMENTS_SHOP_CASH_GIFT_CARD_NOT_ALLOWED","REDUCTION_INVALID_GIFT_CARD_CODE","PAYMENTS_INSTALLMENTS_GIFT_CARD_NOT_ALLOWED","PAYMENTS_GIFT_CARDS_UNAVAILABLE"]);function V({negotiated:e,proposed:s,extension:n,createSubscribableFromSignal:t,shop:i,applyChange:r,extensionInstance:o}){return{appliedGiftCards:t(b(()=>{const l=e.fields.paymentLines.value;return l?l.lines.filter(d=>d.method.type==="giftCard").map(d=>({lastCharacters:d.method.code.slice(-4),amountUsed:d.cost,balance:d.method.balance})):[]})),async applyGiftCardChange(l){return r({unknownChange:l,extension:n,extensionInstanceId:o.id,handlers:{async addGiftCard({negotiate:d,change:a}){if(Is(a),!e.fields.paymentMethods.peek()?.some(f=>f.type==="giftCard"))throw new y("the `applyGiftCardChange` API is disabled");const c=await d({customizeNegotiation:f=>({...f,reduction:{code:a.code}})});return Rs(c),{type:"success"}},async removeGiftCard({negotiate:d,change:a}){Is(a);const p=s.paymentLines.peek(),c=i.hasFlagEnabled(Kn);let f=p;c?a.code.split(",").forEach(E=>{f=_s(f,E)}):f=_s(f,a.code),s.paymentLines.value=f;const m=await d({});return Rs(m),{type:"success"}}},errorResult:d=>({type:"error",message:`Could not apply gift card changes. Error: ${d.message}`})})}}}function Is(e){if(typeof e?.code!="string")throw new y("Gift card code must be a string")}function _s(e,s){const n=Si(s),t=e.findIndex(({method:r})=>r.type!=="giftCard"?!1:s.length===4?r.code.toLowerCase().slice(-4)===n.slice(-4):r.code.toLowerCase()===n);if(t===-1)return e;const i=[...e];return i.splice(t,1),i}function Si(e){return e.replace(/[\s-]/g,"").toLowerCase()}function Rs(e){const s=e.errors.find(n=>bi.has(n.code));if(s)throw new y(s.nonLocalizedMessage,{cause:{code:s.code}})}function Ti(e){let s,n=!1;function t(){return s??=ht(e).catch(i=>{throw s=void 0,i}),s}return{load:t,preload(){n||(n=!0,yt(()=>{t().catch(()=>{})}))}}}function We(e){const{lineAllocation:s}=e,n="parentRelationship"in e?e.parentRelationship?.parent?.lineAllocations?.[0]:void 0;return{id:Oi(s.stableId),quantity:s.quantity,cost:{totalAmount:s.checkoutPriceAfterDiscounts},merchandise:Ds(e),attributes:e.properties.map(t=>({key:t.name,value:String(t.value)})),discountAllocations:_i(s.allocations,"LINE"),lineComponents:e.lineComponents.map(t=>({type:"bundle",id:bs(t.lineAllocation.stableId),merchandise:Ds(t),quantity:t.lineAllocation.quantity,cost:{totalAmount:t.lineAllocation.checkoutPriceAfterDiscounts},attributes:t.properties.map(i=>({key:i.name,value:String(i.value)}))})),parentRelationship:n?{parent:{id:bs(n.stableId)}}:null}}function Ds(e){if(!e.variantId)throw new Ke("Cannot create cart line API without a variantId. Custom merchandise lines are not yet supported.");return{type:"variant",id:e.variantId.replace("ProductVariantMerchandise","ProductVariant"),title:e.title,subtitle:e.subtitle,image:e.image?{url:e.image.four,altText:e.image.altText}:void 0,selectedOptions:e.options.map(s=>({name:s.name,value:s.value})),product:{id:e.productId,vendor:e.vendor,productType:e.productType},requiresShipping:e.requiresShipping,sellingPlan:e.sellingPlan?{id:e.sellingPlan.id,recurringDeliveries:!!e.sellingPlan.subscriptionDetails}:void 0,sku:e.sku??void 0}}function Ln(e){const{lineAllocation:s,image:n}=e;return{id:Ni(s.stableId),title:e.title,subtitle:e.subtitle,lines:[We(e)],quantity:s.quantity,cost:{totalAmount:s.checkoutPriceAfterDiscounts},image:n?{url:n.four,altText:n.altText}:void 0}}function Oi(e){return`gid://shopify/CartLine/${e}`}function bs(e){return`gid://shopify/CartLineComponent/${e}`}function Ni(e){return`gid://shopify/PresentmentCartLine/${e}`}const Li="merchandiseError:",Ss=Ti(()=>_t(()=>import("./apply-cart-line-change.Cbl-yI6B.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])));function U({negotiated:e,proposed:s,createSubscribableFromSignal:n,extension:t,stableDetourSignal:i,cartInstructionsSignal:r,cartLineChangeLoadingSignal:o,observability:u,applyChange:l,extensionInstance:d,isCheckoutEditor:a}){Ss.preload();async function p(c,f){return o.value=!0,(await Ss.load()).applyCartLineChange({change:c,negotiated:e,proposed:s,stableDetourSignal:i,cartInstructionsSignal:r,negotiate:f,isCheckoutEditor:a,observability:u})}return{lines:n(Gt(()=>
6{const c=e.fields.merchandiseLines.value,f=e.fields.remoteMerchandiseDetails?.value;return c?c.lines.filter(m=>!fn(m.stableId,f)).flatMap(m=>m.productId==null?[]:m.variantId?In(m).map(We):(u.error(new Ke("Cannot create cart line API without a variantId. Custom merchandise lines are not yet supported.")),[])):[]})),async applyCartLinesChange(c){return l({unknownChange:c,extension:t,extensionInstanceId:d.id,handlers:{async addCartLine({negotiate:f,change:m}){return p(m,f)},async removeCartLine({negotiate:f,change:m}){return p(m,f)},async updateCartLine({negotiate:f,change:m}){return p(m,f)}},errorResult:f=>f.message.startsWith(Li)?{type:"error",message:f.message}:{type:"error",message:`Could not apply line item changes. Error: ${f.message}`}}).finally(()=>{o.value=!1})}}}const Ts=5e3;function G({proposed:e,negotiated:s,createSubscribableFromSignal:n,extension:t,cartInstructionsSignal:i,applyChange:r,extensionInstance:o}){return{note:n(e.note),async applyNoteChange(l){return r({unknownChange:l,extension:t,extensionInstanceId:o.id,handlers:{async updateNote({negotiate:d,change:a,markChangeAsNoOp:p}){if(u(),typeof a.note!="string")throw new y('Invalid NoteChange: note must be of type "string"');if(a.note&&a.note.length>Ts)throw new y(`Invalid NoteChange: note must be less than or equal to ${Ts} characters`);return Pi(a.note,e.note.peek(),s.fields.note.peek())?(p(),{type:"success"}):(e.note.value=a.note||void 0,await Oe(()=>d({silenceViolations:["all"]})),{type:"success"})},async removeNote({negotiate:d,markChangeAsNoOp:a}){return u(),ki(e.note.peek(),s.fields.note.peek())?(a(),{type:"success"}):(e.note.value=void 0,await Oe(()=>d({silenceViolations:["all"]})),{type:"success"})}},errorResult:d=>({type:"error",message:d.message})})}};
6function u(){if(!i.peek().notes.canUpdateNote)throw new y(he("applyNoteChange","notes"))}}function Pi(e,s,n){const t=e||void 0;return s===t&&(n||void 0)===t}function ki(e,s){return e===void 0&&(s||void 0)===void 0}function O(e){const{extension:s}=e,{applyAttributeChange:n}=M(e),{applyCartLinesChange:t}=U(e),{applyNoteChange:i}=G(e),{applyMetafieldChange:r}=te(e),{applyDiscountCodeChange:o}=C(e),{applyGiftCardChange:u}=V(e),{applyShippingAddressChange:l}=w(e),{experimentalIsShopAppStyle:d}=Di(e);switch(s.apiVersion){case"2023-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u};case"2023-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2023-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2024-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2024-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2024-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2024-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2025-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2025-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2025-07":case"unstable":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2025-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2026-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2026-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2026-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2026-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};case"2027-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:u,applyShippingAddressChange:l,experimentalIsShopAppStyle:d};default:Me(s.apiVersion)}}function Ve(e){const{createSubscribableFromSignal:s}=e,{apiVersion:n}=e.extension;return _e(n).equalTo("unstable")?{order:s(ye(void 0))}:_e(n).laterThan("2025-07")?{}:{order:s(ye(void 0))}}function wi({negotiated:e,createSubscribableFromSignal:s,observability:n}){return{presentmentLines:s(b(()=>{const t=e.fields.merchandiseLines.value;return t?t.lines.flatMap(i=>i.variantId?In(i).map(r=>Ln(r)):(n.error(new Ke("Cannot create cart line API without a variantId. Custom merchandise lines are not yet supported.")),[])):[]}))}}function j({negotiated:e,createSubscribableFromSignal:s,proposed:n,extension:t}){return ne(t.approvalScopes,D.CustomerPersonalData)?{buyerIdentity:{customer:s(b(()=>{const i=e.fields.buyerIdentity.value?.customerProfile;if(i?.__typename==="CustomerProfile"||i?.__typename==="BusinessCustomerProfile"){const r=ne(t.approvalScopes,D.CustomerEmail),o=ne(t.approvalScopes,D.CustomerPhone),u=ne(t.approvalScopes,D.CustomerName),l=i?.__typename==="CustomerProfile"?i.storeCreditAccounts.map(d=>({...d,balance:d.balance})):[];return{id:i.id,email:r?i.email??void 0:void 0,phone:o?i.phone??void 0:void 0,fullName:u?i.fullName??void 0:void 0,firstName:u?i.firstName??void 0:void 0,lastName:u?i.lastName??void 0:void 0,image:{url:i.imageUrl},acceptsMarketing:i.acceptsEmailMarketing,acceptsEmailMarketing:i.acceptsEmailMarketing,acceptsSmsMarketing:i.acceptsSmsMarketing,storeCreditAccounts:l,ordersCount:i.ordersCount??0}}})),email:s(b(()=>{if(!ne(t.approvalScopes,D.CustomerEmail))return;const r=n.email.value,o=e.fields.buyerIdentity.value?.customerProfile?.email,u=e.fields.contactInfo.value?.email;return r||o||u})),phone:s(b(()=>{if(!ne(t.approvalScopes,D.CustomerPhone))return;const r=n.phone.value,o=e.fields.buyerIdentity.value?.customerProfile?.phone,u=e.fields.contactInfo.value?.phone;return r||o||u})),purchasingCompany:s(b(()=>{const i=e.fields.buyerIdentity.value?.purchasingCompany;if(i)return{company:{id:i.company.id,name:i.company.name,externalId:i.company?.externalId},location:{id:i.location.id,name:i.location.name,externalId:i.location?.externalId}}}))}}:{buyerIdentity:void 0}}const Mi=3e4,Ie={behavior:"allow"};function q({extension:e,extensionInstance:s,proposal:n,captureEvent:t,journeyCompletedSignal:i,sourceType:r,createSubscribableFromSignal:o,journeyStateSignal:u,pageBeforeDetourSignal:l,negotiated:d,cartPageSignal:a,checkout:p,interceptorRegistrationResolversSignal:c,observability:f,negotiationRateLimiter:m}){let h=0;const E=c.peek(),v=E.get(e.id);return{intercept(g){const A=String(h++);_n(g);let P=!1;const I=[],k={interceptorKey:A,extension:e,captureEvent:t,sourceType:r,observability:f,activeRaces:I,extensionInstance:s,suppressMalformedInterceptionErrors:e.type==="persisted"||e.type==="global"},R=Ci(g,k),ie=async S=>{switch(S){case"registration":return await R({requiresRenderToBlock:!1}),Ie;case"negotiation":{const N=await R({requiresRenderToBlock:!0});if(!N)return Ie;const{perform:L}=N.interceptorRunResponse;return N.isBlocking?{behavior:"allow",errors:N.interceptorRunResponse.errors,perform:L&&ge(()=>L({behavior:"allow"}),k)}:{behavior:"allow",perform:L&&ge(()=>L({behavior:"allow"}),k)}}case"progression":case"completion":{const N=await R({requiresRenderToBlock:!0});if(!N)return Ie;const{perform:L}=N.interceptorRunResponse;if(N.isBlocking){if(m.isThrottled(e.id)){if(!P){P=!0;const Re=cs(e),{isRemoteDom:Ge,isHighValueExtension:Be}=Re;f.log("extension_throttled_buyer_journey_block_attempt","[Extensions::BuyerJourneyIntercept] Throttled extension attempted to block checkout progress",{...Re,enforced:!0}),f.counter({name:"extension_throttled_buyer_journey_block_attempt",value:1,attributes:{isRemoteDom:Ge,isHighValueExtension:Be,enforced:!0}})}return s.markNotBlocking(A),{behavior:"allow",errors:N.interceptorRunResponse.errors,perform:L&&ge(()=>L({behavior:"block"}),k)}}return t("extensionBuyerJourneyBlock",{behavior:"block",reason:N.interceptorRunResponse.reason,extension:e,section:"extension",timestamp:new Date,validationErrors:N.interceptorRunResponse.errors??[]}),f.debug("extensions_buyer_journey_intercepted","[Extensions::BuyerJourneyIntercept] Blocked checkout progress",{...cs(e),errors:N.interceptorRunResponse.errors,reason:N.interceptorRunResponse.reason}),{behavior:"block",reason:Qn.InvalidExtensionState,errors:N.interceptorRunResponse.errors,perform:L&&ge(()=>L({behavior:"block"}),k),context:{extension:pe(e)}}}return{behavior:"allow",perform:L&&ge(()=>L({behavior:"allow"}),k)}}default:return S}},Z=n.intercept(({reason:S})=>ie(S));Ui({interceptorRegistrationResolvers:E,interceptorRegistration:v,extension:e,sourceType:r,observability:f});const fe=async()=>
6{if(!p.isCheckoutLayoutForcedToOnePage.value||!p.wallets.isAcceleratedWalletEscalation.value||!s.rendered)return;const S=await R({requiresRenderToBlock:!0});if(!S?.isBlocking)return;const{perform:N}=S.interceptorRunResponse;N&&await ge(()=>N({behavior:"block"}),k)()};ie("registration").then(fe).catch(S=>{f.error(S,{metadata:{extension:pe(e),source:{type:r}}})});const me=s.on("restart",()=>{T()}),ce=s.on("destroy",()=>{T()}),T=()=>{s.markNotBlocking(A);for(const S of I)S.abort();Z(),me(),ce(),Rn(g)};return T},completed:o(i),steps:o(b(()=>{if(i.value)return[{handle:"thank-you",to:"shopify:checkout/thank-you",label:"thank-you",disabled:!1}];const{plan:{greenPath:g}}=u.value,A=l.value,P=d.value,I=a.value,k=g.filter(({skipOverPage:Z})=>!Z||!Z(P)),R=k.findIndex(Z=>Z.id===A?.id),ie=k.map((Z,fe)=>Os({page:Z,disabled:R>=0&&fe>R}));return I&&ie.unshift(Os({page:I,disabled:!1})),ie})),activeStep:o(b(()=>{if(i.value)return{handle:"thank-you"};const{plan:{greenPath:g}}=u.value,A=l.value;if(!A||!g.some(({id:I})=>I===A.id))return;const P=d.value;if(!A.skipOverPage?.(P))return{handle:kn(A).handle}}))}}function Pn(e,s,n){const t={finished:Promise.resolve(),abort:()=>{}},{captureEvent:i,extension:r}=s,o=s.duration??Mi,u=performance.now();let l,d;return t.abort=()=>{clearTimeout(d),l(void 0)},t.finished=Promise.race([new Promise(a=>{l=a,d=setTimeout(()=>{l(s.onTimeout())},o)}),e.finally(()=>{i("extensionInteraction",{interaction:"buyerJourneyInterceptor",extension:r,section:"extension",timestamp:new Date,duration:performance.now()-u,extensionInstanceId:n}),clearTimeout(d)})]),t}function Ci(e,s){return async({requiresRenderToBlock:n})=>{const{interceptorKey:t,extension:i,captureEvent:r,sourceType:o,observability:u,activeRaces:l,extensionInstance:d,suppressMalformedInterceptionErrors:a}=s;if(n&&!d.rendered)return d.markNotBlocking(t),{isBlocking:!1,interceptorRunResponse:Ie};const p=i.capabilities.blockProgress&&i.behaviors.value.blockProgress,c=(async()=>{try{return await e({canBlockProgress:p})}catch(h){return u.error(new gn(`Error in buyer journey interceptor callback: ${h}`,{cause:h}),{metadata:{extension:pe(i),source:{type:o}}}),{behavior:"allow",perform:()=>{}}}})(),f=Pn(c,{captureEvent:r,extension:i,onTimeout:()=>(u.error(new y("buyer journey interceptor callback timed out"),{metadata:{extension:pe(i),source:{type:o}}}),Ie)},d.id);l.push(f);let m;try{m=await f.finished,Vi(i,m)}catch(h){if(a){const E=h;return console.warn(`${E.name}: ${E.message}`),d.markNotBlocking(t),null}throw h instanceof TypeError&&u.leaveErrorBreadcrumb("BuyerJourneryIntercept: Cannot block progress",{extension:i,interceptorRequest:m}),h}return p&&m.behavior==="block"?(d.markBlocking(t),{isBlocking:!0,interceptorRunResponse:m}):(d.markNotBlocking(t),{isBlocking:!1,interceptorRunResponse:m})}}function ge(e,s){const{observability:n,captureEvent:t,extension:i,sourceType:r,activeRaces:o,extensionInstance:u}=s,d=(async()=>{try{return await e()}catch(a){n.error(new y(`${a} (in buyer journey interceptor)`,{cause:a}),{metadata:{extension:pe(i),source:{type:r}}})}})();return async()=>{const a=Pn(d,{captureEvent:t,extension:i,onTimeout:()=>{n.error(new y("perform() in buyer journey interceptor timed out"),{metadata:{extension:pe(i),source:{type:r}}})}},u.id);o.push(a),await a.finished}}function Vi(e,s){const n=[];if(Object.entries(s||{}).length||n.push("interceptor result cannot be empty or undefined"),(!s?.behavior||!["block","allow"].includes(s.behavior))&&n.push(`behavior must be either "block" or "allow", received "${s?.behavior}"`),s?.hasOwnProperty("perform")&&typeof s?.perform!="function"&&n.push(`perform must be a function: received type ${typeof s?.perform}`),s?.behavior==="block"&&typeof s.reason!="string"&&n.push(`reason must be a string: received type ${typeof s?.reason}`),n.length)throw new xn(n.join("; "));e.type==="local"&&!e.capabilities.blockProgress&&s?.behavior==="block"&&console.warn(`CannotBlockProgressWarning: extension is not allowed to block checkout progress; permission to block checkout progress must be specified under [capabilities] with flag "block_progress = true; see:
7
8https://shopify.dev/docs/api/checkout-ui-extensions/configuration#block-progress`)}function Os({page:e,disabled:s}){const{handle:n,route:t}=kn(e),{label:i}=e;return{handle:n,to:t,label:i,disabled:s}}function kn({id:e,route:s}){switch(e){case"information":case"shipping":case"payment":case"review":return{handle:e,route:`shopify:checkout${s}`};case"onePage":case"shopPay":return{handle:"checkout",route:`shopify:checkout${s}`};case"cart":return{handle:"cart",route:"shopify:cart"};default:return{handle:"unknown",route:"#"}}}function Ui({interceptorRegistrationResolvers:e,interceptorRegistration:s,extension:n,sourceType:t,observability:i}){if(s){Ut(e,n.id,s);return}i.error(new gn("Error registering interceptor resolver. No corresponding extension found in interceptorRegistrationResolversSignal."),{metadata:{extension:pe(n),source:{type:t}}})}function ue({cartInstructionsSignal:e,createSubscribableFromSignal:s}){return{instructions:s(e)}}function K({negotiated:e,createSubscribableFromSignal:s}){return{checkoutSettings:s(b(()=>{const n=e.fields.buyerIdentity.value?.customerProfile,t=e.fields.paymentFlexibilityPaymentTermsTemplate.value,i=t?{id:t.id,name:t.translatedName,dueDate:t.dueDate||void 0,dueInDays:t.dueInDays||void 0}:void 0,r=e.fields.checkoutCompletionTarget.value,o=r||"ORDER",u=n?.__typename==="BusinessCustomerProfile"&&n.checkoutExperienceConfiguration?n.checkoutExperienceConfiguration.editableShippingAddress:!0;return{orderSubmission:o,shippingAddress:{isEditable:u},paymentTermsTemplate:i}}))}}function Ue(e,s){return!e||e.length===0||!s?e:e.filter(n=>{const{targetMerchandiseLines:t}=n;return!t||t.length===0?!0:!t.some(r=>fn(r.stableId,s))})}function Q({negotiated:e,isOnePageCheckout:s,createSubscribableFromSignal:n}
8){return{cost:{subtotalAmount:n(e.fields.subtotal),totalShippingAmount:n(b(()=>{const t=e.fields.deliveryNext.value,i=e.fields.remoteMerchandiseDetails.value;if(t?.status!=="filled")return;const r=Ue(t.lines,i),o=Gi(r,!s);return o.length===0?void 0:{amount:o.reduce((d,{costAfterDiscounts:a})=>d+a.amount,0),currencyCode:o[0]?.costAfterDiscounts.currencyCode}})),totalTaxAmount:n(b(()=>{const t=e.fields.taxes.value;if(t?.status==="available_total")return t.totalTax;if(t?.status==="available_total_included")return t.totalIncludedInTarget;t?.status==="unavailable"&&console.error(`Taxes are unavailable: ${t.reason}`)})),totalAmount:n(e.fields.runningTotal)}}}function Gi(e,s){return e.reduce((n,t)=>{if(t.status==="not_required")return n;const{methods:i,selectedDeliveryMethodHandle:r}=t,o=i.find(({handle:d})=>r===d);if(!o)return n;const u=o?.priceBreakdown?.length&&o.priceBreakdown.every(d=>d.excludeFromDeliveryOptionPrice),l=o?.priceBreakdown?.every(d=>!!!d.targetMerchandiseLines[0]?.sellingPlan?.prepaid);return u&&l&&s||n.push({costAfterDiscounts:o.costAfterDiscounts}),n},[])}function wn(e,s){const n=s?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,type:Yi(e.methodType),carrier:{name:e.carrierName||void 0},cost:{amount:e.cost.amount,currencyCode:e.cost.currencyCode},costAfterDiscounts:{amount:e.costAfterDiscounts.amount,currencyCode:e.costAfterDiscounts.currencyCode},deliveryEstimate:$i(e),code:e.code||"",metafields:n||[]}}function Bi(e,s){const n=s?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,code:e.code||"",type:"pickup",location:{address:{address1:e.pickupLocation?.address.address1,address2:e.pickupLocation?.address.address2,city:e.pickupLocation?.address.city,countryCode:e.pickupLocation?.address.countryCode,phone:e.pickupLocation?.address.phone,zip:e.pickupLocation?.address.postalCode,provinceCode:e.pickupLocation?.address.zoneCode,...Xe(e.pickupLocation?.address)}},metafields:n||[]}}function Yi(e){return e==="LOCAL"?"local":"shipping"}function $i(e){return{timeInTransit:Fi(e.estimatedTimeInTransit)}}function Fi(e){if(e)return typeof e=="number"?{lower:e,upper:e}:{lower:e.lower,upper:e.upper}}function Hi({line:e,extensionContext:s,observability:n,proposedSelectedDeliveryMethodHandles:t,lines:i}){if(e.status==="available"){const r=Ji(e.methods,n,s);return{targetedCartLines:Ns(e.targetMerchandiseLines??[],i),deliveryOptions:r,selectedDeliveryOption:zi(e,r,t),groupType:Ee(e.type),isDeliveryRequired:!0,id:Ls(e.id)}}else return{targetedCartLines:Ns(e.targetMerchandiseLines,i),deliveryOptions:[],selectedDeliveryOption:void 0,groupType:Ee(e.type),isDeliveryRequired:!1,id:Ls(e.id)}}function Ns(e,s){return s?s.filter(t=>e.some(i=>i.stableId===t.stableId)).flatMap(({lineAllocations:t})=>t.map(i=>({id:`gid://shopify/CartLine/${i.stableId}`}))):[]}function zi(e,s,n){if(s.length===0)return;const t=e.methods.map(o=>o.handle),r=n.find(o=>o&&t.includes(o))||e.selectedDeliveryMethodHandle;return r?{handle:r}:void 0}function Ji(e,s,n){return e.map(t=>{switch(t.methodType){case"SHIPPING":case"LOCAL":return wn(t,n);case"PICK_UP":return ji(t,s,n);case"PICKUP_POINT":return Ki(t,s,n);case"RETAIL":case"NONE":return;default:{const i=`Unknown delivery method type: ${t.methodType}`;s?.error(new Ze(i),{metadata:{deliveryMethod:{type:t.methodType,handle:t.handle}}});return}}}).filter(t=>t!=null)}function ji(e,s,n){const t=qi(e,s);if(t==null)return;const i=n?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,code:e.code||"",type:"pickup",location:t,metafields:i||[]}}function qi({pickupLocation:e,methodType:s},n){if(e?.type==="PickupInStoreLocation"){const{address:i}=e;return{name:e?.name,address:{name:i.name,firstName:i.firstName,lastName:i.lastName,company:i.company,address1:i.address1,address2:i.address2,city:i.city,zip:i.postalCode,countryCode:i.countryCode,provinceCode:i.zoneCode,phone:i.phone,...Xe(i)}}}const t=`Invalid pickupLocation type ${e?.type} for ${s} delivery method`;n?.error(new Ze(t))}function Ki(e,s,n){const t=Xi(e,s);if(t==null)return;const i=n?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,code:e.code||"",type:"pickupPoint",cost:{amount:e.cost.amount,currencyCode:e.cost.currencyCode},costAfterDiscounts:{amount:e.costAfterDiscounts.amount,currencyCode:e.costAfterDiscounts.currencyCode},carrier:{name:Qi(e),code:Wi(e)},location:t,metafields:i||[]}}function Qi({pickupLocation:e}){if(e?.type==="PickupPointLocation")return e.carrierName}function Wi({pickupLocation:e}){if(e?.type==="PickupPointLocation")return e.carrierCode}function Xi({pickupLocation:e,methodType:s},n){if(e?.type==="PickupPointLocation"){const{name:i,address:r,handle:o}=e;return{name:i,handle:o,address:{name:r.name,firstName:r.firstName,lastName:r.lastName,company:r.company,address1:r.address1,address2:r.address2,city:r.city,zip:r.postalCode,countryCode:r.countryCode,provinceCode:r.zoneCode,phone:r.phone,...Xe(r)}}}const t=`Invalid pickupLocation type ${e?.type} for ${s} delivery method`;n?.error(new Ze(t))}function Xe(e){const s=e?.coordinates;return s?.latitude==null||s.longitude==null?{}:{latitude:s.latitude,longitude:s.longitude}}function Ls(e){if(e)return mn("DeliveryGroup",Ce(e))}
8class Ze extends Error{constructor(s){super(s),this.name="DeliveryError"}}class Le{constructor(s,n){this.measureAsync=(({functionToMeasure:t})=>Promise.resolve(t())),this.measureSync=(({functionToMeasure:t})=>t()),this.observability=n,this.extension=s}static wrapClient(s,n){return n instanceof Le?n:new Le(s,n)}counter(...s){this.observability.counter(...s)}gauge(...s){this.observability.gauge(...s)}histogram(...s){this.observability.histogram(...s)}debug(...s){this.observability.debug(...s)}log(...s){this.observability.log(...s)}addErrorMetadata(...s){this.observability.addErrorMetadata(...s)}leaveErrorBreadcrumb(...s){this.observability.leaveErrorBreadcrumb(...s)}addOnError(...s){this.observability.addOnError(...s)}removeOnError(...s){this.observability.removeOnError(...s)}async exportMetrics(){await this.observability.exportMetrics()}async exportLogs(){await this.observability.exportLogs()}addAttributesForLogs(...s){this.observability.addAttributesForLogs(...s)}enableKeepAlive(){return this.observability.enableKeepAlive()}error(s,n){const t={...n};t.metadata||(t.metadata={}),t.metadata.extension||(t.metadata.extension=pe(this.extension)),this.observability.error(s,t)}leaveBreadcrumb(s,n,t){this.observability.leaveErrorBreadcrumb(s,n,t)}}class xe{constructor(s){this.extension=s}filterMetafieldsByExtensionId(s){return s.filter(n=>{const t=n.namespace.split("--");return t[0]==="app"&&t[1]===Ce(this.extension.appId)||t[0]!=="app"})}}function es({line:e,extension:s,observability:n,proposedSelectedDeliveryMethodHandles:t,lines:i}){const r=s?new xe(s):void 0;return Hi({line:e,extensionContext:r,observability:Le.wrapClient(s,n),proposedSelectedDeliveryMethodHandles:t,lines:i})}function Zi(e,s){return Bi(e,new xe(s))}function W({extension:e,negotiated:s,proposed:n,observability:t,createSubscribableFromSignal:i}){return{deliveryGroups:i(b(()=>{const o=s.fields.deliveryNext.value;if(!o)return[];const u=o.status;if(u==="unavailable")return[];const d=n.deliveryLines.value.map(c=>c.fields.deliveryMethodHandle.value),a=s.fields.remoteMerchandiseDetails.value;if(u==="filled"||u==="partial")return Ue(o.lines,a).map(f=>es({line:f,extension:e,observability:t,proposedSelectedDeliveryMethodHandles:d,lines:s.fields.merchandiseLines.value?.lines}));const p=`Unknown delivery status: ${u}`;return t.error(new et(p),{metadata:{extension:pe(e)}}),[]}))}}function le({createSubscribableFromSignal:e,proposed:s,extension:n,negotiated:t}){return ne(n.approvalScopes,D.CustomerPersonalData)?{localizedFields:e(b(()=>{const i=s.localizationExtensions.value;return i?i.map(({fields:r})=>({key:r.key.value,title:r.title.value,value:r.value.value??""})):(t.value.localizationExtensions||[]).map(({key:r,title:o,value:u})=>({key:r,title:o,value:u??""}))}))}:{localizedFields:void 0}}function X({negotiated:e,proposed:s,createSubscribableFromSignal:n}){return{availablePaymentOptions:n(b(()=>{const t=e.fields.paymentMethods.value,i=s.paymentLines.value,r=e.fields.paymentLines.value,o=e.fields.deferredTotal.value,u="giftCard";if(!t)return[];let l=!1;const d=t?.filter(f=>f.type!==u?!0:(l=!0,!1)).map(f=>({method:f}));if(!d&&!l)return[];const a=rs(d),p=os(a,i,t,{negotiatedPaymentLines:r?.lines,deferredTotal:o}),c=p.some(f=>f.method.type===u);return p.map(f=>{const m="name"in f.method?f.method.name:void 0,h="paymentMethodIdentifier"in f.method&&f.method.paymentMethodIdentifier||void 0;return{handle:He(f.method.type,m,h),type:Fe(f.method.type)}}).concat(l&&!c?[{handle:He(u),type:Fe(u)}]:[])})),selectedPaymentOptions:n(b(()=>{const t=s.paymentLines.value,i=e.fields.paymentMethods.value,r=e.fields.paymentLines.value,o=e.fields.deferredTotal.value;if(!i)return[];const u=rs(t);return os(u,t,i,{negotiatedPaymentLines:r?.lines,deferredTotal:o}).map(d=>{const a="name"in d.method?d.method.name:void 0,p="paymentMethodIdentifier"in d.method&&d.method.paymentMethodIdentifier||void 0;return{handle:He(d.method.type,a,p),type:Fe(d.method.type)}})}))}}function ae({extension:e,ui:s}){return{ui:{overlay:{close(n){It(e,n)&&s.overlay.close(n)}}}}}function _(e){const{shop:s,extension:n,extensionInstance:t}=e;switch(n.apiVersion){case"2023-04":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{presentmentLines:u}=wi(e),{note:l}=G(e),{metafields:d}=te(e),{discountAllocations:a,discountCodes:p}=C(e),{appliedGiftCards:c}=V(e),{shippingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:t.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:Se(s),appliedGiftCards:c,attributes:r,discountAllocations:a,discountCodes:p,lines:o,metafields:d,note:l,presentmentLines:u,shippingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:As(e),...Y(e),...B(e),...z(e),...ae(e)}}case"2023-07":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:Se(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:As(e),...Y(e),...B(e),...z(e),...ae(e)}}case"2023-10":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:Se(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e)}}case"2024-01":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:Se(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e)}}case"2024-04":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e)}}case"2024-07":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e),...ue(e)}}case"2024-10":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e),...ue(e)}}case"2025-01":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2025-04":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2025-07":case"unstable":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2025-10":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2026-01":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{metafields:l}=te(e),{discountAllocations:d,discountCodes:a}=C(e),{appliedGiftCards:p}=V(e),{shippingAddress:c,billingAddress:f}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,discountAllocations:d,discountCodes:a,lines:o,metafields:l,note:u,shippingAddress:c,billingAddress:f,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ae(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2026-04":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{discountAllocations:l,discountCodes:d}=C(e),{appliedGiftCards:a}=V(e),{shippingAddress:p,billingAddress:c}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:a,attributes:r,discountAllocations:l,discountCodes:d,lines:o,note:u,shippingAddress:p,billingAddress:c,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2026-07":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{discountAllocations:l,discountCodes:d}=C(e),{appliedGiftCards:a}=V(e),{shippingAddress:p,billingAddress:c}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:a,attributes:r,discountAllocations:l,discountCodes:d,lines:o,note:u,shippingAddress:p,billingAddress:c,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2026-10":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{discountAllocations:l,discountCodes:d}=C(e),{appliedGiftCards:a}=V(e),{shippingAddress:p,billingAddress:c}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:a,attributes:r,discountAllocations:l,discountCodes:d,lines:o,note:u,shippingAddress:p,billingAddress:c,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ee(e),...re(e),...ue(e),...le(e)}}case"2027-01":{const i=F(e),{attributes:r}=M(e),{lines:o}=U(e),{note:u}=G(e),{discountAllocations:l,discountCodes:d}=C(e),{appliedGiftCards:a}=V(e),{shippingAddress:p,billingAddress:c}=w(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:a,attributes:r,discountAllocations:l,discountCodes:d,lines:o,note:u,shippingAddress:p,billingAddress:c,buyerJourney:q(e),...K(e),...H(e),...j(e),...Q(e),...X(e),...W(e),...$(e),storage:se(e),...Y(e),...B(e),...z(e),...ee(e),...re(e),...ue(e),...le(e)}}default:Me(n.apiVersion)}}function ss(e,{stableId:s}
8){const{extension:n}=e;switch(n.apiVersion){case"2023-04":return{...xi(e,s)};case"2023-07":return{...x(e,s)};case"2023-10":return{...x(e,s)};case"2024-01":return{...x(e,s)};case"2024-04":return{...x(e,s)};case"2024-07":return{...x(e,s)};case"2024-10":return{...x(e,s)};case"2025-01":return{...x(e,s)};case"2025-04":return{...x(e,s)};case"2025-07":case"unstable":return{...x(e,s)};case"2025-10":return{...x(e,s)};case"2026-01":return{...x(e,s)};case"2026-04":return{...x(e,s)};case"2026-07":return{...x(e,s)};case"2026-10":return{...x(e,s)};case"2027-01":return{...x(e,s)};default:Me(n.apiVersion)}}function x({createSubscribableFromSignal:e,negotiated:s},n){let t;return{target:e(b(()=>{const r=s.fields.merchandiseLines.value,o=ot({stableId:n,merchandiseLines:r?.lines??[]});if(o===null&&!t)throw new En("No merchandise item found");return o!==null&&(t=We(o)),t}))}}function xi({createSubscribableFromSignal:e,negotiated:s},n){let t;return{target:e(b(()=>{const r=s.fields.merchandiseLines.value,o=at(n,r?.lines??[]);if(o===null&&!t)throw new En("No merchandise item found");if(o!==null){const{parent:u,index:l}=o;t=Ln(ut(u,l))}return t}))}}const Ps=64;function Mn({applyChange:e,extension:s,proposed:n,createSubscribableFromSignal:t,extensionInstance:i,bankIdNumberSignal:r},{paymentMethodIdentifier:o}){const u=ne(s.approvalScopes,D.CheckoutExtensionPayments);async function l(d){return e({unknownChange:d,extension:s,extensionInstanceId:i.id,handlers:{async updatePaymentMethodAttributes({change:a}){if(!u)throw new y(er);a.attributes.forEach(c=>{if(typeof c.value=="string"&&c.value.length>Ps)throw new y(`Value length exceeded threshold ${Ps} for key ${c.key}`)});const p=n.paymentLines.peek();return n.paymentLines.value=p.map(c=>(c.method.type==="customOnsite"||c.method.type==="direct")&&c.method.paymentMethodIdentifier===o?{...c,method:{...c.method,paymentAttributes:JSON.stringify(a.attributes)}}:c),{type:"success"}}},errorResult:a=>({type:"error",message:a.message})})}return{applyPaymentMethodAttributesChange:l,paymentMethodAttributes:u?t(b(()=>{const d=n.paymentLines.value.find(({method:a})=>{if(a.type==="direct"||a.type==="customOnsite")return a.paymentMethodIdentifier===o&&a.paymentAttributes});if(d){const{paymentAttributes:a}=d.method;if(a)return JSON.parse(a)}})):void 0,bankIdNumber:u?t(r):void 0}}const er="Access denied: the extension does not have the required approval scopes";function sr({createSubscribableFromSignal:e,extension:s,negotiated:n,proposal:t},i){let r;const o=i?.handle,u=e(b(()=>{const d=n.fields.deliveryNext.value;if(!d||d.status!=="filled")return r;const c=d.lines.filter(f=>f.status==="available").flatMap(f=>f.methods).find(f=>f.handle===o);if(c){const f=Zi(c,s);r=qe(r,f)?r:f}return r})),l=e(b(()=>t.parts.deliveryLines.value.some(({fields:{deliveryMethodHandle:a}})=>o===a.value)));return{target:u,isTargetSelected:l}}function Cn({createSubscribableFromSignal:e},{isLocationFormVisible:s}){return{isLocationFormVisible:e(ye(s))}}function Vn({createSubscribableFromSignal:e},{isLocationFormVisible:s}){return{isLocationFormVisible:e(ye(s))}}function nr({extension:e,negotiated:s,applyChange:n,extensionInstance:t},{paymentMethodIdentifier:i,submitRedeemablePaymentLine:r}){return{async applyRedeemableChange(o){return n({unknownChange:o,extension:e,extensionInstanceId:t.id,handlers:{async redeemableAddChange({negotiate:u,change:l}){if(!(e.type==="local")&&!ne(e.approvalScopes,D.CheckoutExtensionRedeemables))throw new y("Access denied: the extension does not have the required approval scopes");const a=s.fields.availableRedeemables.peek()?.map(E=>({paymentMethod:St(E.paymentMethod)}))??[],p={paymentMethod:{type:"redeemable",redemptionSource:"CUSTOM",redemptionContent:{paymentMethodIdentifier:i,maskedIdentifier:tr(l.identifier),redemptionAttributes:l.attributes}}},c=Tt(p),f=await u({customizeNegotiation:E=>({...E,availableRedeemables:{availableRedeemables:a.concat(c)}}),fieldsToResolve:["availableRedeemables"]}),m=f.status==="error"&&f.violations.some(us),h=f.violations.find(us);if(m)throw new y("Could not apply redeemable",{cause:{code:h?.code}});if(r){const E=f.negotiated.availableRedeemables?.find(P=>dt(p.paymentMethod,P.paymentMethod)),v=f.negotiated.paymentDue;if(!E||!v)throw new y("Could not apply redeemable",{cause:{code:h?.code}});const g=await r(E,v),A=g&&(g.status==="error"&&g.violations.some(Wn)||g.status!=="error"&&g.status!=="success");if(!g||A)throw new y("Could not submit redeemable as a payment line")}return{type:"success"}}},errorResult:u=>({type:"error",message:u.message})})}}}function tr(e){return e.slice(0,-4).replace(/./g,"•")+e.slice(-4)}function Un({createSubscribableFromSignal:e,extension:s,negotiated:n,proposal:t},{handle:i,isInModal:r}){let o;const u=e(b(()=>{const a=s?new xe(s):void 0,p=n.fields.deliveryNext.value;if(!p||p.status!=="filled")return o;const m=p.lines.filter(h=>h.status==="available").flatMap(h=>h.methods).find(h=>h.handle===i);if(m){const h=wn(m,a);o=qe(o,h)?o:h}return o}
8)),l=e(b(()=>t.parts.deliveryLines.value.some(p=>i===p.fields.deliveryMethodHandle.value)));return{target:u,isTargetSelected:l,renderMode:{overlay:r??!1}}}function Gn(e,s){const{extension:{apiVersion:n}}=e;switch(n){case"2023-04":case"2023-07":case"2023-10":return{};case"2024-01":case"2024-04":return ir(e,s??{});case"2024-07":return de(e,s??{});case"2024-10":return de(e,s??{});case"2025-01":return de(e,s??{});case"2025-04":return de(e,s??{});case"2025-07":case"unstable":return de(e,s??{});case"2025-10":return de(e,s??{});case"2026-01":return de(e,s??{});case"2026-04":return de(e,s??{});case"2026-07":return de(e,s??{});case"2026-10":return de(e,s??{});case"2027-01":return de(e,s??{});default:Me(n)}}function de({createSubscribableFromSignal:e,observability:s,extension:n,proposed:t,negotiated:i},{includeDeliverySelectionGroups:r,groupType:o}){return{target:e(b(()=>{const u=i.fields.deliveryNext.value;if(!o||u?.status!=="filled")return;const l=i.fields.remoteMerchandiseDetails.value,d=u.lines.filter(yn),p=Ue(d,l).filter(({type:v})=>Ee(v)===o),f=t.deliveryLines.value.filter(v=>Ee(v.fields.type.value)===o).map(v=>v.fields.deliveryMethodHandle.value),m=i.fields.merchandiseLines.value?.lines,h=v=>es({line:v,extension:n,observability:s,proposedSelectedDeliveryMethodHandles:f,lines:m}),E=p.map(h);return E.length>0?{groupType:o,deliveryGroups:E}:void 0})),deliverySelectionGroups:e(b(()=>{const u=t.deliveryMacros.value,l=t.deliveryLines.value.map(a=>a.value).filter(({type:a,deliveryMethodTypes:p})=>a==="ONE_TIME_PURCHASE"&&p.some(c=>c==="SHIPPING"||c==="LOCAL"));if(!r||!u.length||!l.length)return;const d=new Set(l.map(({deliveryMethodHandle:a})=>a).filter(a=>!!a));return u.map(a=>{const p=Object.values(a.deliveryMethodHandles).filter(c=>!!c);return{handle:a.id,selected:p.length===d.size&&p.every(c=>d.has(c)),title:a.title,associatedDeliveryOptions:p.map(c=>({handle:c})),cost:{amount:a.cost.amount,currencyCode:a.cost.currencyCode},costAfterDiscounts:{amount:a.costAfterDiscounts.amount,currencyCode:a.costAfterDiscounts.currencyCode}}})}))}}function ir({createSubscribableFromSignal:e,observability:s,extension:n,proposed:t,negotiated:i},{groupType:r}){return{target:e(b(()=>{const o=i.fields.deliveryNext.value;if(!r||o?.status!=="filled")return;const u=i.fields.remoteMerchandiseDetails.value,l=o.lines.filter(yn),a=Ue(l,u).filter(({type:E})=>Ee(E)===r),c=t.deliveryLines.value.filter(E=>Ee(E.fields.type.value)===r).map(E=>E.fields.deliveryMethodHandle.value),f=i.fields.merchandiseLines.value?.lines,m=E=>es({line:E,extension:n,observability:s,proposedSelectedDeliveryMethodHandles:c,lines:f}),[h]=a;return h?m(h):void 0}))}}const ks={name:"Checkout::Dynamic::Render",api(e){return{..._(e),...O(e),...Ve(e)}}},ws={name:"Checkout::Actions::RenderBefore",api(e){return{..._(e),...O(e)}}},Ms={name:"Checkout::CartLineDetails::RenderAfter",api(e,s){return{..._(e),...O(e),...ss(e,s),...Ve(e)}}},Cs={name:"Checkout::CartLineDetails::RenderLineComponents",api(e,s){return{..._(e),...ss(e,s)}}},Vs={name:"Checkout::CartLines::RenderAfter",api(e){return{..._(e),...O(e),...Ve(e)}}},Us={name:"Checkout::Contact::RenderAfter",api(e){return{..._(e),...O(e)}}},Gs={name:"Checkout::CustomerInformation::RenderAfter",api(e){return{..._(e),...O(e),...Ve(e)}}},Bs={name:"Checkout::DeliveryAddress::RenderBefore",api(e){return{..._(e),...O(e)}}},Ys={name:"purchase.checkout.delivery-address.render-after",api(e){return{..._(e),...O(e)}}},$s={name:"Checkout::GiftCard::Render",api(e,s){return{..._(e),...O(e),...nr(e,s)}}},Fs={name:"Checkout::PaymentMethod::Render",api(e,s){return{..._(e),...O(e),...Mn(e,s)}}},Hs={name:"Checkout::PaymentMethod::HostedFields::RenderAfter",api(e,s){return{..._(e),...O(e),...Mn(e,s)}}},zs={name:"Checkout::PaymentMethod::RenderRequiredAction",api(e){return{..._(e),...O(e)}}},Js={name:"purchase.checkout.payment-method-list.render-before",api(e){return{..._(e),...O(e)}}},js={name:"purchase.checkout.payment-method-list.render-after",api(e){return{..._(e),...O(e)}}},qs={name:"Checkout::PickupLocations::RenderBefore",api(e,s){return{..._(e),...O(e),...Cn(e,s)}}},Ks={name:"Checkout::PickupLocations::RenderAfter",api(e,s){return{..._(e),...O(e),...Cn(e,s)}}},Qs={name:"Checkout::PickupPoints::RenderBefore",api(e,s){return{..._(e),...O(e),...Vn(e,s)}}},Ws={name:"Checkout::PickupPoints::RenderAfter",api(e,s){return{..._(e),...O(e),...Vn(e,s)}}},Xs={name:"purchase.checkout.pickup-location-option-item.render-after",api(e,s){return{..._(e),...O(e),...sr(e,s)}}},Zs={name:"Checkout::Reductions::RenderBefore",api(e){return{..._(e),...O(e)}}},xs={name:"Checkout::Reductions::RenderAfter",api(e){return{..._(e),...O(e)}}},en={name:"Checkout::ShippingMethodDetails::RenderAfter",api(e,s){return{..._(e),...O(e),...Un(e,s)}}},sn={name:"Checkout::ShippingMethodDetails::RenderExpanded",api(e,s){return{..._(e),...O(e),...Un(e,s)}}},nn={name:"Checkout::ShippingMethods::RenderBefore",api(e,s){return{..._(e),...O(e),...Gn(e,s)}}},tn={name:"Checkout::ShippingMethods::RenderAfter",api(e,s){return{..._(e),...O(e),...Gn(e,s)}}},rn={name:"purchase.checkout.header.render-after",api(e){return{..._(e),...O(e)}}},on={name:"purchase.checkout.footer.render-after",api(e){return{..._(e),...O(e)}}},Pe={name:"purchase.checkout.chat.render",api(e){return{..._(e),...O(e)}}};function rr({extensionInstance:e,announcementEmitter:s}){return e.target!=="purchase.thank-you.announcement.render"?{}:(e.on("destroy",()=>{s.removeAllListeners()}),e.on("restart",()=>{s.removeAllListeners()}),{})}function ve({createSubscribableFromSignal:e,checkout:s,isCheckoutEditor:n,journeyCompletedSignal:t,observability:i}){return{orderConfirmation:e(b(()=>{const r=s.latestReceipt.value,o=!r||r.status!=="processed";if(o&&n)return{order:{id:mn("Order","0")},number:Ot().substring(0,10),isFirstOrder:!0};if(o){const u=t.peek()?"No receipt available on thankYou page":"No receipt available";throw r&&i.leaveErrorBreadcrumb("Receipt (OrderConfirmationApi):",{status:r.status,keys:Object.keys(r)}),new st(u)}return{order:{id:r.orderIdentity.id},number:r.orderIdentity.buyerIdentifier??void 0,isFirstOrder:r.isFirstOrder??!0}}))}}const an={name:"Checkout::ThankYou::Dynamic::Render",api(e){return{..._(e),...ve(e)}}},un={name:"Checkout::ThankYou::CartLineDetails::RenderAfter",api(e,s){return{..._(e),...ss(e,s),...ve(e)}}},dn={name:"Checkout::ThankYou::CartLines::RenderAfter",api(e){return{..._(e),...ve(e)}}},cn={name:"Checkout::ThankYou::CustomerInformation::RenderAfter",api(e){return{..._(e),...ve(e)}}},ln={name:"purchase.thank-you.header.render-after",api(e){return{..._(e),...ve(e)}}},pn={name:"purchase.thank-you.footer.render-after",api(e){return{..._(e),...ve(e)}}},ke={name:"purchase.thank-you.chat.render",api(e){return{..._(e),...ve(e)}}},we={name:"purchase.thank-you.announcement.render",api(e){return{..._(e),...ve(e),...rr(e)}}},Dr={[ks.name]:ks,[ws.name]:ws,[Ms.name]:Ms,[Cs.name]:Cs,[Vs.name]:Vs,[Us.name]:Us,[Gs.name]:Gs,[Bs.name]:Bs,[Ys.name]:Ys,[$s.name]:$s,[Fs.name]:Fs,[Hs.name]:Hs,[Js.name]:Js,[js.name]:js,[qs.name]:qs,[Ks.name]:Ks,[Xs.name]:Xs,[Qs.name]:Qs,[Ws.name]:Ws,[zs.name]:zs,[Zs.name]:Zs,[xs.name]:xs,[en.name]:en,[nn.name]:nn,[tn.name]:tn,[sn.name]:sn,[rn.name]:rn,[on.name]:on,[Pe.name]:Pe,[an.name]:an,[un.name]:un,[dn.name]:dn,[cn.name]:cn,[ln.name]:ln,[pn.name]:pn,[ke.name]:ke,[we.name]:we},br=[Pe.name,ke.name,we.name],Sr=[Pe.name,ke.name,we.name];export{br as D,Li as M,Dr as R,Sr as a,w as b,M as c,te as d,cs as e,$ as f,se as g,oe as h,he as i,J as j,F as k,z as l,H as m,ee as n,Y as o,Rr as p,Ai as q,Vt as r,hs as s,_r as t,Ir as u,
8Er as v,Ar as w,Ct as x,gr as y};

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.