import{a as x,_ as M,T as E,b as K}from"./CQn3kAfA.js";import{_ as L}from"./CbtPaznW.js";import{_ as N}from"./G7u0egV4.js";import{d as P,L as $,u as D,c as H,a as R,o as f,F as Y,f as n,w as g,Y as j,b as y,E as _,g as o,N as z,l as u,e as k,s as O}from"./JQJBiNWj.js";import q from"./Dc_YXEFz.js";import{S as G}from"./H4pzrCEL.js";const J={class:"flex flex-col h-full gap-5 w-full"},Q={class:"flex flex-wrap gap-2"},W=P({__name:"Multi",props:$({id:{},name:{},dialogHeader:{default:"Selecionar setor"},showClear:{type:Boolean,default:!1},invalid:{type:Boolean,default:!1},showInactives:{type:Boolean,default:()=>{}},onlyVisibleInPleitos:{type:Boolean,default:()=>{}},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const{modalVisible:s,areas:v,areasNested:V,statusFetchAreas:S,searchAreas:m,expandedKeys:c,searchInativos:i}=x({showInactives:r.showInactives,onlyVisibleInPleitos:r.onlyVisibleInPleitos}),t=D(r,"modelValue");function C(e){return e.sigla+" - "+e.descricao}const U=H(()=>{var l;const e=t.value;if(e!=null&&e.length){if(e.length>1)return`${e.length} setores selecionados`;if((l=v.value)!=null&&l.length){const d=v.value.find(p=>p.id===e[0]);if(d)return C(d)}return"1 setor selecionado"}});function w(){t.value=[],s.value=!1}function B(e){["Space","Enter"].includes(e.code)&&(e.preventDefault(),s.value=!0)}function b(){s.value=!0}return(e,l)=>{const d=M,p=L,F=q,h=N,I=O,A=z;return f(),R(Y,null,[n(F,{name:e.name},{default:g(a=>[j(e.$slots,"input",{openModal:b,field:a},()=>[n(d,{id:e.id,"model-value":o(U),invalid:e.invalid||a.invalid,"show-clear":e.showClear,disabled:e.disabled,onClick:b,onClear:w,onKeydown:B},null,8,["id","model-value","invalid","show-clear","disabled"]),a.props?(f(),y(p,{key:0,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=T=>t.value=T),field:a},null,8,["modelValue","field"])):_("",!0)])]),_:3},8,["name"]),n(A,{visible:o(s),"onUpdate:visible":l[7]||(l[7]=a=>u(s)?s.value=a:null),modal:"",header:e.dialogHeader,class:"w-full h-full full-screen-mobile lg:overflow-hidden","content-class":"overflow-hidden grow",closable:!1},{default:g(()=>[k("div",J,[n(E,{search:o(m),"onUpdate:search":l[1]||(l[1]=a=>u(m)?m.value=a:null),inativos:o(i),"onUpdate:inativos":l[2]||(l[2]=a=>u(i)?i.value=a:null),"show-inactives":e.showInactives},null,8,["search","inativos","show-inactives"]),n(K,{"multi-value":t.value,"onUpdate:multiValue":l[3]||(l[3]=a=>t.value=a),"expanded-keys":o(c),"onUpdate:expandedKeys":l[4]||(l[4]=a=>u(c)?c.value=a:null),"nested-areas":o(V),status:o(S),"show-inactives":e.showInactives!==!1&&o(i)!==o(G).Ativo,multi:""},null,8,["multi-value","expanded-keys","nested-areas","status","show-inactives"]),k("div",Q,[e.showClear?(f(),y(h,{key:0,mode:"clean",onClick:w})):_("",!0),n(h,{mode:"back",class:"ml-auto",onClick:l[5]||(l[5]=a=>s.value=!1)}),n(I,{type:"button",label:"Finalizar",icon:"pi pi-check",class:"max-lg:w-full",onClick:l[6]||(l[6]=a=>s.value=!1)})])])]),_:1},8,["visible","header"])],64)}}}),se=Object.assign(W,{__name:"UiSelectSetorAgenciaMulti"});export{se as _};
