what-core 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +64 -38
- package/a11y.d.ts +128 -0
- package/data.d.ts +294 -0
- package/dist/a11y.js +510 -0
- package/dist/a11y.min.js +413 -0
- package/dist/actions.js +158 -0
- package/dist/actions.min.js +112 -0
- package/dist/animation.js +481 -0
- package/dist/animation.min.js +295 -0
- package/dist/async.js +180 -0
- package/dist/async.min.js +134 -0
- package/dist/components.js +577 -0
- package/dist/components.min.js +413 -0
- package/dist/data.js +1212 -0
- package/dist/data.min.js +918 -0
- package/dist/diagnostics.js +187 -0
- package/dist/diagnostics.min.js +134 -0
- package/dist/dom.js +796 -0
- package/dist/dom.min.js +603 -0
- package/dist/entries/a11y.js +43 -0
- package/dist/entries/a11y.min.js +43 -0
- package/dist/entries/data.js +29 -0
- package/dist/entries/data.min.js +29 -0
- package/dist/entries/dom.js +45 -0
- package/dist/entries/dom.min.js +45 -0
- package/dist/entries/form.js +31 -0
- package/dist/entries/form.min.js +31 -0
- package/dist/entries/internal.js +123 -0
- package/dist/entries/internal.min.js +123 -0
- package/dist/entries/motion.js +23 -0
- package/dist/entries/motion.min.js +23 -0
- package/dist/entries/ui.js +25 -0
- package/dist/entries/ui.min.js +25 -0
- package/dist/env.js +5 -0
- package/dist/env.min.js +5 -0
- package/dist/errors.js +1518 -0
- package/dist/errors.min.js +548 -0
- package/dist/form.js +936 -0
- package/dist/form.min.js +703 -0
- package/dist/guardrails.js +84 -0
- package/dist/guardrails.min.js +55 -0
- package/dist/h.js +232 -0
- package/dist/h.min.js +171 -0
- package/dist/head.js +241 -0
- package/dist/head.min.js +207 -0
- package/dist/helpers.js +126 -0
- package/dist/helpers.min.js +98 -0
- package/dist/hooks.js +255 -0
- package/dist/hooks.min.js +153 -0
- package/dist/hot.js +215 -0
- package/dist/hot.min.js +24 -0
- package/dist/hydration-data.js +495 -0
- package/dist/hydration-data.min.js +371 -0
- package/dist/import-changes.js +273 -0
- package/dist/import-changes.min.js +272 -0
- package/dist/index.js +95 -0
- package/dist/index.min.js +95 -227
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-dev-runtime.min.js +10 -1
- package/dist/jsx-runtime.js +27 -0
- package/dist/jsx-runtime.min.js +15 -1
- package/dist/live.js +54 -0
- package/dist/live.min.js +49 -0
- package/dist/markup-rules.js +250 -0
- package/dist/markup-rules.min.js +213 -0
- package/dist/reactive.js +3334 -0
- package/dist/reactive.min.js +2033 -0
- package/dist/render.js +4746 -0
- package/dist/render.min.js +2797 -1
- package/dist/scheduler.js +225 -0
- package/dist/scheduler.min.js +162 -0
- package/dist/selector.js +11 -0
- package/dist/selector.min.js +10 -0
- package/dist/server-context.js +148 -0
- package/dist/server-context.min.js +121 -0
- package/dist/skeleton.js +342 -0
- package/dist/skeleton.min.js +310 -0
- package/dist/store.js +72 -0
- package/dist/store.min.js +50 -0
- package/dist/testing.js +720 -0
- package/dist/testing.min.js +458 -1
- package/dist/vnode-adoption.js +19 -0
- package/dist/vnode-adoption.min.js +19 -0
- package/dist/vnode-renderer.js +61 -0
- package/dist/vnode-renderer.min.js +47 -0
- package/dom.d.ts +44 -0
- package/form.d.ts +218 -0
- package/hot.d.ts +35 -0
- package/index.d.ts +421 -736
- package/internal.d.ts +284 -0
- package/jsx-runtime.d.ts +160 -137
- package/markup-rules.d.ts +83 -0
- package/motion.d.ts +156 -0
- package/package.json +117 -3
- package/render.d.ts +278 -29
- package/src/a11y.js +64 -59
- package/src/actions.js +226 -0
- package/src/animation.js +105 -57
- package/src/async.js +259 -0
- package/src/components.js +495 -144
- package/src/data.js +1410 -1159
- package/src/diagnostics.js +263 -0
- package/src/dom.js +1159 -872
- package/src/entries/a11y.js +24 -0
- package/src/entries/data.js +17 -0
- package/src/entries/dom.js +29 -0
- package/src/entries/form.js +16 -0
- package/src/entries/internal.js +63 -0
- package/src/entries/motion.js +13 -0
- package/src/entries/ui.js +13 -0
- package/src/env-development.js +12 -0
- package/src/env.js +33 -0
- package/src/errors.js +1144 -168
- package/src/form.js +723 -225
- package/src/guardrails.js +38 -126
- package/src/h.js +227 -152
- package/src/head.js +189 -19
- package/src/helpers.js +47 -75
- package/src/hooks.js +233 -248
- package/src/hot.js +316 -0
- package/src/hydration-data.js +859 -16
- package/src/import-changes.js +156 -0
- package/src/index.js +38 -188
- package/src/jsx-dev-runtime.js +7 -14
- package/src/jsx-runtime.js +25 -9
- package/src/live.js +80 -0
- package/src/markup-rules.js +387 -0
- package/src/reactive.js +4400 -862
- package/src/render.js +6502 -2570
- package/src/scheduler.js +56 -21
- package/src/selector.js +31 -0
- package/src/server-context.js +252 -22
- package/src/skeleton.js +22 -12
- package/src/store.js +17 -31
- package/src/testing.js +389 -63
- package/src/vnode-adoption.js +48 -0
- package/src/vnode-renderer.js +114 -0
- package/testing.d.ts +81 -1
- package/ui.d.ts +20 -0
- package/dist/chunk-6YOUZ6T4.min.js +0 -1
- package/dist/chunk-FN6HXME3.min.js +0 -11
- package/dist/chunk-VKZY7JPN.min.js +0 -1
- package/src/agent-context.js +0 -127
- package/src/warnings.js +0 -193
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// What Framework - vnodes, and the vnode renderer slot
|
|
2
|
+
//
|
|
3
|
+
// Compiled JSX builds DOM directly and never produces a vnode. Vnodes come from
|
|
4
|
+
// h(), the automatic JSX runtime and the components built on them, and rendering
|
|
5
|
+
// one needs dom.js's createDOM with the element, prop, boundary and portal code
|
|
6
|
+
// behind it. render.js reaches that renderer only through this slot, which h.js
|
|
7
|
+
// fills when it is imported, so a bundle with no vnode producer never contains
|
|
8
|
+
// createDOM.
|
|
9
|
+
//
|
|
10
|
+
// This module must stay import-free. h.js fills the slot while the
|
|
11
|
+
// render.js -> dom.js -> components.js -> h.js import cycle is still evaluating,
|
|
12
|
+
// and a binding declared in any module of that cycle can still be in its
|
|
13
|
+
// temporal dead zone at that moment.
|
|
14
|
+
|
|
15
|
+
// A vnode is an instance of VNode, and every renderer (the client's, both of
|
|
16
|
+
// what-server's, its compiled-markup runtime) recognises one by the private
|
|
17
|
+
// brand alone. JSON, structuredClone, a store proxy and a Proxy that answers
|
|
18
|
+
// every property cannot produce it: `#brand in value` consults no trap and no
|
|
19
|
+
// own property, so `{ "tag": "div", "props": { "dangerouslySetInnerHTML": … } }`
|
|
20
|
+
// arriving from data renders as the text it is. h(), the JSX runtime and
|
|
21
|
+
// _vnode (h.js) are the producers; a library making elements calls one of them.
|
|
22
|
+
//
|
|
23
|
+
// A program can hold two copies of what-core: a server bundle that inlined one
|
|
24
|
+
// while the server renderer imports another (a linked workspace package), or
|
|
25
|
+
// two installed versions. Each copy's class has a brand of its own, so the
|
|
26
|
+
// first vnode a copy makes registers its brand check where every copy finds it
|
|
27
|
+
// (a global set, keyed by a registered symbol), and a value another copy made
|
|
28
|
+
// is a vnode too.
|
|
29
|
+
const BRANDS = Symbol.for('what-core.vnode.v1');
|
|
30
|
+
let registered = false;
|
|
31
|
+
|
|
32
|
+
export class VNode {
|
|
33
|
+
#brand;
|
|
34
|
+
|
|
35
|
+
constructor(tag, props, children, key) {
|
|
36
|
+
this.tag = tag;
|
|
37
|
+
this.props = props;
|
|
38
|
+
this.children = children;
|
|
39
|
+
this.key = key;
|
|
40
|
+
if (!registered) {
|
|
41
|
+
registered = true;
|
|
42
|
+
/** @type {any} */
|
|
43
|
+
const global = globalThis;
|
|
44
|
+
(global[BRANDS] ??= new Set()).add(VNode.own);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static own(value) {
|
|
49
|
+
return #brand in value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static is(value) {
|
|
53
|
+
if (typeof value !== 'object' || value === null) return false;
|
|
54
|
+
if (#brand in value) return true;
|
|
55
|
+
const brands = /** @type {any} */ (globalThis)[BRANDS];
|
|
56
|
+
// Another copy's brand is in the set only when it holds more than this
|
|
57
|
+
// copy's own: nothing else is asked then (an iterator per object asked).
|
|
58
|
+
if (brands !== undefined && brands.size > (registered ? 1 : 0)) {
|
|
59
|
+
for (const own of brands) if (own !== VNode.own && own(value)) return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Whether `value` is a vnode made by h(), the JSX runtime or a boundary, in this copy of what-core or another. */
|
|
66
|
+
export function isVNode(value) {
|
|
67
|
+
return VNode.is(value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** @type {((vnode: any, parent?: any, isSvg?: boolean, inParent?: 1) => Node) | null} */
|
|
71
|
+
export let vnodeRenderer = null;
|
|
72
|
+
|
|
73
|
+
// The elements only SVG has, by name in any case (`clipPath`, `clippath`): the
|
|
74
|
+
// vnode renderer creates one in SVG wherever it stands (dom.js
|
|
75
|
+
// createElementFromVNode), as what-compiler places a template root by its tag,
|
|
76
|
+
// and so does a tag held in a binding (render.js tagElement).
|
|
77
|
+
export const SVG_TAG = /^(?:svg|animate(?:motion|transform)?|circle|clippath|defs|desc|ellipse|fe[a-z]+|filter|foreignobject|g|image|line|lineargradient|marker|mask|metadata|mpath|path|pattern|poly(?:gon|line)|radialgradient|rect|set|stop|switch|symbol|text|textpath|tspan|use|view)$/i;
|
|
78
|
+
|
|
79
|
+
// The keyed vnode rows a reactive region renders a keyed vnode list through
|
|
80
|
+
// (render.js _vnodeRows), installed with the renderer for the same reason, and
|
|
81
|
+
// what hydrate() writes a vnode's props onto the element it claims with: the
|
|
82
|
+
// renderer's prop writer (dom.js _setVNodeProp) and the attribute rules it
|
|
83
|
+
// refuses values by (dom.js _isUnsafeAttr). A bundle whose only JSX is
|
|
84
|
+
// compiled carries none of them.
|
|
85
|
+
/** @type {(((value: any, rows: any, isSvg: boolean, scope: any, end?: any, adopted?: any) => any) & { adopt?: (value: any, scope: any, open: Comment, close: Comment) => any }) | null} */
|
|
86
|
+
export let vnodeRows = null;
|
|
87
|
+
/** @type {((el: any, key: string, value: any, isSvg: boolean) => void) | null} */
|
|
88
|
+
export let vnodeProp = null;
|
|
89
|
+
/** @type {((key: string, value: any) => boolean) | null} */
|
|
90
|
+
export let vnodeRefuses = null;
|
|
91
|
+
|
|
92
|
+
export function _installVNodeRuntime(render, keyedRows, setProp, refuses) {
|
|
93
|
+
vnodeRenderer = render;
|
|
94
|
+
// Every vnode carries this copy's renderer, for a copy of what-core that
|
|
95
|
+
// has none to render it with (render.js valuesToNodes): a vnode is
|
|
96
|
+
// rendered by the copy that made it.
|
|
97
|
+
/** @type {any} */ (VNode.prototype)._$r = render;
|
|
98
|
+
vnodeRows = keyedRows;
|
|
99
|
+
vnodeProp = setProp;
|
|
100
|
+
vnodeRefuses = refuses;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @internal what-react/mixed: the rows a region renders its value through are
|
|
105
|
+
* `wrap(rows)` from now on, around the ones installed now (null when none
|
|
106
|
+
* are): what-react renders a value that holds one of its elements through
|
|
107
|
+
* rows of its own (an element's props changing, a row moving, an unkeyed
|
|
108
|
+
* list) and leaves any other to `rows`, and its `adopt(value, scope, open,
|
|
109
|
+
* close)` gives the rows that take a hydrating region's server nodes for
|
|
110
|
+
* such a value, or null.
|
|
111
|
+
*/
|
|
112
|
+
export function _installForeignRows(wrap) {
|
|
113
|
+
vnodeRows = wrap(vnodeRows);
|
|
114
|
+
}
|
package/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// What Framework - Testing Utilities Type Definitions
|
|
2
2
|
|
|
3
|
-
import { VNode, Signal } from './index.js';
|
|
3
|
+
import { VNode, Signal, DiagnosticEvent } from './index.js';
|
|
4
4
|
|
|
5
5
|
// Setup and Cleanup
|
|
6
6
|
export function setupDOM(): HTMLElement | null;
|
|
@@ -53,7 +53,18 @@ export function waitFor<T>(callback: () => T, options?: WaitOptions): Promise<T>
|
|
|
53
53
|
export function waitForElementToBeRemoved(callback: () => HTMLElement | null, options?: WaitOptions): Promise<void>;
|
|
54
54
|
|
|
55
55
|
// Act
|
|
56
|
+
/**
|
|
57
|
+
* Run `callback`, then wait until what it started has landed and committed:
|
|
58
|
+
* queued effects, the async values it made fetch, the transitions it opened
|
|
59
|
+
* (`settled()`). Never resolves while something keeps fetching (polling).
|
|
60
|
+
*/
|
|
56
61
|
export function act<T>(callback: () => T | Promise<T>): Promise<T>;
|
|
62
|
+
/**
|
|
63
|
+
* The root entry's settled(): resolves once nothing is queued or flushing, no
|
|
64
|
+
* async value is fetching, no transition is open and no <Suspense> waits on a
|
|
65
|
+
* promise. Act, then `await settled()`, then read the DOM.
|
|
66
|
+
*/
|
|
67
|
+
export function settled(): Promise<void>;
|
|
57
68
|
|
|
58
69
|
// Signal Testing Helpers
|
|
59
70
|
export interface TestSignal<T> {
|
|
@@ -139,6 +150,75 @@ export function flushEffects(): void;
|
|
|
139
150
|
*/
|
|
140
151
|
export function trackSignals(fn: () => void): { accessed: string[]; written: string[] };
|
|
141
152
|
|
|
153
|
+
// --- captureDiagnostics ---
|
|
154
|
+
// Diagnostics reported and effect runs counted while a callback ran.
|
|
155
|
+
|
|
156
|
+
/** An effect or computed that ran during a capture, or was known to exist then. */
|
|
157
|
+
export interface CapturedEffect {
|
|
158
|
+
/** The effect or computed function's name, `'(anonymous)'` otherwise. */
|
|
159
|
+
name: string;
|
|
160
|
+
kind: 'effect' | 'computed';
|
|
161
|
+
/**
|
|
162
|
+
* The components that hold it in the owner tree, root first
|
|
163
|
+
* (`['<App>', '<TodoRow>']`), as diagnostics print `owner`: the component
|
|
164
|
+
* whose body, output, region or list row created it, or whose effect,
|
|
165
|
+
* `useEffect` or `onMount` run created it. `null` when no component holds
|
|
166
|
+
* it: created at module scope, or in a `createRoot` outside any component.
|
|
167
|
+
*/
|
|
168
|
+
owner: string[] | null;
|
|
169
|
+
/** Runs during the capture: 0 for one that existed and did not run. */
|
|
170
|
+
runs: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface CapturedDiagnostics<R = unknown> {
|
|
174
|
+
/** Diagnostics reported during the callback, folded by code and subject. */
|
|
175
|
+
events: DiagnosticEvent[];
|
|
176
|
+
/** Effect and computed runs during the callback, keyed by function name ('(anonymous)' otherwise). */
|
|
177
|
+
runs: Record<string, number>;
|
|
178
|
+
/** Each effect and computed that ran during the callback or was known to exist then, with its owner. */
|
|
179
|
+
effects: CapturedEffect[];
|
|
180
|
+
/** The callback's return value (awaited when it returned a promise). */
|
|
181
|
+
result: R;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** How many times: `exact`, or `min` and/or `max`. With none of them, at least once. */
|
|
185
|
+
export type CountOptions =
|
|
186
|
+
| { exact: number; min?: never; max?: never }
|
|
187
|
+
| { exact?: never; min?: number; max?: number };
|
|
188
|
+
|
|
189
|
+
export type ExpectDiagnosticOptions = CountOptions & {
|
|
190
|
+
/** The `ERR_*` code. Occurrences add up each event's folded `count`. */
|
|
191
|
+
code: string;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export type ExpectRunsOptions = CountOptions & {
|
|
195
|
+
/** Only effects and computeds with this function name. */
|
|
196
|
+
effect?: string;
|
|
197
|
+
/** Only those created in this component (by name) or in a component inside it. */
|
|
198
|
+
component?: string;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Run `fn` and capture the diagnostics it reported and the effects it ran.
|
|
203
|
+
* Reports stay off the console while the capture is open. Development builds
|
|
204
|
+
* only: throws in production, where nothing is reported.
|
|
205
|
+
*/
|
|
206
|
+
export function captureDiagnostics<R>(fn: () => Promise<R>): Promise<CapturedDiagnostics<R>>;
|
|
207
|
+
export function captureDiagnostics<R>(fn: () => R): CapturedDiagnostics<R>;
|
|
208
|
+
|
|
209
|
+
/** Throw unless the capture holds no diagnostics other than the `allow`ed codes. The message lists each code, owner, location and fix. */
|
|
210
|
+
export function expectNoDiagnostics(captured: { events: DiagnosticEvent[] }, options?: { allow?: string[] }): void;
|
|
211
|
+
/** Throw unless the capture holds `code` and no other code, reported the given number of times (at least once by default). */
|
|
212
|
+
export function expectDiagnostic(captured: { events: DiagnosticEvent[] }, options: ExpectDiagnosticOptions): void;
|
|
213
|
+
/**
|
|
214
|
+
* Throw unless the selected effects ran the given number of times during the
|
|
215
|
+
* capture (at least once by default). With neither `effect` nor `component`,
|
|
216
|
+
* every effect and computed run counts: the whole interaction. A name or
|
|
217
|
+
* component that matches nothing that ran or was known to exist throws, listing
|
|
218
|
+
* what ran. An effect outside any component (`owner: null`) is in no component's count.
|
|
219
|
+
*/
|
|
220
|
+
export function expectRuns(captured: { effects: CapturedEffect[] }, options?: ExpectRunsOptions): void;
|
|
221
|
+
|
|
142
222
|
// --- mockSignal ---
|
|
143
223
|
// A signal that records every distinct value it has held.
|
|
144
224
|
|
package/ui.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// what-core/ui (what-framework/ui): skeletons and loading placeholders.
|
|
2
|
+
import type { VNode } from './index.js';
|
|
3
|
+
|
|
4
|
+
// --- Skeleton ---
|
|
5
|
+
|
|
6
|
+
export function Skeleton(props?: Record<string, any>): VNode;
|
|
7
|
+
export function SkeletonText(props?: Record<string, any>): VNode;
|
|
8
|
+
export function SkeletonAvatar(props?: Record<string, any>): VNode;
|
|
9
|
+
export function SkeletonCard(props?: Record<string, any>): VNode;
|
|
10
|
+
export function SkeletonTable(props?: Record<string, any>): VNode;
|
|
11
|
+
export function IslandSkeleton(props?: Record<string, any>): VNode;
|
|
12
|
+
export function useSkeleton<T>(asyncFn: () => Promise<T> | T, deps?: unknown[]): {
|
|
13
|
+
isLoading: () => boolean;
|
|
14
|
+
data: () => T | null;
|
|
15
|
+
error: () => any;
|
|
16
|
+
Skeleton: (props?: Record<string, any>) => VNode;
|
|
17
|
+
};
|
|
18
|
+
export function Placeholder(props?: Record<string, any>): VNode;
|
|
19
|
+
export function LoadingDots(props?: Record<string, any>): VNode;
|
|
20
|
+
export function Spinner(props?: Record<string, any>): VNode;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var w=Object.create(null),p=[];function y(e,n){n=n||w;let f=arguments.length,l;if(f<=2)l=p;else if(f===3)l=_(arguments[2]);else{let t=[];for(let u=2;u<f;u++)x(arguments[u],t);l=t}let i=n.key??null;return n.key!==void 0&&(n={...n},delete n.key),{tag:e,props:n,children:l,key:i,_vnode:!0}}function T({children:e}){return e}function _(e){if(e==null||e===!1||e===!0)return p;if(Array.isArray(e)){let n=[];return x(e,n),n}if(typeof e=="object"){if(e._vnode)return[e];if(typeof e.nodeType=="number")return[e]}return typeof e=="function"?[e]:[String(e)]}function x(e,n){if(!(e==null||e===!1||e===!0))if(Array.isArray(e))for(let f=0;f<e.length;f++)x(e[f],n);else typeof e=="object"?e._vnode||typeof e.nodeType=="number"?n.push(e):n.push(String(e)):typeof e=="function"?n.push(e):n.push(String(e))}function j(e,...n){let f=e.reduce((l,i,t)=>l+i+(t<n.length?`\0${t}\0`:""),"");return c(f,n)}function c(e,n){e=e.trim();let f=[],l=0;for(;l<e.length;){if(e[l]==="<"){let t=b(e,l,n);if(t){f.push(t.node),l=t.end;continue}}let i=A(e,l,n);i.text&&f.push(i.text),l=i.end}return f.length===1?f[0]:f}function b(e,n,f){let l=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\w*)/);if(!l)return null;let i=l[1],t=n+l[0].length,u={};for(;t<e.length;){for(;t<e.length&&/\s/.test(e[t]);)t++;if(e.slice(t,t+2)==="/>")return{node:y(i,Object.keys(u).length?u:null),end:t+2};if(e[t]===">"){t++;break}if(e.slice(t,t+3)==="..."){let a=e.slice(t+3).match(/^\x00(\d+)\x00/);if(a){Object.assign(u,f[Number(a[1])]),t+=3+a[0].length;continue}}let o=e.slice(t).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);if(!o)break;let r=o[1];for(t+=o[0].length;t<e.length&&/\s/.test(e[t]);)t++;if(e[t]==="="){for(t++;t<e.length&&/\s/.test(e[t]);)t++;let a=e.slice(t).match(/^\x00(\d+)\x00/);if(a)u[r]=f[Number(a[1])],t+=a[0].length;else if(e[t]==='"'||e[t]==="'"){let k=e[t];t++;let s="";for(;t<e.length&&e[t]!==k;){let m=e.slice(t).match(/^\x00(\d+)\x00/);m?(s+=String(f[Number(m[1])]),t+=m[0].length):(s+=e[t],t++)}t++,u[r]=s}}else u[r]=!0}let g=[],h=`</${i}>`;for(;t<e.length;){if(e.slice(t,t+h.length)===h){t+=h.length;break}if(e[t]==="<"){let r=b(e,t,f);if(r){g.push(r.node),t=r.end;continue}}let o=A(e,t,f);o.text!=null&&g.push(o.text),t=o.end}return{node:y(i,Object.keys(u).length?u:null,...g),end:t}}function A(e,n,f){let l=n,i="";for(;l<e.length&&e[l]!=="<";){let t=e.slice(l).match(/^\x00(\d+)\x00/);if(t)return i.trim()?{text:i.trim(),end:l}:{text:f[Number(t[1])],end:l+t[0].length};i+=e[l],l++}return{text:i.trim()||null,end:l}}export{y as a,T as b,j as c};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{E as Nt,Q as q,R as Bt,T as v,U as ct,V as O,W as yt,Y as W,Z as Mt,_ as F,a as z,ba as Dt,ca as Ht,d as I,da as mt,f as j,j as Tt,n as Q,r as St,z as Lt}from"./chunk-VKZY7JPN.min.js";import{a as Z}from"./chunk-6YOUZ6T4.min.js";var jt=I(null);typeof document<"u"&&document.addEventListener("focusin",t=>{jt.set(t.target)});function Me(){return{current:()=>jt(),focus:t=>t?.focus(),blur:()=>document.activeElement?.blur()}}function De(){let t={current:null};function e(r){typeof document>"u"||(t.current=r||document.activeElement||null)}function n(r){let o=t.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:e,restore:n,previous:()=>t.current}}function te(t){let e=null;function n(){if(typeof document>"u")return;e=document.activeElement;let o=t.current||t;if(!o||typeof o.querySelectorAll!="function")return;let i=Pt(o);if(i.length===0)return;i[0].focus();function g(c){if(c.key!=="Tab")return;let p=Pt(o),l=p[0],d=p[p.length-1];c.shiftKey?document.activeElement===l&&(c.preventDefault(),d.focus()):document.activeElement===d&&(c.preventDefault(),l.focus())}return o.addEventListener("keydown",g),()=>{o.removeEventListener("keydown",g)}}function r(){e&&typeof e.focus=="function"&&e.focus()}return{activate:n,deactivate:r}}function Pt(t){let e=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(n=>n.offsetParent!==null)}function He({children:t,active:e=!0}){let n={current:null},r=I(0),o=te(n),i=null,g=l=>{n.current=l,r.set(d=>d+1)},c=j(()=>{if(r(),i&&(i(),i=null,o.deactivate()),e&&n.current)return i=o.activate(),()=>{i?.(),i=null,o.deactivate()}}),p=Mt?.();return p&&(p._cleanupCallbacks=p._cleanupCallbacks||[],p._cleanupCallbacks.push(()=>{c(),i?.(),i=null,o.deactivate()})),Z("div",{ref:g},t)}var k=null,bt=0;function ee(){return typeof document>"u"?null:(k||(k=document.createElement("div"),k.id="what-announcer",k.setAttribute("aria-live","polite"),k.setAttribute("aria-atomic","true"),k.style.cssText=`
|
|
2
|
-
position: absolute;
|
|
3
|
-
width: 1px;
|
|
4
|
-
height: 1px;
|
|
5
|
-
padding: 0;
|
|
6
|
-
margin: -1px;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
clip: rect(0, 0, 0, 0);
|
|
9
|
-
white-space: nowrap;
|
|
10
|
-
border: 0;
|
|
11
|
-
`,document.body.appendChild(k)),k)}function ne(t,e={}){let{priority:n="polite",timeout:r=1e3}=e,o=ee();if(!o)return;o.setAttribute("aria-live",n);let i=++bt;o.textContent="",requestAnimationFrame(()=>{bt===i&&(o.textContent=t)}),setTimeout(()=>{bt===i&&(o.textContent="")},r)}function Pe(t){return ne(t,{priority:"assertive"})}function je({href:t="#main",children:e="Skip to content"}){return Z("a",{href:t,class:"what-skip-link",onClick:n=>{n.preventDefault();let r=document.querySelector(t);r&&(r.focus(),r.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},e)}function xt(t){return t?"true":"false"}function Re(t=!1){let e=I(t);return{expanded:()=>e(),toggle:()=>e.set(!e.peek()),open:()=>e.set(!0),close:()=>e.set(!1),buttonProps:()=>({"aria-expanded":()=>xt(e()),onClick:()=>e.set(!e.peek())}),panelProps:()=>({hidden:()=>!e()})}}function $e(t=null){let e=I(t);return{selected:()=>e(),select:n=>e.set(n),isSelected:n=>e()===n,itemProps:n=>({"aria-selected":()=>xt(e()===n),onClick:()=>e.set(n)})}}function Ke(t=!1){let e=I(t);return{checked:()=>e(),toggle:()=>e.set(!e.peek()),set:n=>e.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":()=>xt(e()),tabIndex:0,onClick:()=>e.set(!e.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.set(!e.peek()))}})}}function Oe(t,e={}){let n=typeof t=="function"?t:()=>t,r=I(0),o=e?.role||null,i=[],g=[],c=[];function p(h){let s=g[h];return s||(s={get current(){return i[h]||null},set current(a){i[h]=a||null;let x=c[h];typeof x=="function"?x(a):x&&typeof x=="object"&&(x.current=a)}},g[h]=s),s}function l(h){let s=i[h];return s?s.isConnected===!1?null:s:null}function d(h){let s=l(h);return!s||typeof s.focus!="function"?null:((typeof document>"u"||document.activeElement!==s)&&s.focus(),s)}function f(){if(typeof document>"u")return!1;let h=document.activeElement;if(!h)return!1;for(let s=0;s<i.length;s++){let a=i[s];if(a&&(a===h||typeof a.contains=="function"&&a.contains(h)))return!0}return!1}function m(h,s){return!(s>0)||h<0?0:h>s-1?s-1:h}function b(){return m(r(),n())}function y(h){return Number.isInteger(h)&&h>=0&&h<n()}function _(h){let s=n();if(s<=0)return;let a=m(r.peek(),s),x=a;switch(h.key){case"ArrowDown":case"ArrowRight":x=(a+1)%s;break;case"ArrowUp":case"ArrowLeft":x=(a-1+s)%s;break;case"Home":x=0;break;case"End":x=s-1;break;default:return}h.preventDefault(),r.set(x),d(x)}return{focusIndex:()=>b(),setFocusIndex:h=>{y(h)&&(r.set(h),f()&&d(h))},focusItem:h=>y(h)?(r.set(h),d(h)):null,getItemProps:(h,s)=>{let{ref:a,...x}=s||{};return c[h]=a||null,{ref:p(h),tabIndex:()=>b()===h?0:-1,onKeyDown:_,onFocus:S=>{let D=S&&(S.currentTarget||S.target);D&&(i[h]=D),r.set(h)},...x}},containerProps:h=>o?{role:o,...h}:{...h}}}function Ie({children:t,as:e="span"}){return Z(e,{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}},t)}function Ve({children:t,priority:e="polite",atomic:n=!0}){return Z("div",{"aria-live":e,"aria-atomic":n},t)}var Rt=0;function $t(){let t=St();return t?(t.idCounter=(t.idCounter||0)+1,t.idCounter):++Rt}function Kt(){Rt=0}function Ot(t="what"){let e=`${t}-${$t()}`;return()=>e}function ze(t,e="what"){let n=[];for(let r=0;r<t;r++)n.push(`${e}-${$t()}`);return n}function ke(t){let e=Ot("desc");return{descriptionId:e,descriptionProps:()=>({id:e(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":e()}),Description:()=>Z("div",{id:e(),style:{display:"none"}},t)}}function Ge(t){let e=Ot("label");return{labelId:e,labelProps:()=>({id:e()}),labelledByProps:()=>({"aria-labelledby":e()})}}var Ue={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function qe(t,e){return n=>{n.key===t&&e(n)}}function We(t,e){return n=>{t.includes(n.key)&&e(n)}}var nt=null;function Fe(t){nt=typeof t=="function"?t:null}function re(t,e,n){if(typeof n=="function"){let r=()=>{let o=n();return o.length===1?o[0]:o};return r._lazyChildren=!0,e=e?Object.assign({},e):{},Object.defineProperty(e,"_$lazyChildren",{value:r,configurable:!0}),{tag:t,props:e,children:[],key:null,_vnode:!0}}if(n&&n.length>0){let r=n.length===1?n[0]:n;e=e?Object.assign({},e,{children:r}):{children:r}}return{tag:t,props:e||{},children:n||[],key:null,_vnode:!0}}function tn(t,e,n){return W(re(t,e,n))}var oe={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},ie=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function Gt(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function ce(t){let e=t.trim(),n=Gt(e);if(ie.has(n))return fe(e);let r=oe[n];if(r){let i=document.createElement("template");i.innerHTML=r.wrap+e+r.unwrap;let g=i.content.firstChild;for(let c=0;c<r.depth;c++)g=g.firstChild;return()=>g.cloneNode(!0)}let o=document.createElement("template");if(o.innerHTML=e,z&&o.content.childNodes.length!==1){let i=[...o.content.childNodes].find((g,c)=>c>0&&g.nodeType===1);throw Object.assign(new Error(`[what] <${n}> cannot contain <${i?i.nodeName.toLowerCase():"that element"}>: the HTML parser closed the outer tag early, so the rendered tree does not match your JSX.`),{code:"ERR_INVALID_HTML_NESTING"})}return()=>o.content.firstChild.cloneNode(!0)}var It=!1;function en(t){return z&&!It&&(It=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),ce(t)}function fe(t){let e=t.trim();if(Gt(e)==="svg"){let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function Ut(t,e){if(!t)return;let n=!1,r=()=>{n||(n=!0,e())},o=t._dispose;t._dispose=o?()=>{o(),r()}:r}function qt(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return qt(t,e(),n);if(typeof e=="function"){let r=n||null,o=null,i=null,g=!1,c=Et(),p=j(()=>Xt(c,()=>{let l=e(),d=typeof l;if(!g){g=!0,d==="string"||d==="number"?(i=document.createTextNode(String(l)),r?t.insertBefore(i,r):t.appendChild(i),nt&&nt(t,String(l)),o=i):o=st(t,l,null,r);return}if(i!==null&&(d==="string"||d==="number")){let f=String(l);i.data!==f&&(i.data=f),nt&&nt(t,f);return}i=null,o=st(t,l,o,r)}));return Ut(r||t,p),o}if(typeof e=="string"||typeof e=="number"){let r=document.createTextNode(String(e));return n?t.insertBefore(r,n):t.appendChild(r),r}return e!=null&&typeof e=="object"&&e.nodeType>0?(n?t.insertBefore(e,n):t.appendChild(e),e):st(t,e,null,n||null)}function Wt(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function se(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var dt=typeof SVGElement<"u";function At(t){return dt&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function Et(){let t=F();return t[t.length-1]||null}function Xt(t,e){let n=F(),r=t!==null&&n[n.length-1]!==t;r&&n.push(t);try{return e()}finally{r&&n.pop()}}function Vt(t){return t==null?[]:Array.isArray(t)?t:[t]}function Jt(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let r=0;r<t.length;r++)Jt(t[r],e,n);return n}if(typeof t=="function"){let r=W(t,e,At(e));if(r&&r.nodeType===11){let o=Array.from(r.childNodes);for(let i=0;i<o.length;i++)n.push(o[i])}else r&&n.push(r);return n}if(typeof t=="string"||typeof t=="number")return n.push(document.createTextNode(String(t))),n;if(Wt(t)){if(t.nodeType===11&&t.childNodes.length>0){let r=Array.from(t.childNodes);for(let o=0;o<r.length;o++)n.push(r[o])}else n.push(t);return n}if(se(t)){let r=W(t,e,At(e));if(r&&r.nodeType===11)if(r.childNodes.length===0)n.push(r);else{let o=Array.from(r.childNodes);for(let i=0;i<o.length;i++)n.push(o[i])}else r&&n.push(r);return n}return n.push(document.createTextNode(String(t))),n}function le(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function st(t,e,n,r){if(!t||typeof t.insertBefore!="function")return z&&console.warn("[what] reconcileInsert called with invalid parent:",t),n;let o=r||null;if(e==null||typeof e=="boolean"){let d=yt(Vt(n));for(let f=0;f<d.length;f++){let m=d[f];m.parentNode===t&&(O(m),t.removeChild(m))}return null}if((typeof e=="string"||typeof e=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let d=String(e);return n.data!==d&&(n.data=d),n}if(typeof e=="object"&&e!==null&&e.nodeType>0&&e.nodeType!==11&&!Array.isArray(e)){if(e===n)return n;if(n&&!Array.isArray(n)&&n.nodeType>0&&n.nodeType!==11)return n.parentNode===t?(O(n),t.replaceChild(e,n)):o?t.insertBefore(e,o):t.appendChild(e),e}let i=Jt(e,t,[]),g=Vt(n);if(le(g,i))return n;let c=yt(g),p=i.length;for(let d=0;d<c.length;d++){let f=c[d];if(f.parentNode!==t)continue;let m=!1;for(let b=0;b<p;b++)if(i[b]===f){m=!0;break}m||(O(f),t.removeChild(f))}let l=o;for(let d=i.length-1;d>=0;d--){let f=i[d];(f.parentNode!==t||f.nextSibling!==l)&&(l&&l.parentNode!==t&&(l=null),l?t.insertBefore(f,l):t.appendChild(f)),l=f}return i.length===0?null:i.length===1?i[0]:i}function nn(t,e,n){let r=n?.key,o=n?.raw||!1,i=(g,c)=>{let p=[],l=[],d=[],f=r&&!o?new Map:null,m=document.createComment("/list");g.insertBefore(m,c||null);let b=j(()=>{let y=t()||[],_=m.parentNode||g;r?pe(_,m,p,y,l,d,e,r,f):ue(_,m,p,y,l,d,e),p=y.length>0?y.slice():y});return Ut(m,()=>{b();for(let y=0;y<d.length;y++)d[y]?.();d.length=0}),m};return i._mapArray=!0,i._mapArraySource=t,i._mapArrayFn=e,i._mapArrayKeyed=!!r&&!o,i}function rn(t){let e=t._mapArraySource()||[],n=t._mapArrayFn,r=t._mapArrayKeyed;return e.map((o,i)=>n(r?()=>o:o,i))}function ue(t,e,n,r,o,i,g){let c=r.length,p=n.length;if(c===0){if(p>0){for(let s=0;s<p;s++)i[s]&&i[s]();for(let s=p-1;s>=0;s--){let a=o[s];a&&(O(a),a.parentNode===t&&t.removeChild(a))}o.length=0,i.length=0}return}if(p===0){let s=document.createDocumentFragment();for(let a=0;a<c;a++){let x=r[a],S=Q(D=>(i[a]=D,g(x,a)));o[a]=S,s.appendChild(S)}t.insertBefore(s,e);return}let l=0,d=Math.min(p,c);for(;l<d&&n[l]===r[l];)l++;if(l===p&&l===c)return;let f=p-1,m=c-1;for(;f>=l&&m>=l&&n[f]===r[m];)f--,m--;let b=new Array(c),y=new Array(c);for(let s=0;s<l;s++)b[s]=o[s],y[s]=i[s];for(let s=m+1;s<c;s++){let a=f+1+(s-m-1);b[s]=o[a],y[s]=i[a]}let _=m-l+1,h=f-l+1;if(_===0)for(let s=l;s<=f;s++)i[s]?.(),o[s]&&O(o[s]),o[s]?.parentNode&&o[s].parentNode.removeChild(o[s]);else if(h===0){let s=l<c&&b[m+1]?b[m+1]:e,a=document.createDocumentFragment();for(let x=l;x<=m;x++){let S=r[x],D=x;b[x]=Q(N=>(y[D]=N,g(S,D))),a.appendChild(b[x])}t.insertBefore(a,s)}else ae(t,e,n,r,o,i,g,l,f,m,b,y);o.length=c,i.length=c;for(let s=0;s<c;s++)o[s]=b[s],i[s]=y[s]}function ae(t,e,n,r,o,i,g,c,p,l,d,f){let m=new Map;for(let a=c;a<=p;a++)m.set(n[a],a);let b=l-c+1,y=new Int32Array(b);y.fill(-1);for(let a=c;a<=l;a++){let x=m.get(r[a]);x!==void 0&&(m.delete(r[a]),d[a]=o[x],f[a]=i[x],y[a-c]=x)}for(let[,a]of m)i[a]?.(),o[a]&&O(o[a]),o[a]?.parentNode&&o[a].parentNode.removeChild(o[a]);let _=b-de(y,b),h=new Uint8Array(b);if(_>1){let a=new Int32Array(_),x=new Int32Array(_),S=0;for(let N=0;N<b;N++)y[N]!==-1&&(a[S]=y[N],x[S]=N,S++);let D=Zt(a,_);for(let N=0;N<D.length;N++)h[x[D[N]]]=1}else if(_===1){for(let a=0;a<b;a++)if(y[a]!==-1){h[a]=1;break}}for(let a=c;a<=l;a++)if(!d[a]){let x=r[a],S=a;d[a]=Q(D=>(f[S]=D,g(x,S)))}let s=l+1<d.length&&d[l+1]?d[l+1]:e;for(let a=l;a>=c;a--){let x=a-c;(y[x]===-1||!h[x])&&(s&&s.parentNode!==t&&(s=e),t.insertBefore(d[a],s)),s=d[a]}}function de(t,e){let n=0;for(let r=0;r<e;r++)t[r]===-1&&n++;return n}function Zt(t,e){if(e===0)return[];if(e===1)return[0];let n=new Int32Array(e),r=new Int32Array(e),o=1;n[0]=0,r[0]=-1;for(let c=1;c<e;c++)if(t[c]>t[n[o-1]])r[c]=n[o-1],n[o++]=c;else{let p=0,l=o-1;for(;p<l;){let d=p+l>>1;t[n[d]]<t[c]?p=d+1:l=d}n[p]=c,r[c]=p>0?n[p-1]:-1}let i=new Array(o),g=n[o-1];for(let c=o-1;c>=0;c--)i[c]=g,g=r[g];return i}function he(){return document.createComment("i")}function tt(t,e,n,r){let o=e;for(;o&&o!==n;){let i=o.nextSibling;t.insertBefore(o,r),o=i}}function _t(t,e,n){let r=e;for(;r&&r!==n;){let o=r.nextSibling;O(r),t.removeChild(r),r=o}}function wt(t,e,n,r,o,i,g,c,p){let l;if(o){let m=r(e),b=p(e);l=b,o.set(m,{itemSig:b})}else l=e;let d=he();t.appendChild(d);let f=Q(m=>(c[n]=m,i(l,n)));t.appendChild(f),g[n]=d}function pe(t,e,n,r,o,i,g,c,p){let l=r.length,d=n.length;if(l===0){if(d>0){for(let u=0;u<d;u++)i[u]&&i[u]();o[0]&&_t(t,o[0],e),o.length=0,i.length=0,p&&p.clear()}return}if(d===0){let u=document.createDocumentFragment();for(let E=0;E<l;E++)wt(u,r[E],E,c,p,g,o,i,I);t.insertBefore(u,e);return}let f=0,m=Math.min(d,l);for(;f<m;){if(n[f]===r[f]){f++;continue}let u=c(n[f]),E=c(r[f]);if(u!==E)break;p&&p.get(u).itemSig.set(r[f]),f++}let b=d-1,y=l-1;for(;b>=f&&y>=f;){if(n[b]===r[y]){b--,y--;continue}let u=c(n[b]),E=c(r[y]);if(u!==E)break;p&&p.get(u).itemSig.set(r[y]),b--,y--}if(f>b&&f>y)return;let _=new Array(l),h=new Array(l);for(let u=0;u<f;u++)_[u]=o[u],h[u]=i[u];for(let u=y+1;u<l;u++){let E=b+1+(u-y-1);_[u]=o[E],h[u]=i[E]}let s=y-f+1,a=b-f+1;if(a===0){let u=y+1<l&&_[y+1]?_[y+1]:e,E=document.createDocumentFragment();for(let B=f;B<=y;B++)wt(E,r[B],B,c,p,g,_,h,I);t.insertBefore(E,u),et(o,i,_,h,l);return}if(s===0){for(let u=f;u<=b;u++){i[u]?.();let E=X(t,o[u],o,u,e);_t(t,o[u],E),p&&p.delete(c(n[u]))}et(o,i,_,h,l);return}if(s===a&&s>=2&&s<=Math.max(a,200)){let u=0,E=-1,B=-1;for(let A=0;A<s&&u<=4;A++){let C=c(n[f+A]),K=c(r[f+A]);C!==K&&(u===0?E=A:u===1&&(B=A),u++)}if(u===2){let A=f+E,C=f+B,K=c(n[A]),J=c(n[C]),gt=c(r[A]),U=c(r[C]);if(K===U&&J===gt){for(let L=0;L<f;L++)_[L]=o[L],h[L]=i[L];for(let L=f;L<=y;L++)_[L]=o[L],h[L]=i[L];for(let L=y+1;L<l;L++){let $=b+1+(L-y-1);_[L]=o[$],h[L]=i[$]}let R=_[A];_[A]=_[C],_[C]=R;let M=h[A];if(h[A]=h[C],h[C]=M,p){if(r[A]!==n[A]){let L=c(r[A]),$=p.get(L);$&&$.itemSig.set(r[A])}if(r[C]!==n[C]){let L=c(r[C]),$=p.get(L);$&&$.itemSig.set(r[C])}}let H=C===A+1||A===C+1,P=Math.min(A,C),T=Math.max(A,C);if(H){let L=X(t,o[T],o,T,e);tt(t,o[T],L,o[P])}else{let L=X(t,o[C],o,C,e),$=document.createComment("tmp");t.insertBefore($,o[C]),tt(t,o[C],L,o[A]);let Ft=X(t,o[A],o,A,e);tt(t,o[A],Ft,$),t.removeChild($)}et(o,i,_,h,l);return}}if(u>=2&&u<=s){let A=E,C=-1,K=-1,J=!1,gt=c(n[f+A]),U=-1;for(let R=A;R<s;R++)if(c(r[f+R])===gt){U=R;break}if(U>A){let R=!0;for(let M=A;M<U;M++)if(c(n[f+M+1])!==c(r[f+M])){R=!1;break}if(R){let M=!0;for(let H=U+1;H<s;H++)if(c(n[f+H])!==c(r[f+H])){M=!1;break}M&&(J=!0,C=f+A,K=f+U)}}if(!J){let R=c(r[f+A]),M=-1;for(let H=A;H<a;H++)if(c(n[f+H])===R){M=H;break}if(M>A){let H=!0;for(let P=A;P<M;P++)if(c(n[f+P])!==c(r[f+P+1])){H=!1;break}if(H){let P=!0;for(let T=M+1;T<s;T++)if(c(n[f+T])!==c(r[f+T])){P=!1;break}P&&(J=!0,C=f+M,K=f+A)}}}if(J){for(let T=f;T<=b;T++)_[T]=o[T],h[T]=i[T];let R=_[C],M=h[C];if(C<K)for(let T=C;T<K;T++)_[T]=_[T+1],h[T]=h[T+1];else for(let T=C;T>K;T--)_[T]=_[T-1],h[T]=h[T-1];if(_[K]=R,h[K]=M,p)for(let T=f;T<=y;T++){let L=c(r[T]);if(r[T]!==n[T]){let $=p.get(L);$&&$.itemSig.set(r[T])}}let H=X(t,R,o,C,e),P;K+1<l?P=_[K+1]:P=e,(K>=y+1||P&&P.parentNode!==t)&&(P=e),tt(t,R,H,P),et(o,i,_,h,l);return}}}let x=new Map;for(let u=f;u<=b;u++)x.set(c(n[u]),u);let S=new Int32Array(s);S.fill(-1);for(let u=f;u<=y;u++){let E=c(r[u]),B=x.get(E);B!==void 0&&(x.delete(E),_[u]=o[B],h[u]=i[B],S[u-f]=B,p&&r[u]!==n[B]&&p.get(E).itemSig.set(r[u]))}let D=[...x.values()].sort((u,E)=>E-u);for(let u of D){i[u]?.();let E=X(t,o[u],o,u,e);_t(t,o[u],E),p&&p.delete(c(n[u]))}for(let u=f;u<=y;u++)if(!_[u]){let E=document.createDocumentFragment();wt(E,r[u],u,c,p,g,_,h,I),_[u]._frag=E}let N=0,ot=!0,it=-1;for(let u=0;u<s;u++)S[u]!==-1&&(N++,S[u]<=it&&(ot=!1),it=S[u]);let V=new Uint8Array(s);if(ot)for(let u=0;u<s;u++)S[u]!==-1&&(V[u]=1);else if(N>1){let u=new Int32Array(N),E=new Int32Array(N),B=0;for(let C=0;C<s;C++)S[C]!==-1&&(u[B]=S[C],E[B]=C,B++);let A=Zt(u,N);for(let C=0;C<A.length;C++)V[E[A[C]]]=1}else if(N===1){for(let u=0;u<s;u++)if(S[u]!==-1){V[u]=1;break}}et(o,i,_,h,l);let pt=y+1<l&&o[y+1]?o[y+1]:e;for(let u=y;u>=f;u--){let E=u-f,B=o[u];if(S[E]===-1)B._frag&&(t.insertBefore(B._frag,pt),delete B._frag);else if(!V[E]){let A=X(t,B,o,u,e);tt(t,B,A,pt)}pt=B}}function X(t,e,n,r,o){let i=e.nextSibling;for(;i&&i!==o;){if(i.nodeType===8&&i.data==="i")return i;i=i.nextSibling}return o}function et(t,e,n,r,o){t.length=o,e.length=o;for(let i=0;i<o;i++)t[i]=n[i],e[i]=r[i]}function on(t,e){for(let n in e){let r=e[n];if(n==="ref"){typeof r=="function"?r(t):r&&typeof r=="object"&&(r.current=t);continue}if(q(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(typeof r=="function"&&!q(n)){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}n==="class"||n==="className"?t._propEffects[n]=j(()=>{let o=r()||"";dt&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):n==="style"&&typeof r()=="object"?t._propEffects[n]=j(()=>{ht(t,r())}):t._propEffects[n]=j(()=>{ut(t,n,r())})}else ut(t,n,r)}}function ut(t,e,n){if(e==="ref"){typeof n=="function"?n(t):n&&typeof n=="object"&&(n.current=t);return}if(e==="key")return;if(typeof n=="function"&&!q(e)){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>ut(t,e,n()));return}if(q(e))return;if(Bt(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let r=dt&&t instanceof SVGElement;if(e==="class"||e==="className")r?t.setAttribute("class",n||""):t.className=n||"";else if(e==="dangerouslySetInnerHTML"){let o=n?.__html??"";typeof z<"u"&&z&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else if(e==="innerHTML")if(n&&typeof n=="object"&&"__html"in n){let o=n.__html??"";typeof z<"u"&&z&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=o}else typeof console<"u"&&n!=null&&n!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(e==="style")ht(t,n);else if(n==null){if(e in t)try{t[e]=""}catch{}t.removeAttribute(e)}else e.startsWith("data-")||e.startsWith("aria-")?t.setAttribute(e,n):typeof n=="boolean"?n?t.setAttribute(e,""):t.removeAttribute(e):r?t.setAttribute(e,n):e==="value"&&t.tagName==="SELECT"?mt(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function rt(t,e,n,r){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>r(t,n()))}function ge(t,e){if(typeof e=="function")return rt(t,"class",e,ge);dt&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function ht(t,e){if(typeof e=="function")return rt(t,"style",e,ht);if(typeof e=="string")t.style.cssText=e,t._lastStyleObj=null;else if(e&&typeof e=="object"){let n=t.style,r=t._lastStyleObj;if(r)for(let o in r)o in e||(n[o]="");for(let o in e)n[o]=e[o]??"";t._lastStyleObj=e}else e==null&&(t.style.cssText="",t._lastStyleObj=null)}function ye(t,e,n){if(typeof n=="function")return rt(t,e,n,(r,o)=>ye(r,e,o));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function me(t,e){if(typeof e=="function")return rt(t,"value",e,me);if(t.tagName==="SELECT"){mt(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function be(t,e){if(typeof e=="function")return rt(t,"checked",e,be);t.checked=!!e}var zt=new Set;function cn(t){for(let e of t)zt.has(e)||(zt.add(e),document.addEventListener(e,n=>{let r=n.target,o="$$"+e;for(Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return r||document}});r;){let i=r[o];if(i&&(i(n),n.cancelBubble))return;r=r.parentNode}}))}function fn(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function sn(t,e){j(()=>{for(let n in e){let r=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!r)}})}var at=!1,w=null;function ln(){return at}function xe(t,e){at=!0,Ct=!1,Kt(),w={parent:e,index:0};try{let n=G(t,e);return e!==document.body&&e!==document.documentElement&&Yt(e),n}finally{at=!1,w=null}}function Yt(t){if(!(!w||w.parent!==t))for(;t.childNodes.length>w.index;){let e=t.lastChild;O(e),t.removeChild(e)}}var _e=new Set(["$","/$","[]","/[]","fn","/fn","eb:start","eb:end","sb:start","sb:end","portal","portal:empty"]);function Qt(t){return t.nodeType===8&&_e.has(t.textContent)}function ft(t){let e=t.childNodes;for(;w.index<e.length;){let n=e[w.index];if(Qt(n)){w.index++;continue}return w.index++,n}return null}function vt(t){if(!w||w.parent!==t)return null;let e=t.childNodes;for(let n=w.index;n<e.length;n++){let r=e[n];if(!Qt(r))return r}return null}function Y(t,e){let n=e.nodeType===11?e.childNodes.length:1;return w&&w.parent===t?(t.insertBefore(e,t.childNodes[w.index]||null),w.index+=n):t.appendChild(e),e}function lt(){return z}var Ct=!1;function we(){!lt()||Ct||(Ct=!0,console.warn("[what] hydrate() was given DOM that is already built, so the server's markup is being REPLACED by a client render rather than adopted. Hydration needs an unbuilt vnode tree, which is what h() returns. what-compiler emits the unbuilt form for JSX written directly inside a hydrate() call, so the remaining causes are: a tree built before the call (`const tree = <App />; hydrate(tree, el)`), a component whose own body what-compiler lowered (it returns a template clone, which is finished DOM, and cannot be rendered by renderToString either), or a DOM node passed in by hand. The page below is correct and interactive; only the reuse is lost."))}function G(t,e){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let n=String(t);if(n===""){let i=vt(e);return i&&i.nodeType===3?(ft(e),i.textContent="",i):Y(e,document.createTextNode(""))}let r=ft(e);if(r&&r.nodeType===3)return r.textContent!==n&&(lt()&&console.warn(`[what] Hydration mismatch: expected text "${n}", got "${r.textContent}"`),r.textContent=n),r;lt()&&console.warn(`[what] Hydration mismatch: expected text node "${n}", got ${r?r.nodeName:"nothing"}. Falling back to client render.`);let o=document.createTextNode(n);return r?e.replaceChild(o,r):Y(e,o),o}if(typeof t=="function"&&t._lazyChildren)return G(t(),e);if(typeof t=="function"&&t._mapArray){let n=!!(w&&w.parent===e),r=n&&e.childNodes[w.index]||null,o=document.createComment("list");e.insertBefore(o,r),n&&w.index++;let i=t(e,r);if(o._rangeEnd=i,n){let g=Array.prototype.indexOf.call(e.childNodes,i);g>=0&&(w.index=g+1)}return i}if(typeof t=="function"){let n=!!(w&&w.parent===e),r=document.createComment("fn"),o=document.createComment("/fn");n?(e.insertBefore(r,e.childNodes[w.index]||null),w.index++):e.appendChild(r),G(t(),e),n?(e.insertBefore(o,e.childNodes[w.index]||null),w.index++):e.appendChild(o);let i=[];for(let f=r.nextSibling;f&&f!==o;f=f.nextSibling)i.push(f);let g=i.length===0?null:i.length===1?i[0]:i,c=Et(),p=j(()=>Xt(c,()=>{let f=t();at||(g=st(o.parentNode||e,f,g,o))})),l=!1,d=()=>{l||(l=!0,p())};return r._dispose=d,o._dispose=d,v(r,d),r._rangeEnd=o,g}if(Array.isArray(t)){let n=[];for(let r of t){let o=G(r,e);o&&n.push(o)}return n.length===1?n[0]:n}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let i=F(),g=t.tag,c=t.props||{},p=t.children||[],l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:g,_parentCtx:i[i.length-1]||null,_errorBoundary:null};i.push(l);let d,f=null;try{let m={...c};c._$lazyChildren?f=Dt(g,m,c._$lazyChildren):m.children=p.length===0?c.children:p.length===1?p[0]:p,d=g(m),f&&f()}catch(m){return i.pop(),!Ht(m)&&!(m&&typeof m.then=="function"&&Ae(m,l))&&!Lt(m,l)&&console.error("[what] Error in component during hydration:",g.name||"Anonymous",m),null}l.mounted=!0,l._mountCallbacks&&queueMicrotask(()=>{if(!l.disposed)for(let m of l._mountCallbacks)try{m()}catch(b){console.error("[what] onMount error:",b)}});try{let m=G(d,e),b=typeof d=="function"||Array.isArray(d)&&d.some(h=>typeof h=="function"),y=Array.isArray(m)?m[0]:m,_=!b&&y&&y.nodeType?y:e;return ct(_,l),m}finally{i.pop()}}if(t.tag==="__errorBoundary"){let{errorState:i,fallback:g,reset:c,handleError:p}=t.props;return kt(t,e,{startText:"eb:start",endText:"eb:end",ctxExtras:{_errorBoundary:p},state:i,contentFor:l=>l?typeof g=="function"?g({error:l,reset:c}):g:t.children||[]})}if(t.tag==="__suspense"){let{boundary:i,fallback:g,loading:c}=t.props;return kt(t,e,{startText:"sb:start",endText:"sb:end",ctxExtras:{_suspenseBoundary:i},state:c,contentFor:p=>p?g:t.children||[]})}if(t.tag==="__portal"){let i=W(t,e);return i?Y(e,i):null}let n=ft(e),r=t.tag.toLowerCase();if(n&&n.nodeType===1&&n.nodeName.toLowerCase()===r){Te(n,t.props||{}),n.removeAttribute("data-hk");let i=w;if(w={parent:n,index:0},t.props?.dangerouslySetInnerHTML?.__html==null){for(let c of t.children)G(c,n);t.children.length>0&&Yt(n)}return w=i,n}lt()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${n?n.nodeName:"nothing"}. Falling back to client render.`);let o=W(t,e,At(e));return n?e.replaceChild(o,n):Y(e,o),o}if(Wt(t)){we();let n=t.nodeType===11?t.childNodes.length:1,o=!!(w&&w.parent===e)?ft(e):null;return o?(e.replaceChild(t,o),w.index+=n-1,t):Y(e,t)}return Y(e,document.createTextNode(String(t)))}function Ae(t,e){for(let n=e;n;n=n._parentCtx)if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(t),!0;return!1}function Ce(t,e){return typeof t=="string"||typeof t=="number"?e.nodeType!==3:t&&t._vnode&&typeof t.tag=="string"?e.nodeType!==1||e.nodeName.toLowerCase()!==t.tag.toLowerCase():!1}function Ee(t,e,n){if(e<0||!w||w.parent!==t||w.index!==e)return!1;let r=vt(t);if(!r)return!1;let o=n(),i=Array.isArray(o)?o:[o],g=i.find(c=>c!=null&&typeof c!="boolean");if(g===void 0)return!0;if(Ce(g,r))return!1;for(let c of i)G(c,t);return!0}function kt(t,e,{startText:n,endText:r,ctxExtras:o,state:i,contentFor:g}){let c=t.children||[],p=!!(w&&w.parent===e),l=document.createComment(n),d=document.createComment(r),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:Et(),_startComment:l,_endComment:d,...o};p?(e.insertBefore(l,e.childNodes[w.index]||null),w.index++):e.appendChild(l);let m=p?w.index:-1,b=F();b.push(f);try{for(let x of c)G(x,e)}finally{b.pop()}let y=Tt(i),_=!y;if(y){b.push(f);try{_=Ee(e,m,()=>g(y))}finally{b.pop()}}p?(e.insertBefore(d,e.childNodes[w.index]||null),w.index++):e.appendChild(d);let h=!0,s=0,a=j(()=>{let x=i();if(h&&(h=!1,_&&x===y))return;let S=l.parentNode;if(!S)return;let D=++s;for(;l.nextSibling&&l.nextSibling!==d;){let N=l.nextSibling;O(N),S.removeChild(N)}b.push(f);try{let N=g(x),ot=Array.isArray(N)?N:[N];for(let it of ot){let V=W(it,S);if(D!==s){V&&O(V);break}V&&(d.parentNode?d.parentNode.insertBefore(V,d):O(V))}}finally{b.pop()}});if(p&&w&&w.parent===e){let x=Array.prototype.indexOf.call(e.childNodes,d);x>=0&&(w.index=x+1)}return f.effects.push(a),ct(l,f),ct(d,f),l}function Te(t,e){for(let n in e){if(n==="children"||n==="key"||n==="dangerouslySetInnerHTML"||n==="innerHTML")continue;if(n==="ref"){let o=e.ref;typeof o=="function"?o(t):o&&typeof o=="object"&&(o.current=t);continue}let r=e[n];if(q(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(n.startsWith("$$")){t[n]=r;continue}if(typeof r=="function"&&!q(n)){n==="class"||n==="className"?v(t,j(()=>{t.className=r()||""})):n==="style"&&typeof r()=="object"?v(t,j(()=>{ht(t,r())})):v(t,j(()=>{ut(t,n,r())}));continue}}}Nt({hydrate:xe,insert:qt});export{Me as a,De as b,te as c,He as d,ne as e,Pe as f,je as g,Re as h,$e as i,Ke as j,Oe as k,Ie as l,Ve as m,Ot as n,ze as o,ke as p,Ge as q,Ue as r,qe as s,We as t,Fe as u,re as v,tn as w,ce as x,en as y,fe as z,qt as A,nn as B,rn as C,on as D,ut as E,ge as F,ht as G,ye as H,me as I,be as J,cn as K,fn as L,sn as M,ln as N,xe as O};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as T}from"./chunk-6YOUZ6T4.min.js";var l=typeof globalThis<"u"&&typeof globalThis.__WHAT_DEV__=="boolean"?globalThis.__WHAT_DEV__:import.meta&&import.meta.env?!!import.meta.env.DEV:(typeof process<"u"&&process.env,!1),u=null;function Ze(e){l&&(u=e)}var C=null,b=null,E=null,U=!1,B=0,x=[],V=!1,F=Symbol("needs_upstream"),H=null;function A(e,t){let n=e,r=new Set,o=null,s=0;function c(f){l&&U&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let a=typeof f=="function"?f(n):f;(n===a?n!==0||1/n===1/a:n!==n&&a!==a)||(n=a,o=null,l&&u&&u.onSignalUpdate?.(i),r.size>0&&ce(r))}function i(f){if(arguments.length===0){let a=C;return a!==null&&(a!==o||a._epoch!==s)&&(o=a,s=a._epoch,r.add(a),a.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>L(()=>f(i())),i._signal=!0,l&&(i._subs=r,r._signalOwner=i,t&&(i._debugName=t)),l&&u&&u.onSignalCreate?.(i),i}function Ye(e){let t,n=!0,r=new Set,o=null,s=0,c=Q(()=>{let f=U;l&&(U=!0);try{t=e(),n=!1}finally{l&&(U=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n,b&&b.disposals.push(()=>I(c));function i(){if(c.disposed)return t;let f=C;return f!==null&&(f!==o||f._epoch!==s)&&(o=f,s=f._epoch,r.add(f),f.deps.push(r)),n&&oe(c),t}return c._onNotify=()=>{n=!0,o=null,r.size>0&&ce(r)},i._signal=!0,i.peek=()=>(n&&!c.disposed&&oe(c),t),i}function oe(e){if(H!==null)throw H.push(e),F;let t=[e];H=t;try{for(;t.length>0;){let n=t[t.length-1];if(n.disposed||!n._isDirty||!n._isDirty()){t.pop();continue}let r=!1,o=n.deps;for(let s=0;s<o.length;s++){let c=o[s]._owner;c&&!c.disposed&&c._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let s=n.deps.length;Z(n),n.deps.length!==s&&$(n),t.pop()}catch(s){if(s===F)n._markDirty();else throw s}}}finally{H=null}}function $(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let o=n[r]._owner;if(o){let s=o._level;s>t&&(t=s)}}e._level=t+1}var ke=()=>{};function L(e,t){let n=Q(e);n._level=1;let r=C;C=n;try{let s=n.fn();typeof s=="function"&&(n._cleanup=s)}catch(s){throw I(n),s}finally{C=r}if($(n),l&&u?.onEffectRun?.(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,l&&u&&u.onEffectDispose?.(n),ke;let o=()=>I(n);return b&&b.disposals.push(o),o}function et(e){B++;try{e()}finally{B--,B===0&&ee()}}function Q(e,t){let n={fn:e,deps:[],lazy:t||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null,_cleanup:null,_epoch:0};return l&&u&&u.onEffectCreate?.(n),n}function Z(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(r){l&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=C;C=null;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){u?.onError&&u.onError?.(r,{type:"effect",effect:e}),Y(r)}finally{C=n}l&&u?.onEffectRun&&u.onEffectRun?.(e);return}if(ie(e),e._cleanup){try{e._cleanup()}catch(n){l&&u?.onError&&u.onError?.(n,{type:"effect-cleanup",effect:e}),l&&console.warn("[what] Error in effect cleanup:",n)}e._cleanup=null}let t=C;C=e;try{let n=e.fn();typeof n=="function"&&(e._cleanup=n)}catch(n){throw n===F||l&&u?.onError&&u.onError?.(n,{type:"effect",effect:e}),n}finally{C=t}l&&u?.onEffectRun&&u.onEffectRun?.(e)}function I(e){if(e.disposed=!0,l&&u&&u.onEffectDispose?.(e),ie(e),e._cleanup){try{e._cleanup()}catch(t){l&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function ie(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var K=0,M=null,R=0;function se(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(B===0&&e._stable){let t=C;C=null;try{let n=e.fn();if(typeof n=="function"){if(e._cleanup)try{e._cleanup()}catch{}e._cleanup=n}}catch(n){l&&u?.onError&&u.onError?.(n,{type:"effect",effect:e}),Y(n)}finally{C=t}l&&u?.onEffectRun?.(e)}else{e._pending=!0;let t=e._level,n=x.length;n>0&&x[n-1]._level>t&&(V=!0),x.push(e)}}}function ce(e){if(K===0){K=1;try{for(let t of e)se(t);if(R>0&&M){let t=0,n=M;for(;t<R;){let r=n[t];n[t]=null,t++;for(let o of r)se(o)}R=0}}finally{K=0}B===0&&x.length>0&&Ae()}else M===null&&(M=[]),R>=M.length?M.push(e):M[R]=e,R++}var W=!1;function Ae(){W||(W=!0,queueMicrotask(()=>{W=!1,ee()}))}var z=!1;function Y(e){try{console.error("[what] Uncaught error in effect during update:",e)}catch{}}function ee(){if(!z){z=!0;try{let e=0;for(;x.length>0&&e<25;){let t=x;x=[],t.length>1&&V&&t.sort((n,r)=>n._level-r._level),V=!1;for(let n=0;n<t.length;n++){let r=t[n];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;try{Z(r)}catch(s){if(s===F)throw s;l&&u?.onError&&u.onError?.(s,{type:"effect",effect:r}),Y(s);continue}!r._computed&&r.deps.length!==o&&$(r)}}e++}if(e>=25){if(l){let n=x.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${n.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected");for(let t=0;t<x.length;t++)x[t]._pending=!1;x.length=0}}finally{z=!1}}}function tt(e){let t,n=new Set,r=Q(()=>{let s=e();if(!Object.is(t,s)){t=s;for(let c of n)if(!c.disposed){if(c._onNotify)c._onNotify();else if(!c._pending){c._pending=!0;let i=c._level,f=x.length;f>0&&x[f-1]._level>i&&(V=!0),x.push(c)}}}});r._level=1;try{Z(r)}catch(s){throw I(r),s}$(r),n._owner=r,b&&b.disposals.push(()=>I(r));function o(){return C&&(n.add(C),C.deps.push(n)),t}return o._signal=!0,o.peek=()=>t,o}function nt(){if(z){l&&console.warn("[what] flushSync() called during an active flush (e.g., inside a component render or effect). This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}if(C){l&&console.warn("[what] flushSync() called during effect execution. This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}W=!1,ee()}function te(e){let t=C;C=null;try{return e()}finally{C=t}}function rt(){return E}function ot(e,t){let n=E,r=b;E=e,b=e;try{return t()}finally{E=n,b=r}}function st(e){let t=b,n=E,r={disposals:[],owner:E,children:[],_disposed:!1};E&&E.children.push(r),b=r,E=r;try{return e(()=>ne(r))}finally{b=t,E=n}}function ne(e){if(e._disposed)return;e._disposed=!0;let t=!1,n;for(;e.children.length>0;){let r=e.children.pop();try{ne(r)}catch(o){t||(t=!0,n=o)}}e.children.length=0;for(let r=e.disposals.length-1;r>=0;r--)try{e.disposals[r]()}catch(o){t||(t=!0,n=o)}if(e.disposals.length=0,e.owner){let r=e.owner.children.indexOf(e);r>=0&&e.owner.children.splice(r,1)}if(t)throw n}function it(e){let t=b,n=E,r={disposals:[],owner:null,children:[],_disposed:!1};b=r,E=r;try{return e(()=>ne(r))}finally{b=t,E=n}}function ct(e){b&&b.disposals.push(e)}if(l&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};u={__isPreinstallBuffer:!0,onSignalCreate(n){t.signals.size<2e3&&t.signals.add(new WeakRef(n))},onSignalUpdate(){},onEffectCreate(n){t.effects.size<2e3&&t.effects.add(new WeakRef(n))},onEffectDispose(){},onEffectRun(){},onError(){},onComponentMount(n){t.components.length<2e3&&t.components.push(n)},onComponentUnmount(){},__buffer:t}}function ft(){if(!l)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof X<"u"?X:null;if(!t)return e;for(let n of t.signals){let r=n.deref?.();r&&e.signals.push(r)}for(let n of t.effects){let r=n.deref?.();r&&e.effects.push(r)}for(let n of t.components)e.components.push(n);return e}var X=null;l&&u?.__isPreinstallBuffer&&(X=u.__buffer);var O=null,j=null;function lt(e){j||(j=e)}function Ne(){return j?.getStore()??O}function fe(){return typeof document>"u"||Ne()!=null}function ut(e){let t=O;return O=e,t}function pt(e,t){if(j)return j.run(e,t);let n=O;O=e;try{return t()}finally{O=n}}function gt(e,t){let n=function(o){return e(o)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var ae=null;function le(e){ae=e}function Ct(e){let t=null,n=null,r=null,o=new Set;function s(c){if(r)throw r;if(t)return T(t,c);throw n||(n=e().then(i=>{t=i.default||i,o.forEach(f=>f()),o.clear()}).catch(i=>{r=i})),n}return s.displayName="Lazy",s._lazy=!0,s._onLoad=c=>{t?c():o.add(c)},s}function Le({fallback:e,children:t}){let n=A(!1),r=new Set,o=!1;return{tag:"__suspense",props:{boundary:{_suspense:!0,onSuspend(c){o||(n.set(!0),r.add(c),c.then(()=>{r.delete(c),r.size===0&&n.set(!1)},i=>{o=!0,r.delete(c),console.error("[what] Suspense: a suspended child rejected:",i)}))}},fallback:e,loading:n},children:Array.isArray(t)?t:[t],_vnode:!0}}Le._deferChildren=!0;function De({fallback:e,children:t,onError:n}){let r=A(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:c=>{if(r.set(c),n)try{n(c)}catch(i){console.error("Error in onError handler:",i)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}De._deferChildren=!0;function ue(e,t){let n=t||ae?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function wt({when:e,fallback:t=null,children:n}){return()=>(typeof e=="function"?e():e)?n:t}function bt({each:e,fallback:t=null,children:n}){let r=Array.isArray(n)?n[0]:n;return typeof r!="function"?(console.warn("[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>"),t):()=>{let o=typeof e=="function"?e():e;return!o||o.length===0?t:o.map((s,c)=>{let i=r(s,c);return i&&typeof i=="object"&&i.key==null&&(s!=null&&typeof s=="object"?s.id!=null?i.key=s.id:s.key!=null&&(i.key=s.key):(typeof s=="string"||typeof s=="number")&&(i.key=s)),i})}}function St({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];return()=>{for(let r of n)if(r&&r.tag===Me){let o=r.props.when;if(typeof o=="function"?o():o)return r.children}return e}}function Me(e){return()=>(typeof e.when=="function"?e.when():e.when)?e.children:null}var q=null;function xt(e){q=e}function Te(e){let t={};for(let n in e){let r=e[n];typeof r=="function"||typeof r=="symbol"||r===void 0||(t[n]=r)}try{return JSON.stringify(t)}catch{return"{}"}}function Et({component:e,mode:t,mediaQuery:n,name:r,children:o,...s}){let c=r||e?.name||"Island",i=t||"idle",f={"data-island":c,"data-island-mode":i,"data-hydrate":i,"data-island-self":"1"},a=o==null?[]:Array.isArray(o)?o:[o];if(fe())return T("div",{...f,"data-island-props":Te(s)},T(e,s,...a));let _=!1;function y(p){if(_)return;_=!0;let d=T(e,s,...a);p.childNodes.length>0&&q?.hydrate?q.hydrate(d,p):q?.insert&&q.insert(p,d,null),p.removeAttribute("data-hydrate"),p.removeAttribute("data-island-self"),p.setAttribute("data-island-hydrated","");let m=p.ownerDocument?.defaultView??globalThis;typeof m.CustomEvent=="function"&&p.dispatchEvent(new m.CustomEvent("island:hydrated",{bubbles:!0,detail:{name:c,mode:i}}))}function S(p){let d=()=>y(p);switch(i){case"load":queueMicrotask(d);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(d):setTimeout(d,200);break;case"visible":{if(typeof IntersectionObserver>"u"){queueMicrotask(d);break}let m=new IntersectionObserver(w=>{w.some(v=>v.isIntersecting)&&(m.disconnect(),d())},{rootMargin:"200px"});m.observe(p);break}case"interaction":case"action":{let m=["click","focus","mouseenter","touchstart"],w=()=>{for(let v of m)p.removeEventListener(v,w);d()};for(let v of m)p.addEventListener(v,w,{once:!0});break}case"media":{if(!n||typeof window>"u"||!window.matchMedia){d();break}let m=window.matchMedia(n);if(m.matches){queueMicrotask(d);break}let w=()=>{m.matches&&(m.removeEventListener("change",w),d())};m.addEventListener("change",w);break}case"static":break;default:queueMicrotask(d)}}return T("div",{...f,ref:p=>{p&&S(p)}})}var pe=!1;function At(e,t,n){return pe||(pe=!0,console.warn("[what] each() is deprecated. Use the <For> component or Array.map() instead.")),!e||e.length===0?[]:e.map((r,o)=>{let s=t(r,o);return n&&s&&typeof s=="object"&&(s.key=n(r,o)),s})}function Nt(...e){let t=[];for(let n of e)if(n){if(typeof n=="string")t.push(n);else if(typeof n=="object")for(let[r,o]of Object.entries(n))o&&t.push(r)}return t.join(" ")}function Lt(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${Re(t)}:${n}`).join(";")}function Re(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Dt(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function Mt(e,t){let n=0;return(...r)=>{let o=Date.now();o-n>=t&&(n=o,e(...r))}}var G=null;function de(e){G=e}function Tt(e){if(typeof window>"u")return A(!1);let t=window.matchMedia(e),n=A(t.matches),r=s=>n.set(s.matches);t.addEventListener("change",r);let o=G?.();return o&&(o._cleanupCallbacks=o._cleanupCallbacks||[],o._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function Rt(e,t){let n;try{let i=localStorage.getItem(e);n=i!==null?JSON.parse(i):t}catch{n=t}let r=A(n),o=L(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){l&&console.warn("[what] localStorage write failed (quota exceeded?):",i)}}),s=null;typeof window<"u"&&(s=i=>{if(i.key===e&&i.newValue!==null)try{r.set(JSON.parse(i.newValue))}catch(f){l&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",s));let c=G?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{o(),s&&window.removeEventListener("storage",s)})),r}function Ot({target:e,children:t}){if(typeof document>"u")return null;let n=typeof e=="string"?document.querySelector(e):e;return n?{tag:"__portal",props:{container:n},children:Array.isArray(t)?t:[t],_vnode:!0}:null}function Pt(e,t){if(typeof document>"u")return;let n=o=>{let s=e.current||e;!s||s.contains(o.target)||t(o)};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);let r=G?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function Bt(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var Oe=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),Pe="http://www.w3.org/2000/svg",he=new Set(["href","src","action","formaction","formAction","data","ping","xlink:href","xlinkHref"]),_e=new Set(["srcdoc","srcDoc"]);function Be(e){if(e==null)return!0;let t;try{t=String(e).trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase()}catch{return!1}return!(t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:"))}function me(e){if(e.length<=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return(t===111||t===79)&&(n===110||n===78)}function Ie(e,t){let n=e.toLowerCase();return _e.has(e)||_e.has(n)?!0:!he.has(e)&&!he.has(n)?!1:!Be(t)}function je(e){return e==="role"||e.startsWith("aria-")}var ge=new Set,J=new WeakMap;function qe(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ye(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function re(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let t of e.cleanups)try{t()}catch(n){console.error("[what] cleanup error:",n)}if(e.effects)for(let t of e.effects)try{t()}catch{}if(e.hooks){for(let t of e.hooks)if(t&&typeof t.cleanup=="function")try{t.cleanup()}catch(n){console.error("[what] hook cleanup error:",n)}}if(e._cleanupCallbacks)for(let t of e._cleanupCallbacks)try{t()}catch(n){console.error("[what] onCleanup error:",n)}l&&u?.onComponentUnmount&&u.onComponentUnmount?.(e),ge.delete(e)}}function He(e,t){!e||typeof t!="function"||(e._hydrationDisposers?e._hydrationDisposers.push(t):e._hydrationDisposers=[t])}function Ut(e,t){He(e,()=>re(t))}function D(e){if(!e)return;if(e._componentCtx&&re(e._componentCtx),e._hydrationDisposers){let n=e._hydrationDisposers;e._hydrationDisposers=null;for(let r=0;r<n.length;r++)try{n[r]()}catch{}}if(e.nodeType===8){let n=J.get(e);n&&re(n)}if(e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}let t=e.childNodes;if(t&&t.length>0)for(let n=0;n<t.length;n++)D(t[n])}function Ue(e){let t=null;for(let n of e){let r=n._rangeEnd;if(!r||r.parentNode!==n.parentNode)continue;t||(t=e.slice());let o=t;for(let s=n.nextSibling;s&&(o.push(s),s!==r);s=s.nextSibling);}return t||e}function Wt(e,t){typeof t=="string"&&(t=document.querySelector(t)),D(t),t.textContent="";let n=N(e,t);return n&&t.appendChild(n),()=>{D(t),t.textContent=""}}function N(e,t,n){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(qe(e))return e;if(typeof e=="function"&&e._mapArray){let r=document.createDocumentFragment(),o=document.createComment("list");return r.appendChild(o),o._rangeEnd=e(r,null),r}if(typeof e=="function"&&e._lazyChildren)return N(e(),t,n);if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),s=[],c=document.createDocumentFragment();c.appendChild(r),c.appendChild(o);let i=h[h.length-1]||null,f=L(()=>{let a=i!==null&&h[h.length-1]!==i;a&&h.push(i);try{let _=e(),y=_==null||_===!1||_===!0?[]:Array.isArray(_)?_:[_],S=o.parentNode;if(!S)return;for(let p of Ue(s))D(p),p.parentNode===S&&S.removeChild(p);s=[];for(let p of y){let d=N(p,S,t?._isSvg);if(d)if(d.nodeType===11){let m=Array.from(d.childNodes);S.insertBefore(d,o);for(let w of m)s.push(w)}else S.insertBefore(d,o),s.push(d)}}finally{a&&h.pop()}});return r._dispose=f,o._dispose=f,r._rangeEnd=o,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let s=N(o,t,n);s&&r.appendChild(s)}return r}return ye(e)&&typeof e.tag=="function"?$e(e,t,n):ye(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?we(e,t):e.tag==="__suspense"?be(e,t):e.tag==="__portal"?Se(e,t):Je(e,t,n):document.createTextNode(String(e))}var We={get(e,t){if(t!=="_sig"&&!(t==="__proto__"||t==="constructor"||t==="prototype"))return e._sig()[t]},has(e,t){return t==="_sig"?!1:t in e._sig()},ownKeys(e){return Reflect.ownKeys(e._sig())},getOwnPropertyDescriptor(e,t){if(t==="_sig")return;let n=e._sig();if(t in n)return{value:n[t],writable:!1,enumerable:!0,configurable:!0}},set(e,t){return!1}},h=[];function Ce(){return h[h.length-1]}le(Ce);de(Ce);function zt(){return h}function Vt(e){let t={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:e,_parentCtx:h[h.length-1]||null,_errorBoundary:null};return h.push(t),t}function Ft(e){h[h.length-1]===e&&h.pop(),e.disposed=!0}function ze(e,t,n){if(e._deferChildren)return t.children=n,null;let r,o=!1,s=!0;return Object.defineProperty(t,"children",{get(){return s?(o||(o=!0,r=n()),r):n()},enumerable:!0,configurable:!0}),()=>{s=!1,o=!1,r=void 0}}var Ve=Symbol.for("what.navigation.signal");function Fe(e){if(e==null)return!1;let t=e[Ve];return typeof t!="function"?!1:(t(e),!0)}function $e(e,t,n){let{tag:r,props:o,children:s}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let g=r;r=function(ve){return new g(ve).render()},r.displayName=g.displayName||g.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return we(e,t);if(r==="__suspense"||e.tag==="__suspense")return be(e,t);if(r==="__portal"||e.tag==="__portal")return Se(e,t);let c=h[h.length-1]||null,i=null;if(c&&(i=c._errorBoundary||null,!i)){let g=c._parentCtx;for(;g;){if(g._errorBoundary){i=g._errorBoundary;break}g=g._parentCtx}}let f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:c,_errorBoundary:i},a=document.createComment("c:start"),_=document.createComment("c:end");J.set(a,f),f._startComment=a,f._endComment=_;let y=document.createDocumentFragment();y._componentCtx=f,f._wrapper=a,ge.add(f),l&&u?.onComponentMount&&u.onComponentMount?.(f);let S=s.length===0?void 0:s.length===1?s[0]:s,p;S!==void 0?p=o?Object.assign({},o,{children:S}):{children:S}:p=o?Object.assign({},o):{};let d=o&&o._$lazyChildren,m=d?ze(r,p,d):null,w=A(p);f._propsSignal=w;let v=new Proxy({_sig:w},We);h.push(f);let k;try{k=te(()=>r(v))}catch(g){if(h.pop(),!Fe(g)&&!(g&&typeof g.then=="function"&&Ge(g,f))&&!ue(g,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",g),g;return y.appendChild(a),y.appendChild(_),y}m&&m(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let g of f._mountCallbacks)try{g()}catch(P){console.error("[what] onMount error:",P)}}),y.appendChild(a);let Ee=Array.isArray(k)?k:[k];try{for(let g of Ee){let P=N(g,y,n);P&&y.appendChild(P)}}finally{h.pop()}return y.appendChild(_),y}function Ge(e,t){let n=t;for(;n;){if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(e),!0;n=n._parentCtx}return!1}function we(e,t){let{errorState:n,handleError:r,fallback:o,reset:s}=e.props,c=e.children,i=document.createComment("eb:start"),f=document.createComment("eb:end"),a={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};J.set(i,a);let _=document.createDocumentFragment();_._componentCtx=a,_.appendChild(i),_.appendChild(f);let y=L(()=>{let S=n();h.push(a);try{let p=i.parentNode;if(p)for(;i.nextSibling&&i.nextSibling!==f;){let m=i.nextSibling;D(m),p.removeChild(m)}let d;S?d=typeof o=="function"?[o({error:S,reset:s})]:[o]:d=c,d=Array.isArray(d)?d:[d];for(let m of d){let w=N(m,t);w&&(f.parentNode?f.parentNode.insertBefore(w,f):_.insertBefore(w,f))}}finally{h.pop()}});return a.effects.push(y),_}function be(e,t){let{boundary:n,fallback:r,loading:o}=e.props,s=e.children,c=document.createComment("sb:start"),i=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null,_suspenseBoundary:n,_startComment:c,_endComment:i};J.set(c,f);let a=document.createDocumentFragment();a._componentCtx=f,a.appendChild(c),a.appendChild(i);let _=0,y=L(()=>{let p=o()?[r]:s,d=Array.isArray(p)?p:[p],m=++_;h.push(f);let w=c.parentNode;if(w)for(;c.nextSibling&&c.nextSibling!==i;){let v=c.nextSibling;D(v),w.removeChild(v)}try{for(let v of d){let k=N(v,t);if(m!==_){k&&D(k);break}k&&(i.parentNode?i.parentNode.insertBefore(k,i):a.insertBefore(k,i))}}finally{h.pop()}});return f.effects.push(y),a}function Se(e,t){let{container:n}=e.props,r=e.children;if(!n)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let o={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null},s=document.createComment("portal");s._componentCtx=o;let c=[];for(let i of r){let f=N(i,n);f&&(n.appendChild(f),c.push(f))}return o._cleanupCallbacks=[()=>{for(let i of c)D(i),i.parentNode&&i.parentNode.removeChild(i)}],s}function Je(e,t,n){let{tag:r,props:o,children:s}=e,c=n||Oe.has(r),i=c?document.createElementNS(Pe,r):document.createElement(r);o&&Ke(i,o,{},c);let f=c&&r!=="foreignObject";for(let a=0;a<s.length;a++){let _=N(s[a],i,f);_&&i.appendChild(_)}return i._vnode=e,i}function Ke(e,t,n,r){if(t){for(let o in t)if(!(o==="key"||o==="children")){if(o==="ref"){let s=t.ref;typeof s=="function"?s(e):s&&(s.current=e);continue}xe(e,o,t[o],r)}}}function Xe(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function xe(e,t,n,r){if(typeof n=="function"&&!me(t)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=L(()=>{let o=n();xe(e,t,o,r)});return}if(me(t)){if(typeof n!="function"&&n!=null)return;let o=t.slice(2),s=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),s=!0);let c=o.toLowerCase(),i=s?c+"_capture":c,f=e._events?.[i];if(f&&f._original===n||(f&&e.removeEventListener(c,f,s),n==null))return;e._events||(e._events={});let a=y=>(y.nativeEvent||(y.nativeEvent=y),te(()=>a._handler(y)));a._handler=n,a._original=n,e._events[i]=a;let _=n._eventOpts;e.addEventListener(c,a,_||s||void 0);return}if(Ie(t,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${t}" attribute:`,n);return}if(t==="className"||t==="class"){r?e.setAttribute("class",n||""):e.className=n||"";return}if(t==="style"){if(typeof n=="string")e.style.cssText=n,e._prevStyle=null;else if(typeof n=="object"){let o=e._prevStyle||{};for(let s in o)s in n||(e.style[s]="");for(let s in n)e.style[s]=n[s]??"";e._prevStyle={...n}}return}if(t==="dangerouslySetInnerHTML"){let o=n?.__html??"";l&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o;return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n){let o=n.__html??"";l&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o}else{l&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(n==null){if(t in e)try{e[t]=""}catch{}e.removeAttribute(t);return}if(je(t)||t.startsWith("data-")){e.setAttribute(t,typeof n=="boolean"?String(n):n);return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Xe(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{l as a,u as b,Ze as c,A as d,Ye as e,L as f,et as g,tt as h,nt as i,te as j,rt as k,ot as l,st as m,it as n,ct as o,ft as p,lt as q,Ne as r,fe as s,ut as t,pt as u,gt as v,Ct as w,Le as x,De as y,ue as z,wt as A,bt as B,St as C,Me as D,xt as E,Et as F,At as G,Nt as H,Lt as I,Dt as J,Mt as K,Tt as L,Rt as M,Ot as N,Pt as O,Bt as P,me as Q,Ie as R,je as S,He as T,Ut as U,D as V,Ue as W,Wt as X,N as Y,Ce as Z,zt as _,Vt as $,Ft as aa,ze as ba,Fe as ca,Xe as da};
|
package/src/agent-context.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
// What Framework - Agent Context
|
|
2
|
-
// Exposes a structured global for AI coding agents to discover and inspect the app.
|
|
3
|
-
// Agents can read window.__WHAT_AGENT__ to understand the framework, its state, and health.
|
|
4
|
-
|
|
5
|
-
import { __DEV__ } from './reactive.js';
|
|
6
|
-
import { getCollectedErrors } from './errors.js';
|
|
7
|
-
|
|
8
|
-
// --- Version ---
|
|
9
|
-
// Keep in sync with packages/core/package.json (checked by
|
|
10
|
-
// core/test/guardrails.test.js so it can't silently go stale again).
|
|
11
|
-
const VERSION = '0.14.0';
|
|
12
|
-
|
|
13
|
-
// --- Component Registry ---
|
|
14
|
-
// Tracks mounted components for agent inspection.
|
|
15
|
-
let mountedComponents = [];
|
|
16
|
-
|
|
17
|
-
export function registerComponent(component) {
|
|
18
|
-
if (!__DEV__) return;
|
|
19
|
-
mountedComponents.push(component);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function unregisterComponent(component) {
|
|
23
|
-
if (!__DEV__) return;
|
|
24
|
-
const idx = mountedComponents.indexOf(component);
|
|
25
|
-
if (idx >= 0) mountedComponents.splice(idx, 1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getMountedComponents() {
|
|
29
|
-
return mountedComponents.slice();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// --- Signal Registry ---
|
|
33
|
-
// Tracks active signals for agent inspection.
|
|
34
|
-
let activeSignals = [];
|
|
35
|
-
|
|
36
|
-
export function registerSignal(sig) {
|
|
37
|
-
if (!__DEV__) return;
|
|
38
|
-
activeSignals.push(sig);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function unregisterSignal(sig) {
|
|
42
|
-
if (!__DEV__) return;
|
|
43
|
-
const idx = activeSignals.indexOf(sig);
|
|
44
|
-
if (idx >= 0) activeSignals.splice(idx, 1);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function getActiveSignals() {
|
|
48
|
-
return activeSignals.slice();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// --- Health Check ---
|
|
52
|
-
// Quick health assessment for agents.
|
|
53
|
-
|
|
54
|
-
export function getHealth() {
|
|
55
|
-
const errors = getCollectedErrors();
|
|
56
|
-
const recentErrors = errors.filter(e => Date.now() - e.timestamp < 60000);
|
|
57
|
-
|
|
58
|
-
// Check for effect cycles
|
|
59
|
-
const cycleErrors = errors.filter(e => e.code === 'ERR_INFINITE_EFFECT');
|
|
60
|
-
const effectCycleRisk = cycleErrors.length > 0;
|
|
61
|
-
|
|
62
|
-
// Check for orphan effects (effects outside roots)
|
|
63
|
-
const orphanErrors = errors.filter(e => e.code === 'ERR_ORPHAN_EFFECT');
|
|
64
|
-
|
|
65
|
-
// Check for signal leaks (signals without subscribers that keep accumulating)
|
|
66
|
-
const signalLeaks = activeSignals.filter(s => {
|
|
67
|
-
if (s._subs && s._subs.size === 0) return true;
|
|
68
|
-
return false;
|
|
69
|
-
}).length;
|
|
70
|
-
|
|
71
|
-
// Memory pressure heuristic
|
|
72
|
-
const totalSignals = activeSignals.length;
|
|
73
|
-
const memoryPressure = totalSignals > 10000 ? 'high'
|
|
74
|
-
: totalSignals > 1000 ? 'medium'
|
|
75
|
-
: 'low';
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
effectCycleRisk,
|
|
79
|
-
orphanEffects: orphanErrors.length,
|
|
80
|
-
signalLeaks,
|
|
81
|
-
memoryPressure,
|
|
82
|
-
recentErrorCount: recentErrors.length,
|
|
83
|
-
totalSignals,
|
|
84
|
-
totalComponents: mountedComponents.length,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// --- Install Agent Context ---
|
|
89
|
-
// Call this during app initialization (dev mode only) to expose the global.
|
|
90
|
-
|
|
91
|
-
export function installAgentContext() {
|
|
92
|
-
if (!__DEV__) return;
|
|
93
|
-
if (typeof globalThis === 'undefined') return;
|
|
94
|
-
|
|
95
|
-
globalThis.__WHAT_AGENT__ = {
|
|
96
|
-
framework: 'what-framework',
|
|
97
|
-
version: VERSION,
|
|
98
|
-
mode: 'development',
|
|
99
|
-
features: ['signals', 'effects', 'computed', 'ssr', 'islands', 'router', 'stores', 'forms', 'animations', 'a11y'],
|
|
100
|
-
|
|
101
|
-
// Live accessors — always return current state
|
|
102
|
-
components: () => getMountedComponents().map(c => ({
|
|
103
|
-
id: c.id,
|
|
104
|
-
name: c.name || c.displayName || c.constructor?.name,
|
|
105
|
-
})),
|
|
106
|
-
|
|
107
|
-
signals: () => getActiveSignals().map((s, i) => ({
|
|
108
|
-
id: i,
|
|
109
|
-
name: s._debugName || `signal_${i}`,
|
|
110
|
-
value: typeof s === 'function' ? s.peek?.() : undefined,
|
|
111
|
-
subscriberCount: s._subs ? s._subs.size : 0,
|
|
112
|
-
})),
|
|
113
|
-
|
|
114
|
-
errors: () => getCollectedErrors(),
|
|
115
|
-
|
|
116
|
-
health: () => getHealth(),
|
|
117
|
-
|
|
118
|
-
// Metadata for agents
|
|
119
|
-
api: {
|
|
120
|
-
reactive: ['signal', 'computed', 'effect', 'batch', 'untrack', 'flushSync', 'createRoot', 'memo'],
|
|
121
|
-
hooks: ['useState', 'useSignal', 'useComputed', 'useEffect', 'useMemo', 'useCallback', 'useRef', 'useContext', 'onMount', 'onCleanup'],
|
|
122
|
-
components: ['Show', 'For', 'Switch', 'Match', 'Suspense', 'ErrorBoundary', 'lazy', 'Island'],
|
|
123
|
-
data: ['useSWR', 'useQuery', 'useFetch', 'useInfiniteQuery'],
|
|
124
|
-
store: ['createStore', 'derived', 'atom'],
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
}
|