what-core 0.12.3 → 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-VTPLA4AS.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 +642 -83
- package/src/errors.js +12 -1
- package/src/form.js +329 -31
- package/src/hooks.js +20 -3
- package/src/render.js +491 -22
- package/src/scheduler.js +17 -0
- package/src/warnings.js +83 -0
- package/dist/chunk-JVEPLFIB.min.js +0 -11
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{$ 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};
|