@geektech/tsone 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,534 @@
1
+ /**
2
+ * 零依赖最小 DOM 实现。
3
+ *
4
+ * 供 SSR(CLI 项目渲染、docs 静态构建)与测试环境使用,
5
+ * 覆盖 TSone 框架与测试实际依赖的 DOM 面(节点树、事件、CSS 选择器、
6
+ * innerHTML 序列化/解析、history/location/localStorage 等)。
7
+ * 仅面向本项目所需场景,不追求完整浏览器兼容。
8
+ */
9
+ export declare const enum DomNodeType {
10
+ ELEMENT_NODE = 1,
11
+ TEXT_NODE = 3,
12
+ COMMENT_NODE = 8,
13
+ DOCUMENT_NODE = 9,
14
+ DOCUMENT_FRAGMENT_NODE = 11
15
+ }
16
+ export declare class DOMException extends Error {
17
+ readonly code: number;
18
+ constructor(message: string, name?: string);
19
+ }
20
+ type EventListenerRecord = ((event: Event) => void) | {
21
+ handleEvent(event: Event): void;
22
+ };
23
+ interface ListenerEntry {
24
+ listener: EventListenerRecord;
25
+ capture: boolean;
26
+ once: boolean;
27
+ passive: boolean;
28
+ }
29
+ /**
30
+ * EventTarget 基类:addEventListener / removeEventListener / dispatchEvent。
31
+ */
32
+ export declare class EventTarget {
33
+ private readonly listenerMap;
34
+ addEventListener(type: string, listener: EventListenerRecord | null, options?: boolean | AddEventListenerOptions): void;
35
+ removeEventListener(type: string, listener: EventListenerRecord | null, options?: boolean | EventListenerOptions): void;
36
+ dispatchEvent(event: Event): boolean;
37
+ /** @internal 返回本节点的监听器。 */
38
+ getListeners(type: string): ListenerEntry[];
39
+ }
40
+ export declare class Event {
41
+ static readonly NONE = 0;
42
+ static readonly CAPTURING_PHASE = 1;
43
+ static readonly AT_TARGET = 2;
44
+ static readonly BUBBLING_PHASE = 3;
45
+ readonly type: string;
46
+ readonly bubbles: boolean;
47
+ readonly cancelable: boolean;
48
+ readonly composed: boolean;
49
+ target: EventTarget | null;
50
+ currentTarget: EventTarget | null;
51
+ eventPhase: number;
52
+ defaultPrevented: boolean;
53
+ readonly isTrusted = false;
54
+ readonly timeStamp: number;
55
+ cancelBubble: boolean;
56
+ /** @internal */
57
+ dispatched: boolean;
58
+ /** @internal */
59
+ private propagationStopped;
60
+ /** @internal */
61
+ private immediateStopped;
62
+ /** @internal */
63
+ private canceled;
64
+ constructor(type: string, init?: EventInit);
65
+ preventDefault(): void;
66
+ stopPropagation(): void;
67
+ stopImmediatePropagation(): void;
68
+ /** @internal */
69
+ propagationPrevented(): boolean;
70
+ /** @internal */
71
+ immediatePrevented(): boolean;
72
+ /** @internal */
73
+ wasCanceled(): boolean;
74
+ }
75
+ export declare class CustomEvent<T = unknown> extends Event {
76
+ readonly detail: T;
77
+ constructor(type: string, init?: CustomEventInit<T>);
78
+ }
79
+ export declare class MouseEvent extends Event {
80
+ readonly clientX: number;
81
+ readonly clientY: number;
82
+ readonly button: number;
83
+ readonly buttons: number;
84
+ readonly relatedTarget: unknown;
85
+ constructor(type: string, init?: MouseEventInit);
86
+ }
87
+ export declare class KeyboardEvent extends Event {
88
+ readonly key: string;
89
+ readonly code: string;
90
+ constructor(type: string, init?: KeyboardEventInit);
91
+ }
92
+ export declare class DOMTokenList implements Iterable<string> {
93
+ private readonly element;
94
+ private readonly attributeName;
95
+ constructor(element: Element, attributeName?: string);
96
+ get length(): number;
97
+ get value(): string;
98
+ set value(value: string);
99
+ item(index: number): string | null;
100
+ contains(token: string): boolean;
101
+ add(...tokens: string[]): void;
102
+ remove(...tokens: string[]): void;
103
+ toggle(token: string, force?: boolean): boolean;
104
+ replace(oldToken: string, newToken: string): boolean;
105
+ [Symbol.iterator](): Iterator<string>;
106
+ forEach(callback: (value: string, index: number, list: DOMTokenList) => void): void;
107
+ toString(): string;
108
+ private tokens;
109
+ private setTokens;
110
+ }
111
+ /**
112
+ * 创建 CSSStyleDeclaration 代理,支持任意 camelCase 属性访问与赋值。
113
+ */
114
+ export declare function createStyleDeclaration(): CSSStyleDeclaration;
115
+ /**
116
+ * 类数组节点列表:支持 .length、.item()、数值索引与迭代。
117
+ */
118
+ export declare class NodeList<T extends Node = Node> implements Iterable<T> {
119
+ /** @internal */
120
+ private readonly items;
121
+ constructor(items?: T[]);
122
+ get length(): number;
123
+ item(index: number): T | null;
124
+ [Symbol.iterator](): Iterator<T>;
125
+ forEach(callback: (value: T, index: number, list: NodeList<T>) => void): void;
126
+ entries(): IterableIterator<[number, T]>;
127
+ keys(): IterableIterator<number>;
128
+ values(): IterableIterator<T>;
129
+ toArray(): T[];
130
+ }
131
+ /**
132
+ * Node 基类:节点树、父子关系、文本内容。
133
+ */
134
+ export declare class Node extends EventTarget {
135
+ static readonly ELEMENT_NODE = DomNodeType.ELEMENT_NODE;
136
+ static readonly TEXT_NODE = DomNodeType.TEXT_NODE;
137
+ static readonly COMMENT_NODE = DomNodeType.COMMENT_NODE;
138
+ static readonly DOCUMENT_NODE = DomNodeType.DOCUMENT_NODE;
139
+ static readonly DOCUMENT_FRAGMENT_NODE = DomNodeType.DOCUMENT_FRAGMENT_NODE;
140
+ readonly nodeType: number;
141
+ readonly nodeName: string;
142
+ parentNode: Node | null;
143
+ ownerDocument: Document | null;
144
+ /** @internal */
145
+ childList: Node[];
146
+ constructor(nodeType: number, nodeName: string);
147
+ get parentElement(): Element | null;
148
+ get childNodes(): NodeList<Node>;
149
+ get firstChild(): Node | null;
150
+ get lastChild(): Node | null;
151
+ get nextSibling(): Node | null;
152
+ get previousSibling(): Node | null;
153
+ get textContent(): string;
154
+ set textContent(value: string);
155
+ hasChildNodes(): boolean;
156
+ appendChild<T extends Node>(node: T): T;
157
+ insertBefore<T extends Node>(node: T, reference: Node | null): T;
158
+ removeChild<T extends Node>(node: T): T;
159
+ replaceChild<T extends Node>(newChild: T, oldChild: Node): T;
160
+ replaceChildren(...nodes: Node[]): void;
161
+ contains(node: Node | null): boolean;
162
+ remove(): void;
163
+ cloneNode(deep?: boolean): Node;
164
+ /** @internal */
165
+ protected createClone(): Node;
166
+ getRootNode(): Node;
167
+ isConnected(): boolean;
168
+ }
169
+ /**
170
+ * Element:标签节点。
171
+ */
172
+ export declare class Element extends Node {
173
+ readonly namespaceURI: string | null;
174
+ /** @internal */
175
+ private readonly attributeList;
176
+ /** @internal */
177
+ private styleValue;
178
+ /** @internal */
179
+ private classListValue;
180
+ /** @internal */
181
+ private datasetProxy;
182
+ constructor(tagName: string, namespaceURI?: string | null);
183
+ get tagName(): string;
184
+ get localName(): string;
185
+ get id(): string;
186
+ set id(value: string);
187
+ get className(): string;
188
+ set className(value: string);
189
+ get classList(): DOMTokenList;
190
+ get style(): CSSStyleDeclaration;
191
+ get dataset(): Record<string, string>;
192
+ get children(): NodeList<Element>;
193
+ get firstElementChild(): Element | null;
194
+ get lastElementChild(): Element | null;
195
+ get childElementCount(): number;
196
+ get attributes(): NamedNodeMap;
197
+ getAttribute(name: string): string | null;
198
+ getAttributeNames(): string[];
199
+ setAttribute(name: string, value: unknown): void;
200
+ removeAttribute(name: string): void;
201
+ hasAttribute(name: string): boolean;
202
+ toggleAttribute(name: string, force?: boolean): boolean;
203
+ hasAttributes(): boolean;
204
+ get innerHTML(): string;
205
+ set innerHTML(value: string);
206
+ get outerHTML(): string;
207
+ get value(): string;
208
+ set value(value: string);
209
+ querySelector(selector: string): Element | null;
210
+ querySelectorAll(selector: string): NodeList<Element>;
211
+ getElementsByTagName(tagName: string): NodeList<Element>;
212
+ matches(selector: string): boolean;
213
+ closest(selector: string): Element | null;
214
+ getBoundingClientRect(): DOMRect;
215
+ scrollIntoView(): void;
216
+ focus(): void;
217
+ blur(): void;
218
+ click(): void;
219
+ append(...nodes: (Node | string)[]): void;
220
+ prepend(...nodes: (Node | string)[]): void;
221
+ before(...nodes: (Node | string)[]): void;
222
+ after(...nodes: (Node | string)[]): void;
223
+ replaceWith(...nodes: (Node | string)[]): void;
224
+ setAttributeNS(_namespace: string, name: string, value: unknown): void;
225
+ removeAttributeNS(_namespace: string, name: string): void;
226
+ hasAttributeNS(_namespace: string, name: string): boolean;
227
+ getAttributeNS(_namespace: string, name: string): string | null;
228
+ /** @internal */
229
+ findAttribute(name: string): {
230
+ name: string;
231
+ value: string;
232
+ } | undefined;
233
+ /** @internal */
234
+ attributeEntries(): Array<{
235
+ name: string;
236
+ value: string;
237
+ }>;
238
+ /** @internal 供序列化读取内联样式。 */
239
+ inlineStyleText(): string;
240
+ /** @internal */
241
+ protected createClone(): Node;
242
+ }
243
+ export declare class HTMLElement extends Element {
244
+ constructor(tagName: string);
245
+ }
246
+ export declare class NamedNodeMap implements Iterable<{
247
+ name: string;
248
+ value: string;
249
+ }> {
250
+ private readonly element;
251
+ constructor(element: Element);
252
+ get length(): number;
253
+ item(index: number): {
254
+ name: string;
255
+ value: string;
256
+ } | null;
257
+ getNamedItem(name: string): {
258
+ name: string;
259
+ value: string;
260
+ } | null;
261
+ setNamedItem(attr: {
262
+ name: string;
263
+ value: string;
264
+ }): void;
265
+ removeNamedItem(name: string): void;
266
+ [Symbol.iterator](): Iterator<{
267
+ name: string;
268
+ value: string;
269
+ }>;
270
+ }
271
+ export declare class HTMLOptionElement extends HTMLElement {
272
+ /** @internal */
273
+ private selectedValue;
274
+ constructor(tagName?: string);
275
+ get value(): string;
276
+ set value(value: string);
277
+ get text(): string;
278
+ get label(): string;
279
+ get selected(): boolean;
280
+ set selected(value: boolean);
281
+ /** @internal */
282
+ setSelectedRaw(value: boolean): void;
283
+ /** @internal */
284
+ hasSelectedValue(): boolean;
285
+ }
286
+ export declare class HTMLSelectElement extends HTMLElement {
287
+ constructor(tagName?: string);
288
+ get multiple(): boolean;
289
+ set multiple(value: boolean);
290
+ get options(): HTMLOptionsCollection;
291
+ get selectedOptions(): NodeList<HTMLOptionElement>;
292
+ get selectedIndex(): number;
293
+ set selectedIndex(index: number);
294
+ get value(): string;
295
+ set value(value: string);
296
+ add(option: HTMLOptionElement): void;
297
+ removeOption(index: number): void;
298
+ }
299
+ export declare class HTMLOptionsCollection implements Iterable<HTMLOptionElement> {
300
+ private readonly items;
301
+ constructor(items: HTMLOptionElement[]);
302
+ get length(): number;
303
+ item(index: number): HTMLOptionElement | null;
304
+ get value(): string;
305
+ get selectedIndex(): number;
306
+ toArray(): HTMLOptionElement[];
307
+ [Symbol.iterator](): Iterator<HTMLOptionElement>;
308
+ }
309
+ export declare class HTMLInputElement extends HTMLElement {
310
+ /** @internal */
311
+ private inputValue;
312
+ /** @internal */
313
+ private checkedValue;
314
+ constructor(tagName?: string);
315
+ get type(): string;
316
+ set type(value: string);
317
+ get name(): string;
318
+ set name(value: string);
319
+ get value(): string;
320
+ set value(value: string);
321
+ get defaultValue(): string;
322
+ get checked(): boolean;
323
+ set checked(value: boolean);
324
+ get disabled(): boolean;
325
+ set disabled(value: boolean);
326
+ /** @internal */
327
+ protected createClone(): Node;
328
+ }
329
+ export declare class HTMLTextAreaElement extends HTMLElement {
330
+ /** @internal */
331
+ private textareaValue;
332
+ constructor(tagName?: string);
333
+ get value(): string;
334
+ set value(value: string);
335
+ }
336
+ export declare class HTMLButtonElement extends HTMLElement {
337
+ constructor(tagName?: string);
338
+ get type(): string;
339
+ }
340
+ export declare class HTMLStyleElement extends HTMLElement {
341
+ constructor(tagName?: string);
342
+ }
343
+ export declare class HTMLAnchorElement extends HTMLElement {
344
+ constructor(tagName?: string);
345
+ get href(): string;
346
+ set href(value: string);
347
+ }
348
+ export declare class Text extends Node {
349
+ data: string;
350
+ constructor(data?: string);
351
+ get nodeValue(): string;
352
+ set nodeValue(value: string);
353
+ get textContent(): string;
354
+ set textContent(value: string);
355
+ get wholeText(): string;
356
+ /** @internal */
357
+ protected createClone(): Node;
358
+ }
359
+ export declare class Comment extends Node {
360
+ data: string;
361
+ constructor(data?: string);
362
+ get nodeValue(): string;
363
+ set nodeValue(value: string);
364
+ /** @internal */
365
+ protected createClone(): Node;
366
+ }
367
+ export declare class DocumentFragment extends Node {
368
+ constructor();
369
+ }
370
+ export declare class Document extends Node {
371
+ readonly defaultView: DomWindow | null;
372
+ constructor();
373
+ createElement(tagName: string): HTMLElement;
374
+ createElementNS(namespaceURI: string, tagName: string): HTMLElement;
375
+ createTextNode(data: string): Text;
376
+ createComment(data: string): Comment;
377
+ createDocumentFragment(): DocumentFragment;
378
+ createEvent(type: string): Event;
379
+ get documentElement(): HTMLElement;
380
+ get head(): HTMLElement;
381
+ get body(): HTMLElement;
382
+ get title(): string;
383
+ set title(value: string);
384
+ querySelector(selector: string): Element | null;
385
+ querySelectorAll(selector: string): NodeList<Element>;
386
+ getElementById(id: string): Element | null;
387
+ getElementsByTagName(tagName: string): NodeList<Element>;
388
+ /** @internal */
389
+ protected createClone(): Node;
390
+ private ensureDocumentChild;
391
+ }
392
+ /**
393
+ * History / Location / Storage 等浏览器环境对象。
394
+ */
395
+ export declare class Location {
396
+ /** @internal */
397
+ private url;
398
+ constructor(url: string);
399
+ get href(): string;
400
+ set href(value: string);
401
+ get origin(): string;
402
+ get protocol(): string;
403
+ get host(): string;
404
+ get hostname(): string;
405
+ get port(): string;
406
+ get pathname(): string;
407
+ set pathname(value: string);
408
+ get search(): string;
409
+ set search(value: string);
410
+ get hash(): string;
411
+ set hash(value: string);
412
+ get username(): string;
413
+ get password(): string;
414
+ assign(value: string): void;
415
+ replace(value: string): void;
416
+ reload(): void;
417
+ toString(): string;
418
+ /** @internal */
419
+ getHashPath(): string;
420
+ /** @internal */
421
+ getHrefWithoutHash(): string;
422
+ }
423
+ export declare class History {
424
+ /** @internal */
425
+ private readonly windowRef;
426
+ /** @internal */
427
+ private entries;
428
+ /** @internal */
429
+ private index;
430
+ /** @internal */
431
+ scrollRestoration: 'auto' | 'manual';
432
+ constructor(windowRef: DomWindow);
433
+ get length(): number;
434
+ get state(): unknown;
435
+ pushState(state: unknown, _unusedTitle: string, url?: string): void;
436
+ replaceState(state: unknown, _unusedTitle: string, url?: string): void;
437
+ back(): void;
438
+ forward(): void;
439
+ go(delta?: number): void;
440
+ }
441
+ export declare class Storage {
442
+ private readonly store;
443
+ get length(): number;
444
+ key(index: number): string | null;
445
+ getItem(key: string): string | null;
446
+ setItem(key: string, value: string): void;
447
+ removeItem(key: string): void;
448
+ clear(): void;
449
+ }
450
+ export declare class Navigator {
451
+ readonly userAgent = "TSone/0.3.0";
452
+ readonly platform = "TSone";
453
+ readonly language = "zh-CN";
454
+ readonly languages: string[];
455
+ readonly onLine = true;
456
+ readonly maxTouchPoints = 0;
457
+ }
458
+ export interface MediaQueryList {
459
+ readonly media: string;
460
+ readonly matches: boolean;
461
+ onchange: ((event: Event) => void) | null;
462
+ addEventListener(type: string, listener: EventListenerRecord): void;
463
+ removeEventListener(type: string, listener: EventListenerRecord): void;
464
+ addListener(listener: EventListenerRecord): void;
465
+ removeListener(listener: EventListenerRecord): void;
466
+ dispatchEvent(event: Event): boolean;
467
+ }
468
+ export declare function createMatchMedia(_windowRef: DomWindow, query: string): MediaQueryList;
469
+ export declare class ResizeObserver {
470
+ observe(): void;
471
+ unobserve(): void;
472
+ disconnect(): void;
473
+ }
474
+ export declare const DOM_GLOBAL_KEYS: readonly string[];
475
+ /**
476
+ * DomWindow:模拟的浏览器 window 环境。
477
+ */
478
+ export declare class DomWindow extends EventTarget {
479
+ readonly window: DomWindow;
480
+ readonly document: Document;
481
+ readonly location: Location;
482
+ readonly history: History;
483
+ readonly localStorage: Storage;
484
+ readonly navigator: Navigator;
485
+ readonly Node: typeof Node;
486
+ readonly Text: typeof Text;
487
+ readonly Comment: typeof Comment;
488
+ readonly Element: typeof Element;
489
+ readonly HTMLElement: typeof HTMLElement;
490
+ readonly HTMLInputElement: typeof HTMLInputElement;
491
+ readonly HTMLTextAreaElement: typeof HTMLTextAreaElement;
492
+ readonly HTMLSelectElement: typeof HTMLSelectElement;
493
+ readonly HTMLButtonElement: typeof HTMLButtonElement;
494
+ readonly HTMLOptionElement: typeof HTMLOptionElement;
495
+ readonly HTMLStyleElement: typeof HTMLStyleElement;
496
+ readonly HTMLAnchorElement: typeof HTMLAnchorElement;
497
+ readonly DocumentFragment: typeof DocumentFragment;
498
+ readonly Document: typeof Document;
499
+ readonly Event: typeof Event;
500
+ readonly MouseEvent: typeof MouseEvent;
501
+ readonly KeyboardEvent: typeof KeyboardEvent;
502
+ readonly CustomEvent: typeof CustomEvent;
503
+ readonly EventTarget: typeof EventTarget;
504
+ readonly DOMException: typeof DOMException;
505
+ readonly NodeList: typeof NodeList;
506
+ constructor(options?: {
507
+ url?: string;
508
+ });
509
+ matchMedia(query: string): MediaQueryList;
510
+ getComputedStyle(element: Element): CSSStyleDeclaration;
511
+ requestAnimationFrame(callback: FrameRequestCallback): number;
512
+ cancelAnimationFrame(handle: number): void;
513
+ /** @internal */
514
+ setLocationUrl(url: string): void;
515
+ /** @internal 安装到目标对象上的全局属性名。 */
516
+ installKeys(): string[];
517
+ }
518
+ export interface DomWindowOptions {
519
+ url?: string;
520
+ }
521
+ /**
522
+ * 创建隔离的 DOM window 环境。
523
+ */
524
+ export declare function createDomWindow(options?: DomWindowOptions): DomWindow;
525
+ /**
526
+ * 将 DOM window 的全局属性安装到目标对象(默认 globalThis),
527
+ * 返回可恢复旧值的函数。
528
+ */
529
+ export declare function installDomGlobals(windowRef: DomWindow, target?: Record<string, unknown>): () => void;
530
+ /**
531
+ * 解析 HTML 片段为节点列表(innerHTML setter 用)。
532
+ */
533
+ export declare function parseHtmlFragment(source: string, documentRef: Document | null): Node[];
534
+ export {};
@@ -0,0 +1,4 @@
1
+ var ce;((s)=>{s[s.ELEMENT_NODE=1]="ELEMENT_NODE";s[s.TEXT_NODE=3]="TEXT_NODE";s[s.COMMENT_NODE=8]="COMMENT_NODE";s[s.DOCUMENT_NODE=9]="DOCUMENT_NODE";s[s.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(ce||={});class K extends Error{code;constructor(e,t="Error"){super(e);this.name=t,this.code=0}}class A{listenerMap=new Map;addEventListener(e,t,n){if(!t)return;let i=typeof n==="boolean"?n:n?.capture??!1,r=typeof n==="object"?n.once??!1:!1,s=typeof n==="object"?n.passive??!1:!1,l=this.listenerMap.get(e);if(!l)l=[],this.listenerMap.set(e,l);if(l.some((a)=>a.listener===t&&a.capture===i))return;l.push({listener:t,capture:i,once:r,passive:s})}removeEventListener(e,t,n){if(!t)return;let i=typeof n==="boolean"?n:n?.capture??!1,r=this.listenerMap.get(e);if(!r)return;let s=r.findIndex((l)=>l.listener===t&&l.capture===i);if(s>=0)r.splice(s,1);if(r.length===0)this.listenerMap.delete(e)}dispatchEvent(e){if(!(e instanceof c))throw TypeError("dispatchEvent requires an Event instance");if(e.dispatched)throw Error("Event has already been dispatched");return pe(this,e)}getListeners(e){return this.listenerMap.get(e)??[]}}class c{static NONE=0;static CAPTURING_PHASE=1;static AT_TARGET=2;static BUBBLING_PHASE=3;type;bubbles;cancelable;composed;target=null;currentTarget=null;eventPhase=c.NONE;defaultPrevented=!1;isTrusted=!1;timeStamp;cancelBubble=!1;dispatched=!1;propagationStopped=!1;immediateStopped=!1;canceled=!1;constructor(e,t){this.type=e,this.bubbles=t?.bubbles??!1,this.cancelable=t?.cancelable??!1,this.composed=t?.composed??!1,this.timeStamp=Date.now()}preventDefault(){if(this.cancelable)this.canceled=!0}stopPropagation(){this.propagationStopped=!0,this.cancelBubble=!0}stopImmediatePropagation(){this.propagationStopped=!0,this.immediateStopped=!0,this.cancelBubble=!0}propagationPrevented(){return this.propagationStopped}immediatePrevented(){return this.immediateStopped}wasCanceled(){return this.canceled}}class I extends c{detail;constructor(e,t){super(e,t);this.detail=t?.detail}}class O extends c{clientX;clientY;button;buttons;relatedTarget;constructor(e,t){super(e,t);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}}class H extends c{key;code;constructor(e,t){super(e,t);this.key=t?.key??"",this.code=t?.code??""}}function de(e,t){let n=e.listener;if(typeof n==="function")n.call(t.currentTarget,t);else n.handleEvent(t)}function pe(e,t){t.dispatched=!0,t.target=e;let i=[...he(e)].reverse(),r=i.length-1;t.eventPhase=c.CAPTURING_PHASE;for(let s=0;s<r;s+=1){let l=i[s];if(t.propagationPrevented())break;t.currentTarget=l,x(l,t,!0)}if(!t.propagationPrevented()){if(t.eventPhase=c.AT_TARGET,t.currentTarget=e,x(e,t,!0),!t.immediatePrevented())x(e,t,!1)}if(t.bubbles&&!t.propagationPrevented()){t.eventPhase=c.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s-=1){let l=i[s];if(t.propagationPrevented())break;t.currentTarget=l,x(l,t,!1)}}return t.eventPhase=c.NONE,t.currentTarget=null,!t.wasCanceled()}function x(e,t,n){let i=e.getListeners(t.type);for(let r of[...i]){if(r.capture!==n)continue;if(t.immediatePrevented())break;if(r.once)e.removeEventListener(t.type,r.listener,{capture:r.capture});de(r,t)}}function he(e){let t=[],n=e;while(n){t.push(n);let i=n;if(i.nodeType===9){let s=i.defaultView;if(s)t.push(s);break}let r=i.parentNode;if(r){n=r;continue}break}return t}class X{element;attributeName;constructor(e,t="class"){this.element=e,this.attributeName=t}get length(){return this.tokens().length}get value(){return this.element.getAttribute(this.attributeName)??""}set value(e){this.setTokens(q(e))}item(e){return this.tokens()[e]??null}contains(e){return this.tokens().includes(e)}add(...e){let t=new Set(this.tokens());for(let n of e)if(n)t.add(n);this.setTokens([...t])}remove(...e){let t=new Set(this.tokens());for(let n of e)t.delete(n);this.setTokens([...t])}toggle(e,t){let n=new Set(this.tokens()),i=t??!n.has(e);if(i)n.add(e);else n.delete(e);return this.setTokens([...n]),i}replace(e,t){let n=this.tokens(),i=n.indexOf(e);if(i<0)return!1;return n[i]=t,this.setTokens(n),!0}[Symbol.iterator](){return this.tokens()[Symbol.iterator]()}forEach(e){this.tokens().forEach((t,n)=>e(t,n,this))}toString(){return this.value}tokens(){return q(this.element.getAttribute(this.attributeName)??"")}setTokens(e){let t=e.filter(Boolean).join(" ");if(t)this.element.setAttribute(this.attributeName,t);else this.element.removeAttribute(this.attributeName)}}function q(e){return e.trim().split(/\s+/).filter(Boolean)}function L(e){return e.replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function R(){let e=new Map,t={properties:e,setProperty(i,r,s=""){let l=L(i);if(r==="")e.delete(l);else e.set(l,{value:r,priority:s})},getPropertyValue(i){return e.get(L(i))?.value??""},getPropertyPriority(i){return e.get(L(i))?.priority??""},removeProperty(i){let r=L(i),s=e.get(r)?.value??"";return e.delete(r),s},item(i){return[...e.keys()][i]??""},get length(){return e.size},get cssText(){return[...e.entries()].map(([i,r])=>`${i}: ${r.value}${r.priority?` ${r.priority}`:""};`).join(" ")},set cssText(i){e.clear();for(let r of i.split(";")){let s=r.trim();if(!s)continue;let l=s.indexOf(":");if(l<0)continue;let a=s.slice(0,l).trim(),o=s.slice(l+1).trim();if(a)t.setProperty(a,o)}}};return new Proxy(t,{get(i,r,s){if(typeof r==="symbol")return Reflect.get(i,r,s);if(r in i){let l=Reflect.get(i,r,s);return typeof l==="function"?l.bind(i):l}return i.getPropertyValue(r)},set(i,r,s,l){if(typeof r==="symbol")return Reflect.set(i,r,s,l);if(r in i)return Reflect.set(i,r,s,l);return i.setProperty(r,String(s)),!0},has(i,r){if(typeof r==="symbol")return Reflect.has(i,r);if(r in i)return!0;return i.getPropertyValue(r)!==""},ownKeys(){return[...Reflect.ownKeys(t),...[...e.keys()].map((i)=>be(i))]},getOwnPropertyDescriptor(i,r){if(typeof r==="symbol")return Reflect.getOwnPropertyDescriptor(i,r);if(r in i)return Reflect.getOwnPropertyDescriptor(i,r);let s=i.getPropertyValue(r);if(s!=="")return{configurable:!0,enumerable:!0,writable:!0,value:s};return}})}function be(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}class f{items;constructor(e=[]){this.items=e;for(let t=0;t<e.length;t+=1)Object.defineProperty(this,String(t),{configurable:!0,enumerable:!0,get:()=>this.items[t]})}get length(){return this.items.length}item(e){return this.items[e]??null}[Symbol.iterator](){return this.items[Symbol.iterator]()}forEach(e){this.items.forEach((t,n)=>e(t,n,this))}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}toArray(){return[...this.items]}}class b extends A{static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static DOCUMENT_FRAGMENT_NODE=11;nodeType;nodeName;parentNode=null;ownerDocument=null;childList=[];constructor(e,t){super();this.nodeType=e,this.nodeName=t}get parentElement(){let e=this.parentNode;return e instanceof M?e:null}get childNodes(){return new f([...this.childList])}get firstChild(){return this.childList[0]??null}get lastChild(){return this.childList[this.childList.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let t=e.childList.indexOf(this);return t>=0?e.childList[t+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let t=e.childList.indexOf(this);return t>0?e.childList[t-1]:null}get textContent(){let e="";for(let t of this.childList)if(t.nodeType===3)e+=t.data;else if(t.nodeType===1)e+=t.textContent;return e}set textContent(e){if(this.childList=[],e){let t=new u(e);t.ownerDocument=this.ownerDocument,t.parentNode=this,this.childList.push(t)}}hasChildNodes(){return this.childList.length>0}appendChild(e){if(e===this)throw Error("Cannot append a node to itself");return this.insertBefore(e,null),e}insertBefore(e,t){if(e===this)throw Error("Cannot insert a node before itself");if(e.parentNode)e.parentNode.removeChild(e);if(e.parentNode=this,e.ownerDocument===null)e.ownerDocument=this.ownerDocument;if(t===null)return this.childList.push(e),e;let n=this.childList.indexOf(t);if(n<0)throw Error("Reference node is not a child of this node");return this.childList.splice(n,0,e),e}removeChild(e){let t=this.childList.indexOf(e);if(t<0)throw Error("Node is not a child of this node");return this.childList.splice(t,1),e.parentNode=null,e}replaceChild(e,t){let n=this.childList.indexOf(t);if(n<0)throw Error("Old child is not a child of this node");if(e.parentNode)e.parentNode.removeChild(e);if(e.parentNode=this,e.ownerDocument===null)e.ownerDocument=this.ownerDocument;return this.childList[n]=e,t.parentNode=null,e}replaceChildren(...e){for(let t of[...this.childList])this.removeChild(t);for(let t of e)this.appendChild(t)}contains(e){if(!e)return!1;let t=e;while(t){if(t===this)return!0;t=t.parentNode}return!1}remove(){this.parentNode?.removeChild(this)}cloneNode(e=!1){let t=this.createClone();if(e)for(let n of this.childList)t.appendChild(n.cloneNode(!0));return t}createClone(){let e=new b(this.nodeType,this.nodeName);return e.ownerDocument=this.ownerDocument,e}getRootNode(){if(!this.parentNode)return this;let e=this.parentNode;while(e.parentNode)e=e.parentNode;return e}isConnected(){return this.getRootNode().nodeType===9}}class M extends b{namespaceURI;attributeList=[];styleValue;classListValue;datasetProxy;constructor(e,t=null){super(1,e.toUpperCase());this.namespaceURI=t}get tagName(){return this.nodeName}get localName(){return this.nodeName.toLowerCase()}get id(){return this.getAttribute("id")??""}set id(e){this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){this.setAttribute("class",e)}get classList(){if(!this.classListValue)this.classListValue=new X(this,"class");return this.classListValue}get style(){if(!this.styleValue)this.styleValue=R();return this.styleValue}get dataset(){if(!this.datasetProxy)this.datasetProxy=Ce(this);return this.datasetProxy}get children(){return new f(this.childList.filter((e)=>e.nodeType===1))}get firstElementChild(){return this.children.item(0)}get lastElementChild(){return this.children.item(this.children.length-1)}get childElementCount(){return this.children.length}get attributes(){return new Z(this)}getAttribute(e){let t=this.findAttribute(e);return t?t.value:null}getAttributeNames(){return this.attributeList.map((e)=>e.name)}setAttribute(e,t){let n=String(t);if(e==="style")this.styleValue=R(),this.styleValue.cssText=n;let i=this.findAttribute(e);if(i)i.value=n;else this.attributeList.push({name:e,value:n})}removeAttribute(e){if(e==="style")this.styleValue=R();let t=this.attributeList.findIndex((n)=>n.name===e);if(t>=0)this.attributeList.splice(t,1)}hasAttribute(e){return this.findAttribute(e)!==void 0}toggleAttribute(e,t){let n=t??!this.hasAttribute(e);if(n)this.setAttribute(e,"");else this.removeAttribute(e);return n}hasAttributes(){return this.attributeList.length>0}get innerHTML(){return oe(this)}set innerHTML(e){this.replaceChildren(...ye(e,this.ownerDocument))}get outerHTML(){return le(this)}get value(){return this.getAttribute("value")??""}set value(e){this.setAttribute("value",e)}querySelector(e){return C(this,e).item(0)}querySelectorAll(e){return C(this,e)}getElementsByTagName(e){let t=e.toLowerCase(),n=[];return N(this,(i)=>{if(i.localName===t)n.push(i)}),new f(n)}matches(e){return ue(this,e)}closest(e){if(this.matches(e))return this;let t=this.parentElement;while(t){if(t.matches(e))return t;t=t.parentElement}return null}getBoundingClientRect(){return{x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON(){return{x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0}}}}scrollIntoView(){}focus(){}blur(){}click(){this.dispatchEvent(new O("click",{bubbles:!0,cancelable:!0}))}append(...e){for(let t of e)if(typeof t==="string"){let n=new u(t);n.ownerDocument=this.ownerDocument,this.appendChild(n)}else this.appendChild(t)}prepend(...e){let t=this.firstChild;for(let n of e)if(typeof n==="string"){let i=new u(n);i.ownerDocument=this.ownerDocument,this.insertBefore(i,t)}else this.insertBefore(n,t)}before(...e){let t=this.parentNode;if(!t)return;for(let n of e)if(typeof n==="string"){let i=new u(n);i.ownerDocument=this.ownerDocument,t.insertBefore(i,this)}else t.insertBefore(n,this)}after(...e){let t=this.parentNode;if(!t)return;let n=this.nextSibling;for(let i of e)if(typeof i==="string"){let r=new u(i);r.ownerDocument=this.ownerDocument,t.insertBefore(r,n)}else t.insertBefore(i,n)}replaceWith(...e){let t=this.parentNode;if(!t)return;let n=this.nextSibling;t.removeChild(this);for(let i of e)if(typeof i==="string"){let r=new u(i);r.ownerDocument=this.ownerDocument,t.insertBefore(r,n)}else t.insertBefore(i,n)}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttributeNS(e,t){this.removeAttribute(t)}hasAttributeNS(e,t){return this.hasAttribute(t)}getAttributeNS(e,t){return this.getAttribute(t)}findAttribute(e){return this.attributeList.find((t)=>t.name===e)}attributeEntries(){return[...this.attributeList]}inlineStyleText(){return this.styleValue?.cssText??""}createClone(){let e=m(this.localName,this.ownerDocument);for(let t of this.attributeList)e.setAttribute(t.name,t.value);return e}}class p extends M{constructor(e){super(e)}}class Z{element;constructor(e){this.element=e;for(let t=0;t<e.attributeEntries().length;t+=1)Object.defineProperty(this,String(t),{configurable:!0,enumerable:!0,get:()=>this.element.attributeEntries()[t]??null})}get length(){return this.element.attributeEntries().length}item(e){return this.element.attributeEntries()[e]??null}getNamedItem(e){return this.element.findAttribute(e)??null}setNamedItem(e){this.element.setAttribute(e.name,e.value)}removeNamedItem(e){this.element.removeAttribute(e)}[Symbol.iterator](){return this.element.attributeEntries()[Symbol.iterator]()}}class k extends p{selectedValue;constructor(e="option"){super(e)}get value(){return this.getAttribute("value")??this.textContent}set value(e){this.setAttribute("value",e)}get text(){return this.textContent}get label(){return this.getAttribute("label")??this.textContent}get selected(){return this.hasSelectedValue()}set selected(e){if(this.setSelectedRaw(e),e){let t=this.parentElement;if(t instanceof P&&!t.multiple){for(let n of t.options.toArray())if(n!==this)n.setSelectedRaw(!1)}}}setSelectedRaw(e){if(this.selectedValue=e,e)this.setAttribute("selected","");else this.removeAttribute("selected")}hasSelectedValue(){if(this.selectedValue!==void 0)return this.selectedValue;return this.hasAttribute("selected")}}class P extends p{constructor(e="select"){super(e)}get multiple(){return this.hasAttribute("multiple")}set multiple(e){if(e)this.setAttribute("multiple","");else this.removeAttribute("multiple")}get options(){let e=[];return N(this,(t)=>{if(t instanceof k)e.push(t)}),new Q(e)}get selectedOptions(){return new f(this.options.toArray().filter((e)=>e.hasSelectedValue()))}get selectedIndex(){return this.options.toArray().findIndex((e)=>e.hasSelectedValue())}set selectedIndex(e){this.options.toArray().forEach((n,i)=>n.setSelectedRaw(i===e))}get value(){let e=this.options.toArray(),t=e.find((n)=>n.hasSelectedValue());if(t)return t.value;if(!this.multiple&&e.length>0)return e[0].value;return""}set value(e){let t=this.options.toArray();for(let n of t)if(n.value===e)if(this.multiple)n.setSelectedRaw(!0);else{for(let r of t)r.setSelectedRaw(r===n);return}}add(e){this.appendChild(e)}removeOption(e){let n=this.options.toArray()[e];if(n)n.remove()}}class Q{items;constructor(e){this.items=e;for(let t=0;t<e.length;t+=1)Object.defineProperty(this,String(t),{configurable:!0,enumerable:!0,get:()=>this.items[t]})}get length(){return this.items.length}item(e){return this.items[e]??null}get value(){return this.items.find((e)=>e.hasSelectedValue())?.value??""}get selectedIndex(){return this.items.findIndex((e)=>e.hasSelectedValue())}toArray(){return[...this.items]}[Symbol.iterator](){return this.items[Symbol.iterator]()}}class U extends p{inputValue;checkedValue;constructor(e="input"){super(e)}get type(){return this.getAttribute("type")??"text"}set type(e){this.setAttribute("type",e)}get name(){return this.getAttribute("name")??""}set name(e){this.setAttribute("name",e)}get value(){return this.inputValue??this.getAttribute("value")??""}set value(e){this.inputValue=e}get defaultValue(){return this.getAttribute("value")??""}get checked(){return this.checkedValue??this.hasAttribute("checked")}set checked(e){this.checkedValue=e}get disabled(){return this.hasAttribute("disabled")}set disabled(e){if(e)this.setAttribute("disabled","");else this.removeAttribute("disabled")}createClone(){let e=super.createClone();return e.inputValue=this.inputValue,e.checkedValue=this.checkedValue,e}}class B extends p{textareaValue;constructor(e="textarea"){super(e)}get value(){return this.textareaValue??this.textContent}set value(e){this.textareaValue=e}}class W extends p{constructor(e="button"){super(e)}get type(){return this.getAttribute("type")??"submit"}}class z extends p{constructor(e="style"){super(e)}}class G extends p{constructor(e="a"){super(e)}get href(){return this.getAttribute("href")??""}set href(e){this.setAttribute("href",e)}}class u extends b{data;constructor(e=""){super(3,"#text");this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}get wholeText(){return this.data}createClone(){let e=new u(this.data);return e.ownerDocument=this.ownerDocument,e}}class w extends b{data;constructor(e=""){super(8,"#comment");this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}createClone(){let e=new w(this.data);return e.ownerDocument=this.ownerDocument,e}}class _ extends b{constructor(){super(11,"#document-fragment")}}class S extends b{defaultView=null;constructor(){super(9,"#document")}createElement(e){return m(e,this)}createElementNS(e,t){let n=m(t,this);return n.namespaceURI=e,n}createTextNode(e){let t=new u(e);return t.ownerDocument=this,t}createComment(e){let t=new w(e);return t.ownerDocument=this,t}createDocumentFragment(){let e=new _;return e.ownerDocument=this,e}createEvent(e){if(e==="MouseEvent"||e==="mouseevent")return new O("");if(e==="KeyboardEvent"||e==="keyboardevent")return new H("");if(e==="CustomEvent"||e==="customevent")return new I("");return new c("")}get documentElement(){let e=this.childList.find((n)=>n.nodeType===1);if(e)return e;let t=m("html",this);return this.appendChild(t),t}get head(){return this.ensureDocumentChild("head")}get body(){return this.ensureDocumentChild("body")}get title(){return this.querySelector("title")?.textContent??""}set title(e){let t=this.querySelector("title");if(!t)t=m("title",this),this.head.appendChild(t);t.textContent=e}querySelector(e){return C(this,e).item(0)}querySelectorAll(e){return C(this,e)}getElementById(e){let t=null;return N(this,(n)=>{if(!t&&n.id===e)t=n}),t}getElementsByTagName(e){return this.documentElement.getElementsByTagName(e)}createClone(){return new S}ensureDocumentChild(e){let t=this.documentElement,n=t.childList.find((i)=>i.nodeType===1&&i.localName===e);if(!n)n=m(e,this),t.appendChild(n);return n}}class Y{url;constructor(e){this.url=new URL(e)}get href(){return this.url.href}set href(e){this.url=new URL(e,this.url.href)}get origin(){return this.url.origin}get protocol(){return this.url.protocol}get host(){return this.url.host}get hostname(){return this.url.hostname}get port(){return this.url.port}get pathname(){return this.url.pathname}set pathname(e){let t=this.url,n=new URL(e,t.href);t.pathname=n.pathname}get search(){return this.url.search}set search(e){this.url.search=e.startsWith("?")?e:`?${e}`}get hash(){return this.url.hash}set hash(e){let t=e.startsWith("#")?e:`#${e}`;this.url.hash=t}get username(){return this.url.username}get password(){return this.url.password}assign(e){this.url=new URL(e,this.url.href)}replace(e){this.url=new URL(e,this.url.href)}reload(){}toString(){return this.url.href}getHashPath(){return this.url.hash.slice(1)}getHrefWithoutHash(){let e=this.url;return`${e.origin}${e.pathname}${e.search}`}}class J{windowRef;entries=[];index=0;scrollRestoration="auto";constructor(e){this.windowRef=e,this.entries=[{state:null,url:e.location.href}]}get length(){return this.entries.length}get state(){return this.entries[this.index]?.state??null}pushState(e,t,n){let i=n?new URL(n,this.windowRef.location.href).href:this.windowRef.location.href;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)}replaceState(e,t,n){let i=n?new URL(n,this.windowRef.location.href).href:this.windowRef.location.href;this.entries[this.index]={state:e,url:i},this.windowRef.setLocationUrl(i)}back(){this.go(-1)}forward(){this.go(1)}go(e=0){let t=this.index+e;if(t<0||t>=this.entries.length)return;this.index=t,this.windowRef.setLocationUrl(this.entries[t].url),this.windowRef.dispatchEvent(new c("popstate",{bubbles:!1,cancelable:!1}))}}class ee{store=new Map;get length(){return this.store.size}key(e){return[...this.store.keys()][e]??null}getItem(e){return this.store.has(e)?this.store.get(e):null}setItem(e,t){this.store.set(e,String(t))}removeItem(e){this.store.delete(e)}clear(){this.store.clear()}}class te{userAgent="TSone/0.3.0";platform="TSone";language="zh-CN";languages=["zh-CN"];onLine=!0;maxTouchPoints=0}function ge(e,t){let n=new Set,i=!1,r={media:t,matches:!1,onchange:null,addEventListener(s,l){if(s==="change")n.add(l)},removeEventListener(s,l){if(s==="change")n.delete(l)},addListener(s){n.add(s)},removeListener(s){n.delete(s)},dispatchEvent(s){for(let l of[...n])if(typeof l==="function")l.call(r,s);else l.handleEvent(s);return!0}};return r}class me{observe(){}unobserve(){}disconnect(){}}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"];class ne extends A{window=this;document;location;history;localStorage=new ee;navigator=new te;Node=b;Text=u;Comment=w;Element=M;HTMLElement=p;HTMLInputElement=U;HTMLTextAreaElement=B;HTMLSelectElement=P;HTMLButtonElement=W;HTMLOptionElement=k;HTMLStyleElement=z;HTMLAnchorElement=G;DocumentFragment=_;Document=S;Event=c;MouseEvent=O;KeyboardEvent=H;CustomEvent=I;EventTarget=A;DOMException=K;NodeList=f;constructor(e={}){super();let t=e.url??"http://localhost/";this.location=new Y(t),this.history=new J(this),this.document=new S,this.document.defaultView=this,Se(this.document)}matchMedia(e){return ge(this,e)}getComputedStyle(e){return e.style}requestAnimationFrame(e){return setTimeout(()=>e(Date.now()),0)}cancelAnimationFrame(e){clearTimeout(e)}setLocationUrl(e){this.location.href=e}installKeys(){return[...fe]}}function ke(e={}){return new ne(e)}function Pe(e,t=globalThis){let n=new Map,i=e.installKeys();for(let r of i)n.set(r,Object.getOwnPropertyDescriptor(t,r));for(let r of i)Object.defineProperty(t,r,{configurable:!0,enumerable:!0,writable:!0,value:e[r]});return Object.defineProperty(t,"window",{configurable:!0,enumerable:!0,writable:!0,value:e}),()=>{for(let r of i){let s=n.get(r);if(s)Object.defineProperty(t,r,s);else Reflect.deleteProperty(t,r)}}}function ye(e,t){let n=new _;if(t)n.ownerDocument=t;return Ee(n,e,t),[...n.childList]}function Ee(e,t,n){let i=[],r=e,s=0,l=t.length,a=(o)=>{if(o.ownerDocument===null)o.ownerDocument=n;r.appendChild(o)};while(s<l){let o=t.indexOf("<",s);if(o<0){a(new u(t.slice(s)));break}if(o>s)a(new u(t.slice(s,o)));if(t.startsWith("<!--",o)){let d=t.indexOf("-->",o+4),E=d<0?l:d;a(new w(t.slice(o+4,E))),s=d<0?l:d+3;continue}let h=ve(t,o);if(h<0){a(new u(t.slice(o)));break}let T=t.slice(o+1,h).trim();if(T.startsWith("/")){let d=T.slice(1).trim().toLowerCase();if(i.length>0&&i[i.length-1].localName===d)i.pop(),r=i[i.length-1]??e;s=h+1;continue}let ae=T.endsWith("/"),y=we(T.replace(/\/$/,"").trim());if(!y){s=h+1;continue}let v=m(y.name,n);for(let d of y.attributes)v.setAttribute(d.name,d.value);if(a(v),ie.has(y.name)||ae){s=h+1;continue}if(re.has(y.name)){let d=`</${y.name}>`,E=t.toLowerCase().indexOf(d,h+1),j=t.slice(h+1,E<0?l:E);v.appendChild(n?.createTextNode(j)??new u(j)),s=E<0?l:E+d.length;continue}i.push(v),r=v,s=h+1}}var ie=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),re=new Set(["script","style","textarea","title"]);function ve(e,t){let n=null;for(let i=t+1;i<e.length;i+=1){let r=e[i];if(n){if(r===n)n=null;continue}if(r==='"'||r==="'"){n=r;continue}if(r===">")return i}return-1}function we(e){let t=e.match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*(.*)$/);if(!t)return null;let n=t[1].toLowerCase(),i=[],r=t[2],s=/([a-zA-Z_:][a-zA-Z0-9_:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g,l;while((l=s.exec(r))!==null){let a=l[1],o=l[2]??l[3]??l[4]??"";i.push({name:a,value:Ne(o)})}return{name:n,attributes:i}}function Ne(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&nbsp;/g," ")}function se(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function F(e){return se(e).replace(/"/g,"&quot;")}function le(e){switch(e.nodeType){case 3:return se(e.data);case 8:return`<!--${e.data}-->`;case 1:return Te(e);default:return""}}function Te(e){let t=e.localName,n=[];for(let s of e.attributeEntries()){if(s.name==="style")continue;n.push(`${s.name}="${F(s.value)}"`)}let i=e.inlineStyleText();if(i)n.push(`style="${F(i)}"`);let r=n.length>0?` ${n.join(" ")}`:"";if(ie.has(t))return`<${t}${r}>`;if(re.has(t))return`<${t}${r}>${e.textContent}</${t}>`;return`<${t}${r}>${oe(e)}</${t}>`}function oe(e){return e.childList.map((t)=>le(t)).join("")}function xe(e){return e.split(",").map((t)=>{let n=[],i=0;while(i<t.length){while(i<t.length&&t[i]===" ")i+=1;if(i>=t.length)break;if(t[i]===">"){n.push({type:"child"}),i+=1;continue}let r=i;while(i<t.length&&t[i]!==" "&&t[i]!==">")i+=1;n.push(Le(t.slice(r,i)))}return n})}function Le(e){let t=[],n=0;while(n<e.length){let i=e[n];if(i==="*")t.push({type:"universal"}),n+=1;else if(i==="#"){let r=V(e,n+1);t.push({type:"id",id:e.slice(n+1,r)}),n=r}else if(i==="."){let r=V(e,n+1);t.push({type:"class",className:e.slice(n+1,r)}),n=r}else if(i==="["){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"'=<>`]+)))?$/);if(l)t.push({type:"attribute",name:l[1],operator:l[2],value:l[3]??l[4]??l[5]});else t.push({type:"attribute",name:s});n=r<0?e.length:r+1}else if(/[a-zA-Z_]/.test(i)){let r=V(e,n);t.push({type:"tag",name:e.slice(n,r).toLowerCase()}),n=r}else n+=1}if(t.length===1)return t[0];return{type:"compound",parts:t}}function V(e,t){let n=t;while(n<e.length&&/[a-zA-Z0-9:_-]/.test(e[n]))n+=1;return n}function ue(e,t){return xe(t).some((i)=>De(e,i))}function De(e,t){let n=t.length-1;if(n<0)return!0;if(!D(e,t[n]))return!1;if(n===0)return!0;let i=e.parentElement;n-=1;while(i){let r=t[n];if(!r)return!0;if(r.type==="child"){let s=t[n-1];if(!s||!D(i,s))return!1;if(n-=2,n<0)return!0;i=i.parentElement;continue}if(D(i,r)){if(n-=1,n<0)return!0}i=i.parentElement}return!1}function D(e,t){switch(t.type){case"universal":return!0;case"tag":return e.localName===t.name;case"id":return e.id===t.id;case"class":return e.classList.contains(t.className);case"attribute":return Ae(e,t);case"compound":return t.parts.every((n)=>D(e,n));case"child":return!1;default:return!1}}function Ae(e,t){let n=e.getAttribute(t.name);if(!t.operator)return n!==null;if(n===null)return!1;let i=t.value??"";switch(t.operator){case"=":return n===i;case"~=":return n.split(/\s+/).includes(i);case"|=":return n===i||n.startsWith(`${i}-`);case"^=":return n.startsWith(i);case"$=":return n.endsWith(i);case"*=":return n.includes(i);default:return!1}}function C(e,t){let n=[];return N(e,(i)=>{if(i!==e&&ue(i,t))n.push(i)}),new f(n)}function N(e,t){for(let n of e.childList)if(n.nodeType===1)t(n),N(n,t)}function m(e,t){let n=e.toLowerCase(),i;if(n==="input")i=new U(n);else if(n==="textarea")i=new B(n);else if(n==="select")i=new P(n);else if(n==="option")i=new k(n);else if(n==="button")i=new W(n);else if(n==="style")i=new z(n);else if(n==="a")i=new G(n);else i=new p(n);return i.ownerDocument=t,i}function Se(e){let t=e.createElement("html");t.setAttribute("lang","en"),e.appendChild(t);let n=e.createElement("head"),i=e.createElement("body");t.appendChild(n),t.appendChild(i)}function Ce(e){return new Proxy({},{get(n,i){if(typeof i==="symbol")return;return e.getAttribute(`data-${g(i)}`)??""},set(n,i,r){if(typeof i==="symbol")return!0;if(r===""||r===null||r===void 0)e.removeAttribute(`data-${g(i)}`);else e.setAttribute(`data-${g(i)}`,String(r));return!0},deleteProperty(n,i){if(typeof i!=="symbol")e.removeAttribute(`data-${g(i)}`);return!0},has(n,i){if(typeof i==="symbol")return!1;return e.hasAttribute(`data-${g(i)}`)},ownKeys(){let n=[];for(let i of e.attributeEntries())if(i.name.startsWith("data-"))n.push(Oe(i.name.slice(5)));return n},getOwnPropertyDescriptor(n,i){if(typeof i==="symbol")return;if(e.hasAttribute(`data-${g(i)}`))return{configurable:!0,enumerable:!0,writable:!0,value:e.getAttribute(`data-${g(i)}`)};return}})}function g(e){return e.replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Oe(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}export{w as Comment,I as CustomEvent,K as DOMException,X as DOMTokenList,fe as DOM_GLOBAL_KEYS,S as Document,_ as DocumentFragment,ce as DomNodeType,ne as DomWindow,M as Element,c as Event,A as EventTarget,G as HTMLAnchorElement,W as HTMLButtonElement,p as HTMLElement,U as HTMLInputElement,k as HTMLOptionElement,Q as HTMLOptionsCollection,P as HTMLSelectElement,z as HTMLStyleElement,B as HTMLTextAreaElement,J as History,H as KeyboardEvent,Y as Location,O as MouseEvent,Z as NamedNodeMap,te as Navigator,b as Node,f as NodeList,me as ResizeObserver,ee as Storage,u as Text,ke as createDomWindow,ge as createMatchMedia,R as createStyleDeclaration,Pe as installDomGlobals,ye as parseHtmlFragment};
2
+
3
+ //# debugId=6D3BCEF99138322664756E2164756E21
4
+ //# sourceMappingURL=index.js.map