"use strict";var core=require("@gem-sdk/core");const MINIMUM_CHILD=1,BODY_CHILD_INDEX=0,ICON_MINUS="<svg width='16' height='16' fill='currentColor' viewBox=\"0 0 448 512\"><path fill='currentColor' d=\"M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z\"/></svg>",ICON_PLUS="<svg fill='currentColor' width='16' height='16' xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><path fill='currentColor' d=\"M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z\"/></svg>",getDataState=(t,e)=>{let{setting:r={},styles:o={},builderProps:a}=t,{activeKey:i,iconSvg:l,expandItem:s,iconPosition:n,iconCollapseSize:c,iconGlobalSize:g,iconExpand:S,iconCollapse:I,layoutHeader:p,expandedMode:m,configIconSize:u}=r,{bgColor:d,color:v,headerBorder:C,width:N,fullWidth:h,textColor:L,itemHeaderSpacing:_,contentSizePadding:M,iconColor:U,headerContentPadding:w,widthHeightSize:x}=o,D="multiple"===m,O=t=>t?t.toString().toLowerCase().split(",").map(t=>parseInt(t.trim())-1).map(t=>t.toString()):[],P=s?O(i):[],H=D?[...P]:P,y=()=>({iconSvg:l,isIconPlus:"plus"===l,activeKey:i,expanded:D,expandItem:s,iconPosition:n,iconGlobalSize:g,iconCollapse:I,iconExpand:S,iconCollapseSize:c,layoutHeader:p,expandedMode:m,configIconSize:u,parentUid:a?.uid,childListNumber:s?i?.toString().toLowerCase()==="all"?e?.map((t,e)=>e.toString()):H:[],chidlrenUid:e?.map(t=>t.uid)}),b=()=>({bgColor:d,color:v,headerBorder:C,fullWidth:h,width:N,itemHeaderSpacing:_,textColor:L,iconColor:U,contentSizePadding:M,headerContentPadding:w,widthHeightSize:x});return{uidState:a?.uid,settingState:y(),stylesState:b(),accordions:H}},getParentSettings=(t={})=>{let{iconSvg:e,titleTypo:r,layoutHeader:o,iconGlobalSize:a,iconCollapseSize:i,iconCollapse:l,iconExpand:s,alignment:n,configIconSize:c,iconPosition:g}=t,S=r?{...r,attrs:{...r.attrs}}:void 0;return S?.attrs?.color&&delete S.attrs.color,{iconSvg:e,titleTypo:S,layoutHeader:o,iconGlobalSize:a,iconCollapseSize:i,iconCollapse:l,iconExpand:s,alignment:n,configIconSize:c,iconPosition:g}},composeIconSvg=({isShow:t,iconExpand:e,iconCollapse:r,iconSvg:o})=>e&&t?e:r&&!t?r:"plus"===o?t?ICON_MINUS:ICON_PLUS:o,getSettingItemLiquid=t=>{let{index:e,accordions:r,parentSetting:o,parentStyle:a}=t,{titleTypo:i,iconCollapse:l,iconExpand:s,activeKey:n,expandItem:c,iconSvg:g}=o??{};delete i?.attrs?.color;let{itemContentSpacing:S,iconColor:I,contentSizePadding:p}=a??{},m=!!c&&(n?.toString()?.toLowerCase()==="all"||r?.includes(e?.toString()??"")),u=core.makeGlobalSize(p),d=()=>{let t={...p&&u.padding,...S?.type||p?{}:core.composeSize(S?.custom)};return m?t:core.removePaddingYInStyle(t)},v=composeIconSvg({isShow:m,iconExpand:s,iconCollapse:l,iconSvg:g}),C=()=>{let t={normal:I?.normal??"transparent",hover:I?.hover??I?.active??I?.normal??"transparent",active:I?.active??"transparent"};return m?core.makeStyle({c:core.getSingleColorVariable(t?.active)}):core.getGlobalColorStateStyle("c",t)};return{isShow:m,composeContentSizeStyle:d,collapsibleIcon:v,composeIconColor:C(),makeIcon:v}};exports.BODY_CHILD_INDEX=0,exports.ICON_MINUS=ICON_MINUS,exports.ICON_PLUS=ICON_PLUS,exports.MINIMUM_CHILD=1,exports.composeIconSvg=composeIconSvg,exports.getDataState=getDataState,exports.getParentSettings=getParentSettings,exports.getSettingItemLiquid=getSettingItemLiquid;
