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