1import{l as e,e as n,f as t,u as a,S as i,i as s,k as l,h as r,q as o,T as c,A as d,o as u,G as m,g as p,D as v}from"./2c1ab0fe.D_oO1jU7.js";import{dh as b,di as h,c$ as y,dj as f,dk as _,c as g,H as S,P as I,aC as P,aE as w,aF as L,n as C,dl as A,U as M,I as j,B as N,bm as O,h as T,bB as k,b as E}from"./164ad2e3.DgUUtBtV.js";import{j as F,h as x,i as H,k as R}from"./86720dbb.lSLFpGJE.js";import{O as B,P as Y,Q as q,cT as V,V as z,cU as D,cV as W,aT as U,cW as $,ar as G,cX as J}from"./4c290a1e.D9lE9kmU.js";import{j as Q,D as X}from"./f3fe2775.91jcUSQ2.js";import{b as Z}from"./58314944.QVtJf4c2.js";import{a as K,C as ee}from"./31cc568e.CsDC1k63.js";import{B as ne}from"./b9c0319a.Bj2lNtZE.js";import{a as te,b as ae,C as ie}from"./efa0389a.-R9eik6_.js";import{c as se,d as le}from"./dffdfb34.BmCoupl3.js";import{S as re}from"./0e67bd3b.DkCvQkdq.js";import{u as oe}from"./cc6ff67d.SUHuL0DO.js";import{C as ce}from"./a422df8c.CGT3eUwi.js";import{d as de,e as ue}from"./f8706cb6.DMygWC1h.js";import{g as me}from"./65f3d4da.8ZfwXSRH.js";import{g as pe}from"./f1968089.4OkuMKtQ.js";import{I as ve}from"./3a819064.CWC3Yoc0.js";function be({selectorShowsTiles:l,afterPaymentSelector:r,renderVaultingAgreementInline:o}){const c=Z(),d=b(),{checkout:u,i18n:m,shopPay:p,source:v}=B(),P=h(),w=y(),L=f(),{paymentMethods:C}=Y(),A=p.user.creditCards,M=e(K().creditCardDisabled),j=n(null),N=t((()=>!(P.value||_({checkout:u,source:v})?.pickupAddress)&&!w.value&&u.isShippingRequired.value)),O=t((()=>function({identity:e},{billingPosition:n,vaultedSections:t,showBillingAddressInContext:a}){switch(e.current.value){case"shopPay":return"inContext"===n.value&&!t.value.payment;case"businessCustomer":return!0;default:return a.value}}({identity:u.identity},{billingPosition:d,vaultedSections:L,showBillingAddressInContext:N}))),T=t((()=>Q({paymentMethods:C.value}))),k=t((()=>function({identity:e,i18n:n},{paymentMethodMustSupportInterestBearingLoans:t,supportedCountryOptions:a,creditCards:i,creditCardDisabled:s}){if("shopPay"!==e.current.value)return null;if(!t)return null;if(!i.every((e=>s(e))))return null;const l=a.map((e=>e.label)).join(", ");return l?n.translate("installments.installments_debit_cards_supported_countries",{countries:l}):n.translate("installments.installments_valid_debit_cards_fallback")}({identity:u.identity,i18n:m},{paymentMethodMustSupportInterestBearingLoans:u.installments.paymentMethodMustSupportInterestBearingLoans.value,supportedCountryOptions:u.installments.supportedCountryOptions.value,creditCards:A.value,creditCardDisabled:M.value}))),E=a(X,{blurValidationFieldDenylist:T.value,onSetFieldErrors:c,children:[a(F,{vaultHandle:j}),a(g,{gap:"base",children:[a(he,{}),a(x,{billingAddressInContext:O.value,vaultHandle:j,selectorShowsTiles:l,afterPaymentSelector:r,renderVaultingAgreementInline:o})]})]});return a(s,{when:k,fallback:E,children:e=>a(i,{children:[a(g,{gap:"small-400",children:[a(S,{level:2,children:m.translate("credit_card_form.add_debit_card")}),a(I,{color:"subdued",children:e})]}),E]})})}function he(){return H(),null}const ye="shipping_address",fe="custom_billing_address";function _e({renderFormOnly:e=!1}={}){const{i18n:n}=B(),t=P(),{billingAddressOption:i}=q(),c=w(),d="shipping"===i.value?ye:fe,[u,m]=l([d]),{isBilling:p}=se().value,v=p?a(le,{}):null;r((()=>{m([d])}),[d]);const b=o((e=>{const n=e[0]===ye?"shipping":"custom";i.value=n,m(e),"shipping"===n&&c()}),[i,c]);L();const h=o((({billing:e})=>{e.value=!0}),[]),y=o((({billing:e})=>{e.value=!1}),[]);return a(s,{when:()=>!e&&"form"!==t.value,fallback:a(re,{onValid:h,onInvalid:y,children:a(R,{children:v})}),children:a(te,{name:"billing_address_selector",values:u,onChange:b,variant:"block",children:[a(ae,{value:ye,accessibilityLabel:n.translate("payment.same_billing_address_label"),children:a(C,{type:"strong",children:n.translate("payment.same_billing_address_label")})}),a(ae,{value:fe,selectedContent:a(re,{onValid:h,onInvalid:y,children:a(R,{children:v})}),accessibilityLabel:n.translate("payment.different_billing_address_label"),children:a(C,{type:"strong",children:n.translate("payment.different_billing_address_label")})})]})})}const ge=()=>{const{i18n:e,checkout:{identity:n}}=B(),t=Ie({identity:n});return a(g,{accessibilityRole:"group",accessibilityLabelledBy:"billingAddress",gap:"base",children:[a(S,{id:"billingAddress",level:2,children:e.translate("payment.billing_address_title")}),a(t,{})]})};function Se({dynamicPaymentExtensions:e=[],children:n}){A();const t=b(),s=y(),{checkout:l}=B(),r=f(),o=V({checkout:l}),d=r.value.payment&&r.value.billing&&!o,[u]=oe(),m=c((()=>Object.values(z).some((e=>u===e))),[u]),p=!d&&!s.value&&!m;return a(g,{gap:"base",children:["beforePayment"===t.value&&p&&a(ge,{}),n,"afterPayment"===t.value&&!m&&a(i,{children:[p&&a(ge,{}),a(M,{customizations:e})]})]})}function Ie({identity:e}){return"businessCustomer"===e.current.value?ne:_e}function Pe({onComplete:e}){const n=d(null),t=d(),[i,s]=l(!1),{environment:{services:{shopServer:c}},observability:u}=B(),m=d(performance.now()),p=o((n=>
1{e(n),s(!0),t.current=n}),[e]),v=o((({data:e,origin:t,source:a})=>{if("null"===t&&a===n.current?.contentWindow&&"string"==typeof e.payload&&""!==e.payload)switch(e.action){case"iovation_sandbox_error":u.leaveErrorBreadcrumb("[Iovation] Fingerprint error",{error:e.payload}),p("");break;case"iovation_sandbox_fingerprint":u.histogram({name:"iovation_fingerprint_load_time",value:performance.now()-m.current}),p(e.payload)}}),[p,u]),b=o((()=>{n.current?.contentWindow&&n.current.contentWindow.postMessage({action:"iovation_sandbox_initialize"},"*")}),[]);return r((()=>(window.addEventListener("message",v),()=>{window.removeEventListener("message",v)})),[v]),r((()=>{const e=setTimeout((()=>{void 0===t.current&&(u.histogram({name:"iovation_fingerprint_load_time",value:performance.now()-m.current}),p(""))}),1e4);return()=>clearTimeout(e)}),[p,u]),i?null:a(ve,{ref:n,id:"iovation_sandbox_iframe",sandbox:"allow-scripts",src:new URL("/pay/iovation",c.url).href,style:{display:"none"},onLoad:b})}const we="n7rut",Le="_4PVkL";function Ce(){const{prequalifiedAnimatedBadgeShowCounter:e}=U(),[n,t]=l(!1),{i18n:i}=B(),s=i.translate("installments.installments_prequalified_status_badge"),c=function(e){const n=d(null),t=d(!1);return r((()=>{if(t.current)return;if(!window.IntersectionObserver)return t.current=!0,void e();const a=new IntersectionObserver((n=>{const s=n.some((({isIntersecting:e})=>e));i&&s&&(t.current=!0,a.unobserve(i),e())}),{threshold:1}),i=n.current;return i&&a.observe(i),()=>{i&&a.unobserve(i)}}),[e]),n}(o((()=>{t(!0),e.value+=1}),[e]));return a("div",{className:p("Pdl91",{[we]:n},{[Le]:e.value>1}),ref:c,children:a("span",{className:"a3kZU",children:[a("span",{className:"F1g68",children:a(j,{type:"check-circle",size:"fill"})}),a("span",{className:"Wkh24",children:s})]})})}const Ae=v((function({title:e,subtitle:n,disabled:t,badge:i},s){const l=a(I,{color:t?"subdued":void 0,children:a(C,{type:"strong",children:e})}),r=a(I,{children:n});return i?a(g,{ref:s,gap:"small-100",children:[a(g,{direction:"inline",gap:"base",children:[l,a(Ce,{})]}),r]}):a(N,{ref:s,children:[l,r]})}));function Me({ineligibilityReason:s}){const{observability:p,userEvents:v,i18n:b,source:h,checkout:y,shop:f,shopPay:_}=B(),[g,S]=l(!1),I=O(),{recordRetailEvent:P}=de(),{negotiate:w}=T(),{paymentMethods:L}=Y(),C=me(_),A=function(){const{checkout:{identity:e},shopPay:n}=B(),a=W(),i=Y().paymentMethods;return t((()=>{const t=a.value,s=n.user.installments.prequalifiedAmount.value,l=n.user.installments.credential.value,r=i.value?.find((e=>"wallet"===e.type&&"SHOPIFY_INSTALLMENTS"===e.name)),o="shopPay"===e.current.value&&null!=t&&null!=r&&t.amount>=Math.max(r.minPrice.amount,50)&&t.currencyCode===r.minPrice.currencyCode,c=null!=s&&null!=t&&(!r?.cbtEnabled||s.currencyCode===t.currencyCode)&&(l?.requiresAdditionalInformation&&t.amount<=s.amount||!l?.requiresAdditionalInformation);return o&&c}))}(),M=ue(),{payNowLabel:j,payNowSubtitle:F,installmentsLabel:x,installmentsSubtitle:H}=M.value,R=_.user.installments.prequalifiedAmount.value,q=_.installments.isServiceAvailable.value,V=_.session.paymentMethodOption.value,z=c((()=>V?[V.name]:[]),[V]),U=_.user.installments.isRetryable.value,Q=y.installments.isUnavailable.value,X=c((()=>!q||Q&&!U),[q,Q,U]),Z=function({selectable:t}){const{userEvents:a,source:i,checkout:s,shop:l,shopPay:r,embed:c}=B(),{ineligibilityReasons:p}=s.installments,{isServiceAvailable:v}=r.installments,{isRejected:b}=r.user.installments,{isLoading:h}=r.session,y=n(null),f=d(!1),_=e(t);function g(){const e=_.value,n=e?void 0:JSON.stringify(function({ineligibilityReasons:e,serviceAvailable:n,userRejected:t}){return e.length>0?e:n?t?["user_rejected"]:["unknown"]:["installments_unavailable"]}({ineligibilityReasons:p.value,serviceAvailable:v.value,userRejected:b.value}));a.monorailEvent({schemaId:"shopify_pay_payment_page_installments/1.4",payload:{...pe(i,s,l,{embedPlatform:c?.platform,shopAppSurface:r.app.config.surface}),eventType:D.OptionImpression,success:e,errorMessage:n}})}return u((()=>{const e=y.value;if(!e||h.value||f.current)return;const n=()=>{f.current=!0,m(g)};if(!window.IntersectionObserver)return void n();const t=new IntersectionObserver((e=>{e.some((({isIntersecting:e})=>e))&&(t.disconnect(),n())}),{threshold:1});return t.observe(e),()=>t.disconnect()})),o((e=>{y.value=e}),[y])}({selectable:!X}),K=c((()=>
1{if(A.value&&R&&!X)return"prequalified"}),[A.value,X,R]),ne=o((async()=>{g||(S(!0),await w({force:!1,fieldsToResolve:["taxes","paymentMethods"],include:["paymentLines"],customizeNegotiation:e=>(e.payment?.paymentLines.push({amount:{any:!0},paymentMethod:{walletPaymentMethodConfig:{name:"SHOPIFY_INSTALLMENTS"}}}),e)}))}),[w,g]);r((()=>{"SHOPIFY_INSTALLMENTS"===C&&ne()}),[ne,C]);const te=o((([e="SHOPIFY_INSTALLMENTS"])=>{const n=$(L.value)?.availableLoanTypes,{action:t,method:a}=function({paymentMethodName:e,availableLoanTypes:n}){if("SHOP_PAY"===e)return{action:"payment_method_pay_now",method:{type:"wallet",name:"SHOP_PAY"}};const t={type:"wallet",name:"SHOPIFY_INSTALLMENTS"};return J(n)?{action:"payment_method_interest_bearing_installments",method:t}:{action:"payment_method_installments",method:t}}({paymentMethodName:e,availableLoanTypes:n});_.session.unstable_updatePaymentMethodOption(a),I.value&&P(t),"SHOPIFY_INSTALLMENTS"===e&&p.log("payment_method_selected","[Installments] Payment method selected",{paymentMethodName:e}),v.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...G(h,y,f),action:t}})}),[L,_.session,I,p,v,h,y,f,P]);return a(i,{children:[X&&a(N,{children:[a(k,{heading:b.translate("payment_ux.payment.payment_option.installments_unavailable"),tone:"info",children:s||b.translate("payment.payment_option.installments_temporarily_unavailable")}),a(E,{blockSize:"base"})]}),a(ee.Provider,{value:!0,children:a(ie,{presentation:"base",children:a(ce,{name:"payment_method_options",title:b.translate("payment.payment_option.accessibility_label"),titleHidden:!0,onChange:te,values:z,children:[a(ae,{value:"SHOP_PAY",children:a(Ae,{title:j,subtitle:F})}),a(ae,{value:"SHOPIFY_INSTALLMENTS",disabled:X,children:[!X&&a(Pe,{onComplete:_.setDeviceFingerprint}),a(Ae,{ref:Z,title:x,subtitle:H,disabled:X,badge:K})]})]})})})]})}export{be as P,Se as W,Me as a,Ie as g};
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.