@thibezer/ui-components-kit 2.24.2 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/botao.cjs +1 -1
  3. package/dist/botao.js +1 -1
  4. package/dist/camadas.cjs +1 -1
  5. package/dist/camadas.js +2 -2
  6. package/dist/campo-texto.cjs +1 -1
  7. package/dist/campo-texto.js +1 -1
  8. package/dist/canvas.cjs +1 -1
  9. package/dist/canvas.js +1 -1
  10. package/dist/card.cjs +1 -1
  11. package/dist/card.js +1 -1
  12. package/dist/components/ui-canvas-prancha/index.d.ts +1 -1
  13. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +13 -5
  14. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +6 -1
  15. package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +2 -2
  16. package/dist/components/ui-editor-prancha/editor-barra.d.ts +19 -0
  17. package/dist/components/ui-editor-prancha/editor-modos.d.ts +26 -1
  18. package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +32 -9
  19. package/dist/core/alvo-digitavel.d.ts +3 -0
  20. package/dist/core.cjs +1 -1
  21. package/dist/core.js +4 -4
  22. package/dist/cores.cjs +1 -1
  23. package/dist/cores.js +3 -3
  24. package/dist/custom-elements.json +12330 -11963
  25. package/dist/data.cjs +1 -1
  26. package/dist/data.js +1 -1
  27. package/dist/feedback.cjs +1 -1
  28. package/dist/feedback.js +1 -1
  29. package/dist/forms.cjs +1 -1
  30. package/dist/forms.js +11 -11
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.js +3 -3
  33. package/dist/kit-base-BmkPi5Rz.cjs +2 -0
  34. package/dist/{kit-base-_THn4w3u.js → kit-base-CBXA66aM.js} +119 -114
  35. package/dist/mapa.cjs +1 -1
  36. package/dist/mapa.js +1 -1
  37. package/dist/modal.cjs +1 -1
  38. package/dist/modal.js +1 -1
  39. package/dist/prancha.cjs +6 -6
  40. package/dist/prancha.js +1707 -1470
  41. package/dist/register.cjs +1 -1
  42. package/dist/register.js +1 -1
  43. package/dist/seletor-mapa-base.cjs +1 -1
  44. package/dist/seletor-mapa-base.js +1 -1
  45. package/dist/tabela.cjs +1 -1
  46. package/dist/tabela.js +1 -1
  47. package/dist/tipos-elementos.d.ts +2 -2
  48. package/dist/tipos-vue.d.ts +2 -2
  49. package/dist/tools.cjs +1 -1
  50. package/dist/tools.js +1 -1
  51. package/dist/{ui-seletor-cor-B_twSm-V.js → ui-seletor-cor-CPjA9vhZ.js} +1 -1
  52. package/dist/{ui-seletor-cor-BGw8SBPm.cjs → ui-seletor-cor-D_ifitEN.cjs} +1 -1
  53. package/package.json +1 -1
  54. package/dist/kit-base-CGqj9aiD.cjs +0 -2
package/dist/prancha.js CHANGED
@@ -1,17 +1,17 @@
1
- var Ge = Object.defineProperty;
2
- var He = (t, a, e) => a in t ? Ge(t, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[a] = e;
3
- var m = (t, a, e) => He(t, typeof a != "symbol" ? a + "" : a, e);
1
+ var Qe = Object.defineProperty;
2
+ var Ye = (t, e, a) => e in t ? Qe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
+ var m = (t, e, a) => Ye(t, typeof e != "symbol" ? e + "" : e, a);
4
4
  /* empty css */
5
- import { IndicePrancha as $e, Historico as Be, normalizarElementos as Ke, analisarElemento as Ve, compor as wa, translacao as k, escala as q, mapaDeCamadas as Ue, normalizarCamadas as Xe, expandirGrupos as Ze, buscarSnapPrancha as te, ESPESSURA_TRACO_PADRAO_MM as We, COR_PADRAO_PRANCHA as Je, rotacao as Pa, espelharElementos as Qe, ehMatrizFinita as re, transformarElementos as T, definirRaiosDoRetangulo as Ye, normalizarElemento as at, moverAncoras as ie, excluirAncora as oe, centroDaSelecao as et, criarRetangulo as tt, criarElipse as rt, criarPoligonoRegular as it, criarEstrela as ot, transformarElemento as se, criarLinha as st, ESPACO_PLANO as nt, criarCaminho as Ia, paraMm as lt, criarTexto as ct, caixaDeCantos as ut, reordenar as dt, agrupar as ht, desagrupar as mt, alinhar as ft, distribuir as pt, ordenarPorEmpilhamento as $, aplicarAparencia as ne, criarMascara as gt, liberarMascara as vt, unirCaminhos as bt, dividirComLinha as yt, deslocarCaminho as At, duplicarElementos as le, simplificarCaminho as Pt, contornoDoTraco as St, converterEmCaminho as Mt, desenharElementos as N, caixaOrientada as zt, ancorasDoElemento as Sa, alcasDoElemento as ce, caixaDaSelecao as Ma, posicoesDasAlcas as ue, contornoNaFolha as za, aplicar as Et, posicaoLocalDaAlca as xt, ALCAS_ESCALA as Ct, raiosEfetivos as de, profundidadeNoCanto as he, limitesNaFolha as W, comRaioDeCanto as Tt, moverAlcaDaAncora as wt, moverAncora as It, rotacaoPorArrasto as Dt, matrizDeCisalhamentoPorAlca as _t, matrizDeEscalaPorAlca as Ft, guiasInteligentes as kt, marcasDosCantos as Lt, envelopeNaFolha as Rt, elementoNoTopo as oa, trechoMaisProximo as Ot, adicionarAncora as qt, ancoraMaisProxima as Nt, converterAncora as jt, elementosNaCaixa as Gt, deMm as Ht, caixaDoQuadro as me, OPERACOES_BOOLEANAS as $t, aplicarPathfinder as Bt, ehUnidadePrancha as Kt, temMedidorTexto as Vt, definirMedidorTexto as Ut, saneada as Xt, ehPredefinicao as Zt, gerarPredefinicao as Wt, envelopeVisual as Da, exportarSvg as Jt, ehPropriedadePrancha as Qt, ehPropriedadeDeGeometria as Yt, comPropriedade as ar, rotacaoEmGraus as er, MODOS_MESCLAGEM as tr, valorDaPropriedade as rr, resolverAparencia as ir, ITENS_PREDEFINICOES as _a } from "./prancha-nucleo.js";
6
- import { DIMENSOES_FOLHA as ao, EPSILON_DETERMINANTE as eo, ESCALA_MINIMA as to, ESPESSURA_PADRAO_MM as ro, ESTILOS_TRACO as io, ESTILO_DO_TIPO_LINHA as oo, FAIXAS_MAXIMO as so, FAIXAS_PADRAO as no, FONTE_PADRAO as lo, FORMATOS_ABNT as co, IDENTIDADE as uo, IDS_PROPRIEDADES_PRANCHA as ho, KAPPA as mo, LIMITE_PONTA_PADRAO as fo, MAX_LINHAS_HACHURA as po, MESCLAGEM_CSS as go, MM_POR_PX as vo, MM_POR_UNIDADE as bo, PREDEFINICOES as yo, PRIORIDADE_SNAP_PRANCHA as Ao, ROTULOS_PREDEFINICOES as Po, SOMBRA_PADRAO as So, TIPO_LINHA_DO_ESTILO as Mo, adaptarContextoRelativo as zo, ajustarAparenciaEmLote as Eo, ajustarElementosACaixa as xo, aparenciaDe as Co, aplicarTodos as To, aplicarVetor as wo, areaComSinal as Io, areaDosPoligonos as Do, avisarUmaVez as _o, caixaDoQuadroAbnt as Fo, caixaDoTexto as ko, caixaNormalizada as Lo, caminhoDoContorno as Ro, caminhoFinito as Oo, caminhoParaSvg as qo, cisalhamento as No, comoCaminhoNaFolha as jo, comprimentoDaPonta as Go, contornoElipse as Ho, contornoEstrela as $o, contornoLocal as Bo, contornoLocalEmCache as Ko, contornoPoligonoRegular as Vo, contornoRetangulo as Uo, corComOpacidade as Xo, corNaPosicao as Zo, decompor as Wo, desenharPlano as Jo, determinante as Qo, diagnosticarContexto as Yo, direcaoNaPonta as as, ehFechado as es, ehIdentidade as ts, ehSingular as rs, elementosNoLaco as is, elementosNoPonto as os, emTornoDe as ss, espelhamento as ns, faixasDoGradienteLinear as ls, feicaoDoElemento as cs, fonteSegura as us, geometriaDaPonta as ds, girarElementos as hs, iguais as ms, inverter as fs, limitesLocais as ps, linhasDeHachura as gs, mapearPontoNaCaixa as vs, margensAbnt as bs, matriz as ys, matrizDoElemento as As, meiaEspessura as Ps, modoDeTransformacao as Ss, moverElemento as Ms, multiplicar as zs, normalizarAparencia as Es, normalizarGeometriaElemento as xs, normalizarGradiente as Cs, normalizarHachura as Ts, normalizarParaOrigem as ws, operacaoBooleana as Is, padraoTipoLinhaMm as Ds, pivoNaFolha as _s, planejar as Fs, planejarElemento as ks, planejarElementos as Ls, planoDe as Rs, pontoNoAnel as Os, raiosCabiveis as qs, recompor as Ns, redefinirAvisoContexto as js, regiaoDoElemento as Gs, resolverSombra as Hs, resumirAparencia as $s, temPreenchimento as Bs, testarElemento as Ks, transformarContorno as Vs, varreduraDoArco as Us } from "./prancha-nucleo.js";
7
- import { n as or, T as sr } from "./geometria-px-DHMPUsxC.js";
8
- import { K as nr, M as Fa, U as fe, S as pe, L as Ea, d as ge } from "./kit-base-_THn4w3u.js";
9
- import { E as Zs } from "./feature_caixa-BVc5LenS.js";
10
- import { S as lr } from "./feature_desenho-CC8Mp5Gp.js";
11
- const cr = ":host{--ui-prancha-mesa: var(--ui-cor-fundo);--ui-prancha-papel: var(--ui-cor-papel);--ui-prancha-borda-papel: var(--ui-cor-borda);--ui-prancha-grade: var(--ui-cor-grade-papel);--ui-prancha-selecao: var(--ui-cor-primaria);--ui-prancha-alca: var(--ui-cor-superficie);--ui-prancha-guia: var(--ui-cor-guia);--ui-prancha-guia-inteligente: var(--ui-cor-guia-inteligente);--ui-prancha-snap: var(--ui-cor-destaque);--ui-prancha-regua: var(--ui-cor-fundo-elevado);--ui-prancha-texto-regua: var(--ui-cor-texto-secundario);--ui-prancha-tamanho-regua: 20px;display:block;position:relative;min-height:240px;min-width:240px;height:100%;background:var(--ui-cor-fundo);color:var(--ui-cor-texto);font-family:var(--ui-fonte-base);outline:none;contain:layout paint}:host([hidden]){display:none}.raiz{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;grid-template-columns:var(--ui-prancha-tamanho-regua) 1fr;grid-template-rows:var(--ui-prancha-tamanho-regua) 1fr}:host([sem-reguas]) .raiz{grid-template-columns:0 1fr;grid-template-rows:0 1fr}:host([sem-reguas]) .regua,:host([sem-reguas]) .canto{display:none}.canto{background:var(--ui-prancha-regua);border-right:1px solid var(--ui-cor-borda);border-bottom:1px solid var(--ui-cor-borda)}.regua{display:block;width:100%;height:100%;background:var(--ui-prancha-regua);cursor:default;touch-action:none}.regua-h{border-bottom:1px solid var(--ui-cor-borda);cursor:s-resize}.regua-v{border-right:1px solid var(--ui-cor-borda);cursor:e-resize}.viewport{position:relative;overflow:hidden;background:var(--ui-prancha-mesa);touch-action:none;cursor:default}.viewport:focus-visible{outline:2px solid var(--ui-cor-primaria);outline-offset:-2px}.viewport[data-cursor=mao]{cursor:grab}.viewport[data-cursor=arrastando]{cursor:grabbing}.viewport[data-cursor=mira]{cursor:crosshair}.viewport[data-cursor=mover]{cursor:move}.viewport[data-cursor=girar]{cursor:alias}.viewport[data-cursor=ancora]{cursor:pointer}.camada{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;display:block;pointer-events:none}.status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){:host{--ui-prancha-tamanho-regua: 24px}}";
12
- function ur() {
5
+ import { IndicePrancha as at, Historico as et, normalizarElementos as tt, analisarElemento as rt, compor as Fa, translacao as k, escala as H, mapaDeCamadas as it, normalizarCamadas as ot, expandirGrupos as st, buscarSnapPrancha as se, ESPESSURA_TRACO_PADRAO_MM as nt, COR_PADRAO_PRANCHA as lt, rotacao as za, espelharElementos as ct, ehMatrizFinita as ne, transformarElementos as I, definirRaiosDoRetangulo as ut, normalizarElemento as dt, moverAncoras as le, excluirAncora as ce, centroDaSelecao as ht, criarRetangulo as mt, criarElipse as ft, criarPoligonoRegular as pt, criarEstrela as gt, transformarElemento as ue, criarLinha as vt, ESPACO_PLANO as bt, criarCaminho as _a, paraMm as yt, criarTexto as At, caixaDeCantos as St, reordenar as Pt, agrupar as Mt, desagrupar as zt, alinhar as xt, distribuir as Et, ordenarPorEmpilhamento as U, aplicarAparencia as de, criarMascara as Ct, liberarMascara as Tt, unirCaminhos as wt, dividirComLinha as Dt, deslocarCaminho as It, duplicarElementos as he, simplificarCaminho as Ft, contornoDoTraco as _t, converterEmCaminho as Nt, desenharElementos as $, caixaOrientada as Ot, ancorasDoElemento as xa, alcasDoElemento as me, caixaDaSelecao as Ea, posicoesDasAlcas as fe, contornoNaFolha as Ca, aplicar as Rt, posicaoLocalDaAlca as Lt, ALCAS_ESCALA as kt, raiosEfetivos as pe, profundidadeNoCanto as ge, limitesNaFolha as Y, comRaioDeCanto as qt, moverAlcaDaAncora as Bt, moverAncora as jt, rotacaoPorArrasto as Gt, matrizDeCisalhamentoPorAlca as Ht, matrizDeEscalaPorAlca as $t, guiasInteligentes as Vt, marcasDosCantos as Kt, envelopeNaFolha as Wt, elementoNoTopo as na, trechoMaisProximo as Ut, adicionarAncora as Xt, ancoraMaisProxima as Zt, converterAncora as Jt, elementosNaCaixa as Qt, deMm as Yt, caixaDoQuadro as ve, OPERACOES_BOOLEANAS as ar, aplicarPathfinder as er, ehUnidadePrancha as tr, temMedidorTexto as rr, definirMedidorTexto as ir, saneada as or, ehPredefinicao as sr, gerarPredefinicao as nr, envelopeVisual as Na, exportarSvg as lr, ehPropriedadePrancha as cr, ehPropriedadeDeGeometria as ur, comPropriedade as dr, rotacaoEmGraus as hr, MODOS_MESCLAGEM as mr, valorDaPropriedade as fr, resolverAparencia as pr, ITENS_PREDEFINICOES as Oa } from "./prancha-nucleo.js";
6
+ import { DIMENSOES_FOLHA as So, EPSILON_DETERMINANTE as Po, ESCALA_MINIMA as Mo, ESPESSURA_PADRAO_MM as zo, ESTILOS_TRACO as xo, ESTILO_DO_TIPO_LINHA as Eo, FAIXAS_MAXIMO as Co, FAIXAS_PADRAO as To, FONTE_PADRAO as wo, FORMATOS_ABNT as Do, IDENTIDADE as Io, IDS_PROPRIEDADES_PRANCHA as Fo, KAPPA as _o, LIMITE_PONTA_PADRAO as No, MAX_LINHAS_HACHURA as Oo, MESCLAGEM_CSS as Ro, MM_POR_PX as Lo, MM_POR_UNIDADE as ko, PREDEFINICOES as qo, PRIORIDADE_SNAP_PRANCHA as Bo, ROTULOS_PREDEFINICOES as jo, SOMBRA_PADRAO as Go, TIPO_LINHA_DO_ESTILO as Ho, adaptarContextoRelativo as $o, ajustarAparenciaEmLote as Vo, ajustarElementosACaixa as Ko, aparenciaDe as Wo, aplicarTodos as Uo, aplicarVetor as Xo, areaComSinal as Zo, areaDosPoligonos as Jo, avisarUmaVez as Qo, caixaDoQuadroAbnt as Yo, caixaDoTexto as as, caixaNormalizada as es, caminhoDoContorno as ts, caminhoFinito as rs, caminhoParaSvg as is, cisalhamento as os, comoCaminhoNaFolha as ss, comprimentoDaPonta as ns, contornoElipse as ls, contornoEstrela as cs, contornoLocal as us, contornoLocalEmCache as ds, contornoPoligonoRegular as hs, contornoRetangulo as ms, corComOpacidade as fs, corNaPosicao as ps, decompor as gs, desenharPlano as vs, determinante as bs, diagnosticarContexto as ys, direcaoNaPonta as As, ehFechado as Ss, ehIdentidade as Ps, ehSingular as Ms, elementosNoLaco as zs, elementosNoPonto as xs, emTornoDe as Es, espelhamento as Cs, faixasDoGradienteLinear as Ts, feicaoDoElemento as ws, fonteSegura as Ds, geometriaDaPonta as Is, girarElementos as Fs, iguais as _s, inverter as Ns, limitesLocais as Os, linhasDeHachura as Rs, mapearPontoNaCaixa as Ls, margensAbnt as ks, matriz as qs, matrizDoElemento as Bs, meiaEspessura as js, modoDeTransformacao as Gs, moverElemento as Hs, multiplicar as $s, normalizarAparencia as Vs, normalizarGeometriaElemento as Ks, normalizarGradiente as Ws, normalizarHachura as Us, normalizarParaOrigem as Xs, operacaoBooleana as Zs, padraoTipoLinhaMm as Js, pivoNaFolha as Qs, planejar as Ys, planejarElemento as an, planejarElementos as en, planoDe as tn, pontoNoAnel as rn, raiosCabiveis as on, recompor as sn, redefinirAvisoContexto as nn, regiaoDoElemento as ln, resolverSombra as cn, resumirAparencia as un, temPreenchimento as dn, testarElemento as hn, transformarContorno as mn, varreduraDoArco as fn } from "./prancha-nucleo.js";
7
+ import { n as gr, T as vr } from "./geometria-px-DHMPUsxC.js";
8
+ import { K as be, M as Ra, N as br, O as yr, U as ye, S as Ae, L as Ta, d as Se } from "./kit-base-CBXA66aM.js";
9
+ import { E as gn } from "./feature_caixa-BVc5LenS.js";
10
+ import { S as Ar } from "./feature_desenho-CC8Mp5Gp.js";
11
+ const Sr = ":host{--ui-prancha-mesa: var(--ui-cor-fundo);--ui-prancha-papel: var(--ui-cor-papel);--ui-prancha-borda-papel: var(--ui-cor-borda);--ui-prancha-grade: var(--ui-cor-grade-papel);--ui-prancha-selecao: var(--ui-cor-primaria);--ui-prancha-alca: var(--ui-cor-superficie);--ui-prancha-guia: var(--ui-cor-guia);--ui-prancha-guia-inteligente: var(--ui-cor-guia-inteligente);--ui-prancha-snap: var(--ui-cor-destaque);--ui-prancha-regua: var(--ui-cor-fundo-elevado);--ui-prancha-texto-regua: var(--ui-cor-texto-secundario);--ui-prancha-tamanho-regua: 20px;display:block;position:relative;min-height:240px;min-width:240px;height:100%;background:var(--ui-cor-fundo);color:var(--ui-cor-texto);font-family:var(--ui-fonte-base);outline:none;contain:layout paint}:host([hidden]){display:none}.raiz{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;grid-template-columns:var(--ui-prancha-tamanho-regua) 1fr;grid-template-rows:var(--ui-prancha-tamanho-regua) 1fr}:host([sem-reguas]) .raiz{grid-template-columns:0 1fr;grid-template-rows:0 1fr}:host([sem-reguas]) .regua,:host([sem-reguas]) .canto{display:none}.canto{background:var(--ui-prancha-regua);border-right:1px solid var(--ui-cor-borda);border-bottom:1px solid var(--ui-cor-borda)}.regua{display:block;width:100%;height:100%;background:var(--ui-prancha-regua);cursor:default;touch-action:none}.regua-h{border-bottom:1px solid var(--ui-cor-borda);cursor:s-resize}.regua-v{border-right:1px solid var(--ui-cor-borda);cursor:e-resize}.viewport{position:relative;overflow:hidden;background:var(--ui-prancha-mesa);touch-action:none;cursor:default}.viewport:focus-visible{outline:2px solid var(--ui-cor-primaria);outline-offset:-2px}.viewport[data-cursor=mao]{cursor:grab}.viewport[data-cursor=arrastando]{cursor:grabbing}.viewport[data-cursor=mira]{cursor:crosshair}.viewport[data-cursor=mover]{cursor:move}.viewport[data-cursor=girar]{cursor:alias}.viewport[data-cursor=ancora]{cursor:pointer}.camada{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;display:block;pointer-events:none}.status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){:host{--ui-prancha-tamanho-regua: 24px}}";
12
+ function Pr() {
13
13
  return `
14
- <style>${cr}</style>
14
+ <style>${Sr}</style>
15
15
  <div class="raiz" part="base">
16
16
  <div class="canto" part="canto-reguas" aria-hidden="true"></div>
17
17
  <canvas class="regua regua-h" id="regua-h" part="regua regua-horizontal" aria-hidden="true"></canvas>
@@ -26,82 +26,82 @@ function ur() {
26
26
  </div>
27
27
  `;
28
28
  }
29
- function ka(t, a) {
30
- const e = new Map(t.map((o) => [o.id, o])), r = new Map(a.map((o) => [o.id, o])), i = { adicionados: [], atualizados: [], removidos: [] };
29
+ function La(t, e) {
30
+ const a = new Map(t.map((o) => [o.id, o])), r = new Map(e.map((o) => [o.id, o])), i = { adicionados: [], atualizados: [], removidos: [] };
31
31
  for (const [o, s] of r) {
32
- const n = e.get(o);
32
+ const n = a.get(o);
33
33
  n ? n !== s && i.atualizados.push(s) : i.adicionados.push(s);
34
34
  }
35
- for (const [o, s] of e) r.has(o) || i.removidos.push(s);
35
+ for (const [o, s] of a) r.has(o) || i.removidos.push(s);
36
36
  return i;
37
37
  }
38
- const ga = (t) => t.adicionados.length + t.atualizados.length + t.removidos.length === 0;
39
- class dr {
38
+ const Aa = (t) => t.adicionados.length + t.atualizados.length + t.removidos.length === 0;
39
+ class Mr {
40
40
  constructor() {
41
41
  m(this, "lista", []);
42
42
  m(this, "porId", /* @__PURE__ */ new Map());
43
43
  m(this, "posicoes", /* @__PURE__ */ new Map());
44
44
  m(this, "_selecao", []);
45
- m(this, "indice", new $e());
46
- m(this, "historico", new Be({ limite: 100, janelaRajadaMs: 1e3 }));
45
+ m(this, "indice", new at());
46
+ m(this, "historico", new et({ limite: 100, janelaRajadaMs: 1e3 }));
47
47
  /** Contador de mudanças do documento (carga, edição, desfazer/refazer, renomear): base do `modificado` do componente. */
48
48
  m(this, "revisao", 0);
49
49
  m(this, "ouvinteMudanca", null);
50
50
  }
51
51
  /** Registra quem é avisado depois de cada mudança do documento (o componente avalia o `modificado`). */
52
- ouvirMudancas(a) {
53
- this.ouvinteMudanca = a;
52
+ ouvirMudancas(e) {
53
+ this.ouvinteMudanca = e;
54
54
  }
55
55
  mudou() {
56
- var a;
56
+ var e;
57
57
  this.revisao++;
58
58
  try {
59
- (a = this.ouvinteMudanca) == null || a.call(this);
59
+ (e = this.ouvinteMudanca) == null || e.call(this);
60
60
  } catch {
61
61
  }
62
62
  }
63
63
  get elementos() {
64
64
  return this.lista;
65
65
  }
66
- obter(a) {
67
- return this.porId.get(a);
66
+ obter(e) {
67
+ return this.porId.get(e);
68
68
  }
69
69
  get selecao() {
70
70
  return this._selecao;
71
71
  }
72
72
  elementosSelecionados() {
73
- return this._selecao.map((a) => this.porId.get(a)).filter((a) => !!a);
73
+ return this._selecao.map((e) => this.porId.get(e)).filter((e) => !!e);
74
74
  }
75
75
  /** Troca tudo (carga de documento): normaliza, recomeça o histórico e limpa a seleção. */
76
- definir(a) {
77
- const e = Ke(a);
78
- return this.aplicar(e.elementos), this.indice.definir(e.elementos), this.historico.limpar(), this._selecao = [], this.mudou(), e;
76
+ definir(e) {
77
+ const a = tt(e);
78
+ return this.aplicar(a.elementos), this.indice.definir(a.elementos), this.historico.limpar(), this._selecao = [], this.mudou(), a;
79
79
  }
80
- aplicar(a) {
81
- this.lista = a, this.porId = new Map(a.map((e) => [e.id, e])), this.posicoes = new Map(a.map((e, r) => [e.id, r]));
80
+ aplicar(e) {
81
+ this.lista = e, this.porId = new Map(e.map((a) => [a.id, a])), this.posicoes = new Map(e.map((a, r) => [a.id, r]));
82
82
  }
83
83
  /** Os elementos na ordem da lista do documento (o índice espacial devolve em outra ordem). */
84
- naOrdemDoDocumento(a) {
85
- return [...a].sort((e, r) => (this.posicoes.get(e.id) ?? 0) - (this.posicoes.get(r.id) ?? 0));
84
+ naOrdemDoDocumento(e) {
85
+ return [...e].sort((a, r) => (this.posicoes.get(a.id) ?? 0) - (this.posicoes.get(r.id) ?? 0));
86
86
  }
87
87
  /** Mudança central: grava o passo no histórico, atualiza índice e seleção e devolve a diferença. */
88
- substituir(a, e = {}) {
89
- const r = this.lista, i = ka(r, a);
90
- return ga(i) && r.length === a.length && r.every((o, s) => o === a[s]) || (e.registrar !== !1 && this.historico.registrar(r, { chave: e.chave, agora: e.agora }), this.aplicar(a), this.sincronizarIndice(i), this._selecao = this._selecao.filter((o) => this.porId.has(o)), this.mudou()), i;
88
+ substituir(e, a = {}) {
89
+ const r = this.lista, i = La(r, e);
90
+ return Aa(i) && r.length === e.length && r.every((o, s) => o === e[s]) || (a.registrar !== !1 && this.historico.registrar(r, { chave: a.chave, agora: a.agora }), this.aplicar(e), this.sincronizarIndice(i), this._selecao = this._selecao.filter((o) => this.porId.has(o)), this.mudou()), i;
91
91
  }
92
- sincronizarIndice(a) {
93
- for (const r of a.removidos) this.indice.remover(r.id);
94
- const e = [...a.adicionados, ...a.atualizados];
95
- e.length > 0 && this.indice.atualizarVarios(e);
92
+ sincronizarIndice(e) {
93
+ for (const r of e.removidos) this.indice.remover(r.id);
94
+ const a = [...e.adicionados, ...e.atualizados];
95
+ a.length > 0 && this.indice.atualizarVarios(a);
96
96
  }
97
97
  /** Aplica o lote do app (normalizado; ids repetidos e inválidos recusados). */
98
- aplicarLote(a, e = !0) {
99
- const r = { adicionados: [], atualizados: [], removidos: [], recusados: [] }, i = new Map(this.lista.map((d) => [d.id, d])), o = this.lista.map((d) => d.id), s = new Set((Array.isArray(a == null ? void 0 : a.remover) ? a.remover : []).filter((d) => typeof d == "string"));
98
+ aplicarLote(e, a = !0) {
99
+ const r = { adicionados: [], atualizados: [], removidos: [], recusados: [] }, i = new Map(this.lista.map((d) => [d.id, d])), o = this.lista.map((d) => d.id), s = new Set((Array.isArray(e == null ? void 0 : e.remover) ? e.remover : []).filter((d) => typeof d == "string"));
100
100
  for (const d of s)
101
101
  i.delete(d) && r.removidos.push(d);
102
102
  const n = (d, h) => {
103
103
  Array.isArray(d) && d.forEach((u, f) => {
104
- const p = Ve(u);
104
+ const p = rt(u);
105
105
  if (typeof p == "string") {
106
106
  r.recusados.push({ indice: f, motivo: p });
107
107
  return;
@@ -118,100 +118,100 @@ class dr {
118
118
  h === "adicionar" && o.push(p.id), i.set(p.id, p), (h === "adicionar" ? r.adicionados : r.atualizados).push(p.id);
119
119
  });
120
120
  };
121
- n(a == null ? void 0 : a.adicionar, "adicionar"), n(a == null ? void 0 : a.atualizar, "atualizar");
121
+ n(e == null ? void 0 : e.adicionar, "adicionar"), n(e == null ? void 0 : e.atualizar, "atualizar");
122
122
  const l = /* @__PURE__ */ new Set(), c = [];
123
123
  for (const d of o) {
124
124
  const h = i.get(d);
125
125
  h && !l.has(d) && (l.add(d), c.push(h));
126
126
  }
127
- return { resultado: r, diferenca: this.substituir(c, { registrar: e }) };
127
+ return { resultado: r, diferenca: this.substituir(c, { registrar: a }) };
128
128
  }
129
129
  desfazer() {
130
- const a = this.historico.desfazer(this.lista);
131
- return a ? this.restaurar(a) : null;
130
+ const e = this.historico.desfazer(this.lista);
131
+ return e ? this.restaurar(e) : null;
132
132
  }
133
133
  refazer() {
134
- const a = this.historico.refazer(this.lista);
135
- return a ? this.restaurar(a) : null;
134
+ const e = this.historico.refazer(this.lista);
135
+ return e ? this.restaurar(e) : null;
136
136
  }
137
- restaurar(a) {
138
- const e = ka(this.lista, a);
139
- return this.aplicar(a), this.sincronizarIndice(e), this._selecao = this._selecao.filter((r) => this.porId.has(r)), this.mudou(), e;
137
+ restaurar(e) {
138
+ const a = La(this.lista, e);
139
+ return this.aplicar(e), this.sincronizarIndice(a), this._selecao = this._selecao.filter((r) => this.porId.has(r)), this.mudou(), a;
140
140
  }
141
141
  /** Troca o id de um elemento em tudo (lista, índice, seleção e histórico). `false` se não existe ou o novo já existe. */
142
- renomear(a, e) {
143
- if (typeof e != "string" || !e.trim() || !this.porId.has(a) || this.porId.has(e)) return !1;
144
- const r = (o) => o.map((s) => s.id === a ? { ...s, id: e } : s), i = r(this.lista);
145
- return this.indice.remover(a), this.aplicar(i), this.indice.atualizar(this.porId.get(e)), this.historico.transformar(r), this._selecao = this._selecao.map((o) => o === a ? e : o), this.mudou(), !0;
142
+ renomear(e, a) {
143
+ if (typeof a != "string" || !a.trim() || !this.porId.has(e) || this.porId.has(a)) return !1;
144
+ const r = (o) => o.map((s) => s.id === e ? { ...s, id: a } : s), i = r(this.lista);
145
+ return this.indice.remover(e), this.aplicar(i), this.indice.atualizar(this.porId.get(a)), this.historico.transformar(r), this._selecao = this._selecao.map((o) => o === e ? a : o), this.mudou(), !0;
146
146
  }
147
147
  /** Muda a seleção; devolve se mudou. Só ids existentes, não bloqueados nem ocultos, sem repetição, na ordem dada. */
148
- selecionar(a, e = "substituir") {
149
- const r = a.filter((n, l) => {
148
+ selecionar(e, a = "substituir") {
149
+ const r = e.filter((n, l) => {
150
150
  const c = this.porId.get(n);
151
- return !!c && !c.bloqueado && !c.oculto && a.indexOf(n) === l;
151
+ return !!c && !c.bloqueado && !c.oculto && e.indexOf(n) === l;
152
152
  }), i = this._selecao;
153
153
  let o;
154
- e === "substituir" ? o = r : e === "adicionar" ? o = [...i, ...r.filter((n) => !i.includes(n))] : e === "remover" ? o = i.filter((n) => !r.includes(n)) : o = [...i.filter((n) => !r.includes(n)), ...r.filter((n) => !i.includes(n))];
154
+ a === "substituir" ? o = r : a === "adicionar" ? o = [...i, ...r.filter((n) => !i.includes(n))] : a === "remover" ? o = i.filter((n) => !r.includes(n)) : o = [...i.filter((n) => !r.includes(n)), ...r.filter((n) => !i.includes(n))];
155
155
  const s = o.length !== i.length || o.some((n, l) => n !== i[l]);
156
156
  return s && (this._selecao = o), s;
157
157
  }
158
158
  }
159
- const H = 96 / 25.4, ha = H * 0.02, ma = H * 64, z = (t) => typeof t == "number" && Number.isFinite(t);
160
- class hr {
159
+ const W = 96 / 25.4, pa = W * 0.02, ga = W * 64, E = (t) => typeof t == "number" && Number.isFinite(t);
160
+ class zr {
161
161
  constructor() {
162
- m(this, "zoom", H);
162
+ m(this, "zoom", W);
163
163
  m(this, "pan", [0, 0]);
164
164
  m(this, "largura", 0);
165
165
  m(this, "altura", 0);
166
166
  m(this, "dpr", 1);
167
167
  }
168
168
  get zoomPercentual() {
169
- return this.zoom / H * 100;
169
+ return this.zoom / W * 100;
170
170
  }
171
171
  /** Folha (mm) → px CSS da área de desenho. */
172
172
  matrizTela() {
173
- return wa(q(this.zoom), k(this.pan[0], this.pan[1]));
173
+ return Fa(H(this.zoom), k(this.pan[0], this.pan[1]));
174
174
  }
175
175
  /** Folha (mm) → px do dispositivo (com o dpr): a matriz do pintor. */
176
176
  matrizDispositivo() {
177
- return wa(q(this.zoom), k(this.pan[0], this.pan[1]), q(this.dpr));
177
+ return Fa(H(this.zoom), k(this.pan[0], this.pan[1]), H(this.dpr));
178
178
  }
179
- paraFolha(a, e) {
180
- return [(a - this.pan[0]) / this.zoom, (e - this.pan[1]) / this.zoom];
179
+ paraFolha(e, a) {
180
+ return [(e - this.pan[0]) / this.zoom, (a - this.pan[1]) / this.zoom];
181
181
  }
182
- paraTela(a) {
183
- return [a[0] * this.zoom + this.pan[0], a[1] * this.zoom + this.pan[1]];
182
+ paraTela(e) {
183
+ return [e[0] * this.zoom + this.pan[0], e[1] * this.zoom + this.pan[1]];
184
184
  }
185
185
  /** Muda o tamanho da área de desenho (px CSS) e o dpr; valores inválidos são ignorados. */
186
- redimensionar(a, e, r = 1) {
187
- z(a) && a >= 0 && (this.largura = a), z(e) && e >= 0 && (this.altura = e), z(r) && r > 0 && (this.dpr = Math.min(r, 4));
186
+ redimensionar(e, a, r = 1) {
187
+ E(e) && e >= 0 && (this.largura = e), E(a) && a >= 0 && (this.altura = a), E(r) && r > 0 && (this.dpr = Math.min(r, 4));
188
188
  }
189
189
  /** Zoom absoluto mantendo parado o ponto de tela `foco` (padrão: o centro). Devolve se mudou. */
190
- definirZoom(a, e) {
191
- if (!z(a) || a <= 0) return !1;
192
- const r = Math.min(ma, Math.max(ha, a));
190
+ definirZoom(e, a) {
191
+ if (!E(e) || e <= 0) return !1;
192
+ const r = Math.min(ga, Math.max(pa, e));
193
193
  if (r === this.zoom) return !1;
194
- const i = e && z(e[0]) && z(e[1]) ? e : [this.largura / 2, this.altura / 2], o = this.paraFolha(i[0], i[1]);
194
+ const i = a && E(a[0]) && E(a[1]) ? a : [this.largura / 2, this.altura / 2], o = this.paraFolha(i[0], i[1]);
195
195
  return this.zoom = r, this.pan = [i[0] - o[0] * r, i[1] - o[1] * r], !0;
196
196
  }
197
- zoomRelativo(a, e) {
198
- return z(a) && a > 0 ? this.definirZoom(this.zoom * a, e) : !1;
197
+ zoomRelativo(e, a) {
198
+ return E(e) && e > 0 ? this.definirZoom(this.zoom * e, a) : !1;
199
199
  }
200
- deslocar(a, e) {
201
- return !z(a) || !z(e) || a === 0 && e === 0 ? !1 : (this.pan = [this.pan[0] + a, this.pan[1] + e], !0);
200
+ deslocar(e, a) {
201
+ return !E(e) || !E(a) || e === 0 && a === 0 ? !1 : (this.pan = [this.pan[0] + e, this.pan[1] + a], !0);
202
202
  }
203
203
  /** Zoom absoluto mantendo o CENTRO da caixa (mm) no centro da área de desenho (usado no teto de zoom do enquadramento). */
204
- definirZoomCentrado(a, e) {
205
- return !z(a) || a <= 0 || !e || ![e.x, e.y, e.largura, e.altura].every(z) ? !1 : (this.zoom = Math.min(ma, Math.max(ha, a)), this.pan = [this.largura / 2 - (e.x + e.largura / 2) * this.zoom, this.altura / 2 - (e.y + e.altura / 2) * this.zoom], !0);
204
+ definirZoomCentrado(e, a) {
205
+ return !E(e) || e <= 0 || !a || ![a.x, a.y, a.largura, a.altura].every(E) ? !1 : (this.zoom = Math.min(ga, Math.max(pa, e)), this.pan = [this.largura / 2 - (a.x + a.largura / 2) * this.zoom, this.altura / 2 - (a.y + a.altura / 2) * this.zoom], !0);
206
206
  }
207
207
  /** Enquadra a caixa (mm) com `margem` px em volta. Sem tamanho de área de desenho, não faz nada. */
208
- enquadrar(a, e = 24) {
209
- if (!a || ![a.x, a.y, a.largura, a.altura].every(z) || this.largura <= 0 || this.altura <= 0) return !1;
210
- const r = Math.max(a.largura, 1e-6), i = Math.max(a.altura, 1e-6), o = Math.max(1, this.largura - 2 * e), s = Math.max(1, this.altura - 2 * e);
211
- return this.zoom = Math.min(ma, Math.max(ha, Math.min(o / r, s / i))), this.pan = [this.largura / 2 - (a.x + r / 2) * this.zoom, this.altura / 2 - (a.y + i / 2) * this.zoom], !0;
208
+ enquadrar(e, a = 24) {
209
+ if (!e || ![e.x, e.y, e.largura, e.altura].every(E) || this.largura <= 0 || this.altura <= 0) return !1;
210
+ const r = Math.max(e.largura, 1e-6), i = Math.max(e.altura, 1e-6), o = Math.max(1, this.largura - 2 * a), s = Math.max(1, this.altura - 2 * a);
211
+ return this.zoom = Math.min(ga, Math.max(pa, Math.min(o / r, s / i))), this.pan = [this.largura / 2 - (e.x + r / 2) * this.zoom, this.altura / 2 - (e.y + i / 2) * this.zoom], !0;
212
212
  }
213
213
  }
214
- function mr() {
214
+ function xr() {
215
215
  return {
216
216
  hoverId: null,
217
217
  caixaSelecao: null,
@@ -228,10 +228,10 @@ function mr() {
228
228
  copiasEmGesto: []
229
229
  };
230
230
  }
231
- function j(t) {
231
+ function V(t) {
232
232
  t.caixaSelecao = null, t.substitutos = /* @__PURE__ */ new Map(), t.previa = null, t.pontosPrevia = [], t.snap = null, t.linhasInteligentes = [], t.guiaArrastada = null, t.rotulo = null, t.copiasEmGesto = [];
233
233
  }
234
- const La = Object.freeze({
234
+ const ka = Object.freeze({
235
235
  mesa: "--ui-prancha-mesa",
236
236
  papel: "--ui-prancha-papel",
237
237
  bordaPapel: "--ui-prancha-borda-papel",
@@ -243,7 +243,7 @@ const La = Object.freeze({
243
243
  snap: "--ui-prancha-snap",
244
244
  regua: "--ui-prancha-regua",
245
245
  textoRegua: "--ui-prancha-texto-regua"
246
- }), va = Object.freeze({
246
+ }), Sa = Object.freeze({
247
247
  mesa: "#0b0b0d",
248
248
  papel: "#ffffff",
249
249
  bordaPapel: "rgba(255, 255, 255, 0.08)",
@@ -256,23 +256,23 @@ const La = Object.freeze({
256
256
  regua: "#1a1a1e",
257
257
  textoRegua: "#9696a6"
258
258
  });
259
- function fr(t) {
259
+ function Er(t) {
260
260
  var r;
261
- const a = { ...va };
262
- if (!t || typeof getComputedStyle != "function") return a;
263
- let e = null;
261
+ const e = { ...Sa };
262
+ if (!t || typeof getComputedStyle != "function") return e;
263
+ let a = null;
264
264
  try {
265
- e = getComputedStyle(t);
265
+ a = getComputedStyle(t);
266
266
  } catch {
267
- return a;
267
+ return e;
268
268
  }
269
- for (const i of Object.keys(La)) {
270
- const o = (r = e.getPropertyValue(La[i])) == null ? void 0 : r.trim();
271
- o && (a[i] = or(o, va[i]));
269
+ for (const i of Object.keys(ka)) {
270
+ const o = (r = a.getPropertyValue(ka[i])) == null ? void 0 : r.trim();
271
+ o && (e[i] = gr(o, Sa[i]));
272
272
  }
273
- return a;
273
+ return e;
274
274
  }
275
- const pr = {
275
+ const Cr = {
276
276
  selecao: "Seleção",
277
277
  "selecao-direta": "Seleção direta",
278
278
  mao: "Mão",
@@ -287,24 +287,24 @@ const pr = {
287
287
  caneta: "Caneta",
288
288
  texto: "Texto"
289
289
  };
290
- function gr(t) {
290
+ function Tr(t) {
291
291
  return t <= 0 ? "Nenhum elemento selecionado" : t === 1 ? "1 elemento selecionado" : `${t} elementos selecionados`;
292
292
  }
293
- function vr(t) {
294
- return `Ferramenta ${pr[t] ?? t}`;
293
+ function wr(t) {
294
+ return `Ferramenta ${Cr[t] ?? t}`;
295
295
  }
296
- function sa(t) {
296
+ function la(t) {
297
297
  return `Zoom ${Math.round(t)}%`;
298
298
  }
299
- function br(t, a) {
300
- t && t.textContent !== a && (t.textContent = a);
299
+ function Dr(t, e) {
300
+ t && t.textContent !== e && (t.textContent = e);
301
301
  }
302
- class yr {
303
- constructor(a) {
304
- m(this, "doc", new dr());
305
- m(this, "vista", new hr());
306
- m(this, "ui", mr());
307
- m(this, "cores", { ...va });
302
+ class Ir {
303
+ constructor(e) {
304
+ m(this, "doc", new Mr());
305
+ m(this, "vista", new zr());
306
+ m(this, "ui", xr());
307
+ m(this, "cores", { ...Sa });
308
308
  m(this, "guias", []);
309
309
  m(this, "ferramenta", "selecao");
310
310
  m(this, "opcoesFerramentas", {});
@@ -330,46 +330,46 @@ class yr {
330
330
  m(this, "cacheMapa", null);
331
331
  /** Elementos para a base: os do documento com os substitutos do gesto em andamento no lugar. */
332
332
  m(this, "cacheBase", null);
333
- this.dep = a, this.gerarId = (e) => `${e}-${Date.now().toString(36)}-${(++this.sequencia).toString(36)}`;
333
+ this.dep = e, this.gerarId = (a) => `${a}-${Date.now().toString(36)}-${(++this.sequencia).toString(36)}`;
334
334
  }
335
- emitir(a, e, r = !1) {
336
- return this.dep.emitir(a, e, r);
335
+ emitir(e, a, r = !1) {
336
+ return this.dep.emitir(e, a, r);
337
337
  }
338
338
  agendar() {
339
339
  this.dep.agendar();
340
340
  }
341
- anunciar(a) {
342
- this.dep.anunciar(a);
341
+ anunciar(e) {
342
+ this.dep.anunciar(e);
343
343
  }
344
- recusar(a, e, r) {
345
- this.emitir("prancha-recusa", r === void 0 ? { acao: a, motivo: e } : { acao: a, motivo: e, id: r });
344
+ recusar(e, a, r) {
345
+ this.emitir("prancha-recusa", r === void 0 ? { acao: e, motivo: a } : { acao: e, motivo: a, id: r });
346
346
  }
347
347
  /** Regras das camadas atuais (em cache pela lista). */
348
348
  mapa() {
349
- return (!this.cacheMapa || this.cacheMapa.camadas !== this.camadas) && (this.cacheMapa = { camadas: this.camadas, mapa: Ue(this.camadas) }), this.cacheMapa.mapa;
349
+ return (!this.cacheMapa || this.cacheMapa.camadas !== this.camadas) && (this.cacheMapa = { camadas: this.camadas, mapa: it(this.camadas) }), this.cacheMapa.mapa;
350
350
  }
351
351
  /** Pode ser selecionado agora: visível, destravado (ele e a camada), não é máscara e está no grupo isolado, se houver. */
352
- podeSelecionar(a) {
353
- const e = this.mapa();
354
- return !!a && !a.mascara && e.visivel(a) && !e.travado(a) && (this.isolado === null || a.grupoId === this.isolado);
352
+ podeSelecionar(e) {
353
+ const a = this.mapa();
354
+ return !!e && !e.mascara && a.visivel(e) && !a.travado(e) && (this.isolado === null || e.grupoId === this.isolado);
355
355
  }
356
356
  /** Elementos perto do ponto (pelo índice), visíveis, na ordem do documento (para o desempate do empilhamento). */
357
- candidatosEm(a, e) {
357
+ candidatosEm(e, a) {
358
358
  const r = this.mapa();
359
- return this.doc.naOrdemDoDocumento(this.doc.indice.consultarPonto(a, e).filter((i) => r.visivel(i)));
359
+ return this.doc.naOrdemDoDocumento(this.doc.indice.consultarPonto(e, a).filter((i) => r.visivel(i)));
360
360
  }
361
- definirCamadas(a) {
362
- this.camadas = Xe(a), this.camadaAtiva && !this.camadas.some((e) => e.id === this.camadaAtiva) && (this.camadaAtiva = null), this.emitir("prancha-camadas", { camadas: this.camadas.map((e) => ({ ...e })) }), this.podarSelecao(), this.agendar();
361
+ definirCamadas(e) {
362
+ this.camadas = ot(e), this.camadaAtiva && !this.camadas.some((a) => a.id === this.camadaAtiva) && (this.camadaAtiva = null), this.emitir("prancha-camadas", { camadas: this.camadas.map((a) => ({ ...a })) }), this.podarSelecao(), this.agendar();
363
363
  }
364
364
  /** Isola um grupo (só os membros se selecionam; o resto fica esmaecido) ou sai do isolamento (`null`). */
365
- isolar(a) {
366
- const e = typeof a == "string" && this.doc.elementos.some((r) => r.grupoId === a) ? a : null;
367
- e !== this.isolado && (this.isolado = e, this.emitir("prancha-isolamento", { grupoId: e }), this.anunciar(e ? "Grupo isolado" : "Saiu do grupo"), this.podarSelecao(), this.agendar());
365
+ isolar(e) {
366
+ const a = typeof e == "string" && this.doc.elementos.some((r) => r.grupoId === e) ? e : null;
367
+ a !== this.isolado && (this.isolado = a, this.emitir("prancha-isolamento", { grupoId: a }), this.anunciar(a ? "Grupo isolado" : "Saiu do grupo"), this.podarSelecao(), this.agendar());
368
368
  }
369
369
  /** Tira da seleção o que deixou de ser selecionável (camada oculta ou bloqueada, fora do grupo isolado). */
370
370
  podarSelecao() {
371
- const a = this.doc.selecao.filter((e) => this.podeSelecionar(this.doc.obter(e)));
372
- a.length !== this.doc.selecao.length && this.selecionar(a, "substituir", !1);
371
+ const e = this.doc.selecao.filter((a) => this.podeSelecionar(this.doc.obter(a)));
372
+ e.length !== this.doc.selecao.length && this.selecionar(e, "substituir", !1);
373
373
  }
374
374
  /**
375
375
  * Elementos da BASE: os do documento, sem os que estão num gesto (arrasto, alça, âncora). A lista fica a mesma durante o
@@ -377,252 +377,252 @@ class yr {
377
377
  * (`elementosEmGesto`), por cima, como a prévia de arrasto dos editores vetoriais.
378
378
  */
379
379
  elementosVisiveis() {
380
- const a = this.ui.substitutos;
381
- if (a.size === 0) return this.doc.elementos;
382
- const e = [...a.keys()].join("\0"), r = this.cacheBase;
383
- if (r && r.elementos === this.doc.elementos && r.ids === e) return r.base;
384
- const i = this.doc.elementos.filter((o) => !a.has(o.id));
385
- return this.cacheBase = { elementos: this.doc.elementos, ids: e, base: i }, i;
380
+ const e = this.ui.substitutos;
381
+ if (e.size === 0) return this.doc.elementos;
382
+ const a = [...e.keys()].join("\0"), r = this.cacheBase;
383
+ if (r && r.elementos === this.doc.elementos && r.ids === a) return r.base;
384
+ const i = this.doc.elementos.filter((o) => !e.has(o.id));
385
+ return this.cacheBase = { elementos: this.doc.elementos, ids: a, base: i }, i;
386
386
  }
387
387
  /** Elementos transformados pelo gesto em andamento, na ordem de empilhamento. */
388
388
  elementosEmGesto() {
389
- const a = this.ui.substitutos, e = a.size === 0 ? [] : this.doc.elementos.filter((r) => a.has(r.id)).map((r) => a.get(r.id));
390
- return this.ui.copiasEmGesto.length > 0 ? [...e, ...this.ui.copiasEmGesto] : e;
389
+ const e = this.ui.substitutos, a = e.size === 0 ? [] : this.doc.elementos.filter((r) => e.has(r.id)).map((r) => e.get(r.id));
390
+ return this.ui.copiasEmGesto.length > 0 ? [...a, ...this.ui.copiasEmGesto] : a;
391
391
  }
392
392
  /** Emite os eventos da diferença (criados, atualizados, removidos) com o motivo. */
393
- emitirDiferenca(a, e) {
394
- a.adicionados.length > 0 && this.emitir("prancha-elemento-criado", { elementos: a.adicionados, motivo: e }), a.atualizados.length > 0 && this.emitir("prancha-elemento-atualizado", { elementos: a.atualizados, motivo: e }), a.removidos.length > 0 && this.emitir("prancha-elemento-removido", { ids: a.removidos.map((r) => r.id), elementos: a.removidos, motivo: e });
393
+ emitirDiferenca(e, a) {
394
+ e.adicionados.length > 0 && this.emitir("prancha-elemento-criado", { elementos: e.adicionados, motivo: a }), e.atualizados.length > 0 && this.emitir("prancha-elemento-atualizado", { elementos: e.atualizados, motivo: a }), e.removidos.length > 0 && this.emitir("prancha-elemento-removido", { ids: e.removidos.map((r) => r.id), elementos: e.removidos, motivo: a });
395
395
  }
396
396
  emitirHistorico() {
397
397
  this.emitir("prancha-historico", { podeDesfazer: this.doc.historico.podeDesfazer, podeRefazer: this.doc.historico.podeRefazer });
398
398
  }
399
399
  /** Mudança do usuário: histórico + eventos + repintura. `chave` junta rajadas (setas, scrubber) num passo. */
400
- aplicar(a, e, r) {
401
- const i = this.doc.selecao.join("\0"), o = this.doc.elementos.map((l) => l.id).join("\0"), s = this.doc.substituir(a, { chave: r });
402
- return this.doc.elementos.map((l) => l.id).join("\0") !== o && s.adicionados.length === 0 && s.removidos.length === 0 && (this.emitir("prancha-ordem", { ids: this.doc.elementos.map((l) => l.id), motivo: e }), ga(s) && this.emitirHistorico()), ga(s) || (this.emitirDiferenca(s, e), this.emitirHistorico(), this.ui.edicao && !this.doc.obter(this.ui.edicao.id) && (this.ui.edicao = null), this.doc.selecao.join("\0") !== i && this.emitirSelecao()), this.agendar(), s;
400
+ aplicar(e, a, r) {
401
+ const i = this.doc.selecao.join("\0"), o = this.doc.elementos.map((l) => l.id).join("\0"), s = this.doc.substituir(e, { chave: r });
402
+ return this.doc.elementos.map((l) => l.id).join("\0") !== o && s.adicionados.length === 0 && s.removidos.length === 0 && (this.emitir("prancha-ordem", { ids: this.doc.elementos.map((l) => l.id), motivo: a }), Aa(s) && this.emitirHistorico()), Aa(s) || (this.emitirDiferenca(s, a), this.emitirHistorico(), this.ui.edicao && !this.doc.obter(this.ui.edicao.id) && (this.ui.edicao = null), this.doc.selecao.join("\0") !== i && this.emitirSelecao()), this.agendar(), s;
403
403
  }
404
404
  /** Substitui elementos pelo id (os demais ficam como estão). */
405
- aplicarSubstituicoes(a, e, r) {
406
- const i = new Map(a.map((o) => [o.id, o]));
407
- return this.aplicar(this.doc.elementos.map((o) => i.get(o.id) ?? o), e, r);
405
+ aplicarSubstituicoes(e, a, r) {
406
+ const i = new Map(e.map((o) => [o.id, o]));
407
+ return this.aplicar(this.doc.elementos.map((o) => i.get(o.id) ?? o), a, r);
408
408
  }
409
409
  emitirSelecao() {
410
- const a = this.doc.elementosSelecionados();
411
- this.emitir("prancha-selecao", { ids: a.map((e) => e.id), elementos: a }), this.anunciar(gr(a.length));
410
+ const e = this.doc.elementosSelecionados();
411
+ this.emitir("prancha-selecao", { ids: e.map((a) => a.id), elementos: e }), this.anunciar(Tr(e.length));
412
412
  }
413
413
  /**
414
414
  * Muda a seleção. Fora do isolamento, um membro de grupo seleciona o grupo inteiro (`expandir`). Só entra o que pode ser
415
415
  * selecionado (camadas, máscara, isolamento).
416
416
  */
417
- selecionar(a, e = "substituir", r = !0) {
418
- const i = Array.isArray(a) ? a.filter((n) => typeof n == "string") : [], o = (r && this.isolado === null ? Ze(this.doc.elementos, i) : i).filter((n) => e === "remover" || this.podeSelecionar(this.doc.obter(n)));
419
- return this.doc.selecionar(o, e) ? (this.ui.pivo = null, this.ui.edicao && !this.doc.selecao.includes(this.ui.edicao.id) && this.encerrarEdicao(), this.emitirSelecao(), this.agendar(), !0) : !1;
417
+ selecionar(e, a = "substituir", r = !0) {
418
+ const i = Array.isArray(e) ? e.filter((n) => typeof n == "string") : [], o = (r && this.isolado === null ? st(this.doc.elementos, i) : i).filter((n) => a === "remover" || this.podeSelecionar(this.doc.obter(n)));
419
+ return this.doc.selecionar(o, a) ? (this.ui.pivo = null, this.ui.edicao && !this.doc.selecao.includes(this.ui.edicao.id) && this.encerrarEdicao(), this.emitirSelecao(), this.agendar(), !0) : !1;
420
420
  }
421
- definirFerramenta(a) {
422
- a !== this.ferramenta && (j(this.ui), a !== "selecao-direta" && this.ui.edicao && this.encerrarEdicao(), this.ferramenta = a, this.emitir("prancha-ferramenta", { ferramenta: a }), this.anunciar(vr(a)), this.agendar());
421
+ definirFerramenta(e) {
422
+ e !== this.ferramenta && (V(this.ui), e !== "selecao-direta" && this.ui.edicao && this.encerrarEdicao(), this.ferramenta = e, this.emitir("prancha-ferramenta", { ferramenta: e }), this.anunciar(wr(e)), this.agendar());
423
423
  }
424
- iniciarEdicao(a) {
424
+ iniciarEdicao(e) {
425
425
  var r;
426
- const e = this.doc.obter(a);
427
- return e ? e.bloqueado ? (this.recusar("editar-ancoras", "bloqueado", a), !1) : e.geometria.tipo === "texto" ? (this.recusar("editar-ancoras", "texto-sem-ancoras", a), !1) : (((r = this.ui.edicao) == null ? void 0 : r.id) === a || (this.ui.edicao && this.encerrarEdicao(), this.ui.edicao = { id: a, ancoras: [] }, this.doc.selecionar([a]), this.emitirSelecao(), this.emitir("prancha-edicao-iniciada", { elemento: e }), this.agendar()), !0) : !1;
426
+ const a = this.doc.obter(e);
427
+ return a ? a.bloqueado ? (this.recusar("editar-ancoras", "bloqueado", e), !1) : a.geometria.tipo === "texto" ? (this.recusar("editar-ancoras", "texto-sem-ancoras", e), !1) : (((r = this.ui.edicao) == null ? void 0 : r.id) === e || (this.ui.edicao && this.encerrarEdicao(), this.ui.edicao = { id: e, ancoras: [] }, this.doc.selecionar([e]), this.emitirSelecao(), this.emitir("prancha-edicao-iniciada", { elemento: a }), this.agendar()), !0) : !1;
428
428
  }
429
429
  encerrarEdicao() {
430
- const a = this.ui.edicao;
431
- if (!a) return;
430
+ const e = this.ui.edicao;
431
+ if (!e) return;
432
432
  this.ui.edicao = null;
433
- const e = this.doc.obter(a.id);
434
- e && this.emitir("prancha-edicao-concluida", { elemento: e }), this.agendar();
433
+ const a = this.doc.obter(e.id);
434
+ a && this.emitir("prancha-edicao-concluida", { elemento: a }), this.agendar();
435
435
  }
436
436
  desfazer() {
437
- const a = this.doc.desfazer();
438
- return a ? (this.posHistorico(a, "desfazer"), !0) : (this.recusar("desfazer", "nada-a-desfazer"), !1);
437
+ const e = this.doc.desfazer();
438
+ return e ? (this.posHistorico(e, "desfazer"), !0) : (this.recusar("desfazer", "nada-a-desfazer"), !1);
439
439
  }
440
440
  refazer() {
441
- const a = this.doc.refazer();
442
- return a ? (this.posHistorico(a, "refazer"), !0) : (this.recusar("refazer", "nada-a-refazer"), !1);
441
+ const e = this.doc.refazer();
442
+ return e ? (this.posHistorico(e, "refazer"), !0) : (this.recusar("refazer", "nada-a-refazer"), !1);
443
443
  }
444
- posHistorico(a, e) {
445
- j(this.ui), this.ui.edicao && !this.doc.obter(this.ui.edicao.id) && (this.ui.edicao = null), this.emitirDiferenca(a, e), this.emitirHistorico(), this.anunciar(e === "desfazer" ? "Desfeito" : "Refeito"), this.agendar();
444
+ posHistorico(e, a) {
445
+ V(this.ui), this.ui.edicao && !this.doc.obter(this.ui.edicao.id) && (this.ui.edicao = null), this.emitirDiferenca(e, a), this.emitirHistorico(), this.anunciar(a === "desfazer" ? "Desfeito" : "Refeito"), this.agendar();
446
446
  }
447
447
  /** Tolerância de snap em px (toque precisa de mais). */
448
- toleranciaPx(a = !1) {
449
- return a ? 16 : 8;
448
+ toleranciaPx(e = !1) {
449
+ return e ? 16 : 8;
450
450
  }
451
451
  /**
452
452
  * Snap do ponto (mm) aos elementos perto (pelo índice), às guias e (opcional) à grade. Grava o resultado no estado
453
453
  * (para a sobreposição marcar). Snap desligado ou Alt: devolve o próprio ponto.
454
454
  */
455
- snapPonto(a, e = {}) {
456
- if (!this.snapLigado || e.desligado)
457
- return this.ui.snap = null, { ponto: a, resultado: null };
458
- const r = this.toleranciaPx(e.toque), i = r / this.vista.zoom + 1, o = this.candidatosEm(a, i).filter((n) => !n.mascara), s = te(a, o, this.vista.zoom, {
455
+ snapPonto(e, a = {}) {
456
+ if (!this.snapLigado || a.desligado)
457
+ return this.ui.snap = null, { ponto: e, resultado: null };
458
+ const r = this.toleranciaPx(a.toque), i = r / this.vista.zoom + 1, o = this.candidatosEm(e, i).filter((n) => !n.mascara), s = se(e, o, this.vista.zoom, {
459
459
  toleranciaPx: r,
460
460
  guias: this.guias,
461
- grade: e.grade !== !1 && this.mostrarGrade ? { espacamento: this.grade } : null
462
- }, e.excluir ?? []);
463
- return this.ui.snap = s, { ponto: s ? s.coordenada : a, resultado: s };
461
+ grade: a.grade !== !1 && this.mostrarGrade ? { espacamento: this.grade } : null
462
+ }, a.excluir ?? []);
463
+ return this.ui.snap = s, { ponto: s ? s.coordenada : e, resultado: s };
464
464
  }
465
465
  /** Emite a vista (zoom/pan) e repinta. */
466
466
  emitirVista() {
467
- const a = this.vista;
468
- this.emitir("prancha-vista", { zoom: a.zoom, zoomPercentual: a.zoomPercentual, pan: [a.pan[0], a.pan[1]] }), this.agendar();
467
+ const e = this.vista;
468
+ this.emitir("prancha-vista", { zoom: e.zoom, zoomPercentual: e.zoomPercentual, pan: [e.pan[0], e.pan[1]] }), this.agendar();
469
469
  }
470
470
  emitirGuias() {
471
- this.emitir("prancha-guias", { guias: this.guias.map((a) => ({ ...a })) }), this.agendar();
471
+ this.emitir("prancha-guias", { guias: this.guias.map((e) => ({ ...e })) }), this.agendar();
472
472
  }
473
473
  /** Aparência dos elementos novos (cópia; padrão traço preto 0,25 mm sem preenchimento). */
474
474
  aparenciaNova() {
475
- const a = this.opcoesFerramentas.aparencia;
476
- return a ? JSON.parse(JSON.stringify(a)) : { traco: { cor: Je, espessura: We }, preenchimento: null };
475
+ const e = this.opcoesFerramentas.aparencia;
476
+ return e ? JSON.parse(JSON.stringify(e)) : { traco: { cor: lt, espessura: nt }, preenchimento: null };
477
477
  }
478
478
  }
479
- const Z = (t) => typeof t == "number" && Number.isFinite(t);
480
- function ua(t, a) {
479
+ const Q = (t) => typeof t == "number" && Number.isFinite(t);
480
+ function ha(t, e) {
481
481
  if (t.somenteLeitura)
482
- return t.recusar(a, "somente-leitura"), null;
483
- const e = t.doc.elementosSelecionados().filter((r) => !r.bloqueado);
484
- return e.length === 0 ? (t.recusar(a, "sem-selecao"), null) : e;
485
- }
486
- function J(t, a, e = "comando", r) {
487
- if (!re(a)) return !1;
488
- const i = ua(t, "transformar");
489
- return i ? (t.aplicarSubstituicoes(T(i, a), e, r), !0) : !1;
490
- }
491
- const ve = (t, a, e, r = "comando", i) => Z(a) && Z(e) && J(t, k(a, e), r, i);
492
- function da(t) {
493
- return t.ui.pivo ?? et(t.doc.elementosSelecionados());
494
- }
495
- function be(t, a, e, r = "comando") {
496
- const i = e ?? da(t);
497
- return Z(a) && !!i && J(t, Pa(a * Math.PI / 180, i), r);
498
- }
499
- function ba(t, a, e = a, r, i = "comando") {
500
- const o = r ?? da(t);
501
- return !Z(a) || !Z(e) || a === 0 || e === 0 || !o ? !1 : J(t, q(a, e, o), i);
502
- }
503
- function Ar(t, a, e = "comando") {
504
- if (a !== "horizontal" && a !== "vertical") return !1;
505
- const r = ua(t, "espelhar");
506
- return r ? (t.aplicarSubstituicoes(Qe(r, a, da(t) ?? void 0), e), !0) : !1;
507
- }
508
- function ye(t, a = "remover") {
509
- const e = ua(t, "remover");
510
- if (!e) return !1;
511
- const r = new Set(e.map((i) => i.id));
512
- return t.aplicar(t.doc.elementos.filter((i) => !r.has(i.id)), a), !0;
482
+ return t.recusar(e, "somente-leitura"), null;
483
+ const a = t.doc.elementosSelecionados().filter((r) => !r.bloqueado);
484
+ return a.length === 0 ? (t.recusar(e, "sem-selecao"), null) : a;
485
+ }
486
+ function aa(t, e, a = "comando", r) {
487
+ if (!ne(e)) return !1;
488
+ const i = ha(t, "transformar");
489
+ return i ? (t.aplicarSubstituicoes(I(i, e), a, r), !0) : !1;
490
+ }
491
+ const Pe = (t, e, a, r = "comando", i) => Q(e) && Q(a) && aa(t, k(e, a), r, i);
492
+ function ma(t) {
493
+ return t.ui.pivo ?? ht(t.doc.elementosSelecionados());
494
+ }
495
+ function Me(t, e, a, r = "comando") {
496
+ const i = a ?? ma(t);
497
+ return Q(e) && !!i && aa(t, za(e * Math.PI / 180, i), r);
498
+ }
499
+ function Pa(t, e, a = e, r, i = "comando") {
500
+ const o = r ?? ma(t);
501
+ return !Q(e) || !Q(a) || e === 0 || a === 0 || !o ? !1 : aa(t, H(e, a, o), i);
502
+ }
503
+ function Fr(t, e, a = "comando") {
504
+ if (e !== "horizontal" && e !== "vertical") return !1;
505
+ const r = ha(t, "espelhar");
506
+ return r ? (t.aplicarSubstituicoes(ct(r, e, ma(t) ?? void 0), a), !0) : !1;
507
+ }
508
+ function ze(t, e = "remover") {
509
+ const a = ha(t, "remover");
510
+ if (!a) return !1;
511
+ const r = new Set(a.map((i) => i.id));
512
+ return t.aplicar(t.doc.elementos.filter((i) => !r.has(i.id)), e), !0;
513
513
  }
514
- function Ae(t) {
515
- return t.selecionar(t.doc.elementos.filter((a) => !a.bloqueado && !a.oculto).map((a) => a.id));
514
+ function xe(t) {
515
+ return t.selecionar(t.doc.elementos.filter((e) => !e.bloqueado && !e.oculto).map((e) => e.id));
516
516
  }
517
- function Pr(t, a) {
518
- const e = t.doc.elementos.filter((s) => !s.bloqueado && !s.oculto);
519
- if (e.length === 0) return !1;
520
- const r = t.doc.selecao[t.doc.selecao.length - 1], i = e.findIndex((s) => s.id === r), o = e[i < 0 ? a > 0 ? 0 : e.length - 1 : (i + a + e.length) % e.length];
517
+ function _r(t, e) {
518
+ const a = t.doc.elementos.filter((s) => !s.bloqueado && !s.oculto);
519
+ if (a.length === 0) return !1;
520
+ const r = t.doc.selecao[t.doc.selecao.length - 1], i = a.findIndex((s) => s.id === r), o = a[i < 0 ? e > 0 ? 0 : a.length - 1 : (i + e + a.length) % a.length];
521
521
  return t.selecionar([o.id]);
522
522
  }
523
- function w(t, a, e) {
523
+ function F(t, e, a) {
524
524
  var i;
525
525
  if (t.somenteLeitura)
526
526
  return t.recusar("criar", "somente-leitura"), [];
527
527
  const r = [];
528
- for (const o of a) {
529
- const s = ((i = o == null ? void 0 : o.geometria) == null ? void 0 : i.tipo) ?? "elemento", n = o != null && o.id && !t.doc.obter(o.id) && !r.some((d) => d.id === o.id) ? o.id : t.gerarId(s), l = !(o != null && o.camadaId) && t.camadaAtiva ? { camadaId: t.camadaAtiva } : {}, c = at({ ...o, id: n, ...l });
528
+ for (const o of e) {
529
+ const s = ((i = o == null ? void 0 : o.geometria) == null ? void 0 : i.tipo) ?? "elemento", n = o != null && o.id && !t.doc.obter(o.id) && !r.some((d) => d.id === o.id) ? o.id : t.gerarId(s), l = !(o != null && o.camadaId) && t.camadaAtiva ? { camadaId: t.camadaAtiva } : {}, c = dt({ ...o, id: n, ...l });
530
530
  c ? r.push(c) : t.recusar("criar", "geometria-invalida");
531
531
  }
532
- return r.length === 0 ? [] : (t.aplicar([...t.doc.elementos, ...r], e), t.selecionar(r.map((o) => o.id)), t.anunciar(r.length === 1 ? "Elemento criado" : `${r.length} elementos criados`), r);
532
+ return r.length === 0 ? [] : (t.aplicar([...t.doc.elementos, ...r], a), t.selecionar(r.map((o) => o.id)), t.anunciar(r.length === 1 ? "Elemento criado" : `${r.length} elementos criados`), r);
533
533
  }
534
- function Sr(t, a, e, r) {
534
+ function Nr(t, e, a, r) {
535
535
  const i = t.ui.edicao, o = i ? t.doc.obter(i.id) : void 0;
536
536
  if (!i || !o || i.ancoras.length === 0) return !1;
537
- const s = ie(o, i.ancoras, a, e);
537
+ const s = le(o, i.ancoras, e, a);
538
538
  return s ? (t.aplicarSubstituicoes([s], "editar-ancoras", r), !0) : (t.recusar("editar-ancoras", "matriz-singular", o.id), !1);
539
539
  }
540
- function Mr(t) {
541
- const a = t.ui.edicao;
542
- let e = a ? t.doc.obter(a.id) : void 0;
543
- if (!a || !e || a.ancoras.length === 0) return !1;
540
+ function Or(t) {
541
+ const e = t.ui.edicao;
542
+ let a = e ? t.doc.obter(e.id) : void 0;
543
+ if (!e || !a || e.ancoras.length === 0) return !1;
544
544
  let r = !1;
545
- for (const i of [...a.ancoras].sort((o, s) => s - o)) {
546
- const o = oe(e, i);
545
+ for (const i of [...e.ancoras].sort((o, s) => s - o)) {
546
+ const o = ce(a, i);
547
547
  if (!o) {
548
- t.recusar("excluir-ancora", "minimo-de-ancoras", e.id);
548
+ t.recusar("excluir-ancora", "minimo-de-ancoras", a.id);
549
549
  break;
550
550
  }
551
- e = o, r = !0;
551
+ a = o, r = !0;
552
552
  }
553
- return r ? (a.ancoras = [], t.aplicarSubstituicoes([e], "editar-ancoras"), !0) : !1;
553
+ return r ? (e.ancoras = [], t.aplicarSubstituicoes([a], "editar-ancoras"), !0) : !1;
554
554
  }
555
- function Pe(t, a) {
556
- const e = ua(t, "definir-raios");
557
- if (!e) return !1;
558
- const r = e.map((i) => Ye(i, a)).filter((i) => !!i);
555
+ function Ee(t, e) {
556
+ const a = ha(t, "definir-raios");
557
+ if (!a) return !1;
558
+ const r = a.map((i) => ut(i, e)).filter((i) => !!i);
559
559
  return r.length === 0 ? (t.recusar("definir-raios", "tipo-nao-suportado"), !1) : (t.aplicarSubstituicoes(r, "cantos"), !0);
560
560
  }
561
- const ra = ["retangulo", "elipse", "poligono-regular", "estrela", "linha", "seta"], Se = { polilinha: "linha", poligono: "poligono", caneta: "caneta" }, zr = "__previa__", Er = 3, xr = 8, Cr = 400, Tr = 4, na = (t) => ra.includes(t) || t in Se || t === "texto";
562
- function Ra(t, a, e, r) {
563
- let i = a[0] - t[0], o = a[1] - t[1];
564
- if (e) {
561
+ const oa = ["retangulo", "elipse", "poligono-regular", "estrela", "linha", "seta"], Ce = { polilinha: "linha", poligono: "poligono", caneta: "caneta" }, Rr = "__previa__", Lr = 3, kr = 8, qr = 400, Br = 4, ca = (t) => oa.includes(t) || t in Ce || t === "texto";
562
+ function qa(t, e, a, r) {
563
+ let i = e[0] - t[0], o = e[1] - t[1];
564
+ if (a) {
565
565
  const s = Math.max(Math.abs(i), Math.abs(o));
566
566
  i = (i < 0 ? -1 : 1) * s, o = (o < 0 ? -1 : 1) * s;
567
567
  }
568
- return r ? { x: t[0] - Math.abs(i), y: t[1] - Math.abs(o), largura: 2 * Math.abs(i), altura: 2 * Math.abs(o) } : ut(t, [t[0] + i, t[1] + o]);
568
+ return r ? { x: t[0] - Math.abs(i), y: t[1] - Math.abs(o), largura: 2 * Math.abs(i), altura: 2 * Math.abs(o) } : St(t, [t[0] + i, t[1] + o]);
569
569
  }
570
- function wr(t, a) {
571
- const e = a[0] - t[0], r = a[1] - t[1], i = Math.hypot(e, r), o = Math.round(Math.atan2(r, e) / (Math.PI / 4)) * (Math.PI / 4);
570
+ function jr(t, e) {
571
+ const a = e[0] - t[0], r = e[1] - t[1], i = Math.hypot(a, r), o = Math.round(Math.atan2(r, a) / (Math.PI / 4)) * (Math.PI / 4);
572
572
  return [t[0] + i * Math.cos(o), t[1] + i * Math.sin(o)];
573
573
  }
574
- class Ir {
575
- constructor(a) {
574
+ class Gr {
575
+ constructor(e) {
576
576
  m(this, "arrasto", null);
577
577
  m(this, "sessao", null);
578
578
  m(this, "puxandoAlca", !1);
579
579
  m(this, "ultimoClique", null);
580
- this.c = a;
580
+ this.c = e;
581
581
  }
582
582
  get emAndamento() {
583
583
  return !!this.arrasto || !!this.sessao && this.sessao.nos > 0;
584
584
  }
585
- base(a = {}) {
586
- return { id: zr, aparencia: this.c.aparenciaNova(), ...a };
585
+ base(e = {}) {
586
+ return { id: Rr, aparencia: this.c.aparenciaNova(), ...e };
587
587
  }
588
588
  /** Elemento da forma de arrasto entre `inicio` e `atual` (null se degenerado). */
589
- construir(a, e, r, i) {
589
+ construir(e, a, r, i) {
590
590
  const o = this.c.opcoesFerramentas;
591
- if (a === "retangulo" || a === "elipse") {
592
- const s = Ra(e, r, i.shift, i.alt);
593
- return a === "retangulo" ? tt(this.base(), s, o.raioCantos) : rt(this.base(), s);
591
+ if (e === "retangulo" || e === "elipse") {
592
+ const s = qa(a, r, i.shift, i.alt);
593
+ return e === "retangulo" ? mt(this.base(), s, o.raioCantos) : ft(this.base(), s);
594
594
  }
595
- if (a === "poligono-regular" || a === "estrela") {
596
- const s = Math.hypot(r[0] - e[0], r[1] - e[1]), n = a === "poligono-regular" ? it(this.base(), e, s, o.lados ?? 6) : ot(this.base(), e, s, s * (o.proporcaoInterna ?? 0.45), o.pontas ?? 5);
595
+ if (e === "poligono-regular" || e === "estrela") {
596
+ const s = Math.hypot(r[0] - a[0], r[1] - a[1]), n = e === "poligono-regular" ? pt(this.base(), a, s, o.lados ?? 6) : gt(this.base(), a, s, s * (o.proporcaoInterna ?? 0.45), o.pontas ?? 5);
597
597
  if (!n || i.shift) return n;
598
- const l = Math.atan2(r[1] - e[1], r[0] - e[0]) + Math.PI / 2;
599
- return se(n, Pa(l, e));
598
+ const l = Math.atan2(r[1] - a[1], r[0] - a[0]) + Math.PI / 2;
599
+ return ue(n, za(l, a));
600
600
  }
601
- if (a === "linha" || a === "seta") {
602
- const s = i.shift ? wr(e, r) : r, n = this.c.aparenciaNova();
603
- return a === "seta" && (n.traco = { ...n.traco ?? {}, pontaFim: o.ponta ?? { estilo: "triangulo" } }), st(this.base({ aparencia: n }), e, s);
601
+ if (e === "linha" || e === "seta") {
602
+ const s = i.shift ? jr(a, r) : r, n = this.c.aparenciaNova();
603
+ return e === "seta" && (n.traco = { ...n.traco ?? {}, pontaFim: o.ponta ?? { estilo: "triangulo" } }), vt(this.base({ aparencia: n }), a, s);
604
604
  }
605
605
  return null;
606
606
  }
607
- pressionar(a, e, r) {
608
- const i = this.c.ferramenta, { ponto: o } = this.c.snapPonto(a, { toque: r.toque, desligado: r.alt && !ra.includes(i) });
609
- if (ra.includes(i)) {
610
- this.arrasto = { inicio: o, atual: o, inicioPx: e };
607
+ pressionar(e, a, r) {
608
+ const i = this.c.ferramenta, { ponto: o } = this.c.snapPonto(e, { toque: r.toque, desligado: r.alt && !oa.includes(i) });
609
+ if (oa.includes(i)) {
610
+ this.arrasto = { inicio: o, atual: o, inicioPx: a };
611
611
  return;
612
612
  }
613
613
  if (i === "texto") {
614
614
  this.solicitarTexto(o);
615
615
  return;
616
616
  }
617
- const s = Se[i];
617
+ const s = Ce[i];
618
618
  if (!s) return;
619
- this.sessao || (this.sessao = new lr(s, !1, { espaco: nt }));
620
- const n = this.sessao, l = Date.now(), c = !!this.ultimoClique && l - this.ultimoClique.t <= Cr && Math.hypot(e[0] - this.ultimoClique.x, e[1] - this.ultimoClique.y) <= Tr;
621
- this.ultimoClique = { t: l, x: e[0], y: e[1] };
619
+ this.sessao || (this.sessao = new Ar(s, !1, { espaco: bt }));
620
+ const n = this.sessao, l = Date.now(), c = !!this.ultimoClique && l - this.ultimoClique.t <= qr && Math.hypot(a[0] - this.ultimoClique.x, a[1] - this.ultimoClique.y) <= Br;
621
+ this.ultimoClique = { t: l, x: a[0], y: a[1] };
622
622
  const d = n.primeiro;
623
623
  if (d && n.fechaNoPrimeiro) {
624
624
  const h = this.c.vista.paraTela(d);
625
- if (Math.hypot(h[0] - e[0], h[1] - e[1]) <= xr) {
625
+ if (Math.hypot(h[0] - a[0], h[1] - a[1]) <= kr) {
626
626
  this.finalizar(n.concluirFechando());
627
627
  return;
628
628
  }
@@ -633,270 +633,270 @@ class Ir {
633
633
  }
634
634
  n.clicar(o), s === "caneta" && (this.puxandoAlca = !0), this.atualizarPrevia();
635
635
  }
636
- mover(a, e, r) {
636
+ mover(e, a, r) {
637
637
  const i = this.c.ferramenta;
638
638
  if (this.arrasto) {
639
- const { ponto: o } = this.c.snapPonto(a, { toque: r.toque });
639
+ const { ponto: o } = this.c.snapPonto(e, { toque: r.toque });
640
640
  this.arrasto.atual = o, this.c.ui.previa = this.construir(i, this.arrasto.inicio, o, r);
641
- const s = Ra(this.arrasto.inicio, o, r.shift, r.alt), n = (l) => Math.round(l * 10) / 10;
641
+ const s = qa(this.arrasto.inicio, o, r.shift, r.alt), n = (l) => Math.round(l * 10) / 10;
642
642
  this.c.ui.rotulo = { texto: `${n(s.largura)} × ${n(s.altura)} mm`, em: o }, this.c.agendar();
643
643
  return;
644
644
  }
645
645
  if (this.sessao) {
646
- const { ponto: o } = this.c.snapPonto(a, { toque: r.toque, desligado: r.alt });
646
+ const { ponto: o } = this.c.snapPonto(e, { toque: r.toque, desligado: r.alt });
647
647
  this.puxandoAlca ? this.sessao.definirAlca(o) : this.sessao.mover(o), this.atualizarPrevia();
648
- } else na(i) && (this.c.snapPonto(a, { toque: r.toque, desligado: r.alt }), this.c.agendar());
648
+ } else ca(i) && (this.c.snapPonto(e, { toque: r.toque, desligado: r.alt }), this.c.agendar());
649
649
  }
650
- soltar(a, e, r) {
650
+ soltar(e, a, r) {
651
651
  this.puxandoAlca = !1;
652
652
  const i = this.arrasto;
653
653
  if (!i) return;
654
654
  this.arrasto = null;
655
655
  const o = this.c.ui.previa;
656
- if (j(this.c.ui), !o || Math.hypot(e[0] - i.inicioPx[0], e[1] - i.inicioPx[1]) < Er) {
656
+ if (V(this.c.ui), !o || Math.hypot(a[0] - i.inicioPx[0], a[1] - i.inicioPx[1]) < Lr) {
657
657
  this.c.recusar("desenhar", "forma-pequena"), this.c.agendar();
658
658
  return;
659
659
  }
660
- w(this.c, [{ ...o, id: "" }], "ferramenta");
660
+ F(this.c, [{ ...o, id: "" }], "ferramenta");
661
661
  }
662
662
  atualizarPrevia() {
663
- const a = this.sessao;
664
- if (!a) return;
665
- const e = a.previa();
666
- this.c.ui.previa = e && (e.tipo === "LineString" || e.tipo === "Polygon") ? Ia(this.base(), e) : null, this.c.ui.pontosPrevia = a.ferramenta === "caneta" ? a.ancoras.map((r) => r.ponto) : [...a.pontos], this.c.agendar();
667
- }
668
- finalizar(a) {
669
- if (this.sessao = null, this.ultimoClique = null, j(this.c.ui), a && (a.tipo === "LineString" || a.tipo === "Polygon")) {
670
- const e = Ia({ id: "", aparencia: this.c.aparenciaNova() }, a);
671
- e && w(this.c, [e], "ferramenta");
663
+ const e = this.sessao;
664
+ if (!e) return;
665
+ const a = e.previa();
666
+ this.c.ui.previa = a && (a.tipo === "LineString" || a.tipo === "Polygon") ? _a(this.base(), a) : null, this.c.ui.pontosPrevia = e.ferramenta === "caneta" ? e.ancoras.map((r) => r.ponto) : [...e.pontos], this.c.agendar();
667
+ }
668
+ finalizar(e) {
669
+ if (this.sessao = null, this.ultimoClique = null, V(this.c.ui), e && (e.tipo === "LineString" || e.tipo === "Polygon")) {
670
+ const a = _a({ id: "", aparencia: this.c.aparenciaNova() }, e);
671
+ a && F(this.c, [a], "ferramenta");
672
672
  } else
673
673
  this.c.recusar("desenhar", "geometria-invalida");
674
674
  this.c.agendar();
675
675
  }
676
676
  concluir() {
677
- const a = this.sessao;
678
- return !a || !a.podeConcluir ? !1 : (this.finalizar(a.concluir()), !0);
677
+ const e = this.sessao;
678
+ return !e || !e.podeConcluir ? !1 : (this.finalizar(e.concluir()), !0);
679
679
  }
680
680
  cancelar() {
681
- this.arrasto = null, this.sessao = null, this.puxandoAlca = !1, this.ultimoClique = null, j(this.c.ui), this.c.agendar();
681
+ this.arrasto = null, this.sessao = null, this.puxandoAlca = !1, this.ultimoClique = null, V(this.c.ui), this.c.agendar();
682
682
  }
683
683
  /** Enter, Esc e Backspace durante o desenho; devolve se tratou. */
684
- tecla(a) {
685
- return a === "Enter" && this.sessao ? this.concluir() || !0 : a === "Escape" && this.emAndamento ? (this.cancelar(), !0) : a === "Backspace" && this.sessao && this.sessao.nos > 0 ? (this.sessao.desfazer(), this.sessao.nos === 0 ? this.cancelar() : this.atualizarPrevia(), !0) : !1;
684
+ tecla(e) {
685
+ return e === "Enter" && this.sessao ? this.concluir() || !0 : e === "Escape" && this.emAndamento ? (this.cancelar(), !0) : e === "Backspace" && this.sessao && this.sessao.nos > 0 ? (this.sessao.desfazer(), this.sessao.nos === 0 ? this.cancelar() : this.atualizarPrevia(), !0) : !1;
686
686
  }
687
687
  /** Teclado: Enter com a ferramenta ativa e nada em andamento cria a forma padrão (40 × 30 mm) no centro da vista. */
688
688
  criarNoCentro() {
689
- const a = this.c.ferramenta, e = this.c.vista, r = e.largura > 0 ? e.paraFolha(e.largura / 2, e.altura / 2) : [this.c.folha.largura / 2, this.c.folha.altura / 2];
690
- if (a === "texto")
689
+ const e = this.c.ferramenta, a = this.c.vista, r = a.largura > 0 ? a.paraFolha(a.largura / 2, a.altura / 2) : [this.c.folha.largura / 2, this.c.folha.altura / 2];
690
+ if (e === "texto")
691
691
  return this.solicitarTexto(r), !0;
692
- if (!ra.includes(a)) return !1;
693
- const i = this.construir(a, [r[0] - 20, r[1] - 15], [r[0] + 20, r[1] + 15], { shift: !1, alt: !1 });
694
- return !!i && w(this.c, [{ ...i, id: "" }], "ferramenta").length > 0;
692
+ if (!oa.includes(e)) return !1;
693
+ const i = this.construir(e, [r[0] - 20, r[1] - 15], [r[0] + 20, r[1] + 15], { shift: !1, alt: !1 });
694
+ return !!i && F(this.c, [{ ...i, id: "" }], "ferramenta").length > 0;
695
695
  }
696
- solicitarTexto(a) {
697
- const e = this.c.opcoesFerramentas, r = e.tamanhoTexto && e.tamanhoTexto > 0 ? e.tamanhoTexto : lt(12, "pt"), i = (n) => {
696
+ solicitarTexto(e) {
697
+ const a = this.c.opcoesFerramentas, r = a.tamanhoTexto && a.tamanhoTexto > 0 ? a.tamanhoTexto : yt(12, "pt"), i = (n) => {
698
698
  var c;
699
- const l = ct({ id: "", aparencia: { preenchimento: { cor: ((c = this.c.aparenciaNova().traco) == null ? void 0 : c.cor) ?? void 0 } } }, a, n, r);
700
- return l ? w(this.c, [l], "texto")[0] ?? null : null;
701
- }, o = { posicao: a, concluir: (n) => i(typeof n == "string" ? n : String(n ?? "")) };
702
- this.c.emitir("prancha-texto-solicitado", o, !0) || i(e.textoPadrao ?? "Texto");
699
+ const l = At({ id: "", aparencia: { preenchimento: { cor: ((c = this.c.aparenciaNova().traco) == null ? void 0 : c.cor) ?? void 0 } } }, e, n, r);
700
+ return l ? F(this.c, [l], "texto")[0] ?? null : null;
701
+ }, o = { posicao: e, concluir: (n) => i(typeof n == "string" ? n : String(n ?? "")) };
702
+ this.c.emitir("prancha-texto-solicitado", o, !0) || i(a.textoPadrao ?? "Texto");
703
703
  }
704
704
  }
705
- const U = 5, _ = { elementos: [], colagens: 0 }, ya = (t) => typeof t == "number" && Number.isFinite(t);
706
- function y(t, a, e = 1) {
705
+ const Z = 5, R = { elementos: [], colagens: 0 }, Ma = (t) => typeof t == "number" && Number.isFinite(t);
706
+ function y(t, e, a = 1) {
707
707
  if (t.somenteLeitura)
708
- return t.recusar(a, "somente-leitura"), null;
708
+ return t.recusar(e, "somente-leitura"), null;
709
709
  const r = t.doc.elementosSelecionados().filter((i) => !t.mapa().travado(i));
710
- return r.length < e ? (t.recusar(a, "sem-selecao"), null) : r;
711
- }
712
- function Q(t, a, e) {
713
- return "ok" in e ? e.ok : (t.recusar(a, e.motivo === "texto" ? "texto-sem-ancoras" : e.motivo === "tipos-incompativeis" || e.motivo === "sem-forma-fechada" ? "tipo-nao-suportado" : "geometria-invalida"), null);
710
+ return r.length < a ? (t.recusar(e, "sem-selecao"), null) : r;
714
711
  }
715
- function D(t, a) {
716
- const e = y(t, "ordem");
717
- return !e || !["frente", "tras", "avancar", "recuar"].includes(a) ? !1 : (t.aplicar(dt(t.doc.elementos, e.map((r) => r.id), a, t.camadas), "ordem"), !0);
712
+ function ea(t, e, a) {
713
+ return "ok" in a ? a.ok : (t.recusar(e, a.motivo === "texto" ? "texto-sem-ancoras" : a.motivo === "tipos-incompativeis" || a.motivo === "sem-forma-fechada" ? "tipo-nao-suportado" : "geometria-invalida"), null);
718
714
  }
719
- function Me(t) {
720
- const a = y(t, "agrupar", 2);
721
- return a ? (t.aplicar(ht(t.doc.elementos, a.map((e) => e.id), t.gerarId("grupo"), t.camadas), "agrupar"), !0) : !1;
715
+ function O(t, e) {
716
+ const a = y(t, "ordem");
717
+ return !a || !["frente", "tras", "avancar", "recuar"].includes(e) ? !1 : (t.aplicar(Pt(t.doc.elementos, a.map((r) => r.id), e, t.camadas), "ordem"), !0);
722
718
  }
723
- function ze(t) {
724
- const a = y(t, "desagrupar");
725
- if (!a) return !1;
726
- const e = a.map((r) => r.id);
727
- return t.isolado && a.some((r) => r.grupoId === t.isolado) && t.isolar(null), t.aplicar(mt(t.doc.elementos, e), "desagrupar"), !0;
719
+ function Te(t) {
720
+ const e = y(t, "agrupar", 2);
721
+ return e ? (t.aplicar(Mt(t.doc.elementos, e.map((a) => a.id), t.gerarId("grupo"), t.camadas), "agrupar"), !0) : !1;
728
722
  }
729
- function la(t, a) {
730
- const e = y(t, a === "bloqueado" ? "bloquear" : "ocultar");
723
+ function we(t) {
724
+ const e = y(t, "desagrupar");
731
725
  if (!e) return !1;
732
- const r = new Set(e.map((i) => i.id));
733
- return t.selecionar([]), t.aplicar(t.doc.elementos.map((i) => r.has(i.id) ? { ...i, [a]: !0 } : i), a === "bloqueado" ? "bloquear" : "ocultar"), !0;
726
+ const a = e.map((r) => r.id);
727
+ return t.isolado && e.some((r) => r.grupoId === t.isolado) && t.isolar(null), t.aplicar(zt(t.doc.elementos, a), "desagrupar"), !0;
728
+ }
729
+ function ua(t, e) {
730
+ const a = y(t, e === "bloqueado" ? "bloquear" : "ocultar");
731
+ if (!a) return !1;
732
+ const r = new Set(a.map((i) => i.id));
733
+ return t.selecionar([]), t.aplicar(t.doc.elementos.map((i) => r.has(i.id) ? { ...i, [e]: !0 } : i), e === "bloqueado" ? "bloquear" : "ocultar"), !0;
734
734
  }
735
- function ca(t, a) {
735
+ function da(t, e) {
736
736
  if (t.somenteLeitura)
737
737
  return t.recusar("liberar", "somente-leitura"), !1;
738
- const e = [], r = t.doc.elementos.map((i) => {
739
- if (!i[a]) return i;
740
- e.push(i.id);
738
+ const a = [], r = t.doc.elementos.map((i) => {
739
+ if (!i[e]) return i;
740
+ a.push(i.id);
741
741
  const o = { ...i };
742
- return delete o[a], o;
742
+ return delete o[e], o;
743
743
  });
744
- return e.length === 0 ? !1 : (t.aplicar(r, a === "bloqueado" ? "bloquear" : "ocultar"), t.selecionar(e), !0);
744
+ return a.length === 0 ? !1 : (t.aplicar(r, e === "bloqueado" ? "bloquear" : "ocultar"), t.selecionar(a), !0);
745
745
  }
746
- function Dr(t, a, e = "selecao") {
746
+ function Hr(t, e, a = "selecao") {
747
747
  const r = y(t, "alinhar");
748
748
  if (!r) return !1;
749
749
  let i = { tipo: "selecao" };
750
- e === "folha" ? i = { tipo: "caixa", caixa: { x: 0, y: 0, largura: t.folha.largura, altura: t.folha.altura } } : e === "chave" ? i = { tipo: "chave", id: t.doc.selecao[0] } : e && typeof e == "object" && (i = { tipo: "caixa", caixa: e });
751
- const o = ft(r, a, i);
750
+ a === "folha" ? i = { tipo: "caixa", caixa: { x: 0, y: 0, largura: t.folha.largura, altura: t.folha.altura } } : a === "chave" ? i = { tipo: "chave", id: t.doc.selecao[0] } : a && typeof a == "object" && (i = { tipo: "caixa", caixa: a });
751
+ const o = xt(r, e, i);
752
752
  return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o, "alinhar"), !0);
753
753
  }
754
- function _r(t, a, e = "espacos", r) {
754
+ function $r(t, e, a = "espacos", r) {
755
755
  const i = y(t, "distribuir", 2);
756
756
  if (!i) return !1;
757
- const o = pt(i, a === "vertical" ? "vertical" : "horizontal", e === "centros" ? "centros" : "espacos", ya(r) ? r : void 0);
757
+ const o = Et(i, e === "vertical" ? "vertical" : "horizontal", a === "centros" ? "centros" : "espacos", Ma(r) ? r : void 0);
758
758
  return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o, "distribuir"), !0);
759
759
  }
760
- function xa(t, a, e, r) {
761
- const i = le($(a, t.camadas), t.gerarId, e);
762
- return w(t, i, r);
760
+ function wa(t, e, a, r) {
761
+ const i = he(U(e, t.camadas), t.gerarId, a);
762
+ return F(t, i, r);
763
763
  }
764
- function Fr(t, a = [U, U]) {
765
- const e = y(t, "duplicar");
766
- if (!e) return !1;
767
- const r = ya(a == null ? void 0 : a[0]) && ya(a == null ? void 0 : a[1]) ? a : [U, U], i = xa(t, e, r, "duplicar");
764
+ function Vr(t, e = [Z, Z]) {
765
+ const a = y(t, "duplicar");
766
+ if (!a) return !1;
767
+ const r = Ma(e == null ? void 0 : e[0]) && Ma(e == null ? void 0 : e[1]) ? e : [Z, Z], i = wa(t, a, r, "duplicar");
768
768
  return t.ultimaTransformacao = { matriz: k(r[0], r[1]), duplicar: !0 }, i.length > 0;
769
769
  }
770
- function Oa(t, a, e = !1) {
771
- re(a) && (t.ultimaTransformacao = { matriz: a, duplicar: e });
770
+ function Ba(t, e, a = !1) {
771
+ ne(e) && (t.ultimaTransformacao = { matriz: e, duplicar: a });
772
772
  }
773
- function Ee(t) {
774
- const a = t.ultimaTransformacao;
775
- if (!a)
773
+ function De(t) {
774
+ const e = t.ultimaTransformacao;
775
+ if (!e)
776
776
  return t.recusar("transformar-de-novo", "nada-a-refazer"), !1;
777
- const e = y(t, "transformar-de-novo");
778
- if (!e) return !1;
779
- if (a.duplicar) {
780
- const i = xa(t, e, [0, 0], "duplicar");
781
- return i.length === 0 ? !1 : (t.aplicarSubstituicoes(T(i, a.matriz), "transformar"), t.ultimaTransformacao = a, !0);
777
+ const a = y(t, "transformar-de-novo");
778
+ if (!a) return !1;
779
+ if (e.duplicar) {
780
+ const i = wa(t, a, [0, 0], "duplicar");
781
+ return i.length === 0 ? !1 : (t.aplicarSubstituicoes(I(i, e.matriz), "transformar"), t.ultimaTransformacao = e, !0);
782
782
  }
783
- const r = J(t, a.matriz, "transformar");
784
- return t.ultimaTransformacao = a, r;
783
+ const r = aa(t, e.matriz, "transformar");
784
+ return t.ultimaTransformacao = e, r;
785
785
  }
786
- function Ca(t) {
787
- var e, r, i, o;
788
- const a = t.doc.elementosSelecionados();
789
- if (a.length === 0)
786
+ function Da(t) {
787
+ var a, r, i, o;
788
+ const e = t.doc.elementosSelecionados();
789
+ if (e.length === 0)
790
790
  return t.recusar("copiar", "sem-selecao"), !1;
791
- _.elementos = JSON.parse(JSON.stringify($(a, t.camadas))), _.colagens = 0;
791
+ R.elementos = JSON.parse(JSON.stringify(U(e, t.camadas))), R.colagens = 0;
792
792
  try {
793
793
  const s = typeof navigator < "u" ? navigator : void 0;
794
- (o = (i = (r = (e = s == null ? void 0 : s.clipboard) == null ? void 0 : e.writeText) == null ? void 0 : r.call(e, JSON.stringify({ tipo: "ui-canvas-prancha", elementos: _.elementos }))) == null ? void 0 : i.catch) == null || o.call(i, () => {
794
+ (o = (i = (r = (a = s == null ? void 0 : s.clipboard) == null ? void 0 : a.writeText) == null ? void 0 : r.call(a, JSON.stringify({ tipo: "ui-canvas-prancha", elementos: R.elementos }))) == null ? void 0 : i.catch) == null || o.call(i, () => {
795
795
  });
796
796
  } catch {
797
797
  }
798
- return t.anunciar(a.length === 1 ? "Elemento copiado" : `${a.length} elementos copiados`), !0;
798
+ return t.anunciar(e.length === 1 ? "Elemento copiado" : `${e.length} elementos copiados`), !0;
799
799
  }
800
- function xe(t) {
801
- const a = y(t, "recortar");
802
- if (!a || !Ca(t)) return !1;
803
- const e = new Set(a.map((r) => r.id));
804
- return t.aplicar(t.doc.elementos.filter((r) => !e.has(r.id)), "recortar"), !0;
800
+ function Ie(t) {
801
+ const e = y(t, "recortar");
802
+ if (!e || !Da(t)) return !1;
803
+ const a = new Set(e.map((r) => r.id));
804
+ return t.aplicar(t.doc.elementos.filter((r) => !a.has(r.id)), "recortar"), !0;
805
805
  }
806
- function Ce(t, a = !1) {
807
- if (_.elementos.length === 0)
806
+ function Fe(t, e = !1) {
807
+ if (R.elementos.length === 0)
808
808
  return t.recusar("colar", "sem-selecao"), !1;
809
809
  if (t.somenteLeitura)
810
810
  return t.recusar("colar", "somente-leitura"), !1;
811
- _.colagens++;
812
- const e = a ? 0 : U * _.colagens;
813
- return xa(t, _.elementos, [e, e], "colar").length > 0;
814
- }
815
- function kr(t, a) {
816
- const e = a.aparencia ? JSON.parse(JSON.stringify(a.aparencia)) : void 0;
817
- t.emitir("prancha-conta-gotas", { elemento: a, aparencia: e });
818
- const r = t.doc.elementosSelecionados().filter((i) => i.id !== a.id && !t.mapa().travado(i));
819
- return r.length === 0 ? (t.opcoesFerramentas = { ...t.opcoesFerramentas, aparencia: e }, t.anunciar("Aparência guardada para as formas novas"), !0) : t.somenteLeitura ? (t.recusar("conta-gotas", "somente-leitura"), !1) : (t.aplicarSubstituicoes(ne(r, e), "conta-gotas"), !0);
811
+ R.colagens++;
812
+ const a = e ? 0 : Z * R.colagens;
813
+ return wa(t, R.elementos, [a, a], "colar").length > 0;
820
814
  }
821
- function Lr(t, a) {
822
- const e = y(t, "aparencia");
823
- return e ? (t.aplicarSubstituicoes(ne(e, a ?? void 0), "aparencia"), !0) : !1;
815
+ function Kr(t, e) {
816
+ const a = e.aparencia ? JSON.parse(JSON.stringify(e.aparencia)) : void 0;
817
+ t.emitir("prancha-conta-gotas", { elemento: e, aparencia: a });
818
+ const r = t.doc.elementosSelecionados().filter((i) => i.id !== e.id && !t.mapa().travado(i));
819
+ return r.length === 0 ? (t.opcoesFerramentas = { ...t.opcoesFerramentas, aparencia: a }, t.anunciar("Aparência guardada para as formas novas"), !0) : t.somenteLeitura ? (t.recusar("conta-gotas", "somente-leitura"), !1) : (t.aplicarSubstituicoes(de(r, a), "conta-gotas"), !0);
824
820
  }
825
- function Rr(t, a) {
826
- const e = y(t, "mover-camada");
827
- return !e || typeof a != "string" || !t.camadas.some((r) => r.id === a) ? (e && t.recusar("mover-camada", "id-invalido", typeof a == "string" ? a : void 0), !1) : (t.aplicarSubstituicoes(e.map((r) => ({ ...r, camadaId: a })), "camada"), !0);
821
+ function Wr(t, e) {
822
+ const a = y(t, "aparencia");
823
+ return a ? (t.aplicarSubstituicoes(de(a, e ?? void 0), "aparencia"), !0) : !1;
828
824
  }
829
- function Te(t) {
830
- const a = y(t, "mascara", 2);
831
- if (!a) return !1;
832
- const e = Q(t, "mascara", gt(t.doc.elementos, a.map((r) => r.id), t.gerarId("grupo"), t.camadas));
833
- return e ? (t.aplicar(e, "mascara"), !0) : !1;
825
+ function Ur(t, e) {
826
+ const a = y(t, "mover-camada");
827
+ return !a || typeof e != "string" || !t.camadas.some((r) => r.id === e) ? (a && t.recusar("mover-camada", "id-invalido", typeof e == "string" ? e : void 0), !1) : (t.aplicarSubstituicoes(a.map((r) => ({ ...r, camadaId: e })), "camada"), !0);
834
828
  }
835
- function we(t) {
836
- const a = y(t, "liberar-mascara");
837
- if (!a) return !1;
838
- const e = vt(t.doc.elementos, a.map((r) => r.id));
839
- return e.every((r, i) => r === t.doc.elementos[i]) ? (t.recusar("liberar-mascara", "tipo-nao-suportado"), !1) : (t.aplicar(e, "mascara"), !0);
829
+ function _e(t) {
830
+ const e = y(t, "mascara", 2);
831
+ if (!e) return !1;
832
+ const a = ea(t, "mascara", Ct(t.doc.elementos, e.map((r) => r.id), t.gerarId("grupo"), t.camadas));
833
+ return a ? (t.aplicar(a, "mascara"), !0) : !1;
840
834
  }
841
- function Ie(t, a = 0.01) {
842
- const e = y(t, "unir", 2);
835
+ function Ne(t) {
836
+ const e = y(t, "liberar-mascara");
843
837
  if (!e) return !1;
844
- const r = $(e, t.camadas), i = Q(t, "unir", bt(r, a));
838
+ const a = Tt(t.doc.elementos, e.map((r) => r.id));
839
+ return a.every((r, i) => r === t.doc.elementos[i]) ? (t.recusar("liberar-mascara", "tipo-nao-suportado"), !1) : (t.aplicar(a, "mascara"), !0);
840
+ }
841
+ function Oe(t, e = 0.01) {
842
+ const a = y(t, "unir", 2);
843
+ if (!a) return !1;
844
+ const r = U(a, t.camadas), i = ea(t, "unir", wt(r, e));
845
845
  if (!i) return !1;
846
846
  const o = new Set(r.slice(1).map((s) => s.id));
847
847
  return t.aplicar(t.doc.elementos.filter((s) => !o.has(s.id)).map((s) => s.id === i.id ? i : s), "unir"), !0;
848
848
  }
849
- function Or(t) {
850
- const a = y(t, "dividir", 2);
851
- if (!a) return !1;
852
- const e = $(a, t.camadas), r = [...e].reverse().find((n) => n.geometria.tipo === "linha" || n.geometria.tipo === "caminho" && n.geometria.geometria.tipo === "LineString"), i = e.find((n) => n !== r);
849
+ function Xr(t) {
850
+ const e = y(t, "dividir", 2);
851
+ if (!e) return !1;
852
+ const a = U(e, t.camadas), r = [...a].reverse().find((n) => n.geometria.tipo === "linha" || n.geometria.tipo === "caminho" && n.geometria.geometria.tipo === "LineString"), i = a.find((n) => n !== r);
853
853
  if (!r || !i)
854
854
  return t.recusar("dividir", "tipo-nao-suportado"), !1;
855
- const o = Q(t, "dividir", yt(i, r, t.gerarId));
855
+ const o = ea(t, "dividir", Dt(i, r, t.gerarId));
856
856
  if (!o) return !1;
857
857
  const s = [];
858
858
  for (const n of t.doc.elementos)
859
859
  n.id !== r.id && (n.id === i.id ? s.push(...o) : s.push(n));
860
860
  return t.aplicar(s, "dividir"), t.selecionar(o.map((n) => n.id)), !0;
861
861
  }
862
- function qr(t, a) {
863
- const e = y(t, "deslocar-caminho");
864
- if (!e) return !1;
865
- const r = e.map((i) => Q(t, "deslocar-caminho", At(i, a, t.gerarId("caminho")))).filter((i) => !!i);
866
- return r.length > 0 && w(t, r, "deslocar-caminho").length > 0;
862
+ function Zr(t, e) {
863
+ const a = y(t, "deslocar-caminho");
864
+ if (!a) return !1;
865
+ const r = a.map((i) => ea(t, "deslocar-caminho", It(i, e, t.gerarId("caminho")))).filter((i) => !!i);
866
+ return r.length > 0 && F(t, r, "deslocar-caminho").length > 0;
867
867
  }
868
- function Ta(t, a, e, r) {
869
- const i = y(t, a);
868
+ function Ia(t, e, a, r) {
869
+ const i = y(t, e);
870
870
  if (!i) return !1;
871
871
  const o = [];
872
872
  for (const s of i) {
873
- const n = r(s), l = n && typeof n == "object" && ("ok" in n || "motivo" in n) ? Q(t, a, n) : n;
873
+ const n = r(s), l = n && typeof n == "object" && ("ok" in n || "motivo" in n) ? ea(t, e, n) : n;
874
874
  l && o.push(l);
875
875
  }
876
- return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o, e), !0);
876
+ return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o, a), !0);
877
877
  }
878
- const Nr = (t, a = 0.2) => Ta(t, "simplificar", "simplificar", (e) => Pt(e, a)), jr = (t) => Ta(t, "contorno-traco", "contorno-traco", (a) => St(a)), Gr = (t) => Ta(t, "converter-caminho", "converter-caminho", (a) => a.geometria.tipo === "caminho" ? null : Mt(a)), Hr = 7, De = 22, qa = 6, G = (t, a) => t.setTransform(a, 0, 0, a, 0, 0);
879
- function S(t, a, e = !0) {
880
- if (a.length !== 0) {
881
- t.moveTo(a[0][0], a[0][1]);
882
- for (let r = 1; r < a.length; r++) t.lineTo(a[r][0], a[r][1]);
883
- e && t.closePath();
878
+ const Jr = (t, e = 0.2) => Ia(t, "simplificar", "simplificar", (a) => Ft(a, e)), Qr = (t) => Ia(t, "contorno-traco", "contorno-traco", (e) => _t(e)), Yr = (t) => Ia(t, "converter-caminho", "converter-caminho", (e) => e.geometria.tipo === "caminho" ? null : Nt(e)), ai = 7, Re = 22, ja = 6, K = (t, e) => t.setTransform(e, 0, 0, e, 0, 0);
879
+ function z(t, e, a = !0) {
880
+ if (e.length !== 0) {
881
+ t.moveTo(e[0][0], e[0][1]);
882
+ for (let r = 1; r < e.length; r++) t.lineTo(e[r][0], e[r][1]);
883
+ a && t.closePath();
884
884
  }
885
885
  }
886
- function fa(t, a, e, r, i) {
887
- const o = e / 2;
888
- t.beginPath(), S(t, [[a[0] - o, a[1] - o], [a[0] + o, a[1] - o], [a[0] + o, a[1] + o], [a[0] - o, a[1] + o]]), t.fillStyle = r, t.fill(), t.strokeStyle = i, t.stroke();
886
+ function va(t, e, a, r, i) {
887
+ const o = a / 2;
888
+ t.beginPath(), z(t, [[e[0] - o, e[1] - o], [e[0] + o, e[1] - o], [e[0] + o, e[1] + o], [e[0] - o, e[1] + o]]), t.fillStyle = r, t.fill(), t.strokeStyle = i, t.stroke();
889
889
  }
890
- function Y(t, a, e) {
890
+ function ta(t, e, a) {
891
891
  const r = [];
892
- for (let i = 0; i < 16; i++) r.push([a[0] + e * Math.cos(i * Math.PI / 8), a[1] + e * Math.sin(i * Math.PI / 8)]);
893
- S(t, r);
894
- }
895
- function $r(t, a) {
896
- const e = a.grade;
897
- if (!e || !(e > 0)) return;
898
- const { vista: r, folha: i } = a;
899
- let o = e;
892
+ for (let i = 0; i < 16; i++) r.push([e[0] + a * Math.cos(i * Math.PI / 8), e[1] + a * Math.sin(i * Math.PI / 8)]);
893
+ z(t, r);
894
+ }
895
+ function ei(t, e) {
896
+ const a = e.grade;
897
+ if (!a || !(a > 0)) return;
898
+ const { vista: r, folha: i } = e;
899
+ let o = a;
900
900
  for (; o * r.zoom < 8; ) o *= 2;
901
901
  const [s, n] = r.paraTela([0, 0]), [l, c] = r.paraTela([i.largura, i.altura]);
902
902
  t.beginPath();
@@ -908,394 +908,394 @@ function $r(t, a) {
908
908
  const h = Math.round(r.paraTela([0, d])[1]) + 0.5;
909
909
  t.moveTo(s, h), t.lineTo(l, h);
910
910
  }
911
- t.strokeStyle = a.cores.grade, t.lineWidth = 1, t.setLineDash([]), t.globalAlpha = 1, t.stroke();
911
+ t.strokeStyle = e.cores.grade, t.lineWidth = 1, t.setLineDash([]), t.globalAlpha = 1, t.stroke();
912
912
  }
913
- function Br(t, a, e, r) {
914
- const i = a.matrizDispositivo();
915
- t.setTransform(i.a, i.b, i.c, i.d, i.e, i.f), t.globalAlpha = 0.6, t.fillStyle = r, t.fillRect(0, 0, e.largura, e.altura);
913
+ function ti(t, e, a, r) {
914
+ const i = e.matrizDispositivo();
915
+ t.setTransform(i.a, i.b, i.c, i.d, i.e, i.f), t.globalAlpha = 0.6, t.fillStyle = r, t.fillRect(0, 0, a.largura, a.altura);
916
916
  }
917
- function Kr(t, a) {
918
- const { vista: e, folha: r, cores: i } = a;
919
- t.save(), G(t, e.dpr), t.globalAlpha = 1, t.fillStyle = i.mesa, t.fillRect(0, 0, e.largura, e.altura), t.restore();
920
- const o = e.matrizDispositivo();
921
- N(t, [], { matriz: o, fundo: { cor: i.papel, largura: r.largura, altura: r.altura } }), t.save(), G(t, e.dpr), $r(t, a), t.restore(), N(t, a.elementos, { matriz: o, camadas: a.camadas }), a.isolados && a.isolados.length > 0 && (t.save(), Br(t, e, r, i.papel), t.restore(), N(t, a.isolados, { matriz: o, camadas: a.camadas })), t.save(), G(t, e.dpr);
922
- const [s, n] = e.paraTela([0, 0]), [l, c] = e.paraTela([r.largura, r.altura]);
923
- t.beginPath(), S(t, [[s, n], [l, n], [l, c], [s, c]]), t.strokeStyle = i.bordaPapel, t.lineWidth = 1, t.stroke();
924
- const d = a.margens;
917
+ function ri(t, e) {
918
+ const { vista: a, folha: r, cores: i } = e;
919
+ t.save(), K(t, a.dpr), t.globalAlpha = 1, t.fillStyle = i.mesa, t.fillRect(0, 0, a.largura, a.altura), t.restore();
920
+ const o = a.matrizDispositivo();
921
+ $(t, [], { matriz: o, fundo: { cor: i.papel, largura: r.largura, altura: r.altura } }), t.save(), K(t, a.dpr), ei(t, e), t.restore(), $(t, e.elementos, { matriz: o, camadas: e.camadas }), e.isolados && e.isolados.length > 0 && (t.save(), ti(t, a, r, i.papel), t.restore(), $(t, e.isolados, { matriz: o, camadas: e.camadas })), t.save(), K(t, a.dpr);
922
+ const [s, n] = a.paraTela([0, 0]), [l, c] = a.paraTela([r.largura, r.altura]);
923
+ t.beginPath(), z(t, [[s, n], [l, n], [l, c], [s, c]]), t.strokeStyle = i.bordaPapel, t.lineWidth = 1, t.stroke();
924
+ const d = e.margens;
925
925
  if (d && d.largura > 0 && d.altura > 0) {
926
- const [h, u] = e.paraTela([d.x, d.y]), [f, p] = e.paraTela([d.x + d.largura, d.y + d.altura]);
927
- t.beginPath(), S(t, [[h, u], [f, u], [f, p], [h, p]]), t.strokeStyle = i.guiaInteligente, t.globalAlpha = 0.6, t.setLineDash([6, 4]), t.stroke(), t.setLineDash([]), t.globalAlpha = 1;
926
+ const [h, u] = a.paraTela([d.x, d.y]), [f, p] = a.paraTela([d.x + d.largura, d.y + d.altura]);
927
+ t.beginPath(), z(t, [[h, u], [f, u], [f, p], [h, p]]), t.strokeStyle = i.guiaInteligente, t.globalAlpha = 0.6, t.setLineDash([6, 4]), t.stroke(), t.setLineDash([]), t.globalAlpha = 1;
928
928
  }
929
929
  t.restore();
930
930
  }
931
- function Na(t, a, e) {
932
- const r = za(a);
931
+ function Ga(t, e, a) {
932
+ const r = Ca(e);
933
933
  if (!r) return;
934
934
  const i = r.tipo === "Polygon" ? r.aneis : r.partes && r.partes.length > 1 ? r.partes : [r.coordenadas];
935
- for (const o of i) S(t, o.map((s) => e.paraTela(s)), r.tipo === "Polygon");
935
+ for (const o of i) z(t, o.map((s) => a.paraTela(s)), r.tipo === "Polygon");
936
936
  }
937
- function ja(t, a) {
938
- return ["no", "ne", "se", "so"].map((e) => a.paraTela(Et(t.quadro, xt(t, e))));
937
+ function Ha(t, e) {
938
+ return ["no", "ne", "se", "so"].map((a) => e.paraTela(Rt(t.quadro, Lt(t, a))));
939
939
  }
940
- function Ga(t, a, e) {
941
- if (a.orientacao === "horizontal") {
942
- const r = Math.round(e.paraTela([0, a.posicao])[1]) + 0.5;
943
- t.moveTo(0, r), t.lineTo(e.largura, r);
940
+ function $a(t, e, a) {
941
+ if (e.orientacao === "horizontal") {
942
+ const r = Math.round(a.paraTela([0, e.posicao])[1]) + 0.5;
943
+ t.moveTo(0, r), t.lineTo(a.largura, r);
944
944
  } else {
945
- const r = Math.round(e.paraTela([a.posicao, 0])[0]) + 0.5;
946
- t.moveTo(r, 0), t.lineTo(r, e.altura);
945
+ const r = Math.round(a.paraTela([e.posicao, 0])[0]) + 0.5;
946
+ t.moveTo(r, 0), t.lineTo(r, a.altura);
947
947
  }
948
948
  }
949
- function pa(t, a, e, r) {
950
- typeof t.fillText == "function" && (t.font = "11px sans-serif", t.fillStyle = r, t.fillText(a, e[0], e[1]));
949
+ function ba(t, e, a, r) {
950
+ typeof t.fillText == "function" && (t.font = "11px sans-serif", t.fillStyle = r, t.fillText(e, a[0], a[1]));
951
951
  }
952
- function Vr(t, a) {
953
- const { vista: e, cores: r, ui: i } = a;
954
- t.save(), G(t, e.dpr), typeof t.clearRect == "function" && t.clearRect(0, 0, e.largura, e.altura), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([]), t.beginPath();
955
- for (const s of a.guias) Ga(t, s, e);
956
- t.strokeStyle = r.guia, t.stroke(), i.guiaArrastada && (t.beginPath(), Ga(t, i.guiaArrastada.guia, e), t.setLineDash([4, 3]), t.stroke(), t.setLineDash([])), a.hover && !a.selecionados.includes(a.hover) && (t.beginPath(), Na(t, a.hover, e), t.strokeStyle = r.selecao, t.stroke()), a.emGesto.length > 0 && (N(t, a.emGesto, { matriz: e.matrizDispositivo() }), G(t, e.dpr), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([])), i.previa && (N(t, [i.previa], { matriz: e.matrizDispositivo() }), G(t, e.dpr), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([]));
957
- for (const s of i.pontosPrevia) fa(t, e.paraTela(s), qa, r.alca, r.selecao);
958
- const o = i.edicao ? a.selecionados.find((s) => s.id === i.edicao.id) ?? null : null;
959
- for (const s of a.selecionados) {
960
- const n = zt(s);
961
- !n || s === o || (t.beginPath(), S(t, ja(n, e)), t.strokeStyle = r.selecao, t.stroke());
952
+ function ii(t, e) {
953
+ const { vista: a, cores: r, ui: i } = e;
954
+ t.save(), K(t, a.dpr), typeof t.clearRect == "function" && t.clearRect(0, 0, a.largura, a.altura), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([]), t.beginPath();
955
+ for (const s of e.guias) $a(t, s, a);
956
+ t.strokeStyle = r.guia, t.stroke(), i.guiaArrastada && (t.beginPath(), $a(t, i.guiaArrastada.guia, a), t.setLineDash([4, 3]), t.stroke(), t.setLineDash([])), e.hover && !e.selecionados.includes(e.hover) && (t.beginPath(), Ga(t, e.hover, a), t.strokeStyle = r.selecao, t.stroke()), e.emGesto.length > 0 && ($(t, e.emGesto, { matriz: a.matrizDispositivo() }), K(t, a.dpr), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([])), i.previa && ($(t, [i.previa], { matriz: a.matrizDispositivo() }), K(t, a.dpr), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([]));
957
+ for (const s of i.pontosPrevia) va(t, a.paraTela(s), ja, r.alca, r.selecao);
958
+ const o = i.edicao ? e.selecionados.find((s) => s.id === i.edicao.id) ?? null : null;
959
+ for (const s of e.selecionados) {
960
+ const n = Ot(s);
961
+ !n || s === o || (t.beginPath(), z(t, Ha(n, a)), t.strokeStyle = r.selecao, t.stroke());
962
962
  }
963
963
  if (o && i.edicao) {
964
- t.beginPath(), Na(t, o, e), t.strokeStyle = r.selecao, t.stroke();
965
- const s = Sa(o), n = ce(o);
964
+ t.beginPath(), Ga(t, o, a), t.strokeStyle = r.selecao, t.stroke();
965
+ const s = xa(o), n = me(o);
966
966
  t.beginPath(), i.edicao.ancoras.forEach((l) => {
967
967
  const c = s[l], d = n[l];
968
968
  if (!(!c || !d))
969
- for (const h of [d.entrada, d.saida]) h && S(t, [e.paraTela(c), e.paraTela(h)], !1);
969
+ for (const h of [d.entrada, d.saida]) h && z(t, [a.paraTela(c), a.paraTela(h)], !1);
970
970
  }), t.stroke(), i.edicao.ancoras.forEach((l) => {
971
971
  const c = n[l];
972
972
  if (c)
973
973
  for (const d of [c.entrada, c.saida])
974
- d && (t.beginPath(), Y(t, e.paraTela(d), 3), t.fillStyle = r.selecao, t.fill());
975
- }), s.forEach((l, c) => fa(t, e.paraTela(l), qa, i.edicao.ancoras.includes(c) ? r.selecao : r.alca, r.selecao));
976
- } else if (a.caixaTransformacao && a.selecionados.length > 0) {
977
- const s = Ma(a.selecionados);
974
+ d && (t.beginPath(), ta(t, a.paraTela(d), 3), t.fillStyle = r.selecao, t.fill());
975
+ }), s.forEach((l, c) => va(t, a.paraTela(l), ja, i.edicao.ancoras.includes(c) ? r.selecao : r.alca, r.selecao));
976
+ } else if (e.caixaTransformacao && e.selecionados.length > 0) {
977
+ const s = Ea(e.selecionados);
978
978
  if (s) {
979
- const n = ue(s, De / e.zoom);
980
- t.beginPath(), S(t, ja(s, e)), S(t, [e.paraTela(n.alcas.n), e.paraTela(n.rotacao)], !1), t.strokeStyle = r.selecao, t.stroke();
981
- for (const c of Object.values(n.alcas)) fa(t, e.paraTela(c), Hr, r.alca, r.selecao);
982
- t.beginPath(), Y(t, e.paraTela(n.rotacao), 4), t.fillStyle = r.alca, t.fill(), t.stroke();
983
- for (const c of a.marcasCantos ?? [])
984
- t.beginPath(), Y(t, e.paraTela(c), 3.5), t.fillStyle = r.alca, t.fill(), t.strokeStyle = r.selecao, t.stroke();
985
- const l = e.paraTela(i.pivo ?? n.centro);
986
- t.beginPath(), Y(t, l, 4), S(t, [[l[0] - 7, l[1]], [l[0] + 7, l[1]]], !1), S(t, [[l[0], l[1] - 7], [l[0], l[1] + 7]], !1), t.stroke();
979
+ const n = fe(s, Re / a.zoom);
980
+ t.beginPath(), z(t, Ha(s, a)), z(t, [a.paraTela(n.alcas.n), a.paraTela(n.rotacao)], !1), t.strokeStyle = r.selecao, t.stroke();
981
+ for (const c of Object.values(n.alcas)) va(t, a.paraTela(c), ai, r.alca, r.selecao);
982
+ t.beginPath(), ta(t, a.paraTela(n.rotacao), 4), t.fillStyle = r.alca, t.fill(), t.stroke();
983
+ for (const c of e.marcasCantos ?? [])
984
+ t.beginPath(), ta(t, a.paraTela(c), 3.5), t.fillStyle = r.alca, t.fill(), t.strokeStyle = r.selecao, t.stroke();
985
+ const l = a.paraTela(i.pivo ?? n.centro);
986
+ t.beginPath(), ta(t, l, 4), z(t, [[l[0] - 7, l[1]], [l[0] + 7, l[1]]], !1), z(t, [[l[0], l[1] - 7], [l[0], l[1] + 7]], !1), t.stroke();
987
987
  }
988
988
  }
989
989
  if (i.linhasInteligentes.length > 0) {
990
990
  t.beginPath();
991
991
  for (const s of i.linhasInteligentes) {
992
- const n = e.paraTela(s.orientacao === "vertical" ? [s.posicao, s.de] : [s.de, s.posicao]), l = e.paraTela(s.orientacao === "vertical" ? [s.posicao, s.ate] : [s.ate, s.posicao]);
993
- S(t, [n, l], !1);
992
+ const n = a.paraTela(s.orientacao === "vertical" ? [s.posicao, s.de] : [s.de, s.posicao]), l = a.paraTela(s.orientacao === "vertical" ? [s.posicao, s.ate] : [s.ate, s.posicao]);
993
+ z(t, [n, l], !1);
994
994
  }
995
995
  t.strokeStyle = r.guiaInteligente, t.stroke();
996
996
  for (const s of i.linhasInteligentes) {
997
997
  if (s.distancia === void 0) continue;
998
- const n = e.paraTela(s.orientacao === "vertical" ? [s.posicao, (s.de + s.ate) / 2] : [(s.de + s.ate) / 2, s.posicao]);
999
- pa(t, `${Math.round(s.distancia * 100) / 100} mm`, [n[0] + 4, n[1] - 4], r.guiaInteligente);
998
+ const n = a.paraTela(s.orientacao === "vertical" ? [s.posicao, (s.de + s.ate) / 2] : [(s.de + s.ate) / 2, s.posicao]);
999
+ ba(t, `${Math.round(s.distancia * 100) / 100} mm`, [n[0] + 4, n[1] - 4], r.guiaInteligente);
1000
1000
  }
1001
1001
  }
1002
1002
  if (i.caixaSelecao) {
1003
- const s = e.paraTela(i.caixaSelecao.de), n = e.paraTela(i.caixaSelecao.ate);
1004
- t.beginPath(), S(t, [s, [n[0], s[1]], n, [s[0], n[1]]]), t.setLineDash(i.caixaSelecao.crossing ? [5, 3] : []), t.strokeStyle = r.selecao, t.stroke(), t.setLineDash([]);
1003
+ const s = a.paraTela(i.caixaSelecao.de), n = a.paraTela(i.caixaSelecao.ate);
1004
+ t.beginPath(), z(t, [s, [n[0], s[1]], n, [s[0], n[1]]]), t.setLineDash(i.caixaSelecao.crossing ? [5, 3] : []), t.strokeStyle = r.selecao, t.stroke(), t.setLineDash([]);
1005
1005
  }
1006
1006
  if (i.snap) {
1007
- const s = e.paraTela(i.snap.coordenada);
1008
- t.beginPath(), S(t, [[s[0] - 5, s[1] - 5], [s[0] + 5, s[1] - 5], [s[0] + 5, s[1] + 5], [s[0] - 5, s[1] + 5]]), t.strokeStyle = r.snap, t.stroke(), pa(t, i.snap.tipo, [s[0] + 8, s[1] - 8], r.snap);
1007
+ const s = a.paraTela(i.snap.coordenada);
1008
+ t.beginPath(), z(t, [[s[0] - 5, s[1] - 5], [s[0] + 5, s[1] - 5], [s[0] + 5, s[1] + 5], [s[0] - 5, s[1] + 5]]), t.strokeStyle = r.snap, t.stroke(), ba(t, i.snap.tipo, [s[0] + 8, s[1] - 8], r.snap);
1009
1009
  }
1010
1010
  if (i.rotulo) {
1011
- const s = e.paraTela(i.rotulo.em);
1012
- pa(t, i.rotulo.texto, [s[0] + 12, s[1] + 18], r.selecao);
1011
+ const s = a.paraTela(i.rotulo.em);
1012
+ ba(t, i.rotulo.texto, [s[0] + 12, s[1] + 18], r.selecao);
1013
1013
  }
1014
1014
  t.restore();
1015
1015
  }
1016
- const Ur = 14;
1017
- function _e(t) {
1018
- const a = t.doc.elementosSelecionados();
1019
- return a.length !== 1 || t.ferramenta !== "selecao" || t.somenteLeitura ? null : Lt(t.ui.substitutos.get(a[0].id) ?? a[0], Ur / t.vista.zoom);
1016
+ const oi = 14;
1017
+ function Le(t) {
1018
+ const e = t.doc.elementosSelecionados();
1019
+ return e.length !== 1 || t.ferramenta !== "selecao" || t.somenteLeitura ? null : Kt(t.ui.substitutos.get(e[0].id) ?? e[0], oi / t.vista.zoom);
1020
1020
  }
1021
- const F = (t, a) => Math.hypot(t[0] - a[0], t[1] - a[1]);
1022
- function Ha(t, a, e) {
1023
- const r = t.doc.elementosSelecionados(), i = r.length > 0 ? Ma(r) : null;
1021
+ const L = (t, e) => Math.hypot(t[0] - e[0], t[1] - e[1]);
1022
+ function Va(t, e, a) {
1023
+ const r = t.doc.elementosSelecionados(), i = r.length > 0 ? Ea(r) : null;
1024
1024
  if (!i) return null;
1025
- const o = e ? 19 : 6, s = t.vista, n = ue(i, De / s.zoom), l = _e(t);
1025
+ const o = a ? 19 : 6, s = t.vista, n = fe(i, Re / s.zoom), l = Le(t);
1026
1026
  if (l) {
1027
- const c = l.findIndex((d) => F(s.paraTela(d), a) <= o);
1027
+ const c = l.findIndex((d) => L(s.paraTela(d), e) <= o);
1028
1028
  if (c >= 0) return { tipo: "canto", canto: c };
1029
1029
  }
1030
- if (F(s.paraTela(t.ui.pivo ?? n.centro), a) <= o) return { tipo: "pivo" };
1031
- if (F(s.paraTela(n.rotacao), a) <= o) return { tipo: "rotacao" };
1032
- for (const c of Ct) if (F(s.paraTela(n.alcas[c]), a) <= o) return { tipo: "escala", alca: c };
1030
+ if (L(s.paraTela(t.ui.pivo ?? n.centro), e) <= o) return { tipo: "pivo" };
1031
+ if (L(s.paraTela(n.rotacao), e) <= o) return { tipo: "rotacao" };
1032
+ for (const c of kt) if (L(s.paraTela(n.alcas[c]), e) <= o) return { tipo: "escala", alca: c };
1033
1033
  return null;
1034
1034
  }
1035
- function Xr(t, a, e, r) {
1036
- const i = t.doc.elementosSelecionados().filter((n) => !n.bloqueado), o = Ma(i);
1035
+ function si(t, e, a, r) {
1036
+ const i = t.doc.elementosSelecionados().filter((n) => !n.bloqueado), o = Ea(i);
1037
1037
  if (!o || i.length === 0) return null;
1038
- if (a.tipo === "pivo") return { tipo: "pivo" };
1039
- if (a.tipo === "canto") {
1040
- const n = i[0], l = de(n), c = he(n, a.canto ?? 0, e);
1041
- return i.length !== 1 || !l || c === null ? null : { tipo: "canto", original: n, indice: a.canto ?? 0, raio0: l[a.canto ?? 0], profundidade0: c };
1038
+ if (e.tipo === "pivo") return { tipo: "pivo" };
1039
+ if (e.tipo === "canto") {
1040
+ const n = i[0], l = pe(n), c = ge(n, e.canto ?? 0, a);
1041
+ return i.length !== 1 || !l || c === null ? null : { tipo: "canto", original: n, indice: e.canto ?? 0, raio0: l[e.canto ?? 0], profundidade0: c };
1042
1042
  }
1043
- if (a.tipo === "rotacao") return { tipo: "rotacao", pivo: da(t) ?? e, inicio: e, originais: i };
1044
- const s = a.alca;
1043
+ if (e.tipo === "rotacao") return { tipo: "rotacao", pivo: ma(t) ?? a, inicio: a, originais: i };
1044
+ const s = e.alca;
1045
1045
  return r.ctrl && (s === "n" || s === "s" || s === "e" || s === "o") ? { tipo: "cisalhamento", caixa: o, alca: s, originais: i } : { tipo: "escala", caixa: o, alca: s, originais: i };
1046
1046
  }
1047
- function Zr(t, a, e) {
1048
- const r = 50 / t.vista.zoom, i = t.doc.indice.consultarCaixa(a, r).filter((s) => !e.has(s.id) && !s.oculto), o = [{ x: 0, y: 0, largura: t.folha.largura, altura: t.folha.altura }];
1047
+ function ni(t, e, a) {
1048
+ const r = 50 / t.vista.zoom, i = t.doc.indice.consultarCaixa(e, r).filter((s) => !a.has(s.id) && !s.oculto), o = [{ x: 0, y: 0, largura: t.folha.largura, altura: t.folha.altura }];
1049
1049
  for (const s of i.slice(0, 200)) {
1050
- const n = W(s);
1050
+ const n = Y(s);
1051
1051
  n && o.push(n);
1052
1052
  }
1053
1053
  return o;
1054
1054
  }
1055
- function Wr(t) {
1056
- let a = 1 / 0, e = 1 / 0, r = -1 / 0, i = -1 / 0;
1055
+ function li(t) {
1056
+ let e = 1 / 0, a = 1 / 0, r = -1 / 0, i = -1 / 0;
1057
1057
  for (const o of t) {
1058
- const s = Rt(o);
1059
- s && (a = Math.min(a, s.x), e = Math.min(e, s.y), r = Math.max(r, s.x + s.largura), i = Math.max(i, s.y + s.altura));
1058
+ const s = Wt(o);
1059
+ s && (e = Math.min(e, s.x), a = Math.min(a, s.y), r = Math.max(r, s.x + s.largura), i = Math.max(i, s.y + s.altura));
1060
1060
  }
1061
- return a <= r ? { x: a, y: e, largura: r - a, altura: i - e } : null;
1061
+ return e <= r ? { x: e, y: a, largura: r - e, altura: i - a } : null;
1062
1062
  }
1063
- function Jr(t, a, e = !1, r = !1) {
1063
+ function ci(t, e, a = !1, r = !1) {
1064
1064
  const i = t.doc.elementosSelecionados().filter((n) => !n.bloqueado);
1065
1065
  if (i.length === 0) return null;
1066
- const o = i.length <= 200 ? i.length === 1 ? W(i[0]) : Wr(i) : null, s = t.snapLigado && i.length <= 200 ? te(a, i, t.vista.zoom, { toleranciaPx: t.toleranciaPx(e), meio: !1, aresta: !1 }) : null;
1067
- return { tipo: "mover", inicio: s ? s.coordenada : a, originais: i, caixa: o, duplicar: r };
1066
+ const o = i.length <= 200 ? i.length === 1 ? Y(i[0]) : li(i) : null, s = t.snapLigado && i.length <= 200 ? se(e, i, t.vista.zoom, { toleranciaPx: t.toleranciaPx(a), meio: !1, aresta: !1 }) : null;
1067
+ return { tipo: "mover", inicio: s ? s.coordenada : e, originais: i, caixa: o, duplicar: r };
1068
1068
  }
1069
- function Qr(t, a, e, r) {
1069
+ function ui(t, e, a, r) {
1070
1070
  var s, n, l;
1071
1071
  const i = t.ui;
1072
1072
  i.linhasInteligentes = [], i.snap = null;
1073
1073
  let o = [];
1074
- switch (a.tipo) {
1074
+ switch (e.tipo) {
1075
1075
  case "pivo":
1076
- i.pivo = t.snapPonto(e, { toque: r.toque, desligado: r.alt }).ponto;
1076
+ i.pivo = t.snapPonto(a, { toque: r.toque, desligado: r.alt }).ponto;
1077
1077
  break;
1078
1078
  case "mover": {
1079
- let c = e[0] - a.inicio[0], d = e[1] - a.inicio[1];
1079
+ let c = a[0] - e.inicio[0], d = a[1] - e.inicio[1];
1080
1080
  r.shift && (Math.abs(c) >= Math.abs(d) ? d = 0 : c = 0);
1081
- const h = new Set(a.originais.map((f) => f.id));
1082
- if ((!r.alt || a.duplicar) && t.snapLigado) {
1083
- const f = t.snapPonto([a.inicio[0] + c, a.inicio[1] + d], { excluir: h, grade: !1, toque: r.toque });
1081
+ const h = new Set(e.originais.map((f) => f.id));
1082
+ if ((!r.alt || e.duplicar) && t.snapLigado) {
1083
+ const f = t.snapPonto([e.inicio[0] + c, e.inicio[1] + d], { excluir: h, grade: !1, toque: r.toque });
1084
1084
  if (f.resultado)
1085
- c = f.ponto[0] - a.inicio[0], d = f.ponto[1] - a.inicio[1];
1086
- else if (a.caixa && t.guiasInteligentes) {
1087
- const p = { ...a.caixa, x: a.caixa.x + c, y: a.caixa.y + d }, v = kt(p, Zr(t, p, h), 6 / t.vista.zoom);
1085
+ c = f.ponto[0] - e.inicio[0], d = f.ponto[1] - e.inicio[1];
1086
+ else if (e.caixa && t.guiasInteligentes) {
1087
+ const p = { ...e.caixa, x: e.caixa.x + c, y: e.caixa.y + d }, v = Vt(p, ni(t, p, h), 6 / t.vista.zoom);
1088
1088
  if (c += v.correcao[0], d += v.correcao[1], i.linhasInteligentes = v.linhas, v.linhas.length === 0) {
1089
- const b = t.snapPonto([a.inicio[0] + c, a.inicio[1] + d], { excluir: h, toque: r.toque });
1090
- ((s = b.resultado) == null ? void 0 : s.tipo) === "grade" && (c = b.ponto[0] - a.inicio[0], d = b.ponto[1] - a.inicio[1]);
1089
+ const b = t.snapPonto([e.inicio[0] + c, e.inicio[1] + d], { excluir: h, toque: r.toque });
1090
+ ((s = b.resultado) == null ? void 0 : s.tipo) === "grade" && (c = b.ponto[0] - e.inicio[0], d = b.ponto[1] - e.inicio[1]);
1091
1091
  }
1092
1092
  }
1093
1093
  }
1094
- a.matriz = k(c, d), o = T(a.originais, a.matriz), a.duplicar && (i.copiasEmGesto = o, o = []);
1094
+ e.matriz = k(c, d), o = I(e.originais, e.matriz), e.duplicar && (i.copiasEmGesto = o, o = []);
1095
1095
  const u = (f) => Math.round(f * 100) / 100;
1096
- i.rotulo = { texto: `Δ ${u(c)}, ${u(d)} mm`, em: e };
1096
+ i.rotulo = { texto: `Δ ${u(c)}, ${u(d)} mm`, em: a };
1097
1097
  break;
1098
1098
  }
1099
1099
  case "escala": {
1100
- const c = t.snapPonto(e, { excluir: a.originais.map((h) => h.id), toque: r.toque }).ponto, d = Ft(a.caixa, a.alca, c, { proporcional: r.shift, doCentro: r.alt });
1101
- d && (a.matriz = d, o = T(a.originais, d));
1100
+ const c = t.snapPonto(a, { excluir: e.originais.map((h) => h.id), toque: r.toque }).ponto, d = $t(e.caixa, e.alca, c, { proporcional: r.shift, doCentro: r.alt });
1101
+ d && (e.matriz = d, o = I(e.originais, d));
1102
1102
  break;
1103
1103
  }
1104
1104
  case "cisalhamento": {
1105
- const c = _t(a.caixa, a.alca, e);
1106
- c && (a.matriz = c, o = T(a.originais, c));
1105
+ const c = Ht(e.caixa, e.alca, a);
1106
+ c && (e.matriz = c, o = I(e.originais, c));
1107
1107
  break;
1108
1108
  }
1109
1109
  case "rotacao": {
1110
- const c = Dt(a.pivo, a.inicio, e, r.shift ? Math.PI / 4 : void 0);
1111
- a.matriz = c.matriz, o = T(a.originais, c.matriz), i.rotulo = { texto: `${Math.round(c.angulo * 180 / Math.PI * 10) / 10}°`, em: e };
1110
+ const c = Gt(e.pivo, e.inicio, a, r.shift ? Math.PI / 4 : void 0);
1111
+ e.matriz = c.matriz, o = I(e.originais, c.matriz), i.rotulo = { texto: `${Math.round(c.angulo * 180 / Math.PI * 10) / 10}°`, em: a };
1112
1112
  break;
1113
1113
  }
1114
1114
  case "ancora": {
1115
1115
  const c = ((n = i.edicao) == null ? void 0 : n.ancoras) ?? [];
1116
- if (c.length > 1 && c.includes(a.indice)) {
1117
- const d = ie(a.original, c, e[0] - a.inicio[0], e[1] - a.inicio[1]);
1116
+ if (c.length > 1 && c.includes(e.indice)) {
1117
+ const d = le(e.original, c, a[0] - e.inicio[0], a[1] - e.inicio[1]);
1118
1118
  d && (o = [d]);
1119
1119
  } else {
1120
- const d = t.snapPonto(e, { excluir: [a.original.id], toque: r.toque, desligado: r.alt }).ponto, h = It(a.original, a.indice, d);
1120
+ const d = t.snapPonto(a, { excluir: [e.original.id], toque: r.toque, desligado: r.alt }).ponto, h = jt(e.original, e.indice, d);
1121
1121
  h && (o = [h]);
1122
1122
  }
1123
1123
  break;
1124
1124
  }
1125
1125
  case "alca-bezier": {
1126
- const c = wt(a.original, a.indice, a.qual, e, !r.alt);
1126
+ const c = Bt(e.original, e.indice, e.qual, a, !r.alt);
1127
1127
  c && (o = [c]);
1128
1128
  break;
1129
1129
  }
1130
1130
  case "canto": {
1131
- const c = he(a.original, a.indice, e);
1131
+ const c = ge(e.original, e.indice, a);
1132
1132
  if (c === null) break;
1133
- const d = Tt(a.original, r.alt ? a.indice : null, a.raio0 + c - a.profundidade0);
1133
+ const d = qt(e.original, r.alt ? e.indice : null, e.raio0 + c - e.profundidade0);
1134
1134
  if (d) {
1135
1135
  o = [d];
1136
- const h = ((l = de(d)) == null ? void 0 : l[a.indice]) ?? 0;
1137
- i.rotulo = { texto: `R ${Math.round(h * 100) / 100} mm`, em: e };
1136
+ const h = ((l = pe(d)) == null ? void 0 : l[e.indice]) ?? 0;
1137
+ i.rotulo = { texto: `R ${Math.round(h * 100) / 100} mm`, em: a };
1138
1138
  }
1139
1139
  break;
1140
1140
  }
1141
1141
  }
1142
1142
  i.substitutos = new Map(o.map((c) => [c.id, c])), t.agendar();
1143
1143
  }
1144
- function Yr(t, a) {
1145
- const e = [...t.ui.substitutos.values()];
1146
- if (t.ui.substitutos = /* @__PURE__ */ new Map(), t.ui.copiasEmGesto = [], t.ui.linhasInteligentes = [], t.ui.snap = null, t.ui.rotulo = null, a.tipo === "mover" && a.duplicar) {
1147
- if (a.matriz) {
1148
- const i = T(le(a.originais, t.gerarId), a.matriz);
1149
- w(t, i, "duplicar"), Oa(t, a.matriz, !0);
1144
+ function di(t, e) {
1145
+ const a = [...t.ui.substitutos.values()];
1146
+ if (t.ui.substitutos = /* @__PURE__ */ new Map(), t.ui.copiasEmGesto = [], t.ui.linhasInteligentes = [], t.ui.snap = null, t.ui.rotulo = null, e.tipo === "mover" && e.duplicar) {
1147
+ if (e.matriz) {
1148
+ const i = I(he(e.originais, t.gerarId), e.matriz);
1149
+ F(t, i, "duplicar"), Ba(t, e.matriz, !0);
1150
1150
  }
1151
1151
  t.agendar();
1152
1152
  return;
1153
1153
  }
1154
- if ((a.tipo === "mover" || a.tipo === "escala" || a.tipo === "rotacao" || a.tipo === "cisalhamento") && a.matriz && e.length > 0 && Oa(t, a.matriz, !1), a.tipo === "pivo" || e.length === 0) {
1154
+ if ((e.tipo === "mover" || e.tipo === "escala" || e.tipo === "rotacao" || e.tipo === "cisalhamento") && e.matriz && a.length > 0 && Ba(t, e.matriz, !1), e.tipo === "pivo" || a.length === 0) {
1155
1155
  t.agendar();
1156
1156
  return;
1157
1157
  }
1158
- const r = a.tipo === "mover" ? "mover" : a.tipo === "ancora" || a.tipo === "alca-bezier" ? "editar-ancoras" : a.tipo === "canto" ? "cantos" : "transformar";
1159
- (a.tipo === "rotacao" || a.tipo === "escala" || a.tipo === "cisalhamento") && t.ui.pivo && a.tipo !== "rotacao" && (t.ui.pivo = null), t.aplicarSubstituicoes(e, r);
1158
+ const r = e.tipo === "mover" ? "mover" : e.tipo === "ancora" || e.tipo === "alca-bezier" ? "editar-ancoras" : e.tipo === "canto" ? "cantos" : "transformar";
1159
+ (e.tipo === "rotacao" || e.tipo === "escala" || e.tipo === "cisalhamento") && t.ui.pivo && e.tipo !== "rotacao" && (t.ui.pivo = null), t.aplicarSubstituicoes(a, r);
1160
1160
  }
1161
- function $a(t, a, e) {
1161
+ function Ka(t, e, a) {
1162
1162
  const r = t.ui.edicao, i = r ? t.doc.obter(r.id) : void 0;
1163
1163
  if (!r || !i) return null;
1164
- const o = e ? 19 : 6, s = t.vista, n = ce(i);
1164
+ const o = a ? 19 : 6, s = t.vista, n = me(i);
1165
1165
  for (const d of r.ancoras) {
1166
1166
  const h = n[d];
1167
- if (h != null && h.saida && F(s.paraTela(h.saida), a) <= o) return { tipo: "alca", indice: d, qual: "saida" };
1168
- if (h != null && h.entrada && F(s.paraTela(h.entrada), a) <= o) return { tipo: "alca", indice: d, qual: "entrada" };
1167
+ if (h != null && h.saida && L(s.paraTela(h.saida), e) <= o) return { tipo: "alca", indice: d, qual: "saida" };
1168
+ if (h != null && h.entrada && L(s.paraTela(h.entrada), e) <= o) return { tipo: "alca", indice: d, qual: "entrada" };
1169
1169
  }
1170
- const l = Sa(i);
1170
+ const l = xa(i);
1171
1171
  let c = null;
1172
1172
  return l.forEach((d, h) => {
1173
- const u = F(s.paraTela(d), a);
1173
+ const u = L(s.paraTela(d), e);
1174
1174
  u <= o && (!c || u < c.d) && (c = { indice: h, d: u });
1175
1175
  }), c ? { tipo: "ancora", indice: c.indice } : null;
1176
1176
  }
1177
- function ai(t, a, e) {
1177
+ function hi(t, e, a) {
1178
1178
  const r = t.ui.edicao, i = r ? t.doc.obter(r.id) : void 0;
1179
1179
  if (!i) return [];
1180
- const o = Math.min(a[0], e[0]), s = Math.max(a[0], e[0]), n = Math.min(a[1], e[1]), l = Math.max(a[1], e[1]);
1181
- return Sa(i).map((c, d) => c[0] >= o && c[0] <= s && c[1] >= n && c[1] <= l ? d : -1).filter((c) => c >= 0);
1180
+ const o = Math.min(e[0], a[0]), s = Math.max(e[0], a[0]), n = Math.min(e[1], a[1]), l = Math.max(e[1], a[1]);
1181
+ return xa(i).map((c, d) => c[0] >= o && c[0] <= s && c[1] >= n && c[1] <= l ? d : -1).filter((c) => c >= 0);
1182
1182
  }
1183
- const ei = ["conta-gotas", "adicionar-ancora", "excluir-ancora", "converter-ancora"], ti = (t) => ei.includes(t), Fe = (t, a) => (a ? 19 : 8) / t.vista.zoom;
1184
- function ri(t, a, e) {
1185
- const r = Fe(t, e), i = t.doc.elementosSelecionados(), o = oa(a, t.candidatosEm(a, r + 2), { tolerancia: r, camadas: t.camadas });
1183
+ const mi = ["conta-gotas", "adicionar-ancora", "excluir-ancora", "converter-ancora"], fi = (t) => mi.includes(t), ke = (t, e) => (e ? 19 : 8) / t.vista.zoom;
1184
+ function pi(t, e, a) {
1185
+ const r = ke(t, a), i = t.doc.elementosSelecionados(), o = na(e, t.candidatosEm(e, r + 2), { tolerancia: r, camadas: t.camadas });
1186
1186
  return o && !i.includes(o) ? [...i, o] : i;
1187
1187
  }
1188
- function ii(t, a, e) {
1189
- const r = t.ferramenta, i = Fe(t, e);
1188
+ function gi(t, e, a) {
1189
+ const r = t.ferramenta, i = ke(t, a);
1190
1190
  if (r === "conta-gotas") {
1191
- const o = oa(a, t.candidatosEm(a, i + 2), { tolerancia: i, camadas: t.camadas, incluirBloqueados: !0 });
1192
- return o ? kr(t, o) : !1;
1191
+ const o = na(e, t.candidatosEm(e, i + 2), { tolerancia: i, camadas: t.camadas, incluirBloqueados: !0 });
1192
+ return o ? Kr(t, o) : !1;
1193
1193
  }
1194
1194
  if (t.somenteLeitura)
1195
1195
  return t.recusar("editar-ancoras", "somente-leitura"), !1;
1196
- for (const o of ri(t, a, e)) {
1196
+ for (const o of pi(t, e, a)) {
1197
1197
  if (!t.podeSelecionar(o)) continue;
1198
1198
  let s = null;
1199
1199
  if (r === "adicionar-ancora") {
1200
- const n = Ot(o, a, i);
1200
+ const n = Ut(o, e, i);
1201
1201
  if (n === null) continue;
1202
- s = qt(o, n, a);
1202
+ s = Xt(o, n, e);
1203
1203
  } else {
1204
- const n = Nt(o, a, i);
1204
+ const n = Zt(o, e, i);
1205
1205
  if (n === null) continue;
1206
- if (s = r === "excluir-ancora" ? oe(o, n) : jt(o, n), !s)
1206
+ if (s = r === "excluir-ancora" ? ce(o, n) : Jt(o, n), !s)
1207
1207
  return t.recusar(r, r === "excluir-ancora" ? "minimo-de-ancoras" : "tipo-nao-suportado", o.id), !1;
1208
1208
  }
1209
1209
  return s ? (t.aplicarSubstituicoes([s], "editar-ancoras"), t.doc.selecao.includes(s.id) || t.selecionar([s.id], "substituir", !1), !0) : (t.recusar(r, o.geometria.tipo === "texto" ? "texto-sem-ancoras" : "tipo-nao-suportado", o.id), !1);
1210
1210
  }
1211
1211
  return !1;
1212
1212
  }
1213
- const oi = 4, Ba = 3;
1214
- class si {
1215
- constructor(a, e, r) {
1213
+ const vi = 4, Wa = 3;
1214
+ class bi {
1215
+ constructor(e, a, r) {
1216
1216
  m(this, "gesto", { tipo: "nenhum" });
1217
1217
  /** Espaço segurado (pan temporário). */
1218
1218
  m(this, "espaco", !1);
1219
1219
  m(this, "ultimoClique", null);
1220
- this.c = a, this.viewport = e, this.ferramentas = r;
1220
+ this.c = e, this.viewport = a, this.ferramentas = r;
1221
1221
  }
1222
- conectar(a, e, r) {
1223
- a.add(this.viewport, "pointerdown", (i) => this.pressionar(i)), a.add(this.viewport, "pointermove", (i) => this.mover(i)), a.add(this.viewport, "pointerup", (i) => this.soltar(i)), a.add(this.viewport, "pointercancel", () => this.cancelar()), a.add(this.viewport, "pointerleave", () => this.sair()), a.add(this.viewport, "wheel", (i) => this.roda(i), { passive: !1 }), a.add(this.viewport, "contextmenu", (i) => {
1222
+ conectar(e, a, r) {
1223
+ e.add(this.viewport, "pointerdown", (i) => this.pressionar(i)), e.add(this.viewport, "pointermove", (i) => this.mover(i)), e.add(this.viewport, "pointerup", (i) => this.soltar(i)), e.add(this.viewport, "pointercancel", () => this.cancelar()), e.add(this.viewport, "pointerleave", () => this.sair()), e.add(this.viewport, "wheel", (i) => this.roda(i), { passive: !1 }), e.add(this.viewport, "contextmenu", (i) => {
1224
1224
  this.ferramentas.emAndamento && i.preventDefault();
1225
- }), a.add(e, "pointerdown", (i) => this.puxarGuia(i, "horizontal")), a.add(r, "pointerdown", (i) => this.puxarGuia(i, "vertical"));
1225
+ }), e.add(a, "pointerdown", (i) => this.puxarGuia(i, "horizontal")), e.add(r, "pointerdown", (i) => this.puxarGuia(i, "vertical"));
1226
1226
  }
1227
1227
  get ocupado() {
1228
1228
  return this.gesto.tipo !== "nenhum" || this.ferramentas.emAndamento;
1229
1229
  }
1230
- local(a) {
1230
+ local(e) {
1231
1231
  var r, i;
1232
- const e = (i = (r = this.viewport).getBoundingClientRect) == null ? void 0 : i.call(r);
1233
- return [a.clientX - ((e == null ? void 0 : e.left) ?? 0), a.clientY - ((e == null ? void 0 : e.top) ?? 0)];
1232
+ const a = (i = (r = this.viewport).getBoundingClientRect) == null ? void 0 : i.call(r);
1233
+ return [e.clientX - ((a == null ? void 0 : a.left) ?? 0), e.clientY - ((a == null ? void 0 : a.top) ?? 0)];
1234
1234
  }
1235
- mod(a) {
1236
- return { shift: a.shiftKey, alt: a.altKey, ctrl: a.ctrlKey || a.metaKey, toque: a.pointerType === "touch" };
1235
+ mod(e) {
1236
+ return { shift: e.shiftKey, alt: e.altKey, ctrl: e.ctrlKey || e.metaKey, toque: e.pointerType === "touch" };
1237
1237
  }
1238
- capturar(a) {
1239
- var e, r;
1238
+ capturar(e) {
1239
+ var a, r;
1240
1240
  try {
1241
- (r = (e = this.viewport).setPointerCapture) == null || r.call(e, a.pointerId);
1241
+ (r = (a = this.viewport).setPointerCapture) == null || r.call(a, e.pointerId);
1242
1242
  } catch {
1243
1243
  }
1244
1244
  }
1245
- cursor(a) {
1246
- this.viewport.dataset.cursor !== a && (this.viewport.dataset.cursor = a);
1245
+ cursor(e) {
1246
+ this.viewport.dataset.cursor !== e && (this.viewport.dataset.cursor = e);
1247
1247
  }
1248
- guiaSob(a) {
1249
- const e = this.c.vista;
1248
+ guiaSob(e) {
1249
+ const a = this.c.vista;
1250
1250
  for (let r = this.c.guias.length - 1; r >= 0; r--) {
1251
1251
  const i = this.c.guias[r];
1252
- if ((i.orientacao === "horizontal" ? Math.abs(e.paraTela([0, i.posicao])[1] - a[1]) : Math.abs(e.paraTela([i.posicao, 0])[0] - a[0])) <= oi) return r;
1252
+ if ((i.orientacao === "horizontal" ? Math.abs(a.paraTela([0, i.posicao])[1] - e[1]) : Math.abs(a.paraTela([i.posicao, 0])[0] - e[0])) <= vi) return r;
1253
1253
  }
1254
1254
  return null;
1255
1255
  }
1256
- pressionar(a) {
1257
- if (a.button === 2) return;
1256
+ pressionar(e) {
1257
+ if (e.button === 2) return;
1258
1258
  try {
1259
1259
  this.viewport.focus({ preventScroll: !0 });
1260
1260
  } catch {
1261
1261
  }
1262
- const e = this.local(a), r = this.c.vista.paraFolha(e[0], e[1]), i = this.mod(a), o = this.c.ferramenta;
1263
- if (this.capturar(a), a.button === 1 || this.espaco || o === "mao") {
1264
- this.gesto = { tipo: "pan", inicioPx: e, panInicial: [...this.c.vista.pan] }, this.cursor("arrastando");
1262
+ const a = this.local(e), r = this.c.vista.paraFolha(a[0], a[1]), i = this.mod(e), o = this.c.ferramenta;
1263
+ if (this.capturar(e), e.button === 1 || this.espaco || o === "mao") {
1264
+ this.gesto = { tipo: "pan", inicioPx: a, panInicial: [...this.c.vista.pan] }, this.cursor("arrastando");
1265
1265
  return;
1266
1266
  }
1267
- if (ti(o)) {
1268
- ii(this.c, r, i.toque);
1267
+ if (fi(o)) {
1268
+ gi(this.c, r, i.toque);
1269
1269
  return;
1270
1270
  }
1271
- if (na(o)) {
1271
+ if (ca(o)) {
1272
1272
  if (this.c.somenteLeitura) {
1273
1273
  this.c.recusar("desenhar", "somente-leitura");
1274
1274
  return;
1275
1275
  }
1276
- this.gesto = { tipo: "desenho" }, this.ferramentas.pressionar(r, e, i);
1276
+ this.gesto = { tipo: "desenho" }, this.ferramentas.pressionar(r, a, i);
1277
1277
  return;
1278
1278
  }
1279
- const s = Date.now(), n = !i.shift && !!this.ultimoClique && s - this.ultimoClique.t <= 400 && Math.hypot(e[0] - this.ultimoClique.x, e[1] - this.ultimoClique.y) <= 4;
1280
- if (this.ultimoClique = n ? null : { t: s, x: e[0], y: e[1] }, o === "selecao-direta" && this.c.ui.edicao) {
1281
- const u = $a(this.c, e, i.toque), f = this.c.doc.obter(this.c.ui.edicao.id);
1279
+ const s = Date.now(), n = !i.shift && !!this.ultimoClique && s - this.ultimoClique.t <= 400 && Math.hypot(a[0] - this.ultimoClique.x, a[1] - this.ultimoClique.y) <= 4;
1280
+ if (this.ultimoClique = n ? null : { t: s, x: a[0], y: a[1] }, o === "selecao-direta" && this.c.ui.edicao) {
1281
+ const u = Ka(this.c, a, i.toque), f = this.c.doc.obter(this.c.ui.edicao.id);
1282
1282
  if (u && f && !this.c.somenteLeitura) {
1283
1283
  const p = this.c.ui.edicao;
1284
- u.tipo === "alca" ? this.gesto = { tipo: "selecao", gesto: { tipo: "alca-bezier", original: f, indice: u.indice, qual: u.qual }, inicioPx: e, moveu: !1 } : (i.shift ? p.ancoras = p.ancoras.includes(u.indice) ? p.ancoras.filter((v) => v !== u.indice) : [...p.ancoras, u.indice] : p.ancoras.includes(u.indice) || (p.ancoras = [u.indice]), this.gesto = { tipo: "selecao", gesto: { tipo: "ancora", original: f, indice: u.indice, inicio: r }, inicioPx: e, moveu: !1 }), this.c.agendar();
1284
+ u.tipo === "alca" ? this.gesto = { tipo: "selecao", gesto: { tipo: "alca-bezier", original: f, indice: u.indice, qual: u.qual }, inicioPx: a, moveu: !1 } : (i.shift ? p.ancoras = p.ancoras.includes(u.indice) ? p.ancoras.filter((v) => v !== u.indice) : [...p.ancoras, u.indice] : p.ancoras.includes(u.indice) || (p.ancoras = [u.indice]), this.gesto = { tipo: "selecao", gesto: { tipo: "ancora", original: f, indice: u.indice, inicio: r }, inicioPx: a, moveu: !1 }), this.c.agendar();
1285
1285
  return;
1286
1286
  }
1287
1287
  }
1288
1288
  if (o === "selecao" && !this.c.somenteLeitura) {
1289
- const u = Ha(this.c, e, i.toque);
1289
+ const u = Va(this.c, a, i.toque);
1290
1290
  if (u) {
1291
- const f = Xr(this.c, u, r, i);
1291
+ const f = si(this.c, u, r, i);
1292
1292
  if (f) {
1293
- this.gesto = { tipo: "selecao", gesto: f, inicioPx: e, moveu: !1 };
1293
+ this.gesto = { tipo: "selecao", gesto: f, inicioPx: a, moveu: !1 };
1294
1294
  return;
1295
1295
  }
1296
1296
  }
1297
1297
  }
1298
- const l = (i.toque ? 12 : 4) / this.c.vista.zoom, c = this.c.candidatosEm(r, l + 2).filter((u) => this.c.podeSelecionar(u)), d = oa(r, c, { tolerancia: l, camadas: this.c.camadas });
1298
+ const l = (i.toque ? 12 : 4) / this.c.vista.zoom, c = this.c.candidatosEm(r, l + 2).filter((u) => this.c.podeSelecionar(u)), d = na(r, c, { tolerancia: l, camadas: this.c.camadas });
1299
1299
  if (d) {
1300
1300
  if (n && o === "selecao") {
1301
1301
  if (d.grupoId && this.c.isolado !== d.grupoId) {
@@ -1306,35 +1306,35 @@ class si {
1306
1306
  return;
1307
1307
  }
1308
1308
  if (o === "selecao-direta" ? this.c.iniciarEdicao(d.id) : i.shift ? this.c.selecionar([d.id], "alternar") : this.c.doc.selecao.includes(d.id) || this.c.selecionar([d.id]), this.c.somenteLeitura || !this.c.doc.selecao.includes(d.id)) return;
1309
- const u = Jr(this.c, r, i.toque, i.alt && o === "selecao");
1310
- u && (this.gesto = { tipo: "selecao", gesto: u, inicioPx: e, moveu: !1 });
1309
+ const u = ci(this.c, r, i.toque, i.alt && o === "selecao");
1310
+ u && (this.gesto = { tipo: "selecao", gesto: u, inicioPx: a, moveu: !1 });
1311
1311
  return;
1312
1312
  }
1313
1313
  if (n && this.c.isolado) {
1314
1314
  this.c.isolar(null);
1315
1315
  return;
1316
1316
  }
1317
- const h = o === "selecao" && !this.c.somenteLeitura ? this.guiaSob(e) : null;
1317
+ const h = o === "selecao" && !this.c.somenteLeitura ? this.guiaSob(a) : null;
1318
1318
  if (h !== null) {
1319
1319
  this.gesto = { tipo: "guia", indice: h }, this.c.ui.guiaArrastada = { guia: { ...this.c.guias[h] }, indice: h };
1320
1320
  return;
1321
1321
  }
1322
- this.gesto = { tipo: "caixa", de: r, dePx: e, aditivo: i.shift, moveu: !1 };
1322
+ this.gesto = { tipo: "caixa", de: r, dePx: a, aditivo: i.shift, moveu: !1 };
1323
1323
  }
1324
- mover(a) {
1325
- const e = this.local(a), r = this.c.vista.paraFolha(e[0], e[1]), i = this.mod(a);
1324
+ mover(e) {
1325
+ const a = this.local(e), r = this.c.vista.paraFolha(a[0], a[1]), i = this.mod(e);
1326
1326
  this.c.ui.ponteiro = r, this.c.emitir("prancha-ponteiro", { coordenada: r });
1327
1327
  const o = this.gesto;
1328
1328
  switch (o.tipo) {
1329
1329
  case "pan":
1330
- this.c.vista.pan = [o.panInicial[0] + e[0] - o.inicioPx[0], o.panInicial[1] + e[1] - o.inicioPx[1]], this.c.emitirVista();
1330
+ this.c.vista.pan = [o.panInicial[0] + a[0] - o.inicioPx[0], o.panInicial[1] + a[1] - o.inicioPx[1]], this.c.emitirVista();
1331
1331
  return;
1332
1332
  case "desenho":
1333
- this.ferramentas.mover(r, e, i);
1333
+ this.ferramentas.mover(r, a, i);
1334
1334
  return;
1335
1335
  case "selecao":
1336
- if (!o.moveu && Math.hypot(e[0] - o.inicioPx[0], e[1] - o.inicioPx[1]) < Ba) return;
1337
- o.moveu = !0, Qr(this.c, o.gesto, r, i);
1336
+ if (!o.moveu && Math.hypot(a[0] - o.inicioPx[0], a[1] - o.inicioPx[1]) < Wa) return;
1337
+ o.moveu = !0, ui(this.c, o.gesto, r, i);
1338
1338
  return;
1339
1339
  case "guia": {
1340
1340
  const s = this.c.ui.guiaArrastada;
@@ -1342,31 +1342,31 @@ class si {
1342
1342
  return;
1343
1343
  }
1344
1344
  case "caixa":
1345
- if (!o.moveu && Math.hypot(e[0] - o.dePx[0], e[1] - o.dePx[1]) < Ba) return;
1345
+ if (!o.moveu && Math.hypot(a[0] - o.dePx[0], a[1] - o.dePx[1]) < Wa) return;
1346
1346
  o.moveu = !0, this.c.ui.caixaSelecao = { de: o.de, ate: r, crossing: r[0] < o.de[0] }, this.c.agendar();
1347
1347
  return;
1348
1348
  }
1349
- if (na(this.c.ferramenta)) {
1350
- this.ferramentas.mover(r, e, i), this.cursor("mira");
1349
+ if (ca(this.c.ferramenta)) {
1350
+ this.ferramentas.mover(r, a, i), this.cursor("mira");
1351
1351
  return;
1352
1352
  }
1353
- this.atualizarHover(r, e, i.toque);
1353
+ this.atualizarHover(r, a, i.toque);
1354
1354
  }
1355
- atualizarHover(a, e, r) {
1355
+ atualizarHover(e, a, r) {
1356
1356
  const i = this.c.ferramenta;
1357
1357
  if (i === "mao" || this.espaco) {
1358
1358
  this.cursor("mao");
1359
1359
  return;
1360
1360
  }
1361
- const o = i === "selecao" ? Ha(this.c, e, r) : null, s = 4 / this.c.vista.zoom, n = oa(a, this.c.candidatosEm(a, s + 2).filter((c) => this.c.podeSelecionar(c)), { tolerancia: s, camadas: this.c.camadas }), l = (n == null ? void 0 : n.id) ?? null;
1362
- this.cursor(o ? o.tipo === "rotacao" ? "girar" : "mover" : i === "selecao-direta" && $a(this.c, e, r) ? "ancora" : n ? "mover" : "padrao"), l !== this.c.ui.hoverId ? (this.c.ui.hoverId = l, this.c.agendar()) : this.c.ui.ponteiro && this.c.agendar();
1361
+ const o = i === "selecao" ? Va(this.c, a, r) : null, s = 4 / this.c.vista.zoom, n = na(e, this.c.candidatosEm(e, s + 2).filter((c) => this.c.podeSelecionar(c)), { tolerancia: s, camadas: this.c.camadas }), l = (n == null ? void 0 : n.id) ?? null;
1362
+ this.cursor(o ? o.tipo === "rotacao" ? "girar" : "mover" : i === "selecao-direta" && Ka(this.c, a, r) ? "ancora" : n ? "mover" : "padrao"), l !== this.c.ui.hoverId ? (this.c.ui.hoverId = l, this.c.agendar()) : this.c.ui.ponteiro && this.c.agendar();
1363
1363
  }
1364
- soltar(a) {
1364
+ soltar(e) {
1365
1365
  var o, s;
1366
- const e = this.local(a), r = this.c.vista.paraFolha(e[0], e[1]), i = this.gesto;
1366
+ const a = this.local(e), r = this.c.vista.paraFolha(a[0], a[1]), i = this.gesto;
1367
1367
  this.gesto = { tipo: "nenhum" };
1368
1368
  try {
1369
- (s = (o = this.viewport).releasePointerCapture) == null || s.call(o, a.pointerId);
1369
+ (s = (o = this.viewport).releasePointerCapture) == null || s.call(o, e.pointerId);
1370
1370
  } catch {
1371
1371
  }
1372
1372
  switch (i.tipo) {
@@ -1374,13 +1374,13 @@ class si {
1374
1374
  this.cursor(this.espaco || this.c.ferramenta === "mao" ? "mao" : "padrao");
1375
1375
  return;
1376
1376
  case "desenho":
1377
- this.ferramentas.soltar(r, e, this.mod(a));
1377
+ this.ferramentas.soltar(r, a, this.mod(e));
1378
1378
  return;
1379
1379
  case "selecao":
1380
- i.moveu ? Yr(this.c, i.gesto) : this.c.agendar();
1380
+ i.moveu ? di(this.c, i.gesto) : this.c.agendar();
1381
1381
  return;
1382
1382
  case "guia":
1383
- this.soltarGuia(i.indice, e);
1383
+ this.soltarGuia(i.indice, a);
1384
1384
  return;
1385
1385
  case "caixa":
1386
1386
  this.soltarCaixa(i, r);
@@ -1389,96 +1389,96 @@ class si {
1389
1389
  return;
1390
1390
  }
1391
1391
  }
1392
- soltarCaixa(a, e) {
1393
- if (this.c.ui.caixaSelecao = null, !a.moveu) {
1394
- this.c.ui.edicao && this.c.ferramenta === "selecao-direta" && this.c.encerrarEdicao(), a.aditivo || this.c.selecionar([]), this.c.agendar();
1392
+ soltarCaixa(e, a) {
1393
+ if (this.c.ui.caixaSelecao = null, !e.moveu) {
1394
+ this.c.ui.edicao && this.c.ferramenta === "selecao-direta" && this.c.encerrarEdicao(), e.aditivo || this.c.selecionar([]), this.c.agendar();
1395
1395
  return;
1396
1396
  }
1397
1397
  if (this.c.ferramenta === "selecao-direta" && this.c.ui.edicao) {
1398
- this.c.ui.edicao.ancoras = ai(this.c, a.de, e), this.c.agendar();
1398
+ this.c.ui.edicao.ancoras = hi(this.c, e.de, a), this.c.agendar();
1399
1399
  return;
1400
1400
  }
1401
- const r = { x: Math.min(a.de[0], e[0]), y: Math.min(a.de[1], e[1]), largura: Math.abs(e[0] - a.de[0]), altura: Math.abs(e[1] - a.de[1]) }, i = e[0] < a.de[0] ? "crossing" : "window", o = this.c.doc.indice.consultarCaixa(r).filter((n) => this.c.podeSelecionar(n)), s = Gt(r, o, i, { camadas: this.c.camadas }).map((n) => n.id);
1402
- this.c.selecionar(s, a.aditivo ? "adicionar" : "substituir") || this.c.agendar();
1401
+ const r = { x: Math.min(e.de[0], a[0]), y: Math.min(e.de[1], a[1]), largura: Math.abs(a[0] - e.de[0]), altura: Math.abs(a[1] - e.de[1]) }, i = a[0] < e.de[0] ? "crossing" : "window", o = this.c.doc.indice.consultarCaixa(r).filter((n) => this.c.podeSelecionar(n)), s = Qt(r, o, i, { camadas: this.c.camadas }).map((n) => n.id);
1402
+ this.c.selecionar(s, e.aditivo ? "adicionar" : "substituir") || this.c.agendar();
1403
1403
  }
1404
- puxarGuia(a, e) {
1405
- if (a.button !== 0 || this.c.somenteLeitura) return;
1406
- const r = this.local(a), i = this.c.vista.paraFolha(r[0], r[1]);
1407
- this.capturar(a), this.gesto = { tipo: "guia", indice: null }, this.c.ui.guiaArrastada = { guia: { orientacao: e, posicao: e === "horizontal" ? i[1] : i[0] }, indice: null }, this.c.agendar();
1404
+ puxarGuia(e, a) {
1405
+ if (e.button !== 0 || this.c.somenteLeitura) return;
1406
+ const r = this.local(e), i = this.c.vista.paraFolha(r[0], r[1]);
1407
+ this.capturar(e), this.gesto = { tipo: "guia", indice: null }, this.c.ui.guiaArrastada = { guia: { orientacao: a, posicao: a === "horizontal" ? i[1] : i[0] }, indice: null }, this.c.agendar();
1408
1408
  }
1409
- soltarGuia(a, e) {
1409
+ soltarGuia(e, a) {
1410
1410
  const r = this.c.ui.guiaArrastada;
1411
1411
  if (this.c.ui.guiaArrastada = null, !r) return;
1412
- const i = r.guia.orientacao === "horizontal" ? e[1] < 0 : e[0] < 0;
1413
- a === null ? i || (this.c.guias = [...this.c.guias, r.guia]) : i ? this.c.guias = this.c.guias.filter((o, s) => s !== a) : this.c.guias = this.c.guias.map((o, s) => s === a ? r.guia : o), this.c.emitirGuias();
1412
+ const i = r.guia.orientacao === "horizontal" ? a[1] < 0 : a[0] < 0;
1413
+ e === null ? i || (this.c.guias = [...this.c.guias, r.guia]) : i ? this.c.guias = this.c.guias.filter((o, s) => s !== e) : this.c.guias = this.c.guias.map((o, s) => s === e ? r.guia : o), this.c.emitirGuias();
1414
1414
  }
1415
- roda(a) {
1416
- a.preventDefault();
1417
- const e = this.local(a), r = a.deltaMode === 1 ? a.deltaY * 16 : a.deltaY;
1418
- if (a.shiftKey && !a.ctrlKey) {
1415
+ roda(e) {
1416
+ e.preventDefault();
1417
+ const a = this.local(e), r = e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;
1418
+ if (e.shiftKey && !e.ctrlKey) {
1419
1419
  this.c.vista.deslocar(-r, 0), this.c.emitirVista();
1420
1420
  return;
1421
1421
  }
1422
- this.c.vista.zoomRelativo(Math.exp(-r * 15e-4), e) && (this.c.emitirVista(), this.c.anunciar(sa(this.c.vista.zoomPercentual)));
1422
+ this.c.vista.zoomRelativo(Math.exp(-r * 15e-4), a) && (this.c.emitirVista(), this.c.anunciar(la(this.c.vista.zoomPercentual)));
1423
1423
  }
1424
1424
  sair() {
1425
1425
  this.gesto.tipo === "nenhum" && (this.c.ui.ponteiro = null, this.c.ui.hoverId = null, this.c.ui.snap = null, this.c.emitir("prancha-ponteiro", { coordenada: null }), this.c.agendar());
1426
1426
  }
1427
1427
  /** Cancela qualquer gesto (Esc, perda de ponteiro): nada muda no documento. */
1428
1428
  cancelar() {
1429
- this.gesto = { tipo: "nenhum" }, this.ferramentas.cancelar(), j(this.c.ui), this.c.agendar();
1429
+ this.gesto = { tipo: "nenhum" }, this.ferramentas.cancelar(), V(this.c.ui), this.c.agendar();
1430
1430
  }
1431
1431
  }
1432
- function ni(t, a = 50) {
1432
+ function yi(t, e = 50) {
1433
1433
  if (!(t > 0) || !Number.isFinite(t)) return 1;
1434
- const e = a / t, r = 10 ** Math.floor(Math.log10(e));
1435
- for (const i of [1, 2, 5, 10]) if (i * r >= e) return i * r;
1434
+ const a = e / t, r = 10 ** Math.floor(Math.log10(a));
1435
+ for (const i of [1, 2, 5, 10]) if (i * r >= a) return i * r;
1436
1436
  return 10 * r;
1437
1437
  }
1438
- function li(t, a) {
1439
- const { vista: e, cores: r, comprimento: i, espessura: o } = a, s = a.orientacao === "horizontal";
1440
- t.save(), t.setTransform(e.dpr, 0, 0, e.dpr, 0, 0), t.globalAlpha = 1, t.fillStyle = r.regua, t.fillRect(0, 0, s ? i : o, s ? o : i);
1441
- const n = 1 / Ht(1, a.unidade), l = e.zoom * n, c = ni(l), d = c / (c * l >= 100 ? 10 : 5), h = (s ? e.pan[0] : e.pan[1]) + a.deslocamento, u = Math.floor(-h / l / d) * d, f = (i - h) / l;
1438
+ function Ai(t, e) {
1439
+ const { vista: a, cores: r, comprimento: i, espessura: o } = e, s = e.orientacao === "horizontal";
1440
+ t.save(), t.setTransform(a.dpr, 0, 0, a.dpr, 0, 0), t.globalAlpha = 1, t.fillStyle = r.regua, t.fillRect(0, 0, s ? i : o, s ? o : i);
1441
+ const n = 1 / Yt(1, e.unidade), l = a.zoom * n, c = yi(l), d = c / (c * l >= 100 ? 10 : 5), h = (s ? a.pan[0] : a.pan[1]) + e.deslocamento, u = Math.floor(-h / l / d) * d, f = (i - h) / l;
1442
1442
  t.beginPath();
1443
1443
  const p = [];
1444
1444
  for (let v = u, b = 0; v <= f && b < 5e3; v += d, b++) {
1445
- const M = Math.round(h + v * l) + 0.5, x = Math.abs(v / c - Math.round(v / c)) < 1e-6, C = x ? o : o * 0.3;
1446
- s ? (t.moveTo(M, o), t.lineTo(M, o - C)) : (t.moveTo(o, M), t.lineTo(o - C, M)), x && p.push([String(Math.round(v * 1e3) / 1e3), M]);
1445
+ const M = Math.round(h + v * l) + 0.5, C = Math.abs(v / c - Math.round(v / c)) < 1e-6, T = C ? o : o * 0.3;
1446
+ s ? (t.moveTo(M, o), t.lineTo(M, o - T)) : (t.moveTo(o, M), t.lineTo(o - T, M)), C && p.push([String(Math.round(v * 1e3) / 1e3), M]);
1447
1447
  }
1448
1448
  if (t.strokeStyle = r.textoRegua, t.lineWidth = 1, t.setLineDash([]), t.stroke(), typeof t.fillText == "function") {
1449
1449
  t.font = "9px sans-serif", t.fillStyle = r.textoRegua;
1450
1450
  for (const [v, b] of p)
1451
1451
  s ? t.fillText(v, b + 2, 9) : t.fillText(v, 1, b + 10);
1452
1452
  }
1453
- if (a.ponteiro) {
1454
- const v = e.paraTela(a.ponteiro), b = Math.round((s ? v[0] : v[1]) + a.deslocamento) + 0.5;
1453
+ if (e.ponteiro) {
1454
+ const v = a.paraTela(e.ponteiro), b = Math.round((s ? v[0] : v[1]) + e.deslocamento) + 0.5;
1455
1455
  t.beginPath(), s ? (t.moveTo(b, 0), t.lineTo(b, o)) : (t.moveTo(0, b), t.lineTo(o, b)), t.strokeStyle = r.selecao, t.stroke();
1456
1456
  }
1457
1457
  t.restore();
1458
1458
  }
1459
- const Ka = (t) => {
1460
- var a;
1459
+ const Ua = (t) => {
1460
+ var e;
1461
1461
  try {
1462
- return ((a = t.getContext) == null ? void 0 : a.call(t, "2d")) ?? null;
1462
+ return ((e = t.getContext) == null ? void 0 : e.call(t, "2d")) ?? null;
1463
1463
  } catch {
1464
1464
  return null;
1465
1465
  }
1466
1466
  };
1467
- class ci {
1468
- constructor(a, e, r) {
1467
+ class Si {
1468
+ constructor(e, a, r) {
1469
1469
  m(this, "pedido", null);
1470
1470
  m(this, "contextos", /* @__PURE__ */ new Map());
1471
1471
  m(this, "ultimaBase", { elementos: null, texto: "" });
1472
1472
  m(this, "quadros", 0);
1473
1473
  m(this, "pinturasBase", 0);
1474
- this.c = a, this.cv = e, this.fabrica = r;
1474
+ this.c = e, this.cv = a, this.fabrica = r;
1475
1475
  }
1476
1476
  /** Esquece os contextos (a fábrica mudou) e força a próxima pintura da base. */
1477
1477
  reiniciar() {
1478
1478
  this.contextos.clear(), this.ultimaBase = { elementos: null, texto: "" };
1479
1479
  }
1480
- ctx(a, e) {
1481
- return this.contextos.has(a) || this.contextos.set(a, this.fabrica()(e, a)), this.contextos.get(a) ?? null;
1480
+ ctx(e, a) {
1481
+ return this.contextos.has(e) || this.contextos.set(e, this.fabrica()(a, e)), this.contextos.get(e) ?? null;
1482
1482
  }
1483
1483
  agendar() {
1484
1484
  this.pedido || (typeof requestAnimationFrame == "function" ? this.pedido = { tipo: "raf", id: requestAnimationFrame(() => {
@@ -1490,43 +1490,43 @@ class ci {
1490
1490
  cancelar() {
1491
1491
  this.pedido && (this.pedido.tipo === "raf" && typeof cancelAnimationFrame == "function" ? cancelAnimationFrame(this.pedido.id) : clearTimeout(this.pedido.id), this.pedido = null);
1492
1492
  }
1493
- ajustar(a, e, r, i) {
1494
- const o = Math.max(0, Math.round(e * i)), s = Math.max(0, Math.round(r * i));
1495
- return a.width === o && a.height === s ? !1 : (a.width = o, a.height = s, !0);
1493
+ ajustar(e, a, r, i) {
1494
+ const o = Math.max(0, Math.round(a * i)), s = Math.max(0, Math.round(r * i));
1495
+ return e.width === o && e.height === s ? !1 : (e.width = o, e.height = s, !0);
1496
1496
  }
1497
1497
  /** Mede a área de desenho; devolve se o tamanho mudou. */
1498
1498
  medir() {
1499
- const a = this.c.vista, e = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, r = `${a.largura}x${a.altura}@${a.dpr}`;
1500
- a.redimensionar(this.cv.viewport.clientWidth || 0, this.cv.viewport.clientHeight || 0, e);
1501
- const i = r !== `${a.largura}x${a.altura}@${a.dpr}`;
1499
+ const e = this.c.vista, a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, r = `${e.largura}x${e.altura}@${e.dpr}`;
1500
+ e.redimensionar(this.cv.viewport.clientWidth || 0, this.cv.viewport.clientHeight || 0, a);
1501
+ const i = r !== `${e.largura}x${e.altura}@${e.dpr}`;
1502
1502
  return i && (this.ultimaBase = { elementos: null, texto: "" }), i;
1503
1503
  }
1504
1504
  /** Pinta agora (o que estiver agendado é descartado). */
1505
1505
  pintar() {
1506
1506
  this.cancelar(), this.quadros++;
1507
- const a = this.c, e = a.vista;
1508
- if (e.largura <= 0 || e.altura <= 0) return;
1509
- const r = this.ajustar(this.cv.base, e.largura, e.altura, e.dpr);
1510
- this.ajustar(this.cv.sobreposicao, e.largura, e.altura, e.dpr);
1511
- const i = a.elementosVisiveis(), o = [
1512
- e.zoom,
1513
- e.pan[0],
1514
- e.pan[1],
1515
- e.largura,
1516
- e.altura,
1517
- e.dpr,
1518
- a.folha.largura,
1519
- a.folha.altura,
1520
- a.mostrarGrade ? a.grade : 0,
1521
- Object.values(a.cores).join(),
1522
- JSON.stringify(a.camadas),
1523
- a.isolado ?? "",
1524
- JSON.stringify(a.margens)
1507
+ const e = this.c, a = e.vista;
1508
+ if (a.largura <= 0 || a.altura <= 0) return;
1509
+ const r = this.ajustar(this.cv.base, a.largura, a.altura, a.dpr);
1510
+ this.ajustar(this.cv.sobreposicao, a.largura, a.altura, a.dpr);
1511
+ const i = e.elementosVisiveis(), o = [
1512
+ a.zoom,
1513
+ a.pan[0],
1514
+ a.pan[1],
1515
+ a.largura,
1516
+ a.altura,
1517
+ a.dpr,
1518
+ e.folha.largura,
1519
+ e.folha.altura,
1520
+ e.mostrarGrade ? e.grade : 0,
1521
+ Object.values(e.cores).join(),
1522
+ JSON.stringify(e.camadas),
1523
+ e.isolado ?? "",
1524
+ JSON.stringify(e.margens)
1525
1525
  ].join("|"), s = this.ctx("base", this.cv.base);
1526
1526
  if (s && (r || i !== this.ultimaBase.elementos || o !== this.ultimaBase.texto)) {
1527
1527
  try {
1528
- const l = a.isolado ? i.filter((c) => c.grupoId === a.isolado) : null;
1529
- Kr(s, { vista: e, folha: a.folha, cores: a.cores, elementos: i, grade: a.mostrarGrade ? a.grade : null, camadas: a.camadas, isolados: l, margens: a.margens ? me(a.folha.largura, a.folha.altura, a.margens) : null }), this.pinturasBase++;
1528
+ const l = e.isolado ? i.filter((c) => c.grupoId === e.isolado) : null;
1529
+ ri(s, { vista: a, folha: e.folha, cores: e.cores, elementos: i, grade: e.mostrarGrade ? e.grade : null, camadas: e.camadas, isolados: l, margens: e.margens ? ve(e.folha.largura, e.folha.altura, e.margens) : null }), this.pinturasBase++;
1530
1530
  } catch {
1531
1531
  }
1532
1532
  this.ultimaBase = { elementos: i, texto: o };
@@ -1534,33 +1534,33 @@ class ci {
1534
1534
  const n = this.ctx("sobreposicao", this.cv.sobreposicao);
1535
1535
  if (n)
1536
1536
  try {
1537
- const l = a.ui.hoverId ? a.doc.obter(a.ui.hoverId) ?? null : null, c = a.doc.elementosSelecionados().map((d) => a.ui.substitutos.get(d.id) ?? d);
1538
- Vr(n, { vista: e, cores: a.cores, ui: a.ui, selecionados: c, emGesto: a.elementosEmGesto(), hover: l, guias: a.guias, caixaTransformacao: a.ferramenta === "selecao", marcasCantos: _e(a) });
1537
+ const l = e.ui.hoverId ? e.doc.obter(e.ui.hoverId) ?? null : null, c = e.doc.elementosSelecionados().map((d) => e.ui.substitutos.get(d.id) ?? d);
1538
+ ii(n, { vista: a, cores: e.cores, ui: e.ui, selecionados: c, emGesto: e.elementosEmGesto(), hover: l, guias: e.guias, caixaTransformacao: e.ferramenta === "selecao", marcasCantos: Le(e) });
1539
1539
  } catch {
1540
1540
  }
1541
1541
  this.pintarReguas();
1542
1542
  }
1543
1543
  pintarReguas() {
1544
- const a = this.c;
1545
- for (const [e, r, i] of [["regua-horizontal", this.cv.reguaH, "horizontal"], ["regua-vertical", this.cv.reguaV, "vertical"]]) {
1544
+ const e = this.c;
1545
+ for (const [a, r, i] of [["regua-horizontal", this.cv.reguaH, "horizontal"], ["regua-vertical", this.cv.reguaV, "vertical"]]) {
1546
1546
  const o = i === "horizontal" ? r.clientWidth : r.clientHeight, s = i === "horizontal" ? r.clientHeight : r.clientWidth;
1547
1547
  if (!(o > 0 && s > 0)) continue;
1548
- this.ajustar(r, i === "horizontal" ? o : s, i === "horizontal" ? s : o, a.vista.dpr);
1549
- const n = this.ctx(e, r);
1548
+ this.ajustar(r, i === "horizontal" ? o : s, i === "horizontal" ? s : o, e.vista.dpr);
1549
+ const n = this.ctx(a, r);
1550
1550
  if (n)
1551
1551
  try {
1552
- li(n, { orientacao: i, vista: a.vista, unidade: a.unidade, comprimento: o, espessura: s, cores: a.cores, ponteiro: a.ui.ponteiro, deslocamento: 0 });
1552
+ Ai(n, { orientacao: i, vista: e.vista, unidade: e.unidade, comprimento: o, espessura: s, cores: e.cores, ponteiro: e.ui.ponteiro, deslocamento: 0 });
1553
1553
  } catch {
1554
1554
  }
1555
1555
  }
1556
1556
  }
1557
1557
  }
1558
- function L(t, a) {
1559
- if (!$t.includes(a))
1558
+ function q(t, e) {
1559
+ if (!ar.includes(e))
1560
1560
  return t.recusar("pathfinder", "comando-desconhecido"), !1;
1561
- const e = y(t, "pathfinder", 2);
1562
- if (!e) return !1;
1563
- const r = Bt($(e, t.camadas), a);
1561
+ const a = y(t, "pathfinder", 2);
1562
+ if (!a) return !1;
1563
+ const r = er(U(a, t.camadas), e);
1564
1564
  if (!("ok" in r)) {
1565
1565
  const n = r.motivo === "sem-intersecao" || r.motivo === "resultado-vazio";
1566
1566
  return t.recusar("pathfinder", n ? "resultado-vazio" : "tipo-nao-suportado"), !1;
@@ -1568,26 +1568,54 @@ function L(t, a) {
1568
1568
  const { resultado: i, usados: o } = r.ok, s = new Set(o.filter((n) => n !== i.id));
1569
1569
  return t.aplicar(t.doc.elementos.filter((n) => !s.has(n.id)).map((n) => n.id === i.id ? i : n), "pathfinder"), t.selecionar([i.id]), !0;
1570
1570
  }
1571
- const ke = /* @__PURE__ */ new WeakSet(), Va = /* @__PURE__ */ new WeakSet(), Ji = (t) => !!t && ke.has(t);
1572
- function ui(t) {
1573
- ke.add(t);
1571
+ const qe = /* @__PURE__ */ new WeakSet(), Xa = /* @__PURE__ */ new WeakSet(), bo = (t) => !!t && qe.has(t);
1572
+ function Pi(t) {
1573
+ qe.add(t);
1574
1574
  }
1575
- const Aa = (t) => t === "exclusivo" || t === "isolado" ? t : "local";
1576
- function di(t) {
1575
+ const j = (t) => t === "exclusivo" || t === "isolado" || t === "modal" ? t : "local";
1576
+ function Be(t) {
1577
1577
  if (!t || typeof t != "object") return !1;
1578
- const a = typeof t.key == "string" ? t.key : "";
1579
- if (a === "F5" || a === "F11" || a === "F12" || a === "Tab") return !0;
1578
+ const e = typeof t.key == "string" ? t.key : "";
1579
+ if (e === "F5" || e === "F11" || e === "F12" || e === "Tab") return !0;
1580
1580
  if (!(t.ctrlKey || t.metaKey) || t.altKey) return !1;
1581
- const r = a.length === 1 ? a.toLowerCase() : a;
1581
+ const r = e.length === 1 ? e.toLowerCase() : e;
1582
1582
  return !!(t.shiftKey && (r === "i" || r === "j") || r === "r" || r === "l" || r === "w" || r === "t" || (r === "+" || r === "=" || r === "-" || r === "0") && !t.defaultPrevented);
1583
1583
  }
1584
- function Le(t, a, e) {
1585
- for (const r of ["keydown", "keyup", "keypress"])
1586
- t.add(a, r, (i) => {
1587
- e() && !di(i) && i.stopPropagation();
1588
- });
1584
+ const je = ["keydown", "keyup", "keypress"];
1585
+ function Mi(t, e) {
1586
+ const a = typeof t.composedPath == "function" ? t.composedPath() : [];
1587
+ return a.includes(e) ? !0 : a.length === 0 && typeof Node < "u" && e instanceof Node && t.target instanceof Node && e.contains(t.target);
1589
1588
  }
1590
- const Ua = { Digit1: "uniao", Digit2: "subtracao", Digit3: "intersecao", Digit4: "exclusao" }, Xa = {
1589
+ function zi(t, e) {
1590
+ if (typeof Node > "u" || !(t instanceof Node)) return !1;
1591
+ let a = e;
1592
+ for (; a; ) {
1593
+ if (a === t) return !0;
1594
+ a = a.parentNode ?? (typeof ShadowRoot < "u" && a instanceof ShadowRoot ? a.host : null);
1595
+ }
1596
+ return !1;
1597
+ }
1598
+ function xi(t, e) {
1599
+ if (be(t)) return !0;
1600
+ const a = br();
1601
+ return !!a && yr(a) && !zi(e, a);
1602
+ }
1603
+ function Ge(t, e, a) {
1604
+ if (!(!t || !e || typeof a != "function"))
1605
+ for (const r of je)
1606
+ t.add(e, r, (i) => {
1607
+ a() && !Be(i) && i.stopPropagation();
1608
+ });
1609
+ }
1610
+ function He(t, e, a) {
1611
+ if (!(typeof window > "u" || !t || !e || typeof a != "function"))
1612
+ for (const r of je)
1613
+ t.add(window, r, (i) => {
1614
+ var o;
1615
+ !i || !a() || Mi(i, e) || Be(i) || xi(i, e) || (o = i.stopPropagation) == null || o.call(i);
1616
+ }, { capture: !0 });
1617
+ }
1618
+ const Za = { Digit1: "uniao", Digit2: "subtracao", Digit3: "intersecao", Digit4: "exclusao" }, Ja = {
1591
1619
  v: "selecao",
1592
1620
  a: "selecao-direta",
1593
1621
  h: "mao",
@@ -1597,46 +1625,46 @@ const Ua = { Digit1: "uniao", Digit2: "subtracao", Digit3: "intersecao", Digit4:
1597
1625
  "\\": "linha",
1598
1626
  t: "texto"
1599
1627
  };
1600
- function hi(t, a, e, r) {
1601
- if (r.defaultPrevented || nr(r)) return !1;
1628
+ function Ei(t, e, a, r) {
1629
+ if (r.defaultPrevented || be(r)) return !1;
1602
1630
  const i = r.key, o = r.ctrlKey || r.metaKey, s = i.length === 1 ? i.toLowerCase() : i;
1603
1631
  if (i === " " && !o)
1604
- return Fa(r) ? !1 : (a.espaco || (a.espaco = !0, t.agendar()), !0);
1605
- if (a.ferramentas.tecla(i)) return !0;
1632
+ return Ra(r) ? !1 : (e.espaco || (e.espaco = !0, t.agendar()), !0);
1633
+ if (e.ferramentas.tecla(i)) return !0;
1606
1634
  if (o) {
1607
1635
  if (r.shiftKey && !r.altKey && (s === "i" || s === "j")) return !1;
1608
1636
  const l = r.code ?? "";
1609
- return r.altKey && r.shiftKey && l in Ua ? L(t, Ua[l]) || !0 : l === "BracketRight" || i === "]" || i === "}" ? D(t, r.shiftKey ? "frente" : "avancar") || !0 : l === "BracketLeft" || i === "[" || i === "{" ? D(t, r.shiftKey ? "tras" : "recuar") || !0 : s === "g" ? (r.shiftKey ? ze(t) : Me(t)) || !0 : l === "Digit2" || i === "2" ? (r.altKey ? ca(t, "bloqueado") : la(t, "bloqueado")) || !0 : l === "Digit3" || i === "3" ? (r.altKey ? ca(t, "oculto") : la(t, "oculto")) || !0 : l === "Digit7" || i === "7" ? (r.altKey ? we(t) : Te(t)) || !0 : s === "c" && !r.shiftKey ? Ca(t) || !0 : s === "x" ? xe(t) || !0 : s === "v" ? Ce(t, r.shiftKey) || !0 : s === "d" ? Ee(t) || !0 : s === "j" ? Ie(t) || !0 : s === "z" && !r.shiftKey ? (t.desfazer(), !0) : s === "z" && r.shiftKey || s === "y" ? (t.refazer(), !0) : s === "a" ? (Ae(t), !0) : i === "0" ? (e.ajustarFolha(), !0) : i === "1" ? (e.definirZoomPercentual(100), !0) : i === "=" || i === "+" ? (t.vista.zoomRelativo(1.25), t.emitirVista(), t.anunciar(sa(t.vista.zoomPercentual)), !0) : i === "-" ? (t.vista.zoomRelativo(0.8), t.emitirVista(), t.anunciar(sa(t.vista.zoomPercentual)), !0) : !1;
1637
+ return r.altKey && r.shiftKey && l in Za ? q(t, Za[l]) || !0 : l === "BracketRight" || i === "]" || i === "}" ? O(t, r.shiftKey ? "frente" : "avancar") || !0 : l === "BracketLeft" || i === "[" || i === "{" ? O(t, r.shiftKey ? "tras" : "recuar") || !0 : s === "g" ? (r.shiftKey ? we(t) : Te(t)) || !0 : l === "Digit2" || i === "2" ? (r.altKey ? da(t, "bloqueado") : ua(t, "bloqueado")) || !0 : l === "Digit3" || i === "3" ? (r.altKey ? da(t, "oculto") : ua(t, "oculto")) || !0 : l === "Digit7" || i === "7" ? (r.altKey ? Ne(t) : _e(t)) || !0 : s === "c" && !r.shiftKey ? Da(t) || !0 : s === "x" ? Ie(t) || !0 : s === "v" ? Fe(t, r.shiftKey) || !0 : s === "d" ? De(t) || !0 : s === "j" ? Oe(t) || !0 : s === "z" && !r.shiftKey ? (t.desfazer(), !0) : s === "z" && r.shiftKey || s === "y" ? (t.refazer(), !0) : s === "a" ? (xe(t), !0) : i === "0" ? (a.ajustarFolha(), !0) : i === "1" ? (a.definirZoomPercentual(100), !0) : i === "=" || i === "+" ? (t.vista.zoomRelativo(1.25), t.emitirVista(), t.anunciar(la(t.vista.zoomPercentual)), !0) : i === "-" ? (t.vista.zoomRelativo(0.8), t.emitirVista(), t.anunciar(la(t.vista.zoomPercentual)), !0) : !1;
1610
1638
  }
1611
- if (r.altKey && (i === "=" || i === "+")) return ba(t, 1.1, 1.1, void 0, "teclado") || !0;
1612
- if (r.altKey && i === "-") return ba(t, 0.9, 0.9, void 0, "teclado") || !0;
1639
+ if (r.altKey && (i === "=" || i === "+")) return Pa(t, 1.1, 1.1, void 0, "teclado") || !0;
1640
+ if (r.altKey && i === "-") return Pa(t, 0.9, 0.9, void 0, "teclado") || !0;
1613
1641
  if (i.startsWith("Arrow")) {
1614
- if (a.ocupado) return !0;
1642
+ if (e.ocupado) return !0;
1615
1643
  const l = t.passoTeclado * (r.shiftKey ? 10 : 1), c = i === "ArrowLeft" ? -l : i === "ArrowRight" ? l : 0, d = i === "ArrowUp" ? -l : i === "ArrowDown" ? l : 0;
1616
- if (t.ui.edicao && t.ui.edicao.ancoras.length > 0) Sr(t, c, d, "teclado-ancoras");
1617
- else if (t.doc.selecao.length > 0) ve(t, c, d, "teclado", "teclado-mover");
1644
+ if (t.ui.edicao && t.ui.edicao.ancoras.length > 0) Nr(t, c, d, "teclado-ancoras");
1645
+ else if (t.doc.selecao.length > 0) Pe(t, c, d, "teclado", "teclado-mover");
1618
1646
  else return !1;
1619
1647
  return !0;
1620
1648
  }
1621
1649
  if (i === "Delete" || i === "Backspace") {
1622
- if (t.ui.edicao && t.ui.edicao.ancoras.length > 0) Mr(t);
1623
- else if (t.doc.selecao.length > 0) ye(t);
1650
+ if (t.ui.edicao && t.ui.edicao.ancoras.length > 0) Or(t);
1651
+ else if (t.doc.selecao.length > 0) ze(t);
1624
1652
  else return !1;
1625
1653
  return !0;
1626
1654
  }
1627
1655
  if (i === "Escape")
1628
- return a.ocupado ? (a.cancelar(), !0) : t.ui.edicao ? (t.encerrarEdicao(), !0) : t.isolado ? (t.isolar(null), !0) : t.doc.selecao.length > 0 ? (t.selecionar([]), !0) : (Va.has(r) || (Va.add(r), t.emitir("prancha-esc-sem-efeito", {})), !1);
1656
+ return e.ocupado ? (e.cancelar(), !0) : t.ui.edicao ? (t.encerrarEdicao(), !0) : t.isolado ? (t.isolar(null), !0) : t.doc.selecao.length > 0 ? (t.selecionar([]), !0) : (Xa.has(r) || (Xa.add(r), t.emitir("prancha-esc-sem-efeito", {})), !1);
1629
1657
  if (i === "Enter")
1630
- return Fa(r) ? !1 : na(t.ferramenta) ? a.ferramentas.criarNoCentro() || !0 : t.doc.selecao.length === 1 && !t.ui.edicao ? (t.definirFerramenta("selecao-direta"), t.iniciarEdicao(t.doc.selecao[0]) || !0) : !1;
1631
- if (i === "PageDown" || i === "PageUp") return Pr(t, i === "PageDown" ? 1 : -1) || !0;
1632
- if (s === "r" && !r.altKey) return be(t, r.shiftKey ? -15 : 15, void 0, "teclado") || !0;
1658
+ return Ra(r) ? !1 : ca(t.ferramenta) ? e.ferramentas.criarNoCentro() || !0 : t.doc.selecao.length === 1 && !t.ui.edicao ? (t.definirFerramenta("selecao-direta"), t.iniciarEdicao(t.doc.selecao[0]) || !0) : !1;
1659
+ if (i === "PageDown" || i === "PageUp") return _r(t, i === "PageDown" ? 1 : -1) || !0;
1660
+ if (s === "r" && !r.altKey) return Me(t, r.shiftKey ? -15 : 15, void 0, "teclado") || !0;
1633
1661
  const n = r.altKey ? null : s === "i" && !r.shiftKey ? "conta-gotas" : i === "+" || i === "=" ? "adicionar-ancora" : i === "-" ? "excluir-ancora" : s === "c" && r.shiftKey ? "converter-ancora" : null;
1634
- return n ? (a.ocupado && a.cancelar(), t.definirFerramenta(n), !0) : !r.altKey && !r.shiftKey && Xa[s] ? (a.ocupado && a.cancelar(), t.definirFerramenta(Xa[s]), !0) : !1;
1662
+ return n ? (e.ocupado && e.cancelar(), t.definirFerramenta(n), !0) : !r.altKey && !r.shiftKey && Ja[s] ? (e.ocupado && e.cancelar(), t.definirFerramenta(Ja[s]), !0) : !1;
1635
1663
  }
1636
- function mi(t, a, e) {
1637
- e.key === " " && a.espaco && (a.espaco = !1, t.agendar());
1664
+ function Ci(t, e, a) {
1665
+ a.key === " " && e.espaco && (e.espaco = !1, t.agendar());
1638
1666
  }
1639
- const Re = [
1667
+ const $e = [
1640
1668
  "selecao",
1641
1669
  "selecao-direta",
1642
1670
  "mao",
@@ -1656,10 +1684,10 @@ const Re = [
1656
1684
  "excluir-ancora",
1657
1685
  "converter-ancora"
1658
1686
  ];
1659
- function Oe(t) {
1660
- return typeof t == "string" && Re.includes(t);
1687
+ function Ve(t) {
1688
+ return typeof t == "string" && $e.includes(t);
1661
1689
  }
1662
- const fi = "prancha:comando", pi = [
1690
+ const Ti = "prancha:comando", wi = [
1663
1691
  "definirFerramenta",
1664
1692
  "selecionarElementos",
1665
1693
  "alternarSelecaoElemento",
@@ -1730,15 +1758,15 @@ const fi = "prancha:comando", pi = [
1730
1758
  "aplicarPropriedade",
1731
1759
  "alterarElementos"
1732
1760
  ];
1733
- function gi(t) {
1734
- return typeof t == "string" && pi.includes(t);
1761
+ function Di(t) {
1762
+ return typeof t == "string" && wi.includes(t);
1735
1763
  }
1736
- function vi(t, a) {
1737
- return fe.on(fi, (e) => {
1738
- !e || typeof e != "object" || e.alvo !== void 0 && e.alvo !== t.id || a(e.comando, Array.isArray(e.args) ? e.args : []);
1764
+ function Ii(t, e) {
1765
+ return ye.on(Ti, (a) => {
1766
+ !a || typeof a != "object" || a.alvo !== void 0 && a.alvo !== t.id || e(a.comando, Array.isArray(a.args) ? a.args : []);
1739
1767
  });
1740
1768
  }
1741
- const qe = [
1769
+ const Ke = [
1742
1770
  "largura",
1743
1771
  "altura",
1744
1772
  "unidade",
@@ -1755,94 +1783,94 @@ const qe = [
1755
1783
  "teclado",
1756
1784
  "ajustar-ao-abrir"
1757
1785
  ];
1758
- function Ne(t) {
1786
+ function We(t) {
1759
1787
  if (!t) return null;
1760
- const a = t.trim().split(/[\s,;]+/).map((e) => parseFloat(e.replace(",", ".")));
1761
- return a.length !== 1 && a.length !== 4 || !a.every((e) => Number.isFinite(e) && e >= 0 && e <= 1e5) ? null : a.length === 1 ? { esquerda: a[0], direita: a[0], superior: a[0], inferior: a[0] } : { esquerda: a[0], direita: a[1], superior: a[2], inferior: a[3] };
1788
+ const e = t.trim().split(/[\s,;]+/).map((a) => parseFloat(a.replace(",", ".")));
1789
+ return e.length !== 1 && e.length !== 4 || !e.every((a) => Number.isFinite(a) && a >= 0 && a <= 1e5) ? null : e.length === 1 ? { esquerda: e[0], direita: e[0], superior: e[0], inferior: e[0] } : { esquerda: e[0], direita: e[1], superior: e[2], inferior: e[3] };
1762
1790
  }
1763
- const Za = (t) => t === "conteudo" || t === "nenhum" ? t : "folha", aa = (t, a, e, r) => {
1791
+ const Qa = (t) => t === "conteudo" || t === "nenhum" ? t : "folha", ra = (t, e, a, r) => {
1764
1792
  const i = t === null ? NaN : parseFloat(t.replace(",", "."));
1765
- return Number.isFinite(i) && i >= e && i <= r ? i : a;
1793
+ return Number.isFinite(i) && i >= a && i <= r ? i : e;
1766
1794
  };
1767
- function bi(t, a, e) {
1768
- switch (a) {
1795
+ function Fi(t, e, a) {
1796
+ switch (e) {
1769
1797
  case "largura": {
1770
- const r = aa(e, 210, 1, 1e5), i = r !== t.folha.largura;
1798
+ const r = ra(a, 210, 1, 1e5), i = r !== t.folha.largura;
1771
1799
  return t.folha = { ...t.folha, largura: r }, i;
1772
1800
  }
1773
1801
  case "altura": {
1774
- const r = aa(e, 297, 1, 1e5), i = r !== t.folha.altura;
1802
+ const r = ra(a, 297, 1, 1e5), i = r !== t.folha.altura;
1775
1803
  return t.folha = { ...t.folha, altura: r }, i;
1776
1804
  }
1777
1805
  case "unidade":
1778
- t.unidade = e && Kt(e) ? e : "mm";
1806
+ t.unidade = a && tr(a) ? a : "mm";
1779
1807
  break;
1780
1808
  case "grade":
1781
- t.grade = aa(e, 10, 0.1, 1e4);
1809
+ t.grade = ra(a, 10, 0.1, 1e4);
1782
1810
  break;
1783
1811
  case "mostrar-grade":
1784
- t.mostrarGrade = e !== null && e !== "false";
1812
+ t.mostrarGrade = a !== null && a !== "false";
1785
1813
  break;
1786
1814
  case "sem-snap":
1787
- t.snapLigado = e === null || e === "false";
1815
+ t.snapLigado = a === null || a === "false";
1788
1816
  break;
1789
1817
  case "sem-guias-inteligentes":
1790
- t.guiasInteligentes = e === null || e === "false";
1818
+ t.guiasInteligentes = a === null || a === "false";
1791
1819
  break;
1792
1820
  case "ferramenta":
1793
- t.definirFerramenta(e && Oe(e) ? e : "selecao");
1821
+ t.definirFerramenta(a && Ve(a) ? a : "selecao");
1794
1822
  break;
1795
1823
  case "somente-leitura":
1796
- t.somenteLeitura = e !== null && e !== "false";
1824
+ t.somenteLeitura = a !== null && a !== "false";
1797
1825
  break;
1798
1826
  case "passo-teclado":
1799
- t.passoTeclado = aa(e, 1, 1e-3, 1e3);
1827
+ t.passoTeclado = ra(a, 1, 1e-3, 1e3);
1800
1828
  break;
1801
1829
  case "margens":
1802
- t.margens = Ne(e);
1830
+ t.margens = We(a);
1803
1831
  break;
1804
1832
  }
1805
1833
  return t.agendar(), !1;
1806
1834
  }
1807
- const Wa = 100, yi = 4e3;
1808
- function Ai(t) {
1809
- let a;
1810
- const e = /* @__PURE__ */ new Map();
1835
+ const Ya = 100, _i = 4e3;
1836
+ function Ni(t) {
1837
+ let e;
1838
+ const a = /* @__PURE__ */ new Map();
1811
1839
  return (r, i, o) => {
1812
1840
  var l;
1813
- if (a === void 0)
1841
+ if (e === void 0)
1814
1842
  try {
1815
1843
  const c = (l = t()) == null ? void 0 : l.getContext("2d");
1816
- a = c && typeof c.measureText == "function" ? c : null;
1844
+ e = c && typeof c.measureText == "function" ? c : null;
1817
1845
  } catch {
1818
- a = null;
1846
+ e = null;
1819
1847
  }
1820
- if (!a) return null;
1848
+ if (!e) return null;
1821
1849
  const s = `${i}\0${r}`;
1822
- let n = e.get(s);
1850
+ let n = a.get(s);
1823
1851
  if (n === void 0) {
1824
1852
  try {
1825
- a.font = `${Wa}px ${i}`;
1826
- const c = a.measureText(r).width;
1827
- n = Number.isFinite(c) && c >= 0 ? c / Wa : null;
1853
+ e.font = `${Ya}px ${i}`;
1854
+ const c = e.measureText(r).width;
1855
+ n = Number.isFinite(c) && c >= 0 ? c / Ya : null;
1828
1856
  } catch {
1829
1857
  n = null;
1830
1858
  }
1831
- e.size >= yi && e.clear(), e.set(s, n);
1859
+ a.size >= _i && a.clear(), a.set(s, n);
1832
1860
  }
1833
1861
  return n === null ? null : n * o;
1834
1862
  };
1835
1863
  }
1836
- function Pi() {
1837
- if (Vt() || typeof document > "u") return !1;
1838
- const t = Ai(() => document.createElement("canvas"));
1839
- return t("M", "sans-serif", 1) === null ? !1 : (Ut(t), !0);
1864
+ function Oi() {
1865
+ if (rr() || typeof document > "u") return !1;
1866
+ const t = Ni(() => document.createElement("canvas"));
1867
+ return t("M", "sans-serif", 1) === null ? !1 : (ir(t), !0);
1840
1868
  }
1841
- class Si extends pe {
1869
+ class Ri extends Ae {
1842
1870
  constructor() {
1843
1871
  super();
1844
1872
  m(this, "shadow");
1845
- m(this, "bag", new Ea());
1873
+ m(this, "bag", new Ta());
1846
1874
  m(this, "c");
1847
1875
  m(this, "interacao");
1848
1876
  m(this, "render");
@@ -1853,7 +1881,7 @@ class Si extends pe {
1853
1881
  m(this, "ponteiroSobre", !1);
1854
1882
  m(this, "focoDentro", !1);
1855
1883
  m(this, "enquadrou", !1);
1856
- m(this, "_fabrica", Ka);
1884
+ m(this, "_fabrica", Ua);
1857
1885
  m(this, "revisaoSalva", 0);
1858
1886
  m(this, "_modificado", !1);
1859
1887
  m(this, "conteudoEnquadrado", !1);
@@ -1861,9 +1889,9 @@ class Si extends pe {
1861
1889
  m(this, "resolverPronto", null);
1862
1890
  m(this, "fimPronto", 0);
1863
1891
  m(this, "carregando", !1);
1864
- this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = ur();
1865
- const e = (r) => this.shadow.getElementById(r);
1866
- this.viewport = e("viewport"), this.status = e("status"), this.c = new yr({
1892
+ this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = Pr();
1893
+ const a = (r) => this.shadow.getElementById(r);
1894
+ this.viewport = a("viewport"), this.status = a("status"), this.c = new Ir({
1867
1895
  emitir: (r, i, o) => {
1868
1896
  const s = new CustomEvent(r, { detail: i, bubbles: !0, composed: !0, cancelable: !!o });
1869
1897
  return this.dispatchEvent(s), s.defaultPrevented;
@@ -1872,23 +1900,26 @@ class Si extends pe {
1872
1900
  var r;
1873
1901
  return (r = this.render) == null ? void 0 : r.agendar();
1874
1902
  },
1875
- anunciar: (r) => br(this.status, r)
1903
+ anunciar: (r) => Dr(this.status, r)
1876
1904
  }), this._pronto = new Promise((r) => {
1877
1905
  this.resolverPronto = r;
1878
- }), this.c.doc.ouvirMudancas(() => this.avaliarModificado()), this.interacao = new si(this.c, this.viewport, new Ir(this.c)), this.render = new ci(this.c, {
1906
+ }), this.c.doc.ouvirMudancas(() => this.avaliarModificado()), this.interacao = new bi(this.c, this.viewport, new Gr(this.c)), this.render = new Si(this.c, {
1879
1907
  viewport: this.viewport,
1880
- base: e("camada-base"),
1881
- sobreposicao: e("camada-sobreposicao"),
1882
- reguaH: e("regua-h"),
1883
- reguaV: e("regua-v")
1908
+ base: a("camada-base"),
1909
+ sobreposicao: a("camada-sobreposicao"),
1910
+ reguaH: a("regua-h"),
1911
+ reguaV: a("regua-v")
1884
1912
  }, () => this._fabrica);
1885
1913
  }
1886
1914
  static get observedAttributes() {
1887
- return qe;
1915
+ return Ke;
1888
1916
  }
1889
1917
  connectedCallback() {
1890
- var e;
1891
- this.bag.cleanup(), this.interacao.conectar(this.bag, this.shadow.getElementById("regua-h"), this.shadow.getElementById("regua-v")), Le(this.bag, this, () => this.modoTeclado() === "isolado"), this.bag.add(this, "pointerenter", () => {
1918
+ var a;
1919
+ this.bag.cleanup(), this.interacao.conectar(this.bag, this.shadow.getElementById("regua-h"), this.shadow.getElementById("regua-v")), Ge(this.bag, this, () => {
1920
+ const r = this.modoTeclado();
1921
+ return r === "isolado" || r === "modal";
1922
+ }), He(this.bag, this, () => this.modoTeclado() === "modal" && !this.hospedadaNoEditor()), this.bag.add(this, "pointerenter", () => {
1892
1923
  this.ponteiroSobre = !0;
1893
1924
  }), this.bag.add(this, "pointerleave", () => {
1894
1925
  this.ponteiroSobre = !1;
@@ -1898,25 +1929,25 @@ class Si extends pe {
1898
1929
  this.focoDentro = !1;
1899
1930
  }), this.bag.add(this.viewport, "keydown", (r) => this.tecla(r, !0)), typeof window < "u" && (this.bag.add(window, "keydown", (r) => {
1900
1931
  const i = this.modoTeclado();
1901
- i === "exclusivo" ? this.tecla(r, !0, !0) : i === "isolado" && this.noEscopoDoTeclado(r) && this.tecla(r, !1, !0);
1902
- }, { capture: !0 }), this.bag.add(window, "keydown", (r) => this.tecla(r)), this.bag.add(window, "keyup", (r) => mi(this.c, this.interacao, r), { capture: !0 }), this.bag.add(window, "blur", () => {
1932
+ i === "exclusivo" ? this.tecla(r, !0, !0) : (i === "isolado" || i === "modal") && this.noEscopoDoTeclado(r) && this.tecla(r, !1, !0);
1933
+ }, { capture: !0 }), this.bag.add(window, "keydown", (r) => this.tecla(r)), this.bag.add(window, "keyup", (r) => Ci(this.c, this.interacao, r), { capture: !0 }), this.bag.add(window, "blur", () => {
1903
1934
  this.interacao.espaco = !1;
1904
- })), typeof ResizeObserver == "function" && ((e = this.observador) == null || e.disconnect(), this.observador = new ResizeObserver(() => this.redimensionar()), this.observador.observe(this.viewport)), this.desligarBus.forEach((r) => r()), this.desligarBus = [
1905
- vi(this, (r, i) => this.executarComando(r, i)),
1906
- fe.on("tema:alterado", () => this.atualizarCores())
1907
- ], Pi() && this.c.doc.indice.definir(this.c.doc.elementos), this.atualizarCores(), this.atualizarRotulo(), this.c.margens = Ne(this.getAttribute("margens")), this.redimensionar(), this.prepararPronto();
1935
+ })), typeof ResizeObserver == "function" && ((a = this.observador) == null || a.disconnect(), this.observador = new ResizeObserver(() => this.redimensionar()), this.observador.observe(this.viewport)), this.desligarBus.forEach((r) => r()), this.desligarBus = [
1936
+ Ii(this, (r, i) => this.executarComando(r, i)),
1937
+ ye.on("tema:alterado", () => this.atualizarCores())
1938
+ ], Oi() && this.c.doc.indice.definir(this.c.doc.elementos), this.atualizarCores(), this.atualizarRotulo(), this.c.margens = We(this.getAttribute("margens")), this.redimensionar(), this.prepararPronto();
1908
1939
  }
1909
1940
  disconnectedCallback() {
1910
- var e;
1911
- this.fimPronto && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.fimPronto), this.fimPronto = 0, this.bag.cleanup(), (e = this.observador) == null || e.disconnect(), this.observador = null, this.desligarBus.forEach((r) => r()), this.desligarBus = [], this.render.cancelar(), this.interacao.cancelar();
1941
+ var a;
1942
+ this.fimPronto && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.fimPronto), this.fimPronto = 0, this.bag.cleanup(), (a = this.observador) == null || a.disconnect(), this.observador = null, this.desligarBus.forEach((r) => r()), this.desligarBus = [], this.interacao.cancelar(), this.render.cancelar();
1912
1943
  }
1913
- attributeChangedCallback(e, r, i) {
1914
- if (e === "rotulo") {
1944
+ attributeChangedCallback(a, r, i) {
1945
+ if (a === "rotulo") {
1915
1946
  this.atualizarRotulo();
1916
1947
  return;
1917
1948
  }
1918
- if (e === "teclado") return;
1919
- bi(this.c, e, i) && !this.enquadrou && this.ajustarFolha();
1949
+ if (a === "teclado") return;
1950
+ Fi(this.c, a, i) && !this.enquadrou && this.ajustarFolha();
1920
1951
  }
1921
1952
  /** Resolve `pronto` quando a área de desenho foi medida; sem layout (teste, aba oculta), dois quadros depois. */
1922
1953
  prepararPronto() {
@@ -1933,36 +1964,40 @@ class Si extends pe {
1933
1964
  }
1934
1965
  }
1935
1966
  concluirPronto() {
1936
- const e = this.resolverPronto;
1937
- e && (this.resolverPronto = null, e(), this.dispatchEvent(new CustomEvent("prancha-pronta", { bubbles: !0, composed: !0, detail: {} })));
1967
+ const a = this.resolverPronto;
1968
+ a && (this.resolverPronto = null, a(), this.dispatchEvent(new CustomEvent("prancha-pronta", { bubbles: !0, composed: !0, detail: {} })));
1938
1969
  }
1939
1970
  atualizarRotulo() {
1940
1971
  this.viewport.setAttribute("aria-label", this.getAttribute("rotulo") || "Prancha");
1941
1972
  }
1942
1973
  atualizarCores() {
1943
- this.c.cores = fr(this), this.render.reiniciar(), this.c.agendar();
1974
+ this.c.cores = Er(this), this.render.reiniciar(), this.c.agendar();
1944
1975
  }
1945
1976
  redimensionar() {
1946
1977
  if (this.render.medir(), !this.enquadrou && this.c.vista.largura > 0) {
1947
- const e = Za(this.getAttribute("ajustar-ao-abrir"));
1948
- e === "conteudo" && this.c.doc.elementos.length > 0 ? (this.ajustarElementos(), this.conteudoEnquadrado = !0) : e !== "nenhum" && this.c.vista.enquadrar({ x: 0, y: 0, largura: this.c.folha.largura, altura: this.c.folha.altura }), this.enquadrou = !0;
1978
+ const a = Qa(this.getAttribute("ajustar-ao-abrir"));
1979
+ a === "conteudo" && this.c.doc.elementos.length > 0 ? (this.ajustarElementos(), this.conteudoEnquadrado = !0) : a !== "nenhum" && this.c.vista.enquadrar({ x: 0, y: 0, largura: this.c.folha.largura, altura: this.c.folha.altura }), this.enquadrou = !0;
1949
1980
  }
1950
1981
  this.render.pintar(), this.prepararPronto();
1951
1982
  }
1952
- /** Modo do atributo `teclado`: `local` (padrão), `exclusivo` ou `isolado`. */
1983
+ /** Modo do atributo `teclado`: `local` (padrão), `exclusivo`, `isolado` ou `modal`. */
1953
1984
  modoTeclado() {
1954
- return Aa(this.getAttribute("teclado"));
1985
+ return j(this.getAttribute("teclado"));
1986
+ }
1987
+ hospedadaNoEditor() {
1988
+ const a = this.getRootNode(), r = a == null ? void 0 : a.host;
1989
+ return !!r && r.localName === "ui-editor-prancha";
1955
1990
  }
1956
1991
  tecladoExclusivo() {
1957
1992
  return this.modoTeclado() === "exclusivo";
1958
1993
  }
1959
1994
  /** O evento veio de dentro desta prancha ou do editor (outro componente) que a contém? */
1960
- noEscopoDoTeclado(e) {
1961
- const r = this.getRootNode().host, i = typeof e.composedPath == "function" ? e.composedPath() : [];
1995
+ noEscopoDoTeclado(a) {
1996
+ const r = this.getRootNode().host, i = typeof a.composedPath == "function" ? a.composedPath() : [];
1962
1997
  return i.includes(this) || !!r && i.includes(r);
1963
1998
  }
1964
- tecla(e, r = !1, i = !1) {
1965
- !r && !this.focoDentro && !this.ponteiroSobre || !i && e.defaultPrevented && this.tecladoExclusivo() || hi(this.c, this.interacao, { ajustarFolha: () => this.ajustarFolha(), definirZoomPercentual: (o) => this.definirZoom(o) }, e) && (e.preventDefault(), e.stopPropagation(), i && e.stopImmediatePropagation(), ui(e));
1999
+ tecla(a, r = !1, i = !1) {
2000
+ !r && !this.focoDentro && !this.ponteiroSobre || !i && a.defaultPrevented && this.tecladoExclusivo() || Ei(this.c, this.interacao, { ajustarFolha: () => this.ajustarFolha(), definirZoomPercentual: (o) => this.definirZoom(o) }, a) && (a.preventDefault(), a.stopPropagation(), i && a.stopImmediatePropagation(), Pi(a));
1966
2001
  }
1967
2002
  // ---------- modificado, revisão e ciclo de vida ----------
1968
2003
  /** O documento mudou desde a carga (`definirElementos`) ou desde `marcarComoSalvo()`. */
@@ -1979,8 +2014,8 @@ class Si extends pe {
1979
2014
  }
1980
2015
  avaliarModificado() {
1981
2016
  if (this.carregando) return;
1982
- const e = this.c.doc.revisao !== this.revisaoSalva;
1983
- e !== this._modificado && (this._modificado = e, this.c.emitir("prancha-modificado", { modificado: e, revisao: this.c.doc.revisao }));
2017
+ const a = this.c.doc.revisao !== this.revisaoSalva;
2018
+ a !== this._modificado && (this._modificado = a, this.c.emitir("prancha-modificado", { modificado: a, revisao: this.c.doc.revisao }));
1984
2019
  }
1985
2020
  /**
1986
2021
  * Resolve quando a área de desenho foi medida e a prancha consegue enquadrar (ou, sem layout, dois quadros depois da
@@ -1990,16 +2025,23 @@ class Si extends pe {
1990
2025
  return this._pronto;
1991
2026
  }
1992
2027
  /** Dá o foco à área de desenho (o `focus()` do host entrega o foco ao viewport, onde o teclado da prancha escuta). */
1993
- focus(e) {
1994
- this.viewport.focus(e);
2028
+ focus(a) {
2029
+ this.viewport.focus(a);
1995
2030
  }
1996
2031
  // ---------- propriedades ----------
2032
+ /** Modo do teclado: `local` (padrão), `exclusivo`, `isolado` ou `modal`. */
2033
+ get teclado() {
2034
+ return this.modoTeclado();
2035
+ }
2036
+ set teclado(a) {
2037
+ this.setAttribute("teclado", j(a));
2038
+ }
1997
2039
  /** Ferramenta ativa. */
1998
2040
  get ferramenta() {
1999
2041
  return this.c.ferramenta;
2000
2042
  }
2001
- set ferramenta(e) {
2002
- this.definirFerramenta(e);
2043
+ set ferramenta(a) {
2044
+ this.definirFerramenta(a);
2003
2045
  }
2004
2046
  /** Elementos do documento (na ordem de empilhamento). */
2005
2047
  get elementos() {
@@ -2019,84 +2061,84 @@ class Si extends pe {
2019
2061
  get gerarId() {
2020
2062
  return this.c.gerarId;
2021
2063
  }
2022
- set gerarId(e) {
2023
- typeof e == "function" && (this.c.gerarId = e);
2064
+ set gerarId(a) {
2065
+ typeof a == "function" && (this.c.gerarId = a);
2024
2066
  }
2025
2067
  /** Fábrica do contexto 2D de cada canvas (padrão `getContext('2d')`); serve para pintar com um contexto próprio ou de teste. */
2026
2068
  get fabricaContexto() {
2027
2069
  return this._fabrica;
2028
2070
  }
2029
- set fabricaContexto(e) {
2030
- this._fabrica = typeof e == "function" ? e : Ka, this.render.reiniciar(), this.c.agendar();
2071
+ set fabricaContexto(a) {
2072
+ this._fabrica = typeof a == "function" ? a : Ua, this.render.reiniciar(), this.c.agendar();
2031
2073
  }
2032
2074
  // ---------- dados (sincronização do app: não emite prancha-elemento-*) ----------
2033
2075
  /** Carrega o documento (normaliza; recomeça o histórico e a seleção). Devolve os recusados. */
2034
- definirElementos(e) {
2076
+ definirElementos(a) {
2035
2077
  this.carregando = !0;
2036
2078
  const r = (() => {
2037
2079
  try {
2038
- return this.c.doc.definir(e);
2080
+ return this.c.doc.definir(a);
2039
2081
  } finally {
2040
2082
  this.carregando = !1;
2041
2083
  }
2042
2084
  })();
2043
- return this.c.ui.edicao = null, this.c.emitirHistorico(), this.marcarComoSalvo(), !this.conteudoEnquadrado && this.enquadrou && Za(this.getAttribute("ajustar-ao-abrir")) === "conteudo" && r.elementos.length > 0 && (this.conteudoEnquadrado = !0, this.ajustarElementos()), this.c.agendar(), { aceitos: r.elementos.length, recusados: r.recusados };
2085
+ return this.c.ui.edicao = null, this.c.emitirHistorico(), this.marcarComoSalvo(), !this.conteudoEnquadrado && this.enquadrou && Qa(this.getAttribute("ajustar-ao-abrir")) === "conteudo" && r.elementos.length > 0 && (this.conteudoEnquadrado = !0, this.ajustarElementos()), this.c.agendar(), { aceitos: r.elementos.length, recusados: r.recusados };
2044
2086
  }
2045
2087
  /** Lote de mudanças do app (adicionar, atualizar, remover) de uma vez. */
2046
- aplicarLote(e, r = {}) {
2047
- const { resultado: i } = this.c.doc.aplicarLote(e, r.historico !== !1);
2088
+ aplicarLote(a, r = {}) {
2089
+ const { resultado: i } = this.c.doc.aplicarLote(a, r.historico !== !1);
2048
2090
  return this.c.emitirHistorico(), this.c.agendar(), i;
2049
2091
  }
2050
- adicionarElemento(e, r) {
2051
- return this.aplicarLote({ adicionar: [e] }, r).adicionados.length === 1;
2092
+ adicionarElemento(a, r) {
2093
+ return this.aplicarLote({ adicionar: [a] }, r).adicionados.length === 1;
2052
2094
  }
2053
- atualizarElemento(e, r) {
2054
- return this.aplicarLote({ atualizar: [e] }, r).atualizados.length === 1;
2095
+ atualizarElemento(a, r) {
2096
+ return this.aplicarLote({ atualizar: [a] }, r).atualizados.length === 1;
2055
2097
  }
2056
- removerElemento(e, r) {
2057
- return this.aplicarLote({ remover: [e] }, r).removidos.length === 1;
2098
+ removerElemento(a, r) {
2099
+ return this.aplicarLote({ remover: [a] }, r).removidos.length === 1;
2058
2100
  }
2059
2101
  obterElementos() {
2060
2102
  return this.elementos;
2061
2103
  }
2062
- obterElemento(e) {
2063
- return this.c.doc.obter(e) ?? null;
2104
+ obterElemento(a) {
2105
+ return this.c.doc.obter(a) ?? null;
2064
2106
  }
2065
2107
  /** Troca o id provisório pelo definitivo em tudo (documento, seleção e histórico). */
2066
- renomearElemento(e, r) {
2108
+ renomearElemento(a, r) {
2067
2109
  var o;
2068
- const i = this.c.doc.renomear(e, r);
2069
- return i && ((o = this.c.ui.edicao) == null ? void 0 : o.id) === e && (this.c.ui.edicao.id = r), i;
2110
+ const i = this.c.doc.renomear(a, r);
2111
+ return i && ((o = this.c.ui.edicao) == null ? void 0 : o.id) === a && (this.c.ui.edicao.id = r), i;
2070
2112
  }
2071
2113
  // ---------- seleção e ferramentas ----------
2072
- selecionarElementos(e) {
2073
- return this.c.selecionar(Array.isArray(e) ? e : []);
2114
+ selecionarElementos(a) {
2115
+ return this.c.selecionar(Array.isArray(a) ? a : []);
2074
2116
  }
2075
- alternarSelecaoElemento(e) {
2076
- return this.c.selecionar([e], "alternar");
2117
+ alternarSelecaoElemento(a) {
2118
+ return this.c.selecionar([a], "alternar");
2077
2119
  }
2078
2120
  limparSelecao() {
2079
2121
  return this.c.selecionar([]);
2080
2122
  }
2081
2123
  selecionarTudo() {
2082
- return Ae(this.c);
2124
+ return xe(this.c);
2083
2125
  }
2084
2126
  obterSelecao() {
2085
2127
  return this.c.doc.elementosSelecionados();
2086
2128
  }
2087
- definirFerramenta(e) {
2088
- this.interacao.cancelar(), this.c.definirFerramenta(Oe(e) ? e : "selecao");
2129
+ definirFerramenta(a) {
2130
+ this.interacao.cancelar(), this.c.definirFerramenta(Ve(a) ? a : "selecao");
2089
2131
  }
2090
- definirOpcoesFerramentas(e) {
2091
- this.c.opcoesFerramentas = e && typeof e == "object" ? { ...e } : {};
2132
+ definirOpcoesFerramentas(a) {
2133
+ this.c.opcoesFerramentas = a && typeof a == "object" ? { ...a } : {};
2092
2134
  }
2093
2135
  obterOpcoesFerramentas() {
2094
2136
  return { ...this.c.opcoesFerramentas };
2095
2137
  }
2096
2138
  /** Entra na seleção direta (âncoras) do elemento. */
2097
- editarAncoras(e) {
2098
- const r = typeof e == "string" ? this.c.doc.obter(e) : void 0;
2099
- return r ? r.bloqueado || r.geometria.tipo === "texto" ? this.c.iniciarEdicao(e) : (this.c.definirFerramenta("selecao-direta"), this.c.iniciarEdicao(e)) : (this.c.recusar("editar-ancoras", "id-invalido", typeof e == "string" ? e : void 0), !1);
2139
+ editarAncoras(a) {
2140
+ const r = typeof a == "string" ? this.c.doc.obter(a) : void 0;
2141
+ return r ? r.bloqueado || r.geometria.tipo === "texto" ? this.c.iniciarEdicao(a) : (this.c.definirFerramenta("selecao-direta"), this.c.iniciarEdicao(a)) : (this.c.recusar("editar-ancoras", "id-invalido", typeof a == "string" ? a : void 0), !1);
2100
2142
  }
2101
2143
  concluirEdicao() {
2102
2144
  this.c.encerrarEdicao();
@@ -2108,48 +2150,48 @@ class Si extends pe {
2108
2150
  refazer() {
2109
2151
  return this.c.refazer();
2110
2152
  }
2111
- moverSelecao(e, r) {
2112
- return ve(this.c, e, r);
2153
+ moverSelecao(a, r) {
2154
+ return Pe(this.c, a, r);
2113
2155
  }
2114
- girarSelecao(e, r) {
2115
- return be(this.c, e, r);
2156
+ girarSelecao(a, r) {
2157
+ return Me(this.c, a, r);
2116
2158
  }
2117
- escalarSelecao(e, r, i) {
2118
- return ba(this.c, e, r ?? e, i);
2159
+ escalarSelecao(a, r, i) {
2160
+ return Pa(this.c, a, r ?? a, i);
2119
2161
  }
2120
- espelharSelecao(e) {
2121
- return Ar(this.c, e);
2162
+ espelharSelecao(a) {
2163
+ return Fr(this.c, a);
2122
2164
  }
2123
- transformarSelecao(e) {
2124
- return J(this.c, Xt(e));
2165
+ transformarSelecao(a) {
2166
+ return aa(this.c, or(a));
2125
2167
  }
2126
2168
  removerSelecao() {
2127
- return ye(this.c);
2169
+ return ze(this.c);
2128
2170
  }
2129
2171
  /** Raios dos cantos dos retângulos selecionados, em mm (número = os quatro; ou [sup. esq., sup. dir., inf. dir., inf. esq.]). */
2130
- definirRaiosCantos(e) {
2131
- return Pe(this.c, e);
2172
+ definirRaiosCantos(a) {
2173
+ return Ee(this.c, a);
2132
2174
  }
2133
2175
  /**
2134
2176
  * Insere uma pré-definição (moldura, seta...) e a deixa selecionada. Sem `caixa`: com `opcoes.quadro: 'margens'` (e o
2135
2177
  * atributo `margens`), o quadro das margens; senão, uma caixa no CENTRO DA ÁREA VISÍVEL, de tamanho proporcional ao zoom
2136
2178
  * (cerca de 35% da largura e 25% da altura visíveis, limitada à folha), para a forma nascer à vista.
2137
2179
  */
2138
- inserirPredefinicao(e, r, i = {}) {
2139
- if (!Zt(e))
2180
+ inserirPredefinicao(a, r, i = {}) {
2181
+ if (!sr(a))
2140
2182
  return this.c.recusar("inserir-predefinicao", "geometria-invalida"), [];
2141
- const { quadro: o, ...s } = i ?? {}, n = r ?? (o === "margens" && this.c.margens ? me(this.c.folha.largura, this.c.folha.altura, this.c.margens) : null) ?? this.caixaNaVista(), l = Wt(e, n, { ...s, id: s.id ?? this.c.gerarId(e) });
2142
- return w(this.c, l, "predefinicao");
2183
+ const { quadro: o, ...s } = i ?? {}, n = r ?? (o === "margens" && this.c.margens ? ve(this.c.folha.largura, this.c.folha.altura, this.c.margens) : null) ?? this.caixaNaVista(), l = nr(a, n, { ...s, id: s.id ?? this.c.gerarId(a) });
2184
+ return F(this.c, l, "predefinicao");
2143
2185
  }
2144
2186
  /** Caixa (mm) no centro da área visível, proporcional ao zoom e dentro da folha; sem vista medida, 60 × 40 mm no centro da folha. */
2145
2187
  caixaNaVista() {
2146
- const e = this.c.folha, r = this.c.vista;
2147
- let i = 0, o = 0, s = e.largura, n = e.altura;
2188
+ const a = this.c.folha, r = this.c.vista;
2189
+ let i = 0, o = 0, s = a.largura, n = a.altura;
2148
2190
  if (r.largura > 0 && r.altura > 0) {
2149
- const v = r.paraFolha(0, 0), b = r.paraFolha(r.largura, r.altura), M = Math.max(0, v[0]), x = Math.max(0, v[1]), C = Math.min(e.largura, b[0]), B = Math.min(e.altura, b[1]);
2150
- C > M && B > x && (i = M, o = x, s = C, n = B);
2191
+ const v = r.paraFolha(0, 0), b = r.paraFolha(r.largura, r.altura), M = Math.max(0, v[0]), C = Math.max(0, v[1]), T = Math.min(a.largura, b[0]), P = Math.min(a.altura, b[1]);
2192
+ T > M && P > C && (i = M, o = C, s = T, n = P);
2151
2193
  }
2152
- const l = (s - i) * (r.largura > 0 ? 0.35 : 0.3), c = (n - o) * (r.largura > 0 ? 0.25 : 0.15), d = Math.max(1, Math.min(l, e.largura)), h = Math.max(1, Math.min(c, e.altura)), u = r.largura > 0 && r.altura > 0 ? r.paraFolha(r.largura / 2, r.altura / 2) : [(i + s) / 2, (o + n) / 2], f = Math.min(e.largura, Math.max(0, u[0])), p = Math.min(e.altura, Math.max(0, u[1]));
2194
+ const l = (s - i) * (r.largura > 0 ? 0.35 : 0.3), c = (n - o) * (r.largura > 0 ? 0.25 : 0.15), d = Math.max(1, Math.min(l, a.largura)), h = Math.max(1, Math.min(c, a.altura)), u = r.largura > 0 && r.altura > 0 ? r.paraFolha(r.largura / 2, r.altura / 2) : [(i + s) / 2, (o + n) / 2], f = Math.min(a.largura, Math.max(0, u[0])), p = Math.min(a.altura, Math.max(0, u[1]));
2153
2195
  return { x: f - d / 2, y: p - h / 2, largura: d, altura: h };
2154
2196
  }
2155
2197
  // ---------- vista ----------
@@ -2157,29 +2199,29 @@ class Si extends pe {
2157
2199
  this.render.medir(), this.c.vista.enquadrar({ x: 0, y: 0, largura: this.c.folha.largura, altura: this.c.folha.altura }) && (this.enquadrou = !0), this.c.emitirVista();
2158
2200
  }
2159
2201
  ajustarSelecao() {
2160
- const e = this.c.doc.elementosSelecionados();
2161
- if (e.length === 0) {
2202
+ const a = this.c.doc.elementosSelecionados();
2203
+ if (a.length === 0) {
2162
2204
  this.c.recusar("ajustar-selecao", "sem-selecao");
2163
2205
  return;
2164
2206
  }
2165
- const r = Da(e);
2207
+ const r = Na(a);
2166
2208
  r && this.c.vista.enquadrar(r, 48) && this.c.emitirVista();
2167
2209
  }
2168
2210
  /**
2169
2211
  * Enquadra os elementos (os `ids`, ou todos) SEM mexer na seleção, com teto de zoom (`zoomMaximo`, em %: um elemento
2170
2212
  * pequeno não é ampliado absurdamente). Devolve se enquadrou.
2171
2213
  */
2172
- ajustarElementos(e, r = {}) {
2173
- const i = Array.isArray(e) ? e.map((c) => this.c.doc.obter(c)).filter((c) => !!c) : [...this.c.doc.elementos], o = Da(i);
2214
+ ajustarElementos(a, r = {}) {
2215
+ const i = Array.isArray(a) ? a.map((c) => this.c.doc.obter(c)).filter((c) => !!c) : [...this.c.doc.elementos], o = Na(i);
2174
2216
  if (!o) return !1;
2175
2217
  const s = Number.isFinite(r == null ? void 0 : r.margem) && r.margem >= 0 ? r.margem : 48, n = Number.isFinite(r == null ? void 0 : r.zoomMaximo) && r.zoomMaximo > 0 ? r.zoomMaximo : 800;
2176
2218
  if (!this.c.vista.enquadrar(o, s)) return !1;
2177
- const l = n / 100 * H;
2219
+ const l = n / 100 * W;
2178
2220
  return this.c.vista.zoom > l && this.c.vista.definirZoomCentrado(l, o), this.c.emitirVista(), !0;
2179
2221
  }
2180
2222
  /** Zoom em % (100% = tamanho real a 96 dpi), no centro da vista. */
2181
- definirZoom(e) {
2182
- this.c.vista.definirZoom(e / 100 * H) && (this.c.emitirVista(), this.c.anunciar(sa(this.c.vista.zoomPercentual)));
2223
+ definirZoom(a) {
2224
+ this.c.vista.definirZoom(a / 100 * W) && (this.c.emitirVista(), this.c.anunciar(la(this.c.vista.zoomPercentual)));
2183
2225
  }
2184
2226
  aproximar() {
2185
2227
  this.definirZoom(this.c.vista.zoomPercentual * 1.25);
@@ -2187,136 +2229,136 @@ class Si extends pe {
2187
2229
  afastar() {
2188
2230
  this.definirZoom(this.c.vista.zoomPercentual * 0.8);
2189
2231
  }
2190
- deslocarVista(e, r) {
2191
- this.c.vista.deslocar(e, r) && this.c.emitirVista();
2232
+ deslocarVista(a, r) {
2233
+ this.c.vista.deslocar(a, r) && this.c.emitirVista();
2192
2234
  }
2193
2235
  obterVista() {
2194
- const e = this.c.vista;
2195
- return { zoom: e.zoom, zoomPercentual: e.zoomPercentual, pan: [e.pan[0], e.pan[1]] };
2236
+ const a = this.c.vista;
2237
+ return { zoom: a.zoom, zoomPercentual: a.zoomPercentual, pan: [a.pan[0], a.pan[1]] };
2196
2238
  }
2197
2239
  /** Ponto da área de desenho (px CSS) → folha (mm), e o inverso. */
2198
- paraFolha(e, r) {
2199
- return this.c.vista.paraFolha(e, r);
2240
+ paraFolha(a, r) {
2241
+ return this.c.vista.paraFolha(a, r);
2200
2242
  }
2201
- paraTela(e) {
2202
- return this.c.vista.paraTela(e);
2243
+ paraTela(a) {
2244
+ return this.c.vista.paraTela(a);
2203
2245
  }
2204
2246
  // ---------- guias e snap ----------
2205
- definirGuias(e) {
2206
- this.c.guias = (Array.isArray(e) ? e : []).filter((r) => r && (r.orientacao === "horizontal" || r.orientacao === "vertical") && Number.isFinite(r.posicao)).map((r) => ({ ...r })), this.c.emitirGuias();
2247
+ definirGuias(a) {
2248
+ this.c.guias = (Array.isArray(a) ? a : []).filter((r) => r && (r.orientacao === "horizontal" || r.orientacao === "vertical") && Number.isFinite(r.posicao)).map((r) => ({ ...r })), this.c.emitirGuias();
2207
2249
  }
2208
- adicionarGuia(e) {
2209
- this.definirGuias([...this.c.guias, e]);
2250
+ adicionarGuia(a) {
2251
+ this.definirGuias([...this.c.guias, a]);
2210
2252
  }
2211
- removerGuia(e) {
2212
- this.definirGuias(this.c.guias.filter((r, i) => i !== e));
2253
+ removerGuia(a) {
2254
+ this.definirGuias(this.c.guias.filter((r, i) => i !== a));
2213
2255
  }
2214
2256
  obterGuias() {
2215
- return this.c.guias.map((e) => ({ ...e }));
2257
+ return this.c.guias.map((a) => ({ ...a }));
2216
2258
  }
2217
- definirSnap(e) {
2218
- this.toggleAttribute("sem-snap", !e);
2259
+ definirSnap(a) {
2260
+ this.toggleAttribute("sem-snap", !a);
2219
2261
  }
2220
2262
  // ---------- exportação ----------
2221
2263
  /** SVG da folha com os elementos (o mesmo plano de pintura da tela). */
2222
- exportarSvg(e = {}) {
2223
- return Jt(this.c.doc.elementos, { largura: this.c.folha.largura, altura: this.c.folha.altura, fundo: "#ffffff", ...e });
2264
+ exportarSvg(a = {}) {
2265
+ return lr(this.c.doc.elementos, { largura: this.c.folha.largura, altura: this.c.folha.altura, fundo: "#ffffff", ...a });
2224
2266
  }
2225
2267
  /** Pinta os elementos num contexto próprio (ex.: o PDF vetorial do app) com o mesmo código da tela. */
2226
- desenharEm(e, r = {}) {
2227
- return N(e, this.c.doc.elementos, r);
2268
+ desenharEm(a, r = {}) {
2269
+ return $(a, this.c.doc.elementos, r);
2228
2270
  }
2229
2271
  /** Mede e pinta agora (sem esperar o próximo quadro). */
2230
2272
  renderizarAgora() {
2231
2273
  this.render.medir(), this.render.pintar();
2232
2274
  }
2233
2275
  /** Executa um comando público pelo nome (o mesmo que o `ui-bus` usa). Comando desconhecido emite `prancha-recusa`. */
2234
- executarComando(e, r = []) {
2235
- if (!gi(e)) {
2276
+ executarComando(a, r = []) {
2277
+ if (!Di(a)) {
2236
2278
  this.c.recusar("executar-comando", "comando-desconhecido");
2237
2279
  return;
2238
2280
  }
2239
- const i = this[e];
2281
+ const i = this[a];
2240
2282
  try {
2241
2283
  return i.apply(this, Array.isArray(r) ? r : []);
2242
2284
  } catch {
2243
- this.c.recusar(e, "geometria-invalida");
2285
+ this.c.recusar(a, "geometria-invalida");
2244
2286
  return;
2245
2287
  }
2246
2288
  }
2247
2289
  }
2248
- const Ja = (t) => {
2249
- const a = typeof t == "string" && t.trim() !== "" ? Number(t.replace(",", ".")) : t;
2250
- return typeof a == "number" && Number.isFinite(a) ? a : null;
2290
+ const ae = (t) => {
2291
+ const e = typeof t == "string" && t.trim() !== "" ? Number(t.replace(",", ".")) : t;
2292
+ return typeof e == "number" && Number.isFinite(e) ? e : null;
2251
2293
  };
2252
- function Mi(t) {
2253
- let a = 1 / 0, e = 1 / 0, r = -1 / 0, i = -1 / 0;
2294
+ function Li(t) {
2295
+ let e = 1 / 0, a = 1 / 0, r = -1 / 0, i = -1 / 0;
2254
2296
  for (const o of t) {
2255
- const s = W(o);
2256
- s && (a = Math.min(a, s.x), e = Math.min(e, s.y), r = Math.max(r, s.x + s.largura), i = Math.max(i, s.y + s.altura));
2297
+ const s = Y(o);
2298
+ s && (e = Math.min(e, s.x), a = Math.min(a, s.y), r = Math.max(r, s.x + s.largura), i = Math.max(i, s.y + s.altura));
2257
2299
  }
2258
- return Number.isFinite(a) ? { x: a, y: e, largura: r - a, altura: i - e } : null;
2300
+ return Number.isFinite(e) ? { x: e, y: a, largura: r - e, altura: i - a } : null;
2259
2301
  }
2260
- function zi(t, a, e) {
2261
- const r = Mi(t);
2302
+ function ki(t, e, a) {
2303
+ const r = Li(t);
2262
2304
  if (!r) return null;
2263
2305
  let i = null;
2264
- if (a === "geometria.x") i = k(e - r.x, 0);
2265
- else if (a === "geometria.y") i = k(0, e - r.y);
2266
- else if (a === "geometria.largura" && e > 0 && r.largura > 0) i = q(e / r.largura, 1, [r.x, r.y]);
2267
- else if (a === "geometria.altura" && e > 0 && r.altura > 0) i = q(1, e / r.altura, [r.x, r.y]);
2268
- else if (a === "geometria.rotacao")
2306
+ if (e === "geometria.x") i = k(a - r.x, 0);
2307
+ else if (e === "geometria.y") i = k(0, a - r.y);
2308
+ else if (e === "geometria.largura" && a > 0 && r.largura > 0) i = H(a / r.largura, 1, [r.x, r.y]);
2309
+ else if (e === "geometria.altura" && a > 0 && r.altura > 0) i = H(1, a / r.altura, [r.x, r.y]);
2310
+ else if (e === "geometria.rotacao")
2269
2311
  return t.map((o) => {
2270
- const s = W(o);
2312
+ const s = Y(o);
2271
2313
  if (!s) return o;
2272
- const n = (e - er(o)) * Math.PI / 180;
2273
- return se(o, Pa(n, [s.x + s.largura / 2, s.y + s.altura / 2]));
2314
+ const n = (a - hr(o)) * Math.PI / 180;
2315
+ return ue(o, za(n, [s.x + s.largura / 2, s.y + s.altura / 2]));
2274
2316
  });
2275
- return i ? T(t, i) : null;
2317
+ return i ? I(t, i) : null;
2276
2318
  }
2277
- function Ei(t, a, e) {
2319
+ function qi(t, e, a) {
2278
2320
  if (t.somenteLeitura)
2279
2321
  return t.recusar("propriedade", "somente-leitura"), !1;
2280
- if (!Qt(a))
2322
+ if (!cr(e))
2281
2323
  return t.recusar("propriedade", "comando-desconhecido"), !1;
2282
2324
  const r = t.doc.elementosSelecionados();
2283
2325
  if (r.length === 0)
2284
2326
  return t.recusar("propriedade", "sem-selecao"), !1;
2285
- const i = a === "elemento.bloqueado" || a === "elemento.oculto" ? r : r.filter((s) => !t.mapa().travado(s));
2327
+ const i = e === "elemento.bloqueado" || e === "elemento.oculto" ? r : r.filter((s) => !t.mapa().travado(s));
2286
2328
  if (i.length === 0)
2287
2329
  return t.recusar("propriedade", "bloqueado"), !1;
2288
- if (a === "geometria.raio") {
2289
- const s = Ja(e);
2290
- return s === null || s < 0 ? (t.recusar("propriedade", "geometria-invalida"), !1) : Pe(t, s);
2330
+ if (e === "geometria.raio") {
2331
+ const s = ae(a);
2332
+ return s === null || s < 0 ? (t.recusar("propriedade", "geometria-invalida"), !1) : Ee(t, s);
2291
2333
  }
2292
2334
  let o;
2293
- if (Yt(a)) {
2294
- const s = Ja(e);
2295
- o = s === null ? null : zi(i, a, s);
2335
+ if (ur(e)) {
2336
+ const s = ae(a);
2337
+ o = s === null ? null : ki(i, e, s);
2296
2338
  } else {
2297
- const s = i.map((n) => ar(n, a, e));
2339
+ const s = i.map((n) => dr(n, e, a));
2298
2340
  o = s.every((n) => n !== null) ? s : null;
2299
2341
  }
2300
- return o ? (t.aplicarSubstituicoes(o, "propriedades", `propriedade:${a}`), !0) : (t.recusar("propriedade", "geometria-invalida"), !1);
2342
+ return o ? (t.aplicarSubstituicoes(o, "propriedades", `propriedade:${e}`), !0) : (t.recusar("propriedade", "geometria-invalida"), !1);
2301
2343
  }
2302
- function xi(t, a, e) {
2344
+ function Bi(t, e, a) {
2303
2345
  if (t.somenteLeitura)
2304
2346
  return t.recusar("alterar", "somente-leitura"), !1;
2305
- if (!e || typeof e != "object" || !Array.isArray(a))
2347
+ if (!a || typeof a != "object" || !Array.isArray(e))
2306
2348
  return t.recusar("alterar", "geometria-invalida"), !1;
2307
- const r = a.map((o) => typeof o == "string" ? t.doc.obter(o) : void 0).filter((o) => !!o);
2308
- if (r.length === 0 || e.camadaId !== void 0 && e.camadaId !== null && !t.camadas.some((o) => o.id === e.camadaId))
2349
+ const r = e.map((o) => typeof o == "string" ? t.doc.obter(o) : void 0).filter((o) => !!o);
2350
+ if (r.length === 0 || a.camadaId !== void 0 && a.camadaId !== null && !t.camadas.some((o) => o.id === a.camadaId))
2309
2351
  return t.recusar("alterar", "id-invalido"), !1;
2310
2352
  const i = r.map((o) => {
2311
2353
  const s = { ...o };
2312
- e.nome !== void 0 && (typeof e.nome == "string" && e.nome.trim() !== "" ? s.nome = e.nome : delete s.nome);
2354
+ a.nome !== void 0 && (typeof a.nome == "string" && a.nome.trim() !== "" ? s.nome = a.nome : delete s.nome);
2313
2355
  for (const n of ["oculto", "bloqueado"])
2314
- typeof e[n] == "boolean" && (e[n] ? s[n] = !0 : delete s[n]);
2315
- return e.camadaId !== void 0 && (e.camadaId ? s.camadaId = e.camadaId : delete s.camadaId), s;
2356
+ typeof a[n] == "boolean" && (a[n] ? s[n] = !0 : delete s[n]);
2357
+ return a.camadaId !== void 0 && (a.camadaId ? s.camadaId = a.camadaId : delete s.camadaId), s;
2316
2358
  });
2317
2359
  return t.aplicarSubstituicoes(i, "propriedades"), !0;
2318
2360
  }
2319
- const Ci = {
2361
+ const ji = {
2320
2362
  retangulo: "Retângulo",
2321
2363
  elipse: "Elipse",
2322
2364
  "poligono-regular": "Polígono",
@@ -2324,10 +2366,10 @@ const Ci = {
2324
2366
  linha: "Linha",
2325
2367
  caminho: "Caminho",
2326
2368
  texto: "Texto"
2327
- }, je = (t) => {
2328
- var a;
2329
- return Ci[(a = t == null ? void 0 : t.geometria) == null ? void 0 : a.tipo] ?? "Elemento";
2330
- }, Ti = {
2369
+ }, Ue = (t) => {
2370
+ var e;
2371
+ return ji[(e = t == null ? void 0 : t.geometria) == null ? void 0 : e.tipo] ?? "Elemento";
2372
+ }, Gi = {
2331
2373
  normal: "Normal",
2332
2374
  multiplicar: "Multiplicar",
2333
2375
  tela: "Tela",
@@ -2344,129 +2386,129 @@ const Ci = {
2344
2386
  saturacao: "Saturação",
2345
2387
  cor: "Cor",
2346
2388
  luminosidade: "Luminosidade"
2347
- }, wi = {
2389
+ }, Hi = {
2348
2390
  continua: "Contínua",
2349
2391
  tracejada: "Tracejada",
2350
2392
  "tracejada-curta": "Tracejada curta",
2351
2393
  "tracejada-longa": "Tracejada longa",
2352
2394
  pontilhada: "Pontilhada",
2353
2395
  "traco-ponto": "Traço-ponto"
2354
- }, X = (t) => t.map(([a, e]) => ({ id: a, rotulo: e })), Qa = X([["nenhuma", "Nenhuma"], ["triangulo", "Triângulo"], ["triangulo-aberto", "Triângulo vazado"], ["aberta", "Aberta"], ["circulo", "Círculo"], ["quadrado", "Quadrado"], ["losango", "Losango"], ["barra", "Barra"]]);
2355
- function g(t, a, e, r, i = {}) {
2356
- const o = t.map((l) => rr(l, a)).filter((l) => l !== void 0);
2396
+ }, J = (t) => t.map(([e, a]) => ({ id: e, rotulo: a })), ee = J([["nenhuma", "Nenhuma"], ["triangulo", "Triângulo"], ["triangulo-aberto", "Triângulo vazado"], ["aberta", "Aberta"], ["circulo", "Círculo"], ["quadrado", "Quadrado"], ["losango", "Losango"], ["barra", "Barra"]]);
2397
+ function g(t, e, a, r, i = {}) {
2398
+ const o = t.map((l) => fr(l, e)).filter((l) => l !== void 0);
2357
2399
  if (o.length === 0) return null;
2358
2400
  const s = (l) => JSON.stringify(l);
2359
- return o.every((l) => s(l) === s(o[0])) && o[0] !== null ? { id: a, rotulo: e, tipo: r, valor: o[0], ...i } : { id: a, rotulo: e, tipo: r, valor: null, misto: !0, ...i };
2401
+ return o.every((l) => s(l) === s(o[0])) && o[0] !== null ? { id: e, rotulo: a, tipo: r, valor: o[0], ...i } : { id: e, rotulo: a, tipo: r, valor: null, misto: !0, ...i };
2360
2402
  }
2361
- const E = { unidade: "mm", casasDecimais: 2, passo: 0.5 }, ea = { unidade: "%", casasDecimais: 0, passo: 5, min: 0, max: 100 }, R = (t) => t.filter((a) => a !== null);
2362
- function Ii(t) {
2363
- let a = 1 / 0, e = 1 / 0, r = -1 / 0, i = -1 / 0;
2403
+ const w = { unidade: "mm", casasDecimais: 2, passo: 0.5 }, ia = { unidade: "%", casasDecimais: 0, passo: 5, min: 0, max: 100 }, B = (t) => t.filter((e) => e !== null);
2404
+ function $i(t) {
2405
+ let e = 1 / 0, a = 1 / 0, r = -1 / 0, i = -1 / 0;
2364
2406
  for (const n of t) {
2365
- const l = W(n);
2366
- l && (a = Math.min(a, l.x), e = Math.min(e, l.y), r = Math.max(r, l.x + l.largura), i = Math.max(i, l.y + l.altura));
2367
- }
2368
- const o = (n) => Math.round(n * 1e6) / 1e6, s = Number.isFinite(a) ? [
2369
- { id: "geometria.x", rotulo: "X", tipo: "numero", valor: o(a), ...E },
2370
- { id: "geometria.y", rotulo: "Y", tipo: "numero", valor: o(e), ...E },
2371
- { id: "geometria.largura", rotulo: "Largura", tipo: "numero", valor: o(r - a), ...E, min: 0 },
2372
- { id: "geometria.altura", rotulo: "Altura", tipo: "numero", valor: o(i - e), ...E, min: 0 }
2407
+ const l = Y(n);
2408
+ l && (e = Math.min(e, l.x), a = Math.min(a, l.y), r = Math.max(r, l.x + l.largura), i = Math.max(i, l.y + l.altura));
2409
+ }
2410
+ const o = (n) => Math.round(n * 1e6) / 1e6, s = Number.isFinite(e) ? [
2411
+ { id: "geometria.x", rotulo: "X", tipo: "numero", valor: o(e), ...w },
2412
+ { id: "geometria.y", rotulo: "Y", tipo: "numero", valor: o(a), ...w },
2413
+ { id: "geometria.largura", rotulo: "Largura", tipo: "numero", valor: o(r - e), ...w, min: 0 },
2414
+ { id: "geometria.altura", rotulo: "Altura", tipo: "numero", valor: o(i - a), ...w, min: 0 }
2373
2415
  ] : [];
2374
- return s.push(g(t, "geometria.rotacao", "Rotação", "numero", { unidade: "°", casasDecimais: 2, passo: 15 })), t.every((n) => n.geometria.tipo === "retangulo") && s.push(g(t, "geometria.raio", "Raio dos cantos", "numero", { ...E, min: 0 })), R(s);
2416
+ return s.push(g(t, "geometria.rotacao", "Rotação", "numero", { unidade: "°", casasDecimais: 2, passo: 15 })), t.every((n) => n.geometria.tipo === "retangulo") && s.push(g(t, "geometria.raio", "Raio dos cantos", "numero", { ...w, min: 0 })), B(s);
2375
2417
  }
2376
- const I = (t) => String(Math.round(t * 100) / 100).replace(".", ",");
2377
- function Di(t) {
2378
- const a = t && Number.isFinite(t.largura) && Number.isFinite(t.altura) ? t : null, e = [{ id: "dica", rotulo: "Seleção", tipo: "readonly", valor: "Nada selecionado", dica: "Selecione um elemento para editar: clique nele ou arraste um retângulo de seleção." }];
2379
- if (a) {
2380
- e.push({ id: "folha.tamanho", rotulo: "Folha", tipo: "readonly", valor: `${I(a.largura)} × ${I(a.altura)} mm` }), a.unidade && e.push({ id: "folha.unidade", rotulo: "Unidade", tipo: "readonly", valor: a.unidade }), Number.isFinite(a.grade) && e.push({ id: "folha.grade", rotulo: "Grade", tipo: "readonly", valor: `${I(a.grade)} mm` });
2381
- const r = a.margens;
2382
- r && e.push({ id: "folha.margens", rotulo: "Margens", tipo: "readonly", valor: `${I(r.esquerda)} / ${I(r.direita)} / ${I(r.superior)} / ${I(r.inferior)} mm`, dica: "esquerda / direita / superior / inferior" });
2418
+ const N = (t) => String(Math.round(t * 100) / 100).replace(".", ",");
2419
+ function Vi(t) {
2420
+ const e = t && Number.isFinite(t.largura) && Number.isFinite(t.altura) ? t : null, a = [{ id: "dica", rotulo: "Seleção", tipo: "readonly", valor: "Nada selecionado", dica: "Selecione um elemento para editar: clique nele ou arraste um retângulo de seleção." }];
2421
+ if (e) {
2422
+ a.push({ id: "folha.tamanho", rotulo: "Folha", tipo: "readonly", valor: `${N(e.largura)} × ${N(e.altura)} mm` }), e.unidade && a.push({ id: "folha.unidade", rotulo: "Unidade", tipo: "readonly", valor: e.unidade }), Number.isFinite(e.grade) && a.push({ id: "folha.grade", rotulo: "Grade", tipo: "readonly", valor: `${N(e.grade)} mm` });
2423
+ const r = e.margens;
2424
+ r && a.push({ id: "folha.margens", rotulo: "Margens", tipo: "readonly", valor: `${N(r.esquerda)} / ${N(r.direita)} / ${N(r.superior)} / ${N(r.inferior)} mm`, dica: "esquerda / direita / superior / inferior" });
2383
2425
  }
2384
- return [{ id: "folha", titulo: "Folha", aberto: !0, propriedades: e }];
2426
+ return [{ id: "folha", titulo: "Folha", aberto: !0, propriedades: a }];
2385
2427
  }
2386
- function _i(t) {
2387
- const a = Array.isArray(t) ? t.filter((l) => l && typeof l == "object" && l.geometria) : [];
2388
- if (a.length === 0) return [];
2389
- const e = a.filter((l) => l.geometria.tipo === "texto"), r = a.filter((l) => {
2428
+ function Ki(t) {
2429
+ const e = Array.isArray(t) ? t.filter((l) => l && typeof l == "object" && l.geometria) : [];
2430
+ if (e.length === 0) return [];
2431
+ const a = e.filter((l) => l.geometria.tipo === "texto"), r = e.filter((l) => {
2390
2432
  var c;
2391
- return l.geometria.tipo !== "texto" && ((c = za(l)) == null ? void 0 : c.tipo) === "Polygon";
2392
- }), i = a.length > e.length, o = a.length === 1 ? je(a[0]) : `${a.length} elementos`, s = [
2433
+ return l.geometria.tipo !== "texto" && ((c = Ca(l)) == null ? void 0 : c.tipo) === "Polygon";
2434
+ }), i = e.length > a.length, o = e.length === 1 ? Ue(e[0]) : `${e.length} elementos`, s = [
2393
2435
  {
2394
2436
  id: "elemento",
2395
2437
  titulo: "Elemento",
2396
2438
  aberto: !0,
2397
- propriedades: R([
2439
+ propriedades: B([
2398
2440
  { id: "elemento.tipo", rotulo: "Tipo", tipo: "readonly", valor: o },
2399
- g(a, "elemento.nome", "Nome", "texto"),
2400
- g(a, "elemento.bloqueado", "Bloqueado", "booleano"),
2401
- g(a, "elemento.oculto", "Oculto", "booleano")
2441
+ g(e, "elemento.nome", "Nome", "texto"),
2442
+ g(e, "elemento.bloqueado", "Bloqueado", "booleano"),
2443
+ g(e, "elemento.oculto", "Oculto", "booleano")
2402
2444
  ])
2403
2445
  },
2404
- { id: "geometria", titulo: "Posição e tamanho", aberto: !0, propriedades: Ii(a) }
2446
+ { id: "geometria", titulo: "Posição e tamanho", aberto: !0, propriedades: $i(e) }
2405
2447
  ];
2406
2448
  if (i) {
2407
- const l = a.filter((c) => c.geometria.tipo !== "texto");
2449
+ const l = e.filter((c) => c.geometria.tipo !== "texto");
2408
2450
  s.push({
2409
2451
  id: "traco",
2410
2452
  titulo: "Traço",
2411
2453
  aberto: !0,
2412
- propriedades: R([
2454
+ propriedades: B([
2413
2455
  g(l, "traco.ativo", "Com traço", "booleano"),
2414
2456
  g(l, "traco.cor", "Cor", "cor"),
2415
- g(l, "traco.espessura", "Espessura", "numero", { ...E, passo: 0.05, min: 0 }),
2416
- g(l, "traco.opacidade", "Opacidade", "numero", ea),
2417
- g(l, "traco.tipoLinha", "Tipo de linha", "linha", { opcoes: sr.map((c) => ({ id: c, rotulo: wi[c] ?? c })) }),
2457
+ g(l, "traco.espessura", "Espessura", "numero", { ...w, passo: 0.05, min: 0 }),
2458
+ g(l, "traco.opacidade", "Opacidade", "numero", ia),
2459
+ g(l, "traco.tipoLinha", "Tipo de linha", "linha", { opcoes: vr.map((c) => ({ id: c, rotulo: Hi[c] ?? c })) }),
2418
2460
  g(l, "traco.escalaTipoLinha", "Escala da linha", "numero", { casasDecimais: 2, passo: 0.1, min: 0 }),
2419
- g(l, "traco.terminacao", "Terminação", "selecao", { opcoes: X([["reta", "Reta"], ["arredondada", "Arredondada"], ["quadrada", "Quadrada"]]) }),
2420
- g(l, "traco.juncao", "Junção", "selecao", { opcoes: X([["angular", "Angular"], ["arredondada", "Arredondada"], ["chanfrada", "Chanfrada"]]) }),
2421
- r.length === l.length ? g(l, "traco.alinhamento", "Alinhamento", "selecao", { opcoes: X([["centro", "Centro"], ["dentro", "Dentro"], ["fora", "Fora"]]) }) : null,
2422
- r.length === 0 ? g(l, "traco.pontaInicio", "Ponta inicial", "selecao", { opcoes: Qa }) : null,
2423
- r.length === 0 ? g(l, "traco.pontaFim", "Ponta final", "selecao", { opcoes: Qa }) : null
2461
+ g(l, "traco.terminacao", "Terminação", "selecao", { opcoes: J([["reta", "Reta"], ["arredondada", "Arredondada"], ["quadrada", "Quadrada"]]) }),
2462
+ g(l, "traco.juncao", "Junção", "selecao", { opcoes: J([["angular", "Angular"], ["arredondada", "Arredondada"], ["chanfrada", "Chanfrada"]]) }),
2463
+ r.length === l.length ? g(l, "traco.alinhamento", "Alinhamento", "selecao", { opcoes: J([["centro", "Centro"], ["dentro", "Dentro"], ["fora", "Fora"]]) }) : null,
2464
+ r.length === 0 ? g(l, "traco.pontaInicio", "Ponta inicial", "selecao", { opcoes: ee }) : null,
2465
+ r.length === 0 ? g(l, "traco.pontaFim", "Ponta final", "selecao", { opcoes: ee }) : null
2424
2466
  ])
2425
2467
  });
2426
2468
  }
2427
- return [...r, ...e].length === a.length && s.push({
2469
+ return [...r, ...a].length === e.length && s.push({
2428
2470
  id: "preenchimento",
2429
2471
  titulo: "Preenchimento",
2430
2472
  aberto: !0,
2431
- propriedades: R([
2432
- g(a, "preenchimento.ativo", "Com preenchimento", "booleano"),
2433
- g(a, "preenchimento.cor", "Cor", "cor"),
2434
- g(a, "preenchimento.opacidade", "Opacidade", "numero", ea),
2435
- e.length === 0 ? g(a, "preenchimento.regra", "Regra", "selecao", { opcoes: X([["nonzero", "Diferente de zero"], ["evenodd", "Par-ímpar"]]) }) : null
2473
+ propriedades: B([
2474
+ g(e, "preenchimento.ativo", "Com preenchimento", "booleano"),
2475
+ g(e, "preenchimento.cor", "Cor", "cor"),
2476
+ g(e, "preenchimento.opacidade", "Opacidade", "numero", ia),
2477
+ a.length === 0 ? g(e, "preenchimento.regra", "Regra", "selecao", { opcoes: J([["nonzero", "Diferente de zero"], ["evenodd", "Par-ímpar"]]) }) : null
2436
2478
  ])
2437
- }), r.length === a.length && s.push({
2479
+ }), r.length === e.length && s.push({
2438
2480
  id: "hachura",
2439
2481
  titulo: "Hachura",
2440
2482
  aberto: !1,
2441
- propriedades: R([
2442
- g(a, "hachura.ativa", "Com hachura", "booleano"),
2443
- g(a, "hachura.angulo", "Ângulo", "numero", { unidade: "°", casasDecimais: 1, passo: 15 }),
2444
- g(a, "hachura.espacamento", "Espaçamento", "numero", { ...E, min: 0.1 }),
2445
- g(a, "hachura.cor", "Cor", "cor"),
2446
- g(a, "hachura.cruzada", "Cruzada", "booleano")
2483
+ propriedades: B([
2484
+ g(e, "hachura.ativa", "Com hachura", "booleano"),
2485
+ g(e, "hachura.angulo", "Ângulo", "numero", { unidade: "°", casasDecimais: 1, passo: 15 }),
2486
+ g(e, "hachura.espacamento", "Espaçamento", "numero", { ...w, min: 0.1 }),
2487
+ g(e, "hachura.cor", "Cor", "cor"),
2488
+ g(e, "hachura.cruzada", "Cruzada", "booleano")
2447
2489
  ])
2448
2490
  }), s.push({
2449
2491
  id: "efeitos",
2450
2492
  titulo: "Efeitos",
2451
2493
  aberto: !1,
2452
- propriedades: R([
2453
- g(a, "efeitos.opacidade", "Opacidade", "numero", ea),
2454
- g(a, "efeitos.mesclagem", "Mesclagem", "selecao", { opcoes: tr.map((l) => ({ id: l, rotulo: Ti[l] })) }),
2455
- g(a, "sombra.ativa", "Sombra", "booleano"),
2456
- g(a, "sombra.dx", "Sombra X", "numero", E),
2457
- g(a, "sombra.dy", "Sombra Y", "numero", E),
2458
- g(a, "sombra.desfoque", "Desfoque", "numero", { ...E, min: 0 }),
2459
- g(a, "sombra.cor", "Cor da sombra", "cor"),
2460
- g(a, "sombra.opacidade", "Opacidade da sombra", "numero", ea)
2494
+ propriedades: B([
2495
+ g(e, "efeitos.opacidade", "Opacidade", "numero", ia),
2496
+ g(e, "efeitos.mesclagem", "Mesclagem", "selecao", { opcoes: mr.map((l) => ({ id: l, rotulo: Gi[l] })) }),
2497
+ g(e, "sombra.ativa", "Sombra", "booleano"),
2498
+ g(e, "sombra.dx", "Sombra X", "numero", w),
2499
+ g(e, "sombra.dy", "Sombra Y", "numero", w),
2500
+ g(e, "sombra.desfoque", "Desfoque", "numero", { ...w, min: 0 }),
2501
+ g(e, "sombra.cor", "Cor da sombra", "cor"),
2502
+ g(e, "sombra.opacidade", "Opacidade da sombra", "numero", ia)
2461
2503
  ])
2462
2504
  }), s.filter((l) => l.propriedades.length > 0);
2463
2505
  }
2464
- const O = "prancha:sem-camada", Ya = (t) => typeof t == "string" && t !== O ? t : null;
2465
- function Fi(t, a = [], e = {}) {
2466
- const r = Array.isArray(t) ? t.filter((u) => u && typeof u == "object" && u.geometria) : [], i = Array.isArray(a) ? a.filter((u) => u && typeof u.id == "string") : [], o = new Set(i.map((u) => u.id)), s = i.length === 0 && ((e == null ? void 0 : e.ocultarSemCamada) === !0 || (e == null ? void 0 : e.modo) === "simples"), n = (u) => u.camadaId && o.has(u.camadaId) ? u.camadaId : s ? "" : O, l = /* @__PURE__ */ new Map();
2506
+ const G = "prancha:sem-camada", te = (t) => typeof t == "string" && t !== G ? t : null;
2507
+ function Wi(t, e = [], a = {}) {
2508
+ const r = Array.isArray(t) ? t.filter((u) => u && typeof u == "object" && u.geometria) : [], i = Array.isArray(e) ? e.filter((u) => u && typeof u.id == "string") : [], o = new Set(i.map((u) => u.id)), s = i.length === 0 && ((a == null ? void 0 : a.ocultarSemCamada) === !0 || (a == null ? void 0 : a.modo) === "simples"), n = (u) => u.camadaId && o.has(u.camadaId) ? u.camadaId : s ? "" : G, l = /* @__PURE__ */ new Map();
2467
2509
  for (const u of r) l.set(n(u), (l.get(n(u)) ?? 0) + 1);
2468
2510
  const c = [];
2469
- !s && (l.has(O) || i.length === 0) && c.push({ id: O, name: "Sem camada", visible: !0, locked: !1, opacity: 1, order: 0, count: l.get(O) ?? 0 });
2511
+ !s && (l.has(G) || i.length === 0) && c.push({ id: G, name: "Sem camada", visible: !0, locked: !1, opacity: 1, order: 0, count: l.get(G) ?? 0 });
2470
2512
  for (const u of [...i].reverse())
2471
2513
  c.push({
2472
2514
  id: u.id,
@@ -2477,19 +2519,19 @@ function Fi(t, a = [], e = {}) {
2477
2519
  order: c.length,
2478
2520
  count: l.get(u.id) ?? 0
2479
2521
  });
2480
- const d = /* @__PURE__ */ new Map(), h = [...$(r, i)].reverse().map((u) => {
2481
- var x, C, B;
2482
- const f = je(u);
2522
+ const d = /* @__PURE__ */ new Map(), h = [...U(r, i)].reverse().map((u) => {
2523
+ var C, T, P;
2524
+ const f = Ue(u);
2483
2525
  let p = u.nome;
2484
2526
  if (!p) {
2485
- const K = (d.get(f) ?? 0) + 1;
2486
- d.set(f, K), p = `${f} ${K}`;
2527
+ const _ = (d.get(f) ?? 0) + 1;
2528
+ d.set(f, _), p = `${f} ${_}`;
2487
2529
  }
2488
- const b = u.geometria.tipo === "texto" ? "Text" : ((x = za(u)) == null ? void 0 : x.tipo) === "Polygon" ? "Polygon" : "LineString";
2530
+ const b = u.geometria.tipo === "texto" ? "Text" : ((C = Ca(u)) == null ? void 0 : C.tipo) === "Polygon" ? "Polygon" : "LineString";
2489
2531
  let M;
2490
2532
  try {
2491
- const K = ir(u);
2492
- M = ((C = K.preenchimento) == null ? void 0 : C.cor) ?? ((B = K.traco) == null ? void 0 : B.cor);
2533
+ const _ = pr(u);
2534
+ M = ((T = _.preenchimento) == null ? void 0 : T.cor) ?? ((P = _.traco) == null ? void 0 : P.cor);
2493
2535
  } catch {
2494
2536
  M = void 0;
2495
2537
  }
@@ -2497,158 +2539,158 @@ function Fi(t, a = [], e = {}) {
2497
2539
  });
2498
2540
  return { camadas: c, feicoes: h };
2499
2541
  }
2500
- function ki(t, a, e) {
2542
+ function Ui(t, e, a) {
2501
2543
  const r = Array.isArray(t) ? t : [];
2502
- return !e || typeof e != "object" ? [...r] : r.map((i) => {
2503
- if (i.id !== a) return i;
2544
+ return !a || typeof a != "object" ? [...r] : r.map((i) => {
2545
+ if (i.id !== e) return i;
2504
2546
  const o = { ...i };
2505
- return typeof e.visivel == "boolean" && (o.visivel = e.visivel), typeof e.bloqueada == "boolean" && (o.bloqueada = e.bloqueada), typeof e.opacidade == "number" && Number.isFinite(e.opacidade) && (o.opacidade = Math.min(1, Math.max(0, e.opacidade))), typeof e.nome == "string" && e.nome.trim() !== "" && (o.nome = e.nome), o;
2547
+ return typeof a.visivel == "boolean" && (o.visivel = a.visivel), typeof a.bloqueada == "boolean" && (o.bloqueada = a.bloqueada), typeof a.opacidade == "number" && Number.isFinite(a.opacidade) && (o.opacidade = Math.min(1, Math.max(0, a.opacidade))), typeof a.nome == "string" && a.nome.trim() !== "" && (o.nome = a.nome), o;
2506
2548
  });
2507
2549
  }
2508
- function Li(t, a) {
2509
- const e = Array.isArray(t) ? t : [], r = new Map(e.map((n) => [n.id, n])), i = /* @__PURE__ */ new Set(), o = [];
2510
- for (const n of Array.isArray(a) ? a : []) {
2550
+ function Xi(t, e) {
2551
+ const a = Array.isArray(t) ? t : [], r = new Map(a.map((n) => [n.id, n])), i = /* @__PURE__ */ new Set(), o = [];
2552
+ for (const n of Array.isArray(e) ? e : []) {
2511
2553
  const l = typeof n == "string" ? r.get(n) : void 0;
2512
2554
  l && !i.has(l.id) && (i.add(l.id), o.push(l));
2513
2555
  }
2514
- return [...e.filter((n) => !i.has(n.id)), ...o.reverse()];
2556
+ return [...a.filter((n) => !i.has(n.id)), ...o.reverse()];
2515
2557
  }
2516
- class Ri extends Si {
2558
+ class Zi extends Ri {
2517
2559
  static get observedAttributes() {
2518
- return qe;
2560
+ return Ke;
2519
2561
  }
2520
2562
  // ---------- camadas e isolamento ----------
2521
2563
  /** Camadas da prancha (a primeira fica atrás). Elementos sem camada ficam por cima. */
2522
- definirCamadas(a) {
2523
- this.c.definirCamadas(a);
2564
+ definirCamadas(e) {
2565
+ this.c.definirCamadas(e);
2524
2566
  }
2525
2567
  obterCamadas() {
2526
- return this.c.camadas.map((a) => ({ ...a }));
2568
+ return this.c.camadas.map((e) => ({ ...e }));
2527
2569
  }
2528
2570
  /** Camada que recebe os elementos novos (desenhados, colados, pré-definições); `null` = sem camada. */
2529
- definirCamadaAtiva(a) {
2530
- this.c.camadaAtiva = typeof a == "string" && this.c.camadas.some((e) => e.id === a) ? a : null;
2571
+ definirCamadaAtiva(e) {
2572
+ this.c.camadaAtiva = typeof e == "string" && this.c.camadas.some((a) => a.id === e) ? e : null;
2531
2573
  }
2532
- moverSelecaoParaCamada(a) {
2533
- return Rr(this.c, a);
2574
+ moverSelecaoParaCamada(e) {
2575
+ return Ur(this.c, e);
2534
2576
  }
2535
2577
  /** Isola um grupo (só os membros se selecionam) ou sai do isolamento com `null`. */
2536
- isolarGrupo(a) {
2537
- this.c.isolar(a);
2578
+ isolarGrupo(e) {
2579
+ this.c.isolar(e);
2538
2580
  }
2539
2581
  // ---------- ordem, grupos, bloquear e ocultar ----------
2540
- ordenarSelecao(a) {
2541
- return D(this.c, a);
2582
+ ordenarSelecao(e) {
2583
+ return O(this.c, e);
2542
2584
  }
2543
2585
  trazerParaFrente() {
2544
- return D(this.c, "frente");
2586
+ return O(this.c, "frente");
2545
2587
  }
2546
2588
  enviarParaTras() {
2547
- return D(this.c, "tras");
2589
+ return O(this.c, "tras");
2548
2590
  }
2549
2591
  avancar() {
2550
- return D(this.c, "avancar");
2592
+ return O(this.c, "avancar");
2551
2593
  }
2552
2594
  recuar() {
2553
- return D(this.c, "recuar");
2595
+ return O(this.c, "recuar");
2554
2596
  }
2555
2597
  agruparSelecao() {
2556
- return Me(this.c);
2598
+ return Te(this.c);
2557
2599
  }
2558
2600
  desagruparSelecao() {
2559
- return ze(this.c);
2601
+ return we(this.c);
2560
2602
  }
2561
2603
  bloquearSelecao() {
2562
- return la(this.c, "bloqueado");
2604
+ return ua(this.c, "bloqueado");
2563
2605
  }
2564
2606
  ocultarSelecao() {
2565
- return la(this.c, "oculto");
2607
+ return ua(this.c, "oculto");
2566
2608
  }
2567
2609
  desbloquearTudo() {
2568
- return ca(this.c, "bloqueado");
2610
+ return da(this.c, "bloqueado");
2569
2611
  }
2570
2612
  mostrarTudo() {
2571
- return ca(this.c, "oculto");
2613
+ return da(this.c, "oculto");
2572
2614
  }
2573
2615
  // ---------- alinhar, distribuir, duplicar ----------
2574
2616
  /** Alinha à seleção, à folha, ao primeiro selecionado (`'chave'`) ou a uma caixa em mm (as margens, o quadro). */
2575
- alinharSelecao(a, e = "selecao") {
2576
- return Dr(this.c, a, e);
2617
+ alinharSelecao(e, a = "selecao") {
2618
+ return Hr(this.c, e, a);
2577
2619
  }
2578
2620
  /** Distribui centros ou espaços (iguais, ou `espacamento` fixo em mm). */
2579
- distribuirSelecao(a, e = "espacos", r) {
2580
- return _r(this.c, a, e, r);
2621
+ distribuirSelecao(e, a = "espacos", r) {
2622
+ return $r(this.c, e, a, r);
2581
2623
  }
2582
- duplicarSelecao(a) {
2583
- return Fr(this.c, a);
2624
+ duplicarSelecao(e) {
2625
+ return Vr(this.c, e);
2584
2626
  }
2585
2627
  /** Ctrl+D: repete a última transformação (duplicando, se ela foi uma cópia). */
2586
2628
  transformarDeNovo() {
2587
- return Ee(this.c);
2629
+ return De(this.c);
2588
2630
  }
2589
2631
  // ---------- área de transferência e aparência ----------
2590
2632
  copiar() {
2591
- return Ca(this.c);
2633
+ return Da(this.c);
2592
2634
  }
2593
2635
  recortar() {
2594
- return xe(this.c);
2636
+ return Ie(this.c);
2595
2637
  }
2596
2638
  /** Cola deslocado a cada colagem, ou no mesmo lugar (`noLugar`). */
2597
- colar(a = !1) {
2598
- return Ce(this.c, a);
2639
+ colar(e = !1) {
2640
+ return Fe(this.c, e);
2599
2641
  }
2600
- aplicarAparencia(a) {
2601
- return Lr(this.c, a);
2642
+ aplicarAparencia(e) {
2643
+ return Wr(this.c, e);
2602
2644
  }
2603
2645
  // ---------- máscara e operações de caminho ----------
2604
2646
  criarMascara() {
2605
- return Te(this.c);
2647
+ return _e(this.c);
2606
2648
  }
2607
2649
  liberarMascara() {
2608
- return we(this.c);
2650
+ return Ne(this.c);
2609
2651
  }
2610
- unirSelecao(a) {
2611
- return Ie(this.c, a);
2652
+ unirSelecao(e) {
2653
+ return Oe(this.c, e);
2612
2654
  }
2613
2655
  dividirSelecao() {
2614
- return Or(this.c);
2656
+ return Xr(this.c);
2615
2657
  }
2616
2658
  /** Deslocar caminho (offset): cria um contorno novo a `distancia` mm (negativo = para dentro). */
2617
- deslocarCaminho(a) {
2618
- return qr(this.c, a);
2659
+ deslocarCaminho(e) {
2660
+ return Zr(this.c, e);
2619
2661
  }
2620
- simplificarSelecao(a) {
2621
- return Nr(this.c, a);
2662
+ simplificarSelecao(e) {
2663
+ return Jr(this.c, e);
2622
2664
  }
2623
2665
  contornarTraco() {
2624
- return jr(this.c);
2666
+ return Qr(this.c);
2625
2667
  }
2626
2668
  converterEmCaminho() {
2627
- return Gr(this.c);
2669
+ return Yr(this.c);
2628
2670
  }
2629
2671
  // ---------- Pathfinder (Fase 5) ----------
2630
2672
  /**
2631
2673
  * Operação booleana sobre a seleção: `'uniao'`, `'subtracao'` (o mais atrás menos os outros), `'intersecao'` ou
2632
2674
  * `'exclusao'`. O resultado é um caminho composto com o id e a aparência do mais à frente (na subtração, do mais atrás).
2633
2675
  */
2634
- pathfinder(a) {
2635
- return L(this.c, a);
2676
+ pathfinder(e) {
2677
+ return q(this.c, e);
2636
2678
  }
2637
2679
  /** Ctrl+Alt+Shift+1. */
2638
2680
  unirFormas() {
2639
- return L(this.c, "uniao");
2681
+ return q(this.c, "uniao");
2640
2682
  }
2641
2683
  /** Ctrl+Alt+Shift+2 ("menos frente"). */
2642
2684
  subtrairFrente() {
2643
- return L(this.c, "subtracao");
2685
+ return q(this.c, "subtracao");
2644
2686
  }
2645
2687
  /** Ctrl+Alt+Shift+3. */
2646
2688
  intersectarFormas() {
2647
- return L(this.c, "intersecao");
2689
+ return q(this.c, "intersecao");
2648
2690
  }
2649
2691
  /** Ctrl+Alt+Shift+4. */
2650
2692
  excluirSobreposicao() {
2651
- return L(this.c, "exclusao");
2693
+ return q(this.c, "exclusao");
2652
2694
  }
2653
2695
  // ---------- painéis (Fase 6) ----------
2654
2696
  /**
@@ -2656,27 +2698,27 @@ class Ri extends Si {
2656
2698
  * grade, margens, somente leitura) com a dica "Selecione um elemento para editar", em vez de um painel vazio.
2657
2699
  */
2658
2700
  categoriasDePropriedades() {
2659
- const a = this.c.doc.elementosSelecionados();
2660
- return a.length > 0 ? _i(a) : Di({ largura: this.c.folha.largura, altura: this.c.folha.altura, unidade: this.c.unidade, grade: this.c.grade, margens: this.c.margens });
2701
+ const e = this.c.doc.elementosSelecionados();
2702
+ return e.length > 0 ? Ki(e) : Vi({ largura: this.c.folha.largura, altura: this.c.folha.altura, unidade: this.c.unidade, grade: this.c.grade, margens: this.c.margens });
2661
2703
  }
2662
2704
  /**
2663
2705
  * Aplica um campo do painel de propriedades à seleção (o `id` e o `valor` do `ui-propriedade-alterada`). Ação do usuário:
2664
2706
  * histórico (rajada no mesmo campo = um passo) e `prancha-elemento-atualizado` com motivo `propriedades`.
2665
2707
  */
2666
- aplicarPropriedade(a, e) {
2667
- return Ei(this.c, a, e);
2708
+ aplicarPropriedade(e, a) {
2709
+ return qi(this.c, e, a);
2668
2710
  }
2669
2711
  /** Dados para o `<ui-camadas>` (`painel.definirCamadas(d.camadas, d.feicoes)`), da frente para trás. */
2670
- dadosParaPainelDeCamadas(a) {
2671
- return Fi(this.c.doc.elementos, this.c.camadas, a);
2712
+ dadosParaPainelDeCamadas(e) {
2713
+ return Wi(this.c.doc.elementos, this.c.camadas, e);
2672
2714
  }
2673
2715
  /** Oculta, trava, renomeia ou muda de camada elementos pelo id (o painel de camadas), inclusive travados. */
2674
- alterarElementos(a, e) {
2675
- return xi(this.c, a, e);
2716
+ alterarElementos(e, a) {
2717
+ return Bi(this.c, e, a);
2676
2718
  }
2677
2719
  }
2678
- ge("ui-canvas-prancha", Ri);
2679
- const A = (t) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`, ia = {
2720
+ Se("ui-canvas-prancha", Zi);
2721
+ const A = (t) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`, sa = {
2680
2722
  selecao: A('<path d="M5 3l14 8-6 2-3 6z" fill="currentColor"/>'),
2681
2723
  "selecao-direta": A('<path d="M5 3l14 8-6 2-3 6z"/>'),
2682
2724
  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"/>'),
@@ -2694,109 +2736,223 @@ const A = (t) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" str
2694
2736
  "adicionar-ancora": A('<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5"/><path d="M4 20h6M7 17v6"/>'),
2695
2737
  "excluir-ancora": A('<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5"/><path d="M4 20h6"/>'),
2696
2738
  "converter-ancora": A('<path d="M4 20L12 4l8 16"/><path d="M8 12h8"/>')
2697
- }, P = (t, a, e) => ({ id: t, rotulo: a, icone: ia[t], tipo: "ferramenta", ...e ? { atalho: e } : {} }), Oi = Object.freeze([
2698
- P("selecao", "Seleção", "V"),
2699
- P("selecao-direta", "Seleção direta", "A"),
2700
- { id: "grupo-caneta", rotulo: "Caneta", icone: ia.caneta, tipo: "ferramenta", filhos: [
2701
- P("caneta", "Caneta", "P"),
2702
- P("adicionar-ancora", "Adicionar âncora", "+"),
2703
- P("excluir-ancora", "Excluir âncora", "-"),
2704
- P("converter-ancora", "Converter âncora", "Shift+C")
2739
+ }, S = (t, e, a) => ({ id: t, rotulo: e, icone: sa[t], tipo: "ferramenta", ...a ? { atalho: a } : {} }), Ji = Object.freeze([
2740
+ S("selecao", "Seleção", "V"),
2741
+ S("selecao-direta", "Seleção direta", "A"),
2742
+ { id: "grupo-caneta", rotulo: "Caneta", icone: sa.caneta, tipo: "ferramenta", filhos: [
2743
+ S("caneta", "Caneta", "P"),
2744
+ S("adicionar-ancora", "Adicionar âncora", "+"),
2745
+ S("excluir-ancora", "Excluir âncora", "-"),
2746
+ S("converter-ancora", "Converter âncora", "Shift+C")
2705
2747
  ] },
2706
- P("texto", "Texto", "T"),
2707
- { id: "grupo-linhas", rotulo: "Linhas", icone: ia.linha, tipo: "ferramenta", filhos: [
2708
- P("linha", "Linha", "\\"),
2709
- P("seta", "Seta"),
2710
- P("polilinha", "Polilinha"),
2711
- P("poligono", "Polígono")
2748
+ S("texto", "Texto", "T"),
2749
+ { id: "grupo-linhas", rotulo: "Linhas", icone: sa.linha, tipo: "ferramenta", filhos: [
2750
+ S("linha", "Linha", "\\"),
2751
+ S("seta", "Seta"),
2752
+ S("polilinha", "Polilinha"),
2753
+ S("poligono", "Polígono")
2712
2754
  ] },
2713
- { id: "grupo-formas", rotulo: "Formas", icone: ia.retangulo, tipo: "ferramenta", filhos: [
2714
- P("retangulo", "Retângulo", "M"),
2715
- P("elipse", "Elipse", "L"),
2716
- P("poligono-regular", "Polígono regular"),
2717
- P("estrela", "Estrela")
2755
+ { id: "grupo-formas", rotulo: "Formas", icone: sa.retangulo, tipo: "ferramenta", filhos: [
2756
+ S("retangulo", "Retângulo", "M"),
2757
+ S("elipse", "Elipse", "L"),
2758
+ S("poligono-regular", "Polígono regular"),
2759
+ S("estrela", "Estrela")
2718
2760
  ] },
2719
- P("conta-gotas", "Conta-gotas", "I"),
2720
- P("mao", "Mão", "H")
2761
+ S("conta-gotas", "Conta-gotas", "I"),
2762
+ S("mao", "Mão", "H")
2721
2763
  ]);
2722
- function qi(t) {
2723
- return typeof t == "string" && Re.includes(t) ? t : null;
2764
+ function Qi(t) {
2765
+ return typeof t == "string" && $e.includes(t) ? t : null;
2724
2766
  }
2725
- const Ni = ["prancha-elemento-criado", "prancha-elemento-atualizado", "prancha-elemento-removido", "prancha-ordem", "prancha-camadas"], ji = (t) => t.detail ?? {};
2726
- function Gi(t) {
2727
- const { prancha: a, paleta: e, camadas: r, propriedades: i } = t ?? {};
2728
- if (!a) return () => {
2767
+ const Yi = ["prancha-elemento-criado", "prancha-elemento-atualizado", "prancha-elemento-removido", "prancha-ordem", "prancha-camadas"], ao = (t) => t.detail ?? {};
2768
+ function eo(t) {
2769
+ const { prancha: e, paleta: a, camadas: r, propriedades: i } = t ?? {};
2770
+ if (!e) return () => {
2729
2771
  };
2730
- const o = new Ea(), s = (h, u, f) => o.add(h, u, (p) => {
2772
+ const o = new Ta(), s = (h, u, f) => o.add(h, u, (p) => {
2731
2773
  try {
2732
- f(ji(p));
2774
+ f(ao(p));
2733
2775
  } catch {
2734
2776
  }
2735
2777
  });
2736
- e && (e.ferramentas = Oi, e.valor = a.ferramenta, s(e, "ui-change", (h) => {
2737
- const u = qi(h.valor);
2738
- u && a.definirFerramenta(u);
2739
- }), s(a, "prancha-ferramenta", (h) => {
2740
- e.valor = h.ferramenta;
2778
+ a && (a.ferramentas = Ji, a.valor = e.ferramenta, s(a, "ui-change", (h) => {
2779
+ const u = Qi(h.valor);
2780
+ u && e.definirFerramenta(u);
2781
+ }), s(e, "prancha-ferramenta", (h) => {
2782
+ a.valor = h.ferramenta;
2741
2783
  }));
2742
2784
  const n = () => {
2743
- i && (i.categorias = a.categoriasDePropriedades());
2785
+ i && (i.categorias = e.categoriasDePropriedades());
2744
2786
  };
2745
2787
  i && s(i, "ui-propriedade-alterada", (h) => {
2746
- a.aplicarPropriedade(h.id, h.valor);
2788
+ e.aplicarPropriedade(h.id, h.valor);
2747
2789
  });
2748
2790
  const l = () => {
2749
2791
  var u;
2750
2792
  if (!r) return;
2751
- const h = a.dadosParaPainelDeCamadas({ ocultarSemCamada: t.listaPlana !== !1 });
2752
- r.definirCamadas(h.camadas, h.feicoes), (u = r.selecionarFeicoes) == null || u.call(r, a.selecao);
2793
+ const h = e.dadosParaPainelDeCamadas({ ocultarSemCamada: t.listaPlana !== !1 });
2794
+ r.definirCamadas(h.camadas, h.feicoes), (u = r.selecionarFeicoes) == null || u.call(r, e.selecao);
2753
2795
  }, c = (h, u) => {
2754
- h !== O && a.definirCamadas(ki(a.obterCamadas(), h, u));
2796
+ h !== G && e.definirCamadas(Ui(e.obterCamadas(), h, u));
2755
2797
  };
2756
2798
  if (r) {
2757
2799
  const h = r;
2758
- s(h, "ui-camada-visibilidade", (u) => c(u.camadaId, { visivel: u.visivel })), s(h, "ui-camada-bloqueio", (u) => c(u.camadaId, { bloqueada: u.bloqueado })), s(h, "ui-camada-opacidade", (u) => c(u.camadaId, { opacidade: u.opacidade })), s(h, "ui-camada-renomeada", (u) => c(u.camadaId, { nome: u.novoNome })), s(h, "ui-camada-selecionada", (u) => a.definirCamadaAtiva(Ya(u.camadaId))), s(h, "ui-camadas-reordenadas", (u) => {
2759
- a.definirCamadas(Li(a.obterCamadas(), (u.camadas ?? []).map((f) => f.id)));
2800
+ s(h, "ui-camada-visibilidade", (u) => c(u.camadaId, { visivel: u.visivel })), s(h, "ui-camada-bloqueio", (u) => c(u.camadaId, { bloqueada: u.bloqueado })), s(h, "ui-camada-opacidade", (u) => c(u.camadaId, { opacidade: u.opacidade })), s(h, "ui-camada-renomeada", (u) => c(u.camadaId, { nome: u.novoNome })), s(h, "ui-camada-selecionada", (u) => e.definirCamadaAtiva(te(u.camadaId))), s(h, "ui-camadas-reordenadas", (u) => {
2801
+ e.definirCamadas(Xi(e.obterCamadas(), (u.camadas ?? []).map((f) => f.id)));
2760
2802
  }), s(h, "ui-camada-adicionar", () => {
2761
- const u = a.obterCamadas();
2803
+ const u = e.obterCamadas();
2762
2804
  let f = u.length + 1;
2763
2805
  for (; u.some((p) => p.id === `camada-${f}`); ) f++;
2764
- a.definirCamadas([...u, { id: `camada-${f}`, nome: `Camada ${f}` }]);
2765
- }), s(h, "ui-feicao-selecionada", (u) => a.selecionarElementos([u.feicaoId])), s(h, "ui-feicoes-selecionadas", (u) => a.selecionarElementos(u.feicoesIds ?? [])), s(h, "ui-feicao-visibilidade", (u) => a.alterarElementos([u.feicaoId], { oculto: !u.visivel })), s(h, "ui-feicao-bloqueio", (u) => a.alterarElementos([u.feicaoId], { bloqueado: u.bloqueado })), s(h, "ui-feicao-renomeada", (u) => a.alterarElementos([u.feicaoId], { nome: u.novoNome })), s(h, "ui-feicao-movida", (u) => a.alterarElementos([u.feicaoId], { camadaId: Ya(u.camadaDestinoId) }));
2806
+ e.definirCamadas([...u, { id: `camada-${f}`, nome: `Camada ${f}` }]);
2807
+ }), s(h, "ui-feicao-selecionada", (u) => e.selecionarElementos([u.feicaoId])), s(h, "ui-feicoes-selecionadas", (u) => e.selecionarElementos(u.feicoesIds ?? [])), s(h, "ui-feicao-visibilidade", (u) => e.alterarElementos([u.feicaoId], { oculto: !u.visivel })), s(h, "ui-feicao-bloqueio", (u) => e.alterarElementos([u.feicaoId], { bloqueado: u.bloqueado })), s(h, "ui-feicao-renomeada", (u) => e.alterarElementos([u.feicaoId], { nome: u.novoNome })), s(h, "ui-feicao-movida", (u) => e.alterarElementos([u.feicaoId], { camadaId: te(u.camadaDestinoId) }));
2766
2808
  }
2767
- for (const h of Ni) o.add(a, h, () => {
2809
+ for (const h of Yi) o.add(e, h, () => {
2768
2810
  l(), n();
2769
2811
  });
2770
- o.add(a, "prancha-selecao", () => {
2812
+ o.add(e, "prancha-selecao", () => {
2771
2813
  var h;
2772
- (h = r == null ? void 0 : r.selecionarFeicoes) == null || h.call(r, a.selecao), n();
2814
+ (h = r == null ? void 0 : r.selecionarFeicoes) == null || h.call(r, e.selecao), n();
2773
2815
  }), l(), n();
2774
2816
  let d = !0;
2775
2817
  return () => {
2776
2818
  d && (d = !1, o.cleanup());
2777
2819
  };
2778
2820
  }
2779
- const Hi = 720, ta = (t) => t === "botoes" || t === "menu" ? t : "auto", V = (t) => t === "fixa" || t === "gaveta" ? t : "auto", $i = ":host{--ui-editor-prancha-lateral: 300px;display:block;min-height:360px;min-width:240px;height:100%;color:var(--ui-cor-texto);font-family:var(--ui-fonte-base);box-sizing:border-box}:host([hidden]){display:none}.raiz{container-type:inline-size;container-name:editor;position:relative;display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:inherit;gap:var(--ui-espaco-sm);box-sizing:border-box}.barra{display:flex;flex-wrap:nowrap;gap:var(--ui-espaco-xs);align-items:center;min-width:0}.botoes-formas{display:flex;flex-wrap:wrap;gap:var(--ui-espaco-xs);min-width:0;flex:1 1 auto}.formas-menu{position:relative;display:none;flex:0 0 auto}.btn-lateral{display:none;margin-inline-start:auto;flex:0 0 auto}.acoes{display:flex;flex-wrap:nowrap;gap:var(--ui-espaco-xs);align-items:center;justify-content:flex-end;flex:0 0 auto}.area{position:relative;display:flex;gap:var(--ui-espaco-sm);align-items:stretch;min-height:0;min-width:0}.area>ui-paleta-ferramentas{flex:0 0 auto}.area>ui-canvas-prancha{flex:1 1 auto;min-width:0;height:auto}.lateral{flex:0 0 var(--ui-editor-prancha-lateral);display:flex;flex-direction:column;gap:var(--ui-espaco-sm);min-width:0}.lateral>ui-tabela-propriedades{flex:1 1 auto;min-height:200px}button{font:inherit;font-size:var(--ui-tamanho-corpo-sm);color:var(--ui-cor-texto);background:var(--ui-cor-superficie);border:1px solid var(--ui-cor-borda);border-radius:var(--ui-raio-sm);padding:var(--ui-espaco-xs) var(--ui-espaco-md);min-height:var(--ui-touch-target-min);cursor:pointer;white-space:nowrap}button:hover{border-color:var(--ui-cor-primaria)}button:focus-visible{outline:2px solid var(--ui-cor-primaria);outline-offset:2px}button.primario{background:var(--ui-cor-primaria);color:var(--ui-cor-texto-sobre-primaria, #000);border-color:var(--ui-cor-primaria)}.menu-formas{position:absolute;inset-block-start:100%;inset-inline-start:0;z-index:20;min-width:200px;max-height:70vh;overflow:auto;margin-block-start:var(--ui-espaco-xs);padding:var(--ui-espaco-xs);background:var(--ui-cor-superficie);border:1px solid var(--ui-cor-borda);border-radius:var(--ui-raio-sm);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.menu-formas[hidden]{display:none}.menu-formas button{display:block;width:100%;text-align:start;border-color:transparent;background:transparent}.menu-formas button:hover,.menu-formas button:focus-visible{background:var(--ui-cor-fundo-elevado)}.menu-grupo{padding:var(--ui-espaco-xs) var(--ui-espaco-sm);font-size:var(--ui-tamanho-caption);color:var(--ui-cor-texto-secundario);text-transform:uppercase}.raiz[data-barra=menu] .botoes-formas{display:none}.raiz[data-barra=menu] .formas-menu{display:block}.raiz[data-lateral=gaveta] .btn-lateral{display:inline-block}.raiz[data-lateral=gaveta] .lateral{position:absolute;inset-block:0;inset-inline-end:0;z-index:10;width:min(var(--ui-editor-prancha-lateral),92%);padding:var(--ui-espaco-sm);box-sizing:border-box;background:var(--ui-cor-fundo);border:1px solid var(--ui-cor-borda);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.raiz[data-lateral=gaveta][data-lateral-aberta=false] .lateral{display:none}@container editor (max-width: 719.98px){.raiz[data-barra=auto] .botoes-formas{display:none}.raiz[data-barra=auto] .formas-menu{display:block}.raiz[data-lateral=auto] .btn-lateral{display:inline-block}.raiz[data-lateral=auto] .lateral{position:absolute;inset-block:0;inset-inline-end:0;z-index:10;width:min(var(--ui-editor-prancha-lateral),92%);padding:var(--ui-espaco-sm);box-sizing:border-box;background:var(--ui-cor-fundo);border:1px solid var(--ui-cor-borda);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.raiz[data-lateral=auto][data-lateral-aberta=false] .lateral{display:none}}@container editor (max-width: 420px){.area{flex-direction:column}.area>ui-paleta-ferramentas{align-self:flex-start}}", ae = ["largura", "altura", "unidade", "grade", "mostrar-grade", "margens", "ajustar-ao-abrir", "somente-leitura", "sem-snap", "sem-reguas", "rotulo"], ee = { molduras: "Molduras", formas: "Formas", linhas: "Linhas", setas: "Setas" };
2780
- class Bi extends pe {
2821
+ const to = 720, ro = 24, io = 0.5, ya = (t) => t === "botoes" || t === "menu" ? t : "auto", X = (t) => t === "fixa" || t === "gaveta" ? t : "auto";
2822
+ function oo(t) {
2823
+ if (!t || typeof t != "object") return !1;
2824
+ const e = !!t.colapsadaAtual, a = t.transbordouNoDom === !0, r = t.larguraNecessaria, i = t.larguraDisponivel, o = typeof t.histerese == "number" && Number.isFinite(t.histerese) && t.histerese >= 0 ? t.histerese : ro, s = typeof i == "number" && Number.isFinite(i) && i > 0, n = typeof r == "number" && Number.isFinite(r) && r > 0;
2825
+ return !s || !n ? a ? !0 : e : e ? a ? !0 : i < r + o : a || r > i + io;
2826
+ }
2827
+ const so = "display:flex !important;flex-wrap:nowrap !important;width:max-content !important;max-width:none !important;position:absolute !important;visibility:hidden !important;pointer-events:none !important;left:0 !important;top:0 !important;", x = (t) => typeof t == "number" && Number.isFinite(t) && t > 0 ? t : 0, D = (t, e) => {
2828
+ if (typeof t != "string" || !t) return e;
2829
+ const a = parseFloat(t);
2830
+ return Number.isFinite(a) && a >= 0 ? a : e;
2831
+ }, Xe = (t) => {
2832
+ try {
2833
+ return typeof getComputedStyle == "function" ? getComputedStyle(t) : null;
2834
+ } catch {
2835
+ return null;
2836
+ }
2837
+ }, Ze = (t, e = !1) => {
2838
+ var o;
2839
+ let a = 0;
2840
+ try {
2841
+ a = ((o = t.getBoundingClientRect) == null ? void 0 : o.call(t).width) ?? 0;
2842
+ } catch {
2843
+ a = 0;
2844
+ }
2845
+ const r = x(t.offsetWidth), i = e ? x(t.scrollWidth) : 0;
2846
+ return Math.max(x(a), r, i, 0);
2847
+ };
2848
+ function re(t, e) {
2849
+ const a = Xe(t), r = D(a == null ? void 0 : a.columnGap, 4), i = D(a == null ? void 0 : a.paddingLeft, 0) + D(a == null ? void 0 : a.paddingRight, 0) + D(a == null ? void 0 : a.borderLeftWidth, 0) + D(a == null ? void 0 : a.borderRightWidth, 0);
2850
+ let o = 0, s = !1;
2851
+ for (const n of e) {
2852
+ const l = Ze(n, !0);
2853
+ l > 0 && (s = !0), o += l;
2854
+ }
2855
+ return {
2856
+ largura: s ? o + Math.max(0, e.length - 1) * r + i : 0,
2857
+ medido: s
2858
+ };
2859
+ }
2860
+ function no(t, e) {
2861
+ var o;
2862
+ const a = e[0];
2863
+ if (a) {
2864
+ const s = x(a.offsetHeight);
2865
+ if (s > 0) {
2866
+ const n = a.offsetTop, l = Math.max(4, s * 0.5);
2867
+ if (e.some((c) => c.offsetTop > n + l)) return !0;
2868
+ }
2869
+ try {
2870
+ const n = (o = a.getBoundingClientRect) == null ? void 0 : o.call(a);
2871
+ if (n && n.height > 0) {
2872
+ const l = Math.max(4, n.height * 0.5);
2873
+ if (e.some((c) => {
2874
+ var d, h;
2875
+ return (((h = (d = c.getBoundingClientRect) == null ? void 0 : d.call(c)) == null ? void 0 : h.top) ?? n.top) > n.top + l;
2876
+ })) return !0;
2877
+ }
2878
+ } catch {
2879
+ }
2880
+ }
2881
+ const r = x(t.clientWidth), i = x(t.scrollWidth);
2882
+ return r > 0 && i > r + 1;
2883
+ }
2884
+ function lo(t) {
2885
+ var C, T;
2886
+ const { barra: e, botoesFormas: a, botaoLateral: r, lateralVisivel: i, colapsadaAtual: o, larguraObservada: s } = t, n = Xe(e), l = D(n == null ? void 0 : n.paddingLeft, 0) + D(n == null ? void 0 : n.paddingRight, 0), c = D(n == null ? void 0 : n.columnGap, 4);
2887
+ let d = x(e.clientWidth);
2888
+ if (!(d > 0)) {
2889
+ let P = 0;
2890
+ try {
2891
+ P = x((C = e.getBoundingClientRect) == null ? void 0 : C.call(e).width);
2892
+ } catch {
2893
+ P = 0;
2894
+ }
2895
+ d = P > 0 ? P : x(s);
2896
+ }
2897
+ let h = Math.max(0, d - l);
2898
+ if (h > 0 && i) {
2899
+ const P = Ze(r, !1);
2900
+ P > 0 && (h = Math.max(0, h - P - c));
2901
+ }
2902
+ !(h > 0) && !o && (h = x(a.clientWidth));
2903
+ const u = Array.from(a.querySelectorAll("button[data-predefinicao]"));
2904
+ if (u.length === 0)
2905
+ return { larguraDisponivel: h, larguraNecessaria: 0, transbordouNoDom: !1 };
2906
+ if (o) {
2907
+ const P = a.getAttribute("style");
2908
+ try {
2909
+ a.style.cssText = so;
2910
+ const _ = re(a, u);
2911
+ let fa = 0;
2912
+ try {
2913
+ fa = x((T = a.getBoundingClientRect) == null ? void 0 : T.call(a).width);
2914
+ } catch {
2915
+ fa = 0;
2916
+ }
2917
+ const Je = x(a.scrollWidth);
2918
+ return {
2919
+ larguraDisponivel: h,
2920
+ larguraNecessaria: Math.max(_.largura, fa, Je),
2921
+ transbordouNoDom: !1
2922
+ };
2923
+ } finally {
2924
+ P === null ? a.removeAttribute("style") : a.setAttribute("style", P);
2925
+ }
2926
+ }
2927
+ const f = no(a, u), p = re(a, u), v = x(a.clientWidth), b = x(a.scrollWidth), M = p.medido ? v > 0 && b > v + 1 ? Math.max(p.largura, b) : p.largura : b;
2928
+ return { larguraDisponivel: h, larguraNecessaria: M, transbordouNoDom: f };
2929
+ }
2930
+ const co = ":host{--ui-editor-prancha-lateral: 300px;display:block;min-height:360px;min-width:240px;height:100%;color:var(--ui-cor-texto);font-family:var(--ui-fonte-base);box-sizing:border-box}:host([hidden]){display:none}.raiz{container-type:inline-size;container-name:editor;position:relative;display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:inherit;gap:var(--ui-espaco-sm);box-sizing:border-box}.barra{display:flex;flex-wrap:nowrap;gap:var(--ui-espaco-xs, 4px);align-items:center;min-width:0}.botoes-formas{display:flex;flex-wrap:wrap;gap:var(--ui-espaco-xs, 4px);min-width:0;flex:1 1 auto}.formas-menu{position:relative;display:none;flex:0 0 auto}.btn-lateral{display:none;margin-inline-start:auto;flex:0 0 auto}.acoes{display:flex;flex-wrap:nowrap;gap:var(--ui-espaco-xs);align-items:center;justify-content:flex-end;flex:0 0 auto}.area{position:relative;display:flex;gap:var(--ui-espaco-sm);align-items:stretch;min-height:0;min-width:0}.area>ui-paleta-ferramentas{flex:0 0 auto}.area>ui-canvas-prancha{flex:1 1 auto;min-width:0;height:auto}.lateral{flex:0 0 var(--ui-editor-prancha-lateral);display:flex;flex-direction:column;gap:var(--ui-espaco-sm);min-width:0}.lateral>ui-tabela-propriedades{flex:1 1 auto;min-height:200px}button{font:inherit;font-size:var(--ui-tamanho-corpo-sm);color:var(--ui-cor-texto);background:var(--ui-cor-superficie);border:1px solid var(--ui-cor-borda);border-radius:var(--ui-raio-sm);padding:var(--ui-espaco-xs) var(--ui-espaco-md);min-height:var(--ui-touch-target-min);cursor:pointer;white-space:nowrap}button:hover{border-color:var(--ui-cor-primaria)}button:focus-visible{outline:2px solid var(--ui-cor-primaria);outline-offset:2px}button.primario{background:var(--ui-cor-primaria);color:var(--ui-cor-texto-sobre-primaria, #000);border-color:var(--ui-cor-primaria)}.menu-formas{position:absolute;inset-block-start:100%;inset-inline-start:0;z-index:20;min-width:200px;max-height:70vh;overflow:auto;margin-block-start:var(--ui-espaco-xs);padding:var(--ui-espaco-xs);background:var(--ui-cor-superficie);border:1px solid var(--ui-cor-borda);border-radius:var(--ui-raio-sm);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.menu-formas[hidden]{display:none}.menu-formas button{display:block;width:100%;text-align:start;border-color:transparent;background:transparent}.menu-formas button:hover,.menu-formas button:focus-visible{background:var(--ui-cor-fundo-elevado)}.menu-grupo{padding:var(--ui-espaco-xs) var(--ui-espaco-sm);font-size:var(--ui-tamanho-caption);color:var(--ui-cor-texto-secundario);text-transform:uppercase}.raiz[data-barra=menu] .botoes-formas,.raiz[data-barra=auto][data-barra-modo=menu] .botoes-formas{display:none}.raiz[data-barra=menu] .formas-menu,.raiz[data-barra=auto][data-barra-modo=menu] .formas-menu{display:block}.raiz[data-lateral=gaveta] .btn-lateral{display:inline-block}.raiz[data-lateral=gaveta] .lateral{position:absolute;inset-block:0;inset-inline-end:0;z-index:10;width:min(var(--ui-editor-prancha-lateral),92%);padding:var(--ui-espaco-sm);box-sizing:border-box;background:var(--ui-cor-fundo);border:1px solid var(--ui-cor-borda);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.raiz[data-lateral=gaveta][data-lateral-aberta=false] .lateral{display:none}@container editor (max-width: 719.98px){.raiz[data-lateral=auto] .btn-lateral{display:inline-block}.raiz[data-lateral=auto] .lateral{position:absolute;inset-block:0;inset-inline-end:0;z-index:10;width:min(var(--ui-editor-prancha-lateral),92%);padding:var(--ui-espaco-sm);box-sizing:border-box;background:var(--ui-cor-fundo);border:1px solid var(--ui-cor-borda);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.raiz[data-lateral=auto][data-lateral-aberta=false] .lateral{display:none}}@container editor (max-width: 420px){.area{flex-direction:column}.area>ui-paleta-ferramentas{align-self:flex-start}}", ie = ["largura", "altura", "unidade", "grade", "mostrar-grade", "margens", "ajustar-ao-abrir", "somente-leitura", "sem-snap", "sem-reguas", "rotulo"], oe = { molduras: "Molduras", formas: "Formas", linhas: "Linhas", setas: "Setas" };
2931
+ class uo extends Ae {
2781
2932
  constructor() {
2782
2933
  super();
2783
2934
  m(this, "shadow");
2784
- m(this, "bag", new Ea());
2935
+ m(this, "bag", new Ta());
2785
2936
  m(this, "desligarPaineis", null);
2786
2937
  m(this, "observador", null);
2938
+ m(this, "rafBarra", null);
2787
2939
  m(this, "_prancha");
2788
2940
  m(this, "paleta");
2789
2941
  m(this, "painelCamadas");
2790
2942
  m(this, "painelPropriedades");
2791
2943
  m(this, "raiz");
2944
+ m(this, "barra");
2945
+ m(this, "botoesFormas");
2792
2946
  m(this, "botaoLateral");
2793
2947
  m(this, "botaoFormas");
2794
2948
  m(this, "menuFormas");
2795
2949
  m(this, "_lateralAberta", !1);
2796
2950
  m(this, "estreito", !1);
2951
+ m(this, "barraColapsada", !1);
2952
+ m(this, "ultimaLarguraObservada", 0);
2797
2953
  this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = `
2798
- <style>${$i}</style>
2799
- <div class="raiz" id="raiz" part="base" data-barra="auto" data-lateral="auto" data-lateral-aberta="false">
2954
+ <style>${co}</style>
2955
+ <div class="raiz" id="raiz" part="base" data-barra="auto" data-barra-modo="botoes" data-lateral="auto" data-lateral-aberta="false">
2800
2956
  <div class="barra" part="barra" id="barra" role="toolbar" aria-label="Formas e painéis">
2801
2957
  <div class="botoes-formas" id="botoes-formas" role="group" aria-label="Pré-definições"></div>
2802
2958
  <div class="formas-menu">
@@ -2818,32 +2974,36 @@ class Bi extends pe {
2818
2974
  <button type="button" id="concluir" class="primario">Concluir</button>
2819
2975
  </div>
2820
2976
  </div>`;
2821
- const e = (s) => this.shadow.getElementById(s);
2822
- this._prancha = e("prancha"), this.paleta = e("paleta"), this.painelCamadas = e("camadas"), this.painelPropriedades = e("propriedades"), this.raiz = e("raiz"), this.botaoLateral = e("btn-lateral"), this.botaoFormas = e("btn-formas"), this.menuFormas = e("menu-formas");
2823
- const r = e("botoes-formas");
2824
- let i = null, o = null;
2825
- for (const s of _a) {
2826
- const n = document.createElement("button");
2827
- if (n.type = "button", n.dataset.predefinicao = s.valor, n.textContent = s.rotulo, r.appendChild(n), s.grupo !== i) {
2828
- i = s.grupo, o = document.createElement("div"), o.setAttribute("role", "group"), o.setAttribute("aria-label", ee[s.grupo]);
2829
- const c = document.createElement("div");
2830
- c.className = "menu-grupo", c.setAttribute("aria-hidden", "true"), c.textContent = ee[s.grupo], o.appendChild(c), this.menuFormas.appendChild(o);
2977
+ const a = (o) => this.shadow.getElementById(o);
2978
+ this._prancha = a("prancha"), this.paleta = a("paleta"), this.painelCamadas = a("camadas"), this.painelPropriedades = a("propriedades"), this.raiz = a("raiz"), this.barra = a("barra"), this.botoesFormas = a("botoes-formas"), this.botaoLateral = a("btn-lateral"), this.botaoFormas = a("btn-formas"), this.menuFormas = a("menu-formas");
2979
+ let r = null, i = null;
2980
+ for (const o of Oa) {
2981
+ const s = document.createElement("button");
2982
+ if (s.type = "button", s.dataset.predefinicao = o.valor, s.textContent = o.rotulo, this.botoesFormas.appendChild(s), o.grupo !== r) {
2983
+ r = o.grupo, i = document.createElement("div"), i.setAttribute("role", "group"), i.setAttribute("aria-label", oe[o.grupo]);
2984
+ const l = document.createElement("div");
2985
+ l.className = "menu-grupo", l.setAttribute("aria-hidden", "true"), l.textContent = oe[o.grupo], i.appendChild(l), this.menuFormas.appendChild(i);
2831
2986
  }
2832
- const l = document.createElement("button");
2833
- l.type = "button", l.setAttribute("role", "menuitem"), l.tabIndex = -1, l.dataset.predefinicao = s.valor, l.textContent = s.rotulo, o == null || o.appendChild(l);
2987
+ const n = document.createElement("button");
2988
+ n.type = "button", n.setAttribute("role", "menuitem"), n.tabIndex = -1, n.dataset.predefinicao = o.valor, n.textContent = o.rotulo, i == null || i.appendChild(n);
2834
2989
  }
2835
2990
  }
2836
2991
  static get observedAttributes() {
2837
- return [...ae, "teclado", "barra-formas", "lateral"];
2992
+ return [...ie, "teclado", "barra-formas", "lateral"];
2838
2993
  }
2839
2994
  connectedCallback() {
2840
- var e, r;
2841
- this.bag.cleanup(), (e = this.observador) == null || e.disconnect(), this.observador = null, (r = this.desligarPaineis) == null || r.call(this), this.sincronizarAtributos(), this.desligarPaineis = Gi({
2995
+ var r;
2996
+ this.bag.cleanup(), this.pararObservador(), (r = this.desligarPaineis) == null || r.call(this), this.sincronizarAtributos(), this.desligarPaineis = eo({
2842
2997
  prancha: this._prancha,
2843
2998
  paleta: this.paleta,
2844
2999
  camadas: this.painelCamadas,
2845
3000
  propriedades: this.painelPropriedades
2846
- }), Le(this.bag, this, () => Aa(this.getAttribute("teclado") ?? "isolado") === "isolado"), this.bag.add(this.shadow.getElementById("concluir"), "click", () => this.concluir()), this.bag.add(this.shadow.getElementById("cancelar"), "click", () => this.cancelar()), this.bag.add(this.shadow.getElementById("botoes-formas"), "click", (i) => {
3001
+ });
3002
+ const a = () => j(this.getAttribute("teclado") ?? "isolado");
3003
+ Ge(this.bag, this, () => {
3004
+ const i = a();
3005
+ return i === "isolado" || i === "modal";
3006
+ }), He(this.bag, this, () => a() === "modal"), this.bag.add(this.shadow.getElementById("concluir"), "click", () => this.concluir()), this.bag.add(this.shadow.getElementById("cancelar"), "click", () => this.cancelar()), this.bag.add(this.botoesFormas, "click", (i) => {
2847
3007
  var s, n;
2848
3008
  const o = (n = (s = i.target) == null ? void 0 : s.closest) == null ? void 0 : n.call(s, "button[data-predefinicao]");
2849
3009
  o && this.inserir(o.dataset.predefinicao);
@@ -2863,41 +3023,38 @@ class Bi extends pe {
2863
3023
  i.key === "Escape" && this.emGaveta() && this._lateralAberta && (i.preventDefault(), i.stopPropagation(), this.lateralAberta = !1, this.botaoLateral.focus());
2864
3024
  }), this.bag.add(this, "keydown", (i) => {
2865
3025
  i.altKey && !i.ctrlKey && !i.metaKey && typeof i.key == "string" && i.key.toLowerCase() === "p" && (i.preventDefault(), this.lateralAberta = !this.lateralAberta, this._lateralAberta && this.emGaveta() && this.painelPropriedades.focus());
2866
- }, { capture: !0 }), this.bag.add(this._prancha, "prancha-esc-sem-efeito", () => this.cancelar()), typeof ResizeObserver == "function" && (this.observador = new ResizeObserver((i) => {
2867
- var s, n;
2868
- const o = ((n = (s = i[i.length - 1]) == null ? void 0 : s.contentRect) == null ? void 0 : n.width) ?? 0;
2869
- o > 0 && this.definirLargura(o);
2870
- }), this.observador.observe(this.raiz)), this.atualizarLateral();
3026
+ }, { capture: !0 }), this.bag.add(this._prancha, "prancha-esc-sem-efeito", () => this.cancelar()), this.iniciarObservador(), this.atualizarLateral();
2871
3027
  }
2872
3028
  disconnectedCallback() {
2873
- var e, r;
2874
- this.bag.cleanup(), (e = this.observador) == null || e.disconnect(), this.observador = null, (r = this.desligarPaineis) == null || r.call(this), this.desligarPaineis = null, this.fecharMenuFormas(!1);
3029
+ var a;
3030
+ this.bag.cleanup(), this.pararObservador(), this.ultimaLarguraObservada = 0, (a = this.desligarPaineis) == null || a.call(this), this.desligarPaineis = null, this.fecharMenuFormas(!1);
2875
3031
  }
2876
- attributeChangedCallback(e, r, i) {
2877
- if (e === "barra-formas") {
2878
- this.raiz.dataset.barra = ta(i);
3032
+ attributeChangedCallback(a, r, i) {
3033
+ if (a === "barra-formas") {
3034
+ const o = ya(i);
3035
+ o !== "auto" && (this.barraColapsada = !1), this.sincronizarModoBarra(), o === "auto" && this.isConnected && this.reajustarBarra();
2879
3036
  return;
2880
3037
  }
2881
- if (e === "lateral") {
2882
- this.raiz.dataset.lateral = V(i), this.atualizarLateral();
3038
+ if (a === "lateral") {
3039
+ this.raiz.dataset.lateral = X(i), this.atualizarLateral();
2883
3040
  return;
2884
3041
  }
2885
- this.repassar(e, i);
3042
+ this.repassar(a, i);
2886
3043
  }
2887
- repassar(e, r) {
2888
- if (e === "teclado") {
2889
- const i = Aa(r ?? "isolado");
3044
+ repassar(a, r) {
3045
+ if (a === "teclado") {
3046
+ const i = j(r ?? "isolado");
2890
3047
  i === "local" ? this._prancha.removeAttribute("teclado") : this._prancha.setAttribute("teclado", i);
2891
3048
  return;
2892
3049
  }
2893
- r === null ? this._prancha.removeAttribute(e) : this._prancha.setAttribute(e, r);
3050
+ r === null ? this._prancha.removeAttribute(a) : this._prancha.setAttribute(a, r);
2894
3051
  }
2895
3052
  sincronizarAtributos() {
2896
- for (const e of ae) this.repassar(e, this.getAttribute(e));
2897
- this.repassar("teclado", this.getAttribute("teclado")), this.raiz.dataset.barra = ta(this.getAttribute("barra-formas")), this.raiz.dataset.lateral = V(this.getAttribute("lateral"));
3053
+ for (const a of ie) this.repassar(a, this.getAttribute(a));
3054
+ this.repassar("teclado", this.getAttribute("teclado")), this.barraFormas !== "auto" && (this.barraColapsada = !1), this.sincronizarModoBarra(), this.raiz.dataset.lateral = X(this.getAttribute("lateral"));
2898
3055
  }
2899
- inserir(e) {
2900
- const r = _a.find((i) => i.valor === e);
3056
+ inserir(a) {
3057
+ const r = Oa.find((i) => i.valor === a);
2901
3058
  r && this._prancha.inserirPredefinicao(r.valor, void 0, r.usaQuadro ? { quadro: "margens" } : {});
2902
3059
  }
2903
3060
  // ---------- menu "Formas" ----------
@@ -2905,64 +3062,143 @@ class Bi extends pe {
2905
3062
  return Array.from(this.menuFormas.querySelectorAll('button[role="menuitem"]'));
2906
3063
  }
2907
3064
  abrirMenuFormas() {
2908
- var e;
2909
- this.menuFormas.hidden = !1, this.botaoFormas.setAttribute("aria-expanded", "true"), (e = this.itensDoMenu()[0]) == null || e.focus();
3065
+ var a;
3066
+ this.menuFormas.hidden = !1, this.botaoFormas.setAttribute("aria-expanded", "true"), (a = this.itensDoMenu()[0]) == null || a.focus();
2910
3067
  }
2911
- fecharMenuFormas(e) {
2912
- this.menuFormas.hidden || (this.menuFormas.hidden = !0, this.botaoFormas.setAttribute("aria-expanded", "false"), e && this.botaoFormas.focus());
3068
+ fecharMenuFormas(a) {
3069
+ this.menuFormas.hidden || (this.menuFormas.hidden = !0, this.botaoFormas.setAttribute("aria-expanded", "false"), a && this.botaoFormas.focus());
2913
3070
  }
2914
3071
  alternarMenuFormas() {
2915
3072
  this.menuFormas.hidden ? this.abrirMenuFormas() : this.fecharMenuFormas(!0);
2916
3073
  }
2917
- tecladoDoMenu(e) {
3074
+ tecladoDoMenu(a) {
2918
3075
  const r = this.itensDoMenu(), i = r.indexOf(this.shadow.activeElement);
2919
- if (e.key === "Escape") {
2920
- e.preventDefault(), e.stopPropagation(), this.fecharMenuFormas(!0);
3076
+ if (a.key === "Escape") {
3077
+ a.preventDefault(), a.stopPropagation(), this.fecharMenuFormas(!0);
2921
3078
  return;
2922
3079
  }
2923
- if (e.key === "Tab") {
3080
+ if (a.key === "Tab") {
2924
3081
  this.fecharMenuFormas(!1);
2925
3082
  return;
2926
3083
  }
2927
3084
  const o = (s) => {
2928
3085
  var n;
2929
- e.preventDefault(), (n = r[(s + r.length) % r.length]) == null || n.focus();
3086
+ a.preventDefault(), (n = r[(s + r.length) % r.length]) == null || n.focus();
2930
3087
  };
2931
- e.key === "ArrowDown" ? o(i + 1) : e.key === "ArrowUp" ? o(i - 1) : e.key === "Home" ? o(0) : e.key === "End" && o(r.length - 1);
3088
+ a.key === "ArrowDown" ? o(i + 1) : a.key === "ArrowUp" ? o(i - 1) : a.key === "Home" ? o(0) : a.key === "End" && o(r.length - 1);
3089
+ }
3090
+ // ---------- barra de formas e observador ----------
3091
+ iniciarObservador() {
3092
+ this.pararObservador(), typeof ResizeObserver == "function" && (this.observador = new ResizeObserver((a) => this.aoRedimensionar(a)), this.observador.observe(this.raiz), this.observador.observe(this.barra));
3093
+ }
3094
+ pararObservador() {
3095
+ var a;
3096
+ (a = this.observador) == null || a.disconnect(), this.observador = null, this.rafBarra !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.rafBarra), this.rafBarra = null;
3097
+ }
3098
+ aoRedimensionar(a) {
3099
+ var o;
3100
+ if (!Array.isArray(a)) return;
3101
+ let r = null, i = null;
3102
+ for (const s of a) {
3103
+ const n = (o = s == null ? void 0 : s.contentRect) == null ? void 0 : o.width;
3104
+ typeof n != "number" || !Number.isFinite(n) || n < 0 || (!s.target || s.target === this.raiz ? r = n : s.target === this.barra && (i = n));
3105
+ }
3106
+ r !== null ? (this.ultimaLarguraObservada = r, r > 0 && this.definirLargura(r)) : i !== null && (this.ultimaLarguraObservada = i), this.barraFormas === "auto" && this.agendarAjusteBarra();
3107
+ }
3108
+ /** Agrupa rajadas de redimensionamento em um único reajuste por quadro (evita loops de ResizeObserver e pisca-pisca). */
3109
+ agendarAjusteBarra() {
3110
+ if (!(!this.isConnected || this.barraFormas !== "auto")) {
3111
+ if (typeof requestAnimationFrame != "function") {
3112
+ this.reajustarBarra();
3113
+ return;
3114
+ }
3115
+ this.rafBarra === null && (this.rafBarra = requestAnimationFrame(() => {
3116
+ this.rafBarra = null, this.isConnected && this.reajustarBarra();
3117
+ }));
3118
+ }
3119
+ }
3120
+ /**
3121
+ * Reavalia se a barra de formas no modo `auto` cabe em uma linha ou deve colapsar para `"Formas ▾"`.
3122
+ * Executado no máximo uma vez por quadro via `ResizeObserver`; pode ser chamado após alterações manuais de rótulos/layout.
3123
+ */
3124
+ reajustarBarra() {
3125
+ if (!this.isConnected) return;
3126
+ if (this.barraFormas !== "auto") {
3127
+ this.definirBarraColapsada(!1);
3128
+ return;
3129
+ }
3130
+ const a = lo({
3131
+ barra: this.barra,
3132
+ botoesFormas: this.botoesFormas,
3133
+ botaoLateral: this.botaoLateral,
3134
+ lateralVisivel: this.emGaveta(),
3135
+ colapsadaAtual: this.barraColapsada,
3136
+ larguraObservada: this.ultimaLarguraObservada
3137
+ }), r = oo({
3138
+ colapsadaAtual: this.barraColapsada,
3139
+ larguraNecessaria: a.larguraNecessaria,
3140
+ larguraDisponivel: a.larguraDisponivel,
3141
+ transbordouNoDom: a.transbordouNoDom
3142
+ });
3143
+ this.definirBarraColapsada(r);
3144
+ }
3145
+ definirBarraColapsada(a) {
3146
+ if (a === this.barraColapsada && this.raiz.dataset.barraModo) {
3147
+ this.sincronizarModoBarra();
3148
+ return;
3149
+ }
3150
+ this.barraColapsada = a, this.sincronizarModoBarra();
3151
+ }
3152
+ sincronizarModoBarra() {
3153
+ var o;
3154
+ const a = this.barraFormas;
3155
+ this.raiz.dataset.barra = a;
3156
+ const r = a === "menu" || a === "auto" && this.barraColapsada ? "menu" : "botoes", i = this.raiz.dataset.barraModo;
3157
+ if (this.raiz.dataset.barraModo = r, i === "menu" && r === "botoes") {
3158
+ const s = this.shadow.activeElement === this.botaoFormas || this.menuFormas.contains(this.shadow.activeElement);
3159
+ this.fecharMenuFormas(!1), s && ((o = this.botoesFormas.querySelector("button[data-predefinicao]")) == null || o.focus());
3160
+ }
2932
3161
  }
2933
3162
  // ---------- lateral ----------
2934
3163
  emGaveta() {
2935
- const e = V(this.getAttribute("lateral"));
2936
- return e === "gaveta" || e === "auto" && this.estreito;
3164
+ const a = X(this.getAttribute("lateral"));
3165
+ return a === "gaveta" || a === "auto" && this.estreito;
2937
3166
  }
2938
- definirLargura(e) {
2939
- const r = e < Hi;
3167
+ definirLargura(a) {
3168
+ const r = a < to;
2940
3169
  r !== this.estreito && (this.estreito = r, this.atualizarLateral());
2941
3170
  }
2942
3171
  atualizarLateral() {
2943
- const e = this.emGaveta();
2944
- e || (this._lateralAberta = !1), this.raiz.dataset.lateralAberta = String(this._lateralAberta), this.botaoLateral.setAttribute("aria-expanded", String(!e || this._lateralAberta)), this.botaoLateral.toggleAttribute("data-gaveta", e);
3172
+ const a = this.emGaveta();
3173
+ a || (this._lateralAberta = !1), this.raiz.dataset.lateralAberta = String(this._lateralAberta), this.botaoLateral.setAttribute("aria-expanded", String(!a || this._lateralAberta)), this.botaoLateral.toggleAttribute("data-gaveta", a), this.isConnected && this.barraFormas === "auto" && this.agendarAjusteBarra();
2945
3174
  }
2946
3175
  /** A lateral (camadas e propriedades) está visível? Em modo fixo é sempre `true`; em gaveta, é o estado aberto/fechado. */
2947
3176
  get lateralAberta() {
2948
3177
  return !this.emGaveta() || this._lateralAberta;
2949
3178
  }
2950
- set lateralAberta(e) {
2951
- this.emGaveta() && (this._lateralAberta = !!e, this.atualizarLateral(), this._lateralAberta && this.painelPropriedades.focus());
3179
+ set lateralAberta(a) {
3180
+ this.emGaveta() && (this._lateralAberta = !!a, this.atualizarLateral(), this._lateralAberta && this.painelPropriedades.focus());
2952
3181
  }
2953
3182
  /** `auto`, `fixa` ou `gaveta`. */
2954
3183
  get lateral() {
2955
- return V(this.getAttribute("lateral"));
3184
+ return X(this.getAttribute("lateral"));
2956
3185
  }
2957
- set lateral(e) {
2958
- this.setAttribute("lateral", V(e));
3186
+ set lateral(a) {
3187
+ this.setAttribute("lateral", X(a));
2959
3188
  }
2960
3189
  /** `auto`, `botoes` ou `menu`. */
2961
3190
  get barraFormas() {
2962
- return ta(this.getAttribute("barra-formas"));
3191
+ return ya(this.getAttribute("barra-formas"));
3192
+ }
3193
+ set barraFormas(a) {
3194
+ this.setAttribute("barra-formas", ya(a));
3195
+ }
3196
+ /** `isolado` (padrão), `exclusivo`, `local` ou `modal`. */
3197
+ get teclado() {
3198
+ return j(this.getAttribute("teclado") ?? "isolado");
2963
3199
  }
2964
- set barraFormas(e) {
2965
- this.setAttribute("barra-formas", ta(e));
3200
+ set teclado(a) {
3201
+ this.setAttribute("teclado", j(a));
2966
3202
  }
2967
3203
  // ---------- API ----------
2968
3204
  /** A prancha interna (para usar a API completa: ferramentas, vista, exportação). */
@@ -2973,14 +3209,14 @@ class Bi extends pe {
2973
3209
  get elementos() {
2974
3210
  return this._prancha.obterElementos();
2975
3211
  }
2976
- set elementos(e) {
2977
- this._prancha.definirElementos(Array.isArray(e) ? e : []);
3212
+ set elementos(a) {
3213
+ this._prancha.definirElementos(Array.isArray(a) ? a : []);
2978
3214
  }
2979
3215
  get camadas() {
2980
3216
  return this._prancha.obterCamadas();
2981
3217
  }
2982
- set camadas(e) {
2983
- this._prancha.definirCamadas(Array.isArray(e) ? e : []);
3218
+ set camadas(a) {
3219
+ this._prancha.definirCamadas(Array.isArray(a) ? a : []);
2984
3220
  }
2985
3221
  get modificado() {
2986
3222
  return this._prancha.modificado;
@@ -2994,243 +3230,244 @@ class Bi extends pe {
2994
3230
  }
2995
3231
  /** Confirma: emite `editor-concluir` com os dados atuais. */
2996
3232
  concluir() {
2997
- const e = { elementos: this._prancha.obterElementos(), camadas: this._prancha.obterCamadas(), modificado: this._prancha.modificado };
2998
- this.dispatchEvent(new CustomEvent("editor-concluir", { detail: e, bubbles: !0, composed: !0 }));
3233
+ const a = { elementos: this._prancha.obterElementos(), camadas: this._prancha.obterCamadas(), modificado: this._prancha.modificado };
3234
+ this.dispatchEvent(new CustomEvent("editor-concluir", { detail: a, bubbles: !0, composed: !0 }));
2999
3235
  }
3000
3236
  /** Cancela: emite `editor-cancelar`. */
3001
3237
  cancelar() {
3002
- const e = { modificado: this._prancha.modificado };
3003
- this.dispatchEvent(new CustomEvent("editor-cancelar", { detail: e, bubbles: !0, composed: !0 }));
3238
+ const a = { modificado: this._prancha.modificado };
3239
+ this.dispatchEvent(new CustomEvent("editor-cancelar", { detail: a, bubbles: !0, composed: !0 }));
3004
3240
  }
3005
- focus(e) {
3006
- this._prancha.focus(e);
3241
+ focus(a) {
3242
+ this._prancha.focus(a);
3007
3243
  }
3008
3244
  }
3009
- ge("ui-editor-prancha", Bi);
3245
+ Se("ui-editor-prancha", uo);
3010
3246
  export {
3011
- Ct as ALCAS_ESCALA,
3012
- qe as ATRIBUTOS_PRANCHA,
3013
- O as CAMADA_SEM_CAMADA,
3014
- fi as CANAL_COMANDOS_PRANCHA,
3015
- pi as COMANDOS_PRANCHA,
3016
- Je as COR_PADRAO_PRANCHA,
3017
- ao as DIMENSOES_FOLHA,
3018
- eo as EPSILON_DETERMINANTE,
3019
- to as ESCALA_MINIMA,
3020
- Zs as ESPACO_GEOGRAFICO,
3021
- nt as ESPACO_PLANO,
3022
- ro as ESPESSURA_PADRAO_MM,
3023
- We as ESPESSURA_TRACO_PADRAO_MM,
3024
- io as ESTILOS_TRACO,
3025
- oo as ESTILO_DO_TIPO_LINHA,
3026
- so as FAIXAS_MAXIMO,
3027
- no as FAIXAS_PADRAO,
3028
- Oi as FERRAMENTAS_PALETA_PRANCHA,
3029
- Re as FERRAMENTAS_PRANCHA,
3030
- lo as FONTE_PADRAO,
3031
- co as FORMATOS_ABNT,
3032
- Be as Historico,
3033
- uo as IDENTIDADE,
3034
- ho as IDS_PROPRIEDADES_PRANCHA,
3035
- _a as ITENS_PREDEFINICOES,
3036
- $e as IndicePrancha,
3037
- mo as KAPPA,
3038
- Hi as LARGURA_ESTREITA_PX,
3039
- fo as LIMITE_PONTA_PADRAO,
3040
- po as MAX_LINHAS_HACHURA,
3041
- go as MESCLAGEM_CSS,
3042
- vo as MM_POR_PX,
3043
- bo as MM_POR_UNIDADE,
3044
- tr as MODOS_MESCLAGEM,
3045
- $t as OPERACOES_BOOLEANAS,
3046
- yo as PREDEFINICOES,
3047
- Ao as PRIORIDADE_SNAP_PRANCHA,
3048
- H as PX_POR_MM_100,
3049
- Po as ROTULOS_PREDEFINICOES,
3050
- So as SOMBRA_PADRAO,
3051
- Mo as TIPO_LINHA_DO_ESTILO,
3052
- Ri as UICanvasPrancha,
3053
- Si as UICanvasPranchaBase,
3054
- Bi as UIEditorPrancha,
3055
- zo as adaptarContextoRelativo,
3056
- qt as adicionarAncora,
3057
- ht as agrupar,
3058
- Eo as ajustarAparenciaEmLote,
3059
- xo as ajustarElementosACaixa,
3060
- ce as alcasDoElemento,
3061
- ft as alinhar,
3062
- Ve as analisarElemento,
3063
- Nt as ancoraMaisProxima,
3064
- Sa as ancorasDoElemento,
3065
- Co as aparenciaDe,
3066
- Et as aplicar,
3067
- ne as aplicarAparencia,
3068
- Bt as aplicarPathfinder,
3069
- To as aplicarTodos,
3070
- wo as aplicarVetor,
3071
- Io as areaComSinal,
3072
- Do as areaDosPoligonos,
3073
- _o as avisarUmaVez,
3074
- te as buscarSnapPrancha,
3075
- Ma as caixaDaSelecao,
3076
- ut as caixaDeCantos,
3077
- me as caixaDoQuadro,
3078
- Fo as caixaDoQuadroAbnt,
3079
- ko as caixaDoTexto,
3080
- Lo as caixaNormalizada,
3081
- zt as caixaOrientada,
3082
- Ya as camadaDoPainel,
3083
- ki as camadasComMudanca,
3084
- Li as camadasNaOrdemDoPainel,
3085
- Ro as caminhoDoContorno,
3086
- Oo as caminhoFinito,
3087
- qo as caminhoParaSvg,
3088
- _i as categoriasDePropriedades,
3089
- Di as categoriasSemSelecao,
3090
- et as centroDaSelecao,
3091
- No as cisalhamento,
3092
- ar as comPropriedade,
3093
- Tt as comRaioDeCanto,
3094
- jo as comoCaminhoNaFolha,
3095
- wa as compor,
3096
- Go as comprimentoDaPonta,
3097
- St as contornoDoTraco,
3098
- Ho as contornoElipse,
3099
- $o as contornoEstrela,
3100
- Bo as contornoLocal,
3101
- Ko as contornoLocalEmCache,
3102
- za as contornoNaFolha,
3103
- Vo as contornoPoligonoRegular,
3104
- Uo as contornoRetangulo,
3105
- jt as converterAncora,
3106
- Mt as converterEmCaminho,
3107
- Xo as corComOpacidade,
3108
- Zo as corNaPosicao,
3109
- Ia as criarCaminho,
3110
- rt as criarElipse,
3111
- ot as criarEstrela,
3112
- st as criarLinha,
3113
- gt as criarMascara,
3114
- it as criarPoligonoRegular,
3115
- tt as criarRetangulo,
3116
- ct as criarTexto,
3117
- Fi as dadosParaPainelDeCamadas,
3118
- Ht as deMm,
3119
- Wo as decompor,
3120
- Ut as definirMedidorTexto,
3121
- Ye as definirRaiosDoRetangulo,
3122
- mt as desagrupar,
3123
- N as desenharElementos,
3124
- Jo as desenharPlano,
3125
- At as deslocarCaminho,
3126
- Qo as determinante,
3127
- Yo as diagnosticarContexto,
3128
- as as direcaoNaPonta,
3129
- pt as distribuir,
3130
- yt as dividirComLinha,
3131
- le as duplicarElementos,
3132
- es as ehFechado,
3133
- Oe as ehFerramentaPrancha,
3134
- ts as ehIdentidade,
3135
- re as ehMatrizFinita,
3136
- Zt as ehPredefinicao,
3137
- Yt as ehPropriedadeDeGeometria,
3138
- Qt as ehPropriedadePrancha,
3139
- rs as ehSingular,
3140
- Kt as ehUnidadePrancha,
3141
- oa as elementoNoTopo,
3142
- Gt as elementosNaCaixa,
3143
- is as elementosNoLaco,
3144
- os as elementosNoPonto,
3145
- ss as emTornoDe,
3146
- Rt as envelopeNaFolha,
3147
- Da as envelopeVisual,
3148
- q as escala,
3149
- ns as espelhamento,
3150
- Qe as espelharElementos,
3151
- Ji as eventoTratadoPelaPrancha,
3152
- oe as excluirAncora,
3153
- Ze as expandirGrupos,
3154
- Jt as exportarSvg,
3155
- ls as faixasDoGradienteLinear,
3156
- cs as feicaoDoElemento,
3157
- qi as ferramentaDaPaleta,
3158
- us as fonteSegura,
3159
- ds as geometriaDaPonta,
3160
- Wt as gerarPredefinicao,
3161
- hs as girarElementos,
3162
- kt as guiasInteligentes,
3163
- ms as iguais,
3164
- Le as instalarIsolamentoDeTeclas,
3165
- fs as inverter,
3166
- Ne as lerMargens,
3167
- Aa as lerModoTeclado,
3168
- vt as liberarMascara,
3169
- Gi as ligarPaineisPrancha,
3170
- ps as limitesLocais,
3171
- W as limitesNaFolha,
3172
- gs as linhasDeHachura,
3173
- Ue as mapaDeCamadas,
3174
- vs as mapearPontoNaCaixa,
3175
- Lt as marcasDosCantos,
3176
- bs as margensAbnt,
3177
- ys as matriz,
3178
- _t as matrizDeCisalhamentoPorAlca,
3179
- Ft as matrizDeEscalaPorAlca,
3180
- As as matrizDoElemento,
3181
- Ps as meiaEspessura,
3182
- Ss as modoDeTransformacao,
3183
- wt as moverAlcaDaAncora,
3184
- It as moverAncora,
3185
- ie as moverAncoras,
3186
- Ms as moverElemento,
3187
- zs as multiplicar,
3188
- Es as normalizarAparencia,
3189
- Xe as normalizarCamadas,
3190
- at as normalizarElemento,
3191
- Ke as normalizarElementos,
3192
- xs as normalizarGeometriaElemento,
3193
- Cs as normalizarGradiente,
3194
- Ts as normalizarHachura,
3195
- ws as normalizarParaOrigem,
3196
- Is as operacaoBooleana,
3197
- $ as ordenarPorEmpilhamento,
3198
- Ds as padraoTipoLinhaMm,
3199
- lt as paraMm,
3200
- _s as pivoNaFolha,
3201
- Fs as planejar,
3202
- ks as planejarElemento,
3203
- Ls as planejarElementos,
3204
- Rs as planoDe,
3205
- Os as pontoNoAnel,
3206
- xt as posicaoLocalDaAlca,
3207
- ue as posicoesDasAlcas,
3208
- he as profundidadeNoCanto,
3209
- qs as raiosCabiveis,
3210
- de as raiosEfetivos,
3211
- Ns as recompor,
3212
- js as redefinirAvisoContexto,
3213
- Gs as regiaoDoElemento,
3214
- dt as reordenar,
3215
- ir as resolverAparencia,
3216
- Hs as resolverSombra,
3217
- $s as resumirAparencia,
3218
- Pa as rotacao,
3219
- er as rotacaoEmGraus,
3220
- Dt as rotacaoPorArrasto,
3221
- je as rotuloDoTipo,
3222
- Xt as saneada,
3223
- Pt as simplificarCaminho,
3224
- di as teclaReservadaDoNavegador,
3225
- Vt as temMedidorTexto,
3226
- Bs as temPreenchimento,
3227
- Ks as testarElemento,
3228
- Vs as transformarContorno,
3229
- se as transformarElemento,
3230
- T as transformarElementos,
3247
+ kt as ALCAS_ESCALA,
3248
+ Ke as ATRIBUTOS_PRANCHA,
3249
+ G as CAMADA_SEM_CAMADA,
3250
+ Ti as CANAL_COMANDOS_PRANCHA,
3251
+ wi as COMANDOS_PRANCHA,
3252
+ lt as COR_PADRAO_PRANCHA,
3253
+ So as DIMENSOES_FOLHA,
3254
+ Po as EPSILON_DETERMINANTE,
3255
+ Mo as ESCALA_MINIMA,
3256
+ gn as ESPACO_GEOGRAFICO,
3257
+ bt as ESPACO_PLANO,
3258
+ zo as ESPESSURA_PADRAO_MM,
3259
+ nt as ESPESSURA_TRACO_PADRAO_MM,
3260
+ xo as ESTILOS_TRACO,
3261
+ Eo as ESTILO_DO_TIPO_LINHA,
3262
+ Co as FAIXAS_MAXIMO,
3263
+ To as FAIXAS_PADRAO,
3264
+ Ji as FERRAMENTAS_PALETA_PRANCHA,
3265
+ $e as FERRAMENTAS_PRANCHA,
3266
+ wo as FONTE_PADRAO,
3267
+ Do as FORMATOS_ABNT,
3268
+ et as Historico,
3269
+ Io as IDENTIDADE,
3270
+ Fo as IDS_PROPRIEDADES_PRANCHA,
3271
+ Oa as ITENS_PREDEFINICOES,
3272
+ at as IndicePrancha,
3273
+ _o as KAPPA,
3274
+ to as LARGURA_ESTREITA_PX,
3275
+ No as LIMITE_PONTA_PADRAO,
3276
+ Oo as MAX_LINHAS_HACHURA,
3277
+ Ro as MESCLAGEM_CSS,
3278
+ Lo as MM_POR_PX,
3279
+ ko as MM_POR_UNIDADE,
3280
+ mr as MODOS_MESCLAGEM,
3281
+ ar as OPERACOES_BOOLEANAS,
3282
+ qo as PREDEFINICOES,
3283
+ Bo as PRIORIDADE_SNAP_PRANCHA,
3284
+ W as PX_POR_MM_100,
3285
+ jo as ROTULOS_PREDEFINICOES,
3286
+ Go as SOMBRA_PADRAO,
3287
+ Ho as TIPO_LINHA_DO_ESTILO,
3288
+ Zi as UICanvasPrancha,
3289
+ Ri as UICanvasPranchaBase,
3290
+ uo as UIEditorPrancha,
3291
+ $o as adaptarContextoRelativo,
3292
+ Xt as adicionarAncora,
3293
+ Mt as agrupar,
3294
+ Vo as ajustarAparenciaEmLote,
3295
+ Ko as ajustarElementosACaixa,
3296
+ me as alcasDoElemento,
3297
+ xt as alinhar,
3298
+ rt as analisarElemento,
3299
+ Zt as ancoraMaisProxima,
3300
+ xa as ancorasDoElemento,
3301
+ Wo as aparenciaDe,
3302
+ Rt as aplicar,
3303
+ de as aplicarAparencia,
3304
+ er as aplicarPathfinder,
3305
+ Uo as aplicarTodos,
3306
+ Xo as aplicarVetor,
3307
+ Zo as areaComSinal,
3308
+ Jo as areaDosPoligonos,
3309
+ Qo as avisarUmaVez,
3310
+ se as buscarSnapPrancha,
3311
+ Ea as caixaDaSelecao,
3312
+ St as caixaDeCantos,
3313
+ ve as caixaDoQuadro,
3314
+ Yo as caixaDoQuadroAbnt,
3315
+ as as caixaDoTexto,
3316
+ es as caixaNormalizada,
3317
+ Ot as caixaOrientada,
3318
+ te as camadaDoPainel,
3319
+ Ui as camadasComMudanca,
3320
+ Xi as camadasNaOrdemDoPainel,
3321
+ ts as caminhoDoContorno,
3322
+ rs as caminhoFinito,
3323
+ is as caminhoParaSvg,
3324
+ Ki as categoriasDePropriedades,
3325
+ Vi as categoriasSemSelecao,
3326
+ ht as centroDaSelecao,
3327
+ os as cisalhamento,
3328
+ dr as comPropriedade,
3329
+ qt as comRaioDeCanto,
3330
+ ss as comoCaminhoNaFolha,
3331
+ Fa as compor,
3332
+ ns as comprimentoDaPonta,
3333
+ _t as contornoDoTraco,
3334
+ ls as contornoElipse,
3335
+ cs as contornoEstrela,
3336
+ us as contornoLocal,
3337
+ ds as contornoLocalEmCache,
3338
+ Ca as contornoNaFolha,
3339
+ hs as contornoPoligonoRegular,
3340
+ ms as contornoRetangulo,
3341
+ Jt as converterAncora,
3342
+ Nt as converterEmCaminho,
3343
+ fs as corComOpacidade,
3344
+ ps as corNaPosicao,
3345
+ _a as criarCaminho,
3346
+ ft as criarElipse,
3347
+ gt as criarEstrela,
3348
+ vt as criarLinha,
3349
+ Ct as criarMascara,
3350
+ pt as criarPoligonoRegular,
3351
+ mt as criarRetangulo,
3352
+ At as criarTexto,
3353
+ Wi as dadosParaPainelDeCamadas,
3354
+ Yt as deMm,
3355
+ gs as decompor,
3356
+ ir as definirMedidorTexto,
3357
+ ut as definirRaiosDoRetangulo,
3358
+ zt as desagrupar,
3359
+ $ as desenharElementos,
3360
+ vs as desenharPlano,
3361
+ It as deslocarCaminho,
3362
+ bs as determinante,
3363
+ ys as diagnosticarContexto,
3364
+ As as direcaoNaPonta,
3365
+ Et as distribuir,
3366
+ Dt as dividirComLinha,
3367
+ he as duplicarElementos,
3368
+ Ss as ehFechado,
3369
+ Ve as ehFerramentaPrancha,
3370
+ Ps as ehIdentidade,
3371
+ ne as ehMatrizFinita,
3372
+ sr as ehPredefinicao,
3373
+ ur as ehPropriedadeDeGeometria,
3374
+ cr as ehPropriedadePrancha,
3375
+ Ms as ehSingular,
3376
+ tr as ehUnidadePrancha,
3377
+ na as elementoNoTopo,
3378
+ Qt as elementosNaCaixa,
3379
+ zs as elementosNoLaco,
3380
+ xs as elementosNoPonto,
3381
+ Es as emTornoDe,
3382
+ Wt as envelopeNaFolha,
3383
+ Na as envelopeVisual,
3384
+ H as escala,
3385
+ Cs as espelhamento,
3386
+ ct as espelharElementos,
3387
+ bo as eventoTratadoPelaPrancha,
3388
+ ce as excluirAncora,
3389
+ st as expandirGrupos,
3390
+ lr as exportarSvg,
3391
+ Ts as faixasDoGradienteLinear,
3392
+ ws as feicaoDoElemento,
3393
+ Qi as ferramentaDaPaleta,
3394
+ Ds as fonteSegura,
3395
+ Is as geometriaDaPonta,
3396
+ nr as gerarPredefinicao,
3397
+ Fs as girarElementos,
3398
+ Vt as guiasInteligentes,
3399
+ _s as iguais,
3400
+ Ge as instalarIsolamentoDeTeclas,
3401
+ He as instalarTecladoModal,
3402
+ Ns as inverter,
3403
+ We as lerMargens,
3404
+ j as lerModoTeclado,
3405
+ Tt as liberarMascara,
3406
+ eo as ligarPaineisPrancha,
3407
+ Os as limitesLocais,
3408
+ Y as limitesNaFolha,
3409
+ Rs as linhasDeHachura,
3410
+ it as mapaDeCamadas,
3411
+ Ls as mapearPontoNaCaixa,
3412
+ Kt as marcasDosCantos,
3413
+ ks as margensAbnt,
3414
+ qs as matriz,
3415
+ Ht as matrizDeCisalhamentoPorAlca,
3416
+ $t as matrizDeEscalaPorAlca,
3417
+ Bs as matrizDoElemento,
3418
+ js as meiaEspessura,
3419
+ Gs as modoDeTransformacao,
3420
+ Bt as moverAlcaDaAncora,
3421
+ jt as moverAncora,
3422
+ le as moverAncoras,
3423
+ Hs as moverElemento,
3424
+ $s as multiplicar,
3425
+ Vs as normalizarAparencia,
3426
+ ot as normalizarCamadas,
3427
+ dt as normalizarElemento,
3428
+ tt as normalizarElementos,
3429
+ Ks as normalizarGeometriaElemento,
3430
+ Ws as normalizarGradiente,
3431
+ Us as normalizarHachura,
3432
+ Xs as normalizarParaOrigem,
3433
+ Zs as operacaoBooleana,
3434
+ U as ordenarPorEmpilhamento,
3435
+ Js as padraoTipoLinhaMm,
3436
+ yt as paraMm,
3437
+ Qs as pivoNaFolha,
3438
+ Ys as planejar,
3439
+ an as planejarElemento,
3440
+ en as planejarElementos,
3441
+ tn as planoDe,
3442
+ rn as pontoNoAnel,
3443
+ Lt as posicaoLocalDaAlca,
3444
+ fe as posicoesDasAlcas,
3445
+ ge as profundidadeNoCanto,
3446
+ on as raiosCabiveis,
3447
+ pe as raiosEfetivos,
3448
+ sn as recompor,
3449
+ nn as redefinirAvisoContexto,
3450
+ ln as regiaoDoElemento,
3451
+ Pt as reordenar,
3452
+ pr as resolverAparencia,
3453
+ cn as resolverSombra,
3454
+ un as resumirAparencia,
3455
+ za as rotacao,
3456
+ hr as rotacaoEmGraus,
3457
+ Gt as rotacaoPorArrasto,
3458
+ Ue as rotuloDoTipo,
3459
+ or as saneada,
3460
+ Ft as simplificarCaminho,
3461
+ Be as teclaReservadaDoNavegador,
3462
+ rr as temMedidorTexto,
3463
+ dn as temPreenchimento,
3464
+ hn as testarElemento,
3465
+ mn as transformarContorno,
3466
+ ue as transformarElemento,
3467
+ I as transformarElementos,
3231
3468
  k as translacao,
3232
- Ot as trechoMaisProximo,
3233
- bt as unirCaminhos,
3234
- rr as valorDaPropriedade,
3235
- Us as varreduraDoArco
3469
+ Ut as trechoMaisProximo,
3470
+ wt as unirCaminhos,
3471
+ fr as valorDaPropriedade,
3472
+ fn as varreduraDoArco
3236
3473
  };