import{x as W,a as F,u as n,k as _,T as q,c as b,j as $,f as z,q as H,y as J}from"./dist-vendor.a3kfnPsb.js";import{bW as X,bX as j,h as m,bY as K,bZ as Z,b_ as Q,b$ as ee,c0 as ne,c1 as k,c2 as te,br as ie,au as x,c3 as se,c4 as oe,R as ae,z as re,Z as ce,k as O,c5 as L,c6 as le,c7 as de,A as ue,bp as pe,c8 as ye,E as v,c9 as he,ca as me,cb as C,T as fe}from"./shop-pay-ButtonWithRegisterWebPixel.DNiJgoKP.js";import{a as R,k as Se,ah as B,f as ge,b as A,aB as Ee,aC as _e,W as Ae,a8 as D,j as N,aD as Re,aE as Pe,aF as Ce,aG as Te,aH as Ne,aI as Ie,aJ as Oe,aK as ve,aL as be,av as ke,aM as xe,J as P,aN as Le,aO as Be,aP as De,L as Ve,aQ as Me,aR as we}from"./shop-pay-FullScreenBackground.wUQlmEwa.js";import{R as Ge,S as Ue}from"./captcha-SeparatePaymentsNotice.CgJC5Oqb.js";import{S as Ye}from"./hooks-ShopPayOptInDisclaimer.DXstBANx.js";function We(){const{shopPay:{visibility:{shouldRenderFloatingShopPayButton:e}},embed:t}=R(),i=Se(),{payButton:s}=B(),u=ge(),{buyerIdentity:p,managedByMarketsPro:a}=A(),f=Ee(),d=X().some(I=>"registrationId"in I&&j.has(I.registrationId)),o=m("Checkout::Actions::RenderBefore"),y=m("Checkout::CartLineDetails::RenderAfter"),c=m("Checkout::CartLines::RenderAfter"),l=m("Checkout::Reductions::RenderBefore"),S=m("Checkout::Reductions::RenderAfter"),h=m("Checkout::Dynamic::Render","ORDER_SUMMARY1"),E=m("Checkout::Dynamic::Render","ORDER_SUMMARY2"),V=m("Checkout::Dynamic::Render","ORDER_SUMMARY3"),M=m("Checkout::Dynamic::Render","ORDER_SUMMARY4"),w=m("Checkout::Dynamic::Render","PAYMENT4"),G=m("purchase.checkout.footer.render-after"),U=K([...o,...y,...c,...l,...S,...h,...E,...V,...M,...w,...G]),Y=p.value?.countryCode;return!(u.value||d||a.value&&!f||_e(Y))&&!U&&!t&&!e&&i&&s?.position==="sticky"}const Fe="GsMGr",qe="eDhAI",$e="P0xJW",ze="COpTB",g={Wrapper:Fe,Container:qe,Section:$e,"Container-fixed":"iRlFp","Container-fixed-entering":"_24aJk","Container-fixed-exiting":"ktbnR","Container-fixed-enter":"PCKgT","Container-fixed-exited":"DvZWz",Shadow:ze,"Shadow-enter":"_0hDB9","Shadow-exiting":"P1NPi","Shadow-exited":"lQN1j"},He=new Set([...Pe,...Ce,...Te,...Ne,...Ie,...Oe,...ve,...be,"BUYER_IDENTITY_PRESENTMENT_CURRENCY_DOES_NOT_MATCH","WAITING_PENDING_TERMS"]);function Je(e){return e?.length?e.some(t=>!He.has(t.code)):!1}function Xe(){const e=W(Z),{billing:t,contact:i,payment:s,shipping:u}=Ae(),p=Q(),a=D(),{deliveryNext:f,allViolations:r}=A(),d=ee(),{billingAddressOption:o}=N();return F(()=>{const y=e?.value??{contact:!1,delivery:!1,payment:!1,billing:!1},c=Je(r.value),l=y.contact||i.value,S=!a.value||Re(f.value)||y.delivery||u.value,h=!p.value||y.payment||s.value,E=d==="hidden"||d==="inContext"&&y.payment||y.billing||o.value!=="custom"||t.value;return!c&&l&&S&&h&&E})}function je({children:e}){const t=We(),i=ke({base:!0,medium:!1});return!t||!i?n(_,{children:e}):n(Ke,{children:e})}function Ke({children:e}){const t=Xe().value,{entry:i,ref:s}=ne({threshold:1}),u=t&&i!=null&&!i.isIntersecting&&i.boundingClientRect.bottom>(i.rootBounds?.bottom??0),p=k(t,"base"),{registerStickyElement:a,height:f}=te("pay_button",{active:u}),{main:r}=B(),d=!!(i&&!i.isIntersecting&&p!=="exited"),o=r.section?.padding,y=r.section?.borderWidth,c=r.section?.border,l=q(()=>{if(!d)return;const S=Array.isArray(o)?o[1]:o,h=Array.isArray(o)?o[3]:o;return{padding:["none",S??"none","none",h??S??"none"],borderWidth:y,border:c}},[d,o,y,c]);return n("div",{ref:s,className:g.Wrapper,style:{...d?{"--container-block-size":`${f.value}px`}:void 0},children:n("div",{ref:a,className:b(g.Container,d&&[g["Container-fixed"],g[`Container-fixed-${p}`]]),children:[n(Ze,{visible:d}),n(ie,{style:l,children:n(x,{className:g.Section,accessibilityRole:"presentation",children:e})})]})})}function Ze({visible:e}){const t=k(e,"faster");return t==="exited"?null:n("div",{className:b(g.Shadow,g[`Shadow-${t}`]),"aria-hidden":"true"})}const Qe=e=>n(le,{children:n(x,{children:e})}),en="disable-view-transitions-for-pay-button-section",T="checkout-pay-button-section";function nn(){const e=document.createElement("style");return e.setAttribute("id",en),e.textContent=`
    #${T}, #${T} * {
      view-transition-name: none !important;
    }
  `,document.head.appendChild(e),e}function mn({buttonHidden:e=!1}){const t=m("Checkout::Actions::RenderBefore"),i=xe(),{PayButton:s}=se(),{i18n:u,offsitePopupController:p}=R();return $(()=>{if(p.isOpen.value){const a=nn();return()=>{a.remove()}}}),n(L,{target:"cart.paymentLines[0]",children:n(oe,{impressionType:"pay_now_button",impressionFeatures:[],children:[t.length!==0&&n(_,{children:[n(ae,{extensions:t,render:Qe}),n(re,{blockSize:"base"})]}),n(ce,{id:"checkout-pay-heading",tabIndex:-1,visibility:"hidden",children:u.translate("general.finalize_order_accessibility_label")}),n(O,{gap:"base",ref:i,id:T,children:[n(je,{children:n(O,{gap:"base",children:[n(sn,{}),e?n(s,{hidden:!0}):n(Ge,{children:n(s,{})})]})}),!e&&n(_,{children:[n(Ye,{}),n(Ue,{})]})]})]})})}const tn=new Map([["PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT",{status:"warning",priority:-1,negotiationStage:"completion"}],["TAX_NEW_TAX_MUST_BE_ACCEPTED",{status:"warning",priority:-2,negotiationStage:"completion"}]]);function sn(){const{allViolations:e}=A(),{paymentLines:t}=N(),i=on(t.value),s=an(e.value,tn,i);return n(L,{target:"cart.paymentLines[0]",children:s.map(u=>n(de,{notice:u,errorType:ue.PaymentError},u.code))})}function on(e){if(!e)return!1;const t=P(e,"APPLE_PAY");if(t&&!Le(t)||P(e,"GOOGLE_PAY")&&!Be({paymentLines:e}))return!0;const s=P(e,"PAYPAL_EXPRESS");return!!(s&&!De(s))}function an(e,t,i){const s=pe(),[u,p]=z([]),a=H(({violations:r,negotiationStage:d})=>{const o=[],y=r.some(c=>ye.has(c.code));for(const c of r)if(!rn(c)&&t.has(c.code)){if(y||i)continue;const l=t.get(c.code);d&&d===l?.negotiationStage&&o.push({...c,tone:l?.tone,priority:l?.priority})}if(o.length>=1){const l=o.map(h=>h.priority??0).reduce((h,E)=>h>E?h:E);return o.filter(h=>(h.priority??0)>=l)}return o},[t,i]);return J(()=>{e&&p(a({violations:e}))},[a]),Ve(r=>{r.type==="complete"||r.type==="invalid"||r.type==="failed"||!s.current||p(a({violations:r.violations,negotiationStage:r.negotiationStage}))}),u.filter(Me("localizedMessage"))}function rn(e){return e.__typename!=="ConfirmChangeViolation"&&e.__typename!=="UnprocessableTermViolation"&&e.__typename!=="RemoveTermViolation"}function fn(){const{i18n:e,cart:t}=R(),i=D(),s=N().shippingAddress.value,{value:u}=A().deliveryNext,p=t.proposal.facts.delivery??[],a=p[0],f=A().buyerIdentity.value?.purchasingCompany,r=f?.location.name,d=!!f&&!!r;if((!p.length||!a?.lines?.length)&&!i.value)return null;if(a.pickupAddress)return n(cn,{address:a.pickupAddress??void 0,locationName:a.pickupAddressName});const o=u?.status==="unavailable"?s:a.deliveryAddress,y=n(_,{children:[d?n(v,{children:r}):null,o?n(he,{address:o}):n(v,{color:"subdued",children:e.translate("review.blocks.no_address")})]}),c=a.lines.length?a.lines.filter(({deliveryChange:l,isFulfilled:S})=>l!=="REMOVED"&&!S).map(l=>n(me,{line:l},l.title)):null;return n(_,{children:[n(C,{id:"address",label:e.translate("review.blocks.shipping_address_title"),summary:y}),c?n(C,{id:"shipping",label:e.translate("review.blocks.shipping_method_title"),summary:c}):null]})}function cn({address:e,locationName:t}){const{i18n:i}=R(),s=we(e,{hiddenFields:["postalCode","countryCode","phone"]});return!t||!s?null:n(C,{id:"delivery",label:i.translate("review.blocks.pick_up_in_store_shipping_method_html",{location_name:t}),summary:n(fe,{children:s})})}export{fn as O,mn as P};
