import{template as e,RenderIf as o,isLocalEnv as s,baseAssetURL as r}from"@gem-sdk/core";import{getDynamicSourceLocales as t,createSettingId as d,getSettingPreloadData as p}from"../../../helpers.js";import{createStyle as l,createClass as i,If as m}from"@gem-sdk/system";import{composeContainerStyles as a,composeFormDropdownStyles as n,getAppendTypoStyleFirstTime as c,getStyleOption as f}from"./common/styles.js";import{composeContainerClasses as $,composeFormDropdownClasses as g}from"./common/classes.js";import{FormDropdown as u}from"../../settings/form-dropdown/configs/translate.js";let FormDropdown=({builderProps:y,setting:w,advanced:j,pageContext:v,styles:S})=>{let{name:h,childItem:N,required:O}=w??{},b=N?.map((e,o)=>t({val:e,uid:y?.uid,settingId:d({id:u?.childItem?.id,index:o}),pageContext:v??{}})),k=l(a(j,w)),E=l({...n(j,w,S),...c(w)}),A=l(f(w)),D=i($(j,y)),F=i(g(w));return e`
    <gp-form-dropdown
      data-id="${y?.uid}"
      class="${D}"
      style="${k}"
    >
      <select
        type="email"
        class="${F}"
        style="${E}"
        ${m(O,"required")}
        name="${h}"
        gp-data='${JSON.stringify(w).replaceAll("'","&#039;")}'
      >
        ${m(!Number(w?.defaultOption),`<option class="gp-hidden" value="" disabled selected>
            ${w?.placeholder}
          </option>`)}
        ${b?.map(o=>e`
            <option
              value="${o}"
              style="${A}"
              ${m(!!Number(w?.defaultOption),`selected: ${o===b[Number(w?.defaultOption)-1]}`)}
            >
              ${o}
            </option>`).join("")}
      </select>
    </gp-form-dropdown>
    ${o(s,`<script ${p('class="gps-link" delay',"src")}="{{ 'gp-form-dropdown-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${p('class="gps-link" delay',"src")}="${r}/assets-v2/gp-form-dropdown-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};export{FormDropdown as default};
