what-core 0.13.0 → 0.13.1
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-DZTPU2YD.min.js +11 -0
- package/dist/index.min.js +11 -4
- package/dist/render.min.js +1 -1
- package/package.json +1 -1
- package/src/agent-context.js +1 -1
- package/src/errors.js +15 -0
- package/src/render.js +23 -0
- package/dist/chunk-ENARGHSD.min.js +0 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{E as Tt,Q as W,R as St,T as Lt,U as it,V as I,X as G,Y as Nt,Z as Q,a as z,aa as Bt,ba as Mt,ca as ht,d as O,f as P,j as At,n as Y,r as wt,z as Et}from"./chunk-OKM3GKVP.min.js";import{a as Z}from"./chunk-O3SKPRTY.min.js";var Dt=O(null);typeof document<"u"&&document.addEventListener("focusin",t=>{Dt.set(t.target)});function Te(){return{current:()=>Dt(),focus:t=>t?.focus(),blur:()=>document.activeElement?.blur()}}function Se(){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 Qt(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=Ht(o);if(i.length===0)return;i[0].focus();function g(f){if(f.key!=="Tab")return;let a=Ht(o),c=a[0],p=a[a.length-1];f.shiftKey?document.activeElement===c&&(f.preventDefault(),p.focus()):document.activeElement===p&&(f.preventDefault(),c.focus())}return o.addEventListener("keydown",g),()=>{o.removeEventListener("keydown",g)}}function r(){e&&typeof e.focus=="function"&&e.focus()}return{activate:n,deactivate:r}}function Ht(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 Le({children:t,active:e=!0}){let n={current:null},r=O(0),o=Qt(n),i=null,g=c=>{n.current=c,r.set(p=>p+1)},f=P(()=>{if(r(),i&&(i(),i=null,o.deactivate()),e&&n.current)return i=o.activate(),()=>{i?.(),i=null,o.deactivate()}}),a=Nt?.();return a&&(a._cleanupCallbacks=a._cleanupCallbacks||[],a._cleanupCallbacks.push(()=>{f(),i?.(),i=null,o.deactivate()})),Z("div",{ref:g},t)}var U=null,pt=0;function vt(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.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(U)),U)}function Ft(t,e={}){let{priority:n="polite",timeout:r=1e3}=e,o=vt();if(!o)return;o.setAttribute("aria-live",n);let i=++pt;o.textContent="",requestAnimationFrame(()=>{pt===i&&(o.textContent=t)}),setTimeout(()=>{pt===i&&(o.textContent="")},r)}function Ne(t){return Ft(t,{priority:"assertive"})}function Be({href:t="#main",children:e="Skip to content"}){return Z("a",{href:t,class:"what-skip-link",onClick:n=>{n.preventDefault();let r=document.querySelector(t);r&&(r.focus(),r.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},e)}function gt(t){return t?"true":"false"}function Me(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":()=>gt(e()),onClick:()=>e.set(!e.peek())}),panelProps:()=>({hidden:()=>!e()})}}function He(t=null){let e=O(t);return{selected:()=>e(),select:n=>e.set(n),isSelected:n=>e()===n,itemProps:n=>({"aria-selected":()=>gt(e()===n),onClick:()=>e.set(n)})}}function De(t=!1){let e=O(t);return{checked:()=>e(),toggle:()=>e.set(!e.peek()),set:n=>e.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":()=>gt(e()),tabIndex:0,onClick:()=>e.set(!e.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.set(!e.peek()))}})}}function je(t,e={}){let n=typeof t=="function"?t:()=>t,r=O(0),o=e?.role||null,i=[],g=[],f=[];function a(h){let s=g[h];return s||(s={get current(){return i[h]||null},set current(d){i[h]=d||null;let x=f[h];typeof x=="function"?x(d):x&&typeof x=="object"&&(x.current=d)}},g[h]=s),s}function c(h){let s=i[h];return s?s.isConnected===!1?null:s:null}function p(h){let s=c(h);return!s||typeof s.focus!="function"?null:((typeof document>"u"||document.activeElement!==s)&&s.focus(),s)}function u(){if(typeof document>"u")return!1;let h=document.activeElement;if(!h)return!1;for(let s=0;s<i.length;s++){let d=i[s];if(d&&(d===h||typeof d.contains=="function"&&d.contains(h)))return!0}return!1}function y(h,s){return!(s>0)||h<0?0:h>s-1?s-1:h}function b(){return y(r(),n())}function m(h){return Number.isInteger(h)&&h>=0&&h<n()}function _(h){let s=n();if(s<=0)return;let d=y(r.peek(),s),x=d;switch(h.key){case"ArrowDown":case"ArrowRight":x=(d+1)%s;break;case"ArrowUp":case"ArrowLeft":x=(d-1+s)%s;break;case"Home":x=0;break;case"End":x=s-1;break;default:return}h.preventDefault(),r.set(x),p(x)}return{focusIndex:()=>b(),setFocusIndex:h=>{m(h)&&(r.set(h),u()&&p(h))},focusItem:h=>m(h)?(r.set(h),p(h)):null,getItemProps:(h,s)=>{let{ref:d,...x}=s||{};return f[h]=d||null,{ref:a(h),tabIndex:()=>b()===h?0:-1,onKeyDown:_,onFocus:S=>{let H=S&&(S.currentTarget||S.target);H&&(i[h]=H),r.set(h)},...x}},containerProps:h=>o?{role:o,...h}:{...h}}}function Pe({children:t,as:e="span"}){return Z(e,{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}},t)}function Re({children:t,priority:e="polite",atomic:n=!0}){return Z("div",{"aria-live":e,"aria-atomic":n},t)}var jt=0;function Pt(){let t=wt();return t?(t.idCounter=(t.idCounter||0)+1,t.idCounter):++jt}function Rt(){jt=0}function Kt(t="what"){let e=`${t}-${Pt()}`;return()=>e}function Ke(t,e="what"){let n=[];for(let r=0;r<t;r++)n.push(`${e}-${Pt()}`);return n}function $e(t){let e=Kt("desc");return{descriptionId:e,descriptionProps:()=>({id:e(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":e()}),Description:()=>Z("div",{id:e(),style:{display:"none"}},t)}}function Ie(t){let e=Kt("label");return{labelId:e,labelProps:()=>({id:e()}),labelledByProps:()=>({"aria-labelledby":e()})}}var Oe={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function Ve(t,e){return n=>{n.key===t&&e(n)}}function ze(t,e){return n=>{t.includes(n.key)&&e(n)}}var et=null;function Je(t){et=typeof t=="function"?t:null}function Ze(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}),G({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 G({tag:t,props:e||{},children:n||[],key:null,_vnode:!0})}var te={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>"}},ee=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 zt(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function ne(t){let e=t.trim(),n=zt(e);if(ee.has(n))return re(e);let r=te[n];if(r){let i=document.createElement("template");i.innerHTML=r.wrap+e+r.unwrap;let g=i.content.firstChild;for(let f=0;f<r.depth;f++)g=g.firstChild;return()=>g.cloneNode(!0)}let o=document.createElement("template");if(o.innerHTML=e,z&&o.content.childNodes.length!==1){let i=[...o.content.childNodes].find((g,f)=>f>0&&g.nodeType===1);throw Object.assign(new Error(`[what] <${n}> cannot contain <${i?i.nodeName.toLowerCase():"that element"}>: the HTML parser closed the outer tag early, so the rendered tree does not match your JSX.`),{code:"ERR_INVALID_HTML_NESTING"})}return()=>o.content.firstChild.cloneNode(!0)}var $t=!1;function Ye(t){return z&&!$t&&($t=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),ne(t)}function re(t){let e=t.trim();if(zt(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 Gt(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return Gt(t,e(),n);if(typeof e=="function"){let r=n||null,o=null,i=null,g=!1,f=Ct();return P(()=>kt(f,()=>{let a=e(),c=typeof a;if(!g){g=!0,c==="string"||c==="number"?(i=document.createTextNode(String(a)),r?t.insertBefore(i,r):t.appendChild(i),et&&et(t,String(a)),o=i):o=ft(t,a,null,r);return}if(i!==null&&(c==="string"||c==="number")){let p=String(a);i.data!==p&&(i.data=p),et&&et(t,p);return}i=null,o=ft(t,a,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):ft(t,e,null,n||null)}function Ut(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function oe(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var lt=typeof SVGElement<"u";function _t(t){return lt&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function Ct(){let t=Q();return t[t.length-1]||null}function kt(t,e){let n=Q(),r=t!==null&&n[n.length-1]!==t;r&&n.push(t);try{return e()}finally{r&&n.pop()}}function It(t){return t==null?[]:Array.isArray(t)?t:[t]}function qt(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let r=0;r<t.length;r++)qt(t[r],e,n);return n}if(typeof t=="function"){let r=G(t,e,_t(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(Ut(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(oe(t)){let r=G(t,e,_t(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 ie(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 ft(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 c=It(n);for(let p=0;p<c.length;p++){let u=c[p];u.parentNode===t&&(I(u),t.removeChild(u))}return null}if((typeof e=="string"||typeof e=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let c=String(e);return n.data!==c&&(n.data=c),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?(I(n),t.replaceChild(e,n)):o?t.insertBefore(e,o):t.appendChild(e),e}let i=qt(e,t,[]),g=It(n);if(ie(g,i))return n;let f=i.length;for(let c=0;c<g.length;c++){let p=g[c];if(p.parentNode!==t)continue;let u=!1;for(let y=0;y<f;y++)if(i[y]===p){u=!0;break}u||(I(p),t.removeChild(p))}let a=o;for(let c=i.length-1;c>=0;c--){let p=i[c];(p.parentNode!==t||p.nextSibling!==a)&&(a&&a.parentNode!==t&&(a=null),a?t.insertBefore(p,a):t.appendChild(p)),a=p}return i.length===0?null:i.length===1?i[0]:i}function Qe(t,e,n){let r=n?.key,o=n?.raw||!1,i=(g,f)=>{let a=[],c=[],p=[],u=r&&!o?new Map:null,y=document.createComment("/list");return g.insertBefore(y,f||null),P(()=>{let b=t()||[],m=y.parentNode||g;r?ue(m,y,a,b,c,p,e,r,u):fe(m,y,a,b,c,p,e),a=b.length>0?b.slice():b}),y};return i._mapArray=!0,i._mapArraySource=t,i._mapArrayFn=e,i._mapArrayKeyed=!!r&&!o,i}function ve(t){let e=t._mapArraySource()||[],n=t._mapArrayFn,r=t._mapArrayKeyed;return e.map((o,i)=>n(r?()=>o:o,i))}function fe(t,e,n,r,o,i,g){let f=r.length,a=n.length;if(f===0){if(a>0){for(let s=0;s<a;s++)i[s]&&i[s]();for(let s=a-1;s>=0;s--){let d=o[s];d&&(I(d),d.parentNode===t&&t.removeChild(d))}o.length=0,i.length=0}return}if(a===0){let s=document.createDocumentFragment();for(let d=0;d<f;d++){let x=r[d],S=Y(H=>(i[d]=H,g(x,d)));o[d]=S,s.appendChild(S)}t.insertBefore(s,e);return}let c=0,p=Math.min(a,f);for(;c<p&&n[c]===r[c];)c++;if(c===a&&c===f)return;let u=a-1,y=f-1;for(;u>=c&&y>=c&&n[u]===r[y];)u--,y--;let b=new Array(f),m=new Array(f);for(let s=0;s<c;s++)b[s]=o[s],m[s]=i[s];for(let s=y+1;s<f;s++){let d=u+1+(s-y-1);b[s]=o[d],m[s]=i[d]}let _=y-c+1,h=u-c+1;if(_===0)for(let s=c;s<=u;s++)i[s]?.(),o[s]&&I(o[s]),o[s]?.parentNode&&o[s].parentNode.removeChild(o[s]);else if(h===0){let s=c<f&&b[y+1]?b[y+1]:e,d=document.createDocumentFragment();for(let x=c;x<=y;x++){let S=r[x],H=x;b[x]=Y(N=>(m[H]=N,g(S,H))),d.appendChild(b[x])}t.insertBefore(d,s)}else ce(t,e,n,r,o,i,g,c,u,y,b,m);o.length=f,i.length=f;for(let s=0;s<f;s++)o[s]=b[s],i[s]=m[s]}function ce(t,e,n,r,o,i,g,f,a,c,p,u){let y=new Map;for(let d=f;d<=a;d++)y.set(n[d],d);let b=c-f+1,m=new Int32Array(b);m.fill(-1);for(let d=f;d<=c;d++){let x=y.get(r[d]);x!==void 0&&(y.delete(r[d]),p[d]=o[x],u[d]=i[x],m[d-f]=x)}for(let[,d]of y)i[d]?.(),o[d]&&I(o[d]),o[d]?.parentNode&&o[d].parentNode.removeChild(o[d]);let _=b-se(m,b),h=new Uint8Array(b);if(_>1){let d=new Int32Array(_),x=new Int32Array(_),S=0;for(let N=0;N<b;N++)m[N]!==-1&&(d[S]=m[N],x[S]=N,S++);let H=Wt(d,_);for(let N=0;N<H.length;N++)h[x[H[N]]]=1}else if(_===1){for(let d=0;d<b;d++)if(m[d]!==-1){h[d]=1;break}}for(let d=f;d<=c;d++)if(!p[d]){let x=r[d],S=d;p[d]=Y(H=>(u[S]=H,g(x,S)))}let s=c+1<p.length&&p[c+1]?p[c+1]:e;for(let d=c;d>=f;d--){let x=d-f;(m[x]===-1||!h[x])&&(s&&s.parentNode!==t&&(s=e),t.insertBefore(p[d],s)),s=p[d]}}function se(t,e){let n=0;for(let r=0;r<e;r++)t[r]===-1&&n++;return n}function Wt(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 f=1;f<e;f++)if(t[f]>t[n[o-1]])r[f]=n[o-1],n[o++]=f;else{let a=0,c=o-1;for(;a<c;){let p=a+c>>1;t[n[p]]<t[f]?a=p+1:c=p}n[a]=f,r[f]=a>0?n[a-1]:-1}let i=new Array(o),g=n[o-1];for(let f=o-1;f>=0;f--)i[f]=g,g=r[g];return i}function le(){return document.createComment("i")}function v(t,e,n,r){let o=e;for(;o&&o!==n;){let i=o.nextSibling;t.insertBefore(o,r),o=i}}function yt(t,e,n){let r=e;for(;r&&r!==n;){let o=r.nextSibling;I(r),t.removeChild(r),r=o}}function mt(t,e,n,r,o,i,g,f,a){let c;if(o){let y=r(e),b=a(e);c=b,o.set(y,{itemSig:b})}else c=e;let p=le();t.appendChild(p);let u=Y(y=>(f[n]=y,i(c,n)));t.appendChild(u),g[n]=p}function ue(t,e,n,r,o,i,g,f,a){let c=r.length,p=n.length;if(c===0){if(p>0){for(let l=0;l<p;l++)i[l]&&i[l]();o[0]&&yt(t,o[0],e),o.length=0,i.length=0,a&&a.clear()}return}if(p===0){let l=document.createDocumentFragment();for(let E=0;E<c;E++)mt(l,r[E],E,f,a,g,o,i,O);t.insertBefore(l,e);return}let u=0,y=Math.min(p,c);for(;u<y;){if(n[u]===r[u]){u++;continue}let l=f(n[u]),E=f(r[u]);if(l!==E)break;a&&a.get(l).itemSig.set(r[u]),u++}let b=p-1,m=c-1;for(;b>=u&&m>=u;){if(n[b]===r[m]){b--,m--;continue}let l=f(n[b]),E=f(r[m]);if(l!==E)break;a&&a.get(l).itemSig.set(r[m]),b--,m--}if(u>b&&u>m)return;let _=new Array(c),h=new Array(c);for(let l=0;l<u;l++)_[l]=o[l],h[l]=i[l];for(let l=m+1;l<c;l++){let E=b+1+(l-m-1);_[l]=o[E],h[l]=i[E]}let s=m-u+1,d=b-u+1;if(d===0){let l=m+1<c&&_[m+1]?_[m+1]:e,E=document.createDocumentFragment();for(let B=u;B<=m;B++)mt(E,r[B],B,f,a,g,_,h,O);t.insertBefore(E,l),F(o,i,_,h,c);return}if(s===0){for(let l=u;l<=b;l++){i[l]?.();let E=X(t,o[l],o,l,e);yt(t,o[l],E),a&&a.delete(f(n[l]))}F(o,i,_,h,c);return}if(s===d&&s>=2&&s<=Math.max(d,200)){let l=0,E=-1,B=-1;for(let A=0;A<s&&l<=4;A++){let w=f(n[u+A]),$=f(r[u+A]);w!==$&&(l===0?E=A:l===1&&(B=A),l++)}if(l===2){let A=u+E,w=u+B,$=f(n[A]),J=f(n[w]),dt=f(r[A]),q=f(r[w]);if($===q&&J===dt){for(let L=0;L<u;L++)_[L]=o[L],h[L]=i[L];for(let L=u;L<=m;L++)_[L]=o[L],h[L]=i[L];for(let L=m+1;L<c;L++){let K=b+1+(L-m-1);_[L]=o[K],h[L]=i[K]}let R=_[A];_[A]=_[w],_[w]=R;let M=h[A];if(h[A]=h[w],h[w]=M,a){if(r[A]!==n[A]){let L=f(r[A]),K=a.get(L);K&&K.itemSig.set(r[A])}if(r[w]!==n[w]){let L=f(r[w]),K=a.get(L);K&&K.itemSig.set(r[w])}}let D=w===A+1||A===w+1,j=Math.min(A,w),T=Math.max(A,w);if(D){let L=X(t,o[T],o,T,e);v(t,o[T],L,o[j])}else{let L=X(t,o[w],o,w,e),K=document.createComment("tmp");t.insertBefore(K,o[w]),v(t,o[w],L,o[A]);let Yt=X(t,o[A],o,A,e);v(t,o[A],Yt,K),t.removeChild(K)}F(o,i,_,h,c);return}}if(l>=2&&l<=s){let A=E,w=-1,$=-1,J=!1,dt=f(n[u+A]),q=-1;for(let R=A;R<s;R++)if(f(r[u+R])===dt){q=R;break}if(q>A){let R=!0;for(let M=A;M<q;M++)if(f(n[u+M+1])!==f(r[u+M])){R=!1;break}if(R){let M=!0;for(let D=q+1;D<s;D++)if(f(n[u+D])!==f(r[u+D])){M=!1;break}M&&(J=!0,w=u+A,$=u+q)}}if(!J){let R=f(r[u+A]),M=-1;for(let D=A;D<d;D++)if(f(n[u+D])===R){M=D;break}if(M>A){let D=!0;for(let j=A;j<M;j++)if(f(n[u+j])!==f(r[u+j+1])){D=!1;break}if(D){let j=!0;for(let T=M+1;T<s;T++)if(f(n[u+T])!==f(r[u+T])){j=!1;break}j&&(J=!0,w=u+M,$=u+A)}}}if(J){for(let T=u;T<=b;T++)_[T]=o[T],h[T]=i[T];let R=_[w],M=h[w];if(w<$)for(let T=w;T<$;T++)_[T]=_[T+1],h[T]=h[T+1];else for(let T=w;T>$;T--)_[T]=_[T-1],h[T]=h[T-1];if(_[$]=R,h[$]=M,a)for(let T=u;T<=m;T++){let L=f(r[T]);if(r[T]!==n[T]){let K=a.get(L);K&&K.itemSig.set(r[T])}}let D=X(t,R,o,w,e),j;$+1<c?j=_[$+1]:j=e,($>=m+1||j&&j.parentNode!==t)&&(j=e),v(t,R,D,j),F(o,i,_,h,c);return}}}let x=new Map;for(let l=u;l<=b;l++)x.set(f(n[l]),l);let S=new Int32Array(s);S.fill(-1);for(let l=u;l<=m;l++){let E=f(r[l]),B=x.get(E);B!==void 0&&(x.delete(E),_[l]=o[B],h[l]=i[B],S[l-u]=B,a&&r[l]!==n[B]&&a.get(E).itemSig.set(r[l]))}let H=[...x.values()].sort((l,E)=>E-l);for(let l of H){i[l]?.();let E=X(t,o[l],o,l,e);yt(t,o[l],E),a&&a.delete(f(n[l]))}for(let l=u;l<=m;l++)if(!_[l]){let E=document.createDocumentFragment();mt(E,r[l],l,f,a,g,_,h,O),_[l]._frag=E}let N=0,rt=!0,ot=-1;for(let l=0;l<s;l++)S[l]!==-1&&(N++,S[l]<=ot&&(rt=!1),ot=S[l]);let V=new Uint8Array(s);if(rt)for(let l=0;l<s;l++)S[l]!==-1&&(V[l]=1);else if(N>1){let l=new Int32Array(N),E=new Int32Array(N),B=0;for(let w=0;w<s;w++)S[w]!==-1&&(l[B]=S[w],E[B]=w,B++);let A=Wt(l,N);for(let w=0;w<A.length;w++)V[E[A[w]]]=1}else if(N===1){for(let l=0;l<s;l++)if(S[l]!==-1){V[l]=1;break}}F(o,i,_,h,c);let at=m+1<c&&o[m+1]?o[m+1]:e;for(let l=m;l>=u;l--){let E=l-u,B=o[l];if(S[E]===-1)B._frag&&(t.insertBefore(B._frag,at),delete B._frag);else if(!V[E]){let A=X(t,B,o,l,e);v(t,B,A,at)}at=B}}function X(t,e,n,r,o){let i=e.nextSibling;for(;i&&i!==o;){if(i.nodeType===8&&i.data==="i")return i;i=i.nextSibling}return o}function F(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 Fe(t,e){for(let n in e){let r=e[n];if(n==="ref"){typeof r=="function"?r(t):r&&typeof r=="object"&&(r.current=t);continue}if(W(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(typeof r=="function"&&!W(n)){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}n==="class"||n==="className"?t._propEffects[n]=P(()=>{let o=r()||"";lt&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):n==="style"&&typeof r()=="object"?t._propEffects[n]=P(()=>{ut(t,r())}):t._propEffects[n]=P(()=>{ct(t,n,r())})}else ct(t,n,r)}}function ct(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"&&!W(e)){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=P(()=>ct(t,e,n()));return}if(W(e))return;if(St(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let r=lt&&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")ut(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"?ht(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function nt(t,e,n,r){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=P(()=>r(t,n()))}function ae(t,e){if(typeof e=="function")return nt(t,"class",e,ae);lt&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function ut(t,e){if(typeof e=="function")return nt(t,"style",e,ut);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 de(t,e,n){if(typeof n=="function")return nt(t,e,n,(r,o)=>de(r,e,o));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function he(t,e){if(typeof e=="function")return nt(t,"value",e,he);if(t.tagName==="SELECT"){ht(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function pe(t,e){if(typeof e=="function")return nt(t,"checked",e,pe);t.checked=!!e}var Ot=new Set;function tn(t){for(let e of t)Ot.has(e)||(Ot.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 en(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function nn(t,e){P(()=>{for(let n in e){let r=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!r)}})}var st=!1,C=null;function rn(){return st}function ge(t,e){st=!0,Rt(),C={parent:e,index:0};try{let n=k(t,e);return e!==document.body&&e!==document.documentElement&&Xt(e),n}finally{st=!1,C=null}}function Xt(t){if(!(!C||C.parent!==t))for(;t.childNodes.length>C.index;){let e=t.lastChild;I(e),t.removeChild(e)}}var ye=new Set(["$","/$","[]","/[]","fn","/fn","eb:start","eb:end","sb:start","sb:end","portal","portal:empty"]);function Jt(t){return t.nodeType===8&&ye.has(t.textContent)}function bt(t){let e=t.childNodes;for(;C.index<e.length;){let n=e[C.index];if(Jt(n)){C.index++;continue}return C.index++,n}return null}function Zt(t){if(!C||C.parent!==t)return null;let e=t.childNodes;for(let n=C.index;n<e.length;n++){let r=e[n];if(!Jt(r))return r}return null}function tt(t,e){return C&&C.parent===t?(t.insertBefore(e,t.childNodes[C.index]||null),C.index++):t.appendChild(e),e}function xt(){return z}function k(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=Zt(e);return i&&i.nodeType===3?(bt(e),i.textContent="",i):tt(e,document.createTextNode(""))}let r=bt(e);if(r&&r.nodeType===3)return r.textContent!==n&&(xt()&&console.warn(`[what] Hydration mismatch: expected text "${n}", got "${r.textContent}"`),r.textContent=n),r;xt()&&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):tt(e,o),o}if(typeof t=="function"&&t._lazyChildren)return k(t(),e);if(typeof t=="function"&&t._mapArray){let n=!!(C&&C.parent===e),r=n&&e.childNodes[C.index]||null,o=t(e,r);if(n){let i=Array.prototype.indexOf.call(e.childNodes,o);i>=0&&(C.index=i+1)}return o}if(typeof t=="function"){let n=!!(C&&C.parent===e),r=document.createComment("fn"),o=document.createComment("/fn");n?(e.insertBefore(r,e.childNodes[C.index]||null),C.index++):e.appendChild(r),k(t(),e),n?(e.insertBefore(o,e.childNodes[C.index]||null),C.index++):e.appendChild(o);let i=[];for(let u=r.nextSibling;u&&u!==o;u=u.nextSibling)i.push(u);let g=i.length===0?null:i.length===1?i[0]:i,f=Ct(),a=P(()=>kt(f,()=>{let u=t();st||(g=ft(o.parentNode||e,u,g,o))})),c=!1,p=()=>{c||(c=!0,a())};return r._dispose=p,o._dispose=p,Lt(r,p),g}if(Array.isArray(t)){let n=[];for(let r of t){let o=k(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=Q(),g=t.tag,f=t.props||{},a=t.children||[],c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:g,_parentCtx:i[i.length-1]||null,_errorBoundary:null};i.push(c);let p,u=null;try{let y={...f};f._$lazyChildren?u=Bt(g,y,f._$lazyChildren):y.children=a.length===0?f.children:a.length===1?a[0]:a,p=g(y),u&&u()}catch(y){return i.pop(),!Mt(y)&&!(y&&typeof y.then=="function"&&me(y,c))&&!Et(y,c)&&console.error("[what] Error in component during hydration:",g.name||"Anonymous",y),null}c.mounted=!0,c._mountCallbacks&&queueMicrotask(()=>{if(!c.disposed)for(let y of c._mountCallbacks)try{y()}catch(b){console.error("[what] onMount error:",b)}});try{let y=k(p,e),b=typeof p=="function"||Array.isArray(p)&&p.some(h=>typeof h=="function"),m=Array.isArray(y)?y[0]:y,_=!b&&m&&m.nodeType?m:e;return it(_,c),y}finally{i.pop()}}if(t.tag==="__errorBoundary"){let{errorState:i,fallback:g,reset:f,handleError:a}=t.props;return Vt(t,e,{startText:"eb:start",endText:"eb:end",ctxExtras:{_errorBoundary:a},state:i,contentFor:c=>c?typeof g=="function"?g({error:c,reset:f}):g:t.children||[]})}if(t.tag==="__suspense"){let{boundary:i,fallback:g,loading:f}=t.props;return Vt(t,e,{startText:"sb:start",endText:"sb:end",ctxExtras:{_suspenseBoundary:i},state:f,contentFor:a=>a?g:t.children||[]})}if(t.tag==="__portal"){let i=G(t,e);return i?tt(e,i):null}let n=bt(e),r=t.tag.toLowerCase();if(n&&n.nodeType===1&&n.nodeName.toLowerCase()===r){_e(n,t.props||{});let i=C;if(C={parent:n,index:0},t.props?.dangerouslySetInnerHTML?.__html==null){for(let f of t.children)k(f,n);t.children.length>0&&Xt(n)}return C=i,n}xt()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${n?n.nodeName:"nothing"}. Falling back to client render.`);let o=G(t,e,_t(e));return n?e.replaceChild(o,n):tt(e,o),o}return Ut(t)?t:tt(e,document.createTextNode(String(t)))}function me(t,e){for(let n=e;n;n=n._parentCtx)if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(t),!0;return!1}function be(t,e){return typeof t=="string"||typeof t=="number"?e.nodeType!==3:t&&t._vnode&&typeof t.tag=="string"?e.nodeType!==1||e.nodeName.toLowerCase()!==t.tag.toLowerCase():!1}function xe(t,e,n){if(e<0||!C||C.parent!==t||C.index!==e)return!1;let r=Zt(t);if(!r)return!1;let o=n(),i=Array.isArray(o)?o:[o],g=i.find(f=>f!=null&&typeof f!="boolean");if(g===void 0)return!0;if(be(g,r))return!1;for(let f of i)k(f,t);return!0}function Vt(t,e,{startText:n,endText:r,ctxExtras:o,state:i,contentFor:g}){let f=t.children||[],a=!!(C&&C.parent===e),c=document.createComment(n),p=document.createComment(r),u={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:Ct(),_startComment:c,_endComment:p,...o};a?(e.insertBefore(c,e.childNodes[C.index]||null),C.index++):e.appendChild(c);let y=a?C.index:-1,b=Q();b.push(u);try{for(let x of f)k(x,e)}finally{b.pop()}let m=At(i),_=!m;if(m){b.push(u);try{_=xe(e,y,()=>g(m))}finally{b.pop()}}a?(e.insertBefore(p,e.childNodes[C.index]||null),C.index++):e.appendChild(p);let h=!0,s=0,d=P(()=>{let x=i();if(h&&(h=!1,_&&x===m))return;let S=c.parentNode;if(!S)return;let H=++s;for(;c.nextSibling&&c.nextSibling!==p;){let N=c.nextSibling;I(N),S.removeChild(N)}b.push(u);try{let N=g(x),rt=Array.isArray(N)?N:[N];for(let ot of rt){let V=G(ot,S);if(H!==s){V&&I(V);break}V&&(p.parentNode?p.parentNode.insertBefore(V,p):I(V))}}finally{b.pop()}});if(a&&C&&C.parent===e){let x=Array.prototype.indexOf.call(e.childNodes,p);x>=0&&(C.index=x+1)}return u.effects.push(d),it(c,u),it(p,u),c}function _e(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(W(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"&&!W(n)){n==="class"||n==="className"?P(()=>{t.className=r()||""}):n==="style"&&typeof r()=="object"?P(()=>{ut(t,r())}):P(()=>{ct(t,n,r())});continue}}}Tt({hydrate:ge,insert:Gt});export{Te as a,Se as b,Qt as c,Le as d,Ft as e,Ne as f,Be as g,Me as h,He as i,De as j,je as k,Pe as l,Re as m,Kt as n,Ke as o,$e as p,Ie as q,Oe as r,Ve as s,ze as t,Je as u,Ze as v,ne as w,Ye as x,re as y,Gt as z,Qe as A,ve as B,Fe as C,ct as D,ae as E,ut as F,de as G,he as H,pe as I,tn as J,en as K,nn as L,rn as M,ge as N};
|
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as Fn,B as Pn,C as Hn,D as $n,J as Vn,K as Gn,L as Un,M as jn,N as qn,a as dn,b as fn,c as pn,d as hn,e as gn,f as mn,g as yn,h as vn,i as wn,j as xn,k as En,l as bn,m as _n,n as Sn,o as kn,p as Rn,q as Cn,r as An,s as In,t as Tn,u as Dn,v as Nn,w as On,x as Je,y as Ln,z as Mn}from"./chunk-ENARGHSD.min.js";import{$ as un,A as Bt,B as Wt,C as Yt,D as Xt,F as zt,G as Qt,H as Kt,I as Jt,J as Zt,K as en,L as tn,M as nn,N as rn,O as on,P as sn,Q as Ne,S as an,W as cn,Y as W,_ as ln,a as L,c as At,d,e as P,f as V,g as O,h as It,i as Tt,j as ce,k as Dt,l as Nt,m as Ot,o as Lt,p as Mt,q as Ht,r as ge,s as De,t as $t,u as Vt,v as Gt,w as Ut,x as jt,y as qt}from"./chunk-OKM3GKVP.min.js";import{a as D,b as Ft,c as Pt}from"./chunk-O3SKPRTY.min.js";var re;function Oe(){if(re!==void 0)return re;if(typeof document>"u")return re=null;let e=document.getElementById("__what_data");if(!e)return re=null;try{re=JSON.parse(e.textContent)}catch{re=null}return re}function Bn(){re=void 0}function Le(){let e=Oe();return e?e.loaderData:void 0}function Me(e){let t=Oe();return t&&t.resources?t.resources[e]:void 0}function Wn(){if(De()){let e=ge();return e?e.loaderData:void 0}return Le()}function Y(e){let t=W();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function oe(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function Yn(e){let t=Y("useState"),{index:n,exists:r}=oe(t);if(!r){let s=d(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function Xn(e){let t=Y("useSignal"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=d(typeof e=="function"?e():e)),t.hooks[n]}function zn(e){let t=Y("useComputed"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=P(e)),t.hooks[n]}function Qn(e,t){let n=Y("useEffect"),{index:r,exists:o}=oe(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),L&&Array.isArray(t)&&t.length>0)for(let a=0;a<t.length;a++){let c=t[a];c!=null&&typeof c!="function"&&console.warn(`[what] useEffect dep at index ${a} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[r];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=V(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let a=e();typeof a=="function"&&(s.cleanup=a)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let a=e();typeof a=="function"&&(s.cleanup=a)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=V(()=>{for(let c=0;c<t.length;c++){let u=t[c];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let a=ce(()=>e());typeof a=="function"&&(s.cleanup=a)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function Kn(e,t){let n=Y("useMemo"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={computed:P(e)}),n.hooks[r].computed}function Jn(e,t){let n=Y("useCallback"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function Zn(e){let t=Y("useRef"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Ze(e){let t=W();for(L&&!t&&console.warn(`[what] useContext(${e?.displayName||"Context"}) called outside of component render. useContext must be called during component rendering, not inside effects or event handlers. Store the context value in a variable during render and use that variable in your callback.`);t;){if(t._contextValues&&t._contextValues.has(e)){let n=t._contextValues.get(e);return n&&n._signal?n():n}t=t._parentCtx}return e._defaultValue}function er(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=Y("Context.Provider");if(o._contextValues||(o._contextValues=new Map),o._contextSignals||(o._contextSignals=new Map),o._contextSignals.has(t))o._contextSignals.get(t).set(n);else{let s=d(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Ze(t);return typeof n=="function"?n(r):n}};return t.Provider._deferChildren=!0,t}function tr(e,t,n){let r=Y("useReducer"),{index:o,exists:s}=oe(r);if(!s){let c=n?n(t):t,u=d(c),p=i=>{u.set(h=>e(h,i))};r.hooks[o]={signal:u,dispatch:p}}let a=r.hooks[o];return[a.signal,a.dispatch]}function nr(e){let t=Y("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function rr(e){let t=Y("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function or(e,t={}){if(De()){let i=ge();if(i){let h=t.key!=null?t.key:`__r${i.resourceCounter++}`,g=i.resources.get(h);if(g&&g.status==="ready")return[()=>g.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(g&&g.status==="error")return[()=>{},{loading:()=>!1,error:()=>g.error,refetch:()=>{},mutate:()=>{}}];if(!g){let _=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{i.resources.set(h,{status:"ready",value:b})}).catch(b=>{i.resources.set(h,{status:"error",error:b})});throw i.resources.set(h,{status:"pending",promise:_}),_}throw g.promise}if(t.initialValue!=null)return[()=>t.initialValue,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];throw Promise.resolve().then(()=>e(t.source??!0,{}))}let n=t.initialValue;if(n==null&&t.key!=null){let i=Me(t.key);i!==void 0&&(n=i)}let r=d(n??null),o=d(n==null),s=d(null),a=null,c=async i=>{a&&a.abort(),a=new AbortController;let{signal:h}=a;o.set(!0),s.set(null);try{let g=await e(i,{signal:h});h.aborted||O(()=>{r.set(g),o.set(!1)})}catch(g){h.aborted||O(()=>{s.set(g),o.set(!1)})}},u=i=>{r.set(typeof i=="function"?i(r()):i)},p=W?.();return p&&(p._cleanupCallbacks=p._cleanupCallbacks||[],p._cleanupCallbacks.push(()=>{a&&a.abort()})),n==null&&c(t.source),[r,{loading:o,error:s,refetch:c,mutate:u}]}function nt(e){return e._storeComputed=!0,e}var et=!1;function sr(e){return et||(et=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),nt(e)}function ar(e){let t={},n={},r={};for(let[o,s]of Object.entries(e))typeof s=="function"&&s._storeComputed?(L&&s.length===0&&console.warn(`[what] derived() for "${o}" should accept the state parameter, e.g. derived(state => ...).`),n[o]=s):typeof s=="function"?r[o]=s:t[o]=d(s);for(let[o,s]of Object.entries(n)){let a=new Proxy({},{get(c,u){if(t[u])return t[u]();if(n[u])return n[u]()}});n[o]=P(()=>s(a))}for(let[o,s]of Object.entries(r))r[o]=(...a)=>{let c;return O(()=>{let u=new Proxy({},{get(p,i){if(t[i])return t[i].peek();if(n[i])return n[i].peek();if(r[i])return r[i]},set(p,i,h){return t[i]&&t[i].set(h),!0}});c=s.apply(u,a)}),c};return function(){let s={};for(let[a,c]of Object.entries(t))Object.defineProperty(s,a,{get:()=>c(),enumerable:!0});for(let[a,c]of Object.entries(n))Object.defineProperty(s,a,{get:()=>c(),enumerable:!0});for(let[a,c]of Object.entries(r))s[a]=c;return s}}var tt=!1;function ir(e){return tt||(tt=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),d(e)}var Fe={title:null,metas:new Map,links:new Map};function cr({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ge();return o&&o.head&&ur(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Fe.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);ot("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");ot("link",s,o)}return r||null}function lr(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function ur(e,{title:t,meta:n,link:r}){if(t!=null&&(e.title=t),n)for(let o of Array.isArray(n)?n:[n])e.metas.set(lr(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function dr(){return{title:null,metas:new Map,links:new Map}}function fr(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${st(String(e.title))}</title>`);for(let n of e.metas.values())t+=rt("meta",n);for(let n of e.links.values())t+=rt("link",n);return t}var pr=/^[a-zA-Z_:][a-zA-Z0-9:._-]*$/;function Pe(e){if(!pr.test(e))return!1;let t=e.toLowerCase();return!(t.startsWith("on")&&t.length>2)}function ke(e){return e==="httpEquiv"?"http-equiv":e}function rt(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;let s=ke(r);Pe(s)&&(n+=` ${s}="${st(String(o))}"`)}return n+">"}function st(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function hr(e){let t=String(e);return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n.codePointAt(0).toString(16)} `)}function ot(e,t,n){let r=document.head.querySelector(`[data-what-head="${hr(t)}"]`);if(r){gr(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,a]of Object.entries(n))Pe(ke(s))&&o.setAttribute(ke(s),a);document.head.appendChild(o)}function gr(e,t){for(let[n,r]of Object.entries(t)){let o=ke(n);Pe(o)&&e.getAttribute(o)!==r&&e.setAttribute(o,r)}}function mr(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Fe.metas.clear(),Fe.links.clear()}var me=[],ye=[],$e=!1;function Z(e){return me.push(e),Ve(),()=>{let t=me.indexOf(e);t!==-1&&me.splice(t,1)}}function se(e){return ye.push(e),Ve(),()=>{let t=ye.indexOf(e);t!==-1&&ye.splice(t,1)}}function at(){for(;me.length>0;){let e=me.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;ye.length>0;){let e=ye.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}$e=!1,(me.length>0||ye.length>0)&&Ve()}function Ve(){$e||($e=!0,requestAnimationFrame(at))}function yr(e){return new Promise(t=>{Z(()=>{t(e())})})}function vr(e){return new Promise(t=>{se(()=>{e(),t()})})}function wr(e,t){let n=Symbol("scheduledEffect");return V(()=>{it(n,()=>{Z(()=>{let r=e();t&&se(()=>t(r))})})})}function xr(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var we=new Map;function it(e,t){we.has(e)?we.set(e,t):(we.set(e,t),requestAnimationFrame(()=>{let n=we.get(e);we.delete(e),n&&n()}))}var He=new WeakMap,Re=null;function Er(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(Re||(Re=new ResizeObserver(n=>{Z(()=>{for(let r of n){let o=He.get(r.target);o&&o(r.contentRect)}})})),He.set(e,t),Re.observe(e),()=>{He.delete(e),Re.unobserve(e)})}function br(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{Z(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function _r(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,a,c;Z(()=>{s=window.scrollY;let p=e.getBoundingClientRect();a=s+p.top,c=performance.now(),u()});function u(){Z(()=>{let p=performance.now()-c,i=Math.min(p/n,1),h=r(i),g=s+(a-s)*h;se(()=>{window.scrollTo(0,g),i<1?requestAnimationFrame(u):o()})})}})}function ct(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function lt(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,a=d(e),c=d(e),u=d(0),p=d(!1),i=null,h=null;function g(S){if(h===null){h=S,i=requestAnimationFrame(g);return}let E=Math.min((S-h)/1e3,.064);h=S;let T=a.peek(),N=c.peek(),A=u.peek(),k=T-N,m=-n*k,f=-r*A,I=(m+f)/o,F=A+I*E,$=T+F*E;if(O(()=>{u.set(F),a.set($)}),Math.abs(F)<s&&Math.abs(k)<s){O(()=>{a.set(N),u.set(0),p.set(!1)}),i=null,h=null;return}i=requestAnimationFrame(g)}function _(S){c.set(S),i===null&&(p.set(!0),h=null,i=requestAnimationFrame(g))}function b(){i&&(cancelAnimationFrame(i),i=null),p.set(!1),h=null}function R(S){b(),O(()=>{a.set(S),c.set(S),u.set(0)})}let C=W?.();return C&&(C._cleanupCallbacks=C._cleanupCallbacks||[],C._cleanupCallbacks.push(b)),{current:()=>a(),target:()=>c(),velocity:()=>u(),isAnimating:()=>p(),set:_,stop:b,snap:R,subscribe:a.subscribe}}function ut(e,t,n={}){let{duration:r=300,easing:o=_=>_*(2-_),onUpdate:s,onComplete:a}=n,c=d(0),u=d(e),p=d(!0),i=null,h=null;function g(_){i===null&&(i=_);let b=_-i,R=Math.min(b/r,1),C=o(R),S=e+(t-e)*C;O(()=>{c.set(R),u.set(S)}),s&&s(S,R),R<1?h=requestAnimationFrame(g):(p.set(!1),a&&a())}return h=requestAnimationFrame(g),{progress:()=>c(),value:()=>u(),isAnimating:()=>p(),cancel:()=>{h&&cancelAnimationFrame(h),p.set(!1)},subscribe:u.subscribe}}var dt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*(2*Math.PI/3)),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function Sr(e={}){let{duration:t=300,easing:n=dt.easeOutQuad}=e,r=d(!1),o=d(0);async function s(a){return r.set(!0),o.set(0),new Promise(c=>{let u=performance.now();function p(i){let h=i-u,g=Math.min(h/t,1);o.set(n(g)),g<1?requestAnimationFrame(p):(r.set(!1),a&&a(),c())}requestAnimationFrame(p)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function kr(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:a,onTap:c,onLongPress:u,preventDefault:p=!1}=t,i={isDragging:d(!1),startX:0,startY:0,currentX:d(0),currentY:d(0),deltaX:d(0),deltaY:d(0),velocity:d({x:0,y:0})},h=0,g=0,_=0,b=null;function R(k){let m=k.touches?k.touches[0]:k;i.startX=m.clientX,i.startY=m.clientY,g=m.clientX,_=m.clientY,h=performance.now(),i.isDragging.set(!0),r&&r({x:i.startX,y:i.startY}),u&&(b=setTimeout(()=>{i.isDragging.peek()&&u({x:g,y:_})},500))}function C(k){if(!i.isDragging.peek())return;let m=k.touches?k.touches[0]:k,f=m.clientX,I=m.clientY,F=performance.now(),$=F-h;O(()=>{i.currentX.set(f),i.currentY.set(I),i.deltaX.set(f-i.startX),i.deltaY.set(I-i.startY),$>0&&i.velocity.set({x:(f-g)/$*1e3,y:(I-_)/$*1e3})}),g=f,_=I,h=F,b&&Math.sqrt(i.deltaX.peek()**2+i.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:f,y:I,deltaX:i.deltaX.peek(),deltaY:i.deltaY.peek(),velocity:i.velocity.peek()})}function S(k){if(!i.isDragging.peek())return;b&&(clearTimeout(b),b=null);let m=i.deltaX.peek(),f=i.deltaY.peek(),I=i.velocity.peek();if(Math.sqrt(m**2+f**2)<10&&c&&c({x:i.startX,y:i.startY}),a&&(Math.abs(I.x)>500||Math.abs(I.y)>500)){let $=Math.abs(I.x)>Math.abs(I.y)?I.x>0?"right":"left":I.y>0?"down":"up";a({direction:$,velocity:I})}o&&o({deltaX:m,deltaY:f,velocity:I}),i.isDragging.set(!1)}let E=null;function T(k){if(!s||k.touches.length!==2)return;let m=k.touches[0],f=k.touches[1],I=Math.sqrt((f.clientX-m.clientX)**2+(f.clientY-m.clientY)**2);E===null&&(E=I);let F=I/E,$=(m.clientX+f.clientX)/2,v=(m.clientY+f.clientY)/2;s({scale:F,centerX:$,centerY:v})}function N(){E=null}typeof e=="function"?ct(()=>{let k=ce(e);if(k)return A(k)}):e?.current!==void 0?ct(()=>{let k=e.current;if(k)return A(k)}):e&&A(e);function A(k){return k.addEventListener("mousedown",R),k.addEventListener("touchstart",R,{passive:!p}),window.addEventListener("mousemove",C),window.addEventListener("touchmove",T),window.addEventListener("touchmove",C),window.addEventListener("mouseup",S),window.addEventListener("touchend",S),window.addEventListener("touchend",N),()=>{k.removeEventListener("mousedown",R),k.removeEventListener("touchstart",R),window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",T),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",S),window.removeEventListener("touchend",S),window.removeEventListener("touchend",N)}}return i}function Rr(e){let t=d(e);return{value:()=>t(),setValue:n=>t.set(n),spring(n,r={}){let o=lt(t.peek(),r);o.set(n);let s=V(()=>{t.set(o.current())});return{stop:()=>{o.stop(),s()}}},timing(n,r={}){let o=ut(t.peek(),n,{...r,onUpdate:s=>t.set(s)});return{stop:()=>o.cancel()}},interpolate(n,r){return()=>{let o=t();for(let s=0;s<n.length-1;s++)if(o>=n[s]&&o<=n[s+1]){let a=(o-n[s])/(n[s+1]-n[s]);return r[s]+(r[s+1]-r[s])*a}return o<=n[0]?r[0]:r[r.length-1]}},subscribe:t.subscribe}}function ft(e){return{enter:`${e}-enter`,enterActive:`${e}-enter-active`,enterDone:`${e}-enter-done`,exit:`${e}-exit`,exitActive:`${e}-exit-active`,exitDone:`${e}-exit-done`}}async function Cr(e,t,n="enter",r=300){let o=ft(t);return new Promise(s=>{se(()=>{e.classList.add(o[n]),Z(()=>{e.offsetHeight,se(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{se(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Ar=`
|
|
1
|
+
import{A as Fn,B as Pn,C as Hn,D as Gn,J as Vn,K as $n,L as Un,M as jn,N as qn,a as dn,b as fn,c as pn,d as hn,e as gn,f as mn,g as yn,h as vn,i as wn,j as xn,k as En,l as bn,m as _n,n as Sn,o as kn,p as Rn,q as Cn,r as An,s as In,t as Tn,u as Nn,v as Dn,w as On,x as Je,y as Ln,z as Mn}from"./chunk-DZTPU2YD.min.js";import{$ as un,A as Bt,B as Wt,C as Yt,D as Xt,F as zt,G as Qt,H as Kt,I as Jt,J as Zt,K as en,L as tn,M as nn,N as rn,O as on,P as sn,Q as De,S as an,W as cn,Y as W,_ as ln,a as L,c as At,d,e as P,f as V,g as O,h as It,i as Tt,j as ce,k as Nt,l as Dt,m as Ot,o as Lt,p as Mt,q as Ht,r as ge,s as Ne,t as Gt,u as Vt,v as $t,w as Ut,x as jt,y as qt}from"./chunk-OKM3GKVP.min.js";import{a as N,b as Ft,c as Pt}from"./chunk-O3SKPRTY.min.js";var re;function Oe(){if(re!==void 0)return re;if(typeof document>"u")return re=null;let e=document.getElementById("__what_data");if(!e)return re=null;try{re=JSON.parse(e.textContent)}catch{re=null}return re}function Bn(){re=void 0}function Le(){let e=Oe();return e?e.loaderData:void 0}function Me(e){let t=Oe();return t&&t.resources?t.resources[e]:void 0}function Wn(){if(Ne()){let e=ge();return e?e.loaderData:void 0}return Le()}function Y(e){let t=W();if(!t)throw new Error(`[what] ${e||"Hook"}() can only be called inside a component function. Did you call it outside of a component or in an async callback? If you need reactive state outside a component, use signal() directly.`);return t}function oe(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function Yn(e){let t=Y("useState"),{index:n,exists:r}=oe(t);if(!r){let s=d(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function Xn(e){let t=Y("useSignal"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=d(typeof e=="function"?e():e)),t.hooks[n]}function zn(e){let t=Y("useComputed"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]=P(e)),t.hooks[n]}function Qn(e,t){let n=Y("useEffect"),{index:r,exists:o}=oe(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),L&&Array.isArray(t)&&t.length>0)for(let a=0;a<t.length;a++){let c=t[a];c!=null&&typeof c!="function"&&console.warn(`[what] useEffect dep at index ${a} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[r];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=V(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let a=e();typeof a=="function"&&(s.cleanup=a)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let a=e();typeof a=="function"&&(s.cleanup=a)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=V(()=>{for(let c=0;c<t.length;c++){let u=t[c];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let a=ce(()=>e());typeof a=="function"&&(s.cleanup=a)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function Kn(e,t){let n=Y("useMemo"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={computed:P(e)}),n.hooks[r].computed}function Jn(e,t){let n=Y("useCallback"),{index:r,exists:o}=oe(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function Zn(e){let t=Y("useRef"),{index:n,exists:r}=oe(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Ze(e){let t=W();for(L&&!t&&console.warn(`[what] useContext(${e?.displayName||"Context"}) called outside of component render. useContext must be called during component rendering, not inside effects or event handlers. Store the context value in a variable during render and use that variable in your callback.`);t;){if(t._contextValues&&t._contextValues.has(e)){let n=t._contextValues.get(e);return n&&n._signal?n():n}t=t._parentCtx}return e._defaultValue}function er(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=Y("Context.Provider");if(o._contextValues||(o._contextValues=new Map),o._contextSignals||(o._contextSignals=new Map),o._contextSignals.has(t))o._contextSignals.get(t).set(n);else{let s=d(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Ze(t);return typeof n=="function"?n(r):n}};return t.Provider._deferChildren=!0,t}function tr(e,t,n){let r=Y("useReducer"),{index:o,exists:s}=oe(r);if(!s){let c=n?n(t):t,u=d(c),p=i=>{u.set(h=>e(h,i))};r.hooks[o]={signal:u,dispatch:p}}let a=r.hooks[o];return[a.signal,a.dispatch]}function nr(e){let t=Y("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function rr(e){let t=Y("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function or(e,t={}){if(Ne()){let i=ge();if(i){let h=t.key!=null?t.key:`__r${i.resourceCounter++}`,g=i.resources.get(h);if(g&&g.status==="ready")return[()=>g.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(g&&g.status==="error")return[()=>{},{loading:()=>!1,error:()=>g.error,refetch:()=>{},mutate:()=>{}}];if(!g){let _=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{i.resources.set(h,{status:"ready",value:b})}).catch(b=>{i.resources.set(h,{status:"error",error:b})});throw i.resources.set(h,{status:"pending",promise:_}),_}throw g.promise}if(t.initialValue!=null)return[()=>t.initialValue,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];throw Promise.resolve().then(()=>e(t.source??!0,{}))}let n=t.initialValue;if(n==null&&t.key!=null){let i=Me(t.key);i!==void 0&&(n=i)}let r=d(n??null),o=d(n==null),s=d(null),a=null,c=async i=>{a&&a.abort(),a=new AbortController;let{signal:h}=a;o.set(!0),s.set(null);try{let g=await e(i,{signal:h});h.aborted||O(()=>{r.set(g),o.set(!1)})}catch(g){h.aborted||O(()=>{s.set(g),o.set(!1)})}},u=i=>{r.set(typeof i=="function"?i(r()):i)},p=W?.();return p&&(p._cleanupCallbacks=p._cleanupCallbacks||[],p._cleanupCallbacks.push(()=>{a&&a.abort()})),n==null&&c(t.source),[r,{loading:o,error:s,refetch:c,mutate:u}]}function nt(e){return e._storeComputed=!0,e}var et=!1;function sr(e){return et||(et=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),nt(e)}function ar(e){let t={},n={},r={};for(let[o,s]of Object.entries(e))typeof s=="function"&&s._storeComputed?(L&&s.length===0&&console.warn(`[what] derived() for "${o}" should accept the state parameter, e.g. derived(state => ...).`),n[o]=s):typeof s=="function"?r[o]=s:t[o]=d(s);for(let[o,s]of Object.entries(n)){let a=new Proxy({},{get(c,u){if(t[u])return t[u]();if(n[u])return n[u]()}});n[o]=P(()=>s(a))}for(let[o,s]of Object.entries(r))r[o]=(...a)=>{let c;return O(()=>{let u=new Proxy({},{get(p,i){if(t[i])return t[i].peek();if(n[i])return n[i].peek();if(r[i])return r[i]},set(p,i,h){return t[i]&&t[i].set(h),!0}});c=s.apply(u,a)}),c};return function(){let s={};for(let[a,c]of Object.entries(t))Object.defineProperty(s,a,{get:()=>c(),enumerable:!0});for(let[a,c]of Object.entries(n))Object.defineProperty(s,a,{get:()=>c(),enumerable:!0});for(let[a,c]of Object.entries(r))s[a]=c;return s}}var tt=!1;function ir(e){return tt||(tt=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),d(e)}var Fe={title:null,metas:new Map,links:new Map};function cr({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ge();return o&&o.head&&ur(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Fe.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);ot("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");ot("link",s,o)}return r||null}function lr(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function ur(e,{title:t,meta:n,link:r}){if(t!=null&&(e.title=t),n)for(let o of Array.isArray(n)?n:[n])e.metas.set(lr(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function dr(){return{title:null,metas:new Map,links:new Map}}function fr(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${st(String(e.title))}</title>`);for(let n of e.metas.values())t+=rt("meta",n);for(let n of e.links.values())t+=rt("link",n);return t}var pr=/^[a-zA-Z_:][a-zA-Z0-9:._-]*$/;function Pe(e){if(!pr.test(e))return!1;let t=e.toLowerCase();return!(t.startsWith("on")&&t.length>2)}function ke(e){return e==="httpEquiv"?"http-equiv":e}function rt(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;let s=ke(r);Pe(s)&&(n+=` ${s}="${st(String(o))}"`)}return n+">"}function st(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function hr(e){let t=String(e);return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n.codePointAt(0).toString(16)} `)}function ot(e,t,n){let r=document.head.querySelector(`[data-what-head="${hr(t)}"]`);if(r){gr(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,a]of Object.entries(n))Pe(ke(s))&&o.setAttribute(ke(s),a);document.head.appendChild(o)}function gr(e,t){for(let[n,r]of Object.entries(t)){let o=ke(n);Pe(o)&&e.getAttribute(o)!==r&&e.setAttribute(o,r)}}function mr(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Fe.metas.clear(),Fe.links.clear()}var me=[],ye=[],Ge=!1;function Z(e){return me.push(e),Ve(),()=>{let t=me.indexOf(e);t!==-1&&me.splice(t,1)}}function se(e){return ye.push(e),Ve(),()=>{let t=ye.indexOf(e);t!==-1&&ye.splice(t,1)}}function at(){for(;me.length>0;){let e=me.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;ye.length>0;){let e=ye.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Ge=!1,(me.length>0||ye.length>0)&&Ve()}function Ve(){Ge||(Ge=!0,requestAnimationFrame(at))}function yr(e){return new Promise(t=>{Z(()=>{t(e())})})}function vr(e){return new Promise(t=>{se(()=>{e(),t()})})}function wr(e,t){let n=Symbol("scheduledEffect");return V(()=>{it(n,()=>{Z(()=>{let r=e();t&&se(()=>t(r))})})})}function xr(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var we=new Map;function it(e,t){we.has(e)?we.set(e,t):(we.set(e,t),requestAnimationFrame(()=>{let n=we.get(e);we.delete(e),n&&n()}))}var He=new WeakMap,Re=null;function Er(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(Re||(Re=new ResizeObserver(n=>{Z(()=>{for(let r of n){let o=He.get(r.target);o&&o(r.contentRect)}})})),He.set(e,t),Re.observe(e),()=>{He.delete(e),Re.unobserve(e)})}function br(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{Z(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function _r(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,a,c;Z(()=>{s=window.scrollY;let p=e.getBoundingClientRect();a=s+p.top,c=performance.now(),u()});function u(){Z(()=>{let p=performance.now()-c,i=Math.min(p/n,1),h=r(i),g=s+(a-s)*h;se(()=>{window.scrollTo(0,g),i<1?requestAnimationFrame(u):o()})})}})}function ct(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function lt(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,a=d(e),c=d(e),u=d(0),p=d(!1),i=null,h=null;function g(S){if(h===null){h=S,i=requestAnimationFrame(g);return}let E=Math.min((S-h)/1e3,.064);h=S;let T=a.peek(),D=c.peek(),A=u.peek(),k=T-D,m=-n*k,f=-r*A,I=(m+f)/o,F=A+I*E,G=T+F*E;if(O(()=>{u.set(F),a.set(G)}),Math.abs(F)<s&&Math.abs(k)<s){O(()=>{a.set(D),u.set(0),p.set(!1)}),i=null,h=null;return}i=requestAnimationFrame(g)}function _(S){c.set(S),i===null&&(p.set(!0),h=null,i=requestAnimationFrame(g))}function b(){i&&(cancelAnimationFrame(i),i=null),p.set(!1),h=null}function R(S){b(),O(()=>{a.set(S),c.set(S),u.set(0)})}let C=W?.();return C&&(C._cleanupCallbacks=C._cleanupCallbacks||[],C._cleanupCallbacks.push(b)),{current:()=>a(),target:()=>c(),velocity:()=>u(),isAnimating:()=>p(),set:_,stop:b,snap:R,subscribe:a.subscribe}}function ut(e,t,n={}){let{duration:r=300,easing:o=_=>_*(2-_),onUpdate:s,onComplete:a}=n,c=d(0),u=d(e),p=d(!0),i=null,h=null;function g(_){i===null&&(i=_);let b=_-i,R=Math.min(b/r,1),C=o(R),S=e+(t-e)*C;O(()=>{c.set(R),u.set(S)}),s&&s(S,R),R<1?h=requestAnimationFrame(g):(p.set(!1),a&&a())}return h=requestAnimationFrame(g),{progress:()=>c(),value:()=>u(),isAnimating:()=>p(),cancel:()=>{h&&cancelAnimationFrame(h),p.set(!1)},subscribe:u.subscribe}}var dt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*(2*Math.PI/3)),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function Sr(e={}){let{duration:t=300,easing:n=dt.easeOutQuad}=e,r=d(!1),o=d(0);async function s(a){return r.set(!0),o.set(0),new Promise(c=>{let u=performance.now();function p(i){let h=i-u,g=Math.min(h/t,1);o.set(n(g)),g<1?requestAnimationFrame(p):(r.set(!1),a&&a(),c())}requestAnimationFrame(p)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function kr(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:a,onTap:c,onLongPress:u,preventDefault:p=!1}=t,i={isDragging:d(!1),startX:0,startY:0,currentX:d(0),currentY:d(0),deltaX:d(0),deltaY:d(0),velocity:d({x:0,y:0})},h=0,g=0,_=0,b=null;function R(k){let m=k.touches?k.touches[0]:k;i.startX=m.clientX,i.startY=m.clientY,g=m.clientX,_=m.clientY,h=performance.now(),i.isDragging.set(!0),r&&r({x:i.startX,y:i.startY}),u&&(b=setTimeout(()=>{i.isDragging.peek()&&u({x:g,y:_})},500))}function C(k){if(!i.isDragging.peek())return;let m=k.touches?k.touches[0]:k,f=m.clientX,I=m.clientY,F=performance.now(),G=F-h;O(()=>{i.currentX.set(f),i.currentY.set(I),i.deltaX.set(f-i.startX),i.deltaY.set(I-i.startY),G>0&&i.velocity.set({x:(f-g)/G*1e3,y:(I-_)/G*1e3})}),g=f,_=I,h=F,b&&Math.sqrt(i.deltaX.peek()**2+i.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:f,y:I,deltaX:i.deltaX.peek(),deltaY:i.deltaY.peek(),velocity:i.velocity.peek()})}function S(k){if(!i.isDragging.peek())return;b&&(clearTimeout(b),b=null);let m=i.deltaX.peek(),f=i.deltaY.peek(),I=i.velocity.peek();if(Math.sqrt(m**2+f**2)<10&&c&&c({x:i.startX,y:i.startY}),a&&(Math.abs(I.x)>500||Math.abs(I.y)>500)){let G=Math.abs(I.x)>Math.abs(I.y)?I.x>0?"right":"left":I.y>0?"down":"up";a({direction:G,velocity:I})}o&&o({deltaX:m,deltaY:f,velocity:I}),i.isDragging.set(!1)}let E=null;function T(k){if(!s||k.touches.length!==2)return;let m=k.touches[0],f=k.touches[1],I=Math.sqrt((f.clientX-m.clientX)**2+(f.clientY-m.clientY)**2);E===null&&(E=I);let F=I/E,G=(m.clientX+f.clientX)/2,v=(m.clientY+f.clientY)/2;s({scale:F,centerX:G,centerY:v})}function D(){E=null}typeof e=="function"?ct(()=>{let k=ce(e);if(k)return A(k)}):e?.current!==void 0?ct(()=>{let k=e.current;if(k)return A(k)}):e&&A(e);function A(k){return k.addEventListener("mousedown",R),k.addEventListener("touchstart",R,{passive:!p}),window.addEventListener("mousemove",C),window.addEventListener("touchmove",T),window.addEventListener("touchmove",C),window.addEventListener("mouseup",S),window.addEventListener("touchend",S),window.addEventListener("touchend",D),()=>{k.removeEventListener("mousedown",R),k.removeEventListener("touchstart",R),window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",T),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",S),window.removeEventListener("touchend",S),window.removeEventListener("touchend",D)}}return i}function Rr(e){let t=d(e);return{value:()=>t(),setValue:n=>t.set(n),spring(n,r={}){let o=lt(t.peek(),r);o.set(n);let s=V(()=>{t.set(o.current())});return{stop:()=>{o.stop(),s()}}},timing(n,r={}){let o=ut(t.peek(),n,{...r,onUpdate:s=>t.set(s)});return{stop:()=>o.cancel()}},interpolate(n,r){return()=>{let o=t();for(let s=0;s<n.length-1;s++)if(o>=n[s]&&o<=n[s+1]){let a=(o-n[s])/(n[s+1]-n[s]);return r[s]+(r[s+1]-r[s])*a}return o<=n[0]?r[0]:r[r.length-1]}},subscribe:t.subscribe}}function ft(e){return{enter:`${e}-enter`,enterActive:`${e}-enter-active`,enterDone:`${e}-enter-done`,exit:`${e}-exit`,exitActive:`${e}-exit-active`,exitDone:`${e}-exit-done`}}async function Cr(e,t,n="enter",r=300){let o=ft(t);return new Promise(s=>{se(()=>{e.classList.add(o[n]),Z(()=>{e.offsetHeight,se(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{se(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Ar=`
|
|
2
2
|
.what-skeleton {
|
|
3
3
|
background: linear-gradient(
|
|
4
4
|
90deg,
|
|
@@ -50,7 +50,7 @@ import{A as Fn,B as Pn,C as Hn,D as $n,J as Vn,K as Gn,L as Un,M as jn,N as qn,a
|
|
|
50
50
|
0% { transform: translateX(-100%); }
|
|
51
51
|
100% { transform: translateX(100%); }
|
|
52
52
|
}
|
|
53
|
-
`,pt=!1;function le(){if(pt||typeof document>"u")return;pt=!0;let e=document.createElement("style");e.textContent=Ar,document.head.appendChild(e)}function Ge({width:e,height:t,variant:n="shimmer",circle:r=!1,class:o,style:s,count:a=1}){le();let c=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,u=o?`${c} ${o}`:c,p={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...s};return a===1?D("div",{class:u,style:p,"aria-hidden":"true"}):Array.from({length:a},(i,h)=>D("div",{key:h,class:u,style:{...p,marginBottom:h<a-1?"8px":void 0},"aria-hidden":"true"}))}function Ue({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:o="shimmer"}){return le(),D("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,a)=>D("div",{key:a,class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:a===e-1?t:"100%",marginBottom:a<e-1?`${r}px`:void 0}})))}function Ir({size:e=40,variant:t="shimmer"}){return Ge({width:e,height:e,circle:!0,variant:t})}function ht({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return le(),D("div",{class:"what-skeleton-card","aria-hidden":"true"},D("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),D("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),Ue({lines:t,variant:n}))}function Tr({rows:e=5,columns:t=4,variant:n="shimmer"}){return le(),D("div",{class:"what-skeleton-table","aria-hidden":"true"},D("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,o)=>D("div",{key:o,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,o)=>D("div",{key:o,style:{display:"flex",gap:"16px",marginBottom:o<e-1?"12px":void 0}},Array.from({length:t},(s,a)=>D("div",{key:a,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function Dr({type:e="default",height:t,children:n}){return le(),e==="card"?ht({}):e==="text"?Ue({}):n||D("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function Nr(e,t=[]){let n=d(!0),r=d(null),o=d(null);return V(()=>{n.set(!0),o.set(null),Promise.resolve(e()).then(s=>{r.set(s),n.set(!1)}).catch(s=>{o.set(s),n.set(!1)})}),{isLoading:()=>n(),data:()=>r(),error:()=>o(),Skeleton:s=>n()?Ge(s):null}}function Or({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:o="shimmer"}){return le(),D("div",{class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":n,role:"status"},r&&D("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function Lr({size:e=8,color:t="#666"}){le();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return D("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},D("div",{style:{...n,animationDelay:"0s"}}),D("div",{style:{...n,animationDelay:"0.2s"}}),D("div",{style:{...n,animationDelay:"0.4s"}}))}function Mr({size:e=24,color:t="#666",strokeWidth:n=2}){return D("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},D("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),D("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var U=new Map,ee=new Map,te=new Map,z=new Map,gt=200;function ae(e){return Array.isArray(e)?e.map(t=>typeof t=="string"?t:JSON.stringify(t)??String(t)).map(t=>t.replace(/([\\:])/g,"\\$1")).join(":"):e}function Ce(e){return z.set(e,Date.now()),U.has(e)||(U.set(e,d(null)),U.size>gt&&Pr()),U.get(e)}function mt(e){return ee.has(e)||ee.set(e,d(null)),ee.get(e)}function Fr(e){return te.has(e)||te.set(e,d(!1)),te.get(e)}function Pr(){let e=[...z.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(gt*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];X.has(r)&&X.get(r).size>0||(U.delete(r),ee.delete(r),te.delete(r),z.delete(r),Ee.delete(r))}}var X=new Map;function Be(e,t){return X.has(e)||X.set(e,new Set),X.get(e).add(t),()=>{let n=X.get(e);n&&(n.delete(t),n.size===0&&X.delete(e))}}var je=new Set;function We(e){return je.add(e),()=>je.delete(e)}var ue=new Map,Ee=new Map,Ye=new Map;function yt(e){return Ye.get(e)||0}function Hr(e){Ye.set(e,yt(e)+1)}function xe(e){return e&&typeof e.unref=="function"&&e.unref(),e}function K(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function vt(e){let t=W?.();t&&t.effects.push(e)}function wt(e){let t=typeof e=="function"?e:()=>e,n=d(ce(()=>!!t()));return K(()=>{n.set(!!t())}),n}function $r(e,t={}){let{method:n="GET",body:r,headers:o={},transform:s=g=>g,initialData:a=null}=t,c=d(a),u=d(null),p=d(!0),i=null;async function h(){i&&i.abort(),i=new AbortController;let{signal:g}=i;p.set(!0),u.set(null);try{let _=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...o},body:r?JSON.stringify(r):void 0,signal:g});if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);let b=await _.json();g.aborted||c.set(s(b))}catch(_){g.aborted||u.set(_)}finally{g.aborted||p.set(!1)}}return K(()=>(h(),()=>{i&&i.abort()})),{data:()=>c(),error:()=>u(),isLoading:()=>p(),refetch:h,mutate:g=>c.set(g)}}function Vr(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:o=!0,refreshInterval:s=0,dedupingInterval:a=2e3,fallbackData:c,onSuccess:u,onError:p}=n;if(e==null||e===!1){let E=d(c||null),T=d(null);return{data:()=>E(),error:()=>T(),isLoading:()=>!1,isValidating:()=>!1,mutate:N=>E.set(typeof N=="function"?N(E()):N),revalidate:()=>Promise.resolve()}}let i=ae(e),h=Ce(i),g=mt(i),_=Fr(i),b=P(()=>h()??c??null),R=P(()=>{let E=h()==null,T=_();return E&&T}),C=null;async function S({force:E=!1}={}){let T=Date.now(),N=yt(i);if(ue.has(i)){let f=ue.get(i);if(E?f.epoch===N:T-f.timestamp<a)return f.refCount++,f.promise}let A=Ee.get(i);if(!E&&A&&T-A<a&&h.peek()!=null)return h.peek();if(C){let f=ue.get(i);(!f||f.refCount<=1)&&C.abort()}C=new AbortController;let{signal:k}=C;_.set(!0);let m=t(e,{signal:k});ue.set(i,{promise:m,timestamp:T,refCount:1,epoch:N});try{let f=await m;return k.aborted?void 0:(O(()=>{h.set(f),g.set(null)}),z.set(i,Date.now()),Ee.set(i,Date.now()),u&&u(f,e),f)}catch(f){if(k.aborted)return;throw g.set(f),p&&p(f,e),f}finally{k.aborted||_.set(!1);let f=ue.get(i);f&&(f.refCount--,f.refCount<=0&&ue.delete(i))}}return K(()=>{let E=Be(i,()=>S({force:!0}).catch(()=>{})),T=We(()=>{C&&(C.abort(),C=null)});return S().catch(()=>{}),()=>{C&&C.abort(),E(),T()}}),r&&typeof window<"u"&&K(()=>{let E=()=>{document.visibilityState==="visible"&&S().catch(()=>{})};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)}),o&&typeof window<"u"&&K(()=>{let E=()=>S().catch(()=>{});return window.addEventListener("online",E),()=>window.removeEventListener("online",E)}),s>0&&K(()=>{let E=xe(setInterval(()=>{S().catch(()=>{})},s));return()=>clearInterval(E)}),{data:()=>b(),error:()=>g(),isLoading:()=>R(),isValidating:()=>_(),mutate:(E,T=!0)=>{let N=typeof E=="function"?E(h.peek()):E;h.set(N),z.set(i,Date.now()),T&&S().catch(()=>{})},revalidate:S}}function Gr(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:o=0,cacheTime:s=300*1e3,refetchOnWindowFocus:a=!0,refetchInterval:c=!1,retry:u=3,retryDelay:p=v=>Math.min(1e3*2**v,3e4),onSuccess:i,onError:h,onSettled:g,select:_,placeholderData:b}=e,R=ae(t),C=wt(r),S=Ce(R),E=P(()=>{let v=S();return _&&v!=null?_(v):v}),T=mt(R),N=d(S.peek()!=null?"success":C.peek()?"loading":"idle"),A=d("idle"),k=P(()=>{let v=N(),M=S()!=null,ie=T()!=null,J=A()==="fetching";return v==="success"&&!M||v==="error"&&!ie?J?"loading":"idle":v}),m=0,f=null,I=null;async function F({force:v=!1,manual:M=!1}={}){if(!M&&!C.peek())return;let ie=Date.now();if(!v&&S.peek()!=null&&ie-m<o)return S.peek();f&&f.controller.abort();let J=new AbortController;f={controller:J,manual:M};let{signal:j}=J;A.set("fetching"),S.peek()==null&&N.set("loading");let l=0;async function w(){try{let x=await n({queryKey:Array.isArray(t)?t:[t],signal:j});return j.aborted?void 0:(O(()=>{S.set(x),T.set(null),N.set("success"),A.set("idle")}),m=Date.now(),z.set(R,Date.now()),i&&i(x),g&&g(x,null),I&&clearTimeout(I),I=xe(setTimeout(()=>{if(Date.now()-m>=s){let y=X.get(R);(!y||y.size===0)&&(U.delete(R),ee.delete(R),te.delete(R),z.delete(R),Ee.delete(R))}},s)),x)}catch(x){if(j.aborted)return;if(l++,l<u)return await new Promise((y,q)=>{let B=xe(setTimeout(y,p(l)));j.addEventListener("abort",()=>{clearTimeout(B),q(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(y=>{if(y.name!=="AbortError")throw y}),j.aborted?void 0:w();throw O(()=>{T.set(x),N.set("error"),A.set("idle")}),h&&h(x),g&&g(null,x),x}}try{return await w()}finally{f&&f.controller===J&&(f=null)}}function $(){f&&(f.controller.abort(),f=null),O(()=>{N.peek()!=="idle"&&N.set("idle"),A.peek()!=="idle"&&A.set("idle")})}return K(()=>{let v=Be(R,()=>F({force:!0}).catch(()=>{})),M=We($);return C()?F().catch(()=>{}):f?.manual||O(()=>{N.peek()==="loading"&&N.set("idle"),A.peek()!=="idle"&&A.set("idle")}),()=>{f&&!f.manual&&(f.controller.abort(),f=null),v(),M()}}),vt(()=>{f&&(f.controller.abort(),f=null)}),a&&typeof window<"u"&&K(()=>{let v=()=>{document.visibilityState==="visible"&&F().catch(()=>{})};return document.addEventListener("visibilitychange",v),()=>document.removeEventListener("visibilitychange",v)}),c&&K(()=>{let v=xe(setInterval(()=>{F().catch(()=>{})},c));return()=>clearInterval(v)}),{data:()=>E()??b,error:()=>T(),status:()=>k(),fetchStatus:()=>A(),isLoading:()=>k()==="loading",isError:()=>k()==="error",isSuccess:()=>k()==="success",isIdle:()=>k()==="idle",isFetching:()=>A()==="fetching",isEnabled:()=>C(),refetch:()=>F({force:!0,manual:!0})}}function Ur(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:o,initialPageParam:s,enabled:a=!0,select:c,retry:u=3,retryDelay:p=v=>Math.min(1e3*2**v,3e4),onSuccess:i,onError:h,onSettled:g}=e,_=wt(a),b=d([]),R=d([]),C=d(!0),S=d(!1),E=d(!1),T=d(!1),N=d(null),A=d(_.peek()?"loading":"idle"),k=ae(t),m=null;function f(){m&&(m.controller.abort(),m=null),O(()=>{b.set([]),R.set([]),C.set(!0),S.set(!1),E.set(!1),T.set(!1),N.set(null),A.set("idle")})}async function I(v,M="next",{replace:ie=!1,manual:J=!1}={}){m&&m.controller.abort();let j=new AbortController;m={controller:j,manual:J,direction:M};let{signal:l}=j,w=M==="next"?E:T;w.set(!0),b.peek().length===0&&A.set("loading");let x=0;try{for(;;)try{let y=await n({queryKey:Array.isArray(t)?t:[t],pageParam:v,signal:l});return l.aborted?void 0:(O(()=>{ie?(b.set([y]),R.set([v])):M==="next"?(b.set([...b.peek(),y]),R.set([...R.peek(),v])):(b.set([y,...b.peek()]),R.set([v,...R.peek()]));let q=r?.(y,b.peek());if(C.set(q!==void 0),o){let B=o(y,b.peek());S.set(B!==void 0)}N.set(null),A.set("success")}),i&&i(y),g&&g(y,null),y)}catch(y){if(l.aborted)return;if(x++,x<u){if(await new Promise((q,B)=>{let Se=xe(setTimeout(q,p(x)));l.addEventListener("abort",()=>{clearTimeout(Se),B(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(q=>{if(q.name!=="AbortError")throw q}),l.aborted)return;continue}throw O(()=>{N.set(y),A.set("error")}),h&&h(y),g&&g(null,y),y}}finally{let y=m&&m.controller!==j?m:null;(!l.aborted||!y||y.direction!==M)&&w.set(!1),m&&m.controller===j&&(m=null)}}function F({manual:v=!1}={}){return I(s,"next",{replace:!0,manual:v})}let $=P(()=>{let v={pages:b(),pageParams:R()};return c?c(v):v});return K(()=>{let v=Be(k,()=>{_.peek()&&F().catch(()=>{})}),M=We(f);return _()?I(s,"next",{replace:!0}).catch(()=>{}):m?.manual||O(()=>{A.peek()==="loading"&&A.set("idle"),E.peek()&&E.set(!1),T.peek()&&T.set(!1)}),()=>{m&&!m.manual&&(m.controller.abort(),m=null),v(),M()}}),vt(()=>{m&&(m.controller.abort(),m=null)}),{data:()=>$(),error:()=>N(),status:()=>A(),isLoading:()=>A()==="loading",isError:()=>A()==="error",isSuccess:()=>A()==="success",isIdle:()=>A()==="idle",isFetching:()=>E()||T(),isEnabled:()=>_(),hasNextPage:()=>C(),hasPreviousPage:()=>S(),isFetchingNextPage:()=>E(),isFetchingPreviousPage:()=>T(),fetchNextPage:async()=>{let v=b.peek();if(v.length===0)return I(s,"next",{replace:!0,manual:!0});let M=r?.(v[v.length-1],v);if(M!==void 0)return I(M,"next",{manual:!0})},fetchPreviousPage:async()=>{let v=b.peek();if(v.length===0)return I(s,"previous",{replace:!0,manual:!0});let M=o?.(v[0],v);if(M!==void 0)return I(M,"previous",{manual:!0})},refetch:()=>F({manual:!0})}}function qe(){let e=new Set(U.keys());for(let t of X.keys())e.add(t);return e}function jr(e,t={}){let{hard:n=!1,exact:r=!1}=t,o=[];if(typeof e=="function")for(let s of qe())e(s)&&o.push(s);else if(Array.isArray(e)&&!r){let s=ae(e),a=s+":";for(let c of qe())(c===s||typeof c=="string"&&c.startsWith(a))&&o.push(c)}else o.push(ae(e));for(let s of o){Hr(s),n&&U.has(s)&&U.get(s).set(null);let a=X.get(s);if(a)for(let c of a)c()}}function qr(e,t){e=ae(e);let n=Ce(e);return t(e).then(r=>(n.set(r),z.set(e,Date.now()),r))}function Br(e,t){e=ae(e);let n=Ce(e),r=n.peek();n.set(typeof t=="function"?t(r):t),z.set(e,Date.now())}function Wr(e){return e=ae(e),U.has(e)?U.get(e).peek():void 0}function Yr(){O(()=>{for(let e of qe()){U.get(e)?.set(void 0),ee.get(e)?.set(null),te.get(e)?.set(!1);let t=X.get(e);t!==void 0&&t.size>0?z.set(e,Date.now()):(U.delete(e),ee.delete(e),te.delete(e),z.delete(e))}for(let e of je)e()}),Ee.clear(),ue.clear(),Ye.clear()}function Xr(){let e=[];for(let[t,n]of U)e.push({key:t,data:n.peek(),error:ee.has(t)?ee.get(t).peek():null,isValidating:te.has(t)?te.get(t).peek():!1});return e}function xt(e,t){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t)}function zr(e,t){return typeof e!="function"?t:typeof t!="function"?e:function(...r){return e.apply(this,r),t.apply(this,r)}}function Qr(e,t){let n={...e},r=new Map;for(let o in n)Ne(o)&&r.set(o.slice(2).toLowerCase(),o);for(let o in t){let s=t[o];if(!Ne(o)){n[o]=s;continue}let a=r.get(o.slice(2).toLowerCase());if(a===void 0){n[o]=s,r.set(o.slice(2).toLowerCase(),o);continue}n[a]=zr(s,n[a])}return n}function Kr(e={}){let t=W?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=Et(e)),t.hooks[n]}return Et(e)}function Et(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:o}=e,s={},a={},c={},u=d({});function p(l){return s[l]||(s[l]=d(t[l]??"")),s[l]}function i(l){return a[l]||(a[l]=d(null)),a[l]}function h(l){return c[l]||(c[l]=d(!1)),c[l]}let g=d(!1),_=d(!1),b=d(!1),R=d(!1),C=d(0);function S(l=!1){let w={...t};for(let[x,y]of Object.entries(s))w[x]=l?y():y.peek();return w}function E(l=!1){return l?u():u.peek()}function T(l,w){let x=w??null;i(l).set(x),u.set(y=>{if(y[l]===x)return y;if(x==null){if(!Object.prototype.hasOwnProperty.call(y,l))return y;let B={...y};return delete B[l],B}return{...y,[l]:x}})}function N(l={}){let w=l||{};O(()=>{for(let[x,y]of Object.entries(a))Object.prototype.hasOwnProperty.call(w,x)||y.set(null);for(let[x,y]of Object.entries(w))i(x).set(y??null);u.set({...w})})}let A=P(()=>Object.keys(E(!0)).length===0),k=P(()=>{let l={};for(let[w,x]of Object.entries(s))x()!==(t[w]??"")&&(l[w]=!0);return l});async function m(l){if(!o)return!0;R.set(!0);try{let x=(await o(S(!1)))?.errors||{};if(l){let y=x[l]??null;return T(l,y),!y}else return N(x),Object.keys(x).length===0}finally{R.set(!1)}}function f(l,w={}){let x=p(l),y=w.type==="radio",q=w.type==="checkbox",B=y&&w.value!==void 0;function Se(G){if(B)return w.value;if(G)return typeof G.hasAttribute=="function"?G.hasAttribute("value")?G.value:void 0:G.value}let Qe=!1,Ke=!1,Te=G=>{let H=G&&G.target;if(!H){L&&console.warn(`[what] register("${l}") change handler was called without an event. Pass the DOM event through (or call form.setValue() directly). Ignoring.`);return}let he=w.type||H.type,ne;if(he==="radio"){if(ne=Se(H),ne===void 0){L&&!Qe&&(Qe=!0,console.warn(`[what] register("${l}", { type: 'radio' }) cannot tell which value this radio contributes: pass { value } or give the <input> a value attribute. Field left unchanged.`));return}}else he==="checkbox"?ne=H.checked:ne=H.value;I(l,ne),(n==="onChange"||b.peek()&&r==="onChange")&&m(l)},Q={name:l,onBlur:()=>{h(l).set(!0),(n==="onBlur"||b.peek()&&r==="onBlur")&&m(l)},onFocus:()=>{},ref:w.ref};if(y){let G=B?()=>x()===w.value:()=>!1;B&&(Q.value=w.value),Q.checked=G,Q.onchange=Te,Q.ref=H=>{if(xt(w.ref,H),!H||typeof H!="object")return;H._propEffects||(H._propEffects={});let he="checked:property";if(H._propEffects[he])try{H._propEffects[he]()}catch{}H._propEffects[he]=V(()=>{let ne=Se(H);H.checked=ne!==void 0&&x()===ne})}}else q?(Object.defineProperty(Q,"checked",{get(){return!!x()},enumerable:!0}),Q.onchange=Te):(Object.defineProperty(Q,"value",{get(){return x()},enumerable:!0}),Q.oninput=Te,Q.ref=G=>{xt(w.ref,G),L&&!Ke&&G&&G.type==="radio"&&(Ke=!0,console.warn(`[what] register("${l}") was spread onto <input type="radio"> without a type. Radios in a group share one field holding the SELECTED option, so the registration must be told this radio's value: register("${l}", { type: 'radio', value: ... }), or use <Radio name value register />. As written, the registration overwrote the input's own value and the group cannot record a choice.`))});return Q}function I(l,w,x={}){let{shouldValidate:y=!1,shouldDirty:q=!0}=x;p(l).set(w),q&&g.set(!0),y&&m(l)}function F(l){return p(l)()}function $(l,w){T(l,w)}function v(l){T(l,null)}function M(){N({})}function ie(l=t){O(()=>{for(let[w,x]of Object.entries(s))x.set(l[w]??"");for(let w of Object.values(a))w.set(null);u.set({});for(let w of Object.values(c))w.set(!1);g.set(!1),b.set(!1)})}function J(l,w){return async x=>{x&&x.preventDefault(),_.set(!0),b.set(!0),C.set(C.peek()+1);try{await m()?await l(S()):w&&w(E(!1))}finally{_.set(!1)}}}function j(l){return l?P(()=>p(l)()):P(()=>S(!0))}return{register:f,handleSubmit:J,setValue:I,getValue:F,setError:$,clearError:v,clearErrors:M,reset:ie,watch:j,validate:m,formState:{get values(){return S(!0)},get errors(){return E(!0)},error:l=>i(l)(),get touched(){let l={};for(let[w,x]of Object.entries(c))x()&&(l[w]=!0);return l},isDirty:()=>g(),isValid:A,isValidating:()=>R(),isSubmitting:()=>_(),isSubmitted:()=>b(),submitCount:()=>C(),dirtyFields:k}}}function Jr(e){return!e||typeof e!="object"?null:Array.isArray(e.issues)?e.issues:Array.isArray(e.errors)?e.errors:null}function Zr(e){let t=e?.path;if(t==null)return"";if(!Array.isArray(t))return String(t);let n="";for(let r=0;r<t.length;r++){let o=t[r];n+=(r?".":"")+(typeof o=="symbol"?o.toString():String(o))}return n}function eo(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r=Jr(n);if(!r)throw n;let o={};for(let s of r){let a=Zr(s);o[a]||(o[a]={type:s.code??"validation",message:s.message})}return Object.keys(o).length===0&&(o[""]={type:"validation",message:n?.message||"Validation failed"}),{values:{},errors:o}}}}function to(e){return!e||typeof e!="object"?!1:e.name==="ValidationError"||Array.isArray(e.inner)}function no(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){if(!to(n))throw n;let r={},o=Array.isArray(n.inner)&&n.inner.length>0?n.inner:[n];for(let s of o){let a=s.path??"";r[a]||(r[a]={type:s.type??"validation",message:s.message})}return{values:{},errors:r}}}}function ro(e){return async t=>{let n={};for(let[r,o]of Object.entries(e)){let s=t[r];for(let a of o){let c=a(s,t);if(c){n[r]={type:"validation",message:c};break}}}return{values:t,errors:n}}}var oo={required:(e="This field is required")=>t=>{if(t==null||t==="")return e},minLength:(e,t)=>n=>{if(typeof n=="string"&&n.length<e)return t||`Must be at least ${e} characters`},maxLength:(e,t)=>n=>{if(typeof n=="string"&&n.length>e)return t||`Must be at most ${e} characters`},min:(e,t)=>n=>{if(typeof n=="number"&&n<e)return t||`Must be at least ${e}`},max:(e,t)=>n=>{if(typeof n=="number"&&n>e)return t||`Must be at most ${e}`},pattern:(e,t="Invalid format")=>n=>{if(typeof n=="string"&&!e.test(n))return t},email:(e="Invalid email address")=>t=>{if(typeof t=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return e},url:(e="Invalid URL")=>t=>{try{typeof t=="string"&&t&&new URL(t)}catch{return e}},match:(e,t)=>(n,r)=>{if(n!==r[e])return t||`Must match ${e}`},custom:e=>e};function so(e,t={}){let{validate:n,defaultValue:r=""}=t,o=d(r),s=d(null),a=d(!1),c=d(!1);async function u(){if(!n)return!0;let p=await n(o.peek());return s.set(p||null),!p}return{name:e,value:()=>o(),error:()=>s(),isTouched:()=>a(),isDirty:()=>c(),setValue:p=>{o.set(p),c.set(!0)},setError:p=>s.set(p),validate:u,reset:()=>{o.set(r),s.set(null),a.set(!1),c.set(!1)},inputProps:()=>({name:e,value:o(),onInput:p=>{o.set(p.target.value),c.set(!0)},onBlur:()=>{a.set(!0),u()}})}}function ao(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return D("input",{...r,...o,"aria-invalid":n?"true":void 0})}function io(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return D("textarea",{...r,...o,"aria-invalid":n?"true":void 0})}function co(e){let{register:t,error:n,children:r,...o}=e,s=t?t(e.name):{};return D("select",{...o,...s,"aria-invalid":n?"true":void 0},r)}function lo(e){let{register:t,...n}=e,r=t?t(e.name):{};return D("input",{type:"checkbox",...n,...r,checked:r.value})}function uo(e){let{register:t,value:n,...r}=e;if(n===void 0)return L&&console.warn(`[what] <Radio name="${e.name}"> is missing a \`value\` prop. Radios in a group share one field holding the selected option's value, so a valueless radio has nothing to contribute and cannot be checked. Rendering it unregistered.`),D("input",{type:"radio",...r});let o=t?t(e.name,{type:"radio",value:n,ref:r.ref}):{};return D("input",Qr({type:"radio",value:n,...r},o))}function fo({name:e,formState:t,errors:n,render:r}){let o=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return o?r?r({message:o.message,type:o.type}):D("span",{class:"what-error",role:"alert"},o.message):null}var ze={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
|
|
53
|
+
`,pt=!1;function le(){if(pt||typeof document>"u")return;pt=!0;let e=document.createElement("style");e.textContent=Ar,document.head.appendChild(e)}function $e({width:e,height:t,variant:n="shimmer",circle:r=!1,class:o,style:s,count:a=1}){le();let c=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,u=o?`${c} ${o}`:c,p={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...s};return a===1?N("div",{class:u,style:p,"aria-hidden":"true"}):Array.from({length:a},(i,h)=>N("div",{key:h,class:u,style:{...p,marginBottom:h<a-1?"8px":void 0},"aria-hidden":"true"}))}function Ue({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:o="shimmer"}){return le(),N("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,a)=>N("div",{key:a,class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:a===e-1?t:"100%",marginBottom:a<e-1?`${r}px`:void 0}})))}function Ir({size:e=40,variant:t="shimmer"}){return $e({width:e,height:e,circle:!0,variant:t})}function ht({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return le(),N("div",{class:"what-skeleton-card","aria-hidden":"true"},N("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),N("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),Ue({lines:t,variant:n}))}function Tr({rows:e=5,columns:t=4,variant:n="shimmer"}){return le(),N("div",{class:"what-skeleton-table","aria-hidden":"true"},N("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,o)=>N("div",{key:o,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,o)=>N("div",{key:o,style:{display:"flex",gap:"16px",marginBottom:o<e-1?"12px":void 0}},Array.from({length:t},(s,a)=>N("div",{key:a,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function Nr({type:e="default",height:t,children:n}){return le(),e==="card"?ht({}):e==="text"?Ue({}):n||N("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function Dr(e,t=[]){let n=d(!0),r=d(null),o=d(null);return V(()=>{n.set(!0),o.set(null),Promise.resolve(e()).then(s=>{r.set(s),n.set(!1)}).catch(s=>{o.set(s),n.set(!1)})}),{isLoading:()=>n(),data:()=>r(),error:()=>o(),Skeleton:s=>n()?$e(s):null}}function Or({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:o="shimmer"}){return le(),N("div",{class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":n,role:"status"},r&&N("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function Lr({size:e=8,color:t="#666"}){le();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return N("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},N("div",{style:{...n,animationDelay:"0s"}}),N("div",{style:{...n,animationDelay:"0.2s"}}),N("div",{style:{...n,animationDelay:"0.4s"}}))}function Mr({size:e=24,color:t="#666",strokeWidth:n=2}){return N("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},N("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),N("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var U=new Map,ee=new Map,te=new Map,z=new Map,gt=200;function ae(e){return Array.isArray(e)?e.map(t=>typeof t=="string"?t:JSON.stringify(t)??String(t)).map(t=>t.replace(/([\\:])/g,"\\$1")).join(":"):e}function Ce(e){return z.set(e,Date.now()),U.has(e)||(U.set(e,d(null)),U.size>gt&&Pr()),U.get(e)}function mt(e){return ee.has(e)||ee.set(e,d(null)),ee.get(e)}function Fr(e){return te.has(e)||te.set(e,d(!1)),te.get(e)}function Pr(){let e=[...z.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(gt*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];X.has(r)&&X.get(r).size>0||(U.delete(r),ee.delete(r),te.delete(r),z.delete(r),Ee.delete(r))}}var X=new Map;function Be(e,t){return X.has(e)||X.set(e,new Set),X.get(e).add(t),()=>{let n=X.get(e);n&&(n.delete(t),n.size===0&&X.delete(e))}}var je=new Set;function We(e){return je.add(e),()=>je.delete(e)}var ue=new Map,Ee=new Map,Ye=new Map;function yt(e){return Ye.get(e)||0}function Hr(e){Ye.set(e,yt(e)+1)}function xe(e){return e&&typeof e.unref=="function"&&e.unref(),e}function K(e){let t=W?.(),n=V(e);return t&&t.effects.push(n),n}function vt(e){let t=W?.();t&&t.effects.push(e)}function wt(e){let t=typeof e=="function"?e:()=>e,n=d(ce(()=>!!t()));return K(()=>{n.set(!!t())}),n}function Gr(e,t={}){let{method:n="GET",body:r,headers:o={},transform:s=g=>g,initialData:a=null}=t,c=d(a),u=d(null),p=d(!0),i=null;async function h(){i&&i.abort(),i=new AbortController;let{signal:g}=i;p.set(!0),u.set(null);try{let _=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...o},body:r?JSON.stringify(r):void 0,signal:g});if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);let b=await _.json();g.aborted||c.set(s(b))}catch(_){g.aborted||u.set(_)}finally{g.aborted||p.set(!1)}}return K(()=>(h(),()=>{i&&i.abort()})),{data:()=>c(),error:()=>u(),isLoading:()=>p(),refetch:h,mutate:g=>c.set(g)}}function Vr(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:o=!0,refreshInterval:s=0,dedupingInterval:a=2e3,fallbackData:c,onSuccess:u,onError:p}=n;if(e==null||e===!1){let E=d(c||null),T=d(null);return{data:()=>E(),error:()=>T(),isLoading:()=>!1,isValidating:()=>!1,mutate:D=>E.set(typeof D=="function"?D(E()):D),revalidate:()=>Promise.resolve()}}let i=ae(e),h=Ce(i),g=mt(i),_=Fr(i),b=P(()=>h()??c??null),R=P(()=>{let E=h()==null,T=_();return E&&T}),C=null;async function S({force:E=!1}={}){let T=Date.now(),D=yt(i);if(ue.has(i)){let f=ue.get(i);if(E?f.epoch===D:T-f.timestamp<a)return f.refCount++,f.promise}let A=Ee.get(i);if(!E&&A&&T-A<a&&h.peek()!=null)return h.peek();if(C){let f=ue.get(i);(!f||f.refCount<=1)&&C.abort()}C=new AbortController;let{signal:k}=C;_.set(!0);let m=t(e,{signal:k});ue.set(i,{promise:m,timestamp:T,refCount:1,epoch:D});try{let f=await m;return k.aborted?void 0:(O(()=>{h.set(f),g.set(null)}),z.set(i,Date.now()),Ee.set(i,Date.now()),u&&u(f,e),f)}catch(f){if(k.aborted)return;throw g.set(f),p&&p(f,e),f}finally{k.aborted||_.set(!1);let f=ue.get(i);f&&(f.refCount--,f.refCount<=0&&ue.delete(i))}}return K(()=>{let E=Be(i,()=>S({force:!0}).catch(()=>{})),T=We(()=>{C&&(C.abort(),C=null)});return S().catch(()=>{}),()=>{C&&C.abort(),E(),T()}}),r&&typeof window<"u"&&K(()=>{let E=()=>{document.visibilityState==="visible"&&S().catch(()=>{})};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)}),o&&typeof window<"u"&&K(()=>{let E=()=>S().catch(()=>{});return window.addEventListener("online",E),()=>window.removeEventListener("online",E)}),s>0&&K(()=>{let E=xe(setInterval(()=>{S().catch(()=>{})},s));return()=>clearInterval(E)}),{data:()=>b(),error:()=>g(),isLoading:()=>R(),isValidating:()=>_(),mutate:(E,T=!0)=>{let D=typeof E=="function"?E(h.peek()):E;h.set(D),z.set(i,Date.now()),T&&S().catch(()=>{})},revalidate:S}}function $r(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:o=0,cacheTime:s=300*1e3,refetchOnWindowFocus:a=!0,refetchInterval:c=!1,retry:u=3,retryDelay:p=v=>Math.min(1e3*2**v,3e4),onSuccess:i,onError:h,onSettled:g,select:_,placeholderData:b}=e,R=ae(t),C=wt(r),S=Ce(R),E=P(()=>{let v=S();return _&&v!=null?_(v):v}),T=mt(R),D=d(S.peek()!=null?"success":C.peek()?"loading":"idle"),A=d("idle"),k=P(()=>{let v=D(),M=S()!=null,ie=T()!=null,J=A()==="fetching";return v==="success"&&!M||v==="error"&&!ie?J?"loading":"idle":v}),m=0,f=null,I=null;async function F({force:v=!1,manual:M=!1}={}){if(!M&&!C.peek())return;let ie=Date.now();if(!v&&S.peek()!=null&&ie-m<o)return S.peek();f&&f.controller.abort();let J=new AbortController;f={controller:J,manual:M};let{signal:j}=J;A.set("fetching"),S.peek()==null&&D.set("loading");let l=0;async function w(){try{let x=await n({queryKey:Array.isArray(t)?t:[t],signal:j});return j.aborted?void 0:(O(()=>{S.set(x),T.set(null),D.set("success"),A.set("idle")}),m=Date.now(),z.set(R,Date.now()),i&&i(x),g&&g(x,null),I&&clearTimeout(I),I=xe(setTimeout(()=>{if(Date.now()-m>=s){let y=X.get(R);(!y||y.size===0)&&(U.delete(R),ee.delete(R),te.delete(R),z.delete(R),Ee.delete(R))}},s)),x)}catch(x){if(j.aborted)return;if(l++,l<u)return await new Promise((y,q)=>{let B=xe(setTimeout(y,p(l)));j.addEventListener("abort",()=>{clearTimeout(B),q(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(y=>{if(y.name!=="AbortError")throw y}),j.aborted?void 0:w();throw O(()=>{T.set(x),D.set("error"),A.set("idle")}),h&&h(x),g&&g(null,x),x}}try{return await w()}finally{f&&f.controller===J&&(f=null)}}function G(){f&&(f.controller.abort(),f=null),O(()=>{D.peek()!=="idle"&&D.set("idle"),A.peek()!=="idle"&&A.set("idle")})}return K(()=>{let v=Be(R,()=>F({force:!0}).catch(()=>{})),M=We(G);return C()?F().catch(()=>{}):f?.manual||O(()=>{D.peek()==="loading"&&D.set("idle"),A.peek()!=="idle"&&A.set("idle")}),()=>{f&&!f.manual&&(f.controller.abort(),f=null),v(),M()}}),vt(()=>{f&&(f.controller.abort(),f=null)}),a&&typeof window<"u"&&K(()=>{let v=()=>{document.visibilityState==="visible"&&F().catch(()=>{})};return document.addEventListener("visibilitychange",v),()=>document.removeEventListener("visibilitychange",v)}),c&&K(()=>{let v=xe(setInterval(()=>{F().catch(()=>{})},c));return()=>clearInterval(v)}),{data:()=>E()??b,error:()=>T(),status:()=>k(),fetchStatus:()=>A(),isLoading:()=>k()==="loading",isError:()=>k()==="error",isSuccess:()=>k()==="success",isIdle:()=>k()==="idle",isFetching:()=>A()==="fetching",isEnabled:()=>C(),refetch:()=>F({force:!0,manual:!0})}}function Ur(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:o,initialPageParam:s,enabled:a=!0,select:c,retry:u=3,retryDelay:p=v=>Math.min(1e3*2**v,3e4),onSuccess:i,onError:h,onSettled:g}=e,_=wt(a),b=d([]),R=d([]),C=d(!0),S=d(!1),E=d(!1),T=d(!1),D=d(null),A=d(_.peek()?"loading":"idle"),k=ae(t),m=null;function f(){m&&(m.controller.abort(),m=null),O(()=>{b.set([]),R.set([]),C.set(!0),S.set(!1),E.set(!1),T.set(!1),D.set(null),A.set("idle")})}async function I(v,M="next",{replace:ie=!1,manual:J=!1}={}){m&&m.controller.abort();let j=new AbortController;m={controller:j,manual:J,direction:M};let{signal:l}=j,w=M==="next"?E:T;w.set(!0),b.peek().length===0&&A.set("loading");let x=0;try{for(;;)try{let y=await n({queryKey:Array.isArray(t)?t:[t],pageParam:v,signal:l});return l.aborted?void 0:(O(()=>{ie?(b.set([y]),R.set([v])):M==="next"?(b.set([...b.peek(),y]),R.set([...R.peek(),v])):(b.set([y,...b.peek()]),R.set([v,...R.peek()]));let q=r?.(y,b.peek());if(C.set(q!==void 0),o){let B=o(y,b.peek());S.set(B!==void 0)}D.set(null),A.set("success")}),i&&i(y),g&&g(y,null),y)}catch(y){if(l.aborted)return;if(x++,x<u){if(await new Promise((q,B)=>{let Se=xe(setTimeout(q,p(x)));l.addEventListener("abort",()=>{clearTimeout(Se),B(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(q=>{if(q.name!=="AbortError")throw q}),l.aborted)return;continue}throw O(()=>{D.set(y),A.set("error")}),h&&h(y),g&&g(null,y),y}}finally{let y=m&&m.controller!==j?m:null;(!l.aborted||!y||y.direction!==M)&&w.set(!1),m&&m.controller===j&&(m=null)}}function F({manual:v=!1}={}){return I(s,"next",{replace:!0,manual:v})}let G=P(()=>{let v={pages:b(),pageParams:R()};return c?c(v):v});return K(()=>{let v=Be(k,()=>{_.peek()&&F().catch(()=>{})}),M=We(f);return _()?I(s,"next",{replace:!0}).catch(()=>{}):m?.manual||O(()=>{A.peek()==="loading"&&A.set("idle"),E.peek()&&E.set(!1),T.peek()&&T.set(!1)}),()=>{m&&!m.manual&&(m.controller.abort(),m=null),v(),M()}}),vt(()=>{m&&(m.controller.abort(),m=null)}),{data:()=>G(),error:()=>D(),status:()=>A(),isLoading:()=>A()==="loading",isError:()=>A()==="error",isSuccess:()=>A()==="success",isIdle:()=>A()==="idle",isFetching:()=>E()||T(),isEnabled:()=>_(),hasNextPage:()=>C(),hasPreviousPage:()=>S(),isFetchingNextPage:()=>E(),isFetchingPreviousPage:()=>T(),fetchNextPage:async()=>{let v=b.peek();if(v.length===0)return I(s,"next",{replace:!0,manual:!0});let M=r?.(v[v.length-1],v);if(M!==void 0)return I(M,"next",{manual:!0})},fetchPreviousPage:async()=>{let v=b.peek();if(v.length===0)return I(s,"previous",{replace:!0,manual:!0});let M=o?.(v[0],v);if(M!==void 0)return I(M,"previous",{manual:!0})},refetch:()=>F({manual:!0})}}function qe(){let e=new Set(U.keys());for(let t of X.keys())e.add(t);return e}function jr(e,t={}){let{hard:n=!1,exact:r=!1}=t,o=[];if(typeof e=="function")for(let s of qe())e(s)&&o.push(s);else if(Array.isArray(e)&&!r){let s=ae(e),a=s+":";for(let c of qe())(c===s||typeof c=="string"&&c.startsWith(a))&&o.push(c)}else o.push(ae(e));for(let s of o){Hr(s),n&&U.has(s)&&U.get(s).set(null);let a=X.get(s);if(a)for(let c of a)c()}}function qr(e,t){e=ae(e);let n=Ce(e);return t(e).then(r=>(n.set(r),z.set(e,Date.now()),r))}function Br(e,t){e=ae(e);let n=Ce(e),r=n.peek();n.set(typeof t=="function"?t(r):t),z.set(e,Date.now())}function Wr(e){return e=ae(e),U.has(e)?U.get(e).peek():void 0}function Yr(){O(()=>{for(let e of qe()){U.get(e)?.set(void 0),ee.get(e)?.set(null),te.get(e)?.set(!1);let t=X.get(e);t!==void 0&&t.size>0?z.set(e,Date.now()):(U.delete(e),ee.delete(e),te.delete(e),z.delete(e))}for(let e of je)e()}),Ee.clear(),ue.clear(),Ye.clear()}function Xr(){let e=[];for(let[t,n]of U)e.push({key:t,data:n.peek(),error:ee.has(t)?ee.get(t).peek():null,isValidating:te.has(t)?te.get(t).peek():!1});return e}function xt(e,t){typeof e=="function"?e(t):e&&typeof e=="object"&&(e.current=t)}function zr(e,t){return typeof e!="function"?t:typeof t!="function"?e:function(...r){return e.apply(this,r),t.apply(this,r)}}function Qr(e,t){let n={...e},r=new Map;for(let o in n)De(o)&&r.set(o.slice(2).toLowerCase(),o);for(let o in t){let s=t[o];if(!De(o)){n[o]=s;continue}let a=r.get(o.slice(2).toLowerCase());if(a===void 0){n[o]=s,r.set(o.slice(2).toLowerCase(),o);continue}n[a]=zr(s,n[a])}return n}function Kr(e={}){let t=W?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=Et(e)),t.hooks[n]}return Et(e)}function Et(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:o}=e,s={},a={},c={},u=d({});function p(l){return s[l]||(s[l]=d(t[l]??"")),s[l]}function i(l){return a[l]||(a[l]=d(null)),a[l]}function h(l){return c[l]||(c[l]=d(!1)),c[l]}let g=d(!1),_=d(!1),b=d(!1),R=d(!1),C=d(0);function S(l=!1){let w={...t};for(let[x,y]of Object.entries(s))w[x]=l?y():y.peek();return w}function E(l=!1){return l?u():u.peek()}function T(l,w){let x=w??null;i(l).set(x),u.set(y=>{if(y[l]===x)return y;if(x==null){if(!Object.prototype.hasOwnProperty.call(y,l))return y;let B={...y};return delete B[l],B}return{...y,[l]:x}})}function D(l={}){let w=l||{};O(()=>{for(let[x,y]of Object.entries(a))Object.prototype.hasOwnProperty.call(w,x)||y.set(null);for(let[x,y]of Object.entries(w))i(x).set(y??null);u.set({...w})})}let A=P(()=>Object.keys(E(!0)).length===0),k=P(()=>{let l={};for(let[w,x]of Object.entries(s))x()!==(t[w]??"")&&(l[w]=!0);return l});async function m(l){if(!o)return!0;R.set(!0);try{let x=(await o(S(!1)))?.errors||{};if(l){let y=x[l]??null;return T(l,y),!y}else return D(x),Object.keys(x).length===0}finally{R.set(!1)}}function f(l,w={}){let x=p(l),y=w.type==="radio",q=w.type==="checkbox",B=y&&w.value!==void 0;function Se($){if(B)return w.value;if($)return typeof $.hasAttribute=="function"?$.hasAttribute("value")?$.value:void 0:$.value}let Qe=!1,Ke=!1,Te=$=>{let H=$&&$.target;if(!H){L&&console.warn(`[what] register("${l}") change handler was called without an event. Pass the DOM event through (or call form.setValue() directly). Ignoring.`);return}let he=w.type||H.type,ne;if(he==="radio"){if(ne=Se(H),ne===void 0){L&&!Qe&&(Qe=!0,console.warn(`[what] register("${l}", { type: 'radio' }) cannot tell which value this radio contributes: pass { value } or give the <input> a value attribute. Field left unchanged.`));return}}else he==="checkbox"?ne=H.checked:ne=H.value;I(l,ne),(n==="onChange"||b.peek()&&r==="onChange")&&m(l)},Q={name:l,onBlur:()=>{h(l).set(!0),(n==="onBlur"||b.peek()&&r==="onBlur")&&m(l)},onFocus:()=>{},ref:w.ref};if(y){let $=B?()=>x()===w.value:()=>!1;B&&(Q.value=w.value),Q.checked=$,Q.onchange=Te,Q.ref=H=>{if(xt(w.ref,H),!H||typeof H!="object")return;H._propEffects||(H._propEffects={});let he="checked:property";if(H._propEffects[he])try{H._propEffects[he]()}catch{}H._propEffects[he]=V(()=>{let ne=Se(H);H.checked=ne!==void 0&&x()===ne})}}else q?(Object.defineProperty(Q,"checked",{get(){return!!x()},enumerable:!0}),Q.onchange=Te):(Object.defineProperty(Q,"value",{get(){return x()},enumerable:!0}),Q.oninput=Te,Q.ref=$=>{xt(w.ref,$),L&&!Ke&&$&&$.type==="radio"&&(Ke=!0,console.warn(`[what] register("${l}") was spread onto <input type="radio"> without a type. Radios in a group share one field holding the SELECTED option, so the registration must be told this radio's value: register("${l}", { type: 'radio', value: ... }), or use <Radio name value register />. As written, the registration overwrote the input's own value and the group cannot record a choice.`))});return Q}function I(l,w,x={}){let{shouldValidate:y=!1,shouldDirty:q=!0}=x;p(l).set(w),q&&g.set(!0),y&&m(l)}function F(l){return p(l)()}function G(l,w){T(l,w)}function v(l){T(l,null)}function M(){D({})}function ie(l=t){O(()=>{for(let[w,x]of Object.entries(s))x.set(l[w]??"");for(let w of Object.values(a))w.set(null);u.set({});for(let w of Object.values(c))w.set(!1);g.set(!1),b.set(!1)})}function J(l,w){return async x=>{x&&x.preventDefault(),_.set(!0),b.set(!0),C.set(C.peek()+1);try{await m()?await l(S()):w&&w(E(!1))}finally{_.set(!1)}}}function j(l){return l?P(()=>p(l)()):P(()=>S(!0))}return{register:f,handleSubmit:J,setValue:I,getValue:F,setError:G,clearError:v,clearErrors:M,reset:ie,watch:j,validate:m,formState:{get values(){return S(!0)},get errors(){return E(!0)},error:l=>i(l)(),get touched(){let l={};for(let[w,x]of Object.entries(c))x()&&(l[w]=!0);return l},isDirty:()=>g(),isValid:A,isValidating:()=>R(),isSubmitting:()=>_(),isSubmitted:()=>b(),submitCount:()=>C(),dirtyFields:k}}}function Jr(e){return!e||typeof e!="object"?null:Array.isArray(e.issues)?e.issues:Array.isArray(e.errors)?e.errors:null}function Zr(e){let t=e?.path;if(t==null)return"";if(!Array.isArray(t))return String(t);let n="";for(let r=0;r<t.length;r++){let o=t[r];n+=(r?".":"")+(typeof o=="symbol"?o.toString():String(o))}return n}function eo(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r=Jr(n);if(!r)throw n;let o={};for(let s of r){let a=Zr(s);o[a]||(o[a]={type:s.code??"validation",message:s.message})}return Object.keys(o).length===0&&(o[""]={type:"validation",message:n?.message||"Validation failed"}),{values:{},errors:o}}}}function to(e){return!e||typeof e!="object"?!1:e.name==="ValidationError"||Array.isArray(e.inner)}function no(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){if(!to(n))throw n;let r={},o=Array.isArray(n.inner)&&n.inner.length>0?n.inner:[n];for(let s of o){let a=s.path??"";r[a]||(r[a]={type:s.type??"validation",message:s.message})}return{values:{},errors:r}}}}function ro(e){return async t=>{let n={};for(let[r,o]of Object.entries(e)){let s=t[r];for(let a of o){let c=a(s,t);if(c){n[r]={type:"validation",message:c};break}}}return{values:t,errors:n}}}var oo={required:(e="This field is required")=>t=>{if(t==null||t==="")return e},minLength:(e,t)=>n=>{if(typeof n=="string"&&n.length<e)return t||`Must be at least ${e} characters`},maxLength:(e,t)=>n=>{if(typeof n=="string"&&n.length>e)return t||`Must be at most ${e} characters`},min:(e,t)=>n=>{if(typeof n=="number"&&n<e)return t||`Must be at least ${e}`},max:(e,t)=>n=>{if(typeof n=="number"&&n>e)return t||`Must be at most ${e}`},pattern:(e,t="Invalid format")=>n=>{if(typeof n=="string"&&!e.test(n))return t},email:(e="Invalid email address")=>t=>{if(typeof t=="string"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return e},url:(e="Invalid URL")=>t=>{try{typeof t=="string"&&t&&new URL(t)}catch{return e}},match:(e,t)=>(n,r)=>{if(n!==r[e])return t||`Must match ${e}`},custom:e=>e};function so(e,t={}){let{validate:n,defaultValue:r=""}=t,o=d(r),s=d(null),a=d(!1),c=d(!1);async function u(){if(!n)return!0;let p=await n(o.peek());return s.set(p||null),!p}return{name:e,value:()=>o(),error:()=>s(),isTouched:()=>a(),isDirty:()=>c(),setValue:p=>{o.set(p),c.set(!0)},setError:p=>s.set(p),validate:u,reset:()=>{o.set(r),s.set(null),a.set(!1),c.set(!1)},inputProps:()=>({name:e,value:o(),onInput:p=>{o.set(p.target.value),c.set(!0)},onBlur:()=>{a.set(!0),u()}})}}function ao(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return N("input",{...r,...o,"aria-invalid":n?"true":void 0})}function io(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return N("textarea",{...r,...o,"aria-invalid":n?"true":void 0})}function co(e){let{register:t,error:n,children:r,...o}=e,s=t?t(e.name):{};return N("select",{...o,...s,"aria-invalid":n?"true":void 0},r)}function lo(e){let{register:t,...n}=e,r=t?t(e.name):{};return N("input",{type:"checkbox",...n,...r,checked:r.value})}function uo(e){let{register:t,value:n,...r}=e;if(n===void 0)return L&&console.warn(`[what] <Radio name="${e.name}"> is missing a \`value\` prop. Radios in a group share one field holding the selected option's value, so a valueless radio has nothing to contribute and cannot be checked. Rendering it unregistered.`),N("input",{type:"radio",...r});let o=t?t(e.name,{type:"radio",value:n,ref:r.ref}):{};return N("input",Qr({type:"radio",value:n,...r},o))}function fo({name:e,formState:t,errors:n,render:r}){let o=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return o?r?r({message:o.message,type:o.type}):N("span",{class:"what-error",role:"alert"},o.message):null}var ze={INFINITE_EFFECT:{code:"ERR_INFINITE_EFFECT",severity:"error",template:'Effect "{{effectName}}" exceeded 25 flush iterations \u2014 likely an infinite loop.',suggestion:"An effect is writing to a signal it also reads, creating a cycle. Use untrack() to read the signal without subscribing, or restructure so the write and read are in separate effects.",codeExample:`// Bad \u2014 reads and writes count, creating a cycle:
|
|
54
54
|
effect(() => { count(count() + 1); });
|
|
55
55
|
|
|
56
56
|
// Good \u2014 use untrack() so the read doesn't subscribe:
|
|
@@ -130,7 +130,14 @@ export const save = action(async (data) => {
|
|
|
130
130
|
{ path: '/docs/:slug*', mode: 'static' }
|
|
131
131
|
|
|
132
132
|
// Good \u2014 constrain the param, or precompute the exact paths:
|
|
133
|
-
{ path: '/docs/:slug', mode: 'static', paths: () => slugs.map(slug => ({ slug })) }`},
|
|
133
|
+
{ path: '/docs/:slug', mode: 'static', paths: () => slugs.map(slug => ({ slug })) }`},INVALID_HTML_NESTING:{code:"ERR_INVALID_HTML_NESTING",severity:"error",template:"<{{parent}}> cannot contain <{{child}}>: the HTML parser closed the outer tag early, so the rendered tree does not match your JSX.",suggestion:"The compiler turns each element into an HTML template string, and the browser parses it under real HTML rules. Some nestings are not expressible: <p> may only hold phrasing content, <a> may not hold another <a>, and a table section may not hold arbitrary elements. The parser silently reorders them, which leaves compiled output walking a tree that no longer matches your source. Change the outer tag (usually <p> to <div>) or move the child out.",codeExample:`// Bad \u2014 the parser closes <p> before <div>, producing four sibling nodes:
|
|
134
|
+
<p>Intro<div>{body()}</div>Outro</p>
|
|
135
|
+
|
|
136
|
+
// Good \u2014 a block container can hold block content:
|
|
137
|
+
<div class="prose">Intro<div>{body()}</div>Outro</div>
|
|
138
|
+
|
|
139
|
+
// Good \u2014 or keep the paragraph and use phrasing content:
|
|
140
|
+
<p>Intro<span>{body()}</span>Outro</p>`},INVALID_SSR_TAG:{code:"ERR_INVALID_SSR_TAG",severity:"error",template:"[what-server] Invalid tag name in SSR: {{tag}}.",suggestion:"renderToString reached a vnode whose tag is neither a string nor a component function. This is almost always a component that returned a raw object, or a value interpolated where an element was expected.",codeExample:`// Bad \u2014 returns a plain object, not a vnode:
|
|
134
141
|
function Row() { return { name: 'a' }; }
|
|
135
142
|
|
|
136
143
|
// Good \u2014 return elements, and interpolate values as children:
|
|
@@ -199,4 +206,4 @@ createWhatError('MISSING_KEYS');
|
|
|
199
206
|
createWhatError('MISSING_KEY', { component: 'TodoList' });`},UNKNOWN_TOOL:{code:"ERR_UNKNOWN_TOOL",severity:"error",template:"Unknown tool: {{name}}.",suggestion:"The MCP client called a tool this server does not expose. Call tools/list to enumerate what is available; a stale client cache is the usual cause.",codeExample:`// List what the server actually exposes:
|
|
200
207
|
{ "method": "tools/list" }`}},Xe=null;function _t(e){return Xe===null&&(Xe=new Map(Object.values(ze).map(t=>[t.code,t]))),Xe.get(e)}var pe=class extends Error{constructor({code:t,message:n,suggestion:r,codeExample:o,file:s,line:a,component:c,signal:u,effect:p}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.codeExample=o,this.file=s,this.line=a,this.component=c,this.signal=u,this.effect=p}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,codeExample:this.codeExample,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function fe(e,t={}){let n=typeof e=="string"?ze[e]:e;if(!n)return new pe({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[o,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(s));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new pe({code:n.code,message:r,suggestion:n.suggestion,codeExample:n.codeExample,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var de=[],bt=200;function Ae(e){L&&(de.push({...e.toJSON(),timestamp:Date.now()}),de.length>bt&&(de=de.slice(-bt)))}function Ie(e){return e?de.filter(t=>t.timestamp>e):de.slice()}function po(){de=[]}function ho(e,t={}){let n=e?.message||String(e);if(e&&typeof e.code=="string"){let r=_t(e.code);if(r)return new pe({code:r.code,message:n,suggestion:r.suggestion,codeExample:r.codeExample,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}return n.includes("infinite effect loop")||n.includes("25 iterations")?fe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?fe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?fe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new pe({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var be={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function go(e){Object.assign(be,e)}function mo(){return{...be}}function yo(e,t){return!L||!be.signalReadDetection||(e.toString=function(){let n=fe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
201
208
|
Suggestion: ${n.suggestion}`),Ae(n),String(e())},e.valueOf=function(){let n=fe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
202
|
-
Suggestion: ${n.suggestion}`),Ae(n),e()}),e}function vo(e){if(!L||!be.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${wo(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function wo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var St=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function xo(e){if(!L||!be.importValidation)return[];let t=[];for(let n of e)St.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Eo(n)}?`});return t}function Eo(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of St){let s=bo(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function bo(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var _o="0.13.
|
|
209
|
+
Suggestion: ${n.suggestion}`),Ae(n),e()}),e}function vo(e){if(!L||!be.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${wo(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function wo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var St=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function xo(e){if(!L||!be.importValidation)return[];let t=[];for(let n of e)St.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Eo(n)}?`});return t}function Eo(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of St){let s=bo(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function bo(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var _o="0.13.1",_e=[];function So(e){L&&_e.push(e)}function ko(e){if(!L)return;let t=_e.indexOf(e);t>=0&&_e.splice(t,1)}function kt(){return _e.slice()}var ve=[];function Ro(e){L&&ve.push(e)}function Co(e){if(!L)return;let t=ve.indexOf(e);t>=0&&ve.splice(t,1)}function Rt(){return ve.slice()}function Ct(){let e=Ie(),t=e.filter(u=>Date.now()-u.timestamp<6e4),r=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,o=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ve.filter(u=>!!(u._subs&&u._subs.size===0)).length,a=ve.length,c=a>1e4?"high":a>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:c,recentErrorCount:t.length,totalSignals:a,totalComponents:_e.length}}function Ao(){L&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:_o,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>kt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>Rt().map((e,t)=>({id:t,name:e._debugName||`signal_${t}`,value:typeof e=="function"?e.peek?.():void 0,subscriberCount:e._subs?e._subs.size:0})),errors:()=>Ie(),health:()=>Ct(),api:{reactive:["signal","computed","effect","batch","untrack","flushSync","createRoot","memo"],hooks:["useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","onMount","onCleanup"],components:["Show","For","Switch","Match","Suspense","ErrorBoundary","lazy","Island"],data:["useSWR","useQuery","useFetch","useInfiniteQuery"],store:["createStore","derived","atom"]}}))}export{lo as Checkbox,ze as ERROR_CODES,qt as ErrorBoundary,fo as ErrorMessage,hn as FocusTrap,Wt as For,Ft as Fragment,cr as Head,ao as Input,zt as Island,Nr as IslandSkeleton,An as Keys,_n as LiveRegion,Lr as LoadingDots,Xt as Match,Or as Placeholder,rn as Portal,uo as Radio,co as Select,Bt as Show,$e as Skeleton,Ir as SkeletonAvatar,ht as SkeletonCard,Tr as SkeletonTable,Ue as SkeletonText,yn as SkipLink,Mr as Spinner,jt as Suspense,Yt as Switch,io as Textarea,bn as VisuallyHidden,pe as WhatError,Dn as _$createComponent,On as _$template,Mt as __drainPreinstallBuffer,Xr as __getCacheSnapshot,Ht as __installServerContextStorage,Oe as __readHydrationData,Bn as __resetHydrationData,At as __setDevToolsHooks,ln as _beginComponentSSR,un as _endComponentSSR,an as _isAriaAttr,Pn as _mapArrayToArray,Nn as _setTextInsertHook,Je as _template,gn as announce,mn as announceAssertive,ir as atom,O as batch,dr as beginHeadCollection,vo as checkComponentName,Un as classList,ho as classifyError,Yr as clearCache,po as clearCollectedErrors,mr as clearHead,Kt as cls,Ae as collectError,P as computed,go as configureGuardrails,er as createContext,or as createResource,Ot as createRoot,ar as createStore,ft as createTransitionClasses,fe as createWhatError,Cr as cssTransition,Zt as debounce,Vn as delegateEvents,nt as derived,Qt as each,dt as easings,V as effect,fr as endHeadCollection,at as flushScheduler,Tt as flushSync,Rt as getActiveSignals,Ie as getCollectedErrors,_t as getErrorDefinition,mo as getGuardrailConfig,Ct as getHealth,Le as getLoaderData,kt as getMountedComponents,Nt as getOwner,Wr as getQueryData,Me as getResource,ge as getServerContext,N as h,Pt as html,qn as hydrate,Mn as insert,Ao as installAgentContext,yo as installSignalReadGuardrail,jr as invalidateQueries,jn as isHydrating,Ut as lazy,Fn as mapArray,yr as measure,$t as memo,cn as mount,vr as mutate,xr as nextFrame,$n as on,rr as onCleanup,br as onIntersect,In as onKey,Tn as onKeys,nr as onMount,Er as onResize,Lt as onRootCleanup,qr as prefetchQuery,it as raf,So as registerComponent,Ro as registerSignal,oo as rules,Dt as runWithOwner,Vt as runWithServerContext,Z as scheduleRead,se as scheduleWrite,Gn as setProp,Br as setQueryData,Gt as setServerContext,d as signal,It as signalMemo,ro as simpleResolver,_r as smoothScrollTo,Hn as spread,lt as spring,sr as storeComputed,Jt as style,Ln as svgTemplate,Je as template,en as throttle,sn as transition,ut as tween,ko as unregisterComponent,Co as unregisterSignal,ce as untrack,Rr as useAnimatedValue,xn as useAriaChecked,vn as useAriaExpanded,wn as useAriaSelected,Jn as useCallback,on as useClickOutside,zn as useComputed,Ze as useContext,Rn as useDescribedBy,Qn as useEffect,Gr as useFetch,so as useField,dn as useFocus,fn as useFocusRestore,pn as useFocusTrap,Kr as useForm,kr as useGesture,Sn as useId,kn as useIds,Ur as useInfiniteQuery,Cn as useLabelledBy,Wn as useLoaderData,nn as useLocalStorage,tn as useMediaQuery,Kn as useMemo,$r as useQuery,tr as useReducer,Zn as useRef,En as useRovingTabIndex,Vr as useSWR,wr as useScheduledEffect,Xn as useSignal,Dr as useSkeleton,Yn as useState,Sr as useTransition,xo as validateImports,no as yupResolver,eo as zodResolver};
|
package/dist/render.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as j,B as k,C as l,D as m,E as n,F as o,G as p,H as q,I as r,J as s,K as t,L as u,M as v,N as w,u as d,v as e,w as f,x as g,y as h,z as i}from"./chunk-
|
|
1
|
+
import{A as j,B as k,C as l,D as m,E as n,F as o,G as p,H as q,I as r,J as s,K as t,L as u,M as v,N as w,u as d,v as e,w as f,x as g,y as h,z as i}from"./chunk-DZTPU2YD.min.js";import{f as a,h as b,j as c}from"./chunk-OKM3GKVP.min.js";import"./chunk-O3SKPRTY.min.js";export{e as _$createComponent,f as _$template,k as _mapArrayToArray,d as _setTextInsertHook,g as _template,u as classList,s as delegateEvents,a as effect,w as hydrate,i as insert,v as isHydrating,j as mapArray,b as memo,t as on,p as setAttr,r as setChecked,n as setClass,m as setProp,o as setStyle,q as setValue,l as spread,h as svgTemplate,g as template,c as untrack};
|
package/package.json
CHANGED
package/src/agent-context.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getCollectedErrors } from './errors.js';
|
|
|
8
8
|
// --- Version ---
|
|
9
9
|
// Keep in sync with packages/core/package.json (checked by
|
|
10
10
|
// core/test/guardrails.test.js so it can't silently go stale again).
|
|
11
|
-
const VERSION = '0.13.
|
|
11
|
+
const VERSION = '0.13.1';
|
|
12
12
|
|
|
13
13
|
// --- Component Registry ---
|
|
14
14
|
// Tracks mounted components for agent inspection.
|
package/src/errors.js
CHANGED
|
@@ -218,6 +218,21 @@ export const save = action(async (data) => {
|
|
|
218
218
|
{ path: '/docs/:slug', mode: 'static', paths: () => slugs.map(slug => ({ slug })) }`,
|
|
219
219
|
},
|
|
220
220
|
|
|
221
|
+
INVALID_HTML_NESTING: {
|
|
222
|
+
code: 'ERR_INVALID_HTML_NESTING',
|
|
223
|
+
severity: 'error',
|
|
224
|
+
template: '<{{parent}}> cannot contain <{{child}}>: the HTML parser closed the outer tag early, so the rendered tree does not match your JSX.',
|
|
225
|
+
suggestion: 'The compiler turns each element into an HTML template string, and the browser parses it under real HTML rules. Some nestings are not expressible: <p> may only hold phrasing content, <a> may not hold another <a>, and a table section may not hold arbitrary elements. The parser silently reorders them, which leaves compiled output walking a tree that no longer matches your source. Change the outer tag (usually <p> to <div>) or move the child out.',
|
|
226
|
+
codeExample: `// Bad — the parser closes <p> before <div>, producing four sibling nodes:
|
|
227
|
+
<p>Intro<div>{body()}</div>Outro</p>
|
|
228
|
+
|
|
229
|
+
// Good — a block container can hold block content:
|
|
230
|
+
<div class="prose">Intro<div>{body()}</div>Outro</div>
|
|
231
|
+
|
|
232
|
+
// Good — or keep the paragraph and use phrasing content:
|
|
233
|
+
<p>Intro<span>{body()}</span>Outro</p>`,
|
|
234
|
+
},
|
|
235
|
+
|
|
221
236
|
INVALID_SSR_TAG: {
|
|
222
237
|
code: 'ERR_INVALID_SSR_TAG',
|
|
223
238
|
severity: 'error',
|
package/src/render.js
CHANGED
|
@@ -119,6 +119,29 @@ function _$templateImpl(html) {
|
|
|
119
119
|
|
|
120
120
|
const t = document.createElement('template');
|
|
121
121
|
t.innerHTML = trimmed;
|
|
122
|
+
|
|
123
|
+
// The compiler emits exactly one root element per template. If the parser
|
|
124
|
+
// handed back more than one top-level node it restructured the markup, which
|
|
125
|
+
// it does silently for invalid nesting: `<p>a<div>b</div>c</p>` becomes
|
|
126
|
+
// `<p>a</p><div>b</div>c<p></p>`, four nodes instead of one. Compiled output
|
|
127
|
+
// then walks firstChild/nextSibling over a tree that no longer matches the
|
|
128
|
+
// source and dies on `Cannot read properties of null (reading 'firstChild')`,
|
|
129
|
+
// pointing at generated code with no hint of the cause. Say what happened
|
|
130
|
+
// instead. Dev-only: in production the markup is already known-good, and this
|
|
131
|
+
// is on the hot path.
|
|
132
|
+
if (__DEV__ && t.content.childNodes.length !== 1) {
|
|
133
|
+
const inner = /** @type {Element | null} */ (
|
|
134
|
+
[...t.content.childNodes].find((n, i) => i > 0 && n.nodeType === 1)
|
|
135
|
+
);
|
|
136
|
+
throw Object.assign(
|
|
137
|
+
new Error(
|
|
138
|
+
`[what] <${tag}> cannot contain <${inner ? inner.nodeName.toLowerCase() : 'that element'}>: ` +
|
|
139
|
+
'the HTML parser closed the outer tag early, so the rendered tree does not match your JSX.',
|
|
140
|
+
),
|
|
141
|
+
{ code: 'ERR_INVALID_HTML_NESTING' },
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
122
145
|
return () => /** @type {Node} */ (t.content.firstChild).cloneNode(true);
|
|
123
146
|
}
|
|
124
147
|
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{E as Tt,Q as W,R as St,T as Lt,U as it,V as I,X as G,Y as Bt,Z as Q,a as z,aa as Nt,ba as Mt,ca as ht,d as O,f as j,j as At,n as Y,r as wt,z as Et}from"./chunk-OKM3GKVP.min.js";import{a as J}from"./chunk-O3SKPRTY.min.js";var Ht=O(null);typeof document<"u"&&document.addEventListener("focusin",t=>{Ht.set(t.target)});function Te(){return{current:()=>Ht(),focus:t=>t?.focus(),blur:()=>document.activeElement?.blur()}}function Se(){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 Qt(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 g(f){if(f.key!=="Tab")return;let a=Dt(o),c=a[0],p=a[a.length-1];f.shiftKey?document.activeElement===c&&(f.preventDefault(),p.focus()):document.activeElement===p&&(f.preventDefault(),c.focus())}return o.addEventListener("keydown",g),()=>{o.removeEventListener("keydown",g)}}function r(){e&&typeof e.focus=="function"&&e.focus()}return{activate:n,deactivate:r}}function 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 Le({children:t,active:e=!0}){let n={current:null},r=O(0),o=Qt(n),i=null,g=c=>{n.current=c,r.set(p=>p+1)},f=j(()=>{if(r(),i&&(i(),i=null,o.deactivate()),e&&n.current)return i=o.activate(),()=>{i?.(),i=null,o.deactivate()}}),a=Bt?.();return a&&(a._cleanupCallbacks=a._cleanupCallbacks||[],a._cleanupCallbacks.push(()=>{f(),i?.(),i=null,o.deactivate()})),J("div",{ref:g},t)}var U=null,pt=0;function vt(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.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(U)),U)}function Ft(t,e={}){let{priority:n="polite",timeout:r=1e3}=e,o=vt();if(!o)return;o.setAttribute("aria-live",n);let i=++pt;o.textContent="",requestAnimationFrame(()=>{pt===i&&(o.textContent=t)}),setTimeout(()=>{pt===i&&(o.textContent="")},r)}function Be(t){return Ft(t,{priority:"assertive"})}function Ne({href:t="#main",children:e="Skip to content"}){return J("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 gt(t){return t?"true":"false"}function Me(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":()=>gt(e()),onClick:()=>e.set(!e.peek())}),panelProps:()=>({hidden:()=>!e()})}}function De(t=null){let e=O(t);return{selected:()=>e(),select:n=>e.set(n),isSelected:n=>e()===n,itemProps:n=>({"aria-selected":()=>gt(e()===n),onClick:()=>e.set(n)})}}function He(t=!1){let e=O(t);return{checked:()=>e(),toggle:()=>e.set(!e.peek()),set:n=>e.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":()=>gt(e()),tabIndex:0,onClick:()=>e.set(!e.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.set(!e.peek()))}})}}function Pe(t,e={}){let n=typeof t=="function"?t:()=>t,r=O(0),o=e?.role||null,i=[],g=[],f=[];function a(h){let s=g[h];return s||(s={get current(){return i[h]||null},set current(d){i[h]=d||null;let x=f[h];typeof x=="function"?x(d):x&&typeof x=="object"&&(x.current=d)}},g[h]=s),s}function c(h){let s=i[h];return s?s.isConnected===!1?null:s:null}function p(h){let s=c(h);return!s||typeof s.focus!="function"?null:((typeof document>"u"||document.activeElement!==s)&&s.focus(),s)}function u(){if(typeof document>"u")return!1;let h=document.activeElement;if(!h)return!1;for(let s=0;s<i.length;s++){let d=i[s];if(d&&(d===h||typeof d.contains=="function"&&d.contains(h)))return!0}return!1}function y(h,s){return!(s>0)||h<0?0:h>s-1?s-1:h}function b(){return y(r(),n())}function m(h){return Number.isInteger(h)&&h>=0&&h<n()}function _(h){let s=n();if(s<=0)return;let d=y(r.peek(),s),x=d;switch(h.key){case"ArrowDown":case"ArrowRight":x=(d+1)%s;break;case"ArrowUp":case"ArrowLeft":x=(d-1+s)%s;break;case"Home":x=0;break;case"End":x=s-1;break;default:return}h.preventDefault(),r.set(x),p(x)}return{focusIndex:()=>b(),setFocusIndex:h=>{m(h)&&(r.set(h),u()&&p(h))},focusItem:h=>m(h)?(r.set(h),p(h)):null,getItemProps:(h,s)=>{let{ref:d,...x}=s||{};return f[h]=d||null,{ref:a(h),tabIndex:()=>b()===h?0:-1,onKeyDown:_,onFocus:S=>{let D=S&&(S.currentTarget||S.target);D&&(i[h]=D),r.set(h)},...x}},containerProps:h=>o?{role:o,...h}:{...h}}}function je({children:t,as:e="span"}){return J(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 Ke({children:t,priority:e="polite",atomic:n=!0}){return J("div",{"aria-live":e,"aria-atomic":n},t)}var Pt=0;function jt(){let t=wt();return t?(t.idCounter=(t.idCounter||0)+1,t.idCounter):++Pt}function Kt(){Pt=0}function Rt(t="what"){let e=`${t}-${jt()}`;return()=>e}function Re(t,e="what"){let n=[];for(let r=0;r<t;r++)n.push(`${e}-${jt()}`);return n}function $e(t){let e=Rt("desc");return{descriptionId:e,descriptionProps:()=>({id:e(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":e()}),Description:()=>J("div",{id:e(),style:{display:"none"}},t)}}function Ie(t){let e=Rt("label");return{labelId:e,labelProps:()=>({id:e()}),labelledByProps:()=>({"aria-labelledby":e()})}}var Oe={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function Ve(t,e){return n=>{n.key===t&&e(n)}}function ze(t,e){return n=>{t.includes(n.key)&&e(n)}}var et=null;function Ze(t){et=typeof t=="function"?t:null}function Je(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}),G({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 G({tag:t,props:e||{},children:n||[],key:null,_vnode:!0})}var te={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>"}},ee=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 zt(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function ne(t){let e=t.trim(),n=zt(e);if(ee.has(n))return re(e);let r=te[n];if(r){let i=document.createElement("template");i.innerHTML=r.wrap+e+r.unwrap;let g=i.content.firstChild;for(let f=0;f<r.depth;f++)g=g.firstChild;return()=>g.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}var $t=!1;function Ye(t){return z&&!$t&&($t=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),ne(t)}function re(t){let e=t.trim();if(zt(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 Gt(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return Gt(t,e(),n);if(typeof e=="function"){let r=n||null,o=null,i=null,g=!1,f=Ct();return j(()=>kt(f,()=>{let a=e(),c=typeof a;if(!g){g=!0,c==="string"||c==="number"?(i=document.createTextNode(String(a)),r?t.insertBefore(i,r):t.appendChild(i),et&&et(t,String(a)),o=i):o=ft(t,a,null,r);return}if(i!==null&&(c==="string"||c==="number")){let p=String(a);i.data!==p&&(i.data=p),et&&et(t,p);return}i=null,o=ft(t,a,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):ft(t,e,null,n||null)}function Ut(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function oe(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var lt=typeof SVGElement<"u";function _t(t){return lt&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function Ct(){let t=Q();return t[t.length-1]||null}function kt(t,e){let n=Q(),r=t!==null&&n[n.length-1]!==t;r&&n.push(t);try{return e()}finally{r&&n.pop()}}function It(t){return t==null?[]:Array.isArray(t)?t:[t]}function qt(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let r=0;r<t.length;r++)qt(t[r],e,n);return n}if(typeof t=="function"){let r=G(t,e,_t(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(Ut(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(oe(t)){let r=G(t,e,_t(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 ie(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 ft(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 c=It(n);for(let p=0;p<c.length;p++){let u=c[p];u.parentNode===t&&(I(u),t.removeChild(u))}return null}if((typeof e=="string"||typeof e=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let c=String(e);return n.data!==c&&(n.data=c),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?(I(n),t.replaceChild(e,n)):o?t.insertBefore(e,o):t.appendChild(e),e}let i=qt(e,t,[]),g=It(n);if(ie(g,i))return n;let f=i.length;for(let c=0;c<g.length;c++){let p=g[c];if(p.parentNode!==t)continue;let u=!1;for(let y=0;y<f;y++)if(i[y]===p){u=!0;break}u||(I(p),t.removeChild(p))}let a=o;for(let c=i.length-1;c>=0;c--){let p=i[c];(p.parentNode!==t||p.nextSibling!==a)&&(a&&a.parentNode!==t&&(a=null),a?t.insertBefore(p,a):t.appendChild(p)),a=p}return i.length===0?null:i.length===1?i[0]:i}function Qe(t,e,n){let r=n?.key,o=n?.raw||!1,i=(g,f)=>{let a=[],c=[],p=[],u=r&&!o?new Map:null,y=document.createComment("/list");return g.insertBefore(y,f||null),j(()=>{let b=t()||[],m=y.parentNode||g;r?ue(m,y,a,b,c,p,e,r,u):fe(m,y,a,b,c,p,e),a=b.length>0?b.slice():b}),y};return i._mapArray=!0,i._mapArraySource=t,i._mapArrayFn=e,i._mapArrayKeyed=!!r&&!o,i}function ve(t){let e=t._mapArraySource()||[],n=t._mapArrayFn,r=t._mapArrayKeyed;return e.map((o,i)=>n(r?()=>o:o,i))}function fe(t,e,n,r,o,i,g){let f=r.length,a=n.length;if(f===0){if(a>0){for(let s=0;s<a;s++)i[s]&&i[s]();for(let s=a-1;s>=0;s--){let d=o[s];d&&(I(d),d.parentNode===t&&t.removeChild(d))}o.length=0,i.length=0}return}if(a===0){let s=document.createDocumentFragment();for(let d=0;d<f;d++){let x=r[d],S=Y(D=>(i[d]=D,g(x,d)));o[d]=S,s.appendChild(S)}t.insertBefore(s,e);return}let c=0,p=Math.min(a,f);for(;c<p&&n[c]===r[c];)c++;if(c===a&&c===f)return;let u=a-1,y=f-1;for(;u>=c&&y>=c&&n[u]===r[y];)u--,y--;let b=new Array(f),m=new Array(f);for(let s=0;s<c;s++)b[s]=o[s],m[s]=i[s];for(let s=y+1;s<f;s++){let d=u+1+(s-y-1);b[s]=o[d],m[s]=i[d]}let _=y-c+1,h=u-c+1;if(_===0)for(let s=c;s<=u;s++)i[s]?.(),o[s]&&I(o[s]),o[s]?.parentNode&&o[s].parentNode.removeChild(o[s]);else if(h===0){let s=c<f&&b[y+1]?b[y+1]:e,d=document.createDocumentFragment();for(let x=c;x<=y;x++){let S=r[x],D=x;b[x]=Y(B=>(m[D]=B,g(S,D))),d.appendChild(b[x])}t.insertBefore(d,s)}else ce(t,e,n,r,o,i,g,c,u,y,b,m);o.length=f,i.length=f;for(let s=0;s<f;s++)o[s]=b[s],i[s]=m[s]}function ce(t,e,n,r,o,i,g,f,a,c,p,u){let y=new Map;for(let d=f;d<=a;d++)y.set(n[d],d);let b=c-f+1,m=new Int32Array(b);m.fill(-1);for(let d=f;d<=c;d++){let x=y.get(r[d]);x!==void 0&&(y.delete(r[d]),p[d]=o[x],u[d]=i[x],m[d-f]=x)}for(let[,d]of y)i[d]?.(),o[d]&&I(o[d]),o[d]?.parentNode&&o[d].parentNode.removeChild(o[d]);let _=b-se(m,b),h=new Uint8Array(b);if(_>1){let d=new Int32Array(_),x=new Int32Array(_),S=0;for(let B=0;B<b;B++)m[B]!==-1&&(d[S]=m[B],x[S]=B,S++);let D=Wt(d,_);for(let B=0;B<D.length;B++)h[x[D[B]]]=1}else if(_===1){for(let d=0;d<b;d++)if(m[d]!==-1){h[d]=1;break}}for(let d=f;d<=c;d++)if(!p[d]){let x=r[d],S=d;p[d]=Y(D=>(u[S]=D,g(x,S)))}let s=c+1<p.length&&p[c+1]?p[c+1]:e;for(let d=c;d>=f;d--){let x=d-f;(m[x]===-1||!h[x])&&(s&&s.parentNode!==t&&(s=e),t.insertBefore(p[d],s)),s=p[d]}}function se(t,e){let n=0;for(let r=0;r<e;r++)t[r]===-1&&n++;return n}function Wt(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 f=1;f<e;f++)if(t[f]>t[n[o-1]])r[f]=n[o-1],n[o++]=f;else{let a=0,c=o-1;for(;a<c;){let p=a+c>>1;t[n[p]]<t[f]?a=p+1:c=p}n[a]=f,r[f]=a>0?n[a-1]:-1}let i=new Array(o),g=n[o-1];for(let f=o-1;f>=0;f--)i[f]=g,g=r[g];return i}function le(){return document.createComment("i")}function v(t,e,n,r){let o=e;for(;o&&o!==n;){let i=o.nextSibling;t.insertBefore(o,r),o=i}}function yt(t,e,n){let r=e;for(;r&&r!==n;){let o=r.nextSibling;I(r),t.removeChild(r),r=o}}function mt(t,e,n,r,o,i,g,f,a){let c;if(o){let y=r(e),b=a(e);c=b,o.set(y,{itemSig:b})}else c=e;let p=le();t.appendChild(p);let u=Y(y=>(f[n]=y,i(c,n)));t.appendChild(u),g[n]=p}function ue(t,e,n,r,o,i,g,f,a){let c=r.length,p=n.length;if(c===0){if(p>0){for(let l=0;l<p;l++)i[l]&&i[l]();o[0]&&yt(t,o[0],e),o.length=0,i.length=0,a&&a.clear()}return}if(p===0){let l=document.createDocumentFragment();for(let E=0;E<c;E++)mt(l,r[E],E,f,a,g,o,i,O);t.insertBefore(l,e);return}let u=0,y=Math.min(p,c);for(;u<y;){if(n[u]===r[u]){u++;continue}let l=f(n[u]),E=f(r[u]);if(l!==E)break;a&&a.get(l).itemSig.set(r[u]),u++}let b=p-1,m=c-1;for(;b>=u&&m>=u;){if(n[b]===r[m]){b--,m--;continue}let l=f(n[b]),E=f(r[m]);if(l!==E)break;a&&a.get(l).itemSig.set(r[m]),b--,m--}if(u>b&&u>m)return;let _=new Array(c),h=new Array(c);for(let l=0;l<u;l++)_[l]=o[l],h[l]=i[l];for(let l=m+1;l<c;l++){let E=b+1+(l-m-1);_[l]=o[E],h[l]=i[E]}let s=m-u+1,d=b-u+1;if(d===0){let l=m+1<c&&_[m+1]?_[m+1]:e,E=document.createDocumentFragment();for(let N=u;N<=m;N++)mt(E,r[N],N,f,a,g,_,h,O);t.insertBefore(E,l),F(o,i,_,h,c);return}if(s===0){for(let l=u;l<=b;l++){i[l]?.();let E=X(t,o[l],o,l,e);yt(t,o[l],E),a&&a.delete(f(n[l]))}F(o,i,_,h,c);return}if(s===d&&s>=2&&s<=Math.max(d,200)){let l=0,E=-1,N=-1;for(let A=0;A<s&&l<=4;A++){let w=f(n[u+A]),$=f(r[u+A]);w!==$&&(l===0?E=A:l===1&&(N=A),l++)}if(l===2){let A=u+E,w=u+N,$=f(n[A]),Z=f(n[w]),dt=f(r[A]),q=f(r[w]);if($===q&&Z===dt){for(let L=0;L<u;L++)_[L]=o[L],h[L]=i[L];for(let L=u;L<=m;L++)_[L]=o[L],h[L]=i[L];for(let L=m+1;L<c;L++){let R=b+1+(L-m-1);_[L]=o[R],h[L]=i[R]}let K=_[A];_[A]=_[w],_[w]=K;let M=h[A];if(h[A]=h[w],h[w]=M,a){if(r[A]!==n[A]){let L=f(r[A]),R=a.get(L);R&&R.itemSig.set(r[A])}if(r[w]!==n[w]){let L=f(r[w]),R=a.get(L);R&&R.itemSig.set(r[w])}}let H=w===A+1||A===w+1,P=Math.min(A,w),T=Math.max(A,w);if(H){let L=X(t,o[T],o,T,e);v(t,o[T],L,o[P])}else{let L=X(t,o[w],o,w,e),R=document.createComment("tmp");t.insertBefore(R,o[w]),v(t,o[w],L,o[A]);let Yt=X(t,o[A],o,A,e);v(t,o[A],Yt,R),t.removeChild(R)}F(o,i,_,h,c);return}}if(l>=2&&l<=s){let A=E,w=-1,$=-1,Z=!1,dt=f(n[u+A]),q=-1;for(let K=A;K<s;K++)if(f(r[u+K])===dt){q=K;break}if(q>A){let K=!0;for(let M=A;M<q;M++)if(f(n[u+M+1])!==f(r[u+M])){K=!1;break}if(K){let M=!0;for(let H=q+1;H<s;H++)if(f(n[u+H])!==f(r[u+H])){M=!1;break}M&&(Z=!0,w=u+A,$=u+q)}}if(!Z){let K=f(r[u+A]),M=-1;for(let H=A;H<d;H++)if(f(n[u+H])===K){M=H;break}if(M>A){let H=!0;for(let P=A;P<M;P++)if(f(n[u+P])!==f(r[u+P+1])){H=!1;break}if(H){let P=!0;for(let T=M+1;T<s;T++)if(f(n[u+T])!==f(r[u+T])){P=!1;break}P&&(Z=!0,w=u+M,$=u+A)}}}if(Z){for(let T=u;T<=b;T++)_[T]=o[T],h[T]=i[T];let K=_[w],M=h[w];if(w<$)for(let T=w;T<$;T++)_[T]=_[T+1],h[T]=h[T+1];else for(let T=w;T>$;T--)_[T]=_[T-1],h[T]=h[T-1];if(_[$]=K,h[$]=M,a)for(let T=u;T<=m;T++){let L=f(r[T]);if(r[T]!==n[T]){let R=a.get(L);R&&R.itemSig.set(r[T])}}let H=X(t,K,o,w,e),P;$+1<c?P=_[$+1]:P=e,($>=m+1||P&&P.parentNode!==t)&&(P=e),v(t,K,H,P),F(o,i,_,h,c);return}}}let x=new Map;for(let l=u;l<=b;l++)x.set(f(n[l]),l);let S=new Int32Array(s);S.fill(-1);for(let l=u;l<=m;l++){let E=f(r[l]),N=x.get(E);N!==void 0&&(x.delete(E),_[l]=o[N],h[l]=i[N],S[l-u]=N,a&&r[l]!==n[N]&&a.get(E).itemSig.set(r[l]))}let D=[...x.values()].sort((l,E)=>E-l);for(let l of D){i[l]?.();let E=X(t,o[l],o,l,e);yt(t,o[l],E),a&&a.delete(f(n[l]))}for(let l=u;l<=m;l++)if(!_[l]){let E=document.createDocumentFragment();mt(E,r[l],l,f,a,g,_,h,O),_[l]._frag=E}let B=0,rt=!0,ot=-1;for(let l=0;l<s;l++)S[l]!==-1&&(B++,S[l]<=ot&&(rt=!1),ot=S[l]);let V=new Uint8Array(s);if(rt)for(let l=0;l<s;l++)S[l]!==-1&&(V[l]=1);else if(B>1){let l=new Int32Array(B),E=new Int32Array(B),N=0;for(let w=0;w<s;w++)S[w]!==-1&&(l[N]=S[w],E[N]=w,N++);let A=Wt(l,B);for(let w=0;w<A.length;w++)V[E[A[w]]]=1}else if(B===1){for(let l=0;l<s;l++)if(S[l]!==-1){V[l]=1;break}}F(o,i,_,h,c);let at=m+1<c&&o[m+1]?o[m+1]:e;for(let l=m;l>=u;l--){let E=l-u,N=o[l];if(S[E]===-1)N._frag&&(t.insertBefore(N._frag,at),delete N._frag);else if(!V[E]){let A=X(t,N,o,l,e);v(t,N,A,at)}at=N}}function X(t,e,n,r,o){let i=e.nextSibling;for(;i&&i!==o;){if(i.nodeType===8&&i.data==="i")return i;i=i.nextSibling}return o}function F(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 Fe(t,e){for(let n in e){let r=e[n];if(n==="ref"){typeof r=="function"?r(t):r&&typeof r=="object"&&(r.current=t);continue}if(W(n)){if(typeof r!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,r);continue}if(typeof r=="function"&&!W(n)){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}n==="class"||n==="className"?t._propEffects[n]=j(()=>{let o=r()||"";lt&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):n==="style"&&typeof r()=="object"?t._propEffects[n]=j(()=>{ut(t,r())}):t._propEffects[n]=j(()=>{ct(t,n,r())})}else ct(t,n,r)}}function ct(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"&&!W(e)){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>ct(t,e,n()));return}if(W(e))return;if(St(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let r=lt&&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")ut(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"?ht(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function nt(t,e,n,r){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=j(()=>r(t,n()))}function ae(t,e){if(typeof e=="function")return nt(t,"class",e,ae);lt&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function ut(t,e){if(typeof e=="function")return nt(t,"style",e,ut);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 de(t,e,n){if(typeof n=="function")return nt(t,e,n,(r,o)=>de(r,e,o));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function he(t,e){if(typeof e=="function")return nt(t,"value",e,he);if(t.tagName==="SELECT"){ht(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function pe(t,e){if(typeof e=="function")return nt(t,"checked",e,pe);t.checked=!!e}var Ot=new Set;function tn(t){for(let e of t)Ot.has(e)||(Ot.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 en(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function nn(t,e){j(()=>{for(let n in e){let r=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!r)}})}var st=!1,C=null;function rn(){return st}function ge(t,e){st=!0,Kt(),C={parent:e,index:0};try{let n=k(t,e);return e!==document.body&&e!==document.documentElement&&Xt(e),n}finally{st=!1,C=null}}function Xt(t){if(!(!C||C.parent!==t))for(;t.childNodes.length>C.index;){let e=t.lastChild;I(e),t.removeChild(e)}}var ye=new Set(["$","/$","[]","/[]","fn","/fn","eb:start","eb:end","sb:start","sb:end","portal","portal:empty"]);function Zt(t){return t.nodeType===8&&ye.has(t.textContent)}function bt(t){let e=t.childNodes;for(;C.index<e.length;){let n=e[C.index];if(Zt(n)){C.index++;continue}return C.index++,n}return null}function Jt(t){if(!C||C.parent!==t)return null;let e=t.childNodes;for(let n=C.index;n<e.length;n++){let r=e[n];if(!Zt(r))return r}return null}function tt(t,e){return C&&C.parent===t?(t.insertBefore(e,t.childNodes[C.index]||null),C.index++):t.appendChild(e),e}function xt(){return z}function k(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=Jt(e);return i&&i.nodeType===3?(bt(e),i.textContent="",i):tt(e,document.createTextNode(""))}let r=bt(e);if(r&&r.nodeType===3)return r.textContent!==n&&(xt()&&console.warn(`[what] Hydration mismatch: expected text "${n}", got "${r.textContent}"`),r.textContent=n),r;xt()&&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):tt(e,o),o}if(typeof t=="function"&&t._lazyChildren)return k(t(),e);if(typeof t=="function"&&t._mapArray){let n=!!(C&&C.parent===e),r=n&&e.childNodes[C.index]||null,o=t(e,r);if(n){let i=Array.prototype.indexOf.call(e.childNodes,o);i>=0&&(C.index=i+1)}return o}if(typeof t=="function"){let n=!!(C&&C.parent===e),r=document.createComment("fn"),o=document.createComment("/fn");n?(e.insertBefore(r,e.childNodes[C.index]||null),C.index++):e.appendChild(r),k(t(),e),n?(e.insertBefore(o,e.childNodes[C.index]||null),C.index++):e.appendChild(o);let i=[];for(let u=r.nextSibling;u&&u!==o;u=u.nextSibling)i.push(u);let g=i.length===0?null:i.length===1?i[0]:i,f=Ct(),a=j(()=>kt(f,()=>{let u=t();st||(g=ft(o.parentNode||e,u,g,o))})),c=!1,p=()=>{c||(c=!0,a())};return r._dispose=p,o._dispose=p,Lt(r,p),g}if(Array.isArray(t)){let n=[];for(let r of t){let o=k(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=Q(),g=t.tag,f=t.props||{},a=t.children||[],c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:g,_parentCtx:i[i.length-1]||null,_errorBoundary:null};i.push(c);let p,u=null;try{let y={...f};f._$lazyChildren?u=Nt(g,y,f._$lazyChildren):y.children=a.length===0?f.children:a.length===1?a[0]:a,p=g(y),u&&u()}catch(y){return i.pop(),!Mt(y)&&!(y&&typeof y.then=="function"&&me(y,c))&&!Et(y,c)&&console.error("[what] Error in component during hydration:",g.name||"Anonymous",y),null}c.mounted=!0,c._mountCallbacks&&queueMicrotask(()=>{if(!c.disposed)for(let y of c._mountCallbacks)try{y()}catch(b){console.error("[what] onMount error:",b)}});try{let y=k(p,e),b=typeof p=="function"||Array.isArray(p)&&p.some(h=>typeof h=="function"),m=Array.isArray(y)?y[0]:y,_=!b&&m&&m.nodeType?m:e;return it(_,c),y}finally{i.pop()}}if(t.tag==="__errorBoundary"){let{errorState:i,fallback:g,reset:f,handleError:a}=t.props;return Vt(t,e,{startText:"eb:start",endText:"eb:end",ctxExtras:{_errorBoundary:a},state:i,contentFor:c=>c?typeof g=="function"?g({error:c,reset:f}):g:t.children||[]})}if(t.tag==="__suspense"){let{boundary:i,fallback:g,loading:f}=t.props;return Vt(t,e,{startText:"sb:start",endText:"sb:end",ctxExtras:{_suspenseBoundary:i},state:f,contentFor:a=>a?g:t.children||[]})}if(t.tag==="__portal"){let i=G(t,e);return i?tt(e,i):null}let n=bt(e),r=t.tag.toLowerCase();if(n&&n.nodeType===1&&n.nodeName.toLowerCase()===r){_e(n,t.props||{});let i=C;if(C={parent:n,index:0},t.props?.dangerouslySetInnerHTML?.__html==null){for(let f of t.children)k(f,n);t.children.length>0&&Xt(n)}return C=i,n}xt()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${n?n.nodeName:"nothing"}. Falling back to client render.`);let o=G(t,e,_t(e));return n?e.replaceChild(o,n):tt(e,o),o}return Ut(t)?t:tt(e,document.createTextNode(String(t)))}function me(t,e){for(let n=e;n;n=n._parentCtx)if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(t),!0;return!1}function be(t,e){return typeof t=="string"||typeof t=="number"?e.nodeType!==3:t&&t._vnode&&typeof t.tag=="string"?e.nodeType!==1||e.nodeName.toLowerCase()!==t.tag.toLowerCase():!1}function xe(t,e,n){if(e<0||!C||C.parent!==t||C.index!==e)return!1;let r=Jt(t);if(!r)return!1;let o=n(),i=Array.isArray(o)?o:[o],g=i.find(f=>f!=null&&typeof f!="boolean");if(g===void 0)return!0;if(be(g,r))return!1;for(let f of i)k(f,t);return!0}function Vt(t,e,{startText:n,endText:r,ctxExtras:o,state:i,contentFor:g}){let f=t.children||[],a=!!(C&&C.parent===e),c=document.createComment(n),p=document.createComment(r),u={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:Ct(),_startComment:c,_endComment:p,...o};a?(e.insertBefore(c,e.childNodes[C.index]||null),C.index++):e.appendChild(c);let y=a?C.index:-1,b=Q();b.push(u);try{for(let x of f)k(x,e)}finally{b.pop()}let m=At(i),_=!m;if(m){b.push(u);try{_=xe(e,y,()=>g(m))}finally{b.pop()}}a?(e.insertBefore(p,e.childNodes[C.index]||null),C.index++):e.appendChild(p);let h=!0,s=0,d=j(()=>{let x=i();if(h&&(h=!1,_&&x===m))return;let S=c.parentNode;if(!S)return;let D=++s;for(;c.nextSibling&&c.nextSibling!==p;){let B=c.nextSibling;I(B),S.removeChild(B)}b.push(u);try{let B=g(x),rt=Array.isArray(B)?B:[B];for(let ot of rt){let V=G(ot,S);if(D!==s){V&&I(V);break}V&&(p.parentNode?p.parentNode.insertBefore(V,p):I(V))}}finally{b.pop()}});if(a&&C&&C.parent===e){let x=Array.prototype.indexOf.call(e.childNodes,p);x>=0&&(C.index=x+1)}return u.effects.push(d),it(c,u),it(p,u),c}function _e(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(W(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"&&!W(n)){n==="class"||n==="className"?j(()=>{t.className=r()||""}):n==="style"&&typeof r()=="object"?j(()=>{ut(t,r())}):j(()=>{ct(t,n,r())});continue}}}Tt({hydrate:ge,insert:Gt});export{Te as a,Se as b,Qt as c,Le as d,Ft as e,Be as f,Ne as g,Me as h,De as i,He as j,Pe as k,je as l,Ke as m,Rt as n,Re as o,$e as p,Ie as q,Oe as r,Ve as s,ze as t,Ze as u,Je as v,ne as w,Ye as x,re as y,Gt as z,Qe as A,ve as B,Fe as C,ct as D,ae as E,ut as F,de as G,he as H,pe as I,tn as J,en as K,nn as L,rn as M,ge as N};
|