import{_ as e}from"./Dnmkv-LO.js";import{_ as a}from"./Jeu02Edj.js";import{c as l,w as s,A as t,L as u,V as n,P as r,$ as d,M as o,a2 as i,W as p,H as m,u as c,x as v,_ as y,X as f,G as b,O as _}from"./DOfEu912.js";import{j as g}from"./DkkR1ac8.js";import{I as V,j,A as x,F as k}from"./UAqKlY4B.js";const q={class:"input-wrapper"},h={key:0,for:"label"},S={class:"relative"},w={key:0,class:"text-desc"},A={key:1},F={class:"absolute top-[48%] -translate-y-1/2 end-5"},I={__name:"BaseSelectInput",props:{items:{type:Array,required:!1,default:()=>[]},name:{type:String,required:!0},label:{type:String,required:!1},placeholder:{type:String,required:!1},value:{type:Object,required:!1},rounded:{type:Boolean,required:!1}},emits:["update:value"],setup(I,{expose:B,emit:C}){const M=I,O=g(M.name),P=l(null);s((()=>P.value),((e,a)=>{e?(O.setValue(e),z("update:value",e)):e!=a&&(O.setValue(null),z("update:value",void 0))}),{deep:!0,immediate:!0}),s((()=>M.value),((e,a)=>{e?(P.value=e,O.setValue(e)):e!=a&&(P.value=null,O.setValue(null))}),{deep:!0,immediate:!0});B({emptyInput:()=>{P.value=null}});const z=C;return(l,s)=>{const g=e,B=a,C=t("VeeErrorMessage"),M=t("VeeField");return u(),n(M,{name:I.name},{default:r((({field:e,meta:a})=>[d("div",q,[I.label?(u(),o("label",h,i(I.label),1)):p("",!0),d("div",S,[m(B,null,{default:r((()=>[m(c(V),{modelValue:c(P),"onUpdate:modelValue":s[1]||(s[1]=e=>v(P)?P.value=e:null)},{default:r((()=>[m(c(j),{class:y(I.rounded?"!rounded-full !px-6":"")},{default:r((()=>{var e,a,l,t;return[I.placeholder&&!(null==(e=c(P))?void 0:e.name)?(u(),o("span",w,i(I.placeholder),1)):p("",!0),(null==(a=c(P))?void 0:a.name)?(u(),o("span",A,i(null==(l=c(P))?void 0:l.name),1)):p("",!0),d("span",F,[m(g,{name:"chevron-down"})]),c(P)&&(null==(t=c(P))?void 0:t.id)?(u(),o("button",{key:2,onClick:s[0]||(s[0]=e=>{e.stopPropagation(),P.value=null}),class:"absolute top-1/2 -translate-y-1/2 end-10"},[m(g,{name:"close-2",class:"text-desc scale-[0.6]"})])):p("",!0)]})),_:1},8,["class"]),m(f,{name:"fade"},{default:r((()=>[m(c(x),null,{default:r((()=>[(u(!0),o(b,null,_(I.items,(e=>(u(),n(c(k),{as:"template",key:e.id,value:e},{default:r((({active:a,selected:l})=>[d("li",{class:y([a&&"bg-primary bg-opacity-20 rounded-lg",l&&"bg-primary bg-opacity-20 rounded-lg"])},i(null==e?void 0:e.name),3)])),_:2},1032,["value"])))),128))])),_:1})])),_:1})])),_:1},8,["modelValue"])])),_:1})])]),m(C,{class:"text-sm text-red-500",name:I.name},null,8,["name"])])),_:1},8,["name"])}}};export{I as _};
