@ingcreators/annot-core 0.2.1 → 0.3.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/CHANGELOG.md +72 -0
- package/README.md +1 -1
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/overlay-pick-types.d.ts +35 -0
- package/dist/editor/tool-registry.d.ts +1 -1
- package/dist/element-tree/index.d.ts +4 -0
- package/dist/element-tree/json.d.ts +21 -0
- package/dist/element-tree/types.d.ts +96 -0
- package/dist/element-tree/walk.d.ts +49 -0
- package/dist/element-tree/yaml.d.ts +22 -0
- package/dist/headless.d.ts +3 -1
- package/dist/index.js +1884 -621
- package/dist/storage/path.d.ts +17 -0
- package/dist/storage/types.d.ts +71 -87
- package/dist/xmp/element-tree-payload.d.ts +32 -0
- package/dist/xmp/xmp-browser.d.ts +1 -1
- package/dist/xmp/xmp-bytes.d.ts +29 -0
- package/dist/xmp-bytes.js +2 -2
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
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
3
|
//#region src/editor/font-registry.ts
|
|
2
|
-
var
|
|
4
|
+
var o = [
|
|
3
5
|
"Annot Sans",
|
|
4
6
|
"Annot Serif",
|
|
5
7
|
"Annot Mono"
|
|
6
|
-
],
|
|
8
|
+
], s = {
|
|
7
9
|
"Annot Sans": [
|
|
8
10
|
"-apple-system",
|
|
9
11
|
"BlinkMacSystemFont",
|
|
@@ -43,7 +45,7 @@ var e = [
|
|
|
43
45
|
"\"Noto Sans Mono CJK JP\"",
|
|
44
46
|
"monospace"
|
|
45
47
|
].join(", ")
|
|
46
|
-
},
|
|
48
|
+
}, c = {
|
|
47
49
|
"Annot Sans": {
|
|
48
50
|
latin: "Calibri",
|
|
49
51
|
ea: "Yu Gothic UI",
|
|
@@ -60,22 +62,22 @@ var e = [
|
|
|
60
62
|
cs: "Courier New"
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
|
-
function
|
|
64
|
-
return
|
|
65
|
+
function l(e) {
|
|
66
|
+
return s[e];
|
|
65
67
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
68
|
+
function u(e) {
|
|
69
|
+
return c[e];
|
|
68
70
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
71
|
+
function d(e) {
|
|
72
|
+
return e == null ? !1 : o.includes(e);
|
|
71
73
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
74
|
+
function f(e) {
|
|
75
|
+
return d(e) ? e : "Annot Sans";
|
|
74
76
|
}
|
|
75
77
|
//#endregion
|
|
76
78
|
//#region src/editor/history-core.ts
|
|
77
|
-
var
|
|
78
|
-
function
|
|
79
|
+
var p = 100;
|
|
80
|
+
function m(e) {
|
|
79
81
|
let t = [], n = [], r = e.maxDepth ?? 100, i = () => {
|
|
80
82
|
e.onStateChange?.();
|
|
81
83
|
}, a = {
|
|
@@ -103,19 +105,19 @@ function c(e) {
|
|
|
103
105
|
}
|
|
104
106
|
//#endregion
|
|
105
107
|
//#region src/editor/toolbar-icons.ts
|
|
106
|
-
var
|
|
108
|
+
var h = {
|
|
107
109
|
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>",
|
|
108
110
|
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>",
|
|
109
111
|
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>"
|
|
110
|
-
},
|
|
112
|
+
}, g = {
|
|
111
113
|
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>",
|
|
112
114
|
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>",
|
|
113
115
|
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>"
|
|
114
|
-
},
|
|
116
|
+
}, _ = {
|
|
115
117
|
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>",
|
|
116
118
|
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>",
|
|
117
119
|
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>"
|
|
118
|
-
},
|
|
120
|
+
}, v = [
|
|
119
121
|
{
|
|
120
122
|
value: "#ffe100",
|
|
121
123
|
label: "Yellow"
|
|
@@ -140,7 +142,7 @@ var l = {
|
|
|
140
142
|
value: "#c991ff",
|
|
141
143
|
label: "Purple"
|
|
142
144
|
}
|
|
143
|
-
],
|
|
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 = {
|
|
144
146
|
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>",
|
|
145
147
|
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>",
|
|
146
148
|
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>",
|
|
@@ -243,27 +245,27 @@ var l = {
|
|
|
243
245
|
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>",
|
|
244
246
|
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>",
|
|
245
247
|
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>"
|
|
246
|
-
},
|
|
247
|
-
"shape.rect":
|
|
248
|
-
"shape.rounded":
|
|
249
|
-
"shape.ellipse":
|
|
250
|
-
"arrow.none":
|
|
251
|
-
"arrow.end":
|
|
252
|
-
"arrow.both":
|
|
253
|
-
"counter.circle":
|
|
254
|
-
"counter.rect":
|
|
255
|
-
"counter.rounded":
|
|
256
|
-
"brand.github":
|
|
257
|
-
},
|
|
258
|
-
...
|
|
259
|
-
...
|
|
260
|
-
},
|
|
261
|
-
function
|
|
262
|
-
return
|
|
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];
|
|
263
265
|
}
|
|
264
266
|
//#endregion
|
|
265
267
|
//#region src/editor/icons/sanitize.ts
|
|
266
|
-
var
|
|
268
|
+
var ne = "http://www.w3.org/2000/svg", re = 64 * 1024, ie = {
|
|
267
269
|
svg: "svg",
|
|
268
270
|
g: "g",
|
|
269
271
|
path: "path",
|
|
@@ -283,64 +285,64 @@ var y = "http://www.w3.org/2000/svg", b = 64 * 1024, x = {
|
|
|
283
285
|
desc: "desc",
|
|
284
286
|
text: "text",
|
|
285
287
|
tspan: "tspan"
|
|
286
|
-
},
|
|
287
|
-
function
|
|
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) {
|
|
288
290
|
return /^#[A-Za-z_][A-Za-z0-9_\-:.]*$/.test(e);
|
|
289
291
|
}
|
|
290
|
-
function
|
|
292
|
+
function se(e) {
|
|
291
293
|
return /^\s*(javascript|data:text\/html|vbscript):/i.test(e);
|
|
292
294
|
}
|
|
293
|
-
function
|
|
295
|
+
function ce(e) {
|
|
294
296
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
295
297
|
}
|
|
296
|
-
function
|
|
297
|
-
if (typeof e != "string" || e.length === 0 || e.length >
|
|
298
|
+
function le(e) {
|
|
299
|
+
if (typeof e != "string" || e.length === 0 || e.length > re) return null;
|
|
298
300
|
let t = globalThis.DOMParser;
|
|
299
301
|
if (!t) return null;
|
|
300
302
|
let n = new t().parseFromString(e, "image/svg+xml").documentElement;
|
|
301
|
-
return !n || n.namespaceURI !==
|
|
303
|
+
return !n || n.namespaceURI !== ne || (n.localName ?? "").toLowerCase() !== "svg" ? null : ue(n);
|
|
302
304
|
}
|
|
303
|
-
function
|
|
304
|
-
let t = (e.localName ?? "").toLowerCase(), n =
|
|
305
|
+
function ue(e) {
|
|
306
|
+
let t = (e.localName ?? "").toLowerCase(), n = ie[t];
|
|
305
307
|
if (!n) return "";
|
|
306
|
-
let r =
|
|
308
|
+
let r = de(e, t, n === "svg"), i = [];
|
|
307
309
|
for (let t of Array.from(e.childNodes)) if (t.nodeType === 1) {
|
|
308
310
|
let e = t;
|
|
309
|
-
if (e.namespaceURI !==
|
|
310
|
-
let n =
|
|
311
|
+
if (e.namespaceURI !== ne) continue;
|
|
312
|
+
let n = ue(e);
|
|
311
313
|
n && i.push(n);
|
|
312
314
|
} else if (t.nodeType === 3) {
|
|
313
315
|
let e = t.nodeValue ?? "";
|
|
314
|
-
e.length > 0 && i.push(
|
|
316
|
+
e.length > 0 && i.push(ce(e));
|
|
315
317
|
}
|
|
316
318
|
return i.length === 0 ? `<${n}${r}/>` : `<${n}${r}>${i.join("")}</${n}>`;
|
|
317
319
|
}
|
|
318
|
-
function
|
|
319
|
-
let r =
|
|
320
|
-
n && i.push(` xmlns="${
|
|
320
|
+
function de(e, t, n) {
|
|
321
|
+
let r = oe[t], i = [];
|
|
322
|
+
n && i.push(` xmlns="${ne}"`);
|
|
321
323
|
for (let t of Array.from(e.attributes)) {
|
|
322
324
|
let e = t.name;
|
|
323
325
|
if (e.startsWith("on") || e === "style" || e.startsWith("xmlns")) continue;
|
|
324
|
-
let n =
|
|
325
|
-
!n && !a || a && !
|
|
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)}"`);
|
|
326
328
|
}
|
|
327
329
|
return i.join("");
|
|
328
330
|
}
|
|
329
331
|
//#endregion
|
|
330
332
|
//#region src/editor/icons/render.ts
|
|
331
|
-
function
|
|
333
|
+
function fe(e) {
|
|
332
334
|
let t = e.trim();
|
|
333
335
|
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));
|
|
334
336
|
}
|
|
335
|
-
function
|
|
337
|
+
function pe(e) {
|
|
336
338
|
switch (e.kind) {
|
|
337
|
-
case "builtin": return
|
|
338
|
-
case "svg": return
|
|
339
|
-
case "url": return
|
|
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, "&").replace(/"/g, """).replace(/</g, "<")}" alt="" aria-hidden="true" class="annot-icon-img"/>` : "";
|
|
340
342
|
}
|
|
341
343
|
}
|
|
342
|
-
function
|
|
343
|
-
let n =
|
|
344
|
+
function me(e, t) {
|
|
345
|
+
let n = pe(e);
|
|
344
346
|
if (!n) return null;
|
|
345
347
|
let r = t ?? globalThis.document ?? null;
|
|
346
348
|
if (!r) return null;
|
|
@@ -349,7 +351,7 @@ function re(e, t) {
|
|
|
349
351
|
}
|
|
350
352
|
//#endregion
|
|
351
353
|
//#region src/editor/path-utils.ts
|
|
352
|
-
var
|
|
354
|
+
var he = {
|
|
353
355
|
M: ["x", "y"],
|
|
354
356
|
L: ["x", "y"],
|
|
355
357
|
H: ["x"],
|
|
@@ -386,7 +388,7 @@ var ie = {
|
|
|
386
388
|
],
|
|
387
389
|
Z: []
|
|
388
390
|
};
|
|
389
|
-
function
|
|
391
|
+
function ge(e) {
|
|
390
392
|
let t = [], n = /([A-DF-Za-df-z])|(-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/g, r = null, i = n.exec(e);
|
|
391
393
|
for (; i !== null;) {
|
|
392
394
|
let a = i[1], o = i[2];
|
|
@@ -400,19 +402,19 @@ function ae(e) {
|
|
|
400
402
|
}
|
|
401
403
|
return t;
|
|
402
404
|
}
|
|
403
|
-
function
|
|
405
|
+
function _e(e) {
|
|
404
406
|
return Math.abs(e) < 1e-9 ? "0" : Number(e.toFixed(6)).toString();
|
|
405
407
|
}
|
|
406
|
-
function
|
|
408
|
+
function ve(e) {
|
|
407
409
|
let t = [];
|
|
408
|
-
for (let n of e) n.params.length === 0 ? t.push(n.cmd) : t.push(n.cmd + n.params.map(
|
|
410
|
+
for (let n of e) n.params.length === 0 ? t.push(n.cmd) : t.push(n.cmd + n.params.map(_e).join(" "));
|
|
409
411
|
return t.join(" ");
|
|
410
412
|
}
|
|
411
|
-
function
|
|
413
|
+
function ye(e, t, n) {
|
|
412
414
|
if (t === 0 && n === 0) return e;
|
|
413
|
-
let r =
|
|
415
|
+
let r = ge(e), i = !0;
|
|
414
416
|
for (let e of r) {
|
|
415
|
-
let r = e.cmd.toUpperCase(), a =
|
|
417
|
+
let r = e.cmd.toUpperCase(), a = he[r];
|
|
416
418
|
if (!a || a.length === 0) {
|
|
417
419
|
i = !1;
|
|
418
420
|
continue;
|
|
@@ -430,11 +432,11 @@ function ce(e, t, n) {
|
|
|
430
432
|
}
|
|
431
433
|
i = !1;
|
|
432
434
|
}
|
|
433
|
-
return
|
|
435
|
+
return ve(r);
|
|
434
436
|
}
|
|
435
437
|
//#endregion
|
|
436
438
|
//#region src/utils/dash-utils.ts
|
|
437
|
-
var
|
|
439
|
+
var be = {
|
|
438
440
|
dash: [4, 3],
|
|
439
441
|
dot: [1, 3],
|
|
440
442
|
dashDot: [
|
|
@@ -445,36 +447,36 @@ var le = {
|
|
|
445
447
|
],
|
|
446
448
|
lgDash: [8, 3]
|
|
447
449
|
};
|
|
448
|
-
function
|
|
449
|
-
let n =
|
|
450
|
+
function w(e, t) {
|
|
451
|
+
let n = be[e];
|
|
450
452
|
return n ? n.map((e) => Math.max(1, Math.round(e * t))).join(",") : "";
|
|
451
453
|
}
|
|
452
|
-
function
|
|
454
|
+
function xe(e, t) {
|
|
453
455
|
if (!e) return "";
|
|
454
|
-
for (let [n, r] of Object.entries(
|
|
456
|
+
for (let [n, r] of Object.entries(be)) if (r.map((e) => Math.max(1, Math.round(e * t))).join(",") === e) return n;
|
|
455
457
|
let n = e.split(",").map(Number);
|
|
456
458
|
return n.length === 4 ? "dashDot" : n.length === 2 && n[0] <= t * 2 ? "dot" : n.length === 2 && n[0] > t * 5 ? "lgDash" : "dash";
|
|
457
459
|
}
|
|
458
460
|
//#endregion
|
|
459
461
|
//#region src/editor/arrow-markers.ts
|
|
460
|
-
var
|
|
462
|
+
var Se = class {
|
|
461
463
|
#e = "";
|
|
462
464
|
begin() {}
|
|
463
465
|
moveTo(e, t) {
|
|
464
|
-
this.#e += `M ${
|
|
466
|
+
this.#e += `M ${T(e)} ${T(t)} `;
|
|
465
467
|
}
|
|
466
468
|
lineTo(e, t) {
|
|
467
|
-
this.#e += `L ${
|
|
469
|
+
this.#e += `L ${T(e)} ${T(t)} `;
|
|
468
470
|
}
|
|
469
471
|
quadTo(e, t, n, r) {
|
|
470
|
-
this.#e += `Q ${
|
|
472
|
+
this.#e += `Q ${T(e)} ${T(t)} ${T(n)} ${T(r)} `;
|
|
471
473
|
}
|
|
472
474
|
close() {
|
|
473
475
|
this.#e += "Z ";
|
|
474
476
|
}
|
|
475
477
|
ellipse(e, t, n, r) {
|
|
476
478
|
let i = n / 2, a = r / 2, o = e + i, s = t + a;
|
|
477
|
-
this.#e += `M ${
|
|
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 `;
|
|
478
480
|
}
|
|
479
481
|
stroke() {}
|
|
480
482
|
fillAndStroke() {}
|
|
@@ -485,68 +487,68 @@ var j = class {
|
|
|
485
487
|
this.#e = "";
|
|
486
488
|
}
|
|
487
489
|
};
|
|
488
|
-
function
|
|
490
|
+
function T(e) {
|
|
489
491
|
return Math.abs(e) < 1e-9 ? "0" : Number(e.toFixed(3)).toString();
|
|
490
492
|
}
|
|
491
|
-
function
|
|
493
|
+
function Ce(e, t, n, r, i, a, o, s) {
|
|
492
494
|
let c = i * s * 1.118, l = a * s * 1.118, u = i * (o + s), d = a * (o + s), f = {
|
|
493
495
|
x: r.x - c,
|
|
494
496
|
y: r.y - l
|
|
495
497
|
}, p = n ? 3 / 4 : 1;
|
|
496
498
|
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();
|
|
497
499
|
}
|
|
498
|
-
function
|
|
500
|
+
function we(e, t, n, r, i, a, o) {
|
|
499
501
|
let s = r * o * 1.118, c = i * o * 1.118, l = r * (a + o), u = i * (a + o), d = {
|
|
500
502
|
x: n.x - s,
|
|
501
503
|
y: n.y - c
|
|
502
504
|
};
|
|
503
505
|
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);
|
|
504
506
|
}
|
|
505
|
-
function
|
|
507
|
+
function Te(e, t, n, r, i, a) {
|
|
506
508
|
let o = n * a * Math.SQRT1_2, s = r * a * Math.SQRT1_2, c = n * (i + a), l = r * (i + a), u = {
|
|
507
509
|
x: t.x - o,
|
|
508
510
|
y: t.y - s
|
|
509
511
|
};
|
|
510
512
|
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();
|
|
511
513
|
}
|
|
512
|
-
function
|
|
514
|
+
function Ee(e, t, n, r, i) {
|
|
513
515
|
let a = i / 2, o = {
|
|
514
516
|
x: t.x,
|
|
515
517
|
y: t.y
|
|
516
518
|
};
|
|
517
519
|
t.x -= n * a, t.y -= r * a, e.ellipse(o.x - a, o.y - a, i, i);
|
|
518
520
|
}
|
|
519
|
-
var
|
|
521
|
+
var De = {
|
|
520
522
|
sm: 6,
|
|
521
523
|
md: 10,
|
|
522
524
|
lg: 14
|
|
523
|
-
},
|
|
525
|
+
}, Oe = {
|
|
524
526
|
sm: 3.2,
|
|
525
527
|
md: 2.4,
|
|
526
528
|
lg: 1.8
|
|
527
|
-
},
|
|
529
|
+
}, ke = {
|
|
528
530
|
sm: 11,
|
|
529
531
|
md: 15,
|
|
530
532
|
lg: 20
|
|
531
|
-
},
|
|
533
|
+
}, Ae = {
|
|
532
534
|
sm: 2.4,
|
|
533
535
|
md: 1.8,
|
|
534
536
|
lg: 1.35
|
|
535
537
|
};
|
|
536
|
-
function
|
|
538
|
+
function je(e, t, n, r, i, a) {
|
|
537
539
|
if (t.shape === "none") return { filled: !1 };
|
|
538
|
-
let o = t.shape === "arrow" ?
|
|
540
|
+
let o = t.shape === "arrow" ? ke[t.length] : De[t.length], s = t.shape === "arrow" ? Ae[t.width] : Oe[t.width];
|
|
539
541
|
switch (t.shape) {
|
|
540
|
-
case "triangle": return
|
|
541
|
-
case "stealth": return
|
|
542
|
-
case "arrow": return
|
|
543
|
-
case "diamond": return
|
|
544
|
-
case "oval": return
|
|
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 };
|
|
545
547
|
}
|
|
546
548
|
return { filled: !1 };
|
|
547
549
|
}
|
|
548
|
-
function
|
|
549
|
-
let c = new
|
|
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;
|
|
550
552
|
if (s) {
|
|
551
553
|
let i = s.x - e, a = s.y - t, o = Math.hypot(i, a);
|
|
552
554
|
o > 1e-6 && (h = i / o, g = a / o);
|
|
@@ -559,26 +561,26 @@ function ye(e, t, n, r, i, a, o, s) {
|
|
|
559
561
|
}, b = {
|
|
560
562
|
x: n,
|
|
561
563
|
y: r
|
|
562
|
-
},
|
|
563
|
-
|
|
564
|
-
let
|
|
565
|
-
return
|
|
566
|
-
stemD:
|
|
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,
|
|
567
569
|
headFilledD: c.d,
|
|
568
570
|
headOpenD: l.d
|
|
569
571
|
};
|
|
570
572
|
}
|
|
571
|
-
function
|
|
573
|
+
function Ne(e) {
|
|
572
574
|
return e === "triangle" || e === "stealth" || e === "diamond" || e === "oval";
|
|
573
575
|
}
|
|
574
|
-
function
|
|
576
|
+
function E(e, t) {
|
|
575
577
|
return {
|
|
576
578
|
shape: e.getAttribute(`data-arrow-${t}-shape`) || "none",
|
|
577
579
|
width: e.getAttribute(`data-arrow-${t}-width`) || e.getAttribute(`data-arrow-${t}-size`) || "md",
|
|
578
580
|
length: e.getAttribute(`data-arrow-${t}-length`) || e.getAttribute(`data-arrow-${t}-size`) || "md"
|
|
579
581
|
};
|
|
580
582
|
}
|
|
581
|
-
function
|
|
583
|
+
function Pe(e) {
|
|
582
584
|
return {
|
|
583
585
|
x1: Number.parseFloat(e.getAttribute("data-x1") || "0"),
|
|
584
586
|
y1: Number.parseFloat(e.getAttribute("data-y1") || "0"),
|
|
@@ -586,7 +588,7 @@ function xe(e) {
|
|
|
586
588
|
y2: Number.parseFloat(e.getAttribute("data-y2") || "0")
|
|
587
589
|
};
|
|
588
590
|
}
|
|
589
|
-
function
|
|
591
|
+
function Fe(e) {
|
|
590
592
|
let t = e.getAttribute("data-cx"), n = e.getAttribute("data-cy");
|
|
591
593
|
if (t == null || n == null) return null;
|
|
592
594
|
let r = Number.parseFloat(t), i = Number.parseFloat(n);
|
|
@@ -595,8 +597,8 @@ function Se(e) {
|
|
|
595
597
|
y: i
|
|
596
598
|
};
|
|
597
599
|
}
|
|
598
|
-
function
|
|
599
|
-
let { x1: t, y1: n, x2: r, y2: i } =
|
|
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\"]");
|
|
600
602
|
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);
|
|
601
603
|
let u = e.getAttribute("stroke") || "#ff0000", d = (e, t, n) => {
|
|
602
604
|
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);
|
|
@@ -605,11 +607,11 @@ function Ce(e) {
|
|
|
605
607
|
let p = e.querySelector(":scope > [data-role=\"head-open\"]");
|
|
606
608
|
p || (p = document.createElementNS("http://www.w3.org/2000/svg", "path"), p.setAttribute("data-role", "head-open"), e.appendChild(p)), d(p, "none", c);
|
|
607
609
|
}
|
|
608
|
-
function
|
|
609
|
-
let n =
|
|
610
|
+
function Le(e, t = "right") {
|
|
611
|
+
let n = Re(e);
|
|
610
612
|
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>`;
|
|
611
613
|
}
|
|
612
|
-
function
|
|
614
|
+
function Re(e) {
|
|
613
615
|
let t = (e) => `<line x1="2" y1="7" x2="${e}" y2="7" stroke="currentColor" stroke-width="1.6" stroke-linecap="butt"/>`;
|
|
614
616
|
switch (e) {
|
|
615
617
|
case "none": return "<line x1=\"2\" y1=\"7\" x2=\"38\" y2=\"7\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"butt\"/>";
|
|
@@ -620,8 +622,8 @@ function Te(e) {
|
|
|
620
622
|
case "oval": return `${t(28)}<circle cx="33" cy="7" r="5" fill="currentColor"/>`;
|
|
621
623
|
}
|
|
622
624
|
}
|
|
623
|
-
function
|
|
624
|
-
let r = 1.2, { stemD: i, headFilledD: a, headOpenD: o } =
|
|
625
|
+
function ze(e, t, n = "right") {
|
|
626
|
+
let r = 1.2, { stemD: i, headFilledD: a, headOpenD: o } = Me(2, 7, 38, 7, {
|
|
625
627
|
shape: "none",
|
|
626
628
|
width: e,
|
|
627
629
|
length: t
|
|
@@ -634,11 +636,11 @@ function Ee(e, t, n = "right") {
|
|
|
634
636
|
}
|
|
635
637
|
//#endregion
|
|
636
638
|
//#region src/editor/shape-utils.ts
|
|
637
|
-
var
|
|
638
|
-
function
|
|
639
|
+
var Be = "http://www.w3.org/2000/svg";
|
|
640
|
+
function Ve(e) {
|
|
639
641
|
return e.tagName === "ellipse" ? "ellipse" : e.tagName === "rect" ? e.hasAttribute("data-rounded") ? "rounded" : "rect" : null;
|
|
640
642
|
}
|
|
641
|
-
function
|
|
643
|
+
function He(e) {
|
|
642
644
|
if (e.tagName === "ellipse") {
|
|
643
645
|
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");
|
|
644
646
|
return {
|
|
@@ -655,7 +657,7 @@ function ke(e) {
|
|
|
655
657
|
h: Number.parseFloat(e.getAttribute("height") || "0")
|
|
656
658
|
};
|
|
657
659
|
}
|
|
658
|
-
var
|
|
660
|
+
var Ue = [
|
|
659
661
|
"stroke",
|
|
660
662
|
"stroke-width",
|
|
661
663
|
"stroke-dasharray",
|
|
@@ -664,16 +666,16 @@ var Ae = [
|
|
|
664
666
|
"fill",
|
|
665
667
|
"fill-opacity"
|
|
666
668
|
];
|
|
667
|
-
function
|
|
668
|
-
let { x: n, y: r, w: i, h: a } =
|
|
669
|
+
function We(e, t) {
|
|
670
|
+
let { x: n, y: r, w: i, h: a } = He(e), o = e.parentNode;
|
|
669
671
|
if (!o) throw Error("convertShape: element is detached from DOM");
|
|
670
672
|
let s;
|
|
671
|
-
if (t === "ellipse") s = document.createElementNS(
|
|
672
|
-
else if (s = document.createElementNS(
|
|
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") {
|
|
673
675
|
let e = Math.max(2, Math.round(Math.min(i, a) / 6));
|
|
674
676
|
s.setAttribute("rx", String(e)), s.setAttribute("data-rounded", "true");
|
|
675
677
|
} else s.setAttribute("rx", "0");
|
|
676
|
-
for (let t of
|
|
678
|
+
for (let t of Ue) {
|
|
677
679
|
let n = e.getAttribute(t);
|
|
678
680
|
n != null && s.setAttribute(t, n);
|
|
679
681
|
}
|
|
@@ -681,70 +683,70 @@ function je(e, t) {
|
|
|
681
683
|
}
|
|
682
684
|
//#endregion
|
|
683
685
|
//#region src/editor/text-utils.ts
|
|
684
|
-
var
|
|
686
|
+
var D = "http://www.w3.org/2000/svg", Ge = {
|
|
685
687
|
"#ff0000": "rgba(255,255,200,0.92)",
|
|
686
688
|
"#00ff00": "rgba(200,255,200,0.92)",
|
|
687
689
|
"#0000ff": "rgba(200,220,255,0.92)",
|
|
688
690
|
"#ff8800": "rgba(255,230,200,0.92)",
|
|
689
691
|
"#ff00ff": "rgba(255,210,255,0.92)"
|
|
690
692
|
};
|
|
691
|
-
function
|
|
692
|
-
return
|
|
693
|
+
function Ke(e) {
|
|
694
|
+
return Ge[e.toLowerCase()] || "rgba(255,255,200,0.92)";
|
|
693
695
|
}
|
|
694
|
-
function
|
|
696
|
+
function qe(e, t, n) {
|
|
695
697
|
let r = e.getAttribute(t);
|
|
696
698
|
if (r == null) return n;
|
|
697
699
|
let i = Number.parseFloat(r);
|
|
698
700
|
return Number.isFinite(i) && i >= 0 ? i : n;
|
|
699
701
|
}
|
|
700
|
-
function
|
|
702
|
+
function Je(e) {
|
|
701
703
|
let t = e.getAttribute("data-shape-kind"), n = t === "plain" ? 2 : 10, r = t === "plain" ? 0 : 8;
|
|
702
704
|
return {
|
|
703
|
-
left:
|
|
704
|
-
right:
|
|
705
|
-
top:
|
|
706
|
-
bottom:
|
|
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)
|
|
707
709
|
};
|
|
708
710
|
}
|
|
709
|
-
function
|
|
711
|
+
function Ye(e) {
|
|
710
712
|
return e === "rect" || e === "rounded" || e === "ellipse" ? "middle" : "start";
|
|
711
713
|
}
|
|
712
|
-
function
|
|
714
|
+
function Xe(e) {
|
|
713
715
|
return e === "rect" || e === "rounded" || e === "ellipse" ? "middle" : "top";
|
|
714
716
|
}
|
|
715
|
-
var
|
|
716
|
-
function
|
|
717
|
-
if (
|
|
718
|
-
if (typeof document > "u") return
|
|
717
|
+
var Ze;
|
|
718
|
+
function Qe() {
|
|
719
|
+
if (Ze !== void 0) return Ze;
|
|
720
|
+
if (typeof document > "u") return Ze = null;
|
|
719
721
|
try {
|
|
720
|
-
|
|
722
|
+
Ze = document.createElement("canvas").getContext("2d");
|
|
721
723
|
} catch {
|
|
722
|
-
|
|
724
|
+
Ze = null;
|
|
723
725
|
}
|
|
724
|
-
return
|
|
726
|
+
return Ze;
|
|
725
727
|
}
|
|
726
|
-
function
|
|
727
|
-
let a =
|
|
728
|
+
function $e(e, t, n, r, i) {
|
|
729
|
+
let a = Qe();
|
|
728
730
|
return a ? (a.font = `${`${i ? "italic " : ""}${r ? "bold " : ""}`}${t}px ${n}`, a.measureText(e).width) : 0;
|
|
729
731
|
}
|
|
730
|
-
var
|
|
731
|
-
function
|
|
732
|
-
if (
|
|
733
|
-
if (typeof Intl > "u" || Intl.Segmenter === void 0) return
|
|
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;
|
|
734
736
|
try {
|
|
735
737
|
let e = typeof navigator < "u" ? navigator.language : void 0;
|
|
736
|
-
|
|
738
|
+
et = new Intl.Segmenter(e, { granularity: "word" });
|
|
737
739
|
} catch {
|
|
738
|
-
|
|
740
|
+
et = null;
|
|
739
741
|
}
|
|
740
|
-
return
|
|
742
|
+
return et;
|
|
741
743
|
}
|
|
742
|
-
var
|
|
743
|
-
function
|
|
744
|
+
var nt = /^[\s ]+$/;
|
|
745
|
+
function rt(e, t, n, r) {
|
|
744
746
|
let i = [], a = {
|
|
745
747
|
segments: [],
|
|
746
748
|
maxFontSize: 0
|
|
747
|
-
}, o = 0, s =
|
|
749
|
+
}, o = 0, s = tt(), c = () => {
|
|
748
750
|
i.push(a), a = {
|
|
749
751
|
segments: [],
|
|
750
752
|
maxFontSize: 0
|
|
@@ -756,8 +758,8 @@ function Be(e, t, n, r) {
|
|
|
756
758
|
else {
|
|
757
759
|
let e = 0;
|
|
758
760
|
for (; e < i.text.length;) {
|
|
759
|
-
let t =
|
|
760
|
-
for (; n < 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++;
|
|
761
763
|
f.push(i.text.slice(e, n)), e = n;
|
|
762
764
|
}
|
|
763
765
|
}
|
|
@@ -773,9 +775,9 @@ function Be(e, t, n, r) {
|
|
|
773
775
|
}), e > a.maxFontSize && (a.maxFontSize = e), "");
|
|
774
776
|
};
|
|
775
777
|
for (let n of f) {
|
|
776
|
-
if (a.segments.length === 0 && p === "" &&
|
|
777
|
-
let r =
|
|
778
|
-
o + r > t && (o > 0 || p !== "") && (m(), c(),
|
|
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
781
|
}
|
|
780
782
|
m(), i.text === "" && a.segments.length === 0 && e > a.maxFontSize && (a.maxFontSize = e), i.line_break_after && c();
|
|
781
783
|
}
|
|
@@ -783,7 +785,7 @@ function Be(e, t, n, r) {
|
|
|
783
785
|
for (let e of i) e.maxFontSize === 0 && (e.maxFontSize = n);
|
|
784
786
|
return i;
|
|
785
787
|
}
|
|
786
|
-
function
|
|
788
|
+
function it(e) {
|
|
787
789
|
let { x: t, y: n, w: r, h: i, lineFontSizes: a, margins: o, textAnchor: s, textVerticalAnchor: c } = e, l = a.length > 0 ? a : [16], u = l.map((e) => e * 1.4), d = Array(l.length);
|
|
788
790
|
d[0] = 0;
|
|
789
791
|
for (let e = 1; e < l.length; e++) d[e] = d[e - 1] + u[e - 1];
|
|
@@ -799,17 +801,17 @@ function Ve(e) {
|
|
|
799
801
|
}
|
|
800
802
|
};
|
|
801
803
|
}
|
|
802
|
-
function
|
|
804
|
+
function at(e) {
|
|
803
805
|
return e.tagName === "g" && e.getAttribute("data-type") === "shape" && e.getAttribute("data-shape-kind") != null;
|
|
804
806
|
}
|
|
805
|
-
function
|
|
807
|
+
function ot(e) {
|
|
806
808
|
let t = e.getAttribute("data-shape-kind");
|
|
807
809
|
return t === "plain" || t === "sticky" || t === "callout" ? t : "sticky";
|
|
808
810
|
}
|
|
809
|
-
function
|
|
811
|
+
function st(e) {
|
|
810
812
|
return e.hasAttribute("x") || e.hasAttribute("y");
|
|
811
813
|
}
|
|
812
|
-
function
|
|
814
|
+
function ct(e) {
|
|
813
815
|
let t = e.querySelector("text");
|
|
814
816
|
if (!t) return [];
|
|
815
817
|
let n = Array.from(t.querySelectorAll("tspan"));
|
|
@@ -834,45 +836,45 @@ function Ge(e) {
|
|
|
834
836
|
let c = t.getAttribute("fill");
|
|
835
837
|
c && (i.color = c);
|
|
836
838
|
let l = n[e + 1];
|
|
837
|
-
i.line_break_after = l != null &&
|
|
839
|
+
i.line_break_after = l != null && st(l), r.push(i);
|
|
838
840
|
}
|
|
839
841
|
return r;
|
|
840
842
|
}
|
|
841
|
-
function
|
|
842
|
-
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 =
|
|
843
|
+
function O(e) {
|
|
844
|
+
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");
|
|
843
845
|
return {
|
|
844
846
|
x: n,
|
|
845
847
|
y: r,
|
|
846
848
|
w: i,
|
|
847
849
|
h: a,
|
|
848
850
|
variant: l,
|
|
849
|
-
runs:
|
|
851
|
+
runs: ct(e),
|
|
850
852
|
fontSize: o,
|
|
851
853
|
fontFamily: s,
|
|
852
854
|
color: c,
|
|
853
|
-
textAnchor: p ??
|
|
854
|
-
textVerticalAnchor: m ??
|
|
855
|
+
textAnchor: p ?? Ye(u),
|
|
856
|
+
textVerticalAnchor: m ?? Xe(u),
|
|
855
857
|
tailX: d == null ? void 0 : Number.parseFloat(d),
|
|
856
858
|
tailY: f == null ? void 0 : Number.parseFloat(f)
|
|
857
859
|
};
|
|
858
860
|
}
|
|
859
|
-
function
|
|
860
|
-
let t = document.createElementNS(
|
|
861
|
+
function lt(e) {
|
|
862
|
+
let t = document.createElementNS(D, "g");
|
|
861
863
|
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);
|
|
862
|
-
let n = e.textAnchor ??
|
|
864
|
+
let n = e.textAnchor ?? Ye(e.variant), r = e.textVerticalAnchor ?? Xe(e.variant);
|
|
863
865
|
t.setAttribute("data-text-anchor", n), t.setAttribute("data-text-vanchor", r);
|
|
864
|
-
let i = document.createElementNS(
|
|
865
|
-
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",
|
|
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") {
|
|
866
868
|
let n = e.tailX ?? e.x - 30, r = e.tailY ?? e.y + e.h + 40;
|
|
867
869
|
t.setAttribute("data-tail-x", String(n)), t.setAttribute("data-tail-y", String(r));
|
|
868
|
-
let i = document.createElementNS(
|
|
869
|
-
i.setAttribute("d", ""), i.setAttribute("fill",
|
|
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);
|
|
870
872
|
}
|
|
871
|
-
let a = `clip-textshape-${Math.random().toString(36).slice(2, 9)}`, o = document.createElementNS(
|
|
873
|
+
let a = `clip-textshape-${Math.random().toString(36).slice(2, 9)}`, o = document.createElementNS(D, "clipPath");
|
|
872
874
|
o.id = a;
|
|
873
|
-
let s = document.createElementNS(
|
|
875
|
+
let s = document.createElementNS(D, "rect");
|
|
874
876
|
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);
|
|
875
|
-
let c =
|
|
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({
|
|
876
878
|
x: e.x,
|
|
877
879
|
y: e.y,
|
|
878
880
|
w: e.w,
|
|
@@ -881,25 +883,25 @@ function Ke(e) {
|
|
|
881
883
|
margins: c,
|
|
882
884
|
textAnchor: n,
|
|
883
885
|
textVerticalAnchor: r
|
|
884
|
-
}), f = document.createElementNS(
|
|
885
|
-
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",
|
|
886
|
+
}), f = document.createElementNS(D, "text");
|
|
887
|
+
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;
|
|
886
888
|
}
|
|
887
|
-
function
|
|
889
|
+
function ut(e, t, n) {
|
|
888
890
|
for (let r = 0; r < t.length; r++) {
|
|
889
891
|
let i = t[r], a = n.xForLine, o = n.yForLine(r);
|
|
890
892
|
if (i.segments.length === 0) {
|
|
891
|
-
let t = document.createElementNS(
|
|
893
|
+
let t = document.createElementNS(D, "tspan");
|
|
892
894
|
t.setAttribute("x", String(a)), t.setAttribute("y", String(o)), t.textContent = "", e.appendChild(t);
|
|
893
895
|
continue;
|
|
894
896
|
}
|
|
895
897
|
let s = !0;
|
|
896
898
|
for (let t of i.segments) {
|
|
897
|
-
let n = document.createElementNS(
|
|
899
|
+
let n = document.createElementNS(D, "tspan");
|
|
898
900
|
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);
|
|
899
901
|
}
|
|
900
902
|
}
|
|
901
903
|
}
|
|
902
|
-
function
|
|
904
|
+
function dt(e) {
|
|
903
905
|
if (e.getAttribute("data-shape-kind") !== "callout") return;
|
|
904
906
|
let t = e.querySelector("rect"), n = e.querySelector("path");
|
|
905
907
|
if (!t || !n) return;
|
|
@@ -908,14 +910,14 @@ function Je(e) {
|
|
|
908
910
|
let e = c - u, t = l - d;
|
|
909
911
|
m = Math.abs(e) > Math.abs(t) ? e > 0 ? "right" : "left" : t > 0 ? "bottom" : "top";
|
|
910
912
|
} else m = f > p ? c < r ? "left" : "right" : l < i ? "top" : "bottom";
|
|
911
|
-
let h = .1667, g = r, _ = r + a, v = i, y = i + o, b = Math.max(0, Math.min(a * h, a - 2 * s)),
|
|
912
|
-
|
|
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(" "));
|
|
913
915
|
}
|
|
914
|
-
function
|
|
916
|
+
function k(e, t) {
|
|
915
917
|
let n = (() => {
|
|
916
918
|
for (let t of Array.from(e.children)) if (t.tagName === "rect") return t;
|
|
917
919
|
return null;
|
|
918
|
-
})(), 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 =
|
|
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({
|
|
919
921
|
x: r,
|
|
920
922
|
y: i,
|
|
921
923
|
w: a,
|
|
@@ -929,8 +931,8 @@ function B(e, t) {
|
|
|
929
931
|
_ = t;
|
|
930
932
|
break;
|
|
931
933
|
}
|
|
932
|
-
for (_ || (_ = document.createElementNS(
|
|
933
|
-
if (
|
|
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
|
+
if (ut(_, m, g), e.getAttribute("data-text-autofit") === "resize" && n) {
|
|
934
936
|
let r = 0;
|
|
935
937
|
for (let e of h) r += e * 1.4;
|
|
936
938
|
r === 0 && (r = s * 1.4);
|
|
@@ -938,22 +940,22 @@ function B(e, t) {
|
|
|
938
940
|
if (i > o) {
|
|
939
941
|
n.setAttribute("height", String(i));
|
|
940
942
|
let r = e.querySelector("clipPath > rect");
|
|
941
|
-
r instanceof Element && r.setAttribute("height", String(i)),
|
|
943
|
+
r instanceof Element && r.setAttribute("height", String(i)), dt(e), k(e, t);
|
|
942
944
|
}
|
|
943
945
|
}
|
|
944
946
|
}
|
|
945
|
-
function
|
|
947
|
+
function ft(e, t) {
|
|
946
948
|
let n = e.parentNode;
|
|
947
949
|
if (!n) throw Error("convertTextVariant: element is detached");
|
|
948
|
-
let r =
|
|
949
|
-
...
|
|
950
|
+
let r = lt({
|
|
951
|
+
...O(e),
|
|
950
952
|
variant: t
|
|
951
953
|
}), i = e.getAttribute("transform");
|
|
952
954
|
return i && r.setAttribute("transform", i), n.replaceChild(r, e), r;
|
|
953
955
|
}
|
|
954
956
|
//#endregion
|
|
955
957
|
//#region src/editor/property-schema.ts
|
|
956
|
-
var
|
|
958
|
+
var A = {
|
|
957
959
|
shapeTypePicker: "shapeTypePicker",
|
|
958
960
|
arrowVariantPicker: "arrowVariantPicker",
|
|
959
961
|
drawStylePicker: "drawStylePicker",
|
|
@@ -993,54 +995,54 @@ var V = {
|
|
|
993
995
|
arrowStartSize: "arrowStartSize",
|
|
994
996
|
arrowEndShape: "arrowEndShape",
|
|
995
997
|
arrowEndSize: "arrowEndSize"
|
|
996
|
-
},
|
|
998
|
+
}, pt = {
|
|
997
999
|
textbox: [
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
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
|
|
1012
1014
|
],
|
|
1013
1015
|
marker: [
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1016
|
+
A.markerShapePicker,
|
|
1017
|
+
A.markerBgFillColor,
|
|
1018
|
+
A.markerBgStrokeColor,
|
|
1019
|
+
A.markerBgStrokeWidth,
|
|
1020
|
+
A.markerBgStrokeStyle,
|
|
1021
|
+
A.markerLabelValue,
|
|
1022
|
+
A.markerSize
|
|
1021
1023
|
],
|
|
1022
|
-
"redact-mosaic": [
|
|
1023
|
-
"redact-solid": [
|
|
1024
|
-
"redact-blur": [
|
|
1025
|
-
highlight: [
|
|
1024
|
+
"redact-mosaic": [A.redactStylePicker],
|
|
1025
|
+
"redact-solid": [A.redactStylePicker, A.redactSolidColor],
|
|
1026
|
+
"redact-blur": [A.redactStylePicker],
|
|
1027
|
+
highlight: [A.highlightColorPicker, A.highlightTransparency],
|
|
1026
1028
|
group: [],
|
|
1027
1029
|
shape: [
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
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
|
|
1042
1044
|
]
|
|
1043
|
-
},
|
|
1045
|
+
}, j = {
|
|
1044
1046
|
applyArrowVariant: "applyArrowVariant",
|
|
1045
1047
|
applyDrawStyle: "applyDrawStyle",
|
|
1046
1048
|
applyMarkerShape: "applyMarkerShape",
|
|
@@ -1052,27 +1054,27 @@ var V = {
|
|
|
1052
1054
|
applyArrowEndShape: "applyArrowEndShape",
|
|
1053
1055
|
applyArrowEndSize: "applyArrowEndSize"
|
|
1054
1056
|
};
|
|
1055
|
-
function
|
|
1057
|
+
function mt(e) {
|
|
1056
1058
|
let t = (e.getAttribute("data-arrow-start-shape") ?? "none") === "none", n = (e.getAttribute("data-arrow-end-shape") ?? "none") === "none";
|
|
1057
1059
|
return t && n ? "none" : !t && !n ? "both" : "end";
|
|
1058
1060
|
}
|
|
1059
|
-
function
|
|
1061
|
+
function ht(e) {
|
|
1060
1062
|
let t = e.getAttribute("data-draw-style");
|
|
1061
1063
|
if (t === "pen" || t === "highlighter") return t;
|
|
1062
1064
|
if (e.tagName === "g" && e.getAttribute("data-type") === "freehand") {
|
|
1063
1065
|
let t = e.querySelector("path");
|
|
1064
|
-
if (t) return
|
|
1066
|
+
if (t) return ht(t);
|
|
1065
1067
|
}
|
|
1066
1068
|
return Number.parseFloat(e.getAttribute("stroke-opacity") || "1") < .99 ? "highlighter" : "pen";
|
|
1067
1069
|
}
|
|
1068
|
-
function
|
|
1070
|
+
function gt(e) {
|
|
1069
1071
|
let t = e.getAttribute("data-shape");
|
|
1070
1072
|
return t === "circle" || t === "rect" || t === "rounded" ? t : e.querySelector("circle, rect")?.tagName === "rect" ? "rect" : "circle";
|
|
1071
1073
|
}
|
|
1072
|
-
function
|
|
1074
|
+
function M(e) {
|
|
1073
1075
|
return e.querySelector("circle") ?? e.querySelector("rect");
|
|
1074
1076
|
}
|
|
1075
|
-
function
|
|
1077
|
+
function _t(e) {
|
|
1076
1078
|
if (e.tagName === "g" && e.getAttribute("data-type") === "freehand") {
|
|
1077
1079
|
let t = [];
|
|
1078
1080
|
for (let n of Array.from(e.children)) n.tagName.toLowerCase() === "path" && t.push(n);
|
|
@@ -1080,17 +1082,17 @@ function W(e) {
|
|
|
1080
1082
|
}
|
|
1081
1083
|
return [e];
|
|
1082
1084
|
}
|
|
1083
|
-
function
|
|
1085
|
+
function N(e, t) {
|
|
1084
1086
|
return e.tagName === "g" ? e.querySelector("path, rect, line, circle")?.getAttribute(t) ?? e.getAttribute(t) : e.getAttribute(t);
|
|
1085
1087
|
}
|
|
1086
|
-
function
|
|
1088
|
+
function vt(e) {
|
|
1087
1089
|
return e.tagName === "g" && e.getAttribute("data-type") === "arrow";
|
|
1088
1090
|
}
|
|
1089
|
-
function
|
|
1090
|
-
let t =
|
|
1091
|
+
function yt(e) {
|
|
1092
|
+
let t = E(e, "start").shape === "none", n = E(e, "end").shape === "none";
|
|
1091
1093
|
return t && n ? "none" : !t && !n ? "both" : "end";
|
|
1092
1094
|
}
|
|
1093
|
-
function
|
|
1095
|
+
function bt(e, t) {
|
|
1094
1096
|
let n = e === "start" ? "left" : "right";
|
|
1095
1097
|
return [
|
|
1096
1098
|
{
|
|
@@ -1123,10 +1125,10 @@ function nt(e, t) {
|
|
|
1123
1125
|
}).map((e) => ({
|
|
1124
1126
|
value: e.value,
|
|
1125
1127
|
label: e.label,
|
|
1126
|
-
iconSvg:
|
|
1128
|
+
iconSvg: Le(e.value, n)
|
|
1127
1129
|
}));
|
|
1128
1130
|
}
|
|
1129
|
-
function
|
|
1131
|
+
function xt(e) {
|
|
1130
1132
|
let t = e === "start" ? "left" : "right", n = [
|
|
1131
1133
|
"sm",
|
|
1132
1134
|
"md",
|
|
@@ -1135,82 +1137,82 @@ function rt(e) {
|
|
|
1135
1137
|
for (let e of n) for (let i of n) r.push({
|
|
1136
1138
|
value: `${e}-${i}`,
|
|
1137
1139
|
label: `W:${e.toUpperCase()} L:${i.toUpperCase()}`,
|
|
1138
|
-
iconSvg:
|
|
1140
|
+
iconSvg: ze(e, i, t)
|
|
1139
1141
|
});
|
|
1140
1142
|
return r;
|
|
1141
1143
|
}
|
|
1142
|
-
function
|
|
1144
|
+
function St(e) {
|
|
1143
1145
|
let t = e.querySelector("text");
|
|
1144
1146
|
return Number.parseFloat(t?.getAttribute("font-size") || "13");
|
|
1145
1147
|
}
|
|
1146
|
-
function
|
|
1148
|
+
function Ct(e) {
|
|
1147
1149
|
let t = e.getAttribute("data-redact-style");
|
|
1148
1150
|
return t === "mosaic" || t === "solid" || t === "blur" ? t : "mosaic";
|
|
1149
1151
|
}
|
|
1150
|
-
function
|
|
1152
|
+
function P(e) {
|
|
1151
1153
|
return e.tagName === "line" ? !0 : e.tagName === "g" && e.getAttribute("data-type") === "arrow";
|
|
1152
1154
|
}
|
|
1153
|
-
function
|
|
1155
|
+
function wt(e) {
|
|
1154
1156
|
return e.tagName === "g" && e.getAttribute("data-type") === "freehand";
|
|
1155
1157
|
}
|
|
1156
|
-
var
|
|
1158
|
+
var Tt = {
|
|
1157
1159
|
shapeTypePicker: {
|
|
1158
|
-
id:
|
|
1160
|
+
id: A.shapeTypePicker,
|
|
1159
1161
|
type: "variantPicker",
|
|
1160
1162
|
label: "Shape type",
|
|
1161
|
-
getValue: (e) =>
|
|
1162
|
-
replace: (e, t) =>
|
|
1163
|
-
visibleWhen: (e) =>
|
|
1163
|
+
getValue: (e) => Ve(e),
|
|
1164
|
+
replace: (e, t) => We(e, t),
|
|
1165
|
+
visibleWhen: (e) => Ve(e) !== null,
|
|
1164
1166
|
options: [
|
|
1165
1167
|
{
|
|
1166
1168
|
value: "rect",
|
|
1167
1169
|
label: "Rectangle",
|
|
1168
|
-
iconSvg:
|
|
1170
|
+
iconSvg: h.rect
|
|
1169
1171
|
},
|
|
1170
1172
|
{
|
|
1171
1173
|
value: "rounded",
|
|
1172
1174
|
label: "Rounded",
|
|
1173
|
-
iconSvg:
|
|
1175
|
+
iconSvg: h.rounded
|
|
1174
1176
|
},
|
|
1175
1177
|
{
|
|
1176
1178
|
value: "ellipse",
|
|
1177
1179
|
label: "Ellipse",
|
|
1178
|
-
iconSvg:
|
|
1180
|
+
iconSvg: h.ellipse
|
|
1179
1181
|
}
|
|
1180
1182
|
]
|
|
1181
1183
|
},
|
|
1182
1184
|
arrowVariantPicker: {
|
|
1183
|
-
id:
|
|
1185
|
+
id: A.arrowVariantPicker,
|
|
1184
1186
|
type: "variantPicker",
|
|
1185
1187
|
label: "Arrow type",
|
|
1186
|
-
getValue: (e) =>
|
|
1187
|
-
effect:
|
|
1188
|
-
visibleWhen: (e) =>
|
|
1188
|
+
getValue: (e) => mt(e),
|
|
1189
|
+
effect: j.applyArrowVariant,
|
|
1190
|
+
visibleWhen: (e) => P(e),
|
|
1189
1191
|
options: [
|
|
1190
1192
|
{
|
|
1191
1193
|
value: "none",
|
|
1192
1194
|
label: "Line",
|
|
1193
|
-
iconSvg:
|
|
1195
|
+
iconSvg: g.none
|
|
1194
1196
|
},
|
|
1195
1197
|
{
|
|
1196
1198
|
value: "end",
|
|
1197
1199
|
label: "Arrow",
|
|
1198
|
-
iconSvg:
|
|
1200
|
+
iconSvg: g.end
|
|
1199
1201
|
},
|
|
1200
1202
|
{
|
|
1201
1203
|
value: "both",
|
|
1202
1204
|
label: "Double arrow",
|
|
1203
|
-
iconSvg:
|
|
1205
|
+
iconSvg: g.both
|
|
1204
1206
|
}
|
|
1205
1207
|
]
|
|
1206
1208
|
},
|
|
1207
1209
|
drawStylePicker: {
|
|
1208
|
-
id:
|
|
1210
|
+
id: A.drawStylePicker,
|
|
1209
1211
|
type: "variantPicker",
|
|
1210
1212
|
label: "Draw style",
|
|
1211
|
-
getValue: (e) =>
|
|
1212
|
-
effect:
|
|
1213
|
-
visibleWhen: (e) => e.tagName === "path" ||
|
|
1213
|
+
getValue: (e) => ht(e),
|
|
1214
|
+
effect: j.applyDrawStyle,
|
|
1215
|
+
visibleWhen: (e) => e.tagName === "path" || wt(e),
|
|
1214
1216
|
options: [{
|
|
1215
1217
|
value: "pen",
|
|
1216
1218
|
label: "Pen",
|
|
@@ -1222,43 +1224,43 @@ var st = {
|
|
|
1222
1224
|
}]
|
|
1223
1225
|
},
|
|
1224
1226
|
fillColor: {
|
|
1225
|
-
id:
|
|
1227
|
+
id: A.fillColor,
|
|
1226
1228
|
type: "color",
|
|
1227
1229
|
label: "Color",
|
|
1228
1230
|
getValue: (e) => e.getAttribute("fill") ?? "none",
|
|
1229
1231
|
setValue: (e, t) => {
|
|
1230
1232
|
e.setAttribute("fill", String(t));
|
|
1231
1233
|
},
|
|
1232
|
-
visibleWhen: (e) => !
|
|
1234
|
+
visibleWhen: (e) => !P(e) && e.tagName !== "path" && !wt(e),
|
|
1233
1235
|
allowNone: !0
|
|
1234
1236
|
},
|
|
1235
1237
|
strokeColor: {
|
|
1236
|
-
id:
|
|
1238
|
+
id: A.strokeColor,
|
|
1237
1239
|
type: "color",
|
|
1238
1240
|
label: "Color",
|
|
1239
|
-
getValue: (e) =>
|
|
1241
|
+
getValue: (e) => N(e, "stroke") ?? "#000000",
|
|
1240
1242
|
setValue: (e, t) => {
|
|
1241
1243
|
let n = String(t);
|
|
1242
|
-
for (let t of
|
|
1243
|
-
if (
|
|
1244
|
+
for (let t of _t(e)) t.setAttribute("stroke", n);
|
|
1245
|
+
if (vt(e)) {
|
|
1244
1246
|
let t = e.querySelector(":scope > [data-role=\"head-filled\"]");
|
|
1245
1247
|
t && t.setAttribute("fill", n);
|
|
1246
1248
|
}
|
|
1247
1249
|
}
|
|
1248
1250
|
},
|
|
1249
1251
|
strokeWidth: {
|
|
1250
|
-
id:
|
|
1252
|
+
id: A.strokeWidth,
|
|
1251
1253
|
type: "number",
|
|
1252
1254
|
label: "Width",
|
|
1253
|
-
getValue: (e) => Number.parseFloat(
|
|
1255
|
+
getValue: (e) => Number.parseFloat(N(e, "stroke-width") || "0"),
|
|
1254
1256
|
setValue: (e, t) => {
|
|
1255
1257
|
let n = Number(t);
|
|
1256
|
-
for (let t of
|
|
1258
|
+
for (let t of _t(e)) {
|
|
1257
1259
|
t.setAttribute("stroke-width", String(n));
|
|
1258
1260
|
let e = t.getAttribute("data-dash-key");
|
|
1259
|
-
e && t.setAttribute("stroke-dasharray",
|
|
1261
|
+
e && t.setAttribute("stroke-dasharray", w(e, n));
|
|
1260
1262
|
}
|
|
1261
|
-
|
|
1263
|
+
vt(e) && Ie(e);
|
|
1262
1264
|
},
|
|
1263
1265
|
min: .25,
|
|
1264
1266
|
max: 200,
|
|
@@ -1266,20 +1268,20 @@ var st = {
|
|
|
1266
1268
|
unit: "pt"
|
|
1267
1269
|
},
|
|
1268
1270
|
strokeStyle: {
|
|
1269
|
-
id:
|
|
1271
|
+
id: A.strokeStyle,
|
|
1270
1272
|
type: "select",
|
|
1271
1273
|
label: "Dash type",
|
|
1272
1274
|
getValue: (e) => {
|
|
1273
|
-
let t =
|
|
1275
|
+
let t = N(e, "data-dash-key");
|
|
1274
1276
|
if (t != null) return t;
|
|
1275
|
-
let n = Number.parseFloat(
|
|
1276
|
-
return
|
|
1277
|
+
let n = Number.parseFloat(N(e, "stroke-width") || "1");
|
|
1278
|
+
return xe(N(e, "stroke-dasharray") || "", n) ?? "";
|
|
1277
1279
|
},
|
|
1278
1280
|
setValue: (e, t) => {
|
|
1279
1281
|
let n = String(t);
|
|
1280
|
-
for (let t of
|
|
1282
|
+
for (let t of _t(e)) {
|
|
1281
1283
|
let e = Number.parseFloat(t.getAttribute("stroke-width") || "1");
|
|
1282
|
-
n ? (t.setAttribute("data-dash-key", n), t.setAttribute("stroke-dasharray",
|
|
1284
|
+
n ? (t.setAttribute("data-dash-key", n), t.setAttribute("stroke-dasharray", w(n, e))) : (t.removeAttribute("data-dash-key"), t.removeAttribute("stroke-dasharray"));
|
|
1283
1285
|
}
|
|
1284
1286
|
},
|
|
1285
1287
|
options: [
|
|
@@ -1306,11 +1308,11 @@ var st = {
|
|
|
1306
1308
|
]
|
|
1307
1309
|
},
|
|
1308
1310
|
textVariantPicker: {
|
|
1309
|
-
id:
|
|
1311
|
+
id: A.textVariantPicker,
|
|
1310
1312
|
type: "variantPicker",
|
|
1311
1313
|
label: "Text type",
|
|
1312
|
-
getValue: (e) =>
|
|
1313
|
-
replace: (e, t) =>
|
|
1314
|
+
getValue: (e) => ot(e),
|
|
1315
|
+
replace: (e, t) => ft(e, t),
|
|
1314
1316
|
options: [
|
|
1315
1317
|
{
|
|
1316
1318
|
value: "plain",
|
|
@@ -1330,19 +1332,19 @@ var st = {
|
|
|
1330
1332
|
]
|
|
1331
1333
|
},
|
|
1332
1334
|
textColor: {
|
|
1333
|
-
id:
|
|
1335
|
+
id: A.textColor,
|
|
1334
1336
|
type: "color",
|
|
1335
1337
|
label: "Color",
|
|
1336
1338
|
getValue: (e) => e.querySelector("text")?.getAttribute("fill") ?? "#ff0000",
|
|
1337
|
-
effect:
|
|
1339
|
+
effect: j.applyTextColor
|
|
1338
1340
|
},
|
|
1339
1341
|
fontFamily: {
|
|
1340
|
-
id:
|
|
1342
|
+
id: A.fontFamily,
|
|
1341
1343
|
type: "select",
|
|
1342
1344
|
label: "Font",
|
|
1343
|
-
getValue: (e) =>
|
|
1345
|
+
getValue: (e) => f(e.getAttribute("data-font-family") ?? e.querySelector("text")?.getAttribute("font-family")),
|
|
1344
1346
|
setValue: (e, t) => {
|
|
1345
|
-
let n =
|
|
1347
|
+
let n = f(String(t));
|
|
1346
1348
|
e.setAttribute("data-font-family", n), e.querySelector("text")?.setAttribute("font-family", n);
|
|
1347
1349
|
},
|
|
1348
1350
|
options: [
|
|
@@ -1361,15 +1363,15 @@ var st = {
|
|
|
1361
1363
|
]
|
|
1362
1364
|
},
|
|
1363
1365
|
fontSize: {
|
|
1364
|
-
id:
|
|
1366
|
+
id: A.fontSize,
|
|
1365
1367
|
type: "number",
|
|
1366
1368
|
label: "Size",
|
|
1367
1369
|
getValue: (e) => Number.parseFloat(e.querySelector("text")?.getAttribute("font-size") || "16"),
|
|
1368
1370
|
setValue: (e, t) => {
|
|
1369
1371
|
let n = Number(t);
|
|
1370
|
-
if (e.querySelector("text")?.setAttribute("font-size", String(n)), e.setAttribute("data-font-size", String(n)),
|
|
1371
|
-
let t =
|
|
1372
|
-
|
|
1372
|
+
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);
|
|
1373
1375
|
}
|
|
1374
1376
|
},
|
|
1375
1377
|
min: 8,
|
|
@@ -1378,15 +1380,15 @@ var st = {
|
|
|
1378
1380
|
unit: "pt"
|
|
1379
1381
|
},
|
|
1380
1382
|
textAnchor: {
|
|
1381
|
-
id:
|
|
1383
|
+
id: A.textAnchor,
|
|
1382
1384
|
type: "select",
|
|
1383
1385
|
label: "Align",
|
|
1384
1386
|
getValue: (e) => e.getAttribute("data-text-anchor") ?? "start",
|
|
1385
1387
|
setValue: (e, t) => {
|
|
1386
1388
|
let n = String(t);
|
|
1387
1389
|
e.setAttribute("data-text-anchor", n);
|
|
1388
|
-
let r =
|
|
1389
|
-
|
|
1390
|
+
let r = O(e).runs;
|
|
1391
|
+
k(e, r);
|
|
1390
1392
|
},
|
|
1391
1393
|
options: [
|
|
1392
1394
|
{
|
|
@@ -1407,15 +1409,15 @@ var st = {
|
|
|
1407
1409
|
]
|
|
1408
1410
|
},
|
|
1409
1411
|
textVerticalAnchor: {
|
|
1410
|
-
id:
|
|
1412
|
+
id: A.textVerticalAnchor,
|
|
1411
1413
|
type: "select",
|
|
1412
1414
|
label: "V-Align",
|
|
1413
1415
|
getValue: (e) => e.getAttribute("data-text-vanchor") ?? "top",
|
|
1414
1416
|
setValue: (e, t) => {
|
|
1415
1417
|
let n = String(t);
|
|
1416
1418
|
e.setAttribute("data-text-vanchor", n);
|
|
1417
|
-
let r =
|
|
1418
|
-
|
|
1419
|
+
let r = O(e).runs;
|
|
1420
|
+
k(e, r);
|
|
1419
1421
|
},
|
|
1420
1422
|
options: [
|
|
1421
1423
|
{
|
|
@@ -1436,15 +1438,15 @@ var st = {
|
|
|
1436
1438
|
]
|
|
1437
1439
|
},
|
|
1438
1440
|
textAutofit: {
|
|
1439
|
-
id:
|
|
1441
|
+
id: A.textAutofit,
|
|
1440
1442
|
type: "select",
|
|
1441
1443
|
label: "Autofit",
|
|
1442
1444
|
getValue: (e) => e.getAttribute("data-text-autofit") || "none",
|
|
1443
1445
|
setValue: (e, t) => {
|
|
1444
1446
|
let n = String(t);
|
|
1445
1447
|
n === "none" ? e.removeAttribute("data-text-autofit") : e.setAttribute("data-text-autofit", n);
|
|
1446
|
-
let r =
|
|
1447
|
-
|
|
1448
|
+
let r = O(e).runs;
|
|
1449
|
+
k(e, r);
|
|
1448
1450
|
},
|
|
1449
1451
|
options: [
|
|
1450
1452
|
{
|
|
@@ -1461,19 +1463,19 @@ var st = {
|
|
|
1461
1463
|
}
|
|
1462
1464
|
]
|
|
1463
1465
|
},
|
|
1464
|
-
textMarginLeft:
|
|
1465
|
-
textMarginRight:
|
|
1466
|
-
textMarginTop:
|
|
1467
|
-
textMarginBottom:
|
|
1468
|
-
textBold:
|
|
1469
|
-
textItalic:
|
|
1470
|
-
textUnderline:
|
|
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")),
|
|
1471
1473
|
redactStylePicker: {
|
|
1472
|
-
id:
|
|
1474
|
+
id: A.redactStylePicker,
|
|
1473
1475
|
type: "variantPicker",
|
|
1474
1476
|
label: "Redact style",
|
|
1475
|
-
getValue: (e) =>
|
|
1476
|
-
effect:
|
|
1477
|
+
getValue: (e) => Ct(e),
|
|
1478
|
+
effect: j.applyRedactStyle,
|
|
1477
1479
|
options: [
|
|
1478
1480
|
{
|
|
1479
1481
|
value: "mosaic",
|
|
@@ -1493,31 +1495,31 @@ var st = {
|
|
|
1493
1495
|
]
|
|
1494
1496
|
},
|
|
1495
1497
|
redactSolidColor: {
|
|
1496
|
-
id:
|
|
1498
|
+
id: A.redactSolidColor,
|
|
1497
1499
|
type: "color",
|
|
1498
1500
|
label: "Color",
|
|
1499
1501
|
getValue: (e) => e.getAttribute("fill") ?? "#111111",
|
|
1500
1502
|
setValue: (e, t) => {
|
|
1501
1503
|
e.setAttribute("fill", String(t));
|
|
1502
1504
|
},
|
|
1503
|
-
visibleWhen: (e) =>
|
|
1505
|
+
visibleWhen: (e) => Ct(e) === "solid"
|
|
1504
1506
|
},
|
|
1505
1507
|
highlightColorPicker: {
|
|
1506
|
-
id:
|
|
1508
|
+
id: A.highlightColorPicker,
|
|
1507
1509
|
type: "variantPicker",
|
|
1508
1510
|
label: "Highlight color",
|
|
1509
|
-
getValue: (e) => (e.getAttribute("fill") ??
|
|
1511
|
+
getValue: (e) => (e.getAttribute("fill") ?? v[0]?.value ?? "#ffff00").toLowerCase(),
|
|
1510
1512
|
setValue: (e, t) => {
|
|
1511
1513
|
e.setAttribute("fill", String(t));
|
|
1512
1514
|
},
|
|
1513
|
-
options:
|
|
1515
|
+
options: v.map((e) => ({
|
|
1514
1516
|
value: e.value,
|
|
1515
1517
|
label: e.label,
|
|
1516
1518
|
swatchColor: e.value
|
|
1517
1519
|
}))
|
|
1518
1520
|
},
|
|
1519
1521
|
highlightTransparency: {
|
|
1520
|
-
id:
|
|
1522
|
+
id: A.highlightTransparency,
|
|
1521
1523
|
type: "number",
|
|
1522
1524
|
label: "Transparency",
|
|
1523
1525
|
getValue: (e) => {
|
|
@@ -1534,71 +1536,71 @@ var st = {
|
|
|
1534
1536
|
unit: "%"
|
|
1535
1537
|
},
|
|
1536
1538
|
markerShapePicker: {
|
|
1537
|
-
id:
|
|
1539
|
+
id: A.markerShapePicker,
|
|
1538
1540
|
type: "variantPicker",
|
|
1539
1541
|
label: "Counter shape",
|
|
1540
|
-
getValue: (e) =>
|
|
1541
|
-
effect:
|
|
1542
|
+
getValue: (e) => gt(e),
|
|
1543
|
+
effect: j.applyMarkerShape,
|
|
1542
1544
|
options: [
|
|
1543
1545
|
{
|
|
1544
1546
|
value: "circle",
|
|
1545
1547
|
label: "Circle",
|
|
1546
|
-
iconSvg:
|
|
1548
|
+
iconSvg: _.circle
|
|
1547
1549
|
},
|
|
1548
1550
|
{
|
|
1549
1551
|
value: "rect",
|
|
1550
1552
|
label: "Square",
|
|
1551
|
-
iconSvg:
|
|
1553
|
+
iconSvg: _.rect
|
|
1552
1554
|
},
|
|
1553
1555
|
{
|
|
1554
1556
|
value: "rounded",
|
|
1555
1557
|
label: "Rounded square",
|
|
1556
|
-
iconSvg:
|
|
1558
|
+
iconSvg: _.rounded
|
|
1557
1559
|
}
|
|
1558
1560
|
]
|
|
1559
1561
|
},
|
|
1560
1562
|
markerSize: {
|
|
1561
|
-
id:
|
|
1563
|
+
id: A.markerSize,
|
|
1562
1564
|
type: "number",
|
|
1563
1565
|
label: "Size",
|
|
1564
|
-
getValue: (e) =>
|
|
1565
|
-
effect:
|
|
1566
|
+
getValue: (e) => St(e),
|
|
1567
|
+
effect: j.resizeMarker,
|
|
1566
1568
|
min: 8,
|
|
1567
1569
|
max: 96,
|
|
1568
1570
|
step: 1,
|
|
1569
1571
|
unit: "pt"
|
|
1570
1572
|
},
|
|
1571
1573
|
markerBgFillColor: {
|
|
1572
|
-
id:
|
|
1574
|
+
id: A.markerBgFillColor,
|
|
1573
1575
|
type: "color",
|
|
1574
1576
|
label: "Color",
|
|
1575
|
-
getValue: (e) =>
|
|
1577
|
+
getValue: (e) => M(e)?.getAttribute("fill") ?? "#ff0000",
|
|
1576
1578
|
setValue: (e, t) => {
|
|
1577
|
-
|
|
1579
|
+
M(e)?.setAttribute("fill", String(t));
|
|
1578
1580
|
},
|
|
1579
1581
|
allowNone: !0
|
|
1580
1582
|
},
|
|
1581
1583
|
markerBgStrokeColor: {
|
|
1582
|
-
id:
|
|
1584
|
+
id: A.markerBgStrokeColor,
|
|
1583
1585
|
type: "color",
|
|
1584
1586
|
label: "Color",
|
|
1585
|
-
getValue: (e) =>
|
|
1587
|
+
getValue: (e) => M(e)?.getAttribute("stroke") ?? "#ffffff",
|
|
1586
1588
|
setValue: (e, t) => {
|
|
1587
|
-
|
|
1589
|
+
M(e)?.setAttribute("stroke", String(t));
|
|
1588
1590
|
}
|
|
1589
1591
|
},
|
|
1590
1592
|
markerBgStrokeWidth: {
|
|
1591
|
-
id:
|
|
1593
|
+
id: A.markerBgStrokeWidth,
|
|
1592
1594
|
type: "number",
|
|
1593
1595
|
label: "Width",
|
|
1594
|
-
getValue: (e) => Number.parseFloat(
|
|
1596
|
+
getValue: (e) => Number.parseFloat(M(e)?.getAttribute("stroke-width") || "1.5"),
|
|
1595
1597
|
setValue: (e, t) => {
|
|
1596
|
-
let n =
|
|
1598
|
+
let n = M(e);
|
|
1597
1599
|
if (!n) return;
|
|
1598
1600
|
let r = Number(t);
|
|
1599
1601
|
n.setAttribute("stroke-width", String(r));
|
|
1600
1602
|
let i = n.getAttribute("data-dash-key");
|
|
1601
|
-
i && n.setAttribute("stroke-dasharray",
|
|
1603
|
+
i && n.setAttribute("stroke-dasharray", w(i, r));
|
|
1602
1604
|
},
|
|
1603
1605
|
min: 0,
|
|
1604
1606
|
max: 20,
|
|
@@ -1606,22 +1608,22 @@ var st = {
|
|
|
1606
1608
|
unit: "pt"
|
|
1607
1609
|
},
|
|
1608
1610
|
markerBgStrokeStyle: {
|
|
1609
|
-
id:
|
|
1611
|
+
id: A.markerBgStrokeStyle,
|
|
1610
1612
|
type: "select",
|
|
1611
1613
|
label: "Dash type",
|
|
1612
1614
|
getValue: (e) => {
|
|
1613
|
-
let t =
|
|
1615
|
+
let t = M(e);
|
|
1614
1616
|
if (!t) return "";
|
|
1615
1617
|
let n = t.getAttribute("data-dash-key");
|
|
1616
1618
|
if (n != null) return n;
|
|
1617
1619
|
let r = Number.parseFloat(t.getAttribute("stroke-width") || "1.5");
|
|
1618
|
-
return
|
|
1620
|
+
return xe(t.getAttribute("stroke-dasharray") || "", r) ?? "";
|
|
1619
1621
|
},
|
|
1620
1622
|
setValue: (e, t) => {
|
|
1621
|
-
let n =
|
|
1623
|
+
let n = M(e);
|
|
1622
1624
|
if (!n) return;
|
|
1623
1625
|
let r = String(t), i = Number.parseFloat(n.getAttribute("stroke-width") || "1.5");
|
|
1624
|
-
r ? (n.setAttribute("data-dash-key", r), n.setAttribute("stroke-dasharray",
|
|
1626
|
+
r ? (n.setAttribute("data-dash-key", r), n.setAttribute("stroke-dasharray", w(r, i))) : (n.removeAttribute("data-dash-key"), n.removeAttribute("stroke-dasharray"));
|
|
1625
1627
|
},
|
|
1626
1628
|
options: [
|
|
1627
1629
|
{
|
|
@@ -1647,7 +1649,7 @@ var st = {
|
|
|
1647
1649
|
]
|
|
1648
1650
|
},
|
|
1649
1651
|
markerLabelValue: {
|
|
1650
|
-
id:
|
|
1652
|
+
id: A.markerLabelValue,
|
|
1651
1653
|
type: "number",
|
|
1652
1654
|
label: "Value",
|
|
1653
1655
|
getValue: (e) => {
|
|
@@ -1665,34 +1667,34 @@ var st = {
|
|
|
1665
1667
|
step: 1
|
|
1666
1668
|
},
|
|
1667
1669
|
fillOpacity: {
|
|
1668
|
-
id:
|
|
1670
|
+
id: A.fillOpacity,
|
|
1669
1671
|
type: "number",
|
|
1670
1672
|
label: "Transparency",
|
|
1671
1673
|
getValue: (e) => {
|
|
1672
|
-
let t = Number.parseFloat(
|
|
1674
|
+
let t = Number.parseFloat(N(e, "fill-opacity") || "1");
|
|
1673
1675
|
return Math.round((1 - (Number.isFinite(t) ? t : 1)) * 100);
|
|
1674
1676
|
},
|
|
1675
1677
|
setValue: (e, t) => {
|
|
1676
1678
|
let n = 1 - Number(t) / 100;
|
|
1677
1679
|
e.setAttribute("fill-opacity", String(n));
|
|
1678
1680
|
},
|
|
1679
|
-
visibleWhen: (e) => !
|
|
1681
|
+
visibleWhen: (e) => !P(e) && e.tagName !== "path" && !wt(e),
|
|
1680
1682
|
min: 0,
|
|
1681
1683
|
max: 100,
|
|
1682
1684
|
step: 1,
|
|
1683
1685
|
unit: "%"
|
|
1684
1686
|
},
|
|
1685
1687
|
strokeOpacity: {
|
|
1686
|
-
id:
|
|
1688
|
+
id: A.strokeOpacity,
|
|
1687
1689
|
type: "number",
|
|
1688
1690
|
label: "Transparency",
|
|
1689
1691
|
getValue: (e) => {
|
|
1690
|
-
let t = e.getAttribute("opacity") ?? (
|
|
1692
|
+
let t = e.getAttribute("opacity") ?? (N(e, "stroke-opacity") || "1"), n = Number.parseFloat(t);
|
|
1691
1693
|
return Math.round((1 - (Number.isFinite(n) ? n : 1)) * 100);
|
|
1692
1694
|
},
|
|
1693
1695
|
setValue: (e, t) => {
|
|
1694
1696
|
let n = 1 - Number(t) / 100;
|
|
1695
|
-
for (let t of
|
|
1697
|
+
for (let t of _t(e)) P(t) ? (t.setAttribute("opacity", String(n)), t.removeAttribute("stroke-opacity")) : t.setAttribute("stroke-opacity", String(n));
|
|
1696
1698
|
},
|
|
1697
1699
|
min: 0,
|
|
1698
1700
|
max: 100,
|
|
@@ -1700,13 +1702,13 @@ var st = {
|
|
|
1700
1702
|
unit: "%"
|
|
1701
1703
|
},
|
|
1702
1704
|
strokeLinecap: {
|
|
1703
|
-
id:
|
|
1705
|
+
id: A.strokeLinecap,
|
|
1704
1706
|
type: "select",
|
|
1705
1707
|
label: "Cap type",
|
|
1706
|
-
getValue: (e) =>
|
|
1708
|
+
getValue: (e) => N(e, "stroke-linecap") ?? "butt",
|
|
1707
1709
|
setValue: (e, t) => {
|
|
1708
1710
|
let n = String(t);
|
|
1709
|
-
for (let t of
|
|
1711
|
+
for (let t of _t(e)) t.setAttribute("stroke-linecap", n);
|
|
1710
1712
|
},
|
|
1711
1713
|
options: [
|
|
1712
1714
|
{
|
|
@@ -1724,57 +1726,57 @@ var st = {
|
|
|
1724
1726
|
]
|
|
1725
1727
|
},
|
|
1726
1728
|
arrowStartShape: {
|
|
1727
|
-
id:
|
|
1729
|
+
id: A.arrowStartShape,
|
|
1728
1730
|
type: "select",
|
|
1729
1731
|
label: "Begin arrow type",
|
|
1730
|
-
getValue: (e) =>
|
|
1731
|
-
effect:
|
|
1732
|
-
visibleWhen:
|
|
1733
|
-
getOptions: (e) =>
|
|
1732
|
+
getValue: (e) => E(e, "start").shape,
|
|
1733
|
+
effect: j.applyArrowStartShape,
|
|
1734
|
+
visibleWhen: P,
|
|
1735
|
+
getOptions: (e) => bt("start", yt(e)),
|
|
1734
1736
|
selectColumns: 3,
|
|
1735
1737
|
selectPopupWidth: 170
|
|
1736
1738
|
},
|
|
1737
1739
|
arrowStartSize: {
|
|
1738
|
-
id:
|
|
1740
|
+
id: A.arrowStartSize,
|
|
1739
1741
|
type: "select",
|
|
1740
1742
|
label: "Begin arrow size",
|
|
1741
1743
|
getValue: (e) => {
|
|
1742
|
-
let t =
|
|
1744
|
+
let t = E(e, "start");
|
|
1743
1745
|
return `${t.width}-${t.length}`;
|
|
1744
1746
|
},
|
|
1745
|
-
effect:
|
|
1746
|
-
visibleWhen:
|
|
1747
|
-
options:
|
|
1747
|
+
effect: j.applyArrowStartSize,
|
|
1748
|
+
visibleWhen: P,
|
|
1749
|
+
options: xt("start"),
|
|
1748
1750
|
selectColumns: 3,
|
|
1749
1751
|
selectPopupWidth: 180
|
|
1750
1752
|
},
|
|
1751
1753
|
arrowEndShape: {
|
|
1752
|
-
id:
|
|
1754
|
+
id: A.arrowEndShape,
|
|
1753
1755
|
type: "select",
|
|
1754
1756
|
label: "End arrow type",
|
|
1755
|
-
getValue: (e) =>
|
|
1756
|
-
effect:
|
|
1757
|
-
visibleWhen:
|
|
1758
|
-
getOptions: (e) =>
|
|
1757
|
+
getValue: (e) => E(e, "end").shape,
|
|
1758
|
+
effect: j.applyArrowEndShape,
|
|
1759
|
+
visibleWhen: P,
|
|
1760
|
+
getOptions: (e) => bt("end", yt(e)),
|
|
1759
1761
|
selectColumns: 3,
|
|
1760
1762
|
selectPopupWidth: 170
|
|
1761
1763
|
},
|
|
1762
1764
|
arrowEndSize: {
|
|
1763
|
-
id:
|
|
1765
|
+
id: A.arrowEndSize,
|
|
1764
1766
|
type: "select",
|
|
1765
1767
|
label: "End arrow size",
|
|
1766
1768
|
getValue: (e) => {
|
|
1767
|
-
let t =
|
|
1769
|
+
let t = E(e, "end");
|
|
1768
1770
|
return `${t.width}-${t.length}`;
|
|
1769
1771
|
},
|
|
1770
|
-
effect:
|
|
1771
|
-
visibleWhen:
|
|
1772
|
-
options:
|
|
1772
|
+
effect: j.applyArrowEndSize,
|
|
1773
|
+
visibleWhen: P,
|
|
1774
|
+
options: xt("end"),
|
|
1773
1775
|
selectColumns: 3,
|
|
1774
1776
|
selectPopupWidth: 180
|
|
1775
1777
|
}
|
|
1776
1778
|
};
|
|
1777
|
-
function
|
|
1779
|
+
function Et(e) {
|
|
1778
1780
|
let t = e.tagName;
|
|
1779
1781
|
if (t === "g") {
|
|
1780
1782
|
let t = e.getAttribute("data-type");
|
|
@@ -1787,7 +1789,7 @@ function ct(e) {
|
|
|
1787
1789
|
let n = e.getAttribute("data-redact-style");
|
|
1788
1790
|
return n === "mosaic" ? "redact-mosaic" : n === "solid" ? "redact-solid" : n === "blur" ? "redact-blur" : "shape";
|
|
1789
1791
|
}
|
|
1790
|
-
function
|
|
1792
|
+
function Dt(e, t, n) {
|
|
1791
1793
|
return {
|
|
1792
1794
|
id: e,
|
|
1793
1795
|
type: "number",
|
|
@@ -1802,8 +1804,8 @@ function q(e, t, n) {
|
|
|
1802
1804
|
let r = Number(t);
|
|
1803
1805
|
if (!Number.isFinite(r) || r < 0) return;
|
|
1804
1806
|
e.setAttribute(n, String(r));
|
|
1805
|
-
let i =
|
|
1806
|
-
|
|
1807
|
+
let i = O(e).runs;
|
|
1808
|
+
k(e, i);
|
|
1807
1809
|
},
|
|
1808
1810
|
min: 0,
|
|
1809
1811
|
max: 200,
|
|
@@ -1811,7 +1813,7 @@ function q(e, t, n) {
|
|
|
1811
1813
|
unit: "px"
|
|
1812
1814
|
};
|
|
1813
1815
|
}
|
|
1814
|
-
function
|
|
1816
|
+
function Ot(e, t, n, r, i) {
|
|
1815
1817
|
return {
|
|
1816
1818
|
id: e,
|
|
1817
1819
|
type: "select",
|
|
@@ -1836,13 +1838,13 @@ function lt(e, t, n, r, i) {
|
|
|
1836
1838
|
}]
|
|
1837
1839
|
};
|
|
1838
1840
|
}
|
|
1839
|
-
function
|
|
1841
|
+
function kt(e) {
|
|
1840
1842
|
if (e.length === 0) return {
|
|
1841
1843
|
category: null,
|
|
1842
1844
|
uniform: !0
|
|
1843
1845
|
};
|
|
1844
|
-
let t =
|
|
1845
|
-
for (let n = 1; n < e.length; n++) if (
|
|
1846
|
+
let t = Et(e[0]);
|
|
1847
|
+
for (let n = 1; n < e.length; n++) if (Et(e[n]) !== t) return {
|
|
1846
1848
|
category: t,
|
|
1847
1849
|
uniform: !1
|
|
1848
1850
|
};
|
|
@@ -1853,14 +1855,14 @@ function ut(e) {
|
|
|
1853
1855
|
}
|
|
1854
1856
|
//#endregion
|
|
1855
1857
|
//#region src/editor/selection-geometry.ts
|
|
1856
|
-
function
|
|
1858
|
+
function At(e, t, n, r, i) {
|
|
1857
1859
|
let a = Math.cos(i), o = Math.sin(i);
|
|
1858
1860
|
return {
|
|
1859
1861
|
x: n + (e - n) * a - (t - r) * o,
|
|
1860
1862
|
y: r + (e - n) * o + (t - r) * a
|
|
1861
1863
|
};
|
|
1862
1864
|
}
|
|
1863
|
-
var
|
|
1865
|
+
var jt = [
|
|
1864
1866
|
"ew-resize",
|
|
1865
1867
|
"nwse-resize",
|
|
1866
1868
|
"ns-resize",
|
|
@@ -1870,11 +1872,11 @@ var ft = [
|
|
|
1870
1872
|
"ns-resize",
|
|
1871
1873
|
"nesw-resize"
|
|
1872
1874
|
];
|
|
1873
|
-
function
|
|
1875
|
+
function Mt(e) {
|
|
1874
1876
|
let t = Math.PI * 2, n = (e % t + t) % t;
|
|
1875
|
-
return n += Math.PI / 8, n >= t && (n -= t),
|
|
1877
|
+
return n += Math.PI / 8, n >= t && (n -= t), jt[Math.floor(n / (Math.PI / 4)) % 8];
|
|
1876
1878
|
}
|
|
1877
|
-
function
|
|
1879
|
+
function Nt(e) {
|
|
1878
1880
|
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
|
|
1879
1881
|
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);
|
|
1880
1882
|
return {
|
|
@@ -1884,14 +1886,14 @@ function mt(e) {
|
|
|
1884
1886
|
height: i - n
|
|
1885
1887
|
};
|
|
1886
1888
|
}
|
|
1887
|
-
function
|
|
1889
|
+
function Pt(e) {
|
|
1888
1890
|
let { draggedBoxes: t, dx: n, dy: r, otherBoxes: i, threshold: a } = e;
|
|
1889
1891
|
if (t.length === 0 || i.length === 0) return {
|
|
1890
1892
|
dx: n,
|
|
1891
1893
|
dy: r,
|
|
1892
1894
|
guides: []
|
|
1893
1895
|
};
|
|
1894
|
-
let o =
|
|
1896
|
+
let o = Nt(t), s = {
|
|
1895
1897
|
left: o.x + n,
|
|
1896
1898
|
right: o.x + o.width + n,
|
|
1897
1899
|
centerX: o.x + o.width / 2 + n,
|
|
@@ -1964,20 +1966,20 @@ function ht(e) {
|
|
|
1964
1966
|
}
|
|
1965
1967
|
//#endregion
|
|
1966
1968
|
//#region src/editor/svg-format.ts
|
|
1967
|
-
var
|
|
1968
|
-
function
|
|
1969
|
-
e.setAttribute(
|
|
1969
|
+
var Ft = "1", It = "0", Lt = "data-annot-version";
|
|
1970
|
+
function Rt(e) {
|
|
1971
|
+
e.setAttribute(Lt, "1");
|
|
1970
1972
|
}
|
|
1971
|
-
function
|
|
1973
|
+
function zt(e) {
|
|
1972
1974
|
return e.getAttribute("data-annot-version") || "0";
|
|
1973
1975
|
}
|
|
1974
|
-
function
|
|
1976
|
+
function Bt(e) {
|
|
1975
1977
|
let t = /\sdata-annot-version="([^"]*)"/.exec(e);
|
|
1976
1978
|
return t ? t[1] : "0";
|
|
1977
1979
|
}
|
|
1978
1980
|
//#endregion
|
|
1979
1981
|
//#region src/editor/tool-lifecycle.ts
|
|
1980
|
-
function
|
|
1982
|
+
function Vt(e) {
|
|
1981
1983
|
let t = [], n = [], r = {
|
|
1982
1984
|
drafts: t,
|
|
1983
1985
|
committed: n,
|
|
@@ -1996,32 +1998,32 @@ function St(e) {
|
|
|
1996
1998
|
}
|
|
1997
1999
|
//#endregion
|
|
1998
2000
|
//#region src/editor/tool-style-writer.ts
|
|
1999
|
-
function
|
|
2000
|
-
t.strokeColor && e.setAttribute("stroke", t.strokeColor), t.strokeWidth != null && e.setAttribute("stroke-width", String(t.strokeWidth)), t.strokeDasharray != null && (e.setAttribute("stroke-dasharray",
|
|
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)));
|
|
2001
2003
|
}
|
|
2002
2004
|
//#endregion
|
|
2003
2005
|
//#region src/editor/tool-registry.ts
|
|
2004
|
-
var
|
|
2006
|
+
var Ut = [
|
|
2005
2007
|
"tool.typeChips",
|
|
2006
2008
|
"tool.transparencyPercent",
|
|
2007
2009
|
"tool.fillTransparencyPercent",
|
|
2008
2010
|
"tool.fillOpacityPercent",
|
|
2009
2011
|
"tool.freehandDone"
|
|
2010
|
-
],
|
|
2012
|
+
], Wt = [
|
|
2011
2013
|
"strokeColor",
|
|
2012
2014
|
"strokeWidth",
|
|
2013
2015
|
"strokeDasharray",
|
|
2014
2016
|
"strokeOpacity",
|
|
2015
2017
|
"strokeLinecap"
|
|
2016
2018
|
];
|
|
2017
|
-
function
|
|
2019
|
+
function Gt(e) {
|
|
2018
2020
|
return e.getAttribute("data-highlight") === "1" || e.getAttribute("data-redact-style") === "solid" ? null : e.hasAttribute("data-rounded") ? "rounded" : "rect";
|
|
2019
2021
|
}
|
|
2020
|
-
function
|
|
2022
|
+
function Kt(e) {
|
|
2021
2023
|
let t = (e.getAttribute("data-arrow-start-shape") ?? "none") !== "none", n = (e.getAttribute("data-arrow-end-shape") ?? "none") !== "none";
|
|
2022
2024
|
return t && n ? "both" : t || n ? "end" : "none";
|
|
2023
2025
|
}
|
|
2024
|
-
function
|
|
2026
|
+
function qt(e, t, n) {
|
|
2025
2027
|
if (e !== "arrow") return;
|
|
2026
2028
|
let r = n, i = "triangle", a = "none", o = n.arrowHeadStart, s = n.arrowHeadEnd;
|
|
2027
2029
|
switch (t) {
|
|
@@ -2036,7 +2038,7 @@ function Et(e, t, n) {
|
|
|
2036
2038
|
break;
|
|
2037
2039
|
}
|
|
2038
2040
|
}
|
|
2039
|
-
var
|
|
2041
|
+
var Jt = {
|
|
2040
2042
|
arrow: {
|
|
2041
2043
|
id: "arrow",
|
|
2042
2044
|
label: "Line",
|
|
@@ -2048,23 +2050,23 @@ var Dt = {
|
|
|
2048
2050
|
value: "none",
|
|
2049
2051
|
icon: "horizontal_rule",
|
|
2050
2052
|
label: "Line (no arrow)",
|
|
2051
|
-
svg:
|
|
2053
|
+
svg: g.none
|
|
2052
2054
|
},
|
|
2053
2055
|
{
|
|
2054
2056
|
value: "end",
|
|
2055
2057
|
icon: "north_east",
|
|
2056
2058
|
label: "Arrow",
|
|
2057
|
-
svg:
|
|
2059
|
+
svg: g.end
|
|
2058
2060
|
},
|
|
2059
2061
|
{
|
|
2060
2062
|
value: "both",
|
|
2061
2063
|
icon: "sync_alt",
|
|
2062
2064
|
label: "Double arrow",
|
|
2063
|
-
svg:
|
|
2065
|
+
svg: g.both
|
|
2064
2066
|
}
|
|
2065
2067
|
],
|
|
2066
2068
|
presetFields: [
|
|
2067
|
-
...
|
|
2069
|
+
...Wt,
|
|
2068
2070
|
"arrowHead",
|
|
2069
2071
|
"arrowHeadStart",
|
|
2070
2072
|
"arrowHeadEnd",
|
|
@@ -2080,7 +2082,7 @@ var Dt = {
|
|
|
2080
2082
|
},
|
|
2081
2083
|
{
|
|
2082
2084
|
section: "Line",
|
|
2083
|
-
id:
|
|
2085
|
+
id: A.strokeColor
|
|
2084
2086
|
},
|
|
2085
2087
|
{
|
|
2086
2088
|
section: "Line",
|
|
@@ -2088,43 +2090,43 @@ var Dt = {
|
|
|
2088
2090
|
},
|
|
2089
2091
|
{
|
|
2090
2092
|
section: "Line",
|
|
2091
|
-
id:
|
|
2093
|
+
id: A.strokeWidth
|
|
2092
2094
|
},
|
|
2093
2095
|
{
|
|
2094
2096
|
section: "Line",
|
|
2095
|
-
id:
|
|
2097
|
+
id: A.strokeStyle
|
|
2096
2098
|
},
|
|
2097
2099
|
{
|
|
2098
2100
|
section: "Line",
|
|
2099
|
-
id:
|
|
2101
|
+
id: A.strokeLinecap
|
|
2100
2102
|
},
|
|
2101
2103
|
{
|
|
2102
2104
|
section: "Line",
|
|
2103
|
-
id:
|
|
2105
|
+
id: A.arrowStartShape
|
|
2104
2106
|
},
|
|
2105
2107
|
{
|
|
2106
2108
|
section: "Line",
|
|
2107
|
-
id:
|
|
2109
|
+
id: A.arrowStartSize
|
|
2108
2110
|
},
|
|
2109
2111
|
{
|
|
2110
2112
|
section: "Line",
|
|
2111
|
-
id:
|
|
2113
|
+
id: A.arrowEndShape
|
|
2112
2114
|
},
|
|
2113
2115
|
{
|
|
2114
2116
|
section: "Line",
|
|
2115
|
-
id:
|
|
2117
|
+
id: A.arrowEndSize
|
|
2116
2118
|
}
|
|
2117
2119
|
],
|
|
2118
2120
|
variantKeyForElement(e) {
|
|
2119
|
-
return e.tagName === "line" || e.tagName === "g" && e.getAttribute("data-type") === "arrow" ? `arrow.${
|
|
2121
|
+
return e.tagName === "line" || e.tagName === "g" && e.getAttribute("data-type") === "arrow" ? `arrow.${Kt(e)}` : null;
|
|
2120
2122
|
},
|
|
2121
2123
|
extractStyleFromElement(e, t) {
|
|
2122
|
-
t.arrowHead =
|
|
2124
|
+
t.arrowHead = Kt(e);
|
|
2123
2125
|
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");
|
|
2124
|
-
n && (t.arrowHeadStart = n), r && (t.arrowHeadEnd = r), i && (t.arrowWidthStart = i), a && (t.arrowLengthStart = a), o && (t.arrowWidthEnd = o), s && (t.arrowLengthEnd = s),
|
|
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);
|
|
2125
2127
|
},
|
|
2126
2128
|
applyStyleToElement(e, t) {
|
|
2127
|
-
|
|
2129
|
+
Ht(e, t), e.tagName === "g" && e.getAttribute("data-type") === "arrow" && Ie(e);
|
|
2128
2130
|
}
|
|
2129
2131
|
},
|
|
2130
2132
|
shape: {
|
|
@@ -2138,23 +2140,23 @@ var Dt = {
|
|
|
2138
2140
|
value: "rect",
|
|
2139
2141
|
icon: "rectangle",
|
|
2140
2142
|
label: "Rectangle",
|
|
2141
|
-
svg:
|
|
2143
|
+
svg: h.rect
|
|
2142
2144
|
},
|
|
2143
2145
|
{
|
|
2144
2146
|
value: "rounded",
|
|
2145
2147
|
icon: "crop_square",
|
|
2146
2148
|
label: "Rounded rectangle",
|
|
2147
|
-
svg:
|
|
2149
|
+
svg: h.rounded
|
|
2148
2150
|
},
|
|
2149
2151
|
{
|
|
2150
2152
|
value: "ellipse",
|
|
2151
2153
|
icon: "circle",
|
|
2152
2154
|
label: "Ellipse",
|
|
2153
|
-
svg:
|
|
2155
|
+
svg: h.ellipse
|
|
2154
2156
|
}
|
|
2155
2157
|
],
|
|
2156
2158
|
presetFields: [
|
|
2157
|
-
...
|
|
2159
|
+
...Wt,
|
|
2158
2160
|
"fillColor",
|
|
2159
2161
|
"fillOpacity",
|
|
2160
2162
|
"shapeType",
|
|
@@ -2167,7 +2169,7 @@ var Dt = {
|
|
|
2167
2169
|
},
|
|
2168
2170
|
{
|
|
2169
2171
|
section: "Fill",
|
|
2170
|
-
id:
|
|
2172
|
+
id: A.fillColor
|
|
2171
2173
|
},
|
|
2172
2174
|
{
|
|
2173
2175
|
section: "Fill",
|
|
@@ -2175,7 +2177,7 @@ var Dt = {
|
|
|
2175
2177
|
},
|
|
2176
2178
|
{
|
|
2177
2179
|
section: "Line",
|
|
2178
|
-
id:
|
|
2180
|
+
id: A.strokeColor
|
|
2179
2181
|
},
|
|
2180
2182
|
{
|
|
2181
2183
|
section: "Line",
|
|
@@ -2183,21 +2185,21 @@ var Dt = {
|
|
|
2183
2185
|
},
|
|
2184
2186
|
{
|
|
2185
2187
|
section: "Line",
|
|
2186
|
-
id:
|
|
2188
|
+
id: A.strokeWidth
|
|
2187
2189
|
},
|
|
2188
2190
|
{
|
|
2189
2191
|
section: "Line",
|
|
2190
|
-
id:
|
|
2192
|
+
id: A.strokeStyle
|
|
2191
2193
|
},
|
|
2192
2194
|
{
|
|
2193
2195
|
section: "Line",
|
|
2194
|
-
id:
|
|
2196
|
+
id: A.strokeLinecap
|
|
2195
2197
|
}
|
|
2196
2198
|
],
|
|
2197
2199
|
variantKeyForElement(e) {
|
|
2198
2200
|
if (e.tagName === "ellipse") return "shape.ellipse";
|
|
2199
2201
|
if (e.tagName === "rect") {
|
|
2200
|
-
let t =
|
|
2202
|
+
let t = Gt(e);
|
|
2201
2203
|
return t ? `shape.${t}` : null;
|
|
2202
2204
|
}
|
|
2203
2205
|
return null;
|
|
@@ -2206,7 +2208,7 @@ var Dt = {
|
|
|
2206
2208
|
e.tagName === "ellipse" ? t.shapeType = "ellipse" : e.tagName === "rect" && (t.shapeType = e.hasAttribute("data-rounded") ? "rounded" : "rect");
|
|
2207
2209
|
},
|
|
2208
2210
|
applyStyleToElement(e, t) {
|
|
2209
|
-
|
|
2211
|
+
Ht(e, t);
|
|
2210
2212
|
}
|
|
2211
2213
|
},
|
|
2212
2214
|
highlight: {
|
|
@@ -2214,8 +2216,8 @@ var Dt = {
|
|
|
2214
2216
|
label: "Highlight",
|
|
2215
2217
|
icon: "ink_highlighter",
|
|
2216
2218
|
variantField: "highlightColor",
|
|
2217
|
-
defaultVariant:
|
|
2218
|
-
variants:
|
|
2219
|
+
defaultVariant: v[0].value,
|
|
2220
|
+
variants: v.map((e) => ({
|
|
2219
2221
|
value: e.value,
|
|
2220
2222
|
icon: "ink_highlighter",
|
|
2221
2223
|
label: e.label
|
|
@@ -2223,7 +2225,7 @@ var Dt = {
|
|
|
2223
2225
|
flyoutKind: "color",
|
|
2224
2226
|
tooltipLabelForVariant: (e) => {
|
|
2225
2227
|
let t = e.toLowerCase();
|
|
2226
|
-
return
|
|
2228
|
+
return v.find((e) => e.value === t)?.label ?? "";
|
|
2227
2229
|
},
|
|
2228
2230
|
ensurePresetForVariantChange: (e) => {
|
|
2229
2231
|
e.shapeType = "highlight";
|
|
@@ -2239,7 +2241,7 @@ var Dt = {
|
|
|
2239
2241
|
variantKeyForElement(e) {
|
|
2240
2242
|
if (e.tagName !== "rect" || e.getAttribute("data-highlight") !== "1") return null;
|
|
2241
2243
|
let t = e.getAttribute("fill");
|
|
2242
|
-
return `highlight.${t ? t.toLowerCase() :
|
|
2244
|
+
return `highlight.${t ? t.toLowerCase() : v[0].value}`;
|
|
2243
2245
|
},
|
|
2244
2246
|
extractStyleFromElement(e, t) {
|
|
2245
2247
|
let n = e.getAttribute("fill");
|
|
@@ -2288,23 +2290,23 @@ var Dt = {
|
|
|
2288
2290
|
},
|
|
2289
2291
|
{
|
|
2290
2292
|
section: "Line",
|
|
2291
|
-
id:
|
|
2293
|
+
id: A.strokeColor
|
|
2292
2294
|
},
|
|
2293
2295
|
{
|
|
2294
2296
|
section: "Line",
|
|
2295
|
-
id:
|
|
2297
|
+
id: A.fontFamily
|
|
2296
2298
|
},
|
|
2297
2299
|
{
|
|
2298
2300
|
section: "Line",
|
|
2299
|
-
id:
|
|
2301
|
+
id: A.fontSize
|
|
2300
2302
|
},
|
|
2301
2303
|
{
|
|
2302
2304
|
section: "Label",
|
|
2303
|
-
id:
|
|
2305
|
+
id: A.textAnchor
|
|
2304
2306
|
},
|
|
2305
2307
|
{
|
|
2306
2308
|
section: "Label",
|
|
2307
|
-
id:
|
|
2309
|
+
id: A.textVerticalAnchor
|
|
2308
2310
|
}
|
|
2309
2311
|
],
|
|
2310
2312
|
variantKeyForElement(e) {
|
|
@@ -2347,7 +2349,7 @@ var Dt = {
|
|
|
2347
2349
|
}
|
|
2348
2350
|
return;
|
|
2349
2351
|
}
|
|
2350
|
-
|
|
2352
|
+
Ht(e, t);
|
|
2351
2353
|
}
|
|
2352
2354
|
},
|
|
2353
2355
|
freehand: {
|
|
@@ -2365,7 +2367,7 @@ var Dt = {
|
|
|
2365
2367
|
icon: "ink_highlighter",
|
|
2366
2368
|
label: "Highlighter"
|
|
2367
2369
|
}],
|
|
2368
|
-
presetFields: [...
|
|
2370
|
+
presetFields: [...Wt, "drawStyle"],
|
|
2369
2371
|
panelControls: [
|
|
2370
2372
|
{
|
|
2371
2373
|
section: "Type",
|
|
@@ -2373,7 +2375,7 @@ var Dt = {
|
|
|
2373
2375
|
},
|
|
2374
2376
|
{
|
|
2375
2377
|
section: "Line",
|
|
2376
|
-
id:
|
|
2378
|
+
id: A.strokeColor
|
|
2377
2379
|
},
|
|
2378
2380
|
{
|
|
2379
2381
|
section: "Line",
|
|
@@ -2381,15 +2383,15 @@ var Dt = {
|
|
|
2381
2383
|
},
|
|
2382
2384
|
{
|
|
2383
2385
|
section: "Line",
|
|
2384
|
-
id:
|
|
2386
|
+
id: A.strokeWidth
|
|
2385
2387
|
},
|
|
2386
2388
|
{
|
|
2387
2389
|
section: "Line",
|
|
2388
|
-
id:
|
|
2390
|
+
id: A.strokeStyle
|
|
2389
2391
|
},
|
|
2390
2392
|
{
|
|
2391
2393
|
section: "Line",
|
|
2392
|
-
id:
|
|
2394
|
+
id: A.strokeLinecap
|
|
2393
2395
|
},
|
|
2394
2396
|
{
|
|
2395
2397
|
section: "Line",
|
|
@@ -2404,7 +2406,7 @@ var Dt = {
|
|
|
2404
2406
|
(n === "pen" || n === "highlighter") && (t.drawStyle = n);
|
|
2405
2407
|
},
|
|
2406
2408
|
applyStyleToElement(e, t) {
|
|
2407
|
-
|
|
2409
|
+
Ht(e, t);
|
|
2408
2410
|
}
|
|
2409
2411
|
},
|
|
2410
2412
|
marker: {
|
|
@@ -2418,23 +2420,23 @@ var Dt = {
|
|
|
2418
2420
|
value: "circle",
|
|
2419
2421
|
icon: "circle",
|
|
2420
2422
|
label: "Circle",
|
|
2421
|
-
svg:
|
|
2423
|
+
svg: _.circle
|
|
2422
2424
|
},
|
|
2423
2425
|
{
|
|
2424
2426
|
value: "rect",
|
|
2425
2427
|
icon: "square",
|
|
2426
2428
|
label: "Square",
|
|
2427
|
-
svg:
|
|
2429
|
+
svg: _.rect
|
|
2428
2430
|
},
|
|
2429
2431
|
{
|
|
2430
2432
|
value: "rounded",
|
|
2431
2433
|
icon: "crop_square",
|
|
2432
2434
|
label: "Rounded square",
|
|
2433
|
-
svg:
|
|
2435
|
+
svg: _.rounded
|
|
2434
2436
|
}
|
|
2435
2437
|
],
|
|
2436
2438
|
presetFields: [
|
|
2437
|
-
...
|
|
2439
|
+
...Wt,
|
|
2438
2440
|
"fillColor",
|
|
2439
2441
|
"fontSize",
|
|
2440
2442
|
"markerShape"
|
|
@@ -2446,23 +2448,23 @@ var Dt = {
|
|
|
2446
2448
|
},
|
|
2447
2449
|
{
|
|
2448
2450
|
section: "Fill",
|
|
2449
|
-
id:
|
|
2451
|
+
id: A.fillColor
|
|
2450
2452
|
},
|
|
2451
2453
|
{
|
|
2452
2454
|
section: "Line",
|
|
2453
|
-
id:
|
|
2455
|
+
id: A.strokeColor
|
|
2454
2456
|
},
|
|
2455
2457
|
{
|
|
2456
2458
|
section: "Line",
|
|
2457
|
-
id:
|
|
2459
|
+
id: A.strokeWidth
|
|
2458
2460
|
},
|
|
2459
2461
|
{
|
|
2460
2462
|
section: "Line",
|
|
2461
|
-
id:
|
|
2463
|
+
id: A.strokeStyle
|
|
2462
2464
|
},
|
|
2463
2465
|
{
|
|
2464
2466
|
section: "Label",
|
|
2465
|
-
id:
|
|
2467
|
+
id: A.fontSize
|
|
2466
2468
|
}
|
|
2467
2469
|
],
|
|
2468
2470
|
variantKeyForElement(e) {
|
|
@@ -2487,7 +2489,7 @@ var Dt = {
|
|
|
2487
2489
|
if (n) {
|
|
2488
2490
|
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) {
|
|
2489
2491
|
let e = t.strokeWidth ?? Number.parseFloat(n.getAttribute("stroke-width") || "1.5");
|
|
2490
|
-
n.setAttribute("stroke-dasharray",
|
|
2492
|
+
n.setAttribute("stroke-dasharray", w(t.strokeDasharray, e)), n.setAttribute("data-dash-key", t.strokeDasharray);
|
|
2491
2493
|
}
|
|
2492
2494
|
if (t.fontSize != null) {
|
|
2493
2495
|
let n = e.querySelector("text");
|
|
@@ -2525,7 +2527,7 @@ var Dt = {
|
|
|
2525
2527
|
id: "tool.typeChips"
|
|
2526
2528
|
}, {
|
|
2527
2529
|
section: "Fill",
|
|
2528
|
-
id:
|
|
2530
|
+
id: A.fillColor,
|
|
2529
2531
|
visibleWhen: (e) => e.redactStyle === "solid"
|
|
2530
2532
|
}],
|
|
2531
2533
|
variantKeyForElement(e) {
|
|
@@ -2550,8 +2552,15 @@ var Dt = {
|
|
|
2550
2552
|
icon: "crop",
|
|
2551
2553
|
category: "image-op",
|
|
2552
2554
|
presetFields: []
|
|
2555
|
+
},
|
|
2556
|
+
overlay: {
|
|
2557
|
+
id: "overlay",
|
|
2558
|
+
label: "Overlay",
|
|
2559
|
+
icon: "label",
|
|
2560
|
+
category: "annotation",
|
|
2561
|
+
presetFields: []
|
|
2553
2562
|
}
|
|
2554
|
-
},
|
|
2563
|
+
}, Yt = [
|
|
2555
2564
|
"arrow",
|
|
2556
2565
|
"shape",
|
|
2557
2566
|
"highlight",
|
|
@@ -2559,147 +2568,148 @@ var Dt = {
|
|
|
2559
2568
|
"freehand",
|
|
2560
2569
|
"marker",
|
|
2561
2570
|
"redact",
|
|
2562
|
-
"crop"
|
|
2563
|
-
|
|
2564
|
-
|
|
2571
|
+
"crop",
|
|
2572
|
+
"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) {
|
|
2565
2575
|
return e === "sm" || e === "md" || e === "lg";
|
|
2566
2576
|
}
|
|
2567
|
-
function
|
|
2577
|
+
function tn(e, t) {
|
|
2568
2578
|
return e ?? t;
|
|
2569
2579
|
}
|
|
2570
|
-
function
|
|
2571
|
-
return `${
|
|
2580
|
+
function nn(e, t) {
|
|
2581
|
+
return `${tn(e, "md")}-${tn(t, "md")}`;
|
|
2572
2582
|
}
|
|
2573
|
-
function
|
|
2583
|
+
function rn(e) {
|
|
2574
2584
|
let [t, n] = e.split("-");
|
|
2575
2585
|
return {
|
|
2576
|
-
width: t &&
|
|
2577
|
-
length: n &&
|
|
2586
|
+
width: t && en(t) ? t : "md",
|
|
2587
|
+
length: n && en(n) ? n : "md"
|
|
2578
2588
|
};
|
|
2579
2589
|
}
|
|
2580
|
-
var
|
|
2581
|
-
[
|
|
2590
|
+
var an = {
|
|
2591
|
+
[A.strokeColor]: {
|
|
2582
2592
|
read: (e) => e.strokeColor,
|
|
2583
2593
|
write: (e, t) => {
|
|
2584
2594
|
e.strokeColor = String(t);
|
|
2585
2595
|
},
|
|
2586
|
-
selectionDef:
|
|
2596
|
+
selectionDef: A.strokeColor
|
|
2587
2597
|
},
|
|
2588
|
-
[
|
|
2598
|
+
[A.strokeWidth]: {
|
|
2589
2599
|
read: (e) => e.strokeWidth,
|
|
2590
2600
|
write: (e, t) => {
|
|
2591
2601
|
e.strokeWidth = Number(t);
|
|
2592
2602
|
},
|
|
2593
|
-
selectionDef:
|
|
2603
|
+
selectionDef: A.strokeWidth
|
|
2594
2604
|
},
|
|
2595
|
-
[
|
|
2605
|
+
[A.strokeStyle]: {
|
|
2596
2606
|
read: (e) => e.strokeDasharray ?? "",
|
|
2597
2607
|
write: (e, t) => {
|
|
2598
2608
|
e.strokeDasharray = String(t);
|
|
2599
2609
|
},
|
|
2600
|
-
selectionDef:
|
|
2610
|
+
selectionDef: A.strokeStyle
|
|
2601
2611
|
},
|
|
2602
|
-
[
|
|
2612
|
+
[A.strokeLinecap]: {
|
|
2603
2613
|
read: (e) => e.strokeLinecap ?? "butt",
|
|
2604
2614
|
write: (e, t) => {
|
|
2605
2615
|
e.strokeLinecap = t;
|
|
2606
2616
|
},
|
|
2607
|
-
selectionDef:
|
|
2617
|
+
selectionDef: A.strokeLinecap
|
|
2608
2618
|
},
|
|
2609
|
-
[
|
|
2619
|
+
[A.fillColor]: {
|
|
2610
2620
|
read: (e) => e.fillColor,
|
|
2611
2621
|
write: (e, t) => {
|
|
2612
2622
|
e.fillColor = String(t);
|
|
2613
2623
|
},
|
|
2614
|
-
selectionDef:
|
|
2624
|
+
selectionDef: A.fillColor
|
|
2615
2625
|
},
|
|
2616
|
-
[
|
|
2626
|
+
[A.fontSize]: {
|
|
2617
2627
|
read: (e) => e.fontSize,
|
|
2618
2628
|
write: (e, t) => {
|
|
2619
2629
|
e.fontSize = Number(t);
|
|
2620
2630
|
},
|
|
2621
|
-
selectionDef:
|
|
2631
|
+
selectionDef: A.fontSize
|
|
2622
2632
|
},
|
|
2623
|
-
[
|
|
2624
|
-
read: (e) =>
|
|
2633
|
+
[A.fontFamily]: {
|
|
2634
|
+
read: (e) => f(e.fontFamily),
|
|
2625
2635
|
write: (e, t) => {
|
|
2626
|
-
e.fontFamily =
|
|
2636
|
+
e.fontFamily = f(String(t));
|
|
2627
2637
|
},
|
|
2628
|
-
selectionDef:
|
|
2638
|
+
selectionDef: A.fontFamily
|
|
2629
2639
|
},
|
|
2630
|
-
[
|
|
2640
|
+
[A.textAnchor]: {
|
|
2631
2641
|
read: (e) => e.textAnchor ?? "start",
|
|
2632
2642
|
write: (e, t) => {
|
|
2633
2643
|
e.textAnchor = t;
|
|
2634
2644
|
},
|
|
2635
|
-
selectionDef:
|
|
2645
|
+
selectionDef: A.textAnchor
|
|
2636
2646
|
},
|
|
2637
|
-
[
|
|
2647
|
+
[A.textVerticalAnchor]: {
|
|
2638
2648
|
read: (e) => e.textVerticalAnchor ?? "top",
|
|
2639
2649
|
write: (e, t) => {
|
|
2640
2650
|
e.textVerticalAnchor = t;
|
|
2641
2651
|
},
|
|
2642
|
-
selectionDef:
|
|
2652
|
+
selectionDef: A.textVerticalAnchor
|
|
2643
2653
|
},
|
|
2644
|
-
[
|
|
2654
|
+
[A.arrowStartShape]: {
|
|
2645
2655
|
read: (e) => e.arrowHeadStart ?? "none",
|
|
2646
2656
|
write: (e, t) => {
|
|
2647
2657
|
e.arrowHeadStart = t;
|
|
2648
2658
|
},
|
|
2649
|
-
selectionDef:
|
|
2659
|
+
selectionDef: A.arrowStartShape
|
|
2650
2660
|
},
|
|
2651
|
-
[
|
|
2661
|
+
[A.arrowEndShape]: {
|
|
2652
2662
|
read: (e) => e.arrowHeadEnd ?? "triangle",
|
|
2653
2663
|
write: (e, t) => {
|
|
2654
2664
|
e.arrowHeadEnd = t;
|
|
2655
2665
|
},
|
|
2656
|
-
selectionDef:
|
|
2666
|
+
selectionDef: A.arrowEndShape
|
|
2657
2667
|
},
|
|
2658
|
-
[
|
|
2659
|
-
read: (e) =>
|
|
2668
|
+
[A.arrowStartSize]: {
|
|
2669
|
+
read: (e) => nn(e.arrowWidthStart, e.arrowLengthStart),
|
|
2660
2670
|
write: (e, t) => {
|
|
2661
|
-
let { width: n, length: r } =
|
|
2671
|
+
let { width: n, length: r } = rn(String(t));
|
|
2662
2672
|
e.arrowWidthStart = n, e.arrowLengthStart = r;
|
|
2663
2673
|
},
|
|
2664
|
-
selectionDef:
|
|
2674
|
+
selectionDef: A.arrowStartSize
|
|
2665
2675
|
},
|
|
2666
|
-
[
|
|
2667
|
-
read: (e) =>
|
|
2676
|
+
[A.arrowEndSize]: {
|
|
2677
|
+
read: (e) => nn(e.arrowWidthEnd, e.arrowLengthEnd),
|
|
2668
2678
|
write: (e, t) => {
|
|
2669
|
-
let { width: n, length: r } =
|
|
2679
|
+
let { width: n, length: r } = rn(String(t));
|
|
2670
2680
|
e.arrowWidthEnd = n, e.arrowLengthEnd = r;
|
|
2671
2681
|
},
|
|
2672
|
-
selectionDef:
|
|
2682
|
+
selectionDef: A.arrowEndSize
|
|
2673
2683
|
},
|
|
2674
2684
|
"tool.typeChips": {
|
|
2675
2685
|
read: (e, t) => {
|
|
2676
|
-
let n =
|
|
2686
|
+
let n = Jt[t]?.variantField;
|
|
2677
2687
|
if (n) return e[n];
|
|
2678
2688
|
},
|
|
2679
2689
|
write: (e, t, n) => {
|
|
2680
|
-
let r =
|
|
2690
|
+
let r = Jt[n]?.variantField;
|
|
2681
2691
|
r && (e[r] = t);
|
|
2682
2692
|
},
|
|
2683
2693
|
selectionDef: null
|
|
2684
2694
|
},
|
|
2685
2695
|
"tool.transparencyPercent": {
|
|
2686
|
-
read: (e) =>
|
|
2696
|
+
read: (e) => Xt(e.strokeOpacity ?? 1, 1),
|
|
2687
2697
|
write: (e, t) => {
|
|
2688
|
-
e.strokeOpacity =
|
|
2698
|
+
e.strokeOpacity = Zt(Number(t));
|
|
2689
2699
|
},
|
|
2690
|
-
selectionDef:
|
|
2700
|
+
selectionDef: A.strokeOpacity
|
|
2691
2701
|
},
|
|
2692
2702
|
"tool.fillTransparencyPercent": {
|
|
2693
|
-
read: (e) =>
|
|
2703
|
+
read: (e) => Xt(e.fillOpacity ?? .4, .4),
|
|
2694
2704
|
write: (e, t) => {
|
|
2695
|
-
e.fillOpacity =
|
|
2705
|
+
e.fillOpacity = Zt(Number(t));
|
|
2696
2706
|
},
|
|
2697
|
-
selectionDef:
|
|
2707
|
+
selectionDef: A.fillOpacity
|
|
2698
2708
|
},
|
|
2699
2709
|
"tool.fillOpacityPercent": {
|
|
2700
|
-
read: (e) =>
|
|
2710
|
+
read: (e) => Qt(e.fillOpacity ?? 1, 1),
|
|
2701
2711
|
write: (e, t) => {
|
|
2702
|
-
e.fillOpacity =
|
|
2712
|
+
e.fillOpacity = $t(Number(t));
|
|
2703
2713
|
},
|
|
2704
2714
|
selectionDef: null
|
|
2705
2715
|
},
|
|
@@ -2709,10 +2719,10 @@ var Lt = {
|
|
|
2709
2719
|
selectionDef: null
|
|
2710
2720
|
}
|
|
2711
2721
|
};
|
|
2712
|
-
function
|
|
2713
|
-
let t =
|
|
2722
|
+
function on(e) {
|
|
2723
|
+
let t = an[e];
|
|
2714
2724
|
if (!t?.selectionDef) return null;
|
|
2715
|
-
let n =
|
|
2725
|
+
let n = Tt[t.selectionDef];
|
|
2716
2726
|
return n ? {
|
|
2717
2727
|
label: n.label,
|
|
2718
2728
|
options: n.options,
|
|
@@ -2723,22 +2733,22 @@ function Rt(e) {
|
|
|
2723
2733
|
allowNone: n.allowNone
|
|
2724
2734
|
} : null;
|
|
2725
2735
|
}
|
|
2726
|
-
var
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
...
|
|
2741
|
-
],
|
|
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 = {
|
|
2742
2752
|
strokeColor: "stroke_color",
|
|
2743
2753
|
fillColor: "fill_color",
|
|
2744
2754
|
strokeWidth: "stroke_width",
|
|
@@ -2764,49 +2774,49 @@ var zt = [
|
|
|
2764
2774
|
strokeOpacity: "stroke_opacity",
|
|
2765
2775
|
strokeLinecap: "stroke_linecap",
|
|
2766
2776
|
strokeLinejoin: "stroke_linejoin"
|
|
2767
|
-
},
|
|
2777
|
+
}, ln = (() => {
|
|
2768
2778
|
let e = {};
|
|
2769
|
-
for (let [t, n] of Object.entries(
|
|
2779
|
+
for (let [t, n] of Object.entries(cn)) e[n] = t;
|
|
2770
2780
|
return e;
|
|
2771
2781
|
})();
|
|
2772
|
-
function
|
|
2773
|
-
return t === "camel" ? e :
|
|
2782
|
+
function un(e, t) {
|
|
2783
|
+
return t === "camel" ? e : cn[e] ?? e;
|
|
2774
2784
|
}
|
|
2775
|
-
function
|
|
2785
|
+
function dn(e, t, n) {
|
|
2776
2786
|
if (t === "camel") return e in n ? e : null;
|
|
2777
|
-
let r =
|
|
2787
|
+
let r = cn[e];
|
|
2778
2788
|
return r !== void 0 && r in n ? r : null;
|
|
2779
2789
|
}
|
|
2780
|
-
function
|
|
2790
|
+
function fn(e, t, n) {
|
|
2781
2791
|
let r = {};
|
|
2782
2792
|
for (let i of t) {
|
|
2783
2793
|
let t = e[i];
|
|
2784
|
-
t !== void 0 && (r[
|
|
2794
|
+
t !== void 0 && (r[un(i, n)] = t);
|
|
2785
2795
|
}
|
|
2786
2796
|
return r;
|
|
2787
2797
|
}
|
|
2788
|
-
function
|
|
2798
|
+
function pn(e, t, n) {
|
|
2789
2799
|
let r = {};
|
|
2790
2800
|
for (let i of t) {
|
|
2791
|
-
let t =
|
|
2801
|
+
let t = dn(i, n, e);
|
|
2792
2802
|
if (t === null) continue;
|
|
2793
2803
|
let a = e[t];
|
|
2794
2804
|
a !== void 0 && a !== "" && (r[i] = a);
|
|
2795
2805
|
}
|
|
2796
2806
|
return r;
|
|
2797
2807
|
}
|
|
2798
|
-
function
|
|
2799
|
-
return
|
|
2808
|
+
function mn(e) {
|
|
2809
|
+
return ln[e];
|
|
2800
2810
|
}
|
|
2801
2811
|
//#endregion
|
|
2802
2812
|
//#region src/editor/tool-style-reader.ts
|
|
2803
|
-
function
|
|
2813
|
+
function hn(e) {
|
|
2804
2814
|
if (e.tagName.toLowerCase() !== "g" || e.getAttribute("data-type") !== "freehand") return e;
|
|
2805
2815
|
let t = e.querySelectorAll(":scope > path");
|
|
2806
2816
|
return t.length === 0 ? e : t[t.length - 1];
|
|
2807
2817
|
}
|
|
2808
|
-
function
|
|
2809
|
-
let n =
|
|
2818
|
+
function gn(e, t) {
|
|
2819
|
+
let n = hn(e), r = n.getAttribute("stroke");
|
|
2810
2820
|
r && (t.strokeColor = r);
|
|
2811
2821
|
let i = n.getAttribute("fill");
|
|
2812
2822
|
i && (t.fillColor = i);
|
|
@@ -2825,22 +2835,22 @@ function Jt(e, t) {
|
|
|
2825
2835
|
}
|
|
2826
2836
|
//#endregion
|
|
2827
2837
|
//#region src/editor/viewport-math.ts
|
|
2828
|
-
var
|
|
2829
|
-
function
|
|
2838
|
+
var _n = .1, vn = 5, yn = 40;
|
|
2839
|
+
function bn(e, t = _n, n = 5) {
|
|
2830
2840
|
return Math.max(t, Math.min(e, n));
|
|
2831
2841
|
}
|
|
2832
|
-
function
|
|
2842
|
+
function xn(e, t, n, r, i = 40, a = 1) {
|
|
2833
2843
|
if (e <= 0 || t <= 0) return 0;
|
|
2834
2844
|
let o = n - i, s = r - i;
|
|
2835
2845
|
return o <= 0 || s <= 0 ? 0 : Math.min(o / e, s / t, a);
|
|
2836
2846
|
}
|
|
2837
|
-
function
|
|
2847
|
+
function Sn(e, t, n) {
|
|
2838
2848
|
return {
|
|
2839
2849
|
width: Math.round(e * n),
|
|
2840
2850
|
height: Math.round(t * n)
|
|
2841
2851
|
};
|
|
2842
2852
|
}
|
|
2843
|
-
function
|
|
2853
|
+
function Cn(e, t, n) {
|
|
2844
2854
|
let [r, i, a, o, s, c] = e, l = r * o - i * a;
|
|
2845
2855
|
if (l === 0) throw Error("applyInverseAffine: matrix is singular");
|
|
2846
2856
|
return {
|
|
@@ -2849,193 +2859,1378 @@ function tn(e, t, n) {
|
|
|
2849
2859
|
};
|
|
2850
2860
|
}
|
|
2851
2861
|
//#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
|
|
2852
4047
|
//#region src/icons/types.ts
|
|
2853
|
-
function
|
|
4048
|
+
function lo(e) {
|
|
2854
4049
|
return {
|
|
2855
4050
|
kind: "builtin",
|
|
2856
4051
|
id: e
|
|
2857
4052
|
};
|
|
2858
4053
|
}
|
|
2859
|
-
function
|
|
4054
|
+
function uo(e) {
|
|
2860
4055
|
return {
|
|
2861
4056
|
kind: "svg",
|
|
2862
4057
|
svg: e
|
|
2863
4058
|
};
|
|
2864
4059
|
}
|
|
2865
|
-
function
|
|
4060
|
+
function fo(e) {
|
|
2866
4061
|
return {
|
|
2867
4062
|
kind: "url",
|
|
2868
4063
|
url: e
|
|
2869
4064
|
};
|
|
2870
4065
|
}
|
|
2871
|
-
function
|
|
4066
|
+
function po(e) {
|
|
2872
4067
|
return e.kind === "builtin";
|
|
2873
4068
|
}
|
|
2874
|
-
function
|
|
4069
|
+
function mo(e) {
|
|
2875
4070
|
return e.kind === "svg";
|
|
2876
4071
|
}
|
|
2877
|
-
function
|
|
4072
|
+
function ho(e) {
|
|
2878
4073
|
return e.kind === "url";
|
|
2879
4074
|
}
|
|
2880
4075
|
//#endregion
|
|
2881
4076
|
//#region src/storage/errors.ts
|
|
2882
|
-
var
|
|
4077
|
+
var go = class extends Error {
|
|
2883
4078
|
code;
|
|
2884
4079
|
path;
|
|
2885
4080
|
constructor(e, t, n) {
|
|
2886
4081
|
super(n), this.name = "StorageError", this.code = e, this.path = t;
|
|
2887
4082
|
}
|
|
2888
|
-
},
|
|
4083
|
+
}, _o = class extends go {
|
|
2889
4084
|
constructor(e, t) {
|
|
2890
4085
|
super("conflict", e, t ?? `Path already exists: ${e}`), this.name = "StorageConflictError";
|
|
2891
4086
|
}
|
|
2892
|
-
},
|
|
4087
|
+
}, vo = class extends go {
|
|
2893
4088
|
constructor(e, t) {
|
|
2894
4089
|
super("not-found", e, t ?? `Path not found: ${e}`), this.name = "StorageNotFoundError";
|
|
2895
4090
|
}
|
|
2896
|
-
},
|
|
4091
|
+
}, yo = class extends go {
|
|
2897
4092
|
constructor(e, t) {
|
|
2898
4093
|
super("permission", e, t ?? `Permission denied: ${e}`), this.name = "StoragePermissionError";
|
|
2899
4094
|
}
|
|
2900
|
-
},
|
|
4095
|
+
}, bo = class extends go {
|
|
2901
4096
|
constructor(e, t) {
|
|
2902
4097
|
super("quota", e, t ?? `Quota exceeded: ${e}`), this.name = "StorageQuotaError";
|
|
2903
4098
|
}
|
|
2904
|
-
},
|
|
4099
|
+
}, xo = class extends Error {
|
|
2905
4100
|
constructor(e, t) {
|
|
2906
4101
|
super(e, t), this.name = "MetadataCacheError";
|
|
2907
4102
|
}
|
|
2908
|
-
},
|
|
4103
|
+
}, So = class extends xo {
|
|
2909
4104
|
constructor(e = "Metadata cache quota exceeded", t) {
|
|
2910
4105
|
super(e, t), this.name = "MetadataCacheQuotaError";
|
|
2911
4106
|
}
|
|
2912
4107
|
};
|
|
2913
|
-
function
|
|
4108
|
+
function Co(e) {
|
|
2914
4109
|
let t = e;
|
|
2915
4110
|
return typeof t.metadataNamespace == "function" && typeof t.attachMetadataCache == "function";
|
|
2916
4111
|
}
|
|
2917
4112
|
//#endregion
|
|
2918
4113
|
//#region src/storage/path.ts
|
|
2919
|
-
var
|
|
2920
|
-
function
|
|
4114
|
+
var wo = "", To = /[<>:"/\\|?*\x00-\x1f]/;
|
|
4115
|
+
function Eo(e) {
|
|
2921
4116
|
if (!e) throw Error("Name must not be empty");
|
|
2922
4117
|
if (e === "." || e === "..") throw Error(`Name "${e}" is reserved`);
|
|
2923
|
-
if (
|
|
4118
|
+
if (To.test(e)) throw Error(`Name "${e}" contains invalid characters`);
|
|
2924
4119
|
if (e.length > 255) throw Error("Name is too long (max 255 chars)");
|
|
2925
4120
|
}
|
|
2926
|
-
function
|
|
4121
|
+
function Do(e, t) {
|
|
2927
4122
|
if (!t) throw Error("joinPath: name is required");
|
|
2928
4123
|
if (t.includes("/")) throw Error(`joinPath: name must not contain "/": "${t}"`);
|
|
2929
4124
|
return e ? `${e}/${t}` : t;
|
|
2930
4125
|
}
|
|
2931
|
-
function
|
|
4126
|
+
function Oo(e) {
|
|
2932
4127
|
if (!e) return "";
|
|
2933
4128
|
let t = e.lastIndexOf("/");
|
|
2934
4129
|
return t < 0 ? "" : e.slice(0, t);
|
|
2935
4130
|
}
|
|
2936
|
-
function
|
|
4131
|
+
function ko(e) {
|
|
2937
4132
|
if (!e) return "";
|
|
2938
4133
|
let t = e.lastIndexOf("/");
|
|
2939
4134
|
return t < 0 ? e : e.slice(t + 1);
|
|
2940
4135
|
}
|
|
2941
|
-
function
|
|
4136
|
+
function Ao(e) {
|
|
2942
4137
|
return e ? e.split("/") : [];
|
|
2943
4138
|
}
|
|
2944
|
-
function
|
|
2945
|
-
let t =
|
|
4139
|
+
function jo(e) {
|
|
4140
|
+
let t = Ao(e), n = [], r = "";
|
|
2946
4141
|
for (let e = 0; e < t.length - 1; e++) r = r ? `${r}/${t[e]}` : t[e], n.push(r);
|
|
2947
4142
|
return n;
|
|
2948
4143
|
}
|
|
2949
|
-
function
|
|
4144
|
+
function Mo(e, t) {
|
|
2950
4145
|
return t ? e === t || e.startsWith(`${t}/`) : !0;
|
|
2951
4146
|
}
|
|
2952
|
-
function
|
|
4147
|
+
function No(e) {
|
|
2953
4148
|
let t = e.lastIndexOf(".");
|
|
2954
4149
|
return t <= 0 ? [e, ""] : [e.slice(0, t), e.slice(t)];
|
|
2955
4150
|
}
|
|
2956
|
-
function
|
|
4151
|
+
function Po(e, t) {
|
|
2957
4152
|
if (!t(e)) return e;
|
|
2958
|
-
let [n, r] =
|
|
4153
|
+
let [n, r] = No(e);
|
|
2959
4154
|
for (let e = 2; e < 1e4; e++) {
|
|
2960
4155
|
let i = `${n} (${e})${r}`;
|
|
2961
4156
|
if (!t(i)) return i;
|
|
2962
4157
|
}
|
|
2963
4158
|
throw Error(`Could not find unique name for "${e}"`);
|
|
2964
4159
|
}
|
|
2965
|
-
async function
|
|
4160
|
+
async function Fo(e, t) {
|
|
2966
4161
|
if (!await t(e)) return e;
|
|
2967
|
-
let [n, r] =
|
|
4162
|
+
let [n, r] = No(e);
|
|
2968
4163
|
for (let e = 2; e < 1e4; e++) {
|
|
2969
4164
|
let i = `${n} (${e})${r}`;
|
|
2970
4165
|
if (!await t(i)) return i;
|
|
2971
4166
|
}
|
|
2972
4167
|
throw Error(`Could not find unique name for "${e}"`);
|
|
2973
4168
|
}
|
|
2974
|
-
function
|
|
4169
|
+
function Io(e, t, n) {
|
|
2975
4170
|
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;
|
|
2976
4171
|
}
|
|
2977
4172
|
//#endregion
|
|
2978
4173
|
//#region src/storage/thumbnail-cache.ts
|
|
2979
|
-
var
|
|
4174
|
+
var Lo = class extends Error {
|
|
2980
4175
|
constructor(e, t) {
|
|
2981
4176
|
super(e, t), this.name = "ThumbnailCacheError";
|
|
2982
4177
|
}
|
|
2983
|
-
},
|
|
4178
|
+
}, Ro = class extends Lo {
|
|
2984
4179
|
constructor(e = "Thumbnail cache quota exceeded", t) {
|
|
2985
4180
|
super(e, t), this.name = "ThumbnailCacheQuotaError";
|
|
2986
4181
|
}
|
|
2987
4182
|
};
|
|
2988
4183
|
//#endregion
|
|
2989
4184
|
//#region src/storage/types.ts
|
|
2990
|
-
function
|
|
4185
|
+
function zo(e) {
|
|
2991
4186
|
return typeof e.resync == "function";
|
|
2992
4187
|
}
|
|
2993
|
-
function
|
|
4188
|
+
function Bo(e) {
|
|
2994
4189
|
return typeof e.forceRefresh == "function";
|
|
2995
4190
|
}
|
|
2996
|
-
function
|
|
4191
|
+
function Vo(e) {
|
|
2997
4192
|
return typeof e.setTokenRefresher == "function" && typeof e.setToken == "function";
|
|
2998
4193
|
}
|
|
2999
|
-
function
|
|
4194
|
+
function Ho(e) {
|
|
3000
4195
|
return typeof e.init == "function";
|
|
3001
4196
|
}
|
|
3002
|
-
function
|
|
4197
|
+
function Uo(e) {
|
|
3003
4198
|
return typeof e.getRateLimit == "function" && typeof e.setRateLimitListener == "function";
|
|
3004
4199
|
}
|
|
3005
|
-
function
|
|
4200
|
+
function Wo(e) {
|
|
3006
4201
|
let t = e;
|
|
3007
4202
|
return typeof t.saveDocument == "function" && typeof t.getDocument == "function" && typeof t.listDocuments == "function" && typeof t.updateDocument == "function";
|
|
3008
4203
|
}
|
|
3009
4204
|
//#endregion
|
|
3010
4205
|
//#region src/utils/assert.ts
|
|
3011
|
-
function
|
|
4206
|
+
function Go(e, t) {
|
|
3012
4207
|
if (e == null) throw Error(`Assertion failed: ${t}`);
|
|
3013
4208
|
return e;
|
|
3014
4209
|
}
|
|
3015
4210
|
//#endregion
|
|
3016
4211
|
//#region src/utils/constants.ts
|
|
3017
|
-
var
|
|
3018
|
-
function
|
|
4212
|
+
var Ko = .9, qo = "#ff0000", Jo = "none", Yo = 3, Xo = 24, Zo = 10, Qo = "annot";
|
|
4213
|
+
function $o(e, t = 2) {
|
|
3019
4214
|
return String(e).padStart(t, "0");
|
|
3020
4215
|
}
|
|
3021
|
-
function
|
|
3022
|
-
return `${e.getFullYear()}${
|
|
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)}`;
|
|
3023
4218
|
}
|
|
3024
|
-
function
|
|
3025
|
-
return `${
|
|
4219
|
+
function ts(e = /* @__PURE__ */ new Date()) {
|
|
4220
|
+
return `${Qo}-${es(e)}`;
|
|
3026
4221
|
}
|
|
3027
|
-
function
|
|
4222
|
+
function ns(e, t = /* @__PURE__ */ new Date()) {
|
|
3028
4223
|
let n = e.startsWith("data:image/jpeg") ? "jpg" : "png";
|
|
3029
|
-
return `${
|
|
4224
|
+
return `${ts(t)}.annot.${n}`;
|
|
3030
4225
|
}
|
|
3031
4226
|
//#endregion
|
|
3032
4227
|
//#region src/utils/id.ts
|
|
3033
|
-
var
|
|
3034
|
-
function
|
|
3035
|
-
let t = new Uint8Array(16), n = Math.floor(e / 4294967296), r = e >>> 0;
|
|
4228
|
+
var rs = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
4229
|
+
function is(e = Date.now()) {
|
|
4230
|
+
let t = /* @__PURE__ */ new Uint8Array(16), n = Math.floor(e / 4294967296), r = e >>> 0;
|
|
3036
4231
|
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;
|
|
3037
4232
|
}
|
|
3038
|
-
function
|
|
4233
|
+
function as(e) {
|
|
3039
4234
|
let t = 0;
|
|
3040
4235
|
for (; t < e.length && e[t] === 0;) t++;
|
|
3041
4236
|
let n = Array.from(e), r = [], i = t;
|
|
@@ -3049,17 +4244,85 @@ function Xn(e) {
|
|
|
3049
4244
|
r.push(e);
|
|
3050
4245
|
}
|
|
3051
4246
|
let a = "";
|
|
3052
|
-
for (let e = 0; e < t; e++) a +=
|
|
3053
|
-
for (let e = r.length - 1; e >= 0; e--) 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]];
|
|
3054
4249
|
return a;
|
|
3055
4250
|
}
|
|
3056
|
-
function
|
|
3057
|
-
return
|
|
4251
|
+
function os() {
|
|
4252
|
+
return as(is());
|
|
4253
|
+
}
|
|
4254
|
+
//#endregion
|
|
4255
|
+
//#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([
|
|
4260
|
+
0,
|
|
4261
|
+
1,
|
|
4262
|
+
0,
|
|
4263
|
+
0,
|
|
4264
|
+
0
|
|
4265
|
+
]), o)), c = hs(n), l = c.length - 12;
|
|
4266
|
+
return t(c.slice(0, l), s, c.slice(l));
|
|
4267
|
+
}
|
|
4268
|
+
function ds(e) {
|
|
4269
|
+
if (!ps(e)) return null;
|
|
4270
|
+
let t = gs(e);
|
|
4271
|
+
if (t === null) return null;
|
|
4272
|
+
let n = io(t);
|
|
4273
|
+
if (n.version !== 1) throw Error(`readElementTreePng: unsupported ElementTree schema version ${String(n.version)} (this build understands 1)`);
|
|
4274
|
+
return n;
|
|
4275
|
+
}
|
|
4276
|
+
function fs(e) {
|
|
4277
|
+
return ps(e) ? ms(e) !== null : !1;
|
|
4278
|
+
}
|
|
4279
|
+
function ps(e) {
|
|
4280
|
+
return e.length >= 8 && e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71;
|
|
4281
|
+
}
|
|
4282
|
+
function ms(e) {
|
|
4283
|
+
let t = 8;
|
|
4284
|
+
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 {
|
|
4290
|
+
start: t,
|
|
4291
|
+
end: s,
|
|
4292
|
+
dataStart: o,
|
|
4293
|
+
dataLength: i
|
|
4294
|
+
};
|
|
4295
|
+
}
|
|
4296
|
+
t = s;
|
|
4297
|
+
}
|
|
4298
|
+
return null;
|
|
4299
|
+
}
|
|
4300
|
+
function hs(e) {
|
|
4301
|
+
let n = ms(e);
|
|
4302
|
+
return n === null ? e : t(e.slice(0, n.start), e.slice(n.end));
|
|
4303
|
+
}
|
|
4304
|
+
function gs(e) {
|
|
4305
|
+
let t = ms(e);
|
|
4306
|
+
if (t === null) return null;
|
|
4307
|
+
let n = t.dataStart + cs.length;
|
|
4308
|
+
if (n + 3 > t.dataStart + t.dataLength) return null;
|
|
4309
|
+
let r = e[n + 1] ?? 0, i = e[n + 2] ?? 0;
|
|
4310
|
+
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);
|
|
4316
|
+
if (r === 1) {
|
|
4317
|
+
let e = a(c);
|
|
4318
|
+
return new TextDecoder().decode(e);
|
|
4319
|
+
}
|
|
4320
|
+
return new TextDecoder().decode(c);
|
|
3058
4321
|
}
|
|
3059
4322
|
//#endregion
|
|
3060
4323
|
//#region src/zip/zip-bytes.ts
|
|
3061
|
-
var
|
|
3062
|
-
function
|
|
4324
|
+
var _s = new TextEncoder();
|
|
4325
|
+
function vs(e) {
|
|
3063
4326
|
let t = 4294967295;
|
|
3064
4327
|
for (let n = 0; n < e.length; n++) {
|
|
3065
4328
|
t ^= e[n];
|
|
@@ -3078,10 +4341,10 @@ function $(e) {
|
|
|
3078
4341
|
e >> 24 & 255
|
|
3079
4342
|
]);
|
|
3080
4343
|
}
|
|
3081
|
-
function
|
|
4344
|
+
function ys(e) {
|
|
3082
4345
|
let t = [], n = [], r = 0;
|
|
3083
4346
|
for (let i of e) {
|
|
3084
|
-
let e =
|
|
4347
|
+
let e = _s.encode(i.name), a = vs(i.data), o = i.data.length, s = new Uint8Array([
|
|
3085
4348
|
80,
|
|
3086
4349
|
75,
|
|
3087
4350
|
3,
|
|
@@ -3146,17 +4409,17 @@ function er(e) {
|
|
|
3146
4409
|
}
|
|
3147
4410
|
//#endregion
|
|
3148
4411
|
//#region src/zip/zip-builder.ts
|
|
3149
|
-
function
|
|
3150
|
-
let t =
|
|
4412
|
+
function bs(e) {
|
|
4413
|
+
let t = ys(e);
|
|
3151
4414
|
return new Blob([t], { type: "application/zip" });
|
|
3152
4415
|
}
|
|
3153
|
-
function
|
|
4416
|
+
function xs(e) {
|
|
3154
4417
|
let t = e.split(",")[1] || "", n = atob(t), r = new Uint8Array(n.length);
|
|
3155
4418
|
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
3156
4419
|
return r;
|
|
3157
4420
|
}
|
|
3158
|
-
function
|
|
4421
|
+
function Ss(e) {
|
|
3159
4422
|
return e.startsWith("data:image/png") ? "png" : "jpg";
|
|
3160
4423
|
}
|
|
3161
4424
|
//#endregion
|
|
3162
|
-
export {
|
|
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 };
|