rari 0.17.7 → 0.17.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/cli.mjs +2 -1
  2. package/dist/{define-CuBTL1jt.mjs → define-Dsj1lR4C.mjs} +1 -1
  3. package/dist/{execute-DJ7w3uhW.mjs → execute-C7dN28Np.mjs} +1 -1
  4. package/dist/{feed-CfjUO7Zz.mjs → feed-DUwifKF8.mjs} +1 -1
  5. package/dist/font.mjs +1 -1
  6. package/dist/form-state-C9jn086j.mjs +1 -0
  7. package/dist/headers.mjs +1 -1
  8. package/dist/image.mjs +1 -1
  9. package/dist/mdx/define.mjs +1 -1
  10. package/dist/mdx.mjs +1 -1
  11. package/dist/navigate-CSQP4q53.mjs +1 -0
  12. package/dist/proxy/RariResponse.mjs +1 -1
  13. package/dist/{robots-C4JcczMZ.mjs → robots-BdSA0wq4.mjs} +1 -1
  14. package/dist/{route-cache-D2iIKQIU.mjs → route-cache-BfEqTT9i.mjs} +1 -1
  15. package/dist/{router-Cc9lVbtA.mjs → router-kf_rLP_F.mjs} +1 -1
  16. package/dist/router.mjs +1 -1
  17. package/dist/rsc-vite-build-DYAQzQ09.mjs +1 -0
  18. package/dist/runtime/AppRouterProvider.d.mts +2 -1
  19. package/dist/runtime/AppRouterProvider.mjs +1 -1
  20. package/dist/runtime/ClientRouter.mjs +1 -1
  21. package/dist/runtime/ErrorBoundaryWrapper.d.mts +2 -1
  22. package/dist/runtime/action-flight-refresh.mjs +1 -1
  23. package/dist/runtime/call-server.mjs +1 -1
  24. package/dist/runtime/entry-client.mjs +1 -1
  25. package/dist/runtime/merge-flight-refresh.mjs +1 -1
  26. package/dist/runtime/rsc-client-runtime.d.mts +2 -1
  27. package/dist/runtime/rsc-client-runtime.mjs +1 -1
  28. package/dist/{sitemap-BcUkIffd.mjs → sitemap-DIL-PFSt.mjs} +1 -1
  29. package/dist/vite.mjs +21 -21
  30. package/package.json +17 -17
  31. package/dist/form-state-DAygOjc8.mjs +0 -1
  32. package/dist/navigate-DuyUa6qD.mjs +0 -1
  33. package/dist/rsc-vite-build-Cyc5ad0S.mjs +0 -1
package/dist/cli.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import{b as e,d as t,x as n,y as r}from"./type-guards-BLY2PlGR.mjs";import{n as i,t as a}from"./dist-paths-C4EV064W.mjs";import{getBinaryPath as o,getInstallationInstructions as s}from"./platform.mjs";import{spawn as c}from"node:child_process";import{existsSync as l,readFileSync as u,readdirSync as d,realpathSync as f,rmSync as p}from"node:fs";import{basename as m,dirname as h,isAbsolute as g,join as _,resolve as v}from"node:path";import y from"node:process";import{fileURLToPath as b}from"node:url";import{once as ee}from"node:events";import{parseArgs as x,styleText as S}from"node:util";function C(e){console.warn(`${S(`blue`,`info`)} ${e}`)}function w(e){console.warn(`${S(`green`,`✓`)} ${e}`)}function T(e){console.error(`${S(`red`,`✗`)} ${e}`)}function E(e){console.warn(`${S(`yellow`,`⚠`)} ${e}`)}const te=[`vite.config.ts`];function D(e,t=`build`){let n=/(?:^|[,{\s])defaultPackage\s*:\s*['"]([^'"]+)['"]/.exec(e);if(n?.[1]!=null&&n[1]!==``)return n[1];let r=/(?:^|[,{\s])defaultPackage\s*:\s*\{([^}]*)\}/.exec(e);if(r?.[1]==null)return null;let i=RegExp(`(?:^|[,\\s])${t}\\s*:\\s*['"]([^'"]+)['"]`).exec(r[1])?.[1];return i!=null&&i!==``?i:null}function O(e){let t=/(?:^|[,{\s])outDir\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function k(e){let t=/(?:^|[,{\s])root\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function A(e){for(let t of te){let n=v(e,t);if(l(n))try{return u(n,`utf8`)}catch{return null}}return null}function j(e,t){return g(t)?t:v(e,t)}function M(e,t){let n=t==null?null:k(t);return n==null||n===``?e:j(e,n)}function N(e,t=`vp`,n=`build`){if(t!==`vp`)return e;let r=A(e);if(r==null)return e;let i=D(r,n);if(i==null||i===``)return e;let a=v(e,i);return l(a)?a:e}function P(e){let t=A(e),n=M(e,t),r=t==null?null:O(t);return r==null||r===``?v(n,a):j(n,r)}function ne(e){return m(e)===`client`?h(e):e}function F(e){let t=P(e),n=[_(ne(t),`server`,`image.json`),_(t,`server`,`image.json`),_(e,i,`server`,`image.json`)];for(let e of n)if(l(e))return e;let r;try{r=d(e)}catch{return null}for(let t of r){if(t===`node_modules`||t===`dist`||t.startsWith(`.`))continue;let n=_(e,t,`server`,`image.json`);if(l(n))return n}return null}function I(e,t){let n=h(e),i=h(n),a=M(t,A(t)),o=r(u(e,`utf8`))?.outDir;return typeof o==`string`&&o!==``?g(o)?o:v(a,o):_(i,`client`)}let L=null;function R(e){let t=l(e)?new Set(z(e)):/* @__PURE__ */ new Set;return t.has(`pnpm-lock.yaml`)?`pnpm`:t.has(`yarn.lock`)?`yarn`:t.has(`bun.lockb`)||t.has(`bun.lock`)?`bun`:t.has(`package-lock.json`)?`npm`:re(e)}function z(e){try{return d(e)}catch{return[]}}function re(t){try{let n=v(t,`package.json`);if(!l(n))return null;let i=r(u(n,`utf-8`));return i?e(i):null}catch{}return null}function ie(e){try{let t=v(e,`package.json`);if(!l(t))return null;let i=r(u(t,`utf-8`));return i?n(i):null}catch{}return null}function ae(e){let t=e,n=null,r=null;for(;t!==v(t,`..`)&&(n??=R(t),r??=ie(t),!(n&&r));)t=v(t,`..`);return{cwd:e,packageManager:n??`npm`,viteBin:r??`vite`}}function B(){let e=y.cwd();return L?.cwd===e||(L=ae(e)),L}function oe(){return B().packageManager}function V(){let e=B().packageManager,t=y.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`;case`npm`:return t?`npx.cmd`:`npx`;default:return t?`npx.cmd`:`npx`}}function H(e,t=y.cwd()){let n=y.platform===`win32`,r=t;for(;r!==v(r,`..`);){let t=v(r,`node_modules`,`.bin`),i=n?[v(t,`${e}.cmd`),v(t,`${e}.exe`),v(t,e)]:[v(t,e)];for(let e of i)if(l(e))return e;r=v(r,`..`)}return null}function U(e,t,n={}){let r=y.platform===`win32`;if(e===`npx`){let e=V();if(e.includes(`bun`))return c(r?`bunx.cmd`:`bunx`,t,{...n,shell:r});if(e.includes(`pnpm`))return c(e,[`exec`,...t],{...n,shell:r});if(e.includes(`yarn`)){let[i,...a]=t,o=i===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...a]:[`dlx`,...t];return c(e,o,{...n,shell:r})}}return r&&e===`npx`?c(`npx.cmd`,t,{...n,shell:!0}):c(e,t,n)}function W(e,t,n={}){let r=H(e);if(r!=null&&r!==``){let e=y.platform===`win32`&&r.endsWith(`.cmd`);return c(r,t,e?{...n,shell:!0}:n)}return U(`npx`,[e,...t],n)}async function G(e,t={}){try{let[t]=await ee(e,`close`);return t}catch(e){if(t.tolerateErrors)return E(K(e)),1;throw e}}function K(e){if(t(e))return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function se(){let e=v(y.cwd(),`.env`);l(e)&&y.loadEnvFile(e)}function ce(e){let{values:t,positionals:n}=x({args:e,options:{help:{type:`boolean`,short:`h`,default:!1}},allowPositionals:!0,strict:!1});if(t.help===!0)return{command:`help`,args:[]};let[r=`help`,...i]=n;return{command:r,args:i}}function q(){return y.env.RAILWAY_ENVIRONMENT!=null&&y.env.RAILWAY_ENVIRONMENT!==``||y.env.RAILWAY_PROJECT_ID!=null&&y.env.RAILWAY_PROJECT_ID!==``||y.env.RAILWAY_SERVICE_ID!=null&&y.env.RAILWAY_SERVICE_ID!==``}function J(){return y.env.RENDER!=null&&y.env.RENDER!==``||y.env.RENDER_SERVICE_ID!=null&&y.env.RENDER_SERVICE_ID!==``||y.env.RENDER_SERVICE_NAME!=null&&y.env.RENDER_SERVICE_NAME!==``}function Y(){return q()||J()}function X(){return q()?`Railway`:J()?`Render`:`local`}function Z(){return{port:y.env.PORT!=null&&y.env.PORT!==``?y.env.PORT:y.env.RSC_PORT!=null&&y.env.RSC_PORT!==``?y.env.RSC_PORT:`3000`,mode:y.env.NODE_ENV!=null&&y.env.NODE_ENV!==``?y.env.NODE_ENV:`production`,host:Y()?`0.0.0.0`:`127.0.0.1`}}async function Q(){$();let e=B().viteBin;C(`Type checking...`);let t=await G(W(`tsc`,[],{stdio:`inherit`,cwd:y.cwd()}));if(t===0)w(`Type check passed`);else throw T(`Type check failed with code ${t}`),Error(`Type check failed with code ${t}`);C(`Building for production...`);let n=await G(W(e,[`build`],{stdio:`inherit`,cwd:y.cwd()}));if(n===0)w(`Build complete`);else throw T(`Build failed with code ${n}`),Error(`Build failed with code ${n}`);await le()}async function le(){let e=y.cwd(),{viteBin:t}=B(),n=N(e,t),i=F(n);if(i==null)return;let a=I(i,n),s=h(i),d=`assets`;try{let e=r(u(i,`utf-8`));e&&typeof e.assetsDir==`string`&&e.assetsDir.length>0&&(d=e.assetsDir.replaceAll(/^\/+|\/+$/g,``))}catch{}let f=v(n,`public`),p=v(a,d),m=v(s,`static-image-sources.json`);if(l(f)||l(p)||l(m))try{let e=o(),t=await G(c(e,[`optimize-images`,`--config`,i],{stdio:`inherit`,cwd:n,shell:!1}),{tolerateErrors:!0});t!==0&&E(`Image pre-optimization exited with code ${t}`)}catch(e){E(`Could not pre-optimize images: ${K(e)}`)}}async function ue(){let e=B().viteBin,t=v(y.cwd(),`dist`);if(!l(t)){C(`First run detected - building project...`);let t=await G(W(e,[`build`,`--mode`,`development`],{stdio:`inherit`,cwd:y.cwd()}));if(t===0)w(`Initial build complete`);else throw T(`Build failed with code ${t}`),Error(`Build failed with code ${t}`)}C(`Starting Vite${e===`vp`?`+`:``} dev server...`);let n=W(e,[`dev`],{stdio:`inherit`,cwd:y.cwd()}),r=()=>{C(`Shutting down dev server...`),n.kill(`SIGTERM`)};return y.on(`SIGINT`,r),y.on(`SIGTERM`,r),n.on(`error`,e=>{T(`Failed to start Vite: ${e.message}`),y.exit(1)}),n.on(`exit`,e=>{e!==0&&e!==null&&(T(`Vite exited with code ${e}`),y.exit(e))}),new Promise(()=>{})}async function de(){let e;try{e=o()}catch{T(`Failed to obtain rari binary`),T(s()),y.exit(1)}let{port:t,mode:n,host:r}=Z();if(Y()){let i=X();C(`${i} environment detected`),C(`Starting rari server for ${i} deployment...`),C(`Mode: ${n}, Host: ${r}, Port: ${t}`),C(`using binary: ${e}`)}let i=[`--mode`,n,`--port`,t,`--host`,r],a=y.platform!==`win32`&&y.stdin.isTTY,l=c(e,i,{stdio:`inherit`,cwd:y.cwd(),detached:a,env:{...y.env,RUST_LOG:y.env.RUST_LOG!=null&&y.env.RUST_LOG!==``?y.env.RUST_LOG:`error`}}),u=!1,d,f=()=>{u||(u=!0,C(`shutting down...`),l.kill(`SIGTERM`),d=setTimeout(()=>{l.kill(`SIGKILL`),y.exit(1)},5e3),d.unref())};return y.on(`SIGINT`,f),y.on(`SIGTERM`,f),y.on(`exit`,()=>{try{l.kill(`SIGKILL`)}catch{}}),l.on(`error`,e=>{T(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&T(`Binary not found. Please ensure rari is properly installed.`),y.exit(1)}),l.on(`exit`,(e,t)=>{d&&clearTimeout(d),t!=null&&t!==``?(u&&(C(`server stopped by signal ${t}`),y.exit(0)),T(`server stopped unexpectedly by signal ${t}`),y.exit(1)):e===0?(w(`server stopped successfully`),y.exit(0)):(T(`server exited with code ${e}`),y.exit(e!=null&&e!==0?e:1))}),new Promise(()=>{})}async function fe(){C(`Setting up Railway deployment...`),Y()&&(T(`Already running in ${X()} environment. Use "rari start" instead.`),y.exit(1));let{createRailwayDeployment:e}=await import(`./railway-CE3nqaKt.mjs`);e()}async function pe(){C(`Setting up Render deployment...`),Y()&&(T(`Already running in ${X()} environment. Use "rari start" instead.`),y.exit(1));let{createRenderDeployment:e}=await import(`./render-D0eMtn5L.mjs`);e()}function $(){let e=v(y.cwd(),`dist`);l(e)?(C(`Cleaning dist folder...`),p(e,{recursive:!0,force:!0}),w(`Cleaned dist folder`)):C(`No dist folder to clean`)}function me(){console.warn(`${S(`bold`,`rari CLI`)}
2
3
 
3
4
  ${S(`bold`,`Usage:`)}
@@ -65,4 +66,4 @@ ${S(`bold`,`Notes:`)}
65
66
  - Platform deployment is automatically detected and configured
66
67
  - Use Ctrl+C to stop the server gracefully
67
68
 
68
- `)}async function he(){se();let{command:e,args:t}=ce(y.argv.slice(2));if(e==null||e===`help`){me();return}switch(e){case`dev`:await ue();break;case`build`:await Q();break;case`start`:await de();break;case`clean`:$();break;case`deploy`:t[0]===`railway`?await fe():t[0]===`render`?await pe():(T(`Unknown deployment target. Available: railway, render`),y.exit(1));break;default:console.error(`${S(`bold`,`Unknown command:`)} ${e}`),console.warn(`Run "${S(`cyan`,`rari help`)}" for available commands`),y.exit(1)}}function ge(){let e=y.argv[1]?f(v(y.argv[1])):``,t=f(b(import.meta.url));return!!e&&t===e}ge()&&he().catch(e=>{T(`CLI Error: ${K(e)}`),console.error(e),y.exit(1)});export{oe as detectPackageManager,F as findImageConfigPath,Z as getDeploymentConfig,q as isRailwayEnvironment,J as isRenderEnvironment,I as outDirFromImageConfigPath,O as readBuildOutDir,D as readDefaultPackageTarget,k as readViteRoot,P as resolveConfiguredBuildOutDir,M as resolveEffectiveViteRoot,N as resolveViteBuildPackageRoot};
69
+ `)}async function he(){se();let{command:e,args:t}=ce(y.argv.slice(2));if(e==null||e===`help`)me();else switch(e){case`dev`:await ue();break;case`build`:await Q();break;case`start`:await de();break;case`clean`:$();break;case`deploy`:t[0]===`railway`?await fe():t[0]===`render`?await pe():(T(`Unknown deployment target. Available: railway, render`),y.exit(1));break;default:console.error(`${S(`bold`,`Unknown command:`)} ${e}`),console.warn(`Run "${S(`cyan`,`rari help`)}" for available commands`),y.exit(1)}}function ge(){let e=y.argv[1]?f(v(y.argv[1])):``,t=f(b(import.meta.url));return!!e&&t===e}ge()&&he().catch(e=>{T(`CLI Error: ${K(e)}`),console.error(e),y.exit(1)});export{oe as detectPackageManager,F as findImageConfigPath,Z as getDeploymentConfig,q as isRailwayEnvironment,J as isRenderEnvironment,I as outDirFromImageConfigPath,O as readBuildOutDir,D as readDefaultPackageTarget,k as readViteRoot,P as resolveConfiguredBuildOutDir,M as resolveEffectiveViteRoot,N as resolveViteBuildPackageRoot};
@@ -1 +1 @@
1
- import{g as e}from"./type-guards-BLY2PlGR.mjs";import{s as t}from"./regex-constants-DzXwNGh2.mjs";import{t as n}from"./names-CLmM0CPi.mjs";import{registerClientReference as r}from"./runtime/rsc-references.mjs";import{r as i}from"./rari-global-5vGzhToD.mjs";function a(e,n,a=`default`){let o=`${n}#${a}`;if(typeof globalThis<`u`){let r=i(),s=n.replace(t,``).split(`/`).pop(),c=s!=null&&s!==``?s:a,l={id:a==="default"?c:a,path:n,type:`client`,component:e,registered:!0};r[o]=l,r[c]=l,r[n]=l}function s(){throw Error(`Attempted to call ${a}() from the server but ${a} is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.`)}return r(s,n,a)}function o(e){let t={};for(let[n,{component:r,id:i,exportName:o=`default`}]of Object.entries(e))t[n]=a(r,i,o);return t}function s(t){return e(t)&&typeof t.id==`string`&&`component`in t}function c(e){return Array.isArray(e)?[...e]:Object.entries(e).map(([e,t])=>{if(s(t))return{component:t.component,id:t.id,exportName:t.exportName,name:e,client:t.client??!0};throw Error(`[rari/mdx] Component "${e}" is missing module metadata. Pass components to defineMdxComponents({ ... }) in a file processed by the rari vite plugin.`)})}function l(e){let t=c(e);return e=>{let r={},i={},a=new Set(n(e));for(let e of t)if(a.has(e.name)){if(e.client===!1){r[e.name]=e.component;continue}i[e.name]={component:e.component,id:e.id,exportName:e.exportName}}return{...r,...o(i)}}}export{l as t};
1
+ import{g as e}from"./type-guards-BLY2PlGR.mjs";import{s as t}from"./regex-constants-DzXwNGh2.mjs";import{t as n}from"./names-CLmM0CPi.mjs";import{registerClientReference as r}from"./runtime/rsc-references.mjs";import{r as i}from"./rari-global-5vGzhToD.mjs";function a(e,n,a=`default`){let o=`${n}#${a}`;if(typeof globalThis<`u`){let r=i(),s=n.replace(t,``).split(`/`).pop(),c=s!=null&&s!==``?s:a,l={id:a==="default"?c:a,path:n,type:`client`,component:e,registered:!0};r[o]=l,r[c]=l,r[n]=l}function s(){throw Error(`Attempted to call ${a}() from the server but ${a} is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.`)}return r(s,n,a)}function o(e){let t={};for(let[n,{component:r,id:i,exportName:o=`default`}]of Object.entries(e))t[n]=a(r,i,o);return t}function s(t){return e(t)&&typeof t.id==`string`&&`component`in t}function c(e){return Array.isArray(e)?[...e]:Object.entries(e).map(([e,t])=>{if(s(t))return{component:t.component,id:t.id,exportName:t.exportName,name:e,client:t.client??!0};throw Error(`[rari/mdx] Component "${e}" is missing module metadata. Pass components to defineMdxComponents({ ... }) in a file processed by the rari vite plugin.`)})}function l(e){let t=c(e);return e=>{let r={},i={},a=new Set(n(e));for(let e of t)a.has(e.name)&&(e.client===!1?r[e.name]=e.component:i[e.name]={component:e.component,id:e.id,exportName:e.exportName});return{...r,...o(i)}}}export{l as t};
@@ -1 +1 @@
1
- import{a as e,g as t}from"./type-guards-BLY2PlGR.mjs";import{s as n,t as r,u as i}from"./rsc-vite-build-Cyc5ad0S.mjs";import{promises as a}from"node:fs";import o from"node:path";import{pathToFileURL as s}from"node:url";import{randomUUID as c}from"node:crypto";const l=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`];async function u(t){let{appDir:n,staticFileName:r,dynamicBaseName:i,extensions:s=l,rethrowNonEnoent:c=!1}=t,u=o.join(n,r);try{return await a.access(u),{type:`static`,path:u}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}for(let t of s){let r=o.join(n,`${i}${t}`);try{return await a.access(r),{type:`dynamic`,path:r}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}}return null}function d(e,t){switch(e){case`ts`:return`ts`;case`tsx`:return`tsx`;case`js`:case`mjs`:return`js`;case`jsx`:return`jsx`;case`json`:if(t===`sitemap`)return`json`}throw Error(`Unsupported ${t} file extension: ".${e}". Allowed extensions are: ${t===`sitemap`?`.ts, .tsx, .js, .jsx, .mjs, .json`:`.ts, .tsx, .js, .jsx, .mjs`}`)}function f(e){let{name:t,virtualId:r,sourcePath:s,sourceCode:c,aliases:l={},projectRoot:u,kind:f}=e;return{name:t,resolveId(e,t){if(e===r)return e;if(Object.keys(l).length>0){let t=n(e,l,u);if(t!=null&&t!==``){let e=i(t);return e!=null&&e!==``?e:t}}if(e.startsWith(`.`)){let n=t==null||t===``||t.startsWith(`\0`)?s:t,r=o.resolve(o.dirname(n),e),a=i(r);return a!=null&&a!==``?a:r}return null},async load(e){if(e===r){let e=o.extname(s).slice(1);return{code:c,moduleType:d(e,f)}}if(e&&!e.startsWith(`\0`))try{return{code:await a.readFile(e,`utf-8`),moduleType:d(o.extname(e).slice(1),f)}}catch{return null}return null}}}function p(e){return e===`rari`||e.startsWith(`rari/`)}async function m(e){let{virtualId:t,sourcePath:n,sourceCode:i,aliases:l={},projectRoot:u,kind:d,pluginName:m,label:h}=e,g=await r({root:u,virtualId:t,external:p,plugins:[f({name:m,virtualId:t,sourcePath:n,sourceCode:i,aliases:l,projectRoot:u,kind:d})]});if(g==null)throw Error(`Failed to build ${h} module`);let _=o.join(u,`node_modules`,`.cache`,`rari-metadata`);await a.mkdir(_,{recursive:!0});let v=o.join(_,`${h}-${c()}.mjs`);await using y=new AsyncDisposableStack;return y.defer(async()=>{await a.rm(v,{force:!0})}),await a.writeFile(v,g.code,`utf8`),await import(s(v).href)}function h(e,n){if(!t(e))throw Error(`${n} file must export a default export (either an object or a function)`);let r=e.default;if(r==null)throw Error(`${n} file must export a default export (either an object or a function)`);return r}function g(e){return o.resolve(e,`..`,`..`)}export{u as i,g as n,h as r,m as t};
1
+ import{a as e,g as t}from"./type-guards-BLY2PlGR.mjs";import{s as n,t as r,u as i}from"./rsc-vite-build-DYAQzQ09.mjs";import{promises as a}from"node:fs";import o from"node:path";import{pathToFileURL as s}from"node:url";import{randomUUID as c}from"node:crypto";const l=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`];async function u(t){let{appDir:n,staticFileName:r,dynamicBaseName:i,extensions:s=l,rethrowNonEnoent:c=!1}=t,u=o.join(n,r);try{return await a.access(u),{type:`static`,path:u}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}for(let t of s){let r=o.join(n,`${i}${t}`);try{return await a.access(r),{type:`dynamic`,path:r}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}}return null}function d(e,t){switch(e){case`ts`:return`ts`;case`tsx`:return`tsx`;case`js`:case`mjs`:return`js`;case`jsx`:return`jsx`;case`json`:if(t===`sitemap`)return`json`}throw Error(`Unsupported ${t} file extension: ".${e}". Allowed extensions are: ${t===`sitemap`?`.ts, .tsx, .js, .jsx, .mjs, .json`:`.ts, .tsx, .js, .jsx, .mjs`}`)}function f(e){let{name:t,virtualId:r,sourcePath:s,sourceCode:c,aliases:l={},projectRoot:u,kind:f}=e;return{name:t,resolveId(e,t){if(e===r)return e;if(Object.keys(l).length>0){let t=n(e,l,u);if(t!=null&&t!==``){let e=i(t);return e!=null&&e!==``?e:t}}if(e.startsWith(`.`)){let n=t==null||t===``||t.startsWith(`\0`)?s:t,r=o.resolve(o.dirname(n),e),a=i(r);return a!=null&&a!==``?a:r}return null},async load(e){if(e===r){let e=o.extname(s).slice(1);return{code:c,moduleType:d(e,f)}}if(e&&!e.startsWith(`\0`))try{return{code:await a.readFile(e,`utf-8`),moduleType:d(o.extname(e).slice(1),f)}}catch{return null}return null}}}function p(e){return e===`rari`||e.startsWith(`rari/`)}async function m(e){let{virtualId:t,sourcePath:n,sourceCode:i,aliases:l={},projectRoot:u,kind:d,pluginName:m,label:h}=e,g=await r({root:u,virtualId:t,external:p,plugins:[f({name:m,virtualId:t,sourcePath:n,sourceCode:i,aliases:l,projectRoot:u,kind:d})]});if(g==null)throw Error(`Failed to build ${h} module`);let _=o.join(u,`node_modules`,`.cache`,`rari-metadata`);await a.mkdir(_,{recursive:!0});let v=o.join(_,`${h}-${c()}.mjs`);await using y=new AsyncDisposableStack;return y.defer(async()=>{await a.rm(v,{force:!0})}),await a.writeFile(v,g.code,`utf8`),await import(s(v).href)}function h(e,n){if(!t(e))throw Error(`${n} file must export a default export (either an object or a function)`);let r=e.default;if(r==null)throw Error(`${n} file must export a default export (either an object or a function)`);return r}function g(e){return o.resolve(e,`..`,`..`)}export{u as i,g as n,h as r,m as t};
@@ -1,4 +1,4 @@
1
- import{g as e}from"./type-guards-BLY2PlGR.mjs";import{t}from"./xml-DPsk9WTz.mjs";import{i as n,n as r,r as i,t as a}from"./execute-DJ7w3uhW.mjs";import{promises as o}from"node:fs";import s from"node:path";function c(t){return e(t)&&typeof t.title==`string`&&typeof t.description==`string`&&typeof t.link==`string`&&Array.isArray(t.items)}async function l(e){if(typeof e==`function`){let t=e(),n=t instanceof Promise?await t:t;if(!c(n))throw Error(`Feed default export must resolve to a feed object`);return n}if(!c(e))throw Error(`Feed default export must be a feed object`);return e}function u(e){return(typeof e==`string`?new Date(e):e).toUTCString()}function d(e){return e==null||e===``?``:typeof e==`string`?` <dc:creator>${t(e)}</dc:creator>`:e.email!=null&&e.email!==``?` <author>${t(`${e.email} (${e.name})`)}</author>`:` <dc:creator>${t(e.name)}</dc:creator>`}function f(e){let n=[` <item>`,` <title>${t(e.title)}</title>`,` <link>${t(e.url)}</link>`];return e.description!=null&&e.description!==``&&n.push(` <description>${t(e.description)}</description>`),n.push(...p(e),...m(e),...h(e)),n.push(` </item>`),n.join(`
1
+ import{g as e}from"./type-guards-BLY2PlGR.mjs";import{t}from"./xml-DPsk9WTz.mjs";import{i as n,n as r,r as i,t as a}from"./execute-C7dN28Np.mjs";import{promises as o}from"node:fs";import s from"node:path";function c(t){return e(t)&&typeof t.title==`string`&&typeof t.description==`string`&&typeof t.link==`string`&&Array.isArray(t.items)}async function l(e){if(typeof e==`function`){let t=e(),n=t instanceof Promise?await t:t;if(!c(n))throw Error(`Feed default export must resolve to a feed object`);return n}if(!c(e))throw Error(`Feed default export must be a feed object`);return e}function u(e){return(typeof e==`string`?new Date(e):e).toUTCString()}function d(e){return e==null||e===``?``:typeof e==`string`?` <dc:creator>${t(e)}</dc:creator>`:e.email!=null&&e.email!==``?` <author>${t(`${e.email} (${e.name})`)}</author>`:` <dc:creator>${t(e.name)}</dc:creator>`}function f(e){let n=[` <item>`,` <title>${t(e.title)}</title>`,` <link>${t(e.url)}</link>`];return e.description!=null&&e.description!==``&&n.push(` <description>${t(e.description)}</description>`),n.push(...p(e),...m(e),...h(e)),n.push(` </item>`),n.join(`
2
2
  `)}function p(e){let t=[];e.content!=null&&e.content!==``&&t.push(` <content:encoded><![CDATA[${e.content.replace(/\]\]>/g,`]]]]><![CDATA[>`)}]]></content:encoded>`);let n=d(e.author);return n&&t.push(n),t}function m(e){let n=[];if(e.pubDate!=null&&n.push(` <pubDate>${u(e.pubDate)}</pubDate>`),n.push(` <guid isPermaLink="${e.guid!=null&&e.guid!==``?`false`:`true`}">${t(e.guid!=null&&e.guid!==``?e.guid:e.url)}</guid>`),e.categories)for(let r of e.categories)n.push(` <category>${t(r)}</category>`);return n}function h(e){if(!e.enclosure)return[];let n=[`url="${t(e.enclosure.url)}"`];return e.enclosure.length!==void 0&&n.push(`length="${e.enclosure.length}"`),n.push(`type="${t(e.enclosure.type!=null&&e.enclosure.type!==``?e.enclosure.type:`application/octet-stream`)}"`),[` <enclosure ${n.join(` `)} />`]}function g(e){let n=e.items.some(e=>e.content!=null&&e.content!==``),r=e.items.some(e=>{let t=e.author;return t==null||t===``?!1:typeof t==`string`||t.email==null||t.email===``}),i=[];n&&i.push(`xmlns:content="http://purl.org/rss/1.0/modules/content/"`),r&&i.push(`xmlns:dc="http://purl.org/dc/elements/1.1/"`),i.push(`xmlns:atom="http://www.w3.org/2005/Atom"`);let a=[`<?xml version="1.0" encoding="UTF-8"?>`,`<rss version="2.0"${i.length>0?` ${i.join(` `)}`:``}>`,` <channel>`,` <title>${t(e.title)}</title>`,` <link>${t(e.link)}</link>`,` <description>${t(e.description)}</description>`,` <atom:link href="${t(`${e.link.replace(/\/+$/,``)}/feed.xml`)}" rel="self" type="application/rss+xml" />`];e.language!=null&&e.language!==``&&a.push(` <language>${t(e.language)}</language>`),e.copyright!=null&&e.copyright!==``&&a.push(` <copyright>${t(e.copyright)}</copyright>`),e.lastBuildDate!=null&&a.push(` <lastBuildDate>${u(e.lastBuildDate)}</lastBuildDate>`),e.ttl!==void 0&&a.push(` <ttl>${e.ttl}</ttl>`),e.image&&(a.push(` <image>`),a.push(` <url>${t(e.image.url)}</url>`),a.push(` <title>${t(e.image.title)}</title>`),a.push(` <link>${t(e.image.link)}</link>`),e.image.width!==void 0&&a.push(` <width>${e.image.width}</width>`),e.image.height!==void 0&&a.push(` <height>${e.image.height}</height>`),a.push(` </image>`));for(let t of e.items)a.push(f(t));return a.push(` </channel>`),a.push(`</rss>`),a.join(`
3
3
  `)}
4
4
  /* v8 ignore start - file system operations, better tested in integration/e2e */
package/dist/font.mjs CHANGED
@@ -1 +1 @@
1
- import e from"./font/local.mjs";export{e as localFont};
1
+ export{default as localFont}from"./font/local.mjs";
@@ -0,0 +1 @@
1
+ function e(e,r){let i=!0,a=/* @__PURE__ */ new Set;for(let n of r.keys())if(!a.has(n)){a.add(n);try{t(e,r,n)}catch{i=!1}}for(let t of e.elements)try{n(t,a)}catch{i=!1}return i}function t(e,t,n){let r=t.getAll(n).filter(e=>typeof e==`string`),i=new Set(r),a=e.elements.namedItem(n);if(a instanceof RadioNodeList)a.forEach(e=>{e instanceof HTMLInputElement&&(e.type===`radio`||e.type===`checkbox`?e.checked=i.has(e.value):r.length===1&&(e.value=r[0]))});else if(a instanceof HTMLSelectElement&&a.multiple)for(let e of a.options)e.selected=i.has(e.value);else(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)&&(a instanceof HTMLInputElement&&(a.type===`checkbox`||a.type===`radio`)?a.checked=i.has(a.value):r.length>0&&(a.value=r[0]))}function n(e,t){if(e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`))e.name!==``&&!t.has(e.name)&&(e.checked=!1);else if(e instanceof HTMLSelectElement&&e.multiple){if(e.name===``||t.has(e.name))return;for(let t of e.options)t.selected=!1}}function r(){let e=/* @__PURE__ */ new Map;return typeof document>`u`||document.querySelectorAll(`form`).forEach((t,n)=>{e.set(`form-${n}`,new FormData(t))}),e}function i(t){typeof document<`u`&&document.querySelectorAll(`form`).forEach((n,r)=>{let i=t.get(`form-${r}`);i&&e(n,i)})}export{r as n,i as r,e as t};
package/dist/headers.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e}from"./rari-global-5vGzhToD.mjs";function t(){let t=e();if(t.markUseCacheDynamic){t.markUseCacheDynamic();return}t.useCacheDynamicDepth=(t.useCacheDynamicDepth??0)+1}async function n(){t();let n=e().cookies?.();if(!n)throw Error(`[rari] cookies() is only available in server actions and server components.`);return Promise.resolve(n)}async function r(){t();let n=e().headers?.();if(!n)throw Error(`[rari] headers() is only available in server actions and server components.`);return Promise.resolve(n)}export{n as cookies,r as headers};
1
+ import{i as e}from"./rari-global-5vGzhToD.mjs";function t(){let t=e();t.markUseCacheDynamic?t.markUseCacheDynamic():t.useCacheDynamicDepth=(t.useCacheDynamicDepth??0)+1}async function n(){t();let n=e().cookies?.();if(!n)throw Error(`[rari] cookies() is only available in server actions and server components.`);return Promise.resolve(n)}async function r(){t();let n=e().headers?.();if(!n)throw Error(`[rari] headers() is only available in server actions and server components.`);return Promise.resolve(n)}export{n as cookies,r as headers};
package/dist/image.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./constants-C6nBL5YX.mjs";import{configureImageSizes as c}from"./image/runtime-config.mjs";import{c as l}from"react/compiler-runtime";import{useEffect as u,useLayoutEffect as d,useRef as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{preload as g}from"react-dom";import{getAllImageSizes as _,getImageDeviceSizes as v,getMaxOptimizedWidth as y}from"rari/image/runtime-config";import"virtual:rari-image-config";function b(e){return Math.min(Math.max(e,1),y())}function x(e){let t=_(),n=b(e);return t.find(e=>e>=n)??t[t.length-1]}function S(e){let t=/(^|[,\s])(1?\d?\d)vw/g,n=[];for(let r=t.exec(e);r!=null;r=t.exec(e))n.push(Number.parseInt(r[2],10));let r=_();if(n.length===0)return[...r];let i=Math.min(...n)*.01,a=v()[0]*i;return r.filter(e=>e>=a)}function C(e){let{fill:t,width:n,intrinsicWidth:r,sizes:i}=e,a=v();if(t)return{defaultWidth:y(),widths:a};let o=n!=null&&n!==0?n:r!=null&&r!==0?r:void 0;if(i!=null&&i!==``){let e=S(i);return{defaultWidth:o==null?e.at(-1)??1920:x(o),widths:e}}if(o==null)return{defaultWidth:1920,widths:a};let s=[...new Set([o,o*2].map(e=>x(e)))];return s.sort((e,t)=>e-t),{defaultWidth:s[0],widths:s}}function w(e,t,n,r){let i=new URLSearchParams;return i.set(`url`,e),i.set(`w`,t.toString()),i.set(`q`,n.toString()),r&&i.set(`f`,r),`/_rari/image?${i}`}function T(e,t,n,r,i){return e==null?w(t,n,r,i):e({src:t,width:n,quality:r})}function ee(e,t,n=!1,r){if(e!=null&&e!==``)return e;if(n)return`100vw`;if(t)return r!=null&&r!==0?`${r}px`:`100vw`}function te(e){if(e==null&&n.length===1&&n[0]===`avif`)return`avif`}function ne(e){if(!e.enabled)return;let{finalSrc:t,defaultWidth:n,widths:r,quality:i,sizes:a,loader:o,unoptimized:s,shouldUseSrcSet:c,format:l}=e;if(s){g(o==null?t:o({src:t,width:n,quality:i}),{as:`image`,fetchPriority:`high`});return}let u=T(o,t,n,i,l);if(c){g(u,{as:`image`,fetchPriority:`high`,imageSrcSet:A(o,t,r,i,l),...a==null?{}:{imageSizes:a},...l===`avif`?{type:`image/avif`}:{}});return}g(u,{as:`image`,fetchPriority:`high`,...l===`avif`?{type:`image/avif`}:{}})}function E(e,t,n){if(e!=null&&e!==0)return e;if(!t&&n!=null&&n!==0)return n}function re(e){let{src:t,width:n,height:r,fill:i,placeholder:a,blurDataURL:o,loader:s}=e,c=typeof t==`string`?t:t.src,l=typeof t==`string`?void 0:t.width,u=typeof t==`string`?void 0:t.height,d=o!=null&&o!==``?o:typeof t==`string`?void 0:t.blurDataURL,f=d!=null&&d!==``?d:void 0,p=a===`blur`&&f==null?T(s,c,16,25,`jpeg`):void 0;return{imgSrc:c,imgWidth:E(n,i,l),imgHeight:E(r,i,u),inlineBlurDataURL:f,optimizerBlurUrl:p}}function D(e){return{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:e?.objectFit??`cover`}}function O(e){return{backgroundImage:`url("${e}")`,backgroundSize:`cover`,backgroundPosition:`center`,filter:`blur(20px)`,transition:`filter 0.3s ease-out`}}function k(e){return e.complete&&e.naturalWidth>0}function ie(e){let{style:t,fill:n,placeholder:r,imgBlurDataURL:i,blurComplete:a}=e,o=r===`blur`&&i!=null&&i!==``&&!a,s=r===`blur`&&a;return{...t,...n?D(t):null,...o?O(i):null,...s?{filter:`none`,transition:`filter 0.3s ease-out`}:null}}function A(e,t,n,r,i){return n.map(n=>`${T(e,t,n,r,i)} ${n}w`).join(`, `)}function ae(e){let{unoptimized:t,loader:n,finalSrc:r,width:i,quality:a,format:o}=e;return t?n==null?r:n({src:r,width:i,quality:a}):T(n,r,i,a,o)}function j(e,t,n){if(!t||e==null)return;let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(n(),r.disconnect())},{rootMargin:`200px`});return r.observe(e),()=>{r.disconnect()}}function M(e){let{imgElement:t,loader:r,finalSrc:i,widths:a,quality:o,sizes:s}=e;return/* @__PURE__ */ h(`picture`,{children:[n.includes(`avif`)&&/* @__PURE__ */ m(`source`,{type:`image/avif`,srcSet:A(r,i,a,o,`avif`),sizes:s}),n.includes(`webp`)&&/* @__PURE__ */ m(`source`,{type:`image/webp`,srcSet:A(r,i,a,o,`webp`),sizes:s}),t]})}function oe(e){let t=l(19),{finalSrc:n,shouldEagerBlur:r,inlineBlurDataURL:i,optimizerBlurUrl:a,placeholder:o}=e,[s,c]=p(!1),[m,h]=p(n),[g,_]=p(r),v=f(null);m!==n&&(h(n),_(r),c(!1));let y;t[0]===o?y=t[1]:(y=()=>{if(o!==`blur`)return;let e=v.current;e!=null&&k(e)&&c(!0)},t[0]=o,t[1]=y);let b;t[2]!==n||t[3]!==o?(b=[o,n],t[2]=n,t[3]=o,t[4]=b):b=t[4],d(y,b);let x;t[5]!==g||t[6]!==a||t[7]!==o||t[8]!==r?(x=()=>j(v.current,!r&&!g&&a!=null&&o===`blur`,()=>{_(!0)}),t[5]=g,t[6]=a,t[7]=o,t[8]=r,t[9]=x):x=t[9];let S;t[10]!==n||t[11]!==g||t[12]!==a||t[13]!==o||t[14]!==r?(S=[r,g,a,o,n],t[10]=n,t[11]=g,t[12]=a,t[13]=o,t[14]=r,t[15]=S):S=t[15],u(x,S);let C=i??(r||g?a:void 0),w;return t[16]!==s||t[17]!==C?(w={imgRef:v,blurComplete:s,setBlurComplete:c,activeBlurUrl:C},t[16]=s,t[17]=C,t[18]=w):w=t[18],w}function N(e){let t=l(16),{src:n,alt:r,width:i,height:a,quality:o,preload:s,loading:c,placeholder:d,blurDataURL:h,fill:g,sizes:_,style:v,className:y,onLoad:b,onError:x,unoptimized:S,loader:w,overrideSrc:T,decoding:E}=e,D=o===void 0?75:o,O=s!==void 0&&s,k=c===void 0?`lazy`:c,j=d===void 0?`empty`:d,N=g!==void 0&&g,P=S!==void 0&&S,{imgSrc:F,imgWidth:I,imgHeight:se,inlineBlurDataURL:ce,optimizerBlurUrl:le}=re({src:n,width:i,height:a,fill:N,placeholder:j,blurDataURL:h,loader:w}),L=T!=null&&T!==``?T:F,ue=E??(O?`sync`:`async`),R=C({fill:N,width:i,intrinsicWidth:typeof n==`string`?void 0:n.width,sizes:_}),z=R.widths.length>1||R.widths[0]!==R.defaultWidth,B=O||k===`eager`,V=te(w),[de,fe]=p(!1),H=f(b),{imgRef:pe,blurComplete:U,setBlurComplete:W,activeBlurUrl:G}=oe({finalSrc:L,shouldEagerBlur:B,inlineBlurDataURL:ce,optimizerBlurUrl:le,placeholder:j}),K,q;t[0]===b?(K=t[1],q=t[2]):(K=()=>{H.current=b},q=[b],t[0]=b,t[1]=K,t[2]=q),u(K,q);let J;t[3]!==j||t[4]!==W?(J=e=>{let t=e.currentTarget;(t.currentSrc===``?t.src:t.currentSrc)!==``&&t.complete&&(j===`blur`&&W(!0),H.current&&H.current(e))},t[3]=j,t[4]=W,t[5]=J):J=t[5];let me=J,Y;t[6]!==x||t[7]!==j||t[8]!==W?(Y=e=>{fe(!0),j===`blur`&&W(!0),x&&x(e)},t[6]=x,t[7]=j,t[8]=W,t[9]=Y):Y=t[9];let he=Y,X;t[10]!==G||t[11]!==U||t[12]!==N||t[13]!==j||t[14]!==v?(X=ie({style:v,fill:N,placeholder:j,imgBlurDataURL:G,blurComplete:U}),t[10]=G,t[11]=U,t[12]=N,t[13]=j,t[14]=v,t[15]=X):X=t[15];let ge=X,_e=ae({unoptimized:P,loader:w,finalSrc:L,width:R.defaultWidth,quality:D,format:V}),Z=ee(_,z,N,i??I??R.defaultWidth),Q=!P&&z?A(w,L,R.widths,D,V):void 0;ne({enabled:O,finalSrc:L,defaultWidth:R.defaultWidth,widths:R.widths,quality:D,sizes:Z,loader:w,unoptimized:P,shouldUseSrcSet:z,format:V});let $=/* @__PURE__ */ m(`img`,{ref:pe,src:_e,srcSet:Q,sizes:Q==null?void 0:Z,alt:de?r:``,width:N?void 0:I,height:N?void 0:se,loading:O?`eager`:k,fetchPriority:O?`high`:`auto`,decoding:ue,onLoad:j===`blur`||b!=null?me:void 0,onError:he,style:ge,className:y});return P||!z?$:M({imgElement:$,loader:w,finalSrc:L,widths:R.widths,quality:D,sizes:Z})}const P=typeof window>`u`,F=N;P&&(F.$$typeof=Symbol.for(`react.client.reference`),F.$$id=`rari/image#Image`);export{s as BLUR_PLACEHOLDER_QUALITY,r as BLUR_PLACEHOLDER_WIDTH,a as DEFAULT_DEVICE_SIZES,n as DEFAULT_FORMATS,e as DEFAULT_IMAGE_SIZES,i as DEFAULT_MINIMUM_CACHE_TTL,o as DEFAULT_QUALITY_LEVELS,F as Image,t as MAX_OPTIMIZED_OUTPUT_WIDTH,c as configureImageSizes};
1
+ import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./constants-C6nBL5YX.mjs";import{configureImageSizes as c}from"./image/runtime-config.mjs";import{c as l}from"react/compiler-runtime";import{useEffect as u,useLayoutEffect as d,useRef as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{preload as g}from"react-dom";import{getAllImageSizes as _,getImageDeviceSizes as v,getMaxOptimizedWidth as y}from"rari/image/runtime-config";import"virtual:rari-image-config";function b(e){return Math.min(Math.max(e,1),y())}function x(e){let t=_(),n=b(e);return t.find(e=>e>=n)??t[t.length-1]}function S(e){let t=/(^|[,\s])(1?\d?\d)vw/g,n=[];for(let r=t.exec(e);r!=null;r=t.exec(e))n.push(Number.parseInt(r[2],10));let r=_();if(n.length===0)return[...r];let i=Math.min(...n)*.01,a=v()[0]*i;return r.filter(e=>e>=a)}function C(e){let{fill:t,width:n,intrinsicWidth:r,sizes:i}=e,a=v();if(t)return{defaultWidth:y(),widths:a};let o=n!=null&&n!==0?n:r!=null&&r!==0?r:void 0;if(i!=null&&i!==``){let e=S(i);return{defaultWidth:o==null?e.at(-1)??1920:x(o),widths:e}}if(o==null)return{defaultWidth:1920,widths:a};let s=[...new Set([o,o*2].map(e=>x(e)))];return s.sort((e,t)=>e-t),{defaultWidth:s[0],widths:s}}function w(e,t,n,r){let i=new URLSearchParams;return i.set(`url`,e),i.set(`w`,t.toString()),i.set(`q`,n.toString()),r&&i.set(`f`,r),`/_rari/image?${i}`}function T(e,t,n,r,i){return e==null?w(t,n,r,i):e({src:t,width:n,quality:r})}function ee(e,t,n=!1,r){if(e!=null&&e!==``)return e;if(n)return`100vw`;if(t)return r!=null&&r!==0?`${r}px`:`100vw`}function te(e){if(e==null&&n.length===1&&n[0]===`avif`)return`avif`}function ne(e){if(!e.enabled)return;let{finalSrc:t,defaultWidth:n,widths:r,quality:i,sizes:a,loader:o,unoptimized:s,shouldUseSrcSet:c,format:l}=e;if(s){g(o==null?t:o({src:t,width:n,quality:i}),{as:`image`,fetchPriority:`high`});return}let u=T(o,t,n,i,l);c?g(u,{as:`image`,fetchPriority:`high`,imageSrcSet:A(o,t,r,i,l),...a==null?{}:{imageSizes:a},...l===`avif`?{type:`image/avif`}:{}}):g(u,{as:`image`,fetchPriority:`high`,...l===`avif`?{type:`image/avif`}:{}})}function E(e,t,n){if(e!=null&&e!==0)return e;if(!t&&n!=null&&n!==0)return n}function re(e){let{src:t,width:n,height:r,fill:i,placeholder:a,blurDataURL:o,loader:s}=e,c=typeof t==`string`?t:t.src,l=typeof t==`string`?void 0:t.width,u=typeof t==`string`?void 0:t.height,d=o!=null&&o!==``?o:typeof t==`string`?void 0:t.blurDataURL,f=d!=null&&d!==``?d:void 0,p=a===`blur`&&f==null?T(s,c,16,25,`jpeg`):void 0;return{imgSrc:c,imgWidth:E(n,i,l),imgHeight:E(r,i,u),inlineBlurDataURL:f,optimizerBlurUrl:p}}function D(e){return{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:e?.objectFit??`cover`}}function O(e){return{backgroundImage:`url("${e}")`,backgroundSize:`cover`,backgroundPosition:`center`,filter:`blur(20px)`,transition:`filter 0.3s ease-out`}}function k(e){return e.complete&&e.naturalWidth>0}function ie(e){let{style:t,fill:n,placeholder:r,imgBlurDataURL:i,blurComplete:a}=e,o=r===`blur`&&i!=null&&i!==``&&!a,s=r===`blur`&&a;return{...t,...n?D(t):null,...o?O(i):null,...s?{filter:`none`,transition:`filter 0.3s ease-out`}:null}}function A(e,t,n,r,i){return n.map(n=>`${T(e,t,n,r,i)} ${n}w`).join(`, `)}function ae(e){let{unoptimized:t,loader:n,finalSrc:r,width:i,quality:a,format:o}=e;return t?n==null?r:n({src:r,width:i,quality:a}):T(n,r,i,a,o)}function j(e,t,n){if(!t||e==null)return;let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(n(),r.disconnect())},{rootMargin:`200px`});return r.observe(e),()=>{r.disconnect()}}function M(e){let{imgElement:t,loader:r,finalSrc:i,widths:a,quality:o,sizes:s}=e;return/* @__PURE__ */ h(`picture`,{children:[n.includes(`avif`)&&/* @__PURE__ */ m(`source`,{type:`image/avif`,srcSet:A(r,i,a,o,`avif`),sizes:s}),n.includes(`webp`)&&/* @__PURE__ */ m(`source`,{type:`image/webp`,srcSet:A(r,i,a,o,`webp`),sizes:s}),t]})}function oe(e){let t=l(19),{finalSrc:n,shouldEagerBlur:r,inlineBlurDataURL:i,optimizerBlurUrl:a,placeholder:o}=e,[s,c]=p(!1),[m,h]=p(n),[g,_]=p(r),v=f(null);m!==n&&(h(n),_(r),c(!1));let y;t[0]===o?y=t[1]:(y=()=>{if(o!==`blur`)return;let e=v.current;e!=null&&k(e)&&c(!0)},t[0]=o,t[1]=y);let b;t[2]!==n||t[3]!==o?(b=[o,n],t[2]=n,t[3]=o,t[4]=b):b=t[4],d(y,b);let x;t[5]!==g||t[6]!==a||t[7]!==o||t[8]!==r?(x=()=>j(v.current,!r&&!g&&a!=null&&o===`blur`,()=>{_(!0)}),t[5]=g,t[6]=a,t[7]=o,t[8]=r,t[9]=x):x=t[9];let S;t[10]!==n||t[11]!==g||t[12]!==a||t[13]!==o||t[14]!==r?(S=[r,g,a,o,n],t[10]=n,t[11]=g,t[12]=a,t[13]=o,t[14]=r,t[15]=S):S=t[15],u(x,S);let C=i??(r||g?a:void 0),w;return t[16]!==s||t[17]!==C?(w={imgRef:v,blurComplete:s,setBlurComplete:c,activeBlurUrl:C},t[16]=s,t[17]=C,t[18]=w):w=t[18],w}function N(e){let t=l(16),{src:n,alt:r,width:i,height:a,quality:o,preload:s,loading:c,placeholder:d,blurDataURL:h,fill:g,sizes:_,style:v,className:y,onLoad:b,onError:x,unoptimized:S,loader:w,overrideSrc:T,decoding:E}=e,D=o===void 0?75:o,O=s!==void 0&&s,k=c===void 0?`lazy`:c,j=d===void 0?`empty`:d,N=g!==void 0&&g,P=S!==void 0&&S,{imgSrc:F,imgWidth:I,imgHeight:se,inlineBlurDataURL:ce,optimizerBlurUrl:le}=re({src:n,width:i,height:a,fill:N,placeholder:j,blurDataURL:h,loader:w}),L=T!=null&&T!==``?T:F,ue=E??(O?`sync`:`async`),R=C({fill:N,width:i,intrinsicWidth:typeof n==`string`?void 0:n.width,sizes:_}),z=R.widths.length>1||R.widths[0]!==R.defaultWidth,B=O||k===`eager`,V=te(w),[de,fe]=p(!1),H=f(b),{imgRef:pe,blurComplete:U,setBlurComplete:W,activeBlurUrl:G}=oe({finalSrc:L,shouldEagerBlur:B,inlineBlurDataURL:ce,optimizerBlurUrl:le,placeholder:j}),K,q;t[0]===b?(K=t[1],q=t[2]):(K=()=>{H.current=b},q=[b],t[0]=b,t[1]=K,t[2]=q),u(K,q);let J;t[3]!==j||t[4]!==W?(J=e=>{let t=e.currentTarget;(t.currentSrc===``?t.src:t.currentSrc)!==``&&t.complete&&(j===`blur`&&W(!0),H.current&&H.current(e))},t[3]=j,t[4]=W,t[5]=J):J=t[5];let me=J,Y;t[6]!==x||t[7]!==j||t[8]!==W?(Y=e=>{fe(!0),j===`blur`&&W(!0),x&&x(e)},t[6]=x,t[7]=j,t[8]=W,t[9]=Y):Y=t[9];let he=Y,X;t[10]!==G||t[11]!==U||t[12]!==N||t[13]!==j||t[14]!==v?(X=ie({style:v,fill:N,placeholder:j,imgBlurDataURL:G,blurComplete:U}),t[10]=G,t[11]=U,t[12]=N,t[13]=j,t[14]=v,t[15]=X):X=t[15];let ge=X,_e=ae({unoptimized:P,loader:w,finalSrc:L,width:R.defaultWidth,quality:D,format:V}),Z=ee(_,z,N,i??I??R.defaultWidth),Q=!P&&z?A(w,L,R.widths,D,V):void 0;ne({enabled:O,finalSrc:L,defaultWidth:R.defaultWidth,widths:R.widths,quality:D,sizes:Z,loader:w,unoptimized:P,shouldUseSrcSet:z,format:V});let $=/* @__PURE__ */ m(`img`,{ref:pe,src:_e,srcSet:Q,sizes:Q==null?void 0:Z,alt:de?r:``,width:N?void 0:I,height:N?void 0:se,loading:O?`eager`:k,fetchPriority:O?`high`:`auto`,decoding:ue,onLoad:j===`blur`||b!=null?me:void 0,onError:he,style:ge,className:y});return P||!z?$:M({imgElement:$,loader:w,finalSrc:L,widths:R.widths,quality:D,sizes:Z})}const P=typeof window>`u`,F=N;P&&(F.$$typeof=Symbol.for(`react.client.reference`),F.$$id=`rari/image#Image`);export{s as BLUR_PLACEHOLDER_QUALITY,r as BLUR_PLACEHOLDER_WIDTH,a as DEFAULT_DEVICE_SIZES,n as DEFAULT_FORMATS,e as DEFAULT_IMAGE_SIZES,i as DEFAULT_MINIMUM_CACHE_TTL,o as DEFAULT_QUALITY_LEVELS,F as Image,t as MAX_OPTIMIZED_OUTPUT_WIDTH,c as configureImageSizes};
@@ -1 +1 @@
1
- import{t as e}from"../define-CuBTL1jt.mjs";export{e as defineMdxComponents};
1
+ export{t as defineMdxComponents}from"../define-Dsj1lR4C.mjs";
package/dist/mdx.mjs CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./names-CLmM0CPi.mjs";import{t}from"./define-CuBTL1jt.mjs";import{createElement as n}from"react";import{evaluate as r}from"@mdx-js/mdx";import{getMDXComponents as i}from"rari/mdx/registry";async function a(e,t){let{components:a={},...o}=t,s=await r(e,o),c=s.default,l=i(e);function u(e){let t={...l,...a,...e.components};return n(c,{...e,components:t})}return{...s,default:u}}export{t as defineMdxComponents,a as evaluate,e as scanMdxComponentNames};
1
+ import{t as e}from"./names-CLmM0CPi.mjs";import{t}from"./define-Dsj1lR4C.mjs";import{createElement as n}from"react";import{evaluate as r}from"@mdx-js/mdx";import{getMDXComponents as i}from"rari/mdx/registry";async function a(e,t){let{components:a={},...o}=t,s=await r(e,o),c=s.default,l=i(e);function u(e){let t={...l,...a,...e.components};return n(c,{...e,components:t})}return{...s,default:u}}export{t as defineMdxComponents,a as evaluate,e as scanMdxComponentNames};
@@ -0,0 +1 @@
1
+ let e=null;function t(){return e}function n(t){typeof window>`u`?console.warn(`[rari] Router cannot register navigate in non-browser environment`):(e&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&console.warn(`[rari] Router: registerNavigate called multiple times, overwriting existing navigate function`,{previous:e,new:t}),e=t,window.dispatchEvent(new CustomEvent(`rari:register-navigate`,{detail:{navigate:t}})))}function r(){typeof window>`u`?console.warn(`[rari] Router cannot deregister navigate in non-browser environment`):(e=null,window.dispatchEvent(new CustomEvent(`rari:deregister-navigate`)))}async function i(t,n){if(typeof window>`u`)console.warn(`[rari] Router cannot navigate in non-browser environment`);else if(!e)console.warn(`[rari] Router not initialized, falling back to window.location`),n?.replace?window.location.replace(t):window.location.href=t;else return e(t,n)}export{n as i,t as n,i as r,r as t};
@@ -1 +1 @@
1
- var e=class{cookies;constructor(){this.cookies=/* @__PURE__ */ new Map}get(e){let t=this.cookies.get(e);if(t)return{name:t.name,value:t.value,path:t.options?.path}}getAll(){return Array.from(this.cookies.values(),e=>({name:e.name,value:e.value,path:e.options?.path}))}set(e,t,n){if(typeof e==`string`)this.cookies.set(e,{name:e,value:t,options:n});else{let{name:t,value:n,...r}=e;this.cookies.set(t,{name:t,value:n,options:r})}}delete(e){this.cookies.delete(e)}toSetCookieHeaders(){return Array.from(this.cookies.values(),e=>t(e))}};function t(e){let t=`${e.name}=${e.value}`,n=e.options;return n==null?t:(n.path!=null&&n.path!==``&&(t+=`; Path=${n.path}`),n.domain!=null&&n.domain!==``&&(t+=`; Domain=${n.domain}`),n.maxAge!=null&&(t+=`; Max-Age=${n.maxAge}`),n.expires&&(t+=`; Expires=${n.expires.toUTCString()}`),n.httpOnly&&(t+=`; HttpOnly`),n.secure&&(t+=`; Secure`),n.sameSite&&(t+=`; SameSite=${n.sameSite}`),t)}var n=class t extends Response{cookies;constructor(t,n){super(t,n),this.cookies=new e}static next(e){let n=new t(null,{status:200,headers:{"x-rari-proxy-continue":`true`}});return e?.request?.headers&&(e.request.headers instanceof Headers?e.request.headers:new Headers(e.request.headers)).forEach((e,t)=>{n.headers.set(`x-rari-proxy-request-${t}`,e)}),n}static redirect(e,n){return new t(null,{status:n!=null&&n!==0?n:307,headers:{Location:e.toString()}})}static rewrite(e){return new t(null,{status:200,headers:{"x-rari-proxy-rewrite":e.toString()}})}static json(e,n){let r=JSON.stringify(e),i=new Headers(n?.headers);return i.set(`Content-Type`,`application/json`),new t(r,{...n,headers:i})}};export{n as RariResponse};
1
+ var e=class{cookies;constructor(){this.cookies=/* @__PURE__ */ new Map}get(e){let t=this.cookies.get(e);if(t)return{name:t.name,value:t.value,path:t.options?.path}}getAll(){return Array.from(this.cookies.values(),e=>({name:e.name,value:e.value,path:e.options?.path}))}set(e,t,n){if(typeof e==`string`)this.cookies.set(e,{name:e,value:t,options:n});else{let{name:t,value:n,...r}=e;this.cookies.set(t,{name:t,value:n,options:r})}}delete(e){this.cookies.delete(e)}toSetCookieHeaders(){return Array.from(this.cookies.values(),e=>t(e))}};function t(e){let t=`${e.name}=${e.value}`,n=e.options;return n==null||(n.path!=null&&n.path!==``&&(t+=`; Path=${n.path}`),n.domain!=null&&n.domain!==``&&(t+=`; Domain=${n.domain}`),n.maxAge!=null&&(t+=`; Max-Age=${n.maxAge}`),n.expires&&(t+=`; Expires=${n.expires.toUTCString()}`),n.httpOnly&&(t+=`; HttpOnly`),n.secure&&(t+=`; Secure`),n.sameSite&&(t+=`; SameSite=${n.sameSite}`)),t}var n=class t extends Response{cookies;constructor(t,n){super(t,n),this.cookies=new e}static next(e){let n=new t(null,{status:200,headers:{"x-rari-proxy-continue":`true`}});return e?.request?.headers&&(e.request.headers instanceof Headers?e.request.headers:new Headers(e.request.headers)).forEach((e,t)=>{n.headers.set(`x-rari-proxy-request-${t}`,e)}),n}static redirect(e,n){return new t(null,{status:n!=null&&n!==0?n:307,headers:{Location:e.toString()}})}static rewrite(e){return new t(null,{status:200,headers:{"x-rari-proxy-rewrite":e.toString()}})}static json(e,n){let r=JSON.stringify(e),i=new Headers(n?.headers);return i.set(`Content-Type`,`application/json`),new t(r,{...n,headers:i})}};export{n as RariResponse};
@@ -1,4 +1,4 @@
1
- import{g as e}from"./type-guards-BLY2PlGR.mjs";import{i as t,n,r,t as i}from"./execute-DJ7w3uhW.mjs";import{promises as a}from"node:fs";import o from"node:path";function s(t){return e(t)&&t.rules!=null}async function c(e){if(typeof e==`function`){let t=e(),n=t instanceof Promise?await t:t;if(!s(n))throw Error(`Robots default export must resolve to a robots object`);return n}if(!s(e))throw Error(`Robots default export must be a robots object`);return e}function l(e){return typeof e==`string`?e===``?[`*`]:[e]:e==null?[`*`]:[...e]}function u(e){return e===void 0?[]:typeof e==`string`?e===``?[]:[e]:[...e].filter(e=>e!==``)}function d(e){let t=[],n=l(e.userAgent);for(let r of n){t.push(`User-Agent: ${r}`);let n=u(e.allow);for(let e of n)t.push(`Allow: ${e}`);let i=u(e.disallow);for(let e of i)t.push(`Disallow: ${e}`);e.crawlDelay!==void 0&&t.push(`Crawl-delay: ${e.crawlDelay}`),t.push(``)}return t}function f(e){return e==null||e===``?[]:[`Host: ${e}`,``]}function p(e){return u(e).map(e=>`Sitemap: ${e}`)}function m(e){let t=[],n=Array.isArray(e.rules)?e.rules:[e.rules];for(let e of n)t.push(...d(e));return t.push(...f(e.host)),t.push(...p(e.sitemap)),t.join(`
1
+ import{g as e}from"./type-guards-BLY2PlGR.mjs";import{i as t,n,r,t as i}from"./execute-C7dN28Np.mjs";import{promises as a}from"node:fs";import o from"node:path";function s(t){return e(t)&&t.rules!=null}async function c(e){if(typeof e==`function`){let t=e(),n=t instanceof Promise?await t:t;if(!s(n))throw Error(`Robots default export must resolve to a robots object`);return n}if(!s(e))throw Error(`Robots default export must be a robots object`);return e}function l(e){return typeof e==`string`?e===``?[`*`]:[e]:e==null?[`*`]:[...e]}function u(e){return e===void 0?[]:typeof e==`string`?e===``?[]:[e]:[...e].filter(e=>e!==``)}function d(e){let t=[],n=l(e.userAgent);for(let r of n){t.push(`User-Agent: ${r}`);let n=u(e.allow);for(let e of n)t.push(`Allow: ${e}`);let i=u(e.disallow);for(let e of i)t.push(`Disallow: ${e}`);e.crawlDelay!==void 0&&t.push(`Crawl-delay: ${e.crawlDelay}`),t.push(``)}return t}function f(e){return e==null||e===``?[]:[`Host: ${e}`,``]}function p(e){return u(e).map(e=>`Sitemap: ${e}`)}function m(e){let t=[],n=Array.isArray(e.rules)?e.rules:[e.rules];for(let e of n)t.push(...d(e));return t.push(...f(e.host)),t.push(...p(e.sitemap)),t.join(`
2
2
  `)}
3
3
  /* v8 ignore start - file system operations, better tested in integration/e2e */
4
4
  async function h(e,n=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`]){return t({appDir:e,staticFileName:`robots.txt`,dynamicBaseName:`robots`,extensions:n,rethrowNonEnoent:!0})}
@@ -1 +1 @@
1
- import{isLayoutReuseMarker as e,layoutPathOf as t}from"./runtime/merge-flight-refresh.mjs";import{r as n,t as r}from"./react-helpers-duOBWuYF.mjs";import{cloneElement as i,createElement as a,isValidElement as o}from"react";const s=`children`;function c(e){let t=e.length;for(;t>1&&e[t-1]===`/`;)--t;return e.slice(0,t)}function l(e){let t=e===`/`||e===``?`/`:c(e)||`/`,n=t===`/`?[]:t.slice(1).split(`/`).filter(Boolean),r=[``,{}];for(let e=n.length-1;e>=0;--e)r=[n[e],{[s]:r}];return[``,{[s]:r}]}function u(e){let t=[],n=e;for(;n;){let e=n[0],r=n[1];e&&t.push(e),n=r.children}return t}function d(e){return u(l(e))}const f=`rari-layout-slot`;function p(){return{rsc:null,data:/* @__PURE__ */ new Map,slots:null}}function m(e,t){e.slots??=/* @__PURE__ */ new Map;let n=e.slots.get(t);return n??(n=p(),e.slots.set(t,n)),n}function h(e,t){let n=e;for(let e of t)n=m(n,e);return n}function g(e,t){let n=e;for(let e of t){let t=n.slots?.get(e);if(t==null)return null;n=t}return n}function _(e,t){if(t.length===0){e.rsc=null,e.data.clear(),e.slots=null;return}let n=e;for(let e=0;e<t.length-1;e+=1){let r=t[e],i=n.slots?.get(r);if(i==null)return;n=i}let r=t[t.length-1];n.slots!=null&&n.slots.has(r)&&(n.slots.delete(r),n.slots.size===0&&(n.slots=null))}function v(e){return e===`/`||e===``?[]:e.replace(/^\//,``).split(`/`).filter(Boolean)}function y(e){return e.props.children}function b(e){let t={...e.props};return delete t.children,t}function x(e,t){let n=r(t);return i(e,b(e),...n.length===0?[null]:n)}function S(e){return e.type===f}function C(e){if(Array.isArray(e)){for(let t of r(e))if(C(t))return!0;return!1}return o(e)?S(e)?!0:C(y(e)):!1}function w(e){return a(f,{"data-rari-layout-path":e,style:{display:`contents`}})}function T(e,t){return e===`/`?t!==`/`:t.startsWith(`${e}/`)}function E(e,n){if(Array.isArray(e)){for(let t of r(e))E(t,n);return}if(!o(e))return;let i=t(e);i!=null&&!n.includes(i)&&n.push(i);for(let t of r(y(e)))E(t,n)}function D(e,n){let i=[];function a(e){if(e==null||e===!1||e===!0)return e;if(Array.isArray(e))return r(e).map(a);if(!o(e))return e;let s=t(e);if(s!=null&&s!==n&&T(n,s)&&!S(e))return i.push({path:s,content:y(e)}),w(s);let c=y(e);if(c==null)return e;let l=a(c);return Object.is(l,c)?e:x(e,l)}return{chrome:a(e),nested:i}}function O(e,n){if(t(e)===n)return e;for(let t of r(y(e))){if(!o(t))continue;let e=O(t,n);if(e!=null)return e}return null}function k(e,t){if(Array.isArray(e)){for(let n of r(e)){let e=k(n,t);if(e!=null)return e}return null}return o(e)?O(e,t):null}function A(e){return e.length===0?`/`:`/${e.join(`/`)}`}function j(e){return e.rsc==null&&e.data.size===0&&(e.slots==null||e.slots.size===0)}function M(n){let i=[];function a(n){if(n==null||n===!1||n===!0)return n;if(Array.isArray(n))return r(n).map(a);if(!o(n))return n;let s=t(n);if(s!=null&&!S(n)&&!e(n))return i.push({path:s,content:y(n)}),x(n,w(s));let c=y(n);if(c==null)return n;let l=a(c);return Object.is(l,c)?n:x(n,l)}let s=a(n);return o(s)?{shell:s,entries:i}:{shell:n,entries:i}}function N(n){let r=n,i=null;for(;o(r)&&e(r);){let e=t(r);if(e==null)return{targetPath:null,content:n};i=e,r=y(r)}return{targetPath:i,content:r}}const P=new class{shell=null;root=p();version=0;listeners=/* @__PURE__ */ new Set;documentSnapshot=null;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getVersion=()=>this.version;bump(){this.version+=1;for(let e of this.listeners)e()}notify(){this.documentSnapshot=null,this.bump()}getShell(){return this.shell}getDocumentSnapshot=()=>{let{pathname:e,search:t}=F(),n=`${e}${t}`,r=this.hasRoute(e,t);return this.documentSnapshot!=null&&this.documentSnapshot.shell===this.shell&&this.documentSnapshot.routeKey===n&&this.documentSnapshot.ok===r||(this.documentSnapshot={shell:this.shell,routeKey:n,ok:r}),this.documentSnapshot};hasRoute(e,t){return g(this.root,d(e))?.data.has(t)===!0}readChrome(e){return g(this.root,v(e))?.rsc??null}readLeaf(e,t){let n=g(this.root,d(e));return n==null||!n.data.has(t)?null:n.data.get(t)??null}readSegmentSnapshot(e,t){let{pathname:n,search:r}=t??F();return this.isDeepestLayout(e,n)?this.readLeaf(n,r):this.readChrome(e)}isDeepestLayout(e,t){let n=this.readChrome(e);if(n==null)return!0;let r=[];E(n,r);let i=t===`/`||t===``?`/`:t.replace(/\/$/,``)||`/`;return!r.some(t=>T(e,t)?t===`/`||i===t||i.startsWith(`${t}/`):!1)}ingest(e,t,r){if(!n(e)||C(e))return!1;let{shell:i,entries:a}=M(e);if(this.shell=i,a.length===0)return h(this.root,d(t)).data.set(r,e),this.bump(),!0;for(let e of a)this.writeStampContent(e.path,e.content,t,r);return this.bump(),!0}ingestSegment(e,n,r){if(this.shell==null||!o(e))return!1;let{targetPath:i,content:a}=N(e);return i==null?!o(a)||t(a)==null||!this.ingestStampTree(a,n,r)?!1:(this.bump(),!0):this.isAddressableLayoutPath(i)?(this.writeStampContent(i,a,n,r),this.bump(),!0):!1}ingestStampTree(e,t,n){let r=[];if(E(e,r),r.length===0)return!1;for(let i of r){let r=O(e,i);r==null||S(r)||this.writeStampContent(i,y(r),t,n)}return!0}isAddressableLayoutPath(e){if(this.shell!=null&&O(this.shell,e)!=null)return!0;let t=v(e);for(let n=0;n<t.length;n+=1){let r=A(t.slice(0,n)),i=this.readChrome(r);if(i!=null&&k(i,e)!=null)return!0}return!1}writeStampContent(e,t,n,r){if(o(t)&&S(t))return;let{chrome:i,nested:a}=D(t,e===``?`/`:e);if(o(i)&&S(i)&&a.length===0)return;let s=h(this.root,v(e));if(s.rsc=i,a.length===0){h(this.root,d(n)).data.set(r,t);return}for(let e of a)this.writeStampContent(e.path,e.content,n,r)}getElement(e,t){if(this.hasRoute(e,t))return this.shell??void 0}set(e,t,r){n(r)&&this.ingest(r,e,t)}invalidate(e,t){let n=d(e);if(n.length===0){this.shell=null,this.root=p(),this.bump();return}let r=g(this.root,n);r!=null&&(r.data.delete(t),r.rsc=null,r.slots=null,j(r)&&_(this.root,n),this.bump())}evictLeaf(e,t){let n=d(e),r=g(this.root,n);r!=null&&(r.data.delete(t),j(r)&&_(this.root,n),this.bump())}clear(){this.shell=null,this.root=p(),this.documentSnapshot=null,this.bump()}};function F(){return typeof window>`u`?{pathname:`/`,search:``}:{pathname:window.location.pathname,search:window.location.search}}function I(){let{pathname:e,search:t}=F();return JSON.stringify({pathname:e,search:t,tree:l(e)})}export{I as a,S as i,F as n,P as r,C as t};
1
+ import{isLayoutReuseMarker as e,layoutPathOf as t}from"./runtime/merge-flight-refresh.mjs";import{r as n,t as r}from"./react-helpers-duOBWuYF.mjs";import{cloneElement as i,createElement as a,isValidElement as o}from"react";const s=`children`;function c(e){let t=e.length;for(;t>1&&e[t-1]===`/`;)--t;return e.slice(0,t)}function l(e){let t=e===`/`||e===``?`/`:c(e)||`/`,n=t===`/`?[]:t.slice(1).split(`/`).filter(Boolean),r=[``,{}];for(let e=n.length-1;e>=0;--e)r=[n[e],{[s]:r}];return[``,{[s]:r}]}function u(e){let t=[],n=e;for(;n;){let e=n[0],r=n[1];e&&t.push(e),n=r.children}return t}function d(e){return u(l(e))}const f=`rari-layout-slot`;function p(){return{rsc:null,data:/* @__PURE__ */ new Map,slots:null}}function m(e,t){e.slots??=/* @__PURE__ */ new Map;let n=e.slots.get(t);return n??(n=p(),e.slots.set(t,n)),n}function h(e,t){let n=e;for(let e of t)n=m(n,e);return n}function g(e,t){let n=e;for(let e of t){let t=n.slots?.get(e);if(t==null)return null;n=t}return n}function _(e,t){if(t.length===0){e.rsc=null,e.data.clear(),e.slots=null;return}let n=e;for(let e=0;e<t.length-1;e+=1){let r=t[e],i=n.slots?.get(r);if(i==null)return;n=i}let r=t[t.length-1];n.slots!=null&&n.slots.has(r)&&(n.slots.delete(r),n.slots.size===0&&(n.slots=null))}function v(e){return e===`/`||e===``?[]:e.replace(/^\//,``).split(`/`).filter(Boolean)}function y(e){return e.props.children}function b(e){let t={...e.props};return delete t.children,t}function x(e,t){let n=r(t);return i(e,b(e),...n.length===0?[null]:n)}function S(e){return e.type===f}function C(e){if(Array.isArray(e)){for(let t of r(e))if(C(t))return!0;return!1}return o(e)?S(e)?!0:C(y(e)):!1}function w(e){return a(f,{"data-rari-layout-path":e,style:{display:`contents`}})}function T(e,t){return e===`/`?t!==`/`:t.startsWith(`${e}/`)}function E(e,n){if(Array.isArray(e)){for(let t of r(e))E(t,n);return}if(!o(e))return;let i=t(e);i!=null&&!n.includes(i)&&n.push(i);for(let t of r(y(e)))E(t,n)}function D(e,n){let i=[];function a(e){if(e==null||e===!1||e===!0)return e;if(Array.isArray(e))return r(e).map(a);if(!o(e))return e;let s=t(e);if(s!=null&&s!==n&&T(n,s)&&!S(e))return i.push({path:s,content:y(e)}),w(s);let c=y(e);if(c==null)return e;let l=a(c);return Object.is(l,c)?e:x(e,l)}return{chrome:a(e),nested:i}}function O(e,n){if(t(e)===n)return e;for(let t of r(y(e))){if(!o(t))continue;let e=O(t,n);if(e!=null)return e}return null}function k(e,t){if(Array.isArray(e)){for(let n of r(e)){let e=k(n,t);if(e!=null)return e}return null}return o(e)?O(e,t):null}function A(e){return e.length===0?`/`:`/${e.join(`/`)}`}function j(e){return e.rsc==null&&e.data.size===0&&(e.slots==null||e.slots.size===0)}function M(n){let i=[];function a(n){if(n==null||n===!1||n===!0)return n;if(Array.isArray(n))return r(n).map(a);if(!o(n))return n;let s=t(n);if(s!=null&&!S(n)&&!e(n))return i.push({path:s,content:y(n)}),x(n,w(s));let c=y(n);if(c==null)return n;let l=a(c);return Object.is(l,c)?n:x(n,l)}let s=a(n);return o(s)?{shell:s,entries:i}:{shell:n,entries:i}}function N(n){let r=n,i=null;for(;o(r)&&e(r);){let e=t(r);if(e==null)return{targetPath:null,content:n};i=e,r=y(r)}return{targetPath:i,content:r}}const P=new class{shell=null;root=p();version=0;listeners=/* @__PURE__ */ new Set;documentSnapshot=null;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getVersion=()=>this.version;bump(){this.version+=1;for(let e of this.listeners)e()}notify(){this.documentSnapshot=null,this.bump()}getShell(){return this.shell}getDocumentSnapshot=()=>{let{pathname:e,search:t}=F(),n=`${e}${t}`,r=this.hasRoute(e,t);return this.documentSnapshot!=null&&this.documentSnapshot.shell===this.shell&&this.documentSnapshot.routeKey===n&&this.documentSnapshot.ok===r||(this.documentSnapshot={shell:this.shell,routeKey:n,ok:r}),this.documentSnapshot};hasRoute(e,t){return g(this.root,d(e))?.data.has(t)===!0}readChrome(e){return g(this.root,v(e))?.rsc??null}readLeaf(e,t){let n=g(this.root,d(e));return n==null||!n.data.has(t)?null:n.data.get(t)??null}readSegmentSnapshot(e,t){let{pathname:n,search:r}=t??F();return this.isDeepestLayout(e,n)?this.readLeaf(n,r):this.readChrome(e)}isDeepestLayout(e,t){let n=this.readChrome(e);if(n==null)return!0;let r=[];E(n,r);let i=t===`/`||t===``?`/`:t.replace(/\/$/,``)||`/`;return!r.some(t=>T(e,t)?t===`/`||i===t||i.startsWith(`${t}/`):!1)}ingest(e,t,r){if(!n(e)||C(e))return!1;let{shell:i,entries:a}=M(e);if(this.shell=i,a.length===0)return h(this.root,d(t)).data.set(r,e),this.bump(),!0;for(let e of a)this.writeStampContent(e.path,e.content,t,r);return this.bump(),!0}ingestSegment(e,n,r){if(this.shell==null||!o(e))return!1;let{targetPath:i,content:a}=N(e);return i==null?!o(a)||t(a)==null||!this.ingestStampTree(a,n,r)?!1:(this.bump(),!0):this.isAddressableLayoutPath(i)?(this.writeStampContent(i,a,n,r),this.bump(),!0):!1}ingestStampTree(e,t,n){let r=[];if(E(e,r),r.length===0)return!1;for(let i of r){let r=O(e,i);r==null||S(r)||this.writeStampContent(i,y(r),t,n)}return!0}isAddressableLayoutPath(e){if(this.shell!=null&&O(this.shell,e)!=null)return!0;let t=v(e);for(let n=0;n<t.length;n+=1){let r=A(t.slice(0,n)),i=this.readChrome(r);if(i!=null&&k(i,e)!=null)return!0}return!1}writeStampContent(e,t,n,r){if(o(t)&&S(t))return;let{chrome:i,nested:a}=D(t,e===``?`/`:e);if(o(i)&&S(i)&&a.length===0)return;let s=h(this.root,v(e));if(s.rsc=i,a.length===0)h(this.root,d(n)).data.set(r,t);else for(let e of a)this.writeStampContent(e.path,e.content,n,r)}getElement(e,t){if(this.hasRoute(e,t))return this.shell??void 0}set(e,t,r){n(r)&&this.ingest(r,e,t)}invalidate(e,t){let n=d(e);if(n.length===0){this.shell=null,this.root=p(),this.bump();return}let r=g(this.root,n);r!=null&&(r.data.delete(t),r.rsc=null,r.slots=null,j(r)&&_(this.root,n),this.bump())}evictLeaf(e,t){let n=d(e),r=g(this.root,n);r!=null&&(r.data.delete(t),j(r)&&_(this.root,n),this.bump())}clear(){this.shell=null,this.root=p(),this.documentSnapshot=null,this.bump()}};function F(){return typeof window>`u`?{pathname:`/`,search:``}:{pathname:window.location.pathname,search:window.location.search}}function I(){let{pathname:e,search:t}=F();return JSON.stringify({pathname:e,search:t,tree:l(e)})}export{I as a,S as i,F as n,P as r,C as t};
@@ -1 +1 @@
1
- import{n as e}from"./navigate-DuyUa6qD.mjs";import{g as t,i as n}from"./type-guards-BLY2PlGR.mjs";import{i as r,n as i,r as a,t as o}from"./navigation-transition-store-dfNJmkIX.mjs";import{c as s}from"react/compiler-runtime";import{createContext as c,use as l,useEffect as u,useRef as d,useSyncExternalStore as f}from"react";import{jsx as p}from"react/jsx-runtime";const m=c(null);function h(){let e=l(m);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function g(){return h().pathname}function _(){return h().searchParams}function v(){return f(a,b,y)}function y(){return o().generation}function b(){return i().generation}function x(e){return t(e)&&typeof e.navigate==`function`}function S(t){let r=s(17),{children:c,initialPathname:l}=t,h;r[0]===l?h=r[1]:(h=()=>o(l),r[0]=l,r[1]=h);let g=f(a,i,h),_=d(null),v;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],r[2]=v):v=r[2],u(D,v);let y,b;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let t=e();t&&(_.current=t);let r=e=>{let t=n(e,x);t&&(_.current=t.navigate)},i=()=>{_.current=null};return window.addEventListener(`rari:register-navigate`,r),window.addEventListener(`rari:deregister-navigate`,i),()=>{window.removeEventListener(`rari:register-navigate`,r),window.removeEventListener(`rari:deregister-navigate`,i)}},b=[],r[3]=y,r[4]=b):(y=r[3],b=r[4]),u(y,b);let S;r[5]===g.search?S=r[6]:(S=g.search.startsWith(`?`)?g.search.slice(1):g.search,r[5]=g.search,r[6]=S);let O;r[7]===S?O=r[8]:(O=new URLSearchParams(S),r[7]=S,r[8]=O);let k=O,A,j;r[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=async(e,t)=>{_.current?await _.current(e,t):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.href=e)},j=async(e,t)=>{_.current?await _.current(e,{...t,replace:!0}):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.replace(e))},r[9]=A,r[10]=j):(A=r[9],j=r[10]);let M;r[11]!==k||r[12]!==g.pathname?(M={pathname:g.pathname,searchParams:k,push:A,replace:j,back:E,forward:T,refresh:w,prefetch:C},r[11]=k,r[12]=g.pathname,r[13]=M):M=r[13];let N=M,P;return r[14]!==c||r[15]!==N?(P=/* @__PURE__ */ p(m,{value:N,children:c}),r[14]=c,r[15]=N,r[16]=P):P=r[16],P}async function C(e){try{let t=new URL(e,window.location.origin);await fetch(t.pathname+t.search,{headers:{Accept:`text/x-component`},priority:`low`})}catch(e){console.warn(`[rari] Prefetch failed:`,e)}}function w(){window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`))}function T(){window.history.forward()}function E(){window.history.back()}function D(){r()}export{v as a,_ as i,g as n,h as r,S as t};
1
+ import{n as e}from"./navigate-CSQP4q53.mjs";import{g as t,i as n}from"./type-guards-BLY2PlGR.mjs";import{i as r,n as i,r as a,t as o}from"./navigation-transition-store-dfNJmkIX.mjs";import{c as s}from"react/compiler-runtime";import{createContext as c,use as l,useEffect as u,useRef as d,useSyncExternalStore as f}from"react";import{jsx as p}from"react/jsx-runtime";const m=c(null);function h(){let e=l(m);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function g(){return h().pathname}function _(){return h().searchParams}function v(){return f(a,b,y)}function y(){return o().generation}function b(){return i().generation}function x(e){return t(e)&&typeof e.navigate==`function`}function S(t){let r=s(17),{children:c,initialPathname:l}=t,h;r[0]===l?h=r[1]:(h=()=>o(l),r[0]=l,r[1]=h);let g=f(a,i,h),_=d(null),v;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],r[2]=v):v=r[2],u(D,v);let y,b;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let t=e();t&&(_.current=t);let r=e=>{let t=n(e,x);t&&(_.current=t.navigate)},i=()=>{_.current=null};return window.addEventListener(`rari:register-navigate`,r),window.addEventListener(`rari:deregister-navigate`,i),()=>{window.removeEventListener(`rari:register-navigate`,r),window.removeEventListener(`rari:deregister-navigate`,i)}},b=[],r[3]=y,r[4]=b):(y=r[3],b=r[4]),u(y,b);let S;r[5]===g.search?S=r[6]:(S=g.search.startsWith(`?`)?g.search.slice(1):g.search,r[5]=g.search,r[6]=S);let O;r[7]===S?O=r[8]:(O=new URLSearchParams(S),r[7]=S,r[8]=O);let k=O,A,j;r[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=async(e,t)=>{_.current?await _.current(e,t):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.href=e)},j=async(e,t)=>{_.current?await _.current(e,{...t,replace:!0}):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.replace(e))},r[9]=A,r[10]=j):(A=r[9],j=r[10]);let M;r[11]!==k||r[12]!==g.pathname?(M={pathname:g.pathname,searchParams:k,push:A,replace:j,back:E,forward:T,refresh:w,prefetch:C},r[11]=k,r[12]=g.pathname,r[13]=M):M=r[13];let N=M,P;return r[14]!==c||r[15]!==N?(P=/* @__PURE__ */ p(m,{value:N,children:c}),r[14]=c,r[15]=N,r[16]=P):P=r[16],P}async function C(e){try{let t=new URL(e,window.location.origin);await fetch(t.pathname+t.search,{headers:{Accept:`text/x-component`},priority:`low`})}catch(e){console.warn(`[rari] Prefetch failed:`,e)}}function w(){window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`))}function T(){window.history.forward()}function E(){window.history.back()}function D(){r()}export{v as a,_ as i,g as n,h as r,S as t};
package/dist/router.mjs CHANGED
@@ -1 +1 @@
1
- import{r as e}from"./navigate-DuyUa6qD.mjs";import{a as t,i as n,n as r,r as i,t as a}from"./router-Cc9lVbtA.mjs";export{a as RouterProvider,e as navigate,r as usePathname,i as useRouter,n as useSearchParams,t as useViewTransitionKey};
1
+ import{r as e}from"./navigate-CSQP4q53.mjs";import{a as t,i as n,n as r,r as i,t as a}from"./router-kf_rLP_F.mjs";export{a as RouterProvider,e as navigate,r as usePathname,i as useRouter,n as useSearchParams,t as useViewTransitionKey};
@@ -0,0 +1 @@
1
+ import{g as e}from"./type-guards-BLY2PlGR.mjs";import{o as t}from"./path-CTEC1xmy.mjs";import{Buffer as n}from"node:buffer";import r from"node:fs";import i from"node:path";import{createBuilder as a}from"vite-plus";const o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map;function c(e){let t=o.get(e);return t===void 0&&(t=r.existsSync(e),o.set(e,t)),t}function l(e){let t=s.get(e);if(t!==void 0)return t;try{t=r.statSync(e).isDirectory()}catch{t=!1}return s.set(e,t),t}function u(){o.clear(),s.clear()}function d(e,t){let n=null;for(let r of t)if(r!==``&&e.endsWith(r)&&(n??=c(e),n&&!l(e)))return e;for(let n of t){let t=`${e}${n}`;if(c(t)&&!l(t))return t}return null}function f(e,t){if(c(e)){if(!l(e))return null;for(let n of t){let t=i.join(e,`index${n}`);if(c(t))return t}}return null}const p=[`.tsx`,`.jsx`,`.ts`,`.js`];function m(e,t,n={},r=p){let a=e;for(let[t,r]of Object.entries(n))if(e.startsWith(`${t}/`)){a=e.replace(t,r);break}else if(e===t){a=r;break}let o=i.resolve(i.dirname(t),a),s=d(o,r);if(s!=null&&s!==``)return s;let c=f(o,r);return c!=null&&c!==``?c:`${o}.tsx`}const h=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`];function g(e,t=h){return d(e,t)??f(e,t)}const _=/* @__PURE__ */ new WeakMap;function v(e){let t=_.get(e);return t||(t=Object.entries(e).sort((e,t)=>t[0].length-e[0].length),_.set(e,t),t)}function y(e,t,n){if(typeof e!=`string`)throw TypeError(`Expected source to be a string, but received ${typeof e}`);if(typeof t!=`object`||Array.isArray(t))throw TypeError(`Expected aliases to be a plain object, but received ${Array.isArray(t)?`array`:typeof t}`);if(Object.getPrototypeOf(t)!==Object.prototype&&Object.getPrototypeOf(t)!==null)throw TypeError(`Expected aliases to be a plain object, but received ${t.constructor.name||`object with custom prototype`}`);if(typeof n!=`string`)throw TypeError(`Expected projectRoot to be a string, but received ${typeof n}`);let r=v(t);for(let[t,a]of r)if(e.startsWith(`${t}/`)||e===t){let r=e.slice(t.length).replace(/^\/+/,``),o=i.join(a,r);return i.isAbsolute(o)?o:i.resolve(n,o)}return null}const b=/^node:/,x=/* @__PURE__ */ new Map;function S(e){let t=i.resolve(e.root);return JSON.stringify({root:t,configFile:e.configFile??null,logLevel:e.logLevel??null})}async function C(e){let t=typeof e==`string`?{root:e}:e,n=i.resolve(t.root),r=S(t),o=x.get(r);return o??(o=a({root:n,...t.configFile===void 0?{}:{configFile:t.configFile},...t.logLevel==null?{}:{logLevel:t.logLevel},oxc:{jsx:{development:!1}}}).catch(e=>{throw x.delete(r),e}),x.set(r,o)),o}function w(t){let n=i.resolve(t);for(let t of x.keys()){let r=JSON.parse(t);e(r)&&r.root===n&&x.delete(t)}}function T(e){return typeof e==`object`&&!!e&&`type`in e}function E(e){let t=Array.isArray(e)?e:[e],n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e.output;if(Array.isArray(t))for(let e of t)T(e)&&n.push(e)}return n}function D(e){return typeof e==`string`?e:n.from(e).toString(`utf8`)}function O(e){return e==null?[]:e instanceof Set?[...e].map(e=>t(String(e))):Array.isArray(e)?e.map(e=>t(String(e))):[]}const k=[b,`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react/compiler-runtime`,/^rari(?:\/|$)/,`react-server-dom-rari/server`],A=[b,`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react/compiler-runtime`,/^rari(?:\/|$)/,`react-server-dom-webpack/client`,/^react-server-dom-webpack\//];function j(e){return{write:e.write,emptyOutDir:e.emptyOutDir,copyPublicDir:e.copyPublicDir,minify:e.minify,emitAssets:e.emitAssets,rolldownOptions:e.rolldownOptions}}function M(e,t){e.write=t.write,e.emptyOutDir=t.emptyOutDir,e.copyPublicDir=t.copyPublicDir,e.minify=t.minify,e.emitAssets=t.emitAssets,e.rolldownOptions=t.rolldownOptions}function N(e){let n=/* @__PURE__ */ new Map,r=[],i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map;for(let o of e){if(o.type===`asset`){let e=t(o.fileName);e.endsWith(`.css`)?n.set(e,D(o.source)):r.push({fileName:e,code:o.source});continue}let e=t(o.fileName);if(o.isEntry){let e=o.name;if(e==null||e===``)continue;i.set(e,{code:o.code,cssAssetSources:[]}),a.set(e,O(o.viteMetadata?.importedCss))}else r.push({fileName:e,code:o.code})}return{cssByFileName:n,extraFiles:r,entryOutputs:i,entryCssFiles:a}}function P(e,t,n){for(let[r,i]of e){let a=(t.get(r)??[]).map(e=>n.get(e)).filter(e=>e!=null);a.length===0&&e.size===1&&n.size>0?e.set(r,{...i,cssAssetSources:[...n.values()]}):e.set(r,{...i,cssAssetSources:a})}}async function F(e){let t=/* @__PURE__ */ new Map,n=[];for(let r of e.entries){let i=await L({...e,entries:[r]});if(i==null)return null;for(let[e,n]of i.outputs)t.set(e,n);n.push(...i.extraFiles)}return{outputs:t,extraFiles:n}}function I(e,t,n,r){e.write=!1,e.emptyOutDir=!1,e.copyPublicDir=!1,e.emitAssets=!0,e.minify=t.minify===!0&&`oxc`,e.rolldownOptions={...r,input:n,platform:`node`,output:{format:`es`,entryFileNames:`[name].js`,chunkFileNames:`chunks/[name]-[hash].js`,assetFileNames:`assets/[name]-[hash][extname]`,...t.codeSplitting===!1?{codeSplitting:!1}:{}},external:[...t.environmentName===`ssr`?A:k]}}async function L(t){if(t.entries.length===0)return{outputs:/* @__PURE__ */ new Map,extraFiles:[]};if(t.codeSplitting===!1&&t.entries.length>1)return F(t);let n=t.viteBuilder.environments[t.environmentName];if(n==null)return null;await n.init();let r={};for(let e of t.entries)r[e.entryName]=e.filePath;let i=n.config.build,a=j(i),o=e(a.rolldownOptions)?{...a.rolldownOptions}:{},s=t.label??t.environmentName.toUpperCase();try{I(i,t,r,o);let e=E(await t.viteBuilder.build(n));if(e.length===0)return null;let a=N(e);P(a.entryOutputs,a.entryCssFiles,a.cssByFileName);for(let e of t.entries)if(!a.entryOutputs.has(e.entryName))return null;return{outputs:a.entryOutputs,extraFiles:a.extraFiles}}catch(e){return console.warn(`[rari] Vite ${s} environment build failed:`,e),null}finally{M(i,a)}}async function R(e){return L({viteBuilder:e.viteBuilder,environmentName:`rsc`,entries:e.entries.map(e=>({entryName:e.componentId,filePath:e.filePath})),minify:e.minify,codeSplitting:e.codeSplitting,label:`RSC`})}async function z(e){return L({viteBuilder:e.viteBuilder,environmentName:`ssr`,entries:e.entries,minify:e.minify??!1,label:`SSR`})}function B(e,n){return t(i.join(e,`${n}.js`))}async function V(e){let t=await a({configFile:!1,root:e.root,logLevel:`error`,plugins:[...e.plugins],define:{global:`globalThis`},resolve:{conditions:[`import`,`module`,`default`],extensions:[`.mjs`,`.js`,`.ts`,`.tsx`,`.jsx`],mainFields:[`module`,`main`]},environments:{ssr:{consumer:`server`,build:{write:!1,emptyOutDir:!1,copyPublicDir:!1,emitAssets:!1,minify:!1,cssMinify:!1,target:`esnext`,rolldownOptions:{input:{entry:e.virtualId},platform:`node`,external:e.external,output:{format:`es`,codeSplitting:!1,entryFileNames:`[name].js`}}}}},builder:{sharedPlugins:!0},css:{transformer:`lightningcss`}}),n=t.environments.ssr;await n.init();let r=E(await t.build(n)),i=r.find(e=>e.type===`chunk`&&e.isEntry)??r.find(e=>e.type===`chunk`);return i?.type===`chunk`?{code:i.code}:null}export{C as a,u as c,w as i,m as l,R as n,B as o,z as r,y as s,V as t,g as u};
@@ -43,4 +43,5 @@ interface NavigationDetail {
43
43
  };
44
44
  }
45
45
  export declare function AppRouterProvider({ children, initialPayload, onNavigate }: AppRouterProviderProps): import("react").JSX.Element;
46
- //#endregion
46
+ //#endregion
47
+ export {};
@@ -1 +1 @@
1
- import{S as e,d as t,g as n,i as r,p as i,r as a,s as o}from"../type-guards-BLY2PlGR.mjs";import{i as s}from"../navigation-transition-store-dfNJmkIX.mjs";import{isLayoutReuseMarker as c,layoutPathOf as l,mergeFlightRefresh as u,unwrapFulfilledFlightNode as d}from"./merge-flight-refresh.mjs";import{a as f,i as p,n as m,r as h,t as g}from"../react-helpers-duOBWuYF.mjs";import{i as _,n as v,r as y,t as b}from"../route-cache-D2iIKQIU.mjs";import"./action-revalidation-kind.mjs";import{n as x,t as ee}from"../preload-modules-BDQFWAlZ.mjs";import{n as te,r as ne}from"../form-state-DAygOjc8.mjs";import{c as S}from"react/compiler-runtime";import{Suspense as C,addTransitionType as re,cloneElement as ie,createContext as w,createElement as T,isValidElement as E,startTransition as ae,use as D,useCallback as oe,useEffect as O,useLayoutEffect as se,useRef as k,useState as A,useSyncExternalStore as j}from"react";import{jsx as M,jsxs as N}from"react/jsx-runtime";import{createFromFetch as ce,createFromReadableStream as le}from"virtual:react-flight-client";const ue={position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,padding:`24px`,background:`rgba(220, 38, 38, 0.95)`,color:`white`,borderRadius:`8px`,fontSize:`14px`,zIndex:1e4,maxWidth:`500px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.3)`},P={padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},F={padding:`8px 16px`,background:`rgba(255, 255, 255, 0.2)`,color:`white`,border:`1px solid rgba(255, 255, 255, 0.3)`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},de={fetch:`Failed to fetch updated content from server.`,parse:`Failed to parse server response.`,stale:`Server returned stale content.`,network:`Network error occurred.`};function I(e){return de[e]}function fe(e){let t=S(27),{failure:n,maxRetries:r,onRefresh:i,onDismiss:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ M(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),s={marginBottom:`12px`,opacity:.9},t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c;t[2]===n.type?c=t[3]:(c=I(n.type),t[2]=n.type,t[3]=c);let l;t[4]===c?l=t[5]:(l=/* @__PURE__ */ M(`div`,{style:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},t[6]=u):u=t[6];let d;t[7]===n.details?d=t[8]:(d=/* @__PURE__ */ M(`div`,{style:u,children:n.details}),t[7]=n.details,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f={marginBottom:`12px`,fontSize:`12px`,opacity:.7},t[9]=f):f=t[9];let p;t[10]!==n.consecutiveFailures||t[11]!==r?(p=/* @__PURE__ */ N(`div`,{style:f,children:[`Consecutive failures: `,n.consecutiveFailures,` / `,r]}),t[10]=n.consecutiveFailures,t[11]=r,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m={display:`flex`,gap:`8px`},t[13]=m):m=t[13];let h;t[14]===i?h=t[15]:(h=/* @__PURE__ */ M(`button`,{onClick:i,type:`button`,style:P,children:`Refresh Page`}),t[14]=i,t[15]=h);let g;t[16]===a?g=t[17]:(g=/* @__PURE__ */ M(`button`,{onClick:a,type:`button`,style:F,children:`Dismiss`}),t[16]=a,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=/* @__PURE__ */ N(`div`,{style:m,children:[h,g]}),t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=/* @__PURE__ */ M(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`}),t[21]=v):v=t[21];let y;return t[22]!==_||t[23]!==l||t[24]!==d||t[25]!==p?(y=/* @__PURE__ */ N(`div`,{style:ue,children:[o,l,d,p,_,v]}),t[22]=_,t[23]=l,t[24]=d,t[25]=p,t[26]=y):y=t[26],y}function L(e,t,n){y.getShell()??y.ingest(e,t,n)}function R(e){if(e.fromPathname!==`/`&&(e.fromPathname!==e.toPathname||e.fromSearch!==e.search))return{pathname:e.fromPathname,search:e.fromSearch}}function z(e){if(L(e.previousDocument,e.fromPathname,e.fromSearch),h(e.refresh)){if(!y.ingest(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else if(E(e.refresh)){if(!y.ingestSegment(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else return{kind:`hard-nav`};if(y.getShell()==null||!y.hasRoute(e.toPathname,e.search))return{kind:`hard-nav`};let t=y.readLeaf(e.toPathname,e.search),n=m(e.refresh)||t!=null&&m(t),r=t!=null&&p(t)||p(e.refresh),i=R(e);return h(e.refresh)?{kind:`merged`,element:e.refresh,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}:{kind:`merged`,element:e.previousDocument,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}}function B(e,t,n,r){if(h(t))return y.ingest(t,n,r);if(E(t)&&y.getShell()!=null)return y.ingestSegment(t,n,r);let i=u(e,t);return E(t)&&c(t)&&i===e||!h(i)?!1:y.ingest(i,n,r)}function V(e,t){let n=m(e),r=p(e);return h(e)?{kind:`merged`,element:e,maySuspend:n,hasLoadingFallback:r}:h(t)?{kind:`merged`,element:t,maySuspend:n,hasLoadingFallback:r}:{kind:`hard-nav`}}function pe(e){return h(e.previousDocument)&&y.getShell()==null&&!y.ingest(e.previousDocument,e.pathname,e.search)||!B(e.previousDocument,e.refresh,e.pathname,e.search)||y.getShell()==null||!y.hasRoute(e.pathname,e.search)?{kind:`hard-nav`}:V(e.refresh,e.previousDocument)}function me(e){return e.historyKey!=null&&e.historyKey!==``?[`nav`,`nav-traverse`]:e.replace===!0?[`nav`,`nav-replace`]:[`nav`,`nav-forward`]}function he(e,t){if(e==null||e.url===``)return t;try{let t=`http://localhost/`;if(typeof window<`u`)try{t=window.location.href}catch{}let n=new URL(e.url,t);return{pathname:n.pathname,search:n.search}}catch{return t}}function H(e){e!=null&&typeof window<`u`&&(e.replace===!0?window.history.replaceState(e.state,``,e.url):window.history.pushState(e.state,``,e.url))}function ge(e){let{parsedPayload:t,shouldScrollToTop:n,navigationId:r,transitionTypes:i,maySuspend:a=!1,hasLoadingFallback:o=!1,pendingHistory:s,routeLocation:c,startTransition:l=ae,currentNavigationIdRef:u,pendingScrollPayloadRef:d,setRenderKey:f,setRscPayload:p,setRouteLocation:m,setPendingLoadingLeaf:h,clearHmrError:g,pendingNavigateCommittedIdRef:_,pendingEvictLeaf:v}=e;if(u.current!==r)return;let b=a&&o;a&&H(s),b&&c!=null&&(m?.(c),h?.(c));let x=()=>{u.current===r&&(h?.(null),a||H(s),c!=null&&m?.(c),v!=null&&y.evictLeaf(v.pathname,v.search),f(e=>{let r=e+1;return d.current=n?{payload:t,commitKey:r}:null,r}),p(t),g(),_.current=r)};l(()=>{if(i!=null)for(let e of i)re(e);x()})}const _e=w(null);function U(){return D(_e)}function W(e,t,n){return n?.pathname===e&&n.search===t}function G(){return j(y.subscribe,y.getVersion,y.getVersion)}function K(e){return l(e)!=null&&!_(e)&&!c(e)}function q(e,t,n){if(e==null||e===!1||e===!0)return e;if(Array.isArray(e))return g(e).map(e=>q(e,t,n));if(!E(e))return e;if(_(e)||K(e)){let r=l(e);return r==null?null:T(Y,{key:r,layoutPath:r,pathname:t,search:n})}let r=e.props,i=r.children;if(i==null)return e;let a=q(i,t,n);if(Object.is(a,i))return e;let o=g(a),s={...r};return delete s.children,ie(e,s,...o.length===0?[null]:o)}function J({layoutPath:e,pathname:t,search:n},r,i=null){let a=y.readSegmentSnapshot(e,{pathname:t,search:n});if(a==null||E(a)&&_(a))return null;if(y.isDeepestLayout(e,t)){let{fallback:e,content:r}=f(a);return W(t,n,i)&&e!=null?e:T(C,{fallback:e},r)}return q(a,t,n)}function Y(e){let t=S(4),n=G(),r=U(),i;return t[0]!==n||t[1]!==r||t[2]!==e?(i=J(e,n,r),t[0]=n,t[1]=r,t[2]=e,t[3]=i):i=t[3],i}function ve({fallback:e=null,pathname:t,search:n},r){let i=y.getShell();if(i!=null){let e=q(i,t,n);return E(e)?e:null}return e!=null&&b(e)?null:e}function ye(e){let t=S(3),n=G(),r;return t[0]!==n||t[1]!==e?(r=ve(e,n),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function be(e,t,n){return e==null||e.commitKey!==n?{shouldScroll:!1,nextPending:null}:t===e.payload?{shouldScroll:!0,nextPending:null}:{shouldScroll:!1,nextPending:e}}function xe(e){if(e==null)return null;if(i(e)){let t=d(e);return t===e||!h(t)?null:t}return h(e)?e:null}const Se=/"timestamp":(\d+)/;function Ce(e){if(!t(e)||o(e))return!1;let n=e.message;return n===`Failed to fetch`||n.includes(`NetworkError`)||n.includes(`network error`)||n.includes(`Load failed`)}async function we(e){await new Promise(t=>{setTimeout(t,e)})}async function X(e,t,n){if(e.maySuspend!==!0||e.hasLoadingFallback!==!0)return e;if(e.bodyComplete==null){await Promise.resolve();let r=y.readLeaf(t,n);return r!=null&&!m(r)?{...e,maySuspend:!1}:e}if(await Promise.race([e.bodyComplete.then(e=>e?`body`:`failed`),we(100).then(()=>`timeout`)])===`body`)return{...e,maySuspend:!1};let r=y.readLeaf(t,n);return r!=null&&!m(r)?{...e,maySuspend:!1}:e}function Te(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||E(e)||Array.isArray(e)}function Ee(e){return n(e)&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.navigationId==`number`&&n(e.options)}function De(e){return n(e)&&`element`in e}function Oe(e){return n(e)&&typeof e.navigationId==`number`&&typeof e.targetPath==`string`}function ke(e){if(!i(e))return e;if(n(e)&&e.status===`fulfilled`)return Te(e.value)?e.value:void 0}function Ae(e){return h(e)||E(e)&&c(e)}function je(e){let t=e.pendingHistory?.url;if(t!=null&&t!==``)try{return new URL(t,window.location.origin).search}catch{}return v().search}function Me(e,t){console.error(`[rari] AppRouter: Navigation failed:`,t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:e.from,to:e.to,error:t,navigationId:e.navigationId}}))}function Ne(e){let t=e.pendingHistory?.url,n=t!=null&&t!==``?new URL(t,window.location.origin).hash.length>0:window.location.hash.length>0;return(e.options.historyKey==null||e.options.historyKey===``)&&!n&&e.options.scroll!==!1}async function Pe(e,t,n,r,i,a,o,s){let l=await Fe(e.element);if(r!==n)return{kind:`superseded`};if(!Ae(l))return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let u=xe(t);if(E(l)&&c(l)&&u==null)return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: layout-reuse Flight marker requires a previous <html> document`)};if(u==null)return h(l)?(y.set(a,o,l),{kind:`payload`,payload:await X({...e,element:l,maySuspend:m(l),hasLoadingFallback:p(l)},a,o)}):{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let d=z({previousDocument:u,refresh:l,fromPathname:i,toPathname:a,fromSearch:s,search:o});return d.kind===`hard-nav`?{kind:`hard-nav`}:{kind:`payload`,payload:await X({...e,element:d.element,maySuspend:d.maySuspend,hasLoadingFallback:d.hasLoadingFallback===!0,pendingEvictLeaf:d.pendingEvictLeaf},a,o)}}async function Fe(e){let t=x(e);for(let e=0;e<10&&i(t);e+=1)t=x(await t);if(i(t))throw Error(`[rari] AppRouter: Flight content did not resolve to a React node`);return t}function Ie({children:c,initialPayload:l,onNavigate:u}){let[d,f]=A(l),p=k(l),[m,g]=A(0),[_,S]=A(()=>v()),[C,re]=A(null),ie=k(_),w=k({x:0,y:0}),T=k(null),D=k(/* @__PURE__ */ new Map),j=k(/* @__PURE__ */ new Set),ue=k(u),P=k(0),F=k(0),de=k(/* @__PURE__ */ new Map),I=k(null),L=k(null),R=k(/* @__PURE__ */ new Map),z=k([]),B=k(null),V=k(0),[H,U]=A(null);O(()=>{ie.current=_},[_]),O(()=>{ue.current=u},[u]),se(()=>{let{shouldScroll:e,nextPending:t}=be(T.current,d,m);T.current=t,e&&window.scrollTo(0,0);let n=L.current;n!=null&&(L.current=null,window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:n}})))},[d,m]),O(()=>{s()},[m]);let W=oe(e=>{if(e==null||i(e)||!E(e)||e.type!==`html`&&e.type!==`HTML`||b(e))return;let{pathname:t,search:n}=_;y.getShell()!=null&&y.hasRoute(t,n)||y.set(t,n,e)},[_]),G=k(W);O(()=>{G.current=W},[W]),O(()=>{p.current=d,d?.element!=null&&W(d.element)},[d,W]),O(()=>{if(d?.element!=null){let e=d.element;if(n(e)&&`status`in e&&e.status===`rejected`){let t=e.reason;t!=null&&t!==``&&console.error(`[rari] AppRouter: Flight payload rejected:`,t)}}},[d]);let K=()=>{D.current=te()},q=()=>{ne(D.current)};se(()=>{let e=I.current;e!=null&&d===e&&(I.current=null,window.scrollTo(w.current.x,w.current.y),q())},[d,m]);let J=(e,t,n,r)=>{V.current+=1;let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r,consecutiveFailures:V.current};z.current.push(i),z.current.length>10&&z.current.shift(),V.current>=2&&U(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},Y=()=>{setTimeout(()=>{window.location.reload()},1e3)},ve=()=>{V.current>0&&(V.current=0)},xe=e=>{if(B.current==null||B.current===``)return!1;if(e===B.current)return!0;let t=Se.exec(e);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1},X=e=>{ee(e,j.current);let t=new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}});return{element:le(t),flightProtocol:e}},Ae=async e=>{let t=await e;if(!t.body)throw Error(`Response has no body stream`);let n=t.clone();return{element:ce(Promise.resolve(t)),flightProtocol:``,bodyComplete:n.text().then(async e=>(await ee(e,j.current),e!==``&&(B.current=e),!0)).catch(()=>!1)}},Ie=async(t,n)=>{try{let e=await t.text();if(xe(e))return R.current.delete(n),`stale`;let r=await Fe(X(e).element);if(!h(r))throw Error(`[rari] AppRouter: refetched Flight content did not resolve to an <html> document root`);return{element:r,flightProtocol:e}}catch(t){if(o(t))throw t;let n=e(t),r=Error(`Failed to parse RSC Flight protocol: ${n.message}`,{cause:n});return J(r,`parse`,r.message,window.location.pathname),r}},Le=async(n,r,i)=>{let a=n!=null&&n!==``?n:window.location.pathname,s=P.current,c=i?.commit!==!1,l=i?.expectedRoute!=null&&i.expectedSeq!=null?`:hmr:${i.expectedRoute}:${i.expectedSeq}`:``,u=`${s}:${a}${window.location.search}:${c?`commit`:`defer`}${l}`,d=R.current.get(u);if(d)return d;let p=i?.expectedRoute,m=i?.expectedSeq,h=(async()=>{try{let e=a+window.location.search,t=await fetch(e,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(P.current)},cache:`no-store`,signal:r});if(!t.ok){let n=/* @__PURE__ */ Error(`Failed to fetch RSC data: ${t.status} ${t.statusText}`);throw J(n,`fetch`,`HTTP ${t.status} when fetching ${e}`,window.location.pathname),n}let n=await Ie(t,u);if(n===`stale`)return;if(n instanceof Error)throw n;let i=p==null||m==null||de.current.get(p)===m;return P.current===s&&i&&(c&&f(n),n.flightProtocol!=null&&n.flightProtocol!==``&&(B.current=n.flightProtocol),ve()),R.current.delete(u),n}catch(n){throw R.current.delete(u),t(n)&&!o(n)&&!n.message.includes(`Failed to fetch RSC data`)&&!n.message.includes(`Failed to parse`)&&J(n,`network`,`Network error: ${n.message}`,window.location.pathname),e(n)}})();return R.current.set(u,h),h},Re=k(X),ze=k(Ae),Be=k(Le);O(()=>{Re.current=X,ze.current=Ae,Be.current=Le}),O(()=>{if(typeof window>`u`)return;let t=async e=>{if(e.rscResponsePromise){let t=await e.rscResponsePromise;if(P.current!==e.navigationId)return;let n=await ze.current(Promise.resolve(t));return P.current===e.navigationId?n:void 0}if(e.rscResponse){let t=await ze.current(Promise.resolve(e.rscResponse));return P.current===e.navigationId?t:void 0}if(e.rscFlightProtocol!=null&&e.rscFlightProtocol!==``)return Re.current(e.rscFlightProtocol);if(!e.isStreaming)return Be.current(e.to,e.abortSignal,{commit:!1})},n=async(t,n)=>{try{let e=await Pe(n,p.current?.element,t.navigationId,P.current,t.from,t.to,je(t),ie.current.search);if(e.kind===`superseded`)return null;if(e.kind===`hard-nav`){if(P.current!==t.navigationId)return null;let e=t.pendingHistory?.url!=null&&t.pendingHistory.url!==``?t.pendingHistory.url:t.to;return window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:t.navigationId}})),window.location.assign(e),null}return e.kind===`error`?(Me(t,e.error),null):P.current===t.navigationId?e.payload:null}catch(n){return Me(t,e(n)),null}},s=(e,t)=>{let n=he(e.pendingHistory,{pathname:e.to,search:je(e)});ge({parsedPayload:t,shouldScrollToTop:Ne(e),navigationId:e.navigationId,transitionTypes:me({historyKey:e.options.historyKey,replace:e.options.replace}),maySuspend:t.maySuspend===!0,hasLoadingFallback:t.hasLoadingFallback===!0,pendingHistory:e.pendingHistory,routeLocation:n,pendingEvictLeaf:t.pendingEvictLeaf,startTransition:ae,currentNavigationIdRef:P,pendingScrollPayloadRef:T,setRenderKey:g,setRscPayload:f,setRouteLocation:S,setPendingLoadingLeaf:re,clearHmrError:()=>{U(null)},pendingNavigateCommittedIdRef:L}),t.flightProtocol!=null&&t.flightProtocol!==``&&(B.current=t.flightProtocol),ve(),ue.current&&ue.current(e)},c=async n=>{try{return{kind:`payload`,payload:await t(n)}}catch(t){return o(t)?{kind:`aborted`}:{kind:`error`,error:e(t)}}},l=async e=>{let t=r(e,Ee);if(!t||t.navigationId!==P.current)return;w.current={x:window.scrollX,y:window.scrollY},K();let i=await c(t);if(i.kind===`aborted`)return;if(i.kind===`error`){Me(t,i.error),V.current>=3&&Y();return}let a=i.payload;if(a==null&&t.isStreaming&&P.current===t.navigationId||a==null||P.current!==t.navigationId)return;let o=await n(t,a);o!=null&&s(t,o)},u=async t=>{let n;for(let e=0;e<3;e+=1)try{return await Be.current(void 0,void 0,{commit:!0,expectedRoute:t.expectedRoute,expectedSeq:t.expectedSeq})}catch(t){if(n=t,!Ce(t)||e===2)throw t;await we(150*(e+1))}throw e(n)},d=async()=>{let e=P.current,{pathname:t,search:n}=v(),r=`${t}${n}`,a=de.current,o=(a.get(r)??0)+1;a.set(r,o);let s=await u({expectedRoute:r,expectedSeq:o});if(P.current!==e)return!1;let{pathname:c,search:l}=v();if(`${c}${l}`!==r||a.get(r)!==o)return!1;let d=s?.element;return d!=null&&!i(d)&&E(d)&&(d.type===`html`||d.type===`HTML`)&&!b(d)&&y.set(t,n,d),!0},m=async()=>{w.current={x:window.scrollX,y:window.scrollY},K();try{if(!await d())return;let e=P.current,{pathname:t,search:n}=v(),r=`${t}${n}`,i={x:w.current.x,y:w.current.y};g(e=>e+1),U(null),requestAnimationFrame(()=>{if(P.current!==e)return;let{pathname:t,search:n}=v();`${t}${n}`===r&&(window.scrollTo(i.x,i.y),q())})}catch(e){console.error(`HMR refetch error:`,a(e,String(e))),V.current>=3&&Y()}},h=t=>{let n=r(t,De);if(n?.element==null||!Te(n.element)&&!i(n.element))return;let{pathname:a,search:o}=v(),s=++F.current,c=P.current,l=`${a}${o}`;w.current={x:window.scrollX,y:window.scrollY},K();try{n.revalidationKind===1?y.clear():n.revalidatedPath!=null&&n.revalidatedPath!==``?y.invalidate(n.revalidatedPath,o):y.invalidate(a,o);let t=p.current?.element,r=y.getElement(a,o)??(t!=null&&i(t)?null:t??null),u=n.element;(async()=>{try{let e=await Fe(u);if(s!==F.current||P.current!==c)return;let{pathname:t,search:n}=v();if(`${t}${n}`!==l)return;let i=pe({previousDocument:r??null,refresh:e,pathname:a,search:o});if(i.kind===`hard-nav`){window.location.reload();return}let d=i.element;if(s!==F.current||P.current!==c)return;let p=v();if(`${p.pathname}${p.search}`!==l)return;let m={element:d};I.current=m,ae(()=>{f(m),U(null)}),G.current(d),ve()}catch(t){if(s!==F.current||P.current!==c)return;let n=e(t);J(n,`parse`,`Action flight refresh failed: ${n.message}`,window.location.pathname),V.current>=3&&Y()}})()}catch(t){let n=e(t);J(n,`parse`,`Action flight refresh failed: ${n.message}`,window.location.pathname),V.current>=3&&Y()}},_=async()=>{try{if(!await d())return;g(e=>e+1),U(null)}catch(e){console.error(`RSC invalidate error:`,a(e,String(e))),V.current>=3&&Y()}},x=e=>{let t=r(e,Oe);t&&(j.current.clear(),P.current=t.navigationId,F.current+=1,T.current=null,I.current=null,re(null))},ee=async()=>{try{if(!await d())return;U(null)}catch(e){console.error(`Manifest update error:`,a(e,String(e))),V.current>=3&&Y()}},te=e=>{l(e)},ne=()=>{m()},C=()=>{_()},D=()=>{ee()};return window.addEventListener(`rari:navigation-start`,x),window.addEventListener(`rari:navigate`,te),window.addEventListener(`rari:app-router-rerender`,ne),window.addEventListener(`rari:action-flight-refresh`,h),window.addEventListener(`rari:rsc-invalidate`,C),window.addEventListener(`rari:app-router-manifest-updated`,D),()=>{window.removeEventListener(`rari:navigation-start`,x),window.removeEventListener(`rari:navigate`,te),window.removeEventListener(`rari:app-router-rerender`,ne),window.removeEventListener(`rari:action-flight-refresh`,h),window.removeEventListener(`rari:rsc-invalidate`,C),window.removeEventListener(`rari:app-router-manifest-updated`,D)}},[]),O(()=>{if(typeof window<`u`&&window.location.hash&&d){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`instant`,block:`start`})})})}},[d]);let Ve=d?.element??c,He=x(Ve),[Z,Ue]=A(null),We=ke(He),Ge=i(He)&&We===void 0,Ke=We===void 0?i(He)?null:He:x(We),Q=Ke!=null&&!i(Ke)&&h(Ke)?Ke:null;Q!=null&&!Object.is(Q,Z)&&!b(Q)&&Ue(Q);let $=Ge?Z:Q,qe=$!=null&&h($)&&!b($)?$:Z!=null&&h(Z)&&!b(Z)?Z:null;if(qe==null&&!y.hasRoute(_.pathname,_.search))throw Error(`[rari] AppRouter: expected a resolved <html> document root`);return/* @__PURE__ */ N(_e,{value:C,children:[H!=null&&/* @__PURE__ */ M(fe,{failure:H,maxRetries:3,onRefresh:()=>{window.location.reload()},onDismiss:()=>{U(null)}}),/* @__PURE__ */ M(ye,{fallback:qe,pathname:_.pathname,search:_.search})]})}export{Ie as AppRouterProvider};
1
+ import{S as e,d as t,g as n,i as r,p as i,r as a,s as o}from"../type-guards-BLY2PlGR.mjs";import{i as s}from"../navigation-transition-store-dfNJmkIX.mjs";import{isLayoutReuseMarker as c,layoutPathOf as l,mergeFlightRefresh as u,unwrapFulfilledFlightNode as d}from"./merge-flight-refresh.mjs";import{a as f,i as p,n as m,r as h,t as g}from"../react-helpers-duOBWuYF.mjs";import{i as _,n as v,r as y,t as b}from"../route-cache-BfEqTT9i.mjs";import"./action-revalidation-kind.mjs";import{n as x,t as ee}from"../preload-modules-BDQFWAlZ.mjs";import{n as te,r as ne}from"../form-state-C9jn086j.mjs";import{c as S}from"react/compiler-runtime";import{Suspense as C,addTransitionType as re,cloneElement as ie,createContext as w,createElement as T,isValidElement as E,startTransition as ae,use as D,useCallback as oe,useEffect as O,useLayoutEffect as se,useRef as k,useState as A,useSyncExternalStore as j}from"react";import{jsx as M,jsxs as N}from"react/jsx-runtime";import{createFromFetch as ce,createFromReadableStream as le}from"virtual:react-flight-client";const ue={position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,padding:`24px`,background:`rgba(220, 38, 38, 0.95)`,color:`white`,borderRadius:`8px`,fontSize:`14px`,zIndex:1e4,maxWidth:`500px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.3)`},P={padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},F={padding:`8px 16px`,background:`rgba(255, 255, 255, 0.2)`,color:`white`,border:`1px solid rgba(255, 255, 255, 0.3)`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},de={fetch:`Failed to fetch updated content from server.`,parse:`Failed to parse server response.`,stale:`Server returned stale content.`,network:`Network error occurred.`};function I(e){return de[e]}function fe(e){let t=S(27),{failure:n,maxRetries:r,onRefresh:i,onDismiss:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ M(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),s={marginBottom:`12px`,opacity:.9},t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c;t[2]===n.type?c=t[3]:(c=I(n.type),t[2]=n.type,t[3]=c);let l;t[4]===c?l=t[5]:(l=/* @__PURE__ */ M(`div`,{style:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},t[6]=u):u=t[6];let d;t[7]===n.details?d=t[8]:(d=/* @__PURE__ */ M(`div`,{style:u,children:n.details}),t[7]=n.details,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f={marginBottom:`12px`,fontSize:`12px`,opacity:.7},t[9]=f):f=t[9];let p;t[10]!==n.consecutiveFailures||t[11]!==r?(p=/* @__PURE__ */ N(`div`,{style:f,children:[`Consecutive failures: `,n.consecutiveFailures,` / `,r]}),t[10]=n.consecutiveFailures,t[11]=r,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m={display:`flex`,gap:`8px`},t[13]=m):m=t[13];let h;t[14]===i?h=t[15]:(h=/* @__PURE__ */ M(`button`,{onClick:i,type:`button`,style:P,children:`Refresh Page`}),t[14]=i,t[15]=h);let g;t[16]===a?g=t[17]:(g=/* @__PURE__ */ M(`button`,{onClick:a,type:`button`,style:F,children:`Dismiss`}),t[16]=a,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=/* @__PURE__ */ N(`div`,{style:m,children:[h,g]}),t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=/* @__PURE__ */ M(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`}),t[21]=v):v=t[21];let y;return t[22]!==_||t[23]!==l||t[24]!==d||t[25]!==p?(y=/* @__PURE__ */ N(`div`,{style:ue,children:[o,l,d,p,_,v]}),t[22]=_,t[23]=l,t[24]=d,t[25]=p,t[26]=y):y=t[26],y}function L(e,t,n){y.getShell()??y.ingest(e,t,n)}function R(e){if(e.fromPathname!==`/`&&(e.fromPathname!==e.toPathname||e.fromSearch!==e.search))return{pathname:e.fromPathname,search:e.fromSearch}}function z(e){if(L(e.previousDocument,e.fromPathname,e.fromSearch),h(e.refresh)){if(!y.ingest(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else if(E(e.refresh)){if(!y.ingestSegment(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else return{kind:`hard-nav`};if(y.getShell()==null||!y.hasRoute(e.toPathname,e.search))return{kind:`hard-nav`};let t=y.readLeaf(e.toPathname,e.search),n=m(e.refresh)||t!=null&&m(t),r=t!=null&&p(t)||p(e.refresh),i=R(e);return h(e.refresh)?{kind:`merged`,element:e.refresh,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}:{kind:`merged`,element:e.previousDocument,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}}function B(e,t,n,r){if(h(t))return y.ingest(t,n,r);if(E(t)&&y.getShell()!=null)return y.ingestSegment(t,n,r);let i=u(e,t);return E(t)&&c(t)&&i===e||!h(i)?!1:y.ingest(i,n,r)}function V(e,t){let n=m(e),r=p(e);return h(e)?{kind:`merged`,element:e,maySuspend:n,hasLoadingFallback:r}:h(t)?{kind:`merged`,element:t,maySuspend:n,hasLoadingFallback:r}:{kind:`hard-nav`}}function pe(e){return h(e.previousDocument)&&y.getShell()==null&&!y.ingest(e.previousDocument,e.pathname,e.search)||!B(e.previousDocument,e.refresh,e.pathname,e.search)||y.getShell()==null||!y.hasRoute(e.pathname,e.search)?{kind:`hard-nav`}:V(e.refresh,e.previousDocument)}function me(e){return e.historyKey!=null&&e.historyKey!==``?[`nav`,`nav-traverse`]:e.replace===!0?[`nav`,`nav-replace`]:[`nav`,`nav-forward`]}function he(e,t){if(e==null||e.url===``)return t;try{let t=`http://localhost/`;if(typeof window<`u`)try{t=window.location.href}catch{}let n=new URL(e.url,t);return{pathname:n.pathname,search:n.search}}catch{return t}}function H(e){e!=null&&typeof window<`u`&&(e.replace===!0?window.history.replaceState(e.state,``,e.url):window.history.pushState(e.state,``,e.url))}function ge(e){let{parsedPayload:t,shouldScrollToTop:n,navigationId:r,transitionTypes:i,maySuspend:a=!1,hasLoadingFallback:o=!1,pendingHistory:s,routeLocation:c,startTransition:l=ae,currentNavigationIdRef:u,pendingScrollPayloadRef:d,setRenderKey:f,setRscPayload:p,setRouteLocation:m,setPendingLoadingLeaf:h,clearHmrError:g,pendingNavigateCommittedIdRef:_,pendingEvictLeaf:v}=e;if(u.current!==r)return;let b=a&&o;a&&H(s),b&&c!=null&&(m?.(c),h?.(c));let x=()=>{u.current===r&&(h?.(null),a||H(s),c!=null&&m?.(c),v!=null&&y.evictLeaf(v.pathname,v.search),f(e=>{let r=e+1;return d.current=n?{payload:t,commitKey:r}:null,r}),p(t),g(),_.current=r)};l(()=>{if(i!=null)for(let e of i)re(e);x()})}const _e=w(null);function U(){return D(_e)}function W(e,t,n){return n?.pathname===e&&n.search===t}function G(){return j(y.subscribe,y.getVersion,y.getVersion)}function K(e){return l(e)!=null&&!_(e)&&!c(e)}function q(e,t,n){if(e==null||e===!1||e===!0)return e;if(Array.isArray(e))return g(e).map(e=>q(e,t,n));if(!E(e))return e;if(_(e)||K(e)){let r=l(e);return r==null?null:T(Y,{key:r,layoutPath:r,pathname:t,search:n})}let r=e.props,i=r.children;if(i==null)return e;let a=q(i,t,n);if(Object.is(a,i))return e;let o=g(a),s={...r};return delete s.children,ie(e,s,...o.length===0?[null]:o)}function J({layoutPath:e,pathname:t,search:n},r,i=null){let a=y.readSegmentSnapshot(e,{pathname:t,search:n});if(a==null||E(a)&&_(a))return null;if(y.isDeepestLayout(e,t)){let{fallback:e,content:r}=f(a);return W(t,n,i)&&e!=null?e:T(C,{fallback:e},r)}return q(a,t,n)}function Y(e){let t=S(4),n=G(),r=U(),i;return t[0]!==n||t[1]!==r||t[2]!==e?(i=J(e,n,r),t[0]=n,t[1]=r,t[2]=e,t[3]=i):i=t[3],i}function ve({fallback:e=null,pathname:t,search:n},r){let i=y.getShell();if(i!=null){let e=q(i,t,n);return E(e)?e:null}return e!=null&&b(e)?null:e}function ye(e){let t=S(3),n=G(),r;return t[0]!==n||t[1]!==e?(r=ve(e,n),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function be(e,t,n){return e==null||e.commitKey!==n?{shouldScroll:!1,nextPending:null}:t===e.payload?{shouldScroll:!0,nextPending:null}:{shouldScroll:!1,nextPending:e}}function xe(e){if(e==null)return null;if(i(e)){let t=d(e);return t===e||!h(t)?null:t}return h(e)?e:null}const Se=/"timestamp":(\d+)/;function Ce(e){if(!t(e)||o(e))return!1;let n=e.message;return n===`Failed to fetch`||n.includes(`NetworkError`)||n.includes(`network error`)||n.includes(`Load failed`)}async function we(e){await new Promise(t=>{setTimeout(t,e)})}async function X(e,t,n){if(e.maySuspend!==!0||e.hasLoadingFallback!==!0)return e;if(e.bodyComplete==null){await Promise.resolve();let r=y.readLeaf(t,n);return r!=null&&!m(r)?{...e,maySuspend:!1}:e}if(await Promise.race([e.bodyComplete.then(e=>e?`body`:`failed`),we(100).then(()=>`timeout`)])===`body`)return{...e,maySuspend:!1};let r=y.readLeaf(t,n);return r!=null&&!m(r)?{...e,maySuspend:!1}:e}function Te(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||E(e)||Array.isArray(e)}function Ee(e){return n(e)&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.navigationId==`number`&&n(e.options)}function De(e){return n(e)&&`element`in e}function Oe(e){return n(e)&&typeof e.navigationId==`number`&&typeof e.targetPath==`string`}function ke(e){if(!i(e))return e;if(n(e)&&e.status===`fulfilled`)return Te(e.value)?e.value:void 0}function Ae(e){return h(e)||E(e)&&c(e)}function je(e){let t=e.pendingHistory?.url;if(t!=null&&t!==``)try{return new URL(t,window.location.origin).search}catch{}return v().search}function Me(e,t){console.error(`[rari] AppRouter: Navigation failed:`,t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:e.from,to:e.to,error:t,navigationId:e.navigationId}}))}function Ne(e){let t=e.pendingHistory?.url,n=t!=null&&t!==``?new URL(t,window.location.origin).hash.length>0:window.location.hash.length>0;return(e.options.historyKey==null||e.options.historyKey===``)&&!n&&e.options.scroll!==!1}async function Pe(e,t,n,r,i,a,o,s){let l=await Fe(e.element);if(r!==n)return{kind:`superseded`};if(!Ae(l))return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let u=xe(t);if(E(l)&&c(l)&&u==null)return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: layout-reuse Flight marker requires a previous <html> document`)};if(u==null)return h(l)?(y.set(a,o,l),{kind:`payload`,payload:await X({...e,element:l,maySuspend:m(l),hasLoadingFallback:p(l)},a,o)}):{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let d=z({previousDocument:u,refresh:l,fromPathname:i,toPathname:a,fromSearch:s,search:o});return d.kind===`hard-nav`?{kind:`hard-nav`}:{kind:`payload`,payload:await X({...e,element:d.element,maySuspend:d.maySuspend,hasLoadingFallback:d.hasLoadingFallback===!0,pendingEvictLeaf:d.pendingEvictLeaf},a,o)}}async function Fe(e){let t=x(e);for(let e=0;e<10&&i(t);e+=1)t=x(await t);if(i(t))throw Error(`[rari] AppRouter: Flight content did not resolve to a React node`);return t}function Ie({children:c,initialPayload:l,onNavigate:u}){let[d,f]=A(l),p=k(l),[m,g]=A(0),[_,S]=A(()=>v()),[C,re]=A(null),ie=k(_),w=k({x:0,y:0}),T=k(null),D=k(/* @__PURE__ */ new Map),j=k(/* @__PURE__ */ new Set),ue=k(u),P=k(0),F=k(0),de=k(/* @__PURE__ */ new Map),I=k(null),L=k(null),R=k(/* @__PURE__ */ new Map),z=k([]),B=k(null),V=k(0),[H,U]=A(null);O(()=>{ie.current=_},[_]),O(()=>{ue.current=u},[u]),se(()=>{let{shouldScroll:e,nextPending:t}=be(T.current,d,m);T.current=t,e&&window.scrollTo(0,0);let n=L.current;n!=null&&(L.current=null,window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:n}})))},[d,m]),O(()=>{s()},[m]);let W=oe(e=>{if(e==null||i(e)||!E(e)||e.type!==`html`&&e.type!==`HTML`||b(e))return;let{pathname:t,search:n}=_;y.getShell()!=null&&y.hasRoute(t,n)||y.set(t,n,e)},[_]),G=k(W);O(()=>{G.current=W},[W]),O(()=>{p.current=d,d?.element!=null&&W(d.element)},[d,W]),O(()=>{if(d?.element!=null){let e=d.element;if(n(e)&&`status`in e&&e.status===`rejected`){let t=e.reason;t!=null&&t!==``&&console.error(`[rari] AppRouter: Flight payload rejected:`,t)}}},[d]);let K=()=>{D.current=te()},q=()=>{ne(D.current)};se(()=>{let e=I.current;e!=null&&d===e&&(I.current=null,window.scrollTo(w.current.x,w.current.y),q())},[d,m]);let J=(e,t,n,r)=>{V.current+=1;let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r,consecutiveFailures:V.current};z.current.push(i),z.current.length>10&&z.current.shift(),V.current>=2&&U(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},Y=()=>{setTimeout(()=>{window.location.reload()},1e3)},ve=()=>{V.current>0&&(V.current=0)},xe=e=>{if(B.current==null||B.current===``)return!1;if(e===B.current)return!0;let t=Se.exec(e);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1},X=e=>{ee(e,j.current);let t=new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}});return{element:le(t),flightProtocol:e}},Ae=async e=>{let t=await e;if(!t.body)throw Error(`Response has no body stream`);let n=t.clone();return{element:ce(Promise.resolve(t)),flightProtocol:``,bodyComplete:n.text().then(async e=>(await ee(e,j.current),e!==``&&(B.current=e),!0)).catch(()=>!1)}},Ie=async(t,n)=>{try{let e=await t.text();if(xe(e))return R.current.delete(n),`stale`;let r=await Fe(X(e).element);if(!h(r))throw Error(`[rari] AppRouter: refetched Flight content did not resolve to an <html> document root`);return{element:r,flightProtocol:e}}catch(t){if(o(t))throw t;let n=e(t),r=Error(`Failed to parse RSC Flight protocol: ${n.message}`,{cause:n});return J(r,`parse`,r.message,window.location.pathname),r}},Le=async(n,r,i)=>{let a=n!=null&&n!==``?n:window.location.pathname,s=P.current,c=i?.commit!==!1,l=i?.expectedRoute!=null&&i.expectedSeq!=null?`:hmr:${i.expectedRoute}:${i.expectedSeq}`:``,u=`${s}:${a}${window.location.search}:${c?`commit`:`defer`}${l}`,d=R.current.get(u);if(d)return d;let p=i?.expectedRoute,m=i?.expectedSeq,h=(async()=>{try{let e=a+window.location.search,t=await fetch(e,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(P.current)},cache:`no-store`,signal:r});if(!t.ok){let n=/* @__PURE__ */ Error(`Failed to fetch RSC data: ${t.status} ${t.statusText}`);throw J(n,`fetch`,`HTTP ${t.status} when fetching ${e}`,window.location.pathname),n}let n=await Ie(t,u);if(n===`stale`)return;if(n instanceof Error)throw n;let i=p==null||m==null||de.current.get(p)===m;return P.current===s&&i&&(c&&f(n),n.flightProtocol!=null&&n.flightProtocol!==``&&(B.current=n.flightProtocol),ve()),R.current.delete(u),n}catch(n){throw R.current.delete(u),t(n)&&!o(n)&&!n.message.includes(`Failed to fetch RSC data`)&&!n.message.includes(`Failed to parse`)&&J(n,`network`,`Network error: ${n.message}`,window.location.pathname),e(n)}})();return R.current.set(u,h),h},Re=k(X),ze=k(Ae),Be=k(Le);O(()=>{Re.current=X,ze.current=Ae,Be.current=Le}),O(()=>{if(typeof window>`u`)return;let t=async e=>{if(e.rscResponsePromise){let t=await e.rscResponsePromise;if(P.current!==e.navigationId)return;let n=await ze.current(Promise.resolve(t));return P.current===e.navigationId?n:void 0}if(e.rscResponse){let t=await ze.current(Promise.resolve(e.rscResponse));return P.current===e.navigationId?t:void 0}if(e.rscFlightProtocol!=null&&e.rscFlightProtocol!==``)return Re.current(e.rscFlightProtocol);if(!e.isStreaming)return Be.current(e.to,e.abortSignal,{commit:!1})},n=async(t,n)=>{try{let e=await Pe(n,p.current?.element,t.navigationId,P.current,t.from,t.to,je(t),ie.current.search);if(e.kind===`superseded`)return null;if(e.kind===`hard-nav`){if(P.current!==t.navigationId)return null;let e=t.pendingHistory?.url!=null&&t.pendingHistory.url!==``?t.pendingHistory.url:t.to;return window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:t.navigationId}})),window.location.assign(e),null}return e.kind===`error`?(Me(t,e.error),null):P.current===t.navigationId?e.payload:null}catch(n){return Me(t,e(n)),null}},s=(e,t)=>{let n=he(e.pendingHistory,{pathname:e.to,search:je(e)});ge({parsedPayload:t,shouldScrollToTop:Ne(e),navigationId:e.navigationId,transitionTypes:me({historyKey:e.options.historyKey,replace:e.options.replace}),maySuspend:t.maySuspend===!0,hasLoadingFallback:t.hasLoadingFallback===!0,pendingHistory:e.pendingHistory,routeLocation:n,pendingEvictLeaf:t.pendingEvictLeaf,startTransition:ae,currentNavigationIdRef:P,pendingScrollPayloadRef:T,setRenderKey:g,setRscPayload:f,setRouteLocation:S,setPendingLoadingLeaf:re,clearHmrError:()=>{U(null)},pendingNavigateCommittedIdRef:L}),t.flightProtocol!=null&&t.flightProtocol!==``&&(B.current=t.flightProtocol),ve(),ue.current&&ue.current(e)},c=async n=>{try{return{kind:`payload`,payload:await t(n)}}catch(t){return o(t)?{kind:`aborted`}:{kind:`error`,error:e(t)}}},l=async e=>{let t=r(e,Ee);if(!t||t.navigationId!==P.current)return;w.current={x:window.scrollX,y:window.scrollY},K();let i=await c(t);if(i.kind===`aborted`)return;if(i.kind===`error`){Me(t,i.error),V.current>=3&&Y();return}let a=i.payload;if(a==null&&t.isStreaming&&P.current===t.navigationId||a==null||P.current!==t.navigationId)return;let o=await n(t,a);o!=null&&s(t,o)},u=async t=>{let n;for(let e=0;e<3;e+=1)try{return await Be.current(void 0,void 0,{commit:!0,expectedRoute:t.expectedRoute,expectedSeq:t.expectedSeq})}catch(t){if(n=t,!Ce(t)||e===2)throw t;await we(150*(e+1))}throw e(n)},d=async()=>{let e=P.current,{pathname:t,search:n}=v(),r=`${t}${n}`,a=de.current,o=(a.get(r)??0)+1;a.set(r,o);let s=await u({expectedRoute:r,expectedSeq:o});if(P.current!==e)return!1;let{pathname:c,search:l}=v();if(`${c}${l}`!==r||a.get(r)!==o)return!1;let d=s?.element;return d!=null&&!i(d)&&E(d)&&(d.type===`html`||d.type===`HTML`)&&!b(d)&&y.set(t,n,d),!0},m=async()=>{w.current={x:window.scrollX,y:window.scrollY},K();try{if(!await d())return;let e=P.current,{pathname:t,search:n}=v(),r=`${t}${n}`,i={x:w.current.x,y:w.current.y};g(e=>e+1),U(null),requestAnimationFrame(()=>{if(P.current!==e)return;let{pathname:t,search:n}=v();`${t}${n}`===r&&(window.scrollTo(i.x,i.y),q())})}catch(e){console.error(`HMR refetch error:`,a(e,String(e))),V.current>=3&&Y()}},h=t=>{let n=r(t,De);if(n?.element==null||!Te(n.element)&&!i(n.element))return;let{pathname:a,search:o}=v(),s=++F.current,c=P.current,l=`${a}${o}`;w.current={x:window.scrollX,y:window.scrollY},K();try{n.revalidationKind===1?y.clear():n.revalidatedPath!=null&&n.revalidatedPath!==``?y.invalidate(n.revalidatedPath,o):y.invalidate(a,o);let t=p.current?.element,r=y.getElement(a,o)??(t!=null&&i(t)?null:t??null),u=n.element;(async()=>{try{let e=await Fe(u);if(s!==F.current||P.current!==c)return;let{pathname:t,search:n}=v();if(`${t}${n}`!==l)return;let i=pe({previousDocument:r??null,refresh:e,pathname:a,search:o});if(i.kind===`hard-nav`){window.location.reload();return}let d=i.element;if(s!==F.current||P.current!==c)return;let p=v();if(`${p.pathname}${p.search}`!==l)return;let m={element:d};I.current=m,ae(()=>{f(m),U(null)}),G.current(d),ve()}catch(t){if(s!==F.current||P.current!==c)return;let n=e(t);J(n,`parse`,`Action flight refresh failed: ${n.message}`,window.location.pathname),V.current>=3&&Y()}})()}catch(t){let n=e(t);J(n,`parse`,`Action flight refresh failed: ${n.message}`,window.location.pathname),V.current>=3&&Y()}},_=async()=>{try{if(!await d())return;g(e=>e+1),U(null)}catch(e){console.error(`RSC invalidate error:`,a(e,String(e))),V.current>=3&&Y()}},x=e=>{let t=r(e,Oe);t&&(j.current.clear(),P.current=t.navigationId,F.current+=1,T.current=null,I.current=null,re(null))},ee=async()=>{try{if(!await d())return;U(null)}catch(e){console.error(`Manifest update error:`,a(e,String(e))),V.current>=3&&Y()}},te=e=>{l(e)},ne=()=>{m()},C=()=>{_()},D=()=>{ee()};return window.addEventListener(`rari:navigation-start`,x),window.addEventListener(`rari:navigate`,te),window.addEventListener(`rari:app-router-rerender`,ne),window.addEventListener(`rari:action-flight-refresh`,h),window.addEventListener(`rari:rsc-invalidate`,C),window.addEventListener(`rari:app-router-manifest-updated`,D),()=>{window.removeEventListener(`rari:navigation-start`,x),window.removeEventListener(`rari:navigate`,te),window.removeEventListener(`rari:app-router-rerender`,ne),window.removeEventListener(`rari:action-flight-refresh`,h),window.removeEventListener(`rari:rsc-invalidate`,C),window.removeEventListener(`rari:app-router-manifest-updated`,D)}},[]),O(()=>{if(typeof window<`u`&&window.location.hash&&d){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`instant`,block:`start`})})})}},[d]);let Ve=d?.element??c,He=x(Ve),[Z,Ue]=A(null),We=ke(He),Ge=i(He)&&We===void 0,Ke=We===void 0?i(He)?null:He:x(We),Q=Ke!=null&&!i(Ke)&&h(Ke)?Ke:null;Q!=null&&!Object.is(Q,Z)&&!b(Q)&&Ue(Q);let $=Ge?Z:Q,qe=$!=null&&h($)&&!b($)?$:Z!=null&&h(Z)&&!b(Z)?Z:null;if(qe==null&&!y.hasRoute(_.pathname,_.search))throw Error(`[rari] AppRouter: expected a resolved <html> document root`);return/* @__PURE__ */ N(_e,{value:C,children:[H!=null&&/* @__PURE__ */ M(fe,{failure:H,maxRetries:3,onRefresh:()=>{window.location.reload()},onDismiss:()=>{U(null)}}),/* @__PURE__ */ M(ye,{fallback:qe,pathname:_.pathname,search:_.search})]})}export{Ie as AppRouterProvider};
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"../navigate-DuyUa6qD.mjs";import{d as n,g as r,h as i,i as a,n as o,s}from"../type-guards-BLY2PlGR.mjs";import{r as c}from"../path-CTEC1xmy.mjs";import{a as ee}from"../route-cache-D2iIKQIU.mjs";import{t as l}from"../form-state-DAygOjc8.mjs";import{c as u}from"react/compiler-runtime";import{useEffect as d,useLayoutEffect as f,useRef as p,useState as m}from"react";function h(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:c=!1,trailing:ee=!0,maxWait:l}=n;function u(t){let n=o,r=s;o=null,s=null,a=t,e.apply(r,n)}function d(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||l!==void 0&&r>=l}function f(){let e=Date.now();if(d(e)){m(e);return}let n=e-i,o=e-a,s=t-n,c=l===void 0?1/0:l-o;r=setTimeout(f,Math.min(s,c))}function p(e){a=e,r=setTimeout(f,t),c&&u(e)}function m(e){if(r=null,ee&&o){u(e);return}o=null,s=null}function h(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function g(){r!==null&&m(Date.now())}function _(){return r!==null}function v(...e){let n=Date.now(),a=d(n);if(o=e,s=this,i=n,a){if(r===null){p(i);return}
1
+ import{i as e,t}from"../navigate-CSQP4q53.mjs";import{d as n,g as r,h as i,i as a,n as o,s}from"../type-guards-BLY2PlGR.mjs";import{r as c}from"../path-CTEC1xmy.mjs";import{a as ee}from"../route-cache-BfEqTT9i.mjs";import{t as l}from"../form-state-C9jn086j.mjs";import{c as u}from"react/compiler-runtime";import{useEffect as d,useLayoutEffect as f,useRef as p,useState as m}from"react";function h(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:c=!1,trailing:ee=!0,maxWait:l}=n;function u(t){let n=o,r=s;o=null,s=null,a=t,e.apply(r,n)}function d(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||l!==void 0&&r>=l}function f(){let e=Date.now();if(d(e)){m(e);return}let n=e-i,o=e-a,s=t-n,c=l===void 0?1/0:l-o;r=setTimeout(f,Math.min(s,c))}function p(e){a=e,r=setTimeout(f,t),c&&u(e)}function m(e){r=null,ee&&o?u(e):(o=null,s=null)}function h(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function g(){r!==null&&m(Date.now())}function _(){return r!==null}function v(...e){let n=Date.now(),a=d(n);if(o=e,s=this,i=n,a){if(r===null){p(i);return}
2
2
  /* v8 ignore start - edge case: isInvoking true with existing timeout and maxWait defined */
3
3
  if(l!==void 0){r=setTimeout(f,t),u(i);return}}r??=setTimeout(f,t)}return v.cancel=h,v.flush=g,v.pending=_,v}const g=/fetch|networkerror|load failed/i;function _(e,t){return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1}}function v(e,t){return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function y(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 b(e,t){return{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function x(e,t){return{type:`parse-error`,message:`Failed to parse server response`,
4
4
  /* v8 ignore next - defensive check for non-Error values from parse-related condition */
@@ -23,4 +23,5 @@ export declare class ErrorBoundaryWrapper extends Component<ErrorBoundaryWrapper
23
23
  reset: () => void;
24
24
  render(): ReactNode;
25
25
  }
26
- //#endregion
26
+ //#endregion
27
+ export {};
@@ -1 +1 @@
1
- import{g as e,p as t,r as n}from"../type-guards-BLY2PlGR.mjs";import{ActionDidNotRevalidate as r,ActionDidRevalidateDynamicOnly as i,ActionDidRevalidateStaticAndDynamic as a,parseActionRevalidationKind as o}from"./action-revalidation-kind.mjs";import{isValidElement as s}from"react";function c(t){return e(t)?`redirect`in t||`~rariSkipRefresh`in t||`~rariFormState`in t:!1}function l(e){return s(e)||t(e)}function u(e){return e==null||e===``?null:e instanceof Promise?e.then(e=>e==null||e===``?null:e):e}function d(e,t,r){typeof globalThis.dispatchEvent==`function`&&(c(r)||(async()=>{let n=u(t.f),r=n instanceof Promise?await n:n;if(r==null||!l(r))return;let i=o(e.headers.get(`x-action-revalidated`));if(i===0)return;let a=e.headers.get(`x-action-revalidated-path`)??void 0,s=()=>{globalThis.dispatchEvent(new CustomEvent(`rari:action-flight-refresh`,{detail:{element:r,revalidationKind:i,revalidatedPath:a}}))};if(typeof requestAnimationFrame==`function`){requestAnimationFrame(()=>{requestAnimationFrame(s)});return}queueMicrotask(s)})().catch(e=>{console.error(`[rari] Action flight refresh failed:`,n(e,String(e)))}))}export{r as ActionDidNotRevalidate,i as ActionDidRevalidateDynamicOnly,a as ActionDidRevalidateStaticAndDynamic,d as scheduleActionFlightRefresh};
1
+ import{g as e,p as t,r as n}from"../type-guards-BLY2PlGR.mjs";import{ActionDidNotRevalidate as r,ActionDidRevalidateDynamicOnly as i,ActionDidRevalidateStaticAndDynamic as a,parseActionRevalidationKind as o}from"./action-revalidation-kind.mjs";import{isValidElement as s}from"react";function c(t){return e(t)?`redirect`in t||`~rariSkipRefresh`in t||`~rariFormState`in t:!1}function l(e){return s(e)||t(e)}function u(e){return e==null||e===``?null:e instanceof Promise?e.then(e=>e==null||e===``?null:e):e}function d(e,t,r){typeof globalThis.dispatchEvent==`function`&&(c(r)||(async()=>{let n=u(t.f),r=n instanceof Promise?await n:n;if(r==null||!l(r))return;let i=o(e.headers.get(`x-action-revalidated`));if(i===0)return;let a=e.headers.get(`x-action-revalidated-path`)??void 0,s=()=>{globalThis.dispatchEvent(new CustomEvent(`rari:action-flight-refresh`,{detail:{element:r,revalidationKind:i,revalidatedPath:a}}))};typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>{requestAnimationFrame(s)}):queueMicrotask(s)})().catch(e=>{console.error(`[rari] Action flight refresh failed:`,n(e,String(e)))}))}export{r as ActionDidNotRevalidate,i as ActionDidRevalidateDynamicOnly,a as ActionDidRevalidateStaticAndDynamic,d as scheduleActionFlightRefresh};
@@ -1 +1 @@
1
- import{d as e,g as t}from"../type-guards-BLY2PlGR.mjs";import{a as n}from"../route-cache-D2iIKQIU.mjs";import{scheduleActionFlightRefresh as r}from"./action-flight-refresh.mjs";import{createFromFetch as i,createTemporaryReferenceSet as a,encodeReply as o}from"virtual:react-flight-client";const s=3e4;function c(e){if(!t(e))return e;let{"~rariSkipRefresh":n,...r}=e;return r}function l(){return typeof window<`u`?window.location.pathname+window.location.search:`/`}const u=/* @__PURE__ */ new Set([`http:`,`https:`]);function d(e){if(typeof window<`u`)try{let t=new URL(e,window.location.href);if(!u.has(t.protocol))return;t.href!==window.location.href&&(window.location.href=t.href)}catch{}}async function f(e,t){let s=a(),{headers:l,body:u}=p(await o(t,{temporaryReferences:s}));l.Accept=`text/x-component`,l[`rsc-action-id`]=e,l[`rari-router-state`]=n();let d=await m(e,l,u),_=h(d);if(_!=null)return _;await g(e,d);let v=await i(Promise.resolve(d),{callServer:f,temporaryReferences:s}),y=v.a,b=y instanceof Promise?await y:y;return r(d,v,b),c(b)}function p(e){let t={};return typeof e==`string`&&(t[`Content-Type`]=`text/plain;charset=UTF-8`),{headers:t,body:e}}async function m(t,n,r){try{return await fetch(l(),{method:`POST`,headers:n,body:r,signal:AbortSignal.timeout(s)})}catch(n){throw n instanceof DOMException&&n.name===`TimeoutError`||e(n)&&n.name===`AbortError`?Error(`Server action "${t}" timed out after ${s}ms`):n}}function h(e){let t=e.headers.get(`x-action-redirect`);if(t==null||t===``)return null;let[n=``]=t.split(`;`);return n!==``&&d(n),{redirect:n}}async function g(e,t){let n=t.headers.get(`content-type`),r=n!=null&&n!==``?n:``;if(r.startsWith(`text/x-component`))return;let i=t.status>=400&&r.startsWith(`text/plain`)?await t.text().catch(()=>t.statusText):`Server action "${e}" failed with status ${t.status}: ${t.statusText}`;throw Error(i)}export{f as callServer};
1
+ import{d as e,g as t}from"../type-guards-BLY2PlGR.mjs";import{a as n}from"../route-cache-BfEqTT9i.mjs";import{scheduleActionFlightRefresh as r}from"./action-flight-refresh.mjs";import{createFromFetch as i,createTemporaryReferenceSet as a,encodeReply as o}from"virtual:react-flight-client";const s=3e4;function c(e){if(!t(e))return e;let{"~rariSkipRefresh":n,...r}=e;return r}function l(){return typeof window<`u`?window.location.pathname+window.location.search:`/`}const u=/* @__PURE__ */ new Set([`http:`,`https:`]);function d(e){if(typeof window<`u`)try{let t=new URL(e,window.location.href);if(!u.has(t.protocol))return;t.href!==window.location.href&&(window.location.href=t.href)}catch{}}async function f(e,t){let s=a(),{headers:l,body:u}=p(await o(t,{temporaryReferences:s}));l.Accept=`text/x-component`,l[`rsc-action-id`]=e,l[`rari-router-state`]=n();let d=await m(e,l,u),_=h(d);if(_!=null)return _;await g(e,d);let v=await i(Promise.resolve(d),{callServer:f,temporaryReferences:s}),y=v.a,b=y instanceof Promise?await y:y;return r(d,v,b),c(b)}function p(e){let t={};return typeof e==`string`&&(t[`Content-Type`]=`text/plain;charset=UTF-8`),{headers:t,body:e}}async function m(t,n,r){try{return await fetch(l(),{method:`POST`,headers:n,body:r,signal:AbortSignal.timeout(s)})}catch(n){throw n instanceof DOMException&&n.name===`TimeoutError`||e(n)&&n.name===`AbortError`?Error(`Server action "${t}" timed out after ${s}ms`):n}}function h(e){let t=e.headers.get(`x-action-redirect`);if(t==null||t===``)return null;let[n=``]=t.split(`;`);return n!==``&&d(n),{redirect:n}}async function g(e,t){let n=t.headers.get(`content-type`),r=n!=null&&n!==``?n:``;if(r.startsWith(`text/x-component`))return;let i=t.status>=400&&r.startsWith(`text/plain`)?await t.text().catch(()=>t.statusText):`Server action "${e}" failed with status ${t.status}: ${t.statusText}`;throw Error(i)}export{f as callServer};
@@ -1,4 +1,4 @@
1
- import{g as e,i as t,n,p as r,r as i}from"../type-guards-BLY2PlGR.mjs";import{t as a}from"../router-Cc9lVbtA.mjs";import{a as o,n as s,r as c}from"../rari-global-5vGzhToD.mjs";import{r as l}from"../react-helpers-duOBWuYF.mjs";import{n as u,t as d}from"../preload-modules-BDQFWAlZ.mjs";import{createElement as f}from"react";import{createFromFetch as p,createFromReadableStream as m}from"virtual:react-flight-client";import{createRoot as h,hydrateRoot as g}from"react-dom/client";import{AppRouterProvider as _}from"virtual:app-router-provider";import{ClientRouter as v}from"virtual:client-router";import"virtual:rsc-integration.ts";function y(e,t){if(e.querySelector(`.rari-error[data-rari-hydration-failure]`))return;let n=document.createElement(`div`);n.className=`rari-error`,n.setAttribute(`data-rari-hydration-failure`,`true`),n.setAttribute(`role`,`alert`),n.style.cssText=`color:red;border:1px solid red;padding:10px;border-radius:4px;background-color:#fff5f5;margin:10px 0;`;let r=document.createElement(`strong`);r.textContent=`Failed to load page: `,n.append(r,document.createTextNode(t)),e.prepend(n)}function b(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT);for(;t.nextNode();){let e=t.currentNode;if(e.nodeType===8&&`data`in e){let t=e.data;if(t===`$`||t===`$?`||t===`/$`)return!0}}return!!(e.querySelector(`[data-reactroot]`)||e.querySelectorAll(`template[data-rri]`).length>0)}function x(e){let t=e.tagName;if(t===`SCRIPT`||t===`STYLE`||t===`LINK`||t===`META`||t===`NOSCRIPT`)return!0;let n=typeof e.getAttribute==`function`?e.getAttribute.bind(e):null;return n==null?!1:n(`data-rari-nav-transition`)!=null||n(`aria-hidden`)===`true`}function S(e){let t=e.firstElementChild;for(;t!=null&&x(t);)t=t.nextElementSibling;return t}function C(e){if(b(e))return!0;let t=S(e);return t!==null&&!t.classList.contains(`rari-error`)}function w(e){return b(e)}function T(e){e.querySelectorAll(`.rari-error:not([data-rari-hydration-failure])`).forEach(e=>{e.remove()})}async function E(e){let t=u(e);for(let e=0;e<10&&r(t);e+=1)t=u(await t);if(r(t))throw Error(`[rari] Failed to resolve Flight element to a React node`);return t}function D(e){if(!l(e))return y(document.body,`RSC payload did not resolve to an <html> document root. Try refreshing the page.`),console.error(`[rari] Hydration skipped: Flight content is not a document root`),!1;let t=f(_,{initialPayload:{element:e}});return t=f(v,{initialRoute:window.location.pathname},t),t=f(a,{initialPathname:window.location.pathname},t),A(t),!0}function O(){Reflect.set(globalThis,`__rari_client_ready`,!0),window.dispatchEvent(new CustomEvent(`rari:client-ready`))}function k(e){if(e===``)return;let t=()=>{document.title.trim()===``&&(document.title=e)};t(),queueMicrotask(t),requestAnimationFrame(()=>{t(),requestAnimationFrame(t)})}function A(e){let t=document.documentElement,n=document.title.trim();w(t)?(T(t),g(document,e,{onRecoverableError(e){import.meta.env.DEV&&console.warn(`[rari] Hydration mismatch:`,e)}})):h(document).render(e),k(n),O()}
1
+ import{g as e,i as t,n,p as r,r as i}from"../type-guards-BLY2PlGR.mjs";import{t as a}from"../router-kf_rLP_F.mjs";import{a as o,n as s,r as c}from"../rari-global-5vGzhToD.mjs";import{r as l}from"../react-helpers-duOBWuYF.mjs";import{n as u,t as d}from"../preload-modules-BDQFWAlZ.mjs";import{createElement as f}from"react";import{createFromFetch as p,createFromReadableStream as m}from"virtual:react-flight-client";import{createRoot as h,hydrateRoot as g}from"react-dom/client";import{AppRouterProvider as _}from"virtual:app-router-provider";import{ClientRouter as v}from"virtual:client-router";import"virtual:rsc-integration.ts";function y(e,t){if(e.querySelector(`.rari-error[data-rari-hydration-failure]`))return;let n=document.createElement(`div`);n.className=`rari-error`,n.setAttribute(`data-rari-hydration-failure`,`true`),n.setAttribute(`role`,`alert`),n.style.cssText=`color:red;border:1px solid red;padding:10px;border-radius:4px;background-color:#fff5f5;margin:10px 0;`;let r=document.createElement(`strong`);r.textContent=`Failed to load page: `,n.append(r,document.createTextNode(t)),e.prepend(n)}function b(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT);for(;t.nextNode();){let e=t.currentNode;if(e.nodeType===8&&`data`in e){let t=e.data;if(t===`$`||t===`$?`||t===`/$`)return!0}}return!!(e.querySelector(`[data-reactroot]`)||e.querySelectorAll(`template[data-rri]`).length>0)}function x(e){let t=e.tagName;if(t===`SCRIPT`||t===`STYLE`||t===`LINK`||t===`META`||t===`NOSCRIPT`)return!0;let n=typeof e.getAttribute==`function`?e.getAttribute.bind(e):null;return n==null?!1:n(`data-rari-nav-transition`)!=null||n(`aria-hidden`)===`true`}function S(e){let t=e.firstElementChild;for(;t!=null&&x(t);)t=t.nextElementSibling;return t}function C(e){if(b(e))return!0;let t=S(e);return t!==null&&!t.classList.contains(`rari-error`)}function w(e){return b(e)}function T(e){e.querySelectorAll(`.rari-error:not([data-rari-hydration-failure])`).forEach(e=>{e.remove()})}async function E(e){let t=u(e);for(let e=0;e<10&&r(t);e+=1)t=u(await t);if(r(t))throw Error(`[rari] Failed to resolve Flight element to a React node`);return t}function D(e){if(!l(e))return y(document.body,`RSC payload did not resolve to an <html> document root. Try refreshing the page.`),console.error(`[rari] Hydration skipped: Flight content is not a document root`),!1;let t=f(_,{initialPayload:{element:e}});return t=f(v,{initialRoute:window.location.pathname},t),t=f(a,{initialPathname:window.location.pathname},t),A(t),!0}function O(){Reflect.set(globalThis,`__rari_client_ready`,!0),window.dispatchEvent(new CustomEvent(`rari:client-ready`))}function k(e){if(e===``)return;let t=()=>{document.title.trim()===``&&(document.title=e)};t(),queueMicrotask(t),requestAnimationFrame(()=>{t(),requestAnimationFrame(t)})}function A(e){let t=document.documentElement,n=document.title.trim();w(t)?(T(t),g(document,e,{onRecoverableError(e){import.meta.env.DEV&&console.warn(`[rari] Hydration mismatch:`,e)}})):h(document).render(e),k(n),O()}
2
2
  /*! @preserve CLIENT_COMPONENT_IMPORTS_PLACEHOLDER */
3
3
  c(),s();
4
4
  /*! @preserve CLIENT_COMPONENT_REGISTRATIONS_PLACEHOLDER */
@@ -1 +1 @@
1
- import{g as e,l as t,o as n,p as r}from"../type-guards-BLY2PlGR.mjs";import{Children as i,Fragment as a,cloneElement as o,createElement as s,isValidElement as c}from"react";function l(e){return t(e.type)}function u(e){return e.type===`head`||e.type===`HEAD`}function d(e){return e.type===`html`||e.type===`HTML`}function f(e){return e.type===`body`||e.type===`BODY`}function p(e){return e.type===`rari-layout-reuse`}function m(e){let t=e.props[`data-rari-layout-path`];return typeof t==`string`&&t!==``?t:void 0}function ee(e,t,n){if(m(e)===t)return W(e,e.props,n);let r=q(e,t);if(r==null)return null;let i=r.parent.props,a=_(r.parent),o=a[r.slotIndex];if(!c(o))return null;let s=[...a];s[r.slotIndex]=W(o,o.props,n);let l=Q(e,r.parent,W(r.parent,i,s));return c(l)?l:null}function h(e){let t={...e};return delete t.children,t}function g(e,t){if(!l(e)||!l(t))return!1;let r=n(e.type)?e.type.$$id:void 0,i=n(t.type)?t.type.$$id:void 0;return r==null||r===``||i==null||i===``||r!==i?!1:(e.key??null)===(t.key??null)}function _(e){return S(e.props.children)}function v(e){return Array.isArray(e)&&e.some(e=>Array.isArray(e))}function y(e,t){let n=e.key,r=typeof n==`string`&&n!==``?`${t}:${n.replace(/^\.+/,``)}`:t;return o(e,{key:r})}function b(e,t,n){return Array.isArray(e)?x(e,t==null?`.${n}`:`${t}:${n}`):e==null||e===!1||e===!0?[]:c(e)&&t!=null?[y(e,`${t}:${n}`)]:[e]}function x(e,t){if(!Array.isArray(e))return e==null||e===!1||e===!0?[]:c(e)&&t!=null?[y(e,t)]:[e];let n=[];for(let r=0;r<e.length;r+=1)n.push(...b(e[r],t,r));return n}function S(e){return e==null||e===!1||e===!0?[]:c(e)||typeof e==`string`||typeof e==`number`?[e]:Array.isArray(e)?x(e,null):r(e)?[e]:i.toArray(e)}function C(e){return c(e)?p(e)?!0:S(e.props.children).some(e=>C(e)):!1}function te(e){let t=e.type;return t===`title`||t===`TITLE`||t===`meta`||t===`META`||t===`link`||t===`LINK`}function w(e){if(e.type!==`link`&&e.type!==`LINK`)return!1;let t=e.props.rel;if(typeof t!=`string`||t===``)return!1;let n=t.toLowerCase();return n===`stylesheet`||n===`preload`||n===`modulepreload`||n===`preconnect`||n===`dns-prefetch`||n===`icon`||n===`shortcut icon`||n===`apple-touch-icon`}function T(t){if(e(t)){if(t.status===`fulfilled`)return t.value;if(e(t._payload)&&t._payload.status===`fulfilled`)return t._payload.value}}function E(t){let n=t;for(let t=0;t<10;t+=1){if(!r(n)&&(!e(n)||!e(n._payload)))return n;let t=T(n);if(t===void 0)return n;if(t==null||t===!1||t===!0)return t;n=t}return n}function D(e){let t=E(e);if(Array.isArray(t)){let e=[];for(let n of t)e.push(...D(n));return e}return c(t)&&t.type===a?O(_(t)):t==null||t===!1||t===!0?[]:[t]}function O(e){let t=[];for(let n of e)t.push(...D(n));return t}function k(e){let t=E(e);return Array.isArray(t)?!0:c(t)&&t.type===a}function A(e){let t=[];for(let n of e){if(c(n)&&n.type===a){t.push(...A(_(n)));continue}t.push(n)}return t}function j(e){if(e.type!==`meta`&&e.type!==`META`)return!1;let t=e.props;return t.charSet!=null||t.charset!=null||typeof t.httpEquiv==`string`&&t.httpEquiv.toLowerCase()===`content-type`||typeof t.name==`string`&&t.name.toLowerCase()===`viewport`}function M(e,t){let n=e.props;return A(t).some(e=>{if(!c(e)||!j(e))return!1;let t=e.props;return n.charSet!=null||n.charset!=null?t.charSet!=null||t.charset!=null:typeof n.httpEquiv==`string`&&n.httpEquiv.toLowerCase()===`content-type`?typeof t.httpEquiv==`string`&&t.httpEquiv.toLowerCase()===`content-type`:typeof t.name==`string`&&t.name.toLowerCase()===`viewport`})}function N(e){return e.type===`title`||e.type===`TITLE`}function P(e){if(e.type!==`meta`&&e.type!==`META`)return!1;let t=e.props.name;return typeof t==`string`&&t.toLowerCase()===`description`}function F(e){return A(e).some(e=>c(e)&&N(e))}function I(e){return A(e).some(e=>c(e)&&P(e))}function L(e,t){let n=e.props,r=A(_(e)),i=_(t),a=A(i),o=F(a),s=I(a);return W(e,n,[...r.filter(e=>{if(!c(e))return!0;if(N(e))return!o;if(e.type===`meta`||e.type===`META`)return j(e)?!M(e,i):P(e)?!s:!1;if(!w(e))return!te(e);let t=e.props;return!a.some(e=>{if(!c(e)||!w(e))return!1;let n=e.props;return t.rel!=null&&t.rel===n.rel&&t.href===n.href})}),...a])}function R(e){return e.length===0?null:e.length===1?e[0]:[...e]}function z(e){let t=[];for(let n of S(e))t.push(B(n));return t}function B(e){if(Array.isArray(e))return R(z(e));if(!c(e))return e;if(p(e))return R(z(e.props.children));let t=e.props,n=S(t.children);if(n.length===0)return e;let r=z(n);return!v(t.children)&&r.every((e,t)=>e===n[t])?e:W(e,t,R(r))}function V(e,t){if(e.length===0)return[B(t)];if(e.length===1)return[$(e[0],t)];let n=[],r=!1;for(let i of e)!r&&c(i)?(r=!0,n.push($(i,t))):n.push(i);return r?n:[B(t)]}function H(e,t){let n=[],r=0;for(let i of t){if(c(i)&&p(i)){n.push(...V(e.slice(r),i)),r=e.length;continue}let t=e[r];n.push(t===void 0?B(i):$(t,i)),r+=1}return r<e.length&&n.push(...e.slice(r)),R(n)}function U(e,t){let n=S(e),r=S(t);return n.length===0||r.length===0?B(t):r.some(e=>c(e)&&p(e))?H(n,r):n.length===r.length?R(n.map((e,t)=>$(e,r[t]))):B(t)}function W(e,t,n){let r=S(n);return o(e,h(t),...r.length===0?[null]:r)}function G(e,t){for(let n=0;n<e.length;n+=1){let r=e[n];if(c(r)&&m(r)===t)return n;for(let e of D(r))if(c(e)&&m(e)===t)return n}return-1}function K(e,t){let n=_(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(c(i)){let e=q(i,t);if(e!=null)return e;continue}let a=E(i);if(c(a)&&q(a,t)!=null)return{parent:e,slotIndex:r}}return null}function q(e,t){let n=G(_(e),t);return n>=0?{parent:e,slotIndex:n}:K(e,t)}function J(e,t,n){let r=E(e);if(Array.isArray(r)){let e=[];for(let t of r)e.push(...D(t));return Z(s(a,null,...e.length===0?[null]:e),t,n)}return c(r)?Z(r,t,n):t}function Y(e,t){if(t==null||t===!1||t===!0)return t;let n=_(e);return n.length===1?$(n[0],t):t}function X(e,t,n){if(m(e)===n)return W(e,e.props,Y(e,t));let i=q(e,n);if(i==null)return null;let a=i.parent.props,o=_(i.parent),s=[...o],l=o[i.slotIndex];return k(l)||!c(l)&&r(l)?s[i.slotIndex]=J(l,t,n):c(l)?s[i.slotIndex]=W(l,l.props,Y(l,t)):s[i.slotIndex]=t,Q(e,i.parent,W(i.parent,a,s))}function Z(e,t,n){if(!c(e))return t;if(c(t)&&p(t)){let r=m(t);return Z(e,t.props.children,r??n)}return n!=null&&n!==``?X(e,t,n)??e:e}function Q(e,t,n){if(e===t)return n;let r=e.props,i=_(e),a=[],o=!1;for(let e of i){if(!c(e)){a.push(e);continue}if(e===t){o=!0,a.push(n);continue}let r=Q(e,t,n);r!==e&&(o=!0),a.push(r)}return o?W(e,r,a):e}function ne(e,t){let n=e.props,r=_(e),i=_(t),a=r.find(e=>c(e)&&u(e)),o=i.find(e=>c(e)&&u(e)),s=r.find(e=>c(e)&&f(e)),l=i.find(e=>c(e)&&f(e)),d=c(a)&&c(o)?L(a,o):c(a)?a:o,p=c(s)&&c(l)?$(s,l):c(s)?s:l;if(d===a&&p===s)return e;let m=[];return d!=null&&m.push(d),p!=null&&m.push(p),W(e,n,m)}function re(e,t,n){let r=e.props,i=_(e),a=i.findIndex(e=>c(e)&&f(e)),o=a>=0?i[a]:void 0,s=c(o)?Z(o,t.children,n):Z(e,t.children,n);if(s===o||s===e)return e;if(c(o)&&a>=0){let t=[...i];return t[a]=s,W(e,r,t)}return W(e,r,s)}function ie(e,t){let n=e.props,r=t.props,i=S(r.children);if(i.length===1&&c(i[0])&&p(i[0])){let t=i[0];return Z(e,t.props.children,m(t))}let a=U(n.children,r.children);return a===r.children?t:C(t)?W(e,n,a):W(t,r,a)}function $(e,t){if(e==null)return B(t);if(t==null)return e;if(!c(e)||!c(t))return t;if(p(t)){let n=t.props,r=m(t);return d(e)?re(e,n,r):Z(e,n.children,r)}return d(e)&&d(t)&&C(t)?ne(e,t):u(e)||u(t)?t:g(e,t)||e.type===t.type?ie(e,t):t}export{p as isLayoutReuseMarker,m as layoutPathOf,$ as mergeFlightRefresh,ee as setChildrenAtLayoutPath,E as unwrapFulfilledFlightNode};
1
+ import{g as e,l as t,o as n,p as r}from"../type-guards-BLY2PlGR.mjs";import{Children as i,Fragment as a,cloneElement as o,createElement as s,isValidElement as c}from"react";function l(e){return t(e.type)}function u(e){return e.type===`head`||e.type===`HEAD`}function d(e){return e.type===`html`||e.type===`HTML`}function f(e){return e.type===`body`||e.type===`BODY`}function p(e){return e.type===`rari-layout-reuse`}function m(e){let t=e.props[`data-rari-layout-path`];return typeof t==`string`&&t!==``?t:void 0}function ee(e,t,n){if(m(e)===t)return W(e,e.props,n);let r=q(e,t);if(r==null)return null;let i=r.parent.props,a=_(r.parent),o=a[r.slotIndex];if(!c(o))return null;let s=[...a];s[r.slotIndex]=W(o,o.props,n);let l=Q(e,r.parent,W(r.parent,i,s));return c(l)?l:null}function h(e){let t={...e};return delete t.children,t}function g(e,t){if(!l(e)||!l(t))return!1;let r=n(e.type)?e.type.$$id:void 0,i=n(t.type)?t.type.$$id:void 0;return r==null||r===``||i==null||i===``||r!==i?!1:(e.key??null)===(t.key??null)}function _(e){return S(e.props.children)}function v(e){return Array.isArray(e)&&e.some(e=>Array.isArray(e))}function y(e,t){let n=e.key,r=typeof n==`string`&&n!==``?`${t}:${n.replace(/^\.+/,``)}`:t;return o(e,{key:r})}function b(e,t,n){return Array.isArray(e)?x(e,t==null?`.${n}`:`${t}:${n}`):e==null||e===!1||e===!0?[]:c(e)&&t!=null?[y(e,`${t}:${n}`)]:[e]}function x(e,t){if(!Array.isArray(e))return e==null||e===!1||e===!0?[]:c(e)&&t!=null?[y(e,t)]:[e];let n=[];for(let r=0;r<e.length;r+=1)n.push(...b(e[r],t,r));return n}function S(e){return e==null||e===!1||e===!0?[]:c(e)||typeof e==`string`||typeof e==`number`?[e]:Array.isArray(e)?x(e,null):r(e)?[e]:i.toArray(e)}function C(e){return c(e)?p(e)?!0:S(e.props.children).some(e=>C(e)):!1}function te(e){let t=e.type;return t===`title`||t===`TITLE`||t===`meta`||t===`META`||t===`link`||t===`LINK`}function w(e){if(e.type!==`link`&&e.type!==`LINK`)return!1;let t=e.props.rel;if(typeof t!=`string`||t===``)return!1;let n=t.toLowerCase();return n===`stylesheet`||n===`preload`||n===`modulepreload`||n===`preconnect`||n===`dns-prefetch`||n===`icon`||n===`shortcut icon`||n===`apple-touch-icon`}function T(t){if(e(t)){if(t.status===`fulfilled`)return t.value;if(e(t._payload)&&t._payload.status===`fulfilled`)return t._payload.value}}function E(t){let n=t;for(let t=0;t<10;t+=1){if(!r(n)&&(!e(n)||!e(n._payload)))return n;let t=T(n);if(t===void 0)return n;if(t==null||t===!1||t===!0)return t;n=t}return n}function D(e){let t=E(e);if(Array.isArray(t)){let e=[];for(let n of t)e.push(...D(n));return e}return c(t)&&t.type===a?O(_(t)):t==null||t===!1||t===!0?[]:[t]}function O(e){let t=[];for(let n of e)t.push(...D(n));return t}function k(e){let t=E(e);return Array.isArray(t)?!0:c(t)&&t.type===a}function A(e){let t=[];for(let n of e)c(n)&&n.type===a?t.push(...A(_(n))):t.push(n);return t}function j(e){if(e.type!==`meta`&&e.type!==`META`)return!1;let t=e.props;return t.charSet!=null||t.charset!=null||typeof t.httpEquiv==`string`&&t.httpEquiv.toLowerCase()===`content-type`||typeof t.name==`string`&&t.name.toLowerCase()===`viewport`}function M(e,t){let n=e.props;return A(t).some(e=>{if(!c(e)||!j(e))return!1;let t=e.props;return n.charSet!=null||n.charset!=null?t.charSet!=null||t.charset!=null:typeof n.httpEquiv==`string`&&n.httpEquiv.toLowerCase()===`content-type`?typeof t.httpEquiv==`string`&&t.httpEquiv.toLowerCase()===`content-type`:typeof t.name==`string`&&t.name.toLowerCase()===`viewport`})}function N(e){return e.type===`title`||e.type===`TITLE`}function P(e){if(e.type!==`meta`&&e.type!==`META`)return!1;let t=e.props.name;return typeof t==`string`&&t.toLowerCase()===`description`}function F(e){return A(e).some(e=>c(e)&&N(e))}function I(e){return A(e).some(e=>c(e)&&P(e))}function L(e,t){let n=e.props,r=A(_(e)),i=_(t),a=A(i),o=F(a),s=I(a);return W(e,n,[...r.filter(e=>{if(!c(e))return!0;if(N(e))return!o;if(e.type===`meta`||e.type===`META`)return j(e)?!M(e,i):P(e)?!s:!1;if(!w(e))return!te(e);let t=e.props;return!a.some(e=>{if(!c(e)||!w(e))return!1;let n=e.props;return t.rel!=null&&t.rel===n.rel&&t.href===n.href})}),...a])}function R(e){return e.length===0?null:e.length===1?e[0]:[...e]}function z(e){let t=[];for(let n of S(e))t.push(B(n));return t}function B(e){if(Array.isArray(e))return R(z(e));if(!c(e))return e;if(p(e))return R(z(e.props.children));let t=e.props,n=S(t.children);if(n.length===0)return e;let r=z(n);return!v(t.children)&&r.every((e,t)=>e===n[t])?e:W(e,t,R(r))}function V(e,t){if(e.length===0)return[B(t)];if(e.length===1)return[$(e[0],t)];let n=[],r=!1;for(let i of e)!r&&c(i)?(r=!0,n.push($(i,t))):n.push(i);return r?n:[B(t)]}function H(e,t){let n=[],r=0;for(let i of t){if(c(i)&&p(i)){n.push(...V(e.slice(r),i)),r=e.length;continue}let t=e[r];n.push(t===void 0?B(i):$(t,i)),r+=1}return r<e.length&&n.push(...e.slice(r)),R(n)}function U(e,t){let n=S(e),r=S(t);return n.length===0||r.length===0?B(t):r.some(e=>c(e)&&p(e))?H(n,r):n.length===r.length?R(n.map((e,t)=>$(e,r[t]))):B(t)}function W(e,t,n){let r=S(n);return o(e,h(t),...r.length===0?[null]:r)}function G(e,t){for(let n=0;n<e.length;n+=1){let r=e[n];if(c(r)&&m(r)===t)return n;for(let e of D(r))if(c(e)&&m(e)===t)return n}return-1}function K(e,t){let n=_(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(c(i)){let e=q(i,t);if(e!=null)return e;continue}let a=E(i);if(c(a)&&q(a,t)!=null)return{parent:e,slotIndex:r}}return null}function q(e,t){let n=G(_(e),t);return n>=0?{parent:e,slotIndex:n}:K(e,t)}function J(e,t,n){let r=E(e);if(Array.isArray(r)){let e=[];for(let t of r)e.push(...D(t));return Z(s(a,null,...e.length===0?[null]:e),t,n)}return c(r)?Z(r,t,n):t}function Y(e,t){if(t==null||t===!1||t===!0)return t;let n=_(e);return n.length===1?$(n[0],t):t}function X(e,t,n){if(m(e)===n)return W(e,e.props,Y(e,t));let i=q(e,n);if(i==null)return null;let a=i.parent.props,o=_(i.parent),s=[...o],l=o[i.slotIndex];return k(l)||!c(l)&&r(l)?s[i.slotIndex]=J(l,t,n):c(l)?s[i.slotIndex]=W(l,l.props,Y(l,t)):s[i.slotIndex]=t,Q(e,i.parent,W(i.parent,a,s))}function Z(e,t,n){if(!c(e))return t;if(c(t)&&p(t)){let r=m(t);return Z(e,t.props.children,r??n)}return n!=null&&n!==``?X(e,t,n)??e:e}function Q(e,t,n){if(e===t)return n;let r=e.props,i=_(e),a=[],o=!1;for(let e of i){if(!c(e)){a.push(e);continue}if(e===t){o=!0,a.push(n);continue}let r=Q(e,t,n);r!==e&&(o=!0),a.push(r)}return o?W(e,r,a):e}function ne(e,t){let n=e.props,r=_(e),i=_(t),a=r.find(e=>c(e)&&u(e)),o=i.find(e=>c(e)&&u(e)),s=r.find(e=>c(e)&&f(e)),l=i.find(e=>c(e)&&f(e)),d=c(a)&&c(o)?L(a,o):c(a)?a:o,p=c(s)&&c(l)?$(s,l):c(s)?s:l;if(d===a&&p===s)return e;let m=[];return d!=null&&m.push(d),p!=null&&m.push(p),W(e,n,m)}function re(e,t,n){let r=e.props,i=_(e),a=i.findIndex(e=>c(e)&&f(e)),o=a>=0?i[a]:void 0,s=c(o)?Z(o,t.children,n):Z(e,t.children,n);if(s===o||s===e)return e;if(c(o)&&a>=0){let t=[...i];return t[a]=s,W(e,r,t)}return W(e,r,s)}function ie(e,t){let n=e.props,r=t.props,i=S(r.children);if(i.length===1&&c(i[0])&&p(i[0])){let t=i[0];return Z(e,t.props.children,m(t))}let a=U(n.children,r.children);return a===r.children?t:C(t)?W(e,n,a):W(t,r,a)}function $(e,t){if(e==null)return B(t);if(t==null)return e;if(!c(e)||!c(t))return t;if(p(t)){let n=t.props,r=m(t);return d(e)?re(e,n,r):Z(e,n.children,r)}return d(e)&&d(t)&&C(t)?ne(e,t):u(e)||u(t)?t:g(e,t)||e.type===t.type?ie(e,t):t}export{p as isLayoutReuseMarker,m as layoutPathOf,$ as mergeFlightRefresh,ee as setChildrenAtLayoutPath,E as unwrapFulfilledFlightNode};
@@ -6,4 +6,5 @@ declare function requireClientComponent(id: string): any;
6
6
  declare global {
7
7
  var __rari_rsc_require__: typeof requireClientComponent | undefined;
8
8
  }
9
- //#endregion
9
+ //#endregion
10
+ export {};
@@ -1 +1 @@
1
- import{g as e}from"../type-guards-BLY2PlGR.mjs";import{a as t,i as n,n as r,r as i,t as a}from"../rari-global-5vGzhToD.mjs";import{n as o,r as s}from"../get-client-component-D2K213pV.mjs";if(n().isDevelopment=process.env.NODE_ENV!==`production`,i(),a(),r(),typeof window<`u`&&(o(),Reflect.set(globalThis,`__rari_rsc_require__`,s)),typeof window<`u`){let e=t();e.streaming??={bufferedRows:[]}}if(import.meta.hot){function t(e){if(!e)return!1;try{return n().serverComponents?.has(e)===!0}catch{return!1}}let r=!1,i=[],a=/* @__PURE__ */ new Map;function o(e,t,n){a.set(e,async e=>{n(e)&&await t(e)}),import.meta.hot.on(e,t=>{(async()=>{if(!r){i.push({event:e,data:t});return}try{let n=a.get(e);n&&await n(t)}catch(t){console.error(`[rari] HMR: Error in handler for '${e}':`,t)}})()})}function s(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}function c(t){return e(t)&&Array.isArray(t.serverComponents)}function l(t){return e(t)&&typeof t.path==`string`&&t.path!==``}function u(t){return e(t)}function d(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}function f(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}o(`rari:register-server-component`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set,t.serverComponents.add(e.filePath)},s),o(`rari:server-components-registry`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set;for(let n of e.serverComponents)t.serverComponents.add(n)},c),o(`vite:beforeFullReload`,e=>{t(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},l),o(`rari:server-component-updated`,e=>{let n=e.id!=null&&e.id!==``?e.id:e.componentId,r=e.t!=null&&e.t!==0?e.t:e.timestamp;n!=null&&n!==``?window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:n,filePath:e.filePath!=null&&e.filePath!==``?e.filePath:e.file,type:`server-component`,timestamp:r}})):e.path!=null&&e.path!==``&&t(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},u);function p(e){if(e.title!=null&&e.title!==``&&(document.title=e.title),e.description==null||e.description===``)return;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 m(t){let n=e(t)&&t.success===!0,r=e(t)&&t.reloaded===!0,i=e(t)&&t.content_unchanged===!0,a=e(t)&&typeof t.error==`string`?t.error:`Component reload unsuccessful`;return{ok:n||r,contentUnchanged:i,errorMessage:a}}async function h(e){if(e.routePath!=null&&e.routePath!==``||e.affectedRoutes!=null&&e.affectedRoutes.length!==0)try{let t=await fetch(`/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:e.filePath})});if(!t.ok)throw Error(`Component reload failed: ${t.status}`);let n=m(await t.json());if(!n.ok)throw Error(n.errorMessage);if(n.contentUnchanged)return;await fetch(`/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:e.routePath!=null&&e.routePath!==``?e.routePath:e.filePath,filePath:e.filePath})}),e.metadataChanged&&e.metadata&&p(e.metadata),window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:e.routePath,affectedRoutes:e.affectedRoutes??(e.routePath==null?[]:[e.routePath]),currentPath:window.location.pathname,preserveParams:!0}}))}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}}o(`rari:app-router-updated`,h,d),o(`rari:server-action-updated`,e=>{window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}}))},f),i.length>0?(async()=>{try{let e=[...i];i.length=0;for(let{event:t,data:n}of e){let e=a.get(t);e&&await e(n)}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{r=!0}})():r=!0}export{};
1
+ import{g as e}from"../type-guards-BLY2PlGR.mjs";import{a as t,i as n,n as r,r as i,t as a}from"../rari-global-5vGzhToD.mjs";import{n as o,r as s}from"../get-client-component-D2K213pV.mjs";if(n().isDevelopment=process.env.NODE_ENV!==`production`,i(),a(),r(),typeof window<`u`&&(o(),Reflect.set(globalThis,`__rari_rsc_require__`,s)),typeof window<`u`){let e=t();e.streaming??={bufferedRows:[]}}if(import.meta.hot){function t(e){if(!e)return!1;try{return n().serverComponents?.has(e)===!0}catch{return!1}}let r=!1,i=[],a=/* @__PURE__ */ new Map;function o(e,t,n){a.set(e,async e=>{n(e)&&await t(e)}),import.meta.hot.on(e,t=>{(async()=>{if(!r)i.push({event:e,data:t});else try{let n=a.get(e);n&&await n(t)}catch(t){console.error(`[rari] HMR: Error in handler for '${e}':`,t)}})()})}function s(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}function c(t){return e(t)&&Array.isArray(t.serverComponents)}function l(t){return e(t)&&typeof t.path==`string`&&t.path!==``}function u(t){return e(t)}function d(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}function f(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}o(`rari:register-server-component`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set,t.serverComponents.add(e.filePath)},s),o(`rari:server-components-registry`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set;for(let n of e.serverComponents)t.serverComponents.add(n)},c),o(`vite:beforeFullReload`,e=>{t(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},l),o(`rari:server-component-updated`,e=>{let n=e.id!=null&&e.id!==``?e.id:e.componentId,r=e.t!=null&&e.t!==0?e.t:e.timestamp;n!=null&&n!==``?window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:n,filePath:e.filePath!=null&&e.filePath!==``?e.filePath:e.file,type:`server-component`,timestamp:r}})):e.path!=null&&e.path!==``&&t(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},u);function p(e){if(e.title!=null&&e.title!==``&&(document.title=e.title),e.description==null||e.description===``)return;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 m(t){let n=e(t)&&t.success===!0,r=e(t)&&t.reloaded===!0,i=e(t)&&t.content_unchanged===!0,a=e(t)&&typeof t.error==`string`?t.error:`Component reload unsuccessful`;return{ok:n||r,contentUnchanged:i,errorMessage:a}}async function h(e){if(e.routePath!=null&&e.routePath!==``||e.affectedRoutes!=null&&e.affectedRoutes.length!==0)try{let t=await fetch(`/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:e.filePath})});if(!t.ok)throw Error(`Component reload failed: ${t.status}`);let n=m(await t.json());if(!n.ok)throw Error(n.errorMessage);if(n.contentUnchanged)return;await fetch(`/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:e.routePath!=null&&e.routePath!==``?e.routePath:e.filePath,filePath:e.filePath})}),e.metadataChanged&&e.metadata&&p(e.metadata),window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:e.routePath,affectedRoutes:e.affectedRoutes??(e.routePath==null?[]:[e.routePath]),currentPath:window.location.pathname,preserveParams:!0}}))}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}}o(`rari:app-router-updated`,h,d),o(`rari:server-action-updated`,e=>{window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}}))},f),i.length>0?(async()=>{try{let e=[...i];i.length=0;for(let{event:t,data:n}of e){let e=a.get(t);e&&await e(n)}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{r=!0}})():r=!0}export{};
@@ -1,4 +1,4 @@
1
- import{g as e}from"./type-guards-BLY2PlGR.mjs";import{t}from"./xml-DPsk9WTz.mjs";import{i as n,n as r,t as i}from"./execute-DJ7w3uhW.mjs";import{promises as a}from"node:fs";import o from"node:path";const s=/[^\w-]/g;function c(e){return(typeof e==`string`?new Date(e):e).toISOString()}function l(e){return[` <image:image>`,` <image:loc>${t(e)}</image:loc>`,` </image:image>`].join(`
1
+ import{g as e}from"./type-guards-BLY2PlGR.mjs";import{t}from"./xml-DPsk9WTz.mjs";import{i as n,n as r,t as i}from"./execute-C7dN28Np.mjs";import{promises as a}from"node:fs";import o from"node:path";const s=/[^\w-]/g;function c(e){return(typeof e==`string`?new Date(e):e).toISOString()}function l(e){return[` <image:image>`,` <image:loc>${t(e)}</image:loc>`,` </image:image>`].join(`
2
2
  `)}function u(e){let n=[` <image:image>`,` <image:loc>${t(e.loc)}</image:loc>`];return e.title!=null&&e.title!==``&&n.push(` <image:title>${t(e.title)}</image:title>`),e.caption!=null&&e.caption!==``&&n.push(` <image:caption>${t(e.caption)}</image:caption>`),e.geoLocation!=null&&e.geoLocation!==``&&n.push(` <image:geo_location>${t(e.geoLocation)}</image:geo_location>`),e.license!=null&&e.license!==``&&n.push(` <image:license>${t(e.license)}</image:license>`),n.push(` </image:image>`),n.join(`
3
3
  `)}function d(e){let t=[];for(let n of e)typeof n==`string`?t.push(l(n)):t.push(u(n));return t.join(`
4
4
  `)}function f(e){return[` <video:video>`,` <video:title>${t(e.title)}</video:title>`,` <video:thumbnail_loc>${t(e.thumbnail_loc)}</video:thumbnail_loc>`,` <video:description>${t(e.description)}</video:description>`,...p(e),...m(e),...h(e),...g(e),` </video:video>`].join(`