(function(w,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("vuetify/components/VBtn"),require("vuetify/components/VBadge"),require("vuetify/components/VTextField"),require("vuetify/components/VCard"),require("vuetify/components/VGrid"),require("vuetify/components"),require("vuetify/components/VChip"),require("vuetify/components/VTextarea"),require("vuetify/components/VSelect")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/components/VBtn","vuetify/components/VBadge","vuetify/components/VTextField","vuetify/components/VCard","vuetify/components/VGrid","vuetify/components","vuetify/components/VChip","vuetify/components/VTextarea","vuetify/components/VSelect"],t):(w=typeof globalThis<"u"?globalThis:w||self,t(w.eli_vue={},w.Vue,w.VBtn,w.VBadge,w.VTextField,w.VCard,w.VGrid,w.components,w.VChip,w.VTextarea,w.VSelect))})(this,(function(w,t,xe,et,Ce,se,tt,ve,at,ot,nt){"use strict";const rt=t.defineComponent({name:"EliBotao",inheritAttrs:!1,props:{color:{type:String,default:"primary"},variant:{type:String,default:"elevated"},size:{type:String,default:"default"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}}}),T=(e,a)=>{const n=e.__vccOpts||e;for(const[l,s]of a)n[l]=s;return n};function lt(e,a,n,l,s,m){return t.openBlock(),t.createBlock(xe.VBtn,t.mergeProps({color:e.color,variant:e.variant,size:e.size,disabled:e.disabled,loading:e.loading},e.$attrs,{class:"eli-botao text-none pt-1"}),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},16,["color","variant","size","disabled","loading"])}const _e=T(rt,[["render",lt]]),Ae={suave:"4px",pill:"10px"},it=t.defineComponent({name:"EliBadge",inheritAttrs:!1,props:{color:{type:String,default:"primary"},location:{type:String,default:"top right"},offsetX:{type:String,default:"0"},offsetY:{type:String,default:"0"},dot:{type:Boolean,default:!1},visible:{type:Boolean,default:!0},badge:{type:[String,Number],default:void 0},radius:{type:String,default:"suave"}},setup(e){const a=t.computed(()=>e.radius in Ae?Ae[e.radius]:e.radius),n=t.computed(()=>e.dot||e.badge!==void 0?e.visible:!1),l=t.computed(()=>({"--eli-badge-radius":a.value}));return{showBadge:n,badgeStyle:l}}});function st(e,a,n,l,s,m){return e.showBadge?(t.openBlock(),t.createBlock(et.VBadge,t.mergeProps({key:0,color:e.color},e.$attrs,{location:e.location,"offset-x":e.offsetX,"offset-y":e.offsetY,dot:e.dot,content:e.badge,style:e.badgeStyle,class:"eli-badge"}),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},16,["color","location","offset-x","offset-y","dot","content","style"])):t.renderSlot(e.$slots,"default",{key:1})}const ye=T(it,[["render",st]]);function ct(e){return e.replace(/\D+/g,"")}function dt(e){const a=ct(e);return a.length<=11?a.replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2").slice(0,14):a.replace(/^(\d{2})(\d)/,"$1.$2").replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3").replace(/\.(\d{3})(\d)/,".$1/$2").replace(/(\d{4})(\d)/,"$1-$2").slice(0,18)}function ut(e){return e.replace(/\D+/g,"")}function mt(e){const a=ut(e);return a?a.length<=10?a.replace(/^(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2").slice(0,14):a.replace(/^(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2").slice(0,15):""}function pt(e){return e.replace(/\D+/g,"")}function ft(e){const a=pt(e);return a?a.replace(/^(\d{5})(\d)/,"$1-$2").slice(0,9):""}const bt=t.defineComponent({name:"EliEntradaTexto",inheritAttrs:!1,props:{value:{type:[String,null],default:void 0},opcoes:{type:Object,required:!0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,focus:()=>!0,blur:()=>!0},setup(e,{attrs:a,emit:n}){const l=t.computed(()=>{var i;return((i=e.opcoes)==null?void 0:i.formato)??"texto"}),s=t.computed({get:()=>e.value,set:i=>{n("update:value",i),n("input",i),n("change",i)}}),m=t.computed(()=>l.value==="email"?"email":l.value==="url"?"url":"text"),o=t.computed(()=>{if(l.value==="telefone")return"tel";if(l.value==="cpfCnpj"||l.value==="cep")return"numeric"});function r(i){switch(l.value){case"telefone":return mt(i);case"cpfCnpj":return dt(i);case"cep":return ft(i);default:return i}}function u(i){const d=i.target,b=r(d.value);d.value=b,s.value=b}return{attrs:a,emit:n,localValue:s,inputHtmlType:m,inputMode:o,onInput:u}}});function ht(e,a,n,l,s,m){var o,r,u,i;return t.openBlock(),t.createBlock(Ce.VTextField,t.mergeProps({modelValue:e.localValue,"onUpdate:modelValue":a[0]||(a[0]=d=>e.localValue=d),type:e.inputHtmlType,inputmode:e.inputMode,label:(o=e.opcoes)==null?void 0:o.rotulo,placeholder:(r=e.opcoes)==null?void 0:r.placeholder,counter:(u=e.opcoes)==null?void 0:u.limiteCaracteres,maxlength:(i=e.opcoes)==null?void 0:i.limiteCaracteres},e.attrs,{onFocus:a[1]||(a[1]=()=>e.emit("focus")),onBlur:a[2]||(a[2]=()=>e.emit("blur")),onInput:e.onInput}),null,16,["modelValue","type","inputmode","label","placeholder","counter","maxlength","onInput"])}const $e=T(bt,[["render",ht]]),gt=t.defineComponent({name:"EliOlaMundo",components:{EliBotao:_e,EliBadge:ye,EliEntradaTexto:$e},setup(){const e=t.ref(""),a=t.ref(""),n=t.ref(""),l=t.ref(""),s=t.ref("");return{nome:e,email:l,documento:s,telefone:n,cep:a}}}),yt={class:"grid-example"};function $t(e,a,n,l,s,m){const o=t.resolveComponent("EliBadge"),r=t.resolveComponent("EliEntradaTexto"),u=t.resolveComponent("EliBotao");return t.openBlock(),t.createBlock(tt.VContainer,null,{default:t.withCtx(()=>[t.createVNode(se.VCard,{class:"mx-auto",max_width:"400"},{default:t.withCtx(()=>[t.createVNode(se.VCardTitle,null,{default:t.withCtx(()=>[t.createVNode(o,{badge:"Novo","offset-x":"-15",location:"right center"},{default:t.withCtx(()=>[...a[5]||(a[5]=[t.createTextVNode(" Olá Mundo! ",-1)])]),_:1})]),_:1}),t.createVNode(se.VCardText,null,{default:t.withCtx(()=>[a[6]||(a[6]=t.createTextVNode(" Este é um componente de exemplo integrado com Vuetify. ",-1)),t.createElementVNode("div",yt,[t.createVNode(r,{value:e.nome,"onUpdate:value":a[0]||(a[0]=i=>e.nome=i),opcoes:{rotulo:"Nome",placeholder:"Digite o nome"},density:"compact"},null,8,["value"]),t.createVNode(r,{value:e.telefone,"onUpdate:value":a[1]||(a[1]=i=>e.telefone=i),opcoes:{rotulo:"Telefone",formato:"telefone"}},null,8,["value"]),t.createVNode(r,{value:e.cep,"onUpdate:value":a[2]||(a[2]=i=>e.cep=i),opcoes:{rotulo:"CEP",placeholder:"00000-000",formato:"cep"}},null,8,["value"]),t.createVNode(r,{value:e.documento,"onUpdate:value":a[3]||(a[3]=i=>e.documento=i),opcoes:{rotulo:"CPF / CNPJ",formato:"cpfCnpj"}},null,8,["value"]),t.createVNode(r,{value:e.email,"onUpdate:value":a[4]||(a[4]=i=>e.email=i),opcoes:{rotulo:"Email",placeholder:"email@exemplo.com",formato:"email"}},null,8,["value"])])]),_:1}),t.createVNode(se.VCardActions,null,{default:t.withCtx(()=>[t.createVNode(u,{color:"primary",variant:"elevated",block:""},{default:t.withCtx(()=>[...a[7]||(a[7]=[t.createTextVNode(" Botão Vuetify ",-1)])]),_:1})]),_:1})]),_:1})]),_:1})}const Me=T(gt,[["render",$t]]),Et=t.defineComponent({name:"EliCartao",components:{EliBadge:ye},inheritAttrs:!1,props:{titulo:{type:String,default:""},status:{type:String,required:!0},variant:{type:String,default:"outlined"}},emits:{clicar:e=>!0},setup(e,{emit:a}){const n=t.computed(()=>e.status),l=t.computed(()=>{switch(e.status){case"novo":return"primary";case"rascunho":return"secondary";case"vendido":return"success";case"cancelado":return"error"}}),s=t.computed(()=>`eli-cartao--${e.status}`);function m(){a("clicar",e.status)}return{rotuloStatus:n,corStatus:l,classeStatus:s,onClick:m}}}),kt={class:"eli-cartao__titulo-texto"},Bt={class:"eli-cartao__status"};function Ct(e,a,n,l,s,m){const o=t.resolveComponent("EliBadge");return t.openBlock(),t.createBlock(se.VCard,t.mergeProps({class:["eli-cartao",e.classeStatus],variant:e.variant},e.$attrs),{default:t.withCtx(()=>[t.createVNode(se.VCardTitle,{class:"eli-cartao__titulo"},{default:t.withCtx(()=>[t.createElementVNode("div",kt,[t.renderSlot(e.$slots,"titulo",{},()=>[t.createTextVNode(t.toDisplayString(e.titulo),1)])]),t.createElementVNode("div",Bt,[t.createVNode(o,{badge:e.rotuloStatus,radius:"pill",color:e.corStatus},{default:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("span",null,null,-1)])]),_:1},8,["badge","color"])])]),_:3}),t.createVNode(se.VCardText,{class:"eli-cartao__conteudo"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3}),e.$slots.acoes?(t.openBlock(),t.createBlock(se.VCardActions,{key:0,class:"eli-cartao__acoes"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"acoes")]),_:3})):t.createCommentVNode("",!0)]),_:3},16,["variant","class"])}const we=T(Et,[["render",Ct]]);var Te=(e=>(e[e.sucesso=200]="sucesso",e[e.erroConhecido=400]="erroConhecido",e[e.erroPermissao=401]="erroPermissao",e[e.erroNaoEncontrado=404]="erroNaoEncontrado",e[e.erroDesconhecido=500]="erroDesconhecido",e[e.tempoEsgotado=504]="tempoEsgotado",e))(Te||{});/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vt=e=>{for(const a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pe=e=>e==="";/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _t=(...e)=>e.filter((a,n,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===n).join(" ").trim();/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,n,l)=>l?l.toUpperCase():n.toLowerCase());/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const St=e=>{const a=Vt(e);return a.charAt(0).toUpperCase()+a.slice(1)};/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var be={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dt=({name:e,iconNode:a,absoluteStrokeWidth:n,"absolute-stroke-width":l,strokeWidth:s,"stroke-width":m,size:o=be.width,color:r=be.stroke,...u},{slots:i})=>t.h("svg",{...be,...u,width:o,height:o,stroke:r,"stroke-width":Pe(n)||Pe(l)||n===!0||l===!0?Number(s||m||be["stroke-width"])*24/Number(o):s||m||be["stroke-width"],class:_t("lucide",u.class,...e?[`lucide-${Fe(St(e))}-icon`,`lucide-${Fe(e)}`]:["lucide-icon"]),...!i.default&&!vt(u)&&{"aria-hidden":"true"}},[...a.map(d=>t.h(...d)),...i.default?[i.default()]:[]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fe=(e,a)=>(n,{slots:l,attrs:s})=>t.h(Dt,{...s,...n,iconNode:a,name:e},l);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Oe=fe("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qe=fe("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ie=fe("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Le=fe("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nt=fe("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const At=fe("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Mt=t.defineComponent({name:"EliTabelaCaixaDeBusca",components:{Search:At},props:{modelo:{type:String,required:!1,default:""}},emits:{buscar(e){return typeof e=="string"}},setup(e,{emit:a}){const n=t.ref(e.modelo??"");t.watch(()=>e.modelo,s=>{s!==void 0&&s!==n.value&&(n.value=s)});function l(){a("buscar",n.value.trim())}return{texto:n,emitirBusca:l}}}),wt={class:"eli-tabela__busca"},Tt={class:"eli-tabela__busca-input-wrapper"};function Pt(e,a,n,l,s,m){const o=t.resolveComponent("Search");return t.openBlock(),t.createElementBlock("div",wt,[t.createElementVNode("div",Tt,[t.withDirectives(t.createElementVNode("input",{id:"eli-tabela-busca","onUpdate:modelValue":a[0]||(a[0]=r=>e.texto=r),type:"search",class:"eli-tabela__busca-input",placeholder:"Digite termos para filtrar",onKeyup:a[1]||(a[1]=t.withKeys((...r)=>e.emitirBusca&&e.emitirBusca(...r),["enter"]))},null,544),[[t.vModelText,e.texto]]),t.createElementVNode("button",{type:"button",class:"eli-tabela__busca-botao","aria-label":"Buscar",title:"Buscar",onClick:a[2]||(a[2]=(...r)=>e.emitirBusca&&e.emitirBusca(...r))},[t.createVNode(o,{class:"eli-tabela__busca-botao-icone",size:16,"stroke-width":2,"aria-hidden":"true"})])])])}const Ft=T(Mt,[["render",Pt]]),Ot=t.defineComponent({name:"EliTabelaCabecalho",components:{EliTabelaCaixaDeBusca:Ft},props:{exibirBusca:{type:Boolean,required:!0},exibirBotaoColunas:{type:Boolean,required:!1,default:!0},exibirBotaoFiltroAvancado:{type:Boolean,required:!1,default:!1},valorBusca:{type:String,required:!0},acoesCabecalho:{type:Array,required:!0}},emits:{buscar(e){return typeof e=="string"},colunas(){return!0},filtroAvancado(){return!0}},setup(e,{emit:a}){const n=t.computed(()=>e.acoesCabecalho.length>0);function l(o){a("buscar",o)}function s(){a("colunas")}function m(){a("filtroAvancado")}return{temAcoesCabecalho:n,emitBuscar:l,emitColunas:s,emitFiltroAvancado:m}}}),qt={class:"eli-tabela__cabecalho"},It={key:0,class:"eli-tabela__busca-grupo"},Lt={key:1,class:"eli-tabela__acoes-cabecalho"},zt=["onClick"],jt={class:"eli-tabela__acoes-cabecalho-rotulo"};function Ht(e,a,n,l,s,m){const o=t.resolveComponent("EliTabelaCaixaDeBusca");return t.openBlock(),t.createElementBlock("div",qt,[e.exibirBusca?(t.openBlock(),t.createElementBlock("div",It,[e.exibirBotaoColunas?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__acoes-cabecalho-botao eli-tabela__acoes-cabecalho-botao--colunas",onClick:a[0]||(a[0]=(...r)=>e.emitColunas&&e.emitColunas(...r))}," Colunas ")):t.createCommentVNode("",!0),e.exibirBotaoFiltroAvancado?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"eli-tabela__acoes-cabecalho-botao eli-tabela__acoes-cabecalho-botao--filtro",onClick:a[1]||(a[1]=(...r)=>e.emitFiltroAvancado&&e.emitFiltroAvancado(...r))}," Filtro ")):t.createCommentVNode("",!0),t.createVNode(o,{modelo:e.valorBusca,onBuscar:e.emitBuscar},null,8,["modelo","onBuscar"])])):t.createCommentVNode("",!0),e.temAcoesCabecalho?(t.openBlock(),t.createElementBlock("div",Lt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.acoesCabecalho,(r,u)=>(t.openBlock(),t.createElementBlock("button",{key:`${r.rotulo}-${u}`,type:"button",class:"eli-tabela__acoes-cabecalho-botao",style:t.normalizeStyle(r.cor?{backgroundColor:r.cor,color:"#fff"}:void 0),onClick:r.acao},[r.icone?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.icone),{key:0,class:"eli-tabela__acoes-cabecalho-icone",size:16,"stroke-width":2})):t.createCommentVNode("",!0),t.createElementVNode("span",jt,t.toDisplayString(r.rotulo),1)],12,zt))),128))])):t.createCommentVNode("",!0)])}const Ut=T(Ot,[["render",Ht]]),Yt=t.defineComponent({name:"EliTabelaEstados",props:{carregando:{type:Boolean,required:!0},erro:{type:String,required:!0},mensagemVazio:{type:String,required:!1,default:void 0}}}),Rt={key:0,class:"eli-tabela eli-tabela--carregando","aria-busy":"true"},Jt={key:1,class:"eli-tabela eli-tabela--erro",role:"alert"},Wt={class:"eli-tabela__erro-mensagem"},Zt={key:2,class:"eli-tabela eli-tabela--vazio"};function Gt(e,a,n,l,s,m){return e.carregando?(t.openBlock(),t.createElementBlock("div",Rt," Carregando... ")):e.erro?(t.openBlock(),t.createElementBlock("div",Jt,[a[0]||(a[0]=t.createElementVNode("div",{class:"eli-tabela__erro-titulo"},"Erro",-1)),t.createElementVNode("div",Wt,t.toDisplayString(e.erro),1)])):(t.openBlock(),t.createElementBlock("div",Zt,t.toDisplayString(e.mensagemVazio??"Nenhum registro encontrado."),1))}const Xt=T(Yt,[["render",Gt]]),Kt=t.defineComponent({name:"EliTabelaDebug",props:{isDev:{type:Boolean,required:!0},menuAberto:{type:Number,required:!0},menuPopupPos:{type:Object,required:!0}}}),Qt={key:0,style:{position:"fixed",left:"8px",bottom:"8px","z-index":"999999",background:"rgba(185,28,28,0.9)",color:"#fff",padding:"6px 10px","border-radius":"8px","font-size":"12px","max-width":"500px"}};function xt(e,a,n,l,s,m){return e.isDev?(t.openBlock(),t.createElementBlock("div",Qt,[a[0]||(a[0]=t.createElementVNode("div",null,[t.createElementVNode("b",null,"EliTabela debug")],-1)),t.createElementVNode("div",null,"menuAberto: "+t.toDisplayString(e.menuAberto),1),t.createElementVNode("div",null,"menuPos: top="+t.toDisplayString(e.menuPopupPos.top)+", left="+t.toDisplayString(e.menuPopupPos.left),1),t.renderSlot(e.$slots,"default")])):t.createCommentVNode("",!0)}const ea=T(Kt,[["render",xt]]),ta=t.defineComponent({name:"EliTabelaHead",components:{ArrowUp:qe,ArrowDown:Oe},props:{colunas:{type:Array,required:!0},temAcoes:{type:Boolean,required:!0},temColunasInvisiveis:{type:Boolean,required:!0},colunaOrdenacao:{type:String,required:!0},direcaoOrdenacao:{type:String,required:!0}},emits:{alternarOrdenacao(e){return typeof e=="string"&&e.length>0}},setup(e,{emit:a}){function n(s){return(s==null?void 0:s.coluna_ordem)!==void 0&&(s==null?void 0:s.coluna_ordem)!==null}function l(s){a("alternarOrdenacao",s)}return{ArrowUp:qe,ArrowDown:Oe,isOrdenavel:n,emitAlternarOrdenacao:l}}}),aa={class:"eli-tabela__thead"},oa={class:"eli-tabela__tr eli-tabela__tr--header"},na={key:0,class:"eli-tabela__th eli-tabela__th--expander",scope:"col"},ra=["onClick"],la={class:"eli-tabela__th-texto"},ia={key:1,class:"eli-tabela__th-label"},sa={key:1,class:"eli-tabela__th eli-tabela__th--acoes",scope:"col"};function ca(e,a,n,l,s,m){const o=t.resolveComponent("ArrowUp");return t.openBlock(),t.createElementBlock("thead",aa,[t.createElementVNode("tr",oa,[e.temColunasInvisiveis?(t.openBlock(),t.createElementBlock("th",na)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(r,u)=>(t.openBlock(),t.createElementBlock("th",{key:`th-${u}`,class:t.normalizeClass(["eli-tabela__th",[e.isOrdenavel(r)?"eli-tabela__th--ordenavel":void 0]]),scope:"col"},[e.isOrdenavel(r)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["eli-tabela__th-botao",[e.colunaOrdenacao===String(r.coluna_ordem)?"eli-tabela__th-botao--ativo":void 0]]),onClick:i=>e.emitAlternarOrdenacao(String(r.coluna_ordem))},[t.createElementVNode("span",la,t.toDisplayString(r.rotulo),1),e.colunaOrdenacao===String(r.coluna_ordem)?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.direcaoOrdenacao==="asc"?e.ArrowUp:e.ArrowDown),{key:0,class:"eli-tabela__th-icone",size:16,"stroke-width":2,"aria-hidden":"true"})):(t.openBlock(),t.createBlock(o,{key:1,class:"eli-tabela__th-icone eli-tabela__th-icone--oculto",size:16,"stroke-width":2,"aria-hidden":"true"}))],10,ra)):(t.openBlock(),t.createElementBlock("span",ia,t.toDisplayString(r.rotulo),1))],2))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("th",sa," Ações ")):t.createCommentVNode("",!0)])])}const da=T(ta,[["render",ca]]),ua=t.defineComponent({name:"EliTabelaCelulaTextoSimples",components:{},props:{dados:{type:Object}},data(){return{}},methods:{},setup({dados:e}){return{dados:e}}}),ma={key:1};function pa(e,a,n,l,s,m){var o,r,u;return(o=e.dados)!=null&&o.acao?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__celula-link",onClick:a[0]||(a[0]=t.withModifiers(i=>e.dados.acao(),["stop","prevent"]))},t.toDisplayString((r=e.dados)==null?void 0:r.texto),1)):(t.openBlock(),t.createElementBlock("span",ma,t.toDisplayString((u=e.dados)==null?void 0:u.texto),1))}const fa=T(ua,[["render",pa]]),ba=t.defineComponent({name:"EliTabelaCelulaTextoTruncado",props:{dados:{type:Object}},setup({dados:e}){return{dados:e}}}),ha=["title"],ga=["title"];function ya(e,a,n,l,s,m){var o,r,u,i,d;return(o=e.dados)!=null&&o.acao?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__texto-truncado eli-tabela__celula-link",title:(r=e.dados)==null?void 0:r.texto,onClick:a[0]||(a[0]=t.withModifiers(b=>{var C,v;return(v=(C=e.dados)==null?void 0:C.acao)==null?void 0:v.call(C)},["stop","prevent"]))},t.toDisplayString((u=e.dados)==null?void 0:u.texto),9,ha)):(t.openBlock(),t.createElementBlock("span",{key:1,class:"eli-tabela__texto-truncado",title:(i=e.dados)==null?void 0:i.texto},t.toDisplayString((d=e.dados)==null?void 0:d.texto),9,ga))}const $a=T(ba,[["render",ya]]),Ea=t.defineComponent({name:"EliTabelaCelulaNumero",components:{},props:{dados:{type:Object}},setup({dados:e}){const a=t.computed(()=>{var r,u;const n=String(e==null?void 0:e.numero).replace(".",","),l=(r=e==null?void 0:e.prefixo)==null?void 0:r.trim(),s=(u=e==null?void 0:e.sufixo)==null?void 0:u.trim(),m=l?`${l} `:"",o=s?` ${s}`:"";return`${m}${n}${o}`});return{dados:e,textoNumero:a}}}),ka={key:1};function Ba(e,a,n,l,s,m){var o;return(o=e.dados)!=null&&o.acao?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__celula-link",onClick:a[0]||(a[0]=t.withModifiers(r=>e.dados.acao(),["stop","prevent"]))},t.toDisplayString(e.textoNumero),1)):(t.openBlock(),t.createElementBlock("span",ka,t.toDisplayString(e.textoNumero),1))}const Ca=T(Ea,[["render",Ba]]),va=t.defineComponent({name:"EliTabelaCelulaTags",components:{VChip:ve.VChip},props:{dados:{type:Object,required:!1}},setup({dados:e}){return{dados:e}}}),_a={class:"eli-tabela__celula-tags"};function Va(e,a,n,l,s,m){var o;return t.openBlock(),t.createElementBlock("div",_a,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(((o=e.dados)==null?void 0:o.opcoes)??[],(r,u)=>(t.openBlock(),t.createBlock(at.VChip,{key:u,class:"eli-tabela__celula-tag",size:"small",variant:"tonal",color:r.cor,clickable:!!r.acao,onClick:t.withModifiers(i=>{var d;return(d=r.acao)==null?void 0:d.call(r)},["stop","prevent"])},{default:t.withCtx(()=>[r.icone?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.icone),{key:0,class:"eli-tabela__celula-tag-icone",size:14})):t.createCommentVNode("",!0),t.createElementVNode("span",null,t.toDisplayString(r.rotulo),1)]),_:2},1032,["color","clickable","onClick"]))),128))])}const Sa=T(va,[["render",Va]]);function ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}},Da=Ee.exports,je;function Na(){return je||(je=1,(function(e,a){(function(n,l){e.exports=l()})(Da,(function(){var n=1e3,l=6e4,s=36e5,m="millisecond",o="second",r="minute",u="hour",i="day",d="week",b="month",C="quarter",v="year",y="date",c="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(_){var h=["th","st","nd","rd"],p=_%100;return"["+_+(h[(p-20)%10]||h[p]||h[0])+"]"}},j=function(_,h,p){var k=String(_);return!k||k.length>=h?_:""+Array(h+1-k.length).join(p)+_},W={s:j,z:function(_){var h=-_.utcOffset(),p=Math.abs(h),k=Math.floor(p/60),f=p%60;return(h<=0?"+":"-")+j(k,2,"0")+":"+j(f,2,"0")},m:function _(h,p){if(h.date()
1)return _(V[0])}else{var M=h.name;H[M]=h,f=M}return!k&&f&&(I=f),f||!k&&I},A=function(_,h){if(P(_))return _.clone();var p=typeof h=="object"?h:{};return p.date=_,p.args=arguments,new me(p)},D=W;D.l=ae,D.i=P,D.w=function(_,h){return A(_,{locale:h.$L,utc:h.$u,x:h.$x,$offset:h.$offset})};var me=(function(){function _(p){this.$L=ae(p.locale,null,!0),this.parse(p),this.$x=this.$x||p.x||{},this[G]=!0}var h=_.prototype;return h.parse=function(p){this.$d=(function(k){var f=k.date,S=k.utc;if(f===null)return new Date(NaN);if(D.u(f))return new Date;if(f instanceof Date)return new Date(f);if(typeof f=="string"&&!/Z$/i.test(f)){var V=f.match($);if(V){var M=V[2]-1||0,L=(V[7]||"0").substring(0,3);return S?new Date(Date.UTC(V[1],M,V[3]||1,V[4]||0,V[5]||0,V[6]||0,L)):new Date(V[1],M,V[3]||1,V[4]||0,V[5]||0,V[6]||0,L)}}return new Date(f)})(p),this.init()},h.init=function(){var p=this.$d;this.$y=p.getFullYear(),this.$M=p.getMonth(),this.$D=p.getDate(),this.$W=p.getDay(),this.$H=p.getHours(),this.$m=p.getMinutes(),this.$s=p.getSeconds(),this.$ms=p.getMilliseconds()},h.$utils=function(){return D},h.isValid=function(){return this.$d.toString()!==c},h.isSame=function(p,k){var f=A(p);return this.startOf(k)<=f&&f<=this.endOf(k)},h.isAfter=function(p,k){return A(p)0,H<=I.r||!I.r){H<=1&&W>0&&(I=E[W-1]);var G=g[I.l];v&&(H=v(""+H)),c=typeof G=="string"?G.replace("%d",H):G(H,d,I.l,$);break}}if(d)return c;var P=$?g.future:g.past;return typeof P=="function"?P(c):P.replace("%s",c)},m.to=function(i,d){return r(i,d,this,!0)},m.from=function(i,d){return r(i,d,this)};var u=function(i){return i.$u?s.utc():s()};m.toNow=function(i){return this.to(u(this),i)},m.fromNow=function(i){return this.from(u(this),i)}}}))})(ke)),ke.exports}var Ta=wa();const Pa=ze(Ta);ce.extend(Pa);const Fa=t.defineComponent({name:"EliTabelaCelulaData",props:{dados:{type:Object,required:!1}},setup({dados:e}){const a=t.computed(()=>{const n=e==null?void 0:e.valor;if(!n)return"";const l=(e==null?void 0:e.formato)??"data";return l==="relativo"?ce(n).fromNow():l==="data_hora"?ce(n).format("DD/MM/YYYY HH:mm"):ce(n).format("DD/MM/YYYY")});return{dados:e,textoData:a}}}),Oa={key:1};function qa(e,a,n,l,s,m){var o;return(o=e.dados)!=null&&o.acao?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__celula-link",onClick:a[0]||(a[0]=t.withModifiers(r=>e.dados.acao(),["stop","prevent"]))},t.toDisplayString(e.textoData),1)):(t.openBlock(),t.createElementBlock("span",Oa,t.toDisplayString(e.textoData),1))}const Ia={textoSimples:fa,textoTruncado:$a,numero:Ca,tags:Sa,data:T(Fa,[["render",qa]])},La=t.defineComponent({name:"EliTabelaCelula",props:{celula:{type:Array,required:!0}},setup(e){const a=t.computed(()=>e.celula[0]),n=t.computed(()=>e.celula[1]),l=t.computed(()=>Ia[a.value]),s=t.computed(()=>n.value);return{Componente:l,dadosParaComponente:s}}});function za(e,a,n,l,s,m){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Componente),{dados:e.dadosParaComponente},null,8,["dados"])}const Ue=T(La,[["render",za]]),ja=t.defineComponent({name:"EliTabelaDetalhesLinha",components:{EliTabelaCelula:Ue},props:{linha:{type:null,required:!0},colunasInvisiveis:{type:Array,required:!0}}}),Ha={class:"eli-tabela__detalhes"},Ua={class:"eli-tabela__detalhe-rotulo"},Ya={class:"eli-tabela__detalhe-valor"};function Ra(e,a,n,l,s,m){const o=t.resolveComponent("EliTabelaCelula");return t.openBlock(),t.createElementBlock("div",Ha,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunasInvisiveis,(r,u)=>(t.openBlock(),t.createElementBlock("div",{key:`det-${u}-${r.rotulo}`,class:"eli-tabela__detalhe"},[t.createElementVNode("div",Ua,t.toDisplayString(r.rotulo),1),t.createElementVNode("div",Ya,[t.createVNode(o,{celula:r.celula(e.linha)},null,8,["celula"])])]))),128))])}const Ja=T(ja,[["render",Ra]]),Wa=t.defineComponent({name:"EliTabelaBody",components:{EliTabelaCelula:Ue,EliTabelaDetalhesLinha:Ja,MoreVertical:Nt,ChevronRight:Le,ChevronDown:Ie},props:{colunas:{type:Array,required:!0},colunasInvisiveis:{type:Array,required:!0},temColunasInvisiveis:{type:Boolean,required:!0},linhasExpandidas:{type:Object,required:!0},linhas:{type:Array,required:!0},temAcoes:{type:Boolean,required:!0},menuAberto:{type:Number,required:!0},possuiAcoes:{type:Function,required:!0},toggleMenu:{type:Function,required:!0},alternarLinhaExpandida:{type:Function,required:!0}},setup(){return{ChevronRight:Le,ChevronDown:Ie}}}),Za={class:"eli-tabela__tbody"},Ga=["aria-expanded","aria-label","title","onClick"],Xa=["id","disabled","aria-expanded","aria-controls","aria-label","title","onClick"],Ka=["colspan"];function Qa(e,a,n,l,s,m){const o=t.resolveComponent("EliTabelaCelula"),r=t.resolveComponent("MoreVertical"),u=t.resolveComponent("EliTabelaDetalhesLinha");return t.openBlock(),t.createElementBlock("tbody",Za,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.linhas,(i,d)=>{var b,C,v,y,c,$;return t.openBlock(),t.createElementBlock(t.Fragment,{key:`grp-${d}`},[t.createElementVNode("tr",{class:t.normalizeClass(["eli-tabela__tr",[d%2===1?"eli-tabela__tr--zebra":void 0]])},[e.temColunasInvisiveis?(t.openBlock(),t.createElementBlock("td",{class:"eli-tabela__td eli-tabela__td--expander",key:`td-${d}-exp`},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["eli-tabela__expander-botao",[(b=e.linhasExpandidas)!=null&&b[d]?"eli-tabela__expander-botao--ativo":void 0]]),"aria-expanded":(C=e.linhasExpandidas)!=null&&C[d]?"true":"false","aria-label":(v=e.linhasExpandidas)!=null&&v[d]?"Ocultar colunas ocultas":"Mostrar colunas ocultas",title:(y=e.linhasExpandidas)!=null&&y[d]?"Ocultar detalhes":"Mostrar detalhes",onClick:t.withModifiers(g=>e.alternarLinhaExpandida(d),["stop"])},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent((c=e.linhasExpandidas)!=null&&c[d]?e.ChevronDown:e.ChevronRight),{class:"eli-tabela__expander-icone",size:16,"stroke-width":2,"aria-hidden":"true"}))],10,Ga)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(g,E)=>(t.openBlock(),t.createElementBlock("td",{key:`td-${d}-${E}`,class:"eli-tabela__td"},[t.createVNode(o,{celula:g.celula(i)},null,8,["celula"])]))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("td",{class:"eli-tabela__td eli-tabela__td--acoes",key:`td-${d}-acoes`},[t.createElementVNode("div",{class:t.normalizeClass(["eli-tabela__acoes-container",[e.menuAberto===d?"eli-tabela__acoes-container--aberto":void 0]])},[t.createElementVNode("button",{class:"eli-tabela__acoes-toggle",type:"button",id:`eli-tabela-acoes-toggle-${d}`,disabled:!e.possuiAcoes(d),"aria-haspopup":"menu","aria-expanded":e.menuAberto===d?"true":"false","aria-controls":e.possuiAcoes(d)?`eli-tabela-acoes-menu-${d}`:void 0,"aria-label":e.possuiAcoes(d)?"Ações da linha":"Nenhuma ação disponível",title:e.possuiAcoes(d)?"Ações":"Nenhuma ação disponível",onClick:t.withModifiers(g=>e.toggleMenu(d,g),["stop"])},[t.createVNode(r,{class:"eli-tabela__acoes-toggle-icone",size:18,"stroke-width":2})],8,Xa)],2)])):t.createCommentVNode("",!0)],2),e.temColunasInvisiveis&&(($=e.linhasExpandidas)!=null&&$[d])?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["eli-tabela__tr eli-tabela__tr--detalhes",[d%2===1?"eli-tabela__tr--zebra":void 0]])},[t.createElementVNode("td",{class:"eli-tabela__td eli-tabela__td--detalhes",colspan:(e.temColunasInvisiveis?1:0)+e.colunas.length+(e.temAcoes?1:0)},[t.createVNode(u,{linha:i,colunasInvisiveis:e.colunasInvisiveis},null,8,["linha","colunasInvisiveis"])],8,Ka)],2)):t.createCommentVNode("",!0)],64)}),128))])}const xa=T(Wa,[["render",Qa]]),eo=t.defineComponent({name:"EliTabelaMenuAcoes",props:{menuAberto:{type:Number,required:!0},posicao:{type:Object,required:!0},acoes:{type:Array,required:!0},linha:{type:null,required:!0}},emits:{executar(e){return e!==null&&typeof e=="object"}},setup(e,{emit:a,expose:n}){const l=t.ref(null);n({menuEl:l});const s=t.computed(()=>e.acoes.length>0);function m(o){e.linha&&a("executar",{acao:o.acao,linha:e.linha})}return{menuEl:l,possuiAcoes:s,emitExecutar:m}}}),to=["id","aria-labelledby"],ao=["aria-label","title","onClick"],oo={class:"eli-tabela__acoes-item-texto"};function no(e,a,n,l,s,m){return t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[e.menuAberto!==null&&e.possuiAcoes?(t.openBlock(),t.createElementBlock("ul",{key:0,id:`eli-tabela-acoes-menu-${e.menuAberto}`,ref:"menuEl",class:"eli-tabela__acoes-menu",role:"menu","aria-labelledby":`eli-tabela-acoes-toggle-${e.menuAberto}`,style:t.normalizeStyle({position:"fixed",top:`${e.posicao.top}px`,left:`${e.posicao.left}px`,zIndex:999999})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.acoes,o=>(t.openBlock(),t.createElementBlock("li",{key:`acao-${e.menuAberto}-${o.indice}`,class:"eli-tabela__acoes-item",role:"none"},[t.createElementVNode("button",{type:"button",class:"eli-tabela__acoes-item-botao",style:t.normalizeStyle({color:o.acao.cor}),role:"menuitem","aria-label":o.acao.rotulo,title:o.acao.rotulo,onClick:t.withModifiers(r=>e.emitExecutar(o),["stop"])},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.acao.icone),{class:"eli-tabela__acoes-item-icone",size:16,"stroke-width":2})),t.createElementVNode("span",oo,t.toDisplayString(o.acao.rotulo),1)],12,ao)]))),128))],12,to)):t.createCommentVNode("",!0)])}const ro=T(eo,[["render",no]]),lo=t.defineComponent({name:"EliTabelaPaginacao",props:{pagina:{type:Number,required:!0},totalPaginas:{type:Number,required:!0},maximoBotoes:{type:Number,required:!1}},emits:{alterar(e){return Number.isFinite(e)}},setup(e,{emit:a}){const n=t.computed(()=>{const i=e.maximoBotoes;return typeof i=="number"&&i>=5?Math.floor(i):7}),l=t.computed(()=>{const i=e.totalPaginas,d=e.pagina,b=n.value,C=[],v=E=>{C.push({label:String(E),pagina:E,ativo:E===d})},y=()=>{C.push({label:"…",ehEllipsis:!0})};if(i<=b){for(let E=1;E<=i;E+=1)v(E);return C}const c=Math.max(3,b-2);let $=Math.max(2,d-Math.floor(c/2)),g=$+c-1;g>=i&&(g=i-1,$=g-c+1),v(1),$>2&&y();for(let E=$;E<=g;E+=1)v(E);return ge.pagina<=1),o=t.computed(()=>e.pagina>=e.totalPaginas),r=t.computed(()=>e.pagina),u=t.computed(()=>e.totalPaginas);return{botoes:l,irParaPagina:s,anteriorDesabilitado:m,proximaDesabilitada:o,paginaAtual:r,totalPaginasExibidas:u}}}),io={key:0,class:"eli-tabela__paginacao",role:"navigation","aria-label":"Paginação de resultados"},so=["disabled"],co={key:0,class:"eli-tabela__pagina-ellipsis","aria-hidden":"true"},uo=["disabled","aria-current","aria-label","onClick"],mo=["disabled"];function po(e,a,n,l,s,m){return e.totalPaginasExibidas>1?(t.openBlock(),t.createElementBlock("nav",io,[t.createElementVNode("button",{type:"button",class:"eli-tabela__pagina-botao",disabled:e.anteriorDesabilitado,"aria-label":"Página anterior",onClick:a[0]||(a[0]=o=>e.irParaPagina(e.paginaAtual-1))}," << ",8,so),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.botoes,(o,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`${o.label}-${r}`},[o.ehEllipsis?(t.openBlock(),t.createElementBlock("span",co,t.toDisplayString(o.label),1)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["eli-tabela__pagina-botao",o.ativo?"eli-tabela__pagina-botao--ativo":void 0]),disabled:o.ativo,"aria-current":o.ativo?"page":void 0,"aria-label":`Ir para página ${o.label}`,onClick:u=>e.irParaPagina(o.pagina)},t.toDisplayString(o.label),11,uo))],64))),128)),t.createElementVNode("button",{type:"button",class:"eli-tabela__pagina-botao",disabled:e.proximaDesabilitada,"aria-label":"Próxima página",onClick:a[1]||(a[1]=o=>e.irParaPagina(e.paginaAtual+1))}," >> ",8,mo)])):t.createCommentVNode("",!0)}const fo=T(lo,[["render",po]]),Ye="application/x-eli-tabela-coluna",bo=t.defineComponent({name:"EliTabelaModalColunas",props:{aberto:{type:Boolean,required:!0},rotulosColunas:{type:Array,required:!0},configInicial:{type:Object,required:!0},colunas:{type:Array,required:!0}},emits:{fechar(){return!0},salvar(e){return!0}},setup(e,{emit:a}){const n=t.ref([]),l=t.ref([]);function s(){var H,G;const y=e.rotulosColunas,c=(((H=e.configInicial.visiveis)==null?void 0:H.length)??0)>0||(((G=e.configInicial.invisiveis)==null?void 0:G.length)??0)>0,$=new Set(e.colunas.filter(P=>P.visivel===!1).map(P=>P.rotulo)),g=c?new Set(e.configInicial.invisiveis??[]):$,E=y.filter(P=>!g.has(P)),j=e.configInicial.visiveis??[],W=new Set(E),I=[];for(const P of j)W.has(P)&&I.push(P);for(const P of E)I.includes(P)||I.push(P);n.value=I,l.value=y.filter(P=>g.has(P))}t.watch(()=>[e.aberto,e.rotulosColunas,e.configInicial,e.colunas],()=>{e.aberto&&s()},{deep:!0,immediate:!0});function m(){a("fechar")}function o(){a("salvar",{visiveis:[...n.value],invisiveis:[...l.value]})}function r(y,c){var $,g;try{($=y.dataTransfer)==null||$.setData(Ye,JSON.stringify(c)),(g=y.dataTransfer)==null||g.setData("text/plain",c.rotulo),y.dataTransfer.effectAllowed="move"}catch{}}function u(y){var c;try{const $=(c=y.dataTransfer)==null?void 0:c.getData(Ye);if(!$)return null;const g=JSON.parse($);return!g||typeof g.rotulo!="string"||g.origem!=="visiveis"&&g.origem!=="invisiveis"?null:g}catch{return null}}function i(y){const c=y.origem==="visiveis"?n.value:l.value,$=c.indexOf(y.rotulo);$>=0&&c.splice($,1)}function d(y,c,$){const g=y==="visiveis"?n.value:l.value,E=g.indexOf(c);E>=0&&g.splice(E,1),$===null||$<0||$>g.length?g.push(c):g.splice($,0,c)}function b(y,c,$,g){r(y,{rotulo:c,origem:$,index:g})}function C(y,c,$){const g=u(y);if(g)if(i(g),d(c,g.rotulo,$),c==="visiveis"){const E=l.value.indexOf(g.rotulo);E>=0&&l.value.splice(E,1)}else{const E=n.value.indexOf(g.rotulo);E>=0&&n.value.splice(E,1)}}function v(y,c,$){const g=u(y);if(g)if(i(g),d(c,g.rotulo,null),c==="visiveis"){const E=l.value.indexOf(g.rotulo);E>=0&&l.value.splice(E,1)}else{const E=n.value.indexOf(g.rotulo);E>=0&&n.value.splice(E,1)}}return{visiveisLocal:n,invisiveisLocal:l,emitFechar:m,emitSalvar:o,onDragStart:b,onDropItem:C,onDropLista:v}}}),ho={class:"eli-tabela-modal-colunas__modal",role:"dialog","aria-modal":"true","aria-label":"Configurar colunas"},go={class:"eli-tabela-modal-colunas__header"},yo={class:"eli-tabela-modal-colunas__conteudo"},$o={class:"eli-tabela-modal-colunas__coluna"},Eo=["onDragstart","onDrop"],ko={class:"eli-tabela-modal-colunas__item-texto"},Bo={class:"eli-tabela-modal-colunas__coluna"},Co=["onDragstart","onDrop"],vo={class:"eli-tabela-modal-colunas__item-texto"},_o={class:"eli-tabela-modal-colunas__footer"};function Vo(e,a,n,l,s,m){return e.aberto?(t.openBlock(),t.createElementBlock("div",{key:0,class:"eli-tabela-modal-colunas__overlay",role:"presentation",onClick:a[9]||(a[9]=t.withModifiers((...o)=>e.emitFechar&&e.emitFechar(...o),["self"]))},[t.createElementVNode("div",ho,[t.createElementVNode("header",go,[a[10]||(a[10]=t.createElementVNode("h3",{class:"eli-tabela-modal-colunas__titulo"},"Colunas",-1)),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-colunas__fechar","aria-label":"Fechar",onClick:a[0]||(a[0]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," × ")]),t.createElementVNode("div",yo,[t.createElementVNode("div",$o,[a[12]||(a[12]=t.createElementVNode("div",{class:"eli-tabela-modal-colunas__coluna-titulo"},"Visíveis",-1)),t.createElementVNode("div",{class:"eli-tabela-modal-colunas__lista",onDragover:a[2]||(a[2]=t.withModifiers(()=>{},["prevent"])),onDrop:a[3]||(a[3]=o=>e.onDropLista(o,"visiveis",null))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.visiveisLocal,(o,r)=>(t.openBlock(),t.createElementBlock("div",{key:`vis-${o}`,class:"eli-tabela-modal-colunas__item",draggable:"true",onDragstart:u=>e.onDragStart(u,o,"visiveis",r),onDragover:a[1]||(a[1]=t.withModifiers(()=>{},["prevent"])),onDrop:u=>e.onDropItem(u,"visiveis",r)},[a[11]||(a[11]=t.createElementVNode("span",{class:"eli-tabela-modal-colunas__item-handle","aria-hidden":"true"},"⋮⋮",-1)),t.createElementVNode("span",ko,t.toDisplayString(o),1)],40,Eo))),128))],32)]),t.createElementVNode("div",Bo,[a[14]||(a[14]=t.createElementVNode("div",{class:"eli-tabela-modal-colunas__coluna-titulo"},"Invisíveis",-1)),t.createElementVNode("div",{class:"eli-tabela-modal-colunas__lista",onDragover:a[5]||(a[5]=t.withModifiers(()=>{},["prevent"])),onDrop:a[6]||(a[6]=o=>e.onDropLista(o,"invisiveis",null))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.invisiveisLocal,(o,r)=>(t.openBlock(),t.createElementBlock("div",{key:`inv-${o}`,class:"eli-tabela-modal-colunas__item",draggable:"true",onDragstart:u=>e.onDragStart(u,o,"invisiveis",r),onDragover:a[4]||(a[4]=t.withModifiers(()=>{},["prevent"])),onDrop:u=>e.onDropItem(u,"invisiveis",r)},[a[13]||(a[13]=t.createElementVNode("span",{class:"eli-tabela-modal-colunas__item-handle","aria-hidden":"true"},"⋮⋮",-1)),t.createElementVNode("span",vo,t.toDisplayString(o),1)],40,Co))),128))],32)])]),t.createElementVNode("footer",_o,[t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-colunas__botao eli-tabela-modal-colunas__botao--sec",onClick:a[7]||(a[7]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," Cancelar "),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-colunas__botao eli-tabela-modal-colunas__botao--prim",onClick:a[8]||(a[8]=(...o)=>e.emitSalvar&&e.emitSalvar(...o))}," Salvar ")])])])):t.createCommentVNode("",!0)}const So=T(bo,[["render",Vo]]);function Do(e){if(!Number.isFinite(e)||e<=0||e>=1)return 0;const a=e.toString();if(a.includes("e-")){const[,s]=a.split("e-"),m=Number(s);return Number.isFinite(m)?m:0}const n=a.indexOf(".");return n===-1?0:a.slice(n+1).replace(/0+$/,"").length}function No(e){const a=(e??"").trim().replace(/,/g,".");if(!a)return null;const n=Number(a);return Number.isNaN(n)?null:n}function Ve(e,a){return e==null?"":a===null?String(e):Number(e).toFixed(Math.max(0,a)).replace(/\./g,",")}function Re(e){return(e??"").replace(/\D+/g,"")}function Ao(e){const a=(e??"").replace(/[^0-9.,]+/g,""),n=a.match(/[.,]/);if(!n)return a;const l=n[0],s=a.indexOf(l),m=a.slice(0,s).replace(/[.,]/g,""),o=a.slice(s+1).replace(/[.,]/g,"");return`${m.length?m:"0"}${l}${o}`}function Mo(e,a){if(a===null)return e;if(a<=0)return e.replace(/[.,]/g,"");const n=e.match(/[.,]/);if(!n)return e;const l=n[0],s=e.indexOf(l),m=e.slice(0,s),o=e.slice(s+1);return`${m}${l}${o.slice(0,a)}`}function wo(e){const a=e.match(/^(\d+)[.,]$/);if(!a)return null;const n=Number(a[1]);return Number.isNaN(n)?null:n}const To=t.defineComponent({name:"EliEntradaNumero",inheritAttrs:!1,props:{value:{type:[Number,null],default:void 0},opcoes:{type:Object,required:!0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,focus:()=>!0,blur:()=>!0},setup(e,{attrs:a,emit:n}){const l=t.computed(()=>{var d;const i=(d=e.opcoes)==null?void 0:d.precisao;return i==null?null:Do(i)}),s=t.computed(()=>l.value===0),m=t.computed(()=>{const i=l.value;return i!==null&&i>0}),o=t.ref(""),r=t.ref(void 0);t.watch(()=>e.value,i=>{i!==r.value&&(o.value=Ve(i,l.value),r.value=i)},{immediate:!0});function u(i){if(m.value){const v=l.value??0,y=Re(i),c=y?Number(y):0,$=Math.pow(10,v),g=y?c/$:null,E=g===null?null:g;r.value=E,n("update:value",E),n("input",E),n("change",E),o.value=Ve(E,v);return}const d=s.value?Re(i):Ao(i),b=s.value?d:Mo(d,l.value);let C=null;if(b){const y=(s.value?null:wo(b))??No(b);C=y===null?null:y}r.value=C,n("update:value",C),n("input",C),n("change",C),o.value=Ve(C,l.value)}return{attrs:a,emit:n,displayValue:o,isInteiro:s,onUpdateModelValue:u}}}),Po={class:"eli-entrada__prefixo"},Fo={class:"eli-entrada__sufixo"};function Oo(e,a,n,l,s,m){var o,r,u,i;return t.openBlock(),t.createBlock(Ce.VTextField,t.mergeProps({"model-value":e.displayValue,label:(o=e.opcoes)==null?void 0:o.rotulo,placeholder:(r=e.opcoes)==null?void 0:r.placeholder,type:e.isInteiro?"number":"text",inputmode:e.isInteiro?"numeric":"decimal",pattern:e.isInteiro?"[0-9]*":"[0-9.,]*"},e.attrs,{"onUpdate:modelValue":e.onUpdateModelValue,onFocus:a[0]||(a[0]=()=>e.emit("focus")),onBlur:a[1]||(a[1]=()=>e.emit("blur"))}),t.createSlots({_:2},[(u=e.opcoes)!=null&&u.prefixo?{name:"prepend-inner",fn:t.withCtx(()=>[t.createElementVNode("span",Po,t.toDisplayString(e.opcoes.prefixo),1)]),key:"0"}:void 0,(i=e.opcoes)!=null&&i.sufixo?{name:"append-inner",fn:t.withCtx(()=>[t.createElementVNode("span",Fo,t.toDisplayString(e.opcoes.sufixo),1)]),key:"1"}:void 0]),1040,["model-value","label","placeholder","type","inputmode","pattern","onUpdate:modelValue"])}const Se=T(To,[["render",Oo]]),qo=t.defineComponent({name:"EliEntradaDataHora",inheritAttrs:!1,props:{value:{type:String,default:void 0},opcoes:{type:Object,required:!1,default:void 0},modelValue:{type:String,default:null},modo:{type:String,default:void 0},rotulo:{type:String,default:void 0},placeholder:{type:String,default:void 0},desabilitado:{type:Boolean,default:void 0},limpavel:{type:Boolean,default:void 0},erro:{type:Boolean,default:void 0},mensagensErro:{type:[String,Array],default:void 0},dica:{type:String,default:void 0},dicaPersistente:{type:Boolean,default:void 0},densidade:{type:String,default:void 0},variante:{type:String,default:void 0},min:{type:String,default:void 0},max:{type:String,default:void 0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,"update:modelValue":e=>!0,alterar:e=>!0,foco:()=>!0,desfoco:()=>!0,focus:()=>!0,blur:()=>!0},setup(e,{emit:a,attrs:n}){const l=t.computed(()=>e.opcoes?e.opcoes:{rotulo:e.rotulo??"Data e hora",placeholder:e.placeholder??"",modo:e.modo??"dataHora",limpavel:e.limpavel,erro:e.erro,mensagensErro:e.mensagensErro,dica:e.dica,dicaPersistente:e.dicaPersistente,densidade:e.densidade,variante:e.variante,min:e.min,max:e.max}),s=t.computed(()=>l.value.modo??"dataHora"),m=t.computed(()=>!!e.desabilitado),o=t.computed(()=>s.value==="data"?"date":"datetime-local");function r(c){return s.value==="data"?ce(c).format("YYYY-MM-DD"):ce(c).format("YYYY-MM-DDTHH:mm")}function u(c){return s.value==="data"?ce(`${c}T00:00`).format():ce(c).format()}const i=t.computed(()=>e.value!==void 0?e.value??null:e.modelValue),d=t.computed({get:()=>i.value?r(i.value):"",set:c=>{const $=c&&c.length>0?c:null;if(!$){a("update:value",null),a("input",null),a("change",null),a("update:modelValue",null),a("alterar",null);return}const g=u($);a("update:value",g),a("input",g),a("change",g),a("update:modelValue",g),a("alterar",g)}}),b=t.computed(()=>{const c=l.value.min;if(c)return r(c)}),C=t.computed(()=>{const c=l.value.max;if(c)return r(c)});function v(){a("foco"),a("focus")}function y(){a("desfoco"),a("blur")}return{attrs:n,valor:d,tipoInput:o,minLocal:b,maxLocal:C,opcoesEfetivas:l,desabilitadoEfetivo:m,emitCompatFocus:v,emitCompatBlur:y}}}),Io={class:"eli-data-hora"};function Lo(e,a,n,l,s,m){return t.openBlock(),t.createElementBlock("div",Io,[t.createVNode(Ce.VTextField,t.mergeProps({modelValue:e.valor,"onUpdate:modelValue":a[0]||(a[0]=o=>e.valor=o),type:e.tipoInput,label:e.opcoesEfetivas.rotulo,placeholder:e.opcoesEfetivas.placeholder,disabled:e.desabilitadoEfetivo,clearable:!!e.opcoesEfetivas.limpavel,error:!!e.opcoesEfetivas.erro,"error-messages":e.opcoesEfetivas.mensagensErro,hint:e.opcoesEfetivas.dica,"persistent-hint":!!e.opcoesEfetivas.dicaPersistente,density:e.opcoesEfetivas.densidade??"comfortable",variant:e.opcoesEfetivas.variante??"outlined",min:e.minLocal,max:e.maxLocal},e.attrs,{onFocus:e.emitCompatFocus,onBlur:e.emitCompatBlur}),null,16,["modelValue","type","label","placeholder","disabled","clearable","error","error-messages","hint","persistent-hint","density","variant","min","max","onFocus","onBlur"])])}const De=T(qo,[["render",Lo]]),zo=t.defineComponent({name:"EliEntradaParagrafo",components:{VTextarea:ve.VTextarea},inheritAttrs:!1,props:{value:{type:[String,null],default:void 0},opcoes:{type:Object,required:!0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,focus:()=>!0,blur:()=>!0},setup(e,{attrs:a,emit:n}){const l=t.computed({get:()=>e.value,set:s=>{n("update:value",s),n("input",s),n("change",s)}});return{attrs:a,emit:n,localValue:l,opcoes:e.opcoes}}});function jo(e,a,n,l,s,m){var o,r,u,i,d,b,C,v,y,c,$,g;return t.openBlock(),t.createBlock(ot.VTextarea,t.mergeProps({modelValue:e.localValue,"onUpdate:modelValue":a[0]||(a[0]=E=>e.localValue=E),label:(o=e.opcoes)==null?void 0:o.rotulo,placeholder:(r=e.opcoes)==null?void 0:r.placeholder,rows:((u=e.opcoes)==null?void 0:u.linhas)??4,counter:(i=e.opcoes)==null?void 0:i.limiteCaracteres,maxlength:(d=e.opcoes)==null?void 0:d.limiteCaracteres,clearable:!!((b=e.opcoes)!=null&&b.limpavel),error:!!((C=e.opcoes)!=null&&C.erro),"error-messages":(v=e.opcoes)==null?void 0:v.mensagensErro,hint:(y=e.opcoes)==null?void 0:y.dica,"persistent-hint":!!((c=e.opcoes)!=null&&c.dicaPersistente),density:(($=e.opcoes)==null?void 0:$.densidade)??"comfortable",variant:((g=e.opcoes)==null?void 0:g.variante)??"outlined","auto-grow":""},e.attrs,{onFocus:a[1]||(a[1]=()=>e.emit("focus")),onBlur:a[2]||(a[2]=()=>e.emit("blur"))}),null,16,["modelValue","label","placeholder","rows","counter","maxlength","clearable","error","error-messages","hint","persistent-hint","density","variant"])}const Je=T(zo,[["render",jo]]),Ho=t.defineComponent({name:"EliEntradaSelecao",components:{VSelect:ve.VSelect},inheritAttrs:!1,props:{value:{type:[String,null],default:void 0},opcoes:{type:Object,required:!0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,focus:()=>!0,blur:()=>!0},setup(e,{attrs:a,emit:n}){const l=t.ref([]),s=t.ref(!1),m=t.computed({get:()=>e.value,set:r=>{n("update:value",r),n("input",r),n("change",r)}});async function o(){s.value=!0;try{const r=await e.opcoes.itens(),u=Array.isArray(r)?r:[];l.value=[...u]}finally{s.value=!1}}return t.watch(()=>e.opcoes.itens,()=>{o()}),t.onMounted(()=>{o()}),t.watch(l,r=>{console.debug("[EliEntradaSelecao] itens:",r)},{deep:!0}),{attrs:a,emit:n,localValue:m,opcoes:e.opcoes,itens:l,carregando:s}}});function Uo(e,a,n,l,s,m){var o,r,u,i,d,b,C,v,y;return t.openBlock(),t.createBlock(nt.VSelect,t.mergeProps({modelValue:e.localValue,"onUpdate:modelValue":a[0]||(a[0]=c=>e.localValue=c),label:(o=e.opcoes)==null?void 0:o.rotulo,placeholder:(r=e.opcoes)==null?void 0:r.placeholder,items:e.itens,"item-title":"rotulo","item-value":"chave",loading:e.carregando,disabled:e.carregando,"menu-props":{maxHeight:320},clearable:!!((u=e.opcoes)!=null&&u.limpavel),error:!!((i=e.opcoes)!=null&&i.erro),"error-messages":(d=e.opcoes)==null?void 0:d.mensagensErro,hint:(b=e.opcoes)==null?void 0:b.dica,"persistent-hint":!!((C=e.opcoes)!=null&&C.dicaPersistente),density:((v=e.opcoes)==null?void 0:v.densidade)??"comfortable",variant:((y=e.opcoes)==null?void 0:y.variante)??"outlined"},e.attrs,{onFocus:a[1]||(a[1]=()=>e.emit("focus")),onBlur:a[2]||(a[2]=()=>e.emit("blur"))}),null,16,["modelValue","label","placeholder","items","loading","disabled","clearable","error","error-messages","hint","persistent-hint","density","variant"])}const We=T(Ho,[["render",Uo]]);function Yo(e){return e==="texto"||e==="numero"||e==="dataHora"}function Ro(e){var n,l;const a=(l=(n=e==null?void 0:e.entrada)==null?void 0:n[1])==null?void 0:l.rotulo;return String(a||((e==null?void 0:e.coluna)??"Filtro"))}const Jo=t.defineComponent({name:"EliTabelaModalFiltroAvancado",props:{aberto:{type:Boolean,required:!0},filtrosBase:{type:Array,required:!0},modelo:{type:Array,required:!0}},emits:{fechar:()=>!0,limpar:()=>!0,salvar:e=>!0},setup(e,{emit:a}){const n=t.ref([]),l=t.ref(""),s=t.computed(()=>(e.filtrosBase??[]).map(c=>String(c.coluna))),m=t.computed(()=>{const c=new Set(n.value.map($=>String($.coluna)));return(e.filtrosBase??[]).filter($=>!c.has(String($.coluna)))});function o(c){const $=c==null?void 0:c[0];return $==="numero"?Se:$==="dataHora"?De:$e}function r(c){return(c==null?void 0:c[1])??{rotulo:""}}function u(c){return(c==null?void 0:c[0])==="numero"?null:""}function i(){var g;const c=e.filtrosBase??[],$=Array.isArray(e.modelo)?e.modelo:[];n.value=$.map(E=>{const j=c.find(P=>String(P.coluna)===String(E.coluna))??c[0],W=(j==null?void 0:j.entrada)??E.entrada,I=(j==null?void 0:j.coluna)??E.coluna,H=String((j==null?void 0:j.operador)??"="),G=E.valor??u(W);return{coluna:I,operador:H,entrada:W,valor:G}});for(const E of n.value)s.value.includes(String(E.coluna))&&(E.operador=String(((g=c.find(j=>String(j.coluna)===String(E.coluna)))==null?void 0:g.operador)??"="),E.entrada&&!Yo(E.entrada[0])&&(E.entrada=["texto",{rotulo:"Valor"}]))}t.watch(()=>[e.aberto,e.filtrosBase,e.modelo],()=>{e.aberto&&i()},{deep:!0,immediate:!0});function d(){if(!l.value)return;const c=(e.filtrosBase??[]).find($=>String($.coluna)===String(l.value));c&&(n.value.some($=>String($.coluna)===String(c.coluna))||(n.value.push({coluna:c.coluna,entrada:c.entrada,operador:String(c.operador??"="),valor:u(c.entrada)}),l.value=""))}function b(c){n.value.splice(c,1)}function C(){a("fechar")}function v(){a("limpar")}function y(){a("salvar",n.value.map(c=>({coluna:c.coluna,valor:c.valor})))}return{linhas:n,opcoesParaAdicionar:m,colunaParaAdicionar:l,componenteEntrada:o,opcoesEntrada:r,adicionar:d,remover:b,emitFechar:C,emitSalvar:y,emitLimpar:v,rotuloDoFiltro:Ro}}}),Wo={class:"eli-tabela-modal-filtro__modal",role:"dialog","aria-modal":"true","aria-label":"Filtro avançado"},Zo={class:"eli-tabela-modal-filtro__header"},Go={class:"eli-tabela-modal-filtro__conteudo"},Xo={key:0,class:"eli-tabela-modal-filtro__vazio"},Ko={key:1,class:"eli-tabela-modal-filtro__lista"},Qo={class:"eli-tabela-modal-filtro__entrada"},xo=["onClick"],en={class:"eli-tabela-modal-filtro__acoes"},tn=["disabled"],an=["value"],on=["disabled"],nn={class:"eli-tabela-modal-filtro__footer"};function rn(e,a,n,l,s,m){return e.aberto?(t.openBlock(),t.createElementBlock("div",{key:0,class:"eli-tabela-modal-filtro__overlay",role:"presentation",onClick:a[6]||(a[6]=t.withModifiers((...o)=>e.emitFechar&&e.emitFechar(...o),["self"]))},[t.createElementVNode("div",Wo,[t.createElementVNode("header",Zo,[a[7]||(a[7]=t.createElementVNode("h3",{class:"eli-tabela-modal-filtro__titulo"},"Filtro avançado",-1)),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__fechar","aria-label":"Fechar",onClick:a[0]||(a[0]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," × ")]),t.createElementVNode("div",Go,[e.filtrosBase.length?(t.openBlock(),t.createElementBlock("div",Ko,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.linhas,(o,r)=>(t.openBlock(),t.createElementBlock("div",{key:String(o.coluna),class:"eli-tabela-modal-filtro__linha"},[t.createElementVNode("div",Qo,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.componenteEntrada(o.entrada)),{value:o.valor,"onUpdate:value":u=>o.valor=u,opcoes:e.opcoesEntrada(o.entrada),density:"compact"},null,40,["value","onUpdate:value","opcoes"]))]),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__remover",title:"Remover","aria-label":"Remover",onClick:u=>e.remover(r)}," × ",8,xo)]))),128))])):(t.openBlock(),t.createElementBlock("div",Xo," Nenhum filtro configurado na tabela. ")),t.createElementVNode("div",en,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":a[1]||(a[1]=o=>e.colunaParaAdicionar=o),class:"eli-tabela-modal-filtro__select",disabled:!e.opcoesParaAdicionar.length},[a[8]||(a[8]=t.createElementVNode("option",{disabled:"",value:""},"Selecione um filtro…",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.opcoesParaAdicionar,o=>(t.openBlock(),t.createElementBlock("option",{key:String(o.coluna),value:String(o.coluna)},t.toDisplayString(e.rotuloDoFiltro(o)),9,an))),128))],8,tn),[[t.vModelSelect,e.colunaParaAdicionar]]),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao",onClick:a[2]||(a[2]=(...o)=>e.adicionar&&e.adicionar(...o)),disabled:!e.colunaParaAdicionar}," Adicionar ",8,on)])]),t.createElementVNode("footer",nn,[t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--sec",onClick:a[3]||(a[3]=(...o)=>e.emitLimpar&&e.emitLimpar(...o))}," Limpar "),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--sec",onClick:a[4]||(a[4]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," Cancelar "),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--prim",onClick:a[5]||(a[5]=(...o)=>e.emitSalvar&&e.emitSalvar(...o))}," Aplicar ")])])])):t.createCommentVNode("",!0)}const ln=T(Jo,[["render",rn]]),sn="eli:tabela";function Ze(e){return`${sn}:${e}:colunas`}function Ge(e){if(!e||typeof e!="object")return{visiveis:[],invisiveis:[]};const a=e,n=Array.isArray(a.visiveis)?a.visiveis.filter(s=>typeof s=="string"):[],l=Array.isArray(a.invisiveis)?a.invisiveis.filter(s=>typeof s=="string"):[];return{visiveis:n,invisiveis:l}}function Xe(e){try{const a=window.localStorage.getItem(Ze(e));return a?Ge(JSON.parse(a)):{visiveis:[],invisiveis:[]}}catch{return{visiveis:[],invisiveis:[]}}}function cn(e,a){try{window.localStorage.setItem(Ze(e),JSON.stringify(Ge(a)))}catch{}}function Ne(e){return`eli_tabela:${e}:filtro_avancado`}function Ke(e){try{const a=localStorage.getItem(Ne(e));if(!a)return[];const n=JSON.parse(a);return Array.isArray(n)?n:[]}catch{return[]}}function dn(e,a){try{localStorage.setItem(Ne(e),JSON.stringify(a??[]))}catch{}}function un(e){try{localStorage.removeItem(Ne(e))}catch{}}const mn=t.defineComponent({name:"EliTabela",inheritAttrs:!1,components:{EliTabelaCabecalho:Ut,EliTabelaEstados:Xt,EliTabelaDebug:ea,EliTabelaHead:da,EliTabelaBody:xa,EliTabelaMenuAcoes:ro,EliTabelaPaginacao:fo,EliTabelaModalColunas:So,EliTabelaModalFiltroAvancado:ln},props:{tabela:{type:Object,required:!0}},setup(e){const n=t.ref(!1),l=t.ref(null),s=t.ref([]),m=t.ref(0),o=t.ref([]),r=t.ref(null),u=t.ref(null),i=t.ref({top:0,left:0}),d=t.ref(""),b=t.ref(1),C=t.ref(null),v=t.ref("asc"),y=t.ref(!1),c=t.ref(Ke(e.tabela.nome));function $(){y.value=!0}function g(){y.value=!1}function E(){c.value=[],un(e.tabela.nome),y.value=!1,d.value="",b.value!==1?b.value=1:re()}function j(B){c.value=B??[],dn(e.tabela.nome,B??[]),y.value=!1,d.value="",b.value!==1?b.value=1:re()}const W=t.computed(()=>{const B=e.tabela.filtroAvancado??[];return(c.value??[]).filter(N=>N&&N.coluna!==void 0).map(N=>{const F=B.find(O=>String(O.coluna)===String(N.coluna));return F?{coluna:String(F.coluna),operador:F.operador,valor:N.valor}:null}).filter(Boolean)}),I=t.computed(()=>e.tabela),H=t.computed(()=>!!e.tabela.mostrarCaixaDeBusca),G=t.computed(()=>e.tabela.acoesTabela??[]),P=t.computed(()=>G.value.length>0),ae=t.ref(!1),A=t.ref(Xe(e.tabela.nome)),D=t.ref({}),me=t.computed(()=>e.tabela.colunas.map(B=>B.rotulo)),he=t.computed(()=>{var Z,K;const B=e.tabela.colunas,F=(((Z=A.value.visiveis)==null?void 0:Z.length)??0)>0||(((K=A.value.invisiveis)==null?void 0:K.length)??0)>0?A.value.invisiveis??[]:B.filter(z=>z.visivel===!1).map(z=>z.rotulo),O=new Set(F),ee=B.filter(z=>O.has(z.rotulo)),Q=F,le=new Map;for(const z of ee)le.has(z.rotulo)||le.set(z.rotulo,z);const R=[];for(const z of Q){const te=le.get(z);te&&R.push(te)}for(const z of ee)R.includes(z)||R.push(z);return R}),_=t.computed(()=>he.value.length>0),h=t.computed(()=>{var z,te;const B=e.tabela.colunas,N=me.value,F=(((z=A.value.visiveis)==null?void 0:z.length)??0)>0||(((te=A.value.invisiveis)==null?void 0:te.length)??0)>0,O=F?A.value.invisiveis??[]:e.tabela.colunas.filter(q=>q.visivel===!1).map(q=>q.rotulo),ee=new Set(O),Q=N.filter(q=>!ee.has(q)),le=new Set(Q),R=F?A.value.visiveis??[]:[],Z=[];for(const q of R)le.has(q)&&Z.push(q);for(const q of Q)Z.includes(q)||Z.push(q);const K=new Map;for(const q of B)K.has(q.rotulo)||K.set(q.rotulo,q);return Z.map(q=>K.get(q)).filter(Boolean)});function p(){ae.value=!0}function k(){ae.value=!1}function f(B){A.value=B,cn(e.tabela.nome,B),ae.value=!1,D.value={}}function S(B){const N=!!D.value[B];D.value={...D.value,[B]:!N}}const V=t.computed(()=>{const B=e.tabela.registros_por_consulta;return typeof B=="number"&&B>0?Math.floor(B):10}),M=t.computed(()=>{const B=V.value;if(!B||B<=0)return 1;const N=m.value??0;return N?Math.max(1,Math.ceil(N/B)):1}),L=t.computed(()=>s.value??[]),U=t.computed(()=>m.value??0),Y=t.computed(()=>(e.tabela.acoesLinha??[]).length>0),X=t.computed(()=>(e.tabela.filtroAvancado??[]).length>0);let x=0;function oe(B){var R,Z,K,z,te,q;const N=B.getBoundingClientRect(),F=8,O=((K=(Z=(R=u.value)==null?void 0:R.menuEl)==null?void 0:Z.value)==null?void 0:K.offsetHeight)??0,ee=((q=(te=(z=u.value)==null?void 0:z.menuEl)==null?void 0:te.value)==null?void 0:q.offsetWidth)??180;let Q=N.bottom+F;const le=N.right-ee;O&&Q+O>window.innerHeight-F&&(Q=N.top-F-O),i.value={top:Math.max(F,Math.round(Q)),left:Math.max(F,Math.round(le))}}function de(B){var F,O;if(r.value===null)return;const N=B.target;(O=(F=u.value)==null?void 0:F.menuEl)!=null&&O.value&&u.value.menuEl.value.contains(N)||(r.value=null)}function ie(B){if(B){if(C.value===B){v.value=v.value==="asc"?"desc":"asc",re();return}C.value=B,v.value="asc",b.value!==1?b.value=1:re()}}function J(B){d.value!==B&&(d.value=B,b.value!==1?b.value=1:re())}function ne(B){const N=Math.min(Math.max(1,B),M.value);N!==b.value&&(b.value=N)}function ue(B){const N=e.tabela.acoesLinha??[],F=o.value[B]??[];return N.map((O,ee)=>{const Q=O.exibir===void 0?!0:typeof O.exibir=="boolean"?O.exibir:!1;return{acao:O,indice:ee,visivel:F[ee]??Q}}).filter(O=>O.visivel)}function pe(B){return ue(B).length>0}function yn(B,N){if(!pe(B))return;if(r.value===B){r.value=null;return}r.value=B;const F=(N==null?void 0:N.currentTarget)??null;F&&(oe(F),requestAnimationFrame(()=>oe(F)))}async function re(){var Q,le;const B=++x;n.value=!0,l.value=null,o.value=[],r.value=null,D.value={};const N=Math.max(1,V.value),O={offSet:(b.value-1)*N,limit:N},ee=(d.value??"").trim();if(ee)O.texto_busca=ee;else{const R=W.value;R.length&&(O.filtros=R)}C.value&&(O.coluna_ordem=C.value,O.direcao_ordem=v.value);try{const R=e.tabela,Z=await R.consulta(O);if(B!==x)return;if(Z.cod!==Te.sucesso){s.value=[],m.value=0,l.value=Z.mensagem;return}const K=((Q=Z.valor)==null?void 0:Q.valores)??[],z=((le=Z.valor)==null?void 0:le.quantidade)??K.length;s.value=K,m.value=Number(z)||0;const te=Math.max(1,Math.ceil((m.value||0)/N));b.value>te&&(b.value=te);const q=R.acoesLinha??[];if(!q.length){o.value=[];return}const $n=K.map(()=>q.map(ge=>ge.exibir===void 0?!0:typeof ge.exibir=="boolean"?ge.exibir:!1));o.value=$n;const En=await Promise.all(K.map(async ge=>Promise.all(q.map(async Be=>{if(Be.exibir===void 0)return!0;if(typeof Be.exibir=="boolean")return Be.exibir;try{const kn=Be.exibir(ge);return!!await Promise.resolve(kn)}catch{return!1}}))));B===x&&(o.value=En)}catch(R){if(B!==x)return;s.value=[],m.value=0,l.value=R instanceof Error?R.message:"Erro ao carregar dados."}finally{B===x&&(n.value=!1)}}return t.onMounted(()=>{document.addEventListener("click",de),re()}),t.onBeforeUnmount(()=>{document.removeEventListener("click",de)}),t.watch(()=>e.tabela.mostrarCaixaDeBusca,B=>{!B&&d.value&&(d.value="",b.value!==1?b.value=1:re())}),t.watch(b,(B,N)=>{B!==N&&re()}),t.watch(()=>e.tabela,()=>{r.value=null,C.value=null,v.value="asc",d.value="",ae.value=!1,y.value=!1,A.value=Xe(e.tabela.nome),c.value=Ke(e.tabela.nome),D.value={},b.value!==1?b.value=1:re()}),t.watch(()=>e.tabela.registros_por_consulta,()=>{b.value!==1?b.value=1:re()}),t.watch(s,()=>{r.value=null,D.value={}}),{isDev:!1,tabela:I,carregando:n,erro:l,linhas:s,linhasPaginadas:L,filtrosAvancadosAtivos:W,quantidadeFiltrada:U,quantidade:m,menuAberto:r,valorBusca:d,paginaAtual:b,colunaOrdenacao:C,direcaoOrdenacao:v,totalPaginas:M,registrosPorConsulta:V,exibirBusca:H,exibirFiltroAvancado:X,acoesCabecalho:G,temAcoesCabecalho:P,temAcoes:Y,colunasEfetivas:h,rotulosColunas:me,modalColunasAberto:ae,configColunas:A,temColunasInvisiveis:_,colunasInvisiveisEfetivas:he,linhasExpandidas:D,abrirModalColunas:p,abrirModalFiltro:$,fecharModalColunas:k,salvarModalColunas:f,modalFiltroAberto:y,filtrosUi:c,salvarFiltrosAvancados:j,limparFiltrosAvancados:E,fecharModalFiltro:g,alternarLinhaExpandida:S,alternarOrdenacao:ie,atualizarBusca:J,irParaPagina:ne,acoesDisponiveisPorLinha:ue,possuiAcoes:pe,toggleMenu:yn,menuPopup:u,menuPopupPos:i}}}),pn={class:"eli-tabela"},fn={class:"eli-tabela__table"};function bn(e,a,n,l,s,m){const o=t.resolveComponent("EliTabelaDebug"),r=t.resolveComponent("EliTabelaEstados"),u=t.resolveComponent("EliTabelaCabecalho"),i=t.resolveComponent("EliTabelaModalColunas"),d=t.resolveComponent("EliTabelaModalFiltroAvancado"),b=t.resolveComponent("EliTabelaHead"),C=t.resolveComponent("EliTabelaBody"),v=t.resolveComponent("EliTabelaMenuAcoes"),y=t.resolveComponent("EliTabelaPaginacao");return t.openBlock(),t.createElementBlock("div",pn,[t.createVNode(o,{isDev:e.isDev,menuAberto:e.menuAberto,menuPopupPos:e.menuPopupPos},{default:t.withCtx(()=>[t.createElementVNode("div",null,"paginaAtual: "+t.toDisplayString(e.paginaAtual),1),t.createElementVNode("div",null,"limit: "+t.toDisplayString(e.registrosPorConsulta),1),t.createElementVNode("div",null,"texto_busca: "+t.toDisplayString((e.valorBusca||"").trim()),1),t.createElementVNode("div",null,"filtrosAvancadosAtivos: "+t.toDisplayString(JSON.stringify(e.filtrosAvancadosAtivos)),1),t.createElementVNode("div",null,"quantidadeTotal: "+t.toDisplayString(e.quantidade),1)]),_:1},8,["isDev","menuAberto","menuPopupPos"]),e.carregando||e.erro||!e.linhas.length?(t.openBlock(),t.createBlock(r,{key:0,carregando:e.carregando,erro:e.erro,mensagemVazio:e.tabela.mensagemVazio},null,8,["carregando","erro","mensagemVazio"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.exibirBusca||e.temAcoesCabecalho?(t.openBlock(),t.createBlock(u,{key:0,exibirBusca:e.exibirBusca,exibirBotaoFiltroAvancado:e.exibirFiltroAvancado,valorBusca:e.valorBusca,acoesCabecalho:e.acoesCabecalho,onBuscar:e.atualizarBusca,onColunas:e.abrirModalColunas,onFiltroAvancado:e.abrirModalFiltro},null,8,["exibirBusca","exibirBotaoFiltroAvancado","valorBusca","acoesCabecalho","onBuscar","onColunas","onFiltroAvancado"])):t.createCommentVNode("",!0),t.createVNode(i,{aberto:e.modalColunasAberto,rotulosColunas:e.rotulosColunas,configInicial:e.configColunas,colunas:e.tabela.colunas,onFechar:e.fecharModalColunas,onSalvar:e.salvarModalColunas},null,8,["aberto","rotulosColunas","configInicial","colunas","onFechar","onSalvar"]),t.createVNode(d,{aberto:e.modalFiltroAberto,filtrosBase:e.tabela.filtroAvancado??[],modelo:e.filtrosUi,onFechar:e.fecharModalFiltro,onLimpar:e.limparFiltrosAvancados,onSalvar:e.salvarFiltrosAvancados},null,8,["aberto","filtrosBase","modelo","onFechar","onLimpar","onSalvar"]),t.createElementVNode("table",fn,[t.createVNode(b,{colunas:e.colunasEfetivas,temAcoes:e.temAcoes,temColunasInvisiveis:e.temColunasInvisiveis,colunaOrdenacao:e.colunaOrdenacao,direcaoOrdenacao:e.direcaoOrdenacao,onAlternarOrdenacao:e.alternarOrdenacao},null,8,["colunas","temAcoes","temColunasInvisiveis","colunaOrdenacao","direcaoOrdenacao","onAlternarOrdenacao"]),t.createVNode(C,{colunas:e.colunasEfetivas,colunasInvisiveis:e.colunasInvisiveisEfetivas,temColunasInvisiveis:e.temColunasInvisiveis,linhasExpandidas:e.linhasExpandidas,linhas:e.linhasPaginadas,temAcoes:e.temAcoes,menuAberto:e.menuAberto,possuiAcoes:e.possuiAcoes,toggleMenu:e.toggleMenu,alternarLinhaExpandida:e.alternarLinhaExpandida},null,8,["colunas","colunasInvisiveis","temColunasInvisiveis","linhasExpandidas","linhas","temAcoes","menuAberto","possuiAcoes","toggleMenu","alternarLinhaExpandida"])]),t.createVNode(v,{ref:"menuPopup",menuAberto:e.menuAberto,posicao:e.menuPopupPos,acoes:e.menuAberto===null?[]:e.acoesDisponiveisPorLinha(e.menuAberto),linha:e.menuAberto===null?null:e.linhasPaginadas[e.menuAberto],onExecutar:a[0]||(a[0]=({acao:c,linha:$})=>{e.menuAberto=null,c.acao($)})},null,8,["menuAberto","posicao","acoes","linha"]),e.totalPaginas>1&&e.quantidadeFiltrada>0?(t.openBlock(),t.createBlock(y,{key:1,pagina:e.paginaAtual,totalPaginas:e.totalPaginas,maximoBotoes:e.tabela.maximo_botoes_paginacao,onAlterar:e.irParaPagina},null,8,["pagina","totalPaginas","maximoBotoes","onAlterar"])):t.createCommentVNode("",!0)],64))])}const Qe=T(mn,[["render",bn]]),hn=(e,a)=>[e,a],gn={install(e){e.component("EliOlaMundo",Me),e.component("EliBotao",_e),e.component("EliBadge",ye),e.component("EliCartao",we),e.component("EliTabela",Qe),e.component("EliEntradaTexto",$e),e.component("EliEntradaNumero",Se),e.component("EliEntradaDataHora",De),e.component("EliEntradaParagrafo",Je),e.component("EliEntradaSelecao",We)}};w.EliBadge=ye,w.EliBotao=_e,w.EliCartao=we,w.EliEntradaDataHora=De,w.EliEntradaNumero=Se,w.EliEntradaParagrafo=Je,w.EliEntradaSelecao=We,w.EliEntradaTexto=$e,w.EliOlaMundo=Me,w.EliTabela=Qe,w.celulaTabela=hn,w.default=gn,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));