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