@thibezer/ui-components-kit 2.8.1 → 2.8.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 (191) hide show
  1. package/CHANGELOG.md +22 -103
  2. package/README.md +8 -32
  3. package/dist/botao.cjs +1 -1
  4. package/dist/botao.js +1 -1
  5. package/dist/camadas.cjs +110 -114
  6. package/dist/camadas.js +1177 -1343
  7. package/dist/campo-texto.cjs +1 -1
  8. package/dist/campo-texto.js +1 -1
  9. package/dist/canvas.cjs +63 -64
  10. package/dist/canvas.js +3544 -4025
  11. package/dist/card.cjs +1 -1
  12. package/dist/card.js +1 -1
  13. package/dist/components/ui-avatar/ui-avatar.d.ts +0 -11
  14. package/dist/components/ui-badge/ui-badge.d.ts +0 -2
  15. package/dist/components/ui-barra-ferramentas/ferramentas-comum.d.ts +22 -1
  16. package/dist/components/ui-barra-ferramentas/tipos.d.ts +31 -0
  17. package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +17 -1
  18. package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +17 -0
  19. package/dist/components/ui-camadas/camadas-arraste-controles.d.ts +0 -2
  20. package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +11 -4
  21. package/dist/components/ui-camadas/camadas-drag-drop.d.ts +1 -13
  22. package/dist/components/ui-camadas/camadas-host.d.ts +0 -1
  23. package/dist/components/ui-camadas/camadas-mapas-base.d.ts +1 -3
  24. package/dist/components/ui-camadas/camadas-selecao.d.ts +0 -12
  25. package/dist/components/ui-camadas/ui-camadas.d.ts +5 -8
  26. package/dist/components/ui-canvas-cad/cad-atributos-sync.d.ts +1 -2
  27. package/dist/components/ui-canvas-cad/cad-broadcast.d.ts +1 -1
  28. package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +8 -3
  29. package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +106 -39
  30. package/dist/components/ui-canvas-cad/cad-inicializador.d.ts +1 -3
  31. package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +1 -15
  32. package/dist/components/ui-checkbox/ui-checkbox.d.ts +1 -4
  33. package/dist/components/ui-cores/tipos.d.ts +0 -2
  34. package/dist/components/ui-cores/ui-controle-cores.d.ts +3 -8
  35. package/dist/components/ui-cores/ui-seletor-cor.d.ts +1 -3
  36. package/dist/components/ui-mapa/ui-mapa-linha.d.ts +5 -12
  37. package/dist/components/ui-mapa/ui-mapa-marcador.d.ts +6 -15
  38. package/dist/components/ui-mapa/ui-mapa.d.ts +1 -14
  39. package/dist/components/ui-modal/modal-acessibilidade.d.ts +5 -5
  40. package/dist/components/ui-modal/ui-modal.d.ts +11 -1
  41. package/dist/components/ui-radio/radio-grupo-registry.d.ts +0 -10
  42. package/dist/components/ui-radio/ui-radio.d.ts +2 -9
  43. package/dist/components/ui-skeleton/ui-skeleton.d.ts +0 -9
  44. package/dist/components/ui-switch/ui-switch.d.ts +1 -3
  45. package/dist/components/ui-tabela/ui-tabela.d.ts +19 -1
  46. package/dist/components/ui-tooltip/ui-tooltip.d.ts +1 -24
  47. package/dist/core/index.d.ts +0 -1
  48. package/dist/core.cjs +1 -1
  49. package/dist/core.js +18 -28
  50. package/dist/cores.cjs +1 -1
  51. package/dist/cores.js +1 -1
  52. package/dist/custom-elements.json +13585 -18764
  53. package/dist/data.cjs +1 -1
  54. package/dist/data.js +2 -2
  55. package/dist/feedback.cjs +1 -1
  56. package/dist/feedback.js +2 -2
  57. package/dist/form-validacao-BIOXxt-1.js +140 -0
  58. package/dist/form-validacao-ytRYSF3E.cjs +1 -0
  59. package/dist/forms.cjs +1 -1
  60. package/dist/forms.js +2 -2
  61. package/dist/gerencigeo-canvas/canvas_interacao.d.ts +1 -0
  62. package/dist/gerencigeo-canvas/feature_metricas.d.ts +9 -0
  63. package/dist/gerencigeo-canvas/feature_popup.d.ts +0 -2
  64. package/dist/gerencigeo-canvas/mapa_core.d.ts +0 -6
  65. package/dist/index.cjs +1 -1
  66. package/dist/index.d.ts +0 -3
  67. package/dist/index.js +176 -179
  68. package/dist/mapa.cjs +16 -11
  69. package/dist/mapa.js +170 -242
  70. package/dist/modal.cjs +1 -1
  71. package/dist/modal.js +1 -1
  72. package/dist/register.cjs +1 -1
  73. package/dist/register.js +11 -11
  74. package/dist/svg-seguro-ChVJ2L2z.js +74 -0
  75. package/dist/svg-seguro-J2RM1Ssf.cjs +1 -0
  76. package/dist/tabela.cjs +1 -1
  77. package/dist/tabela.js +1 -1
  78. package/dist/tipos-elementos.d.ts +20 -48
  79. package/dist/tipos-react.d.ts +0 -2
  80. package/dist/tipos-vue.d.ts +15 -44
  81. package/dist/tools.cjs +1 -1
  82. package/dist/tools.js +1 -1
  83. package/dist/ui-badge-BxT-sDmV.cjs +28 -0
  84. package/dist/ui-badge-C0eKBI8E.js +183 -0
  85. package/dist/ui-botao-BOOnP8ds.cjs +12 -0
  86. package/dist/ui-botao-DfqSivHl.js +165 -0
  87. package/dist/ui-botao-OGJV6Vfk.js +165 -0
  88. package/dist/ui-botao-psS1juof.cjs +12 -0
  89. package/dist/ui-campo-texto-Cnn2UAkS.cjs +16 -0
  90. package/dist/{ui-campo-texto-B_OHVGiN.js → ui-campo-texto-Uu2dJE_0.js} +51 -51
  91. package/dist/ui-card-B86lJXTP.cjs +20 -0
  92. package/dist/{ui-card-BNYCQ7g-.js → ui-card-C_o5_0cB.js} +42 -50
  93. package/dist/ui-controle-cores-BS0WYPdi.js +572 -0
  94. package/dist/ui-controle-cores-Er6ZcQ7U.cjs +111 -0
  95. package/dist/ui-kit.css +1 -1
  96. package/dist/ui-modal-CvGFGh1h.cjs +18 -0
  97. package/dist/{ui-modal-BkYvNP0G.js → ui-modal-DBOtSTbR.js} +140 -116
  98. package/dist/ui-paleta-ferramentas-CEZYcN4J.js +624 -0
  99. package/dist/ui-paleta-ferramentas-CU4icLl0.js +1171 -0
  100. package/dist/{ui-paleta-ferramentas-bDLPbiGA.cjs → ui-paleta-ferramentas-Ccmo-rB5.cjs} +7 -7
  101. package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +21 -0
  102. package/dist/{ui-paleta-ferramentas-Ksh6gMW3.js → ui-paleta-ferramentas-DNN5i6nL.js} +329 -359
  103. package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +18 -0
  104. package/dist/ui-paleta-ferramentas-DbwdWVtT.js +1173 -0
  105. package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +21 -0
  106. package/dist/ui-segmented-D6b6zxVs.cjs +19 -0
  107. package/dist/ui-segmented-DyF5YLsV.js +418 -0
  108. package/dist/ui-segmented-rn9RxRGM.cjs +19 -0
  109. package/dist/{ui-linha-nCDh2wPm.js → ui-segmented-wUraId2e.js} +105 -200
  110. package/dist/ui-skeleton-DI4_9WOX.js +428 -0
  111. package/dist/{ui-skeleton-DiOxTBZK.cjs → ui-skeleton-SPYqku8P.cjs} +10 -10
  112. package/dist/{ui-skeleton-B2Rgrv8o.js → ui-skeleton-W9uwIceA.js} +191 -254
  113. package/dist/ui-skeleton-elhKIh2B.cjs +33 -0
  114. package/dist/{ui-switch-DO1R0Ce7.js → ui-switch-BcOqOkiV.js} +128 -187
  115. package/dist/ui-switch-D7iPKDj-.cjs +53 -0
  116. package/dist/ui-tabela-propriedades-BBr5sqki.cjs +145 -0
  117. package/dist/{ui-tabela-propriedades-DzZlyNZ_.cjs → ui-tabela-propriedades-BecPqC-e.cjs} +10 -10
  118. package/dist/{ui-tabela-propriedades-D9Echt2X.js → ui-tabela-propriedades-BokvDD3b.js} +826 -845
  119. package/dist/ui-tabela-propriedades-Boy7I5yW.js +2412 -0
  120. package/dist/ui-tabela-propriedades-C-PeuW1i.cjs +141 -0
  121. package/dist/ui-tabela-propriedades-Df9ajC6M.js +2648 -0
  122. package/dist/ui-toast-Bp_NlM5G.js +156 -0
  123. package/dist/ui-toast-DGTZKne5.cjs +20 -0
  124. package/dist/zero-js-triggers-C_KrvFOQ.js +244 -0
  125. package/dist/zero-js-triggers-C_gtaojZ.cjs +1 -0
  126. package/package.json +3 -3
  127. package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
  128. package/dist/acessibilidade-CUlSXc2X.js +0 -38
  129. package/dist/altura-controle-ukMRPckR.cjs +0 -1
  130. package/dist/altura-controle-vxQiXG4q.js +0 -62
  131. package/dist/components/ui-barra-ferramentas/paleta-atalhos.d.ts +0 -16
  132. package/dist/components/ui-barra-ferramentas/paleta-pressao-longa.d.ts +0 -24
  133. package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +0 -14
  134. package/dist/components/ui-barra-ferramentas/ribbon-teclado.d.ts +0 -17
  135. package/dist/components/ui-camadas/camadas-colecao.d.ts +0 -27
  136. package/dist/components/ui-camadas/camadas-drop-ops.d.ts +0 -31
  137. package/dist/components/ui-camadas/camadas-hierarquia.d.ts +0 -10
  138. package/dist/components/ui-camadas/camadas-lembranca.d.ts +0 -34
  139. package/dist/components/ui-camadas/camadas-render.d.ts +0 -15
  140. package/dist/components/ui-camadas/camadas-renomear.d.ts +0 -12
  141. package/dist/components/ui-camadas/camadas-selecao-api.d.ts +0 -17
  142. package/dist/components/ui-camadas/camadas-thumb.d.ts +0 -1
  143. package/dist/components/ui-canvas-cad/cad-acessibilidade.d.ts +0 -15
  144. package/dist/components/ui-canvas-cad/cad-evento-coordenadas.d.ts +0 -22
  145. package/dist/components/ui-canvas-cad/cad-feicoes-camera.d.ts +0 -26
  146. package/dist/components/ui-canvas-cad/cad-feicoes-consulta.d.ts +0 -21
  147. package/dist/components/ui-canvas-cad/cad-feicoes-dados.d.ts +0 -39
  148. package/dist/components/ui-canvas-cad/cad-feicoes-desenho.d.ts +0 -68
  149. package/dist/components/ui-canvas-cad/cad-feicoes-edicao.d.ts +0 -37
  150. package/dist/components/ui-canvas-cad/cad-feicoes-operacoes.d.ts +0 -48
  151. package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +0 -28
  152. package/dist/components/ui-canvas-cad/cad-feicoes-selecao-regiao.d.ts +0 -22
  153. package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +0 -53
  154. package/dist/components/ui-canvas-cad/cad-feicoes-versoes.d.ts +0 -33
  155. package/dist/components/ui-canvas-cad/cad-leaflet-adaptador.d.ts +0 -5
  156. package/dist/components/ui-canvas-cad/cad-selecao-pontos.d.ts +0 -5
  157. package/dist/components/ui-canvas-cad/tipos.d.ts +0 -37
  158. package/dist/components/ui-linha/index.d.ts +0 -1
  159. package/dist/components/ui-linha/ui-linha.d.ts +0 -48
  160. package/dist/components/ui-mapa/mapa-atributos.d.ts +0 -14
  161. package/dist/components/ui-mapa/mapa-basemaps.d.ts +0 -7
  162. package/dist/components/ui-mapa/mapa-icones.d.ts +0 -4
  163. package/dist/components/ui-mapa/mapa-leaflet.d.ts +0 -5
  164. package/dist/components/ui-mapa/mapa-vinculo-pai.d.ts +0 -22
  165. package/dist/components/ui-mapa/tipos.d.ts +0 -13
  166. package/dist/components/ui-modal/modal-foco.d.ts +0 -28
  167. package/dist/components/ui-tabela/tabela-estados.d.ts +0 -16
  168. package/dist/components/ui-tabela/tabela-rolagem.d.ts +0 -44
  169. package/dist/components/ui-tabela/tabela-teclado.d.ts +0 -16
  170. package/dist/components/ui-tooltip/tooltip-popover.d.ts +0 -7
  171. package/dist/components/ui-tooltip/tooltip-posicionamento.d.ts +0 -29
  172. package/dist/core/altura-controle.d.ts +0 -34
  173. package/dist/core/opcoes.d.ts +0 -9
  174. package/dist/core/rotulo-controle.d.ts +0 -13
  175. package/dist/form-validacao-BlQFxUVj.js +0 -104
  176. package/dist/form-validacao-DIeyQVH5.cjs +0 -1
  177. package/dist/gerencigeo-canvas/popup_gate.d.ts +0 -30
  178. package/dist/gerencigeo-canvas/zoom_opcoes.d.ts +0 -10
  179. package/dist/opcoes-CJYLi6kd.js +0 -12
  180. package/dist/opcoes-CkyDxBuQ.cjs +0 -1
  181. package/dist/ui-badge-BWhoGgo9.js +0 -197
  182. package/dist/ui-badge-SIR81R9l.cjs +0 -28
  183. package/dist/ui-botao-D24oXySA.cjs +0 -12
  184. package/dist/ui-botao-Dsj08jjw.js +0 -165
  185. package/dist/ui-campo-texto-DauJCde3.cjs +0 -16
  186. package/dist/ui-card-BrjBL-yo.cjs +0 -20
  187. package/dist/ui-controle-cores-DgEza3wF.js +0 -612
  188. package/dist/ui-controle-cores-uY__TgwW.cjs +0 -117
  189. package/dist/ui-linha-C6HBnsaw.cjs +0 -19
  190. package/dist/ui-modal-CUNbpbZ1.cjs +0 -18
  191. package/dist/ui-switch-D9a8XlVX.cjs +0 -53
@@ -0,0 +1,1171 @@
1
+ var J = Object.defineProperty;
2
+ var Q = (n, u, t) => u in n ? J(n, u, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[u] = t;
3
+ var c = (n, u, t) => Q(n, typeof u != "symbol" ? u + "" : u, t);
4
+ import { L as M } from "./listener-bag-DQgv7OON.js";
5
+ import { d as D, S as N } from "./ssr-safe-5cWfJP-s.js";
6
+ import { h as Z } from "./svg-seguro-ChVJ2L2z.js";
7
+ const tt = ':host{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;color:inherit;flex-shrink:0;width:var(--ui-tamanho-icone, 20px);height:var(--ui-tamanho-icone, 20px);box-sizing:border-box}.ui-icone{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;color:inherit;font-size:var(--ui-tamanho-icone, 20px)}::slotted(svg),.ui-icone svg{width:100%!important;height:100%!important;display:block;shape-rendering:geometricPrecision}:host([cor="primaria"]),:host([color="primaria"]){color:var(--ui-cor-primaria, #00E08A)}:host([cor="secundaria"]),:host([color="secundaria"]){color:var(--ui-cor-texto-secundario, #888899)}:host([cor="erro"]),:host([color="erro"]){color:var(--ui-cor-texto-erro, #ff5555)}:host([cor="sucesso"]),:host([color="sucesso"]){color:var(--ui-cor-texto-sucesso, #00E08A)}:host([cor="alerta"]),:host([color="alerta"]){color:var(--ui-cor-texto-alerta, #ffb86c)}', G = {
8
+ search: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
9
+ check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',
10
+ eye: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>',
11
+ eyeOff: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>',
12
+ lock: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>',
13
+ trash: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>',
14
+ gear: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>',
15
+ bell: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>',
16
+ alert: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>',
17
+ close: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>'
18
+ };
19
+ class et extends N {
20
+ constructor() {
21
+ super();
22
+ c(this, "iconContainer");
23
+ c(this, "svgContainer");
24
+ c(this, "slotElement");
25
+ c(this, "handleSlotChange", () => {
26
+ this.syncState();
27
+ });
28
+ const t = this.attachShadow({ mode: "open" });
29
+ t.innerHTML = `
30
+ <style>${tt}</style>
31
+ <span class="ui-icone" aria-hidden="true">
32
+ <span class="ui-icone__svg" style="display: none;"></span>
33
+ <slot></slot>
34
+ </span>
35
+ `, this.iconContainer = t.querySelector(".ui-icone"), this.svgContainer = t.querySelector(".ui-icone__svg"), this.slotElement = t.querySelector("slot");
36
+ }
37
+ static get observedAttributes() {
38
+ return ["tamanho", "size", "cor", "color", "nome", "name"];
39
+ }
40
+ connectedCallback() {
41
+ this.slotElement.addEventListener("slotchange", this.handleSlotChange), this.syncState();
42
+ }
43
+ disconnectedCallback() {
44
+ this.slotElement.removeEventListener("slotchange", this.handleSlotChange);
45
+ }
46
+ attributeChangedCallback(t, e, i) {
47
+ this.syncState();
48
+ }
49
+ resolveTamanhoPx() {
50
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
51
+ switch (t.toLowerCase()) {
52
+ case "sm":
53
+ return "16px";
54
+ case "md":
55
+ return "20px";
56
+ case "lg":
57
+ return "24px";
58
+ case "xl":
59
+ return "32px";
60
+ default:
61
+ return isNaN(Number(t)) ? t : `${t}px`;
62
+ }
63
+ }
64
+ syncState() {
65
+ const t = this.resolveTamanhoPx();
66
+ this.style.setProperty("--ui-tamanho-icone", t);
67
+ const e = this.getAttribute("cor") || this.getAttribute("color");
68
+ e ? (this.style.setProperty("--ui-cor-icone", e), this.iconContainer.style.color = e) : (this.style.removeProperty("--ui-cor-icone"), this.iconContainer.style.color = ""), this.hasAttribute("aria-label") || this.hasAttribute("label") ? this.iconContainer.removeAttribute("aria-hidden") : this.iconContainer.setAttribute("aria-hidden", "true");
69
+ const r = this.getAttribute("nome") || this.getAttribute("name"), a = this.slotElement.assignedNodes().length > 0;
70
+ r && G[r] && !a ? (this.svgContainer.innerHTML = G[r], this.svgContainer.style.display = "inline-flex") : (this.svgContainer.innerHTML = "", this.svgContainer.style.display = "none");
71
+ }
72
+ }
73
+ D("ui-icone", et);
74
+ const it = ':host{display:block;position:relative;box-sizing:border-box;min-height:122px;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}:host([recolhido]){min-height:31px}.ui-ribbon{display:flex;flex-direction:column;background:var(--ui-cor-superficie, #141417);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));-webkit-user-select:none;user-select:none}.ui-ribbon__cabecalho{display:flex;align-items:stretch;height:30px;box-sizing:border-box;box-shadow:inset 0 -1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__abas{display:flex;flex:1;min-width:0;align-items:flex-end;gap:2px;padding:0 8px;box-sizing:border-box;overflow-x:auto;scrollbar-width:none;background:linear-gradient(to right,var(--ui-cor-superficie, #141417) 20px,transparent) left top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to left,var(--ui-cor-superficie, #141417) 20px,transparent) right top / 28px calc(100% - 1px) no-repeat local,linear-gradient(to right,rgba(0,0,0,.35),transparent) left top / 14px calc(100% - 1px) no-repeat scroll,linear-gradient(to left,rgba(0,0,0,.35),transparent) right top / 14px calc(100% - 1px) no-repeat scroll}.ui-ribbon__abas::-webkit-scrollbar{display:none}.ui-ribbon__aba{position:relative;flex-shrink:0;height:28px;margin-bottom:1px;padding:0 14px;border:0;border-radius:6px 6px 0 0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);font:inherit;font-size:.75rem;font-weight:600;white-space:nowrap;cursor:pointer;transition:background-color .12s ease,color .12s ease}.ui-ribbon__aba:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__aba:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:30px;margin-bottom:0;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-fundo-elevado, #1a1a1e);box-shadow:inset 1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset -1px 0 0 var(--ui-cor-borda, rgba(255, 255, 255, .12)),inset 0 1px 0 var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__aba--ativa:after{content:"";position:absolute;inset-inline:8px;bottom:1px;height:2px;border-radius:2px 2px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual{color:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__aba--contextual:before{content:"";position:absolute;inset-inline:0;top:0;height:2px;border-radius:6px 6px 0 0;background:var(--ui-cor-primaria, #00E08A)}.ui-ribbon__fixar{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;align-self:center;width:28px;height:24px;margin-inline:2px 6px;padding:0;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer}.ui-ribbon__fixar:hover{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__fixar:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__fixar:before{content:"";width:6px;height:6px;border:solid currentColor;border-width:2px 0 0 2px;transform:translateY(2px) rotate(45deg)}:host([recolhido]) .ui-ribbon__fixar:before{transform:translateY(-2px) rotate(225deg)}.ui-ribbon__painel{background:var(--ui-cor-fundo-elevado, #1a1a1e);overflow-x:auto;scrollbar-width:thin;scrollbar-color:var(--ui-cor-borda, rgba(255, 255, 255, .2)) transparent}.ui-ribbon__grupos{display:flex;align-items:stretch;width:max-content;min-width:100%;min-height:92px;padding:4px 8px;box-sizing:border-box}.ui-ribbon__grupo{display:flex;flex-direction:column;flex-shrink:0;padding:0 8px;border-inline-end:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ribbon__grupo:last-child{border-inline-end:0}.ui-ribbon__grupo-itens{display:flex;flex:1;align-items:stretch;gap:2px}.ui-ribbon__grupo-rotulo{position:relative;display:flex;align-items:center;justify-content:center;padding:3px 0 1px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;line-height:1.2;text-align:center;white-space:nowrap}.ui-ribbon__lancador{position:absolute;right:0;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;padding:0;border:0;background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;border-radius:2px;opacity:.7}[dir=rtl] .ui-ribbon__lancador{right:auto;left:0}.ui-ribbon__lancador:hover{opacity:1;color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__lancador:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-1px}.ui-ribbon__grupo--colapsado{padding:0 4px;justify-content:center}.ui-ribbon__btn-colapsado{height:calc(100% - 6px);margin:3px 0}.ui-ribbon__keytip{position:absolute;z-index:100;padding:1px 4px;font-size:.625rem;font-weight:700;line-height:1;color:#111;background:#fef08a;border:1px solid #ca8a04;border-radius:2px;box-shadow:0 1px 3px #0006;pointer-events:none}.ui-ribbon__coluna{display:flex;flex-direction:column;justify-content:center;gap:0}.ui-ribbon__separador{width:1px;margin:4px 3px;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn--grande{flex-direction:column;min-width:52px;padding:4px 6px;gap:3px}.ui-ferr-btn--grande .ui-ferr-btn__rotulo{max-width:72px;white-space:normal;text-align:center;line-height:1.15;overflow-wrap:anywhere}.ui-ferr-btn--pequeno{height:24px;padding:0 6px;justify-content:flex-start}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:24px;padding:0;justify-content:center}.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;box-shadow:none}:host([recolhido]) .ui-ribbon__painel{display:none;position:absolute;top:100%;inset-inline:0;z-index:var(--ui-z-docked-bar, 600);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35))}:host([recolhido]) .ui-ribbon--aberto .ui-ribbon__painel{display:block}:host([recolhido]) .ui-ribbon__aba--ativa:after{display:none}:host([compacto]) .ui-ribbon__grupos{min-height:0;padding-block:2px}:host([compacto]) .ui-ribbon__grupo-rotulo{display:none}:host([compacto]) .ui-ferr-btn--grande{min-width:44px}@media (max-width: 720px){.ui-ferr-btn--pequeno:has(.ui-ferr-btn__icone) .ui-ferr-btn__rotulo{display:none}.ui-ferr-btn--pequeno:has(.ui-ferr-btn__icone){min-width:28px;justify-content:center;padding:0 4px}}@media (pointer: coarse){.ui-ribbon__cabecalho{height:38px}.ui-ribbon__aba{height:36px}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{height:38px}.ui-ferr-btn--pequeno{height:32px}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:32px}.ui-ribbon__fixar{width:36px;height:32px}}@media (prefers-reduced-motion: reduce){.ui-ribbon__aba{transition:none}}@media (forced-colors: active){.ui-ribbon__aba--ativa:after,.ui-ribbon__aba--contextual:before{background:Highlight;forced-color-adjust:none}.ui-ribbon__aba--ativa,.ui-ribbon__aba--ativa:hover{box-shadow:none;border:1px solid CanvasText;border-bottom-color:Canvas}.ui-ribbon__aba:focus-visible,.ui-ribbon__fixar:focus-visible,.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline-color:Highlight}}', K = '.ui-ferr-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:4px;box-sizing:border-box;padding:0;border:1px solid transparent;border-radius:var(--ui-raio-borda, 6px);background:transparent;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.75rem;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .12s ease,border-color .12s ease,color .12s ease}.ui-ferr-btn:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-btn:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 14%,transparent)}.ui-ferr-btn:focus-visible{outline:2px solid transparent;outline-offset:2px;box-shadow:0 0 0 2px var(--ui-cor-fundo, #0b0b0d),0 0 0 4px var(--ui-cor-primaria, #00E08A)}.ui-ferr-btn:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-btn--ativo{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent);border-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 55%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 28%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 36%,transparent)}.ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));border-color:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn__icone{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.ui-ferr-btn__rotulo{white-space:nowrap}.ui-ferr-btn__caret{width:0;height:0;flex-shrink:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid currentColor;opacity:.7}.ui-ferr-menu{position:fixed;z-index:var(--ui-z-popover, 1050);display:flex;flex-direction:column;gap:1px;min-width:180px;max-height:calc(100vh - 8px);overflow-y:auto;padding:4px;box-sizing:border-box;background:var(--ui-cor-fundo-menu, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .35));font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-ferr-menu__item{position:relative;display:flex;align-items:center;gap:8px;width:100%;height:28px;padding:0 8px;box-sizing:border-box;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:inherit;font:inherit;font-size:.75rem;text-align:start;cursor:pointer}.ui-ferr-menu__item:hover:not(:disabled){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ferr-menu__item:disabled{opacity:.4;cursor:not-allowed}.ui-ferr-menu__item--ativo,.ui-ferr-menu__item[aria-checked=true]{color:var(--ui-cor-primaria, #00E08A);font-weight:600}.ui-ferr-menu__item--ativo:after,.ui-ferr-menu__item[aria-checked=true]:after{content:"";flex-shrink:0;width:4px;height:8px;margin-inline-start:4px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg) translateY(-1px)}.ui-ferr-menu__icone{display:inline-flex;width:16px;justify-content:center}.ui-ferr-menu__rotulo{flex:1}.ui-ferr-menu__atalho{margin-inline-start:16px;color:var(--ui-cor-texto-secundario, #888899);font-size:.6875rem;font-variant-numeric:tabular-nums}.ui-ferr-menu__sep{height:1px;margin:3px 2px;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}@media (pointer: coarse){.ui-ferr-menu__item{height:36px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn{transition:none}}.ui-ferr-tooltip{position:fixed;z-index:var(--ui-z-tooltip, 1200);pointer-events:none;display:none;align-items:center;gap:6px;padding:4px 8px;border-radius:var(--ui-raio-sm, 4px);background:var(--ui-cor-fundo-tooltip, #18181c);color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:.6875rem;line-height:1.2;white-space:nowrap;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));box-shadow:var(--ui-sombra-md, 0 4px 12px rgba(0, 0, 0, .35));opacity:0;transform:translateY(-2px);transition:opacity .12s ease,transform .12s ease}.ui-ferr-tooltip--visivel{display:inline-flex;opacity:1;transform:translateY(0)}.ui-ferr-tooltip__atalho{display:inline-flex;align-items:center;padding:1px 4px;border-radius:3px;background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-size:.625rem;font-weight:600;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08))}.ui-ferr-split{display:inline-flex;align-items:stretch;border-radius:var(--ui-raio-borda, 6px);position:relative}.ui-ferr-split--grande{flex-direction:column}.ui-ferr-split--grande .ui-ferr-split__acao{border-bottom-left-radius:0;border-bottom-right-radius:0}.ui-ferr-split--grande .ui-ferr-split__gatilho{height:16px;width:100%;border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));padding:0;justify-content:center}.ui-ferr-split--pequeno{flex-direction:row}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-top-right-radius:0;border-bottom-right-radius:0}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{width:16px;height:24px;padding:0;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));justify-content:center}.ui-ferr-split:hover:not(:has(:disabled)){background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .04))}.ui-ferr-menu__caret-sub{width:0;height:0;margin-inline-start:auto;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid currentColor;opacity:.7}[dir=rtl] .ui-ferr-menu__caret-sub{border-left:0;border-right:4px solid currentColor}@media (forced-colors: active){.ui-ferr-btn:focus-visible,.ui-ferr-menu__item:focus-visible{outline:2px solid Highlight}.ui-ferr-btn--ativo{background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-ferr-btn:disabled,.ui-ferr-menu__item:disabled{opacity:1;color:GrayText}.ui-ferr-menu{border-color:CanvasText}.ui-ferr-menu__item:hover:not(:disabled){background:Highlight;color:HighlightText}}';
75
+ function S(n, u) {
76
+ if (!n) return null;
77
+ const t = document.createElement("ui-icone");
78
+ if (t.setAttribute("tamanho", String(u)), n.trimStart().startsWith("<")) {
79
+ const e = Z(n);
80
+ if (!e) return null;
81
+ t.appendChild(e);
82
+ } else
83
+ t.setAttribute("nome", n);
84
+ return t;
85
+ }
86
+ const V = /* @__PURE__ */ new Set();
87
+ function C(n) {
88
+ return n.rotuloAcessivel ? n.rotuloAcessivel : n.rotulo ? n.rotulo : n.icone && !n.icone.trimStart().startsWith("<") ? n.icone : (V.has(n.id) || (V.add(n.id), console.warn(`[ui-barra-ferramentas] O item "${n.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), n.id);
89
+ }
90
+ function R(n, u) {
91
+ const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
92
+ n.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${u}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
93
+ }
94
+ function q(n, u = []) {
95
+ for (const t of n)
96
+ t.tipo !== "separador" && (u.push(t.id), t.filhos && q(t.filhos, u));
97
+ return u;
98
+ }
99
+ function A(n, u) {
100
+ n.disabled = !!u.disabled;
101
+ const t = u.tipo, e = t === "toggle" || t === "ferramenta";
102
+ e ? n.setAttribute("aria-pressed", String(!!u.ativo)) : n.removeAttribute("aria-pressed"), n.classList.toggle("ui-ferr-btn--ativo", e && !!u.ativo);
103
+ }
104
+ function F(n, u, t) {
105
+ var s;
106
+ const e = document.createElement("button");
107
+ e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${u}`, e.dataset.id = n.id, e.tabIndex = -1;
108
+ const i = !!((s = n.filhos) != null && s.length), r = u !== "paleta" && !n.somenteIcone && !!n.rotulo;
109
+ n.rotuloAcessivel ? e.setAttribute("aria-label", n.rotuloAcessivel) : r ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", C(n)), n.atalho && e.setAttribute("aria-keyshortcuts", n.atalho), e.dataset.tooltip = C(n), n.atalho && (e.dataset.atalho = n.atalho);
110
+ const a = S(n.icone, t);
111
+ if (a) {
112
+ const l = document.createElement("span");
113
+ l.className = "ui-ferr-btn__icone", l.appendChild(a), e.appendChild(l);
114
+ }
115
+ if (u !== "paleta" && n.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), r) {
116
+ const l = document.createElement("span");
117
+ l.className = "ui-ferr-btn__rotulo", l.textContent = n.rotulo, e.appendChild(l);
118
+ }
119
+ if (i && !n.dividido) {
120
+ if (u === "paleta")
121
+ e.classList.add("ui-ferr-btn--grupo");
122
+ else {
123
+ const l = document.createElement("span");
124
+ l.className = "ui-ferr-btn__caret", e.appendChild(l);
125
+ }
126
+ e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
127
+ }
128
+ return A(e, n), e;
129
+ }
130
+ function rt(n, u, t) {
131
+ const e = document.createElement("div");
132
+ e.className = `ui-ferr-split ui-ferr-split--${u}`, e.dataset.id = n.id;
133
+ const i = F({ ...n, filhos: void 0, dividido: !1 }, u, t);
134
+ i.classList.add("ui-ferr-split__acao"), i.dataset.split = "acao";
135
+ const r = document.createElement("button");
136
+ r.type = "button", r.className = `ui-ferr-btn ui-ferr-split__gatilho ui-ferr-btn--${u}`, r.dataset.id = n.id, r.dataset.split = "gatilho", r.tabIndex = -1, r.disabled = !!n.disabled, r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), r.setAttribute("aria-label", `Opções de ${C(n)}`), r.dataset.tooltip = `Opções de ${C(n)}`;
137
+ const a = document.createElement("span");
138
+ return a.className = "ui-ferr-btn__caret", r.appendChild(a), e.appendChild(i), e.appendChild(r), e;
139
+ }
140
+ function v(n, u) {
141
+ for (const t of n) {
142
+ if (t.id === u) return t;
143
+ if (t.filhos) {
144
+ const e = v(t.filhos, u);
145
+ if (e) return e;
146
+ }
147
+ }
148
+ }
149
+ function U(n, u) {
150
+ if (!u || !u.trim()) return !1;
151
+ const t = u.split("+").map((p) => p.trim()), e = t[t.length - 1], i = t.some((p) => /^(ctrl|control|cmd|meta)$/i.test(p)), r = t.some((p) => /^alt$/i.test(p)), a = t.some((p) => /^shift$/i.test(p)), s = n.ctrlKey || n.metaKey, l = n.altKey, b = n.shiftKey;
152
+ if (i !== s || r !== l || a !== b) return !1;
153
+ const o = e.toLowerCase(), d = (n.key || "").toLowerCase();
154
+ return o === "esc" || o === "escape" ? d === "escape" : o === "del" || o === "delete" ? d === "delete" : o === "enter" ? d === "enter" : o === "space" || o === "espaço" ? d === " " || d === "space" : d === o;
155
+ }
156
+ function j(n) {
157
+ const u = n.filter((t) => !t.disabled);
158
+ n.forEach((t) => t.tabIndex = -1), u.length && (u[0].tabIndex = 0);
159
+ }
160
+ function W(n) {
161
+ const u = n.find((t) => t.tabIndex === 0 && !t.disabled);
162
+ u ? n.forEach((t) => {
163
+ t !== u && (t.tabIndex = -1);
164
+ }) : j(n);
165
+ }
166
+ function Y(n, u) {
167
+ const t = n.find((e) => e === u || e.contains(u));
168
+ !t || t.disabled || n.forEach((e) => e.tabIndex = e === t ? 0 : -1);
169
+ }
170
+ function $(n, u, t, e) {
171
+ const i = u.filter((l) => !l.disabled), r = i.length, a = i.findIndex((l) => l === n.target);
172
+ if (r === 0 || a < 0) return !1;
173
+ let s = a;
174
+ if (t.includes(n.key)) s = (a - 1 + r) % r;
175
+ else if (e.includes(n.key)) s = (a + 1) % r;
176
+ else if (n.key === "Home") s = 0;
177
+ else if (n.key === "End") s = r - 1;
178
+ else return !1;
179
+ return n.preventDefault(), u.forEach((l) => l.tabIndex = -1), i[s].tabIndex = 0, i[s].focus(), !0;
180
+ }
181
+ function at(n, u, t = !1) {
182
+ const e = u.filter((l) => !l.disabled), i = e.length, r = e.findIndex((l) => l === n.target);
183
+ if (i === 0 || r < 0) return !1;
184
+ let a = r;
185
+ const s = r % 2;
186
+ if (n.key === "ArrowRight")
187
+ t ? s === 1 && (a = r - 1) : s === 0 && r + 1 < i && (a = r + 1);
188
+ else if (n.key === "ArrowLeft")
189
+ t ? s === 0 && r + 1 < i && (a = r + 1) : s === 1 && (a = r - 1);
190
+ else if (n.key === "ArrowDown")
191
+ r + 2 < i ? a = r + 2 : r + 1 < i && s === 0 && (a = r + 1);
192
+ else if (n.key === "ArrowUp")
193
+ r - 2 >= 0 ? a = r - 2 : r - 1 >= 0 && s === 1 && (a = r - 1);
194
+ else if (n.key === "Home")
195
+ a = 0;
196
+ else if (n.key === "End")
197
+ a = i - 1;
198
+ else
199
+ return !1;
200
+ return n.preventDefault(), u.forEach((l) => l.tabIndex = -1), e[a].tabIndex = 0, e[a].focus(), !0;
201
+ }
202
+ let ot = 0;
203
+ class X {
204
+ constructor(u, t) {
205
+ c(this, "el");
206
+ c(this, "textoEl");
207
+ c(this, "atalhoEl");
208
+ c(this, "timer");
209
+ c(this, "alvoAtual", null);
210
+ c(this, "id", `ui-ferr-tooltip-${++ot}`);
211
+ c(this, "listeners", new M());
212
+ this.raiz = u, this.el = document.createElement("div"), this.el.className = "ui-ferr-tooltip", this.el.id = this.id, this.el.setAttribute("role", "tooltip"), this.el.setAttribute("aria-hidden", "true"), this.textoEl = document.createElement("span"), this.textoEl.className = "ui-ferr-tooltip__texto", this.atalhoEl = document.createElement("kbd"), this.atalhoEl.className = "ui-ferr-tooltip__atalho", this.el.appendChild(this.textoEl), this.el.appendChild(this.atalhoEl), this.raiz.appendChild(this.el), this.listeners.add(t, "pointerover", (e) => {
213
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
214
+ if (i && i !== this.alvoAtual) {
215
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
216
+ r && this.agendar(i, r, a);
217
+ }
218
+ }), this.listeners.add(t, "pointerout", (e) => {
219
+ const r = e.relatedTarget;
220
+ this.alvoAtual && (!r || !this.alvoAtual.contains(r)) && this.esconder();
221
+ }), this.listeners.add(t, "focusin", (e) => {
222
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
223
+ if (i) {
224
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
225
+ r && this.mostrar(i, r, a);
226
+ }
227
+ }), this.listeners.add(t, "focusout", () => this.esconder()), this.listeners.add(t, "pointerdown", () => this.esconder()), this.listeners.add(t, "click", () => this.esconder()), this.listeners.add(window, "scroll", () => this.esconder(), !0), this.listeners.add(window, "resize", () => this.esconder());
228
+ }
229
+ agendar(u, t, e) {
230
+ this.limparTimer(), this.timer = window.setTimeout(() => this.mostrar(u, t, e), 140);
231
+ }
232
+ mostrar(u, t, e) {
233
+ if (this.limparTimer(), !u.isConnected || !t) return;
234
+ this.alvoAtual = u, this.textoEl.textContent = t, e ? (this.atalhoEl.textContent = `(${e})`, this.atalhoEl.style.display = "") : (this.atalhoEl.textContent = "", this.atalhoEl.style.display = "none"), this.el.classList.add("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "false"), u.setAttribute("aria-describedby", this.id);
235
+ const i = u.getBoundingClientRect(), r = this.el.getBoundingClientRect();
236
+ let a = i.bottom + 6, s = i.left + (i.width - (r.width || 80)) / 2;
237
+ a + (r.height || 24) > window.innerHeight - 6 && (a = Math.max(6, i.top - (r.height || 24) - 6)), s < 6 ? s = 6 : s + (r.width || 80) > window.innerWidth - 6 && (s = Math.max(6, window.innerWidth - (r.width || 80) - 6)), this.el.style.top = `${a}px`, this.el.style.left = `${s}px`;
238
+ }
239
+ esconder() {
240
+ this.limparTimer(), this.alvoAtual && (this.alvoAtual.removeAttribute("aria-describedby"), this.alvoAtual = null), this.el.classList.remove("ui-ferr-tooltip--visivel"), this.el.setAttribute("aria-hidden", "true");
241
+ }
242
+ limparTimer() {
243
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0);
244
+ }
245
+ destruir() {
246
+ this.esconder(), this.listeners.cleanup(), this.el.remove();
247
+ }
248
+ }
249
+ let st = 0;
250
+ function z(n, u, t, e, i = {}) {
251
+ var H;
252
+ const r = i.lado ?? "baixo", a = new M(), s = document.createElement("div");
253
+ s.className = "ui-ferr-menu", s.setAttribute("role", "menu"), s.id = `ui-ferr-menu-${++st}`, s.setAttribute("aria-label", u.getAttribute("aria-label") || "Menu"), u.setAttribute("aria-controls", s.id);
254
+ const l = [];
255
+ let b = !1, o = null;
256
+ const d = () => {
257
+ o && (o.fechar(), o = null);
258
+ }, p = () => {
259
+ var h;
260
+ b || (b = !0, d(), u.removeAttribute("aria-controls"), a.cleanup(), s.remove(), (h = i.onFechar) == null || h.call(i));
261
+ }, m = getComputedStyle(u).direction === "rtl";
262
+ t.forEach((h) => {
263
+ var B;
264
+ if (h.tipo === "separador") {
265
+ const _ = document.createElement("div");
266
+ _.className = "ui-ferr-menu__sep", _.setAttribute("role", "separator"), s.appendChild(_);
267
+ return;
268
+ }
269
+ const f = document.createElement("button");
270
+ f.type = "button", f.className = "ui-ferr-menu__item";
271
+ const E = h.tipo ?? i.tipoPadrao ?? "botao";
272
+ E === "toggle" ? (f.setAttribute("role", "menuitemcheckbox"), f.setAttribute("aria-checked", String(!!h.ativo))) : E === "ferramenta" ? (f.setAttribute("role", "menuitemradio"), f.setAttribute("aria-checked", String(!!h.ativo))) : f.setAttribute("role", "menuitem"), f.dataset.id = h.id, f.disabled = !!h.disabled, h.atalho && f.setAttribute("aria-keyshortcuts", h.atalho), h.ativo && f.classList.add("ui-ferr-menu__item--ativo");
273
+ const k = document.createElement("span");
274
+ k.className = "ui-ferr-menu__icone";
275
+ const P = S(h.icone, 14);
276
+ P && k.appendChild(P), f.appendChild(k);
277
+ const x = document.createElement("span");
278
+ if (x.className = "ui-ferr-menu__rotulo", x.textContent = C(h), f.appendChild(x), h.atalho) {
279
+ const _ = document.createElement("span");
280
+ _.className = "ui-ferr-menu__atalho", _.textContent = h.atalho, f.appendChild(_);
281
+ }
282
+ if (!!((B = h.filhos) != null && B.length)) {
283
+ f.classList.add("ui-ferr-menu__item--has-sub"), f.setAttribute("aria-haspopup", "menu"), f.setAttribute("aria-expanded", "false");
284
+ const _ = document.createElement("span");
285
+ _.className = "ui-ferr-menu__caret-sub", f.appendChild(_);
286
+ const O = (T) => {
287
+ (o == null ? void 0 : o.ancora) !== f && (d(), f.setAttribute("aria-expanded", "true"), o = z(n, f, h.filhos, e, {
288
+ lado: m ? "esquerda" : "direita",
289
+ focar: T,
290
+ tipoPadrao: i.tipoPadrao,
291
+ onFechar: () => {
292
+ f.setAttribute("aria-expanded", "false"), o = null;
293
+ }
294
+ }));
295
+ };
296
+ f.addEventListener("pointerenter", () => O(!1)), f.addEventListener("click", (T) => {
297
+ T.stopPropagation(), O(!0);
298
+ });
299
+ } else
300
+ f.addEventListener("pointerenter", d), f.addEventListener("click", (_) => {
301
+ _.stopPropagation(), p(), u.focus(), e(h);
302
+ });
303
+ l.push(f), s.appendChild(f);
304
+ }), n.appendChild(s);
305
+ const g = u.getBoundingClientRect(), w = s.getBoundingClientRect();
306
+ let L = r === "baixo" ? g.bottom + 2 : g.top, y = r === "direita" ? g.right + 4 : r === "esquerda" ? g.left - w.width - 4 : m ? g.right - w.width : g.left;
307
+ w.width && y + w.width > window.innerWidth - 4 && (y = Math.max(4, window.innerWidth - w.width - 4)), y < 4 && (y = 4), w.height && L + w.height > window.innerHeight - 4 && (L = Math.max(4, window.innerHeight - w.height - 4)), s.style.top = `${L}px`, s.style.left = `${y}px`;
308
+ const I = () => l.filter((h) => !h.disabled);
309
+ return a.add(s, "keydown", (h) => {
310
+ const f = I(), E = f.findIndex((x) => x === h.target), k = m ? "ArrowLeft" : "ArrowRight", P = m ? "ArrowRight" : "ArrowLeft";
311
+ if (h.key === "Escape")
312
+ h.preventDefault(), h.stopPropagation(), p(), u.focus();
313
+ else if (h.key === "Tab")
314
+ p();
315
+ else if (f.length && (h.key === "ArrowDown" || h.key === "ArrowUp")) {
316
+ h.preventDefault(), d();
317
+ const x = h.key === "ArrowDown" ? 1 : -1;
318
+ f[(E + x + f.length) % f.length].focus();
319
+ } else if (f.length && h.key === k) {
320
+ const x = f[E];
321
+ x != null && x.classList.contains("ui-ferr-menu__item--has-sub") && (h.preventDefault(), x.click());
322
+ } else h.key === P && (r === "direita" || r === "esquerda") ? (h.preventDefault(), h.stopPropagation(), p(), u.focus()) : f.length && h.key === "Home" ? (h.preventDefault(), f[0].focus()) : f.length && h.key === "End" && (h.preventDefault(), f[f.length - 1].focus());
323
+ }), a.add(document, "pointerdown", (h) => {
324
+ const f = h.composedPath();
325
+ !f.includes(s) && !f.includes(u) && !(o != null && o.elemento.contains(h.target)) && p();
326
+ }, !0), a.add(window, "resize", p), a.add(window, "scroll", (h) => {
327
+ h.target instanceof Node && s.contains(h.target) || p();
328
+ }, !0), i.focar && ((H = I()[0]) == null || H.focus()), { elemento: s, ancora: u, fechar: p, focarPrimeiro: () => {
329
+ var h;
330
+ return (h = I()[0]) == null ? void 0 : h.focus();
331
+ } };
332
+ }
333
+ let nt = 0;
334
+ class lt extends N {
335
+ constructor() {
336
+ super();
337
+ c(this, "rootElement");
338
+ c(this, "abasElement");
339
+ c(this, "gruposElement");
340
+ c(this, "painelElement");
341
+ c(this, "fixarElement");
342
+ c(this, "uid", `ui-ribbon-${++nt}`);
343
+ c(this, "_abaPendente", "");
344
+ c(this, "_pronto", !1);
345
+ c(this, "_modoControlado", !1);
346
+ c(this, "_abas", []);
347
+ c(this, "_abaAtiva", "");
348
+ c(this, "menu", null);
349
+ c(this, "listeners", new M());
350
+ c(this, "tooltip", null);
351
+ c(this, "observerResize", null);
352
+ c(this, "gruposColapsados", /* @__PURE__ */ new Set());
353
+ c(this, "keytipsAtivas", !1);
354
+ c(this, "handleFocusInGrupos", (t) => Y(this.botoesPainel(), t.target));
355
+ /* ---------- Interação ---------- */
356
+ c(this, "handleClickAbas", (t) => {
357
+ const e = t.target.closest(".ui-ribbon__aba");
358
+ e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
359
+ });
360
+ c(this, "handleClickFixar", () => {
361
+ this.recolhido = !this.recolhido;
362
+ });
363
+ c(this, "handleDblClickAbas", (t) => {
364
+ t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
365
+ });
366
+ c(this, "handleKeyDownAbas", (t) => {
367
+ var b, o;
368
+ const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = e.findIndex((d) => d === t.target);
369
+ if (i < 0) return;
370
+ if (this.ativacaoManual && (t.key === "Enter" || t.key === " ")) {
371
+ t.preventDefault();
372
+ const d = e[i].dataset.id;
373
+ d && this.selecionarAba(d);
374
+ return;
375
+ }
376
+ let r = i;
377
+ const [a, s] = this.rtl ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
378
+ if (t.key === a) r = (i + 1) % e.length;
379
+ else if (t.key === s) r = (i - 1 + e.length) % e.length;
380
+ else if (t.key === "Home") r = 0;
381
+ else if (t.key === "End") r = e.length - 1;
382
+ else if (t.key === "ArrowDown") {
383
+ t.preventDefault(), this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (b = this.botoesPainel().find((d) => !d.disabled)) == null || b.focus();
384
+ return;
385
+ } else return;
386
+ t.preventDefault();
387
+ const l = e[r].dataset.id;
388
+ this.ativacaoManual ? (e.forEach((d) => d.tabIndex = -1), e[r].tabIndex = 0, e[r].focus()) : (l && this.selecionarAba(l), (o = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(l ?? "")}"]`)) == null || o.focus());
389
+ });
390
+ c(this, "handleClickGrupos", (t) => {
391
+ var a;
392
+ const e = t.target, i = e.closest(".ui-ferr-split__gatilho");
393
+ if (i) {
394
+ const s = i.closest(".ui-ferr-split"), l = s == null ? void 0 : s.dataset.id, b = this._abas.find((d) => d.id === this._abaAtiva), o = b && v(b.grupos.flatMap((d) => d.itens), l ?? "");
395
+ o && ((a = o.filhos) != null && a.length) && this.alternarMenu(i, o, !1);
396
+ return;
397
+ }
398
+ const r = e.closest(".ui-ferr-btn");
399
+ r != null && r.dataset.id && this.acionar(r, t.detail === 0);
400
+ });
401
+ c(this, "handleKeyDownGrupos", (t) => {
402
+ var r;
403
+ const e = this.botoesPainel();
404
+ if (this.rtl ? $(t, e, ["ArrowRight"], ["ArrowLeft"]) : $(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
405
+ const i = t.target instanceof HTMLButtonElement ? t.target : null;
406
+ (i == null ? void 0 : i.getAttribute("aria-haspopup")) === "menu" && t.key === "ArrowDown" && (t.preventDefault(), ((r = this.menu) == null ? void 0 : r.ancora) === i ? this.menu.focarPrimeiro() : this.acionar(i, !0));
407
+ });
408
+ c(this, "handleEscape", (t) => {
409
+ t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
410
+ });
411
+ c(this, "handlePointerDownFora", (t) => {
412
+ !this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
413
+ });
414
+ c(this, "handleAtalho", (t) => {
415
+ if (!this.hasAttribute("atalhos") && !this.hasAttribute("keytips") || t.defaultPrevented) return;
416
+ const e = t.composedPath(), i = e[0];
417
+ if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((o) => {
418
+ var p, m;
419
+ const d = (p = o.getAttribute) == null ? void 0 : p.call(o, "role");
420
+ return ((m = o.getAttribute) == null ? void 0 : m.call(o, "aria-modal")) === "true" || d === "textbox" || d === "searchbox" || d === "combobox" || d === "spinbutton";
421
+ })) return;
422
+ if (this.hasAttribute("keytips") && (t.key === "Alt" || t.key === "F10") && !t.ctrlKey && !t.shiftKey && !t.metaKey) {
423
+ t.preventDefault(), this.alternarKeyTips();
424
+ return;
425
+ }
426
+ if (!this.hasAttribute("atalhos")) return;
427
+ const a = this._abas.find((o) => o.id === this._abaAtiva);
428
+ if (!a) return;
429
+ const l = a.grupos.flatMap((o) => o.itens).find((o) => !o.disabled && U(t, o.atalho));
430
+ if (!l) return;
431
+ t.preventDefault();
432
+ const b = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(l.id)}"]`);
433
+ b ? this.acionar(b, !1) : this.emitir(l);
434
+ });
435
+ const t = this.attachShadow({ mode: "open" });
436
+ t.innerHTML = `
437
+ <style>${K}${it}</style>
438
+ <div class="ui-ribbon">
439
+ <div class="ui-ribbon__cabecalho">
440
+ <div class="ui-ribbon__abas" role="tablist"></div>
441
+ <button type="button" class="ui-ribbon__fixar"></button>
442
+ </div>
443
+ <div class="ui-ribbon__painel" role="tabpanel">
444
+ <div class="ui-ribbon__grupos" role="toolbar" aria-label="Ferramentas"></div>
445
+ </div>
446
+ </div>
447
+ `, this.rootElement = t.querySelector(".ui-ribbon"), this.abasElement = t.querySelector(".ui-ribbon__abas"), this.gruposElement = t.querySelector(".ui-ribbon__grupos"), this.painelElement = t.querySelector(".ui-ribbon__painel"), this.fixarElement = t.querySelector(".ui-ribbon__fixar"), this.painelElement.id = `${this.uid}-painel`;
448
+ }
449
+ static get observedAttributes() {
450
+ return [
451
+ "aba-ativa",
452
+ "recolhido",
453
+ "compacto",
454
+ "ativacao-manual",
455
+ "copiar-dados",
456
+ "modo-controlado",
457
+ "atalhos",
458
+ "keytips",
459
+ "aria-label",
460
+ "rotulo-abas",
461
+ "rotulo-fixar",
462
+ "rotulo-expandir"
463
+ ];
464
+ }
465
+ connectedCallback() {
466
+ var e;
467
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new X(this.shadowRoot, this.rootElement), this.listeners.add(this.abasElement, "click", this.handleClickAbas), this.listeners.add(this.fixarElement, "click", this.handleClickFixar), this.listeners.add(this.abasElement, "dblclick", this.handleDblClickAbas), this.listeners.add(this.abasElement, "keydown", this.handleKeyDownAbas), this.listeners.add(this.gruposElement, "click", this.handleClickGrupos), this.listeners.add(this.gruposElement, "keydown", this.handleKeyDownGrupos), this.listeners.add(document, "pointerdown", this.handlePointerDownFora, !0), this.listeners.add(this.rootElement, "keydown", this.handleEscape), this.listeners.add(this.gruposElement, "focusin", this.handleFocusInGrupos), this.listeners.add(document, "keydown", this.handleAtalho), this.iniciarResizeObserver();
468
+ const t = this.getAttribute("aba-ativa");
469
+ t && !this._abaAtiva && (this._abaPendente = t), this.aplicarRotulos(), this.renderizar(), this._pronto = !0;
470
+ }
471
+ disconnectedCallback() {
472
+ var t, e;
473
+ this._pronto = !1, this.fecharMenu(), (t = this.observerResize) == null || t.disconnect(), this.observerResize = null, (e = this.tooltip) == null || e.destruir(), this.tooltip = null, this.listeners.cleanup();
474
+ }
475
+ attributeChangedCallback(t, e, i) {
476
+ if (e !== i)
477
+ if (t === "aba-ativa") {
478
+ if (!i || i === this._abaAtiva) return;
479
+ this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
480
+ } else t === "recolhido" ? (this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
481
+ new CustomEvent("ui-recolhido-change", {
482
+ detail: { recolhido: i !== null },
483
+ bubbles: !0,
484
+ composed: !0
485
+ })
486
+ )) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
487
+ }
488
+ aplicarRotulos() {
489
+ this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
490
+ const t = this.hasAttribute("recolhido"), e = t ? this.getAttribute("rotulo-expandir") || "Fixar faixa de opções" : this.getAttribute("rotulo-fixar") || "Recolher faixa de opções";
491
+ this.fixarElement.setAttribute("aria-label", e), this.fixarElement.title = e, this.fixarElement.setAttribute("aria-expanded", String(!t)), this.fixarElement.setAttribute("aria-controls", this.painelElement.id);
492
+ }
493
+ /* ---------- API pública ---------- */
494
+ get modoControlado() {
495
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
496
+ }
497
+ set modoControlado(t) {
498
+ this._modoControlado = !!t;
499
+ }
500
+ get copiarDados() {
501
+ return this.modoControlado;
502
+ }
503
+ set copiarDados(t) {
504
+ this.modoControlado = t;
505
+ }
506
+ get ativacaoManual() {
507
+ return this.hasAttribute("ativacao-manual");
508
+ }
509
+ set ativacaoManual(t) {
510
+ t ? this.setAttribute("ativacao-manual", "") : this.removeAttribute("ativacao-manual");
511
+ }
512
+ get abas() {
513
+ return this._abas;
514
+ }
515
+ set abas(t) {
516
+ const e = Array.isArray(t) ? t : [];
517
+ this._abas = this.modoControlado ? e.map((i) => ({
518
+ ...i,
519
+ grupos: i.grupos.map((r) => ({
520
+ ...r,
521
+ itens: r.itens.map((a) => {
522
+ var s;
523
+ return {
524
+ ...a,
525
+ filhos: (s = a.filhos) == null ? void 0 : s.map((l) => ({ ...l }))
526
+ };
527
+ })
528
+ }))
529
+ })) : e, R(this._abas.map((i) => i.id), "<ui-ribbon> abas"), R(
530
+ this._abas.flatMap((i) => i.grupos.flatMap((r) => q(r.itens))),
531
+ "<ui-ribbon> itens"
532
+ ), this.gruposColapsados.clear(), this.renderizar();
533
+ }
534
+ get abaAtiva() {
535
+ return this._abaAtiva;
536
+ }
537
+ set abaAtiva(t) {
538
+ this.selecionarAba(t);
539
+ }
540
+ get recolhido() {
541
+ return this.hasAttribute("recolhido");
542
+ }
543
+ set recolhido(t) {
544
+ t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
545
+ }
546
+ get compacto() {
547
+ return this.hasAttribute("compacto");
548
+ }
549
+ set compacto(t) {
550
+ t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
551
+ }
552
+ selecionarAba(t, e = !0) {
553
+ const i = this._abas.find((r) => r.id === t && !r.oculta);
554
+ if (!i) {
555
+ t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
556
+ return;
557
+ }
558
+ i.id !== this._abaAtiva && (this._abaPendente = "", this.fecharMenu(), this.gruposColapsados.clear(), this._abaAtiva = i.id, this.getAttribute("aba-ativa") !== i.id && this.setAttribute("aba-ativa", i.id), this.renderizar(), e && this.dispatchEvent(
559
+ new CustomEvent("ui-aba-change", {
560
+ detail: { id: i.id, aba: i },
561
+ bubbles: !0,
562
+ composed: !0
563
+ })
564
+ ));
565
+ }
566
+ definirAbaVisivel(t, e) {
567
+ const i = this._abas.find((s) => s.id === t);
568
+ if (!i) return;
569
+ const r = this._abaAtiva;
570
+ i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
571
+ const a = this._abas.find((s) => s.id === this._abaAtiva);
572
+ !e && r === t && a && this.dispatchEvent(
573
+ new CustomEvent("ui-aba-change", { detail: { id: a.id, aba: a }, bubbles: !0, composed: !0 })
574
+ );
575
+ }
576
+ /** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
577
+ atualizarItem(t, e) {
578
+ const i = this._abas.flatMap((b) => b.grupos.flatMap((o) => o.itens)), r = v(i, t);
579
+ if (!r) {
580
+ console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
581
+ return;
582
+ }
583
+ Object.assign(r, e);
584
+ const a = this._abas.find((b) => b.id === this._abaAtiva);
585
+ if (!a || !v(a.grupos.flatMap((b) => b.itens), t)) return;
586
+ const s = Object.keys(e).every((b) => b === "ativo" || b === "disabled"), l = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
587
+ s ? l && (A(l, this.efetivo(r)), W(this.botoesPainel())) : this.comFoco(() => this.renderizarPainel());
588
+ }
589
+ efetivo(t) {
590
+ var e;
591
+ return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
592
+ }
593
+ /* ---------- Foco preservado em re-renderizações ---------- */
594
+ capturarFoco() {
595
+ var e, i;
596
+ const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
597
+ return (i = t == null ? void 0 : t.dataset) != null && i.id ? t.classList.contains("ui-ribbon__aba") ? { seletor: ".ui-ribbon__aba", id: t.dataset.id } : t.classList.contains("ui-ferr-btn") ? { seletor: ".ui-ferr-btn", id: t.dataset.id } : null : null;
598
+ }
599
+ comFoco(t) {
600
+ const e = this.capturarFoco();
601
+ if (t(), !e) return;
602
+ const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
603
+ i && !i.disabled && i.focus();
604
+ }
605
+ /* ---------- Renderização ---------- */
606
+ abasVisiveis() {
607
+ return this._abas.filter((t) => !t.oculta);
608
+ }
609
+ renderizar() {
610
+ var e;
611
+ const t = this.abasVisiveis();
612
+ this._abaPendente && t.length && (t.some((i) => i.id === this._abaPendente) ? (this._abaAtiva = this._abaPendente, this._abaPendente = "") : this._abas.some((i) => i.id === this._abaPendente) || (console.warn(`[ui-ribbon] aba-ativa="${this._abaPendente}" não existe em "abas".`), this._abaPendente = "")), t.some((i) => i.id === this._abaAtiva) || (this._abaAtiva = ((e = t[0]) == null ? void 0 : e.id) ?? ""), this._abaAtiva && !this._abaPendente && this.getAttribute("aba-ativa") !== this._abaAtiva && this.setAttribute("aba-ativa", this._abaAtiva), this.comFoco(() => {
613
+ this.renderizarAbas(), this.renderizarPainel();
614
+ });
615
+ }
616
+ renderizarAbas() {
617
+ this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
618
+ const e = t.id === this._abaAtiva, i = document.createElement("button");
619
+ i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = t.id, i.id = this.idAba(t.id), e && i.setAttribute("aria-controls", this.painelElement.id), i.textContent = t.rotulo, i.tabIndex = e ? 0 : -1, i.setAttribute("aria-selected", String(e)), i.classList.toggle("ui-ribbon__aba--ativa", e), i.classList.toggle("ui-ribbon__aba--contextual", !!t.contextual), this.abasElement.appendChild(i);
620
+ });
621
+ }
622
+ idAba(t) {
623
+ return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
624
+ }
625
+ renderizarPainel() {
626
+ this.fecharMenu(), this.gruposElement.innerHTML = "";
627
+ const t = this._abas.find((e) => e.id === this._abaAtiva);
628
+ if (!t) {
629
+ this.painelElement.removeAttribute("aria-labelledby");
630
+ return;
631
+ }
632
+ this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(this.criarGrupo(e))), j(this.botoesPainel());
633
+ }
634
+ iniciarResizeObserver() {
635
+ typeof ResizeObserver > "u" || (this.observerResize = new ResizeObserver(() => {
636
+ this.ajustarColapsoGrupos();
637
+ }), this.observerResize.observe(this.painelElement));
638
+ }
639
+ ajustarColapsoGrupos() {
640
+ const t = this._abas.find((i) => i.id === this._abaAtiva);
641
+ if (!t || !t.grupos.length) return;
642
+ const e = this.gruposElement;
643
+ if (e.scrollWidth > e.clientWidth) {
644
+ const i = [...t.grupos].filter((r) => !this.gruposColapsados.has(r.id)).sort((r, a) => (r.prioridade ?? 0) - (a.prioridade ?? 0));
645
+ i.length > 0 && (this.gruposColapsados.add(i[0].id), this.renderizarPainel());
646
+ } else if (this.gruposColapsados.size > 0) {
647
+ const i = [...t.grupos].filter((r) => this.gruposColapsados.has(r.id)).sort((r, a) => (a.prioridade ?? 0) - (r.prioridade ?? 0));
648
+ i.length > 0 && (this.gruposColapsados.delete(i[0].id), this.renderizarPainel(), e.scrollWidth > e.clientWidth && (this.gruposColapsados.add(i[0].id), this.renderizarPainel()));
649
+ }
650
+ }
651
+ alternarMenuGrupoColapsado(t, e) {
652
+ var r;
653
+ const i = ((r = this.menu) == null ? void 0 : r.ancora) === t;
654
+ this.fecharMenu(), !i && (t.setAttribute("aria-expanded", "true"), this.menu = z(
655
+ this.shadowRoot,
656
+ t,
657
+ e.itens,
658
+ (a) => {
659
+ const s = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(a.id)}"]`);
660
+ if (s) this.acionar(s, !1);
661
+ else {
662
+ const l = a.ativo;
663
+ a.tipo === "toggle" ? a.ativo = !l : a.tipo === "ferramenta" && (a.ativo = !0), this.emitir(a) || (a.ativo = l);
664
+ }
665
+ this.rootElement.classList.remove("ui-ribbon--aberto");
666
+ },
667
+ {
668
+ lado: "baixo",
669
+ onFechar: () => {
670
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
671
+ }
672
+ }
673
+ ));
674
+ }
675
+ criarGrupo(t) {
676
+ const e = document.createElement("div");
677
+ if (e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", t.rotulo), e.dataset.id = t.id, this.gruposColapsados.has(t.id)) {
678
+ e.classList.add("ui-ribbon__grupo--colapsado");
679
+ const o = document.createElement("button");
680
+ o.type = "button", o.className = "ui-ferr-btn ui-ferr-btn--grande ui-ribbon__btn-colapsado", o.dataset.id = t.id, o.dataset.tooltip = t.rotulo, o.setAttribute("aria-haspopup", "menu"), o.setAttribute("aria-expanded", "false");
681
+ const d = S(t.icone, 24) || S('<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" fill="none"/></svg>', 24);
682
+ if (d) {
683
+ const g = document.createElement("span");
684
+ g.className = "ui-ferr-btn__icone", g.appendChild(d), o.appendChild(g);
685
+ }
686
+ const p = document.createElement("span");
687
+ p.className = "ui-ferr-btn__rotulo", p.textContent = t.rotulo, o.appendChild(p);
688
+ const m = document.createElement("span");
689
+ return m.className = "ui-ferr-btn__caret", o.appendChild(m), o.addEventListener("click", (g) => {
690
+ g.stopPropagation(), this.alternarMenuGrupoColapsado(o, t);
691
+ }), e.appendChild(o), e;
692
+ }
693
+ const i = document.createElement("div");
694
+ i.className = "ui-ribbon__grupo-itens";
695
+ let r = null, a = 0;
696
+ const s = () => {
697
+ r && i.appendChild(r), r = null, a = 0;
698
+ }, l = (o, d, p) => {
699
+ var m;
700
+ return o.dividido && ((m = o.filhos) != null && m.length) ? rt(this.efetivo(o), d, p) : this.criarBotao(o, d, p);
701
+ };
702
+ t.itens.forEach((o) => {
703
+ if (o.tipo === "separador") {
704
+ s();
705
+ const d = document.createElement("div");
706
+ d.className = "ui-ribbon__separador", d.setAttribute("role", "separator"), i.appendChild(d);
707
+ } else o.tamanho === "grande" ? (s(), i.appendChild(l(o, "grande", 24))) : (r || (r = document.createElement("div"), r.className = "ui-ribbon__coluna"), r.appendChild(l(o, "pequeno", 16)), ++a === 3 && s());
708
+ }), s();
709
+ const b = document.createElement("div");
710
+ if (b.className = "ui-ribbon__grupo-rotulo", b.textContent = t.rotulo, t.lancadorDialogo) {
711
+ const o = document.createElement("button");
712
+ o.type = "button", o.className = "ui-ribbon__lancador";
713
+ const d = t.rotuloLancador || `Mais opções de ${t.rotulo}`;
714
+ o.setAttribute("aria-label", d), o.dataset.tooltip = d, o.innerHTML = '<svg viewBox="0 0 16 16" width="10" height="10" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 12h8V4M12 12l-7-7"/></svg>', o.addEventListener("click", (p) => {
715
+ p.stopPropagation(), this.dispatchEvent(new CustomEvent("ui-grupo-dialogo", {
716
+ detail: { id: typeof t.lancadorDialogo == "string" ? t.lancadorDialogo : t.id, grupo: t },
717
+ bubbles: !0,
718
+ composed: !0
719
+ }));
720
+ }), b.appendChild(o);
721
+ }
722
+ return e.appendChild(i), e.appendChild(b), e;
723
+ }
724
+ criarBotao(t, e, i) {
725
+ return F(this.efetivo(t), e, i);
726
+ }
727
+ botoesPainel() {
728
+ return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
729
+ }
730
+ get rtl() {
731
+ return getComputedStyle(this).direction === "rtl";
732
+ }
733
+ alternarKeyTips() {
734
+ if (this.keytipsAtivas = !this.keytipsAtivas, this.shadowRoot.querySelectorAll(".ui-ribbon__keytip").forEach((e) => e.remove()), !this.keytipsAtivas) return;
735
+ Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")).forEach((e, i) => {
736
+ const r = document.createElement("span");
737
+ r.className = "ui-ribbon__keytip", r.textContent = String(i + 1), r.style.top = "2px", r.style.left = "4px", e.style.position = "relative", e.appendChild(r);
738
+ });
739
+ }
740
+ acionar(t, e) {
741
+ var s;
742
+ const i = this._abas.find((l) => l.id === this._abaAtiva), r = i == null ? void 0 : i.grupos.find((l) => v(l.itens, t.dataset.id)), a = r && v(r.itens, t.dataset.id);
743
+ if (!(!a || a.disabled)) {
744
+ if ((s = a.filhos) != null && s.length && !a.dividido) {
745
+ this.alternarMenu(t, a, e);
746
+ return;
747
+ }
748
+ if (a.tipo === "toggle") {
749
+ const l = a.ativo;
750
+ a.ativo = !l, A(t, a), this.emitir(a) || (a.ativo = l, A(t, a));
751
+ } else if (a.tipo === "ferramenta") {
752
+ const l = a.ativo, b = r ? r.exclusivo !== !1 : !0, o = b && r ? r.itens.filter((d) => d.tipo === "ferramenta" && d.id !== a.id && d.ativo) : [];
753
+ a.ativo = !0, A(t, a), b && o.forEach((d) => {
754
+ d.ativo = !1;
755
+ const p = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(d.id)}"]`);
756
+ p && A(p, d);
757
+ }), this.emitir(a) || (a.ativo = l, A(t, a), b && o.forEach((d) => {
758
+ d.ativo = !0;
759
+ const p = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(d.id)}"]`);
760
+ p && A(p, d);
761
+ }));
762
+ } else
763
+ this.emitir(a);
764
+ this.rootElement.classList.remove("ui-ribbon--aberto");
765
+ }
766
+ }
767
+ alternarMenu(t, e, i) {
768
+ var a;
769
+ const r = ((a = this.menu) == null ? void 0 : a.ancora) === t;
770
+ this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = z(
771
+ this.shadowRoot,
772
+ t,
773
+ e.filhos,
774
+ (s) => {
775
+ if (s.tipo === "toggle") {
776
+ const l = s.ativo;
777
+ s.ativo = !l, this.emitir(s, e) || (s.ativo = l);
778
+ } else
779
+ this.emitir(s, e);
780
+ this.rootElement.classList.remove("ui-ribbon--aberto");
781
+ },
782
+ {
783
+ lado: "baixo",
784
+ focar: i,
785
+ onFechar: () => {
786
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
787
+ }
788
+ }
789
+ ));
790
+ }
791
+ fecharMenu() {
792
+ var t;
793
+ (t = this.menu) == null || t.fechar(), this.menu = null;
794
+ }
795
+ /** Retorna false se o consumidor cancelou o evento (preventDefault). */
796
+ emitir(t, e) {
797
+ return this.dispatchEvent(
798
+ new CustomEvent("ui-ferramenta", {
799
+ detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
800
+ bubbles: !0,
801
+ composed: !0,
802
+ cancelable: !0
803
+ })
804
+ );
805
+ }
806
+ }
807
+ D("ui-ribbon", lt);
808
+ const ut = ':host{display:inline-flex;flex-direction:column;max-width:100%;max-height:100%;vertical-align:top;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.ui-paleta{--ui-paleta-btn: 34px;--ui-paleta-padding: 4px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 10px);--ui-paleta-btn-raio: var(--ui-paleta-raio-botao, max(2px, calc(var(--ui-paleta-raio) - var(--ui-paleta-padding))));display:flex;flex-direction:column;align-items:center;gap:2px;padding:var(--ui-paleta-padding);box-sizing:border-box;background:var(--ui-cor-superficie, #141417);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-paleta-raio);-webkit-user-select:none;user-select:none;min-width:0;min-height:0;max-width:100%;overflow:auto;scrollbar-width:thin}.ui-paleta--horizontal{flex-direction:row}.ui-paleta--sm{--ui-paleta-btn: 28px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 8px)}.ui-paleta--lg{--ui-paleta-btn: 42px;--ui-paleta-raio: var(--ui-paleta-raio-borda, 12px)}.ui-paleta--cols-2{display:grid;grid-template-columns:repeat(2,var(--ui-paleta-btn));justify-content:center}.ui-paleta--cols-2 .ui-paleta__sep{grid-column:1 / -1}.ui-ferr-btn--grupo:after{content:"";position:absolute;inset-inline-end:3px;bottom:3px;width:0;height:0;border-inline-start:6px solid transparent;border-bottom:6px solid currentColor;opacity:.8;pointer-events:none;transition:opacity .12s ease,transform .12s ease}.ui-ferr-btn--grupo:hover:after,.ui-ferr-btn--grupo:focus-visible:after,.ui-ferr-btn--grupo[aria-expanded=true]:after{opacity:1;transform:scale(1.2);transform-origin:bottom right}.ui-paleta__sep{grid-column:1 / -1}.ui-paleta .ui-ferr-btn{width:var(--ui-paleta-btn);height:var(--ui-paleta-btn);border-radius:var(--ui-paleta-btn-raio)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:var(--ui-cor-primaria, #00E08A);border-color:transparent;color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 86%,#fff)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 80%,#000)}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:disabled{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:inherit}.ui-ferr-btn--grupo:after{content:"";position:absolute;right:3px;bottom:3px;width:0;height:0;border-left:5px solid transparent;border-bottom:5px solid currentColor;opacity:.7;pointer-events:none}.ui-paleta__sep{width:70%;height:1px;margin:3px 0;background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-paleta--horizontal .ui-paleta__sep{width:1px;height:70%;margin:0 3px}@media (pointer: coarse){.ui-paleta{--ui-paleta-btn: 40px}.ui-paleta--sm{--ui-paleta-btn: 36px}.ui-paleta--lg{--ui-paleta-btn: 48px}}@media (prefers-reduced-motion: reduce){.ui-ferr-btn--grupo:after{transition:none}}@media (forced-colors: active){.ui-paleta{border-color:CanvasText}.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo,.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:hover:not(:disabled),.ui-paleta .ui-ferr-btn.ui-ferr-btn--ativo:active:not(:disabled){background:Highlight;color:HighlightText;border-color:ButtonText;forced-color-adjust:none}.ui-paleta__sep{background:CanvasText}}', dt = 380, ct = 8, ht = 50, bt = { sm: 16, md: 18, lg: 22 };
809
+ class pt extends N {
810
+ constructor() {
811
+ super();
812
+ c(this, "rootElement");
813
+ c(this, "_ferramentas", []);
814
+ c(this, "_ativo", "");
815
+ c(this, "_pendente", "");
816
+ c(this, "visiveis", /* @__PURE__ */ new Map());
817
+ // id do grupo → id do filho exibido
818
+ c(this, "menu", null);
819
+ c(this, "timerPressao");
820
+ c(this, "timerSupressao");
821
+ c(this, "inicioPressao", null);
822
+ c(this, "suprimirClique", !1);
823
+ c(this, "listeners", new M());
824
+ c(this, "tooltip", null);
825
+ c(this, "_modoControlado", !1);
826
+ c(this, "handleClick", (t) => {
827
+ if (this.suprimirClique) {
828
+ this.suprimirClique = !1, window.clearTimeout(this.timerSupressao);
829
+ return;
830
+ }
831
+ const e = t.target.closest(".ui-ferr-btn"), i = e != null && e.dataset.id ? v(this._ferramentas, e.dataset.id) : void 0;
832
+ if (!e || !i) return;
833
+ const r = e.dataset.grupo ? v(this._ferramentas, e.dataset.grupo) : void 0;
834
+ this.acionar(i, r);
835
+ });
836
+ c(this, "handleFocusIn", (t) => Y(this.botoes(), t.target));
837
+ c(this, "handlePointerDown", (t) => {
838
+ const e = t;
839
+ if (e.pointerType === "mouse" && e.button !== 0) return;
840
+ const i = t.target.closest(".ui-ferr-btn--grupo");
841
+ !i || i.disabled || (this.cancelarPressao(), window.clearTimeout(this.timerSupressao), this.inicioPressao = { x: e.clientX ?? 0, y: e.clientY ?? 0 }, this.timerPressao = window.setTimeout(() => {
842
+ this.suprimirClique = !0, this.abrirFlyout(i, !1);
843
+ }, dt));
844
+ });
845
+ /** Arrastar/rolar com o dedo cancela o clique longo. */
846
+ c(this, "handlePointerMove", (t) => {
847
+ if (this.timerPressao === void 0 || !this.inicioPressao) return;
848
+ const e = t, i = (e.clientX ?? 0) - this.inicioPressao.x, r = (e.clientY ?? 0) - this.inicioPressao.y;
849
+ Math.hypot(i, r) > ct && this.cancelarPressao();
850
+ });
851
+ /** Fim do gesto: cancela o timer e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
852
+ c(this, "handlePointerFim", () => {
853
+ this.cancelarPressao(), this.suprimirClique && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
854
+ this.suprimirClique = !1;
855
+ }, ht));
856
+ });
857
+ c(this, "cancelarPressao", () => {
858
+ this.timerPressao !== void 0 && (window.clearTimeout(this.timerPressao), this.timerPressao = void 0), this.inicioPressao = null;
859
+ });
860
+ c(this, "handleContextMenu", (t) => {
861
+ const e = t.target.closest(".ui-ferr-btn--grupo");
862
+ e && (t.preventDefault(), this.cancelarPressao(), this.abrirFlyout(e, !1));
863
+ });
864
+ c(this, "handleKeyDown", (t) => {
865
+ var l;
866
+ const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = this.colunas;
867
+ if (!e && r === 2) {
868
+ if (at(t, this.botoes(), i)) return;
869
+ } else {
870
+ const b = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], o = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
871
+ if ($(t, this.botoes(), b, o)) return;
872
+ }
873
+ const a = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", s = t.target instanceof HTMLButtonElement ? t.target : null;
874
+ s != null && s.dataset.grupo && t.key === a && (t.preventDefault(), ((l = this.menu) == null ? void 0 : l.ancora) === s ? this.menu.focarPrimeiro() : this.abrirFlyout(s, !0));
875
+ });
876
+ c(this, "handleAtalho", (t) => {
877
+ if (!this.hasAttribute("atalhos") || t.defaultPrevented) return;
878
+ const e = t.composedPath(), i = e[0];
879
+ if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((o) => {
880
+ var p, m;
881
+ const d = (p = o.getAttribute) == null ? void 0 : p.call(o, "role");
882
+ return ((m = o.getAttribute) == null ? void 0 : m.call(o, "aria-modal")) === "true" || d === "textbox" || d === "searchbox" || d === "combobox" || d === "spinbutton";
883
+ })) return;
884
+ const a = Array.from(document.querySelectorAll("ui-paleta-ferramentas[atalhos]"));
885
+ if (a.length > 1 && (a.find((d) => {
886
+ var p;
887
+ return d.matches(":focus-within") || ((p = d.shadowRoot) == null ? void 0 : p.activeElement);
888
+ }) || a[0]) !== this)
889
+ return;
890
+ const s = this.todasFerramentas().filter((o) => !o.disabled && U(t, o.atalho));
891
+ if (!s.length) return;
892
+ t.preventDefault();
893
+ let l = s[0];
894
+ if (s.length > 1) {
895
+ const o = s.findIndex((d) => d.id === this._ativo);
896
+ l = s[(o + 1) % s.length];
897
+ }
898
+ const b = this._ferramentas.find((o) => {
899
+ var d;
900
+ return (d = o.filhos) == null ? void 0 : d.some((p) => p.id === l.id);
901
+ });
902
+ this.acionar(l, b);
903
+ });
904
+ const t = this.attachShadow({ mode: "open" });
905
+ t.innerHTML = `
906
+ <style>${K}${ut}</style>
907
+ <div class="ui-paleta ui-paleta--vertical" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
908
+ `, this.rootElement = t.querySelector(".ui-paleta");
909
+ }
910
+ static get observedAttributes() {
911
+ return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "aria-label", "copiar-dados", "modo-controlado"];
912
+ }
913
+ connectedCallback() {
914
+ var e;
915
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new X(this.shadowRoot, this.rootElement), this.listeners.add(this.rootElement, "click", this.handleClick), this.listeners.add(this.rootElement, "pointerdown", this.handlePointerDown), this.listeners.add(this.rootElement, "pointermove", this.handlePointerMove), this.listeners.add(this.rootElement, "pointerup", this.handlePointerFim), this.listeners.add(this.rootElement, "pointerleave", this.handlePointerFim), this.listeners.add(this.rootElement, "pointercancel", this.handlePointerFim), this.listeners.add(this.rootElement, "contextmenu", this.handleContextMenu), this.listeners.add(this.rootElement, "keydown", this.handleKeyDown), this.listeners.add(this.rootElement, "focusin", this.handleFocusIn), this.listeners.add(document, "keydown", this.handleAtalho);
916
+ const t = this.getAttribute("valor") || this.getAttribute("value");
917
+ t && !this._ativo && (this._pendente = t), this.aplicarPendente(), this.renderizar();
918
+ }
919
+ disconnectedCallback() {
920
+ var t;
921
+ this.cancelarPressao(), window.clearTimeout(this.timerSupressao), this.suprimirClique = !1, this.fecharMenu(), (t = this.tooltip) == null || t.destruir(), this.tooltip = null, this.listeners.cleanup();
922
+ }
923
+ attributeChangedCallback(t, e, i) {
924
+ if (e !== i)
925
+ if (t === "valor" || t === "value") {
926
+ const r = this.getAttribute("valor") || this.getAttribute("value") || "";
927
+ r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
928
+ } else
929
+ this.renderizar();
930
+ }
931
+ /* ---------- API pública ---------- */
932
+ /**
933
+ * Quando `true` ou atributo `copiar-dados` / `modo-controlado`: clona a árvore de itens
934
+ * para não mutar os objetos fornecidos pelo consumidor (Item 11).
935
+ */
936
+ get modoControlado() {
937
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
938
+ }
939
+ set modoControlado(t) {
940
+ this._modoControlado = !!t;
941
+ }
942
+ get copiarDados() {
943
+ return this.modoControlado;
944
+ }
945
+ set copiarDados(t) {
946
+ this.modoControlado = t;
947
+ }
948
+ get ferramentas() {
949
+ return this._ferramentas;
950
+ }
951
+ set ferramentas(t) {
952
+ const e = Array.isArray(t) ? t : [];
953
+ this._ferramentas = this.modoControlado ? e.map((i) => {
954
+ var r;
955
+ return { ...i, filhos: (r = i.filhos) == null ? void 0 : r.map((a) => ({ ...a })) };
956
+ }) : e, R(q(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
957
+ }
958
+ get valor() {
959
+ return this._ativo;
960
+ }
961
+ set valor(t) {
962
+ this.ativar(t);
963
+ }
964
+ get value() {
965
+ return this.valor;
966
+ }
967
+ set value(t) {
968
+ this.valor = t;
969
+ }
970
+ get orientacao() {
971
+ return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
972
+ }
973
+ set orientacao(t) {
974
+ this.setAttribute("orientacao", t);
975
+ }
976
+ get colunas() {
977
+ return this.getAttribute("colunas") === "2" ? 2 : 1;
978
+ }
979
+ set colunas(t) {
980
+ this.setAttribute("colunas", String(t));
981
+ }
982
+ get tamanho() {
983
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
984
+ return t === "sm" || t === "lg" ? t : "md";
985
+ }
986
+ set tamanho(t) {
987
+ this.setAttribute("tamanho", t);
988
+ }
989
+ /**
990
+ * Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
991
+ * `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
992
+ */
993
+ ativar(t, e = !0) {
994
+ if (!t) {
995
+ this.limpar(e);
996
+ return;
997
+ }
998
+ const i = v(this._ferramentas, t);
999
+ if (!i) {
1000
+ this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
1001
+ return;
1002
+ }
1003
+ if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
1004
+ console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
1005
+ return;
1006
+ }
1007
+ this._pendente = "";
1008
+ const r = this._ativo;
1009
+ this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
1010
+ }
1011
+ /** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
1012
+ limpar(t = !0) {
1013
+ const e = this._ativo;
1014
+ !e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
1015
+ }
1016
+ atualizarItem(t, e) {
1017
+ var s;
1018
+ const i = v(this._ferramentas, t);
1019
+ if (!i) {
1020
+ console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
1021
+ return;
1022
+ }
1023
+ Object.assign(i, e);
1024
+ const r = Object.keys(e).every((l) => l === "ativo" || l === "disabled"), a = this._ferramentas.find((l) => {
1025
+ var b;
1026
+ return (b = l.filhos) == null ? void 0 : b.some((o) => o.id === t);
1027
+ });
1028
+ if (r && !(a && "disabled" in e)) {
1029
+ const l = this.botoes().find((b) => b.dataset.id === t || b.dataset.grupo === t);
1030
+ if (l) {
1031
+ A(l, this.itemParaBotao(a ?? i)), W(this.botoes());
1032
+ return;
1033
+ }
1034
+ if (a || (s = i.filhos) != null && s.length) return;
1035
+ }
1036
+ this.renderizar();
1037
+ }
1038
+ /* ---------- Estado interno ---------- */
1039
+ refletirValor(t) {
1040
+ const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
1041
+ this.getAttribute(e) !== t && this.setAttribute(e, t);
1042
+ }
1043
+ aplicarPendente() {
1044
+ if (!this._pendente) return;
1045
+ const t = v(this._ferramentas, this._pendente);
1046
+ t && !t.disabled && (t.tipo ?? "ferramenta") === "ferramenta" ? (this.definirAtivoInterno(this._pendente), this._pendente = "") : this._ferramentas.length && (console.warn(`[ui-paleta-ferramentas] valor="${this._pendente}" não é uma ferramenta ativável em "ferramentas".`), this._pendente = "");
1047
+ }
1048
+ definirAtivoInterno(t) {
1049
+ this._ativo = t;
1050
+ const e = this._ferramentas.find((i) => {
1051
+ var r;
1052
+ return (r = i.filhos) == null ? void 0 : r.some((a) => a.id === t);
1053
+ });
1054
+ e && this.visiveis.set(e.id, t);
1055
+ }
1056
+ emitirMudanca(t, e, i) {
1057
+ const r = { valor: t, item: e, anterior: i };
1058
+ this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
1059
+ }
1060
+ /** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
1061
+ itemExibido(t) {
1062
+ var a;
1063
+ if (!((a = t.filhos) != null && a.length)) return t;
1064
+ const e = (s) => s.tipo !== "separador" && !s.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((s) => s.id === i);
1065
+ return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((s) => s.tipo !== "separador") ?? t.filhos[0];
1066
+ }
1067
+ itemParaBotao(t) {
1068
+ const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
1069
+ return {
1070
+ ...e,
1071
+ tipo: i,
1072
+ ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
1073
+ filhos: t.filhos
1074
+ };
1075
+ }
1076
+ todasFerramentas() {
1077
+ return this._ferramentas.flatMap((t) => {
1078
+ var e;
1079
+ return (e = t.filhos) != null && e.length ? t.filhos : [t];
1080
+ }).filter((t) => t.tipo !== "separador");
1081
+ }
1082
+ /* ---------- Renderização ---------- */
1083
+ renderizar() {
1084
+ var b;
1085
+ const t = (b = this.shadowRoot) == null ? void 0 : b.activeElement, e = t && t.classList.contains("ui-ferr-btn") ? { id: t.dataset.id ?? "", grupo: t.dataset.grupo ?? "" } : null;
1086
+ this.fecharMenu();
1087
+ const i = this.orientacao, r = this.tamanho, a = this.colunas;
1088
+ this.rootElement.className = `ui-paleta ui-paleta--${i} ui-paleta--${r}`, a === 2 && i === "vertical" && this.rootElement.classList.add("ui-paleta--cols-2"), this.rootElement.setAttribute("aria-orientation", i), this.rootElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.rootElement.innerHTML = "";
1089
+ const s = bt[r] ?? 18;
1090
+ this._ferramentas.forEach((o) => {
1091
+ var m;
1092
+ if (o.tipo === "separador") {
1093
+ const g = document.createElement("div");
1094
+ g.className = "ui-paleta__sep", g.setAttribute("role", "separator"), this.rootElement.appendChild(g);
1095
+ return;
1096
+ }
1097
+ const d = this.itemExibido(o), p = F(this.itemParaBotao(o), "paleta", s);
1098
+ p.dataset.id = d.id, (m = o.filhos) != null && m.length && (p.dataset.grupo = o.id), this.rootElement.appendChild(p);
1099
+ }), j(this.botoes());
1100
+ const l = this.botoes().find((o) => o.dataset.id === this._ativo && !o.disabled);
1101
+ if (l && (this.botoes().forEach((o) => o.tabIndex = -1), l.tabIndex = 0), e) {
1102
+ const o = this.botoes().find((d) => e.grupo ? d.dataset.grupo === e.grupo : d.dataset.id === e.id);
1103
+ o && !o.disabled && o.focus();
1104
+ }
1105
+ }
1106
+ botoes() {
1107
+ return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
1108
+ }
1109
+ /** Reflete no botão o estado atual do item (sem recriar o DOM). */
1110
+ atualizarBotaoDe(t, e) {
1111
+ const i = this.botoes().find((r) => r.dataset.id === t.id);
1112
+ i && A(i, this.itemParaBotao(e ?? t));
1113
+ }
1114
+ /* ---------- Interação ---------- */
1115
+ acionar(t, e) {
1116
+ if (t.disabled) return;
1117
+ const i = t.tipo ?? "ferramenta", r = this._ativo, a = t.ativo;
1118
+ i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
1119
+ new CustomEvent("ui-ferramenta", {
1120
+ detail: {
1121
+ id: t.id,
1122
+ item: t,
1123
+ pai: e,
1124
+ ativo: i === "ferramenta" ? !0 : t.ativo,
1125
+ origem: "paleta"
1126
+ },
1127
+ bubbles: !0,
1128
+ composed: !0,
1129
+ cancelable: !0
1130
+ })
1131
+ ) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = a, this.atualizarBotaoDe(t, e)));
1132
+ }
1133
+ abrirFlyout(t, e) {
1134
+ var a;
1135
+ const i = t.dataset.grupo ? v(this._ferramentas, t.dataset.grupo) : void 0;
1136
+ if (!((a = i == null ? void 0 : i.filhos) != null && a.length)) return;
1137
+ this.fecharMenu();
1138
+ const r = i.filhos.map((s) => ({
1139
+ ...s,
1140
+ ativo: (s.tipo ?? "ferramenta") === "ferramenta" ? s.id === this._ativo : s.ativo
1141
+ }));
1142
+ t.setAttribute("aria-expanded", "true"), this.menu = z(
1143
+ this.shadowRoot,
1144
+ t,
1145
+ r,
1146
+ (s) => {
1147
+ var b;
1148
+ const l = v(i.filhos, s.id);
1149
+ l && (this.acionar(l, i), (b = this.botoes().find((o) => o.dataset.grupo === i.id)) == null || b.focus());
1150
+ },
1151
+ {
1152
+ lado: this.getAttribute("orientacao") === "horizontal" ? "baixo" : "direita",
1153
+ focar: e,
1154
+ tipoPadrao: "ferramenta",
1155
+ onFechar: () => {
1156
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
1157
+ }
1158
+ }
1159
+ );
1160
+ }
1161
+ fecharMenu() {
1162
+ var t;
1163
+ (t = this.menu) == null || t.fechar(), this.menu = null;
1164
+ }
1165
+ }
1166
+ D("ui-paleta-ferramentas", pt);
1167
+ export {
1168
+ et as U,
1169
+ pt as a,
1170
+ lt as b
1171
+ };