@geektech/tsone-cli 0.1.0 → 0.2.2

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