1import{u as e,T as _,q as R,h as E,i as U}from"./esnext-vendor.DDpcaSqU.js";import{C as A,a as M}from"./Choice.D9vYH2mX.js";import{k as C,l as g,aI as V,aJ as W,aK as q,aL as w,n as z,P as H,a0 as J}from"./hydrate.BcfGVx0L.js";import{B as T}from"./BillingAddressForm.B1Xpg2b3.js";import{T as N,a5 as K,b9 as $,W as j,ba as G,bb as F,bc as Q}from"./utilities-previous.Cnwy8G2v.js";import{A as X}from"./utilities-stable-ref.dCtJn23l.js";function Y(){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(X,{...m,address:r})})]})})}const Z="billing_address_selector";function ae({renderFormOnly:a=!1}={}){const{i18n:i,source:t,checkout:r}=N(),n=K(),m=n.deliveryNext.value,u=$(m),P=V(),{billingAddress:s,shippingAddress:h,billingAddressOption:d}=j(),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,L=c&&!G(c)&&c.billingAddresses.length===0&&c.shippingAddresses.length===0,x=(!c||L)&&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]),I=R(([l])=>{l&&(d.value=l,F(t)?l==="custom"?s.value=y:l==="shipping"?s.value=p.value:l==="billing-fact"&&o&&(s.value=o):l==="custom"&&f?s.value=Q({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(),E(()=>{F(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,D=_(()=>[k],[k]);return e(J,{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}),x?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(T,{}),children:e(M,{name:Z,values:D,onChange:I,variant:"block",children:[f?e(Y,{}):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(T,{}),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.