what-core 0.11.7 → 0.11.8
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-JIZR6JX5.min.js +1 -0
- package/dist/chunk-PABR63P3.min.js +1 -0
- package/dist/index.min.js +19 -6
- package/dist/render.min.js +1 -1
- package/dist/testing.min.js +1 -1
- package/index.d.ts +152 -11
- package/package.json +1 -1
- package/src/agent-context.js +1 -1
- package/src/components.js +47 -22
- package/src/dom.js +219 -22
- package/src/errors.js +29 -0
- package/src/head.js +35 -5
- package/src/hooks.js +3 -0
- package/src/reactive.js +5 -5
- package/src/render.js +73 -34
- package/dist/chunk-5QCEMXNL.min.js +0 -1
- package/dist/chunk-H67HFVDV.min.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as R,J as gt,K as dt,L as yt,M as V,O as Z,Q as bt,R as mt,S as _t,T as ct,a as G,c as nt,e as N,m as X}from"./chunk-PABR63P3.min.js";var Y=null;function kt(t){Y=typeof t=="function"?t:null}function vt(t,e,n){if(typeof n=="function"){let i=()=>{let o=n();return o.length===1?o[0]:o};return i._lazyChildren=!0,e||(e={}),Object.defineProperty(e,"_$lazyChildren",{value:i,configurable:!0}),Z({tag:t,props:e,children:[],key:null,_vnode:!0})}if(n&&n.length>0){let i=n.length===1?n[0]:n;e?e.children=i:e={children:i}}return Z({tag:t,props:e||{},children:n||[],key:null,_vnode:!0})}var Mt={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>"}},Ht=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 Et(t){let e=t.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return e?e[1]:""}function jt(t){let e=t.trim(),n=Et(e);if(Ht.has(n))return Bt(e);let i=Mt[n];if(i){let r=document.createElement("template");r.innerHTML=i.wrap+e+i.unwrap;let m=r.content.firstChild;for(let c=0;c<i.depth;c++)m=m.firstChild;return()=>m.cloneNode(!0)}let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}var pt=!1;function Ft(t){return G&&!pt&&(pt=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),jt(t)}function Bt(t){let e=t.trim();if(Et(e)==="svg"){let o=document.createElement("template");return o.innerHTML=e,()=>o.content.firstChild.cloneNode(!0)}let i=document.createElement("template");return i.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,()=>i.content.firstChild.firstChild.cloneNode(!0)}function $t(t,e,n){if(typeof e=="function"&&e._mapArray)return e(t,n||null);if(typeof e=="function"&&e._lazyChildren)return $t(t,e(),n);if(typeof e=="function"){let i=n||null,o=null,r=null,m=!1;return N(()=>{let c=e(),a=typeof c;if(!m){m=!0,a==="string"||a==="number"?(r=document.createTextNode(String(c)),i?t.insertBefore(r,i):t.appendChild(r),Y&&Y(t,String(c)),o=r):o=I(t,c,null,i);return}if(r!==null&&(a==="string"||a==="number")){let l=String(c);r.data!==l&&(r.data=l),Y&&Y(t,l);return}r=null,o=I(t,c,o,i)}),o}if(typeof e=="string"||typeof e=="number"){let i=document.createTextNode(String(e));return n?t.insertBefore(i,n):t.appendChild(i),i}return e!=null&&typeof e=="object"&&e.nodeType>0?(n?t.insertBefore(e,n):t.appendChild(e),e):I(t,e,null,n||null)}function wt(t){return!t||typeof t!="object"?!1:typeof Node<"u"&&t instanceof Node?!0:typeof t.nodeType=="number"&&typeof t.nodeName=="string"}function Nt(t){return!!t&&typeof t=="object"&&(t._vnode===!0||"tag"in t)}var ot=typeof SVGElement<"u";function xt(t){return ot&&t instanceof SVGElement&&t.tagName!=="foreignObject"}function Ct(t){return t==null?[]:Array.isArray(t)?t:[t]}function Lt(t,e,n){if(t==null||typeof t=="boolean")return n;if(Array.isArray(t)){for(let i=0;i<t.length;i++)Lt(t[i],e,n);return n}if(typeof t=="function"){let i=Z(t,e,xt(e));if(i&&i.nodeType===11){let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)n.push(o[r])}else i&&n.push(i);return n}if(typeof t=="string"||typeof t=="number")return n.push(document.createTextNode(String(t))),n;if(wt(t)){if(t.nodeType===11&&t.childNodes.length>0){let i=Array.from(t.childNodes);for(let o=0;o<i.length;o++)n.push(i[o])}else n.push(t);return n}if(Nt(t)){let i=Z(t,e,xt(e));if(i&&i.nodeType===11)if(i.childNodes.length===0)n.push(i);else{let o=Array.from(i.childNodes);for(let r=0;r<o.length;r++)n.push(o[r])}else i&&n.push(i);return n}return n.push(document.createTextNode(String(t))),n}function Dt(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 I(t,e,n,i){if(!t||typeof t.insertBefore!="function")return G&&console.warn("[what] reconcileInsert called with invalid parent:",t),n;let o=i||null;if(e==null||typeof e=="boolean"){let l=Ct(n);for(let y=0;y<l.length;y++){let s=l[y];s.parentNode===t&&(V(s),t.removeChild(s))}return null}if((typeof e=="string"||typeof e=="number")&&n&&!Array.isArray(n)&&n.nodeType===3){let l=String(e);return n.data!==l&&(n.data=l),n}if(typeof e=="object"&&e!==null&&e.nodeType>0&&e.nodeType!==11&&!Array.isArray(e)){if(e===n)return n;if(n&&!Array.isArray(n)&&n.nodeType>0&&n.nodeType!==11)return n.parentNode===t?(V(n),t.replaceChild(e,n)):o?t.insertBefore(e,o):t.appendChild(e),e}let r=Lt(e,t,[]),m=Ct(n);if(Dt(m,r))return n;let c=r.length;for(let l=0;l<m.length;l++){let y=m[l];if(y.parentNode!==t)continue;let s=!1;for(let C=0;C<c;C++)if(r[C]===y){s=!0;break}s||(V(y),t.removeChild(y))}let a=o;for(let l=r.length-1;l>=0;l--){let y=r[l];(y.parentNode!==t||y.nextSibling!==a)&&(a&&a.parentNode!==t&&(a=null),a?t.insertBefore(y,a):t.appendChild(y)),a=y}return r.length===0?null:r.length===1?r[0]:r}function te(t,e,n){let i=n?.key,o=n?.raw||!1,r=(m,c)=>{let a=[],l=[],y=[],s=i&&!o?new Map:null,C=document.createComment("/list");return m.insertBefore(C,c||null),N(()=>{let d=t()||[],b=C.parentNode||m;i?zt(b,C,a,d,l,y,e,i,s):Kt(b,C,a,d,l,y,e),a=d.length>0?d.slice():d}),C};return r._mapArray=!0,r}function Kt(t,e,n,i,o,r,m){let c=i.length,a=n.length;if(c===0){if(a>0){for(let u=0;u<a;u++)r[u]&&r[u]();for(let u=a-1;u>=0;u--){let h=o[u];h&&(V(h),h.parentNode===t&&t.removeChild(h))}o.length=0,r.length=0}return}if(a===0){let u=document.createDocumentFragment();for(let h=0;h<c;h++){let E=i[h],L=X(O=>(r[h]=O,m(E,h)));o[h]=L,u.appendChild(L)}t.insertBefore(u,e);return}let l=0,y=Math.min(a,c);for(;l<y&&n[l]===i[l];)l++;if(l===a&&l===c)return;let s=a-1,C=c-1;for(;s>=l&&C>=l&&n[s]===i[C];)s--,C--;let d=new Array(c),b=new Array(c);for(let u=0;u<l;u++)d[u]=o[u],b[u]=r[u];for(let u=C+1;u<c;u++){let h=s+1+(u-C-1);d[u]=o[h],b[u]=r[h]}let p=C-l+1,T=s-l+1;if(p===0)for(let u=l;u<=s;u++)r[u]?.(),o[u]&&V(o[u]),o[u]?.parentNode&&o[u].parentNode.removeChild(o[u]);else if(T===0){let u=l<c&&d[C+1]?d[C+1]:e,h=document.createDocumentFragment();for(let E=l;E<=C;E++){let L=i[E],O=E;d[E]=X(S=>(b[O]=S,m(L,O))),h.appendChild(d[E])}t.insertBefore(h,u)}else Ot(t,e,n,i,o,r,m,l,s,C,d,b);o.length=c,r.length=c;for(let u=0;u<c;u++)o[u]=d[u],r[u]=b[u]}function Ot(t,e,n,i,o,r,m,c,a,l,y,s){let C=new Map;for(let h=c;h<=a;h++)C.set(n[h],h);let d=l-c+1,b=new Int32Array(d);b.fill(-1);for(let h=c;h<=l;h++){let E=C.get(i[h]);E!==void 0&&(C.delete(i[h]),y[h]=o[E],s[h]=r[E],b[h-c]=E)}for(let[,h]of C)r[h]?.(),o[h]&&V(o[h]),o[h]?.parentNode&&o[h].parentNode.removeChild(o[h]);let p=d-Pt(b,d),T=new Uint8Array(d);if(p>1){let h=new Int32Array(p),E=new Int32Array(p),L=0;for(let S=0;S<d;S++)b[S]!==-1&&(h[L]=b[S],E[L]=S,L++);let O=St(h,p);for(let S=0;S<O.length;S++)T[E[O[S]]]=1}else if(p===1){for(let h=0;h<d;h++)if(b[h]!==-1){T[h]=1;break}}for(let h=c;h<=l;h++)if(!y[h]){let E=i[h],L=h;y[h]=X(O=>(s[L]=O,m(E,L)))}let u=l+1<y.length&&y[l+1]?y[l+1]:e;for(let h=l;h>=c;h--){let E=h-c;(b[E]===-1||!T[E])&&(u&&u.parentNode!==t&&(u=e),t.insertBefore(y[h],u)),u=y[h]}}function Pt(t,e){let n=0;for(let i=0;i<e;i++)t[i]===-1&&n++;return n}function St(t,e){if(e===0)return[];if(e===1)return[0];let n=new Int32Array(e),i=new Int32Array(e),o=1;n[0]=0,i[0]=-1;for(let c=1;c<e;c++)if(t[c]>t[n[o-1]])i[c]=n[o-1],n[o++]=c;else{let a=0,l=o-1;for(;a<l;){let y=a+l>>1;t[n[y]]<t[c]?a=y+1:l=y}n[a]=c,i[c]=a>0?n[a-1]:-1}let r=new Array(o),m=n[o-1];for(let c=o-1;c>=0;c--)r[c]=m,m=i[m];return r}function Vt(){return document.createComment("i")}function J(t,e,n,i){let o=e;for(;o&&o!==n;){let r=o.nextSibling;t.insertBefore(o,i),o=r}}function lt(t,e,n){let i=e;for(;i&&i!==n;){let o=i.nextSibling;V(i),t.removeChild(i),i=o}}function st(t,e,n,i,o,r,m,c,a){let l;if(o){let C=i(e),d=a(e);l=d,o.set(C,{itemSig:d})}else l=e;let y=Vt();t.appendChild(y);let s=X(C=>(c[n]=C,r(l,n)));t.appendChild(s),m[n]=y}function zt(t,e,n,i,o,r,m,c,a){let l=i.length,y=n.length;if(l===0){if(y>0){for(let f=0;f<y;f++)r[f]&&r[f]();o[0]&<(t,o[0],e),o.length=0,r.length=0,a&&a.clear()}return}if(y===0){let f=document.createDocumentFragment();for(let x=0;x<l;x++)st(f,i[x],x,c,a,m,o,r,nt);t.insertBefore(f,e);return}let s=0,C=Math.min(y,l);for(;s<C;){if(n[s]===i[s]){s++;continue}let f=c(n[s]),x=c(i[s]);if(f!==x)break;a&&a.get(f).itemSig.set(i[s]),s++}let d=y-1,b=l-1;for(;d>=s&&b>=s;){if(n[d]===i[b]){d--,b--;continue}let f=c(n[d]),x=c(i[b]);if(f!==x)break;a&&a.get(f).itemSig.set(i[b]),d--,b--}if(s>d&&s>b)return;let p=new Array(l),T=new Array(l);for(let f=0;f<s;f++)p[f]=o[f],T[f]=r[f];for(let f=b+1;f<l;f++){let x=d+1+(f-b-1);p[f]=o[x],T[f]=r[x]}let u=b-s+1,h=d-s+1;if(h===0){let f=b+1<l&&p[b+1]?p[b+1]:e,x=document.createDocumentFragment();for(let w=s;w<=b;w++)st(x,i[w],w,c,a,m,p,T,nt);t.insertBefore(x,f),Q(o,r,p,T,l);return}if(u===0){for(let f=s;f<=d;f++){r[f]?.();let x=U(t,o[f],o,f,e);lt(t,o[f],x),a&&a.delete(c(n[f]))}Q(o,r,p,T,l);return}if(u===h&&u>=2&&u<=Math.max(h,200)){let f=0,x=-1,w=-1;for(let _=0;_<u&&f<=4;_++){let A=c(n[s+_]),D=c(i[s+_]);A!==D&&(f===0?x=_:f===1&&(w=_),f++)}if(f===2){let _=s+x,A=s+w,D=c(n[_]),K=c(n[A]),q=c(i[_]),tt=c(i[A]);if(D===tt&&K===q){for(let g=0;g<s;g++)p[g]=o[g],T[g]=r[g];for(let g=s;g<=b;g++)p[g]=o[g],T[g]=r[g];for(let g=b+1;g<l;g++){let $=d+1+(g-b-1);p[g]=o[$],T[g]=r[$]}let z=p[_];p[_]=p[A],p[A]=z;let j=T[_];if(T[_]=T[A],T[A]=j,a){if(i[_]!==n[_]){let g=c(i[_]),$=a.get(g);$&&$.itemSig.set(i[_])}if(i[A]!==n[A]){let g=c(i[A]),$=a.get(g);$&&$.itemSig.set(i[A])}}let H=A===_+1||_===A+1,B=Math.min(_,A),M=Math.max(_,A);if(H){let g=U(t,o[M],o,M,e);J(t,o[M],g,o[B])}else{let g=U(t,o[A],o,A,e),$=document.createComment("tmp");t.insertBefore($,o[A]),J(t,o[A],g,o[_]);let et=U(t,o[_],o,_,e);J(t,o[_],et,$),t.removeChild($)}Q(o,r,p,T,l);return}}if(f>=2&&f<=u){let _=x,A=null,D=-1,K=-1,q=!1,tt=c(n[s+_]),z=-1;for(let j=_;j<u;j++)if(c(i[s+j])===tt){z=j;break}if(z>_){let j=!0;for(let H=_;H<z;H++)if(c(n[s+H+1])!==c(i[s+H])){j=!1;break}if(j){let H=!0;for(let B=z+1;B<u;B++)if(c(n[s+B])!==c(i[s+B])){H=!1;break}H&&(q=!0,D=s+_,K=s+z,A=tt)}}if(!q){let j=c(i[s+_]),H=-1;for(let B=_;B<h;B++)if(c(n[s+B])===j){H=B;break}if(H>_){let B=!0;for(let M=_;M<H;M++)if(c(n[s+M])!==c(i[s+M+1])){B=!1;break}if(B){let M=!0;for(let g=H+1;g<u;g++)if(c(n[s+g])!==c(i[s+g])){M=!1;break}M&&(q=!0,D=s+H,K=s+_,A=j)}}}if(q){for(let g=s;g<=d;g++)p[g]=o[g],T[g]=r[g];let j=p[D],H=T[D];if(D<K)for(let g=D;g<K;g++)p[g]=p[g+1],T[g]=T[g+1];else for(let g=D;g>K;g--)p[g]=p[g-1],T[g]=T[g-1];if(p[K]=j,T[K]=H,a)for(let g=s;g<=b;g++){let $=c(i[g]);if(i[g]!==n[g]){let et=a.get($);et&&et.itemSig.set(i[g])}}let B=U(t,j,o,D,e),M;K+1<l?M=p[K+1]:M=e,(K>=b+1||M&&M.parentNode!==t)&&(M=e),J(t,j,B,M),Q(o,r,p,T,l);return}}}let E=new Map;for(let f=s;f<=d;f++)E.set(c(n[f]),f);let L=new Int32Array(u);L.fill(-1);for(let f=s;f<=b;f++){let x=c(i[f]),w=E.get(x);w!==void 0&&(E.delete(x),p[f]=o[w],T[f]=r[w],L[f-s]=w,a&&i[f]!==n[w]&&a.get(x).itemSig.set(i[f]))}let O=[...E.values()].sort((f,x)=>x-f);for(let f of O){r[f]?.();let x=U(t,o[f],o,f,e);lt(t,o[f],x),a&&a.delete(c(n[f]))}for(let f=s;f<=b;f++)if(!p[f]){let x=document.createDocumentFragment();st(x,i[f],f,c,a,m,p,T,nt),p[f]._frag=x}let S=0,at=!0,ht=-1;for(let f=0;f<u;f++)L[f]!==-1&&(S++,L[f]<=ht&&(at=!1),ht=L[f]);let F=new Uint8Array(u);if(at)for(let f=0;f<u;f++)L[f]!==-1&&(F[f]=1);else if(S>1){let f=new Int32Array(S),x=new Int32Array(S),w=0;for(let A=0;A<u;A++)L[A]!==-1&&(f[w]=L[A],x[w]=A,w++);let _=St(f,S);for(let A=0;A<_.length;A++)F[x[_[A]]]=1}else if(S===1){for(let f=0;f<u;f++)if(L[f]!==-1){F[f]=1;break}}Q(o,r,p,T,l);let ft=b+1<l&&o[b+1]?o[b+1]:e;for(let f=b;f>=s;f--){let x=f-s,w=o[f];if(L[x]===-1)w._frag&&(t.insertBefore(w._frag,ft),delete w._frag);else if(!F[x]){let _=U(t,w,o,f,e);J(t,w,_,ft)}ft=w}}function U(t,e,n,i,o){let r=e.nextSibling;for(;r&&r!==o;){if(r.nodeType===8&&r.data==="i")return r;r=r.nextSibling}return o}function Q(t,e,n,i,o){t.length=o,e.length=o;for(let r=0;r<o;r++)t[r]=n[r],e[r]=i[r]}function ee(t,e){for(let n in e){let i=e[n];if(R(n)){if(typeof i!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(typeof i=="function"&&!R(n)){if(t._propEffects||(t._propEffects={}),t._propEffects[n])try{t._propEffects[n]()}catch{}n==="class"||n==="className"?t._propEffects[n]=N(()=>{let o=i()||"";ot&&t instanceof SVGElement?t.setAttribute("class",o):t.className=o}):n==="style"&&typeof i()=="object"?t._propEffects[n]=N(()=>{rt(t,i())}):t._propEffects[n]=N(()=>{k(t,n,i())})}else k(t,n,i)}}function k(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"&&!R(e)){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=N(()=>k(t,e,n()));return}if(R(e))return;if(gt(e,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${e}" attribute:`,n);return}let i=ot&&t instanceof SVGElement;if(e==="class"||e==="className")i?t.setAttribute("class",n||""):t.className=n||"";else if(e==="dangerouslySetInnerHTML"){let o=n?.__html??"";typeof G<"u"&&G&&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 G<"u"&&G&&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")rt(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):i?t.setAttribute(e,n):e==="value"&&t.tagName==="SELECT"?ct(t,n):e in t?t[e]=n:t.setAttribute(e,n)}function v(t,e,n,i){if(t._propEffects||(t._propEffects={}),t._propEffects[e])try{t._propEffects[e]()}catch{}t._propEffects[e]=N(()=>i(t,n()))}function Gt(t,e){if(typeof e=="function")return v(t,"class",e,Gt);ot&&t instanceof SVGElement?t.setAttribute("class",e||""):t.className=e||""}function rt(t,e){if(typeof e=="function")return v(t,"style",e,rt);if(typeof e=="string")t.style.cssText=e,t._lastStyleObj=null;else if(e&&typeof e=="object"){let n=t.style,i=t._lastStyleObj;if(i)for(let o in i)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 Rt(t,e,n){if(typeof n=="function")return v(t,e,n,(i,o)=>Rt(i,e,o));n==null?t.removeAttribute(e):t.setAttribute(e,n)}function Ut(t,e){if(typeof e=="function")return v(t,"value",e,Ut);if(t.tagName==="SELECT"){ct(t,e);return}let n=e==null?"":String(e);t.value!==n&&(t.value=n)}function qt(t,e){if(typeof e=="function")return v(t,"checked",e,qt);t.checked=!!e}var At=new Set;function ne(t){for(let e of t)At.has(e)||(At.add(e),document.addEventListener(e,n=>{let i=n.target,o="$$"+e;for(Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return i||document}});i;){let r=i[o];if(r&&(r(n),n.cancelBubble))return;i=i.parentNode}}))}function ie(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function oe(t,e){N(()=>{for(let n in e){let i=typeof e[n]=="function"?e[n]():e[n];t.classList.toggle(n,!!i)}})}var it=!1,P=null;function re(){return it}function fe(t,e){it=!0,P={parent:e,index:0};try{return W(t,e)}finally{it=!1,P=null}}function Tt(t){let e=t.childNodes;for(;P.index<e.length;){let n=e[P.index];if(n.nodeType===8){let i=n.textContent;if(i==="$"||i==="/$"||i==="[]"||i==="/[]"){P.index++;continue}}return P.index++,n}return null}function ut(){return typeof process<"u"&&!1}function W(t,e){if(t==null||typeof t=="boolean")return null;if(typeof t=="string"||typeof t=="number"){let i=Tt(e),o=String(t);if(i&&i.nodeType===3)return ut()&&i.textContent!==o&&(console.warn(`[what] Hydration mismatch: expected text "${o}", got "${i.textContent}"`),i.textContent=o),i;ut()&&console.warn(`[what] Hydration mismatch: expected text node "${o}", got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createTextNode(o);return i?e.replaceChild(r,i):e.appendChild(r),r}if(typeof t=="function"&&t._lazyChildren)return W(t(),e);if(typeof t=="function"){let i=t(),o=W(i,e),r=N(()=>{let m=t();it||(o=I(e,m,o,null))});return dt(o&&o.nodeType?o:e,r),o}if(Array.isArray(t)){let i=[];for(let o of t){let r=W(o,e);r&&i.push(r)}return i.length===1?i[0]:i}if(typeof t=="object"&&t._vnode){if(typeof t.tag=="function"){let m=bt(),c=t.tag,a=t.props||{},l=t.children||[],y={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:c,_parentCtx:m[m.length-1]||null,_errorBoundary:null};m.push(y);let s,C=null;try{let d={...a};a._$lazyChildren?C=mt(c,d,a._$lazyChildren):d.children=l.length===0?a.children:l.length===1?l[0]:l,s=c(d),C&&C()}catch(d){return m.pop(),_t(d)||console.error("[what] Error in component during hydration:",c.name||"Anonymous",d),null}y.mounted=!0,y._mountCallbacks&&queueMicrotask(()=>{if(!y.disposed)for(let d of y._mountCallbacks)try{d()}catch(b){console.error("[what] onMount error:",b)}});try{let d=W(s,e),b=Array.isArray(d)?d[0]:d;return yt(b&&b.nodeType?b:e,y),d}finally{m.pop()}}let i=Tt(e),o=t.tag.toUpperCase();if(i&&i.nodeType===1&&i.nodeName===o){Wt(i,t.props||{});let m=P;if(P={parent:i,index:0},t.props?.dangerouslySetInnerHTML?.__html==null)for(let a of t.children)W(a,i);return P=m,i}ut()&&console.warn(`[what] Hydration mismatch: expected <${t.tag}>, got ${i?i.nodeName:"nothing"}. Falling back to client render.`);let r=document.createElement(t.tag);for(let m in t.props||{})m==="children"||m==="key"||k(r,m,t.props[m]);for(let m of t.children)I(r,m,null,null);return i?e.replaceChild(r,i):e.appendChild(r),r}if(wt(t))return t;let n=document.createTextNode(String(t));return e.appendChild(n),n}function Wt(t,e){for(let n in e){if(n==="children"||n==="key"||n==="ref"||n==="dangerouslySetInnerHTML"||n==="innerHTML")continue;let i=e[n];if(R(n)){if(typeof i!="function")continue;let o=n.slice(2).toLowerCase();t.addEventListener(o,i);continue}if(n.startsWith("$$")){t[n]=i;continue}if(typeof i=="function"&&!R(n)){n==="class"||n==="className"?N(()=>{t.className=i()||""}):n==="style"&&typeof i()=="object"?N(()=>{rt(t,i())}):N(()=>{k(t,n,i())});continue}}}export{kt as a,vt as b,jt as c,Ft as d,Bt as e,$t as f,te as g,ee as h,k as i,Gt as j,rt as k,Rt as l,Ut as m,qt as n,ne as o,ie as p,oe as q,re as r,fe as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as B}from"./chunk-O3SKPRTY.min.js";var u=typeof globalThis<"u"&&typeof globalThis.__WHAT_DEV__=="boolean"?globalThis.__WHAT_DEV__:import.meta&&import.meta.env?!!import.meta.env.DEV:(typeof process<"u"&&process.env,!1),d=null;function ze(e){u&&(d=e)}var _=null,C=null,b=null,j=!1,P=0,w=[],q=!1,U=Symbol("needs_upstream"),R=null;function S(e,t){let n=e,r=new Set,o=null,s=0;function c(f){u&&j&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(t?` (signal: ${t})`:""));let l=typeof f=="function"?f(n):f;(n===l?n!==0||1/n===1/l:n!==n&&l!==l)||(n=l,o=null,u&&d&&d.onSignalUpdate(i),r.size>0&&re(r))}function i(f){if(arguments.length===0){let l=_;return l!==null&&(l!==o||l._epoch!==s)&&(o=l,s=l._epoch,r.add(l),l.deps.push(r)),n}c(f)}return i.set=c,i.peek=()=>n,i.subscribe=f=>L(()=>f(i())),i._signal=!0,u&&(i._subs=r,t&&(i._debugName=t)),u&&d&&d.onSignalCreate(i),i}function Ve(e){let t,n=!0,r=new Set,o=null,s=0,c=G(()=>{let f=j;u&&(j=!0);try{t=e(),n=!1}finally{u&&(j=f)}},!0);c._level=1,c._computed=!0,c._computedSubs=r,r._owner=c,c._markDirty=()=>{n=!0},c._isDirty=()=>n;function i(){let f=_;return f!==null&&(f!==o||f._epoch!==s)&&(o=f,s=f._epoch,r.add(f),f.deps.push(r)),n&&Y(c),t}return c._onNotify=()=>{n=!0,o=null,r.size>0&&re(r)},i._signal=!0,i.peek=()=>(n&&Y(c),t),i}function Y(e){if(R!==null)throw R.push(e),U;let t=[e];R=t;try{for(;t.length>0;){let n=t[t.length-1];if(!n._isDirty||!n._isDirty()){t.pop();continue}let r=!1,o=n.deps;for(let s=0;s<o.length;s++){let c=o[s]._owner;c&&c._computed&&c._isDirty&&c._isDirty()&&(t.push(c),r=!0)}if(!r)try{let s=n.deps.length;K(n),n.deps.length!==s&&W(n),t.pop()}catch(s){if(s===U)n._markDirty();else throw s}}}finally{R=null}}function W(e){let t=0,n=e.deps;for(let r=0;r<n.length;r++){let o=n[r]._owner;if(o){let s=o._level;s>t&&(t=s)}}e._level=t+1}var be=()=>{};function L(e,t){let n=G(e);n._level=1;let r=_;_=n;try{let s=n.fn();typeof s=="function"&&(n._cleanup=s)}finally{_=r}if(W(n),t?.stable&&(n._stable=!0),n.deps.length===0&&n._cleanup===null)return n.disposed=!0,u&&d&&d.onEffectDispose(n),be;let o=()=>te(n);return C&&C.disposals.push(o),o}function Fe(e){P++;try{e()}finally{P--,P===0&&J()}}function G(e,t){let n={fn:e,deps:[],lazy:t||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null,_cleanup:null,_epoch:0};return u&&d&&d.onEffectCreate(n),n}function K(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(o){u&&console.warn("[what] Error in effect cleanup:",o)}e._cleanup=null}let r=_;_=null;try{let o=e.fn();typeof o=="function"&&(e._cleanup=o)}catch(o){d?.onError&&d.onError(o,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",o)}finally{_=r}u&&d?.onEffectRun&&d.onEffectRun(e);return}let t=e.deps.length===1?e.deps[0]:null;if(ne(e),e._cleanup){try{e._cleanup()}catch(r){u&&d?.onError&&d.onError(r,{type:"effect-cleanup",effect:e}),u&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let n=_;_=e;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){throw r===U||u&&d?.onError&&d.onError(r,{type:"effect",effect:e}),r}finally{_=n}t!==null&&e.deps.length===1&&e.deps[0]===t&&!e._cleanup&&!e._pending&&(e._stable=!0),u&&d?.onEffectRun&&d.onEffectRun(e)}function te(e){if(e.disposed=!0,u&&d&&d.onEffectDispose(e),ne(e),e._cleanup){try{e._cleanup()}catch(t){u&&console.warn("[what] Error in effect cleanup on dispose:",t)}e._cleanup=null}}function ne(e){let t=e.deps;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0,e._epoch++}var F=0,D=null,T=0;function ee(e){if(!e.disposed){if(e._onNotify)e._onNotify();else if(!e._pending)if(P===0&&e._stable){let t=_;_=null;try{let n=e.fn();if(typeof n=="function"){if(e._cleanup)try{e._cleanup()}catch{}e._cleanup=n}}catch(n){u&&d?.onError&&d.onError(n,{type:"effect",effect:e}),u&&console.warn("[what] Error in stable effect:",n)}finally{_=t}}else{e._pending=!0;let t=e._level,n=w.length;n>0&&w[n-1]._level>t&&(q=!0),w.push(e)}}}function re(e){if(F===0){F=1;try{for(let t of e)ee(t);if(T>0){let t=0;for(;t<T;){let n=D[t];D[t]=null,t++;for(let r of n)ee(r)}T=0}}finally{F=0}P===0&&w.length>0&&Ee()}else D===null&&(D=[]),T>=D.length?D.push(e):D[T]=e,T++}var I=!1;function Ee(){I||(I=!0,queueMicrotask(()=>{I=!1,J()}))}var H=!1;function J(){if(!H){H=!0;try{let e=0;for(;w.length>0&&e<25;){let t=w;w=[],t.length>1&&q&&t.sort((n,r)=>n._level-r._level),q=!1;for(let n=0;n<t.length;n++){let r=t[n];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;try{K(r)}catch(s){if(s===U)throw s;u&&d?.onError&&d.onError(s,{type:"effect",effect:r});try{console.error("[what] Uncaught error in effect during update:",s)}catch{}continue}!r._computed&&r.deps.length!==o&&W(r)}}e++}if(e>=25){if(u){let n=w.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${n.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected");for(let t=0;t<w.length;t++)w[t]._pending=!1;w.length=0}}finally{H=!1}}}function $e(e){let t,n=new Set,r=G(()=>{let s=e();if(!Object.is(t,s)){t=s;for(let c of n)if(!c.disposed){if(c._onNotify)c._onNotify();else if(!c._pending){c._pending=!0;let i=c._level,f=w.length;f>0&&w[f-1]._level>i&&(q=!0),w.push(c)}}}});r._level=1,K(r),W(r),n._owner=r,C&&C.disposals.push(()=>te(r));function o(){return _&&(n.add(_),_.deps.push(n)),t}return o._signal=!0,o.peek=()=>t,o}function Ge(){if(H){u&&console.warn("[what] flushSync() called during an active flush (e.g., inside a component render or effect). This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}if(_){u&&console.warn("[what] flushSync() called during effect execution. This is a no-op to prevent infinite loops. Move flushSync() to an event handler or onMount callback.");return}I=!1,J()}function X(e){let t=_;_=null;try{return e()}finally{_=t}}function Ke(){return b}function Je(e,t){let n=b,r=C;b=e,C=e;try{return t()}finally{b=n,C=r}}function Xe(e){let t=C,n=b,r={disposals:[],owner:b,children:[],_disposed:!1};b&&b.children.push(r),C=r,b=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)Q(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();if(r.disposals.length=0,r.owner){let s=r.owner.children.indexOf(r);s>=0&&r.owner.children.splice(s,1)}}})}finally{C=t,b=n}}function Q(e){if(!e._disposed){e._disposed=!0;for(let t=e.children.length-1;t>=0;t--)Q(e.children[t]);e.children.length=0;for(let t=e.disposals.length-1;t>=0;t--)e.disposals[t]();e.disposals.length=0}}function Qe(e){let t=C,n=b,r={disposals:[],owner:null,children:[],_disposed:!1};C=r,b=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let s=r.children.length-1;s>=0;s--)Q(r.children[s]);r.children.length=0;for(let s=r.disposals.length-1;s>=0;s--)r.disposals[s]();r.disposals.length=0}})}finally{C=t,b=n}}function Ze(e){C&&C.disposals.push(e)}if(u&&typeof WeakRef<"u"){let t={signals:new Set,effects:new Set,components:[]};d={__isPreinstallBuffer:!0,onSignalCreate(n){t.signals.size<2e3&&t.signals.add(new WeakRef(n))},onSignalUpdate(){},onEffectCreate(n){t.effects.size<2e3&&t.effects.add(new WeakRef(n))},onEffectDispose(){},onEffectRun(){},onError(){},onComponentMount(n){t.components.length<2e3&&t.components.push(n)},onComponentUnmount(){},__buffer:t}}function Ye(){if(!u)return{signals:[],effects:[],components:[]};let e={signals:[],effects:[],components:[]},t=typeof $<"u"?$:null;if(!t)return e;for(let n of t.signals){let r=n.deref?.();r&&e.signals.push(r)}for(let n of t.effects){let r=n.deref?.();r&&e.effects.push(r)}for(let n of t.components)e.components.push(n);return e}var $=null;u&&d?.__isPreinstallBuffer&&($=d.__buffer);function it(e,t){let n=function(o){return e(o)};return n.displayName=`Memo(${e.name||"Anonymous"})`,n}var oe=null;function se(e){oe=e}function ct(e){let t=null,n=null,r=null,o=new Set;function s(c){if(r)throw r;if(t)return B(t,c);throw n||(n=e().then(i=>{t=i.default||i,o.forEach(f=>f()),o.clear()}).catch(i=>{r=i})),n}return s.displayName="Lazy",s._lazy=!0,s._onLoad=c=>{t?c():o.add(c)},s}function Se({fallback:e,children:t}){let n=S(!1),r=new Set,o=!1;return{tag:"__suspense",props:{boundary:{_suspense:!0,onSuspend(c){o||(n.set(!0),r.add(c),c.then(()=>{r.delete(c),r.size===0&&n.set(!1)},i=>{o=!0,r.delete(c),console.error("[what] Suspense: a suspended child rejected:",i)}))}},fallback:e,loading:n},children:Array.isArray(t)?t:[t],_vnode:!0}}Se._deferChildren=!0;function xe({fallback:e,children:t,onError:n}){let r=S(null);return{tag:"__errorBoundary",props:{errorState:r,handleError:c=>{if(r.set(c),n)try{n(c)}catch(i){console.error("Error in onError handler:",i)}},fallback:e,reset:()=>r.set(null)},children:Array.isArray(t)?t:[t],_vnode:!0}}xe._deferChildren=!0;function ie(e,t){let n=t||oe?.();for(;n;){if(n._errorBoundary)return n._errorBoundary(e),!0;n=n._parentCtx}return!1}function ft({when:e,fallback:t=null,children:n}){return()=>(typeof e=="function"?e():e)?n:t}function lt({each:e,fallback:t=null,children:n}){let r=Array.isArray(n)?n[0]:n;return typeof r!="function"?(console.warn("[what] For: children must be a render function, e.g. <For each={items}>{(item) => ...}</For>"),t):()=>{let o=typeof e=="function"?e():e;return!o||o.length===0?t:o.map((s,c)=>{let i=r(s,c);return i&&typeof i=="object"&&i.key==null&&(s!=null&&typeof s=="object"?s.id!=null?i.key=s.id:s.key!=null&&(i.key=s.key):(typeof s=="string"||typeof s=="number")&&(i.key=s)),i})}}function at({fallback:e=null,children:t}){let n=Array.isArray(t)?t:[t];return()=>{for(let r of n)if(r&&r.tag===ke){let o=r.props.when;if(typeof o=="function"?o():o)return r.children}return e}}function ke(e){return()=>(typeof e.when=="function"?e.when():e.when)?e.children:null}function ut({component:e,mode:t,mediaQuery:n,...r}){let o=B("div",{"data-island":e.name||"Island","data-hydrate":t}),s=S(null),c=S(!1);function i(){c()||(c.set(!0),s.set(B(e,r)))}function f(p){switch(t){case"load":queueMicrotask(i);break;case"idle":typeof requestIdleCallback<"u"?requestIdleCallback(i):setTimeout(i,200);break;case"visible":{let a=new IntersectionObserver(m=>{m[0].isIntersecting&&(a.disconnect(),i())});a.observe(p);break}case"interaction":{let a=()=>{p.removeEventListener("click",a),p.removeEventListener("focus",a),p.removeEventListener("mouseenter",a),i()};p.addEventListener("click",a,{once:!0}),p.addEventListener("focus",a,{once:!0}),p.addEventListener("mouseenter",a,{once:!0});break}case"media":{if(!n){i();break}let a=window.matchMedia(n);if(a.matches)queueMicrotask(i);else{let m=()=>{a.matches&&(a.removeEventListener("change",m),i())};a.addEventListener("change",m)}break}default:queueMicrotask(i)}}let l=p=>{p&&f(p)};return B("div",{"data-island":e.name||"Island","data-hydrate":t,ref:l},c()?s():null)}var ce=!1;function ht(e,t,n){return ce||(ce=!0,console.warn("[what] each() is deprecated. Use the <For> component or Array.map() instead.")),!e||e.length===0?[]:e.map((r,o)=>{let s=t(r,o);return n&&s&&typeof s=="object"&&(s.key=n(r,o)),s})}function _t(...e){let t=[];for(let n of e)if(n){if(typeof n=="string")t.push(n);else if(typeof n=="object")for(let[r,o]of Object.entries(n))o&&t.push(r)}return t.join(" ")}function mt(e){return typeof e=="string"?e:Object.entries(e).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${ve(t)}:${n}`).join(";")}function ve(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function yt(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function gt(e,t){let n=0;return(...r)=>{let o=Date.now();o-n>=t&&(n=o,e(...r))}}var z=null;function fe(e){z=e}function Ct(e){if(typeof window>"u")return S(!1);let t=window.matchMedia(e),n=S(t.matches),r=s=>n.set(s.matches);t.addEventListener("change",r);let o=z?.();return o&&(o._cleanupCallbacks=o._cleanupCallbacks||[],o._cleanupCallbacks.push(()=>t.removeEventListener("change",r))),n}function wt(e,t){let n;try{let i=localStorage.getItem(e);n=i!==null?JSON.parse(i):t}catch{n=t}let r=S(n),o=L(()=>{try{localStorage.setItem(e,JSON.stringify(r()))}catch(i){u&&console.warn("[what] localStorage write failed (quota exceeded?):",i)}}),s=null;typeof window<"u"&&(s=i=>{if(i.key===e&&i.newValue!==null)try{r.set(JSON.parse(i.newValue))}catch(f){u&&console.warn("[what] localStorage parse failed:",f)}},window.addEventListener("storage",s));let c=z?.();return c&&(c._cleanupCallbacks=c._cleanupCallbacks||[],c._cleanupCallbacks.push(()=>{o(),s&&window.removeEventListener("storage",s)})),r}function bt({target:e,children:t}){if(typeof document>"u")return null;let n=typeof e=="string"?document.querySelector(e):e;return n?{tag:"__portal",props:{container:n},children:Array.isArray(t)?t:[t],_vnode:!0}:null}function Et(e,t){if(typeof document>"u")return;let n=o=>{let s=e.current||e;!s||s.contains(o.target)||t(o)};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);let r=z?.();r&&(r._cleanupCallbacks=r._cleanupCallbacks||[],r._cleanupCallbacks.push(()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}))}function St(e,t){return{class:t?`${e}-enter ${e}-enter-active`:`${e}-leave ${e}-leave-active`}}var Le=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),Ne="http://www.w3.org/2000/svg",le=new Set(["href","src","action","formaction","formAction","data","ping","xlink:href","xlinkHref"]),ae=new Set(["srcdoc","srcDoc"]);function Ae(e){if(e==null)return!0;let t;try{t=String(e).trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase()}catch{return!1}return!(t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:"))}function ue(e){if(e.length<=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return(t===111||t===79)&&(n===110||n===78)}function De(e,t){let n=e.toLowerCase();return ae.has(e)||ae.has(n)?!0:!le.has(e)&&!le.has(n)?!1:!Ae(t)}var de=new Set,V=new WeakMap;function Te(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function pe(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function Z(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let t of e.cleanups)try{t()}catch(n){console.error("[what] cleanup error:",n)}if(e.effects)for(let t of e.effects)try{t()}catch{}if(e.hooks){for(let t of e.hooks)if(t&&typeof t.cleanup=="function")try{t.cleanup()}catch(n){console.error("[what] hook cleanup error:",n)}}if(e._cleanupCallbacks)for(let t of e._cleanupCallbacks)try{t()}catch(n){console.error("[what] onCleanup error:",n)}u&&d?.onComponentUnmount&&d.onComponentUnmount(e),de.delete(e)}}function Me(e,t){!e||typeof t!="function"||(e._hydrationDisposers?e._hydrationDisposers.push(t):e._hydrationDisposers=[t])}function Dt(e,t){Me(e,()=>Z(t))}function N(e){if(!e)return;if(e._componentCtx&&Z(e._componentCtx),e._hydrationDisposers){let n=e._hydrationDisposers;e._hydrationDisposers=null;for(let r=0;r<n.length;r++)try{n[r]()}catch{}}if(e.nodeType===8){let n=V.get(e);n&&Z(n)}if(e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let n in e._propEffects)try{e._propEffects[n]()}catch{}let t=e.childNodes;if(t&&t.length>0)for(let n=0;n<t.length;n++)N(t[n])}function Tt(e,t){typeof t=="string"&&(t=document.querySelector(t)),N(t),t.textContent="";let n=x(e,t);return n&&t.appendChild(n),()=>{N(t),t.textContent=""}}function x(e,t,n){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(Te(e))return e;if(typeof e=="function"&&e._mapArray){let r=document.createDocumentFragment(),o=document.createComment("/list-frag");return r.appendChild(o),e(r,o),r}if(typeof e=="function"&&e._lazyChildren)return x(e(),t,n);if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),s=[],c=document.createDocumentFragment();c.appendChild(r),c.appendChild(o);let i=L(()=>{let f=e(),l=f==null||f===!1||f===!0?[]:Array.isArray(f)?f:[f],p=o.parentNode;if(p){for(let a of s)N(a),a.parentNode===p&&p.removeChild(a);s=[];for(let a of l){let m=x(a,p,t?._isSvg);if(m)if(m.nodeType===11){let y=Array.from(m.childNodes);p.insertBefore(m,o);for(let E of y)s.push(E)}else p.insertBefore(m,o),s.push(m)}}});return r._dispose=i,o._dispose=i,c}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let s=x(o,t,n);s&&r.appendChild(s)}return r}return pe(e)&&typeof e.tag=="function"?je(e,t,n):pe(e)&&typeof e.tag=="string"?e.tag==="__errorBoundary"?_e(e,t):e.tag==="__suspense"?me(e,t):e.tag==="__portal"?ye(e,t):He(e,t,n):document.createTextNode(String(e))}var Be={get(e,t){if(t!=="_sig"&&!(t==="__proto__"||t==="constructor"||t==="prototype"))return e._sig()[t]},has(e,t){return t==="_sig"?!1:t in e._sig()},ownKeys(e){return Reflect.ownKeys(e._sig())},getOwnPropertyDescriptor(e,t){if(t==="_sig")return;let n=e._sig();if(t in n)return{value:n[t],writable:!1,enumerable:!0,configurable:!0}},set(e,t){return!1}},g=[];function he(){return g[g.length-1]}se(he);fe(he);function Mt(){return g}function Pe(e,t,n){if(e._deferChildren)return t.children=n,null;let r,o=!1,s=!0;return Object.defineProperty(t,"children",{get(){return s?(o||(o=!0,r=n()),r):n()},enumerable:!0,configurable:!0}),()=>{s=!1,o=!1,r=void 0}}var Oe=Symbol.for("what.navigation.signal");function Re(e){if(e==null)return!1;let t=e[Oe];return typeof t!="function"?!1:(t(e),!0)}function je(e,t,n){let{tag:r,props:o,children:s}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let h=r;r=function(we){return new h(we).render()},r.displayName=h.displayName||h.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return _e(e,t);if(r==="__suspense"||e.tag==="__suspense")return me(e,t);if(r==="__portal"||e.tag==="__portal")return ye(e,t);let c=g[g.length-1]||null,i=null;if(c&&(i=c._errorBoundary||null,!i)){let h=c._parentCtx;for(;h;){if(h._errorBoundary){i=h._errorBoundary;break}h=h._parentCtx}}let f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:c,_errorBoundary:i},l=document.createComment("c:start"),p=document.createComment("c:end");V.set(l,f),f._startComment=l,f._endComment=p;let a=document.createDocumentFragment();a._componentCtx=f,f._wrapper=l,de.add(f),u&&d?.onComponentMount&&d.onComponentMount(f);let m=s.length===0?void 0:s.length===1?s[0]:s,y;m!==void 0?y=o?Object.assign({},o,{children:m}):{children:m}:y=o?Object.assign({},o):{};let E=o&&o._$lazyChildren,k=E?Pe(r,y,E):null,v=S(y);f._propsSignal=v;let A=new Proxy({_sig:v},Be);g.push(f);let O;try{O=X(()=>r(A))}catch(h){if(g.pop(),!Re(h)&&!(h&&typeof h.then=="function"&&Ie(h,f))&&!ie(h,f))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",h),h;return a.appendChild(l),a.appendChild(p),a}k&&k(),f.mounted=!0,f._mountCallbacks&&queueMicrotask(()=>{if(!f.disposed)for(let h of f._mountCallbacks)try{h()}catch(M){console.error("[what] onMount error:",M)}}),a.appendChild(l);let Ce=Array.isArray(O)?O:[O];try{for(let h of Ce){let M=x(h,a,n);M&&a.appendChild(M)}}finally{g.pop()}return a.appendChild(p),a}function Ie(e,t){let n=t;for(;n;){if(n._suspenseBoundary)return n._suspenseBoundary.onSuspend(e),!0;n=n._parentCtx}return!1}function _e(e,t){let{errorState:n,handleError:r,fallback:o,reset:s}=e.props,c=e.children,i=document.createComment("eb:start"),f=document.createComment("eb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:g[g.length-1]||null,_errorBoundary:r,_startComment:i,_endComment:f};V.set(i,l);let p=document.createDocumentFragment();p._componentCtx=l,p.appendChild(i),p.appendChild(f);let a=L(()=>{let m=n();if(g.push(l),i.parentNode)for(;i.nextSibling&&i.nextSibling!==f;){let E=i.nextSibling;N(E),E.parentNode.removeChild(E)}let y;m?y=typeof o=="function"?[o({error:m,reset:s})]:[o]:y=c,y=Array.isArray(y)?y:[y];for(let E of y){let k=x(E,t);k&&(f.parentNode?f.parentNode.insertBefore(k,f):p.insertBefore(k,f))}g.pop()});return l.effects.push(a),p}function me(e,t){let{boundary:n,fallback:r,loading:o}=e.props,s=e.children,c=document.createComment("sb:start"),i=document.createComment("sb:end"),f={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:g[g.length-1]||null,_suspenseBoundary:n,_startComment:c,_endComment:i};V.set(c,f);let l=document.createDocumentFragment();l._componentCtx=f,l.appendChild(c),l.appendChild(i);let p=0,a=L(()=>{let y=o()?[r]:s,E=Array.isArray(y)?y:[y],k=++p;if(g.push(f),c.parentNode)for(;c.nextSibling&&c.nextSibling!==i;){let v=c.nextSibling;N(v),v.parentNode.removeChild(v)}try{for(let v of E){let A=x(v,t);if(k!==p){A&&N(A);break}A&&(i.parentNode?i.parentNode.insertBefore(A,i):l.insertBefore(A,i))}}finally{g.pop()}});return f.effects.push(a),l}function ye(e,t){let{container:n}=e.props,r=e.children;if(!n)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let o={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:g[g.length-1]||null},s=document.createComment("portal");s._componentCtx=o;let c=[];for(let i of r){let f=x(i,n);f&&(n.appendChild(f),c.push(f))}return o._cleanupCallbacks=[()=>{for(let i of c)N(i),i.parentNode&&i.parentNode.removeChild(i)}],s}function He(e,t,n){let{tag:r,props:o,children:s}=e,c=n||Le.has(r),i=c?document.createElementNS(Ne,r):document.createElement(r);o&&qe(i,o,{},c);let f=c&&r!=="foreignObject";for(let l=0;l<s.length;l++){let p=x(s[l],i,f);p&&i.appendChild(p)}return i._vnode=e,i}function qe(e,t,n,r){if(t){for(let o in t)if(!(o==="key"||o==="children")){if(o==="ref"){let s=t.ref;typeof s=="function"?s(e):s&&(s.current=e);continue}ge(e,o,t[o],r)}}}function Ue(e,t){e.value=t,e.value!==String(t)&&queueMicrotask(()=>{e.value=t})}function ge(e,t,n,r){if(typeof n=="function"&&!ue(t)&&t!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[t])try{e._propEffects[t]()}catch{}e._propEffects[t]=L(()=>{let o=n();ge(e,t,o,r)});return}if(ue(t)){if(typeof n!="function"&&n!=null)return;let o=t.slice(2),s=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),s=!0);let c=o.toLowerCase(),i=s?c+"_capture":c,f=e._events?.[i];if(f&&f._original===n||(f&&e.removeEventListener(c,f,s),n==null))return;e._events||(e._events={});let l=a=>(a.nativeEvent||(a.nativeEvent=a),X(()=>l._handler(a)));l._handler=n,l._original=n,e._events[i]=l;let p=n._eventOpts;e.addEventListener(c,l,p||s||void 0);return}if(De(t,n)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${t}" attribute:`,n);return}if(t==="className"||t==="class"){r?e.setAttribute("class",n||""):e.className=n||"";return}if(t==="style"){if(typeof n=="string")e.style.cssText=n,e._prevStyle=null;else if(typeof n=="object"){let o=e._prevStyle||{};for(let s in o)s in n||(e.style[s]="");for(let s in n)e.style[s]=n[s]??"";e._prevStyle={...n}}return}if(t==="dangerouslySetInnerHTML"){let o=n?.__html??"";u&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o;return}if(t==="innerHTML"){if(n==null)return;if(n&&typeof n=="object"&&"__html"in n){let o=n.__html??"";u&&typeof o=="string"&&/(<script|onerror\s*=|onload\s*=|javascript:)/i.test(o)&&console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized."),e.innerHTML=o}else{u&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(n==null){if(t in e)try{e[t]=""}catch{}e.removeAttribute(t);return}if(typeof n=="boolean"){n?e.setAttribute(t,""):e.removeAttribute(t);return}if(t.startsWith("data-")||t.startsWith("aria-")){e.setAttribute(t,n);return}if(r){n===!1||n==null?e.removeAttribute(t):e.setAttribute(t,n===!0?"":String(n));return}if(t==="value"&&e.tagName==="SELECT"){Ue(e,n);return}t in e?e[t]=n:e.setAttribute(t,n)}export{u as a,ze as b,S as c,Ve as d,L as e,Fe as f,$e as g,Ge as h,X as i,Ke as j,Je as k,Xe as l,Qe as m,Ze as n,Ye as o,it as p,ct as q,Se as r,xe as s,ft as t,lt as u,at as v,ke as w,ut as x,ht as y,_t as z,mt as A,yt as B,gt as C,Ct as D,wt as E,bt as F,Et as G,St as H,ue as I,De as J,Me as K,Dt as L,N as M,Tt as N,x as O,he as P,Mt as Q,Pe as R,Re as S,Ue as T};
|
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Yt,b as Xt,c as Wt,d as Pe,e as Qt,f as zt,g as Kt,h as Ut,i as Jt,o as Zt,p as en,q as tn,r as nn,s as rn}from"./chunk-H67HFVDV.min.js";import{A as Nt,B as Ot,C as $t,D as Ht,E as Vt,F as jt,G as qt,H as Bt,J as Gt,L as $,a as F,b as gt,c as l,d as N,e as O,f as M,g as mt,h as yt,i as le,j as xt,k as vt,l as wt,n as bt,o as kt,p as Ct,q as _t,r as At,s as It,t as Rt,u as Tt,v as Mt,w as Lt,x as Dt,y as Ft,z as Pt}from"./chunk-5QCEMXNL.min.js";import{a as w,b as St,c as Et}from"./chunk-O3SKPRTY.min.js";var se=null,fe=null;function on(e){fe||(fe=e)}function ie(){return fe?.getStore()??se}function sn(e){let t=se;return se=e,t}function an(e,t){if(fe)return fe.run(e,t);let n=se;se=e;try{return t()}finally{se=n}}var Q;function Ce(){if(Q!==void 0)return Q;if(typeof document>"u")return Q=null;let e=document.getElementById("__what_data");if(!e)return Q=null;try{Q=JSON.parse(e.textContent)}catch{Q=null}return Q}function cn(){Q=void 0}function _e(){let e=Ce();return e?e.loaderData:void 0}function Ae(e){let t=Ce();return t&&t.resources?t.resources[e]:void 0}function un(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return _e()}function j(e){let t=$();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 z(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function ln(e){let t=j("useState"),{index:n,exists:r}=z(t);if(!r){let s=l(typeof e=="function"?e():e);t.hooks[n]=s}let o=t.hooks[n];return[o,o.set]}function fn(e){let t=j("useSignal"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=l(typeof e=="function"?e():e)),t.hooks[n]}function dn(e){let t=j("useComputed"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=N(e)),t.hooks[n]}function pn(e,t){let n=j("useEffect"),{index:r,exists:o}=z(n);if(o||(n.hooks[r]={cleanup:null,dispose:null}),F&&Array.isArray(t)&&t.length>0)for(let i=0;i<t.length;i++){let a=t[i];a!=null&&typeof a!="function"&&console.warn(`[what] useEffect dep at index ${i} 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=O(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=e();typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let i=e();typeof i=="function"&&(s.cleanup=i)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{for(let a=0;a<t.length;a++){let u=t[a];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=le(()=>e());typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function hn(e,t){let n=j("useMemo"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={computed:N(e)}),n.hooks[r].computed}function gn(e,t){let n=j("useCallback"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function mn(e){let t=j("useRef"),{index:n,exists:r}=z(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Ne(e){let t=$();for(F&&!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 yn(e){let t={_defaultValue:e,Provider:({value:n,children:r})=>{let o=j("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=l(n);o._contextSignals.set(t,s),o._contextValues.set(t,s)}return r},Consumer:({children:n})=>{let r=Ne(t);return typeof n=="function"?n(r):n}};return t}function xn(e,t,n){let r=j("useReducer"),{index:o,exists:s}=z(r);if(!s){let a=n?n(t):t,u=l(a),f=c=>{u.set(d=>e(d,c))};r.hooks[o]={signal:u,dispatch:f}}let i=r.hooks[o];return[i.signal,i.dispatch]}function vn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function wn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function bn(e,t={}){if(typeof document>"u"){let c=ie();if(c){let d=t.key!=null?t.key:`__r${c.resourceCounter++}`,h=c.resources.get(d);if(h&&h.status==="ready")return[()=>h.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(h&&h.status==="error")return[()=>{},{loading:()=>!1,error:()=>h.error,refetch:()=>{},mutate:()=>{}}];if(!h){let v=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{c.resources.set(d,{status:"ready",value:b})}).catch(b=>{c.resources.set(d,{status:"error",error:b})});throw c.resources.set(d,{status:"pending",promise:v}),v}throw h.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 c=Ae(t.key);c!==void 0&&(n=c)}let r=l(n??null),o=l(n==null),s=l(null),i=null,a=async c=>{i&&i.abort(),i=new AbortController;let{signal:d}=i;o.set(!0),s.set(null);try{let h=await e(c,{signal:d});d.aborted||M(()=>{r.set(h),o.set(!1)})}catch(h){d.aborted||M(()=>{s.set(h),o.set(!1)})}},u=c=>{r.set(typeof c=="function"?c(r()):c)},f=$?.();return f&&(f._cleanupCallbacks=f._cleanupCallbacks||[],f._cleanupCallbacks.push(()=>{i&&i.abort()})),n==null&&a(t.source),[r,{loading:o,error:s,refetch:a,mutate:u}]}function He(e){return e._storeComputed=!0,e}var Oe=!1;function kn(e){return Oe||(Oe=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),He(e)}function Sn(e){let t={},n={},r={},o={};for(let[s,i]of Object.entries(e))typeof i=="function"&&i._storeComputed?(F&&i.length===0&&console.warn(`[what] derived() for "${s}" should accept the state parameter, e.g. derived(state => ...).`),n[s]=i):typeof i=="function"?r[s]=i:t[s]=l(i);for(let[s,i]of Object.entries(n)){let a=new Proxy({},{get(u,f){if(t[f])return t[f]();if(n[f])return n[f]()}});n[s]=N(()=>i(a))}for(let[s,i]of Object.entries(r))r[s]=(...a)=>{let u;return M(()=>{let f=new Proxy({},{get(c,d){if(t[d])return t[d].peek();if(n[d])return n[d].peek();if(r[d])return r[d]},set(c,d,h){return t[d]&&t[d].set(h),!0}});u=i.apply(f,a)}),u};return function(){let i={};for(let[a,u]of Object.entries(t))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(n))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(r))i[a]=u;return i}}var $e=!1;function En(e){return $e||($e=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ie={title:null,metas:new Map,links:new Map};function Cn({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ie();return o&&o.head&&An(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ie.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);je("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");je("link",s,o)}return r||null}function _n(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function An(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(_n(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function In(){return{title:null,metas:new Map,links:new Map}}function Rn(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${qe(String(e.title))}</title>`);for(let n of e.metas.values())t+=Ve("meta",n);for(let n of e.links.values())t+=Ve("link",n);return t}function Ve(e,t){let n=`<${e}`;for(let[r,o]of Object.entries(t)){if(o==null||o===!1)continue;n+=` ${r==="httpEquiv"?"http-equiv":r}="${qe(String(o))}"`}return n+">"}function qe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function je(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){Tn(r,n);return}let o=document.createElement(e);o.setAttribute("data-what-head",t);for(let[s,i]of Object.entries(n))o.setAttribute(s,i);document.head.appendChild(o)}function Tn(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Mn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ie.metas.clear(),Ie.links.clear()}var pe=[],he=[],Te=!1;function G(e){return pe.push(e),Ge(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function K(e){return he.push(e),Ge(),()=>{let t=he.indexOf(e);t!==-1&&he.splice(t,1)}}function Be(){for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;he.length>0;){let e=he.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Te=!1}function Ge(){Te||(Te=!0,requestAnimationFrame(Be))}function Ln(e){return new Promise(t=>{G(()=>{t(e())})})}function Dn(e){return new Promise(t=>{K(()=>{e(),t()})})}function Fn(e,t){let n=Symbol("scheduledEffect");return O(()=>{Ye(n,()=>{G(()=>{let r=e();t&&K(()=>t(r))})})})}function Pn(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var de=new Map;function Ye(e,t){de.has(e)?de.set(e,t):(de.set(e,t),requestAnimationFrame(()=>{let n=de.get(e);de.delete(e),n&&n()}))}var Re=new WeakMap,ve=null;function Nn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(ve||(ve=new ResizeObserver(n=>{G(()=>{for(let r of n){let o=Re.get(r.target);o&&o(r.contentRect)}})})),Re.set(e,t),ve.observe(e),()=>{Re.delete(e),ve.unobserve(e)})}function On(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let r=new IntersectionObserver(o=>{G(()=>{for(let s of o)t(s)})},n);return r.observe(e),()=>r.disconnect()}function $n(e,t={}){let{duration:n=300,easing:r=o=>o*(2-o)}=t;return new Promise(o=>{let s,i,a;G(()=>{s=window.scrollY;let f=e.getBoundingClientRect();i=s+f.top,a=performance.now(),u()});function u(){G(()=>{let f=performance.now()-a,c=Math.min(f/n,1),d=r(c),h=s+(i-s)*d;K(()=>{window.scrollTo(0,h),c<1?requestAnimationFrame(u):o()})})}})}function Xe(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function We(e,t={}){let{stiffness:n=100,damping:r=10,mass:o=1,precision:s=.01}=t,i=l(e),a=l(e),u=l(0),f=l(!1),c=null,d=null;function h(y){if(d===null){d=y,c=requestAnimationFrame(h);return}let I=Math.min((y-d)/1e3,.064);d=y;let m=i.peek(),R=a.peek(),_=u.peek(),x=m-R,g=-n*x,L=-r*_,k=(g+L)/o,D=_+k*I,P=m+D*I;if(M(()=>{u.set(D),i.set(P)}),Math.abs(D)<s&&Math.abs(x)<s){M(()=>{i.set(R),u.set(0),f.set(!1)}),c=null,d=null;return}c=requestAnimationFrame(h)}function v(y){a.set(y),c===null&&(f.set(!0),d=null,c=requestAnimationFrame(h))}function b(){c&&(cancelAnimationFrame(c),c=null),f.set(!1),d=null}function E(y){b(),M(()=>{i.set(y),a.set(y),u.set(0)})}let S=$?.();return S&&(S._cleanupCallbacks=S._cleanupCallbacks||[],S._cleanupCallbacks.push(b)),{current:()=>i(),target:()=>a(),velocity:()=>u(),isAnimating:()=>f(),set:v,stop:b,snap:E,subscribe:i.subscribe}}function Qe(e,t,n={}){let{duration:r=300,easing:o=v=>v*(2-v),onUpdate:s,onComplete:i}=n,a=l(0),u=l(e),f=l(!0),c=null,d=null;function h(v){c===null&&(c=v);let b=v-c,E=Math.min(b/r,1),S=o(E),y=e+(t-e)*S;M(()=>{a.set(E),u.set(y)}),s&&s(y,E),E<1?d=requestAnimationFrame(h):(f.set(!1),i&&i())}return d=requestAnimationFrame(h),{progress:()=>a(),value:()=>u(),isAnimating:()=>f(),cancel:()=>{d&&cancelAnimationFrame(d),f.set(!1)},subscribe:u.subscribe}}var ze={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 Hn(e={}){let{duration:t=300,easing:n=ze.easeOutQuad}=e,r=l(!1),o=l(0);async function s(i){return r.set(!0),o.set(0),new Promise(a=>{let u=performance.now();function f(c){let d=c-u,h=Math.min(d/t,1);o.set(n(h)),h<1?requestAnimationFrame(f):(r.set(!1),i&&i(),a())}requestAnimationFrame(f)})}return{isTransitioning:()=>r(),progress:()=>o(),start:s}}function Vn(e,t={}){let{onDrag:n,onDragStart:r,onDragEnd:o,onPinch:s,onSwipe:i,onTap:a,onLongPress:u,preventDefault:f=!1}=t,c={isDragging:l(!1),startX:0,startY:0,currentX:l(0),currentY:l(0),deltaX:l(0),deltaY:l(0),velocity:l({x:0,y:0})},d=0,h=0,v=0,b=null;function E(x){let g=x.touches?x.touches[0]:x;c.startX=g.clientX,c.startY=g.clientY,h=g.clientX,v=g.clientY,d=performance.now(),c.isDragging.set(!0),r&&r({x:c.startX,y:c.startY}),u&&(b=setTimeout(()=>{c.isDragging.peek()&&u({x:h,y:v})},500))}function S(x){if(!c.isDragging.peek())return;let g=x.touches?x.touches[0]:x,L=g.clientX,k=g.clientY,D=performance.now(),P=D-d;M(()=>{c.currentX.set(L),c.currentY.set(k),c.deltaX.set(L-c.startX),c.deltaY.set(k-c.startY),P>0&&c.velocity.set({x:(L-h)/P*1e3,y:(k-v)/P*1e3})}),h=L,v=k,d=D,b&&Math.sqrt(c.deltaX.peek()**2+c.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:L,y:k,deltaX:c.deltaX.peek(),deltaY:c.deltaY.peek(),velocity:c.velocity.peek()})}function y(x){if(!c.isDragging.peek())return;b&&(clearTimeout(b),b=null);let g=c.deltaX.peek(),L=c.deltaY.peek(),k=c.velocity.peek();if(Math.sqrt(g**2+L**2)<10&&a&&a({x:c.startX,y:c.startY}),i&&(Math.abs(k.x)>500||Math.abs(k.y)>500)){let P=Math.abs(k.x)>Math.abs(k.y)?k.x>0?"right":"left":k.y>0?"down":"up";i({direction:P,velocity:k})}o&&o({deltaX:g,deltaY:L,velocity:k}),c.isDragging.set(!1)}let I=null;function m(x){if(!s||x.touches.length!==2)return;let g=x.touches[0],L=x.touches[1],k=Math.sqrt((L.clientX-g.clientX)**2+(L.clientY-g.clientY)**2);I===null&&(I=k);let D=k/I,P=(g.clientX+L.clientX)/2,ee=(g.clientY+L.clientY)/2;s({scale:D,centerX:P,centerY:ee})}function R(){I=null}typeof e=="function"?Xe(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?Xe(()=>{let x=e.current;if(x)return _(x)}):e&&_(e);function _(x){return x.addEventListener("mousedown",E),x.addEventListener("touchstart",E,{passive:!f}),window.addEventListener("mousemove",S),window.addEventListener("touchmove",m),window.addEventListener("touchmove",S),window.addEventListener("mouseup",y),window.addEventListener("touchend",y),window.addEventListener("touchend",R),()=>{x.removeEventListener("mousedown",E),x.removeEventListener("touchstart",E),window.removeEventListener("mousemove",S),window.removeEventListener("touchmove",m),window.removeEventListener("touchmove",S),window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y),window.removeEventListener("touchend",R)}}return c}function jn(e){let t=l(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=We(t.peek(),o);s.set(r);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=Qe(t.peek(),r,{...o,onUpdate:i=>t.set(i)});return{stop:()=>s.cancel()}},interpolate(r,o){return()=>{let s=t();for(let i=0;i<r.length-1;i++)if(s>=r[i]&&s<=r[i+1]){let a=(s-r[i])/(r[i+1]-r[i]);return o[i]+(o[i+1]-o[i])*a}return s<=r[0]?o[0]:o[o.length-1]}},subscribe:t.subscribe}}function Ke(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 qn(e,t,n="enter",r=300){let o=Ke(t);return new Promise(s=>{K(()=>{e.classList.add(o[n]),G(()=>{e.offsetHeight,K(()=>{e.classList.add(o[`${n}Active`]),setTimeout(()=>{K(()=>{e.classList.remove(o[n],o[`${n}Active`]),e.classList.add(o[`${n}Done`]),s()})},r)})})})})}var Je=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Je.set(e.target)});function Bn(){return{current:()=>Je(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function Gn(){let e={current:null};function t(r){typeof document>"u"||(e.current=r||document.activeElement||null)}function n(r){let o=e.current||r;o&&typeof o.focus=="function"&&o.focus()}return{capture:t,restore:n,previous:()=>e.current}}function Ze(e){let t=null;function n(){if(typeof document>"u")return;t=document.activeElement;let o=e.current||e;if(!o||typeof o.querySelectorAll!="function")return;let s=Ue(o);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ue(o),f=u[0],c=u[u.length-1];a.shiftKey?document.activeElement===f&&(a.preventDefault(),c.focus()):document.activeElement===c&&(a.preventDefault(),f.focus())}return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}}function r(){t&&typeof t.focus=="function"&&t.focus()}return{activate:n,deactivate:r}}function Ue(e){let t=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter(n=>n.offsetParent!==null)}function Yn({children:e,active:t=!0}){let n={current:null},r=l(0),o=Ze(n),s=null,i=f=>{n.current=f,r.set(c=>c+1)},a=O(()=>{if(r(),s&&(s(),s=null,o.deactivate()),t&&n.current)return s=o.activate(),()=>{s?.(),s=null,o.deactivate()}}),u=$?.();return u&&(u._cleanupCallbacks=u._cleanupCallbacks||[],u._cleanupCallbacks.push(()=>{a(),s?.(),s=null,o.deactivate()})),w("div",{ref:i},e)}var U=null,Me=0;function Xn(){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=`
|
|
1
|
+
import{a as Xt,b as Qt,c as zt,d as Oe,e as Ut,f as Kt,g as Jt,h as Zt,i as en,o as tn,p as nn,q as rn,r as on,s as sn}from"./chunk-JIZR6JX5.min.js";import{A as $t,B as Ht,C as Vt,D as jt,E as qt,F as Bt,G as Gt,H as Wt,N as Yt,P as $,a as F,b as yt,c as l,d as N,e as O,f as D,g as xt,h as vt,i as le,j as wt,k as bt,l as kt,n as St,o as Et,p as At,q as Rt,r as It,s as Tt,t as Dt,u as Lt,v as Mt,w as Ft,x as Pt,y as Nt,z as Ot}from"./chunk-PABR63P3.min.js";import{a as w,b as Ct,c as _t}from"./chunk-O3SKPRTY.min.js";var se=null,fe=null;function an(e){fe||(fe=e)}function ie(){return fe?.getStore()??se}function cn(e){let t=se;return se=e,t}function un(e,t){if(fe)return fe.run(e,t);let n=se;se=e;try{return t()}finally{se=n}}var Q;function _e(){if(Q!==void 0)return Q;if(typeof document>"u")return Q=null;let e=document.getElementById("__what_data");if(!e)return Q=null;try{Q=JSON.parse(e.textContent)}catch{Q=null}return Q}function ln(){Q=void 0}function Ae(){let e=_e();return e?e.loaderData:void 0}function Re(e){let t=_e();return t&&t.resources?t.resources[e]:void 0}function fn(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return Ae()}function j(e){let t=$();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 z(e){let t=e.hookIndex++;return{index:t,exists:t<e.hooks.length}}function dn(e){let t=j("useState"),{index:n,exists:o}=z(t);if(!o){let s=l(typeof e=="function"?e():e);t.hooks[n]=s}let r=t.hooks[n];return[r,r.set]}function pn(e){let t=j("useSignal"),{index:n,exists:o}=z(t);return o||(t.hooks[n]=l(typeof e=="function"?e():e)),t.hooks[n]}function hn(e){let t=j("useComputed"),{index:n,exists:o}=z(t);return o||(t.hooks[n]=N(e)),t.hooks[n]}function gn(e,t){let n=j("useEffect"),{index:o,exists:r}=z(n);if(r||(n.hooks[o]={cleanup:null,dispose:null}),F&&Array.isArray(t)&&t.length>0)for(let i=0;i<t.length;i++){let a=t[i];a!=null&&typeof a!="function"&&console.warn(`[what] useEffect dep at index ${i} is not a function. Did you mean to pass a signal? Use count instead of count()`)}let s=n.hooks[o];s.dispose||(t===void 0?queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=e();typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}):t.length===0?(queueMicrotask(()=>{if(n.disposed)return;let i=e();typeof i=="function"&&(s.cleanup=i)}),s.dispose=!0):queueMicrotask(()=>{n.disposed||(s.dispose=O(()=>{for(let a=0;a<t.length;a++){let u=t[a];typeof u=="function"&&u._signal&&u()}if(s.cleanup){try{s.cleanup()}catch{}s.cleanup=null}let i=le(()=>e());typeof i=="function"&&(s.cleanup=i)}),n.effects=n.effects||[],n.effects.push(s.dispose))}))}function mn(e,t){let n=j("useMemo"),{index:o,exists:r}=z(n);return r||(n.hooks[o]={computed:N(e)}),n.hooks[o].computed}function yn(e,t){let n=j("useCallback"),{index:o,exists:r}=z(n);return r||(n.hooks[o]={callback:e}),n.hooks[o].callback}function xn(e){let t=j("useRef"),{index:n,exists:o}=z(t);return o||(t.hooks[n]={current:e}),t.hooks[n]}function $e(e){let t=$();for(F&&!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 vn(e){let t={_defaultValue:e,Provider:({value:n,children:o})=>{let r=j("Context.Provider");if(r._contextValues||(r._contextValues=new Map),r._contextSignals||(r._contextSignals=new Map),r._contextSignals.has(t))r._contextSignals.get(t).set(n);else{let s=l(n);r._contextSignals.set(t,s),r._contextValues.set(t,s)}return o},Consumer:({children:n})=>{let o=$e(t);return typeof n=="function"?n(o):n}};return t.Provider._deferChildren=!0,t}function wn(e,t,n){let o=j("useReducer"),{index:r,exists:s}=z(o);if(!s){let a=n?n(t):t,u=l(a),f=c=>{u.set(d=>e(d,c))};o.hooks[r]={signal:u,dispatch:f}}let i=o.hooks[r];return[i.signal,i.dispatch]}function bn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function kn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function Sn(e,t={}){if(typeof document>"u"){let c=ie();if(c){let d=t.key!=null?t.key:`__r${c.resourceCounter++}`,h=c.resources.get(d);if(h&&h.status==="ready")return[()=>h.value,{loading:()=>!1,error:()=>null,refetch:()=>{},mutate:()=>{}}];if(h&&h.status==="error")return[()=>{},{loading:()=>!1,error:()=>h.error,refetch:()=>{},mutate:()=>{}}];if(!h){let v=Promise.resolve().then(()=>e(t.source??!0,{})).then(b=>{c.resources.set(d,{status:"ready",value:b})}).catch(b=>{c.resources.set(d,{status:"error",error:b})});throw c.resources.set(d,{status:"pending",promise:v}),v}throw h.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 c=Re(t.key);c!==void 0&&(n=c)}let o=l(n??null),r=l(n==null),s=l(null),i=null,a=async c=>{i&&i.abort(),i=new AbortController;let{signal:d}=i;r.set(!0),s.set(null);try{let h=await e(c,{signal:d});d.aborted||D(()=>{o.set(h),r.set(!1)})}catch(h){d.aborted||D(()=>{s.set(h),r.set(!1)})}},u=c=>{o.set(typeof c=="function"?c(o()):c)},f=$?.();return f&&(f._cleanupCallbacks=f._cleanupCallbacks||[],f._cleanupCallbacks.push(()=>{i&&i.abort()})),n==null&&a(t.source),[o,{loading:r,error:s,refetch:a,mutate:u}]}function je(e){return e._storeComputed=!0,e}var He=!1;function En(e){return He||(He=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),je(e)}function Cn(e){let t={},n={},o={},r={};for(let[s,i]of Object.entries(e))typeof i=="function"&&i._storeComputed?(F&&i.length===0&&console.warn(`[what] derived() for "${s}" should accept the state parameter, e.g. derived(state => ...).`),n[s]=i):typeof i=="function"?o[s]=i:t[s]=l(i);for(let[s,i]of Object.entries(n)){let a=new Proxy({},{get(u,f){if(t[f])return t[f]();if(n[f])return n[f]()}});n[s]=N(()=>i(a))}for(let[s,i]of Object.entries(o))o[s]=(...a)=>{let u;return D(()=>{let f=new Proxy({},{get(c,d){if(t[d])return t[d].peek();if(n[d])return n[d].peek();if(o[d])return o[d]},set(c,d,h){return t[d]&&t[d].set(h),!0}});u=i.apply(f,a)}),u};return function(){let i={};for(let[a,u]of Object.entries(t))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(n))Object.defineProperty(i,a,{get:()=>u(),enumerable:!0});for(let[a,u]of Object.entries(o))i[a]=u;return i}}var Ve=!1;function _n(e){return Ve||(Ve=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ie={title:null,metas:new Map,links:new Map};function An({title:e,meta:t,link:n,children:o}){if(typeof document>"u"){let r=ie();return r&&r.head&&In(r.head,{title:e,meta:t,link:n}),o??null}if(e&&(document.title=e,Ie.title=e),t)for(let r of Array.isArray(t)?t:[t]){let s=r.name||r.property||r.httpEquiv||JSON.stringify(r);Be("meta",s,r)}if(n)for(let r of Array.isArray(n)?n:[n]){let s=r.rel+(r.href||"");Be("link",s,r)}return o||null}function Rn(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function In(e,{title:t,meta:n,link:o}){if(t!=null&&(e.title=t),n)for(let r of Array.isArray(n)?n:[n])e.metas.set(Rn(r),r);if(o)for(let r of Array.isArray(o)?o:[o])e.links.set(r.rel+(r.href||""),r)}function Tn(){return{title:null,metas:new Map,links:new Map}}function Dn(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${Ge(String(e.title))}</title>`);for(let n of e.metas.values())t+=qe("meta",n);for(let n of e.links.values())t+=qe("link",n);return t}var Ln=/^[a-zA-Z_:][a-zA-Z0-9:._-]*$/;function Te(e){if(!Ln.test(e))return!1;let t=e.toLowerCase();return!(t.startsWith("on")&&t.length>2)}function ve(e){return e==="httpEquiv"?"http-equiv":e}function qe(e,t){let n=`<${e}`;for(let[o,r]of Object.entries(t)){if(r==null||r===!1)continue;let s=ve(o);Te(s)&&(n+=` ${s}="${Ge(String(r))}"`)}return n+">"}function Ge(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Mn(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 Be(e,t,n){let o=document.head.querySelector(`[data-what-head="${Mn(t)}"]`);if(o){Fn(o,n);return}let r=document.createElement(e);r.setAttribute("data-what-head",t);for(let[s,i]of Object.entries(n))Te(ve(s))&&r.setAttribute(ve(s),i);document.head.appendChild(r)}function Fn(e,t){for(let[n,o]of Object.entries(t)){let r=ve(n);Te(r)&&e.getAttribute(r)!==o&&e.setAttribute(r,o)}}function Pn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ie.metas.clear(),Ie.links.clear()}var pe=[],he=[],Le=!1;function G(e){return pe.push(e),Ye(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function U(e){return he.push(e),Ye(),()=>{let t=he.indexOf(e);t!==-1&&he.splice(t,1)}}function We(){for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;he.length>0;){let e=he.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Le=!1}function Ye(){Le||(Le=!0,requestAnimationFrame(We))}function Nn(e){return new Promise(t=>{G(()=>{t(e())})})}function On(e){return new Promise(t=>{U(()=>{e(),t()})})}function $n(e,t){let n=Symbol("scheduledEffect");return O(()=>{Xe(n,()=>{G(()=>{let o=e();t&&U(()=>t(o))})})})}function Hn(){let e,t=new Promise((n,o)=>{let r=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(r),o(new Error("Cancelled"))}});return t.cancel=e,t}var de=new Map;function Xe(e,t){de.has(e)?de.set(e,t):(de.set(e,t),requestAnimationFrame(()=>{let n=de.get(e);de.delete(e),n&&n()}))}var De=new WeakMap,we=null;function Vn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(we||(we=new ResizeObserver(n=>{G(()=>{for(let o of n){let r=De.get(o.target);r&&r(o.contentRect)}})})),De.set(e,t),we.observe(e),()=>{De.delete(e),we.unobserve(e)})}function jn(e,t,n={}){if(typeof IntersectionObserver>"u")return t({isIntersecting:!0,intersectionRatio:1}),()=>{};let o=new IntersectionObserver(r=>{G(()=>{for(let s of r)t(s)})},n);return o.observe(e),()=>o.disconnect()}function qn(e,t={}){let{duration:n=300,easing:o=r=>r*(2-r)}=t;return new Promise(r=>{let s,i,a;G(()=>{s=window.scrollY;let f=e.getBoundingClientRect();i=s+f.top,a=performance.now(),u()});function u(){G(()=>{let f=performance.now()-a,c=Math.min(f/n,1),d=o(c),h=s+(i-s)*d;U(()=>{window.scrollTo(0,h),c<1?requestAnimationFrame(u):r()})})}})}function Qe(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function ze(e,t={}){let{stiffness:n=100,damping:o=10,mass:r=1,precision:s=.01}=t,i=l(e),a=l(e),u=l(0),f=l(!1),c=null,d=null;function h(y){if(d===null){d=y,c=requestAnimationFrame(h);return}let R=Math.min((y-d)/1e3,.064);d=y;let m=i.peek(),I=a.peek(),_=u.peek(),x=m-I,g=-n*x,L=-o*_,k=(g+L)/r,M=_+k*R,P=m+M*R;if(D(()=>{u.set(M),i.set(P)}),Math.abs(M)<s&&Math.abs(x)<s){D(()=>{i.set(I),u.set(0),f.set(!1)}),c=null,d=null;return}c=requestAnimationFrame(h)}function v(y){a.set(y),c===null&&(f.set(!0),d=null,c=requestAnimationFrame(h))}function b(){c&&(cancelAnimationFrame(c),c=null),f.set(!1),d=null}function E(y){b(),D(()=>{i.set(y),a.set(y),u.set(0)})}let S=$?.();return S&&(S._cleanupCallbacks=S._cleanupCallbacks||[],S._cleanupCallbacks.push(b)),{current:()=>i(),target:()=>a(),velocity:()=>u(),isAnimating:()=>f(),set:v,stop:b,snap:E,subscribe:i.subscribe}}function Ue(e,t,n={}){let{duration:o=300,easing:r=v=>v*(2-v),onUpdate:s,onComplete:i}=n,a=l(0),u=l(e),f=l(!0),c=null,d=null;function h(v){c===null&&(c=v);let b=v-c,E=Math.min(b/o,1),S=r(E),y=e+(t-e)*S;D(()=>{a.set(E),u.set(y)}),s&&s(y,E),E<1?d=requestAnimationFrame(h):(f.set(!1),i&&i())}return d=requestAnimationFrame(h),{progress:()=>a(),value:()=>u(),isAnimating:()=>f(),cancel:()=>{d&&cancelAnimationFrame(d),f.set(!1)},subscribe:u.subscribe}}var Ke={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 Bn(e={}){let{duration:t=300,easing:n=Ke.easeOutQuad}=e,o=l(!1),r=l(0);async function s(i){return o.set(!0),r.set(0),new Promise(a=>{let u=performance.now();function f(c){let d=c-u,h=Math.min(d/t,1);r.set(n(h)),h<1?requestAnimationFrame(f):(o.set(!1),i&&i(),a())}requestAnimationFrame(f)})}return{isTransitioning:()=>o(),progress:()=>r(),start:s}}function Gn(e,t={}){let{onDrag:n,onDragStart:o,onDragEnd:r,onPinch:s,onSwipe:i,onTap:a,onLongPress:u,preventDefault:f=!1}=t,c={isDragging:l(!1),startX:0,startY:0,currentX:l(0),currentY:l(0),deltaX:l(0),deltaY:l(0),velocity:l({x:0,y:0})},d=0,h=0,v=0,b=null;function E(x){let g=x.touches?x.touches[0]:x;c.startX=g.clientX,c.startY=g.clientY,h=g.clientX,v=g.clientY,d=performance.now(),c.isDragging.set(!0),o&&o({x:c.startX,y:c.startY}),u&&(b=setTimeout(()=>{c.isDragging.peek()&&u({x:h,y:v})},500))}function S(x){if(!c.isDragging.peek())return;let g=x.touches?x.touches[0]:x,L=g.clientX,k=g.clientY,M=performance.now(),P=M-d;D(()=>{c.currentX.set(L),c.currentY.set(k),c.deltaX.set(L-c.startX),c.deltaY.set(k-c.startY),P>0&&c.velocity.set({x:(L-h)/P*1e3,y:(k-v)/P*1e3})}),h=L,v=k,d=M,b&&Math.sqrt(c.deltaX.peek()**2+c.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:L,y:k,deltaX:c.deltaX.peek(),deltaY:c.deltaY.peek(),velocity:c.velocity.peek()})}function y(x){if(!c.isDragging.peek())return;b&&(clearTimeout(b),b=null);let g=c.deltaX.peek(),L=c.deltaY.peek(),k=c.velocity.peek();if(Math.sqrt(g**2+L**2)<10&&a&&a({x:c.startX,y:c.startY}),i&&(Math.abs(k.x)>500||Math.abs(k.y)>500)){let P=Math.abs(k.x)>Math.abs(k.y)?k.x>0?"right":"left":k.y>0?"down":"up";i({direction:P,velocity:k})}r&&r({deltaX:g,deltaY:L,velocity:k}),c.isDragging.set(!1)}let R=null;function m(x){if(!s||x.touches.length!==2)return;let g=x.touches[0],L=x.touches[1],k=Math.sqrt((L.clientX-g.clientX)**2+(L.clientY-g.clientY)**2);R===null&&(R=k);let M=k/R,P=(g.clientX+L.clientX)/2,ee=(g.clientY+L.clientY)/2;s({scale:M,centerX:P,centerY:ee})}function I(){R=null}typeof e=="function"?Qe(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?Qe(()=>{let x=e.current;if(x)return _(x)}):e&&_(e);function _(x){return x.addEventListener("mousedown",E),x.addEventListener("touchstart",E,{passive:!f}),window.addEventListener("mousemove",S),window.addEventListener("touchmove",m),window.addEventListener("touchmove",S),window.addEventListener("mouseup",y),window.addEventListener("touchend",y),window.addEventListener("touchend",I),()=>{x.removeEventListener("mousedown",E),x.removeEventListener("touchstart",E),window.removeEventListener("mousemove",S),window.removeEventListener("touchmove",m),window.removeEventListener("touchmove",S),window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y),window.removeEventListener("touchend",I)}}return c}function Wn(e){let t=l(e),n=[];return{value:()=>t(),setValue:o=>t.set(o),spring(o,r={}){let s=ze(t.peek(),r);s.set(o);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(o,r={}){let s=Ue(t.peek(),o,{...r,onUpdate:i=>t.set(i)});return{stop:()=>s.cancel()}},interpolate(o,r){return()=>{let s=t();for(let i=0;i<o.length-1;i++)if(s>=o[i]&&s<=o[i+1]){let a=(s-o[i])/(o[i+1]-o[i]);return r[i]+(r[i+1]-r[i])*a}return s<=o[0]?r[0]:r[r.length-1]}},subscribe:t.subscribe}}function Je(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 Yn(e,t,n="enter",o=300){let r=Je(t);return new Promise(s=>{U(()=>{e.classList.add(r[n]),G(()=>{e.offsetHeight,U(()=>{e.classList.add(r[`${n}Active`]),setTimeout(()=>{U(()=>{e.classList.remove(r[n],r[`${n}Active`]),e.classList.add(r[`${n}Done`]),s()})},o)})})})})}var et=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{et.set(e.target)});function Xn(){return{current:()=>et(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function Qn(){let e={current:null};function t(o){typeof document>"u"||(e.current=o||document.activeElement||null)}function n(o){let r=e.current||o;r&&typeof r.focus=="function"&&r.focus()}return{capture:t,restore:n,previous:()=>e.current}}function tt(e){let t=null;function n(){if(typeof document>"u")return;t=document.activeElement;let r=e.current||e;if(!r||typeof r.querySelectorAll!="function")return;let s=Ze(r);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ze(r),f=u[0],c=u[u.length-1];a.shiftKey?document.activeElement===f&&(a.preventDefault(),c.focus()):document.activeElement===c&&(a.preventDefault(),f.focus())}return r.addEventListener("keydown",i),()=>{r.removeEventListener("keydown",i)}}function o(){t&&typeof t.focus=="function"&&t.focus()}return{activate:n,deactivate:o}}function Ze(e){let t=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter(n=>n.offsetParent!==null)}function zn({children:e,active:t=!0}){let n={current:null},o=l(0),r=tt(n),s=null,i=f=>{n.current=f,o.set(c=>c+1)},a=O(()=>{if(o(),s&&(s(),s=null,r.deactivate()),t&&n.current)return s=r.activate(),()=>{s?.(),s=null,r.deactivate()}}),u=$?.();return u&&(u._cleanupCallbacks=u._cleanupCallbacks||[],u._cleanupCallbacks.push(()=>{a(),s?.(),s=null,r.deactivate()})),w("div",{ref:i},e)}var K=null,Me=0;function Un(){return typeof document>"u"?null:(K||(K=document.createElement("div"),K.id="what-announcer",K.setAttribute("aria-live","polite"),K.setAttribute("aria-atomic","true"),K.style.cssText=`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 1px;
|
|
4
4
|
height: 1px;
|
|
@@ -8,7 +8,7 @@ import{a as Yt,b as Xt,c as Wt,d as Pe,e as Qt,f as zt,g as Kt,h as Ut,i as Jt,o
|
|
|
8
8
|
clip: rect(0, 0, 0, 0);
|
|
9
9
|
white-space: nowrap;
|
|
10
10
|
border: 0;
|
|
11
|
-
`,document.body.appendChild(
|
|
11
|
+
`,document.body.appendChild(K)),K)}function nt(e,t={}){let{priority:n="polite",timeout:o=1e3}=t,r=Un();if(!r)return;r.setAttribute("aria-live",n);let s=++Me;r.textContent="",requestAnimationFrame(()=>{Me===s&&(r.textContent=e)}),setTimeout(()=>{Me===s&&(r.textContent="")},o)}function Kn(e){return nt(e,{priority:"assertive"})}function Jn({href:e="#main",children:t="Skip to content"}){return w("a",{href:e,class:"what-skip-link",onClick:n=>{n.preventDefault();let o=document.querySelector(e);o&&(o.focus(),o.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},t)}function Zn(e=!1){let t=l(e);return{expanded:()=>t(),toggle:()=>t.set(!t.peek()),open:()=>t.set(!0),close:()=>t.set(!1),buttonProps:()=>({"aria-expanded":t(),onClick:()=>t.set(!t.peek())}),panelProps:()=>({hidden:!t()})}}function er(e=null){let t=l(e);return{selected:()=>t(),select:n=>t.set(n),isSelected:n=>t()===n,itemProps:n=>({"aria-selected":t()===n,onClick:()=>t.set(n)})}}function tr(e=!1){let t=l(e);return{checked:()=>t(),toggle:()=>t.set(!t.peek()),set:n=>t.set(n),checkboxProps:()=>({role:"checkbox","aria-checked":t(),tabIndex:0,onClick:()=>t.set(!t.peek()),onKeyDown:n=>{(n.key===" "||n.key==="Enter")&&(n.preventDefault(),t.set(!t.peek()))}})}}function nr(e){let t=typeof e=="function"?e:()=>e,n=l(0);function o(r){let s=t();if(!(s<=0))switch(r.key){case"ArrowDown":case"ArrowRight":r.preventDefault(),n.set((n.peek()+1)%s);break;case"ArrowUp":case"ArrowLeft":r.preventDefault(),n.set((n.peek()-1+s)%s);break;case"Home":r.preventDefault(),n.set(0);break;case"End":r.preventDefault(),n.set(s-1);break}}return{focusIndex:()=>n(),setFocusIndex:r=>n.set(r),getItemProps:r=>({tabIndex:n()===r?0:-1,onKeyDown:o,onFocus:()=>n.set(r)}),containerProps:()=>({role:"listbox"})}}function rr({children:e,as:t="span"}){return w(t,{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}},e)}function or({children:e,priority:t="polite",atomic:n=!0}){return w("div",{"aria-live":t,"aria-atomic":n},e)}var rt=0;function Fe(e="what"){let t=`${e}-${++rt}`;return()=>t}function sr(e,t="what"){let n=[];for(let o=0;o<e;o++)n.push(`${t}-${++rt}`);return n}function ir(e){let t=Fe("desc");return{descriptionId:t,descriptionProps:()=>({id:t(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":t()}),Description:()=>w("div",{id:t(),style:{display:"none"}},e)}}function ar(e){let t=Fe("label");return{labelId:t,labelProps:()=>({id:t()}),labelledByProps:()=>({"aria-labelledby":t()})}}var cr={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function ur(e,t){return n=>{n.key===e&&t(n)}}function lr(e,t){return n=>{e.includes(n.key)&&t(n)}}var fr=`
|
|
12
12
|
.what-skeleton {
|
|
13
13
|
background: linear-gradient(
|
|
14
14
|
90deg,
|
|
@@ -60,7 +60,7 @@ import{a as Yt,b as Xt,c as Wt,d as Pe,e as Qt,f as zt,g as Kt,h as Ut,i as Jt,o
|
|
|
60
60
|
0% { transform: translateX(-100%); }
|
|
61
61
|
100% { transform: translateX(100%); }
|
|
62
62
|
}
|
|
63
|
-
`,nt=!1;function te(){if(nt||typeof document>"u")return;nt=!0;let e=document.createElement("style");e.textContent=ar,document.head.appendChild(e)}function De({width:e,height:t,variant:n="shimmer",circle:r=!1,class:o,style:s,count:i=1}){te();let a=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,u=o?`${a} ${o}`:a,f={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:r?"50%":void 0,...s};return i===1?w("div",{class:u,style:f,"aria-hidden":"true"}):Array.from({length:i},(c,d)=>w("div",{key:d,class:u,style:{...f,marginBottom:d<i-1?"8px":void 0},"aria-hidden":"true"}))}function Fe({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:r=8,variant:o="shimmer"}){return te(),w("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,i)=>w("div",{key:i,class:`what-skeleton ${o==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:i===e-1?t:"100%",marginBottom:i<e-1?`${r}px`:void 0}})))}function cr({size:e=40,variant:t="shimmer"}){return De({width:e,height:e,circle:!0,variant:t})}function rt({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-card","aria-hidden":"true"},w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),Fe({lines:t,variant:n}))}function ur({rows:e=5,columns:t=4,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-table","aria-hidden":"true"},w("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(r,o)=>w("div",{key:o,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(r,o)=>w("div",{key:o,style:{display:"flex",gap:"16px",marginBottom:o<e-1?"12px":void 0}},Array.from({length:t},(s,i)=>w("div",{key:i,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function lr({type:e="default",height:t,children:n}){return te(),e==="card"?rt({}):e==="text"?Fe({}):n||w("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function fr(e,t=[]){let n=l(!0),r=l(null),o=l(null);return O(()=>{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()?De(s):null}}function dr({width:e="100%",height:t=100,label:n="Loading...",showLabel:r=!1,variant:o="shimmer"}){return te(),w("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&&w("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function pr({size:e=8,color:t="#666"}){te();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return w("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},w("div",{style:{...n,animationDelay:"0s"}}),w("div",{style:{...n,animationDelay:"0.2s"}}),w("div",{style:{...n,animationDelay:"0.4s"}}))}function hr({size:e=24,color:t="#666",strokeWidth:n=2}){return w("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},w("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),w("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var H=new Map,J=new Map,Z=new Map,q=new Map,ot=200;function we(e){return q.set(e,Date.now()),H.has(e)||(H.set(e,l(null)),H.size>ot&&mr()),H.get(e)}function st(e){return J.has(e)||J.set(e,l(null)),J.get(e)}function gr(e){return Z.has(e)||Z.set(e,l(!1)),Z.get(e)}function mr(){let e=[...q.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(ot*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];Y.has(r)&&Y.get(r).size>0||(H.delete(r),J.delete(r),Z.delete(r),q.delete(r),ge.delete(r))}}var Y=new Map;function it(e,t){return Y.has(e)||Y.set(e,new Set),Y.get(e).add(t),()=>{let n=Y.get(e);n&&(n.delete(t),n.size===0&&Y.delete(e))}}var ne=new Map,ge=new Map;function X(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function yr(e,t={}){let{method:n="GET",body:r,headers:o={},transform:s=h=>h,initialData:i=null}=t,a=l(i),u=l(null),f=l(!0),c=null;async function d(){c&&c.abort(),c=new AbortController;let{signal:h}=c;f.set(!0),u.set(null);try{let v=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...o},body:r?JSON.stringify(r):void 0,signal:h});if(!v.ok)throw new Error(`HTTP ${v.status}: ${v.statusText}`);let b=await v.json();h.aborted||a.set(s(b))}catch(v){h.aborted||u.set(v)}finally{h.aborted||f.set(!1)}}return X(()=>(d(),()=>{c&&c.abort()})),{data:()=>a(),error:()=>u(),isLoading:()=>f(),refetch:d,mutate:h=>a.set(h)}}function xr(e,t,n={}){let{revalidateOnFocus:r=!0,revalidateOnReconnect:o=!0,refreshInterval:s=0,dedupingInterval:i=2e3,fallbackData:a,onSuccess:u,onError:f,suspense:c=!1}=n;if(e==null||e===!1){let m=l(a||null),R=l(null);return{data:()=>m(),error:()=>R(),isLoading:()=>!1,isValidating:()=>!1,mutate:_=>m.set(typeof _=="function"?_(m()):_),revalidate:()=>Promise.resolve()}}let d=we(e),h=st(e),v=gr(e),b=N(()=>d()??a??null),E=N(()=>d()==null&&v()),S=null;async function y(){let m=Date.now();if(ne.has(e)){let g=ne.get(e);if(m-g.timestamp<i)return g.refCount++,g.promise}let R=ge.get(e);if(R&&m-R<i&&d.peek()!=null)return d.peek();if(S){let g=ne.get(e);(!g||g.refCount<=1)&&S.abort()}S=new AbortController;let{signal:_}=S;v.set(!0);let x=t(e,{signal:_});ne.set(e,{promise:x,timestamp:m,refCount:1});try{let g=await x;return _.aborted?void 0:(M(()=>{d.set(g),h.set(null)}),q.set(e,Date.now()),ge.set(e,Date.now()),u&&u(g,e),g)}catch(g){if(_.aborted)return;throw h.set(g),f&&f(g,e),g}finally{_.aborted||v.set(!1);let g=ne.get(e);g&&(g.refCount--,g.refCount<=0&&ne.delete(e))}}let I=it(e,()=>y().catch(()=>{}));return X(()=>(y().catch(()=>{}),()=>{S&&S.abort(),I()})),r&&typeof window<"u"&&X(()=>{let m=()=>{document.visibilityState==="visible"&&y().catch(()=>{})};return document.addEventListener("visibilitychange",m),()=>document.removeEventListener("visibilitychange",m)}),o&&typeof window<"u"&&X(()=>{let m=()=>y().catch(()=>{});return window.addEventListener("online",m),()=>window.removeEventListener("online",m)}),s>0&&X(()=>{let m=setInterval(()=>{y().catch(()=>{})},s);return()=>clearInterval(m)}),{data:()=>b(),error:()=>h(),isLoading:()=>E(),isValidating:()=>v(),mutate:(m,R=!0)=>{let _=typeof m=="function"?m(d.peek()):m;d.set(_),q.set(e,Date.now()),R&&y().catch(()=>{})},revalidate:y}}function vr(e){let{queryKey:t,queryFn:n,enabled:r=!0,staleTime:o=0,cacheTime:s=300*1e3,refetchOnWindowFocus:i=!0,refetchInterval:a=!1,retry:u=3,retryDelay:f=k=>Math.min(1e3*2**k,3e4),onSuccess:c,onError:d,onSettled:h,select:v,placeholderData:b}=e,E=Array.isArray(t)?t.join(":"):t,S=we(E),y=N(()=>{let k=S();return v&&k!==null?v(k):k}),I=st(E),m=l(S.peek()!=null?"success":"loading"),R=l("idle"),_=0,x=null;async function g(){if(!r)return;let k=Date.now();if(S.peek()!=null&&k-_<o)return S.peek();x&&x.abort(),x=new AbortController;let{signal:D}=x;R.set("fetching"),S.peek()==null&&m.set("loading");let P=0;async function ee(){try{let V=await n({queryKey:Array.isArray(t)?t:[t],signal:D});return D.aborted?void 0:(M(()=>{S.set(V),I.set(null),m.set("success"),R.set("idle")}),_=Date.now(),q.set(E,Date.now()),c&&c(V),h&&h(V,null),setTimeout(()=>{if(Date.now()-_>=s){let B=Y.get(E);(!B||B.size===0)&&(H.delete(E),J.delete(E),Z.delete(E),q.delete(E),ge.delete(E))}},s),V)}catch(V){if(D.aborted)return;if(P++,P<u)return await new Promise((B,Se)=>{let Ee=setTimeout(B,f(P));D.addEventListener("abort",()=>{clearTimeout(Ee),Se(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(B=>{if(B.name!=="AbortError")throw B}),D.aborted?void 0:ee();throw M(()=>{I.set(V),m.set("error"),R.set("idle")}),d&&d(V),h&&h(null,V),V}}return ee()}let L=it(E,()=>g().catch(()=>{}));return X(()=>(r&&g().catch(()=>{}),()=>{x&&x.abort(),L()})),i&&typeof window<"u"&&X(()=>{let k=()=>{document.visibilityState==="visible"&&g().catch(()=>{})};return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)}),a&&X(()=>{let k=setInterval(()=>{g().catch(()=>{})},a);return()=>clearInterval(k)}),{data:()=>y()??b,error:()=>I(),status:()=>m(),fetchStatus:()=>R(),isLoading:()=>m()==="loading",isError:()=>m()==="error",isSuccess:()=>m()==="success",isFetching:()=>R()==="fetching",refetch:g}}function wr(e){let{queryKey:t,queryFn:n,getNextPageParam:r,getPreviousPageParam:o,initialPageParam:s,...i}=e,a=l([]),u=l([s]),f=l(!0),c=l(!1),d=l(!1),h=l(!1),v=Array.isArray(t)?t.join(":"):t,b=null,E=!1;async function S(y,I="next"){b&&b.abort(),b=new AbortController;let{signal:m}=b,R=I==="next"?d:h;R.set(!0);try{let _=await n({queryKey:Array.isArray(t)?t:[t],pageParam:y,signal:m});return m.aborted?void 0:(M(()=>{E?(a.set([_]),u.set([y]),E=!1):I==="next"?(a.set([...a.peek(),_]),u.set([...u.peek(),y])):(a.set([_,...a.peek()]),u.set([y,...u.peek()]));let x=r?.(_,a.peek());if(f.set(x!==void 0),o){let g=o(_,a.peek());c.set(g!==void 0)}}),_)}finally{m.aborted||R.set(!1)}}return X(()=>(S(s).catch(()=>{}),()=>{b&&b.abort()})),{data:()=>({pages:a(),pageParams:u()}),hasNextPage:()=>f(),hasPreviousPage:()=>c(),isFetchingNextPage:()=>d(),isFetchingPreviousPage:()=>h(),fetchNextPage:async()=>{let y=a.peek()[a.peek().length-1],I=r?.(y,a.peek());if(I!==void 0)return S(I,"next")},fetchPreviousPage:async()=>{let y=a.peek()[0],I=o?.(y,a.peek());if(I!==void 0)return S(I,"previous")},refetch:async()=>(E=!0,S(s))}}function br(e,t={}){let{hard:n=!1}=t,r=[];if(typeof e=="function")for(let[o]of H)e(o)&&r.push(o);else r.push(e);for(let o of r){n&&H.has(o)&&H.get(o).set(null);let s=Y.get(o);if(s)for(let i of s)i()}}function kr(e,t){let n=we(e);return t(e).then(r=>(n.set(r),q.set(e,Date.now()),r))}function Sr(e,t){let n=we(e),r=n.peek();n.set(typeof t=="function"?t(r):t),q.set(e,Date.now())}function Er(e){return H.has(e)?H.get(e).peek():void 0}function Cr(){H.clear(),J.clear(),Z.clear(),q.clear(),ge.clear(),ne.clear()}function _r(){let e=[];for(let[t,n]of H)e.push({key:t,data:n.peek(),error:J.has(t)?J.get(t).peek():null,isValidating:Z.has(t)?Z.get(t).peek():!1});return e}function Ar(e={}){let t=$?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=at(e)),t.hooks[n]}return at(e)}function at(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:r="onChange",resolver:o}=e,s={},i={},a={},u=l({});function f(p){return s[p]||(s[p]=l(t[p]??"")),s[p]}function c(p){return i[p]||(i[p]=l(null)),i[p]}function d(p){return a[p]||(a[p]=l(!1)),a[p]}let h=l(!1),v=l(!1),b=l(!1),E=l(!1),S=l(0);function y(p=!1){let C={...t};for(let[A,T]of Object.entries(s))C[A]=p?T():T.peek();return C}function I(p=!1){return p?u():u.peek()}function m(p,C){let A=C??null;c(p).set(A),u.set(T=>{if(T[p]===A)return T;if(A==null){if(!Object.prototype.hasOwnProperty.call(T,p))return T;let W={...T};return delete W[p],W}return{...T,[p]:A}})}function R(p={}){let C=p||{};M(()=>{for(let[A,T]of Object.entries(i))Object.prototype.hasOwnProperty.call(C,A)||T.set(null);for(let[A,T]of Object.entries(C))c(A).set(T??null);u.set({...C})})}let _=N(()=>Object.keys(I(!0)).length===0),x=N(()=>{let p={};for(let[C,A]of Object.entries(s))A()!==(t[C]??"")&&(p[C]=!0);return p});async function g(p){if(!o)return!0;E.set(!0);try{let A=(await o(y(!1)))?.errors||{};if(p){let T=A[p]??null;return m(p,T),!T}else return R(A),Object.keys(A).length===0}finally{E.set(!1)}}function L(p,C={}){let A=f(p),T=C.type==="checkbox"||C.type==="radio",ue=xe=>{let ht=xe.target.type==="checkbox"||xe.target.type==="radio"?xe.target.checked:xe.target.value;k(p,ht),(n==="onChange"||b.peek()&&r==="onChange")&&g(p)},W={name:p,onBlur:()=>{d(p).set(!0),(n==="onBlur"||b.peek()&&r==="onBlur")&&g(p)},onFocus:()=>{},ref:C.ref};return T?(Object.defineProperty(W,"checked",{get(){return!!A()},enumerable:!0}),W.onchange=ue):(Object.defineProperty(W,"value",{get(){return A()},enumerable:!0}),W.oninput=ue),W}function k(p,C,A={}){let{shouldValidate:T=!1,shouldDirty:ue=!0}=A;f(p).set(C),ue&&h.set(!0),T&&g(p)}function D(p){return f(p)()}function P(p,C){m(p,C)}function ee(p){m(p,null)}function V(){R({})}function B(p=t){M(()=>{for(let[C,A]of Object.entries(s))A.set(p[C]??"");for(let C of Object.values(i))C.set(null);u.set({});for(let C of Object.values(a))C.set(!1);h.set(!1),b.set(!1)})}function Se(p,C){return async A=>{A&&A.preventDefault(),v.set(!0),b.set(!0),S.set(S.peek()+1),await g()?await p(y()):C&&C(I(!1)),v.set(!1)}}function Ee(p){return p?N(()=>f(p)()):N(()=>y(!0))}return{register:L,handleSubmit:Se,setValue:k,getValue:D,setError:P,clearError:ee,clearErrors:V,reset:B,watch:Ee,validate:g,formState:{get values(){return y(!0)},get errors(){return I(!0)},error:p=>c(p)(),get touched(){let p={};for(let[C,A]of Object.entries(a))A()&&(p[C]=!0);return p},isDirty:()=>h(),isValid:_,isValidating:()=>E(),isSubmitting:()=>v(),isSubmitted:()=>b(),submitCount:()=>S(),dirtyFields:x}}}function Ir(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let r={};for(let o of n.errors||[]){let s=o.path.join(".");r[s]||(r[s]={type:o.code,message:o.message})}return{values:{},errors:r}}}}function Rr(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){let r={};for(let o of n.inner||[])r[o.path]||(r[o.path]={type:o.type,message:o.message});return{values:{},errors:r}}}}function Tr(e){return async t=>{let n={};for(let[r,o]of Object.entries(e)){let s=t[r];for(let i of o){let a=i(s,t);if(a){n[r]={type:"validation",message:a};break}}}return{values:t,errors:n}}}var Mr={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 Lr(e,t={}){let{validate:n,defaultValue:r=""}=t,o=l(r),s=l(null),i=l(!1),a=l(!1);async function u(){if(!n)return!0;let f=await n(o.peek());return s.set(f||null),!f}return{name:e,value:()=>o(),error:()=>s(),isTouched:()=>i(),isDirty:()=>a(),setValue:f=>{o.set(f),a.set(!0)},setError:f=>s.set(f),validate:u,reset:()=>{o.set(r),s.set(null),i.set(!1),a.set(!1)},inputProps:()=>({name:e,value:o(),onInput:f=>{o.set(f.target.value),a.set(!0)},onBlur:()=>{i.set(!0),u()}})}}function Dr(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return w("input",{...r,...o,"aria-invalid":n?"true":void 0})}function Fr(e){let{register:t,error:n,...r}=e,o=t?t(e.name):{};return w("textarea",{...r,...o,"aria-invalid":n?"true":void 0})}function Pr(e){let{register:t,error:n,children:r,...o}=e,s=t?t(e.name):{};return w("select",{...o,...s,"aria-invalid":n?"true":void 0},r)}function Nr(e){let{register:t,...n}=e,r=t?t(e.name):{};return w("input",{type:"checkbox",...n,...r,checked:r.value})}function Or(e){let{register:t,value:n,...r}=e,o=t?t(e.name):{};return w("input",{type:"radio",value:n,...r,checked:o.value===n,onChange:s=>{s.target.checked&&o.onInput&&o.onInput({target:{value:n}})}})}function $r({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}):w("span",{class:"what-error",role:"alert"},o.message):null}var ut={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:
|
|
63
|
+
`,ot=!1;function te(){if(ot||typeof document>"u")return;ot=!0;let e=document.createElement("style");e.textContent=fr,document.head.appendChild(e)}function Pe({width:e,height:t,variant:n="shimmer",circle:o=!1,class:r,style:s,count:i=1}){te();let a=`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""} ${n==="wave"?"what-skeleton-wave":""}`,u=r?`${a} ${r}`:a,f={width:typeof e=="number"?`${e}px`:e,height:typeof t=="number"?`${t}px`:t,borderRadius:o?"50%":void 0,...s};return i===1?w("div",{class:u,style:f,"aria-hidden":"true"}):Array.from({length:i},(c,d)=>w("div",{key:d,class:u,style:{...f,marginBottom:d<i-1?"8px":void 0},"aria-hidden":"true"}))}function Ne({lines:e=3,lastLineWidth:t="60%",lineHeight:n=16,gap:o=8,variant:r="shimmer"}){return te(),w("div",{class:"what-skeleton-text","aria-hidden":"true"},Array.from({length:e},(s,i)=>w("div",{key:i,class:`what-skeleton ${r==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${n}px`,width:i===e-1?t:"100%",marginBottom:i<e-1?`${o}px`:void 0}})))}function dr({size:e=40,variant:t="shimmer"}){return Pe({width:e,height:e,circle:!0,variant:t})}function st({imageHeight:e=200,lines:t=3,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-card","aria-hidden":"true"},w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:`${e}px`,width:"100%",marginBottom:"16px"}}),w("div",{class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"24px",width:"70%",marginBottom:"12px"}}),Ne({lines:t,variant:n}))}function pr({rows:e=5,columns:t=4,variant:n="shimmer"}){return te(),w("div",{class:"what-skeleton-table","aria-hidden":"true"},w("div",{style:{display:"flex",gap:"16px",marginBottom:"16px"}},Array.from({length:t},(o,r)=>w("div",{key:r,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"20px",flex:1}}))),Array.from({length:e},(o,r)=>w("div",{key:r,style:{display:"flex",gap:"16px",marginBottom:r<e-1?"12px":void 0}},Array.from({length:t},(s,i)=>w("div",{key:i,class:`what-skeleton ${n==="pulse"?"what-skeleton-pulse":""}`,style:{height:"16px",flex:1}})))))}function hr({type:e="default",height:t,children:n}){return te(),e==="card"?st({}):e==="text"?Ne({}):n||w("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function gr(e,t=[]){let n=l(!0),o=l(null),r=l(null);return O(()=>{n.set(!0),r.set(null),Promise.resolve(e()).then(s=>{o.set(s),n.set(!1)}).catch(s=>{r.set(s),n.set(!1)})}),{isLoading:()=>n(),data:()=>o(),error:()=>r(),Skeleton:s=>n()?Pe(s):null}}function mr({width:e="100%",height:t=100,label:n="Loading...",showLabel:o=!1,variant:r="shimmer"}){return te(),w("div",{class:`what-skeleton ${r==="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"},o&&w("span",{style:{color:"var(--skeleton-text, #999)",fontSize:"14px"}},n))}function yr({size:e=8,color:t="#666"}){te();let n={width:`${e}px`,height:`${e}px`,borderRadius:"50%",backgroundColor:t,animation:"what-skeleton-pulse 1s infinite ease-in-out"};return w("div",{class:"what-loading-dots",style:{display:"flex",gap:`${e/2}px`},"aria-label":"Loading",role:"status"},w("div",{style:{...n,animationDelay:"0s"}}),w("div",{style:{...n,animationDelay:"0.2s"}}),w("div",{style:{...n,animationDelay:"0.4s"}}))}function xr({size:e=24,color:t="#666",strokeWidth:n=2}){return w("svg",{width:e,height:e,viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},"aria-label":"Loading",role:"status"},w("style",null,"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"),w("circle",{cx:12,cy:12,r:10,stroke:t,strokeWidth:n,fill:"none",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}))}var H=new Map,J=new Map,Z=new Map,q=new Map,it=200;function be(e){return q.set(e,Date.now()),H.has(e)||(H.set(e,l(null)),H.size>it&&wr()),H.get(e)}function at(e){return J.has(e)||J.set(e,l(null)),J.get(e)}function vr(e){return Z.has(e)||Z.set(e,l(!1)),Z.get(e)}function wr(){let e=[...q.entries()].sort((n,o)=>n[1]-o[1]),t=Math.floor(it*.2);for(let n=0;n<t&&n<e.length;n++){let o=e[n][0];W.has(o)&&W.get(o).size>0||(H.delete(o),J.delete(o),Z.delete(o),q.delete(o),ge.delete(o))}}var W=new Map;function ct(e,t){return W.has(e)||W.set(e,new Set),W.get(e).add(t),()=>{let n=W.get(e);n&&(n.delete(t),n.size===0&&W.delete(e))}}var ne=new Map,ge=new Map;function Y(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function br(e,t={}){let{method:n="GET",body:o,headers:r={},transform:s=h=>h,initialData:i=null}=t,a=l(i),u=l(null),f=l(!0),c=null;async function d(){c&&c.abort(),c=new AbortController;let{signal:h}=c;f.set(!0),u.set(null);try{let v=await fetch(e,{method:n,headers:{"Content-Type":"application/json",...r},body:o?JSON.stringify(o):void 0,signal:h});if(!v.ok)throw new Error(`HTTP ${v.status}: ${v.statusText}`);let b=await v.json();h.aborted||a.set(s(b))}catch(v){h.aborted||u.set(v)}finally{h.aborted||f.set(!1)}}return Y(()=>(d(),()=>{c&&c.abort()})),{data:()=>a(),error:()=>u(),isLoading:()=>f(),refetch:d,mutate:h=>a.set(h)}}function kr(e,t,n={}){let{revalidateOnFocus:o=!0,revalidateOnReconnect:r=!0,refreshInterval:s=0,dedupingInterval:i=2e3,fallbackData:a,onSuccess:u,onError:f,suspense:c=!1}=n;if(e==null||e===!1){let m=l(a||null),I=l(null);return{data:()=>m(),error:()=>I(),isLoading:()=>!1,isValidating:()=>!1,mutate:_=>m.set(typeof _=="function"?_(m()):_),revalidate:()=>Promise.resolve()}}let d=be(e),h=at(e),v=vr(e),b=N(()=>d()??a??null),E=N(()=>d()==null&&v()),S=null;async function y(){let m=Date.now();if(ne.has(e)){let g=ne.get(e);if(m-g.timestamp<i)return g.refCount++,g.promise}let I=ge.get(e);if(I&&m-I<i&&d.peek()!=null)return d.peek();if(S){let g=ne.get(e);(!g||g.refCount<=1)&&S.abort()}S=new AbortController;let{signal:_}=S;v.set(!0);let x=t(e,{signal:_});ne.set(e,{promise:x,timestamp:m,refCount:1});try{let g=await x;return _.aborted?void 0:(D(()=>{d.set(g),h.set(null)}),q.set(e,Date.now()),ge.set(e,Date.now()),u&&u(g,e),g)}catch(g){if(_.aborted)return;throw h.set(g),f&&f(g,e),g}finally{_.aborted||v.set(!1);let g=ne.get(e);g&&(g.refCount--,g.refCount<=0&&ne.delete(e))}}let R=ct(e,()=>y().catch(()=>{}));return Y(()=>(y().catch(()=>{}),()=>{S&&S.abort(),R()})),o&&typeof window<"u"&&Y(()=>{let m=()=>{document.visibilityState==="visible"&&y().catch(()=>{})};return document.addEventListener("visibilitychange",m),()=>document.removeEventListener("visibilitychange",m)}),r&&typeof window<"u"&&Y(()=>{let m=()=>y().catch(()=>{});return window.addEventListener("online",m),()=>window.removeEventListener("online",m)}),s>0&&Y(()=>{let m=setInterval(()=>{y().catch(()=>{})},s);return()=>clearInterval(m)}),{data:()=>b(),error:()=>h(),isLoading:()=>E(),isValidating:()=>v(),mutate:(m,I=!0)=>{let _=typeof m=="function"?m(d.peek()):m;d.set(_),q.set(e,Date.now()),I&&y().catch(()=>{})},revalidate:y}}function Sr(e){let{queryKey:t,queryFn:n,enabled:o=!0,staleTime:r=0,cacheTime:s=300*1e3,refetchOnWindowFocus:i=!0,refetchInterval:a=!1,retry:u=3,retryDelay:f=k=>Math.min(1e3*2**k,3e4),onSuccess:c,onError:d,onSettled:h,select:v,placeholderData:b}=e,E=Array.isArray(t)?t.join(":"):t,S=be(E),y=N(()=>{let k=S();return v&&k!==null?v(k):k}),R=at(E),m=l(S.peek()!=null?"success":"loading"),I=l("idle"),_=0,x=null;async function g(){if(!o)return;let k=Date.now();if(S.peek()!=null&&k-_<r)return S.peek();x&&x.abort(),x=new AbortController;let{signal:M}=x;I.set("fetching"),S.peek()==null&&m.set("loading");let P=0;async function ee(){try{let V=await n({queryKey:Array.isArray(t)?t:[t],signal:M});return M.aborted?void 0:(D(()=>{S.set(V),R.set(null),m.set("success"),I.set("idle")}),_=Date.now(),q.set(E,Date.now()),c&&c(V),h&&h(V,null),setTimeout(()=>{if(Date.now()-_>=s){let B=W.get(E);(!B||B.size===0)&&(H.delete(E),J.delete(E),Z.delete(E),q.delete(E),ge.delete(E))}},s),V)}catch(V){if(M.aborted)return;if(P++,P<u)return await new Promise((B,Ee)=>{let Ce=setTimeout(B,f(P));M.addEventListener("abort",()=>{clearTimeout(Ce),Ee(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(B=>{if(B.name!=="AbortError")throw B}),M.aborted?void 0:ee();throw D(()=>{R.set(V),m.set("error"),I.set("idle")}),d&&d(V),h&&h(null,V),V}}return ee()}let L=ct(E,()=>g().catch(()=>{}));return Y(()=>(o&&g().catch(()=>{}),()=>{x&&x.abort(),L()})),i&&typeof window<"u"&&Y(()=>{let k=()=>{document.visibilityState==="visible"&&g().catch(()=>{})};return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)}),a&&Y(()=>{let k=setInterval(()=>{g().catch(()=>{})},a);return()=>clearInterval(k)}),{data:()=>y()??b,error:()=>R(),status:()=>m(),fetchStatus:()=>I(),isLoading:()=>m()==="loading",isError:()=>m()==="error",isSuccess:()=>m()==="success",isFetching:()=>I()==="fetching",refetch:g}}function Er(e){let{queryKey:t,queryFn:n,getNextPageParam:o,getPreviousPageParam:r,initialPageParam:s,...i}=e,a=l([]),u=l([s]),f=l(!0),c=l(!1),d=l(!1),h=l(!1),v=Array.isArray(t)?t.join(":"):t,b=null,E=!1;async function S(y,R="next"){b&&b.abort(),b=new AbortController;let{signal:m}=b,I=R==="next"?d:h;I.set(!0);try{let _=await n({queryKey:Array.isArray(t)?t:[t],pageParam:y,signal:m});return m.aborted?void 0:(D(()=>{E?(a.set([_]),u.set([y]),E=!1):R==="next"?(a.set([...a.peek(),_]),u.set([...u.peek(),y])):(a.set([_,...a.peek()]),u.set([y,...u.peek()]));let x=o?.(_,a.peek());if(f.set(x!==void 0),r){let g=r(_,a.peek());c.set(g!==void 0)}}),_)}finally{m.aborted||I.set(!1)}}return Y(()=>(S(s).catch(()=>{}),()=>{b&&b.abort()})),{data:()=>({pages:a(),pageParams:u()}),hasNextPage:()=>f(),hasPreviousPage:()=>c(),isFetchingNextPage:()=>d(),isFetchingPreviousPage:()=>h(),fetchNextPage:async()=>{let y=a.peek()[a.peek().length-1],R=o?.(y,a.peek());if(R!==void 0)return S(R,"next")},fetchPreviousPage:async()=>{let y=a.peek()[0],R=r?.(y,a.peek());if(R!==void 0)return S(R,"previous")},refetch:async()=>(E=!0,S(s))}}function Cr(e,t={}){let{hard:n=!1}=t,o=[];if(typeof e=="function")for(let[r]of H)e(r)&&o.push(r);else o.push(e);for(let r of o){n&&H.has(r)&&H.get(r).set(null);let s=W.get(r);if(s)for(let i of s)i()}}function _r(e,t){let n=be(e);return t(e).then(o=>(n.set(o),q.set(e,Date.now()),o))}function Ar(e,t){let n=be(e),o=n.peek();n.set(typeof t=="function"?t(o):t),q.set(e,Date.now())}function Rr(e){return H.has(e)?H.get(e).peek():void 0}function Ir(){H.clear(),J.clear(),Z.clear(),q.clear(),ge.clear(),ne.clear()}function Tr(){let e=[];for(let[t,n]of H)e.push({key:t,data:n.peek(),error:J.has(t)?J.get(t).peek():null,isValidating:Z.has(t)?Z.get(t).peek():!1});return e}function Dr(e={}){let t=$?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=ut(e)),t.hooks[n]}return ut(e)}function ut(e={}){let{defaultValues:t={},mode:n="onSubmit",reValidateMode:o="onChange",resolver:r}=e,s={},i={},a={},u=l({});function f(p){return s[p]||(s[p]=l(t[p]??"")),s[p]}function c(p){return i[p]||(i[p]=l(null)),i[p]}function d(p){return a[p]||(a[p]=l(!1)),a[p]}let h=l(!1),v=l(!1),b=l(!1),E=l(!1),S=l(0);function y(p=!1){let C={...t};for(let[A,T]of Object.entries(s))C[A]=p?T():T.peek();return C}function R(p=!1){return p?u():u.peek()}function m(p,C){let A=C??null;c(p).set(A),u.set(T=>{if(T[p]===A)return T;if(A==null){if(!Object.prototype.hasOwnProperty.call(T,p))return T;let X={...T};return delete X[p],X}return{...T,[p]:A}})}function I(p={}){let C=p||{};D(()=>{for(let[A,T]of Object.entries(i))Object.prototype.hasOwnProperty.call(C,A)||T.set(null);for(let[A,T]of Object.entries(C))c(A).set(T??null);u.set({...C})})}let _=N(()=>Object.keys(R(!0)).length===0),x=N(()=>{let p={};for(let[C,A]of Object.entries(s))A()!==(t[C]??"")&&(p[C]=!0);return p});async function g(p){if(!r)return!0;E.set(!0);try{let A=(await r(y(!1)))?.errors||{};if(p){let T=A[p]??null;return m(p,T),!T}else return I(A),Object.keys(A).length===0}finally{E.set(!1)}}function L(p,C={}){let A=f(p),T=C.type==="checkbox"||C.type==="radio",ue=xe=>{let mt=xe.target.type==="checkbox"||xe.target.type==="radio"?xe.target.checked:xe.target.value;k(p,mt),(n==="onChange"||b.peek()&&o==="onChange")&&g(p)},X={name:p,onBlur:()=>{d(p).set(!0),(n==="onBlur"||b.peek()&&o==="onBlur")&&g(p)},onFocus:()=>{},ref:C.ref};return T?(Object.defineProperty(X,"checked",{get(){return!!A()},enumerable:!0}),X.onchange=ue):(Object.defineProperty(X,"value",{get(){return A()},enumerable:!0}),X.oninput=ue),X}function k(p,C,A={}){let{shouldValidate:T=!1,shouldDirty:ue=!0}=A;f(p).set(C),ue&&h.set(!0),T&&g(p)}function M(p){return f(p)()}function P(p,C){m(p,C)}function ee(p){m(p,null)}function V(){I({})}function B(p=t){D(()=>{for(let[C,A]of Object.entries(s))A.set(p[C]??"");for(let C of Object.values(i))C.set(null);u.set({});for(let C of Object.values(a))C.set(!1);h.set(!1),b.set(!1)})}function Ee(p,C){return async A=>{A&&A.preventDefault(),v.set(!0),b.set(!0),S.set(S.peek()+1),await g()?await p(y()):C&&C(R(!1)),v.set(!1)}}function Ce(p){return p?N(()=>f(p)()):N(()=>y(!0))}return{register:L,handleSubmit:Ee,setValue:k,getValue:M,setError:P,clearError:ee,clearErrors:V,reset:B,watch:Ce,validate:g,formState:{get values(){return y(!0)},get errors(){return R(!0)},error:p=>c(p)(),get touched(){let p={};for(let[C,A]of Object.entries(a))A()&&(p[C]=!0);return p},isDirty:()=>h(),isValid:_,isValidating:()=>E(),isSubmitting:()=>v(),isSubmitted:()=>b(),submitCount:()=>S(),dirtyFields:x}}}function Lr(e){return async t=>{try{return{values:await e.parseAsync(t),errors:{}}}catch(n){let o={};for(let r of n.errors||[]){let s=r.path.join(".");o[s]||(o[s]={type:r.code,message:r.message})}return{values:{},errors:o}}}}function Mr(e){return async t=>{try{return{values:await e.validate(t,{abortEarly:!1}),errors:{}}}catch(n){let o={};for(let r of n.inner||[])o[r.path]||(o[r.path]={type:r.type,message:r.message});return{values:{},errors:o}}}}function Fr(e){return async t=>{let n={};for(let[o,r]of Object.entries(e)){let s=t[o];for(let i of r){let a=i(s,t);if(a){n[o]={type:"validation",message:a};break}}}return{values:t,errors:n}}}var Pr={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,o)=>{if(n!==o[e])return t||`Must match ${e}`},custom:e=>e};function Nr(e,t={}){let{validate:n,defaultValue:o=""}=t,r=l(o),s=l(null),i=l(!1),a=l(!1);async function u(){if(!n)return!0;let f=await n(r.peek());return s.set(f||null),!f}return{name:e,value:()=>r(),error:()=>s(),isTouched:()=>i(),isDirty:()=>a(),setValue:f=>{r.set(f),a.set(!0)},setError:f=>s.set(f),validate:u,reset:()=>{r.set(o),s.set(null),i.set(!1),a.set(!1)},inputProps:()=>({name:e,value:r(),onInput:f=>{r.set(f.target.value),a.set(!0)},onBlur:()=>{i.set(!0),u()}})}}function Or(e){let{register:t,error:n,...o}=e,r=t?t(e.name):{};return w("input",{...o,...r,"aria-invalid":n?"true":void 0})}function $r(e){let{register:t,error:n,...o}=e,r=t?t(e.name):{};return w("textarea",{...o,...r,"aria-invalid":n?"true":void 0})}function Hr(e){let{register:t,error:n,children:o,...r}=e,s=t?t(e.name):{};return w("select",{...r,...s,"aria-invalid":n?"true":void 0},o)}function Vr(e){let{register:t,...n}=e,o=t?t(e.name):{};return w("input",{type:"checkbox",...n,...o,checked:o.value})}function jr(e){let{register:t,value:n,...o}=e,r=t?t(e.name):{};return w("input",{type:"radio",value:n,...o,checked:r.value===n,onChange:s=>{s.target.checked&&r.onInput&&r.onInput({target:{value:n}})}})}function qr({name:e,formState:t,errors:n,render:o}){let r=t&&typeof t.error=="function"?t.error(e):(t?.errors!=null?t.errors:typeof n=="function"?n():n)?.[e]||null;return r?o?o({message:r.message,type:r.type}):w("span",{class:"what-error",role:"alert"},r.message):null}var ft={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:
|
|
64
64
|
effect(() => { count(count() + 1); });
|
|
65
65
|
|
|
66
66
|
// Good \u2014 use untrack() so the read doesn't subscribe:
|
|
@@ -117,6 +117,19 @@ html\`<div>\${sanitizedContent}</div>\``},MISSING_KEY:{code:"ERR_MISSING_KEY",se
|
|
|
117
117
|
<For each={items()}>{item => <li>{item.name}</li>}</For>
|
|
118
118
|
|
|
119
119
|
// Good \u2014 stable key:
|
|
120
|
-
<For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
<For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`},UNSAFE_REDIRECT:{code:"ERR_UNSAFE_REDIRECT",severity:"error",template:"redirect() refused an unsafe target: {{target}}.",suggestion:'redirect() accepts same-origin paths and http:, https:, mailto: or tel: URLs only. Protocol-relative ("//host"), backslash-smuggled and javascript:/data: targets are open-redirect vectors. Check a user-supplied target against an allowlist first.',codeExample:`// Bad - a user-controlled target can leave your origin:
|
|
121
|
+
redirect(query.next);
|
|
122
|
+
|
|
123
|
+
// Good - allowlist the target first:
|
|
124
|
+
redirect(ALLOWED.has(query.next) ? query.next : '/');`},REDIRECT_NOT_CAUGHT:{code:"ERR_REDIRECT_NOT_CAUGHT",severity:"error",template:'A redirect() to "{{target}}" surfaced uncaught, so nothing performed the navigation.',suggestion:"redirect() is caught in route middleware and in a component body. From an event handler, a promise callback, a timer or a reactive thunk, call navigate(to) instead. If the call is inside a try/catch, rethrow anything whose name is RouterRedirect. On the server this signal escapes renderToString to its caller: read its `to` and emit a 302 rather than calling navigate().",codeExample:`// Bad - a reactive thunk re-runs outside the render the Router caught:
|
|
125
|
+
<div>{() => (loggedOut() ? redirect('/login') : <Dashboard />)}</div>
|
|
126
|
+
|
|
127
|
+
// Good - navigate() from a thunk or a handler:
|
|
128
|
+
<div>{() => (loggedOut() ? (navigate('/login'), null) : <Dashboard />)}</div>
|
|
129
|
+
<button onclick={() => navigate('/login')}>Sign in</button>
|
|
130
|
+
|
|
131
|
+
// On the server, catch it instead of navigating:
|
|
132
|
+
try { html = renderToString(<App />); }
|
|
133
|
+
catch (e) { if (e.name === 'RouterRedirect') return Response.redirect(e.to, 302); throw e; }`}},ae=class extends Error{constructor({code:t,message:n,suggestion:o,file:r,line:s,component:i,signal:a,effect:u}){super(n),this.name="WhatError",this.code=t,this.suggestion=o,this.file=r,this.line=s,this.component=i,this.signal=a,this.effect=u}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function oe(e,t={}){let n=typeof e=="string"?ft[e]:e;if(!n)return new ae({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let o=n.template;for(let[r,s]of Object.entries(t))o=o.replace(new RegExp(`\\{\\{${r}\\}\\}`,"g"),String(s));return o=o.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ae({code:n.code,message:o,suggestion:n.suggestion,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var re=[],lt=200;function ke(e){F&&(re.push({...e.toJSON(),timestamp:Date.now()}),re.length>lt&&(re=re.slice(-lt)))}function Se(e){return e?re.filter(t=>t.timestamp>e):re.slice()}function Br(){re=[]}function Gr(e,t={}){let n=e?.message||String(e);return n.includes("infinite effect loop")||n.includes("25 iterations")?oe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?oe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?oe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new ae({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var me={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function Wr(e){Object.assign(me,e)}function Yr(){return{...me}}function Xr(e,t){return!F||!me.signalReadDetection||(e.toString=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
134
|
+
Suggestion: ${n.suggestion}`),ke(n),String(e())},e.valueOf=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
135
|
+
Suggestion: ${n.suggestion}`),ke(n),e()}),e}function Qr(e){if(!F||!me.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${zr(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 zr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var dt=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 Ur(e){if(!F||!me.importValidation)return[];let t=[];for(let n of e)dt.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Kr(n)}?`});return t}function Kr(e){let t=e.toLowerCase(),n=null,o=1/0;for(let r of dt){let s=Jr(t,r.toLowerCase());s<o&&(o=s,n=r)}return o<=3?n:"(no close match found)"}function Jr(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let o=0;o<=t.length;o++)n[o]=[o];for(let o=0;o<=e.length;o++)n[0][o]=o;for(let o=1;o<=t.length;o++)for(let r=1;r<=e.length;r++){let s=t[o-1]===e[r-1]?0:1;n[o][r]=Math.min(n[o-1][r]+1,n[o][r-1]+1,n[o-1][r-1]+s)}return n[t.length][e.length]}var Zr="0.11.8",ye=[];function eo(e){F&&ye.push(e)}function to(e){if(!F)return;let t=ye.indexOf(e);t>=0&&ye.splice(t,1)}function pt(){return ye.slice()}var ce=[];function no(e){F&&ce.push(e)}function ro(e){if(!F)return;let t=ce.indexOf(e);t>=0&&ce.splice(t,1)}function ht(){return ce.slice()}function gt(){let e=Se(),t=e.filter(u=>Date.now()-u.timestamp<6e4),o=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,r=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ce.filter(u=>!!(u._subs&&u._subs.size===0)).length,i=ce.length,a=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:o,orphanEffects:r.length,signalLeaks:s,memoryPressure:a,recentErrorCount:t.length,totalSignals:i,totalComponents:ye.length}}function oo(){F&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:Zr,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>pt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>ht().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:()=>Se(),health:()=>gt(),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{Vr as Checkbox,ft as ERROR_CODES,Tt as ErrorBoundary,qr as ErrorMessage,zn as FocusTrap,Lt as For,Ct as Fragment,An as Head,Or as Input,Pt as Island,hr as IslandSkeleton,cr as Keys,or as LiveRegion,yr as LoadingDots,Ft as Match,mr as Placeholder,Bt as Portal,jr as Radio,Hr as Select,Dt as Show,Pe as Skeleton,dr as SkeletonAvatar,st as SkeletonCard,pr as SkeletonTable,Ne as SkeletonText,Jn as SkipLink,xr as Spinner,It as Suspense,Mt as Switch,$r as Textarea,rr as VisuallyHidden,ae as WhatError,Qt as _$createComponent,zt as _$template,Et as __drainPreinstallBuffer,Tr as __getCacheSnapshot,an as __installServerContextStorage,_e as __readHydrationData,ln as __resetHydrationData,yt as __setDevToolsHooks,Xt as _setTextInsertHook,Oe as _template,nt as announce,Kn as announceAssertive,_n as atom,D as batch,Tn as beginHeadCollection,Qr as checkComponentName,rn as classList,Gr as classifyError,Ir as clearCache,Br as clearCollectedErrors,Pn as clearHead,Ot as cls,ke as collectError,N as computed,Wr as configureGuardrails,vn as createContext,Sn as createResource,kt as createRoot,Cn as createStore,Je as createTransitionClasses,oe as createWhatError,Yn as cssTransition,Ht as debounce,tn as delegateEvents,je as derived,Nt as each,Ke as easings,O as effect,Dn as endHeadCollection,We as flushScheduler,vt as flushSync,ht as getActiveSignals,Se as getCollectedErrors,Yr as getGuardrailConfig,gt as getHealth,Ae as getLoaderData,pt as getMountedComponents,wt as getOwner,Rr as getQueryData,Re as getResource,ie as getServerContext,w as h,_t as html,sn as hydrate,Kt as insert,oo as installAgentContext,Xr as installSignalReadGuardrail,Cr as invalidateQueries,on as isHydrating,Rt as lazy,Jt as mapArray,Nn as measure,At as memo,Yt as mount,On as mutate,Hn as nextFrame,nn as on,kn as onCleanup,jn as onIntersect,ur as onKey,lr as onKeys,bn as onMount,Vn as onResize,St as onRootCleanup,_r as prefetchQuery,Xe as raf,eo as registerComponent,no as registerSignal,Pr as rules,bt as runWithOwner,un as runWithServerContext,G as scheduleRead,U as scheduleWrite,en as setProp,Ar as setQueryData,cn as setServerContext,l as signal,xt as signalMemo,Fr as simpleResolver,qn as smoothScrollTo,Zt as spread,ze as spring,En as storeComputed,$t as style,Ut as svgTemplate,Oe as template,Vt as throttle,Wt as transition,Ue as tween,to as unregisterComponent,ro as unregisterSignal,le as untrack,Wn as useAnimatedValue,tr as useAriaChecked,Zn as useAriaExpanded,er as useAriaSelected,yn as useCallback,Gt as useClickOutside,hn as useComputed,$e as useContext,ir as useDescribedBy,gn as useEffect,br as useFetch,Nr as useField,Xn as useFocus,Qn as useFocusRestore,tt as useFocusTrap,Dr as useForm,Gn as useGesture,Fe as useId,sr as useIds,Er as useInfiniteQuery,ar as useLabelledBy,fn as useLoaderData,qt as useLocalStorage,jt as useMediaQuery,mn as useMemo,Sr as useQuery,wn as useReducer,xn as useRef,nr as useRovingTabIndex,kr as useSWR,$n as useScheduledEffect,pn as useSignal,gr as useSkeleton,dn as useState,Bn as useTransition,Ur as validateImports,Mr as yupResolver,Lr as zodResolver};
|
package/dist/render.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v}from"./chunk-
|
|
1
|
+
import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v}from"./chunk-JIZR6JX5.min.js";import{e as a,g as b,i as c}from"./chunk-PABR63P3.min.js";import"./chunk-O3SKPRTY.min.js";export{e as _$createComponent,f as _$template,d as _setTextInsertHook,g as _template,t as classList,r as delegateEvents,a as effect,v as hydrate,i as insert,u as isHydrating,j as mapArray,b as memo,s as on,o as setAttr,q as setChecked,m as setClass,l as setProp,n as setStyle,p as setValue,k as spread,h as svgTemplate,g as template,c as untrack};
|
package/dist/testing.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{N as m,c as f,e as p,h as w,l as b}from"./chunk-PABR63P3.min.js";import{a as h}from"./chunk-O3SKPRTY.min.js";var l=null;function E(){return typeof document<"u"&&(l=document.createElement("div"),l.id="test-root",document.body.appendChild(l)),l}function v(){l&&(l.innerHTML="",l.parentNode&&l.parentNode.removeChild(l),l=null)}function N(e,t={}){let{container:n}=t,o=n||E();if(!o)throw new Error("No DOM container available. Are you running in Node.js without jsdom?");let s=m(e,o);return{container:o,unmount:s,getByText:r=>d(o,r),getByTestId:r=>o.querySelector(`[data-testid="${r}"]`),getByRole:r=>o.querySelector(`[role="${r}"]`),getAllByText:r=>g(o,r),queryByText:r=>d(o,r),queryByTestId:r=>o.querySelector(`[data-testid="${r}"]`),debug:()=>console.log(o.innerHTML),findByText:(r,u)=>y(()=>d(o,r),{timeout:u}),findByTestId:(r,u)=>y(()=>o.querySelector(`[data-testid="${r}"]`),{timeout:u})}}function q(e,t){let n=E();if(!n)throw new Error("No DOM container available. Are you running in Node.js without jsdom?");let o={},s=null,r;return b(u=>{s=u;let c=h(e,t||{});r=m(c,n)}),{container:n,signals:new Proxy(o,{get(u,c){if(c in u)return u[c]},set(u,c,i){return u[c]=i,!0}}),update(){w()},unmount(){r&&r(),s&&s(),v()},getByText:u=>d(n,u),getByTestId:u=>n.querySelector(`[data-testid="${u}"]`),queryByText:u=>d(n,u),debug:()=>console.log(n.innerHTML)}}function C(){w()}function M(e){let t=[],n=[],o=f,s=new Map,r=i=>{t.includes(i)||t.push(i)},u=i=>{n.includes(i)||n.push(i)},c;return b(i=>{c=i;let a=p(()=>{e()})}),c&&c(),{accessed:t,written:n}}function D(e,t){let n=[t],o=0,s=f(t,e),r=s.set;s.set=function(i){let a=typeof i=="function"?i(s.peek()):i;return Object.is(s.peek(),a)||(o++,n.push(a)),r(a)};let u=s,c=function(...i){if(i.length===0)return u();let a=typeof i[0]=="function"?i[0](u.peek()):i[0];return Object.is(u.peek(),a)||(o++,n.push(a)),u(a)};return c._signal=!0,c.peek=s.peek,c.set=s.set,c.subscribe=s.subscribe,s._debugName&&(c._debugName=s._debugName),s._subs&&(c._subs=s._subs),Object.defineProperty(c,"history",{get(){return n}}),Object.defineProperty(c,"setCount",{get(){return o}}),c.reset=function(i){let a=i!==void 0?i:t;n.length=0,n.push(a),o=0,u(a)},c}function d(e,t){let n=t instanceof RegExp?t:null,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);for(;o.nextNode();){let s=o.currentNode;if(n?n.test(s.textContent):s.textContent.includes(t))return s.parentElement}return null}function g(e,t){let n=[],o=t instanceof RegExp?t:null,s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);for(;s.nextNode();){let r=s.currentNode;(o?o.test(r.textContent):r.textContent.includes(t))&&n.push(r.parentElement)}return n}var H={click(e){let t=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:typeof window<"u"?window:void 0});return e.dispatchEvent(t),t},change(e,t){e.value=t;let n=new Event("input",{bubbles:!0});e.dispatchEvent(n);let o=new Event("change",{bubbles:!0});return e.dispatchEvent(o),o},input(e,t){e.value=t;let n=new Event("input",{bubbles:!0});return e.dispatchEvent(n),n},submit(e){let t=new Event("submit",{bubbles:!0,cancelable:!0});return e.dispatchEvent(t),t},focus(e){e.focus();let t=new FocusEvent("focus",{bubbles:!0});return e.dispatchEvent(t),t},blur(e){e.blur();let t=new FocusEvent("blur",{bubbles:!0});return e.dispatchEvent(t),t},keyDown(e,t,n={}){let o=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,key:t,...n});return e.dispatchEvent(o),o},keyUp(e,t,n={}){let o=new KeyboardEvent("keyup",{bubbles:!0,cancelable:!0,key:t,...n});return e.dispatchEvent(o),o},mouseEnter(e){let t=new MouseEvent("mouseenter",{bubbles:!0});return e.dispatchEvent(t),t},mouseLeave(e){let t=new MouseEvent("mouseleave",{bubbles:!0});return e.dispatchEvent(t),t}};async function y(e,t={}){let{timeout:n=1e3,interval:o=50}=t,s=Date.now();for(;Date.now()-s<n;){try{let r=e();if(r)return r}catch{}await new Promise(r=>setTimeout(r,o))}throw new Error(`waitFor timed out after ${n}ms`)}async function O(e,t={}){let{timeout:n=1e3,interval:o=50}=t,s=Date.now(),r=e();if(!r)throw new Error("Element not found");for(;Date.now()-s<n;){if(r=e(),!r)return;await new Promise(u=>setTimeout(u,o))}throw new Error(`Element still present after ${n}ms`)}async function _(e){let t=await e();return w(),await new Promise(n=>queueMicrotask(n)),await new Promise(n=>setTimeout(n,0)),t}function F(e){let t=f(e),n=[e];return p(()=>{n.push(t())}),{signal:t,get value(){return t()},set value(o){t.set(o)},history:n,reset(){n.length=0,n.push(t())}}}function R(e="MockComponent"){let t=[];function n(o){return t.push({props:o,timestamp:Date.now()}),h("div",{"data-testid":`mock-${e}`},JSON.stringify(o,null,2))}return n.displayName=e,n.calls=t,n.lastCall=()=>t[t.length-1],n.reset=()=>{t.length=0},n}var j={toBeInTheDocument(e){if(!e||!e.parentNode)throw new Error("Expected element to be in the document")},toHaveTextContent(e,t){if(!e)throw new Error("Element not found");let n=e.textContent;if(!(t instanceof RegExp?t.test(n):n.includes(t)))throw new Error(`Expected "${n}" to contain "${t}"`)},toHaveAttribute(e,t,n){if(!e)throw new Error("Element not found");let o=e.getAttribute(t);if(n!==void 0&&o!==n)throw new Error(`Expected attribute "${t}" to be "${n}", got "${o}"`);if(n===void 0&&o===null)throw new Error(`Expected element to have attribute "${t}"`)},toHaveClass(e,t){if(!e)throw new Error("Element not found");if(!e.classList.contains(t))throw new Error(`Expected element to have class "${t}"`)},toBeVisible(e){if(!e)throw new Error("Element not found");let t=window.getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden"||t.opacity==="0")throw new Error("Expected element to be visible")},toBeDisabled(e){if(!e)throw new Error("Element not found");if(!e.disabled)throw new Error("Expected element to be disabled")},toHaveValue(e,t){if(!e)throw new Error("Element not found");if(e.value!==t)throw new Error(`Expected value to be "${t}", got "${e.value}"`)}},A={getByText:e=>d(document.body,e),getByTestId:e=>document.querySelector(`[data-testid="${e}"]`),getByRole:e=>document.querySelector(`[role="${e}"]`),getAllByText:e=>g(document.body,e),queryByText:e=>d(document.body,e),queryByTestId:e=>document.querySelector(`[data-testid="${e}"]`),debug:()=>console.log(document.body.innerHTML)};export{_ as act,v as cleanup,F as createTestSignal,j as expect,H as fireEvent,C as flushEffects,R as mockComponent,D as mockSignal,N as render,q as renderTest,A as screen,E as setupDOM,M as trackSignals,y as waitFor,O as waitForElementToBeRemoved};
|