@thibezer/ui-components-kit 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +2 -2
  3. package/dist/acessibilidade-CSzX-DkG.cjs +1 -0
  4. package/dist/acessibilidade-CUlSXc2X.js +38 -0
  5. package/dist/camadas.cjs +94 -94
  6. package/dist/camadas.js +1218 -1124
  7. package/dist/campo-texto.cjs +1 -1
  8. package/dist/campo-texto.js +1 -1
  9. package/dist/canvas.cjs +66 -65
  10. package/dist/canvas.js +3769 -3389
  11. package/dist/card.cjs +1 -1
  12. package/dist/card.js +1 -1
  13. package/dist/components/ui-alerta/ui-toast.d.ts +4 -15
  14. package/dist/components/ui-avatar/ui-avatar.d.ts +11 -0
  15. package/dist/components/ui-badge/ui-badge.d.ts +2 -0
  16. package/dist/components/ui-barra-ferramentas/paleta-atalhos.d.ts +16 -0
  17. package/dist/components/ui-barra-ferramentas/paleta-pressao-longa.d.ts +24 -0
  18. package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +14 -0
  19. package/dist/components/ui-barra-ferramentas/ribbon-teclado.d.ts +17 -0
  20. package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +1 -7
  21. package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +0 -1
  22. package/dist/components/ui-camadas/camadas-arraste-controles.d.ts +2 -0
  23. package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +4 -11
  24. package/dist/components/ui-camadas/camadas-colecao.d.ts +27 -0
  25. package/dist/components/ui-camadas/camadas-drag-drop.d.ts +13 -1
  26. package/dist/components/ui-camadas/camadas-drop-ops.d.ts +31 -0
  27. package/dist/components/ui-camadas/camadas-hierarquia.d.ts +10 -0
  28. package/dist/components/ui-camadas/camadas-lembranca.d.ts +34 -0
  29. package/dist/components/ui-camadas/camadas-render.d.ts +14 -0
  30. package/dist/components/ui-camadas/camadas-renomear.d.ts +12 -0
  31. package/dist/components/ui-camadas/camadas-selecao-api.d.ts +17 -0
  32. package/dist/components/ui-camadas/camadas-thumb.d.ts +1 -0
  33. package/dist/components/ui-camadas/ui-camadas.d.ts +3 -5
  34. package/dist/components/ui-canvas-cad/cad-acessibilidade.d.ts +15 -0
  35. package/dist/components/ui-canvas-cad/cad-atributos-sync.d.ts +2 -1
  36. package/dist/components/ui-canvas-cad/cad-broadcast.d.ts +1 -1
  37. package/dist/components/ui-canvas-cad/cad-evento-coordenadas.d.ts +22 -0
  38. package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +3 -8
  39. package/dist/components/ui-canvas-cad/cad-feicoes-camera.d.ts +26 -0
  40. package/dist/components/ui-canvas-cad/cad-feicoes-consulta.d.ts +21 -0
  41. package/dist/components/ui-canvas-cad/cad-feicoes-dados.d.ts +39 -0
  42. package/dist/components/ui-canvas-cad/cad-feicoes-desenho.d.ts +68 -0
  43. package/dist/components/ui-canvas-cad/cad-feicoes-edicao.d.ts +37 -0
  44. package/dist/components/ui-canvas-cad/cad-feicoes-operacoes.d.ts +48 -0
  45. package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +24 -0
  46. package/dist/components/ui-canvas-cad/cad-feicoes-selecao-regiao.d.ts +22 -0
  47. package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +53 -0
  48. package/dist/components/ui-canvas-cad/cad-feicoes-versoes.d.ts +33 -0
  49. package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +26 -106
  50. package/dist/components/ui-canvas-cad/cad-inicializador.d.ts +3 -1
  51. package/dist/components/ui-canvas-cad/cad-leaflet-adaptador.d.ts +5 -0
  52. package/dist/components/ui-canvas-cad/cad-selecao-pontos.d.ts +5 -0
  53. package/dist/components/ui-canvas-cad/tipos.d.ts +37 -0
  54. package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +4 -1
  55. package/dist/components/ui-checkbox/ui-checkbox.d.ts +4 -1
  56. package/dist/components/ui-cores/tipos.d.ts +2 -0
  57. package/dist/components/ui-cores/ui-controle-cores.d.ts +8 -3
  58. package/dist/components/ui-cores/ui-seletor-cor.d.ts +3 -1
  59. package/dist/components/ui-mapa/mapa-atributos.d.ts +14 -0
  60. package/dist/components/ui-mapa/mapa-basemaps.d.ts +7 -0
  61. package/dist/components/ui-mapa/mapa-icones.d.ts +4 -0
  62. package/dist/components/ui-mapa/mapa-leaflet.d.ts +5 -0
  63. package/dist/components/ui-mapa/mapa-vinculo-pai.d.ts +22 -0
  64. package/dist/components/ui-mapa/tipos.d.ts +13 -0
  65. package/dist/components/ui-mapa/ui-mapa-linha.d.ts +12 -5
  66. package/dist/components/ui-mapa/ui-mapa-marcador.d.ts +15 -6
  67. package/dist/components/ui-mapa/ui-mapa.d.ts +14 -1
  68. package/dist/components/ui-modal/modal-acessibilidade.d.ts +5 -5
  69. package/dist/components/ui-modal/modal-foco.d.ts +28 -0
  70. package/dist/components/ui-modal/ui-modal.d.ts +1 -11
  71. package/dist/components/ui-radio/radio-grupo-registry.d.ts +10 -0
  72. package/dist/components/ui-radio/ui-radio.d.ts +9 -2
  73. package/dist/components/ui-skeleton/ui-skeleton.d.ts +9 -0
  74. package/dist/components/ui-switch/ui-switch.d.ts +3 -1
  75. package/dist/components/ui-tabela/tabela-estados.d.ts +16 -0
  76. package/dist/components/ui-tabela/tabela-rolagem.d.ts +44 -0
  77. package/dist/components/ui-tabela/tabela-teclado.d.ts +16 -0
  78. package/dist/components/ui-tabela/ui-tabela.d.ts +1 -19
  79. package/dist/components/ui-tooltip/tooltip-popover.d.ts +7 -0
  80. package/dist/components/ui-tooltip/tooltip-posicionamento.d.ts +29 -0
  81. package/dist/components/ui-tooltip/ui-tooltip.d.ts +24 -1
  82. package/dist/core/opcoes.d.ts +9 -0
  83. package/dist/core/rotulo-controle.d.ts +13 -0
  84. package/dist/core/tipos-toast.d.ts +16 -0
  85. package/dist/core/ui-bus.d.ts +9 -1
  86. package/dist/core.cjs +1 -1
  87. package/dist/core.js +12 -11
  88. package/dist/cores.cjs +1 -1
  89. package/dist/cores.js +1 -1
  90. package/dist/custom-elements.json +19799 -14940
  91. package/dist/data.cjs +1 -1
  92. package/dist/data.js +2 -2
  93. package/dist/feedback.cjs +1 -1
  94. package/dist/feedback.js +21 -21
  95. package/dist/form-validacao-BlQFxUVj.js +104 -0
  96. package/dist/form-validacao-DIeyQVH5.cjs +1 -0
  97. package/dist/forms.cjs +1 -1
  98. package/dist/forms.js +2 -2
  99. package/dist/index.cjs +1 -1
  100. package/dist/index.js +46 -46
  101. package/dist/mapa.cjs +11 -16
  102. package/dist/mapa.js +242 -170
  103. package/dist/modal.cjs +1 -1
  104. package/dist/modal.js +1 -1
  105. package/dist/opcoes-CJYLi6kd.js +12 -0
  106. package/dist/opcoes-CkyDxBuQ.cjs +1 -0
  107. package/dist/register.cjs +1 -1
  108. package/dist/register.js +13 -14
  109. package/dist/tabela.cjs +1 -1
  110. package/dist/tabela.js +1 -1
  111. package/dist/tipos-elementos.d.ts +9 -3
  112. package/dist/tipos-vue.d.ts +9 -3
  113. package/dist/tools.cjs +1 -1
  114. package/dist/tools.js +1 -1
  115. package/dist/ui-badge-ChiiiO1r.js +197 -0
  116. package/dist/ui-badge-DUCxyAG6.cjs +28 -0
  117. package/dist/{zero-js-triggers-C_KrvFOQ.js → ui-bus-CUd99VJi.js} +36 -103
  118. package/dist/ui-bus-XqBLlTYQ.cjs +1 -0
  119. package/dist/ui-campo-texto-CHTfMO-H.cjs +16 -0
  120. package/dist/ui-campo-texto-gum_jDdI.js +380 -0
  121. package/dist/ui-card-BNYCQ7g-.js +119 -0
  122. package/dist/ui-card-BrjBL-yo.cjs +20 -0
  123. package/dist/ui-controle-cores-DgEza3wF.js +612 -0
  124. package/dist/ui-controle-cores-uY__TgwW.cjs +117 -0
  125. package/dist/ui-modal-BkYvNP0G.js +214 -0
  126. package/dist/ui-modal-CUNbpbZ1.cjs +18 -0
  127. package/dist/ui-paleta-ferramentas-Ksh6gMW3.js +890 -0
  128. package/dist/ui-paleta-ferramentas-bDLPbiGA.cjs +21 -0
  129. package/dist/ui-segmented-BOaGRQw4.cjs +19 -0
  130. package/dist/ui-segmented-kbO1BLVs.js +439 -0
  131. package/dist/ui-skeleton-B2Rgrv8o.js +648 -0
  132. package/dist/ui-skeleton-BilwGdOm.js +634 -0
  133. package/dist/ui-skeleton-DiOxTBZK.cjs +52 -0
  134. package/dist/ui-skeleton-SPYqku8P.cjs +52 -0
  135. package/dist/ui-skeleton-W9uwIceA.js +585 -0
  136. package/dist/ui-skeleton-gZrJipCC.cjs +52 -0
  137. package/dist/ui-switch-BX6U5Ykm.cjs +53 -0
  138. package/dist/ui-switch-DO5jR0hy.js +915 -0
  139. package/dist/ui-tabela-propriedades-D9Echt2X.js +2667 -0
  140. package/dist/ui-tabela-propriedades-DzZlyNZ_.cjs +141 -0
  141. package/dist/zero-js-triggers-CJT988bR.js +83 -0
  142. package/dist/zero-js-triggers-CgM9IIQB.cjs +1 -0
  143. package/package.json +10 -3
  144. package/dist/ui-botao-OGJV6Vfk.js +0 -165
  145. package/dist/ui-botao-psS1juof.cjs +0 -12
  146. package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
  147. package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
  148. package/dist/ui-skeleton-DI4_9WOX.js +0 -428
  149. package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
  150. package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
  151. package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
  152. package/dist/ui-toast-Bp_NlM5G.js +0 -156
  153. package/dist/ui-toast-DGTZKne5.cjs +0 -20
  154. package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
@@ -0,0 +1,890 @@
1
+ var V = Object.defineProperty;
2
+ var U = (a, o, t) => o in a ? V(a, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[o] = t;
3
+ var u = (a, o, t) => U(a, typeof o != "symbol" ? o + "" : o, t);
4
+ import { L as P } from "./listener-bag-DQgv7OON.js";
5
+ import { d as z, S as M } from "./ssr-safe-5cWfJP-s.js";
6
+ import { h as G } from "./svg-seguro-BsbNQqpd.js";
7
+ const K = ':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)}', $ = {
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 X extends M {
20
+ constructor() {
21
+ super();
22
+ u(this, "iconContainer");
23
+ u(this, "svgContainer");
24
+ u(this, "slotElement");
25
+ u(this, "handleSlotChange", () => {
26
+ this.syncState();
27
+ });
28
+ const t = this.attachShadow({ mode: "open" });
29
+ t.innerHTML = `
30
+ <style>${K}</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"), s = this.slotElement.assignedNodes().length > 0;
70
+ r && $[r] && !s ? (this.svgContainer.innerHTML = $[r], this.svgContainer.style.display = "inline-flex") : (this.svgContainer.innerHTML = "", this.svgContainer.style.display = "none");
71
+ }
72
+ }
73
+ z("ui-icone", X);
74
+ const Y = ':host{display:block;position:relative;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);color:var(--ui-cor-texto, #e1e1e6)}.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{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__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}}', R = '.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}}@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 B(a, o) {
76
+ if (!a) return null;
77
+ const t = document.createElement("ui-icone");
78
+ if (t.setAttribute("tamanho", String(o)), a.trimStart().startsWith("<")) {
79
+ const e = G(a);
80
+ if (!e) return null;
81
+ t.appendChild(e);
82
+ } else
83
+ t.setAttribute("nome", a);
84
+ return t;
85
+ }
86
+ const N = /* @__PURE__ */ new Set();
87
+ function I(a) {
88
+ return a.rotuloAcessivel ? a.rotuloAcessivel : a.rotulo ? a.rotulo : a.icone && !a.icone.trimStart().startsWith("<") ? a.icone : (N.has(a.id) || (N.add(a.id), console.warn(`[ui-barra-ferramentas] O item "${a.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), a.id);
89
+ }
90
+ function W(a) {
91
+ const o = I(a);
92
+ return a.atalho ? `${o} (${a.atalho})` : o;
93
+ }
94
+ function C(a, o) {
95
+ const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
96
+ a.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${o}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
97
+ }
98
+ function L(a, o = []) {
99
+ for (const t of a)
100
+ t.tipo !== "separador" && (o.push(t.id), t.filhos && L(t.filhos, o));
101
+ return o;
102
+ }
103
+ function A(a, o) {
104
+ a.disabled = !!o.disabled;
105
+ const t = o.tipo, e = t === "toggle" || t === "ferramenta";
106
+ e ? a.setAttribute("aria-pressed", String(!!o.ativo)) : a.removeAttribute("aria-pressed"), a.classList.toggle("ui-ferr-btn--ativo", e && !!o.ativo);
107
+ }
108
+ function j(a, o, t) {
109
+ var n;
110
+ const e = document.createElement("button");
111
+ e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${o}`, e.dataset.id = a.id, e.tabIndex = -1, e.setAttribute("aria-label", I(a)), a.atalho && e.setAttribute("aria-keyshortcuts", a.atalho), e.title = W(a);
112
+ const i = B(a.icone, t);
113
+ if (i) {
114
+ const l = document.createElement("span");
115
+ l.className = "ui-ferr-btn__icone", l.appendChild(i), e.appendChild(l);
116
+ }
117
+ const r = !!((n = a.filhos) != null && n.length), s = o !== "paleta" && !a.somenteIcone && !!a.rotulo;
118
+ if (o !== "paleta" && a.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), s) {
119
+ const l = document.createElement("span");
120
+ l.className = "ui-ferr-btn__rotulo", l.textContent = a.rotulo, e.appendChild(l);
121
+ }
122
+ if (r) {
123
+ if (o === "paleta")
124
+ e.classList.add("ui-ferr-btn--grupo");
125
+ else {
126
+ const l = document.createElement("span");
127
+ l.className = "ui-ferr-btn__caret", e.appendChild(l);
128
+ }
129
+ e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
130
+ }
131
+ return A(e, a), e;
132
+ }
133
+ function m(a, o) {
134
+ for (const t of a) {
135
+ if (t.id === o) return t;
136
+ if (t.filhos) {
137
+ const e = m(t.filhos, o);
138
+ if (e) return e;
139
+ }
140
+ }
141
+ }
142
+ function T(a) {
143
+ const o = a.filter((t) => !t.disabled);
144
+ a.forEach((t) => t.tabIndex = -1), o.length && (o[0].tabIndex = 0);
145
+ }
146
+ function H(a) {
147
+ const o = a.find((t) => t.tabIndex === 0 && !t.disabled);
148
+ o ? a.forEach((t) => {
149
+ t !== o && (t.tabIndex = -1);
150
+ }) : T(a);
151
+ }
152
+ function q(a, o) {
153
+ const t = a.find((e) => e === o || e.contains(o));
154
+ !t || t.disabled || a.forEach((e) => e.tabIndex = e === t ? 0 : -1);
155
+ }
156
+ function S(a, o, t, e) {
157
+ const i = o.filter((l) => !l.disabled), r = i.length, s = i.findIndex((l) => l === a.target);
158
+ if (r === 0 || s < 0) return !1;
159
+ let n = s;
160
+ if (t.includes(a.key)) n = (s - 1 + r) % r;
161
+ else if (e.includes(a.key)) n = (s + 1) % r;
162
+ else if (a.key === "Home") n = 0;
163
+ else if (a.key === "End") n = r - 1;
164
+ else return !1;
165
+ return a.preventDefault(), o.forEach((l) => l.tabIndex = -1), i[n].tabIndex = 0, i[n].focus(), !0;
166
+ }
167
+ let J = 0;
168
+ function O(a, o, t, e, i = {}) {
169
+ var D;
170
+ const r = i.lado ?? "baixo", s = new P(), n = document.createElement("div");
171
+ n.className = "ui-ferr-menu", n.setAttribute("role", "menu"), n.id = `ui-ferr-menu-${++J}`, n.setAttribute("aria-label", o.getAttribute("aria-label") || "Menu"), o.setAttribute("aria-controls", n.id);
172
+ const l = [];
173
+ let d = !1;
174
+ const h = () => {
175
+ var c;
176
+ d || (d = !0, o.removeAttribute("aria-controls"), s.cleanup(), n.remove(), (c = i.onFechar) == null || c.call(i));
177
+ };
178
+ t.forEach((c) => {
179
+ if (c.tipo === "separador") {
180
+ const g = document.createElement("div");
181
+ g.className = "ui-ferr-menu__sep", g.setAttribute("role", "separator"), n.appendChild(g);
182
+ return;
183
+ }
184
+ const b = document.createElement("button");
185
+ b.type = "button", b.className = "ui-ferr-menu__item";
186
+ const y = c.tipo ?? i.tipoPadrao ?? "botao";
187
+ y === "toggle" ? (b.setAttribute("role", "menuitemcheckbox"), b.setAttribute("aria-checked", String(!!c.ativo))) : y === "ferramenta" ? (b.setAttribute("role", "menuitemradio"), b.setAttribute("aria-checked", String(!!c.ativo))) : b.setAttribute("role", "menuitem"), b.dataset.id = c.id, b.disabled = !!c.disabled, c.atalho && b.setAttribute("aria-keyshortcuts", c.atalho), c.ativo && b.classList.add("ui-ferr-menu__item--ativo");
188
+ const x = document.createElement("span");
189
+ x.className = "ui-ferr-menu__icone";
190
+ const F = B(c.icone, 14);
191
+ F && x.appendChild(F), b.appendChild(x);
192
+ const k = document.createElement("span");
193
+ if (k.className = "ui-ferr-menu__rotulo", k.textContent = I(c), b.appendChild(k), c.atalho) {
194
+ const g = document.createElement("span");
195
+ g.className = "ui-ferr-menu__atalho", g.textContent = c.atalho, b.appendChild(g);
196
+ }
197
+ b.addEventListener("click", (g) => {
198
+ g.stopPropagation(), h(), o.focus(), e(c);
199
+ }), l.push(b), n.appendChild(b);
200
+ }), a.appendChild(n);
201
+ const p = o.getBoundingClientRect(), _ = getComputedStyle(o).direction === "rtl", f = n.getBoundingClientRect();
202
+ let v = r === "direita" ? p.top : p.bottom + 2, w = r === "direita" ? _ ? p.left - f.width - 4 : p.right + 4 : _ ? p.right - f.width : p.left;
203
+ f.width && w + f.width > window.innerWidth - 4 && (w = Math.max(4, window.innerWidth - f.width - 4)), w < 4 && (w = 4), f.height && v + f.height > window.innerHeight - 4 && (v = Math.max(4, window.innerHeight - f.height - 4)), n.style.top = `${v}px`, n.style.left = `${w}px`;
204
+ const E = () => l.filter((c) => !c.disabled);
205
+ return s.add(n, "keydown", (c) => {
206
+ const b = E(), y = b.findIndex((x) => x === c.target);
207
+ if (c.key === "Escape")
208
+ c.preventDefault(), c.stopPropagation(), h(), o.focus();
209
+ else if (c.key === "Tab")
210
+ h();
211
+ else if (b.length && (c.key === "ArrowDown" || c.key === "ArrowUp")) {
212
+ c.preventDefault();
213
+ const x = c.key === "ArrowDown" ? 1 : -1;
214
+ b[(y + x + b.length) % b.length].focus();
215
+ } else b.length && c.key === "Home" ? (c.preventDefault(), b[0].focus()) : b.length && c.key === "End" && (c.preventDefault(), b[b.length - 1].focus());
216
+ }), s.add(document, "pointerdown", (c) => {
217
+ const b = c.composedPath();
218
+ !b.includes(n) && !b.includes(o) && h();
219
+ }, !0), s.add(window, "resize", h), s.add(window, "scroll", (c) => {
220
+ c.target instanceof Node && n.contains(c.target) || h();
221
+ }, !0), s.add(window, "blur", h), i.focar && ((D = E()[0]) == null || D.focus()), { elemento: n, ancora: o, fechar: h, focarPrimeiro: () => {
222
+ var c;
223
+ return (c = E()[0]) == null ? void 0 : c.focus();
224
+ } };
225
+ }
226
+ const Q = 3;
227
+ function Z({ aba: a, ativa: o, idBotao: t, idPainel: e }) {
228
+ const i = document.createElement("button");
229
+ return i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = a.id, i.id = t, o && i.setAttribute("aria-controls", e), i.textContent = a.rotulo, i.tabIndex = o ? 0 : -1, i.setAttribute("aria-selected", String(o)), i.classList.toggle("ui-ribbon__aba--ativa", o), i.classList.toggle("ui-ribbon__aba--contextual", !!a.contextual), i;
230
+ }
231
+ function tt(a, o) {
232
+ const t = document.createElement("div");
233
+ t.className = "ui-ribbon__grupo", t.setAttribute("role", "group"), t.setAttribute("aria-label", a.rotulo), t.dataset.id = a.id;
234
+ const e = document.createElement("div");
235
+ e.className = "ui-ribbon__grupo-itens";
236
+ let i = null, r = 0;
237
+ const s = () => {
238
+ i && e.appendChild(i), i = null, r = 0;
239
+ };
240
+ a.itens.forEach((l) => {
241
+ if (l.tipo === "separador") {
242
+ s();
243
+ const d = document.createElement("div");
244
+ d.className = "ui-ribbon__separador", d.setAttribute("role", "separator"), e.appendChild(d);
245
+ } else l.tamanho === "grande" ? (s(), e.appendChild(o(l, "grande", 24))) : (i || (i = document.createElement("div"), i.className = "ui-ribbon__coluna"), i.appendChild(o(l, "pequeno", 16)), ++r === Q && s());
246
+ }), s();
247
+ const n = document.createElement("div");
248
+ return n.className = "ui-ribbon__grupo-rotulo", n.textContent = a.rotulo, t.appendChild(e), t.appendChild(n), t;
249
+ }
250
+ function et(a, o, t, e) {
251
+ if (o < 0 || t <= 0) return null;
252
+ const [i, r] = e ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
253
+ return a === i ? { tipo: "ir-para", indice: (o + 1) % t } : a === r ? { tipo: "ir-para", indice: (o - 1 + t) % t } : a === "Home" ? { tipo: "ir-para", indice: 0 } : a === "End" ? { tipo: "ir-para", indice: t - 1 } : a === "ArrowDown" ? { tipo: "descer" } : null;
254
+ }
255
+ let it = 0;
256
+ class rt extends M {
257
+ constructor() {
258
+ super();
259
+ u(this, "rootElement");
260
+ u(this, "abasElement");
261
+ u(this, "gruposElement");
262
+ u(this, "painelElement");
263
+ u(this, "fixarElement");
264
+ u(this, "uid", `ui-ribbon-${++it}`);
265
+ u(this, "_abaPendente", "");
266
+ u(this, "_pronto", !1);
267
+ u(this, "_abas", []);
268
+ u(this, "_abaAtiva", "");
269
+ u(this, "menu", null);
270
+ u(this, "listeners", new P());
271
+ u(this, "handleFocusInGrupos", (t) => q(this.botoesPainel(), t.target));
272
+ /* ---------- Interação ---------- */
273
+ u(this, "handleClickAbas", (t) => {
274
+ const e = t.target.closest(".ui-ribbon__aba");
275
+ e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
276
+ });
277
+ u(this, "handleClickFixar", () => {
278
+ this.recolhido = !this.recolhido;
279
+ });
280
+ u(this, "handleDblClickAbas", (t) => {
281
+ t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
282
+ });
283
+ u(this, "handleKeyDownAbas", (t) => {
284
+ var s, n;
285
+ const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = et(t.key, e.findIndex((l) => l === t.target), e.length, this.rtl);
286
+ if (!i) return;
287
+ if (t.preventDefault(), i.tipo === "descer") {
288
+ this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (s = this.botoesPainel().find((l) => !l.disabled)) == null || s.focus();
289
+ return;
290
+ }
291
+ const r = e[i.indice].dataset.id;
292
+ r && this.selecionarAba(r), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(r ?? "")}"]`)) == null || n.focus();
293
+ });
294
+ u(this, "handleClickGrupos", (t) => {
295
+ const e = t.target.closest(".ui-ferr-btn");
296
+ e != null && e.dataset.id && this.acionar(e, t.detail === 0);
297
+ });
298
+ u(this, "handleKeyDownGrupos", (t) => {
299
+ var r;
300
+ const e = this.botoesPainel();
301
+ if (this.rtl ? S(t, e, ["ArrowRight"], ["ArrowLeft"]) : S(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
302
+ const i = t.target instanceof HTMLButtonElement ? t.target : null;
303
+ (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));
304
+ });
305
+ u(this, "handleEscape", (t) => {
306
+ t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
307
+ });
308
+ u(this, "handlePointerDownFora", (t) => {
309
+ !this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
310
+ });
311
+ const t = this.attachShadow({ mode: "open" });
312
+ t.innerHTML = `
313
+ <style>${R}${Y}</style>
314
+ <div class="ui-ribbon">
315
+ <div class="ui-ribbon__cabecalho">
316
+ <div class="ui-ribbon__abas" role="tablist"></div>
317
+ <button type="button" class="ui-ribbon__fixar"></button>
318
+ </div>
319
+ <div class="ui-ribbon__painel" role="tabpanel">
320
+ <div class="ui-ribbon__grupos" role="toolbar" aria-label="Ferramentas"></div>
321
+ </div>
322
+ </div>
323
+ `, 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`;
324
+ }
325
+ static get observedAttributes() {
326
+ return ["aba-ativa", "recolhido", "compacto", "aria-label", "rotulo-abas", "rotulo-fixar", "rotulo-expandir"];
327
+ }
328
+ connectedCallback() {
329
+ this.listeners.cleanup(), 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);
330
+ const t = this.getAttribute("aba-ativa");
331
+ t && !this._abaAtiva && (this._abaPendente = t), this.aplicarRotulos(), this.renderizar(), this._pronto = !0;
332
+ }
333
+ disconnectedCallback() {
334
+ this._pronto = !1, this.fecharMenu(), this.listeners.cleanup();
335
+ }
336
+ attributeChangedCallback(t, e, i) {
337
+ if (e !== i)
338
+ if (t === "aba-ativa") {
339
+ if (!i || i === this._abaAtiva) return;
340
+ this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
341
+ } else t === "recolhido" ? (this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
342
+ new CustomEvent("ui-recolhido-change", {
343
+ detail: { recolhido: i !== null },
344
+ bubbles: !0,
345
+ composed: !0
346
+ })
347
+ )) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
348
+ }
349
+ aplicarRotulos() {
350
+ this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
351
+ 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";
352
+ 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);
353
+ }
354
+ /* ---------- API pública ---------- */
355
+ get abas() {
356
+ return this._abas;
357
+ }
358
+ set abas(t) {
359
+ this._abas = Array.isArray(t) ? t : [], C(this._abas.map((e) => e.id), "<ui-ribbon> abas"), C(
360
+ this._abas.flatMap((e) => e.grupos.flatMap((i) => L(i.itens))),
361
+ "<ui-ribbon> itens"
362
+ ), this.renderizar();
363
+ }
364
+ get abaAtiva() {
365
+ return this._abaAtiva;
366
+ }
367
+ set abaAtiva(t) {
368
+ this.selecionarAba(t);
369
+ }
370
+ get recolhido() {
371
+ return this.hasAttribute("recolhido");
372
+ }
373
+ set recolhido(t) {
374
+ t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
375
+ }
376
+ get compacto() {
377
+ return this.hasAttribute("compacto");
378
+ }
379
+ set compacto(t) {
380
+ t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
381
+ }
382
+ selecionarAba(t, e = !0) {
383
+ const i = this._abas.find((r) => r.id === t && !r.oculta);
384
+ if (!i) {
385
+ t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
386
+ return;
387
+ }
388
+ i.id !== this._abaAtiva && (this._abaPendente = "", this.fecharMenu(), this._abaAtiva = i.id, this.getAttribute("aba-ativa") !== i.id && this.setAttribute("aba-ativa", i.id), this.renderizar(), e && this.dispatchEvent(
389
+ new CustomEvent("ui-aba-change", {
390
+ detail: { id: i.id, aba: i },
391
+ bubbles: !0,
392
+ composed: !0
393
+ })
394
+ ));
395
+ }
396
+ definirAbaVisivel(t, e) {
397
+ const i = this._abas.find((n) => n.id === t);
398
+ if (!i) return;
399
+ const r = this._abaAtiva;
400
+ i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
401
+ const s = this._abas.find((n) => n.id === this._abaAtiva);
402
+ !e && r === t && s && this.dispatchEvent(
403
+ new CustomEvent("ui-aba-change", { detail: { id: s.id, aba: s }, bubbles: !0, composed: !0 })
404
+ );
405
+ }
406
+ /** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
407
+ atualizarItem(t, e) {
408
+ const i = this._abas.flatMap((d) => d.grupos.flatMap((h) => h.itens)), r = m(i, t);
409
+ if (!r) {
410
+ console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
411
+ return;
412
+ }
413
+ Object.assign(r, e);
414
+ const s = this._abas.find((d) => d.id === this._abaAtiva);
415
+ if (!s || !m(s.grupos.flatMap((d) => d.itens), t)) return;
416
+ const n = Object.keys(e).every((d) => d === "ativo" || d === "disabled"), l = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
417
+ n ? l && (A(l, this.efetivo(r)), H(this.botoesPainel())) : this.comFoco(() => this.renderizarPainel());
418
+ }
419
+ efetivo(t) {
420
+ var e;
421
+ return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
422
+ }
423
+ /* ---------- Foco preservado em re-renderizações ---------- */
424
+ capturarFoco() {
425
+ var e, i;
426
+ const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
427
+ 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;
428
+ }
429
+ comFoco(t) {
430
+ const e = this.capturarFoco();
431
+ if (t(), !e) return;
432
+ const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
433
+ i && !i.disabled && i.focus();
434
+ }
435
+ /* ---------- Renderização ---------- */
436
+ abasVisiveis() {
437
+ return this._abas.filter((t) => !t.oculta);
438
+ }
439
+ renderizar() {
440
+ var e;
441
+ const t = this.abasVisiveis();
442
+ 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(() => {
443
+ this.renderizarAbas(), this.renderizarPainel();
444
+ });
445
+ }
446
+ renderizarAbas() {
447
+ this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
448
+ this.abasElement.appendChild(Z({
449
+ aba: t,
450
+ ativa: t.id === this._abaAtiva,
451
+ idBotao: this.idAba(t.id),
452
+ idPainel: this.painelElement.id
453
+ }));
454
+ });
455
+ }
456
+ idAba(t) {
457
+ return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
458
+ }
459
+ renderizarPainel() {
460
+ this.fecharMenu(), this.gruposElement.innerHTML = "";
461
+ const t = this._abas.find((e) => e.id === this._abaAtiva);
462
+ if (!t) {
463
+ this.painelElement.removeAttribute("aria-labelledby");
464
+ return;
465
+ }
466
+ this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(tt(e, (i, r, s) => this.criarBotao(i, r, s)))), T(this.botoesPainel());
467
+ }
468
+ criarBotao(t, e, i) {
469
+ return j(this.efetivo(t), e, i);
470
+ }
471
+ botoesPainel() {
472
+ return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
473
+ }
474
+ get rtl() {
475
+ return getComputedStyle(this).direction === "rtl";
476
+ }
477
+ acionar(t, e) {
478
+ var s;
479
+ const i = this._abas.find((n) => n.id === this._abaAtiva), r = i && m(i.grupos.flatMap((n) => n.itens), t.dataset.id);
480
+ if (!(!r || r.disabled)) {
481
+ if ((s = r.filhos) != null && s.length) {
482
+ this.alternarMenu(t, r, e);
483
+ return;
484
+ }
485
+ if (r.tipo === "toggle") {
486
+ const n = r.ativo;
487
+ r.ativo = !n, A(t, r), this.emitir(r) || (r.ativo = n, A(t, r));
488
+ } else
489
+ this.emitir(r);
490
+ this.rootElement.classList.remove("ui-ribbon--aberto");
491
+ }
492
+ }
493
+ alternarMenu(t, e, i) {
494
+ var s;
495
+ const r = ((s = this.menu) == null ? void 0 : s.ancora) === t;
496
+ this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = O(
497
+ this.shadowRoot,
498
+ t,
499
+ e.filhos,
500
+ (n) => {
501
+ if (n.tipo === "toggle") {
502
+ const l = n.ativo;
503
+ n.ativo = !l, this.emitir(n, e) || (n.ativo = l);
504
+ } else
505
+ this.emitir(n, e);
506
+ this.rootElement.classList.remove("ui-ribbon--aberto");
507
+ },
508
+ {
509
+ lado: "baixo",
510
+ focar: i,
511
+ onFechar: () => {
512
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
513
+ }
514
+ }
515
+ ));
516
+ }
517
+ fecharMenu() {
518
+ var t;
519
+ (t = this.menu) == null || t.fechar(), this.menu = null;
520
+ }
521
+ /** Retorna false se o consumidor cancelou o evento (preventDefault). */
522
+ emitir(t, e) {
523
+ return this.dispatchEvent(
524
+ new CustomEvent("ui-ferramenta", {
525
+ detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
526
+ bubbles: !0,
527
+ composed: !0,
528
+ cancelable: !0
529
+ })
530
+ );
531
+ }
532
+ }
533
+ z("ui-ribbon", rt);
534
+ const at = ':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}}', ot = 380, nt = 8, st = 50;
535
+ class lt {
536
+ constructor() {
537
+ u(this, "timer");
538
+ u(this, "timerSupressao");
539
+ u(this, "inicio", null);
540
+ u(this, "suprimir", !1);
541
+ }
542
+ /** Começa a contar; `aoDisparar` roda se o ponteiro ficar parado até `TEMPO_PRESSAO_LONGA_MS`. */
543
+ iniciar(o, t, e) {
544
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.inicio = { x: o, y: t }, this.timer = window.setTimeout(() => {
545
+ this.suprimir = !0, e();
546
+ }, ot);
547
+ }
548
+ /** Arrastar/rolar com o dedo cancela o clique longo. */
549
+ mover(o, t) {
550
+ this.timer === void 0 || !this.inicio || Math.hypot(o - this.inicio.x, t - this.inicio.y) > nt && this.cancelar();
551
+ }
552
+ /** Fim do gesto: cancela a contagem e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
553
+ fim() {
554
+ this.cancelar(), this.suprimir && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
555
+ this.suprimir = !1;
556
+ }, st));
557
+ }
558
+ cancelar() {
559
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0), this.inicio = null;
560
+ }
561
+ /** `true` (uma única vez) se o próximo `click` deve ser ignorado por ser o resíduo de uma pressão longa. */
562
+ consumirSupressao() {
563
+ return this.suprimir ? (this.suprimir = !1, window.clearTimeout(this.timerSupressao), !0) : !1;
564
+ }
565
+ destruir() {
566
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.suprimir = !1;
567
+ }
568
+ }
569
+ const ut = /* @__PURE__ */ new Set(["textbox", "searchbox", "combobox", "spinbutton"]);
570
+ function ct(a) {
571
+ const o = a[0];
572
+ return o && (/^(INPUT|TEXTAREA|SELECT)$/.test(o.tagName) || o.isContentEditable) ? !0 : a.some((t) => {
573
+ var r, s;
574
+ const e = t, i = (r = e.getAttribute) == null ? void 0 : r.call(e, "role");
575
+ return ((s = e.getAttribute) == null ? void 0 : s.call(e, "aria-modal")) === "true" || !!i && ut.has(i);
576
+ });
577
+ }
578
+ function dt(a, o, t, e) {
579
+ const i = (a || "").toUpperCase();
580
+ if (i.length !== 1) return null;
581
+ const r = o.filter((l) => {
582
+ var d;
583
+ return !l.disabled && ((d = l.atalho) == null ? void 0 : d.toUpperCase()) === i;
584
+ });
585
+ if (r.length === 0) return null;
586
+ let s = r[0];
587
+ if (r.length > 1) {
588
+ const l = r.findIndex((d) => d.id === e);
589
+ s = r[(l + 1) % r.length];
590
+ }
591
+ const n = t.find((l) => {
592
+ var d;
593
+ return (d = l.filhos) == null ? void 0 : d.some((h) => h.id === s.id);
594
+ });
595
+ return { alvo: s, pai: n };
596
+ }
597
+ const ht = { sm: 16, md: 18, lg: 22 };
598
+ class bt extends M {
599
+ constructor() {
600
+ super();
601
+ u(this, "rootElement");
602
+ u(this, "_ferramentas", []);
603
+ u(this, "_ativo", "");
604
+ u(this, "_pendente", "");
605
+ u(this, "visiveis", /* @__PURE__ */ new Map());
606
+ // id do grupo → id do filho exibido
607
+ u(this, "menu", null);
608
+ u(this, "pressao", new lt());
609
+ u(this, "listeners", new P());
610
+ u(this, "handleClick", (t) => {
611
+ if (this.pressao.consumirSupressao()) return;
612
+ const e = t.target.closest(".ui-ferr-btn"), i = e != null && e.dataset.id ? m(this._ferramentas, e.dataset.id) : void 0;
613
+ if (!e || !i) return;
614
+ const r = e.dataset.grupo ? m(this._ferramentas, e.dataset.grupo) : void 0;
615
+ this.acionar(i, r);
616
+ });
617
+ u(this, "handleFocusIn", (t) => q(this.botoes(), t.target));
618
+ u(this, "handlePointerDown", (t) => {
619
+ const e = t;
620
+ if (e.pointerType === "mouse" && e.button !== 0) return;
621
+ const i = t.target.closest(".ui-ferr-btn--grupo");
622
+ !i || i.disabled || this.pressao.iniciar(e.clientX ?? 0, e.clientY ?? 0, () => this.abrirFlyout(i, !1));
623
+ });
624
+ u(this, "handlePointerMove", (t) => {
625
+ const e = t;
626
+ this.pressao.mover(e.clientX ?? 0, e.clientY ?? 0);
627
+ });
628
+ u(this, "handlePointerFim", () => this.pressao.fim());
629
+ u(this, "handleContextMenu", (t) => {
630
+ const e = t.target.closest(".ui-ferr-btn--grupo");
631
+ e && (t.preventDefault(), this.pressao.cancelar(), this.abrirFlyout(e, !1));
632
+ });
633
+ u(this, "handleKeyDown", (t) => {
634
+ var d;
635
+ const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], s = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
636
+ if (S(t, this.botoes(), r, s)) return;
637
+ const n = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", l = t.target instanceof HTMLButtonElement ? t.target : null;
638
+ l != null && l.dataset.grupo && t.key === n && (t.preventDefault(), ((d = this.menu) == null ? void 0 : d.ancora) === l ? this.menu.focarPrimeiro() : this.abrirFlyout(l, !0));
639
+ });
640
+ u(this, "handleAtalho", (t) => {
641
+ if (!this.hasAttribute("atalhos") || t.ctrlKey || t.metaKey || t.altKey || t.defaultPrevented || ct(t.composedPath())) return;
642
+ const e = dt(t.key, this.todasFerramentas(), this._ferramentas, this._ativo);
643
+ e && (t.preventDefault(), this.acionar(e.alvo, e.pai));
644
+ });
645
+ const t = this.attachShadow({ mode: "open" });
646
+ t.innerHTML = `
647
+ <style>${R}${at}</style>
648
+ <div class="ui-paleta ui-paleta--vertical" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
649
+ `, this.rootElement = t.querySelector(".ui-paleta");
650
+ }
651
+ static get observedAttributes() {
652
+ return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "aria-label"];
653
+ }
654
+ connectedCallback() {
655
+ this.listeners.cleanup(), 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);
656
+ const t = this.getAttribute("valor") || this.getAttribute("value");
657
+ t && !this._ativo && (this._pendente = t), this.aplicarPendente(), this.renderizar();
658
+ }
659
+ disconnectedCallback() {
660
+ this.pressao.destruir(), this.fecharMenu(), this.listeners.cleanup();
661
+ }
662
+ attributeChangedCallback(t, e, i) {
663
+ if (e !== i)
664
+ if (t === "valor" || t === "value") {
665
+ const r = this.getAttribute("valor") || this.getAttribute("value") || "";
666
+ r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
667
+ } else
668
+ this.renderizar();
669
+ }
670
+ /* ---------- API pública ---------- */
671
+ get ferramentas() {
672
+ return this._ferramentas;
673
+ }
674
+ set ferramentas(t) {
675
+ this._ferramentas = Array.isArray(t) ? t : [], C(L(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
676
+ }
677
+ get valor() {
678
+ return this._ativo;
679
+ }
680
+ set valor(t) {
681
+ this.ativar(t);
682
+ }
683
+ get value() {
684
+ return this.valor;
685
+ }
686
+ set value(t) {
687
+ this.valor = t;
688
+ }
689
+ get orientacao() {
690
+ return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
691
+ }
692
+ set orientacao(t) {
693
+ this.setAttribute("orientacao", t);
694
+ }
695
+ get colunas() {
696
+ return this.getAttribute("colunas") === "2" ? 2 : 1;
697
+ }
698
+ set colunas(t) {
699
+ this.setAttribute("colunas", String(t));
700
+ }
701
+ get tamanho() {
702
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
703
+ return t === "sm" || t === "lg" ? t : "md";
704
+ }
705
+ set tamanho(t) {
706
+ this.setAttribute("tamanho", t);
707
+ }
708
+ /**
709
+ * Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
710
+ * `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
711
+ */
712
+ ativar(t, e = !0) {
713
+ if (!t) {
714
+ this.limpar(e);
715
+ return;
716
+ }
717
+ const i = m(this._ferramentas, t);
718
+ if (!i) {
719
+ this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
720
+ return;
721
+ }
722
+ if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
723
+ console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
724
+ return;
725
+ }
726
+ this._pendente = "";
727
+ const r = this._ativo;
728
+ this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
729
+ }
730
+ /** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
731
+ limpar(t = !0) {
732
+ const e = this._ativo;
733
+ !e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
734
+ }
735
+ atualizarItem(t, e) {
736
+ var n;
737
+ const i = m(this._ferramentas, t);
738
+ if (!i) {
739
+ console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
740
+ return;
741
+ }
742
+ Object.assign(i, e);
743
+ const r = Object.keys(e).every((l) => l === "ativo" || l === "disabled"), s = this._ferramentas.find((l) => {
744
+ var d;
745
+ return (d = l.filhos) == null ? void 0 : d.some((h) => h.id === t);
746
+ });
747
+ if (r && !(s && "disabled" in e)) {
748
+ const l = this.botoes().find((d) => d.dataset.id === t || d.dataset.grupo === t);
749
+ if (l) {
750
+ A(l, this.itemParaBotao(s ?? i)), H(this.botoes());
751
+ return;
752
+ }
753
+ if (s || (n = i.filhos) != null && n.length) return;
754
+ }
755
+ this.renderizar();
756
+ }
757
+ /* ---------- Estado interno ---------- */
758
+ refletirValor(t) {
759
+ const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
760
+ this.getAttribute(e) !== t && this.setAttribute(e, t);
761
+ }
762
+ aplicarPendente() {
763
+ if (!this._pendente) return;
764
+ const t = m(this._ferramentas, this._pendente);
765
+ 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 = "");
766
+ }
767
+ definirAtivoInterno(t) {
768
+ this._ativo = t;
769
+ const e = this._ferramentas.find((i) => {
770
+ var r;
771
+ return (r = i.filhos) == null ? void 0 : r.some((s) => s.id === t);
772
+ });
773
+ e && this.visiveis.set(e.id, t);
774
+ }
775
+ emitirMudanca(t, e, i) {
776
+ const r = { valor: t, item: e, anterior: i };
777
+ this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
778
+ }
779
+ /** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
780
+ itemExibido(t) {
781
+ var s;
782
+ if (!((s = t.filhos) != null && s.length)) return t;
783
+ const e = (n) => n.tipo !== "separador" && !n.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((n) => n.id === i);
784
+ return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((n) => n.tipo !== "separador") ?? t.filhos[0];
785
+ }
786
+ itemParaBotao(t) {
787
+ const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
788
+ return {
789
+ ...e,
790
+ tipo: i,
791
+ ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
792
+ filhos: t.filhos
793
+ };
794
+ }
795
+ todasFerramentas() {
796
+ return this._ferramentas.flatMap((t) => {
797
+ var e;
798
+ return (e = t.filhos) != null && e.length ? t.filhos : [t];
799
+ }).filter((t) => t.tipo !== "separador");
800
+ }
801
+ /* ---------- Renderização ---------- */
802
+ renderizar() {
803
+ var d;
804
+ const t = (d = this.shadowRoot) == null ? void 0 : d.activeElement, e = t && t.classList.contains("ui-ferr-btn") ? { id: t.dataset.id ?? "", grupo: t.dataset.grupo ?? "" } : null;
805
+ this.fecharMenu();
806
+ const i = this.orientacao, r = this.tamanho, s = this.colunas;
807
+ this.rootElement.className = `ui-paleta ui-paleta--${i} ui-paleta--${r}`, s === 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 = "";
808
+ const n = ht[r] ?? 18;
809
+ this._ferramentas.forEach((h) => {
810
+ var f;
811
+ if (h.tipo === "separador") {
812
+ const v = document.createElement("div");
813
+ v.className = "ui-paleta__sep", v.setAttribute("role", "separator"), this.rootElement.appendChild(v);
814
+ return;
815
+ }
816
+ const p = this.itemExibido(h), _ = j(this.itemParaBotao(h), "paleta", n);
817
+ _.dataset.id = p.id, (f = h.filhos) != null && f.length && (_.dataset.grupo = h.id), this.rootElement.appendChild(_);
818
+ }), T(this.botoes());
819
+ const l = this.botoes().find((h) => h.dataset.id === this._ativo && !h.disabled);
820
+ if (l && (this.botoes().forEach((h) => h.tabIndex = -1), l.tabIndex = 0), e) {
821
+ const h = this.botoes().find((p) => e.grupo ? p.dataset.grupo === e.grupo : p.dataset.id === e.id);
822
+ h && !h.disabled && h.focus();
823
+ }
824
+ }
825
+ botoes() {
826
+ return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
827
+ }
828
+ /** Reflete no botão o estado atual do item (sem recriar o DOM). */
829
+ atualizarBotaoDe(t, e) {
830
+ const i = this.botoes().find((r) => r.dataset.id === t.id);
831
+ i && A(i, this.itemParaBotao(e ?? t));
832
+ }
833
+ /* ---------- Interação ---------- */
834
+ acionar(t, e) {
835
+ if (t.disabled) return;
836
+ const i = t.tipo ?? "ferramenta", r = this._ativo, s = t.ativo;
837
+ i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
838
+ new CustomEvent("ui-ferramenta", {
839
+ detail: {
840
+ id: t.id,
841
+ item: t,
842
+ pai: e,
843
+ ativo: i === "ferramenta" ? !0 : t.ativo,
844
+ origem: "paleta"
845
+ },
846
+ bubbles: !0,
847
+ composed: !0,
848
+ cancelable: !0
849
+ })
850
+ ) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = s, this.atualizarBotaoDe(t, e)));
851
+ }
852
+ abrirFlyout(t, e) {
853
+ var s;
854
+ const i = t.dataset.grupo ? m(this._ferramentas, t.dataset.grupo) : void 0;
855
+ if (!((s = i == null ? void 0 : i.filhos) != null && s.length)) return;
856
+ this.fecharMenu();
857
+ const r = i.filhos.map((n) => ({
858
+ ...n,
859
+ ativo: (n.tipo ?? "ferramenta") === "ferramenta" ? n.id === this._ativo : n.ativo
860
+ }));
861
+ t.setAttribute("aria-expanded", "true"), this.menu = O(
862
+ this.shadowRoot,
863
+ t,
864
+ r,
865
+ (n) => {
866
+ var d;
867
+ const l = m(i.filhos, n.id);
868
+ l && (this.acionar(l, i), (d = this.botoes().find((h) => h.dataset.grupo === i.id)) == null || d.focus());
869
+ },
870
+ {
871
+ lado: this.getAttribute("orientacao") === "horizontal" ? "baixo" : "direita",
872
+ focar: e,
873
+ tipoPadrao: "ferramenta",
874
+ onFechar: () => {
875
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
876
+ }
877
+ }
878
+ );
879
+ }
880
+ fecharMenu() {
881
+ var t;
882
+ (t = this.menu) == null || t.fechar(), this.menu = null;
883
+ }
884
+ }
885
+ z("ui-paleta-ferramentas", bt);
886
+ export {
887
+ X as U,
888
+ bt as a,
889
+ rt as b
890
+ };