what-core 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2IZMPODD.min.js +2 -0
- package/dist/chunk-2IZMPODD.min.js.map +7 -0
- package/dist/chunk-2P7OVL2L.js +1386 -0
- package/dist/chunk-2P7OVL2L.js.map +7 -0
- package/dist/chunk-5EQUBJWQ.js +1365 -0
- package/dist/chunk-5EQUBJWQ.js.map +7 -0
- package/dist/chunk-6DAIK77K.min.js +2 -0
- package/dist/chunk-6DAIK77K.min.js.map +7 -0
- package/dist/chunk-CCINITLW.js +1692 -0
- package/dist/chunk-CCINITLW.js.map +7 -0
- package/dist/chunk-GZRA4IAJ.js +1699 -0
- package/dist/chunk-GZRA4IAJ.js.map +7 -0
- package/dist/chunk-H3GA34JK.js +1384 -0
- package/dist/chunk-H3GA34JK.js.map +7 -0
- package/dist/chunk-MH7L756Y.min.js +2 -0
- package/dist/chunk-MH7L756Y.min.js.map +7 -0
- package/dist/chunk-RI7T5VFD.min.js +2 -0
- package/dist/chunk-RI7T5VFD.min.js.map +7 -0
- package/dist/chunk-VKCFJ4OT.min.js +2 -0
- package/dist/chunk-VKCFJ4OT.min.js.map +7 -0
- package/dist/index.js +3 -5
- package/dist/index.js.map +2 -2
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +3 -3
- package/dist/render.js +14 -2
- package/dist/render.min.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/testing.min.js +1 -1
- package/package.json +1 -1
- package/render.d.ts +18 -0
- package/src/agent-context.js +3 -2
- package/src/dom.js +16 -0
- package/src/guardrails.js +17 -46
- package/src/reactive.js +22 -0
- package/src/render.js +159 -55
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Gt,b as Wt,c as Yt,d as Fe,e as Xt,f as Qt,g as zt,h as Kt,i as Ut,j as Jt,k as Zt,l as en,m as tn,n as nn}from"./chunk-RN6QIBWL.min.js";import{A as Pt,B as Nt,C as Ot,D as $t,E as Ht,F as Vt,G as jt,H as qt,J as Bt,L as $,a as F,b as ht,c as l,d as N,e as O,f as M,g as gt,h as mt,i as le,j as yt,k as xt,l as vt,n as wt,o as bt,p as Et,q as Ct,r as _t,s as At,t as It,u as Rt,v as Tt,w as Mt,x as Dt,y as Lt,z as Ft}from"./chunk-KBM6CWG4.min.js";import{a as w,b as kt,c as St}from"./chunk-O3SKPRTY.min.js";var se=null;function ie(){return se}function rn(e){let t=se;return se=e,t}function on(e,t){let n=se;se=e;try{return t()}finally{se=n}}var Q;function Ee(){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 sn(){Q=void 0}function Ce(){let e=Ee();return e?e.loaderData:void 0}function _e(e){let t=Ee();return t&&t.resources?t.resources[e]:void 0}function an(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return Ce()}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 cn(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 un(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 ln(e){let t=j("useComputed"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=N(e)),t.hooks[n]}function fn(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 dn(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 pn(e,t){let n=j("useCallback"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function hn(e){let t=j("useRef"),{index:n,exists:r}=z(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Pe(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 gn(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=Pe(t);return typeof n=="function"?n(r):n}};return t}function mn(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 yn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function xn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function vn(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=_e(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 $e(e){return e._storeComputed=!0,e}var Ne=!1;function wn(e){return Ne||(Ne=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),$e(e)}function bn(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 Oe=!1;function kn(e){return Oe||(Oe=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ae={title:null,metas:new Map,links:new Map};function Sn({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ie();return o&&o.head&&Cn(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ae.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);Ve("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");Ve("link",s,o)}return r||null}function En(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function Cn(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(En(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function _n(){return{title:null,metas:new Map,links:new Map}}function An(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${je(String(e.title))}</title>`);for(let n of e.metas.values())t+=He("meta",n);for(let n of e.links.values())t+=He("link",n);return t}function He(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}="${je(String(o))}"`}return n+">"}function je(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ve(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){In(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 In(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Rn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ae.metas.clear(),Ae.links.clear()}var de=[],pe=[],Re=!1;function G(e){return de.push(e),Be(),()=>{let t=de.indexOf(e);t!==-1&&de.splice(t,1)}}function K(e){return pe.push(e),Be(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function qe(){for(;de.length>0;){let e=de.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Re=!1}function Be(){Re||(Re=!0,requestAnimationFrame(qe))}function Tn(e){return new Promise(t=>{G(()=>{t(e())})})}function Mn(e){return new Promise(t=>{K(()=>{e(),t()})})}function Dn(e,t){let n=Symbol("scheduledEffect");return O(()=>{Ge(n,()=>{G(()=>{let r=e();t&&K(()=>t(r))})})})}function Ln(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var fe=new Map;function Ge(e,t){fe.has(e)?fe.set(e,t):(fe.set(e,t),requestAnimationFrame(()=>{let n=fe.get(e);fe.delete(e),n&&n()}))}var Ie=new WeakMap,xe=null;function Fn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(xe||(xe=new ResizeObserver(n=>{G(()=>{for(let r of n){let o=Ie.get(r.target);o&&o(r.contentRect)}})})),Ie.set(e,t),xe.observe(e),()=>{Ie.delete(e),xe.unobserve(e)})}function Pn(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 Nn(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 We(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function Ye(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,D=-r*_,k=(g+D)/o,L=_+k*I,P=m+L*I;if(M(()=>{u.set(L),i.set(P)}),Math.abs(L)<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 Xe(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 Qe={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 On(e={}){let{duration:t=300,easing:n=Qe.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 $n(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,D=g.clientX,k=g.clientY,L=performance.now(),P=L-d;M(()=>{c.currentX.set(D),c.currentY.set(k),c.deltaX.set(D-c.startX),c.deltaY.set(k-c.startY),P>0&&c.velocity.set({x:(D-h)/P*1e3,y:(k-v)/P*1e3})}),h=D,v=k,d=L,b&&Math.sqrt(c.deltaX.peek()**2+c.deltaY.peek()**2)>10&&(clearTimeout(b),b=null),n&&n({x:D,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(),D=c.deltaY.peek(),k=c.velocity.peek();if(Math.sqrt(g**2+D**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:D,velocity:k}),c.isDragging.set(!1)}let I=null;function m(x){if(!s||x.touches.length!==2)return;let g=x.touches[0],D=x.touches[1],k=Math.sqrt((D.clientX-g.clientX)**2+(D.clientY-g.clientY)**2);I===null&&(I=k);let L=k/I,P=(g.clientX+D.clientX)/2,ee=(g.clientY+D.clientY)/2;s({scale:L,centerX:P,centerY:ee})}function R(){I=null}typeof e=="function"?We(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?We(()=>{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 Hn(e){let t=l(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=Ye(t.peek(),o);s.set(r);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=Xe(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 ze(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 Vn(e,t,n="enter",r=300){let o=ze(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 Ue=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Ue.set(e.target)});function jn(){return{current:()=>Ue(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function qn(){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 Je(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=Ke(o);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ke(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 Ke(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 Bn({children:e,active:t=!0}){let n={current:null},r=l(0),o=Je(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,Te=0;function Gn(){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 Gt,b as Yt,c as Xt,d as Fe,e as Wt,f as Qt,g as zt,h as Kt,i as Ut,o as Jt,p as Zt,q as en,r as tn,s as nn}from"./chunk-RI7T5VFD.min.js";import{A as Pt,B as Nt,C as Ot,D as $t,E as Ht,F as Vt,G as jt,H as qt,J as Bt,L as $,a as F,b as ht,c as l,d as N,e as O,f as M,g as gt,h as mt,i as le,j as yt,k as xt,l as vt,n as wt,o as bt,p as Et,q as Ct,r as _t,s as At,t as It,u as Rt,v as Tt,w as Mt,x as Lt,y as Dt,z as Ft}from"./chunk-MH7L756Y.min.js";import{a as w,b as kt,c as St}from"./chunk-O3SKPRTY.min.js";var se=null;function ie(){return se}function rn(e){let t=se;return se=e,t}function on(e,t){let n=se;se=e;try{return t()}finally{se=n}}var Q;function Ee(){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 sn(){Q=void 0}function Ce(){let e=Ee();return e?e.loaderData:void 0}function _e(e){let t=Ee();return t&&t.resources?t.resources[e]:void 0}function an(){if(typeof document>"u"){let e=ie();return e?e.loaderData:void 0}return Ce()}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 cn(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 un(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 ln(e){let t=j("useComputed"),{index:n,exists:r}=z(t);return r||(t.hooks[n]=N(e)),t.hooks[n]}function fn(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 dn(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 pn(e,t){let n=j("useCallback"),{index:r,exists:o}=z(n);return o||(n.hooks[r]={callback:e}),n.hooks[r].callback}function hn(e){let t=j("useRef"),{index:n,exists:r}=z(t);return r||(t.hooks[n]={current:e}),t.hooks[n]}function Pe(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 gn(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=Pe(t);return typeof n=="function"?n(r):n}};return t}function mn(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 yn(e){let t=j("onMount");t.mounted||(t._mountCallbacks=t._mountCallbacks||[],t._mountCallbacks.push(e))}function xn(e){let t=j("onCleanup");t._cleanupCallbacks=t._cleanupCallbacks||[],t._cleanupCallbacks.push(e)}function vn(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=_e(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 $e(e){return e._storeComputed=!0,e}var Ne=!1;function wn(e){return Ne||(Ne=!0,console.warn("[what] storeComputed() is deprecated. Use derived() instead.")),$e(e)}function bn(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 Oe=!1;function kn(e){return Oe||(Oe=!0,console.warn("[what] atom() is deprecated. Use signal() directly instead.")),l(e)}var Ae={title:null,metas:new Map,links:new Map};function Sn({title:e,meta:t,link:n,children:r}){if(typeof document>"u"){let o=ie();return o&&o.head&&Cn(o.head,{title:e,meta:t,link:n}),r??null}if(e&&(document.title=e,Ae.title=e),t)for(let o of Array.isArray(t)?t:[t]){let s=o.name||o.property||o.httpEquiv||JSON.stringify(o);Ve("meta",s,o)}if(n)for(let o of Array.isArray(n)?n:[n]){let s=o.rel+(o.href||"");Ve("link",s,o)}return r||null}function En(e){return e.name||e.property||e.httpEquiv||JSON.stringify(e)}function Cn(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(En(o),o);if(r)for(let o of Array.isArray(r)?r:[r])e.links.set(o.rel+(o.href||""),o)}function _n(){return{title:null,metas:new Map,links:new Map}}function An(e){if(!e)return"";let t="";e.title!=null&&(t+=`<title>${je(String(e.title))}</title>`);for(let n of e.metas.values())t+=He("meta",n);for(let n of e.links.values())t+=He("link",n);return t}function He(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}="${je(String(o))}"`}return n+">"}function je(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ve(e,t,n){let r=document.head.querySelector(`[data-what-head="${t}"]`);if(r){In(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 In(e,t){for(let[n,r]of Object.entries(t))e.getAttribute(n)!==r&&e.setAttribute(n,r)}function Rn(){let e=document.head.querySelectorAll("[data-what-head]");for(let t of e)t.remove();Ae.metas.clear(),Ae.links.clear()}var de=[],pe=[],Re=!1;function G(e){return de.push(e),Be(),()=>{let t=de.indexOf(e);t!==-1&&de.splice(t,1)}}function K(e){return pe.push(e),Be(),()=>{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}}function qe(){for(;de.length>0;){let e=de.shift();try{e()}catch(t){console.error("[what] Scheduler read error:",t)}}for(;pe.length>0;){let e=pe.shift();try{e()}catch(t){console.error("[what] Scheduler write error:",t)}}Re=!1}function Be(){Re||(Re=!0,requestAnimationFrame(qe))}function Tn(e){return new Promise(t=>{G(()=>{t(e())})})}function Mn(e){return new Promise(t=>{K(()=>{e(),t()})})}function Ln(e,t){let n=Symbol("scheduledEffect");return O(()=>{Ge(n,()=>{G(()=>{let r=e();t&&K(()=>t(r))})})})}function Dn(){let e,t=new Promise((n,r)=>{let o=requestAnimationFrame(n);e=()=>{cancelAnimationFrame(o),r(new Error("Cancelled"))}});return t.cancel=e,t}var fe=new Map;function Ge(e,t){fe.has(e)?fe.set(e,t):(fe.set(e,t),requestAnimationFrame(()=>{let n=fe.get(e);fe.delete(e),n&&n()}))}var Ie=new WeakMap,xe=null;function Fn(e,t){return typeof ResizeObserver>"u"?(t(e.getBoundingClientRect()),()=>{}):(xe||(xe=new ResizeObserver(n=>{G(()=>{for(let r of n){let o=Ie.get(r.target);o&&o(r.contentRect)}})})),Ie.set(e,t),xe.observe(e),()=>{Ie.delete(e),xe.unobserve(e)})}function Pn(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 Nn(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 Ye(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function Xe(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 We(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 Qe={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 On(e={}){let{duration:t=300,easing:n=Qe.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 $n(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"?Ye(()=>{let x=le(e);if(x)return _(x)}):e?.current!==void 0?Ye(()=>{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 Hn(e){let t=l(e),n=[];return{value:()=>t(),setValue:r=>t.set(r),spring(r,o={}){let s=Xe(t.peek(),o);s.set(r);let i=O(()=>{t.set(s.current())});return{stop:()=>{s.stop(),i()}}},timing(r,o={}){let s=We(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 ze(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 Vn(e,t,n="enter",r=300){let o=ze(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 Ue=l(null);typeof document<"u"&&document.addEventListener("focusin",e=>{Ue.set(e.target)});function jn(){return{current:()=>Ue(),focus:e=>e?.focus(),blur:()=>document.activeElement?.blur()}}function qn(){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 Je(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=Ke(o);if(s.length===0)return;s[0].focus();function i(a){if(a.key!=="Tab")return;let u=Ke(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 Ke(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 Bn({children:e,active:t=!0}){let n={current:null},r=l(0),o=Je(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,Te=0;function Gn(){return typeof document>"u"?null:(U||(U=document.createElement("div"),U.id="what-announcer",U.setAttribute("aria-live","polite"),U.setAttribute("aria-atomic","true"),U.style.cssText=`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 1px;
|
|
4
4
|
height: 1px;
|
|
@@ -8,7 +8,7 @@ import{a as Gt,b as Wt,c as Yt,d as Fe,e as Xt,f as Qt,g as zt,h as Kt,i as Ut,j
|
|
|
8
8
|
clip: rect(0, 0, 0, 0);
|
|
9
9
|
white-space: nowrap;
|
|
10
10
|
border: 0;
|
|
11
|
-
`,document.body.appendChild(U)),U)}function Ze(e,t={}){let{priority:n="polite",timeout:r=1e3}=t,o=Gn();if(!o)return;o.setAttribute("aria-live",n);let s=++Te;o.textContent="",requestAnimationFrame(()=>{Te===s&&(o.textContent=e)}),setTimeout(()=>{Te===s&&(o.textContent="")},r)}function
|
|
11
|
+
`,document.body.appendChild(U)),U)}function Ze(e,t={}){let{priority:n="polite",timeout:r=1e3}=t,o=Gn();if(!o)return;o.setAttribute("aria-live",n);let s=++Te;o.textContent="",requestAnimationFrame(()=>{Te===s&&(o.textContent=e)}),setTimeout(()=>{Te===s&&(o.textContent="")},r)}function Yn(e){return Ze(e,{priority:"assertive"})}function Xn({href:e="#main",children:t="Skip to content"}){return w("a",{href:e,class:"what-skip-link",onClick:n=>{n.preventDefault();let r=document.querySelector(e);r&&(r.focus(),r.scrollIntoView())},style:{position:"absolute",top:"-40px",left:"0",padding:"8px",background:"#000",color:"#fff",textDecoration:"none",zIndex:"10000"},onFocus:n=>{n.target.style.top="0"},onBlur:n=>{n.target.style.top="-40px"}},t)}function Wn(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 Qn(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 zn(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 Kn(e){let t=typeof e=="function"?e:()=>e,n=l(0);function r(o){let s=t();if(!(s<=0))switch(o.key){case"ArrowDown":case"ArrowRight":o.preventDefault(),n.set((n.peek()+1)%s);break;case"ArrowUp":case"ArrowLeft":o.preventDefault(),n.set((n.peek()-1+s)%s);break;case"Home":o.preventDefault(),n.set(0);break;case"End":o.preventDefault(),n.set(s-1);break}}return{focusIndex:()=>n(),setFocusIndex:o=>n.set(o),getItemProps:o=>({tabIndex:n()===o?0:-1,onKeyDown:r,onFocus:()=>n.set(o)}),containerProps:()=>({role:"listbox"})}}function Un({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 Jn({children:e,priority:t="polite",atomic:n=!0}){return w("div",{"aria-live":t,"aria-atomic":n},e)}var et=0;function Me(e="what"){let t=`${e}-${++et}`;return()=>t}function Zn(e,t="what"){let n=[];for(let r=0;r<e;r++)n.push(`${t}-${++et}`);return n}function er(e){let t=Me("desc");return{descriptionId:t,descriptionProps:()=>({id:t(),style:{display:"none"}}),describedByProps:()=>({"aria-describedby":t()}),Description:()=>w("div",{id:t(),style:{display:"none"}},e)}}function tr(e){let t=Me("label");return{labelId:t,labelProps:()=>({id:t()}),labelledByProps:()=>({"aria-labelledby":t()})}}var nr={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Home:"Home",End:"End",Tab:"Tab"};function rr(e,t){return n=>{n.key===e&&t(n)}}function or(e,t){return n=>{e.includes(n.key)&&t(n)}}var sr=`
|
|
12
12
|
.what-skeleton {
|
|
13
13
|
background: linear-gradient(
|
|
14
14
|
90deg,
|
|
@@ -60,7 +60,7 @@ import{a as Gt,b as Wt,c as Yt,d as Fe,e as Xt,f as Qt,g as zt,h as Kt,i as Ut,j
|
|
|
60
60
|
0% { transform: translateX(-100%); }
|
|
61
61
|
100% { transform: translateX(100%); }
|
|
62
62
|
}
|
|
63
|
-
`,tt=!1;function te(){if(tt||typeof document>"u")return;tt=!0;let e=document.createElement("style");e.textContent=sr,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 Le({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 ir({size:e=40,variant:t="shimmer"}){return De({width:e,height:e,circle:!0,variant:t})}function nt({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"}}),Le({lines:t,variant:n}))}function ar({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 cr({type:e="default",height:t,children:n}){return te(),e==="card"?nt({}):e==="text"?Le({}):n||w("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function ur(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 lr({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 fr({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 dr({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,rt=200;function ve(e){return q.set(e,Date.now()),H.has(e)||(H.set(e,l(null)),H.size>rt&&hr()),H.get(e)}function ot(e){return J.has(e)||J.set(e,l(null)),J.get(e)}function pr(e){return Z.has(e)||Z.set(e,l(!1)),Z.get(e)}function hr(){let e=[...q.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(rt*.2);for(let n=0;n<t&&n<e.length;n++){let r=e[n][0];W.has(r)&&W.get(r).size>0||(H.delete(r),J.delete(r),Z.delete(r),q.delete(r),he.delete(r))}}var W=new Map;function st(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,he=new Map;function Y(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function gr(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 Y(()=>(d(),()=>{c&&c.abort()})),{data:()=>a(),error:()=>u(),isLoading:()=>f(),refetch:d,mutate:h=>a.set(h)}}function mr(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=ve(e),h=ot(e),v=pr(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=he.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()),he.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=st(e,()=>y().catch(()=>{}));return Y(()=>(y().catch(()=>{}),()=>{S&&S.abort(),I()})),r&&typeof window<"u"&&Y(()=>{let m=()=>{document.visibilityState==="visible"&&y().catch(()=>{})};return document.addEventListener("visibilitychange",m),()=>document.removeEventListener("visibilitychange",m)}),o&&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,R=!0)=>{let _=typeof m=="function"?m(d.peek()):m;d.set(_),q.set(e,Date.now()),R&&y().catch(()=>{})},revalidate:y}}function yr(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=ve(E),y=N(()=>{let k=S();return v&&k!==null?v(k):k}),I=ot(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:L}=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:L});return L.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=W.get(E);(!B||B.size===0)&&(H.delete(E),J.delete(E),Z.delete(E),q.delete(E),he.delete(E))}},s),V)}catch(V){if(L.aborted)return;if(P++,P<u)return await new Promise((B,ke)=>{let Se=setTimeout(B,f(P));L.addEventListener("abort",()=>{clearTimeout(Se),ke(new DOMException("Aborted","AbortError"))},{once:!0})}).catch(B=>{if(B.name!=="AbortError")throw B}),L.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 D=st(E,()=>g().catch(()=>{}));return Y(()=>(r&&g().catch(()=>{}),()=>{x&&x.abort(),D()})),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:()=>I(),status:()=>m(),fetchStatus:()=>R(),isLoading:()=>m()==="loading",isError:()=>m()==="error",isSuccess:()=>m()==="success",isFetching:()=>R()==="fetching",refetch:g}}function xr(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 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],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 vr(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=W.get(o);if(s)for(let i of s)i()}}function wr(e,t){let n=ve(e);return t(e).then(r=>(n.set(r),q.set(e,Date.now()),r))}function br(e,t){let n=ve(e),r=n.peek();n.set(typeof t=="function"?t(r):t),q.set(e,Date.now())}function kr(e){return H.has(e)?H.get(e).peek():void 0}function Sr(){H.clear(),J.clear(),Z.clear(),q.clear(),he.clear(),ne.clear()}function Er(){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 Cr(e={}){let t=$?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=it(e)),t.hooks[n]}return it(e)}function it(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 X={...T};return delete X[p],X}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 D(p,C={}){let A=f(p),T=C.type==="checkbox"||C.type==="radio",ue=ye=>{let pt=ye.target.type==="checkbox"||ye.target.type==="radio"?ye.target.checked:ye.target.value;k(p,pt),(n==="onChange"||b.peek()&&r==="onChange")&&g(p)},X={name:p,onBlur:()=>{d(p).set(!0),(n==="onBlur"||b.peek()&&r==="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 L(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 ke(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 Se(p){return p?N(()=>f(p)()):N(()=>y(!0))}return{register:D,handleSubmit:ke,setValue:k,getValue:L,setError:P,clearError:ee,clearErrors:V,reset:B,watch:Se,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 _r(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 Ar(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 Ir(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 Rr={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 Tr(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 Mr(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 Dr(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 Lr(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 Fr(e){let{register:t,...n}=e,r=t?t(e.name):{};return w("input",{type:"checkbox",...n,...r,checked:r.value})}function Pr(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 Nr({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 ct={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
|
+
`,tt=!1;function te(){if(tt||typeof document>"u")return;tt=!0;let e=document.createElement("style");e.textContent=sr,document.head.appendChild(e)}function Le({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 De({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 ir({size:e=40,variant:t="shimmer"}){return Le({width:e,height:e,circle:!0,variant:t})}function nt({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"}}),De({lines:t,variant:n}))}function ar({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 cr({type:e="default",height:t,children:n}){return te(),e==="card"?nt({}):e==="text"?De({}):n||w("div",{class:"what-skeleton what-island-skeleton",style:{height:typeof t=="number"?`${t}px`:t||"100px",width:"100%"},"aria-hidden":"true"})}function ur(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()?Le(s):null}}function lr({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 fr({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 dr({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,rt=200;function ve(e){return q.set(e,Date.now()),H.has(e)||(H.set(e,l(null)),H.size>rt&&hr()),H.get(e)}function ot(e){return J.has(e)||J.set(e,l(null)),J.get(e)}function pr(e){return Z.has(e)||Z.set(e,l(!1)),Z.get(e)}function hr(){let e=[...q.entries()].sort((n,r)=>n[1]-r[1]),t=Math.floor(rt*.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),he.delete(r))}}var Y=new Map;function st(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,he=new Map;function X(e){let t=$?.(),n=O(e);return t&&t.effects.push(n),n}function gr(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 mr(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=ve(e),h=ot(e),v=pr(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=he.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()),he.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=st(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 yr(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=ve(E),y=N(()=>{let k=S();return v&&k!==null?v(k):k}),I=ot(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),he.delete(E))}},s),V)}catch(V){if(D.aborted)return;if(P++,P<u)return await new Promise((B,ke)=>{let Se=setTimeout(B,f(P));D.addEventListener("abort",()=>{clearTimeout(Se),ke(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=st(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 xr(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 vr(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 wr(e,t){let n=ve(e);return t(e).then(r=>(n.set(r),q.set(e,Date.now()),r))}function br(e,t){let n=ve(e),r=n.peek();n.set(typeof t=="function"?t(r):t),q.set(e,Date.now())}function kr(e){return H.has(e)?H.get(e).peek():void 0}function Sr(){H.clear(),J.clear(),Z.clear(),q.clear(),he.clear(),ne.clear()}function Er(){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 Cr(e={}){let t=$?.();if(t){let n=t.hookIndex++;return t.hooks[n]||(t.hooks[n]=it(e)),t.hooks[n]}return it(e)}function it(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=ye=>{let pt=ye.target.type==="checkbox"||ye.target.type==="radio"?ye.target.checked:ye.target.value;k(p,pt),(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 ke(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 Se(p){return p?N(()=>f(p)()):N(()=>y(!0))}return{register:L,handleSubmit:ke,setValue:k,getValue:D,setError:P,clearError:ee,clearErrors:V,reset:B,watch:Se,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 _r(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 Ar(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 Ir(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 Rr={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 Tr(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 Mr(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 Lr(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 Dr(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 Fr(e){let{register:t,...n}=e,r=t?t(e.name):{};return w("input",{type:"checkbox",...n,...r,checked:r.value})}function Pr(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 Nr({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 ct={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,7 +117,7 @@ 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>`}},ae=class extends Error{constructor({code:t,message:n,suggestion:r,file:o,line:s,component:i,signal:a,effect:u}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.file=o,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"?ct[e]:e;if(!n)return new ae({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[o,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(s));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ae({code:n.code,message:r,suggestion:n.suggestion,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var re=[],at=200;function we(e){F&&(re.push({...e.toJSON(),timestamp:Date.now()}),re.length>at&&(re=re.slice(-at)))}function be(e){return e?re.filter(t=>t.timestamp>e):re.slice()}function Or(){re=[]}function $r(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 ge={signalReadDetection:!0,
|
|
121
|
-
Suggestion: ${
|
|
122
|
-
Suggestion: ${
|
|
120
|
+
<For each={items()}>{item => <li key={item.id}>{item.name}</li>}</For>`}},ae=class extends Error{constructor({code:t,message:n,suggestion:r,file:o,line:s,component:i,signal:a,effect:u}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.file=o,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"?ct[e]:e;if(!n)return new ae({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[o,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(s));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new ae({code:n.code,message:r,suggestion:n.suggestion,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var re=[],at=200;function we(e){F&&(re.push({...e.toJSON(),timestamp:Date.now()}),re.length>at&&(re=re.slice(-at)))}function be(e){return e?re.filter(t=>t.timestamp>e):re.slice()}function Or(){re=[]}function $r(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 ge={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function Hr(e){Object.assign(ge,e)}function Vr(){return{...ge}}function jr(e,t){return!F||!ge.signalReadDetection||(e.toString=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
121
|
+
Suggestion: ${n.suggestion}`),we(n),String(e())},e.valueOf=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
122
|
+
Suggestion: ${n.suggestion}`),we(n),e()}),e}function qr(e){if(!F||!ge.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${Br(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 Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ut=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 Gr(e){if(!F||!ge.importValidation)return[];let t=[];for(let n of e)ut.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Yr(n)}?`});return t}function Yr(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of ut){let s=Xr(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function Xr(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var Wr="0.11.0",me=[];function Qr(e){F&&me.push(e)}function zr(e){if(!F)return;let t=me.indexOf(e);t>=0&&me.splice(t,1)}function lt(){return me.slice()}var ce=[];function Kr(e){F&&ce.push(e)}function Ur(e){if(!F)return;let t=ce.indexOf(e);t>=0&&ce.splice(t,1)}function ft(){return ce.slice()}function dt(){let e=be(),t=e.filter(u=>Date.now()-u.timestamp<6e4),r=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,o=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ce.filter(u=>!!(u._subs&&u._subs.size===0)).length,i=ce.length,a=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:a,recentErrorCount:t.length,totalSignals:i,totalComponents:me.length}}function Jr(){F&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:Wr,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>lt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>ft().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:()=>be(),health:()=>dt(),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{Fr as Checkbox,ct as ERROR_CODES,At as ErrorBoundary,Nr as ErrorMessage,Bn as FocusTrap,Rt as For,kt as Fragment,Sn as Head,Mr as Input,Lt as Island,cr as IslandSkeleton,nr as Keys,Jn as LiveRegion,fr as LoadingDots,Mt as Match,lr as Placeholder,Vt as Portal,Pr as Radio,Dr as Select,It as Show,Le as Skeleton,ir as SkeletonAvatar,nt as SkeletonCard,ar as SkeletonTable,De as SkeletonText,Xn as SkipLink,dr as Spinner,_t as Suspense,Tt as Switch,Lr as Textarea,Un as VisuallyHidden,ae as WhatError,Yt as _$createComponent,Xt as _$template,bt as __drainPreinstallBuffer,Er as __getCacheSnapshot,Ee as __readHydrationData,sn as __resetHydrationData,ht as __setDevToolsHooks,Gt as _setTextInsertHook,Fe as _template,Ze as announce,Yn as announceAssertive,kn as atom,M as batch,_n as beginHeadCollection,qr as checkComponentName,en as classList,$r as classifyError,Sr as clearCache,Or as clearCollectedErrors,Rn as clearHead,Ft as cls,we as collectError,N as computed,Hr as configureGuardrails,gn as createContext,vn as createResource,vt as createRoot,bn as createStore,ze as createTransitionClasses,oe as createWhatError,Vn as cssTransition,Nt as debounce,Jt as delegateEvents,$e as derived,Dt as each,Qe as easings,O as effect,An as endHeadCollection,qe as flushScheduler,mt as flushSync,ft as getActiveSignals,be as getCollectedErrors,Vr as getGuardrailConfig,dt as getHealth,Ce as getLoaderData,lt as getMountedComponents,yt as getOwner,kr as getQueryData,_e as getResource,ie as getServerContext,w as h,St as html,nn as hydrate,Qt as insert,Jr as installAgentContext,jr as installSignalReadGuardrail,vr as invalidateQueries,tn as isHydrating,Ct as lazy,zt as mapArray,Tn as measure,Et as memo,Bt as mount,Mn as mutate,Dn as nextFrame,Zt as on,xn as onCleanup,Pn as onIntersect,rr as onKey,or as onKeys,yn as onMount,Fn as onResize,wt as onRootCleanup,wr as prefetchQuery,Ge as raf,Qr as registerComponent,Kr as registerSignal,Rr as rules,xt as runWithOwner,on as runWithServerContext,G as scheduleRead,K as scheduleWrite,Ut as setProp,br as setQueryData,rn as setServerContext,l as signal,gt as signalMemo,Ir as simpleResolver,Nn as smoothScrollTo,Kt as spread,Xe as spring,wn as storeComputed,Pt as style,Wt as svgTemplate,Fe as template,Ot as throttle,qt as transition,We as tween,zr as unregisterComponent,Ur as unregisterSignal,le as untrack,Hn as useAnimatedValue,zn as useAriaChecked,Wn as useAriaExpanded,Qn as useAriaSelected,pn as useCallback,jt as useClickOutside,ln as useComputed,Pe as useContext,er as useDescribedBy,fn as useEffect,gr as useFetch,Tr as useField,jn as useFocus,qn as useFocusRestore,Je as useFocusTrap,Cr as useForm,$n as useGesture,Me as useId,Zn as useIds,xr as useInfiniteQuery,tr as useLabelledBy,an as useLoaderData,Ht as useLocalStorage,$t as useMediaQuery,dn as useMemo,yr as useQuery,mn as useReducer,hn as useRef,Kn as useRovingTabIndex,mr as useSWR,Ln as useScheduledEffect,un as useSignal,ur as useSkeleton,cn as useState,On as useTransition,Gr as validateImports,Ar as yupResolver,_r as zodResolver};
|
|
123
123
|
//# sourceMappingURL=index.min.js.map
|