@quartz-community/obsidian-plugin-excalidraw 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,4926 @@
1
+ import { createRequire } from 'module';
2
+ import { readFileSync } from 'fs';
3
+ import { join } from 'path';
4
+
5
+ createRequire(import.meta.url);
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __commonJS = (cb, mod) => function __require() {
13
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
+ };
15
+ var __export = (target, all2) => {
16
+ for (var name in all2)
17
+ __defProp(target, name, { get: all2[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key2 of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key2) && key2 !== except)
23
+ __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
33
+ mod
34
+ ));
35
+
36
+ // node_modules/lz-string/libs/lz-string.js
37
+ var require_lz_string = __commonJS({
38
+ "node_modules/lz-string/libs/lz-string.js"(exports$1, module) {
39
+ var LZString2 = (function() {
40
+ var f5 = String.fromCharCode;
41
+ var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
42
+ var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
43
+ var baseReverseDic = {};
44
+ function getBaseValue(alphabet, character) {
45
+ if (!baseReverseDic[alphabet]) {
46
+ baseReverseDic[alphabet] = {};
47
+ for (var i4 = 0; i4 < alphabet.length; i4++) {
48
+ baseReverseDic[alphabet][alphabet.charAt(i4)] = i4;
49
+ }
50
+ }
51
+ return baseReverseDic[alphabet][character];
52
+ }
53
+ var LZString3 = {
54
+ compressToBase64: function(input) {
55
+ if (input == null) return "";
56
+ var res = LZString3._compress(input, 6, function(a4) {
57
+ return keyStrBase64.charAt(a4);
58
+ });
59
+ switch (res.length % 4) {
60
+ // To produce valid Base64
61
+ default:
62
+ // When could this happen ?
63
+ case 0:
64
+ return res;
65
+ case 1:
66
+ return res + "===";
67
+ case 2:
68
+ return res + "==";
69
+ case 3:
70
+ return res + "=";
71
+ }
72
+ },
73
+ decompressFromBase64: function(input) {
74
+ if (input == null) return "";
75
+ if (input == "") return null;
76
+ return LZString3._decompress(input.length, 32, function(index) {
77
+ return getBaseValue(keyStrBase64, input.charAt(index));
78
+ });
79
+ },
80
+ compressToUTF16: function(input) {
81
+ if (input == null) return "";
82
+ return LZString3._compress(input, 15, function(a4) {
83
+ return f5(a4 + 32);
84
+ }) + " ";
85
+ },
86
+ decompressFromUTF16: function(compressed) {
87
+ if (compressed == null) return "";
88
+ if (compressed == "") return null;
89
+ return LZString3._decompress(compressed.length, 16384, function(index) {
90
+ return compressed.charCodeAt(index) - 32;
91
+ });
92
+ },
93
+ //compress into uint8array (UCS-2 big endian format)
94
+ compressToUint8Array: function(uncompressed) {
95
+ var compressed = LZString3.compress(uncompressed);
96
+ var buf = new Uint8Array(compressed.length * 2);
97
+ for (var i4 = 0, TotalLen = compressed.length; i4 < TotalLen; i4++) {
98
+ var current_value = compressed.charCodeAt(i4);
99
+ buf[i4 * 2] = current_value >>> 8;
100
+ buf[i4 * 2 + 1] = current_value % 256;
101
+ }
102
+ return buf;
103
+ },
104
+ //decompress from uint8array (UCS-2 big endian format)
105
+ decompressFromUint8Array: function(compressed) {
106
+ if (compressed === null || compressed === void 0) {
107
+ return LZString3.decompress(compressed);
108
+ } else {
109
+ var buf = new Array(compressed.length / 2);
110
+ for (var i4 = 0, TotalLen = buf.length; i4 < TotalLen; i4++) {
111
+ buf[i4] = compressed[i4 * 2] * 256 + compressed[i4 * 2 + 1];
112
+ }
113
+ var result = [];
114
+ buf.forEach(function(c4) {
115
+ result.push(f5(c4));
116
+ });
117
+ return LZString3.decompress(result.join(""));
118
+ }
119
+ },
120
+ //compress into a string that is already URI encoded
121
+ compressToEncodedURIComponent: function(input) {
122
+ if (input == null) return "";
123
+ return LZString3._compress(input, 6, function(a4) {
124
+ return keyStrUriSafe.charAt(a4);
125
+ });
126
+ },
127
+ //decompress from an output of compressToEncodedURIComponent
128
+ decompressFromEncodedURIComponent: function(input) {
129
+ if (input == null) return "";
130
+ if (input == "") return null;
131
+ input = input.replace(/ /g, "+");
132
+ return LZString3._decompress(input.length, 32, function(index) {
133
+ return getBaseValue(keyStrUriSafe, input.charAt(index));
134
+ });
135
+ },
136
+ compress: function(uncompressed) {
137
+ return LZString3._compress(uncompressed, 16, function(a4) {
138
+ return f5(a4);
139
+ });
140
+ },
141
+ _compress: function(uncompressed, bitsPerChar, getCharFromInt) {
142
+ if (uncompressed == null) return "";
143
+ var i4, value, context_dictionary = {}, context_dictionaryToCreate = {}, context_c = "", context_wc = "", context_w = "", context_enlargeIn = 2, context_dictSize = 3, context_numBits = 2, context_data = [], context_data_val = 0, context_data_position = 0, ii;
144
+ for (ii = 0; ii < uncompressed.length; ii += 1) {
145
+ context_c = uncompressed.charAt(ii);
146
+ if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
147
+ context_dictionary[context_c] = context_dictSize++;
148
+ context_dictionaryToCreate[context_c] = true;
149
+ }
150
+ context_wc = context_w + context_c;
151
+ if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {
152
+ context_w = context_wc;
153
+ } else {
154
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
155
+ if (context_w.charCodeAt(0) < 256) {
156
+ for (i4 = 0; i4 < context_numBits; i4++) {
157
+ context_data_val = context_data_val << 1;
158
+ if (context_data_position == bitsPerChar - 1) {
159
+ context_data_position = 0;
160
+ context_data.push(getCharFromInt(context_data_val));
161
+ context_data_val = 0;
162
+ } else {
163
+ context_data_position++;
164
+ }
165
+ }
166
+ value = context_w.charCodeAt(0);
167
+ for (i4 = 0; i4 < 8; i4++) {
168
+ context_data_val = context_data_val << 1 | value & 1;
169
+ if (context_data_position == bitsPerChar - 1) {
170
+ context_data_position = 0;
171
+ context_data.push(getCharFromInt(context_data_val));
172
+ context_data_val = 0;
173
+ } else {
174
+ context_data_position++;
175
+ }
176
+ value = value >> 1;
177
+ }
178
+ } else {
179
+ value = 1;
180
+ for (i4 = 0; i4 < context_numBits; i4++) {
181
+ context_data_val = context_data_val << 1 | value;
182
+ if (context_data_position == bitsPerChar - 1) {
183
+ context_data_position = 0;
184
+ context_data.push(getCharFromInt(context_data_val));
185
+ context_data_val = 0;
186
+ } else {
187
+ context_data_position++;
188
+ }
189
+ value = 0;
190
+ }
191
+ value = context_w.charCodeAt(0);
192
+ for (i4 = 0; i4 < 16; i4++) {
193
+ context_data_val = context_data_val << 1 | value & 1;
194
+ if (context_data_position == bitsPerChar - 1) {
195
+ context_data_position = 0;
196
+ context_data.push(getCharFromInt(context_data_val));
197
+ context_data_val = 0;
198
+ } else {
199
+ context_data_position++;
200
+ }
201
+ value = value >> 1;
202
+ }
203
+ }
204
+ context_enlargeIn--;
205
+ if (context_enlargeIn == 0) {
206
+ context_enlargeIn = Math.pow(2, context_numBits);
207
+ context_numBits++;
208
+ }
209
+ delete context_dictionaryToCreate[context_w];
210
+ } else {
211
+ value = context_dictionary[context_w];
212
+ for (i4 = 0; i4 < context_numBits; i4++) {
213
+ context_data_val = context_data_val << 1 | value & 1;
214
+ if (context_data_position == bitsPerChar - 1) {
215
+ context_data_position = 0;
216
+ context_data.push(getCharFromInt(context_data_val));
217
+ context_data_val = 0;
218
+ } else {
219
+ context_data_position++;
220
+ }
221
+ value = value >> 1;
222
+ }
223
+ }
224
+ context_enlargeIn--;
225
+ if (context_enlargeIn == 0) {
226
+ context_enlargeIn = Math.pow(2, context_numBits);
227
+ context_numBits++;
228
+ }
229
+ context_dictionary[context_wc] = context_dictSize++;
230
+ context_w = String(context_c);
231
+ }
232
+ }
233
+ if (context_w !== "") {
234
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
235
+ if (context_w.charCodeAt(0) < 256) {
236
+ for (i4 = 0; i4 < context_numBits; i4++) {
237
+ context_data_val = context_data_val << 1;
238
+ if (context_data_position == bitsPerChar - 1) {
239
+ context_data_position = 0;
240
+ context_data.push(getCharFromInt(context_data_val));
241
+ context_data_val = 0;
242
+ } else {
243
+ context_data_position++;
244
+ }
245
+ }
246
+ value = context_w.charCodeAt(0);
247
+ for (i4 = 0; i4 < 8; i4++) {
248
+ context_data_val = context_data_val << 1 | value & 1;
249
+ if (context_data_position == bitsPerChar - 1) {
250
+ context_data_position = 0;
251
+ context_data.push(getCharFromInt(context_data_val));
252
+ context_data_val = 0;
253
+ } else {
254
+ context_data_position++;
255
+ }
256
+ value = value >> 1;
257
+ }
258
+ } else {
259
+ value = 1;
260
+ for (i4 = 0; i4 < context_numBits; i4++) {
261
+ context_data_val = context_data_val << 1 | value;
262
+ if (context_data_position == bitsPerChar - 1) {
263
+ context_data_position = 0;
264
+ context_data.push(getCharFromInt(context_data_val));
265
+ context_data_val = 0;
266
+ } else {
267
+ context_data_position++;
268
+ }
269
+ value = 0;
270
+ }
271
+ value = context_w.charCodeAt(0);
272
+ for (i4 = 0; i4 < 16; i4++) {
273
+ context_data_val = context_data_val << 1 | value & 1;
274
+ if (context_data_position == bitsPerChar - 1) {
275
+ context_data_position = 0;
276
+ context_data.push(getCharFromInt(context_data_val));
277
+ context_data_val = 0;
278
+ } else {
279
+ context_data_position++;
280
+ }
281
+ value = value >> 1;
282
+ }
283
+ }
284
+ context_enlargeIn--;
285
+ if (context_enlargeIn == 0) {
286
+ context_enlargeIn = Math.pow(2, context_numBits);
287
+ context_numBits++;
288
+ }
289
+ delete context_dictionaryToCreate[context_w];
290
+ } else {
291
+ value = context_dictionary[context_w];
292
+ for (i4 = 0; i4 < context_numBits; i4++) {
293
+ context_data_val = context_data_val << 1 | value & 1;
294
+ if (context_data_position == bitsPerChar - 1) {
295
+ context_data_position = 0;
296
+ context_data.push(getCharFromInt(context_data_val));
297
+ context_data_val = 0;
298
+ } else {
299
+ context_data_position++;
300
+ }
301
+ value = value >> 1;
302
+ }
303
+ }
304
+ context_enlargeIn--;
305
+ if (context_enlargeIn == 0) {
306
+ context_enlargeIn = Math.pow(2, context_numBits);
307
+ context_numBits++;
308
+ }
309
+ }
310
+ value = 2;
311
+ for (i4 = 0; i4 < context_numBits; i4++) {
312
+ context_data_val = context_data_val << 1 | value & 1;
313
+ if (context_data_position == bitsPerChar - 1) {
314
+ context_data_position = 0;
315
+ context_data.push(getCharFromInt(context_data_val));
316
+ context_data_val = 0;
317
+ } else {
318
+ context_data_position++;
319
+ }
320
+ value = value >> 1;
321
+ }
322
+ while (true) {
323
+ context_data_val = context_data_val << 1;
324
+ if (context_data_position == bitsPerChar - 1) {
325
+ context_data.push(getCharFromInt(context_data_val));
326
+ break;
327
+ } else context_data_position++;
328
+ }
329
+ return context_data.join("");
330
+ },
331
+ decompress: function(compressed) {
332
+ if (compressed == null) return "";
333
+ if (compressed == "") return null;
334
+ return LZString3._decompress(compressed.length, 32768, function(index) {
335
+ return compressed.charCodeAt(index);
336
+ });
337
+ },
338
+ _decompress: function(length, resetValue, getNextValue) {
339
+ var dictionary = [], enlargeIn = 4, dictSize = 4, numBits = 3, entry = "", result = [], i4, w4, bits, resb, maxpower, power, c4, data = { val: getNextValue(0), position: resetValue, index: 1 };
340
+ for (i4 = 0; i4 < 3; i4 += 1) {
341
+ dictionary[i4] = i4;
342
+ }
343
+ bits = 0;
344
+ maxpower = Math.pow(2, 2);
345
+ power = 1;
346
+ while (power != maxpower) {
347
+ resb = data.val & data.position;
348
+ data.position >>= 1;
349
+ if (data.position == 0) {
350
+ data.position = resetValue;
351
+ data.val = getNextValue(data.index++);
352
+ }
353
+ bits |= (resb > 0 ? 1 : 0) * power;
354
+ power <<= 1;
355
+ }
356
+ switch (bits) {
357
+ case 0:
358
+ bits = 0;
359
+ maxpower = Math.pow(2, 8);
360
+ power = 1;
361
+ while (power != maxpower) {
362
+ resb = data.val & data.position;
363
+ data.position >>= 1;
364
+ if (data.position == 0) {
365
+ data.position = resetValue;
366
+ data.val = getNextValue(data.index++);
367
+ }
368
+ bits |= (resb > 0 ? 1 : 0) * power;
369
+ power <<= 1;
370
+ }
371
+ c4 = f5(bits);
372
+ break;
373
+ case 1:
374
+ bits = 0;
375
+ maxpower = Math.pow(2, 16);
376
+ power = 1;
377
+ while (power != maxpower) {
378
+ resb = data.val & data.position;
379
+ data.position >>= 1;
380
+ if (data.position == 0) {
381
+ data.position = resetValue;
382
+ data.val = getNextValue(data.index++);
383
+ }
384
+ bits |= (resb > 0 ? 1 : 0) * power;
385
+ power <<= 1;
386
+ }
387
+ c4 = f5(bits);
388
+ break;
389
+ case 2:
390
+ return "";
391
+ }
392
+ dictionary[3] = c4;
393
+ w4 = c4;
394
+ result.push(c4);
395
+ while (true) {
396
+ if (data.index > length) {
397
+ return "";
398
+ }
399
+ bits = 0;
400
+ maxpower = Math.pow(2, numBits);
401
+ power = 1;
402
+ while (power != maxpower) {
403
+ resb = data.val & data.position;
404
+ data.position >>= 1;
405
+ if (data.position == 0) {
406
+ data.position = resetValue;
407
+ data.val = getNextValue(data.index++);
408
+ }
409
+ bits |= (resb > 0 ? 1 : 0) * power;
410
+ power <<= 1;
411
+ }
412
+ switch (c4 = bits) {
413
+ case 0:
414
+ bits = 0;
415
+ maxpower = Math.pow(2, 8);
416
+ power = 1;
417
+ while (power != maxpower) {
418
+ resb = data.val & data.position;
419
+ data.position >>= 1;
420
+ if (data.position == 0) {
421
+ data.position = resetValue;
422
+ data.val = getNextValue(data.index++);
423
+ }
424
+ bits |= (resb > 0 ? 1 : 0) * power;
425
+ power <<= 1;
426
+ }
427
+ dictionary[dictSize++] = f5(bits);
428
+ c4 = dictSize - 1;
429
+ enlargeIn--;
430
+ break;
431
+ case 1:
432
+ bits = 0;
433
+ maxpower = Math.pow(2, 16);
434
+ power = 1;
435
+ while (power != maxpower) {
436
+ resb = data.val & data.position;
437
+ data.position >>= 1;
438
+ if (data.position == 0) {
439
+ data.position = resetValue;
440
+ data.val = getNextValue(data.index++);
441
+ }
442
+ bits |= (resb > 0 ? 1 : 0) * power;
443
+ power <<= 1;
444
+ }
445
+ dictionary[dictSize++] = f5(bits);
446
+ c4 = dictSize - 1;
447
+ enlargeIn--;
448
+ break;
449
+ case 2:
450
+ return result.join("");
451
+ }
452
+ if (enlargeIn == 0) {
453
+ enlargeIn = Math.pow(2, numBits);
454
+ numBits++;
455
+ }
456
+ if (dictionary[c4]) {
457
+ entry = dictionary[c4];
458
+ } else {
459
+ if (c4 === dictSize) {
460
+ entry = w4 + w4.charAt(0);
461
+ } else {
462
+ return null;
463
+ }
464
+ }
465
+ result.push(entry);
466
+ dictionary[dictSize++] = w4 + entry.charAt(0);
467
+ enlargeIn--;
468
+ w4 = entry;
469
+ if (enlargeIn == 0) {
470
+ enlargeIn = Math.pow(2, numBits);
471
+ numBits++;
472
+ }
473
+ }
474
+ }
475
+ };
476
+ return LZString3;
477
+ })();
478
+ if (typeof define === "function" && define.amd) {
479
+ define(function() {
480
+ return LZString2;
481
+ });
482
+ } else if (typeof module !== "undefined" && module != null) {
483
+ module.exports = LZString2;
484
+ } else if (typeof angular !== "undefined" && angular != null) {
485
+ angular.module("LZString", []).factory("LZString", function() {
486
+ return LZString2;
487
+ });
488
+ }
489
+ }
490
+ });
491
+
492
+ // node_modules/@quartz-community/utils/dist/path.js
493
+ function isRelativeURL(s4) {
494
+ const validStart = /^\.{1,2}/.test(s4);
495
+ const validEnding = !endsWith(s4, "index");
496
+ return validStart && validEnding && ![".md", ".html"].includes(getFileExtension(s4) ?? "");
497
+ }
498
+ function simplifySlug(fp) {
499
+ const res = stripSlashes(trimSuffix(fp, "index"), true);
500
+ return res.length === 0 ? "/" : res;
501
+ }
502
+ function slugifyFilePath(fp, excludeExt) {
503
+ fp = stripSlashes(fp);
504
+ const ext = getFileExtension(fp);
505
+ const withoutFileExt = fp.replace(new RegExp(ext + "$"), "");
506
+ const finalExt = [".md", ".html", void 0].includes(ext) ? "" : ext;
507
+ let slug2 = _sluggify(withoutFileExt);
508
+ if (endsWith(slug2, "_index")) {
509
+ slug2 = slug2.replace(/_index$/, "index");
510
+ }
511
+ const segments = slug2.split("/");
512
+ if (segments.length >= 2 && segments[segments.length - 1] === segments[segments.length - 2]) {
513
+ segments[segments.length - 1] = "index";
514
+ slug2 = segments.join("/");
515
+ }
516
+ return slug2 + (finalExt ?? "");
517
+ }
518
+ function joinSegments(...args) {
519
+ if (args.length === 0) {
520
+ return "";
521
+ }
522
+ let joined = args.filter((segment) => segment !== "" && segment !== "/").map((segment) => stripSlashes(segment)).join("/");
523
+ const first = args[0];
524
+ const last = args[args.length - 1];
525
+ if (first?.startsWith("/")) {
526
+ joined = "/" + joined;
527
+ }
528
+ if (last?.endsWith("/")) {
529
+ joined = joined + "/";
530
+ }
531
+ return joined;
532
+ }
533
+ function endsWith(s4, suffix) {
534
+ return s4 === suffix || s4.endsWith("/" + suffix);
535
+ }
536
+ function trimSuffix(s4, suffix) {
537
+ if (endsWith(s4, suffix)) {
538
+ s4 = s4.slice(0, -suffix.length);
539
+ }
540
+ return s4;
541
+ }
542
+ function stripSlashes(s4, onlyStripPrefix) {
543
+ if (s4.startsWith("/")) {
544
+ s4 = s4.substring(1);
545
+ }
546
+ if (!onlyStripPrefix && s4.endsWith("/")) {
547
+ s4 = s4.slice(0, -1);
548
+ }
549
+ return s4;
550
+ }
551
+ function getFileExtension(s4) {
552
+ return s4.match(/\.[A-Za-z0-9]+$/)?.[0];
553
+ }
554
+ function pathToRoot(slug2) {
555
+ let rootPath = slug2.split("/").filter((x4) => x4 !== "").slice(0, -1).map((_3) => "..").join("/");
556
+ if (rootPath.length === 0) {
557
+ rootPath = ".";
558
+ }
559
+ return rootPath;
560
+ }
561
+ function resolveRelative(current, target) {
562
+ const res = joinSegments(pathToRoot(current), simplifySlug(target));
563
+ return res;
564
+ }
565
+ function slugifyPath(s4) {
566
+ return s4.split("/").map(
567
+ (segment) => segment.replace(/\s/g, "-").replace(/&/g, "-and-").replace(/%/g, "-percent").replace(/\?/g, "").replace(/#/g, "").replace(/[<>:"|*]/g, "").toLowerCase()
568
+ ).join("/").replace(/\/$/, "");
569
+ }
570
+ function normalizeHastElement(rawEl, curBase, newBase) {
571
+ const el = structuredClone(rawEl);
572
+ _rebaseHastElement(el, "src", curBase, newBase);
573
+ _rebaseHastElement(el, "href", curBase, newBase);
574
+ if (el.children) {
575
+ el.children = el.children.map(
576
+ (child) => child.type === "element" ? normalizeHastElement(child, curBase, newBase) : child
577
+ );
578
+ }
579
+ return el;
580
+ }
581
+ function _rebaseHastElement(el, attr, curBase, newBase) {
582
+ const value = el.properties?.[attr];
583
+ if (value === void 0 || value === null) return;
584
+ const href = String(value);
585
+ if (!isRelativeURL(href)) return;
586
+ el.properties[attr] = joinSegments(resolveRelative(curBase, newBase), "..", href);
587
+ }
588
+ function _sluggify(s4) {
589
+ return slugifyPath(s4);
590
+ }
591
+
592
+ // src/parser.ts
593
+ var import_lz_string = __toESM(require_lz_string());
594
+ var DEFAULT_APP_STATE = {
595
+ viewBackgroundColor: "#ffffff",
596
+ exportBackground: true,
597
+ exportWithDarkMode: false
598
+ };
599
+ function parseExcalidraw(content, filePath) {
600
+ if (filePath.endsWith(".excalidraw.md")) {
601
+ return parseExcalidrawMd(content);
602
+ }
603
+ if (filePath.endsWith(".excalidraw")) {
604
+ return parseExcalidrawJson(content);
605
+ }
606
+ return null;
607
+ }
608
+ function parseExcalidrawJson(content) {
609
+ try {
610
+ const data = JSON.parse(content);
611
+ if (data.type !== "excalidraw") return null;
612
+ return normalizeData(data);
613
+ } catch {
614
+ return null;
615
+ }
616
+ }
617
+ function parseExcalidrawMd(content) {
618
+ const json = extractJsonFromMd(content);
619
+ if (!json) return null;
620
+ let data;
621
+ try {
622
+ data = JSON.parse(json);
623
+ } catch {
624
+ return null;
625
+ }
626
+ if (data.type !== "excalidraw") return null;
627
+ const embeddedFiles = parseEmbeddedFilesSection(content);
628
+ const normalized = normalizeData(data);
629
+ if (!normalized) return null;
630
+ if (Object.keys(embeddedFiles).length > 0) {
631
+ normalized.embeddedFiles = embeddedFiles;
632
+ }
633
+ return normalized;
634
+ }
635
+ function extractJsonFromMd(content) {
636
+ const drawingMarkerIdx = content.indexOf("# Drawing");
637
+ if (drawingMarkerIdx === -1) {
638
+ return extractBetweenPercentDelimiters(content);
639
+ }
640
+ const afterMarker = content.slice(drawingMarkerIdx);
641
+ return extractBetweenPercentDelimiters(afterMarker) ?? extractFromCodeFence(afterMarker);
642
+ }
643
+ function extractBetweenPercentDelimiters(content) {
644
+ const firstPct = content.indexOf("%%");
645
+ if (firstPct === -1) return null;
646
+ const afterFirst = content.indexOf("%%", firstPct);
647
+ const contentAfterFirstPct = content.slice(afterFirst + 2);
648
+ const secondPct = contentAfterFirstPct.indexOf("%%");
649
+ if (secondPct === -1) return null;
650
+ const block = contentAfterFirstPct.slice(0, secondPct).trim();
651
+ return extractFromCodeFence(block) ?? extractRawJson(block);
652
+ }
653
+ function extractFromCodeFence(block) {
654
+ const compressedFenceStart = block.indexOf("```compressed-json");
655
+ if (compressedFenceStart !== -1) {
656
+ const afterFence2 = block.slice(compressedFenceStart + "```compressed-json".length);
657
+ const fenceEnd2 = afterFence2.indexOf("```");
658
+ if (fenceEnd2 === -1) return null;
659
+ const compressedContent = afterFence2.slice(afterFence2.indexOf("\n") + 1, fenceEnd2);
660
+ const cleaned = compressedContent.replace(/[\n\r]/g, "");
661
+ const decompressed = import_lz_string.default.decompressFromBase64(cleaned);
662
+ return decompressed ?? null;
663
+ }
664
+ const fenceStart = block.indexOf("```json");
665
+ if (fenceStart === -1) {
666
+ const altFenceStart = block.indexOf("```");
667
+ if (altFenceStart === -1) return null;
668
+ const afterFence2 = block.slice(altFenceStart + 3);
669
+ const fenceEnd2 = afterFence2.indexOf("```");
670
+ if (fenceEnd2 === -1) return null;
671
+ return afterFence2.slice(afterFence2.indexOf("\n") + 1, fenceEnd2).trim();
672
+ }
673
+ const afterFence = block.slice(fenceStart + 7);
674
+ const fenceEnd = afterFence.indexOf("```");
675
+ if (fenceEnd === -1) return null;
676
+ return afterFence.slice(afterFence.indexOf("\n") + 1, fenceEnd).trim();
677
+ }
678
+ function extractRawJson(block) {
679
+ const lines = block.split("\n");
680
+ const jsonStart = lines.findIndex((line) => line.trimStart().startsWith("{"));
681
+ if (jsonStart === -1) return null;
682
+ const jsonContent = lines.slice(jsonStart).join("\n").trim();
683
+ if (jsonContent.startsWith("{") && jsonContent.endsWith("}")) {
684
+ return jsonContent;
685
+ }
686
+ return null;
687
+ }
688
+ function parseEmbeddedFilesSection(content) {
689
+ const result = {};
690
+ const sectionMatch = content.match(/^##?\s+Embedded\s+[Ff]iles\s*$/im);
691
+ if (!sectionMatch) return result;
692
+ const sectionIdx = sectionMatch.index;
693
+ const afterSection = content.slice(sectionIdx + sectionMatch[0].length);
694
+ const endIdx = afterSection.indexOf("%%");
695
+ const section = endIdx === -1 ? afterSection : afterSection.slice(0, endIdx);
696
+ const pattern = /^([a-f0-9]+):\s+\[\[(.+?)\]\]\s*$/gm;
697
+ let match;
698
+ while ((match = pattern.exec(section)) !== null) {
699
+ result[match[1]] = match[2];
700
+ }
701
+ return result;
702
+ }
703
+ function normalizeData(data) {
704
+ const d4 = data;
705
+ if (typeof d4 !== "object" || d4 === null) return null;
706
+ const elements = Array.isArray(d4.elements) ? d4.elements.filter((el) => !el.isDeleted) : [];
707
+ const appState = typeof d4.appState === "object" && d4.appState !== null ? d4.appState : {};
708
+ const files = typeof d4.files === "object" && d4.files !== null ? d4.files : {};
709
+ return {
710
+ type: "excalidraw",
711
+ version: typeof d4.version === "number" ? d4.version : 2,
712
+ source: typeof d4.source === "string" ? d4.source : void 0,
713
+ elements,
714
+ appState: { ...DEFAULT_APP_STATE, ...appState },
715
+ files
716
+ };
717
+ }
718
+
719
+ // node_modules/html-void-elements/index.js
720
+ var htmlVoidElements = [
721
+ "area",
722
+ "base",
723
+ "basefont",
724
+ "bgsound",
725
+ "br",
726
+ "col",
727
+ "command",
728
+ "embed",
729
+ "frame",
730
+ "hr",
731
+ "image",
732
+ "img",
733
+ "input",
734
+ "keygen",
735
+ "link",
736
+ "meta",
737
+ "param",
738
+ "source",
739
+ "track",
740
+ "wbr"
741
+ ];
742
+
743
+ // node_modules/property-information/lib/util/schema.js
744
+ var Schema = class {
745
+ /**
746
+ * @param {SchemaType['property']} property
747
+ * Property.
748
+ * @param {SchemaType['normal']} normal
749
+ * Normal.
750
+ * @param {Space | undefined} [space]
751
+ * Space.
752
+ * @returns
753
+ * Schema.
754
+ */
755
+ constructor(property, normal, space) {
756
+ this.normal = normal;
757
+ this.property = property;
758
+ if (space) {
759
+ this.space = space;
760
+ }
761
+ }
762
+ };
763
+ Schema.prototype.normal = {};
764
+ Schema.prototype.property = {};
765
+ Schema.prototype.space = void 0;
766
+
767
+ // node_modules/property-information/lib/util/merge.js
768
+ function merge(definitions, space) {
769
+ const property = {};
770
+ const normal = {};
771
+ for (const definition of definitions) {
772
+ Object.assign(property, definition.property);
773
+ Object.assign(normal, definition.normal);
774
+ }
775
+ return new Schema(property, normal, space);
776
+ }
777
+
778
+ // node_modules/property-information/lib/normalize.js
779
+ function normalize(value) {
780
+ return value.toLowerCase();
781
+ }
782
+
783
+ // node_modules/property-information/lib/util/info.js
784
+ var Info = class {
785
+ /**
786
+ * @param {string} property
787
+ * Property.
788
+ * @param {string} attribute
789
+ * Attribute.
790
+ * @returns
791
+ * Info.
792
+ */
793
+ constructor(property, attribute) {
794
+ this.attribute = attribute;
795
+ this.property = property;
796
+ }
797
+ };
798
+ Info.prototype.attribute = "";
799
+ Info.prototype.booleanish = false;
800
+ Info.prototype.boolean = false;
801
+ Info.prototype.commaOrSpaceSeparated = false;
802
+ Info.prototype.commaSeparated = false;
803
+ Info.prototype.defined = false;
804
+ Info.prototype.mustUseProperty = false;
805
+ Info.prototype.number = false;
806
+ Info.prototype.overloadedBoolean = false;
807
+ Info.prototype.property = "";
808
+ Info.prototype.spaceSeparated = false;
809
+ Info.prototype.space = void 0;
810
+
811
+ // node_modules/property-information/lib/util/types.js
812
+ var types_exports = {};
813
+ __export(types_exports, {
814
+ boolean: () => boolean,
815
+ booleanish: () => booleanish,
816
+ commaOrSpaceSeparated: () => commaOrSpaceSeparated,
817
+ commaSeparated: () => commaSeparated,
818
+ number: () => number,
819
+ overloadedBoolean: () => overloadedBoolean,
820
+ spaceSeparated: () => spaceSeparated
821
+ });
822
+ var powers = 0;
823
+ var boolean = increment();
824
+ var booleanish = increment();
825
+ var overloadedBoolean = increment();
826
+ var number = increment();
827
+ var spaceSeparated = increment();
828
+ var commaSeparated = increment();
829
+ var commaOrSpaceSeparated = increment();
830
+ function increment() {
831
+ return 2 ** ++powers;
832
+ }
833
+
834
+ // node_modules/property-information/lib/util/defined-info.js
835
+ var checks = (
836
+ /** @type {ReadonlyArray<keyof typeof types>} */
837
+ Object.keys(types_exports)
838
+ );
839
+ var DefinedInfo = class extends Info {
840
+ /**
841
+ * @constructor
842
+ * @param {string} property
843
+ * Property.
844
+ * @param {string} attribute
845
+ * Attribute.
846
+ * @param {number | null | undefined} [mask]
847
+ * Mask.
848
+ * @param {Space | undefined} [space]
849
+ * Space.
850
+ * @returns
851
+ * Info.
852
+ */
853
+ constructor(property, attribute, mask, space) {
854
+ let index = -1;
855
+ super(property, attribute);
856
+ mark(this, "space", space);
857
+ if (typeof mask === "number") {
858
+ while (++index < checks.length) {
859
+ const check = checks[index];
860
+ mark(this, checks[index], (mask & types_exports[check]) === types_exports[check]);
861
+ }
862
+ }
863
+ }
864
+ };
865
+ DefinedInfo.prototype.defined = true;
866
+ function mark(values, key2, value) {
867
+ if (value) {
868
+ values[key2] = value;
869
+ }
870
+ }
871
+
872
+ // node_modules/property-information/lib/util/create.js
873
+ function create(definition) {
874
+ const properties = {};
875
+ const normals = {};
876
+ for (const [property, value] of Object.entries(definition.properties)) {
877
+ const info = new DefinedInfo(
878
+ property,
879
+ definition.transform(definition.attributes || {}, property),
880
+ value,
881
+ definition.space
882
+ );
883
+ if (definition.mustUseProperty && definition.mustUseProperty.includes(property)) {
884
+ info.mustUseProperty = true;
885
+ }
886
+ properties[property] = info;
887
+ normals[normalize(property)] = property;
888
+ normals[normalize(info.attribute)] = property;
889
+ }
890
+ return new Schema(properties, normals, definition.space);
891
+ }
892
+
893
+ // node_modules/property-information/lib/aria.js
894
+ var aria = create({
895
+ properties: {
896
+ ariaActiveDescendant: null,
897
+ ariaAtomic: booleanish,
898
+ ariaAutoComplete: null,
899
+ ariaBusy: booleanish,
900
+ ariaChecked: booleanish,
901
+ ariaColCount: number,
902
+ ariaColIndex: number,
903
+ ariaColSpan: number,
904
+ ariaControls: spaceSeparated,
905
+ ariaCurrent: null,
906
+ ariaDescribedBy: spaceSeparated,
907
+ ariaDetails: null,
908
+ ariaDisabled: booleanish,
909
+ ariaDropEffect: spaceSeparated,
910
+ ariaErrorMessage: null,
911
+ ariaExpanded: booleanish,
912
+ ariaFlowTo: spaceSeparated,
913
+ ariaGrabbed: booleanish,
914
+ ariaHasPopup: null,
915
+ ariaHidden: booleanish,
916
+ ariaInvalid: null,
917
+ ariaKeyShortcuts: null,
918
+ ariaLabel: null,
919
+ ariaLabelledBy: spaceSeparated,
920
+ ariaLevel: number,
921
+ ariaLive: null,
922
+ ariaModal: booleanish,
923
+ ariaMultiLine: booleanish,
924
+ ariaMultiSelectable: booleanish,
925
+ ariaOrientation: null,
926
+ ariaOwns: spaceSeparated,
927
+ ariaPlaceholder: null,
928
+ ariaPosInSet: number,
929
+ ariaPressed: booleanish,
930
+ ariaReadOnly: booleanish,
931
+ ariaRelevant: null,
932
+ ariaRequired: booleanish,
933
+ ariaRoleDescription: spaceSeparated,
934
+ ariaRowCount: number,
935
+ ariaRowIndex: number,
936
+ ariaRowSpan: number,
937
+ ariaSelected: booleanish,
938
+ ariaSetSize: number,
939
+ ariaSort: null,
940
+ ariaValueMax: number,
941
+ ariaValueMin: number,
942
+ ariaValueNow: number,
943
+ ariaValueText: null,
944
+ role: null
945
+ },
946
+ transform(_3, property) {
947
+ return property === "role" ? property : "aria-" + property.slice(4).toLowerCase();
948
+ }
949
+ });
950
+
951
+ // node_modules/property-information/lib/util/case-sensitive-transform.js
952
+ function caseSensitiveTransform(attributes, attribute) {
953
+ return attribute in attributes ? attributes[attribute] : attribute;
954
+ }
955
+
956
+ // node_modules/property-information/lib/util/case-insensitive-transform.js
957
+ function caseInsensitiveTransform(attributes, property) {
958
+ return caseSensitiveTransform(attributes, property.toLowerCase());
959
+ }
960
+
961
+ // node_modules/property-information/lib/html.js
962
+ var html = create({
963
+ attributes: {
964
+ acceptcharset: "accept-charset",
965
+ classname: "class",
966
+ htmlfor: "for",
967
+ httpequiv: "http-equiv"
968
+ },
969
+ mustUseProperty: ["checked", "multiple", "muted", "selected"],
970
+ properties: {
971
+ // Standard Properties.
972
+ abbr: null,
973
+ accept: commaSeparated,
974
+ acceptCharset: spaceSeparated,
975
+ accessKey: spaceSeparated,
976
+ action: null,
977
+ allow: null,
978
+ allowFullScreen: boolean,
979
+ allowPaymentRequest: boolean,
980
+ allowUserMedia: boolean,
981
+ alt: null,
982
+ as: null,
983
+ async: boolean,
984
+ autoCapitalize: null,
985
+ autoComplete: spaceSeparated,
986
+ autoFocus: boolean,
987
+ autoPlay: boolean,
988
+ blocking: spaceSeparated,
989
+ capture: null,
990
+ charSet: null,
991
+ checked: boolean,
992
+ cite: null,
993
+ className: spaceSeparated,
994
+ cols: number,
995
+ colSpan: null,
996
+ content: null,
997
+ contentEditable: booleanish,
998
+ controls: boolean,
999
+ controlsList: spaceSeparated,
1000
+ coords: number | commaSeparated,
1001
+ crossOrigin: null,
1002
+ data: null,
1003
+ dateTime: null,
1004
+ decoding: null,
1005
+ default: boolean,
1006
+ defer: boolean,
1007
+ dir: null,
1008
+ dirName: null,
1009
+ disabled: boolean,
1010
+ download: overloadedBoolean,
1011
+ draggable: booleanish,
1012
+ encType: null,
1013
+ enterKeyHint: null,
1014
+ fetchPriority: null,
1015
+ form: null,
1016
+ formAction: null,
1017
+ formEncType: null,
1018
+ formMethod: null,
1019
+ formNoValidate: boolean,
1020
+ formTarget: null,
1021
+ headers: spaceSeparated,
1022
+ height: number,
1023
+ hidden: overloadedBoolean,
1024
+ high: number,
1025
+ href: null,
1026
+ hrefLang: null,
1027
+ htmlFor: spaceSeparated,
1028
+ httpEquiv: spaceSeparated,
1029
+ id: null,
1030
+ imageSizes: null,
1031
+ imageSrcSet: null,
1032
+ inert: boolean,
1033
+ inputMode: null,
1034
+ integrity: null,
1035
+ is: null,
1036
+ isMap: boolean,
1037
+ itemId: null,
1038
+ itemProp: spaceSeparated,
1039
+ itemRef: spaceSeparated,
1040
+ itemScope: boolean,
1041
+ itemType: spaceSeparated,
1042
+ kind: null,
1043
+ label: null,
1044
+ lang: null,
1045
+ language: null,
1046
+ list: null,
1047
+ loading: null,
1048
+ loop: boolean,
1049
+ low: number,
1050
+ manifest: null,
1051
+ max: null,
1052
+ maxLength: number,
1053
+ media: null,
1054
+ method: null,
1055
+ min: null,
1056
+ minLength: number,
1057
+ multiple: boolean,
1058
+ muted: boolean,
1059
+ name: null,
1060
+ nonce: null,
1061
+ noModule: boolean,
1062
+ noValidate: boolean,
1063
+ onAbort: null,
1064
+ onAfterPrint: null,
1065
+ onAuxClick: null,
1066
+ onBeforeMatch: null,
1067
+ onBeforePrint: null,
1068
+ onBeforeToggle: null,
1069
+ onBeforeUnload: null,
1070
+ onBlur: null,
1071
+ onCancel: null,
1072
+ onCanPlay: null,
1073
+ onCanPlayThrough: null,
1074
+ onChange: null,
1075
+ onClick: null,
1076
+ onClose: null,
1077
+ onContextLost: null,
1078
+ onContextMenu: null,
1079
+ onContextRestored: null,
1080
+ onCopy: null,
1081
+ onCueChange: null,
1082
+ onCut: null,
1083
+ onDblClick: null,
1084
+ onDrag: null,
1085
+ onDragEnd: null,
1086
+ onDragEnter: null,
1087
+ onDragExit: null,
1088
+ onDragLeave: null,
1089
+ onDragOver: null,
1090
+ onDragStart: null,
1091
+ onDrop: null,
1092
+ onDurationChange: null,
1093
+ onEmptied: null,
1094
+ onEnded: null,
1095
+ onError: null,
1096
+ onFocus: null,
1097
+ onFormData: null,
1098
+ onHashChange: null,
1099
+ onInput: null,
1100
+ onInvalid: null,
1101
+ onKeyDown: null,
1102
+ onKeyPress: null,
1103
+ onKeyUp: null,
1104
+ onLanguageChange: null,
1105
+ onLoad: null,
1106
+ onLoadedData: null,
1107
+ onLoadedMetadata: null,
1108
+ onLoadEnd: null,
1109
+ onLoadStart: null,
1110
+ onMessage: null,
1111
+ onMessageError: null,
1112
+ onMouseDown: null,
1113
+ onMouseEnter: null,
1114
+ onMouseLeave: null,
1115
+ onMouseMove: null,
1116
+ onMouseOut: null,
1117
+ onMouseOver: null,
1118
+ onMouseUp: null,
1119
+ onOffline: null,
1120
+ onOnline: null,
1121
+ onPageHide: null,
1122
+ onPageShow: null,
1123
+ onPaste: null,
1124
+ onPause: null,
1125
+ onPlay: null,
1126
+ onPlaying: null,
1127
+ onPopState: null,
1128
+ onProgress: null,
1129
+ onRateChange: null,
1130
+ onRejectionHandled: null,
1131
+ onReset: null,
1132
+ onResize: null,
1133
+ onScroll: null,
1134
+ onScrollEnd: null,
1135
+ onSecurityPolicyViolation: null,
1136
+ onSeeked: null,
1137
+ onSeeking: null,
1138
+ onSelect: null,
1139
+ onSlotChange: null,
1140
+ onStalled: null,
1141
+ onStorage: null,
1142
+ onSubmit: null,
1143
+ onSuspend: null,
1144
+ onTimeUpdate: null,
1145
+ onToggle: null,
1146
+ onUnhandledRejection: null,
1147
+ onUnload: null,
1148
+ onVolumeChange: null,
1149
+ onWaiting: null,
1150
+ onWheel: null,
1151
+ open: boolean,
1152
+ optimum: number,
1153
+ pattern: null,
1154
+ ping: spaceSeparated,
1155
+ placeholder: null,
1156
+ playsInline: boolean,
1157
+ popover: null,
1158
+ popoverTarget: null,
1159
+ popoverTargetAction: null,
1160
+ poster: null,
1161
+ preload: null,
1162
+ readOnly: boolean,
1163
+ referrerPolicy: null,
1164
+ rel: spaceSeparated,
1165
+ required: boolean,
1166
+ reversed: boolean,
1167
+ rows: number,
1168
+ rowSpan: number,
1169
+ sandbox: spaceSeparated,
1170
+ scope: null,
1171
+ scoped: boolean,
1172
+ seamless: boolean,
1173
+ selected: boolean,
1174
+ shadowRootClonable: boolean,
1175
+ shadowRootDelegatesFocus: boolean,
1176
+ shadowRootMode: null,
1177
+ shape: null,
1178
+ size: number,
1179
+ sizes: null,
1180
+ slot: null,
1181
+ span: number,
1182
+ spellCheck: booleanish,
1183
+ src: null,
1184
+ srcDoc: null,
1185
+ srcLang: null,
1186
+ srcSet: null,
1187
+ start: number,
1188
+ step: null,
1189
+ style: null,
1190
+ tabIndex: number,
1191
+ target: null,
1192
+ title: null,
1193
+ translate: null,
1194
+ type: null,
1195
+ typeMustMatch: boolean,
1196
+ useMap: null,
1197
+ value: booleanish,
1198
+ width: number,
1199
+ wrap: null,
1200
+ writingSuggestions: null,
1201
+ // Legacy.
1202
+ // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
1203
+ align: null,
1204
+ // Several. Use CSS `text-align` instead,
1205
+ aLink: null,
1206
+ // `<body>`. Use CSS `a:active {color}` instead
1207
+ archive: spaceSeparated,
1208
+ // `<object>`. List of URIs to archives
1209
+ axis: null,
1210
+ // `<td>` and `<th>`. Use `scope` on `<th>`
1211
+ background: null,
1212
+ // `<body>`. Use CSS `background-image` instead
1213
+ bgColor: null,
1214
+ // `<body>` and table elements. Use CSS `background-color` instead
1215
+ border: number,
1216
+ // `<table>`. Use CSS `border-width` instead,
1217
+ borderColor: null,
1218
+ // `<table>`. Use CSS `border-color` instead,
1219
+ bottomMargin: number,
1220
+ // `<body>`
1221
+ cellPadding: null,
1222
+ // `<table>`
1223
+ cellSpacing: null,
1224
+ // `<table>`
1225
+ char: null,
1226
+ // Several table elements. When `align=char`, sets the character to align on
1227
+ charOff: null,
1228
+ // Several table elements. When `char`, offsets the alignment
1229
+ classId: null,
1230
+ // `<object>`
1231
+ clear: null,
1232
+ // `<br>`. Use CSS `clear` instead
1233
+ code: null,
1234
+ // `<object>`
1235
+ codeBase: null,
1236
+ // `<object>`
1237
+ codeType: null,
1238
+ // `<object>`
1239
+ color: null,
1240
+ // `<font>` and `<hr>`. Use CSS instead
1241
+ compact: boolean,
1242
+ // Lists. Use CSS to reduce space between items instead
1243
+ declare: boolean,
1244
+ // `<object>`
1245
+ event: null,
1246
+ // `<script>`
1247
+ face: null,
1248
+ // `<font>`. Use CSS instead
1249
+ frame: null,
1250
+ // `<table>`
1251
+ frameBorder: null,
1252
+ // `<iframe>`. Use CSS `border` instead
1253
+ hSpace: number,
1254
+ // `<img>` and `<object>`
1255
+ leftMargin: number,
1256
+ // `<body>`
1257
+ link: null,
1258
+ // `<body>`. Use CSS `a:link {color: *}` instead
1259
+ longDesc: null,
1260
+ // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>`
1261
+ lowSrc: null,
1262
+ // `<img>`. Use a `<picture>`
1263
+ marginHeight: number,
1264
+ // `<body>`
1265
+ marginWidth: number,
1266
+ // `<body>`
1267
+ noResize: boolean,
1268
+ // `<frame>`
1269
+ noHref: boolean,
1270
+ // `<area>`. Use no href instead of an explicit `nohref`
1271
+ noShade: boolean,
1272
+ // `<hr>`. Use background-color and height instead of borders
1273
+ noWrap: boolean,
1274
+ // `<td>` and `<th>`
1275
+ object: null,
1276
+ // `<applet>`
1277
+ profile: null,
1278
+ // `<head>`
1279
+ prompt: null,
1280
+ // `<isindex>`
1281
+ rev: null,
1282
+ // `<link>`
1283
+ rightMargin: number,
1284
+ // `<body>`
1285
+ rules: null,
1286
+ // `<table>`
1287
+ scheme: null,
1288
+ // `<meta>`
1289
+ scrolling: booleanish,
1290
+ // `<frame>`. Use overflow in the child context
1291
+ standby: null,
1292
+ // `<object>`
1293
+ summary: null,
1294
+ // `<table>`
1295
+ text: null,
1296
+ // `<body>`. Use CSS `color` instead
1297
+ topMargin: number,
1298
+ // `<body>`
1299
+ valueType: null,
1300
+ // `<param>`
1301
+ version: null,
1302
+ // `<html>`. Use a doctype.
1303
+ vAlign: null,
1304
+ // Several. Use CSS `vertical-align` instead
1305
+ vLink: null,
1306
+ // `<body>`. Use CSS `a:visited {color}` instead
1307
+ vSpace: number,
1308
+ // `<img>` and `<object>`
1309
+ // Non-standard Properties.
1310
+ allowTransparency: null,
1311
+ autoCorrect: null,
1312
+ autoSave: null,
1313
+ disablePictureInPicture: boolean,
1314
+ disableRemotePlayback: boolean,
1315
+ prefix: null,
1316
+ property: null,
1317
+ results: number,
1318
+ security: null,
1319
+ unselectable: null
1320
+ },
1321
+ space: "html",
1322
+ transform: caseInsensitiveTransform
1323
+ });
1324
+
1325
+ // node_modules/property-information/lib/svg.js
1326
+ var svg = create({
1327
+ attributes: {
1328
+ accentHeight: "accent-height",
1329
+ alignmentBaseline: "alignment-baseline",
1330
+ arabicForm: "arabic-form",
1331
+ baselineShift: "baseline-shift",
1332
+ capHeight: "cap-height",
1333
+ className: "class",
1334
+ clipPath: "clip-path",
1335
+ clipRule: "clip-rule",
1336
+ colorInterpolation: "color-interpolation",
1337
+ colorInterpolationFilters: "color-interpolation-filters",
1338
+ colorProfile: "color-profile",
1339
+ colorRendering: "color-rendering",
1340
+ crossOrigin: "crossorigin",
1341
+ dataType: "datatype",
1342
+ dominantBaseline: "dominant-baseline",
1343
+ enableBackground: "enable-background",
1344
+ fillOpacity: "fill-opacity",
1345
+ fillRule: "fill-rule",
1346
+ floodColor: "flood-color",
1347
+ floodOpacity: "flood-opacity",
1348
+ fontFamily: "font-family",
1349
+ fontSize: "font-size",
1350
+ fontSizeAdjust: "font-size-adjust",
1351
+ fontStretch: "font-stretch",
1352
+ fontStyle: "font-style",
1353
+ fontVariant: "font-variant",
1354
+ fontWeight: "font-weight",
1355
+ glyphName: "glyph-name",
1356
+ glyphOrientationHorizontal: "glyph-orientation-horizontal",
1357
+ glyphOrientationVertical: "glyph-orientation-vertical",
1358
+ hrefLang: "hreflang",
1359
+ horizAdvX: "horiz-adv-x",
1360
+ horizOriginX: "horiz-origin-x",
1361
+ horizOriginY: "horiz-origin-y",
1362
+ imageRendering: "image-rendering",
1363
+ letterSpacing: "letter-spacing",
1364
+ lightingColor: "lighting-color",
1365
+ markerEnd: "marker-end",
1366
+ markerMid: "marker-mid",
1367
+ markerStart: "marker-start",
1368
+ navDown: "nav-down",
1369
+ navDownLeft: "nav-down-left",
1370
+ navDownRight: "nav-down-right",
1371
+ navLeft: "nav-left",
1372
+ navNext: "nav-next",
1373
+ navPrev: "nav-prev",
1374
+ navRight: "nav-right",
1375
+ navUp: "nav-up",
1376
+ navUpLeft: "nav-up-left",
1377
+ navUpRight: "nav-up-right",
1378
+ onAbort: "onabort",
1379
+ onActivate: "onactivate",
1380
+ onAfterPrint: "onafterprint",
1381
+ onBeforePrint: "onbeforeprint",
1382
+ onBegin: "onbegin",
1383
+ onCancel: "oncancel",
1384
+ onCanPlay: "oncanplay",
1385
+ onCanPlayThrough: "oncanplaythrough",
1386
+ onChange: "onchange",
1387
+ onClick: "onclick",
1388
+ onClose: "onclose",
1389
+ onCopy: "oncopy",
1390
+ onCueChange: "oncuechange",
1391
+ onCut: "oncut",
1392
+ onDblClick: "ondblclick",
1393
+ onDrag: "ondrag",
1394
+ onDragEnd: "ondragend",
1395
+ onDragEnter: "ondragenter",
1396
+ onDragExit: "ondragexit",
1397
+ onDragLeave: "ondragleave",
1398
+ onDragOver: "ondragover",
1399
+ onDragStart: "ondragstart",
1400
+ onDrop: "ondrop",
1401
+ onDurationChange: "ondurationchange",
1402
+ onEmptied: "onemptied",
1403
+ onEnd: "onend",
1404
+ onEnded: "onended",
1405
+ onError: "onerror",
1406
+ onFocus: "onfocus",
1407
+ onFocusIn: "onfocusin",
1408
+ onFocusOut: "onfocusout",
1409
+ onHashChange: "onhashchange",
1410
+ onInput: "oninput",
1411
+ onInvalid: "oninvalid",
1412
+ onKeyDown: "onkeydown",
1413
+ onKeyPress: "onkeypress",
1414
+ onKeyUp: "onkeyup",
1415
+ onLoad: "onload",
1416
+ onLoadedData: "onloadeddata",
1417
+ onLoadedMetadata: "onloadedmetadata",
1418
+ onLoadStart: "onloadstart",
1419
+ onMessage: "onmessage",
1420
+ onMouseDown: "onmousedown",
1421
+ onMouseEnter: "onmouseenter",
1422
+ onMouseLeave: "onmouseleave",
1423
+ onMouseMove: "onmousemove",
1424
+ onMouseOut: "onmouseout",
1425
+ onMouseOver: "onmouseover",
1426
+ onMouseUp: "onmouseup",
1427
+ onMouseWheel: "onmousewheel",
1428
+ onOffline: "onoffline",
1429
+ onOnline: "ononline",
1430
+ onPageHide: "onpagehide",
1431
+ onPageShow: "onpageshow",
1432
+ onPaste: "onpaste",
1433
+ onPause: "onpause",
1434
+ onPlay: "onplay",
1435
+ onPlaying: "onplaying",
1436
+ onPopState: "onpopstate",
1437
+ onProgress: "onprogress",
1438
+ onRateChange: "onratechange",
1439
+ onRepeat: "onrepeat",
1440
+ onReset: "onreset",
1441
+ onResize: "onresize",
1442
+ onScroll: "onscroll",
1443
+ onSeeked: "onseeked",
1444
+ onSeeking: "onseeking",
1445
+ onSelect: "onselect",
1446
+ onShow: "onshow",
1447
+ onStalled: "onstalled",
1448
+ onStorage: "onstorage",
1449
+ onSubmit: "onsubmit",
1450
+ onSuspend: "onsuspend",
1451
+ onTimeUpdate: "ontimeupdate",
1452
+ onToggle: "ontoggle",
1453
+ onUnload: "onunload",
1454
+ onVolumeChange: "onvolumechange",
1455
+ onWaiting: "onwaiting",
1456
+ onZoom: "onzoom",
1457
+ overlinePosition: "overline-position",
1458
+ overlineThickness: "overline-thickness",
1459
+ paintOrder: "paint-order",
1460
+ panose1: "panose-1",
1461
+ pointerEvents: "pointer-events",
1462
+ referrerPolicy: "referrerpolicy",
1463
+ renderingIntent: "rendering-intent",
1464
+ shapeRendering: "shape-rendering",
1465
+ stopColor: "stop-color",
1466
+ stopOpacity: "stop-opacity",
1467
+ strikethroughPosition: "strikethrough-position",
1468
+ strikethroughThickness: "strikethrough-thickness",
1469
+ strokeDashArray: "stroke-dasharray",
1470
+ strokeDashOffset: "stroke-dashoffset",
1471
+ strokeLineCap: "stroke-linecap",
1472
+ strokeLineJoin: "stroke-linejoin",
1473
+ strokeMiterLimit: "stroke-miterlimit",
1474
+ strokeOpacity: "stroke-opacity",
1475
+ strokeWidth: "stroke-width",
1476
+ tabIndex: "tabindex",
1477
+ textAnchor: "text-anchor",
1478
+ textDecoration: "text-decoration",
1479
+ textRendering: "text-rendering",
1480
+ transformOrigin: "transform-origin",
1481
+ typeOf: "typeof",
1482
+ underlinePosition: "underline-position",
1483
+ underlineThickness: "underline-thickness",
1484
+ unicodeBidi: "unicode-bidi",
1485
+ unicodeRange: "unicode-range",
1486
+ unitsPerEm: "units-per-em",
1487
+ vAlphabetic: "v-alphabetic",
1488
+ vHanging: "v-hanging",
1489
+ vIdeographic: "v-ideographic",
1490
+ vMathematical: "v-mathematical",
1491
+ vectorEffect: "vector-effect",
1492
+ vertAdvY: "vert-adv-y",
1493
+ vertOriginX: "vert-origin-x",
1494
+ vertOriginY: "vert-origin-y",
1495
+ wordSpacing: "word-spacing",
1496
+ writingMode: "writing-mode",
1497
+ xHeight: "x-height",
1498
+ // These were camelcased in Tiny. Now lowercased in SVG 2
1499
+ playbackOrder: "playbackorder",
1500
+ timelineBegin: "timelinebegin"
1501
+ },
1502
+ properties: {
1503
+ about: commaOrSpaceSeparated,
1504
+ accentHeight: number,
1505
+ accumulate: null,
1506
+ additive: null,
1507
+ alignmentBaseline: null,
1508
+ alphabetic: number,
1509
+ amplitude: number,
1510
+ arabicForm: null,
1511
+ ascent: number,
1512
+ attributeName: null,
1513
+ attributeType: null,
1514
+ azimuth: number,
1515
+ bandwidth: null,
1516
+ baselineShift: null,
1517
+ baseFrequency: null,
1518
+ baseProfile: null,
1519
+ bbox: null,
1520
+ begin: null,
1521
+ bias: number,
1522
+ by: null,
1523
+ calcMode: null,
1524
+ capHeight: number,
1525
+ className: spaceSeparated,
1526
+ clip: null,
1527
+ clipPath: null,
1528
+ clipPathUnits: null,
1529
+ clipRule: null,
1530
+ color: null,
1531
+ colorInterpolation: null,
1532
+ colorInterpolationFilters: null,
1533
+ colorProfile: null,
1534
+ colorRendering: null,
1535
+ content: null,
1536
+ contentScriptType: null,
1537
+ contentStyleType: null,
1538
+ crossOrigin: null,
1539
+ cursor: null,
1540
+ cx: null,
1541
+ cy: null,
1542
+ d: null,
1543
+ dataType: null,
1544
+ defaultAction: null,
1545
+ descent: number,
1546
+ diffuseConstant: number,
1547
+ direction: null,
1548
+ display: null,
1549
+ dur: null,
1550
+ divisor: number,
1551
+ dominantBaseline: null,
1552
+ download: boolean,
1553
+ dx: null,
1554
+ dy: null,
1555
+ edgeMode: null,
1556
+ editable: null,
1557
+ elevation: number,
1558
+ enableBackground: null,
1559
+ end: null,
1560
+ event: null,
1561
+ exponent: number,
1562
+ externalResourcesRequired: null,
1563
+ fill: null,
1564
+ fillOpacity: number,
1565
+ fillRule: null,
1566
+ filter: null,
1567
+ filterRes: null,
1568
+ filterUnits: null,
1569
+ floodColor: null,
1570
+ floodOpacity: null,
1571
+ focusable: null,
1572
+ focusHighlight: null,
1573
+ fontFamily: null,
1574
+ fontSize: null,
1575
+ fontSizeAdjust: null,
1576
+ fontStretch: null,
1577
+ fontStyle: null,
1578
+ fontVariant: null,
1579
+ fontWeight: null,
1580
+ format: null,
1581
+ fr: null,
1582
+ from: null,
1583
+ fx: null,
1584
+ fy: null,
1585
+ g1: commaSeparated,
1586
+ g2: commaSeparated,
1587
+ glyphName: commaSeparated,
1588
+ glyphOrientationHorizontal: null,
1589
+ glyphOrientationVertical: null,
1590
+ glyphRef: null,
1591
+ gradientTransform: null,
1592
+ gradientUnits: null,
1593
+ handler: null,
1594
+ hanging: number,
1595
+ hatchContentUnits: null,
1596
+ hatchUnits: null,
1597
+ height: null,
1598
+ href: null,
1599
+ hrefLang: null,
1600
+ horizAdvX: number,
1601
+ horizOriginX: number,
1602
+ horizOriginY: number,
1603
+ id: null,
1604
+ ideographic: number,
1605
+ imageRendering: null,
1606
+ initialVisibility: null,
1607
+ in: null,
1608
+ in2: null,
1609
+ intercept: number,
1610
+ k: number,
1611
+ k1: number,
1612
+ k2: number,
1613
+ k3: number,
1614
+ k4: number,
1615
+ kernelMatrix: commaOrSpaceSeparated,
1616
+ kernelUnitLength: null,
1617
+ keyPoints: null,
1618
+ // SEMI_COLON_SEPARATED
1619
+ keySplines: null,
1620
+ // SEMI_COLON_SEPARATED
1621
+ keyTimes: null,
1622
+ // SEMI_COLON_SEPARATED
1623
+ kerning: null,
1624
+ lang: null,
1625
+ lengthAdjust: null,
1626
+ letterSpacing: null,
1627
+ lightingColor: null,
1628
+ limitingConeAngle: number,
1629
+ local: null,
1630
+ markerEnd: null,
1631
+ markerMid: null,
1632
+ markerStart: null,
1633
+ markerHeight: null,
1634
+ markerUnits: null,
1635
+ markerWidth: null,
1636
+ mask: null,
1637
+ maskContentUnits: null,
1638
+ maskUnits: null,
1639
+ mathematical: null,
1640
+ max: null,
1641
+ media: null,
1642
+ mediaCharacterEncoding: null,
1643
+ mediaContentEncodings: null,
1644
+ mediaSize: number,
1645
+ mediaTime: null,
1646
+ method: null,
1647
+ min: null,
1648
+ mode: null,
1649
+ name: null,
1650
+ navDown: null,
1651
+ navDownLeft: null,
1652
+ navDownRight: null,
1653
+ navLeft: null,
1654
+ navNext: null,
1655
+ navPrev: null,
1656
+ navRight: null,
1657
+ navUp: null,
1658
+ navUpLeft: null,
1659
+ navUpRight: null,
1660
+ numOctaves: null,
1661
+ observer: null,
1662
+ offset: null,
1663
+ onAbort: null,
1664
+ onActivate: null,
1665
+ onAfterPrint: null,
1666
+ onBeforePrint: null,
1667
+ onBegin: null,
1668
+ onCancel: null,
1669
+ onCanPlay: null,
1670
+ onCanPlayThrough: null,
1671
+ onChange: null,
1672
+ onClick: null,
1673
+ onClose: null,
1674
+ onCopy: null,
1675
+ onCueChange: null,
1676
+ onCut: null,
1677
+ onDblClick: null,
1678
+ onDrag: null,
1679
+ onDragEnd: null,
1680
+ onDragEnter: null,
1681
+ onDragExit: null,
1682
+ onDragLeave: null,
1683
+ onDragOver: null,
1684
+ onDragStart: null,
1685
+ onDrop: null,
1686
+ onDurationChange: null,
1687
+ onEmptied: null,
1688
+ onEnd: null,
1689
+ onEnded: null,
1690
+ onError: null,
1691
+ onFocus: null,
1692
+ onFocusIn: null,
1693
+ onFocusOut: null,
1694
+ onHashChange: null,
1695
+ onInput: null,
1696
+ onInvalid: null,
1697
+ onKeyDown: null,
1698
+ onKeyPress: null,
1699
+ onKeyUp: null,
1700
+ onLoad: null,
1701
+ onLoadedData: null,
1702
+ onLoadedMetadata: null,
1703
+ onLoadStart: null,
1704
+ onMessage: null,
1705
+ onMouseDown: null,
1706
+ onMouseEnter: null,
1707
+ onMouseLeave: null,
1708
+ onMouseMove: null,
1709
+ onMouseOut: null,
1710
+ onMouseOver: null,
1711
+ onMouseUp: null,
1712
+ onMouseWheel: null,
1713
+ onOffline: null,
1714
+ onOnline: null,
1715
+ onPageHide: null,
1716
+ onPageShow: null,
1717
+ onPaste: null,
1718
+ onPause: null,
1719
+ onPlay: null,
1720
+ onPlaying: null,
1721
+ onPopState: null,
1722
+ onProgress: null,
1723
+ onRateChange: null,
1724
+ onRepeat: null,
1725
+ onReset: null,
1726
+ onResize: null,
1727
+ onScroll: null,
1728
+ onSeeked: null,
1729
+ onSeeking: null,
1730
+ onSelect: null,
1731
+ onShow: null,
1732
+ onStalled: null,
1733
+ onStorage: null,
1734
+ onSubmit: null,
1735
+ onSuspend: null,
1736
+ onTimeUpdate: null,
1737
+ onToggle: null,
1738
+ onUnload: null,
1739
+ onVolumeChange: null,
1740
+ onWaiting: null,
1741
+ onZoom: null,
1742
+ opacity: null,
1743
+ operator: null,
1744
+ order: null,
1745
+ orient: null,
1746
+ orientation: null,
1747
+ origin: null,
1748
+ overflow: null,
1749
+ overlay: null,
1750
+ overlinePosition: number,
1751
+ overlineThickness: number,
1752
+ paintOrder: null,
1753
+ panose1: null,
1754
+ path: null,
1755
+ pathLength: number,
1756
+ patternContentUnits: null,
1757
+ patternTransform: null,
1758
+ patternUnits: null,
1759
+ phase: null,
1760
+ ping: spaceSeparated,
1761
+ pitch: null,
1762
+ playbackOrder: null,
1763
+ pointerEvents: null,
1764
+ points: null,
1765
+ pointsAtX: number,
1766
+ pointsAtY: number,
1767
+ pointsAtZ: number,
1768
+ preserveAlpha: null,
1769
+ preserveAspectRatio: null,
1770
+ primitiveUnits: null,
1771
+ propagate: null,
1772
+ property: commaOrSpaceSeparated,
1773
+ r: null,
1774
+ radius: null,
1775
+ referrerPolicy: null,
1776
+ refX: null,
1777
+ refY: null,
1778
+ rel: commaOrSpaceSeparated,
1779
+ rev: commaOrSpaceSeparated,
1780
+ renderingIntent: null,
1781
+ repeatCount: null,
1782
+ repeatDur: null,
1783
+ requiredExtensions: commaOrSpaceSeparated,
1784
+ requiredFeatures: commaOrSpaceSeparated,
1785
+ requiredFonts: commaOrSpaceSeparated,
1786
+ requiredFormats: commaOrSpaceSeparated,
1787
+ resource: null,
1788
+ restart: null,
1789
+ result: null,
1790
+ rotate: null,
1791
+ rx: null,
1792
+ ry: null,
1793
+ scale: null,
1794
+ seed: null,
1795
+ shapeRendering: null,
1796
+ side: null,
1797
+ slope: null,
1798
+ snapshotTime: null,
1799
+ specularConstant: number,
1800
+ specularExponent: number,
1801
+ spreadMethod: null,
1802
+ spacing: null,
1803
+ startOffset: null,
1804
+ stdDeviation: null,
1805
+ stemh: null,
1806
+ stemv: null,
1807
+ stitchTiles: null,
1808
+ stopColor: null,
1809
+ stopOpacity: null,
1810
+ strikethroughPosition: number,
1811
+ strikethroughThickness: number,
1812
+ string: null,
1813
+ stroke: null,
1814
+ strokeDashArray: commaOrSpaceSeparated,
1815
+ strokeDashOffset: null,
1816
+ strokeLineCap: null,
1817
+ strokeLineJoin: null,
1818
+ strokeMiterLimit: number,
1819
+ strokeOpacity: number,
1820
+ strokeWidth: null,
1821
+ style: null,
1822
+ surfaceScale: number,
1823
+ syncBehavior: null,
1824
+ syncBehaviorDefault: null,
1825
+ syncMaster: null,
1826
+ syncTolerance: null,
1827
+ syncToleranceDefault: null,
1828
+ systemLanguage: commaOrSpaceSeparated,
1829
+ tabIndex: number,
1830
+ tableValues: null,
1831
+ target: null,
1832
+ targetX: number,
1833
+ targetY: number,
1834
+ textAnchor: null,
1835
+ textDecoration: null,
1836
+ textRendering: null,
1837
+ textLength: null,
1838
+ timelineBegin: null,
1839
+ title: null,
1840
+ transformBehavior: null,
1841
+ type: null,
1842
+ typeOf: commaOrSpaceSeparated,
1843
+ to: null,
1844
+ transform: null,
1845
+ transformOrigin: null,
1846
+ u1: null,
1847
+ u2: null,
1848
+ underlinePosition: number,
1849
+ underlineThickness: number,
1850
+ unicode: null,
1851
+ unicodeBidi: null,
1852
+ unicodeRange: null,
1853
+ unitsPerEm: number,
1854
+ values: null,
1855
+ vAlphabetic: number,
1856
+ vMathematical: number,
1857
+ vectorEffect: null,
1858
+ vHanging: number,
1859
+ vIdeographic: number,
1860
+ version: null,
1861
+ vertAdvY: number,
1862
+ vertOriginX: number,
1863
+ vertOriginY: number,
1864
+ viewBox: null,
1865
+ viewTarget: null,
1866
+ visibility: null,
1867
+ width: null,
1868
+ widths: null,
1869
+ wordSpacing: null,
1870
+ writingMode: null,
1871
+ x: null,
1872
+ x1: null,
1873
+ x2: null,
1874
+ xChannelSelector: null,
1875
+ xHeight: number,
1876
+ y: null,
1877
+ y1: null,
1878
+ y2: null,
1879
+ yChannelSelector: null,
1880
+ z: null,
1881
+ zoomAndPan: null
1882
+ },
1883
+ space: "svg",
1884
+ transform: caseSensitiveTransform
1885
+ });
1886
+
1887
+ // node_modules/property-information/lib/xlink.js
1888
+ var xlink = create({
1889
+ properties: {
1890
+ xLinkActuate: null,
1891
+ xLinkArcRole: null,
1892
+ xLinkHref: null,
1893
+ xLinkRole: null,
1894
+ xLinkShow: null,
1895
+ xLinkTitle: null,
1896
+ xLinkType: null
1897
+ },
1898
+ space: "xlink",
1899
+ transform(_3, property) {
1900
+ return "xlink:" + property.slice(5).toLowerCase();
1901
+ }
1902
+ });
1903
+
1904
+ // node_modules/property-information/lib/xmlns.js
1905
+ var xmlns = create({
1906
+ attributes: { xmlnsxlink: "xmlns:xlink" },
1907
+ properties: { xmlnsXLink: null, xmlns: null },
1908
+ space: "xmlns",
1909
+ transform: caseInsensitiveTransform
1910
+ });
1911
+
1912
+ // node_modules/property-information/lib/xml.js
1913
+ var xml = create({
1914
+ properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
1915
+ space: "xml",
1916
+ transform(_3, property) {
1917
+ return "xml:" + property.slice(3).toLowerCase();
1918
+ }
1919
+ });
1920
+
1921
+ // node_modules/property-information/lib/find.js
1922
+ var cap = /[A-Z]/g;
1923
+ var dash = /-[a-z]/g;
1924
+ var valid = /^data[-\w.:]+$/i;
1925
+ function find(schema, value) {
1926
+ const normal = normalize(value);
1927
+ let property = value;
1928
+ let Type = Info;
1929
+ if (normal in schema.normal) {
1930
+ return schema.property[schema.normal[normal]];
1931
+ }
1932
+ if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) {
1933
+ if (value.charAt(4) === "-") {
1934
+ const rest = value.slice(5).replace(dash, camelcase);
1935
+ property = "data" + rest.charAt(0).toUpperCase() + rest.slice(1);
1936
+ } else {
1937
+ const rest = value.slice(4);
1938
+ if (!dash.test(rest)) {
1939
+ let dashes = rest.replace(cap, kebab);
1940
+ if (dashes.charAt(0) !== "-") {
1941
+ dashes = "-" + dashes;
1942
+ }
1943
+ value = "data" + dashes;
1944
+ }
1945
+ }
1946
+ Type = DefinedInfo;
1947
+ }
1948
+ return new Type(property, value);
1949
+ }
1950
+ function kebab($0) {
1951
+ return "-" + $0.toLowerCase();
1952
+ }
1953
+ function camelcase($0) {
1954
+ return $0.charAt(1).toUpperCase();
1955
+ }
1956
+
1957
+ // node_modules/property-information/index.js
1958
+ var html2 = merge([aria, html, xlink, xmlns, xml], "html");
1959
+ var svg2 = merge([aria, svg, xlink, xmlns, xml], "svg");
1960
+
1961
+ // node_modules/zwitch/index.js
1962
+ var own2 = {}.hasOwnProperty;
1963
+ function zwitch(key2, options) {
1964
+ const settings = options || {};
1965
+ function one2(value, ...parameters) {
1966
+ let fn = one2.invalid;
1967
+ const handlers = one2.handlers;
1968
+ if (value && own2.call(value, key2)) {
1969
+ const id = String(value[key2]);
1970
+ fn = own2.call(handlers, id) ? handlers[id] : one2.unknown;
1971
+ }
1972
+ if (fn) {
1973
+ return fn.call(this, value, ...parameters);
1974
+ }
1975
+ }
1976
+ one2.handlers = settings.handlers || {};
1977
+ one2.invalid = settings.invalid;
1978
+ one2.unknown = settings.unknown;
1979
+ return one2;
1980
+ }
1981
+
1982
+ // node_modules/stringify-entities/lib/core.js
1983
+ var defaultSubsetRegex = /["&'<>`]/g;
1984
+ var surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
1985
+ var controlCharactersRegex = (
1986
+ // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
1987
+ /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g
1988
+ );
1989
+ var regexEscapeRegex = /[|\\{}()[\]^$+*?.]/g;
1990
+ var subsetToRegexCache = /* @__PURE__ */ new WeakMap();
1991
+ function core(value, options) {
1992
+ value = value.replace(
1993
+ options.subset ? charactersToExpressionCached(options.subset) : defaultSubsetRegex,
1994
+ basic
1995
+ );
1996
+ if (options.subset || options.escapeOnly) {
1997
+ return value;
1998
+ }
1999
+ return value.replace(surrogatePairsRegex, surrogate).replace(controlCharactersRegex, basic);
2000
+ function surrogate(pair, index, all2) {
2001
+ return options.format(
2002
+ (pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536,
2003
+ all2.charCodeAt(index + 2),
2004
+ options
2005
+ );
2006
+ }
2007
+ function basic(character, index, all2) {
2008
+ return options.format(
2009
+ character.charCodeAt(0),
2010
+ all2.charCodeAt(index + 1),
2011
+ options
2012
+ );
2013
+ }
2014
+ }
2015
+ function charactersToExpressionCached(subset) {
2016
+ let cached = subsetToRegexCache.get(subset);
2017
+ if (!cached) {
2018
+ cached = charactersToExpression(subset);
2019
+ subsetToRegexCache.set(subset, cached);
2020
+ }
2021
+ return cached;
2022
+ }
2023
+ function charactersToExpression(subset) {
2024
+ const groups = [];
2025
+ let index = -1;
2026
+ while (++index < subset.length) {
2027
+ groups.push(subset[index].replace(regexEscapeRegex, "\\$&"));
2028
+ }
2029
+ return new RegExp("(?:" + groups.join("|") + ")", "g");
2030
+ }
2031
+
2032
+ // node_modules/stringify-entities/lib/util/to-hexadecimal.js
2033
+ var hexadecimalRegex = /[\dA-Fa-f]/;
2034
+ function toHexadecimal(code, next, omit) {
2035
+ const value = "&#x" + code.toString(16).toUpperCase();
2036
+ return omit && next && !hexadecimalRegex.test(String.fromCharCode(next)) ? value : value + ";";
2037
+ }
2038
+
2039
+ // node_modules/stringify-entities/lib/util/to-decimal.js
2040
+ var decimalRegex = /\d/;
2041
+ function toDecimal(code, next, omit) {
2042
+ const value = "&#" + String(code);
2043
+ return omit && next && !decimalRegex.test(String.fromCharCode(next)) ? value : value + ";";
2044
+ }
2045
+
2046
+ // node_modules/character-entities-legacy/index.js
2047
+ var characterEntitiesLegacy = [
2048
+ "AElig",
2049
+ "AMP",
2050
+ "Aacute",
2051
+ "Acirc",
2052
+ "Agrave",
2053
+ "Aring",
2054
+ "Atilde",
2055
+ "Auml",
2056
+ "COPY",
2057
+ "Ccedil",
2058
+ "ETH",
2059
+ "Eacute",
2060
+ "Ecirc",
2061
+ "Egrave",
2062
+ "Euml",
2063
+ "GT",
2064
+ "Iacute",
2065
+ "Icirc",
2066
+ "Igrave",
2067
+ "Iuml",
2068
+ "LT",
2069
+ "Ntilde",
2070
+ "Oacute",
2071
+ "Ocirc",
2072
+ "Ograve",
2073
+ "Oslash",
2074
+ "Otilde",
2075
+ "Ouml",
2076
+ "QUOT",
2077
+ "REG",
2078
+ "THORN",
2079
+ "Uacute",
2080
+ "Ucirc",
2081
+ "Ugrave",
2082
+ "Uuml",
2083
+ "Yacute",
2084
+ "aacute",
2085
+ "acirc",
2086
+ "acute",
2087
+ "aelig",
2088
+ "agrave",
2089
+ "amp",
2090
+ "aring",
2091
+ "atilde",
2092
+ "auml",
2093
+ "brvbar",
2094
+ "ccedil",
2095
+ "cedil",
2096
+ "cent",
2097
+ "copy",
2098
+ "curren",
2099
+ "deg",
2100
+ "divide",
2101
+ "eacute",
2102
+ "ecirc",
2103
+ "egrave",
2104
+ "eth",
2105
+ "euml",
2106
+ "frac12",
2107
+ "frac14",
2108
+ "frac34",
2109
+ "gt",
2110
+ "iacute",
2111
+ "icirc",
2112
+ "iexcl",
2113
+ "igrave",
2114
+ "iquest",
2115
+ "iuml",
2116
+ "laquo",
2117
+ "lt",
2118
+ "macr",
2119
+ "micro",
2120
+ "middot",
2121
+ "nbsp",
2122
+ "not",
2123
+ "ntilde",
2124
+ "oacute",
2125
+ "ocirc",
2126
+ "ograve",
2127
+ "ordf",
2128
+ "ordm",
2129
+ "oslash",
2130
+ "otilde",
2131
+ "ouml",
2132
+ "para",
2133
+ "plusmn",
2134
+ "pound",
2135
+ "quot",
2136
+ "raquo",
2137
+ "reg",
2138
+ "sect",
2139
+ "shy",
2140
+ "sup1",
2141
+ "sup2",
2142
+ "sup3",
2143
+ "szlig",
2144
+ "thorn",
2145
+ "times",
2146
+ "uacute",
2147
+ "ucirc",
2148
+ "ugrave",
2149
+ "uml",
2150
+ "uuml",
2151
+ "yacute",
2152
+ "yen",
2153
+ "yuml"
2154
+ ];
2155
+
2156
+ // node_modules/character-entities-html4/index.js
2157
+ var characterEntitiesHtml4 = {
2158
+ nbsp: "\xA0",
2159
+ iexcl: "\xA1",
2160
+ cent: "\xA2",
2161
+ pound: "\xA3",
2162
+ curren: "\xA4",
2163
+ yen: "\xA5",
2164
+ brvbar: "\xA6",
2165
+ sect: "\xA7",
2166
+ uml: "\xA8",
2167
+ copy: "\xA9",
2168
+ ordf: "\xAA",
2169
+ laquo: "\xAB",
2170
+ not: "\xAC",
2171
+ shy: "\xAD",
2172
+ reg: "\xAE",
2173
+ macr: "\xAF",
2174
+ deg: "\xB0",
2175
+ plusmn: "\xB1",
2176
+ sup2: "\xB2",
2177
+ sup3: "\xB3",
2178
+ acute: "\xB4",
2179
+ micro: "\xB5",
2180
+ para: "\xB6",
2181
+ middot: "\xB7",
2182
+ cedil: "\xB8",
2183
+ sup1: "\xB9",
2184
+ ordm: "\xBA",
2185
+ raquo: "\xBB",
2186
+ frac14: "\xBC",
2187
+ frac12: "\xBD",
2188
+ frac34: "\xBE",
2189
+ iquest: "\xBF",
2190
+ Agrave: "\xC0",
2191
+ Aacute: "\xC1",
2192
+ Acirc: "\xC2",
2193
+ Atilde: "\xC3",
2194
+ Auml: "\xC4",
2195
+ Aring: "\xC5",
2196
+ AElig: "\xC6",
2197
+ Ccedil: "\xC7",
2198
+ Egrave: "\xC8",
2199
+ Eacute: "\xC9",
2200
+ Ecirc: "\xCA",
2201
+ Euml: "\xCB",
2202
+ Igrave: "\xCC",
2203
+ Iacute: "\xCD",
2204
+ Icirc: "\xCE",
2205
+ Iuml: "\xCF",
2206
+ ETH: "\xD0",
2207
+ Ntilde: "\xD1",
2208
+ Ograve: "\xD2",
2209
+ Oacute: "\xD3",
2210
+ Ocirc: "\xD4",
2211
+ Otilde: "\xD5",
2212
+ Ouml: "\xD6",
2213
+ times: "\xD7",
2214
+ Oslash: "\xD8",
2215
+ Ugrave: "\xD9",
2216
+ Uacute: "\xDA",
2217
+ Ucirc: "\xDB",
2218
+ Uuml: "\xDC",
2219
+ Yacute: "\xDD",
2220
+ THORN: "\xDE",
2221
+ szlig: "\xDF",
2222
+ agrave: "\xE0",
2223
+ aacute: "\xE1",
2224
+ acirc: "\xE2",
2225
+ atilde: "\xE3",
2226
+ auml: "\xE4",
2227
+ aring: "\xE5",
2228
+ aelig: "\xE6",
2229
+ ccedil: "\xE7",
2230
+ egrave: "\xE8",
2231
+ eacute: "\xE9",
2232
+ ecirc: "\xEA",
2233
+ euml: "\xEB",
2234
+ igrave: "\xEC",
2235
+ iacute: "\xED",
2236
+ icirc: "\xEE",
2237
+ iuml: "\xEF",
2238
+ eth: "\xF0",
2239
+ ntilde: "\xF1",
2240
+ ograve: "\xF2",
2241
+ oacute: "\xF3",
2242
+ ocirc: "\xF4",
2243
+ otilde: "\xF5",
2244
+ ouml: "\xF6",
2245
+ divide: "\xF7",
2246
+ oslash: "\xF8",
2247
+ ugrave: "\xF9",
2248
+ uacute: "\xFA",
2249
+ ucirc: "\xFB",
2250
+ uuml: "\xFC",
2251
+ yacute: "\xFD",
2252
+ thorn: "\xFE",
2253
+ yuml: "\xFF",
2254
+ fnof: "\u0192",
2255
+ Alpha: "\u0391",
2256
+ Beta: "\u0392",
2257
+ Gamma: "\u0393",
2258
+ Delta: "\u0394",
2259
+ Epsilon: "\u0395",
2260
+ Zeta: "\u0396",
2261
+ Eta: "\u0397",
2262
+ Theta: "\u0398",
2263
+ Iota: "\u0399",
2264
+ Kappa: "\u039A",
2265
+ Lambda: "\u039B",
2266
+ Mu: "\u039C",
2267
+ Nu: "\u039D",
2268
+ Xi: "\u039E",
2269
+ Omicron: "\u039F",
2270
+ Pi: "\u03A0",
2271
+ Rho: "\u03A1",
2272
+ Sigma: "\u03A3",
2273
+ Tau: "\u03A4",
2274
+ Upsilon: "\u03A5",
2275
+ Phi: "\u03A6",
2276
+ Chi: "\u03A7",
2277
+ Psi: "\u03A8",
2278
+ Omega: "\u03A9",
2279
+ alpha: "\u03B1",
2280
+ beta: "\u03B2",
2281
+ gamma: "\u03B3",
2282
+ delta: "\u03B4",
2283
+ epsilon: "\u03B5",
2284
+ zeta: "\u03B6",
2285
+ eta: "\u03B7",
2286
+ theta: "\u03B8",
2287
+ iota: "\u03B9",
2288
+ kappa: "\u03BA",
2289
+ lambda: "\u03BB",
2290
+ mu: "\u03BC",
2291
+ nu: "\u03BD",
2292
+ xi: "\u03BE",
2293
+ omicron: "\u03BF",
2294
+ pi: "\u03C0",
2295
+ rho: "\u03C1",
2296
+ sigmaf: "\u03C2",
2297
+ sigma: "\u03C3",
2298
+ tau: "\u03C4",
2299
+ upsilon: "\u03C5",
2300
+ phi: "\u03C6",
2301
+ chi: "\u03C7",
2302
+ psi: "\u03C8",
2303
+ omega: "\u03C9",
2304
+ thetasym: "\u03D1",
2305
+ upsih: "\u03D2",
2306
+ piv: "\u03D6",
2307
+ bull: "\u2022",
2308
+ hellip: "\u2026",
2309
+ prime: "\u2032",
2310
+ Prime: "\u2033",
2311
+ oline: "\u203E",
2312
+ frasl: "\u2044",
2313
+ weierp: "\u2118",
2314
+ image: "\u2111",
2315
+ real: "\u211C",
2316
+ trade: "\u2122",
2317
+ alefsym: "\u2135",
2318
+ larr: "\u2190",
2319
+ uarr: "\u2191",
2320
+ rarr: "\u2192",
2321
+ darr: "\u2193",
2322
+ harr: "\u2194",
2323
+ crarr: "\u21B5",
2324
+ lArr: "\u21D0",
2325
+ uArr: "\u21D1",
2326
+ rArr: "\u21D2",
2327
+ dArr: "\u21D3",
2328
+ hArr: "\u21D4",
2329
+ forall: "\u2200",
2330
+ part: "\u2202",
2331
+ exist: "\u2203",
2332
+ empty: "\u2205",
2333
+ nabla: "\u2207",
2334
+ isin: "\u2208",
2335
+ notin: "\u2209",
2336
+ ni: "\u220B",
2337
+ prod: "\u220F",
2338
+ sum: "\u2211",
2339
+ minus: "\u2212",
2340
+ lowast: "\u2217",
2341
+ radic: "\u221A",
2342
+ prop: "\u221D",
2343
+ infin: "\u221E",
2344
+ ang: "\u2220",
2345
+ and: "\u2227",
2346
+ or: "\u2228",
2347
+ cap: "\u2229",
2348
+ cup: "\u222A",
2349
+ int: "\u222B",
2350
+ there4: "\u2234",
2351
+ sim: "\u223C",
2352
+ cong: "\u2245",
2353
+ asymp: "\u2248",
2354
+ ne: "\u2260",
2355
+ equiv: "\u2261",
2356
+ le: "\u2264",
2357
+ ge: "\u2265",
2358
+ sub: "\u2282",
2359
+ sup: "\u2283",
2360
+ nsub: "\u2284",
2361
+ sube: "\u2286",
2362
+ supe: "\u2287",
2363
+ oplus: "\u2295",
2364
+ otimes: "\u2297",
2365
+ perp: "\u22A5",
2366
+ sdot: "\u22C5",
2367
+ lceil: "\u2308",
2368
+ rceil: "\u2309",
2369
+ lfloor: "\u230A",
2370
+ rfloor: "\u230B",
2371
+ lang: "\u2329",
2372
+ rang: "\u232A",
2373
+ loz: "\u25CA",
2374
+ spades: "\u2660",
2375
+ clubs: "\u2663",
2376
+ hearts: "\u2665",
2377
+ diams: "\u2666",
2378
+ quot: '"',
2379
+ amp: "&",
2380
+ lt: "<",
2381
+ gt: ">",
2382
+ OElig: "\u0152",
2383
+ oelig: "\u0153",
2384
+ Scaron: "\u0160",
2385
+ scaron: "\u0161",
2386
+ Yuml: "\u0178",
2387
+ circ: "\u02C6",
2388
+ tilde: "\u02DC",
2389
+ ensp: "\u2002",
2390
+ emsp: "\u2003",
2391
+ thinsp: "\u2009",
2392
+ zwnj: "\u200C",
2393
+ zwj: "\u200D",
2394
+ lrm: "\u200E",
2395
+ rlm: "\u200F",
2396
+ ndash: "\u2013",
2397
+ mdash: "\u2014",
2398
+ lsquo: "\u2018",
2399
+ rsquo: "\u2019",
2400
+ sbquo: "\u201A",
2401
+ ldquo: "\u201C",
2402
+ rdquo: "\u201D",
2403
+ bdquo: "\u201E",
2404
+ dagger: "\u2020",
2405
+ Dagger: "\u2021",
2406
+ permil: "\u2030",
2407
+ lsaquo: "\u2039",
2408
+ rsaquo: "\u203A",
2409
+ euro: "\u20AC"
2410
+ };
2411
+
2412
+ // node_modules/stringify-entities/lib/constant/dangerous.js
2413
+ var dangerous = [
2414
+ "cent",
2415
+ "copy",
2416
+ "divide",
2417
+ "gt",
2418
+ "lt",
2419
+ "not",
2420
+ "para",
2421
+ "times"
2422
+ ];
2423
+
2424
+ // node_modules/stringify-entities/lib/util/to-named.js
2425
+ var own3 = {}.hasOwnProperty;
2426
+ var characters = {};
2427
+ var key;
2428
+ for (key in characterEntitiesHtml4) {
2429
+ if (own3.call(characterEntitiesHtml4, key)) {
2430
+ characters[characterEntitiesHtml4[key]] = key;
2431
+ }
2432
+ }
2433
+ var notAlphanumericRegex = /[^\dA-Za-z]/;
2434
+ function toNamed(code, next, omit, attribute) {
2435
+ const character = String.fromCharCode(code);
2436
+ if (own3.call(characters, character)) {
2437
+ const name = characters[character];
2438
+ const value = "&" + name;
2439
+ if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) {
2440
+ return value;
2441
+ }
2442
+ return value + ";";
2443
+ }
2444
+ return "";
2445
+ }
2446
+
2447
+ // node_modules/stringify-entities/lib/util/format-smart.js
2448
+ function formatSmart(code, next, options) {
2449
+ let numeric = toHexadecimal(code, next, options.omitOptionalSemicolons);
2450
+ let named;
2451
+ if (options.useNamedReferences || options.useShortestReferences) {
2452
+ named = toNamed(
2453
+ code,
2454
+ next,
2455
+ options.omitOptionalSemicolons,
2456
+ options.attribute
2457
+ );
2458
+ }
2459
+ if ((options.useShortestReferences || !named) && options.useShortestReferences) {
2460
+ const decimal = toDecimal(code, next, options.omitOptionalSemicolons);
2461
+ if (decimal.length < numeric.length) {
2462
+ numeric = decimal;
2463
+ }
2464
+ }
2465
+ return named && (!options.useShortestReferences || named.length < numeric.length) ? named : numeric;
2466
+ }
2467
+
2468
+ // node_modules/stringify-entities/lib/index.js
2469
+ function stringifyEntities(value, options) {
2470
+ return core(value, Object.assign({ format: formatSmart }, options));
2471
+ }
2472
+
2473
+ // node_modules/hast-util-to-html/lib/handle/comment.js
2474
+ var htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g;
2475
+ var bogusCommentEntitySubset = [">"];
2476
+ var commentEntitySubset = ["<", ">"];
2477
+ function comment(node, _1, _22, state) {
2478
+ return state.settings.bogusComments ? "<?" + stringifyEntities(
2479
+ node.value,
2480
+ Object.assign({}, state.settings.characterReferences, {
2481
+ subset: bogusCommentEntitySubset
2482
+ })
2483
+ ) + ">" : "<!--" + node.value.replace(htmlCommentRegex, encode) + "-->";
2484
+ function encode($0) {
2485
+ return stringifyEntities(
2486
+ $0,
2487
+ Object.assign({}, state.settings.characterReferences, {
2488
+ subset: commentEntitySubset
2489
+ })
2490
+ );
2491
+ }
2492
+ }
2493
+
2494
+ // node_modules/hast-util-to-html/lib/handle/doctype.js
2495
+ function doctype(_1, _22, _3, state) {
2496
+ return "<!" + (state.settings.upperDoctype ? "DOCTYPE" : "doctype") + (state.settings.tightDoctype ? "" : " ") + "html>";
2497
+ }
2498
+
2499
+ // node_modules/ccount/index.js
2500
+ function ccount(value, character) {
2501
+ const source = String(value);
2502
+ if (typeof character !== "string") {
2503
+ throw new TypeError("Expected character");
2504
+ }
2505
+ let count = 0;
2506
+ let index = source.indexOf(character);
2507
+ while (index !== -1) {
2508
+ count++;
2509
+ index = source.indexOf(character, index + character.length);
2510
+ }
2511
+ return count;
2512
+ }
2513
+
2514
+ // node_modules/comma-separated-tokens/index.js
2515
+ function stringify(values, options) {
2516
+ const settings = options || {};
2517
+ const input = values[values.length - 1] === "" ? [...values, ""] : values;
2518
+ return input.join(
2519
+ (settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
2520
+ ).trim();
2521
+ }
2522
+
2523
+ // node_modules/space-separated-tokens/index.js
2524
+ function stringify2(values) {
2525
+ return values.join(" ").trim();
2526
+ }
2527
+
2528
+ // node_modules/hast-util-whitespace/lib/index.js
2529
+ var re = /[ \t\n\f\r]/g;
2530
+ function whitespace(thing) {
2531
+ return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing);
2532
+ }
2533
+ function empty(value) {
2534
+ return value.replace(re, "") === "";
2535
+ }
2536
+
2537
+ // node_modules/hast-util-to-html/lib/omission/util/siblings.js
2538
+ var siblingAfter = siblings(1);
2539
+ var siblingBefore = siblings(-1);
2540
+ var emptyChildren = [];
2541
+ function siblings(increment2) {
2542
+ return sibling;
2543
+ function sibling(parent, index, includeWhitespace) {
2544
+ const siblings2 = parent ? parent.children : emptyChildren;
2545
+ let offset = (index || 0) + increment2;
2546
+ let next = siblings2[offset];
2547
+ if (!includeWhitespace) {
2548
+ while (next && whitespace(next)) {
2549
+ offset += increment2;
2550
+ next = siblings2[offset];
2551
+ }
2552
+ }
2553
+ return next;
2554
+ }
2555
+ }
2556
+
2557
+ // node_modules/hast-util-to-html/lib/omission/omission.js
2558
+ var own4 = {}.hasOwnProperty;
2559
+ function omission(handlers) {
2560
+ return omit;
2561
+ function omit(node, index, parent) {
2562
+ return own4.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
2563
+ }
2564
+ }
2565
+
2566
+ // node_modules/hast-util-to-html/lib/omission/closing.js
2567
+ var closing = omission({
2568
+ body,
2569
+ caption: headOrColgroupOrCaption,
2570
+ colgroup: headOrColgroupOrCaption,
2571
+ dd,
2572
+ dt,
2573
+ head: headOrColgroupOrCaption,
2574
+ html: html3,
2575
+ li,
2576
+ optgroup,
2577
+ option,
2578
+ p,
2579
+ rp: rubyElement,
2580
+ rt: rubyElement,
2581
+ tbody,
2582
+ td: cells,
2583
+ tfoot,
2584
+ th: cells,
2585
+ thead,
2586
+ tr
2587
+ });
2588
+ function headOrColgroupOrCaption(_3, index, parent) {
2589
+ const next = siblingAfter(parent, index, true);
2590
+ return !next || next.type !== "comment" && !(next.type === "text" && whitespace(next.value.charAt(0)));
2591
+ }
2592
+ function html3(_3, index, parent) {
2593
+ const next = siblingAfter(parent, index);
2594
+ return !next || next.type !== "comment";
2595
+ }
2596
+ function body(_3, index, parent) {
2597
+ const next = siblingAfter(parent, index);
2598
+ return !next || next.type !== "comment";
2599
+ }
2600
+ function p(_3, index, parent) {
2601
+ const next = siblingAfter(parent, index);
2602
+ return next ? next.type === "element" && (next.tagName === "address" || next.tagName === "article" || next.tagName === "aside" || next.tagName === "blockquote" || next.tagName === "details" || next.tagName === "div" || next.tagName === "dl" || next.tagName === "fieldset" || next.tagName === "figcaption" || next.tagName === "figure" || next.tagName === "footer" || next.tagName === "form" || next.tagName === "h1" || next.tagName === "h2" || next.tagName === "h3" || next.tagName === "h4" || next.tagName === "h5" || next.tagName === "h6" || next.tagName === "header" || next.tagName === "hgroup" || next.tagName === "hr" || next.tagName === "main" || next.tagName === "menu" || next.tagName === "nav" || next.tagName === "ol" || next.tagName === "p" || next.tagName === "pre" || next.tagName === "section" || next.tagName === "table" || next.tagName === "ul") : !parent || // Confusing parent.
2603
+ !(parent.type === "element" && (parent.tagName === "a" || parent.tagName === "audio" || parent.tagName === "del" || parent.tagName === "ins" || parent.tagName === "map" || parent.tagName === "noscript" || parent.tagName === "video"));
2604
+ }
2605
+ function li(_3, index, parent) {
2606
+ const next = siblingAfter(parent, index);
2607
+ return !next || next.type === "element" && next.tagName === "li";
2608
+ }
2609
+ function dt(_3, index, parent) {
2610
+ const next = siblingAfter(parent, index);
2611
+ return Boolean(
2612
+ next && next.type === "element" && (next.tagName === "dt" || next.tagName === "dd")
2613
+ );
2614
+ }
2615
+ function dd(_3, index, parent) {
2616
+ const next = siblingAfter(parent, index);
2617
+ return !next || next.type === "element" && (next.tagName === "dt" || next.tagName === "dd");
2618
+ }
2619
+ function rubyElement(_3, index, parent) {
2620
+ const next = siblingAfter(parent, index);
2621
+ return !next || next.type === "element" && (next.tagName === "rp" || next.tagName === "rt");
2622
+ }
2623
+ function optgroup(_3, index, parent) {
2624
+ const next = siblingAfter(parent, index);
2625
+ return !next || next.type === "element" && next.tagName === "optgroup";
2626
+ }
2627
+ function option(_3, index, parent) {
2628
+ const next = siblingAfter(parent, index);
2629
+ return !next || next.type === "element" && (next.tagName === "option" || next.tagName === "optgroup");
2630
+ }
2631
+ function thead(_3, index, parent) {
2632
+ const next = siblingAfter(parent, index);
2633
+ return Boolean(
2634
+ next && next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot")
2635
+ );
2636
+ }
2637
+ function tbody(_3, index, parent) {
2638
+ const next = siblingAfter(parent, index);
2639
+ return !next || next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot");
2640
+ }
2641
+ function tfoot(_3, index, parent) {
2642
+ return !siblingAfter(parent, index);
2643
+ }
2644
+ function tr(_3, index, parent) {
2645
+ const next = siblingAfter(parent, index);
2646
+ return !next || next.type === "element" && next.tagName === "tr";
2647
+ }
2648
+ function cells(_3, index, parent) {
2649
+ const next = siblingAfter(parent, index);
2650
+ return !next || next.type === "element" && (next.tagName === "td" || next.tagName === "th");
2651
+ }
2652
+
2653
+ // node_modules/hast-util-to-html/lib/omission/opening.js
2654
+ var opening = omission({
2655
+ body: body2,
2656
+ colgroup,
2657
+ head,
2658
+ html: html4,
2659
+ tbody: tbody2
2660
+ });
2661
+ function html4(node) {
2662
+ const head2 = siblingAfter(node, -1);
2663
+ return !head2 || head2.type !== "comment";
2664
+ }
2665
+ function head(node) {
2666
+ const seen = /* @__PURE__ */ new Set();
2667
+ for (const child2 of node.children) {
2668
+ if (child2.type === "element" && (child2.tagName === "base" || child2.tagName === "title")) {
2669
+ if (seen.has(child2.tagName)) return false;
2670
+ seen.add(child2.tagName);
2671
+ }
2672
+ }
2673
+ const child = node.children[0];
2674
+ return !child || child.type === "element";
2675
+ }
2676
+ function body2(node) {
2677
+ const head2 = siblingAfter(node, -1, true);
2678
+ return !head2 || head2.type !== "comment" && !(head2.type === "text" && whitespace(head2.value.charAt(0))) && !(head2.type === "element" && (head2.tagName === "meta" || head2.tagName === "link" || head2.tagName === "script" || head2.tagName === "style" || head2.tagName === "template"));
2679
+ }
2680
+ function colgroup(node, index, parent) {
2681
+ const previous = siblingBefore(parent, index);
2682
+ const head2 = siblingAfter(node, -1, true);
2683
+ if (parent && previous && previous.type === "element" && previous.tagName === "colgroup" && closing(previous, parent.children.indexOf(previous), parent)) {
2684
+ return false;
2685
+ }
2686
+ return Boolean(head2 && head2.type === "element" && head2.tagName === "col");
2687
+ }
2688
+ function tbody2(node, index, parent) {
2689
+ const previous = siblingBefore(parent, index);
2690
+ const head2 = siblingAfter(node, -1);
2691
+ if (parent && previous && previous.type === "element" && (previous.tagName === "thead" || previous.tagName === "tbody") && closing(previous, parent.children.indexOf(previous), parent)) {
2692
+ return false;
2693
+ }
2694
+ return Boolean(head2 && head2.type === "element" && head2.tagName === "tr");
2695
+ }
2696
+
2697
+ // node_modules/hast-util-to-html/lib/handle/element.js
2698
+ var constants = {
2699
+ // See: <https://html.spec.whatwg.org/#attribute-name-state>.
2700
+ name: [
2701
+ [" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")],
2702
+ [`\0
2703
+ \f\r "&'/<=>`.split(""), "\0 \n\f\r \"&'/<=>`".split("")]
2704
+ ],
2705
+ // See: <https://html.spec.whatwg.org/#attribute-value-(unquoted)-state>.
2706
+ unquoted: [
2707
+ [" \n\f\r &>".split(""), "\0 \n\f\r \"&'<=>`".split("")],
2708
+ ["\0 \n\f\r \"&'<=>`".split(""), "\0 \n\f\r \"&'<=>`".split("")]
2709
+ ],
2710
+ // See: <https://html.spec.whatwg.org/#attribute-value-(single-quoted)-state>.
2711
+ single: [
2712
+ ["&'".split(""), "\"&'`".split("")],
2713
+ ["\0&'".split(""), "\0\"&'`".split("")]
2714
+ ],
2715
+ // See: <https://html.spec.whatwg.org/#attribute-value-(double-quoted)-state>.
2716
+ double: [
2717
+ ['"&'.split(""), "\"&'`".split("")],
2718
+ ['\0"&'.split(""), "\0\"&'`".split("")]
2719
+ ]
2720
+ };
2721
+ function element(node, index, parent, state) {
2722
+ const schema = state.schema;
2723
+ const omit = schema.space === "svg" ? false : state.settings.omitOptionalTags;
2724
+ let selfClosing = schema.space === "svg" ? state.settings.closeEmptyElements : state.settings.voids.includes(node.tagName.toLowerCase());
2725
+ const parts = [];
2726
+ let last;
2727
+ if (schema.space === "html" && node.tagName === "svg") {
2728
+ state.schema = svg2;
2729
+ }
2730
+ const attributes = serializeAttributes(state, node.properties);
2731
+ const content = state.all(
2732
+ schema.space === "html" && node.tagName === "template" ? node.content : node
2733
+ );
2734
+ state.schema = schema;
2735
+ if (content) selfClosing = false;
2736
+ if (attributes || !omit || !opening(node, index, parent)) {
2737
+ parts.push("<", node.tagName, attributes ? " " + attributes : "");
2738
+ if (selfClosing && (schema.space === "svg" || state.settings.closeSelfClosing)) {
2739
+ last = attributes.charAt(attributes.length - 1);
2740
+ if (!state.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") {
2741
+ parts.push(" ");
2742
+ }
2743
+ parts.push("/");
2744
+ }
2745
+ parts.push(">");
2746
+ }
2747
+ parts.push(content);
2748
+ if (!selfClosing && (!omit || !closing(node, index, parent))) {
2749
+ parts.push("</" + node.tagName + ">");
2750
+ }
2751
+ return parts.join("");
2752
+ }
2753
+ function serializeAttributes(state, properties) {
2754
+ const values = [];
2755
+ let index = -1;
2756
+ let key2;
2757
+ if (properties) {
2758
+ for (key2 in properties) {
2759
+ if (properties[key2] !== null && properties[key2] !== void 0) {
2760
+ const value = serializeAttribute(state, key2, properties[key2]);
2761
+ if (value) values.push(value);
2762
+ }
2763
+ }
2764
+ }
2765
+ while (++index < values.length) {
2766
+ const last = state.settings.tightAttributes ? values[index].charAt(values[index].length - 1) : void 0;
2767
+ if (index !== values.length - 1 && last !== '"' && last !== "'") {
2768
+ values[index] += " ";
2769
+ }
2770
+ }
2771
+ return values.join("");
2772
+ }
2773
+ function serializeAttribute(state, key2, value) {
2774
+ const info = find(state.schema, key2);
2775
+ const x4 = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
2776
+ const y4 = state.settings.allowDangerousCharacters ? 0 : 1;
2777
+ let quote = state.quote;
2778
+ let result;
2779
+ if (info.overloadedBoolean && (value === info.attribute || value === "")) {
2780
+ value = true;
2781
+ } else if ((info.boolean || info.overloadedBoolean) && (typeof value !== "string" || value === info.attribute || value === "")) {
2782
+ value = Boolean(value);
2783
+ }
2784
+ if (value === null || value === void 0 || value === false || typeof value === "number" && Number.isNaN(value)) {
2785
+ return "";
2786
+ }
2787
+ const name = stringifyEntities(
2788
+ info.attribute,
2789
+ Object.assign({}, state.settings.characterReferences, {
2790
+ // Always encode without parse errors in non-HTML.
2791
+ subset: constants.name[x4][y4]
2792
+ })
2793
+ );
2794
+ if (value === true) return name;
2795
+ value = Array.isArray(value) ? (info.commaSeparated ? stringify : stringify2)(value, {
2796
+ padLeft: !state.settings.tightCommaSeparatedLists
2797
+ }) : String(value);
2798
+ if (state.settings.collapseEmptyAttributes && !value) return name;
2799
+ if (state.settings.preferUnquoted) {
2800
+ result = stringifyEntities(
2801
+ value,
2802
+ Object.assign({}, state.settings.characterReferences, {
2803
+ attribute: true,
2804
+ subset: constants.unquoted[x4][y4]
2805
+ })
2806
+ );
2807
+ }
2808
+ if (result !== value) {
2809
+ if (state.settings.quoteSmart && ccount(value, quote) > ccount(value, state.alternative)) {
2810
+ quote = state.alternative;
2811
+ }
2812
+ result = quote + stringifyEntities(
2813
+ value,
2814
+ Object.assign({}, state.settings.characterReferences, {
2815
+ // Always encode without parse errors in non-HTML.
2816
+ subset: (quote === "'" ? constants.single : constants.double)[x4][y4],
2817
+ attribute: true
2818
+ })
2819
+ ) + quote;
2820
+ }
2821
+ return name + (result ? "=" + result : result);
2822
+ }
2823
+
2824
+ // node_modules/hast-util-to-html/lib/handle/text.js
2825
+ var textEntitySubset = ["<", "&"];
2826
+ function text(node, _3, parent, state) {
2827
+ return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node.value : stringifyEntities(
2828
+ node.value,
2829
+ Object.assign({}, state.settings.characterReferences, {
2830
+ subset: textEntitySubset
2831
+ })
2832
+ );
2833
+ }
2834
+
2835
+ // node_modules/hast-util-to-html/lib/handle/raw.js
2836
+ function raw(node, index, parent, state) {
2837
+ return state.settings.allowDangerousHtml ? node.value : text(node, index, parent, state);
2838
+ }
2839
+
2840
+ // node_modules/hast-util-to-html/lib/handle/root.js
2841
+ function root(node, _1, _22, state) {
2842
+ return state.all(node);
2843
+ }
2844
+
2845
+ // node_modules/hast-util-to-html/lib/handle/index.js
2846
+ var handle = zwitch("type", {
2847
+ invalid,
2848
+ unknown,
2849
+ handlers: { comment, doctype, element, raw, root, text }
2850
+ });
2851
+ function invalid(node) {
2852
+ throw new Error("Expected node, not `" + node + "`");
2853
+ }
2854
+ function unknown(node_) {
2855
+ const node = (
2856
+ /** @type {Nodes} */
2857
+ node_
2858
+ );
2859
+ throw new Error("Cannot compile unknown node `" + node.type + "`");
2860
+ }
2861
+
2862
+ // node_modules/hast-util-to-html/lib/index.js
2863
+ var emptyOptions = {};
2864
+ var emptyCharacterReferences = {};
2865
+ var emptyChildren2 = [];
2866
+ function toHtml(tree, options) {
2867
+ const options_ = options || emptyOptions;
2868
+ const quote = options_.quote || '"';
2869
+ const alternative = quote === '"' ? "'" : '"';
2870
+ if (quote !== '"' && quote !== "'") {
2871
+ throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`");
2872
+ }
2873
+ const state = {
2874
+ one,
2875
+ all,
2876
+ settings: {
2877
+ omitOptionalTags: options_.omitOptionalTags || false,
2878
+ allowParseErrors: options_.allowParseErrors || false,
2879
+ allowDangerousCharacters: options_.allowDangerousCharacters || false,
2880
+ quoteSmart: options_.quoteSmart || false,
2881
+ preferUnquoted: options_.preferUnquoted || false,
2882
+ tightAttributes: options_.tightAttributes || false,
2883
+ upperDoctype: options_.upperDoctype || false,
2884
+ tightDoctype: options_.tightDoctype || false,
2885
+ bogusComments: options_.bogusComments || false,
2886
+ tightCommaSeparatedLists: options_.tightCommaSeparatedLists || false,
2887
+ tightSelfClosing: options_.tightSelfClosing || false,
2888
+ collapseEmptyAttributes: options_.collapseEmptyAttributes || false,
2889
+ allowDangerousHtml: options_.allowDangerousHtml || false,
2890
+ voids: options_.voids || htmlVoidElements,
2891
+ characterReferences: options_.characterReferences || emptyCharacterReferences,
2892
+ closeSelfClosing: options_.closeSelfClosing || false,
2893
+ closeEmptyElements: options_.closeEmptyElements || false
2894
+ },
2895
+ schema: options_.space === "svg" ? svg2 : html2,
2896
+ quote,
2897
+ alternative
2898
+ };
2899
+ return state.one(
2900
+ Array.isArray(tree) ? { type: "root", children: tree } : tree,
2901
+ void 0,
2902
+ void 0
2903
+ );
2904
+ }
2905
+ function one(node, index, parent) {
2906
+ return handle(node, index, parent, this);
2907
+ }
2908
+ function all(parent) {
2909
+ const results = [];
2910
+ const children = parent && parent.children || emptyChildren2;
2911
+ let index = -1;
2912
+ while (++index < children.length) {
2913
+ results[index] = this.one(children[index], index, parent);
2914
+ }
2915
+ return results.join("");
2916
+ }
2917
+
2918
+ // node_modules/roughjs/bundled/rough.esm.js
2919
+ function t(t4, e4, s4) {
2920
+ if (t4 && t4.length) {
2921
+ const [n4, o4] = e4, a4 = Math.PI / 180 * s4, h4 = Math.cos(a4), r4 = Math.sin(a4);
2922
+ for (const e5 of t4) {
2923
+ const [t5, s5] = e5;
2924
+ e5[0] = (t5 - n4) * h4 - (s5 - o4) * r4 + n4, e5[1] = (t5 - n4) * r4 + (s5 - o4) * h4 + o4;
2925
+ }
2926
+ }
2927
+ }
2928
+ function e(t4, e4) {
2929
+ return t4[0] === e4[0] && t4[1] === e4[1];
2930
+ }
2931
+ function s(s4, n4, o4, a4 = 1) {
2932
+ const h4 = o4, r4 = Math.max(n4, 0.1), i4 = s4[0] && s4[0][0] && "number" == typeof s4[0][0] ? [s4] : s4, c4 = [0, 0];
2933
+ if (h4) for (const e4 of i4) t(e4, c4, h4);
2934
+ const l4 = (function(t4, s5, n5) {
2935
+ const o5 = [];
2936
+ for (const s6 of t4) {
2937
+ const t5 = [...s6];
2938
+ e(t5[0], t5[t5.length - 1]) || t5.push([t5[0][0], t5[0][1]]), t5.length > 2 && o5.push(t5);
2939
+ }
2940
+ const a5 = [];
2941
+ s5 = Math.max(s5, 0.1);
2942
+ const h5 = [];
2943
+ for (const t5 of o5) for (let e4 = 0; e4 < t5.length - 1; e4++) {
2944
+ const s6 = t5[e4], n6 = t5[e4 + 1];
2945
+ if (s6[1] !== n6[1]) {
2946
+ const t6 = Math.min(s6[1], n6[1]);
2947
+ h5.push({ ymin: t6, ymax: Math.max(s6[1], n6[1]), x: t6 === s6[1] ? s6[0] : n6[0], islope: (n6[0] - s6[0]) / (n6[1] - s6[1]) });
2948
+ }
2949
+ }
2950
+ if (h5.sort(((t5, e4) => t5.ymin < e4.ymin ? -1 : t5.ymin > e4.ymin ? 1 : t5.x < e4.x ? -1 : t5.x > e4.x ? 1 : t5.ymax === e4.ymax ? 0 : (t5.ymax - e4.ymax) / Math.abs(t5.ymax - e4.ymax))), !h5.length) return a5;
2951
+ let r5 = [], i5 = h5[0].ymin, c5 = 0;
2952
+ for (; r5.length || h5.length; ) {
2953
+ if (h5.length) {
2954
+ let t5 = -1;
2955
+ for (let e4 = 0; e4 < h5.length && !(h5[e4].ymin > i5); e4++) t5 = e4;
2956
+ h5.splice(0, t5 + 1).forEach(((t6) => {
2957
+ r5.push({ s: i5, edge: t6 });
2958
+ }));
2959
+ }
2960
+ if (r5 = r5.filter(((t5) => !(t5.edge.ymax <= i5))), r5.sort(((t5, e4) => t5.edge.x === e4.edge.x ? 0 : (t5.edge.x - e4.edge.x) / Math.abs(t5.edge.x - e4.edge.x))), (1 !== n5 || c5 % s5 == 0) && r5.length > 1) for (let t5 = 0; t5 < r5.length; t5 += 2) {
2961
+ const e4 = t5 + 1;
2962
+ if (e4 >= r5.length) break;
2963
+ const s6 = r5[t5].edge, n6 = r5[e4].edge;
2964
+ a5.push([[Math.round(s6.x), i5], [Math.round(n6.x), i5]]);
2965
+ }
2966
+ i5 += n5, r5.forEach(((t5) => {
2967
+ t5.edge.x = t5.edge.x + n5 * t5.edge.islope;
2968
+ })), c5++;
2969
+ }
2970
+ return a5;
2971
+ })(i4, r4, a4);
2972
+ if (h4) {
2973
+ for (const e4 of i4) t(e4, c4, -h4);
2974
+ !(function(e4, s5, n5) {
2975
+ const o5 = [];
2976
+ e4.forEach(((t4) => o5.push(...t4))), t(o5, s5, n5);
2977
+ })(l4, c4, -h4);
2978
+ }
2979
+ return l4;
2980
+ }
2981
+ function n(t4, e4) {
2982
+ var n4;
2983
+ const o4 = e4.hachureAngle + 90;
2984
+ let a4 = e4.hachureGap;
2985
+ a4 < 0 && (a4 = 4 * e4.strokeWidth), a4 = Math.round(Math.max(a4, 0.1));
2986
+ let h4 = 1;
2987
+ return e4.roughness >= 1 && ((null === (n4 = e4.randomizer) || void 0 === n4 ? void 0 : n4.next()) || Math.random()) > 0.7 && (h4 = a4), s(t4, a4, o4, h4 || 1);
2988
+ }
2989
+ var o = class {
2990
+ constructor(t4) {
2991
+ this.helper = t4;
2992
+ }
2993
+ fillPolygons(t4, e4) {
2994
+ return this._fillPolygons(t4, e4);
2995
+ }
2996
+ _fillPolygons(t4, e4) {
2997
+ const s4 = n(t4, e4);
2998
+ return { type: "fillSketch", ops: this.renderLines(s4, e4) };
2999
+ }
3000
+ renderLines(t4, e4) {
3001
+ const s4 = [];
3002
+ for (const n4 of t4) s4.push(...this.helper.doubleLineOps(n4[0][0], n4[0][1], n4[1][0], n4[1][1], e4));
3003
+ return s4;
3004
+ }
3005
+ };
3006
+ function a(t4) {
3007
+ const e4 = t4[0], s4 = t4[1];
3008
+ return Math.sqrt(Math.pow(e4[0] - s4[0], 2) + Math.pow(e4[1] - s4[1], 2));
3009
+ }
3010
+ var h = class extends o {
3011
+ fillPolygons(t4, e4) {
3012
+ let s4 = e4.hachureGap;
3013
+ s4 < 0 && (s4 = 4 * e4.strokeWidth), s4 = Math.max(s4, 0.1);
3014
+ const o4 = n(t4, Object.assign({}, e4, { hachureGap: s4 })), h4 = Math.PI / 180 * e4.hachureAngle, r4 = [], i4 = 0.5 * s4 * Math.cos(h4), c4 = 0.5 * s4 * Math.sin(h4);
3015
+ for (const [t5, e5] of o4) a([t5, e5]) && r4.push([[t5[0] - i4, t5[1] + c4], [...e5]], [[t5[0] + i4, t5[1] - c4], [...e5]]);
3016
+ return { type: "fillSketch", ops: this.renderLines(r4, e4) };
3017
+ }
3018
+ };
3019
+ var r = class extends o {
3020
+ fillPolygons(t4, e4) {
3021
+ const s4 = this._fillPolygons(t4, e4), n4 = Object.assign({}, e4, { hachureAngle: e4.hachureAngle + 90 }), o4 = this._fillPolygons(t4, n4);
3022
+ return s4.ops = s4.ops.concat(o4.ops), s4;
3023
+ }
3024
+ };
3025
+ var i = class {
3026
+ constructor(t4) {
3027
+ this.helper = t4;
3028
+ }
3029
+ fillPolygons(t4, e4) {
3030
+ const s4 = n(t4, e4 = Object.assign({}, e4, { hachureAngle: 0 }));
3031
+ return this.dotsOnLines(s4, e4);
3032
+ }
3033
+ dotsOnLines(t4, e4) {
3034
+ const s4 = [];
3035
+ let n4 = e4.hachureGap;
3036
+ n4 < 0 && (n4 = 4 * e4.strokeWidth), n4 = Math.max(n4, 0.1);
3037
+ let o4 = e4.fillWeight;
3038
+ o4 < 0 && (o4 = e4.strokeWidth / 2);
3039
+ const h4 = n4 / 4;
3040
+ for (const r4 of t4) {
3041
+ const t5 = a(r4), i4 = t5 / n4, c4 = Math.ceil(i4) - 1, l4 = t5 - c4 * n4, u5 = (r4[0][0] + r4[1][0]) / 2 - n4 / 4, p5 = Math.min(r4[0][1], r4[1][1]);
3042
+ for (let t6 = 0; t6 < c4; t6++) {
3043
+ const a4 = p5 + l4 + t6 * n4, r5 = u5 - h4 + 2 * Math.random() * h4, i5 = a4 - h4 + 2 * Math.random() * h4, c5 = this.helper.ellipse(r5, i5, o4, o4, e4);
3044
+ s4.push(...c5.ops);
3045
+ }
3046
+ }
3047
+ return { type: "fillSketch", ops: s4 };
3048
+ }
3049
+ };
3050
+ var c = class {
3051
+ constructor(t4) {
3052
+ this.helper = t4;
3053
+ }
3054
+ fillPolygons(t4, e4) {
3055
+ const s4 = n(t4, e4);
3056
+ return { type: "fillSketch", ops: this.dashedLine(s4, e4) };
3057
+ }
3058
+ dashedLine(t4, e4) {
3059
+ const s4 = e4.dashOffset < 0 ? e4.hachureGap < 0 ? 4 * e4.strokeWidth : e4.hachureGap : e4.dashOffset, n4 = e4.dashGap < 0 ? e4.hachureGap < 0 ? 4 * e4.strokeWidth : e4.hachureGap : e4.dashGap, o4 = [];
3060
+ return t4.forEach(((t5) => {
3061
+ const h4 = a(t5), r4 = Math.floor(h4 / (s4 + n4)), i4 = (h4 + n4 - r4 * (s4 + n4)) / 2;
3062
+ let c4 = t5[0], l4 = t5[1];
3063
+ c4[0] > l4[0] && (c4 = t5[1], l4 = t5[0]);
3064
+ const u5 = Math.atan((l4[1] - c4[1]) / (l4[0] - c4[0]));
3065
+ for (let t6 = 0; t6 < r4; t6++) {
3066
+ const a4 = t6 * (s4 + n4), h5 = a4 + s4, r5 = [c4[0] + a4 * Math.cos(u5) + i4 * Math.cos(u5), c4[1] + a4 * Math.sin(u5) + i4 * Math.sin(u5)], l5 = [c4[0] + h5 * Math.cos(u5) + i4 * Math.cos(u5), c4[1] + h5 * Math.sin(u5) + i4 * Math.sin(u5)];
3067
+ o4.push(...this.helper.doubleLineOps(r5[0], r5[1], l5[0], l5[1], e4));
3068
+ }
3069
+ })), o4;
3070
+ }
3071
+ };
3072
+ var l = class {
3073
+ constructor(t4) {
3074
+ this.helper = t4;
3075
+ }
3076
+ fillPolygons(t4, e4) {
3077
+ const s4 = e4.hachureGap < 0 ? 4 * e4.strokeWidth : e4.hachureGap, o4 = e4.zigzagOffset < 0 ? s4 : e4.zigzagOffset, a4 = n(t4, e4 = Object.assign({}, e4, { hachureGap: s4 + o4 }));
3078
+ return { type: "fillSketch", ops: this.zigzagLines(a4, o4, e4) };
3079
+ }
3080
+ zigzagLines(t4, e4, s4) {
3081
+ const n4 = [];
3082
+ return t4.forEach(((t5) => {
3083
+ const o4 = a(t5), h4 = Math.round(o4 / (2 * e4));
3084
+ let r4 = t5[0], i4 = t5[1];
3085
+ r4[0] > i4[0] && (r4 = t5[1], i4 = t5[0]);
3086
+ const c4 = Math.atan((i4[1] - r4[1]) / (i4[0] - r4[0]));
3087
+ for (let t6 = 0; t6 < h4; t6++) {
3088
+ const o5 = 2 * t6 * e4, a4 = 2 * (t6 + 1) * e4, h5 = Math.sqrt(2 * Math.pow(e4, 2)), i5 = [r4[0] + o5 * Math.cos(c4), r4[1] + o5 * Math.sin(c4)], l4 = [r4[0] + a4 * Math.cos(c4), r4[1] + a4 * Math.sin(c4)], u5 = [i5[0] + h5 * Math.cos(c4 + Math.PI / 4), i5[1] + h5 * Math.sin(c4 + Math.PI / 4)];
3089
+ n4.push(...this.helper.doubleLineOps(i5[0], i5[1], u5[0], u5[1], s4), ...this.helper.doubleLineOps(u5[0], u5[1], l4[0], l4[1], s4));
3090
+ }
3091
+ })), n4;
3092
+ }
3093
+ };
3094
+ var u = {};
3095
+ var p2 = class {
3096
+ constructor(t4) {
3097
+ this.seed = t4;
3098
+ }
3099
+ next() {
3100
+ return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
3101
+ }
3102
+ };
3103
+ var f = 0;
3104
+ var d = 1;
3105
+ var g = 2;
3106
+ var M = { A: 7, a: 7, C: 6, c: 6, H: 1, h: 1, L: 2, l: 2, M: 2, m: 2, Q: 4, q: 4, S: 4, s: 4, T: 2, t: 2, V: 1, v: 1, Z: 0, z: 0 };
3107
+ function k(t4, e4) {
3108
+ return t4.type === e4;
3109
+ }
3110
+ function b(t4) {
3111
+ const e4 = [], s4 = (function(t5) {
3112
+ const e5 = new Array();
3113
+ for (; "" !== t5; ) if (t5.match(/^([ \t\r\n,]+)/)) t5 = t5.substr(RegExp.$1.length);
3114
+ else if (t5.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e5[e5.length] = { type: f, text: RegExp.$1 }, t5 = t5.substr(RegExp.$1.length);
3115
+ else {
3116
+ if (!t5.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
3117
+ e5[e5.length] = { type: d, text: `${parseFloat(RegExp.$1)}` }, t5 = t5.substr(RegExp.$1.length);
3118
+ }
3119
+ return e5[e5.length] = { type: g, text: "" }, e5;
3120
+ })(t4);
3121
+ let n4 = "BOD", o4 = 0, a4 = s4[o4];
3122
+ for (; !k(a4, g); ) {
3123
+ let h4 = 0;
3124
+ const r4 = [];
3125
+ if ("BOD" === n4) {
3126
+ if ("M" !== a4.text && "m" !== a4.text) return b("M0,0" + t4);
3127
+ o4++, h4 = M[a4.text], n4 = a4.text;
3128
+ } else k(a4, d) ? h4 = M[n4] : (o4++, h4 = M[a4.text], n4 = a4.text);
3129
+ if (!(o4 + h4 < s4.length)) throw new Error("Path data ended short");
3130
+ for (let t5 = o4; t5 < o4 + h4; t5++) {
3131
+ const e5 = s4[t5];
3132
+ if (!k(e5, d)) throw new Error("Param not a number: " + n4 + "," + e5.text);
3133
+ r4[r4.length] = +e5.text;
3134
+ }
3135
+ if ("number" != typeof M[n4]) throw new Error("Bad segment: " + n4);
3136
+ {
3137
+ const t5 = { key: n4, data: r4 };
3138
+ e4.push(t5), o4 += h4, a4 = s4[o4], "M" === n4 && (n4 = "L"), "m" === n4 && (n4 = "l");
3139
+ }
3140
+ }
3141
+ return e4;
3142
+ }
3143
+ function y(t4) {
3144
+ let e4 = 0, s4 = 0, n4 = 0, o4 = 0;
3145
+ const a4 = [];
3146
+ for (const { key: h4, data: r4 } of t4) switch (h4) {
3147
+ case "M":
3148
+ a4.push({ key: "M", data: [...r4] }), [e4, s4] = r4, [n4, o4] = r4;
3149
+ break;
3150
+ case "m":
3151
+ e4 += r4[0], s4 += r4[1], a4.push({ key: "M", data: [e4, s4] }), n4 = e4, o4 = s4;
3152
+ break;
3153
+ case "L":
3154
+ a4.push({ key: "L", data: [...r4] }), [e4, s4] = r4;
3155
+ break;
3156
+ case "l":
3157
+ e4 += r4[0], s4 += r4[1], a4.push({ key: "L", data: [e4, s4] });
3158
+ break;
3159
+ case "C":
3160
+ a4.push({ key: "C", data: [...r4] }), e4 = r4[4], s4 = r4[5];
3161
+ break;
3162
+ case "c": {
3163
+ const t5 = r4.map(((t6, n5) => n5 % 2 ? t6 + s4 : t6 + e4));
3164
+ a4.push({ key: "C", data: t5 }), e4 = t5[4], s4 = t5[5];
3165
+ break;
3166
+ }
3167
+ case "Q":
3168
+ a4.push({ key: "Q", data: [...r4] }), e4 = r4[2], s4 = r4[3];
3169
+ break;
3170
+ case "q": {
3171
+ const t5 = r4.map(((t6, n5) => n5 % 2 ? t6 + s4 : t6 + e4));
3172
+ a4.push({ key: "Q", data: t5 }), e4 = t5[2], s4 = t5[3];
3173
+ break;
3174
+ }
3175
+ case "A":
3176
+ a4.push({ key: "A", data: [...r4] }), e4 = r4[5], s4 = r4[6];
3177
+ break;
3178
+ case "a":
3179
+ e4 += r4[5], s4 += r4[6], a4.push({ key: "A", data: [r4[0], r4[1], r4[2], r4[3], r4[4], e4, s4] });
3180
+ break;
3181
+ case "H":
3182
+ a4.push({ key: "H", data: [...r4] }), e4 = r4[0];
3183
+ break;
3184
+ case "h":
3185
+ e4 += r4[0], a4.push({ key: "H", data: [e4] });
3186
+ break;
3187
+ case "V":
3188
+ a4.push({ key: "V", data: [...r4] }), s4 = r4[0];
3189
+ break;
3190
+ case "v":
3191
+ s4 += r4[0], a4.push({ key: "V", data: [s4] });
3192
+ break;
3193
+ case "S":
3194
+ a4.push({ key: "S", data: [...r4] }), e4 = r4[2], s4 = r4[3];
3195
+ break;
3196
+ case "s": {
3197
+ const t5 = r4.map(((t6, n5) => n5 % 2 ? t6 + s4 : t6 + e4));
3198
+ a4.push({ key: "S", data: t5 }), e4 = t5[2], s4 = t5[3];
3199
+ break;
3200
+ }
3201
+ case "T":
3202
+ a4.push({ key: "T", data: [...r4] }), e4 = r4[0], s4 = r4[1];
3203
+ break;
3204
+ case "t":
3205
+ e4 += r4[0], s4 += r4[1], a4.push({ key: "T", data: [e4, s4] });
3206
+ break;
3207
+ case "Z":
3208
+ case "z":
3209
+ a4.push({ key: "Z", data: [] }), e4 = n4, s4 = o4;
3210
+ }
3211
+ return a4;
3212
+ }
3213
+ function m(t4) {
3214
+ const e4 = [];
3215
+ let s4 = "", n4 = 0, o4 = 0, a4 = 0, h4 = 0, r4 = 0, i4 = 0;
3216
+ for (const { key: c4, data: l4 } of t4) {
3217
+ switch (c4) {
3218
+ case "M":
3219
+ e4.push({ key: "M", data: [...l4] }), [n4, o4] = l4, [a4, h4] = l4;
3220
+ break;
3221
+ case "C":
3222
+ e4.push({ key: "C", data: [...l4] }), n4 = l4[4], o4 = l4[5], r4 = l4[2], i4 = l4[3];
3223
+ break;
3224
+ case "L":
3225
+ e4.push({ key: "L", data: [...l4] }), [n4, o4] = l4;
3226
+ break;
3227
+ case "H":
3228
+ n4 = l4[0], e4.push({ key: "L", data: [n4, o4] });
3229
+ break;
3230
+ case "V":
3231
+ o4 = l4[0], e4.push({ key: "L", data: [n4, o4] });
3232
+ break;
3233
+ case "S": {
3234
+ let t5 = 0, a5 = 0;
3235
+ "C" === s4 || "S" === s4 ? (t5 = n4 + (n4 - r4), a5 = o4 + (o4 - i4)) : (t5 = n4, a5 = o4), e4.push({ key: "C", data: [t5, a5, ...l4] }), r4 = l4[0], i4 = l4[1], n4 = l4[2], o4 = l4[3];
3236
+ break;
3237
+ }
3238
+ case "T": {
3239
+ const [t5, a5] = l4;
3240
+ let h5 = 0, c5 = 0;
3241
+ "Q" === s4 || "T" === s4 ? (h5 = n4 + (n4 - r4), c5 = o4 + (o4 - i4)) : (h5 = n4, c5 = o4);
3242
+ const u5 = n4 + 2 * (h5 - n4) / 3, p5 = o4 + 2 * (c5 - o4) / 3, f5 = t5 + 2 * (h5 - t5) / 3, d4 = a5 + 2 * (c5 - a5) / 3;
3243
+ e4.push({ key: "C", data: [u5, p5, f5, d4, t5, a5] }), r4 = h5, i4 = c5, n4 = t5, o4 = a5;
3244
+ break;
3245
+ }
3246
+ case "Q": {
3247
+ const [t5, s5, a5, h5] = l4, c5 = n4 + 2 * (t5 - n4) / 3, u5 = o4 + 2 * (s5 - o4) / 3, p5 = a5 + 2 * (t5 - a5) / 3, f5 = h5 + 2 * (s5 - h5) / 3;
3248
+ e4.push({ key: "C", data: [c5, u5, p5, f5, a5, h5] }), r4 = t5, i4 = s5, n4 = a5, o4 = h5;
3249
+ break;
3250
+ }
3251
+ case "A": {
3252
+ const t5 = Math.abs(l4[0]), s5 = Math.abs(l4[1]), a5 = l4[2], h5 = l4[3], r5 = l4[4], i5 = l4[5], c5 = l4[6];
3253
+ if (0 === t5 || 0 === s5) e4.push({ key: "C", data: [n4, o4, i5, c5, i5, c5] }), n4 = i5, o4 = c5;
3254
+ else if (n4 !== i5 || o4 !== c5) {
3255
+ x(n4, o4, i5, c5, t5, s5, a5, h5, r5).forEach((function(t6) {
3256
+ e4.push({ key: "C", data: t6 });
3257
+ })), n4 = i5, o4 = c5;
3258
+ }
3259
+ break;
3260
+ }
3261
+ case "Z":
3262
+ e4.push({ key: "Z", data: [] }), n4 = a4, o4 = h4;
3263
+ }
3264
+ s4 = c4;
3265
+ }
3266
+ return e4;
3267
+ }
3268
+ function w(t4, e4, s4) {
3269
+ return [t4 * Math.cos(s4) - e4 * Math.sin(s4), t4 * Math.sin(s4) + e4 * Math.cos(s4)];
3270
+ }
3271
+ function x(t4, e4, s4, n4, o4, a4, h4, r4, i4, c4) {
3272
+ const l4 = (u5 = h4, Math.PI * u5 / 180);
3273
+ var u5;
3274
+ let p5 = [], f5 = 0, d4 = 0, g4 = 0, M4 = 0;
3275
+ if (c4) [f5, d4, g4, M4] = c4;
3276
+ else {
3277
+ [t4, e4] = w(t4, e4, -l4), [s4, n4] = w(s4, n4, -l4);
3278
+ const h5 = (t4 - s4) / 2, c5 = (e4 - n4) / 2;
3279
+ let u6 = h5 * h5 / (o4 * o4) + c5 * c5 / (a4 * a4);
3280
+ u6 > 1 && (u6 = Math.sqrt(u6), o4 *= u6, a4 *= u6);
3281
+ const p6 = o4 * o4, k5 = a4 * a4, b4 = p6 * k5 - p6 * c5 * c5 - k5 * h5 * h5, y5 = p6 * c5 * c5 + k5 * h5 * h5, m5 = (r4 === i4 ? -1 : 1) * Math.sqrt(Math.abs(b4 / y5));
3282
+ g4 = m5 * o4 * c5 / a4 + (t4 + s4) / 2, M4 = m5 * -a4 * h5 / o4 + (e4 + n4) / 2, f5 = Math.asin(parseFloat(((e4 - M4) / a4).toFixed(9))), d4 = Math.asin(parseFloat(((n4 - M4) / a4).toFixed(9))), t4 < g4 && (f5 = Math.PI - f5), s4 < g4 && (d4 = Math.PI - d4), f5 < 0 && (f5 = 2 * Math.PI + f5), d4 < 0 && (d4 = 2 * Math.PI + d4), i4 && f5 > d4 && (f5 -= 2 * Math.PI), !i4 && d4 > f5 && (d4 -= 2 * Math.PI);
3283
+ }
3284
+ let k4 = d4 - f5;
3285
+ if (Math.abs(k4) > 120 * Math.PI / 180) {
3286
+ const t5 = d4, e5 = s4, r5 = n4;
3287
+ d4 = i4 && d4 > f5 ? f5 + 120 * Math.PI / 180 * 1 : f5 + 120 * Math.PI / 180 * -1, p5 = x(s4 = g4 + o4 * Math.cos(d4), n4 = M4 + a4 * Math.sin(d4), e5, r5, o4, a4, h4, 0, i4, [d4, t5, g4, M4]);
3288
+ }
3289
+ k4 = d4 - f5;
3290
+ const b3 = Math.cos(f5), y4 = Math.sin(f5), m4 = Math.cos(d4), P4 = Math.sin(d4), v4 = Math.tan(k4 / 4), S4 = 4 / 3 * o4 * v4, O4 = 4 / 3 * a4 * v4, L4 = [t4, e4], T4 = [t4 + S4 * y4, e4 - O4 * b3], D4 = [s4 + S4 * P4, n4 - O4 * m4], A4 = [s4, n4];
3291
+ if (T4[0] = 2 * L4[0] - T4[0], T4[1] = 2 * L4[1] - T4[1], c4) return [T4, D4, A4].concat(p5);
3292
+ {
3293
+ p5 = [T4, D4, A4].concat(p5);
3294
+ const t5 = [];
3295
+ for (let e5 = 0; e5 < p5.length; e5 += 3) {
3296
+ const s5 = w(p5[e5][0], p5[e5][1], l4), n5 = w(p5[e5 + 1][0], p5[e5 + 1][1], l4), o5 = w(p5[e5 + 2][0], p5[e5 + 2][1], l4);
3297
+ t5.push([s5[0], s5[1], n5[0], n5[1], o5[0], o5[1]]);
3298
+ }
3299
+ return t5;
3300
+ }
3301
+ }
3302
+ var P = { randOffset: function(t4, e4) {
3303
+ return G(t4, e4);
3304
+ }, randOffsetWithRange: function(t4, e4, s4) {
3305
+ return E(t4, e4, s4);
3306
+ }, ellipse: function(t4, e4, s4, n4, o4) {
3307
+ const a4 = T(s4, n4, o4);
3308
+ return D(t4, e4, o4, a4).opset;
3309
+ }, doubleLineOps: function(t4, e4, s4, n4, o4) {
3310
+ return $(t4, e4, s4, n4, o4, true);
3311
+ } };
3312
+ function v(t4, e4, s4, n4, o4) {
3313
+ return { type: "path", ops: $(t4, e4, s4, n4, o4) };
3314
+ }
3315
+ function S(t4, e4, s4) {
3316
+ const n4 = (t4 || []).length;
3317
+ if (n4 > 2) {
3318
+ const o4 = [];
3319
+ for (let e5 = 0; e5 < n4 - 1; e5++) o4.push(...$(t4[e5][0], t4[e5][1], t4[e5 + 1][0], t4[e5 + 1][1], s4));
3320
+ return e4 && o4.push(...$(t4[n4 - 1][0], t4[n4 - 1][1], t4[0][0], t4[0][1], s4)), { type: "path", ops: o4 };
3321
+ }
3322
+ return 2 === n4 ? v(t4[0][0], t4[0][1], t4[1][0], t4[1][1], s4) : { type: "path", ops: [] };
3323
+ }
3324
+ function O(t4, e4, s4, n4, o4) {
3325
+ return (function(t5, e5) {
3326
+ return S(t5, true, e5);
3327
+ })([[t4, e4], [t4 + s4, e4], [t4 + s4, e4 + n4], [t4, e4 + n4]], o4);
3328
+ }
3329
+ function L(t4, e4) {
3330
+ if (t4.length) {
3331
+ const s4 = "number" == typeof t4[0][0] ? [t4] : t4, n4 = j(s4[0], 1 * (1 + 0.2 * e4.roughness), e4), o4 = e4.disableMultiStroke ? [] : j(s4[0], 1.5 * (1 + 0.22 * e4.roughness), z(e4));
3332
+ for (let t5 = 1; t5 < s4.length; t5++) {
3333
+ const a4 = s4[t5];
3334
+ if (a4.length) {
3335
+ const t6 = j(a4, 1 * (1 + 0.2 * e4.roughness), e4), s5 = e4.disableMultiStroke ? [] : j(a4, 1.5 * (1 + 0.22 * e4.roughness), z(e4));
3336
+ for (const e5 of t6) "move" !== e5.op && n4.push(e5);
3337
+ for (const t7 of s5) "move" !== t7.op && o4.push(t7);
3338
+ }
3339
+ }
3340
+ return { type: "path", ops: n4.concat(o4) };
3341
+ }
3342
+ return { type: "path", ops: [] };
3343
+ }
3344
+ function T(t4, e4, s4) {
3345
+ const n4 = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t4 / 2, 2) + Math.pow(e4 / 2, 2)) / 2)), o4 = Math.ceil(Math.max(s4.curveStepCount, s4.curveStepCount / Math.sqrt(200) * n4)), a4 = 2 * Math.PI / o4;
3346
+ let h4 = Math.abs(t4 / 2), r4 = Math.abs(e4 / 2);
3347
+ const i4 = 1 - s4.curveFitting;
3348
+ return h4 += G(h4 * i4, s4), r4 += G(r4 * i4, s4), { increment: a4, rx: h4, ry: r4 };
3349
+ }
3350
+ function D(t4, e4, s4, n4) {
3351
+ const [o4, a4] = F(n4.increment, t4, e4, n4.rx, n4.ry, 1, n4.increment * E(0.1, E(0.4, 1, s4), s4), s4);
3352
+ let h4 = q(o4, null, s4);
3353
+ if (!s4.disableMultiStroke && 0 !== s4.roughness) {
3354
+ const [o5] = F(n4.increment, t4, e4, n4.rx, n4.ry, 1.5, 0, s4), a5 = q(o5, null, s4);
3355
+ h4 = h4.concat(a5);
3356
+ }
3357
+ return { estimatedPoints: a4, opset: { type: "path", ops: h4 } };
3358
+ }
3359
+ function A(t4, e4, s4, n4, o4, a4, h4, r4, i4) {
3360
+ const c4 = t4, l4 = e4;
3361
+ let u5 = Math.abs(s4 / 2), p5 = Math.abs(n4 / 2);
3362
+ u5 += G(0.01 * u5, i4), p5 += G(0.01 * p5, i4);
3363
+ let f5 = o4, d4 = a4;
3364
+ for (; f5 < 0; ) f5 += 2 * Math.PI, d4 += 2 * Math.PI;
3365
+ d4 - f5 > 2 * Math.PI && (f5 = 0, d4 = 2 * Math.PI);
3366
+ const g4 = 2 * Math.PI / i4.curveStepCount, M4 = Math.min(g4 / 2, (d4 - f5) / 2), k4 = V(M4, c4, l4, u5, p5, f5, d4, 1, i4);
3367
+ if (!i4.disableMultiStroke) {
3368
+ const t5 = V(M4, c4, l4, u5, p5, f5, d4, 1.5, i4);
3369
+ k4.push(...t5);
3370
+ }
3371
+ return h4 && (r4 ? k4.push(...$(c4, l4, c4 + u5 * Math.cos(f5), l4 + p5 * Math.sin(f5), i4), ...$(c4, l4, c4 + u5 * Math.cos(d4), l4 + p5 * Math.sin(d4), i4)) : k4.push({ op: "lineTo", data: [c4, l4] }, { op: "lineTo", data: [c4 + u5 * Math.cos(f5), l4 + p5 * Math.sin(f5)] })), { type: "path", ops: k4 };
3372
+ }
3373
+ function _(t4, e4) {
3374
+ const s4 = m(y(b(t4))), n4 = [];
3375
+ let o4 = [0, 0], a4 = [0, 0];
3376
+ for (const { key: t5, data: h4 } of s4) switch (t5) {
3377
+ case "M":
3378
+ a4 = [h4[0], h4[1]], o4 = [h4[0], h4[1]];
3379
+ break;
3380
+ case "L":
3381
+ n4.push(...$(a4[0], a4[1], h4[0], h4[1], e4)), a4 = [h4[0], h4[1]];
3382
+ break;
3383
+ case "C": {
3384
+ const [t6, s5, o5, r4, i4, c4] = h4;
3385
+ n4.push(...Z(t6, s5, o5, r4, i4, c4, a4, e4)), a4 = [i4, c4];
3386
+ break;
3387
+ }
3388
+ case "Z":
3389
+ n4.push(...$(a4[0], a4[1], o4[0], o4[1], e4)), a4 = [o4[0], o4[1]];
3390
+ }
3391
+ return { type: "path", ops: n4 };
3392
+ }
3393
+ function I(t4, e4) {
3394
+ const s4 = [];
3395
+ for (const n4 of t4) if (n4.length) {
3396
+ const t5 = e4.maxRandomnessOffset || 0, o4 = n4.length;
3397
+ if (o4 > 2) {
3398
+ s4.push({ op: "move", data: [n4[0][0] + G(t5, e4), n4[0][1] + G(t5, e4)] });
3399
+ for (let a4 = 1; a4 < o4; a4++) s4.push({ op: "lineTo", data: [n4[a4][0] + G(t5, e4), n4[a4][1] + G(t5, e4)] });
3400
+ }
3401
+ }
3402
+ return { type: "fillPath", ops: s4 };
3403
+ }
3404
+ function C(t4, e4) {
3405
+ return (function(t5, e5) {
3406
+ let s4 = t5.fillStyle || "hachure";
3407
+ if (!u[s4]) switch (s4) {
3408
+ case "zigzag":
3409
+ u[s4] || (u[s4] = new h(e5));
3410
+ break;
3411
+ case "cross-hatch":
3412
+ u[s4] || (u[s4] = new r(e5));
3413
+ break;
3414
+ case "dots":
3415
+ u[s4] || (u[s4] = new i(e5));
3416
+ break;
3417
+ case "dashed":
3418
+ u[s4] || (u[s4] = new c(e5));
3419
+ break;
3420
+ case "zigzag-line":
3421
+ u[s4] || (u[s4] = new l(e5));
3422
+ break;
3423
+ default:
3424
+ s4 = "hachure", u[s4] || (u[s4] = new o(e5));
3425
+ }
3426
+ return u[s4];
3427
+ })(e4, P).fillPolygons(t4, e4);
3428
+ }
3429
+ function z(t4) {
3430
+ const e4 = Object.assign({}, t4);
3431
+ return e4.randomizer = void 0, t4.seed && (e4.seed = t4.seed + 1), e4;
3432
+ }
3433
+ function W(t4) {
3434
+ return t4.randomizer || (t4.randomizer = new p2(t4.seed || 0)), t4.randomizer.next();
3435
+ }
3436
+ function E(t4, e4, s4, n4 = 1) {
3437
+ return s4.roughness * n4 * (W(s4) * (e4 - t4) + t4);
3438
+ }
3439
+ function G(t4, e4, s4 = 1) {
3440
+ return E(-t4, t4, e4, s4);
3441
+ }
3442
+ function $(t4, e4, s4, n4, o4, a4 = false) {
3443
+ const h4 = a4 ? o4.disableMultiStrokeFill : o4.disableMultiStroke, r4 = R(t4, e4, s4, n4, o4, true, false);
3444
+ if (h4) return r4;
3445
+ const i4 = R(t4, e4, s4, n4, o4, true, true);
3446
+ return r4.concat(i4);
3447
+ }
3448
+ function R(t4, e4, s4, n4, o4, a4, h4) {
3449
+ const r4 = Math.pow(t4 - s4, 2) + Math.pow(e4 - n4, 2), i4 = Math.sqrt(r4);
3450
+ let c4 = 1;
3451
+ c4 = i4 < 200 ? 1 : i4 > 500 ? 0.4 : -16668e-7 * i4 + 1.233334;
3452
+ let l4 = o4.maxRandomnessOffset || 0;
3453
+ l4 * l4 * 100 > r4 && (l4 = i4 / 10);
3454
+ const u5 = l4 / 2, p5 = 0.2 + 0.2 * W(o4);
3455
+ let f5 = o4.bowing * o4.maxRandomnessOffset * (n4 - e4) / 200, d4 = o4.bowing * o4.maxRandomnessOffset * (t4 - s4) / 200;
3456
+ f5 = G(f5, o4, c4), d4 = G(d4, o4, c4);
3457
+ const g4 = [], M4 = () => G(u5, o4, c4), k4 = () => G(l4, o4, c4), b3 = o4.preserveVertices;
3458
+ return (h4 ? g4.push({ op: "move", data: [t4 + (b3 ? 0 : M4()), e4 + (b3 ? 0 : M4())] }) : g4.push({ op: "move", data: [t4 + (b3 ? 0 : G(l4, o4, c4)), e4 + (b3 ? 0 : G(l4, o4, c4))] })), h4 ? g4.push({ op: "bcurveTo", data: [f5 + t4 + (s4 - t4) * p5 + M4(), d4 + e4 + (n4 - e4) * p5 + M4(), f5 + t4 + 2 * (s4 - t4) * p5 + M4(), d4 + e4 + 2 * (n4 - e4) * p5 + M4(), s4 + (b3 ? 0 : M4()), n4 + (b3 ? 0 : M4())] }) : g4.push({ op: "bcurveTo", data: [f5 + t4 + (s4 - t4) * p5 + k4(), d4 + e4 + (n4 - e4) * p5 + k4(), f5 + t4 + 2 * (s4 - t4) * p5 + k4(), d4 + e4 + 2 * (n4 - e4) * p5 + k4(), s4 + (b3 ? 0 : k4()), n4 + (b3 ? 0 : k4())] }), g4;
3459
+ }
3460
+ function j(t4, e4, s4) {
3461
+ if (!t4.length) return [];
3462
+ const n4 = [];
3463
+ n4.push([t4[0][0] + G(e4, s4), t4[0][1] + G(e4, s4)]), n4.push([t4[0][0] + G(e4, s4), t4[0][1] + G(e4, s4)]);
3464
+ for (let o4 = 1; o4 < t4.length; o4++) n4.push([t4[o4][0] + G(e4, s4), t4[o4][1] + G(e4, s4)]), o4 === t4.length - 1 && n4.push([t4[o4][0] + G(e4, s4), t4[o4][1] + G(e4, s4)]);
3465
+ return q(n4, null, s4);
3466
+ }
3467
+ function q(t4, e4, s4) {
3468
+ const n4 = t4.length, o4 = [];
3469
+ if (n4 > 3) {
3470
+ const a4 = [], h4 = 1 - s4.curveTightness;
3471
+ o4.push({ op: "move", data: [t4[1][0], t4[1][1]] });
3472
+ for (let e5 = 1; e5 + 2 < n4; e5++) {
3473
+ const s5 = t4[e5];
3474
+ a4[0] = [s5[0], s5[1]], a4[1] = [s5[0] + (h4 * t4[e5 + 1][0] - h4 * t4[e5 - 1][0]) / 6, s5[1] + (h4 * t4[e5 + 1][1] - h4 * t4[e5 - 1][1]) / 6], a4[2] = [t4[e5 + 1][0] + (h4 * t4[e5][0] - h4 * t4[e5 + 2][0]) / 6, t4[e5 + 1][1] + (h4 * t4[e5][1] - h4 * t4[e5 + 2][1]) / 6], a4[3] = [t4[e5 + 1][0], t4[e5 + 1][1]], o4.push({ op: "bcurveTo", data: [a4[1][0], a4[1][1], a4[2][0], a4[2][1], a4[3][0], a4[3][1]] });
3475
+ }
3476
+ } else 3 === n4 ? (o4.push({ op: "move", data: [t4[1][0], t4[1][1]] }), o4.push({ op: "bcurveTo", data: [t4[1][0], t4[1][1], t4[2][0], t4[2][1], t4[2][0], t4[2][1]] })) : 2 === n4 && o4.push(...R(t4[0][0], t4[0][1], t4[1][0], t4[1][1], s4, true, true));
3477
+ return o4;
3478
+ }
3479
+ function F(t4, e4, s4, n4, o4, a4, h4, r4) {
3480
+ const i4 = [], c4 = [];
3481
+ if (0 === r4.roughness) {
3482
+ t4 /= 4, c4.push([e4 + n4 * Math.cos(-t4), s4 + o4 * Math.sin(-t4)]);
3483
+ for (let a5 = 0; a5 <= 2 * Math.PI; a5 += t4) {
3484
+ const t5 = [e4 + n4 * Math.cos(a5), s4 + o4 * Math.sin(a5)];
3485
+ i4.push(t5), c4.push(t5);
3486
+ }
3487
+ c4.push([e4 + n4 * Math.cos(0), s4 + o4 * Math.sin(0)]), c4.push([e4 + n4 * Math.cos(t4), s4 + o4 * Math.sin(t4)]);
3488
+ } else {
3489
+ const l4 = G(0.5, r4) - Math.PI / 2;
3490
+ c4.push([G(a4, r4) + e4 + 0.9 * n4 * Math.cos(l4 - t4), G(a4, r4) + s4 + 0.9 * o4 * Math.sin(l4 - t4)]);
3491
+ const u5 = 2 * Math.PI + l4 - 0.01;
3492
+ for (let h5 = l4; h5 < u5; h5 += t4) {
3493
+ const t5 = [G(a4, r4) + e4 + n4 * Math.cos(h5), G(a4, r4) + s4 + o4 * Math.sin(h5)];
3494
+ i4.push(t5), c4.push(t5);
3495
+ }
3496
+ c4.push([G(a4, r4) + e4 + n4 * Math.cos(l4 + 2 * Math.PI + 0.5 * h4), G(a4, r4) + s4 + o4 * Math.sin(l4 + 2 * Math.PI + 0.5 * h4)]), c4.push([G(a4, r4) + e4 + 0.98 * n4 * Math.cos(l4 + h4), G(a4, r4) + s4 + 0.98 * o4 * Math.sin(l4 + h4)]), c4.push([G(a4, r4) + e4 + 0.9 * n4 * Math.cos(l4 + 0.5 * h4), G(a4, r4) + s4 + 0.9 * o4 * Math.sin(l4 + 0.5 * h4)]);
3497
+ }
3498
+ return [c4, i4];
3499
+ }
3500
+ function V(t4, e4, s4, n4, o4, a4, h4, r4, i4) {
3501
+ const c4 = a4 + G(0.1, i4), l4 = [];
3502
+ l4.push([G(r4, i4) + e4 + 0.9 * n4 * Math.cos(c4 - t4), G(r4, i4) + s4 + 0.9 * o4 * Math.sin(c4 - t4)]);
3503
+ for (let a5 = c4; a5 <= h4; a5 += t4) l4.push([G(r4, i4) + e4 + n4 * Math.cos(a5), G(r4, i4) + s4 + o4 * Math.sin(a5)]);
3504
+ return l4.push([e4 + n4 * Math.cos(h4), s4 + o4 * Math.sin(h4)]), l4.push([e4 + n4 * Math.cos(h4), s4 + o4 * Math.sin(h4)]), q(l4, null, i4);
3505
+ }
3506
+ function Z(t4, e4, s4, n4, o4, a4, h4, r4) {
3507
+ const i4 = [], c4 = [r4.maxRandomnessOffset || 1, (r4.maxRandomnessOffset || 1) + 0.3];
3508
+ let l4 = [0, 0];
3509
+ const u5 = r4.disableMultiStroke ? 1 : 2, p5 = r4.preserveVertices;
3510
+ for (let f5 = 0; f5 < u5; f5++) 0 === f5 ? i4.push({ op: "move", data: [h4[0], h4[1]] }) : i4.push({ op: "move", data: [h4[0] + (p5 ? 0 : G(c4[0], r4)), h4[1] + (p5 ? 0 : G(c4[0], r4))] }), l4 = p5 ? [o4, a4] : [o4 + G(c4[f5], r4), a4 + G(c4[f5], r4)], i4.push({ op: "bcurveTo", data: [t4 + G(c4[f5], r4), e4 + G(c4[f5], r4), s4 + G(c4[f5], r4), n4 + G(c4[f5], r4), l4[0], l4[1]] });
3511
+ return i4;
3512
+ }
3513
+ function Q(t4) {
3514
+ return [...t4];
3515
+ }
3516
+ function H(t4, e4 = 0) {
3517
+ const s4 = t4.length;
3518
+ if (s4 < 3) throw new Error("A curve must have at least three points.");
3519
+ const n4 = [];
3520
+ if (3 === s4) n4.push(Q(t4[0]), Q(t4[1]), Q(t4[2]), Q(t4[2]));
3521
+ else {
3522
+ const s5 = [];
3523
+ s5.push(t4[0], t4[0]);
3524
+ for (let e5 = 1; e5 < t4.length; e5++) s5.push(t4[e5]), e5 === t4.length - 1 && s5.push(t4[e5]);
3525
+ const o4 = [], a4 = 1 - e4;
3526
+ n4.push(Q(s5[0]));
3527
+ for (let t5 = 1; t5 + 2 < s5.length; t5++) {
3528
+ const e5 = s5[t5];
3529
+ o4[0] = [e5[0], e5[1]], o4[1] = [e5[0] + (a4 * s5[t5 + 1][0] - a4 * s5[t5 - 1][0]) / 6, e5[1] + (a4 * s5[t5 + 1][1] - a4 * s5[t5 - 1][1]) / 6], o4[2] = [s5[t5 + 1][0] + (a4 * s5[t5][0] - a4 * s5[t5 + 2][0]) / 6, s5[t5 + 1][1] + (a4 * s5[t5][1] - a4 * s5[t5 + 2][1]) / 6], o4[3] = [s5[t5 + 1][0], s5[t5 + 1][1]], n4.push(o4[1], o4[2], o4[3]);
3530
+ }
3531
+ }
3532
+ return n4;
3533
+ }
3534
+ function N(t4, e4) {
3535
+ return Math.pow(t4[0] - e4[0], 2) + Math.pow(t4[1] - e4[1], 2);
3536
+ }
3537
+ function B(t4, e4, s4) {
3538
+ const n4 = N(e4, s4);
3539
+ if (0 === n4) return N(t4, e4);
3540
+ let o4 = ((t4[0] - e4[0]) * (s4[0] - e4[0]) + (t4[1] - e4[1]) * (s4[1] - e4[1])) / n4;
3541
+ return o4 = Math.max(0, Math.min(1, o4)), N(t4, J(e4, s4, o4));
3542
+ }
3543
+ function J(t4, e4, s4) {
3544
+ return [t4[0] + (e4[0] - t4[0]) * s4, t4[1] + (e4[1] - t4[1]) * s4];
3545
+ }
3546
+ function K(t4, e4, s4, n4) {
3547
+ const o4 = n4 || [];
3548
+ if ((function(t5, e5) {
3549
+ const s5 = t5[e5 + 0], n5 = t5[e5 + 1], o5 = t5[e5 + 2], a5 = t5[e5 + 3];
3550
+ let h5 = 3 * n5[0] - 2 * s5[0] - a5[0];
3551
+ h5 *= h5;
3552
+ let r4 = 3 * n5[1] - 2 * s5[1] - a5[1];
3553
+ r4 *= r4;
3554
+ let i4 = 3 * o5[0] - 2 * a5[0] - s5[0];
3555
+ i4 *= i4;
3556
+ let c4 = 3 * o5[1] - 2 * a5[1] - s5[1];
3557
+ return c4 *= c4, h5 < i4 && (h5 = i4), r4 < c4 && (r4 = c4), h5 + r4;
3558
+ })(t4, e4) < s4) {
3559
+ const s5 = t4[e4 + 0];
3560
+ if (o4.length) {
3561
+ (a4 = o4[o4.length - 1], h4 = s5, Math.sqrt(N(a4, h4))) > 1 && o4.push(s5);
3562
+ } else o4.push(s5);
3563
+ o4.push(t4[e4 + 3]);
3564
+ } else {
3565
+ const n5 = 0.5, a5 = t4[e4 + 0], h5 = t4[e4 + 1], r4 = t4[e4 + 2], i4 = t4[e4 + 3], c4 = J(a5, h5, n5), l4 = J(h5, r4, n5), u5 = J(r4, i4, n5), p5 = J(c4, l4, n5), f5 = J(l4, u5, n5), d4 = J(p5, f5, n5);
3566
+ K([a5, c4, p5, d4], 0, s4, o4), K([d4, f5, u5, i4], 0, s4, o4);
3567
+ }
3568
+ var a4, h4;
3569
+ return o4;
3570
+ }
3571
+ function U(t4, e4) {
3572
+ return X(t4, 0, t4.length, e4);
3573
+ }
3574
+ function X(t4, e4, s4, n4, o4) {
3575
+ const a4 = o4 || [], h4 = t4[e4], r4 = t4[s4 - 1];
3576
+ let i4 = 0, c4 = 1;
3577
+ for (let n5 = e4 + 1; n5 < s4 - 1; ++n5) {
3578
+ const e5 = B(t4[n5], h4, r4);
3579
+ e5 > i4 && (i4 = e5, c4 = n5);
3580
+ }
3581
+ return Math.sqrt(i4) > n4 ? (X(t4, e4, c4 + 1, n4, a4), X(t4, c4, s4, n4, a4)) : (a4.length || a4.push(h4), a4.push(r4)), a4;
3582
+ }
3583
+ function Y(t4, e4 = 0.15, s4) {
3584
+ const n4 = [], o4 = (t4.length - 1) / 3;
3585
+ for (let s5 = 0; s5 < o4; s5++) {
3586
+ K(t4, 3 * s5, e4, n4);
3587
+ }
3588
+ return s4 && s4 > 0 ? X(n4, 0, n4.length, s4) : n4;
3589
+ }
3590
+ var tt = "none";
3591
+ var et = class {
3592
+ constructor(t4) {
3593
+ this.defaultOptions = { maxRandomnessOffset: 2, roughness: 1, bowing: 1, stroke: "#000", strokeWidth: 1, curveTightness: 0, curveFitting: 0.95, curveStepCount: 9, fillStyle: "hachure", fillWeight: -1, hachureAngle: -41, hachureGap: -1, dashOffset: -1, dashGap: -1, zigzagOffset: -1, seed: 0, disableMultiStroke: false, disableMultiStrokeFill: false, preserveVertices: false, fillShapeRoughnessGain: 0.8 }, this.config = t4 || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
3594
+ }
3595
+ static newSeed() {
3596
+ return Math.floor(Math.random() * 2 ** 31);
3597
+ }
3598
+ _o(t4) {
3599
+ return t4 ? Object.assign({}, this.defaultOptions, t4) : this.defaultOptions;
3600
+ }
3601
+ _d(t4, e4, s4) {
3602
+ return { shape: t4, sets: e4 || [], options: s4 || this.defaultOptions };
3603
+ }
3604
+ line(t4, e4, s4, n4, o4) {
3605
+ const a4 = this._o(o4);
3606
+ return this._d("line", [v(t4, e4, s4, n4, a4)], a4);
3607
+ }
3608
+ rectangle(t4, e4, s4, n4, o4) {
3609
+ const a4 = this._o(o4), h4 = [], r4 = O(t4, e4, s4, n4, a4);
3610
+ if (a4.fill) {
3611
+ const o5 = [[t4, e4], [t4 + s4, e4], [t4 + s4, e4 + n4], [t4, e4 + n4]];
3612
+ "solid" === a4.fillStyle ? h4.push(I([o5], a4)) : h4.push(C([o5], a4));
3613
+ }
3614
+ return a4.stroke !== tt && h4.push(r4), this._d("rectangle", h4, a4);
3615
+ }
3616
+ ellipse(t4, e4, s4, n4, o4) {
3617
+ const a4 = this._o(o4), h4 = [], r4 = T(s4, n4, a4), i4 = D(t4, e4, a4, r4);
3618
+ if (a4.fill) if ("solid" === a4.fillStyle) {
3619
+ const s5 = D(t4, e4, a4, r4).opset;
3620
+ s5.type = "fillPath", h4.push(s5);
3621
+ } else h4.push(C([i4.estimatedPoints], a4));
3622
+ return a4.stroke !== tt && h4.push(i4.opset), this._d("ellipse", h4, a4);
3623
+ }
3624
+ circle(t4, e4, s4, n4) {
3625
+ const o4 = this.ellipse(t4, e4, s4, s4, n4);
3626
+ return o4.shape = "circle", o4;
3627
+ }
3628
+ linearPath(t4, e4) {
3629
+ const s4 = this._o(e4);
3630
+ return this._d("linearPath", [S(t4, false, s4)], s4);
3631
+ }
3632
+ arc(t4, e4, s4, n4, o4, a4, h4 = false, r4) {
3633
+ const i4 = this._o(r4), c4 = [], l4 = A(t4, e4, s4, n4, o4, a4, h4, true, i4);
3634
+ if (h4 && i4.fill) if ("solid" === i4.fillStyle) {
3635
+ const h5 = Object.assign({}, i4);
3636
+ h5.disableMultiStroke = true;
3637
+ const r5 = A(t4, e4, s4, n4, o4, a4, true, false, h5);
3638
+ r5.type = "fillPath", c4.push(r5);
3639
+ } else c4.push((function(t5, e5, s5, n5, o5, a5, h5) {
3640
+ const r5 = t5, i5 = e5;
3641
+ let c5 = Math.abs(s5 / 2), l5 = Math.abs(n5 / 2);
3642
+ c5 += G(0.01 * c5, h5), l5 += G(0.01 * l5, h5);
3643
+ let u5 = o5, p5 = a5;
3644
+ for (; u5 < 0; ) u5 += 2 * Math.PI, p5 += 2 * Math.PI;
3645
+ p5 - u5 > 2 * Math.PI && (u5 = 0, p5 = 2 * Math.PI);
3646
+ const f5 = (p5 - u5) / h5.curveStepCount, d4 = [];
3647
+ for (let t6 = u5; t6 <= p5; t6 += f5) d4.push([r5 + c5 * Math.cos(t6), i5 + l5 * Math.sin(t6)]);
3648
+ return d4.push([r5 + c5 * Math.cos(p5), i5 + l5 * Math.sin(p5)]), d4.push([r5, i5]), C([d4], h5);
3649
+ })(t4, e4, s4, n4, o4, a4, i4));
3650
+ return i4.stroke !== tt && c4.push(l4), this._d("arc", c4, i4);
3651
+ }
3652
+ curve(t4, e4) {
3653
+ const s4 = this._o(e4), n4 = [], o4 = L(t4, s4);
3654
+ if (s4.fill && s4.fill !== tt) if ("solid" === s4.fillStyle) {
3655
+ const e5 = L(t4, Object.assign(Object.assign({}, s4), { disableMultiStroke: true, roughness: s4.roughness ? s4.roughness + s4.fillShapeRoughnessGain : 0 }));
3656
+ n4.push({ type: "fillPath", ops: this._mergedShape(e5.ops) });
3657
+ } else {
3658
+ const e5 = [], o5 = t4;
3659
+ if (o5.length) {
3660
+ const t5 = "number" == typeof o5[0][0] ? [o5] : o5;
3661
+ for (const n5 of t5) n5.length < 3 ? e5.push(...n5) : 3 === n5.length ? e5.push(...Y(H([n5[0], n5[0], n5[1], n5[2]]), 10, (1 + s4.roughness) / 2)) : e5.push(...Y(H(n5), 10, (1 + s4.roughness) / 2));
3662
+ }
3663
+ e5.length && n4.push(C([e5], s4));
3664
+ }
3665
+ return s4.stroke !== tt && n4.push(o4), this._d("curve", n4, s4);
3666
+ }
3667
+ polygon(t4, e4) {
3668
+ const s4 = this._o(e4), n4 = [], o4 = S(t4, true, s4);
3669
+ return s4.fill && ("solid" === s4.fillStyle ? n4.push(I([t4], s4)) : n4.push(C([t4], s4))), s4.stroke !== tt && n4.push(o4), this._d("polygon", n4, s4);
3670
+ }
3671
+ path(t4, e4) {
3672
+ const s4 = this._o(e4), n4 = [];
3673
+ if (!t4) return this._d("path", n4, s4);
3674
+ t4 = (t4 || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
3675
+ const o4 = s4.fill && "transparent" !== s4.fill && s4.fill !== tt, a4 = s4.stroke !== tt, h4 = !!(s4.simplification && s4.simplification < 1), r4 = (function(t5, e5, s5) {
3676
+ const n5 = m(y(b(t5))), o5 = [];
3677
+ let a5 = [], h5 = [0, 0], r5 = [];
3678
+ const i5 = () => {
3679
+ r5.length >= 4 && a5.push(...Y(r5, e5)), r5 = [];
3680
+ }, c4 = () => {
3681
+ i5(), a5.length && (o5.push(a5), a5 = []);
3682
+ };
3683
+ for (const { key: t6, data: e6 } of n5) switch (t6) {
3684
+ case "M":
3685
+ c4(), h5 = [e6[0], e6[1]], a5.push(h5);
3686
+ break;
3687
+ case "L":
3688
+ i5(), a5.push([e6[0], e6[1]]);
3689
+ break;
3690
+ case "C":
3691
+ if (!r5.length) {
3692
+ const t7 = a5.length ? a5[a5.length - 1] : h5;
3693
+ r5.push([t7[0], t7[1]]);
3694
+ }
3695
+ r5.push([e6[0], e6[1]]), r5.push([e6[2], e6[3]]), r5.push([e6[4], e6[5]]);
3696
+ break;
3697
+ case "Z":
3698
+ i5(), a5.push([h5[0], h5[1]]);
3699
+ }
3700
+ if (c4(), !s5) return o5;
3701
+ const l4 = [];
3702
+ for (const t6 of o5) {
3703
+ const e6 = U(t6, s5);
3704
+ e6.length && l4.push(e6);
3705
+ }
3706
+ return l4;
3707
+ })(t4, 1, h4 ? 4 - 4 * (s4.simplification || 1) : (1 + s4.roughness) / 2), i4 = _(t4, s4);
3708
+ if (o4) if ("solid" === s4.fillStyle) if (1 === r4.length) {
3709
+ const e5 = _(t4, Object.assign(Object.assign({}, s4), { disableMultiStroke: true, roughness: s4.roughness ? s4.roughness + s4.fillShapeRoughnessGain : 0 }));
3710
+ n4.push({ type: "fillPath", ops: this._mergedShape(e5.ops) });
3711
+ } else n4.push(I(r4, s4));
3712
+ else n4.push(C(r4, s4));
3713
+ return a4 && (h4 ? r4.forEach(((t5) => {
3714
+ n4.push(S(t5, false, s4));
3715
+ })) : n4.push(i4)), this._d("path", n4, s4);
3716
+ }
3717
+ opsToPath(t4, e4) {
3718
+ let s4 = "";
3719
+ for (const n4 of t4.ops) {
3720
+ const t5 = "number" == typeof e4 && e4 >= 0 ? n4.data.map(((t6) => +t6.toFixed(e4))) : n4.data;
3721
+ switch (n4.op) {
3722
+ case "move":
3723
+ s4 += `M${t5[0]} ${t5[1]} `;
3724
+ break;
3725
+ case "bcurveTo":
3726
+ s4 += `C${t5[0]} ${t5[1]}, ${t5[2]} ${t5[3]}, ${t5[4]} ${t5[5]} `;
3727
+ break;
3728
+ case "lineTo":
3729
+ s4 += `L${t5[0]} ${t5[1]} `;
3730
+ }
3731
+ }
3732
+ return s4.trim();
3733
+ }
3734
+ toPaths(t4) {
3735
+ const e4 = t4.sets || [], s4 = t4.options || this.defaultOptions, n4 = [];
3736
+ for (const t5 of e4) {
3737
+ let e5 = null;
3738
+ switch (t5.type) {
3739
+ case "path":
3740
+ e5 = { d: this.opsToPath(t5), stroke: s4.stroke, strokeWidth: s4.strokeWidth, fill: tt };
3741
+ break;
3742
+ case "fillPath":
3743
+ e5 = { d: this.opsToPath(t5), stroke: tt, strokeWidth: 0, fill: s4.fill || tt };
3744
+ break;
3745
+ case "fillSketch":
3746
+ e5 = this.fillSketch(t5, s4);
3747
+ }
3748
+ e5 && n4.push(e5);
3749
+ }
3750
+ return n4;
3751
+ }
3752
+ fillSketch(t4, e4) {
3753
+ let s4 = e4.fillWeight;
3754
+ return s4 < 0 && (s4 = e4.strokeWidth / 2), { d: this.opsToPath(t4), stroke: e4.fill || tt, strokeWidth: s4, fill: tt };
3755
+ }
3756
+ _mergedShape(t4) {
3757
+ return t4.filter(((t5, e4) => 0 === e4 || "move" !== t5.op));
3758
+ }
3759
+ };
3760
+ var st = class {
3761
+ constructor(t4, e4) {
3762
+ this.canvas = t4, this.ctx = this.canvas.getContext("2d"), this.gen = new et(e4);
3763
+ }
3764
+ draw(t4) {
3765
+ const e4 = t4.sets || [], s4 = t4.options || this.getDefaultOptions(), n4 = this.ctx, o4 = t4.options.fixedDecimalPlaceDigits;
3766
+ for (const a4 of e4) switch (a4.type) {
3767
+ case "path":
3768
+ n4.save(), n4.strokeStyle = "none" === s4.stroke ? "transparent" : s4.stroke, n4.lineWidth = s4.strokeWidth, s4.strokeLineDash && n4.setLineDash(s4.strokeLineDash), s4.strokeLineDashOffset && (n4.lineDashOffset = s4.strokeLineDashOffset), this._drawToContext(n4, a4, o4), n4.restore();
3769
+ break;
3770
+ case "fillPath": {
3771
+ n4.save(), n4.fillStyle = s4.fill || "";
3772
+ const e5 = "curve" === t4.shape || "polygon" === t4.shape || "path" === t4.shape ? "evenodd" : "nonzero";
3773
+ this._drawToContext(n4, a4, o4, e5), n4.restore();
3774
+ break;
3775
+ }
3776
+ case "fillSketch":
3777
+ this.fillSketch(n4, a4, s4);
3778
+ }
3779
+ }
3780
+ fillSketch(t4, e4, s4) {
3781
+ let n4 = s4.fillWeight;
3782
+ n4 < 0 && (n4 = s4.strokeWidth / 2), t4.save(), s4.fillLineDash && t4.setLineDash(s4.fillLineDash), s4.fillLineDashOffset && (t4.lineDashOffset = s4.fillLineDashOffset), t4.strokeStyle = s4.fill || "", t4.lineWidth = n4, this._drawToContext(t4, e4, s4.fixedDecimalPlaceDigits), t4.restore();
3783
+ }
3784
+ _drawToContext(t4, e4, s4, n4 = "nonzero") {
3785
+ t4.beginPath();
3786
+ for (const n5 of e4.ops) {
3787
+ const e5 = "number" == typeof s4 && s4 >= 0 ? n5.data.map(((t5) => +t5.toFixed(s4))) : n5.data;
3788
+ switch (n5.op) {
3789
+ case "move":
3790
+ t4.moveTo(e5[0], e5[1]);
3791
+ break;
3792
+ case "bcurveTo":
3793
+ t4.bezierCurveTo(e5[0], e5[1], e5[2], e5[3], e5[4], e5[5]);
3794
+ break;
3795
+ case "lineTo":
3796
+ t4.lineTo(e5[0], e5[1]);
3797
+ }
3798
+ }
3799
+ "fillPath" === e4.type ? t4.fill(n4) : t4.stroke();
3800
+ }
3801
+ get generator() {
3802
+ return this.gen;
3803
+ }
3804
+ getDefaultOptions() {
3805
+ return this.gen.defaultOptions;
3806
+ }
3807
+ line(t4, e4, s4, n4, o4) {
3808
+ const a4 = this.gen.line(t4, e4, s4, n4, o4);
3809
+ return this.draw(a4), a4;
3810
+ }
3811
+ rectangle(t4, e4, s4, n4, o4) {
3812
+ const a4 = this.gen.rectangle(t4, e4, s4, n4, o4);
3813
+ return this.draw(a4), a4;
3814
+ }
3815
+ ellipse(t4, e4, s4, n4, o4) {
3816
+ const a4 = this.gen.ellipse(t4, e4, s4, n4, o4);
3817
+ return this.draw(a4), a4;
3818
+ }
3819
+ circle(t4, e4, s4, n4) {
3820
+ const o4 = this.gen.circle(t4, e4, s4, n4);
3821
+ return this.draw(o4), o4;
3822
+ }
3823
+ linearPath(t4, e4) {
3824
+ const s4 = this.gen.linearPath(t4, e4);
3825
+ return this.draw(s4), s4;
3826
+ }
3827
+ polygon(t4, e4) {
3828
+ const s4 = this.gen.polygon(t4, e4);
3829
+ return this.draw(s4), s4;
3830
+ }
3831
+ arc(t4, e4, s4, n4, o4, a4, h4 = false, r4) {
3832
+ const i4 = this.gen.arc(t4, e4, s4, n4, o4, a4, h4, r4);
3833
+ return this.draw(i4), i4;
3834
+ }
3835
+ curve(t4, e4) {
3836
+ const s4 = this.gen.curve(t4, e4);
3837
+ return this.draw(s4), s4;
3838
+ }
3839
+ path(t4, e4) {
3840
+ const s4 = this.gen.path(t4, e4);
3841
+ return this.draw(s4), s4;
3842
+ }
3843
+ };
3844
+ var nt = "http://www.w3.org/2000/svg";
3845
+ var ot = class {
3846
+ constructor(t4, e4) {
3847
+ this.svg = t4, this.gen = new et(e4);
3848
+ }
3849
+ draw(t4) {
3850
+ const e4 = t4.sets || [], s4 = t4.options || this.getDefaultOptions(), n4 = this.svg.ownerDocument || window.document, o4 = n4.createElementNS(nt, "g"), a4 = t4.options.fixedDecimalPlaceDigits;
3851
+ for (const h4 of e4) {
3852
+ let e5 = null;
3853
+ switch (h4.type) {
3854
+ case "path":
3855
+ e5 = n4.createElementNS(nt, "path"), e5.setAttribute("d", this.opsToPath(h4, a4)), e5.setAttribute("stroke", s4.stroke), e5.setAttribute("stroke-width", s4.strokeWidth + ""), e5.setAttribute("fill", "none"), s4.strokeLineDash && e5.setAttribute("stroke-dasharray", s4.strokeLineDash.join(" ").trim()), s4.strokeLineDashOffset && e5.setAttribute("stroke-dashoffset", `${s4.strokeLineDashOffset}`);
3856
+ break;
3857
+ case "fillPath":
3858
+ e5 = n4.createElementNS(nt, "path"), e5.setAttribute("d", this.opsToPath(h4, a4)), e5.setAttribute("stroke", "none"), e5.setAttribute("stroke-width", "0"), e5.setAttribute("fill", s4.fill || ""), "curve" !== t4.shape && "polygon" !== t4.shape || e5.setAttribute("fill-rule", "evenodd");
3859
+ break;
3860
+ case "fillSketch":
3861
+ e5 = this.fillSketch(n4, h4, s4);
3862
+ }
3863
+ e5 && o4.appendChild(e5);
3864
+ }
3865
+ return o4;
3866
+ }
3867
+ fillSketch(t4, e4, s4) {
3868
+ let n4 = s4.fillWeight;
3869
+ n4 < 0 && (n4 = s4.strokeWidth / 2);
3870
+ const o4 = t4.createElementNS(nt, "path");
3871
+ return o4.setAttribute("d", this.opsToPath(e4, s4.fixedDecimalPlaceDigits)), o4.setAttribute("stroke", s4.fill || ""), o4.setAttribute("stroke-width", n4 + ""), o4.setAttribute("fill", "none"), s4.fillLineDash && o4.setAttribute("stroke-dasharray", s4.fillLineDash.join(" ").trim()), s4.fillLineDashOffset && o4.setAttribute("stroke-dashoffset", `${s4.fillLineDashOffset}`), o4;
3872
+ }
3873
+ get generator() {
3874
+ return this.gen;
3875
+ }
3876
+ getDefaultOptions() {
3877
+ return this.gen.defaultOptions;
3878
+ }
3879
+ opsToPath(t4, e4) {
3880
+ return this.gen.opsToPath(t4, e4);
3881
+ }
3882
+ line(t4, e4, s4, n4, o4) {
3883
+ const a4 = this.gen.line(t4, e4, s4, n4, o4);
3884
+ return this.draw(a4);
3885
+ }
3886
+ rectangle(t4, e4, s4, n4, o4) {
3887
+ const a4 = this.gen.rectangle(t4, e4, s4, n4, o4);
3888
+ return this.draw(a4);
3889
+ }
3890
+ ellipse(t4, e4, s4, n4, o4) {
3891
+ const a4 = this.gen.ellipse(t4, e4, s4, n4, o4);
3892
+ return this.draw(a4);
3893
+ }
3894
+ circle(t4, e4, s4, n4) {
3895
+ const o4 = this.gen.circle(t4, e4, s4, n4);
3896
+ return this.draw(o4);
3897
+ }
3898
+ linearPath(t4, e4) {
3899
+ const s4 = this.gen.linearPath(t4, e4);
3900
+ return this.draw(s4);
3901
+ }
3902
+ polygon(t4, e4) {
3903
+ const s4 = this.gen.polygon(t4, e4);
3904
+ return this.draw(s4);
3905
+ }
3906
+ arc(t4, e4, s4, n4, o4, a4, h4 = false, r4) {
3907
+ const i4 = this.gen.arc(t4, e4, s4, n4, o4, a4, h4, r4);
3908
+ return this.draw(i4);
3909
+ }
3910
+ curve(t4, e4) {
3911
+ const s4 = this.gen.curve(t4, e4);
3912
+ return this.draw(s4);
3913
+ }
3914
+ path(t4, e4) {
3915
+ const s4 = this.gen.path(t4, e4);
3916
+ return this.draw(s4);
3917
+ }
3918
+ };
3919
+ var at = { canvas: (t4, e4) => new st(t4, e4), svg: (t4, e4) => new ot(t4, e4), generator: (t4) => new et(t4), newSeed: () => et.newSeed() };
3920
+
3921
+ // node_modules/perfect-freehand/dist/esm/index.mjs
3922
+ var { PI: e2 } = Math;
3923
+ var t2 = e2 + 1e-4;
3924
+ var n2 = 0.5;
3925
+ var r2 = [1, 1];
3926
+ function i2(e4, t4, n4, r4 = (e5) => e5) {
3927
+ return e4 * r4(0.5 - t4 * (0.5 - n4));
3928
+ }
3929
+ var { min: a2 } = Math;
3930
+ function o2(e4, t4, n4) {
3931
+ let r4 = a2(1, t4 / n4);
3932
+ return a2(1, e4 + (a2(1, 1 - r4) - e4) * (r4 * 0.275));
3933
+ }
3934
+ function s2(e4) {
3935
+ return [-e4[0], -e4[1]];
3936
+ }
3937
+ function c2(e4, t4) {
3938
+ return [e4[0] + t4[0], e4[1] + t4[1]];
3939
+ }
3940
+ function l2(e4, t4, n4) {
3941
+ return e4[0] = t4[0] + n4[0], e4[1] = t4[1] + n4[1], e4;
3942
+ }
3943
+ function u2(e4, t4) {
3944
+ return [e4[0] - t4[0], e4[1] - t4[1]];
3945
+ }
3946
+ function d2(e4, t4, n4) {
3947
+ return e4[0] = t4[0] - n4[0], e4[1] = t4[1] - n4[1], e4;
3948
+ }
3949
+ function f2(e4, t4) {
3950
+ return [e4[0] * t4, e4[1] * t4];
3951
+ }
3952
+ function p3(e4, t4, n4) {
3953
+ return e4[0] = t4[0] * n4, e4[1] = t4[1] * n4, e4;
3954
+ }
3955
+ function m2(e4, t4) {
3956
+ return [e4[0] / t4, e4[1] / t4];
3957
+ }
3958
+ function h2(e4) {
3959
+ return [e4[1], -e4[0]];
3960
+ }
3961
+ function g2(e4, t4) {
3962
+ let n4 = t4[0];
3963
+ return e4[0] = t4[1], e4[1] = -n4, e4;
3964
+ }
3965
+ function ee(e4, t4) {
3966
+ return e4[0] * t4[0] + e4[1] * t4[1];
3967
+ }
3968
+ function _2(e4, t4) {
3969
+ return e4[0] === t4[0] && e4[1] === t4[1];
3970
+ }
3971
+ function v2(e4) {
3972
+ return Math.hypot(e4[0], e4[1]);
3973
+ }
3974
+ function y2(e4, t4) {
3975
+ let n4 = e4[0] - t4[0], r4 = e4[1] - t4[1];
3976
+ return n4 * n4 + r4 * r4;
3977
+ }
3978
+ function b2(e4) {
3979
+ return m2(e4, v2(e4));
3980
+ }
3981
+ function x2(e4, t4) {
3982
+ return Math.hypot(e4[1] - t4[1], e4[0] - t4[0]);
3983
+ }
3984
+ function S2(e4, t4, n4) {
3985
+ let r4 = Math.sin(n4), i4 = Math.cos(n4), a4 = e4[0] - t4[0], o4 = e4[1] - t4[1], s4 = a4 * i4 - o4 * r4, c4 = a4 * r4 + o4 * i4;
3986
+ return [s4 + t4[0], c4 + t4[1]];
3987
+ }
3988
+ function C2(e4, t4, n4, r4) {
3989
+ let i4 = Math.sin(r4), a4 = Math.cos(r4), o4 = t4[0] - n4[0], s4 = t4[1] - n4[1], c4 = o4 * a4 - s4 * i4, l4 = o4 * i4 + s4 * a4;
3990
+ return e4[0] = c4 + n4[0], e4[1] = l4 + n4[1], e4;
3991
+ }
3992
+ function w2(e4, t4, n4) {
3993
+ return c2(e4, f2(u2(t4, e4), n4));
3994
+ }
3995
+ function te(e4, t4, n4, r4) {
3996
+ let i4 = n4[0] - t4[0], a4 = n4[1] - t4[1];
3997
+ return e4[0] = t4[0] + i4 * r4, e4[1] = t4[1] + a4 * r4, e4;
3998
+ }
3999
+ function T2(e4, t4, n4) {
4000
+ return c2(e4, f2(t4, n4));
4001
+ }
4002
+ var E2 = [0, 0];
4003
+ var D2 = [0, 0];
4004
+ var O2 = [0, 0];
4005
+ function k2(e4, n4) {
4006
+ let r4 = T2(e4, b2(h2(u2(e4, c2(e4, [1, 1])))), -n4), i4 = [], a4 = 1 / 13;
4007
+ for (let n5 = a4; n5 <= 1; n5 += a4) i4.push(S2(r4, e4, t2 * 2 * n5));
4008
+ return i4;
4009
+ }
4010
+ function A2(e4, n4, r4) {
4011
+ let i4 = [], a4 = 1 / r4;
4012
+ for (let r5 = a4; r5 <= 1; r5 += a4) i4.push(S2(n4, e4, t2 * r5));
4013
+ return i4;
4014
+ }
4015
+ function j2(e4, t4, n4) {
4016
+ let r4 = u2(t4, n4), i4 = f2(r4, 0.5), a4 = f2(r4, 0.51);
4017
+ return [u2(e4, i4), u2(e4, a4), c2(e4, a4), c2(e4, i4)];
4018
+ }
4019
+ function M2(e4, n4, r4, i4) {
4020
+ let a4 = [], o4 = T2(e4, n4, r4), s4 = 1 / i4;
4021
+ for (let n5 = s4; n5 < 1; n5 += s4) a4.push(S2(o4, e4, t2 * 3 * n5));
4022
+ return a4;
4023
+ }
4024
+ function ne(e4, t4, n4) {
4025
+ return [c2(e4, f2(t4, n4)), c2(e4, f2(t4, n4 * 0.99)), u2(e4, f2(t4, n4 * 0.99)), u2(e4, f2(t4, n4))];
4026
+ }
4027
+ function N2(e4, t4, n4) {
4028
+ return e4 === false || e4 === void 0 ? 0 : e4 === true ? Math.max(t4, n4) : e4;
4029
+ }
4030
+ function re2(e4, t4, n4) {
4031
+ return e4.slice(0, 10).reduce((e5, r4) => {
4032
+ let i4 = r4.pressure;
4033
+ return t4 && (i4 = o2(e5, r4.distance, n4)), (e5 + i4) / 2;
4034
+ }, e4[0].pressure);
4035
+ }
4036
+ function P2(e4, n4 = {}) {
4037
+ let { size: r4 = 16, smoothing: a4 = 0.5, thinning: f5 = 0.5, simulatePressure: m4 = true, easing: _3 = (e5) => e5, start: v4 = {}, end: b3 = {}, last: x4 = false } = n4, { cap: S4 = true, easing: w4 = (e5) => e5 * (2 - e5) } = v4, { cap: T4 = true, easing: P4 = (e5) => --e5 * e5 * e5 + 1 } = b3;
4038
+ if (e4.length === 0 || r4 <= 0) return [];
4039
+ let F4 = e4[e4.length - 1].runningLength, I4 = N2(v4.taper, r4, F4), L4 = N2(b3.taper, r4, F4), R3 = (r4 * a4) ** 2, z3 = [], B3 = [], V3 = re2(e4, m4, r4), H2 = i2(r4, f5, e4[e4.length - 1].pressure, _3), U2, W2 = e4[0].vector, G2 = e4[0].point, K2 = G2, q3 = G2, J2 = K2, Y2 = false;
4040
+ for (let n5 = 0; n5 < e4.length; n5++) {
4041
+ let { pressure: a5 } = e4[n5], { point: s4, vector: h4, distance: v5, runningLength: b4 } = e4[n5], x5 = n5 === e4.length - 1;
4042
+ if (!x5 && F4 - b4 < 3) continue;
4043
+ f5 ? (m4 && (a5 = o2(V3, v5, r4)), H2 = i2(r4, f5, a5, _3)) : H2 = r4 / 2, U2 === void 0 && (U2 = H2);
4044
+ let S5 = b4 < I4 ? w4(b4 / I4) : 1, T5 = F4 - b4 < L4 ? P4((F4 - b4) / L4) : 1;
4045
+ H2 = Math.max(0.01, H2 * Math.min(S5, T5));
4046
+ let k4 = (x5 ? e4[n5] : e4[n5 + 1]).vector, A4 = x5 ? 1 : ee(h4, k4), j4 = ee(h4, W2) < 0 && !Y2, M4 = A4 !== null && A4 < 0;
4047
+ if (j4 || M4) {
4048
+ g2(E2, W2), p3(E2, E2, H2);
4049
+ for (let e5 = 0; e5 <= 1; e5 += 0.07692307692307693) d2(D2, s4, E2), C2(D2, D2, s4, t2 * e5), q3 = [D2[0], D2[1]], z3.push(q3), l2(O2, s4, E2), C2(O2, O2, s4, t2 * -e5), J2 = [O2[0], O2[1]], B3.push(J2);
4050
+ G2 = q3, K2 = J2, M4 && (Y2 = true);
4051
+ continue;
4052
+ }
4053
+ if (Y2 = false, x5) {
4054
+ g2(E2, h4), p3(E2, E2, H2), z3.push(u2(s4, E2)), B3.push(c2(s4, E2));
4055
+ continue;
4056
+ }
4057
+ te(E2, k4, h4, A4), g2(E2, E2), p3(E2, E2, H2), d2(D2, s4, E2), q3 = [D2[0], D2[1]], (n5 <= 1 || y2(G2, q3) > R3) && (z3.push(q3), G2 = q3), l2(O2, s4, E2), J2 = [O2[0], O2[1]], (n5 <= 1 || y2(K2, J2) > R3) && (B3.push(J2), K2 = J2), V3 = a5, W2 = h4;
4058
+ }
4059
+ let X2 = [e4[0].point[0], e4[0].point[1]], Z2 = e4.length > 1 ? [e4[e4.length - 1].point[0], e4[e4.length - 1].point[1]] : c2(e4[0].point, [1, 1]), Q2 = [], $3 = [];
4060
+ if (e4.length === 1) {
4061
+ if (!(I4 || L4) || x4) return k2(X2, U2 || H2);
4062
+ } else {
4063
+ I4 || L4 && e4.length === 1 || (S4 ? Q2.push(...A2(X2, B3[0], 13)) : Q2.push(...j2(X2, z3[0], B3[0])));
4064
+ let t4 = h2(s2(e4[e4.length - 1].vector));
4065
+ L4 || I4 && e4.length === 1 ? $3.push(Z2) : T4 ? $3.push(...M2(Z2, t4, H2, 29)) : $3.push(...ne(Z2, t4, H2));
4066
+ }
4067
+ return z3.concat($3, B3.reverse(), Q2);
4068
+ }
4069
+ var F2 = [0, 0];
4070
+ function I2(e4) {
4071
+ return e4 != null && e4 >= 0;
4072
+ }
4073
+ function L2(e4, t4 = {}) {
4074
+ let { streamline: i4 = 0.5, size: a4 = 16, last: o4 = false } = t4;
4075
+ if (e4.length === 0) return [];
4076
+ let s4 = 0.15 + (1 - i4) * 0.85, l4 = Array.isArray(e4[0]) ? e4 : e4.map(({ x: e5, y: t5, pressure: r4 = n2 }) => [e5, t5, r4]);
4077
+ if (l4.length === 2) {
4078
+ let e5 = l4[1];
4079
+ l4 = l4.slice(0, -1);
4080
+ for (let t5 = 1; t5 < 5; t5++) l4.push(w2(l4[0], e5, t5 / 4));
4081
+ }
4082
+ l4.length === 1 && (l4 = [...l4, [...c2(l4[0], r2), ...l4[0].slice(2)]]);
4083
+ let u5 = [{ point: [l4[0][0], l4[0][1]], pressure: I2(l4[0][2]) ? l4[0][2] : 0.25, vector: [...r2], distance: 0, runningLength: 0 }], f5 = false, p5 = 0, m4 = u5[0], h4 = l4.length - 1;
4084
+ for (let e5 = 1; e5 < l4.length; e5++) {
4085
+ let t5 = o4 && e5 === h4 ? [l4[e5][0], l4[e5][1]] : w2(m4.point, l4[e5], s4);
4086
+ if (_2(m4.point, t5)) continue;
4087
+ let r4 = x2(t5, m4.point);
4088
+ if (p5 += r4, e5 < h4 && !f5) {
4089
+ if (p5 < a4) continue;
4090
+ f5 = true;
4091
+ }
4092
+ d2(F2, m4.point, t5), m4 = { point: t5, pressure: I2(l4[e5][2]) ? l4[e5][2] : n2, vector: b2(F2), distance: r4, runningLength: p5 }, u5.push(m4);
4093
+ }
4094
+ return u5[0].vector = u5[1]?.vector || [0, 0], u5;
4095
+ }
4096
+ function R2(e4, t4 = {}) {
4097
+ return P2(L2(e4, t4), t4);
4098
+ }
4099
+
4100
+ // src/renderer.ts
4101
+ var gen = at.generator();
4102
+ var FONT_FAMILIES = {
4103
+ 1: "Virgil, Segoe UI Emoji, sans-serif",
4104
+ 2: "Helvetica, Arial, sans-serif",
4105
+ 3: "Cascadia, monospace",
4106
+ 4: "Virgil, Segoe UI Emoji, sans-serif"
4107
+ };
4108
+ function renderToSvg(data, opts = {}, ctx) {
4109
+ const elements = data.elements.filter((el) => !el.isDeleted);
4110
+ if (elements.length === 0) {
4111
+ return {
4112
+ svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"></svg>',
4113
+ overlays: [],
4114
+ viewBox: { width: 100, height: 100, offsetX: 0, offsetY: 0 }
4115
+ };
4116
+ }
4117
+ const padding = opts.exportPadding ?? 20;
4118
+ const bbox = computeBoundingBox(elements);
4119
+ const width = Math.ceil(bbox.width + padding * 2);
4120
+ const height = Math.ceil(bbox.height + padding * 2);
4121
+ const offsetX = -bbox.minX + padding;
4122
+ const offsetY = -bbox.minY + padding;
4123
+ const bgColor = resolveBgColor(data, opts);
4124
+ const overlays = [];
4125
+ const embeddables = elements.filter((el) => el.type === "embeddable" || el.type === "iframe");
4126
+ for (const el of embeddables) {
4127
+ const link = el.link ?? "";
4128
+ const isWikilink = link.startsWith("[[");
4129
+ overlays.push({
4130
+ id: el.id,
4131
+ x: el.x,
4132
+ y: el.y,
4133
+ width: el.width,
4134
+ height: el.height,
4135
+ link,
4136
+ isWikilink,
4137
+ resolved: ctx?.resolvedEmbeds?.[el.id]
4138
+ });
4139
+ }
4140
+ const renderedElements = elements.map((el) => renderElement(el, data, ctx)).filter(Boolean);
4141
+ const parts = [
4142
+ `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="100%" height="100%" preserveAspectRatio="xMidYMid meet" data-bg-color="${escapeAttr(bgColor ?? "#ffffff")}">`,
4143
+ `<defs>${getFontDefs()}</defs>`,
4144
+ `<g transform="translate(${offsetX}, ${offsetY})">`,
4145
+ ...renderedElements,
4146
+ "</g>",
4147
+ "</svg>"
4148
+ ];
4149
+ return {
4150
+ svg: parts.filter(Boolean).join("\n"),
4151
+ overlays,
4152
+ viewBox: { width, height, offsetX, offsetY }
4153
+ };
4154
+ }
4155
+ function resolveBgColor(data, opts) {
4156
+ const exportBg = data.appState.exportBackground ?? true;
4157
+ if (!exportBg) return null;
4158
+ if (opts.darkMode === "dark") return "#1e1e1e";
4159
+ if (opts.darkMode === "light") return data.appState.viewBackgroundColor ?? "#ffffff";
4160
+ const rawBg = data.appState.viewBackgroundColor ?? "#ffffff";
4161
+ const lower = rawBg.toLowerCase();
4162
+ if (lower === "#ffffff" || lower === "#ffffffff") return "var(--excalidraw-bg, #ffffff)";
4163
+ return rawBg;
4164
+ }
4165
+ function renderElement(el, data, ctx) {
4166
+ const inner = renderElementInner(el, data, ctx);
4167
+ if (!inner) return "";
4168
+ const attrs = [];
4169
+ if (el.angle && el.angle !== 0) {
4170
+ const cx = el.x + el.width / 2;
4171
+ const cy = el.y + el.height / 2;
4172
+ const deg = el.angle * 180 / Math.PI;
4173
+ attrs.push(`transform="rotate(${deg.toFixed(2)}, ${cx.toFixed(2)}, ${cy.toFixed(2)})"`);
4174
+ }
4175
+ if (el.opacity != null && el.opacity < 100) {
4176
+ attrs.push(`opacity="${el.opacity / 100}"`);
4177
+ }
4178
+ if (attrs.length > 0) {
4179
+ return `<g ${attrs.join(" ")}>${inner}</g>`;
4180
+ }
4181
+ return inner;
4182
+ }
4183
+ function renderElementInner(el, data, ctx) {
4184
+ switch (el.type) {
4185
+ case "rectangle":
4186
+ return renderRectangle(el);
4187
+ case "ellipse":
4188
+ return renderEllipse(el);
4189
+ case "diamond":
4190
+ return renderDiamond(el);
4191
+ case "line":
4192
+ case "arrow":
4193
+ return renderLinearElement(el);
4194
+ case "text":
4195
+ return renderText(el);
4196
+ case "freedraw":
4197
+ return renderFreedraw(el);
4198
+ case "image":
4199
+ return renderImage(el, data, ctx);
4200
+ case "frame":
4201
+ case "magicframe":
4202
+ return renderFrame(el);
4203
+ case "embeddable":
4204
+ case "iframe":
4205
+ return renderEmbeddable(el);
4206
+ default:
4207
+ return "";
4208
+ }
4209
+ }
4210
+ var DARK_MODE_MAP = {
4211
+ "#1e1e1e": "#d3d3d3",
4212
+ "#000000": "#ededed",
4213
+ "#343a40": "#b7bcc1",
4214
+ "#868e96": "#6e757c",
4215
+ "#ced4da": "#33383d",
4216
+ "#e9ecef": "#202325",
4217
+ "#f8f9fa": "#161718",
4218
+ "#e03131": "#ff8383",
4219
+ "#fa5252": "#fa6969",
4220
+ "#ff8787": "#b44d4d",
4221
+ "#ffc9c9": "#5a2c2c",
4222
+ "#fff5f5": "#1f1717",
4223
+ "#c2255c": "#ff8dbc",
4224
+ "#e64980": "#f56e9d",
4225
+ "#f783ac": "#b04d70",
4226
+ "#fcc2d7": "#602e40",
4227
+ "#fff0f6": "#26191e",
4228
+ "#9c36b5": "#e28af8",
4229
+ "#be4bdb": "#d471ed",
4230
+ "#da77f2": "#a954be",
4231
+ "#eebefa": "#5b3165",
4232
+ "#f8f0fc": "#211a25",
4233
+ "#6741d9": "#b595ff",
4234
+ "#7950f2": "#a885ff",
4235
+ "#9775fa": "#8a6cdf",
4236
+ "#d0bfff": "#4a3b72",
4237
+ "#f3f0ff": "#1f1c29",
4238
+ "#1971c2": "#56a2e8",
4239
+ "#228be6": "#3791e0",
4240
+ "#4dabf7": "#2273b4",
4241
+ "#a5d8ff": "#154162",
4242
+ "#e7f5ff": "#121e26",
4243
+ "#0c8599": "#3da5b6",
4244
+ "#15aabf": "#0f8fa1",
4245
+ "#3bc9db": "#007281",
4246
+ "#99e9f2": "#004149",
4247
+ "#e3fafc": "#0a1e20",
4248
+ "#099268": "#32a783",
4249
+ "#12b886": "#039267",
4250
+ "#38d9a9": "#00744b",
4251
+ "#96f2d7": "#00422b",
4252
+ "#e6fcf5": "#0a1d17",
4253
+ "#2f9e44": "#39994b",
4254
+ "#40c057": "#16842a",
4255
+ "#69db7c": "#056715",
4256
+ "#b2f2bb": "#043b0c",
4257
+ "#ebfbee": "#0f1d12",
4258
+ "#f08c00": "#b86200",
4259
+ "#fab005": "#905000",
4260
+ "#ffd43b": "#5f3a00",
4261
+ "#ffec99": "#362600",
4262
+ "#fff9db": "#1e1900",
4263
+ "#e8590c": "#f17634",
4264
+ "#fd7e14": "#cd6005",
4265
+ "#ffa94d": "#924800",
4266
+ "#ffd8a8": "#4c2b01",
4267
+ "#fff4e6": "#22190d",
4268
+ "#846358": "#a98d84",
4269
+ "#a18072": "#917569",
4270
+ "#d2bab0": "#5a463d",
4271
+ "#eaddd7": "#362b26",
4272
+ "#f8f1ee": "#221c1a",
4273
+ "#ffffff": "#121212"
4274
+ };
4275
+ function themeColor(color) {
4276
+ const lower = color.toLowerCase();
4277
+ if (lower in DARK_MODE_MAP) {
4278
+ return `var(--excalidraw-color-${lower.slice(1)}, ${color})`;
4279
+ }
4280
+ return color;
4281
+ }
4282
+ function roughOpts(el) {
4283
+ return {
4284
+ seed: el.seed,
4285
+ roughness: el.roughness,
4286
+ stroke: el.strokeColor === "transparent" ? "none" : themeColor(el.strokeColor),
4287
+ strokeWidth: el.strokeWidth,
4288
+ fill: el.backgroundColor === "transparent" ? void 0 : themeColor(el.backgroundColor),
4289
+ fillStyle: mapFillStyle(el.fillStyle),
4290
+ strokeLineDash: mapStrokeStyle(el.strokeStyle, el.strokeWidth)
4291
+ };
4292
+ }
4293
+ function mapFillStyle(style) {
4294
+ switch (style) {
4295
+ case "hachure":
4296
+ return "hachure";
4297
+ case "cross-hatch":
4298
+ return "cross-hatch";
4299
+ case "solid":
4300
+ return "solid";
4301
+ case "zigzag":
4302
+ return "zigzag";
4303
+ case "dots":
4304
+ return "dots";
4305
+ case "dashed":
4306
+ return "dashed";
4307
+ case "zigzag-line":
4308
+ return "zigzag-line";
4309
+ default:
4310
+ return "hachure";
4311
+ }
4312
+ }
4313
+ function mapStrokeStyle(style, width) {
4314
+ switch (style) {
4315
+ case "dashed":
4316
+ return [8 * width, 4 * width];
4317
+ case "dotted":
4318
+ return [1.5 * width, 4 * width];
4319
+ default:
4320
+ return void 0;
4321
+ }
4322
+ }
4323
+ function renderRectangle(el) {
4324
+ const opts = roughOpts(el);
4325
+ const drawable = gen.rectangle(el.x, el.y, el.width, el.height, opts);
4326
+ return drawableToSvg(drawable);
4327
+ }
4328
+ function renderEllipse(el) {
4329
+ const opts = roughOpts(el);
4330
+ const cx = el.x + el.width / 2;
4331
+ const cy = el.y + el.height / 2;
4332
+ const drawable = gen.ellipse(cx, cy, el.width, el.height, opts);
4333
+ return drawableToSvg(drawable);
4334
+ }
4335
+ function renderDiamond(el) {
4336
+ const opts = roughOpts(el);
4337
+ const cx = el.x + el.width / 2;
4338
+ const cy = el.y + el.height / 2;
4339
+ const hw = el.width / 2;
4340
+ const hh = el.height / 2;
4341
+ const points = [
4342
+ [cx, cy - hh],
4343
+ [cx + hw, cy],
4344
+ [cx, cy + hh],
4345
+ [cx - hw, cy]
4346
+ ];
4347
+ const drawable = gen.polygon(points, opts);
4348
+ return drawableToSvg(drawable);
4349
+ }
4350
+ function renderLinearElement(el) {
4351
+ const points = el.points ?? [];
4352
+ if (points.length < 2) return "";
4353
+ const opts = {
4354
+ ...roughOpts(el),
4355
+ fill: void 0,
4356
+ fillStyle: void 0
4357
+ };
4358
+ const absolutePoints = points.map(([px, py]) => [el.x + px, el.y + py]);
4359
+ let svg3;
4360
+ if (points.length > 2) {
4361
+ const drawable = gen.curve(absolutePoints, opts);
4362
+ svg3 = drawableToSvg(drawable);
4363
+ } else {
4364
+ const drawable = gen.linearPath(absolutePoints, opts);
4365
+ svg3 = drawableToSvg(drawable);
4366
+ }
4367
+ if (el.type === "arrow") {
4368
+ svg3 += renderArrowheads(el, absolutePoints);
4369
+ }
4370
+ return svg3;
4371
+ }
4372
+ function renderArrowheads(el, points) {
4373
+ let svg3 = "";
4374
+ const color = el.strokeColor === "transparent" ? "none" : el.strokeColor;
4375
+ if (el.endArrowhead && el.endArrowhead !== "none" && points.length >= 2) {
4376
+ const tip = points[points.length - 1];
4377
+ const prev = points[points.length - 2];
4378
+ svg3 += renderArrowhead(prev, tip, color, el.strokeWidth);
4379
+ }
4380
+ if (el.startArrowhead && el.startArrowhead !== "none" && points.length >= 2) {
4381
+ const tip = points[0];
4382
+ const prev = points[1];
4383
+ svg3 += renderArrowhead(prev, tip, color, el.strokeWidth);
4384
+ }
4385
+ return svg3;
4386
+ }
4387
+ function renderArrowhead(from, to, color, strokeWidth) {
4388
+ const angle = Math.atan2(to[1] - from[1], to[0] - from[0]);
4389
+ const headLen = 10 + strokeWidth * 2;
4390
+ const headAngle = Math.PI / 6;
4391
+ const x1 = to[0] - headLen * Math.cos(angle - headAngle);
4392
+ const y1 = to[1] - headLen * Math.sin(angle - headAngle);
4393
+ const x22 = to[0] - headLen * Math.cos(angle + headAngle);
4394
+ const y22 = to[1] - headLen * Math.sin(angle + headAngle);
4395
+ return `<path d="M${x1.toFixed(2)} ${y1.toFixed(2)} L${to[0].toFixed(2)} ${to[1].toFixed(2)} L${x22.toFixed(2)} ${y22.toFixed(2)}" fill="none" stroke="${escapeAttr(color)}" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round" />`;
4396
+ }
4397
+ function renderText(el) {
4398
+ if (!el.text) return "";
4399
+ const fontFamily = FONT_FAMILIES[el.fontFamily ?? 1] ?? "Virgil, Segoe UI Emoji, sans-serif";
4400
+ const fontSize = el.fontSize ?? 20;
4401
+ const textAnchor = mapTextAlign(el.textAlign);
4402
+ const color = el.strokeColor === "transparent" ? "var(--excalidraw-fg, #000000)" : themeColor(el.strokeColor);
4403
+ const lines = el.text.split("\n");
4404
+ const lineHeight = fontSize * 1.25;
4405
+ const totalHeight = lines.length * lineHeight;
4406
+ let startY = el.y;
4407
+ if (el.verticalAlign === "middle") {
4408
+ startY = el.y + (el.height - totalHeight) / 2;
4409
+ } else if (el.verticalAlign === "bottom") {
4410
+ startY = el.y + el.height - totalHeight;
4411
+ }
4412
+ let textX = el.x;
4413
+ if (el.textAlign === "center") {
4414
+ textX = el.x + el.width / 2;
4415
+ } else if (el.textAlign === "right") {
4416
+ textX = el.x + el.width;
4417
+ }
4418
+ const tspans = lines.map((line, i4) => {
4419
+ const y4 = startY + fontSize + i4 * lineHeight;
4420
+ return `<tspan x="${textX.toFixed(2)}" y="${y4.toFixed(2)}">${escapeXml(line)}</tspan>`;
4421
+ }).join("");
4422
+ return `<text font-family="${escapeAttr(fontFamily)}" font-size="${fontSize}" fill="${escapeAttr(color)}" text-anchor="${textAnchor}" dominant-baseline="auto">${tspans}</text>`;
4423
+ }
4424
+ function mapTextAlign(align) {
4425
+ switch (align) {
4426
+ case "center":
4427
+ return "middle";
4428
+ case "right":
4429
+ return "end";
4430
+ default:
4431
+ return "start";
4432
+ }
4433
+ }
4434
+ function renderFreedraw(el) {
4435
+ const points = el.points ?? [];
4436
+ if (points.length < 2) return "";
4437
+ const absolutePoints = points.map(
4438
+ ([px, py]) => [el.x + px, el.y + py, 0.5]
4439
+ );
4440
+ const strokePoints = R2(absolutePoints, {
4441
+ size: el.strokeWidth * 4.5,
4442
+ thinning: 0.6,
4443
+ smoothing: 0.5,
4444
+ streamline: 0.5,
4445
+ simulatePressure: el.simulatePressure ?? true
4446
+ });
4447
+ if (strokePoints.length < 2) return "";
4448
+ const d4 = getSvgPathFromStroke(strokePoints);
4449
+ const color = el.strokeColor === "transparent" ? "var(--excalidraw-fg, #000000)" : themeColor(el.strokeColor);
4450
+ return `<path d="${d4}" fill="${escapeAttr(color)}" stroke="none" />`;
4451
+ }
4452
+ function getSvgPathFromStroke(points) {
4453
+ if (points.length < 2) return "";
4454
+ const first = points[0];
4455
+ let d4 = `M${first[0].toFixed(2)} ${first[1].toFixed(2)}`;
4456
+ for (let i4 = 1; i4 < points.length - 1; i4++) {
4457
+ const curr = points[i4];
4458
+ const next = points[i4 + 1];
4459
+ const mx = (curr[0] + next[0]) / 2;
4460
+ const my = (curr[1] + next[1]) / 2;
4461
+ d4 += ` Q${curr[0].toFixed(2)} ${curr[1].toFixed(2)} ${mx.toFixed(2)} ${my.toFixed(2)}`;
4462
+ }
4463
+ d4 += " Z";
4464
+ return d4;
4465
+ }
4466
+ function renderImage(el, data, ctx) {
4467
+ if (!el.fileId) return "";
4468
+ const file = data.files[el.fileId];
4469
+ if (file?.dataURL) {
4470
+ return `<image x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" href="${escapeAttr(file.dataURL)}" preserveAspectRatio="xMidYMid meet" />`;
4471
+ }
4472
+ const resolvedUrl = ctx?.resolvedImages?.[el.fileId];
4473
+ if (resolvedUrl) {
4474
+ return `<image x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" href="${escapeAttr(resolvedUrl)}" preserveAspectRatio="xMidYMid meet" />`;
4475
+ }
4476
+ return "";
4477
+ }
4478
+ function renderFrame(el) {
4479
+ return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" fill="none" stroke="#aaaaaa" stroke-width="1" stroke-dasharray="5 5" />`;
4480
+ }
4481
+ function renderEmbeddable(el) {
4482
+ return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" fill="var(--excalidraw-bg, #f8f9fa)" stroke="var(--excalidraw-color-ced4da, #dee2e6)" stroke-width="2" rx="8" ry="8" data-embed-id="${el.id}" />`;
4483
+ }
4484
+ function drawableToSvg(drawable) {
4485
+ const paths = [];
4486
+ for (const set of drawable.sets) {
4487
+ const d4 = opsToPath(set.ops);
4488
+ if (!d4) continue;
4489
+ if (set.type === "path") {
4490
+ paths.push(
4491
+ `<path d="${d4}" stroke="${escapeAttr(drawable.options.stroke ?? "none")}" stroke-width="${drawable.options.strokeWidth ?? 1}" fill="none"${strokeDashAttr(drawable.options.strokeLineDash)} />`
4492
+ );
4493
+ } else if (set.type === "fillPath") {
4494
+ paths.push(
4495
+ `<path d="${d4}" fill="${escapeAttr(drawable.options.fill ?? "none")}" stroke="none" />`
4496
+ );
4497
+ } else if (set.type === "fillSketch") {
4498
+ paths.push(
4499
+ `<path d="${d4}" stroke="${escapeAttr(drawable.options.fill ?? "none")}" stroke-width="${(drawable.options.fillWeight ?? drawable.options.strokeWidth ?? 1) * 0.5}" fill="none" />`
4500
+ );
4501
+ }
4502
+ }
4503
+ return paths.join("\n");
4504
+ }
4505
+ function strokeDashAttr(dash2) {
4506
+ if (!dash2 || dash2.length === 0) return "";
4507
+ return ` stroke-dasharray="${dash2.join(" ")}"`;
4508
+ }
4509
+ function opsToPath(ops) {
4510
+ let d4 = "";
4511
+ for (const item of ops) {
4512
+ const p5 = item.data;
4513
+ switch (item.op) {
4514
+ case "move":
4515
+ d4 += `M${p5[0].toFixed(2)} ${p5[1].toFixed(2)} `;
4516
+ break;
4517
+ case "lineTo":
4518
+ d4 += `L${p5[0].toFixed(2)} ${p5[1].toFixed(2)} `;
4519
+ break;
4520
+ case "bcurveTo":
4521
+ d4 += `C${p5[0].toFixed(2)} ${p5[1].toFixed(2)},${p5[2].toFixed(2)} ${p5[3].toFixed(2)},${p5[4].toFixed(2)} ${p5[5].toFixed(2)} `;
4522
+ break;
4523
+ }
4524
+ }
4525
+ return d4.trim();
4526
+ }
4527
+ function computeBoundingBox(elements) {
4528
+ let minX = Infinity;
4529
+ let minY = Infinity;
4530
+ let maxX = -Infinity;
4531
+ let maxY = -Infinity;
4532
+ for (const el of elements) {
4533
+ const corners = getElementCorners(el);
4534
+ for (const [cx, cy] of corners) {
4535
+ if (cx < minX) minX = cx;
4536
+ if (cy < minY) minY = cy;
4537
+ if (cx > maxX) maxX = cx;
4538
+ if (cy > maxY) maxY = cy;
4539
+ }
4540
+ }
4541
+ if (!isFinite(minX)) {
4542
+ return { minX: 0, minY: 0, maxX: 100, maxY: 100, width: 100, height: 100 };
4543
+ }
4544
+ return { minX, minY, maxX, maxY, width: maxX - minX, height: maxY - minY };
4545
+ }
4546
+ function getElementCorners(el) {
4547
+ if ((el.type === "line" || el.type === "arrow" || el.type === "freedraw") && el.points) {
4548
+ return el.points.map(([px, py]) => [el.x + px, el.y + py]);
4549
+ }
4550
+ const corners = [
4551
+ [el.x, el.y],
4552
+ [el.x + el.width, el.y],
4553
+ [el.x + el.width, el.y + el.height],
4554
+ [el.x, el.y + el.height]
4555
+ ];
4556
+ if (el.angle && el.angle !== 0) {
4557
+ const cx = el.x + el.width / 2;
4558
+ const cy = el.y + el.height / 2;
4559
+ return corners.map(([x4, y4]) => rotatePoint(x4, y4, cx, cy, el.angle));
4560
+ }
4561
+ return corners;
4562
+ }
4563
+ function rotatePoint(x4, y4, cx, cy, angle) {
4564
+ const cos = Math.cos(angle);
4565
+ const sin = Math.sin(angle);
4566
+ const dx = x4 - cx;
4567
+ const dy = y4 - cy;
4568
+ return [cx + dx * cos - dy * sin, cy + dx * sin + dy * cos];
4569
+ }
4570
+ function getFontDefs() {
4571
+ return `<style>
4572
+ @font-face {
4573
+ font-family: "Virgil";
4574
+ src: url("https://unpkg.com/@excalidraw/excalidraw@0.17.0/dist/prod/Virgil-Regular-hO16.woff2") format("woff2");
4575
+ }
4576
+ </style>`;
4577
+ }
4578
+ function escapeXml(str) {
4579
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4580
+ }
4581
+ function escapeAttr(str) {
4582
+ return str.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4583
+ }
4584
+
4585
+ // src/components/styles/excalidraw.scss
4586
+ var excalidraw_default = '.excalidraw-page {\n position: relative;\n width: 100%;\n height: 100%;\n max-width: none;\n margin: 0;\n overflow: hidden;\n user-select: none;\n background-color: var(--light);\n}\n\n.excalidraw-container {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: grab;\n touch-action: none;\n background-color: var(--light);\n}\n.excalidraw-container:active {\n cursor: grabbing;\n}\n.excalidraw-container svg {\n width: 100%;\n height: 100%;\n object-fit: contain;\n transform-origin: 0 0;\n}\n\n:root {\n --excalidraw-fg: #1e1e1e;\n --excalidraw-bg: #ffffff;\n --excalidraw-color-1e1e1e: #1e1e1e;\n --excalidraw-color-000000: #000000;\n --excalidraw-color-ffffff: #ffffff;\n --excalidraw-color-343a40: #343a40;\n --excalidraw-color-868e96: #868e96;\n --excalidraw-color-ced4da: #ced4da;\n --excalidraw-color-e9ecef: #e9ecef;\n --excalidraw-color-f8f9fa: #f8f9fa;\n --excalidraw-color-e03131: #e03131;\n --excalidraw-color-fa5252: #fa5252;\n --excalidraw-color-ff8787: #ff8787;\n --excalidraw-color-ffc9c9: #ffc9c9;\n --excalidraw-color-fff5f5: #fff5f5;\n --excalidraw-color-c2255c: #c2255c;\n --excalidraw-color-e64980: #e64980;\n --excalidraw-color-f783ac: #f783ac;\n --excalidraw-color-fcc2d7: #fcc2d7;\n --excalidraw-color-fff0f6: #fff0f6;\n --excalidraw-color-9c36b5: #9c36b5;\n --excalidraw-color-be4bdb: #be4bdb;\n --excalidraw-color-da77f2: #da77f2;\n --excalidraw-color-eebefa: #eebefa;\n --excalidraw-color-f8f0fc: #f8f0fc;\n --excalidraw-color-6741d9: #6741d9;\n --excalidraw-color-7950f2: #7950f2;\n --excalidraw-color-9775fa: #9775fa;\n --excalidraw-color-d0bfff: #d0bfff;\n --excalidraw-color-f3f0ff: #f3f0ff;\n --excalidraw-color-1971c2: #1971c2;\n --excalidraw-color-228be6: #228be6;\n --excalidraw-color-4dabf7: #4dabf7;\n --excalidraw-color-a5d8ff: #a5d8ff;\n --excalidraw-color-e7f5ff: #e7f5ff;\n --excalidraw-color-0c8599: #0c8599;\n --excalidraw-color-15aabf: #15aabf;\n --excalidraw-color-3bc9db: #3bc9db;\n --excalidraw-color-99e9f2: #99e9f2;\n --excalidraw-color-e3fafc: #e3fafc;\n --excalidraw-color-099268: #099268;\n --excalidraw-color-12b886: #12b886;\n --excalidraw-color-38d9a9: #38d9a9;\n --excalidraw-color-96f2d7: #96f2d7;\n --excalidraw-color-e6fcf5: #e6fcf5;\n --excalidraw-color-2f9e44: #2f9e44;\n --excalidraw-color-40c057: #40c057;\n --excalidraw-color-69db7c: #69db7c;\n --excalidraw-color-b2f2bb: #b2f2bb;\n --excalidraw-color-ebfbee: #ebfbee;\n --excalidraw-color-f08c00: #f08c00;\n --excalidraw-color-fab005: #fab005;\n --excalidraw-color-ffd43b: #ffd43b;\n --excalidraw-color-ffec99: #ffec99;\n --excalidraw-color-fff9db: #fff9db;\n --excalidraw-color-e8590c: #e8590c;\n --excalidraw-color-fd7e14: #fd7e14;\n --excalidraw-color-ffa94d: #ffa94d;\n --excalidraw-color-ffd8a8: #ffd8a8;\n --excalidraw-color-fff4e6: #fff4e6;\n --excalidraw-color-846358: #846358;\n --excalidraw-color-a18072: #a18072;\n --excalidraw-color-d2bab0: #d2bab0;\n --excalidraw-color-eaddd7: #eaddd7;\n --excalidraw-color-f8f1ee: #f8f1ee;\n}\n\n:root[saved-theme=dark] {\n --excalidraw-fg: #d3d3d3;\n --excalidraw-bg: #121212;\n --excalidraw-color-1e1e1e: #d3d3d3;\n --excalidraw-color-000000: #ededed;\n --excalidraw-color-ffffff: #121212;\n --excalidraw-color-343a40: #b7bcc1;\n --excalidraw-color-868e96: #6e757c;\n --excalidraw-color-ced4da: #33383d;\n --excalidraw-color-e9ecef: #202325;\n --excalidraw-color-f8f9fa: #161718;\n --excalidraw-color-e03131: #ff8383;\n --excalidraw-color-fa5252: #fa6969;\n --excalidraw-color-ff8787: #b44d4d;\n --excalidraw-color-ffc9c9: #5a2c2c;\n --excalidraw-color-fff5f5: #1f1717;\n --excalidraw-color-c2255c: #ff8dbc;\n --excalidraw-color-e64980: #f56e9d;\n --excalidraw-color-f783ac: #b04d70;\n --excalidraw-color-fcc2d7: #602e40;\n --excalidraw-color-fff0f6: #26191e;\n --excalidraw-color-9c36b5: #e28af8;\n --excalidraw-color-be4bdb: #d471ed;\n --excalidraw-color-da77f2: #a954be;\n --excalidraw-color-eebefa: #5b3165;\n --excalidraw-color-f8f0fc: #211a25;\n --excalidraw-color-6741d9: #b595ff;\n --excalidraw-color-7950f2: #a885ff;\n --excalidraw-color-9775fa: #8a6cdf;\n --excalidraw-color-d0bfff: #4a3b72;\n --excalidraw-color-f3f0ff: #1f1c29;\n --excalidraw-color-1971c2: #56a2e8;\n --excalidraw-color-228be6: #3791e0;\n --excalidraw-color-4dabf7: #2273b4;\n --excalidraw-color-a5d8ff: #154162;\n --excalidraw-color-e7f5ff: #121e26;\n --excalidraw-color-0c8599: #3da5b6;\n --excalidraw-color-15aabf: #0f8fa1;\n --excalidraw-color-3bc9db: #007281;\n --excalidraw-color-99e9f2: #004149;\n --excalidraw-color-e3fafc: #0a1e20;\n --excalidraw-color-099268: #32a783;\n --excalidraw-color-12b886: #039267;\n --excalidraw-color-38d9a9: #00744b;\n --excalidraw-color-96f2d7: #00422b;\n --excalidraw-color-e6fcf5: #0a1d17;\n --excalidraw-color-2f9e44: #39994b;\n --excalidraw-color-40c057: #16842a;\n --excalidraw-color-69db7c: #056715;\n --excalidraw-color-b2f2bb: #043b0c;\n --excalidraw-color-ebfbee: #0f1d12;\n --excalidraw-color-f08c00: #b86200;\n --excalidraw-color-fab005: #905000;\n --excalidraw-color-ffd43b: #5f3a00;\n --excalidraw-color-ffec99: #362600;\n --excalidraw-color-fff9db: #1e1900;\n --excalidraw-color-e8590c: #f17634;\n --excalidraw-color-fd7e14: #cd6005;\n --excalidraw-color-ffa94d: #924800;\n --excalidraw-color-ffd8a8: #4c2b01;\n --excalidraw-color-fff4e6: #22190d;\n --excalidraw-color-846358: #a98d84;\n --excalidraw-color-a18072: #917569;\n --excalidraw-color-d2bab0: #5a463d;\n --excalidraw-color-eaddd7: #362b26;\n --excalidraw-color-f8f1ee: #221c1a;\n}\n\n.excalidraw-controls {\n position: fixed;\n bottom: 1rem;\n right: 1rem;\n z-index: 10;\n display: flex;\n flex-direction: row;\n gap: 0.25rem;\n}\n.excalidraw-controls button {\n width: 2rem;\n height: 2rem;\n border: 1px solid var(--lightgray);\n border-radius: 6px;\n background: var(--light);\n color: var(--darkgray);\n font-size: 1.2rem;\n line-height: 1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 0.1s ease;\n}\n.excalidraw-controls button:hover {\n background: var(--lightgray);\n}\n\n.page[data-frame=excalidraw] {\n --excalidraw-sidebar-width: 300px;\n}\n\n.page[data-frame=excalidraw] .excalidraw-frame {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n padding-left: 0;\n transition: padding-left 0.2s ease;\n}\n\n.page[data-frame=excalidraw] .excalidraw-stage {\n width: 100%;\n height: 100%;\n}\n\n.page[data-frame=excalidraw] .excalidraw-sidebar {\n position: fixed;\n top: 0;\n height: 100vh;\n width: var(--excalidraw-sidebar-width);\n box-sizing: border-box;\n background: var(--light);\n border-right: 1px solid var(--lightgray);\n box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);\n overflow-y: hidden;\n left: calc(-1 * var(--excalidraw-sidebar-width));\n transition: left 0.25s ease;\n z-index: 20;\n}\n\n.page[data-frame=excalidraw] .excalidraw-sidebar-toggle {\n position: fixed;\n top: 12px;\n left: 12px;\n width: 32px;\n height: 32px;\n border: 1px solid var(--lightgray);\n border-radius: 6px;\n background: var(--light);\n color: var(--darkgray);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 30;\n transition: background 0.1s ease, left 0.25s ease;\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar-toggle:hover {\n background: var(--lightgray);\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar-toggle svg {\n pointer-events: none;\n}\n\n.page[data-frame=excalidraw] .excalidraw-sidebar-icon-close {\n display: none;\n}\n\n.page[data-frame=excalidraw].excalidraw-sidebar-open .excalidraw-frame {\n padding-left: var(--excalidraw-sidebar-width);\n}\n\n.page[data-frame=excalidraw].excalidraw-sidebar-open .excalidraw-sidebar {\n left: 0;\n}\n\n.page[data-frame=excalidraw].excalidraw-sidebar-open .excalidraw-sidebar-toggle {\n left: calc(var(--excalidraw-sidebar-width) + 12px);\n}\n\n.page[data-frame=excalidraw].excalidraw-sidebar-open .excalidraw-sidebar-icon-open {\n display: none;\n}\n\n.page[data-frame=excalidraw].excalidraw-sidebar-open .excalidraw-sidebar-icon-close {\n display: block;\n}\n\n@media (max-width: 800px) {\n .page[data-frame=excalidraw] {\n --excalidraw-sidebar-width: calc(100vw - 56px);\n }\n .page[data-frame=excalidraw].excalidraw-sidebar-open .excalidraw-frame {\n padding-left: 0;\n }\n .page[data-frame=excalidraw].excalidraw-sidebar-open .excalidraw-sidebar-toggle {\n left: calc(var(--excalidraw-sidebar-width) + 12px);\n }\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar {\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar .spacer {\n display: none;\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar .explorer button.desktop-explorer,\n.page[data-frame=excalidraw] .excalidraw-sidebar .explorer button.mobile-explorer {\n display: none !important;\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar .explorer {\n order: initial;\n overflow-y: hidden;\n overflow: hidden;\n flex: 1 1 0;\n min-height: 0;\n flex-shrink: initial;\n align-self: initial;\n margin-top: 0;\n margin-bottom: 0;\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar .explorer .explorer-content,\n.page[data-frame=excalidraw] .excalidraw-sidebar .explorer.collapsed > .explorer-content,\n.page[data-frame=excalidraw] .excalidraw-sidebar .explorer:not(.collapsed) > .explorer-content {\n position: static;\n width: auto;\n max-width: none;\n height: 100%;\n max-height: 100%;\n transform: none !important;\n visibility: visible !important;\n padding: 0;\n overflow-y: auto;\n z-index: auto;\n background-color: transparent;\n}\n.page[data-frame=excalidraw] .excalidraw-sidebar .explorer-content > .explorer-ul {\n overscroll-behavior: auto;\n}\n\n.excalidraw-overlays {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.excalidraw-overlay {\n position: absolute;\n display: none;\n flex-direction: column;\n pointer-events: auto;\n cursor: default;\n user-select: text;\n}\n\n.excalidraw-embed-note,\n.excalidraw-embed-url {\n width: 100%;\n height: 100%;\n overflow: hidden;\n border-radius: 8px;\n border: 2px solid var(--lightgray);\n display: flex;\n flex-direction: column;\n background: var(--light);\n box-sizing: border-box;\n}\n\n.excalidraw-embed-header {\n padding: 8px 12px;\n border-bottom: 1px solid var(--lightgray);\n font-size: 13px;\n font-family: var(--bodyFont, sans-serif);\n color: var(--darkgray);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 0;\n}\n.excalidraw-embed-header a {\n color: var(--darkgray);\n text-decoration: none;\n}\n\n.excalidraw-embed-content {\n flex: 1;\n overflow: auto;\n padding: 8px 12px;\n font-family: var(--bodyFont, sans-serif);\n font-size: 12px;\n line-height: 1.5;\n color: var(--darkgray);\n background: var(--light);\n}\n\n.excalidraw-embed-open-link {\n display: block;\n padding: 4px 0;\n color: var(--secondary);\n font-size: 12px;\n text-decoration: none;\n font-family: var(--bodyFont, sans-serif);\n}\n\n.excalidraw-embed-body {\n font-size: 12px;\n line-height: 1.5;\n color: var(--dark);\n}\n.excalidraw-embed-body h1 {\n font-size: 1.6em;\n margin: 0.5em 0 0.25em;\n}\n.excalidraw-embed-body h2 {\n font-size: 1.4em;\n margin: 0.5em 0 0.25em;\n}\n.excalidraw-embed-body h3 {\n font-size: 1.2em;\n margin: 0.4em 0 0.2em;\n}\n.excalidraw-embed-body h4 {\n font-size: 1.1em;\n margin: 0.4em 0 0.2em;\n}\n.excalidraw-embed-body h5 {\n font-size: 1.05em;\n margin: 0.3em 0 0.15em;\n}\n.excalidraw-embed-body h6 {\n font-size: 1em;\n margin: 0.3em 0 0.15em;\n}\n.excalidraw-embed-body h1[id] > a[href^="#"],\n.excalidraw-embed-body h2[id] > a[href^="#"],\n.excalidraw-embed-body h3[id] > a[href^="#"],\n.excalidraw-embed-body h4[id] > a[href^="#"],\n.excalidraw-embed-body h5[id] > a[href^="#"],\n.excalidraw-embed-body h6[id] > a[href^="#"] {\n display: none;\n}\n\n.excalidraw-embed-missing {\n color: var(--gray);\n font-size: 12px;\n}\n\n.excalidraw-embed-iframe {\n flex: 1;\n width: 100%;\n border: none;\n}\n\n.transclude .excalidraw-page {\n height: auto;\n}\n.transclude .excalidraw-container {\n height: auto;\n min-height: 400px;\n}\n.transclude .excalidraw-controls {\n position: absolute;\n}\n\n.popover-inner .excalidraw-page {\n height: auto;\n}\n.popover-inner .excalidraw-container {\n height: auto;\n min-height: 200px;\n max-height: 300px;\n}\n.popover-inner .excalidraw-controls {\n display: none;\n}';
4587
+
4588
+ // src/components/scripts/excalidraw.inline.ts
4589
+ var excalidraw_inline_default = `function B(){let n=document.querySelector(".page[data-frame='excalidraw']");if(n){N(n),q(n);return}let t=document.querySelectorAll(".excalidraw-page");for(let v of t)q(v)}function N(n){let t=n.querySelector(".excalidraw-sidebar-toggle");t&&(t.addEventListener("click",()=>{n.classList.toggle("excalidraw-sidebar-open")}),window.addCleanup(()=>{n.classList.remove("excalidraw-sidebar-open")}))}function q(n){let t=n.querySelector(".excalidraw-container");if(!t)return;let v=t.querySelector("svg");if(!v)return;t.style.backgroundColor="var(--excalidraw-bg, var(--light))";var h=n.querySelector(".excalidraw-overlays");let a=1,u=0,d=0,c=!1,m=0,M=0;function O(){if(h){var e=h.querySelectorAll(".excalidraw-overlay");if(e.length!==0){var o=parseFloat(h.getAttribute("data-offset-x"))||0,l=parseFloat(h.getAttribute("data-offset-y"))||0,r=v.getScreenCTM(),g=t.getBoundingClientRect();if(r)for(var p=0;p<e.length;p++){var i=e[p],A=parseFloat(i.getAttribute("data-x"))||0,Y=parseFloat(i.getAttribute("data-y"))||0,T=parseFloat(i.getAttribute("data-w"))||0,P=parseFloat(i.getAttribute("data-h"))||0,C=A+o,F=Y+l,k=C*r.a+r.e-g.left,z=F*r.d+r.f-g.top,D=T*r.a,I=P*r.d;i.style.left=k+"px",i.style.top=z+"px",i.style.width=D+"px",i.style.height=I+"px",i.style.display="flex"}}}}O();function s(){v.style.transform="translate("+u+"px, "+d+"px) scale("+a+")",O()}function y(e){e.preventDefault();var o=e.deltaY>0?-.15:.15;a=Math.max(.1,Math.min(5,a+o)),s()}function E(e){e.button===0&&(c=!0,m=e.clientX-u,M=e.clientY-d,t.style.cursor="grabbing")}function w(e){c&&(u=e.clientX-m,d=e.clientY-M,s())}function x(){c=!1,t.style.cursor="grab"}var L=n.querySelector(".excalidraw-zoom-in"),S=n.querySelector(".excalidraw-zoom-out"),b=n.querySelector(".excalidraw-reset");L&&L.addEventListener("click",function(){a=Math.min(5,a+.15),s()}),S&&S.addEventListener("click",function(){a=Math.max(.1,a-.15),s()}),b&&b.addEventListener("click",function(){a=1,u=0,d=0,s()});var f=0;function X(e){if(e.touches.length===1)c=!0,m=e.touches[0].clientX-u,M=e.touches[0].clientY-d;else if(e.touches.length===2){c=!1;var o=e.touches[0].clientX-e.touches[1].clientX,l=e.touches[0].clientY-e.touches[1].clientY;f=Math.sqrt(o*o+l*l)}}function Z(e){if(e.preventDefault(),e.touches.length===1&&c)u=e.touches[0].clientX-m,d=e.touches[0].clientY-M,s();else if(e.touches.length===2&&f>0){var o=e.touches[0].clientX-e.touches[1].clientX,l=e.touches[0].clientY-e.touches[1].clientY,r=Math.sqrt(o*o+l*l),g=r/f;a=Math.max(.1,Math.min(5,a*g)),f=r,s()}}function _(){c=!1,f=0}t.addEventListener("wheel",y,{passive:!1}),t.addEventListener("mousedown",E),document.addEventListener("mousemove",w),document.addEventListener("mouseup",x),t.addEventListener("touchstart",X,{passive:!0}),t.addEventListener("touchmove",Z,{passive:!1}),t.addEventListener("touchend",_),window.addCleanup(function(){t.removeEventListener("wheel",y),t.removeEventListener("mousedown",E),document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",x),t.removeEventListener("touchstart",X),t.removeEventListener("touchmove",Z),t.removeEventListener("touchend",_)})}document.addEventListener("nav",B);
4590
+ `;
4591
+ var l3;
4592
+ l3 = { __e: function(n4, l4, u5, t4) {
4593
+ for (var i4, o4, r4; l4 = l4.__; ) if ((i4 = l4.__c) && !i4.__) try {
4594
+ if ((o4 = i4.constructor) && null != o4.getDerivedStateFromError && (i4.setState(o4.getDerivedStateFromError(n4)), r4 = i4.__d), null != i4.componentDidCatch && (i4.componentDidCatch(n4, t4 || {}), r4 = i4.__d), r4) return i4.__E = i4;
4595
+ } catch (l5) {
4596
+ n4 = l5;
4597
+ }
4598
+ throw n4;
4599
+ } }, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout;
4600
+
4601
+ // node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
4602
+ var f4 = 0;
4603
+ function u4(e4, t4, n4, o4, i4, u5) {
4604
+ t4 || (t4 = {});
4605
+ var a4, c4, p5 = t4;
4606
+ if ("ref" in p5) for (c4 in p5 = {}, t4) "ref" == c4 ? a4 = t4[c4] : p5[c4] = t4[c4];
4607
+ var l4 = { type: e4, props: p5, key: n4, ref: a4, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f4, __i: -1, __u: 0, __source: i4, __self: u5 };
4608
+ if ("function" == typeof e4 && (a4 = e4.defaultProps)) for (c4 in a4) void 0 === p5[c4] && (p5[c4] = a4[c4]);
4609
+ return l3.vnode && l3.vnode(l4), l4;
4610
+ }
4611
+
4612
+ // src/components/ExcalidrawBody.tsx
4613
+ function stripTranscludes(html5) {
4614
+ return html5.replace(/<blockquote[^>]*class="[^"]*transclude[^"]*"[^>]*>[\s\S]*?<\/blockquote>/gi, "").replace(/<div[^>]*class="[^"]*transclude[^"]*"[^>]*>[\s\S]*?<\/div>/gi, "");
4615
+ }
4616
+ function resolveEmbeds(data, currentSlug, allFiles) {
4617
+ const result = {};
4618
+ const embeddables = data.elements.filter(
4619
+ (el) => el.type === "embeddable" || el.type === "iframe"
4620
+ );
4621
+ for (const el of embeddables) {
4622
+ const link = el.link ?? "";
4623
+ if (!link.startsWith("[[")) continue;
4624
+ const target = link.replace(/^\[\[/, "").replace(/\]\]$/, "");
4625
+ const targetLower = target.toLowerCase();
4626
+ const page = allFiles.find((f5) => {
4627
+ if (!f5.slug) return false;
4628
+ if (f5.slug === targetLower) return true;
4629
+ const lastSegment = f5.slug.split("/").pop();
4630
+ return lastSegment === targetLower;
4631
+ });
4632
+ const pageSlug = page?.slug ?? slugifyFilePath(target);
4633
+ const href = resolveRelative(currentSlug, pageSlug);
4634
+ if (!page || !page.htmlAst) {
4635
+ result[el.id] = {
4636
+ html: `<a href="${href}" style="color:#228be6;text-decoration:none;font-size:13px;">${target}</a>`,
4637
+ href
4638
+ };
4639
+ continue;
4640
+ }
4641
+ const tree = page.htmlAst;
4642
+ const rebased = {
4643
+ ...tree,
4644
+ children: tree.children.map((child) => {
4645
+ if (child.type === "element") {
4646
+ return normalizeHastElement(
4647
+ child,
4648
+ currentSlug,
4649
+ pageSlug
4650
+ );
4651
+ }
4652
+ return child;
4653
+ })
4654
+ };
4655
+ let html5 = toHtml(rebased, { allowDangerousHtml: true });
4656
+ html5 = stripTranscludes(html5);
4657
+ result[el.id] = { html: html5, href };
4658
+ }
4659
+ return result;
4660
+ }
4661
+ function resolveImages(imagePaths, currentSlug) {
4662
+ const result = {};
4663
+ for (const [hash, filePath] of Object.entries(imagePaths)) {
4664
+ const imageSlug = slugifyFilePath(filePath);
4665
+ result[hash] = resolveRelative(currentSlug, imageSlug);
4666
+ }
4667
+ return result;
4668
+ }
4669
+ function renderOverlay(overlay) {
4670
+ const label = overlay.link.replace(/^\[\[/, "").replace(/\]\]$/, "").replace(/^https?:\/\//, "");
4671
+ const truncatedLabel = label.length > 50 ? label.slice(0, 47) + "..." : label;
4672
+ if (overlay.isWikilink) {
4673
+ const noteContent = overlay.resolved ? `<a href="${overlay.resolved.href}" class="excalidraw-embed-open-link">Open note \u2192</a><div class="excalidraw-embed-body">${overlay.resolved.html}</div>` : `<span class="excalidraw-embed-missing">Note not found</span>`;
4674
+ return /* @__PURE__ */ u4(
4675
+ "div",
4676
+ {
4677
+ class: "excalidraw-overlay excalidraw-embed-note",
4678
+ "data-overlay-id": overlay.id,
4679
+ "data-x": overlay.x,
4680
+ "data-y": overlay.y,
4681
+ "data-w": overlay.width,
4682
+ "data-h": overlay.height,
4683
+ children: [
4684
+ /* @__PURE__ */ u4("div", { class: "excalidraw-embed-header", children: "\u{1F4C4} " + truncatedLabel }),
4685
+ /* @__PURE__ */ u4("div", { class: "excalidraw-embed-content", dangerouslySetInnerHTML: { __html: noteContent } })
4686
+ ]
4687
+ }
4688
+ );
4689
+ }
4690
+ return /* @__PURE__ */ u4(
4691
+ "div",
4692
+ {
4693
+ class: "excalidraw-overlay excalidraw-embed-url",
4694
+ "data-overlay-id": overlay.id,
4695
+ "data-x": overlay.x,
4696
+ "data-y": overlay.y,
4697
+ "data-w": overlay.width,
4698
+ "data-h": overlay.height,
4699
+ children: [
4700
+ /* @__PURE__ */ u4("div", { class: "excalidraw-embed-header", children: /* @__PURE__ */ u4("a", { href: overlay.link, target: "_blank", rel: "noopener noreferrer", children: "\u{1F517} " + truncatedLabel }) }),
4701
+ /* @__PURE__ */ u4(
4702
+ "iframe",
4703
+ {
4704
+ src: overlay.link,
4705
+ class: "excalidraw-embed-iframe",
4706
+ sandbox: "allow-scripts allow-same-origin allow-popups",
4707
+ loading: "lazy",
4708
+ referrerpolicy: "no-referrer"
4709
+ }
4710
+ )
4711
+ ]
4712
+ }
4713
+ );
4714
+ }
4715
+ var ExcalidrawBody_default = ((userOpts) => {
4716
+ const Component = (props) => {
4717
+ const { fileData, allFiles } = props;
4718
+ const data = fileData.excalidrawData;
4719
+ const options = fileData.excalidrawOptions ?? userOpts ?? {};
4720
+ const currentSlug = fileData.slug;
4721
+ const resolvedEmbedMap = allFiles ? resolveEmbeds(data, currentSlug, allFiles) : void 0;
4722
+ const imagePaths = fileData.excalidrawImagePaths ?? {};
4723
+ const resolvedImageMap = resolveImages(imagePaths, currentSlug);
4724
+ const renderCtx = {
4725
+ resolvedEmbeds: resolvedEmbedMap,
4726
+ resolvedImages: resolvedImageMap
4727
+ };
4728
+ const result = renderToSvg(data, options, renderCtx);
4729
+ return /* @__PURE__ */ u4(
4730
+ "article",
4731
+ {
4732
+ class: "excalidraw-page",
4733
+ role: "img",
4734
+ "aria-label": fileData.frontmatter?.title ?? "Excalidraw drawing",
4735
+ children: [
4736
+ /* @__PURE__ */ u4("div", { class: "excalidraw-controls", children: [
4737
+ /* @__PURE__ */ u4("button", { class: "excalidraw-zoom-in", type: "button", "aria-label": "Zoom in", children: "+" }),
4738
+ /* @__PURE__ */ u4("button", { class: "excalidraw-zoom-out", type: "button", "aria-label": "Zoom out", children: "\u2212" }),
4739
+ /* @__PURE__ */ u4("button", { class: "excalidraw-reset", type: "button", "aria-label": "Reset view", children: "\u27F2" })
4740
+ ] }),
4741
+ /* @__PURE__ */ u4("div", { class: "excalidraw-container", dangerouslySetInnerHTML: { __html: result.svg } }),
4742
+ /* @__PURE__ */ u4(
4743
+ "div",
4744
+ {
4745
+ class: "excalidraw-overlays",
4746
+ "data-viewbox-w": result.viewBox.width,
4747
+ "data-viewbox-h": result.viewBox.height,
4748
+ "data-offset-x": result.viewBox.offsetX,
4749
+ "data-offset-y": result.viewBox.offsetY,
4750
+ children: result.overlays.map((o4) => renderOverlay(o4))
4751
+ }
4752
+ ),
4753
+ options.enableInteraction !== false && /* @__PURE__ */ u4(
4754
+ "script",
4755
+ {
4756
+ type: "application/json",
4757
+ class: "excalidraw-data",
4758
+ dangerouslySetInnerHTML: {
4759
+ __html: JSON.stringify({
4760
+ elements: data.elements,
4761
+ appState: data.appState,
4762
+ files: data.files
4763
+ })
4764
+ }
4765
+ }
4766
+ )
4767
+ ]
4768
+ }
4769
+ );
4770
+ };
4771
+ Component.css = excalidraw_default;
4772
+ Component.afterDOMLoaded = excalidraw_inline_default;
4773
+ return Component;
4774
+ });
4775
+
4776
+ // src/pageType.ts
4777
+ var excalidrawMatcher = ({ fileData }) => {
4778
+ return "excalidrawData" in fileData;
4779
+ };
4780
+ var ExcalidrawPage = (opts) => ({
4781
+ name: "ExcalidrawPage",
4782
+ priority: 25,
4783
+ fileExtensions: [".excalidraw.md", ".excalidraw"],
4784
+ match: excalidrawMatcher,
4785
+ generate({ ctx }) {
4786
+ const excalidrawFiles = ctx.allFiles.filter(
4787
+ (fp) => fp.endsWith(".excalidraw.md") || fp.endsWith(".excalidraw")
4788
+ );
4789
+ const imageFiles = ctx.allFiles.filter(
4790
+ (fp) => /\.(png|jpe?g|gif|svg|webp|avif|bmp|ico)$/i.test(fp)
4791
+ );
4792
+ const virtualPages = [];
4793
+ for (const filePath of excalidrawFiles) {
4794
+ const fullPath = join(ctx.argv.directory, filePath);
4795
+ let content;
4796
+ try {
4797
+ content = readFileSync(fullPath, "utf-8");
4798
+ } catch {
4799
+ continue;
4800
+ }
4801
+ const data = parseExcalidraw(content, filePath);
4802
+ if (!data) continue;
4803
+ const resolvedImagePaths = {};
4804
+ if (data.embeddedFiles) {
4805
+ for (const [hash, wikilink] of Object.entries(data.embeddedFiles)) {
4806
+ if (data.files[hash]?.dataURL) continue;
4807
+ const targetName = wikilink.split("/").pop()?.toLowerCase() ?? "";
4808
+ const match = imageFiles.find((fp) => {
4809
+ const fpName = fp.split("/").pop()?.toLowerCase() ?? "";
4810
+ return fpName === targetName;
4811
+ });
4812
+ if (match) {
4813
+ resolvedImagePaths[hash] = match;
4814
+ }
4815
+ }
4816
+ }
4817
+ const baseName = filePath.replace(/\.excalidraw\.md$/, "").replace(/\.excalidraw$/, "").split("/").pop() ?? "Excalidraw Drawing";
4818
+ const slug2 = slugifyFilePath(filePath);
4819
+ virtualPages.push({
4820
+ slug: slug2,
4821
+ title: baseName,
4822
+ data: {
4823
+ frontmatter: { title: baseName, tags: ["excalidraw"] },
4824
+ excalidrawData: data,
4825
+ excalidrawOptions: opts,
4826
+ excalidrawImagePaths: resolvedImagePaths
4827
+ }
4828
+ });
4829
+ }
4830
+ return virtualPages;
4831
+ },
4832
+ shouldPublish(_ctx, content) {
4833
+ const relativePath = content[1].data.relativePath ?? "";
4834
+ if (relativePath.endsWith(".excalidraw.md") || relativePath.endsWith(".excalidraw")) {
4835
+ return false;
4836
+ }
4837
+ return true;
4838
+ },
4839
+ layout: "excalidraw",
4840
+ frame: "excalidraw",
4841
+ body: ExcalidrawBody_default
4842
+ });
4843
+
4844
+ // src/frames/ExcalidrawFrame.tsx
4845
+ var ExcalidrawFrame = {
4846
+ name: "excalidraw",
4847
+ css: `
4848
+ .page[data-frame="excalidraw"] {
4849
+ max-width: none;
4850
+ margin: 0;
4851
+ min-height: 100vh;
4852
+ }
4853
+
4854
+ .page[data-frame="excalidraw"] > #quartz-body {
4855
+ grid-template-columns: auto;
4856
+ grid-template-rows: 1fr;
4857
+ grid-template-areas:
4858
+ "grid-center";
4859
+ height: 100vh;
4860
+ padding: 0;
4861
+ }
4862
+
4863
+ .page[data-frame="excalidraw"] > #quartz-body > .center.excalidraw-frame {
4864
+ max-width: 100%;
4865
+ min-width: 100%;
4866
+ height: 100%;
4867
+ margin: 0;
4868
+ }
4869
+
4870
+ .page[data-frame="excalidraw"] > #quartz-body.lock-scroll > * {
4871
+ transform: none;
4872
+ }
4873
+ `,
4874
+ render({ componentData, pageBody: Content, left }) {
4875
+ const renderSlot = (Component) => Component(componentData);
4876
+ return /* @__PURE__ */ u4("div", { class: "center excalidraw-frame", children: [
4877
+ /* @__PURE__ */ u4("button", { class: "excalidraw-sidebar-toggle", type: "button", "aria-label": "Toggle sidebar", children: [
4878
+ /* @__PURE__ */ u4(
4879
+ "svg",
4880
+ {
4881
+ xmlns: "http://www.w3.org/2000/svg",
4882
+ width: "16",
4883
+ height: "16",
4884
+ viewBox: "0 0 24 24",
4885
+ fill: "none",
4886
+ stroke: "currentColor",
4887
+ "stroke-width": "2",
4888
+ "stroke-linecap": "round",
4889
+ "stroke-linejoin": "round",
4890
+ class: "excalidraw-sidebar-icon-open",
4891
+ children: [
4892
+ /* @__PURE__ */ u4("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
4893
+ /* @__PURE__ */ u4("line", { x1: "3", y1: "12", x2: "21", y2: "12" }),
4894
+ /* @__PURE__ */ u4("line", { x1: "3", y1: "18", x2: "21", y2: "18" })
4895
+ ]
4896
+ }
4897
+ ),
4898
+ /* @__PURE__ */ u4(
4899
+ "svg",
4900
+ {
4901
+ xmlns: "http://www.w3.org/2000/svg",
4902
+ width: "16",
4903
+ height: "16",
4904
+ viewBox: "0 0 24 24",
4905
+ fill: "none",
4906
+ stroke: "currentColor",
4907
+ "stroke-width": "2",
4908
+ "stroke-linecap": "round",
4909
+ "stroke-linejoin": "round",
4910
+ class: "excalidraw-sidebar-icon-close",
4911
+ children: [
4912
+ /* @__PURE__ */ u4("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
4913
+ /* @__PURE__ */ u4("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
4914
+ ]
4915
+ }
4916
+ )
4917
+ ] }),
4918
+ /* @__PURE__ */ u4("aside", { class: "excalidraw-sidebar", children: left.map((BodyComponent) => renderSlot(BodyComponent)) }),
4919
+ /* @__PURE__ */ u4("div", { class: "excalidraw-stage", children: renderSlot(Content) })
4920
+ ] });
4921
+ }
4922
+ };
4923
+
4924
+ export { ExcalidrawBody_default as ExcalidrawBody, ExcalidrawFrame, ExcalidrawPage };
4925
+ //# sourceMappingURL=index.js.map
4926
+ //# sourceMappingURL=index.js.map