@askrjs/askr 0.0.12 → 0.0.14
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/README.md +48 -26
- package/dist/{chunk-76FYOA5Z.js → chunk-7DNGQWPJ.js} +1 -1
- package/dist/chunk-BJ3TA3ZK.js +1 -0
- package/dist/{chunk-4YHYFQDP.js → chunk-FYTGHAKU.js} +1 -1
- package/dist/chunk-LW2VF6A3.js +2 -0
- package/dist/{chunk-XJFUFTFF.js → chunk-OD6C42QU.js} +1 -1
- package/dist/for/index.js +1 -1
- package/dist/foundations/index.js +1 -1
- package/dist/fx/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/navigate-R2PQVY2C.js +1 -0
- package/dist/resources/index.js +1 -1
- package/dist/{route-6SM7I3UO.js → route-WP5TWBJE.js} +1 -1
- package/dist/router/index.js +1 -1
- package/dist/ssr/index.d.ts +22 -5
- package/dist/ssr/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-P3C5XSNF.js +0 -2
- package/dist/navigate-L6D2UGE2.js +0 -1
package/README.md
CHANGED
|
@@ -27,15 +27,17 @@ Developers should only think about:
|
|
|
27
27
|
- state
|
|
28
28
|
- HTML
|
|
29
29
|
|
|
30
|
-
## Quick
|
|
30
|
+
## Quick Start
|
|
31
31
|
|
|
32
|
-
Install
|
|
32
|
+
**1. Install**
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
35
|
npm i @askrjs/askr
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
**2. Configure TypeScript**
|
|
39
|
+
|
|
40
|
+
Edit `tsconfig.json`:
|
|
39
41
|
|
|
40
42
|
```json
|
|
41
43
|
{
|
|
@@ -46,55 +48,75 @@ TypeScript JSX setup (`tsconfig.json`):
|
|
|
46
48
|
}
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
**3. Create `src/main.tsx`**
|
|
50
52
|
|
|
51
53
|
```ts
|
|
52
|
-
import { createSPA, getRoutes, Link,
|
|
54
|
+
import { createSPA, getRoutes, Link, route, state } from '@askrjs/askr';
|
|
53
55
|
|
|
54
56
|
function Home() {
|
|
55
57
|
const count = state(0);
|
|
56
58
|
return (
|
|
57
|
-
<div>
|
|
59
|
+
<div style="padding:12px">
|
|
58
60
|
<h1>Home</h1>
|
|
59
61
|
<p>Count: {count()}</p>
|
|
60
62
|
<button onClick={() => count.set(prev => prev + 1)}>Increment</button>
|
|
61
|
-
<p>
|
|
62
|
-
<Link href="/users/42">User 42</Link>
|
|
63
|
-
</p>
|
|
63
|
+
<p><Link href="/users/42">User 42</Link></p>
|
|
64
64
|
</div>
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Tip:** Prefer functional updates when updating based on previous state: `count.set(prev => prev + 1)`.
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
|
|
74
68
|
function User({ id }: { id: string }) {
|
|
75
69
|
return (
|
|
76
|
-
<div>
|
|
70
|
+
<div style="padding:12px">
|
|
77
71
|
<h1>User {id}</h1>
|
|
78
|
-
<Link href="/"
|
|
72
|
+
<Link href="/">← Back</Link>
|
|
79
73
|
</div>
|
|
80
74
|
);
|
|
81
75
|
}
|
|
82
76
|
|
|
83
|
-
// Register routes at module-load time
|
|
84
77
|
route('/', () => <Home />);
|
|
85
78
|
route('/users/{id}', ({ id }) => <User id={id} />);
|
|
86
79
|
|
|
87
|
-
// App root component — render `Home` by default; registered routes will take over on navigation
|
|
88
|
-
function App() {
|
|
89
|
-
// Default page when app loads
|
|
90
|
-
return <Home />;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Create the app. Click the "User 42" link above to navigate to `/users/42`.
|
|
94
80
|
createSPA({ root: 'app', routes: getRoutes() });
|
|
95
81
|
```
|
|
96
82
|
|
|
97
|
-
|
|
83
|
+
**4. Create `index.html`**
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<!doctype html>
|
|
87
|
+
<html>
|
|
88
|
+
<body>
|
|
89
|
+
<div id="app"></div>
|
|
90
|
+
<script type="module" src="./src/main.tsx"></script>
|
|
91
|
+
</body>
|
|
92
|
+
</html>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**5. Run with Vite**
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
npx vite
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then install the Askr Vite plugin in `vite.config.ts` if needed (automatically handles JSX):
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { defineConfig } from 'vite';
|
|
105
|
+
import { askrVitePlugin } from '@askrjs/askr/vite';
|
|
106
|
+
|
|
107
|
+
export default defineConfig({
|
|
108
|
+
plugins: [askrVitePlugin()],
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Done. Click links, increment counters, navigate routes. No hidden state, no effects, no lifecycle.
|
|
113
|
+
|
|
114
|
+
**Key takeaways:**
|
|
115
|
+
|
|
116
|
+
- Write normal functions and HTML
|
|
117
|
+
- Use `state()` for reactive values; call `set()` to update
|
|
118
|
+
- Use `route()` to register and read routes
|
|
119
|
+
- Platform primitives: cancellation is `AbortSignal`, state is plain functions
|
|
98
120
|
|
|
99
121
|
## JSX runtime
|
|
100
122
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-D2JSJKCW.js';import {j as j$1}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-D2JSJKCW.js';import {j as j$1}from'./chunk-LW2VF6A3.js';import {c}from'./chunk-62D2TNHX.js';var q={};c(q,{_lockRouteRegistrationForTests:()=>T,_unlockRouteRegistrationForTests:()=>U,clearRoutes:()=>C,getLoadedNamespaces:()=>F,getNamespaceRoutes:()=>Q,getRoutes:()=>W,lockRouteRegistration:()=>L,registerRoute:()=>_,resolveRoute:()=>J,route:()=>S,setServerLocation:()=>O,unloadNamespace:()=>j});function h(e,r){let o=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,i=r.endsWith("/")&&r!=="/"?r.slice(0,-1):r,t=o.split("/").filter(Boolean),n=i.split("/").filter(Boolean);if(n.length===1&&n[0]==="*")return {matched:true,params:{"*":t.length>1?o:t[0]}};if(t.length!==n.length)return {matched:false,params:{}};let s={};for(let a=0;a<n.length;a++){let c=n[a],u=t[a];if(c.startsWith("{")&&c.endsWith("}")){let f=c.slice(1,-1);s[f]=decodeURIComponent(u);}else if(c==="*")s["*"]=u;else if(c!==u)return {matched:false,params:{}}}return {matched:true,params:s}}var l=[],g=new Set,P=Symbol.for("__ASKR_HAS_ROUTES__");function b(e){try{let r=globalThis;r[P]=e;}catch{}}b(false);var p=new Map;function z(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;return r==="/"?0:r.split("/").filter(Boolean).length}function v(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;if(r==="/*")return 0;let o=r.split("/").filter(Boolean),i=0;for(let t of o)t.startsWith("{")&&t.endsWith("}")?i+=2:t==="*"?i+=1:i+=3;return i}var w=null;function O(e){w=e;}function M(e){try{let r=new URL(e,"http://localhost");return {pathname:r.pathname,search:r.search,hash:r.hash}}catch{return {pathname:"/",search:"",hash:""}}}function m(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e)){let o=e[r];o&&typeof o=="object"&&m(o);}}return e}function N(e){let r=new URLSearchParams(e||""),o=new Map;for(let[t,n]of r.entries()){let s=o.get(t);s?s.push(n):o.set(t,[n]);}return m({get(t){let n=o.get(t);return n?n[0]:null},getAll(t){let n=o.get(t);return n?[...n]:[]},has(t){return o.has(t)},toJSON(){let t={};for(let[n,s]of o.entries())t[n]=s.length>1?[...s]:s[0];return t}})}function B(e){let r=W(),o=[];function i(t){let n=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;if(n==="/*")return 0;let s=n.split("/").filter(Boolean),a=0;for(let c of s)c.startsWith("{")&&c.endsWith("}")?a+=2:c==="*"?a+=1:a+=3;return a}for(let t of r){let n=h(e,t.path);n.matched&&o.push({pattern:t.path,params:n.params,name:t.name,namespace:t.namespace,specificity:i(t.path)});}return o.sort((t,n)=>n.specificity-t.specificity),o.map(t=>({path:t.pattern,params:m({...t.params}),name:t.name,namespace:t.namespace}))}var d=false;function L(){d=true;}function T(){d=true;}function U(){d=false;}function S(e,r,o){if(a()==="islands")throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.");if(typeof e>"u"){let a=j$1();if(!a)throw new Error("route() can only be called during component render execution. Call route() from inside your component function.");let c="/",u="",f="";if(typeof window<"u"&&window.location)c=window.location.pathname||"/",u=window.location.search||"",f=window.location.hash||"";else if(w){let R=M(w);c=R.pathname,u=R.search,f=R.hash;}let A=m({...a.props||{}}),D=N(u),E=B(c);return Object.freeze({path:c,params:A,query:D,hash:f||null,matches:Object.freeze(E)})}let i=j$1();if(i&&i.ssr)throw new Error("route() cannot be called during SSR rendering. Register routes at module load time instead.");if(d)throw new Error("Route registration is locked after app startup. Register routes at module load time before calling createSPA or createSSR.");if(typeof r!="function")throw new Error("route(path, handler) requires a function handler that returns a VNode (e.g. () => <Page />). Passing JSX elements or VNodes directly is not supported.");let t={path:e,handler:r,namespace:o};l.push(t),b(true);let n=z(e),s=p.get(n);s||(s=[],p.set(n,s)),s.push(t),o&&g.add(o);}function W(){return [...l]}function Q(e){return l.filter(r=>r.namespace===e)}function j(e){let r=l.length;for(let o=l.length-1;o>=0;o--)if(l[o].namespace===e){let i=l[o];l.splice(o,1);let t=z(i.path),n=p.get(t);if(n){let s=n.indexOf(i);s>=0&&n.splice(s,1);}}return g.delete(e),r-l.length}function C(){l.length=0,g.clear(),p.clear(),d=false,b(false);}function k(e){if(e!=null&&typeof e=="function")return (r,o)=>{try{return e(r,o)}catch{return e(r)}}}function _(e,r,...o){let i=!e.startsWith("/"),t={path:e,handler:r,children:o.filter(Boolean),_isDescriptor:true};if(!i){let n=k(r);if(r!=null&&!n)throw new Error("registerRoute(path, handler) requires a function handler. Passing JSX elements or VNodes directly is not supported.");n&&S(e,n);for(let s of t.children||[]){let c=`${e==="/"?"":e.replace(/\/$/,"")}/${s.path.replace(/^\//,"")}`.replace(/\/\//g,"/");if(s.handler){let u=k(s.handler);if(!u)throw new Error("registerRoute child handler must be a function. Passing JSX elements directly is not supported.");u&&S(c,u);}s.children&&s.children.length&&_(c,null,...s.children);}return t}return t}function F(){return Array.from(g)}function J(e){let r=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,o=r==="/"?0:r.split("/").filter(Boolean).length,i=[],t=p.get(o);if(t)for(let n of t){let s=h(e,n.path);s.matched&&i.push({route:n,specificity:v(n.path),params:s.params});}for(let n of l){if(t?.includes(n))continue;let s=h(e,n.path);s.matched&&i.push({route:n,specificity:v(n.path),params:s.params});}if(i.sort((n,s)=>s.specificity-n.specificity),i.length>0){let n=i[0];return {handler:n.route.handler,params:n.params}}return null}
|
|
2
2
|
export{O as a,L as b,T as c,U as d,S as e,W as f,Q as g,j as h,C as i,_ as j,F as k,J as l,q as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-FYTGHAKU.js';import {h,f}from'./chunk-LW2VF6A3.js';function m(t,n,a$1){let p=a(h(t,n,a$1?.by))();return {type:f,props:{source:t},_forState:p}}export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {l,n,a,e,b}from'./chunk-
|
|
1
|
+
import {l,n,a,e,b}from'./chunk-LW2VF6A3.js';function C(l$1){let e=l();if(!e)throw new Error("state() can only be called during component render execution. Move state() calls to the top level of your component function.");let t=n(),s=e.stateValues;if(t<e.stateIndexCheck)throw new Error(`State index violation: state() call at index ${t}, but previously saw index ${e.stateIndexCheck}. This happens when state() is called conditionally (inside if/for/etc). Move all state() calls to the top level of your component function, before any conditionals.`);if(a(t>=e.stateIndexCheck,"[State] State indices must increase monotonically"),e.stateIndexCheck=t,e.firstRenderComplete){if(!e.expectedStateIndices.includes(t))throw new Error(`Hook order violation: state() called at index ${t}, but this index was not in the first render's sequence [${e.expectedStateIndices.join(", ")}]. This usually means state() is inside a conditional or loop. Move all state() calls to the top level of your component function.`)}else e.expectedStateIndices.push(t);if(s[t]){let n=s[t];if(n._owner!==e)throw new Error(`State ownership violation: state() called at index ${t} is owned by a different component instance. State ownership is positional and immutable.`);return n}let o=S(l$1,e);return s[t]=o,o}function S(l$1,e$1){let t=l$1,s=new Map;function o(){o._hasBeenRead=true;let n=l();return n&&n._currentRenderToken!==void 0&&(n._pendingReadStates||(n._pendingReadStates=new Set),n._pendingReadStates.add(o)),t}return o._readers=s,o._owner=e$1,o.set=n=>{if(l()!==null)throw new Error("[Askr] state.set() cannot be called during component render. State mutations during render break the actor model and cause infinite loops. Move state updates to event handlers or use conditional rendering instead.");let r;if(typeof n=="function"?r=n(t):r=n,Object.is(t,r))return;if(e()){t=r;return}t=r;let c=o._readers;if(c){for(let[a,m]of c)if(a.lastRenderToken===m&&!a.hasPendingUpdate){a.hasPendingUpdate=true;let p=a._pendingFlushTask;p?b.enqueue(p):b.enqueue(()=>{a.hasPendingUpdate=false,a.notifyUpdate?.();});}}let u=c?.get(e$1);if(u!==void 0&&e$1.lastRenderToken===u&&!e$1.hasPendingUpdate){e$1.hasPendingUpdate=true;let a=e$1._pendingFlushTask;a?b.enqueue(a):b.enqueue(()=>{e$1.hasPendingUpdate=false,e$1.notifyUpdate?.();});}},o}export{C as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-HGMOQ3I7.js';import {b as b$1}from'./chunk-37RC6ZT3.js';function fe(e,n,t){if(!e){let r=t?`
|
|
2
|
+
`+JSON.stringify(t,null,2):"";throw new Error(`[Askr Invariant] ${n}${r}`)}}function ve(e,n){fe(e,`[Scheduler Precondition] ${n}`);}function Q(){try{let e=globalThis.__ASKR_FASTLANE;return typeof e?.isBulkCommitActive=="function"?!!e.isBulkCommitActive():!1}catch(e){return false}}var me=class{constructor(){this.q=[];this.head=0;this.running=false;this.inHandler=false;this.depth=0;this.executionDepth=0;this.flushVersion=0;this.kickScheduled=false;this.allowSyncProgress=false;this.waiters=[];this.taskCount=0;}enqueue(n){ve(typeof n=="function","enqueue() requires a function"),!(Q()&&!this.allowSyncProgress)&&(this.q.push(n),this.taskCount++,!this.running&&!this.kickScheduled&&!this.inHandler&&!Q()&&(this.kickScheduled=true,queueMicrotask(()=>{if(this.kickScheduled=false,!this.running&&!Q())try{this.flush();}catch(t){setTimeout(()=>{throw t});}})));}flush(){fe(!this.running,"[Scheduler] flush() called while already running"),this.running=true,this.depth=0;let n=null;try{for(;this.head<this.q.length;){this.depth++;let t=this.q[this.head++];try{this.executionDepth++,t(),this.executionDepth--;}catch(r){this.executionDepth>0&&(this.executionDepth=0),n=r;break}this.taskCount>0&&this.taskCount--;}}finally{if(this.running=false,this.depth=0,this.executionDepth=0,this.head>=this.q.length)this.q.length=0,this.head=0;else if(this.head>0){let t=this.q.length-this.head;for(let r=0;r<t;r++)this.q[r]=this.q[this.head+r];this.q.length=t,this.head=0;}this.flushVersion++,this.resolveWaiters();}if(n)throw n}runWithSyncProgress(n){let t=this.allowSyncProgress;this.allowSyncProgress=true;let i=this.flushVersion;try{let a=n();return !this.running&&this.q.length-this.head>0&&this.flush(),a}finally{try{this.flushVersion===i&&(this.flushVersion++,this.resolveWaiters());}catch(a){}this.allowSyncProgress=t;}}waitForFlush(n,t=2e3){let r=typeof n=="number"?n:this.flushVersion+1;return this.flushVersion>=r?Promise.resolve():new Promise((o,s)=>{let i=setTimeout(()=>{let a=globalThis.__ASKR__||{},l={flushVersion:this.flushVersion,queueLen:this.q.length-this.head,running:this.running,inHandler:this.inHandler,bulk:Q(),namespace:a};s(new Error(`waitForFlush timeout ${t}ms: ${JSON.stringify(l)}`));},t);this.waiters.push({target:r,resolve:o,reject:s,timer:i});})}getState(){return {queueLength:this.q.length-this.head,running:this.running,depth:this.depth,executionDepth:this.executionDepth,taskCount:this.taskCount,flushVersion:this.flushVersion,inHandler:this.inHandler,allowSyncProgress:this.allowSyncProgress}}setInHandler(n){this.inHandler=n;}isInHandler(){return this.inHandler}isExecuting(){return this.running||this.executionDepth>0}clearPendingSyncTasks(){let n=this.q.length-this.head;return n<=0?0:this.running?(this.q.length=this.head,this.taskCount=Math.max(0,this.taskCount-n),queueMicrotask(()=>{try{this.flushVersion++,this.resolveWaiters();}catch(t){}}),n):(this.q.length=0,this.head=0,this.taskCount=Math.max(0,this.taskCount-n),this.flushVersion++,this.resolveWaiters(),n)}resolveWaiters(){if(this.waiters.length===0)return;let n=[],t=[];for(let r of this.waiters)this.flushVersion>=r.target?(r.timer&&clearTimeout(r.timer),n.push(r.resolve)):t.push(r);this.waiters=t;for(let r of n)r();}},v=new me;function Ne(){return v.isExecuting()}var Re=Symbol("__tempoContextFrame__"),Z=null;function q(e,n){let t=Z;Z=e;try{return n()}finally{Z=t;}}function Ct(e,n){try{return n()}finally{}}function we(){return Z}function xe(){try{let e=globalThis;return e.__ASKR_DIAG||(e.__ASKR_DIAG={}),e.__ASKR_DIAG}catch(e){return {}}}function b(e,n){try{let t=xe();t[e]=n;try{let r=globalThis;try{let o=r.__ASKR__||(r.__ASKR__={});try{o[e]=n;}catch(s){}}catch(o){}}catch(r){}}catch(t){}}function N(e){try{let n=xe(),r=(typeof n[e]=="number"?n[e]:0)+1;n[e]=r;try{let o=globalThis,s=o.__ASKR__||(o.__ASKR__={});try{let i=typeof s[e]=="number"?s[e]:0;s[e]=i+1;}catch(i){}}catch(o){}}catch(n){}}function j(e){return !e.startsWith("on")||e.length<=2?null:e.slice(2).charAt(0).toLowerCase()+e.slice(3).toLowerCase()}function $(e){if(e==="wheel"||e==="scroll"||e.startsWith("touch"))return {passive:true}}function W(e,n=false){return t=>{v.setInHandler(true);try{e(t);}catch(r){a.error("[Askr] Event handler error:",r);}finally{if(v.setInHandler(false),n){let r=v.getState();(r.queueLength??0)>0&&!r.running&&queueMicrotask(()=>{try{v.isExecuting()||v.flush();}catch(o){queueMicrotask(()=>{throw o});}});}}}}function he(e){return e==="children"||e==="key"||e==="ref"}function ee(e){return !!(e==="children"||e==="key"||e.startsWith("on")&&e.length>2||e.startsWith("data-"))}function ge(e,n,t){try{if(n==="class"||n==="className")return e.className!==String(t);if(n==="value"||n==="checked")return e[n]!==t;let r=e.getAttribute(n);return t==null||t===!1?r!==null:String(t)!==r}catch{return true}}function Fe(e){for(let n of Object.keys(e))if(!ee(n))return true;return false}function Me(e,n){for(let t of Object.keys(n))if(!ee(t)&&ge(e,t,n[t]))return true;return false}function D(e){if(typeof e!="object"||e===null)return;let n=e,t=n.key??n.props?.key;if(t!==void 0)return typeof t=="symbol"?String(t):t}function Ie(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function ne(e){try{N("__DOM_REPLACE_COUNT"),b(`__LAST_DOM_REPLACE_STACK_${e}`,new Error().stack);}catch{}}function te(e,n){try{b("__LAST_FASTPATH_STATS",e),b("__LAST_FASTPATH_COMMIT_COUNT",1),n&&N(n);}catch{}}function re(e,n,t){(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&(t!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n,t):n!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n):a.warn(`[Askr][FASTPATH] ${e}`));}function G(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}var S=new WeakMap;function oe(e){return S.get(e)}function Pe(e){try{if(S.has(e))return;let n=Ie(e);if(n.size===0){n=new Map;let t=Array.from(e.children);for(let r of t){let o=(r.textContent||"").trim();if(o){n.set(o,r);let s=Number(o);Number.isNaN(s)||n.set(s,r);}}}n.size>0&&S.set(e,n);}catch{}}var De=new WeakSet;function an(e){let n=[];for(let t of e){let r=D(t);r!==void 0&&n.push({key:r,vnode:t});}return n}function ln(e){let n=[];for(let t of e){if(t===-1)continue;let r=0,o=n.length;for(;r<o;){let s=r+o>>1;n[s]<t?r=s+1:o=s;}r===n.length?n.push(t):n[r]=t;}return n.length}function un(e){for(let{vnode:n}of e){if(typeof n!="object"||n===null)continue;let t=n;if(t.props&&Fe(t.props))return true}return false}function cn(e,n){for(let{key:t,vnode:r}of e){let o=n?.get(t);if(!o||typeof r!="object"||r===null)continue;let i=r.props||{};for(let a of Object.keys(i))if(!ee(a)&&ge(o,a,i[a]))return true}return false}function L(e,n,t){let r=an(n),o=r.length,s=r.map(h=>h.key),i=t?Array.from(t.keys()):[],a=0;for(let h=0;h<s.length;h++){let A=s[h];(h>=i.length||i[h]!==A||!t?.has(A))&&a++;}let p=o>=128&&i.length>0&&a>Math.max(64,Math.floor(o*.1)),u=false,c=0;if(o>=128){let h=Array.from(e.children),A=r.map(({key:F})=>{let P=t?.get(F);return P?.parentElement===e?h.indexOf(P):-1});c=ln(A),u=c<Math.floor(o*.5);}let f=un(r),g=cn(r,t);return {useFastPath:(p||u)&&!g&&!f,totalKeyed:o,moveCount:a,lisLen:c,hasPropChanges:g}}var ye=false,V=null;function Oe(){ye=true,V=new WeakSet;try{let e=v.clearPendingSyncTasks?.()??0;}catch{}}function Ke(){ye=false,V=null;}function X(){return ye}function _e(e){if(V)try{V.add(e);}catch(n){}}function dn(e){return !!(V&&V.has(e))}function fn(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let s=o._readers;s&&s.delete(e);}e.lastRenderToken=r;for(let o of n){let s=o._readers;s||(s=new Map,o._readers=s),s.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function mn(e){if(!e||typeof e!="object"||!("type"in e))return e;let n=e;if(typeof n.type=="symbol"&&(n.type===b$1||String(n.type)==="Symbol(askr.fragment)")){let t=n.children||n.props?.children;if(Array.isArray(t)&&t.length>0){for(let r of t)if(r&&typeof r=="object"&&"type"in r&&typeof r.type=="string")return r}}return e}function pn(e,n){let t=mn(n);if(!t||typeof t!="object"||!("type"in t))return {useFastPath:false,reason:"not-vnode"};let r=t;if(r==null||typeof r.type!="string")return {useFastPath:false,reason:"not-intrinsic"};let o=e.target;if(!o)return {useFastPath:false,reason:"no-root"};let s=o.children[0];if(!s)return {useFastPath:false,reason:"no-first-child"};if(s.tagName.toLowerCase()!==String(r.type).toLowerCase())return {useFastPath:false,reason:"root-tag-mismatch"};let i=r.children||r.props?.children;if(!Array.isArray(i))return {useFastPath:false,reason:"no-children-array"};for(let d of i)if(typeof d=="object"&&d!==null&&"type"in d&&typeof d.type=="function")return {useFastPath:false,reason:"component-child-present"};if(e.mountOperations.length>0)return {useFastPath:false,reason:"pending-mounts"};try{Pe(s);}catch{}let a=oe(s),l=L(s,i,a);return !l.useFastPath||l.totalKeyed<128?{...l,useFastPath:false,reason:"renderer-declined"}:{...l,useFastPath:true}}function hn(e,n){let t=globalThis.__ASKR_RENDERER?.evaluate;if(typeof t!="function")return a.warn("[Tempo][FASTPATH][DEV] renderer.evaluate not available; declining fast-lane"),false;Oe();try{v.runWithSyncProgress(()=>{t(n,e.target);try{fn(e);}catch{}});let o=v.clearPendingSyncTasks?.()??0;return !0}finally{Ke();}}function gn(e,n){if(!pn(e,n).useFastPath)return false;try{return hn(e,n)}catch{return false}}typeof globalThis<"u"&&(globalThis.__ASKR_FASTLANE={isBulkCommitActive:X,enterBulkCommit:Oe,exitBulkCommit:Ke,tryRuntimeFastLaneSync:gn,markFastPathApplied:_e,isFastPathApplied:dn});var Le=Symbol("__FOR_BOUNDARY__");function T(e){return typeof e=="object"&&e!==null&&"type"in e}function Ve(e,n,t){let r=e.__ASKR_INSTANCE;if(r){try{Ue(r);}catch(o){a.warn("[Askr] cleanupComponent failed:",o);}try{delete e.__ASKR_INSTANCE;}catch(o){}}}function Be(e,n){try{let r=e.ownerDocument,o=r?.createTreeWalker;if(typeof o=="function"){let s=o.call(r,e,1),i=s.firstChild();for(;i;)n(i),i=s.nextNode();return}}catch{}let t=e.querySelectorAll("*");for(let r=0;r<t.length;r++)n(t[r]);}function R(e,n){if(!e||!(e instanceof Element))return;let t=false,r=null;try{Ve(e,r,t);}catch(o){a.warn("[Askr] cleanupInstanceIfPresent failed:",o);}try{Be(e,o=>{try{Ve(o,r,t);}catch(s){t?r.push(s):a.warn("[Askr] cleanupInstanceIfPresent descendant cleanup failed:",s);}});}catch(o){a.warn("[Askr] cleanupInstanceIfPresent descendant query failed:",o);}}function Ee(e,n){R(e);}var C=new WeakMap;function He(e){let n=C.get(e);if(n){for(let[t,r]of n)r.options!==void 0?e.removeEventListener(t,r.handler,r.options):e.removeEventListener(t,r.handler);C.delete(e);}}function M(e){e&&(He(e),Be(e,He));}var k=globalThis;function ie(e,n){}var _n=(e,n)=>e!=null&&typeof e=="object"&&"id"in e?e.id:n;function Wt(e,n,t){let r=typeof e=="function"?null:e,o=J();return {sourceState:r,items:new Map,orderedKeys:[],byFn:t||_n,renderFn:n,parentInstance:o,mounted:false}}var qe=1;function je(e,n,t,r){let o=t,s=Object.assign(()=>o,{set(c){let f=typeof c=="function"?c(o):c;f!==o&&(o=f);}}),i=()=>null,a=ae(`for-item-${e}`,i,{},null);r.parentInstance&&(a.ownerFrame=r.parentInstance.ownerFrame);let l=J();z(a);let d=We();a._currentRenderToken=qe++,a._pendingReadStates=new Set;let p=r.renderFn(n,()=>s());O(a),z(l);let u={key:e,item:n,indexSignal:s,componentInstance:a,vnode:p,_startStateIndex:d};return a._pendingFlushTask=()=>{let c=J();z(a),a.stateIndexCheck=-1;let f=a.stateValues;for(let m=0;m<f.length;m++){let h=f[m];h&&(h._hasBeenRead=false);}Ge(d),a._currentRenderToken=qe++,a._pendingReadStates=new Set;try{let m=r.renderFn(n,()=>s());u.vnode=m,O(a);}finally{z(c);}let g=r.parentInstance;g&&g._enqueueRun?.();},u}function En(e,n){let t=k.__ASKR_BENCH__?performance.now():0,{items:r,orderedKeys:o,byFn:s}=e,i=o.length,a=n.length;if(i<=a){let u=true;for(let c=0;c<i;c++)if(s(n[c],c)!==o[c]){u=false;break}if(u){let c=[];for(let f=0;f<i;f++){let g=n[f],m=o[f],h=r.get(m);let A=h.item!==g,F=h.indexSignal()!==f;if(A){h.item=g;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(g,()=>h.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}F&&h.indexSignal.set(f),c.push(h.vnode);}for(let f=i;f<a;f++){let g=n[f],m=s(g,f),h=je(m,g,f,e);r.set(m,h),c.push(h.vnode),o[f]=m;}return k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),c}}if(a<=i){let u=true;for(let c=0;c<a;c++)if(s(n[c],c)!==o[c]){u=false;break}if(u){let c=[];for(let f=0;f<a;f++){let g=n[f],m=o[f],h=r.get(m);let A=h.item!==g,F=h.indexSignal()!==f;if(A){h.item=g;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(g,()=>h.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}F&&h.indexSignal.set(f),c.push(h.vnode);}for(let f=a;f<i;f++){let g=o[f],m=r.get(g);if(m){let h=m.componentInstance;h.abortController.abort();for(let A of h.cleanupFns)try{A();}catch{}r.delete(g);}}return o.length=a,e.orderedKeys=o,k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),c}}if(i===a){let u=true;for(let c=0;c<i;c++)if(s(n[c],c)!==o[c]){u=false;break}if(u){let c=[];for(let f=0;f<i;f++){let g=n[f],m=o[f],h=r.get(m);let A=h.item!==g,F=h.indexSignal()!==f;if(A){h.item=g;let P=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=h.componentInstance,h.vnode=e.renderFn(g,()=>h.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=P;}F&&h.indexSignal.set(f),c.push(h.vnode);}return k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),c}}let l=new Set(o),d=[],p=[];for(let u=0;u<n.length;u++){let c=n[u],f=s(c,u);l.delete(f),d.push(f);let g=r.get(f);if(g){let m=g.item!==c,h=g.indexSignal()!==u;if(m){g.item=c;let A=k.__ASKR_CURRENT_INSTANCE__;k.__ASKR_CURRENT_INSTANCE__=g.componentInstance,g.vnode=e.renderFn(c,()=>g.indexSignal()),k.__ASKR_CURRENT_INSTANCE__=A;}h&&g.indexSignal.set(u),p.push(g.vnode);}else {let m=je(f,c,u,e);r.set(f,m),p.push(m.vnode);}}for(let u of l){let c=r.get(u);if(c){let f=c.componentInstance;f.abortController.abort();for(let g of f.cleanupFns)try{g();}catch{}r.delete(u);}}return e.orderedKeys=d,k.__ASKR_BENCH__&&ie("reconcile",performance.now()-t),p}function $e(e,n){let t=n();if(!Array.isArray(t))throw new Error("For source must evaluate to an array");return En(e,t)}var Sn=typeof document<"u",Xe=0;function kn(){let e="__COMPONENT_INSTANCE_ID";try{N(e);let t=globalThis.__ASKR_DIAG,r=t?t[e]:void 0;if(typeof r=="number"&&Number.isFinite(r))return `comp-${r}`}catch{}return Xe++,`comp-${Xe}`}function An(e,n,t){let r=W(t,true),o=$(n);o!==void 0?e.addEventListener(n,r,o):e.addEventListener(n,r),C.has(e)||C.set(e,new Map),C.get(e).set(n,{handler:r,original:t,options:o});}function bn(e,n,t){for(let r in n){let o=n[r];if(r==="ref"){Tn(e,o);continue}if(he(r)||o==null||o===false)continue;let s=j(r);if(s){An(e,s,o);continue}r==="class"||r==="className"?e.className=String(o):r==="value"||r==="checked"?Cn(e,r,o,t):e.setAttribute(r,String(o));}}function Tn(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function Cn(e,n,t,r){n==="value"?((Y(r,"input")||Y(r,"textarea")||Y(r,"select"))&&(e.value=String(t)),e.setAttribute("value",String(t))):n==="checked"&&(Y(r,"input")&&(e.checked=!!t),e.setAttribute("checked",String(!!t)));}function ze(e,n,t){let r=n.key??t?.key;r!==void 0&&e.setAttribute("data-key",String(r));}function _(e){if(!Sn)return null;if(typeof e=="string")return document.createTextNode(e);if(typeof e=="number")return document.createTextNode(String(e));if(!e)return null;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let t of e){let r=_(t);r&&n.appendChild(r);}return n}if(typeof e=="object"&&e!==null&&"type"in e){let n=e.type,t=e.props||{};if(typeof n=="string")return vn(e,n,t);if(typeof n=="function")return Nn(e,n,t);if(n===Le)return wn(e,t);if(typeof n=="symbol"&&(n===b$1||String(n)==="Symbol(Fragment)"))return Rn(e,t)}return null}function vn(e,n,t){let r=document.createElement(n);ze(r,e,t),bn(r,t,n);let o=t.children??e.children;if(o!=null)if(Array.isArray(o)){for(let s of o){let i=_(s);i&&r.appendChild(i);}}else {let s=_(o);s&&r.appendChild(s);}return r}function Nn(e,n,t){let o=e[Re]||we(),s=n;if(s.constructor.name==="AsyncFunction")throw new Error("Async components are not supported. Use resource() for async work.");let a=e.__instance;a||(a=ae(kn(),s,t||{},null),e.__instance=a),o&&(a.ownerFrame=o);let l=q(o,()=>Qe(a));if(l instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");let d=q(o,()=>_(l));if(d instanceof Element)return ke(a,d),d;if(!d){let u=document.createComment("");return a._placeholder=u,a.mounted=true,a.notifyUpdate=a._enqueueRun,u}let p=document.createElement("div");return p.appendChild(d),ke(a,p),p}function Rn(e,n){let t=document.createDocumentFragment(),r=n.children||e.children;if(r)if(Array.isArray(r))for(let o of r){let s=_(o);s&&t.appendChild(s);}else {let o=_(r);o&&t.appendChild(o);}return t}function wn(e,n){let t=e._forState;if(!t)return document.createDocumentFragment();let r=n.source,o=$e(t,r),s=[],i=false;for(let l=0;l<o.length;l++){let d=o[l],p=d.key,u=null;if(p!=null&&t.items.has(p)){let c=t.items.get(p);c._dom&&c.vnode===d&&(u=c._dom);}u||(u=_(d),i=true,p!=null&&t.items.has(p)&&(t.items.get(p)._dom=u??void 0)),s.push(u);}if(!i&&s.length!==t.orderedKeys.length&&(i=true),!i)return document.createDocumentFragment();let a=document.createDocumentFragment();for(let l of s)l&&a.appendChild(l);return a}function I(e,n,t=true){if(!T(n))return;let r=n.props||{};ze(e,n,r);let o=C.get(e),s=null;for(let i in r){let a=r[i];if(he(i))continue;let l=j(i);if(a==null||a===false){if(i==="class"||i==="className")e.className="";else if(l&&o?.has(l)){let d=o.get(l);d.options!==void 0?e.removeEventListener(l,d.handler,d.options):e.removeEventListener(l,d.handler),o.delete(l);}else e.removeAttribute(i);continue}if(i==="class"||i==="className")e.className=String(a);else if(i==="value"||i==="checked")e[i]=a;else if(l){o&&o.size>0&&(s??=new Set).add(l);let d=o?.get(l);if(d&&d.original===a)continue;d&&(d.options!==void 0?e.removeEventListener(l,d.handler,d.options):e.removeEventListener(l,d.handler));let p=W(a,true),u=$(l);u!==void 0?e.addEventListener(l,p,u):e.addEventListener(l,p),C.has(e)||C.set(e,new Map),C.get(e).set(l,{handler:p,original:a,options:u});}else e.setAttribute(i,String(a));}if(o&&o.size>0)if(s===null){for(let[i,a]of o)a.options!==void 0?e.removeEventListener(i,a.handler,a.options):e.removeEventListener(i,a.handler);C.delete(e);}else {for(let[i,a]of o)s.has(i)||(a.options!==void 0?e.removeEventListener(i,a.handler,a.options):e.removeEventListener(i,a.handler),o.delete(i));o.size===0&&C.delete(e);}if(t){let i=n.children||r.children;xn(e,i);}}function xn(e,n){if(!n){e.textContent="";return}if(!Array.isArray(n)&&(typeof n=="string"||typeof n=="number")){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=String(n):e.textContent=String(n);return}if(Array.isArray(n)){Ae(e,n);return}e.textContent="";let t=_(n);t&&e.appendChild(t);}function Ae(e,n){let t=Array.from(e.children),r=n.some(i=>typeof i=="string"||typeof i=="number"),o=n.some(i=>T(i));if(r&&o){let i=Array.from(e.childNodes),a=Math.max(i.length,n.length);for(let l=0;l<a;l++){let d=i[l],p=n[l];if(p===void 0&&d){d.nodeType===1&&R(d),d.remove();continue}if(!d&&p!==void 0){let u=_(p);u&&e.appendChild(u);continue}if(!(!d||p===void 0)){if(typeof p=="string"||typeof p=="number")if(d.nodeType===3)d.data=String(p);else {let u=document.createTextNode(String(p));e.replaceChild(u,d);}else if(T(p))if(d.nodeType===1){let u=d;if(typeof p.type=="string")if(B(u.tagName,p.type))I(u,p);else {let c=_(p);c&&(M(u),R(u),e.replaceChild(c,d));}}else {let u=_(p);u&&e.replaceChild(u,d);}}}return}if(n.length===1&&t.length===0&&e.childNodes.length===1){let i=n[0],a=e.firstChild;if((typeof i=="string"||typeof i=="number")&&a?.nodeType===3){a.data=String(i);return}}t.length===0&&e.childNodes.length>0&&(e.textContent="");let s=Math.max(t.length,n.length);for(let i=0;i<s;i++){let a=t[i],l=n[i];if(l===void 0&&a){R(a),a.remove();continue}if(!a&&l!==void 0){let d=_(l);d&&e.appendChild(d);continue}if(!(!a||l===void 0))if(typeof l=="string"||typeof l=="number")a.textContent=String(l);else if(T(l))if(typeof l.type=="string")if(B(a.tagName,l.type))I(a,l);else {let d=_(l);d&&(a instanceof Element&&M(a),R(a),e.replaceChild(d,a));}else {let d=_(l);d&&(a instanceof Element&&M(a),R(a),e.replaceChild(d,a));}else {let d=_(l);d&&(a instanceof Element&&M(a),R(a),e.replaceChild(d,a));}}}function le(e,n){let t=n.length,r=0,o=0,s=G(),i=process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true";for(let d=0;d<t;d++){let{key:p,vnode:u}=n[d],c=e.children[d];if(c&&T(u)&&typeof u.type=="string"){let f=u.type;if(B(c.tagName,f)){let g=u.children||u.props?.children;i&&re("positional idx",d,{chTag:c.tagName,vnodeType:f,chChildNodes:c.childNodes.length,childrenType:Array.isArray(g)?"array":typeof g}),Fn(c,g,u),In(c,p,()=>o++),r++;continue}else i&&re("positional tag mismatch",d,{chTag:c.tagName,vnodeType:f});}else i&&re("positional missing or invalid",d,{ch:!!c});Dn(e,d,u);}let a=G()-s;On(e,n);let l={n:t,reused:r,updatedKeys:o,t:a};return te(l,"bulkKeyedPositionalHits"),l}function Fn(e,n,t){typeof n=="string"||typeof n=="number"?H(e,String(n)):Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number")?H(e,String(n[0])):Mn(e,t)||I(e,t);}function Mn(e,n){let t=n.children||n.props?.children;if(!Array.isArray(t)||t.length!==2)return false;let r=t[0],o=t[1];if(!T(r)||!T(o)||typeof r.type!="string"||typeof o.type!="string")return false;let s=e.children[0],i=e.children[1];if(!s||!i||!B(s.tagName,r.type)||!B(i.tagName,o.type))return false;let a=r.children||r.props?.children,l=o.children||o.props?.children;if(typeof a=="string"||typeof a=="number")H(s,String(a));else if(Array.isArray(a)&&a.length===1&&(typeof a[0]=="string"||typeof a[0]=="number"))H(s,String(a[0]));else return false;if(typeof l=="string"||typeof l=="number")H(i,String(l));else if(Array.isArray(l)&&l.length===1&&(typeof l[0]=="string"||typeof l[0]=="number"))H(i,String(l[0]));else return false;return true}function H(e,n){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=n:e.textContent=n;}function In(e,n,t){try{let r=String(n);if(e.getAttribute("data-key")===r)return;e.setAttribute("data-key",r),t();}catch{}}function Pn(e){switch(e){case "div":return "DIV";case "span":return "SPAN";case "p":return "P";case "a":return "A";case "button":return "BUTTON";case "input":return "INPUT";case "ul":return "UL";case "ol":return "OL";case "li":return "LI";default:return null}}function Y(e,n){if(e===n)return true;let t=e.length;if(t!==n.length)return false;for(let r=0;r<t;r++){let o=e.charCodeAt(r),s=n.charCodeAt(r);if(o===s)continue;let i=o>=65&&o<=90?o+32:o,a=s>=65&&s<=90?s+32:s;if(i!==a)return false}return true}function B(e,n){let t=Pn(n);return t!==null&&e===t?true:Y(e,n)}function Dn(e,n,t){let r=_(t);if(r){let o=e.children[n];o?(R(o),e.replaceChild(r,o)):e.appendChild(r);}}function On(e,n){try{let t=S.get(e),r=t?(t.clear(),t):new Map;for(let o=0;o<n.length;o++){let s=n[o].key,i=e.children[o];i&&r.set(s,i);}S.set(e,r);}catch{}}function Je(e,n){let t=G(),r=Array.from(e.childNodes),o=[],s=0,i=0;for(let p=0;p<n.length;p++){let u=Kn(n[p],r[p],o);u==="reused"?s++:u==="created"&&i++;}let a=G()-t,l=Hn(e,o);S.delete(e);let d={n:n.length,reused:s,created:i,tBuild:a,tCommit:l};return Bn(d),d}function Kn(e,n,t){return typeof e=="string"||typeof e=="number"?Ln(String(e),n,t):typeof e=="object"&&e!==null&&"type"in e?Vn(e,n,t):"skipped"}function Ln(e,n,t){return n&&n.nodeType===3?(n.data=e,t.push(n),"reused"):(t.push(document.createTextNode(e)),"created")}function Vn(e,n,t){let r=e;if(typeof r.type=="string"){let s=r.type;if(n&&n.nodeType===1&&B(n.tagName,s))return I(n,e),t.push(n),"reused"}let o=_(e);return o?(t.push(o),"created"):"skipped"}function Hn(e,n){let t=Date.now(),r=document.createDocumentFragment();for(let o=0;o<n.length;o++)r.appendChild(n[o]);try{for(let o=e.firstChild;o;){let s=o.nextSibling;o instanceof Element&&M(o),R(o),o=s;}}catch{}return ne("bulk-text-replace"),e.replaceChildren(r),Date.now()-t}function Bn(e){try{b("__LAST_BULK_TEXT_FASTPATH_STATS",e),b("__LAST_FASTPATH_STATS",e),b("__LAST_FASTPATH_COMMIT_COUNT",1),N("bulkTextFastpathHits");}catch{}}function Ye(e,n){let t=Number(process.env.ASKR_BULK_TEXT_THRESHOLD)||1024,r=.8,o=Array.isArray(n)?n.length:0;if(o<t)return Se({phase:"bulk-unkeyed-eligible",reason:"too-small",total:o,threshold:t}),false;let s=Un(n);if(s.componentFound!==void 0)return Se({phase:"bulk-unkeyed-eligible",reason:"component-child",index:s.componentFound}),false;let i=s.simple/o,a=i>=r&&e.childNodes.length>=o;return Se({phase:"bulk-unkeyed-eligible",total:o,simple:s.simple,fraction:i,requiredFraction:r,eligible:a}),a}function Un(e){let n=0;for(let t=0;t<e.length;t++){let r=e[t];if(typeof r=="string"||typeof r=="number"){n++;continue}if(typeof r=="object"&&r!==null&&"type"in r){let o=r;if(typeof o.type=="function")return {simple:n,componentFound:t};typeof o.type=="string"&&qn(o)&&n++;}}return {simple:n}}function qn(e){let n=e.children||e.props?.children;return !!(!n||typeof n=="string"||typeof n=="number"||Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number"))}function Se(e){if(process.env.ASKR_FASTPATH_DEBUG==="1")try{b("__BULK_DIAG",e);}catch{}}function Ze(e,n,t,r){if(typeof document>"u")return null;let o=n.length;if(o===0&&(!r||r.length===0))return null;Ne()||a.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let s,i;if(o<=20)try{let u=e.children;s=new Array(u.length);for(let c=0;c<u.length;c++)s[c]=u[c];}catch(u){s=void 0;}else {i=new Map;try{for(let u=e.firstElementChild;u;u=u.nextElementSibling){let c=u.getAttribute("data-key");if(c!==null){i.set(c,u);let f=Number(c);Number.isNaN(f)||i.set(f,u);}}}catch(u){i=void 0;}}let a$1=[],l=0,d=0,p=0;for(let u=0;u<n.length;u++){let{key:c,vnode:f}=n[u];l++;let g;if(o<=20&&s){let m=String(c);for(let h=0;h<s.length;h++){let A=s[h],F=A.getAttribute("data-key");if(F!==null&&(F===m||Number(F)===c)){g=A;break}}g||(g=t?.get(c));}else g=i?.get(c)??t?.get(c);if(g)a$1.push(g),p++;else {let m=_(f);m&&(a$1.push(m),d++);}}if(r&&r.length)for(let u of r){let c=_(u);c&&(a$1.push(c),d++);}try{let u=Date.now(),c=document.createDocumentFragment(),f=0;for(let m=0;m<a$1.length;m++)c.appendChild(a$1[m]),f++;try{for(let m=e.firstChild;m;){let h=m.nextSibling;m instanceof Element&&M(m),R(m),m=h;}}catch(m){}try{N("__DOM_REPLACE_COUNT"),b("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack);}catch(m){}e.replaceChildren(c);try{b("__LAST_FASTPATH_COMMIT_COUNT",1);}catch(m){}try{X()&&_e(e);}catch(m){}let g=new Map;for(let m=0;m<n.length;m++){let h=n[m].key,A=a$1[m];A instanceof Element&&g.set(h,A);}try{let m={n:o,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-u,t_commit:0,t_bookkeeping:0,fragmentAppendCount:f,mapLookups:l,createdNodes:d,reusedCount:p};typeof globalThis<"u"&&(b("__LAST_FASTPATH_STATS",m),b("__LAST_FASTPATH_REUSED",p>0),N("fastpathHistoryPush")),(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH]",JSON.stringify({n:o,createdNodes:d,reusedCount:p}));}catch(m){}try{De.add(e);}catch(m){}return g}catch(u){return null}}function ue(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let s=r>=65&&r<=90?r+32:r,i=o>=65&&o<=90?o+32:o;if(s!==i)return false}return true}function ce(e,n,t){let{keyedVnodes:r,unkeyedVnodes:o}=$n(n),s=t||jn(e),i=Wn(e,n,r,o,s);return i||Qn(e,n,r,s)}function jn(e){let n=new Map;try{for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}}catch{}return n}function $n(e){let n=[],t=[];for(let r=0;r<e.length;r++){let o=e[r],s=D(o);s!==void 0?n.push({key:s,vnode:o}):t.push(o);}return {keyedVnodes:n,unkeyedVnodes:t}}function Wn(e,n,t,r,o){try{let s=Gn(e,n,t,r,o);if(s)return s;let i=Xn(e,t);if(i)return i}catch{}return null}function Gn(e,n,t,r,o){if(L(e,n,o).useFastPath&&t.length>=128||X())try{let i=Ze(e,t,o,r);if(i)return S.set(e,i),i}catch{}return null}function Xn(e,n){let t=n.length;if(t<10||zn(e,n)/t<.9||Jn(e,n))return null;try{let o=le(e,n);return te(o,"bulkKeyedPositionalHits"),Yn(e),S.get(e)}catch{return null}}function zn(e,n){let t=0;try{for(let r=0;r<n.length;r++){let o=n[r].vnode;if(!o||typeof o!="object"||typeof o.type!="string")continue;let s=e.children[r];s&&ue(s.tagName,o.type)&&t++;}}catch{}return t}function Jn(e,n){try{for(let t=0;t<n.length;t++){let r=n[t].vnode,o=e.children[t];if(!(!o||!r||typeof r!="object")&&Me(o,r.props||{}))return !0}}catch{return true}return false}function Yn(e){try{let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}S.set(e,n);}catch{}}function Qn(e,n,t,r){let o=new Map,s=[],i=new WeakSet,a=Zn(e,r,i);for(let l=0;l<n.length;l++){let d=n[l],p=nt(d,l,e,a,i,o);p&&s.push(p);}return typeof document>"u"||(at(e,s),S.delete(e)),o}function Zn(e,n,t){return r=>{if(!n)return;let o=n.get(r);if(o&&!t.has(o))return t.add(o),o;let s=String(r),i=n.get(s);if(i&&!t.has(i))return t.add(i),i;let a=Number(s);if(!Number.isNaN(a)){let l=n.get(a);if(l&&!t.has(l))return t.add(l),l}return et(e,r,s,t)}}function et(e,n,t,r){try{for(let o=e.firstElementChild;o;o=o.nextElementSibling){if(r.has(o))continue;let s=o.getAttribute("data-key");if(s===t)return r.add(o),o;if(s!==null){let i=Number(s);if(!Number.isNaN(i)&&i===n)return r.add(o),o}}}catch{}}function nt(e,n,t,r,o,s){let i=D(e);return i!==void 0?tt(e,i,t,r,s):rt(e,n,t,o)}function tt(e,n,t,r,o){let s=r(n);if(s&&s.parentElement===t)try{let a=e;if(a&&typeof a=="object"&&typeof a.type=="string"&&ue(s.tagName,a.type))return I(s,e),o.set(n,s),s}catch{}let i=_(e);return i?(i instanceof Element&&o.set(n,i),i):null}function rt(e,n,t,r){try{let s=t.children[n];if(s&&(typeof e=="string"||typeof e=="number")&&s.nodeType===1)return s.textContent=String(e),r.add(s),s;if(ot(s,e))return I(s,e),r.add(s),s;let i=st(t,r);if(i){let a=it(i,e,r);if(a)return a}}catch{}return _(e)}function ot(e,n){if(!e||typeof n!="object"||n===null||!("type"in n))return false;let t=n,r=e.getAttribute("data-key");return r==null&&typeof t.type=="string"&&ue(e.tagName,t.type)}function st(e,n){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!n.has(t)&&t.getAttribute("data-key")===null)return t}function it(e,n,t){if(typeof n=="string"||typeof n=="number")return e.textContent=String(n),t.add(e),e;if(typeof n=="object"&&n!==null&&"type"in n){let r=n;if(typeof r.type=="string"&&ue(e.tagName,r.type))return I(e,n),t.add(e),e}return null}function at(e,n){let t=document.createDocumentFragment();for(let r=0;r<n.length;r++)t.appendChild(n[r]);try{for(let r=e.firstChild;r;){let o=r.nextSibling;r instanceof Element&&M(r),R(r),r=o;}}catch{}ne("reconcile"),e.replaceChildren(t);}var be=new WeakMap;function Te(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let s=r>=65&&r<=90?r+32:r,i=o>=65&&o<=90?o+32:o;if(s!==i)return false}return true}function lt(e){if(Array.isArray(e)){if(e.length===1){let n=e[0];if(typeof n=="string"||typeof n=="number")return {isSimple:true,text:String(n)}}}else if(typeof e=="string"||typeof e=="number")return {isSimple:true,text:String(e)};return {isSimple:false}}function ut(e,n){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=n,true):false}function en(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function ct(e){let n=S.get(e);return n||(n=en(e),n.size>0&&S.set(e,n)),n.size>0?n:void 0}function nn(e){for(let n=0;n<e.length;n++)if(D(e[n])!==void 0)return true;return false}function dt(e,n,t){if(process.env.ASKR_FORCE_BULK_POSREUSE==="1"&&ft(e,n))return;let r=ce(e,n,t);S.set(e,r);}function ft(e,n){try{let t=[];for(let s of n)T(s)&&s.key!==void 0&&t.push({key:s.key,vnode:s});if(t.length===0||t.length!==n.length)return !1;(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced positional bulk keyed reuse (evaluate-level)");let r=le(e,t);if(process.env.ASKR_FASTPATH_DEBUG==="1")try{b("__LAST_FASTPATH_STATS",r),b("__LAST_FASTPATH_COMMIT_COUNT",1),N("bulkKeyedPositionalForced");}catch{}let o=en(e);return S.set(e,o),!0}catch(t){return (process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced bulk path failed, falling back",t),false}}function mt(e,n){if(Ye(e,n)){Je(e,n);}else Ae(e,n);S.delete(e);}function pt(e,n){if(!n){e.textContent="",S.delete(e);return}if(!Array.isArray(n)){e.textContent="";let t=_(n);t&&e.appendChild(t),S.delete(e);return}if(nn(n)){let t=ct(e);try{dt(e,n,t);}catch{let r=ce(e,n,t);S.set(e,r);}}else mt(e,n);}function Ce(e,n){let t=n.children||n.props?.children;t&&!Array.isArray(t)&&(t=[t]);let r=lt(t);r.isSimple&&ut(e,r.text)||pt(e,t),I(e,n,false);}function ht(e,n){let t=e.firstElementChild;for(let r=0;r<n.length;r++){let o=n[r],s=t?t.nextElementSibling:null;if(t&&T(o)&&typeof o.type=="string"&&Te(t.tagName,o.type)){Ce(t,o),t=s;continue}let i=_(o);i&&(t?e.replaceChild(i,t):e.appendChild(i)),t=s;}for(;t;){let r=t.nextElementSibling;e.removeChild(t),t=r;}}function gt(e,n){for(let[t,r]of Object.entries(n)){if(t==="children"||t==="key"||r==null||r===false)continue;if(t==="ref"){yt(e,r);continue}let o=j(t);if(o){let s=W(r,true),i=$(o);i!==void 0?e.addEventListener(o,s,i):e.addEventListener(o,s),C.has(e)||C.set(e,new Map),C.get(e).set(o,{handler:s,original:r,options:i});continue}t==="class"||t==="className"?e.className=String(r):t==="value"||t==="checked"?e[t]=r:e.setAttribute(t,String(r));}}function yt(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function _t(e,n){let t=n.children;if(!Array.isArray(t)||!nn(t))return false;let r=document.createElement(n.type);e.appendChild(r),gt(r,n.props||{});let o=ce(r,t,void 0);return S.set(r,o),true}function Et(e){return T(e)&&typeof e.type=="symbol"&&(e.type===b$1||String(e.type)==="Symbol(askr.fragment)")}function St(e){let n=e.props?.children||e.children||[];return Array.isArray(n)?n:[n]}function U(e,n,t){if(n&&!(typeof document>"u"))if(t&&be.has(t)){let r=be.get(t),o=r.start.nextSibling;for(;o&&o!==r.end;){let i=o.nextSibling;o.remove(),o=i;}let s=_(e);s&&n.insertBefore(s,r.end);}else if(t){let r=document.createComment("component-start"),o=document.createComment("component-end");n.appendChild(r),n.appendChild(o),be.set(t,{start:r,end:o});let s=_(e);s&&n.insertBefore(s,o);}else {let r=e;if(Et(r)){let a=St(r);if(a.length===1&&T(a[0])&&typeof a[0].type=="string")r=a[0];else {ht(n,a);return}}let s=n.__ASKR_INSTANCE;if(s&&s.target===n)if(T(r)&&typeof r.type=="string"&&Te(n.tagName,r.type)){Ce(n,r);return}else {let a=_(r);if(a&&n.parentNode){a instanceof Element&&(a.__ASKR_INSTANCE=s,s.target=a),M(n),n.parentNode.replaceChild(a,n);return}}let i=n.children[0];if(i&&T(r)&&typeof r.type=="string"&&Te(i.tagName,r.type))Ce(i,r);else {if(n.textContent="",T(r)&&typeof r.type=="string"&&_t(n,r))return;let a=_(r);a&&n.appendChild(a);}}}if(typeof globalThis<"u"){let e=globalThis;e.__ASKR_RENDERER={evaluate:U,isKeyedReorderFastPathEligible:L,getKeyMapForElement:oe};}function ae(e,n,t,r){let o={id:e,fn:n,props:t,target:r,mounted:false,abortController:new AbortController,stateValues:[],evaluationGeneration:0,notifyUpdate:null,_pendingFlushTask:void 0,_pendingRunTask:void 0,_enqueueRun:void 0,stateIndexCheck:-1,expectedStateIndices:[],firstRenderComplete:false,mountOperations:[],cleanupFns:[],hasPendingUpdate:false,ownerFrame:null,ssr:false,cleanupStrict:false,isRoot:false,_currentRenderToken:void 0,lastRenderToken:0,_pendingReadStates:new Set,_lastReadStates:new Set};return o._pendingRunTask=()=>{o.hasPendingUpdate=false,on(o);},o._enqueueRun=()=>{o.hasPendingUpdate||(o.hasPendingUpdate=true,v.enqueue(o._pendingRunTask));},o._pendingFlushTask=()=>{o.hasPendingUpdate=false,o._enqueueRun?.();},o}var x=null,de=0;function $r(){return x}function z(e){x=e;}function tn(e){if(e.isRoot){for(let n of e.mountOperations){let t=n();t instanceof Promise?t.then(r=>{typeof r=="function"&&e.cleanupFns.push(r);}):typeof t=="function"&&e.cleanupFns.push(t);}e.mountOperations=[];}}function ke(e,n){e.target=n;try{n instanceof Element&&(n.__ASKR_INSTANCE=e);}catch(r){}e.notifyUpdate=e._enqueueRun;let t=!e.mounted;e.mounted=true,t&&e.mountOperations.length>0&&tn(e);}var rn=0;function on(e){e.notifyUpdate=e._enqueueRun,e._currentRenderToken=++rn,e._pendingReadStates=new Set;let n=e.target?e.target.innerHTML:"",t=sn(e);if(t instanceof Promise)throw new Error("Async components are not supported. Components must be synchronous.");{let r=globalThis.__ASKR_FASTLANE;try{if(r?.tryRuntimeFastLaneSync?.(e,t))return}catch{}v.enqueue(()=>{if(!e.target&&e._placeholder){if(t==null){O(e);return}let o=e._placeholder,s=o.parentNode;if(!s){a.warn("[Askr] placeholder no longer in DOM, cannot render component");return}let i=document.createElement("div"),a$1=x;x=e;try{U(t,i),s.replaceChild(i,o),e.target=i,e._placeholder=void 0,i.__ASKR_INSTANCE=e,O(e);}finally{x=a$1;}return}if(e.target){let o=[];try{let s=!e.mounted,i=x;x=e,o=Array.from(e.target.childNodes);try{U(t,e.target);}catch(a$1){try{let l=Array.from(e.target.childNodes);for(let d of l)try{Ee(d);}catch(p){a.warn("[Askr] error cleaning up failed commit children:",p);}}catch(l){}try{N("__DOM_REPLACE_COUNT"),b("__LAST_DOM_REPLACE_STACK_COMPONENT_RESTORE",new Error().stack);}catch(l){}throw e.target.replaceChildren(...o),a$1}finally{x=i;}O(e),e.mounted=!0,s&&e.mountOperations.length>0&&tn(e);}catch(s){try{let i=Array.from(e.target.childNodes);for(let a$1 of i)try{Ee(a$1);}catch(l){a.warn("[Askr] error cleaning up partial children during rollback:",l);}}catch(i){}try{try{N("__DOM_REPLACE_COUNT"),b("__LAST_DOM_REPLACE_STACK_COMPONENT_ROLLBACK",new Error().stack);}catch(i){}e.target.replaceChildren(...o);}catch{e.target.innerHTML=n;}throw s}}});}}function Qe(e){let n=e._currentRenderToken!==void 0,t=e._currentRenderToken,r=e._pendingReadStates;n||(e._currentRenderToken=++rn,e._pendingReadStates=new Set);try{let o=sn(e);return n||O(e),o}finally{e._currentRenderToken=t,e._pendingReadStates=r??new Set;}}function sn(e){e.stateIndexCheck=-1;for(let n of e.stateValues)n&&(n._hasBeenRead=false);e._pendingReadStates=new Set,x=e,de=0;try{let t={signal:e.abortController.signal},r={parent:e.ownerFrame,values:null},o=q(r,()=>e.fn(e.props,t)),s=Date.now()-0;s>5&&a.warn(`[askr] Slow render detected: ${s}ms. Consider optimizing component performance.`),e.firstRenderComplete||(e.firstRenderComplete=!0);for(let i=0;i<e.stateValues.length;i++){let a$1=e.stateValues[i];if(a$1&&!a$1._hasBeenRead)try{let l=e.fn?.name||"<anonymous>";a.warn(`[askr] Unused state variable detected in ${l} at index ${i}. State should be read during render or removed.`);}catch{a.warn("[askr] Unused state variable detected. State should be read during render or removed.");}}return o}finally{x=null;}}function kt(e){e.abortController=new AbortController,e.notifyUpdate=e._enqueueRun,v.enqueue(()=>on(e));}function J(){return x}function Gr(){if(!x)throw new Error("getSignal() can only be called during component render execution. Ensure you are calling this from inside your component function.");return x.abortController.signal}function O(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let s=o._readers;s&&s.delete(e);}e.lastRenderToken=r;for(let o of n){let s=o._readers;s||(s=new Map,o._readers=s),s.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function Xr(){return de++}function We(){return de}function Ge(e){de=e;}function zr(e){kt(e);}function Ue(e){let n=[];for(let t of e.cleanupFns)try{t();}catch(r){e.cleanupStrict&&n.push(r);}if(e.cleanupFns=[],n.length>0)throw new AggregateError(n,`Cleanup failed for component ${e.id}`);if(e._lastReadStates){for(let t of e._lastReadStates){let r=t._readers;r&&r.delete(e);}e._lastReadStates=new Set;}e.abortController.abort(),e.notifyUpdate=null,e.mounted=false;}export{fe as a,v as b,Ct as c,we as d,X as e,Le as f,M as g,Wt as h,ae as i,$r as j,z as k,J as l,Gr as m,Xr as n,zr as o,Ue as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,l}from'./chunk-
|
|
1
|
+
import {b,l}from'./chunk-7DNGQWPJ.js';import {p,o}from'./chunk-LW2VF6A3.js';var e=null;function f(n,t){e=n,b();}function c(n){if(typeof window>"u")return;let t=l(n);t&&(window.history.pushState({path:n},"",n),e&&(p(e),e.fn=t.handler,e.props=t.params,e.stateValues=[],e.expectedStateIndices=[],e.firstRenderComplete=false,e.stateIndexCheck=-1,e.evaluationGeneration++,e.notifyUpdate=null,e.abortController=new AbortController,o(e)));}function s(n){let t=window.location.pathname;if(!e)return;let o$1=l(t);o$1&&(p(e),e.fn=o$1.handler,e.props=o$1.params,e.stateValues=[],e.expectedStateIndices=[],e.firstRenderComplete=false,e.stateIndexCheck=-1,e.evaluationGeneration++,e.notifyUpdate=null,e.abortController=new AbortController,o(e));}function u(){typeof window<"u"&&window.addEventListener("popstate",s);}function m(){typeof window<"u"&&window.removeEventListener("popstate",s);}export{f as a,c as b,u as c,m as d};
|
package/dist/for/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{a as For}from'../chunk-BJ3TA3ZK.js';import'../chunk-FYTGHAKU.js';import'../chunk-LW2VF6A3.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-FYTGHAKU.js';import {c}from'../chunk-HZKAD5DE.js';export{i as applyInteractionPolicy,c as ariaDisabled,d as ariaExpanded,e as ariaSelected,a as composeHandlers,g as composeRefs,k as layout,j as mergeInteractionProps,b as mergeProps,h as pressable,f as setRef}from'../chunk-HZKAD5DE.js';import {b,a as a$1}from'../chunk-4RTKQ7SC.js';export{d as DefaultPortal,c as definePortal}from'../chunk-4RTKQ7SC.js';import'../chunk-LW2VF6A3.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import {b as b$1,a as a$2}from'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function w(e){return `${e.prefix??"askr"}-${String(e.id)}`}function F({node:e,disabled:o,onDismiss:n}){function r(l){o||l.key==="Escape"&&(l.preventDefault?.(),l.stopPropagation?.(),n?.("escape"));}function s(l){if(o)return;let t=l.target;t instanceof Node&&e&&(e.contains(t)||n?.("outside"));}return {onKeyDown:r,onPointerDownCapture:s}}function M({disabled:e,tabIndex:o}){return {tabIndex:e?-1:o===void 0?0:o,...c(e)}}function H({disabled:e,onEnter:o,onLeave:n}){return {onPointerEnter:e?void 0:r=>{o?.(r);},onPointerLeave:e?void 0:r=>{n?.(r);}}}function A(e){let{currentIndex:o,itemCount:n,orientation:r="horizontal",loop:s=false,onNavigate:l,isDisabled:t}=e;function i(u,p){let a=u+p;if(s)a<0&&(a=n-1),a>=n&&(a=0);else if(a<0||a>=n)return;return t?.(a)?a===u?void 0:i(a,p):a}function d(u){let{key:p}=u,a;if((r==="horizontal"||r==="both")&&(p==="ArrowRight"&&(a=1),p==="ArrowLeft"&&(a=-1)),(r==="vertical"||r==="both")&&(p==="ArrowDown"&&(a=1),p==="ArrowUp"&&(a=-1)),a===void 0)return;let f=i(o,a);f!==void 0&&(u.preventDefault?.(),u.stopPropagation?.(),l?.(f));}return {container:{onKeyDown:d},item:u=>({tabIndex:u===o?0:-1,"data-roving-index":u})}}function T(e){return e!==void 0}function g(e,o){let n=T(e);return {value:n?e:o,isControlled:n}}function K(e){let{value:o,defaultValue:n,onChange:r,setInternal:s}=e,{isControlled:l}=g(o,n);function t(i){l||s?.(i),r?.(i);}return {set:t,isControlled:l}}function J(e){let o=a(e.defaultValue),n=e.value!==void 0;function r(){return n?e.value:o()}return r.set=s=>{let l=r(),t=typeof s=="function"?s(l):s;if(!Object.is(l,t)){if(n){e.onChange?.(t);return}o.set(s),e.onChange?.(t);}},r.isControlled=n,r}function X(e){if(e.asChild){let{children:n,asChild:r,...s}=e;return a$1(n)?b(n,s):null}return {$$typeof:a$2,type:b$1,props:{children:e.children},key:null}}function z({present:e,children:o}){return (typeof e=="function"?e():!!e)?{$$typeof:a$2,type:b$1,props:{children:o},key:null}:null}function $(){let e=new Map;function o(l,t){let i={node:l,metadata:t};return e.set(l,i),()=>{e.delete(l);}}function n(){return Array.from(e.values())}function r(){e.clear();}function s(){return e.size}return {register:o,items:n,clear:r,size:s}}function j(){let e=[],o=1;function n(t){let i=o++,d={id:i,options:t};e.push(d);function u(){return e[e.length-1]?.id===i}function p(){let a=e.findIndex(f=>f.id===i);a!==-1&&e.splice(a,1);}return {id:i,isTop:u,unregister:p}}function r(){return e.map(t=>({id:t.id,isTop:()=>e[e.length-1]?.id===t.id,unregister:()=>{let i=e.findIndex(d=>d.id===t.id);i!==-1&&e.splice(i,1);}}))}function s(){let t=e[e.length-1];t&&t.options.onEscape?.();}function l(t){let i=e[e.length-1];if(!i)return;let d=i.options.node;d&&t.target instanceof Node&&d.contains(t.target)||i.options.onOutsidePointer?.(t);}return {register:n,layers:r,handleEscape:s,handleOutsidePointer:l}}export{z as Presence,X as Slot,J as controllableState,$ as createCollection,j as createLayer,F as dismissable,M as focusable,w as formatId,H as hoverable,T as isControlled,K as makeControllable,g as resolveControllable,A as rovingFocus};
|
package/dist/fx/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {j,b as b$1}from'../chunk-
|
|
1
|
+
import {j,b as b$1}from'../chunk-LW2VF6A3.js';import {a}from'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function k(l,t,n){let e=null,{leading:r=false,trailing:i=true}=n||{},o=null,u=null,a=0,s=function(...f){let c=Date.now();o=f,u=this,e!==null&&clearTimeout(e),r&&c-a>=t&&(l.apply(this,f),a=c),i&&(e=setTimeout(()=>{l.apply(u,o),e=null,a=Date.now();},t));};return s.cancel=()=>{e!==null&&(clearTimeout(e),e=null);},s}function E(l,t,n){let e=0,r=null,{leading:i=true,trailing:o=true}=n||{},u=null,a=null,s=function(...f){let c=Date.now();u=f,a=this,i&&c-e>=t?(l.apply(this,f),e=c,r!==null&&(clearTimeout(r),r=null)):!i&&e===0&&(e=c),o&&r===null&&(r=setTimeout(()=>{l.apply(a,u),e=Date.now(),r=null;},t-(c-e)));};return s.cancel=()=>{r!==null&&(clearTimeout(r),r=null);},s}function x(l){let t=false,n;return((...e)=>(t||(t=true,n=l(...e)),n))}function g(l){Promise.resolve().then(l);}function F(l){let t=null,n=null,e=null;return function(...r){n=r,e=this,t===null&&(t=requestAnimationFrame(()=>{l.apply(e,n),t=null;}));}}function I(l,t){typeof requestIdleCallback<"u"?requestIdleCallback(l,t?{timeout:t.timeout}:void 0):Promise.resolve().then(()=>{setTimeout(l,0);});}function b(l){return new Promise(t=>setTimeout(t,l))}async function R(l,t){let{maxAttempts:n=3,delayMs:e=100,backoff:r=o=>e*Math.pow(2,o)}=t||{},i=null;for(let o=0;o<n;o++)try{return await l()}catch(u){if(i=u,o<n-1){let a=r(o);await b(a);}}throw i||new Error("Retry failed")}var h=Object.assign(l=>{},{cancel(){}}),y=Object.assign(l=>{},{cancel(){},flush(){}});function p(){if(j()!==null)throw new Error("[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.")}function d(l){b$1.enqueue(()=>{try{l();}catch(t){a.error("[Askr] FX handler error:",t);}});}function C(l,t,n){let{leading:e=false,trailing:r=true}=n||{},i=j();if(i&&i.ssr)return y;let o=null,u=null,a=0,s=function(f){p();let c=Date.now();u=f,o!==null&&(clearTimeout(o),o=null),e&&c-a>=l&&(d(()=>t.call(null,f)),a=c),r&&(o=setTimeout(()=>{u&&d(()=>t.call(null,u)),o=null,a=Date.now();},l));};return s.cancel=()=>{o!==null&&(clearTimeout(o),o=null),u=null;},s.flush=()=>{if(o!==null){clearTimeout(o);let f=u;u=null,o=null,f&&d(()=>t.call(null,f));}},i&&i.cleanupFns.push(()=>{s.cancel();}),s}function A(l,t,n){let{leading:e=true,trailing:r=true}=n||{},i=j();if(i&&i.ssr)return h;let o=0,u=null,a=null,s=function(f){p();let c=Date.now();if(a=f,e&&c-o>=l?(d(()=>t.call(null,f)),o=c,u!==null&&(clearTimeout(u),u=null)):!e&&o===0&&(o=c),r&&u===null){let w=l-(c-o);u=setTimeout(()=>{a&&d(()=>t.call(null,a)),o=Date.now(),u=null;},Math.max(0,w));}};return s.cancel=()=>{u!==null&&(clearTimeout(u),u=null),a=null;},i&&i.cleanupFns.push(()=>s.cancel()),s}function L(l){let t=j();if(t&&t.ssr)return h;let n=null,e=null,r=()=>{n=(typeof requestAnimationFrame<"u"?requestAnimationFrame:u=>setTimeout(()=>u(Date.now()),16))(()=>{if(n=null,e){let u=e;e=null,d(()=>l.call(null,u));}});},i=function(o){p(),e=o,n===null&&r();};return i.cancel=()=>{n!==null&&(typeof cancelAnimationFrame<"u"&&typeof n=="number"?cancelAnimationFrame(n):clearTimeout(n),n=null),e=null;},t&&t.cleanupFns.push(()=>i.cancel()),i}function q(l,t){p();let n=j();if(n&&n.ssr)return ()=>{};let e=setTimeout(()=>{e=null,d(t);},l),r=()=>{e!==null&&(clearTimeout(e),e=null);};return n&&n.cleanupFns.push(r),r}function D(l,t){p();let n=j();if(n&&n.ssr)return ()=>{};let e=null,r=false;typeof requestIdleCallback<"u"?(r=true,e=requestIdleCallback(()=>{e=null,d(l);},t)):e=setTimeout(()=>{e=null,d(l);},0);let i=()=>{e!==null&&(r&&typeof cancelIdleCallback<"u"&&typeof e=="number"?cancelIdleCallback(e):clearTimeout(e),e=null);};return n&&n.cleanupFns.push(i),i}function O(l,t){p();let n=j();if(n&&n.ssr)return {cancel:()=>{}};let{maxAttempts:e=3,delayMs:r=100,backoff:i=s=>r*Math.pow(2,s)}=t||{},o=false,u=s=>{o||b$1.enqueue(()=>{if(o)return;l().then(()=>{},()=>{if(!o&&s+1<e){let c=i(s);setTimeout(()=>{u(s+1);},c);}}).catch(c=>{a.error("[Askr] scheduleRetry error:",c);});});};u(0);let a$1=()=>{o=true;};return n&&n.cleanupFns.push(a$1),{cancel:a$1}}export{k as debounce,C as debounceEvent,g as defer,I as idle,x as once,F as raf,L as rafEvent,R as retry,D as scheduleIdle,O as scheduleRetry,q as scheduleTimeout,E as throttle,A as throttleEvent,b as timeout};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { C as ComponentFunction } from './component-AJMg1Gmv.js';
|
|
2
2
|
export { S as State, s as state } from './component-AJMg1Gmv.js';
|
|
3
3
|
import { R as Route } from './router-DaGtH1Sq.js';
|
|
4
|
+
export { For, ForOptions } from './for/index.js';
|
|
4
5
|
export { P as Props } from './jsx-CPjsGyEg.js';
|
|
5
6
|
|
|
6
7
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as state}from'./chunk-
|
|
1
|
+
export{a as For}from'./chunk-BJ3TA3ZK.js';export{a as state}from'./chunk-FYTGHAKU.js';import {d}from'./chunk-4RTKQ7SC.js';import {b}from'./chunk-D2JSJKCW.js';import {j,g,p,i,o,b as b$1}from'./chunk-LW2VF6A3.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import {a,b as b$2}from'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';var R=Symbol.for("__ASKR_HAS_ROUTES__");var N=0,l=new WeakMap,A=Symbol.for("__tempoCleanup__");function k(e,n){e[A]=()=>{let t=[];try{g(e);}catch(o){t.push(o);}try{let o=e.querySelectorAll("*");for(let s of Array.from(o))try{let r=s.__ASKR_INSTANCE;if(r){try{p(r);}catch(a){t.push(a);}try{delete s.__ASKR_INSTANCE;}catch(a){t.push(a);}}}catch(r){t.push(r);}}catch(o){t.push(o);}try{p(n);}catch(o){t.push(o);}if(t.length>0&&n.cleanupStrict)throw new AggregateError(t,"cleanup failed for app root")};try{let t=Object.getOwnPropertyDescriptor(e,"innerHTML")||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"innerHTML")||Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML");t&&(t.get||t.set)&&Object.defineProperty(e,"innerHTML",{get:t.get?function(){return t.get.call(this)}:void 0,set:function(o){if(o===""&&l.get(this)===n){try{g(e);}catch(s){if(n.cleanupStrict)throw s}try{p(n);}catch(s){if(n.cleanupStrict)throw s}}if(t.set)return t.set.call(this,o)},configurable:!0});}catch{}}function w(e,n,t){let o$1=(a$1,c)=>{let i=n(a$1,c),d$1={$$typeof:a,type:d,props:{},key:"__default_portal"};return {$$typeof:a,type:b$2,props:{children:i==null?[d$1]:[i,d$1]}}};Object.defineProperty(o$1,"name",{value:n.name||"Component"});let s=e[A];s&&s();let r=l.get(e);if(r){g(e);try{p(r);}catch{}r.fn=o$1,r.evaluationGeneration++,r.mounted=false,r.expectedStateIndices=[],r.firstRenderComplete=false,r.isRoot=true,t&&typeof t.cleanupStrict=="boolean"&&(r.cleanupStrict=t.cleanupStrict);}else {let a=String(++N);r=i(a,o$1,{},e),l.set(e,r),r.isRoot=true,t&&typeof t.cleanupStrict=="boolean"&&(r.cleanupStrict=t.cleanupStrict);}k(e,r),o(r),b$1.flush();}function L(e){if(b("islands"),!e||typeof e!="object")throw new Error("createIsland requires a config object");if(typeof e.component!="function")throw new Error("createIsland: component must be a function");let n=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!n)throw new Error(`Root element not found: ${e.root}`);if("routes"in e)throw new Error("createIsland does not accept routes; use createSPA for routed apps");try{if(globalThis[R])throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.")}catch{}w(n,e.component,{cleanupStrict:e.cleanupStrict});}async function M(e){if(b("spa"),!e||typeof e!="object")throw new Error("createSPA requires a config object");if(!Array.isArray(e.routes)||e.routes.length===0)throw new Error("createSPA requires a route table. If you are enhancing existing HTML, use createIsland instead.");let n=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!n)throw new Error(`Root element not found: ${e.root}`);let{clearRoutes:t,route:o,lockRouteRegistration:s,resolveRoute:r}=await import('./route-WP5TWBJE.js');t();for(let p of e.routes)o(p.path,p.handler,p.namespace);s();let a=typeof window<"u"?window.location.pathname:"/",c=r(a);if(!c){w(n,()=>({type:"div",children:[]}),{cleanupStrict:false});let{registerAppInstance:p,initializeNavigation:b}=await import('./navigate-R2PQVY2C.js'),E=l.get(n);if(!E)throw new Error("Internal error: app instance missing");p(E,a),b();return}w(n,c.handler,{cleanupStrict:false});let{registerAppInstance:i,initializeNavigation:d}=await import('./navigate-R2PQVY2C.js'),y=l.get(n);if(!y)throw new Error("Internal error: app instance missing");i(y,a),d();}var O=new WeakMap;function _(e){let n=O.get(e);return n||(n=new Map,O.set(e,n)),n}function H(e,n){if(n===void 0&&typeof e=="function"){let a=e();if(a==null)return null;let c=j();if(!c)return a;let i=_(c);return i.has(a)?i.get(a):(i.set(a,a),a)}let t;if(typeof e=="function"&&!("value"in e)?t=e():t=e?.value??e,t==null)return null;let o=j();if(!o)return n(t);let s=_(o);if(s.has(t))return s.get(t);let r=n(t);return s.set(t,r),r}export{L as createIsland,M as createSPA,H as derive};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{d as cleanupNavigation,c as initializeNavigation,b as navigate,a as registerAppInstance}from'./chunk-OD6C42QU.js';import'./chunk-7DNGQWPJ.js';import'./chunk-D2JSJKCW.js';import'./chunk-LW2VF6A3.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
|
package/dist/resources/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-FYTGHAKU.js';import {c,a as a$1}from'../chunk-YRY4OLQF.js';import {j,d as d$1,b,c as c$1}from'../chunk-LW2VF6A3.js';export{m as getSignal}from'../chunk-LW2VF6A3.js';import {a as a$2}from'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';var d=class{constructor(o,a,i){this.value=null;this.pending=true;this.error=null;this.generation=0;this.controller=null;this.deps=null;this.resourceFrame=null;this.subscribers=new Set;this.fn=o,this.deps=a?a.slice():null,this.resourceFrame=i,this.snapshot={value:null,pending:true,error:null,refresh:()=>this.refresh()};}subscribe(o){return this.subscribers.add(o),()=>this.subscribers.delete(o)}notifySubscribers(){this.snapshot.value=this.value,this.snapshot.pending=this.pending,this.snapshot.error=this.error;for(let o of this.subscribers)o();}start(o=false,a=true){let i=this.generation;this.controller?.abort();let l=new AbortController;this.controller=l,this.pending=true,this.error=null,a&&this.notifySubscribers();let u;try{u=c$1(this.resourceFrame,()=>this.fn({signal:l.signal}));}catch(t){this.pending=false,this.error=t,a&&this.notifySubscribers();return}if(!(u instanceof Promise)){this.value=u,this.pending=false,this.error=null,a&&this.notifySubscribers();return}o&&c().throwSSRDataMissing(),u.then(t=>{this.generation===i&&this.controller===l&&(this.value=t,this.pending=false,this.error=null,this.notifySubscribers());}).catch(t=>{if(this.generation===i&&this.controller===l){this.pending=false,this.error=t;try{this.ownerName?a$2.error(`[Askr] Async resource error in ${this.ownerName}:`,t):a$2.error("[Askr] Async resource error:",t);}catch{}this.notifySubscribers();}});}refresh(){this.generation++,this.controller?.abort(),this.start();}abort(){this.controller?.abort();}};function x(b$1,o=[]){let a$2=j(),i=a$2;if(!a$2){let r=c(),e=r.getCurrentRenderData();if(e){let n=r.getNextKey();return n in e||r.throwSSRDataMissing(),{value:e[n],pending:false,error:null,refresh:()=>{}}}throw r.getCurrentSSRContext()&&r.throwSSRDataMissing(),new Error("[Askr] resource() must be called during component render inside an app. Do not create resources at module scope or outside render.")}let l=c(),u=l.getCurrentRenderData();if(u){let r=l.getNextKey();r in u||l.throwSSRDataMissing();let e=u[r],p=a({cell:void 0,snapshot:{value:e,pending:false,error:null,refresh:()=>{}}}),n=p();return n.snapshot.value=e,n.snapshot.pending=false,n.snapshot.error=null,p.set(n),n.snapshot}let t=a({cell:void 0,snapshot:{value:null,pending:true,error:null,refresh:()=>{}}}),c$1=t();if(!c$1.cell){let r=d$1(),e=new d(b$1,o,r);e.ownerName=i.fn?.name||"<anonymous>",c$1.cell=e,c$1.snapshot=e.snapshot;let p=e.subscribe(()=>{let n=t();n.snapshot.value=e.snapshot.value,n.snapshot.pending=e.snapshot.pending,n.snapshot.error=e.snapshot.error,t.set(n);try{i._enqueueRun?.();}catch{}});if(i.cleanupFns.push(()=>{p(),e.abort();}),i.ssr){if(e.start(true,false),!e.pending){let n=t();n.snapshot.value=e.value,n.snapshot.pending=e.pending,n.snapshot.error=e.error;}}else b.enqueue(()=>{try{e.start(!1,!1);}catch(n){let h=t();h.snapshot.value=e.value,h.snapshot.pending=e.pending,h.snapshot.error=n??null,t.set(h),i._enqueueRun?.();return}if(!e.pending){let n=t();n.snapshot.value=e.value,n.snapshot.pending=e.pending,n.snapshot.error=e.error,t.set(n),i._enqueueRun?.();}});}let s=c$1.cell;if(!s.deps||s.deps.length!==o.length||s.deps.some((r,e)=>r!==o[e])){s.deps=o.slice(),s.generation++,s.pending=true,s.error=null;try{if(i.ssr){if(s.start(!0,!1),!s.pending){let r=t();r.snapshot.value=s.value,r.snapshot.pending=s.pending,r.snapshot.error=s.error;}}else b.enqueue(()=>{if(s.start(!1,!1),!s.pending){let r=t();r.snapshot.value=s.value,r.snapshot.pending=s.pending,r.snapshot.error=s.error,t.set(r),i._enqueueRun?.();}});}catch(r){if(r instanceof a$1)throw r;s.error=r,s.pending=false;let e=t();e.snapshot.value=s.value,e.snapshot.pending=s.pending,e.snapshot.error=s.error;}}return c$1.snapshot}export{x as resource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as _lockRouteRegistrationForTests,d as _unlockRouteRegistrationForTests,i as clearRoutes,k as getLoadedNamespaces,g as getNamespaceRoutes,f as getRoutes,b as lockRouteRegistration,j as registerRoute,l as resolveRoute,e as route,a as setServerLocation,h as unloadNamespace}from'./chunk-
|
|
1
|
+
export{c as _lockRouteRegistrationForTests,d as _unlockRouteRegistrationForTests,i as clearRoutes,k as getLoadedNamespaces,g as getNamespaceRoutes,f as getRoutes,b as lockRouteRegistration,j as registerRoute,l as resolveRoute,e as route,a as setServerLocation,h as unloadNamespace}from'./chunk-7DNGQWPJ.js';import'./chunk-D2JSJKCW.js';import'./chunk-LW2VF6A3.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
|
package/dist/router/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'../chunk-
|
|
1
|
+
import {b}from'../chunk-OD6C42QU.js';export{b as navigate}from'../chunk-OD6C42QU.js';import {i,b as b$1}from'../chunk-HZKAD5DE.js';export{k as layout}from'../chunk-HZKAD5DE.js';export{i as clearRoutes,f as getRoutes,e as route}from'../chunk-7DNGQWPJ.js';import'../chunk-D2JSJKCW.js';import'../chunk-LW2VF6A3.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function c({href:o,children:p}){let i$1=i({isNative:true,disabled:false,onPress:u=>{let t=u;(t.button??0)!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),b(o));}});return {type:"a",props:b$1(i$1,{href:o,children:p})}}export{c as Link};
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -13,10 +13,24 @@ declare class SSRDataMissingError extends Error {
|
|
|
13
13
|
* Common call contracts: SSR types
|
|
14
14
|
*/
|
|
15
15
|
type SSRData = Record<string, unknown>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* SSR Context Management
|
|
19
|
+
*
|
|
20
|
+
* Provides concurrency-safe context for server-side rendering.
|
|
21
|
+
* In Node.js, uses AsyncLocalStorage for isolation between concurrent requests.
|
|
22
|
+
* Falls back to stack-based approach in non-Node environments.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
interface RenderContext {
|
|
26
|
+
url: string;
|
|
18
27
|
seed: number;
|
|
19
|
-
|
|
28
|
+
data?: SSRData;
|
|
29
|
+
params?: Record<string, string>;
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
keyCounter: number;
|
|
32
|
+
renderData: Record<string, unknown> | null;
|
|
33
|
+
}
|
|
20
34
|
|
|
21
35
|
/**
|
|
22
36
|
* Shared SSR types
|
|
@@ -24,7 +38,7 @@ type RenderContext = {
|
|
|
24
38
|
|
|
25
39
|
/** VNode representation for SSR rendering */
|
|
26
40
|
type VNode = {
|
|
27
|
-
type: string | SSRComponent;
|
|
41
|
+
type: string | SSRComponent | symbol;
|
|
28
42
|
props?: Props;
|
|
29
43
|
children?: unknown[];
|
|
30
44
|
};
|
|
@@ -41,7 +55,7 @@ type SSRComponent = (props: Props, context?: {
|
|
|
41
55
|
* SSR Data Management
|
|
42
56
|
*
|
|
43
57
|
* Manages render-phase keying for deterministic SSR data lookup.
|
|
44
|
-
*
|
|
58
|
+
* All state is stored in the per-render context for concurrency safety.
|
|
45
59
|
*/
|
|
46
60
|
|
|
47
61
|
type ResourceDescriptor = {
|
|
@@ -72,6 +86,9 @@ declare const resolveResources: typeof resolvePlan;
|
|
|
72
86
|
* SSR is synchronous: async components are not supported; async work should use
|
|
73
87
|
* `resource()` which is rejected during synchronous SSR. This module throws
|
|
74
88
|
* when an async component or async resource is encountered during sync SSR.
|
|
89
|
+
*
|
|
90
|
+
* Concurrency: Each render call uses AsyncLocalStorage (Node.js) to isolate
|
|
91
|
+
* render state, making concurrent SSR requests safe.
|
|
75
92
|
*/
|
|
76
93
|
|
|
77
94
|
type Component = SSRComponent;
|
package/dist/ssr/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d}from'../chunk-4RTKQ7SC.js';import {b as b$1,a}from'../chunk-YRY4OLQF.js';export{a as SSRDataMissingError}from'../chunk-YRY4OLQF.js';import {m}from'../chunk-76FYOA5Z.js';import'../chunk-D2JSJKCW.js';import {j as j$1,i,k}from'../chunk-P3C5XSNF.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import {a as a$1,b as b$2}from'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function B(n,e){try{return e()}finally{}}function H(n=12345){return {seed:n}}var x=null;function Y(){return x}function Z(n,e){let t=x;x=n;try{return e()}finally{x=t;}}function C(){throw new a}var W=0,M=null;function q(){return M}function Q(){W=0;}function nn(){return `r:${W++}`}function $(n){M=n??null,Q();}function b(){M=null,Q();}var en="SSR collection/prepass is removed: SSR is strictly synchronous";async function tn(n){throw new Error(`${en}; async resource plans are not supported`)}function fn(n){throw new Error(`${en}; collectResources is disabled`)}var dn=tn;var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E=new Map,rn=256,Sn=/[&<>]/g,mn=/[&"'<>]/g,gn=/[{}<>\\]/g,yn=/(?:url|expression|javascript)\s*\(/i,O=new Map,Rn=512,hn=n=>{let e=n.charCodeAt(0);return e===38?"&":e===60?"<":e===62?">":n},wn=n=>{let e=n.charCodeAt(0);return e===38?"&":e===34?""":e===39?"'":e===60?"<":e===62?">":n};function Cn(n){let e=O.get(n);if(e!==void 0)return e;let t=n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);return O.size<Rn&&O.set(n,t),t}function y(n){let e=n.length<=64;if(e){let s=E.get(n);if(s!==void 0)return s}let t=String(n),o=false;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);if(i===38||i===60||i===62){o=true;break}}if(!o)return e&&E.size<rn&&E.set(n,t),t;let r=t.replace(Sn,hn);return e&&E.size<rn&&E.set(n,r),r}function j(n){let e=String(n),t=false;for(let o=0;o<e.length;o++){let r=e.charCodeAt(o);if(r===38||r===34||r===39||r===60||r===62){t=true;break}}return t?e.replace(mn,wn):e}function En(n){let e=String(n),t=false,o=-1;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);if(s===123||s===125||s===60||s===62||s===92){if(t=true,o>=0)break}else if(s===40&&o<0&&(o=r,t))break}return !t&&o===-1?e:o!==-1&&yn.test(e)?"":t?e.replace(gn,""):e}function on(n){if(!n||typeof n!="object")return null;let e=Object.entries(n);if(e.length===0)return "";let t=[];for(let[o,r]of e){if(r==null||r===false)continue;let s=Cn(o),i=En(String(r));i&&t.push(`${s}:${i};`);}return t.join("")}function R(n,e){if(!n||typeof n!="object")return e?.returnDangerousHtml?{attrs:""}:"";let t=[],o,r=n;for(let i in r){let a=r[i];if(i==="children"||i==="key"||i==="ref")continue;if(i==="dangerouslySetInnerHTML"){a&&typeof a=="object"&&"__html"in a&&(o=String(a.__html));continue}if(i.length>=3&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90||i.length>0&&i[0]==="_")continue;let f=i==="class"||i==="className"?"class":i;if(f==="style"){let d=typeof a=="string"?a:on(a);if(d===null||d==="")continue;t.push(` style="${j(d)}"`);continue}if(a===true)t.push(` ${f}`);else {if(a===false||a===null||a===void 0)continue;{let d=String(a);t.push(` ${f}="${j(d)}"`);}}}let s=t.join("");return e?.returnDangerousHtml?{attrs:s,dangerousHtml:o}:s}var _=class _{constructor(){this.chunks=[];this.bufferChunks=[];this.bufferLen=0;}write(e){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length,this.bufferLen>=_.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0));}end(){this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}toString(){return this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0),this.chunks.join("")}};_.FLUSH_THRESHOLD=32*1024;var h=_,A=class{constructor(e,t){this.onChunk=e;this.onComplete=t;}write(e){e&&this.onChunk(e);}end(){this.onComplete();}};function kn(n){return !!n&&typeof n=="object"&&"type"in n}function sn(n){let e=n,t=Array.isArray(e?.children)?e?.children:null,o=e?.props?.children,r=t??o;return r==null||r===false?[]:Array.isArray(r)?r:[r]}function un(n,e,t){for(let o of n)V(o,e,t);}function xn(n){return !n||typeof n!="object"?false:typeof n.then=="function"}function $n(n,e,t){let o=n(e??{},{signal:t.signal});return xn(o)&&C(),o}function V(n,e,t){if(n==null)return;if(typeof n=="string"){e.write(y(n));return}if(typeof n=="number"){e.write(y(String(n)));return}if(!kn(n))return;let{type:o,props:r}=n;if(typeof o=="symbol"&&(o===b$2||String(o)==="Symbol(Fragment)")){let c=sn(n);un(c,e,t);return}if(typeof o=="function"){let c=B(t,()=>$n(o,r,t));V(c,e,t);return}let s=String(o),{attrs:i,dangerousHtml:a}=R(r,{returnDangerousHtml:true});if(N.has(s)){e.write(`<${s}${i} />`);return}if(e.write(`<${s}${i}>`),a!==void 0)e.write(a);else {let c=sn(n);un(c,e,t);}e.write(`</${s}>`);}var X=new Map;function w(n){let e=X.get(n);return e||(e={open:`<${n}`,close:`</${n}>`,selfClose:`<${n} />`},X.size<256&&X.set(n,e)),e}b$1({getCurrentSSRContext:Y,throwSSRDataMissing:C,getCurrentRenderData:q,getNextKey:nn});function Zn(){}function Wn(){}function bn(n,e,t){if(!(n==null||n===false)){if(typeof n=="string"){e.write(y(n));return}if(typeof n=="number"){e.write(y(String(n)));return}n&&typeof n=="object"&&"type"in n&&D(n,e,t);}}function I(n,e,t){if(!(!n||!Array.isArray(n)||n.length===0))for(let o=0;o<n.length;o++)bn(n[o],e,t);}function D(n,e,t){let{type:o,props:r}=n;if(typeof o=="function"){let u=J(o,r,t);D(u,e,t);return}if(typeof o=="symbol"){if(o===b$2){let u=Array.isArray(n.children)?n.children:Array.isArray(r?.children)?r?.children:void 0;I(u,e,t);return}throw new Error(`renderNodeSyncToSink: unsupported VNode symbol type: ${String(o)}`)}let s=o;if(N.has(s)){let u=r?R(r):"",{selfClose:p}=w(s);e.write(u?`${p.slice(0,-3)}${u} />`:p);return}let i=r?r?.dangerouslySetInnerHTML:void 0;if(i!=null){let{attrs:u,dangerousHtml:p}=R(r,{returnDangerousHtml:true}),{open:S,close:l}=w(s);e.write(u?`${S}${u}>`:`${S}>`),p!==void 0?e.write(p):I(n.children,e,t),e.write(l);return}let a=r?R(r):"",c=n.children;if(c===void 0&&r?.children!==void 0){let u=r.children;Array.isArray(u)?c=u:u!==null&&u!==false&&(c=[u]);}if(!c||Array.isArray(c)&&c.length===0){let{open:u,close:p}=w(s);e.write(a?`${u}${a}>${p}`:`${u}>${p}`);return}if(Array.isArray(c)&&c.length===1){let u=c[0];if(typeof u=="string"){let{open:p,close:S}=w(s),l=y(u);e.write(a?`${p}${a}>${l}${S}`:`${p}>${l}${S}`);return}if(typeof u=="number"){let{open:p,close:S}=w(s),l=y(String(u));e.write(a?`${p}${a}>${l}${S}`:`${p}>${l}${S}`);return}}let{open:f,close:d}=w(s);e.write(a?`${f}${a}>`:`${f}>`),I(c,e,t),e.write(d);}function J(n,e,t){{let o=j$1(),r=i("ssr-temp",n,e||{},null);r.ssr=true,k(r);try{return Z(t,()=>{let s=n(e||{},{ssr:t});if(s instanceof Promise&&C(),typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null||s===void 0){let i=s==null||s===!1?"":String(s);return {$$typeof:a$1,type:b$2,props:{children:i?[i]:[]}}}return s})}finally{k(o);}}}function Nn(n,e,t){let o=t?.seed??12345,r=H(o);$(t?.data??null);try{let i=J((c,f)=>{let d$1=n(c??{},f),u={$$typeof:a$1,type:d,props:{},key:"__default_portal"};return d$1==null?{$$typeof:a$1,type:b$2,props:{children:[u]}}:{$$typeof:a$1,type:b$2,props:{children:[d$1,u]}}},e||{},r);if(!i)throw new Error("renderToStringSync: wrapped component returned empty");let a=new h;return D(i,a,r),a.end(),a.toString()}finally{b();}}function qn(n){let{url:e,routes:t,options:o}=n,{clearRoutes:r,route:s,setServerLocation:i,lockRouteRegistration:a,resolveRoute:c}=m;r();for(let p of t)s(p.path,p.handler,p.namespace);i(e),a();let f=c(e);if(!f)throw new Error(`renderToStringSync: no route found for url: ${e}`);let d$1=o?.seed??12345,u=H(d$1);$(o?.data??null);try{let S=J((pn,ln)=>{let G=f.handler(pn??{},ln),F={$$typeof:a$1,type:d,props:{},key:"__default_portal"};return G==null?{$$typeof:a$1,type:b$2,props:{children:[F]}}:{$$typeof:a$1,type:b$2,props:{children:[G,F]}}},f.params||{},u),l=new h;return D(S,l,u),l.end(),l.toString()}finally{b();}}function te(n){if(typeof n=="function")return Nn(n);let e=n,t=new h;return cn({...e,sink:t}),t.end(),t.toString()}function re(n){let e=new A(n.onChunk,n.onComplete);cn({...n,sink:e}),e.end();}function cn(n){let{url:e,routes:t,seed:o=12345,data:r,sink:s}=n,{clearRoutes:i,route:a,setServerLocation:c,lockRouteRegistration:f,resolveRoute:d}=m;i();for(let l of t)a(l.path,l.handler,l.namespace);c(e),f();let u=d(e);if(!u)throw new Error(`SSR: no route found for url: ${e}`);let p={url:e,seed:o,data:r,params:u.params,signal:void 0},S=u.handler(u.params);$(r||null);try{V(S,s,p);}finally{b();}}export{fn as collectResources,Wn as popSSRStrictPurityGuard,Zn as pushSSRStrictPurityGuard,re as renderToStream,te as renderToString,Nn as renderToStringSync,qn as renderToStringSyncForUrl,tn as resolvePlan,dn as resolveResources};
|
|
1
|
+
import {d}from'../chunk-4RTKQ7SC.js';import {b as b$1,a as a$1}from'../chunk-YRY4OLQF.js';export{a as SSRDataMissingError}from'../chunk-YRY4OLQF.js';import {m}from'../chunk-7DNGQWPJ.js';import'../chunk-D2JSJKCW.js';import {j,i,k as k$1}from'../chunk-LW2VF6A3.js';import'../chunk-HGMOQ3I7.js';import'../chunk-BP2CKUO6.js';import {b as b$2,a as a$2}from'../chunk-37RC6ZT3.js';import {a}from'../chunk-62D2TNHX.js';var b=null;try{let n=a("async_hooks");n?.AsyncLocalStorage&&(b=new n.AsyncLocalStorage);}catch{}var N=null;function D(n=12345,e={}){return {url:e.url??"",seed:n,data:e.data,params:e.params,signal:e.signal,keyCounter:0,renderData:null}}function _(n,e){if(b)return b.run(n,e);let t=N;N=n;try{return e()}finally{N=t;}}function y(){return b?b.getStore()??null:N}function x(){throw new a$1}function Q(){return y()?.renderData??null}function ee(){let n=y();return n?`r:${n.keyCounter++}`:"r:0"}function T(n){let e=y();e&&(e.renderData=n??null,e.keyCounter=0);}function v(){let n=y();n&&(n.renderData=null,n.keyCounter=0);}var ne="SSR collection/prepass is removed: SSR is strictly synchronous";async function te(n){throw new Error(`${ne}; async resource plans are not supported`)}function fe(n){throw new Error(`${ne}; collectResources is disabled`)}var pe=te;var L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E=new Map,re=256,le=/[&<>]/g,de=/[&"'<>]/g,ge=/[{}<>\\]/g,Se=/(?:url|expression|javascript)\s*\(/i,I=new Map,me=512,ye=n=>{let e=n.charCodeAt(0);return e===38?"&":e===60?"<":e===62?">":n},he=n=>{let e=n.charCodeAt(0);return e===38?"&":e===34?""":e===39?"'":e===60?"<":e===62?">":n};function Re(n){let e=I.get(n);if(e!==void 0)return e;let t=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);return I.size<me&&I.set(n,t),t}function we(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t===38||t===60||t===62)return true}return false}function X(n){for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t===38||t===34||t===39||t===60||t===62)return true}return false}function h(n){let e=n.length<=64;if(e){let r=E.get(n);if(r!==void 0)return r}if(!we(n))return e&&E.size<re&&E.set(n,n),n;let t=n.replace(le,ye);return e&&E.size<re&&E.set(n,t),t}function k(n){return n.replace(de,he)}function Ce(n){let e=String(n),t=false,r=-1;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s===123||s===125||s===60||s===62||s===92){if(t=true,r>=0)break}else if(s===40&&r<0&&(r=o,t))break}return !t&&r===-1?e:r!==-1&&Se.test(e)?"":t?e.replace(ge,""):e}function J(n){if(!n||typeof n!="object")return null;let e=n,t="";for(let r in e){let o=e[r];if(o==null||o===false)continue;let s=Re(r),a=Ce(String(o));a&&(t+=`${s}:${a};`);}return t||null}function oe(n){return n.length>=3&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>=65&&n.charCodeAt(2)<=90}function U(n,e){if(!n||typeof n!="object")return;let t=n;for(let r in t){let o=t[r];if(r==="children"||r==="key"||r==="ref"||r==="dangerouslySetInnerHTML"||oe(r)||r.charCodeAt(0)===95)continue;let s=r==="className"?"class":r;if(s==="style"){let i=typeof o=="string"?o:J(o);if(!i)continue;e.write(' style="'),X(i)?e.write(k(i)):e.write(i),e.write('"');continue}if(o===true){e.write(" "),e.write(s);continue}if(o===false||o===null||o===void 0)continue;let a=String(o);e.write(" "),e.write(s),e.write('="'),X(a)?e.write(k(a)):e.write(a),e.write('"');}}function P(n,e){if(!n||typeof n!="object")return e?.returnDangerousHtml?{attrs:""}:"";let t=[],r,o=n;for(let a in o){let i=o[a];if(a==="children"||a==="key"||a==="ref")continue;if(a==="dangerouslySetInnerHTML"){i&&typeof i=="object"&&"__html"in i&&(r=String(i.__html));continue}if(oe(a)||a.charCodeAt(0)===95)continue;let c=a==="class"||a==="className"?"class":a;if(c==="style"){let p=typeof i=="string"?i:J(i);if(p===null||p==="")continue;t.push(` style="${k(p)}"`);continue}if(i===true)t.push(` ${c}`);else {if(i===false||i===null||i===void 0)continue;{let p=String(i);t.push(` ${c}="${k(p)}"`);}}}let s=t.join("");return e?.returnDangerousHtml?{attrs:s,dangerousHtml:r}:s}var R=class R{constructor(){this.chunks=[];this.bufferChunks=[];this.bufferLen=0;}write(e){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length,this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0));}write2(e,t){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length),t&&(this.bufferChunks.push(t),this.bufferLen+=t.length),this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}write3(e,t,r){e&&(this.bufferChunks.push(e),this.bufferLen+=e.length),t&&(this.bufferChunks.push(t),this.bufferLen+=t.length),r&&(this.bufferChunks.push(r),this.bufferLen+=r.length),this.bufferLen>=R.FLUSH_THRESHOLD&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}end(){this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0);}toString(){return this.bufferLen&&(this.chunks.push(this.bufferChunks.join("")),this.bufferChunks.length=0,this.bufferLen=0),this.chunks.join("")}};R.FLUSH_THRESHOLD=32*1024;var w=R,V=class{constructor(e,t){this.onChunk=e;this.onComplete=t;}write(e){e&&this.onChunk(e);}end(){this.onComplete();}};function be(n){return !n||typeof n!="object"?false:typeof n.then=="function"}function xe(n,e,t){let r=n(e??{},{signal:t.signal});return be(r)&&x(),r}function F(n,e,t){let r=n.children;if(r===void 0&&(r=n.props?.children),!(r==null||r===false)){if(Array.isArray(r)){for(let o=0;o<r.length;o++)A(r[o],e,t);return}A(r,e,t);}}function A(n,e,t){if(n==null)return;if(typeof n=="string"){e.write(h(n));return}if(typeof n=="number"){e.write(String(n));return}if(typeof n=="boolean"||typeof n!="object")return;let r=n,o=r.type;if(o===b$2){F(r,e,t);return}if(typeof o=="symbol"){F(r,e,t);return}if(typeof o=="function"){let p=xe(o,r.props,t);A(p,e,t);return}let s=o,a=r.props,i=a?.dangerouslySetInnerHTML,c=i&&typeof i=="object"&&"__html"in i?String(i.__html):void 0;if(L.has(s)){e.write("<"),e.write(s),U(a,e),e.write(" />");return}e.write("<"),e.write(s),U(a,e),e.write(">"),c!==void 0?e.write(c):F(r,e,t),e.write("</"),e.write(s),e.write(">");}var G=new Map;function C(n){let e=G.get(n);return e||(e={open:`<${n}`,close:`</${n}>`,selfClose:`<${n} />`},G.size<256&&G.set(n,e)),e}b$1({getCurrentSSRContext:y,throwSSRDataMissing:x,getCurrentRenderData:Q,getNextKey:ee});function Ye(){}function Ze(){}function Ee(n,e,t){if(!(n==null||n===false)){if(typeof n=="string"){e.write(h(n));return}if(typeof n=="number"){e.write(h(String(n)));return}n&&typeof n=="object"&&"type"in n&&H(n,e,t);}}function K(n,e,t){if(!(!n||!Array.isArray(n)||n.length===0))for(let r=0;r<n.length;r++)Ee(n[r],e,t);}function H(n,e,t){let{type:r,props:o}=n;if(typeof r=="function"){let u=z(r,o,t);H(u,e,t);return}if(typeof r=="symbol"){if(r===b$2){let u=Array.isArray(n.children)?n.children:Array.isArray(o?.children)?o?.children:void 0;K(u,e,t);return}throw new Error(`renderNodeSyncToSink: unsupported VNode symbol type: ${String(r)}`)}let s=r;if(L.has(s)){let u=o?P(o):"",{selfClose:f}=C(s);e.write(u?`${f.slice(0,-3)}${u} />`:f);return}let a=o?o?.dangerouslySetInnerHTML:void 0;if(a!=null){let{attrs:u,dangerousHtml:f}=P(o,{returnDangerousHtml:true}),{open:d,close:l}=C(s);e.write(u?`${d}${u}>`:`${d}>`),f!==void 0?e.write(f):K(n.children,e,t),e.write(l);return}let i=o?P(o):"",c=n.children;if(c===void 0&&o?.children!==void 0){let u=o.children;Array.isArray(u)?c=u:u!==null&&u!==false&&(c=[u]);}if(!c||Array.isArray(c)&&c.length===0){let{open:u,close:f}=C(s);e.write(i?`${u}${i}>${f}`:`${u}>${f}`);return}if(Array.isArray(c)&&c.length===1){let u=c[0];if(typeof u=="string"){let{open:f,close:d}=C(s),l=h(u);e.write(i?`${f}${i}>${l}${d}`:`${f}>${l}${d}`);return}if(typeof u=="number"){let{open:f,close:d}=C(s),l=h(String(u));e.write(i?`${f}${i}>${l}${d}`:`${f}>${l}${d}`);return}}let{open:p,close:S}=C(s);e.write(i?`${p}${i}>`:`${p}>`),K(c,e,t),e.write(S);}function z(n,e,t){{let r=j(),o=i("ssr-temp",n,e||{},null);o.ssr=true,k$1(o);try{let s=n(e||{},{ssr:t});if(s instanceof Promise&&x(),typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null||s===void 0){let a=s==null||s===!1?"":String(s);return {$$typeof:a$2,type:b$2,props:{children:a?[a]:[]}}}return s}finally{k$1(r);}}}function ke(n,e,t){let r=t?.seed??12345,o=D(r,{data:t?.data});return _(o,()=>{T(t?.data??null);try{let a=z((c,p)=>{let S=n(c??{},p),u={$$typeof:a$2,type:d,props:{},key:"__default_portal"};return S==null?{$$typeof:a$2,type:b$2,props:{children:[u]}}:{$$typeof:a$2,type:b$2,props:{children:[S,u]}}},e||{},o);if(!a)throw new Error("renderToStringSync: wrapped component returned empty");let i=new w;return H(a,i,o),i.end(),i.toString()}finally{v();}})}function qe(n){let{url:e,routes:t,options:r}=n,{clearRoutes:o,route:s,setServerLocation:a,lockRouteRegistration:i,resolveRoute:c}=m;o();for(let f of t)s(f.path,f.handler,f.namespace);a(e),i();let p=c(e);if(!p)throw new Error(`renderToStringSync: no route found for url: ${e}`);let S=r?.seed??12345,u=D(S,{url:e,data:r?.data});return _(u,()=>{T(r?.data??null);try{let d$1=z((ue,ae)=>{let B=p.handler(ue??{},ae),Y={$$typeof:a$2,type:d,props:{},key:"__default_portal"};return B==null?{$$typeof:a$2,type:b$2,props:{children:[Y]}}:{$$typeof:a$2,type:b$2,props:{children:[B,Y]}}},p.params||{},u),l=new w;return H(d$1,l,u),l.end(),l.toString()}finally{v();}})}function nn(n){if(typeof n=="function")return ke(n);let e=n,t=new w;return ie({...e,sink:t}),t.end(),t.toString()}function tn(n){let e=new V(n.onChunk,n.onComplete);ie({...n,sink:e}),e.end();}function ie(n){let{url:e,routes:t,seed:r=12345,data:o,sink:s}=n,{clearRoutes:a,route:i,setServerLocation:c,lockRouteRegistration:p,resolveRoute:S}=m;a();for(let l of t)i(l.path,l.handler,l.namespace);c(e),p();let u=S(e);if(!u)throw new Error(`SSR: no route found for url: ${e}`);let f=D(r,{url:e,data:o,params:u.params}),d=u.handler(u.params);_(f,()=>{T(o||null);try{A(d,s,f);}finally{v();}});}export{fe as collectResources,Ze as popSSRStrictPurityGuard,Ye as pushSSRStrictPurityGuard,tn as renderToStream,nn as renderToString,ke as renderToStringSync,qe as renderToStringSyncForUrl,te as resolvePlan,pe as resolveResources};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askrjs/askr",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Actor-backed deterministic UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -86,17 +86,17 @@
|
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@eslint/js": "^9.39.2",
|
|
89
|
-
"@types/node": "^25.0.
|
|
89
|
+
"@types/node": "^25.0.9",
|
|
90
90
|
"cross-env": "^10.1.0",
|
|
91
91
|
"eslint": "^9.39.2",
|
|
92
92
|
"eslint-config-prettier": "^10.1.8",
|
|
93
93
|
"jiti": "^2.6.1",
|
|
94
94
|
"jsdom": "^27.4.0",
|
|
95
|
-
"prettier": "^3.
|
|
95
|
+
"prettier": "^3.8.0",
|
|
96
96
|
"tsup": "^8.5.1",
|
|
97
97
|
"tsd": "^0.33.0",
|
|
98
98
|
"typescript": "^5.9.3",
|
|
99
|
-
"typescript-eslint": "^8.53.
|
|
99
|
+
"typescript-eslint": "^8.53.1",
|
|
100
100
|
"vitest": "^4.0.17",
|
|
101
101
|
"vite": "^7.3.1"
|
|
102
102
|
}
|
package/dist/chunk-P3C5XSNF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-HGMOQ3I7.js';import {b as b$1}from'./chunk-37RC6ZT3.js';function se(e,n,t){if(!e){let r=t?`
|
|
2
|
-
`+JSON.stringify(t,null,2):"";throw new Error(`[Askr Invariant] ${n}${r}`)}}function Se(e,n){se(e,`[Scheduler Precondition] ${n}`);}function X(){try{let e=globalThis.__ASKR_FASTLANE;return typeof e?.isBulkCommitActive=="function"?!!e.isBulkCommitActive():!1}catch(e){return false}}var ae=class{constructor(){this.q=[];this.head=0;this.running=false;this.inHandler=false;this.depth=0;this.executionDepth=0;this.flushVersion=0;this.kickScheduled=false;this.allowSyncProgress=false;this.waiters=[];this.taskCount=0;}enqueue(n){Se(typeof n=="function","enqueue() requires a function"),!(X()&&!this.allowSyncProgress)&&(this.q.push(n),this.taskCount++,!this.running&&!this.kickScheduled&&!this.inHandler&&!X()&&(this.kickScheduled=true,queueMicrotask(()=>{if(this.kickScheduled=false,!this.running&&!X())try{this.flush();}catch(t){setTimeout(()=>{throw t});}})));}flush(){se(!this.running,"[Scheduler] flush() called while already running"),this.running=true,this.depth=0;let n=null;try{for(;this.head<this.q.length;){this.depth++;let t=this.q[this.head++];try{this.executionDepth++,t(),this.executionDepth--;}catch(r){this.executionDepth>0&&(this.executionDepth=0),n=r;break}this.taskCount>0&&this.taskCount--;}}finally{if(this.running=false,this.depth=0,this.executionDepth=0,this.head>=this.q.length)this.q.length=0,this.head=0;else if(this.head>0){let t=this.q.length-this.head;for(let r=0;r<t;r++)this.q[r]=this.q[this.head+r];this.q.length=t,this.head=0;}this.flushVersion++,this.resolveWaiters();}if(n)throw n}runWithSyncProgress(n){let t=this.allowSyncProgress;this.allowSyncProgress=true;let s=this.flushVersion;try{let a=n();return !this.running&&this.q.length-this.head>0&&this.flush(),a}finally{try{this.flushVersion===s&&(this.flushVersion++,this.resolveWaiters());}catch(a){}this.allowSyncProgress=t;}}waitForFlush(n,t=2e3){let r=typeof n=="number"?n:this.flushVersion+1;return this.flushVersion>=r?Promise.resolve():new Promise((o,i)=>{let s=setTimeout(()=>{let a=globalThis.__ASKR__||{},l={flushVersion:this.flushVersion,queueLen:this.q.length-this.head,running:this.running,inHandler:this.inHandler,bulk:X(),namespace:a};i(new Error(`waitForFlush timeout ${t}ms: ${JSON.stringify(l)}`));},t);this.waiters.push({target:r,resolve:o,reject:i,timer:s});})}getState(){return {queueLength:this.q.length-this.head,running:this.running,depth:this.depth,executionDepth:this.executionDepth,taskCount:this.taskCount,flushVersion:this.flushVersion,inHandler:this.inHandler,allowSyncProgress:this.allowSyncProgress}}setInHandler(n){this.inHandler=n;}isInHandler(){return this.inHandler}isExecuting(){return this.running||this.executionDepth>0}clearPendingSyncTasks(){let n=this.q.length-this.head;return n<=0?0:this.running?(this.q.length=this.head,this.taskCount=Math.max(0,this.taskCount-n),queueMicrotask(()=>{try{this.flushVersion++,this.resolveWaiters();}catch(t){}}),n):(this.q.length=0,this.head=0,this.taskCount=Math.max(0,this.taskCount-n),this.flushVersion++,this.resolveWaiters(),n)}resolveWaiters(){if(this.waiters.length===0)return;let n=[],t=[];for(let r of this.waiters)this.flushVersion>=r.target?(r.timer&&clearTimeout(r.timer),n.push(r.resolve)):t.push(r);this.waiters=t;for(let r of n)r();}},A=new ae;function be(){return A.isExecuting()}var Ae=Symbol("__tempoContextFrame__"),z=null;function K(e,n){let t=z;z=e;try{return n()}finally{z=t;}}function St(e,n){try{return n()}finally{}}function ke(){return z}function Te(){try{let e=globalThis;return e.__ASKR_DIAG||(e.__ASKR_DIAG={}),e.__ASKR_DIAG}catch(e){return {}}}function S(e,n){try{let t=Te();t[e]=n;try{let r=globalThis;try{let o=r.__ASKR__||(r.__ASKR__={});try{o[e]=n;}catch(i){}}catch(o){}}catch(r){}}catch(t){}}function k(e){try{let n=Te(),r=(typeof n[e]=="number"?n[e]:0)+1;n[e]=r;try{let o=globalThis,i=o.__ASKR__||(o.__ASKR__={});try{let s=typeof i[e]=="number"?i[e]:0;i[e]=s+1;}catch(s){}}catch(o){}}catch(n){}}function V(e){return !e.startsWith("on")||e.length<=2?null:e.slice(2).charAt(0).toLowerCase()+e.slice(3).toLowerCase()}function H(e){if(e==="wheel"||e==="scroll"||e.startsWith("touch"))return {passive:true}}function U(e,n=false){return t=>{A.setInHandler(true);try{e(t);}catch(r){a.error("[Askr] Event handler error:",r);}finally{if(A.setInHandler(false),n){let r=A.getState();(r.queueLength??0)>0&&!r.running&&queueMicrotask(()=>{try{A.isExecuting()||A.flush();}catch(o){queueMicrotask(()=>{throw o});}});}}}}function ue(e){return e==="children"||e==="key"||e==="ref"}function J(e){return !!(e==="children"||e==="key"||e.startsWith("on")&&e.length>2||e.startsWith("data-"))}function ce(e,n,t){try{if(n==="class"||n==="className")return e.className!==String(t);if(n==="value"||n==="checked")return e[n]!==t;let r=e.getAttribute(n);return t==null||t===!1?r!==null:String(t)!==r}catch{return true}}function Ce(e){for(let n of Object.keys(e))if(!J(n))return true;return false}function ve(e,n){for(let t of Object.keys(n))if(!J(t)&&ce(e,t,n[t]))return true;return false}function R(e){if(typeof e!="object"||e===null)return;let n=e,t=n.key??n.props?.key;if(t!==void 0)return typeof t=="symbol"?String(t):t}function we(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function Y(e){try{k("__DOM_REPLACE_COUNT"),S(`__LAST_DOM_REPLACE_STACK_${e}`,new Error().stack);}catch{}}function Q(e,n){try{S("__LAST_FASTPATH_STATS",e),S("__LAST_FASTPATH_COMMIT_COUNT",1),n&&k(n);}catch{}}function Z(e,n,t){(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&(t!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n,t):n!==void 0?a.warn(`[Askr][FASTPATH] ${e}`,n):a.warn(`[Askr][FASTPATH] ${e}`));}function B(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}var y=new WeakMap;function ee(e){return y.get(e)}function xe(e){try{if(y.has(e))return;let n=we(e);if(n.size===0){n=new Map;let t=Array.from(e.children);for(let r of t){let o=(r.textContent||"").trim();if(o){n.set(o,r);let i=Number(o);Number.isNaN(i)||n.set(i,r);}}}n.size>0&&y.set(e,n);}catch{}}var Ne=new WeakSet;function nn(e){let n=[];for(let t of e){let r=R(t);r!==void 0&&n.push({key:r,vnode:t});}return n}function tn(e){let n=[];for(let t of e){if(t===-1)continue;let r=0,o=n.length;for(;r<o;){let i=r+o>>1;n[i]<t?r=i+1:o=i;}r===n.length?n.push(t):n[r]=t;}return n.length}function rn(e){for(let{vnode:n}of e){if(typeof n!="object"||n===null)continue;let t=n;if(t.props&&Ce(t.props))return true}return false}function on(e,n){for(let{key:t,vnode:r}of e){let o=n?.get(t);if(!o||typeof r!="object"||r===null)continue;let s=r.props||{};for(let a of Object.keys(s))if(!J(a)&&ce(o,a,s[a]))return true}return false}function P(e,n,t){let r=nn(n),o=r.length,i=r.map(E=>E.key),s=t?Array.from(t.keys()):[],a=0;for(let E=0;E<i.length;E++){let w=i[E];(E>=s.length||s[E]!==w||!t?.has(w))&&a++;}let f=o>=128&&s.length>0&&a>Math.max(64,Math.floor(o*.1)),c=false,d=0;if(o>=128){let E=Array.from(e.children),w=r.map(({key:L})=>{let Ee=t?.get(L);return Ee?.parentElement===e?E.indexOf(Ee):-1});d=tn(w),c=d<Math.floor(o*.5);}let h=rn(r),_=on(r,t);return {useFastPath:(f||c)&&!_&&!h,totalKeyed:o,moveCount:a,lisLen:d,hasPropChanges:_}}var de=false,O=null;function Re(){de=true,O=new WeakSet;try{let e=A.clearPendingSyncTasks?.()??0;}catch{}}function Fe(){de=false,O=null;}function q(){return de}function fe(e){if(O)try{O.add(e);}catch(n){}}function sn(e){return !!(O&&O.has(e))}function an(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let i=o._readers;i&&i.delete(e);}e.lastRenderToken=r;for(let o of n){let i=o._readers;i||(i=new Map,o._readers=i),i.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function ln(e){if(!e||typeof e!="object"||!("type"in e))return e;let n=e;if(typeof n.type=="symbol"&&(n.type===b$1||String(n.type)==="Symbol(askr.fragment)")){let t=n.children||n.props?.children;if(Array.isArray(t)&&t.length>0){for(let r of t)if(r&&typeof r=="object"&&"type"in r&&typeof r.type=="string")return r}}return e}function un(e,n){let t=ln(n);if(!t||typeof t!="object"||!("type"in t))return {useFastPath:false,reason:"not-vnode"};let r=t;if(r==null||typeof r.type!="string")return {useFastPath:false,reason:"not-intrinsic"};let o=e.target;if(!o)return {useFastPath:false,reason:"no-root"};let i=o.children[0];if(!i)return {useFastPath:false,reason:"no-first-child"};if(i.tagName.toLowerCase()!==String(r.type).toLowerCase())return {useFastPath:false,reason:"root-tag-mismatch"};let s=r.children||r.props?.children;if(!Array.isArray(s))return {useFastPath:false,reason:"no-children-array"};for(let u of s)if(typeof u=="object"&&u!==null&&"type"in u&&typeof u.type=="function")return {useFastPath:false,reason:"component-child-present"};if(e.mountOperations.length>0)return {useFastPath:false,reason:"pending-mounts"};try{xe(i);}catch{}let a=ee(i),l=P(i,s,a);return !l.useFastPath||l.totalKeyed<128?{...l,useFastPath:false,reason:"renderer-declined"}:{...l,useFastPath:true}}function cn(e,n){let t=globalThis.__ASKR_RENDERER?.evaluate;if(typeof t!="function")return a.warn("[Tempo][FASTPATH][DEV] renderer.evaluate not available; declining fast-lane"),false;Re();try{A.runWithSyncProgress(()=>{t(n,e.target);try{an(e);}catch{}});let o=A.clearPendingSyncTasks?.()??0;return !0}finally{Fe();}}function dn(e,n){if(!un(e,n).useFastPath)return false;try{return cn(e,n)}catch{return false}}typeof globalThis<"u"&&(globalThis.__ASKR_FASTLANE={isBulkCommitActive:q,enterBulkCommit:Re,exitBulkCommit:Fe,tryRuntimeFastLaneSync:dn,markFastPathApplied:fe,isFastPathApplied:sn});var Me=Symbol("__FOR_BOUNDARY__");function T(e){return typeof e=="object"&&e!==null&&"type"in e}function Pe(e,n,t){let r=e.__ASKR_INSTANCE;if(r){try{Ie(r);}catch(o){a.warn("[Askr] cleanupComponent failed:",o);}try{delete e.__ASKR_INSTANCE;}catch(o){}}}function De(e,n){try{let r=e.ownerDocument,o=r?.createTreeWalker;if(typeof o=="function"){let i=o.call(r,e,1),s=i.firstChild();for(;s;)n(s),s=i.nextNode();return}}catch{}let t=e.querySelectorAll("*");for(let r=0;r<t.length;r++)n(t[r]);}function v(e,n){if(!e||!(e instanceof Element))return;let t=false,r=null;try{Pe(e,r,t);}catch(o){a.warn("[Askr] cleanupInstanceIfPresent failed:",o);}try{De(e,o=>{try{Pe(o,r,t);}catch(i){t?r.push(i):a.warn("[Askr] cleanupInstanceIfPresent descendant cleanup failed:",i);}});}catch(o){a.warn("[Askr] cleanupInstanceIfPresent descendant query failed:",o);}}function me(e,n){v(e);}var b=new WeakMap;function Oe(e){let n=b.get(e);if(n){for(let[t,r]of n)r.options!==void 0?e.removeEventListener(t,r.handler,r.options):e.removeEventListener(t,r.handler);b.delete(e);}}function x(e){e&&(Oe(e),De(e,Oe));}var pe=globalThis,fn=(e,n)=>e!=null&&typeof e=="object"&&"id"in e?e.id:n;function Ut(e,n,t){let r=typeof e=="function"?null:e,o=$();return {sourceState:r,items:new Map,orderedKeys:[],byFn:t||fn,renderFn:n,parentInstance:o,mounted:false}}var Le=1;function mn(e,n,t,r){let o=t,i=Object.assign(()=>o,{set(d){let h=typeof d=="function"?d(o):d;h!==o&&(o=h);}}),s=()=>null,a=ne(`for-item-${e}`,s,{},null);r.parentInstance&&(a.ownerFrame=r.parentInstance.ownerFrame);let l=$();j(a);let u=Ve();a._currentRenderToken=Le++,a._pendingReadStates=new Set;let f=r.renderFn(n,()=>i());F(a),j(l);let c={key:e,item:n,indexSignal:i,componentInstance:a,vnode:f,_startStateIndex:u};return a._pendingFlushTask=()=>{let d=$();j(a),a.stateIndexCheck=-1;let h=a.stateValues;for(let m=0;m<h.length;m++){let E=h[m];E&&(E._hasBeenRead=false);}He(u),a._currentRenderToken=Le++,a._pendingReadStates=new Set;try{let m=r.renderFn(n,()=>i());c.vnode=m,F(a);}finally{j(d);}let _=r.parentInstance;_&&_._enqueueRun?.();},c}function pn(e,n){let{items:t,orderedKeys:r,byFn:o}=e,i=new Map;for(let u=0;u<n.length;u++){let f=n[u],c=o(f,u);i.set(c,{item:f,index:u});}let s=[],a=[],l=new Set(r);for(let[u,{item:f,index:c}]of i){l.delete(u),s.push(u);let d=t.get(u);if(d){let h=d.item!==f,_=d.indexSignal()!==c;if(h){d.item=f;let m=pe.__ASKR_CURRENT_INSTANCE__;pe.__ASKR_CURRENT_INSTANCE__=d.componentInstance,d.vnode=e.renderFn(f,()=>d.indexSignal()),pe.__ASKR_CURRENT_INSTANCE__=m;}_&&d.indexSignal.set(c),a.push(d.vnode);}else {let h=mn(u,f,c,e);t.set(u,h),a.push(h.vnode);}}for(let u of l){let f=t.get(u);if(f){let c=f.componentInstance;c.abortController.abort();for(let d of c.cleanupFns)try{d();}catch{}t.delete(u);}}return e.orderedKeys=s,a}function Ke(e,n){let t=n();if(!Array.isArray(t))throw new Error("For source must evaluate to an array");return pn(e,t)}var hn=typeof document<"u",Ue=0;function gn(){let e="__COMPONENT_INSTANCE_ID";try{k(e);let t=globalThis.__ASKR_DIAG,r=t?t[e]:void 0;if(typeof r=="number"&&Number.isFinite(r))return `comp-${r}`}catch{}return Ue++,`comp-${Ue}`}function yn(e,n,t){let r=U(t,true),o=H(n);o!==void 0?e.addEventListener(n,r,o):e.addEventListener(n,r),b.has(e)||b.set(e,new Map),b.get(e).set(n,{handler:r,original:t,options:o});}function _n(e,n,t){for(let r in n){let o=n[r];if(ue(r)||o==null||o===false)continue;if(r==="ref"){En(e,o);continue}let i=V(r);if(i){yn(e,i,o);continue}r==="class"||r==="className"?e.className=String(o):r==="value"||r==="checked"?Sn(e,r,o,t):e.setAttribute(r,String(o));}}function En(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function Sn(e,n,t,r){n==="value"?((W(r,"input")||W(r,"textarea")||W(r,"select"))&&(e.value=String(t)),e.setAttribute("value",String(t))):n==="checked"&&(W(r,"input")&&(e.checked=!!t),e.setAttribute("checked",String(!!t)));}function Be(e,n,t){let r=n.key??t?.key;r!==void 0&&e.setAttribute("data-key",String(r));}function p(e){if(!hn)return null;if(typeof e=="string")return document.createTextNode(e);if(typeof e=="number")return document.createTextNode(String(e));if(!e)return null;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let t of e){let r=p(t);r&&n.appendChild(r);}return n}if(typeof e=="object"&&e!==null&&"type"in e){let n=e.type,t=e.props||{};if(typeof n=="string")return bn(e,n,t);if(typeof n=="function")return An(e,n,t);if(n===Me)return Tn(e,t);if(typeof n=="symbol"&&(n===b$1||String(n)==="Symbol(Fragment)"))return kn(e,t)}return null}function bn(e,n,t){let r=document.createElement(n);Be(r,e,t),_n(r,t,n);let o=t.children||e.children;if(o)if(Array.isArray(o)){for(let i of o){let s=p(i);s&&r.appendChild(s);}}else {let i=p(o);i&&r.appendChild(i);}return r}function An(e,n,t){let o=e[Ae]||ke(),i=n;if(i.constructor.name==="AsyncFunction")throw new Error("Async components are not supported. Use resource() for async work.");let a=e.__instance;a||(a=ne(gn(),i,t||{},null),e.__instance=a),o&&(a.ownerFrame=o);let l=K(o,()=>$e(a));if(l instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");let u=K(o,()=>p(l));if(u instanceof Element)return ge(a,u),u;if(!u){let c=document.createComment("");return a._placeholder=c,a.mounted=true,a.notifyUpdate=a._enqueueRun,c}let f=document.createElement("div");return f.appendChild(u),ge(a,f),f}function kn(e,n){let t=document.createDocumentFragment(),r=n.children||e.children;if(r)if(Array.isArray(r))for(let o of r){let i=p(o);i&&t.appendChild(i);}else {let o=p(r);o&&t.appendChild(o);}return t}function Tn(e,n){let t=e._forState;if(!t)return document.createDocumentFragment();let r=n.source,o=Ke(t,r),i=[],s=false;for(let l=0;l<o.length;l++){let u=o[l],f=u.key,c=null;if(f!=null&&t.items.has(f)){let d=t.items.get(f);d._dom&&d.vnode===u&&(c=d._dom);}c||(c=p(u),s=true,f!=null&&t.items.has(f)&&(t.items.get(f)._dom=c??void 0)),i.push(c);}if(!s&&i.length!==t.orderedKeys.length&&(s=true),!s)return document.createDocumentFragment();let a=document.createDocumentFragment();for(let l of i)l&&a.appendChild(l);return a}function N(e,n,t=true){if(!T(n))return;let r=n.props||{};Be(e,n,r);let o=b.get(e),i=null;for(let s in r){let a=r[s];if(ue(s))continue;let l=V(s);if(a==null||a===false){if(s==="class"||s==="className")e.className="";else if(l&&o?.has(l)){let u=o.get(l);u.options!==void 0?e.removeEventListener(l,u.handler,u.options):e.removeEventListener(l,u.handler),o.delete(l);}else e.removeAttribute(s);continue}if(s==="class"||s==="className")e.className=String(a);else if(s==="value"||s==="checked")e[s]=a;else if(l){o&&o.size>0&&(i??=new Set).add(l);let u=o?.get(l);if(u&&u.original===a)continue;u&&(u.options!==void 0?e.removeEventListener(l,u.handler,u.options):e.removeEventListener(l,u.handler));let f=U(a,false),c=H(l);c!==void 0?e.addEventListener(l,f,c):e.addEventListener(l,f),b.has(e)||b.set(e,new Map),b.get(e).set(l,{handler:f,original:a,options:c});}else e.setAttribute(s,String(a));}if(o&&o.size>0)if(i===null){for(let[s,a]of o)a.options!==void 0?e.removeEventListener(s,a.handler,a.options):e.removeEventListener(s,a.handler);b.delete(e);}else {for(let[s,a]of o)i.has(s)||(a.options!==void 0?e.removeEventListener(s,a.handler,a.options):e.removeEventListener(s,a.handler),o.delete(s));o.size===0&&b.delete(e);}if(t){let s=n.children||r.children;Cn(e,s);}}function Cn(e,n){if(!n){e.textContent="";return}if(!Array.isArray(n)&&(typeof n=="string"||typeof n=="number")){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=String(n):e.textContent=String(n);return}if(Array.isArray(n)){ye(e,n);return}e.textContent="";let t=p(n);t&&e.appendChild(t);}function ye(e,n){let t=Array.from(e.children);if(n.length===1&&t.length===0&&e.childNodes.length===1){let o=n[0],i=e.firstChild;if((typeof o=="string"||typeof o=="number")&&i?.nodeType===3){i.data=String(o);return}}t.length===0&&e.childNodes.length>0&&(e.textContent="");let r=Math.max(t.length,n.length);for(let o=0;o<r;o++){let i=t[o],s=n[o];if(s===void 0&&i){v(i),i.remove();continue}if(!i&&s!==void 0){let a=p(s);a&&e.appendChild(a);continue}if(!(!i||s===void 0))if(typeof s=="string"||typeof s=="number")i.textContent=String(s);else if(T(s))if(typeof s.type=="string")if(G(i.tagName,s.type))N(i,s);else {let a=p(s);a&&(i instanceof Element&&x(i),v(i),e.replaceChild(a,i));}else {let a=p(s);a&&(i instanceof Element&&x(i),v(i),e.replaceChild(a,i));}else {let a=p(s);a&&(i instanceof Element&&x(i),v(i),e.replaceChild(a,i));}}}function te(e,n){let t=n.length,r=0,o=0,i=B(),s=process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true";for(let u=0;u<t;u++){let{key:f,vnode:c}=n[u],d=e.children[u];if(d&&T(c)&&typeof c.type=="string"){let h=c.type;if(G(d.tagName,h)){let _=c.children||c.props?.children;s&&Z("positional idx",u,{chTag:d.tagName,vnodeType:h,chChildNodes:d.childNodes.length,childrenType:Array.isArray(_)?"array":typeof _}),vn(d,_,c),xn(d,f,()=>o++),r++;continue}else s&&Z("positional tag mismatch",u,{chTag:d.tagName,vnodeType:h});}else s&&Z("positional missing or invalid",u,{ch:!!d});Rn(e,u,c);}let a=B()-i;Fn(e,n);let l={n:t,reused:r,updatedKeys:o,t:a};return Q(l,"bulkKeyedPositionalHits"),l}function vn(e,n,t){typeof n=="string"||typeof n=="number"?D(e,String(n)):Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number")?D(e,String(n[0])):wn(e,t)||N(e,t);}function wn(e,n){let t=n.children||n.props?.children;if(!Array.isArray(t)||t.length!==2)return false;let r=t[0],o=t[1];if(!T(r)||!T(o)||typeof r.type!="string"||typeof o.type!="string")return false;let i=e.children[0],s=e.children[1];if(!i||!s||!G(i.tagName,r.type)||!G(s.tagName,o.type))return false;let a=r.children||r.props?.children,l=o.children||o.props?.children;if(typeof a=="string"||typeof a=="number")D(i,String(a));else if(Array.isArray(a)&&a.length===1&&(typeof a[0]=="string"||typeof a[0]=="number"))D(i,String(a[0]));else return false;if(typeof l=="string"||typeof l=="number")D(s,String(l));else if(Array.isArray(l)&&l.length===1&&(typeof l[0]=="string"||typeof l[0]=="number"))D(s,String(l[0]));else return false;return true}function D(e,n){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=n:e.textContent=n;}function xn(e,n,t){try{let r=String(n);if(e.getAttribute("data-key")===r)return;e.setAttribute("data-key",r),t();}catch{}}function Nn(e){switch(e){case "div":return "DIV";case "span":return "SPAN";case "p":return "P";case "a":return "A";case "button":return "BUTTON";case "input":return "INPUT";case "ul":return "UL";case "ol":return "OL";case "li":return "LI";default:return null}}function W(e,n){if(e===n)return true;let t=e.length;if(t!==n.length)return false;for(let r=0;r<t;r++){let o=e.charCodeAt(r),i=n.charCodeAt(r);if(o===i)continue;let s=o>=65&&o<=90?o+32:o,a=i>=65&&i<=90?i+32:i;if(s!==a)return false}return true}function G(e,n){let t=Nn(n);return t!==null&&e===t?true:W(e,n)}function Rn(e,n,t){let r=p(t);if(r){let o=e.children[n];o?(v(o),e.replaceChild(r,o)):e.appendChild(r);}}function Fn(e,n){try{let t=y.get(e),r=t?(t.clear(),t):new Map;for(let o=0;o<n.length;o++){let i=n[o].key,s=e.children[o];s&&r.set(i,s);}y.set(e,r);}catch{}}function qe(e,n){let t=B(),r=Array.from(e.childNodes),o=[],i=0,s=0;for(let f=0;f<n.length;f++){let c=Mn(n[f],r[f],o);c==="reused"?i++:c==="created"&&s++;}let a=B()-t,l=Dn(e,o);y.delete(e);let u={n:n.length,reused:i,created:s,tBuild:a,tCommit:l};return In(u),u}function Mn(e,n,t){return typeof e=="string"||typeof e=="number"?Pn(String(e),n,t):typeof e=="object"&&e!==null&&"type"in e?On(e,n,t):"skipped"}function Pn(e,n,t){return n&&n.nodeType===3?(n.data=e,t.push(n),"reused"):(t.push(document.createTextNode(e)),"created")}function On(e,n,t){let r=e;if(typeof r.type=="string"){let i=r.type;if(n&&n.nodeType===1&&G(n.tagName,i))return N(n,e),t.push(n),"reused"}let o=p(e);return o?(t.push(o),"created"):"skipped"}function Dn(e,n){let t=Date.now(),r=document.createDocumentFragment();for(let o=0;o<n.length;o++)r.appendChild(n[o]);try{for(let o=e.firstChild;o;){let i=o.nextSibling;o instanceof Element&&x(o),v(o),o=i;}}catch{}return Y("bulk-text-replace"),e.replaceChildren(r),Date.now()-t}function In(e){try{S("__LAST_BULK_TEXT_FASTPATH_STATS",e),S("__LAST_FASTPATH_STATS",e),S("__LAST_FASTPATH_COMMIT_COUNT",1),k("bulkTextFastpathHits");}catch{}}function je(e,n){let t=Number(process.env.ASKR_BULK_TEXT_THRESHOLD)||1024,r=.8,o=Array.isArray(n)?n.length:0;if(o<t)return he({phase:"bulk-unkeyed-eligible",reason:"too-small",total:o,threshold:t}),false;let i=Ln(n);if(i.componentFound!==void 0)return he({phase:"bulk-unkeyed-eligible",reason:"component-child",index:i.componentFound}),false;let s=i.simple/o,a=s>=r&&e.childNodes.length>=o;return he({phase:"bulk-unkeyed-eligible",total:o,simple:i.simple,fraction:s,requiredFraction:r,eligible:a}),a}function Ln(e){let n=0;for(let t=0;t<e.length;t++){let r=e[t];if(typeof r=="string"||typeof r=="number"){n++;continue}if(typeof r=="object"&&r!==null&&"type"in r){let o=r;if(typeof o.type=="function")return {simple:n,componentFound:t};typeof o.type=="string"&&Kn(o)&&n++;}}return {simple:n}}function Kn(e){let n=e.children||e.props?.children;return !!(!n||typeof n=="string"||typeof n=="number"||Array.isArray(n)&&n.length===1&&(typeof n[0]=="string"||typeof n[0]=="number"))}function he(e){if(process.env.ASKR_FASTPATH_DEBUG==="1")try{S("__BULK_DIAG",e);}catch{}}function We(e,n,t,r){if(typeof document>"u")return null;let o=n.length;if(o===0&&(!r||r.length===0))return null;be()||a.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let i,s;if(o<=20)try{let c=e.children;i=new Array(c.length);for(let d=0;d<c.length;d++)i[d]=c[d];}catch(c){i=void 0;}else {s=new Map;try{for(let c=e.firstElementChild;c;c=c.nextElementSibling){let d=c.getAttribute("data-key");if(d!==null){s.set(d,c);let h=Number(d);Number.isNaN(h)||s.set(h,c);}}}catch(c){s=void 0;}}let a$1=[],l=0,u=0,f=0;for(let c=0;c<n.length;c++){let{key:d,vnode:h}=n[c];l++;let _;if(o<=20&&i){let m=String(d);for(let E=0;E<i.length;E++){let w=i[E],L=w.getAttribute("data-key");if(L!==null&&(L===m||Number(L)===d)){_=w;break}}_||(_=t?.get(d));}else _=s?.get(d)??t?.get(d);if(_)a$1.push(_),f++;else {let m=p(h);m&&(a$1.push(m),u++);}}if(r&&r.length)for(let c of r){let d=p(c);d&&(a$1.push(d),u++);}try{let c=Date.now(),d=document.createDocumentFragment(),h=0;for(let m=0;m<a$1.length;m++)d.appendChild(a$1[m]),h++;try{for(let m=e.firstChild;m;){let E=m.nextSibling;m instanceof Element&&x(m),v(m),m=E;}}catch(m){}try{k("__DOM_REPLACE_COUNT"),S("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack);}catch(m){}e.replaceChildren(d);try{S("__LAST_FASTPATH_COMMIT_COUNT",1);}catch(m){}try{q()&&fe(e);}catch(m){}let _=new Map;for(let m=0;m<n.length;m++){let E=n[m].key,w=a$1[m];w instanceof Element&&_.set(E,w);}try{let m={n:o,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-c,t_commit:0,t_bookkeeping:0,fragmentAppendCount:h,mapLookups:l,createdNodes:u,reusedCount:f};typeof globalThis<"u"&&(S("__LAST_FASTPATH_STATS",m),S("__LAST_FASTPATH_REUSED",f>0),k("fastpathHistoryPush")),(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH]",JSON.stringify({n:o,createdNodes:u,reusedCount:f}));}catch(m){}try{Ne.add(e);}catch(m){}return _}catch(c){return null}}function re(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let i=r>=65&&r<=90?r+32:r,s=o>=65&&o<=90?o+32:o;if(i!==s)return false}return true}function oe(e,n,t){let{keyedVnodes:r,unkeyedVnodes:o}=Hn(n),i=t||Vn(e),s=Un(e,n,r,o,i);return s||Gn(e,n,r,i)}function Vn(e){let n=new Map;try{for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}}catch{}return n}function Hn(e){let n=[],t=[];for(let r=0;r<e.length;r++){let o=e[r],i=R(o);i!==void 0?n.push({key:i,vnode:o}):t.push(o);}return {keyedVnodes:n,unkeyedVnodes:t}}function Un(e,n,t,r,o){try{let i=Bn(e,n,t,r,o);if(i)return i;let s=qn(e,t);if(s)return s}catch{}return null}function Bn(e,n,t,r,o){if(P(e,n,o).useFastPath&&t.length>=128||q())try{let s=We(e,t,o,r);if(s)return y.set(e,s),s}catch{}return null}function qn(e,n){let t=n.length;if(t<10||jn(e,n)/t<.9||$n(e,n))return null;try{let o=te(e,n);return Q(o,"bulkKeyedPositionalHits"),Wn(e),y.get(e)}catch{return null}}function jn(e,n){let t=0;try{for(let r=0;r<n.length;r++){let o=n[r].vnode;if(!o||typeof o!="object"||typeof o.type!="string")continue;let i=e.children[r];i&&re(i.tagName,o.type)&&t++;}}catch{}return t}function $n(e,n){try{for(let t=0;t<n.length;t++){let r=n[t].vnode,o=e.children[t];if(!(!o||!r||typeof r!="object")&&ve(o,r.props||{}))return !0}}catch{return true}return false}function Wn(e){try{let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}y.set(e,n);}catch{}}function Gn(e,n,t,r){let o=new Map,i=[],s=new WeakSet,a=Xn(e,r,s);for(let l=0;l<n.length;l++){let u=n[l],f=Jn(u,l,e,a,s,o);f&&i.push(f);}return typeof document>"u"||(tt(e,i),y.delete(e)),o}function Xn(e,n,t){return r=>{if(!n)return;let o=n.get(r);if(o&&!t.has(o))return t.add(o),o;let i=String(r),s=n.get(i);if(s&&!t.has(s))return t.add(s),s;let a=Number(i);if(!Number.isNaN(a)){let l=n.get(a);if(l&&!t.has(l))return t.add(l),l}return zn(e,r,i,t)}}function zn(e,n,t,r){try{for(let o=e.firstElementChild;o;o=o.nextElementSibling){if(r.has(o))continue;let i=o.getAttribute("data-key");if(i===t)return r.add(o),o;if(i!==null){let s=Number(i);if(!Number.isNaN(s)&&s===n)return r.add(o),o}}}catch{}}function Jn(e,n,t,r,o,i){let s=R(e);return s!==void 0?Yn(e,s,t,r,i):Qn(e,n,t,o)}function Yn(e,n,t,r,o){let i=r(n);if(i&&i.parentElement===t)try{let a=e;if(a&&typeof a=="object"&&typeof a.type=="string"&&re(i.tagName,a.type))return N(i,e),o.set(n,i),i}catch{}let s=p(e);return s?(s instanceof Element&&o.set(n,s),s):null}function Qn(e,n,t,r){try{let i=t.children[n];if(i&&(typeof e=="string"||typeof e=="number")&&i.nodeType===1)return i.textContent=String(e),r.add(i),i;if(Zn(i,e))return N(i,e),r.add(i),i;let s=et(t,r);if(s){let a=nt(s,e,r);if(a)return a}}catch{}return p(e)}function Zn(e,n){if(!e||typeof n!="object"||n===null||!("type"in n))return false;let t=n,r=e.getAttribute("data-key");return r==null&&typeof t.type=="string"&&re(e.tagName,t.type)}function et(e,n){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!n.has(t)&&t.getAttribute("data-key")===null)return t}function nt(e,n,t){if(typeof n=="string"||typeof n=="number")return e.textContent=String(n),t.add(e),e;if(typeof n=="object"&&n!==null&&"type"in n){let r=n;if(typeof r.type=="string"&&re(e.tagName,r.type))return N(e,n),t.add(e),e}return null}function tt(e,n){let t=document.createDocumentFragment();for(let r=0;r<n.length;r++)t.appendChild(n[r]);try{for(let r=e.firstChild;r;){let o=r.nextSibling;r instanceof Element&&x(r),v(r),r=o;}}catch{}Y("reconcile"),e.replaceChildren(t);}var _e=new WeakMap;function Ge(e,n){if(e===n)return true;if(e.length!==n.length)return false;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t),o=n.charCodeAt(t);if(r===o)continue;let i=r>=65&&r<=90?r+32:r,s=o>=65&&o<=90?o+32:o;if(i!==s)return false}return true}function rt(e){if(Array.isArray(e)){if(e.length===1){let n=e[0];if(typeof n=="string"||typeof n=="number")return {isSimple:true,text:String(n)}}}else if(typeof e=="string"||typeof e=="number")return {isSimple:true,text:String(e)};return {isSimple:false}}function ot(e,n){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=n,true):false}function Xe(e){let n=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let r=t.getAttribute("data-key");if(r!==null){n.set(r,t);let o=Number(r);Number.isNaN(o)||n.set(o,t);}}return n}function it(e){let n=y.get(e);return n||(n=Xe(e),n.size>0&&y.set(e,n)),n.size>0?n:void 0}function ze(e){for(let n=0;n<e.length;n++)if(R(e[n])!==void 0)return true;return false}function st(e,n,t){if(process.env.ASKR_FORCE_BULK_POSREUSE==="1"&&at(e,n))return;let r=oe(e,n,t);y.set(e,r);}function at(e,n){try{let t=[];for(let i of n)T(i)&&i.key!==void 0&&t.push({key:i.key,vnode:i});if(t.length===0||t.length!==n.length)return !1;(process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced positional bulk keyed reuse (evaluate-level)");let r=te(e,t);if(process.env.ASKR_FASTPATH_DEBUG==="1")try{S("__LAST_FASTPATH_STATS",r),S("__LAST_FASTPATH_COMMIT_COUNT",1),k("bulkKeyedPositionalForced");}catch{}let o=Xe(e);return y.set(e,o),!0}catch(t){return (process.env.ASKR_FASTPATH_DEBUG==="1"||process.env.ASKR_FASTPATH_DEBUG==="true")&&a.warn("[Askr][FASTPATH] forced bulk path failed, falling back",t),false}}function lt(e,n){if(je(e,n)){qe(e,n);}else ye(e,n);y.delete(e);}function ut(e,n){if(!n){e.textContent="",y.delete(e);return}if(!Array.isArray(n)){e.textContent="";let t=p(n);t&&e.appendChild(t),y.delete(e);return}if(ze(n)){let t=it(e);try{st(e,n,t);}catch{let r=oe(e,n,t);y.set(e,r);}}else lt(e,n);}function Je(e,n){let t=n.children||n.props?.children,r=rt(t);r.isSimple&&ot(e,r.text)||ut(e,t),N(e,n,false);}function ct(e,n){let t=e.firstElementChild;for(let r=0;r<n.length;r++){let o=n[r],i=t?t.nextElementSibling:null;if(t&&T(o)&&typeof o.type=="string"&&Ge(t.tagName,o.type)){Je(t,o),t=i;continue}let s=p(o);s&&(t?e.replaceChild(s,t):e.appendChild(s)),t=i;}for(;t;){let r=t.nextElementSibling;e.removeChild(t),t=r;}}function dt(e,n){for(let[t,r]of Object.entries(n)){if(t==="children"||t==="key"||r==null||r===false)continue;if(t==="ref"){ft(e,r);continue}let o=V(t);if(o){let i=U(r,false),s=H(o);s!==void 0?e.addEventListener(o,i,s):e.addEventListener(o,i),b.has(e)||b.set(e,new Map),b.get(e).set(o,{handler:i,original:r,options:s});continue}t==="class"||t==="className"?e.className=String(r):t==="value"||t==="checked"?e[t]=r:e.setAttribute(t,String(r));}}function ft(e,n){let t=n;if(t){if(typeof t=="function"){t(e);return}try{t.current=e;}catch{}}}function mt(e,n){let t=n.children;if(!Array.isArray(t)||!ze(t))return false;let r=document.createElement(n.type);e.appendChild(r),dt(r,n.props||{});let o=oe(r,t,void 0);return y.set(r,o),true}function pt(e){return T(e)&&typeof e.type=="symbol"&&(e.type===b$1||String(e.type)==="Symbol(askr.fragment)")}function ht(e){let n=e.props?.children||e.children||[];return Array.isArray(n)?n:[n]}function I(e,n,t){if(n&&!(typeof document>"u"))if(t&&_e.has(t)){let r=_e.get(t),o=r.start.nextSibling;for(;o&&o!==r.end;){let s=o.nextSibling;o.remove(),o=s;}let i=p(e);i&&n.insertBefore(i,r.end);}else if(t){let r=document.createComment("component-start"),o=document.createComment("component-end");n.appendChild(r),n.appendChild(o),_e.set(t,{start:r,end:o});let i=p(e);i&&n.insertBefore(i,o);}else {let r=e;if(pt(r)){let i=ht(r);if(i.length===1&&T(i[0])&&typeof i[0].type=="string")r=i[0];else {ct(n,i);return}}let o=n.children[0];if(o&&T(r)&&typeof r.type=="string"&&Ge(o.tagName,r.type))Je(o,r);else {if(n.textContent="",T(r)&&typeof r.type=="string"&&mt(n,r))return;let i=p(r);i&&n.appendChild(i);}}}if(typeof globalThis<"u"){let e=globalThis;e.__ASKR_RENDERER={evaluate:I,isKeyedReorderFastPathEligible:P,getKeyMapForElement:ee};}function ne(e,n,t,r){let o={id:e,fn:n,props:t,target:r,mounted:false,abortController:new AbortController,stateValues:[],evaluationGeneration:0,notifyUpdate:null,_pendingFlushTask:void 0,_pendingRunTask:void 0,_enqueueRun:void 0,stateIndexCheck:-1,expectedStateIndices:[],firstRenderComplete:false,mountOperations:[],cleanupFns:[],hasPendingUpdate:false,ownerFrame:null,ssr:false,cleanupStrict:false,isRoot:false,_currentRenderToken:void 0,lastRenderToken:0,_pendingReadStates:new Set,_lastReadStates:new Set};return o._pendingRunTask=()=>{o.hasPendingUpdate=false,Ze(o);},o._enqueueRun=()=>{o.hasPendingUpdate||(o.hasPendingUpdate=true,A.enqueue(o._pendingRunTask));},o._pendingFlushTask=()=>{o.hasPendingUpdate=false,o._enqueueRun?.();},o}var C=null,ie=0;function Hr(){return C}function j(e){C=e;}function Ye(e){if(e.isRoot){for(let n of e.mountOperations){let t=n();t instanceof Promise?t.then(r=>{typeof r=="function"&&e.cleanupFns.push(r);}):typeof t=="function"&&e.cleanupFns.push(t);}e.mountOperations=[];}}function ge(e,n){e.target=n;try{n instanceof Element&&(n.__ASKR_INSTANCE=e);}catch(r){}e.notifyUpdate=e._enqueueRun;let t=!e.mounted;e.mounted=true,t&&e.mountOperations.length>0&&Ye(e);}var Qe=0;function Ze(e){e.notifyUpdate=e._enqueueRun,e._currentRenderToken=++Qe,e._pendingReadStates=new Set;let n=e.target?e.target.innerHTML:"",t=en(e);if(t instanceof Promise)throw new Error("Async components are not supported. Components must be synchronous.");{let r=globalThis.__ASKR_FASTLANE;try{if(r?.tryRuntimeFastLaneSync?.(e,t))return}catch{}A.enqueue(()=>{if(!e.target&&e._placeholder){if(t==null){F(e);return}let o=e._placeholder,i=o.parentNode;if(!i){a.warn("[Askr] placeholder no longer in DOM, cannot render component");return}let s=document.createElement("div"),a$1=C;C=e;try{I(t,s),i.replaceChild(s,o),e.target=s,e._placeholder=void 0,s.__ASKR_INSTANCE=e,F(e);}finally{C=a$1;}return}if(e.target){let o=[];try{let i=!e.mounted,s=C;C=e,o=Array.from(e.target.childNodes);try{I(t,e.target);}catch(a$1){try{let l=Array.from(e.target.childNodes);for(let u of l)try{me(u);}catch(f){a.warn("[Askr] error cleaning up failed commit children:",f);}}catch(l){}try{k("__DOM_REPLACE_COUNT"),S("__LAST_DOM_REPLACE_STACK_COMPONENT_RESTORE",new Error().stack);}catch(l){}throw e.target.replaceChildren(...o),a$1}finally{C=s;}F(e),e.mounted=!0,i&&e.mountOperations.length>0&&Ye(e);}catch(i){try{let s=Array.from(e.target.childNodes);for(let a$1 of s)try{me(a$1);}catch(l){a.warn("[Askr] error cleaning up partial children during rollback:",l);}}catch(s){}try{try{k("__DOM_REPLACE_COUNT"),S("__LAST_DOM_REPLACE_STACK_COMPONENT_ROLLBACK",new Error().stack);}catch(s){}e.target.replaceChildren(...o);}catch{e.target.innerHTML=n;}throw i}}});}}function $e(e){let n=e._currentRenderToken!==void 0,t=e._currentRenderToken,r=e._pendingReadStates;n||(e._currentRenderToken=++Qe,e._pendingReadStates=new Set);try{let o=en(e);return n||F(e),o}finally{e._currentRenderToken=t,e._pendingReadStates=r??new Set;}}function en(e){e.stateIndexCheck=-1;for(let n of e.stateValues)n&&(n._hasBeenRead=false);e._pendingReadStates=new Set,C=e,ie=0;try{let t={signal:e.abortController.signal},r={parent:e.ownerFrame,values:null},o=K(r,()=>e.fn(e.props,t)),i=Date.now()-0;i>5&&a.warn(`[askr] Slow render detected: ${i}ms. Consider optimizing component performance.`),e.firstRenderComplete||(e.firstRenderComplete=!0);for(let s=0;s<e.stateValues.length;s++){let a$1=e.stateValues[s];if(a$1&&!a$1._hasBeenRead)try{let l=e.fn?.name||"<anonymous>";a.warn(`[askr] Unused state variable detected in ${l} at index ${s}. State should be read during render or removed.`);}catch{a.warn("[askr] Unused state variable detected. State should be read during render or removed.");}}return o}finally{C=null;}}function gt(e){e.abortController=new AbortController,e.notifyUpdate=e._enqueueRun,A.enqueue(()=>Ze(e));}function $(){return C}function Br(){if(!C)throw new Error("getSignal() can only be called during component render execution. Ensure you are calling this from inside your component function.");return C.abortController.signal}function F(e){let n=e._pendingReadStates??new Set,t=e._lastReadStates??new Set,r=e._currentRenderToken;if(r!==void 0){for(let o of t)if(!n.has(o)){let i=o._readers;i&&i.delete(e);}e.lastRenderToken=r;for(let o of n){let i=o._readers;i||(i=new Map,o._readers=i),i.set(e,e.lastRenderToken??0);}e._lastReadStates=n,e._pendingReadStates=new Set,e._currentRenderToken=void 0;}}function qr(){return ie++}function Ve(){return ie}function He(e){ie=e;}function jr(e){gt(e);}function Ie(e){let n=[];for(let t of e.cleanupFns)try{t();}catch(r){e.cleanupStrict&&n.push(r);}if(e.cleanupFns=[],n.length>0)throw new AggregateError(n,`Cleanup failed for component ${e.id}`);if(e._lastReadStates){for(let t of e._lastReadStates){let r=t._readers;r&&r.delete(e);}e._lastReadStates=new Set;}e.abortController.abort(),e.notifyUpdate=null,e.mounted=false;}export{se as a,A as b,St as c,ke as d,q as e,Me as f,x as g,Ut as h,ne as i,Hr as j,j as k,$ as l,Br as m,qr as n,jr as o,Ie as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{d as cleanupNavigation,c as initializeNavigation,b as navigate,a as registerAppInstance}from'./chunk-XJFUFTFF.js';import'./chunk-76FYOA5Z.js';import'./chunk-D2JSJKCW.js';import'./chunk-P3C5XSNF.js';import'./chunk-HGMOQ3I7.js';import'./chunk-BP2CKUO6.js';import'./chunk-37RC6ZT3.js';import'./chunk-62D2TNHX.js';
|