@thibezer/ui-components-kit 2.15.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/botao.cjs +1 -1
  4. package/dist/botao.js +1 -1
  5. package/dist/camadas.cjs +50 -50
  6. package/dist/camadas.js +381 -373
  7. package/dist/campo-texto.cjs +1 -1
  8. package/dist/campo-texto.js +1 -1
  9. package/dist/canvas.cjs +24 -24
  10. package/dist/canvas.js +757 -751
  11. package/dist/card.cjs +1 -1
  12. package/dist/card.js +1 -1
  13. package/dist/components/ui-avatar/ui-avatar.d.ts +7 -0
  14. package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +2 -0
  15. package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +7 -0
  16. package/dist/components/ui-mapa/ui-mapa.d.ts +1 -0
  17. package/dist/components/ui-seletor-mapa-base/ui-seletor-mapa-base.d.ts +6 -0
  18. package/dist/components/ui-skeleton/ui-skeleton.d.ts +9 -0
  19. package/dist/components/ui-stat/ui-stat.d.ts +12 -0
  20. package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +2 -1
  21. package/dist/components/ui-tabela-propriedades/propriedades-persistencia.d.ts +63 -0
  22. package/dist/components/ui-tabela-propriedades/propriedades-render-arvore.d.ts +1 -0
  23. package/dist/components/ui-tabela-propriedades/tipos.d.ts +16 -0
  24. package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +40 -1
  25. package/dist/core/degrade.d.ts +34 -0
  26. package/dist/core/index.d.ts +1 -0
  27. package/dist/core.cjs +1 -1
  28. package/dist/core.js +33 -24
  29. package/dist/cores.cjs +1 -1
  30. package/dist/cores.js +1 -1
  31. package/dist/custom-elements.json +20565 -19020
  32. package/dist/data.cjs +1 -1
  33. package/dist/data.js +89 -79
  34. package/dist/degrade-CIxvOTUv.cjs +1 -0
  35. package/dist/degrade-gDa5sW__.js +119 -0
  36. package/dist/feedback.cjs +1 -1
  37. package/dist/feedback.js +2 -2
  38. package/dist/forms.cjs +1 -1
  39. package/dist/forms.js +2 -2
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +215 -196
  43. package/dist/mapa.cjs +1 -1
  44. package/dist/mapa.js +1 -1
  45. package/dist/modal.cjs +1 -1
  46. package/dist/modal.js +1 -1
  47. package/dist/register.cjs +1 -1
  48. package/dist/register.js +11 -11
  49. package/dist/seletor-mapa-base.cjs +10 -10
  50. package/dist/seletor-mapa-base.js +34 -28
  51. package/dist/tabela.cjs +1 -1
  52. package/dist/tabela.js +83 -73
  53. package/dist/tipos-elementos.d.ts +33 -3
  54. package/dist/tipos-vue.d.ts +30 -3
  55. package/dist/tools.cjs +1 -1
  56. package/dist/tools.js +1 -1
  57. package/dist/ui-badge-1UU8vT-b.js +198 -0
  58. package/dist/ui-badge-CKKKPdt8.cjs +28 -0
  59. package/dist/ui-badge-DE58YSBY.cjs +28 -0
  60. package/dist/ui-badge-KgmI3jOD.js +201 -0
  61. package/dist/ui-botao-Dz8YvmiA.cjs +12 -0
  62. package/dist/ui-botao-bU_bf6SU.js +166 -0
  63. package/dist/ui-botao-xTbH5mpH.cjs +12 -0
  64. package/dist/ui-botao-zLkcMMyP.js +168 -0
  65. package/dist/ui-campo-texto-DVU_sWV1.cjs +16 -0
  66. package/dist/ui-campo-texto-Dliyt9qr.cjs +16 -0
  67. package/dist/ui-campo-texto-W5M0gNE4.js +377 -0
  68. package/dist/ui-campo-texto-btevggO3.js +379 -0
  69. package/dist/ui-card-BYyYxxY1.cjs +20 -0
  70. package/dist/ui-card-CojoGXaT.js +144 -0
  71. package/dist/ui-card-DFnRp9bl.js +146 -0
  72. package/dist/ui-card-DrWVJQKw.cjs +20 -0
  73. package/dist/ui-controle-cores-Bq_XUrIQ.cjs +32 -0
  74. package/dist/ui-controle-cores-BtA6yzu3.js +291 -0
  75. package/dist/ui-kit.css +1 -1
  76. package/dist/ui-linha-2kY7TNUJ.cjs +38 -0
  77. package/dist/ui-linha-DAz6DBcl.cjs +38 -0
  78. package/dist/ui-linha-DkxwMhD-.js +749 -0
  79. package/dist/ui-linha-KFF86FW5.js +752 -0
  80. package/dist/ui-modal-4nU-tXjO.cjs +18 -0
  81. package/dist/ui-modal-BrXzVZ65.js +216 -0
  82. package/dist/ui-modal-BwB9fksp.js +214 -0
  83. package/dist/ui-modal-lARKzEVZ.cjs +18 -0
  84. package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +1245 -0
  85. package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +21 -0
  86. package/dist/ui-skeleton-BLEV6h3k.js +653 -0
  87. package/dist/ui-skeleton-B_XTaGrX.cjs +52 -0
  88. package/dist/ui-skeleton-DEHwpDqa.js +648 -0
  89. package/dist/ui-skeleton-sIphhOSx.cjs +52 -0
  90. package/dist/ui-switch-BXIDwC-Y.cjs +66 -0
  91. package/dist/ui-switch-Ctxk-jKS.js +1212 -0
  92. package/dist/ui-switch-DAIgOhqr.cjs +66 -0
  93. package/dist/ui-switch-_F8yubdX.js +1203 -0
  94. package/dist/ui-tabela-propriedades-2bq2nX-b.js +3202 -0
  95. package/dist/ui-tabela-propriedades-CJyo568n.js +3517 -0
  96. package/dist/ui-tabela-propriedades-CnfW9DZG.cjs +142 -0
  97. package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +142 -0
  98. package/package.json +187 -187
@@ -0,0 +1,3517 @@
1
+ var je = Object.defineProperty;
2
+ var Ue = (r, t, e) => t in r ? je(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var v = (r, t, e) => Ue(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { L as j } from "./listener-bag-DQgv7OON.js";
5
+ import { a as R } from "./parts-CaoQiCfI.js";
6
+ import { d as G, S as ze } from "./ssr-safe-5cWfJP-s.js";
7
+ import { A as Le, e as Me, a as U } from "./degrade-gDa5sW__.js";
8
+ import { h as We } from "./svg-seguro-ChVJ2L2z.js";
9
+ class Xe {
10
+ constructor(t) {
11
+ v(this, "autoFetchController", null);
12
+ v(this, "emVoo", null);
13
+ this.ctx = t;
14
+ }
15
+ /**
16
+ * Busca os dados. Resolve `true` em sucesso e `false` em falha, cancelamento ou requisição
17
+ * substituída (nunca rejeita; o motivo da falha vai no evento `ui-fetch-erro`).
18
+ * Uma chamada com a mesma URL de uma requisição em andamento reaproveita essa requisição.
19
+ */
20
+ carregar(t) {
21
+ if (!t) return Promise.resolve(!1);
22
+ if (this.emVoo && this.emVoo.url === t && this.autoFetchController) return this.emVoo.promessa;
23
+ this.cancelarEmVoo();
24
+ const e = new AbortController();
25
+ this.autoFetchController = e;
26
+ const i = this.executar(t, e);
27
+ return this.emVoo = { url: t, promessa: i }, i;
28
+ }
29
+ emitir(t, e) {
30
+ this.ctx.host.dispatchEvent(new CustomEvent(t, { bubbles: !0, composed: !0, detail: e }));
31
+ }
32
+ erro(t, e, i, o) {
33
+ const a = e instanceof Error ? e.message : String(e);
34
+ console.error("[ui-tabela] Erro ao carregar dados remotos:", e);
35
+ const n = { url: t, erro: a, origem: i };
36
+ o !== void 0 && (n.status = o), this.emitir("ui-fetch-erro", n);
37
+ }
38
+ async executar(t, e) {
39
+ var s, l, u, d;
40
+ const i = () => this.autoFetchController === e, o = () => {
41
+ this.autoFetchController === e && (this.autoFetchController = null, this.emVoo = null);
42
+ };
43
+ this.ctx.onCarregandoAlterado(!0), this.emitir("ui-fetch-start", { url: t });
44
+ let a = "rede", n;
45
+ try {
46
+ const p = { ...((l = (s = this.ctx).getOpcoes) == null ? void 0 : l.call(s)) ?? {}, signal: e.signal }, h = await (((d = (u = this.ctx).getFetcher) == null ? void 0 : d.call(u)) ?? ((g, y) => fetch(g, y)))(t, p);
47
+ if (!h.ok)
48
+ throw a = "http", n = h.status, new Error(`HTTP ${h.status}: ${h.statusText}`);
49
+ a = "json";
50
+ const f = await h.json(), m = Array.isArray(f) ? f : (f == null ? void 0 : f.dados) || (f == null ? void 0 : f.items) || (f == null ? void 0 : f.data) || (f == null ? void 0 : f.rows) || [], b = Array.isArray(m) ? m : [];
51
+ return i() ? (a = "render", this.ctx.onDadosRecebidos(b), o(), this.ctx.onCarregandoAlterado(!1), this.emitir("ui-fetch-sucesso", { url: t, total: b.length, dados: b }), !0) : !1;
52
+ } catch (p) {
53
+ return (p == null ? void 0 : p.name) === "AbortError" ? (i() && (o(), this.ctx.onCarregandoAlterado(!1)), this.emitir("ui-fetch-cancelado", { url: t }), !1) : (i() && (o(), this.ctx.onCarregandoAlterado(!1), this.erro(t, p, a, n)), !1);
54
+ }
55
+ }
56
+ /** Cancela a requisição em andamento (se houver) e libera o indicador de carregamento. */
57
+ abortar() {
58
+ this.autoFetchController && (this.cancelarEmVoo(), this.ctx.onCarregandoAlterado(!1));
59
+ }
60
+ cancelarEmVoo() {
61
+ if (this.autoFetchController) {
62
+ const t = this.autoFetchController;
63
+ this.autoFetchController = null, this.emVoo = null, t.abort();
64
+ }
65
+ }
66
+ }
67
+ const Ke = ["id", "_id", "codigo", "key"];
68
+ function Ge(r, t) {
69
+ return r != null && (r === t || String(r) === String(t));
70
+ }
71
+ function ve(r, t) {
72
+ let e = -1;
73
+ return typeof r == "number" && Number.isInteger(r) ? e = r : typeof r == "string" && /^\d+$/.test(r.trim()) && (e = parseInt(r.trim(), 10)), e >= 0 && e < t ? e : -1;
74
+ }
75
+ function Ye(r, t, e = "id", i = !1) {
76
+ if (!r || r.length === 0) return -1;
77
+ if (typeof t == "function")
78
+ return r.findIndex(t);
79
+ if (i) return ve(t, r.length);
80
+ const o = [e, ...Ke.filter((a) => a !== e)];
81
+ for (const a of o) {
82
+ const n = r.findIndex((s) => !!s && typeof s == "object" && Ge(s[a], t));
83
+ if (n !== -1) return n;
84
+ }
85
+ return ve(t, r.length);
86
+ }
87
+ class Je {
88
+ constructor(t) {
89
+ v(this, "itemSelecionado", null);
90
+ v(this, "indiceSelecionado", null);
91
+ this.ctx = t;
92
+ }
93
+ /** Mesmo objeto ou mesmo valor na chave configurada. */
94
+ indiceDoItem(t, e) {
95
+ const i = this.ctx.getChaveId(), o = t.indexOf(e);
96
+ return o >= 0 ? o : e[i] == null ? -1 : t.findIndex((a) => (a == null ? void 0 : a[i]) != null && String(a[i]) === String(e[i]));
97
+ }
98
+ getItemSelecionado() {
99
+ return this.itemSelecionado;
100
+ }
101
+ setItemSelecionado(t) {
102
+ this.itemSelecionado = t;
103
+ const e = t ? this.indiceDoItem(this.ctx.getDadosExibicao(), t) : -1;
104
+ this.indiceSelecionado = e >= 0 ? e : null, this.atualizarLinhasSelecionadas();
105
+ }
106
+ getIndiceSelecionado() {
107
+ return this.indiceSelecionado;
108
+ }
109
+ setIndiceSelecionado(t) {
110
+ const e = this.ctx.getDadosExibicao(), i = t !== null && t >= 0 && t < e.length;
111
+ this.indiceSelecionado = i ? t : null, this.itemSelecionado = i ? e[t] : null, this.atualizarLinhasSelecionadas();
112
+ }
113
+ /**
114
+ * Reaplica a seleção após ordenar, filtrar ou trocar os dados.
115
+ * - Item ainda exibido: atualiza o índice (e a referência, se veio um objeto novo com a mesma chave).
116
+ * - Item só escondido pelo filtro: mantém a seleção (sem índice) para reaparecer ao limpar o filtro.
117
+ * - Item removido dos dados: limpa a seleção e emite `ui-selecao-removida`.
118
+ */
119
+ reconciliar() {
120
+ const t = this.itemSelecionado;
121
+ if (!t) {
122
+ this.indiceSelecionado = null;
123
+ return;
124
+ }
125
+ const e = this.ctx.getDadosExibicao(), i = this.indiceDoItem(e, t);
126
+ if (i >= 0) {
127
+ this.indiceSelecionado = i, this.substituirReferencia(t, e[i]);
128
+ return;
129
+ }
130
+ this.indiceSelecionado = null;
131
+ const o = this.ctx.getDadosOriginais(), a = this.indiceDoItem(o, t);
132
+ if (a >= 0) {
133
+ this.substituirReferencia(t, o[a]);
134
+ return;
135
+ }
136
+ this.itemSelecionado = null, this.ctx.host.dispatchEvent(
137
+ new CustomEvent("ui-selecao-removida", { bubbles: !0, composed: !0, detail: { item: t } })
138
+ );
139
+ }
140
+ /** Mesmo registro com outro objeto (dados recarregados): atualiza a referência e avisa. */
141
+ substituirReferencia(t, e) {
142
+ this.itemSelecionado = e, t !== e && this.ctx.host.dispatchEvent(
143
+ new CustomEvent("ui-selecao-atualizada", { bubbles: !0, composed: !0, detail: { item: e, anterior: t } })
144
+ );
145
+ }
146
+ limparSelecao() {
147
+ this.itemSelecionado = null, this.indiceSelecionado = null, this.atualizarLinhasSelecionadas();
148
+ }
149
+ isItemSelecionado(t, e) {
150
+ if (this.itemSelecionado) {
151
+ if (this.itemSelecionado === t) return !0;
152
+ const i = this.ctx.getChaveId();
153
+ if (t[i] != null && this.itemSelecionado[i] != null)
154
+ return String(t[i]) === String(this.itemSelecionado[i]);
155
+ if (t.id != null && this.itemSelecionado.id != null)
156
+ return String(t.id) === String(this.itemSelecionado.id);
157
+ }
158
+ return this.indiceSelecionado !== null && this.indiceSelecionado === e;
159
+ }
160
+ atualizarLinhasSelecionadas() {
161
+ const t = this.ctx.getTbody();
162
+ if (!t) return;
163
+ const e = this.ctx.getDadosExibicao();
164
+ t.querySelectorAll("tr:not(.ui-tabela__virtual-spacer)").forEach((o) => {
165
+ const a = o.getAttribute("data-index"), n = a !== null ? parseInt(a, 10) : -1, s = n >= 0 ? e[n] : null, l = s ? this.isItemSelecionado(s, n) : !1;
166
+ o.classList.toggle("ui-tabela__tr--selecionada", l), R(o, "linha-selecionada", l), l ? (o.setAttribute("data-selecionada", "true"), o.setAttribute("aria-current", "true"), o.setAttribute("aria-selected", "true")) : (o.removeAttribute("data-selecionada"), o.removeAttribute("aria-current"), o.setAttribute("aria-selected", "false"));
167
+ });
168
+ }
169
+ rolarPara(t, e) {
170
+ const i = this.ctx.getDadosExibicao(), o = Ye(i, t, this.ctx.getChaveId(), (e == null ? void 0 : e.porIndice) === !0);
171
+ if (o === -1)
172
+ return !1;
173
+ if (e != null && e.selecionar) {
174
+ const a = i[o];
175
+ this.itemSelecionado = a, this.indiceSelecionado = o, this.atualizarLinhasSelecionadas(), this.ctx.onLinhaAtiva(o), this.ctx.host.dispatchEvent(
176
+ new CustomEvent("ui-linha-selecionada", {
177
+ bubbles: !0,
178
+ composed: !0,
179
+ detail: { item: a, indice: o }
180
+ })
181
+ );
182
+ }
183
+ return this.ctx.onRolarParaIndice(o, (e == null ? void 0 : e.comportamento) || "smooth");
184
+ }
185
+ }
186
+ function Qe(r, t, e) {
187
+ return r !== e ? {
188
+ idColuna: e,
189
+ direcao: "asc"
190
+ } : t === "asc" ? {
191
+ idColuna: e,
192
+ direcao: "desc"
193
+ } : t === "desc" ? {
194
+ idColuna: null,
195
+ direcao: "original"
196
+ } : {
197
+ idColuna: e,
198
+ direcao: "asc"
199
+ };
200
+ }
201
+ const Ze = new Intl.Collator("pt-BR", { numeric: !0, sensitivity: "base" });
202
+ function _e(r) {
203
+ if (r instanceof Date) return r.getTime();
204
+ if (typeof r == "number") return r;
205
+ const t = String(r).trim(), e = /^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T](\d{1,2}):(\d{2}))?$/.exec(t);
206
+ return e ? new Date(+e[3], +e[2] - 1, +e[1], +(e[4] ?? 0), +(e[5] ?? 0)).getTime() : Date.parse(t);
207
+ }
208
+ function et(r, t, e) {
209
+ if (e === "data" || !e && (r instanceof Date || t instanceof Date)) {
210
+ const i = _e(r), o = _e(t);
211
+ if (!Number.isNaN(i) && !Number.isNaN(o)) return i - o;
212
+ } else if (e === "numero" || !e && typeof r == "number" && typeof t == "number") {
213
+ const i = Number(r), o = Number(t);
214
+ if (!Number.isNaN(i) && !Number.isNaN(o)) return i - o;
215
+ } else if (e === "booleano" || !e && typeof r == "boolean" && typeof t == "boolean")
216
+ return +!!r - +!!t;
217
+ return Ze.compare(String(r), String(t));
218
+ }
219
+ function tt(r, t, e, i) {
220
+ if (!t || e === "original")
221
+ return [...r];
222
+ const o = e === "desc" ? -1 : 1;
223
+ return [...r].sort((a, n) => {
224
+ const s = a[t], l = n[t], u = s == null, d = l == null;
225
+ return u || d ? u === d ? 0 : u ? 1 : -1 : i != null && i.comparador ? i.comparador(s, l, a, n) * o : s === l ? 0 : et(s, l, i == null ? void 0 : i.tipo) * o;
226
+ });
227
+ }
228
+ function ie(r) {
229
+ return r.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
230
+ }
231
+ class rt {
232
+ constructor() {
233
+ v(this, "dadosOriginais", []);
234
+ v(this, "dadosExibicao", []);
235
+ v(this, "indicePorItem", null);
236
+ v(this, "colunaOrdenada", null);
237
+ v(this, "direcaoOrdenacao", "original");
238
+ v(this, "ultimoFiltro", "");
239
+ /** Colunas declaradas: o filtro olha só elas (vazio = todos os campos do registro). */
240
+ v(this, "colunasFiltro", []);
241
+ v(this, "colunas", []);
242
+ /** Ordenação feita pelo servidor: a tabela guarda coluna/direção (indicador) mas não reordena os dados. */
243
+ v(this, "ordenacaoRemota", !1);
244
+ }
245
+ setColunas(t) {
246
+ this.colunas = t, this.colunaOrdenada && this.aplicarOrdenacao();
247
+ }
248
+ setOrdenacaoRemota(t) {
249
+ this.ordenacaoRemota !== t && (this.ordenacaoRemota = t, this.aplicarOrdenacao());
250
+ }
251
+ /** Restaura coluna/direção (ex.: `ui-sort` cancelado) e recalcula. */
252
+ restaurarOrdenacao(t, e) {
253
+ this.colunaOrdenada = t, this.direcaoOrdenacao = e, this.aplicarOrdenacao();
254
+ }
255
+ setColunasFiltro(t) {
256
+ this.colunasFiltro = t, this.ultimoFiltro && this.aplicarOrdenacao();
257
+ }
258
+ getDadosOriginais() {
259
+ return this.dadosOriginais;
260
+ }
261
+ setDadosOriginais(t) {
262
+ this.dadosOriginais = Array.isArray(t) ? t.filter((e) => e != null) : [], this.indicePorItem = null, this.aplicarOrdenacao();
263
+ }
264
+ /** Posição do item em `dados` (-1 se não pertence). Índice por objeto montado sob demanda, uma vez por troca de dados. */
265
+ indiceOriginal(t) {
266
+ this.indicePorItem || (this.indicePorItem = /* @__PURE__ */ new Map(), this.dadosOriginais.forEach((i, o) => {
267
+ this.indicePorItem.has(i) || this.indicePorItem.set(i, o);
268
+ }));
269
+ const e = this.indicePorItem.get(t);
270
+ return e !== void 0 && this.dadosOriginais[e] === t ? e : this.dadosOriginais.indexOf(t);
271
+ }
272
+ getDadosExibicao() {
273
+ return this.dadosExibicao;
274
+ }
275
+ getColunaOrdenada() {
276
+ return this.colunaOrdenada;
277
+ }
278
+ setColunaOrdenada(t) {
279
+ this.colunaOrdenada = t, t ? this.direcaoOrdenacao === "original" && (this.direcaoOrdenacao = "asc") : this.direcaoOrdenacao = "original", this.aplicarOrdenacao();
280
+ }
281
+ getDirecaoOrdenacao() {
282
+ return this.direcaoOrdenacao;
283
+ }
284
+ setDirecaoOrdenacao(t) {
285
+ this.direcaoOrdenacao = t || "original", this.direcaoOrdenacao === "original" && (this.colunaOrdenada = null), this.aplicarOrdenacao();
286
+ }
287
+ alternarOrdenacaoColuna(t) {
288
+ if (!t.ordenavel) return null;
289
+ const e = Qe(this.colunaOrdenada, this.direcaoOrdenacao, t.id);
290
+ return this.colunaOrdenada = e.idColuna, this.direcaoOrdenacao = e.direcao, this.aplicarOrdenacao(), e;
291
+ }
292
+ /** Recalcula a lista exibida: filtro vigente e, sobre o resultado, a ordenação da coluna (valem juntos). */
293
+ aplicarOrdenacao() {
294
+ const t = this.ultimoFiltro, e = t ? this.dadosOriginais.filter((o) => this.casaFiltro(o, t)) : this.dadosOriginais, i = this.colunaOrdenada ? this.colunas.find((o) => o.id === this.colunaOrdenada) : null;
295
+ this.dadosExibicao = this.ordenacaoRemota ? [...e] : tt(e, this.colunaOrdenada, this.direcaoOrdenacao, i);
296
+ }
297
+ casaFiltro(t, e) {
298
+ return (this.colunasFiltro.length > 0 ? this.colunasFiltro : Object.keys(t)).some((o) => {
299
+ const a = t[o], n = this.colunas.find((l) => l.id === o);
300
+ if (n != null && n.textoFiltro)
301
+ try {
302
+ if (ie(String(n.textoFiltro(a, t) ?? "")).includes(e)) return !0;
303
+ } catch {
304
+ }
305
+ if (a == null || typeof a == "object" && !(a instanceof Date)) return !1;
306
+ const s = a instanceof Date ? `${a.toISOString()} ${a.toLocaleDateString("pt-BR")}` : String(a);
307
+ return ie(s).includes(e);
308
+ });
309
+ }
310
+ /** Há um filtro de texto aplicado (o vazio vira "sem resultados"). */
311
+ temFiltro() {
312
+ return this.ultimoFiltro !== "";
313
+ }
314
+ filtrar(t) {
315
+ this.ultimoFiltro = ie((t || "").trim()), this.aplicarOrdenacao();
316
+ }
317
+ }
318
+ const it = ':host{display:block;width:100%;box-sizing:border-box;font-family:inherit;color:var(--ui-cor-texto, #e1e1e6);position:relative}.ui-tabela-container{width:100%;max-width:100%;max-height:var(--ui-tabela-max-height, 500px);overflow-x:auto;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);background:var(--ui-degrade-interno, var(--ui-tabela-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417))));box-sizing:border-box;position:relative}.ui-tabela{width:100%;border-collapse:separate;border-spacing:0;text-align:left;font-size:14px;font-family:var(--ui-fonte-base, inherit);font-variant-numeric:tabular-nums}.ui-tabela thead{background:var(--ui-tabela-cabecalho-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e)))}.ui-tabela th{position:sticky;top:0;z-index:10;padding:10px 16px;background:var(--ui-tabela-cabecalho-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e)));color:var(--ui-cor-texto-secundario, #9696a6);font-size:13px;font-weight:600;letter-spacing:.02em;border-bottom:2px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box}.ui-tabela th[aria-sort=ascending],.ui-tabela th[aria-sort=descending]{color:var(--ui-cor-texto, #e1e1e6)}.ui-tabela__resizer{position:absolute;top:0;right:0;width:8px;height:100%;cursor:col-resize;-webkit-user-select:none;user-select:none;touch-action:none;z-index:20;background:linear-gradient(var(--ui-cor-borda, rgba(255, 255, 255, .12)),var(--ui-cor-borda, rgba(255, 255, 255, .12))) center / 1px 60% no-repeat;transition:background-color .15s ease}.ui-tabela__resizer:hover,.ui-tabela__resizer:focus-visible,.ui-tabela__resizer--ativo{background:var(--ui-cor-primaria, #00E08A);outline:none}:host([densidade="compacta"]) th,:host([densidade="compacta"]) td,:host([density="compact"]) th,:host([density="compact"]) td{padding:4px 8px}:host([densidade="normal"]) th,:host([densidade="normal"]) td,:host([density="normal"]) th,:host([density="normal"]) td{padding:10px 16px}:host([densidade="relaxada"]) th,:host([densidade="relaxada"]) td,:host([density="relaxed"]) th,:host([density="relaxed"]) td{padding:16px 20px}:host([altura-linha]) td,:host([row-height]) td{height:var(--ui-tabela-altura-linha);box-sizing:border-box;padding-top:0;padding-bottom:0;overflow:hidden;white-space:nowrap}.ui-tabela__header-content{display:inline-flex;align-items:center;vertical-align:middle;width:100%;box-sizing:border-box}.ui-tabela__header-text{margin-right:var(--ui-tabela-th-gap, 6px);display:inline-block;min-width:0;overflow:hidden;text-overflow:ellipsis}.ui-tabela__sort-icon{width:var(--ui-tabela-th-icone, 16px);min-width:var(--ui-tabela-th-icone, 16px);flex:none;display:inline-flex;justify-content:center;align-items:center}.ui-tabela th.ui-tabela__th--ordenavel{cursor:pointer}@media (hover: hover){.ui-tabela th.ui-tabela__th--ordenavel:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,var(--ui-cor-fundo-elevado, #1a1a1e));color:var(--ui-cor-texto, #e1e1e6)}}.ui-tabela__ordenar{all:unset;display:flex;width:100%;box-sizing:border-box;cursor:pointer;font:inherit;color:inherit;text-align:inherit}.ui-tabela__ordenar:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px;border-radius:var(--ui-raio-sm, 4px)}.ui-tabela tbody tr:focus{outline:none}.ui-tabela tbody tr:focus-visible{outline:2px solid var(--ui-tabela-cor-foco, var(--ui-cor-texto, #e1e1e6));outline-offset:-2px;background:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 8%, transparent))}.ui-tabela__sort-arrow{display:inline-block;width:14px;height:14px;vertical-align:middle;shape-rendering:geometricPrecision;fill:var(--ui-cor-primaria, #00E08A)}.ui-tabela__sort-arrow path{transition:opacity .15s ease;opacity:.35}.ui-tabela__sort-arrow--asc .seta-cima,.ui-tabela__sort-arrow--desc .seta-baixo{opacity:1}.ui-tabela__sort-arrow--inativo{fill:var(--ui-cor-texto-secundario, #9696a6)}.ui-tabela__sort-arrow--inativo path{opacity:.6}.ui-tabela td{padding:10px 16px;border-bottom:1px solid color-mix(in srgb,var(--ui-cor-borda, rgba(255, 255, 255, .12)) 60%,transparent);white-space:nowrap;vertical-align:middle;color:var(--ui-cor-texto, #e1e1e6);box-sizing:border-box}.ui-tabela__cell-content{display:inline-flex;align-items:center;vertical-align:middle}.ui-tabela__cell-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.ui-tabela--alinhar-esquerda{text-align:left}.ui-tabela--alinhar-esquerda .ui-tabela__header-content,.ui-tabela--alinhar-esquerda .ui-tabela__cell-content{justify-content:flex-start}.ui-tabela--alinhar-centro{text-align:center}.ui-tabela--alinhar-centro .ui-tabela__header-content,.ui-tabela--alinhar-centro .ui-tabela__cell-content{justify-content:center}.ui-tabela--alinhar-direita{text-align:right}.ui-tabela--alinhar-direita .ui-tabela__header-content,.ui-tabela--alinhar-direita .ui-tabela__cell-content{justify-content:flex-end}.ui-tabela tbody tr[data-index]{cursor:pointer}.ui-tabela tbody tr.ui-tabela__tr--par{background:var(--ui-tabela-zebra, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 4%, transparent))}@media (hover: hover){.ui-tabela tbody tr[data-index]:hover{background:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 8%, transparent))}}.ui-tabela tbody tr[data-index]:active{background:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 12%, transparent))}:host(:not([selecionar-texto])) .ui-tabela tbody td{-webkit-user-select:none;user-select:none}.ui-tabela tbody tr.ui-tabela__tr--selecionada,.ui-tabela tbody tr[data-selecionada=true]{background:var(--ui-tabela-selecionada, var(--ui-cor-linha-selecionada, color-mix(in srgb, var(--ui-cor-primaria, #00E08A) 14%, transparent)))}.ui-tabela tbody tr.ui-tabela__tr--selecionada td:first-child,.ui-tabela tbody tr[data-selecionada=true] td:first-child{box-shadow:inset 3px 0 0 var(--ui-cor-primaria, #00E08A)}@media (hover: hover){.ui-tabela tbody tr.ui-tabela__tr--selecionada:hover,.ui-tabela tbody tr[data-selecionada=true]:hover{background:var(--ui-tabela-selecionada-hover, var(--ui-cor-linha-selecionada-hover, color-mix(in srgb, var(--ui-cor-primaria, #00E08A) 22%, transparent)))}}.ui-tabela__virtual-spacer td{padding:0!important;border:none!important;height:inherit;background:transparent!important}.ui-tabela__empty{padding:40px 24px;text-align:center;color:var(--ui-cor-texto-secundario, #9696a6);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;box-sizing:border-box}.ui-tabela__empty-icon{width:32px;height:32px;opacity:.5;fill:currentColor}.ui-tabela__empty-text{font-size:14px;font-weight:500;color:var(--ui-cor-texto-secundario, #9696a6)}.ui-tabela__erro{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:12px;padding:10px 14px;border:1px solid var(--ui-cor-texto-erro, #ff5555);border-left-width:4px;border-radius:var(--ui-raio-borda, 6px);background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 10%,transparent);color:var(--ui-cor-texto, #e1e1e6);font-size:14px;box-sizing:border-box}.ui-tabela__erro-texto{flex:1 1 200px;min-width:0}.ui-tabela__erro-detalhe{display:block;margin-top:2px;font-size:12px;color:var(--ui-cor-texto-secundario, #9696a6);overflow-wrap:anywhere}.ui-tabela__erro-acao,.ui-tabela__prompt-actions button{background:var(--ui-cor-botao-secundario-fundo, rgba(255, 255, 255, .12));color:var(--ui-cor-texto, #e1e1e6);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));padding:6px 12px;border-radius:var(--ui-raio-sm, 4px);font:inherit;cursor:pointer}.ui-tabela__erro-acao:hover,.ui-tabela__prompt-actions button:hover{background:var(--ui-cor-botao-secundario-hover, rgba(255, 255, 255, .2))}.ui-tabela__erro-acao:focus-visible,.ui-tabela__prompt-actions button:focus-visible,.ui-tabela__prompt-dialog input:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px}.ui-tabela__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-tabela__loading{position:absolute;top:0;left:0;right:0;bottom:0;background:color-mix(in srgb,var(--ui-cor-superficie, #141417) 72%,transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;z-index:50;color:var(--ui-cor-texto, #e1e1e6);font-size:14px}.ui-tabela__spinner{width:32px;height:32px;border:3px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 15%,transparent);border-top-color:var(--ui-cor-primaria, #00E08A);border-radius:50%;animation:ui-tabela-spin .8s linear infinite}@keyframes ui-tabela-spin{to{transform:rotate(360deg)}}.ui-tabela__prompt-dialog{margin:0;max-width:calc(100vw - 16px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .2));border-radius:var(--ui-raio-borda, 6px);background:var(--ui-tabela-dialogo-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e)));color:var(--ui-cor-texto, #e1e1e6);padding:12px;box-shadow:var(--ui-sombra-lg, 0 8px 32px rgba(0, 0, 0, .8));font-family:inherit;font-size:14px}.ui-tabela__prompt-dialog::backdrop{background:#0000004d}.ui-tabela__prompt-title{display:block;margin-bottom:8px;font-weight:500}.ui-tabela__prompt-dialog input{width:100%;padding:6px 8px;border-radius:var(--ui-raio-sm, 4px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .2));background:var(--ui-cor-superficie, #141417);color:var(--ui-cor-texto, #e1e1e6);margin-bottom:8px;box-sizing:border-box;font:inherit}.ui-tabela__prompt-dialog input[aria-invalid=true]{border-color:var(--ui-cor-texto-erro, #ff5555)}.ui-tabela__prompt-erro{min-height:1.2em;margin-bottom:8px;font-size:12px;color:var(--ui-cor-texto-erro, #ff5555)}.ui-tabela__prompt-actions{display:flex;justify-content:flex-end;gap:8px}.ui-tabela__prompt-actions button:last-child{background:var(--ui-cor-primaria, #00E08A);border-color:transparent;color:var(--ui-cor-texto-sobre-primaria, #000000);font-weight:600}.ui-tabela__prompt-actions button:last-child:hover{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 85%,var(--ui-cor-texto, #e1e1e6))}@media (pointer: coarse){.ui-tabela__resizer{width:16px}:host(:not([altura-linha]):not([row-height])) .ui-tabela tbody tr[data-index]{height:44px}}@media (max-width: 640px){.ui-tabela th{padding:8px 10px;font-size:12px}.ui-tabela td{padding:8px 10px;font-size:13px}}@media (prefers-reduced-motion: reduce){.ui-tabela__resizer,.ui-tabela__sort-arrow path{transition:none}.ui-tabela__spinner{animation-duration:2.4s}}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-tabela-container[data-degrade]:not([data-degrade=false]){--ui-tabela-fundo: var(--ui-gradiente-superficie);--ui-tabela-cabecalho-fundo: var(--ui-gradiente-elevado);--ui-tabela-dialogo-fundo: var(--ui-gradiente-elevado)}';
319
+ function Ne(r) {
320
+ return r == null || r === "" ? "" : typeof r == "number" ? `${r}px` : r;
321
+ }
322
+ function De(r) {
323
+ return r === "centro" || r === "center" ? "ui-tabela--alinhar-centro" : r === "direita" || r === "right" ? "ui-tabela--alinhar-direita" : "ui-tabela--alinhar-esquerda";
324
+ }
325
+ function Re(r) {
326
+ return r === "centro" || r === "center" ? "center" : r === "direita" || r === "right" ? "right" : "left";
327
+ }
328
+ function xe(r) {
329
+ return r === "compacta" ? 30 : r === "relaxada" ? 56 : 42;
330
+ }
331
+ function ot(r, t, e, i) {
332
+ r.innerHTML = `<style>${it}</style>`;
333
+ const o = document.createElement("div");
334
+ o.className = "ui-tabela-container", o.setAttribute("part", "base"), e && (o.style.maxHeight = e);
335
+ const a = document.createElement("div");
336
+ a.className = "ui-tabela__empty", a.setAttribute("part", "vazio"), a.style.display = "none", a.setAttribute("role", "status");
337
+ const n = document.createElement("div");
338
+ n.innerHTML = `
339
+ <svg class="ui-tabela__empty-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
340
+ <path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"/>
341
+ </svg>`;
342
+ const s = document.createElement("span");
343
+ s.className = "ui-tabela__empty-text", s.textContent = t, a.appendChild(n), a.appendChild(s);
344
+ const l = document.createElement("table");
345
+ l.className = "ui-tabela", l.setAttribute("part", "tabela"), l.setAttribute("role", "grid");
346
+ const u = document.createElement("colgroup"), d = document.createElement("thead"), p = document.createElement("tbody");
347
+ l.appendChild(u), l.appendChild(d), l.appendChild(p);
348
+ const c = document.createElement("div");
349
+ c.className = "ui-tabela__erro", c.setAttribute("part", "erro"), c.setAttribute("role", "alert"), c.style.display = "none";
350
+ const h = document.createElement("div");
351
+ h.className = "ui-tabela__erro-texto";
352
+ const f = document.createElement("span");
353
+ f.className = "ui-tabela__erro-mensagem";
354
+ const m = document.createElement("span");
355
+ m.className = "ui-tabela__erro-detalhe", h.appendChild(f), h.appendChild(m);
356
+ const b = document.createElement("button");
357
+ b.type = "button", b.className = "ui-tabela__erro-acao", b.setAttribute("part", "erro-acao"), b.textContent = "Tentar novamente", c.appendChild(h), c.appendChild(b);
358
+ const g = document.createElement("div");
359
+ g.className = "ui-tabela__sr", g.setAttribute("role", "status"), g.setAttribute("aria-live", "polite"), o.appendChild(c), o.appendChild(l), o.appendChild(a), o.appendChild(g);
360
+ const y = document.createElement("div");
361
+ return y.className = "ui-tabela__loading", y.setAttribute("part", "carregando"), y.setAttribute("role", "status"), y.setAttribute("aria-live", "polite"), y.style.display = i ? "flex" : "none", y.innerHTML = `
362
+ <div class="ui-tabela__spinner" aria-hidden="true"></div>
363
+ <span class="ui-tabela__loading-texto">Carregando dados...</span>
364
+ `, o.appendChild(y), r.appendChild(o), {
365
+ containerElement: o,
366
+ tableElement: l,
367
+ theadElement: d,
368
+ tbodyElement: p,
369
+ colgroupElement: u,
370
+ emptyElement: a,
371
+ loadingElement: y,
372
+ erroElement: c,
373
+ anuncioElement: g
374
+ };
375
+ }
376
+ function at(r) {
377
+ var a, n;
378
+ if (!r.theadElement || !r.colgroupElement) return;
379
+ r.headerListeners.cleanup();
380
+ const e = r.theadElement.getRootNode().activeElement, i = e && r.theadElement.contains(e) ? ((a = e.closest("th")) == null ? void 0 : a.getAttribute("data-coluna")) ?? null : null;
381
+ r.theadElement.innerHTML = "", r.colgroupElement.innerHTML = "";
382
+ const o = document.createElement("tr");
383
+ if (o.setAttribute("aria-rowindex", "1"), r.colunas.forEach((s, l) => {
384
+ const u = document.createElement("col");
385
+ s.largura !== void 0 && (u.style.width = r.formatWidth(s.largura)), r.colgroupElement.appendChild(u);
386
+ const d = document.createElement("th"), p = r.getAlignmentClass(s.alinhamento);
387
+ if (d.className = p, d.setAttribute("part", "celula-cabecalho"), d.scope = "col", d.setAttribute("data-coluna", s.id), d.style.textAlign = r.getTextAlign(s.alinhamento), s.largura !== void 0 && (d.style.width = r.formatWidth(s.largura)), s.larguraMinima !== void 0 && (d.style.minWidth = r.formatWidth(s.larguraMinima)), s.larguraMaxima !== void 0) {
388
+ const x = r.formatWidth(s.larguraMaxima);
389
+ d.style.maxWidth = x, d.style.overflow = "hidden", d.style.textOverflow = "ellipsis", d.style.whiteSpace = "nowrap";
390
+ }
391
+ s.tooltip && (d.title = s.tooltip);
392
+ const c = !!s.ordenavel && r.colunaOrdenada === s.id && r.direcaoOrdenacao !== "original", h = c && r.direcaoOrdenacao === "desc";
393
+ if (s.ordenavel) {
394
+ d.classList.add("ui-tabela__th--ordenavel");
395
+ const x = () => r.onHeaderClick(s);
396
+ r.headerListeners.add(d, "click", x), d.setAttribute("aria-sort", c ? h ? "descending" : "ascending" : "none");
397
+ }
398
+ const f = (x) => r.onHeaderContextMenu(x, s, l, d);
399
+ r.headerListeners.add(d, "contextmenu", f);
400
+ const m = document.createElement("div");
401
+ m.className = "ui-tabela__header-content";
402
+ const b = document.createElement("span");
403
+ if (b.className = "ui-tabela__header-text", b.textContent = s.rotulo, m.appendChild(b), s.ordenavel) {
404
+ const x = document.createElement("span");
405
+ x.className = "ui-tabela__sort-icon";
406
+ const _ = c ? h ? "ui-tabela__sort-arrow--desc" : "ui-tabela__sort-arrow--asc" : "ui-tabela__sort-arrow--inativo";
407
+ x.setAttribute("aria-hidden", "true"), x.innerHTML = `<svg class="ui-tabela__sort-arrow ${_}" viewBox="0 0 24 24" focusable="false"><path class="seta-cima" d="M7 11l5-5 5 5H7z"/><path class="seta-baixo" d="M7 13l5 5 5-5H7z"/></svg>`, m.appendChild(x);
408
+ }
409
+ if (s.ordenavel) {
410
+ const x = document.createElement("button");
411
+ x.type = "button", x.className = "ui-tabela__ordenar", x.setAttribute("part", "ordenar"), x.appendChild(m), d.appendChild(x);
412
+ } else
413
+ d.appendChild(m);
414
+ const g = document.createElement("div");
415
+ g.className = "ui-tabela__resizer", g.setAttribute("part", "redimensionador"), g.title = "Arrastar para redimensionar largura (duplo-clique para auto-ajuste)", g.tabIndex = 0, g.setAttribute("role", "separator"), g.setAttribute("aria-orientation", "vertical"), g.setAttribute("aria-label", `Redimensionar coluna ${s.rotulo}`);
416
+ const y = (x) => r.onInitColumnResize(x, s, l, d, g);
417
+ r.headerListeners.add(g, "mousedown", y);
418
+ const E = (x) => {
419
+ const _ = x;
420
+ _.pointerType === "mouse" || !_.pointerType || r.onInitColumnResize(_, s, l, d, g);
421
+ };
422
+ r.headerListeners.add(g, "pointerdown", E);
423
+ const w = (x) => {
424
+ var A, z;
425
+ const _ = x, C = _.shiftKey ? 50 : 10;
426
+ if (_.key === "ArrowRight")
427
+ _.preventDefault(), (A = r.onResizeTeclado) == null || A.call(r, C, s, l, d, u);
428
+ else if (_.key === "ArrowLeft")
429
+ _.preventDefault(), (z = r.onResizeTeclado) == null || z.call(r, -C, s, l, d, u);
430
+ else if (_.key === "Enter" || _.key === "F2") {
431
+ _.preventDefault();
432
+ const k = d.getBoundingClientRect();
433
+ r.onHeaderContextMenu(new MouseEvent("contextmenu", { clientX: k.left, clientY: k.bottom }), s, l, d);
434
+ }
435
+ };
436
+ r.headerListeners.add(g, "keydown", w);
437
+ const L = (x) => {
438
+ x.stopPropagation(), r.onColumnAutoFit(s, d, u);
439
+ };
440
+ r.headerListeners.add(g, "dblclick", L), r.headerListeners.add(g, "click", (x) => x.stopPropagation()), d.appendChild(g), o.appendChild(d);
441
+ }), r.theadElement.appendChild(o), i !== null) {
442
+ const s = Array.from(o.children).find((l) => l.getAttribute("data-coluna") === i);
443
+ (n = s == null ? void 0 : s.querySelector(".ui-tabela__ordenar")) == null || n.focus();
444
+ }
445
+ }
446
+ const Y = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new WeakMap();
447
+ function W(r) {
448
+ return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement;
449
+ }
450
+ function Oe(r) {
451
+ return r instanceof HTMLInputElement && (r.type === "checkbox" || r.type === "radio") ? r.checked : r.value;
452
+ }
453
+ function nt(r) {
454
+ r.querySelectorAll("input, textarea, select").forEach((t) => {
455
+ W(t) && le.set(t, Oe(t));
456
+ });
457
+ }
458
+ function st(r) {
459
+ try {
460
+ const t = r;
461
+ return { inicio: t.selectionStart ?? null, fim: t.selectionEnd ?? null };
462
+ } catch {
463
+ return { inicio: null, fim: null };
464
+ }
465
+ }
466
+ function lt(r) {
467
+ const e = r.getRootNode().activeElement;
468
+ if (!e || e === r || !r.contains(e)) return null;
469
+ const i = e.closest("td"), o = i == null ? void 0 : i.closest("tr");
470
+ if (!i || !o || o.parentElement !== r || !o.hasAttribute("data-index")) return null;
471
+ const { inicio: a, fim: n } = st(e), s = W(e) ? le.get(e) : void 0, l = W(e) ? Oe(e) : void 0, u = s !== void 0 && l !== s;
472
+ return {
473
+ digitado: u ? l : void 0,
474
+ valorInicial: u ? s : void 0,
475
+ item: Y.get(o),
476
+ dataId: o.getAttribute("data-id"),
477
+ indiceLinha: Number(o.getAttribute("data-index")),
478
+ indiceColuna: Array.from(o.children).indexOf(i),
479
+ ordinal: Array.from(i.querySelectorAll("*")).indexOf(e),
480
+ selecaoInicio: a,
481
+ selecaoFim: n
482
+ };
483
+ }
484
+ function dt(r, t) {
485
+ const e = Array.from(r.querySelectorAll("tr[data-index]"));
486
+ if (t.item) {
487
+ const i = e.find((o) => Y.get(o) === t.item);
488
+ if (i) return i;
489
+ }
490
+ if (t.dataId !== null) {
491
+ const i = e.find((o) => o.getAttribute("data-id") === t.dataId);
492
+ if (i) return i;
493
+ }
494
+ return e.find((i) => Number(i.getAttribute("data-index")) === t.indiceLinha) ?? null;
495
+ }
496
+ function ct(r, t) {
497
+ if (!t) return;
498
+ const e = dt(r, t), i = e == null ? void 0 : e.children[t.indiceColuna], o = i == null ? void 0 : i.querySelectorAll("*")[t.ordinal];
499
+ if (!(!o || typeof o.focus != "function") && (o.focus({ preventScroll: !0 }), t.digitado !== void 0 && W(o) && le.get(o) === t.valorInicial && (typeof t.digitado == "boolean" ? o.checked = t.digitado : o.value = t.digitado), t.selecaoInicio !== null && t.selecaoFim !== null))
500
+ try {
501
+ o.setSelectionRange(t.selecaoInicio, t.selecaoFim);
502
+ } catch {
503
+ }
504
+ }
505
+ const ut = [
506
+ "button",
507
+ "input",
508
+ "select",
509
+ "textarea",
510
+ "a",
511
+ "summary",
512
+ "label",
513
+ '[role="button"]',
514
+ '[role="checkbox"]',
515
+ '[role="switch"]',
516
+ '[role="radio"]',
517
+ '[role="textbox"]',
518
+ '[role="combobox"]',
519
+ '[role="slider"]',
520
+ '[role="spinbutton"]',
521
+ '[role="menuitem"]',
522
+ '[role="tab"]',
523
+ '[role="link"]',
524
+ '[contenteditable]:not([contenteditable="false"])',
525
+ "[data-prevent-select]"
526
+ ].join(", "), Te = /* @__PURE__ */ new WeakMap();
527
+ function pt(r, t) {
528
+ for (const e of r.composedPath()) {
529
+ if (e === t) return !1;
530
+ if (e instanceof Element && e.matches(ut)) return !0;
531
+ }
532
+ return !1;
533
+ }
534
+ function X(r, t, e) {
535
+ const i = document.createElement("tr");
536
+ i.className = "ui-tabela__virtual-spacer", i.setAttribute("data-espacador", r), i.setAttribute("aria-hidden", "true"), i.style.height = `${t}px`;
537
+ const o = document.createElement("td");
538
+ return o.colSpan = e, i.appendChild(o), i;
539
+ }
540
+ function ht(r, t, e, i) {
541
+ const o = document.createElement("td"), a = r.getAlignmentClass(t.alinhamento);
542
+ if (o.className = a, o.setAttribute("part", "celula"), o.style.textAlign = r.getTextAlign(t.alinhamento), t.larguraMaxima !== void 0) {
543
+ const l = r.formatWidth(t.larguraMaxima);
544
+ o.style.maxWidth = l, o.style.overflow = "hidden", o.style.textOverflow = "ellipsis", o.style.whiteSpace = "nowrap";
545
+ }
546
+ const n = document.createElement("div");
547
+ n.className = "ui-tabela__cell-content", t.larguraMaxima !== void 0 && n.classList.add("ui-tabela__cell-truncate");
548
+ const s = e[t.id];
549
+ if (typeof t.render == "function")
550
+ try {
551
+ const l = r.indiceOriginal ? r.indiceOriginal(e) : i, u = t.render(s, e, i, l);
552
+ u instanceof Node ? n.appendChild(u) : n.textContent = String(u ?? "");
553
+ } catch (l) {
554
+ console.error(`[ui-tabela] Erro no render da coluna "${t.id}" (linha ${i}):`, l), n.textContent = "";
555
+ }
556
+ else if (s instanceof Node)
557
+ n.appendChild(s);
558
+ else {
559
+ const l = s != null ? String(s) : "";
560
+ n.textContent = l, t.larguraMaxima !== void 0 && !t.tooltip && (o.title = l);
561
+ }
562
+ return o.appendChild(n), nt(o), o;
563
+ }
564
+ function Be(r, t, e, i) {
565
+ const o = document.createElement("tr");
566
+ Y.set(o, t), Te.set(o, r.colunas), o.setAttribute("data-index", String(e)), o.setAttribute("part", "linha"), o.setAttribute("aria-rowindex", String(e + 2)), o.setAttribute("aria-selected", "false"), o.tabIndex = e === i ? 0 : -1, e % 2 === 1 && o.classList.add("ui-tabela__tr--par");
567
+ const a = r.chaveId;
568
+ return t[a] !== void 0 ? o.setAttribute("data-id", String(t[a])) : t.id !== void 0 ? o.setAttribute("data-id", String(t.id)) : t._id !== void 0 && o.setAttribute("data-id", String(t._id)), r.isItemSelecionado(t, e) && (o.classList.add("ui-tabela__tr--selecionada"), o.setAttribute("part", "linha linha-selecionada"), o.setAttribute("aria-current", "true"), o.setAttribute("aria-selected", "true"), o.setAttribute("data-selecionada", "true")), o.addEventListener("click", (n) => {
569
+ pt(n, o) || r.onLinhaClique(t, e);
570
+ }), r.colunas.forEach((n) => {
571
+ o.appendChild(ht(r, n, t, e));
572
+ }), o;
573
+ }
574
+ function ft(r, t, e, i, o) {
575
+ t.tabIndex = i === o ? 0 : -1;
576
+ const a = r.isItemSelecionado(e, i);
577
+ a !== t.classList.contains("ui-tabela__tr--selecionada") && (t.classList.toggle("ui-tabela__tr--selecionada", a), R(t, "linha-selecionada", a), t.setAttribute("aria-selected", String(a)), a ? (t.setAttribute("aria-current", "true"), t.setAttribute("data-selecionada", "true")) : (t.removeAttribute("aria-current"), t.removeAttribute("data-selecionada")));
578
+ }
579
+ function mt(r, t, e, i, o) {
580
+ return e >= i && e < o && Y.get(t) === r.dadosExibicao[e] && Te.get(t) === r.colunas;
581
+ }
582
+ function gt(r, t, e, i, o, a, n) {
583
+ const s = r.dadosExibicao.length, l = r.colunas.length || 1, u = /* @__PURE__ */ new Map();
584
+ let d = null, p = null;
585
+ for (const m of Array.from(t.children)) {
586
+ const b = m.getAttribute("data-espacador");
587
+ if (b === "topo") {
588
+ d = m;
589
+ continue;
590
+ }
591
+ if (b === "base") {
592
+ p = m;
593
+ continue;
594
+ }
595
+ const g = Number(m.getAttribute("data-index"));
596
+ m.hasAttribute("data-index") && !u.has(g) && mt(r, m, g, e, i) ? u.set(g, m) : m.remove();
597
+ }
598
+ const c = a && e > 0 ? e * o : 0;
599
+ c > 0 ? d ? (d.style.height = `${c}px`, d.firstElementChild.colSpan = l) : (d = X("topo", c, l), t.insertBefore(d, t.firstChild)) : d && (d.remove(), d = null);
600
+ let h = d ? d.nextSibling : t.firstChild;
601
+ for (let m = e; m < i; m++) {
602
+ const b = r.dadosExibicao[m], g = u.get(m);
603
+ g ? (ft(r, g, b, m, n), g === h ? h = g.nextSibling : t.insertBefore(g, h)) : t.insertBefore(Be(r, b, m, n), h);
604
+ }
605
+ const f = a && i < s ? (s - i) * o : 0;
606
+ f > 0 ? p ? (p.style.height = `${f}px`, p.firstElementChild.colSpan = l, p.nextSibling && t.appendChild(p)) : t.appendChild(X("base", f, l)) : p && p.remove();
607
+ }
608
+ function bt(r, t, e, i, o, a, n) {
609
+ const s = r.dadosExibicao.length, l = r.colunas.length || 1;
610
+ t.innerHTML = "";
611
+ const u = document.createDocumentFragment();
612
+ a && e > 0 && u.appendChild(X("topo", e * o, l));
613
+ for (let d = e; d < i; d++)
614
+ u.appendChild(Be(r, r.dadosExibicao[d], d, n));
615
+ a && i < s && u.appendChild(X("base", (s - i) * o, l)), t.appendChild(u);
616
+ }
617
+ function vt(r) {
618
+ if (!r.tbodyElement || !r.tableElement || !r.emptyElement || !r.containerElement) return;
619
+ if (r.tableElement.setAttribute("aria-colcount", String(r.colunas.length)), !r.dadosExibicao || r.dadosExibicao.length === 0) {
620
+ r.tbodyElement.innerHTML = "", r.tableElement.setAttribute("aria-rowcount", "1"), r.tableElement.style.display = r.colunas.length > 0 ? "table" : "none", r.emptyElement.style.display = "flex";
621
+ const h = r.emptyElement.querySelector(".ui-tabela__empty-text"), f = r.filtroAtivo ? r.textoSemResultados : r.textoVazio;
622
+ h && f !== void 0 && (h.textContent = f);
623
+ return;
624
+ }
625
+ r.emptyElement.style.display = "none", r.tableElement.style.display = "table", r.tableElement.setAttribute("aria-rowcount", String(r.dadosExibicao.length + 1));
626
+ const t = r.dadosExibicao.length, e = r.rowHeight, i = r.virtualizar && t > 30;
627
+ let o = 0, a = t;
628
+ if (i) {
629
+ const h = r.containerElement.scrollTop, f = r.containerElement.clientHeight || 400, m = 5;
630
+ o = Math.max(0, Math.floor(h / e) - m), a = Math.min(t, Math.ceil((h + f) / e) + m);
631
+ }
632
+ const n = r.tbodyElement, s = n.getRootNode(), l = s.activeElement, u = l && l.parentElement === n ? l.getAttribute("data-index") : null, d = lt(n), p = r.indiceAtivo ?? null, c = p !== null && p >= o && p < a ? p : o;
633
+ if (r.modo === "rolagem" ? gt(r, n, o, a, e, i, c) : bt(r, n, o, a, e, i, c), u !== null) {
634
+ const h = n.querySelector(`tr[data-index="${u}"]`);
635
+ h && s.activeElement !== h && h.focus({ preventScroll: !0 });
636
+ } else d && !(l && l.isConnected) && ct(n, d);
637
+ }
638
+ function ye(r) {
639
+ if (r === void 0) return null;
640
+ const t = typeof r == "number" ? r : parseInt(r, 10);
641
+ return isNaN(t) ? null : t;
642
+ }
643
+ function de(r, t) {
644
+ const e = ye(r.larguraMinima);
645
+ let i = Math.max(e ?? 60, t);
646
+ const o = ye(r.larguraMaxima);
647
+ return o !== null && (i = Math.min(o, i)), i;
648
+ }
649
+ function _t(r, t, e, i) {
650
+ const o = de(r, t.offsetWidth + i);
651
+ return r.largura = `${o}px`, t.style.width = `${o}px`, e && (e.style.width = `${o}px`), `${o}px`;
652
+ }
653
+ function xt(r) {
654
+ const {
655
+ evento: t,
656
+ coluna: e,
657
+ colIndex: i,
658
+ thElement: o,
659
+ resizer: a,
660
+ colgroupElement: n,
661
+ onResizeStart: s,
662
+ onResizeEnd: l,
663
+ onResizeCancel: u
664
+ } = r;
665
+ t.stopPropagation(), t.preventDefault(), s(), a.classList.add("ui-tabela__resizer--ativo");
666
+ const d = t.pageX, p = o.offsetWidth, c = n == null ? void 0 : n.children[i], h = t.type === "pointerdown", f = h ? t.pointerId : null, m = h ? "pointermove" : "mousemove", b = h ? "pointerup" : "mouseup";
667
+ let g = !1;
668
+ const y = (L) => {
669
+ const x = L;
670
+ if (f !== null && x.pointerId !== f) return;
671
+ g = !0;
672
+ const _ = de(e, p + (x.pageX - d));
673
+ e.largura = `${_}px`, o.style.width = `${_}px`, c && (c.style.width = `${_}px`);
674
+ }, E = () => {
675
+ w(), g ? l(String(e.largura)) : u == null || u();
676
+ }, w = () => {
677
+ a.classList.remove("ui-tabela__resizer--ativo"), window.removeEventListener(m, y), window.removeEventListener(b, E), h && window.removeEventListener("pointercancel", E);
678
+ };
679
+ return window.addEventListener(m, y), window.addEventListener(b, E), h && window.addEventListener("pointercancel", E), w;
680
+ }
681
+ const H = 20;
682
+ let yt = 0;
683
+ function Et(r) {
684
+ var z;
685
+ const {
686
+ evento: t,
687
+ coluna: e,
688
+ colIndex: i,
689
+ thElement: o,
690
+ colgroupElement: a,
691
+ shadow: n,
692
+ onResizeEnd: s
693
+ } = r, l = `ui-tabela-dlg-${++yt}`, u = document.createElement("dialog");
694
+ u.className = "ui-tabela__prompt-dialog", u.setAttribute("part", "dialogo"), u.setAttribute("aria-labelledby", `${l}-titulo`);
695
+ const d = document.createElement("label");
696
+ d.className = "ui-tabela__prompt-title", d.id = `${l}-titulo`, d.htmlFor = `${l}-campo`, d.textContent = `Largura de "${e.rotulo}" (px; vazio = automática)`;
697
+ const p = document.createElement("input");
698
+ p.id = `${l}-campo`, p.type = "number", p.min = String(H), p.step = "1", p.setAttribute("inputmode", "numeric"), p.placeholder = "auto";
699
+ const c = e.largura ? parseInt(String(e.largura), 10) : NaN;
700
+ p.value = Number.isFinite(c) ? String(c) : "";
701
+ const h = document.createElement("div");
702
+ h.className = "ui-tabela__prompt-erro", h.id = `${l}-erro`, h.setAttribute("role", "alert");
703
+ const f = document.createElement("div");
704
+ f.className = "ui-tabela__prompt-actions";
705
+ const m = document.createElement("button");
706
+ m.type = "button", m.textContent = "Aplicar";
707
+ const b = document.createElement("button");
708
+ b.type = "button", b.textContent = "Cancelar", f.appendChild(b), f.appendChild(m), u.appendChild(d), u.appendChild(p), u.appendChild(h), u.appendChild(f), n.appendChild(u), typeof u.showModal == "function" ? u.showModal() : u.setAttribute("open", ""), u.style.position = "fixed";
709
+ const g = u.getBoundingClientRect(), y = g.width || 240, E = g.height || 140, w = Math.max(8, Math.min(t.clientX || 0, window.innerWidth - y - 8)), L = Math.max(8, Math.min(t.clientY || 0, window.innerHeight - E - 8));
710
+ u.style.left = `${w}px`, u.style.top = `${L}px`;
711
+ let x = !1;
712
+ const _ = () => {
713
+ var k;
714
+ x || (x = !0, u.open && typeof u.close == "function" && u.close(), u.remove(), (k = o.querySelector(".ui-tabela__ordenar, .ui-tabela__resizer")) == null || k.focus());
715
+ }, C = (k) => {
716
+ h.textContent = k, p.setAttribute("aria-invalid", "true"), p.setAttribute("aria-describedby", h.id), p.focus();
717
+ }, A = () => {
718
+ const k = e.largura, be = p.value.trim();
719
+ if (be === "")
720
+ e.largura = void 0, o.style.width = "", a != null && a.children[i] && (a.children[i].style.width = "");
721
+ else {
722
+ const te = Number(be);
723
+ if (!Number.isFinite(te) || te < H) {
724
+ C(`Informe um valor de pelo menos ${H} px, ou deixe vazio para automática.`);
725
+ return;
726
+ }
727
+ const re = Math.round(de({ ...e, larguraMinima: e.larguraMinima ?? H }, te));
728
+ e.largura = `${re}px`, o.style.width = `${re}px`, a != null && a.children[i] && (a.children[i].style.width = `${re}px`);
729
+ }
730
+ _(), e.largura !== k && s(e.largura ? String(e.largura) : "auto");
731
+ };
732
+ m.addEventListener("click", (k) => {
733
+ k.stopPropagation(), A();
734
+ }), b.addEventListener("click", (k) => {
735
+ k.stopPropagation(), _();
736
+ }), u.addEventListener("close", _), p.addEventListener("input", () => {
737
+ h.textContent = "", p.removeAttribute("aria-invalid"), p.removeAttribute("aria-describedby");
738
+ }), p.addEventListener("keydown", (k) => {
739
+ k.key === "Enter" ? (k.preventDefault(), A()) : k.key === "Escape" && (k.preventDefault(), _());
740
+ }), p.focus(), (z = p.select) == null || z.call(p);
741
+ }
742
+ function wt(r, t, e, i, o, a) {
743
+ return xt({
744
+ evento: r,
745
+ coluna: t,
746
+ colIndex: e,
747
+ thElement: i,
748
+ resizer: o,
749
+ colgroupElement: a.colgroupElement,
750
+ onResizeStart: () => a.onSetIsResizing(!0),
751
+ onResizeCancel: () => {
752
+ setTimeout(() => a.onSetIsResizing(!1), 50);
753
+ },
754
+ onResizeEnd: (n) => {
755
+ setTimeout(() => a.onSetIsResizing(!1), 50), a.host.dispatchEvent(
756
+ new CustomEvent("ui-column-resize", {
757
+ detail: { idColuna: t.id, largura: n },
758
+ bubbles: !0,
759
+ composed: !0
760
+ })
761
+ );
762
+ }
763
+ });
764
+ }
765
+ function At(r, t, e, i, o) {
766
+ r.preventDefault(), r.stopPropagation(), Et({
767
+ evento: r,
768
+ coluna: t,
769
+ colIndex: e,
770
+ thElement: i,
771
+ colgroupElement: o.colgroupElement,
772
+ shadow: o.shadow,
773
+ onResizeEnd: (a) => {
774
+ o.host.dispatchEvent(
775
+ new CustomEvent("ui-column-resize", {
776
+ detail: { idColuna: t.id, largura: a },
777
+ bubbles: !0,
778
+ composed: !0
779
+ })
780
+ );
781
+ }
782
+ });
783
+ }
784
+ function Ct(r, t, e, i, o) {
785
+ const a = _t(t, e, i, r);
786
+ o.host.dispatchEvent(
787
+ new CustomEvent("ui-column-resize", {
788
+ detail: { idColuna: t.id, largura: a },
789
+ bubbles: !0,
790
+ composed: !0
791
+ })
792
+ );
793
+ }
794
+ function kt(r) {
795
+ at({
796
+ theadElement: r.theadElement,
797
+ colgroupElement: r.colgroupElement,
798
+ colunas: r.colunas,
799
+ colunaOrdenada: r.dadosController.getColunaOrdenada(),
800
+ direcaoOrdenacao: r.dadosController.getDirecaoOrdenacao(),
801
+ headerListeners: r.headerListeners,
802
+ formatWidth: Ne,
803
+ getAlignmentClass: De,
804
+ getTextAlign: Re,
805
+ onHeaderClick: (t) => r.onHeaderClick(t),
806
+ onHeaderContextMenu: (t, e, i, o) => {
807
+ At(t, e, i, o, {
808
+ host: r.host,
809
+ colgroupElement: r.colgroupElement,
810
+ shadow: r.shadow,
811
+ onSetIsResizing: r.onSetIsResizing
812
+ });
813
+ },
814
+ onInitColumnResize: (t, e, i, o, a) => {
815
+ const n = wt(t, e, i, o, a, {
816
+ host: r.host,
817
+ colgroupElement: r.colgroupElement,
818
+ shadow: r.shadow,
819
+ onSetIsResizing: r.onSetIsResizing
820
+ });
821
+ r.onActiveResizeCleanup(n);
822
+ },
823
+ onResizeTeclado: (t, e, i, o, a) => {
824
+ Ct(t, e, o, a, {
825
+ host: r.host,
826
+ colgroupElement: r.colgroupElement,
827
+ shadow: r.shadow,
828
+ onSetIsResizing: r.onSetIsResizing
829
+ });
830
+ },
831
+ onColumnAutoFit: (t, e, i) => {
832
+ t.largura = void 0, e.style.width = "", i.style.width = "", r.host.dispatchEvent(
833
+ new CustomEvent("ui-column-resize", {
834
+ bubbles: !0,
835
+ composed: !0,
836
+ detail: { idColuna: t.id, largura: "auto" }
837
+ })
838
+ );
839
+ }
840
+ });
841
+ }
842
+ function St(r) {
843
+ vt({
844
+ tbodyElement: r.tbodyElement,
845
+ tableElement: r.tableElement,
846
+ emptyElement: r.emptyElement,
847
+ containerElement: r.containerElement,
848
+ dadosExibicao: r.dadosController.getDadosExibicao(),
849
+ colunas: r.colunas,
850
+ chaveId: r.chaveId,
851
+ virtualizar: r.virtualizar,
852
+ rowHeight: r.rowHeight,
853
+ indiceAtivo: r.indiceAtivo,
854
+ filtroAtivo: r.dadosController.temFiltro(),
855
+ modo: r.modoCorpo,
856
+ indiceOriginal: (t) => r.dadosController.indiceOriginal(t),
857
+ textoVazio: r.textoVazio,
858
+ textoSemResultados: r.textoSemResultados,
859
+ isItemSelecionado: (t, e) => r.selecaoController.isItemSelecionado(t, e),
860
+ onLinhaClique: (t, e) => {
861
+ r.selecaoController.setItemSelecionado(t), r.host.dispatchEvent(
862
+ new CustomEvent("ui-linha-clique", {
863
+ bubbles: !0,
864
+ composed: !0,
865
+ detail: { item: t, indice: e }
866
+ })
867
+ );
868
+ },
869
+ formatWidth: Ne,
870
+ getAlignmentClass: De,
871
+ getTextAlign: Re
872
+ });
873
+ }
874
+ function zt(r, t) {
875
+ let e = !1;
876
+ const i = () => {
877
+ e || (window.requestAnimationFrame(() => {
878
+ try {
879
+ t();
880
+ } finally {
881
+ e = !1;
882
+ }
883
+ }), e = !0);
884
+ };
885
+ return r.addEventListener("scroll", i), i;
886
+ }
887
+ function Lt(r, t, e, i) {
888
+ return ot(r, t, e, i);
889
+ }
890
+ function Ie(r) {
891
+ const t = r.host.getAttribute("texto-vazio") || r.host.getAttribute("empty-text");
892
+ t && r.onTextoVazioAlterado(t);
893
+ const e = r.host.getAttribute("virtualizar") || r.host.getAttribute("virtualize");
894
+ e !== null && r.onVirtualizarAlterado(e !== "false"), r.onSrcLido(r.host.getAttribute("src"));
895
+ const i = r.host.hasAttribute("carregando") || r.host.hasAttribute("loading");
896
+ r.onCarregandoAlterado(i), r.loadingElement && (r.loadingElement.style.display = i ? "flex" : "none");
897
+ }
898
+ function Mt(r, t, e) {
899
+ if (Ie(e), r === "src") {
900
+ t && e.host.isConnected && e.onCarregarSrc(t);
901
+ return;
902
+ }
903
+ if (r === "max-height" && e.containerElement) {
904
+ e.containerElement.style.maxHeight = t || "";
905
+ return;
906
+ }
907
+ if ((r === "texto-vazio" || r === "empty-text") && e.emptyElement) {
908
+ const i = e.emptyElement.querySelector(".ui-tabela__empty-text");
909
+ i && t && (i.textContent = t), e.onRenderBody();
910
+ return;
911
+ }
912
+ if (r === "carregando" || r === "loading") {
913
+ e.loadingElement && (e.loadingElement.style.display = t !== null ? "flex" : "none");
914
+ return;
915
+ }
916
+ if (!(r === "aria-label" || r === "texto-erro" || r === "texto-carregando")) {
917
+ if (r === "texto-sem-resultados" || r === "densidade" || r === "density") {
918
+ e.onRenderBody();
919
+ return;
920
+ }
921
+ e.onRenderTotal();
922
+ }
923
+ }
924
+ function Nt(r, t, e, i) {
925
+ if (r === "Enter" || r === " ") return { tipo: "ativar" };
926
+ if (!Number.isInteger(t) || !Number.isInteger(e) || e < 0) return null;
927
+ const o = Math.max(1, Math.floor(Number.isFinite(i) ? i : 1)), a = (n) => Math.min(e, Math.max(0, n));
928
+ switch (r) {
929
+ case "ArrowDown":
930
+ return { tipo: "mover", indice: a(t + 1) };
931
+ case "ArrowUp":
932
+ return { tipo: "mover", indice: a(t - 1) };
933
+ case "Home":
934
+ return { tipo: "mover", indice: 0 };
935
+ case "End":
936
+ return { tipo: "mover", indice: e };
937
+ case "PageDown":
938
+ return { tipo: "mover", indice: a(t + o) };
939
+ case "PageUp":
940
+ return { tipo: "mover", indice: a(t - o) };
941
+ default:
942
+ return null;
943
+ }
944
+ }
945
+ const Dt = "Não foi possível carregar os dados.", Rt = "Nenhum resultado para o filtro";
946
+ function Ot(r, t, e, i) {
947
+ if (!r) return;
948
+ if (!t) {
949
+ r.style.display = "none";
950
+ return;
951
+ }
952
+ const o = r.querySelector(".ui-tabela__erro-mensagem"), a = r.querySelector(".ui-tabela__erro-detalhe");
953
+ o && (o.textContent = e || Dt), a && (a.textContent = t.erro || "");
954
+ const n = r.querySelector(".ui-tabela__erro-acao");
955
+ n && (n.style.display = i ? "" : "none"), r.style.display = "flex";
956
+ }
957
+ function Tt(r, t, e, i) {
958
+ if (!r) return;
959
+ const o = e ? t === 0 ? i : `${t} ${t === 1 ? "registro encontrado" : "registros encontrados"}` : "";
960
+ r.textContent !== o && (r.textContent = o);
961
+ }
962
+ function Bt({ tabela: r, container: t }, e, i) {
963
+ r && (e ? r.setAttribute("aria-label", e) : r.removeAttribute("aria-label"), r.setAttribute("aria-busy", String(i)), t && (e ? (t.setAttribute("role", "region"), t.setAttribute("aria-label", e)) : (t.removeAttribute("role"), t.removeAttribute("aria-label"))));
964
+ }
965
+ const It = 800;
966
+ function Ee(r, t, e) {
967
+ const i = r.getBoundingClientRect(), o = t.getBoundingClientRect(), a = i.top + r.clientTop + e, n = i.top + r.clientTop + r.clientHeight;
968
+ return o.top < a ? o.top - a : o.bottom > n ? Math.min(o.bottom - n, o.top - a) : 0;
969
+ }
970
+ function we(r, t, e) {
971
+ e === "smooth" && typeof r.scrollTo == "function" ? r.scrollTo({ top: t, behavior: "smooth" }) : r.scrollTop = t;
972
+ }
973
+ class Pt {
974
+ constructor(t) {
975
+ v(this, "cancelarCorrecao", null);
976
+ this.p = t;
977
+ }
978
+ alturaCabecalho() {
979
+ var t;
980
+ return ((t = this.p.cabecalho()) == null ? void 0 : t.offsetHeight) ?? 0;
981
+ }
982
+ /** Linhas inteiras que cabem na área visível (mínimo 1). */
983
+ linhasPorPagina() {
984
+ var e;
985
+ const t = (((e = this.p.container()) == null ? void 0 : e.clientHeight) ?? 0) - this.alturaCabecalho();
986
+ return Math.max(1, Math.floor(t / this.p.alturaLinha()));
987
+ }
988
+ /** Foca a linha, renderizando a janela virtual se necessário, e a mantém visível abaixo do cabeçalho fixo. */
989
+ focar(t) {
990
+ const e = this.p.container(), i = this.p.tbody();
991
+ if (!e || !i) return;
992
+ this.p.aoLinhaAtiva(t);
993
+ const o = `tr[data-index="${t}"]`;
994
+ let a = i.querySelector(o);
995
+ if (a || (e.scrollTop = Math.max(0, t * this.p.alturaLinha() - e.clientHeight / 2), this.p.renderizarCorpo(), a = i.querySelector(o)), !a) return;
996
+ a.focus({ preventScroll: !0 });
997
+ const n = Ee(e, a, this.alturaCabecalho());
998
+ n && (e.scrollTop += n);
999
+ }
1000
+ /**
1001
+ * Posiciona a linha exibida `indice` na área visível.
1002
+ * Fora da janela virtual, rola até a posição estimada, renderiza a janela e corrige pela posição
1003
+ * real da linha. No modo suave a correção ocorre ao fim da animação (`scrollend`, com timeout de
1004
+ * segurança para navegadores sem o evento ou quando não há rolagem a fazer).
1005
+ */
1006
+ posicionar(t, e) {
1007
+ const i = this.p.container(), o = this.p.tbody();
1008
+ if (!i || !o) return !1;
1009
+ this.cancelar();
1010
+ const a = () => o.querySelector(`tr[data-index="${t}"]`), n = (p) => {
1011
+ const c = a();
1012
+ if (!c) return;
1013
+ const h = Ee(i, c, this.alturaCabecalho());
1014
+ h && we(i, i.scrollTop + h, p);
1015
+ };
1016
+ if (a())
1017
+ return n(e), !0;
1018
+ const s = () => {
1019
+ i.scrollTop = Math.max(0, t * this.p.alturaLinha()), this.p.renderizarCorpo(), n("auto"), this.p.renderizarCorpo();
1020
+ };
1021
+ if (e === "auto")
1022
+ return s(), !0;
1023
+ we(i, Math.max(0, t * this.p.alturaLinha()), "smooth");
1024
+ let l = !0;
1025
+ const u = () => {
1026
+ l && (this.cancelar(), this.p.renderizarCorpo(), a() ? n("smooth") : s());
1027
+ }, d = window.setTimeout(u, It);
1028
+ return i.addEventListener("scrollend", u, { once: !0 }), this.cancelarCorrecao = () => {
1029
+ l = !1, window.clearTimeout(d), i.removeEventListener("scrollend", u), this.cancelarCorrecao = null;
1030
+ }, !0;
1031
+ }
1032
+ /** Cancela a correção pendente de uma rolagem suave (nova rolagem, desconexão). */
1033
+ cancelar() {
1034
+ var t;
1035
+ (t = this.cancelarCorrecao) == null || t.call(this);
1036
+ }
1037
+ }
1038
+ class Ft extends ze {
1039
+ constructor() {
1040
+ super();
1041
+ v(this, "shadow");
1042
+ v(this, "_colunas", []);
1043
+ v(this, "_textoVazio", "Nenhum registro encontrado");
1044
+ v(this, "_virtualizar", !0);
1045
+ v(this, "_isResizing", !1);
1046
+ v(this, "_carregando", !1);
1047
+ v(this, "_src", null);
1048
+ v(this, "_fetchOpcoes", null);
1049
+ v(this, "_fetcher", null);
1050
+ v(this, "_containerElement", null);
1051
+ v(this, "_tableElement", null);
1052
+ v(this, "_theadElement", null);
1053
+ v(this, "_tbodyElement", null);
1054
+ v(this, "_colgroupElement", null);
1055
+ v(this, "_emptyElement", null);
1056
+ v(this, "_loadingElement", null);
1057
+ v(this, "_erroElement", null);
1058
+ v(this, "_anuncioElement", null);
1059
+ /** Último erro de carregamento remoto (null = sem erro). */
1060
+ v(this, "_erro", null);
1061
+ v(this, "_scrollHandler", null);
1062
+ v(this, "_activeResizeCleanup", null);
1063
+ v(this, "_headerListeners", new j());
1064
+ v(this, "_corpoListeners", new j());
1065
+ /** Linha com o foco móvel (navegação por teclado); null = primeira linha visível. */
1066
+ v(this, "_indiceAtivo", null);
1067
+ /** Altura real das linhas medida no DOM; null = usa a estimativa da densidade. */
1068
+ v(this, "_alturaLinhaMedida", null);
1069
+ v(this, "rolagem", new Pt({
1070
+ container: () => this._containerElement,
1071
+ tbody: () => this._tbodyElement,
1072
+ cabecalho: () => this._theadElement,
1073
+ alturaLinha: () => this.getRowHeight(),
1074
+ renderizarCorpo: () => this.renderBody("rolagem"),
1075
+ aoLinhaAtiva: (e) => {
1076
+ this._indiceAtivo = e;
1077
+ }
1078
+ }));
1079
+ v(this, "remotaController");
1080
+ v(this, "selecaoController");
1081
+ v(this, "dadosController", new rt());
1082
+ /** Mantém um único tabindex=0 (foco móvel): Tab entra na tabela pela última linha ativa. */
1083
+ v(this, "handleFocoLinha", (e) => {
1084
+ const i = e.target;
1085
+ i.parentElement !== this._tbodyElement || !i.hasAttribute("data-index") || this.definirLinhaAtiva(Number(i.getAttribute("data-index")));
1086
+ });
1087
+ /**
1088
+ * Teclado nas linhas: setas, Home/End e PageUp/PageDown movem o foco;
1089
+ * Enter/Espaço selecionam a linha (mesmo caminho do clique, emite `ui-linha-clique`).
1090
+ */
1091
+ v(this, "handleTecladoCorpo", (e) => {
1092
+ const i = e.target;
1093
+ if (i.parentElement !== this._tbodyElement || !i.hasAttribute("data-index")) return;
1094
+ const o = this.dadosController.getDadosExibicao().length - 1, a = Nt(e.key, Number(i.getAttribute("data-index")), o, this.rolagem.linhasPorPagina());
1095
+ a && (e.preventDefault(), a.tipo === "ativar" ? i.click() : this.rolagem.focar(a.indice));
1096
+ });
1097
+ this.shadow = this.attachShadow({ mode: "open" }), this.remotaController = new Xe({
1098
+ host: this,
1099
+ onCarregandoAlterado: (e) => {
1100
+ this.carregando = e;
1101
+ },
1102
+ onDadosRecebidos: (e) => {
1103
+ this.dados = e;
1104
+ },
1105
+ getOpcoes: () => this._fetchOpcoes,
1106
+ getFetcher: () => this._fetcher
1107
+ }), this.selecaoController = new Je({
1108
+ host: this,
1109
+ getTbody: () => this._tbodyElement,
1110
+ getDadosExibicao: () => this.dadosController.getDadosExibicao(),
1111
+ getDadosOriginais: () => this.dadosController.getDadosOriginais(),
1112
+ getChaveId: () => this.chaveId,
1113
+ onRolarParaIndice: (e, i) => this.rolagem.posicionar(e, i),
1114
+ onLinhaAtiva: (e) => this.definirLinhaAtiva(e)
1115
+ }), this.addEventListener("ui-fetch-erro", (e) => this.mostrarErro(e.detail)), this.addEventListener("ui-fetch-start", () => this.mostrarErro(null)), this.addEventListener("ui-fetch-sucesso", () => this.mostrarErro(null));
1116
+ }
1117
+ static get observedAttributes() {
1118
+ return ["texto-vazio", "empty-text", "max-height", "densidade", "density", "altura-linha", "row-height", "virtualizar", "virtualize", "src", "carregando", "loading", "chave-id", "id-key", "aria-label", "ordenacao-remota", "texto-erro", "texto-sem-resultados", "texto-carregando", ...Le];
1119
+ }
1120
+ connectedCallback() {
1121
+ this.syncAttributes(), this.alturaLinha && this.style.setProperty("--ui-tabela-altura-linha", `${this.alturaLinha}px`), !this.hasAttribute("densidade") && !this.hasAttribute("density") && this.setAttribute("densidade", "normal"), this.renderTotal(), this._src && this.remotaController.carregar(this._src);
1122
+ }
1123
+ disconnectedCallback() {
1124
+ this.cleanupEventListeners();
1125
+ }
1126
+ attributeChangedCallback(e, i, o) {
1127
+ if (Me(e)) {
1128
+ U(this, this._containerElement);
1129
+ return;
1130
+ }
1131
+ e === "ordenacao-remota" && (this.dadosController.setOrdenacaoRemota(o !== null), this.atualizarContextoSelecao()), (e === "densidade" || e === "density" || e === "altura-linha" || e === "row-height") && (this._alturaLinhaMedida = null), (e === "altura-linha" || e === "row-height") && this.aplicarAlturaLinha(), (e === "chave-id" || e === "id-key") && this.atualizarContextoSelecao(), Mt(e, o, this.obterContextoAtributos()), this.sincronizarAria();
1132
+ }
1133
+ /** Nome acessível vem do host (`aria-label`); `aria-busy` acompanha o carregamento remoto. */
1134
+ sincronizarAria() {
1135
+ this._tableElement && (Bt({ tabela: this._tableElement, container: this._containerElement }, this.getAttribute("aria-label"), this._carregando), this.atualizarTextosEstado());
1136
+ }
1137
+ /** Textos de estado configuráveis por atributo (carregando, sem resultados, erro). */
1138
+ atualizarTextosEstado() {
1139
+ var i;
1140
+ const e = (i = this._loadingElement) == null ? void 0 : i.querySelector(".ui-tabela__loading-texto");
1141
+ e && (e.textContent = this.getAttribute("texto-carregando") || "Carregando dados..."), this.renderizarErro();
1142
+ }
1143
+ /** Mostra (ou oculta, com null) o aviso de erro de carregamento com a ação "Tentar novamente". */
1144
+ mostrarErro(e) {
1145
+ this._erro = e, this.renderizarErro();
1146
+ }
1147
+ renderizarErro() {
1148
+ Ot(this._erroElement, this._erro, this.getAttribute("texto-erro"), !!this._src);
1149
+ }
1150
+ /** Anuncia ao leitor de tela o resultado do filtro (a região é limpa sem filtro ativo). */
1151
+ anunciarResultado() {
1152
+ Tt(
1153
+ this._anuncioElement,
1154
+ this.dadosController.getDadosExibicao().length,
1155
+ this.dadosController.temFiltro(),
1156
+ this._textoSemResultados()
1157
+ );
1158
+ }
1159
+ _textoSemResultados() {
1160
+ return this.getAttribute("texto-sem-resultados") || Rt;
1161
+ }
1162
+ syncAttributes() {
1163
+ Ie(this.obterContextoAtributos());
1164
+ }
1165
+ obterContextoAtributos() {
1166
+ return {
1167
+ host: this,
1168
+ containerElement: this._containerElement,
1169
+ emptyElement: this._emptyElement,
1170
+ loadingElement: this._loadingElement,
1171
+ onTextoVazioAlterado: (e) => {
1172
+ this._textoVazio = e;
1173
+ },
1174
+ onVirtualizarAlterado: (e) => {
1175
+ this._virtualizar = e;
1176
+ },
1177
+ onSrcLido: (e) => {
1178
+ this._src = e;
1179
+ },
1180
+ onCarregarSrc: (e) => {
1181
+ this.remotaController.carregar(e);
1182
+ },
1183
+ onCarregandoAlterado: (e) => {
1184
+ this._carregando = e;
1185
+ },
1186
+ onRenderBody: () => this.renderBody(),
1187
+ onRenderTotal: () => this.renderTotal()
1188
+ };
1189
+ }
1190
+ get src() {
1191
+ return this._src;
1192
+ }
1193
+ set src(e) {
1194
+ this._src = e, e ? this.setAttribute("src", e) : this.removeAttribute("src");
1195
+ }
1196
+ get carregando() {
1197
+ return this._carregando;
1198
+ }
1199
+ set carregando(e) {
1200
+ this._carregando = !!e, this._carregando ? this.setAttribute("carregando", "") : (this.removeAttribute("carregando"), this.removeAttribute("loading")), this._loadingElement && (this._loadingElement.style.display = this._carregando ? "flex" : "none"), this.sincronizarAria();
1201
+ }
1202
+ /** Opções do `fetch` do modo remoto (headers, credentials, method, body...); o `signal` é da tabela. */
1203
+ get fetchOpcoes() {
1204
+ return this._fetchOpcoes;
1205
+ }
1206
+ set fetchOpcoes(e) {
1207
+ this._fetchOpcoes = e ?? null;
1208
+ }
1209
+ /** Função de busca alternativa ao `fetch` (autenticação, renovação de token, mocks). */
1210
+ get fetcher() {
1211
+ return this._fetcher;
1212
+ }
1213
+ set fetcher(e) {
1214
+ this._fetcher = typeof e == "function" ? e : null;
1215
+ }
1216
+ /** Ordenação feita pelo servidor: o clique no cabeçalho atualiza o indicador e emite `ui-sort`, mas não reordena. */
1217
+ get ordenacaoRemota() {
1218
+ return this.hasAttribute("ordenacao-remota");
1219
+ }
1220
+ set ordenacaoRemota(e) {
1221
+ this.toggleAttribute("ordenacao-remota", !!e);
1222
+ }
1223
+ /** Busca a URL (guardada como `src`, para `recarregar()`). Resolve `true` em sucesso; falhas vão em `ui-fetch-erro`. */
1224
+ async carregarDoEndpoint(e) {
1225
+ return e && e !== this._src && (this.src = e), this.remotaController.carregar(e || this._src || "");
1226
+ }
1227
+ async recarregar() {
1228
+ return this._src ? this.remotaController.carregar(this._src) : (this.dadosController.aplicarOrdenacao(), this.atualizarContextoSelecao(), this.renderBody(), !0);
1229
+ }
1230
+ filtrar(e) {
1231
+ this.dadosController.filtrar(e), this.atualizarContextoSelecao(), this.renderBody();
1232
+ }
1233
+ cleanupEventListeners() {
1234
+ this._containerElement && this._scrollHandler && (this._containerElement.removeEventListener("scroll", this._scrollHandler), this._scrollHandler = null), this._activeResizeCleanup && (this._activeResizeCleanup(), this._activeResizeCleanup = null, this._isResizing = !1), this.rolagem.cancelar(), this.remotaController.abortar(), this._headerListeners.cleanup(), this._corpoListeners.cleanup();
1235
+ }
1236
+ get colunas() {
1237
+ return this._colunas;
1238
+ }
1239
+ set colunas(e) {
1240
+ this._colunas = Array.isArray(e) ? e.filter((i) => i != null).map((i) => ({ ...i })) : [], this.dadosController.setColunas(this._colunas), this.dadosController.setColunasFiltro(this._colunas.map((i) => i.id)), this._alturaLinhaMedida = null, this.renderTotal();
1241
+ }
1242
+ get dados() {
1243
+ return this.dadosController.getDadosOriginais();
1244
+ }
1245
+ set dados(e) {
1246
+ this.dadosController.setDadosOriginais(e), this.atualizarContextoSelecao(), this.renderBody();
1247
+ }
1248
+ get itens() {
1249
+ return this.dados;
1250
+ }
1251
+ set itens(e) {
1252
+ this.dados = e;
1253
+ }
1254
+ get chaveId() {
1255
+ return this.getAttribute("chave-id") || this.getAttribute("id-key") || "id";
1256
+ }
1257
+ set chaveId(e) {
1258
+ e ? this.setAttribute("chave-id", e) : (this.removeAttribute("chave-id"), this.removeAttribute("id-key")), this.atualizarContextoSelecao();
1259
+ }
1260
+ get itemSelecionado() {
1261
+ return this.selecaoController.getItemSelecionado();
1262
+ }
1263
+ set itemSelecionado(e) {
1264
+ this.selecaoController.setItemSelecionado(e);
1265
+ }
1266
+ get indiceSelecionado() {
1267
+ return this.selecaoController.getIndiceSelecionado();
1268
+ }
1269
+ set indiceSelecionado(e) {
1270
+ this.selecaoController.setIndiceSelecionado(e);
1271
+ }
1272
+ limparSelecao() {
1273
+ this.selecaoController.limparSelecao();
1274
+ }
1275
+ get densidade() {
1276
+ const e = this.getAttribute("densidade") || this.getAttribute("density");
1277
+ return e === "compacta" || e === "compact" ? "compacta" : e === "relaxada" || e === "relaxed" ? "relaxada" : "normal";
1278
+ }
1279
+ set densidade(e) {
1280
+ e ? this.setAttribute("densidade", e) : (this.removeAttribute("densidade"), this.removeAttribute("density")), this.renderBody();
1281
+ }
1282
+ get virtualizar() {
1283
+ return this._virtualizar;
1284
+ }
1285
+ set virtualizar(e) {
1286
+ this._virtualizar = !!e, e ? this.setAttribute("virtualizar", "true") : this.removeAttribute("virtualizar"), this.renderTotal();
1287
+ }
1288
+ get colunaOrdenada() {
1289
+ return this.dadosController.getColunaOrdenada();
1290
+ }
1291
+ set colunaOrdenada(e) {
1292
+ this.dadosController.setColunaOrdenada(e), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
1293
+ }
1294
+ get direcaoOrdenacao() {
1295
+ return this.dadosController.getDirecaoOrdenacao();
1296
+ }
1297
+ set direcaoOrdenacao(e) {
1298
+ this.dadosController.setDirecaoOrdenacao(e), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
1299
+ }
1300
+ get textoVazio() {
1301
+ return this._textoVazio;
1302
+ }
1303
+ set textoVazio(e) {
1304
+ this._textoVazio = e || "Nenhum registro encontrado", this.renderTotal();
1305
+ }
1306
+ handleHeaderClick(e) {
1307
+ if (!e.ordenavel || this._isResizing) return;
1308
+ const i = this.dadosController.getColunaOrdenada(), o = this.dadosController.getDirecaoOrdenacao(), a = this.dadosController.alternarOrdenacaoColuna(e);
1309
+ if (!a) return;
1310
+ this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
1311
+ const n = new CustomEvent("ui-sort", { detail: a, bubbles: !0, composed: !0, cancelable: !0 });
1312
+ this.dispatchEvent(n), n.defaultPrevented && (this.dadosController.restaurarOrdenacao(i, o), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody());
1313
+ }
1314
+ /** Altura fixa das linhas em px (`altura-linha`), sobrepõe a densidade; null = vale a densidade. */
1315
+ get alturaLinha() {
1316
+ const e = this.getAttribute("altura-linha") ?? this.getAttribute("row-height"), i = e === null ? NaN : parseFloat(e);
1317
+ return Number.isFinite(i) && i > 0 ? i : null;
1318
+ }
1319
+ set alturaLinha(e) {
1320
+ e && e > 0 ? this.setAttribute("altura-linha", String(e)) : (this.removeAttribute("altura-linha"), this.removeAttribute("row-height"));
1321
+ }
1322
+ /** Publica a altura fixa como variável CSS (usada pelo estilo `:host([altura-linha])`). */
1323
+ aplicarAlturaLinha() {
1324
+ const e = this.alturaLinha;
1325
+ e ? this.style.setProperty("--ui-tabela-altura-linha", `${e}px`) : this.style.removeProperty("--ui-tabela-altura-linha"), this.renderBody();
1326
+ }
1327
+ /** Altura usada na virtualização: a fixa (`altura-linha`), a medida no DOM ou a estimativa da densidade. */
1328
+ getRowHeight() {
1329
+ return this.alturaLinha ?? this._alturaLinhaMedida ?? xe(this.densidade);
1330
+ }
1331
+ /**
1332
+ * Mede a altura real das linhas uma vez por configuração (densidade/colunas): padding, fonte e
1333
+ * renderizadores customizados mudam a altura, e a estimativa fixa desalinharia a janela virtual.
1334
+ * Não remede a cada rolagem para os espaçadores não "pularem" com linhas de alturas diferentes.
1335
+ */
1336
+ medirAlturaLinha() {
1337
+ if (this._alturaLinhaMedida !== null || !this._tbodyElement) return;
1338
+ const e = this._tbodyElement.querySelectorAll("tr[data-index]");
1339
+ if (e.length === 0) return;
1340
+ let i = 0;
1341
+ e.forEach((a) => {
1342
+ i += a.getBoundingClientRect().height;
1343
+ });
1344
+ const o = i / e.length;
1345
+ o <= 0 || (this._alturaLinhaMedida = o, Math.abs(o - xe(this.densidade)) > 0.5 && this.renderBody());
1346
+ }
1347
+ /** Ordenar, filtrar, trocar os dados ou a chave mantém a linha selecionada (se ainda existir). */
1348
+ atualizarContextoSelecao() {
1349
+ this.selecaoController.reconciliar(), this._indiceAtivo = this.selecaoController.getIndiceSelecionado();
1350
+ }
1351
+ renderTotal() {
1352
+ var e;
1353
+ if (this.shadow) {
1354
+ if (this._containerElement) {
1355
+ if (this._containerElement.style.maxHeight = this.getAttribute("max-height") || "", this._emptyElement) {
1356
+ const i = this._emptyElement.querySelector(".ui-tabela__empty-text");
1357
+ i && (i.textContent = this._textoVazio);
1358
+ }
1359
+ } else {
1360
+ this.cleanupEventListeners();
1361
+ const i = Lt(this.shadow, this._textoVazio, this.getAttribute("max-height"), this._carregando);
1362
+ this._containerElement = i.containerElement, this._tableElement = i.tableElement, this._colgroupElement = i.colgroupElement, this._theadElement = i.theadElement, this._tbodyElement = i.tbodyElement, this._emptyElement = i.emptyElement, this._loadingElement = i.loadingElement, this._erroElement = i.erroElement, this._anuncioElement = i.anuncioElement, (e = i.erroElement.querySelector(".ui-tabela__erro-acao")) == null || e.addEventListener("click", () => {
1363
+ this.recarregar();
1364
+ });
1365
+ }
1366
+ U(this, this._containerElement), this.renderHeader(), this.renderBody(), this._virtualizar && this._containerElement && !this._scrollHandler && (this._scrollHandler = zt(this._containerElement, () => this.renderBody("rolagem"))), this._tbodyElement && this._corpoListeners.size === 0 && (this._corpoListeners.add(this._tbodyElement, "keydown", this.handleTecladoCorpo), this._corpoListeners.add(this._tbodyElement, "focusin", this.handleFocoLinha)), this.sincronizarAria();
1367
+ }
1368
+ }
1369
+ definirLinhaAtiva(e) {
1370
+ this._indiceAtivo = e;
1371
+ const i = this._tbodyElement, o = i == null ? void 0 : i.querySelector(`tr[data-index="${e}"]`);
1372
+ !i || !o || (i.querySelectorAll('tr[tabindex="0"]').forEach((a) => {
1373
+ a !== o && (a.tabIndex = -1);
1374
+ }), o.tabIndex = 0);
1375
+ }
1376
+ obterContextoRenderizador(e = "completo") {
1377
+ return {
1378
+ modoCorpo: e,
1379
+ host: this,
1380
+ shadow: this.shadow,
1381
+ theadElement: this._theadElement,
1382
+ colgroupElement: this._colgroupElement,
1383
+ tbodyElement: this._tbodyElement,
1384
+ tableElement: this._tableElement,
1385
+ emptyElement: this._emptyElement,
1386
+ containerElement: this._containerElement,
1387
+ colunas: this._colunas,
1388
+ dadosController: this.dadosController,
1389
+ selecaoController: this.selecaoController,
1390
+ chaveId: this.chaveId,
1391
+ virtualizar: this._virtualizar,
1392
+ rowHeight: this.getRowHeight(),
1393
+ indiceAtivo: this._indiceAtivo,
1394
+ textoVazio: this._textoVazio,
1395
+ textoSemResultados: this._textoSemResultados(),
1396
+ headerListeners: this._headerListeners,
1397
+ onSetIsResizing: (i) => {
1398
+ this._isResizing = i;
1399
+ },
1400
+ onActiveResizeCleanup: (i) => {
1401
+ this._activeResizeCleanup = i;
1402
+ },
1403
+ onHeaderClick: (i) => this.handleHeaderClick(i)
1404
+ };
1405
+ }
1406
+ renderHeader() {
1407
+ kt(this.obterContextoRenderizador());
1408
+ }
1409
+ /**
1410
+ * Renderiza o corpo. `completo` (padrão) recria as linhas e roda o `render` das colunas de novo;
1411
+ * `rolagem` só ajusta a janela virtual e mantém as linhas que continuam visíveis (foco e texto digitado intactos).
1412
+ */
1413
+ renderBody(e = "completo") {
1414
+ St(this.obterContextoRenderizador(e)), this.anunciarResultado(), this.medirAlturaLinha();
1415
+ }
1416
+ /**
1417
+ * Rola até um item e opcionalmente o seleciona. Aceita ID (pela `chave-id`, depois `id`, `_id`,
1418
+ * `codigo`, `key`), predicado ou índice. Um número é procurado primeiro como ID; use
1419
+ * `{ porIndice: true }` ou `rolarParaIndice()` para tratá-lo só como índice da linha exibida.
1420
+ */
1421
+ rolarPara(e, i) {
1422
+ return this.selecaoController.rolarPara(e, i);
1423
+ }
1424
+ /** Rola até a linha exibida de índice `indice` (posição após ordenação/filtro, base 0). */
1425
+ rolarParaIndice(e, i) {
1426
+ return this.selecaoController.rolarPara(e, { ...i, porIndice: !0 });
1427
+ }
1428
+ }
1429
+ G("ui-tabela", Ft);
1430
+ const M = Math.PI / 180, Ae = 64;
1431
+ function N(r) {
1432
+ return Math.abs(r) < 1e-12 ? 0 : Number(r.toPrecision(15));
1433
+ }
1434
+ const Vt = {
1435
+ sqrt: Math.sqrt,
1436
+ abs: Math.abs,
1437
+ round: Math.round,
1438
+ floor: Math.floor,
1439
+ ceil: Math.ceil,
1440
+ trunc: Math.trunc,
1441
+ sign: Math.sign,
1442
+ log: Math.log10,
1443
+ ln: Math.log,
1444
+ deg: (r) => N(r / M),
1445
+ rad: (r) => N(r * M),
1446
+ sin: (r) => N(Math.sin(r * M)),
1447
+ cos: (r) => N(Math.cos(r * M)),
1448
+ tan: (r) => N(Math.tan(r * M)),
1449
+ asin: (r) => N(Math.asin(r) / M),
1450
+ acos: (r) => N(Math.acos(r) / M),
1451
+ atan: (r) => N(Math.atan(r) / M)
1452
+ }, Ht = {
1453
+ min: (r) => r.length > 0 ? Math.min(...r) : NaN,
1454
+ max: (r) => r.length > 0 ? Math.max(...r) : NaN,
1455
+ pow: (r) => r.length === 2 ? Math.pow(r[0], r[1]) : NaN,
1456
+ hypot: (r) => r.length >= 2 ? Math.hypot(...r) : NaN,
1457
+ atan2: (r) => r.length === 2 ? N(Math.atan2(r[0], r[1]) / M) : NaN,
1458
+ mod: (r) => r.length === 2 && r[1] !== 0 ? r[0] % r[1] : NaN
1459
+ };
1460
+ function qt(r) {
1461
+ if (!r || typeof r != "string") return null;
1462
+ let t = r.trim();
1463
+ if (t.startsWith("=") && (t = t.slice(1).trim()), !t) return null;
1464
+ t = t.replace(/(\d),(\d)/g, "$1.$2");
1465
+ let e = 0, i = 0, o = !1;
1466
+ function a() {
1467
+ return t[e] || "";
1468
+ }
1469
+ function n() {
1470
+ return t[e++] || "";
1471
+ }
1472
+ function s() {
1473
+ for (; e < t.length && /\s/.test(t[e]); )
1474
+ e++;
1475
+ }
1476
+ function l() {
1477
+ if (++i > Ae)
1478
+ throw new Error("Profundidade máxima excedida");
1479
+ try {
1480
+ s();
1481
+ let c = u();
1482
+ for (s(); e < t.length; ) {
1483
+ const h = a();
1484
+ if (h === "+" || h === "-") {
1485
+ n(), s();
1486
+ const f = u(), m = o;
1487
+ s(), m ? c = h === "+" ? c + c * f : c - c * f : c = h === "+" ? c + f : c - f, o = !1;
1488
+ } else
1489
+ break;
1490
+ }
1491
+ return c;
1492
+ } finally {
1493
+ i--;
1494
+ }
1495
+ }
1496
+ function u() {
1497
+ s();
1498
+ let c = d(), h = o;
1499
+ for (s(); e < t.length; ) {
1500
+ const f = a();
1501
+ if (f === "*" || f === "/" || f === "x" || f === "X") {
1502
+ n(), s();
1503
+ const m = d();
1504
+ if (h = !1, f === "/" && m === 0)
1505
+ throw new Error("Divisão por zero");
1506
+ c = f === "/" ? c / m : c * m, s();
1507
+ } else
1508
+ break;
1509
+ }
1510
+ return o = h, c;
1511
+ }
1512
+ function d() {
1513
+ if (++i > Ae)
1514
+ throw new Error("Profundidade máxima excedida");
1515
+ try {
1516
+ s();
1517
+ const c = a();
1518
+ if (c === "+" || c === "-") {
1519
+ n();
1520
+ const m = d();
1521
+ return c === "-" ? -m : m;
1522
+ }
1523
+ let h = p();
1524
+ const f = o;
1525
+ if (s(), a() === "^") {
1526
+ n();
1527
+ const m = d();
1528
+ h = Math.pow(h, m), o = !1;
1529
+ } else if (t.slice(e, e + 2) === "**") {
1530
+ e += 2;
1531
+ const m = d();
1532
+ h = Math.pow(h, m), o = !1;
1533
+ } else
1534
+ o = f;
1535
+ return h;
1536
+ } finally {
1537
+ i--;
1538
+ }
1539
+ }
1540
+ function p() {
1541
+ s(), o = !1;
1542
+ const c = a();
1543
+ if (c === "+" || c === "-") {
1544
+ n();
1545
+ const b = p();
1546
+ return c === "-" ? -b : b;
1547
+ }
1548
+ if (c === "(") {
1549
+ n();
1550
+ const b = l();
1551
+ if (s(), n() !== ")") throw new Error("Parêntese sem fechamento");
1552
+ return s(), a() === "%" ? (n(), o = !0, b / 100) : (o = !1, b);
1553
+ }
1554
+ const h = t.slice(e).match(/^([a-zA-Z_]\w*)\s*\(/);
1555
+ if (h) {
1556
+ const b = h[1].toLowerCase(), g = Vt[b], y = Ht[b];
1557
+ if (!g && !y)
1558
+ throw new Error("Função desconhecida: " + h[1]);
1559
+ e += h[0].length;
1560
+ const E = [l()];
1561
+ for (s(); a() === ";" || a() === ","; )
1562
+ n(), s(), E.push(l()), s();
1563
+ if (n() !== ")") throw new Error("Parêntese sem fechamento");
1564
+ const w = y ? y(E) : E.length === 1 && g ? g(E[0]) : NaN;
1565
+ if (isNaN(w)) throw new Error("Resultado inválido de função");
1566
+ return s(), a() === "%" ? (n(), o = !0, w / 100) : (o = !1, w);
1567
+ }
1568
+ const f = t.slice(e).match(/^(pi|π|e)\b/i);
1569
+ if (f) {
1570
+ e += f[0].length;
1571
+ let g = f[1].toLowerCase() === "e" ? Math.E : Math.PI;
1572
+ return s(), a() === "%" && (n(), o = !0, g = g / 100), g;
1573
+ }
1574
+ const m = t.slice(e).match(/^(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+|,[0-9]+)(?:[eE][+-]?[0-9]+)?/);
1575
+ if (m) {
1576
+ e += m[0].length;
1577
+ let b = parseFloat(m[0].replace(",", "."));
1578
+ return s(), a() === "%" && (n(), o = !0, b = b / 100), b;
1579
+ }
1580
+ throw new Error("Caractere inválido: " + c);
1581
+ }
1582
+ try {
1583
+ const c = l();
1584
+ return s(), e < t.length ? null : typeof c == "number" && isFinite(c) ? c : null;
1585
+ } catch {
1586
+ return null;
1587
+ }
1588
+ }
1589
+ const $t = "ui_tabela_propriedades_estado_", K = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
1590
+ function Ce(r) {
1591
+ return !!r && typeof r == "object" && !Array.isArray(r);
1592
+ }
1593
+ function ce() {
1594
+ if (typeof window > "u") return null;
1595
+ try {
1596
+ return typeof localStorage < "u" ? localStorage : null;
1597
+ } catch {
1598
+ return null;
1599
+ }
1600
+ }
1601
+ function q(r, t) {
1602
+ const e = typeof r == "string" ? r.trim() : "", i = typeof t == "string" ? t.trim() : "";
1603
+ return `${$t}${e || i || "default"}`;
1604
+ }
1605
+ function jt(r) {
1606
+ if (!Ce(r)) return null;
1607
+ const t = {};
1608
+ if (Ce(r.categorias))
1609
+ for (const [o, a] of Object.entries(r.categorias))
1610
+ !o || K.has(o) || typeof a == "boolean" && (t[o] = a);
1611
+ const e = typeof r.versao == "number" && Number.isFinite(r.versao) ? r.versao : 1, i = typeof r.ultimaAtualizacao == "number" && Number.isFinite(r.ultimaAtualizacao) ? r.ultimaAtualizacao : void 0;
1612
+ return i !== void 0 ? { versao: e, categorias: t, ultimaAtualizacao: i } : { versao: e, categorias: t };
1613
+ }
1614
+ function Ut(r) {
1615
+ const t = ce();
1616
+ if (!t) return null;
1617
+ try {
1618
+ const e = t.getItem(r);
1619
+ return e ? jt(JSON.parse(e)) : null;
1620
+ } catch (e) {
1621
+ return console.warn(
1622
+ `[ui-tabela-propriedades] Não foi possível carregar o estado persistido (${r}):`,
1623
+ e
1624
+ ), null;
1625
+ }
1626
+ }
1627
+ function Wt(r, t) {
1628
+ const e = ce();
1629
+ if (e)
1630
+ try {
1631
+ e.setItem(r, JSON.stringify(t));
1632
+ } catch (i) {
1633
+ console.warn(
1634
+ `[ui-tabela-propriedades] Não foi possível salvar o estado persistido (${r}):`,
1635
+ i
1636
+ );
1637
+ }
1638
+ }
1639
+ function Xt(r) {
1640
+ const t = ce();
1641
+ if (t)
1642
+ try {
1643
+ t.removeItem(r);
1644
+ } catch {
1645
+ }
1646
+ }
1647
+ function D(r) {
1648
+ if (!r || typeof r != "object") return null;
1649
+ const t = r.id;
1650
+ if (t == null) return null;
1651
+ const e = String(t);
1652
+ return !e || K.has(e) ? null : e;
1653
+ }
1654
+ function ae(r) {
1655
+ return r.aberto !== void 0 ? r.aberto !== !1 : r.aberta !== !1;
1656
+ }
1657
+ function F(r, t) {
1658
+ if (!(!r || typeof r != "object" || Object.isFrozen(r)))
1659
+ try {
1660
+ r.aberto = t, "aberta" in r && (r.aberta = t);
1661
+ } catch {
1662
+ }
1663
+ }
1664
+ class Kt {
1665
+ constructor(t) {
1666
+ v(this, "preferencias", /* @__PURE__ */ new Map());
1667
+ v(this, "origensAberto", /* @__PURE__ */ new Map());
1668
+ v(this, "ultimaChaveCarregada", null);
1669
+ this.getContexto = t;
1670
+ }
1671
+ chaveAtual() {
1672
+ const t = this.getContexto();
1673
+ return q(t.storageKey, t.id);
1674
+ }
1675
+ /** Carrega preferências do storage. Quando `substituirExistentes` é falso, preserva alterações feitas antes da conexão. */
1676
+ carregarDoStorage(t = !1) {
1677
+ const e = this.getContexto(), i = q(e.storageKey, e.id);
1678
+ if (t && this.preferencias.clear(), this.ultimaChaveCarregada = i, !e.persistir) return !1;
1679
+ const o = Ut(i);
1680
+ if (!o) return !1;
1681
+ for (const [a, n] of Object.entries(o.categorias))
1682
+ (t || !this.preferencias.has(a)) && this.preferencias.set(a, n);
1683
+ return !0;
1684
+ }
1685
+ /** Recarrega o estado se `id` ou `storage-key` tiver mudado após a conexão. */
1686
+ sincronizarSeChaveMudou() {
1687
+ const t = this.getContexto();
1688
+ if (!t.conectado || !t.persistir) return !1;
1689
+ const e = q(t.storageKey, t.id);
1690
+ return this.ultimaChaveCarregada === null ? this.carregarDoStorage(!1) : e !== this.ultimaChaveCarregada ? this.carregarDoStorage(!0) : !1;
1691
+ }
1692
+ /** Registra os padrões originais enviados pela aplicação para permitir restauração via `limpar()`. */
1693
+ registrarOrigens(t) {
1694
+ if (this.origensAberto.clear(), !!Array.isArray(t))
1695
+ for (const e of t) {
1696
+ const i = D(e);
1697
+ i !== null && this.origensAberto.set(i, ae(e));
1698
+ }
1699
+ }
1700
+ /** Aplica sobre os objetos mutáveis de `categorias` as preferências lembradas para cada `id`. */
1701
+ aplicarEmCategorias(t) {
1702
+ if (Array.isArray(t))
1703
+ for (const e of t) {
1704
+ const i = D(e);
1705
+ i !== null && this.preferencias.has(i) && F(e, this.preferencias.get(i));
1706
+ }
1707
+ }
1708
+ /** Restaura nos objetos mutáveis os valores iniciais enviados pela aplicação. */
1709
+ restaurarOrigensEmCategorias(t) {
1710
+ if (Array.isArray(t))
1711
+ for (const e of t) {
1712
+ const i = D(e);
1713
+ i !== null && this.origensAberto.has(i) && F(e, this.origensAberto.get(i));
1714
+ }
1715
+ }
1716
+ /** Estado efetivo da categoria considerando preferência lembrada e padrão da própria categoria. */
1717
+ estaAberta(t) {
1718
+ if (!t || typeof t != "object") return !0;
1719
+ const e = D(t);
1720
+ return e !== null && this.preferencias.has(e) ? this.preferencias.get(e) : ae(t);
1721
+ }
1722
+ registrar(t, e, i = !0) {
1723
+ !t || K.has(t) || (this.preferencias.set(t, !!e), i && this.salvar());
1724
+ }
1725
+ registrarVarias(t, e = !0) {
1726
+ let i = !1;
1727
+ for (const [o, a] of t)
1728
+ !o || K.has(o) || (this.preferencias.set(o, !!a), i = !0);
1729
+ i && e && this.salvar();
1730
+ }
1731
+ salvar() {
1732
+ const t = this.getContexto();
1733
+ if (!t.persistir || !t.conectado) return;
1734
+ const e = q(t.storageKey, t.id);
1735
+ if (this.ultimaChaveCarregada = e, this.preferencias.size === 0) return;
1736
+ const i = {};
1737
+ for (const [o, a] of this.preferencias.entries())
1738
+ i[o] = a;
1739
+ Wt(e, {
1740
+ versao: 1,
1741
+ categorias: i,
1742
+ ultimaAtualizacao: Date.now()
1743
+ });
1744
+ }
1745
+ limpar(t) {
1746
+ this.preferencias.clear(), t && this.restaurarOrigensEmCategorias(t), Xt(this.chaveAtual());
1747
+ }
1748
+ obterEstado(t) {
1749
+ const e = {};
1750
+ for (const [i, o] of this.preferencias.entries())
1751
+ e[i] = o;
1752
+ if (Array.isArray(t))
1753
+ for (const i of t) {
1754
+ const o = D(i);
1755
+ o !== null && !(o in e) && (e[o] = this.estaAberta(i));
1756
+ }
1757
+ return e;
1758
+ }
1759
+ montarDetalheEvento(t) {
1760
+ const e = this.obterEstado(t), i = [], o = [];
1761
+ for (const [a, n] of Object.entries(e))
1762
+ n ? i.push(a) : o.push(a);
1763
+ return { estado: e, abertas: i, fechadas: o };
1764
+ }
1765
+ }
1766
+ const ue = '.ui-prop__categoria--aberta .ui-prop__linha input:not([disabled]):not([type="color"]):not(.ui-prop__cor-picker-oculto), .ui-prop__categoria--aberta .ui-prop__linha select:not([disabled]), .ui-prop__categoria--aberta .ui-prop__linha .ui-prop__btn-acao-inline:not([disabled]), .ui-prop__categoria--aberta .ui-prop__linha .ui-prop__editor-booleano, .ui-prop__categoria--aberta .ui-prop__linha .ui-prop__editor-cor-container';
1767
+ function Pe(r, t) {
1768
+ if (!r) return null;
1769
+ const e = String(t);
1770
+ return Array.from(r.querySelectorAll("[data-prop-id]")).find((i) => i.getAttribute("data-prop-id") === e) ?? null;
1771
+ }
1772
+ const Fe = /* @__PURE__ */ new WeakMap();
1773
+ function O(r, t) {
1774
+ Fe.set(r, t);
1775
+ }
1776
+ function ke(r, t, e) {
1777
+ var a, n;
1778
+ const i = Pe(r, t), o = (a = i == null ? void 0 : i.querySelector(".ui-prop__col-valor")) == null ? void 0 : a.firstElementChild;
1779
+ o && ((n = Fe.get(o)) == null || n(e));
1780
+ }
1781
+ function J(r, t, e = (o, a) => o === String(a), i = (o) => o == null || o === "" ? "—" : String(o)) {
1782
+ var n;
1783
+ (n = r.querySelector("option[data-externa]")) == null || n.remove();
1784
+ const o = Array.from(r.options).find((s) => !s.hasAttribute("data-acao") && e(s.value, t));
1785
+ if (o) {
1786
+ o.selected = !0;
1787
+ return;
1788
+ }
1789
+ const a = document.createElement("option");
1790
+ a.value = t == null ? "" : String(t), a.textContent = i(t), a.setAttribute("data-externa", ""), a.hidden = !0, r.insertBefore(a, r.firstChild), a.selected = !0;
1791
+ }
1792
+ function Q(r, t) {
1793
+ var i;
1794
+ (i = r.querySelector("option[data-externa]")) == null || i.remove();
1795
+ const e = document.createElement("option");
1796
+ e.value = "", e.textContent = t, e.setAttribute("data-externa", ""), e.setAttribute("data-misto", ""), e.hidden = !0, e.disabled = !0, r.insertBefore(e, r.firstChild), e.selected = !0;
1797
+ }
1798
+ function Gt(r, t) {
1799
+ const e = Array.from(r.querySelectorAll(ue)), i = e.indexOf(t);
1800
+ if (i !== -1 && i + 1 < e.length) {
1801
+ const o = e[i + 1];
1802
+ o.focus(), o instanceof HTMLInputElement && o.select();
1803
+ }
1804
+ }
1805
+ function Yt(r, t) {
1806
+ const e = Array.from(r.querySelectorAll(ue)), i = e.indexOf(t);
1807
+ if (i > 0) {
1808
+ const o = e[i - 1];
1809
+ o.focus(), o instanceof HTMLInputElement && o.select();
1810
+ }
1811
+ }
1812
+ function Jt(r) {
1813
+ const t = r.querySelector(ue);
1814
+ t && (t.focus(), t instanceof HTMLInputElement && t.select());
1815
+ }
1816
+ function Z(r, t) {
1817
+ var e;
1818
+ r.classList.toggle("ui-prop__categoria--aberta", t), R(r, "categoria-aberta", t), (e = r.querySelector(".ui-prop__categoria-header")) == null || e.setAttribute("aria-expanded", String(t));
1819
+ }
1820
+ function Qt(r, t, e) {
1821
+ const i = /* @__PURE__ */ new Map();
1822
+ r.querySelectorAll(".ui-prop__categoria[data-cat-id]").forEach((o) => {
1823
+ const a = o.getAttribute("data-cat-id");
1824
+ a !== null && i.set(a, o);
1825
+ }), (Array.isArray(t) ? t : []).forEach((o) => {
1826
+ const a = D(o);
1827
+ if (a === null) return;
1828
+ const n = e(o), s = i.get(a);
1829
+ s && Z(s, n);
1830
+ });
1831
+ }
1832
+ function Zt(r, t) {
1833
+ (Array.isArray(t) ? t : []).forEach((e) => {
1834
+ F(e, !0);
1835
+ }), r.querySelectorAll(".ui-prop__categoria").forEach((e) => Z(e, !0));
1836
+ }
1837
+ function er(r, t) {
1838
+ (Array.isArray(t) ? t : []).forEach((e) => {
1839
+ F(e, !1);
1840
+ }), r.querySelectorAll(".ui-prop__categoria").forEach((e) => Z(e, !1));
1841
+ }
1842
+ function tr(r, t, e, i, o) {
1843
+ const a = (Array.isArray(e) ? e : []).find(
1844
+ (u) => u && typeof u == "object" && String(u.id) === String(i)
1845
+ );
1846
+ if (!a) return;
1847
+ const n = Array.from(r.querySelectorAll("[data-cat-id]")).find((u) => u.getAttribute("data-cat-id") === String(i)), l = !(o !== void 0 ? o : n ? n.classList.contains("ui-prop__categoria--aberta") : ae(a));
1848
+ return F(a, l), n && Z(n, l), t.dispatchEvent(
1849
+ new CustomEvent("ui-categoria-toggle", {
1850
+ bubbles: !0,
1851
+ composed: !0,
1852
+ detail: { id: i, aberto: l }
1853
+ })
1854
+ ), l;
1855
+ }
1856
+ const pe = Symbol.for("ui-tabela-propriedades:misto"), he = "Varia";
1857
+ function S(r) {
1858
+ return r === pe;
1859
+ }
1860
+ function T(r) {
1861
+ var e;
1862
+ let t;
1863
+ try {
1864
+ t = (e = r.obterTextoMisto) == null ? void 0 : e.call(r);
1865
+ } catch {
1866
+ }
1867
+ return typeof t == "string" && t.trim() ? t : he;
1868
+ }
1869
+ function P(r, t) {
1870
+ return r == null && t == null ? !0 : Object.is(r, t);
1871
+ }
1872
+ function ne(r) {
1873
+ return r.misto ? pe : r.valor;
1874
+ }
1875
+ function rr(r) {
1876
+ if (!Array.isArray(r) || r.length === 0) return;
1877
+ const t = r[0];
1878
+ for (let e = 1; e < r.length; e++)
1879
+ if (!P(t, r[e])) return pe;
1880
+ return t;
1881
+ }
1882
+ function Ir(r) {
1883
+ if (!Array.isArray(r)) return {};
1884
+ const t = r.filter(
1885
+ (o) => o !== null && typeof o == "object" && !Array.isArray(o)
1886
+ ), e = /* @__PURE__ */ new Set();
1887
+ t.forEach((o) => Object.keys(o).forEach((a) => e.add(a)));
1888
+ const i = {};
1889
+ return e.forEach((o) => {
1890
+ i[o] = rr(t.map((a) => o in a ? a[o] : void 0));
1891
+ }), i;
1892
+ }
1893
+ function ee(r) {
1894
+ if (typeof r.casasDecimais == "number" && r.casasDecimais >= 0) return r.casasDecimais;
1895
+ if (typeof r.precisao == "number" && r.precisao >= 0) return r.precisao;
1896
+ }
1897
+ function ir(r, t) {
1898
+ return typeof r.passo == "number" && r.passo > 0 ? r.passo : typeof r.step == "number" && r.step > 0 ? r.step : t !== void 0 ? Math.pow(10, -t) : 1;
1899
+ }
1900
+ function fe(r, t) {
1901
+ let e = r;
1902
+ return typeof t.min == "number" && Number.isFinite(t.min) && (e = Math.max(t.min, e)), typeof t.max == "number" && Number.isFinite(t.max) && (e = Math.min(t.max, e)), e;
1903
+ }
1904
+ function oe(r, t) {
1905
+ if (typeof r != "string") return null;
1906
+ let e = r.trim();
1907
+ const i = typeof t.unidade == "string" ? t.unidade.trim() : "";
1908
+ if (i && e.length > i.length && e.toLowerCase().endsWith(i.toLowerCase()) && (e = e.slice(0, e.length - i.length).trim()), !e) return null;
1909
+ const o = qt(e);
1910
+ if (o === null || !Number.isFinite(o)) return null;
1911
+ const a = ee(t), n = fe(o, t);
1912
+ return Number(a !== void 0 ? n.toFixed(a) : n.toPrecision(15));
1913
+ }
1914
+ function Ve(r, t, e, i) {
1915
+ r.classList.toggle("ui-prop__editor--misto", e), e ? r.placeholder = i : t.placeholder ? r.placeholder = t.placeholder : r.removeAttribute("placeholder");
1916
+ }
1917
+ function or(r, t, e) {
1918
+ const i = document.createElement("span"), o = e ? ee(e) : void 0, a = (n) => {
1919
+ if (S(n)) {
1920
+ i.className = "ui-prop__valor-readonly ui-prop__editor--misto", i.textContent = t ? T({ obterTextoMisto: t }) : he;
1921
+ return;
1922
+ }
1923
+ if (n == null) {
1924
+ i.className = "ui-prop__valor-readonly", i.textContent = "—";
1925
+ return;
1926
+ }
1927
+ if ((e == null ? void 0 : e.tipo) === "booleano" && typeof n == "boolean") {
1928
+ i.className = "ui-prop__valor-readonly", i.textContent = n ? "Sim" : "Não";
1929
+ return;
1930
+ }
1931
+ if (e != null && e.opcoes && e.opcoes.length > 0) {
1932
+ const l = e.opcoes.find((u) => u && String(u.id) === String(n));
1933
+ if (l) {
1934
+ i.className = "ui-prop__valor-readonly", i.textContent = l.rotulo;
1935
+ return;
1936
+ }
1937
+ }
1938
+ const s = typeof n == "number" || typeof n == "string" && /^-?\d+(\.\d+)?$/.test(n.trim());
1939
+ if (i.className = `ui-prop__valor-readonly ${s ? "ui-prop__valor-readonly--numero" : ""}`.trim(), s && o !== void 0) {
1940
+ const l = Number(n);
1941
+ i.textContent = Number.isFinite(l) ? l.toFixed(o) : String(n);
1942
+ } else
1943
+ i.textContent = String(n);
1944
+ };
1945
+ return a(r), O(i, a), i;
1946
+ }
1947
+ function ar(r, t, e, i) {
1948
+ const o = document.createElement("label");
1949
+ o.className = "ui-prop__editor-booleano", o.setAttribute("role", "checkbox"), o.tabIndex = 0, o.setAttribute("aria-label", String(t.rotulo ?? t.id));
1950
+ const a = document.createElement("div");
1951
+ a.className = "ui-prop__checkbox-custom";
1952
+ const n = document.createElement("span");
1953
+ n.className = "ui-prop__booleano-rotulo";
1954
+ const s = (u) => {
1955
+ const d = S(u), p = !d && !!u;
1956
+ o.classList.toggle("ui-prop__editor--misto", d), a.classList.toggle("ui-prop__checkbox-custom--marcado", p), a.classList.toggle("ui-prop__checkbox-custom--misto", d), a.textContent = d ? "–" : p ? "✓" : "", n.textContent = d ? T(i) : p ? "Sim" : "Não", o.setAttribute("aria-checked", d ? "mixed" : String(p));
1957
+ };
1958
+ s(e), O(o, s), o.appendChild(a), o.appendChild(n);
1959
+ const l = () => {
1960
+ const u = i.obterValorAtual(t.id), d = S(u) ? !0 : !u;
1961
+ i.registrarAlteracao(r, t.id, d), s(d);
1962
+ };
1963
+ return o.addEventListener("click", (u) => {
1964
+ u.preventDefault(), l();
1965
+ }), o.addEventListener("keydown", (u) => {
1966
+ u.key === " " ? (u.preventDefault(), l()) : u.key === "Enter" && (u.preventDefault(), u.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o));
1967
+ }), o;
1968
+ }
1969
+ function nr(r, t, e, i) {
1970
+ const o = document.createElement("select");
1971
+ o.className = "ui-prop__editor-select", o.setAttribute("aria-label", String(t.rotulo ?? t.id)), (Array.isArray(t.opcoes) ? t.opcoes : []).forEach((n) => {
1972
+ if (!n || typeof n != "object") return;
1973
+ const s = document.createElement("option");
1974
+ s.value = String(n.id), s.textContent = String(n.rotulo ?? n.id), o.appendChild(s);
1975
+ });
1976
+ const a = (n) => {
1977
+ o.classList.toggle("ui-prop__editor--misto", S(n)), S(n) ? Q(o, T(i)) : J(o, n);
1978
+ };
1979
+ return a(e), O(o, a), o.addEventListener("change", () => {
1980
+ const n = (t.opcoes || []).find((s) => s && String(s.id) === o.value);
1981
+ i.registrarAlteracao(r, t.id, n ? n.id : o.value), a(i.obterValorAtual(t.id));
1982
+ }), o.addEventListener("keydown", (n) => {
1983
+ n.key === "Enter" && (n.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o));
1984
+ }), o;
1985
+ }
1986
+ function sr(r, t, e) {
1987
+ const i = document.createElement("button");
1988
+ return i.type = "button", i.className = "ui-prop__btn-acao-inline", i.textContent = t.rotuloAcao || "Editar...", i.addEventListener("click", () => {
1989
+ typeof t.onClickAcao == "function" && t.onClickAcao(t), e.despacharEventoAcao(t, r);
1990
+ }), i;
1991
+ }
1992
+ function lr(r, t, e, i) {
1993
+ const o = document.createElement("input");
1994
+ o.type = "text", o.inputMode = "decimal", o.autocomplete = "off", o.spellcheck = !1, o.className = "ui-prop__editor-input ui-prop__editor-input--numero", o.setAttribute("aria-label", String(t.rotulo ?? t.id)), t.placeholder && (o.placeholder = t.placeholder);
1995
+ const a = ee(t), n = (c) => {
1996
+ if (c == null || c === "" || S(c)) return "";
1997
+ const h = Number(c);
1998
+ return isNaN(h) ? String(c) : a !== void 0 ? h.toFixed(a) : String(h);
1999
+ }, s = (c) => {
2000
+ o.value = n(c), Ve(o, t, S(c), T(i));
2001
+ };
2002
+ s(e), O(o, s);
2003
+ let l = null;
2004
+ const u = () => {
2005
+ o.classList.remove("ui-prop__editor-input--calculando"), o.title = "", l && (l.hidden = !0);
2006
+ }, d = (c) => {
2007
+ if (!l) {
2008
+ if (!o.parentElement) return;
2009
+ l = document.createElement("span"), l.className = "ui-prop__previa-calculo", l.setAttribute("aria-hidden", "true"), o.parentElement.appendChild(l);
2010
+ }
2011
+ l.textContent = c, l.hidden = !1;
2012
+ };
2013
+ o.addEventListener("focus", () => {
2014
+ o.classList.remove("ui-prop__editor-input--invalido"), o.select();
2015
+ }), o.addEventListener("animationend", () => o.classList.remove("ui-prop__editor-input--invalido")), o.addEventListener("input", () => {
2016
+ o.classList.remove("ui-prop__editor-input--invalido");
2017
+ const c = o.value.trim(), f = !/^[+-]?[0-9]*[.,]?[0-9]*$/.test(c) && (c.startsWith("=") || /[\+\-\*\/\^\%\(\);]|^[a-zA-Z_π]/.test(c));
2018
+ if (o.classList.toggle("ui-prop__editor-input--calculando", f), f) {
2019
+ const m = oe(c, t), b = m !== null ? `= ${n(m)}` : "= ?";
2020
+ o.title = m !== null ? b : "", d(b);
2021
+ } else
2022
+ u();
2023
+ });
2024
+ const p = () => {
2025
+ u();
2026
+ const c = o.value.trim(), h = i.obterValorAtual(t.id);
2027
+ if (c === n(h)) return;
2028
+ if (c === "") {
2029
+ if (S(h)) return;
2030
+ i.registrarAlteracao(r, t.id, null);
2031
+ return;
2032
+ }
2033
+ const f = oe(c, t);
2034
+ f !== null ? (i.registrarAlteracao(r, t.id, f), s(i.obterValorAtual(t.id))) : (s(h), o.classList.add("ui-prop__editor-input--invalido"));
2035
+ };
2036
+ return o.addEventListener("change", p), o.addEventListener("blur", p), o.addEventListener("keydown", (c) => {
2037
+ if (c.key === "Enter")
2038
+ p(), c.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o);
2039
+ else if (c.key === "Escape")
2040
+ c.preventDefault(), c.stopPropagation(), u(), s(i.obterValorAtual(t.id)), o.blur();
2041
+ else if (c.key === "ArrowUp" || c.key === "ArrowDown") {
2042
+ c.preventDefault(), u();
2043
+ const h = oe(o.value, t), f = i.obterValorAtual(t.id);
2044
+ if (h === null && S(f)) return;
2045
+ const m = h ?? (Number(f) || 0);
2046
+ let b = ir(t, a);
2047
+ c.shiftKey ? b *= 10 : c.altKey && a === void 0 && (b *= 0.1);
2048
+ let g = c.key === "ArrowUp" ? m + b : m - b;
2049
+ g = fe(g, t), a !== void 0 ? g = Number(g.toFixed(a)) : g = Math.round(g * 1e4) / 1e4, i.registrarAlteracao(r, t.id, g), s(g);
2050
+ }
2051
+ }), o;
2052
+ }
2053
+ function dr(r, t, e, i) {
2054
+ const o = document.createElement("input");
2055
+ o.type = "text", o.className = "ui-prop__editor-input", o.setAttribute("aria-label", String(t.rotulo ?? t.id)), t.placeholder && (o.placeholder = t.placeholder);
2056
+ const a = (s) => {
2057
+ const l = S(s);
2058
+ o.value = l || s == null ? "" : String(s), Ve(o, t, l, T(i));
2059
+ };
2060
+ a(e), O(o, a), o.addEventListener("focus", () => {
2061
+ o.select();
2062
+ });
2063
+ const n = () => {
2064
+ o.value === "" && S(i.obterValorAtual(t.id)) || (i.registrarAlteracao(r, t.id, o.value), a(i.obterValorAtual(t.id)));
2065
+ };
2066
+ return o.addEventListener("change", n), o.addEventListener("blur", n), o.addEventListener("keydown", (s) => {
2067
+ s.key === "Enter" ? (n(), s.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o)) : s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), a(i.obterValorAtual(t.id)), o.blur());
2068
+ }), o;
2069
+ }
2070
+ const He = (r, t) => r.toLowerCase() === String(t ?? "").toLowerCase();
2071
+ function me(r, t) {
2072
+ (Array.isArray(t) ? t : []).forEach((e) => {
2073
+ if (!e || typeof e != "object") return;
2074
+ const i = document.createElement("option");
2075
+ i.value = String(e.id), i.textContent = String(e.rotulo ?? e.id), r.appendChild(i);
2076
+ });
2077
+ }
2078
+ function cr(r, t, e, i) {
2079
+ const o = document.createElement("div");
2080
+ o.className = "ui-prop__editor-linha-container";
2081
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2082
+ a.setAttribute("class", "ui-prop__linha-amostra-svg"), a.setAttribute("viewBox", "0 0 44 12"), a.setAttribute("aria-hidden", "true");
2083
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "line");
2084
+ n.setAttribute("x1", "0"), n.setAttribute("y1", "6"), n.setAttribute("x2", "44"), n.setAttribute("y2", "6");
2085
+ const s = (p) => {
2086
+ const c = String(p || "").toLowerCase();
2087
+ c.includes("center") || c.includes("eixo") || c.includes("dashdot") || c.includes("traço-ponto") ? n.setAttribute("stroke-dasharray", "8,3,2,3") : c.includes("dash") || c.includes("tracej") || c.includes("hidden") ? n.setAttribute("stroke-dasharray", "6,3") : c.includes("dot") || c.includes("ponto") || c.includes("pontilh") ? n.setAttribute("stroke-dasharray", "2,3") : n.setAttribute("stroke-dasharray", "none");
2088
+ };
2089
+ a.appendChild(n);
2090
+ const l = document.createElement("select");
2091
+ l.className = "ui-prop__linha-select", l.setAttribute("aria-label", String(t.rotulo ?? t.id));
2092
+ const u = t.opcoes && t.opcoes.length > 0 ? t.opcoes : [
2093
+ { id: "ByLayer", rotulo: "ByLayer" },
2094
+ { id: "ByBlock", rotulo: "ByBlock" },
2095
+ { id: "Continuous", rotulo: "Continuous" },
2096
+ { id: "Dashed", rotulo: "Dashed" },
2097
+ { id: "Hidden", rotulo: "Hidden" },
2098
+ { id: "Center", rotulo: "Center" },
2099
+ { id: "Dotted", rotulo: "Dotted" }
2100
+ ];
2101
+ me(l, u);
2102
+ const d = (p) => {
2103
+ const c = S(p);
2104
+ if (o.classList.toggle("ui-prop__editor--misto", c), c) {
2105
+ s(""), Q(l, T(i));
2106
+ return;
2107
+ }
2108
+ s(p), J(l, p, He);
2109
+ };
2110
+ return d(e), O(o, d), l.addEventListener("change", () => {
2111
+ const p = u.find((c) => c && String(c.id) === l.value);
2112
+ i.registrarAlteracao(r, t.id, p ? p.id : l.value), d(i.obterValorAtual(t.id));
2113
+ }), l.addEventListener("keydown", (p) => {
2114
+ p.key === "Enter" && (p.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(l) : i.focarProximoEditor(l));
2115
+ }), o.appendChild(a), o.appendChild(l), o;
2116
+ }
2117
+ function ur(r, t, e, i) {
2118
+ const o = document.createElement("div");
2119
+ o.className = "ui-prop__editor-espessura-container";
2120
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2121
+ a.setAttribute("class", "ui-prop__espessura-amostra-svg"), a.setAttribute("viewBox", "0 0 38 12"), a.setAttribute("aria-hidden", "true");
2122
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "line");
2123
+ n.setAttribute("x1", "0"), n.setAttribute("y1", "6"), n.setAttribute("x2", "38"), n.setAttribute("y2", "6");
2124
+ const s = (p) => {
2125
+ const c = parseFloat(String(p).replace(/[^0-9.]/g, ""));
2126
+ return isNaN(c) || c <= 0 ? 1.5 : Math.min(8, Math.max(1, c * 8));
2127
+ };
2128
+ a.appendChild(n);
2129
+ const l = document.createElement("select");
2130
+ l.className = "ui-prop__espessura-select", l.setAttribute("aria-label", String(t.rotulo ?? t.id));
2131
+ const u = t.opcoes && t.opcoes.length > 0 ? t.opcoes : [
2132
+ { id: "ByLayer", rotulo: "ByLayer" },
2133
+ { id: "ByBlock", rotulo: "ByBlock" },
2134
+ { id: "0.00 mm", rotulo: "0.00 mm" },
2135
+ { id: "0.05 mm", rotulo: "0.05 mm" },
2136
+ { id: "0.09 mm", rotulo: "0.09 mm" },
2137
+ { id: "0.13 mm", rotulo: "0.13 mm" },
2138
+ { id: "0.15 mm", rotulo: "0.15 mm" },
2139
+ { id: "0.18 mm", rotulo: "0.18 mm" },
2140
+ { id: "0.20 mm", rotulo: "0.20 mm" },
2141
+ { id: "0.25 mm", rotulo: "0.25 mm" },
2142
+ { id: "0.30 mm", rotulo: "0.30 mm" },
2143
+ { id: "0.35 mm", rotulo: "0.35 mm" },
2144
+ { id: "0.40 mm", rotulo: "0.40 mm" },
2145
+ { id: "0.50 mm", rotulo: "0.50 mm" },
2146
+ { id: "0.60 mm", rotulo: "0.60 mm" },
2147
+ { id: "0.70 mm", rotulo: "0.70 mm" },
2148
+ { id: "1.00 mm", rotulo: "1.00 mm" },
2149
+ { id: "1.40 mm", rotulo: "1.40 mm" },
2150
+ { id: "2.00 mm", rotulo: "2.00 mm" }
2151
+ ];
2152
+ me(l, u);
2153
+ const d = (p) => {
2154
+ const c = S(p);
2155
+ o.classList.toggle("ui-prop__editor--misto", c), n.setAttribute("stroke-width", String(s(c ? "" : p))), c ? Q(l, T(i)) : J(l, p, He);
2156
+ };
2157
+ return d(e), O(o, d), l.addEventListener("change", () => {
2158
+ const p = u.find((c) => c && String(c.id) === l.value);
2159
+ i.registrarAlteracao(r, t.id, p ? p.id : l.value), d(i.obterValorAtual(t.id));
2160
+ }), l.addEventListener("keydown", (p) => {
2161
+ p.key === "Enter" && (p.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(l) : i.focarProximoEditor(l));
2162
+ }), o.appendChild(a), o.appendChild(l), o;
2163
+ }
2164
+ const ge = [
2165
+ { nome: "Red", indice: 1, hex: "#ff0000" },
2166
+ { nome: "Yellow", indice: 2, hex: "#ffff00" },
2167
+ { nome: "Green", indice: 3, hex: "#00ff00" },
2168
+ { nome: "Cyan", indice: 4, hex: "#00ffff" },
2169
+ { nome: "Blue", indice: 5, hex: "#0000ff" },
2170
+ { nome: "Magenta", indice: 6, hex: "#ff00ff" },
2171
+ { nome: "White", indice: 7, hex: "#ffffff" }
2172
+ ], qe = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
2173
+ function se(r) {
2174
+ const t = String(r ?? "").trim().toLowerCase(), e = ge.find((i) => String(i.indice) === t || i.nome.toLowerCase() === t);
2175
+ return e ? e.nome.toLowerCase() : t;
2176
+ }
2177
+ function pr(r) {
2178
+ const t = se(r), e = ge.find((i) => i.nome.toLowerCase() === t);
2179
+ return e ? e.hex : qe.test(t) ? t : "#ffffff";
2180
+ }
2181
+ function $e(r) {
2182
+ return r.length === 4 ? "#" + r.slice(1).split("").map((t) => t + t).join("") : r;
2183
+ }
2184
+ function hr(r, t, e, i) {
2185
+ const o = document.createElement("div");
2186
+ o.className = "ui-prop__editor-cor-cad-container";
2187
+ const a = document.createElement("div");
2188
+ a.className = "ui-prop__cor-amostra";
2189
+ const n = document.createElement("select");
2190
+ n.className = "ui-prop__cor-cad-select", n.setAttribute("aria-label", String(t.rotulo ?? t.id)), me(n, [
2191
+ { id: "ByLayer", rotulo: "ByLayer" },
2192
+ { id: "ByBlock", rotulo: "ByBlock" },
2193
+ ...ge.map((d) => ({ id: d.nome, rotulo: `${d.nome} (${d.indice})` }))
2194
+ ]);
2195
+ const s = document.createElement("option");
2196
+ s.value = "__escolher", s.textContent = "Selecionar cor...", s.setAttribute("data-acao", ""), n.appendChild(s);
2197
+ const l = document.createElement("input");
2198
+ l.type = "color", l.className = "ui-prop__cor-picker-oculto", l.tabIndex = -1, l.setAttribute("aria-hidden", "true");
2199
+ const u = (d) => {
2200
+ const p = S(d);
2201
+ if (o.classList.toggle("ui-prop__editor--misto", p), a.classList.toggle("ui-prop__cor-amostra--misto", p), p) {
2202
+ a.style.backgroundColor = "", l.value = "#ffffff", Q(n, T(i));
2203
+ return;
2204
+ }
2205
+ const c = pr(d);
2206
+ a.style.backgroundColor = c, l.value = $e(c), J(
2207
+ n,
2208
+ d,
2209
+ (h, f) => se(h) === se(f),
2210
+ (h) => h == null || h === "" ? "—" : String(h)
2211
+ );
2212
+ };
2213
+ return u(e), O(o, u), l.addEventListener("input", () => {
2214
+ a.style.backgroundColor = l.value;
2215
+ }), l.addEventListener("change", () => {
2216
+ i.registrarAlteracao(r, t.id, l.value), u(i.obterValorAtual(t.id));
2217
+ }), n.addEventListener("change", () => {
2218
+ if (n.value === "__escolher") {
2219
+ u(i.obterValorAtual(t.id)), l.click();
2220
+ return;
2221
+ }
2222
+ i.registrarAlteracao(r, t.id, n.value), u(i.obterValorAtual(t.id));
2223
+ }), n.addEventListener("keydown", (d) => {
2224
+ d.key === "Enter" && (d.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(n) : i.focarProximoEditor(n));
2225
+ }), o.appendChild(a), o.appendChild(n), o.appendChild(l), o;
2226
+ }
2227
+ function fr(r, t, e, i) {
2228
+ const o = document.createElement("div");
2229
+ o.className = "ui-prop__editor-cor-container", o.setAttribute("role", "button"), o.tabIndex = 0;
2230
+ const a = document.createElement("div");
2231
+ a.className = "ui-prop__cor-amostra";
2232
+ const n = document.createElement("span");
2233
+ n.className = "ui-prop__cor-texto";
2234
+ const s = document.createElement("input");
2235
+ s.type = "color", s.className = "ui-prop__cor-picker-oculto", s.tabIndex = -1, s.setAttribute("aria-hidden", "true");
2236
+ const l = (u) => {
2237
+ const d = S(u);
2238
+ if (o.classList.toggle("ui-prop__editor--misto", d), a.classList.toggle("ui-prop__cor-amostra--misto", d), d) {
2239
+ const c = T(i);
2240
+ a.style.backgroundColor = "", n.textContent = c, s.value = "#ffffff", o.setAttribute("aria-label", `${t.rotulo ?? t.id}: ${c}`);
2241
+ return;
2242
+ }
2243
+ const p = typeof u == "string" && qe.test(u) ? $e(u) : null;
2244
+ a.style.backgroundColor = u || "#ffffff", n.textContent = t.textoAmostra || String(u || "ByLayer"), s.value = p ?? "#ffffff", o.setAttribute("aria-label", `${t.rotulo ?? t.id}: ${u || "ByLayer"}`);
2245
+ };
2246
+ return l(e), O(o, l), s.addEventListener("input", () => {
2247
+ a.style.backgroundColor = s.value, n.textContent = t.textoAmostra || s.value;
2248
+ }), s.addEventListener("change", () => {
2249
+ i.registrarAlteracao(r, t.id, s.value), l(i.obterValorAtual(t.id));
2250
+ }), o.addEventListener("click", (u) => {
2251
+ u.target !== s && s.click();
2252
+ }), o.addEventListener("keydown", (u) => {
2253
+ (u.key === " " || u.key === "Enter") && (u.preventDefault(), s.click());
2254
+ }), o.appendChild(a), o.appendChild(n), o.appendChild(s), o;
2255
+ }
2256
+ function mr(r, t, e, i) {
2257
+ let o;
2258
+ return t.somenteLeitura || t.tipo === "readonly" ? o = or(e, i.obterTextoMisto, t) : t.tipo === "booleano" ? o = ar(r, t, e, i) : t.tipo === "linha" || t.tipo === "linetype" ? o = cr(r, t, e, i) : t.tipo === "espessura" || t.tipo === "lineweight" ? o = ur(r, t, e, i) : t.tipo === "cor-cad" ? o = hr(r, t, e, i) : t.tipo === "selecao" ? o = nr(r, t, e, i) : t.tipo === "cor" ? o = fr(r, t, e, i) : t.tipo === "acao" ? o = sr(r, t, i) : t.tipo === "numero" ? o = lr(r, t, e, i) : o = dr(r, t, e, i), o.setAttribute("part", "editor"), t.dica && o.setAttribute("aria-description", t.dica), o;
2259
+ }
2260
+ function gr(r) {
2261
+ if (!r.tipoContainerElement) return;
2262
+ const t = (Array.isArray(r.tipos) ? r.tipos : []).filter(
2263
+ (i) => !!(i && typeof i == "object" && i.id !== void 0 && i.id !== null)
2264
+ );
2265
+ if (t.length === 0) {
2266
+ r.tipoContainerElement.style.display = "none", r.tipoContainerElement.innerHTML = "";
2267
+ return;
2268
+ }
2269
+ r.tipoContainerElement.style.display = "flex", r.tipoContainerElement.innerHTML = "";
2270
+ const e = t.find((i) => String(i.id) === String(r.tipoSelecionadoId)) || t[0];
2271
+ if (r.estiloVisual === "revit") {
2272
+ const i = document.createElement("div");
2273
+ i.className = "ui-prop__tipo-revit-card", i.title = "Editar tipo de família", i.addEventListener("click", () => r.onEditarTipo(e));
2274
+ const o = document.createElement("div");
2275
+ o.className = "ui-prop__tipo-miniatura";
2276
+ const a = e.iconeSvg ? We(e.iconeSvg) : null;
2277
+ a ? o.appendChild(a) : o.innerHTML = `
2278
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
2279
+ <rect x="3" y="3" width="18" height="18" rx="2"></rect>
2280
+ <path d="M3 9h18M9 21V9"></path>
2281
+ </svg>
2282
+ `;
2283
+ const n = document.createElement("div");
2284
+ n.className = "ui-prop__tipo-info";
2285
+ const s = document.createElement("div");
2286
+ s.className = "ui-prop__tipo-nome", s.textContent = String(e.rotulo ?? e.id);
2287
+ const l = document.createElement("div");
2288
+ l.className = "ui-prop__tipo-subtexto", l.textContent = e.subtipo || "Tipo de Família", n.appendChild(s), n.appendChild(l), i.appendChild(o), i.appendChild(n);
2289
+ const u = document.createElement("div");
2290
+ u.className = "ui-prop__tipo-revit-subbarra";
2291
+ const d = document.createElement("select");
2292
+ d.className = "ui-prop__tipo-select", d.setAttribute("aria-label", "Selecionar tipo de família"), t.forEach((c) => {
2293
+ const h = document.createElement("option");
2294
+ h.value = String(c.id), h.textContent = `${c.rotulo ?? c.id}${c.subtipo ? ` : ${c.subtipo}` : ""}`, String(c.id) === String(e.id) && (h.selected = !0), d.appendChild(h);
2295
+ }), d.addEventListener("change", () => {
2296
+ r.onSelecionarTipo(d.value);
2297
+ });
2298
+ const p = document.createElement("button");
2299
+ p.type = "button", p.className = "ui-prop__btn-editar-tipo", p.innerHTML = `
2300
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 4px; vertical-align: -1px;" aria-hidden="true">
2301
+ <rect x="3" y="3" width="12" height="12" rx="1"></rect>
2302
+ <rect x="9" y="9" width="12" height="12" rx="1"></rect>
2303
+ </svg>
2304
+ <span>Editar tipo</span>
2305
+ `, p.addEventListener("click", () => {
2306
+ r.onEditarTipo(e);
2307
+ }), u.appendChild(d), u.appendChild(p), r.tipoContainerElement.appendChild(i), r.tipoContainerElement.appendChild(u);
2308
+ } else {
2309
+ const i = document.createElement("div");
2310
+ i.className = "ui-prop__tipo-autocad-bar";
2311
+ const o = document.createElement("select");
2312
+ o.className = "ui-prop__tipo-select", o.setAttribute("aria-label", "Selecionar tipo de objeto"), t.forEach((u) => {
2313
+ const d = document.createElement("option");
2314
+ d.value = String(u.id), d.textContent = String(u.rotulo ?? u.id), String(u.id) === String(e.id) && (d.selected = !0), o.appendChild(d);
2315
+ }), o.addEventListener("change", () => {
2316
+ r.onSelecionarTipo(o.value);
2317
+ });
2318
+ const a = document.createElement("div");
2319
+ a.className = "ui-prop__tipo-autocad-acoes";
2320
+ const n = document.createElement("button");
2321
+ n.type = "button", n.className = "ui-prop__btn-autocad", n.title = "Seleção rápida", n.setAttribute("aria-label", "Seleção rápida"), n.innerHTML = `
2322
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
2323
+ <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
2324
+ </svg>
2325
+ `, n.addEventListener("click", () => {
2326
+ r.onQuickSelect(e);
2327
+ });
2328
+ const s = document.createElement("button");
2329
+ s.type = "button", s.className = "ui-prop__btn-autocad", s.title = "Selecionar objetos", s.setAttribute("aria-label", "Selecionar objetos"), s.innerHTML = `
2330
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
2331
+ <circle cx="12" cy="12" r="7"></circle>
2332
+ <line x1="12" y1="2" x2="12" y2="7"></line>
2333
+ <line x1="12" y1="17" x2="12" y2="22"></line>
2334
+ <line x1="2" y1="12" x2="7" y2="12"></line>
2335
+ <line x1="17" y1="12" x2="22" y2="12"></line>
2336
+ <line x1="12" y1="9" x2="12" y2="15" stroke-width="2.5"></line>
2337
+ <line x1="9" y1="12" x2="15" y2="12" stroke-width="2.5"></line>
2338
+ </svg>
2339
+ `, s.addEventListener("click", () => {
2340
+ r.onSelectObjects(e);
2341
+ });
2342
+ const l = document.createElement("button");
2343
+ l.type = "button", l.className = "ui-prop__btn-autocad", l.title = "Calculadora rápida", l.setAttribute("aria-label", "Calculadora rápida"), l.innerHTML = `
2344
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
2345
+ <rect x="4" y="2" width="16" height="20" rx="2"></rect>
2346
+ <line x1="8" y1="6" x2="16" y2="6"></line>
2347
+ <circle cx="8" cy="11" r="1" fill="currentColor"></circle>
2348
+ <circle cx="12" cy="11" r="1" fill="currentColor"></circle>
2349
+ <circle cx="16" cy="11" r="1" fill="currentColor"></circle>
2350
+ <circle cx="8" cy="15" r="1" fill="currentColor"></circle>
2351
+ <circle cx="12" cy="15" r="1" fill="currentColor"></circle>
2352
+ <circle cx="16" cy="15" r="1" fill="currentColor"></circle>
2353
+ </svg>
2354
+ `, l.addEventListener("click", () => {
2355
+ r.onCalculadora(e);
2356
+ }), a.appendChild(n), a.appendChild(s), a.appendChild(l), i.appendChild(o), i.appendChild(a), r.tipoContainerElement.appendChild(i);
2357
+ }
2358
+ }
2359
+ function br(r) {
2360
+ let t = 45;
2361
+ function e(a) {
2362
+ if (!Number.isFinite(a)) return t;
2363
+ const n = Math.max(20, Math.min(65, a));
2364
+ return t = n, r.hostElement.style.setProperty("--ui-prop-rotulo-largura", `${n}%`), r.splitterElement && (r.splitterElement.style.left = `calc(${n}% - 4px)`, r.splitterElement.setAttribute("aria-valuenow", String(Math.round(n)))), n;
2365
+ }
2366
+ function i(a) {
2367
+ r.onLarguraAlterada(a), r.hostElement.dispatchEvent(
2368
+ new CustomEvent("ui-splitter-resize", {
2369
+ bubbles: !0,
2370
+ composed: !0,
2371
+ detail: { larguraPorcentagem: a }
2372
+ })
2373
+ );
2374
+ }
2375
+ function o() {
2376
+ if (!r.splitterElement || !r.corpoElement) return;
2377
+ r.splitterListeners.cleanup();
2378
+ let a = !1;
2379
+ const n = (s) => {
2380
+ if (s.button !== 0) return;
2381
+ s.preventDefault(), s.stopPropagation(), a = !0, r.splitterElement.classList.add("ui-prop__splitter--ativo");
2382
+ try {
2383
+ r.splitterElement.setPointerCapture(s.pointerId);
2384
+ } catch {
2385
+ }
2386
+ const l = r.corpoElement.getBoundingClientRect(), u = (p) => {
2387
+ if (!a) return;
2388
+ const c = l.width;
2389
+ if (c <= 0) return;
2390
+ const h = p.clientX - l.left;
2391
+ let g = Math.max(80, Math.min(c - 130, h)) / c * 100;
2392
+ g = Math.max(20, Math.min(65, g)), e(g);
2393
+ }, d = (p) => {
2394
+ if (a) {
2395
+ a = !1, r.splitterElement.classList.remove("ui-prop__splitter--ativo");
2396
+ try {
2397
+ r.splitterElement.hasPointerCapture(p.pointerId) && r.splitterElement.releasePointerCapture(p.pointerId);
2398
+ } catch {
2399
+ }
2400
+ r.splitterElement.removeEventListener("pointermove", u), r.splitterElement.removeEventListener("pointerup", d), r.splitterElement.removeEventListener("pointercancel", d), i(t);
2401
+ }
2402
+ };
2403
+ r.splitterElement.addEventListener("pointermove", u), r.splitterElement.addEventListener("pointerup", d), r.splitterElement.addEventListener("pointercancel", d);
2404
+ };
2405
+ r.splitterListeners.add(r.splitterElement, "pointerdown", n), r.splitterListeners.add(r.splitterElement, "dblclick", () => {
2406
+ const s = e(45);
2407
+ i(s);
2408
+ }), r.splitterListeners.add(r.splitterElement, "keydown", (s) => {
2409
+ const l = s.shiftKey ? 5 : 2;
2410
+ let u = null;
2411
+ if (s.key === "ArrowLeft" ? u = t - l : s.key === "ArrowRight" ? u = t + l : s.key === "Home" ? u = 20 : s.key === "End" ? u = 65 : s.key === "Enter" && (u = 45), u !== null) {
2412
+ s.preventDefault(), s.stopPropagation();
2413
+ const d = e(u);
2414
+ i(d);
2415
+ }
2416
+ });
2417
+ }
2418
+ return {
2419
+ init: o,
2420
+ definirLarguraRotulo: e
2421
+ };
2422
+ }
2423
+ const vr = `:host{display:flex;flex-direction:column;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:var(--ui-tamanho-corpo-sm, 12px);color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-degrade-interno, var(--ui-prop-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 4px);overflow:hidden;width:100%;max-width:100%;height:100%;min-height:200px;-webkit-user-select:none;user-select:none;--ui-prop-altura-linha: 22px;--ui-prop-rotulo-largura: 45%}:host([densidade="compacta"]){--ui-prop-altura-linha: 19px;font-size:10.5px}:host([densidade="ultracompacta"]){--ui-prop-altura-linha: 17px;font-size:10px}:host([densidade="relaxada"]){--ui-prop-altura-linha: 28px;font-size:12px}:host([colapsado]){width:32px!important;min-width:32px!important;max-width:32px!important;height:100%!important;cursor:pointer;transition:width .2s cubic-bezier(.4,0,.2,1)}:host([colapsado]) .ui-prop__header,:host([colapsado]) .ui-prop__tipo-seletor-container,:host([colapsado]) .ui-prop__filtro-container,:host([colapsado]) .ui-prop__corpo-wrapper,:host([colapsado]) .ui-prop__footer,:host([colapsado]) .ui-prop__resizer-canto{display:none!important}:host([colapsado]) .ui-prop__faixa-estreita{display:flex!important;flex-direction:column;align-items:center;width:100%;height:100%;padding:8px 0;gap:10px;box-sizing:border-box;background:var(--ui-prop-elevado-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #18181d)));-webkit-user-select:none;user-select:none;cursor:pointer}.ui-prop__faixa-estreita{display:none}.ui-prop__faixa-icone{display:flex;align-items:center;justify-content:center;color:var(--ui-cor-destaque, #00E08A);flex-shrink:0}.ui-prop__faixa-btn-expandir{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:3px;color:var(--ui-cor-texto, #e1e1e6);cursor:pointer;padding:0;transition:all .15s ease;flex-shrink:0}.ui-prop__faixa-btn-expandir:hover{background:var(--ui-cor-destaque, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000);border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__faixa-texto{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:2px;color:var(--ui-cor-texto-secundario, #888899);margin-top:8px;flex:1;pointer-events:none}:host([colapsado]):hover .ui-prop__faixa-texto{color:var(--ui-cor-texto, #ffffff)}:host([flutuante]){position:fixed!important;z-index:var(--ui-z-docked-bar, 600)!important;box-shadow:var(--ui-sombra-lg, 0 16px 48px rgba(0, 0, 0, .75)),0 0 0 1px color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 14%,transparent),0 6px 14px #00000080!important;border-radius:6px!important;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);resize:both;overflow:hidden;max-width:95vw;max-height:95vh;min-width:220px;min-height:200px}:host([flutuante]) .ui-prop__header{cursor:grab;-webkit-user-select:none;user-select:none}:host([flutuante].arrastando) .ui-prop__header{cursor:grabbing!important}.ui-prop__resizer-canto{display:none}:host([flutuante]) .ui-prop__resizer-canto{display:block;position:absolute;bottom:0;right:0;width:14px;height:14px;cursor:nwse-resize;z-index:50;background:linear-gradient(135deg,transparent 50%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 50%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 65%,transparent 65%,transparent 80%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 80%);pointer-events:auto}.ui-prop__btn-icone--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent)!important;color:var(--ui-cor-destaque, #00E08A)!important}.ui-prop__container{display:flex;flex-direction:column;width:100%;height:100%;min-height:0;flex:1;overflow:hidden;box-sizing:border-box;background:var(--ui-degrade-interno, var(--ui-prop-container-fundo, transparent))}.ui-prop__header{display:flex;align-items:center;justify-content:space-between;height:22px;min-height:22px;padding:0 8px;background:var(--ui-prop-elevado-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e)));border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__header{height:20px;min-height:20px;padding:0 6px}:host([densidade="ultracompacta"]) .ui-prop__header{height:18px;min-height:18px;padding:0 5px}.ui-prop__header-titulo{display:flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;color:var(--ui-cor-texto, #ffffff);text-transform:uppercase;letter-spacing:.4px}:host([densidade="compacta"]) .ui-prop__header-titulo{font-size:10px;gap:4px}:host([densidade="ultracompacta"]) .ui-prop__header-titulo{font-size:9.5px;gap:3px}.ui-prop__header-icone{display:flex;align-items:center;color:var(--ui-cor-destaque, #00E08A)}.ui-prop__header-icone svg{width:12px;height:12px}:host([densidade="ultracompacta"]) .ui-prop__header-icone svg{width:10px;height:10px}.ui-prop__header-acoes{display:flex;align-items:center;gap:2px}.ui-prop__btn-icone{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;background:transparent;border:none;border-radius:2px;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;transition:all .15s ease;padding:0}.ui-prop__btn-icone:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto, #ffffff)}:host([densidade="compacta"]) .ui-prop__btn-icone{width:17px;height:17px}:host([densidade="ultracompacta"]) .ui-prop__btn-icone{width:16px;height:16px}.ui-prop__tipo-seletor-container{padding:3px 6px;background:var(--ui-prop-secao-fundo, var(--ui-cor-superficie, #141417));border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));display:flex;flex-direction:column;gap:3px;flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__tipo-seletor-container{padding:2px 5px;gap:2px}:host([densidade="ultracompacta"]) .ui-prop__tipo-seletor-container{padding:1px 4px;gap:1px}.ui-prop__tipo-revit-card{display:flex;align-items:center;gap:10px;background:var(--ui-prop-card-fundo, var(--ui-fundo-card, var(--ui-cor-fundo-card, #18181c)));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-sm, 4px);padding:6px 8px;cursor:pointer;transition:border-color .15s ease}.ui-prop__tipo-revit-card:hover{border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__tipo-miniatura{width:32px;height:32px;border-radius:3px;background:var(--ui-cor-fundo-elevado, #24242a);display:flex;align-items:center;justify-content:center;color:var(--ui-cor-destaque, #00E08A);flex-shrink:0}.ui-prop__tipo-info{display:flex;flex-direction:column;flex:1;min-width:0}.ui-prop__tipo-nome{font-weight:600;font-size:12px;color:var(--ui-cor-texto, #ffffff);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ui-prop__tipo-subtexto{font-size:11px;color:var(--ui-cor-texto-secundario, #888899);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ui-prop__tipo-revit-subbarra{display:flex;align-items:center;gap:6px}.ui-prop__tipo-select{flex:1;min-width:0;width:0;height:20px;--_chevron: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");color:var(--ui-cor-texto, #ffffff);border:none;border-radius:2px;padding:0 16px 0 2px;font-size:10.5px;font-weight:500;cursor:pointer;outline:none;appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--_chevron) right 4px center / 8px 5px no-repeat,transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,color .15s ease}.ui-prop__tipo-select:hover{background:var(--_chevron) right 4px center / 8px 5px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);color:var(--ui-cor-texto, #ffffff)}.ui-prop__tipo-select:focus{background:var(--_chevron) right 4px center / 8px 5px no-repeat,color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent);color:var(--ui-cor-destaque, #00E08A)}:host([densidade="compacta"]) .ui-prop__tipo-select{height:18px;font-size:10px;padding:0 14px 0 2px}:host([densidade="ultracompacta"]) .ui-prop__tipo-select{height:16px;font-size:9.5px;padding:0 12px 0 2px}.ui-prop__btn-editar-tipo{height:20px;padding:0 6px;background:transparent;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:2px;color:var(--ui-cor-texto, #ffffff);font-size:10.5px;font-weight:500;cursor:pointer;white-space:nowrap;transition:all .15s ease}:host([densidade="compacta"]) .ui-prop__btn-editar-tipo{height:18px;font-size:10px}:host([densidade="ultracompacta"]) .ui-prop__btn-editar-tipo{height:16px;font-size:9.5px}.ui-prop__btn-editar-tipo:hover{background:var(--ui-cor-botao-secundario-hover, #2a2a34);border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__tipo-autocad-bar{display:flex;align-items:center;gap:2px;width:100%;min-width:0;box-sizing:border-box;background:transparent}.ui-prop__tipo-autocad-acoes{display:flex;align-items:center;gap:1px;flex-shrink:0;border-left:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));padding-left:3px;margin-left:1px}.ui-prop__btn-autocad{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;background:transparent;border:none;border-radius:2px;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;padding:0;transition:all .15s ease}:host([densidade="compacta"]) .ui-prop__btn-autocad{width:18px;height:18px}:host([densidade="ultracompacta"]) .ui-prop__btn-autocad{width:16px;height:16px}.ui-prop__btn-autocad:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .1));color:var(--ui-cor-destaque, #00E08A)}.ui-prop__btn-autocad:active{transform:scale(.92);background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}.ui-prop__filtro-container{display:flex;align-items:center;padding:4px 8px;background:var(--ui-prop-filtro-fundo, var(--ui-cor-fundo, #0b0b0d));border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));gap:6px;flex-shrink:0}.ui-prop__filtro-icone{color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0}.ui-prop__filtro-input{flex:1;background:transparent;border:none;outline:none;font-size:11px;color:var(--ui-cor-texto, #e1e1e6);padding:3px 0}.ui-prop__filtro-limpar{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;font-size:11px;padding:0 4px;display:inline-flex;align-items:center;justify-content:center;border-radius:2px}.ui-prop__filtro-limpar:hover{color:var(--ui-cor-texto, #ffffff);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-prop__filtro-input::placeholder{color:var(--ui-cor-texto-secundario, #666677)}.ui-prop__corpo-wrapper{position:relative;flex:1;min-height:0;width:100%;overflow:hidden;display:flex;flex-direction:column}.ui-prop__corpo{flex:1;min-height:0;width:100%;overflow-y:auto;overflow-x:hidden;background:var(--ui-prop-secao-fundo, var(--ui-cor-superficie, #141417));position:relative;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent) var(--ui-cor-fundo, #0b0b0d)}.ui-prop__corpo::-webkit-scrollbar{width:8px}.ui-prop__corpo::-webkit-scrollbar-track{background:var(--ui-cor-fundo, #0b0b0d)}.ui-prop__corpo::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent);border-radius:var(--ui-raio-sm, 4px)}.ui-prop__corpo::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent)}.ui-prop__categoria{border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1))}.ui-prop__categoria-header{position:relative;z-index:25;display:flex;align-items:center;justify-content:space-between;height:21px;padding:0 6px;background:var(--ui-prop-categoria-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #18181d)));cursor:pointer;-webkit-user-select:none;user-select:none;font-weight:600;font-size:10.5px;color:var(--ui-cor-texto, #ffffff);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .05));transition:background-color .15s ease;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__categoria-header{height:19px;font-size:10px;padding:0 5px}:host([densidade="ultracompacta"]) .ui-prop__categoria-header{height:17px;font-size:9.5px;padding:0 4px}.ui-prop__categoria-header:focus-visible{outline:1.5px solid var(--ui-cor-destaque, #00E08A);outline-offset:-1.5px}.ui-prop__categoria-header:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .06))}.ui-prop__categoria-titulo-bloco{display:flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__categoria-seta{display:inline-flex;align-items:center;justify-content:center;font-size:9px;width:12px;height:12px;color:var(--ui-cor-texto-secundario, #888899);transition:transform .15s ease}.ui-prop__categoria--aberta .ui-prop__categoria-seta{transform:rotate(90deg)}.ui-prop__categoria-contador{font-size:10px;font-weight:400;color:var(--ui-cor-texto-secundario, #888899)}.ui-prop__categoria-conteudo{display:none}.ui-prop__categoria--aberta .ui-prop__categoria-conteudo{display:block}.ui-prop__linha{display:flex;align-items:stretch;min-height:var(--ui-prop-altura-linha, 24px);border-bottom:1px dotted var(--ui-cor-borda, rgba(255, 255, 255, .08));box-sizing:border-box;position:relative;z-index:1;transition:background-color .1s ease}.ui-prop__linha:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .04))}.ui-prop__linha:focus-within{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)}.ui-prop__linha:focus-within .ui-prop__col-rotulo{color:var(--ui-cor-texto, #ffffff);font-weight:500}.ui-prop__linha--modificada{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 5%,transparent)}.ui-prop__col-rotulo{width:var(--ui-prop-rotulo-largura, 45%);padding:1px 4px 1px 8px;display:flex;align-items:center;color:var(--ui-cor-texto-secundario, #9999aa);border-right:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;position:relative;flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__col-rotulo{padding:0 4px 0 6px;font-size:10px}:host([densidade="ultracompacta"]) .ui-prop__col-rotulo{padding:0 3px 0 5px;font-size:9.5px}.ui-prop__col-rotulo span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__col-rotulo--scrub{cursor:ew-resize;-webkit-user-select:none;user-select:none;transition:color .15s ease,background-color .15s ease}.ui-prop__col-rotulo--scrub:hover{color:var(--ui-cor-destaque, #00E08A);background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 5%,transparent)}.ui-prop__col-rotulo--arrastando{color:var(--ui-cor-texto-sobre-primaria, #000000)!important;background:var(--ui-cor-destaque, #00E08A)!important;font-weight:600;cursor:ew-resize!important}.ui-prop__col-rotulo--arrastando span{color:var(--ui-cor-texto-sobre-primaria, #000000)!important}.ui-prop__splitter{position:absolute;top:0;bottom:0;min-height:100%;left:calc(var(--ui-prop-rotulo-largura, 45%) - 4px);width:8px;cursor:col-resize;z-index:30;touch-action:none;-webkit-user-select:none;user-select:none;display:flex;align-items:center;justify-content:center}.ui-prop__splitter:after{content:"";position:absolute;top:0;bottom:0;left:3px;width:2px;background:transparent;pointer-events:none;transition:background-color .15s ease,box-shadow .15s ease}.ui-prop__splitter:hover:after,.ui-prop__splitter--ativo:after{background:var(--ui-cor-destaque, #00E08A);box-shadow:0 0 6px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 50%,transparent)}.ui-prop__splitter:focus-visible{outline:none}.ui-prop__splitter:focus-visible:after{background:var(--ui-cor-destaque, #00E08A);box-shadow:0 0 6px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 50%,transparent)}.ui-prop__splitter--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)}.ui-prop__col-valor{width:calc(100% - var(--ui-prop-rotulo-largura, 45%));flex:1 1 0px;min-width:0!important;display:flex;align-items:stretch;padding:0;overflow:hidden;box-sizing:border-box;position:relative;transition:background-color .1s ease,box-shadow .1s ease}.ui-prop__col-valor:focus-within{background:var(--ui-cor-fundo, #0b0b0d);box-shadow:inset 0 0 0 1px var(--ui-cor-destaque, #00E08A)}.ui-prop__editor-input{width:100%;min-width:0;height:100%;min-height:var(--ui-prop-altura-linha, 24px);background:transparent;border:none;border-radius:0;color:var(--ui-cor-texto, #ffffff);font-family:inherit;font-size:11px;padding:0 8px;outline:none;box-sizing:border-box;transition:background-color .1s ease}.ui-prop__editor-input:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__editor-input--numero{text-align:right;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums}.ui-prop__editor-input--calculando{color:var(--ui-cor-destaque, #00E08A)!important;font-weight:500}.ui-prop__col-valor:has(.ui-prop__editor-input--calculando){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)!important;box-shadow:inset 0 0 0 1.5px var(--ui-cor-destaque, #00E08A)!important}.ui-prop__editor-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);--_chevron: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 8px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--_chevron) right 6px center / 8px 5px no-repeat,transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;transition:background-color .1s ease}.ui-prop__editor-select:hover{background:var(--_chevron) right 6px center / 8px 5px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__editor-select option{background:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-cor-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);cursor:pointer;padding:0 20px 0 8px;box-sizing:border-box;position:relative;border:none;border-radius:0;--_chevron: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background:var(--_chevron) right 6px center / 8px 5px no-repeat,transparent;transition:background-color .1s ease}.ui-prop__editor-cor-container:hover{background:var(--_chevron) right 6px center / 8px 5px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent)}.ui-prop__cor-amostra{width:13px;height:13px;border-radius:2px;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent);flex-shrink:0;box-sizing:border-box}.ui-prop__cor-texto{flex:1 1 0px;min-width:0!important;width:0!important;font-size:11px;color:var(--ui-cor-texto, #ffffff);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__cor-picker-oculto{position:absolute;opacity:0;pointer-events:none;width:0;height:0}.ui-prop__editor-linha-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__linha-amostra-svg{width:24px;height:10px;flex-shrink:0}.ui-prop__linha-amostra-svg line{stroke:var(--ui-cor-texto, #e1e1e6);stroke-width:1.5}.ui-prop__linha-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;--_chevron: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--_chevron) right 6px center / 8px 5px no-repeat,transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__linha-select:hover{background:var(--_chevron) right 6px center / 8px 5px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__linha-select option{background:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-espessura-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__espessura-amostra-svg{width:20px;height:10px;flex-shrink:0}.ui-prop__espessura-amostra-svg line{stroke:var(--ui-cor-texto, #e1e1e6)}.ui-prop__espessura-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;--_chevron: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--_chevron) right 6px center / 8px 5px no-repeat,transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__espessura-select:hover{background:var(--_chevron) right 6px center / 8px 5px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__espessura-select option{background:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-cor-cad-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__cor-cad-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;--_chevron: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--_chevron) right 6px center / 8px 5px no-repeat,transparent;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__cor-cad-select:hover{background:var(--_chevron) right 6px center / 8px 5px no-repeat,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__cor-cad-select option{background:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-booleano{display:flex;align-items:center;gap:6px;width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);cursor:pointer;padding:0 8px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.ui-prop__editor-booleano:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__checkbox-custom{width:13px;height:13px;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .25));border-radius:2px;background:var(--ui-cor-fundo, #0b0b0d);display:flex;align-items:center;justify-content:center;transition:all .15s ease}.ui-prop__checkbox-custom--marcado{background:var(--ui-cor-destaque, #00E08A);border-color:var(--ui-cor-destaque, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-prop__booleano-rotulo{font-size:11px;color:var(--ui-cor-texto, #ffffff)}.ui-prop__btn-acao-inline{width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 8px;background:transparent;border:none;border-radius:0;color:var(--ui-cor-texto, #ffffff);font-size:11px;font-weight:500;cursor:pointer;white-space:nowrap;text-align:left;transition:all .15s ease;box-sizing:border-box}.ui-prop__btn-acao-inline:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent);color:var(--ui-cor-destaque, #00E08A)}.ui-prop__valor-readonly{display:flex;align-items:center;width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);font-size:11px;color:var(--ui-cor-texto-secundario, #777788);padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box;-webkit-user-select:text;user-select:text}.ui-prop__valor-readonly--numero{justify-content:flex-end;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums}.ui-prop__unidade-sufixo{display:flex;align-items:center;font-size:10px;color:var(--ui-cor-texto-secundario, #777788);padding-right:8px;flex-shrink:0;-webkit-user-select:none;user-select:none}.ui-prop__vazio{padding:24px 16px;text-align:center;color:var(--ui-cor-texto-secundario, #888899);font-size:12px}.ui-prop__footer{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;background:var(--ui-prop-elevado-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #18181c)));border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1));flex-shrink:0}.ui-prop__link-ajuda{font-size:11px;color:var(--ui-cor-destaque, #00E08A);text-decoration:none;cursor:pointer}.ui-prop__link-ajuda:hover{text-decoration:underline}.ui-prop__footer-botoes{display:flex;gap:6px}.ui-prop__btn-aplicar{height:24px;padding:0 12px;background:var(--ui-cor-destaque, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000);border:none;border-radius:3px;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s ease}.ui-prop__btn-aplicar:disabled{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent);color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent);cursor:not-allowed}.ui-prop__btn-desfazer{height:24px;padding:0 8px;background:transparent;color:var(--ui-cor-texto-secundario, #888899);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:3px;font-size:11px;cursor:pointer;transition:all .15s ease}.ui-prop__btn-desfazer:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto, #ffffff)}.ui-prop__btn-desfazer:disabled{opacity:.4;cursor:not-allowed}@media (max-width: 640px){:host{--ui-prop-altura-linha: 28px;font-size:13px}.ui-prop__btn-icone{min-width:28px;min-height:28px}.ui-prop__footer-botoes{gap:8px}.ui-prop__btn-aplicar,.ui-prop__btn-desfazer{height:30px;font-size:12px;padding:0 12px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-prop__editor-input,.ui-prop__editor-select{touch-action:manipulation;font-size:14px}}.ui-prop__editor--misto,.ui-prop__editor--misto .ui-prop__booleano-rotulo,.ui-prop__editor--misto .ui-prop__cor-texto,.ui-prop__editor--misto select,select.ui-prop__editor--misto{font-style:italic;color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab))}.ui-prop__editor-input.ui-prop__editor--misto::placeholder{font-style:italic;color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab));opacity:1}.ui-prop__editor--misto option:not([data-misto]),select.ui-prop__editor--misto option:not([data-misto]){font-style:normal;color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor--misto svg{opacity:.35}.ui-prop__checkbox-custom--misto{border-color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab));color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab));font-style:normal}.ui-prop__cor-amostra--misto{background:linear-gradient(to top right,transparent calc(50% - 1px),var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab)) 50%,transparent calc(50% + 1px))}.ui-prop__linha--modificada .ui-prop__col-rotulo{box-shadow:inset 2px 0 0 var(--ui-cor-destaque, #00E08A)}.ui-prop__btn-reverter{display:none;margin-left:auto;flex-shrink:0;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:none;border-radius:var(--ui-raio-sm, 3px);background:transparent;color:var(--ui-cor-destaque, #00E08A);font-size:11px;line-height:1;cursor:pointer}.ui-prop__linha--modificada .ui-prop__btn-reverter{display:inline-flex}.ui-prop__btn-reverter:hover{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}.ui-prop__btn-reverter:focus-visible{outline:1px solid var(--ui-cor-destaque, #00E08A);outline-offset:-1px}.ui-prop__previa-calculo{position:absolute;left:6px;top:50%;transform:translateY(-50%);pointer-events:none;font-size:10px;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums;color:var(--ui-cor-texto-secundario, #9696a6);white-space:nowrap}.ui-prop__previa-calculo[hidden]{display:none}.ui-prop__editor-input--invalido{animation:ui-prop-invalido .6s ease}.ui-prop__col-valor:has(.ui-prop__editor-input--invalido){box-shadow:inset 0 0 0 1px var(--ui-cor-texto-erro, #ff5555)}@keyframes ui-prop-invalido{0%,60%{color:var(--ui-cor-texto-erro, #ff5555)}to{color:inherit}}@media (prefers-reduced-motion: reduce){.ui-prop__editor-input--invalido{animation-duration:.01ms}}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),:host([degrade]:not([degrade="false"])),:host([gradiente]:not([gradiente="false"])),:host([gradient]:not([gradient="false"])),.ui-prop__container[data-degrade]:not([data-degrade=false]){--ui-prop-fundo: var(--ui-gradiente-superficie);--ui-prop-container-fundo: var(--ui-gradiente-superficie);--ui-prop-elevado-fundo: var(--ui-gradiente-elevado);--ui-prop-card-fundo: var(--ui-gradiente-card);--ui-prop-secao-fundo: transparent;--ui-prop-filtro-fundo: color-mix(in srgb, var(--ui-cor-fundo, #0b0b0d) 72%, transparent);--ui-prop-categoria-fundo: color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 4%, transparent)}`;
2424
+ function _r() {
2425
+ return `
2426
+ <style>${vr}</style>
2427
+ <div class="ui-prop__container" id="container" part="base">
2428
+ <!-- 0. Faixa Vertical da Coluna Estreita (visível quando colapsado) -->
2429
+ <div class="ui-prop__faixa-estreita" id="faixa-estreita" part="faixa-estreita" title="Clique para expandir painel">
2430
+ <span class="ui-prop__faixa-icone" aria-hidden="true">
2431
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
2432
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
2433
+ <line x1="3" y1="9" x2="21" y2="9"></line>
2434
+ <line x1="9" y1="21" x2="9" y2="9"></line>
2435
+ </svg>
2436
+ </span>
2437
+ <button type="button" class="ui-prop__faixa-btn-expandir" id="btn-expandir-faixa" title="Expandir painel de propriedades" aria-label="Expandir painel de propriedades">
2438
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2">
2439
+ <polyline points="9 18 15 12 9 6"></polyline>
2440
+ <line x1="5" y1="5" x2="5" y2="19"></line>
2441
+ </svg>
2442
+ </button>
2443
+ <span class="ui-prop__faixa-texto">PROPRIEDADES</span>
2444
+ </div>
2445
+
2446
+ <!-- 1. Header Superior -->
2447
+ <header class="ui-prop__header" id="header" part="cabecalho">
2448
+ <div class="ui-prop__header-titulo">
2449
+ <span class="ui-prop__header-icone" aria-hidden="true">
2450
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
2451
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
2452
+ <line x1="3" y1="9" x2="21" y2="9"></line>
2453
+ <line x1="9" y1="21" x2="9" y2="9"></line>
2454
+ </svg>
2455
+ </span>
2456
+ <span id="header-titulo-texto" part="titulo">Propriedades</span>
2457
+ </div>
2458
+ <div class="ui-prop__header-acoes" part="acoes-cabecalho">
2459
+ <button type="button" class="ui-prop__btn-icone" id="btn-flutuante" title="Desacoplar / Modo flutuante (CAD)" aria-label="Modo flutuante">
2460
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
2461
+ <rect x="3" y="3" width="14" height="14" rx="2"></rect>
2462
+ <polyline points="15 3 21 3 21 9"></polyline>
2463
+ <line x1="10" y1="14" x2="21" y2="3"></line>
2464
+ </svg>
2465
+ </button>
2466
+ <button type="button" class="ui-prop__btn-icone" id="btn-colapsar-horizontal" title="Recolher para coluna estreita" aria-label="Recolher para coluna estreita">
2467
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
2468
+ <polyline points="11 17 6 12 11 7"></polyline>
2469
+ <line x1="18" y1="5" x2="18" y2="19"></line>
2470
+ </svg>
2471
+ </button>
2472
+ <button type="button" class="ui-prop__btn-icone" id="btn-densidade" title="Alternar compressão vertical" aria-label="Alternar densidade vertical">
2473
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
2474
+ <polyline points="4 7 12 11 20 7"></polyline>
2475
+ <polyline points="4 17 12 13 20 17"></polyline>
2476
+ <line x1="4" y1="12" x2="20" y2="12"></line>
2477
+ </svg>
2478
+ </button>
2479
+ <button type="button" class="ui-prop__btn-icone" id="btn-expandir-tudo" title="Expandir/Recolher Tudo" aria-label="Expandir ou recolher tudo">
2480
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
2481
+ <polyline points="7 13 12 18 17 13"></polyline>
2482
+ <polyline points="7 6 12 11 17 6"></polyline>
2483
+ </svg>
2484
+ </button>
2485
+ <button type="button" class="ui-prop__btn-icone" id="btn-fechar" title="Fechar" aria-label="Fechar" style="display: none;">
2486
+ ✕
2487
+ </button>
2488
+ </div>
2489
+ </header>
2490
+
2491
+ <!-- 2. Seletor de Tipo (AutoCAD / Revit) -->
2492
+ <div class="ui-prop__tipo-seletor-container" id="tipo-container" part="seletor-tipo" style="display: none;"></div>
2493
+
2494
+ <!-- 3. Busca Rápida de Propriedades -->
2495
+ <div class="ui-prop__filtro-container" id="filtro-container" part="filtro" style="display: none;">
2496
+ <svg class="ui-prop__filtro-icone" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
2497
+ <circle cx="11" cy="11" r="8"></circle>
2498
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
2499
+ </svg>
2500
+ <input type="text" class="ui-prop__filtro-input" id="filtro-input" part="filtro-input" placeholder="Filtrar propriedades..." aria-label="Filtrar propriedades" autocomplete="off" spellcheck="false" />
2501
+ <button type="button" class="ui-prop__filtro-limpar" id="btn-limpar-filtro" title="Limpar filtro (Esc)" aria-label="Limpar filtro" style="display: none;">✕</button>
2502
+ </div>
2503
+
2504
+ <!-- 4. Corpo Rolável com Grade de Categorias -->
2505
+ <div class="ui-prop__corpo-wrapper" id="corpo-wrapper">
2506
+ <div class="ui-prop__splitter" id="splitter" part="splitter" role="separator" tabindex="0" aria-orientation="vertical" aria-valuemin="20" aria-valuemax="65" aria-valuenow="45" aria-label="Redimensionar coluna de rótulos" title="Arraste para redimensionar colunas (duplo-clique reseta para 45%)"></div>
2507
+ <div class="ui-prop__corpo" id="corpo" part="corpo">
2508
+ <div class="ui-prop__lista-categorias" id="lista-categorias" part="lista-categorias"></div>
2509
+ </div>
2510
+ </div>
2511
+
2512
+ <!-- 5. Rodapé com Ações (Aplicar / Desfazer) -->
2513
+ <footer class="ui-prop__footer" id="footer" part="rodape" style="display: none;">
2514
+ <a class="ui-prop__link-ajuda" id="link-ajuda" part="ajuda" href="#" role="button">Ajuda de propriedades</a>
2515
+ <div class="ui-prop__footer-botoes">
2516
+ <button type="button" class="ui-prop__btn-desfazer" id="btn-desfazer" part="desfazer" disabled>Desfazer</button>
2517
+ <button type="button" class="ui-prop__btn-aplicar" id="btn-aplicar" part="aplicar" disabled>Aplicar</button>
2518
+ </div>
2519
+ </footer>
2520
+
2521
+ <!-- 6. Grip para redimensionar no modo flutuante -->
2522
+ <div class="ui-prop__resizer-canto" id="resizer-canto" title="Redimensionar"></div>
2523
+ </div>
2524
+ `;
2525
+ }
2526
+ function xr(r) {
2527
+ const { listaContainer: t, categorias: e, termoBusca: i, onToggleCategoria: o, linhaCtx: a } = r;
2528
+ t.innerHTML = "";
2529
+ const n = (Array.isArray(e) ? e : []).filter(
2530
+ (d) => !!(d && typeof d == "object")
2531
+ );
2532
+ if (n.length === 0) {
2533
+ const d = document.createElement("div");
2534
+ d.className = "ui-prop__vazio", d.setAttribute("part", "vazio"), d.textContent = "Nenhuma propriedade disponível.", t.appendChild(d);
2535
+ return;
2536
+ }
2537
+ const s = document.createDocumentFragment(), l = (i || "").trim().toLowerCase();
2538
+ let u = 0;
2539
+ if (n.forEach((d) => {
2540
+ const p = String(d.titulo ?? d.id ?? "").toLowerCase(), c = !!l && p.includes(l), h = (Array.isArray(d.propriedades) ? d.propriedades : []).filter((_) => {
2541
+ if (!_ || typeof _ != "object" || _.id === void 0 || _.id === null) return !1;
2542
+ if (!l || c) return !0;
2543
+ const C = String(_.rotulo ?? "").toLowerCase(), A = String(_.id).toLowerCase(), z = String(a.valoresAtuais[_.id] ?? "").toLowerCase();
2544
+ return C.includes(l) || A.includes(l) || z.includes(l);
2545
+ });
2546
+ if (l && h.length === 0)
2547
+ return;
2548
+ u += h.length;
2549
+ const f = r.obterCategoriaAberta ? r.obterCategoriaAberta(d) : d.aberto !== void 0 ? d.aberto !== !1 : d.aberta !== !1, m = !!l || f, b = document.createElement("div");
2550
+ b.className = `ui-prop__categoria ${m ? "ui-prop__categoria--aberta" : ""}`, b.setAttribute("data-cat-id", String(d.id)), b.setAttribute("part", "categoria"), R(b, "categoria-aberta", m);
2551
+ const g = document.createElement("div");
2552
+ g.className = "ui-prop__categoria-header", g.setAttribute("part", "categoria-cabecalho"), g.setAttribute("role", "button"), g.tabIndex = 0, g.setAttribute("aria-expanded", String(m));
2553
+ const y = document.createElement("div");
2554
+ y.className = "ui-prop__categoria-titulo-bloco";
2555
+ const E = document.createElement("span");
2556
+ E.className = "ui-prop__categoria-seta", E.setAttribute("aria-hidden", "true"), E.textContent = "▶";
2557
+ const w = document.createElement("span");
2558
+ w.textContent = String(d.titulo ?? d.id), y.appendChild(E), y.appendChild(w);
2559
+ const L = document.createElement("span");
2560
+ L.className = "ui-prop__categoria-contador", L.textContent = String(h.length), g.appendChild(y), g.appendChild(L), g.addEventListener("click", () => o(String(d.id))), g.addEventListener("keydown", (_) => {
2561
+ if (_.key === "Enter" || _.key === " ")
2562
+ _.preventDefault(), o(String(d.id));
2563
+ else if (_.key === "ArrowRight")
2564
+ b.classList.contains("ui-prop__categoria--aberta") || (_.preventDefault(), o(String(d.id)));
2565
+ else if (_.key === "ArrowLeft")
2566
+ b.classList.contains("ui-prop__categoria--aberta") && (_.preventDefault(), o(String(d.id)));
2567
+ else if (_.key === "ArrowDown" || _.key === "ArrowUp") {
2568
+ const C = Array.from(t.querySelectorAll(".ui-prop__categoria-header")), A = C.indexOf(g);
2569
+ if (A !== -1) {
2570
+ const z = _.key === "ArrowDown" ? A + 1 : A - 1;
2571
+ z >= 0 && z < C.length && (_.preventDefault(), C[z].focus());
2572
+ }
2573
+ } else if (_.key === "Home") {
2574
+ const C = t.querySelector(".ui-prop__categoria-header");
2575
+ C && (_.preventDefault(), C.focus());
2576
+ } else if (_.key === "End") {
2577
+ const C = t.querySelectorAll(".ui-prop__categoria-header");
2578
+ C.length > 0 && (_.preventDefault(), C[C.length - 1].focus());
2579
+ }
2580
+ });
2581
+ const x = document.createElement("div");
2582
+ x.className = "ui-prop__categoria-conteudo", x.setAttribute("part", "categoria-conteudo"), h.forEach((_) => {
2583
+ const C = yr(String(d.id), _, a);
2584
+ x.appendChild(C);
2585
+ }), b.appendChild(g), b.appendChild(x), s.appendChild(b);
2586
+ }), l && u === 0) {
2587
+ const d = document.createElement("div");
2588
+ d.className = "ui-prop__vazio", d.setAttribute("part", "vazio"), d.textContent = `Nenhuma propriedade encontrada para "${i}".`, t.appendChild(d);
2589
+ return;
2590
+ }
2591
+ t.appendChild(s);
2592
+ }
2593
+ function yr(r, t, e) {
2594
+ const i = document.createElement("div");
2595
+ i.className = "ui-prop__linha", i.setAttribute("data-prop-id", String(t.id)), i.setAttribute("part", "linha");
2596
+ const o = e.valoresAtuais[t.id] !== void 0 ? e.valoresAtuais[t.id] : ne(t), a = t.id in e.valoresOriginais ? e.valoresOriginais[t.id] : ne(t), n = !P(o, a), s = S(o);
2597
+ n && (i.classList.add("ui-prop__linha--modificada"), R(i, "linha-modificada", !0)), s && (i.classList.add("ui-prop__linha--misto"), R(i, "linha-mista", !0)), i.addEventListener("dblclick", () => {
2598
+ const f = i.querySelector(
2599
+ 'input:not([type="color"]):not(.ui-prop__cor-picker-oculto), select, .ui-prop__btn-acao-inline'
2600
+ );
2601
+ f && (f.focus(), f instanceof HTMLInputElement && f.select());
2602
+ });
2603
+ const l = document.createElement("div");
2604
+ l.className = "ui-prop__col-rotulo", l.setAttribute("part", "rotulo");
2605
+ const u = String(t.rotulo ?? t.id);
2606
+ l.title = t.dica ? `${u} — ${t.dica}` : u;
2607
+ const d = document.createElement("span");
2608
+ if (d.textContent = u, l.appendChild(d), !t.somenteLeitura && t.tipo !== "readonly" && t.tipo !== "acao" && e.onRedefinir) {
2609
+ const f = e.onRedefinir, m = document.createElement("button");
2610
+ m.type = "button", m.className = "ui-prop__btn-reverter", m.title = "Restaurar valor original", m.setAttribute("aria-label", `Restaurar valor original de ${u}`), m.setAttribute("part", "restaurar"), m.textContent = "↺", m.addEventListener("click", (b) => {
2611
+ b.stopPropagation(), f(String(t.id));
2612
+ }), m.addEventListener("dblclick", (b) => b.stopPropagation()), l.appendChild(m);
2613
+ }
2614
+ t.tipo === "numero" && !t.somenteLeitura && Er(l, r, t, e);
2615
+ const c = document.createElement("div");
2616
+ c.className = "ui-prop__col-valor", c.setAttribute("part", "valor");
2617
+ const h = mr(r, t, o, e.editorCtx);
2618
+ if (c.appendChild(h), t.unidade) {
2619
+ const f = document.createElement("span");
2620
+ f.className = "ui-prop__unidade-sufixo", f.setAttribute("part", "unidade"), f.textContent = t.unidade, c.appendChild(f);
2621
+ }
2622
+ return i.appendChild(l), i.appendChild(c), i;
2623
+ }
2624
+ function Er(r, t, e, i) {
2625
+ r.classList.add("ui-prop__col-rotulo--scrub");
2626
+ const o = String(e.rotulo ?? e.id), a = e.dica ? `${o} — ${e.dica}` : o;
2627
+ r.title = `${a} (Arraste para ajustar, duplo-clique para editar)`;
2628
+ let n = 0, s = 0, l = !1;
2629
+ r.addEventListener("pointerdown", (u) => {
2630
+ var h, f;
2631
+ if (u.button !== 0 || (f = (h = u.target) == null ? void 0 : h.closest) != null && f.call(h, ".ui-prop__btn-reverter") || S(i.editorCtx.obterValorAtual(e.id))) return;
2632
+ n = u.clientX;
2633
+ const d = i.editorCtx.obterValorAtual(e.id);
2634
+ s = typeof d == "number" ? d : parseFloat(String(d || 0)) || 0, l = !1;
2635
+ try {
2636
+ r.setPointerCapture(u.pointerId);
2637
+ } catch {
2638
+ }
2639
+ r.classList.add("ui-prop__col-rotulo--arrastando");
2640
+ const p = (m) => {
2641
+ const b = m.clientX - n;
2642
+ if (Math.abs(b) > 2 && (l = !0), l) {
2643
+ let g = 1;
2644
+ m.shiftKey ? g = 0.1 : (m.ctrlKey || m.metaKey) && (g = 10);
2645
+ const y = ee(e), E = typeof e.passo == "number" && e.passo > 0 ? e.passo * 0.01 : typeof e.step == "number" && e.step > 0 ? e.step * 0.01 : Math.pow(10, -Math.min(y !== void 0 ? y : 2, 2));
2646
+ let w = s + b * E * g;
2647
+ w = fe(w, e), y !== void 0 ? w = Number(w.toFixed(y)) : w = Math.round(w * 100) / 100, i.editorCtx.registrarAlteracao(t, e.id, w), i.onAtualizarCampoVisual(e.id, w);
2648
+ }
2649
+ }, c = (m) => {
2650
+ r.classList.remove("ui-prop__col-rotulo--arrastando");
2651
+ try {
2652
+ r.hasPointerCapture(m.pointerId) && r.releasePointerCapture(m.pointerId);
2653
+ } catch {
2654
+ }
2655
+ r.removeEventListener("pointermove", p), r.removeEventListener("pointerup", c), r.removeEventListener("pointercancel", c);
2656
+ };
2657
+ r.addEventListener("pointermove", p), r.addEventListener("pointerup", c), r.addEventListener("pointercancel", c);
2658
+ });
2659
+ }
2660
+ const Se = 300, wr = 480, $ = /* @__PURE__ */ new WeakMap();
2661
+ function Ar(r) {
2662
+ var i, o, a;
2663
+ const t = r.hasAttribute("flutuante"), e = r.style;
2664
+ if (t) {
2665
+ const n = $.get(r) ?? { acoplado: { width: "", height: "" } };
2666
+ n.flutuante = { left: e.left, top: e.top, width: e.width, height: e.height }, $.set(r, n), r.removeAttribute("flutuante"), e.left = "", e.top = "", e.right = "", e.bottom = "", e.position = "", e.zIndex = "", e.width = n.acoplado.width, e.height = n.acoplado.height;
2667
+ } else {
2668
+ const n = {
2669
+ acoplado: { width: e.width, height: e.height },
2670
+ flutuante: (i = $.get(r)) == null ? void 0 : i.flutuante
2671
+ };
2672
+ if ($.set(r, n), r.setAttribute("flutuante", ""), e.position = "fixed", (o = n.flutuante) != null && o.left || (a = n.flutuante) != null && a.top)
2673
+ e.left = n.flutuante.left, e.top = n.flutuante.top, e.width = n.flutuante.width, e.height = n.flutuante.height;
2674
+ else if (!e.left && !e.top) {
2675
+ const s = Math.max(
2676
+ 20,
2677
+ (typeof window < "u" ? window.innerWidth : 1024) - Se - 30
2678
+ );
2679
+ e.left = `${s}px`, e.top = "70px", e.width = `${Se}px`, e.height = `${wr}px`;
2680
+ }
2681
+ }
2682
+ return !t;
2683
+ }
2684
+ function Cr(r, t, e) {
2685
+ const i = t.getElementById("header");
2686
+ if (i) {
2687
+ let a = null, n = 0, s = 0, l = 0, u = 0;
2688
+ const d = (c) => {
2689
+ if (a === null) return;
2690
+ const h = c.clientX - n, f = c.clientY - s;
2691
+ let m = l + h, b = u + f;
2692
+ const g = Math.max(0, (typeof window < "u" ? window.innerWidth : 1024) - r.offsetWidth), y = Math.max(0, (typeof window < "u" ? window.innerHeight : 768) - 30);
2693
+ m = Math.max(0, Math.min(g, m)), b = Math.max(0, Math.min(y, b)), r.style.left = `${m}px`, r.style.top = `${b}px`, r.style.right = "auto", r.style.bottom = "auto";
2694
+ }, p = (c) => {
2695
+ if (a !== null) {
2696
+ try {
2697
+ i.releasePointerCapture(c.pointerId);
2698
+ } catch {
2699
+ }
2700
+ i.removeEventListener("pointermove", d), i.removeEventListener("pointerup", p), i.removeEventListener("pointercancel", p), a = null, r.classList.remove("arrastando"), r.dispatchEvent(new CustomEvent("ui-mover", {
2701
+ bubbles: !0,
2702
+ composed: !0,
2703
+ detail: { left: r.style.left, top: r.style.top }
2704
+ }));
2705
+ }
2706
+ };
2707
+ e.add(i, "pointerdown", (c) => {
2708
+ if (!r.hasAttribute("flutuante") || c.target.closest("button, input, select, a") || c.button !== 0) return;
2709
+ c.preventDefault(), a = c.pointerId, n = c.clientX, s = c.clientY;
2710
+ const f = r.getBoundingClientRect();
2711
+ l = f.left, u = f.top, r.classList.add("arrastando");
2712
+ try {
2713
+ i.setPointerCapture(c.pointerId);
2714
+ } catch {
2715
+ }
2716
+ i.addEventListener("pointermove", d), i.addEventListener("pointerup", p), i.addEventListener("pointercancel", p);
2717
+ });
2718
+ }
2719
+ const o = t.getElementById("resizer-canto");
2720
+ if (o) {
2721
+ let a = null, n = 0, s = 0, l = 0, u = 0;
2722
+ const d = (c) => {
2723
+ if (a === null) return;
2724
+ const h = Math.max(200, n + (c.clientX - l)), f = Math.max(180, s + (c.clientY - u));
2725
+ r.style.width = `${h}px`, r.style.height = `${f}px`;
2726
+ }, p = (c) => {
2727
+ if (a !== null) {
2728
+ try {
2729
+ o.releasePointerCapture(c.pointerId);
2730
+ } catch {
2731
+ }
2732
+ o.removeEventListener("pointermove", d), o.removeEventListener("pointerup", p), o.removeEventListener("pointercancel", p), a = null, r.dispatchEvent(new CustomEvent("ui-redimensionar", {
2733
+ bubbles: !0,
2734
+ composed: !0,
2735
+ detail: { width: r.style.width, height: r.style.height }
2736
+ }));
2737
+ }
2738
+ };
2739
+ e.add(o, "pointerdown", (c) => {
2740
+ if (!r.hasAttribute("flutuante") || c.button !== 0) return;
2741
+ c.preventDefault(), c.stopPropagation(), a = c.pointerId, l = c.clientX, u = c.clientY;
2742
+ const h = r.getBoundingClientRect();
2743
+ n = h.width, s = h.height;
2744
+ try {
2745
+ o.setPointerCapture(c.pointerId);
2746
+ } catch {
2747
+ }
2748
+ o.addEventListener("pointermove", d), o.addEventListener("pointerup", p), o.addEventListener("pointercancel", p);
2749
+ });
2750
+ }
2751
+ }
2752
+ function kr(r) {
2753
+ return r === "compacta" ? "ultracompacta" : r === "ultracompacta" ? "padrao" : "compacta";
2754
+ }
2755
+ class Sr {
2756
+ constructor(t) {
2757
+ v(this, "valoresOriginais", {});
2758
+ v(this, "valoresAtuais", {});
2759
+ this.ctx = t;
2760
+ }
2761
+ inicializarCategorias(t) {
2762
+ this.valoresOriginais = {}, this.valoresAtuais = {};
2763
+ const e = /* @__PURE__ */ new Set();
2764
+ (Array.isArray(t) ? t : []).forEach((i) => {
2765
+ !i || typeof i != "object" || (Array.isArray(i.propriedades) ? i.propriedades : []).forEach((o) => {
2766
+ if (!o || typeof o != "object" || o.id === void 0 || o.id === null) return;
2767
+ const a = String(o.id);
2768
+ e.has(a) && typeof console < "u" && console.warn(`[ui-tabela-propriedades] id de propriedade repetido: "${a}". Os valores são indexados por id e serão compartilhados.`), e.add(a);
2769
+ const n = ne(o);
2770
+ this.valoresOriginais[a] = n, this.valoresAtuais[a] = n;
2771
+ });
2772
+ }), this.ctx.onAtualizarBotoesFooter(!1);
2773
+ }
2774
+ /** Há alguma propriedade com valor diferente do original (último aplicar/carregar)? */
2775
+ get isDirty() {
2776
+ return Object.keys(this.valoresAtuais).some((t) => this.isModificada(t));
2777
+ }
2778
+ isModificada(t) {
2779
+ return !P(this.valoresAtuais[t], this.valoresOriginais[t]);
2780
+ }
2781
+ getValores() {
2782
+ return { ...this.valoresAtuais };
2783
+ }
2784
+ getValoresOriginais() {
2785
+ return { ...this.valoresOriginais };
2786
+ }
2787
+ setValores(t) {
2788
+ !t || typeof t != "object" || (Object.keys(t).forEach((e) => {
2789
+ this.valoresAtuais[e] = t[e], this.valoresOriginais[e] = t[e];
2790
+ }), this.ctx.onAtualizarBotoesFooter(this.isDirty));
2791
+ }
2792
+ obterValor(t) {
2793
+ return this.valoresAtuais[t];
2794
+ }
2795
+ obterValorOriginal(t) {
2796
+ return this.valoresOriginais[t];
2797
+ }
2798
+ /** Alteração programática: atualiza o editor na tela; não emite se o valor não mudou. */
2799
+ definirValor(t, e, i = !0) {
2800
+ const o = this.valoresAtuais[t];
2801
+ P(o, e) || (this.valoresAtuais[t] = e, this.aposAlterar(t), this.ctx.onAtualizarCampoVisual(t, e), i && this.emitirAlteracao(t, e, o, this.categoriaDe(t)));
2802
+ }
2803
+ /**
2804
+ * Restaura uma propriedade individual ao seu valor original (antes da edição).
2805
+ * Devolve `false` se não havia o que restaurar.
2806
+ */
2807
+ redefinirValor(t, e = !0) {
2808
+ if (!(t in this.valoresOriginais) || !this.isModificada(t)) return !1;
2809
+ const i = this.valoresOriginais[t];
2810
+ return this.definirValor(t, i, e && !this.ctx.isModoManual()), !0;
2811
+ }
2812
+ /** Alteração feita pelo usuário num editor. Em modo manual só emite no Aplicar. */
2813
+ registrarAlteracao(t, e, i) {
2814
+ const o = this.valoresAtuais[e];
2815
+ P(o, i) || (this.valoresAtuais[e] = i, this.aposAlterar(e), this.ctx.isModoManual() || this.emitirAlteracao(e, i, o, t));
2816
+ }
2817
+ aplicar() {
2818
+ var i;
2819
+ if (!this.isDirty) return;
2820
+ const t = {};
2821
+ Object.keys(this.valoresAtuais).forEach((o) => {
2822
+ this.isModificada(o) && (t[o] = this.valoresAtuais[o]);
2823
+ }), this.valoresOriginais = { ...this.valoresAtuais }, this.ctx.onAtualizarBotoesFooter(!1);
2824
+ const e = (i = this.ctx.hostElement.shadowRoot) == null ? void 0 : i.querySelectorAll(".ui-prop__linha--modificada");
2825
+ e == null || e.forEach((o) => {
2826
+ o.classList.remove("ui-prop__linha--modificada"), R(o, "linha-modificada", !1);
2827
+ }), this.ctx.hostElement.dispatchEvent(
2828
+ new CustomEvent("ui-aplicar", {
2829
+ bubbles: !0,
2830
+ composed: !0,
2831
+ detail: { valores: { ...this.valoresAtuais }, alterados: t }
2832
+ })
2833
+ );
2834
+ }
2835
+ desfazer() {
2836
+ this.isDirty && (this.valoresAtuais = { ...this.valoresOriginais }, this.ctx.onAtualizarBotoesFooter(!1), this.ctx.onRenderCategorias(), this.ctx.hostElement.dispatchEvent(
2837
+ new CustomEvent("ui-desfazer", {
2838
+ bubbles: !0,
2839
+ composed: !0,
2840
+ detail: { valores: { ...this.valoresAtuais } }
2841
+ })
2842
+ ));
2843
+ }
2844
+ /** Marca/desmarca a linha (modificada e mista) e recalcula os botões do rodapé (voltar ao original limpa o estado). */
2845
+ aposAlterar(t) {
2846
+ const e = Pe(this.ctx.hostElement.shadowRoot, t);
2847
+ if (e) {
2848
+ const i = this.isModificada(t), o = S(this.valoresAtuais[t]);
2849
+ e.classList.toggle("ui-prop__linha--modificada", i), e.classList.toggle("ui-prop__linha--misto", o), R(e, "linha-modificada", i), R(e, "linha-mista", o);
2850
+ }
2851
+ this.ctx.onAtualizarBotoesFooter(this.isDirty);
2852
+ }
2853
+ categoriaDe(t) {
2854
+ for (const e of this.ctx.getCategorias())
2855
+ if (e && Array.isArray(e.propriedades) && e.propriedades.some((i) => i && String(i.id) === String(t)))
2856
+ return e.id;
2857
+ return "";
2858
+ }
2859
+ emitirAlteracao(t, e, i, o = "") {
2860
+ this.ctx.hostElement.dispatchEvent(
2861
+ new CustomEvent("ui-propriedade-alterada", {
2862
+ bubbles: !0,
2863
+ composed: !0,
2864
+ detail: {
2865
+ id: t,
2866
+ categoriaId: o,
2867
+ valor: e,
2868
+ valorAnterior: i,
2869
+ todosValores: { ...this.valoresAtuais }
2870
+ }
2871
+ })
2872
+ );
2873
+ }
2874
+ }
2875
+ function zr(r) {
2876
+ const {
2877
+ shadow: t,
2878
+ listeners: e,
2879
+ host: i,
2880
+ onToggleExpandirTodas: o,
2881
+ onFiltrar: a,
2882
+ onAplicar: n,
2883
+ onDesfazer: s,
2884
+ onAlternarDensidade: l,
2885
+ onAlternarFlutuante: u,
2886
+ onAlternarColapsoHorizontal: d,
2887
+ onFocarPrimeiroEditor: p
2888
+ } = r, c = t.getElementById("btn-flutuante");
2889
+ c && u && e.add(c, "click", u);
2890
+ const h = t.getElementById("btn-colapsar-horizontal");
2891
+ h && d && e.add(h, "click", d);
2892
+ const f = t.getElementById("faixa-estreita");
2893
+ f && d && e.add(f, "click", d);
2894
+ const m = t.getElementById("btn-expandir-faixa");
2895
+ m && d && e.add(m, "click", (A) => {
2896
+ A.stopPropagation(), d();
2897
+ });
2898
+ const b = t.getElementById("btn-densidade");
2899
+ b && l && e.add(b, "click", l);
2900
+ const g = t.getElementById("btn-expandir-tudo");
2901
+ g && e.add(g, "click", o);
2902
+ const y = t.getElementById("btn-fechar");
2903
+ y && e.add(y, "click", () => {
2904
+ i.dispatchEvent(new CustomEvent("ui-fechar", { bubbles: !0, composed: !0 }));
2905
+ });
2906
+ const E = t.getElementById("filtro-input"), w = t.getElementById("btn-limpar-filtro"), L = () => {
2907
+ w && E && (w.style.display = E.value ? "inline-flex" : "none");
2908
+ };
2909
+ E && (e.add(E, "input", () => {
2910
+ L();
2911
+ const A = (E.value || "").trim().toLowerCase();
2912
+ a(A);
2913
+ }), e.add(E, "keydown", (A) => {
2914
+ A.key === "Escape" ? E.value ? (A.preventDefault(), A.stopPropagation(), E.value = "", L(), a("")) : E.blur() : (A.key === "Enter" || A.key === "ArrowDown") && p && (A.preventDefault(), p());
2915
+ })), w && E && e.add(w, "click", () => {
2916
+ E.value = "", L(), a(""), E.focus();
2917
+ });
2918
+ const x = t.getElementById("btn-aplicar");
2919
+ x && e.add(x, "click", n);
2920
+ const _ = t.getElementById("btn-desfazer");
2921
+ _ && e.add(_, "click", s);
2922
+ const C = t.getElementById("link-ajuda");
2923
+ C && e.add(C, "click", (A) => {
2924
+ A.preventDefault(), i.dispatchEvent(new CustomEvent("ui-ajuda", { bubbles: !0, composed: !0 }));
2925
+ }), e.add(t, "keydown", (A) => {
2926
+ const z = A;
2927
+ (z.ctrlKey || z.metaKey) && z.key === "Enter" && i.getAttribute("modo-aplicar") === "manual" && (z.preventDefault(), n());
2928
+ });
2929
+ }
2930
+ function B(r, t) {
2931
+ const e = r.getElementById("header-titulo-texto");
2932
+ e && (e.textContent = t.getAttribute("titulo") || "Propriedades");
2933
+ const i = r.getElementById("btn-fechar");
2934
+ i && (i.style.display = t.hasAttribute("fechavel") ? "inline-flex" : "none");
2935
+ const o = r.getElementById("btn-flutuante");
2936
+ if (o) {
2937
+ const p = t.hasAttribute("flutuante");
2938
+ o.title = p ? "Acoplar painel (Dock)" : "Desacoplar / Modo flutuante (CAD)", o.setAttribute("aria-pressed", String(p)), o.classList.toggle("ui-prop__btn-icone--ativo", p);
2939
+ }
2940
+ const a = r.getElementById("btn-colapsar-horizontal");
2941
+ if (a) {
2942
+ const p = t.hasAttribute("colapsado");
2943
+ a.title = p ? "Expandir painel" : "Recolher para coluna estreita", a.setAttribute("aria-pressed", String(p)), a.classList.toggle("ui-prop__btn-icone--ativo", p);
2944
+ }
2945
+ const n = r.getElementById("btn-densidade");
2946
+ if (n) {
2947
+ const p = t.getAttribute("densidade") || "padrão";
2948
+ n.title = `Compressão vertical: ${p} (clique para alternar)`;
2949
+ }
2950
+ const s = r.getElementById("filtro-container");
2951
+ s && (s.style.display = t.hasAttribute("filtro") ? "flex" : "none");
2952
+ const l = r.getElementById("filtro-input"), u = r.getElementById("btn-limpar-filtro");
2953
+ u && l && (u.style.display = l.value ? "inline-flex" : "none");
2954
+ const d = r.getElementById("footer");
2955
+ d && (d.style.display = t.getAttribute("modo-aplicar") === "manual" ? "flex" : "none");
2956
+ }
2957
+ const I = class I extends ze {
2958
+ constructor() {
2959
+ super();
2960
+ v(this, "shadow");
2961
+ v(this, "listeners", new j());
2962
+ v(this, "splitterListeners", new j());
2963
+ v(this, "controladorSplitter");
2964
+ v(this, "gerenciadorValores");
2965
+ v(this, "_conectado", !1);
2966
+ v(this, "lembranca", new Kt(() => ({
2967
+ persistir: this.persistir,
2968
+ conectado: this._conectado,
2969
+ storageKey: this.storageKey,
2970
+ id: this.id
2971
+ })));
2972
+ v(this, "_categorias", []);
2973
+ v(this, "_tipos", []);
2974
+ v(this, "_tipoSelecionadoId", "");
2975
+ v(this, "_termoBusca", "");
2976
+ v(this, "_larguraRotuloPorcentagem", 45);
2977
+ v(this, "_sincronizandoFlutuante", !1);
2978
+ v(this, "tipoContainerElement");
2979
+ v(this, "corpoElement");
2980
+ v(this, "btnAplicarElement");
2981
+ v(this, "btnDesfazerElement");
2982
+ v(this, "splitterElement");
2983
+ this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = _r(), this.tipoContainerElement = this.shadow.getElementById("tipo-container"), this.corpoElement = this.shadow.getElementById("corpo"), this.btnAplicarElement = this.shadow.getElementById("btn-aplicar"), this.btnDesfazerElement = this.shadow.getElementById("btn-desfazer"), this.splitterElement = this.shadow.getElementById("splitter"), this.gerenciadorValores = new Sr({
2984
+ hostElement: this,
2985
+ getCategorias: () => this._categorias,
2986
+ onAtualizarBotoesFooter: (e) => {
2987
+ this.btnAplicarElement.disabled = !e, this.btnDesfazerElement.disabled = !e;
2988
+ },
2989
+ onAtualizarCampoVisual: (e, i) => ke(this.shadow, e, i),
2990
+ onRenderCategorias: () => this.renderCategorias(),
2991
+ isModoManual: () => this.getAttribute("modo-aplicar") === "manual"
2992
+ }), this.controladorSplitter = br({
2993
+ hostElement: this,
2994
+ corpoElement: this.corpoElement,
2995
+ splitterElement: this.splitterElement,
2996
+ splitterListeners: this.splitterListeners,
2997
+ onLarguraAlterada: (e) => {
2998
+ this._larguraRotuloPorcentagem = e;
2999
+ }
3000
+ });
3001
+ }
3002
+ static get observedAttributes() {
3003
+ return [
3004
+ "titulo",
3005
+ "estilo-visual",
3006
+ "modo-aplicar",
3007
+ "filtro",
3008
+ "densidade",
3009
+ "largura-rotulo",
3010
+ "fechavel",
3011
+ "colapsado",
3012
+ "flutuante",
3013
+ "texto-misto",
3014
+ "persistir",
3015
+ "storage-key",
3016
+ ...Le
3017
+ ];
3018
+ }
3019
+ get larguraRotuloPorcentagem() {
3020
+ return this._larguraRotuloPorcentagem;
3021
+ }
3022
+ connectedCallback() {
3023
+ this.listeners.cleanup(), this._conectado = !0, this.atualizarRegistroChavePadrao(), this.persistir && (this.lembranca.sincronizarSeChaveMudou(), this.lembranca.restaurarOrigensEmCategorias(this._categorias), this.lembranca.aplicarEmCategorias(this._categorias)), zr({
3024
+ shadow: this.shadow,
3025
+ listeners: this.listeners,
3026
+ host: this,
3027
+ onToggleExpandirTodas: () => this.toggleExpandirTodas(),
3028
+ onFiltrar: (e) => {
3029
+ this._termoBusca = e, this.renderCategorias();
3030
+ },
3031
+ onAplicar: () => this.aplicar(),
3032
+ onDesfazer: () => this.desfazer(),
3033
+ onAlternarDensidade: () => this.alternarDensidade(),
3034
+ onAlternarFlutuante: () => this.alternarFlutuante(),
3035
+ onAlternarColapsoHorizontal: () => this.alternarColapsoHorizontal(),
3036
+ onFocarPrimeiroEditor: () => Jt(this.shadow)
3037
+ }), Cr(this, this.shadow, this.listeners), this.controladorSplitter.init(), U(this, this.shadow.getElementById("container")), this.syncState();
3038
+ }
3039
+ disconnectedCallback() {
3040
+ this._conectado = !1, this.atualizarRegistroChavePadrao(), this.listeners.cleanup(), this.splitterListeners.cleanup();
3041
+ }
3042
+ /**
3043
+ * Cada atributo atualiza só o que depende dele: redesenhar todas as linhas (ex.: ao trocar o
3044
+ * `titulo`) tiraria o foco de um campo em edição.
3045
+ */
3046
+ attributeChangedCallback(e, i, o) {
3047
+ if (i !== o) {
3048
+ if (Me(e)) {
3049
+ U(this, this.shadow.getElementById("container"));
3050
+ return;
3051
+ }
3052
+ switch (e) {
3053
+ case "largura-rotulo": {
3054
+ const a = parseFloat(o ?? "");
3055
+ isNaN(a) || (this._larguraRotuloPorcentagem = this.controladorSplitter.definirLarguraRotulo(a));
3056
+ return;
3057
+ }
3058
+ case "estilo-visual":
3059
+ this.renderSeletorTipos();
3060
+ return;
3061
+ case "texto-misto":
3062
+ this.renderCategorias();
3063
+ return;
3064
+ case "filtro":
3065
+ if (B(this.shadow, this), o === null && this._termoBusca) {
3066
+ this._termoBusca = "";
3067
+ const a = this.shadow.getElementById("filtro-input");
3068
+ a && (a.value = ""), this.renderCategorias();
3069
+ }
3070
+ return;
3071
+ case "flutuante":
3072
+ this._sincronizandoFlutuante || B(this.shadow, this);
3073
+ return;
3074
+ case "persistir":
3075
+ this.atualizarRegistroChavePadrao(), this._conectado && this.persistir && (this.lembranca.sincronizarSeChaveMudou(), this.lembranca.restaurarOrigensEmCategorias(this._categorias), this.lembranca.aplicarEmCategorias(this._categorias), this.atualizarVisaoCategorias());
3076
+ return;
3077
+ case "storage-key":
3078
+ this.atualizarRegistroChavePadrao(), this._conectado && this.persistir && (this.lembranca.carregarDoStorage(!0), this.lembranca.restaurarOrigensEmCategorias(this._categorias), this.lembranca.aplicarEmCategorias(this._categorias), this.atualizarVisaoCategorias());
3079
+ return;
3080
+ default:
3081
+ B(this.shadow, this);
3082
+ }
3083
+ }
3084
+ }
3085
+ // --- Propriedades Públicas Espelhadas (Getters e Setters Tipados) ---
3086
+ get titulo() {
3087
+ return this.getAttribute("titulo") || "Propriedades";
3088
+ }
3089
+ set titulo(e) {
3090
+ e ? this.setAttribute("titulo", e) : this.removeAttribute("titulo");
3091
+ }
3092
+ get estiloVisual() {
3093
+ return this.getAttribute("estilo-visual") || "autocad";
3094
+ }
3095
+ set estiloVisual(e) {
3096
+ e && e !== "autocad" ? this.setAttribute("estilo-visual", e) : this.removeAttribute("estilo-visual");
3097
+ }
3098
+ get modoAplicar() {
3099
+ return this.getAttribute("modo-aplicar") || "imediato";
3100
+ }
3101
+ set modoAplicar(e) {
3102
+ e === "manual" ? this.setAttribute("modo-aplicar", "manual") : this.removeAttribute("modo-aplicar");
3103
+ }
3104
+ get filtro() {
3105
+ return this.hasAttribute("filtro");
3106
+ }
3107
+ set filtro(e) {
3108
+ e ? this.setAttribute("filtro", "") : this.removeAttribute("filtro");
3109
+ }
3110
+ get termoBusca() {
3111
+ return this._termoBusca;
3112
+ }
3113
+ set termoBusca(e) {
3114
+ this._termoBusca = (e || "").trim().toLowerCase();
3115
+ const i = this.shadow.getElementById("filtro-input");
3116
+ i && (i.value = e || ""), this.renderCategorias();
3117
+ }
3118
+ get larguraRotulo() {
3119
+ return this._larguraRotuloPorcentagem;
3120
+ }
3121
+ set larguraRotulo(e) {
3122
+ const i = typeof e == "number" ? e : parseFloat(String(e));
3123
+ isNaN(i) || this.setAttribute("largura-rotulo", String(i));
3124
+ }
3125
+ get fechavel() {
3126
+ return this.hasAttribute("fechavel");
3127
+ }
3128
+ set fechavel(e) {
3129
+ e ? this.setAttribute("fechavel", "") : this.removeAttribute("fechavel");
3130
+ }
3131
+ /**
3132
+ * Habilita a persistência das abas/categorias abertas no `localStorage`.
3133
+ * Ativo por padrão (`true`); defina `persistir="false"` para manter apenas em memória.
3134
+ */
3135
+ get persistir() {
3136
+ return this.getAttribute("persistir") !== "false";
3137
+ }
3138
+ set persistir(e) {
3139
+ e === !1 ? this.setAttribute("persistir", "false") : this.removeAttribute("persistir");
3140
+ }
3141
+ /**
3142
+ * Chave customizada de armazenamento no `localStorage` (`storage-key`).
3143
+ * Quando omitida, usa o atributo `id` do componente ou `'default'`.
3144
+ */
3145
+ get storageKey() {
3146
+ return this.getAttribute("storage-key");
3147
+ }
3148
+ set storageKey(e) {
3149
+ e && e.trim() ? this.setAttribute("storage-key", e.trim()) : this.removeAttribute("storage-key");
3150
+ }
3151
+ get categorias() {
3152
+ return this._categorias;
3153
+ }
3154
+ set categorias(e) {
3155
+ this._categorias = Array.isArray(e) ? e : [], this.gerenciadorValores.inicializarCategorias(this._categorias), this.lembranca.registrarOrigens(this._categorias), this._conectado && this.persistir && this.lembranca.sincronizarSeChaveMudou(), this.lembranca.aplicarEmCategorias(this._categorias), this.renderCategorias();
3156
+ }
3157
+ /**
3158
+ * Texto exibido nas propriedades cujo valor difere entre os objetos selecionados
3159
+ * (`VALOR_MISTO`). Reflete o atributo `texto-misto`; padrão "Varia".
3160
+ */
3161
+ get textoMisto() {
3162
+ const e = this.getAttribute("texto-misto");
3163
+ return e && e.trim() ? e : he;
3164
+ }
3165
+ set textoMisto(e) {
3166
+ typeof e == "string" && e.trim() ? this.setAttribute("texto-misto", e) : this.removeAttribute("texto-misto");
3167
+ }
3168
+ get tipos() {
3169
+ return this._tipos;
3170
+ }
3171
+ set tipos(e) {
3172
+ this._tipos = Array.isArray(e) ? e : [], this.renderSeletorTipos();
3173
+ }
3174
+ /** Id do tipo exibido no seletor: sem seleção válida, o seletor mostra (e devolve) o primeiro. */
3175
+ get tipoSelecionado() {
3176
+ const e = this._tipos.filter((o) => o && o.id !== null && o.id !== void 0);
3177
+ return !e.some((o) => String(o.id) === this._tipoSelecionadoId) && e.length > 0 ? String(e[0].id) : this._tipoSelecionadoId;
3178
+ }
3179
+ set tipoSelecionado(e) {
3180
+ this._tipoSelecionadoId = String(e ?? ""), this.renderSeletorTipos();
3181
+ }
3182
+ get valores() {
3183
+ return this.gerenciadorValores.getValores();
3184
+ }
3185
+ set valores(e) {
3186
+ this.gerenciadorValores.setValores(e), this.renderCategorias();
3187
+ }
3188
+ get isDirty() {
3189
+ return this.gerenciadorValores.isDirty;
3190
+ }
3191
+ get dirty() {
3192
+ return this.gerenciadorValores.isDirty;
3193
+ }
3194
+ obterValor(e) {
3195
+ return this.gerenciadorValores.obterValor(e);
3196
+ }
3197
+ definirValor(e, i, o = !0) {
3198
+ this.gerenciadorValores.definirValor(e, i, o);
3199
+ }
3200
+ /**
3201
+ * Volta uma propriedade ao valor do último carregar/aplicar (o mesmo que o botão ↺ da linha).
3202
+ * Fora do modo manual emite `ui-propriedade-alterada`. Devolve `false` se não havia o que restaurar.
3203
+ */
3204
+ redefinirValor(e, i = !0) {
3205
+ return this.gerenciadorValores.redefinirValor(e, i);
3206
+ }
3207
+ aplicar() {
3208
+ this.gerenciadorValores.aplicar();
3209
+ }
3210
+ desfazer() {
3211
+ this.gerenciadorValores.desfazer();
3212
+ }
3213
+ expandirTudo() {
3214
+ const e = [];
3215
+ for (const i of this._categorias) {
3216
+ const o = D(i);
3217
+ o !== null && e.push([o, !0]);
3218
+ }
3219
+ this.lembranca.registrarVarias(e), Zt(this.shadow, this._categorias), e.length > 0 && this.emitirEstadoCategorias();
3220
+ }
3221
+ colapsarTudo() {
3222
+ const e = [];
3223
+ for (const i of this._categorias) {
3224
+ const o = D(i);
3225
+ o !== null && e.push([o, !1]);
3226
+ }
3227
+ this.lembranca.registrarVarias(e), er(this.shadow, this._categorias), e.length > 0 && this.emitirEstadoCategorias();
3228
+ }
3229
+ toggleCategoria(e) {
3230
+ const i = this._categorias.find((n) => D(n) === e);
3231
+ if (!i) return;
3232
+ const o = this.lembranca.estaAberta(i), a = tr(this.shadow, this, this._categorias, e, o);
3233
+ typeof a == "boolean" && (this.lembranca.registrar(e, a), this.emitirEstadoCategorias());
3234
+ }
3235
+ /**
3236
+ * Retorna a chave completa de armazenamento utilizada por esta instância no `localStorage`.
3237
+ */
3238
+ obterChaveStorageAtual() {
3239
+ return this.lembranca.chaveAtual();
3240
+ }
3241
+ /**
3242
+ * Retorna um mapa `{ categoriaId: aberto }` refletindo as abas atualmente lembradas e visíveis.
3243
+ */
3244
+ obterEstadoCategorias() {
3245
+ return this.lembranca.obterEstado(this._categorias);
3246
+ }
3247
+ /**
3248
+ * Define programaticamente o estado aberto/fechado de um conjunto de categorias.
3249
+ */
3250
+ definirEstadoCategorias(e, i) {
3251
+ if (!e || typeof e != "object") return;
3252
+ const o = [];
3253
+ for (const [a, n] of Object.entries(e))
3254
+ typeof n == "boolean" && o.push([a, n]);
3255
+ o.length !== 0 && (this.lembranca.registrarVarias(o, (i == null ? void 0 : i.persistir) !== !1), this.lembranca.aplicarEmCategorias(this._categorias), this.atualizarVisaoCategorias(), i != null && i.emitirEvento && this.emitirEstadoCategorias());
3256
+ }
3257
+ /**
3258
+ * Remove as preferências lembradas em memória e no `localStorage`, restaurando o padrão das categorias.
3259
+ */
3260
+ limparEstadoCategorias() {
3261
+ this.lembranca.limpar(this._categorias), this.atualizarVisaoCategorias();
3262
+ }
3263
+ /**
3264
+ * Alias compatível com `<ui-camadas>` para limpar a memória persistida das categorias.
3265
+ */
3266
+ limparLembranca() {
3267
+ this.limparEstadoCategorias();
3268
+ }
3269
+ get densidade() {
3270
+ return this.getAttribute("densidade") || "padrao";
3271
+ }
3272
+ set densidade(e) {
3273
+ !e || e === "padrao" ? this.removeAttribute("densidade") : this.setAttribute("densidade", e);
3274
+ }
3275
+ alternarDensidade() {
3276
+ const e = kr(this.getAttribute("densidade") || "padrao");
3277
+ return e === "padrao" ? this.removeAttribute("densidade") : this.setAttribute("densidade", e), this.dispatchEvent(
3278
+ new CustomEvent("ui-densidade-alterada", {
3279
+ bubbles: !0,
3280
+ composed: !0,
3281
+ detail: { densidade: e }
3282
+ })
3283
+ ), B(this.shadow, this), e;
3284
+ }
3285
+ get flutuante() {
3286
+ return this.hasAttribute("flutuante");
3287
+ }
3288
+ set flutuante(e) {
3289
+ !!e !== this.hasAttribute("flutuante") && this.alternarFlutuante();
3290
+ }
3291
+ get colapsado() {
3292
+ return this.hasAttribute("colapsado");
3293
+ }
3294
+ set colapsado(e) {
3295
+ !!e !== this.hasAttribute("colapsado") && this.alternarColapsoHorizontal();
3296
+ }
3297
+ alternarFlutuante() {
3298
+ this._sincronizandoFlutuante = !0;
3299
+ try {
3300
+ const e = Ar(this);
3301
+ return B(this.shadow, this), this.dispatchEvent(new CustomEvent("ui-flutuante-alterado", {
3302
+ bubbles: !0,
3303
+ composed: !0,
3304
+ detail: {
3305
+ flutuante: e,
3306
+ left: this.style.left,
3307
+ top: this.style.top,
3308
+ width: this.style.width,
3309
+ height: this.style.height
3310
+ }
3311
+ })), e;
3312
+ } finally {
3313
+ this._sincronizandoFlutuante = !1;
3314
+ }
3315
+ }
3316
+ alternarColapsoHorizontal() {
3317
+ const e = this.hasAttribute("colapsado");
3318
+ e ? this.removeAttribute("colapsado") : this.setAttribute("colapsado", "");
3319
+ const i = !e;
3320
+ return B(this.shadow, this), this.dispatchEvent(new CustomEvent("ui-colapso-horizontal", {
3321
+ bubbles: !0,
3322
+ composed: !0,
3323
+ detail: { colapsado: i }
3324
+ })), i;
3325
+ }
3326
+ syncState() {
3327
+ B(this.shadow, this);
3328
+ const e = this.getAttribute("largura-rotulo");
3329
+ if (e) {
3330
+ const i = parseFloat(e);
3331
+ isNaN(i) || (this._larguraRotuloPorcentagem = this.controladorSplitter.definirLarguraRotulo(i));
3332
+ }
3333
+ this.renderSeletorTipos(), this.renderCategorias();
3334
+ }
3335
+ toggleExpandirTodas() {
3336
+ this._categorias.some(
3337
+ (i) => !!(i && typeof i == "object") && !this.lembranca.estaAberta(i)
3338
+ ) ? this.expandirTudo() : this.colapsarTudo();
3339
+ }
3340
+ atualizarRegistroChavePadrao() {
3341
+ var i, o;
3342
+ if (this._conectado && this.persistir && !((i = this.getAttribute("storage-key")) != null && i.trim()) && !((o = this.id) != null && o.trim())) {
3343
+ const a = I.instanciasChavePadrao.has(this);
3344
+ I.instanciasChavePadrao.add(this), !a && I.instanciasChavePadrao.size > 1 && console.warn(
3345
+ '[ui-tabela-propriedades] Múltiplos painéis persistentes conectados sem "id" ou "storage-key". Todos compartilharão a mesma chave de armazenamento.'
3346
+ );
3347
+ } else
3348
+ I.instanciasChavePadrao.delete(this);
3349
+ }
3350
+ atualizarVisaoCategorias() {
3351
+ const e = this.shadow.querySelectorAll(".ui-prop__categoria").length > 0;
3352
+ if (!this._termoBusca && e) {
3353
+ Qt(this.shadow, this._categorias, (i) => this.lembranca.estaAberta(i));
3354
+ return;
3355
+ }
3356
+ this.renderCategorias();
3357
+ }
3358
+ emitirEstadoCategorias() {
3359
+ const e = this.lembranca.montarDetalheEvento(this._categorias);
3360
+ this.dispatchEvent(
3361
+ new CustomEvent("ui-categorias-estado", {
3362
+ bubbles: !0,
3363
+ composed: !0,
3364
+ detail: e
3365
+ })
3366
+ );
3367
+ }
3368
+ renderSeletorTipos() {
3369
+ gr({
3370
+ tipoContainerElement: this.tipoContainerElement,
3371
+ tipos: this._tipos,
3372
+ tipoSelecionadoId: this._tipoSelecionadoId,
3373
+ estiloVisual: this.getAttribute("estilo-visual") || "autocad",
3374
+ onSelecionarTipo: (e) => {
3375
+ this._tipoSelecionadoId = e, this.renderSeletorTipos();
3376
+ const i = this._tipos.find((o) => o && String(o.id) === String(e));
3377
+ this.dispatchEvent(new CustomEvent("ui-tipo-alterado", { bubbles: !0, composed: !0, detail: { id: e, tipo: i } }));
3378
+ },
3379
+ onEditarTipo: (e) => this.dispatchEvent(new CustomEvent("ui-editar-tipo-clique", { bubbles: !0, composed: !0, detail: { tipo: e } })),
3380
+ onQuickSelect: (e) => this.dispatchEvent(new CustomEvent("ui-quick-select", { bubbles: !0, composed: !0, detail: { tipo: e } })),
3381
+ onSelectObjects: (e) => this.dispatchEvent(new CustomEvent("ui-selecionar-objetos", { bubbles: !0, composed: !0, detail: { tipo: e } })),
3382
+ onCalculadora: (e) => this.dispatchEvent(new CustomEvent("ui-calculadora", { bubbles: !0, composed: !0, detail: { tipo: e } }))
3383
+ });
3384
+ }
3385
+ renderCategorias() {
3386
+ const e = this.shadow.getElementById("lista-categorias");
3387
+ e && xr({
3388
+ listaContainer: e,
3389
+ categorias: this._categorias,
3390
+ termoBusca: this._termoBusca,
3391
+ onToggleCategoria: (i) => this.toggleCategoria(i),
3392
+ obterCategoriaAberta: (i) => this.lembranca.estaAberta(i),
3393
+ linhaCtx: {
3394
+ valoresAtuais: this.gerenciadorValores.getValores(),
3395
+ valoresOriginais: this.gerenciadorValores.getValoresOriginais(),
3396
+ onAtualizarCampoVisual: (i, o) => ke(this.shadow, i, o),
3397
+ onRedefinir: (i) => this.redefinirValor(i),
3398
+ editorCtx: {
3399
+ obterValorAtual: (i) => this.gerenciadorValores.obterValor(i),
3400
+ registrarAlteracao: (i, o, a) => {
3401
+ this.gerenciadorValores.registrarAlteracao(i, o, a);
3402
+ },
3403
+ focarProximoEditor: (i) => Gt(this.shadow, i),
3404
+ focarEditorAnterior: (i) => Yt(this.shadow, i),
3405
+ obterTextoMisto: () => this.textoMisto,
3406
+ despacharEventoAcao: (i, o) => {
3407
+ this.dispatchEvent(
3408
+ new CustomEvent("ui-acao-clique", {
3409
+ bubbles: !0,
3410
+ composed: !0,
3411
+ detail: { id: i.id, categoriaId: o, propriedade: i }
3412
+ })
3413
+ );
3414
+ }
3415
+ }
3416
+ }
3417
+ });
3418
+ }
3419
+ };
3420
+ v(I, "instanciasChavePadrao", /* @__PURE__ */ new Set());
3421
+ let V = I;
3422
+ class Lr extends V {
3423
+ }
3424
+ class Mr extends V {
3425
+ }
3426
+ G("ui-tabela-propriedades", V);
3427
+ G("ui-painel-propriedades", Lr);
3428
+ G("ui-propriedades", Mr);
3429
+ export {
3430
+ D as $,
3431
+ cr as A,
3432
+ ur as B,
3433
+ lr as C,
3434
+ or as D,
3435
+ nr as E,
3436
+ dr as F,
3437
+ Sr as G,
3438
+ mr as H,
3439
+ yr as I,
3440
+ St as J,
3441
+ kt as K,
3442
+ Kt as L,
3443
+ wt as M,
3444
+ Ct as N,
3445
+ Et as O,
3446
+ Zt as P,
3447
+ Yt as Q,
3448
+ Jt as R,
3449
+ Gt as S,
3450
+ he as T,
3451
+ Lr as U,
3452
+ pe as V,
3453
+ Ne as W,
3454
+ q as X,
3455
+ De as Y,
3456
+ xe as Z,
3457
+ Re as _,
3458
+ rt as a,
3459
+ zt as a0,
3460
+ xt as a1,
3461
+ oe as a2,
3462
+ ve as a3,
3463
+ S as a4,
3464
+ de as a5,
3465
+ Xt as a6,
3466
+ Ye as a7,
3467
+ Q as a8,
3468
+ ot as a9,
3469
+ jt as aa,
3470
+ ie as ab,
3471
+ ee as ac,
3472
+ ir as ad,
3473
+ Lt as ae,
3474
+ kr as af,
3475
+ _t as ag,
3476
+ O as ah,
3477
+ xr as ai,
3478
+ vt as aj,
3479
+ at as ak,
3480
+ gr as al,
3481
+ Wt as am,
3482
+ Ie as an,
3483
+ F as ao,
3484
+ Qt as ap,
3485
+ B as aq,
3486
+ J as ar,
3487
+ T as as,
3488
+ Mt as at,
3489
+ rr as au,
3490
+ ne as av,
3491
+ P as aw,
3492
+ Xe as b,
3493
+ Je as c,
3494
+ Mr as d,
3495
+ Ft as e,
3496
+ V as f,
3497
+ ae as g,
3498
+ At as h,
3499
+ tr as i,
3500
+ Qe as j,
3501
+ Ar as k,
3502
+ fe as l,
3503
+ tt as m,
3504
+ ke as n,
3505
+ qt as o,
3506
+ Pe as p,
3507
+ Ut as q,
3508
+ er as r,
3509
+ Ir as s,
3510
+ Cr as t,
3511
+ zr as u,
3512
+ br as v,
3513
+ sr as w,
3514
+ ar as x,
3515
+ hr as y,
3516
+ fr as z
3517
+ };