"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../../helpers.js"),system=require("@gem-sdk/system"),helpers=require("../common/helpers.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),translate=require("../settings/configs/translate.js");const Accordion=({rawChildren:e,setting:s,styles:t,builderProps:r,pageContext:a,advanced:c,style:l,builderAttrs:i})=>{let{align:o}=t??{},{childItem:n,activeKey:d}=s??{},{uidState:p,settingState:y,stylesState:g,accordions:m}=helpers.getDataState({setting:s,styles:t,builderProps:r},e),u=system.createStateOrContext({uid:p,setting:y,styles:{...g}}),S=system.createClass(classes.getContainerClasses(c?.cssClass)),$=system.createStyle({...styles.getContainerStyles(l,t)}),h=system.createAttr({...i,"data-id":r?.uid??""}),f=system.createStyle({...core.makeStyleResponsive("jc",o)}),v=system.createClass({"gp-flex":!0}),C=system.createClass(classes.extendClasses()),j=()=>core.WrapRenderChildren({uid:r?.uid??"",customProps:e?.[0].customProps},e?.map((e,c)=>{if(e){let l=helpers$1.getDynamicSourceLocales({val:n?.[c],uid:r?.uid,settingId:helpers$1.createSettingId({id:translate.Accordion?.childItem?.id,index:c}),pageContext:a??{},isCapitalize:s?.titleTypo?.attrs?.transform==="capitalize"});return core.template`
          <div class="${v}" style="${f}">
            ${core.RenderChildren({...e,index:c,title:l,accordions:m,parentSetting:s,parentStyle:t,parentUid:r?.uid,childrenIcon:s?.childConfig?.[c],activeKey:d})}
          </div>
            `}})),A=()=>core.RenderIf(core.isLocalEnv,`
    <script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-accordion-v7-5.js' | asset_url }}"
      defer="defer"></script>`,`
    <script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-accordion-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>
    `);return core.template`
    <gp-accordion ${h} class="${S}" style="${$}"
      gp-data='${JSON.stringify(u).replaceAll("'","&#039;")}'
        >
        <div class=" ${C}"></div>
      ${j()}
    </gp-accordion>
    ${A()}
  `};exports.default=Accordion;
