@thibezer/ui-components-kit 2.22.0 → 2.24.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 (79) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +822 -820
  3. package/dist/camadas.cjs +1 -311
  4. package/dist/camadas.js +148 -3248
  5. package/dist/canvas.cjs +24 -24
  6. package/dist/canvas.js +90 -88
  7. package/dist/card.cjs +1 -1
  8. package/dist/card.js +1 -1
  9. package/dist/components/ui-calendario/calendario-datas.d.ts +28 -0
  10. package/dist/components/ui-calendario/calendario-teclado.d.ts +6 -0
  11. package/dist/components/ui-calendario/calendario-template.d.ts +14 -0
  12. package/dist/components/ui-calendario/index.d.ts +1 -0
  13. package/dist/components/ui-calendario/tipos.d.ts +43 -0
  14. package/dist/components/ui-calendario/ui-calendario.d.ts +81 -0
  15. package/dist/components/ui-canvas-prancha/index.d.ts +3 -1
  16. package/dist/components/ui-canvas-prancha/prancha-atributos-sync.d.ts +10 -1
  17. package/dist/components/ui-canvas-prancha/prancha-controlador.d.ts +7 -0
  18. package/dist/components/ui-canvas-prancha/prancha-documento.d.ts +6 -0
  19. package/dist/components/ui-canvas-prancha/prancha-paineis.d.ts +29 -0
  20. package/dist/components/ui-canvas-prancha/prancha-painel-camadas.d.ts +10 -1
  21. package/dist/components/ui-canvas-prancha/prancha-painel-propriedades.d.ts +18 -0
  22. package/dist/components/ui-canvas-prancha/prancha-pintura.d.ts +7 -0
  23. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +2 -0
  24. package/dist/components/ui-canvas-prancha/prancha-vista.d.ts +2 -0
  25. package/dist/components/ui-canvas-prancha/tipos.d.ts +18 -0
  26. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +43 -6
  27. package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +13 -5
  28. package/dist/components/ui-card/ui-card.d.ts +5 -0
  29. package/dist/components/ui-editor-prancha/editor-tipos.d.ts +12 -0
  30. package/dist/components/ui-editor-prancha/index.d.ts +2 -0
  31. package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +60 -0
  32. package/dist/custom-elements.json +34861 -32534
  33. package/dist/data.cjs +1 -1
  34. package/dist/data.js +99 -98
  35. package/dist/feature_caixa-2Sxv3tGa.js +824 -0
  36. package/dist/feature_caixa-4M4MkFH7.cjs +1 -0
  37. package/dist/feature_desenho-BH-E1Q9Q.cjs +1 -0
  38. package/dist/feature_desenho-BVHivWIB.js +222 -0
  39. package/dist/feature_historico-BAIYk1Me.cjs +3 -0
  40. package/dist/feature_historico-C4h9y5fu.js +3039 -0
  41. package/dist/geometria-px-DUs5FgLE.js +639 -0
  42. package/dist/gerencigeo-canvas/prancha/ajuste_caixa.d.ts +32 -0
  43. package/dist/gerencigeo-canvas/prancha/aparencia_lote.d.ts +49 -0
  44. package/dist/gerencigeo-canvas/prancha/elemento_predefinicoes.d.ts +36 -3
  45. package/dist/gerencigeo-canvas/prancha/envelope_visual.d.ts +12 -0
  46. package/dist/gerencigeo-canvas/prancha/index.d.ts +5 -0
  47. package/dist/gerencigeo-canvas/prancha/pintura_canvas.d.ts +43 -3
  48. package/dist/gerencigeo-canvas/prancha/pintura_contexto.d.ts +54 -0
  49. package/dist/gerencigeo-canvas/prancha/pintura_gradiente_faixas.d.ts +21 -0
  50. package/dist/index.cjs +1 -1
  51. package/dist/index.d.ts +6 -0
  52. package/dist/index.js +245 -242
  53. package/dist/motor.js +15 -15
  54. package/dist/prancha-nucleo.cjs +1 -0
  55. package/dist/prancha-nucleo.d.ts +3 -0
  56. package/dist/prancha-nucleo.js +302 -0
  57. package/dist/prancha.cjs +1 -1
  58. package/dist/prancha.d.ts +3 -0
  59. package/dist/prancha.js +228 -197
  60. package/dist/register.cjs +1 -1
  61. package/dist/register.js +8 -6
  62. package/dist/tabela.cjs +1 -1
  63. package/dist/tabela.js +90 -89
  64. package/dist/tipos-elementos.d.ts +56 -1
  65. package/dist/tipos-react.d.ts +4 -0
  66. package/dist/tipos-vue.d.ts +56 -1
  67. package/dist/ui-camadas-DoHPnbQm.js +3133 -0
  68. package/dist/ui-camadas-Vx7wYD4D.cjs +311 -0
  69. package/dist/ui-card-7IEYbCN0.js +150 -0
  70. package/dist/ui-card-Bx8EyzYY.cjs +20 -0
  71. package/dist/ui-editor-prancha-CIngI6yI.js +2886 -0
  72. package/dist/ui-editor-prancha-DorSe6sC.cjs +31 -0
  73. package/dist/ui-linha-B4mBRm1x.cjs +61 -0
  74. package/dist/ui-linha-DTEIIww4.js +1167 -0
  75. package/dist/ui-tabela-CXxqbwXv.cjs +7 -0
  76. package/dist/ui-tabela-Cd0vOwnT.js +1459 -0
  77. package/dist/ui-tabela-propriedades-D96Djx-q.cjs +136 -0
  78. package/dist/ui-tabela-propriedades-ahQhQauu.js +2329 -0
  79. package/package.json +6 -1
@@ -0,0 +1,639 @@
1
+ var lt = Object.defineProperty;
2
+ var ft = (t, n, o) => n in t ? lt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
3
+ var y = (t, n, o) => ft(t, typeof n != "symbol" ? n + "" : n, o);
4
+ function N(t) {
5
+ return t.partes && t.partes.length > 1 ? t.partes : [t.coordenadas];
6
+ }
7
+ function tn(t) {
8
+ return t.tipo === "LineString" && !!t.partes && t.partes.length > 1;
9
+ }
10
+ function mt(t) {
11
+ return t.length > 1 ? { tipo: "LineString", coordenadas: t[0], partes: t } : { tipo: "LineString", coordenadas: t[0] };
12
+ }
13
+ const P = 6378137, b = 1 / 298.257222101, G = b * (2 - b), m = (t) => t * Math.PI / 180;
14
+ function U(t) {
15
+ const n = Math.sin(m(t)), o = 1 - G * n * n;
16
+ return { N: P / Math.sqrt(o), M: P * (1 - G) / (o * Math.sqrt(o)) };
17
+ }
18
+ function nn(t) {
19
+ const { M: n, N: o } = U(t);
20
+ return { lat: m(1) * n, lng: m(1) * o * Math.cos(m(t)) };
21
+ }
22
+ function pt(t, n) {
23
+ const o = P * (1 - b), a = b, i = m(n[1] - t[1]), r = Math.atan((1 - a) * Math.tan(m(t[0]))), s = Math.atan((1 - a) * Math.tan(m(n[0]))), e = Math.sin(r), c = Math.cos(r), u = Math.sin(s), d = Math.cos(s);
24
+ let l = i, h = 0, f = 0, A = 0, p = 0, M = 0;
25
+ for (let S = 0; S < 100; S++) {
26
+ const k = Math.sin(l), z = Math.cos(l);
27
+ if (h = Math.hypot(d * k, c * u - e * d * z), h === 0) return 0;
28
+ f = e * u + c * d * z, A = Math.atan2(h, f);
29
+ const O = c * d * k / h;
30
+ p = 1 - O * O, M = p === 0 ? 0 : f - 2 * e * u / p;
31
+ const E = a / 16 * p * (4 + a * (4 - 3 * p)), dt = l;
32
+ if (l = i + (1 - E) * a * O * (A + E * h * (M + E * f * (-1 + 2 * M * M))), Math.abs(l - dt) < 1e-12) break;
33
+ }
34
+ const L = p * (P * P - o * o) / (o * o), D = 1 + L / 16384 * (4096 + L * (-768 + L * (320 - 175 * L))), g = L / 1024 * (256 + L * (-128 + L * (74 - 47 * L))), x = g * h * (M + g / 4 * (f * (-1 + 2 * M * M) - g / 6 * M * (-3 + 4 * h * h) * (-3 + 4 * M * M)));
35
+ return o * D * (A - x);
36
+ }
37
+ function V(t, n) {
38
+ const o = n[0] - t[0], a = n[1] - t[1];
39
+ if (Math.abs(o) < 0.1 && Math.abs(a) < 0.1) {
40
+ const { M: i, N: r } = U((t[0] + n[0]) / 2), s = m(o) * i, e = m(a) * r * Math.cos(m((t[0] + n[0]) / 2));
41
+ return Math.hypot(e, s);
42
+ }
43
+ return pt(t, n);
44
+ }
45
+ function Mt(t, n = !1) {
46
+ let o = 0;
47
+ for (let a = 1; a < t.length; a++) o += V(t[a - 1], t[a]);
48
+ return n && t.length > 2 && (o += V(t[t.length - 1], t[0])), o;
49
+ }
50
+ function q(t) {
51
+ const n = t.length;
52
+ if (n < 3) return 0;
53
+ let o = 0, a = 0;
54
+ for (let e = 0; e < n; e++) {
55
+ const c = t[(e - 1 + n) % n], u = t[e], d = t[(e + 1) % n];
56
+ o += m(d[1] - c[1]) * Math.sin(m(u[0])), a += u[0];
57
+ }
58
+ const { M: i, N: r } = U(a / n), s = Math.abs(o * i * r / 2);
59
+ return Number.isFinite(s) ? s : 0;
60
+ }
61
+ function Lt(t) {
62
+ const [n, ...o] = t;
63
+ return n ? Math.max(0, q(n) - o.reduce((a, i) => a + q(i), 0)) : 0;
64
+ }
65
+ const At = new Intl.NumberFormat("pt-BR", { minimumFractionDigits: 4, maximumFractionDigits: 4 }), H = new Intl.NumberFormat("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
66
+ function yt(t) {
67
+ return `${At.format(t / 1e4)} ha`;
68
+ }
69
+ function vt(t) {
70
+ return t >= 1e3 ? `${H.format(t / 1e3)} km` : `${H.format(t)} m`;
71
+ }
72
+ function xt(t, n) {
73
+ return t.tipo === "Polygon" ? n ? n.area(t.aneis) : Lt(t.aneis) : t.tipo === "Circle" ? Math.PI * t.raioMetros ** 2 : null;
74
+ }
75
+ function It(t, n) {
76
+ const o = (a, i = !1) => n ? n.comprimento(a, i) : Mt(a, i);
77
+ return t.tipo === "LineString" ? N(t).reduce((a, i) => a + o(i), 0) : t.tipo === "Polygon" ? o(t.aneis[0] ?? [], !0) : t.tipo === "Circle" ? 2 * Math.PI * t.raioMetros : null;
78
+ }
79
+ function on(t, n) {
80
+ var i;
81
+ const o = n ?? "name";
82
+ if (o === "area") {
83
+ const r = xt(t.geometria);
84
+ return r === null ? "" : yt(r);
85
+ }
86
+ if (o === "extensao") {
87
+ const r = It(t.geometria);
88
+ return r === null ? "" : vt(r);
89
+ }
90
+ if (o === "id") return t.id;
91
+ const a = (i = t.propriedades) == null ? void 0 : i[o];
92
+ return a != null && a !== "" ? String(a) : n ? "" : t.id;
93
+ }
94
+ function gt(t, n) {
95
+ const o = n / 111320, a = o / Math.max(0.01, Math.cos(m(t[0])));
96
+ return [[t[0] - o, t[1] - a], [t[0] + o, t[1] + a]];
97
+ }
98
+ function St(t, n) {
99
+ let o;
100
+ switch (t.tipo) {
101
+ case "Point":
102
+ case "Text":
103
+ o = [t.coordenada];
104
+ break;
105
+ case "LineString":
106
+ o = N(t).flat();
107
+ break;
108
+ case "Polygon":
109
+ o = t.aneis.flat();
110
+ break;
111
+ case "Circle":
112
+ o = n ? n.extremosDoCirculo(t.centro, t.raioMetros) : gt(t.centro, t.raioMetros);
113
+ break;
114
+ }
115
+ const a = o.map((r) => r[0]), i = o.map((r) => r[1]);
116
+ return [[Math.min(...a), Math.min(...i)], [Math.max(...a), Math.max(...i)]];
117
+ }
118
+ const C = 16, Pt = 256;
119
+ function X(t, n) {
120
+ const [[o, a], [i, r]] = St(t.geometria, n);
121
+ return { minLon: a, minLat: o, maxLon: r, maxLat: i };
122
+ }
123
+ function j(t, n) {
124
+ return t.minLon <= n.maxLon && t.maxLon >= n.minLon && t.minLat <= n.maxLat && t.maxLat >= n.minLat;
125
+ }
126
+ function B(t) {
127
+ let n = 1 / 0, o = 1 / 0, a = -1 / 0, i = -1 / 0;
128
+ for (const r of t)
129
+ r.minLon < n && (n = r.minLon), r.minLat < o && (o = r.minLat), r.maxLon > a && (a = r.maxLon), r.maxLat > i && (i = r.maxLat);
130
+ return { minLon: n, minLat: o, maxLon: a, maxLat: i };
131
+ }
132
+ function Z(t) {
133
+ const n = t.length, o = Math.ceil(n / C), i = Math.ceil(Math.sqrt(o)) * C, r = [...t].sort((e, c) => e.minLon + e.maxLon - (c.minLon + c.maxLon)), s = [];
134
+ for (let e = 0; e < n; e += i) {
135
+ const c = r.slice(e, e + i).sort((u, d) => u.minLat + u.maxLat - (d.minLat + d.maxLat));
136
+ for (let u = 0; u < c.length; u += C) s.push(c.slice(u, u + C));
137
+ }
138
+ return s;
139
+ }
140
+ function Ct(t) {
141
+ if (t.length === 0) return null;
142
+ let n = Z(t).map((o) => ({ ...B(o), folhas: o }));
143
+ for (; n.length > 1; )
144
+ n = Z(n).map((o) => ({ ...B(o), filhos: o }));
145
+ return n[0];
146
+ }
147
+ class an {
148
+ /** `espaco` define o envelope do círculo (sem ele, o geográfico de sempre). */
149
+ constructor(n) {
150
+ y(this, "raiz", null);
151
+ /** Itens vivos: a fonte da verdade (a árvore pode conter itens já removidos/atualizados). */
152
+ y(this, "itens", /* @__PURE__ */ new Map());
153
+ /** Itens que entraram ou mudaram depois da última montagem. */
154
+ y(this, "delta", /* @__PURE__ */ new Map());
155
+ /** Ids que estão na árvore mas foram removidos ou substituídos. */
156
+ y(this, "obsoletos", /* @__PURE__ */ new Set());
157
+ this.espaco = n;
158
+ }
159
+ get tamanho() {
160
+ return this.itens.size;
161
+ }
162
+ construir(n) {
163
+ this.itens.clear();
164
+ for (const o of n)
165
+ o.excluida || this.itens.set(o.id, { id: o.id, ...X(o, this.espaco) });
166
+ this.remontar();
167
+ }
168
+ inserir(n) {
169
+ this.atualizar(n);
170
+ }
171
+ /** Insere ou substitui; feição `excluida` sai do índice. */
172
+ atualizar(n) {
173
+ if (n.excluida) {
174
+ this.remover(n.id);
175
+ return;
176
+ }
177
+ const o = { id: n.id, ...X(n, this.espaco) };
178
+ this.itens.has(n.id) && this.obsoletos.add(n.id), this.itens.set(n.id, o), this.delta.set(n.id, o), this.compactarSeNecessario();
179
+ }
180
+ remover(n) {
181
+ this.itens.delete(n) && (this.obsoletos.add(n), this.delta.delete(n), this.compactarSeNecessario());
182
+ }
183
+ limpar() {
184
+ this.itens.clear(), this.remontar();
185
+ }
186
+ /** Ids das feições cujo envelope toca `caixa`. */
187
+ consultar(n) {
188
+ const o = [], a = this.raiz ? [this.raiz] : [];
189
+ for (; a.length > 0; ) {
190
+ const i = a.pop();
191
+ if (j(i, n))
192
+ if (i.folhas)
193
+ for (const r of i.folhas)
194
+ !this.obsoletos.has(r.id) && j(r, n) && o.push(r.id);
195
+ else i.filhos && a.push(...i.filhos);
196
+ }
197
+ for (const i of this.delta.values()) j(i, n) && o.push(i.id);
198
+ return o;
199
+ }
200
+ intersecta(n) {
201
+ return this.consultar(n).length > 0;
202
+ }
203
+ /** Envelope da feição indexada, se houver. */
204
+ caixaDe(n) {
205
+ return this.itens.get(n);
206
+ }
207
+ compactarSeNecessario() {
208
+ this.delta.size + this.obsoletos.size > Math.max(Pt, this.itens.size * 0.1) && this.remontar();
209
+ }
210
+ remontar() {
211
+ this.raiz = Ct([...this.itens.values()]), this.delta.clear(), this.obsoletos.clear();
212
+ }
213
+ }
214
+ const bt = 17, Nt = 9, Tt = 1.2;
215
+ function Dt(t) {
216
+ return !Number.isFinite(t) || t >= bt ? 0 : 360 / (256 * 2 ** t) * Tt;
217
+ }
218
+ function Y(t) {
219
+ return Number.isFinite(t) ? 1 / Math.max(0.05, Math.cos(Math.max(-85, Math.min(85, t)) * Math.PI / 180)) : 1;
220
+ }
221
+ function Ot(t, n, o, a) {
222
+ const i = o[1] - n[1], r = (o[0] - n[0]) * a, s = i * i + r * r, e = (t[0] - n[0]) * a;
223
+ let c = s === 0 ? 0 : ((t[1] - n[1]) * i + e * r) / s;
224
+ return c = Math.max(0, Math.min(1, c)), Math.hypot(t[1] - (n[1] + c * i), e - c * r);
225
+ }
226
+ function rt(t, n, o = 1) {
227
+ if (!(n > 0) || t.length < 3) return t;
228
+ const a = Number.isFinite(o) && o > 0 ? o : 1, i = new Uint8Array(t.length);
229
+ i[0] = 1, i[t.length - 1] = 1;
230
+ const r = [[0, t.length - 1]];
231
+ for (; r.length > 0; ) {
232
+ const [s, e] = r.pop();
233
+ let c = 0, u = -1;
234
+ for (let d = s + 1; d < e; d++) {
235
+ const l = Ot(t[d], t[s], t[e], a);
236
+ l > c && (c = l, u = d);
237
+ }
238
+ u !== -1 && c > n && (i[u] = 1, r.push([s, u], [u, e]));
239
+ }
240
+ return t.filter((s, e) => i[e] === 1);
241
+ }
242
+ function Et(t, n, o = 1) {
243
+ if (!(n > 0) || t.length < 4) return t;
244
+ const a = [...t, t[0]], i = rt(a, n, o);
245
+ return i.pop(), i.length >= 3 ? i : t;
246
+ }
247
+ function jt(t) {
248
+ return (t.tipo === "LineString" || t.tipo === "Polygon") && t.curva ? 0 : t.tipo === "LineString" ? N(t).reduce((n, o) => n + o.length, 0) : t.tipo === "Polygon" ? t.aneis.reduce((n, o) => n + o.length, 0) : 0;
249
+ }
250
+ function rn(t, n) {
251
+ var a, i, r, s;
252
+ const o = Dt(n);
253
+ if (o === 0 || jt(t) < Nt) return t;
254
+ if (t.tipo === "LineString") {
255
+ const e = N(t), c = Y(((i = (a = e[0]) == null ? void 0 : a[0]) == null ? void 0 : i[0]) ?? NaN);
256
+ return mt(e.map((u) => rt(u, o, c)));
257
+ }
258
+ if (t.tipo === "Polygon") {
259
+ const e = Y(((s = (r = t.aneis[0]) == null ? void 0 : r[0]) == null ? void 0 : s[0]) ?? NaN);
260
+ return { tipo: "Polygon", aneis: t.aneis.map((c) => Et(c, o, e)) };
261
+ }
262
+ return t;
263
+ }
264
+ const wt = /* @__PURE__ */ new Set(["previa", "prévia", "preview", "rascunho", "draft", "proposta"]);
265
+ function $(t) {
266
+ var o, a;
267
+ const n = [t.status, (o = t.propriedades) == null ? void 0 : o.status, (a = t.propriedades) == null ? void 0 : a.tipo_geometria];
268
+ for (const i of n)
269
+ if (typeof i == "string" && wt.has(i.trim().toLowerCase())) return "previa";
270
+ return "oficial";
271
+ }
272
+ function w(t) {
273
+ var o;
274
+ const n = t.entidadeId ?? ((o = t.propriedades) == null ? void 0 : o.entidadeId);
275
+ return typeof n == "string" || typeof n == "number" ? String(n) : t.id;
276
+ }
277
+ const F = (t, n) => `${t}\0${n}`;
278
+ class en {
279
+ constructor() {
280
+ /** Mostra as prévias de todas as entidades. */
281
+ y(this, "global", !1);
282
+ y(this, "individuais", /* @__PURE__ */ new Set());
283
+ }
284
+ alternarIndividual(n, o) {
285
+ const a = F(n, o);
286
+ return this.individuais.has(a) ? this.individuais.delete(a) : this.individuais.add(a), this.individuais.has(a);
287
+ }
288
+ definirIndividual(n, o, a) {
289
+ const i = F(n, o);
290
+ a ? this.individuais.add(i) : this.individuais.delete(i);
291
+ }
292
+ individualAtiva(n, o) {
293
+ return this.individuais.has(F(n, o));
294
+ }
295
+ /** Entidades da camada que têm geometria oficial. */
296
+ static oficiais(n) {
297
+ const o = /* @__PURE__ */ new Set();
298
+ for (const a of n) !a.excluida && $(a) === "oficial" && o.add(w(a));
299
+ return o;
300
+ }
301
+ /** A feição aparece? `comOficial` = entidades da camada com geometria oficial (ver `oficiais`). */
302
+ visivel(n, o) {
303
+ if ($(n) === "oficial") return !0;
304
+ const a = w(n);
305
+ return this.global || !o.has(a) || this.individualAtiva(n.camadaId, a);
306
+ }
307
+ /** A prévia está sendo mostrada por pedido (global ou individual), e não só por falta de oficial? */
308
+ previaSolicitada(n) {
309
+ return this.global || this.individualAtiva(n.camadaId, w(n));
310
+ }
311
+ }
312
+ const et = /* @__PURE__ */ new Set(["simetrico", "suave", "livre"]), J = 1e-6;
313
+ function sn(t) {
314
+ if (!t.entrada && !t.saida) return "canto";
315
+ if (t.modo && et.has(t.modo)) return t.modo;
316
+ if (!t.entrada || !t.saida) return "simetrico";
317
+ const n = t.ponto[0] - t.entrada[0], o = t.ponto[1] - t.entrada[1], a = t.saida[0] - t.ponto[0], i = t.saida[1] - t.ponto[1], r = Math.hypot(n, o), s = Math.hypot(a, i);
318
+ return r === 0 || s === 0 || !(Math.abs(n * i - o * a) <= J * r * s && n * a + o * i > 0) ? "livre" : Math.abs(r - s) <= J * Math.max(r, s) ? "simetrico" : "suave";
319
+ }
320
+ const Ft = 24, _t = 2, Q = (t) => typeof t == "number" && Number.isFinite(t), _ = (t) => Array.isArray(t) && t.length === 2 && Q(t[0]) && Q(t[1]);
321
+ function cn(t, n) {
322
+ return [2 * t[0] - n[0], 2 * t[1] - n[1]];
323
+ }
324
+ function Rt(t) {
325
+ return t.some((n) => n.entrada !== void 0 || n.saida !== void 0);
326
+ }
327
+ function st(t, n) {
328
+ return [t.saida ?? t.ponto, n.entrada ?? n.ponto];
329
+ }
330
+ function ct(t, n) {
331
+ const o = [];
332
+ for (let a = 0; a < t - 1; a++) o.push([a, a + 1]);
333
+ return n && t > 2 && o.push([t - 1, 0]), o;
334
+ }
335
+ function $t(t, n, o, a, i) {
336
+ const r = 1 - i, s = r * r * r, e = 3 * r * r * i, c = 3 * r * i * i, u = i * i * i;
337
+ return [s * t[0] + e * n[0] + c * o[0] + u * a[0], s * t[1] + e * n[1] + c * o[1] + u * a[1]];
338
+ }
339
+ function un(t, n = !1, o = Ft) {
340
+ if (t.length === 0) return [];
341
+ const a = [[t[0].ponto[0], t[0].ponto[1]]];
342
+ for (const [i, r] of ct(t.length, n)) {
343
+ const s = t[i], e = t[r];
344
+ if (!(s.saida === void 0 && e.entrada === void 0)) {
345
+ const [u, d] = st(s, e);
346
+ for (let l = 1; l < o; l++) a.push($t(s.ponto, u, d, e.ponto, l / o));
347
+ }
348
+ r !== 0 && a.push([e.ponto[0], e.ponto[1]]);
349
+ }
350
+ return a;
351
+ }
352
+ function Ut(t, n) {
353
+ if (t.length === 0) return [];
354
+ const o = [{ cmd: "M", pts: [t[0].ponto] }];
355
+ for (const [a, i] of ct(t.length, n)) {
356
+ const r = t[a], s = t[i];
357
+ if (r.saida === void 0 && s.entrada === void 0)
358
+ o.push({ cmd: "L", pts: [s.ponto] });
359
+ else {
360
+ const [e, c] = st(r, s);
361
+ o.push({ cmd: "C", pts: [e, c, s.ponto] });
362
+ }
363
+ }
364
+ return o;
365
+ }
366
+ function hn(t, n, o) {
367
+ const a = (r) => String(Math.round(r * 100) / 100), i = Ut(t, n).map((r) => r.cmd + r.pts.map((s) => {
368
+ const e = o(s);
369
+ return `${a(e.x)} ${a(e.y)}`;
370
+ }).join(" ")).join("");
371
+ return i && n ? `${i}Z` : i;
372
+ }
373
+ function dn(t, n = _t) {
374
+ if (!Array.isArray(t) || t.length < n) return null;
375
+ const o = [];
376
+ for (const a of t) {
377
+ if (!a || typeof a != "object" || !_(a.ponto)) return null;
378
+ const i = a, r = { ponto: [i.ponto[0], i.ponto[1]] };
379
+ _(i.entrada) && (r.entrada = [i.entrada[0], i.entrada[1]]), _(i.saida) && (r.saida = [i.saida[0], i.saida[1]]), typeof i.modo == "string" && et.has(i.modo) && (r.entrada || r.saida) && (r.modo = i.modo), o.push(r);
380
+ }
381
+ return Rt(o) ? o : null;
382
+ }
383
+ function ln(t, n) {
384
+ return t.map((o) => {
385
+ const a = { ponto: n(o.ponto) };
386
+ return o.entrada && (a.entrada = n(o.entrada)), o.saida && (a.saida = n(o.saida)), o.modo && (a.modo = o.modo), a;
387
+ });
388
+ }
389
+ function fn(t) {
390
+ return t.tipo === "LineString" ? t.curva && t.curva.length >= 2 && !(t.partes && t.partes.length > 1) ? t.curva : null : t.tipo === "Polygon" && t.curva && t.curva.length >= 3 && t.aneis.length === 1 ? t.curva : null;
391
+ }
392
+ const kt = [
393
+ "continua",
394
+ "tracejada",
395
+ "tracejada-curta",
396
+ "tracejada-longa",
397
+ "pontilhada",
398
+ "traco-ponto",
399
+ "traco-ponto-ponto",
400
+ "oculta",
401
+ "centro",
402
+ "fantasma",
403
+ "divisa"
404
+ ], zt = {
405
+ tracejada: [12, 6],
406
+ "tracejada-curta": [6, 4],
407
+ "tracejada-longa": [24, 8],
408
+ pontilhada: [0, 4],
409
+ "traco-ponto": [12, 4, 0, 4],
410
+ "traco-ponto-ponto": [12, 4, 0, 4, 0, 4],
411
+ oculta: [6, 3],
412
+ centro: [24, 4, 6, 4],
413
+ fantasma: [24, 4, 6, 4, 6, 4],
414
+ divisa: [12, 4, 12, 4, 0, 4]
415
+ }, K = { arredondada: "round", reta: "butt", quadrada: "square" }, W = { arredondada: "round", chanfrada: "bevel", angular: "miter" }, Gt = 0.05, Vt = 100, tt = {
416
+ continuous: "continua",
417
+ dashed: "tracejada",
418
+ dashed2: "tracejada-curta",
419
+ dashedx2: "tracejada-longa",
420
+ dot: "pontilhada",
421
+ dotted: "pontilhada",
422
+ dashdot: "traco-ponto",
423
+ divide: "traco-ponto-ponto",
424
+ hidden: "oculta",
425
+ center: "centro",
426
+ phantom: "fantasma",
427
+ border: "divisa"
428
+ };
429
+ function nt(t) {
430
+ return typeof t == "string" && kt.includes(t);
431
+ }
432
+ function ut(t) {
433
+ if (nt(t)) return t;
434
+ if (typeof t != "string") return;
435
+ const n = t.trim().toLowerCase();
436
+ return nt(n) ? n : Object.prototype.hasOwnProperty.call(tt, n) ? tt[n] : void 0;
437
+ }
438
+ function ot(t) {
439
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(K, t) ? K[t] : void 0;
440
+ }
441
+ function at(t) {
442
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(W, t) ? W[t] : void 0;
443
+ }
444
+ function qt(t) {
445
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 1 : Math.min(Vt, Math.max(Gt, t));
446
+ }
447
+ function it(t, n, o = 1, a = "round") {
448
+ const i = ut(t);
449
+ if (!i || i === "continua") return;
450
+ const r = Number.isFinite(n) && n > 0 ? n : 1, s = qt(o) * Math.max(1, r / 2), e = a === "butt" ? r : 0, c = a === "butt" ? 0 : r;
451
+ return zt[i].map((u, d) => {
452
+ const l = d % 2 === 0 ? u === 0 ? e : u * s : u * s + c;
453
+ return Math.round(l * 100) / 100;
454
+ }).join(" ");
455
+ }
456
+ const Ht = "#38bdf8", Xt = "#38bdf8", Bt = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([0-9.,%\s\/-]+\)|[a-z]{3,20})$/i;
457
+ function R(t, n) {
458
+ return typeof t == "string" && Bt.test(t.trim()) ? t.trim() : n;
459
+ }
460
+ const v = (t) => typeof t == "number" && Number.isFinite(t);
461
+ function mn(t, n, o = !1) {
462
+ const a = t.estilo ?? {}, i = R(a.corTraco ?? n.corPrimaria, Ht), r = t.geometria.tipo, s = r === "Polygon" || r === "Circle", e = r === "Point", c = e && R(a.corContorno, "") || i, u = e && v(a.espessuraContorno) && a.espessuraContorno >= 0 ? a.espessuraContorno : void 0, d = u ?? (v(a.espessuraTraco) ? a.espessuraTraco : void 0) ?? (v(n.espessuraLinha) ? n.espessuraLinha : 2), l = v(a.opacidadePreenchimento) ? a.opacidadePreenchimento : s ? 0.2 : 0.85, h = o ? d + 2 : d, f = ot(a.terminacaoTraco) ?? ot(n.terminacaoLinha) ?? "round", A = v(a.opacidadeTraco) ? a.opacidadeTraco : v(n.opacidadeLinha) ? n.opacidadeLinha : 1;
463
+ return {
464
+ cor: o ? Xt : c,
465
+ traco: !(u === 0 && !o),
466
+ peso: h,
467
+ dash: Zt(t, n, h, f),
468
+ // selecionada fica opaca: a seleção precisa aparecer mesmo numa linha quase transparente
469
+ opacidadeTraco: o ? 1 : Math.min(1, Math.max(0, A)),
470
+ terminacao: f,
471
+ juncao: at(a.juncaoTraco) ?? at(n.juncaoLinha) ?? "round",
472
+ deslocamentoDash: v(a.deslocamentoTracejado) ? a.deslocamentoTracejado : 0,
473
+ preencher: s || e,
474
+ corPreenchimento: R(a.corPreenchimento, i),
475
+ opacidadePreenchimento: o ? Math.min(1, l + 0.18) : l
476
+ };
477
+ }
478
+ function Zt(t, n, o, a) {
479
+ const i = t.estilo ?? {};
480
+ if (i.dashArray) return i.dashArray;
481
+ if (i.tipoLinha !== void 0 && i.tipoLinha !== null) {
482
+ const r = it(i.tipoLinha, o, i.escalaTipoLinha ?? n.escalaTipoLinha, a);
483
+ if (r || ut(i.tipoLinha) === "continua") return r;
484
+ }
485
+ return $(t) === "previa" ? "6 4" : n.dashArray ? n.dashArray : it(n.tipoLinha, o, n.escalaTipoLinha, a);
486
+ }
487
+ function pn(t, n) {
488
+ var a;
489
+ const o = ((a = t.estilo) == null ? void 0 : a.tamanhoIcone) ?? n.tamanhoMarcador ?? 8;
490
+ return (v(o) && o > 0 ? o : 8) / 2;
491
+ }
492
+ class Mn {
493
+ constructor() {
494
+ y(this, "porChave", /* @__PURE__ */ new Map());
495
+ }
496
+ interno(n) {
497
+ const o = `${n.cor}|${n.traco ? 1 : 0}|${n.peso}|${n.dash ?? ""}|${n.opacidadeTraco ?? 1}|${n.terminacao ?? ""}|${n.juncao ?? ""}|${n.deslocamentoDash ?? 0}|${n.preencher ? 1 : 0}|${n.corPreenchimento}|${n.opacidadePreenchimento}`, a = this.porChave.get(o);
498
+ return a || (this.porChave.set(o, n), n);
499
+ }
500
+ limpar() {
501
+ this.porChave.clear();
502
+ }
503
+ }
504
+ const Yt = 256, I = 85.0511287798, Jt = 4007501668557849e-8;
505
+ function ht(t, n, o, a, i) {
506
+ const r = o > I ? I : o < -I ? -I : o, s = Math.sin(r * Math.PI / 180);
507
+ t[n] = (a + 180) / 360 * i, t[n + 1] = (0.5 - Math.log((1 + s) / (1 - s)) / (4 * Math.PI)) * i;
508
+ }
509
+ const T = (t) => Yt * 2 ** t;
510
+ function Ln(t, n, o) {
511
+ const a = T(o);
512
+ return [Math.atan(Math.sinh(Math.PI * (1 - 2 * n / a))) * 180 / Math.PI, t / a * 360 - 180];
513
+ }
514
+ function An(t, n) {
515
+ const o = T(n), a = new Float64Array(t.length * 2);
516
+ for (let i = 0; i < t.length; i++) {
517
+ const r = t[i];
518
+ ht(a, i * 2, r[0], r[1], o);
519
+ }
520
+ return a;
521
+ }
522
+ function yn(t, n, o) {
523
+ const a = new Float64Array(2);
524
+ return ht(a, 0, t, n, T(o)), a;
525
+ }
526
+ function Qt(t, n) {
527
+ const o = Math.max(-I, Math.min(I, t));
528
+ return Jt * Math.cos(o * Math.PI / 180) / T(n);
529
+ }
530
+ function vn(t, n, o) {
531
+ const a = Qt(t, o), i = n / a;
532
+ return Number.isFinite(i) && i >= 0 ? i : 0;
533
+ }
534
+ function xn(t) {
535
+ let n = 1 / 0, o = 1 / 0, a = -1 / 0, i = -1 / 0;
536
+ for (const r of t)
537
+ for (let s = 0; s + 1 < r.length; s += 2) {
538
+ const e = r[s], c = r[s + 1];
539
+ Number.isFinite(e) && Number.isFinite(c) && (e < n && (n = e), e > a && (a = e), c < o && (o = c), c > i && (i = c));
540
+ }
541
+ return n <= a && o <= i ? { minX: n, minY: o, maxX: a, maxY: i } : null;
542
+ }
543
+ function Kt(t, n, o, a, i, r) {
544
+ const s = i - o, e = r - a, c = s * s + e * e;
545
+ let u = c === 0 ? 0 : ((t - o) * s + (n - a) * e) / c;
546
+ return u = u < 0 ? 0 : u > 1 ? 1 : u, Math.hypot(t - (o + u * s), n - (a + u * e));
547
+ }
548
+ function In(t, n, o) {
549
+ const a = t.length >> 1;
550
+ if (!(n > 0) || a < 3) return t;
551
+ let i = t, r = a;
552
+ o && (i = new Float64Array((a + 1) * 2), i.set(t), i[a * 2] = t[0], i[a * 2 + 1] = t[1], r = a + 1);
553
+ const s = new Uint8Array(r);
554
+ s[0] = 1, s[r - 1] = 1;
555
+ const e = [0, r - 1];
556
+ for (; e.length > 0; ) {
557
+ const h = e.pop(), f = e.pop();
558
+ let A = 0, p = -1;
559
+ const M = i[f * 2], L = i[f * 2 + 1], D = i[h * 2], g = i[h * 2 + 1];
560
+ for (let x = f + 1; x < h; x++) {
561
+ const S = Kt(i[x * 2], i[x * 2 + 1], M, L, D, g);
562
+ S > A && (A = S, p = x);
563
+ }
564
+ p !== -1 && A > n && (s[p] = 1, e.push(f, p, p, h));
565
+ }
566
+ const c = o ? r - 1 : r;
567
+ let u = 0;
568
+ for (let h = 0; h < c; h++) s[h] && u++;
569
+ if (o && u < 3 || u === c) return t;
570
+ const d = new Float64Array(u * 2);
571
+ let l = 0;
572
+ for (let h = 0; h < c; h++)
573
+ s[h] && (d[l++] = i[h * 2], d[l++] = i[h * 2 + 1]);
574
+ return d;
575
+ }
576
+ export {
577
+ T as $,
578
+ Et as A,
579
+ rt as B,
580
+ hn as C,
581
+ Ht as D,
582
+ Xt as E,
583
+ $ as F,
584
+ w as G,
585
+ jt as H,
586
+ an as I,
587
+ rn as J,
588
+ j as K,
589
+ mn as L,
590
+ Nt as M,
591
+ pn as N,
592
+ on as O,
593
+ Ln as P,
594
+ xt as Q,
595
+ It as R,
596
+ yt as S,
597
+ kt as T,
598
+ vt as U,
599
+ en as V,
600
+ Mn as W,
601
+ X,
602
+ xn as Y,
603
+ bt as Z,
604
+ nt as _,
605
+ un as a,
606
+ Y as a0,
607
+ Qt as a1,
608
+ yn as a2,
609
+ ht as a3,
610
+ An as a4,
611
+ vn as a5,
612
+ In as a6,
613
+ Dt as a7,
614
+ gt as b,
615
+ Lt as c,
616
+ Mt as d,
617
+ cn as e,
618
+ V as f,
619
+ tn as g,
620
+ ln as h,
621
+ mt as i,
622
+ st as j,
623
+ $t as k,
624
+ sn as l,
625
+ nn as m,
626
+ St as n,
627
+ ot as o,
628
+ N as p,
629
+ ut as q,
630
+ at as r,
631
+ qt as s,
632
+ Rt as t,
633
+ R as u,
634
+ it as v,
635
+ dn as w,
636
+ Kt as x,
637
+ fn as y,
638
+ Ut as z
639
+ };
@@ -0,0 +1,32 @@
1
+ import { CaixaMm, ElementoGrafico } from './tipos';
2
+ export interface OpcoesAjusteCaixa {
3
+ /** Escala uniforme (a menor das duas) e centraliza no destino. Padrão `false`. */
4
+ manterProporcao?: boolean;
5
+ /**
6
+ * `'distorcer'` (padrão): o texto acompanha a matriz, esticado junto; `'tamanho'`: o texto muda de posição e de corpo
7
+ * uniformemente (média geométrica das escalas), sem distorcer; `'nao'`: só muda de posição.
8
+ */
9
+ escalarTexto?: 'distorcer' | 'tamanho' | 'nao';
10
+ /** Também ajusta os elementos bloqueados (padrão `true`: o desenho é um bloco só). */
11
+ incluirBloqueados?: boolean;
12
+ }
13
+ /**
14
+ * Leva `elementos`, que ocupam `caixaOrigem`, para `caixaDestino`. Caixa inválida ou degenerada (largura/altura ≤ 0, não
15
+ * finita) RECUSA: devolve uma cópia sem alteração. Nunca lança.
16
+ */
17
+ export declare function ajustarElementosACaixa(elementos: readonly ElementoGrafico[], caixaOrigem: CaixaMm, caixaDestino: CaixaMm, opcoes?: OpcoesAjusteCaixa): ElementoGrafico[];
18
+ export interface OpcoesNormalizarOrigem {
19
+ /** Tamanho mínimo (mm) da caixa resultante; o desenho fica centrado nela. Padrão 0. */
20
+ minimo?: number;
21
+ }
22
+ /**
23
+ * Translada TODOS os elementos (bloqueados inclusive) para que o envelope visual comece em (0, 0). Com `minimo`, uma
24
+ * caixa menor que ele é ampliada e o desenho centrado. Devolve os elementos e a caixa resultante (`x = y = 0`). Sem nada
25
+ * visível, devolve a cópia e uma caixa `minimo × minimo` (ou 0 × 0).
26
+ */
27
+ export declare function normalizarParaOrigem(elementos: readonly ElementoGrafico[], opcoes?: OpcoesNormalizarOrigem): {
28
+ elementos: ElementoGrafico[];
29
+ caixa: CaixaMm;
30
+ };
31
+ /** Ponto da caixa origem mapeado por `ajustarElementosACaixa` (útil ao app para reposicionar guias). */
32
+ export declare function mapearPontoNaCaixa(p: [number, number], origem: CaixaMm, destino: CaixaMm): [number, number] | null;