'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),useMarqueeStyles=require("../hooks/useMarqueeStyles.js"),useMarqueeScrollToItem=require("../hooks/useMarqueeScrollToItem.js"),MarqueeBase=require("./MarqueeBase.js"),useMarquee=require("../hooks/useMarquee.js"),system=require("@gem-sdk/system"),classes=require("../common/classes.js"),styles=require("../common/styles.js");const Marquee=({children:e,style:s,builderAttrs:t,advanced:r,...a})=>{let{styles:l,setting:i,builderProps:u}=a,{iconSeparatorSvg:c,isShowIconSeparator:m,stopOnHover:o,speed:n}=i||{},{backgroundColor:d,iconSeparatorColor:y}=l||{},q=React.useMemo(()=>React.Children.count(core.filterToolbarPreview(e)),[e]),{isFullWidth:j}=useMarqueeStyles.useMarqueeStyles({setting:i,styles:l,itemSize:q}),{styleHeight:C,styleWidth:h,getWidthForWrapperItem:x,getHeightOfIconSeparatorSize:S,getWidthOfIconSeparatorSize:M,getIconPosition:v,getItemPaddingRightSpacingValue:g,getWidthForItem:R}=styles.getMarqueeStyles({setting:i,styles:l,itemSize:q}),{rate:p,wrapperElement:I,scrollTime:w,hoverItem:N,setHoverItem:T,setActiveItem:f,activeItem:k,direction:B,isPause:F,scrollToItemClass:P}=useMarqueeScrollToItem.useMarqueeScrollToItem({children:e,style:s,builderAttrs:t,...a}),{isPlay:b,rateUse:_}=useMarquee.useMarquee({children:e,isPause:F,isPreview:u?.isPreview,rate:p,speed:n}),A=system.createClass(classes.getAlignClasses),H=system.createStyle(styles.getAlignStyles(l)),E=system.createStyle(styles.getContentStyles({style:s,backgroundColor:d,styleWidth:h,styleHeight:C})),O=system.createClass(classes.getContentClasses),W=system.createClass(classes.getWrapperClasses(u?.uid)),L=system.createClass(classes.getFastMarqueeClasses),V=system.createClass(classes.getFastMarqueeContentClasses),z=system.createClass(classes.getFastMarqueeContentChildrenClasses(j)),D=e=>system.createStyle(styles.getFastMarqueeChildrenIconStyles({index:e,itemSize:q,iconSeparatorColor:y,getHeightOfIconSeparatorSize:S,getWidthOfIconSeparatorSize:M,getIconPosition:v})),G=system.createClass(classes.getFastMarqueeChildrenIconClasses),J=e=>system.createStyle({...g(e),"text-wrap":"wrap",...x()}),K=system.createStyle(R());return jsxRuntime.jsx("div",{"data-id":u?.uid,className:core.cls(u?.uid,r?.cssClass),children:jsxRuntime.jsx("div",{className:A,style:H,children:jsxRuntime.jsxs("div",{"data-id":u?.uid,className:O,style:E,...t,children:[jsxRuntime.jsx("div",{className:W,ref:I,children:jsxRuntime.jsx("div",{className:L,children:jsxRuntime.jsx(MarqueeBase.default,{autoFill:!0,play:b,speed:_,isFullWidth:j,pauseOnHover:o,direction:B,uniqueId:u?.uid,style:{...h,width:"100%"},children:jsxRuntime.jsx("div",{className:V,children:core.isEmptyChildren(e)?jsxRuntime.jsx("div",{children:"No Slider"}):React.Children.map(core.filterToolbarPreview(e),(e,s)=>React.isValidElement(e)?jsxRuntime.jsxs("div",{className:z,style:J(s),children:[jsxRuntime.jsx(e.type,{...e.props,index:s,activeItem:k,hoverItem:N,timeToScroll:w,setHoverItem:T,setActiveItem:f,className:P(s),itemBorderStyle:l?.itemBorderStyle,itemCorner:l?.itemCorner,itemBackgroundColor:l?.itemBackgroundColor,hasItemShadow:i?.hasItemShadow,itemShadow:l?.itemShadow,itemStyle:K}),system.If(!!(m&&c),jsxRuntime.jsx("span",{style:D(s),className:G,dangerouslySetInnerHTML:{__html:c??""}}))]},e.key):null)})})})}),core.filterToolbarPreview(e,!0)]})})})};exports.default=Marquee;
