import{V as c}from"./vue-select-CqDP9j-G.mjs";import{_ as p}from"./WebFormFieldCore-xNTPdj0N.mjs";import{_ as m,G as h,o as n,c as d,d as f,s as a,N as v,a as i,ah as _,ca as w,aa as V,y,t as M,l as S}from"./BDipKYNj.js";const g={components:{VueSelect:c},extends:p,props:{value:{type:[Array,String],default:()=>[]},placeholder:{type:String,default:null},options:{type:Array,required:!0},allowMultiple:{type:Boolean,default:!1}},data(){return{selected:this.allowMultiple?this.value:{}}},watch:{selected(e){this.update(e)}},mounted(){var e;this.allowMultiple||(this.selected=((e=this.options.find(t=>t.value===this.value))==null?void 0:e.value)??"")},methods:{validate(e){return this.required&&(!e||`${e}`.trim()==="")?{valid:!1,errors:["Field is required"]}:{valid:!0,errors:[]}}}},q={class:"form-field-select"},E=["title","innerHTML"],H=["innerHTML"],A={key:0,class:"error"};function B(e,t,r,C,o,L){const u=h("VueSelect");return n(),d("div",q,[f(u,{id:e.name,modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=s=>o.selected=s),placeholder:r.placeholder??"Select...",name:e.name,reduce:s=>s.value,disabled:e.disabled,required:e.required,options:r.options,multiple:r.allowMultiple,"menu-props":"auto",class:y(["select",e.hasError&&e.showErrors?"has-error":""])},{search:a(({attributes:s,events:l})=>[v(i("input",_({maxlength:"20",class:"vs__search"},s,w(l,!0)),null,16),[[V,!o.selected||r.options]])]),option:a(s=>{var l;return[i("div",{title:s.title,innerHTML:(l=s.label)==null?void 0:l.replaceAll(",",", ")},null,8,E)]}),"selected-option":a(({label:s})=>[i("div",{innerHTML:s==null?void 0:s.replaceAll(",",", ")},null,8,H)]),_:1},8,["id","modelValue","placeholder","name","reduce","disabled","required","options","multiple","class"]),e.hasError&&e.showErrors?(n(),d("span",A,M(e.errorMsg),1)):S("",!0)])}const F=m(g,[["render",B],["__scopeId","data-v-0dea6152"]]);export{F as default};