'use client';
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useI18nStore as o,useProduct as m,useCurrentVariant as t,useMoneyFormat as r,useCurrentDevice as l,useProductBundleDiscount as i,useEditorMode as a,useRenderMode as c,usePageType as n,filterToolbarPreview as d}from"@gem-sdk/core";import{getBadgeContent as p,getIsNoDiscountState as y}from"./utils/common.js";import"./constants.js";import f from"../../../common/components/NoDataState.js";import h from"../../../common/components/TooltipHover.js";import{createClass as N,createStyle as u,createAttr as j,If as v}from"@gem-sdk/system";import{getEditTooltipAttrs as g,getSubWrapperAttrs as T,getContainerAttrs as k,getTextContentAttrs as x,getImageAttr as B}from"./common/attrs.js";import{getContainerClasses as C,getWrapperClasses as P,getSubWrapperClass as S,getTextContainerClasses as b,getTextWrapperClasses as w,getTextContentClasses as A,getImageContainerClasses as D,getImageClasses as H}from"./common/classes.js";import{getContainerStyle as I,getSubWrapperStyle as M,getContentStyleInternal as q,getTextBadgeWrapperStyles as z,getTextContentStyle as E,getImageContainerStyles as F}from"./common/styles.js";let ProductBadge=G=>{let{t:J}=o(),{setting:K,styles:L,children:O,builderAttrs:Q,...R}=G,U=m(),V=t(),{moneyFormat:W}=r(),X=l(),{useProductCompareAtPrice:Y}=i(),Z=R?.["bundle-item"],$=a(),{isEditMode:_}=c(),ee="STATIC"===n(),es=p({detail:U,currentVariant:V,bundleItem:Z,useProductCompareAtPrice:Y},K?.displayContent,W),eo=y({props:G,product:U,currentVariant:V,moneyFormat:W,useProductCompareAtPrice:Y}),em=N({...C({mode:$,isInstant:ee,product:U,currentVariant:V,props:G})}),et=u({...I(G)}),er=j({...g(G,_)}),el=N({...P(G)}),ei=N({...S(G,X)}),ea=u({...M({props:G,product:U,currentVariant:V,isEditMode:_})}),ec=j({...T(G,U)}),en=q(G),ed=N({...b()}),ep=j({...k(G)}),ey=N({...w()}),ef=u({...z({setting:K,styles:L})}),eh=N({...A(L)}),eN=u({...E({setting:K,styles:L})}),eu=j({...x()}),ej=N({...D()}),ev=u({...F({setting:K,styles:L})}),eg=N({...H()}),eT=j({...B({setting:K})});return U?e("div",{...ep,style:et,className:em,children:[v(_&&eo,s(h,{...er,children:s(f,{...Q,elementType:"secondary",description:J("No discount"),rawMode:!0})}),s("div",{className:el,children:e("div",{...ec,className:ei,style:ea,children:[s("style",{children:en}),v(K?.shape!=="image",s("div",{className:ed,children:s("div",{className:ey,style:ef,children:s("pre",{...eu,className:eh,style:eN,children:es})})}),s("div",{className:ej,style:ev,children:s("img",{...eT,className:eg,alt:""})}))]})})),d(O,!0)]}):null};export{ProductBadge as default};
