"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("react"),r=require("./useMountTransition.js"),o=require("../../hooks/useGetProductId.js"),s=require("../common/helpers.js");exports.default=a=>{let{accordions:u,index:l,builderProps:n,parentSetting:i={},parentStyle:c={},handleDropDown:d}=a,{iconPosition:m,titleTypo:p,iconCollapse:g,iconExpand:v,iconSvg:S}=i;delete p?.attrs?.color;let{itemContentSpacing:M,iconColor:f,contentSizePadding:y}=c,I=u?.includes(l?.toString()??""),b=e.makeGlobalSize(y),h=e.useEditorMode(),[j,k]=t.useState(I),q=r.default(j||!1,500);t.useEffect(()=>{k(I)},[I]);let w=t.useMemo(()=>s.composeIconSvg({isShow:I,iconExpand:v,iconCollapse:g,iconSvg:S}),[I,v,g,S]),G=t.useMemo(()=>e.makeStyle({fd:"left"===m?"row":"row-reverse",jc:"right"===m?"space-between":""}),[m]),P=t.useMemo(()=>{let t={normal:f?.normal??"transparent",hover:f?.hover??f?.active??f?.normal??"transparent",active:f?.active??f?.normal??"transparent"};return I?e.makeStyle({c:e.getSingleColorVariable(t?.active)}):e.getGlobalColorStateStyle("c",t)},[f,I]),{refContainer:$,productID:x}=o.useGetProductId(),z=t.useMemo(()=>{let e=`gp-accordion-item-${n?.uid}-${l}`;return x?`${e}-${x}`:e},[n?.uid,l,x]),C=t.useMemo(()=>{let t={...y&&b.padding,...M?.type||y?{}:e.composeSize(M?.custom)};return I?t:e.removePaddingYInStyle(t)},[y,M,I,b]),E=t.useMemo(()=>q||j||"edit"!==h,[q,j,h]);return{productID:x,isShow:I,getIdDropdownItem:(e,t)=>{!e.target.closest(".gp-text")&&d&&t&&(k(!j),d(t))},makeIcon:w,refContainer:$,uniqueId:z,isRenderChildren:E,composePosition:G,composeIconColor:P,composeContentSizeStyle:C,hasTransitionedIn:q,isMounted:j}};
