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