@thibezer/ui-components-kit 2.24.0 → 2.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/dist/botao.cjs +12 -1
  3. package/dist/botao.js +162 -3
  4. package/dist/camadas.cjs +311 -1
  5. package/dist/camadas.js +3244 -148
  6. package/dist/campo-texto.cjs +16 -1
  7. package/dist/campo-texto.js +308 -7
  8. package/dist/canvas.cjs +22 -22
  9. package/dist/canvas.js +230 -233
  10. package/dist/card.cjs +20 -1
  11. package/dist/card.js +145 -2
  12. package/dist/components/ui-canvas-prancha/index.d.ts +1 -1
  13. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +18 -0
  14. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +4 -0
  15. package/dist/components/ui-card/ui-card.d.ts +4 -0
  16. package/dist/components/ui-editor-prancha/editor-modos.d.ts +10 -0
  17. package/dist/components/ui-editor-prancha/editor-tipos.d.ts +4 -0
  18. package/dist/components/ui-editor-prancha/index.d.ts +1 -0
  19. package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +39 -6
  20. package/dist/core.cjs +1 -1
  21. package/dist/core.js +44 -55
  22. package/dist/{cores-utils-BrdynxRd.js → cores-utils-DMyqWvZh.js} +2 -2
  23. package/dist/cores.cjs +32 -1
  24. package/dist/cores.js +300 -13
  25. package/dist/custom-elements.json +33962 -33439
  26. package/dist/data.cjs +28 -1
  27. package/dist/data.js +286 -99
  28. package/dist/{feature_caixa-2Sxv3tGa.js → feature_caixa-BVc5LenS.js} +42 -42
  29. package/dist/{feature_desenho-BVHivWIB.js → feature_desenho-CC8Mp5Gp.js} +2 -2
  30. package/dist/feedback.cjs +52 -1
  31. package/dist/feedback.js +655 -25
  32. package/dist/forms.cjs +66 -1
  33. package/dist/forms.js +1216 -39
  34. package/dist/{geometria-px-DUs5FgLE.js → geometria-px-DHMPUsxC.js} +47 -47
  35. package/dist/index.cjs +67 -1
  36. package/dist/index.js +1476 -274
  37. package/dist/kit-base-CGqj9aiD.cjs +2 -0
  38. package/dist/kit-base-_THn4w3u.js +1079 -0
  39. package/dist/mapa.cjs +5 -5
  40. package/dist/mapa.js +16 -17
  41. package/dist/modal.cjs +18 -1
  42. package/dist/modal.js +235 -29
  43. package/dist/motor.js +49 -49
  44. package/dist/prancha-nucleo.cjs +3 -1
  45. package/dist/prancha-nucleo.js +3120 -277
  46. package/dist/prancha.cjs +38 -1
  47. package/dist/prancha.js +3233 -228
  48. package/dist/register.cjs +1 -1
  49. package/dist/register.js +3 -20
  50. package/dist/seletor-mapa-base.cjs +13 -13
  51. package/dist/seletor-mapa-base.js +3 -5
  52. package/dist/tabela.cjs +142 -1
  53. package/dist/tabela.js +3773 -92
  54. package/dist/tipos-elementos.d.ts +5 -1
  55. package/dist/tipos-vue.d.ts +4 -1
  56. package/dist/tools.cjs +16 -1
  57. package/dist/tools.js +1564 -26
  58. package/dist/ui-seletor-cor-BGw8SBPm.cjs +83 -0
  59. package/dist/{ui-seletor-cor-Cd8jkzXG.js → ui-seletor-cor-B_twSm-V.js} +8 -9
  60. package/dist/utils-ClVgqVyJ.cjs +1 -0
  61. package/dist/utils-DrHoxxmf.js +83 -0
  62. package/package.json +43 -2
  63. package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
  64. package/dist/acessibilidade-CUlSXc2X.js +0 -38
  65. package/dist/altura-controle-ukMRPckR.cjs +0 -1
  66. package/dist/altura-controle-vxQiXG4q.js +0 -62
  67. package/dist/alvo-digitavel-CzCvNVQ3.js +0 -23
  68. package/dist/alvo-digitavel-DbH0hYFf.cjs +0 -1
  69. package/dist/degrade-CIxvOTUv.cjs +0 -1
  70. package/dist/degrade-gDa5sW__.js +0 -119
  71. package/dist/feature_caixa-CnYPKVFS.cjs +0 -1
  72. package/dist/feature_caixa-DCs9ZeSk.js +0 -1038
  73. package/dist/feature_historico-BAIYk1Me.cjs +0 -3
  74. package/dist/feature_historico-C4h9y5fu.js +0 -3039
  75. package/dist/form-atalhos-7JTYvumA.cjs +0 -1
  76. package/dist/form-atalhos-DDTlpgaB.js +0 -203
  77. package/dist/form-erros-CwPz7Jr4.cjs +0 -1
  78. package/dist/form-erros-DT5HklfD.js +0 -184
  79. package/dist/form-submissao-C-SPRKgT.js +0 -61
  80. package/dist/form-submissao-DxKO5MHI.cjs +0 -1
  81. package/dist/form-validacao-BlQFxUVj.js +0 -104
  82. package/dist/form-validacao-DIeyQVH5.cjs +0 -1
  83. package/dist/geometria-px-DKrWq_XY.js +0 -639
  84. package/dist/leaflet-CEPcxGWV.cjs +0 -1
  85. package/dist/leaflet-DOq10gfg.js +0 -84
  86. package/dist/leaflet-loader-94z5VsdY.cjs +0 -2
  87. package/dist/leaflet-loader-Cjcdgj5R.js +0 -21
  88. package/dist/listener-bag-D5omxZ9h.cjs +0 -1
  89. package/dist/listener-bag-DQgv7OON.js +0 -34
  90. package/dist/motor-By2te6PZ.js +0 -1400
  91. package/dist/motor-CkMxd378.cjs +0 -1
  92. package/dist/opcoes-CupvWVIm.js +0 -24
  93. package/dist/opcoes-vdAUY5OI.cjs +0 -1
  94. package/dist/parts-CaoQiCfI.js +0 -7
  95. package/dist/parts-vQa2873h.cjs +0 -1
  96. package/dist/prancha-paleta-BZ-9QDgh.js +0 -5276
  97. package/dist/prancha-paleta-Bb24vP71.cjs +0 -17
  98. package/dist/ssr-safe-5cWfJP-s.js +0 -10
  99. package/dist/ssr-safe-CiHD1adl.cjs +0 -1
  100. package/dist/svg-seguro-ChVJ2L2z.js +0 -74
  101. package/dist/svg-seguro-J2RM1Ssf.cjs +0 -1
  102. package/dist/ui-badge-DE58YSBY.cjs +0 -28
  103. package/dist/ui-badge-KgmI3jOD.js +0 -201
  104. package/dist/ui-botao-Dz8YvmiA.cjs +0 -12
  105. package/dist/ui-botao-zLkcMMyP.js +0 -168
  106. package/dist/ui-bus-CUd99VJi.js +0 -177
  107. package/dist/ui-bus-XqBLlTYQ.cjs +0 -1
  108. package/dist/ui-camadas-DoHPnbQm.js +0 -3133
  109. package/dist/ui-camadas-Vx7wYD4D.cjs +0 -311
  110. package/dist/ui-campo-texto-Dliyt9qr.cjs +0 -16
  111. package/dist/ui-campo-texto-btevggO3.js +0 -379
  112. package/dist/ui-card-7IEYbCN0.js +0 -150
  113. package/dist/ui-card-Bx8EyzYY.cjs +0 -20
  114. package/dist/ui-card-DFnRp9bl.js +0 -146
  115. package/dist/ui-card-DrWVJQKw.cjs +0 -20
  116. package/dist/ui-controle-cores-B1w_Yl69.cjs +0 -32
  117. package/dist/ui-controle-cores-BRjMvmMn.js +0 -291
  118. package/dist/ui-controle-cores-BcH9k2Fa.js +0 -292
  119. package/dist/ui-controle-cores-CvSTP6gJ.cjs +0 -32
  120. package/dist/ui-editor-prancha-CIngI6yI.js +0 -2886
  121. package/dist/ui-editor-prancha-DorSe6sC.cjs +0 -31
  122. package/dist/ui-linha-2kY7TNUJ.cjs +0 -38
  123. package/dist/ui-linha-B4mBRm1x.cjs +0 -61
  124. package/dist/ui-linha-DTEIIww4.js +0 -1167
  125. package/dist/ui-linha-KFF86FW5.js +0 -752
  126. package/dist/ui-modal-BrXzVZ65.js +0 -216
  127. package/dist/ui-modal-lARKzEVZ.cjs +0 -18
  128. package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +0 -1245
  129. package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +0 -21
  130. package/dist/ui-paleta-ferramentas-DebHYiwd.js +0 -1615
  131. package/dist/ui-paleta-ferramentas-Dgejtluh.js +0 -1423
  132. package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +0 -22
  133. package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +0 -22
  134. package/dist/ui-seletor-cor-0RLjcME6.cjs +0 -83
  135. package/dist/ui-seletor-cor-CMuuW-Ym.cjs +0 -83
  136. package/dist/ui-seletor-cor-DFIQ1sin.js +0 -405
  137. package/dist/ui-skeleton-BLEV6h3k.js +0 -653
  138. package/dist/ui-skeleton-B_XTaGrX.cjs +0 -52
  139. package/dist/ui-switch-BXIDwC-Y.cjs +0 -66
  140. package/dist/ui-switch-Ctxk-jKS.js +0 -1212
  141. package/dist/ui-tabela-CXxqbwXv.cjs +0 -7
  142. package/dist/ui-tabela-Cd0vOwnT.js +0 -1459
  143. package/dist/ui-tabela-propriedades-C5cIF5ES.js +0 -3779
  144. package/dist/ui-tabela-propriedades-CJyo568n.js +0 -3517
  145. package/dist/ui-tabela-propriedades-D96Djx-q.cjs +0 -136
  146. package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +0 -142
  147. package/dist/ui-tabela-propriedades-ahQhQauu.js +0 -2329
  148. package/dist/ui-tabela-propriedades-w9JWhjHy.cjs +0 -142
  149. package/dist/zero-js-triggers-CJT988bR.js +0 -83
  150. package/dist/zero-js-triggers-CgM9IIQB.cjs +0 -1
package/dist/tools.js CHANGED
@@ -1,30 +1,1568 @@
1
+ var ut = Object.defineProperty;
2
+ var dt = (a, s, t) => s in a ? ut(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
+ var h = (a, s, t) => dt(a, typeof s != "symbol" ? s + "" : s, t);
1
4
  /* empty css */
2
- import { a as o, b as l } from "./ui-paleta-ferramentas-DebHYiwd.js";
3
- const a = (t) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`, h = {
4
- selecionar: a('<path d="M4 3l7 17 2.5-7.5L21 10z"/>'),
5
- mover: a('<path d="M5 9l-3 3 3 3M9 5l3-3 3 3M15 19l-3 3-3-3M19 9l3 3-3 3M2 12h20M12 2v20"/>'),
6
- mao: a('<path d="M18 11V6a2 2 0 0 0-4 0M14 10V4a2 2 0 0 0-4 0v2M10 10.5V6a2 2 0 0 0-4 0v8M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.9-5.9-2.4L3.4 16a2 2 0 0 1 3.2-2.4L8 15"/>'),
7
- zoom: a('<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><path d="M11 8v6M8 11h6"/>'),
8
- linha: a('<line x1="5" y1="19" x2="19" y2="5"/><circle cx="5" cy="19" r="1.5"/><circle cx="19" cy="5" r="1.5"/>'),
9
- polilinha: a('<polyline points="3 17 9 11 13 15 21 7"/>'),
10
- retangulo: a('<rect x="3" y="5" width="18" height="14" rx="1"/>'),
11
- circulo: a('<circle cx="12" cy="12" r="9"/>'),
12
- arco: a('<path d="M4 18a9 9 0 0 1 16 0"/>'),
13
- ponto: a('<circle cx="12" cy="12" r="3"/>'),
14
- texto: a('<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'),
15
- caneta: a('<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.6 7.6"/>'),
16
- medir: a('<rect x="2" y="8" width="20" height="8" rx="1"/><path d="M6 8v3M10 8v4M14 8v3M18 8v4"/>'),
17
- camadas: a('<polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/>'),
18
- grade: a('<path d="M3 3h18v18H3zM3 9h18M3 15h18M9 3v18M15 3v18"/>'),
19
- desfazer: a('<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-15-6.7L3 13"/>'),
20
- refazer: a('<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 15-6.7L21 13"/>'),
21
- colar: a('<rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>'),
22
- copiar: a('<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>'),
23
- negrito: a('<path d="M6 4h8a4 4 0 0 1 0 8H6zM6 12h9a4 4 0 0 1 0 8H6z"/>'),
24
- italico: a('<line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/>')
5
+ import { L as $, X as ct, S as Q, A as tt, g as j, s as et, d as it } from "./kit-base-_THn4w3u.js";
6
+ const g = (a) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${a}</svg>`, Jt = {
7
+ selecionar: g('<path d="M4 3l7 17 2.5-7.5L21 10z"/>'),
8
+ mover: g('<path d="M5 9l-3 3 3 3M9 5l3-3 3 3M15 19l-3 3-3-3M19 9l3 3-3 3M2 12h20M12 2v20"/>'),
9
+ mao: g('<path d="M18 11V6a2 2 0 0 0-4 0M14 10V4a2 2 0 0 0-4 0v2M10 10.5V6a2 2 0 0 0-4 0v8M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.9-5.9-2.4L3.4 16a2 2 0 0 1 3.2-2.4L8 15"/>'),
10
+ zoom: g('<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><path d="M11 8v6M8 11h6"/>'),
11
+ linha: g('<line x1="5" y1="19" x2="19" y2="5"/><circle cx="5" cy="19" r="1.5"/><circle cx="19" cy="5" r="1.5"/>'),
12
+ polilinha: g('<polyline points="3 17 9 11 13 15 21 7"/>'),
13
+ retangulo: g('<rect x="3" y="5" width="18" height="14" rx="1"/>'),
14
+ circulo: g('<circle cx="12" cy="12" r="9"/>'),
15
+ arco: g('<path d="M4 18a9 9 0 0 1 16 0"/>'),
16
+ ponto: g('<circle cx="12" cy="12" r="3"/>'),
17
+ texto: g('<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'),
18
+ caneta: g('<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.6 7.6"/>'),
19
+ medir: g('<rect x="2" y="8" width="20" height="8" rx="1"/><path d="M6 8v3M10 8v4M14 8v3M18 8v4"/>'),
20
+ camadas: g('<polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/>'),
21
+ grade: g('<path d="M3 3h18v18H3zM3 9h18M3 15h18M9 3v18M15 3v18"/>'),
22
+ desfazer: g('<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-15-6.7L3 13"/>'),
23
+ refazer: g('<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 15-6.7L21 13"/>'),
24
+ colar: g('<rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>'),
25
+ copiar: g('<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>'),
26
+ negrito: g('<path d="M6 4h8a4 4 0 0 1 0 8H6zM6 12h9a4 4 0 0 1 0 8H6z"/>'),
27
+ italico: g('<line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/>')
28
+ }, ht = ':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}}', rt = '.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}}';
29
+ function N(a, s) {
30
+ if (!a) return null;
31
+ const t = document.createElement("ui-icone");
32
+ if (t.setAttribute("tamanho", String(s)), a.trimStart().startsWith("<")) {
33
+ const e = ct(a);
34
+ if (!e) return null;
35
+ t.appendChild(e);
36
+ } else
37
+ t.setAttribute("nome", a);
38
+ return t;
39
+ }
40
+ const X = /* @__PURE__ */ new Set();
41
+ function M(a) {
42
+ return a.rotuloAcessivel ? a.rotuloAcessivel : a.rotulo ? a.rotulo : a.icone && !a.icone.trimStart().startsWith("<") ? a.icone : (X.has(a.id) || (X.add(a.id), console.warn(`[ui-barra-ferramentas] O item "${a.id}" não tem "rotulo" nem "rotuloAcessivel": o id será usado como nome acessível.`)), a.id);
43
+ }
44
+ function H(a, s) {
45
+ const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
46
+ a.forEach((i) => t.has(i) ? e.add(i) : t.add(i)), e.size && console.warn(`[ui-barra-ferramentas] ${s}: ids duplicados (${[...e].join(", ")}). Use ids únicos, senão atualizarItem() e os eventos podem atingir o item errado.`);
47
+ }
48
+ function K(a, s = []) {
49
+ for (const t of a)
50
+ t.tipo !== "separador" && (s.push(t.id), t.filhos && K(t.filhos, s));
51
+ return s;
52
+ }
53
+ function k(a, s) {
54
+ a.disabled = !!s.disabled;
55
+ const t = s.tipo, e = t === "toggle" || t === "ferramenta";
56
+ e ? a.setAttribute("aria-pressed", String(!!s.ativo)) : a.removeAttribute("aria-pressed"), a.classList.toggle("ui-ferr-btn--ativo", e && !!s.ativo);
57
+ }
58
+ function O(a, s, t) {
59
+ var n;
60
+ const e = document.createElement("button");
61
+ e.type = "button", e.className = `ui-ferr-btn ui-ferr-btn--${s}`, e.dataset.id = a.id, e.tabIndex = -1;
62
+ const i = !!((n = a.filhos) != null && n.length), r = s !== "paleta" && !a.somenteIcone && !!a.rotulo;
63
+ a.rotuloAcessivel ? e.setAttribute("aria-label", a.rotuloAcessivel) : r ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", M(a)), a.atalho && e.setAttribute("aria-keyshortcuts", a.atalho), e.dataset.tooltip = M(a), a.atalho && (e.dataset.atalho = a.atalho);
64
+ const o = N(a.icone, t);
65
+ if (o) {
66
+ const u = document.createElement("span");
67
+ u.className = "ui-ferr-btn__icone", u.appendChild(o), e.appendChild(u);
68
+ }
69
+ if (s !== "paleta" && a.somenteIcone && e.classList.add("ui-ferr-btn--so-icone"), r) {
70
+ const u = document.createElement("span");
71
+ u.className = "ui-ferr-btn__rotulo", u.textContent = a.rotulo, e.appendChild(u);
72
+ }
73
+ if (i && !a.dividido) {
74
+ if (s === "paleta")
75
+ e.classList.add("ui-ferr-btn--grupo");
76
+ else {
77
+ const u = document.createElement("span");
78
+ u.className = "ui-ferr-btn__caret", e.appendChild(u);
79
+ }
80
+ e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", "false");
81
+ }
82
+ return k(e, a), e;
83
+ }
84
+ function bt(a, s, t) {
85
+ const e = document.createElement("div");
86
+ e.className = `ui-ferr-split ui-ferr-split--${s}`, e.dataset.id = a.id;
87
+ const i = O({ ...a, filhos: void 0, dividido: !1 }, s, t);
88
+ i.classList.add("ui-ferr-split__acao"), i.dataset.split = "acao";
89
+ const r = document.createElement("button");
90
+ r.type = "button", r.className = `ui-ferr-btn ui-ferr-split__gatilho ui-ferr-btn--${s}`, r.dataset.id = a.id, r.dataset.split = "gatilho", r.tabIndex = -1, r.disabled = !!a.disabled, r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), r.setAttribute("aria-label", `Opções de ${M(a)}`), r.dataset.tooltip = `Opções de ${M(a)}`;
91
+ const o = document.createElement("span");
92
+ return o.className = "ui-ferr-btn__caret", r.appendChild(o), e.appendChild(i), e.appendChild(r), e;
93
+ }
94
+ function A(a, s) {
95
+ for (const t of a) {
96
+ if (t.id === s) return t;
97
+ if (t.filhos) {
98
+ const e = A(t.filhos, s);
99
+ if (e) return e;
100
+ }
101
+ }
102
+ }
103
+ function at(a, s) {
104
+ if (!s || !s.trim()) return !1;
105
+ const t = s.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)), o = t.some((b) => /^shift$/i.test(b)), n = a.ctrlKey || a.metaKey, u = a.altKey, d = a.shiftKey;
106
+ if (i !== n || r !== u || o !== d) return !1;
107
+ const l = e.toLowerCase(), c = (a.key || "").toLowerCase();
108
+ return l === "esc" || l === "escape" ? c === "escape" : l === "del" || l === "delete" ? c === "delete" : l === "enter" ? c === "enter" : l === "space" || l === "espaço" ? c === " " || c === "space" : c === l;
109
+ }
110
+ function W(a) {
111
+ const s = a.filter((t) => !t.disabled);
112
+ a.forEach((t) => t.tabIndex = -1), s.length && (s[0].tabIndex = 0);
113
+ }
114
+ function ot(a) {
115
+ const s = a.find((t) => t.tabIndex === 0 && !t.disabled);
116
+ s ? a.forEach((t) => {
117
+ t !== s && (t.tabIndex = -1);
118
+ }) : W(a);
119
+ }
120
+ function st(a, s) {
121
+ const t = a.find((e) => e === s || e.contains(s));
122
+ !t || t.disabled || a.forEach((e) => e.tabIndex = e === t ? 0 : -1);
123
+ }
124
+ function G(a, s, t, e) {
125
+ const i = s.filter((u) => !u.disabled), r = i.length, o = i.findIndex((u) => u === a.target);
126
+ if (r === 0 || o < 0) return !1;
127
+ let n = o;
128
+ if (t.includes(a.key)) n = (o - 1 + r) % r;
129
+ else if (e.includes(a.key)) n = (o + 1) % r;
130
+ else if (a.key === "Home") n = 0;
131
+ else if (a.key === "End") n = r - 1;
132
+ else return !1;
133
+ return a.preventDefault(), s.forEach((u) => u.tabIndex = -1), i[n].tabIndex = 0, i[n].focus(), !0;
134
+ }
135
+ function pt(a, s, t = !1) {
136
+ const e = s.filter((u) => !u.disabled), i = e.length, r = e.findIndex((u) => u === a.target);
137
+ if (i === 0 || r < 0) return !1;
138
+ let o = r;
139
+ const n = r % 2;
140
+ if (a.key === "ArrowRight")
141
+ t ? n === 1 && (o = r - 1) : n === 0 && r + 1 < i && (o = r + 1);
142
+ else if (a.key === "ArrowLeft")
143
+ t ? n === 0 && r + 1 < i && (o = r + 1) : n === 1 && (o = r - 1);
144
+ else if (a.key === "ArrowDown")
145
+ r + 2 < i ? o = r + 2 : r + 1 < i && n === 0 && (o = r + 1);
146
+ else if (a.key === "ArrowUp")
147
+ r - 2 >= 0 ? o = r - 2 : r - 1 >= 0 && n === 1 && (o = r - 1);
148
+ else if (a.key === "Home")
149
+ o = 0;
150
+ else if (a.key === "End")
151
+ o = i - 1;
152
+ else
153
+ return !1;
154
+ return a.preventDefault(), s.forEach((u) => u.tabIndex = -1), e[o].tabIndex = 0, e[o].focus(), !0;
155
+ }
156
+ let ft = 0;
157
+ class nt {
158
+ constructor(s, t) {
159
+ h(this, "el");
160
+ h(this, "textoEl");
161
+ h(this, "atalhoEl");
162
+ h(this, "timer");
163
+ h(this, "alvoAtual", null);
164
+ h(this, "id", `ui-ferr-tooltip-${++ft}`);
165
+ h(this, "listeners", new $());
166
+ this.raiz = s, 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) => {
167
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
168
+ if (i && i !== this.alvoAtual) {
169
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", o = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
170
+ r && this.agendar(i, r, o);
171
+ }
172
+ }), this.listeners.add(t, "pointerout", (e) => {
173
+ const r = e.relatedTarget;
174
+ this.alvoAtual && (!r || !this.alvoAtual.contains(r)) && this.esconder();
175
+ }), this.listeners.add(t, "focusin", (e) => {
176
+ const i = e.target.closest(".ui-ferr-btn, .ui-ribbon__fixar, .ui-ribbon__lancador");
177
+ if (i) {
178
+ const r = i.dataset.tooltip || i.getAttribute("aria-label") || "", o = i.dataset.atalho || i.getAttribute("aria-keyshortcuts") || "";
179
+ r && this.mostrar(i, r, o);
180
+ }
181
+ }), 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());
182
+ }
183
+ agendar(s, t, e) {
184
+ this.limparTimer(), this.timer = window.setTimeout(() => this.mostrar(s, t, e), 140);
185
+ }
186
+ mostrar(s, t, e) {
187
+ if (this.limparTimer(), !s.isConnected || !t) return;
188
+ this.alvoAtual = s, 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"), s.setAttribute("aria-describedby", this.id);
189
+ const i = s.getBoundingClientRect(), r = this.el.getBoundingClientRect();
190
+ let o = i.bottom + 6, n = i.left + (i.width - (r.width || 80)) / 2;
191
+ o + (r.height || 24) > window.innerHeight - 6 && (o = 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 = `${o}px`, this.el.style.left = `${n}px`;
192
+ }
193
+ esconder() {
194
+ 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");
195
+ }
196
+ limparTimer() {
197
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0);
198
+ }
199
+ destruir() {
200
+ this.esconder(), this.listeners.cleanup(), this.el.remove();
201
+ }
202
+ }
203
+ let mt = 0;
204
+ function P(a, s, t, e, i = {}) {
205
+ var z;
206
+ const r = i.lado ?? "baixo", o = new $(), n = document.createElement("div");
207
+ n.className = "ui-ferr-menu", n.setAttribute("role", "menu"), n.id = `ui-ferr-menu-${++mt}`, n.setAttribute("aria-label", s.getAttribute("aria-label") || "Menu"), s.setAttribute("aria-controls", n.id);
208
+ const u = [];
209
+ let d = !1, l = null;
210
+ const c = () => {
211
+ l && (l.fechar(), l = null);
212
+ }, b = () => {
213
+ var p;
214
+ d || (d = !0, c(), s.removeAttribute("aria-controls"), o.cleanup(), n.remove(), (p = i.onFechar) == null || p.call(i));
215
+ }, m = getComputedStyle(s).direction === "rtl";
216
+ t.forEach((p) => {
217
+ var U;
218
+ if (p.tipo === "separador") {
219
+ const E = document.createElement("div");
220
+ E.className = "ui-ferr-menu__sep", E.setAttribute("role", "separator"), n.appendChild(E);
221
+ return;
222
+ }
223
+ const f = document.createElement("button");
224
+ f.type = "button", f.className = "ui-ferr-menu__item";
225
+ const R = p.tipo ?? i.tipoPadrao ?? "botao";
226
+ R === "toggle" ? (f.setAttribute("role", "menuitemcheckbox"), f.setAttribute("aria-checked", String(!!p.ativo))) : R === "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");
227
+ const L = document.createElement("span");
228
+ L.className = "ui-ferr-menu__icone";
229
+ const D = N(p.icone, 14);
230
+ D && L.appendChild(D), f.appendChild(L);
231
+ const y = document.createElement("span");
232
+ if (y.className = "ui-ferr-menu__rotulo", y.textContent = M(p), f.appendChild(y), p.atalho) {
233
+ const E = document.createElement("span");
234
+ E.className = "ui-ferr-menu__atalho", E.textContent = p.atalho, f.appendChild(E);
235
+ }
236
+ if (!!((U = p.filhos) != null && U.length)) {
237
+ f.classList.add("ui-ferr-menu__item--has-sub"), f.setAttribute("aria-haspopup", "menu"), f.setAttribute("aria-expanded", "false");
238
+ const E = document.createElement("span");
239
+ E.className = "ui-ferr-menu__caret-sub", f.appendChild(E);
240
+ const Y = (q) => {
241
+ (l == null ? void 0 : l.ancora) !== f && (c(), f.setAttribute("aria-expanded", "true"), l = P(a, f, p.filhos, e, {
242
+ lado: m ? "esquerda" : "direita",
243
+ focar: q,
244
+ tipoPadrao: i.tipoPadrao,
245
+ onFechar: () => {
246
+ f.setAttribute("aria-expanded", "false"), l = null;
247
+ }
248
+ }));
249
+ };
250
+ f.addEventListener("pointerenter", () => Y(!1)), f.addEventListener("click", (q) => {
251
+ q.stopPropagation(), Y(!0);
252
+ });
253
+ } else
254
+ f.addEventListener("pointerenter", c), f.addEventListener("click", (E) => {
255
+ E.stopPropagation(), b(), s.focus(), e(p);
256
+ });
257
+ u.push(f), n.appendChild(f);
258
+ }), a.appendChild(n);
259
+ const x = s.getBoundingClientRect(), v = n.getBoundingClientRect();
260
+ let w = r === "baixo" ? x.bottom + 2 : x.top, C = r === "direita" ? x.right + 4 : r === "esquerda" ? x.left - v.width - 4 : m ? x.right - v.width : x.left;
261
+ v.width && C + v.width > window.innerWidth - 4 && (C = Math.max(4, window.innerWidth - v.width - 4)), C < 4 && (C = 4), v.height && w + v.height > window.innerHeight - 4 && (w = Math.max(4, window.innerHeight - v.height - 4)), n.style.top = `${w}px`, n.style.left = `${C}px`;
262
+ const S = () => u.filter((p) => !p.disabled);
263
+ return o.add(n, "keydown", (p) => {
264
+ const f = S(), R = f.findIndex((y) => y === p.target), L = m ? "ArrowLeft" : "ArrowRight", D = m ? "ArrowRight" : "ArrowLeft";
265
+ if (p.key === "Escape")
266
+ p.preventDefault(), p.stopPropagation(), b(), s.focus();
267
+ else if (p.key === "Tab")
268
+ b();
269
+ else if (f.length && (p.key === "ArrowDown" || p.key === "ArrowUp")) {
270
+ p.preventDefault(), c();
271
+ const y = p.key === "ArrowDown" ? 1 : -1;
272
+ f[(R + y + f.length) % f.length].focus();
273
+ } else if (f.length && p.key === L) {
274
+ const y = f[R];
275
+ y != null && y.classList.contains("ui-ferr-menu__item--has-sub") && (p.preventDefault(), y.click());
276
+ } else p.key === D && (r === "direita" || r === "esquerda") ? (p.preventDefault(), p.stopPropagation(), b(), s.focus()) : f.length && p.key === "Home" ? (p.preventDefault(), f[0].focus()) : f.length && p.key === "End" && (p.preventDefault(), f[f.length - 1].focus());
277
+ }), o.add(document, "pointerdown", (p) => {
278
+ const f = p.composedPath();
279
+ !f.includes(n) && !f.includes(s) && !(l != null && l.elemento.contains(p.target)) && b();
280
+ }, !0), o.add(window, "resize", b), o.add(window, "scroll", (p) => {
281
+ p.target instanceof Node && n.contains(p.target) || b();
282
+ }, !0), i.focar && ((z = S()[0]) == null || z.focus()), { elemento: n, ancora: s, fechar: b, focarPrimeiro: () => {
283
+ var p;
284
+ return (p = S()[0]) == null ? void 0 : p.focus();
285
+ } };
286
+ }
287
+ const vt = 3;
288
+ function gt({ aba: a, ativa: s, idBotao: t, idPainel: e }) {
289
+ const i = document.createElement("button");
290
+ return i.type = "button", i.className = "ui-ribbon__aba", i.setAttribute("role", "tab"), i.dataset.id = a.id, i.id = t, s && i.setAttribute("aria-controls", e), i.textContent = a.rotulo, i.tabIndex = s ? 0 : -1, i.setAttribute("aria-selected", String(s)), i.classList.toggle("ui-ribbon__aba--ativa", s), i.classList.toggle("ui-ribbon__aba--contextual", !!a.contextual), i;
291
+ }
292
+ const xt = '<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" fill="none"/></svg>', _t = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 12h8V4M12 12l-7-7"/></svg>', At = (a) => a.rotuloLancador || `Mais opções de ${a.rotulo || "ferramentas"}`;
293
+ function yt(a, s) {
294
+ s.classList.add("ui-ribbon__grupo--colapsado");
295
+ const t = document.createElement("button");
296
+ t.type = "button", t.className = "ui-ferr-btn ui-ferr-btn--grande ui-ribbon__btn-colapsado", t.dataset.grupoColapsado = a.id, t.dataset.tooltip = a.rotulo, t.setAttribute("aria-haspopup", "menu"), t.setAttribute("aria-expanded", "false");
297
+ const e = N(a.icone, 24) || N(xt, 24);
298
+ if (e) {
299
+ const o = document.createElement("span");
300
+ o.className = "ui-ferr-btn__icone", o.appendChild(e), t.appendChild(o);
301
+ }
302
+ const i = document.createElement("span");
303
+ i.className = "ui-ferr-btn__rotulo", i.textContent = a.rotulo, t.appendChild(i);
304
+ const r = document.createElement("span");
305
+ return r.className = "ui-ferr-btn__caret", t.appendChild(r), s.appendChild(t), s;
306
+ }
307
+ function Et(a, s, t = {}) {
308
+ const e = document.createElement("div");
309
+ if (e.className = "ui-ribbon__grupo", e.setAttribute("role", "group"), e.setAttribute("aria-label", a.rotulo), e.dataset.id = a.id, t.colapsado) return yt(a, e);
310
+ t.reduzido && e.classList.add("ui-ribbon__grupo--reduzido");
311
+ const i = (d, l, c) => {
312
+ var m;
313
+ const b = t.reduzido && l === "pequeno" && d.icone && !d.somenteIcone ? { ...d, somenteIcone: !0 } : d;
314
+ return b.dividido && ((m = b.filhos) != null && m.length) && t.criarDividido ? t.criarDividido(b, l, c) : s(b, l, c);
315
+ }, r = document.createElement("div");
316
+ r.className = "ui-ribbon__grupo-itens";
317
+ let o = null, n = 0;
318
+ const u = () => {
319
+ o && r.appendChild(o), o = null, n = 0;
320
+ };
321
+ if (a.itens.forEach((d) => {
322
+ if (d.tipo === "separador") {
323
+ u();
324
+ const l = document.createElement("div");
325
+ l.className = "ui-ribbon__separador", l.setAttribute("role", "separator"), r.appendChild(l);
326
+ } else d.tamanho === "grande" ? (u(), r.appendChild(i(d, "grande", 24))) : (o || (o = document.createElement("div"), o.className = "ui-ribbon__coluna"), o.appendChild(i(d, "pequeno", 16)), ++n === vt && u());
327
+ }), u(), a.rotulo || a.lancadorDialogo) {
328
+ const d = document.createElement("div");
329
+ if (d.className = "ui-ribbon__grupo-rotulo", a.rotulo && (d.textContent = a.rotulo), a.lancadorDialogo) {
330
+ const l = document.createElement("button");
331
+ l.type = "button", l.className = "ui-ribbon__lancador", l.dataset.lancador = a.id;
332
+ const c = At(a);
333
+ l.setAttribute("aria-label", c), l.dataset.tooltip = c;
334
+ const b = N(_t, 10);
335
+ b && l.appendChild(b), d.appendChild(l);
336
+ }
337
+ return e.appendChild(r), e.appendChild(d), e;
338
+ }
339
+ return e.appendChild(r), e;
340
+ }
341
+ function wt(a, s, t, e, i = !1) {
342
+ if (s < 0 || t <= 0) return null;
343
+ if (i && (a === "Enter" || a === " ")) return { tipo: "ativar", indice: s };
344
+ const [r, o] = e ? ["ArrowLeft", "ArrowRight"] : ["ArrowRight", "ArrowLeft"];
345
+ return a === r ? { tipo: "ir-para", indice: (s + 1) % t } : a === o ? { tipo: "ir-para", indice: (s - 1 + t) % t } : a === "Home" ? { tipo: "ir-para", indice: 0 } : a === "End" ? { tipo: "ir-para", indice: t - 1 } : a === "ArrowDown" ? { tipo: "descer" } : null;
346
+ }
347
+ const V = 0, T = 1, B = 2, I = (a) => typeof a == "number" && Number.isFinite(a) && a >= 0;
348
+ function Ct(a, s, t = 0) {
349
+ const e = /* @__PURE__ */ new Map(), i = [];
350
+ Array.isArray(a) && a.forEach((l, c) => {
351
+ if (!l || typeof l.id != "string") return;
352
+ const b = Array.isArray(l.larguras) ? l.larguras.map((m) => I(m) ? m : NaN) : [];
353
+ e.set(l.id, V), i.push({ id: l.id, prio: Number.isFinite(l.prioridade) ? l.prioridade : 0, ordem: c, larguras: b });
354
+ });
355
+ const r = Number.isFinite(s) ? s : 0;
356
+ if (!i.length || r <= 0) return { niveis: e, cabe: !0 };
357
+ const o = /* @__PURE__ */ new Map();
358
+ let n = I(t) ? t : 0;
359
+ for (const l of i) {
360
+ const c = l.larguras[V];
361
+ o.set(l.id, I(c) ? c : 0), n += o.get(l.id);
362
+ }
363
+ if (n <= r) return { niveis: e, cabe: !0 };
364
+ const u = [...i].sort((l, c) => l.prio - c.prio || c.ordem - l.ordem), d = i.reduce((l, c) => Math.max(l, c.larguras.length - 1), 0);
365
+ for (let l = T; l <= d; l++)
366
+ for (const c of u) {
367
+ const b = c.larguras[l], m = o.get(c.id);
368
+ if (!(!I(b) || b >= m) && (n -= m - b, o.set(c.id, b), e.set(c.id, l), n <= r))
369
+ return { niveis: e, cabe: !0 };
370
+ }
371
+ return { niveis: e, cabe: !1 };
372
+ }
373
+ function kt(a, s, t, e, i) {
374
+ const r = { estreito: a, acao: null };
375
+ if (!Number.isFinite(s) || s <= 0 || !Number.isFinite(t) || t <= 0) return r;
376
+ const o = s < t;
377
+ return o === a ? r : o ? { estreito: o, acao: e ? null : "recolher" } : { estreito: o, acao: e && i ? "restaurar" : null };
378
+ }
379
+ function Mt({ inicio: a, tamanho: s, rolagem: t, visivel: e, margem: i = 8 }) {
380
+ const r = Number.isFinite(t) && t > 0 ? t : 0;
381
+ if (!Number.isFinite(a) || !Number.isFinite(s) || !Number.isFinite(e) || e <= 0) return r;
382
+ const o = Number.isFinite(i) && i > 0 ? i : 0, n = Math.max(0, a - o), u = a + Math.max(0, s) + o;
383
+ return u - n > e || n < r ? n : u > r + e ? u - e : r;
384
+ }
385
+ let St = 0;
386
+ class zt extends Q {
387
+ constructor() {
388
+ super();
389
+ h(this, "rootElement");
390
+ h(this, "abasElement");
391
+ h(this, "gruposElement");
392
+ h(this, "painelElement");
393
+ h(this, "fixarElement");
394
+ h(this, "maisAbasElement");
395
+ h(this, "menuAbas", null);
396
+ h(this, "uid", `ui-ribbon-${++St}`);
397
+ h(this, "_abaPendente", "");
398
+ h(this, "_pronto", !1);
399
+ h(this, "_modoControlado", !1);
400
+ h(this, "_abas", []);
401
+ h(this, "_abaAtiva", "");
402
+ h(this, "menu", null);
403
+ h(this, "listeners", new $());
404
+ h(this, "tooltip", null);
405
+ h(this, "observerResize", null);
406
+ /** Grupos no nível 2 (botão único com flyout). */
407
+ h(this, "gruposColapsados", /* @__PURE__ */ new Set());
408
+ /** Grupos no nível 1 (botões pequenos só com ícone). */
409
+ h(this, "gruposReduzidos", /* @__PURE__ */ new Set());
410
+ /** Larguras medidas por nível da aba ativa; `chave` invalida quando o layout pode ter mudado. */
411
+ h(this, "medidas", null);
412
+ h(this, "revisaoLayout", 0);
413
+ h(this, "keytipsAtivas", !1);
414
+ /** Lado do `recolher-abaixo` na última medição (`null` = ainda não medido). */
415
+ h(this, "estreito", null);
416
+ h(this, "aplicandoRecolhimentoAuto", !1);
417
+ h(this, "recolhidoPorAuto", !1);
418
+ h(this, "handleFocusInGrupos", (t) => st(this.botoesPainel(), t.target));
419
+ h(this, "handleClickMaisAbas", (t) => {
420
+ this.alternarMenuAbas(t.detail === 0);
421
+ });
422
+ h(this, "handleKeyDownMaisAbas", (t) => {
423
+ t.key === "ArrowDown" && (t.preventDefault(), this.menuAbas ? this.menuAbas.focarPrimeiro() : this.alternarMenuAbas(!0));
424
+ });
425
+ /* ---------- Interação ---------- */
426
+ h(this, "handleClickAbas", (t) => {
427
+ const e = t.target.closest(".ui-ribbon__aba");
428
+ e != null && e.dataset.id && (this.selecionarAba(e.dataset.id), this.recolhido && this.rootElement.classList.toggle("ui-ribbon--aberto"));
429
+ });
430
+ h(this, "handleClickFixar", () => {
431
+ this.recolhido = !this.recolhido;
432
+ });
433
+ h(this, "handleDblClickAbas", (t) => {
434
+ t.target.closest(".ui-ribbon__aba") && (this.recolhido = !this.recolhido);
435
+ });
436
+ h(this, "handleKeyDownAbas", (t) => {
437
+ var o, n;
438
+ const e = Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")), i = wt(t.key, e.findIndex((u) => u === t.target), e.length, this.rtl, this.ativacaoManual);
439
+ if (!i) return;
440
+ if (t.preventDefault(), i.tipo === "descer") {
441
+ this.recolhido && this.rootElement.classList.add("ui-ribbon--aberto"), (o = this.botoesPainel().find((u) => !u.disabled)) == null || o.focus();
442
+ return;
443
+ }
444
+ if (i.tipo === "ativar") {
445
+ const u = e[i.indice].dataset.id;
446
+ u && this.selecionarAba(u);
447
+ return;
448
+ }
449
+ const r = e[i.indice].dataset.id;
450
+ if (this.ativacaoManual) {
451
+ e.forEach((u) => u.tabIndex = -1), e[i.indice].tabIndex = 0, e[i.indice].focus();
452
+ return;
453
+ }
454
+ r && this.selecionarAba(r), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(r ?? "")}"]`)) == null || n.focus();
455
+ });
456
+ h(this, "handleClickGrupos", (t) => {
457
+ var d;
458
+ const e = t.target, i = this._abas.find((l) => l.id === this._abaAtiva), r = e.closest(".ui-ribbon__btn-colapsado");
459
+ if (r) {
460
+ const l = i == null ? void 0 : i.grupos.find((c) => c.id === r.dataset.grupoColapsado);
461
+ l && this.alternarMenuGrupoColapsado(r, l);
462
+ return;
463
+ }
464
+ const o = e.closest(".ui-ribbon__lancador");
465
+ if (o) {
466
+ const l = i == null ? void 0 : i.grupos.find((c) => c.id === o.dataset.lancador);
467
+ l && this.dispatchEvent(new CustomEvent("ui-grupo-dialogo", {
468
+ detail: { id: typeof l.lancadorDialogo == "string" ? l.lancadorDialogo : l.id, grupo: l },
469
+ bubbles: !0,
470
+ composed: !0
471
+ }));
472
+ return;
473
+ }
474
+ const n = e.closest(".ui-ferr-split__gatilho");
475
+ if (n) {
476
+ const l = n.closest(".ui-ferr-split"), c = l == null ? void 0 : l.dataset.id, b = i && A(i.grupos.flatMap((m) => m.itens), c ?? "");
477
+ b && ((d = b.filhos) != null && d.length) && this.alternarMenu(n, b, !1);
478
+ return;
479
+ }
480
+ const u = e.closest(".ui-ferr-btn");
481
+ u != null && u.dataset.id && this.acionar(u, t.detail === 0);
482
+ });
483
+ h(this, "handleKeyDownGrupos", (t) => {
484
+ var r;
485
+ const e = this.botoesPainel();
486
+ if (this.rtl ? G(t, e, ["ArrowRight"], ["ArrowLeft"]) : G(t, e, ["ArrowLeft"], ["ArrowRight"])) return;
487
+ const i = t.target instanceof HTMLButtonElement ? t.target : null;
488
+ (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));
489
+ });
490
+ h(this, "handleEscape", (t) => {
491
+ t.key === "Escape" && !this.menu && this.rootElement.classList.remove("ui-ribbon--aberto");
492
+ });
493
+ h(this, "handlePointerDownFora", (t) => {
494
+ !this.recolhido || !this.rootElement.classList.contains("ui-ribbon--aberto") || t.composedPath().includes(this) || this.rootElement.classList.remove("ui-ribbon--aberto");
495
+ });
496
+ h(this, "handleAtalho", (t) => {
497
+ if (!this.hasAttribute("atalhos") && !this.hasAttribute("keytips") || t.defaultPrevented) return;
498
+ const e = t.composedPath(), i = e[0];
499
+ if (i && (/^(INPUT|TEXTAREA|SELECT)$/.test(i.tagName) || i.isContentEditable) || e.some((l) => {
500
+ var b, m;
501
+ const c = (b = l.getAttribute) == null ? void 0 : b.call(l, "role");
502
+ return ((m = l.getAttribute) == null ? void 0 : m.call(l, "aria-modal")) === "true" || c === "textbox" || c === "searchbox" || c === "combobox" || c === "spinbutton";
503
+ })) return;
504
+ if (this.hasAttribute("keytips") && (t.key === "Alt" || t.key === "F10") && !t.ctrlKey && !t.shiftKey && !t.metaKey) {
505
+ t.preventDefault(), this.alternarKeyTips();
506
+ return;
507
+ }
508
+ if (!this.hasAttribute("atalhos")) return;
509
+ const o = this._abas.find((l) => l.id === this._abaAtiva);
510
+ if (!o) return;
511
+ const u = o.grupos.flatMap((l) => l.itens).find((l) => !l.disabled && at(t, l.atalho));
512
+ if (!u) return;
513
+ t.preventDefault();
514
+ const d = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(u.id)}"]`);
515
+ d ? this.acionar(d, !1) : this.emitir(u);
516
+ });
517
+ const t = this.attachShadow({ mode: "open" });
518
+ t.innerHTML = `
519
+ <style>${rt}${ht}</style>
520
+ <div class="ui-ribbon" part="base">
521
+ <div class="ui-ribbon__cabecalho" part="cabecalho">
522
+ <div class="ui-ribbon__abas" part="abas" role="tablist"></div>
523
+ <button type="button" class="ui-ribbon__mais-abas" part="mais-abas" aria-haspopup="menu" aria-expanded="false" hidden></button>
524
+ <button type="button" class="ui-ribbon__fixar" part="fixar"></button>
525
+ </div>
526
+ <div class="ui-ribbon__painel" part="painel" role="tabpanel">
527
+ <div class="ui-ribbon__grupos" part="grupos" role="toolbar" aria-label="Ferramentas"></div>
528
+ </div>
529
+ </div>
530
+ `, 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`;
531
+ }
532
+ static get observedAttributes() {
533
+ return [
534
+ "aba-ativa",
535
+ "recolhido",
536
+ "compacto",
537
+ "ativacao-manual",
538
+ "copiar-dados",
539
+ "modo-controlado",
540
+ "atalhos",
541
+ "keytips",
542
+ "recolher-abaixo",
543
+ "aria-label",
544
+ "rotulo-abas",
545
+ "rotulo-mais-abas",
546
+ "rotulo-fixar",
547
+ "rotulo-expandir",
548
+ ...tt
549
+ ];
550
+ }
551
+ connectedCallback() {
552
+ var e;
553
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new nt(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();
554
+ const t = this.getAttribute("aba-ativa");
555
+ t && !this._abaAtiva && (this._abaPendente = t), j(this, this.rootElement), this.aplicarRotulos(), this.estreito = null, this.invalidarMedidas(), this.renderizar(), this._pronto = !0, this.avaliarRecolhimentoAuto();
556
+ }
557
+ disconnectedCallback() {
558
+ var t, e;
559
+ 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();
560
+ }
561
+ attributeChangedCallback(t, e, i) {
562
+ if (e !== i) {
563
+ if (et(t)) {
564
+ j(this, this.rootElement);
565
+ return;
566
+ }
567
+ if (t === "aba-ativa") {
568
+ if (!i || i === this._abaAtiva) return;
569
+ this._abas.some((r) => r.id === i && !r.oculta) ? (this._abaPendente = "", this.selecionarAba(i, !1)) : (this._abaPendente = i, this.abasVisiveis().length && this.renderizar());
570
+ } 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(
571
+ new CustomEvent("ui-recolhido-change", {
572
+ detail: { recolhido: i !== null },
573
+ bubbles: !0,
574
+ composed: !0
575
+ })
576
+ )) : (t === "aria-label" || t === "rotulo-abas" || t === "rotulo-mais-abas" || t === "rotulo-fixar" || t === "rotulo-expandir") && this.aplicarRotulos();
577
+ }
578
+ }
579
+ aplicarRotulos() {
580
+ this.gruposElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.abasElement.setAttribute("aria-label", this.getAttribute("rotulo-abas") || "Abas");
581
+ const t = this.getAttribute("rotulo-mais-abas") || "Todas as abas";
582
+ this.maisAbasElement.setAttribute("aria-label", t), this.maisAbasElement.title = t;
583
+ 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";
584
+ 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);
585
+ }
586
+ /* ---------- API pública ---------- */
587
+ get modoControlado() {
588
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
589
+ }
590
+ set modoControlado(t) {
591
+ this._modoControlado = !!t;
592
+ }
593
+ get copiarDados() {
594
+ return this.modoControlado;
595
+ }
596
+ set copiarDados(t) {
597
+ this.modoControlado = t;
598
+ }
599
+ get ativacaoManual() {
600
+ return this.hasAttribute("ativacao-manual");
601
+ }
602
+ set ativacaoManual(t) {
603
+ t ? this.setAttribute("ativacao-manual", "") : this.removeAttribute("ativacao-manual");
604
+ }
605
+ get abas() {
606
+ return this._abas;
607
+ }
608
+ set abas(t) {
609
+ const e = Array.isArray(t) ? t : [];
610
+ this._abas = this.modoControlado ? e.map((i) => ({
611
+ ...i,
612
+ grupos: i.grupos.map((r) => ({
613
+ ...r,
614
+ itens: r.itens.map((o) => {
615
+ var n;
616
+ return {
617
+ ...o,
618
+ filhos: (n = o.filhos) == null ? void 0 : n.map((u) => ({ ...u }))
619
+ };
620
+ })
621
+ }))
622
+ })) : e, H(this._abas.map((i) => i.id), "<ui-ribbon> abas"), H(
623
+ this._abas.flatMap((i) => i.grupos.flatMap((r) => K(r.itens))),
624
+ "<ui-ribbon> itens"
625
+ ), this.gruposColapsados.clear(), this.gruposReduzidos.clear(), this.invalidarMedidas(), this.renderizar();
626
+ }
627
+ get abaAtiva() {
628
+ return this._abaAtiva;
629
+ }
630
+ set abaAtiva(t) {
631
+ this.selecionarAba(t);
632
+ }
633
+ get recolhido() {
634
+ return this.hasAttribute("recolhido");
635
+ }
636
+ set recolhido(t) {
637
+ t ? this.setAttribute("recolhido", "") : this.removeAttribute("recolhido");
638
+ }
639
+ get compacto() {
640
+ return this.hasAttribute("compacto");
641
+ }
642
+ set compacto(t) {
643
+ t ? this.setAttribute("compacto", "") : this.removeAttribute("compacto");
644
+ }
645
+ /** Largura (px) abaixo da qual a faixa se recolhe sozinha. `0` desliga. */
646
+ get recolherAbaixo() {
647
+ const t = Number(this.getAttribute("recolher-abaixo"));
648
+ return Number.isFinite(t) && t > 0 ? t : 0;
649
+ }
650
+ set recolherAbaixo(t) {
651
+ Number.isFinite(t) && t > 0 ? this.setAttribute("recolher-abaixo", String(t)) : this.removeAttribute("recolher-abaixo");
652
+ }
653
+ selecionarAba(t, e = !0) {
654
+ const i = this._abas.find((r) => r.id === t && !r.oculta);
655
+ if (!i) {
656
+ t && this._abas.length && console.warn(`[ui-ribbon] selecionarAba("${t}"): aba inexistente ou oculta.`);
657
+ return;
658
+ }
659
+ 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(
660
+ new CustomEvent("ui-aba-change", {
661
+ detail: { id: i.id, aba: i },
662
+ bubbles: !0,
663
+ composed: !0
664
+ })
665
+ ));
666
+ }
667
+ definirAbaVisivel(t, e) {
668
+ const i = this._abas.find((n) => n.id === t);
669
+ if (!i) return;
670
+ const r = this._abaAtiva;
671
+ i.oculta = !e, !e && r === t && (this._abaAtiva = ""), this.renderizar();
672
+ const o = this._abas.find((n) => n.id === this._abaAtiva);
673
+ !e && r === t && o && this.dispatchEvent(
674
+ new CustomEvent("ui-aba-change", { detail: { id: o.id, aba: o }, bubbles: !0, composed: !0 })
675
+ );
676
+ }
677
+ /** Atualiza um item (estado ou aparência) sem precisar recriar as abas. */
678
+ atualizarItem(t, e) {
679
+ const i = this._abas.flatMap((d) => d.grupos.flatMap((l) => l.itens)), r = A(i, t);
680
+ if (!r) {
681
+ console.warn(`[ui-ribbon] atualizarItem("${t}"): item não encontrado.`);
682
+ return;
683
+ }
684
+ Object.assign(r, e);
685
+ const o = this._abas.find((d) => d.id === this._abaAtiva);
686
+ if (!o || !A(o.grupos.flatMap((d) => d.itens), t)) return;
687
+ const n = Object.keys(e).every((d) => d === "ativo" || d === "disabled"), u = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(t)}"]`);
688
+ n ? u && (k(u, this.efetivo(r)), ot(this.botoesPainel())) : (this.invalidarMedidas(), this.comFoco(() => this.renderizarPainel()), this.ajustarResponsivo());
689
+ }
690
+ efetivo(t) {
691
+ var e;
692
+ return (e = t.filhos) != null && e.length ? { ...t, tipo: "menu" } : t;
693
+ }
694
+ /* ---------- Foco preservado em re-renderizações ---------- */
695
+ capturarFoco() {
696
+ var e, i;
697
+ const t = (e = this.shadowRoot) == null ? void 0 : e.activeElement;
698
+ 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;
699
+ }
700
+ comFoco(t) {
701
+ const e = this.capturarFoco();
702
+ if (t(), !e) return;
703
+ const i = this.shadowRoot.querySelector(`${e.seletor}[data-id="${CSS.escape(e.id)}"]`);
704
+ i && !i.disabled && i.focus();
705
+ }
706
+ /* ---------- Renderização ---------- */
707
+ abasVisiveis() {
708
+ return this._abas.filter((t) => !t.oculta);
709
+ }
710
+ renderizar() {
711
+ var e;
712
+ const t = this.abasVisiveis();
713
+ 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(() => {
714
+ this.renderizarAbas(), this.renderizarPainel();
715
+ }), this.ajustarResponsivo(), this.rolarAbaAtivaParaVisivel(), this.atualizarMaisAbas();
716
+ }
717
+ renderizarAbas() {
718
+ this.abasElement.innerHTML = "", this.abasVisiveis().forEach((t) => {
719
+ this.abasElement.appendChild(gt({
720
+ aba: t,
721
+ ativa: t.id === this._abaAtiva,
722
+ idBotao: this.idAba(t.id),
723
+ idPainel: this.painelElement.id
724
+ }));
725
+ });
726
+ }
727
+ /* ---------- Menu "mais abas" (lista transborda) ---------- */
728
+ /** Mostra o botão só quando as abas não cabem; fecha o menu se ele deixar de ser necessário. */
729
+ atualizarMaisAbas() {
730
+ const t = this.abasElement, e = t.scrollWidth > t.clientWidth + 1 && this.abasVisiveis().length > 1;
731
+ this.maisAbasElement.hidden = !e, e || this.fecharMenuAbas();
732
+ }
733
+ fecharMenuAbas() {
734
+ var t;
735
+ (t = this.menuAbas) == null || t.fechar(), this.menuAbas = null;
736
+ }
737
+ alternarMenuAbas(t) {
738
+ const e = !!this.menuAbas;
739
+ if (this.fecharMenuAbas(), e) return;
740
+ const i = this.maisAbasElement;
741
+ i.setAttribute("aria-expanded", "true");
742
+ const r = this.abasVisiveis().map((o) => ({
743
+ id: o.id,
744
+ rotulo: o.rotulo,
745
+ tipo: "ferramenta",
746
+ ativo: o.id === this._abaAtiva
747
+ }));
748
+ this.menuAbas = P(
749
+ this.shadowRoot,
750
+ i,
751
+ r,
752
+ (o) => {
753
+ var n;
754
+ this.selecionarAba(o.id), (n = this.abasElement.querySelector(`.ui-ribbon__aba[data-id="${CSS.escape(o.id)}"]`)) == null || n.focus();
755
+ },
756
+ {
757
+ lado: "baixo",
758
+ focar: t,
759
+ onFechar: () => {
760
+ i.setAttribute("aria-expanded", "false"), this.menuAbas = null;
761
+ }
762
+ }
763
+ );
764
+ }
765
+ /** Mantém a aba ativa dentro da área visível da lista de abas (sem rolar a página, só a lista). */
766
+ rolarAbaAtivaParaVisivel() {
767
+ const t = this.abasElement, e = t.querySelector(".ui-ribbon__aba--ativa");
768
+ if (!e || !(t.scrollWidth > t.clientWidth)) return;
769
+ const i = e.getBoundingClientRect(), r = Mt({
770
+ inicio: i.left - t.getBoundingClientRect().left + t.scrollLeft,
771
+ tamanho: i.width,
772
+ rolagem: t.scrollLeft,
773
+ visivel: t.clientWidth
774
+ });
775
+ r !== t.scrollLeft && (t.scrollLeft = r);
776
+ }
777
+ idAba(t) {
778
+ return `${this.uid}-aba-${t.replace(/\s+/g, "_")}`;
779
+ }
780
+ renderizarPainel() {
781
+ this.fecharMenu(), this.gruposElement.innerHTML = "";
782
+ const t = this._abas.find((e) => e.id === this._abaAtiva);
783
+ if (!t) {
784
+ this.painelElement.removeAttribute("aria-labelledby");
785
+ return;
786
+ }
787
+ this.painelElement.setAttribute("aria-labelledby", this.idAba(t.id)), t.grupos.forEach((e) => this.gruposElement.appendChild(Et(
788
+ e,
789
+ (i, r, o) => this.criarBotao(i, r, o),
790
+ {
791
+ colapsado: this.gruposColapsados.has(e.id),
792
+ reduzido: this.gruposReduzidos.has(e.id),
793
+ criarDividido: (i, r, o) => bt(this.efetivo(i), r, o)
794
+ }
795
+ ))), W(this.botoesPainel());
796
+ }
797
+ iniciarResizeObserver() {
798
+ typeof ResizeObserver > "u" || (this.observerResize = new ResizeObserver(() => {
799
+ this.avaliarRecolhimentoAuto(), this.ajustarResponsivo(), this.atualizarMaisAbas();
800
+ }), this.observerResize.observe(this.painelElement), this.observerResize.observe(this.abasElement), this.observerResize.observe(this));
801
+ }
802
+ /* ---------- Responsividade: degradê dos grupos por falta de espaço ---------- */
803
+ invalidarMedidas() {
804
+ this.revisaoLayout++, this.medidas = null;
805
+ }
806
+ /** Largura fixa do contêiner dos grupos fora dos próprios grupos (padding) + 1px de tolerância de arredondamento. */
807
+ larguraFixaGrupos() {
808
+ try {
809
+ const t = getComputedStyle(this.gruposElement);
810
+ return (parseFloat(t.paddingLeft) || 0) + (parseFloat(t.paddingRight) || 0) + 1;
811
+ } catch {
812
+ return 1;
813
+ }
814
+ }
815
+ larguraDoGrupo(t) {
816
+ var e;
817
+ return ((e = this.gruposElement.querySelector(`.ui-ribbon__grupo[data-id="${CSS.escape(t)}"]`)) == null ? void 0 : e.offsetWidth) ?? 0;
818
+ }
819
+ definirNiveis(t, e) {
820
+ this.gruposReduzidos = new Set(t), this.gruposColapsados = new Set(e);
821
+ }
822
+ /**
823
+ * Mede a largura de cada grupo da aba nos três níveis (renderiza os três estados de forma síncrona, sem pintura
824
+ * entre eles) e guarda em cache até o layout poder mudar (outra aba, `compacto`, itens alterados).
825
+ * Deixa o DOM no último estado medido: quem chama deve renderizar o resultado final.
826
+ */
827
+ medirGrupos(t) {
828
+ var n;
829
+ const e = `${t.id}|${this.compacto}|${this.revisaoLayout}`;
830
+ if (((n = this.medidas) == null ? void 0 : n.chave) === e) return { grupos: this.medidas.grupos, mediu: !1 };
831
+ const i = t.grupos.map((u) => u.id), r = i.map(() => []);
832
+ for (const u of [V, T, B])
833
+ this.definirNiveis(u === T ? i : [], u === B ? i : []), this.renderizarPainel(), i.forEach((d, l) => r[l].push(this.larguraDoGrupo(d)));
834
+ const o = t.grupos.map((u, d) => ({ id: u.id, prioridade: u.prioridade, larguras: r[d] }));
835
+ return this.medidas = { chave: e, grupos: o }, { grupos: o, mediu: !0 };
836
+ }
837
+ /**
838
+ * Ajusta o nível de cada grupo ao espaço real do painel. Só re-renderiza quando o resultado muda, então
839
+ * notificações repetidas do ResizeObserver (inclusive as causadas por esta própria renderização) não fazem laço.
840
+ * Painel oculto (faixa recolhida) ou sem layout: não decide nada.
841
+ */
842
+ ajustarResponsivo() {
843
+ if (!this.isConnected) return;
844
+ const t = this._abas.find((i) => i.id === this._abaAtiva);
845
+ if (!(t != null && t.grupos.length)) return;
846
+ const e = this.painelElement.clientWidth;
847
+ e > 0 && this.comFoco(() => {
848
+ const i = new Set(this.gruposReduzidos), r = new Set(this.gruposColapsados), { grupos: o, mediu: n } = this.medirGrupos(t), { niveis: u } = Ct(o, e, this.larguraFixaGrupos()), d = (m) => [...u].filter(([, x]) => x === m).map(([x]) => x), l = d(T), c = d(B), b = (m, x) => m.size === x.length && x.every((v) => m.has(v));
849
+ !n && b(i, l) && b(r, c) || (this.definirNiveis(l, c), this.renderizarPainel());
850
+ });
851
+ }
852
+ /** `recolher-abaixo`: recolhe a faixa ao cruzar para estreito e restaura (só se foi automático) ao alargar. */
853
+ avaliarRecolhimentoAuto() {
854
+ const t = this.recolherAbaixo;
855
+ if (!t) {
856
+ this.estreito = null;
857
+ return;
858
+ }
859
+ const e = kt(this.estreito, this.offsetWidth, t, this.recolhido, this.recolhidoPorAuto);
860
+ if (this.estreito = e.estreito, !!e.acao) {
861
+ this.aplicandoRecolhimentoAuto = !0;
862
+ try {
863
+ this.recolhido = e.acao === "recolher";
864
+ } finally {
865
+ this.aplicandoRecolhimentoAuto = !1;
866
+ }
867
+ this.recolhidoPorAuto = e.acao === "recolher";
868
+ }
869
+ }
870
+ alternarMenuGrupoColapsado(t, e) {
871
+ var r;
872
+ const i = ((r = this.menu) == null ? void 0 : r.ancora) === t;
873
+ this.fecharMenu(), !i && (t.setAttribute("aria-expanded", "true"), this.menu = P(
874
+ this.shadowRoot,
875
+ t,
876
+ e.itens,
877
+ (o) => {
878
+ const n = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(o.id)}"]`);
879
+ if (n) this.acionar(n, !1);
880
+ else {
881
+ const u = o.ativo;
882
+ o.tipo === "toggle" ? o.ativo = !u : o.tipo === "ferramenta" && (o.ativo = !0), this.emitir(o) || (o.ativo = u);
883
+ }
884
+ this.rootElement.classList.remove("ui-ribbon--aberto");
885
+ },
886
+ {
887
+ lado: "baixo",
888
+ onFechar: () => {
889
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
890
+ }
891
+ }
892
+ ));
893
+ }
894
+ criarBotao(t, e, i) {
895
+ return O(this.efetivo(t), e, i);
896
+ }
897
+ botoesPainel() {
898
+ return Array.from(this.gruposElement.querySelectorAll(".ui-ferr-btn"));
899
+ }
900
+ get rtl() {
901
+ return getComputedStyle(this).direction === "rtl";
902
+ }
903
+ alternarKeyTips() {
904
+ if (this.keytipsAtivas = !this.keytipsAtivas, this.shadowRoot.querySelectorAll(".ui-ribbon__keytip").forEach((e) => e.remove()), !this.keytipsAtivas) return;
905
+ Array.from(this.abasElement.querySelectorAll(".ui-ribbon__aba")).forEach((e, i) => {
906
+ const r = document.createElement("span");
907
+ 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);
908
+ });
909
+ }
910
+ acionar(t, e) {
911
+ var n;
912
+ const i = this._abas.find((u) => u.id === this._abaAtiva), r = i == null ? void 0 : i.grupos.find((u) => A(u.itens, t.dataset.id)), o = r && A(r.itens, t.dataset.id);
913
+ if (!(!o || o.disabled)) {
914
+ if ((n = o.filhos) != null && n.length && !o.dividido) {
915
+ this.alternarMenu(t, o, e);
916
+ return;
917
+ }
918
+ if (o.tipo === "toggle") {
919
+ const u = o.ativo;
920
+ o.ativo = !u, k(t, o), this.emitir(o) || (o.ativo = u, k(t, o));
921
+ } else if (o.tipo === "ferramenta") {
922
+ const u = o.ativo, d = r ? r.exclusivo !== !1 : !0, l = d && r ? r.itens.filter((c) => c.tipo === "ferramenta" && c.id !== o.id && c.ativo) : [];
923
+ o.ativo = !0, k(t, o), d && l.forEach((c) => {
924
+ c.ativo = !1;
925
+ const b = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(c.id)}"]`);
926
+ b && k(b, c);
927
+ }), this.emitir(o) || (o.ativo = u, k(t, o), d && l.forEach((c) => {
928
+ c.ativo = !0;
929
+ const b = this.gruposElement.querySelector(`.ui-ferr-btn[data-id="${CSS.escape(c.id)}"]`);
930
+ b && k(b, c);
931
+ }));
932
+ } else
933
+ this.emitir(o);
934
+ this.rootElement.classList.remove("ui-ribbon--aberto");
935
+ }
936
+ }
937
+ alternarMenu(t, e, i) {
938
+ var o;
939
+ const r = ((o = this.menu) == null ? void 0 : o.ancora) === t;
940
+ this.fecharMenu(), !r && (t.setAttribute("aria-expanded", "true"), this.menu = P(
941
+ this.shadowRoot,
942
+ t,
943
+ e.filhos,
944
+ (n) => {
945
+ if (n.tipo === "toggle") {
946
+ const u = n.ativo;
947
+ n.ativo = !u, this.emitir(n, e) || (n.ativo = u);
948
+ } else
949
+ this.emitir(n, e);
950
+ this.rootElement.classList.remove("ui-ribbon--aberto");
951
+ },
952
+ {
953
+ lado: "baixo",
954
+ focar: i,
955
+ onFechar: () => {
956
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
957
+ }
958
+ }
959
+ ));
960
+ }
961
+ fecharMenu() {
962
+ var t;
963
+ (t = this.menu) == null || t.fechar(), this.menu = null;
964
+ }
965
+ /** Retorna false se o consumidor cancelou o evento (preventDefault). */
966
+ emitir(t, e) {
967
+ return this.dispatchEvent(
968
+ new CustomEvent("ui-ferramenta", {
969
+ detail: { id: t.id, item: t, pai: e, ativo: t.ativo, origem: "ribbon", aba: this._abaAtiva },
970
+ bubbles: !0,
971
+ composed: !0,
972
+ cancelable: !0
973
+ })
974
+ );
975
+ }
976
+ }
977
+ it("ui-ribbon", zt);
978
+ const Rt = ':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-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;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__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)}', Lt = 380, Pt = 8, Nt = 50;
979
+ class Dt {
980
+ constructor() {
981
+ h(this, "timer");
982
+ h(this, "timerSupressao");
983
+ h(this, "inicio", null);
984
+ h(this, "suprimir", !1);
985
+ }
986
+ /** Começa a contar; `aoDisparar` roda se o ponteiro ficar parado até `TEMPO_PRESSAO_LONGA_MS`. */
987
+ iniciar(s, t, e) {
988
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.inicio = { x: s, y: t }, this.timer = window.setTimeout(() => {
989
+ this.suprimir = !0, e();
990
+ }, Lt);
991
+ }
992
+ /** Arrastar/rolar com o dedo cancela o clique longo. */
993
+ mover(s, t) {
994
+ this.timer === void 0 || !this.inicio || Math.hypot(s - this.inicio.x, t - this.inicio.y) > Pt && this.cancelar();
995
+ }
996
+ /** Fim do gesto: cancela a contagem e, se o flyout abriu, descarta a supressão logo após o `click` residual. */
997
+ fim() {
998
+ this.cancelar(), this.suprimir && (window.clearTimeout(this.timerSupressao), this.timerSupressao = window.setTimeout(() => {
999
+ this.suprimir = !1;
1000
+ }, Nt));
1001
+ }
1002
+ cancelar() {
1003
+ this.timer !== void 0 && (window.clearTimeout(this.timer), this.timer = void 0), this.inicio = null;
1004
+ }
1005
+ /** `true` (uma única vez) se o próximo `click` deve ser ignorado por ser o resíduo de uma pressão longa. */
1006
+ consumirSupressao() {
1007
+ return this.suprimir ? (this.suprimir = !1, window.clearTimeout(this.timerSupressao), !0) : !1;
1008
+ }
1009
+ destruir() {
1010
+ this.cancelar(), window.clearTimeout(this.timerSupressao), this.suprimir = !1;
1011
+ }
1012
+ }
1013
+ function It(a, s) {
1014
+ return a.find(s) ?? a[0];
1015
+ }
1016
+ const Ft = /* @__PURE__ */ new Set(["textbox", "searchbox", "combobox", "spinbutton"]);
1017
+ function Tt(a) {
1018
+ const s = a[0];
1019
+ return s && (/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName) || s.isContentEditable) ? !0 : a.some((t) => {
1020
+ var r, o;
1021
+ const e = t, i = (r = e.getAttribute) == null ? void 0 : r.call(e, "role");
1022
+ return ((o = e.getAttribute) == null ? void 0 : o.call(e, "aria-modal")) === "true" || !!i && Ft.has(i);
1023
+ });
1024
+ }
1025
+ function jt(a, s, t, e) {
1026
+ const i = typeof a == "string" ? { key: a, ctrlKey: !1, metaKey: !1, altKey: !1, shiftKey: !1 } : a;
1027
+ if (!i || !i.key) return null;
1028
+ const r = s.filter((u) => !u.disabled && at(i, u.atalho));
1029
+ if (r.length === 0) return null;
1030
+ let o = r[0];
1031
+ if (r.length > 1) {
1032
+ const u = r.findIndex((d) => d.id === e);
1033
+ o = r[(u + 1) % r.length];
1034
+ }
1035
+ const n = t.find((u) => {
1036
+ var d;
1037
+ return (d = u.filhos) == null ? void 0 : d.some((l) => l.id === o.id);
1038
+ });
1039
+ return { alvo: o, pai: n };
1040
+ }
1041
+ function F(a, s) {
1042
+ return Number.isFinite(a) && a >= 0 ? a : s;
1043
+ }
1044
+ function Z(a, s, t, e) {
1045
+ const i = F(a.botao, 0), r = F(a.gap, 0), o = F(a.separador, 0), n = a.vertical && e === 2;
1046
+ let u = 0, d = 0;
1047
+ const l = (m) => {
1048
+ u += (u > 0 ? r : 0) + m;
1049
+ }, c = () => {
1050
+ if (!n) return l(i);
1051
+ d === 0 && l(i), d = (d + 1) % 2;
1052
+ }, b = Math.min(Math.max(0, Math.floor(s)), a.separadores.length);
1053
+ for (let m = 0; m < b; m++)
1054
+ a.separadores[m] ? (l(o), d = 0) : c();
1055
+ return t && c(), u + F(a.moldura, 0);
1056
+ }
1057
+ function $t(a) {
1058
+ const s = Array.isArray(a.separadores) ? a.separadores.length : 0, t = a.vertical ? a.colunas === "auto" ? [1, 2] : [a.colunas === 2 ? 2 : 1] : [1];
1059
+ if (!(a.limite > 0) || !Number.isFinite(a.limite) || s === 0) return { colunas: t[0], visiveis: s };
1060
+ for (const r of t)
1061
+ if (Z(a, s, !1, r) <= a.limite) return { colunas: r, visiveis: s };
1062
+ const i = t[t.length - 1];
1063
+ if (!a.excessoMenu) return { colunas: i, visiveis: s };
1064
+ for (let r = s - 1; r >= 1; r--)
1065
+ if (Z(a, r, !0, i) <= a.limite) return { colunas: i, visiveis: r };
1066
+ return { colunas: i, visiveis: 1 };
1067
+ }
1068
+ function Ot(a, s, t) {
1069
+ const e = Math.min(Math.max(0, Math.floor(s)), a.length);
1070
+ let i = a.slice(0, e), r = a.slice(e);
1071
+ for (; r.length && t(r[0]); ) r = r.slice(1);
1072
+ for (; r.length && t(r[r.length - 1]); ) r = r.slice(0, -1);
1073
+ if (!r.length) return { visiveis: a, excesso: [] };
1074
+ for (; i.length && t(i[i.length - 1]); ) i = i.slice(0, -1);
1075
+ return { visiveis: i, excesso: r };
1076
+ }
1077
+ const qt = '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/></svg>', Bt = "Mais ferramentas";
1078
+ function lt(a, s) {
1079
+ var t;
1080
+ if (s)
1081
+ for (const e of a) {
1082
+ if (e.id === s) return e;
1083
+ const i = (t = e.filhos) == null ? void 0 : t.find((r) => r.id === s);
1084
+ if (i) return i;
1085
+ }
1086
+ }
1087
+ function Ht(a) {
1088
+ return a.filter((s) => s.tipo !== "separador").map((s) => s.id);
1089
+ }
1090
+ function Gt(a, s, t, e = Bt) {
1091
+ const i = lt(a, s), r = a.some((n) => n.tipo !== "separador" && !n.disabled), o = O(
1092
+ {
1093
+ id: "__mais",
1094
+ rotulo: e,
1095
+ rotuloAcessivel: i ? `${e}: ${M(i)} ativa` : e,
1096
+ icone: (i == null ? void 0 : i.icone) ?? qt,
1097
+ tipo: "botao",
1098
+ disabled: !r
1099
+ },
1100
+ "paleta",
1101
+ t
1102
+ );
1103
+ return o.removeAttribute("data-id"), o.dataset.mais = "", o.dataset.tooltip = i ? `${e} — ${M(i)}` : e, o.classList.add("ui-ferr-btn--mais", "ui-ferr-btn--grupo"), o.classList.toggle("ui-ferr-btn--ativo", !!i), o.setAttribute("aria-haspopup", "menu"), o.setAttribute("aria-expanded", "false"), o;
1104
+ }
1105
+ const Vt = { sm: 16, md: 18, lg: 22 }, J = { sm: [28, 36], md: [34, 40], lg: [42, 48] }, Kt = 7, _ = (a, s) => {
1106
+ const t = parseFloat(a ?? "");
1107
+ return Number.isFinite(t) ? t : s;
25
1108
  };
1109
+ class Wt extends Q {
1110
+ constructor() {
1111
+ super();
1112
+ h(this, "rootElement");
1113
+ h(this, "_ferramentas", []);
1114
+ h(this, "_ativo", "");
1115
+ h(this, "_pendente", "");
1116
+ h(this, "visiveis", /* @__PURE__ */ new Map());
1117
+ // id do grupo → id do filho exibido
1118
+ h(this, "menu", null);
1119
+ h(this, "pressao", new Dt());
1120
+ h(this, "listeners", new $());
1121
+ h(this, "tooltip", null);
1122
+ h(this, "_modoControlado", !1);
1123
+ /** Ajuste ao espaço atual (null até a primeira renderização). */
1124
+ h(this, "_ajuste", null);
1125
+ /** Quantidade de itens da lista para a qual `_ajuste` foi calculado. */
1126
+ h(this, "_totalAjustado", 0);
1127
+ /** Itens de topo que não couberam (menu "Mais ferramentas"). */
1128
+ h(this, "_excesso", []);
1129
+ h(this, "observador", null);
1130
+ h(this, "rafAjuste", null);
1131
+ h(this, "handleClick", (t) => {
1132
+ var o;
1133
+ if (this.pressao.consumirSupressao()) return;
1134
+ const e = t.target.closest(".ui-ferr-btn");
1135
+ if (e && e.dataset.mais !== void 0) {
1136
+ if (e.disabled) return;
1137
+ ((o = this.menu) == null ? void 0 : o.ancora) === e ? this.fecharMenu() : this.abrirFlyout(e, !1);
1138
+ return;
1139
+ }
1140
+ const i = e != null && e.dataset.id ? A(this._ferramentas, e.dataset.id) : void 0;
1141
+ if (!e || !i) return;
1142
+ const r = e.dataset.grupo ? A(this._ferramentas, e.dataset.grupo) : void 0;
1143
+ this.acionar(i, r);
1144
+ });
1145
+ h(this, "handleFocusIn", (t) => st(this.botoes(), t.target));
1146
+ h(this, "handlePointerDown", (t) => {
1147
+ const e = t;
1148
+ if (e.pointerType === "mouse" && e.button !== 0) return;
1149
+ const i = t.target.closest(".ui-ferr-btn--grupo");
1150
+ !i || i.disabled || this.pressao.iniciar(e.clientX ?? 0, e.clientY ?? 0, () => this.abrirFlyout(i, !1));
1151
+ });
1152
+ h(this, "handlePointerMove", (t) => {
1153
+ const e = t;
1154
+ this.pressao.mover(e.clientX ?? 0, e.clientY ?? 0);
1155
+ });
1156
+ h(this, "handlePointerFim", () => this.pressao.fim());
1157
+ h(this, "handleContextMenu", (t) => {
1158
+ const e = t.target.closest(".ui-ferr-btn--grupo");
1159
+ e && (t.preventDefault(), this.pressao.cancelar(), this.abrirFlyout(e, !1));
1160
+ });
1161
+ h(this, "handleKeyDown", (t) => {
1162
+ var u;
1163
+ const e = this.getAttribute("orientacao") === "horizontal", i = getComputedStyle(this).direction === "rtl", r = this.colunas;
1164
+ if (!e && r === 2) {
1165
+ if (pt(t, this.botoes(), i)) return;
1166
+ } else {
1167
+ const d = e ? [i ? "ArrowRight" : "ArrowLeft"] : ["ArrowUp"], l = e ? [i ? "ArrowLeft" : "ArrowRight"] : ["ArrowDown"];
1168
+ if (G(t, this.botoes(), d, l)) return;
1169
+ }
1170
+ const o = e ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", n = t.target instanceof HTMLButtonElement ? t.target : null;
1171
+ n && (n.dataset.grupo || n.dataset.mais !== void 0) && t.key === o && (t.preventDefault(), ((u = this.menu) == null ? void 0 : u.ancora) === n ? this.menu.focarPrimeiro() : this.abrirFlyout(n, !0));
1172
+ });
1173
+ h(this, "handleAtalho", (t) => {
1174
+ if (!this.hasAttribute("atalhos") || t.defaultPrevented || Tt(t.composedPath()) || !this.donaDosAtalhos()) return;
1175
+ const e = jt(t, this.todasFerramentas(), this._ferramentas, this._ativo);
1176
+ e && (t.preventDefault(), this.acionar(e.alvo, e.pai));
1177
+ });
1178
+ const t = this.attachShadow({ mode: "open" });
1179
+ t.innerHTML = `
1180
+ <style>${rt}${Rt}</style>
1181
+ <div class="ui-paleta ui-paleta--vertical" part="base" role="toolbar" aria-orientation="vertical" aria-label="Ferramentas"></div>
1182
+ `, this.rootElement = t.querySelector(".ui-paleta");
1183
+ }
1184
+ static get observedAttributes() {
1185
+ return ["valor", "value", "orientacao", "colunas", "tamanho", "size", "excesso", "aria-label", "copiar-dados", "modo-controlado", ...tt];
1186
+ }
1187
+ connectedCallback() {
1188
+ var e;
1189
+ this.listeners.cleanup(), (e = this.tooltip) == null || e.destruir(), this.tooltip = new nt(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);
1190
+ const t = this.getAttribute("valor") || this.getAttribute("value");
1191
+ t && !this._ativo && (this._pendente = t), j(this, this.rootElement), this.aplicarPendente(), this.renderizar(), this.iniciarObservador();
1192
+ }
1193
+ disconnectedCallback() {
1194
+ var t;
1195
+ this.pararObservador(), this.pressao.destruir(), this.fecharMenu(), (t = this.tooltip) == null || t.destruir(), this.tooltip = null, this.listeners.cleanup();
1196
+ }
1197
+ attributeChangedCallback(t, e, i) {
1198
+ if (e !== i) {
1199
+ if (et(t)) {
1200
+ j(this, this.rootElement);
1201
+ return;
1202
+ }
1203
+ if (t === "valor" || t === "value") {
1204
+ const r = this.getAttribute("valor") || this.getAttribute("value") || "";
1205
+ r ? r !== this._ativo && this.ativar(r, !1) : this.limpar(!1);
1206
+ } else
1207
+ this.renderizar();
1208
+ }
1209
+ }
1210
+ /* ---------- API pública ---------- */
1211
+ /**
1212
+ * Quando `true` ou atributo `copiar-dados` / `modo-controlado`: clona a árvore de itens
1213
+ * para não mutar os objetos fornecidos pelo consumidor (Item 11).
1214
+ */
1215
+ get modoControlado() {
1216
+ return this._modoControlado || this.hasAttribute("modo-controlado") || this.hasAttribute("copiar-dados");
1217
+ }
1218
+ set modoControlado(t) {
1219
+ this._modoControlado = !!t;
1220
+ }
1221
+ get copiarDados() {
1222
+ return this.modoControlado;
1223
+ }
1224
+ set copiarDados(t) {
1225
+ this.modoControlado = t;
1226
+ }
1227
+ get ferramentas() {
1228
+ return this._ferramentas;
1229
+ }
1230
+ set ferramentas(t) {
1231
+ const e = Array.isArray(t) ? t : [];
1232
+ this._ferramentas = this.modoControlado ? e.map((i) => {
1233
+ var r;
1234
+ return { ...i, filhos: (r = i.filhos) == null ? void 0 : r.map((o) => ({ ...o })) };
1235
+ }) : e, H(K(this._ferramentas), "<ui-paleta-ferramentas> ferramentas"), this.visiveis.clear(), this._pendente ? this.aplicarPendente() : this._ativo && this.definirAtivoInterno(this._ativo), this.renderizar();
1236
+ }
1237
+ get valor() {
1238
+ return this._ativo;
1239
+ }
1240
+ set valor(t) {
1241
+ this.ativar(t);
1242
+ }
1243
+ get value() {
1244
+ return this.valor;
1245
+ }
1246
+ set value(t) {
1247
+ this.valor = t;
1248
+ }
1249
+ get orientacao() {
1250
+ return this.getAttribute("orientacao") === "horizontal" ? "horizontal" : "vertical";
1251
+ }
1252
+ set orientacao(t) {
1253
+ this.setAttribute("orientacao", t);
1254
+ }
1255
+ /** Colunas em uso. Com `colunas="auto"` reflete o ajuste atual ao espaço (1 ou 2). */
1256
+ get colunas() {
1257
+ var e;
1258
+ const t = this.getAttribute("colunas");
1259
+ return t === "2" ? 2 : t === "auto" ? ((e = this._ajuste) == null ? void 0 : e.colunas) ?? 1 : 1;
1260
+ }
1261
+ set colunas(t) {
1262
+ this.setAttribute("colunas", String(t));
1263
+ }
1264
+ get modoColunas() {
1265
+ const t = this.getAttribute("colunas");
1266
+ return t === "2" ? 2 : t === "auto" ? "auto" : 1;
1267
+ }
1268
+ /** O que fazer quando a paleta não cabe: `menu` (botão "Mais ferramentas", padrão) ou `rolar` (barra de rolagem). */
1269
+ get excesso() {
1270
+ return this.getAttribute("excesso") === "rolar" ? "rolar" : "menu";
1271
+ }
1272
+ set excesso(t) {
1273
+ this.setAttribute("excesso", t);
1274
+ }
1275
+ get tamanho() {
1276
+ const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md";
1277
+ return t === "sm" || t === "lg" ? t : "md";
1278
+ }
1279
+ set tamanho(t) {
1280
+ this.setAttribute("tamanho", t);
1281
+ }
1282
+ /**
1283
+ * Ativa uma ferramenta (exclusiva). Se estiver dentro de um grupo, ela passa a ser a exibida.
1284
+ * `id` vazio limpa a seleção. Se as `ferramentas` ainda não foram definidas, o valor fica pendente.
1285
+ */
1286
+ ativar(t, e = !0) {
1287
+ if (!t) {
1288
+ this.limpar(e);
1289
+ return;
1290
+ }
1291
+ const i = A(this._ferramentas, t);
1292
+ if (!i) {
1293
+ this._ferramentas.length ? console.warn(`[ui-paleta-ferramentas] ativar("${t}"): ferramenta não encontrada.`) : this._pendente = t;
1294
+ return;
1295
+ }
1296
+ if (i.disabled || (i.tipo ?? "ferramenta") !== "ferramenta") {
1297
+ console.warn(`[ui-paleta-ferramentas] ativar("${t}"): só ferramentas habilitadas (tipo "ferramenta") podem ser ativadas.`);
1298
+ return;
1299
+ }
1300
+ this._pendente = "";
1301
+ const r = this._ativo;
1302
+ this.definirAtivoInterno(t), this.refletirValor(t), this.renderizar(), e && r !== t && this.emitirMudanca(t, i, r);
1303
+ }
1304
+ /** Remove a seleção atual (nenhuma ferramenta ativa). Equivale a `valor = ''`. */
1305
+ limpar(t = !0) {
1306
+ const e = this._ativo;
1307
+ !e && !this._pendente || (this._ativo = "", this._pendente = "", this.removeAttribute("valor"), this.removeAttribute("value"), this.renderizar(), t && e && this.emitirMudanca("", null, e));
1308
+ }
1309
+ atualizarItem(t, e) {
1310
+ var u;
1311
+ const i = A(this._ferramentas, t);
1312
+ if (!i) {
1313
+ console.warn(`[ui-paleta-ferramentas] atualizarItem("${t}"): item não encontrado.`);
1314
+ return;
1315
+ }
1316
+ Object.assign(i, e);
1317
+ const r = Object.keys(e).every((d) => d === "ativo" || d === "disabled"), o = this._ferramentas.find((d) => {
1318
+ var l;
1319
+ return (l = d.filhos) == null ? void 0 : l.some((c) => c.id === t);
1320
+ }), n = this._excesso.some((d) => d.id === ((o == null ? void 0 : o.id) ?? t));
1321
+ if (r && !n && !(o && "disabled" in e)) {
1322
+ const d = this.botoes().find((l) => l.dataset.id === t || l.dataset.grupo === t);
1323
+ if (d) {
1324
+ k(d, this.itemParaBotao(o ?? i)), ot(this.botoes());
1325
+ return;
1326
+ }
1327
+ if (o || (u = i.filhos) != null && u.length) return;
1328
+ }
1329
+ this.renderizar();
1330
+ }
1331
+ /**
1332
+ * Reavalia o espaço disponível (colunas e itens ocultos). É chamado sozinho quando o contêiner
1333
+ * muda de tamanho; chame manualmente após mudanças de layout que o navegador não notifica.
1334
+ */
1335
+ reajustar() {
1336
+ if (!this.isConnected) return;
1337
+ const t = this.calcularAtual();
1338
+ this.mesmoAjuste(t, this._ajuste) || this.renderizar(t);
1339
+ }
1340
+ /* ---------- Ajuste ao espaço ---------- */
1341
+ /** `a` foi calculado para a lista atual; `b` (o ajuste guardado) para a lista de `_totalAjustado` itens. */
1342
+ mesmoAjuste(t, e) {
1343
+ if (!e || t.colunas !== e.colunas) return !1;
1344
+ const i = t.visiveis >= this._ferramentas.length, r = e.visiveis >= this._totalAjustado;
1345
+ return i && r || t.visiveis === e.visiveis;
1346
+ }
1347
+ /**
1348
+ * Só reduz quando a paleta realmente transborda (ou já estava reduzida e precisa decidir se pode
1349
+ * crescer): um contêiner de altura automática nunca causa ocultação por erro de estimativa.
1350
+ */
1351
+ calcularAtual() {
1352
+ const t = this._ferramentas.length, e = this.modoColunas, i = this.orientacao === "vertical", r = { colunas: i && e === 2 ? 2 : 1, visiveis: t };
1353
+ if (!this.isConnected || t === 0) return r;
1354
+ const o = this._ajuste;
1355
+ if (!(!!o && (o.visiveis < this._totalAjustado || i && e === "auto" && o.colunas === 2)) && !this.transbordando(i)) return r;
1356
+ const u = this.medirPaleta(i);
1357
+ return $t({
1358
+ separadores: this._ferramentas.map((d) => (d == null ? void 0 : d.tipo) === "separador"),
1359
+ vertical: i,
1360
+ colunas: e,
1361
+ limite: this.limiteDisponivel(i),
1362
+ ...u,
1363
+ excessoMenu: this.excesso === "menu"
1364
+ });
1365
+ }
1366
+ transbordando(t) {
1367
+ const e = this.rootElement;
1368
+ return t ? e.scrollHeight > e.clientHeight + 1 : e.scrollWidth > e.clientWidth + 1;
1369
+ }
1370
+ /** Espaço (px) que o elemento pai oferece no eixo principal; 0 = desconhecido (sem limite). */
1371
+ limiteDisponivel(t) {
1372
+ const e = this.parentElement;
1373
+ if (!e) return 0;
1374
+ const i = getComputedStyle(e), r = t ? e.clientHeight : e.clientWidth, o = t ? _(i.paddingTop, 0) + _(i.paddingBottom, 0) : _(i.paddingLeft, 0) + _(i.paddingRight, 0);
1375
+ return r - o;
1376
+ }
1377
+ /** Medidas reais do CSS (tamanho/toque/tema); cai em valores padrão se o navegador não as expõe. */
1378
+ medirPaleta(t) {
1379
+ const e = getComputedStyle(this.rootElement), i = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, [r, o] = J[this.tamanho] ?? J.md, n = t ? _(e.paddingTop, 4) + _(e.paddingBottom, 4) + _(e.borderTopWidth, 1) + _(e.borderBottomWidth, 1) : _(e.paddingLeft, 4) + _(e.paddingRight, 4) + _(e.borderLeftWidth, 1) + _(e.borderRightWidth, 1);
1380
+ return {
1381
+ botao: _(e.getPropertyValue("--ui-paleta-btn"), i ? o : r),
1382
+ gap: _(t ? e.rowGap : e.columnGap, 2),
1383
+ moldura: n,
1384
+ separador: Kt
1385
+ };
1386
+ }
1387
+ iniciarObservador() {
1388
+ this.pararObservador(), !(typeof ResizeObserver > "u") && (this.observador = new ResizeObserver(() => this.agendarAjuste()), this.parentElement && this.observador.observe(this.parentElement), this.observador.observe(this));
1389
+ }
1390
+ pararObservador() {
1391
+ var t;
1392
+ (t = this.observador) == null || t.disconnect(), this.observador = null, this.rafAjuste !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.rafAjuste), this.rafAjuste = null;
1393
+ }
1394
+ /** Agrupa rajadas de resize num único reajuste por quadro (evita "ResizeObserver loop"). */
1395
+ agendarAjuste() {
1396
+ if (typeof requestAnimationFrame != "function") {
1397
+ this.reajustar();
1398
+ return;
1399
+ }
1400
+ this.rafAjuste === null && (this.rafAjuste = requestAnimationFrame(() => {
1401
+ this.rafAjuste = null, this.reajustar();
1402
+ }));
1403
+ }
1404
+ /* ---------- Estado interno ---------- */
1405
+ refletirValor(t) {
1406
+ const e = this.hasAttribute("value") && !this.hasAttribute("valor") ? "value" : "valor";
1407
+ this.getAttribute(e) !== t && this.setAttribute(e, t);
1408
+ }
1409
+ aplicarPendente() {
1410
+ if (!this._pendente) return;
1411
+ const t = A(this._ferramentas, this._pendente);
1412
+ 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 = "");
1413
+ }
1414
+ definirAtivoInterno(t) {
1415
+ this._ativo = t;
1416
+ const e = this._ferramentas.find((i) => {
1417
+ var r;
1418
+ return (r = i.filhos) == null ? void 0 : r.some((o) => o.id === t);
1419
+ });
1420
+ e && this.visiveis.set(e.id, t);
1421
+ }
1422
+ emitirMudanca(t, e, i) {
1423
+ const r = { valor: t, item: e, anterior: i };
1424
+ this.dispatchEvent(new CustomEvent("ui-change", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-selecionar", { detail: r, bubbles: !0, composed: !0 }));
1425
+ }
1426
+ /** Filho exibido de um grupo: o último usado, pulando separadores e itens desabilitados. */
1427
+ itemExibido(t) {
1428
+ var o;
1429
+ if (!((o = t.filhos) != null && o.length)) return t;
1430
+ const e = (n) => n.tipo !== "separador" && !n.disabled, i = this.visiveis.get(t.id), r = t.filhos.find((n) => n.id === i);
1431
+ return (r && e(r) ? r : void 0) ?? t.filhos.find(e) ?? t.filhos.find((n) => n.tipo !== "separador") ?? t.filhos[0];
1432
+ }
1433
+ itemParaBotao(t) {
1434
+ const e = this.itemExibido(t), i = e.tipo ?? "ferramenta";
1435
+ return {
1436
+ ...e,
1437
+ tipo: i,
1438
+ ativo: i === "ferramenta" ? e.id === this._ativo : e.ativo,
1439
+ filhos: t.filhos
1440
+ };
1441
+ }
1442
+ todasFerramentas() {
1443
+ return this._ferramentas.flatMap((t) => {
1444
+ var e;
1445
+ return (e = t.filhos) != null && e.length ? t.filhos : [t];
1446
+ }).filter((t) => t.tipo !== "separador");
1447
+ }
1448
+ /* ---------- Renderização ---------- */
1449
+ renderizar(t) {
1450
+ var x;
1451
+ const e = (x = this.shadowRoot) == null ? void 0 : x.activeElement, i = e && e.classList.contains("ui-ferr-btn") ? { id: e.dataset.id ?? "", grupo: e.dataset.grupo ?? "", mais: e.dataset.mais !== void 0 } : null;
1452
+ this.fecharMenu();
1453
+ const r = this.orientacao, o = this.tamanho, n = t ?? this.calcularAtual(), u = this._ajuste, d = !!u && !this.mesmoAjuste(n, u);
1454
+ this._ajuste = n, this._totalAjustado = this._ferramentas.length, this.rootElement.className = `ui-paleta ui-paleta--${r} ui-paleta--${o}`, n.colunas === 2 && r === "vertical" && this.rootElement.classList.add("ui-paleta--cols-2"), this.rootElement.setAttribute("aria-orientation", r), this.rootElement.setAttribute("aria-label", this.getAttribute("aria-label") || "Ferramentas"), this.rootElement.innerHTML = "";
1455
+ const l = Vt[o] ?? 18, { visiveis: c, excesso: b } = Ot(this._ferramentas, n.visiveis, (v) => v.tipo === "separador");
1456
+ this._excesso = b, c.forEach((v) => {
1457
+ var S;
1458
+ if (v.tipo === "separador") {
1459
+ const z = document.createElement("div");
1460
+ z.className = "ui-paleta__sep", z.setAttribute("role", "separator"), this.rootElement.appendChild(z);
1461
+ return;
1462
+ }
1463
+ const w = this.itemExibido(v), C = O(this.itemParaBotao(v), "paleta", l);
1464
+ C.dataset.id = w.id, (S = v.filhos) != null && S.length && (C.dataset.grupo = v.id), this.rootElement.appendChild(C);
1465
+ }), b.length && this.rootElement.appendChild(Gt(b, this._ativo, l)), W(this.botoes());
1466
+ const m = this.botoes().find((v) => v.dataset.id === this._ativo && !v.disabled) ?? (lt(b, this._ativo) ? this.botaoMais() : null);
1467
+ if (m && !m.disabled && (this.botoes().forEach((v) => v.tabIndex = -1), m.tabIndex = 0), i) {
1468
+ const v = i.mais ? this.botaoMais() : this.botoes().find((w) => i.grupo ? w.dataset.grupo === i.grupo : w.dataset.id === i.id);
1469
+ v && !v.disabled && v.focus();
1470
+ }
1471
+ d && this.dispatchEvent(
1472
+ new CustomEvent("ui-paleta-ajuste", {
1473
+ detail: {
1474
+ colunas: n.colunas,
1475
+ visiveis: c.filter((v) => v.tipo !== "separador").length,
1476
+ total: this._ferramentas.filter((v) => v.tipo !== "separador").length,
1477
+ ocultos: Ht(b)
1478
+ },
1479
+ bubbles: !0,
1480
+ composed: !0
1481
+ })
1482
+ );
1483
+ }
1484
+ botaoMais() {
1485
+ return this.rootElement.querySelector(".ui-ferr-btn--mais");
1486
+ }
1487
+ botoes() {
1488
+ return Array.from(this.rootElement.querySelectorAll(".ui-ferr-btn"));
1489
+ }
1490
+ /** Reflete no botão o estado atual do item (sem recriar o DOM). */
1491
+ atualizarBotaoDe(t, e) {
1492
+ const i = this.botoes().find((r) => r.dataset.id === t.id);
1493
+ i && k(i, this.itemParaBotao(e ?? t));
1494
+ }
1495
+ /* ---------- Interação ---------- */
1496
+ acionar(t, e) {
1497
+ if (t.disabled) return;
1498
+ const i = t.tipo ?? "ferramenta", r = this._ativo, o = t.ativo;
1499
+ i === "ferramenta" ? this.ativar(t.id) : i === "toggle" && (t.ativo = !t.ativo, this.atualizarBotaoDe(t, e)), this.dispatchEvent(
1500
+ new CustomEvent("ui-ferramenta", {
1501
+ detail: {
1502
+ id: t.id,
1503
+ item: t,
1504
+ pai: e,
1505
+ ativo: i === "ferramenta" ? !0 : t.ativo,
1506
+ origem: "paleta"
1507
+ },
1508
+ bubbles: !0,
1509
+ composed: !0,
1510
+ cancelable: !0
1511
+ })
1512
+ ) || (i === "ferramenta" && r !== t.id ? r ? this.ativar(r) : this.limpar() : i === "toggle" && (t.ativo = o, this.atualizarBotaoDe(t, e)));
1513
+ }
1514
+ /** Várias paletas com `atalhos` na página: só a que contém o foco (ou a primeira no DOM) responde. */
1515
+ donaDosAtalhos() {
1516
+ const t = Array.from(document.querySelectorAll("ui-paleta-ferramentas[atalhos]"));
1517
+ return t.length <= 1 ? !0 : It(t, (e) => {
1518
+ var i;
1519
+ return e.matches(":focus-within") || !!((i = e.shadowRoot) != null && i.activeElement);
1520
+ }) === this;
1521
+ }
1522
+ abrirFlyout(t, e) {
1523
+ const i = t.dataset.mais !== void 0, r = !i && t.dataset.grupo ? A(this._ferramentas, t.dataset.grupo) : void 0, o = i ? this._excesso : r == null ? void 0 : r.filhos;
1524
+ if (!(o != null && o.length)) return;
1525
+ this.fecharMenu();
1526
+ const n = (c) => {
1527
+ var b, m;
1528
+ return {
1529
+ ...c,
1530
+ ativo: !((b = c.filhos) != null && b.length) && (c.tipo ?? "ferramenta") === "ferramenta" ? c.id === this._ativo : c.ativo,
1531
+ filhos: (m = c.filhos) == null ? void 0 : m.map(n)
1532
+ };
1533
+ }, u = o.map(n), d = this.getAttribute("orientacao") !== "horizontal", l = getComputedStyle(this).direction === "rtl";
1534
+ t.setAttribute("aria-expanded", "true"), this.menu = P(
1535
+ this.shadowRoot,
1536
+ t,
1537
+ u,
1538
+ (c) => {
1539
+ var x;
1540
+ const b = A(this._ferramentas, c.id);
1541
+ if (!b) return;
1542
+ const m = r ?? this._ferramentas.find((v) => {
1543
+ var w;
1544
+ return (w = v.filhos) == null ? void 0 : w.some((C) => C.id === b.id);
1545
+ });
1546
+ this.acionar(b, m), (x = i ? this.botaoMais() : this.botoes().find((v) => v.dataset.grupo === (r == null ? void 0 : r.id))) == null || x.focus();
1547
+ },
1548
+ {
1549
+ lado: d ? l ? "esquerda" : "direita" : "baixo",
1550
+ focar: e,
1551
+ tipoPadrao: "ferramenta",
1552
+ onFechar: () => {
1553
+ t.setAttribute("aria-expanded", "false"), this.menu = null;
1554
+ }
1555
+ }
1556
+ );
1557
+ }
1558
+ fecharMenu() {
1559
+ var t;
1560
+ (t = this.menu) == null || t.fechar(), this.menu = null;
1561
+ }
1562
+ }
1563
+ it("ui-paleta-ferramentas", Wt);
26
1564
  export {
27
- h as ICONES_FERRAMENTAS,
28
- o as UIPaletaFerramentas,
29
- l as UIRibbon
1565
+ Jt as ICONES_FERRAMENTAS,
1566
+ Wt as UIPaletaFerramentas,
1567
+ zt as UIRibbon
30
1568
  };