import{_ as e}from"./XQnr5WFw.js";import{_ as a}from"./CAnGDX73.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"./BCDZ6bul.js";import{j as g}from"./u7I9BgvO.js";import{I as V,j,A as x,F as k}from"./KuFEerX8.js";const q={class:"input-wrapper"},h={key:0,for:"label"},A={class:"relative"},S={key:0,class:"text-desc"},w={key:1},I={class:"absolute top-[48%] -translate-y-1/2 end-5"},B={__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(B,{expose:F,emit:G}){const M=B,O=g(M.name),P=l(null);s((()=>P.value),((e,a)=>{e?(O.setValue(e),C("update:value",e)):e!=a&&(O.setValue(null),C("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});F({emptyInput:()=>{P.value=null}});const C=G;return(l,s)=>{const g=e,F=a,G=t("VeeErrorMessage"),M=t("VeeField");return u(),n(M,{name:B.name},{default:r((({field:e,meta:a})=>[d("div",q,[B.label?(u(),o("label",h,i(B.label),1)):p("",!0),d("div",A,[m(F,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(B.rounded?"!rounded-full !px-6":"")},{default:r((()=>{var e,a,l,t;return[B.placeholder&&!(null==(e=c(P))?void 0:e.name)?(u(),o("span",S,i(B.placeholder),1)):p("",!0),(null==(a=c(P))?void 0:a.name)?(u(),o("span",w,i(null==(l=c(P))?void 0:l.name),1)):p("",!0),d("span",I,[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,_(B.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(G,{class:"text-sm text-red-500",name:B.name},null,8,["name"])])),_:1},8,["name"])}}};export{B as _};
