import{_ as $}from"./Clh4W0vm.js";import{s as w,d as B,e as P,c as S,_ as I}from"./BmsEUx_s.js";import{_ as V}from"./DI7zNOmk.js";import{_ as j}from"./BVhh3E6B.js";import{u as L}from"./MNvGvCi9.js";import{k as N,ag as T,l as z,ab as E,G as m,H as R,I as h,O as t,V as c,u as e,M as y,Q as i,a3 as b,a1 as A}from"./BO9AmBA3.js";const D={class:"flex-1 pt-6 px-4 sm:px-6"},G={class:"flex items-start justify-between"},H={id:"slide-over-title",class:"para-5 text-yt-black py-0"},M={class:"ml-3 flex h-7 items-center"},O=t("span",{class:"sr-only"},"Close panel",-1),Q=t("div",{class:"w-6 h-6 i-carbon-close"},null,-1),q=[O,Q],F={class:"mt-8"},J={class:"flow-root"},K={key:0,role:"list",class:"-my-6 px-0"},U={class:"flex py-6"},W={key:1,class:"text-2xl text-center"},X={class:"flex flex-col py-6 px-4 sm:px-6"},Y={class:"mt-6 flex gap-4 items-center justify-center"},Z={class:"mt-6 flex justify-center mx-auto text-center underline cursor-pointer"},tt=["aria-label"],et=t("span",{class:"i-carbon-arrow-right w-5 h-5 ml-1"},null,-1),it=N({__name:"CheckoutSideCart",props:{controller:{}},setup(C){const l=C,{controller:a}=T(l),{cartItems:d,totalPrice:ot,isEmpty:n}=w(),v=B(),{formatLink:f}=P(v),{currentProduct:p}=L(),u=z(()=>{var o;return(o=E([...d==null?void 0:d.value]))==null?void 0:o.find(s=>{var r;return(s==null?void 0:s.id)===((r=p==null?void 0:p.value)==null?void 0:r.id)})});return S(),(o,s)=>{const r=$,k=I,x=V,g=j;return m(),R(g,{controller:e(a),side:"right"},{default:h(()=>[t("div",D,[t("div",G,[t("h2",H,c(o.$t("cart.messages.addedToCart")),1),t("div",M,[t("button",{type:"button",class:"-m-2 p-2 bg-transparent text-yt-black hover:text-yt-gray-500","data-testid":"cart-close-button",onClick:s[0]||(s[0]=(..._)=>e(a).close&&e(a).close(..._))},q)])]),t("div",F,[t("div",J,[!e(n)&&e(u)?(m(),y("div",K,[t("div",U,[i(r,{"cart-item":e(u)},null,8,["cart-item"])])])):(m(),y("div",W,c(o.$t("checkout.empty")),1))])])]),t("div",X,[t("div",Y,[i(k,{theme:"transparent","full-width":!0,"data-testid":"cart-checkout-shopping-cart",onClick:e(a).close,class:"text-center",to:e(f)("/checkout/cart"),"aria-label":o.$t("cart.viewCart")},{default:h(()=>[b(c(o.$t("cart.viewCart")),1)]),_:1},8,["onClick","to","aria-label"]),i(k,{theme:"black","full-width":!0,"data-testid":"cart-checkout-link",onClick:e(a).close,class:A([{"bg-yt-gray-500":e(n),"hover:bg-yt-gray-300":e(n)},"text-center"]),to:e(f)(e(n)?"":"/checkout"),"aria-label":o.$t("cart.checkout")},{default:h(()=>[b(c(o.$t("cart.checkout")),1)]),_:1},8,["onClick","class","to","aria-label"])]),t("div",Z,[t("p",{type:"button",class:"para-4","data-testid":"cart-continue-button",onClick:s[1]||(s[1]=(..._)=>l.controller.close&&l.controller.close(..._)),"aria-label":o.$t("checkout.continueShopping")},c(o.$t("checkout.continueShopping")),9,tt),et])]),i(x,{"cart-item":e(u),controller:l.controller},null,8,["cart-item","controller"])]),_:1},8,["controller"])}}});export{it as _};