rari 0.10.19 → 0.10.20
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 +3 -3
- package/dist/client.d.mts +2 -2
- package/dist/client.mjs +3 -3
- package/dist/get-client-component-YrjzU6RI.mjs +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/proxy/RariRequest.d.mts +1 -1
- package/dist/proxy/RariResponse.d.mts +1 -1
- package/dist/proxy/runtime-executor.d.mts +6 -4
- package/dist/proxy/runtime-executor.mjs +1 -1
- package/dist/railway-2u_Vq-71.mjs +67 -0
- package/dist/render-jhijat1L.mjs +73 -0
- package/dist/robots-generator-Bw9KFHn4.mjs +2 -0
- package/dist/runtime/AppRouterProvider.mjs +1 -1
- package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
- package/dist/runtime/entry-client.mjs +1 -1
- package/dist/runtime/react-server-dom-rari-client.mjs +1 -1
- package/dist/runtime/rsc-client-runtime.mjs +1 -1
- package/dist/runtime-client-yoJmu7vX.mjs +6 -0
- package/dist/server-build-BUnvC6Er.mjs +175 -0
- package/dist/{server-config-x5pDgs13.d.mts → server-config-Cf6g4PHZ.d.mts} +1 -0
- package/dist/sitemap-generator-CzZZcCF6.mjs +7 -0
- package/dist/timer-utils-BO5HIsHv.mjs +1 -0
- package/dist/utils-BGFxUpBh-CWvq2hOR.mjs +37 -0
- package/dist/vite.d.mts +4 -4
- package/dist/vite.mjs +16 -16
- package/package.json +9 -9
- package/dist/get-client-component-DOrK5M2i.mjs +0 -1
- package/dist/railway-wWoxBe94.mjs +0 -102
- package/dist/render-BD1SX5GJ.mjs +0 -108
- package/dist/robots-generator-CDQtL299.mjs +0 -2
- package/dist/runtime-client-C80F166Y.mjs +0 -6
- package/dist/server-build-C6FM1GI2.mjs +0 -175
- package/dist/sitemap-generator-CJ-3AADp.mjs +0 -4
- package/dist/utils-dqnEOG_U-BFRRjfIS.mjs +0 -1
- /package/dist/{metadata-route-D44UGnHc.d.mts → metadata-route-BDdxZuGv.d.mts} +0 -0
- /package/dist/{preload-components-RB1K2A_B.mjs → preload-components-DD3aKUwy.mjs} +0 -0
- /package/dist/{types-C-syXDfX.d.mts → types-BhqnAV4k.d.mts} +0 -0
- /package/dist/{types-B9Cjrsqs.d.mts → types-Cfe0C3JU.d.mts} +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{getBinaryPath as e,getInstallationInstructions as t}from"./platform.mjs";import{existsSync as n,readFileSync as r,realpathSync as i}from"node:fs";import{resolve as a}from"node:path";import o from"node:process";import{spawn as s}from"node:child_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(){let e=a(o.cwd(),`.env`);if(n(e))
|
|
3
|
-
`)){let t=e
|
|
2
|
+
import{getBinaryPath as e,getInstallationInstructions as t}from"./platform.mjs";import{existsSync as n,readFileSync as r,realpathSync as i}from"node:fs";import{resolve as a}from"node:path";import o from"node:process";import{spawn as s}from"node:child_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=a(o.cwd(),`.env`);if(!n(e))return;let t=r(e,`utf-8`);for(let e of t.split(`
|
|
3
|
+
`)){let t=h(e);t&&!o.env[t.key]&&(o.env[t.key]=t.value)}}g();const[,,_,...v]=o.argv;function y(e){return n(a(e,`pnpm-lock.yaml`))?`pnpm`:n(a(e,`yarn.lock`))?`yarn`:n(a(e,`bun.lockb`))?`bun`:n(a(e,`package-lock.json`))?`npm`:null}function b(e){try{let t=a(e,`package.json`);if(!n(t))return null;let i=JSON.parse(r(t,`utf-8`));if(i.packageManager?.startsWith(`pnpm`))return`pnpm`;if(i.packageManager?.startsWith(`yarn`))return`yarn`;if(i.packageManager?.startsWith(`bun`))return`bun`;if(i.packageManager?.startsWith(`npm`))return`npm`}catch{}return null}function x(){let e=o.cwd(),t=a(`/`),n=0;for(;e!==t&&n<20;){n++;let t=y(e);if(t)return t;let r=b(e);if(r)return r;let i=a(e,`..`);if(i===e)break;e=i}return`npm`}function S(){let e=x(),t=o.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 C(e,t,n={}){let r=o.platform===`win32`;if(e===`npx`){let e=S();if(e.includes(`bun`))return s(r?`bunx.cmd`:`bunx`,t,{...n,shell:r});if(e.includes(`pnpm`))return s(e,[`exec`,...t],{...n,shell:r});if(e.includes(`yarn`))return s(e,[`dlx`,...t],{...n,shell:r})}return r&&e===`npx`?s(`npx.cmd`,t,{...n,shell:!0}):s(e,t,n)}function w(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function T(){return!!(o.env.RAILWAY_ENVIRONMENT||o.env.RAILWAY_PROJECT_ID||o.env.RAILWAY_SERVICE_ID)}function E(){return!!(o.env.RENDER||o.env.RENDER_SERVICE_ID||o.env.RENDER_SERVICE_NAME)}function D(){return T()||E()}function O(){return T()?`Railway`:E()?`Render`:`local`}function k(){return{port:o.env.PORT||o.env.RSC_PORT||`3000`,mode:o.env.NODE_ENV||`production`,host:D()?`0.0.0.0`:`127.0.0.1`}}async function A(){let{existsSync:e,rmSync:t}=await import(`node:fs`),{resolve:n}=await import(`node:path`),r=n(o.cwd(),`dist`);e(r)&&(u(`Cleaning dist folder...`),t(r,{recursive:!0,force:!0})),u(`Type checking...`);let i=C(`npx`,[`tsgo`],{stdio:`inherit`,cwd:o.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=C(`npx`,[`vp`,`build`],{stdio:`inherit`,cwd:o.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 j()}async function j(){if(n(a(o.cwd(),`dist`,`server`,`image.json`))&&n(a(o.cwd(),`public`)))try{let t=s(e(),[`optimize-images`],{stdio:`inherit`,cwd:o.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: ${w(t)}`),e()})})}catch(e){p(`Could not pre-optimize images: ${w(e)}`)}}async function M(){let{existsSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`);if(!e(t(o.cwd(),`dist`))){u(`First run detected - building project...`);let e=C(`npx`,[`vp`,`build`,`--mode`,`development`],{stdio:`inherit`,cwd:o.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+ dev server...`);let n=C(`npx`,[`vp`,`dev`],{stdio:`inherit`,cwd:o.cwd()}),r=()=>{u(`Shutting down dev server...`),n.kill(`SIGTERM`)};return o.on(`SIGINT`,r),o.on(`SIGTERM`,r),n.on(`error`,e=>{f(`Failed to start Vite: ${e.message}`),o.exit(1)}),n.on(`exit`,e=>{e!==0&&e!==null&&(f(`Vite exited with code ${e}`),o.exit(e))}),new Promise(()=>{})}async function N(){let n;try{n=e()}catch{f(`Failed to obtain rari binary`),f(t()),o.exit(1)}let{port:r,mode:i,host:a}=k();if(D()){let e=O();u(`${e} environment detected`),u(`Starting rari server for ${e} deployment...`),u(`Mode: ${i}, Host: ${a}, Port: ${r}`),u(`using binary: ${n}`)}let c=s(n,[`--mode`,i,`--port`,r,`--host`,a],{stdio:`inherit`,cwd:o.cwd(),env:{...o.env,RUST_LOG:o.env.RUST_LOG||`error`}}),l=()=>{u(`shutting down...`),c.kill(`SIGTERM`)};return o.on(`SIGINT`,l),o.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.`),o.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}`),o.exit(e||1))}),new Promise(()=>{})}async function P(){u(`Setting up Railway deployment...`),D()&&(f(`Already running in ${O()} environment. Use "rari start" instead.`),o.exit(1));let{createRailwayDeployment:e}=await import(`./railway-2u_Vq-71.mjs`);await e()}async function F(){u(`Setting up Render deployment...`),D()&&(f(`Already running in ${O()} environment. Use "rari start" instead.`),o.exit(1));let{createRenderDeployment:e}=await import(`./render-jhijat1L.mjs`);await e()}async function I(){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
|
|
@@ -63,4 +63,4 @@ ${l(`bold`,`Notes:`)}
|
|
|
63
63
|
- Platform deployment is automatically detected and configured
|
|
64
64
|
- Use Ctrl+C to stop the server gracefully
|
|
65
65
|
|
|
66
|
-
`);break;case`dev`:await
|
|
66
|
+
`);break;case`dev`:await M();break;case`build`:await A();break;case`start`:await N();break;case`deploy`:v[0]===`railway`?await P():v[0]===`render`?await F():(f(`Unknown deployment target. Available: railway, render`),o.exit(1));break;default:console.error(`${l(`bold`,`Unknown command:`)} ${_}`),console.warn(`Run "${l(`cyan`,`rari help`)}" for available commands`),o.exit(1)}}const L=o.argv[1]?i(a(o.argv[1])):``,R=i(c(import.meta.url));L&&R===L&&I().catch(e=>{f(`CLI Error: ${w(e)}`),console.error(e),o.exit(1)});export{x as detectPackageManager,k as getDeploymentConfig,T as isRailwayEnvironment,E as isRenderEnvironment};
|
package/dist/client.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as extractServerPropsWithCache, S as extractServerProps, T as hasServerSideDataFetching, _ as ServerSidePropsResult, a as ServerSpamBlockerConfig, b as clearPropsCacheForComponent, c as ErrorBoundary, d as NotFound, f as RuntimeClient, g as MetadataResult, h as createLoadingBoundary, i as ServerRateLimitConfig, l as HttpRuntimeClient, m as createHttpRuntimeClient, o as DefaultError, p as createErrorBoundary, r as ServerConfig, s as DefaultLoading, t as ServerCSPConfig, u as LoadingSpinner, v as StaticParamsResult, w as extractStaticParams, x as extractMetadata, y as clearPropsCache } from "./server-config-
|
|
2
|
-
import { a as ErrorProps, c as LayoutEntry, f as NotFoundEntry, h as RouteSegmentType, i as ErrorEntry, m as RouteSegment, n as AppRouteManifest, o as GenerateMetadata, r as AppRouteMatch, s as GenerateStaticParams, t as AppRouteEntry, u as LoadingEntry } from "./types-
|
|
1
|
+
import { C as extractServerPropsWithCache, S as extractServerProps, T as hasServerSideDataFetching, _ as ServerSidePropsResult, a as ServerSpamBlockerConfig, b as clearPropsCacheForComponent, c as ErrorBoundary, d as NotFound, f as RuntimeClient, g as MetadataResult, h as createLoadingBoundary, i as ServerRateLimitConfig, l as HttpRuntimeClient, m as createHttpRuntimeClient, o as DefaultError, p as createErrorBoundary, r as ServerConfig, s as DefaultLoading, t as ServerCSPConfig, u as LoadingSpinner, v as StaticParamsResult, w as extractStaticParams, x as extractMetadata, y as clearPropsCache } from "./server-config-Cf6g4PHZ.mjs";
|
|
2
|
+
import { a as ErrorProps, c as LayoutEntry, f as NotFoundEntry, h as RouteSegmentType, i as ErrorEntry, m as RouteSegment, n as AppRouteManifest, o as GenerateMetadata, r as AppRouteMatch, s as GenerateStaticParams, t as AppRouteEntry, u as LoadingEntry } from "./types-Cfe0C3JU.mjs";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Component, ErrorInfo, ReactNode } from "react";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
package/dist/client.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e,t}from"./navigate-hfIqe3MK.mjs";import{a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./runtime-client-C80F166Y.mjs";import{Component as v,useEffect as y,useLayoutEffect as b,useRef as x,useState as S}from"react";import{Fragment as C,jsx as w,jsxs as T}from"react/jsx-runtime";function E(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:c=!1,trailing:l=!0,maxWait:u}=n;function d(t){let n=o,r=s;return o=null,s=null,a=t,e.apply(r,n)}function f(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||u!==void 0&&r>=u}function p(){let e=Date.now();if(f(e))return h(e);let n=e-i,o=e-a,s=t-n,c=u===void 0?1/0:u-o,l=Math.min(s,c);r=setTimeout(p,l)}function m(e){return a=e,r=setTimeout(p,t),c?d(e):void 0}function h(e){if(r=null,l&&o)return d(e);o=null,s=null}function g(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function _(){return r===null?void 0:h(Date.now())}function v(){return r!==null}function y(...e){let n=Date.now(),a=f(n);if(o=e,s=this,i=n,a){if(r===null)return m(i);if(u!==void 0)return r=setTimeout(p,t),d(i)}r===null&&(r=setTimeout(p,t))}return y.cancel=g,y.flush=_,y.pending=v,y}function D(e,t){if(e instanceof Error&&e.name===`AbortError`)return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1};if(e instanceof Error&&e.message.includes(`timeout`))return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0};if(e instanceof Error&&`status`in e){let n=e.status;return n===404?{type:`not-found`,message:`Page not found`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:!1}:n>=500?{type:`server-error`,message:`Server error: ${n}`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:!0}:{type:`fetch-error`,message:`HTTP error: ${n}`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:n>=500}}return e instanceof TypeError&&e.message.includes(`fetch`)?{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}:e instanceof SyntaxError||e instanceof Error&&e.message.includes(`parse`)?{type:`parse-error`,message:`Failed to parse server response`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}:{type:`fetch-error`,message:e instanceof Error?e.message:`Unknown error occurred`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}}var O=class{options;retryCount;constructor(e={}){this.options={timeout:e.timeout??1e4,maxRetries:e.maxRetries??3,onError:e.onError??(()=>{}),onRetry:e.onRetry??(()=>{})},this.retryCount=new Map}handleError(e,t){let n=D(e,t);return this.options.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:navigation-error`,{detail:n})),n}canRetry(e,t){return e.retryable?(this.retryCount.get(t)??0)<this.options.maxRetries:!1}incrementRetry(e){let t=(this.retryCount.get(e)??0)+1;return this.retryCount.set(e,t),this.options.onRetry(t,{type:`fetch-error`,message:`Retry attempt ${t}`,url:e,timestamp:Date.now(),retryable:!0}),t}resetRetry(e){this.retryCount.delete(e)}getRetryCount(e){return this.retryCount.get(e)??0}clearRetries(){this.retryCount.clear()}};const k=/(^\/+)|(\/+$)/g;function A(e){let t=e.replace(k,``);return t?t.split(`/`):[]}function j(e){try{return decodeURIComponent(e)}catch{return null}}function M(e,t,n){let r=A(n),i={},a=0;for(let e=0;e<t.length;e++){let n=t[e];if(a>=r.length){if(n.type===`optional-catch-all`){n.param&&(i[n.param]=[]);continue}return null}switch(n.type){case`static`:if(r[a]!==n.value)return null;a++;break;case`dynamic`:if(n.param){let e=j(r[a]);if(e===null)return null;i[n.param]=e}a++;break;case`catch-all`:case`optional-catch-all`:if(n.param){let e=[];for(let t of r.slice(a)){let n=j(t);if(n===null)return null;e.push(n)}i[n.param]=e}a=r.length;break}}return a===r.length?i:null}function N(e){if(!e||e===`/`)return`/`;let t=e;for(;t.endsWith(`/`)&&t.length>1;)t=t.slice(0,-1);return t.startsWith(`/`)||(t=`/${t}`),t}function P(e,t){try{return new URL(e,t||window.location.origin).origin!==(t||window.location.origin)}catch{return!1}}function F(e){try{let t=new URL(e,window.location.origin);return t.pathname+t.hash}catch{return e}}function I({error:e,onRetry:t,onReload:n,onDismiss:r,retryCount:i=0,maxRetries:a=3}){let o=e.retryable&&i<a;return w(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`rgba(0, 0, 0, 0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e4,padding:`20px`},onClick:e=>{e.target===e.currentTarget&&r&&r()},children:T(`div`,{style:{background:`white`,borderRadius:`8px`,padding:`24px`,maxWidth:`500px`,width:`100%`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`},onClick:e=>e.stopPropagation(),children:[T(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`16px`},children:[w(`span`,{style:{fontSize:`32px`},children:(()=>{switch(e.type){case`timeout`:return`⏱️`;case`network-error`:return`📡`;case`not-found`:return`🔍`;case`server-error`:return`⚠️`;case`parse-error`:return`📄`;case`abort`:return`🚫`;default:return`❌`}})()}),w(`h2`,{style:{margin:0,fontSize:`20px`,fontWeight:`600`,color:`#1f2937`},children:`Navigation Error`})]}),w(`p`,{style:{margin:`0 0 16px 0`,fontSize:`15px`,lineHeight:`1.5`,color:`#4b5563`},children:(()=>{switch(e.type){case`timeout`:return`The page took too long to load. Please try again.`;case`network-error`:return`Unable to connect to the server. Please check your internet connection.`;case`not-found`:return`The page you're looking for doesn't exist.`;case`server-error`:return`The server encountered an error. Please try again in a moment.`;case`parse-error`:return`Unable to load the page content. Please try reloading.`;case`abort`:return`Navigation was cancelled.`;default:return e.message||`An unexpected error occurred.`}})()}),e.url&&T(`details`,{style:{marginBottom:`16px`,fontSize:`13px`,color:`#6b7280`},children:[w(`summary`,{style:{cursor:`pointer`,userSelect:`none`,marginBottom:`8px`},children:`Technical details`}),T(`div`,{style:{padding:`12px`,background:`#f9fafb`,borderRadius:`4px`,fontFamily:`monospace`,fontSize:`12px`,wordBreak:`break-all`},children:[T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`URL:`}),` `,e.url]}),e.statusCode&&T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`Status:`}),` `,e.statusCode]}),T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`Type:`}),` `,e.type]}),e.originalError&&T(`div`,{children:[w(`strong`,{children:`Error:`}),` `,e.originalError.message]})]})]}),o&&i>0&&T(`div`,{style:{marginBottom:`16px`,padding:`8px 12px`,background:`#fef3c7`,border:`1px solid #fbbf24`,borderRadius:`4px`,fontSize:`13px`,color:`#92400e`},children:[`Retry attempt`,` `,i,` `,`of`,` `,a]}),T(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[o&&t&&w(`button`,{onClick:t,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#3b82f6`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#2563eb`},onMouseLeave:e=>{e.currentTarget.style.background=`#3b82f6`},children:`Try Again`}),n&&w(`button`,{onClick:n,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#6b7280`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#4b5563`},onMouseLeave:e=>{e.currentTarget.style.background=`#6b7280`},children:`Reload Page`}),r&&w(`button`,{onClick:r,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`transparent`,color:`#6b7280`,border:`1px solid #d1d5db`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#f9fafb`,e.currentTarget.style.borderColor=`#9ca3af`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`,e.currentTarget.style.borderColor=`#d1d5db`},children:`Dismiss`})]}),w(`p`,{style:{marginTop:`16px`,marginBottom:0,fontSize:`12px`,color:`#9ca3af`,textAlign:`center`},children:`Your current page is still available below this message`})]})})}const L=new class{cache=new Map;pendingRequests=new Map;async get(e){let t=this.cache.get(e);if(t)return t;let n=this.pendingRequests.get(e);if(n)return n;let r=this.fetchRouteInfo(e);this.pendingRequests.set(e,r);try{let t=await r;return this.cache.set(e,t),t}finally{this.pendingRequests.delete(e)}}async fetchRouteInfo(e){let t={path:e},n=await fetch(`/_rari/route-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=null;try{e=await n.json()}catch{}throw e?.error?Error(e.error):Error(`Failed to fetch route info: ${n.status} ${n.statusText}`)}let r=n.clone();try{return await n.json()}catch(t){try{let e=await r.text();return JSON.parse(e)}catch(n){throw console.error(`[RouteInfo] Failed to parse response:`,{error:t,parseError:n,path:e}),Error(`Failed to parse route info response`)}}}clear(){this.cache.clear(),this.pendingRequests.clear()}invalidate(e){this.cache.delete(e)}};if(typeof window<`u`){let e=window[`~rari`]||{};window[`~rari`]||(window[`~rari`]=e),e.routeInfoCache=L}var R=class{stateHistory;routeAccessOrder;maxHistorySize;scrollableSelector;constructor(e={}){this.stateHistory=new Map,this.routeAccessOrder=[],this.maxHistorySize=e.maxHistorySize||50,this.scrollableSelector=e.scrollableSelector||`[data-scrollable], .scrollable, [style*="overflow"]`}captureState(e){let t={scrollPositions:this.captureScrollPositions(),formData:this.captureFormData(),focusedElement:this.captureFocusedElement()};return this.storeState(e,t),t}captureScrollPositions(){let e=new Map;try{e.set(`window`,{x:window.scrollX,y:window.scrollY,element:`window`}),document.querySelectorAll(this.scrollableSelector).forEach((t,n)=>{if(t instanceof HTMLElement){let r=t.id||`scrollable-${n}`;(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&e.set(r,{x:t.scrollLeft,y:t.scrollTop,element:r})}})}catch{}return e}captureFormData(){let e=new Map;try{document.querySelectorAll(`form`).forEach((t,n)=>{let r=t.id||t.name||`form-${n}`,i=new FormData(t);i.entries().next().done||e.set(r,i)})}catch{}return e}captureFocusedElement(){try{let e=document.activeElement;if(e&&e!==document.body){if(e.id)return`#${e.id}`;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.name)return`[name="${e.name}"]`}}catch{}return null}storeState(e,t){let n=this.routeAccessOrder.indexOf(e);for(n!==-1&&this.routeAccessOrder.splice(n,1),this.routeAccessOrder.push(e),this.stateHistory.set(e,t);this.routeAccessOrder.length>this.maxHistorySize;){let e=this.routeAccessOrder.shift();e&&this.stateHistory.delete(e)}}getHistorySize(){return this.stateHistory.size}hasState(e){return this.stateHistory.has(e)}getState(e){return this.stateHistory.get(e)}clearAll(){this.stateHistory.clear(),this.routeAccessOrder=[]}clearState(e){this.stateHistory.delete(e);let t=this.routeAccessOrder.indexOf(e);t!==-1&&this.routeAccessOrder.splice(t,1)}restoreState(e){let t=this.stateHistory.get(e);if(!t)return!1;let n=!0;return this.restoreScrollPositions(t.scrollPositions)||(n=!1),this.restoreFormData(t.formData)||(n=!1),t.focusedElement&&this.restoreFocus(t.focusedElement),n}restoreScrollPositions(e){let t=!0;try{e.forEach((e,n)=>{try{if(n===`window`)window.scrollTo(e.x,e.y);else{let r=document.getElementById(n)||document.querySelector(`[data-scrollable-id="${n}"]`);r instanceof HTMLElement?(r.scrollLeft=e.x,r.scrollTop=e.y):t=!1}}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore scroll positions:`,e),t=!1}return t}restoreFormData(e){let t=!0;try{e.forEach((e,n)=>{try{let r=document.getElementById(n)||document.querySelector(`form[name="${n}"]`)||document.querySelectorAll(`form`)[Number.parseInt(n.replace(`form-`,``),10)];r instanceof HTMLFormElement?e.forEach((e,n)=>{try{let t=r.elements.namedItem(n);t instanceof RadioNodeList?t.forEach(t=>{t instanceof HTMLInputElement&&(t.type===`radio`||t.type===`checkbox`?t.checked=t.value===e:t.value=e)}):(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t instanceof HTMLInputElement&&(t.type===`checkbox`||t.type===`radio`)?t.checked=t.value===e:t.value=e)}catch{t=!1}}):t=!1}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore form data:`,e),t=!1}return t}restoreFocus(e){try{let t=document.querySelector(e);t instanceof HTMLElement&&requestAnimationFrame(()=>{try{t.focus()}catch{}})}catch{}}};function z(e){e.title&&(document.title=e.title);let t=(e,t)=>{let n=document.querySelector(e);if(n)t.content&&n.setAttribute(`content`,t.content);else{n=document.createElement(`meta`);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);document.head.appendChild(n)}};if(e.description&&t(`meta[name="description"]`,{name:`description`,content:e.description}),e.keywords&&e.keywords.length>0&&t(`meta[name="keywords"]`,{name:`keywords`,content:e.keywords.join(`, `)}),e.viewport&&t(`meta[name="viewport"]`,{name:`viewport`,content:e.viewport}),e.canonical){let t=document.querySelector(`link[rel="canonical"]`);t||(t=document.createElement(`link`),t.setAttribute(`rel`,`canonical`),document.head.appendChild(t)),t.setAttribute(`href`,e.canonical)}if(e.robots){let n=[];e.robots.index!==void 0&&n.push(e.robots.index?`index`:`noindex`),e.robots.follow!==void 0&&n.push(e.robots.follow?`follow`:`nofollow`),e.robots.nocache&&n.push(`nocache`),n.length>0&&t(`meta[name="robots"]`,{name:`robots`,content:n.join(`, `)})}if(e.openGraph){let n=e.openGraph;if(n.title&&t(`meta[property="og:title"]`,{property:`og:title`,content:n.title}),n.description&&t(`meta[property="og:description"]`,{property:`og:description`,content:n.description}),n.url&&t(`meta[property="og:url"]`,{property:`og:url`,content:n.url}),n.siteName&&t(`meta[property="og:site_name"]`,{property:`og:site_name`,content:n.siteName}),n.type&&t(`meta[property="og:type"]`,{property:`og:type`,content:n.type}),n.images&&n.images.length>0){document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());for(let e of n.images){let t=document.createElement(`meta`);t.setAttribute(`property`,`og:image`),t.setAttribute(`content`,e),document.head.appendChild(t)}}}if(e.twitter){let n=e.twitter;if(n.card&&t(`meta[name="twitter:card"]`,{name:`twitter:card`,content:n.card}),n.site&&t(`meta[name="twitter:site"]`,{name:`twitter:site`,content:n.site}),n.creator&&t(`meta[name="twitter:creator"]`,{name:`twitter:creator`,content:n.creator}),n.title&&t(`meta[name="twitter:title"]`,{name:`twitter:title`,content:n.title}),n.description&&t(`meta[name="twitter:description"]`,{name:`twitter:description`,content:n.description}),n.images&&n.images.length>0){document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());for(let e of n.images){let t=document.createElement(`meta`);t.setAttribute(`name`,`twitter:image`),t.setAttribute(`content`,e),document.head.appendChild(t)}}}}function B({children:n,initialRoute:r,staleWindowMs:i=3e4}){let[a,o]=S(()=>({currentRoute:N(r),navigationId:0,error:null})),s=x(null),c=x(!0),l=x(N(r)),u=x(new O({timeout:1e4,maxRetries:3,onError:e=>{console.error(`[rari] Router: Navigation error:`,e)},onRetry:()=>{}})),d=x(new Map),f=x([]),p=x(new R({maxHistorySize:50})),m=x(null),h=x(i),g=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,_=()=>{s.current&&=(s.current.abort(),null)},v=()=>{for(let[,e]of d.current.entries())e.abortController.abort();d.current.clear()},D=(e,t)=>{d.current.delete(e),c.current&&a.navigationId===t&&o(e=>({...e}))},k=async e=>L.get(e),A=x(null),j=async(e,t={})=>{if(!e||typeof e!=`string`){console.error(`[rari] Router: Invalid navigation target:`,e);return}let[n,r]=e.includes(`#`)?e.split(`#`):[e,``],i=N(n);if(i===l.current&&!t.replace){if(r){let e=document.getElementById(r);e&&(e.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,`${i}#${r}`))}return}let f=d.current.get(i);if(f)return f.promise;let m=await k(i);v(),_();let h=new AbortController;s.current=h;let y=a.navigationId+1,b=(async()=>{let e=l.current;try{t.historyKey||p.current.captureState(e);let n=t.historyKey||g(),a={route:i,navigationId:y,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:n},s=r?`${i}#${r}`:i;t.replace?window.history.replaceState(a,``,s):window.history.pushState(a,``,s);let f=window.location.origin+i,_=await fetch(f,{headers:{Accept:`text/x-component`},signal:h.signal});if(!_.ok&&_.status!==404)throw Error(`Failed to fetch: ${_.status}`);let v=new URL(_.url).pathname,b=v===i?i:v;if(v!==i){let e=r?`${v}#${r}`:v;window.history.replaceState({route:v,navigationId:y,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:t.historyKey||g()},``,e)}if(h.signal.aborted){D(b,y);return}try{let e=_.headers.get(`x-rari-metadata`);if(e){let t=decodeURIComponent(e);z(JSON.parse(t))}}catch{}let x=_.headers.get(`x-render-mode`)===`streaming`,S=m?.segments&&M(``,m.segments,b)||{};if(x&&_.body){let n=_.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;if(h.signal.aborted){await n.cancel(),D(b,y);return}i+=r.decode(t,{stream:!0});let a=i.split(`
|
|
2
|
-
`);
|
|
3
|
-
`,this.state.error.stack]})]}),
|
|
1
|
+
import{i as e,t}from"./navigate-hfIqe3MK.mjs";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _}from"./runtime-client-yoJmu7vX.mjs";import{Component as v,useEffect as y,useLayoutEffect as ee,useRef as b,useState as x}from"react";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";function T(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:c=!1,trailing:l=!0,maxWait:u}=n;function d(t){let n=o,r=s;return o=null,s=null,a=t,e.apply(r,n)}function f(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||u!==void 0&&r>=u}function p(){let e=Date.now();if(f(e))return h(e);let n=e-i,o=e-a,s=t-n,c=u===void 0?1/0:u-o,l=Math.min(s,c);r=setTimeout(p,l)}function m(e){return a=e,r=setTimeout(p,t),c?d(e):void 0}function h(e){if(r=null,l&&o)return d(e);o=null,s=null}function g(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function _(){return r===null?void 0:h(Date.now())}function v(){return r!==null}function y(...e){let n=Date.now(),a=f(n);if(o=e,s=this,i=n,a){if(r===null)return m(i);if(u!==void 0)return r=setTimeout(p,t),d(i)}r===null&&(r=setTimeout(p,t))}return y.cancel=g,y.flush=_,y.pending=v,y}const E=/fetch|networkerror|load failed/i;function D(e,t){return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1}}function O(e,t){return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function k(e,t,n){if(t===404)return{type:`not-found`,message:`Page not found`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!1};if(t>=500)return{type:`server-error`,message:`Server error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!0};let r=t===408||t===429;return{type:`fetch-error`,message:`HTTP error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:r}}function A(e,t){return{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function j(e,t){return{type:`parse-error`,message:`Failed to parse server response`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}}function M(e,t){return{type:`fetch-error`,message:e instanceof Error?e.message:`Unknown error occurred`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}}function N(e,t){if(e instanceof Error&&e.name===`AbortError`)return D(e,t);if(e instanceof Error&&(e.name===`TimeoutError`||e.message.includes(`timeout`)))return O(e,t);if(e instanceof Error&&`status`in e){let n=e.status;return typeof n==`number`?k(e,n,t):M(e,t)}return e instanceof TypeError&&E.test(e.message)?A(e,t):e instanceof SyntaxError||e instanceof Error&&e.message.includes(`parse`)?j(e,t):M(e,t)}var P=class{options;retryCount;constructor(e={}){this.options={timeout:e.timeout??1e4,maxRetries:e.maxRetries??3,onError:e.onError??(()=>{}),onRetry:e.onRetry??(()=>{})},this.retryCount=new Map}handleError(e,t){let n=N(e,t);return this.options.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),n}canRetry(e,t){return e.retryable?(this.retryCount.get(t)??0)<this.options.maxRetries:!1}incrementRetry(e){let t=(this.retryCount.get(e)??0)+1;return this.retryCount.set(e,t),this.options.onRetry(t,{type:`fetch-error`,message:`Retry attempt ${t}`,url:e,timestamp:Date.now(),retryable:!0}),t}resetRetry(e){this.retryCount.delete(e)}getRetryCount(e){return this.retryCount.get(e)??0}clearRetries(){this.retryCount.clear()}};const F=/(^\/+)|(\/+$)/g;function I(e){let t=e.replace(F,``);return t?t.split(`/`):[]}function L(e){try{return decodeURIComponent(e)}catch{return null}}function R(e,t){let n=L(e),r=L(t);return n===null||r===null?!1:n===r}function z(e,t,n){if(!t)return!1;let r=L(e);return r===null?!1:(n[t]=r,!0)}function B(e,t,n,r){if(!n)return{success:!1,newIndex:t};let i=[];for(let n of e.slice(t)){let e=L(n);if(e===null)return{success:!1,newIndex:t};i.push(e)}return r[n]=i,{success:!0,newIndex:e.length}}function V(e,t,n,r){e>=t&&n&&(r[n]=[])}function H(e,t,n,r){if(n>=t.length)return e.type===`optional-catch-all`&&e.param?(V(n,t.length,e.param,r),{success:!0,newIndex:n}):{success:!1,newIndex:n};switch(e.type){case`static`:return R(t[n],e.value)?{success:!0,newIndex:n+1}:{success:!1,newIndex:n};case`dynamic`:return z(t[n],e.param,r)?{success:!0,newIndex:n+1}:{success:!1,newIndex:n};case`catch-all`:case`optional-catch-all`:return B(t,n,e.param,r);default:return{success:!1,newIndex:n}}}function U(e,t,n){let r=I(n),i={},a=0;for(let e of t){let t=H(e,r,a,i);if(!t.success)return null;a=t.newIndex}return a===r.length?i:null}function W(e){if(!e||e===`/`)return`/`;let t=e;for(;t.endsWith(`/`)&&t.length>1;)t=t.slice(0,-1);return t.startsWith(`/`)||(t=`/${t}`),t}function G(e,t){try{return new URL(e,t||window.location.origin).origin!==(t||window.location.origin)}catch{return!1}}function te(e){try{let t=new URL(e,window.location.origin);return t.pathname+t.hash}catch{return e}}function K({error:e,onRetry:t,onReload:n,onDismiss:r,retryCount:i=0,maxRetries:a=3}){let o=e.retryable&&i<a;return C(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`rgba(0, 0, 0, 0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e4,padding:`20px`},onClick:e=>{e.target===e.currentTarget&&r&&r()},children:w(`div`,{style:{background:`white`,borderRadius:`8px`,padding:`24px`,maxWidth:`500px`,width:`100%`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`},onClick:e=>e.stopPropagation(),children:[w(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`16px`},children:[C(`span`,{style:{fontSize:`32px`},children:(()=>{switch(e.type){case`timeout`:return`⏱️`;case`network-error`:return`📡`;case`not-found`:return`🔍`;case`server-error`:return`⚠️`;case`parse-error`:return`📄`;case`abort`:return`🚫`;default:return`❌`}})()}),C(`h2`,{style:{margin:0,fontSize:`20px`,fontWeight:`600`,color:`#1f2937`},children:`Navigation Error`})]}),C(`p`,{style:{margin:`0 0 16px 0`,fontSize:`15px`,lineHeight:`1.5`,color:`#4b5563`},children:(()=>{switch(e.type){case`timeout`:return`The page took too long to load. Please try again.`;case`network-error`:return`Unable to connect to the server. Please check your internet connection.`;case`not-found`:return`The page you're looking for doesn't exist.`;case`server-error`:return`The server encountered an error. Please try again in a moment.`;case`parse-error`:return`Unable to load the page content. Please try reloading.`;case`abort`:return`Navigation was cancelled.`;default:return e.message||`An unexpected error occurred.`}})()}),e.url&&w(`details`,{style:{marginBottom:`16px`,fontSize:`13px`,color:`#6b7280`},children:[C(`summary`,{style:{cursor:`pointer`,userSelect:`none`,marginBottom:`8px`},children:`Technical details`}),w(`div`,{style:{padding:`12px`,background:`#f9fafb`,borderRadius:`4px`,fontFamily:`monospace`,fontSize:`12px`,wordBreak:`break-all`},children:[w(`div`,{style:{marginBottom:`4px`},children:[C(`strong`,{children:`URL:`}),` `,e.url]}),e.statusCode&&w(`div`,{style:{marginBottom:`4px`},children:[C(`strong`,{children:`Status:`}),` `,e.statusCode]}),w(`div`,{style:{marginBottom:`4px`},children:[C(`strong`,{children:`Type:`}),` `,e.type]}),e.originalError&&w(`div`,{children:[C(`strong`,{children:`Error:`}),` `,e.originalError.message]})]})]}),o&&i>0&&w(`div`,{style:{marginBottom:`16px`,padding:`8px 12px`,background:`#fef3c7`,border:`1px solid #fbbf24`,borderRadius:`4px`,fontSize:`13px`,color:`#92400e`},children:[`Retry attempt`,` `,i,` `,`of`,` `,a]}),w(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[o&&t&&C(`button`,{onClick:t,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#3b82f6`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#2563eb`},onMouseLeave:e=>{e.currentTarget.style.background=`#3b82f6`},children:`Try Again`}),n&&C(`button`,{onClick:n,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#6b7280`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#4b5563`},onMouseLeave:e=>{e.currentTarget.style.background=`#6b7280`},children:`Reload Page`}),r&&C(`button`,{onClick:r,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`transparent`,color:`#6b7280`,border:`1px solid #d1d5db`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#f9fafb`,e.currentTarget.style.borderColor=`#9ca3af`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`,e.currentTarget.style.borderColor=`#d1d5db`},children:`Dismiss`})]}),C(`p`,{style:{marginTop:`16px`,marginBottom:0,fontSize:`12px`,color:`#9ca3af`,textAlign:`center`},children:`Your current page is still available below this message`})]})})}const q=new class{cache=new Map;pendingRequests=new Map;async get(e){let t=this.cache.get(e);if(t)return t;let n=this.pendingRequests.get(e);if(n)return n;let r=this.fetchRouteInfo(e);this.pendingRequests.set(e,r);try{let t=await r;return this.cache.set(e,t),t}finally{this.pendingRequests.delete(e)}}async fetchRouteInfo(e){let t={path:e},n=await fetch(`/_rari/route-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=null;try{e=await n.json()}catch{}throw e?.error?Error(e.error):Error(`Failed to fetch route info: ${n.status} ${n.statusText}`)}let r=n.clone();try{return await n.json()}catch(t){try{let e=await r.text();return JSON.parse(e)}catch(n){throw console.error(`[RouteInfo] Failed to parse response:`,{error:t,parseError:n,path:e}),Error(`Failed to parse route info response`)}}}clear(){this.cache.clear(),this.pendingRequests.clear()}invalidate(e){this.cache.delete(e)}};if(typeof window<`u`){let e=window[`~rari`]||{};window[`~rari`]||(window[`~rari`]=e),e.routeInfoCache=q}var J=class{stateHistory;routeAccessOrder;maxHistorySize;scrollableSelector;constructor(e={}){this.stateHistory=new Map,this.routeAccessOrder=[],this.maxHistorySize=e.maxHistorySize||50,this.scrollableSelector=e.scrollableSelector||`[data-scrollable], .scrollable, [style*="overflow"]`}captureState(e){let t={scrollPositions:this.captureScrollPositions(),formData:this.captureFormData(),focusedElement:this.captureFocusedElement()};return this.storeState(e,t),t}captureScrollPositions(){let e=new Map;try{e.set(`window`,{x:window.scrollX,y:window.scrollY,element:`window`}),document.querySelectorAll(this.scrollableSelector).forEach((t,n)=>{if(t instanceof HTMLElement){let r=t.id||`scrollable-${n}`;(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&e.set(r,{x:t.scrollLeft,y:t.scrollTop,element:r})}})}catch{}return e}captureFormData(){let e=new Map;try{document.querySelectorAll(`form`).forEach((t,n)=>{let r=t.id||t.name||`form-${n}`,i=new FormData(t);i.entries().next().done||e.set(r,i)})}catch{}return e}captureFocusedElement(){try{let e=document.activeElement;if(e&&e!==document.body){if(e.id)return`#${e.id}`;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.name)return`[name="${e.name}"]`}}catch{}return null}storeState(e,t){let n=this.routeAccessOrder.indexOf(e);for(n!==-1&&this.routeAccessOrder.splice(n,1),this.routeAccessOrder.push(e),this.stateHistory.set(e,t);this.routeAccessOrder.length>this.maxHistorySize;){let e=this.routeAccessOrder.shift();e&&this.stateHistory.delete(e)}}getHistorySize(){return this.stateHistory.size}hasState(e){return this.stateHistory.has(e)}getState(e){return this.stateHistory.get(e)}clearAll(){this.stateHistory.clear(),this.routeAccessOrder=[]}clearState(e){this.stateHistory.delete(e);let t=this.routeAccessOrder.indexOf(e);t!==-1&&this.routeAccessOrder.splice(t,1)}restoreState(e){let t=this.stateHistory.get(e);if(!t)return!1;let n=!0;return this.restoreScrollPositions(t.scrollPositions)||(n=!1),this.restoreFormData(t.formData)||(n=!1),t.focusedElement&&this.restoreFocus(t.focusedElement),n}restoreScrollPositions(e){let t=!0;try{e.forEach((e,n)=>{try{if(n===`window`)window.scrollTo(e.x,e.y);else{let r=document.getElementById(n)||document.querySelector(`[data-scrollable-id="${n}"]`);r instanceof HTMLElement?(r.scrollLeft=e.x,r.scrollTop=e.y):t=!1}}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore scroll positions:`,e),t=!1}return t}restoreFormData(e){let t=!0;try{e.forEach((e,n)=>{try{let r=document.getElementById(n)||document.querySelector(`form[name="${n}"]`)||document.querySelectorAll(`form`)[Number.parseInt(n.replace(`form-`,``),10)];r instanceof HTMLFormElement?e.forEach((e,n)=>{try{let t=r.elements.namedItem(n);t instanceof RadioNodeList?t.forEach(t=>{t instanceof HTMLInputElement&&(t.type===`radio`||t.type===`checkbox`?t.checked=t.value===e:t.value=e)}):(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t instanceof HTMLInputElement&&(t.type===`checkbox`||t.type===`radio`)?t.checked=t.value===e:t.value=e)}catch{t=!1}}):t=!1}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore form data:`,e),t=!1}return t}restoreFocus(e){try{let t=document.querySelector(e);t instanceof HTMLElement&&requestAnimationFrame(()=>{try{t.focus()}catch{}})}catch{}}};function Y(e,t){let n=document.querySelector(e);if(n)t.content&&n.setAttribute(`content`,t.content);else{n=document.createElement(`meta`);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);document.head.appendChild(n)}}function X(e){let t=document.querySelector(e);t&&t.remove()}function Z(e){e.title&&(document.title=e.title),e.description?Y(`meta[name="description"]`,{name:`description`,content:e.description}):X(`meta[name="description"]`),e.keywords&&e.keywords.length>0?Y(`meta[name="keywords"]`,{name:`keywords`,content:e.keywords.join(`, `)}):X(`meta[name="keywords"]`),e.viewport&&Y(`meta[name="viewport"]`,{name:`viewport`,content:e.viewport})}function Q(e){let t=document.querySelector(`link[rel="canonical"]`);if(e===void 0){t&&t.remove();return}if(t)t.setAttribute(`href`,e);else{let t=document.createElement(`link`);t.setAttribute(`rel`,`canonical`),t.setAttribute(`href`,e),document.head.appendChild(t)}}function $(e){if(e===void 0){X(`meta[name="robots"]`);return}let t=[];e.index!==void 0&&t.push(e.index?`index`:`noindex`),e.follow!==void 0&&t.push(e.follow?`follow`:`nofollow`),e.nocache&&t.push(`nocache`),t.length>0?Y(`meta[name="robots"]`,{name:`robots`,content:t.join(`, `)}):X(`meta[name="robots"]`)}function ne(e){if(e===void 0){X(`meta[property="og:title"]`),X(`meta[property="og:description"]`),X(`meta[property="og:url"]`),X(`meta[property="og:site_name"]`),X(`meta[property="og:type"]`),document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());return}if(e.title?Y(`meta[property="og:title"]`,{property:`og:title`,content:e.title}):X(`meta[property="og:title"]`),e.description?Y(`meta[property="og:description"]`,{property:`og:description`,content:e.description}):X(`meta[property="og:description"]`),e.url?Y(`meta[property="og:url"]`,{property:`og:url`,content:e.url}):X(`meta[property="og:url"]`),e.siteName?Y(`meta[property="og:site_name"]`,{property:`og:site_name`,content:e.siteName}):X(`meta[property="og:site_name"]`),e.type?Y(`meta[property="og:type"]`,{property:`og:type`,content:e.type}):X(`meta[property="og:type"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`property`,`og:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove())}function re(e){if(e===void 0){X(`meta[name="twitter:card"]`),X(`meta[name="twitter:site"]`),X(`meta[name="twitter:creator"]`),X(`meta[name="twitter:title"]`),X(`meta[name="twitter:description"]`),document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());return}if(e.card?Y(`meta[name="twitter:card"]`,{name:`twitter:card`,content:e.card}):X(`meta[name="twitter:card"]`),e.site?Y(`meta[name="twitter:site"]`,{name:`twitter:site`,content:e.site}):X(`meta[name="twitter:site"]`),e.creator?Y(`meta[name="twitter:creator"]`,{name:`twitter:creator`,content:e.creator}):X(`meta[name="twitter:creator"]`),e.title?Y(`meta[name="twitter:title"]`,{name:`twitter:title`,content:e.title}):X(`meta[name="twitter:title"]`),e.description?Y(`meta[name="twitter:description"]`,{name:`twitter:description`,content:e.description}):X(`meta[name="twitter:description"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`name`,`twitter:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove())}function ie(e){Z(e),Q(e.canonical),$(e.robots),ne(e.openGraph),re(e.twitter)}function ae({children:n,initialRoute:r,staleWindowMs:i=3e4}){let[a,o]=x(()=>({currentRoute:W(r),navigationId:0,error:null})),s=b(null),c=b(!0),l=b(W(r)),u=b(new P({timeout:1e4,maxRetries:3,onError:e=>{console.error(`[rari] Router: Navigation error:`,e)},onRetry:()=>{}})),d=b(new Map),f=b([]),p=b(new J({maxHistorySize:50})),m=b(null),h=b(i),g=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,_=()=>{s.current&&=(s.current.abort(),null)},v=()=>{for(let[,e]of d.current.entries())e.abortController.abort();d.current.clear()},E=(e,t)=>{d.current.delete(e),c.current&&a.navigationId===t&&o(e=>({...e}))},D=async e=>q.get(e),O=b(null),k=(e,t)=>{if(!t)return;let n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,`${e}#${t}`))},A=e=>{try{let t=e.headers.get(`x-rari-metadata`);if(t){let e=decodeURIComponent(t);ie(JSON.parse(e))}}catch(e){console.warn(`[rari] Router: Failed to parse x-rari-metadata header:`,e)}},j=async(e,t,n,r,i,a,o,s,c)=>{if(!e.body)return;let l=e.body.getReader(),u=new TextDecoder,d=``;try{for(;;){let{done:e,value:r}=await l.read();if(e)break;if(t.signal.aborted){await l.cancel(),E(n,i);return}d+=u.decode(r,{stream:!0});let a=d.split(`
|
|
2
|
+
`);d=a.pop()||``;for(let e of a)e.trim()&&window.dispatchEvent(new CustomEvent(`rari:rsc-row`,{detail:{rscRow:e}}))}d+=u.decode(),d.trim()&&window.dispatchEvent(new CustomEvent(`rari:rsc-row`,{detail:{rscRow:d}})),window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:a,to:r,navigationId:i,options:o,routeInfo:{...s,extractedParams:c},abortSignal:t.signal,isStreaming:!0}}))}catch(e){throw console.error(`[rari] Router: Streaming error:`,e),e}},M=async(e,t,n,r,i,a,o,s)=>{let c=await e.text();window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:t,to:n,navigationId:r,options:i,routeInfo:{...a,extractedParams:o},abortSignal:s.signal,rscWireFormat:c}}))},N=(e,t,n)=>{n.historyKey?requestAnimationFrame(()=>{p.current.restoreState(e)}):t&&requestAnimationFrame(()=>{let e=(n=0)=>{let r=document.getElementById(t);r?r.scrollIntoView({behavior:`smooth`,block:`start`}):n<10&&setTimeout(e,50,n+1)};e()})},F=(e,t,n,r)=>{c.current&&(l.current=e,o(t=>({...t,currentRoute:e,navigationId:r,error:null})),u.current.resetRetry(e),N(e,t,n))},I=(e,t,n,r)=>{if(e instanceof Error&&e.name===`AbortError`){E(t,n);return}let i=u.current.handleError(e,t);c.current&&o(e=>({...e,error:i})),d.current.delete(t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:r,to:t,error:i,navigationId:n}})),O.current?.()},L=async(e,t={})=>{if(!e||typeof e!=`string`){console.error(`[rari] Router: Invalid navigation target:`,e);return}let[n,r]=e.includes(`#`)?e.split(`#`):[e,``],i=W(n);if(i===l.current&&!t.replace){k(i,r);return}let o=d.current.get(i);if(o)return o.promise;let c=await D(i);v(),_();let u=new AbortController;s.current=u;let f=a.navigationId+1,m=(async()=>{let e=l.current;try{t.historyKey||p.current.captureState(e);let n=t.historyKey||g(),a=window.location.origin+i,o=await fetch(a,{headers:{Accept:`text/x-component`},signal:u.signal});if(!o.ok&&o.status!==404)throw Error(`Failed to fetch: ${o.status}`);let s=new URL(o.url).pathname;if(u.signal.aborted){E(i,f);return}let l=r?`${s}#${r}`:s,m={route:s,navigationId:f,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:n};t.replace?window.history.replaceState(m,``,l):window.history.pushState(m,``,l),A(o);let h=o.headers.get(`x-render-mode`)===`streaming`,_=c?.segments&&U(``,c.segments,s)||{};if(h&&o.body?await j(o,u,i,s,f,e,t,c,_):await M(o,e,s,f,t,c,_,u),u.signal.aborted){E(i,f);return}F(s,r,t,f),d.current.delete(i),O.current?.()}catch(t){I(t,i,f,e)}})();return d.current.set(i,{targetPath:i,navigationId:f,promise:m,abortController:u}),m},R=async()=>{if(f.current.length===0)return;let e=f.current.at(-1);e&&(f.current=[],await L(e.path,e.options))},z=b(L);ee(()=>(O.current=R,z.current=L,()=>{O.current=null,z.current=null}));let B=b(null);B.current||=T((e,t)=>{z.current?.(e,t)},50,{leading:!1,trailing:!0,maxWait:200});let V=e=>{if(e.button!==0||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;let t=e.target;for(;t&&t.tagName!==`A`;)t=t.parentElement;if(!t||t.tagName!==`A`)return;let n=t;if(n.target&&n.target!==`_self`||n.hasAttribute(`download`))return;let r=n.getAttribute(`href`);if(!r||G(r))return;if(r.startsWith(`#`)){e.preventDefault();let t=r.slice(1),n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,r));return}e.preventDefault();let i=te(r);B.current&&B.current(i,{replace:!1})},H=e=>{let t=window.location.pathname,n=e.state;z.current&&z.current(t,{replace:!0,scroll:!1,historyKey:n?.key})},Y=()=>{if(a.error&&a.error.url){let e=a.error.url;u.current.incrementRetry(e),L(e,{replace:!1})}},X=()=>{window.location.reload()},Z=()=>{o(e=>({...e,error:null}))};y(()=>{let e=window.history.state;if(!e||!e.key){let e={route:W(r),navigationId:0,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:g()};window.history.replaceState(e,``,window.location.pathname+window.location.search+window.location.hash)}},[r]);let Q=e=>{if(e.persisted){let e=window.location.pathname;p.current.captureState(e)}},$=e=>{if(e.persisted){let e=window.location.pathname,t=window.history.state;requestAnimationFrame(()=>{p.current.restoreState(e),t?.scrollPosition&&window.scrollTo(t.scrollPosition.x,t.scrollPosition.y)})}};return y(()=>(document.addEventListener(`click`,V),window.addEventListener(`popstate`,H),window.addEventListener(`pagehide`,Q),window.addEventListener(`pageshow`,$),()=>{document.removeEventListener(`click`,V),window.removeEventListener(`popstate`,H),window.removeEventListener(`pagehide`,Q),window.removeEventListener(`pageshow`,$)}),[]),y(()=>{h.current=i;let e=()=>{document.hidden?m.current=Date.now():m.current!==null&&Date.now()-m.current>h.current&&q.clear()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[i]),y(()=>(c.current=!0,e((e,t)=>z.current?.(e,t)??Promise.resolve()),()=>{c.current=!1,t(),_(),v(),B.current?.cancel&&B.current.cancel()}),[]),w(S,{children:[n,a.error&&C(K,{error:a.error,onRetry:Y,onReload:X,onDismiss:Z,retryCount:u.current.getRetryCount(a.error.url||``),maxRetries:3})]})}var oe=class extends v{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[rari] Layout: Error in layout "${this.props.layoutPath}":`,e,t),this.props.onError&&this.props.onError(e,t),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:layout-error`,{detail:{layoutPath:this.props.layoutPath,error:e,errorInfo:t,timestamp:Date.now()}}))}reset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback(this.state.error,this.reset):w(`div`,{style:{padding:`16px`,margin:`16px 0`,background:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`},children:[C(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`},children:`Layout Error`}),w(`p`,{style:{margin:`0 0 8px 0`,fontSize:`14px`},children:[`An error occurred in layout:`,` `,C(`code`,{children:this.props.layoutPath})]}),w(`details`,{style:{fontSize:`12px`,marginBottom:`8px`},children:[C(`summary`,{style:{cursor:`pointer`},children:`Error details`}),w(`pre`,{style:{marginTop:`8px`,padding:`8px`,background:`#fff`,border:`1px solid #ddd`,borderRadius:`2px`,overflow:`auto`},children:[this.state.error.message,`
|
|
3
|
+
`,this.state.error.stack]})]}),C(`button`,{onClick:this.reset,type:`button`,style:{padding:`6px 12px`,background:`#c00`,color:`white`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},children:`Try Again`})]}):this.props.children}};export{ae as ClientRouter,_ as DefaultError,f as DefaultLoading,h as ErrorBoundary,l as HttpRuntimeClient,oe as LayoutErrorBoundary,r as LoadingSpinner,P as NavigationErrorHandler,K as NavigationErrorOverlay,p as NotFound,J as StatePreserver,a as clearPropsCache,o as clearPropsCacheForComponent,g as createErrorBoundary,i as createHttpRuntimeClient,u as createLoadingBoundary,m as extractMetadata,d as extractServerProps,c as extractServerPropsWithCache,s as extractStaticParams,n as hasServerSideDataFetching};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e.loading=!0,e.loadPromise=e.loader().then(t=>{let n=t.default||t;return e.component=n,e.registered=!0,e.loading=!1,n}).catch(t=>{throw console.error(`[rari] Failed to load component ${e.id}:`,t),e.loading=!1,e.loadPromise=void 0,t}),e.loadPromise}async function t(t,n){if(t.component!=null){if(n&&n!==`default`){let e=t.component[n];return e===void 0?null:e}return t.component}if(t.loadPromise){if(await t.loadPromise,n&&n!==`default`){let e=t.component?.[n];return e===void 0?null:e}return t.component??null}if(t.loader){let r=await e(t);if(r==null)return null;if(n&&n!==`default`){let e=r[n];return e===void 0?null:e}return r}return null}function n(t){return!t.loader||t.loading||t.component!=null||t.loadPromise?Promise.resolve(null):e(t)}function r(e,t){return e.component||e.loader&&!e.loading&&(e.loading=!0,e.loadPromise=e.loader().then(t=>(e.component=t.default||t,e.registered=!0,e.loading=!1,e.component)).catch(n=>{e.loading=!1,e.loadPromise=void 0,console.error(`[rari] Failed to load component ${t}:`,n)})),null}function i(e,t){return e.component==null?null:!t||t===`default`?e.component:e.component[t]}function a(e){e.loader&&!e.loading&&!e.loadPromise&&n(e).catch(()=>{})}function o(e,t){let n=e.indexOf(`#`),r=n===-1?e:e.slice(0,n),i=n===-1?void 0:e.slice(n+1),o=t[r];if(!o)return null;if(o.component!=null){if(i&&i!==`default`){let e=o.component[i];return e===void 0?null:e}return o.component}return a(o),null}function s(e,t,n,r){let o=r[e];if(!o||!n[o])return null;let s=n[o];return i(s,t)??(a(s),null)}function c(e,t,n){let r=e.indexOf(`#`),i=r===-1?e:e.slice(0,r),a=r===-1?``:e.slice(r+1),o=f(i);for(let e of o){let r=s(e,a,t,n);if(r!==null)return r}return null}function l(e,t,n){let r=e.indexOf(`#`),o=r===-1?e:e.slice(0,r),s=r===-1?void 0:e.slice(r+1),c=n[o];if(!c||!t[c])return null;let l=t[c];return i(l,s)??(a(l),null)}function u(e,t){let n=t[`~clientComponents`]||{},r=t[`~clientComponentPaths`]||{},i=t[`~clientComponentNames`]||{},a=o(e,n);if(a!==null)return a;let s=c(e,n,r);return s===null?l(e,n,i):s}function d(e){return u(e,globalThis)}function f(e){return e.startsWith(`./`)?[e,e.slice(2)]:[e,`./${e}`]}async function p(e){let n=globalThis[`~clientComponents`]||{},r=globalThis[`~clientComponentPaths`]||{},i=globalThis[`~clientComponentNames`]||{},a=e.indexOf(`#`),o=a===-1?e:e.slice(0,a),s=a===-1?void 0:e.slice(a+1),c=n[o];if(c)return await t(c,s);let l=f(o);for(let e of l){let i=r[e];if(i&&(c=n[i],c))return await t(c,s)}let u=i[o];return u&&(c=n[u],c)?await t(c,s):null}export{p as n,r,d as t};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as Metadata, l as LayoutProps, p as PageProps } from "./types-
|
|
2
|
-
import { a as SitemapImage, i as SitemapEntry, n as RobotsRule, o as SitemapVideo, r as Sitemap, t as Robots } from "./metadata-route-
|
|
3
|
-
import { c as RariURL, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-
|
|
1
|
+
import { d as Metadata, l as LayoutProps, p as PageProps } from "./types-Cfe0C3JU.mjs";
|
|
2
|
+
import { a as SitemapImage, i as SitemapEntry, n as RobotsRule, o as SitemapVideo, r as Sitemap, t as Robots } from "./metadata-route-BDdxZuGv.mjs";
|
|
3
|
+
import { c as RariURL, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-BhqnAV4k.mjs";
|
|
4
4
|
import { RariRequest } from "./proxy/RariRequest.mjs";
|
|
5
5
|
import { RariResponse } from "./proxy/RariResponse.mjs";
|
|
6
6
|
export { type LayoutProps, type Metadata, type PageProps, type ProxyConfig, type ProxyFunction, type RariFetchEvent, RariRequest, RariResponse, type RariURL, type Robots, type RobotsRule, type Sitemap, type SitemapEntry, type SitemapImage, type SitemapVideo };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/proxy/
|
|
1
|
+
//#region src/proxy/shared/utils.d.ts
|
|
2
2
|
interface SimpleRequest {
|
|
3
3
|
url: string;
|
|
4
4
|
method: string;
|
|
@@ -11,14 +11,16 @@ interface SimpleProxyResult {
|
|
|
11
11
|
permanent: boolean;
|
|
12
12
|
};
|
|
13
13
|
rewrite?: string;
|
|
14
|
-
requestHeaders?: Record<string, string>;
|
|
15
|
-
responseHeaders?: Record<string, string>;
|
|
14
|
+
requestHeaders?: Record<string, string | string[]>;
|
|
15
|
+
responseHeaders?: Record<string, string | string[]>;
|
|
16
16
|
response?: {
|
|
17
17
|
status: number;
|
|
18
|
-
headers: Record<string, string>;
|
|
18
|
+
headers: Record<string, string | string[]>;
|
|
19
19
|
body?: string;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/proxy/runtime-executor.d.ts
|
|
22
24
|
declare global {
|
|
23
25
|
interface GlobalThis {
|
|
24
26
|
'~rariExecuteProxy'?: (request: SimpleRequest) => Promise<SimpleProxyResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){if(!e)return null;let t=e.headers?.get?.(`x-rari-proxy-rewrite`);return t?{continue:!1,rewrite:t}:null}function t(e){if(!e||e.status==null)return null;let t=e.headers?.get?.(`location`);return t&&e.status>=300&&e.status<400?{continue:!1,redirect:{destination:t,permanent:e.status===301||e.status===308}}:null}function n(e,t,n){if(Object.hasOwn(e,t)){let r=e[t];e[t]=Array.isArray(r)?[...r,n]:[r,n]}else e[t]=n}function r(e){let t={},r={};return e?.forEach&&e.forEach((e,i)=>{let a=i.toLowerCase();a.startsWith(`x-rari-proxy-request-`)?n(t,a.replace(`x-rari-proxy-request-`,``),e):a.startsWith(`x-rari-proxy-`)||n(r,a,e)}),{requestHeaders:Object.keys(t).length>0?t:void 0,responseHeaders:Object.keys(r).length>0?r:void 0}}function i(e){let{requestHeaders:t,responseHeaders:n}=r(e.headers);return{continue:!0,requestHeaders:t,responseHeaders:n}}async function a(e){let t={};e.headers?.forEach&&e.headers.forEach((e,r)=>{n(t,r.toLowerCase(),e)});let r;try{e.text&&typeof e.text==`function`?r=await e.text():e.body!=null&&typeof e.body==`string`?r=e.body:e.body!=null&&console.warn(`[rari] Proxy: Response body is not extractable as text`)}catch(e){console.error(`[rari] Proxy: Failed to extract response body:`,e)}return{continue:!1,response:{status:e.status??200,headers:t,body:r}}}async function o(n){return n?e(n)||t(n)||(n.headers?.get?.(`x-rari-proxy-continue`)===`true`?i(n):n.status==null?{continue:!0}:await a(n)):{continue:!0}}async function s(e,t){try{let n=await import(e);if(!n||!n.proxy)return console.error(`[rari] Proxy: proxy function not found in module`),!1;let{RariRequest:r}=await import(t);return globalThis[`~rariExecuteProxy`]=async function(e){try{let t=new r(e.url,{method:e.method,headers:new Headers(e.headers)}),i=[],a=await n.proxy(t,{waitUntil:e=>{e.catch(()=>{}),i.push(e)}});return i.length>0&&Promise.allSettled(i).then(e=>{e.forEach((e,t)=>{e.status===`rejected`&&console.error(`[rari] Proxy: waitUntil promise ${t} failed:`,e.reason)})}),await o(a)}catch(e){return console.error(`[rari] Proxy: Proxy execution error:`,e),{continue:!0}}},!0}catch(e){return console.error(`[rari] Proxy: Failed to initialize proxy executor:`,e),!1}}export{s as initializeProxyExecutor};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BGFxUpBh-CWvq2hOR.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
|
+
builder = "RAILPACK"
|
|
3
|
+
|
|
4
|
+
[deploy]
|
|
5
|
+
startCommand = "npm start"
|
|
6
|
+
healthcheckPath = "/"
|
|
7
|
+
healthcheckTimeout = 300
|
|
8
|
+
restartPolicyType = "ON_FAILURE"
|
|
9
|
+
restartPolicyMaxRetries = 3
|
|
10
|
+
`)}function m(e){let t=l(e,`README.md`),n=`
|
|
11
|
+
## 🚂 Deploy to Railway
|
|
12
|
+
|
|
13
|
+
This rari application is configured for Railway deployment.
|
|
14
|
+
|
|
15
|
+
### Quick Deploy
|
|
16
|
+
|
|
17
|
+
1. **Push to GitHub**:
|
|
18
|
+
\`\`\`bash
|
|
19
|
+
git add .
|
|
20
|
+
git commit -m "Add Railway deployment"
|
|
21
|
+
git push origin main
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
2. **Deploy to Railway**:
|
|
25
|
+
- Go to [railway.app](https://railway.app)
|
|
26
|
+
- Create new project → "Deploy from GitHub repo"
|
|
27
|
+
- Select your repository
|
|
28
|
+
- Click "Deploy Now"
|
|
29
|
+
|
|
30
|
+
3. **Generate Domain**:
|
|
31
|
+
- In Railway dashboard → Settings → Networking
|
|
32
|
+
- Click "Generate Domain"
|
|
33
|
+
- Your app will be live! 🎉
|
|
34
|
+
|
|
35
|
+
### Local Development
|
|
36
|
+
|
|
37
|
+
\`\`\`bash
|
|
38
|
+
# Development server
|
|
39
|
+
npm run start:local
|
|
40
|
+
|
|
41
|
+
# Production simulation
|
|
42
|
+
npm start
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
### Environment Variables
|
|
46
|
+
|
|
47
|
+
Railway automatically provides:
|
|
48
|
+
- \`PORT\` - Server port (Railway assigns this)
|
|
49
|
+
- \`NODE_ENV=production\` - Production mode
|
|
50
|
+
|
|
51
|
+
Optional variables you can set:
|
|
52
|
+
- \`RUST_LOG=debug\` - Rust logging level
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
`;if(o(t)){let e=s(t,`utf-8`);e.includes(`Deploy to Railway`)||(c(t,e+n),r(`Updated README.md with Railway deployment instructions`))}else c(t,`# My rari App
|
|
56
|
+
|
|
57
|
+
A high-performance React Server Components application powered by rari.
|
|
58
|
+
${n}
|
|
59
|
+
## Getting Started
|
|
60
|
+
|
|
61
|
+
\`\`\`bash
|
|
62
|
+
npm install
|
|
63
|
+
npm start
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
Visit [http://localhost:3000](http://localhost:3000) to see your app.
|
|
67
|
+
`),r(`Created README.md with Railway deployment instructions`)}function h(){console.warn(``),r(`Railway deployment setup complete! 🎉`),console.warn(``),e(`Next steps:`),console.warn(` 1. ${d(`cyan`,`git add .`)}`),console.warn(` 2. ${d(`cyan`,`git commit -m "Add Railway deployment"`)}`),console.warn(` 3. ${d(`cyan`,`git push origin main`)}`),console.warn(` 4. Go to ${d(`cyan`,`https://railway.app`)} and deploy from GitHub`),console.warn(``),e(`Your rari app will automatically:`),console.warn(` ✅ Detect Railway environment`),console.warn(` ✅ Bind to 0.0.0.0 (Railway requirement)`),console.warn(` ✅ Use Railway's PORT environment variable`),console.warn(` ✅ Run in production mode`),console.warn(` ✅ Download platform-specific rari binary`),console.warn(``),r(`Ready for deployment! 🚀`)}export{f as createRailwayDeployment};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BGFxUpBh-CWvq2hOR.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
|
+
- type: web
|
|
3
|
+
name: rari-app
|
|
4
|
+
runtime: node
|
|
5
|
+
env: node
|
|
6
|
+
plan: free
|
|
7
|
+
buildCommand: npm install
|
|
8
|
+
startCommand: npm start
|
|
9
|
+
healthCheckPath: /
|
|
10
|
+
envVars:
|
|
11
|
+
- key: NODE_ENV
|
|
12
|
+
value: production
|
|
13
|
+
- key: RUST_LOG
|
|
14
|
+
value: info
|
|
15
|
+
`)}function m(e){let t=l(e,`README.md`),n=`
|
|
16
|
+
## 🎨 Deploy to Render
|
|
17
|
+
|
|
18
|
+
This rari application is configured for Render deployment.
|
|
19
|
+
|
|
20
|
+
### Quick Deploy
|
|
21
|
+
|
|
22
|
+
1. **Push to GitHub**:
|
|
23
|
+
\`\`\`bash
|
|
24
|
+
git add .
|
|
25
|
+
git commit -m "Add Render deployment"
|
|
26
|
+
git push origin main
|
|
27
|
+
\`\`\`
|
|
28
|
+
|
|
29
|
+
2. **Deploy to Render**:
|
|
30
|
+
- Go to [render.com](https://render.com)
|
|
31
|
+
- Create new "Web Service"
|
|
32
|
+
- Connect your GitHub repository
|
|
33
|
+
- Render will auto-detect Node.js and use the configuration from \`render.yaml\`
|
|
34
|
+
- Click "Create Web Service"
|
|
35
|
+
|
|
36
|
+
3. **Your app will be live!** 🎉
|
|
37
|
+
- Render provides a \`.onrender.com\` URL
|
|
38
|
+
- Optional: Add custom domain in Render dashboard
|
|
39
|
+
|
|
40
|
+
### Local Development
|
|
41
|
+
|
|
42
|
+
\`\`\`bash
|
|
43
|
+
# Development server
|
|
44
|
+
npm run start:local
|
|
45
|
+
|
|
46
|
+
# Production simulation
|
|
47
|
+
npm start
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
### Environment Variables
|
|
51
|
+
|
|
52
|
+
Render automatically provides:
|
|
53
|
+
- \`PORT\` - Server port (Render assigns this)
|
|
54
|
+
- \`NODE_ENV=production\` - Production mode (from render.yaml)
|
|
55
|
+
- \`RUST_LOG=info\` - Rust logging level (from render.yaml)
|
|
56
|
+
|
|
57
|
+
Optional variables you can add in Render dashboard:
|
|
58
|
+
- \`RUST_LOG=debug\` - Enhanced logging
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
`;if(o(t)){let e=s(t,`utf-8`);e.includes(`Deploy to Render`)||(c(t,e+n),r(`Updated README.md with Render deployment instructions`))}else c(t,`# My rari App
|
|
62
|
+
|
|
63
|
+
A high-performance React Server Components application powered by rari.
|
|
64
|
+
${n}
|
|
65
|
+
## Getting Started
|
|
66
|
+
|
|
67
|
+
\`\`\`bash
|
|
68
|
+
npm install
|
|
69
|
+
npm start
|
|
70
|
+
\`\`\`
|
|
71
|
+
|
|
72
|
+
Visit [http://localhost:3000](http://localhost:3000) to see your app.
|
|
73
|
+
`),r(`Created README.md with Render deployment instructions`)}function h(){console.warn(``),r(`Render deployment setup complete! 🎉`),console.warn(``),e(`Next steps:`),console.warn(` 1. ${d(`cyan`,`git add .`)}`),console.warn(` 2. ${d(`cyan`,`git commit -m "Add Render deployment"`)}`),console.warn(` 3. ${d(`cyan`,`git push origin main`)}`),console.warn(` 4. Go to ${d(`cyan`,`https://render.com`)} and create a Web Service`),console.warn(``),e(`Your rari app will automatically:`),console.warn(` ✅ Detect Render environment`),console.warn(` ✅ Bind to 0.0.0.0 (Render requirement)`),console.warn(` ✅ Use Render's PORT environment variable`),console.warn(` ✅ Run in production mode`),console.warn(` ✅ Download platform-specific rari binary`),console.warn(``),r(`Ready for deployment! 🚀`)}export{f as createRenderDeployment};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{promises as e}from"node:fs";import t from"node:path";import{Buffer as n}from"node:buffer";function r(e){return Array.isArray(e)?e:e?[e]:[`*`]}function i(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).filter(e=>e!==``)}function a(e){let t=[],n=r(e.userAgent);for(let r of n){t.push(`User-Agent: ${r}`);let n=i(e.allow);for(let e of n)t.push(`Allow: ${e}`);let a=i(e.disallow);for(let e of a)t.push(`Disallow: ${e}`);e.crawlDelay!==void 0&&t.push(`Crawl-delay: ${e.crawlDelay}`),t.push(``)}return t}function o(e){return e?[`Host: ${e}`,``]:[]}function s(e){return i(e).map(e=>`Sitemap: ${e}`)}function c(e){let t=[],n=Array.isArray(e.rules)?e.rules:[e.rules];for(let e of n)t.push(...a(e));return t.push(...o(e.host)),t.push(...s(e.sitemap)),t.join(`
|
|
2
|
+
`)}async function l(n,r=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`]){let i=t.join(n,`robots.txt`);try{return await e.access(i),{type:`static`,path:i}}catch(e){if(e?.code!==`ENOENT`)throw e}for(let i of r){let r=t.join(n,`robots${i}`);try{return await e.access(r),{type:`dynamic`,path:r}}catch(e){if(e?.code!==`ENOENT`)throw e}}return null}async function u(r){let{appDir:i,outDir:a,extensions:o}=r,s=await l(i,o);if(!s)return!1;let u=t.join(a,`robots.txt`);if(await e.mkdir(t.dirname(u),{recursive:!0}),s.type===`static`)return await e.copyFile(s.path,u),!0;try{let{build:r}=await import(`rolldown`),i=await e.readFile(s.path,`utf-8`),a=`\0virtual:robots`,o=await r({input:a,external:[`rari`],platform:`node`,write:!1,output:{format:`esm`,codeSplitting:!1},plugins:[{name:`virtual-robots`,resolveId(e){return e===a?e:e.startsWith(`.`)?t.resolve(t.dirname(s.path),e):null},load(e){if(e===a){let e=t.extname(s.path).slice(1),n;switch(e){case`ts`:n=`ts`;break;case`tsx`:n=`tsx`;break;case`js`:case`mjs`:case`cjs`:n=`js`;break;case`jsx`:n=`jsx`;break;default:throw Error(`Unsupported robots file extension: .${e}. Supported extensions are: .ts, .tsx, .js, .jsx, .mjs, .cjs`)}return{code:i,moduleType:n}}return null}}]});if(!o.output||o.output.length===0)throw Error(`Failed to build robots module`);let l=o.output.find(e=>e.type===`chunk`&&e.isEntry)||o.output.find(e=>e.type===`chunk`);if(!l||l.type!==`chunk`)throw Error(`No chunk output found in robots build result`);let d=l.code,f=await import(`data:text/javascript;base64,${n.from(d).toString(`base64`)}`);if(!f||f.default==null)throw Error(`Robots file must export a default export (either an object or a function)`);let p;if(typeof f.default==`function`){let e=f.default();p=e instanceof Promise?await e:e}else p=f.default;let m=c(p);return await e.writeFile(u,m),!0}catch(e){return console.error(`[rari] Failed to build/execute robots file:`,e),!1}}export{u as generateRobotsFile};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{S as e,b as t}from"../regex-constants-DOQkuGm5.mjs";import{t as n}from"../preload-components-
|
|
1
|
+
"use client";import{S as e,b as t}from"../regex-constants-DOQkuGm5.mjs";import{t as n}from"../preload-components-DD3aKUwy.mjs";import*as r from"react";import{Suspense as i,useEffect as a,useRef as o,useState as s,useTransition as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";const f=/"timestamp":(\d+)/,p=/^[;\s]*$/;function m(){return d(`div`,{style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:9999},children:[u(`div`,{style:{width:`40px`,height:`40px`,border:`4px solid rgba(0, 0, 0, 0.1)`,borderTopColor:`#3b82f6`,borderRadius:`50%`,animation:`spin 1s linear infinite`}}),u(`style`,{children:`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
to { transform: rotate(360deg); }
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{t as e}from"../timer-utils-BO5HIsHv.mjs";import{Component as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";var i=class extends t{_isMounted=!1;_pendingTimer=null;constructor(e){super(e),this.state={hasError:!1,error:null,ErrorComponent:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidMount(){this._isMounted=!0}componentWillUnmount(){this._isMounted=!1,this._pendingTimer=e(this._pendingTimer)}componentDidCatch(e,t){console.error(`[rari] Error boundary caught error:`,e,t);let n=this.props.errorComponentId;if(n&&typeof window<`u`){let e=window[`~clientComponents`]?.[n];e&&(e.component&&typeof e.component==`function`?this.setState({ErrorComponent:e.component}):e.loader&&!e.loading&&(e.loading=!0,e.loader().then(t=>{let n=t.default||t;e.component=n,e.registered=!0,e.loading=!1,this.setState({ErrorComponent:n})}).catch(t=>{e.loading=!1,console.error(`[rari] Failed to load error component ${n}:`,t)})))}}reset=()=>{this._pendingTimer=e(this._pendingTimer),this._pendingTimer=setTimeout(()=>{this._isMounted&&this.setState({hasError:!1,error:null,ErrorComponent:null}),this._pendingTimer=null},50)};render(){if(this.state.hasError&&this.state.error){let{ErrorComponent:e}=this.state;return e?n(e,{error:this.state.error,reset:this.reset}):r(`div`,{style:{padding:`20px`,background:`#fee`,border:`2px solid #f00`},children:[n(`h2`,{children:`Error`}),n(`p`,{children:`Something went wrong.`})]})}return this.props.children}};export{i as ErrorBoundaryWrapper};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../regex-constants-DOQkuGm5.mjs";import{n as e,t}from"../get-client-component-
|
|
1
|
+
import"../regex-constants-DOQkuGm5.mjs";import{n as e,t}from"../get-client-component-YrjzU6RI.mjs";import*as n from"react";import"react";import{ClientRouter as r}from"rari/client";import{RouterProvider as i}from"rari/router";import{createRoot as a}from"react-dom/client";import{AppRouterProvider as o}from"virtual:app-router-provider";import{createFromReadableStream as s}from"virtual:react-server-dom-rari-client.ts";import"virtual:rsc-integration.ts";function c(){return globalThis[`~rari`]}function l(){return globalThis}function u(){return window}function d(){return{moduleMap:new Proxy({},{get(e,t){return new Proxy({},{get(e,n){return{id:`${String(t)}#${String(n)}`,chunks:[],name:String(n)}}})}}),moduleLoading:new Proxy({},{get(e,t){return new Proxy({},{get(e,n){return async()=>{try{let e=String(t),r=String(n),i=`${e}#${r}`;if(l()[`~clientComponents`]?.[i]?.component)return l()[`~clientComponents`][i].component;if(l()[`~clientComponents`]?.[e]?.component){let t=l()[`~clientComponents`][e].component;return r===`default`?t:t?.[r]}let a=l()[`~clientComponents`]?.[i]||l()[`~clientComponents`]?.[e];if(a?.loader){a.loadPromise||=(a.loading=!0,a.loader().then(e=>(a.component=e.default||e,a.registered=!0,a.loading=!1,e)).catch(t=>{throw a.loading=!1,a.loadPromise=void 0,console.error(`[rari] Failed to lazy load ${e}#${r}:`,t),t}));let t=await a.loadPromise,n=t.default||t;return r===`default`?n:n?.[r]??n}return console.warn(`[rari] Module ${e}#${r} not found in client components registry`),null}catch(e){return console.error(`[rari] Failed to load ${String(t)}#${String(n)}:`,e),null}}}})}})}}c()===void 0&&(globalThis[`~rari`]={}),c().AppRouterProvider=o,c().ClientRouter=r,c().getClientComponent=t;async function f(t){try{await e(t)}catch(e){console.error(`[rari] Failed to preload component ${t}:`,e)}}
|
|
2
2
|
/*! @preserve CLIENT_COMPONENT_IMPORTS_PLACEHOLDER */
|
|
3
3
|
c().preloadClientComponent=f,l()[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={}),l()[`~clientComponentPaths`]===void 0&&(globalThis[`~clientComponentPaths`]={});
|
|
4
4
|
/*! @preserve CLIENT_COMPONENT_REGISTRATIONS_PLACEHOLDER */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as e,t,w as n}from"../regex-constants-DOQkuGm5.mjs";import{r}from"../get-client-component-
|
|
1
|
+
import{b as e,t,w as n}from"../regex-constants-DOQkuGm5.mjs";import{r}from"../get-client-component-YrjzU6RI.mjs";import{t as i}from"../preload-components-DD3aKUwy.mjs";import*as a from"react";async function o(e,t={}){let{moduleMap:n={}}=t,r=e.getReader(),a=[];for(;;){let{done:e,value:t}=await r.read();if(e)break;a.push(t)}let o=new Uint8Array(a.reduce((e,t)=>e+t.length,0)),s=0;for(let e of a)o.set(e,s),s+=e.length;let l=c(new TextDecoder().decode(o));return await i(l.modules),u(l.rootElement,l.modules,n,l.symbols,l.chunks)}async function s(e,t={}){let n=c(await(await e).text());return await i(n.modules),u(n.rootElement,n.modules,t.moduleMap||{},n.symbols,n.chunks)}function c(e){let t=new Map,n=new Map,r=new Map,i=0,a=0,o=0,s=0,c=``,u=null;for(;i<e.length;){let d=e[i],f=e.charCodeAt(i);switch(a){case 0:d===`:`?(a=1,i++):(f>=48&&f<=57?o=o<<4|f-48:f>=97&&f<=102?o=o<<4|f-87:f>=65&&f<=70&&(o=o<<4|f-55),i++);break;case 1:f===73||f===69||f===84||f===72||f===68||f===87||f===67?(s=f,a=2,i++):(s=0,a=2);break;case 2:d===`
|
|
2
2
|
`?(l(o,s,c,t,n,r),u===null&&s!==73&&c.trim()&&!(c.startsWith(`"$S`)&&c.endsWith(`"`))&&n.has(o.toString())&&(u=o.toString()),a=0,o=0,s=0,c=``):c+=d,i++;break}}return c.trim()&&(l(o,s,c,t,n,r),u===null&&s!==73&&!(c.startsWith(`"$S`)&&c.endsWith(`"`))&&n.has(o.toString())&&(u=o.toString())),{modules:t,chunks:n,symbols:r,rootElement:u===null?null:n.get(u)}}function l(e,t,n,r,i,a){let o=e.toString();try{switch(t){case 73:{let e=JSON.parse(n);Array.isArray(e)&&e.length>=3&&r.set(`$L${o}`,{id:e[0],chunks:e[1]||[],name:e[2]||`default`});break}case 69:{console.error(`[rari] RSC: Error chunk:`,n);let e=JSON.parse(n);i.set(o,{error:e});break}case 84:i.set(o,n);break;case 72:case 68:case 87:break;case 67:break;default:{if(!n.trim())break;if(n.startsWith(`"$S`)&&n.endsWith(`"`)){let e=n.slice(1,-1);a.set(o,e);break}let e=JSON.parse(n);i.set(o,e);break}}}catch(e){console.error(`[rari] RSC: Failed to parse row:`,{id:o,tag:t,data:n},e)}}function u(t,n,r,i,o){if(!t)return null;if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`){if(typeof t==`string`&&t.startsWith(`$`)&&t.length>1){if(t[1]===`L`){let e=t.slice(2),a=o?.get(e);if(!a){let e=new Promise(()=>{});throw e._rscLazyRef=t,e}return u(a,n,r,i,o)}let e=t.slice(1),a=o?.get(e);return a?u(a,n,r,i,o):null}return t}if(Array.isArray(t)){if(t.length>=4&&t[0]===`$`){let[,s,c,l]=t;if(typeof s==`string`&&s.startsWith(`$`)&&s.length>1&&e.test(s.slice(1))){let e=s.slice(1),t=i?.get(e);if(t&&t.startsWith(`$S`)&&t.slice(2)===`react.suspense`){let e=f(l,n,r,i,o);return a.createElement(a.Suspense,c?{...e,key:c}:e)}}if(typeof s==`string`&&s.startsWith(`$S`)){if(s.slice(2)===`react.suspense`){let e=f(l,n,r,i,o);return a.createElement(a.Suspense,c?{...e,key:c}:e)}return null}if(typeof s==`string`&&s.startsWith(`$L`)){let e=s.substring(2);if(e===`ClientRouter`&&(!l||!l.manifest))return l&&l.children?u(l.children,n,r,i,o):null;let t=d(e,n,r);if(t){let e=f(l,n,r,i,o);return a.createElement(t,c?{...e,key:c}:e)}return null}let p=f(l,n,r,i,o);return a.createElement(s,c?{...p,key:c}:p)}return t.map(e=>u(e,n,r,i,o))}return t}function d(e,i,a){if(e===`AppRouterProvider`){let e=globalThis[`~rari`]?.AppRouterProvider;if(e)return e}if(e===`ClientRouter`){let e=globalThis[`~rari`]?.ClientRouter;if(e)return e}if(i&&i.size>0){let a=`$L${e}`,o=i.get(a);if(o){let e=globalThis[`~clientComponents`]||{},i=[o.id,`${o.id}#${o.name||`default`}`,o.id.replace(n,``),o.id.replace(t,`/`)];for(let t of i){let n=e[t];if(n){if(n.component)return n.component;if(n.loader&&!n.loading)return r(n,o.id);if(n.loading)return null}}console.warn(`[rari] Component not found in registry:`,{moduleId:o.id,moduleName:o.name,triedKeys:i,availableKeys:Object.keys(e).slice(0,10)})}}if(a[e])return a[e];let o=globalThis[`~clientComponents`]||{};for(let[t,n]of Object.entries(o)){let i=t===e,a=t.endsWith(`/${e}`)||t.endsWith(`\\${e}`),o=t.endsWith(`#${e}`),s=n.name===e;if(i||a||o||s){if(n.component)return n.component;if(n.loader&&!n.loading)return r(n,t)}}return null}function f(e,t,n,r,i){if(!e||typeof e!=`object`)return e;let a={};for(let o in e)if(Object.hasOwn(e,o)){if(o.startsWith(`~`)||o===`ref`)continue;o===`children`?a[o]=e.children?u(e.children,t,n,r,i):void 0:a[o]=e[o]}return a}function p(e){return JSON.stringify(e)}function m(e){return JSON.parse(e)}export{s as createFromFetch,o as createFromReadableStream,m as decodeReply,p as encodeReply};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,d as t,g as n,h as r,m as i,n as a,p as o,y as s}from"../regex-constants-DOQkuGm5.mjs";import{t as c}from"../get-client-component-
|
|
1
|
+
import{_ as e,d as t,g as n,h as r,m as i,n as a,p as o,y as s}from"../regex-constants-DOQkuGm5.mjs";import{t as c}from"../get-client-component-YrjzU6RI.mjs";import"../preload-components-DD3aKUwy.mjs";import{createFromFetch as l,createFromReadableStream as u}from"./react-server-dom-rari-client.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`}if(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),globalThis[`~rari`].processBoundaryUpdate=function(t,s,c){let l=document.querySelector(`[data-boundary-id="${t}"]`);if(l)try{let u=s.indexOf(`:`);if(u===-1){console.warn(`[rari] Invalid RSC row format (no colon):`,s);return}let d=s.substring(0,u),f=s.substring(u+1);if(f.startsWith(`I[`)){try{let e=JSON.parse(f.substring(1));if(Array.isArray(e)&&e.length>=3){let[t,n,r]=e,i=`$L${d}`;window[`~rari`].boundaryModules?.set(i,{id:t,chunks:Array.isArray(n)?n:[n],name:r||`default`})}}catch(e){console.error(`[rari] Failed to parse import row:`,f,e)}return}let p;try{p=JSON.parse(f)}catch(e){console.error(`[rari] Failed to parse RSC content:`,f,e);return}function m(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 m(n.children)}return e.some(e=>m(e))}return!1}if(m(p)){if(window[`~rari`].pendingBoundaryHydrations?.set(t,{content:p,element:l,rowId:c}),globalThis[`~rari`].hydrateClientComponents){let e=globalThis[`~rari`].hydrateClientComponents;e(t,p,l)}return}function h(t){let s=t=>t.replace(o,`&`).replace(n,`<`).replace(r,`>`).replace(e,`"`).replace(i,`'`),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(!t)return``;if(typeof t==`string`||typeof t==`number`)return s(String(t));if(Array.isArray(t)){if(t.length>=4&&t[0]===`$`){let[,e,,n]=t,r=typeof e==`string`&&c.has(e.toLowerCase())?e.toLowerCase():`div`,i=null,o=``,l=``;if(n){for(let[e,t]of Object.entries(n))if(e===`dangerouslySetInnerHTML`&&t&&typeof t==`object`&&`__html`in t)i=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(a,`$1-$2`).toLowerCase()}:${String(t)}`).join(`;`);l+=` style="${s(e)}"`}else typeof t==`string`||typeof t==`number`?l+=` ${n}="${s(String(t))}"`:typeof t==`boolean`&&t&&(l+=` ${n}`)}i===null&&n.children&&(o=h(n.children))}return`<${r}${l}>${i===null?o:i}</${r}>`}return t.map(h).join(``)}return``}let g=h(p);g&&requestAnimationFrame(()=>{let e=document.contains(l);e&&(l.innerHTML=g,l.classList.add(`rari-boundary-resolved`)),window.dispatchEvent(new CustomEvent(`rari:boundary-resolved`,{detail:{boundaryId:t,rscRow:s,rowId:c,element:l,wasAttached:e}}))})}catch(e){console.error(`[rari] Error processing boundary update:`,e)}};let t=window,s=globalThis;t[`~rari`].streaming?.bufferedEvents&&t[`~rari`].streaming.bufferedEvents.length>0&&(t[`~rari`].streaming.bufferedEvents.forEach(e=>{let{boundaryId:t,rscRow:n,rowId:r}=e;s[`~rari`].processBoundaryUpdate?.(t,n,r)}),t[`~rari`].streaming.bufferedEvents=[]),window.addEventListener(`rari:boundary-update`,e=>{let{boundaryId:t,rscRow:n,rowId:r}=e.detail;s[`~rari`].processBoundaryUpdate&&s[`~rari`].processBoundaryUpdate(t,n,r)})}function x(e,n,r){let i=r===`default`?e.name||n.split(`/`).pop()?.replace(t,``)||`DefaultComponent`:r,a=i,o={id:a,path:n,type:`client`,component:e,registered:!0};globalThis[`~clientComponents`][a]=o,globalThis[`~clientComponents`][n]=o,globalThis[`~clientComponentPaths`][n]=a,globalThis[`~clientComponentNames`][i]=a,e&&(e[`~isClientComponent`]=!0,e[`~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 S(e){return c(e)}function C(){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 w=l,T=u,E=null;async function D(){return E||(E=(async()=>{try{return w=l,T=u,typeof T!=`function`&&(T=null),typeof w!=`function`&&(w=null),y}catch(e){return console.error(`Failed to load react-dom/client RSC functions:`,e),w=null,T=null,null}})(),E)}const O=new Map,k=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(),O.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 D();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>=3&&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=S(`${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=S(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,x=``,C=null,w=async()=>{try{for(;;){let{value:e,done:t}=await s.read();if(t)break;let n=c.decode(e,{stream:!0});x+=n;let r=x.split(`
|
|
2
2
|
`),i=r.slice(0,-1);x=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);if(r.startsWith(`I[`))try{let e=JSON.parse(r.substring(1));if(Array.isArray(e)&&e.length>=3){let[t,r,i]=e;l.set(`$L${n}`,{id:t,chunks:Array.isArray(r)?r:[r],name:i||`default`})}}catch(e){console.error(`Failed to parse import row:`,r,e)}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),C&&C.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),C&&typeof C.updateRoot==`function`&&C.updateRoot())}}}catch(t){console.error(`Failed to parse stream line:`,e,t)}}}catch(e){console.error(`Error processing stream:`,e)}},T=()=>{let[,e]=v(0);_(()=>(C={updateBoundary:(t,n)=>{y.set(t,n),e(e=>e+1)},updateRoot:()=>{e(e=>e+1)}},()=>{C=null}),[]);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)};w();let E=Promise.resolve(m(T));return{"~isRscResponse":!0,"~rscPromise":E,readRoot(){return E}}}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 D(),w)try{let t=w(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(s),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{if(o.startsWith(`I[`)){let e=o.substring(1),t=JSON.parse(e);if(Array.isArray(t)&&t.length>=3){let[e,r,i]=t;n.set(`$L${a}`,{id:e,chunks:Array.isArray(r)?r:[r],name:i||`default`})}}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 a=null,o=r.keys().toSorted((e,t)=>Number.parseInt(e)-Number.parseInt(t));for(let e of o){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;a=t;break}}return a?this.reconstructElementFromRscData(a,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=S(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=S(`${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 A({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 j({rootPromise:e}){return g(e)}function M({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(!O.has(i)){let n=k.fetchServerComponent(e,t).catch(e=>{throw O.delete(i),e});O.set(i,n)}let a=g(O.get(i));if(a?.[`~isRscResponse`]){let e=a.readRoot();return m(f,{fallback:n??null},m(j,{rootPromise:e}))}return a??null}var N=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(A,{error:this.state.error?.message||`Unknown error`,details:{componentId:this.props.componentId}}):this.props.children}};function P(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&&I(n.filePath)&&(k.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(N,{componentId:e,mountKey:r},m(M,{key:`${e}-${r}`,componentId:e,props:n,fallback:null})))};return n.displayName=`ServerComponent(${e})`,function(e){return m(n,e)}}function F(e,t){return k.fetchServerComponent(e,t)}function I(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&&I(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&&I(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&&(k.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){k.clearCache();return}let t=[];for(let n of k.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)k.componentCache.delete(e),O.delete(e);let n=[];for(let t of O.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)O.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(k.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 L=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 R=null;function z(){return R||=new L,R}if(import.meta.hot){let e=z();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{A as RscErrorComponent,C as createClientModuleMap,P as createServerComponentWrapper,F as fetchServerComponent,S as getClientComponent,x as registerClientComponent,k as rscClient};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import*as e from"react";import{Component as t,Suspense as n}from"react";function r(e,t){e&&(e.notFound&&(t.notFound=!0),e.redirect&&(t.redirect=typeof e.redirect==`string`?e.redirect:e.redirect.destination),e.revalidate!==void 0&&(t.revalidate=e.revalidate),e.props&&(t.props={...t.props,...e.props}))}async function i(e,t,n,i){typeof e.getData==`function`&&r(await e.getData({params:t,searchParams:n}),i)}async function a(e,t,n,i){typeof e.getServerSideProps==`function`&&r(await e.getServerSideProps({params:t,searchParams:n}),i)}async function o(e,t,n){typeof e.getStaticProps==`function`&&r(await e.getStaticProps({params:t}),n)}async function s(e,t,n){try{let r=await import(e),s={props:{}};return await i(r,t,n,s),await a(r,t,n,s),await o(r,t,s),s}catch(t){return console.error(`[rari] Router: Failed to extract server props from ${e}:`,t),{props:{}}}}async function c(e,t,n){try{let r=await import(e);if(typeof r.generateMetadata==`function`){let e=await r.generateMetadata({params:t,searchParams:n});if(e&&typeof e==`object`)return e}return r.metadata&&typeof r.metadata==`object`?r.metadata:{}}catch(t){return console.error(`[rari] Router: Failed to extract metadata from ${e}:`,t),{}}}async function l(e){try{let t=await import(e);if(typeof t.generateStaticParams==`function`){let e=await t.generateStaticParams();if(Array.isArray(e))return e}return[]}catch(t){return console.error(`[rari] Router: Failed to extract static params from ${e}:`,t),[]}}async function u(e){try{let t=await import(e);return!!(t.getData||t.getServerSideProps||t.getStaticProps||t.generateMetadata||t.generateStaticParams)}catch{return!1}}const d=new Map;async function f(e,t,n,r=6e4){let i=`${e}:${JSON.stringify(t)}:${JSON.stringify(n)}`,a=d.get(i);if(a&&Date.now()-a.timestamp<r)return a.result;let o=await s(e,t,n);return d.set(i,{result:o,timestamp:Date.now()}),o}function p(){d.clear()}function m(e){for(let t of d.keys())t.startsWith(e)&&d.delete(t)}async function h(e){if(!e.ok){let t;try{t=await e.text()}catch{t=`<unable to read response body>`}let n=t.length>200?`${t.slice(0,200)}...`:t,r=Error(`HTTP ${e.status}: ${e.statusText}`);throw r.status=e.status,r.statusText=e.statusText,r.bodyPreview=n,r}}var g=class{baseUrl;timeout;components=[];initialized=!1;constructor(e={}){let{host:t=`127.0.0.1`,port:n=3e3,timeout:r=3e4,ssl:i=!1}=e;this.baseUrl=`${i?`https`:`http`}://${t}:${n}`,this.timeout=r}assertInitialized(){if(!this.initialized)throw Error(`Runtime client not initialized. Call initialize() first.`)}async request(e,t={}){let{method:n=`GET`,body:r,headers:i={}}=t,a=`${this.baseUrl}${e}`,o={method:n,headers:{"Content-Type":`application/json`,...i},signal:AbortSignal.timeout(this.timeout)};r&&(n===`POST`||n===`PUT`)&&(o.body=JSON.stringify(r));try{let e=await fetch(a,o);return await h(e),e.headers.get(`content-type`)?.includes(`application/json`)?await e.json():await e.text()}catch(e){if(e instanceof Error){if(e.name===`AbortError`)throw Error(`Request timeout after ${this.timeout}ms`);if(e.message.includes(`ECONNREFUSED`))throw Error(`Failed to connect to rari server at ${this.baseUrl}. Make sure the server is running.`)}throw e}}async initialize(){try{let e=await this.request(`/_rari/health`);if(e.status!==`healthy`)throw Error(`Server is not healthy: ${e.status}`);this.initialized=!0}catch(e){throw Error(`Failed to initialize runtime client: ${e}`)}}async registerComponent(e,t){this.assertInitialized();let n={component_id:e,component_code:t};try{let t=await this.request(`/_rari/register`,{method:`POST`,body:n});if(!t.success)throw Error(`Failed to register component: ${t.error||`Unknown error`}`);this.components.includes(e)||this.components.push(e)}catch(t){throw Error(`Failed to register component ${e}: ${t}`)}}async renderToStreamCallbacks(e,t){this.assertInitialized();let n={component_id:e,props:t?JSON.parse(t):void 0};try{let e=await fetch(`${this.baseUrl}/_rari/stream`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout)});return await h(e),e.body}catch(t){throw Error(`Failed to stream component ${e}: ${t}`)}}registerClientComponent(e,t,n){this.queueClientComponentRegistration(e,t,n)}async queueClientComponentRegistration(e,t,n){if(!this.initialized){console.error(`[rari] Runtime: Client not initialized. Client component registration will be delayed.`);return}let r={component_id:e,file_path:t,export_name:n};try{let e=await this.request(`/_rari/register-client`,{method:`POST`,body:r});if(!e.success)throw Error(`Failed to register client component: ${e.error||`Unknown error`}`)}catch(t){console.error(`[rari] Runtime: Failed to register client component ${e}:`,t)}}registerClientReference(e,t,n){this.queueClientComponentRegistration(e,t,n)}listComponents(){return[...this.components]}async shutdown(){try{this.initialized=!1,this.components=[]}catch(e){console.error(`[rari] Runtime: Error during shutdown:`,e)}}async getServerStatus(){return await this.request(`/_rari/status`)}async checkHealth(){return await this.request(`/_rari/health`)}isInitialized(){return this.initialized}getBaseUrl(){return this.baseUrl}};function _(e){return new g(e)}function v(t){return function({children:r}){return e.createElement(n,{fallback:t},r)}}var y=class extends t{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.hasError){let t=()=>this.setState({hasError:!1,error:null});return this.props.fallback?this.props.fallback(this.state.error,t):e.createElement(`div`,{style:{padding:`1rem`,border:`1px solid #ef4444`,borderRadius:`0.5rem`,backgroundColor:`#fef2f2`}},[e.createElement(`h2`,{style:{color:`#dc2626`,margin:`0 0 0.5rem 0`}},`Something went wrong`),e.createElement(`p`,{style:{color:`#991b1b`,margin:`0 0 1rem 0`}},this.state.error?.message||`An unexpected error occurred`),e.createElement(`button`,{onClick:t,style:{padding:`0.5rem 1rem`,backgroundColor:`#dc2626`,color:`white`,border:`none`,borderRadius:`0.25rem`,cursor:`pointer`}},`Try again`)])}return this.props.children}};function b(t){return function({children:n}){return e.createElement(y,{fallback:t},n)}}function x(){return e.createElement(`div`,{style:{padding:`2rem`,textAlign:`center`}},[e.createElement(`h1`,{style:{fontSize:`2rem`,margin:`0 0 1rem 0`}},`404 - Page Not Found`),e.createElement(`p`,{style:{color:`#6b7280`,margin:`0 0 1rem 0`}},`The page you're looking for doesn't exist.`),e.createElement(`button`,{onClick:()=>window.history.back(),style:{padding:`0.5rem 1rem`,backgroundColor:`#3b82f6`,color:`white`,border:`none`,borderRadius:`0.25rem`,cursor:`pointer`}},`Go back`)])}function S({size:t=`medium`}){let n={small:`1rem`,medium:`2rem`,large:`3rem`};return e.createElement(`div`,{style:{display:`inline-block`,width:n[t],height:n[t],border:`2px solid #e5e7eb`,borderTop:`2px solid #3b82f6`,borderRadius:`50%`,animation:`spin 1s linear infinite`}})}function C(){return e.createElement(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,padding:`2rem`,minHeight:`200px`}},e.createElement(S))}function w({error:t,reset:n}){return e.createElement(`div`,{style:{padding:`2rem`,border:`1px solid #ef4444`,borderRadius:`0.5rem`,backgroundColor:`#fef2f2`,textAlign:`center`}},[e.createElement(`h2`,{style:{color:`#dc2626`,margin:`0 0 1rem 0`}},`Something went wrong`),e.createElement(`p`,{style:{color:`#991b1b`,margin:`0 0 1rem 0`}},t.message||`An unexpected error occurred`),e.createElement(`button`,{onClick:n,style:{padding:`0.5rem 1rem`,backgroundColor:`#dc2626`,color:`white`,border:`none`,borderRadius:`0.25rem`,cursor:`pointer`}},`Try again`)])}if(typeof document<`u`){let e=document.createElement(`style`);e.textContent=`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
0% { transform: rotate(0deg); }
|
|
4
|
+
100% { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`,document.head.appendChild(e)}export{u as _,S as a,_ as c,p as d,m as f,l as g,f as h,g as i,v as l,s as m,C as n,x as o,c as p,y as r,b as s,w as t,h as u};
|