(function(w,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("vuetify/components/VBtn"),require("vuetify/components/VBadge"),require("vuetify/components/VCheckbox"),require("vuetify/components/VIcon"),require("vuetify/components/VRadio"),require("vuetify/components/VRadioGroup"),require("vuetify/components/VSelect"),require("vuetify/components/VTextField"),require("vuetify/components/VTextarea"),require("vuetify/components/VCard"),require("vuetify/components/VGrid")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/components/VBtn","vuetify/components/VBadge","vuetify/components/VCheckbox","vuetify/components/VIcon","vuetify/components/VRadio","vuetify/components/VRadioGroup","vuetify/components/VSelect","vuetify/components/VTextField","vuetify/components/VTextarea","vuetify/components/VCard","vuetify/components/VGrid"],t):(w=typeof globalThis<"u"?globalThis:w||self,t(w.eli_vue={},w.Vue,w.VBtn,w.VBadge,w.VCheckbox,w.VIcon,w.VRadio,w.VRadioGroup,w.VSelect,w.VTextField,w.VTextarea,w.VCard,w.VGrid))})(this,(function(w,t,Be,Ve,Ce,Ee,Se,we,Ae,se,Me,Y,_e){"use strict";const De=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 d=e.__vccOpts||e;for(const[s,m]of a)d[s]=m;return d};function Ne(e,a,d,s,m,p){return t.openBlock(),t.createBlock(Be.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 ne=T(De,[["render",Ne]]),ce={suave:"4px",pill:"10px"},Te=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 ce?ce[e.radius]:e.radius),d=t.computed(()=>e.dot||e.badge!==void 0?e.visible:!1),s=t.computed(()=>({"--eli-badge-radius":a.value}));return{showBadge:d,badgeStyle:s}}});function Pe(e,a,d,s,m,p){return e.showBadge?(t.openBlock(),t.createBlock(Ve.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",{},void 0,!0)]),_:3},16,["color","location","offset-x","offset-y","dot","content","style"])):t.renderSlot(e.$slots,"default",{key:1},void 0,!0)}const Q=T(Te,[["render",Pe],["__scopeId","data-v-371c8db4"]]);function Oe(e){return e.replace(/\D+/g,"")}function qe(e){const a=Oe(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 Ie(e){return e.replace(/\D+/g,"")}function ze(e){const a=Ie(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 re(e){return e.replace(/\D+/g,"")}function de(e){const a=e.replace(/[^\d,]/g,""),d=a.split(",");return d.length>2?d[0]+","+d.slice(1).join(""):a}function Le(e){return de(e.replace(/%/g,""))}function Fe(e){const a=re(e);return a?(parseInt(a,10)/100).toFixed(2).replace(".",",").replace(/\B(?=(\d{3})+(?!\d))/g,"."):""}function Ue(e){const a=re(e).slice(0,8);return a.length<=5?a:a.replace(/^(\d{5})(\d{1,3})$/,"$1-$2")}const je=t.defineComponent({name:"EliInput",inheritAttrs:!1,props:{modelValue:{type:[String,Number,Boolean,Array],default:""},type:{type:String,default:"text"},label:String,placeholder:String,disabled:Boolean,error:Boolean,errorMessages:{type:[String,Array],default:()=>[]},hint:String,persistentHint:Boolean,rows:{type:Number,default:4},options:{type:Array,default:()=>[]},clearable:Boolean,variant:{type:String,default:"outlined"},density:{type:String,default:"comfortable"},color:{type:String,default:"primary"},row:Boolean,showPasswordToggle:Boolean,multiple:Boolean,chips:Boolean},emits:["update:modelValue","change","focus","blur"],setup(e,{emit:a,attrs:d}){const s=t.ref(!1),m=t.ref(!1),p=t.computed({get:()=>e.modelValue,set:$=>{a("update:modelValue",$),a("change",$)}}),l=t.computed(()=>["text","password","email","search","url","telefone","cpfCnpj","numericoInteiro","numericoDecimal","numericoMoeda","porcentagem","cep"].includes(e.type)),c=t.computed(()=>e.type==="password"?m.value?"text":"password":"text"),k=t.computed(()=>{if(e.type==="telefone")return"tel";if(e.type==="porcentagem")return"decimal";if(e.type.startsWith("numerico"))return"numeric"}),r=t.computed(()=>e.error?"error":s.value?e.color:void 0);function y($){const D=$.target;let C=D.value;switch(e.type){case"numericoInteiro":C=re(C);break;case"numericoDecimal":C=de(C);break;case"numericoMoeda":C=Fe(C);break;case"porcentagem":C=Le(C);break;case"telefone":C=ze(C);break;case"cpfCnpj":C=qe(C);break;case"cep":C=Ue(C);break}D.value=C,a("update:modelValue",C),a("change",C)}function g(){m.value=!m.value}const M=t.computed(()=>(e.options||[]).map($=>{if($&&typeof $=="object"&&"value"in $){const C=$.value;return{label:$.label??String(C),value:C,disabled:$.disabled}}const D=$;return{label:String(D),value:D}}));return{attrs:d,value:p,isTextLike:l,inputHtmlType:c,inputMode:k,internalColor:r,showPassword:m,togglePassword:g,onInput:y,onFocus:()=>a("focus"),onBlur:()=>a("blur"),computedItems:M}}}),He={class:"eli-input"},Ye={key:4,class:"checkbox-group"};function Re(e,a,d,s,m,p){return t.openBlock(),t.createElementBlock("div",He,[e.isTextLike?(t.openBlock(),t.createBlock(se.VTextField,t.mergeProps({key:0,modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=l=>e.value=l),type:e.inputHtmlType,label:e.label,placeholder:e.placeholder,disabled:e.disabled,clearable:e.clearable&&e.type!=="password",error:e.error,"error-messages":e.errorMessages,hint:e.hint,"persistent-hint":e.persistentHint,density:e.density,variant:e.variant,color:e.internalColor,inputmode:e.inputMode,suffix:e.type==="porcentagem"?"%":void 0},e.attrs,{onFocus:e.onFocus,onBlur:e.onBlur,onInput:e.onInput}),t.createSlots({_:2},[e.type==="password"&&e.showPasswordToggle?{name:"append-inner",fn:t.withCtx(()=>[t.createVNode(Ee.VIcon,{class:"cursor-pointer",onClick:e.togglePassword},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.showPassword?"mdi-eye-off":"mdi-eye"),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1040,["modelValue","type","label","placeholder","disabled","clearable","error","error-messages","hint","persistent-hint","density","variant","color","inputmode","suffix","onFocus","onBlur","onInput"])):e.type==="textarea"?(t.openBlock(),t.createBlock(Me.VTextarea,t.mergeProps({key:1,modelValue:e.value,"onUpdate:modelValue":a[1]||(a[1]=l=>e.value=l),label:e.label,rows:e.rows,density:e.density,variant:e.variant},e.attrs),null,16,["modelValue","label","rows","density","variant"])):e.type==="select"?(t.openBlock(),t.createBlock(Ae.VSelect,t.mergeProps({key:2,modelValue:e.value,"onUpdate:modelValue":a[2]||(a[2]=l=>e.value=l),items:e.computedItems,label:e.label,placeholder:e.placeholder,multiple:e.multiple,chips:e.chips,clearable:e.clearable,disabled:e.disabled,density:e.density,variant:e.variant,"item-title":"label","item-value":"value",error:e.error,"error-messages":e.errorMessages},e.attrs,{onFocus:e.onFocus,onBlur:e.onBlur}),null,16,["modelValue","items","label","placeholder","multiple","chips","clearable","disabled","density","variant","error","error-messages","onFocus","onBlur"])):e.type==="radio"?(t.openBlock(),t.createBlock(we.VRadioGroup,{key:3,modelValue:e.value,"onUpdate:modelValue":a[3]||(a[3]=l=>e.value=l),row:e.row},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.computedItems,l=>(t.openBlock(),t.createBlock(Se.VRadio,{key:String(l.value),label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","row"])):e.type==="checkbox"?(t.openBlock(),t.createElementBlock("div",Ye,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.computedItems,l=>(t.openBlock(),t.createBlock(Ce.VCheckbox,{key:String(l.value),modelValue:e.value,"onUpdate:modelValue":a[4]||(a[4]=c=>e.value=c),label:l.label,value:l.value,density:e.density},null,8,["modelValue","label","value","density"]))),128))])):t.createCommentVNode("",!0)])}const le=T(je,[["render",Re],["__scopeId","data-v-756cb549"]]),We=t.defineComponent({name:"EliOlaMundo",components:{EliBotao:ne,EliBadge:Q,EliInput:le},setup(){const e=t.ref(""),a=t.ref([]),d=t.ref(""),s=t.ref(""),m=t.ref(""),p=t.ref(""),l=t.ref(""),c=t.ref(""),k=t.ref(""),r=t.ref(""),y=t.ref(""),g=t.ref(null),M=t.ref([]);return{nome:e,email:c,documento:y,estado:a,telefone:s,mensagem:k,senha:r,cor:g,habilidades:M,idade:m,altura:p,cep:d,valor:l}}}),ve={class:"grid-example"};function Ge(e,a,d,s,m,p){const l=t.resolveComponent("EliBadge"),c=t.resolveComponent("EliInput"),k=t.resolveComponent("EliBotao");return t.openBlock(),t.createBlock(_e.VContainer,null,{default:t.withCtx(()=>[t.createVNode(Y.VCard,{class:"mx-auto",max_width:"400"},{default:t.withCtx(()=>[t.createVNode(Y.VCardTitle,null,{default:t.withCtx(()=>[t.createVNode(l,{badge:"Novo","offset-x":"-15",location:"right center"},{default:t.withCtx(()=>[...a[14]||(a[14]=[t.createTextVNode(" Olá Mundo! ",-1)])]),_:1})]),_:1}),t.createVNode(Y.VCardText,null,{default:t.withCtx(()=>[a[15]||(a[15]=t.createTextVNode(" Este é um componente de exemplo integrado com Vuetify. ",-1)),t.createElementVNode("div",ve,[t.createVNode(c,{modelValue:e.nome,"onUpdate:modelValue":a[0]||(a[0]=r=>e.nome=r),label:"Nome",placeholder:"Digite o nome",density:"compact"},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.idade,"onUpdate:modelValue":a[1]||(a[1]=r=>e.idade=r),type:"numericoInteiro",label:"Idade",density:"default"},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.altura,"onUpdate:modelValue":a[2]||(a[2]=r=>e.altura=r),type:"numericoDecimal",label:"Altura",density:"comfortable"},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.valor,"onUpdate:modelValue":a[3]||(a[3]=r=>e.valor=r),type:"numericoMoeda",label:"Valor"},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.telefone,"onUpdate:modelValue":a[4]||(a[4]=r=>e.telefone=r),type:"telefone",label:"Telefone"},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.cep,"onUpdate:modelValue":a[5]||(a[5]=r=>e.cep=r),type:"cep",label:"CEP",placeholder:"00000-000"},null,8,["modelValue"]),t.createVNode(c,{type:"select",label:"Estado",options:[{label:"São Paulo",value:"SP"},{label:"Rio de Janeiro",value:"RJ"}],modelValue:e.estado,"onUpdate:modelValue":a[6]||(a[6]=r=>e.estado=r),multiple:""},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.documento,"onUpdate:modelValue":a[7]||(a[7]=r=>e.documento=r),type:"cpfCnpj",label:"CPF / CNPJ"},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.email,"onUpdate:modelValue":a[8]||(a[8]=r=>e.email=r),label:"Email",placeholder:"email@exemplo.com"},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.senha,"onUpdate:modelValue":a[9]||(a[9]=r=>e.senha=r),label:"Senha",type:"password",showPasswordToggle:!0,placeholder:"Digite sua senha"},null,8,["modelValue"]),t.createVNode(c,{type:"textarea",modelValue:e.mensagem,"onUpdate:modelValue":a[10]||(a[10]=r=>e.mensagem=r),label:"Mensagem",rows:5},null,8,["modelValue"]),t.createVNode(c,{type:"radio",modelValue:e.cor,"onUpdate:modelValue":a[11]||(a[11]=r=>e.cor=r),label:"Cor favorita",options:[{label:"Azul",value:"azul"},{label:"Verde",value:"verde"}]},null,8,["modelValue"]),t.createVNode(c,{type:"checkbox",modelValue:e.habilidades,"onUpdate:modelValue":a[12]||(a[12]=r=>e.habilidades=r),options:[{label:"Vue",value:"vue"},{label:"React",value:"react"}]},null,8,["modelValue"]),t.createVNode(c,{modelValue:e.nome,"onUpdate:modelValue":a[13]||(a[13]=r=>e.nome=r),label:"Nome",error:!0,"error-messages":["Obrigatório"]},null,8,["modelValue"])])]),_:1}),t.createVNode(Y.VCardActions,null,{default:t.withCtx(()=>[t.createVNode(k,{color:"primary",variant:"elevated",block:""},{default:t.withCtx(()=>[...a[16]||(a[16]=[t.createTextVNode(" Botão Vuetify ",-1)])]),_:1})]),_:1})]),_:1})]),_:1})}const ue=T(We,[["render",Ge]]),Je=t.defineComponent({name:"EliCartao",components:{EliBadge:Q},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 d=t.computed(()=>e.status),s=t.computed(()=>{switch(e.status){case"novo":return"primary";case"rascunho":return"secondary";case"vendido":return"success";case"cancelado":return"error"}}),m=t.computed(()=>`eli-cartao--${e.status}`);function p(){a("clicar",e.status)}return{rotuloStatus:d,corStatus:s,classeStatus:m,onClick:p}}}),Ze={class:"eli-cartao__titulo-texto"},Xe={class:"eli-cartao__status"};function Ke(e,a,d,s,m,p){const l=t.resolveComponent("EliBadge");return t.openBlock(),t.createBlock(Y.VCard,t.mergeProps({class:["eli-cartao",e.classeStatus],variant:e.variant},e.$attrs),{default:t.withCtx(()=>[t.createVNode(Y.VCardTitle,{class:"eli-cartao__titulo"},{default:t.withCtx(()=>[t.createElementVNode("div",Ze,[t.renderSlot(e.$slots,"titulo",{},()=>[t.createTextVNode(t.toDisplayString(e.titulo),1)],!0)]),t.createElementVNode("div",Xe,[t.createVNode(l,{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(Y.VCardText,{class:"eli-cartao__conteudo"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,!0)]),_:3}),e.$slots.acoes?(t.openBlock(),t.createBlock(Y.VCardActions,{key:0,class:"eli-cartao__acoes"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"acoes",{},void 0,!0)]),_:3})):t.createCommentVNode("",!0)]),_:3},16,["variant","class"])}const me=T(Je,[["render",Ke],["__scopeId","data-v-6c492bd9"]]);function Qe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x={exports:{}},xe=x.exports,pe;function et(){return pe||(pe=1,(function(e,a){(function(d,s){e.exports=s()})(xe,(function(){var d=1e3,s=6e4,m=36e5,p="millisecond",l="second",c="minute",k="hour",r="day",y="week",g="month",M="quarter",$="year",D="date",C="Invalid Date",j=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,H=/\[([^\]]+)]|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,O={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(f){var o=["th","st","nd","rd"],n=f%100;return"["+f+(o[(n-20)%10]||o[n]||o[0])+"]"}},v=function(f,o,n){var u=String(f);return!u||u.length>=o?f:""+Array(o+1-u.length).join(n)+f},ie={s:v,z:function(f){var o=-f.utcOffset(),n=Math.abs(o),u=Math.floor(n/60),i=n%60;return(o<=0?"+":"-")+v(u,2,"0")+":"+v(i,2,"0")},m:function f(o,n){if(o.date()1)return f(b[0])}else{var B=o.name;F[B]=o,i=B}return!u&&i&&(L=i),i||!u&&L},_=function(f,o){if(X(f))return f.clone();var n=typeof o=="object"?o:{};return n.date=f,n.args=arguments,new R(n)},V=ie;V.l=G,V.i=X,V.w=function(f,o){return _(f,{locale:o.$L,utc:o.$u,x:o.$x,$offset:o.$offset})};var R=(function(){function f(n){this.$L=G(n.locale,null,!0),this.parse(n),this.$x=this.$x||n.x||{},this[Z]=!0}var o=f.prototype;return o.parse=function(n){this.$d=(function(u){var i=u.date,h=u.utc;if(i===null)return new Date(NaN);if(V.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var b=i.match(j);if(b){var B=b[2]-1||0,E=(b[7]||"0").substring(0,3);return h?new Date(Date.UTC(b[1],B,b[3]||1,b[4]||0,b[5]||0,b[6]||0,E)):new Date(b[1],B,b[3]||1,b[4]||0,b[5]||0,b[6]||0,E)}}return new Date(i)})(n),this.init()},o.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},o.$utils=function(){return V},o.isValid=function(){return this.$d.toString()!==C},o.isSame=function(n,u){var i=_(n);return this.startOf(u)<=i&&i<=this.endOf(u)},o.isAfter=function(n,u){return _(n)[]},dica:{type:String,default:""},dicaPersistente:{type:Boolean,default:!1},densidade:{type:String,default:"comfortable"},variante:{type:String,default:"outlined"},min:{type:String,default:void 0},max:{type:String,default:void 0}},emits:{"update:modelValue":e=>!0,alterar:e=>!0,foco:()=>!0,desfoco:()=>!0},setup(e,{emit:a,attrs:d}){const s=t.computed(()=>e.modo==="data"?"date":"datetime-local");function m(r){return e.modo==="data"?ee(r).format("YYYY-MM-DD"):ee(r).format("YYYY-MM-DDTHH:mm")}function p(r){return e.modo==="data"?ee(`${r}T00:00`).format():ee(r).format()}const l=t.computed({get:()=>e.modelValue?m(e.modelValue):"",set:r=>{const y=r&&r.length>0?r:null;if(!y){a("update:modelValue",null),a("alterar",null);return}const g=p(y);a("update:modelValue",g),a("alterar",g)}}),c=t.computed(()=>{if(e.min)return m(e.min)}),k=t.computed(()=>{if(e.max)return m(e.max)});return{attrs:d,valor:l,emit:a,minLocal:c,maxLocal:k,tipoInput:s}}}),ot={class:"eli-data-hora"};function nt(e,a,d,s,m,p){return t.openBlock(),t.createElementBlock("div",ot,[t.createVNode(se.VTextField,t.mergeProps({modelValue:e.valor,"onUpdate:modelValue":a[0]||(a[0]=l=>e.valor=l),type:e.tipoInput,label:e.rotulo,placeholder:e.placeholder,disabled:e.desabilitado,clearable:e.limpavel,error:e.erro,"error-messages":e.mensagensErro,hint:e.dica,"persistent-hint":e.dicaPersistente,density:e.densidade,variant:e.variante,min:e.minLocal,max:e.maxLocal},e.attrs,{onFocus:a[1]||(a[1]=l=>e.emit("foco")),onBlur:a[2]||(a[2]=l=>e.emit("desfoco"))}),null,16,["modelValue","type","label","placeholder","disabled","clearable","error","error-messages","hint","persistent-hint","density","variant","min","max"])])}const fe=T(at,[["render",nt],["__scopeId","data-v-71afabb6"]]);var be=(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))(be||{});/** * @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 rt=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 he=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 lt=(...e)=>e.filter((a,d,s)=>!!a&&a.trim()!==""&&s.indexOf(a)===d).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 ye=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 it=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,d,s)=>s?s.toUpperCase():d.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=it(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 J={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 ct=({name:e,iconNode:a,absoluteStrokeWidth:d,"absolute-stroke-width":s,strokeWidth:m,"stroke-width":p,size:l=J.width,color:c=J.stroke,...k},{slots:r})=>t.h("svg",{...J,...k,width:l,height:l,stroke:c,"stroke-width":he(d)||he(s)||d===!0||s===!0?Number(m||p||J["stroke-width"])*24/Number(l):m||p||J["stroke-width"],class:lt("lucide",k.class,...e?[`lucide-${ye(st(e))}-icon`,`lucide-${ye(e)}`]:["lucide-icon"]),...!r.default&&!rt(k)&&{"aria-hidden":"true"}},[...a.map(y=>t.h(...y)),...r.default?[r.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 te=(e,a)=>(d,{slots:s,attrs:m})=>t.h(ct,{...m,...d,iconNode:a,name:e},s);/** * @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 ge=te("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 $e=te("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 dt=te("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 ut=te("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:ut},props:{modelo:{type:String,required:!1,default:""}},emits:{buscar(e){return typeof e=="string"}},setup(e,{emit:a}){const d=t.ref(e.modelo??"");t.watch(()=>e.modelo,m=>{m!==void 0&&m!==d.value&&(d.value=m)});function s(){a("buscar",d.value.trim())}return{texto:d,emitirBusca:s}}}),pt={class:"eli-tabela__busca"},ft={class:"eli-tabela__busca-input-wrapper"};function bt(e,a,d,s,m,p){const l=t.resolveComponent("Search");return t.openBlock(),t.createElementBlock("div",pt,[t.createElementVNode("div",ft,[t.withDirectives(t.createElementVNode("input",{id:"eli-tabela-busca","onUpdate:modelValue":a[0]||(a[0]=c=>e.texto=c),type:"search",class:"eli-tabela__busca-input",placeholder:"Digite termos para filtrar",onKeyup:a[1]||(a[1]=t.withKeys((...c)=>e.emitirBusca&&e.emitirBusca(...c),["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]=(...c)=>e.emitirBusca&&e.emitirBusca(...c))},[t.createVNode(l,{class:"eli-tabela__busca-botao-icone",size:16,"stroke-width":2,"aria-hidden":"true"})])])])}const ht=T(mt,[["render",bt],["__scopeId","data-v-f7b534c8"]]),yt=t.defineComponent({name:"EliTabelaCabecalho",components:{EliTabelaCaixaDeBusca:ht},props:{exibirBusca:{type:Boolean,required:!0},valorBusca:{type:String,required:!0},acoesCabecalho:{type:Array,required:!0}},emits:{buscar(e){return typeof e=="string"}},setup(e,{emit:a}){const d=t.computed(()=>e.acoesCabecalho.length>0);function s(m){a("buscar",m)}return{temAcoesCabecalho:d,emitBuscar:s}}}),gt={class:"eli-tabela__cabecalho"},$t={key:1,class:"eli-tabela__acoes-cabecalho"},kt=["onClick"],Bt={class:"eli-tabela__acoes-cabecalho-rotulo"};function Vt(e,a,d,s,m,p){const l=t.resolveComponent("EliTabelaCaixaDeBusca");return t.openBlock(),t.createElementBlock("div",gt,[e.exibirBusca?(t.openBlock(),t.createBlock(l,{key:0,modelo:e.valorBusca,onBuscar:e.emitBuscar},null,8,["modelo","onBuscar"])):t.createCommentVNode("",!0),e.temAcoesCabecalho?(t.openBlock(),t.createElementBlock("div",$t,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.acoesCabecalho,(c,k)=>(t.openBlock(),t.createElementBlock("button",{key:`${c.rotulo}-${k}`,type:"button",class:"eli-tabela__acoes-cabecalho-botao",style:t.normalizeStyle(c.cor?{backgroundColor:c.cor,color:"#fff"}:void 0),onClick:c.acao},[c.icone?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(c.icone),{key:0,class:"eli-tabela__acoes-cabecalho-icone",size:16,"stroke-width":2})):t.createCommentVNode("",!0),t.createElementVNode("span",Bt,t.toDisplayString(c.rotulo),1)],12,kt))),128))])):t.createCommentVNode("",!0)])}const Ct=T(yt,[["render",Vt]]),Et=t.defineComponent({name:"EliTabelaEstados",props:{carregando:{type:Boolean,required:!0},erro:{type:String,required:!0},mensagemVazio:{type:String,required:!1,default:void 0}}}),St={key:0,class:"eli-tabela eli-tabela--carregando","aria-busy":"true"},wt={key:1,class:"eli-tabela eli-tabela--erro",role:"alert"},At={class:"eli-tabela__erro-mensagem"},Mt={key:2,class:"eli-tabela eli-tabela--vazio"};function _t(e,a,d,s,m,p){return e.carregando?(t.openBlock(),t.createElementBlock("div",St," Carregando... ")):e.erro?(t.openBlock(),t.createElementBlock("div",wt,[a[0]||(a[0]=t.createElementVNode("div",{class:"eli-tabela__erro-titulo"},"Erro",-1)),t.createElementVNode("div",At,t.toDisplayString(e.erro),1)])):(t.openBlock(),t.createElementBlock("div",Mt,t.toDisplayString(e.mensagemVazio??"Nenhum registro encontrado."),1))}const Dt=T(Et,[["render",_t]]),Nt=t.defineComponent({name:"EliTabelaDebug",props:{isDev:{type:Boolean,required:!0},menuAberto:{type:Number,required:!0},menuPopupPos:{type:Object,required:!0}}}),Tt={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 Pt(e,a,d,s,m,p){return e.isDev?(t.openBlock(),t.createElementBlock("div",Tt,[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.createCommentVNode("",!0)}const Ot=T(Nt,[["render",Pt]]),qt=t.defineComponent({name:"EliTabelaHead",components:{ArrowUp:$e,ArrowDown:ge},props:{colunas:{type:Array,required:!0},temAcoes:{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 d(p){return(p==null?void 0:p.coluna_ordem)!==void 0&&(p==null?void 0:p.coluna_ordem)!==null}function s(p){return p==="direita"?"eli-tabela__celula--direita":p==="centro"?"eli-tabela__celula--centro":"eli-tabela__celula--esquerda"}function m(p){a("alternarOrdenacao",p)}return{ArrowUp:$e,ArrowDown:ge,isOrdenavel:d,obterClasseAlinhamento:s,emitAlternarOrdenacao:m}}}),It={class:"eli-tabela__thead"},zt={class:"eli-tabela__tr eli-tabela__tr--header"},Lt=["onClick"],Ft={class:"eli-tabela__th-texto"},Ut={key:1,class:"eli-tabela__th-label"},jt={key:0,class:"eli-tabela__th eli-tabela__th--acoes",scope:"col"};function Ht(e,a,d,s,m,p){const l=t.resolveComponent("ArrowUp");return t.openBlock(),t.createElementBlock("thead",It,[t.createElementVNode("tr",zt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(c,k)=>(t.openBlock(),t.createElementBlock("th",{key:`th-${k}`,class:t.normalizeClass(["eli-tabela__th",[e.isOrdenavel(c)?"eli-tabela__th--ordenavel":void 0,e.obterClasseAlinhamento(c.alinhamento)]]),scope:"col"},[e.isOrdenavel(c)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["eli-tabela__th-botao",[e.colunaOrdenacao===String(c.coluna_ordem)?"eli-tabela__th-botao--ativo":void 0]]),onClick:r=>e.emitAlternarOrdenacao(String(c.coluna_ordem))},[t.createElementVNode("span",Ft,t.toDisplayString(c.rotulo),1),e.colunaOrdenacao===String(c.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(l,{key:1,class:"eli-tabela__th-icone eli-tabela__th-icone--oculto",size:16,"stroke-width":2,"aria-hidden":"true"}))],10,Lt)):(t.openBlock(),t.createElementBlock("span",Ut,t.toDisplayString(c.rotulo),1))],2))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("th",jt," Ações ")):t.createCommentVNode("",!0)])])}const Yt=T(qt,[["render",Ht]]),Rt=t.defineComponent({name:"EliTabelaCelulaTextoSimples",components:{},props:{dados:{type:Object}},data(){return{}},methods:{},setup({dados:e}){return{dados:e}}});function Wt(e,a,d,s,m,p){var l;return t.toDisplayString((l=e.dados)==null?void 0:l.texto)}const vt=T(Rt,[["render",Wt]]),Gt=t.defineComponent({name:"EliTabelaCelulaNumero",components:{},props:{dados:{type:Object}},data(){return{}},methods:{},setup({dados:e}){return{dados:e}}});function Jt(e,a,d,s,m,p){var l;return t.toDisplayString(String((l=e.dados)==null?void 0:l.numero).replace(".",","))}const Zt={textoSimples:vt,numero:T(Gt,[["render",Jt]])},Xt=t.defineComponent({name:"EliTabelaCelula",props:{celula:{type:Array,required:!0}},setup(e){const a=t.computed(()=>e.celula[0]),d=t.computed(()=>e.celula[1]),s=t.computed(()=>Zt[a.value]),m=t.computed(()=>d.value);return{Componente:s,dadosParaComponente:m}}});function Kt(e,a,d,s,m,p){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Componente),{dados:e.dadosParaComponente},null,8,["dados"])}const Qt=T(Xt,[["render",Kt]]),xt=t.defineComponent({name:"EliTabelaBody",components:{EliTabelaCelula:Qt,MoreVertical:dt},props:{colunas:{type:Array,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}},setup(){function e(s){return s==="direita"?"eli-tabela__celula--direita":s==="centro"?"eli-tabela__celula--centro":"eli-tabela__celula--esquerda"}function a(s){if(s!=null)return typeof s=="number"?`${s}px`:String(s)}function d(s){if(!Array.isArray(s))return;const m=s[0],p=s[1];if(m==="textoSimples")return typeof(p==null?void 0:p.texto)=="string"?p.texto:void 0;if(m==="numero")return typeof(p==null?void 0:p.numero)=="number"?String(p.numero):void 0}return{obterClasseAlinhamento:e,obterMaxWidth:a,obterTooltipCelula:d}}}),ea={class:"eli-tabela__tbody"},ta=["onClick"],aa=["title"],oa=["id","disabled","aria-expanded","aria-controls","aria-label","title","onClick"];function na(e,a,d,s,m,p){const l=t.resolveComponent("EliTabelaCelula"),c=t.resolveComponent("MoreVertical");return t.openBlock(),t.createElementBlock("tbody",ea,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.linhas,(k,r)=>(t.openBlock(),t.createElementBlock("tr",{key:`tr-${r}`,class:t.normalizeClass(["eli-tabela__tr",[r%2===1?"eli-tabela__tr--zebra":void 0]])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(y,g)=>(t.openBlock(),t.createElementBlock("td",{key:`td-${r}-${g}`,class:t.normalizeClass(["eli-tabela__td",[y.acao?"eli-tabela__td--clicavel":void 0,e.obterClasseAlinhamento(y.alinhamento)]]),onClick:M=>y.acao?()=>{var $;return($=y.acao)==null?void 0:$.call(y)}:void 0},[y.truncar?(t.openBlock(),t.createElementBlock("span",{key:0,class:"eli-tabela__celula-conteudo",style:t.normalizeStyle(y.largura_maxima?{maxWidth:e.obterMaxWidth(y.largura_maxima)}:void 0),title:e.obterTooltipCelula(y.celula(k))},[t.createVNode(l,{celula:y.celula(k)},null,8,["celula"])],12,aa)):(t.openBlock(),t.createBlock(l,{key:1,celula:y.celula(k)},null,8,["celula"]))],10,ta))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("td",{class:"eli-tabela__td eli-tabela__td--acoes",key:`td-${r}-acoes`},[t.createElementVNode("div",{class:t.normalizeClass(["eli-tabela__acoes-container",[e.menuAberto===r?"eli-tabela__acoes-container--aberto":void 0]])},[t.createElementVNode("button",{class:"eli-tabela__acoes-toggle",type:"button",id:`eli-tabela-acoes-toggle-${r}`,disabled:!e.possuiAcoes(r),"aria-haspopup":"menu","aria-expanded":e.menuAberto===r?"true":"false","aria-controls":e.possuiAcoes(r)?`eli-tabela-acoes-menu-${r}`:void 0,"aria-label":e.possuiAcoes(r)?"Ações da linha":"Nenhuma ação disponível",title:e.possuiAcoes(r)?"Ações":"Nenhuma ação disponível",onClick:t.withModifiers(y=>e.toggleMenu(r,y),["stop"])},[t.createVNode(c,{class:"eli-tabela__acoes-toggle-icone",size:18,"stroke-width":2})],8,oa)],2)])):t.createCommentVNode("",!0)],2))),128))])}const ra=T(xt,[["render",na]]),la=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:d}){const s=t.ref(null);d({menuEl:s});const m=t.computed(()=>e.acoes.length>0);function p(l){e.linha&&a("executar",{acao:l.acao,linha:e.linha})}return{menuEl:s,possuiAcoes:m,emitExecutar:p}}}),ia=["id","aria-labelledby"],sa=["aria-label","title","onClick"],ca={class:"eli-tabela__acoes-item-texto"};function da(e,a,d,s,m,p){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,l=>(t.openBlock(),t.createElementBlock("li",{key:`acao-${e.menuAberto}-${l.indice}`,class:"eli-tabela__acoes-item",role:"none"},[t.createElementVNode("button",{type:"button",class:"eli-tabela__acoes-item-botao",style:t.normalizeStyle({color:l.acao.cor}),role:"menuitem","aria-label":l.acao.rotulo,title:l.acao.rotulo,onClick:t.withModifiers(c=>e.emitExecutar(l),["stop"])},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.acao.icone),{class:"eli-tabela__acoes-item-icone",size:16,"stroke-width":2})),t.createElementVNode("span",ca,t.toDisplayString(l.acao.rotulo),1)],12,sa)]))),128))],12,ia)):t.createCommentVNode("",!0)])}const ua=T(la,[["render",da]]),ma=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 d=t.computed(()=>{const r=e.maximoBotoes;return typeof r=="number"&&r>=5?Math.floor(r):7}),s=t.computed(()=>{const r=e.totalPaginas,y=e.pagina,g=d.value,M=[],$=O=>{M.push({label:String(O),pagina:O,ativo:O===y})},D=()=>{M.push({label:"…",ehEllipsis:!0})};if(r<=g){for(let O=1;O<=r;O+=1)$(O);return M}const C=Math.max(3,g-2);let j=Math.max(2,y-Math.floor(C/2)),H=j+C-1;H>=r&&(H=r-1,j=H-C+1),$(1),j>2&&D();for(let O=j;O<=H;O+=1)$(O);return He.pagina<=1),l=t.computed(()=>e.pagina>=e.totalPaginas),c=t.computed(()=>e.pagina),k=t.computed(()=>e.totalPaginas);return{botoes:s,irParaPagina:m,anteriorDesabilitado:p,proximaDesabilitada:l,paginaAtual:c,totalPaginasExibidas:k}}}),pa={key:0,class:"eli-tabela__paginacao",role:"navigation","aria-label":"Paginação de resultados"},fa=["disabled"],ba={key:0,class:"eli-tabela__pagina-ellipsis","aria-hidden":"true"},ha=["disabled","aria-current","aria-label","onClick"],ya=["disabled"];function ga(e,a,d,s,m,p){return e.totalPaginasExibidas>1?(t.openBlock(),t.createElementBlock("nav",pa,[t.createElementVNode("button",{type:"button",class:"eli-tabela__pagina-botao",disabled:e.anteriorDesabilitado,"aria-label":"Página anterior",onClick:a[0]||(a[0]=l=>e.irParaPagina(e.paginaAtual-1))}," << ",8,fa),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.botoes,(l,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`${l.label}-${c}`},[l.ehEllipsis?(t.openBlock(),t.createElementBlock("span",ba,t.toDisplayString(l.label),1)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["eli-tabela__pagina-botao",l.ativo?"eli-tabela__pagina-botao--ativo":void 0]),disabled:l.ativo,"aria-current":l.ativo?"page":void 0,"aria-label":`Ir para página ${l.label}`,onClick:k=>e.irParaPagina(l.pagina)},t.toDisplayString(l.label),11,ha))],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]=l=>e.irParaPagina(e.paginaAtual+1))}," >> ",8,ya)])):t.createCommentVNode("",!0)}const $a=T(ma,[["render",ga],["__scopeId","data-v-59d12455"]]),ka=t.defineComponent({name:"EliTabela",inheritAttrs:!1,components:{EliTabelaCabecalho:Ct,EliTabelaEstados:Dt,EliTabelaDebug:Ot,EliTabelaHead:Yt,EliTabelaBody:ra,EliTabelaMenuAcoes:ua,EliTabelaPaginacao:$a},props:{tabela:{type:Object,required:!0}},setup(e){const d=t.ref(!1),s=t.ref(null),m=t.ref([]),p=t.ref(0),l=t.ref([]),c=t.ref(null),k=t.ref(null),r=t.ref({top:0,left:0}),y=t.ref(""),g=t.ref(1),M=t.ref(null),$=t.ref("asc"),D=t.computed(()=>e.tabela),C=t.computed(()=>!!e.tabela.mostrarCaixaDeBusca),j=t.computed(()=>e.tabela.acoesTabela??[]),H=t.computed(()=>j.value.length>0),O=t.computed(()=>{const o=e.tabela.registros_por_consulta;return typeof o=="number"&&o>0?Math.floor(o):10}),v=t.computed(()=>{const o=O.value;if(!o||o<=0)return 1;const n=p.value;return n?Math.max(1,Math.ceil(n/o)):1}),ie=t.computed(()=>(e.tabela.acoesLinha??[]).length>0);let L=0;function F(o){var E,S,A,P,q,z;const n=o.getBoundingClientRect(),u=8,i=((A=(S=(E=k.value)==null?void 0:E.menuEl)==null?void 0:S.value)==null?void 0:A.offsetHeight)??0,h=((z=(q=(P=k.value)==null?void 0:P.menuEl)==null?void 0:q.value)==null?void 0:z.offsetWidth)??180;let b=n.bottom+u;const B=n.right-h;i&&b+i>window.innerHeight-u&&(b=n.top-u-i),r.value={top:Math.max(u,Math.round(b)),left:Math.max(u,Math.round(B))}}function Z(o){var u,i;if(c.value===null)return;const n=o.target;(i=(u=k.value)==null?void 0:u.menuEl)!=null&&i.value&&k.value.menuEl.value.contains(n)||(c.value=null)}function X(o){if(o){if(M.value===o){$.value=$.value==="asc"?"desc":"asc",f();return}M.value=o,$.value="asc",g.value!==1?g.value=1:f()}}function G(o){y.value!==o&&(y.value=o,g.value!==1?g.value=1:f())}function _(o){const n=Math.min(Math.max(1,o),v.value);n!==g.value&&(g.value=n)}function V(o){const n=e.tabela.acoesLinha??[],u=l.value[o]??[];return n.map((i,h)=>{const b=i.exibir===void 0?!0:typeof i.exibir=="boolean"?i.exibir:!1;return{acao:i,indice:h,visivel:u[h]??b}}).filter(i=>i.visivel)}function R(o){return V(o).length>0}function ae(o,n){if(!R(o))return;if(c.value===o){c.value=null;return}c.value=o;const u=(n==null?void 0:n.currentTarget)??null;u&&(F(u),requestAnimationFrame(()=>F(u)))}async function f(){var h,b;const o=++L;d.value=!0,s.value=null,l.value=[],c.value=null;const n=Math.max(1,O.value),i={offSet:(g.value-1)*n,limit:n};y.value&&(i.texto_busca=y.value),M.value&&(i.coluna_ordem=M.value,i.direcao_ordem=$.value);try{const B=e.tabela,E=await B.consulta(i);if(o!==L)return;if(E.cod!==be.sucesso){m.value=[],p.value=0,s.value=E.mensagem;return}const S=((h=E.valor)==null?void 0:h.valores)??[],A=((b=E.valor)==null?void 0:b.quantidade)??S.length;m.value=S,p.value=A;const P=Math.max(1,Math.ceil((A||0)/n));if(g.value>P){g.value=P;return}const q=B.acoesLinha??[];if(!q.length){l.value=[];return}const z=S.map(()=>q.map(I=>I.exibir===void 0?!0:typeof I.exibir=="boolean"?I.exibir:!1));l.value=z;const W=await Promise.all(S.map(async I=>Promise.all(q.map(async N=>{if(N.exibir===void 0)return!0;if(typeof N.exibir=="boolean")return N.exibir;try{const U=N.exibir(I);return!!await Promise.resolve(U)}catch{return!1}}))));o===L&&(l.value=W)}catch(B){if(o!==L)return;m.value=[],p.value=0,s.value=B instanceof Error?B.message:"Erro ao carregar dados."}finally{o===L&&(d.value=!1)}}return t.onMounted(()=>{document.addEventListener("click",Z),f()}),t.onBeforeUnmount(()=>{document.removeEventListener("click",Z)}),t.watch(()=>e.tabela.mostrarCaixaDeBusca,o=>{!o&&y.value&&(y.value="",g.value!==1?g.value=1:f())}),t.watch(g,(o,n)=>{o!==n&&f()}),t.watch(()=>e.tabela,()=>{c.value=null,M.value=null,$.value="asc",y.value="",g.value!==1?g.value=1:f()}),t.watch(()=>e.tabela.registros_por_consulta,()=>{g.value!==1?g.value=1:f()}),t.watch(m,()=>{c.value=null}),{isDev:!1,tabela:D,carregando:d,erro:s,linhas:m,quantidade:p,menuAberto:c,valorBusca:y,paginaAtual:g,colunaOrdenacao:M,direcaoOrdenacao:$,totalPaginas:v,exibirBusca:C,acoesCabecalho:j,temAcoesCabecalho:H,temAcoes:ie,alternarOrdenacao:X,atualizarBusca:G,irParaPagina:_,acoesDisponiveisPorLinha:V,possuiAcoes:R,toggleMenu:ae,menuPopup:k,menuPopupPos:r}}}),Ba={class:"eli-tabela"},Va={class:"eli-tabela__table"};function Ca(e,a,d,s,m,p){const l=t.resolveComponent("EliTabelaDebug"),c=t.resolveComponent("EliTabelaEstados"),k=t.resolveComponent("EliTabelaCabecalho"),r=t.resolveComponent("EliTabelaHead"),y=t.resolveComponent("EliTabelaBody"),g=t.resolveComponent("EliTabelaMenuAcoes"),M=t.resolveComponent("EliTabelaPaginacao");return t.openBlock(),t.createElementBlock("div",Ba,[t.createVNode(l,{isDev:e.isDev,menuAberto:e.menuAberto,menuPopupPos:e.menuPopupPos},null,8,["isDev","menuAberto","menuPopupPos"]),e.carregando||e.erro||!e.linhas.length?(t.openBlock(),t.createBlock(c,{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(k,{key:0,exibirBusca:e.exibirBusca,valorBusca:e.valorBusca,acoesCabecalho:e.acoesCabecalho,onBuscar:e.atualizarBusca},null,8,["exibirBusca","valorBusca","acoesCabecalho","onBuscar"])):t.createCommentVNode("",!0),t.createElementVNode("table",Va,[t.createVNode(r,{colunas:e.tabela.colunas,temAcoes:e.temAcoes,colunaOrdenacao:e.colunaOrdenacao,direcaoOrdenacao:e.direcaoOrdenacao,onAlternarOrdenacao:e.alternarOrdenacao},null,8,["colunas","temAcoes","colunaOrdenacao","direcaoOrdenacao","onAlternarOrdenacao"]),t.createVNode(y,{colunas:e.tabela.colunas,linhas:e.linhas,temAcoes:e.temAcoes,menuAberto:e.menuAberto,possuiAcoes:e.possuiAcoes,toggleMenu:e.toggleMenu},null,8,["colunas","linhas","temAcoes","menuAberto","possuiAcoes","toggleMenu"])]),t.createVNode(g,{ref:"menuPopup",menuAberto:e.menuAberto,posicao:e.menuPopupPos,acoes:e.menuAberto===null?[]:e.acoesDisponiveisPorLinha(e.menuAberto),linha:e.menuAberto===null?null:e.linhas[e.menuAberto],onExecutar:a[0]||(a[0]=({acao:$,linha:D})=>{e.menuAberto=null,$.acao(D)})},null,8,["menuAberto","posicao","acoes","linha"]),e.totalPaginas>1&&e.quantidade>0?(t.openBlock(),t.createBlock(M,{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 ke=T(ka,[["render",Ca]]),Ea={install(e){e.component("EliOlaMundo",ue),e.component("EliBotao",ne),e.component("EliBadge",Q),e.component("EliInput",le),e.component("EliCartao",me),e.component("EliDataHora",fe),e.component("EliTabela",ke)}};w.EliBadge=Q,w.EliBotao=ne,w.EliCartao=me,w.EliDataHora=fe,w.EliInput=le,w.EliOlaMundo=ue,w.EliTabela=ke,w.default=Ea,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));