what-core 0.12.3 → 0.13.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/src/scheduler.js CHANGED
@@ -56,7 +56,24 @@ export function flushScheduler() {
56
56
  try { fn(); } catch (e) { console.error('[what] Scheduler write error:', e); }
57
57
  }
58
58
 
59
+ // Clear the flag BEFORE checking for leftovers so schedule() can arm a frame.
59
60
  scheduled = false;
61
+
62
+ // A callback may queue work whose phase has already run in this flush. The
63
+ // canonical case is cssTransition(): it asks for a reflow READ from inside a
64
+ // WRITE, and the read queue was drained before the write phase started.
65
+ // schedule() short-circuits while `scheduled` is true, so that request used
66
+ // to land in a drained queue with no frame armed and sat there until some
67
+ // unrelated code happened to poke the scheduler again (cssTransition's
68
+ // promise never settled and the element stayed on its start class).
69
+ //
70
+ // Arm another frame for whatever is left instead of dropping it. We defer by
71
+ // a frame rather than looping here on purpose: a callback that re-schedules
72
+ // itself unconditionally then costs one iteration per frame, the same bound
73
+ // as a plain requestAnimationFrame loop, instead of spinning the main thread
74
+ // forever inside a single flush. One frame is armed no matter how many
75
+ // leftovers there are, because schedule() is idempotent.
76
+ if (readQueue.length > 0 || writeQueue.length > 0) schedule();
60
77
  }
61
78
 
62
79
  // --- Internal scheduling ---
@@ -72,11 +89,11 @@ function schedule() {
72
89
  // Returns a promise that resolves with the value.
73
90
 
74
91
  export function measure(fn) {
75
- return new Promise(resolve => {
92
+ return /** @type {Promise<void>} */ (new Promise(resolve => {
76
93
  scheduleRead(() => {
77
94
  resolve(fn());
78
95
  });
79
- });
96
+ }));
80
97
  }
81
98
 
82
99
  // --- Mutate helper ---
@@ -84,12 +101,12 @@ export function measure(fn) {
84
101
  // Returns a promise that resolves when the write is done.
85
102
 
86
103
  export function mutate(fn) {
87
- return new Promise(resolve => {
104
+ return /** @type {Promise<void>} */ (new Promise(resolve => {
88
105
  scheduleWrite(() => {
89
106
  fn();
90
107
  resolve();
91
108
  });
92
- });
109
+ }));
93
110
  }
94
111
 
95
112
  // --- useScheduledEffect ---
@@ -125,7 +142,7 @@ export function nextFrame() {
125
142
  reject(new Error('Cancelled'));
126
143
  };
127
144
  });
128
- promise.cancel = cancel;
145
+ /** @type {any} */ (promise).cancel = cancel;
129
146
  return promise;
130
147
  }
131
148
 
@@ -211,7 +228,7 @@ export function onIntersect(element, callback, options = {}) {
211
228
  export function smoothScrollTo(element, options = {}) {
212
229
  const { duration = 300, easing = t => t * (2 - t) } = options;
213
230
 
214
- return new Promise(resolve => {
231
+ return /** @type {Promise<void>} */ (new Promise(resolve => {
215
232
  let startY;
216
233
  let targetY;
217
234
  let startTime;
@@ -242,5 +259,5 @@ export function smoothScrollTo(element, options = {}) {
242
259
  });
243
260
  });
244
261
  }
245
- });
262
+ }));
246
263
  }
package/src/skeleton.js CHANGED
@@ -74,6 +74,16 @@ function injectStyles() {
74
74
 
75
75
  // --- Skeleton Component ---
76
76
 
77
+ /**
78
+ * @param {object} props
79
+ * @param {number|string} [props.width]
80
+ * @param {number|string} [props.height]
81
+ * @param {'shimmer'|'pulse'|'wave'} [props.variant]
82
+ * @param {boolean} [props.circle]
83
+ * @param {string} [props.class]
84
+ * @param {Record<string, any>} [props.style]
85
+ * @param {number} [props.count]
86
+ */
77
87
  export function Skeleton({
78
88
  width,
79
89
  height,
@@ -137,6 +147,11 @@ export function SkeletonText({
137
147
 
138
148
  // --- Skeleton Avatar ---
139
149
 
150
+ /**
151
+ * @param {object} props
152
+ * @param {number} [props.size]
153
+ * @param {'shimmer'|'pulse'|'wave'} [props.variant]
154
+ */
140
155
  export function SkeletonAvatar({
141
156
  size = 40,
142
157
  variant = 'shimmer',
@@ -251,7 +266,7 @@ export function IslandSkeleton({
251
266
  // --- useSkeleton Hook ---
252
267
  // Show skeleton while loading data
253
268
 
254
- export function useSkeleton(asyncFn, deps = []) {
269
+ export function useSkeleton(asyncFn, _deps = []) {
255
270
  const isLoading = signal(true);
256
271
  const data = signal(null);
257
272
  const error = signal(null);
package/src/store.js CHANGED
@@ -51,7 +51,6 @@ export function createStore(definition) {
51
51
  const signals = {};
52
52
  const computeds = {};
53
53
  const actions = {};
54
- const state = {};
55
54
 
56
55
  // Separate state, computeds, and actions
57
56
  // Use explicit _storeComputed marker instead of function.length heuristic
package/src/testing.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Helpers for testing components, similar to @testing-library/react
3
3
  // Works with Node.js test runner or any test framework
4
4
 
5
- import { signal, computed, effect, batch, flushSync, createRoot, untrack } from './reactive.js';
5
+ import { signal, effect, flushSync, createRoot, __DEV__, __devtools, __setDevToolsHooks } from './reactive.js';
6
6
  import { mount } from './dom.js';
7
7
  import { h } from './h.js';
8
8
 
@@ -125,42 +125,105 @@ export function flushEffects() {
125
125
  // Track signal reads and writes within a callback.
126
126
  // Returns { accessed: string[], written: string[] }
127
127
 
128
+ // --- trackSignals ---
129
+ //
130
+ // Reports which named signals a callback reads and writes.
131
+ //
132
+ // Reads are transitive: reading a computed reports the signals that computed
133
+ // depends on, not the computed itself. That is what "which signals does this
134
+ // depend on" means in a reactive graph, and it is the question worth asking of
135
+ // a callback under test.
136
+ //
137
+ // A signal created without a debug name has nothing to report, so it appears
138
+ // as the single entry UNNAMED rather than vanishing. A caller who sees it
139
+ // knows the answer is incomplete and which signal to name; silently returning
140
+ // a short list would let an assertion pass for the wrong reason.
141
+ const UNNAMED = '(unnamed)';
142
+
128
143
  export function trackSignals(fn) {
144
+ if (!__DEV__) {
145
+ throw new Error(
146
+ '[what] trackSignals() requires a development build. Signal debug names ' +
147
+ 'and subscriber back-references are stripped in production, so there is ' +
148
+ 'nothing to report. Run your tests with NODE_ENV !== "production".'
149
+ );
150
+ }
151
+
129
152
  const accessed = [];
130
153
  const written = [];
131
-
132
- // Intercept signal reads/writes by wrapping in an effect context
133
- // that captures the read calls, and monkey-patching .set temporarily.
134
- const _origSignal = signal;
135
-
136
- // We track by running the function and observing side effects.
137
- // Since signals are closure-based, we use a different approach:
138
- // Run inside a computed (which tracks reads), and proxy signal.set calls.
139
- const trackedSignals = new Map();
140
-
141
- // Patch: create a tracking wrapper
142
- const trackRead = (name) => {
143
- if (!accessed.includes(name)) accessed.push(name);
154
+ const addOnce = (list, name) => { if (!list.includes(name)) list.push(name); };
155
+
156
+ // --- Writes ---
157
+ //
158
+ // Every signal write calls __devtools.onSignalUpdate(sig) in dev, and
159
+ // __devtools is consulted at write time rather than at creation time, so
160
+ // this catches writes to signals that existed long before this call.
161
+ // Chain the previous hooks rather than replacing them: otherwise running a
162
+ // test would silently disable installed devtools for the duration.
163
+ const previousHooks = __devtools;
164
+ const trackingHooks = {
165
+ ...(previousHooks || {}),
166
+ onSignalUpdate(sig) {
167
+ addOnce(written, sig?._debugName || UNNAMED);
168
+ previousHooks?.onSignalUpdate?.(sig);
169
+ },
144
170
  };
145
- const trackWrite = (name) => {
146
- if (!written.includes(name)) written.push(name);
171
+ // A chained hook must not claim to be the pre-install buffer, or the real
172
+ // devtools would later try to drain it a second time.
173
+ delete trackingHooks.__isPreinstallBuffer;
174
+
175
+ // --- Reads ---
176
+ //
177
+ // Reading a signal inside an effect adds that effect to the signal's
178
+ // subscriber Set and pushes the Set onto effect.deps. effect() returns a
179
+ // dispose function rather than the effect, so the effect is reached through
180
+ // a probe signal: after the run, the probe's subscriber Set holds exactly
181
+ // the effect that read it.
182
+ const probe = signal(0, '__trackSignals_probe__');
183
+ // Held in a box rather than a `let`: the assignment happens inside
184
+ // createRoot's callback, and the finally below has to run it whether the
185
+ // tracked fn returned or threw.
186
+ /** @type {{ current: (() => void) | null }} */
187
+ const root = { current: null };
188
+ let thrown = null;
189
+
190
+ const collectReads = (depSets, seen) => {
191
+ for (const depSet of depSets || []) {
192
+ if (seen.has(depSet)) continue;
193
+ seen.add(depSet);
194
+ const sig = depSet._signalOwner;
195
+ if (sig) {
196
+ if (sig !== probe) addOnce(accessed, sig._debugName || UNNAMED);
197
+ continue;
198
+ }
199
+ // Not a signal's Set, so it belongs to a computed. `_owner` is that
200
+ // computed's inner effect; its own deps are the sources to follow.
201
+ const owner = depSet._owner;
202
+ if (owner?.deps) collectReads(owner.deps, seen);
203
+ }
147
204
  };
148
205
 
149
- // We run the function and rely on the reactive system's currentEffect tracking.
150
- // To detect reads, we run in an effect. To detect writes, we'd need instrumentation.
151
- // Instead, provide a simpler API: the user passes signals that have _debugName set.
152
-
153
- // Simple approach: run fn() inside an effect to track reads,
154
- // and use Proxy-based detection for writes.
155
- let dispose;
156
- createRoot((d) => {
157
- dispose = d;
158
- const e = effect(() => {
159
- fn();
206
+ __setDevToolsHooks(trackingHooks);
207
+ try {
208
+ createRoot((disposeRoot) => {
209
+ root.current = disposeRoot;
210
+ effect(() => {
211
+ probe();
212
+ fn();
213
+ });
160
214
  });
161
- });
162
- if (dispose) dispose();
163
215
 
216
+ const seen = new Set();
217
+ for (const tracked of probe._subs) collectReads(tracked.deps, seen);
218
+ } catch (err) {
219
+ thrown = err;
220
+ } finally {
221
+ // Deps are read before this: disposal clears them.
222
+ root.current?.();
223
+ __setDevToolsHooks(previousHooks);
224
+ }
225
+
226
+ if (thrown) throw thrown;
164
227
  return { accessed, written };
165
228
  }
166
229
 
@@ -229,18 +292,12 @@ export function mockSignal(name, initialValue) {
229
292
 
230
293
  function queryByText(container, text) {
231
294
  const regex = text instanceof RegExp ? text : null;
232
- const walker = document.createTreeWalker(
233
- container,
234
- NodeFilter.SHOW_TEXT,
235
- null,
236
- false
237
- );
295
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT, null);
238
296
 
239
297
  while (walker.nextNode()) {
240
298
  const node = walker.currentNode;
241
- const matches = regex
242
- ? regex.test(node.textContent)
243
- : node.textContent.includes(text);
299
+ const content = node.textContent || '';
300
+ const matches = regex ? regex.test(content) : content.includes(text);
244
301
  if (matches) {
245
302
  return node.parentElement;
246
303
  }
@@ -251,18 +308,12 @@ function queryByText(container, text) {
251
308
  function queryAllByText(container, text) {
252
309
  const results = [];
253
310
  const regex = text instanceof RegExp ? text : null;
254
- const walker = document.createTreeWalker(
255
- container,
256
- NodeFilter.SHOW_TEXT,
257
- null,
258
- false
259
- );
311
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT, null);
260
312
 
261
313
  while (walker.nextNode()) {
262
314
  const node = walker.currentNode;
263
- const matches = regex
264
- ? regex.test(node.textContent)
265
- : node.textContent.includes(text);
315
+ const content = node.textContent || '';
316
+ const matches = regex ? regex.test(content) : content.includes(text);
266
317
  if (matches) {
267
318
  results.push(node.parentElement);
268
319
  }
@@ -364,7 +415,7 @@ export async function waitFor(callback, options = {}) {
364
415
  try {
365
416
  const result = callback();
366
417
  if (result) return result;
367
- } catch (e) {
418
+ } catch {
368
419
  // Keep waiting
369
420
  }
370
421
  await new Promise(r => setTimeout(r, interval));
@@ -401,9 +452,9 @@ export async function act(callback) {
401
452
  // Synchronously flush all pending effects
402
453
  flushSync();
403
454
  // Wait for microtasks to flush
404
- await new Promise(r => queueMicrotask(r));
455
+ await /** @type {Promise<void>} */ (new Promise(r => queueMicrotask(() => r())));
405
456
  // Wait for any scheduled effects
406
- await new Promise(r => setTimeout(r, 0));
457
+ await /** @type {Promise<void>} */ (new Promise(r => setTimeout(() => r(), 0)));
407
458
  return result;
408
459
  }
409
460
 
package/src/warnings.js CHANGED
@@ -1,6 +1,62 @@
1
1
  // What Framework - Dev-mode Warning System
2
2
  // Helpful, not noisy: each unique warning fires only once.
3
3
  // All warnings are dev-only and tree-shaken in production builds.
4
+ //
5
+ // STATUS: warn() and the fire-once bookkeeping work. NONE of the five
6
+ // warnXxx() helpers below has a caller anywhere in the framework, and this
7
+ // module is not re-exported from index.js, so nothing outside its own unit
8
+ // test has ever imported it. Verified 2026-08 by grepping every package for
9
+ // each helper name: the only hits are the definitions here and
10
+ // packages/core/test/warnings.test.js, which calls them directly.
11
+ //
12
+ // That matters because docs-site/llms-full.txt advertises several of these as
13
+ // conditions "the runtime detects and reports in dev mode". It does not. What
14
+ // each one would actually need, written down so the next reader does not have
15
+ // to re-derive it (same reasoning as the removed-guardrail note in
16
+ // guardrails.js):
17
+ //
18
+ // warnMissingSignalRead Redundant. The condition IS reported, by
19
+ // installSignalReadGuardrail() in guardrails.js,
20
+ // which raises ERR_MISSING_SIGNAL_READ off the
21
+ // signal's toString/valueOf. Prefer that path.
22
+ //
23
+ // warnSignalWriteDuringRender Needs two hooks in files this module cannot
24
+ // reach: a render-phase flag set around the
25
+ // `Component(reactiveProps)` call in dom.js
26
+ // createComponent(), and a read of that flag in
27
+ // _sigWrite() in reactive.js. Both are required:
28
+ // the write site alone cannot tell a render from
29
+ // a handler, and the render site alone never sees
30
+ // the write. A signal function cannot be patched
31
+ // from outside to catch this either — sig(v)
32
+ // calls the _sigWrite closure directly, not the
33
+ // replaceable sig.set property. NOTE the false
34
+ // positive to avoid when wiring it: components
35
+ // run ONCE, so a handler merely DEFINED in a
36
+ // component body is not a write during render.
37
+ // Only a write that executes synchronously
38
+ // inside the body counts, which is exactly what
39
+ // a render-phase flag measures.
40
+ //
41
+ // warnEffectWithoutCleanup Would have to observe addEventListener calls
42
+ // made during an effect's run and correlate them
43
+ // with the effect's return value. Nothing tracks
44
+ // that today.
45
+ //
46
+ // warnLargeListWithoutKeys The condition is already reported, at BUILD
47
+ // time, by the babel plugin (search
48
+ // ERR_MISSING_KEY in
49
+ // packages/compiler/src/babel-plugin.js).
50
+ // Key-ness is settled by the source, so the
51
+ // compiler sees it and the runtime does not need
52
+ // to.
53
+ //
54
+ // warnUnusedSignal Needs a read-count on every signal plus a
55
+ // disposal hook to check it at. reactive.js
56
+ // tracks neither.
57
+ //
58
+ // ERR_ORPHAN_EFFECT, also advertised in llms-full.txt, has no helper here on
59
+ // purpose: it is not detectable. See the note at the bottom of this file.
4
60
 
5
61
  import { __DEV__ } from './reactive.js';
6
62
 
@@ -108,3 +164,30 @@ export function warnUnusedSignal(signalName, componentName) {
108
164
  `[what] Warning: Signal '${signalName}' created${ctx} but never read.`
109
165
  );
110
166
  }
167
+
168
+ // --- Why there is no warnOrphanEffect() ---
169
+ //
170
+ // ERROR_CODES.ORPHAN_EFFECT ("created outside a reactive root — it will never
171
+ // be cleaned up") has no detectable condition in What, so no helper for it is
172
+ // added here. The only signal available at effect() creation time is whether
173
+ // there is a current owner, and getOwner() returns null in every ordinary
174
+ // place an effect is written. Measured against this build:
175
+ //
176
+ // module scope ........ null onMount() callback ... null
177
+ // component body ...... null event handler ....... null
178
+ // inside createRoot() .. owner
179
+ //
180
+ // So the check would fire on effects created in a component body, which is
181
+ // the very thing the error's own suggestion text tells the user to do
182
+ // instead. Firing on the recommended fix is the worst possible outcome for a
183
+ // warning, and there is no second signal to narrow it with: What has no
184
+ // component-level owner for an effect to attach to. Detecting this would mean
185
+ // giving components an owner scope first, which is a reactivity change, not a
186
+ // warning.
187
+ //
188
+ // (Related, and separately worth someone's attention: because a component
189
+ // body has no owner, a bare effect() created in one is not registered for
190
+ // disposal at all. Unmounting the component leaves it subscribed and re-running
191
+ // — reproducible by mounting a component that calls effect(), unmounting it,
192
+ // then writing the signal it reads and watching the run count climb. Fixing
193
+ // that lives in dom.js/reactive.js, not here.)
package/testing.d.ts CHANGED
@@ -120,7 +120,23 @@ export function renderTest<P = {}>(Component: (props: P) => any, props?: P): Ren
120
120
  /** Run every pending effect synchronously, so assertions see settled DOM. */
121
121
  export function flushEffects(): void;
122
122
 
123
- /** Record which signals a callback reads and writes, by debug name. */
123
+ /**
124
+ * Record which signals a callback reads and writes, by debug name.
125
+ *
126
+ * Reads are transitive: reading a computed reports the signals that computed
127
+ * depends on, not the computed itself.
128
+ *
129
+ * `peek()` is not a read, and writing a value equal to the current one is not
130
+ * a write, matching the reactive system's own semantics.
131
+ *
132
+ * A signal created without a debug name has no name to report and appears as
133
+ * the single entry `'(unnamed)'`. Name your signals (`signal(0, 'count')`) to
134
+ * get anything more specific.
135
+ *
136
+ * Dev builds only. In production the debug names and subscriber
137
+ * back-references this reads are stripped, so it throws rather than reporting
138
+ * an empty result that would look like "nothing happened".
139
+ */
124
140
  export function trackSignals(fn: () => void): { accessed: string[]; written: string[] };
125
141
 
126
142
  // --- mockSignal ---
@@ -1,11 +0,0 @@
1
- import{$ as at,B as At,N as q,O as Ct,Q as wt,R as Et,S as V,U as k,V as Tt,W as ot,Z as Lt,_ as St,a as z,c as O,e as K,m as J,q as _t}from"./chunk-VTPLA4AS.min.js";import{a as X}from"./chunk-O3SKPRTY.min.js";var Mt=O(null);typeof document<"u"&&document.addEventListener("focusin",t=>{Mt.set(t.target)});function ye(){return{current:()=>Mt(),focus:t=>t?.focus(),blur:()=>document.activeElement?.blur()}}function me(){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 Wt(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=Dt(o);if(i.length===0)return;i[0].focus();function m(c){if(c.key!=="Tab")return;let u=Dt(o),s=u[0],h=u[u.length-1];c.shiftKey?document.activeElement===s&&(c.preventDefault(),h.focus()):document.activeElement===h&&(c.preventDefault(),s.focus())}return o.addEventListener("keydown",m),()=>{o.removeEventListener("keydown",m)}}function r(){e&&typeof e.focus=="function"&&e.focus()}return{activate:n,deactivate:r}}function Dt(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 xe({children:t,active:e=!0}){let n={current:null},r=O(0),o=Wt(n),i=null,m=s=>{n.current=s,r.set(h=>h+1)},c=K(()=>{if(r(),i&&(i(),i=null,o.deactivate()),e&&n.current)return i=o.activate(),()=>{i?.(),i=null,o.deactivate()}}),u=Tt?.();return u&&(u._cleanupCallbacks=u._cleanupCallbacks||[],u._cleanupCallbacks.push(()=>{c(),i?.(),i=null,o.deactivate()})),X("div",{ref:m},t)}var G=null,dt=0;function Xt(){return typeof document>"u"?null:(G||(G=document.createElement("div"),G.id="what-announcer",G.setAttribute("aria-live","polite"),G.setAttribute("aria-atomic","true"),G.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(G)),G)}function kt(t,e={}){let{priority:n="polite",timeout:r=1e3}=e,o=Xt();if(!o)return;o.setAttribute("aria-live",n);let i=++dt;o.textContent="",requestAnimationFrame(()=>{dt===i&&(o.textContent=t)}),setTimeout(()=>{dt===i&&(o.textContent="")},r)}function be(t){return kt(t,{priority:"assertive"})}function _e({href:t="#main",children:e="Skip to content"}){return X("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 Ae(t=!1){let e=O(t);return{expanded:()=>e(),toggle:()=>e.set(!e.peek()),open:()=>e.set(!0),close:()=>e.set(!1),buttonProps:()=>({"aria-expanded":e(),onClick:()=>e.set(!e.peek())}),panelProps:()=>({hidden:!e()})}}function Ce(t=null){let e=O(t);return{selected:()=>e(),select:n=>e.set(n),isSelected:n=>e()===n,itemProps:n=>({"aria-selected":e()===n,onClick:()=>e.set(n)})}}function we(t=!1){let e=O(t);return{checked:()=>e(),toggle:()=>e.set(!e.peek()),set:n=>e.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":e(),tabIndex:0,onClick:()=>e.set(!e.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.set(!e.peek()))}})}}function Ee(t){let e=typeof t=="function"?t:()=>t,n=O(0);function r(o){let i=e();if(!(i<=0))switch(o.key){case"ArrowDown":case"ArrowRight":o.preventDefault(),n.set((n.peek()+1)%i);break;case"ArrowUp":case"ArrowLeft":o.preventDefault(),n.set((n.peek()-1+i)%i);break;case"Home":o.preventDefault(),n.set(0);break;case"End":o.preventDefault(),n.set(i-1);break}}return{focusIndex:()=>n(),setFocusIndex:o=>n.set(o),getItemProps:o=>({tabIndex:n()===o?0:-1,onKeyDown:r,onFocus:()=>n.set(o)}),containerProps:()=>({role:"listbox"})}}function Te({children:t,as:e="span"}){return X(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 Le({children:t,priority:e="polite",atomic:n=!0}){return X("div",{"aria-live":e,"aria-atomic":n},t)}var Bt=0;function Ht(){let t=_t();return t?(t.idCounter=(t.idCounter||0)+1,t.idCounter):++Bt}function Pt(){Bt=0}function Kt(t="what"){let e=`${t}-${Ht()}`;return()=>e}function Se(t,e="what"){let n=[];for(let r=0;r<t;r++)n.push(`${e}-${Ht()}`);return n}function De(t){let e=Kt("desc");return{descriptionId:e,descriptionProps:()=>({id:e(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":e()}),Description:()=>X("div",{id:e(),style:{display:"none"}},t)}}function Me(t){let e=Kt("label");return{labelId:e,labelProps:()=>({id:e()}),labelledByProps:()=>({"aria-labelledby":e()})}}var Be={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function He(t,e){return n=>{n.key===t&&e(n)}}function Pe(t,e){return n=>{t.includes(n.key)&&e(n)}}var v=null;function Ue(t){v=typeof t=="function"?t:null}function qe(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.defineProperty(e,"_$lazyChildren",{value:r,configurable:!0}),k({tag:t,props:e,children:[],key:null,_vnode:!0})}if(n&&n.length>0){let r=n.length===1?n[0]:n;e?e.children=r:e={children:r}}return k({tag:t,props:e||{},children:n||[],key:null,_vnode:!0})}var Zt={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>"}},Jt=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 Rt(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function Qt(t){let e=t.trim(),n=Rt(e);if(Jt.has(n))return Yt(e);let r=Zt[n];if(r){let i=document.createElement("template");i.innerHTML=r.wrap+e+r.unwrap;let m=i.content.firstChild;for(let c=0;c<r.depth;c++)m=m.firstChild;return()=>m.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}var Nt=!1;function Ie(t){return z&&!Nt&&(Nt=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Qt(t)}function Yt(t){let e=t.trim();if(Rt(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 Ot(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return Ot(t,e(),n);if(typeof e=="function"){let r=n||null,o=null,i=null,m=!1,c=zt();return K(()=>Gt(c,()=>{let u=e(),s=typeof u;if(!m){m=!0,s==="string"||s==="number"?(i=document.createTextNode(String(u)),r?t.insertBefore(i,r):t.appendChild(i),v&&v(t,String(u)),o=i):o=it(t,u,null,r);return}if(i!==null&&(s==="string"||s==="number")){let h=String(u);i.data!==h&&(i.data=h),v&&v(t,h);return}i=null,o=it(t,u,o,r)})),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):it(t,e,null,n||null)}function Vt(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function vt(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var st=typeof SVGElement<"u";function mt(t){return st&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function zt(){let t=ot();return t[t.length-1]||null}function Gt(t,e){let n=ot(),r=t!==null&&n[n.length-1]!==t;r&&n.push(t);try{return e()}finally{r&&n.pop()}}function $t(t){return t==null?[]:Array.isArray(t)?t:[t]}function Ut(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let r=0;r<t.length;r++)Ut(t[r],e,n);return n}if(typeof t=="function"){let r=k(t,e,mt(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(Vt(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(vt(t)){let r=k(t,e,mt(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 Ft(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 it(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 s=$t(n);for(let h=0;h<s.length;h++){let l=s[h];l.parentNode===t&&(V(l),t.removeChild(l))}return null}if((typeof e=="string"||typeof e=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let s=String(e);return n.data!==s&&(n.data=s),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?(V(n),t.replaceChild(e,n)):o?t.insertBefore(e,o):t.appendChild(e),e}let i=Ut(e,t,[]),m=$t(n);if(Ft(m,i))return n;let c=i.length;for(let s=0;s<m.length;s++){let h=m[s];if(h.parentNode!==t)continue;let l=!1;for(let y=0;y<c;y++)if(i[y]===h){l=!0;break}l||(V(h),t.removeChild(h))}let u=o;for(let s=i.length-1;s>=0;s--){let h=i[s];(h.parentNode!==t||h.nextSibling!==u)&&(u&&u.parentNode!==t&&(u=null),u?t.insertBefore(h,u):t.appendChild(h)),u=h}return i.length===0?null:i.length===1?i[0]:i}function We(t,e,n){let r=n?.key,o=n?.raw||!1,i=(m,c)=>{let u=[],s=[],h=[],l=r&&!o?new Map:null,y=document.createComment("/list");return m.insertBefore(y,c||null),K(()=>{let x=t()||[],p=y.parentNode||m;r?re(p,y,u,x,s,h,e,r,l):te(p,y,u,x,s,h,e),u=x.length>0?x.slice():x}),y};return i._mapArray=!0,i._mapArraySource=t,i._mapArrayFn=e,i._mapArrayKeyed=!!r&&!o,i}function Xe(t){let e=t._mapArraySource()||[],n=t._mapArrayFn,r=t._mapArrayKeyed;return e.map((o,i)=>n(r?()=>o:o,i))}function te(t,e,n,r,o,i,m){let c=r.length,u=n.length;if(c===0){if(u>0){for(let a=0;a<u;a++)i[a]&&i[a]();for(let a=u-1;a>=0;a--){let d=o[a];d&&(V(d),d.parentNode===t&&t.removeChild(d))}o.length=0,i.length=0}return}if(u===0){let a=document.createDocumentFragment();for(let d=0;d<c;d++){let T=r[d],S=J(R=>(i[d]=R,m(T,d)));o[d]=S,a.appendChild(S)}t.insertBefore(a,e);return}let s=0,h=Math.min(u,c);for(;s<h&&n[s]===r[s];)s++;if(s===u&&s===c)return;let l=u-1,y=c-1;for(;l>=s&&y>=s&&n[l]===r[y];)l--,y--;let x=new Array(c),p=new Array(c);for(let a=0;a<s;a++)x[a]=o[a],p[a]=i[a];for(let a=y+1;a<c;a++){let d=l+1+(a-y-1);x[a]=o[d],p[a]=i[d]}let _=y-s+1,w=l-s+1;if(_===0)for(let a=s;a<=l;a++)i[a]?.(),o[a]&&V(o[a]),o[a]?.parentNode&&o[a].parentNode.removeChild(o[a]);else if(w===0){let a=s<c&&x[y+1]?x[y+1]:e,d=document.createDocumentFragment();for(let T=s;T<=y;T++){let S=r[T],R=T;x[T]=J(D=>(p[R]=D,m(S,R))),d.appendChild(x[T])}t.insertBefore(d,a)}else ee(t,e,n,r,o,i,m,s,l,y,x,p);o.length=c,i.length=c;for(let a=0;a<c;a++)o[a]=x[a],i[a]=p[a]}function ee(t,e,n,r,o,i,m,c,u,s,h,l){let y=new Map;for(let d=c;d<=u;d++)y.set(n[d],d);let x=s-c+1,p=new Int32Array(x);p.fill(-1);for(let d=c;d<=s;d++){let T=y.get(r[d]);T!==void 0&&(y.delete(r[d]),h[d]=o[T],l[d]=i[T],p[d-c]=T)}for(let[,d]of y)i[d]?.(),o[d]&&V(o[d]),o[d]?.parentNode&&o[d].parentNode.removeChild(o[d]);let _=x-ne(p,x),w=new Uint8Array(x);if(_>1){let d=new Int32Array(_),T=new Int32Array(_),S=0;for(let D=0;D<x;D++)p[D]!==-1&&(d[S]=p[D],T[S]=D,S++);let R=qt(d,_);for(let D=0;D<R.length;D++)w[T[R[D]]]=1}else if(_===1){for(let d=0;d<x;d++)if(p[d]!==-1){w[d]=1;break}}for(let d=c;d<=s;d++)if(!h[d]){let T=r[d],S=d;h[d]=J(R=>(l[S]=R,m(T,S)))}let a=s+1<h.length&&h[s+1]?h[s+1]:e;for(let d=s;d>=c;d--){let T=d-c;(p[T]===-1||!w[T])&&(a&&a.parentNode!==t&&(a=e),t.insertBefore(h[d],a)),a=h[d]}}function ne(t,e){let n=0;for(let r=0;r<e;r++)t[r]===-1&&n++;return n}function qt(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 u=0,s=o-1;for(;u<s;){let h=u+s>>1;t[n[h]]<t[c]?u=h+1:s=h}n[u]=c,r[c]=u>0?n[u-1]:-1}let i=new Array(o),m=n[o-1];for(let c=o-1;c>=0;c--)i[c]=m,m=r[m];return i}function oe(){return document.createComment("i")}function Q(t,e,n,r){let o=e;for(;o&&o!==n;){let i=o.nextSibling;t.insertBefore(o,r),o=i}}function ht(t,e,n){let r=e;for(;r&&r!==n;){let o=r.nextSibling;V(r),t.removeChild(r),r=o}}function gt(t,e,n,r,o,i,m,c,u){let s;if(o){let y=r(e),x=u(e);s=x,o.set(y,{itemSig:x})}else s=e;let h=oe();t.appendChild(h);let l=J(y=>(c[n]=y,i(s,n)));t.appendChild(l),m[n]=h}function re(t,e,n,r,o,i,m,c,u){let s=r.length,h=n.length;if(s===0){if(h>0){for(let f=0;f<h;f++)i[f]&&i[f]();o[0]&&ht(t,o[0],e),o.length=0,i.length=0,u&&u.clear()}return}if(h===0){let f=document.createDocumentFragment();for(let A=0;A<s;A++)gt(f,r[A],A,c,u,m,o,i,O);t.insertBefore(f,e);return}let l=0,y=Math.min(h,s);for(;l<y;){if(n[l]===r[l]){l++;continue}let f=c(n[l]),A=c(r[l]);if(f!==A)break;u&&u.get(f).itemSig.set(r[l]),l++}let x=h-1,p=s-1;for(;x>=l&&p>=l;){if(n[x]===r[p]){x--,p--;continue}let f=c(n[x]),A=c(r[p]);if(f!==A)break;u&&u.get(f).itemSig.set(r[p]),x--,p--}if(l>x&&l>p)return;let _=new Array(s),w=new Array(s);for(let f=0;f<l;f++)_[f]=o[f],w[f]=i[f];for(let f=p+1;f<s;f++){let A=x+1+(f-p-1);_[f]=o[A],w[f]=i[A]}let a=p-l+1,d=x-l+1;if(d===0){let f=p+1<s&&_[p+1]?_[p+1]:e,A=document.createDocumentFragment();for(let L=l;L<=p;L++)gt(A,r[L],L,c,u,m,_,w,O);t.insertBefore(A,f),Y(o,i,_,w,s);return}if(a===0){for(let f=l;f<=x;f++){i[f]?.();let A=I(t,o[f],o,f,e);ht(t,o[f],A),u&&u.delete(c(n[f]))}Y(o,i,_,w,s);return}if(a===d&&a>=2&&a<=Math.max(d,200)){let f=0,A=-1,L=-1;for(let b=0;b<a&&f<=4;b++){let C=c(n[l+b]),$=c(r[l+b]);C!==$&&(f===0?A=b:f===1&&(L=b),f++)}if(f===2){let b=l+A,C=l+L,$=c(n[b]),j=c(n[C]),W=c(r[b]),et=c(r[C]);if($===et&&j===W){for(let g=0;g<l;g++)_[g]=o[g],w[g]=i[g];for(let g=l;g<=p;g++)_[g]=o[g],w[g]=i[g];for(let g=p+1;g<s;g++){let N=x+1+(g-p-1);_[g]=o[N],w[g]=i[N]}let U=_[b];_[b]=_[C],_[C]=U;let H=w[b];if(w[b]=w[C],w[C]=H,u){if(r[b]!==n[b]){let g=c(r[b]),N=u.get(g);N&&N.itemSig.set(r[b])}if(r[C]!==n[C]){let g=c(r[C]),N=u.get(g);N&&N.itemSig.set(r[C])}}let B=C===b+1||b===C+1,P=Math.min(b,C),M=Math.max(b,C);if(B){let g=I(t,o[M],o,M,e);Q(t,o[M],g,o[P])}else{let g=I(t,o[C],o,C,e),N=document.createComment("tmp");t.insertBefore(N,o[C]),Q(t,o[C],g,o[b]);let nt=I(t,o[b],o,b,e);Q(t,o[b],nt,N),t.removeChild(N)}Y(o,i,_,w,s);return}}if(f>=2&&f<=a){let b=A,C=null,$=-1,j=-1,W=!1,et=c(n[l+b]),U=-1;for(let H=b;H<a;H++)if(c(r[l+H])===et){U=H;break}if(U>b){let H=!0;for(let B=b;B<U;B++)if(c(n[l+B+1])!==c(r[l+B])){H=!1;break}if(H){let B=!0;for(let P=U+1;P<a;P++)if(c(n[l+P])!==c(r[l+P])){B=!1;break}B&&(W=!0,$=l+b,j=l+U,C=et)}}if(!W){let H=c(r[l+b]),B=-1;for(let P=b;P<d;P++)if(c(n[l+P])===H){B=P;break}if(B>b){let P=!0;for(let M=b;M<B;M++)if(c(n[l+M])!==c(r[l+M+1])){P=!1;break}if(P){let M=!0;for(let g=B+1;g<a;g++)if(c(n[l+g])!==c(r[l+g])){M=!1;break}M&&(W=!0,$=l+B,j=l+b,C=H)}}}if(W){for(let g=l;g<=x;g++)_[g]=o[g],w[g]=i[g];let H=_[$],B=w[$];if($<j)for(let g=$;g<j;g++)_[g]=_[g+1],w[g]=w[g+1];else for(let g=$;g>j;g--)_[g]=_[g-1],w[g]=w[g-1];if(_[j]=H,w[j]=B,u)for(let g=l;g<=p;g++){let N=c(r[g]);if(r[g]!==n[g]){let nt=u.get(N);nt&&nt.itemSig.set(r[g])}}let P=I(t,H,o,$,e),M;j+1<s?M=_[j+1]:M=e,(j>=p+1||M&&M.parentNode!==t)&&(M=e),Q(t,H,P,M),Y(o,i,_,w,s);return}}}let T=new Map;for(let f=l;f<=x;f++)T.set(c(n[f]),f);let S=new Int32Array(a);S.fill(-1);for(let f=l;f<=p;f++){let A=c(r[f]),L=T.get(A);L!==void 0&&(T.delete(A),_[f]=o[L],w[f]=i[L],S[f-l]=L,u&&r[f]!==n[L]&&u.get(A).itemSig.set(r[f]))}let R=[...T.values()].sort((f,A)=>A-f);for(let f of R){i[f]?.();let A=I(t,o[f],o,f,e);ht(t,o[f],A),u&&u.delete(c(n[f]))}for(let f=l;f<=p;f++)if(!_[f]){let A=document.createDocumentFragment();gt(A,r[f],f,c,u,m,_,w,O),_[f]._frag=A}let D=0,xt=!0,bt=-1;for(let f=0;f<a;f++)S[f]!==-1&&(D++,S[f]<=bt&&(xt=!1),bt=S[f]);let tt=new Uint8Array(a);if(xt)for(let f=0;f<a;f++)S[f]!==-1&&(tt[f]=1);else if(D>1){let f=new Int32Array(D),A=new Int32Array(D),L=0;for(let C=0;C<a;C++)S[C]!==-1&&(f[L]=S[C],A[L]=C,L++);let b=qt(f,D);for(let C=0;C<b.length;C++)tt[A[b[C]]]=1}else if(D===1){for(let f=0;f<a;f++)if(S[f]!==-1){tt[f]=1;break}}Y(o,i,_,w,s);let ut=p+1<s&&o[p+1]?o[p+1]:e;for(let f=p;f>=l;f--){let A=f-l,L=o[f];if(S[A]===-1)L._frag&&(t.insertBefore(L._frag,ut),delete L._frag);else if(!tt[A]){let b=I(t,L,o,f,e);Q(t,L,b,ut)}ut=L}}function I(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 Y(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 ke(t,e){for(let n in e){let r=e[n];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]=K(()=>{let o=r()||"";st&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):n==="style"&&typeof r()=="object"?t._propEffects[n]=K(()=>{lt(t,r())}):t._propEffects[n]=K(()=>{ft(t,n,r())})}else ft(t,n,r)}}function ft(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]=K(()=>ft(t,e,n()));return}if(q(e))return;if(Ct(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let r=st&&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")lt(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"?at(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function F(t,e,n,r){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=K(()=>r(t,n()))}function ie(t,e){if(typeof e=="function")return F(t,"class",e,ie);st&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function lt(t,e){if(typeof e=="function")return F(t,"style",e,lt);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 fe(t,e,n){if(typeof n=="function")return F(t,e,n,(r,o)=>fe(r,e,o));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function ce(t,e){if(typeof e=="function")return F(t,"value",e,ce);if(t.tagName==="SELECT"){at(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function se(t,e){if(typeof e=="function")return F(t,"checked",e,se);t.checked=!!e}var jt=new Set;function Ze(t){for(let e of t)jt.has(e)||(jt.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 Je(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Qe(t,e){K(()=>{for(let n in e){let r=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!r)}})}var ct=!1,E=null;function Ye(){return ct}function le(t,e){ct=!0,Pt(),E={parent:e,index:0};try{let n=Z(t,e);return e!==document.body&&e!==document.documentElement&&It(e),n}finally{ct=!1,E=null}}function It(t){if(!(!E||E.parent!==t))for(;t.childNodes.length>E.index;){let e=t.lastChild;V(e),t.removeChild(e)}}function pt(t){let e=t.childNodes;for(;E.index<e.length;){let n=e[E.index];if(n.nodeType===8){let r=n.textContent;if(r==="$"||r==="/$"||r==="[]"||r==="/[]"||r==="fn"||r==="/fn"){E.index++;continue}}return E.index++,n}return null}function ue(t){if(!E||E.parent!==t)return null;let e=t.childNodes;for(let n=E.index;n<e.length;n++){let r=e[n];if(r.nodeType===8){let o=r.textContent;if(o==="$"||o==="/$"||o==="[]"||o==="/[]"||o==="fn"||o==="/fn")continue}return r}return null}function rt(t,e){return E&&E.parent===t?(t.insertBefore(e,t.childNodes[E.index]||null),E.index++):t.appendChild(e),e}function yt(){return z}function Z(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=ue(e);return i&&i.nodeType===3?(pt(e),i.textContent="",i):rt(e,document.createTextNode(""))}let r=pt(e);if(r&&r.nodeType===3)return r.textContent!==n&&(yt()&&console.warn(`[what] Hydration mismatch: expected text "${n}", got "${r.textContent}"`),r.textContent=n),r;yt()&&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):rt(e,o),o}if(typeof t=="function"&&t._lazyChildren)return Z(t(),e);if(typeof t=="function"&&t._mapArray){let n=!!(E&&E.parent===e),r=n&&e.childNodes[E.index]||null,o=t(e,r);if(n){let i=Array.prototype.indexOf.call(e.childNodes,o);i>=0&&(E.index=i+1)}return o}if(typeof t=="function"){let n=!!(E&&E.parent===e),r=document.createComment("fn"),o=document.createComment("/fn");n?(e.insertBefore(r,e.childNodes[E.index]||null),E.index++):e.appendChild(r),Z(t(),e),n?(e.insertBefore(o,e.childNodes[E.index]||null),E.index++):e.appendChild(o);let i=[];for(let l=r.nextSibling;l&&l!==o;l=l.nextSibling)i.push(l);let m=i.length===0?null:i.length===1?i[0]:i,c=zt(),u=K(()=>Gt(c,()=>{let l=t();ct||(m=it(o.parentNode||e,l,m,o))})),s=!1,h=()=>{s||(s=!0,u())};return r._dispose=h,o._dispose=h,wt(r,h),m}if(Array.isArray(t)){let n=[];for(let r of t){let o=Z(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=ot(),m=t.tag,c=t.props||{},u=t.children||[],s={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:m,_parentCtx:i[i.length-1]||null,_errorBoundary:null};i.push(s);let h,l=null;try{let y={...c};c._$lazyChildren?l=Lt(m,y,c._$lazyChildren):y.children=u.length===0?c.children:u.length===1?u[0]:u,h=m(y),l&&l()}catch(y){return i.pop(),St(y)||console.error("[what] Error in component during hydration:",m.name||"Anonymous",y),null}s.mounted=!0,s._mountCallbacks&&queueMicrotask(()=>{if(!s.disposed)for(let y of s._mountCallbacks)try{y()}catch(x){console.error("[what] onMount error:",x)}});try{let y=Z(h,e),x=typeof h=="function"||Array.isArray(h)&&h.some(w=>typeof w=="function"),p=Array.isArray(y)?y[0]:y,_=!x&&p&&p.nodeType?p:e;return Et(_,s),y}finally{i.pop()}}let n=pt(e),r=t.tag.toLowerCase();if(n&&n.nodeType===1&&n.nodeName.toLowerCase()===r){ae(n,t.props||{});let i=E;if(E={parent:n,index:0},t.props?.dangerouslySetInnerHTML?.__html==null){for(let c of t.children)Z(c,n);t.children.length>0&&It(n)}return E=i,n}yt()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${n?n.nodeName:"nothing"}. Falling back to client render.`);let o=k(t,e,mt(e));return n?e.replaceChild(o,n):rt(e,o),o}return Vt(t)?t:rt(e,document.createTextNode(String(t)))}function ae(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"?K(()=>{t.className=r()||""}):n==="style"&&typeof r()=="object"?K(()=>{lt(t,r())}):K(()=>{ft(t,n,r())});continue}}}At({hydrate:le,insert:Ot});export{ye as a,me as b,Wt as c,xe as d,kt as e,be as f,_e as g,Ae as h,Ce as i,we as j,Ee as k,Te as l,Le as m,Kt as n,Se as o,De as p,Me as q,Be as r,He as s,Pe as t,Ue as u,qe as v,Qt as w,Ie as x,Yt as y,Ot as z,We as A,Xe as B,ke as C,ft as D,ie as E,lt as F,fe as G,ce as H,se as I,Ze as J,Je as K,Qe as L,Ye as M,le as N};
@@ -1 +0,0 @@
1
- import{a as M}from"./chunk-O3SKPRTY.min.js";var u=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),p=null;function Xe(e){u&&(p=e)}var C=null,S=null,v=null,H=!1,O=0,x=[],U=!1,V=Symbol("needs_upstream"),q=null;function k(e,t){let n=e,r=new Set,o=null,s=0;function c(f){u&&H&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let l=typeof f=="function"?f(n):f;(n===l?n!==0||1/n===1/l:n!==n&&l!==l)||(n=l,o=null,u&&p&&p.onSignalUpdate(i),r.size>0&&ie(r))}function i(f){if(arguments.length===0){let l=C;return l!==null&&(l!==o||l._epoch!==s)&&(o=l,s=l._epoch,r.add(l),l.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>N(()=>f(i())),i._signal=!0,u&&(i._subs=r,t&&(i._debugName=t)),u&&p&&p.onSignalCreate(i),i}function Qe(e){let t,n=!0,r=new Set,o=null,s=0,c=X(()=>{let f=H;u&&(H=!0);try{t=e(),n=!1}finally{u&&(H=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n;function i(){let f=C;return f!==null&&(f!==o||f._epoch!==s)&&(o=f,s=f._epoch,r.add(f),f.deps.push(r)),n&&ne(c),t}return c._onNotify=()=>{n=!0,o=null,r.size>0&&ie(r)},i._signal=!0,i.peek=()=>(n&&ne(c),t),i}function ne(e){if(q!==null)throw q.push(e),V;let t=[e];q=t;try{for(;t.length>0;){let n=t[t.length-1];if(!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._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let s=n.deps.length;Q(n),n.deps.length!==s&&F(n),t.pop()}catch(s){if(s===V)n._markDirty();else throw s}}}finally{q=null}}function F(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 ve=()=>{};function N(e,t){let n=X(e);n._level=1;let r=C;C=n;try{let s=n.fn();typeof s=="function"&&(n._cleanup=s)}finally{C=r}if(F(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,u&&p&&p.onEffectDispose(n),ve;let o=()=>oe(n);return S&&S.disposals.push(o),o}function Ze(e){O++;try{e()}finally{O--,O===0&&Z()}}function X(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 u&&p&&p.onEffectCreate(n),n}function Q(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(o){u&&console.warn("[what] Error in effect cleanup:",o)}e._cleanup=null}let r=C;C=null;try{let o=e.fn();typeof o=="function"&&(e._cleanup=o)}catch(o){p?.onError&&p.onError(o,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",o)}finally{C=r}u&&p?.onEffectRun&&p.onEffectRun(e);return}let t=e.deps.length===1?e.deps[0]:null;if(se(e),e._cleanup){try{e._cleanup()}catch(r){u&&p?.onError&&p.onError(r,{type:"effect-cleanup",effect:e}),u&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=C;C=e;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){throw r===V||u&&p?.onError&&p.onError(r,{type:"effect",effect:e}),r}finally{C=n}t!==null&&e.deps.length===1&&e.deps[0]===t&&!e._cleanup&&!e._pending&&(e._stable=!0),u&&p?.onEffectRun&&p.onEffectRun(e)}function oe(e){if(e.disposed=!0,u&&p&&p.onEffectDispose(e),se(e),e._cleanup){try{e._cleanup()}catch(t){u&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function se(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var J=0,D=null,T=0;function re(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(O===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){u&&p?.onError&&p.onError(n,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",n)}finally{C=t}}else{e._pending=!0;let t=e._level,n=x.length;n>0&&x[n-1]._level>t&&(U=!0),x.push(e)}}}function ie(e){if(J===0){J=1;try{for(let t of e)re(t);if(T>0){let t=0;for(;t<T;){let n=D[t];D[t]=null,t++;for(let r of n)re(r)}T=0}}finally{J=0}O===0&&x.length>0&&ke()}else D===null&&(D=[]),T>=D.length?D.push(e):D[T]=e,T++}var W=!1;function ke(){W||(W=!0,queueMicrotask(()=>{W=!1,Z()}))}var z=!1;function Z(){if(!z){z=!0;try{let e=0;for(;x.length>0&&e<25;){let t=x;x=[],t.length>1&&U&&t.sort((n,r)=>n._level-r._level),U=!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{Q(r)}catch(s){if(s===V)throw s;u&&p?.onError&&p.onError(s,{type:"effect",effect:r});try{console.error("[what] Uncaught error in effect during update:",s)}catch{}continue}!r._computed&&r.deps.length!==o&&F(r)}}e++}if(e>=25){if(u){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 Ye(e){let t,n=new Set,r=X(()=>{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&&(U=!0),x.push(c)}}}});r._level=1,Q(r),F(r),n._owner=r,S&&S.disposals.push(()=>oe(r));function o(){return C&&(n.add(C),C.deps.push(n)),t}return o._signal=!0,o.peek=()=>t,o}function et(){if(z){u&&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){u&&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,Z()}function Y(e){let t=C;C=null;try{return e()}finally{C=t}}function tt(){return v}function nt(e,t){let n=v,r=S;v=e,S=e;try{return t()}finally{v=n,S=r}}function rt(e){let t=S,n=v,r={disposals:[],owner:v,children:[],_disposed:!1};v&&v.children.push(r),S=r,v=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)ee(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();if(r.disposals.length=0,r.owner){let s=r.owner.children.indexOf(r);s>=0&&r.owner.children.splice(s,1)}}})}finally{S=t,v=n}}function ee(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)ee(e.children[t]);e.children.length=0;for(let t=e.disposals.length-1;t>=0;t--)e.disposals[t]();e.disposals.length=0}}function ot(e){let t=S,n=v,r={disposals:[],owner:null,children:[],_disposed:!1};S=r,v=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)ee(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();r.disposals.length=0}})}finally{S=t,v=n}}function st(e){S&&S.disposals.push(e)}if(u&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};p={__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 it(){if(!u)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof K<"u"?K: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 K=null;u&&p?.__isPreinstallBuffer&&(K=p.__buffer);var R=null,P=null;function ft(e){P||(P=e)}function Ae(){return P?.getStore()??R}function ce(){return typeof document>"u"||Ae()!=null}function lt(e){let t=R;return R=e,t}function at(e,t){if(P)return P.run(e,t);let n=R;R=e;try{return t()}finally{R=n}}function gt(e,t){let n=function(o){return e(o)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var fe=null;function le(e){fe=e}function Ct(e){let t=null,n=null,r=null,o=new Set;function s(c){if(r)throw r;if(t)return M(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 Ne({fallback:e,children:t}){let n=k(!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}}Ne._deferChildren=!0;function Le({fallback:e,children:t,onError:n}){let r=k(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}}Le._deferChildren=!0;function ae(e,t){let n=t||fe?.();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===De){let o=r.props.when;if(typeof o=="function"?o():o)return r.children}return e}}function De(e){return()=>(typeof e.when=="function"?e.when():e.when)?e.children:null}var I=null;function xt(e){I=e}function Me(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"},l=o==null?[]:Array.isArray(o)?o:[o];if(ce())return M("div",{...f,"data-island-props":Me(s)},M(e,s,...l));let _=!1;function y(a){if(_)return;_=!0;let d=M(e,s,...l);a.childNodes.length>0&&I?.hydrate?I.hydrate(d,a):I?.insert&&I.insert(a,d,null),a.removeAttribute("data-hydrate"),a.removeAttribute("data-island-self"),a.setAttribute("data-island-hydrated","");let m=a.ownerDocument?.defaultView??globalThis;typeof m.CustomEvent=="function"&&a.dispatchEvent(new m.CustomEvent("island:hydrated",{bubbles:!0,detail:{name:c,mode:i}}))}function b(a){let d=()=>y(a);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(E=>E.isIntersecting)&&(m.disconnect(),d())},{rootMargin:"200px"});m.observe(a);break}case"interaction":case"action":{let m=["click","focus","mouseenter","touchstart"],w=()=>{for(let E of m)a.removeEventListener(E,w);d()};for(let E of m)a.addEventListener(E,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 M("div",{...f,ref:a=>{a&&b(a)}})}var ue=!1;function At(e,t,n){return ue||(ue=!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])=>`${Te(t)}:${n}`).join(";")}function Te(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 $=null;function pe(e){$=e}function Tt(e){if(typeof window>"u")return k(!1);let t=window.matchMedia(e),n=k(t.matches),r=s=>n.set(s.matches);t.addEventListener("change",r);let o=$?.();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=k(n),o=N(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){u&&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){u&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",s));let c=$?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{o(),s&&window.removeEventListener("storage",s)})),r}function Bt({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 Ot(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=$?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function Pt(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var Re=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"]),Be="http://www.w3.org/2000/svg",de=new Set(["href","src","action","formaction","formAction","data","ping","xlink:href","xlinkHref"]),he=new Set(["srcdoc","srcDoc"]);function Oe(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 _e(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 Pe(e,t){let n=e.toLowerCase();return he.has(e)||he.has(n)?!0:!de.has(e)&&!de.has(n)?!1:!Oe(t)}function Ie(e){return e==="role"||e.startsWith("aria-")}var ye=new Set,G=new WeakMap;function je(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function me(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function te(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)}u&&p?.onComponentUnmount&&p.onComponentUnmount(e),ye.delete(e)}}function qe(e,t){!e||typeof t!="function"||(e._hydrationDisposers?e._hydrationDisposers.push(t):e._hydrationDisposers=[t])}function Ut(e,t){qe(e,()=>te(t))}function L(e){if(!e)return;if(e._componentCtx&&te(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=G.get(e);n&&te(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++)L(t[n])}function Vt(e,t){typeof t=="string"&&(t=document.querySelector(t)),L(t),t.textContent="";let n=A(e,t);return n&&t.appendChild(n),()=>{L(t),t.textContent=""}}function A(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(je(e))return e;if(typeof e=="function"&&e._mapArray){let r=document.createDocumentFragment(),o=document.createComment("/list-frag");return r.appendChild(o),e(r,o),r}if(typeof e=="function"&&e._lazyChildren)return A(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=N(()=>{let l=i!==null&&h[h.length-1]!==i;l&&h.push(i);try{let _=e(),y=_==null||_===!1||_===!0?[]:Array.isArray(_)?_:[_],b=o.parentNode;if(!b)return;for(let a of s)L(a),a.parentNode===b&&b.removeChild(a);s=[];for(let a of y){let d=A(a,b,t?._isSvg);if(d)if(d.nodeType===11){let m=Array.from(d.childNodes);b.insertBefore(d,o);for(let w of m)s.push(w)}else b.insertBefore(d,o),s.push(d)}}finally{l&&h.pop()}});return r._dispose=f,o._dispose=f,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let s=A(o,t,n);s&&r.appendChild(s)}return r}return me(e)&&typeof e.tag=="function"?Ve(e,t,n):me(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?Ce(e,t):e.tag==="__suspense"?we(e,t):e.tag==="__portal"?be(e,t):$e(e,t,n):document.createTextNode(String(e))}var He={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 ge(){return h[h.length-1]}le(ge);pe(ge);function Ft(){return h}function $t(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 Gt(e){h[h.length-1]===e&&h.pop(),e.disposed=!0}function We(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 ze=Symbol.for("what.navigation.signal");function Ue(e){if(e==null)return!1;let t=e[ze];return typeof t!="function"?!1:(t(e),!0)}function Ve(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(Ee){return new g(Ee).render()},r.displayName=g.displayName||g.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Ce(e,t);if(r==="__suspense"||e.tag==="__suspense")return we(e,t);if(r==="__portal"||e.tag==="__portal")return be(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},l=document.createComment("c:start"),_=document.createComment("c:end");G.set(l,f),f._startComment=l,f._endComment=_;let y=document.createDocumentFragment();y._componentCtx=f,f._wrapper=l,ye.add(f),u&&p?.onComponentMount&&p.onComponentMount(f);let b=s.length===0?void 0:s.length===1?s[0]:s,a;b!==void 0?a=o?Object.assign({},o,{children:b}):{children:b}:a=o?Object.assign({},o):{};let d=o&&o._$lazyChildren,m=d?We(r,a,d):null,w=k(a);f._propsSignal=w;let E=new Proxy({_sig:w},He);h.push(f);let j;try{j=Y(()=>r(E))}catch(g){if(h.pop(),!Ue(g)&&!(g&&typeof g.then=="function"&&Fe(g,f))&&!ae(g,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",g),g;return y.appendChild(l),y.appendChild(_),y}m&&m(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let g of f._mountCallbacks)try{g()}catch(B){console.error("[what] onMount error:",B)}}),y.appendChild(l);let xe=Array.isArray(j)?j:[j];try{for(let g of xe){let B=A(g,y,n);B&&y.appendChild(B)}}finally{h.pop()}return y.appendChild(_),y}function Fe(e,t){let n=t;for(;n;){if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(e),!0;n=n._parentCtx}return!1}function Ce(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"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:h[h.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};G.set(i,l);let _=document.createDocumentFragment();_._componentCtx=l,_.appendChild(i),_.appendChild(f);let y=N(()=>{let b=n();if(h.push(l),i.parentNode)for(;i.nextSibling&&i.nextSibling!==f;){let d=i.nextSibling;L(d),d.parentNode.removeChild(d)}let a;b?a=typeof o=="function"?[o({error:b,reset:s})]:[o]:a=c,a=Array.isArray(a)?a:[a];for(let d of a){let m=A(d,t);m&&(f.parentNode?f.parentNode.insertBefore(m,f):_.insertBefore(m,f))}h.pop()});return l.effects.push(y),_}function we(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};G.set(c,f);let l=document.createDocumentFragment();l._componentCtx=f,l.appendChild(c),l.appendChild(i);let _=0,y=N(()=>{let a=o()?[r]:s,d=Array.isArray(a)?a:[a],m=++_;if(h.push(f),c.parentNode)for(;c.nextSibling&&c.nextSibling!==i;){let w=c.nextSibling;L(w),w.parentNode.removeChild(w)}try{for(let w of d){let E=A(w,t);if(m!==_){E&&L(E);break}E&&(i.parentNode?i.parentNode.insertBefore(E,i):l.insertBefore(E,i))}}finally{h.pop()}});return f.effects.push(y),l}function be(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=A(i,n);f&&(n.appendChild(f),c.push(f))}return o._cleanupCallbacks=[()=>{for(let i of c)L(i),i.parentNode&&i.parentNode.removeChild(i)}],s}function $e(e,t,n){let{tag:r,props:o,children:s}=e,c=n||Re.has(r),i=c?document.createElementNS(Be,r):document.createElement(r);o&&Ge(i,o,{},c);let f=c&&r!=="foreignObject";for(let l=0;l<s.length;l++){let _=A(s[l],i,f);_&&i.appendChild(_)}return i._vnode=e,i}function Ge(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}Se(e,o,t[o],r)}}}function Je(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function Se(e,t,n,r){if(typeof n=="function"&&!_e(t)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=N(()=>{let o=n();Se(e,t,o,r)});return}if(_e(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 l=y=>(y.nativeEvent||(y.nativeEvent=y),Y(()=>l._handler(y)));l._handler=n,l._original=n,e._events[i]=l;let _=n._eventOpts;e.addEventListener(c,l,_||s||void 0);return}if(Pe(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??"";u&&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??"";u&&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{u&&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(Ie(t)){e.setAttribute(t,typeof n=="boolean"?String(n):n);return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(t.startsWith("data-")){e.setAttribute(t,n);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Je(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{u as a,Xe as b,k as c,Qe as d,N as e,Ze as f,Ye as g,et as h,Y as i,tt as j,nt as k,rt as l,ot as m,st as n,it as o,ft as p,Ae as q,lt as r,at as s,gt as t,Ct as u,Ne as v,Le as w,wt as x,bt as y,St as z,De as A,xt as B,Et as C,At as D,Nt as E,Lt as F,Dt as G,Mt as H,Tt as I,Rt as J,Bt as K,Ot as L,Pt as M,_e as N,Pe as O,Ie as P,qe as Q,Ut as R,L as S,Vt as T,A as U,ge as V,Ft as W,$t as X,Gt as Y,We as Z,Ue as _,Je as $};