'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),core=require("@gem-sdk/core"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),Text=require("../../text/components/Text.js"),useAccordionItem=require("../hooks/useAccordionItem.js"),system=require("@gem-sdk/system"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),helpers=require("../common/helpers.js");const AccordionItem=e=>{let{children:s,index:t,parentUid:l,title:r,childrenIcon:a}=e,{iconSvg:n,titleTypo:c,layoutHeader:o,iconGlobalSize:i,iconCollapseSize:m,iconCollapse:y,iconExpand:d,alignment:u,configIconSize:x,iconPosition:p}=helpers.getParentSettings(e.parentSetting)??{},{refContainer:g,getIdDropdownItem:j,makeIcon:C,isShow:h,uniqueId:S,composeIconColor:I,isRenderChildren:R,composeContentSizeStyle:v,hasTransitionedIn:N,isMounted:f,productID:_}=useAccordionItem.default(e),b=system.createClass(classes.getItemContainerClasses),q=system.createClass(classes.getDropdownClasses(e.parentStyle,{isShow:h,uniqueId:S,makeIcon:C,index:t})),D=system.createClass(classes.getIconClasses),M=system.createClass(classes.getIconRotateClasses(e.parentStyle,{isShow:h,iconExpand:d,iconSvg:n,iconCollapse:y})),T=system.createClass(classes.getContentClasses(l)),A=system.createClass(classes.getGapClasses),L=system.createStyle(styles.getItemContainerStyles(e.parentStyle,h)),H=system.createStyle(styles.getDropdownStyles(e.parentStyle,{isShow:h,iconPosition:p})),k=system.createStyle(styles.getDropdownTextStyles(e.parentStyle?.textColor,h)),w=system.createStyle(styles.getIconRotateStyles(e.parentStyle,h,m)),G=system.createStyle(styles.getIconGlobalSize(i)),O=system.createStyle(styles.getGapStyles(i,u)),P=system.createClass(core.composeClasses("gp-inline-flex")),z=system.createClass(classes.getLayoutIconClasses),B=system.createStyle(styles.getIconStyles(I,x)),E=system.createClass(classes.getRenderChildrenClasses(e.parentStyle,{isShow:h,hasTransitionedIn:N,isMounted:f})),F=system.createStyle(styles.getRenderChildrenStyles()),U=system.createClass(core.composeClasses("gp-accordion-item_body-inner gp-transition-all gp-duration-500 gp-min-h-0")),X=system.createClass(core.composeClasses("gp-border gp-border-transparent group-hover:[color:var(--text-hover-color)]")),Y=React.useMemo(()=>{let e=React.Children.toArray(s);return e.length>=helpers.MINIMUM_CHILD?e[helpers.BODY_CHILD_INDEX]:jsxRuntime.jsx(ChildrenDroppable.default,{})},[s]);return jsxRuntime.jsx("div",{className:b,ref:g,style:L,children:jsxRuntime.jsxs("div",{"data-index":t?.toString(),className:T,children:[jsxRuntime.jsxs("div",{"aria-hidden":!0,onClick:e=>{j(e,t?.toString())},className:q,style:H,children:[system.If(!!C,jsxRuntime.jsx("div",{className:D,children:jsxRuntime.jsx("span",{style:w,className:M,dangerouslySetInnerHTML:{__html:C??""}})})),jsxRuntime.jsxs("div",{className:A,style:O,children:[system.If("before-text"===o,jsxRuntime.jsx("div",{className:P,style:{...G},children:jsxRuntime.jsx("span",{className:z,style:B,dangerouslySetInnerHTML:{__html:a??""}})})),jsxRuntime.jsx(Text.default,{setting:{text:r,htmlTag:"div",options:{uniqueId:S,productID:_,useState:!0},excludeFlex:!0},style:k,styles:{typo:c},className:X}),system.If("after-text"===o,jsxRuntime.jsx("div",{className:P,style:{...G},children:jsxRuntime.jsx("span",{className:z,style:B,dangerouslySetInnerHTML:{__html:a??""}})}))]})]}),R&&jsxRuntime.jsx("div",{...e?.builderAttrs,className:E,style:F,"data-index":t,"data-show":h,children:jsxRuntime.jsx("div",{className:U,style:v,children:Y})})]})})};exports.default=AccordionItem;
