import{j as r,m as A,r as j}from"./main-5057ff34.js";import{b as S}from"./chunk-index-3462efa3.js";import{G as E,f as h}from"./chunk-material-ui-eb5bb5f8.js";import{S as C}from"./chunk-index-b4f9c953.js";import{D as m}from"./chunk-index-a1788cfb.js";import{B as L}from"./chunk-index-9f909ab3.js";const O=({props:o,setOpenInfo:l,setOpenCart:d,getBasket:c})=>{var x;const s=()=>{l(!1),d(!0),c()};if(!o)return null;const u=o.NAME,t=o.PRICE,i=o.PRODUCT_INFO,n=i.DETAIL_PAGE_URL,e=i.OFFERS_GALLERY,f=i.TREE_PROPS.COLOR.VALUE,P=i.TREE_PROPS.SIZE.VALUE,R=(x=o.PROPERTIES.find(p=>p.CODE==="CML2_ARTICLE"))==null?void 0:x.VALUE;return r.jsxs(r.Fragment,{children:[r.jsx(S,{sku:0,itemName:u,link:n,imgPath:A(e,f,"200x200"),color:f,size:P,currentPrice:t,article:R}),r.jsx(E,{item:!0,sm:6,xs:12,children:r.jsx(h,{onClick:s,style:{padding:"8px 16px",fontSize:14},fullWidth:!0,color:"secondary",variant:"outlined",children:"Перейти в корзину"})}),r.jsx(E,{item:!0,sm:6,xs:12,children:r.jsx(h,{href:j.checkout.index,style:{padding:"8px 16px",fontSize:14},fullWidth:!0,color:"default",variant:"contained",children:"Оформить заказ"})})]})};function U({cartItem:o,open:l,handleClose:d,getBasket:c,setOpenCart:s,setOpenInfo:u,openCart:t,basketLoading:i,basketData:n}){var e;return r.jsxs(r.Fragment,{children:[r.jsx(C,{open:l,autoHideDuration:3e3,onClose:d,title:Array.isArray(o==null?void 0:o.data)?"Товара нет":"Добавлено в корзину",children:r.jsx(r.Fragment,{children:!Array.isArray(o==null?void 0:o.data)&&r.jsx(O,{props:o==null?void 0:o.data,getBasket:c,setOpenCart:s,setOpenInfo:u})})}),r.jsx(m,{isWrapped:!0,showCloseIcon:!0,open:t,onClose:()=>s(!1),handlerCloseIcon:()=>s(!1),anchor:"right",closeIconPosition:"right",children:r.jsx(L,{loading:i,itemsBasket:n==null?void 0:n.data.BASKET,pricesBasket:n==null?void 0:n.data.ORDER_PRICES,couponList:Object.values(((e=n==null?void 0:n.data.DISCOUNT_DATA)==null?void 0:e.COUPON_LIST)??{})})})]})}export{U as B};