import{bB as T,b as g,bC as A,bD as v,z as P,ap as R,as as h,B as p,P as L,a4 as w,T as b,a3 as D,a7 as F,$ as N,bE as I,bF as E,bG as H,bH as O,bI as B,bJ as z,bK as G,bL as q,bM as $,ab as _,bN as J,ad as M,f as k,bl as K,bO as V,bP as W,bQ as Q,bR as U,bS as Y,aG as j,L as X,a0 as Z}from"./app.BXvw8ij6.js";import{A as x,u as e,h as ee,T as ne,b as ae}from"./vendor.CynPCimz.js";function se(){const{value:a}=T();return!!a}function ie({children:a}){const{telemetryClient:l}=g(),u=A(),r=v(),i=x(),o=x(),s=P().isBlocked;R(t=>{i.current=void 0,o.current=void 0,"violations"in t&&(i.current=t.violations.map(d=>d.code)),"reasons"in t&&(o.current=t.reasons)});function m(t){t.detail>2&&(l.counter({name:"pay_now_rage_click",value:1}),l.log("rage_click_capture_pay_now_rage_click_detected","pay_now_rage_click",{customerProfile:r?.__typename,numberOfErrors:u?.numberOfErrors()??"unknown",lastInterceptionReasons:o.current,lastViolations:i.current,blocked:s}))}return e("div",{onClickCapture:m,children:a})}function te({shopId:a,shopName:l,shopLogo:u,amount:r,showDivider:i,isLocalShop:o}){const[s,m]=ee(!1),{i18n:t}=g();return e(k,{gap:"base",children:[e(h,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",children:[e(p,{children:e(L,{size:"small",src:u,alt:l})}),e(p,{blockAlignment:"center",children:[e(w,{"aria-expanded":s,"aria-controls":`separate-payments-collapsible-${a}`,onClick:()=>m(d=>!d),children:e(h,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",children:[e(b,{type:"strong",children:l}),e(h,{gridAutoFlow:"column",gridAutoColumns:"minmax(auto, max-content)",gridTemplateColumns:"minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-200",alignItems:"center",alignContent:"center",children:[!s&&e(b,{type:"strong",children:t.formatCurrency(r.amount,{currency:r.currencyCode,form:"short"})}),e(D,{type:s?"chevron-up":"chevron-down",size:"small-200"})]})]})}),e(F,{open:s,id:`separate-payments-collapsible-${a}`,children:[e(N,{spacing:"tight"}),e(I,{title:t.translate("order_summary.cost_table_title"),children:[e(E,{shopId:a}),o&&e(H,{disableTooltip:!0}),e(O,{shopId:a}),e(B,{shopId:a}),o&&e(z,{}),o&&e(G,{disableTooltip:!0}),e(q,{children:[e($,{children:e(_,{level:1,children:t.translate("order_summary.total_label")})}),e(J,{children:e(_,{level:1,children:t.formatCurrency(r.amount,{currency:r.currencyCode,form:"short"})})})]})]})]})]})]}),i&&e(M,{direction:"inline",borderWidth:"base"})]})}function le(){const{i18n:a}=g(),l=K("remoteMerchandiseDetails").value,u=V(),r=W(),{shop:{name:i,id:o,brandSettings:s,remoteShopsConfigMap:m}}=g(),t=Q(),d=U(Y),y=ne(()=>{const n=[];for(const[c,f]of r){if(!f)continue;if(t&&c===o){n.push({shopName:i,shopLogo:s?.squareLogo?.url,shopId:o,amount:f});continue}const C=m?.get(c);C&&n.push({shopName:C.name,shopId:c,shopLogo:C.brandSettings?.squareLogo?.url,amount:f})}return n},[r,o,i,s?.squareLogo?.url,m,t]);if(l||!u)return null;const S=e(X,{textDecoration:"none",overlay:e(j,{heading:a.translate("payment.payments"),children:e(k,{gap:"base",children:y.map((n,c)=>d?e(te,{shopId:n.shopId,shopName:n.shopName,shopLogo:n.shopLogo,amount:n.amount,showDivider:c!==y.length-1,isLocalShop:n.shopId===o},n.shopId):e(ae,{children:[e(h,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",children:[e(p,{children:e(L,{size:"small",src:n.shopLogo,alt:n.shopName})}),e(p,{blockAlignment:"center",children:e(b,{children:n.shopName})}),e(p,{blockAlignment:"center",children:e(b,{type:"strong",children:a.formatCurrency(n.amount.amount,{currency:n.amount.currencyCode,form:"short"})})})]}),c!==y.length-1&&e(M,{direction:"inline",borderWidth:"base"})]},n.shopName||c))})}),children:a.translate("payment.separate_payments_text")});return e(Z,{color:"subdued",children:a.translate("payment.separate_payments_label",{separate_payments_link:S})})}export{ie as R,le as S,se as u};
