import{a as M,A as x,u as e,f as S,T as w}from"./dist-vendor.DBR6g02j.js";import{b as _,a as b,c as T,e as P,y as A,z as D,B as R}from"./shop-pay-FullScreenBackground.C1_sL6Wu.js";import{aq as I,G as f,B as C,P as N,af as F,T as L,I as B,ag as z,t as q,ar as E,as as O,at as G,au as H,av as j,aw as J,ax as V,ay as W,az as $,aA as U,U as K,k,aB as Q,aC as X,L as Y,v as Z}from"./shop-pay-ButtonWithRegisterWebPixel.Tzqfwpmo.js";import{u as ee}from"./types-useHasOrdersFromMultipleShops.BA8xjYgu.js";function re(){const a=_().captcha;return M(()=>!!a.value)}function ie({children:a}){const{observability:r,identity:i,wallets:l}=b(),p=I(),o=T(),c=_().buyerIdentity,u=x(),s=x(),d=P(),g=d.isBlocked;A(n=>{u.current=void 0,s.current=void 0,"violations"in n&&(u.current=n.violations.map(m=>m.code)),"reasons"in n&&(s.current=n.reasons)});function t(n){if(n.detail>2){const m=d.parts.paymentLines.value.map(h=>h.method.type==="wallet"||h.method.type==="walletsPlatformPaymentMethod"?h.method.name:h.method.type),y=o.value.currentDetour?.type??o.value.currentPage?.id??"unknown",v={identity:i.current,activeWallet:l.activeSession?.wallet??null,asPaymentMethod:l.activeSession?.asPaymentMethod??!1,journeyStep:y,primaryPaymentLine:m.at(0)};r.counter({name:"pay_now_rage_click",value:1,attributes:v}),r.log("rage_click_capture_pay_now_rage_click_detected","pay_now_rage_click",{customerProfile:c.value?.customerProfile?.__typename,numberOfErrors:p?.numberOfErrors()??"unknown",lastInterceptionReasons:s.current,lastViolations:u.current,blocked:g,paymentLineNames:m,...v})}}return e("div",{onClickCapture:t,children:a})}function ae({shopId:a,shopName:r,shopLogo:i,amount:l,showDivider:p,isLocalShop:o}){const[c,u]=S(!1),{i18n:s}=b();return e(k,{gap:"base",children:[e(f,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",children:[e(C,{children:e(N,{size:"small",src:i,alt:r})}),e(C,{blockAlignment:"center",children:[e(F,{"aria-expanded":c,"aria-controls":`separate-payments-collapsible-${a}`,onClick:()=>u(d=>!d),children:e(f,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",children:[e(L,{type:"strong",children:r}),e(f,{gridAutoFlow:"column",gridAutoColumns:"minmax(auto, max-content)",gridTemplateColumns:"minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-200",alignItems:"center",alignContent:"center",children:[!c&&e(L,{type:"strong",children:s.formatCurrency(l.amount,{currency:l.currencyCode,form:"short"})}),e(B,{type:c?"chevron-up":"chevron-down",size:"small-200"})]})]})}),e(z,{open:c,id:`separate-payments-collapsible-${a}`,children:[e(q,{blockSize:"small-200"}),e(E,{title:s.translate("order_summary.cost_table_title"),children:[e(O,{shopId:a}),o&&e(G,{disableTooltip:!0}),e(H,{shopId:a}),e(j,{shopId:a}),o&&e(J,{}),o&&e(V,{}),o&&e(W,{disableTooltip:!0}),e($,{shopId:a}),o&&e(U,{shopId:a})]})]})]})]}),p&&e(K,{direction:"inline",borderWidth:"base"})]})}function le(){const{i18n:a,shop:{name:r,id:i,brandSettings:l,remoteShopsConfigMap:p}}=b(),o=D("remoteMerchandiseDetails").value,c=ee().value,u=R(),s=Q(),d=w(()=>{const t=[];for(const[n,m]of u.value){if(!m)continue;if(s.value&&n===i){t.push({shopName:r,shopLogo:l?.squareLogo?.url,shopId:i,amount:m});continue}const y=p?.get(n);y&&t.push({shopName:y.name,shopId:n,shopLogo:y.brandSettings?.squareLogo?.url,amount:m})}return t},[u.value,i,r,l?.squareLogo?.url,p,s.value]);if(o||!c)return null;const g=e(Y,{textDecoration:"none",overlay:e(X,{heading:a.translate("payment.payments"),children:e(k,{gap:"base",children:d.map((t,n)=>e(ae,{shopId:t.shopId,shopName:t.shopName,shopLogo:t.shopLogo,amount:t.amount,showDivider:n!==d.length-1,isLocalShop:t.shopId===i},t.shopId))})}),children:a.translate("payment.separate_payments_text")});return e(Z,{color:"subdued",children:a.translate("payment.separate_payments_label",{separate_payments_link:g})})}export{ie as R,le as S,re as u};
