@ingcreators/annot-core 0.3.0 → 0.4.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.
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
- import { buildPngChunk as e, concat as t, readU32be as n, startsWith as r } from "./xmp-bytes.js";
2
- import { deflate as i, inflate as a } from "pako";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./element-tree-C0Vl00o2.js";
2
+ import { buildPngChunk as u, concat as d, readU32be as f, startsWith as p } from "./xmp-bytes.js";
3
+ import { deflate as m, inflate as h } from "pako";
3
4
  //#region src/editor/font-registry.ts
4
- var o = [
5
+ var g = [
5
6
  "Annot Sans",
6
7
  "Annot Serif",
7
8
  "Annot Mono"
8
- ], s = {
9
+ ], _ = {
9
10
  "Annot Sans": [
10
11
  "-apple-system",
11
12
  "BlinkMacSystemFont",
@@ -45,7 +46,7 @@ var o = [
45
46
  "\"Noto Sans Mono CJK JP\"",
46
47
  "monospace"
47
48
  ].join(", ")
48
- }, c = {
49
+ }, v = {
49
50
  "Annot Sans": {
50
51
  latin: "Calibri",
51
52
  ea: "Yu Gothic UI",
@@ -62,22 +63,22 @@ var o = [
62
63
  cs: "Courier New"
63
64
  }
64
65
  };
65
- function l(e) {
66
- return s[e];
66
+ function y(e) {
67
+ return _[e];
67
68
  }
68
- function u(e) {
69
- return c[e];
69
+ function b(e) {
70
+ return v[e];
70
71
  }
71
- function d(e) {
72
- return e == null ? !1 : o.includes(e);
72
+ function x(e) {
73
+ return e == null ? !1 : g.includes(e);
73
74
  }
74
- function f(e) {
75
- return d(e) ? e : "Annot Sans";
75
+ function S(e) {
76
+ return x(e) ? e : "Annot Sans";
76
77
  }
77
78
  //#endregion
78
79
  //#region src/editor/history-core.ts
79
- var p = 100;
80
- function m(e) {
80
+ var C = 100;
81
+ function ee(e) {
81
82
  let t = [], n = [], r = e.maxDepth ?? 100, i = () => {
82
83
  e.onStateChange?.();
83
84
  }, a = {
@@ -105,19 +106,19 @@ function m(e) {
105
106
  }
106
107
  //#endregion
107
108
  //#region src/editor/toolbar-icons.ts
108
- var h = {
109
+ var w = {
109
110
  rect: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linejoin=\"miter\" aria-hidden=\"true\"><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\"/></svg>",
110
111
  rounded: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\"><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"5\"/></svg>",
111
112
  ellipse: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\"><ellipse cx=\"12\" cy=\"12\" rx=\"8\" ry=\"8\"/></svg>"
112
- }, g = {
113
+ }, T = {
113
114
  none: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 12 H20\"/></svg>",
114
115
  end: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 12 H20\"/><path d=\"M16 8 L20 12 L16 16\"/></svg>",
115
116
  both: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 12 H20\"/><path d=\"M16 8 L20 12 L16 16\"/><path d=\"M8 8 L4 12 L8 16\"/></svg>"
116
- }, _ = {
117
+ }, E = {
117
118
  circle: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\"><ellipse cx=\"12\" cy=\"12\" rx=\"8\" ry=\"8\"/><text x=\"12\" y=\"17\" text-anchor=\"middle\" font-size=\"14\" font-weight=\"800\" font-family=\"system-ui, sans-serif\" fill=\"currentColor\" stroke=\"none\">1</text></svg>",
118
119
  rect: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linejoin=\"miter\" aria-hidden=\"true\"><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\"/><text x=\"12\" y=\"17\" text-anchor=\"middle\" font-size=\"14\" font-weight=\"800\" font-family=\"system-ui, sans-serif\" fill=\"currentColor\" stroke=\"none\">1</text></svg>",
119
120
  rounded: "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\"><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"5\"/><text x=\"12\" y=\"17\" text-anchor=\"middle\" font-size=\"14\" font-weight=\"800\" font-family=\"system-ui, sans-serif\" fill=\"currentColor\" stroke=\"none\">1</text></svg>"
120
- }, v = [
121
+ }, D = [
121
122
  {
122
123
  value: "#ffe100",
123
124
  label: "Yellow"
@@ -142,7 +143,7 @@ var h = {
142
143
  value: "#c991ff",
143
144
  label: "Purple"
144
145
  }
145
- ], y = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.42 7.42 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z\"/></svg>", b = {
146
+ ], te = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.42 7.42 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z\"/></svg>", O = {
146
147
  add: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M450-450H200v-60h250v-250h60v250h250v60H510v250h-60v-250Z\"/></svg>",
147
148
  add_to_drive: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M210-100q-12 0-25.5-7.5T165-126L55-318q-6-11-6-26t6-26l270-464q6-11 19.5-18.5T370-860h220q12 0 25.5 7.5T635-834l187 321q-18-5-36.5-7t-37.5-1L585-800H375L109-344l105 184h338q10 17 22.5 32t26.5 28H210Zm80-180-29-51 183-319h72l101 176q-13 9-23.5 20T573-431l-93-161-145 252h193q-4 14-6 29t-2 31H290Zm440 150v-120H610v-60h120v-120h60v120h120v60H790v120h-60Z\"/></svg>",
148
149
  align_horizontal_center: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M450-80v-210H240v-100h210v-180H120v-100h330v-210h60v210h330v100H510v180h210v100H510v210h-60Z\"/></svg>",
@@ -245,27 +246,27 @@ var h = {
245
246
  view_module: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M621-510h159v-190H621v190Zm-221 0h161v-190H400v190Zm-219 0h159v-190H181v190Zm0 250h159v-190H181v190Zm219 0h161v-190H400v190Zm221 0h159v-190H621v190Zm-500 0v-440q0-24.75 17.63-42.38Q156.25-760 181-760h599q24.75 0 42.38 17.62Q840-724.75 840-700v440q0 24.75-17.62 42.37Q804.75-200 780-200H181q-24.75 0-42.37-17.63Q121-235.25 121-260Z\"/></svg>",
246
247
  visibility_off: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"m629-419-44-44q26-71-27-118t-115-24l-44-44q17-11 38-16t43-5q71 0 120.5 49.5T650-500q0 22-5.5 43.5T629-419Zm129 129-40-40q49-36 85.5-80.5T857-500q-50-111-150-175.5T490-740q-42 0-86 8t-69 19l-46-47q35-16 89.5-28T485-800q143 0 261.5 81.5T920-500q-26 64-67 117t-95 93Zm58 226L648-229q-35 14-79 21.5t-89 7.5q-146 0-265-81.5T40-500q20-52 55.5-101.5T182-696L56-822l42-43 757 757-39 44ZM223-654q-37 27-71.5 71T102-500q51 111 153.5 175.5T488-260q33 0 65-4t48-12l-64-64q-11 5-27 7.5t-30 2.5q-70 0-120-49t-50-121q0-15 2.5-30t7.5-27l-97-97Zm305 142Zm-116 58Z\"/></svg>",
247
248
  warning: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"m40-120 440-760 440 760H40Zm104-60h672L480-760 144-180Zm361.5-65.68q8.5-8.67 8.5-21.5 0-12.82-8.68-21.32-8.67-8.5-21.5-8.5-12.82 0-21.32 8.68-8.5 8.67-8.5 21.5 0 12.82 8.68 21.32 8.67 8.5 21.5 8.5 12.82 0 21.32-8.68ZM454-348h60v-224h-60v224Zm26-122Z\"/></svg>"
248
- }, ee = {
249
- "shape.rect": h.rect,
250
- "shape.rounded": h.rounded,
251
- "shape.ellipse": h.ellipse,
252
- "arrow.none": g.none,
253
- "arrow.end": g.end,
254
- "arrow.both": g.both,
255
- "counter.circle": _.circle,
256
- "counter.rect": _.rect,
257
- "counter.rounded": _.rounded,
258
- "brand.github": y
259
- }, x = {
260
- ...b,
261
- ...ee
262
- }, S = Object.keys(x);
263
- function te(e) {
264
- return x[e];
249
+ }, ne = {
250
+ "shape.rect": w.rect,
251
+ "shape.rounded": w.rounded,
252
+ "shape.ellipse": w.ellipse,
253
+ "arrow.none": T.none,
254
+ "arrow.end": T.end,
255
+ "arrow.both": T.both,
256
+ "counter.circle": E.circle,
257
+ "counter.rect": E.rect,
258
+ "counter.rounded": E.rounded,
259
+ "brand.github": te
260
+ }, re = {
261
+ ...O,
262
+ ...ne
263
+ }, ie = Object.keys(re);
264
+ function ae(e) {
265
+ return re[e];
265
266
  }
266
267
  //#endregion
267
268
  //#region src/editor/icons/sanitize.ts
268
- var ne = "http://www.w3.org/2000/svg", re = 64 * 1024, ie = {
269
+ var oe = "http://www.w3.org/2000/svg", se = 64 * 1024, ce = {
269
270
  svg: "svg",
270
271
  g: "g",
271
272
  path: "path",
@@ -285,64 +286,64 @@ var ne = "http://www.w3.org/2000/svg", re = 64 * 1024, ie = {
285
286
  desc: "desc",
286
287
  text: "text",
287
288
  tspan: "tspan"
288
- }, ae = /* @__PURE__ */ new Set(/* @__PURE__ */ "id.class.viewBox.preserveAspectRatio.fill.fill-rule.fill-opacity.stroke.stroke-width.stroke-linecap.stroke-linejoin.stroke-dasharray.stroke-dashoffset.stroke-opacity.stroke-miterlimit.transform.opacity.color.aria-hidden.aria-label.role.width.height.x.y.x1.y1.x2.y2.cx.cy.r.rx.ry.d.points.offset.stop-color.stop-opacity.gradientUnits.gradientTransform.spreadMethod.fr.fx.fy.text-anchor.dominant-baseline.font-size.font-family.font-weight.letter-spacing.dx.dy".split(".")), oe = { use: /* @__PURE__ */ new Set(["href", "xlink:href"]) };
289
- function C(e) {
289
+ }, le = /* @__PURE__ */ new Set(/* @__PURE__ */ "id.class.viewBox.preserveAspectRatio.fill.fill-rule.fill-opacity.stroke.stroke-width.stroke-linecap.stroke-linejoin.stroke-dasharray.stroke-dashoffset.stroke-opacity.stroke-miterlimit.transform.opacity.color.aria-hidden.aria-label.role.width.height.x.y.x1.y1.x2.y2.cx.cy.r.rx.ry.d.points.offset.stop-color.stop-opacity.gradientUnits.gradientTransform.spreadMethod.fr.fx.fy.text-anchor.dominant-baseline.font-size.font-family.font-weight.letter-spacing.dx.dy".split(".")), ue = { use: /* @__PURE__ */ new Set(["href", "xlink:href"]) };
290
+ function de(e) {
290
291
  return /^#[A-Za-z_][A-Za-z0-9_\-:.]*$/.test(e);
291
292
  }
292
- function se(e) {
293
+ function fe(e) {
293
294
  return /^\s*(javascript|data:text\/html|vbscript):/i.test(e);
294
295
  }
295
- function ce(e) {
296
+ function pe(e) {
296
297
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
297
298
  }
298
- function le(e) {
299
- if (typeof e != "string" || e.length === 0 || e.length > re) return null;
299
+ function me(e) {
300
+ if (typeof e != "string" || e.length === 0 || e.length > se) return null;
300
301
  let t = globalThis.DOMParser;
301
302
  if (!t) return null;
302
303
  let n = new t().parseFromString(e, "image/svg+xml").documentElement;
303
- return !n || n.namespaceURI !== ne || (n.localName ?? "").toLowerCase() !== "svg" ? null : ue(n);
304
+ return !n || n.namespaceURI !== oe || (n.localName ?? "").toLowerCase() !== "svg" ? null : he(n);
304
305
  }
305
- function ue(e) {
306
- let t = (e.localName ?? "").toLowerCase(), n = ie[t];
306
+ function he(e) {
307
+ let t = (e.localName ?? "").toLowerCase(), n = ce[t];
307
308
  if (!n) return "";
308
- let r = de(e, t, n === "svg"), i = [];
309
+ let r = ge(e, t, n === "svg"), i = [];
309
310
  for (let t of Array.from(e.childNodes)) if (t.nodeType === 1) {
310
311
  let e = t;
311
- if (e.namespaceURI !== ne) continue;
312
- let n = ue(e);
312
+ if (e.namespaceURI !== oe) continue;
313
+ let n = he(e);
313
314
  n && i.push(n);
314
315
  } else if (t.nodeType === 3) {
315
316
  let e = t.nodeValue ?? "";
316
- e.length > 0 && i.push(ce(e));
317
+ e.length > 0 && i.push(pe(e));
317
318
  }
318
319
  return i.length === 0 ? `<${n}${r}/>` : `<${n}${r}>${i.join("")}</${n}>`;
319
320
  }
320
- function de(e, t, n) {
321
- let r = oe[t], i = [];
322
- n && i.push(` xmlns="${ne}"`);
321
+ function ge(e, t, n) {
322
+ let r = ue[t], i = [];
323
+ n && i.push(` xmlns="${oe}"`);
323
324
  for (let t of Array.from(e.attributes)) {
324
325
  let e = t.name;
325
326
  if (e.startsWith("on") || e === "style" || e.startsWith("xmlns")) continue;
326
- let n = ae.has(e), a = r?.has(e) === !0;
327
- !n && !a || a && !C(t.value) || se(t.value) || i.push(` ${e}="${ce(t.value)}"`);
327
+ let n = le.has(e), a = r?.has(e) === !0;
328
+ !n && !a || a && !de(t.value) || fe(t.value) || i.push(` ${e}="${pe(t.value)}"`);
328
329
  }
329
330
  return i.join("");
330
331
  }
331
332
  //#endregion
332
333
  //#region src/editor/icons/render.ts
333
- function fe(e) {
334
+ function _e(e) {
334
335
  let t = e.trim();
335
336
  return t.length === 0 ? !1 : /^data:image\/svg\+xml[,;]/i.test(t) ? !0 : !(/^javascript:/i.test(t) || /^data:/i.test(t) || /^[a-z][a-z0-9+.-]*:/i.test(t));
336
337
  }
337
- function pe(e) {
338
+ function ve(e) {
338
339
  switch (e.kind) {
339
- case "builtin": return te(e.id) ?? "";
340
- case "svg": return le(e.svg) ?? "";
341
- case "url": return fe(e.url) ? `<img src="${e.url.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;")}" alt="" aria-hidden="true" class="annot-icon-img"/>` : "";
340
+ case "builtin": return ae(e.id) ?? "";
341
+ case "svg": return me(e.svg) ?? "";
342
+ case "url": return _e(e.url) ? `<img src="${e.url.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;")}" alt="" aria-hidden="true" class="annot-icon-img"/>` : "";
342
343
  }
343
344
  }
344
- function me(e, t) {
345
- let n = pe(e);
345
+ function ye(e, t) {
346
+ let n = ve(e);
346
347
  if (!n) return null;
347
348
  let r = t ?? globalThis.document ?? null;
348
349
  if (!r) return null;
@@ -351,7 +352,7 @@ function me(e, t) {
351
352
  }
352
353
  //#endregion
353
354
  //#region src/editor/path-utils.ts
354
- var he = {
355
+ var be = {
355
356
  M: ["x", "y"],
356
357
  L: ["x", "y"],
357
358
  H: ["x"],
@@ -388,7 +389,7 @@ var he = {
388
389
  ],
389
390
  Z: []
390
391
  };
391
- function ge(e) {
392
+ function xe(e) {
392
393
  let t = [], n = /([A-DF-Za-df-z])|(-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/g, r = null, i = n.exec(e);
393
394
  for (; i !== null;) {
394
395
  let a = i[1], o = i[2];
@@ -402,19 +403,19 @@ function ge(e) {
402
403
  }
403
404
  return t;
404
405
  }
405
- function _e(e) {
406
+ function Se(e) {
406
407
  return Math.abs(e) < 1e-9 ? "0" : Number(e.toFixed(6)).toString();
407
408
  }
408
- function ve(e) {
409
+ function Ce(e) {
409
410
  let t = [];
410
- for (let n of e) n.params.length === 0 ? t.push(n.cmd) : t.push(n.cmd + n.params.map(_e).join(" "));
411
+ for (let n of e) n.params.length === 0 ? t.push(n.cmd) : t.push(n.cmd + n.params.map(Se).join(" "));
411
412
  return t.join(" ");
412
413
  }
413
- function ye(e, t, n) {
414
+ function we(e, t, n) {
414
415
  if (t === 0 && n === 0) return e;
415
- let r = ge(e), i = !0;
416
+ let r = xe(e), i = !0;
416
417
  for (let e of r) {
417
- let r = e.cmd.toUpperCase(), a = he[r];
418
+ let r = e.cmd.toUpperCase(), a = be[r];
418
419
  if (!a || a.length === 0) {
419
420
  i = !1;
420
421
  continue;
@@ -432,11 +433,11 @@ function ye(e, t, n) {
432
433
  }
433
434
  i = !1;
434
435
  }
435
- return ve(r);
436
+ return Ce(r);
436
437
  }
437
438
  //#endregion
438
439
  //#region src/utils/dash-utils.ts
439
- var be = {
440
+ var Te = {
440
441
  dash: [4, 3],
441
442
  dot: [1, 3],
442
443
  dashDot: [
@@ -447,36 +448,36 @@ var be = {
447
448
  ],
448
449
  lgDash: [8, 3]
449
450
  };
450
- function w(e, t) {
451
- let n = be[e];
451
+ function k(e, t) {
452
+ let n = Te[e];
452
453
  return n ? n.map((e) => Math.max(1, Math.round(e * t))).join(",") : "";
453
454
  }
454
- function xe(e, t) {
455
+ function Ee(e, t) {
455
456
  if (!e) return "";
456
- for (let [n, r] of Object.entries(be)) if (r.map((e) => Math.max(1, Math.round(e * t))).join(",") === e) return n;
457
+ for (let [n, r] of Object.entries(Te)) if (r.map((e) => Math.max(1, Math.round(e * t))).join(",") === e) return n;
457
458
  let n = e.split(",").map(Number);
458
459
  return n.length === 4 ? "dashDot" : n.length === 2 && n[0] <= t * 2 ? "dot" : n.length === 2 && n[0] > t * 5 ? "lgDash" : "dash";
459
460
  }
460
461
  //#endregion
461
462
  //#region src/editor/arrow-markers.ts
462
- var Se = class {
463
+ var A = class {
463
464
  #e = "";
464
465
  begin() {}
465
466
  moveTo(e, t) {
466
- this.#e += `M ${T(e)} ${T(t)} `;
467
+ this.#e += `M ${j(e)} ${j(t)} `;
467
468
  }
468
469
  lineTo(e, t) {
469
- this.#e += `L ${T(e)} ${T(t)} `;
470
+ this.#e += `L ${j(e)} ${j(t)} `;
470
471
  }
471
472
  quadTo(e, t, n, r) {
472
- this.#e += `Q ${T(e)} ${T(t)} ${T(n)} ${T(r)} `;
473
+ this.#e += `Q ${j(e)} ${j(t)} ${j(n)} ${j(r)} `;
473
474
  }
474
475
  close() {
475
476
  this.#e += "Z ";
476
477
  }
477
478
  ellipse(e, t, n, r) {
478
479
  let i = n / 2, a = r / 2, o = e + i, s = t + a;
479
- this.#e += `M ${T(o - i)} ${T(s)} A ${T(i)} ${T(a)} 0 1 0 ${T(o + i)} ${T(s)} A ${T(i)} ${T(a)} 0 1 0 ${T(o - i)} ${T(s)} Z `;
480
+ this.#e += `M ${j(o - i)} ${j(s)} A ${j(i)} ${j(a)} 0 1 0 ${j(o + i)} ${j(s)} A ${j(i)} ${j(a)} 0 1 0 ${j(o - i)} ${j(s)} Z `;
480
481
  }
481
482
  stroke() {}
482
483
  fillAndStroke() {}
@@ -487,68 +488,68 @@ var Se = class {
487
488
  this.#e = "";
488
489
  }
489
490
  };
490
- function T(e) {
491
+ function j(e) {
491
492
  return Math.abs(e) < 1e-9 ? "0" : Number(e.toFixed(3)).toString();
492
493
  }
493
- function Ce(e, t, n, r, i, a, o, s) {
494
+ function De(e, t, n, r, i, a, o, s) {
494
495
  let c = i * s * 1.118, l = a * s * 1.118, u = i * (o + s), d = a * (o + s), f = {
495
496
  x: r.x - c,
496
497
  y: r.y - l
497
498
  }, p = n ? 3 / 4 : 1;
498
499
  r.x += -u * p - c, r.y += -d * p - l, e.moveTo(f.x, f.y), e.lineTo(f.x - u - d / t, f.y - d + u / t), n && e.lineTo(f.x - u * 3 / 4, f.y - d * 3 / 4), e.lineTo(f.x + d / t - u, f.y - d - u / t), e.close();
499
500
  }
500
- function we(e, t, n, r, i, a, o) {
501
+ function Oe(e, t, n, r, i, a, o) {
501
502
  let s = r * o * 1.118, c = i * o * 1.118, l = r * (a + o), u = i * (a + o), d = {
502
503
  x: n.x - s,
503
504
  y: n.y - c
504
505
  };
505
506
  n.x += -s * 2, n.y += -c * 2, e.moveTo(d.x - l - u / t, d.y - u + l / t), e.lineTo(d.x, d.y), e.lineTo(d.x + u / t - l, d.y - u - l / t);
506
507
  }
507
- function Te(e, t, n, r, i, a) {
508
+ function ke(e, t, n, r, i, a) {
508
509
  let o = n * a * Math.SQRT1_2, s = r * a * Math.SQRT1_2, c = n * (i + a), l = r * (i + a), u = {
509
510
  x: t.x - o,
510
511
  y: t.y - s
511
512
  };
512
513
  t.x += -c - o, t.y += -l - s, e.moveTo(u.x, u.y), e.lineTo(u.x - c / 2 - l / 2, u.y + c / 2 - l / 2), e.lineTo(u.x - c, u.y - l), e.lineTo(u.x - c / 2 + l / 2, u.y - l / 2 - c / 2), e.close();
513
514
  }
514
- function Ee(e, t, n, r, i) {
515
+ function Ae(e, t, n, r, i) {
515
516
  let a = i / 2, o = {
516
517
  x: t.x,
517
518
  y: t.y
518
519
  };
519
520
  t.x -= n * a, t.y -= r * a, e.ellipse(o.x - a, o.y - a, i, i);
520
521
  }
521
- var De = {
522
+ var je = {
522
523
  sm: 6,
523
524
  md: 10,
524
525
  lg: 14
525
- }, Oe = {
526
+ }, Me = {
526
527
  sm: 3.2,
527
528
  md: 2.4,
528
529
  lg: 1.8
529
- }, ke = {
530
+ }, Ne = {
530
531
  sm: 11,
531
532
  md: 15,
532
533
  lg: 20
533
- }, Ae = {
534
+ }, Pe = {
534
535
  sm: 2.4,
535
536
  md: 1.8,
536
537
  lg: 1.35
537
538
  };
538
- function je(e, t, n, r, i, a) {
539
+ function Fe(e, t, n, r, i, a) {
539
540
  if (t.shape === "none") return { filled: !1 };
540
- let o = t.shape === "arrow" ? ke[t.length] : De[t.length], s = t.shape === "arrow" ? Ae[t.width] : Oe[t.width];
541
+ let o = t.shape === "arrow" ? Ne[t.length] : je[t.length], s = t.shape === "arrow" ? Pe[t.width] : Me[t.width];
541
542
  switch (t.shape) {
542
- case "triangle": return Ce(e, s, !1, n, r, i, o, a), { filled: !0 };
543
- case "stealth": return Ce(e, s, !0, n, r, i, o, a), { filled: !0 };
544
- case "arrow": return we(e, s, n, r, i, o, a), { filled: !1 };
545
- case "diamond": return Te(e, n, r, i, o, a), { filled: !0 };
546
- case "oval": return Ee(e, n, r, i, o), { filled: !0 };
543
+ case "triangle": return De(e, s, !1, n, r, i, o, a), { filled: !0 };
544
+ case "stealth": return De(e, s, !0, n, r, i, o, a), { filled: !0 };
545
+ case "arrow": return Oe(e, s, n, r, i, o, a), { filled: !1 };
546
+ case "diamond": return ke(e, n, r, i, o, a), { filled: !0 };
547
+ case "oval": return Ae(e, n, r, i, o), { filled: !0 };
547
548
  }
548
549
  return { filled: !1 };
549
550
  }
550
- function Me(e, t, n, r, i, a, o, s) {
551
- let c = new Se(), l = new Se(), u = n - e, d = r - t, f = Math.hypot(u, d) || 1, p = u / f, m = d / f, h = p, g = m, _ = p, v = m;
551
+ function Ie(e, t, n, r, i, a, o, s) {
552
+ let c = new A(), l = new A(), u = n - e, d = r - t, f = Math.hypot(u, d) || 1, p = u / f, m = d / f, h = p, g = m, _ = p, v = m;
552
553
  if (s) {
553
554
  let i = s.x - e, a = s.y - t, o = Math.hypot(i, a);
554
555
  o > 1e-6 && (h = i / o, g = a / o);
@@ -561,26 +562,26 @@ function Me(e, t, n, r, i, a, o, s) {
561
562
  }, b = {
562
563
  x: n,
563
564
  y: r
564
- }, ee = Ne(a.shape), x = Ne(i.shape);
565
- je(ee ? c : l, a, b, _, v, o), je(x ? c : l, i, y, -h, -g, o);
566
- let S = new Se();
567
- return S.moveTo(y.x, y.y), s ? S.quadTo(s.x, s.y, b.x, b.y) : S.lineTo(b.x, b.y), {
568
- stemD: S.d,
565
+ }, x = Le(a.shape), S = Le(i.shape);
566
+ Fe(x ? c : l, a, b, _, v, o), Fe(S ? c : l, i, y, -h, -g, o);
567
+ let C = new A();
568
+ return C.moveTo(y.x, y.y), s ? C.quadTo(s.x, s.y, b.x, b.y) : C.lineTo(b.x, b.y), {
569
+ stemD: C.d,
569
570
  headFilledD: c.d,
570
571
  headOpenD: l.d
571
572
  };
572
573
  }
573
- function Ne(e) {
574
+ function Le(e) {
574
575
  return e === "triangle" || e === "stealth" || e === "diamond" || e === "oval";
575
576
  }
576
- function E(e, t) {
577
+ function M(e, t) {
577
578
  return {
578
579
  shape: e.getAttribute(`data-arrow-${t}-shape`) || "none",
579
580
  width: e.getAttribute(`data-arrow-${t}-width`) || e.getAttribute(`data-arrow-${t}-size`) || "md",
580
581
  length: e.getAttribute(`data-arrow-${t}-length`) || e.getAttribute(`data-arrow-${t}-size`) || "md"
581
582
  };
582
583
  }
583
- function Pe(e) {
584
+ function Re(e) {
584
585
  return {
585
586
  x1: Number.parseFloat(e.getAttribute("data-x1") || "0"),
586
587
  y1: Number.parseFloat(e.getAttribute("data-y1") || "0"),
@@ -588,7 +589,7 @@ function Pe(e) {
588
589
  y2: Number.parseFloat(e.getAttribute("data-y2") || "0")
589
590
  };
590
591
  }
591
- function Fe(e) {
592
+ function ze(e) {
592
593
  let t = e.getAttribute("data-cx"), n = e.getAttribute("data-cy");
593
594
  if (t == null || n == null) return null;
594
595
  let r = Number.parseFloat(t), i = Number.parseFloat(n);
@@ -597,8 +598,8 @@ function Fe(e) {
597
598
  y: i
598
599
  };
599
600
  }
600
- function Ie(e) {
601
- let { x1: t, y1: n, x2: r, y2: i } = Pe(e), a = Fe(e), { stemD: o, headFilledD: s, headOpenD: c } = Me(t, n, r, i, E(e, "start"), E(e, "end"), Number.parseFloat(e.getAttribute("stroke-width") || "3") || 3, a), l = e.querySelector(":scope > [data-role=\"stem\"]");
601
+ function Be(e) {
602
+ let { x1: t, y1: n, x2: r, y2: i } = Re(e), a = ze(e), { stemD: o, headFilledD: s, headOpenD: c } = Ie(t, n, r, i, M(e, "start"), M(e, "end"), Number.parseFloat(e.getAttribute("stroke-width") || "3") || 3, a), l = e.querySelector(":scope > [data-role=\"stem\"]");
602
603
  l || (l = document.createElementNS("http://www.w3.org/2000/svg", "path"), l.setAttribute("data-role", "stem"), e.appendChild(l)), l.setAttribute("fill", "none"), l.removeAttribute("stroke-linecap"), l.removeAttribute("stroke-linejoin"), l.setAttribute("d", o);
603
604
  let u = e.getAttribute("stroke") || "#ff0000", d = (e, t, n) => {
604
605
  e.setAttribute("stroke-dasharray", "none"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-linejoin", "miter"), e.setAttribute("fill", t), e.removeAttribute("stroke-width"), e.setAttribute("d", n);
@@ -607,11 +608,11 @@ function Ie(e) {
607
608
  let p = e.querySelector(":scope > [data-role=\"head-open\"]");
608
609
  p || (p = document.createElementNS("http://www.w3.org/2000/svg", "path"), p.setAttribute("data-role", "head-open"), e.appendChild(p)), d(p, "none", c);
609
610
  }
610
- function Le(e, t = "right") {
611
- let n = Re(e);
611
+ function Ve(e, t = "right") {
612
+ let n = He(e);
612
613
  return `<svg width="40" height="14" viewBox="0 0 40 14">${t === "left" ? `<g transform="translate(40,0) scale(-1,1)">${n}</g>` : n}</svg>`;
613
614
  }
614
- function Re(e) {
615
+ function He(e) {
615
616
  let t = (e) => `<line x1="2" y1="7" x2="${e}" y2="7" stroke="currentColor" stroke-width="1.6" stroke-linecap="butt"/>`;
616
617
  switch (e) {
617
618
  case "none": return "<line x1=\"2\" y1=\"7\" x2=\"38\" y2=\"7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"butt\"/>";
@@ -622,8 +623,8 @@ function Re(e) {
622
623
  case "oval": return `${t(28)}<circle cx="33" cy="7" r="5" fill="currentColor"/>`;
623
624
  }
624
625
  }
625
- function ze(e, t, n = "right") {
626
- let r = 1.2, { stemD: i, headFilledD: a, headOpenD: o } = Me(2, 7, 38, 7, {
626
+ function Ue(e, t, n = "right") {
627
+ let r = 1.2, { stemD: i, headFilledD: a, headOpenD: o } = Ie(2, 7, 38, 7, {
627
628
  shape: "none",
628
629
  width: e,
629
630
  length: t
@@ -636,11 +637,11 @@ function ze(e, t, n = "right") {
636
637
  }
637
638
  //#endregion
638
639
  //#region src/editor/shape-utils.ts
639
- var Be = "http://www.w3.org/2000/svg";
640
- function Ve(e) {
640
+ var We = "http://www.w3.org/2000/svg";
641
+ function Ge(e) {
641
642
  return e.tagName === "ellipse" ? "ellipse" : e.tagName === "rect" ? e.hasAttribute("data-rounded") ? "rounded" : "rect" : null;
642
643
  }
643
- function He(e) {
644
+ function Ke(e) {
644
645
  if (e.tagName === "ellipse") {
645
646
  let t = Number.parseFloat(e.getAttribute("cx") || "0"), n = Number.parseFloat(e.getAttribute("cy") || "0"), r = Number.parseFloat(e.getAttribute("rx") || "0"), i = Number.parseFloat(e.getAttribute("ry") || "0");
646
647
  return {
@@ -657,7 +658,7 @@ function He(e) {
657
658
  h: Number.parseFloat(e.getAttribute("height") || "0")
658
659
  };
659
660
  }
660
- var Ue = [
661
+ var qe = [
661
662
  "stroke",
662
663
  "stroke-width",
663
664
  "stroke-dasharray",
@@ -666,16 +667,16 @@ var Ue = [
666
667
  "fill",
667
668
  "fill-opacity"
668
669
  ];
669
- function We(e, t) {
670
- let { x: n, y: r, w: i, h: a } = He(e), o = e.parentNode;
670
+ function Je(e, t) {
671
+ let { x: n, y: r, w: i, h: a } = Ke(e), o = e.parentNode;
671
672
  if (!o) throw Error("convertShape: element is detached from DOM");
672
673
  let s;
673
- if (t === "ellipse") s = document.createElementNS(Be, "ellipse"), s.setAttribute("cx", String(n + i / 2)), s.setAttribute("cy", String(r + a / 2)), s.setAttribute("rx", String(i / 2)), s.setAttribute("ry", String(a / 2));
674
- else if (s = document.createElementNS(Be, "rect"), s.setAttribute("x", String(n)), s.setAttribute("y", String(r)), s.setAttribute("width", String(i)), s.setAttribute("height", String(a)), t === "rounded") {
674
+ if (t === "ellipse") s = document.createElementNS(We, "ellipse"), s.setAttribute("cx", String(n + i / 2)), s.setAttribute("cy", String(r + a / 2)), s.setAttribute("rx", String(i / 2)), s.setAttribute("ry", String(a / 2));
675
+ else if (s = document.createElementNS(We, "rect"), s.setAttribute("x", String(n)), s.setAttribute("y", String(r)), s.setAttribute("width", String(i)), s.setAttribute("height", String(a)), t === "rounded") {
675
676
  let e = Math.max(2, Math.round(Math.min(i, a) / 6));
676
677
  s.setAttribute("rx", String(e)), s.setAttribute("data-rounded", "true");
677
678
  } else s.setAttribute("rx", "0");
678
- for (let t of Ue) {
679
+ for (let t of qe) {
679
680
  let n = e.getAttribute(t);
680
681
  n != null && s.setAttribute(t, n);
681
682
  }
@@ -683,70 +684,70 @@ function We(e, t) {
683
684
  }
684
685
  //#endregion
685
686
  //#region src/editor/text-utils.ts
686
- var D = "http://www.w3.org/2000/svg", Ge = {
687
+ var N = "http://www.w3.org/2000/svg", Ye = {
687
688
  "#ff0000": "rgba(255,255,200,0.92)",
688
689
  "#00ff00": "rgba(200,255,200,0.92)",
689
690
  "#0000ff": "rgba(200,220,255,0.92)",
690
691
  "#ff8800": "rgba(255,230,200,0.92)",
691
692
  "#ff00ff": "rgba(255,210,255,0.92)"
692
693
  };
693
- function Ke(e) {
694
- return Ge[e.toLowerCase()] || "rgba(255,255,200,0.92)";
694
+ function Xe(e) {
695
+ return Ye[e.toLowerCase()] || "rgba(255,255,200,0.92)";
695
696
  }
696
- function qe(e, t, n) {
697
+ function P(e, t, n) {
697
698
  let r = e.getAttribute(t);
698
699
  if (r == null) return n;
699
700
  let i = Number.parseFloat(r);
700
701
  return Number.isFinite(i) && i >= 0 ? i : n;
701
702
  }
702
- function Je(e) {
703
+ function Ze(e) {
703
704
  let t = e.getAttribute("data-shape-kind"), n = t === "plain" ? 2 : 10, r = t === "plain" ? 0 : 8;
704
705
  return {
705
- left: qe(e, "data-text-margin-l", n),
706
- right: qe(e, "data-text-margin-r", n),
707
- top: qe(e, "data-text-margin-t", r),
708
- bottom: qe(e, "data-text-margin-b", r)
706
+ left: P(e, "data-text-margin-l", n),
707
+ right: P(e, "data-text-margin-r", n),
708
+ top: P(e, "data-text-margin-t", r),
709
+ bottom: P(e, "data-text-margin-b", r)
709
710
  };
710
711
  }
711
- function Ye(e) {
712
+ function Qe(e) {
712
713
  return e === "rect" || e === "rounded" || e === "ellipse" ? "middle" : "start";
713
714
  }
714
- function Xe(e) {
715
+ function $e(e) {
715
716
  return e === "rect" || e === "rounded" || e === "ellipse" ? "middle" : "top";
716
717
  }
717
- var Ze;
718
- function Qe() {
719
- if (Ze !== void 0) return Ze;
720
- if (typeof document > "u") return Ze = null;
718
+ var F;
719
+ function et() {
720
+ if (F !== void 0) return F;
721
+ if (typeof document > "u") return F = null;
721
722
  try {
722
- Ze = document.createElement("canvas").getContext("2d");
723
+ F = document.createElement("canvas").getContext("2d");
723
724
  } catch {
724
- Ze = null;
725
+ F = null;
725
726
  }
726
- return Ze;
727
+ return F;
727
728
  }
728
- function $e(e, t, n, r, i) {
729
- let a = Qe();
729
+ function tt(e, t, n, r, i) {
730
+ let a = et();
730
731
  return a ? (a.font = `${`${i ? "italic " : ""}${r ? "bold " : ""}`}${t}px ${n}`, a.measureText(e).width) : 0;
731
732
  }
732
- var et;
733
- function tt() {
734
- if (et !== void 0) return et;
735
- if (typeof Intl > "u" || Intl.Segmenter === void 0) return et = null;
733
+ var I;
734
+ function nt() {
735
+ if (I !== void 0) return I;
736
+ if (typeof Intl > "u" || Intl.Segmenter === void 0) return I = null;
736
737
  try {
737
738
  let e = typeof navigator < "u" ? navigator.language : void 0;
738
- et = new Intl.Segmenter(e, { granularity: "word" });
739
+ I = new Intl.Segmenter(e, { granularity: "word" });
739
740
  } catch {
740
- et = null;
741
+ I = null;
741
742
  }
742
- return et;
743
+ return I;
743
744
  }
744
- var nt = /^[\s ]+$/;
745
+ var L = /^[\s ]+$/;
745
746
  function rt(e, t, n, r) {
746
747
  let i = [], a = {
747
748
  segments: [],
748
749
  maxFontSize: 0
749
- }, o = 0, s = tt(), c = () => {
750
+ }, o = 0, s = nt(), c = () => {
750
751
  i.push(a), a = {
751
752
  segments: [],
752
753
  maxFontSize: 0
@@ -758,8 +759,8 @@ function rt(e, t, n, r) {
758
759
  else {
759
760
  let e = 0;
760
761
  for (; e < i.text.length;) {
761
- let t = nt.test(i.text[e]), n = e + 1;
762
- for (; n < i.text.length && nt.test(i.text[n]) === t;) n++;
762
+ let t = L.test(i.text[e]), n = e + 1;
763
+ for (; n < i.text.length && L.test(i.text[n]) === t;) n++;
763
764
  f.push(i.text.slice(e, n)), e = n;
764
765
  }
765
766
  }
@@ -775,9 +776,9 @@ function rt(e, t, n, r) {
775
776
  }), e > a.maxFontSize && (a.maxFontSize = e), "");
776
777
  };
777
778
  for (let n of f) {
778
- if (a.segments.length === 0 && p === "" && nt.test(n)) continue;
779
- let r = $e(n, e, l, u, d);
780
- o + r > t && (o > 0 || p !== "") && (m(), c(), nt.test(n)) || (p += n, o += r);
779
+ if (a.segments.length === 0 && p === "" && L.test(n)) continue;
780
+ let r = tt(n, e, l, u, d);
781
+ o + r > t && (o > 0 || p !== "") && (m(), c(), L.test(n)) || (p += n, o += r);
781
782
  }
782
783
  m(), i.text === "" && a.segments.length === 0 && e > a.maxFontSize && (a.maxFontSize = e), i.line_break_after && c();
783
784
  }
@@ -840,7 +841,7 @@ function ct(e) {
840
841
  }
841
842
  return r;
842
843
  }
843
- function O(e) {
844
+ function R(e) {
844
845
  let t = e.querySelector("rect"), n = Number.parseFloat(t?.getAttribute("x") || "0"), r = Number.parseFloat(t?.getAttribute("y") || "0"), i = Number.parseFloat(t?.getAttribute("width") || "200"), a = Number.parseFloat(t?.getAttribute("height") || "80"), o = Number.parseFloat(e.getAttribute("data-font-size") || "16"), s = e.getAttribute("data-font-family") || "Annot Sans", c = e.getAttribute("data-color") || "#ff0000", l = ot(e), u = e.getAttribute("data-shape-kind"), d = e.getAttribute("data-tail-x"), f = e.getAttribute("data-tail-y"), p = e.getAttribute("data-text-anchor"), m = e.getAttribute("data-text-vanchor");
845
846
  return {
846
847
  x: n,
@@ -852,29 +853,29 @@ function O(e) {
852
853
  fontSize: o,
853
854
  fontFamily: s,
854
855
  color: c,
855
- textAnchor: p ?? Ye(u),
856
- textVerticalAnchor: m ?? Xe(u),
856
+ textAnchor: p ?? Qe(u),
857
+ textVerticalAnchor: m ?? $e(u),
857
858
  tailX: d == null ? void 0 : Number.parseFloat(d),
858
859
  tailY: f == null ? void 0 : Number.parseFloat(f)
859
860
  };
860
861
  }
861
862
  function lt(e) {
862
- let t = document.createElementNS(D, "g");
863
+ let t = document.createElementNS(N, "g");
863
864
  t.setAttribute("data-type", "shape"), t.setAttribute("data-shape-kind", e.variant), t.setAttribute("data-font-size", String(e.fontSize)), t.setAttribute("data-font-family", e.fontFamily), t.setAttribute("data-color", e.color);
864
- let n = e.textAnchor ?? Ye(e.variant), r = e.textVerticalAnchor ?? Xe(e.variant);
865
+ let n = e.textAnchor ?? Qe(e.variant), r = e.textVerticalAnchor ?? $e(e.variant);
865
866
  t.setAttribute("data-text-anchor", n), t.setAttribute("data-text-vanchor", r);
866
- let i = document.createElementNS(D, "rect");
867
- if (i.setAttribute("x", String(e.x)), i.setAttribute("y", String(e.y)), i.setAttribute("width", String(e.w)), i.setAttribute("height", String(e.h)), e.variant === "plain" ? (i.setAttribute("fill", "none"), i.setAttribute("stroke", "none"), i.setAttribute("pointer-events", "all")) : e.variant === "sticky" ? (i.setAttribute("rx", "4"), i.setAttribute("fill", Ke(e.color)), i.setAttribute("stroke", "rgba(0,0,0,0.15)"), i.setAttribute("stroke-width", "1")) : (i.setAttribute("rx", "8"), i.setAttribute("fill", Ke(e.color)), i.setAttribute("stroke", "none")), t.appendChild(i), e.variant === "callout") {
867
+ let i = document.createElementNS(N, "rect");
868
+ if (i.setAttribute("x", String(e.x)), i.setAttribute("y", String(e.y)), i.setAttribute("width", String(e.w)), i.setAttribute("height", String(e.h)), e.variant === "plain" ? (i.setAttribute("fill", "none"), i.setAttribute("stroke", "none"), i.setAttribute("pointer-events", "all")) : e.variant === "sticky" ? (i.setAttribute("rx", "4"), i.setAttribute("fill", Xe(e.color)), i.setAttribute("stroke", "rgba(0,0,0,0.15)"), i.setAttribute("stroke-width", "1")) : (i.setAttribute("rx", "8"), i.setAttribute("fill", Xe(e.color)), i.setAttribute("stroke", "none")), t.appendChild(i), e.variant === "callout") {
868
869
  let n = e.tailX ?? e.x - 30, r = e.tailY ?? e.y + e.h + 40;
869
870
  t.setAttribute("data-tail-x", String(n)), t.setAttribute("data-tail-y", String(r));
870
- let i = document.createElementNS(D, "path");
871
- i.setAttribute("d", ""), i.setAttribute("fill", Ke(e.color)), i.setAttribute("stroke", "rgba(0,0,0,0.25)"), i.setAttribute("stroke-width", "1"), t.appendChild(i), dt(t);
871
+ let i = document.createElementNS(N, "path");
872
+ i.setAttribute("d", ""), i.setAttribute("fill", Xe(e.color)), i.setAttribute("stroke", "rgba(0,0,0,0.25)"), i.setAttribute("stroke-width", "1"), t.appendChild(i), dt(t);
872
873
  }
873
- let a = `clip-textshape-${Math.random().toString(36).slice(2, 9)}`, o = document.createElementNS(D, "clipPath");
874
+ let a = `clip-textshape-${Math.random().toString(36).slice(2, 9)}`, o = document.createElementNS(N, "clipPath");
874
875
  o.id = a;
875
- let s = document.createElementNS(D, "rect");
876
+ let s = document.createElementNS(N, "rect");
876
877
  s.setAttribute("x", String(e.x)), s.setAttribute("y", String(e.y)), s.setAttribute("width", String(e.w)), s.setAttribute("height", String(e.h)), o.appendChild(s), t.appendChild(o);
877
- let c = Je(t), l = Math.max(0, e.w - c.left - c.right), u = rt(e.runs, l, e.fontSize, e.fontFamily), d = it({
878
+ let c = Ze(t), l = Math.max(0, e.w - c.left - c.right), u = rt(e.runs, l, e.fontSize, e.fontFamily), d = it({
878
879
  x: e.x,
879
880
  y: e.y,
880
881
  w: e.w,
@@ -883,20 +884,20 @@ function lt(e) {
883
884
  margins: c,
884
885
  textAnchor: n,
885
886
  textVerticalAnchor: r
886
- }), f = document.createElementNS(D, "text");
887
+ }), f = document.createElementNS(N, "text");
887
888
  return f.setAttribute("font-size", String(e.fontSize)), f.setAttribute("fill", e.color), f.setAttribute("font-family", e.fontFamily), f.setAttribute("clip-path", `url(#${a})`), f.setAttribute("text-anchor", d.textAnchorAttr), f.style.pointerEvents = "none", ut(f, u, d), t.appendChild(f), t;
888
889
  }
889
890
  function ut(e, t, n) {
890
891
  for (let r = 0; r < t.length; r++) {
891
892
  let i = t[r], a = n.xForLine, o = n.yForLine(r);
892
893
  if (i.segments.length === 0) {
893
- let t = document.createElementNS(D, "tspan");
894
+ let t = document.createElementNS(N, "tspan");
894
895
  t.setAttribute("x", String(a)), t.setAttribute("y", String(o)), t.textContent = "", e.appendChild(t);
895
896
  continue;
896
897
  }
897
898
  let s = !0;
898
899
  for (let t of i.segments) {
899
- let n = document.createElementNS(D, "tspan");
900
+ let n = document.createElementNS(N, "tspan");
900
901
  s &&= (n.setAttribute("x", String(a)), n.setAttribute("y", String(o)), !1), t.bold && n.setAttribute("font-weight", "bold"), t.italic && n.setAttribute("font-style", "italic"), t.underline && n.setAttribute("text-decoration", "underline"), t.font_size != null && n.setAttribute("font-size", String(t.font_size)), t.font_family != null && n.setAttribute("font-family", t.font_family), t.color != null && n.setAttribute("fill", t.color), n.textContent = t.text, e.appendChild(n);
901
902
  }
902
903
  }
@@ -910,14 +911,14 @@ function dt(e) {
910
911
  let e = c - u, t = l - d;
911
912
  m = Math.abs(e) > Math.abs(t) ? e > 0 ? "right" : "left" : t > 0 ? "bottom" : "top";
912
913
  } else m = f > p ? c < r ? "left" : "right" : l < i ? "top" : "bottom";
913
- let h = .1667, g = r, _ = r + a, v = i, y = i + o, b = Math.max(0, Math.min(a * h, a - 2 * s)), ee = Math.max(0, Math.min(o * h, o - 2 * s)), x = b / 2, S = ee / 2, te = c < u ? (u + (g + s)) / 2 : (u + (_ - s)) / 2, ne = l < d ? (d + (v + s)) / 2 : (d + (y - s)) / 2, re = te - x, ie = te + x, ae = ne - S, oe = ne + S, C = [];
914
- C.push(`M ${g + s} ${v}`), m === "top" && (C.push(`L ${re} ${v}`), C.push(`L ${c} ${l}`), C.push(`L ${ie} ${v}`)), C.push(`L ${_ - s} ${v}`), s > 0 && C.push(`A ${s} ${s} 0 0 1 ${_} ${v + s}`), m === "right" && (C.push(`L ${_} ${ae}`), C.push(`L ${c} ${l}`), C.push(`L ${_} ${oe}`)), C.push(`L ${_} ${y - s}`), s > 0 && C.push(`A ${s} ${s} 0 0 1 ${_ - s} ${y}`), m === "bottom" && (C.push(`L ${ie} ${y}`), C.push(`L ${c} ${l}`), C.push(`L ${re} ${y}`)), C.push(`L ${g + s} ${y}`), s > 0 && C.push(`A ${s} ${s} 0 0 1 ${g} ${y - s}`), m === "left" && (C.push(`L ${g} ${oe}`), C.push(`L ${c} ${l}`), C.push(`L ${g} ${ae}`)), C.push(`L ${g} ${v + s}`), s > 0 && C.push(`A ${s} ${s} 0 0 1 ${g + s} ${v}`), C.push("Z"), n.setAttribute("d", C.join(" "));
914
+ let h = .1667, g = r, _ = r + a, v = i, y = i + o, b = Math.max(0, Math.min(a * h, a - 2 * s)), x = Math.max(0, Math.min(o * h, o - 2 * s)), S = b / 2, C = x / 2, ee = c < u ? (u + (g + s)) / 2 : (u + (_ - s)) / 2, w = l < d ? (d + (v + s)) / 2 : (d + (y - s)) / 2, T = ee - S, E = ee + S, D = w - C, te = w + C, O = [];
915
+ O.push(`M ${g + s} ${v}`), m === "top" && (O.push(`L ${T} ${v}`), O.push(`L ${c} ${l}`), O.push(`L ${E} ${v}`)), O.push(`L ${_ - s} ${v}`), s > 0 && O.push(`A ${s} ${s} 0 0 1 ${_} ${v + s}`), m === "right" && (O.push(`L ${_} ${D}`), O.push(`L ${c} ${l}`), O.push(`L ${_} ${te}`)), O.push(`L ${_} ${y - s}`), s > 0 && O.push(`A ${s} ${s} 0 0 1 ${_ - s} ${y}`), m === "bottom" && (O.push(`L ${E} ${y}`), O.push(`L ${c} ${l}`), O.push(`L ${T} ${y}`)), O.push(`L ${g + s} ${y}`), s > 0 && O.push(`A ${s} ${s} 0 0 1 ${g} ${y - s}`), m === "left" && (O.push(`L ${g} ${te}`), O.push(`L ${c} ${l}`), O.push(`L ${g} ${D}`)), O.push(`L ${g} ${v + s}`), s > 0 && O.push(`A ${s} ${s} 0 0 1 ${g + s} ${v}`), O.push("Z"), n.setAttribute("d", O.join(" "));
915
916
  }
916
- function k(e, t) {
917
+ function z(e, t) {
917
918
  let n = (() => {
918
919
  for (let t of Array.from(e.children)) if (t.tagName === "rect") return t;
919
920
  return null;
920
- })(), r = n ? Number.parseFloat(n.getAttribute("x") || "0") : 0, i = n ? Number.parseFloat(n.getAttribute("y") || "0") : 0, a = n ? Number.parseFloat(n.getAttribute("width") || "0") : 0, o = n ? Number.parseFloat(n.getAttribute("height") || "0") : 0, s = Number.parseFloat(e.getAttribute("data-font-size") || "16"), c = e.getAttribute("data-font-family") || "Annot Sans", l = e.getAttribute("data-color") || "#000000", u = e.getAttribute("data-shape-kind"), d = Je(e), f = e.getAttribute("data-text-anchor") ?? Ye(u), p = e.getAttribute("data-text-vanchor") ?? Xe(u), m = rt(t, Math.max(0, a - d.left - d.right), s, c), h = m.map((e) => e.maxFontSize), g = it({
921
+ })(), r = n ? Number.parseFloat(n.getAttribute("x") || "0") : 0, i = n ? Number.parseFloat(n.getAttribute("y") || "0") : 0, a = n ? Number.parseFloat(n.getAttribute("width") || "0") : 0, o = n ? Number.parseFloat(n.getAttribute("height") || "0") : 0, s = Number.parseFloat(e.getAttribute("data-font-size") || "16"), c = e.getAttribute("data-font-family") || "Annot Sans", l = e.getAttribute("data-color") || "#000000", u = e.getAttribute("data-shape-kind"), d = Ze(e), f = e.getAttribute("data-text-anchor") ?? Qe(u), p = e.getAttribute("data-text-vanchor") ?? $e(u), m = rt(t, Math.max(0, a - d.left - d.right), s, c), h = m.map((e) => e.maxFontSize), g = it({
921
922
  x: r,
922
923
  y: i,
923
924
  w: a,
@@ -931,7 +932,7 @@ function k(e, t) {
931
932
  _ = t;
932
933
  break;
933
934
  }
934
- for (_ || (_ = document.createElementNS(D, "text"), e.appendChild(_)), _.setAttribute("font-size", String(s)), _.setAttribute("font-family", c), _.setAttribute("fill", l), _.setAttribute("text-anchor", g.textAnchorAttr), _.style.pointerEvents = "none"; _.firstChild;) _.removeChild(_.firstChild);
935
+ for (_ || (_ = document.createElementNS(N, "text"), e.appendChild(_)), _.setAttribute("font-size", String(s)), _.setAttribute("font-family", c), _.setAttribute("fill", l), _.setAttribute("text-anchor", g.textAnchorAttr), _.style.pointerEvents = "none"; _.firstChild;) _.removeChild(_.firstChild);
935
936
  if (ut(_, m, g), e.getAttribute("data-text-autofit") === "resize" && n) {
936
937
  let r = 0;
937
938
  for (let e of h) r += e * 1.4;
@@ -940,7 +941,7 @@ function k(e, t) {
940
941
  if (i > o) {
941
942
  n.setAttribute("height", String(i));
942
943
  let r = e.querySelector("clipPath > rect");
943
- r instanceof Element && r.setAttribute("height", String(i)), dt(e), k(e, t);
944
+ r instanceof Element && r.setAttribute("height", String(i)), dt(e), z(e, t);
944
945
  }
945
946
  }
946
947
  }
@@ -948,14 +949,14 @@ function ft(e, t) {
948
949
  let n = e.parentNode;
949
950
  if (!n) throw Error("convertTextVariant: element is detached");
950
951
  let r = lt({
951
- ...O(e),
952
+ ...R(e),
952
953
  variant: t
953
954
  }), i = e.getAttribute("transform");
954
955
  return i && r.setAttribute("transform", i), n.replaceChild(r, e), r;
955
956
  }
956
957
  //#endregion
957
958
  //#region src/editor/property-schema.ts
958
- var A = {
959
+ var B = {
959
960
  shapeTypePicker: "shapeTypePicker",
960
961
  arrowVariantPicker: "arrowVariantPicker",
961
962
  drawStylePicker: "drawStylePicker",
@@ -997,52 +998,52 @@ var A = {
997
998
  arrowEndSize: "arrowEndSize"
998
999
  }, pt = {
999
1000
  textbox: [
1000
- A.textVariantPicker,
1001
- A.textColor,
1002
- A.fontFamily,
1003
- A.fontSize,
1004
- A.textBold,
1005
- A.textItalic,
1006
- A.textUnderline,
1007
- A.textAnchor,
1008
- A.textVerticalAnchor,
1009
- A.textAutofit,
1010
- A.textMarginLeft,
1011
- A.textMarginRight,
1012
- A.textMarginTop,
1013
- A.textMarginBottom
1001
+ B.textVariantPicker,
1002
+ B.textColor,
1003
+ B.fontFamily,
1004
+ B.fontSize,
1005
+ B.textBold,
1006
+ B.textItalic,
1007
+ B.textUnderline,
1008
+ B.textAnchor,
1009
+ B.textVerticalAnchor,
1010
+ B.textAutofit,
1011
+ B.textMarginLeft,
1012
+ B.textMarginRight,
1013
+ B.textMarginTop,
1014
+ B.textMarginBottom
1014
1015
  ],
1015
1016
  marker: [
1016
- A.markerShapePicker,
1017
- A.markerBgFillColor,
1018
- A.markerBgStrokeColor,
1019
- A.markerBgStrokeWidth,
1020
- A.markerBgStrokeStyle,
1021
- A.markerLabelValue,
1022
- A.markerSize
1017
+ B.markerShapePicker,
1018
+ B.markerBgFillColor,
1019
+ B.markerBgStrokeColor,
1020
+ B.markerBgStrokeWidth,
1021
+ B.markerBgStrokeStyle,
1022
+ B.markerLabelValue,
1023
+ B.markerSize
1023
1024
  ],
1024
- "redact-mosaic": [A.redactStylePicker],
1025
- "redact-solid": [A.redactStylePicker, A.redactSolidColor],
1026
- "redact-blur": [A.redactStylePicker],
1027
- highlight: [A.highlightColorPicker, A.highlightTransparency],
1025
+ "redact-mosaic": [B.redactStylePicker],
1026
+ "redact-solid": [B.redactStylePicker, B.redactSolidColor],
1027
+ "redact-blur": [B.redactStylePicker],
1028
+ highlight: [B.highlightColorPicker, B.highlightTransparency],
1028
1029
  group: [],
1029
1030
  shape: [
1030
- A.shapeTypePicker,
1031
- A.arrowVariantPicker,
1032
- A.drawStylePicker,
1033
- A.fillColor,
1034
- A.fillOpacity,
1035
- A.strokeColor,
1036
- A.strokeOpacity,
1037
- A.strokeWidth,
1038
- A.strokeStyle,
1039
- A.strokeLinecap,
1040
- A.arrowStartShape,
1041
- A.arrowStartSize,
1042
- A.arrowEndShape,
1043
- A.arrowEndSize
1031
+ B.shapeTypePicker,
1032
+ B.arrowVariantPicker,
1033
+ B.drawStylePicker,
1034
+ B.fillColor,
1035
+ B.fillOpacity,
1036
+ B.strokeColor,
1037
+ B.strokeOpacity,
1038
+ B.strokeWidth,
1039
+ B.strokeStyle,
1040
+ B.strokeLinecap,
1041
+ B.arrowStartShape,
1042
+ B.arrowStartSize,
1043
+ B.arrowEndShape,
1044
+ B.arrowEndSize
1044
1045
  ]
1045
- }, j = {
1046
+ }, V = {
1046
1047
  applyArrowVariant: "applyArrowVariant",
1047
1048
  applyDrawStyle: "applyDrawStyle",
1048
1049
  applyMarkerShape: "applyMarkerShape",
@@ -1071,10 +1072,10 @@ function gt(e) {
1071
1072
  let t = e.getAttribute("data-shape");
1072
1073
  return t === "circle" || t === "rect" || t === "rounded" ? t : e.querySelector("circle, rect")?.tagName === "rect" ? "rect" : "circle";
1073
1074
  }
1074
- function M(e) {
1075
+ function H(e) {
1075
1076
  return e.querySelector("circle") ?? e.querySelector("rect");
1076
1077
  }
1077
- function _t(e) {
1078
+ function U(e) {
1078
1079
  if (e.tagName === "g" && e.getAttribute("data-type") === "freehand") {
1079
1080
  let t = [];
1080
1081
  for (let n of Array.from(e.children)) n.tagName.toLowerCase() === "path" && t.push(n);
@@ -1082,17 +1083,17 @@ function _t(e) {
1082
1083
  }
1083
1084
  return [e];
1084
1085
  }
1085
- function N(e, t) {
1086
+ function W(e, t) {
1086
1087
  return e.tagName === "g" ? e.querySelector("path, rect, line, circle")?.getAttribute(t) ?? e.getAttribute(t) : e.getAttribute(t);
1087
1088
  }
1088
- function vt(e) {
1089
+ function _t(e) {
1089
1090
  return e.tagName === "g" && e.getAttribute("data-type") === "arrow";
1090
1091
  }
1091
- function yt(e) {
1092
- let t = E(e, "start").shape === "none", n = E(e, "end").shape === "none";
1092
+ function vt(e) {
1093
+ let t = M(e, "start").shape === "none", n = M(e, "end").shape === "none";
1093
1094
  return t && n ? "none" : !t && !n ? "both" : "end";
1094
1095
  }
1095
- function bt(e, t) {
1096
+ function yt(e, t) {
1096
1097
  let n = e === "start" ? "left" : "right";
1097
1098
  return [
1098
1099
  {
@@ -1125,10 +1126,10 @@ function bt(e, t) {
1125
1126
  }).map((e) => ({
1126
1127
  value: e.value,
1127
1128
  label: e.label,
1128
- iconSvg: Le(e.value, n)
1129
+ iconSvg: Ve(e.value, n)
1129
1130
  }));
1130
1131
  }
1131
- function xt(e) {
1132
+ function bt(e) {
1132
1133
  let t = e === "start" ? "left" : "right", n = [
1133
1134
  "sm",
1134
1135
  "md",
@@ -1137,82 +1138,82 @@ function xt(e) {
1137
1138
  for (let e of n) for (let i of n) r.push({
1138
1139
  value: `${e}-${i}`,
1139
1140
  label: `W:${e.toUpperCase()} L:${i.toUpperCase()}`,
1140
- iconSvg: ze(e, i, t)
1141
+ iconSvg: Ue(e, i, t)
1141
1142
  });
1142
1143
  return r;
1143
1144
  }
1144
- function St(e) {
1145
+ function xt(e) {
1145
1146
  let t = e.querySelector("text");
1146
1147
  return Number.parseFloat(t?.getAttribute("font-size") || "13");
1147
1148
  }
1148
- function Ct(e) {
1149
+ function St(e) {
1149
1150
  let t = e.getAttribute("data-redact-style");
1150
1151
  return t === "mosaic" || t === "solid" || t === "blur" ? t : "mosaic";
1151
1152
  }
1152
- function P(e) {
1153
+ function G(e) {
1153
1154
  return e.tagName === "line" ? !0 : e.tagName === "g" && e.getAttribute("data-type") === "arrow";
1154
1155
  }
1155
- function wt(e) {
1156
+ function Ct(e) {
1156
1157
  return e.tagName === "g" && e.getAttribute("data-type") === "freehand";
1157
1158
  }
1158
- var Tt = {
1159
+ var wt = {
1159
1160
  shapeTypePicker: {
1160
- id: A.shapeTypePicker,
1161
+ id: B.shapeTypePicker,
1161
1162
  type: "variantPicker",
1162
1163
  label: "Shape type",
1163
- getValue: (e) => Ve(e),
1164
- replace: (e, t) => We(e, t),
1165
- visibleWhen: (e) => Ve(e) !== null,
1164
+ getValue: (e) => Ge(e),
1165
+ replace: (e, t) => Je(e, t),
1166
+ visibleWhen: (e) => Ge(e) !== null,
1166
1167
  options: [
1167
1168
  {
1168
1169
  value: "rect",
1169
1170
  label: "Rectangle",
1170
- iconSvg: h.rect
1171
+ iconSvg: w.rect
1171
1172
  },
1172
1173
  {
1173
1174
  value: "rounded",
1174
1175
  label: "Rounded",
1175
- iconSvg: h.rounded
1176
+ iconSvg: w.rounded
1176
1177
  },
1177
1178
  {
1178
1179
  value: "ellipse",
1179
1180
  label: "Ellipse",
1180
- iconSvg: h.ellipse
1181
+ iconSvg: w.ellipse
1181
1182
  }
1182
1183
  ]
1183
1184
  },
1184
1185
  arrowVariantPicker: {
1185
- id: A.arrowVariantPicker,
1186
+ id: B.arrowVariantPicker,
1186
1187
  type: "variantPicker",
1187
1188
  label: "Arrow type",
1188
1189
  getValue: (e) => mt(e),
1189
- effect: j.applyArrowVariant,
1190
- visibleWhen: (e) => P(e),
1190
+ effect: V.applyArrowVariant,
1191
+ visibleWhen: (e) => G(e),
1191
1192
  options: [
1192
1193
  {
1193
1194
  value: "none",
1194
1195
  label: "Line",
1195
- iconSvg: g.none
1196
+ iconSvg: T.none
1196
1197
  },
1197
1198
  {
1198
1199
  value: "end",
1199
1200
  label: "Arrow",
1200
- iconSvg: g.end
1201
+ iconSvg: T.end
1201
1202
  },
1202
1203
  {
1203
1204
  value: "both",
1204
1205
  label: "Double arrow",
1205
- iconSvg: g.both
1206
+ iconSvg: T.both
1206
1207
  }
1207
1208
  ]
1208
1209
  },
1209
1210
  drawStylePicker: {
1210
- id: A.drawStylePicker,
1211
+ id: B.drawStylePicker,
1211
1212
  type: "variantPicker",
1212
1213
  label: "Draw style",
1213
1214
  getValue: (e) => ht(e),
1214
- effect: j.applyDrawStyle,
1215
- visibleWhen: (e) => e.tagName === "path" || wt(e),
1215
+ effect: V.applyDrawStyle,
1216
+ visibleWhen: (e) => e.tagName === "path" || Ct(e),
1216
1217
  options: [{
1217
1218
  value: "pen",
1218
1219
  label: "Pen",
@@ -1224,43 +1225,43 @@ var Tt = {
1224
1225
  }]
1225
1226
  },
1226
1227
  fillColor: {
1227
- id: A.fillColor,
1228
+ id: B.fillColor,
1228
1229
  type: "color",
1229
1230
  label: "Color",
1230
1231
  getValue: (e) => e.getAttribute("fill") ?? "none",
1231
1232
  setValue: (e, t) => {
1232
1233
  e.setAttribute("fill", String(t));
1233
1234
  },
1234
- visibleWhen: (e) => !P(e) && e.tagName !== "path" && !wt(e),
1235
+ visibleWhen: (e) => !G(e) && e.tagName !== "path" && !Ct(e),
1235
1236
  allowNone: !0
1236
1237
  },
1237
1238
  strokeColor: {
1238
- id: A.strokeColor,
1239
+ id: B.strokeColor,
1239
1240
  type: "color",
1240
1241
  label: "Color",
1241
- getValue: (e) => N(e, "stroke") ?? "#000000",
1242
+ getValue: (e) => W(e, "stroke") ?? "#000000",
1242
1243
  setValue: (e, t) => {
1243
1244
  let n = String(t);
1244
- for (let t of _t(e)) t.setAttribute("stroke", n);
1245
- if (vt(e)) {
1245
+ for (let t of U(e)) t.setAttribute("stroke", n);
1246
+ if (_t(e)) {
1246
1247
  let t = e.querySelector(":scope > [data-role=\"head-filled\"]");
1247
1248
  t && t.setAttribute("fill", n);
1248
1249
  }
1249
1250
  }
1250
1251
  },
1251
1252
  strokeWidth: {
1252
- id: A.strokeWidth,
1253
+ id: B.strokeWidth,
1253
1254
  type: "number",
1254
1255
  label: "Width",
1255
- getValue: (e) => Number.parseFloat(N(e, "stroke-width") || "0"),
1256
+ getValue: (e) => Number.parseFloat(W(e, "stroke-width") || "0"),
1256
1257
  setValue: (e, t) => {
1257
1258
  let n = Number(t);
1258
- for (let t of _t(e)) {
1259
+ for (let t of U(e)) {
1259
1260
  t.setAttribute("stroke-width", String(n));
1260
1261
  let e = t.getAttribute("data-dash-key");
1261
- e && t.setAttribute("stroke-dasharray", w(e, n));
1262
+ e && t.setAttribute("stroke-dasharray", k(e, n));
1262
1263
  }
1263
- vt(e) && Ie(e);
1264
+ _t(e) && Be(e);
1264
1265
  },
1265
1266
  min: .25,
1266
1267
  max: 200,
@@ -1268,20 +1269,20 @@ var Tt = {
1268
1269
  unit: "pt"
1269
1270
  },
1270
1271
  strokeStyle: {
1271
- id: A.strokeStyle,
1272
+ id: B.strokeStyle,
1272
1273
  type: "select",
1273
1274
  label: "Dash type",
1274
1275
  getValue: (e) => {
1275
- let t = N(e, "data-dash-key");
1276
+ let t = W(e, "data-dash-key");
1276
1277
  if (t != null) return t;
1277
- let n = Number.parseFloat(N(e, "stroke-width") || "1");
1278
- return xe(N(e, "stroke-dasharray") || "", n) ?? "";
1278
+ let n = Number.parseFloat(W(e, "stroke-width") || "1");
1279
+ return Ee(W(e, "stroke-dasharray") || "", n) ?? "";
1279
1280
  },
1280
1281
  setValue: (e, t) => {
1281
1282
  let n = String(t);
1282
- for (let t of _t(e)) {
1283
+ for (let t of U(e)) {
1283
1284
  let e = Number.parseFloat(t.getAttribute("stroke-width") || "1");
1284
- n ? (t.setAttribute("data-dash-key", n), t.setAttribute("stroke-dasharray", w(n, e))) : (t.removeAttribute("data-dash-key"), t.removeAttribute("stroke-dasharray"));
1285
+ n ? (t.setAttribute("data-dash-key", n), t.setAttribute("stroke-dasharray", k(n, e))) : (t.removeAttribute("data-dash-key"), t.removeAttribute("stroke-dasharray"));
1285
1286
  }
1286
1287
  },
1287
1288
  options: [
@@ -1308,7 +1309,7 @@ var Tt = {
1308
1309
  ]
1309
1310
  },
1310
1311
  textVariantPicker: {
1311
- id: A.textVariantPicker,
1312
+ id: B.textVariantPicker,
1312
1313
  type: "variantPicker",
1313
1314
  label: "Text type",
1314
1315
  getValue: (e) => ot(e),
@@ -1332,19 +1333,19 @@ var Tt = {
1332
1333
  ]
1333
1334
  },
1334
1335
  textColor: {
1335
- id: A.textColor,
1336
+ id: B.textColor,
1336
1337
  type: "color",
1337
1338
  label: "Color",
1338
1339
  getValue: (e) => e.querySelector("text")?.getAttribute("fill") ?? "#ff0000",
1339
- effect: j.applyTextColor
1340
+ effect: V.applyTextColor
1340
1341
  },
1341
1342
  fontFamily: {
1342
- id: A.fontFamily,
1343
+ id: B.fontFamily,
1343
1344
  type: "select",
1344
1345
  label: "Font",
1345
- getValue: (e) => f(e.getAttribute("data-font-family") ?? e.querySelector("text")?.getAttribute("font-family")),
1346
+ getValue: (e) => S(e.getAttribute("data-font-family") ?? e.querySelector("text")?.getAttribute("font-family")),
1346
1347
  setValue: (e, t) => {
1347
- let n = f(String(t));
1348
+ let n = S(String(t));
1348
1349
  e.setAttribute("data-font-family", n), e.querySelector("text")?.setAttribute("font-family", n);
1349
1350
  },
1350
1351
  options: [
@@ -1363,15 +1364,15 @@ var Tt = {
1363
1364
  ]
1364
1365
  },
1365
1366
  fontSize: {
1366
- id: A.fontSize,
1367
+ id: B.fontSize,
1367
1368
  type: "number",
1368
1369
  label: "Size",
1369
1370
  getValue: (e) => Number.parseFloat(e.querySelector("text")?.getAttribute("font-size") || "16"),
1370
1371
  setValue: (e, t) => {
1371
1372
  let n = Number(t);
1372
1373
  if (e.querySelector("text")?.setAttribute("font-size", String(n)), e.setAttribute("data-font-size", String(n)), at(e)) {
1373
- let t = O(e).runs;
1374
- k(e, t);
1374
+ let t = R(e).runs;
1375
+ z(e, t);
1375
1376
  }
1376
1377
  },
1377
1378
  min: 8,
@@ -1380,15 +1381,15 @@ var Tt = {
1380
1381
  unit: "pt"
1381
1382
  },
1382
1383
  textAnchor: {
1383
- id: A.textAnchor,
1384
+ id: B.textAnchor,
1384
1385
  type: "select",
1385
1386
  label: "Align",
1386
1387
  getValue: (e) => e.getAttribute("data-text-anchor") ?? "start",
1387
1388
  setValue: (e, t) => {
1388
1389
  let n = String(t);
1389
1390
  e.setAttribute("data-text-anchor", n);
1390
- let r = O(e).runs;
1391
- k(e, r);
1391
+ let r = R(e).runs;
1392
+ z(e, r);
1392
1393
  },
1393
1394
  options: [
1394
1395
  {
@@ -1409,15 +1410,15 @@ var Tt = {
1409
1410
  ]
1410
1411
  },
1411
1412
  textVerticalAnchor: {
1412
- id: A.textVerticalAnchor,
1413
+ id: B.textVerticalAnchor,
1413
1414
  type: "select",
1414
1415
  label: "V-Align",
1415
1416
  getValue: (e) => e.getAttribute("data-text-vanchor") ?? "top",
1416
1417
  setValue: (e, t) => {
1417
1418
  let n = String(t);
1418
1419
  e.setAttribute("data-text-vanchor", n);
1419
- let r = O(e).runs;
1420
- k(e, r);
1420
+ let r = R(e).runs;
1421
+ z(e, r);
1421
1422
  },
1422
1423
  options: [
1423
1424
  {
@@ -1438,15 +1439,15 @@ var Tt = {
1438
1439
  ]
1439
1440
  },
1440
1441
  textAutofit: {
1441
- id: A.textAutofit,
1442
+ id: B.textAutofit,
1442
1443
  type: "select",
1443
1444
  label: "Autofit",
1444
1445
  getValue: (e) => e.getAttribute("data-text-autofit") || "none",
1445
1446
  setValue: (e, t) => {
1446
1447
  let n = String(t);
1447
1448
  n === "none" ? e.removeAttribute("data-text-autofit") : e.setAttribute("data-text-autofit", n);
1448
- let r = O(e).runs;
1449
- k(e, r);
1449
+ let r = R(e).runs;
1450
+ z(e, r);
1450
1451
  },
1451
1452
  options: [
1452
1453
  {
@@ -1463,19 +1464,19 @@ var Tt = {
1463
1464
  }
1464
1465
  ]
1465
1466
  },
1466
- textMarginLeft: Dt(A.textMarginLeft, "Margin L", "data-text-margin-l"),
1467
- textMarginRight: Dt(A.textMarginRight, "Margin R", "data-text-margin-r"),
1468
- textMarginTop: Dt(A.textMarginTop, "Margin T", "data-text-margin-t"),
1469
- textMarginBottom: Dt(A.textMarginBottom, "Margin B", "data-text-margin-b"),
1470
- textBold: Ot(A.textBold, "Bold", "font-weight", "bold", (e) => e === "bold" || e === "700"),
1471
- textItalic: Ot(A.textItalic, "Italic", "font-style", "italic", (e) => e === "italic"),
1472
- textUnderline: Ot(A.textUnderline, "Underline", "text-decoration", "underline", (e) => e.includes("underline")),
1467
+ textMarginLeft: K(B.textMarginLeft, "Margin L", "data-text-margin-l"),
1468
+ textMarginRight: K(B.textMarginRight, "Margin R", "data-text-margin-r"),
1469
+ textMarginTop: K(B.textMarginTop, "Margin T", "data-text-margin-t"),
1470
+ textMarginBottom: K(B.textMarginBottom, "Margin B", "data-text-margin-b"),
1471
+ textBold: Et(B.textBold, "Bold", "font-weight", "bold", (e) => e === "bold" || e === "700"),
1472
+ textItalic: Et(B.textItalic, "Italic", "font-style", "italic", (e) => e === "italic"),
1473
+ textUnderline: Et(B.textUnderline, "Underline", "text-decoration", "underline", (e) => e.includes("underline")),
1473
1474
  redactStylePicker: {
1474
- id: A.redactStylePicker,
1475
+ id: B.redactStylePicker,
1475
1476
  type: "variantPicker",
1476
1477
  label: "Redact style",
1477
- getValue: (e) => Ct(e),
1478
- effect: j.applyRedactStyle,
1478
+ getValue: (e) => St(e),
1479
+ effect: V.applyRedactStyle,
1479
1480
  options: [
1480
1481
  {
1481
1482
  value: "mosaic",
@@ -1495,31 +1496,31 @@ var Tt = {
1495
1496
  ]
1496
1497
  },
1497
1498
  redactSolidColor: {
1498
- id: A.redactSolidColor,
1499
+ id: B.redactSolidColor,
1499
1500
  type: "color",
1500
1501
  label: "Color",
1501
1502
  getValue: (e) => e.getAttribute("fill") ?? "#111111",
1502
1503
  setValue: (e, t) => {
1503
1504
  e.setAttribute("fill", String(t));
1504
1505
  },
1505
- visibleWhen: (e) => Ct(e) === "solid"
1506
+ visibleWhen: (e) => St(e) === "solid"
1506
1507
  },
1507
1508
  highlightColorPicker: {
1508
- id: A.highlightColorPicker,
1509
+ id: B.highlightColorPicker,
1509
1510
  type: "variantPicker",
1510
1511
  label: "Highlight color",
1511
- getValue: (e) => (e.getAttribute("fill") ?? v[0]?.value ?? "#ffff00").toLowerCase(),
1512
+ getValue: (e) => (e.getAttribute("fill") ?? D[0]?.value ?? "#ffff00").toLowerCase(),
1512
1513
  setValue: (e, t) => {
1513
1514
  e.setAttribute("fill", String(t));
1514
1515
  },
1515
- options: v.map((e) => ({
1516
+ options: D.map((e) => ({
1516
1517
  value: e.value,
1517
1518
  label: e.label,
1518
1519
  swatchColor: e.value
1519
1520
  }))
1520
1521
  },
1521
1522
  highlightTransparency: {
1522
- id: A.highlightTransparency,
1523
+ id: B.highlightTransparency,
1523
1524
  type: "number",
1524
1525
  label: "Transparency",
1525
1526
  getValue: (e) => {
@@ -1536,71 +1537,71 @@ var Tt = {
1536
1537
  unit: "%"
1537
1538
  },
1538
1539
  markerShapePicker: {
1539
- id: A.markerShapePicker,
1540
+ id: B.markerShapePicker,
1540
1541
  type: "variantPicker",
1541
1542
  label: "Counter shape",
1542
1543
  getValue: (e) => gt(e),
1543
- effect: j.applyMarkerShape,
1544
+ effect: V.applyMarkerShape,
1544
1545
  options: [
1545
1546
  {
1546
1547
  value: "circle",
1547
1548
  label: "Circle",
1548
- iconSvg: _.circle
1549
+ iconSvg: E.circle
1549
1550
  },
1550
1551
  {
1551
1552
  value: "rect",
1552
1553
  label: "Square",
1553
- iconSvg: _.rect
1554
+ iconSvg: E.rect
1554
1555
  },
1555
1556
  {
1556
1557
  value: "rounded",
1557
1558
  label: "Rounded square",
1558
- iconSvg: _.rounded
1559
+ iconSvg: E.rounded
1559
1560
  }
1560
1561
  ]
1561
1562
  },
1562
1563
  markerSize: {
1563
- id: A.markerSize,
1564
+ id: B.markerSize,
1564
1565
  type: "number",
1565
1566
  label: "Size",
1566
- getValue: (e) => St(e),
1567
- effect: j.resizeMarker,
1567
+ getValue: (e) => xt(e),
1568
+ effect: V.resizeMarker,
1568
1569
  min: 8,
1569
1570
  max: 96,
1570
1571
  step: 1,
1571
1572
  unit: "pt"
1572
1573
  },
1573
1574
  markerBgFillColor: {
1574
- id: A.markerBgFillColor,
1575
+ id: B.markerBgFillColor,
1575
1576
  type: "color",
1576
1577
  label: "Color",
1577
- getValue: (e) => M(e)?.getAttribute("fill") ?? "#ff0000",
1578
+ getValue: (e) => H(e)?.getAttribute("fill") ?? "#ff0000",
1578
1579
  setValue: (e, t) => {
1579
- M(e)?.setAttribute("fill", String(t));
1580
+ H(e)?.setAttribute("fill", String(t));
1580
1581
  },
1581
1582
  allowNone: !0
1582
1583
  },
1583
1584
  markerBgStrokeColor: {
1584
- id: A.markerBgStrokeColor,
1585
+ id: B.markerBgStrokeColor,
1585
1586
  type: "color",
1586
1587
  label: "Color",
1587
- getValue: (e) => M(e)?.getAttribute("stroke") ?? "#ffffff",
1588
+ getValue: (e) => H(e)?.getAttribute("stroke") ?? "#ffffff",
1588
1589
  setValue: (e, t) => {
1589
- M(e)?.setAttribute("stroke", String(t));
1590
+ H(e)?.setAttribute("stroke", String(t));
1590
1591
  }
1591
1592
  },
1592
1593
  markerBgStrokeWidth: {
1593
- id: A.markerBgStrokeWidth,
1594
+ id: B.markerBgStrokeWidth,
1594
1595
  type: "number",
1595
1596
  label: "Width",
1596
- getValue: (e) => Number.parseFloat(M(e)?.getAttribute("stroke-width") || "1.5"),
1597
+ getValue: (e) => Number.parseFloat(H(e)?.getAttribute("stroke-width") || "1.5"),
1597
1598
  setValue: (e, t) => {
1598
- let n = M(e);
1599
+ let n = H(e);
1599
1600
  if (!n) return;
1600
1601
  let r = Number(t);
1601
1602
  n.setAttribute("stroke-width", String(r));
1602
1603
  let i = n.getAttribute("data-dash-key");
1603
- i && n.setAttribute("stroke-dasharray", w(i, r));
1604
+ i && n.setAttribute("stroke-dasharray", k(i, r));
1604
1605
  },
1605
1606
  min: 0,
1606
1607
  max: 20,
@@ -1608,22 +1609,22 @@ var Tt = {
1608
1609
  unit: "pt"
1609
1610
  },
1610
1611
  markerBgStrokeStyle: {
1611
- id: A.markerBgStrokeStyle,
1612
+ id: B.markerBgStrokeStyle,
1612
1613
  type: "select",
1613
1614
  label: "Dash type",
1614
1615
  getValue: (e) => {
1615
- let t = M(e);
1616
+ let t = H(e);
1616
1617
  if (!t) return "";
1617
1618
  let n = t.getAttribute("data-dash-key");
1618
1619
  if (n != null) return n;
1619
1620
  let r = Number.parseFloat(t.getAttribute("stroke-width") || "1.5");
1620
- return xe(t.getAttribute("stroke-dasharray") || "", r) ?? "";
1621
+ return Ee(t.getAttribute("stroke-dasharray") || "", r) ?? "";
1621
1622
  },
1622
1623
  setValue: (e, t) => {
1623
- let n = M(e);
1624
+ let n = H(e);
1624
1625
  if (!n) return;
1625
1626
  let r = String(t), i = Number.parseFloat(n.getAttribute("stroke-width") || "1.5");
1626
- r ? (n.setAttribute("data-dash-key", r), n.setAttribute("stroke-dasharray", w(r, i))) : (n.removeAttribute("data-dash-key"), n.removeAttribute("stroke-dasharray"));
1627
+ r ? (n.setAttribute("data-dash-key", r), n.setAttribute("stroke-dasharray", k(r, i))) : (n.removeAttribute("data-dash-key"), n.removeAttribute("stroke-dasharray"));
1627
1628
  },
1628
1629
  options: [
1629
1630
  {
@@ -1649,7 +1650,7 @@ var Tt = {
1649
1650
  ]
1650
1651
  },
1651
1652
  markerLabelValue: {
1652
- id: A.markerLabelValue,
1653
+ id: B.markerLabelValue,
1653
1654
  type: "number",
1654
1655
  label: "Value",
1655
1656
  getValue: (e) => {
@@ -1667,34 +1668,34 @@ var Tt = {
1667
1668
  step: 1
1668
1669
  },
1669
1670
  fillOpacity: {
1670
- id: A.fillOpacity,
1671
+ id: B.fillOpacity,
1671
1672
  type: "number",
1672
1673
  label: "Transparency",
1673
1674
  getValue: (e) => {
1674
- let t = Number.parseFloat(N(e, "fill-opacity") || "1");
1675
+ let t = Number.parseFloat(W(e, "fill-opacity") || "1");
1675
1676
  return Math.round((1 - (Number.isFinite(t) ? t : 1)) * 100);
1676
1677
  },
1677
1678
  setValue: (e, t) => {
1678
1679
  let n = 1 - Number(t) / 100;
1679
1680
  e.setAttribute("fill-opacity", String(n));
1680
1681
  },
1681
- visibleWhen: (e) => !P(e) && e.tagName !== "path" && !wt(e),
1682
+ visibleWhen: (e) => !G(e) && e.tagName !== "path" && !Ct(e),
1682
1683
  min: 0,
1683
1684
  max: 100,
1684
1685
  step: 1,
1685
1686
  unit: "%"
1686
1687
  },
1687
1688
  strokeOpacity: {
1688
- id: A.strokeOpacity,
1689
+ id: B.strokeOpacity,
1689
1690
  type: "number",
1690
1691
  label: "Transparency",
1691
1692
  getValue: (e) => {
1692
- let t = e.getAttribute("opacity") ?? (N(e, "stroke-opacity") || "1"), n = Number.parseFloat(t);
1693
+ let t = e.getAttribute("opacity") ?? (W(e, "stroke-opacity") || "1"), n = Number.parseFloat(t);
1693
1694
  return Math.round((1 - (Number.isFinite(n) ? n : 1)) * 100);
1694
1695
  },
1695
1696
  setValue: (e, t) => {
1696
1697
  let n = 1 - Number(t) / 100;
1697
- for (let t of _t(e)) P(t) ? (t.setAttribute("opacity", String(n)), t.removeAttribute("stroke-opacity")) : t.setAttribute("stroke-opacity", String(n));
1698
+ for (let t of U(e)) G(t) ? (t.setAttribute("opacity", String(n)), t.removeAttribute("stroke-opacity")) : t.setAttribute("stroke-opacity", String(n));
1698
1699
  },
1699
1700
  min: 0,
1700
1701
  max: 100,
@@ -1702,13 +1703,13 @@ var Tt = {
1702
1703
  unit: "%"
1703
1704
  },
1704
1705
  strokeLinecap: {
1705
- id: A.strokeLinecap,
1706
+ id: B.strokeLinecap,
1706
1707
  type: "select",
1707
1708
  label: "Cap type",
1708
- getValue: (e) => N(e, "stroke-linecap") ?? "butt",
1709
+ getValue: (e) => W(e, "stroke-linecap") ?? "butt",
1709
1710
  setValue: (e, t) => {
1710
1711
  let n = String(t);
1711
- for (let t of _t(e)) t.setAttribute("stroke-linecap", n);
1712
+ for (let t of U(e)) t.setAttribute("stroke-linecap", n);
1712
1713
  },
1713
1714
  options: [
1714
1715
  {
@@ -1726,57 +1727,57 @@ var Tt = {
1726
1727
  ]
1727
1728
  },
1728
1729
  arrowStartShape: {
1729
- id: A.arrowStartShape,
1730
+ id: B.arrowStartShape,
1730
1731
  type: "select",
1731
1732
  label: "Begin arrow type",
1732
- getValue: (e) => E(e, "start").shape,
1733
- effect: j.applyArrowStartShape,
1734
- visibleWhen: P,
1735
- getOptions: (e) => bt("start", yt(e)),
1733
+ getValue: (e) => M(e, "start").shape,
1734
+ effect: V.applyArrowStartShape,
1735
+ visibleWhen: G,
1736
+ getOptions: (e) => yt("start", vt(e)),
1736
1737
  selectColumns: 3,
1737
1738
  selectPopupWidth: 170
1738
1739
  },
1739
1740
  arrowStartSize: {
1740
- id: A.arrowStartSize,
1741
+ id: B.arrowStartSize,
1741
1742
  type: "select",
1742
1743
  label: "Begin arrow size",
1743
1744
  getValue: (e) => {
1744
- let t = E(e, "start");
1745
+ let t = M(e, "start");
1745
1746
  return `${t.width}-${t.length}`;
1746
1747
  },
1747
- effect: j.applyArrowStartSize,
1748
- visibleWhen: P,
1749
- options: xt("start"),
1748
+ effect: V.applyArrowStartSize,
1749
+ visibleWhen: G,
1750
+ options: bt("start"),
1750
1751
  selectColumns: 3,
1751
1752
  selectPopupWidth: 180
1752
1753
  },
1753
1754
  arrowEndShape: {
1754
- id: A.arrowEndShape,
1755
+ id: B.arrowEndShape,
1755
1756
  type: "select",
1756
1757
  label: "End arrow type",
1757
- getValue: (e) => E(e, "end").shape,
1758
- effect: j.applyArrowEndShape,
1759
- visibleWhen: P,
1760
- getOptions: (e) => bt("end", yt(e)),
1758
+ getValue: (e) => M(e, "end").shape,
1759
+ effect: V.applyArrowEndShape,
1760
+ visibleWhen: G,
1761
+ getOptions: (e) => yt("end", vt(e)),
1761
1762
  selectColumns: 3,
1762
1763
  selectPopupWidth: 170
1763
1764
  },
1764
1765
  arrowEndSize: {
1765
- id: A.arrowEndSize,
1766
+ id: B.arrowEndSize,
1766
1767
  type: "select",
1767
1768
  label: "End arrow size",
1768
1769
  getValue: (e) => {
1769
- let t = E(e, "end");
1770
+ let t = M(e, "end");
1770
1771
  return `${t.width}-${t.length}`;
1771
1772
  },
1772
- effect: j.applyArrowEndSize,
1773
- visibleWhen: P,
1774
- options: xt("end"),
1773
+ effect: V.applyArrowEndSize,
1774
+ visibleWhen: G,
1775
+ options: bt("end"),
1775
1776
  selectColumns: 3,
1776
1777
  selectPopupWidth: 180
1777
1778
  }
1778
1779
  };
1779
- function Et(e) {
1780
+ function Tt(e) {
1780
1781
  let t = e.tagName;
1781
1782
  if (t === "g") {
1782
1783
  let t = e.getAttribute("data-type");
@@ -1789,7 +1790,7 @@ function Et(e) {
1789
1790
  let n = e.getAttribute("data-redact-style");
1790
1791
  return n === "mosaic" ? "redact-mosaic" : n === "solid" ? "redact-solid" : n === "blur" ? "redact-blur" : "shape";
1791
1792
  }
1792
- function Dt(e, t, n) {
1793
+ function K(e, t, n) {
1793
1794
  return {
1794
1795
  id: e,
1795
1796
  type: "number",
@@ -1804,8 +1805,8 @@ function Dt(e, t, n) {
1804
1805
  let r = Number(t);
1805
1806
  if (!Number.isFinite(r) || r < 0) return;
1806
1807
  e.setAttribute(n, String(r));
1807
- let i = O(e).runs;
1808
- k(e, i);
1808
+ let i = R(e).runs;
1809
+ z(e, i);
1809
1810
  },
1810
1811
  min: 0,
1811
1812
  max: 200,
@@ -1813,7 +1814,7 @@ function Dt(e, t, n) {
1813
1814
  unit: "px"
1814
1815
  };
1815
1816
  }
1816
- function Ot(e, t, n, r, i) {
1817
+ function Et(e, t, n, r, i) {
1817
1818
  return {
1818
1819
  id: e,
1819
1820
  type: "select",
@@ -1838,13 +1839,13 @@ function Ot(e, t, n, r, i) {
1838
1839
  }]
1839
1840
  };
1840
1841
  }
1841
- function kt(e) {
1842
+ function Dt(e) {
1842
1843
  if (e.length === 0) return {
1843
1844
  category: null,
1844
1845
  uniform: !0
1845
1846
  };
1846
- let t = Et(e[0]);
1847
- for (let n = 1; n < e.length; n++) if (Et(e[n]) !== t) return {
1847
+ let t = Tt(e[0]);
1848
+ for (let n = 1; n < e.length; n++) if (Tt(e[n]) !== t) return {
1848
1849
  category: t,
1849
1850
  uniform: !1
1850
1851
  };
@@ -1855,14 +1856,14 @@ function kt(e) {
1855
1856
  }
1856
1857
  //#endregion
1857
1858
  //#region src/editor/selection-geometry.ts
1858
- function At(e, t, n, r, i) {
1859
+ function Ot(e, t, n, r, i) {
1859
1860
  let a = Math.cos(i), o = Math.sin(i);
1860
1861
  return {
1861
1862
  x: n + (e - n) * a - (t - r) * o,
1862
1863
  y: r + (e - n) * o + (t - r) * a
1863
1864
  };
1864
1865
  }
1865
- var jt = [
1866
+ var kt = [
1866
1867
  "ew-resize",
1867
1868
  "nwse-resize",
1868
1869
  "ns-resize",
@@ -1872,11 +1873,11 @@ var jt = [
1872
1873
  "ns-resize",
1873
1874
  "nesw-resize"
1874
1875
  ];
1875
- function Mt(e) {
1876
+ function At(e) {
1876
1877
  let t = Math.PI * 2, n = (e % t + t) % t;
1877
- return n += Math.PI / 8, n >= t && (n -= t), jt[Math.floor(n / (Math.PI / 4)) % 8];
1878
+ return n += Math.PI / 8, n >= t && (n -= t), kt[Math.floor(n / (Math.PI / 4)) % 8];
1878
1879
  }
1879
- function Nt(e) {
1880
+ function jt(e) {
1880
1881
  let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
1881
1882
  for (let a of e) a.x < t && (t = a.x), a.y < n && (n = a.y), a.x + a.width > r && (r = a.x + a.width), a.y + a.height > i && (i = a.y + a.height);
1882
1883
  return {
@@ -1886,14 +1887,14 @@ function Nt(e) {
1886
1887
  height: i - n
1887
1888
  };
1888
1889
  }
1889
- function Pt(e) {
1890
+ function Mt(e) {
1890
1891
  let { draggedBoxes: t, dx: n, dy: r, otherBoxes: i, threshold: a } = e;
1891
1892
  if (t.length === 0 || i.length === 0) return {
1892
1893
  dx: n,
1893
1894
  dy: r,
1894
1895
  guides: []
1895
1896
  };
1896
- let o = Nt(t), s = {
1897
+ let o = jt(t), s = {
1897
1898
  left: o.x + n,
1898
1899
  right: o.x + o.width + n,
1899
1900
  centerX: o.x + o.width / 2 + n,
@@ -1966,20 +1967,20 @@ function Pt(e) {
1966
1967
  }
1967
1968
  //#endregion
1968
1969
  //#region src/editor/svg-format.ts
1969
- var Ft = "1", It = "0", Lt = "data-annot-version";
1970
- function Rt(e) {
1971
- e.setAttribute(Lt, "1");
1970
+ var Nt = "1", Pt = "0", Ft = "data-annot-version";
1971
+ function It(e) {
1972
+ e.setAttribute(Ft, "1");
1972
1973
  }
1973
- function zt(e) {
1974
+ function Lt(e) {
1974
1975
  return e.getAttribute("data-annot-version") || "0";
1975
1976
  }
1976
- function Bt(e) {
1977
+ function Rt(e) {
1977
1978
  let t = /\sdata-annot-version="([^"]*)"/.exec(e);
1978
1979
  return t ? t[1] : "0";
1979
1980
  }
1980
1981
  //#endregion
1981
1982
  //#region src/editor/tool-lifecycle.ts
1982
- function Vt(e) {
1983
+ function zt(e) {
1983
1984
  let t = [], n = [], r = {
1984
1985
  drafts: t,
1985
1986
  committed: n,
@@ -1998,32 +1999,32 @@ function Vt(e) {
1998
1999
  }
1999
2000
  //#endregion
2000
2001
  //#region src/editor/tool-style-writer.ts
2001
- function Ht(e, t) {
2002
- t.strokeColor && e.setAttribute("stroke", t.strokeColor), t.strokeWidth != null && e.setAttribute("stroke-width", String(t.strokeWidth)), t.strokeDasharray != null && (e.setAttribute("stroke-dasharray", w(t.strokeDasharray, t.strokeWidth)), e.setAttribute("data-dash-key", t.strokeDasharray)), t.fillColor && e.setAttribute("fill", t.fillColor), t.fillOpacity != null && e.setAttribute("fill-opacity", String(t.fillOpacity)), t.strokeLinecap && e.setAttribute("stroke-linecap", t.strokeLinecap), t.strokeLinejoin && e.setAttribute("stroke-linejoin", t.strokeLinejoin), t.strokeOpacity != null && (e.tagName === "line" || e.tagName === "g" && e.getAttribute("data-type") === "arrow" ? e.setAttribute("opacity", String(t.strokeOpacity)) : e.setAttribute("stroke-opacity", String(t.strokeOpacity)));
2002
+ function q(e, t) {
2003
+ t.strokeColor && e.setAttribute("stroke", t.strokeColor), t.strokeWidth != null && e.setAttribute("stroke-width", String(t.strokeWidth)), t.strokeDasharray != null && (e.setAttribute("stroke-dasharray", k(t.strokeDasharray, t.strokeWidth)), e.setAttribute("data-dash-key", t.strokeDasharray)), t.fillColor && e.setAttribute("fill", t.fillColor), t.fillOpacity != null && e.setAttribute("fill-opacity", String(t.fillOpacity)), t.strokeLinecap && e.setAttribute("stroke-linecap", t.strokeLinecap), t.strokeLinejoin && e.setAttribute("stroke-linejoin", t.strokeLinejoin), t.strokeOpacity != null && (e.tagName === "line" || e.tagName === "g" && e.getAttribute("data-type") === "arrow" ? e.setAttribute("opacity", String(t.strokeOpacity)) : e.setAttribute("stroke-opacity", String(t.strokeOpacity)));
2003
2004
  }
2004
2005
  //#endregion
2005
2006
  //#region src/editor/tool-registry.ts
2006
- var Ut = [
2007
+ var Bt = [
2007
2008
  "tool.typeChips",
2008
2009
  "tool.transparencyPercent",
2009
2010
  "tool.fillTransparencyPercent",
2010
2011
  "tool.fillOpacityPercent",
2011
2012
  "tool.freehandDone"
2012
- ], Wt = [
2013
+ ], J = [
2013
2014
  "strokeColor",
2014
2015
  "strokeWidth",
2015
2016
  "strokeDasharray",
2016
2017
  "strokeOpacity",
2017
2018
  "strokeLinecap"
2018
2019
  ];
2019
- function Gt(e) {
2020
+ function Vt(e) {
2020
2021
  return e.getAttribute("data-highlight") === "1" || e.getAttribute("data-redact-style") === "solid" ? null : e.hasAttribute("data-rounded") ? "rounded" : "rect";
2021
2022
  }
2022
- function Kt(e) {
2023
+ function Ht(e) {
2023
2024
  let t = (e.getAttribute("data-arrow-start-shape") ?? "none") !== "none", n = (e.getAttribute("data-arrow-end-shape") ?? "none") !== "none";
2024
2025
  return t && n ? "both" : t || n ? "end" : "none";
2025
2026
  }
2026
- function qt(e, t, n) {
2027
+ function Ut(e, t, n) {
2027
2028
  if (e !== "arrow") return;
2028
2029
  let r = n, i = "triangle", a = "none", o = n.arrowHeadStart, s = n.arrowHeadEnd;
2029
2030
  switch (t) {
@@ -2038,7 +2039,7 @@ function qt(e, t, n) {
2038
2039
  break;
2039
2040
  }
2040
2041
  }
2041
- var Jt = {
2042
+ var Wt = {
2042
2043
  arrow: {
2043
2044
  id: "arrow",
2044
2045
  label: "Line",
@@ -2050,23 +2051,23 @@ var Jt = {
2050
2051
  value: "none",
2051
2052
  icon: "horizontal_rule",
2052
2053
  label: "Line (no arrow)",
2053
- svg: g.none
2054
+ svg: T.none
2054
2055
  },
2055
2056
  {
2056
2057
  value: "end",
2057
2058
  icon: "north_east",
2058
2059
  label: "Arrow",
2059
- svg: g.end
2060
+ svg: T.end
2060
2061
  },
2061
2062
  {
2062
2063
  value: "both",
2063
2064
  icon: "sync_alt",
2064
2065
  label: "Double arrow",
2065
- svg: g.both
2066
+ svg: T.both
2066
2067
  }
2067
2068
  ],
2068
2069
  presetFields: [
2069
- ...Wt,
2070
+ ...J,
2070
2071
  "arrowHead",
2071
2072
  "arrowHeadStart",
2072
2073
  "arrowHeadEnd",
@@ -2082,7 +2083,7 @@ var Jt = {
2082
2083
  },
2083
2084
  {
2084
2085
  section: "Line",
2085
- id: A.strokeColor
2086
+ id: B.strokeColor
2086
2087
  },
2087
2088
  {
2088
2089
  section: "Line",
@@ -2090,43 +2091,43 @@ var Jt = {
2090
2091
  },
2091
2092
  {
2092
2093
  section: "Line",
2093
- id: A.strokeWidth
2094
+ id: B.strokeWidth
2094
2095
  },
2095
2096
  {
2096
2097
  section: "Line",
2097
- id: A.strokeStyle
2098
+ id: B.strokeStyle
2098
2099
  },
2099
2100
  {
2100
2101
  section: "Line",
2101
- id: A.strokeLinecap
2102
+ id: B.strokeLinecap
2102
2103
  },
2103
2104
  {
2104
2105
  section: "Line",
2105
- id: A.arrowStartShape
2106
+ id: B.arrowStartShape
2106
2107
  },
2107
2108
  {
2108
2109
  section: "Line",
2109
- id: A.arrowStartSize
2110
+ id: B.arrowStartSize
2110
2111
  },
2111
2112
  {
2112
2113
  section: "Line",
2113
- id: A.arrowEndShape
2114
+ id: B.arrowEndShape
2114
2115
  },
2115
2116
  {
2116
2117
  section: "Line",
2117
- id: A.arrowEndSize
2118
+ id: B.arrowEndSize
2118
2119
  }
2119
2120
  ],
2120
2121
  variantKeyForElement(e) {
2121
- return e.tagName === "line" || e.tagName === "g" && e.getAttribute("data-type") === "arrow" ? `arrow.${Kt(e)}` : null;
2122
+ return e.tagName === "line" || e.tagName === "g" && e.getAttribute("data-type") === "arrow" ? `arrow.${Ht(e)}` : null;
2122
2123
  },
2123
2124
  extractStyleFromElement(e, t) {
2124
- t.arrowHead = Kt(e);
2125
+ t.arrowHead = Ht(e);
2125
2126
  let n = e.getAttribute("data-arrow-start-shape"), r = e.getAttribute("data-arrow-end-shape"), i = e.getAttribute("data-arrow-start-width"), a = e.getAttribute("data-arrow-start-length"), o = e.getAttribute("data-arrow-end-width"), s = e.getAttribute("data-arrow-end-length");
2126
- n && (t.arrowHeadStart = n), r && (t.arrowHeadEnd = r), i && (t.arrowWidthStart = i), a && (t.arrowLengthStart = a), o && (t.arrowWidthEnd = o), s && (t.arrowLengthEnd = s), qt("arrow", t.arrowHead, t);
2127
+ n && (t.arrowHeadStart = n), r && (t.arrowHeadEnd = r), i && (t.arrowWidthStart = i), a && (t.arrowLengthStart = a), o && (t.arrowWidthEnd = o), s && (t.arrowLengthEnd = s), Ut("arrow", t.arrowHead, t);
2127
2128
  },
2128
2129
  applyStyleToElement(e, t) {
2129
- Ht(e, t), e.tagName === "g" && e.getAttribute("data-type") === "arrow" && Ie(e);
2130
+ q(e, t), e.tagName === "g" && e.getAttribute("data-type") === "arrow" && Be(e);
2130
2131
  }
2131
2132
  },
2132
2133
  shape: {
@@ -2140,23 +2141,23 @@ var Jt = {
2140
2141
  value: "rect",
2141
2142
  icon: "rectangle",
2142
2143
  label: "Rectangle",
2143
- svg: h.rect
2144
+ svg: w.rect
2144
2145
  },
2145
2146
  {
2146
2147
  value: "rounded",
2147
2148
  icon: "crop_square",
2148
2149
  label: "Rounded rectangle",
2149
- svg: h.rounded
2150
+ svg: w.rounded
2150
2151
  },
2151
2152
  {
2152
2153
  value: "ellipse",
2153
2154
  icon: "circle",
2154
2155
  label: "Ellipse",
2155
- svg: h.ellipse
2156
+ svg: w.ellipse
2156
2157
  }
2157
2158
  ],
2158
2159
  presetFields: [
2159
- ...Wt,
2160
+ ...J,
2160
2161
  "fillColor",
2161
2162
  "fillOpacity",
2162
2163
  "shapeType",
@@ -2169,7 +2170,7 @@ var Jt = {
2169
2170
  },
2170
2171
  {
2171
2172
  section: "Fill",
2172
- id: A.fillColor
2173
+ id: B.fillColor
2173
2174
  },
2174
2175
  {
2175
2176
  section: "Fill",
@@ -2177,7 +2178,7 @@ var Jt = {
2177
2178
  },
2178
2179
  {
2179
2180
  section: "Line",
2180
- id: A.strokeColor
2181
+ id: B.strokeColor
2181
2182
  },
2182
2183
  {
2183
2184
  section: "Line",
@@ -2185,21 +2186,21 @@ var Jt = {
2185
2186
  },
2186
2187
  {
2187
2188
  section: "Line",
2188
- id: A.strokeWidth
2189
+ id: B.strokeWidth
2189
2190
  },
2190
2191
  {
2191
2192
  section: "Line",
2192
- id: A.strokeStyle
2193
+ id: B.strokeStyle
2193
2194
  },
2194
2195
  {
2195
2196
  section: "Line",
2196
- id: A.strokeLinecap
2197
+ id: B.strokeLinecap
2197
2198
  }
2198
2199
  ],
2199
2200
  variantKeyForElement(e) {
2200
2201
  if (e.tagName === "ellipse") return "shape.ellipse";
2201
2202
  if (e.tagName === "rect") {
2202
- let t = Gt(e);
2203
+ let t = Vt(e);
2203
2204
  return t ? `shape.${t}` : null;
2204
2205
  }
2205
2206
  return null;
@@ -2208,7 +2209,7 @@ var Jt = {
2208
2209
  e.tagName === "ellipse" ? t.shapeType = "ellipse" : e.tagName === "rect" && (t.shapeType = e.hasAttribute("data-rounded") ? "rounded" : "rect");
2209
2210
  },
2210
2211
  applyStyleToElement(e, t) {
2211
- Ht(e, t);
2212
+ q(e, t);
2212
2213
  }
2213
2214
  },
2214
2215
  highlight: {
@@ -2216,8 +2217,8 @@ var Jt = {
2216
2217
  label: "Highlight",
2217
2218
  icon: "ink_highlighter",
2218
2219
  variantField: "highlightColor",
2219
- defaultVariant: v[0].value,
2220
- variants: v.map((e) => ({
2220
+ defaultVariant: D[0].value,
2221
+ variants: D.map((e) => ({
2221
2222
  value: e.value,
2222
2223
  icon: "ink_highlighter",
2223
2224
  label: e.label
@@ -2225,7 +2226,7 @@ var Jt = {
2225
2226
  flyoutKind: "color",
2226
2227
  tooltipLabelForVariant: (e) => {
2227
2228
  let t = e.toLowerCase();
2228
- return v.find((e) => e.value === t)?.label ?? "";
2229
+ return D.find((e) => e.value === t)?.label ?? "";
2229
2230
  },
2230
2231
  ensurePresetForVariantChange: (e) => {
2231
2232
  e.shapeType = "highlight";
@@ -2241,7 +2242,7 @@ var Jt = {
2241
2242
  variantKeyForElement(e) {
2242
2243
  if (e.tagName !== "rect" || e.getAttribute("data-highlight") !== "1") return null;
2243
2244
  let t = e.getAttribute("fill");
2244
- return `highlight.${t ? t.toLowerCase() : v[0].value}`;
2245
+ return `highlight.${t ? t.toLowerCase() : D[0].value}`;
2245
2246
  },
2246
2247
  extractStyleFromElement(e, t) {
2247
2248
  let n = e.getAttribute("fill");
@@ -2290,23 +2291,23 @@ var Jt = {
2290
2291
  },
2291
2292
  {
2292
2293
  section: "Line",
2293
- id: A.strokeColor
2294
+ id: B.strokeColor
2294
2295
  },
2295
2296
  {
2296
2297
  section: "Line",
2297
- id: A.fontFamily
2298
+ id: B.fontFamily
2298
2299
  },
2299
2300
  {
2300
2301
  section: "Line",
2301
- id: A.fontSize
2302
+ id: B.fontSize
2302
2303
  },
2303
2304
  {
2304
2305
  section: "Label",
2305
- id: A.textAnchor
2306
+ id: B.textAnchor
2306
2307
  },
2307
2308
  {
2308
2309
  section: "Label",
2309
- id: A.textVerticalAnchor
2310
+ id: B.textVerticalAnchor
2310
2311
  }
2311
2312
  ],
2312
2313
  variantKeyForElement(e) {
@@ -2349,7 +2350,7 @@ var Jt = {
2349
2350
  }
2350
2351
  return;
2351
2352
  }
2352
- Ht(e, t);
2353
+ q(e, t);
2353
2354
  }
2354
2355
  },
2355
2356
  freehand: {
@@ -2367,7 +2368,7 @@ var Jt = {
2367
2368
  icon: "ink_highlighter",
2368
2369
  label: "Highlighter"
2369
2370
  }],
2370
- presetFields: [...Wt, "drawStyle"],
2371
+ presetFields: [...J, "drawStyle"],
2371
2372
  panelControls: [
2372
2373
  {
2373
2374
  section: "Type",
@@ -2375,7 +2376,7 @@ var Jt = {
2375
2376
  },
2376
2377
  {
2377
2378
  section: "Line",
2378
- id: A.strokeColor
2379
+ id: B.strokeColor
2379
2380
  },
2380
2381
  {
2381
2382
  section: "Line",
@@ -2383,15 +2384,15 @@ var Jt = {
2383
2384
  },
2384
2385
  {
2385
2386
  section: "Line",
2386
- id: A.strokeWidth
2387
+ id: B.strokeWidth
2387
2388
  },
2388
2389
  {
2389
2390
  section: "Line",
2390
- id: A.strokeStyle
2391
+ id: B.strokeStyle
2391
2392
  },
2392
2393
  {
2393
2394
  section: "Line",
2394
- id: A.strokeLinecap
2395
+ id: B.strokeLinecap
2395
2396
  },
2396
2397
  {
2397
2398
  section: "Line",
@@ -2406,7 +2407,7 @@ var Jt = {
2406
2407
  (n === "pen" || n === "highlighter") && (t.drawStyle = n);
2407
2408
  },
2408
2409
  applyStyleToElement(e, t) {
2409
- Ht(e, t);
2410
+ q(e, t);
2410
2411
  }
2411
2412
  },
2412
2413
  marker: {
@@ -2420,23 +2421,23 @@ var Jt = {
2420
2421
  value: "circle",
2421
2422
  icon: "circle",
2422
2423
  label: "Circle",
2423
- svg: _.circle
2424
+ svg: E.circle
2424
2425
  },
2425
2426
  {
2426
2427
  value: "rect",
2427
2428
  icon: "square",
2428
2429
  label: "Square",
2429
- svg: _.rect
2430
+ svg: E.rect
2430
2431
  },
2431
2432
  {
2432
2433
  value: "rounded",
2433
2434
  icon: "crop_square",
2434
2435
  label: "Rounded square",
2435
- svg: _.rounded
2436
+ svg: E.rounded
2436
2437
  }
2437
2438
  ],
2438
2439
  presetFields: [
2439
- ...Wt,
2440
+ ...J,
2440
2441
  "fillColor",
2441
2442
  "fontSize",
2442
2443
  "markerShape"
@@ -2448,23 +2449,23 @@ var Jt = {
2448
2449
  },
2449
2450
  {
2450
2451
  section: "Fill",
2451
- id: A.fillColor
2452
+ id: B.fillColor
2452
2453
  },
2453
2454
  {
2454
2455
  section: "Line",
2455
- id: A.strokeColor
2456
+ id: B.strokeColor
2456
2457
  },
2457
2458
  {
2458
2459
  section: "Line",
2459
- id: A.strokeWidth
2460
+ id: B.strokeWidth
2460
2461
  },
2461
2462
  {
2462
2463
  section: "Line",
2463
- id: A.strokeStyle
2464
+ id: B.strokeStyle
2464
2465
  },
2465
2466
  {
2466
2467
  section: "Label",
2467
- id: A.fontSize
2468
+ id: B.fontSize
2468
2469
  }
2469
2470
  ],
2470
2471
  variantKeyForElement(e) {
@@ -2489,7 +2490,7 @@ var Jt = {
2489
2490
  if (n) {
2490
2491
  if (t.fillColor && n.setAttribute("fill", t.fillColor), t.strokeColor && n.setAttribute("stroke", t.strokeColor), t.strokeWidth != null && n.setAttribute("stroke-width", String(t.strokeWidth)), t.strokeDasharray != null) {
2491
2492
  let e = t.strokeWidth ?? Number.parseFloat(n.getAttribute("stroke-width") || "1.5");
2492
- n.setAttribute("stroke-dasharray", w(t.strokeDasharray, e)), n.setAttribute("data-dash-key", t.strokeDasharray);
2493
+ n.setAttribute("stroke-dasharray", k(t.strokeDasharray, e)), n.setAttribute("data-dash-key", t.strokeDasharray);
2493
2494
  }
2494
2495
  if (t.fontSize != null) {
2495
2496
  let n = e.querySelector("text");
@@ -2527,7 +2528,7 @@ var Jt = {
2527
2528
  id: "tool.typeChips"
2528
2529
  }, {
2529
2530
  section: "Fill",
2530
- id: A.fillColor,
2531
+ id: B.fillColor,
2531
2532
  visibleWhen: (e) => e.redactStyle === "solid"
2532
2533
  }],
2533
2534
  variantKeyForElement(e) {
@@ -2560,7 +2561,7 @@ var Jt = {
2560
2561
  category: "annotation",
2561
2562
  presetFields: []
2562
2563
  }
2563
- }, Yt = [
2564
+ }, Gt = [
2564
2565
  "arrow",
2565
2566
  "shape",
2566
2567
  "highlight",
@@ -2570,146 +2571,146 @@ var Jt = {
2570
2571
  "redact",
2571
2572
  "crop",
2572
2573
  "overlay"
2573
- ], Xt = (e, t) => Math.round((1 - (Number.isFinite(e) ? e : t)) * 100), Zt = (e) => 1 - e / 100, Qt = (e, t) => Math.round((Number.isFinite(e) ? e : t) * 100), $t = (e) => e / 100;
2574
- function en(e) {
2574
+ ], Kt = (e, t) => Math.round((1 - (Number.isFinite(e) ? e : t)) * 100), qt = (e) => 1 - e / 100, Jt = (e, t) => Math.round((Number.isFinite(e) ? e : t) * 100), Yt = (e) => e / 100;
2575
+ function Xt(e) {
2575
2576
  return e === "sm" || e === "md" || e === "lg";
2576
2577
  }
2577
- function tn(e, t) {
2578
+ function Zt(e, t) {
2578
2579
  return e ?? t;
2579
2580
  }
2580
- function nn(e, t) {
2581
- return `${tn(e, "md")}-${tn(t, "md")}`;
2581
+ function Qt(e, t) {
2582
+ return `${Zt(e, "md")}-${Zt(t, "md")}`;
2582
2583
  }
2583
- function rn(e) {
2584
+ function $t(e) {
2584
2585
  let [t, n] = e.split("-");
2585
2586
  return {
2586
- width: t && en(t) ? t : "md",
2587
- length: n && en(n) ? n : "md"
2587
+ width: t && Xt(t) ? t : "md",
2588
+ length: n && Xt(n) ? n : "md"
2588
2589
  };
2589
2590
  }
2590
- var an = {
2591
- [A.strokeColor]: {
2591
+ var en = {
2592
+ [B.strokeColor]: {
2592
2593
  read: (e) => e.strokeColor,
2593
2594
  write: (e, t) => {
2594
2595
  e.strokeColor = String(t);
2595
2596
  },
2596
- selectionDef: A.strokeColor
2597
+ selectionDef: B.strokeColor
2597
2598
  },
2598
- [A.strokeWidth]: {
2599
+ [B.strokeWidth]: {
2599
2600
  read: (e) => e.strokeWidth,
2600
2601
  write: (e, t) => {
2601
2602
  e.strokeWidth = Number(t);
2602
2603
  },
2603
- selectionDef: A.strokeWidth
2604
+ selectionDef: B.strokeWidth
2604
2605
  },
2605
- [A.strokeStyle]: {
2606
+ [B.strokeStyle]: {
2606
2607
  read: (e) => e.strokeDasharray ?? "",
2607
2608
  write: (e, t) => {
2608
2609
  e.strokeDasharray = String(t);
2609
2610
  },
2610
- selectionDef: A.strokeStyle
2611
+ selectionDef: B.strokeStyle
2611
2612
  },
2612
- [A.strokeLinecap]: {
2613
+ [B.strokeLinecap]: {
2613
2614
  read: (e) => e.strokeLinecap ?? "butt",
2614
2615
  write: (e, t) => {
2615
2616
  e.strokeLinecap = t;
2616
2617
  },
2617
- selectionDef: A.strokeLinecap
2618
+ selectionDef: B.strokeLinecap
2618
2619
  },
2619
- [A.fillColor]: {
2620
+ [B.fillColor]: {
2620
2621
  read: (e) => e.fillColor,
2621
2622
  write: (e, t) => {
2622
2623
  e.fillColor = String(t);
2623
2624
  },
2624
- selectionDef: A.fillColor
2625
+ selectionDef: B.fillColor
2625
2626
  },
2626
- [A.fontSize]: {
2627
+ [B.fontSize]: {
2627
2628
  read: (e) => e.fontSize,
2628
2629
  write: (e, t) => {
2629
2630
  e.fontSize = Number(t);
2630
2631
  },
2631
- selectionDef: A.fontSize
2632
+ selectionDef: B.fontSize
2632
2633
  },
2633
- [A.fontFamily]: {
2634
- read: (e) => f(e.fontFamily),
2634
+ [B.fontFamily]: {
2635
+ read: (e) => S(e.fontFamily),
2635
2636
  write: (e, t) => {
2636
- e.fontFamily = f(String(t));
2637
+ e.fontFamily = S(String(t));
2637
2638
  },
2638
- selectionDef: A.fontFamily
2639
+ selectionDef: B.fontFamily
2639
2640
  },
2640
- [A.textAnchor]: {
2641
+ [B.textAnchor]: {
2641
2642
  read: (e) => e.textAnchor ?? "start",
2642
2643
  write: (e, t) => {
2643
2644
  e.textAnchor = t;
2644
2645
  },
2645
- selectionDef: A.textAnchor
2646
+ selectionDef: B.textAnchor
2646
2647
  },
2647
- [A.textVerticalAnchor]: {
2648
+ [B.textVerticalAnchor]: {
2648
2649
  read: (e) => e.textVerticalAnchor ?? "top",
2649
2650
  write: (e, t) => {
2650
2651
  e.textVerticalAnchor = t;
2651
2652
  },
2652
- selectionDef: A.textVerticalAnchor
2653
+ selectionDef: B.textVerticalAnchor
2653
2654
  },
2654
- [A.arrowStartShape]: {
2655
+ [B.arrowStartShape]: {
2655
2656
  read: (e) => e.arrowHeadStart ?? "none",
2656
2657
  write: (e, t) => {
2657
2658
  e.arrowHeadStart = t;
2658
2659
  },
2659
- selectionDef: A.arrowStartShape
2660
+ selectionDef: B.arrowStartShape
2660
2661
  },
2661
- [A.arrowEndShape]: {
2662
+ [B.arrowEndShape]: {
2662
2663
  read: (e) => e.arrowHeadEnd ?? "triangle",
2663
2664
  write: (e, t) => {
2664
2665
  e.arrowHeadEnd = t;
2665
2666
  },
2666
- selectionDef: A.arrowEndShape
2667
+ selectionDef: B.arrowEndShape
2667
2668
  },
2668
- [A.arrowStartSize]: {
2669
- read: (e) => nn(e.arrowWidthStart, e.arrowLengthStart),
2669
+ [B.arrowStartSize]: {
2670
+ read: (e) => Qt(e.arrowWidthStart, e.arrowLengthStart),
2670
2671
  write: (e, t) => {
2671
- let { width: n, length: r } = rn(String(t));
2672
+ let { width: n, length: r } = $t(String(t));
2672
2673
  e.arrowWidthStart = n, e.arrowLengthStart = r;
2673
2674
  },
2674
- selectionDef: A.arrowStartSize
2675
+ selectionDef: B.arrowStartSize
2675
2676
  },
2676
- [A.arrowEndSize]: {
2677
- read: (e) => nn(e.arrowWidthEnd, e.arrowLengthEnd),
2677
+ [B.arrowEndSize]: {
2678
+ read: (e) => Qt(e.arrowWidthEnd, e.arrowLengthEnd),
2678
2679
  write: (e, t) => {
2679
- let { width: n, length: r } = rn(String(t));
2680
+ let { width: n, length: r } = $t(String(t));
2680
2681
  e.arrowWidthEnd = n, e.arrowLengthEnd = r;
2681
2682
  },
2682
- selectionDef: A.arrowEndSize
2683
+ selectionDef: B.arrowEndSize
2683
2684
  },
2684
2685
  "tool.typeChips": {
2685
2686
  read: (e, t) => {
2686
- let n = Jt[t]?.variantField;
2687
+ let n = Wt[t]?.variantField;
2687
2688
  if (n) return e[n];
2688
2689
  },
2689
2690
  write: (e, t, n) => {
2690
- let r = Jt[n]?.variantField;
2691
+ let r = Wt[n]?.variantField;
2691
2692
  r && (e[r] = t);
2692
2693
  },
2693
2694
  selectionDef: null
2694
2695
  },
2695
2696
  "tool.transparencyPercent": {
2696
- read: (e) => Xt(e.strokeOpacity ?? 1, 1),
2697
+ read: (e) => Kt(e.strokeOpacity ?? 1, 1),
2697
2698
  write: (e, t) => {
2698
- e.strokeOpacity = Zt(Number(t));
2699
+ e.strokeOpacity = qt(Number(t));
2699
2700
  },
2700
- selectionDef: A.strokeOpacity
2701
+ selectionDef: B.strokeOpacity
2701
2702
  },
2702
2703
  "tool.fillTransparencyPercent": {
2703
- read: (e) => Xt(e.fillOpacity ?? .4, .4),
2704
+ read: (e) => Kt(e.fillOpacity ?? .4, .4),
2704
2705
  write: (e, t) => {
2705
- e.fillOpacity = Zt(Number(t));
2706
+ e.fillOpacity = qt(Number(t));
2706
2707
  },
2707
- selectionDef: A.fillOpacity
2708
+ selectionDef: B.fillOpacity
2708
2709
  },
2709
2710
  "tool.fillOpacityPercent": {
2710
- read: (e) => Qt(e.fillOpacity ?? 1, 1),
2711
+ read: (e) => Jt(e.fillOpacity ?? 1, 1),
2711
2712
  write: (e, t) => {
2712
- e.fillOpacity = $t(Number(t));
2713
+ e.fillOpacity = Yt(Number(t));
2713
2714
  },
2714
2715
  selectionDef: null
2715
2716
  },
@@ -2719,10 +2720,10 @@ var an = {
2719
2720
  selectionDef: null
2720
2721
  }
2721
2722
  };
2722
- function on(e) {
2723
- let t = an[e];
2723
+ function tn(e) {
2724
+ let t = en[e];
2724
2725
  if (!t?.selectionDef) return null;
2725
- let n = Tt[t.selectionDef];
2726
+ let n = wt[t.selectionDef];
2726
2727
  return n ? {
2727
2728
  label: n.label,
2728
2729
  options: n.options,
@@ -2733,22 +2734,22 @@ function on(e) {
2733
2734
  allowNone: n.allowNone
2734
2735
  } : null;
2735
2736
  }
2736
- var sn = [
2737
- A.strokeColor,
2738
- A.strokeWidth,
2739
- A.strokeStyle,
2740
- A.strokeLinecap,
2741
- A.fillColor,
2742
- A.fontSize,
2743
- A.fontFamily,
2744
- A.textAnchor,
2745
- A.textVerticalAnchor,
2746
- A.arrowStartShape,
2747
- A.arrowEndShape,
2748
- A.arrowStartSize,
2749
- A.arrowEndSize,
2750
- ...Ut
2751
- ], cn = {
2737
+ var nn = [
2738
+ B.strokeColor,
2739
+ B.strokeWidth,
2740
+ B.strokeStyle,
2741
+ B.strokeLinecap,
2742
+ B.fillColor,
2743
+ B.fontSize,
2744
+ B.fontFamily,
2745
+ B.textAnchor,
2746
+ B.textVerticalAnchor,
2747
+ B.arrowStartShape,
2748
+ B.arrowEndShape,
2749
+ B.arrowStartSize,
2750
+ B.arrowEndSize,
2751
+ ...Bt
2752
+ ], rn = {
2752
2753
  strokeColor: "stroke_color",
2753
2754
  fillColor: "fill_color",
2754
2755
  strokeWidth: "stroke_width",
@@ -2774,49 +2775,49 @@ var sn = [
2774
2775
  strokeOpacity: "stroke_opacity",
2775
2776
  strokeLinecap: "stroke_linecap",
2776
2777
  strokeLinejoin: "stroke_linejoin"
2777
- }, ln = (() => {
2778
+ }, an = (() => {
2778
2779
  let e = {};
2779
- for (let [t, n] of Object.entries(cn)) e[n] = t;
2780
+ for (let [t, n] of Object.entries(rn)) e[n] = t;
2780
2781
  return e;
2781
2782
  })();
2782
- function un(e, t) {
2783
- return t === "camel" ? e : cn[e] ?? e;
2783
+ function on(e, t) {
2784
+ return t === "camel" ? e : rn[e] ?? e;
2784
2785
  }
2785
- function dn(e, t, n) {
2786
+ function sn(e, t, n) {
2786
2787
  if (t === "camel") return e in n ? e : null;
2787
- let r = cn[e];
2788
+ let r = rn[e];
2788
2789
  return r !== void 0 && r in n ? r : null;
2789
2790
  }
2790
- function fn(e, t, n) {
2791
+ function cn(e, t, n) {
2791
2792
  let r = {};
2792
2793
  for (let i of t) {
2793
2794
  let t = e[i];
2794
- t !== void 0 && (r[un(i, n)] = t);
2795
+ t !== void 0 && (r[on(i, n)] = t);
2795
2796
  }
2796
2797
  return r;
2797
2798
  }
2798
- function pn(e, t, n) {
2799
+ function ln(e, t, n) {
2799
2800
  let r = {};
2800
2801
  for (let i of t) {
2801
- let t = dn(i, n, e);
2802
+ let t = sn(i, n, e);
2802
2803
  if (t === null) continue;
2803
2804
  let a = e[t];
2804
2805
  a !== void 0 && a !== "" && (r[i] = a);
2805
2806
  }
2806
2807
  return r;
2807
2808
  }
2808
- function mn(e) {
2809
- return ln[e];
2809
+ function un(e) {
2810
+ return an[e];
2810
2811
  }
2811
2812
  //#endregion
2812
2813
  //#region src/editor/tool-style-reader.ts
2813
- function hn(e) {
2814
+ function dn(e) {
2814
2815
  if (e.tagName.toLowerCase() !== "g" || e.getAttribute("data-type") !== "freehand") return e;
2815
2816
  let t = e.querySelectorAll(":scope > path");
2816
2817
  return t.length === 0 ? e : t[t.length - 1];
2817
2818
  }
2818
- function gn(e, t) {
2819
- let n = hn(e), r = n.getAttribute("stroke");
2819
+ function fn(e, t) {
2820
+ let n = dn(e), r = n.getAttribute("stroke");
2820
2821
  r && (t.strokeColor = r);
2821
2822
  let i = n.getAttribute("fill");
2822
2823
  i && (t.fillColor = i);
@@ -2835,22 +2836,22 @@ function gn(e, t) {
2835
2836
  }
2836
2837
  //#endregion
2837
2838
  //#region src/editor/viewport-math.ts
2838
- var _n = .1, vn = 5, yn = 40;
2839
- function bn(e, t = _n, n = 5) {
2839
+ var pn = .1, mn = 5, hn = 40;
2840
+ function gn(e, t = pn, n = 5) {
2840
2841
  return Math.max(t, Math.min(e, n));
2841
2842
  }
2842
- function xn(e, t, n, r, i = 40, a = 1) {
2843
+ function _n(e, t, n, r, i = 40, a = 1) {
2843
2844
  if (e <= 0 || t <= 0) return 0;
2844
2845
  let o = n - i, s = r - i;
2845
2846
  return o <= 0 || s <= 0 ? 0 : Math.min(o / e, s / t, a);
2846
2847
  }
2847
- function Sn(e, t, n) {
2848
+ function vn(e, t, n) {
2848
2849
  return {
2849
2850
  width: Math.round(e * n),
2850
2851
  height: Math.round(t * n)
2851
2852
  };
2852
2853
  }
2853
- function Cn(e, t, n) {
2854
+ function yn(e, t, n) {
2854
2855
  let [r, i, a, o, s, c] = e, l = r * o - i * a;
2855
2856
  if (l === 0) throw Error("applyInverseAffine: matrix is singular");
2856
2857
  return {
@@ -2859,1378 +2860,193 @@ function Cn(e, t, n) {
2859
2860
  };
2860
2861
  }
2861
2862
  //#endregion
2862
- //#region src/element-tree/types.ts
2863
- function wn(e) {
2864
- if (typeof e != "object" || !e) return !1;
2865
- let t = e;
2866
- return !(t.version !== 1 || typeof t.source != "object" || t.source === null || typeof t.viewport != "object" || t.viewport === null || typeof t.root != "object" || t.root === null);
2867
- }
2868
- //#endregion
2869
- //#region src/element-tree/json.ts
2870
- function Tn(e, t = {}) {
2871
- let n = t.compact ? void 0 : 2;
2872
- return JSON.stringify(e, En, n);
2873
- }
2874
- function En(e, t) {
2875
- if (!(Array.isArray(t) && t.length === 0) && !(typeof t == "object" && t && !Array.isArray(t) && Object.keys(t).length === 0)) return t;
2876
- }
2877
- function Dn(e) {
2878
- let t;
2879
- try {
2880
- t = JSON.parse(e);
2881
- } catch (e) {
2882
- throw Error(`ElementTree JSON parse failed: ${e instanceof Error ? e.message : String(e)}`);
2883
- }
2884
- return On(t);
2885
- }
2886
- function On(e) {
2887
- if (!wn(e)) throw Error("ElementTree payload missing required top-level keys (version, source, viewport, root)");
2888
- let t = e;
2889
- return kn(t.source), An(t.viewport), jn(t.root, "root"), t;
2890
- }
2891
- function kn(e) {
2892
- if (typeof e.kind != "string" || e.kind.length === 0) throw Error("ElementTree.source.kind must be a non-empty string");
2893
- if (typeof e.capturedAt != "string" || e.capturedAt.length === 0) throw Error("ElementTree.source.capturedAt must be a non-empty ISO 8601 string");
2894
- if (e.agent !== void 0 && typeof e.agent != "string") throw Error("ElementTree.source.agent, when present, must be a string");
2895
- if (e.url !== void 0 && typeof e.url != "string") throw Error("ElementTree.source.url, when present, must be a string");
2896
- }
2897
- function An(e) {
2898
- if (typeof e.width != "number" || !Number.isFinite(e.width)) throw Error("ElementTree.viewport.width must be a finite number");
2899
- if (typeof e.height != "number" || !Number.isFinite(e.height)) throw Error("ElementTree.viewport.height must be a finite number");
2900
- if (typeof e.scale != "number" || !Number.isFinite(e.scale)) throw Error("ElementTree.viewport.scale must be a finite number");
2901
- }
2902
- function jn(e, t) {
2903
- if (typeof e != "object" || !e) throw Error(`ElementTree node at ${t} is not an object`);
2904
- let n = e;
2905
- if (typeof n.role != "string" || n.role.length === 0) throw Error(`ElementTree node at ${t} missing required role`);
2906
- if (typeof n.ref != "string" || !/^e\d+$/.test(n.ref)) throw Error(`ElementTree node at ${t} has invalid ref (expected "e<n>")`);
2907
- if (n.name !== void 0 && typeof n.name != "string") throw Error(`ElementTree node at ${t} has non-string name`);
2908
- if (n.text !== void 0 && typeof n.text != "string") throw Error(`ElementTree node at ${t} has non-string text`);
2909
- if (n.bbox !== void 0) {
2910
- let e = n.bbox;
2911
- for (let n of [
2912
- "x",
2913
- "y",
2914
- "width",
2915
- "height"
2916
- ]) if (typeof e[n] != "number" || !Number.isFinite(e[n])) throw Error(`ElementTree node at ${t} bbox.${n} must be a finite number`);
2917
- }
2918
- if (n.states !== void 0) {
2919
- if (!Array.isArray(n.states)) throw Error(`ElementTree node at ${t} states must be an array`);
2920
- for (let [e, r] of n.states.entries()) if (typeof r != "string") throw Error(`ElementTree node at ${t} states[${e}] must be a string`);
2921
- }
2922
- if (n.attributes !== void 0) {
2923
- if (typeof n.attributes != "object" || n.attributes === null) throw Error(`ElementTree node at ${t} attributes must be an object`);
2924
- for (let [e, r] of Object.entries(n.attributes)) if (typeof r != "string") throw Error(`ElementTree node at ${t} attributes[${e}] must be a string (got ${typeof r})`);
2925
- }
2926
- if (n.children !== void 0) {
2927
- if (!Array.isArray(n.children)) throw Error(`ElementTree node at ${t} children must be an array`);
2928
- for (let [e, r] of n.children.entries()) jn(r, `${t}.children[${e}]`);
2929
- }
2930
- }
2931
- //#endregion
2932
- //#region src/element-tree/walk.ts
2933
- function Mn(e, t) {
2934
- Nn(e.root, [], t);
2935
- }
2936
- function Nn(e, t, n) {
2937
- if (n(e, t) === !1) return !1;
2938
- if (!e.children) return !0;
2939
- let r = [...t, e];
2940
- for (let t of e.children) if (!Nn(t, r, n)) return !1;
2941
- return !0;
2942
- }
2943
- function Pn(e, t) {
2944
- let n = null;
2945
- return Mn(e, (e) => {
2946
- if (e.ref === t) return n = e, !1;
2947
- }), n;
2948
- }
2949
- function Fn(e, t) {
2950
- let n = [];
2951
- return !t.role && !t.name || Mn(e, (e) => {
2952
- t.role !== void 0 && e.role !== t.role || t.name !== void 0 && e.name !== t.name || n.push(e);
2953
- }), n;
2954
- }
2955
- function In(e) {
2956
- let t = [];
2957
- return Mn(e, (e) => {
2958
- t.push(e);
2959
- }), t;
2960
- }
2961
- //#endregion
2962
- //#region ../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
2963
- function Ln(e) {
2964
- return e == null;
2965
- }
2966
- function Rn(e) {
2967
- return typeof e == "object" && !!e;
2968
- }
2969
- function zn(e) {
2970
- return Array.isArray(e) ? e : Ln(e) ? [] : [e];
2971
- }
2972
- function Bn(e, t) {
2973
- var n, r, i, a;
2974
- if (t) for (a = Object.keys(t), n = 0, r = a.length; n < r; n += 1) i = a[n], e[i] = t[i];
2975
- return e;
2976
- }
2977
- function Vn(e, t) {
2978
- var n = "", r;
2979
- for (r = 0; r < t; r += 1) n += e;
2980
- return n;
2981
- }
2982
- function Hn(e) {
2983
- return e === 0 && 1 / e == -Infinity;
2984
- }
2985
- var F = {
2986
- isNothing: Ln,
2987
- isObject: Rn,
2988
- toArray: zn,
2989
- repeat: Vn,
2990
- isNegativeZero: Hn,
2991
- extend: Bn
2992
- };
2993
- function Un(e, t) {
2994
- var n = "", r = e.reason || "(unknown reason)";
2995
- return e.mark ? (e.mark.name && (n += "in \"" + e.mark.name + "\" "), n += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !t && e.mark.snippet && (n += "\n\n" + e.mark.snippet), r + " " + n) : r;
2996
- }
2997
- function Wn(e, t) {
2998
- Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = t, this.message = Un(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = (/* @__PURE__ */ Error()).stack || "";
2999
- }
3000
- Wn.prototype = Object.create(Error.prototype), Wn.prototype.constructor = Wn, Wn.prototype.toString = function(e) {
3001
- return this.name + ": " + Un(this, e);
3002
- };
3003
- var I = Wn;
3004
- function Gn(e, t, n, r, i) {
3005
- var a = "", o = "", s = Math.floor(i / 2) - 1;
3006
- return r - t > s && (a = " ... ", t = r - s + a.length), n - r > s && (o = " ...", n = r + s - o.length), {
3007
- str: a + e.slice(t, n).replace(/\t/g, "→") + o,
3008
- pos: r - t + a.length
3009
- };
3010
- }
3011
- function Kn(e, t) {
3012
- return F.repeat(" ", t - e.length) + e;
3013
- }
3014
- function qn(e, t) {
3015
- if (t = Object.create(t || null), !e.buffer) return null;
3016
- t.maxLength ||= 79, typeof t.indent != "number" && (t.indent = 1), typeof t.linesBefore != "number" && (t.linesBefore = 3), typeof t.linesAfter != "number" && (t.linesAfter = 2);
3017
- for (var n = /\r?\n|\r|\0/g, r = [0], i = [], a, o = -1; a = n.exec(e.buffer);) i.push(a.index), r.push(a.index + a[0].length), e.position <= a.index && o < 0 && (o = r.length - 2);
3018
- o < 0 && (o = r.length - 1);
3019
- var s = "", c, l, u = Math.min(e.line + t.linesAfter, i.length).toString().length, d = t.maxLength - (t.indent + u + 3);
3020
- for (c = 1; c <= t.linesBefore && !(o - c < 0); c++) l = Gn(e.buffer, r[o - c], i[o - c], e.position - (r[o] - r[o - c]), d), s = F.repeat(" ", t.indent) + Kn((e.line - c + 1).toString(), u) + " | " + l.str + "\n" + s;
3021
- for (l = Gn(e.buffer, r[o], i[o], e.position, d), s += F.repeat(" ", t.indent) + Kn((e.line + 1).toString(), u) + " | " + l.str + "\n", s += F.repeat("-", t.indent + u + 3 + l.pos) + "^\n", c = 1; c <= t.linesAfter && !(o + c >= i.length); c++) l = Gn(e.buffer, r[o + c], i[o + c], e.position - (r[o] - r[o + c]), d), s += F.repeat(" ", t.indent) + Kn((e.line + c + 1).toString(), u) + " | " + l.str + "\n";
3022
- return s.replace(/\n$/, "");
3023
- }
3024
- var Jn = qn, Yn = [
3025
- "kind",
3026
- "multi",
3027
- "resolve",
3028
- "construct",
3029
- "instanceOf",
3030
- "predicate",
3031
- "represent",
3032
- "representName",
3033
- "defaultStyle",
3034
- "styleAliases"
3035
- ], Xn = [
3036
- "scalar",
3037
- "sequence",
3038
- "mapping"
3039
- ];
3040
- function Zn(e) {
3041
- var t = {};
3042
- return e !== null && Object.keys(e).forEach(function(n) {
3043
- e[n].forEach(function(e) {
3044
- t[String(e)] = n;
3045
- });
3046
- }), t;
3047
- }
3048
- function Qn(e, t) {
3049
- if (t ||= {}, Object.keys(t).forEach(function(t) {
3050
- if (Yn.indexOf(t) === -1) throw new I("Unknown option \"" + t + "\" is met in definition of \"" + e + "\" YAML type.");
3051
- }), this.options = t, this.tag = e, this.kind = t.kind || null, this.resolve = t.resolve || function() {
3052
- return !0;
3053
- }, this.construct = t.construct || function(e) {
3054
- return e;
3055
- }, this.instanceOf = t.instanceOf || null, this.predicate = t.predicate || null, this.represent = t.represent || null, this.representName = t.representName || null, this.defaultStyle = t.defaultStyle || null, this.multi = t.multi || !1, this.styleAliases = Zn(t.styleAliases || null), Xn.indexOf(this.kind) === -1) throw new I("Unknown kind \"" + this.kind + "\" is specified for \"" + e + "\" YAML type.");
3056
- }
3057
- var L = Qn;
3058
- function $n(e, t) {
3059
- var n = [];
3060
- return e[t].forEach(function(e) {
3061
- var t = n.length;
3062
- n.forEach(function(n, r) {
3063
- n.tag === e.tag && n.kind === e.kind && n.multi === e.multi && (t = r);
3064
- }), n[t] = e;
3065
- }), n;
3066
- }
3067
- function er() {
3068
- var e = {
3069
- scalar: {},
3070
- sequence: {},
3071
- mapping: {},
3072
- fallback: {},
3073
- multi: {
3074
- scalar: [],
3075
- sequence: [],
3076
- mapping: [],
3077
- fallback: []
3078
- }
3079
- }, t, n;
3080
- function r(t) {
3081
- t.multi ? (e.multi[t.kind].push(t), e.multi.fallback.push(t)) : e[t.kind][t.tag] = e.fallback[t.tag] = t;
3082
- }
3083
- for (t = 0, n = arguments.length; t < n; t += 1) arguments[t].forEach(r);
3084
- return e;
3085
- }
3086
- function tr(e) {
3087
- return this.extend(e);
3088
- }
3089
- tr.prototype.extend = function(e) {
3090
- var t = [], n = [];
3091
- if (e instanceof L) n.push(e);
3092
- else if (Array.isArray(e)) n = n.concat(e);
3093
- else if (e && (Array.isArray(e.implicit) || Array.isArray(e.explicit))) e.implicit && (t = t.concat(e.implicit)), e.explicit && (n = n.concat(e.explicit));
3094
- else throw new I("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
3095
- t.forEach(function(e) {
3096
- if (!(e instanceof L)) throw new I("Specified list of YAML types (or a single Type object) contains a non-Type object.");
3097
- if (e.loadKind && e.loadKind !== "scalar") throw new I("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
3098
- if (e.multi) throw new I("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
3099
- }), n.forEach(function(e) {
3100
- if (!(e instanceof L)) throw new I("Specified list of YAML types (or a single Type object) contains a non-Type object.");
3101
- });
3102
- var r = Object.create(tr.prototype);
3103
- return r.implicit = (this.implicit || []).concat(t), r.explicit = (this.explicit || []).concat(n), r.compiledImplicit = $n(r, "implicit"), r.compiledExplicit = $n(r, "explicit"), r.compiledTypeMap = er(r.compiledImplicit, r.compiledExplicit), r;
3104
- };
3105
- var nr = new tr({ explicit: [
3106
- new L("tag:yaml.org,2002:str", {
3107
- kind: "scalar",
3108
- construct: function(e) {
3109
- return e === null ? "" : e;
3110
- }
3111
- }),
3112
- new L("tag:yaml.org,2002:seq", {
3113
- kind: "sequence",
3114
- construct: function(e) {
3115
- return e === null ? [] : e;
3116
- }
3117
- }),
3118
- new L("tag:yaml.org,2002:map", {
3119
- kind: "mapping",
3120
- construct: function(e) {
3121
- return e === null ? {} : e;
3122
- }
3123
- })
3124
- ] });
3125
- function rr(e) {
3126
- if (e === null) return !0;
3127
- var t = e.length;
3128
- return t === 1 && e === "~" || t === 4 && (e === "null" || e === "Null" || e === "NULL");
3129
- }
3130
- function ir() {
3131
- return null;
3132
- }
3133
- function ar(e) {
3134
- return e === null;
3135
- }
3136
- var or = new L("tag:yaml.org,2002:null", {
3137
- kind: "scalar",
3138
- resolve: rr,
3139
- construct: ir,
3140
- predicate: ar,
3141
- represent: {
3142
- canonical: function() {
3143
- return "~";
3144
- },
3145
- lowercase: function() {
3146
- return "null";
3147
- },
3148
- uppercase: function() {
3149
- return "NULL";
3150
- },
3151
- camelcase: function() {
3152
- return "Null";
3153
- },
3154
- empty: function() {
3155
- return "";
3156
- }
3157
- },
3158
- defaultStyle: "lowercase"
3159
- });
3160
- function sr(e) {
3161
- if (e === null) return !1;
3162
- var t = e.length;
3163
- return t === 4 && (e === "true" || e === "True" || e === "TRUE") || t === 5 && (e === "false" || e === "False" || e === "FALSE");
3164
- }
3165
- function cr(e) {
3166
- return e === "true" || e === "True" || e === "TRUE";
3167
- }
3168
- function lr(e) {
3169
- return Object.prototype.toString.call(e) === "[object Boolean]";
3170
- }
3171
- var ur = new L("tag:yaml.org,2002:bool", {
3172
- kind: "scalar",
3173
- resolve: sr,
3174
- construct: cr,
3175
- predicate: lr,
3176
- represent: {
3177
- lowercase: function(e) {
3178
- return e ? "true" : "false";
3179
- },
3180
- uppercase: function(e) {
3181
- return e ? "TRUE" : "FALSE";
3182
- },
3183
- camelcase: function(e) {
3184
- return e ? "True" : "False";
3185
- }
3186
- },
3187
- defaultStyle: "lowercase"
3188
- });
3189
- function dr(e) {
3190
- return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
3191
- }
3192
- function fr(e) {
3193
- return 48 <= e && e <= 55;
3194
- }
3195
- function pr(e) {
3196
- return 48 <= e && e <= 57;
3197
- }
3198
- function mr(e) {
3199
- if (e === null) return !1;
3200
- var t = e.length, n = 0, r = !1, i;
3201
- if (!t) return !1;
3202
- if (i = e[n], (i === "-" || i === "+") && (i = e[++n]), i === "0") {
3203
- if (n + 1 === t) return !0;
3204
- if (i = e[++n], i === "b") {
3205
- for (n++; n < t; n++) if (i = e[n], i !== "_") {
3206
- if (i !== "0" && i !== "1") return !1;
3207
- r = !0;
3208
- }
3209
- return r && i !== "_";
3210
- }
3211
- if (i === "x") {
3212
- for (n++; n < t; n++) if (i = e[n], i !== "_") {
3213
- if (!dr(e.charCodeAt(n))) return !1;
3214
- r = !0;
3215
- }
3216
- return r && i !== "_";
3217
- }
3218
- if (i === "o") {
3219
- for (n++; n < t; n++) if (i = e[n], i !== "_") {
3220
- if (!fr(e.charCodeAt(n))) return !1;
3221
- r = !0;
3222
- }
3223
- return r && i !== "_";
3224
- }
3225
- }
3226
- if (i === "_") return !1;
3227
- for (; n < t; n++) if (i = e[n], i !== "_") {
3228
- if (!pr(e.charCodeAt(n))) return !1;
3229
- r = !0;
3230
- }
3231
- return !(!r || i === "_");
3232
- }
3233
- function hr(e) {
3234
- var t = e, n = 1, r;
3235
- if (t.indexOf("_") !== -1 && (t = t.replace(/_/g, "")), r = t[0], (r === "-" || r === "+") && (r === "-" && (n = -1), t = t.slice(1), r = t[0]), t === "0") return 0;
3236
- if (r === "0") {
3237
- if (t[1] === "b") return n * parseInt(t.slice(2), 2);
3238
- if (t[1] === "x") return n * parseInt(t.slice(2), 16);
3239
- if (t[1] === "o") return n * parseInt(t.slice(2), 8);
3240
- }
3241
- return n * parseInt(t, 10);
3242
- }
3243
- function gr(e) {
3244
- return Object.prototype.toString.call(e) === "[object Number]" && e % 1 == 0 && !F.isNegativeZero(e);
3245
- }
3246
- var _r = new L("tag:yaml.org,2002:int", {
3247
- kind: "scalar",
3248
- resolve: mr,
3249
- construct: hr,
3250
- predicate: gr,
3251
- represent: {
3252
- binary: function(e) {
3253
- return e >= 0 ? "0b" + e.toString(2) : "-0b" + e.toString(2).slice(1);
3254
- },
3255
- octal: function(e) {
3256
- return e >= 0 ? "0o" + e.toString(8) : "-0o" + e.toString(8).slice(1);
3257
- },
3258
- decimal: function(e) {
3259
- return e.toString(10);
3260
- },
3261
- hexadecimal: function(e) {
3262
- return e >= 0 ? "0x" + e.toString(16).toUpperCase() : "-0x" + e.toString(16).toUpperCase().slice(1);
3263
- }
3264
- },
3265
- defaultStyle: "decimal",
3266
- styleAliases: {
3267
- binary: [2, "bin"],
3268
- octal: [8, "oct"],
3269
- decimal: [10, "dec"],
3270
- hexadecimal: [16, "hex"]
3271
- }
3272
- }), vr = /* @__PURE__ */ RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
3273
- function yr(e) {
3274
- return !(e === null || !vr.test(e) || e[e.length - 1] === "_");
3275
- }
3276
- function br(e) {
3277
- var t = e.replace(/_/g, "").toLowerCase(), n = t[0] === "-" ? -1 : 1;
3278
- return "+-".indexOf(t[0]) >= 0 && (t = t.slice(1)), t === ".inf" ? n === 1 ? Infinity : -Infinity : t === ".nan" ? NaN : n * parseFloat(t, 10);
3279
- }
3280
- var xr = /^[-+]?[0-9]+e/;
3281
- function Sr(e, t) {
3282
- var n;
3283
- if (isNaN(e)) switch (t) {
3284
- case "lowercase": return ".nan";
3285
- case "uppercase": return ".NAN";
3286
- case "camelcase": return ".NaN";
3287
- }
3288
- else if (e === Infinity) switch (t) {
3289
- case "lowercase": return ".inf";
3290
- case "uppercase": return ".INF";
3291
- case "camelcase": return ".Inf";
3292
- }
3293
- else if (e === -Infinity) switch (t) {
3294
- case "lowercase": return "-.inf";
3295
- case "uppercase": return "-.INF";
3296
- case "camelcase": return "-.Inf";
3297
- }
3298
- else if (F.isNegativeZero(e)) return "-0.0";
3299
- return n = e.toString(10), xr.test(n) ? n.replace("e", ".e") : n;
3300
- }
3301
- function Cr(e) {
3302
- return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 != 0 || F.isNegativeZero(e));
3303
- }
3304
- var wr = new L("tag:yaml.org,2002:float", {
3305
- kind: "scalar",
3306
- resolve: yr,
3307
- construct: br,
3308
- predicate: Cr,
3309
- represent: Sr,
3310
- defaultStyle: "lowercase"
3311
- }), Tr = nr.extend({ implicit: [
3312
- or,
3313
- ur,
3314
- _r,
3315
- wr
3316
- ] }), Er = /* @__PURE__ */ RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"), Dr = /* @__PURE__ */ RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
3317
- function Or(e) {
3318
- return e === null ? !1 : Er.exec(e) !== null || Dr.exec(e) !== null;
3319
- }
3320
- function kr(e) {
3321
- var t, n, r, i, a, o, s, c = 0, l = null, u, d, f;
3322
- if (t = Er.exec(e), t === null && (t = Dr.exec(e)), t === null) throw Error("Date resolve error");
3323
- if (n = +t[1], r = t[2] - 1, i = +t[3], !t[4]) return new Date(Date.UTC(n, r, i));
3324
- if (a = +t[4], o = +t[5], s = +t[6], t[7]) {
3325
- for (c = t[7].slice(0, 3); c.length < 3;) c += "0";
3326
- c = +c;
3327
- }
3328
- return t[9] && (u = +t[10], d = +(t[11] || 0), l = (u * 60 + d) * 6e4, t[9] === "-" && (l = -l)), f = new Date(Date.UTC(n, r, i, a, o, s, c)), l && f.setTime(f.getTime() - l), f;
3329
- }
3330
- function Ar(e) {
3331
- return e.toISOString();
3332
- }
3333
- var jr = new L("tag:yaml.org,2002:timestamp", {
3334
- kind: "scalar",
3335
- resolve: Or,
3336
- construct: kr,
3337
- instanceOf: Date,
3338
- represent: Ar
3339
- });
3340
- function Mr(e) {
3341
- return e === "<<" || e === null;
3342
- }
3343
- var Nr = new L("tag:yaml.org,2002:merge", {
3344
- kind: "scalar",
3345
- resolve: Mr
3346
- }), Pr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
3347
- function Fr(e) {
3348
- if (e === null) return !1;
3349
- var t, n, r = 0, i = e.length, a = Pr;
3350
- for (n = 0; n < i; n++) if (t = a.indexOf(e.charAt(n)), !(t > 64)) {
3351
- if (t < 0) return !1;
3352
- r += 6;
3353
- }
3354
- return r % 8 == 0;
3355
- }
3356
- function Ir(e) {
3357
- var t, n, r = e.replace(/[\r\n=]/g, ""), i = r.length, a = Pr, o = 0, s = [];
3358
- for (t = 0; t < i; t++) t % 4 == 0 && t && (s.push(o >> 16 & 255), s.push(o >> 8 & 255), s.push(o & 255)), o = o << 6 | a.indexOf(r.charAt(t));
3359
- return n = i % 4 * 6, n === 0 ? (s.push(o >> 16 & 255), s.push(o >> 8 & 255), s.push(o & 255)) : n === 18 ? (s.push(o >> 10 & 255), s.push(o >> 2 & 255)) : n === 12 && s.push(o >> 4 & 255), new Uint8Array(s);
3360
- }
3361
- function Lr(e) {
3362
- var t = "", n = 0, r, i, a = e.length, o = Pr;
3363
- for (r = 0; r < a; r++) r % 3 == 0 && r && (t += o[n >> 18 & 63], t += o[n >> 12 & 63], t += o[n >> 6 & 63], t += o[n & 63]), n = (n << 8) + e[r];
3364
- return i = a % 3, i === 0 ? (t += o[n >> 18 & 63], t += o[n >> 12 & 63], t += o[n >> 6 & 63], t += o[n & 63]) : i === 2 ? (t += o[n >> 10 & 63], t += o[n >> 4 & 63], t += o[n << 2 & 63], t += o[64]) : i === 1 && (t += o[n >> 2 & 63], t += o[n << 4 & 63], t += o[64], t += o[64]), t;
3365
- }
3366
- function Rr(e) {
3367
- return Object.prototype.toString.call(e) === "[object Uint8Array]";
3368
- }
3369
- var zr = new L("tag:yaml.org,2002:binary", {
3370
- kind: "scalar",
3371
- resolve: Fr,
3372
- construct: Ir,
3373
- predicate: Rr,
3374
- represent: Lr
3375
- }), Br = Object.prototype.hasOwnProperty, Vr = Object.prototype.toString;
3376
- function Hr(e) {
3377
- if (e === null) return !0;
3378
- var t = [], n, r, i, a, o, s = e;
3379
- for (n = 0, r = s.length; n < r; n += 1) {
3380
- if (i = s[n], o = !1, Vr.call(i) !== "[object Object]") return !1;
3381
- for (a in i) if (Br.call(i, a)) if (!o) o = !0;
3382
- else return !1;
3383
- if (!o) return !1;
3384
- if (t.indexOf(a) === -1) t.push(a);
3385
- else return !1;
3386
- }
3387
- return !0;
3388
- }
3389
- function Ur(e) {
3390
- return e === null ? [] : e;
3391
- }
3392
- var Wr = new L("tag:yaml.org,2002:omap", {
3393
- kind: "sequence",
3394
- resolve: Hr,
3395
- construct: Ur
3396
- }), Gr = Object.prototype.toString;
3397
- function Kr(e) {
3398
- if (e === null) return !0;
3399
- var t, n, r, i, a, o = e;
3400
- for (a = Array(o.length), t = 0, n = o.length; t < n; t += 1) {
3401
- if (r = o[t], Gr.call(r) !== "[object Object]" || (i = Object.keys(r), i.length !== 1)) return !1;
3402
- a[t] = [i[0], r[i[0]]];
3403
- }
3404
- return !0;
3405
- }
3406
- function qr(e) {
3407
- if (e === null) return [];
3408
- var t, n, r, i, a, o = e;
3409
- for (a = Array(o.length), t = 0, n = o.length; t < n; t += 1) r = o[t], i = Object.keys(r), a[t] = [i[0], r[i[0]]];
3410
- return a;
3411
- }
3412
- var Jr = new L("tag:yaml.org,2002:pairs", {
3413
- kind: "sequence",
3414
- resolve: Kr,
3415
- construct: qr
3416
- }), Yr = Object.prototype.hasOwnProperty;
3417
- function Xr(e) {
3418
- if (e === null) return !0;
3419
- var t, n = e;
3420
- for (t in n) if (Yr.call(n, t) && n[t] !== null) return !1;
3421
- return !0;
3422
- }
3423
- function Zr(e) {
3424
- return e === null ? {} : e;
3425
- }
3426
- var Qr = new L("tag:yaml.org,2002:set", {
3427
- kind: "mapping",
3428
- resolve: Xr,
3429
- construct: Zr
3430
- }), $r = Tr.extend({
3431
- implicit: [jr, Nr],
3432
- explicit: [
3433
- zr,
3434
- Wr,
3435
- Jr,
3436
- Qr
3437
- ]
3438
- }), R = Object.prototype.hasOwnProperty, ei = 1, ti = 2, ni = 3, ri = 4, ii = 1, ai = 2, oi = 3, si = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, ci = /[\x85\u2028\u2029]/, li = /[,\[\]\{\}]/, ui = /^(?:!|!!|![a-z\-]+!)$/i, di = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
3439
- function fi(e) {
3440
- return Object.prototype.toString.call(e);
3441
- }
3442
- function z(e) {
3443
- return e === 10 || e === 13;
3444
- }
3445
- function B(e) {
3446
- return e === 9 || e === 32;
3447
- }
3448
- function V(e) {
3449
- return e === 9 || e === 32 || e === 10 || e === 13;
3450
- }
3451
- function H(e) {
3452
- return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
3453
- }
3454
- function pi(e) {
3455
- var t;
3456
- return 48 <= e && e <= 57 ? e - 48 : (t = e | 32, 97 <= t && t <= 102 ? t - 97 + 10 : -1);
3457
- }
3458
- function mi(e) {
3459
- return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
3460
- }
3461
- function hi(e) {
3462
- return 48 <= e && e <= 57 ? e - 48 : -1;
3463
- }
3464
- function gi(e) {
3465
- return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? "\n" : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? "\"" : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "…" : e === 95 ? "\xA0" : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
3466
- }
3467
- function _i(e) {
3468
- return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode((e - 65536 >> 10) + 55296, (e - 65536 & 1023) + 56320);
3469
- }
3470
- function vi(e, t, n) {
3471
- t === "__proto__" ? Object.defineProperty(e, t, {
3472
- configurable: !0,
3473
- enumerable: !0,
3474
- writable: !0,
3475
- value: n
3476
- }) : e[t] = n;
3477
- }
3478
- for (var yi = Array(256), bi = Array(256), U = 0; U < 256; U++) yi[U] = +!!gi(U), bi[U] = gi(U);
3479
- function xi(e, t) {
3480
- this.input = e, this.filename = t.filename || null, this.schema = t.schema || $r, this.onWarning = t.onWarning || null, this.legacy = t.legacy || !1, this.json = t.json || !1, this.listener = t.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = e.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
3481
- }
3482
- function Si(e, t) {
3483
- var n = {
3484
- name: e.filename,
3485
- buffer: e.input.slice(0, -1),
3486
- position: e.position,
3487
- line: e.line,
3488
- column: e.position - e.lineStart
3489
- };
3490
- return n.snippet = Jn(n), new I(t, n);
3491
- }
3492
- function W(e, t) {
3493
- throw Si(e, t);
3494
- }
3495
- function Ci(e, t) {
3496
- e.onWarning && e.onWarning.call(null, Si(e, t));
3497
- }
3498
- var wi = {
3499
- YAML: function(e, t, n) {
3500
- var r, i, a;
3501
- e.version !== null && W(e, "duplication of %YAML directive"), n.length !== 1 && W(e, "YAML directive accepts exactly one argument"), r = /^([0-9]+)\.([0-9]+)$/.exec(n[0]), r === null && W(e, "ill-formed argument of the YAML directive"), i = parseInt(r[1], 10), a = parseInt(r[2], 10), i !== 1 && W(e, "unacceptable YAML version of the document"), e.version = n[0], e.checkLineBreaks = a < 2, a !== 1 && a !== 2 && Ci(e, "unsupported YAML version of the document");
3502
- },
3503
- TAG: function(e, t, n) {
3504
- var r, i;
3505
- n.length !== 2 && W(e, "TAG directive accepts exactly two arguments"), r = n[0], i = n[1], ui.test(r) || W(e, "ill-formed tag handle (first argument) of the TAG directive"), R.call(e.tagMap, r) && W(e, "there is a previously declared suffix for \"" + r + "\" tag handle"), di.test(i) || W(e, "ill-formed tag prefix (second argument) of the TAG directive");
3506
- try {
3507
- i = decodeURIComponent(i);
3508
- } catch {
3509
- W(e, "tag prefix is malformed: " + i);
3510
- }
3511
- e.tagMap[r] = i;
3512
- }
3513
- };
3514
- function G(e, t, n, r) {
3515
- var i, a, o, s;
3516
- if (t < n) {
3517
- if (s = e.input.slice(t, n), r) for (i = 0, a = s.length; i < a; i += 1) o = s.charCodeAt(i), o === 9 || 32 <= o && o <= 1114111 || W(e, "expected valid JSON character");
3518
- else si.test(s) && W(e, "the stream contains non-printable characters");
3519
- e.result += s;
3520
- }
3521
- }
3522
- function Ti(e, t, n, r) {
3523
- var i, a, o, s;
3524
- for (F.isObject(n) || W(e, "cannot merge mappings; the provided source object is unacceptable"), i = Object.keys(n), o = 0, s = i.length; o < s; o += 1) a = i[o], R.call(t, a) || (vi(t, a, n[a]), r[a] = !0);
3525
- }
3526
- function K(e, t, n, r, i, a, o, s, c) {
3527
- var l, u;
3528
- if (Array.isArray(i)) for (i = Array.prototype.slice.call(i), l = 0, u = i.length; l < u; l += 1) Array.isArray(i[l]) && W(e, "nested arrays are not supported inside keys"), typeof i == "object" && fi(i[l]) === "[object Object]" && (i[l] = "[object Object]");
3529
- if (typeof i == "object" && fi(i) === "[object Object]" && (i = "[object Object]"), i = String(i), t === null && (t = {}), r === "tag:yaml.org,2002:merge") if (Array.isArray(a)) for (l = 0, u = a.length; l < u; l += 1) Ti(e, t, a[l], n);
3530
- else Ti(e, t, a, n);
3531
- else !e.json && !R.call(n, i) && R.call(t, i) && (e.line = o || e.line, e.lineStart = s || e.lineStart, e.position = c || e.position, W(e, "duplicated mapping key")), vi(t, i, a), delete n[i];
3532
- return t;
3533
- }
3534
- function Ei(e) {
3535
- var t = e.input.charCodeAt(e.position);
3536
- t === 10 ? e.position++ : t === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : W(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
3537
- }
3538
- function q(e, t, n) {
3539
- for (var r = 0, i = e.input.charCodeAt(e.position); i !== 0;) {
3540
- for (; B(i);) i === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), i = e.input.charCodeAt(++e.position);
3541
- if (t && i === 35) do
3542
- i = e.input.charCodeAt(++e.position);
3543
- while (i !== 10 && i !== 13 && i !== 0);
3544
- if (z(i)) for (Ei(e), i = e.input.charCodeAt(e.position), r++, e.lineIndent = 0; i === 32;) e.lineIndent++, i = e.input.charCodeAt(++e.position);
3545
- else break;
3546
- }
3547
- return n !== -1 && r !== 0 && e.lineIndent < n && Ci(e, "deficient indentation"), r;
3548
- }
3549
- function Di(e) {
3550
- var t = e.position, n = e.input.charCodeAt(t);
3551
- return !!((n === 45 || n === 46) && n === e.input.charCodeAt(t + 1) && n === e.input.charCodeAt(t + 2) && (t += 3, n = e.input.charCodeAt(t), n === 0 || V(n)));
3552
- }
3553
- function Oi(e, t) {
3554
- t === 1 ? e.result += " " : t > 1 && (e.result += F.repeat("\n", t - 1));
3555
- }
3556
- function ki(e, t, n) {
3557
- var r, i, a, o, s, c, l, u, d = e.kind, f = e.result, p = e.input.charCodeAt(e.position);
3558
- if (V(p) || H(p) || p === 35 || p === 38 || p === 42 || p === 33 || p === 124 || p === 62 || p === 39 || p === 34 || p === 37 || p === 64 || p === 96 || (p === 63 || p === 45) && (i = e.input.charCodeAt(e.position + 1), V(i) || n && H(i))) return !1;
3559
- for (e.kind = "scalar", e.result = "", a = o = e.position, s = !1; p !== 0;) {
3560
- if (p === 58) {
3561
- if (i = e.input.charCodeAt(e.position + 1), V(i) || n && H(i)) break;
3562
- } else if (p === 35) {
3563
- if (r = e.input.charCodeAt(e.position - 1), V(r)) break;
3564
- } else if (e.position === e.lineStart && Di(e) || n && H(p)) break;
3565
- else if (z(p)) if (c = e.line, l = e.lineStart, u = e.lineIndent, q(e, !1, -1), e.lineIndent >= t) {
3566
- s = !0, p = e.input.charCodeAt(e.position);
3567
- continue;
3568
- } else {
3569
- e.position = o, e.line = c, e.lineStart = l, e.lineIndent = u;
3570
- break;
3571
- }
3572
- s &&= (G(e, a, o, !1), Oi(e, e.line - c), a = o = e.position, !1), B(p) || (o = e.position + 1), p = e.input.charCodeAt(++e.position);
3573
- }
3574
- return G(e, a, o, !1), e.result ? !0 : (e.kind = d, e.result = f, !1);
3575
- }
3576
- function Ai(e, t) {
3577
- var n = e.input.charCodeAt(e.position), r, i;
3578
- if (n !== 39) return !1;
3579
- for (e.kind = "scalar", e.result = "", e.position++, r = i = e.position; (n = e.input.charCodeAt(e.position)) !== 0;) if (n === 39) if (G(e, r, e.position, !0), n = e.input.charCodeAt(++e.position), n === 39) r = e.position, e.position++, i = e.position;
3580
- else return !0;
3581
- else z(n) ? (G(e, r, i, !0), Oi(e, q(e, !1, t)), r = i = e.position) : e.position === e.lineStart && Di(e) ? W(e, "unexpected end of the document within a single quoted scalar") : (e.position++, i = e.position);
3582
- W(e, "unexpected end of the stream within a single quoted scalar");
3583
- }
3584
- function ji(e, t) {
3585
- var n, r, i, a, o, s = e.input.charCodeAt(e.position);
3586
- if (s !== 34) return !1;
3587
- for (e.kind = "scalar", e.result = "", e.position++, n = r = e.position; (s = e.input.charCodeAt(e.position)) !== 0;) if (s === 34) return G(e, n, e.position, !0), e.position++, !0;
3588
- else if (s === 92) {
3589
- if (G(e, n, e.position, !0), s = e.input.charCodeAt(++e.position), z(s)) q(e, !1, t);
3590
- else if (s < 256 && yi[s]) e.result += bi[s], e.position++;
3591
- else if ((o = mi(s)) > 0) {
3592
- for (i = o, a = 0; i > 0; i--) s = e.input.charCodeAt(++e.position), (o = pi(s)) >= 0 ? a = (a << 4) + o : W(e, "expected hexadecimal character");
3593
- e.result += _i(a), e.position++;
3594
- } else W(e, "unknown escape sequence");
3595
- n = r = e.position;
3596
- } else z(s) ? (G(e, n, r, !0), Oi(e, q(e, !1, t)), n = r = e.position) : e.position === e.lineStart && Di(e) ? W(e, "unexpected end of the document within a double quoted scalar") : (e.position++, r = e.position);
3597
- W(e, "unexpected end of the stream within a double quoted scalar");
3598
- }
3599
- function Mi(e, t) {
3600
- var n = !0, r, i, a, o = e.tag, s, c = e.anchor, l, u, d, f, p, m = Object.create(null), h, g, _, v = e.input.charCodeAt(e.position);
3601
- if (v === 91) u = 93, p = !1, s = [];
3602
- else if (v === 123) u = 125, p = !0, s = {};
3603
- else return !1;
3604
- for (e.anchor !== null && (e.anchorMap[e.anchor] = s), v = e.input.charCodeAt(++e.position); v !== 0;) {
3605
- if (q(e, !0, t), v = e.input.charCodeAt(e.position), v === u) return e.position++, e.tag = o, e.anchor = c, e.kind = p ? "mapping" : "sequence", e.result = s, !0;
3606
- n ? v === 44 && W(e, "expected the node content, but found ','") : W(e, "missed comma between flow collection entries"), g = h = _ = null, d = f = !1, v === 63 && (l = e.input.charCodeAt(e.position + 1), V(l) && (d = f = !0, e.position++, q(e, !0, t))), r = e.line, i = e.lineStart, a = e.position, J(e, t, ei, !1, !0), g = e.tag, h = e.result, q(e, !0, t), v = e.input.charCodeAt(e.position), (f || e.line === r) && v === 58 && (d = !0, v = e.input.charCodeAt(++e.position), q(e, !0, t), J(e, t, ei, !1, !0), _ = e.result), p ? K(e, s, m, g, h, _, r, i, a) : d ? s.push(K(e, null, m, g, h, _, r, i, a)) : s.push(h), q(e, !0, t), v = e.input.charCodeAt(e.position), v === 44 ? (n = !0, v = e.input.charCodeAt(++e.position)) : n = !1;
3607
- }
3608
- W(e, "unexpected end of the stream within a flow collection");
3609
- }
3610
- function Ni(e, t) {
3611
- var n, r, i = ii, a = !1, o = !1, s = t, c = 0, l = !1, u, d = e.input.charCodeAt(e.position);
3612
- if (d === 124) r = !1;
3613
- else if (d === 62) r = !0;
3614
- else return !1;
3615
- for (e.kind = "scalar", e.result = ""; d !== 0;) if (d = e.input.charCodeAt(++e.position), d === 43 || d === 45) ii === i ? i = d === 43 ? oi : ai : W(e, "repeat of a chomping mode identifier");
3616
- else if ((u = hi(d)) >= 0) u === 0 ? W(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : o ? W(e, "repeat of an indentation width identifier") : (s = t + u - 1, o = !0);
3617
- else break;
3618
- if (B(d)) {
3619
- do
3620
- d = e.input.charCodeAt(++e.position);
3621
- while (B(d));
3622
- if (d === 35) do
3623
- d = e.input.charCodeAt(++e.position);
3624
- while (!z(d) && d !== 0);
3625
- }
3626
- for (; d !== 0;) {
3627
- for (Ei(e), e.lineIndent = 0, d = e.input.charCodeAt(e.position); (!o || e.lineIndent < s) && d === 32;) e.lineIndent++, d = e.input.charCodeAt(++e.position);
3628
- if (!o && e.lineIndent > s && (s = e.lineIndent), z(d)) {
3629
- c++;
3630
- continue;
3631
- }
3632
- if (e.lineIndent < s) {
3633
- i === oi ? e.result += F.repeat("\n", a ? 1 + c : c) : i === ii && a && (e.result += "\n");
3634
- break;
3635
- }
3636
- for (r ? B(d) ? (l = !0, e.result += F.repeat("\n", a ? 1 + c : c)) : l ? (l = !1, e.result += F.repeat("\n", c + 1)) : c === 0 ? a && (e.result += " ") : e.result += F.repeat("\n", c) : e.result += F.repeat("\n", a ? 1 + c : c), a = !0, o = !0, c = 0, n = e.position; !z(d) && d !== 0;) d = e.input.charCodeAt(++e.position);
3637
- G(e, n, e.position, !1);
3638
- }
3639
- return !0;
3640
- }
3641
- function Pi(e, t) {
3642
- var n, r = e.tag, i = e.anchor, a = [], o, s = !1, c;
3643
- if (e.firstTabInLine !== -1) return !1;
3644
- for (e.anchor !== null && (e.anchorMap[e.anchor] = a), c = e.input.charCodeAt(e.position); c !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, W(e, "tab characters must not be used in indentation")), !(c !== 45 || (o = e.input.charCodeAt(e.position + 1), !V(o))));) {
3645
- if (s = !0, e.position++, q(e, !0, -1) && e.lineIndent <= t) {
3646
- a.push(null), c = e.input.charCodeAt(e.position);
3647
- continue;
3648
- }
3649
- if (n = e.line, J(e, t, ni, !1, !0), a.push(e.result), q(e, !0, -1), c = e.input.charCodeAt(e.position), (e.line === n || e.lineIndent > t) && c !== 0) W(e, "bad indentation of a sequence entry");
3650
- else if (e.lineIndent < t) break;
3651
- }
3652
- return s ? (e.tag = r, e.anchor = i, e.kind = "sequence", e.result = a, !0) : !1;
3653
- }
3654
- function Fi(e, t, n) {
3655
- var r, i, a, o, s, c, l = e.tag, u = e.anchor, d = {}, f = Object.create(null), p = null, m = null, h = null, g = !1, _ = !1, v;
3656
- if (e.firstTabInLine !== -1) return !1;
3657
- for (e.anchor !== null && (e.anchorMap[e.anchor] = d), v = e.input.charCodeAt(e.position); v !== 0;) {
3658
- if (!g && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, W(e, "tab characters must not be used in indentation")), r = e.input.charCodeAt(e.position + 1), a = e.line, (v === 63 || v === 58) && V(r)) v === 63 ? (g && (K(e, d, f, p, m, null, o, s, c), p = m = h = null), _ = !0, g = !0, i = !0) : g ? (g = !1, i = !0) : W(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, v = r;
3659
- else {
3660
- if (o = e.line, s = e.lineStart, c = e.position, !J(e, n, ti, !1, !0)) break;
3661
- if (e.line === a) {
3662
- for (v = e.input.charCodeAt(e.position); B(v);) v = e.input.charCodeAt(++e.position);
3663
- if (v === 58) v = e.input.charCodeAt(++e.position), V(v) || W(e, "a whitespace character is expected after the key-value separator within a block mapping"), g && (K(e, d, f, p, m, null, o, s, c), p = m = h = null), _ = !0, g = !1, i = !1, p = e.tag, m = e.result;
3664
- else if (_) W(e, "can not read an implicit mapping pair; a colon is missed");
3665
- else return e.tag = l, e.anchor = u, !0;
3666
- } else if (_) W(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
3667
- else return e.tag = l, e.anchor = u, !0;
3668
- }
3669
- if ((e.line === a || e.lineIndent > t) && (g && (o = e.line, s = e.lineStart, c = e.position), J(e, t, ri, !0, i) && (g ? m = e.result : h = e.result), g || (K(e, d, f, p, m, h, o, s, c), p = m = h = null), q(e, !0, -1), v = e.input.charCodeAt(e.position)), (e.line === a || e.lineIndent > t) && v !== 0) W(e, "bad indentation of a mapping entry");
3670
- else if (e.lineIndent < t) break;
3671
- }
3672
- return g && K(e, d, f, p, m, null, o, s, c), _ && (e.tag = l, e.anchor = u, e.kind = "mapping", e.result = d), _;
3673
- }
3674
- function Ii(e) {
3675
- var t, n = !1, r = !1, i, a, o = e.input.charCodeAt(e.position);
3676
- if (o !== 33) return !1;
3677
- if (e.tag !== null && W(e, "duplication of a tag property"), o = e.input.charCodeAt(++e.position), o === 60 ? (n = !0, o = e.input.charCodeAt(++e.position)) : o === 33 ? (r = !0, i = "!!", o = e.input.charCodeAt(++e.position)) : i = "!", t = e.position, n) {
3678
- do
3679
- o = e.input.charCodeAt(++e.position);
3680
- while (o !== 0 && o !== 62);
3681
- e.position < e.length ? (a = e.input.slice(t, e.position), o = e.input.charCodeAt(++e.position)) : W(e, "unexpected end of the stream within a verbatim tag");
3682
- } else {
3683
- for (; o !== 0 && !V(o);) o === 33 && (r ? W(e, "tag suffix cannot contain exclamation marks") : (i = e.input.slice(t - 1, e.position + 1), ui.test(i) || W(e, "named tag handle cannot contain such characters"), r = !0, t = e.position + 1)), o = e.input.charCodeAt(++e.position);
3684
- a = e.input.slice(t, e.position), li.test(a) && W(e, "tag suffix cannot contain flow indicator characters");
3685
- }
3686
- a && !di.test(a) && W(e, "tag name cannot contain such characters: " + a);
3687
- try {
3688
- a = decodeURIComponent(a);
3689
- } catch {
3690
- W(e, "tag name is malformed: " + a);
3691
- }
3692
- return n ? e.tag = a : R.call(e.tagMap, i) ? e.tag = e.tagMap[i] + a : i === "!" ? e.tag = "!" + a : i === "!!" ? e.tag = "tag:yaml.org,2002:" + a : W(e, "undeclared tag handle \"" + i + "\""), !0;
3693
- }
3694
- function Li(e) {
3695
- var t, n = e.input.charCodeAt(e.position);
3696
- if (n !== 38) return !1;
3697
- for (e.anchor !== null && W(e, "duplication of an anchor property"), n = e.input.charCodeAt(++e.position), t = e.position; n !== 0 && !V(n) && !H(n);) n = e.input.charCodeAt(++e.position);
3698
- return e.position === t && W(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(t, e.position), !0;
3699
- }
3700
- function Ri(e) {
3701
- var t, n, r = e.input.charCodeAt(e.position);
3702
- if (r !== 42) return !1;
3703
- for (r = e.input.charCodeAt(++e.position), t = e.position; r !== 0 && !V(r) && !H(r);) r = e.input.charCodeAt(++e.position);
3704
- return e.position === t && W(e, "name of an alias node must contain at least one character"), n = e.input.slice(t, e.position), R.call(e.anchorMap, n) || W(e, "unidentified alias \"" + n + "\""), e.result = e.anchorMap[n], q(e, !0, -1), !0;
3705
- }
3706
- function J(e, t, n, r, i) {
3707
- var a, o, s, c = 1, l = !1, u = !1, d, f, p, m, h, g;
3708
- if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, a = o = s = ri === n || ni === n, r && q(e, !0, -1) && (l = !0, e.lineIndent > t ? c = 1 : e.lineIndent === t ? c = 0 : e.lineIndent < t && (c = -1)), c === 1) for (; Ii(e) || Li(e);) q(e, !0, -1) ? (l = !0, s = a, e.lineIndent > t ? c = 1 : e.lineIndent === t ? c = 0 : e.lineIndent < t && (c = -1)) : s = !1;
3709
- if (s &&= l || i, (c === 1 || ri === n) && (h = ei === n || ti === n ? t : t + 1, g = e.position - e.lineStart, c === 1 ? s && (Pi(e, g) || Fi(e, g, h)) || Mi(e, h) ? u = !0 : (o && Ni(e, h) || Ai(e, h) || ji(e, h) ? u = !0 : Ri(e) ? (u = !0, (e.tag !== null || e.anchor !== null) && W(e, "alias node should not have any properties")) : ki(e, h, ei === n) && (u = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : c === 0 && (u = s && Pi(e, g))), e.tag === null) e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
3710
- else if (e.tag === "?") {
3711
- for (e.result !== null && e.kind !== "scalar" && W(e, "unacceptable node kind for !<?> tag; it should be \"scalar\", not \"" + e.kind + "\""), d = 0, f = e.implicitTypes.length; d < f; d += 1) if (m = e.implicitTypes[d], m.resolve(e.result)) {
3712
- e.result = m.construct(e.result), e.tag = m.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
3713
- break;
3714
- }
3715
- } else if (e.tag !== "!") {
3716
- if (R.call(e.typeMap[e.kind || "fallback"], e.tag)) m = e.typeMap[e.kind || "fallback"][e.tag];
3717
- else for (m = null, p = e.typeMap.multi[e.kind || "fallback"], d = 0, f = p.length; d < f; d += 1) if (e.tag.slice(0, p[d].tag.length) === p[d].tag) {
3718
- m = p[d];
3719
- break;
3720
- }
3721
- m || W(e, "unknown tag !<" + e.tag + ">"), e.result !== null && m.kind !== e.kind && W(e, "unacceptable node kind for !<" + e.tag + "> tag; it should be \"" + m.kind + "\", not \"" + e.kind + "\""), m.resolve(e.result, e.tag) ? (e.result = m.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : W(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
3722
- }
3723
- return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || u;
3724
- }
3725
- function zi(e) {
3726
- var t = e.position, n, r, i, a = !1, o;
3727
- for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = Object.create(null), e.anchorMap = Object.create(null); (o = e.input.charCodeAt(e.position)) !== 0 && (q(e, !0, -1), o = e.input.charCodeAt(e.position), !(e.lineIndent > 0 || o !== 37));) {
3728
- for (a = !0, o = e.input.charCodeAt(++e.position), n = e.position; o !== 0 && !V(o);) o = e.input.charCodeAt(++e.position);
3729
- for (r = e.input.slice(n, e.position), i = [], r.length < 1 && W(e, "directive name must not be less than one character in length"); o !== 0;) {
3730
- for (; B(o);) o = e.input.charCodeAt(++e.position);
3731
- if (o === 35) {
3732
- do
3733
- o = e.input.charCodeAt(++e.position);
3734
- while (o !== 0 && !z(o));
3735
- break;
3736
- }
3737
- if (z(o)) break;
3738
- for (n = e.position; o !== 0 && !V(o);) o = e.input.charCodeAt(++e.position);
3739
- i.push(e.input.slice(n, e.position));
3740
- }
3741
- o !== 0 && Ei(e), R.call(wi, r) ? wi[r](e, r, i) : Ci(e, "unknown document directive \"" + r + "\"");
3742
- }
3743
- if (q(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, q(e, !0, -1)) : a && W(e, "directives end mark is expected"), J(e, e.lineIndent - 1, ri, !1, !0), q(e, !0, -1), e.checkLineBreaks && ci.test(e.input.slice(t, e.position)) && Ci(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Di(e)) {
3744
- e.input.charCodeAt(e.position) === 46 && (e.position += 3, q(e, !0, -1));
3745
- return;
3746
- }
3747
- if (e.position < e.length - 1) W(e, "end of the stream or a document separator is expected");
3748
- else return;
3749
- }
3750
- function Bi(e, t) {
3751
- e = String(e), t ||= {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += "\n"), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
3752
- var n = new xi(e, t), r = e.indexOf("\0");
3753
- for (r !== -1 && (n.position = r, W(n, "null byte is not allowed in input")), n.input += "\0"; n.input.charCodeAt(n.position) === 32;) n.lineIndent += 1, n.position += 1;
3754
- for (; n.position < n.length - 1;) zi(n);
3755
- return n.documents;
3756
- }
3757
- function Vi(e, t, n) {
3758
- typeof t == "object" && t && n === void 0 && (n = t, t = null);
3759
- var r = Bi(e, n);
3760
- if (typeof t != "function") return r;
3761
- for (var i = 0, a = r.length; i < a; i += 1) t(r[i]);
3762
- }
3763
- function Hi(e, t) {
3764
- var n = Bi(e, t);
3765
- if (n.length !== 0) {
3766
- if (n.length === 1) return n[0];
3767
- throw new I("expected a single document in the stream, but found more");
3768
- }
3769
- }
3770
- var Ui = {
3771
- loadAll: Vi,
3772
- load: Hi
3773
- }, Wi = Object.prototype.toString, Gi = Object.prototype.hasOwnProperty, Ki = 65279, qi = 9, Ji = 10, Yi = 13, Xi = 32, Zi = 33, Qi = 34, $i = 35, ea = 37, ta = 38, na = 39, ra = 42, ia = 44, aa = 45, oa = 58, sa = 61, ca = 62, la = 63, ua = 64, da = 91, fa = 93, pa = 96, ma = 123, ha = 124, ga = 125, Y = {};
3774
- Y[0] = "\\0", Y[7] = "\\a", Y[8] = "\\b", Y[9] = "\\t", Y[10] = "\\n", Y[11] = "\\v", Y[12] = "\\f", Y[13] = "\\r", Y[27] = "\\e", Y[34] = "\\\"", Y[92] = "\\\\", Y[133] = "\\N", Y[160] = "\\_", Y[8232] = "\\L", Y[8233] = "\\P";
3775
- var _a = [
3776
- "y",
3777
- "Y",
3778
- "yes",
3779
- "Yes",
3780
- "YES",
3781
- "on",
3782
- "On",
3783
- "ON",
3784
- "n",
3785
- "N",
3786
- "no",
3787
- "No",
3788
- "NO",
3789
- "off",
3790
- "Off",
3791
- "OFF"
3792
- ], va = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
3793
- function ya(e, t) {
3794
- var n, r, i, a, o, s, c;
3795
- if (t === null) return {};
3796
- for (n = {}, r = Object.keys(t), i = 0, a = r.length; i < a; i += 1) o = r[i], s = String(t[o]), o.slice(0, 2) === "!!" && (o = "tag:yaml.org,2002:" + o.slice(2)), c = e.compiledTypeMap.fallback[o], c && Gi.call(c.styleAliases, s) && (s = c.styleAliases[s]), n[o] = s;
3797
- return n;
3798
- }
3799
- function ba(e) {
3800
- var t = e.toString(16).toUpperCase(), n, r;
3801
- if (e <= 255) n = "x", r = 2;
3802
- else if (e <= 65535) n = "u", r = 4;
3803
- else if (e <= 4294967295) n = "U", r = 8;
3804
- else throw new I("code point within a string may not be greater than 0xFFFFFFFF");
3805
- return "\\" + n + F.repeat("0", r - t.length) + t;
3806
- }
3807
- var xa = 1, Sa = 2;
3808
- function Ca(e) {
3809
- this.schema = e.schema || $r, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = F.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = ya(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === "\"" ? Sa : xa, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
3810
- }
3811
- function wa(e, t) {
3812
- for (var n = F.repeat(" ", t), r = 0, i = -1, a = "", o, s = e.length; r < s;) i = e.indexOf("\n", r), i === -1 ? (o = e.slice(r), r = s) : (o = e.slice(r, i + 1), r = i + 1), o.length && o !== "\n" && (a += n), a += o;
3813
- return a;
3814
- }
3815
- function Ta(e, t) {
3816
- return "\n" + F.repeat(" ", e.indent * t);
3817
- }
3818
- function Ea(e, t) {
3819
- var n, r, i;
3820
- for (n = 0, r = e.implicitTypes.length; n < r; n += 1) if (i = e.implicitTypes[n], i.resolve(t)) return !0;
3821
- return !1;
3822
- }
3823
- function Da(e) {
3824
- return e === Xi || e === qi;
3825
- }
3826
- function Oa(e) {
3827
- return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== Ki || 65536 <= e && e <= 1114111;
3828
- }
3829
- function ka(e) {
3830
- return Oa(e) && e !== Ki && e !== Yi && e !== Ji;
3831
- }
3832
- function Aa(e, t, n) {
3833
- var r = ka(e), i = r && !Da(e);
3834
- return (n ? r : r && e !== ia && e !== da && e !== fa && e !== ma && e !== ga) && e !== $i && !(t === oa && !i) || ka(t) && !Da(t) && e === $i || t === oa && i;
3835
- }
3836
- function ja(e) {
3837
- return Oa(e) && e !== Ki && !Da(e) && e !== aa && e !== la && e !== oa && e !== ia && e !== da && e !== fa && e !== ma && e !== ga && e !== $i && e !== ta && e !== ra && e !== Zi && e !== ha && e !== sa && e !== ca && e !== na && e !== Qi && e !== ea && e !== ua && e !== pa;
3838
- }
3839
- function Ma(e) {
3840
- return !Da(e) && e !== oa;
3841
- }
3842
- function Na(e, t) {
3843
- var n = e.charCodeAt(t), r;
3844
- return n >= 55296 && n <= 56319 && t + 1 < e.length && (r = e.charCodeAt(t + 1), r >= 56320 && r <= 57343) ? (n - 55296) * 1024 + r - 56320 + 65536 : n;
3845
- }
3846
- function Pa(e) {
3847
- return /^\n* /.test(e);
3848
- }
3849
- var Fa = 1, Ia = 2, La = 3, Ra = 4, X = 5;
3850
- function za(e, t, n, r, i, a, o, s) {
3851
- var c, l = 0, u = null, d = !1, f = !1, p = r !== -1, m = -1, h = ja(Na(e, 0)) && Ma(Na(e, e.length - 1));
3852
- if (t || o) for (c = 0; c < e.length; l >= 65536 ? c += 2 : c++) {
3853
- if (l = Na(e, c), !Oa(l)) return X;
3854
- h &&= Aa(l, u, s), u = l;
3855
- }
3856
- else {
3857
- for (c = 0; c < e.length; l >= 65536 ? c += 2 : c++) {
3858
- if (l = Na(e, c), l === Ji) d = !0, p && (f ||= c - m - 1 > r && e[m + 1] !== " ", m = c);
3859
- else if (!Oa(l)) return X;
3860
- h &&= Aa(l, u, s), u = l;
3861
- }
3862
- f ||= p && c - m - 1 > r && e[m + 1] !== " ";
3863
- }
3864
- return !d && !f ? h && !o && !i(e) ? Fa : a === Sa ? X : Ia : n > 9 && Pa(e) ? X : o ? a === Sa ? X : Ia : f ? Ra : La;
3865
- }
3866
- function Ba(e, t, n, r, i) {
3867
- e.dump = function() {
3868
- if (t.length === 0) return e.quotingType === Sa ? "\"\"" : "''";
3869
- if (!e.noCompatMode && (_a.indexOf(t) !== -1 || va.test(t))) return e.quotingType === Sa ? "\"" + t + "\"" : "'" + t + "'";
3870
- var a = e.indent * Math.max(1, n), o = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - a), s = r || e.flowLevel > -1 && n >= e.flowLevel;
3871
- function c(t) {
3872
- return Ea(e, t);
3873
- }
3874
- switch (za(t, s, e.indent, o, c, e.quotingType, e.forceQuotes && !r, i)) {
3875
- case Fa: return t;
3876
- case Ia: return "'" + t.replace(/'/g, "''") + "'";
3877
- case La: return "|" + Va(t, e.indent) + Ha(wa(t, a));
3878
- case Ra: return ">" + Va(t, e.indent) + Ha(wa(Ua(t, o), a));
3879
- case X: return "\"" + Ga(t) + "\"";
3880
- default: throw new I("impossible error: invalid scalar style");
3881
- }
3882
- }();
3883
- }
3884
- function Va(e, t) {
3885
- var n = Pa(e) ? String(t) : "", r = e[e.length - 1] === "\n";
3886
- return n + (r && (e[e.length - 2] === "\n" || e === "\n") ? "+" : r ? "" : "-") + "\n";
3887
- }
3888
- function Ha(e) {
3889
- return e[e.length - 1] === "\n" ? e.slice(0, -1) : e;
3890
- }
3891
- function Ua(e, t) {
3892
- for (var n = /(\n+)([^\n]*)/g, r = function() {
3893
- var r = e.indexOf("\n");
3894
- return r = r === -1 ? e.length : r, n.lastIndex = r, Wa(e.slice(0, r), t);
3895
- }(), i = e[0] === "\n" || e[0] === " ", a, o; o = n.exec(e);) {
3896
- var s = o[1], c = o[2];
3897
- a = c[0] === " ", r += s + (!i && !a && c !== "" ? "\n" : "") + Wa(c, t), i = a;
3898
- }
3899
- return r;
3900
- }
3901
- function Wa(e, t) {
3902
- if (e === "" || e[0] === " ") return e;
3903
- for (var n = / [^ ]/g, r, i = 0, a, o = 0, s = 0, c = ""; r = n.exec(e);) s = r.index, s - i > t && (a = o > i ? o : s, c += "\n" + e.slice(i, a), i = a + 1), o = s;
3904
- return c += "\n", e.length - i > t && o > i ? c += e.slice(i, o) + "\n" + e.slice(o + 1) : c += e.slice(i), c.slice(1);
3905
- }
3906
- function Ga(e) {
3907
- for (var t = "", n = 0, r, i = 0; i < e.length; n >= 65536 ? i += 2 : i++) n = Na(e, i), r = Y[n], !r && Oa(n) ? (t += e[i], n >= 65536 && (t += e[i + 1])) : t += r || ba(n);
3908
- return t;
3909
- }
3910
- function Ka(e, t, n) {
3911
- var r = "", i = e.tag, a, o, s;
3912
- for (a = 0, o = n.length; a < o; a += 1) s = n[a], e.replacer && (s = e.replacer.call(n, String(a), s)), (Z(e, t, s, !1, !1) || s === void 0 && Z(e, t, null, !1, !1)) && (r !== "" && (r += "," + (e.condenseFlow ? "" : " ")), r += e.dump);
3913
- e.tag = i, e.dump = "[" + r + "]";
3914
- }
3915
- function qa(e, t, n, r) {
3916
- var i = "", a = e.tag, o, s, c;
3917
- for (o = 0, s = n.length; o < s; o += 1) c = n[o], e.replacer && (c = e.replacer.call(n, String(o), c)), (Z(e, t + 1, c, !0, !0, !1, !0) || c === void 0 && Z(e, t + 1, null, !0, !0, !1, !0)) && ((!r || i !== "") && (i += Ta(e, t)), e.dump && Ji === e.dump.charCodeAt(0) ? i += "-" : i += "- ", i += e.dump);
3918
- e.tag = a, e.dump = i || "[]";
3919
- }
3920
- function Ja(e, t, n) {
3921
- var r = "", i = e.tag, a = Object.keys(n), o, s, c, l, u;
3922
- for (o = 0, s = a.length; o < s; o += 1) u = "", r !== "" && (u += ", "), e.condenseFlow && (u += "\""), c = a[o], l = n[c], e.replacer && (l = e.replacer.call(n, c, l)), Z(e, t, c, !1, !1) && (e.dump.length > 1024 && (u += "? "), u += e.dump + (e.condenseFlow ? "\"" : "") + ":" + (e.condenseFlow ? "" : " "), Z(e, t, l, !1, !1) && (u += e.dump, r += u));
3923
- e.tag = i, e.dump = "{" + r + "}";
3924
- }
3925
- function Ya(e, t, n, r) {
3926
- var i = "", a = e.tag, o = Object.keys(n), s, c, l, u, d, f;
3927
- if (e.sortKeys === !0) o.sort();
3928
- else if (typeof e.sortKeys == "function") o.sort(e.sortKeys);
3929
- else if (e.sortKeys) throw new I("sortKeys must be a boolean or a function");
3930
- for (s = 0, c = o.length; s < c; s += 1) f = "", (!r || i !== "") && (f += Ta(e, t)), l = o[s], u = n[l], e.replacer && (u = e.replacer.call(n, l, u)), Z(e, t + 1, l, !0, !0, !0) && (d = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, d && (e.dump && Ji === e.dump.charCodeAt(0) ? f += "?" : f += "? "), f += e.dump, d && (f += Ta(e, t)), Z(e, t + 1, u, !0, d) && (e.dump && Ji === e.dump.charCodeAt(0) ? f += ":" : f += ": ", f += e.dump, i += f));
3931
- e.tag = a, e.dump = i || "{}";
3932
- }
3933
- function Xa(e, t, n) {
3934
- var r, i = n ? e.explicitTypes : e.implicitTypes, a, o, s, c;
3935
- for (a = 0, o = i.length; a < o; a += 1) if (s = i[a], (s.instanceOf || s.predicate) && (!s.instanceOf || typeof t == "object" && t instanceof s.instanceOf) && (!s.predicate || s.predicate(t))) {
3936
- if (n ? s.multi && s.representName ? e.tag = s.representName(t) : e.tag = s.tag : e.tag = "?", s.represent) {
3937
- if (c = e.styleMap[s.tag] || s.defaultStyle, Wi.call(s.represent) === "[object Function]") r = s.represent(t, c);
3938
- else if (Gi.call(s.represent, c)) r = s.represent[c](t, c);
3939
- else throw new I("!<" + s.tag + "> tag resolver accepts not \"" + c + "\" style");
3940
- e.dump = r;
3941
- }
3942
- return !0;
3943
- }
3944
- return !1;
3945
- }
3946
- function Z(e, t, n, r, i, a, o) {
3947
- e.tag = null, e.dump = n, Xa(e, n, !1) || Xa(e, n, !0);
3948
- var s = Wi.call(e.dump), c = r, l;
3949
- r &&= e.flowLevel < 0 || e.flowLevel > t;
3950
- var u = s === "[object Object]" || s === "[object Array]", d, f;
3951
- if (u && (d = e.duplicates.indexOf(n), f = d !== -1), (e.tag !== null && e.tag !== "?" || f || e.indent !== 2 && t > 0) && (i = !1), f && e.usedDuplicates[d]) e.dump = "*ref_" + d;
3952
- else {
3953
- if (u && f && !e.usedDuplicates[d] && (e.usedDuplicates[d] = !0), s === "[object Object]") r && Object.keys(e.dump).length !== 0 ? (Ya(e, t, e.dump, i), f && (e.dump = "&ref_" + d + e.dump)) : (Ja(e, t, e.dump), f && (e.dump = "&ref_" + d + " " + e.dump));
3954
- else if (s === "[object Array]") r && e.dump.length !== 0 ? (e.noArrayIndent && !o && t > 0 ? qa(e, t - 1, e.dump, i) : qa(e, t, e.dump, i), f && (e.dump = "&ref_" + d + e.dump)) : (Ka(e, t, e.dump), f && (e.dump = "&ref_" + d + " " + e.dump));
3955
- else if (s === "[object String]") e.tag !== "?" && Ba(e, e.dump, t, a, c);
3956
- else if (s === "[object Undefined]") return !1;
3957
- else {
3958
- if (e.skipInvalid) return !1;
3959
- throw new I("unacceptable kind of an object to dump " + s);
3960
- }
3961
- e.tag !== null && e.tag !== "?" && (l = encodeURI(e.tag[0] === "!" ? e.tag.slice(1) : e.tag).replace(/!/g, "%21"), l = e.tag[0] === "!" ? "!" + l : l.slice(0, 18) === "tag:yaml.org,2002:" ? "!!" + l.slice(18) : "!<" + l + ">", e.dump = l + " " + e.dump);
3962
- }
3963
- return !0;
3964
- }
3965
- function Za(e, t) {
3966
- var n = [], r = [], i, a;
3967
- for (Qa(e, n, r), i = 0, a = r.length; i < a; i += 1) t.duplicates.push(n[r[i]]);
3968
- t.usedDuplicates = Array(a);
3969
- }
3970
- function Qa(e, t, n) {
3971
- var r, i, a;
3972
- if (typeof e == "object" && e) if (i = t.indexOf(e), i !== -1) n.indexOf(i) === -1 && n.push(i);
3973
- else if (t.push(e), Array.isArray(e)) for (i = 0, a = e.length; i < a; i += 1) Qa(e[i], t, n);
3974
- else for (r = Object.keys(e), i = 0, a = r.length; i < a; i += 1) Qa(e[r[i]], t, n);
3975
- }
3976
- function $a(e, t) {
3977
- t ||= {};
3978
- var n = new Ca(t);
3979
- n.noRefs || Za(e, n);
3980
- var r = e;
3981
- return n.replacer && (r = n.replacer.call({ "": r }, "", r)), Z(n, 0, r, !0, !0) ? n.dump + "\n" : "";
3982
- }
3983
- var eo = { dump: $a }, to = Ui.load;
3984
- Ui.loadAll;
3985
- var no = eo.dump;
3986
- //#endregion
3987
- //#region src/element-tree/yaml.ts
3988
- function ro(e) {
3989
- return no(ao(e), {
3990
- indent: 2,
3991
- lineWidth: -1,
3992
- noRefs: !0,
3993
- sortKeys: !1,
3994
- quotingType: "\"",
3995
- forceQuotes: !1
3996
- });
3997
- }
3998
- function io(e) {
3999
- let t;
4000
- try {
4001
- t = to(e);
4002
- } catch (e) {
4003
- throw Error(`ElementTree YAML parse failed: ${e instanceof Error ? e.message : String(e)}`);
4004
- }
4005
- return On(t);
4006
- }
4007
- function ao(e) {
4008
- return {
4009
- version: e.version,
4010
- source: oo(e.source),
4011
- viewport: so(e.viewport),
4012
- root: co(e.root)
4013
- };
4014
- }
4015
- function oo(e) {
4016
- let t = { kind: e.kind };
4017
- return e.url !== void 0 && (t.url = e.url), e.agent !== void 0 && (t.agent = e.agent), t.capturedAt = e.capturedAt, t;
4018
- }
4019
- function so(e) {
4020
- return {
4021
- width: e.width,
4022
- height: e.height,
4023
- scale: e.scale
4024
- };
4025
- }
4026
- function co(e) {
4027
- let t = {
4028
- ref: e.ref,
4029
- role: e.role
4030
- };
4031
- if (e.name !== void 0 && (t.name = e.name), e.text !== void 0 && (t.text = e.text), e.bbox !== void 0 && (t.bbox = {
4032
- x: e.bbox.x,
4033
- y: e.bbox.y,
4034
- width: e.bbox.width,
4035
- height: e.bbox.height
4036
- }), e.states !== void 0 && e.states.length > 0 && (t.states = [...e.states]), e.attributes !== void 0) {
4037
- let n = Object.keys(e.attributes);
4038
- if (n.length > 0) {
4039
- let r = {};
4040
- for (let t of [...n].sort()) r[t] = e.attributes[t];
4041
- t.attributes = r;
4042
- }
4043
- }
4044
- return e.children !== void 0 && e.children.length > 0 && (t.children = e.children.map(co)), t;
4045
- }
4046
- //#endregion
4047
2863
  //#region src/icons/types.ts
4048
- function lo(e) {
2864
+ function bn(e) {
4049
2865
  return {
4050
2866
  kind: "builtin",
4051
2867
  id: e
4052
2868
  };
4053
2869
  }
4054
- function uo(e) {
2870
+ function xn(e) {
4055
2871
  return {
4056
2872
  kind: "svg",
4057
2873
  svg: e
4058
2874
  };
4059
2875
  }
4060
- function fo(e) {
2876
+ function Sn(e) {
4061
2877
  return {
4062
2878
  kind: "url",
4063
2879
  url: e
4064
2880
  };
4065
2881
  }
4066
- function po(e) {
2882
+ function Cn(e) {
4067
2883
  return e.kind === "builtin";
4068
2884
  }
4069
- function mo(e) {
2885
+ function wn(e) {
4070
2886
  return e.kind === "svg";
4071
2887
  }
4072
- function ho(e) {
2888
+ function Tn(e) {
4073
2889
  return e.kind === "url";
4074
2890
  }
4075
2891
  //#endregion
4076
2892
  //#region src/storage/errors.ts
4077
- var go = class extends Error {
2893
+ var Y = class extends Error {
4078
2894
  code;
4079
2895
  path;
4080
2896
  constructor(e, t, n) {
4081
2897
  super(n), this.name = "StorageError", this.code = e, this.path = t;
4082
2898
  }
4083
- }, _o = class extends go {
2899
+ }, En = class extends Y {
4084
2900
  constructor(e, t) {
4085
2901
  super("conflict", e, t ?? `Path already exists: ${e}`), this.name = "StorageConflictError";
4086
2902
  }
4087
- }, vo = class extends go {
2903
+ }, Dn = class extends Y {
4088
2904
  constructor(e, t) {
4089
2905
  super("not-found", e, t ?? `Path not found: ${e}`), this.name = "StorageNotFoundError";
4090
2906
  }
4091
- }, yo = class extends go {
2907
+ }, On = class extends Y {
4092
2908
  constructor(e, t) {
4093
2909
  super("permission", e, t ?? `Permission denied: ${e}`), this.name = "StoragePermissionError";
4094
2910
  }
4095
- }, bo = class extends go {
2911
+ }, kn = class extends Y {
4096
2912
  constructor(e, t) {
4097
2913
  super("quota", e, t ?? `Quota exceeded: ${e}`), this.name = "StorageQuotaError";
4098
2914
  }
4099
- }, xo = class extends Error {
2915
+ }, An = class extends Error {
4100
2916
  constructor(e, t) {
4101
2917
  super(e, t), this.name = "MetadataCacheError";
4102
2918
  }
4103
- }, So = class extends xo {
2919
+ }, jn = class extends An {
4104
2920
  constructor(e = "Metadata cache quota exceeded", t) {
4105
2921
  super(e, t), this.name = "MetadataCacheQuotaError";
4106
2922
  }
4107
2923
  };
4108
- function Co(e) {
2924
+ function Mn(e) {
4109
2925
  let t = e;
4110
2926
  return typeof t.metadataNamespace == "function" && typeof t.attachMetadataCache == "function";
4111
2927
  }
4112
2928
  //#endregion
4113
2929
  //#region src/storage/path.ts
4114
- var wo = "", To = /[<>:"/\\|?*\x00-\x1f]/;
4115
- function Eo(e) {
2930
+ var Nn = "", Pn = /[<>:"/\\|?*\x00-\x1f]/;
2931
+ function Fn(e) {
4116
2932
  if (!e) throw Error("Name must not be empty");
4117
2933
  if (e === "." || e === "..") throw Error(`Name "${e}" is reserved`);
4118
- if (To.test(e)) throw Error(`Name "${e}" contains invalid characters`);
2934
+ if (Pn.test(e)) throw Error(`Name "${e}" contains invalid characters`);
4119
2935
  if (e.length > 255) throw Error("Name is too long (max 255 chars)");
4120
2936
  }
4121
- function Do(e, t) {
2937
+ function In(e, t) {
4122
2938
  if (!t) throw Error("joinPath: name is required");
4123
2939
  if (t.includes("/")) throw Error(`joinPath: name must not contain "/": "${t}"`);
4124
2940
  return e ? `${e}/${t}` : t;
4125
2941
  }
4126
- function Oo(e) {
2942
+ function Ln(e) {
4127
2943
  if (!e) return "";
4128
2944
  let t = e.lastIndexOf("/");
4129
2945
  return t < 0 ? "" : e.slice(0, t);
4130
2946
  }
4131
- function ko(e) {
2947
+ function Rn(e) {
4132
2948
  if (!e) return "";
4133
2949
  let t = e.lastIndexOf("/");
4134
2950
  return t < 0 ? e : e.slice(t + 1);
4135
2951
  }
4136
- function Ao(e) {
2952
+ function zn(e) {
4137
2953
  return e ? e.split("/") : [];
4138
2954
  }
4139
- function jo(e) {
4140
- let t = Ao(e), n = [], r = "";
2955
+ function Bn(e) {
2956
+ let t = zn(e), n = [], r = "";
4141
2957
  for (let e = 0; e < t.length - 1; e++) r = r ? `${r}/${t[e]}` : t[e], n.push(r);
4142
2958
  return n;
4143
2959
  }
4144
- function Mo(e, t) {
2960
+ function Vn(e, t) {
4145
2961
  return t ? e === t || e.startsWith(`${t}/`) : !0;
4146
2962
  }
4147
- function No(e) {
2963
+ function Hn(e) {
4148
2964
  let t = e.lastIndexOf(".");
4149
2965
  return t <= 0 ? [e, ""] : [e.slice(0, t), e.slice(t)];
4150
2966
  }
4151
- function Po(e, t) {
2967
+ function Un(e, t) {
4152
2968
  if (!t(e)) return e;
4153
- let [n, r] = No(e);
2969
+ let [n, r] = Hn(e);
4154
2970
  for (let e = 2; e < 1e4; e++) {
4155
2971
  let i = `${n} (${e})${r}`;
4156
2972
  if (!t(i)) return i;
4157
2973
  }
4158
2974
  throw Error(`Could not find unique name for "${e}"`);
4159
2975
  }
4160
- async function Fo(e, t) {
2976
+ async function Wn(e, t) {
4161
2977
  if (!await t(e)) return e;
4162
- let [n, r] = No(e);
2978
+ let [n, r] = Hn(e);
4163
2979
  for (let e = 2; e < 1e4; e++) {
4164
2980
  let i = `${n} (${e})${r}`;
4165
2981
  if (!await t(i)) return i;
4166
2982
  }
4167
2983
  throw Error(`Could not find unique name for "${e}"`);
4168
2984
  }
4169
- function Io(e, t, n) {
2985
+ function Gn(e, t, n) {
4170
2986
  return e === t ? n : t && e.startsWith(`${t}/`) ? n ? n + e.slice(t.length) : e.slice(t.length + 1) : t ? e : n ? `${n}/${e}` : e;
4171
2987
  }
4172
2988
  //#endregion
4173
2989
  //#region src/storage/thumbnail-cache.ts
4174
- var Lo = class extends Error {
2990
+ var Kn = class extends Error {
4175
2991
  constructor(e, t) {
4176
2992
  super(e, t), this.name = "ThumbnailCacheError";
4177
2993
  }
4178
- }, Ro = class extends Lo {
2994
+ }, qn = class extends Kn {
4179
2995
  constructor(e = "Thumbnail cache quota exceeded", t) {
4180
2996
  super(e, t), this.name = "ThumbnailCacheQuotaError";
4181
2997
  }
4182
2998
  };
4183
2999
  //#endregion
4184
3000
  //#region src/storage/types.ts
4185
- function zo(e) {
3001
+ function Jn(e) {
4186
3002
  return typeof e.resync == "function";
4187
3003
  }
4188
- function Bo(e) {
3004
+ function Yn(e) {
4189
3005
  return typeof e.forceRefresh == "function";
4190
3006
  }
4191
- function Vo(e) {
3007
+ function Xn(e) {
4192
3008
  return typeof e.setTokenRefresher == "function" && typeof e.setToken == "function";
4193
3009
  }
4194
- function Ho(e) {
3010
+ function Zn(e) {
4195
3011
  return typeof e.init == "function";
4196
3012
  }
4197
- function Uo(e) {
3013
+ function Qn(e) {
4198
3014
  return typeof e.getRateLimit == "function" && typeof e.setRateLimitListener == "function";
4199
3015
  }
4200
- function Wo(e) {
3016
+ function $n(e) {
4201
3017
  let t = e;
4202
3018
  return typeof t.saveDocument == "function" && typeof t.getDocument == "function" && typeof t.listDocuments == "function" && typeof t.updateDocument == "function";
4203
3019
  }
4204
3020
  //#endregion
4205
3021
  //#region src/utils/assert.ts
4206
- function Go(e, t) {
3022
+ function er(e, t) {
4207
3023
  if (e == null) throw Error(`Assertion failed: ${t}`);
4208
3024
  return e;
4209
3025
  }
4210
3026
  //#endregion
4211
3027
  //#region src/utils/constants.ts
4212
- var Ko = .9, qo = "#ff0000", Jo = "none", Yo = 3, Xo = 24, Zo = 10, Qo = "annot";
4213
- function $o(e, t = 2) {
3028
+ var tr = .9, nr = "#ff0000", rr = "none", ir = 3, ar = 24, or = 10, sr = "annot";
3029
+ function X(e, t = 2) {
4214
3030
  return String(e).padStart(t, "0");
4215
3031
  }
4216
- function es(e = /* @__PURE__ */ new Date()) {
4217
- return `${e.getFullYear()}${$o(e.getMonth() + 1)}${$o(e.getDate())}-${$o(e.getHours())}${$o(e.getMinutes())}${$o(e.getSeconds())}-${$o(e.getMilliseconds(), 3)}`;
3032
+ function cr(e = /* @__PURE__ */ new Date()) {
3033
+ return `${e.getFullYear()}${X(e.getMonth() + 1)}${X(e.getDate())}-${X(e.getHours())}${X(e.getMinutes())}${X(e.getSeconds())}-${X(e.getMilliseconds(), 3)}`;
4218
3034
  }
4219
- function ts(e = /* @__PURE__ */ new Date()) {
4220
- return `${Qo}-${es(e)}`;
3035
+ function lr(e = /* @__PURE__ */ new Date()) {
3036
+ return `${sr}-${cr(e)}`;
4221
3037
  }
4222
- function ns(e, t = /* @__PURE__ */ new Date()) {
3038
+ function ur(e, t = /* @__PURE__ */ new Date()) {
4223
3039
  let n = e.startsWith("data:image/jpeg") ? "jpg" : "png";
4224
- return `${ts(t)}.annot.${n}`;
3040
+ return `${lr(t)}.annot.${n}`;
4225
3041
  }
4226
3042
  //#endregion
4227
3043
  //#region src/utils/id.ts
4228
- var rs = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
4229
- function is(e = Date.now()) {
3044
+ var dr = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
3045
+ function fr(e = Date.now()) {
4230
3046
  let t = /* @__PURE__ */ new Uint8Array(16), n = Math.floor(e / 4294967296), r = e >>> 0;
4231
3047
  return t[0] = n >>> 8 & 255, t[1] = n & 255, t[2] = r >>> 24 & 255, t[3] = r >>> 16 & 255, t[4] = r >>> 8 & 255, t[5] = r & 255, crypto.getRandomValues(t.subarray(6)), t[6] = t[6] & 15 | 112, t[8] = t[8] & 63 | 128, t;
4232
3048
  }
4233
- function as(e) {
3049
+ function pr(e) {
4234
3050
  let t = 0;
4235
3051
  for (; t < e.length && e[t] === 0;) t++;
4236
3052
  let n = Array.from(e), r = [], i = t;
@@ -4244,85 +3060,85 @@ function as(e) {
4244
3060
  r.push(e);
4245
3061
  }
4246
3062
  let a = "";
4247
- for (let e = 0; e < t; e++) a += rs[0];
4248
- for (let e = r.length - 1; e >= 0; e--) a += rs[r[e]];
3063
+ for (let e = 0; e < t; e++) a += dr[0];
3064
+ for (let e = r.length - 1; e >= 0; e--) a += dr[r[e]];
4249
3065
  return a;
4250
3066
  }
4251
- function os() {
4252
- return as(is());
3067
+ function mr() {
3068
+ return pr(fr());
4253
3069
  }
4254
3070
  //#endregion
4255
3071
  //#region src/xmp/element-tree-payload.ts
4256
- var ss = "annot:elementTree", cs = new TextEncoder().encode(ss), ls = new TextEncoder().encode("iTXt");
4257
- function us(n, r) {
4258
- if (!ps(n)) throw Error("writeElementTreePng: input is not a valid PNG (missing signature)");
4259
- let a = ro(r), o = i(new TextEncoder().encode(a)), s = e(ls, t(cs, new Uint8Array([
3072
+ var hr = "annot:elementTree", Z = new TextEncoder().encode(hr), gr = new TextEncoder().encode("iTXt");
3073
+ function _r(e, t) {
3074
+ if (!br(e)) throw Error("writeElementTreePng: input is not a valid PNG (missing signature)");
3075
+ let n = i(t), r = m(new TextEncoder().encode(n)), a = u(gr, d(Z, new Uint8Array([
4260
3076
  0,
4261
3077
  1,
4262
3078
  0,
4263
3079
  0,
4264
3080
  0
4265
- ]), o)), c = hs(n), l = c.length - 12;
4266
- return t(c.slice(0, l), s, c.slice(l));
3081
+ ]), r)), o = Sr(e), s = o.length - 12;
3082
+ return d(o.slice(0, s), a, o.slice(s));
4267
3083
  }
4268
- function ds(e) {
4269
- if (!ps(e)) return null;
4270
- let t = gs(e);
3084
+ function vr(e) {
3085
+ if (!br(e)) return null;
3086
+ let t = Cr(e);
4271
3087
  if (t === null) return null;
4272
- let n = io(t);
3088
+ let n = c(t);
4273
3089
  if (n.version !== 1) throw Error(`readElementTreePng: unsupported ElementTree schema version ${String(n.version)} (this build understands 1)`);
4274
3090
  return n;
4275
3091
  }
4276
- function fs(e) {
4277
- return ps(e) ? ms(e) !== null : !1;
3092
+ function yr(e) {
3093
+ return br(e) ? xr(e) !== null : !1;
4278
3094
  }
4279
- function ps(e) {
3095
+ function br(e) {
4280
3096
  return e.length >= 8 && e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71;
4281
3097
  }
4282
- function ms(e) {
3098
+ function xr(e) {
4283
3099
  let t = 8;
4284
3100
  for (; t + 12 <= e.length;) {
4285
- let i = n(e, t), a = String.fromCharCode(e[t + 4], e[t + 5], e[t + 6], e[t + 7]), o = t + 8, s = o + i + 4;
4286
- if (s > e.length) break;
4287
- if (a === "iTXt" && r(e, o, cs)) {
4288
- let n = o + cs.length;
4289
- if (n < o + i && e[n] === 0) return {
3101
+ let n = f(e, t), r = String.fromCharCode(e[t + 4], e[t + 5], e[t + 6], e[t + 7]), i = t + 8, a = i + n + 4;
3102
+ if (a > e.length) break;
3103
+ if (r === "iTXt" && p(e, i, Z)) {
3104
+ let r = i + Z.length;
3105
+ if (r < i + n && e[r] === 0) return {
4290
3106
  start: t,
4291
- end: s,
4292
- dataStart: o,
4293
- dataLength: i
3107
+ end: a,
3108
+ dataStart: i,
3109
+ dataLength: n
4294
3110
  };
4295
3111
  }
4296
- t = s;
3112
+ t = a;
4297
3113
  }
4298
3114
  return null;
4299
3115
  }
4300
- function hs(e) {
4301
- let n = ms(e);
4302
- return n === null ? e : t(e.slice(0, n.start), e.slice(n.end));
3116
+ function Sr(e) {
3117
+ let t = xr(e);
3118
+ return t === null ? e : d(e.slice(0, t.start), e.slice(t.end));
4303
3119
  }
4304
- function gs(e) {
4305
- let t = ms(e);
3120
+ function Cr(e) {
3121
+ let t = xr(e);
4306
3122
  if (t === null) return null;
4307
- let n = t.dataStart + cs.length;
3123
+ let n = t.dataStart + Z.length;
4308
3124
  if (n + 3 > t.dataStart + t.dataLength) return null;
4309
3125
  let r = e[n + 1] ?? 0, i = e[n + 2] ?? 0;
4310
3126
  if (r === 1 && i !== 0) throw Error(`extractElementTreeYaml: unsupported compression method ${i} (only deflate is defined)`);
4311
- let o = n + 3, s = t.dataStart + t.dataLength;
4312
- for (; o < s && e[o] !== 0;) o++;
4313
- for (o++; o < s && e[o] !== 0;) o++;
4314
- if (o++, o > s) return null;
4315
- let c = e.slice(o, s);
3127
+ let a = n + 3, o = t.dataStart + t.dataLength;
3128
+ for (; a < o && e[a] !== 0;) a++;
3129
+ for (a++; a < o && e[a] !== 0;) a++;
3130
+ if (a++, a > o) return null;
3131
+ let s = e.slice(a, o);
4316
3132
  if (r === 1) {
4317
- let e = a(c);
3133
+ let e = h(s);
4318
3134
  return new TextDecoder().decode(e);
4319
3135
  }
4320
- return new TextDecoder().decode(c);
3136
+ return new TextDecoder().decode(s);
4321
3137
  }
4322
3138
  //#endregion
4323
3139
  //#region src/zip/zip-bytes.ts
4324
- var _s = new TextEncoder();
4325
- function vs(e) {
3140
+ var wr = new TextEncoder();
3141
+ function Tr(e) {
4326
3142
  let t = 4294967295;
4327
3143
  for (let n = 0; n < e.length; n++) {
4328
3144
  t ^= e[n];
@@ -4341,10 +3157,10 @@ function $(e) {
4341
3157
  e >> 24 & 255
4342
3158
  ]);
4343
3159
  }
4344
- function ys(e) {
3160
+ function Er(e) {
4345
3161
  let t = [], n = [], r = 0;
4346
3162
  for (let i of e) {
4347
- let e = _s.encode(i.name), a = vs(i.data), o = i.data.length, s = new Uint8Array([
3163
+ let e = wr.encode(i.name), a = Tr(i.data), o = i.data.length, s = new Uint8Array([
4348
3164
  80,
4349
3165
  75,
4350
3166
  3,
@@ -4409,17 +3225,17 @@ function ys(e) {
4409
3225
  }
4410
3226
  //#endregion
4411
3227
  //#region src/zip/zip-builder.ts
4412
- function bs(e) {
4413
- let t = ys(e);
3228
+ function Dr(e) {
3229
+ let t = Er(e);
4414
3230
  return new Blob([t], { type: "application/zip" });
4415
3231
  }
4416
- function xs(e) {
3232
+ function Or(e) {
4417
3233
  let t = e.split(",")[1] || "", n = atob(t), r = new Uint8Array(n.length);
4418
3234
  for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
4419
3235
  return r;
4420
3236
  }
4421
- function Ss(e) {
3237
+ function kr(e) {
4422
3238
  return e.startsWith("data:image/png") ? "png" : "jpg";
4423
3239
  }
4424
3240
  //#endregion
4425
- export { Qo as ANNOT_FILENAME_PREFIX, Ft as ANNOT_SVG_VERSION, Lt as ANNOT_SVG_VERSION_ATTR, It as ANNOT_SVG_VERSION_UNSTAMPED, x as BUILTIN_ICONS, S as BUILTIN_ICON_IDS, pt as CATEGORY_CONTROL_SHAPE, Jo as DEFAULT_FILL_COLOR, Xo as DEFAULT_FONT_SIZE, p as DEFAULT_HISTORY_DEPTH, vn as DEFAULT_MAX_ZOOM, _n as DEFAULT_MIN_ZOOM, qo as DEFAULT_STROKE_COLOR, Yo as DEFAULT_STROKE_WIDTH, ss as ELEMENT_TREE_ITXT_KEYWORD, yn as FIT_VIEW_PADDING, Ko as JPEG_QUALITY, o as LOGICAL_FAMILIES, Zo as MOSAIC_BLOCK_SIZE, xo as MetadataCacheError, So as MetadataCacheQuotaError, Tt as PROPERTY_CONTROLS, A as PROPERTY_CONTROL_IDS, j as PROPERTY_EFFECT_IDS, wo as ROOT_PATH, _o as StorageConflictError, go as StorageError, vo as StorageNotFoundError, yo as StoragePermissionError, bo as StorageQuotaError, an as TOOL_PANEL_ADAPTERS, sn as TOOL_PANEL_ADAPTER_IDS, Ut as TOOL_PANEL_EXTRA_CONTROL_IDS, Jt as TOOL_REGISTRY, Yt as TOOL_REGISTRY_IDS, Lo as ThumbnailCacheError, Ro as ThumbnailCacheQuotaError, jo as ancestorPaths, Cn as applyInverseAffine, Go as assertNonNull, bs as buildZip, lo as builtinIcon, bn as clampZoom, Et as classifyPropertyElement, kt as classifyPropertySelection, f as coerceToLogicalFamily, w as computeDasharray, xn as computeFitZoom, Sn as computeRenderedSize, Pt as computeSnap, m as createHistoryCore, Vt as createMockToolSurface, l as cssStackFor, Mt as cursorForAngle, Ss as dataUrlExt, xs as dataUrlToBytes, ts as defaultAnnotFilenameStem, ns as defaultAnnotImageFilename, xe as detectDashKey, mn as fieldForSnakeKey, Fn as findByMatch, Pn as findByRef, In as flattenTree, es as formatLocalTimestamp, Bt as getAnnotVersionFromString, ko as getFilename, Oo as getParentPath, fs as hasElementTreePng, po as isBuiltinIcon, Mo as isDescendantOrSame, wn as isElementTreeShape, d as isLogicalFamily, mo as isSvgIcon, ho as isUrlIcon, Do as joinPath, os as newIdB58, qt as normalizeVariantSideFields, u as ooxmlTypefacesFor, Dn as parseElementTreeFromJson, io as parseElementTreeFromYaml, pn as presetFromWire, fn as presetToWire, zt as readAnnotVersion, ds as readElementTreePng, gn as readUniversalStyleAttrs, me as renderIconElement, pe as renderIconHtml, te as resolveBuiltinIcon, hn as resolveStyleReadSource, Io as rewritePathPrefix, At as rotateAround, le as sanitizeIconSvg, on as selectionDefMetadata, Tn as serializeElementTreeToJson, ro as serializeElementTreeToYaml, No as splitExt, Ao as splitPath, Rt as stampAnnotVersion, Wo as supportsDocuments, Bo as supportsForceRefresh, Ho as supportsInit, Co as supportsMetadataCache, Uo as supportsRateLimit, zo as supportsResync, Vo as supportsTokenRefresher, uo as svgIcon, ye as translatePathD, Po as uniquifyFilename, Fo as uniquifyFilenameAsync, fo as urlIcon, On as validateElementTree, Eo as validateName, Mn as walkTree, us as writeElementTreePng, Ht as writeUniversalStyleAttrs };
3241
+ export { sr as ANNOT_FILENAME_PREFIX, Nt as ANNOT_SVG_VERSION, Ft as ANNOT_SVG_VERSION_ATTR, Pt as ANNOT_SVG_VERSION_UNSTAMPED, re as BUILTIN_ICONS, ie as BUILTIN_ICON_IDS, pt as CATEGORY_CONTROL_SHAPE, rr as DEFAULT_FILL_COLOR, ar as DEFAULT_FONT_SIZE, C as DEFAULT_HISTORY_DEPTH, mn as DEFAULT_MAX_ZOOM, pn as DEFAULT_MIN_ZOOM, nr as DEFAULT_STROKE_COLOR, ir as DEFAULT_STROKE_WIDTH, hr as ELEMENT_TREE_ITXT_KEYWORD, hn as FIT_VIEW_PADDING, tr as JPEG_QUALITY, g as LOGICAL_FAMILIES, or as MOSAIC_BLOCK_SIZE, An as MetadataCacheError, jn as MetadataCacheQuotaError, wt as PROPERTY_CONTROLS, B as PROPERTY_CONTROL_IDS, V as PROPERTY_EFFECT_IDS, Nn as ROOT_PATH, En as StorageConflictError, Y as StorageError, Dn as StorageNotFoundError, On as StoragePermissionError, kn as StorageQuotaError, en as TOOL_PANEL_ADAPTERS, nn as TOOL_PANEL_ADAPTER_IDS, Bt as TOOL_PANEL_EXTRA_CONTROL_IDS, Wt as TOOL_REGISTRY, Gt as TOOL_REGISTRY_IDS, Kn as ThumbnailCacheError, qn as ThumbnailCacheQuotaError, Bn as ancestorPaths, yn as applyInverseAffine, er as assertNonNull, Dr as buildZip, bn as builtinIcon, gn as clampZoom, Tt as classifyPropertyElement, Dt as classifyPropertySelection, S as coerceToLogicalFamily, k as computeDasharray, _n as computeFitZoom, vn as computeRenderedSize, Mt as computeSnap, ee as createHistoryCore, zt as createMockToolSurface, y as cssStackFor, At as cursorForAngle, kr as dataUrlExt, Or as dataUrlToBytes, lr as defaultAnnotFilenameStem, ur as defaultAnnotImageFilename, Ee as detectDashKey, un as fieldForSnakeKey, o as findByMatch, n as findByRef, e as flattenTree, cr as formatLocalTimestamp, Rt as getAnnotVersionFromString, Rn as getFilename, Ln as getParentPath, yr as hasElementTreePng, Cn as isBuiltinIcon, Vn as isDescendantOrSame, l as isElementTreeShape, x as isLogicalFamily, wn as isSvgIcon, Tn as isUrlIcon, In as joinPath, mr as newIdB58, Ut as normalizeVariantSideFields, b as ooxmlTypefacesFor, s as parseElementTreeFromJson, c as parseElementTreeFromYaml, ln as presetFromWire, cn as presetToWire, Lt as readAnnotVersion, vr as readElementTreePng, fn as readUniversalStyleAttrs, ye as renderIconElement, ve as renderIconHtml, ae as resolveBuiltinIcon, dn as resolveStyleReadSource, Gn as rewritePathPrefix, Ot as rotateAround, me as sanitizeIconSvg, tn as selectionDefMetadata, t as serializeElementTreeToJson, i as serializeElementTreeToYaml, Hn as splitExt, zn as splitPath, It as stampAnnotVersion, $n as supportsDocuments, Yn as supportsForceRefresh, Zn as supportsInit, Mn as supportsMetadataCache, Qn as supportsRateLimit, Jn as supportsResync, Xn as supportsTokenRefresher, xn as svgIcon, we as translatePathD, Un as uniquifyFilename, Wn as uniquifyFilenameAsync, Sn as urlIcon, r as validateElementTree, Fn as validateName, a as walkTree, _r as writeElementTreePng, q as writeUniversalStyleAttrs };