@thibezer/ui-components-kit 2.24.1 → 2.24.2

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