what-core 0.12.2 → 0.12.4
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/dist/{chunk-NCPX66TV.min.js → chunk-M5GDJRVX.min.js} +1 -1
- package/dist/chunk-T2SKNKT5.min.js +11 -0
- package/dist/index.min.js +5 -5
- package/dist/render.min.js +1 -1
- package/dist/testing.min.js +1 -1
- package/index.d.ts +329 -40
- package/package.json +1 -1
- package/src/a11y.js +234 -23
- package/src/agent-context.js +1 -1
- package/src/animation.js +8 -0
- package/src/data.js +730 -105
- package/src/dom.js +52 -0
- package/src/errors.js +12 -1
- package/src/form.js +329 -31
- package/src/hooks.js +20 -3
- package/src/index.js +6 -0
- package/src/render.js +872 -50
- package/src/scheduler.js +17 -0
- package/src/warnings.js +83 -0
- package/dist/chunk-RXISSKLI.min.js +0 -11
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 ---
|
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.)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{B as bt,N as q,O as xt,Q as mt,R as _t,S as z,U as Q,V as Ct,W as wt,X as At,Y as Et,Z as lt,a as U,c as R,e as j,m as J,q as yt}from"./chunk-NCPX66TV.min.js";import{a as X}from"./chunk-O3SKPRTY.min.js";var Lt=R(null);typeof document<"u"&&document.addEventListener("focusin",t=>{Lt.set(t.target)});function ae(){return{current:()=>Lt(),focus:t=>t?.focus(),blur:()=>document.activeElement?.blur()}}function de(){let t={current:null};function e(o){typeof document>"u"||(t.current=o||document.activeElement||null)}function n(o){let r=t.current||o;r&&typeof r.focus=="function"&&r.focus()}return{capture:e,restore:n,previous:()=>t.current}}function Gt(t){let e=null;function n(){if(typeof document>"u")return;e=document.activeElement;let r=t.current||t;if(!r||typeof r.querySelectorAll!="function")return;let i=Tt(r);if(i.length===0)return;i[0].focus();function g(c){if(c.key!=="Tab")return;let l=Tt(r),s=l[0],p=l[l.length-1];c.shiftKey?document.activeElement===s&&(c.preventDefault(),p.focus()):document.activeElement===p&&(c.preventDefault(),s.focus())}return r.addEventListener("keydown",g),()=>{r.removeEventListener("keydown",g)}}function o(){e&&typeof e.focus=="function"&&e.focus()}return{activate:n,deactivate:o}}function Tt(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},o=R(0),r=Gt(n),i=null,g=s=>{n.current=s,o.set(p=>p+1)},c=j(()=>{if(o(),i&&(i(),i=null,r.deactivate()),e&&n.current)return i=r.activate(),()=>{i?.(),i=null,r.deactivate()}}),l=Ct?.();return l&&(l._cleanupCallbacks=l._cleanupCallbacks||[],l._cleanupCallbacks.push(()=>{c(),i?.(),i=null,r.deactivate()})),X("div",{ref:g},t)}var O=null,ut=0;function Ut(){return typeof document>"u"?null:(O||(O=document.createElement("div"),O.id="what-announcer",O.setAttribute("aria-live","polite"),O.setAttribute("aria-atomic","true"),O.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(O)),O)}function qt(t,e={}){let{priority:n="polite",timeout:o=1e3}=e,r=Ut();if(!r)return;r.setAttribute("aria-live",n);let i=++ut;r.textContent="",requestAnimationFrame(()=>{ut===i&&(r.textContent=t)}),setTimeout(()=>{ut===i&&(r.textContent="")},o)}function pe(t){return qt(t,{priority:"assertive"})}function ge({href:t="#main",children:e="Skip to content"}){return X("a",{href:t,class:"what-skip-link",onClick:n=>{n.preventDefault();let o=document.querySelector(t);o&&(o.focus(),o.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 ye(t=!1){let e=R(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 be(t=null){let e=R(t);return{selected:()=>e(),select:n=>e.set(n),isSelected:n=>e()===n,itemProps:n=>({"aria-selected":e()===n,onClick:()=>e.set(n)})}}function xe(t=!1){let e=R(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 me(t){let e=typeof t=="function"?t:()=>t,n=R(0);function o(r){let i=e();if(!(i<=0))switch(r.key){case"ArrowDown":case"ArrowRight":r.preventDefault(),n.set((n.peek()+1)%i);break;case"ArrowUp":case"ArrowLeft":r.preventDefault(),n.set((n.peek()-1+i)%i);break;case"Home":r.preventDefault(),n.set(0);break;case"End":r.preventDefault(),n.set(i-1);break}}return{focusIndex:()=>n(),setFocusIndex:r=>n.set(r),getItemProps:r=>({tabIndex:n()===r?0:-1,onKeyDown:o,onFocus:()=>n.set(r)}),containerProps:()=>({role:"listbox"})}}function _e({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 Ce({children:t,priority:e="polite",atomic:n=!0}){return X("div",{"aria-live":e,"aria-atomic":n},t)}var St=0;function Dt(){let t=yt();return t?(t.idCounter=(t.idCounter||0)+1,t.idCounter):++St}function Mt(){St=0}function Ht(t="what"){let e=`${t}-${Dt()}`;return()=>e}function we(t,e="what"){let n=[];for(let o=0;o<t;o++)n.push(`${e}-${Dt()}`);return n}function Ae(t){let e=Ht("desc");return{descriptionId:e,descriptionProps:()=>({id:e(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":e()}),Description:()=>X("div",{id:e(),style:{display:"none"}},t)}}function Ee(t){let e=Ht("label");return{labelId:e,labelProps:()=>({id:e()}),labelledByProps:()=>({"aria-labelledby":e()})}}var Te={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function Le(t,e){return n=>{n.key===t&&e(n)}}function Se(t,e){return n=>{t.includes(n.key)&&e(n)}}var v=null;function Re(t){v=typeof t=="function"?t:null}function Ve(t,e,n){if(typeof n=="function"){let o=()=>{let r=n();return r.length===1?r[0]:r};return o._lazyChildren=!0,e||(e={}),Object.defineProperty(e,"_$lazyChildren",{value:o,configurable:!0}),Q({tag:t,props:e,children:[],key:null,_vnode:!0})}if(n&&n.length>0){let o=n.length===1?n[0]:n;e?e.children=o:e={children:o}}return Q({tag:t,props:e||{},children:n||[],key:null,_vnode:!0})}var Wt={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>"}},It=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 Nt(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function Xt(t){let e=t.trim(),n=Nt(e);if(It.has(n))return Zt(e);let o=Wt[n];if(o){let i=document.createElement("template");i.innerHTML=o.wrap+e+o.unwrap;let g=i.content.firstChild;for(let c=0;c<o.depth;c++)g=g.firstChild;return()=>g.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=e,()=>r.content.firstChild.cloneNode(!0)}var Bt=!1;function ze(t){return U&&!Bt&&(Bt=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Xt(t)}function Zt(t){let e=t.trim();if(Nt(e)==="svg"){let r=document.createElement("template");return r.innerHTML=e,()=>r.content.firstChild.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,()=>o.content.firstChild.firstChild.cloneNode(!0)}function Rt(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return Rt(t,e(),n);if(typeof e=="function"){let o=n||null,r=null,i=null,g=!1;return j(()=>{let c=e(),l=typeof c;if(!g){g=!0,l==="string"||l==="number"?(i=document.createTextNode(String(c)),o?t.insertBefore(i,o):t.appendChild(i),v&&v(t,String(c)),r=i):r=F(t,c,null,o);return}if(i!==null&&(l==="string"||l==="number")){let s=String(c);i.data!==s&&(i.data=s),v&&v(t,s);return}i=null,r=F(t,c,r,o)}),r}if(typeof e=="string"||typeof e=="number"){let o=document.createTextNode(String(e));return n?t.insertBefore(o,n):t.appendChild(o),o}return e!=null&&typeof e=="object"&&e.nodeType>0?(n?t.insertBefore(e,n):t.appendChild(e),e):F(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 Jt(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var ft=typeof SVGElement<"u";function jt(t){return ft&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function Pt(t){return t==null?[]:Array.isArray(t)?t:[t]}function zt(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let o=0;o<t.length;o++)zt(t[o],e,n);return n}if(typeof t=="function"){let o=Q(t,e,jt(e));if(o&&o.nodeType===11){let r=Array.from(o.childNodes);for(let i=0;i<r.length;i++)n.push(r[i])}else o&&n.push(o);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 o=Array.from(t.childNodes);for(let r=0;r<o.length;r++)n.push(o[r])}else n.push(t);return n}if(Jt(t)){let o=Q(t,e,jt(e));if(o&&o.nodeType===11)if(o.childNodes.length===0)n.push(o);else{let r=Array.from(o.childNodes);for(let i=0;i<r.length;i++)n.push(r[i])}else o&&n.push(o);return n}return n.push(document.createTextNode(String(t))),n}function Qt(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 F(t,e,n,o){if(!t||typeof t.insertBefore!="function")return U&&console.warn("[what] reconcileInsert called with invalid parent:",t),n;let r=o||null;if(e==null||typeof e=="boolean"){let s=Pt(n);for(let p=0;p<s.length;p++){let u=s[p];u.parentNode===t&&(z(u),t.removeChild(u))}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?(z(n),t.replaceChild(e,n)):r?t.insertBefore(e,r):t.appendChild(e),e}let i=zt(e,t,[]),g=Pt(n);if(Qt(g,i))return n;let c=i.length;for(let s=0;s<g.length;s++){let p=g[s];if(p.parentNode!==t)continue;let u=!1;for(let C=0;C<c;C++)if(i[C]===p){u=!0;break}u||(z(p),t.removeChild(p))}let l=r;for(let s=i.length-1;s>=0;s--){let p=i[s];(p.parentNode!==t||p.nextSibling!==l)&&(l&&l.parentNode!==t&&(l=null),l?t.insertBefore(p,l):t.appendChild(p)),l=p}return i.length===0?null:i.length===1?i[0]:i}function Oe(t,e,n){let o=n?.key,r=n?.raw||!1,i=(g,c)=>{let l=[],s=[],p=[],u=o&&!r?new Map:null,C=document.createComment("/list");return g.insertBefore(C,c||null),j(()=>{let y=t()||[],b=C.parentNode||g;o?te(b,C,l,y,s,p,e,o,u):Yt(b,C,l,y,s,p,e),l=y.length>0?y.slice():y}),C};return i._mapArray=!0,i}function Yt(t,e,n,o,r,i,g){let c=o.length,l=n.length;if(c===0){if(l>0){for(let a=0;a<l;a++)i[a]&&i[a]();for(let a=l-1;a>=0;a--){let d=r[a];d&&(z(d),d.parentNode===t&&t.removeChild(d))}r.length=0,i.length=0}return}if(l===0){let a=document.createDocumentFragment();for(let d=0;d<c;d++){let E=o[d],L=J(N=>(i[d]=N,g(E,d)));r[d]=L,a.appendChild(L)}t.insertBefore(a,e);return}let s=0,p=Math.min(l,c);for(;s<p&&n[s]===o[s];)s++;if(s===l&&s===c)return;let u=l-1,C=c-1;for(;u>=s&&C>=s&&n[u]===o[C];)u--,C--;let y=new Array(c),b=new Array(c);for(let a=0;a<s;a++)y[a]=r[a],b[a]=i[a];for(let a=C+1;a<c;a++){let d=u+1+(a-C-1);y[a]=r[d],b[a]=i[d]}let m=C-s+1,A=u-s+1;if(m===0)for(let a=s;a<=u;a++)i[a]?.(),r[a]&&z(r[a]),r[a]?.parentNode&&r[a].parentNode.removeChild(r[a]);else if(A===0){let a=s<c&&y[C+1]?y[C+1]:e,d=document.createDocumentFragment();for(let E=s;E<=C;E++){let L=o[E],N=E;y[E]=J(S=>(b[N]=S,g(L,N))),d.appendChild(y[E])}t.insertBefore(d,a)}else kt(t,e,n,o,r,i,g,s,u,C,y,b);r.length=c,i.length=c;for(let a=0;a<c;a++)r[a]=y[a],i[a]=b[a]}function kt(t,e,n,o,r,i,g,c,l,s,p,u){let C=new Map;for(let d=c;d<=l;d++)C.set(n[d],d);let y=s-c+1,b=new Int32Array(y);b.fill(-1);for(let d=c;d<=s;d++){let E=C.get(o[d]);E!==void 0&&(C.delete(o[d]),p[d]=r[E],u[d]=i[E],b[d-c]=E)}for(let[,d]of C)i[d]?.(),r[d]&&z(r[d]),r[d]?.parentNode&&r[d].parentNode.removeChild(r[d]);let m=y-vt(b,y),A=new Uint8Array(y);if(m>1){let d=new Int32Array(m),E=new Int32Array(m),L=0;for(let S=0;S<y;S++)b[S]!==-1&&(d[L]=b[S],E[L]=S,L++);let N=Ot(d,m);for(let S=0;S<N.length;S++)A[E[N[S]]]=1}else if(m===1){for(let d=0;d<y;d++)if(b[d]!==-1){A[d]=1;break}}for(let d=c;d<=s;d++)if(!p[d]){let E=o[d],L=d;p[d]=J(N=>(u[L]=N,g(E,L)))}let a=s+1<p.length&&p[s+1]?p[s+1]:e;for(let d=s;d>=c;d--){let E=d-c;(b[E]===-1||!A[E])&&(a&&a.parentNode!==t&&(a=e),t.insertBefore(p[d],a)),a=p[d]}}function vt(t,e){let n=0;for(let o=0;o<e;o++)t[o]===-1&&n++;return n}function Ot(t,e){if(e===0)return[];if(e===1)return[0];let n=new Int32Array(e),o=new Int32Array(e),r=1;n[0]=0,o[0]=-1;for(let c=1;c<e;c++)if(t[c]>t[n[r-1]])o[c]=n[r-1],n[r++]=c;else{let l=0,s=r-1;for(;l<s;){let p=l+s>>1;t[n[p]]<t[c]?l=p+1:s=p}n[l]=c,o[c]=l>0?n[l-1]:-1}let i=new Array(r),g=n[r-1];for(let c=r-1;c>=0;c--)i[c]=g,g=o[g];return i}function Ft(){return document.createComment("i")}function Y(t,e,n,o){let r=e;for(;r&&r!==n;){let i=r.nextSibling;t.insertBefore(r,o),r=i}}function at(t,e,n){let o=e;for(;o&&o!==n;){let r=o.nextSibling;z(o),t.removeChild(o),o=r}}function dt(t,e,n,o,r,i,g,c,l){let s;if(r){let C=o(e),y=l(e);s=y,r.set(C,{itemSig:y})}else s=e;let p=Ft();t.appendChild(p);let u=J(C=>(c[n]=C,i(s,n)));t.appendChild(u),g[n]=p}function te(t,e,n,o,r,i,g,c,l){let s=o.length,p=n.length;if(s===0){if(p>0){for(let f=0;f<p;f++)i[f]&&i[f]();r[0]&&at(t,r[0],e),r.length=0,i.length=0,l&&l.clear()}return}if(p===0){let f=document.createDocumentFragment();for(let _=0;_<s;_++)dt(f,o[_],_,c,l,g,r,i,R);t.insertBefore(f,e);return}let u=0,C=Math.min(p,s);for(;u<C;){if(n[u]===o[u]){u++;continue}let f=c(n[u]),_=c(o[u]);if(f!==_)break;l&&l.get(f).itemSig.set(o[u]),u++}let y=p-1,b=s-1;for(;y>=u&&b>=u;){if(n[y]===o[b]){y--,b--;continue}let f=c(n[y]),_=c(o[b]);if(f!==_)break;l&&l.get(f).itemSig.set(o[b]),y--,b--}if(u>y&&u>b)return;let m=new Array(s),A=new Array(s);for(let f=0;f<u;f++)m[f]=r[f],A[f]=i[f];for(let f=b+1;f<s;f++){let _=y+1+(f-b-1);m[f]=r[_],A[f]=i[_]}let a=b-u+1,d=y-u+1;if(d===0){let f=b+1<s&&m[b+1]?m[b+1]:e,_=document.createDocumentFragment();for(let T=u;T<=b;T++)dt(_,o[T],T,c,l,g,m,A,R);t.insertBefore(_,f),k(r,i,m,A,s);return}if(a===0){for(let f=u;f<=y;f++){i[f]?.();let _=W(t,r[f],r,f,e);at(t,r[f],_),l&&l.delete(c(n[f]))}k(r,i,m,A,s);return}if(a===d&&a>=2&&a<=Math.max(d,200)){let f=0,_=-1,T=-1;for(let x=0;x<a&&f<=4;x++){let w=c(n[u+x]),K=c(o[u+x]);w!==K&&(f===0?_=x:f===1&&(T=x),f++)}if(f===2){let x=u+_,w=u+T,K=c(n[x]),$=c(n[w]),I=c(o[x]),ot=c(o[w]);if(K===ot&&$===I){for(let h=0;h<u;h++)m[h]=r[h],A[h]=i[h];for(let h=u;h<=b;h++)m[h]=r[h],A[h]=i[h];for(let h=b+1;h<s;h++){let P=y+1+(h-b-1);m[h]=r[P],A[h]=i[P]}let G=m[x];m[x]=m[w],m[w]=G;let H=A[x];if(A[x]=A[w],A[w]=H,l){if(o[x]!==n[x]){let h=c(o[x]),P=l.get(h);P&&P.itemSig.set(o[x])}if(o[w]!==n[w]){let h=c(o[w]),P=l.get(h);P&&P.itemSig.set(o[w])}}let M=w===x+1||x===w+1,B=Math.min(x,w),D=Math.max(x,w);if(M){let h=W(t,r[D],r,D,e);Y(t,r[D],h,r[B])}else{let h=W(t,r[w],r,w,e),P=document.createComment("tmp");t.insertBefore(P,r[w]),Y(t,r[w],h,r[x]);let rt=W(t,r[x],r,x,e);Y(t,r[x],rt,P),t.removeChild(P)}k(r,i,m,A,s);return}}if(f>=2&&f<=a){let x=_,w=null,K=-1,$=-1,I=!1,ot=c(n[u+x]),G=-1;for(let H=x;H<a;H++)if(c(o[u+H])===ot){G=H;break}if(G>x){let H=!0;for(let M=x;M<G;M++)if(c(n[u+M+1])!==c(o[u+M])){H=!1;break}if(H){let M=!0;for(let B=G+1;B<a;B++)if(c(n[u+B])!==c(o[u+B])){M=!1;break}M&&(I=!0,K=u+x,$=u+G,w=ot)}}if(!I){let H=c(o[u+x]),M=-1;for(let B=x;B<d;B++)if(c(n[u+B])===H){M=B;break}if(M>x){let B=!0;for(let D=x;D<M;D++)if(c(n[u+D])!==c(o[u+D+1])){B=!1;break}if(B){let D=!0;for(let h=M+1;h<a;h++)if(c(n[u+h])!==c(o[u+h])){D=!1;break}D&&(I=!0,K=u+M,$=u+x,w=H)}}}if(I){for(let h=u;h<=y;h++)m[h]=r[h],A[h]=i[h];let H=m[K],M=A[K];if(K<$)for(let h=K;h<$;h++)m[h]=m[h+1],A[h]=A[h+1];else for(let h=K;h>$;h--)m[h]=m[h-1],A[h]=A[h-1];if(m[$]=H,A[$]=M,l)for(let h=u;h<=b;h++){let P=c(o[h]);if(o[h]!==n[h]){let rt=l.get(P);rt&&rt.itemSig.set(o[h])}}let B=W(t,H,r,K,e),D;$+1<s?D=m[$+1]:D=e,($>=b+1||D&&D.parentNode!==t)&&(D=e),Y(t,H,B,D),k(r,i,m,A,s);return}}}let E=new Map;for(let f=u;f<=y;f++)E.set(c(n[f]),f);let L=new Int32Array(a);L.fill(-1);for(let f=u;f<=b;f++){let _=c(o[f]),T=E.get(_);T!==void 0&&(E.delete(_),m[f]=r[T],A[f]=i[T],L[f-u]=T,l&&o[f]!==n[T]&&l.get(_).itemSig.set(o[f]))}let N=[...E.values()].sort((f,_)=>_-f);for(let f of N){i[f]?.();let _=W(t,r[f],r,f,e);at(t,r[f],_),l&&l.delete(c(n[f]))}for(let f=u;f<=b;f++)if(!m[f]){let _=document.createDocumentFragment();dt(_,o[f],f,c,l,g,m,A,R),m[f]._frag=_}let S=0,pt=!0,gt=-1;for(let f=0;f<a;f++)L[f]!==-1&&(S++,L[f]<=gt&&(pt=!1),gt=L[f]);let nt=new Uint8Array(a);if(pt)for(let f=0;f<a;f++)L[f]!==-1&&(nt[f]=1);else if(S>1){let f=new Int32Array(S),_=new Int32Array(S),T=0;for(let w=0;w<a;w++)L[w]!==-1&&(f[T]=L[w],_[T]=w,T++);let x=Ot(f,S);for(let w=0;w<x.length;w++)nt[_[x[w]]]=1}else if(S===1){for(let f=0;f<a;f++)if(L[f]!==-1){nt[f]=1;break}}k(r,i,m,A,s);let st=b+1<s&&r[b+1]?r[b+1]:e;for(let f=b;f>=u;f--){let _=f-u,T=r[f];if(L[_]===-1)T._frag&&(t.insertBefore(T._frag,st),delete T._frag);else if(!nt[_]){let x=W(t,T,r,f,e);Y(t,T,x,st)}st=T}}function W(t,e,n,o,r){let i=e.nextSibling;for(;i&&i!==r;){if(i.nodeType===8&&i.data==="i")return i;i=i.nextSibling}return r}function k(t,e,n,o,r){t.length=r,e.length=r;for(let i=0;i<r;i++)t[i]=n[i],e[i]=o[i]}function Ge(t,e){for(let n in e){let o=e[n];if(q(n)){if(typeof o!="function")continue;let r=n.slice(2).toLowerCase();t.addEventListener(r,o);continue}if(typeof o=="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 r=o()||"";ft&&t instanceof SVGElement?t.setAttribute("class",r):t.className=r}):n==="style"&&typeof o()=="object"?t._propEffects[n]=j(()=>{ct(t,o())}):t._propEffects[n]=j(()=>{tt(t,n,o())})}else tt(t,n,o)}}function tt(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(()=>tt(t,e,n()));return}if(q(e))return;if(xt(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let o=ft&&t instanceof SVGElement;if(e==="class"||e==="className")o?t.setAttribute("class",n||""):t.className=n||"";else if(e==="dangerouslySetInnerHTML"){let r=n?.__html??"";typeof U<"u"&&U&&typeof r=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(r)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=r}else if(e==="innerHTML")if(n&&typeof n=="object"&&"__html"in n){let r=n.__html??"";typeof U<"u"&&U&&typeof r=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(r)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),t.innerHTML=r}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")ct(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):o?t.setAttribute(e,n):e==="value"&&t.tagName==="SELECT"?lt(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function et(t,e,n,o){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>o(t,n()))}function ee(t,e){if(typeof e=="function")return et(t,"class",e,ee);ft&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function ct(t,e){if(typeof e=="function")return et(t,"style",e,ct);if(typeof e=="string")t.style.cssText=e,t._lastStyleObj=null;else if(e&&typeof e=="object"){let n=t.style,o=t._lastStyleObj;if(o)for(let r in o)r in e||(n[r]="");for(let r in e)n[r]=e[r]??"";t._lastStyleObj=e}else e==null&&(t.style.cssText="",t._lastStyleObj=null)}function ne(t,e,n){if(typeof n=="function")return et(t,e,n,(o,r)=>ne(o,e,r));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function oe(t,e){if(typeof e=="function")return et(t,"value",e,oe);if(t.tagName==="SELECT"){lt(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function re(t,e){if(typeof e=="function")return et(t,"checked",e,re);t.checked=!!e}var Kt=new Set;function Ue(t){for(let e of t)Kt.has(e)||(Kt.add(e),document.addEventListener(e,n=>{let o=n.target,r="$$"+e;for(Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return o||document}});o;){let i=o[r];if(i&&(i(n),n.cancelBubble))return;o=o.parentNode}}))}function qe(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function We(t,e){j(()=>{for(let n in e){let o=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!o)}})}var it=!1,V=null;function Ie(){return it}function ie(t,e){it=!0,Mt(),V={parent:e,index:0};try{return Z(t,e)}finally{it=!1,V=null}}function $t(t){let e=t.childNodes;for(;V.index<e.length;){let n=e[V.index];if(n.nodeType===8){let o=n.textContent;if(o==="$"||o==="/$"||o==="[]"||o==="/[]"){V.index++;continue}}return V.index++,n}return null}function ht(){return typeof process<"u"&&!1}function Z(t,e){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let o=$t(e),r=String(t);if(o&&o.nodeType===3)return ht()&&o.textContent!==r&&(console.warn(`[what] Hydration mismatch: expected text "${r}", got "${o.textContent}"`),o.textContent=r),o;ht()&&console.warn(`[what] Hydration mismatch: expected text node "${r}", got ${o?o.nodeName:"nothing"}. Falling back to client render.`);let i=document.createTextNode(r);return o?e.replaceChild(i,o):e.appendChild(i),i}if(typeof t=="function"&&t._lazyChildren)return Z(t(),e);if(typeof t=="function"){let o=t(),r=Z(o,e),i=j(()=>{let g=t();it||(r=F(e,g,r,null))});return mt(r&&r.nodeType?r:e,i),r}if(Array.isArray(t)){let o=[];for(let r of t){let i=Z(r,e);i&&o.push(i)}return o.length===1?o[0]:o}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let g=wt(),c=t.tag,l=t.props||{},s=t.children||[],p={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:c,_parentCtx:g[g.length-1]||null,_errorBoundary:null};g.push(p);let u,C=null;try{let y={...l};l._$lazyChildren?C=At(c,y,l._$lazyChildren):y.children=s.length===0?l.children:s.length===1?s[0]:s,u=c(y),C&&C()}catch(y){return g.pop(),Et(y)||console.error("[what] Error in component during hydration:",c.name||"Anonymous",y),null}p.mounted=!0,p._mountCallbacks&&queueMicrotask(()=>{if(!p.disposed)for(let y of p._mountCallbacks)try{y()}catch(b){console.error("[what] onMount error:",b)}});try{let y=Z(u,e),b=Array.isArray(y)?y[0]:y;return _t(b&&b.nodeType?b:e,p),y}finally{g.pop()}}let o=$t(e),r=t.tag.toUpperCase();if(o&&o.nodeType===1&&o.nodeName===r){fe(o,t.props||{});let g=V;if(V={parent:o,index:0},t.props?.dangerouslySetInnerHTML?.__html==null)for(let l of t.children)Z(l,o);return V=g,o}ht()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${o?o.nodeName:"nothing"}. Falling back to client render.`);let i=document.createElement(t.tag);for(let g in t.props||{})g==="children"||g==="key"||tt(i,g,t.props[g]);for(let g of t.children)F(i,g,null,null);return o?e.replaceChild(i,o):e.appendChild(i),i}if(Vt(t))return t;let n=document.createTextNode(String(t));return e.appendChild(n),n}function fe(t,e){for(let n in e){if(n==="children"||n==="key"||n==="dangerouslySetInnerHTML"||n==="innerHTML")continue;if(n==="ref"){let r=e.ref;typeof r=="function"?r(t):r&&typeof r=="object"&&(r.current=t);continue}let o=e[n];if(q(n)){if(typeof o!="function")continue;let r=n.slice(2).toLowerCase();t.addEventListener(r,o);continue}if(n.startsWith("$$")){t[n]=o;continue}if(typeof o=="function"&&!q(n)){n==="class"||n==="className"?j(()=>{t.className=o()||""}):n==="style"&&typeof o()=="object"?j(()=>{ct(t,o())}):j(()=>{tt(t,n,o())});continue}}}bt({hydrate:ie,insert:Rt});export{ae as a,de as b,Gt as c,he as d,qt as e,pe as f,ge as g,ye as h,be as i,xe as j,me as k,_e as l,Ce as m,Ht as n,we as o,Ae as p,Ee as q,Te as r,Le as s,Se as t,Re as u,Ve as v,Xt as w,ze as x,Zt as y,Rt as z,Oe as A,Ge as B,tt as C,ee as D,ct as E,ne as F,oe as G,re as H,Ue as I,qe as J,We as K,Ie as L,ie as M};
|