1import{G as e}from"./2c1ab0fe.GMbxnz74.js";import{aL as s,aM as i,aN as n,aO as t,aP as a,aQ as r}from"./4c290a1e.C6TDJ9Fn.js";import{i as o}from"./bff2ff9b.Wb1R3ZbF.js";function d(e,s){return Object.keys(s).every(i=>(s[i]??"")===(e[i]??""))}function p(e,s){if(!e)return!1;const[i=0,n=0,t=0]=l(e),[a=0,r=0,o=0]=l(s);return i!==a?i>a:n!==r?n>r:t>=o}function l(e){return e.split(".").map(e=>parseInt(e,10)||0)}const u=new Set(["mobilepay","bancontact","blik","bizum","mb","multibanco","mbway","eps","swish","twint","przelewy24","alipay","wechatpay","oxxo","satispay","vipps","konbini","grabpay"]);function c(e,{identity:i,installmentsSelected:n,isApplePayAvailable:t,idealEnabled:a,isBareCardOnly:r,isShopAppLayout:d=!1,shopAppVersion:l}){return r?e.filter(e=>"direct"===e.type):"shopPay"!==i.current.value?e:n?e.filter(e=>"direct"===e.type):e.filter(e=>{if("direct"===e.type)return!0;if("customOnsite"===e.type){const s=e.paymentBrands??[];return!!(s.includes("bogus_app_coin")||s.includes("usdc")||a&&s.includes("ideal"))||!!o(e.uiExtension?.appId)&&s.some(e=>function({brand:e,isShopAppLayout:s=!1,shopAppVersion:i}){if(s&&!function(e){return p(e,"2.251.0")}(i))return!1;const n=e.toLowerCase();return u.has(n)}({brand:e,isShopAppLayout:d,shopAppVersion:l}))}return!!s(e)&&t})}function y(s,{isApplePayAvailable:i}){const{identity:n,shopPay:t,negotiatedFields:o}=s;return e(()=>{return c(o.paymentMethods.value??[],{identity:n,installmentsSelected:!1,isApplePayAvailable:(e=i,"boolean"==typeof e?e:e.value),idealEnabled:r({managedByMarketsPro:o.managedByMarketsPro.value}),isBareCardOnly:!1,isShopAppLayout:a(t.app.config),shopAppVersion:t.app.config.version});var e})}function h({checkout:e,shopPay:s,observability:a,shippingAddress:r,billingAddress:o,fallbackPhoneNumber:p,buyerAddresses:l}){if(!r&&!o)return{};const u=e.proposal.proposed,c=e.proposal.negotiated.fields,y=i({canUpdateDeliveryAddress:c.canUpdateDeliveryAddress.value,mustSelectProvidedAddress:c.mustSelectProvidedAddress.value,proposedAddress:u.shippingAddress.value,buyerAddresses:l}),h=r&&y?r:void 0,b=o;if(!h&&!b)return{};const f=e.configuration.addressSettings.nonBillingAddressSettings.value;if(h){const e=f.isRequired("phone",{countryCode:h.countryCode,useMerchantSettings:!0})&&!h.phone?p:h.phone;a.log("wallets_shipping_address_update","update with Shop Pay vaulted address",{isPostalCodePadded:n(h.postalCode,h.countryCode),countryCode:h.countryCode}),u.shippingAddress.value={...h,phone:e,oneTimeUse:h.oneTimeUse||!1}}if(b){const e=f.isRequired("phone",{countryCode:b.countryCode,useMerchantSettings:!0})&&!b.phone?p:b.phone;u.billingAddress.value={...b,phone:e}}h&&t(u.shippingAddress),b&&t(u.billingAddress);const A=d(h??u.shippingAddress.value,b??u.billingAddress.value);return s.user.hasCreditCards.value&&(u.billingAddressOption.value=A?"shipping":"custom"),{shippingAddress:h,billingAddress:b}}export{p as a,h as b,c as f,d as i,y as s};
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.