'use client';
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useRenderMode as o,useI18nStore as s,isEmptyChildren as n}from"@gem-sdk/core";import{isValidElement as r}from"react";import i from"../../../common/components/NoDataState.js";import{createClass as l,createStyle as m,If as d}from"@gem-sdk/system";import{getSizeSettings as c,getContainerStyles as u}from"./common/styles.js";import{getContainerClasses as a,getNoDiscountClasses as p}from"./common/classes.js";import f from"./hooks/useProductBundleDataState.js";import h from"./hooks/useProductBundleDiscountState.js";import y from"./ProductBundleDiscountChildrenItem.js";let b=({builderAttrs:b,style:I,children:g,setting:j,styles:k,advanced:D})=>{let{isEditMode:S,isPreviewSharePageMode:x}=o(),{isSelected:B,setSelected:N}=h(j),{emitRedirectSetupPage:P,redirectGuideline:T,svgVertical:v,svgHorizontal:A}=f(),{t:C}=s(),q=l(a(j,D?.cssClass)),w=l(p),z=m(c(k)?.gap),M=m(u(z,k,I));if(!j?.bundleItems?.length&&S)return e(i,{elementType:"secondary",description:C("Increase AOV with bundle quantity."),descriptionActions:[{text:C("Setup bundle discount"),callback:P},{text:C("read guideline"),callback:T}],additionalMedia:j?.layout=="horizontal-layout"?A:v});let O=(t,o)=>{if(j?.hideNoDiscountItem&&t?.discountType==="no_discount")return null;let s=g?.[o];if(r(s))return e(y,{index:o,childItem:s,setting:j,styles:k,isSelected:B(o),setSelected:N,bundleItem:t},o)},V=(n(g)||j?.bundleItems?.length==0)&&!x;return t("div",{...b,className:q,style:M,children:[d(V,e("div",{className:w,children:C("This product has no bundle discount")})),j?.bundleItems?.map((e,t)=>O(e,t))]})};export{b as default};
