import{U as p}from"./BweM3Zv8.js";import{i as m,c,D as v,Q as g,d as A,b as d,g as i,o as r}from"./JQJBiNWj.js";import{u as R}from"./F98GHXdS.js";import h from"./DPeK_S5k.js";import b from"./BBDFeM-T.js";const f=o=>o+"-referencia-ativos",k=o=>{const{data:a}=R(async()=>m.ativos.findAllReferenciaAtivos(o),"$hyK1sjJlGc"),n=c(()=>{var t;const l={};return(t=a.value)==null||t.forEach(e=>{var s;if(e.campoReferencia)if(l[e.campoReferencia])(s=l[e.campoReferencia])==null||s.push(e);else return l[e.campoReferencia]=[e]}),l});return g(f(o),n),n},y=o=>v(f(o),void 0),w=A({__name:"SelectReferenciaAtivo",props:{name:{},tipoAtivo:{},campoReferencia:{default:()=>{}},disabled:{type:Boolean,default:!1},multi:{type:Boolean,default:!1},showToggleAll:{type:Boolean,default:!1}},setup(o){const a=y(o.tipoAtivo),n=c(()=>o.campoReferencia||o.name);function l(){return m.ativos.findAllReferenciaAtivos(o.tipoAtivo,{campoReferencia:n.value})}const t=c(()=>o.multi?h:b);return(e,s)=>{const u=p;return i(a)?(r(),d(i(t),{key:0,id:e.name,name:e.name,options:i(a)[i(n)]||[],"option-label":"nome","option-value":"id",filter:"","show-clear":"",disabled:e.disabled,"read-only":e.disabled,loading:!i(a)[i(n)],placeholder:"Selecione...","show-toggle-all":e.showToggleAll},null,8,["id","name","options","disabled","read-only","loading","show-toggle-all"])):(r(),d(u,{key:1,id:e.name,name:e.name,"async-fn":l,"option-label":"nome","option-value":"id",filter:"","show-clear":"",disabled:e.disabled,"read-only":e.disabled,multi:e.multi,"show-toggle-all":e.showToggleAll},null,8,["id","name","disabled","read-only","multi","show-toggle-all"]))}}}),T=Object.assign(w,{__name:"UiSelectReferenciaAtivo"});export{T as _,k as u};
