rari 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import{getBinaryPath as e,getInstallationInstructions as t}from"./platform.mjs";import{spawn as n}from"node:child_process";import{existsSync as r,readFileSync as i,realpathSync as a}from"node:fs";import{resolve as o}from"node:path";import s from"node:process";import{fileURLToPath as c}from"node:url";import{styleText as l}from"node:util";function u(e){console.warn(`${l(`blue`,`info`)} ${e}`)}function d(e){console.warn(`${l(`green`,`✓`)} ${e}`)}function f(e){console.error(`${l(`red`,`✗`)} ${e}`)}function p(e){console.warn(`${l(`yellow`,`⚠`)} ${e}`)}const m=/^([^=]+)=(.*)$/;function h(e){let t=e.trim();if(!t||t.startsWith(`#`))return null;let n=t.match(m);if(!n)return null;let[,r,i]=n,a=r.trim(),o=i.trim();return(o.startsWith(`"`)&&o.endsWith(`"`)||o.startsWith(`'`)&&o.endsWith(`'`))&&(o=o.slice(1,-1)),{key:a,value:o}}function g(){let e=o(s.cwd(),`.env`);if(!r(e))return;let t=i(e,`utf-8`);for(let e of t.split(`
3
- `)){let t=h(e);t&&!s.env[t.key]&&(s.env[t.key]=t.value)}}g();const[,,_,...v]=s.argv;function y(e){let t=s.cwd();for(;;){let n=e(t);if(n!==null)return n;let r=o(t,`..`);if(r===t)break;t=r}return null}function b(e){return r(o(e,`pnpm-lock.yaml`))?`pnpm`:r(o(e,`yarn.lock`))?`yarn`:r(o(e,`bun.lockb`))?`bun`:r(o(e,`package-lock.json`))?`npm`:null}function x(e){try{let t=o(e,`package.json`);if(!r(t))return null;let n=JSON.parse(i(t,`utf-8`));if(n.packageManager?.startsWith(`pnpm`))return`pnpm`;if(n.packageManager?.startsWith(`yarn`))return`yarn`;if(n.packageManager?.startsWith(`bun`))return`bun`;if(n.packageManager?.startsWith(`npm`))return`npm`}catch{}return null}function S(){return y(e=>b(e)??x(e))??`npm`}function C(){let e=S(),t=s.platform===`win32`;switch(e){case`bun`:return t?`bun.cmd`:`bun`;case`pnpm`:return t?`pnpm.cmd`:`pnpm`;case`yarn`:return t?`yarn.cmd`:`yarn`;default:return t?`npx.cmd`:`npx`}}function w(){return y(e=>{try{let t=o(e,`package.json`);if(r(t)){let e=JSON.parse(i(t,`utf-8`)),n={...e.dependencies,...e.devDependencies};if(n[`vite-plus`])return`vp`;if(n.vite)return`vite`}}catch{}return null})??`vite`}function T(e,t,r={}){let i=s.platform===`win32`;if(e===`npx`){let e=C();if(e.includes(`bun`))return n(i?`bunx.cmd`:`bunx`,t,{...r,shell:i});if(e.includes(`pnpm`))return n(e,[`exec`,...t],{...r,shell:i});if(e.includes(`yarn`)){let[a,...o]=t;return n(e,a===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...o]:[`dlx`,...t],{...r,shell:i})}}return i&&e===`npx`?n(`npx.cmd`,t,{...r,shell:!0}):n(e,t,r)}function E(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function D(){return!!(s.env.RAILWAY_ENVIRONMENT||s.env.RAILWAY_PROJECT_ID||s.env.RAILWAY_SERVICE_ID)}function O(){return!!(s.env.RENDER||s.env.RENDER_SERVICE_ID||s.env.RENDER_SERVICE_NAME)}function k(){return D()||O()}function A(){return D()?`Railway`:O()?`Render`:`local`}function j(){return{port:s.env.PORT||s.env.RSC_PORT||`3000`,mode:s.env.NODE_ENV||`production`,host:k()?`0.0.0.0`:`127.0.0.1`}}async function M(){let{existsSync:e,rmSync:t}=await import(`node:fs`),{resolve:n}=await import(`node:path`),r=n(s.cwd(),`dist`);e(r)&&(u(`Cleaning dist folder...`),t(r,{recursive:!0,force:!0})),u(`Type checking...`);let i=T(`npx`,[`tsgo`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{i.on(`exit`,n=>{n===0?(d(`Type check passed`),e()):(f(`Type check failed with code ${n}`),t(Error(`Type check failed with code ${n}`)))}),i.on(`error`,t)}),u(`Building for production...`);let a=T(`npx`,[w(),`build`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{a.on(`exit`,n=>{n===0?(d(`Build complete`),e()):(f(`Build failed with code ${n}`),t(Error(`Build failed with code ${n}`)))}),a.on(`error`,t)}),await N()}async function N(){if(r(o(s.cwd(),`dist`,`server`,`image.json`))&&r(o(s.cwd(),`public`)))try{let t=n(e(),[`optimize-images`],{stdio:`inherit`,cwd:s.cwd(),shell:!1});await new Promise(e=>{t.on(`exit`,t=>{t===0||p(`Image pre-optimization exited with code ${t}`),e()}),t.on(`error`,t=>{p(`Image pre-optimization error: ${E(t)}`),e()})})}catch(e){p(`Could not pre-optimize images: ${E(e)}`)}}async function P(){let{existsSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),n=w();if(!e(t(s.cwd(),`dist`))){u(`First run detected - building project...`);let e=T(`npx`,[n,`build`,`--mode`,`development`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((t,n)=>{e.on(`exit`,e=>{e===0?(d(`Initial build complete`),t()):(f(`Build failed with code ${e}`),n(Error(`Build failed with code ${e}`)))}),e.on(`error`,n)})}u(`Starting Vite${n===`vp`?`+`:``} dev server...`);let r=T(`npx`,[n,`dev`],{stdio:`inherit`,cwd:s.cwd()}),i=()=>{u(`Shutting down dev server...`),r.kill(`SIGTERM`)};return s.on(`SIGINT`,i),s.on(`SIGTERM`,i),r.on(`error`,e=>{f(`Failed to start Vite: ${e.message}`),s.exit(1)}),r.on(`exit`,e=>{e!==0&&e!==null&&(f(`Vite exited with code ${e}`),s.exit(e))}),new Promise(()=>{})}async function F(){let r;try{r=e()}catch{f(`Failed to obtain rari binary`),f(t()),s.exit(1)}let{port:i,mode:a,host:o}=j();if(k()){let e=A();u(`${e} environment detected`),u(`Starting rari server for ${e} deployment...`),u(`Mode: ${a}, Host: ${o}, Port: ${i}`),u(`using binary: ${r}`)}let c=n(r,[`--mode`,a,`--port`,i,`--host`,o],{stdio:`inherit`,cwd:s.cwd(),env:{...s.env,RUST_LOG:s.env.RUST_LOG||`error`}}),l=()=>{u(`shutting down...`),c.kill(`SIGTERM`)};return s.on(`SIGINT`,l),s.on(`SIGTERM`,l),c.on(`error`,e=>{f(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&f(`Binary not found. Please ensure rari is properly installed.`),s.exit(1)}),c.on(`exit`,(e,t)=>{t?u(`server stopped by signal ${t}`):e===0?d(`server stopped successfully`):(f(`server exited with code ${e}`),s.exit(e||1))}),new Promise(()=>{})}async function I(){u(`Setting up Railway deployment...`),k()&&(f(`Already running in ${A()} environment. Use "rari start" instead.`),s.exit(1));let{createRailwayDeployment:e}=await import(`./railway-bxKRJ0Cg.mjs`);await e()}async function L(){u(`Setting up Render deployment...`),k()&&(f(`Already running in ${A()} environment. Use "rari start" instead.`),s.exit(1));let{createRenderDeployment:e}=await import(`./render-CXNCiz-E.mjs`);await e()}async function R(){switch(_){case void 0:case`help`:case`--help`:case`-h`:console.warn(`${l(`bold`,`rari CLI`)}
3
+ `)){let t=h(e);t&&!s.env[t.key]&&(s.env[t.key]=t.value)}}g();const[,,_,...v]=s.argv;function y(e){let t=s.cwd();for(;;){let n=e(t);if(n!==null)return n;let r=o(t,`..`);if(r===t)break;t=r}return null}function b(e){return r(o(e,`pnpm-lock.yaml`))?`pnpm`:r(o(e,`yarn.lock`))?`yarn`:r(o(e,`bun.lockb`))?`bun`:r(o(e,`package-lock.json`))?`npm`:null}function x(e){try{let t=o(e,`package.json`);if(!r(t))return null;let n=JSON.parse(i(t,`utf-8`));if(n.packageManager?.startsWith(`pnpm`))return`pnpm`;if(n.packageManager?.startsWith(`yarn`))return`yarn`;if(n.packageManager?.startsWith(`bun`))return`bun`;if(n.packageManager?.startsWith(`npm`))return`npm`}catch{}return null}function S(){return y(e=>b(e)??x(e))??`npm`}function C(){let e=S(),t=s.platform===`win32`;switch(e){case`bun`:return t?`bun.cmd`:`bun`;case`pnpm`:return t?`pnpm.cmd`:`pnpm`;case`yarn`:return t?`yarn.cmd`:`yarn`;default:return t?`npx.cmd`:`npx`}}function w(){return y(e=>{try{let t=o(e,`package.json`);if(r(t)){let e=JSON.parse(i(t,`utf-8`)),n={...e.dependencies,...e.devDependencies};if(n[`vite-plus`])return`vp`;if(n.vite)return`vite`}}catch{}return null})??`vite`}function T(e,t,r={}){let i=s.platform===`win32`;if(e===`npx`){let e=C();if(e.includes(`bun`))return n(i?`bunx.cmd`:`bunx`,t,{...r,shell:i});if(e.includes(`pnpm`))return n(e,[`exec`,...t],{...r,shell:i});if(e.includes(`yarn`)){let[a,...o]=t;return n(e,a===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...o]:[`dlx`,...t],{...r,shell:i})}}return i&&e===`npx`?n(`npx.cmd`,t,{...r,shell:!0}):n(e,t,r)}function E(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function D(){return!!(s.env.RAILWAY_ENVIRONMENT||s.env.RAILWAY_PROJECT_ID||s.env.RAILWAY_SERVICE_ID)}function O(){return!!(s.env.RENDER||s.env.RENDER_SERVICE_ID||s.env.RENDER_SERVICE_NAME)}function k(){return D()||O()}function A(){return D()?`Railway`:O()?`Render`:`local`}function j(){return{port:s.env.PORT||s.env.RSC_PORT||`3000`,mode:s.env.NODE_ENV||`production`,host:k()?`0.0.0.0`:`127.0.0.1`}}async function M(){let{existsSync:e,rmSync:t}=await import(`node:fs`),{resolve:n}=await import(`node:path`),r=n(s.cwd(),`dist`);e(r)&&(u(`Cleaning dist folder...`),t(r,{recursive:!0,force:!0})),u(`Type checking...`);let i=T(`npx`,[`tsgo`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{i.on(`exit`,n=>{n===0?(d(`Type check passed`),e()):(f(`Type check failed with code ${n}`),t(Error(`Type check failed with code ${n}`)))}),i.on(`error`,t)}),u(`Building for production...`);let a=T(`npx`,[w(),`build`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{a.on(`exit`,n=>{n===0?(d(`Build complete`),e()):(f(`Build failed with code ${n}`),t(Error(`Build failed with code ${n}`)))}),a.on(`error`,t)}),await N()}async function N(){if(r(o(s.cwd(),`dist`,`server`,`image.json`))&&r(o(s.cwd(),`public`)))try{let t=n(e(),[`optimize-images`],{stdio:`inherit`,cwd:s.cwd(),shell:!1});await new Promise(e=>{t.on(`exit`,t=>{t===0||p(`Image pre-optimization exited with code ${t}`),e()}),t.on(`error`,t=>{p(`Image pre-optimization error: ${E(t)}`),e()})})}catch(e){p(`Could not pre-optimize images: ${E(e)}`)}}async function P(){let{existsSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),n=w();if(!e(t(s.cwd(),`dist`))){u(`First run detected - building project...`);let e=T(`npx`,[n,`build`,`--mode`,`development`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((t,n)=>{e.on(`exit`,e=>{e===0?(d(`Initial build complete`),t()):(f(`Build failed with code ${e}`),n(Error(`Build failed with code ${e}`)))}),e.on(`error`,n)})}u(`Starting Vite${n===`vp`?`+`:``} dev server...`);let r=T(`npx`,[n,`dev`],{stdio:`inherit`,cwd:s.cwd()}),i=()=>{u(`Shutting down dev server...`),r.kill(`SIGTERM`)};return s.on(`SIGINT`,i),s.on(`SIGTERM`,i),r.on(`error`,e=>{f(`Failed to start Vite: ${e.message}`),s.exit(1)}),r.on(`exit`,e=>{e!==0&&e!==null&&(f(`Vite exited with code ${e}`),s.exit(e))}),new Promise(()=>{})}async function F(){let r;try{r=e()}catch{f(`Failed to obtain rari binary`),f(t()),s.exit(1)}let{port:i,mode:a,host:o}=j();if(k()){let e=A();u(`${e} environment detected`),u(`Starting rari server for ${e} deployment...`),u(`Mode: ${a}, Host: ${o}, Port: ${i}`),u(`using binary: ${r}`)}let c=n(r,[`--mode`,a,`--port`,i,`--host`,o],{stdio:`inherit`,cwd:s.cwd(),env:{...s.env,RUST_LOG:s.env.RUST_LOG||`error`}}),l=()=>{u(`shutting down...`),c.kill(`SIGTERM`)};return s.on(`SIGINT`,l),s.on(`SIGTERM`,l),c.on(`error`,e=>{f(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&f(`Binary not found. Please ensure rari is properly installed.`),s.exit(1)}),c.on(`exit`,(e,t)=>{t?u(`server stopped by signal ${t}`):e===0?d(`server stopped successfully`):(f(`server exited with code ${e}`),s.exit(e||1))}),new Promise(()=>{})}async function I(){u(`Setting up Railway deployment...`),k()&&(f(`Already running in ${A()} environment. Use "rari start" instead.`),s.exit(1));let{createRailwayDeployment:e}=await import(`./railway-s8_vD6IQ.mjs`);await e()}async function L(){u(`Setting up Render deployment...`),k()&&(f(`Already running in ${A()} environment. Use "rari start" instead.`),s.exit(1));let{createRenderDeployment:e}=await import(`./render--U1cY-wT.mjs`);await e()}async function R(){switch(_){case void 0:case`help`:case`--help`:case`-h`:console.warn(`${l(`bold`,`rari CLI`)}
4
4
 
5
5
  ${l(`bold`,`Usage:`)}
6
6
  ${l(`cyan`,`rari dev`)} Start the development server with Vite
package/dist/client.d.mts CHANGED
@@ -13,7 +13,7 @@ declare function ClientRouter({
13
13
  children,
14
14
  initialRoute,
15
15
  staleWindowMs
16
- }: ClientRouterProps): import("react/jsx-runtime").JSX.Element;
16
+ }: ClientRouterProps): React.JSX.Element;
17
17
  //#endregion
18
18
  //#region src/router/LayoutErrorBoundary.d.ts
19
19
  interface LayoutErrorBoundaryProps {
@@ -79,7 +79,7 @@ declare function NavigationErrorOverlay({
79
79
  onDismiss,
80
80
  retryCount,
81
81
  maxRetries
82
- }: NavigationErrorOverlayProps): import("react/jsx-runtime").JSX.Element;
82
+ }: NavigationErrorOverlayProps): import("react").JSX.Element;
83
83
  //#endregion
84
84
  //#region src/router/route-info-types.d.ts
85
85
  interface RouteInfoRequest {
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BK4N0qFr-QFbF96eD.mjs";import{existsSync as o,readFileSync as s,writeFileSync as c}from"node:fs";import{join as l}from"node:path";import u from"node:process";import{styleText as d}from"node:util";function f(){let r=u.cwd();e(`Creating Railway deployment configuration...`),t(r,{providerName:`Railway`,deployScript:`echo "Push to GitHub and connect to Railway to deploy"`,startScript:`rari start`,dependency:n()}),p(r),a(r,`Railway`,`.railway`),m(r),h()}function p(e){i(e,`railway.toml`,`[build]
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BdLqcjvq-QFbF96eD.mjs";import{existsSync as o,readFileSync as s,writeFileSync as c}from"node:fs";import{join as l}from"node:path";import u from"node:process";import{styleText as d}from"node:util";function f(){let r=u.cwd();e(`Creating Railway deployment configuration...`),t(r,{providerName:`Railway`,deployScript:`echo "Push to GitHub and connect to Railway to deploy"`,startScript:`rari start`,dependency:n()}),p(r),a(r,`Railway`,`.railway`),m(r),h()}function p(e){i(e,`railway.toml`,`[build]
2
2
  builder = "RAILPACK"
3
3
 
4
4
  [deploy]
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BK4N0qFr-QFbF96eD.mjs";import{existsSync as o,readFileSync as s,writeFileSync as c}from"node:fs";import{join as l}from"node:path";import u from"node:process";import{styleText as d}from"node:util";function f(){let r=u.cwd();e(`Creating Render deployment configuration...`),t(r,{providerName:`Render`,deployScript:`echo "Push to GitHub and connect to Render to deploy"`,startScript:`rari start`,dependency:n()}),p(r),a(r,`Render`,`.render`),m(r),h()}function p(e){i(e,`render.yaml`,`services:
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BdLqcjvq-QFbF96eD.mjs";import{existsSync as o,readFileSync as s,writeFileSync as c}from"node:fs";import{join as l}from"node:path";import u from"node:process";import{styleText as d}from"node:util";function f(){let r=u.cwd();e(`Creating Render deployment configuration...`),t(r,{providerName:`Render`,deployScript:`echo "Push to GitHub and connect to Render to deploy"`,startScript:`rari start`,dependency:n()}),p(r),a(r,`Render`,`.render`),m(r),h()}function p(e){i(e,`render.yaml`,`services:
2
2
  - type: web
3
3
  name: rari-app
4
4
  runtime: node
package/dist/router.d.mts CHANGED
@@ -28,7 +28,7 @@ interface RouterProviderProps {
28
28
  declare function RouterProvider({
29
29
  children,
30
30
  initialPathname
31
- }: RouterProviderProps): import("react/jsx-runtime").JSX.Element;
31
+ }: RouterProviderProps): import("react").JSX.Element;
32
32
  declare function useRouter(): RouterContextValue;
33
33
  declare function usePathname(): string;
34
34
  declare function useParams(): Record<string, string | string[]>;
package/dist/router.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t}from"./navigate-DuyUa6qD.mjs";import{createContext as n,use as r,useEffect as i,useMemo as a,useRef as o,useState as s}from"react";import{jsx as c}from"react/jsx-runtime";const l=n(null);function u({children:t,initialPathname:n}){let[r,u]=s(n),[d,f]=s(()=>typeof window<`u`?new URLSearchParams(window.location.search):new URLSearchParams),[p,m]=s({}),h=o(null);return i(()=>{let e=e=>{let t=e.detail;t?.to&&(u(t.to),f(new URLSearchParams(window.location.search)),m({}))};return window.addEventListener(`rari:navigate`,e),()=>{window.removeEventListener(`rari:navigate`,e)}},[]),i(()=>{let t=e();t&&(h.current=t);let n=e=>{h.current=e.detail.navigate},r=()=>{h.current=null};return window.addEventListener(`rari:register-navigate`,n),window.addEventListener(`rari:deregister-navigate`,r),()=>{window.removeEventListener(`rari:register-navigate`,n),window.removeEventListener(`rari:deregister-navigate`,r)}},[]),c(l,{value:a(()=>({pathname:r,params:p,searchParams:d,push:async(e,t)=>{h.current?await h.current(e,t):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.href=e)},replace:async(e,t)=>{h.current?await h.current(e,{...t,replace:!0}):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.replace(e))},back:()=>{window.history.back()},forward:()=>{window.history.forward()},refresh:()=>{window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`))},prefetch:async e=>{try{let t=new URL(e,window.location.origin);await fetch(t.pathname+t.search,{headers:{Accept:`text/x-component`},priority:`low`})}catch(e){console.warn(`[rari] Prefetch failed:`,e)}}}),[r,p,d]),children:t})}function d(){let e=r(l);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function f(){return d().pathname}function p(){return d().params}function m(){return d().searchParams}export{u as RouterProvider,t as navigate,p as useParams,f as usePathname,d as useRouter,m as useSearchParams};
1
+ import{n as e,r as t}from"./navigate-DuyUa6qD.mjs";import{createContext as n,use as r,useEffect as i,useMemo as a,useRef as o,useState as s}from"react";import{jsx as c}from"react/jsx-runtime";const l=n(null);function u({children:t,initialPathname:n}){let[r,u]=s(n),[d,f]=s(()=>typeof window<`u`?new URLSearchParams(window.location.search):new URLSearchParams),p=o(null);return i(()=>{let e=e=>{let t=e.detail;t?.to&&(u(t.to),f(new URLSearchParams(window.location.search)))};return window.addEventListener(`rari:navigate`,e),()=>{window.removeEventListener(`rari:navigate`,e)}},[]),i(()=>{let t=e();t&&(p.current=t);let n=e=>{p.current=e.detail.navigate},r=()=>{p.current=null};return window.addEventListener(`rari:register-navigate`,n),window.addEventListener(`rari:deregister-navigate`,r),()=>{window.removeEventListener(`rari:register-navigate`,n),window.removeEventListener(`rari:deregister-navigate`,r)}},[]),c(l,{value:a(()=>({pathname:r,params:{},searchParams:d,push:async(e,t)=>{p.current?await p.current(e,t):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.href=e)},replace:async(e,t)=>{p.current?await p.current(e,{...t,replace:!0}):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.replace(e))},back:()=>{window.history.back()},forward:()=>{window.history.forward()},refresh:()=>{window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`))},prefetch:async e=>{try{let t=new URL(e,window.location.origin);await fetch(t.pathname+t.search,{headers:{Accept:`text/x-component`},priority:`low`})}catch(e){console.warn(`[rari] Prefetch failed:`,e)}}}),[r,d]),children:t})}function d(){let e=r(l);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function f(){return d().pathname}function p(){return d().params}function m(){return d().searchParams}export{u as RouterProvider,t as navigate,p as useParams,f as usePathname,d as useRouter,m as useSearchParams};
@@ -22,6 +22,6 @@ declare function AppRouterProvider({
22
22
  children,
23
23
  initialPayload,
24
24
  onNavigate
25
- }: AppRouterProviderProps): import("react/jsx-runtime").JSX.Element;
25
+ }: AppRouterProviderProps): React.JSX.Element;
26
26
  //#endregion
27
27
  export { AppRouterProvider };
@@ -1,5 +1,5 @@
1
- "use client";import{g as e,m as t}from"../regex-constants-B4P386OY.mjs";import{t as n}from"../preload-modules-xvnJ_8eh.mjs";import*as r from"react";import{Suspense as i,useEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{createFromFetch as d,createFromReadableStream as f}from"virtual:react-flight-client";const ee=/"timestamp":(\d+)/,p=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)$/,m=/^[0-9a-f]+$/i,te=/^\$L?[0-9a-f]+$/i;function ne(e){return new Promise(t=>{setTimeout(t,e)})}function h(e){if(!e||e.length===0)return!1;let t=e.charAt(0),n=e.charCodeAt(0);return e.startsWith(`I[`)||e.startsWith(`I{`)||e.startsWith(`"$S`)?!1:!!(n===84||t===`[`||t===`{`||e.startsWith(`E{`)||t===`"`||p.test(e))}function re(e){return!e||e.length===0?!1:!!(e.includes(`"fallback"`)||e.includes(`$Lfallback`)||e.startsWith(`E{`))}function ie({contentRef:e,rowsDataRef:t,modulesDataRef:n,symbolsDataRef:i,suspendingPromisesRef:a,getSuspendingPromise:o,rscToReact:s}){let c=t.current,l=n.current,u=i.current,d=a.current,f=c.has(e);if(r.useEffect(()=>{f&&d.has(e)&&d.delete(e)},[e,f,d]),f)return s(c.get(e),l,void 0,u,c);throw o(e)}function g({children:p,initialPayload:g,onNavigate:_}){let[v,y]=s(g),b=s(0)[1],x=o({x:0,y:0}),S=o(new Map),C=o(null),w=o(new Set),T=o(_),E=o(0),D=o(new Map),O=o([]),k=o(null),A=o(0),[j,M]=s(null),N=o(typeof window<`u`&&window.location.hash.length>0),ae=o(0),P=o(!1),F=o(!1),I=o(!1),L=o(Promise.resolve()),oe=o(!1),R=o(!!g),z=o(null);a(()=>{T.current=_},[_]),a(()=>{if(v?.element!=null&&v.element&&typeof v.element==`object`&&`status`in v.element&&v.element.status===`rejected`){let e=v.element.reason;e&&console.error(`[rari] AppRouter: Flight payload rejected:`,e)}},[v]);let se=()=>{if(typeof document>`u`)return;let e=document.querySelectorAll(`form`);S.current.clear(),e.forEach((e,t)=>{let n=new FormData(e);S.current.set(`form-${t}`,n)})},ce=()=>{typeof document>`u`||document.querySelectorAll(`form`).forEach((e,t)=>{let n=S.current.get(`form-${t}`);n&&n.forEach((t,n)=>{let r=e.elements.namedItem(n);r&&(r.type===`checkbox`||r.type===`radio`?r.checked=t===`on`:r.value=t)})})},B=(e,t,n,r)=>{let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r};O.current.push(i),A.current+=1,O.current.length>10&&O.current.shift(),A.current>=2&&M(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},V=()=>{setTimeout(()=>{window.location.reload()},1e3)},H=()=>{A.current>0&&(A.current=0)},le=e=>{if(!k.current)return!1;if(e===k.current)return!0;let t=e.match(ee);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1};function ue(e){let t;try{t=JSON.stringify(e)}catch{try{let n=new WeakSet;t=JSON.stringify(e,(e,t)=>{if(typeof t==`object`&&t){if(n.has(t))return`[Circular]`;n.add(t)}return t})}catch{t=`[Unstringifiable:${typeof e}:${String(e).substring(0,50)}]`}}let n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);n=(n<<5)-n+r,n&=n}return Math.abs(n).toString(36)}function U(e,n,i,a,o,s){if(e==null)return null;if(typeof e==`string`&&e.startsWith(`$`)&&e.length>1&&m.test(e.substring(1))&&o&&o.has(e)){let t=s??new Set;return t.has(e)?(console.warn(`[rari] AppRouter: Circular $ reference detected:`,e),null):(t.add(e),U(o.get(e),n,i,a,o,t))}if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,s,c,l]=e,u=s;if(typeof s==`string`&&s.startsWith(`$`)&&a){let e=s.substring(1);if(t.test(e)){let e=a.get(s);e&&(e===`$Sreact.suspense`||e===`react.suspense`?u=`Suspense`:console.warn(`[rari] AppRouter: Unknown symbol:`,e))}}if(u===`Suspense`||s===`Suspense`){let e=me(l,n,i,a,o);return r.createElement(r.Suspense,c?{...e,key:c}:e)}if(typeof u==`string`&&u.startsWith(`$`)&&te.test(u)){let e=n.get(u);if(!e)return console.warn(`[rari] AppRouter: Module not found for reference:`,u,`Available modules:`,Array.from(n.keys())),null;let t=globalThis[`~clientComponents`]?.[e.id]?.component;if(!t)return console.warn(`[rari] AppRouter: Component not loaded:`,e.id),null;if(typeof t!=`function`)return null;let s=c||`fallback-${u}-${ae.current++}`,d={...l,children:l.children===void 0?void 0:U(l.children,n,i,a,o)};return r.createElement(t,{key:s,...d})}if(!u||typeof u!=`string`&&typeof u!=`function`||typeof u==`string`&&u.startsWith(`$`))return null;let d=me(l,n,i,a,o);return r.createElement(u,c?{...d,key:c}:d)}return e.map((e,t)=>{let s=U(e,n,i,a,o);if(s==null)return null;if(typeof s==`object`&&r.isValidElement(s)&&!s.key){let n=typeof e==`object`&&e?ue(e):`primitive`,i=`rsc-${Array.isArray(e)&&e[0]===`$`&&e[1]?String(e[1]):`unknown`}-${n}-${t}`;return r.createElement(r.Fragment,{key:i},s)}return s}).filter(e=>e!=null)}return e}let W=o(new Set),G=o(new Map),K=o(new Map),q=o(new Map),J=o(new Map);function de(e){if(!J.current.has(e)){let t=new Promise(()=>{});J.current.set(e,{promise:t,timestamp:Date.now()})}return J.current.get(e).promise}function fe(){J.current.clear(),W.current.clear()}function pe(){let e=Date.now(),t=[];J.current.forEach((n,r)=>{e-n.timestamp>3e4&&t.push(r)}),t.forEach(e=>{J.current.delete(e),W.current.delete(e)})}function me(e,t,n,i,a){if(!e||typeof e!=`object`)return e;a&&(G.current=a),t&&(K.current=t),i&&(q.current=i);let o={};for(let s in e)if(Object.hasOwn(e,s))if(s===`children`){let c=e.children;if(typeof c==`string`&&c.startsWith(`$`)&&c.length>1&&m.test(c.substring(1)))if(a&&a.has(c)){let e=a.get(c);W.current.delete(c),o[s]=U(e,t,n,i,a)}else W.current.add(c),o[s]=r.createElement(ie,{key:`lazy-${c}`,contentRef:c,rowsDataRef:G,modulesDataRef:K,symbolsDataRef:q,suspendingPromisesRef:J,getSuspendingPromise:de,rscToReact:U});else o[s]=c===void 0?void 0:U(c,t,n,i,a)}else s===`dangerouslySetInnerHTML`?o[s]=e[s]:o[s]=U(e[s],t,n,i,a);return o}let Y=async e=>{await n(e,w.current);let t=await f(new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}}));return{element:t,rawElement:t,wireFormat:e}},he=e=>({element:d(e)}),ge=async(t,n)=>{let r=t||window.location.pathname,i=E.current,a=`${i}:${r}${window.location.search}`,o=D.current.get(a);if(o)return o;let s=(async()=>{try{let t=(import.meta.env.RARI_SERVER_URL||window.location.origin).replace(e,``)+r+window.location.search,a=await fetch(t,{headers:{Accept:`text/x-component`},cache:`no-store`,signal:n});if(!a.ok){let e=Error(`Failed to fetch RSC data: ${a.status} ${a.statusText}`);throw B(e,`fetch`,`HTTP ${a.status} when fetching ${t}`,window.location.pathname),e}let o=await a.text();if(le(o)&&v)return v;let s;try{s=await Y(o)}catch(e){let t=e instanceof Error?e:Error(String(e));throw B(t,`parse`,`Failed to parse RSC wire format: ${t.message}`,window.location.pathname),t}return E.current===i&&(y(s),k.current=o,H()),s}catch(e){throw e instanceof Error&&!e.message.includes(`Failed to fetch RSC data`)&&!e.message.includes(`Failed to parse`)&&B(e,`network`,`Network error: ${e.message}`,window.location.pathname),e}finally{D.current.delete(a)}})();return D.current.set(a,s),s},X=o(Y),Z=o(he),Q=o(ge);a(()=>{X.current=Y,Z.current=he,Q.current=ge}),a(()=>{if(typeof window>`u`)return;let e=setInterval(()=>{pe()},3e4),t=async e=>{let t=e.detail;if(t.navigationId!==E.current)return;N.current=!0,t.isStreaming||(C.current=null),fe(),x.current={x:window.scrollX,y:window.scrollY},se();let n=null,i=null,a=!1;try{if(t.rscResponsePromise){let e=await t.rscResponsePromise;if(E.current!==t.navigationId)return;a=e.headers.get(`x-render-mode`)===`streaming`;let{element:r}=Z.current(Promise.resolve(e));if(a)n={element:r};else{let e=await r;if(E.current!==t.navigationId)return;n={element:e}}}else if(t.rscResponse){a=t.rscResponse.headers.get(`x-render-mode`)===`streaming`;let{element:e}=Z.current(Promise.resolve(t.rscResponse));if(a)n={element:e};else{let r=await e;if(E.current!==t.navigationId)return;n={element:r}}}else t.rscWireFormat?n=await X.current(t.rscWireFormat):t.isStreaming||(n=await Q.current(t.to,t.abortSignal))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;i=e}if(i){console.error(`[rari] AppRouter: Navigation failed:`,i),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:t.from,to:t.to,error:i,navigationId:t.navigationId}})),A.current>=3&&V();return}if(!n&&t.isStreaming&&E.current===t.navigationId){z.current=t;return}n&&E.current===t.navigationId&&(a?(y(n),b(e=>e+1),M(null)):r.startTransition(()=>{y(n),b(e=>e+1),M(null)}),t.rscWireFormat&&(k.current=t.rscWireFormat),H(),T.current&&T.current(t));let o=typeof window<`u`&&window.location.hash.length>0;!t.options?.historyKey&&!o&&requestAnimationFrame(()=>{t.options?.scroll!==!1&&window.scrollTo(0,0)})},n=async()=>{x.current={x:window.scrollX,y:window.scrollY},se();try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`HMR refetch error:`,e instanceof Error?e.message:String(e)),A.current>=3&&V()}finally{requestAnimationFrame(()=>{window.scrollTo(x.current.x,x.current.y),ce()})}},i=async()=>{try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`RSC invalidate error:`,e instanceof Error?e.message:String(e)),A.current>=3&&V()}},a=e=>{let t=e;if(C.current=[],w.current.clear(),E.current=t.detail.navigationId,typeof window<`u`){let e=window;e[`~rari`]||={},e[`~rari`].navigationId=t.detail.navigationId}P.current=!1,F.current=!1,I.current=!1,L.current=Promise.resolve(),oe.current=!0,R.current=!1,z.current=null},o=async()=>{try{await Q.current(),M(null)}catch(e){console.error(`Manifest update error:`,e instanceof Error?e.message:String(e)),A.current>=3&&V()}},s=async()=>{if(!C.current||C.current.length===0||R.current)return;let e=E.current,t=[...C.current],n=t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,r=t>0?e.substring(t+1):``;return m.test(n)&&h(r)}),r=t.some(e=>{let n=e.indexOf(`:`),r=n>0?e.substring(0,n).trim():``,i=n>0?e.substring(n+1):``;return!m.test(r)||!h(i)?!1:t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,i=t>0?e.substring(t+1):``;return!m.test(n)||!h(i)||re(i)?!1:RegExp(`"?\\$L?${r}"?(?![0-9a-fA-F])`).test(i)})});if(!n&&!r)return;if(!P.current&&n&&!r&&(P.current=!0,t.some(e=>e.includes(`"$Sreact.suspense"`)||e.includes(`react.suspense`)))){try{let n=t.filter(e=>{let n=e.indexOf(`:`),i=n>0?e.substring(0,n).trim():``,a=RegExp(`"\\$L?${i}"(?![0-9a-fA-F])`);return!r||!t.some(e=>a.test(e))}),i=await X.current(n.join(`
1
+ "use client";import{g as e,m as t}from"../regex-constants-B4P386OY.mjs";import{t as n}from"../preload-modules-xvnJ_8eh.mjs";import{t as r}from"../suspense-CsIYuC_l.mjs";import*as i from"react";import{Suspense as a,useEffect as o,useRef as s,useState as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{createFromFetch as f,createFromReadableStream as ee}from"virtual:react-flight-client";const te=/"timestamp":(\d+)/,p=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)$/,m=/^[0-9a-f]+$/i,ne=/^\$L?[0-9a-f]+$/i;function re(e){return new Promise(t=>{setTimeout(t,e)})}function h(e){if(!e||e.length===0)return!1;let t=e.charAt(0),n=e.charCodeAt(0);return e.startsWith(`I[`)||e.startsWith(`I{`)||e.startsWith(`"$S`)?!1:!!(n===84||t===`[`||t===`{`||e.startsWith(`E{`)||t===`"`||p.test(e))}function ie(e){return!e||e.length===0?!1:!!(e.includes(`"fallback"`)||e.includes(`$Lfallback`)||e.startsWith(`E{`))}function ae({contentRef:e,rowsDataRef:t,modulesDataRef:n,symbolsDataRef:r,suspendingPromisesRef:a,getSuspendingPromise:o,rscToReact:s}){let c=t.current,l=n.current,u=r.current,d=a.current,f=c.has(e);if(i.useEffect(()=>{f&&d.has(e)&&d.delete(e)},[e,f,d]),f)return s(c.get(e),l,void 0,u,c);throw o(e)}function g({children:p,initialPayload:g,onNavigate:_}){let[v,y]=c(g),b=c(0)[1],x=s({x:0,y:0}),S=s(new Map),C=s(null),w=s(new Set),T=s(_),E=s(0),D=s(new Map),O=s([]),k=s(null),A=s(0),[j,M]=c(null),N=s(typeof window<`u`&&window.location.hash.length>0),oe=s(0),P=s(!1),F=s(!1),I=s(!1),L=s(Promise.resolve()),se=s(!1),R=s(!!g),z=s(null);o(()=>{T.current=_},[_]),o(()=>{if(v?.element!=null&&v.element&&typeof v.element==`object`&&`status`in v.element&&v.element.status===`rejected`){let e=v.element.reason;e&&console.error(`[rari] AppRouter: Flight payload rejected:`,e)}},[v]);let B=()=>{if(typeof document>`u`)return;let e=document.querySelectorAll(`form`);S.current.clear(),e.forEach((e,t)=>{let n=new FormData(e);S.current.set(`form-${t}`,n)})},ce=()=>{typeof document>`u`||document.querySelectorAll(`form`).forEach((e,t)=>{let n=S.current.get(`form-${t}`);n&&n.forEach((t,n)=>{let r=e.elements.namedItem(n);r&&(r.type===`checkbox`||r.type===`radio`?r.checked=t===`on`:r.value=t)})})},V=(e,t,n,r)=>{let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r};O.current.push(i),A.current+=1,O.current.length>10&&O.current.shift(),A.current>=2&&M(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},H=()=>{setTimeout(()=>{window.location.reload()},1e3)},U=()=>{A.current>0&&(A.current=0)},le=e=>{if(!k.current)return!1;if(e===k.current)return!0;let t=e.match(te);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1};function ue(e){let t;try{t=JSON.stringify(e)}catch{try{let n=new WeakSet;t=JSON.stringify(e,(e,t)=>{if(typeof t==`object`&&t){if(n.has(t))return`[Circular]`;n.add(t)}return t})}catch{t=`[Unstringifiable:${typeof e}:${String(e).substring(0,50)}]`}}let n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);n=(n<<5)-n+r,n&=n}return Math.abs(n).toString(36)}function W(e,n,a,o,s,c){if(e==null)return null;if(typeof e==`string`&&e.startsWith(`$`)&&e.length>1&&m.test(e.substring(1))&&s&&s.has(e)){let t=c??new Set;return t.has(e)?(console.warn(`[rari] AppRouter: Circular $ reference detected:`,e),null):(t.add(e),W(s.get(e),n,a,o,s,t))}if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,c,l,u]=e,d=c;if(typeof c==`string`&&c.startsWith(`$`)&&o){let e=c.substring(1);if(t.test(e)){let e=o.get(c);e&&(r(e)?d=`Suspense`:console.warn(`[rari] AppRouter: Unknown symbol:`,e))}}if(typeof d==`string`&&r(d)||typeof c==`string`&&r(c)){let e=he(u,n,a,o,s);return i.createElement(i.Suspense,l?{...e,key:l}:e)}if(typeof d==`string`&&d.startsWith(`$`)&&ne.test(d)){let e=n.get(d);if(!e)return console.warn(`[rari] AppRouter: Module not found for reference:`,d,`Available modules:`,Array.from(n.keys())),null;let t=globalThis[`~clientComponents`]?.[e.id]?.component;if(!t)return console.warn(`[rari] AppRouter: Component not loaded:`,e.id),null;if(typeof t!=`function`)return null;let r=l||`fallback-${d}-${oe.current++}`,c={...u,children:u.children===void 0?void 0:W(u.children,n,a,o,s)};return i.createElement(t,{key:r,...c})}if(!d||typeof d!=`string`&&typeof d!=`function`||typeof d==`string`&&d.startsWith(`$`))return null;let f=he(u,n,a,o,s);return i.createElement(d,l?{...f,key:l}:f)}return e.map((e,t)=>{let r=W(e,n,a,o,s);if(r==null)return null;if(typeof r==`object`&&i.isValidElement(r)&&!r.key){let n=typeof e==`object`&&e?ue(e):`primitive`,a=`rsc-${Array.isArray(e)&&e[0]===`$`&&e[1]?String(e[1]):`unknown`}-${n}-${t}`;return i.createElement(i.Fragment,{key:a},r)}return r}).filter(e=>e!=null)}return e}let G=s(new Set),K=s(new Map),q=s(new Map),de=s(new Map),J=s(new Map);function fe(e){if(!J.current.has(e)){let t=new Promise(()=>{});J.current.set(e,{promise:t,timestamp:Date.now()})}return J.current.get(e).promise}function pe(){J.current.clear(),G.current.clear()}function me(){let e=Date.now(),t=[];J.current.forEach((n,r)=>{e-n.timestamp>3e4&&t.push(r)}),t.forEach(e=>{J.current.delete(e),G.current.delete(e)})}function he(e,t,n,r,a){if(!e||typeof e!=`object`)return e;a&&(K.current=a),t&&(q.current=t),r&&(de.current=r);let o={};for(let s in e)if(Object.hasOwn(e,s))if(s===`children`){let c=e.children;if(typeof c==`string`&&c.startsWith(`$`)&&c.length>1&&m.test(c.substring(1)))if(a&&a.has(c)){let e=a.get(c);G.current.delete(c),o[s]=W(e,t,n,r,a)}else G.current.add(c),o[s]=i.createElement(ae,{key:`lazy-${c}`,contentRef:c,rowsDataRef:K,modulesDataRef:q,symbolsDataRef:de,suspendingPromisesRef:J,getSuspendingPromise:fe,rscToReact:W});else o[s]=c===void 0?void 0:W(c,t,n,r,a)}else s===`dangerouslySetInnerHTML`?o[s]=e[s]:o[s]=W(e[s],t,n,r,a);return o}let Y=async e=>{await n(e,w.current);let t=await ee(new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}}));return{element:t,rawElement:t,wireFormat:e}},ge=e=>({element:f(e)}),_e=async(t,n)=>{let r=t||window.location.pathname,i=E.current,a=`${i}:${r}${window.location.search}`,o=D.current.get(a);if(o)return o;let s=(async()=>{try{let t=(import.meta.env.RARI_SERVER_URL||window.location.origin).replace(e,``)+r+window.location.search,a=await fetch(t,{headers:{Accept:`text/x-component`},cache:`no-store`,signal:n});if(!a.ok){let e=Error(`Failed to fetch RSC data: ${a.status} ${a.statusText}`);throw V(e,`fetch`,`HTTP ${a.status} when fetching ${t}`,window.location.pathname),e}let o=await a.text();if(le(o)&&v)return v;let s;try{s=await Y(o)}catch(e){let t=e instanceof Error?e:Error(String(e));throw V(t,`parse`,`Failed to parse RSC wire format: ${t.message}`,window.location.pathname),t}return E.current===i&&(y(s),k.current=o,U()),s}catch(e){throw e instanceof Error&&!e.message.includes(`Failed to fetch RSC data`)&&!e.message.includes(`Failed to parse`)&&V(e,`network`,`Network error: ${e.message}`,window.location.pathname),e}finally{D.current.delete(a)}})();return D.current.set(a,s),s},X=s(Y),Z=s(ge),Q=s(_e);o(()=>{X.current=Y,Z.current=ge,Q.current=_e}),o(()=>{if(typeof window>`u`)return;let e=setInterval(()=>{me()},3e4),t=async e=>{let t=e.detail;if(t.navigationId!==E.current)return;N.current=!0,t.isStreaming||(C.current=null),pe(),x.current={x:window.scrollX,y:window.scrollY},B();let n=null,r=null,a=!1;try{if(t.rscResponsePromise){let e=await t.rscResponsePromise;if(E.current!==t.navigationId)return;a=e.headers.get(`x-render-mode`)===`streaming`;let{element:r}=Z.current(Promise.resolve(e));if(a)n={element:r};else{let e=await r;if(E.current!==t.navigationId)return;n={element:e}}}else if(t.rscResponse){a=t.rscResponse.headers.get(`x-render-mode`)===`streaming`;let{element:e}=Z.current(Promise.resolve(t.rscResponse));if(a)n={element:e};else{let r=await e;if(E.current!==t.navigationId)return;n={element:r}}}else t.rscWireFormat?n=await X.current(t.rscWireFormat):t.isStreaming||(n=await Q.current(t.to,t.abortSignal))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;r=e}if(r){console.error(`[rari] AppRouter: Navigation failed:`,r),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:t.from,to:t.to,error:r,navigationId:t.navigationId}})),A.current>=3&&H();return}if(!n&&t.isStreaming&&E.current===t.navigationId){z.current=t;return}n&&E.current===t.navigationId&&(a?(y(n),b(e=>e+1),M(null)):i.startTransition(()=>{y(n),b(e=>e+1),M(null)}),t.rscWireFormat&&(k.current=t.rscWireFormat),U(),T.current&&T.current(t));let o=typeof window<`u`&&window.location.hash.length>0;!t.options?.historyKey&&!o&&requestAnimationFrame(()=>{t.options?.scroll!==!1&&window.scrollTo(0,0)})},n=async()=>{x.current={x:window.scrollX,y:window.scrollY},B();try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`HMR refetch error:`,e instanceof Error?e.message:String(e)),A.current>=3&&H()}finally{requestAnimationFrame(()=>{window.scrollTo(x.current.x,x.current.y),ce()})}},r=async()=>{try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`RSC invalidate error:`,e instanceof Error?e.message:String(e)),A.current>=3&&H()}},a=e=>{let t=e;if(C.current=[],w.current.clear(),E.current=t.detail.navigationId,typeof window<`u`){let e=window;e[`~rari`]||={},e[`~rari`].navigationId=t.detail.navigationId}P.current=!1,F.current=!1,I.current=!1,L.current=Promise.resolve(),se.current=!0,R.current=!1,z.current=null},o=async()=>{try{await Q.current(),M(null)}catch(e){console.error(`Manifest update error:`,e instanceof Error?e.message:String(e)),A.current>=3&&H()}},s=async()=>{if(!C.current||C.current.length===0||R.current)return;let e=E.current,t=[...C.current],n=t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,r=t>0?e.substring(t+1):``;return m.test(n)&&h(r)}),r=t.some(e=>{let n=e.indexOf(`:`),r=n>0?e.substring(0,n).trim():``,i=n>0?e.substring(n+1):``;return!m.test(r)||!h(i)?!1:t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,i=t>0?e.substring(t+1):``;return!m.test(n)||!h(i)||ie(i)?!1:RegExp(`"?\\$L?${r}"?(?![0-9a-fA-F])`).test(i)})});if(!n&&!r)return;if(!P.current&&n&&!r&&(P.current=!0,t.some(e=>e.includes(`"$Sreact.suspense"`)||e.includes(`react.suspense`)))){try{let n=t.filter(e=>{let n=e.indexOf(`:`),i=n>0?e.substring(0,n).trim():``,a=RegExp(`"\\$L?${i}"(?![0-9a-fA-F])`);return!r||!t.some(e=>a.test(e))}),i=await X.current(n.join(`
2
2
  `));E.current===e&&(y(i),b(e=>e+1))}catch(e){console.error(`[rari] Failed to parse shell payload:`,e),P.current=!1,L.current=Promise.resolve()}return}let i=t.some(e=>e.includes(`"$Sreact.suspense"`)||e.includes(`react.suspense`));if(!(!r&&i&&!I.current)&&!F.current){P.current=!0;try{let n=await X.current(t.join(`
3
- `));if((i||r)&&(await ne(50),E.current===e&&!F.current)){let n=C.current?[...C.current]:t,r=await X.current(n.join(`
3
+ `));if((i||r)&&(await re(50),E.current===e&&!F.current)){let n=C.current?[...C.current]:t,r=await X.current(n.join(`
4
4
  `));E.current===e&&(F.current=!0,y(r),b(e=>e+1),z.current&&T.current&&(T.current(z.current),z.current=null),I.current&&(C.current=null))}if(E.current!==e||F.current)return;let a=C.current?[...C.current]:t;if(n=await X.current(a.join(`
5
- `)),E.current!==e||F.current)return;y(n),b(e=>e+1),z.current&&T.current&&(T.current(z.current),z.current=null),I.current&&(F.current=!0,C.current=null)}catch(e){console.error(`Process rows error:`,e instanceof Error?e.message:String(e))}}},c=e=>{let t=e,n=t.detail.rscRow,r=t.detail.navigationId;if(!n||!n.trim()||!C.current)return;let i=E.current;if(!(r==null||r!==i)){if(n.trim()===`STREAM_COMPLETE`){I.current=!0,L.current=L.current.then(()=>{if(E.current===i)return s()});return}C.current.push(n),L.current=L.current.then(()=>{if(E.current===i)return s()})}};return window.addEventListener(`rari:navigation-start`,a),window.addEventListener(`rari:navigate`,t),window.addEventListener(`rari:app-router-rerender`,n),window.addEventListener(`rari:rsc-invalidate`,i),window.addEventListener(`rari:app-router-manifest-updated`,o),window.addEventListener(`rari:rsc-row`,c),()=>{clearInterval(e),fe(),window.removeEventListener(`rari:navigation-start`,a),window.removeEventListener(`rari:navigate`,t),window.removeEventListener(`rari:app-router-rerender`,n),window.removeEventListener(`rari:rsc-invalidate`,i),window.removeEventListener(`rari:app-router-manifest-updated`,o),window.removeEventListener(`rari:rsc-row`,c)}},[]),a(()=>{if(!(typeof window>`u`)&&window.location.hash&&v&&N.current){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&(t.scrollIntoView({behavior:`instant`,block:`start`}),N.current=!1)})})}},[v]);let _e=()=>{window.location.reload()},ve=()=>{M(null)},ye=e=>{if(!e||typeof e!=`object`)return null;if(e.type===`html`&&e.props?.children){let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t)if(e&&typeof e==`object`&&e.type===`body`)return e.props?.children??null}return e},$=p;if(v?.element!=null)if(v.element&&typeof v.element==`object`&&`status`in v.element){let e=v.element.status;$=e===`fulfilled`?v.element.value:e===`rejected`?p:r.use(v.element)}else $=ye(v.element)??v.element;return Array.isArray($)&&$.length===1&&r.isValidElement($[0])?$=$[0]:Array.isArray($)&&$.length>0&&$.every(e=>r.isValidElement(e)||e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)&&($=r.createElement(r.Fragment,null,...$)),u(c,{children:[j&&u(`div`,{style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,padding:`24px`,background:`rgba(220, 38, 38, 0.95)`,color:`white`,borderRadius:`8px`,fontSize:`14px`,zIndex:1e4,maxWidth:`500px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.3)`},children:[l(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),u(`div`,{style:{marginBottom:`12px`,opacity:.9},children:[j.type===`fetch`&&`Failed to fetch updated content from server.`,j.type===`parse`&&`Failed to parse server response.`,j.type===`stale`&&`Server returned stale content.`,j.type===`network`&&`Network error occurred.`]}),l(`div`,{style:{marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},children:j.details}),u(`div`,{style:{marginBottom:`12px`,fontSize:`12px`,opacity:.7},children:[`Consecutive failures:`,` `,A.current,` `,`/`,` `,3]}),u(`div`,{style:{display:`flex`,gap:`8px`},children:[l(`button`,{onClick:_e,type:`button`,style:{padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},children:`Refresh Page`}),l(`button`,{onClick:ve,type:`button`,style:{padding:`8px 16px`,background:`rgba(255, 255, 255, 0.2)`,color:`white`,border:`1px solid rgba(255, 255, 255, 0.3)`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},children:`Dismiss`})]}),l(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`})]}),l(i,{fallback:null,children:$})]})}export{g as AppRouterProvider};
5
+ `)),E.current!==e||F.current)return;y(n),b(e=>e+1),z.current&&T.current&&(T.current(z.current),z.current=null),I.current&&(F.current=!0,C.current=null)}catch(e){console.error(`Process rows error:`,e instanceof Error?e.message:String(e))}}},c=e=>{let t=e,n=t.detail.rscRow,r=t.detail.navigationId;if(!n||!n.trim()||!C.current)return;let i=E.current;if(!(r==null||r!==i)){if(n.trim()===`STREAM_COMPLETE`){I.current=!0,L.current=L.current.then(()=>{if(E.current===i)return s()});return}C.current.push(n),L.current=L.current.then(()=>{if(E.current===i)return s()})}};return window.addEventListener(`rari:navigation-start`,a),window.addEventListener(`rari:navigate`,t),window.addEventListener(`rari:app-router-rerender`,n),window.addEventListener(`rari:rsc-invalidate`,r),window.addEventListener(`rari:app-router-manifest-updated`,o),window.addEventListener(`rari:rsc-row`,c),()=>{clearInterval(e),pe(),window.removeEventListener(`rari:navigation-start`,a),window.removeEventListener(`rari:navigate`,t),window.removeEventListener(`rari:app-router-rerender`,n),window.removeEventListener(`rari:rsc-invalidate`,r),window.removeEventListener(`rari:app-router-manifest-updated`,o),window.removeEventListener(`rari:rsc-row`,c)}},[]),o(()=>{if(!(typeof window>`u`)&&window.location.hash&&v&&N.current){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&(t.scrollIntoView({behavior:`instant`,block:`start`}),N.current=!1)})})}},[v]);let ve=()=>{window.location.reload()},ye=()=>{M(null)},be=e=>{if(!e||typeof e!=`object`)return null;if(e.type===`html`&&e.props?.children){let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t)if(e&&typeof e==`object`&&e.type===`body`)return e.props?.children??null}return e},$=p;if(v?.element!=null)if(v.element&&typeof v.element==`object`&&`status`in v.element){let e=v.element.status;$=e===`fulfilled`?v.element.value:e===`rejected`?p:i.use(v.element)}else $=be(v.element)??v.element;return Array.isArray($)&&$.length===1&&i.isValidElement($[0])?$=$[0]:Array.isArray($)&&$.length>0&&$.every(e=>i.isValidElement(e)||e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)&&($=i.createElement(i.Fragment,null,...$)),d(l,{children:[j&&d(`div`,{style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,padding:`24px`,background:`rgba(220, 38, 38, 0.95)`,color:`white`,borderRadius:`8px`,fontSize:`14px`,zIndex:1e4,maxWidth:`500px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.3)`},children:[u(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),d(`div`,{style:{marginBottom:`12px`,opacity:.9},children:[j.type===`fetch`&&`Failed to fetch updated content from server.`,j.type===`parse`&&`Failed to parse server response.`,j.type===`stale`&&`Server returned stale content.`,j.type===`network`&&`Network error occurred.`]}),u(`div`,{style:{marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},children:j.details}),d(`div`,{style:{marginBottom:`12px`,fontSize:`12px`,opacity:.7},children:[`Consecutive failures:`,` `,A.current,` `,`/`,` `,3]}),d(`div`,{style:{display:`flex`,gap:`8px`},children:[u(`button`,{onClick:ve,type:`button`,style:{padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},children:`Refresh Page`}),u(`button`,{onClick:ye,type:`button`,style:{padding:`8px 16px`,background:`rgba(255, 255, 255, 0.2)`,color:`white`,border:`1px solid rgba(255, 255, 255, 0.3)`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},children:`Dismiss`})]}),u(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`})]}),u(a,{fallback:null,children:$})]})}export{g as AppRouterProvider};
@@ -23,8 +23,8 @@ declare class RscClient {
23
23
  processRscResponse(response: Response): Promise<any>;
24
24
  processRscResponseManually(response: Response): Promise<any>;
25
25
  parseRscResponse(rscPayload: string): any;
26
- reconstructElementFromRscData(elementData: any, modules: Map<string, ModuleData>): any;
27
- processPropsRecursively(props: any, modules: Map<string, ModuleData>): any;
26
+ reconstructElementFromRscData(elementData: any, modules: Map<string, ModuleData>, symbols?: Map<string, string>): any;
27
+ processPropsRecursively(props: any, modules: Map<string, ModuleData>, symbols?: Map<string, string>): any;
28
28
  }
29
29
  declare const rscClient: RscClient;
30
30
  declare function RscErrorComponent({
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,d as n,l as r,n as i,p as a,s as o,u as s}from"../regex-constants-B4P386OY.mjs";import{t as c}from"../get-client-component-B4Y2T40R.mjs";import{createFromFetch as l,createFromReadableStream as u}from"./vendor/react-flight-client/index.mjs";import*as d from"react";import{Suspense as f,cloneElement as p,createElement as m,isValidElement as h,use as g,useEffect as _,useState as v}from"react";import*as y from"react-dom/client";function b(){return import.meta.env?.RARI_SERVER_URL?import.meta.env.RARI_SERVER_URL:typeof window<`u`?window.location.origin:`http://localhost:3000`}globalThis[`~rari`]===void 0&&(globalThis[`~rari`]={}),globalThis[`~rari`].isDevelopment=process.env.NODE_ENV!==`production`,globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={}),globalThis[`~clientComponentNames`]===void 0&&(globalThis[`~clientComponentNames`]={}),globalThis[`~clientComponentPaths`]===void 0&&(globalThis[`~clientComponentPaths`]={}),typeof window<`u`&&(window[`~rari`]||(window[`~rari`]=globalThis[`~rari`]),window[`~rari`].streaming||(window[`~rari`].streaming={bufferedRows:[],bufferedEvents:[]}),window[`~rari`].streaming.bufferedEvents||(window[`~rari`].streaming.bufferedEvents=[]),window[`~rari`].boundaryModules||(window[`~rari`].boundaryModules=new Map),window[`~rari`].pendingBoundaryHydrations||(window[`~rari`].pendingBoundaryHydrations=new Map));function x(e){if(!e.startsWith(`I{`))return null;try{let t=JSON.parse(e.substring(1));if(typeof t==`object`&&t&&!Array.isArray(t)){if(typeof t.id!=`string`)return console.error(`[rari] Invalid import data: id must be a string:`,t),null;let e;if(typeof t.chunks==`string`)e=[t.chunks];else if(Array.isArray(t.chunks))e=t.chunks.filter(e=>typeof e==`string`);else return console.error(`[rari] Invalid import data: chunks must be a string or array:`,t),null;return e.length===0?(console.error(`[rari] Invalid import data: chunks array is empty:`,t),null):{id:t.id,chunks:e,name:t.name||`default`}}console.error(`[rari] Invalid import data format, expected object:`,t)}catch(t){console.error(`[rari] Failed to parse import row:`,e,t)}return null}if(typeof window<`u`){globalThis[`~rari`].processBoundaryUpdate=function(e,a,c){let l=document.querySelector(`[data-boundary-id="${e}"]`);if(l)try{let u=a.indexOf(`:`);if(u===-1){console.warn(`[rari] Invalid RSC row format (no colon):`,a);return}let d=a.substring(0,u),f=a.substring(u+1),p=x(f);if(p){let e=`$L${d}`;window[`~rari`].boundaryModules?.set(e,p);return}let m;try{m=JSON.parse(f)}catch(e){console.error(`[rari] Failed to parse RSC content:`,f,e);return}function h(e){if(!e)return!1;if(typeof e==`string`)return e.startsWith(`$L`);if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t]=e;if(typeof t==`string`&&t.startsWith(`$L`))return!0;let n=e[3];if(n&&n.children)return h(n.children)}return e.some(e=>h(e))}return!1}if(h(m)){if(window[`~rari`].pendingBoundaryHydrations?.set(e,{content:m,element:l,rowId:c}),globalThis[`~rari`].hydrateClientComponents){let t=globalThis[`~rari`].hydrateClientComponents;t(e,m,l)}return}function g(e){let a=e=>e.replace(o,`&amp;`).replace(s,`&lt;`).replace(r,`&gt;`).replace(n,`&quot;`).replace(t,`&#39;`),c=new Set(`div.span.p.ul.ol.li.a.img.section.article.header.footer.nav.main.aside.strong.em.b.i.button.input.label.form.select.option.textarea.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.td.th.code.pre.blockquote.hr.br.small.mark.del.ins.sub.sup.abbr.time.figure.figcaption.details.summary.dialog.menu.menuitem.canvas.svg.path.circle.rect.line.polygon.polyline.ellipse.text.g.defs.use.symbol.clippath.mask.pattern.lineargradient.radialgradient.stop.image.video.audio.source.track.picture.dl.dt.dd.fieldset.legend`.split(`.`));if(!e)return``;if(typeof e==`string`||typeof e==`number`)return a(String(e));if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t,,n]=e,r=typeof t==`string`&&c.has(t.toLowerCase())?t.toLowerCase():`div`,o=null,s=``,l=``;if(n){for(let[e,t]of Object.entries(n))if(e===`dangerouslySetInnerHTML`&&t&&typeof t==`object`&&`__html`in t)o=t.__html;else if(e!==`children`&&e!==`~boundaryId`){let n=e===`className`?`class`:e;if(e===`style`&&typeof t==`object`&&t){let e=Object.entries(t).map(([e,t])=>`${e.replace(i,`$1-$2`).toLowerCase()}:${String(t)}`).join(`;`);l+=` style="${a(e)}"`}else typeof t==`string`||typeof t==`number`?l+=` ${n}="${a(String(t))}"`:typeof t==`boolean`&&t&&(l+=` ${n}`)}o===null&&n.children&&(s=g(n.children))}return`<${r}${l}>${o===null?s:o}</${r}>`}return e.map(g).join(``)}return``}let _=g(m);if(_){let t=document.contains(l);t&&(l.innerHTML=_,l.classList.add(`rari-boundary-resolved`)),window.dispatchEvent(new CustomEvent(`rari:boundary-resolved`,{detail:{boundaryId:e,rscRow:a,rowId:c,element:l,wasAttached:t}}))}}catch(e){console.error(`[rari] Error processing boundary update:`,e)}};let e=window,a=globalThis;e[`~rari`].streaming?.bufferedEvents&&e[`~rari`].streaming.bufferedEvents.length>0&&(e[`~rari`].streaming.bufferedEvents.forEach(e=>{let{boundaryId:t,rscRow:n,rowId:r}=e;a[`~rari`].processBoundaryUpdate?.(t,n,r)}),e[`~rari`].streaming.bufferedEvents=[]),window.addEventListener(`rari:boundary-update`,e=>{let{boundaryId:t,rscRow:n,rowId:r}=e.detail;a[`~rari`].processBoundaryUpdate&&a[`~rari`].processBoundaryUpdate(t,n,r)})}function S(t,n,r){let i=r==="default"?t.name||n.split(`/`).pop()?.replace(e,``)||`DefaultComponent`:r,a=i,o={id:a,path:n,type:`client`,component:t,registered:!0};globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={});let s=`${n}#${r}`;globalThis[`~clientComponents`][a]=o,globalThis[`~clientComponents`][n]=o,globalThis[`~clientComponents`][s]=o,globalThis[`~clientComponentPaths`][n]=a,globalThis[`~clientComponentNames`][i]=a,t&&(t[`~isClientComponent`]=!0,t[`~clientComponentId`]=a),typeof window<`u`&&fetch(`/_rari/register-client`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:a,file_path:n,export_name:r})}).catch(e=>{console.error(`[rari] Failed to register client component with server:`,e)})}function C(e){return c(e)}function w(){let e={};for(let[t,n]of Object.entries(globalThis[`~clientComponents`]))e[t]={id:t,chunks:[n.path],name:t,async:!1,default:n.component};return e}let T=l,E=u,D=null;async function O(){return D||(D=(async()=>{try{return T=l,E=u,typeof E!=`function`&&(E=null),typeof T!=`function`&&(T=null),y}catch(e){return console.error(`Failed to load react-dom/client RSC functions:`,e),T=null,E=null,null}})(),D)}const k=new Map,A=new class{componentCache;moduleCache;inflightRequests;config;constructor(){this.componentCache=new Map,this.moduleCache=new Map,this.inflightRequests=new Map,this.config={maxRetries:5,retryDelay:500,timeout:1e4}}configure(e){this.config={...this.config,...e}}clearCache(){this.componentCache.clear(),this.moduleCache.clear(),k.clear()}async fetchServerComponent(e,t={}){let n=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,r=`${e}:${JSON.stringify(t)}:hmr:${n}`;if(this.componentCache.has(r))return this.componentCache.get(r);if(this.inflightRequests.has(r))return this.inflightRequests.get(r);let i=this.fetchServerComponentStream(e,t);this.inflightRequests.set(r,i);try{let e=await i;return this.componentCache.set(r,e),e}finally{this.inflightRequests.delete(r)}}async fetchServerComponentStream(e,t={}){await O();let n=(()=>{let e=[`/_rari/stream`];try{if(typeof window<`u`&&(window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`)){let t=b();t&&e.push(`${t}/_rari/stream`)}}catch{}return e})(),r=null,i=null,a=async()=>{for(let r of n)try{let n=await this.fetchWithTimeout(r,{method:`POST`,headers:{"Content-Type":`application/json`,...this.buildRequestHeaders()},body:JSON.stringify({component_id:e,props:t})});if(n.ok)return n;i=Error(`HTTP ${n.status}: ${await n.text()}`)}catch(e){i=e}return null};if(r=await a(),r||=(await new Promise(e=>setTimeout(e,this.config.retryDelay)),await a()),!r)throw i||Error(`Failed to reach stream endpoint`);if(!r.ok){let e=await r.text();throw Error(`Server responded with ${r.status}: ${e}`)}let o=r.body;if(!o)throw Error(`No ReadableStream from stream response`);let s=o.getReader(),c=new TextDecoder,l=new Map,u=new Map,d=e=>{if(!m)return console.error(`React not available for RSC conversion`),null;if(!e)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t,n,r]=e;if(t===`react.suspense`||t===`suspense`)return m(f,{fallback:d(r?.fallback)||null},r?.children?d(r.children):null);let i=r?{...r}:{};if(r?.children){let e=d(r.children);Array.isArray(e)?i.children=e.map((e,t)=>h(e)&&e.key==null?p(e,{key:t}):e):i.children=e}if(typeof t==`string`){if(t.startsWith(`$L`)){let e=l.get(t);if(e){let t=C(`${e.id}#${e.name||`default`}`);if(t)return m(t,n?{...i,key:n}:i)}return i&&i.children?i.children:null}if(t.includes(`.tsx#`)||t.includes(`.jsx#`)){let e=C(t);return e?m(e,n?{...i,key:n}:i):(console.error(`Failed to resolve client component:`,t),null)}else return i&&Object.hasOwn(i,`~boundaryId`)&&(i={...i},delete i[`~boundaryId`]),m(t,n?{...i,key:n}:i)}else console.error(`Unknown RSC element type:`,t)}return e.map(e=>d(e))}return typeof e==`object`?(console.error(`Unexpected object in RSC conversion:`,e),null):e},g=null,y=new Map,S=``,w=null,T=async()=>{try{for(;;){let{value:e,done:t}=await s.read();if(t)break;let n=c.decode(e,{stream:!0});S+=n;let r=S.split(`
2
- `),i=r.slice(0,-1);S=r.at(-1)||``;for(let e of i)if(e.trim())try{let t=e.indexOf(`:`);if(t===-1)continue;let n=e.substring(0,t),r=e.substring(t+1),i=x(r);if(i)l.set(`$L${n}`,i);else if(r.startsWith(`E{`))try{let e=JSON.parse(r.substring(1));console.error(`RSC stream error:`,e)}catch(e){console.error(`Failed to parse error row:`,r,e)}else if(r.startsWith(`Symbol.for(`))continue;else if(r.startsWith(`[`)){let e=JSON.parse(r);if(Array.isArray(e)&&e.length>=4){let[t,r,i]=e,a=i?.[`~boundaryId`];if(t===`$`&&(r===`react.suspense`||r===`suspense`)&&i&&a&&u.set(`$L${n}`,a),t===`$`&&i&&Object.hasOwn(i,`children`)&&typeof r==`string`&&r.startsWith(`$L`)){let e=u.get(r)||null;if(e){let t=d(i.children);y.set(e,t),w&&w.updateBoundary(e,t);continue}}}if(!g){let t=!0;if(Array.isArray(e)&&e.length>=4&&e[0]===`$`){let n=e[1],r=e[3],i=r?.[`~boundaryId`];typeof n==`string`&&(n===`react.suspense`||n===`suspense`)&&r&&i&&(t=!1)}t&&(g=d(e),w&&typeof w.updateRoot==`function`&&w.updateRoot())}}}catch(t){console.error(`Failed to parse stream line:`,e,t)}}}catch(e){console.error(`Error processing stream:`,e)}},E=()=>{let[,e]=v(0);_(()=>(w={updateBoundary:(t,n)=>{y.set(t,n),e(e=>e+1)},updateRoot:()=>{e(e=>e+1)}},()=>{w=null}),[e]);let t=e=>{if(!e)return null;if(h(e)){let n=e.props,r=n?.[`~boundaryId`];if(n&&r){let e=y.get(r);if(e)return e}if(n&&n.children){let r=t(n.children);if(r!==n.children){let t={...n};return e.key!==null&&e.key!==void 0&&(t.key=e.key),m(e.type,t,r)}}return e}return Array.isArray(e)?e.map(e=>t(e)):e};return t(g)};T();let D=Promise.resolve(m(E));return{"~isRscResponse":!0,"~rscPromise":D,readRoot(){return D}}}buildRequestHeaders(){return{Accept:`text/x-component`,"Cache-Control":`no-cache, no-transform`}}async fetchWithTimeout(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),this.config.timeout);try{let i=await fetch(e,{...t,signal:n.signal});return clearTimeout(r),i}catch(e){throw clearTimeout(r),e}}async processRscResponse(e){if(await O(),T)try{let t=T(Promise.resolve(e));return{"~isRscResponse":!0,"~rscPromise":t,readRoot(){return t}}}catch{throw Error(`React Server DOM client not available`)}else throw Error(`React Server DOM client not available`)}async processRscResponseManually(e){let t=await e.text();return this.parseRscResponse(t)}parseRscResponse(e){let t=e.trim().split(a),n=new Map,r=new Map,i=[];for(let e of t){let t=e.indexOf(`:`);if(t===-1)continue;let a=e.substring(0,t),o=e.substring(t+1);if(o)try{let t=x(o);if(t)n.set(`$L${a}`,t);else if(o.startsWith(`E{`)){let e=o.substring(1),t=JSON.parse(e);i.push(t),console.error(`RSC: Server error`,t)}else if(o.startsWith(`[`)){let e=JSON.parse(o);r.set(a,e)}else if(o.startsWith(`Symbol.for(`))continue;else console.error(`Unknown RSC row format:`,e)}catch(t){console.error(`Failed to parse RSC row:`,e,t)}}if(i.length>0)throw Error(`RSC Server Error: ${i.map(e=>e.message||e).join(`, `)}`);let o=null,s=Array.from(r.keys()).sort((e,t)=>Number.parseInt(e,16)-Number.parseInt(t,16));for(let e of s){let t=r.get(e);if(Array.isArray(t)&&t.length>=2&&t[0]===`$`){let[,e,,n]=t,r=n?.[`~boundaryId`];if(e===`react.suspense`&&n&&r)continue;o=t;break}}return o?this.reconstructElementFromRscData(o,n):(console.error(`No valid root element found in RSC payload`,{elements:r,modules:n}),null)}reconstructElementFromRscData(e,t){if(e==null)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e))if(e.length>=4&&e[0]===`$`){let[,n,r,i]=e,a=n;if(typeof n==`string`&&n.includes(`#`))a=C(n)||(({children:e,...t})=>m(`div`,{...t,"data-client-component":n,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},m(`small`,{style:{color:`#c00`}},`Missing Client Component: ${n}`),e));else if(typeof n==`string`&&n.startsWith(`$L`)&&t.has(n)){let e=t.get(n);e&&(a=C(`${e.id}#${e.name}`)||(({children:t,...r})=>m(`div`,{...r,"data-client-component":n,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},m(`small`,{style:{color:`#c00`}},`Missing Client Component: ${e.name} (${e.id})`),t)))}let o=i?this.processPropsRecursively(i,t):{};return m(a,{key:r,...o})}else return e.map(e=>this.reconstructElementFromRscData(e,t));return typeof e==`object`?null:e}processPropsRecursively(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))if(r===`children`)if(Array.isArray(i))if(i.length>=2&&i[0]===`$`)n[r]=this.reconstructElementFromRscData(i,t);else{let e=i.map(e=>this.reconstructElementFromRscData(e,t)).filter(e=>e!=null);e.length===0?n[r]=null:e.length===1?n[r]=e[0]:n[r]=e}else n[r]=this.reconstructElementFromRscData(i,t);else r===`dangerouslySetInnerHTML`?n[r]=i:n[r]=this.reconstructElementFromRscData(i,t);return n}};function j({error:e,details:t}){return m(`div`,{className:`rsc-error`,style:{padding:`16px`,backgroundColor:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`,margin:`8px 0`,fontFamily:`monospace`}},m(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`}},`RSC Error`),m(`p`,{style:{margin:`0 0 8px 0`}},e),t&&m(`details`,{style:{marginTop:`8px`}},m(`summary`,{style:{cursor:`pointer`}},`Error Details`),m(`pre`,{style:{fontSize:`12px`,overflow:`auto`,backgroundColor:`#f5f5f5`,padding:`8px`}},JSON.stringify(t,null,2))))}function M({rootPromise:e}){return g(e)}function N({componentId:e,props:t,fallback:n}){let r=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,i=`${e}:${JSON.stringify(t)}:hmr:${r}`;if(!k.has(i)){let n=A.fetchServerComponent(e,t).catch(e=>{throw k.delete(i),e});k.set(i,n)}let a=g(k.get(i));if(a?.[`~isRscResponse`]){let e=a.readRoot();return m(f,{fallback:n??null},m(M,{rootPromise:e}))}return a??null}var P=class extends d.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidUpdate(e){e.mountKey!==this.props.mountKey&&this.state.hasError&&this.setState({hasError:!1,error:null})}componentDidCatch(e,t){console.error(`[rari] ServerComponentErrorBoundary: Error in component ${this.props.componentId}:`,e,t)}render(){return this.state.hasError?m(j,{error:this.state.error?.message||`Unknown error`,details:{componentId:this.props.componentId}}):this.props.children}};function F(e){let t=0;if(typeof window<`u`){let n=window;n[`~rari`].hmr||(n[`~rari`].hmr={refreshCounters:{}}),n[`~rari`].hmr.refreshCounters[e]===void 0&&(n[`~rari`].hmr.refreshCounters[e]=0),t=n[`~rari`].hmr.refreshCounters[e]}let n=n=>{let[r,i]=v(t);return _(()=>{let t=t=>{let n=t.detail;if(n&&n.filePath&&L(n.filePath)&&(A.clearCache(),typeof window<`u`)){let t=window;t[`~rari`].hmr||(t[`~rari`].hmr={refreshCounters:{}}),t[`~rari`].hmr.refreshCounters[e]=(t[`~rari`].hmr.refreshCounters[e]||0)+1,i(t[`~rari`].hmr.refreshCounters[e])}};return typeof window<`u`&&window.addEventListener(`rari:rsc-invalidate`,t),()=>{typeof window<`u`&&window.removeEventListener(`rari:rsc-invalidate`,t)}},[]),m(f,{fallback:null},m(P,{componentId:e,mountKey:r},m(N,{key:`${e}-${r}`,componentId:e,props:n,fallback:null})))};return n.displayName=`ServerComponent(${e})`,function(e){return m(n,e)}}function I(e,t){return A.fetchServerComponent(e,t)}function L(e){if(!e)return!1;try{return typeof globalThis<`u`&&globalThis[`~rari`].serverComponents?globalThis[`~rari`].serverComponents.has(e):!1}catch(e){return console.error(`Error checking if file is server component:`,e),!1}}if(import.meta.hot){let e=!1,t=[],n=new Map;function r(r,i){n.set(r,i),import.meta.hot.on(r,async n=>{if(!e){t.push({event:r,data:n});return}try{await i(n)}catch(e){console.error(`[rari] HMR: Error in handler for '${r}':`,e)}})}r(`rari:register-server-component`,e=>{e?.filePath&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,globalThis[`~rari`].serverComponents.add(e.filePath))}),r(`rari:server-components-registry`,e=>{e?.serverComponents&&Array.isArray(e.serverComponents)&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,e.serverComponents.forEach(e=>{globalThis[`~rari`].serverComponents?.add(e)}))}),r(`vite:beforeFullReload`,async e=>{e?.path&&L(e.path)&&await u({filePath:e.path,forceReload:!0})}),r(`rari:server-component-updated`,async e=>{let t=e?.id||e?.componentId,n=e?.t||e?.timestamp;if(t){if(typeof window<`u`){let r=new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:t,filePath:e.filePath||e.file,type:`server-component`,timestamp:n}});window.dispatchEvent(r)}}else e?.path&&L(e.path)&&await u({filePath:e.path,forceReload:!1})}),r(`rari:app-router-updated`,async e=>{try{if(!e||!e.routePath&&(!e.affectedRoutes||e.affectedRoutes.length===0))return;await i(e)}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}}),r(`rari:server-action-updated`,async e=>{if(e?.filePath&&(A.clearCache(),typeof window<`u`)){let t=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}});window.dispatchEvent(t)}});async function i(e){let t=e.fileType,n=e.filePath,r=e.routePath,i=e.affectedRoutes,o=e.manifestUpdated,u=e.metadata;e.metadataChanged&&u&&a(u);try{let e=`${b()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:n})});if(!t.ok){let e=await t.text(),n=`Component reload failed with status ${t.status}: ${e}`;throw console.error(`[rari] HMR:`,n),Error(n)}let r=await t.json();if(typeof r!=`object`||!r){let e=`Invalid reload response: null or non-object`;throw console.error(`[rari] HMR:`,e,r),Error(e)}if(r.success!==!0&&r.reloaded!==!0){let e=`Component reload unsuccessful: ${r.error||`unknown error`}`;throw console.error(`[rari] HMR:`,e,r),Error(e)}}catch(e){console.error(`[rari] HMR: Failed to reload component:`,e);return}let d=[r];switch(t){case`page`:d=[r];break;case`layout`:case`loading`:case`error`:case`not-found`:d=i;break;default:break}await s({routes:d,fileType:t,filePath:n,componentId:r}),o&&await l(),await c({routePath:r,affectedRoutes:i})}function a(e){if(!(typeof document>`u`)&&(e.title&&(document.title=e.title),e.description)){let t=document.querySelector(`meta[name="description"]`);t||(t=document.createElement(`meta`),t.setAttribute(`name`,`description`),document.head.appendChild(t)),t.setAttribute(`content`,e.description)}}function o(e){if(!e||e.length===0){A.clearCache();return}let t=[];for(let n of A.componentCache.keys())for(let r of e){if(n.includes(`route:${r}:`)||n.startsWith(`${r}:`)){t.push(n);break}if(r!==`/`&&n.includes(`route:${r}/`)){t.push(n);break}}for(let e of t)A.componentCache.delete(e),k.delete(e);let n=[];for(let t of k.keys())for(let r of e){if(t.includes(`route:${r}:`)||t.startsWith(`${r}:`)){n.push(t);break}if(r!==`/`&&t.includes(`route:${r}/`)){n.push(t);break}}for(let e of n)k.delete(e)}async function s(e){let t=e.routes||[],n=e.fileType,r=e.filePath,i=e.componentId;if(i||r)try{let e=`${b()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:i||r,filePath:r})}),n=await t.text();t.ok||console.error(`[rari] HMR: Server cache invalidation failed:`,t.status,n)}catch(e){console.error(`[rari] HMR: Failed to call server invalidation endpoint:`,e)}if(o(t),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{routes:t,fileType:n}});window.dispatchEvent(e)}}async function c(e){let t=e.routePath,n=e.affectedRoutes||[t];if(!(typeof window>`u`))try{let e=window.location.pathname,r=new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:t,affectedRoutes:n,currentPath:e,preserveParams:!0}});window.dispatchEvent(r)}catch(e){throw console.error(`[rari] HMR: Failed to trigger re-render:`,e),e}}async function l(){typeof window<`u`&&window[`~rari`]?.routeInfoCache&&window[`~rari`].routeInfoCache.clear()}async function u(e){let t=e?.filePath||e;if(A.clearCache(),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:t}});window.dispatchEvent(e)}}t.length>0?(async()=>{try{for(;t.length>0;){let e=[...t];t.length=0;for(let{event:t,data:r}of e){let e=n.get(t);if(e)try{await e(r)}catch(e){console.error(`[rari] HMR: Error replaying buffered event '${t}':`,e)}}}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{e=!0}})():e=!0}var R=class{overlay;currentError;escapeKeyHandler;constructor(){this.overlay=null,this.currentError=null,this.escapeKeyHandler=null}show(e){this.currentError=e,this.overlay?this.updateOverlay(e):this.createOverlay(e)}hide(){this.overlay&&(this.overlay.remove(),this.overlay=null,this.currentError=null),this.escapeKeyHandler&&=(document.removeEventListener(`keydown`,this.escapeKeyHandler),null)}isVisible(){return this.overlay!==null}createOverlay(e){this.overlay=document.createElement(`div`),this.overlay.id=`rari-hmr-error-overlay`,this.updateOverlay(e),document.body.appendChild(this.overlay),this.escapeKeyHandler=e=>{e.key===`Escape`&&this.hide()},document.addEventListener(`keydown`,this.escapeKeyHandler)}updateOverlay(e){if(!this.overlay)return;this.overlay.replaceChildren();let t=document.createElement(`div`);t.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 2rem; backdrop-filter: blur(4px);`;let n=document.createElement(`div`);n.style.cssText=`background: #1e1e1e; color: #e0e0e0; border-radius: 0.5rem; padding: 2rem; max-width: 50rem; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4); border: 1px solid #ef4444;`;let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;`;let i=document.createElement(`div`);i.style.cssText=`display: flex; align-items: center; gap: 0.75rem;`;let a=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);a.style.cssText=`width: 2rem; height: 2rem; color: #ef4444;`,a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`viewBox`,`0 0 24 24`);let o=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);o.setAttribute(`stroke-linecap`,`round`),o.setAttribute(`stroke-linejoin`,`round`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`d`,`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`),a.appendChild(o);let s=document.createElement(`h1`);s.style.cssText=`margin: 0; font-size: 1.5rem; font-weight: 700; color: #ef4444;`,s.textContent=`Build Error`,i.appendChild(a),i.appendChild(s);let c=document.createElement(`button`);if(c.style.cssText=`background: transparent; border: none; color: #9ca3af; cursor: pointer; padding: 0.5rem; border-radius: 0.25rem; transition: all 0.2s; font-size: 1.5rem; line-height: 1; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;`,c.textContent=`×`,c.setAttribute(`aria-label`,`Close overlay`),c.onclick=()=>this.hide(),c.onmouseover=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onmouseout=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},c.onfocus=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onblur=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},r.appendChild(i),r.appendChild(c),n.appendChild(r),e.filePath){let t=document.createElement(`div`);t.style.cssText=`margin-bottom: 1rem; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; font-family: monospace; font-size: 0.875rem;`;let r=document.createElement(`strong`);r.textContent=`File: `,t.appendChild(r),t.appendChild(document.createTextNode(e.filePath)),n.appendChild(t)}let l=document.createElement(`div`);l.style.cssText=`margin-bottom: 1.5rem;`;let u=document.createElement(`h2`);u.style.cssText=`margin: 0 0 0.75rem 0; font-size: 1rem; font-weight: 600; color: #fca5a5;`,u.textContent=`Error Message:`;let d=document.createElement(`pre`);if(d.style.cssText=`margin: 0; padding: 1rem; background: rgba(239, 68, 68, 0.1); border-left: 4px solid #ef4444; border-radius: 0.375rem; overflow-x: auto; font-family: monospace; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #fca5a5;`,d.textContent=e.message??`An error occurred`,l.appendChild(u),l.appendChild(d),n.appendChild(l),e.stack){let t=document.createElement(`details`);t.style.cssText=`margin-top: 1rem; cursor: pointer;`;let r=document.createElement(`summary`);r.style.cssText=`font-weight: 600; margin-bottom: 0.5rem; user-select: none;`,r.textContent=`Stack Trace`;let i=document.createElement(`pre`);i.style.cssText=`margin: 0; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; overflow-x: auto; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;`,i.textContent=e.stack,t.appendChild(r),t.appendChild(i),n.appendChild(t)}let f=document.createElement(`div`);f.style.cssText=`margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #374151; display: flex; gap: 0.75rem; align-items: center;`;let p=document.createElement(`button`);p.style.cssText=`padding: 0.625rem 1.25rem; background: #ef4444; color: white; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,p.textContent=`Reload Page`,p.onclick=()=>window.location.reload(),p.onmouseover=()=>{p.style.background=`#dc2626`},p.onmouseout=()=>{p.style.background=`#ef4444`},p.onfocus=()=>{p.style.background=`#dc2626`},p.onblur=()=>{p.style.background=`#ef4444`};let m=document.createElement(`button`);m.style.cssText=`padding: 0.625rem 1.25rem; background: #374151; color: #e0e0e0; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,m.textContent=`Dismiss`,m.onclick=()=>this.hide(),m.onmouseover=()=>{m.style.background=`#4b5563`},m.onmouseout=()=>{m.style.background=`#374151`},m.onfocus=()=>{m.style.background=`#4b5563`},m.onblur=()=>{m.style.background=`#374151`};let h=document.createElement(`span`);h.style.cssText=`margin-left: auto; font-size: 0.75rem; color: #9ca3af;`;let g=new Date(e.timestamp);h.textContent=Number.isNaN(g.valueOf())?``:g.toLocaleTimeString(),f.appendChild(p),f.appendChild(m),f.appendChild(h),n.appendChild(f),t.appendChild(n),this.overlay.appendChild(t)}};let z=null;function B(){return z||=new R,z}if(import.meta.hot){let e=B();import.meta.hot.on(`rari:hmr-error`,t=>{let n=t.msg||t.message,r=t.file||t.filePath,i=t.t||t.timestamp,a=t.count||t.errorCount,o=t.max||t.maxErrors;console.error(`[rari] HMR: Build error:`,n),r&&console.error(`[rari] HMR: File:`,r),t.stack&&console.error(`[rari] HMR: Stack:`,t.stack),e.show({message:n,stack:t.stack,filePath:r,timestamp:i}),a&&o&&(a>=o?console.error(`[rari] HMR: Maximum error count (${o}) reached. Consider restarting the dev server if issues persist.`):a>=o-2&&console.warn(`[rari] HMR: Error count: ${a}/${o}. Approaching maximum error threshold.`))}),import.meta.hot.on(`rari:hmr-error-cleared`,()=>{e.hide()}),import.meta.hot.on(`vite:error`,t=>{e.show({message:t.err?.message||`Unknown Vite error`,stack:t.err?.stack,filePath:t.err?.file,timestamp:Date.now()})})}export{j as RscErrorComponent,w as createClientModuleMap,F as createServerComponentWrapper,I as fetchServerComponent,C as getClientComponent,S as registerClientComponent,A as rscClient};
1
+ import{a as e,c as t,d as n,l as r,n as i,p as a,s as o,u as s}from"../regex-constants-B4P386OY.mjs";import{t as c}from"../get-client-component-B4Y2T40R.mjs";import{t as l}from"../suspense-CsIYuC_l.mjs";import{createFromFetch as u,createFromReadableStream as d}from"./vendor/react-flight-client/index.mjs";import*as f from"react";import{Suspense as p,cloneElement as m,createElement as h,isValidElement as g,use as _,useEffect as v,useState as y}from"react";import*as b from"react-dom/client";function x(){return import.meta.env?.RARI_SERVER_URL?import.meta.env.RARI_SERVER_URL:typeof window<`u`?window.location.origin:`http://localhost:3000`}globalThis[`~rari`]===void 0&&(globalThis[`~rari`]={}),globalThis[`~rari`].isDevelopment=process.env.NODE_ENV!==`production`,globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={}),globalThis[`~clientComponentNames`]===void 0&&(globalThis[`~clientComponentNames`]={}),globalThis[`~clientComponentPaths`]===void 0&&(globalThis[`~clientComponentPaths`]={}),typeof window<`u`&&(window[`~rari`]||(window[`~rari`]=globalThis[`~rari`]),window[`~rari`].streaming||(window[`~rari`].streaming={bufferedRows:[],bufferedEvents:[]}),window[`~rari`].streaming.bufferedEvents||(window[`~rari`].streaming.bufferedEvents=[]),window[`~rari`].boundaryModules||(window[`~rari`].boundaryModules=new Map),window[`~rari`].pendingBoundaryHydrations||(window[`~rari`].pendingBoundaryHydrations=new Map));function S(e){if(!e.startsWith(`I{`))return null;try{let t=JSON.parse(e.substring(1));if(typeof t==`object`&&t&&!Array.isArray(t)){if(typeof t.id!=`string`)return console.error(`[rari] Invalid import data: id must be a string:`,t),null;let e;if(typeof t.chunks==`string`)e=[t.chunks];else if(Array.isArray(t.chunks))e=t.chunks.filter(e=>typeof e==`string`);else return console.error(`[rari] Invalid import data: chunks must be a string or array:`,t),null;return e.length===0?(console.error(`[rari] Invalid import data: chunks array is empty:`,t),null):{id:t.id,chunks:e,name:t.name||`default`}}console.error(`[rari] Invalid import data format, expected object:`,t)}catch(t){console.error(`[rari] Failed to parse import row:`,e,t)}return null}if(typeof window<`u`){globalThis[`~rari`].processBoundaryUpdate=function(e,a,c){let l=document.querySelector(`[data-boundary-id="${e}"]`);if(l)try{let u=a.indexOf(`:`);if(u===-1){console.warn(`[rari] Invalid RSC row format (no colon):`,a);return}let d=a.substring(0,u),f=a.substring(u+1),p=S(f);if(p){let e=`$L${d}`;window[`~rari`].boundaryModules?.set(e,p);return}let m;try{m=JSON.parse(f)}catch(e){console.error(`[rari] Failed to parse RSC content:`,f,e);return}function h(e){if(!e)return!1;if(typeof e==`string`)return e.startsWith(`$L`);if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t]=e;if(typeof t==`string`&&t.startsWith(`$L`))return!0;let n=e[3];if(n&&n.children)return h(n.children)}return e.some(e=>h(e))}return!1}if(h(m)){if(window[`~rari`].pendingBoundaryHydrations?.set(e,{content:m,element:l,rowId:c}),globalThis[`~rari`].hydrateClientComponents){let t=globalThis[`~rari`].hydrateClientComponents;t(e,m,l)}return}function g(e){let a=e=>e.replace(o,`&amp;`).replace(s,`&lt;`).replace(r,`&gt;`).replace(n,`&quot;`).replace(t,`&#39;`),c=new Set(`div.span.p.ul.ol.li.a.img.section.article.header.footer.nav.main.aside.strong.em.b.i.button.input.label.form.select.option.textarea.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.td.th.code.pre.blockquote.hr.br.small.mark.del.ins.sub.sup.abbr.time.figure.figcaption.details.summary.dialog.menu.menuitem.canvas.svg.path.circle.rect.line.polygon.polyline.ellipse.text.g.defs.use.symbol.clippath.mask.pattern.lineargradient.radialgradient.stop.image.video.audio.source.track.picture.dl.dt.dd.fieldset.legend`.split(`.`));if(!e)return``;if(typeof e==`string`||typeof e==`number`)return a(String(e));if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t,,n]=e,r=typeof t==`string`&&c.has(t.toLowerCase())?t.toLowerCase():`div`,o=null,s=``,l=``;if(n){for(let[e,t]of Object.entries(n))if(e===`dangerouslySetInnerHTML`&&t&&typeof t==`object`&&`__html`in t)o=t.__html;else if(e!==`children`&&e!==`~boundaryId`){let n=e===`className`?`class`:e;if(e===`style`&&typeof t==`object`&&t){let e=Object.entries(t).map(([e,t])=>`${e.replace(i,`$1-$2`).toLowerCase()}:${String(t)}`).join(`;`);l+=` style="${a(e)}"`}else typeof t==`string`||typeof t==`number`?l+=` ${n}="${a(String(t))}"`:typeof t==`boolean`&&t&&(l+=` ${n}`)}o===null&&n.children&&(s=g(n.children))}return`<${r}${l}>${o===null?s:o}</${r}>`}return e.map(g).join(``)}return``}let _=g(m);if(_){let t=document.contains(l);t&&(l.innerHTML=_,l.classList.add(`rari-boundary-resolved`)),window.dispatchEvent(new CustomEvent(`rari:boundary-resolved`,{detail:{boundaryId:e,rscRow:a,rowId:c,element:l,wasAttached:t}}))}}catch(e){console.error(`[rari] Error processing boundary update:`,e)}};let e=window,a=globalThis;e[`~rari`].streaming?.bufferedEvents&&e[`~rari`].streaming.bufferedEvents.length>0&&(e[`~rari`].streaming.bufferedEvents.forEach(e=>{let{boundaryId:t,rscRow:n,rowId:r}=e;a[`~rari`].processBoundaryUpdate?.(t,n,r)}),e[`~rari`].streaming.bufferedEvents=[]),window.addEventListener(`rari:boundary-update`,e=>{let{boundaryId:t,rscRow:n,rowId:r}=e.detail;a[`~rari`].processBoundaryUpdate&&a[`~rari`].processBoundaryUpdate(t,n,r)})}function C(t,n,r){let i=r==="default"?t.name||n.split(`/`).pop()?.replace(e,``)||`DefaultComponent`:r,a=i,o={id:a,path:n,type:`client`,component:t,registered:!0};globalThis[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={});let s=`${n}#${r}`;globalThis[`~clientComponents`][a]=o,globalThis[`~clientComponents`][n]=o,globalThis[`~clientComponents`][s]=o,globalThis[`~clientComponentPaths`][n]=a,globalThis[`~clientComponentNames`][i]=a,t&&(t[`~isClientComponent`]=!0,t[`~clientComponentId`]=a),typeof window<`u`&&fetch(`/_rari/register-client`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:a,file_path:n,export_name:r})}).catch(e=>{console.error(`[rari] Failed to register client component with server:`,e)})}function w(e){return c(e)}function T(){let e={};for(let[t,n]of Object.entries(globalThis[`~clientComponents`]))e[t]={id:t,chunks:[n.path],name:t,async:!1,default:n.component};return e}let E=u,D=d,O=null;async function k(){return O||(O=(async()=>{try{return E=u,D=d,typeof D!=`function`&&(D=null),typeof E!=`function`&&(E=null),b}catch(e){return console.error(`Failed to load react-dom/client RSC functions:`,e),E=null,D=null,null}})(),O)}const A=new Map,j=new class{componentCache;moduleCache;inflightRequests;config;constructor(){this.componentCache=new Map,this.moduleCache=new Map,this.inflightRequests=new Map,this.config={maxRetries:5,retryDelay:500,timeout:1e4}}configure(e){this.config={...this.config,...e}}clearCache(){this.componentCache.clear(),this.moduleCache.clear(),A.clear()}async fetchServerComponent(e,t={}){let n=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,r=`${e}:${JSON.stringify(t)}:hmr:${n}`;if(this.componentCache.has(r))return this.componentCache.get(r);if(this.inflightRequests.has(r))return this.inflightRequests.get(r);let i=this.fetchServerComponentStream(e,t);this.inflightRequests.set(r,i);try{let e=await i;return this.componentCache.set(r,e),e}finally{this.inflightRequests.delete(r)}}async fetchServerComponentStream(e,t={}){await k();let n=(()=>{let e=[`/_rari/stream`];try{if(typeof window<`u`&&(window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`)){let t=x();t&&e.push(`${t}/_rari/stream`)}}catch{}return e})(),r=null,i=null,a=async()=>{for(let r of n)try{let n=await this.fetchWithTimeout(r,{method:`POST`,headers:{"Content-Type":`application/json`,...this.buildRequestHeaders()},body:JSON.stringify({component_id:e,props:t})});if(n.ok)return n;i=Error(`HTTP ${n.status}: ${await n.text()}`)}catch(e){i=e}return null};if(r=await a(),r||=(await new Promise(e=>setTimeout(e,this.config.retryDelay)),await a()),!r)throw i||Error(`Failed to reach stream endpoint`);if(!r.ok){let e=await r.text();throw Error(`Server responded with ${r.status}: ${e}`)}let o=r.body;if(!o)throw Error(`No ReadableStream from stream response`);let s=o.getReader(),c=new TextDecoder,u=new Map,d=new Map,f=e=>{if(!h)return console.error(`React not available for RSC conversion`),null;if(!e)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,t,n,r]=e;if(l(t))return h(p,{fallback:r?.fallback?f(r.fallback):null},r?.children?f(r.children):null);let i=r?{...r}:{};if(r?.children){let e=f(r.children);Array.isArray(e)?i.children=e.map((e,t)=>g(e)&&e.key==null?m(e,{key:t}):e):i.children=e}if(typeof t==`string`){if(t.startsWith(`$L`)){let e=u.get(t);if(e){let t=w(`${e.id}#${e.name||`default`}`);if(t)return h(t,n?{...i,key:n}:i)}return i&&i.children?i.children:null}if(t.includes(`.tsx#`)||t.includes(`.jsx#`)){let e=w(t);return e?h(e,n?{...i,key:n}:i):(console.error(`Failed to resolve client component:`,t),null)}else return i&&Object.hasOwn(i,`~boundaryId`)&&(i={...i},delete i[`~boundaryId`]),h(t,n?{...i,key:n}:i)}else console.error(`Unknown RSC element type:`,t)}return e.map(e=>f(e))}return typeof e==`object`?(console.error(`Unexpected object in RSC conversion:`,e),null):e},_=null,b=new Map,C=``,T=null,E=async()=>{try{for(;;){let{value:e,done:t}=await s.read();if(t)break;let n=c.decode(e,{stream:!0});C+=n;let r=C.split(`
2
+ `),i=r.slice(0,-1);C=r.at(-1)||``;for(let e of i)if(e.trim())try{let t=e.indexOf(`:`);if(t===-1)continue;let n=e.substring(0,t),r=e.substring(t+1),i=S(r);if(i)u.set(`$L${n}`,i);else if(r.startsWith(`E{`))try{let e=JSON.parse(r.substring(1)),t=e?.error??e?.message??JSON.stringify(e);console.error(`RSC stream error:`,t)}catch(e){console.error(`Failed to parse error row:`,r,e)}else if(r.startsWith(`Symbol.for(`))continue;else if(r.startsWith(`[`)){let e=JSON.parse(r);if(Array.isArray(e)&&e.length>=4){let[t,r,i]=e,a=i?.[`~boundaryId`];if(t===`$`&&l(r)&&i&&a&&d.set(`$L${n}`,a),t===`$`&&i&&Object.hasOwn(i,`children`)&&typeof r==`string`&&r.startsWith(`$L`)){let e=d.get(r)||null;if(e){let t=f(i.children);b.set(e,t),T&&T.updateBoundary(e,t);continue}}}if(!_){let t=!0;if(Array.isArray(e)&&e.length>=4&&e[0]===`$`){let n=e[1],r=e[3],i=r?.[`~boundaryId`];typeof n==`string`&&l(n)&&r&&i&&(t=!1)}t&&(_=f(e),T&&typeof T.updateRoot==`function`&&T.updateRoot())}}}catch(t){console.error(`Failed to parse stream line:`,e,t)}}}catch(e){console.error(`Error processing stream:`,e)}},D=()=>{let[,e]=y(0);v(()=>(T={updateBoundary:(t,n)=>{b.set(t,n),e(e=>e+1)},updateRoot:()=>{e(e=>e+1)}},()=>{T=null}),[e]);let t=e=>{if(!e)return null;if(g(e)){let n=e.props,r=n?.[`~boundaryId`];if(n&&r){let e=b.get(r);if(e)return e}if(n&&n.children){let r=t(n.children);if(r!==n.children){let t={...n};return e.key!==null&&e.key!==void 0&&(t.key=e.key),h(e.type,t,r)}}return e}return Array.isArray(e)?e.map(e=>t(e)):e};return t(_)};E();let O=Promise.resolve(h(D));return{"~isRscResponse":!0,"~rscPromise":O,readRoot(){return O}}}buildRequestHeaders(){return{Accept:`text/x-component`,"Cache-Control":`no-cache, no-transform`}}async fetchWithTimeout(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),this.config.timeout);try{let i=await fetch(e,{...t,signal:n.signal});return clearTimeout(r),i}catch(e){throw clearTimeout(r),e}}async processRscResponse(e){if(await k(),E)try{let t=E(Promise.resolve(e));return{"~isRscResponse":!0,"~rscPromise":t,readRoot(){return t}}}catch{throw Error(`React Server DOM client not available`)}else throw Error(`React Server DOM client not available`)}async processRscResponseManually(e){let t=await e.text();return this.parseRscResponse(t)}parseRscResponse(e){let t=e.trim().split(a),n=new Map,r=new Map,i=new Map,o=[];for(let e of t){let t=e.indexOf(`:`);if(t===-1)continue;let a=e.substring(0,t),s=e.substring(t+1);if(s)try{let t=S(s);if(t)n.set(`$L${a}`,t);else if(s.startsWith(`E{`)){let e=s.substring(1),t=JSON.parse(e),n=t?.error??t?.message??JSON.stringify(t);o.push(n),console.error(`RSC: Server error`,n)}else if(s.startsWith(`[`)){let e=JSON.parse(s);r.set(a,e)}else if(s.startsWith(`Symbol.for(`))continue;else if(s.startsWith(`"$S`)){let e=JSON.parse(s);typeof e==`string`&&i.set(`$${a}`,e)}else console.error(`Unknown RSC row format:`,e)}catch(t){console.error(`Failed to parse RSC row:`,e,t)}}if(o.length>0)throw Error(`RSC Server Error: ${o.map(e=>e?.error??e?.message??e).join(`, `)}`);let s=null,c=Array.from(r.keys()).sort((e,t)=>Number.parseInt(e,16)-Number.parseInt(t,16));for(let e of c){let t=r.get(e);if(Array.isArray(t)&&t.length>=2&&t[0]===`$`){let[,e,,n]=t,r=n?.[`~boundaryId`],a=typeof e==`string`&&e.startsWith(`$`)?i.get(e):void 0;if((l(e)||l(a))&&n&&r)continue;s=t;break}}return s?this.reconstructElementFromRscData(s,n,i):(console.error(`No valid root element found in RSC payload`,{elements:r,modules:n}),null)}reconstructElementFromRscData(e,t,n){if(e==null)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e))if(e.length>=4&&e[0]===`$`){let[,r,i,a]=e,o=r;if(typeof r==`string`&&r.includes(`#`))o=w(r)||(({children:e,...t})=>h(`div`,{...t,"data-client-component":r,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},h(`small`,{style:{color:`#c00`}},`Missing Client Component: ${r}`),e));else if(typeof r==`string`&&r.startsWith(`$L`)&&t.has(r)){let e=t.get(r);e&&(o=w(`${e.id}#${e.name}`)||(({children:t,...n})=>h(`div`,{...n,"data-client-component":r,style:{border:`2px dashed #f00`,padding:`8px`,margin:`4px`,backgroundColor:`#fff0f0`}},h(`small`,{style:{color:`#c00`}},`Missing Client Component: ${e.name} (${e.id})`),t)))}let s=a?this.processPropsRecursively(a,t,n):{},c=typeof r==`string`&&r.startsWith(`$`)&&!r.startsWith(`$L`)?n?.get(r):void 0;return(l(r)||l(c))&&(o=p),h(o,{key:i,...s})}else return e.map(e=>this.reconstructElementFromRscData(e,t,n));return typeof e==`object`?null:e}processPropsRecursively(e,t,n){if(!e||typeof e!=`object`)return e;let r={};for(let[i,a]of Object.entries(e))if(i===`children`)if(Array.isArray(a))if(a.length>=2&&a[0]===`$`)r[i]=this.reconstructElementFromRscData(a,t,n);else{let e=a.map(e=>this.reconstructElementFromRscData(e,t,n)).filter(e=>e!=null);e.length===0?r[i]=null:e.length===1?r[i]=e[0]:r[i]=e}else r[i]=this.reconstructElementFromRscData(a,t,n);else i===`dangerouslySetInnerHTML`?r[i]=a:r[i]=this.reconstructElementFromRscData(a,t,n);return r}};function M({error:e,details:t}){return h(`div`,{className:`rsc-error`,style:{padding:`16px`,backgroundColor:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`,margin:`8px 0`,fontFamily:`monospace`}},h(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`}},`RSC Error`),h(`p`,{style:{margin:`0 0 8px 0`}},e),t&&h(`details`,{style:{marginTop:`8px`}},h(`summary`,{style:{cursor:`pointer`}},`Error Details`),h(`pre`,{style:{fontSize:`12px`,overflow:`auto`,backgroundColor:`#f5f5f5`,padding:`8px`}},JSON.stringify(t,null,2))))}function N({rootPromise:e}){return _(e)}function P({componentId:e,props:t,fallback:n}){let r=typeof window<`u`&&window[`~rari`]?.hmr?.refreshCounters?.[e]||0,i=`${e}:${JSON.stringify(t)}:hmr:${r}`;if(!A.has(i)){let n=j.fetchServerComponent(e,t).catch(e=>{throw A.delete(i),e});A.set(i,n)}let a=_(A.get(i));if(a?.[`~isRscResponse`]){let e=a.readRoot();return h(p,{fallback:n??null},h(N,{rootPromise:e}))}return a??null}var F=class extends f.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidUpdate(e){e.mountKey!==this.props.mountKey&&this.state.hasError&&this.setState({hasError:!1,error:null})}componentDidCatch(e,t){console.error(`[rari] ServerComponentErrorBoundary: Error in component ${this.props.componentId}:`,e,t)}render(){return this.state.hasError?h(M,{error:this.state.error?.message||`Unknown error`,details:{componentId:this.props.componentId}}):this.props.children}};function I(e){let t=0;if(typeof window<`u`){let n=window;n[`~rari`].hmr||(n[`~rari`].hmr={refreshCounters:{}}),n[`~rari`].hmr.refreshCounters[e]===void 0&&(n[`~rari`].hmr.refreshCounters[e]=0),t=n[`~rari`].hmr.refreshCounters[e]}let n=n=>{let[r,i]=y(t);return v(()=>{let t=t=>{let n=t.detail;if(n&&n.filePath&&R(n.filePath)&&(j.clearCache(),typeof window<`u`)){let t=window;t[`~rari`].hmr||(t[`~rari`].hmr={refreshCounters:{}}),t[`~rari`].hmr.refreshCounters[e]=(t[`~rari`].hmr.refreshCounters[e]||0)+1,i(t[`~rari`].hmr.refreshCounters[e])}};return typeof window<`u`&&window.addEventListener(`rari:rsc-invalidate`,t),()=>{typeof window<`u`&&window.removeEventListener(`rari:rsc-invalidate`,t)}},[]),h(p,{fallback:null},h(F,{componentId:e,mountKey:r},h(P,{key:`${e}-${r}`,componentId:e,props:n,fallback:null})))};return n.displayName=`ServerComponent(${e})`,function(e){return h(n,e)}}function L(e,t){return j.fetchServerComponent(e,t)}function R(e){if(!e)return!1;try{return typeof globalThis<`u`&&globalThis[`~rari`].serverComponents?globalThis[`~rari`].serverComponents.has(e):!1}catch(e){return console.error(`Error checking if file is server component:`,e),!1}}if(import.meta.hot){let e=!1,t=[],n=new Map;function r(r,i){n.set(r,i),import.meta.hot.on(r,async n=>{if(!e){t.push({event:r,data:n});return}try{await i(n)}catch(e){console.error(`[rari] HMR: Error in handler for '${r}':`,e)}})}r(`rari:register-server-component`,e=>{e?.filePath&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,globalThis[`~rari`].serverComponents.add(e.filePath))}),r(`rari:server-components-registry`,e=>{e?.serverComponents&&Array.isArray(e.serverComponents)&&typeof globalThis<`u`&&(globalThis[`~rari`].serverComponents=globalThis[`~rari`].serverComponents||new Set,e.serverComponents.forEach(e=>{globalThis[`~rari`].serverComponents?.add(e)}))}),r(`vite:beforeFullReload`,async e=>{e?.path&&R(e.path)&&await u({filePath:e.path,forceReload:!0})}),r(`rari:server-component-updated`,async e=>{let t=e?.id||e?.componentId,n=e?.t||e?.timestamp;if(t){if(typeof window<`u`){let r=new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:t,filePath:e.filePath||e.file,type:`server-component`,timestamp:n}});window.dispatchEvent(r)}}else e?.path&&R(e.path)&&await u({filePath:e.path,forceReload:!1})}),r(`rari:app-router-updated`,async e=>{try{if(!e||!e.routePath&&(!e.affectedRoutes||e.affectedRoutes.length===0))return;await i(e)}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}}),r(`rari:server-action-updated`,async e=>{if(e?.filePath&&(j.clearCache(),typeof window<`u`)){let t=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}});window.dispatchEvent(t)}});async function i(e){let t=e.fileType,n=e.filePath,r=e.routePath,i=e.affectedRoutes,o=e.manifestUpdated,u=e.metadata;e.metadataChanged&&u&&a(u);try{let e=`${x()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:n})});if(!t.ok){let e=await t.text(),n=`Component reload failed with status ${t.status}: ${e}`;throw console.error(`[rari] HMR:`,n),Error(n)}let r=await t.json();if(typeof r!=`object`||!r){let e=`Invalid reload response: null or non-object`;throw console.error(`[rari] HMR:`,e,r),Error(e)}if(r.success!==!0&&r.reloaded!==!0){let e=`Component reload unsuccessful: ${r.error||`unknown error`}`;throw console.error(`[rari] HMR:`,e,r),Error(e)}}catch(e){console.error(`[rari] HMR: Failed to reload component:`,e);return}let d=[r];switch(t){case`page`:d=[r];break;case`layout`:case`loading`:case`error`:case`not-found`:d=i;break;default:break}await s({routes:d,fileType:t,filePath:n,componentId:r}),o&&await l(),await c({routePath:r,affectedRoutes:i})}function a(e){if(!(typeof document>`u`)&&(e.title&&(document.title=e.title),e.description)){let t=document.querySelector(`meta[name="description"]`);t||(t=document.createElement(`meta`),t.setAttribute(`name`,`description`),document.head.appendChild(t)),t.setAttribute(`content`,e.description)}}function o(e){if(!e||e.length===0){j.clearCache();return}let t=[];for(let n of j.componentCache.keys())for(let r of e){if(n.includes(`route:${r}:`)||n.startsWith(`${r}:`)){t.push(n);break}if(r!==`/`&&n.includes(`route:${r}/`)){t.push(n);break}}for(let e of t)j.componentCache.delete(e),A.delete(e);let n=[];for(let t of A.keys())for(let r of e){if(t.includes(`route:${r}:`)||t.startsWith(`${r}:`)){n.push(t);break}if(r!==`/`&&t.includes(`route:${r}/`)){n.push(t);break}}for(let e of n)A.delete(e)}async function s(e){let t=e.routes||[],n=e.fileType,r=e.filePath,i=e.componentId;if(i||r)try{let e=`${x()}/_rari/hmr`,t=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:i||r,filePath:r})}),n=await t.text();t.ok||console.error(`[rari] HMR: Server cache invalidation failed:`,t.status,n)}catch(e){console.error(`[rari] HMR: Failed to call server invalidation endpoint:`,e)}if(o(t),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{routes:t,fileType:n}});window.dispatchEvent(e)}}async function c(e){let t=e.routePath,n=e.affectedRoutes||[t];if(!(typeof window>`u`))try{let e=window.location.pathname,r=new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:t,affectedRoutes:n,currentPath:e,preserveParams:!0}});window.dispatchEvent(r)}catch(e){throw console.error(`[rari] HMR: Failed to trigger re-render:`,e),e}}async function l(){typeof window<`u`&&window[`~rari`]?.routeInfoCache&&window[`~rari`].routeInfoCache.clear()}async function u(e){let t=e?.filePath||e;if(j.clearCache(),typeof window<`u`){let e=new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:t}});window.dispatchEvent(e)}}t.length>0?(async()=>{try{for(;t.length>0;){let e=[...t];t.length=0;for(let{event:t,data:r}of e){let e=n.get(t);if(e)try{await e(r)}catch(e){console.error(`[rari] HMR: Error replaying buffered event '${t}':`,e)}}}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{e=!0}})():e=!0}var z=class{overlay;currentError;escapeKeyHandler;constructor(){this.overlay=null,this.currentError=null,this.escapeKeyHandler=null}show(e){this.currentError=e,this.overlay?this.updateOverlay(e):this.createOverlay(e)}hide(){this.overlay&&(this.overlay.remove(),this.overlay=null,this.currentError=null),this.escapeKeyHandler&&=(document.removeEventListener(`keydown`,this.escapeKeyHandler),null)}isVisible(){return this.overlay!==null}createOverlay(e){this.overlay=document.createElement(`div`),this.overlay.id=`rari-hmr-error-overlay`,this.updateOverlay(e),document.body.appendChild(this.overlay),this.escapeKeyHandler=e=>{e.key===`Escape`&&this.hide()},document.addEventListener(`keydown`,this.escapeKeyHandler)}updateOverlay(e){if(!this.overlay)return;this.overlay.replaceChildren();let t=document.createElement(`div`);t.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 2rem; backdrop-filter: blur(4px);`;let n=document.createElement(`div`);n.style.cssText=`background: #1e1e1e; color: #e0e0e0; border-radius: 0.5rem; padding: 2rem; max-width: 50rem; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4); border: 1px solid #ef4444;`;let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;`;let i=document.createElement(`div`);i.style.cssText=`display: flex; align-items: center; gap: 0.75rem;`;let a=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);a.style.cssText=`width: 2rem; height: 2rem; color: #ef4444;`,a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,`currentColor`),a.setAttribute(`viewBox`,`0 0 24 24`);let o=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);o.setAttribute(`stroke-linecap`,`round`),o.setAttribute(`stroke-linejoin`,`round`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`d`,`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`),a.appendChild(o);let s=document.createElement(`h1`);s.style.cssText=`margin: 0; font-size: 1.5rem; font-weight: 700; color: #ef4444;`,s.textContent=`Build Error`,i.appendChild(a),i.appendChild(s);let c=document.createElement(`button`);if(c.style.cssText=`background: transparent; border: none; color: #9ca3af; cursor: pointer; padding: 0.5rem; border-radius: 0.25rem; transition: all 0.2s; font-size: 1.5rem; line-height: 1; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;`,c.textContent=`×`,c.setAttribute(`aria-label`,`Close overlay`),c.onclick=()=>this.hide(),c.onmouseover=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onmouseout=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},c.onfocus=()=>{c.style.background=`rgba(255,255,255,0.1)`,c.style.color=`#e0e0e0`},c.onblur=()=>{c.style.background=`transparent`,c.style.color=`#9ca3af`},r.appendChild(i),r.appendChild(c),n.appendChild(r),e.filePath){let t=document.createElement(`div`);t.style.cssText=`margin-bottom: 1rem; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; font-family: monospace; font-size: 0.875rem;`;let r=document.createElement(`strong`);r.textContent=`File: `,t.appendChild(r),t.appendChild(document.createTextNode(e.filePath)),n.appendChild(t)}let l=document.createElement(`div`);l.style.cssText=`margin-bottom: 1.5rem;`;let u=document.createElement(`h2`);u.style.cssText=`margin: 0 0 0.75rem 0; font-size: 1rem; font-weight: 600; color: #fca5a5;`,u.textContent=`Error Message:`;let d=document.createElement(`pre`);if(d.style.cssText=`margin: 0; padding: 1rem; background: rgba(239, 68, 68, 0.1); border-left: 4px solid #ef4444; border-radius: 0.375rem; overflow-x: auto; font-family: monospace; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #fca5a5;`,d.textContent=e.message??`An error occurred`,l.appendChild(u),l.appendChild(d),n.appendChild(l),e.stack){let t=document.createElement(`details`);t.style.cssText=`margin-top: 1rem; cursor: pointer;`;let r=document.createElement(`summary`);r.style.cssText=`font-weight: 600; margin-bottom: 0.5rem; user-select: none;`,r.textContent=`Stack Trace`;let i=document.createElement(`pre`);i.style.cssText=`margin: 0; padding: 0.75rem; background: rgba(0, 0, 0, 0.2); border-radius: 0.375rem; overflow-x: auto; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;`,i.textContent=e.stack,t.appendChild(r),t.appendChild(i),n.appendChild(t)}let f=document.createElement(`div`);f.style.cssText=`margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #374151; display: flex; gap: 0.75rem; align-items: center;`;let p=document.createElement(`button`);p.style.cssText=`padding: 0.625rem 1.25rem; background: #ef4444; color: white; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,p.textContent=`Reload Page`,p.onclick=()=>window.location.reload(),p.onmouseover=()=>{p.style.background=`#dc2626`},p.onmouseout=()=>{p.style.background=`#ef4444`},p.onfocus=()=>{p.style.background=`#dc2626`},p.onblur=()=>{p.style.background=`#ef4444`};let m=document.createElement(`button`);m.style.cssText=`padding: 0.625rem 1.25rem; background: #374151; color: #e0e0e0; border: none; border-radius: 0.375rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; transition: all 0.2s;`,m.textContent=`Dismiss`,m.onclick=()=>this.hide(),m.onmouseover=()=>{m.style.background=`#4b5563`},m.onmouseout=()=>{m.style.background=`#374151`},m.onfocus=()=>{m.style.background=`#4b5563`},m.onblur=()=>{m.style.background=`#374151`};let h=document.createElement(`span`);h.style.cssText=`margin-left: auto; font-size: 0.75rem; color: #9ca3af;`;let g=new Date(e.timestamp);h.textContent=Number.isNaN(g.valueOf())?``:g.toLocaleTimeString(),f.appendChild(p),f.appendChild(m),f.appendChild(h),n.appendChild(f),t.appendChild(n),this.overlay.appendChild(t)}};let B=null;function V(){return B||=new z,B}if(import.meta.hot){let e=V();import.meta.hot.on(`rari:hmr-error`,t=>{let n=t.msg||t.message,r=t.file||t.filePath,i=t.t||t.timestamp,a=t.count||t.errorCount,o=t.max||t.maxErrors;console.error(`[rari] HMR: Build error:`,n),r&&console.error(`[rari] HMR: File:`,r),t.stack&&console.error(`[rari] HMR: Stack:`,t.stack),e.show({message:n,stack:t.stack,filePath:r,timestamp:i}),a&&o&&(a>=o?console.error(`[rari] HMR: Maximum error count (${o}) reached. Consider restarting the dev server if issues persist.`):a>=o-2&&console.warn(`[rari] HMR: Error count: ${a}/${o}. Approaching maximum error threshold.`))}),import.meta.hot.on(`rari:hmr-error-cleared`,()=>{e.hide()}),import.meta.hot.on(`vite:error`,t=>{e.show({message:t.err?.message||`Unknown Vite error`,stack:t.err?.stack,filePath:t.err?.file,timestamp:Date.now()})})}export{M as RscErrorComponent,T as createClientModuleMap,I as createServerComponentWrapper,L as fetchServerComponent,w as getClientComponent,C as registerClientComponent,j as rscClient};
@@ -1,2 +1,2 @@
1
- import{createStringDecoder as e,preloadModule as t,readFinalStringChunk as n,readPartialStringChunk as r,requireModule as i,resolveClientReference as a}from"./ReactFlightClientConfig.mjs";const o=Symbol.for(`react.transitional.element`)||Symbol.for(`react.element`),s=Symbol.for(`react.lazy`),c=`pending`,l=`blocked`,u=`resolved_model`,d=`resolved_module`,f=`fulfilled`,p=`rejected`;function m(e,t,n){this.status=e,this.value=t,this.reason=n}m.prototype=Object.create(Promise.prototype),m.prototype.then=function(e,t){let n=this;switch(n.status){case u:A(n);break;case d:j(n);break}switch(n.status){case f:e&&e(n.value);break;case c:case l:if(e){if(n.value===null&&(n.value=[]),!Array.isArray(n.value)){e(n.value);break}n.value.push(e)}if(t){if(n.reason===null&&(n.reason=[]),!Array.isArray(n.reason))break;n.reason.push(t)}break;default:t&&t(n.reason);break}};function h(e){switch(e.status){case u:A(e);break;case d:j(e);break}switch(e.status){case f:return e.value;case c:case l:throw e;default:throw Error(String(e.reason))}}function g(e){return N(e,0)}function _(){return new m(c,null,null)}function v(){return new m(l,null,null)}function y(e){return new m(p,null,e)}function b(e,t){for(let n=0;n<e.length;n++){let r=e[n];typeof r==`function`&&r(t)}}function x(e,t,n){switch(e.status){case f:b(t,e.value);break;case c:case l:if(e.value!==null&&!Array.isArray(e.value)){e.value=t;break}if(e.value)for(let n=0;n<t.length;n++)e.value.push(t[n]);else e.value=t;if(e.reason!==null&&!Array.isArray(e.reason)){e.reason=n;break}if(e.reason){if(n)for(let t=0;t<n.length;t++)e.reason.push(n[t])}else e.reason=n;break;case p:n&&b(n,e.reason);break}}function S(e,t){if(e.status!==c&&e.status!==l)return;let n=e.reason,r=e;if(r.status=p,r.reason=t,n!==null)for(let e=0;e<n.length;e++)n[e](t)}function C(e,t){return new m(u,t,e)}function w(e){return new m(d,e,null)}function T(e){return new m(f,e,null)}function E(e,t,n){if(t.status!==c&&t.status!==l)return;let r=Array.isArray(t.value)?t.value:null,i=Array.isArray(t.reason)?t.reason:null,a=t;a.status=u,a.value=n,a.reason=e,A(a),r!==null&&x(t,r,i)}function D(e,t,n){if(t.status!==c&&t.status!==l&&t.status!==p)return;let r=Array.isArray(t.value)?t.value:null,i=Array.isArray(t.reason)?t.reason:null,a=t;a.status=d,a.value=n,a.reason=null,j(a),r!==null&&x(t,r,i)}let O=null,k=null;function A(e){let t=O,n=k;O=null,k=null;let r=e.value,i=e.reason,a=e;a.status=l,a.value=null,a.reason=null,O=a;try{let t=V(i,r);if(k!==null){let e=k;if(e.errored)throw e.reason;if(e.deps>0){e.value=t,e.chunk=a;return}}let n=e;n.status=f,n.value=t,n.reason=null}catch(t){let n=e;n.status=p,n.reason=t}finally{O=t,k=n}}function j(e){try{let t=i(e.value),n=e;n.status=f,n.value=t,n.reason=null}catch(t){let n=e;n.status=p,n.reason=t}}function M(e,t){e._closed=!0,e._closedReason=t,e._chunks.forEach(e=>{e.status===c&&S(e,t)})}function N(e,t){let n=e._chunks,r=n.get(t);return r||(r=e._closed?y(e._closedReason):_(),n.set(t,r)),r}function P(e,t,n,r){r??={};let i={$$typeof:o,type:t,key:n,ref:null,props:r};if(k!==null){let e=k;if(k=e.parent,e.errored)return F(y(e.reason));if(e.deps>0){let t=v();return e.value=i,e.chunk=t,F(t)}}return i}function F(e){return{$$typeof:s,_payload:e,_init:h}}function I(e,t,n,r,i){let a=t.split(`:`),o=N(e,Number.parseInt(a[0],16));switch(o.status){case u:A(o);break;case d:j(o);break}switch(o.status){case f:{let e=o.value;for(let t=1;t<a.length;t++)e=e[a[t]];return i(e)}case c:case l:return F(o);default:return k?(k.errored=!0,k.reason=o.reason):k={parent:null,chunk:null,value:null,deps:0,errored:!0,reason:o.reason},null}}function L(e){return e}function R(e,t,n,r){if(r[0]===`$`){if(r===`$`)return k!==null&&n===`0`&&(k={parent:k,chunk:null,value:null,deps:0,errored:!1,reason:null}),o;switch(r[1]){case`$`:return r.slice(1);case`L`:return F(N(e,Number.parseInt(r.slice(2),16)));case`@`:return N(e,Number.parseInt(r.slice(2),16));case`S`:return Symbol.for(r.slice(2));case`F`:return I(e,r.slice(2),t,n,t=>W(e,t));case`Q`:return I(e,r.slice(2),t,n,H);case`W`:return I(e,r.slice(2),t,n,U);case`I`:return 1/0;case`-`:return r===`$-0`?-0:-1/0;case`N`:return NaN;case`u`:return;case`D`:return new Date(Date.parse(r.slice(2)));case`n`:return BigInt(r.slice(2));default:return I(e,r.slice(1),t,n,L)}}return r}function z(e,t){let n=t;return n[0]===o?P(e,n[1],n[2],n[3]):t}function B(e,t,n,r){if(typeof t==`string`)return t[0]===`$`?R(e,n,r,t):t;if(typeof t!=`object`||!t)return t;if(Array.isArray(t)){for(let n=0;n<t.length;n++)t[n]=B(e,t[n],t,`${n}`);return t[0]===o?z(e,t):t}for(let n in t)if(n===`__proto__`)delete t[n];else{let r=B(e,t[n],t,n);r===void 0?delete t[n]:t[n]=r}return t}function V(e,t){let n=JSON.parse(t);return B(e,n,{"":n},``)}function H(e){return new Map(e)}function U(e){return new Set(e)}function W(e,t){let n=e._callServer,r=t.id;return function(...e){return n(r,e)}}function G(){throw Error(`Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.`)}function K(t,n){let r=new Map;this._bundlerConfig=t,this._callServer=n===void 0?G:n,this._chunks=r,this._stringDecoder=e(),this._closed=!1,this._closedReason=null}function q(e,t){return new K(e,t)}function J(){return{_rowState:0,_rowID:0,_rowTag:0,_rowLength:0,_buffer:[]}}function Y(e,t,n){let r=e._chunks,i=r.get(t);i?E(e,i,n):r.set(t,C(e,n))}function X(e,t,n){e._chunks.set(t,T(n))}function Z(e,n,r){let i=e._chunks,o=i.get(n),s=a(V(e,r)),c=t(s);if(c){let t;o?(t=o,t.status=l):(t=v(),i.set(n,t)),c.then(()=>D(e,t,s),e=>S(t,e))}else o?D(e,o,s):i.set(n,w(s))}function Q(e,t,n){let r=Error(`An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.`);r.digest=n;let i=e._chunks,a=i.get(t);a?S(a,r):i.set(t,y(r))}function $(e,t,n,r){switch(n){case 73:Z(e,t,r);return;case 69:Q(e,t,JSON.parse(r).digest);return;case 84:X(e,t,r);return;default:Y(e,t,r)}}function ee(e,t,i){let a=0,o=t._rowState,s=t._rowID,c=t._rowTag,l=t._rowLength,u=t._buffer,d=i.length;for(;a<d;){let t=-1;switch(o){case 0:{let e=i[a++];e===58?o=1:s=s<<4|(e>96?e-87:e-48);continue}case 1:{let e=i[a];e===84||e>64&&e<91?(c=e,o=3,a++):(c=0,o=3);continue}case 3:t=i.indexOf(10,a);break}let d=i.byteOffset+a;if(t>-1){let f=t-a,p=new Uint8Array(i.buffer,d,f),m=e._stringDecoder,h=``;for(let e=0;e<u.length;e++)h+=r(m,u[e]);h+=n(m,p),$(e,s,c,h),a=t,o===3&&a++,o=0,c=0,s=0,l=0,u.length=0}else{let e=i.byteLength-a,t=new Uint8Array(i.buffer,d,e);u.push(t),l-=t.byteLength;break}}t._rowState=o,t._rowID=s,t._rowTag=c,t._rowLength=l}function te(e,t,n){let r=0,i=t._rowState,a=t._rowID,o=t._rowTag,s=n.length;for(;r<s;){let t=-1;switch(i){case 0:{let e=n.charCodeAt(r++);e===58?i=1:a=a<<4|(e>96?e-87:e-48);continue}case 1:{let e=n.charCodeAt(r);e===84||e>64&&e<91?(o=e,i=3,r++):(o=0,i=3);continue}case 3:t=n.indexOf(`
2
- `,r);break}if(t>-1){let s=n.slice(r,t);$(e,a,o,s),r=t,i===3&&r++,i=0,o=0,a=0}else break}t._rowState=i,t._rowID=a,t._rowTag=o}function ne(e){e._closed=!0,e._chunks.forEach(e=>{e.status===c&&S(e,Error(`Connection closed.`))})}export{ne as close,q as createResponse,J as createStreamState,g as getRoot,ee as processBinaryChunk,te as processStringChunk,M as reportGlobalError};
1
+ import{t as e}from"../../../suspense-CsIYuC_l.mjs";import{createStringDecoder as t,preloadModule as n,readFinalStringChunk as r,readPartialStringChunk as i,requireModule as a,resolveClientReference as o}from"./ReactFlightClientConfig.mjs";const s=Symbol.for(`react.transitional.element`)||Symbol.for(`react.element`),c=Symbol.for(`react.lazy`),l=`pending`,u=`blocked`,d=`resolved_model`,f=`resolved_module`,p=`fulfilled`,m=`rejected`;function h(e,t,n){this.status=e,this.value=t,this.reason=n}h.prototype=Object.create(Promise.prototype),h.prototype.then=function(e,t){let n=this;switch(n.status){case d:j(n);break;case f:M(n);break}switch(n.status){case p:e&&e(n.value);break;case l:case u:if(e){if(n.value===null&&(n.value=[]),!Array.isArray(n.value)){e(n.value);break}n.value.push(e)}if(t){if(n.reason===null&&(n.reason=[]),!Array.isArray(n.reason))break;n.reason.push(t)}break;default:t&&t(n.reason);break}};function g(e){switch(e.status){case d:j(e);break;case f:M(e);break}switch(e.status){case p:return e.value;case l:case u:throw e;default:throw Error(String(e.reason))}}function _(e){return P(e,0)}function v(){return new h(l,null,null)}function y(){return new h(u,null,null)}function b(e){return new h(m,null,e)}function x(e,t){for(let n=0;n<e.length;n++){let r=e[n];typeof r==`function`&&r(t)}}function S(e,t,n){switch(e.status){case p:x(t,e.value);break;case l:case u:if(e.value!==null&&!Array.isArray(e.value)){e.value=t;break}if(e.value)for(let n=0;n<t.length;n++)e.value.push(t[n]);else e.value=t;if(e.reason!==null&&!Array.isArray(e.reason)){e.reason=n;break}if(e.reason){if(n)for(let t=0;t<n.length;t++)e.reason.push(n[t])}else e.reason=n;break;case m:n&&x(n,e.reason);break}}function C(e,t){if(e.status!==l&&e.status!==u)return;let n=e.reason,r=e;if(r.status=m,r.reason=t,n!==null)for(let e=0;e<n.length;e++)n[e](t)}function w(e,t){return new h(d,t,e)}function T(e){return new h(f,e,null)}function E(e){return new h(p,e,null)}function D(e,t,n){if(t.status!==l&&t.status!==u)return;let r=Array.isArray(t.value)?t.value:null,i=Array.isArray(t.reason)?t.reason:null,a=t;a.status=d,a.value=n,a.reason=e,j(a),r!==null&&S(t,r,i)}function O(e,t,n){if(t.status!==l&&t.status!==u&&t.status!==m)return;let r=Array.isArray(t.value)?t.value:null,i=Array.isArray(t.reason)?t.reason:null,a=t;a.status=f,a.value=n,a.reason=null,M(a),r!==null&&S(t,r,i)}let k=null,A=null;function j(e){let t=k,n=A;k=null,A=null;let r=e.value,i=e.reason,a=e;a.status=u,a.value=null,a.reason=null,k=a;try{let t=H(i,r);if(A!==null){let e=A;if(e.errored)throw e.reason;if(e.deps>0){e.value=t,e.chunk=a;return}}let n=e;n.status=p,n.value=t,n.reason=null}catch(t){let n=e;n.status=m,n.reason=t}finally{k=t,A=n}}function M(e){try{let t=a(e.value),n=e;n.status=p,n.value=t,n.reason=null}catch(t){let n=e;n.status=m,n.reason=t}}function N(e,t){e._closed=!0,e._closedReason=t,e._chunks.forEach(e=>{e.status===l&&C(e,t)})}function P(e,t){let n=e._chunks,r=n.get(t);return r||(r=e._closed?b(e._closedReason):v(),n.set(t,r)),r}function F(t,n,r,i){i??={},e(n)&&(n=Symbol.for(`react.suspense`));let a={$$typeof:s,type:n,key:r,ref:null,props:i};if(A!==null){let e=A;if(A=e.parent,e.errored)return I(b(e.reason));if(e.deps>0){let t=y();return e.value=a,e.chunk=t,I(t)}}return a}function I(e){return{$$typeof:c,_payload:e,_init:g}}function L(e,t,n,r,i){let a=t.split(`:`),o=P(e,Number.parseInt(a[0],16));switch(o.status){case d:j(o);break;case f:M(o);break}switch(o.status){case p:{let e=o.value;for(let t=1;t<a.length;t++)e=e[a[t]];return i(e)}case l:case u:return I(o);default:return A?(A.errored=!0,A.reason=o.reason):A={parent:null,chunk:null,value:null,deps:0,errored:!0,reason:o.reason},null}}function R(e){return e}function z(e,t,n,r){if(r[0]===`$`){if(r===`$`)return A!==null&&n===`0`&&(A={parent:A,chunk:null,value:null,deps:0,errored:!1,reason:null}),s;switch(r[1]){case`$`:return r.slice(1);case`L`:return I(P(e,Number.parseInt(r.slice(2),16)));case`@`:return P(e,Number.parseInt(r.slice(2),16));case`S`:return Symbol.for(r.slice(2));case`F`:return L(e,r.slice(2),t,n,t=>G(e,t));case`Q`:return L(e,r.slice(2),t,n,U);case`W`:return L(e,r.slice(2),t,n,W);case`I`:return 1/0;case`-`:return r===`$-0`?-0:-1/0;case`N`:return NaN;case`u`:return;case`D`:return new Date(Date.parse(r.slice(2)));case`n`:return BigInt(r.slice(2));default:return L(e,r.slice(1),t,n,R)}}return r}function B(e,t){let n=t;return n[0]===s?F(e,n[1],n[2],n[3]):t}function V(e,t,n,r){if(typeof t==`string`)return t[0]===`$`?z(e,n,r,t):t;if(typeof t!=`object`||!t)return t;if(Array.isArray(t)){for(let n=0;n<t.length;n++)t[n]=V(e,t[n],t,`${n}`);return t[0]===s?B(e,t):t}for(let n in t)if(n===`__proto__`)delete t[n];else{let r=V(e,t[n],t,n);r===void 0?delete t[n]:t[n]=r}return t}function H(e,t){let n=JSON.parse(t);return V(e,n,{"":n},``)}function U(e){return new Map(e)}function W(e){return new Set(e)}function G(e,t){let n=e._callServer,r=t.id;return function(...e){return n(r,e)}}function K(){throw Error(`Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.`)}function q(e,n){let r=new Map;this._bundlerConfig=e,this._callServer=n===void 0?K:n,this._chunks=r,this._stringDecoder=t(),this._closed=!1,this._closedReason=null}function J(e,t){return new q(e,t)}function Y(){return{_rowState:0,_rowID:0,_rowTag:0,_rowLength:0,_buffer:[]}}function X(e,t,n){let r=e._chunks,i=r.get(t);i?D(e,i,n):r.set(t,w(e,n))}function Z(e,t,n){e._chunks.set(t,E(n))}function Q(e,t,r){let i=e._chunks,a=i.get(t),s=o(H(e,r)),c=n(s);if(c){let n;a?(n=a,n.status=u):(n=y(),i.set(t,n)),c.then(()=>O(e,n,s),e=>C(n,e))}else a?O(e,a,s):i.set(t,T(s))}function ee(e,t,n){let r=Error(`An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.`);r.digest=n;let i=e._chunks,a=i.get(t);a?C(a,r):i.set(t,b(r))}function $(e,t,n,r){switch(n){case 73:Q(e,t,r);return;case 69:ee(e,t,JSON.parse(r).digest);return;case 84:Z(e,t,r);return;default:X(e,t,r)}}function te(e,t,n){let a=0,o=t._rowState,s=t._rowID,c=t._rowTag,l=t._rowLength,u=t._buffer,d=n.length;for(;a<d;){let t=-1;switch(o){case 0:{let e=n[a++];e===58?o=1:s=s<<4|(e>96?e-87:e-48);continue}case 1:{let e=n[a];e===84||e>64&&e<91?(c=e,o=3,a++):(c=0,o=3);continue}case 3:t=n.indexOf(10,a);break}let d=n.byteOffset+a;if(t>-1){let f=t-a,p=new Uint8Array(n.buffer,d,f),m=e._stringDecoder,h=``;for(let e=0;e<u.length;e++)h+=i(m,u[e]);h+=r(m,p),$(e,s,c,h),a=t,o===3&&a++,o=0,c=0,s=0,l=0,u.length=0}else{let e=n.byteLength-a,t=new Uint8Array(n.buffer,d,e);u.push(t),l-=t.byteLength;break}}t._rowState=o,t._rowID=s,t._rowTag=c,t._rowLength=l}function ne(e,t,n){let r=0,i=t._rowState,a=t._rowID,o=t._rowTag,s=n.length;for(;r<s;){let t=-1;switch(i){case 0:{let e=n.charCodeAt(r++);e===58?i=1:a=a<<4|(e>96?e-87:e-48);continue}case 1:{let e=n.charCodeAt(r);e===84||e>64&&e<91?(o=e,i=3,r++):(o=0,i=3);continue}case 3:t=n.indexOf(`
2
+ `,r);break}if(t>-1){let s=n.slice(r,t);$(e,a,o,s),r=t,i===3&&r++,i=0,o=0,a=0}else break}t._rowState=i,t._rowID=a,t._rowTag=o}function re(e){e._closed=!0,e._chunks.forEach(e=>{e.status===l&&C(e,Error(`Connection closed.`))})}export{re as close,J as createResponse,Y as createStreamState,_ as getRoot,te as processBinaryChunk,ne as processStringChunk,N as reportGlobalError};
@@ -0,0 +1 @@
1
+ const e=[`$Sreact.suspense`,`react.suspense`,`suspense`,`Suspense`];function t(t){return typeof t==`string`&&e.includes(t)}export{t};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rari",
3
3
  "type": "module",
4
- "version": "0.14.2",
4
+ "version": "0.14.3",
5
5
  "description": "Runtime Accelerated Rendering Infrastructure (rari)",
6
6
  "author": "Ryan Skinner",
7
7
  "license": "MIT",
@@ -110,19 +110,19 @@
110
110
  "rolldown": "^1.0.3"
111
111
  },
112
112
  "optionalDependencies": {
113
- "rari-darwin-arm64": "0.14.2",
114
- "rari-darwin-x64": "0.14.2",
115
- "rari-linux-arm64": "0.14.2",
116
- "rari-linux-x64": "0.14.2",
117
- "rari-win32-arm64": "0.14.2",
118
- "rari-win32-x64": "0.14.2"
113
+ "rari-darwin-arm64": "0.14.3",
114
+ "rari-darwin-x64": "0.14.3",
115
+ "rari-linux-arm64": "0.14.3",
116
+ "rari-linux-x64": "0.14.3",
117
+ "rari-win32-arm64": "0.14.3",
118
+ "rari-win32-x64": "0.14.3"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@types/node": "^25.9.1",
122
- "@types/react": "^19.2.15",
122
+ "@types/react": "^19.2.16",
123
123
  "@types/react-dom": "^19.2.3",
124
- "@typescript/native-preview": "^7.0.0-dev.20260527.2",
125
- "vite-plus": "^0.1.23",
124
+ "@typescript/native-preview": "^7.0.0-dev.20260601.1",
125
+ "vite-plus": "^0.1.24",
126
126
  "@rari/deploy": "0.1.0",
127
127
  "@rari/logger": "0.1.0"
128
128
  },