1import{u as e,T as _,q as E,h as R,i as U}from"./esnext-vendor.BBoIVOQW.js";import{C as A,a as M}from"./Choice.18syyoW7.js";import{k as C,l as g,aC as V,aD as W,aE as q,aF as w,n as z,P as H,Y}from"./hydrate.Tsur0pib.js";import{B as F}from"./BillingAddressForm.BMqAGUql.js";import{T as N,a5 as $,b6 as j,W as G,b7 as J,b8 as T,b9 as K}from"./addresses-is-address-empty.ZJ1ThpFy.js";import{A as Q}from"./AddressPresenter.Ce4uWLSc.js";function X(){const{i18n:a,checkout:i}=N(),t=i.addressManager.billing.value.suggestedAddress.value,r=t.address,n=t.type,m={hiddenFields:["phone","company","firstName","lastName"],multiline:!1},u=(()=>{if(n==="billing-fact")return a.translate("payment.use_order_billing_address_label");if(n==="billing")return a.translate("payment.use_location_billing_address_label");if(n==="shipping")return a.translate("payment.use_location_shipping_address_label")})();return!r||!n||!u?null:e(A,{value:n,children:e(C,{children:[e(g,{type:"strong",children:u}),e(g,{color:"subdued",children:e(Q,{...m,address:r})})]})})}const Z="billing_address_selector";function ae({renderFormOnly:a=!1}={}){const{i18n:i,source:t,checkout:r}=N(),n=$(),m=n.deliveryNext.value,u=j(m),P=V(),{billingAddress:s,shippingAddress:h,billingAddressOption:d}=G(),O=h.value,o=r.proposal.facts.billingAddress,b=r.configuration.layout.isOnePage.value,p=W(),S=q(),f=n.buyerIdentity.value?.purchasingCompany,c=n.buyerIdentity.value?.customerProfile,x=c&&!J(c)&&c.billingAddresses.length===0&&c.shippingAddresses.length===0,L=(!c||x)&&O.oneTimeUse,y=_(()=>({firstName:void 0,lastName:void 0,address1:void 0,address2:void 0,company:void 0,city:void 0,postalCode:void 0,phone:void 0,zoneCode:void 0,name:void 0,countryCode:s.fields.countryCode.peek()}),[s.fields.countryCode]),v=_(()=>h.fields.countryCode.peek(),[h.fields.countryCode]),D=E(([l])=>{l&&(d.value=l,T(t)?l==="custom"?s.value=y:l==="shipping"?s.value=p.value:l==="billing-fact"&&o&&(s.value=o):l==="custom"&&f?s.value=K({countryCode:v}):l==="custom"?s.fields.countryCode.value=v:l==="shipping"&&(s.value=p.value,S()))},[d,t,f,o,s,y,p,v,S]),B=i.translate("payment.billing_address_title");w(),R(()=>{T(t)&&P.value==="form"?s.value=y:d.value==="shipping"?s.value=p.value:d.value==="billing-fact"&&o&&(s.value=o)},[]);const k=d.value,I=_(()=>[k],[k]);return e(Y,{accessibilityRole:"group",accessibilityLabelledBy:b?void 0:"billingAddress",accessibilityLabel:b?B:void 0,children:e(C,{gap:"base",children:[b?null:e(C,{gap:"small-400",children:[e(z,{id:"billingAddress",children:B}),L?null:e(H,{color:"subdued",children:u?i.translate("payment.billing_address_description_no_shipping_address"):i.translate("payment.billing_address_description")})]}),e(U,{when:()=>!a&&P.value!=="form",fallback:e(F,{}),children:e(M,{name:Z,values:I,onChange:D,variant:"block",children:[f?e(X,{}):e(A,{value:"shipping",accessibilityLabel:i.translate("payment.same_billing_address_label"),children:e(g,{type:"strong",children:i.translate("payment.same_billing_address_label")})}),e(A,{value:"custom",selectedContent:e(F,{}),accessibilityLabel:i.translate("payment.different_billing_address_label"),children:e(g,{type:"strong",children:i.translate("payment.different_billing_address_label")})})]})})]})})}export{ae as B};
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.