@thibezer/ui-components-kit 2.20.0 → 2.22.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 (125) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +2 -2
  3. package/dist/camadas.cjs +1 -1
  4. package/dist/camadas.js +1 -1
  5. package/dist/canvas.cjs +80 -80
  6. package/dist/canvas.js +2962 -3442
  7. package/dist/components/ui-barra-ferramentas/paleta-ajuste.d.ts +43 -0
  8. package/dist/components/ui-barra-ferramentas/paleta-excesso.d.ts +8 -0
  9. package/dist/components/ui-barra-ferramentas/ribbon-colapso.d.ts +61 -0
  10. package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +5 -0
  11. package/dist/components/ui-barra-ferramentas/tipos.d.ts +15 -0
  12. package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +47 -6
  13. package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +42 -1
  14. package/dist/components/ui-canvas-prancha/index.d.ts +11 -0
  15. package/dist/components/ui-canvas-prancha/prancha-acessibilidade.d.ts +5 -0
  16. package/dist/components/ui-canvas-prancha/prancha-atributos-sync.d.ts +5 -0
  17. package/dist/components/ui-canvas-prancha/prancha-bus.d.ts +5 -0
  18. package/dist/components/ui-canvas-prancha/prancha-comandos-organizacao.d.ts +45 -0
  19. package/dist/components/ui-canvas-prancha/prancha-comandos-pathfinder.d.ts +3 -0
  20. package/dist/components/ui-canvas-prancha/prancha-comandos-propriedades.d.ts +12 -0
  21. package/dist/components/ui-canvas-prancha/prancha-comandos.d.ts +27 -0
  22. package/dist/components/ui-canvas-prancha/prancha-controlador.d.ts +115 -0
  23. package/dist/components/ui-canvas-prancha/prancha-cores.d.ts +23 -0
  24. package/dist/components/ui-canvas-prancha/prancha-documento.d.ts +53 -0
  25. package/dist/components/ui-canvas-prancha/prancha-estado-ui.d.ts +45 -0
  26. package/dist/components/ui-canvas-prancha/prancha-ferramentas-edicao.d.ts +7 -0
  27. package/dist/components/ui-canvas-prancha/prancha-ferramentas.d.ts +38 -0
  28. package/dist/components/ui-canvas-prancha/prancha-gestos.d.ts +88 -0
  29. package/dist/components/ui-canvas-prancha/prancha-interacao.d.ts +31 -0
  30. package/dist/components/ui-canvas-prancha/prancha-medidor-texto.d.ts +6 -0
  31. package/dist/components/ui-canvas-prancha/prancha-painel-camadas.d.ts +43 -0
  32. package/dist/components/ui-canvas-prancha/prancha-painel-propriedades.d.ts +32 -0
  33. package/dist/components/ui-canvas-prancha/prancha-paleta.d.ts +13 -0
  34. package/dist/components/ui-canvas-prancha/prancha-pintura.d.ts +48 -0
  35. package/dist/components/ui-canvas-prancha/prancha-reguas.d.ts +26 -0
  36. package/dist/components/ui-canvas-prancha/prancha-render.d.ts +35 -0
  37. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +10 -0
  38. package/dist/components/ui-canvas-prancha/prancha-template.d.ts +1 -0
  39. package/dist/components/ui-canvas-prancha/prancha-vista.d.ts +29 -0
  40. package/dist/components/ui-canvas-prancha/tipos.d.ts +120 -0
  41. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +121 -0
  42. package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +111 -0
  43. package/dist/cores-utils-BmkzhA1v.cjs +1 -0
  44. package/dist/cores-utils-BrdynxRd.js +54 -0
  45. package/dist/cores.cjs +1 -1
  46. package/dist/cores.js +12 -11
  47. package/dist/custom-elements.json +27225 -17835
  48. package/dist/feature_caixa-CnYPKVFS.cjs +1 -0
  49. package/dist/feature_caixa-DCs9ZeSk.js +1038 -0
  50. package/dist/geometria-px-Cyi_oPD6.cjs +1 -0
  51. package/dist/geometria-px-DKrWq_XY.js +639 -0
  52. package/dist/gerencigeo-canvas/booleanas/classificacao.d.ts +41 -0
  53. package/dist/gerencigeo-canvas/booleanas/index.d.ts +10 -0
  54. package/dist/gerencigeo-canvas/booleanas/montagem.d.ts +23 -0
  55. package/dist/gerencigeo-canvas/booleanas/segmentos.d.ts +38 -0
  56. package/dist/gerencigeo-canvas/booleanas/tipos.d.ts +44 -0
  57. package/dist/gerencigeo-canvas/espaco/espaco_geografico.d.ts +2 -0
  58. package/dist/gerencigeo-canvas/espaco/espaco_matriz.d.ts +58 -0
  59. package/dist/gerencigeo-canvas/espaco/espaco_plano.d.ts +13 -0
  60. package/dist/gerencigeo-canvas/espaco/espaco_tipos.d.ts +35 -0
  61. package/dist/gerencigeo-canvas/espaco/index.d.ts +4 -0
  62. package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +12 -8
  63. package/dist/gerencigeo-canvas/feature_amostra.d.ts +2 -1
  64. package/dist/gerencigeo-canvas/feature_caixa.d.ts +3 -2
  65. package/dist/gerencigeo-canvas/feature_curvas.d.ts +9 -2
  66. package/dist/gerencigeo-canvas/feature_desenho.d.ts +23 -2
  67. package/dist/gerencigeo-canvas/feature_edicao_nos.d.ts +68 -0
  68. package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +28 -8
  69. package/dist/gerencigeo-canvas/feature_editor_painel_no.d.ts +40 -0
  70. package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +46 -0
  71. package/dist/gerencigeo-canvas/feature_formas.d.ts +7 -3
  72. package/dist/gerencigeo-canvas/feature_historico.d.ts +41 -0
  73. package/dist/gerencigeo-canvas/feature_indice.d.ts +10 -2
  74. package/dist/gerencigeo-canvas/feature_metricas.d.ts +15 -4
  75. package/dist/gerencigeo-canvas/feature_types.d.ts +14 -2
  76. package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +2 -0
  77. package/dist/gerencigeo-canvas/prancha/aparencia_estilo.d.ts +86 -0
  78. package/dist/gerencigeo-canvas/prancha/camadas.d.ts +14 -0
  79. package/dist/gerencigeo-canvas/prancha/cantos_vivos.d.ts +18 -0
  80. package/dist/gerencigeo-canvas/prancha/elemento_consulta.d.ts +63 -0
  81. package/dist/gerencigeo-canvas/prancha/elemento_criacao.d.ts +27 -0
  82. package/dist/gerencigeo-canvas/prancha/elemento_edicao.d.ts +24 -0
  83. package/dist/gerencigeo-canvas/prancha/elemento_geometria.d.ts +60 -0
  84. package/dist/gerencigeo-canvas/prancha/elemento_predefinicoes.d.ts +55 -0
  85. package/dist/gerencigeo-canvas/prancha/elemento_snap.d.ts +39 -0
  86. package/dist/gerencigeo-canvas/prancha/elemento_transformacao.d.ts +65 -0
  87. package/dist/gerencigeo-canvas/prancha/elemento_validacao.d.ts +27 -0
  88. package/dist/gerencigeo-canvas/prancha/exportar_svg.d.ts +18 -0
  89. package/dist/gerencigeo-canvas/prancha/guias_inteligentes.d.ts +21 -0
  90. package/dist/gerencigeo-canvas/prancha/index.d.ts +23 -0
  91. package/dist/gerencigeo-canvas/prancha/operacoes_caminho.d.ts +35 -0
  92. package/dist/gerencigeo-canvas/prancha/organizacao.d.ts +46 -0
  93. package/dist/gerencigeo-canvas/prancha/pathfinder.d.ts +17 -0
  94. package/dist/gerencigeo-canvas/prancha/pintura_canvas.d.ts +78 -0
  95. package/dist/gerencigeo-canvas/prancha/pintura_formas.d.ts +32 -0
  96. package/dist/gerencigeo-canvas/prancha/pintura_plano.d.ts +126 -0
  97. package/dist/gerencigeo-canvas/prancha/propriedades.d.ts +15 -0
  98. package/dist/gerencigeo-canvas/prancha/tipos.d.ts +228 -0
  99. package/dist/index.cjs +1 -1
  100. package/dist/index.d.ts +5 -0
  101. package/dist/index.js +257 -255
  102. package/dist/motor.cjs +1 -1
  103. package/dist/motor.js +822 -57
  104. package/dist/prancha-paleta-BZ-9QDgh.js +5276 -0
  105. package/dist/prancha-paleta-Bb24vP71.cjs +17 -0
  106. package/dist/prancha.cjs +1 -0
  107. package/dist/prancha.d.ts +10 -0
  108. package/dist/prancha.js +200 -0
  109. package/dist/register.cjs +1 -1
  110. package/dist/register.js +7 -5
  111. package/dist/tipos-elementos.d.ts +47 -1
  112. package/dist/tipos-react.d.ts +2 -0
  113. package/dist/tipos-vue.d.ts +46 -1
  114. package/dist/tools.cjs +1 -1
  115. package/dist/tools.js +1 -1
  116. package/dist/ui-controle-cores-BcH9k2Fa.js +292 -0
  117. package/dist/ui-controle-cores-CvSTP6gJ.cjs +32 -0
  118. package/dist/ui-kit.css +1 -1
  119. package/dist/ui-paleta-ferramentas-DebHYiwd.js +1615 -0
  120. package/dist/ui-paleta-ferramentas-Dgejtluh.js +1423 -0
  121. package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +22 -0
  122. package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +22 -0
  123. package/dist/ui-seletor-cor-0RLjcME6.cjs +83 -0
  124. package/dist/ui-seletor-cor-Cd8jkzXG.js +354 -0
  125. package/package.json +6 -1
@@ -0,0 +1,1423 @@
1
+ var at = Object.defineProperty;
2
+ var ot = (o, l, t) => l in o ? at(o, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[l] = t;
3
+ var d = (o, l, t) => ot(o, typeof l != "symbol" ? l + "" : l, t);
4
+ import { L as N } from "./listener-bag-DQgv7OON.js";
5
+ import { d as B, S as O } from "./ssr-safe-5cWfJP-s.js";
6
+ import { A as Z, a as R, e as J } from "./degrade-gDa5sW__.js";
7
+ import { h as st } from "./svg-seguro-ChVJ2L2z.js";
8
+ const nt = ':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)}', Y = {
9
+ 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>',
10
+ 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>',
11
+ 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>',
12
+ 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>',
13
+ 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>',
14
+ 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>',
15
+ 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>',
16
+ 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>',
17
+ 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>',
18
+ 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>'
19
+ };
20
+ class lt extends O {
21
+ constructor() {
22
+ super();
23
+ d(this, "iconContainer");
24
+ d(this, "svgContainer");
25
+ d(this, "slotElement");
26
+ d(this, "handleSlotChange", () => {
27
+ this.syncState();
28
+ });
29
+ const t = this.attachShadow({ mode: "open" });
30
+ t.innerHTML = `
31
+ <style>${nt}</style>
32
+ <span class="ui-icone" aria-hidden="true">
33
+ <span class="ui-icone__svg" style="display: none;"></span>
34
+ <slot></slot>
35
+ </span>
36
+ `, this.iconContainer = t.querySelector(".ui-icone"), this.svgContainer = t.querySelector(".ui-icone__svg"), this.slotElement = t.querySelector("slot");
37
+ }
38
+ static get observedAttributes() {
39
+ return ["tamanho", "size", "cor", "color", "nome", "name"];
40
+ }
41
+ connectedCallback() {
42
+ this.slotElement.addEventListener("slotchange", this.handleSlotChange), this.syncState();
43
+ }
44
+ disconnectedCallback() {
45
+ this.slotElement.removeEventListener("slotchange", this.handleSlotChange);
46
+ }
47
+ attributeChangedCallback(t, e, i) {
48
+ this.syncState();
49
+ }
50
+ resolveTamanhoPx() {
51
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
52
+ switch (t.toLowerCase()) {
53
+ case "sm":
54
+ return "16px";
55
+ case "md":
56
+ return "20px";
57
+ case "lg":
58
+ return "24px";
59
+ case "xl":
60
+ return "32px";
61
+ default:
62
+ return isNaN(Number(t)) ? t : `${t}px`;
63
+ }
64
+ }
65
+ syncState() {
66
+ const t = this.resolveTamanhoPx();
67
+ this.style.setProperty("--ui-tamanho-icone", t);
68
+ const e = this.getAttribute("cor") || this.getAttribute("color");
69
+ 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");
70
+ const r = this.getAttribute("nome") || this.getAttribute("name"), a = this.slotElement.assignedNodes().length > 0;
71
+ r && Y[r] && !a ? (this.svgContainer.innerHTML = Y[r], this.svgContainer.style.display = "inline-flex") : (this.svgContainer.innerHTML = "", this.svgContainer.style.display = "none");
72
+ }
73
+ }
74
+ B("ui-icone", lt);
75
+ const ut = ':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-degrade-interno, var(--ui-ribbon-fundo, var(--ui-fundo-superficie, 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}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-ribbon[data-degrade]:not([data-degrade=false]){--ui-ribbon-fundo: var(--ui-gradiente-superficie)}.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__mais-abas{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;align-self:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--ui-raio-sm, 4px);background:transparent;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer}.ui-ribbon__mais-abas[hidden]{display:none}.ui-ribbon__mais-abas:hover,.ui-ribbon__mais-abas[aria-expanded=true]{color:var(--ui-cor-texto, #e1e1e6);background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-ribbon__mais-abas:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:-2px}.ui-ribbon__mais-abas:before{content:"";width:6px;height:6px;border:solid currentColor;border-width:0 2px 2px 0;transform:translateY(-2px) rotate(45deg)}.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;justify-content:center;flex-shrink:0;padding:0 var(--ui-espaco-sm, 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:center;gap:var(--ui-espaco-xs, 4px)}.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__grupo-rotulo:empty{display:none;padding:0}.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:2px}.ui-ribbon__separador{width:1px;height:68px;align-self:center;margin:0 var(--ui-espaco-xs, 4px);background:var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-ferr-btn--grande{flex-direction:column;min-width:52px;height:76px;padding:6px 8px;gap:3px;box-sizing:border-box;border-radius:var(--ui-raio-borda, 6px);justify-content:center;align-items:center}.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 8px;border-radius:var(--ui-raio-sm, 4px);justify-content:flex-start;box-sizing:border-box}.ui-ferr-btn--pequeno.ui-ferr-btn--so-icone{width:24px;padding:0;justify-content:center}.ui-ferr-split--pequeno{border-radius:var(--ui-raio-sm, 4px)}.ui-ferr-split--pequeno .ui-ferr-split__acao{border-radius:var(--ui-raio-sm, 4px) 0 0 var(--ui-raio-sm, 4px);padding:0 6px 0 8px}.ui-ferr-split--pequeno .ui-ferr-split__gatilho{border-radius:0 var(--ui-raio-sm, 4px) var(--ui-raio-sm, 4px) 0}.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 (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__mais-abas{width:32px;height: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__mais-abas:focus-visible,.ui-ribbon__fixar:focus-visible,.ui-ribbon__grupos .ui-ferr-btn:focus-visible{outline-color:Highlight}}', Q = '.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-degrade-interno, var(--ui-ferr-menu-fundo, var(--ui-fundo-elevado, 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-degrade-interno, var(--ui-ferr-tooltip-fundo, var(--ui-fundo-elevado, 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}}';
76
+ function S(o, l) {
77
+ if (!o) return null;
78
+ const t = document.createElement("ui-icone");
79
+ if (t.setAttribute("tamanho", String(l)), o.trimStart().startsWith("<")) {
80
+ const e = st(o);
81
+ if (!e) return null;
82
+ t.appendChild(e);
83
+ } else
84
+ t.setAttribute("nome", o);
85
+ return t;
86
+ }
87
+ const X = /* @__PURE__ */ new Set();
88
+ function z(o) {
89
+ return o.rotuloAcessivel ? o.rotuloAcessivel : o.rotulo ? o.rotulo : o.icone && !o.icone.trimStart().startsWith("<") ? o.icone : (X.has(o.id) || (X.add(o.id), console.warn(`[ui-barra-ferramentas] O item "${o.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), o.id);
90
+ }
91
+ function $(o, l) {
92
+ const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
93
+ o.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${l}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
94
+ }
95
+ function H(o, l = []) {
96
+ for (const t of o)
97
+ t.tipo !== "separador" && (l.push(t.id), t.filhos && H(t.filhos, l));
98
+ return l;
99
+ }
100
+ function y(o, l) {
101
+ o.disabled = !!l.disabled;
102
+ const t = l.tipo, e = t === "toggle" || t === "ferramenta";
103
+ e ? o.setAttribute("aria-pressed", String(!!l.ativo)) : o.removeAttribute("aria-pressed"), o.classList.toggle("ui-ferr-btn--ativo", e && !!l.ativo);
104
+ }
105
+ function G(o, l, t) {
106
+ var n;
107
+ const e = document.createElement("button");
108
+ e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${l}`, e.dataset.id = o.id, e.tabIndex = -1;
109
+ const i = !!((n = o.filhos) != null && n.length), r = l !== "paleta" && !o.somenteIcone && !!o.rotulo;
110
+ o.rotuloAcessivel ? e.setAttribute("aria-label", o.rotuloAcessivel) : r ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", z(o)), o.atalho && e.setAttribute("aria-keyshortcuts", o.atalho), e.dataset.tooltip = z(o), o.atalho && (e.dataset.atalho = o.atalho);
111
+ const a = S(o.icone, t);
112
+ if (a) {
113
+ const u = document.createElement("span");
114
+ u.className = "ui-ferr-btn__icone", u.appendChild(a), e.appendChild(u);
115
+ }
116
+ if (l !== "paleta" && o.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), r) {
117
+ const u = document.createElement("span");
118
+ u.className = "ui-ferr-btn__rotulo", u.textContent = o.rotulo, e.appendChild(u);
119
+ }
120
+ if (i && !o.dividido) {
121
+ if (l === "paleta")
122
+ e.classList.add("ui-ferr-btn--grupo");
123
+ else {
124
+ const u = document.createElement("span");
125
+ u.className = "ui-ferr-btn__caret", e.appendChild(u);
126
+ }
127
+ e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
128
+ }
129
+ return y(e, o), e;
130
+ }
131
+ function dt(o, l, t) {
132
+ const e = document.createElement("div");
133
+ e.className = `ui-ferr-split ui-ferr-split--${l}`, e.dataset.id = o.id;
134
+ const i = G({ ...o, filhos: void 0, dividido: !1 }, l, t);
135
+ i.classList.add("ui-ferr-split__acao"), i.dataset.split = "acao";
136
+ const r = document.createElement("button");
137
+ r.type = "button", r.className = `ui-ferr-btn ui-ferr-split__gatilho ui-ferr-btn--${l}`, r.dataset.id = o.id, r.dataset.split = "gatilho", r.tabIndex = -1, r.disabled = !!o.disabled, r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), r.setAttribute("aria-label", `Opções de ${z(o)}`), r.dataset.tooltip = `Opções de ${z(o)}`;
138
+ const a = document.createElement("span");
139
+ return a.className = "ui-ferr-btn__caret", r.appendChild(a), e.appendChild(i), e.appendChild(r), e;
140
+ }
141
+ function v(o, l) {
142
+ for (const t of o) {
143
+ if (t.id === l) return t;
144
+ if (t.filhos) {
145
+ const e = v(t.filhos, l);
146
+ if (e) return e;
147
+ }
148
+ }
149
+ }
150
+ function tt(o, l) {
151
+ if (!l || !l.trim()) return !1;
152
+ const t = l.split("+").map((b) => b.trim()), e = t[t.length - 1], i = t.some((b) => /^(ctrl|control|cmd|meta)$/i.test(b)), r = t.some((b) => /^alt$/i.test(b)), a = t.some((b) => /^shift$/i.test(b)), n = o.ctrlKey || o.metaKey, u = o.altKey, c = o.shiftKey;
153
+ if (i !== n || r !== u || a !== c) return !1;
154
+ const s = e.toLowerCase(), h = (o.key || "").toLowerCase();
155
+ return s === "esc" || s === "escape" ? h === "escape" : s === "del" || s === "delete" ? h === "delete" : s === "enter" ? h === "enter" : s === "space" || s === "espaço" ? h === " " || h === "space" : h === s;
156
+ }
157
+ function V(o) {
158
+ const l = o.filter((t) => !t.disabled);
159
+ o.forEach((t) => t.tabIndex = -1), l.length && (l[0].tabIndex = 0);
160
+ }
161
+ function et(o) {
162
+ const l = o.find((t) => t.tabIndex === 0 && !t.disabled);
163
+ l ? o.forEach((t) => {
164
+ t !== l && (t.tabIndex = -1);
165
+ }) : V(o);
166
+ }
167
+ function it(o, l) {
168
+ const t = o.find((e) => e === l || e.contains(l));
169
+ !t || t.disabled || o.forEach((e) => e.tabIndex = e === t ? 0 : -1);
170
+ }
171
+ function j(o, l, t, e) {
172
+ const i = l.filter((u) => !u.disabled), r = i.length, a = i.findIndex((u) => u === o.target);
173
+ if (r === 0 || a < 0) return !1;
174
+ let n = a;
175
+ if (t.includes(o.key)) n = (a - 1 + r) % r;
176
+ else if (e.includes(o.key)) n = (a + 1) % r;
177
+ else if (o.key === "Home") n = 0;
178
+ else if (o.key === "End") n = r - 1;
179
+ else return !1;
180
+ return o.preventDefault(), l.forEach((u) => u.tabIndex = -1), i[n].tabIndex = 0, i[n].focus(), !0;
181
+ }
182
+ function ct(o, l, t = !1) {
183
+ const e = l.filter((u) => !u.disabled), i = e.length, r = e.findIndex((u) => u === o.target);
184
+ if (i === 0 || r < 0) return !1;
185
+ let a = r;
186
+ const n = r % 2;
187
+ if (o.key === "ArrowRight")
188
+ t ? n === 1 && (a = r - 1) : n === 0 && r + 1 < i && (a = r + 1);
189
+ else if (o.key === "ArrowLeft")
190
+ t ? n === 0 && r + 1 < i && (a = r + 1) : n === 1 && (a = r - 1);
191
+ else if (o.key === "ArrowDown")
192
+ r + 2 < i ? a = r + 2 : r + 1 < i && n === 0 && (a = r + 1);
193
+ else if (o.key === "ArrowUp")
194
+ r - 2 >= 0 ? a = r - 2 : r - 1 >= 0 && n === 1 && (a = r - 1);
195
+ else if (o.key === "Home")
196
+ a = 0;
197
+ else if (o.key === "End")
198
+ a = i - 1;
199
+ else
200
+ return !1;
201
+ return o.preventDefault(), l.forEach((u) => u.tabIndex = -1), e[a].tabIndex = 0, e[a].focus(), !0;
202
+ }
203
+ let ht = 0;
204
+ class rt {
205
+ constructor(l, t) {
206
+ d(this, "el");
207
+ d(this, "textoEl");
208
+ d(this, "atalhoEl");
209
+ d(this, "timer");
210
+ d(this, "alvoAtual", null);
211
+ d(this, "id", `ui-ferr-tooltip-${++ht}`);
212
+ d(this, "listeners", new N());
213
+ this.raiz = l, 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) => {
214
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
215
+ if (i && i !== this.alvoAtual) {
216
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
217
+ r && this.agendar(i, r, a);
218
+ }
219
+ }), this.listeners.add(t, "pointerout", (e) => {
220
+ const r = e.relatedTarget;
221
+ this.alvoAtual && (!r || !this.alvoAtual.contains(r)) && this.esconder();
222
+ }), this.listeners.add(t, "focusin", (e) => {
223
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
224
+ if (i) {
225
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", a = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
226
+ r && this.mostrar(i, r, a);
227
+ }
228
+ }), 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());
229
+ }
230
+ agendar(l, t, e) {
231
+ this.limparTimer(), this.timer = window.setTimeout(() => this.mostrar(l, t, e), 140);
232
+ }
233
+ mostrar(l, t, e) {
234
+ if (this.limparTimer(), !l.isConnected || !t) return;
235
+ this.alvoAtual = l, 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"), l.setAttribute("aria-describedby", this.id);
236
+ const i = l.getBoundingClientRect(), r = this.el.getBoundingClientRect();
237
+ let a = i.bottom + 6, n = i.left + (i.width - (r.width || 80)) / 2;
238
+ a + (r.height || 24) > window.innerHeight - 6 && (a = Math.max(6, i.top - (r.height || 24) - 6)), n < 6 ? n = 6 : n + (r.width || 80) > window.innerWidth - 6 && (n = Math.max(6, window.innerWidth - (r.width || 80) - 6)), this.el.style.top = `${a}px`, this.el.style.left = `${n}px`;
239
+ }
240
+ esconder() {
241
+ 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");
242
+ }
243
+ limparTimer() {
244
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0);
245
+ }
246
+ destruir() {
247
+ this.esconder(), this.listeners.cleanup(), this.el.remove();
248
+ }
249
+ }
250
+ let bt = 0;
251
+ function k(o, l, t, e, i = {}) {
252
+ var K;
253
+ const r = i.lado ?? "baixo", a = new N(), n = document.createElement("div");
254
+ n.className = "ui-ferr-menu", n.setAttribute("role", "menu"), n.id = `ui-ferr-menu-${++bt}`, n.setAttribute("aria-label", l.getAttribute("aria-label") || "Menu"), l.setAttribute("aria-controls", n.id);
255
+ const u = [];
256
+ let c = !1, s = null;
257
+ const h = () => {
258
+ s && (s.fechar(), s = null);
259
+ }, b = () => {
260
+ var p;
261
+ c || (c = !0, h(), l.removeAttribute("aria-controls"), a.cleanup(), n.remove(), (p = i.onFechar) == null || p.call(i));
262
+ }, m = getComputedStyle(l).direction === "rtl";
263
+ t.forEach((p) => {
264
+ var U;
265
+ if (p.tipo === "separador") {
266
+ const _ = document.createElement("div");
267
+ _.className = "ui-ferr-menu__sep", _.setAttribute("role", "separator"), n.appendChild(_);
268
+ return;
269
+ }
270
+ const f = document.createElement("button");
271
+ f.type = "button", f.className = "ui-ferr-menu__item";
272
+ const E = p.tipo ?? i.tipoPadrao ?? "botao";
273
+ E === "toggle" ? (f.setAttribute("role", "menuitemcheckbox"), f.setAttribute("aria-checked", String(!!p.ativo))) : E === "ferramenta" ? (f.setAttribute("role", "menuitemradio"), f.setAttribute("aria-checked", String(!!p.ativo))) : f.setAttribute("role", "menuitem"), f.dataset.id = p.id, f.disabled = !!p.disabled, p.atalho && f.setAttribute("aria-keyshortcuts", p.atalho), p.ativo && f.classList.add("ui-ferr-menu__item--ativo");
274
+ const C = document.createElement("span");
275
+ C.className = "ui-ferr-menu__icone";
276
+ const M = S(p.icone, 14);
277
+ M && C.appendChild(M), f.appendChild(C);
278
+ const x = document.createElement("span");
279
+ if (x.className = "ui-ferr-menu__rotulo", x.textContent = z(p), f.appendChild(x), p.atalho) {
280
+ const _ = document.createElement("span");
281
+ _.className = "ui-ferr-menu__atalho", _.textContent = p.atalho, f.appendChild(_);
282
+ }
283
+ if (!!((U = p.filhos) != null && U.length)) {
284
+ f.classList.add("ui-ferr-menu__item--has-sub"), f.setAttribute("aria-haspopup", "menu"), f.setAttribute("aria-expanded", "false");
285
+ const _ = document.createElement("span");
286
+ _.className = "ui-ferr-menu__caret-sub", f.appendChild(_);
287
+ const W = (T) => {
288
+ (s == null ? void 0 : s.ancora) !== f && (h(), f.setAttribute("aria-expanded", "true"), s = k(o, f, p.filhos, e, {
289
+ lado: m ? "esquerda" : "direita",
290
+ focar: T,
291
+ tipoPadrao: i.tipoPadrao,
292
+ onFechar: () => {
293
+ f.setAttribute("aria-expanded", "false"), s = null;
294
+ }
295
+ }));
296
+ };
297
+ f.addEventListener("pointerenter", () => W(!1)), f.addEventListener("click", (T) => {
298
+ T.stopPropagation(), W(!0);
299
+ });
300
+ } else
301
+ f.addEventListener("pointerenter", h), f.addEventListener("click", (_) => {
302
+ _.stopPropagation(), b(), l.focus(), e(p);
303
+ });
304
+ u.push(f), n.appendChild(f);
305
+ }), o.appendChild(n);
306
+ const g = l.getBoundingClientRect(), A = n.getBoundingClientRect();
307
+ let D = r === "baixo" ? g.bottom + 2 : g.top, w = r === "direita" ? g.right + 4 : r === "esquerda" ? g.left - A.width - 4 : m ? g.right - A.width : g.left;
308
+ A.width && w + A.width > window.innerWidth - 4 && (w = Math.max(4, window.innerWidth - A.width - 4)), w < 4 && (w = 4), A.height && D + A.height > window.innerHeight - 4 && (D = Math.max(4, window.innerHeight - A.height - 4)), n.style.top = `${D}px`, n.style.left = `${w}px`;
309
+ const I = () => u.filter((p) => !p.disabled);
310
+ return a.add(n, "keydown", (p) => {
311
+ const f = I(), E = f.findIndex((x) => x === p.target), C = m ? "ArrowLeft" : "ArrowRight", M = m ? "ArrowRight" : "ArrowLeft";
312
+ if (p.key === "Escape")
313
+ p.preventDefault(), p.stopPropagation(), b(), l.focus();
314
+ else if (p.key === "Tab")
315
+ b();
316
+ else if (f.length && (p.key === "ArrowDown" || p.key === "ArrowUp")) {
317
+ p.preventDefault(), h();
318
+ const x = p.key === "ArrowDown" ? 1 : -1;
319
+ f[(E + x + f.length) % f.length].focus();
320
+ } else if (f.length && p.key === C) {
321
+ const x = f[E];
322
+ x != null && x.classList.contains("ui-ferr-menu__item--has-sub") && (p.preventDefault(), x.click());
323
+ } else p.key === M && (r === "direita" || r === "esquerda") ? (p.preventDefault(), p.stopPropagation(), b(), l.focus()) : f.length && p.key === "Home" ? (p.preventDefault(), f[0].focus()) : f.length && p.key === "End" && (p.preventDefault(), f[f.length - 1].focus());
324
+ }), a.add(document, "pointerdown", (p) => {
325
+ const f = p.composedPath();
326
+ !f.includes(n) && !f.includes(l) && !(s != null && s.elemento.contains(p.target)) && b();
327
+ }, !0), a.add(window, "resize", b), a.add(window, "scroll", (p) => {
328
+ p.target instanceof Node && n.contains(p.target) || b();
329
+ }, !0), i.focar && ((K = I()[0]) == null || K.focus()), { elemento: n, ancora: l, fechar: b, focarPrimeiro: () => {
330
+ var p;
331
+ return (p = I()[0]) == null ? void 0 : p.focus();
332
+ } };
333
+ }
334
+ const pt = 3;
335
+ function ft({ aba: o, ativa: l, idBotao: t, idPainel: e }) {
336
+ const i = document.createElement("button");
337
+ return i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = o.id, i.id = t, l && i.setAttribute("aria-controls", e), i.textContent = o.rotulo, i.tabIndex = l ? 0 : -1, i.setAttribute("aria-selected", String(l)), i.classList.toggle("ui-ribbon__aba--ativa", l), i.classList.toggle("ui-ribbon__aba--contextual", !!o.contextual), i;
338
+ }
339
+ const mt = '<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" fill="none"/></svg>', gt = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 12h8V4M12 12l-7-7"/></svg>', vt = (o) => o.rotuloLancador || `Mais opções de ${o.rotulo || "ferramentas"}`;
340
+ function xt(o, l) {
341
+ l.classList.add("ui-ribbon__grupo--colapsado");
342
+ const t = document.createElement("button");
343
+ t.type = "button", t.className = "ui-ferr-btn ui-ferr-btn--grande ui-ribbon__btn-colapsado", t.dataset.grupoColapsado = o.id, t.dataset.tooltip = o.rotulo, t.setAttribute("aria-haspopup", "menu"), t.setAttribute("aria-expanded", "false");
344
+ const e = S(o.icone, 24) || S(mt, 24);
345
+ if (e) {
346
+ const a = document.createElement("span");
347
+ a.className = "ui-ferr-btn__icone", a.appendChild(e), t.appendChild(a);
348
+ }
349
+ const i = document.createElement("span");
350
+ i.className = "ui-ferr-btn__rotulo", i.textContent = o.rotulo, t.appendChild(i);
351
+ const r = document.createElement("span");
352
+ return r.className = "ui-ferr-btn__caret", t.appendChild(r), l.appendChild(t), l;
353
+ }
354
+ function _t(o, l, t = {}) {
355
+ const e = document.createElement("div");
356
+ if (e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", o.rotulo), e.dataset.id = o.id, t.colapsado) return xt(o, e);
357
+ t.reduzido && e.classList.add("ui-ribbon__grupo--reduzido");
358
+ const i = (c, s, h) => {
359
+ var m;
360
+ const b = t.reduzido && s === "pequeno" && c.icone && !c.somenteIcone ? { ...c, somenteIcone: !0 } : c;
361
+ return b.dividido && ((m = b.filhos) != null && m.length) && t.criarDividido ? t.criarDividido(b, s, h) : l(b, s, h);
362
+ }, r = document.createElement("div");
363
+ r.className = "ui-ribbon__grupo-itens";
364
+ let a = null, n = 0;
365
+ const u = () => {
366
+ a && r.appendChild(a), a = null, n = 0;
367
+ };
368
+ if (o.itens.forEach((c) => {
369
+ if (c.tipo === "separador") {
370
+ u();
371
+ const s = document.createElement("div");
372
+ s.className = "ui-ribbon__separador", s.setAttribute("role", "separator"), r.appendChild(s);
373
+ } else c.tamanho === "grande" ? (u(), r.appendChild(i(c, "grande", 24))) : (a || (a = document.createElement("div"), a.className = "ui-ribbon__coluna"), a.appendChild(i(c, "pequeno", 16)), ++n === pt && u());
374
+ }), u(), o.rotulo || o.lancadorDialogo) {
375
+ const c = document.createElement("div");
376
+ if (c.className = "ui-ribbon__grupo-rotulo", o.rotulo && (c.textContent = o.rotulo), o.lancadorDialogo) {
377
+ const s = document.createElement("button");
378
+ s.type = "button", s.className = "ui-ribbon__lancador", s.dataset.lancador = o.id;
379
+ const h = vt(o);
380
+ s.setAttribute("aria-label", h), s.dataset.tooltip = h;
381
+ const b = S(gt, 10);
382
+ b && s.appendChild(b), c.appendChild(s);
383
+ }
384
+ return e.appendChild(r), e.appendChild(c), e;
385
+ }
386
+ return e.appendChild(r), e;
387
+ }
388
+ function At(o, l, t, e, i = !1) {
389
+ if (l < 0 || t <= 0) return null;
390
+ if (i && (o === "Enter" || o === " ")) return { tipo: "ativar", indice: l };
391
+ const [r, a] = e ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
392
+ return o === r ? { tipo: "ir-para", indice: (l + 1) % t } : o === a ? { tipo: "ir-para", indice: (l - 1 + t) % t } : o === "Home" ? { tipo: "ir-para", indice: 0 } : o === "End" ? { tipo: "ir-para", indice: t - 1 } : o === "ArrowDown" ? { tipo: "descer" } : null;
393
+ }
394
+ const q = 0, L = 1, F = 2, P = (o) => typeof o == "number" && Number.isFinite(o) && o >= 0;
395
+ function yt(o, l, t = 0) {
396
+ const e = /* @__PURE__ */ new Map(), i = [];
397
+ Array.isArray(o) && o.forEach((s, h) => {
398
+ if (!s || typeof s.id != "string") return;
399
+ const b = Array.isArray(s.larguras) ? s.larguras.map((m) => P(m) ? m : NaN) : [];
400
+ e.set(s.id, q), i.push({ id: s.id, prio: Number.isFinite(s.prioridade) ? s.prioridade : 0, ordem: h, larguras: b });
401
+ });
402
+ const r = Number.isFinite(l) ? l : 0;
403
+ if (!i.length || r <= 0) return { niveis: e, cabe: !0 };
404
+ const a = /* @__PURE__ */ new Map();
405
+ let n = P(t) ? t : 0;
406
+ for (const s of i) {
407
+ const h = s.larguras[q];
408
+ a.set(s.id, P(h) ? h : 0), n += a.get(s.id);
409
+ }
410
+ if (n <= r) return { niveis: e, cabe: !0 };
411
+ const u = [...i].sort((s, h) => s.prio - h.prio || h.ordem - s.ordem), c = i.reduce((s, h) => Math.max(s, h.larguras.length - 1), 0);
412
+ for (let s = L; s <= c; s++)
413
+ for (const h of u) {
414
+ const b = h.larguras[s], m = a.get(h.id);
415
+ if (!(!P(b) || b >= m) && (n -= m - b, a.set(h.id, b), e.set(h.id, s), n <= r))
416
+ return { niveis: e, cabe: !0 };
417
+ }
418
+ return { niveis: e, cabe: !1 };
419
+ }
420
+ function wt(o, l, t, e, i) {
421
+ const r = { estreito: o, acao: null };
422
+ if (!Number.isFinite(l) || l <= 0 || !Number.isFinite(t) || t <= 0) return r;
423
+ const a = l < t;
424
+ return a === o ? r : a ? { estreito: a, acao: e ? null : "recolher" } : { estreito: a, acao: e && i ? "restaurar" : null };
425
+ }
426
+ function Et({ inicio: o, tamanho: l, rolagem: t, visivel: e, margem: i = 8 }) {
427
+ const r = Number.isFinite(t) && t > 0 ? t : 0;
428
+ if (!Number.isFinite(o) || !Number.isFinite(l) || !Number.isFinite(e) || e <= 0) return r;
429
+ const a = Number.isFinite(i) && i > 0 ? i : 0, n = Math.max(0, o - a), u = o + Math.max(0, l) + a;
430
+ return u - n > e || n < r ? n : u > r + e ? u - e : r;
431
+ }
432
+ let Ct = 0;
433
+ class kt extends O {
434
+ constructor() {
435
+ super();
436
+ d(this, "rootElement");
437
+ d(this, "abasElement");
438
+ d(this, "gruposElement");
439
+ d(this, "painelElement");
440
+ d(this, "fixarElement");
441
+ d(this, "maisAbasElement");
442
+ d(this, "menuAbas", null);
443
+ d(this, "uid", `ui-ribbon-${++Ct}`);
444
+ d(this, "_abaPendente", "");
445
+ d(this, "_pronto", !1);
446
+ d(this, "_modoControlado", !1);
447
+ d(this, "_abas", []);
448
+ d(this, "_abaAtiva", "");
449
+ d(this, "menu", null);
450
+ d(this, "listeners", new N());
451
+ d(this, "tooltip", null);
452
+ d(this, "observerResize", null);
453
+ /** Grupos no nível 2 (botão único com flyout). */
454
+ d(this, "gruposColapsados", /* @__PURE__ */ new Set());
455
+ /** Grupos no nível 1 (botões pequenos só com ícone). */
456
+ d(this, "gruposReduzidos", /* @__PURE__ */ new Set());
457
+ /** Larguras medidas por nível da aba ativa; `chave` invalida quando o layout pode ter mudado. */
458
+ d(this, "medidas", null);
459
+ d(this, "revisaoLayout", 0);
460
+ d(this, "keytipsAtivas", !1);
461
+ /** Lado do `recolher-abaixo` na última medição (`null` = ainda não medido). */
462
+ d(this, "estreito", null);
463
+ d(this, "aplicandoRecolhimentoAuto", !1);
464
+ d(this, "recolhidoPorAuto", !1);
465
+ d(this, "handleFocusInGrupos", (t) => it(this.botoesPainel(), t.target));
466
+ d(this, "handleClickMaisAbas", (t) => {
467
+ this.alternarMenuAbas(t.detail === 0);
468
+ });
469
+ d(this, "handleKeyDownMaisAbas", (t) => {
470
+ t.key === "ArrowDown" && (t.preventDefault(), this.menuAbas ? this.menuAbas.focarPrimeiro() : this.alternarMenuAbas(!0));
471
+ });
472
+ /* ---------- Interação ---------- */
473
+ d(this, "handleClickAbas", (t) => {
474
+ const e = t.target.closest(".ui-ribbon__aba");
475
+ e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
476
+ });
477
+ d(this, "handleClickFixar", () => {
478
+ this.recolhido = !this.recolhido;
479
+ });
480
+ d(this, "handleDblClickAbas", (t) => {
481
+ t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
482
+ });
483
+ d(this, "handleKeyDownAbas", (t) => {
484
+ var a, n;
485
+ const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = At(t.key, e.findIndex((u) => u === t.target), e.length, this.rtl, this.ativacaoManual);
486
+ if (!i) return;
487
+ if (t.preventDefault(), i.tipo === "descer") {
488
+ this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (a = this.botoesPainel().find((u) => !u.disabled)) == null || a.focus();
489
+ return;
490
+ }
491
+ if (i.tipo === "ativar") {
492
+ const u = e[i.indice].dataset.id;
493
+ u && this.selecionarAba(u);
494
+ return;
495
+ }
496
+ const r = e[i.indice].dataset.id;
497
+ if (this.ativacaoManual) {
498
+ e.forEach((u) => u.tabIndex = -1), e[i.indice].tabIndex = 0, e[i.indice].focus();
499
+ return;
500
+ }
501
+ r && this.selecionarAba(r), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(r ?? "")}"]`)) == null || n.focus();
502
+ });
503
+ d(this, "handleClickGrupos", (t) => {
504
+ var c;
505
+ const e = t.target, i = this._abas.find((s) => s.id === this._abaAtiva), r = e.closest(".ui-ribbon__btn-colapsado");
506
+ if (r) {
507
+ const s = i == null ? void 0 : i.grupos.find((h) => h.id === r.dataset.grupoColapsado);
508
+ s && this.alternarMenuGrupoColapsado(r, s);
509
+ return;
510
+ }
511
+ const a = e.closest(".ui-ribbon__lancador");
512
+ if (a) {
513
+ const s = i == null ? void 0 : i.grupos.find((h) => h.id === a.dataset.lancador);
514
+ s && this.dispatchEvent(new CustomEvent("ui-grupo-dialogo", {
515
+ detail: { id: typeof s.lancadorDialogo == "string" ? s.lancadorDialogo : s.id, grupo: s },
516
+ bubbles: !0,
517
+ composed: !0
518
+ }));
519
+ return;
520
+ }
521
+ const n = e.closest(".ui-ferr-split__gatilho");
522
+ if (n) {
523
+ const s = n.closest(".ui-ferr-split"), h = s == null ? void 0 : s.dataset.id, b = i && v(i.grupos.flatMap((m) => m.itens), h ?? "");
524
+ b && ((c = b.filhos) != null && c.length) && this.alternarMenu(n, b, !1);
525
+ return;
526
+ }
527
+ const u = e.closest(".ui-ferr-btn");
528
+ u != null && u.dataset.id && this.acionar(u, t.detail === 0);
529
+ });
530
+ d(this, "handleKeyDownGrupos", (t) => {
531
+ var r;
532
+ const e = this.botoesPainel();
533
+ if (this.rtl ? j(t, e, ["ArrowRight"], ["ArrowLeft"]) : j(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
534
+ const i = t.target instanceof HTMLButtonElement ? t.target : null;
535
+ (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));
536
+ });
537
+ d(this, "handleEscape", (t) => {
538
+ t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
539
+ });
540
+ d(this, "handlePointerDownFora", (t) => {
541
+ !this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
542
+ });
543
+ d(this, "handleAtalho", (t) => {
544
+ if (!this.hasAttribute("atalhos") && !this.hasAttribute("keytips") || t.defaultPrevented) return;
545
+ const e = t.composedPath(), i = e[0];
546
+ if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((s) => {
547
+ var b, m;
548
+ const h = (b = s.getAttribute) == null ? void 0 : b.call(s, "role");
549
+ return ((m = s.getAttribute) == null ? void 0 : m.call(s, "aria-modal")) === "true" || h === "textbox" || h === "searchbox" || h === "combobox" || h === "spinbutton";
550
+ })) return;
551
+ if (this.hasAttribute("keytips") && (t.key === "Alt" || t.key === "F10") && !t.ctrlKey && !t.shiftKey && !t.metaKey) {
552
+ t.preventDefault(), this.alternarKeyTips();
553
+ return;
554
+ }
555
+ if (!this.hasAttribute("atalhos")) return;
556
+ const a = this._abas.find((s) => s.id === this._abaAtiva);
557
+ if (!a) return;
558
+ const u = a.grupos.flatMap((s) => s.itens).find((s) => !s.disabled && tt(t, s.atalho));
559
+ if (!u) return;
560
+ t.preventDefault();
561
+ const c = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(u.id)}"]`);
562
+ c ? this.acionar(c, !1) : this.emitir(u);
563
+ });
564
+ const t = this.attachShadow({ mode: "open" });
565
+ t.innerHTML = `
566
+ <style>${Q}${ut}</style>
567
+ <div class="ui-ribbon" part="base">
568
+ <div class="ui-ribbon__cabecalho" part="cabecalho">
569
+ <div class="ui-ribbon__abas" part="abas" role="tablist"></div>
570
+ <button type="button" class="ui-ribbon__mais-abas" part="mais-abas" aria-haspopup="menu" aria-expanded="false" hidden></button>
571
+ <button type="button" class="ui-ribbon__fixar" part="fixar"></button>
572
+ </div>
573
+ <div class="ui-ribbon__painel" part="painel" role="tabpanel">
574
+ <div class="ui-ribbon__grupos" part="grupos" role="toolbar" aria-label="Ferramentas"></div>
575
+ </div>
576
+ </div>
577
+ `, 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.maisAbasElement = t.querySelector(".ui-ribbon__mais-abas"), this.painelElement.id = `${this.uid}-painel`;
578
+ }
579
+ static get observedAttributes() {
580
+ return [
581
+ "aba-ativa",
582
+ "recolhido",
583
+ "compacto",
584
+ "ativacao-manual",
585
+ "copiar-dados",
586
+ "modo-controlado",
587
+ "atalhos",
588
+ "keytips",
589
+ "recolher-abaixo",
590
+ "aria-label",
591
+ "rotulo-abas",
592
+ "rotulo-mais-abas",
593
+ "rotulo-fixar",
594
+ "rotulo-expandir",
595
+ ...Z
596
+ ];
597
+ }
598
+ connectedCallback() {
599
+ var e;
600
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new rt(this.shadowRoot, this.rootElement), this.listeners.add(this.abasElement, "click", this.handleClickAbas), this.listeners.add(this.fixarElement, "click", this.handleClickFixar), this.listeners.add(this.maisAbasElement, "click", this.handleClickMaisAbas), this.listeners.add(this.maisAbasElement, "keydown", this.handleKeyDownMaisAbas), 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();
601
+ const t = this.getAttribute("aba-ativa");
602
+ t && !this._abaAtiva && (this._abaPendente = t), R(this, this.rootElement), this.aplicarRotulos(), this.estreito = null, this.invalidarMedidas(), this.renderizar(), this._pronto = !0, this.avaliarRecolhimentoAuto();
603
+ }
604
+ disconnectedCallback() {
605
+ var t, e;
606
+ this._pronto = !1, this.fecharMenu(), this.fecharMenuAbas(), (t = this.observerResize) == null || t.disconnect(), this.observerResize = null, (e = this.tooltip) == null || e.destruir(), this.tooltip = null, this.listeners.cleanup();
607
+ }
608
+ attributeChangedCallback(t, e, i) {
609
+ if (e !== i) {
610
+ if (J(t)) {
611
+ R(this, this.rootElement);
612
+ return;
613
+ }
614
+ if (t === "aba-ativa") {
615
+ if (!i || i === this._abaAtiva) return;
616
+ this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
617
+ } else t === "compacto" ? (this.invalidarMedidas(), this.ajustarResponsivo()) : t === "recolher-abaixo" ? (this.estreito = null, this.avaliarRecolhimentoAuto()) : t === "recolhido" ? (this.aplicandoRecolhimentoAuto || (this.recolhidoPorAuto = !1), this.rootElement.classList.remove("ui-ribbon--aberto"), this.aplicarRotulos(), this._pronto && e === null != (i === null) && this.dispatchEvent(
618
+ new CustomEvent("ui-recolhido-change", {
619
+ detail: { recolhido: i !== null },
620
+ bubbles: !0,
621
+ composed: !0
622
+ })
623
+ )) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-mais-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
624
+ }
625
+ }
626
+ aplicarRotulos() {
627
+ this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
628
+ const t = this.getAttribute("rotulo-mais-abas") || "Todas as abas";
629
+ this.maisAbasElement.setAttribute("aria-label", t), this.maisAbasElement.title = t;
630
+ const e = this.hasAttribute("recolhido"), i = e ? this.getAttribute("rotulo-expandir") || "Fixar faixa de opções" : this.getAttribute("rotulo-fixar") || "Recolher faixa de opções";
631
+ this.fixarElement.setAttribute("aria-label", i), this.fixarElement.title = i, this.fixarElement.setAttribute("aria-expanded", String(!e)), this.fixarElement.setAttribute("aria-controls", this.painelElement.id);
632
+ }
633
+ /* ---------- API pública ---------- */
634
+ get modoControlado() {
635
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
636
+ }
637
+ set modoControlado(t) {
638
+ this._modoControlado = !!t;
639
+ }
640
+ get copiarDados() {
641
+ return this.modoControlado;
642
+ }
643
+ set copiarDados(t) {
644
+ this.modoControlado = t;
645
+ }
646
+ get ativacaoManual() {
647
+ return this.hasAttribute("ativacao-manual");
648
+ }
649
+ set ativacaoManual(t) {
650
+ t ? this.setAttribute("ativacao-manual", "") : this.removeAttribute("ativacao-manual");
651
+ }
652
+ get abas() {
653
+ return this._abas;
654
+ }
655
+ set abas(t) {
656
+ const e = Array.isArray(t) ? t : [];
657
+ this._abas = this.modoControlado ? e.map((i) => ({
658
+ ...i,
659
+ grupos: i.grupos.map((r) => ({
660
+ ...r,
661
+ itens: r.itens.map((a) => {
662
+ var n;
663
+ return {
664
+ ...a,
665
+ filhos: (n = a.filhos) == null ? void 0 : n.map((u) => ({ ...u }))
666
+ };
667
+ })
668
+ }))
669
+ })) : e, $(this._abas.map((i) => i.id), "<ui-ribbon> abas"), $(
670
+ this._abas.flatMap((i) => i.grupos.flatMap((r) => H(r.itens))),
671
+ "<ui-ribbon> itens"
672
+ ), this.gruposColapsados.clear(), this.gruposReduzidos.clear(), this.invalidarMedidas(), this.renderizar();
673
+ }
674
+ get abaAtiva() {
675
+ return this._abaAtiva;
676
+ }
677
+ set abaAtiva(t) {
678
+ this.selecionarAba(t);
679
+ }
680
+ get recolhido() {
681
+ return this.hasAttribute("recolhido");
682
+ }
683
+ set recolhido(t) {
684
+ t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
685
+ }
686
+ get compacto() {
687
+ return this.hasAttribute("compacto");
688
+ }
689
+ set compacto(t) {
690
+ t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
691
+ }
692
+ /** Largura (px) abaixo da qual a faixa se recolhe sozinha. `0` desliga. */
693
+ get recolherAbaixo() {
694
+ const t = Number(this.getAttribute("recolher-abaixo"));
695
+ return Number.isFinite(t) && t > 0 ? t : 0;
696
+ }
697
+ set recolherAbaixo(t) {
698
+ Number.isFinite(t) && t > 0 ? this.setAttribute("recolher-abaixo", String(t)) : this.removeAttribute("recolher-abaixo");
699
+ }
700
+ selecionarAba(t, e = !0) {
701
+ const i = this._abas.find((r) => r.id === t && !r.oculta);
702
+ if (!i) {
703
+ t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
704
+ return;
705
+ }
706
+ i.id !== this._abaAtiva && (this._abaPendente = "", this.fecharMenu(), this.gruposColapsados.clear(), this.gruposReduzidos.clear(), this._abaAtiva = i.id, this.getAttribute("aba-ativa") !== i.id && this.setAttribute("aba-ativa", i.id), this.renderizar(), e && this.dispatchEvent(
707
+ new CustomEvent("ui-aba-change", {
708
+ detail: { id: i.id, aba: i },
709
+ bubbles: !0,
710
+ composed: !0
711
+ })
712
+ ));
713
+ }
714
+ definirAbaVisivel(t, e) {
715
+ const i = this._abas.find((n) => n.id === t);
716
+ if (!i) return;
717
+ const r = this._abaAtiva;
718
+ i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
719
+ const a = this._abas.find((n) => n.id === this._abaAtiva);
720
+ !e && r === t && a && this.dispatchEvent(
721
+ new CustomEvent("ui-aba-change", { detail: { id: a.id, aba: a }, bubbles: !0, composed: !0 })
722
+ );
723
+ }
724
+ /** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
725
+ atualizarItem(t, e) {
726
+ const i = this._abas.flatMap((c) => c.grupos.flatMap((s) => s.itens)), r = v(i, t);
727
+ if (!r) {
728
+ console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
729
+ return;
730
+ }
731
+ Object.assign(r, e);
732
+ const a = this._abas.find((c) => c.id === this._abaAtiva);
733
+ if (!a || !v(a.grupos.flatMap((c) => c.itens), t)) return;
734
+ const n = Object.keys(e).every((c) => c === "ativo" || c === "disabled"), u = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
735
+ n ? u && (y(u, this.efetivo(r)), et(this.botoesPainel())) : (this.invalidarMedidas(), this.comFoco(() => this.renderizarPainel()), this.ajustarResponsivo());
736
+ }
737
+ efetivo(t) {
738
+ var e;
739
+ return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
740
+ }
741
+ /* ---------- Foco preservado em re-renderizações ---------- */
742
+ capturarFoco() {
743
+ var e, i;
744
+ const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
745
+ 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;
746
+ }
747
+ comFoco(t) {
748
+ const e = this.capturarFoco();
749
+ if (t(), !e) return;
750
+ const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
751
+ i && !i.disabled && i.focus();
752
+ }
753
+ /* ---------- Renderização ---------- */
754
+ abasVisiveis() {
755
+ return this._abas.filter((t) => !t.oculta);
756
+ }
757
+ renderizar() {
758
+ var e;
759
+ const t = this.abasVisiveis();
760
+ 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(() => {
761
+ this.renderizarAbas(), this.renderizarPainel();
762
+ }), this.ajustarResponsivo(), this.rolarAbaAtivaParaVisivel(), this.atualizarMaisAbas();
763
+ }
764
+ renderizarAbas() {
765
+ this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
766
+ this.abasElement.appendChild(ft({
767
+ aba: t,
768
+ ativa: t.id === this._abaAtiva,
769
+ idBotao: this.idAba(t.id),
770
+ idPainel: this.painelElement.id
771
+ }));
772
+ });
773
+ }
774
+ /* ---------- Menu "mais abas" (lista transborda) ---------- */
775
+ /** Mostra o botão só quando as abas não cabem; fecha o menu se ele deixar de ser necessário. */
776
+ atualizarMaisAbas() {
777
+ const t = this.abasElement, e = t.scrollWidth > t.clientWidth + 1 && this.abasVisiveis().length > 1;
778
+ this.maisAbasElement.hidden = !e, e || this.fecharMenuAbas();
779
+ }
780
+ fecharMenuAbas() {
781
+ var t;
782
+ (t = this.menuAbas) == null || t.fechar(), this.menuAbas = null;
783
+ }
784
+ alternarMenuAbas(t) {
785
+ const e = !!this.menuAbas;
786
+ if (this.fecharMenuAbas(), e) return;
787
+ const i = this.maisAbasElement;
788
+ i.setAttribute("aria-expanded", "true");
789
+ const r = this.abasVisiveis().map((a) => ({
790
+ id: a.id,
791
+ rotulo: a.rotulo,
792
+ tipo: "ferramenta",
793
+ ativo: a.id === this._abaAtiva
794
+ }));
795
+ this.menuAbas = k(
796
+ this.shadowRoot,
797
+ i,
798
+ r,
799
+ (a) => {
800
+ var n;
801
+ this.selecionarAba(a.id), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(a.id)}"]`)) == null || n.focus();
802
+ },
803
+ {
804
+ lado: "baixo",
805
+ focar: t,
806
+ onFechar: () => {
807
+ i.setAttribute("aria-expanded", "false"), this.menuAbas = null;
808
+ }
809
+ }
810
+ );
811
+ }
812
+ /** Mantém a aba ativa dentro da área visível da lista de abas (sem rolar a página, só a lista). */
813
+ rolarAbaAtivaParaVisivel() {
814
+ const t = this.abasElement, e = t.querySelector(".ui-ribbon__aba--ativa");
815
+ if (!e || !(t.scrollWidth > t.clientWidth)) return;
816
+ const i = e.getBoundingClientRect(), r = Et({
817
+ inicio: i.left - t.getBoundingClientRect().left + t.scrollLeft,
818
+ tamanho: i.width,
819
+ rolagem: t.scrollLeft,
820
+ visivel: t.clientWidth
821
+ });
822
+ r !== t.scrollLeft && (t.scrollLeft = r);
823
+ }
824
+ idAba(t) {
825
+ return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
826
+ }
827
+ renderizarPainel() {
828
+ this.fecharMenu(), this.gruposElement.innerHTML = "";
829
+ const t = this._abas.find((e) => e.id === this._abaAtiva);
830
+ if (!t) {
831
+ this.painelElement.removeAttribute("aria-labelledby");
832
+ return;
833
+ }
834
+ this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(_t(
835
+ e,
836
+ (i, r, a) => this.criarBotao(i, r, a),
837
+ {
838
+ colapsado: this.gruposColapsados.has(e.id),
839
+ reduzido: this.gruposReduzidos.has(e.id),
840
+ criarDividido: (i, r, a) => dt(this.efetivo(i), r, a)
841
+ }
842
+ ))), V(this.botoesPainel());
843
+ }
844
+ iniciarResizeObserver() {
845
+ typeof ResizeObserver > "u" || (this.observerResize = new ResizeObserver(() => {
846
+ this.avaliarRecolhimentoAuto(), this.ajustarResponsivo(), this.atualizarMaisAbas();
847
+ }), this.observerResize.observe(this.painelElement), this.observerResize.observe(this.abasElement), this.observerResize.observe(this));
848
+ }
849
+ /* ---------- Responsividade: degradê dos grupos por falta de espaço ---------- */
850
+ invalidarMedidas() {
851
+ this.revisaoLayout++, this.medidas = null;
852
+ }
853
+ /** Largura fixa do contêiner dos grupos fora dos próprios grupos (padding) + 1px de tolerância de arredondamento. */
854
+ larguraFixaGrupos() {
855
+ try {
856
+ const t = getComputedStyle(this.gruposElement);
857
+ return (parseFloat(t.paddingLeft) || 0) + (parseFloat(t.paddingRight) || 0) + 1;
858
+ } catch {
859
+ return 1;
860
+ }
861
+ }
862
+ larguraDoGrupo(t) {
863
+ var e;
864
+ return ((e = this.gruposElement.querySelector(`.ui-ribbon__grupo[data-id="${CSS.escape(t)}"]`)) == null ? void 0 : e.offsetWidth) ?? 0;
865
+ }
866
+ definirNiveis(t, e) {
867
+ this.gruposReduzidos = new Set(t), this.gruposColapsados = new Set(e);
868
+ }
869
+ /**
870
+ * Mede a largura de cada grupo da aba nos três níveis (renderiza os três estados de forma síncrona, sem pintura
871
+ * entre eles) e guarda em cache até o layout poder mudar (outra aba, `compacto`, itens alterados).
872
+ * Deixa o DOM no último estado medido: quem chama deve renderizar o resultado final.
873
+ */
874
+ medirGrupos(t) {
875
+ var n;
876
+ const e = `${t.id}|${this.compacto}|${this.revisaoLayout}`;
877
+ if (((n = this.medidas) == null ? void 0 : n.chave) === e) return { grupos: this.medidas.grupos, mediu: !1 };
878
+ const i = t.grupos.map((u) => u.id), r = i.map(() => []);
879
+ for (const u of [q, L, F])
880
+ this.definirNiveis(u === L ? i : [], u === F ? i : []), this.renderizarPainel(), i.forEach((c, s) => r[s].push(this.larguraDoGrupo(c)));
881
+ const a = t.grupos.map((u, c) => ({ id: u.id, prioridade: u.prioridade, larguras: r[c] }));
882
+ return this.medidas = { chave: e, grupos: a }, { grupos: a, mediu: !0 };
883
+ }
884
+ /**
885
+ * Ajusta o nível de cada grupo ao espaço real do painel. Só re-renderiza quando o resultado muda, então
886
+ * notificações repetidas do ResizeObserver (inclusive as causadas por esta própria renderização) não fazem laço.
887
+ * Painel oculto (faixa recolhida) ou sem layout: não decide nada.
888
+ */
889
+ ajustarResponsivo() {
890
+ if (!this.isConnected) return;
891
+ const t = this._abas.find((i) => i.id === this._abaAtiva);
892
+ if (!(t != null && t.grupos.length)) return;
893
+ const e = this.painelElement.clientWidth;
894
+ e > 0 && this.comFoco(() => {
895
+ const i = new Set(this.gruposReduzidos), r = new Set(this.gruposColapsados), { grupos: a, mediu: n } = this.medirGrupos(t), { niveis: u } = yt(a, e, this.larguraFixaGrupos()), c = (m) => [...u].filter(([, g]) => g === m).map(([g]) => g), s = c(L), h = c(F), b = (m, g) => m.size === g.length && g.every((A) => m.has(A));
896
+ !n && b(i, s) && b(r, h) || (this.definirNiveis(s, h), this.renderizarPainel());
897
+ });
898
+ }
899
+ /** `recolher-abaixo`: recolhe a faixa ao cruzar para estreito e restaura (só se foi automático) ao alargar. */
900
+ avaliarRecolhimentoAuto() {
901
+ const t = this.recolherAbaixo;
902
+ if (!t) {
903
+ this.estreito = null;
904
+ return;
905
+ }
906
+ const e = wt(this.estreito, this.offsetWidth, t, this.recolhido, this.recolhidoPorAuto);
907
+ if (this.estreito = e.estreito, !!e.acao) {
908
+ this.aplicandoRecolhimentoAuto = !0;
909
+ try {
910
+ this.recolhido = e.acao === "recolher";
911
+ } finally {
912
+ this.aplicandoRecolhimentoAuto = !1;
913
+ }
914
+ this.recolhidoPorAuto = e.acao === "recolher";
915
+ }
916
+ }
917
+ alternarMenuGrupoColapsado(t, e) {
918
+ var r;
919
+ const i = ((r = this.menu) == null ? void 0 : r.ancora) === t;
920
+ this.fecharMenu(), !i && (t.setAttribute("aria-expanded", "true"), this.menu = k(
921
+ this.shadowRoot,
922
+ t,
923
+ e.itens,
924
+ (a) => {
925
+ const n = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(a.id)}"]`);
926
+ if (n) this.acionar(n, !1);
927
+ else {
928
+ const u = a.ativo;
929
+ a.tipo === "toggle" ? a.ativo = !u : a.tipo === "ferramenta" && (a.ativo = !0), this.emitir(a) || (a.ativo = u);
930
+ }
931
+ this.rootElement.classList.remove("ui-ribbon--aberto");
932
+ },
933
+ {
934
+ lado: "baixo",
935
+ onFechar: () => {
936
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
937
+ }
938
+ }
939
+ ));
940
+ }
941
+ criarBotao(t, e, i) {
942
+ return G(this.efetivo(t), e, i);
943
+ }
944
+ botoesPainel() {
945
+ return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
946
+ }
947
+ get rtl() {
948
+ return getComputedStyle(this).direction === "rtl";
949
+ }
950
+ alternarKeyTips() {
951
+ if (this.keytipsAtivas = !this.keytipsAtivas, this.shadowRoot.querySelectorAll(".ui-ribbon__keytip").forEach((e) => e.remove()), !this.keytipsAtivas) return;
952
+ Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")).forEach((e, i) => {
953
+ const r = document.createElement("span");
954
+ 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);
955
+ });
956
+ }
957
+ acionar(t, e) {
958
+ var n;
959
+ const i = this._abas.find((u) => u.id === this._abaAtiva), r = i == null ? void 0 : i.grupos.find((u) => v(u.itens, t.dataset.id)), a = r && v(r.itens, t.dataset.id);
960
+ if (!(!a || a.disabled)) {
961
+ if ((n = a.filhos) != null && n.length && !a.dividido) {
962
+ this.alternarMenu(t, a, e);
963
+ return;
964
+ }
965
+ if (a.tipo === "toggle") {
966
+ const u = a.ativo;
967
+ a.ativo = !u, y(t, a), this.emitir(a) || (a.ativo = u, y(t, a));
968
+ } else if (a.tipo === "ferramenta") {
969
+ const u = a.ativo, c = r ? r.exclusivo !== !1 : !0, s = c && r ? r.itens.filter((h) => h.tipo === "ferramenta" && h.id !== a.id && h.ativo) : [];
970
+ a.ativo = !0, y(t, a), c && s.forEach((h) => {
971
+ h.ativo = !1;
972
+ const b = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(h.id)}"]`);
973
+ b && y(b, h);
974
+ }), this.emitir(a) || (a.ativo = u, y(t, a), c && s.forEach((h) => {
975
+ h.ativo = !0;
976
+ const b = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(h.id)}"]`);
977
+ b && y(b, h);
978
+ }));
979
+ } else
980
+ this.emitir(a);
981
+ this.rootElement.classList.remove("ui-ribbon--aberto");
982
+ }
983
+ }
984
+ alternarMenu(t, e, i) {
985
+ var a;
986
+ const r = ((a = this.menu) == null ? void 0 : a.ancora) === t;
987
+ this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = k(
988
+ this.shadowRoot,
989
+ t,
990
+ e.filhos,
991
+ (n) => {
992
+ if (n.tipo === "toggle") {
993
+ const u = n.ativo;
994
+ n.ativo = !u, this.emitir(n, e) || (n.ativo = u);
995
+ } else
996
+ this.emitir(n, e);
997
+ this.rootElement.classList.remove("ui-ribbon--aberto");
998
+ },
999
+ {
1000
+ lado: "baixo",
1001
+ focar: i,
1002
+ onFechar: () => {
1003
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
1004
+ }
1005
+ }
1006
+ ));
1007
+ }
1008
+ fecharMenu() {
1009
+ var t;
1010
+ (t = this.menu) == null || t.fechar(), this.menu = null;
1011
+ }
1012
+ /** Retorna false se o consumidor cancelou o evento (preventDefault). */
1013
+ emitir(t, e) {
1014
+ return this.dispatchEvent(
1015
+ new CustomEvent("ui-ferramenta", {
1016
+ detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
1017
+ bubbles: !0,
1018
+ composed: !0,
1019
+ cancelable: !0
1020
+ })
1021
+ );
1022
+ }
1023
+ }
1024
+ B("ui-ribbon", kt);
1025
+ const St = ':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-degrade-interno, var(--ui-paleta-fundo, var(--ui-fundo-superficie, var(--ui-cor-superficie, #141417))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-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}}:host(.degrade),:host(.gradiente),:host([data-degrade]:not([data-degrade="false"])),.ui-paleta[data-degrade]:not([data-degrade=false]){--ui-paleta-fundo: var(--ui-gradiente-superficie)}', zt = 380, Mt = 8, Pt = 50;
1026
+ class Lt {
1027
+ constructor() {
1028
+ d(this, "timer");
1029
+ d(this, "timerSupressao");
1030
+ d(this, "inicio", null);
1031
+ d(this, "suprimir", !1);
1032
+ }
1033
+ /** Começa a contar; `aoDisparar` roda se o ponteiro ficar parado até `TEMPO_PRESSAO_LONGA_MS`. */
1034
+ iniciar(l, t, e) {
1035
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.inicio = { x: l, y: t }, this.timer = window.setTimeout(() => {
1036
+ this.suprimir = !0, e();
1037
+ }, zt);
1038
+ }
1039
+ /** Arrastar/rolar com o dedo cancela o clique longo. */
1040
+ mover(l, t) {
1041
+ this.timer === void 0 || !this.inicio || Math.hypot(l - this.inicio.x, t - this.inicio.y) > Mt && this.cancelar();
1042
+ }
1043
+ /** Fim do gesto: cancela a contagem e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
1044
+ fim() {
1045
+ this.cancelar(), this.suprimir && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
1046
+ this.suprimir = !1;
1047
+ }, Pt));
1048
+ }
1049
+ cancelar() {
1050
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0), this.inicio = null;
1051
+ }
1052
+ /** `true` (uma única vez) se o próximo `click` deve ser ignorado por ser o resíduo de uma pressão longa. */
1053
+ consumirSupressao() {
1054
+ return this.suprimir ? (this.suprimir = !1, window.clearTimeout(this.timerSupressao), !0) : !1;
1055
+ }
1056
+ destruir() {
1057
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.suprimir = !1;
1058
+ }
1059
+ }
1060
+ function Rt(o, l) {
1061
+ return o.find(l) ?? o[0];
1062
+ }
1063
+ const Nt = /* @__PURE__ */ new Set(["textbox", "searchbox", "combobox", "spinbutton"]);
1064
+ function Dt(o) {
1065
+ const l = o[0];
1066
+ return l && (/^(INPUT|TEXTAREA|SELECT)$/.test(l.tagName) || l.isContentEditable) ? !0 : o.some((t) => {
1067
+ var r, a;
1068
+ const e = t, i = (r = e.getAttribute) == null ? void 0 : r.call(e, "role");
1069
+ return ((a = e.getAttribute) == null ? void 0 : a.call(e, "aria-modal")) === "true" || !!i && Nt.has(i);
1070
+ });
1071
+ }
1072
+ function It(o, l, t, e) {
1073
+ const i = typeof o == "string" ? { key: o, ctrlKey: !1, metaKey: !1, altKey: !1, shiftKey: !1 } : o;
1074
+ if (!i || !i.key) return null;
1075
+ const r = l.filter((u) => !u.disabled && tt(i, u.atalho));
1076
+ if (r.length === 0) return null;
1077
+ let a = r[0];
1078
+ if (r.length > 1) {
1079
+ const u = r.findIndex((c) => c.id === e);
1080
+ a = r[(u + 1) % r.length];
1081
+ }
1082
+ const n = t.find((u) => {
1083
+ var c;
1084
+ return (c = u.filhos) == null ? void 0 : c.some((s) => s.id === a.id);
1085
+ });
1086
+ return { alvo: a, pai: n };
1087
+ }
1088
+ const Tt = { sm: 16, md: 18, lg: 22 };
1089
+ class Ft extends O {
1090
+ constructor() {
1091
+ super();
1092
+ d(this, "rootElement");
1093
+ d(this, "_ferramentas", []);
1094
+ d(this, "_ativo", "");
1095
+ d(this, "_pendente", "");
1096
+ d(this, "visiveis", /* @__PURE__ */ new Map());
1097
+ // id do grupo → id do filho exibido
1098
+ d(this, "menu", null);
1099
+ d(this, "pressao", new Lt());
1100
+ d(this, "listeners", new N());
1101
+ d(this, "tooltip", null);
1102
+ d(this, "_modoControlado", !1);
1103
+ d(this, "handleClick", (t) => {
1104
+ if (this.pressao.consumirSupressao()) return;
1105
+ const e = t.target.closest(".ui-ferr-btn"), i = e != null && e.dataset.id ? v(this._ferramentas, e.dataset.id) : void 0;
1106
+ if (!e || !i) return;
1107
+ const r = e.dataset.grupo ? v(this._ferramentas, e.dataset.grupo) : void 0;
1108
+ this.acionar(i, r);
1109
+ });
1110
+ d(this, "handleFocusIn", (t) => it(this.botoes(), t.target));
1111
+ d(this, "handlePointerDown", (t) => {
1112
+ const e = t;
1113
+ if (e.pointerType === "mouse" && e.button !== 0) return;
1114
+ const i = t.target.closest(".ui-ferr-btn--grupo");
1115
+ !i || i.disabled || this.pressao.iniciar(e.clientX ?? 0, e.clientY ?? 0, () => this.abrirFlyout(i, !1));
1116
+ });
1117
+ d(this, "handlePointerMove", (t) => {
1118
+ const e = t;
1119
+ this.pressao.mover(e.clientX ?? 0, e.clientY ?? 0);
1120
+ });
1121
+ d(this, "handlePointerFim", () => this.pressao.fim());
1122
+ d(this, "handleContextMenu", (t) => {
1123
+ const e = t.target.closest(".ui-ferr-btn--grupo");
1124
+ e && (t.preventDefault(), this.pressao.cancelar(), this.abrirFlyout(e, !1));
1125
+ });
1126
+ d(this, "handleKeyDown", (t) => {
1127
+ var u;
1128
+ const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = this.colunas;
1129
+ if (!e && r === 2) {
1130
+ if (ct(t, this.botoes(), i)) return;
1131
+ } else {
1132
+ const c = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], s = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
1133
+ if (j(t, this.botoes(), c, s)) return;
1134
+ }
1135
+ const a = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", n = t.target instanceof HTMLButtonElement ? t.target : null;
1136
+ n != null && n.dataset.grupo && t.key === a && (t.preventDefault(), ((u = this.menu) == null ? void 0 : u.ancora) === n ? this.menu.focarPrimeiro() : this.abrirFlyout(n, !0));
1137
+ });
1138
+ d(this, "handleAtalho", (t) => {
1139
+ if (!this.hasAttribute("atalhos") || t.defaultPrevented || Dt(t.composedPath()) || !this.donaDosAtalhos()) return;
1140
+ const e = It(t, this.todasFerramentas(), this._ferramentas, this._ativo);
1141
+ e && (t.preventDefault(), this.acionar(e.alvo, e.pai));
1142
+ });
1143
+ const t = this.attachShadow({ mode: "open" });
1144
+ t.innerHTML = `
1145
+ <style>${Q}${St}</style>
1146
+ <div class="ui-paleta ui-paleta--vertical" part="base" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
1147
+ `, this.rootElement = t.querySelector(".ui-paleta");
1148
+ }
1149
+ static get observedAttributes() {
1150
+ return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "aria-label", "copiar-dados", "modo-controlado", ...Z];
1151
+ }
1152
+ connectedCallback() {
1153
+ var e;
1154
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new rt(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);
1155
+ const t = this.getAttribute("valor") || this.getAttribute("value");
1156
+ t && !this._ativo && (this._pendente = t), R(this, this.rootElement), this.aplicarPendente(), this.renderizar();
1157
+ }
1158
+ disconnectedCallback() {
1159
+ var t;
1160
+ this.pressao.destruir(), this.fecharMenu(), (t = this.tooltip) == null || t.destruir(), this.tooltip = null, this.listeners.cleanup();
1161
+ }
1162
+ attributeChangedCallback(t, e, i) {
1163
+ if (e !== i) {
1164
+ if (J(t)) {
1165
+ R(this, this.rootElement);
1166
+ return;
1167
+ }
1168
+ if (t === "valor" || t === "value") {
1169
+ const r = this.getAttribute("valor") || this.getAttribute("value") || "";
1170
+ r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
1171
+ } else
1172
+ this.renderizar();
1173
+ }
1174
+ }
1175
+ /* ---------- API pública ---------- */
1176
+ /**
1177
+ * Quando `true` ou atributo `copiar-dados` / `modo-controlado`: clona a árvore de itens
1178
+ * para não mutar os objetos fornecidos pelo consumidor (Item 11).
1179
+ */
1180
+ get modoControlado() {
1181
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
1182
+ }
1183
+ set modoControlado(t) {
1184
+ this._modoControlado = !!t;
1185
+ }
1186
+ get copiarDados() {
1187
+ return this.modoControlado;
1188
+ }
1189
+ set copiarDados(t) {
1190
+ this.modoControlado = t;
1191
+ }
1192
+ get ferramentas() {
1193
+ return this._ferramentas;
1194
+ }
1195
+ set ferramentas(t) {
1196
+ const e = Array.isArray(t) ? t : [];
1197
+ this._ferramentas = this.modoControlado ? e.map((i) => {
1198
+ var r;
1199
+ return { ...i, filhos: (r = i.filhos) == null ? void 0 : r.map((a) => ({ ...a })) };
1200
+ }) : e, $(H(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
1201
+ }
1202
+ get valor() {
1203
+ return this._ativo;
1204
+ }
1205
+ set valor(t) {
1206
+ this.ativar(t);
1207
+ }
1208
+ get value() {
1209
+ return this.valor;
1210
+ }
1211
+ set value(t) {
1212
+ this.valor = t;
1213
+ }
1214
+ get orientacao() {
1215
+ return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
1216
+ }
1217
+ set orientacao(t) {
1218
+ this.setAttribute("orientacao", t);
1219
+ }
1220
+ get colunas() {
1221
+ return this.getAttribute("colunas") === "2" ? 2 : 1;
1222
+ }
1223
+ set colunas(t) {
1224
+ this.setAttribute("colunas", String(t));
1225
+ }
1226
+ get tamanho() {
1227
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
1228
+ return t === "sm" || t === "lg" ? t : "md";
1229
+ }
1230
+ set tamanho(t) {
1231
+ this.setAttribute("tamanho", t);
1232
+ }
1233
+ /**
1234
+ * Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
1235
+ * `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
1236
+ */
1237
+ ativar(t, e = !0) {
1238
+ if (!t) {
1239
+ this.limpar(e);
1240
+ return;
1241
+ }
1242
+ const i = v(this._ferramentas, t);
1243
+ if (!i) {
1244
+ this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
1245
+ return;
1246
+ }
1247
+ if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
1248
+ console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
1249
+ return;
1250
+ }
1251
+ this._pendente = "";
1252
+ const r = this._ativo;
1253
+ this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
1254
+ }
1255
+ /** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
1256
+ limpar(t = !0) {
1257
+ const e = this._ativo;
1258
+ !e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
1259
+ }
1260
+ atualizarItem(t, e) {
1261
+ var n;
1262
+ const i = v(this._ferramentas, t);
1263
+ if (!i) {
1264
+ console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
1265
+ return;
1266
+ }
1267
+ Object.assign(i, e);
1268
+ const r = Object.keys(e).every((u) => u === "ativo" || u === "disabled"), a = this._ferramentas.find((u) => {
1269
+ var c;
1270
+ return (c = u.filhos) == null ? void 0 : c.some((s) => s.id === t);
1271
+ });
1272
+ if (r && !(a && "disabled" in e)) {
1273
+ const u = this.botoes().find((c) => c.dataset.id === t || c.dataset.grupo === t);
1274
+ if (u) {
1275
+ y(u, this.itemParaBotao(a ?? i)), et(this.botoes());
1276
+ return;
1277
+ }
1278
+ if (a || (n = i.filhos) != null && n.length) return;
1279
+ }
1280
+ this.renderizar();
1281
+ }
1282
+ /* ---------- Estado interno ---------- */
1283
+ refletirValor(t) {
1284
+ const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
1285
+ this.getAttribute(e) !== t && this.setAttribute(e, t);
1286
+ }
1287
+ aplicarPendente() {
1288
+ if (!this._pendente) return;
1289
+ const t = v(this._ferramentas, this._pendente);
1290
+ 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 = "");
1291
+ }
1292
+ definirAtivoInterno(t) {
1293
+ this._ativo = t;
1294
+ const e = this._ferramentas.find((i) => {
1295
+ var r;
1296
+ return (r = i.filhos) == null ? void 0 : r.some((a) => a.id === t);
1297
+ });
1298
+ e && this.visiveis.set(e.id, t);
1299
+ }
1300
+ emitirMudanca(t, e, i) {
1301
+ const r = { valor: t, item: e, anterior: i };
1302
+ this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
1303
+ }
1304
+ /** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
1305
+ itemExibido(t) {
1306
+ var a;
1307
+ if (!((a = t.filhos) != null && a.length)) return t;
1308
+ const e = (n) => n.tipo !== "separador" && !n.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((n) => n.id === i);
1309
+ return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((n) => n.tipo !== "separador") ?? t.filhos[0];
1310
+ }
1311
+ itemParaBotao(t) {
1312
+ const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
1313
+ return {
1314
+ ...e,
1315
+ tipo: i,
1316
+ ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
1317
+ filhos: t.filhos
1318
+ };
1319
+ }
1320
+ todasFerramentas() {
1321
+ return this._ferramentas.flatMap((t) => {
1322
+ var e;
1323
+ return (e = t.filhos) != null && e.length ? t.filhos : [t];
1324
+ }).filter((t) => t.tipo !== "separador");
1325
+ }
1326
+ /* ---------- Renderização ---------- */
1327
+ renderizar() {
1328
+ var c;
1329
+ const t = (c = this.shadowRoot) == null ? void 0 : c.activeElement, e = t && t.classList.contains("ui-ferr-btn") ? { id: t.dataset.id ?? "", grupo: t.dataset.grupo ?? "" } : null;
1330
+ this.fecharMenu();
1331
+ const i = this.orientacao, r = this.tamanho, a = this.colunas;
1332
+ 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 = "";
1333
+ const n = Tt[r] ?? 18;
1334
+ this._ferramentas.forEach((s) => {
1335
+ var m;
1336
+ if (s.tipo === "separador") {
1337
+ const g = document.createElement("div");
1338
+ g.className = "ui-paleta__sep", g.setAttribute("role", "separator"), this.rootElement.appendChild(g);
1339
+ return;
1340
+ }
1341
+ const h = this.itemExibido(s), b = G(this.itemParaBotao(s), "paleta", n);
1342
+ b.dataset.id = h.id, (m = s.filhos) != null && m.length && (b.dataset.grupo = s.id), this.rootElement.appendChild(b);
1343
+ }), V(this.botoes());
1344
+ const u = this.botoes().find((s) => s.dataset.id === this._ativo && !s.disabled);
1345
+ if (u && (this.botoes().forEach((s) => s.tabIndex = -1), u.tabIndex = 0), e) {
1346
+ const s = this.botoes().find((h) => e.grupo ? h.dataset.grupo === e.grupo : h.dataset.id === e.id);
1347
+ s && !s.disabled && s.focus();
1348
+ }
1349
+ }
1350
+ botoes() {
1351
+ return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
1352
+ }
1353
+ /** Reflete no botão o estado atual do item (sem recriar o DOM). */
1354
+ atualizarBotaoDe(t, e) {
1355
+ const i = this.botoes().find((r) => r.dataset.id === t.id);
1356
+ i && y(i, this.itemParaBotao(e ?? t));
1357
+ }
1358
+ /* ---------- Interação ---------- */
1359
+ acionar(t, e) {
1360
+ if (t.disabled) return;
1361
+ const i = t.tipo ?? "ferramenta", r = this._ativo, a = t.ativo;
1362
+ i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
1363
+ new CustomEvent("ui-ferramenta", {
1364
+ detail: {
1365
+ id: t.id,
1366
+ item: t,
1367
+ pai: e,
1368
+ ativo: i === "ferramenta" ? !0 : t.ativo,
1369
+ origem: "paleta"
1370
+ },
1371
+ bubbles: !0,
1372
+ composed: !0,
1373
+ cancelable: !0
1374
+ })
1375
+ ) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = a, this.atualizarBotaoDe(t, e)));
1376
+ }
1377
+ /** Várias paletas com `atalhos` na página: só a que contém o foco (ou a primeira no DOM) responde. */
1378
+ donaDosAtalhos() {
1379
+ const t = Array.from(document.querySelectorAll("ui-paleta-ferramentas[atalhos]"));
1380
+ return t.length <= 1 ? !0 : Rt(t, (e) => {
1381
+ var i;
1382
+ return e.matches(":focus-within") || !!((i = e.shadowRoot) != null && i.activeElement);
1383
+ }) === this;
1384
+ }
1385
+ abrirFlyout(t, e) {
1386
+ var a;
1387
+ const i = t.dataset.grupo ? v(this._ferramentas, t.dataset.grupo) : void 0;
1388
+ if (!((a = i == null ? void 0 : i.filhos) != null && a.length)) return;
1389
+ this.fecharMenu();
1390
+ const r = i.filhos.map((n) => ({
1391
+ ...n,
1392
+ ativo: (n.tipo ?? "ferramenta") === "ferramenta" ? n.id === this._ativo : n.ativo
1393
+ }));
1394
+ t.setAttribute("aria-expanded", "true"), this.menu = k(
1395
+ this.shadowRoot,
1396
+ t,
1397
+ r,
1398
+ (n) => {
1399
+ var c;
1400
+ const u = v(i.filhos, n.id);
1401
+ u && (this.acionar(u, i), (c = this.botoes().find((s) => s.dataset.grupo === i.id)) == null || c.focus());
1402
+ },
1403
+ {
1404
+ lado: this.getAttribute("orientacao") === "horizontal" ? "baixo" : "direita",
1405
+ focar: e,
1406
+ tipoPadrao: "ferramenta",
1407
+ onFechar: () => {
1408
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
1409
+ }
1410
+ }
1411
+ );
1412
+ }
1413
+ fecharMenu() {
1414
+ var t;
1415
+ (t = this.menu) == null || t.fechar(), this.menu = null;
1416
+ }
1417
+ }
1418
+ B("ui-paleta-ferramentas", Ft);
1419
+ export {
1420
+ lt as U,
1421
+ Ft as a,
1422
+ kt as b
1423
+ };