"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),system=require("@gem-sdk/system"),styles=require("./common/styles.js"),classes=require("./common/classes.js");const FormDropdown=({builderProps:e,setting:s,advanced:t,pageContext:r,styles:o})=>{let{name:l,childItem:a,required:p,translate:c}=s??{},d=a?.map((s,t)=>helpers.getDynamicSourceLocales({val:s,uid:e?.uid,settingId:`childItem_${t}`,pageContext:r,translate:c})),i=system.createStyle(styles.composeContainerStyles(t,s)),m=system.createStyle({...styles.composeFormDropdownStyles(t,s,o),...styles.getAppendTypoStyleFirstTime(s)}),n=system.createStyle(styles.getStyleOption(s)),y=system.createClass(classes.composeContainerClasses(t,e)),u=system.createClass(classes.composeFormDropdownClasses(s));return core.template`
    <gp-form-dropdown
      data-id="${e?.uid}"
      class="${y}"
      style="${i}"
    >
      <select
        type="email"
        class="${u}"
        style="${m}"
        ${system.If(p,"required")}
        name="${l}"
        gp-data='${JSON.stringify(s).replaceAll("'","&#039;")}'
      >
        ${system.If(!Number(s?.defaultOption),`<option class="gp-hidden" value="" disabled selected>
            ${s?.placeholder}
          </option>`)}
        ${d?.map(e=>core.template`
            <option
              value="${e}"
              style="${n}"
              ${system.If(!!Number(s?.defaultOption),`selected: ${e===d[Number(s?.defaultOption)-1]}`)}
            >
              ${e}
            </option>`).join("")}
      </select>
    </gp-form-dropdown>
    ${core.RenderIf(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-form-dropdown-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-form-dropdown-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};exports.default=FormDropdown;
