@geektech/tsone 0.0.2 → 0.2.1

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.
@@ -0,0 +1,2181 @@
1
+ // lib/dom/index.ts
2
+ var DomNodeType;
3
+ ((DomNodeType2) => {
4
+ DomNodeType2[DomNodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
5
+ DomNodeType2[DomNodeType2["TEXT_NODE"] = 3] = "TEXT_NODE";
6
+ DomNodeType2[DomNodeType2["COMMENT_NODE"] = 8] = "COMMENT_NODE";
7
+ DomNodeType2[DomNodeType2["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
8
+ DomNodeType2[DomNodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
9
+ })(DomNodeType ||= {});
10
+
11
+ class DOMException extends Error {
12
+ code;
13
+ constructor(message, name = "Error") {
14
+ super(message);
15
+ this.name = name;
16
+ this.code = 0;
17
+ }
18
+ }
19
+
20
+ class EventTarget {
21
+ listenerMap = new Map;
22
+ addEventListener(type, listener, options) {
23
+ if (!listener) {
24
+ return;
25
+ }
26
+ const capture = typeof options === "boolean" ? options : options?.capture ?? false;
27
+ const once = typeof options === "object" ? options.once ?? false : false;
28
+ const passive = typeof options === "object" ? options.passive ?? false : false;
29
+ let entries = this.listenerMap.get(type);
30
+ if (!entries) {
31
+ entries = [];
32
+ this.listenerMap.set(type, entries);
33
+ }
34
+ if (entries.some((entry) => entry.listener === listener && entry.capture === capture)) {
35
+ return;
36
+ }
37
+ entries.push({ listener, capture, once, passive });
38
+ }
39
+ removeEventListener(type, listener, options) {
40
+ if (!listener) {
41
+ return;
42
+ }
43
+ const capture = typeof options === "boolean" ? options : options?.capture ?? false;
44
+ const entries = this.listenerMap.get(type);
45
+ if (!entries) {
46
+ return;
47
+ }
48
+ const index = entries.findIndex((entry) => entry.listener === listener && entry.capture === capture);
49
+ if (index >= 0) {
50
+ entries.splice(index, 1);
51
+ }
52
+ if (entries.length === 0) {
53
+ this.listenerMap.delete(type);
54
+ }
55
+ }
56
+ dispatchEvent(event) {
57
+ if (!(event instanceof Event)) {
58
+ throw new TypeError("dispatchEvent requires an Event instance");
59
+ }
60
+ if (event.dispatched) {
61
+ throw new Error("Event has already been dispatched");
62
+ }
63
+ return dispatchOnTarget(this, event);
64
+ }
65
+ getListeners(type) {
66
+ return this.listenerMap.get(type) ?? [];
67
+ }
68
+ }
69
+
70
+ class Event {
71
+ static NONE = 0;
72
+ static CAPTURING_PHASE = 1;
73
+ static AT_TARGET = 2;
74
+ static BUBBLING_PHASE = 3;
75
+ type;
76
+ bubbles;
77
+ cancelable;
78
+ composed;
79
+ target = null;
80
+ currentTarget = null;
81
+ eventPhase = Event.NONE;
82
+ defaultPrevented = false;
83
+ isTrusted = false;
84
+ timeStamp;
85
+ cancelBubble = false;
86
+ dispatched = false;
87
+ propagationStopped = false;
88
+ immediateStopped = false;
89
+ canceled = false;
90
+ constructor(type, init) {
91
+ this.type = type;
92
+ this.bubbles = init?.bubbles ?? false;
93
+ this.cancelable = init?.cancelable ?? false;
94
+ this.composed = init?.composed ?? false;
95
+ this.timeStamp = Date.now();
96
+ }
97
+ preventDefault() {
98
+ if (this.cancelable) {
99
+ this.canceled = true;
100
+ }
101
+ }
102
+ stopPropagation() {
103
+ this.propagationStopped = true;
104
+ this.cancelBubble = true;
105
+ }
106
+ stopImmediatePropagation() {
107
+ this.propagationStopped = true;
108
+ this.immediateStopped = true;
109
+ this.cancelBubble = true;
110
+ }
111
+ propagationPrevented() {
112
+ return this.propagationStopped;
113
+ }
114
+ immediatePrevented() {
115
+ return this.immediateStopped;
116
+ }
117
+ wasCanceled() {
118
+ return this.canceled;
119
+ }
120
+ }
121
+
122
+ class CustomEvent extends Event {
123
+ detail;
124
+ constructor(type, init) {
125
+ super(type, init);
126
+ this.detail = init?.detail;
127
+ }
128
+ }
129
+
130
+ class MouseEvent extends Event {
131
+ clientX;
132
+ clientY;
133
+ button;
134
+ buttons;
135
+ relatedTarget;
136
+ constructor(type, init) {
137
+ super(type, init);
138
+ this.clientX = init?.clientX ?? 0;
139
+ this.clientY = init?.clientY ?? 0;
140
+ this.button = init?.button ?? 0;
141
+ this.buttons = init?.buttons ?? 0;
142
+ this.relatedTarget = init?.relatedTarget ?? null;
143
+ }
144
+ }
145
+
146
+ class KeyboardEvent extends Event {
147
+ key;
148
+ code;
149
+ constructor(type, init) {
150
+ super(type, init);
151
+ this.key = init?.key ?? "";
152
+ this.code = init?.code ?? "";
153
+ }
154
+ }
155
+ function invokeListener(listener, event) {
156
+ const record = listener.listener;
157
+ if (typeof record === "function") {
158
+ record.call(event.currentTarget, event);
159
+ } else {
160
+ record.handleEvent(event);
161
+ }
162
+ }
163
+ function dispatchOnTarget(target, event) {
164
+ event.dispatched = true;
165
+ event.target = target;
166
+ const chain = buildEventPath(target);
167
+ const capturePath = [...chain].reverse();
168
+ const targetIndex = capturePath.length - 1;
169
+ event.eventPhase = Event.CAPTURING_PHASE;
170
+ for (let index = 0;index < targetIndex; index += 1) {
171
+ const current = capturePath[index];
172
+ if (event.propagationPrevented()) {
173
+ break;
174
+ }
175
+ event.currentTarget = current;
176
+ runListeners(current, event, true);
177
+ }
178
+ if (!event.propagationPrevented()) {
179
+ event.eventPhase = Event.AT_TARGET;
180
+ event.currentTarget = target;
181
+ runListeners(target, event, true);
182
+ if (!event.immediatePrevented()) {
183
+ runListeners(target, event, false);
184
+ }
185
+ }
186
+ if (event.bubbles && !event.propagationPrevented()) {
187
+ event.eventPhase = Event.BUBBLING_PHASE;
188
+ for (let index = capturePath.length - 2;index >= 0; index -= 1) {
189
+ const current = capturePath[index];
190
+ if (event.propagationPrevented()) {
191
+ break;
192
+ }
193
+ event.currentTarget = current;
194
+ runListeners(current, event, false);
195
+ }
196
+ }
197
+ event.eventPhase = Event.NONE;
198
+ event.currentTarget = null;
199
+ return !event.wasCanceled();
200
+ }
201
+ function runListeners(target, event, capture) {
202
+ const listeners = target.getListeners(event.type);
203
+ for (const entry of [...listeners]) {
204
+ if (entry.capture !== capture) {
205
+ continue;
206
+ }
207
+ if (event.immediatePrevented()) {
208
+ break;
209
+ }
210
+ if (entry.once) {
211
+ target.removeEventListener(event.type, entry.listener, {
212
+ capture: entry.capture
213
+ });
214
+ }
215
+ invokeListener(entry, event);
216
+ }
217
+ }
218
+ function buildEventPath(target) {
219
+ const path = [];
220
+ let current = target;
221
+ while (current) {
222
+ path.push(current);
223
+ const node = current;
224
+ if (node.nodeType === 9 /* DOCUMENT_NODE */) {
225
+ const view = node.defaultView;
226
+ if (view) {
227
+ path.push(view);
228
+ }
229
+ break;
230
+ }
231
+ const parent = node.parentNode;
232
+ if (parent) {
233
+ current = parent;
234
+ continue;
235
+ }
236
+ break;
237
+ }
238
+ return path;
239
+ }
240
+
241
+ class DOMTokenList {
242
+ element;
243
+ attributeName;
244
+ constructor(element, attributeName = "class") {
245
+ this.element = element;
246
+ this.attributeName = attributeName;
247
+ }
248
+ get length() {
249
+ return this.tokens().length;
250
+ }
251
+ get value() {
252
+ return this.element.getAttribute(this.attributeName) ?? "";
253
+ }
254
+ set value(value) {
255
+ this.setTokens(splitTokens(value));
256
+ }
257
+ item(index) {
258
+ return this.tokens()[index] ?? null;
259
+ }
260
+ contains(token) {
261
+ return this.tokens().includes(token);
262
+ }
263
+ add(...tokens) {
264
+ const current = new Set(this.tokens());
265
+ for (const token of tokens) {
266
+ if (token) {
267
+ current.add(token);
268
+ }
269
+ }
270
+ this.setTokens([...current]);
271
+ }
272
+ remove(...tokens) {
273
+ const current = new Set(this.tokens());
274
+ for (const token of tokens) {
275
+ current.delete(token);
276
+ }
277
+ this.setTokens([...current]);
278
+ }
279
+ toggle(token, force) {
280
+ const current = new Set(this.tokens());
281
+ const shouldAdd = force ?? !current.has(token);
282
+ if (shouldAdd) {
283
+ current.add(token);
284
+ } else {
285
+ current.delete(token);
286
+ }
287
+ this.setTokens([...current]);
288
+ return shouldAdd;
289
+ }
290
+ replace(oldToken, newToken) {
291
+ const current = this.tokens();
292
+ const index = current.indexOf(oldToken);
293
+ if (index < 0) {
294
+ return false;
295
+ }
296
+ current[index] = newToken;
297
+ this.setTokens(current);
298
+ return true;
299
+ }
300
+ [Symbol.iterator]() {
301
+ return this.tokens()[Symbol.iterator]();
302
+ }
303
+ forEach(callback) {
304
+ this.tokens().forEach((value, index) => callback(value, index, this));
305
+ }
306
+ toString() {
307
+ return this.value;
308
+ }
309
+ tokens() {
310
+ return splitTokens(this.element.getAttribute(this.attributeName) ?? "");
311
+ }
312
+ setTokens(tokens) {
313
+ const value = tokens.filter(Boolean).join(" ");
314
+ if (value) {
315
+ this.element.setAttribute(this.attributeName, value);
316
+ } else {
317
+ this.element.removeAttribute(this.attributeName);
318
+ }
319
+ }
320
+ }
321
+ function splitTokens(value) {
322
+ return value.trim().split(/\s+/).filter(Boolean);
323
+ }
324
+ function normalizeCssProperty(property) {
325
+ return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
326
+ }
327
+ function createStyleDeclaration() {
328
+ const properties = new Map;
329
+ const target = {
330
+ properties,
331
+ setProperty(property, value, priority = "") {
332
+ const name = normalizeCssProperty(property);
333
+ if (value === "") {
334
+ properties.delete(name);
335
+ } else {
336
+ properties.set(name, { value, priority });
337
+ }
338
+ },
339
+ getPropertyValue(property) {
340
+ return properties.get(normalizeCssProperty(property))?.value ?? "";
341
+ },
342
+ getPropertyPriority(property) {
343
+ return properties.get(normalizeCssProperty(property))?.priority ?? "";
344
+ },
345
+ removeProperty(property) {
346
+ const name = normalizeCssProperty(property);
347
+ const previous = properties.get(name)?.value ?? "";
348
+ properties.delete(name);
349
+ return previous;
350
+ },
351
+ item(index) {
352
+ return [...properties.keys()][index] ?? "";
353
+ },
354
+ get length() {
355
+ return properties.size;
356
+ },
357
+ get cssText() {
358
+ return [...properties.entries()].map(([name, entry]) => `${name}: ${entry.value}${entry.priority ? ` ${entry.priority}` : ""};`).join(" ");
359
+ },
360
+ set cssText(value) {
361
+ properties.clear();
362
+ for (const declaration of value.split(";")) {
363
+ const trimmed = declaration.trim();
364
+ if (!trimmed) {
365
+ continue;
366
+ }
367
+ const separator = trimmed.indexOf(":");
368
+ if (separator < 0) {
369
+ continue;
370
+ }
371
+ const name = trimmed.slice(0, separator).trim();
372
+ const propertyValue = trimmed.slice(separator + 1).trim();
373
+ if (name) {
374
+ target.setProperty(name, propertyValue);
375
+ }
376
+ }
377
+ }
378
+ };
379
+ const handler = {
380
+ get(t, property, receiver) {
381
+ if (typeof property === "symbol") {
382
+ return Reflect.get(t, property, receiver);
383
+ }
384
+ if (property in t) {
385
+ const value = Reflect.get(t, property, receiver);
386
+ return typeof value === "function" ? value.bind(t) : value;
387
+ }
388
+ return t.getPropertyValue(property);
389
+ },
390
+ set(t, property, value, receiver) {
391
+ if (typeof property === "symbol") {
392
+ return Reflect.set(t, property, value, receiver);
393
+ }
394
+ if (property in t) {
395
+ return Reflect.set(t, property, value, receiver);
396
+ }
397
+ t.setProperty(property, String(value));
398
+ return true;
399
+ },
400
+ has(t, property) {
401
+ if (typeof property === "symbol") {
402
+ return Reflect.has(t, property);
403
+ }
404
+ if (property in t) {
405
+ return true;
406
+ }
407
+ return t.getPropertyValue(property) !== "";
408
+ },
409
+ ownKeys() {
410
+ return [
411
+ ...Reflect.ownKeys(target),
412
+ ...[...properties.keys()].map((name) => camelCaseProperty(name))
413
+ ];
414
+ },
415
+ getOwnPropertyDescriptor(t, property) {
416
+ if (typeof property === "symbol") {
417
+ return Reflect.getOwnPropertyDescriptor(t, property);
418
+ }
419
+ if (property in t) {
420
+ return Reflect.getOwnPropertyDescriptor(t, property);
421
+ }
422
+ const value = t.getPropertyValue(property);
423
+ if (value !== "") {
424
+ return { configurable: true, enumerable: true, writable: true, value };
425
+ }
426
+ return;
427
+ }
428
+ };
429
+ return new Proxy(target, handler);
430
+ }
431
+ function camelCaseProperty(property) {
432
+ return property.replace(/-([a-z])/g, (_match, char) => char.toUpperCase());
433
+ }
434
+
435
+ class NodeList {
436
+ items;
437
+ constructor(items = []) {
438
+ this.items = items;
439
+ for (let index = 0;index < items.length; index += 1) {
440
+ Object.defineProperty(this, String(index), {
441
+ configurable: true,
442
+ enumerable: true,
443
+ get: () => this.items[index]
444
+ });
445
+ }
446
+ }
447
+ get length() {
448
+ return this.items.length;
449
+ }
450
+ item(index) {
451
+ return this.items[index] ?? null;
452
+ }
453
+ [Symbol.iterator]() {
454
+ return this.items[Symbol.iterator]();
455
+ }
456
+ forEach(callback) {
457
+ this.items.forEach((value, index) => callback(value, index, this));
458
+ }
459
+ entries() {
460
+ return this.items.entries();
461
+ }
462
+ keys() {
463
+ return this.items.keys();
464
+ }
465
+ values() {
466
+ return this.items.values();
467
+ }
468
+ toArray() {
469
+ return [...this.items];
470
+ }
471
+ }
472
+
473
+ class Node extends EventTarget {
474
+ static ELEMENT_NODE = 1 /* ELEMENT_NODE */;
475
+ static TEXT_NODE = 3 /* TEXT_NODE */;
476
+ static COMMENT_NODE = 8 /* COMMENT_NODE */;
477
+ static DOCUMENT_NODE = 9 /* DOCUMENT_NODE */;
478
+ static DOCUMENT_FRAGMENT_NODE = 11 /* DOCUMENT_FRAGMENT_NODE */;
479
+ nodeType;
480
+ nodeName;
481
+ parentNode = null;
482
+ ownerDocument = null;
483
+ childList = [];
484
+ constructor(nodeType, nodeName) {
485
+ super();
486
+ this.nodeType = nodeType;
487
+ this.nodeName = nodeName;
488
+ }
489
+ get parentElement() {
490
+ const parent = this.parentNode;
491
+ return parent instanceof Element ? parent : null;
492
+ }
493
+ get childNodes() {
494
+ return new NodeList([...this.childList]);
495
+ }
496
+ get firstChild() {
497
+ return this.childList[0] ?? null;
498
+ }
499
+ get lastChild() {
500
+ return this.childList[this.childList.length - 1] ?? null;
501
+ }
502
+ get nextSibling() {
503
+ const parent = this.parentNode;
504
+ if (!parent) {
505
+ return null;
506
+ }
507
+ const index = parent.childList.indexOf(this);
508
+ return index >= 0 ? parent.childList[index + 1] ?? null : null;
509
+ }
510
+ get previousSibling() {
511
+ const parent = this.parentNode;
512
+ if (!parent) {
513
+ return null;
514
+ }
515
+ const index = parent.childList.indexOf(this);
516
+ return index > 0 ? parent.childList[index - 1] : null;
517
+ }
518
+ get textContent() {
519
+ let text = "";
520
+ for (const child of this.childList) {
521
+ if (child.nodeType === 3 /* TEXT_NODE */) {
522
+ text += child.data;
523
+ } else if (child.nodeType === 1 /* ELEMENT_NODE */) {
524
+ text += child.textContent;
525
+ }
526
+ }
527
+ return text;
528
+ }
529
+ set textContent(value) {
530
+ this.childList = [];
531
+ if (value) {
532
+ const textNode = new Text(value);
533
+ textNode.ownerDocument = this.ownerDocument;
534
+ textNode.parentNode = this;
535
+ this.childList.push(textNode);
536
+ }
537
+ }
538
+ hasChildNodes() {
539
+ return this.childList.length > 0;
540
+ }
541
+ appendChild(node) {
542
+ if (node === this) {
543
+ throw new Error("Cannot append a node to itself");
544
+ }
545
+ this.insertBefore(node, null);
546
+ return node;
547
+ }
548
+ insertBefore(node, reference) {
549
+ if (node === this) {
550
+ throw new Error("Cannot insert a node before itself");
551
+ }
552
+ if (node.parentNode) {
553
+ node.parentNode.removeChild(node);
554
+ }
555
+ node.parentNode = this;
556
+ if (node.ownerDocument === null) {
557
+ node.ownerDocument = this.ownerDocument;
558
+ }
559
+ if (reference === null) {
560
+ this.childList.push(node);
561
+ return node;
562
+ }
563
+ const index = this.childList.indexOf(reference);
564
+ if (index < 0) {
565
+ throw new Error("Reference node is not a child of this node");
566
+ }
567
+ this.childList.splice(index, 0, node);
568
+ return node;
569
+ }
570
+ removeChild(node) {
571
+ const index = this.childList.indexOf(node);
572
+ if (index < 0) {
573
+ throw new Error("Node is not a child of this node");
574
+ }
575
+ this.childList.splice(index, 1);
576
+ node.parentNode = null;
577
+ return node;
578
+ }
579
+ replaceChild(newChild, oldChild) {
580
+ const index = this.childList.indexOf(oldChild);
581
+ if (index < 0) {
582
+ throw new Error("Old child is not a child of this node");
583
+ }
584
+ if (newChild.parentNode) {
585
+ newChild.parentNode.removeChild(newChild);
586
+ }
587
+ newChild.parentNode = this;
588
+ if (newChild.ownerDocument === null) {
589
+ newChild.ownerDocument = this.ownerDocument;
590
+ }
591
+ this.childList[index] = newChild;
592
+ oldChild.parentNode = null;
593
+ return newChild;
594
+ }
595
+ replaceChildren(...nodes) {
596
+ for (const child of [...this.childList]) {
597
+ this.removeChild(child);
598
+ }
599
+ for (const node of nodes) {
600
+ this.appendChild(node);
601
+ }
602
+ }
603
+ contains(node) {
604
+ if (!node) {
605
+ return false;
606
+ }
607
+ let current = node;
608
+ while (current) {
609
+ if (current === this) {
610
+ return true;
611
+ }
612
+ current = current.parentNode;
613
+ }
614
+ return false;
615
+ }
616
+ remove() {
617
+ this.parentNode?.removeChild(this);
618
+ }
619
+ cloneNode(deep = false) {
620
+ const clone = this.createClone();
621
+ if (deep) {
622
+ for (const child of this.childList) {
623
+ clone.appendChild(child.cloneNode(true));
624
+ }
625
+ }
626
+ return clone;
627
+ }
628
+ createClone() {
629
+ const clone = new Node(this.nodeType, this.nodeName);
630
+ clone.ownerDocument = this.ownerDocument;
631
+ return clone;
632
+ }
633
+ getRootNode() {
634
+ if (!this.parentNode) {
635
+ return this;
636
+ }
637
+ let parent = this.parentNode;
638
+ while (parent.parentNode) {
639
+ parent = parent.parentNode;
640
+ }
641
+ return parent;
642
+ }
643
+ isConnected() {
644
+ return this.getRootNode().nodeType === 9 /* DOCUMENT_NODE */;
645
+ }
646
+ }
647
+
648
+ class Element extends Node {
649
+ namespaceURI;
650
+ attributeList = [];
651
+ styleValue;
652
+ classListValue;
653
+ datasetProxy;
654
+ constructor(tagName, namespaceURI = null) {
655
+ super(1 /* ELEMENT_NODE */, tagName.toUpperCase());
656
+ this.namespaceURI = namespaceURI;
657
+ }
658
+ get tagName() {
659
+ return this.nodeName;
660
+ }
661
+ get localName() {
662
+ return this.nodeName.toLowerCase();
663
+ }
664
+ get id() {
665
+ return this.getAttribute("id") ?? "";
666
+ }
667
+ set id(value) {
668
+ this.setAttribute("id", value);
669
+ }
670
+ get className() {
671
+ return this.getAttribute("class") ?? "";
672
+ }
673
+ set className(value) {
674
+ this.setAttribute("class", value);
675
+ }
676
+ get classList() {
677
+ if (!this.classListValue) {
678
+ this.classListValue = new DOMTokenList(this, "class");
679
+ }
680
+ return this.classListValue;
681
+ }
682
+ get style() {
683
+ if (!this.styleValue) {
684
+ this.styleValue = createStyleDeclaration();
685
+ }
686
+ return this.styleValue;
687
+ }
688
+ get dataset() {
689
+ if (!this.datasetProxy) {
690
+ this.datasetProxy = createDatasetProxy(this);
691
+ }
692
+ return this.datasetProxy;
693
+ }
694
+ get children() {
695
+ return new NodeList(this.childList.filter((child) => child.nodeType === 1 /* ELEMENT_NODE */));
696
+ }
697
+ get firstElementChild() {
698
+ return this.children.item(0);
699
+ }
700
+ get lastElementChild() {
701
+ return this.children.item(this.children.length - 1);
702
+ }
703
+ get childElementCount() {
704
+ return this.children.length;
705
+ }
706
+ get attributes() {
707
+ return new NamedNodeMap(this);
708
+ }
709
+ getAttribute(name) {
710
+ const entry = this.findAttribute(name);
711
+ return entry ? entry.value : null;
712
+ }
713
+ getAttributeNames() {
714
+ return this.attributeList.map((entry) => entry.name);
715
+ }
716
+ setAttribute(name, value) {
717
+ const stringValue = String(value);
718
+ if (name === "style") {
719
+ this.styleValue = createStyleDeclaration();
720
+ this.styleValue.cssText = stringValue;
721
+ }
722
+ const entry = this.findAttribute(name);
723
+ if (entry) {
724
+ entry.value = stringValue;
725
+ } else {
726
+ this.attributeList.push({ name, value: stringValue });
727
+ }
728
+ }
729
+ removeAttribute(name) {
730
+ if (name === "style") {
731
+ this.styleValue = createStyleDeclaration();
732
+ }
733
+ const index = this.attributeList.findIndex((entry) => entry.name === name);
734
+ if (index >= 0) {
735
+ this.attributeList.splice(index, 1);
736
+ }
737
+ }
738
+ hasAttribute(name) {
739
+ return this.findAttribute(name) !== undefined;
740
+ }
741
+ toggleAttribute(name, force) {
742
+ const shouldAdd = force ?? !this.hasAttribute(name);
743
+ if (shouldAdd) {
744
+ this.setAttribute(name, "");
745
+ } else {
746
+ this.removeAttribute(name);
747
+ }
748
+ return shouldAdd;
749
+ }
750
+ hasAttributes() {
751
+ return this.attributeList.length > 0;
752
+ }
753
+ get innerHTML() {
754
+ return serializeChildren(this);
755
+ }
756
+ set innerHTML(value) {
757
+ this.replaceChildren(...parseHtmlFragment(value, this.ownerDocument));
758
+ }
759
+ get outerHTML() {
760
+ return serializeNode(this);
761
+ }
762
+ get value() {
763
+ return this.getAttribute("value") ?? "";
764
+ }
765
+ set value(value) {
766
+ this.setAttribute("value", value);
767
+ }
768
+ querySelector(selector) {
769
+ return querySelectorAll(this, selector).item(0);
770
+ }
771
+ querySelectorAll(selector) {
772
+ return querySelectorAll(this, selector);
773
+ }
774
+ getElementsByTagName(tagName) {
775
+ const lowered = tagName.toLowerCase();
776
+ const results = [];
777
+ collectElements(this, (element) => {
778
+ if (element.localName === lowered) {
779
+ results.push(element);
780
+ }
781
+ });
782
+ return new NodeList(results);
783
+ }
784
+ matches(selector) {
785
+ return matchSelector(this, selector);
786
+ }
787
+ closest(selector) {
788
+ if (this.matches(selector)) {
789
+ return this;
790
+ }
791
+ let parent = this.parentElement;
792
+ while (parent) {
793
+ if (parent.matches(selector)) {
794
+ return parent;
795
+ }
796
+ parent = parent.parentElement;
797
+ }
798
+ return null;
799
+ }
800
+ getBoundingClientRect() {
801
+ return {
802
+ x: 0,
803
+ y: 0,
804
+ top: 0,
805
+ left: 0,
806
+ right: 0,
807
+ bottom: 0,
808
+ width: 0,
809
+ height: 0,
810
+ toJSON() {
811
+ return {
812
+ x: 0,
813
+ y: 0,
814
+ top: 0,
815
+ left: 0,
816
+ right: 0,
817
+ bottom: 0,
818
+ width: 0,
819
+ height: 0
820
+ };
821
+ }
822
+ };
823
+ }
824
+ scrollIntoView() {}
825
+ focus() {}
826
+ blur() {}
827
+ click() {
828
+ this.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
829
+ }
830
+ append(...nodes) {
831
+ for (const node of nodes) {
832
+ if (typeof node === "string") {
833
+ const textNode = new Text(node);
834
+ textNode.ownerDocument = this.ownerDocument;
835
+ this.appendChild(textNode);
836
+ } else {
837
+ this.appendChild(node);
838
+ }
839
+ }
840
+ }
841
+ prepend(...nodes) {
842
+ const reference = this.firstChild;
843
+ for (const node of nodes) {
844
+ if (typeof node === "string") {
845
+ const textNode = new Text(node);
846
+ textNode.ownerDocument = this.ownerDocument;
847
+ this.insertBefore(textNode, reference);
848
+ } else {
849
+ this.insertBefore(node, reference);
850
+ }
851
+ }
852
+ }
853
+ before(...nodes) {
854
+ const parent = this.parentNode;
855
+ if (!parent) {
856
+ return;
857
+ }
858
+ for (const node of nodes) {
859
+ if (typeof node === "string") {
860
+ const textNode = new Text(node);
861
+ textNode.ownerDocument = this.ownerDocument;
862
+ parent.insertBefore(textNode, this);
863
+ } else {
864
+ parent.insertBefore(node, this);
865
+ }
866
+ }
867
+ }
868
+ after(...nodes) {
869
+ const parent = this.parentNode;
870
+ if (!parent) {
871
+ return;
872
+ }
873
+ const reference = this.nextSibling;
874
+ for (const node of nodes) {
875
+ if (typeof node === "string") {
876
+ const textNode = new Text(node);
877
+ textNode.ownerDocument = this.ownerDocument;
878
+ parent.insertBefore(textNode, reference);
879
+ } else {
880
+ parent.insertBefore(node, reference);
881
+ }
882
+ }
883
+ }
884
+ replaceWith(...nodes) {
885
+ const parent = this.parentNode;
886
+ if (!parent) {
887
+ return;
888
+ }
889
+ const reference = this.nextSibling;
890
+ parent.removeChild(this);
891
+ for (const node of nodes) {
892
+ if (typeof node === "string") {
893
+ const textNode = new Text(node);
894
+ textNode.ownerDocument = this.ownerDocument;
895
+ parent.insertBefore(textNode, reference);
896
+ } else {
897
+ parent.insertBefore(node, reference);
898
+ }
899
+ }
900
+ }
901
+ setAttributeNS(_namespace, name, value) {
902
+ this.setAttribute(name, value);
903
+ }
904
+ removeAttributeNS(_namespace, name) {
905
+ this.removeAttribute(name);
906
+ }
907
+ hasAttributeNS(_namespace, name) {
908
+ return this.hasAttribute(name);
909
+ }
910
+ getAttributeNS(_namespace, name) {
911
+ return this.getAttribute(name);
912
+ }
913
+ findAttribute(name) {
914
+ return this.attributeList.find((entry) => entry.name === name);
915
+ }
916
+ attributeEntries() {
917
+ return [...this.attributeList];
918
+ }
919
+ inlineStyleText() {
920
+ return this.styleValue?.cssText ?? "";
921
+ }
922
+ createClone() {
923
+ const clone = createElementForTag(this.localName, this.ownerDocument);
924
+ for (const entry of this.attributeList) {
925
+ clone.setAttribute(entry.name, entry.value);
926
+ }
927
+ return clone;
928
+ }
929
+ }
930
+
931
+ class HTMLElement extends Element {
932
+ constructor(tagName) {
933
+ super(tagName);
934
+ }
935
+ }
936
+
937
+ class NamedNodeMap {
938
+ element;
939
+ constructor(element) {
940
+ this.element = element;
941
+ for (let index = 0;index < element.attributeEntries().length; index += 1) {
942
+ Object.defineProperty(this, String(index), {
943
+ configurable: true,
944
+ enumerable: true,
945
+ get: () => this.element.attributeEntries()[index] ?? null
946
+ });
947
+ }
948
+ }
949
+ get length() {
950
+ return this.element.attributeEntries().length;
951
+ }
952
+ item(index) {
953
+ return this.element.attributeEntries()[index] ?? null;
954
+ }
955
+ getNamedItem(name) {
956
+ return this.element.findAttribute(name) ?? null;
957
+ }
958
+ setNamedItem(attr) {
959
+ this.element.setAttribute(attr.name, attr.value);
960
+ }
961
+ removeNamedItem(name) {
962
+ this.element.removeAttribute(name);
963
+ }
964
+ [Symbol.iterator]() {
965
+ return this.element.attributeEntries()[Symbol.iterator]();
966
+ }
967
+ }
968
+
969
+ class HTMLOptionElement extends HTMLElement {
970
+ selectedValue;
971
+ constructor(tagName = "option") {
972
+ super(tagName);
973
+ }
974
+ get value() {
975
+ return this.getAttribute("value") ?? this.textContent;
976
+ }
977
+ set value(value) {
978
+ this.setAttribute("value", value);
979
+ }
980
+ get text() {
981
+ return this.textContent;
982
+ }
983
+ get label() {
984
+ return this.getAttribute("label") ?? this.textContent;
985
+ }
986
+ get selected() {
987
+ return this.hasSelectedValue();
988
+ }
989
+ set selected(value) {
990
+ this.setSelectedRaw(value);
991
+ if (value) {
992
+ const select = this.parentElement;
993
+ if (select instanceof HTMLSelectElement && !select.multiple) {
994
+ for (const option of select.options.toArray()) {
995
+ if (option !== this) {
996
+ option.setSelectedRaw(false);
997
+ }
998
+ }
999
+ }
1000
+ }
1001
+ }
1002
+ setSelectedRaw(value) {
1003
+ this.selectedValue = value;
1004
+ if (value) {
1005
+ this.setAttribute("selected", "");
1006
+ } else {
1007
+ this.removeAttribute("selected");
1008
+ }
1009
+ }
1010
+ hasSelectedValue() {
1011
+ if (this.selectedValue !== undefined) {
1012
+ return this.selectedValue;
1013
+ }
1014
+ return this.hasAttribute("selected");
1015
+ }
1016
+ }
1017
+
1018
+ class HTMLSelectElement extends HTMLElement {
1019
+ constructor(tagName = "select") {
1020
+ super(tagName);
1021
+ }
1022
+ get multiple() {
1023
+ return this.hasAttribute("multiple");
1024
+ }
1025
+ set multiple(value) {
1026
+ if (value) {
1027
+ this.setAttribute("multiple", "");
1028
+ } else {
1029
+ this.removeAttribute("multiple");
1030
+ }
1031
+ }
1032
+ get options() {
1033
+ const options = [];
1034
+ collectElements(this, (element) => {
1035
+ if (element instanceof HTMLOptionElement) {
1036
+ options.push(element);
1037
+ }
1038
+ });
1039
+ return new HTMLOptionsCollection(options);
1040
+ }
1041
+ get selectedOptions() {
1042
+ return new NodeList(this.options.toArray().filter((option) => option.hasSelectedValue()));
1043
+ }
1044
+ get selectedIndex() {
1045
+ return this.options.toArray().findIndex((option) => option.hasSelectedValue());
1046
+ }
1047
+ set selectedIndex(index) {
1048
+ const options = this.options.toArray();
1049
+ options.forEach((option, optionIndex) => option.setSelectedRaw(optionIndex === index));
1050
+ }
1051
+ get value() {
1052
+ const options = this.options.toArray();
1053
+ const selected = options.find((option) => option.hasSelectedValue());
1054
+ if (selected) {
1055
+ return selected.value;
1056
+ }
1057
+ if (!this.multiple && options.length > 0) {
1058
+ return options[0].value;
1059
+ }
1060
+ return "";
1061
+ }
1062
+ set value(value) {
1063
+ const options = this.options.toArray();
1064
+ for (const option of options) {
1065
+ const shouldSelect = option.value === value;
1066
+ if (shouldSelect) {
1067
+ if (this.multiple) {
1068
+ option.setSelectedRaw(true);
1069
+ } else {
1070
+ for (const other of options) {
1071
+ other.setSelectedRaw(other === option);
1072
+ }
1073
+ return;
1074
+ }
1075
+ }
1076
+ }
1077
+ }
1078
+ add(option) {
1079
+ this.appendChild(option);
1080
+ }
1081
+ removeOption(index) {
1082
+ const options = this.options.toArray();
1083
+ const option = options[index];
1084
+ if (option) {
1085
+ option.remove();
1086
+ }
1087
+ }
1088
+ }
1089
+
1090
+ class HTMLOptionsCollection {
1091
+ items;
1092
+ constructor(items) {
1093
+ this.items = items;
1094
+ for (let index = 0;index < items.length; index += 1) {
1095
+ Object.defineProperty(this, String(index), {
1096
+ configurable: true,
1097
+ enumerable: true,
1098
+ get: () => this.items[index]
1099
+ });
1100
+ }
1101
+ }
1102
+ get length() {
1103
+ return this.items.length;
1104
+ }
1105
+ item(index) {
1106
+ return this.items[index] ?? null;
1107
+ }
1108
+ get value() {
1109
+ return this.items.find((option) => option.hasSelectedValue())?.value ?? "";
1110
+ }
1111
+ get selectedIndex() {
1112
+ return this.items.findIndex((option) => option.hasSelectedValue());
1113
+ }
1114
+ toArray() {
1115
+ return [...this.items];
1116
+ }
1117
+ [Symbol.iterator]() {
1118
+ return this.items[Symbol.iterator]();
1119
+ }
1120
+ }
1121
+
1122
+ class HTMLInputElement extends HTMLElement {
1123
+ inputValue;
1124
+ checkedValue;
1125
+ constructor(tagName = "input") {
1126
+ super(tagName);
1127
+ }
1128
+ get type() {
1129
+ return this.getAttribute("type") ?? "text";
1130
+ }
1131
+ set type(value) {
1132
+ this.setAttribute("type", value);
1133
+ }
1134
+ get name() {
1135
+ return this.getAttribute("name") ?? "";
1136
+ }
1137
+ set name(value) {
1138
+ this.setAttribute("name", value);
1139
+ }
1140
+ get value() {
1141
+ return this.inputValue ?? this.getAttribute("value") ?? "";
1142
+ }
1143
+ set value(value) {
1144
+ this.inputValue = value;
1145
+ }
1146
+ get defaultValue() {
1147
+ return this.getAttribute("value") ?? "";
1148
+ }
1149
+ get checked() {
1150
+ return this.checkedValue ?? this.hasAttribute("checked");
1151
+ }
1152
+ set checked(value) {
1153
+ this.checkedValue = value;
1154
+ }
1155
+ get disabled() {
1156
+ return this.hasAttribute("disabled");
1157
+ }
1158
+ set disabled(value) {
1159
+ if (value) {
1160
+ this.setAttribute("disabled", "");
1161
+ } else {
1162
+ this.removeAttribute("disabled");
1163
+ }
1164
+ }
1165
+ createClone() {
1166
+ const clone = super.createClone();
1167
+ clone.inputValue = this.inputValue;
1168
+ clone.checkedValue = this.checkedValue;
1169
+ return clone;
1170
+ }
1171
+ }
1172
+
1173
+ class HTMLTextAreaElement extends HTMLElement {
1174
+ textareaValue;
1175
+ constructor(tagName = "textarea") {
1176
+ super(tagName);
1177
+ }
1178
+ get value() {
1179
+ return this.textareaValue ?? this.textContent;
1180
+ }
1181
+ set value(value) {
1182
+ this.textareaValue = value;
1183
+ }
1184
+ }
1185
+
1186
+ class HTMLButtonElement extends HTMLElement {
1187
+ constructor(tagName = "button") {
1188
+ super(tagName);
1189
+ }
1190
+ get type() {
1191
+ return this.getAttribute("type") ?? "submit";
1192
+ }
1193
+ }
1194
+
1195
+ class HTMLStyleElement extends HTMLElement {
1196
+ constructor(tagName = "style") {
1197
+ super(tagName);
1198
+ }
1199
+ }
1200
+
1201
+ class HTMLAnchorElement extends HTMLElement {
1202
+ constructor(tagName = "a") {
1203
+ super(tagName);
1204
+ }
1205
+ get href() {
1206
+ return this.getAttribute("href") ?? "";
1207
+ }
1208
+ set href(value) {
1209
+ this.setAttribute("href", value);
1210
+ }
1211
+ }
1212
+
1213
+ class Text extends Node {
1214
+ data;
1215
+ constructor(data = "") {
1216
+ super(3 /* TEXT_NODE */, "#text");
1217
+ this.data = data;
1218
+ }
1219
+ get nodeValue() {
1220
+ return this.data;
1221
+ }
1222
+ set nodeValue(value) {
1223
+ this.data = value;
1224
+ }
1225
+ get textContent() {
1226
+ return this.data;
1227
+ }
1228
+ set textContent(value) {
1229
+ this.data = value;
1230
+ }
1231
+ get wholeText() {
1232
+ return this.data;
1233
+ }
1234
+ createClone() {
1235
+ const clone = new Text(this.data);
1236
+ clone.ownerDocument = this.ownerDocument;
1237
+ return clone;
1238
+ }
1239
+ }
1240
+
1241
+ class Comment extends Node {
1242
+ data;
1243
+ constructor(data = "") {
1244
+ super(8 /* COMMENT_NODE */, "#comment");
1245
+ this.data = data;
1246
+ }
1247
+ get nodeValue() {
1248
+ return this.data;
1249
+ }
1250
+ set nodeValue(value) {
1251
+ this.data = value;
1252
+ }
1253
+ createClone() {
1254
+ const clone = new Comment(this.data);
1255
+ clone.ownerDocument = this.ownerDocument;
1256
+ return clone;
1257
+ }
1258
+ }
1259
+
1260
+ class DocumentFragment extends Node {
1261
+ constructor() {
1262
+ super(11 /* DOCUMENT_FRAGMENT_NODE */, "#document-fragment");
1263
+ }
1264
+ }
1265
+
1266
+ class Document extends Node {
1267
+ defaultView = null;
1268
+ constructor() {
1269
+ super(9 /* DOCUMENT_NODE */, "#document");
1270
+ }
1271
+ createElement(tagName) {
1272
+ return createElementForTag(tagName, this);
1273
+ }
1274
+ createElementNS(namespaceURI, tagName) {
1275
+ const element = createElementForTag(tagName, this);
1276
+ element.namespaceURI = namespaceURI;
1277
+ return element;
1278
+ }
1279
+ createTextNode(data) {
1280
+ const text = new Text(data);
1281
+ text.ownerDocument = this;
1282
+ return text;
1283
+ }
1284
+ createComment(data) {
1285
+ const comment = new Comment(data);
1286
+ comment.ownerDocument = this;
1287
+ return comment;
1288
+ }
1289
+ createDocumentFragment() {
1290
+ const fragment = new DocumentFragment;
1291
+ fragment.ownerDocument = this;
1292
+ return fragment;
1293
+ }
1294
+ createEvent(type) {
1295
+ if (type === "MouseEvent" || type === "mouseevent") {
1296
+ return new MouseEvent("");
1297
+ }
1298
+ if (type === "KeyboardEvent" || type === "keyboardevent") {
1299
+ return new KeyboardEvent("");
1300
+ }
1301
+ if (type === "CustomEvent" || type === "customevent") {
1302
+ return new CustomEvent("");
1303
+ }
1304
+ return new Event("");
1305
+ }
1306
+ get documentElement() {
1307
+ const html = this.childList.find((child) => child.nodeType === 1 /* ELEMENT_NODE */);
1308
+ if (html) {
1309
+ return html;
1310
+ }
1311
+ const created = createElementForTag("html", this);
1312
+ this.appendChild(created);
1313
+ return created;
1314
+ }
1315
+ get head() {
1316
+ return this.ensureDocumentChild("head");
1317
+ }
1318
+ get body() {
1319
+ return this.ensureDocumentChild("body");
1320
+ }
1321
+ get title() {
1322
+ const titleElement = this.querySelector("title");
1323
+ return titleElement?.textContent ?? "";
1324
+ }
1325
+ set title(value) {
1326
+ let titleElement = this.querySelector("title");
1327
+ if (!titleElement) {
1328
+ titleElement = createElementForTag("title", this);
1329
+ this.head.appendChild(titleElement);
1330
+ }
1331
+ titleElement.textContent = value;
1332
+ }
1333
+ querySelector(selector) {
1334
+ return querySelectorAll(this, selector).item(0);
1335
+ }
1336
+ querySelectorAll(selector) {
1337
+ return querySelectorAll(this, selector);
1338
+ }
1339
+ getElementById(id) {
1340
+ let result = null;
1341
+ collectElements(this, (element) => {
1342
+ if (!result && element.id === id) {
1343
+ result = element;
1344
+ }
1345
+ });
1346
+ return result;
1347
+ }
1348
+ getElementsByTagName(tagName) {
1349
+ return this.documentElement.getElementsByTagName(tagName);
1350
+ }
1351
+ createClone() {
1352
+ return new Document;
1353
+ }
1354
+ ensureDocumentChild(tagName) {
1355
+ const documentElement = this.documentElement;
1356
+ let child = documentElement.childList.find((node) => node.nodeType === 1 /* ELEMENT_NODE */ && node.localName === tagName);
1357
+ if (!child) {
1358
+ child = createElementForTag(tagName, this);
1359
+ documentElement.appendChild(child);
1360
+ }
1361
+ return child;
1362
+ }
1363
+ }
1364
+
1365
+ class Location {
1366
+ url;
1367
+ constructor(url) {
1368
+ this.url = new URL(url);
1369
+ }
1370
+ get href() {
1371
+ return this.url.href;
1372
+ }
1373
+ set href(value) {
1374
+ this.url = new URL(value, this.url.href);
1375
+ }
1376
+ get origin() {
1377
+ return this.url.origin;
1378
+ }
1379
+ get protocol() {
1380
+ return this.url.protocol;
1381
+ }
1382
+ get host() {
1383
+ return this.url.host;
1384
+ }
1385
+ get hostname() {
1386
+ return this.url.hostname;
1387
+ }
1388
+ get port() {
1389
+ return this.url.port;
1390
+ }
1391
+ get pathname() {
1392
+ return this.url.pathname;
1393
+ }
1394
+ set pathname(value) {
1395
+ const url = this.url;
1396
+ const next = new URL(value, url.href);
1397
+ url.pathname = next.pathname;
1398
+ }
1399
+ get search() {
1400
+ return this.url.search;
1401
+ }
1402
+ set search(value) {
1403
+ this.url.search = value.startsWith("?") ? value : `?${value}`;
1404
+ }
1405
+ get hash() {
1406
+ return this.url.hash;
1407
+ }
1408
+ set hash(value) {
1409
+ const nextHash = value.startsWith("#") ? value : `#${value}`;
1410
+ this.url.hash = nextHash;
1411
+ }
1412
+ get username() {
1413
+ return this.url.username;
1414
+ }
1415
+ get password() {
1416
+ return this.url.password;
1417
+ }
1418
+ assign(value) {
1419
+ this.url = new URL(value, this.url.href);
1420
+ }
1421
+ replace(value) {
1422
+ this.url = new URL(value, this.url.href);
1423
+ }
1424
+ reload() {}
1425
+ toString() {
1426
+ return this.url.href;
1427
+ }
1428
+ getHashPath() {
1429
+ return this.url.hash.slice(1);
1430
+ }
1431
+ getHrefWithoutHash() {
1432
+ const url = this.url;
1433
+ return `${url.origin}${url.pathname}${url.search}`;
1434
+ }
1435
+ }
1436
+
1437
+ class History {
1438
+ windowRef;
1439
+ entries = [];
1440
+ index = 0;
1441
+ scrollRestoration = "auto";
1442
+ constructor(windowRef) {
1443
+ this.windowRef = windowRef;
1444
+ this.entries = [{ state: null, url: windowRef.location.href }];
1445
+ }
1446
+ get length() {
1447
+ return this.entries.length;
1448
+ }
1449
+ get state() {
1450
+ return this.entries[this.index]?.state ?? null;
1451
+ }
1452
+ pushState(state, _unusedTitle, url) {
1453
+ const nextUrl = url ? new URL(url, this.windowRef.location.href).href : this.windowRef.location.href;
1454
+ this.entries = this.entries.slice(0, this.index + 1);
1455
+ this.entries.push({ state, url: nextUrl });
1456
+ this.index = this.entries.length - 1;
1457
+ this.windowRef.setLocationUrl(nextUrl);
1458
+ }
1459
+ replaceState(state, _unusedTitle, url) {
1460
+ const nextUrl = url ? new URL(url, this.windowRef.location.href).href : this.windowRef.location.href;
1461
+ this.entries[this.index] = { state, url: nextUrl };
1462
+ this.windowRef.setLocationUrl(nextUrl);
1463
+ }
1464
+ back() {
1465
+ this.go(-1);
1466
+ }
1467
+ forward() {
1468
+ this.go(1);
1469
+ }
1470
+ go(delta = 0) {
1471
+ const nextIndex = this.index + delta;
1472
+ if (nextIndex < 0 || nextIndex >= this.entries.length) {
1473
+ return;
1474
+ }
1475
+ this.index = nextIndex;
1476
+ this.windowRef.setLocationUrl(this.entries[nextIndex].url);
1477
+ this.windowRef.dispatchEvent(new Event("popstate", { bubbles: false, cancelable: false }));
1478
+ }
1479
+ }
1480
+
1481
+ class Storage {
1482
+ store = new Map;
1483
+ get length() {
1484
+ return this.store.size;
1485
+ }
1486
+ key(index) {
1487
+ return [...this.store.keys()][index] ?? null;
1488
+ }
1489
+ getItem(key) {
1490
+ return this.store.has(key) ? this.store.get(key) : null;
1491
+ }
1492
+ setItem(key, value) {
1493
+ this.store.set(key, String(value));
1494
+ }
1495
+ removeItem(key) {
1496
+ this.store.delete(key);
1497
+ }
1498
+ clear() {
1499
+ this.store.clear();
1500
+ }
1501
+ }
1502
+
1503
+ class Navigator {
1504
+ userAgent = "TSone/0.2.1";
1505
+ platform = "TSone";
1506
+ language = "zh-CN";
1507
+ languages = ["zh-CN"];
1508
+ onLine = true;
1509
+ maxTouchPoints = 0;
1510
+ }
1511
+ function createMatchMedia(_windowRef, query) {
1512
+ const listeners = new Set;
1513
+ const matches = false;
1514
+ const list = {
1515
+ media: query,
1516
+ matches,
1517
+ onchange: null,
1518
+ addEventListener(type, listener) {
1519
+ if (type === "change") {
1520
+ listeners.add(listener);
1521
+ }
1522
+ },
1523
+ removeEventListener(type, listener) {
1524
+ if (type === "change") {
1525
+ listeners.delete(listener);
1526
+ }
1527
+ },
1528
+ addListener(listener) {
1529
+ listeners.add(listener);
1530
+ },
1531
+ removeListener(listener) {
1532
+ listeners.delete(listener);
1533
+ },
1534
+ dispatchEvent(event) {
1535
+ for (const listener of [...listeners]) {
1536
+ if (typeof listener === "function") {
1537
+ listener.call(list, event);
1538
+ } else {
1539
+ listener.handleEvent(event);
1540
+ }
1541
+ }
1542
+ return true;
1543
+ }
1544
+ };
1545
+ return list;
1546
+ }
1547
+
1548
+ class ResizeObserver {
1549
+ observe() {}
1550
+ unobserve() {}
1551
+ disconnect() {}
1552
+ }
1553
+ var DOM_GLOBAL_KEYS = [
1554
+ "window",
1555
+ "document",
1556
+ "Node",
1557
+ "Text",
1558
+ "Comment",
1559
+ "Element",
1560
+ "HTMLElement",
1561
+ "HTMLInputElement",
1562
+ "HTMLTextAreaElement",
1563
+ "HTMLSelectElement",
1564
+ "HTMLButtonElement",
1565
+ "HTMLOptionElement",
1566
+ "HTMLStyleElement",
1567
+ "HTMLAnchorElement",
1568
+ "DocumentFragment",
1569
+ "Document",
1570
+ "Event",
1571
+ "MouseEvent",
1572
+ "KeyboardEvent",
1573
+ "CustomEvent",
1574
+ "EventTarget",
1575
+ "DOMException",
1576
+ "history",
1577
+ "location",
1578
+ "navigator",
1579
+ "localStorage",
1580
+ "matchMedia",
1581
+ "getComputedStyle",
1582
+ "requestAnimationFrame",
1583
+ "cancelAnimationFrame",
1584
+ "ResizeObserver"
1585
+ ];
1586
+
1587
+ class DomWindow extends EventTarget {
1588
+ window = this;
1589
+ document;
1590
+ location;
1591
+ history;
1592
+ localStorage = new Storage;
1593
+ navigator = new Navigator;
1594
+ Node = Node;
1595
+ Text = Text;
1596
+ Comment = Comment;
1597
+ Element = Element;
1598
+ HTMLElement = HTMLElement;
1599
+ HTMLInputElement = HTMLInputElement;
1600
+ HTMLTextAreaElement = HTMLTextAreaElement;
1601
+ HTMLSelectElement = HTMLSelectElement;
1602
+ HTMLButtonElement = HTMLButtonElement;
1603
+ HTMLOptionElement = HTMLOptionElement;
1604
+ HTMLStyleElement = HTMLStyleElement;
1605
+ HTMLAnchorElement = HTMLAnchorElement;
1606
+ DocumentFragment = DocumentFragment;
1607
+ Document = Document;
1608
+ Event = Event;
1609
+ MouseEvent = MouseEvent;
1610
+ KeyboardEvent = KeyboardEvent;
1611
+ CustomEvent = CustomEvent;
1612
+ EventTarget = EventTarget;
1613
+ DOMException = DOMException;
1614
+ NodeList = NodeList;
1615
+ constructor(options = {}) {
1616
+ super();
1617
+ const url = options.url ?? "http://localhost/";
1618
+ this.location = new Location(url);
1619
+ this.history = new History(this);
1620
+ this.document = new Document;
1621
+ this.document.defaultView = this;
1622
+ setupDocumentTree(this.document);
1623
+ }
1624
+ matchMedia(query) {
1625
+ return createMatchMedia(this, query);
1626
+ }
1627
+ getComputedStyle(element) {
1628
+ return element.style;
1629
+ }
1630
+ requestAnimationFrame(callback) {
1631
+ return setTimeout(() => callback(Date.now()), 0);
1632
+ }
1633
+ cancelAnimationFrame(handle) {
1634
+ clearTimeout(handle);
1635
+ }
1636
+ setLocationUrl(url) {
1637
+ this.location.href = url;
1638
+ }
1639
+ installKeys() {
1640
+ return [...DOM_GLOBAL_KEYS];
1641
+ }
1642
+ }
1643
+ function createDomWindow(options = {}) {
1644
+ return new DomWindow(options);
1645
+ }
1646
+ function installDomGlobals(windowRef, target = globalThis) {
1647
+ const previous = new Map;
1648
+ const keys = windowRef.installKeys();
1649
+ for (const key of keys) {
1650
+ previous.set(key, Object.getOwnPropertyDescriptor(target, key));
1651
+ }
1652
+ for (const key of keys) {
1653
+ Object.defineProperty(target, key, {
1654
+ configurable: true,
1655
+ enumerable: true,
1656
+ writable: true,
1657
+ value: windowRef[key]
1658
+ });
1659
+ }
1660
+ Object.defineProperty(target, "window", {
1661
+ configurable: true,
1662
+ enumerable: true,
1663
+ writable: true,
1664
+ value: windowRef
1665
+ });
1666
+ return () => {
1667
+ for (const key of keys) {
1668
+ const descriptor = previous.get(key);
1669
+ if (descriptor) {
1670
+ Object.defineProperty(target, key, descriptor);
1671
+ } else {
1672
+ Reflect.deleteProperty(target, key);
1673
+ }
1674
+ }
1675
+ };
1676
+ }
1677
+ function parseHtmlFragment(source, documentRef) {
1678
+ const root = new DocumentFragment;
1679
+ if (documentRef) {
1680
+ root.ownerDocument = documentRef;
1681
+ }
1682
+ parseInto(root, source, documentRef);
1683
+ return [...root.childList];
1684
+ }
1685
+ function parseInto(parent, source, documentRef) {
1686
+ const stack = [];
1687
+ let current = parent;
1688
+ let index = 0;
1689
+ const length = source.length;
1690
+ const append = (node) => {
1691
+ if (node.ownerDocument === null) {
1692
+ node.ownerDocument = documentRef;
1693
+ }
1694
+ current.appendChild(node);
1695
+ };
1696
+ while (index < length) {
1697
+ const openIndex = source.indexOf("<", index);
1698
+ if (openIndex < 0) {
1699
+ append(new Text(source.slice(index)));
1700
+ break;
1701
+ }
1702
+ if (openIndex > index) {
1703
+ append(new Text(source.slice(index, openIndex)));
1704
+ }
1705
+ if (source.startsWith("<!--", openIndex)) {
1706
+ const closeIndex = source.indexOf("-->", openIndex + 4);
1707
+ const commentEnd = closeIndex < 0 ? length : closeIndex;
1708
+ append(new Comment(source.slice(openIndex + 4, commentEnd)));
1709
+ index = closeIndex < 0 ? length : closeIndex + 3;
1710
+ continue;
1711
+ }
1712
+ const tagEnd = findTagEnd(source, openIndex);
1713
+ if (tagEnd < 0) {
1714
+ append(new Text(source.slice(openIndex)));
1715
+ break;
1716
+ }
1717
+ const tagSource = source.slice(openIndex + 1, tagEnd);
1718
+ const trimmed = tagSource.trim();
1719
+ if (trimmed.startsWith("/")) {
1720
+ const tagName = trimmed.slice(1).trim().toLowerCase();
1721
+ if (stack.length > 0 && stack[stack.length - 1].localName === tagName) {
1722
+ stack.pop();
1723
+ current = stack[stack.length - 1] ?? parent;
1724
+ }
1725
+ index = tagEnd + 1;
1726
+ continue;
1727
+ }
1728
+ const selfClosing = trimmed.endsWith("/");
1729
+ const parsed = parseTag(trimmed.replace(/\/$/, "").trim());
1730
+ if (!parsed) {
1731
+ index = tagEnd + 1;
1732
+ continue;
1733
+ }
1734
+ const element = createElementForTag(parsed.name, documentRef);
1735
+ for (const attr of parsed.attributes) {
1736
+ element.setAttribute(attr.name, attr.value);
1737
+ }
1738
+ append(element);
1739
+ if (VOID_TAGS.has(parsed.name) || selfClosing) {
1740
+ index = tagEnd + 1;
1741
+ continue;
1742
+ }
1743
+ if (RAW_TEXT_TAGS.has(parsed.name)) {
1744
+ const closeTag = `</${parsed.name}>`;
1745
+ const rawEnd = source.toLowerCase().indexOf(closeTag, tagEnd + 1);
1746
+ const rawText = source.slice(tagEnd + 1, rawEnd < 0 ? length : rawEnd);
1747
+ element.appendChild(documentRef?.createTextNode(rawText) ?? new Text(rawText));
1748
+ index = rawEnd < 0 ? length : rawEnd + closeTag.length;
1749
+ continue;
1750
+ }
1751
+ stack.push(element);
1752
+ current = element;
1753
+ index = tagEnd + 1;
1754
+ }
1755
+ }
1756
+ var VOID_TAGS = new Set([
1757
+ "area",
1758
+ "base",
1759
+ "br",
1760
+ "col",
1761
+ "embed",
1762
+ "hr",
1763
+ "img",
1764
+ "input",
1765
+ "link",
1766
+ "meta",
1767
+ "param",
1768
+ "source",
1769
+ "track",
1770
+ "wbr"
1771
+ ]);
1772
+ var RAW_TEXT_TAGS = new Set(["script", "style", "textarea", "title"]);
1773
+ function findTagEnd(source, openIndex) {
1774
+ let inQuote = null;
1775
+ for (let index = openIndex + 1;index < source.length; index += 1) {
1776
+ const char = source[index];
1777
+ if (inQuote) {
1778
+ if (char === inQuote) {
1779
+ inQuote = null;
1780
+ }
1781
+ continue;
1782
+ }
1783
+ if (char === '"' || char === "'") {
1784
+ inQuote = char;
1785
+ continue;
1786
+ }
1787
+ if (char === ">") {
1788
+ return index;
1789
+ }
1790
+ }
1791
+ return -1;
1792
+ }
1793
+ function parseTag(source) {
1794
+ const match = source.match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*(.*)$/);
1795
+ if (!match) {
1796
+ return null;
1797
+ }
1798
+ const name = match[1].toLowerCase();
1799
+ const attributes = [];
1800
+ const attributeSource = match[2];
1801
+ const pattern = /([a-zA-Z_:][a-zA-Z0-9_:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;
1802
+ let attributeMatch;
1803
+ while ((attributeMatch = pattern.exec(attributeSource)) !== null) {
1804
+ const attrName = attributeMatch[1];
1805
+ const value = attributeMatch[2] ?? attributeMatch[3] ?? attributeMatch[4] ?? "";
1806
+ attributes.push({ name: attrName, value: decodeEntities(value) });
1807
+ }
1808
+ return { name, attributes };
1809
+ }
1810
+ function decodeEntities(value) {
1811
+ return value.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
1812
+ }
1813
+ function encodeText(value) {
1814
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1815
+ }
1816
+ function encodeAttribute(value) {
1817
+ return encodeText(value).replace(/"/g, "&quot;");
1818
+ }
1819
+ function serializeNode(node) {
1820
+ switch (node.nodeType) {
1821
+ case 3 /* TEXT_NODE */:
1822
+ return encodeText(node.data);
1823
+ case 8 /* COMMENT_NODE */:
1824
+ return `<!--${node.data}-->`;
1825
+ case 1 /* ELEMENT_NODE */:
1826
+ return serializeElement(node);
1827
+ default:
1828
+ return "";
1829
+ }
1830
+ }
1831
+ function serializeElement(element) {
1832
+ const tag = element.localName;
1833
+ const attributes = [];
1834
+ for (const entry of element.attributeEntries()) {
1835
+ if (entry.name === "style") {
1836
+ continue;
1837
+ }
1838
+ attributes.push(`${entry.name}="${encodeAttribute(entry.value)}"`);
1839
+ }
1840
+ const inlineStyle = element.inlineStyleText();
1841
+ if (inlineStyle) {
1842
+ attributes.push(`style="${encodeAttribute(inlineStyle)}"`);
1843
+ }
1844
+ const attributeText = attributes.length > 0 ? ` ${attributes.join(" ")}` : "";
1845
+ if (VOID_TAGS.has(tag)) {
1846
+ return `<${tag}${attributeText}>`;
1847
+ }
1848
+ if (RAW_TEXT_TAGS.has(tag)) {
1849
+ return `<${tag}${attributeText}>${element.textContent}</${tag}>`;
1850
+ }
1851
+ return `<${tag}${attributeText}>${serializeChildren(element)}</${tag}>`;
1852
+ }
1853
+ function serializeChildren(element) {
1854
+ return element.childList.map((child) => serializeNode(child)).join("");
1855
+ }
1856
+ function parseSelector(selector) {
1857
+ return selector.split(",").map((group) => {
1858
+ const segments = [];
1859
+ let index = 0;
1860
+ while (index < group.length) {
1861
+ while (index < group.length && group[index] === " ") {
1862
+ index += 1;
1863
+ }
1864
+ if (index >= group.length) {
1865
+ break;
1866
+ }
1867
+ if (group[index] === ">") {
1868
+ segments.push({ type: "child" });
1869
+ index += 1;
1870
+ continue;
1871
+ }
1872
+ const start = index;
1873
+ while (index < group.length && group[index] !== " " && group[index] !== ">") {
1874
+ index += 1;
1875
+ }
1876
+ segments.push(parseCompound(group.slice(start, index)));
1877
+ }
1878
+ return segments;
1879
+ });
1880
+ }
1881
+ function parseCompound(source) {
1882
+ const selectors = [];
1883
+ let index = 0;
1884
+ while (index < source.length) {
1885
+ const char = source[index];
1886
+ if (char === "*") {
1887
+ selectors.push({ type: "universal" });
1888
+ index += 1;
1889
+ } else if (char === "#") {
1890
+ const end = scanIdentifier(source, index + 1);
1891
+ selectors.push({ type: "id", id: source.slice(index + 1, end) });
1892
+ index = end;
1893
+ } else if (char === ".") {
1894
+ const end = scanIdentifier(source, index + 1);
1895
+ selectors.push({
1896
+ type: "class",
1897
+ className: source.slice(index + 1, end)
1898
+ });
1899
+ index = end;
1900
+ } else if (char === "[") {
1901
+ const end = source.indexOf("]", index);
1902
+ const inner = source.slice(index + 1, end < 0 ? source.length : end).trim();
1903
+ const attrMatch = inner.match(/^([a-zA-Z_:][a-zA-Z0-9_:.-]*)(?:([~|^$*]?=)(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?$/);
1904
+ if (attrMatch) {
1905
+ selectors.push({
1906
+ type: "attribute",
1907
+ name: attrMatch[1],
1908
+ operator: attrMatch[2],
1909
+ value: attrMatch[3] ?? attrMatch[4] ?? attrMatch[5]
1910
+ });
1911
+ } else {
1912
+ selectors.push({ type: "attribute", name: inner });
1913
+ }
1914
+ index = end < 0 ? source.length : end + 1;
1915
+ } else if (/[a-zA-Z_]/.test(char)) {
1916
+ const end = scanIdentifier(source, index);
1917
+ selectors.push({
1918
+ type: "tag",
1919
+ name: source.slice(index, end).toLowerCase()
1920
+ });
1921
+ index = end;
1922
+ } else {
1923
+ index += 1;
1924
+ }
1925
+ }
1926
+ if (selectors.length === 1) {
1927
+ return selectors[0];
1928
+ }
1929
+ return { type: "compound", parts: selectors };
1930
+ }
1931
+ function scanIdentifier(source, start) {
1932
+ let index = start;
1933
+ while (index < source.length && /[a-zA-Z0-9:_-]/.test(source[index])) {
1934
+ index += 1;
1935
+ }
1936
+ return index;
1937
+ }
1938
+ function matchSelector(element, selector) {
1939
+ const groups = parseSelector(selector);
1940
+ return groups.some((group) => matchGroup(element, group));
1941
+ }
1942
+ function matchGroup(element, group) {
1943
+ let index = group.length - 1;
1944
+ if (index < 0) {
1945
+ return true;
1946
+ }
1947
+ if (!matchSegment(element, group[index])) {
1948
+ return false;
1949
+ }
1950
+ if (index === 0) {
1951
+ return true;
1952
+ }
1953
+ let current = element.parentElement;
1954
+ index -= 1;
1955
+ while (current) {
1956
+ const selector = group[index];
1957
+ if (!selector) {
1958
+ return true;
1959
+ }
1960
+ if (selector.type === "child") {
1961
+ const parentSelector = group[index - 1];
1962
+ if (!parentSelector || !matchSegment(current, parentSelector)) {
1963
+ return false;
1964
+ }
1965
+ index -= 2;
1966
+ if (index < 0) {
1967
+ return true;
1968
+ }
1969
+ current = current.parentElement;
1970
+ continue;
1971
+ }
1972
+ if (matchSegment(current, selector)) {
1973
+ index -= 1;
1974
+ if (index < 0) {
1975
+ return true;
1976
+ }
1977
+ }
1978
+ current = current.parentElement;
1979
+ }
1980
+ return false;
1981
+ }
1982
+ function matchSegment(element, selector) {
1983
+ switch (selector.type) {
1984
+ case "universal":
1985
+ return true;
1986
+ case "tag":
1987
+ return element.localName === selector.name;
1988
+ case "id":
1989
+ return element.id === selector.id;
1990
+ case "class":
1991
+ return element.classList.contains(selector.className);
1992
+ case "attribute":
1993
+ return matchAttribute(element, selector);
1994
+ case "compound":
1995
+ return selector.parts.every((part) => matchSegment(element, part));
1996
+ case "child":
1997
+ return false;
1998
+ default:
1999
+ return false;
2000
+ }
2001
+ }
2002
+ function matchAttribute(element, selector) {
2003
+ const attributeValue = element.getAttribute(selector.name);
2004
+ if (!selector.operator) {
2005
+ return attributeValue !== null;
2006
+ }
2007
+ if (attributeValue === null) {
2008
+ return false;
2009
+ }
2010
+ const expected = selector.value ?? "";
2011
+ switch (selector.operator) {
2012
+ case "=":
2013
+ return attributeValue === expected;
2014
+ case "~=":
2015
+ return attributeValue.split(/\s+/).includes(expected);
2016
+ case "|=":
2017
+ return attributeValue === expected || attributeValue.startsWith(`${expected}-`);
2018
+ case "^=":
2019
+ return attributeValue.startsWith(expected);
2020
+ case "$=":
2021
+ return attributeValue.endsWith(expected);
2022
+ case "*=":
2023
+ return attributeValue.includes(expected);
2024
+ default:
2025
+ return false;
2026
+ }
2027
+ }
2028
+ function querySelectorAll(root, selector) {
2029
+ const results = [];
2030
+ collectElements(root, (element) => {
2031
+ if (element !== root && matchSelector(element, selector)) {
2032
+ results.push(element);
2033
+ }
2034
+ });
2035
+ return new NodeList(results);
2036
+ }
2037
+ function collectElements(root, visit) {
2038
+ for (const child of root.childList) {
2039
+ if (child.nodeType === 1 /* ELEMENT_NODE */) {
2040
+ visit(child);
2041
+ collectElements(child, visit);
2042
+ }
2043
+ }
2044
+ }
2045
+ function createElementForTag(tagName, documentRef) {
2046
+ const tag = tagName.toLowerCase();
2047
+ let element;
2048
+ if (tag === "input") {
2049
+ element = new HTMLInputElement(tag);
2050
+ } else if (tag === "textarea") {
2051
+ element = new HTMLTextAreaElement(tag);
2052
+ } else if (tag === "select") {
2053
+ element = new HTMLSelectElement(tag);
2054
+ } else if (tag === "option") {
2055
+ element = new HTMLOptionElement(tag);
2056
+ } else if (tag === "button") {
2057
+ element = new HTMLButtonElement(tag);
2058
+ } else if (tag === "style") {
2059
+ element = new HTMLStyleElement(tag);
2060
+ } else if (tag === "a") {
2061
+ element = new HTMLAnchorElement(tag);
2062
+ } else {
2063
+ element = new HTMLElement(tag);
2064
+ }
2065
+ element.ownerDocument = documentRef;
2066
+ return element;
2067
+ }
2068
+ function setupDocumentTree(documentRef) {
2069
+ const html = documentRef.createElement("html");
2070
+ html.setAttribute("lang", "en");
2071
+ documentRef.appendChild(html);
2072
+ const head = documentRef.createElement("head");
2073
+ const body = documentRef.createElement("body");
2074
+ html.appendChild(head);
2075
+ html.appendChild(body);
2076
+ }
2077
+ function createDatasetProxy(element) {
2078
+ const handler = {
2079
+ get(_target, property) {
2080
+ if (typeof property === "symbol") {
2081
+ return;
2082
+ }
2083
+ return element.getAttribute(`data-${toKebabCase(property)}`) ?? "";
2084
+ },
2085
+ set(_target, property, value) {
2086
+ if (typeof property === "symbol") {
2087
+ return true;
2088
+ }
2089
+ if (value === "" || value === null || value === undefined) {
2090
+ element.removeAttribute(`data-${toKebabCase(property)}`);
2091
+ } else {
2092
+ element.setAttribute(`data-${toKebabCase(property)}`, String(value));
2093
+ }
2094
+ return true;
2095
+ },
2096
+ deleteProperty(_target, property) {
2097
+ if (typeof property !== "symbol") {
2098
+ element.removeAttribute(`data-${toKebabCase(property)}`);
2099
+ }
2100
+ return true;
2101
+ },
2102
+ has(_target, property) {
2103
+ if (typeof property === "symbol") {
2104
+ return false;
2105
+ }
2106
+ return element.hasAttribute(`data-${toKebabCase(property)}`);
2107
+ },
2108
+ ownKeys() {
2109
+ const keys = [];
2110
+ for (const entry of element.attributeEntries()) {
2111
+ if (entry.name.startsWith("data-")) {
2112
+ keys.push(toCamelCase(entry.name.slice(5)));
2113
+ }
2114
+ }
2115
+ return keys;
2116
+ },
2117
+ getOwnPropertyDescriptor(_target, property) {
2118
+ if (typeof property === "symbol") {
2119
+ return;
2120
+ }
2121
+ if (element.hasAttribute(`data-${toKebabCase(property)}`)) {
2122
+ return {
2123
+ configurable: true,
2124
+ enumerable: true,
2125
+ writable: true,
2126
+ value: element.getAttribute(`data-${toKebabCase(property)}`)
2127
+ };
2128
+ }
2129
+ return;
2130
+ }
2131
+ };
2132
+ return new Proxy({}, handler);
2133
+ }
2134
+ function toKebabCase(value) {
2135
+ return value.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
2136
+ }
2137
+ function toCamelCase(value) {
2138
+ return value.replace(/-([a-z])/g, (_match, char) => char.toUpperCase());
2139
+ }
2140
+ export {
2141
+ Comment,
2142
+ CustomEvent,
2143
+ DOMException,
2144
+ DOMTokenList,
2145
+ DOM_GLOBAL_KEYS,
2146
+ Document,
2147
+ DocumentFragment,
2148
+ DomNodeType,
2149
+ DomWindow,
2150
+ Element,
2151
+ Event,
2152
+ EventTarget,
2153
+ HTMLAnchorElement,
2154
+ HTMLButtonElement,
2155
+ HTMLElement,
2156
+ HTMLInputElement,
2157
+ HTMLOptionElement,
2158
+ HTMLOptionsCollection,
2159
+ HTMLSelectElement,
2160
+ HTMLStyleElement,
2161
+ HTMLTextAreaElement,
2162
+ History,
2163
+ KeyboardEvent,
2164
+ Location,
2165
+ MouseEvent,
2166
+ NamedNodeMap,
2167
+ Navigator,
2168
+ Node,
2169
+ NodeList,
2170
+ ResizeObserver,
2171
+ Storage,
2172
+ Text,
2173
+ createDomWindow,
2174
+ createMatchMedia,
2175
+ createStyleDeclaration,
2176
+ installDomGlobals,
2177
+ parseHtmlFragment
2178
+ };
2179
+
2180
+ //# debugId=7D13E902DBE25F4664756E2164756E21
2181
+ //# sourceMappingURL=index.js.map