1import{a as e}from"./2c1ab0fe.D_oO1jU7.js";import{eF as t,as as r,eG as a,eH as n,eI as i,eJ as o,cm as s,aa as d,eK as c,V as l,at as u,av as p,eL as m}from"./4c290a1e.D9lE9kmU.js";import{h,e as y,a as g,b as f,o as P,t as v,c as b}from"./2255f8fa.DZJKRP_r.js";import{e as T}from"./05a2a9c8.DmM9tTSM.js";import"./app.bDJ3v-8C.js";class A extends Error{constructor(){super(...arguments),this.name="ReceiptError"}}function k(s,d={pollingTimeoutReached:!1,skipToThankYouPage:!1,waitingForPostPurchaseDone:!1}){if(h(s))return y(s);switch(s.__typename){case"ProcessingRemoteCheckoutsReceipt":return{status:"processing_remote_checkouts",id:s.id,pollAt:Date.now()+s.pollDelay+o,remoteCheckouts:(S=s.remoteCheckouts,S.map((t=>{switch(t.__typename){case"SubmittingRemoteCheckout":return{status:"submitting",shopId:t.shopId};case"SubmittedRemoteCheckout":return{status:"submitted",shopId:t.shopId};case"FailedRemoteCheckout":return{status:"failed",shopId:t.shopId};default:return e(t)}})))};case"ProcessedReceipt":{if(s.postPurchasePageRequested&&"NOT_READY"===s.postPurchaseVaultedPaymentMethodStatus&&!d.pollingTimeoutReached)return{status:"polling_for_order",id:s.id,token:s.token};const e={amount:parseFloat(s.purchaseOrder.totalAmountToPay.amount),currencyCode:s.purchaseOrder.totalAmountToPay.currencyCode},o=t(s.purchaseOrder.note);return{status:"processed",id:s.id,token:s.token,redirectUrl:s.redirectUrl||null,mapUrl:s.mapUrl??null,mapVisibility:s.mapVisibility,confirmationPage:{url:s.confirmationPage.url,shouldRedirect:s.confirmationPage.shouldRedirect},analytics:{checkoutCompletedEventId:s.analytics?.checkoutCompletedEventId||null,emitConversionEvent:s.analytics?.emitConversionEvent||!1},orderIdentity:{buyerIdentifier:s.orderIdentity.buyerIdentifier,id:s.orderIdentity.id},paymentDetails:{paymentCardBrand:s.paymentDetails?.paymentCardBrand,creditCardLastFourDigits:s.paymentDetails?.creditCardLastFourDigits,paymentAmount:s.paymentDetails?.paymentAmount?.amount,paymentCurrency:s.paymentDetails?.paymentAmount?.currencyCode,paymentGateway:s.paymentDetails?.paymentGateway,financialPendingReason:s.paymentDetails?.financialPendingReason,paymentDescriptor:s.paymentDetails?.paymentDescriptor,buyerActionInfo:s.paymentDetails?.buyerActionInfo??void 0,paymentIcon:s.paymentDetails?.paymentIcon,installmentDetails:s.paymentDetails?.installmentDetails??void 0},purchaseOrder:{email:O(s.purchaseOrder.buyerIdentity),phone:M(s.purchaseOrder.buyerIdentity),checkoutCompletionTarget:s.purchaseOrder.checkoutCompletionTarget,shippingAddress:R(s.purchaseOrder.delivery,s.completedRemoteCheckouts),billingAddress:C(s.purchaseOrder.payment,s.completedRemoteCheckouts),paymentLines:E(s.purchaseOrder.payment.paymentLines),deliveryNext:D(s.purchaseOrder.delivery,o,s.completedRemoteCheckouts),deliveryExpectations:(p=s.purchaseOrder.deliveryExpectations,p?{status:"filled",deliveryExpectationLines:p.map((e=>({deliveryOptionHandle:void 0,deliveryStrategyHandle:e.deliveryStrategyHandle,brandedPromise:e.brandedPromise?{name:e.brandedPromise.name,logoUrl:e.brandedPromise.logoUrl,handle:e.brandedPromise.handle,darkThemeLogoUrl:e.brandedPromise.darkThemeLogoUrl,lightThemeLogoUrl:e.brandedPromise.lightThemeLogoUrl}:void 0,minDeliveryDateTime:void 0,maxDeliveryDateTime:void 0,deliveryExpectationPresentmentTitle:e.deliveryExpectationPresentmentTitle,promiseProviderApiClientId:void 0,returnability:e.returnability?.returnable})))}:{status:"unavailable",deliveryExpectationLines:null}),paymentDue:g(s.purchaseOrder.payment,e),runningTotal:e,merchandiseLines:T(s.purchaseOrder.merchandise),totalTaxes:s.purchaseOrder.tax.totalTaxAmountV2?B(s.purchaseOrder.tax.totalTaxAmountV2):void 0,metafields:s.purchaseOrder.metafields,cartMetafields:s.purchaseOrder.cartMetafields},purchaseOrderNumber:s.poNumber??void 0,orderStatusPageUrl:s.orderStatusPageUrl,orderCreationStatus:(u=s.orderCreationStatus,"OrderCreationSucceeded"===u.__typename?{status:"created"}:{status:"processing"}),postPurchasePageUrl:s.postPurchasePageUrl,postPurchaseVaultingStatus:F(s.postPurchaseVaultedPaymentMethodStatus),postPurchasePageRequested:s.postPurchasePageRequested,shopPayArtifact:{optIn:s.purchaseOrder.shopPayArtifact?.optIn??void 0},shopAppLinksAndResources:{qrCodeUrl:s.shopAppLinksAndResources.qrCodeUrl,mobileUrl:s.shopAppLinksAndResources.mobileUrl,orderTrackingMobileUrl:s.shopAppLinksAndResources?.orderTrackingMobileUrl??void 0,canTrackOrderUpdates:s.shopAppLinksAndResources.canTrackOrderUpdates,shopInstallmentsViewSchedules:s.shopAppLinksAndResources.shopInstallmentsViewSchedules,installmentsHighlightEligible:s.shopAppLinksAndResources.installmentsHighlightEligible,shopInstallmentsMobileUrl:s.shopAppLinksAndResources.shopInstallmentsMobileUrl,mobileUrlAttributionPayload:s.shopAppLinksAndResources.mobileUrlAttributionPayload,shopAppEligible:s.shopAppLinksAndResources.shopAppEligible,payEscrowMayExist:Boolean(s.shopAppLinksAndResources.payEscrowMayExist),shopAppQrCodeKillswitch:s.shopAppLinksAndResources.shopAppQrCodeKillswitch,shopPayOrder:s.shopAppLinksAndResources.shopPayOrder,buyerHasShopApp:s.shopAppLinksAndResources?.buyerHasShopApp??void 0,buyerHasShopPay:s.shopAppLinksAndResources?.buyerHasShopPay??void 0,buyerHasOrderTrackingPush:s.shopAppLinksAndResources?.buyerHasOrderTrackingPush??void 0,orderTrackingPushCtaVariant:s.shopAppLinksAndResources?.orderTrackingPushCtaVariant??void 0,orderUpdateOptions:s.shopAppLinksAndResources.orderUpdateOptions,giveawayAmount:s.shopAppLinksAndResources.giveawayAmount?{amount:parseFloat(s.shopAppLinksAndResources.giveawayAmount.amount),currencyCode:s.shopAppLinksAndResources.giveawayAmount.currencyCode}:void 0},skipToThankYouPage:Boolean(d.skipToThankYouPage),waitingForPostPurchaseDone:!1,eligibleForMarketingOptIn:s.eligibleForMarketingOptIn,paymentExtensionBrand:s.paymentExtensionBrand,lpmDisclosure:s.lpmDisclosure??void 0,recurringTotals:i(s.purchaseOrder.recurringTotals),deferredTotal:n(s.purchaseOrder.deferredTotal??void 0),checkoutTotalBeforeTaxesAndShipping:s.purchaseOrder.checkoutTotalBeforeTaxesAndShipping?r(s.purchaseOrder.checkoutTotalBeforeTaxesAndShipping):void 0,checkoutTotal:r(s.purchaseOrder.checkoutTotal),checkoutTotalTaxes:s.purchaseOrder.checkoutTotalTaxes?r(s.purchaseOrder.checkoutTotalTaxes):void 0,taxes:v({...s.purchaseOrder.tax,totalTaxAmount:s.purchaseOrder.tax.totalTaxAmountV2??void 0}),legacyRepresentProductsAsFees:s.purchaseOrder.legacyRepresentProductsAsFees,totalSavings:r(s.purchaseOrder.totalSavings),subtotal:r(s.purchaseOrder.subtotalBeforeTaxesAndShipping),landedCostDetails:s.purchaseOrder.landedCostDetails?.incotermInformation??void 0,dutiesIncluded:s.purchaseOrder.dutiesIncluded??void 0,duties:(l=s.purchaseOrder.tax.totalDutyAmount,l?{status:"available_total",totalDuty:r(l)}:{status:"unavailable",reason:""}),paymentFlexibilityPaymentTermsTemplate:s.paymentFlexibilityPaymentTermsTemplate??void 0,optionalDuties:s.purchaseOrder.optionalDuties?P(s.purchaseOrder.optionalDuties):void 0,discountLines:(c=s.purchaseOrder.discounts,{lines:c.lines.map(V).filter((e=>Boolean(e)))}),tipLines:(k=s.purchaseOrder.tip,k.tipLines.map((e=>({amount:r(e.amount)})))),hasOnlyDeferredShipping:s.purchaseOrder.hasOnlyDeferredShipping,acceptEmailMarketing:(b=s.purchaseOrder.buyerIdentity,G(b)??b.marketingConsent.some((e=>"PurchaseOrderEmailContactMethod"===e.__typename))),acceptSmsMarketing:N(s.purchaseOrder.buyerIdentity),smsMarketingPhone:H(s.purchaseOrder.buyerIdentity),note:s.purchaseOrder.note.message??void 0,paymentMethods:W(s.purchaseOrder.payment.paymentLines),customerId:s.customerId??void 0,isFirstOrder:s.isFirstOrder??void 0,isRedacted:s.isRedacted,buyerIdentity:s.purchaseOrder.buyerIdentity?f(s.purchaseOrder.buyerIdentity):void 0,subtotalAfterMerchandiseDiscounts:s.purchaseOrder.subtotalAfterMerchandiseDiscounts?r(s.purchaseOrder.subtotalAfterMerchandiseDiscounts):void 0,subtotalBeforeReductions:r(s.purchaseOrder.subtotalBeforeReductions),customAttributes:s.purchaseOrder.note?.customAttributes??void 0,legacySubtotalBeforeTaxesShippingAndFees:r(s.purchaseOrder.legacySubtotalBeforeTaxesShippingAndFees),legacyMerchandiseLinesAsFees:a(s.purchaseOrder.legacyAggregatedMerchandiseTermsAsFees),consolidatedProposedSubtotalBeforeTaxesAndShipping:s.consolidatedProposedSubtotalBeforeTaxesAndShipping?r(s.consolidatedProposedSubtotalBeforeTaxesAndShipping):void 0,completedRemoteCheckouts:j(s.completedRemoteCheckouts),remotePaymentDue:g(s.purchaseOrder.payment,s.consolidatedTotals?.runningTotal?r(s.consolidatedTotals.runningTotal):void 0),consolidatedTotals:s.consolidatedTotals?(m=s.consolidatedTotals,{total:r(m.runningTotal),runningTotal:r(m.runningTotal),subtotal:r(m.subtotalBeforeTaxesAndShipping),subtotalBeforeReductions:r(m.subtotalBeforeReductions),totalSavings:r(m.totalSavings),checkoutTotalTaxes:m.checkoutTotalTaxes?r(m.checkoutTotalTaxes):void 0,checkoutTotalBeforeTaxesAndShipping:m.checkoutTotalBeforeTaxesAndShipping?r(m.checkoutTotalBeforeTaxesAndShipping):void 0,checkoutTotal:m.checkoutTotal?r(m.checkoutTotal):void 0}):void 0,consolidatedTaxes:s.consolidatedTaxes?_(s.consolidatedTaxes,s.completedRemoteCheckouts):void 0,remoteMerchandiseDetails:X(s.completedRemoteCheckouts)}}
1default:throw new A(`Unknown receipt type: ${s.__typename}`)}var c,l,u,p,m,b,k,S}function O(e){const{contactMethod:t}=e;return"PurchaseOrderEmailContactMethod"===t?.__typename?t.email:void 0}function M(e){const{contactMethod:t}=e;return"PurchaseOrderSMSContactMethod"===t?.__typename?t.phoneNumber:void 0}function R(e,t){const r=e.deliveryLines.find((e=>e.destinationAddress))?.destinationAddress,a="StreetAddress"===r?.__typename?d(r):void 0;if(a)return a;const n=t?.find((e=>"SubmittedRemoteCheckout"===e.__typename))?.processedRemoteReceipt.remotePurchaseOrder.delivery.deliveryLines.find((e=>e.destinationAddress))?.destinationAddress;return"StreetAddress"===n?.__typename?d(n):void 0}function C(e,t){const r=e.billingAddress&&"address1"in e.billingAddress?e.billingAddress:void 0,a=e.paymentLines.find((e=>"WalletPaymentMethod"===e.paymentMethod.__typename));if(a)return function(e,t){if("WalletPaymentMethod"!==e?.paymentMethod?.__typename)return;if("FacebookPayWalletContent"===e?.paymentMethod?.walletContent.__typename)return;const r=e?.paymentMethod?.walletContent.billingAddress??t??void 0;return r?d(r):void 0}(a,r);const n=e.paymentLines.map((e=>e.paymentMethod)).filter((e=>"billingAddress"in e)),i=n.find((e=>e.billingAddress&&"address1"in e.billingAddress))?.billingAddress??r??void 0,o=i?d(i):void 0;if(o)return o;for(const s of t??[]){if("SubmittedRemoteCheckout"!==s.__typename)continue;const e=s.processedRemoteReceipt.remotePurchaseOrder.payment;for(const r of e.paymentLines){const e=r.paymentMethod,t="DirectPaymentMethod"===e.__typename?e.billingAddress:void 0;if(t&&"address1"in t)return d(t)}const t=e.billingAddress;if(t&&"address1"in t)return d(t)}}function S(e){if("PickupInStoreLocation"===e?.__typename||"PickupPointLocation"===e?.__typename){if("PickupPointLocation"===e?.__typename){const{name:t,carrierCode:r,carrierName:a,carrierLogoUrl:n,fromDeliveryOptionGenerator:i,address:o}=e;return{name:t,address:d(o),carrierName:a,carrierCode:r,carrierLogoUrl:n,fromDeliveryOptionGenerator:i,type:e?.__typename}}return{name:e.name,address:d(e.address),instructions:e.instructions,type:e?.__typename}}}function _(e,t){if(!t)return;const r=new Map;for(const a of t)"SubmittedRemoteCheckout"===a.__typename&&r.set(a.shopId,v({...a.processedRemoteReceipt.remotePurchaseOrder.tax,totalTaxAmount:a.processedRemoteReceipt.remotePurchaseOrder.tax.totalTaxAmountV2??void 0}));return{perShopTaxes:r,consolidatedTaxes:b(e)}}function I(e,t){if(e)return e.map((({amount:e,discountRecurringCycleLimit:a,excludeFromDeliveryOptionPrice:n,targetMerchandise:i,flatRateGroupId:o})=>({amount:r(e),discountRecurringCycleLimit:a??void 0,excludeFromDeliveryOptionPrice:n,targetMerchandiseLines:x(i,t),flatRateGroupId:o??void 0})))}function x(e,t){return e.reduce(((e,r)=>{if("PurchaseOrderMerchandiseLine"!==r.__typename&&"PurchaseOrderBundleLineComponent"!==r.__typename)return e;const{stableId:a,merchandise:n,quantity:i}=r;if("ProductVariantSnapshot"===n.__typename){const r=Y(i),o=n.image?{...n.image,altText:n.image.altText||void 0}:void 0;return[...e,{id:n.variantId,digest:n.digest,title:n.productTitle,stableId:a,requiresShipping:!t&&(n.requiresShipping??!0),properties:p(n.properties),subtitle:n.title??void 0,sellingPlan:u(n.sellingPlan),quantity:r,image:o}]}return e}),[])}function D(e,t,a){const n=e.deliveryLines.map((e=>function(e,t){const a={amountCombinabilityToken:e.deliveryStrategy.amountCombinabilityToken,deliveryPresentationGroupToken:e.deliveryStrategy.deliveryPresentationGroupToken,handle:e.deliveryStrategy.handle,title:e.deliveryStrategy.title,de
1scription:e.deliveryStrategy.description??void 0,cost:r(e.lineAmount),costAfterDiscounts:r(e.lineAmountAfterDiscounts),estimatedTimeInTransit:void 0,methodType:e.deliveryStrategy.methodType,brandedPromise:e.deliveryStrategy.brandedPromise,pickupLocation:S(e.deliveryStrategy.pickupLocation),deliveryPromisePresentmentTitle:e.deliveryStrategy.deliveryPromisePresentmentTitle,metafields:[],priceBreakdown:I(e.deliveryStrategy.deliveryStrategyBreakdown,t),deliveryPredictionEligible:!1};return a&&"NONE"!==a.methodType?{status:"available",methods:[a],selectedDeliveryMethodHandle:a.handle,type:e.groupType,targetMerchandiseLines:x(e.targetMerchandise,t),availableOn:e.availableOn}:{status:"not_required",type:e.groupType,targetMerchandiseLines:x(e.targetMerchandise,t)}}(e,t))),i=function(e){const t=e?.filter((e=>"SubmittedRemoteCheckout"===e.__typename));return t&&0!==t.length?t.flatMap((e=>e.processedRemoteReceipt.remotePurchaseOrder.delivery.deliveryLines.filter((e=>"NONE"!==e.deliveryStrategy.methodType)).map((e=>function(e){return{status:"available",methods:[{cost:r(e.lineAmount),costAfterDiscounts:r(e.lineAmount),deliveryPredictionEligible:!1,estimatedTimeInTransit:void 0,handle:e.deliveryStrategy.handle,metafields:[],methodType:e.deliveryStrategy.methodType,title:e.deliveryStrategy.title}],selectedDeliveryMethodHandle:e.deliveryStrategy.handle,type:e.groupType,targetMerchandiseLines:(t=e.targetMerchandise,t.reduce(((e,t)=>{if("PurchaseOrderMerchandiseLine"!==t.__typename)return e;const{stableId:r,merchandise:a,quantity:n}=t;if("ProductVariantSnapshot"===a.__typename){const t=Y(n);return[...e,{digest:a.digest,title:a.productTitle,stableId:r,requiresShipping:a.requiresShipping,properties:[],quantity:t}]}return e}),[])),availableOn:e.availableOn};var t}(e))))):[]}(a);return{status:"filled",lines:[...n,...i],splitShippingToggle:e.splitShippingToggle}}function L(e,t){const r="PurchaseOrderGiftCardPaymentMethod"===e.paymentMethod.__typename,a="PurchaseOrderGiftCardPaymentMethod"===t.paymentMethod.__typename;return r&&!a?-1:!r&&a?1:0}function E(e){return e.filter((e=>!e.due)).sort(L).map((e=>({...w(e.paymentMethod),cost:B(e.amount),specialInstructions:e.postPaymentMessage??void 0})))}function B(e){if(null!=e)return{amount:parseFloat(e.amount),currencyCode:e.currencyCode}}function w(e){switch(e.__typename){case"DirectPaymentMethod":return{method:{type:"direct",sessionId:e.sessionId,paymentMethodIdentifier:e.paymentMethodIdentifier??"",brand:e.creditCard?.brand??void 0,creditCardLastFourDigits:e.creditCard?.lastDigits??void 0,vaultingAgreement:e.vaultingAgreement}};case"CustomerCreditCardPaymentMethod":return{method:{type:l.CreditCard,id:e.id,token:e.token,billingAddress:d(e.billingAddress),brand:e.brand,firstDigits:e.firstDigits??void 0,displayLastDigits:e.displayLastDigits,defaultPaymentMethod:e.defaultPaymentMethod,deletable:e.deletable,requiresCvvConfirmation:e.requiresCvvConfirmation}};case"PaymentOnDeliveryMethod":return{method:{type:"paymentOnDelivery",additionalDetails:e.additionalDetails??"",paymentInstructions:e.paymentInstructions??"",paymentMethodIdentifier:e.paymentMethodIdentifier??"",availablePresentmentCurrencies:[]}};case"PurchaseOrderGiftCardPaymentMethod":return{method:{type:"giftCard",code:e.code,balance:B(e.balance)}};case"WalletPaymentMethod":return{method:{type:"wallet",name:e.name,walletContent:U(e.walletContent)}};case"WalletsPlatformPaymentMethod":return{method:{type:"walletsPlatformPaymentMethod",name:e.name,walletParams:e.walletParams}};case"LocalPaymentMethod":return{method:{type:"local",paymentMethodIdentifier:e.paymentMethodIdentifier??"",name:e.name}};case"DeferredPaymentMethod":return{method:{type:"deferred"}};case"ManualPaymentMethod":return{method:{type:"manualPayment",name:e.name,id:e.id,additionalDetails:e.additionalDetails??"",paymentInstructions:e.paymentInstructions??"",paymentMethodIdentifier:e.paymentMethodIdentifier??"",availablePresentmentCurrencies:[]}};case"CustomPaymentMethod":return{method:{type:"customManualPayment",name:e.name,id:e.id,additionalDetails:e.additionalDetails??"",paymentInstructions:e.paymentInstructions??"",paymentMethodIdentifier:e.paymentMethodIdentifier??"",availablePresentmentCurrencies:[]}};case"PaypalBillingAgreementPaymentMethod":return{method:{type:l.PayPal,token:e.token,billingAddress:d(e.billingAddress)}};case"OffsitePaymentMethod":return{method:{type:"offsite",paymentMethodIdentifier:e.paymentMethodIdentifier??void 0,name:e.name}};case"RedeemablePaymentMethod":switch(e.redemptionSource){case"CUSTOM":case"SHOP_CASH":return{method:{type:"redeemable",redemptionSource:e.redemptionSource,redemptionContent:e.redemptionContent}};default:return{method:{type:"redeemable",redemptionSource:e.redemptionSource}}}case"CustomOnsitePaymentMethod":return{method:{type:"customOnsite",paymentMethodIdentifier:e.paymentMethodIdentifier??void 0,name:e.name}};case"BankPaymentInstrument":return{method:{type:"bank",paymentMethodIdentifier:e.paymentMethodIdentifier,lastDigits:e.lastDigits??"",bankName:e.bankName??""}};case"ShopWalletPaymentInstrument":return{method:{type:"shopWallet"}};default:return{method:{type:"other"}}}}function U(e){switch(e.__typename){case"ShopifyInstallmentsWalletContent":return{autoPayEnabled:e.autoPayEnabled,billingAddress:m(e.billingAddress),disclosureDetails:e.disclosureDetails,installmentsToken:e.installmentsToken,creditCardBrand:e.creditCard?.brand??void 0,creditCardLastFourDigits:e.creditCard?.lastDigits??void 0};case"ShopPayWalletContent":return{billingAddress:m(e.billingAddress),paymentMethod:e.paymentMethod,paymentAttributes:e.paymentAttributes,paymentMethodIdentifier:e.paymentMethodIdentifier}}}function F(e){switch(e){case"READY":return"ready";case"NOT_READY":return"notReady";case"EXPIRED":return"expired";case"DISABLED_FEATURE":return"disabled"}}function V(e){switch(e.discount.__typename){case"CustomDiscount":return{title:e.discount.title,de
1scription:e.discount.description??void 0,amount:r(e.lineAmount),allocations:q([...e.deliveryAllocations,...e.merchandiseAllocations]),discount:c(e.discount)};case"CodeDiscount":case"AutomaticDiscount":return{title:e.discount.title,amount:r(e.lineAmount),allocations:q([...e.deliveryAllocations,...e.merchandiseAllocations]),discount:c(e.discount)};case"DiscountCodeTrigger":return{title:e.discount.code,discount:c(e.discount)};default:return}}function q(e){return e.map((e=>({target:{index:e.index,amount:r(e.amount),stableId:e.stableId,type:e.targetType}})))}function N(e){return G(e)??e.marketingConsent.some((e=>"PurchaseOrderSMSContactMethod"===e.__typename))}function H(e){const t=e.marketingConsent.find((e=>"PurchaseOrderSMSContactMethod"===e.__typename));return t?.phoneNumber??""}function G(e){return"DecodedCustomerProfile"===e.customer?.__typename||"BusinessCustomerProfile"===e.customer?.__typename?e.customer.acceptsEmailMarketing:void 0}function W(e){const t=function(e){const t=e.map((e=>e.paymentMethod)).find((e=>"LocalPaymentMethod"===e.__typename));if(t)return{type:"local",name:t.name,displayName:t.displayName??"",paymentMethodIdentifier:t.paymentMethodIdentifier??"",orderingIndex:Number.MAX_SAFE_INTEGER}}(e);return t?[t]:[]}function Y(e){return"number"==typeof e?e:"PurchaseOrderMerchandiseQuantityByItem"===e.__typename?e.items:0}function j(t){if(t)return t.map((t=>{switch(t.__typename){case"SubmittedRemoteCheckout":return{status:"submitted",shopId:t.shopId,checkoutSessionToken:t.checkoutSessionToken,orderIdentity:{id:t.processedRemoteReceipt.orderIdentity.id,buyerIdentifier:t.processedRemoteReceipt.orderIdentity.buyerIdentifier},orderStatusPageUrl:t.processedRemoteReceipt.orderStatusPageUrl,remotePurchaseOrder:{paymentLines:E(t.processedRemoteReceipt.remotePurchaseOrder.payment.paymentLines.filter((e=>"DirectPaymentMethod"===e.paymentMethod.__typename))),deliveryLines:(i=t.processedRemoteReceipt.remotePurchaseOrder.delivery.deliveryLines,i.filter((({deliveryStrategy:e})=>"NONE"!==e.methodType)).map((({deliveryStrategy:{handle:e,title:t},lineAmount:a})=>({handle:e,title:t,lineAmount:r(a)})))),merchandiseLines:Q(t.processedRemoteReceipt.remotePurchaseOrder.merchandise.merchandiseLines),checkoutTotal:r(t.processedRemoteReceipt.remotePurchaseOrder.checkoutTotal),subtotalBeforeTaxesAndShipping:r(t.processedRemoteReceipt.remotePurchaseOrder.subtotalBeforeTaxesAndShipping),tax:t.processedRemoteReceipt.remotePurchaseOrder.tax.totalTaxAmountV2?B(t.processedRemoteReceipt.remotePurchaseOrder.tax.totalTaxAmountV2):void 0}};case"FailedRemoteCheckout":return{status:"failed",shopId:t.shopId,checkoutSessionToken:t.checkoutSessionToken,recoveryUrl:t.recoveryUrl,merchandiseLines:t.failedRemoteReceipt?Q(t.failedRemoteReceipt.remotePurchaseOrder.merchandise.merchandiseLines):(n=t.negotiatedProposal.merchandise,"FilledMerchandiseTerms"!==n.__typename?[]:n.merchandiseLines.map((e=>{if("ProductVariantMerchandise"!==e.merchandise.__typename&&"ContextualizedProductVariantMerchandise"!==e.merchandise.__typename)return;const t="ProposalMerchandiseQuantityByItem"===e.quantity?.__typename&&"IntValueConstraint"===e.quantity.items?.__typename?e.quantity.items.value:0;return{stableId:e.stableId,quantity:t,title:e.merchandise.subtitle??null,productTitle:e.merchandise.title,image:e.merchandise.image?{url:e.merchandise.image.url,...e.merchandise.image.altText&&{altText:e.merchandise.image.altText}}:null,price:r(e.totalAmount)}})).filter((e=>Boolean(e)))),checkoutTotal:t.failedRemoteReceipt?r(t.failedRemoteReceipt.remotePurchaseOrder.checkoutTotal):(a=t.negotiatedProposal,"MoneyValueConstraint"===a.checkoutTotal?.__typename?r(a.checkoutTotal):r(a.runningTotal)),subtotalBeforeTaxesAndShipping:t.failedRemoteReceipt?r(t.failedRemoteReceipt.remotePurchaseOrder.subtotalBeforeTaxesAndShipping):r(t.negotiatedProposal.subtotalBeforeTaxesAndShipping),tax:t.failedRemoteReceipt?.remotePurchaseOrder.tax.totalTaxAmountV2?B(t.failedRemoteReceipt?.remotePurchaseOrder.tax.totalTaxAmountV2):K(t.negotiatedProposal)};default:return e(t)}var a,n,i}))}function Q(e){return e.map((({quantity:{items:e},merchandise:t,stableId:a})=>({stableId:a,quantity:e,title:t.title??null,productTitle:t.productTitle,image:t.image?{url:t.image.url,altText:t.image.altText??void 0}:null,price:r(t.price)})))}function K(e){const t=v(e.tax);if("available_total"===t.status)return t.totalTax}function X(e){if(!e)return;const t=new Map,a=[];for(const n of e)"SubmittedRemoteCheckout"===n.__typename&&n.processedRemoteReceipt.remotePurchaseOrder.merchandise.merchandiseLines.forEac
1h((e=>{const i=r(e.merchandise.price);t.set(e.stableId,n.shopId),a.push({...e,lineAmount:{__typename:"Money",amount:s(i.amount*e.quantity.items).toString(),currencyCode:i.currencyCode},legacyFee:!1,lineAllocations:[],lineComponents:[]})}));return{stableIdToShopId:t,mergedBuyerProposalMerchandise:{__typename:"PurchaseOrderMerchandiseTerms",merchandiseLines:a}}}export{k as receiptForUI};
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.