import{_ as y,b as S,a as V,d as _,c as x}from"./CNprkc5i.js";import{e as k,Z as M,$ as h,x as m,m as f,o,n as s,w as n,b as u,I as p,W as $,c as v,y as B,d as C,t as g,F as w}from"./BoB2h2qv.js";const N={key:1,class:"px-2 py-3 text-sm text-muted-foreground"},F=k({__name:"selector",props:M({options:{},placeholder:{default:"Select..."},disabled:{type:Boolean,default:!1},emptyMessage:{default:void 0},class:{default:void 0},contentClass:{default:void 0}},{modelValue:{type:[String,Number,Boolean,null],default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const i=l,d=h(l,"modelValue"),r=m(()=>{const e=new Map;for(const a of i.options)e.set(String(a.value),a.value);return e}),c=m({get:()=>{const e=d.value;if(e==null)return;const a=r.value;for(const[t,b]of a.entries())if(b===e)return t;return String(e)},set:e=>{if(e===void 0||e===""){d.value=null;return}const a=r.value;d.value=a.get(e)??e}});return(e,a)=>(o(),f(s(y),{modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=t=>c.value=t),disabled:l.disabled},{default:n(()=>[u(s(V),{class:p(s($)("w-full",i.class))},{default:n(()=>[u(s(S),{placeholder:l.placeholder},null,8,["placeholder"])]),_:1},8,["class"]),u(s(x),{class:p(l.contentClass)},{default:n(()=>[l.options.length?(o(!0),v(w,{key:0},B(l.options,t=>(o(),f(s(_),{key:String(t.value),value:String(t.value),disabled:t.disabled},{default:n(()=>[C(g(t.label),1)]),_:2},1032,["value","disabled"]))),128)):(o(),v("div",N,g(l.emptyMessage||"No options available"),1))]),_:1},8,["class"])]),_:1},8,["modelValue","disabled"]))}}),D=Object.assign(F,{__name:"Selector"});export{D as S};
