rari 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-routes-Dc2tv31o.mjs +1 -0
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +39 -39
- package/dist/constants-CRK2JRKf.mjs +1 -0
- package/dist/{define-CRafeveU.mjs → define-B_ozIapW.mjs} +1 -1
- package/dist/dist-paths-C4EV064W.mjs +1 -0
- package/dist/{execute-B1z6YRUF.mjs → execute-CbhDMAQ3.mjs} +1 -1
- package/dist/feed-NrJzjZyg.mjs +10 -0
- package/dist/font/google-catalog.d.mts +1952 -0
- package/dist/font/google.d.mts +1 -1946
- package/dist/font/google.mjs +1 -1
- package/dist/form-state-DAygOjc8.mjs +1 -0
- package/dist/get-client-component-s7qprTUa.mjs +1 -0
- package/dist/headers.d.mts +1 -1
- package/dist/image/static.d.mts +1 -0
- package/dist/image/static.mjs +1 -0
- package/dist/image.d.mts +4 -35
- package/dist/image.mjs +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +1 -1
- package/dist/mdx/define.mjs +1 -1
- package/dist/mdx.mjs +1 -1
- package/dist/navigation-transition-store-CSKrbtbK.mjs +1 -0
- package/dist/path-CTEC1xmy.mjs +1 -0
- package/dist/platform.mjs +1 -1
- package/dist/preload-modules-Dv_GzGCm.mjs +2 -0
- package/dist/proxy/RariResponse.mjs +1 -1
- package/dist/proxy/runtime-executor.mjs +1 -1
- package/dist/regex-constants-DzXwNGh2.mjs +1 -0
- package/dist/{robots-B1bFAd4J.mjs → robots-BOPIkPcN.mjs} +1 -1
- package/dist/router-Cl4J7j1A.mjs +1 -0
- package/dist/router.d.mts +8 -5
- package/dist/router.mjs +1 -1
- package/dist/{rsc-vite-build-Cpu5suGN.mjs → rsc-vite-build-CSnu8C3P.mjs} +1 -1
- package/dist/runtime/AppRouterProvider.mjs +1 -1
- package/dist/runtime/ClientRouter.mjs +4 -4
- package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
- package/dist/runtime/call-server.mjs +1 -1
- package/dist/runtime/entry-client.d.mts +1 -1
- package/dist/runtime/entry-client.mjs +3 -3
- package/dist/runtime/flight-router-state.d.mts +1 -0
- package/dist/runtime/flight-router-state.mjs +1 -1
- package/dist/runtime/merge-flight-refresh.d.mts +4 -0
- package/dist/runtime/merge-flight-refresh.mjs +1 -1
- package/dist/runtime/rsc-client-runtime.d.mts +1 -1
- package/dist/runtime/rsc-client-runtime.mjs +1 -1
- package/dist/serialize-router-state-uOGGpmBr.mjs +1 -0
- package/dist/sitemap--bdIkWl5.mjs +13 -0
- package/dist/static-modules-DBL6iFbg.d.mts +61 -0
- package/dist/{types-Q-x_0kVB.d.mts → types-C8N3Hc8I.d.mts} +1 -0
- package/dist/{types-xTbuE-Js.d.mts → types-DfSnnFaF.d.mts} +3 -1
- package/dist/vite.d.mts +3 -1
- package/dist/vite.mjs +141 -197
- package/dist/{xml-EW5iM39h.mjs → xml-DPsk9WTz.mjs} +1 -1
- package/package.json +22 -19
- package/dist/api-routes-ChRr3O5-.mjs +0 -1
- package/dist/constants-BFdy-wPN.mjs +0 -1
- package/dist/feed-uUGeOZmR.mjs +0 -10
- package/dist/form-state-DZJs9bve.mjs +0 -1
- package/dist/get-client-component-DU5z65us.mjs +0 -1
- package/dist/path-C74rvUep.mjs +0 -1
- package/dist/preload-modules-1i2BJqux.mjs +0 -2
- package/dist/prompt-uaCPq0_A-BW0EkzOD.mjs +0 -45
- package/dist/regex-constants-DBMCJbMw.mjs +0 -1
- package/dist/router-D6X8JHst.mjs +0 -1
- package/dist/runtime/LoadingErrorBoundary.d.mts +0 -10
- package/dist/runtime/LoadingErrorBoundary.mjs +0 -1
- package/dist/sitemap-DJY3OiJ0.mjs +0 -13
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as e,t}from"./api-routes-Dc2tv31o.mjs";import{T as n,a as r,b as i,c as a,d as o,n as s,r as c,t as l,v as u,w as d,x as f,y as p}from"./type-guards-BJXKlA6x.mjs";import{a as m,i as h,r as g,s as _}from"./constants-CRK2JRKf.mjs";import{a as v,d as y,f as ee,i as te,m as ne,n as b,o as x,p as S,r as re,s as ie,u as ae}from"./regex-constants-DzXwNGh2.mjs";import{a as oe,i as se,n as C,o as w,t as ce}from"./path-CTEC1xmy.mjs";import{a as le,c as ue,i as de,l as fe,n as pe,o as me,r as he,s as T,u as ge}from"./rsc-vite-build-CSnu8C3P.mjs";import{t as _e}from"./timer-Duul5JHq.mjs";import{t as ve}from"./names-CLmM0CPi.mjs";import{a as ye,i as be,n as xe,r as Se}from"./dist-paths-C4EV064W.mjs";import{builtinModules as Ce,createRequire as we}from"node:module";import{Buffer as Te}from"node:buffer";import{spawn as Ee,spawnSync as De}from"node:child_process";import E,{promises as D}from"node:fs";import O from"node:path";import k from"node:process";import{text as Oe}from"node:stream/consumers";import{fileURLToPath as A,pathToFileURL as ke}from"node:url";import{createHash as Ae}from"node:crypto";import{isFileLoadingAllowed as je}from"vite-plus";import{fromBuffer as Me}from"@capsizecss/unpack";import j from"@capsizecss/metrics/arial";import Ne from"@capsizecss/metrics/timesNewRoman";import{reactRefreshWrapperPlugin as Pe}from"vite-plus/internal";function Fe(e){return e.map(e=>e)}function Ie(e){return e}const Le=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mts`,`.mjs`];async function Re(e=k.cwd(),t=`src`,n={}){let r=n.proxyFileName??`proxy`,i=n.extensions??Le;for(let t of i){let n=O.join(e,`${r}${t}`);try{return await D.access(n),n}catch{}}for(let n of i){let i=O.join(e,t,`${r}${n}`);try{return await D.access(i),i}catch{}}return null}function ze(e={}){let{root:t=k.cwd(),srcDir:n=`src`,proxyFileName:r=`proxy`,extensions:i=Le,verbose:a=!1}=e,o=null,s=e=>{a&&console.warn(`[rari] Proxy: ${e}`)};async function c(){let e=await Re(t,n,{proxyFileName:r,extensions:i});if(e==null)return null;let a=O.relative(t,e);return s(`Found proxy file: ${a}`),{filePath:e,exists:!0,relativePath:a}}return Ie({name:`rari:proxy`,async buildStart(){o=await c(),s(o?`Proxy enabled: ${o.relativePath}`:`No proxy file found`)},configureServer(e){o&&(e.watcher.add(o.filePath),e.watcher.on(`change`,t=>{t===o?.filePath&&(s(`Proxy file changed, reloading...`),e.ws.send({type:`custom`,event:`rari:proxy-reload`}))}))},handleHotUpdate({file:e,server:t}){if(e===o?.filePath)return s(`Hot reloading proxy...`),t.ws.send({type:`custom`,event:`rari:proxy-reload`,data:{file:o.relativePath}}),[]}})}function Be(e){if(e==null||e===``)return null;let t=Number(e);return Number.isFinite(t)?t:null}function M(){let{SERVER_PORT:e,PORT:t,RSC_PORT:n}=k.env;return Be(e)??Be(t)??Be(n)??3e3}function Ve(){return`http://localhost:${M()}`}const He=6e4;async function Ue(e){let t=ke(e).href,n=`
|
|
2
2
|
import { registerHooks } from "node:module";
|
|
3
3
|
registerHooks({
|
|
4
4
|
resolve(specifier, context, nextResolve) {
|
|
@@ -16,24 +16,17 @@ const result =
|
|
|
16
16
|
process.send(result, () => {
|
|
17
17
|
process.disconnect();
|
|
18
18
|
});
|
|
19
|
-
`;return new Promise((t,r)=>{let i=
|
|
20
|
-
`);if(n!==0){r(Error(i||`generateStaticParams worker exited with code ${n}`));return}if(!c){r(Error(i||`generateStaticParams worker exited without an IPC result for ${e}`));return}t(l)})})}const
|
|
19
|
+
`;return new Promise((t,r)=>{let i=Ee(k.execPath,[`--conditions=react-server`,`--input-type=module`,`--eval`,n],{stdio:[`ignore`,`pipe`,`pipe`,`ipc`],env:k.env}),a=``,o=``,s=!1,c=!1,l,u,d,f=()=>{u!==void 0&&clearTimeout(u),d!==void 0&&clearTimeout(d),u=void 0,d=void 0};u=setTimeout(()=>{s||(s=!0,u!==void 0&&clearTimeout(u),u=void 0,i.kill(`SIGTERM`),d=setTimeout(()=>{i.kill(`SIGKILL`)},1e3),r(/* @__PURE__ */ Error(`generateStaticParams timed out after ${He}ms for ${e}`)))},He),i.stdout?.setEncoding(`utf8`),i.stderr?.setEncoding(`utf8`),i.stdout?.on(`data`,e=>{a+=e}),i.stderr?.on(`data`,e=>{o+=e}),i.on(`message`,e=>{c=!0,l=e}),i.on(`error`,e=>{s||(s=!0,f(),r(e))}),i.on(`close`,n=>{if(f(),s)return;s=!0;let i=[o.trim(),a.trim()].filter(Boolean).join(`
|
|
20
|
+
`);if(n!==0){r(Error(i||`generateStaticParams worker exited with code ${n}`));return}if(!c){r(Error(i||`generateStaticParams worker exited without an IPC result for ${e}`));return}t(l)})})}const We=/\\\*/g;function Ge(e,t={}){let{escapeAsterisk:n=!0}=t,r=RegExp.escape(e);return n?r:r.replace(We,`*`)}const Ke=[`.ico`],qe=[`.ico`,`.jpg`,`.jpeg`,`.png`,`.svg`],Je=[`.jpg`,`.jpeg`,`.png`],Ye={".ico":`image/x-icon`,".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".svg":`image/svg+xml`};function Xe(e){return Ye[e.toLowerCase()]??`application/octet-stream`}function Ze(e,t,n){let r=n.map(e=>Ge(e.replace(/^\./,``))).join(`|`),i=RegExp(`^${Ge(t)}(\\d*)\\.(${r})$`,`i`);return e.filter(e=>i.test(e)).sort((e,t)=>e.localeCompare(t))}function Qe(e,t){let n=w(e).replace(/^\/+|\/+$/g,``);return n===``?`/${t}`:`/${n}/${t}`.replace(/\/+/g,`/`)}function $e(e){if(e.length<24||e[0]!==137||e[1]!==80||e[2]!==78||e[3]!==71)return;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:t.getUint32(16),height:t.getUint32(20)}}async function et(e){let t=O.extname(e).toLowerCase();if(t===`.svg`||t===`.ico`)return{sizes:`any`};try{let n=await D.readFile(e);if(t===`.png`){let e=$e(n);if(e)return{...e,sizes:`${e.width}x${e.height}`}}}catch{}return{sizes:`any`}}function tt(e){let t=w(O.join(e.relativeDir,e.fileName)),n=O.extname(e.fileName).toLowerCase();return{path:e.routePath,filePath:t,kind:e.kind,url:Qe(e.relativeDir,e.fileName),contentType:Xe(n),width:e.width,height:e.height,sizes:e.sizes}}async function nt(e){let{appDir:t,relativeDir:n,routePath:r,files:i}=e,a=[],o=async(e,o,s,c)=>{if(c&&r!==`/`)return;let l=Ze(i,o,s);for(let i of l){let o=await et(O.join(t,n,i));a.push(tt({routePath:r,relativeDir:n,fileName:i,kind:e,width:o.width,height:o.height,sizes:o.sizes}))}};return await o(`favicon`,`favicon`,Ke,!0),await o(`icon`,`icon`,qe,!1),await o(`apple-icon`,`apple-icon`,Je,!1),a}async function rt(e){let{appDir:t,outDir:n,icons:r}=e,i=0;for(let e of r){let r=O.join(t,e.filePath),a=O.join(n,e.url.replace(/^\//,``));await D.mkdir(O.dirname(a),{recursive:!0}),await D.copyFile(r,a),i+=1}return i}function it(e){return u(e)?typeof e.path==`string`&&typeof e.filePath==`string`&&(e.kind===`favicon`||e.kind===`icon`||e.kind===`apple-icon`)&&typeof e.url==`string`&&typeof e.contentType==`string`&&(e.sizes===void 0||typeof e.sizes==`string`)&&(e.width===void 0||typeof e.width==`number`)&&(e.height===void 0||typeof e.height==`number`):!1}function at(e){let t;try{t=JSON.parse(e)}catch{return[]}return!u(t)||!Array.isArray(t.appIcons)?[]:t.appIcons.filter(it)}const N={PAGE:`page`,LAYOUT:`layout`,LOADING:`loading`,ERROR:`error`,NOT_FOUND:`not-found`,TEMPLATE:`template`,DEFAULT:`default`,ROUTE:`route`,OG_IMAGE:`opengraph-image`,TWITTER_IMAGE:`twitter-image`,ICON:`icon`,APPLE_ICON:`apple-icon`},ot={DYNAMIC:/^\[([^\]]+)\]$/,CATCH_ALL:/^\[\.\.\.([^\]]+)\]$/,OPTIONAL_CATCH_ALL:/^\[\[\.\.\.([^\]]+)\]\]$/},st=[{pattern:ot.OPTIONAL_CATCH_ALL,type:`optional-catch-all`,format:e=>`[[...${e}]]`},{pattern:ot.CATCH_ALL,type:`catch-all`,format:e=>`[...${e}]`},{pattern:ot.DYNAMIC,type:`dynamic`,format:e=>`[${e}]`}],ct=/^\([^/]+\)$/;function lt(e){return ct.test(e)}function ut(e){return e?w(e).split(`/`).filter(Boolean).some(lt):!1}function dt(e){for(let t of st){let n=e.match(t.pattern);if(n)return{type:t.type,param:n[1],format:t.format}}}function ft(e){let t=dt(e);return t?t.format(t.param):e}function pt(e){let t=dt(e);return t?{type:t.type,value:e,param:t.param}:{type:`static`,value:e}}const mt=/export\s+const\s+size\s*=\s*\{\s*width\s*:\s*(\d+)\s*,\s*height\s*:\s*(\d+)\s*[,}]/,ht=/export\s+const\s+contentType\s*=\s*['"]([^'"]+)['"]/,gt=[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`];var _t=class{appDir;extensions;verbose;constructor(e){this.appDir=O.resolve(e.appDir),this.extensions=[...e.extensions??[`.tsx`,`.jsx`,`.ts`,`.js`]],this.verbose=e.verbose??!1}async generateManifest(){this.verbose&&console.warn(`[rari] Router: Scanning app directory: ${this.appDir}`);let e=[],t=[],n=[],r=[],i=[],a=[],o=[],s=[],c=[];await this.scanDirectory(``,e,t,n,r,i,a,o,s,c);for(let o of[t,n,r,i,a,s])this.finalizeGroupEntries(e,o);return this.assertNoDuplicateRoutes(e),this.assertNoDuplicateRoutes(o),this.verbose&&(console.warn(`[rari] Router: Found ${e.length} routes`),console.warn(`[rari] Router: Found ${t.length} layouts`),console.warn(`[rari] Router: Found ${n.length} loading components`),console.warn(`[rari] Router: Found ${r.length} error boundaries`),console.warn(`[rari] Router: Found ${a.length} templates`),console.warn(`[rari] Router: Found ${o.length} API routes`),console.warn(`[rari] Router: Found ${s.length} OG images`),console.warn(`[rari] Router: Found ${c.length} app icons`)),{routes:this.sortRoutes(e),layouts:this.sortLayouts(t),loading:n,errors:r,notFound:i,templates:this.sortTemplates(a),apiRoutes:this.sortApiRoutes(o),ogImages:s,appIcons:c,generated:(/* @__PURE__ */ new Date()).toISOString()}}finalizeGroupEntries(e,t){for(let n=t.length-1;n>=0;n--){let r=t[n],i=w(O.dirname(r.filePath));if(!ut(i))continue;let a=e.filter(e=>{let t=w(O.dirname(e.filePath));return t===i||t.startsWith(`${i}/`)}).map(e=>e.path);if(a.length===0){t.splice(n,1);continue}let o=Array.from(new Set(a)).sort();r.path=o[0],o.length>1&&(r.additionalPaths=o.slice(1))}}assertNoDuplicateRoutes(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.path);if(e!=null&&e!==``)throw Error(`[rari] Route conflict: path '${n.path}' is defined by both '${e}' and '${n.filePath}'.`);t.set(n.path,n.filePath)}}async scanDirectory(e,t,n,r,i,a,o,s,c,l){let u=O.join(this.appDir,e),d;try{d=await D.readdir(u)}catch{return}let f=[],p=[];for(let e of d){let t=O.join(u,e),n=await D.stat(t);n.isDirectory()?this.shouldScanDirectory(e)&&p.push(e):n.isFile()&&f.push(e)}await this.processSpecialFiles(e,f,t,n,r,i,a,o,s,c,l);for(let u of p){let d=e?O.join(e,u):u;await this.scanDirectory(d,t,n,r,i,a,o,s,c,l)}}async processSpecialFiles(e,t,n,r,i,a,o,s,c,l,u){let d=this.pathToRoute(e);this.pushPageRoute(e,t,d,n),this.pushLayoutEntry(e,t,d,r),this.pushNamedSpecial(e,t,d,N.LOADING,i),this.pushNamedSpecial(e,t,d,N.ERROR,a),this.pushNamedSpecial(e,t,d,N.NOT_FOUND,o),this.pushTemplateEntry(e,t,d,s),await this.pushOgImageEntry(e,t,d,l);let f=await nt({appDir:this.appDir,relativeDir:e,routePath:d,files:t});u.push(...f);let p=this.findFile(t,N.ROUTE);if(p!=null&&p!==``){let t=await this.processApiRouteFile(e,p);c.push(t)}}pushPageRoute(e,t,n,r){let i=this.findFile(t,N.PAGE);if(i==null||i===``)return;let a=this.parseRouteSegments(e),o=this.extractParams(a);r.push({path:n,filePath:w(O.join(e,i)),segments:a,params:o,isDynamic:o.length>0})}pushLayoutEntry(e,t,n,r){let i=this.findFile(t,N.LAYOUT);if(i==null||i===``)return;let a=this.getParentPath(e);r.push({path:n,filePath:w(O.join(e,i)),parentPath:a===null?void 0:this.pathToRoute(a)})}pushNamedSpecial(e,t,n,r,i){let a=this.findFile(t,r);a!=null&&a!==``&&i.push({path:n,filePath:w(O.join(e,a))})}pushTemplateEntry(e,t,n,r){let i=this.findFile(t,N.TEMPLATE);if(i==null||i===``)return;let a=this.getParentPath(e);r.push({path:n,filePath:w(O.join(e,i)),parentPath:a===null?void 0:this.pathToRoute(a)})}async pushOgImageEntry(e,t,n,r){let i=this.findFile(t,N.OG_IMAGE);if(i==null||i===``)return;let a=w(O.join(e,i)),o=O.join(this.appDir,a),s,c,l;try{let e=await D.readFile(o,`utf-8`),t=mt.exec(e);t&&(s=Number.parseInt(t[1],10),c=Number.parseInt(t[2],10));let n=ht.exec(e);n&&(l=n[1])}catch{}r.push({path:n,filePath:a,width:s,height:c,contentType:l})}findFile(e,t){for(let n of this.extensions){let r=`${t}${n}`;if(e.includes(r))return r}}pathToRoute(e){return e?`/${w(e).split(`/`).filter(Boolean).filter(e=>!lt(e)).map(ft).join(`/`)}`:`/`}parseRouteSegments(e){return e?e.split(ae).filter(Boolean).filter(e=>!lt(e)).map(pt):[]}extractParams(e){return e.filter(e=>e.param!==void 0).map(e=>e.param)}getParentPath(e){if(!e)return null;let t=e.split(ae).filter(Boolean);
|
|
21
21
|
/* v8 ignore stop */
|
|
22
22
|
return t.length===0?null:t.slice(0,-1).join(`/`)}shouldScanDirectory(e){return![`node_modules`,`.git`,`dist`,`build`,`__tests__`,`test`,`tests`,`coverage`].includes(e)&&!e.startsWith(`_`)&&!e.startsWith(`.`)}sortRoutes(e){return e.sort((e,t)=>{let n=e=>{if(!e.isDynamic)return 0;let t=e.segments.some(e=>e.type===`catch-all`);return e.segments.some(e=>e.type===`optional-catch-all`)?3:t?2:1},r=n(e),i=n(t);if(r!==i)return r-i;let a=e.path.split(`/`).length,o=t.path.split(`/`).length;return a===o?e.path.localeCompare(t.path):o-a})}sortApiRoutes(e){return e.sort((e,t)=>{if(!e.isDynamic&&t.isDynamic)return-1;if(e.isDynamic&&!t.isDynamic)return 1;let n=e.path.split(`/`).length,r=t.path.split(`/`).length;
|
|
23
23
|
/* v8 ignore stop */
|
|
24
|
-
return n===r?e.path.localeCompare(t.path):n-r})}sortLayouts(e){return e.sort((e,t)=>e.path===`/`&&t.path!==`/`?-1:t.path===`/`&&e.path!==`/`?1:e.path.split(`/`).length-t.path.split(`/`).length)}sortTemplates(e){return e.sort((e,t)=>e.path===`/`&&t.path!==`/`?-1:t.path===`/`&&e.path!==`/`?1:e.path.split(`/`).length-t.path.split(`/`).length)}async detectHttpMethods(e){let t=
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
}`,Vt(t.slice(n,r),`return {
|
|
32
|
-
name: referenceClosure,
|
|
33
|
-
method: "POST",
|
|
34
|
-
encType: "multipart/form-data",
|
|
35
|
-
data: data
|
|
36
|
-
};`,`function resolveRariFormActionUrl() {
|
|
24
|
+
return n===r?e.path.localeCompare(t.path):n-r})}sortLayouts(e){return e.sort((e,t)=>e.path===`/`&&t.path!==`/`?-1:t.path===`/`&&e.path!==`/`?1:e.path.split(`/`).length-t.path.split(`/`).length)}sortTemplates(e){return e.sort((e,t)=>e.path===`/`&&t.path!==`/`?-1:t.path===`/`&&e.path!==`/`?1:e.path.split(`/`).length-t.path.split(`/`).length)}async detectHttpMethods(e){let t=O.join(this.appDir,e),n=await D.readFile(t,`utf-8`),r=[];for(let e of gt){let t=RegExp(`export\\s+(?:async\\s+)?function\\s+${e}\\s*\\(`),i=RegExp(`export\\s+(?:async\\s+)?(?:const|let|var)\\s+${e}\\s*=`);(t.test(n)||i.test(n))&&r.push(e)}return r}async processApiRouteFile(e,t){let n=w(O.join(e,t)),r=this.pathToRoute(e),i=this.parseRouteSegments(e),a=this.extractParams(i),o=await this.detectHttpMethods(n);return{path:r,filePath:n,segments:i,params:a,isDynamic:a.length>0,methods:o}}};async function vt(e,t={}){return new _t({appDir:e,...t}).generateManifest()}const yt=/export\s+const\s+metadata\s*(?::\s*\w+\s*)?=\s*(\{[\s\S]*?\n\})/,bt=/title\s*:\s*['"]([^'"]+)['"]/,xt=/description\s*:\s*['"]([^'"]+)['"]/,St=/keywords\s*:\s*\[([\s\S]*?)\]/,Ct={appDir:`src/app`,extensions:[`.tsx`,`.jsx`,`.ts`,`.js`],outDir:`dist`};function wt(e){switch(O.basename(e).replace(S,``)){case`page`:return`page`;case`layout`:return`layout`;case`template`:return`template`;case`loading`:return`loading`;case`error`:return`error`;case`not-found`:return`not-found`;case`route`:return`route`;default:return null}}function Tt(e){if(!e||e===`/`)return`/`;let t=w(e).split(`/`).filter(e=>!!e&&!lt(e));return t.length>0?`/${t.join(`/`)}`:`/`}function Et(e,t){let n=O.relative(O.normalize(t),O.normalize(O.dirname(e)));return!n||n===`.`?`/`:Tt(`/${w(n).split(`/`).filter(Boolean).join(`/`)}`)}function Dt(e,t,n){if(t===`page`)return[e];let r=`${e}${e===`/`?``:`/`}`,i=n.filter(t=>t===e||t.startsWith(r));return i.length>0?i:[e]}function Ot(e){try{let t=yt.exec(e);if(!t)return null;let n=t[1],r={},i=bt.exec(n);i&&(r.title=i[1]);let a=xt.exec(n);a&&(r.description=a[1]);let o=St.exec(n);o&&(r.keywords=o[1].split(`,`).map(e=>e.trim().replace(y,``)).filter(Boolean));for(let e of[`author`,`viewport`,`themeColor`,`robots`,`openGraph`,`twitter`]){let t=RegExp(`${e}\\s*:\\s*['"]([^'"]+)['"]`,`m`),i=n.match(t);i&&(r[e]=i[1])}return Object.keys(r).length>0?r:null}catch(e){return console.error(`[rari] Router: Failed to extract metadata:`,e),null}}function kt(e){let t=[];for(let n of[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]){let r=RegExp(`export\\s+(?:async\\s+)?function\\s+${n}\\s*\\(`),i=RegExp(`export\\s+(?:async\\s+)?(?:const|let|var)\\s+${n}\\s*=`);(r.test(e)||i.test(e))&&t.push(n)}return t}function At(e){return u(e)&&Array.isArray(e.routes)}async function jt(e){try{let t=await fetch(`${Ve()}/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate-api-route`,filePath:e})});if(!t.ok){console.error(`[rari] Router: Failed to invalidate API route cache: ${t.statusText}`);return}let n=f(await t.text());if(n?.success!==!0){let e=typeof n?.error==`string`&&n.error!==``?n.error:`Unknown error`;console.error(`[rari] HMR: Failed to invalidate API route cache: ${e}`)}}catch(e){console.error(`[rari] Router: Failed to notify API route invalidation:`,e)}}function Mt(e={}){let t={...Ct,...e},r=null,i=/* @__PURE__ */ new Map,a=null,o=/* @__PURE__ */ new Set,s=e=>[...e].toSorted().join(`|`),c=async e=>{let n=/* @__PURE__ */ new Set,r=async e=>{try{let i=await D.readdir(e,{withFileTypes:!0});for(let a of i){let i=O.join(e,a.name);a.isDirectory()?await r(i):a.isFile()&&t.extensions.some(e=>a.name.endsWith(e))&&wt(i)&&n.add(w(i))}}catch{}};return await r(e),n},l=async(e,n=!1)=>{let i=O.resolve(e,t.appDir);try{await D.access(i)}catch{return null}try{let l=await c(i),u=s(l);if(!n&&a===u&&r!=null&&r!==``)return r;let d=await vt(i,{extensions:t.extensions}),f=JSON.stringify(d),p=O.resolve(e,t.outDir);await D.mkdir(p,{recursive:!0});let m=O.join(p,`server`);return await D.mkdir(m,{recursive:!0}),await D.writeFile(O.join(m,`routes.json`),f,`utf-8`),a=u,o.clear(),l.forEach(e=>{o.add(e)}),f}catch(e){return console.error(`[rari] Router: Failed to generate app routes:`,e),null}},u=e=>{let n=O.resolve(e.config.root,t.appDir);e.watcher.on(`all`,(r,i)=>{(async()=>{if(ce(i,n)&&t.extensions.some(e=>i.endsWith(e)))try{let t=wt(i)!==null,a=r===`add`||r===`unlink`,s=t&&!o.has(w(i));(a||s)&&(await l(e.config.root,!0),ce(i,n)&&e.ws.send({type:`full-reload`,path:`*`}))}catch(e){console.error(`[rari] Router: Failed to regenerate app routes:`,e)}})()})},d;return Ie({name:`rari-router`,configResolved(e){d=e.root;let t=e.logger.warn.bind(e.logger);e.logger.warn=(e,n)=>{typeof e==`string`&&e.includes(`The above dynamic import cannot be analyzed`)&&e.includes(`packages/rari/dist/`)||t(e,n)}},async writeBundle(){let e=d||k.cwd();r=await l(e,!0)},configureServer(e){u(e)},async handleHotUpdate(e){let{file:n,server:a}=e,s=O.resolve(a.config.root,t.appDir);if(ce(n,s)&&t.extensions.some(e=>n.endsWith(e))){let e=wt(n);if(e){let t=i.get(n);t&&clearTimeout(t);let c=setTimeout(()=>{(async()=>{i.delete(n);let t=w(n),c=!o.has(t),u=r;r=await l(a.config.root,c);let d=u!==r,p=Et(n,s),m=[p];if(r!=null&&r!==``)try{let e=f(r);e&&At(e)&&(m=e.routes.map(e=>e.path))}catch(e){console.error(`[rari] Router: Failed to parse manifest for affected routes:`,e)}let h=Dt(p,e,m),g,_=!1,v;if(e===`page`||e===`layout`)try{let e=Ot(await D.readFile(n,`utf-8`));e&&(g=e,_=!0)}catch(e){console.error(`[rari] Router: Failed to extract metadata:`,e)}if(e===`route`)try{v=kt(await D.readFile(n,`utf-8`)),await jt(O.relative(s,n))}catch(e){console.error(`[rari] Router: Failed to detect HTTP methods:`,e)}let y={fileType:e,filePath:w(O.relative(a.config.root,n)),routePath:p,affectedRoutes:h,manifestUpdated:d,timestamp:Date.now(),metadata:g,metadataChanged:_,methods:v};a.ws.send({type:`custom`,event:`rari:app-router-updated`,data:y})})()},200);return i.set(n,c),[]}return r=await l(a.config.root),[]}},async closeBundle(){for(let e of i.values())clearTimeout(e);i.clear();let e=d||k.cwd(),r=O.resolve(e,t.outDir,`server`),a=O.join(r,`routes.json`);try{let e=await D.readFile(a,`utf-8`),t=f(e);if(!t||!At(t))return;let i=t,o=i.routes.flatMap(e=>{if(!e.isDynamic)return[];let t=e.componentId;return t==null||t===``?[]:[{route:e,componentId:t}]}),s=Math.min(8,Math.max(1,o.length)),c=o.map(()=>!1),l=0,u=0;await new Promise(e=>{let t=()=>{for(;u<s&&l<o.length;){let i=l++,{route:a,componentId:s}=o[i],d=O.join(r,`${s}.js`);u++,(async()=>{try{let e=await Ue(d);if(e==null)return;p(e)?(a.staticParams=e,c[i]=!0):n(s)}catch(e){console.warn(`[rari] Failed to evaluate generateStaticParams for ${s}:`,e)}finally{u--,l>=o.length&&u===0?e():t()}})()}o.length===0&&e()};t()}),c.some(Boolean)&&await D.writeFile(a,JSON.stringify(i),`utf-8`)}catch(e){console.warn(`[rari] Failed to enrich routes manifest with static params:`,e)}}})}const Nt=/return \{\s*name: referenceClosure,\s*method: "POST",\s*encType: "multipart\/form-data",\s*data: data\s*\};/,Pt=/function registerBoundServerReference\(reference, id, bound\) \{\s*knownServerReferences\.has\(reference\) \|\|\s*knownServerReferences\.set\(reference, \{\s*id: id,\s*originalBind: reference\.bind,\s*bound: bound\s*\}\);\s*\}/,Ft=/Object\.defineProperty\(value\._store, "validated", \{\s*configurable: !1,\s*enumerable: !1,\s*writable: !0,\s*value: i\s*\}\);/;function It(e,t,n,r){let i=new RegExp(t.source,t.flags.includes(`g`)?t.flags:`${t.flags}g`),a=[...e.matchAll(i)];if(a.length===0)throw Error(`Failed to patch flight browser client: pattern for ${r} not found. The react-server-dom-webpack sources likely changed shape after a version bump; update the anchors in patch-flight-browser-client.ts.`);if(a.length>1)throw Error(`Failed to patch flight browser client: pattern for ${r} matched more than once. Update the anchors in patch-flight-browser-client.ts to be unambiguous.`);let o=a[0];return e.slice(0,o.index)+n+e.slice(o.index+o[0].length)}function Lt(e){return Ft.test(e)?(Ft.lastIndex=0,It(e,Ft,`Object.defineProperty(value._store, "validated", {
|
|
25
|
+
configurable: !1,
|
|
26
|
+
enumerable: !1,
|
|
27
|
+
writable: !0,
|
|
28
|
+
value: void 0 === i ? 1 : i
|
|
29
|
+
});`,`DEV _store.validated default for production wire`)):e}function Rt(e){let t=e.indexOf(`var boundCache = new WeakMap();`),n=e.indexOf(`function encodeFormData`),r=t===-1?n===-1?-1:n:t,i=e.indexOf(`function createBoundServerReference`,r);if(r===-1||i===-1)throw Error(`Failed to locate edge client form-action helpers for browser patch`);let a=e.slice(r,i);a.includes(`var boundCache = new WeakMap()`)||(a=`var boundCache = new WeakMap();\n${a}`);let o=/FunctionBind\s*=\s*Function\.prototype\.bind/.test(a),s=/ArraySlice\s*=\s*Array\.prototype\.slice/.test(a);return!o&&!s?a=`var FunctionBind = Function.prototype.bind,\n ArraySlice = Array.prototype.slice;\n${a}`:o?s||(a=`var ArraySlice = Array.prototype.slice;\n${a}`):a=`var FunctionBind = Function.prototype.bind;\n${a}`,It(a,Nt,`function resolveRariFormActionUrl() {
|
|
37
30
|
var g = typeof globalThis !== "undefined" ? globalThis : {};
|
|
38
31
|
var rari = g["~rari"];
|
|
39
32
|
if (rari && rari.actionPostUrl)
|
|
@@ -48,20 +41,20 @@ return n===r?e.path.localeCompare(t.path):n-r})}sortLayouts(e){return e.sort((e,
|
|
|
48
41
|
encType: "multipart/form-data",
|
|
49
42
|
action: resolveRariFormActionUrl(),
|
|
50
43
|
data: data
|
|
51
|
-
};`,`edge $$FORM_ACTION return block`),`browser registerBoundServerReference`)}const Ut=[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react/compiler-runtime`,`react-dom/client`];function Wt(e){return l(e)&&typeof e.find==`string`&&typeof e.replacement==`string`}function Gt(e,t=new Set(Ut)){let n={},r=e.resolve?.alias;if(Array.isArray(r))for(let e of r)Wt(e)&&!t.has(e.find)&&(n[e.find]=e.replacement);else if(l(r))for(let[e,i]of Object.entries(r))typeof i==`string`&&!t.has(e)&&(n[e]=i);return n}function Kt(e){return{projectRoot:e.root,outDir:S.resolve(e.root,e.build.outDir),assetsDir:fe(e.build.assetsDir)}}function qt(e,t=8){return Ne(`sha256`).update(e).digest(`hex`).slice(0,t)}function Jt(e,t=C.cwd()){let n=S.isAbsolute(e)?e:S.resolve(t,e),r=S.relative(t,n);return S.isAbsolute(r)?y(n):y(r)}function Yt(e){return e.replace(v,``).replace(ae,`_`).replace(ie,``)}function Xt(e,t=C.cwd()){let n=Jt(e,t);return`${Yt(n)}_${qt(n)}`}const Zt=/* @__PURE__ */ new Set([`return`,`throw`,`case`,`typeof`,`instanceof`,`new`,`delete`,`void`,`in`,`of`]),Qt=8232,$t=8233;function en(e){return e===32||e===9||e===13||e===10||e===Qt||e===$t||e===65279}function tn(e){return e===13||e===10||e===Qt||e===$t}function T(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95||e===36}function nn(e){return e>=97&&e<=122||e>=65&&e<=90||e===95||e===36}function rn(e,t,n){for(;t<n&&en(e.charCodeAt(t));)t++;return t}function E(e,t,n){for(;t<n;){let r=rn(e,t,n);if(r!==t){t=r;continue}let i=e.charCodeAt(t);if(i===47&&e.charCodeAt(t+1)===47){t=an(e,t,n);continue}if(i===47&&e.charCodeAt(t+1)===42){t=on(e,t,n);continue}break}return t}function an(e,t,n){for(;t<n&&!tn(e.charCodeAt(t));)t++;return t}function on(e,t,n){for(t+=2;t<n-1&&(e.charCodeAt(t)!==42||e.charCodeAt(t+1)!==47);)t++;return t+2}function sn(e,t,n,r){for(t++;t<n;){let n=e.charCodeAt(t);if(n===92){t+=2;continue}if(n===r)return t+1;t++}return t}function cn(e,t,n){t++;let r=e.charCodeAt(t)===47;for(r&&t++;t<n;){let n=e.charCodeAt(t);if(T(n)||n===46||n===45)t++;else break}let i=+!r;for(;t<n&&i>0;){let a=e.charCodeAt(t);if(a===39||a===34||a===96){t=sn(e,t,n,a);continue}if(a===123){t++;let r=1;for(;t<n&&r>0;){let i=e.charCodeAt(t);if(i===39||i===34||i===96){t=sn(e,t,n,i);continue}i===123&&r++,i===125&&r--,t++}continue}if(a===47&&e.charCodeAt(t+1)===62){i--,t+=2;continue}if(a===62){t++,r&&i--;continue}if(a===60){let r=e.charCodeAt(t+1);if(r===47||r===46||r===62||nn(r)){for(r===47?(i--,t++):r!==33&&i++,t++;t<n;){let n=e.charCodeAt(t);if(T(n)||n===46||n===45)t++;else break}continue}t++;continue}t++}return t}function ln(e,t,n){for(let r=0;r<n.length;r++)if(e.charCodeAt(t+r)!==n.charCodeAt(r))return!1;return!0}function D(e,t,n){if(t+n.length>e.length)return!1;for(let r=0;r<n.length;r++)if(e.charCodeAt(t+r)!==n.charCodeAt(r))return!1;let r=t>0?e.charCodeAt(t-1):-1,i=t+n.length,a=i<e.length?e.charCodeAt(i):-1;return!(r!==-1&&T(r)||a!==-1&&T(a))}function un(e,t,n){let r=E(e,t,n);if(r>=n)return null;let i=e.charCodeAt(r);if(i!==39&&i!==34)return null;let a=r+1,o=sn(e,r,n,i);return o<=a?null:{source:e.slice(a,o-1),end:o}}function dn(e,t,n){if(!D(e,t,`import`))return{sources:[],end:t+6};let r=t+6;if(r=E(e,r,n),D(e,r,`type`)&&(r=E(e,r+4,n)),e.charCodeAt(r)===46){for(r++;r<n&&T(e.charCodeAt(r));)r++;for(;r<n&&e.charCodeAt(r)===46;)for(r++;r<n&&T(e.charCodeAt(r));)r++;return{sources:[],end:r}}if(e.charCodeAt(r)===40){r++;let t=un(e,r,n);return t?{sources:[t.source],end:t.end}:{sources:[],end:r}}let i=un(e,r,n);if(i)return{sources:[i.source],end:i.end};let a=0;for(;r<n&&(r=E(e,r,n),!(r>=n));){let t=e.charCodeAt(r);if(a===0&&D(e,r,`from`)){let t=un(e,r+4,n);if(t)return{sources:[t.source],end:t.end};break}if(t===39||t===34||t===96){r=sn(e,r,n,t);continue}t===123||t===40||t===91?a++:(t===125||t===41||t===93)&&(a=Math.max(0,a-1)),r++}return{sources:[],end:r}}function fn(e,t){return e.charCodeAt(t)===101&&e.charCodeAt(t+1)===120&&e.charCodeAt(t+2)===112&&e.charCodeAt(t+3)===111&&e.charCodeAt(t+4)===114&&e.charCodeAt(t+5)===116}function pn(e,t){return e.charCodeAt(t)===100&&e.charCodeAt(t+1)===101&&e.charCodeAt(t+2)===102&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===117&&e.charCodeAt(t+5)===108&&e.charCodeAt(t+6)===116}function mn(e){let t={hasUseClient:!1,hasUseServer:!1},n=!1,r=!1,i=!1,a=!1,o=[],s=!0,c=!1,l=0,u=e.length;for(;l<u;){let d=e.charCodeAt(l);if(s&&(d===39||d===34)){let i=l+1,a=sn(e,l,u,d);if(a<=i){s=!1,l++;continue}let o=a-1-i,f=o===10&&ln(e,i,`use client`),p=o===10&&ln(e,i,`use server`);c||(c=!0,n=f,r=p),f&&(t.hasUseClient=!0),p&&(t.hasUseServer=!0);let m=a,h=!1;for(;m<u;){let t=e.charCodeAt(m);if(en(t)&&!tn(t)){m++;continue}if(tn(t)||t===59){h=!0,l=m+1;break}if(t===47&&e.charCodeAt(m+1)===47){m=an(e,m,u);continue}if(t===47&&e.charCodeAt(m+1)===42){m=on(e,m,u);continue}s=!1,h=!1;break}if(!h){m>=u&&(s=!1),l=s?a:m;continue}continue}let f=Mn(e,l,u);if(f!==-1){s&&!Nn(e,l)&&(s=!1),l=f;continue}if(s=!1,D(e,l,`import`)){let t=dn(e,l,u);for(let e of t.sources)o.push(e);l=t.end;continue}if(fn(e,l)){let t=l+6;if(t<u){let n=e.charCodeAt(t);if(en(n)||n===123||n===47&&(e.charCodeAt(t+1)===47||e.charCodeAt(t+1)===42)){let n=E(e,t,u);if(pn(e,n)){i=!0,a=!0;let r=n+7;if(r>=u||!T(e.charCodeAt(r))){l=t;continue}}if(e.charCodeAt(n)===123){let t=n+1;for(;t<u&&(t=E(e,t,u),e.charCodeAt(t)!==125);){let n=t;for(;t<u&&T(e.charCodeAt(t));)t++;let r=t-n;if(r===0)break;t=E(e,t,u);let o=!1;if(e.charCodeAt(t)===97&&e.charCodeAt(t+1)===115){o=!0;let n=t+2;if(n<u&&!T(e.charCodeAt(n))){t=E(e,n,u);let r=t;for(;t<u&&T(e.charCodeAt(t));)t++;t-r===7&&pn(e,r)&&(i=!0,a=!0)}}if(!o&&r===7&&pn(e,n)&&(i=!0,a=!0),e.charCodeAt(t)===44){t++;continue}if(e.charCodeAt(t)===125)break;t++}}else(D(e,n,`async`)||D(e,n,`function`)||D(e,n,`class`))&&(a=!0)}}}l++}return{directives:t,topLevelUseClient:n,topLevelUseServer:r,hasDefaultExport:i,hasComponentExport:a,importSources:[...new Set(o)]}}function hn(e,t,n){if(t>=n||!nn(e.charCodeAt(t)))return null;let r=t+1;for(;r<n&&T(e.charCodeAt(r));)r++;return{name:e.slice(t,r),end:r}}function gn(e,t,n){let r=t;for(;r<n;){let t=e.charCodeAt(r);if(t===32||t===9){r++;continue}if(t===59)return r+1;break}return t}function _n(e,t,n){let r=[],i=t+1;for(;;){if(i=E(e,i,n),i>=n)return null;if(e.charCodeAt(i)===125)return{named:r,end:i+1};let t=!1;if(D(e,i,`type`)){let r=E(e,i+4,n),a=e.charCodeAt(r);(a===39||a===34||hn(e,r,n)!==null)&&!D(e,r,`as`)&&(t=!0,i=r)}let a,o=e.charCodeAt(i);if(o===39||o===34){let t=sn(e,i,n,o);a=e.slice(i+1,t-1),i=t}else{let t=hn(e,i,n);if(!t)return null;a=t.name,i=t.end}i=E(e,i,n);let s=a;if(D(e,i,`as`)){i=E(e,i+2,n);let t=hn(e,i,n);if(!t)return null;s=t.name,i=E(e,t.end,n)}r.push({imported:a,local:s,typeOnly:t});let c=e.charCodeAt(i);if(c===44){i++;continue}return c===125?{named:r,end:i+1}:null}}function vn(e,t,n){let r=E(e,t+6,n);if(r>=n)return null;let i=e.charCodeAt(r);if(i===40||i===46)return null;if(i===39||i===34){let i=un(e,r,n);return i?{start:t,end:gn(e,i.end,n),source:i.source,typeOnly:!1,sideEffectOnly:!0,defaultBinding:null,namespaceBinding:null,named:[]}:null}let a=!1;if(D(e,r,`type`)){let t=E(e,r+4,n);!D(e,t,`from`)&&e.charCodeAt(t)!==44&&(a=!0,r=t)}let o=null,s=null,c=[],l=e.charCodeAt(r);if(l!==123&&l!==42){let t=hn(e,r,n);if(!t)return null;o=t.name,r=E(e,t.end,n),e.charCodeAt(r)===44?(r=E(e,r+1,n),l=e.charCodeAt(r)):l=-1}if(l===42){if(r=E(e,r+1,n),!D(e,r,`as`))return null;r=E(e,r+2,n);let t=hn(e,r,n);if(!t)return null;s=t.name,r=t.end}else if(l===123){let t=_n(e,r,n);if(!t)return null;c=t.named,r=t.end}if(r=E(e,r,n),!D(e,r,`from`))return null;let u=un(e,r+4,n);return u?{start:t,end:gn(e,u.end,n),source:u.source,typeOnly:a,sideEffectOnly:!1,defaultBinding:o,namespaceBinding:s,named:c}:null}function yn(e){let t=[],n=0,r=e.length;for(;n<r;){let i=Mn(e,n,r);if(i!==-1){n=i;continue}if(D(e,n,`import`)){let i=vn(e,n,r);if(i){t.push(i),n=i.end;continue}n+=6;continue}n++}return t}function bn(e){let t=/* @__PURE__ */ new Set,n=0,r=e.length;for(;n<r;){let i=Mn(e,n,r);if(i!==-1){n=i;continue}if(!D(e,n,`export`)){n++;continue}let a=E(e,n+6,r);if(D(e,a,`type`)||D(e,a,`interface`)){n=a+1;continue}if(e.charCodeAt(a)===42){let i=E(e,a+1,r);if(D(e,i,`as`)){i=E(e,i+2,r);let a=hn(e,i,r);a&&t.add(a.name),n=a?.end??i+1}else n=a+1;continue}if(D(e,a,`default`)){t.add(`default`),n=a+7;continue}if(e.charCodeAt(a)===123){let i=xn(e,a,r),o=e.slice(a+1,i-1);for(let e of o.split(`,`)){let n=e.trim();if(!n||n.startsWith(`type `)||n.startsWith(`typeof `))continue;let r=(n.split(/\s+as\s+/).at(-1)??``).trim();r!==``&&r!==`type`&&t.add(r)}n=i;continue}if(D(e,a,`async`)&&(a=E(e,a+5,r)),D(e,a,`function`)||D(e,a,`class`)||D(e,a,`const`)||D(e,a,`let`)||D(e,a,`var`)){let i=D(e,a,`function`)?8:D(e,a,`class`)||D(e,a,`const`)?5:3,o=E(e,a+i,r);e.charCodeAt(o)===42&&(o=E(e,o+1,r));let s=hn(e,o,r);s&&t.add(s.name),n=s?.end??o+1;continue}n++}return[...t]}function xn(e,t,n){let r=t,i=0;for(;r<n;){let t=e.charCodeAt(r);if(t===39||t===34||t===96){r=sn(e,r,n,t);continue}if(t===47&&e.charCodeAt(r+1)===47){r=an(e,r,n);continue}if(t===47&&e.charCodeAt(r+1)===42){r=on(e,r,n);continue}if(t===123){i++,r++;continue}if(t===125){if(i--,r++,i===0)return r;continue}r++}return r}function Sn(e){return mn(e).topLevelUseServer}function Cn(e){return mn(e).hasDefaultExport}function wn(e){return e===40||e===91||e===123||e===44||e===59||e===61||e===58||e===63||e===33||e===43||e===45||e===42||e===37||e===38||e===124||e===94||e===126||e===60||e===62}function Tn(e,t){let n=t-1;for(;n>=0;){let t=e.charCodeAt(n);if(en(t)){n--;continue}if(n>=1&&t===47&&e.charCodeAt(n-1)===42){for(n-=2;n>=1;){if(e.charCodeAt(n)===42&&e.charCodeAt(n-1)===47){n-=2;break}n--}if(n<0)return;continue}if(n>=1&&t===47&&e.charCodeAt(n-1)===47){n-=2;continue}let r=n;for(;r>=0&&e.charCodeAt(r)!==10&&e.charCodeAt(r)!==13;)r--;let i=r+1;for(;i<n&&(e.charCodeAt(i)===32||e.charCodeAt(i)===9);)i++;if(i<n&&e.charCodeAt(i)===47&&e.charCodeAt(i+1)===47){n=i-1;continue}break}if(n<0||!T(e.charCodeAt(n)))return;let r=n;for(;n>=0&&T(e.charCodeAt(n));)n--;return e.slice(n+1,r+1)}function En(e,t){let n=t-1;for(;n>=0;){let t=e.charCodeAt(n);if(en(t)){n--;continue}if(n>=1&&t===47&&e.charCodeAt(n-1)===42){for(n-=2;n>=1;){if(e.charCodeAt(n)===42&&e.charCodeAt(n-1)===47){n-=2;break}n--}if(n<0)return-1;continue}if(n>=1&&t===47&&e.charCodeAt(n-1)===47){n-=2;continue}let r=n;for(;r>=0&&e.charCodeAt(r)!==10&&e.charCodeAt(r)!==13;)r--;let i=r+1;for(;i<n&&(e.charCodeAt(i)===32||e.charCodeAt(i)===9);)i++;if(i<n&&e.charCodeAt(i)===47&&e.charCodeAt(i+1)===47){n=i-1;continue}return t}return-1}function Dn(e,t){let n=En(e,t);if(n===-1||wn(n))return!0;let r=Tn(e,t);return r!=null&&r!==``&&Zt.has(r)}const On=/* @__PURE__ */ new Set([`return`,`throw`,`case`,`default`,`else`,`do`,`typeof`,`void`,`yield`,`await`,`delete`]);function kn(e,t){let n=En(e,t);if(n===-1)return!0;if(T(n)||n>=48&&n<=57){let n=Tn(e,t);return n!=null&&n!==``&&On.has(n)}return n!==41&&n!==93&&n!==125}function An(e,t,n){if(!kn(e,t))return-1;let r=e.charCodeAt(t+1);if(r!==47&&r!==46&&r!==62&&!nn(r))return-1;let i=cn(e,t,n);return i<n&&e.charCodeAt(i)===62&&i++,i>t&&e.charCodeAt(i-1)===62?i:-1}function jn(e,t,n){t++;let r=!1;for(;t<n;){let i=e.charCodeAt(t);if(i===92){t+=2;continue}if(r){i===93&&(r=!1),t++;continue}if(i===91){r=!0,t++;continue}if(i===47){for(t++;t<n&&T(e.charCodeAt(t));)t++;return t}if(tn(i))return t;t++}return t}function Mn(e,t,n){if(t>=n)return-1;let r=e.charCodeAt(t);if(en(r))return t+1;if(r===47&&e.charCodeAt(t+1)===47)return an(e,t,n);if(r===47&&e.charCodeAt(t+1)===42)return on(e,t,n);if(r===39||r===34||r===96)return sn(e,t,n,r);if(r===47&&e.charCodeAt(t+1)!==47&&e.charCodeAt(t+1)!==42&&Dn(e,t))return jn(e,t,n);if(r===60){let r=An(e,t,n);if(r!==-1)return r}return-1}function Nn(e,t){let n=e.charCodeAt(t);return en(n)?!0:n===47&&(e.charCodeAt(t+1)===47||e.charCodeAt(t+1)===42)}function Pn(e){let t=e.length,n=0;for(;n<t;){let r=Mn(e,n,t);if(r!==-1){n=r;continue}if(D(e,n,`export`)){let r=E(e,n+6,t);if(!D(e,r,`default`)){n++;continue}let i=E(e,r+7,t),a=i,o=null;if(D(e,a,`async`)){let n=E(e,a+5,t);D(e,n,`function`)&&(a=n)}if(D(e,a,`function`)||D(e,a,`class`)){let n=D(e,a,`function`)?8:5,r=E(e,a+n,t);e.charCodeAt(r)===42&&(r=E(e,r+1,t));let i=hn(e,r,t);i&&(o=i.name)}let s=Ln(e,i,t),c=gn(e,s,t);return{exportStart:n,valueStart:i,valueEnd:s,statementEnd:c,bindingName:o}}n++}return null}function Fn(e,t,n){if(t>=n)return!1;let r=e.charCodeAt(t),i=t+1<n?e.charCodeAt(t+1):-1;return r===46||r===63&&i===46||r===40||r===91||r===96||r===61&&i===62||r===43||r===45||r===42||r===47||r===37||r===38||r===124||r===94||r===60||r===62||r===61||r===33||r===63||r===58||r===44||r===126||D(e,t,`instanceof`)||D(e,t,`in`)||D(e,t,`of`)||D(e,t,`as`)}const In=/* @__PURE__ */ new Set([`typeof`,`void`,`delete`,`await`,`yield`,`new`]);function Ln(e,t,n){let r=t,i=0,a=0,o=0,s=!1;for(;r<n;){let t=e.charCodeAt(r);if(t===39||t===34||t===96){r=sn(e,r,n,t),s=!0;continue}if(t===47&&e.charCodeAt(r+1)===47){r=an(e,r,n);continue}if(t===47&&e.charCodeAt(r+1)===42){r=on(e,r,n);continue}if(t===47&&e.charCodeAt(r+1)!==47&&e.charCodeAt(r+1)!==42&&Dn(e,r)){r=jn(e,r,n),s=!0;continue}if(t===60&&i===0&&a===0&&o===0){let t=An(e,r,n);if(t!==-1){r=t,s=!0;continue}}if(t===40){i++,s=!1,r++;continue}if(t===41){i=Math.max(0,i-1),s=!0,r++;continue}if(t===123){a++,s=!1,r++;continue}if(t===125){if(a=Math.max(0,a-1),s=!0,r++,i===0&&a===0&&o===0)return r;continue}if(t===91){o++,s=!1,r++;continue}if(t===93){o=Math.max(0,o-1),s=!0,r++;continue}if(i===0&&a===0&&o===0){if(t===59)return r;if(tn(t)){let t=E(e,r+1,n);if(!s||Fn(e,t,n)){r++;continue}return r}}if(nn(t)){let t=hn(e,r,n);if(t){s=!In.has(t.name),r=t.end;continue}}if(t>=48&&t<=57){for(s=!0,r++;r<n;){let t=e.charCodeAt(r);if(t>=48&&t<=57||t===46||t===110||t===101||t===69){r++;continue}break}continue}if(t===61&&e.charCodeAt(r+1)===62){s=!1,r+=2;continue}if(t===46||t===44||t===58||t===63||t===61||t===43||t===45||t===42||t===47||t===37||t===38||t===124||t===94||t===33||t===126||t===60||t===62){s=!1,r++;continue}r++}return r}function Rn(e,t){let n=Pn(e);if(n==null||n.bindingName!=null)return null;let r=`const ${t} = ${e.slice(n.valueStart,n.valueEnd).trimEnd()};\nexport default ${t}${e.slice(n.statementEnd)}`;return e.slice(0,n.exportStart)+r}const zn=/* @__PURE__ */ new Set([`node_modules`,`.git`,`.cache`,`dist`]);function Bn(e,t){let n=/* @__PURE__ */ new Set,r=e=>{if(!b.existsSync(e))return;let i=b.readdirSync(e,{withFileTypes:!0});for(let a of i){let i=S.join(e,a.name);if(a.isDirectory()){if(zn.has(a.name))continue;r(i)}else if(a.isFile()&&v.test(a.name)){if(n.has(i))continue;n.add(i),t(i)}}};for(let t of e)t&&b.existsSync(t)&&r(t)}function Vn(e){let t=[];return Bn(e,e=>{t.push(e)}),t}function Hn(e,t=[]){let n=[e],r=S.resolve(e);for(let e of t){if(!e)continue;let t=S.resolve(e);if(t===r)continue;let i=S.relative(r,t);if(i!==``&&(i.startsWith(`..`)||S.isAbsolute(i)))try{b.statSync(e).isDirectory()&&n.push(e)}catch{}}return n}const Un=new Set(Te);function Wn(e){return Un.has(e)}function Gn(e){for(let t of e.importSources)if(t.startsWith(`node:`)||Wn(t))return!0;return!1}function Kn(e,t=Un){let n=[];for(let r of e)!r.startsWith(`.`)&&!r.startsWith(`/`)&&!r.startsWith(`@/`)&&!r.startsWith(`node:`)&&!t.has(r)&&n.push(r);return[...new Set(n)]}function qn(e){let t=[];for(let n of e)(n.startsWith(`./`)||n.startsWith(`../`)||n.startsWith(`@/`))&&t.push(n);return t}function Jn(e){try{return b.realpathSync(e)}catch{return S.resolve(e)}}function Yn(e,t){e.delete(t);try{e.delete(b.realpathSync(t))}catch{e.delete(S.resolve(t))}}function Xn(e,t){let n=[];for(let r of Vn(e))try{t.get(r).directives.hasUseClient&&n.push(r)}catch{}return n}var Zn=class{cache=/* @__PURE__ */ new Map;get(e,t){let n=Jn(e),r=this.cache.get(n);if(t!==void 0){if(r?.source===t)return r.analysis}else if(r){let e=this.readMtimeMs(n);if(e>=0&&r.mtimeMs===e)return r.analysis}t??=b.readFileSync(n,`utf-8`);let i=this.readMtimeMs(n),a=mn(t);return this.cache.set(n,{mtimeMs:i,source:t,analysis:a}),a}getSource(e){return this.get(e),this.cache.get(Jn(e)).source}invalidate(e){Yn(this.cache,e)}clear(){this.cache.clear()}readMtimeMs(e){try{return b.statSync(e).mtimeMs}catch{return-1}}};function Qn(e){return e.code===`MODULE_LEVEL_DIRECTIVE`&&(e.message?.includes(`use client`)===!0||e.message?.includes(`use server`)===!0)}function $n(){return{name:`rari:silence-react-directive-logs`,onLog(e,t){return!Qn(t)&&void 0}}}const er=`virtual:rari-entry-client`,tr=/^layout\.(?:tsx|ts|jsx|js)$/,nr=/\.css(?:\?.*)?$/,rr=/* @__PURE__ */ new Set;function ir(){rr.clear()}function ar(e){let t=e.trim();t!==``&&rr.add(t)}function or(){return[...rr]}function sr(e,t,n,r){let i=e.replace(/[?#].*$/,``);if(!nr.test(i))return null;if(i.startsWith(`./`)||i.startsWith(`../`)){let e=S.resolve(S.dirname(t),i);return!b.existsSync(e)||!b.statSync(e).isFile()?null:e}let a=xe(i,r,n);return a!=null&&a!==``&&b.existsSync(a)&&b.statSync(a).isFile()?a:i}function cr(e,t,n,r){if(b.existsSync(e))for(let i of b.readdirSync(e,{withFileTypes:!0})){let a=S.join(e,i.name);if(i.isDirectory()){cr(a,t,n,r);continue}if(!i.isFile()||!tr.test(i.name))continue;let o=b.readFileSync(a,`utf-8`);for(let e of yn(o)){let i=sr(e.source,a,t,n);i!=null&&r.add(i)}}}function lr(e,t={}){let n=/* @__PURE__ */ new Set;return cr(S.join(e,`src`,`app`),e,t,n),n}function ur(e,t){if(!S.isAbsolute(e))return e.startsWith(`/`)?e:`/${e}`;let n=y(S.relative(t,e));return n.startsWith(`..`)||S.isAbsolute(n)?`/@fs/${e}`:`/${n}`}function dr(e,t={}){return[...lr(e,t)].sort().map(t=>ur(t,e))}function fr(e,t){if(!S.isAbsolute(e))return e;let n=y(S.relative(t,e));return n.startsWith(`..`)||S.isAbsolute(n)?e:`/${n}`}function pr(e,t={}){return[...lr(e,t)].sort().map(t=>`import ${JSON.stringify(fr(t,e))};`).join(`
|
|
52
|
-
`)}function
|
|
53
|
-
`)}\n`:``}function
|
|
54
|
-
`),r
|
|
55
|
-
`,r}function Ir(e,t,n,r=`sans-serif`){let i=[`"${jr(e)}"`];n&&i.push(`"${jr(`${e} Fallback`)}"`);for(let e of t??[])i.push(e.includes(` `)?`"${jr(e)}"`:e);return Ar(t)||i.push(r),i.join(`, `)}function Lr(e){return e??`swap`}function Rr(e){return e==null?`400`:String(e)}function zr(e){return e??`normal`}const Br=/* @__PURE__ */ new Map,Vr=/* @__PURE__ */ new Map;function Hr(e){return!l(e)||!Array.isArray(e.familyMetadataList)?!1:e.familyMetadataList.every(e=>l(e)&&typeof e.family==`string`&&e.family!==``)}function Ur(e){let t=e.replace(/^\)\]\}'\n?/,``);return JSON.parse(t)}function Wr(e){return[...new Set(e)].sort((e,t)=>e.localeCompare(t))}function Gr(e){let t=Wr((e.subsets??[]).filter(e=>e!==`menu`&&e!==``)),n=(e.axes??[]).filter(e=>typeof e.tag==`string`&&e.tag!==``&&typeof e.min==`number`&&typeof e.max==`number`).map(e=>({tag:e.tag,min:e.min,max:e.max})).sort((e,t)=>e.tag.localeCompare(t.tag));return{family:e.family,subsets:t,axisRanges:n}}function Kr(e){if(!Hr(e))throw Error(`Unexpected fonts.google.com/metadata/fonts shape`);let t=/* @__PURE__ */ new Map;for(let n of e.familyMetadataList){let e=Gr(n);t.set(e.family,e)}return t}async function qr(e){let t=Br.get(e);if(t!=null)return t;let n=Vr.get(e);if(n!=null)return n;let r=Promise.resolve().then(async()=>{let t=S.join(e,`google-fonts-metadata.json`);if(b.existsSync(t))try{let n=Kr(Ur(b.readFileSync(t,`utf8`)));return Br.set(e,n),n}catch{try{b.unlinkSync(t)}catch{}}let n=await fetch(`https://fonts.google.com/metadata/fonts`,{headers:{"User-Agent":`rari-google-font-meta`},signal:AbortSignal.timeout(3e4)});if(!n.ok)throw Error(`Failed to fetch Google font metadata: ${n.status} ${n.statusText}`);let r=await n.text(),i=Kr(Ur(r));return Sr(e),b.writeFileSync(t,r.replace(/^\)\]\}'\n?/,``)),Br.set(e,i),i});return Vr.set(e,r),r.finally(()=>{Vr.get(e)===r&&Vr.delete(e)})}async function Jr(e,t){try{return(await qr(e)).get(t)??null}catch(e){return console.warn(`[rari/font] Failed to load Google font metadata for ${t}:`,e),null}}function Yr(e,t,n){let r=t.subsets!=null&&t.subsets.length>0,i=r?t.preload!==!1:t.preload===!0,a=t.subsets;if(i&&!r&&console.warn(`[rari/font] ${e}: \`preload\` is true but no \`subsets\` were specified. Specify subsets to avoid downloading unused glyphs, or set \`preload: false\`.`),a==null||a.length===0||n==null||n.length===0)return;let o=new Set(n.map(e=>e.toLowerCase())),s=[...new Set(a.map(e=>e.toLowerCase())).difference(o)];s.length!==0&&console.warn(`[rari/font] ${e}: unknown subset(s) ${s.map(e=>JSON.stringify(e)).join(`, `)}. Available: ${n.join(`, `)}`)}const Xr=1e4,Zr=/* @__PURE__ */ new Set([`fonts.gstatic.com`]);function Qr(e){let t=URL.parse(e);if(t==null)throw Error(`Invalid Google font URL: ${e}`);if(t.protocol!==`https:`)throw Error(`Google font URL must use HTTPS: ${e}`);if(!Zr.has(t.hostname))throw Error(`Google font URL host not allowlisted (${t.hostname}): ${e}. Allowed: ${[...Zr].join(`, `)}`);return t}function $r(e){return e.subsets!=null&&e.subsets.length>0?e.preload!==!1:e.preload===!0}function ei(e){return e.trim().replaceAll(` `,`+`)}function ti(e){if(e==null)return[`400`];if(Array.isArray(e)){let t=e.map(String);return t.length>0?t:[`400`]}return[String(e)]}const ni=/^(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)$/;function ri(e){return ni.test(e.trim())}function ii(e){return e===`variable`||typeof e==`string`&&ri(e)?!0:Array.isArray(e)?e.some(e=>e===`variable`||typeof e==`string`&&ri(e)):!1}function ai(e){if(typeof e==`string`){let t=ni.exec(e.trim());if(t!=null)return`${t[1]}..${t[2]}`}if(Array.isArray(e))for(let t of e){if(typeof t!=`string`)continue;let e=ni.exec(t.trim());if(e!=null)return`${e[1]}..${e[2]}`}return`100..900`}function oi(e,t){if(e==null)return null;let n=e.find(e=>e.tag===t);return n==null?null:`${n.min}..${n.max}`}function si(e,t){if(ii(e)){if(typeof e==`string`&&ri(e))return ai(e);if(Array.isArray(e)){for(let t of e)if(typeof t==`string`&&ri(t))return ai(t)}return oi(t,`wght`)??ai(e)}if(e!=null){let t=ti(e);if(t.length===1)return`${t[0]}..${t[0]}`}return oi(t,`wght`)??`100..900`}function ci(e){if(e==null)return[`normal`];if(typeof e==`string`)return[e];let t=e.filter(e=>e!==``);return t.length>0?[...t]:[`normal`]}function li(e){let t=(e.axes??[]).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t)n.includes(e)||n.push(e);return n}function ui(e){return e==null||ii(e)?null:ti(e)}function di(e,t,n){let r=ei(e),i=Lr(t.display),a=ci(t.style),o=a.includes(`italic`),s=a.includes(`normal`)||!o,c=li(t),l=ii(t.weight)||c.length>0,u;if(l){let e=[`wght`,...c.filter(e=>e!==`wght`&&e!==`ital`)].sort((e,t)=>e.localeCompare(t)),r=ui(t.weight),i=(e,t)=>e===`wght`?t:oi(n,e)??`1..1000`;if(r!=null){let t=r.map(t=>e.map(e=>i(e,t)).join(`,`));u=o&&s?`ital,${e.join(`,`)}@${[...t.map(e=>`0,${e}`),...t.map(e=>`1,${e}`)].join(`;`)}`:o?`ital,${e.join(`,`)}@${t.map(e=>`1,${e}`).join(`;`)}`:e.length===1&&e[0]===`wght`?`wght@${r.join(`;`)}`:`${e.join(`,`)}@${t.join(`;`)}`}else{let r=si(t.weight,n),a=e.map(e=>i(e,r));u=o&&s?`ital,${e.join(`,`)}@0,${a.join(`,`)};1,${a.join(`,`)}`:o?`ital,${e.join(`,`)}@1,${a.join(`,`)}`:e.length===1&&e[0]===`wght`?`wght@${a[0]}`:`${e.join(`,`)}@${a.join(`,`)}`}}else{let e=ti(t.weight);u=o&&s?`ital,wght@${[...e.map(e=>`0,${e}`),...e.map(e=>`1,${e}`)].join(`;`)}`:o?`ital,wght@${e.map(e=>`1,${e}`).join(`;`)}`:`wght@${e.join(`;`)}`}return`https://fonts.googleapis.com/css2?family=${r}:${u}&display=${i}`}function fi(e){let t=[],n=e.split(`@font-face`);for(let e=1;e<n.length;e+=1){let r=n[e-1]??``,i=n[e]??``,a=i.indexOf(`{`),o=i.indexOf(`}`,a);if(a===-1||o===-1)continue;let s=i.slice(a+1,o),c=/\/\*\s*([\w-]+)\s*\*\/\s*$/.exec(r)?.[1]??null,l=/font-family:\s*'([^']+)'/.exec(s)?.[1]??/font-family:\s*"([^"]+)"/.exec(s)?.[1],u=/font-style:\s*([^;\s]+)\s*;/.exec(s)?.[1]??`normal`,d=/font-weight:([^;]+);/.exec(s)?.[1]?.trim()??`400`,f=/src:\s*url\(([^)]+)\)/.exec(s)?.[1]?.replaceAll(/['"]/g,``),p=/unicode-range:([^;]+);/.exec(s)?.[1]?.trim()??null;l!=null&&f!=null&&f!==``&&t.push({family:l,style:u,weight:d,url:f,subset:c,unicodeRange:p})}return t}function pi(e,t){if(t==null||t.length===0)return[...e];let n=new Set(t.map(e=>e.toLowerCase()));return e.filter(e=>e.subset!=null&&n.has(e.subset.toLowerCase()))}async function mi(e,t){if(b.existsSync(t))return b.readFileSync(t);let n=Qr(e).href,r=null;for(let e=0;e<=3;e+=1){let e=await fetch(n,{signal:AbortSignal.timeout(Xr),redirect:`manual`});if(e.status>=300&&e.status<400){let t=e.headers.get(`location`);if(t==null||t===``)throw Error(`Font download redirect missing Location from ${n}`);n=Qr(new URL(t,n).href).href;continue}r=e;break}if(r==null)throw Error(`Too many redirects downloading font ${e}`);if(!r.ok)throw Error(`Failed to download font ${e}: ${r.status} ${r.statusText}`);let i=Buffer.from(await r.arrayBuffer());return Sr(S.dirname(t)),b.writeFileSync(t,i),i}async function hi(e,t,n){let r=await Jr(n,e);Yr(e,t,r?.subsets);let i=di(e,t,r?.axisRanges),a=S.join(n,`${qt(i)}.css`),o;if(b.existsSync(a))o=b.readFileSync(a,`utf8`);else{let t=await fetch(i,{headers:{"User-Agent":`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`},signal:AbortSignal.timeout(Xr)});if(!t.ok)throw Error(`Failed to fetch Google Font CSS for ${e}: ${t.status} ${t.statusText}`);o=await t.text(),Sr(n),b.writeFileSync(a,o)}let s=pi(fi(o),t.subsets);if(s.length===0)throw Error(`No @font-face rules returned for Google font "${e}"`);let c=Lr(t.display),l=$r(t),u=[];for(let r of s){let i=Qr(r.url),a=qt(r.url),o=S.extname(i.pathname)||`.woff2`,s=`${e.replaceAll(/\s+/g,``)}-${r.weight}-${r.style}-${a}${o}`,d=S.join(n,s);await mi(r.url,d),u.push({family:r.family,style:zr(r.style),weight:Rr(r.weight),display:c,src:[{url:``,format:Nr(d)}],preload:l,variable:t.variable,fallback:t.fallback,adjustFontFallback:t.adjustFontFallback!==!1&&void 0,unicodeRange:r.unicodeRange??void 0,filePaths:[d]})}return u}function gi(e){return e.replaceAll(`_`,` `)}function _i(e){return typeof e==`string`?[{path:e}]:e.map(e=>({...e}))}function vi(e,t,n){let r=Lr(e.display),i=e.preload!==!1,a=_i(e.src);if(a.length===0)throw Error("rari/font/local: `src` must include at least one font file");let o=a.map(r=>{let i=S.isAbsolute(r.path)?r.path:S.resolve(t,r.path);if(!b.existsSync(i))throw Error(`rari/font/local: font file not found: ${r.path} (from ${t})`);let a=S.relative(n,i);if(a.startsWith(`..`)||S.isAbsolute(a))throw Error(`rari/font/local: font file must be inside the project: ${r.path}`);return{absolute:i,weight:Rr(r.weight??e.weight),style:zr(r.style??e.style),familyBase:S.basename(i,S.extname(i))}}),s=o[0].familyBase;return o.map(t=>({family:s,style:t.style,weight:t.weight,display:r,src:[{url:``,format:Nr(t.absolute)}],preload:i,variable:e.variable,fallback:e.fallback,adjustFontFallback:e.adjustFontFallback,declarations:e.declarations,filePaths:[t.absolute]}))}function yi(e,t){if(e[t]!==`{`)return null;try{let{json:n,end:r}=xi(e,t);return typeof n!=`object`||!n||Array.isArray(n)?null:{value:n,end:r}}catch{return null}}function bi(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]??``);)n+=1;return n}function xi(e,t){let n=bi(e,t),r=e[n];if(r===`{`)return Ti(e,n);if(r===`[`)return wi(e,n);if(r===`'`||r===`"`)return Si(e,n);if(r===`-`||r>=`0`&&r<=`9`)return Ci(e,n);if(e.startsWith(`true`,n))return{json:!0,end:n+4};if(e.startsWith(`false`,n))return{json:!1,end:n+5};if(e.startsWith(`null`,n))return{json:null,end:n+4};throw Error(`Unsupported token at ${n}`)}function Si(e,t){let n=e[t],r=t+1,i=``;for(;r<e.length;){let t=e[r];if(t===`\\`){if(r+1>=e.length)throw Error(`Unterminated string escape`);i+=e[r+1],r+=2;continue}if(t===n)return{json:i,end:r+1};i+=t,r+=1}throw Error(`Unterminated string`)}function Ci(e,t){let n=/^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/i.exec(e.slice(t));if(n==null)throw Error(`Invalid number`);return{json:Number(n[0]),end:t+n[0].length}}function wi(e,t){let n=[],r=bi(e,t+1);if(e[r]===`]`)return{json:n,end:r+1};for(;r<e.length;){let t=xi(e,r);if(n.push(t.json),r=bi(e,t.end),e[r]===`,`){if(r=bi(e,r+1),e[r]===`]`)return{json:n,end:r+1};continue}if(e[r]===`]`)return{json:n,end:r+1};throw Error(`Expected comma or ]`)}throw Error(`Unterminated array`)}function Ti(e,t){let n={},r=bi(e,t+1);if(e[r]===`}`)return{json:n,end:r+1};for(;r<e.length;){let t;if(e[r]===`'`||e[r]===`"`){let n=Si(e,r);t=n.json,r=bi(e,n.end)}else{let n=/^[A-Z_$][\w$]*/i.exec(e.slice(r));if(n==null)throw Error(`Expected property name`);t=n[0],r=bi(e,r+t.length)}if(e[r]!==`:`)throw Error(`Expected :`);let i=xi(e,r+1);if(n[t]=i.json,r=bi(e,i.end),e[r]===`,`){if(r=bi(e,r+1),e[r]===`}`)return{json:n,end:r+1};continue}if(e[r]===`}`)return{json:n,end:r+1};throw Error(`Expected comma or }`)}throw Error(`Unterminated object`)}const Ei=`rari/font/local`,Di=`rari/font/google`,Oi=`\0rari-font-css:`,ki=/\.(?:woff2?|ttf|otf)$/i;function Ai(e){if(e!=null){if(typeof e==`string`)return[e];if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}}function ji(e){if(e===`auto`||e===`block`||e===`swap`||e===`fallback`||e===`optional`)return e}function Mi(e){let t=e.src,n;if(typeof t==`string`)n=t;else if(Array.isArray(t))n=t.map(e=>{if(typeof e==`string`)return{path:e};if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`rari/font/local: invalid src entry`);let t=e.path;if(typeof t!=`string`)throw Error(`rari/font/local: src.path must be a string`);return{path:t,weight:typeof e.weight==`string`||typeof e.weight==`number`?e.weight:void 0,style:typeof e.style==`string`?e.style:void 0}});else throw TypeError("rari/font/local: `src` is required");return{src:n,display:ji(e.display),weight:typeof e.weight==`string`||typeof e.weight==`number`?e.weight:void 0,style:typeof e.style==`string`?e.style:void 0,variable:typeof e.variable==`string`?e.variable:void 0,preload:typeof e.preload==`boolean`?e.preload:void 0,fallback:Ai(e.fallback),adjustFontFallback:e.adjustFontFallback===!1?!1:e.adjustFontFallback===`Arial`||e.adjustFontFallback===`Times New Roman`?e.adjustFontFallback:void 0,declarations:Ni(e.declarations)}}function Ni(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(typeof n!=`object`||!n||Array.isArray(n))continue;let e=n.prop,r=n.value;typeof e==`string`&&typeof r==`string`&&t.push({prop:e,value:r})}return t.length>0?t:void 0}function Pi(e){let t=e.weight,n=e.style;return{weight:typeof t==`string`||typeof t==`number`?t:Array.isArray(t)?t.filter(e=>typeof e==`string`||typeof e==`number`):void 0,style:typeof n==`string`?n:Array.isArray(n)?n.filter(e=>typeof e==`string`):void 0,subsets:Ai(e.subsets),display:ji(e.display),variable:typeof e.variable==`string`?e.variable:void 0,preload:typeof e.preload==`boolean`?e.preload:void 0,fallback:Ai(e.fallback),adjustFontFallback:typeof e.adjustFontFallback==`boolean`?e.adjustFontFallback:void 0,axes:Ai(e.axes)}}function Fi(e,t){let n=0;for(let r=t;r<e.length;r+=1){let t=e[r];if(t===`(`)n+=1;else if(t===`)`&&(--n,n===0))return r}return-1}async function Ii(e,t,n){let r=[],i=[],a=[];for(let o of e){if(o.filePaths.length===0)continue;let e=o.filePaths[0],s=b.readFileSync(e),c=qt(s);a.push(c);let l=br(e,c,t);r.push({fileName:l,source:s}),i.push({...o,family:n,src:[{url:xr(l),format:o.src[0]?.format??`woff2`}]})}if(i.length===0)throw Error(`rari/font: no font files resolved`);let o=i[0],s=JSON.stringify({display:o.display,weight:i.map(e=>e.weight),style:i.map(e=>e.style),fallback:o.fallback??null,adjustFontFallback:o.adjustFontFallback??null,declarations:o.declarations??null,unicodeRange:i.map(e=>e.unicodeRange??null),variable:o.variable??null}),c=qt(`${a.join(`|`)}|${n}|${s}`),l=Cr(`rari_font`,c),u=o.variable==null?null:Cr(`rari_font_var`,c),d=null,f=await Er(n);if(o.adjustFontFallback!==!1){let e=o.adjustFontFallback===`Arial`||o.adjustFontFallback===`Times New Roman`?o.adjustFontFallback:null;if(f==null)try{let e=await Pe(b.readFileSync(o.filePaths[0]));f={ascent:e.ascent,descent:e.descent,lineGap:e.lineGap,unitsPerEm:e.unitsPerEm,xWidthAvg:e.xWidthAvg}}catch{f=null}f!=null&&(e??=Dr(f.category),d=Tr(f,e))}let p=``;for(let e of i)p+=Fr(e);d!=null&&(p+=`@font-face {\n font-family: "${n} Fallback";\n src: local("${d.fallbackFont}");\n ascent-override: ${d.ascentOverride};\n descent-override: ${d.descentOverride};\n line-gap-override: ${d.lineGapOverride};\n size-adjust: ${d.sizeAdjust};\n}\n`);let m=Ir(n,o.fallback,d!=null,kr(f?.category));p+=`.${l} {\n font-family: ${m};\n}\n`,o.variable!=null&&u!=null&&(p+=`.${u} {\n ${o.variable}: ${m};\n}\n`);let h=Number(o.weight),g={className:l,style:{fontFamily:m,fontWeight:Number.isFinite(h)?h:o.weight,fontStyle:o.style===`normal`?void 0:o.style},variable:u??void 0},_=i.filter(e=>e.preload).flatMap(e=>e.src.map(e=>e.url)).filter(e=>e!==``);return{font:g,css:p,cssId:`${Oi}${c}.css`,assets:r,preloadUrls:_}}function Li(e){let t=[];for(let n=0;n<e.length;n+=1)t.push(!0);let n=(e,n)=>{for(let r=e;r<n;r+=1)t[r]=!1},r=0;for(;r<e.length;){let t=e.charCodeAt(r);if(t===47&&e.charCodeAt(r+1)===47){let t=r,i=e.indexOf(`
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
`,r+2);r=t===-1?e.length:t+1;continue}if(i===47&&e.charCodeAt(r+1)===42){let t=e.indexOf(`*/`,r+2);r=t===-1?e.length:t+2;continue}if(i===34||i===39||i===96){r=Ui(e,r);continue}if(Vi(i)&&e.startsWith(t,r)){let i=r+t.length,a=r===0?0:e.charCodeAt(r-1);if((r===0||!Hi(a))&&(i>=e.length||!Hi(e.charCodeAt(i)))){let t=i;for(;t<e.length&&(e[t]===` `||e[t]===` `||e[t]===`
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
`){n
|
|
62
|
-
|
|
63
|
-
`){n+=1;continue}break}r=n}return r===0?`${t}\n${e}`:`${e.slice(0,r)}${t}\n${e.slice(r)}`}function
|
|
64
|
-
• `);this.outputLog(t,`${n.length} updates:\n • ${e}`)}}this.logBatch=[],this.logBatchTimer=null}outputLog(e,t){let n=`[rari] HMR:`;switch(e){case`success`:console.warn(`\x1B[32m${n}\x1B[0m ${t}`);break;case`warning`:console.warn(`\x1B[33m${n}\x1B[0m ${t}`);break;case`error`:console.error(`\x1B[31m${n}\x1B[0m ${t}`);break;default:console.warn(`${n} ${t}`)}}dispose(){this.logBatchTimer&&(clearTimeout(this.logBatchTimer),this.flushLogs()),this.batchTimer&&=(clearTimeout(this.batchTimer),null);for(let e of this.pendingUpdates.values())clearTimeout(e);this.pendingUpdates.clear(),this.pendingFiles.clear(),this.errorHandler.dispose()}};function na(e,t){return e.readUInt16BE(t)}function ra(e,t){return e.readUInt32BE(t)}function ia(e,t){return e.readUInt32LE(t)}function aa(e){return e.length<24||e.toString(`ascii`,1,4)!==`PNG`?null:{width:ra(e,16),height:ra(e,20)}}function oa(e){if(e.length<10)return null;let t=e.toString(`ascii`,0,6);return t!==`GIF87a`&&t!==`GIF89a`?null:{width:e.readUInt16LE(6),height:e.readUInt16LE(8)}}function sa(e){if(e.length<4||e[0]!==255||e[1]!==216)return null;let t=2;for(;t+9<=e.length;){if(e[t]!==255){t+=1;continue}if(t+1>=e.length)return null;let n=e[t+1];if(t+=2,n>=192&&n<=195||n>=197&&n<=199||n>=201&&n<=203||n>=205&&n<=207){if(t+7>=e.length)return null;let n=na(e,t),r=e[t+7]??0,i=8+3*r;if(r<1||n<i||t+n>e.length)return null;let a=na(e,t+3),o=na(e,t+5);return o===0||a===0?null:{height:a,width:o}}if(n===217||n===218||t+1>=e.length)return null;let r=na(e,t);if(r<2)return null;t+=r}return null}function ca(e,t){return(e[t]??0)|(e[t+1]??0)<<8|(e[t+2]??0)<<16}function la(e){if(e.length<20||e.toString(`ascii`,0,4)!==`RIFF`||e.toString(`ascii`,8,12)!==`WEBP`)return null;let t=e.toString(`ascii`,12,16);if(t===`VP8X`&&e.length>=30)return{width:ca(e,24)+1,height:ca(e,27)+1};if(t===`VP8 `&&e.length>=30)return{width:e.readUInt16LE(26)&16383,height:e.readUInt16LE(28)&16383};if(t===`VP8L`&&e.length>=25){if(e[20]!==47)return null;let t=ia(e,21);return{width:(t&16383)+1,height:(t>>14&16383)+1}}return null}function ua(e,t,n){if(t+8>n)return null;let r=ra(e,t),i=e.toString(`ascii`,t+4,t+8),a=8;if(r===1){if(t+16>n)return null;r=Number(e.readBigUInt64BE(t+8)),a=16}else r===0&&(r=n-t);let o=t+r;return r<a||o>n?null:{type:i,headerSize:a,start:t,end:o}}function*da(e,t,n){let r=t;for(;r+8<=n;){let t=ua(e,r,n);if(t==null)return;yield t,r=t.end}}function fa(e,t){let n=t.start+t.headerSize;return n+4>t.end?null:{version:e[n]??0,flags:(e[n+1]??0)<<16|(e[n+2]??0)<<8|(e[n+3]??0),dataOffset:n+4}}function pa(e,t){let n=fa(e,t);return n==null||n.dataOffset+8>t.end?null:{width:ra(e,n.dataOffset),height:ra(e,n.dataOffset+4)}}function ma(e,t){let n=fa(e,t);return n==null?null:n.version===0?n.dataOffset+2>t.end?null:na(e,n.dataOffset):n.dataOffset+4>t.end?null:ra(e,n.dataOffset)}function ha(e,t){let n=fa(e,t);if(n==null||n.dataOffset+4>t.end)return null;let r=ra(e,n.dataOffset),i=n.dataOffset+4,a=/* @__PURE__ */ new Map,o=!!(n.flags&1);for(let s=0;s<r;s+=1){let r;if(n.version<1){if(i+2>t.end)return null;r=na(e,i),i+=2}else{if(i+4>t.end)return null;r=ra(e,i),i+=4}if(i+1>t.end)return null;let s=e[i]??0;i+=1;let c=[];for(let n=0;n<s;n+=1)if(o){if(i+2>t.end)return null;let n=na(e,i);i+=2,c.push(n&32767)}else{if(i+1>t.end)return null;let n=e[i]??0;i+=1,c.push(n&127)}a.set(r,c)}return a}function ga(e){for(let t of da(e,0,e.length))if(t.type===`meta`)return t;return null}function _a(e){if(e.length<12||e.toString(`ascii`,4,8)!==`ftyp`)return null;let t=ga(e);if(t==null)return null;let n=t.start+t.headerSize+4;if(n>t.end)return null;let r=null,i=/* @__PURE__ */ new Map,a=null,o=null;for(let s of da(e,n,t.end)){if(s.type===`pitm`){r=ma(e,s);continue}if(s.type===`iprp`)for(let t of da(e,s.start+s.headerSize,s.end))if(t.type===`ipco`){let n=1;for(let r of da(e,t.start+t.headerSize,t.end)){if(r.type===`ispe`){let t=pa(e,r);t!=null&&(i.set(n,t),o??=t)}n+=1}}else t.type===`ipma`&&(a=ha(e,t))}if(r!=null&&a!=null){let e=a.get(r);if(e!=null)for(let t of e){let e=i.get(t);if(e!=null)return e}}return o}function va(e){return e.length<4?null:e[0]===137&&e.toString(`ascii`,1,4)===`PNG`?aa(e):e[0]===255&&e[1]===216?sa(e):e.toString(`ascii`,0,3)===`GIF`?oa(e):e.toString(`ascii`,0,4)===`RIFF`?la(e):_a(e)}const ya=/\.(?:avif|gif|jpe?g|png|webp)$/i,ba=`\0rari-static-image:`,xa=/* @__PURE__ */ new Set([`raw`,`url`,`inline`,`no-inline`]);function Sa(e){let t=e.indexOf(`?`);return t===-1?[]:e.slice(t+1).split(`&`).map(e=>e.split(`=`)[0]??``).filter(Boolean)}function Ca(e){return Sa(e).includes(`rari-static-bypass`)}function wa(e){return Sa(e).some(e=>xa.has(e))}function Ta(e,t,n){return vr(e,t,n,{encodeBase:!0})}function Ea(e,t,n){return _r(e,t,n)}function Da(e,t,n){return`const src = ${JSON.stringify(e)};\nexport default {\n src,\n width: ${t},\n height: ${n},\n};\n`}function Oa(e){return ya.test(ue(e))&&!Ca(e)&&!wa(e)}function ka(e,t=`assets`){let n=b.readFileSync(e),r=qt(n),i=Ta(e,r,t),a=Ea(e,r,t),o=va(n);if(o==null)throw Error(`[rari] Unable to read dimensions for static image import: ${e}. Pass explicit width/height to <Image>, or convert the file to png/jpeg/webp/gif/avif.`);return{code:Da(i,o.width,o.height),publicPath:i,source:n,fileName:a}}const Aa=/* @__PURE__ */ new Map,ja=/* @__PURE__ */ new Map;function Ma(e,t){let n=Aa.get(e);if(n!=null)return n;let r=/* @__PURE__ */ new Map;if(b.existsSync(t))try{let e=d(b.readFileSync(t,`utf8`));if(e!=null)for(let[t,n]of Object.entries(e))typeof n==`string`&&r.set(t,n)}catch{}return Aa.set(e,r),r}function Na(e,t,n){for(let[r,i]of e)i===n&&r!==t&&e.delete(r);e.set(t,n)}function Pa(e,t){let n=new Set(t.values());for(let[r,i]of e){if(!b.existsSync(i)){e.delete(r);continue}n.has(i)&&t.get(r)!==i&&e.delete(r)}}function Fa(e){return S.join(e,`server`,`static-image-sources.json`)}function Ia(e,t){let r=Fa(e);if(t.size===0){try{b.unlinkSync(r)}catch(e){if(n(e)!==`ENOENT`)throw e}return}b.mkdirSync(S.dirname(r),{recursive:!0});let i=Object.fromEntries(t);b.writeFileSync(r,`${JSON.stringify(i,null,2)}\n`)}function La(e){ja.has(e)||ja.set(e,/* @__PURE__ */ new Map)}function Ra(e){let t=ja.get(e);if(t==null)return;let n=Ma(e,Fa(e));n.clear();for(let[e,r]of t)b.existsSync(r)&&n.set(e,r);Ia(e,n),ja.delete(e)}function za(e,t){let n=Ma(e,Fa(e));for(let[e,r]of t)n.set(e,r);let r=ja.get(e);if(r!=null){for(let[e,n]of t)Na(r,e,n);return}Pa(n,t),Ia(e,n)}function Ba(e,t){let n=!1;for(let[r,i]of e)i===t&&(e.delete(r),n=!0);return n}function Va(){let e=process.cwd(),t=S.join(e,`dist`),n=`assets`,r=!1,i=/* @__PURE__ */ new Map;return{name:`rari:static-image`,enforce:`pre`,configResolved(i){let a=Kt(i);e=a.projectRoot,t=a.outDir,n=a.assetsDir,r=i.command===`build`},buildStart(){r&&La(t)},async resolveId(e,t){if(t==null||t===``||!Oa(e))return null;let n=await this.resolve(e,t,{skipSelf:!0});if(n==null||n.id===``)return null;let r=ue(n.id);return b.existsSync(r)?ba+r:null},load(e){if(!e.startsWith(ba))return null;let r=e.slice(19),a=ka(r,n);return Na(i,a.publicPath,r),za(t,i),this.emitFile({type:`asset`,fileName:a.fileName,source:a.source}),a.code},watchChange(e,n){if(n.event!==`delete`)return;let r=ue(e);if(!Ba(i,r))return;let a=ja.get(t);a!=null&&Ba(a,r),za(t,i)},configureServer(e){e.middlewares.use((e,t,n)=>{let r=e.url?.split(`?`)[0];if(r==null||r===``){n();return}let a=r;try{a=decodeURIComponent(r)}catch{a=r}let o=i.get(r)??i.get(a);if(o==null||o===``){n();return}let s=S.extname(o).toLowerCase(),c=s===`.png`?`image/png`:s===`.gif`?`image/gif`:s===`.webp`?`image/webp`:s===`.avif`?`image/avif`:s===`.svg`?`image/svg+xml`:`image/jpeg`;t.setHeader(`Content-Type`,c),t.setHeader(`Cache-Control`,`no-cache`),b.createReadStream(o).on(`error`,()=>{t.headersSent||(t.statusCode=404),t.end()}).pipe(t)})}}}function Ha(e){let t=y(e);return t===`rari/mdx/registry`||t.startsWith(`rari/mdx/registry?`)?!0:t.endsWith(`/mdx/registry.ts`)||t.endsWith(`/mdx/registry.mts`)||t.endsWith(`/mdx/registry.mjs`)||t.endsWith(`/mdx/registry.js`)||t.endsWith(`/mdx/registry`)?t.includes(`/node_modules/rari/`)||t.includes(`/packages/rari/`):!1}function Ua(e,t){let n=e=>{if(b.existsSync(e))for(let r of b.readdirSync(e,{withFileTypes:!0})){let i=S.join(e,r.name);if(r.isDirectory()){if(r.name===`node_modules`||r.name===`.git`||r.name===`dist`)continue;n(i)}else r.isFile()&&r.name.endsWith(`.mdx`)&&t(i)}};for(let t of e)t&&b.existsSync(t)&&n(t)}function Wa(e){let t=/* @__PURE__ */ new Set;return Ua(e,e=>{try{let n=b.readFileSync(e,`utf-8`);for(let e of we(n))t.add(e)}catch{}}),t}function Ga(e,t){try{if(t.get(e).hasDefaultExport)return S.basename(e,S.extname(e));let n=t.getSource(e).match(oe);if(n?.[1]!=null&&n[1]!==``)return n[1]}catch{}return S.basename(e,S.extname(e))}function Ka(e){let t=Wa(e.contentDirs.map(t=>S.join(e.projectRoot,t)));if(t.size===0)return[];let n=Xn(e.componentScanDirs,e.cache),r=[],i=/* @__PURE__ */ new Set;for(let a of n){let n=Ga(a,e.cache);if(n==null||n===``||!t.has(n))continue;let o=Jt(a,e.projectRoot),s=o.startsWith(`/`)?o:`/${o}`,c=n.replace(/[^\w$]/g,`_`);i.has(c)&&(c=`${c}_${r.length}`),i.add(c),r.push({name:n,binding:c,importPath:s,moduleId:o,client:!0})}return r.sort((e,t)=>e.name.localeCompare(t.name))}function qa(e){let t=Ya(e.projectRoot,e.mdxOptions),n=e.srcDir??S.join(e.projectRoot,`src`),r=$a(e.projectRoot,t.componentsDir,Hn(n,Object.values(e.alias??{})));return Ka({projectRoot:e.projectRoot,componentsDir:t.componentsDir,contentDirs:t.contentDirs,cache:e.cache,componentScanDirs:r})}function Ja(e,t={}){let n=t.importStyle??`root-absolute`,r=t.mode??`vite`;return e.length===0?`import { defineMdxComponents } from 'rari/mdx/define'
|
|
44
|
+
};`,`edge $$FORM_ACTION return block`)}function zt(e,t){let n=Rt(t);return Lt(It(e,Pt,n,`browser registerBoundServerReference`))}const Bt=[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react/compiler-runtime`,`react-dom/client`];function Vt(e){return u(e)&&typeof e.find==`string`&&typeof e.replacement==`string`}function Ht(e,t=new Set(Bt)){let n={},r=e.resolve?.alias;if(Array.isArray(r))for(let e of r)Vt(e)&&!t.has(e.find)&&(n[e.find]=e.replacement);else if(u(r))for(let[e,i]of Object.entries(r))typeof i==`string`&&!t.has(e)&&(n[e]=i);return n}function Ut(e){return{projectRoot:e.root,outDir:O.resolve(e.root,e.build.outDir),assetsDir:C(e.build.assetsDir)}}function P(e,t=8){return Ae(`sha256`).update(e).digest(`hex`).slice(0,t)}function Wt(e,t=k.cwd()){let n=O.isAbsolute(e)?e:O.resolve(t,e),r=O.relative(t,n);return O.isAbsolute(r)?w(n):w(r)}function Gt(e){return e.replace(S,``).replace(b,`_`).replace(ee,``)}function Kt(e,t=k.cwd()){let n=Wt(e,t);return`${Gt(n)}_${P(n)}`}const qt=/* @__PURE__ */ new Set([`return`,`throw`,`case`,`typeof`,`instanceof`,`new`,`delete`,`void`,`in`,`of`]),Jt=8232,Yt=8233;function Xt(e){return e===32||e===9||e===13||e===10||e===Jt||e===Yt||e===65279}function Zt(e){return e===13||e===10||e===Jt||e===Yt}function F(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95||e===36}function Qt(e){return e>=97&&e<=122||e>=65&&e<=90||e===95||e===36}function $t(e,t,n){for(;t<n&&Xt(e.charCodeAt(t));)t++;return t}function I(e,t,n){for(;t<n;){let r=$t(e,t,n);if(r!==t){t=r;continue}let i=e.charCodeAt(t);if(i===47&&e.charCodeAt(t+1)===47){t=en(e,t,n);continue}if(i===47&&e.charCodeAt(t+1)===42){t=tn(e,t,n);continue}break}return t}function en(e,t,n){for(;t<n&&!Zt(e.charCodeAt(t));)t++;return t}function tn(e,t,n){for(t+=2;t<n-1&&(e.charCodeAt(t)!==42||e.charCodeAt(t+1)!==47);)t++;return t+2}function L(e,t,n,r){for(t++;t<n;){let n=e.charCodeAt(t);if(n===92){t+=2;continue}if(n===r)return t+1;t++}return t}function nn(e,t,n){for(;t<n;){let n=e.charCodeAt(t);if(F(n)||n===46||n===45)t++;else break}return t}function rn(e,t,n){t++;let r=1;for(;t<n&&r>0;){let i=e.charCodeAt(t);if(i===39||i===34||i===96){t=L(e,t,n,i);continue}i===123&&r++,i===125&&r--,t++}return t}function an(e,t,n,r){let i=e.charCodeAt(t+1);if(i!==47&&i!==46&&i!==62&&!Qt(i))return{i:t+1,depth:r};let a=r;return i===47?(a--,t++):i!==33&&a++,t++,{i:nn(e,t,n),depth:a}}function on(e,t,n,r,i){let a=e.charCodeAt(t);return a===39||a===34||a===96?{i:L(e,t,n,a),depth:r}:a===123?{i:rn(e,t,n),depth:r}:a===47&&e.charCodeAt(t+1)===62?{i:t+2,depth:r-1}:a===62?{i:t+1,depth:i?r-1:r}:a===60?an(e,t,n,r):{i:t+1,depth:r}}function sn(e,t,n){t++;let r=e.charCodeAt(t)===47;r&&t++,t=nn(e,t,n);let i=+!r;for(;t<n&&i>0;)({i:t,depth:i}=on(e,t,n,i,r));return t}function cn(e,t,n){for(let r=0;r<n.length;r++)if(e.charCodeAt(t+r)!==n.charCodeAt(r))return!1;return!0}function R(e,t,n){if(t+n.length>e.length)return!1;for(let r=0;r<n.length;r++)if(e.charCodeAt(t+r)!==n.charCodeAt(r))return!1;let r=t>0?e.charCodeAt(t-1):-1,i=t+n.length,a=i<e.length?e.charCodeAt(i):-1;return!(r!==-1&&F(r)||a!==-1&&F(a))}function ln(e,t,n){let r=I(e,t,n);if(r>=n)return null;let i=e.charCodeAt(r);if(i!==39&&i!==34)return null;let a=r+1,o=L(e,r,n,i);return o<=a?null:{source:e.slice(a,o-1),end:o}}function un(e,t,n){for(t++;t<n&&F(e.charCodeAt(t));)t++;for(;t<n&&e.charCodeAt(t)===46;)for(t++;t<n&&F(e.charCodeAt(t));)t++;return t}function dn(e,t){return e===123||e===40||e===91?t+1:e===125||e===41||e===93?Math.max(0,t-1):t}function fn(e,t,n){let r=0;for(;t<n&&(t=I(e,t,n),!(t>=n));){let i=e.charCodeAt(t);if(r===0&&R(e,t,`from`)){let r=ln(e,t+4,n);if(r)return{sources:[r.source],end:r.end};break}if(i===39||i===34||i===96){t=L(e,t,n,i);continue}r=dn(i,r),t++}return{sources:[],end:t}}function pn(e,t,n){if(!R(e,t,`import`))return{sources:[],end:t+6};let r=I(e,t+6,n);if(R(e,r,`type`)&&(r=I(e,r+4,n)),e.charCodeAt(r)===46)return{sources:[],end:un(e,r,n)};if(e.charCodeAt(r)===40){r++;let t=ln(e,r,n);return t?{sources:[t.source],end:t.end}:{sources:[],end:r}}let i=ln(e,r,n);return i?{sources:[i.source],end:i.end}:fn(e,r,n)}function mn(e,t){return e.charCodeAt(t)===101&&e.charCodeAt(t+1)===120&&e.charCodeAt(t+2)===112&&e.charCodeAt(t+3)===111&&e.charCodeAt(t+4)===114&&e.charCodeAt(t+5)===116}function hn(e,t){return e.charCodeAt(t)===100&&e.charCodeAt(t+1)===101&&e.charCodeAt(t+2)===102&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===117&&e.charCodeAt(t+5)===108&&e.charCodeAt(t+6)===116}function gn(e,t,n){e.sawFirstDirective||(e.sawFirstDirective=!0,e.topLevelUseClient=t,e.topLevelUseServer=n),t&&(e.directives.hasUseClient=!0),n&&(e.directives.hasUseServer=!0)}function _n(e,t,n){let r=t;for(;r<n;){let t=e.charCodeAt(r);if(Xt(t)&&!Zt(t)){r++;continue}if(Zt(t)||t===59)return{stillDirective:!0,nextI:r+1,endDirectivesPhase:!1};if(t===47&&e.charCodeAt(r+1)===47){r=en(e,r,n);continue}if(t===47&&e.charCodeAt(r+1)===42){r=tn(e,r,n);continue}return{stillDirective:!1,nextI:r,endDirectivesPhase:!0}}return{stillDirective:!0,nextI:t,endDirectivesPhase:!0}}function vn(e,t,n,r){if(!r.directivesPhase)return null;let i=e.charCodeAt(t);if(i!==39&&i!==34)return null;let a=t+1,o=L(e,t,n,i);if(o<=a)return r.directivesPhase=!1,t+1;let s=o-1-a;gn(r,s===10&&cn(e,a,`use client`),s===10&&cn(e,a,`use server`));let c=_n(e,o,n);return c.stillDirective?c.nextI:(c.endDirectivesPhase&&(r.directivesPhase=!1),r.directivesPhase?o:c.nextI)}function yn(e,t,n){if(t>=n)return!1;let r=e.charCodeAt(t);return Xt(r)||r===123?!0:r===47&&(e.charCodeAt(t+1)===47||e.charCodeAt(t+1)===42)}function bn(e){e.hasDefaultExportResult=!0,e.hasComponentExportResult=!0}function xn(e,t,n,r){if(e.charCodeAt(t)!==97||e.charCodeAt(t+1)!==115)return{k:t,hasAlias:!1};let i=t+2;if(i>=n||F(e.charCodeAt(i)))return{k:t,hasAlias:!0};t=I(e,i,n);let a=t;for(;t<n&&F(e.charCodeAt(t));)t++;return t-a===7&&hn(e,a)&&bn(r),{k:t,hasAlias:!0}}function Sn(e,t,n,r){let i=t;for(;t<n&&F(e.charCodeAt(t));)t++;let a=t-i;if(a===0)return null;t=I(e,t,n);let o=xn(e,t,n,r);return t=o.k,!o.hasAlias&&a===7&&hn(e,i)&&bn(r),e.charCodeAt(t)===44?t+1:e.charCodeAt(t)===125?t:t+1}function Cn(e,t,n,r){let i=t+1;for(;i<n&&(i=I(e,i,n),e.charCodeAt(i)!==125);){let t=Sn(e,i,n,r);if(t===null)break;i=t}}function wn(e,t,n,r){if(!mn(e,t))return null;let i=t+6;if(!yn(e,i,n))return null;let a=I(e,i,n);if(hn(e,a)){bn(r);let t=a+7;if(t>=n||!F(e.charCodeAt(t)))return i}return e.charCodeAt(a)===123?(Cn(e,a,n,r),null):((R(e,a,`async`)||R(e,a,`function`)||R(e,a,`class`))&&(r.hasComponentExportResult=!0),null)}function Tn(e,t,n,r){let i=vn(e,t,n,r);if(i!==null)return i;let a=V(e,t,n);if(a!==-1)return r.directivesPhase&&!sr(e,t)&&(r.directivesPhase=!1),a;if(r.directivesPhase=!1,R(e,t,`import`)){let i=pn(e,t,n);for(let e of i.sources)r.importSources.push(e);return i.end}let o=wn(e,t,n,r);return o===null?t+1:o}function z(e){let t={directives:{hasUseClient:!1,hasUseServer:!1},topLevelUseClient:!1,topLevelUseServer:!1,hasDefaultExportResult:!1,hasComponentExportResult:!1,importSources:[],directivesPhase:!0,sawFirstDirective:!1},n=0,r=e.length;for(;n<r;)n=Tn(e,n,r,t);return{directives:t.directives,topLevelUseClient:t.topLevelUseClient,topLevelUseServer:t.topLevelUseServer,hasDefaultExport:t.hasDefaultExportResult,hasComponentExport:t.hasComponentExportResult,importSources:[...new Set(t.importSources)]}}function B(e,t,n){if(t>=n||!Qt(e.charCodeAt(t)))return null;let r=t+1;for(;r<n&&F(e.charCodeAt(r));)r++;return{name:e.slice(t,r),end:r}}function En(e,t,n){let r=t;for(;r<n;){let t=e.charCodeAt(r);if(t===32||t===9){r++;continue}if(t===59)return r+1;break}return t}function Dn(e,t,n){if(!R(e,t,`type`))return null;let r=I(e,t+4,n),i=e.charCodeAt(r);return(i===39||i===34||B(e,r,n)!==null)&&!R(e,r,`as`)?r:null}function On(e,t,n){let r=e.charCodeAt(t);if(r===39||r===34){let i=L(e,t,n,r);return{imported:e.slice(t+1,i-1),end:i}}let i=B(e,t,n);return i?{imported:i.name,end:i.end}:null}function kn(e,t,n){let r=Dn(e,t,n),i=r!==null;r!==null&&(t=r);let a=On(e,t,n);if(!a)return null;let o=a.imported;t=I(e,a.end,n);let s=o;if(R(e,t,`as`)){t=I(e,t+2,n);let r=B(e,t,n);if(!r)return null;s=r.name,t=I(e,r.end,n)}return{specifier:{imported:o,local:s,typeOnly:i},end:t}}function An(e,t,n){let r=[],i=t+1;for(;;){if(i=I(e,i,n),i>=n)return null;if(e.charCodeAt(i)===125)return{named:r,end:i+1};let t=kn(e,i,n);if(!t)return null;r.push(t.specifier),i=t.end;let a=e.charCodeAt(i);if(a===44){i++;continue}return a===125?{named:r,end:i+1}:null}}function jn(e,t,n,r){let i=e.charCodeAt(n);if(i!==39&&i!==34)return null;let a=ln(e,n,r);return a?{start:t,end:En(e,a.end,r),source:a.source,typeOnly:!1,sideEffectOnly:!0,defaultBinding:null,namespaceBinding:null,named:[]}:null}function Mn(e,t,n){if(!R(e,t,`type`))return{typeOnly:!1,pos:t};let r=I(e,t+4,n);return!R(e,r,`from`)&&e.charCodeAt(r)!==44?{typeOnly:!0,pos:r}:{typeOnly:!1,pos:t}}function Nn(e,t,n){let r=null,i=null,a=[],o=e.charCodeAt(t);if(o!==123&&o!==42){let i=B(e,t,n);if(!i)return null;r=i.name,t=I(e,i.end,n),e.charCodeAt(t)===44?(t=I(e,t+1,n),o=e.charCodeAt(t)):o=-1}if(o===42){if(t=I(e,t+1,n),!R(e,t,`as`))return null;t=I(e,t+2,n);let r=B(e,t,n);if(!r)return null;i=r.name,t=r.end}else if(o===123){let r=An(e,t,n);if(!r)return null;a=r.named,t=r.end}return{defaultBinding:r,namespaceBinding:i,named:a,pos:t}}function Pn(e,t,n){let r=I(e,t+6,n);if(r>=n)return null;let i=e.charCodeAt(r);if(i===40||i===46)return null;let a=jn(e,t,r,n);if(a)return a;let o=Mn(e,r,n);r=o.pos;let s=Nn(e,r,n);if(!s||(r=I(e,s.pos,n),!R(e,r,`from`)))return null;let c=ln(e,r+4,n);return c?{start:t,end:En(e,c.end,n),source:c.source,typeOnly:o.typeOnly,sideEffectOnly:!1,defaultBinding:s.defaultBinding,namespaceBinding:s.namespaceBinding,named:s.named}:null}function Fn(e){let t=[],n=0,r=e.length;for(;n<r;){let i=V(e,n,r);if(i!==-1){n=i;continue}if(R(e,n,`import`)){let i=Pn(e,n,r);if(i){t.push(i),n=i.end;continue}n+=6;continue}n++}return t}function In(e,t,n,r){let i=I(e,t+1,n);if(R(e,i,`as`)){i=I(e,i+2,n);let t=B(e,i,n);return t&&r.add(t.name),t?.end??i+1}return t+1}function Ln(e,t,n,r){let i=Hn(e,t,n),a=e.slice(t+1,i-1);for(let e of a.split(`,`)){let t=e.trim();if(!t||t.startsWith(`type `)||t.startsWith(`typeof `))continue;let n=(t.split(/\s+as\s+/).at(-1)??``).trim();n!==``&&n!==`type`&&r.add(n)}return i}function Rn(e,t){return R(e,t,`function`)?8:R(e,t,`class`)||R(e,t,`const`)?5:3}function zn(e,t,n,r){if(R(e,t,`async`)&&(t=I(e,t+5,n)),!R(e,t,`function`)&&!R(e,t,`class`)&&!R(e,t,`const`)&&!R(e,t,`let`)&&!R(e,t,`var`))return null;let i=Rn(e,t),a=I(e,t+i,n);e.charCodeAt(a)===42&&(a=I(e,a+1,n));let o=B(e,a,n);return o&&r.add(o.name),o?.end??a+1}function Bn(e,t,n,r){let i=I(e,t+6,n);if(R(e,i,`type`)||R(e,i,`interface`))return i+1;if(e.charCodeAt(i)===42)return In(e,i,n,r);if(R(e,i,`default`))return r.add(`default`),i+7;if(e.charCodeAt(i)===123)return Ln(e,i,n,r);let a=zn(e,i,n,r);return a===null?t+1:a}function Vn(e){let t=/* @__PURE__ */ new Set,n=0,r=e.length;for(;n<r;){let i=V(e,n,r);if(i!==-1){n=i;continue}if(!R(e,n,`export`)){n++;continue}n=Bn(e,n,r,t)}return[...t]}function Hn(e,t,n){let r=t,i=0;for(;r<n;){let t=Un(e,r,n);if(t!=null){r=t;continue}let a=e.charCodeAt(r);if(a===123){i++,r++;continue}if(a===125){if(i--,r++,i===0)return r;continue}r++}return r}function Un(e,t,n){let r=e.charCodeAt(t);return r===39||r===34||r===96?L(e,t,n,r):r===47&&e.charCodeAt(t+1)===47?en(e,t,n):r===47&&e.charCodeAt(t+1)===42?tn(e,t,n):null}function Wn(e){return z(e).topLevelUseServer}function Gn(e,t,n){let r=e.charCodeAt(t);if(r!==39&&r!==34)return null;let i=t+1,a=L(e,t,n,r);if(a<=i)return null;let o=a-1-i,s=o===10&&cn(e,i,`use client`),c=o===10&&cn(e,i,`use server`);return!s&&!c?null:{kind:s?`use client`:`use server`,term:_n(e,a,n)}}function Kn(e,t){return!e.stillDirective&&e.endDirectivesPhase||!e.stillDirective?!1:t}function qn(e,t){let n=0,r=e.length,i=!0;for(;n<r&&i&&(n=I(e,n,r),!(n>=r));){let a=Gn(e,n,r);if(a==null)break;if(i=Kn(a.term,i),a.kind===t&&a.term.stillDirective)return e.slice(0,n)+e.slice(a.term.nextI);if(!a.term.stillDirective)break;n=a.term.nextI}return e}function Jn(e){return z(e).hasDefaultExport}function Yn(e){return e===40||e===91||e===123||e===44||e===59||e===61||e===58||e===63||e===33||e===43||e===45||e===42||e===37||e===38||e===124||e===94||e===126||e===60||e===62}function Xn(e,t){for(t-=2;t>=1;){if(e.charCodeAt(t)===42&&e.charCodeAt(t-1)===47)return t-2;t--}return-1}function Zn(e,t){let n=t;for(;n>=0&&e.charCodeAt(n)!==10&&e.charCodeAt(n)!==13;)n--;let r=n+1;for(;r<t&&(e.charCodeAt(r)===32||e.charCodeAt(r)===9);)r++;return r<t&&e.charCodeAt(r)===47&&e.charCodeAt(r+1)===47?r-1:null}function Qn(e,t){let n=e.charCodeAt(t);return Xt(n)?t-1:t>=1&&n===47&&e.charCodeAt(t-1)===42?Xn(e,t):t>=1&&n===47&&e.charCodeAt(t-1)===47?t-2:Zn(e,t)}function $n(e,t){let n=t-1;for(;n>=0;){let t=Qn(e,n);if(t!==null){if(n=t,n<0)return;continue}break}if(n<0||!F(e.charCodeAt(n)))return;let r=n;for(;n>=0&&F(e.charCodeAt(n));)n--;return e.slice(n+1,r+1)}function er(e,t){let n=t-1;for(;n>=0;){let t=Qn(e,n);if(t!==null){if(n=t,n<0)return-1;continue}return e.charCodeAt(n)}return-1}function tr(e,t){let n=er(e,t);if(n===-1||Yn(n))return!0;let r=$n(e,t);return r!=null&&r!==``&&qt.has(r)}const nr=/* @__PURE__ */ new Set([`return`,`throw`,`case`,`default`,`else`,`do`,`typeof`,`void`,`yield`,`await`,`delete`]);function rr(e,t){let n=er(e,t);if(n===-1)return!0;if(F(n)||n>=48&&n<=57){let n=$n(e,t);return n!=null&&n!==``&&nr.has(n)}return n!==41&&n!==93&&n!==125}function ir(e,t,n){if(!rr(e,t))return-1;let r=e.charCodeAt(t+1);if(r!==47&&r!==46&&r!==62&&!Qt(r))return-1;let i=sn(e,t,n);return i<n&&e.charCodeAt(i)===62&&i++,i>t&&e.charCodeAt(i-1)===62?i:-1}function ar(e,t,n,r){let i=e.charCodeAt(t);if(i===92)return{i:t+2,inCharClass:r,done:!1};if(r)return{i:t+1,inCharClass:i!==93,done:!1};if(i===91)return{i:t+1,inCharClass:!0,done:!1};if(i===47){for(t++;t<n&&F(e.charCodeAt(t));)t++;return{i:t,inCharClass:r,done:!0}}return Zt(i)?{i:t,inCharClass:r,done:!0}:{i:t+1,inCharClass:r,done:!1}}function or(e,t,n){t++;let r=!1;for(;t<n;){let i=ar(e,t,n,r);if(t=i.i,r=i.inCharClass,i.done)return t}return t}function V(e,t,n){if(t>=n)return-1;let r=e.charCodeAt(t);if(Xt(r))return t+1;if(r===47&&e.charCodeAt(t+1)===47)return en(e,t,n);if(r===47&&e.charCodeAt(t+1)===42)return tn(e,t,n);if(r===39||r===34||r===96)return L(e,t,n,r);if(r===47&&e.charCodeAt(t+1)!==47&&e.charCodeAt(t+1)!==42&&tr(e,t))return or(e,t,n);if(r===60){let r=ir(e,t,n);if(r!==-1)return r}return-1}function sr(e,t){let n=e.charCodeAt(t);return Xt(n)?!0:n===47&&(e.charCodeAt(t+1)===47||e.charCodeAt(t+1)===42)}function cr(e,t,n){let r=t;if(R(e,r,`async`)){let t=I(e,r+5,n);R(e,t,`function`)&&(r=t)}if(!R(e,r,`function`)&&!R(e,r,`class`))return null;let i=R(e,r,`function`)?8:5,a=I(e,r+i,n);e.charCodeAt(a)===42&&(a=I(e,a+1,n));let o=B(e,a,n);return o?o.name:null}function lr(e){let t=e.length,n=0;for(;n<t;){let r=V(e,n,t);if(r!==-1){n=r;continue}if(!R(e,n,`export`)){n++;continue}let i=I(e,n+6,t);if(!R(e,i,`default`)){n++;continue}let a=I(e,i+7,t),o=cr(e,a,t),s=yr(e,a,t);return{exportStart:n,valueStart:a,valueEnd:s,statementEnd:En(e,s,t),bindingName:o}}return null}function ur(e,t,n){if(t>=n)return!1;let r=e.charCodeAt(t),i=t+1<n?e.charCodeAt(t+1):-1;return r===46||r===63&&i===46||r===40||r===91||r===96||r===61&&i===62||r===43||r===45||r===42||r===47||r===37||r===38||r===124||r===94||r===60||r===62||r===61||r===33||r===63||r===58||r===44||r===126||R(e,t,`instanceof`)||R(e,t,`in`)||R(e,t,`of`)||R(e,t,`as`)}const dr=/* @__PURE__ */ new Set([`typeof`,`void`,`delete`,`await`,`yield`,`new`]);function fr(e,t,n){let r=e.charCodeAt(t.i);return r===39||r===34||r===96?(t.i=L(e,t.i,n,r),t.lastCanTerminate=!0,!0):r===47&&e.charCodeAt(t.i+1)===47?(t.i=en(e,t.i,n),!0):r===47&&e.charCodeAt(t.i+1)===42?(t.i=tn(e,t.i,n),!0):r===47&&e.charCodeAt(t.i+1)!==47&&e.charCodeAt(t.i+1)!==42&&tr(e,t.i)?(t.i=or(e,t.i,n),t.lastCanTerminate=!0,!0):!1}function pr(e,t,n){if(e.charCodeAt(t.i)!==60||t.paren!==0||t.brace!==0||t.bracket!==0)return!1;let r=ir(e,t.i,n);return r!==-1&&(t.i=r,t.lastCanTerminate=!0,!0)}function mr(e,t){return e===40?(t.paren++,t.lastCanTerminate=!1,t.i++,!1):e===41?(t.paren=Math.max(0,t.paren-1),t.lastCanTerminate=!0,t.i++,!1):e===123?(t.brace++,t.lastCanTerminate=!1,t.i++,!1):e===125?(t.brace=Math.max(0,t.brace-1),t.lastCanTerminate=!0,t.i++,t.paren===0&&t.brace===0&&t.bracket===0):e===91?(t.bracket++,t.lastCanTerminate=!1,t.i++,!1):e===93?(t.bracket=Math.max(0,t.bracket-1),t.lastCanTerminate=!0,t.i++,!1):null}function hr(e,t,n,r){if(t.paren!==0||t.brace!==0||t.bracket!==0)return null;if(r===59)return t.i;if(!Zt(r))return null;let i=I(e,t.i+1,n);return!t.lastCanTerminate||ur(e,i,n)?(t.i++,-1):t.i}function gr(e,t,n){for(t++;t<n;){let n=e.charCodeAt(t);if(n>=48&&n<=57||n===46||n===110||n===101||n===69){t++;continue}break}return t}function _r(e){return e===46||e===44||e===58||e===63||e===61||e===43||e===45||e===42||e===47||e===37||e===38||e===124||e===94||e===33||e===126||e===60||e===62}function vr(e,t,n){let r=e.charCodeAt(t.i);if(Qt(r)){let r=B(e,t.i,n);if(r){t.lastCanTerminate=!dr.has(r.name),t.i=r.end;return}}if(r>=48&&r<=57){t.lastCanTerminate=!0,t.i=gr(e,t.i,n);return}if(r===61&&e.charCodeAt(t.i+1)===62){t.lastCanTerminate=!1,t.i+=2;return}if(_r(r)){t.lastCanTerminate=!1,t.i++;return}t.i++}function yr(e,t,n){let r={i:t,paren:0,brace:0,bracket:0,lastCanTerminate:!1};for(;r.i<n;){if(fr(e,r,n)||pr(e,r,n))continue;let t=e.charCodeAt(r.i),i=mr(t,r);if(i===!0)return r.i;if(i===!1)continue;let a=hr(e,r,n,t);if(a!==-1){if(a!==null)return a;vr(e,r,n)}}return r.i}function br(e,t){let n=lr(e);if(n==null||n.bindingName!=null)return null;let r=`const ${t} = ${e.slice(n.valueStart,n.valueEnd).trimEnd()};\nexport default ${t}${e.slice(n.statementEnd)}`;return e.slice(0,n.exportStart)+r}const xr=/* @__PURE__ */ new Set([`node_modules`,`.git`,`.cache`,`dist`]);function Sr(e,t){let n=/* @__PURE__ */ new Set,r=e=>{if(!E.existsSync(e))return;let i=E.readdirSync(e,{withFileTypes:!0});for(let a of i){let i=O.join(e,a.name);if(a.isDirectory()){if(xr.has(a.name))continue;r(i)}else if(a.isFile()&&S.test(a.name)){if(n.has(i))continue;n.add(i),t(i)}}};for(let t of e)t&&E.existsSync(t)&&r(t)}function Cr(e){let t=[];return Sr(e,e=>{t.push(e)}),t}function wr(e,t=[]){let n=[e],r=O.resolve(e);for(let e of t){if(!e)continue;let t=O.resolve(e);if(t===r)continue;let i=O.relative(r,t);if(i!==``&&(i.startsWith(`..`)||O.isAbsolute(i)))try{E.statSync(e).isDirectory()&&n.push(e)}catch{}}return n}const Tr=new Set(Ce);function Er(e){return Tr.has(e)}function Dr(e){for(let t of e.importSources)if(t.startsWith(`node:`)||Er(t))return!0;return!1}function Or(e,t=Tr){let n=[];for(let r of e)!r.startsWith(`.`)&&!r.startsWith(`/`)&&!r.startsWith(`@/`)&&!r.startsWith(`node:`)&&!t.has(r)&&n.push(r);return[...new Set(n)]}function kr(e){let t=[];for(let n of e)(n.startsWith(`./`)||n.startsWith(`../`)||n.startsWith(`@/`))&&t.push(n);return t}function H(e){try{return E.realpathSync(e)}catch{return O.resolve(e)}}function Ar(e,t){e.delete(t);try{e.delete(E.realpathSync(t))}catch{e.delete(O.resolve(t))}}function jr(e,t){let n=[];for(let r of Cr(e))try{t.get(r).directives.hasUseClient&&n.push(r)}catch{}return n}var Mr=class{cache=/* @__PURE__ */ new Map;get(e,t){let n=H(e),r=this.cache.get(n);if(t!==void 0){if(r?.source===t)return r.analysis}else if(r){let e=this.readMtimeMs(n);if(e>=0&&r.mtimeMs===e)return r.analysis}t??=E.readFileSync(n,`utf-8`);let i=this.readMtimeMs(n),a=z(t);return this.cache.set(n,{mtimeMs:i,source:t,analysis:a}),a}getSource(e){return this.get(e),this.cache.get(H(e)).source}invalidate(e){Ar(this.cache,e)}clear(){this.cache.clear()}readMtimeMs(e){try{return E.statSync(e).mtimeMs}catch{return-1}}};const Nr=`virtual:rari-entry-client`,Pr=/^layout\.(?:tsx|ts|jsx|js)$/,Fr=/\.css(?:\?.*)?$/,Ir=/* @__PURE__ */ new Set;function Lr(){Ir.clear()}function Rr(e){let t=e.trim();t!==``&&Ir.add(t)}function zr(){return[...Ir]}function Br(e,t,n,r){let i=e.replace(/[?#].*$/,``);if(!Fr.test(i))return null;if(i.startsWith(`./`)||i.startsWith(`../`)){let e=O.resolve(O.dirname(t),i);return!E.existsSync(e)||!E.statSync(e).isFile()?null:e}let a=T(i,r,n);return a!=null&&a!==``&&E.existsSync(a)&&E.statSync(a).isFile()?a:i}function Vr(e,t,n,r){if(E.existsSync(e))for(let i of E.readdirSync(e,{withFileTypes:!0})){let a=O.join(e,i.name);if(i.isDirectory()){Vr(a,t,n,r);continue}if(!i.isFile()||!Pr.test(i.name))continue;let o=E.readFileSync(a,`utf-8`);for(let e of Fn(o)){let i=Br(e.source,a,t,n);i!=null&&r.add(i)}}}function Hr(e,t={}){let n=/* @__PURE__ */ new Set;return Vr(O.join(e,`src`,`app`),e,t,n),n}function Ur(e,t){if(!O.isAbsolute(e))return e.startsWith(`/`)?e:`/${e}`;let n=w(O.relative(t,e));return n.startsWith(`..`)||O.isAbsolute(n)?`/@fs/${e}`:`/${n}`}function Wr(e,t={}){return[...Hr(e,t)].sort().map(t=>Ur(t,e))}function Gr(e,t){if(!O.isAbsolute(e))return e;let n=w(O.relative(t,e));return n.startsWith(`..`)||O.isAbsolute(n)?e:`/${n}`}function Kr(e,t={}){return[...Hr(e,t)].sort().map(t=>`import ${JSON.stringify(Gr(t,e))};`).join(`
|
|
45
|
+
`)}function qr(e){return e.startsWith(`/`)?e:`/${e}`}function Jr(e){let t=[...zr()],n=new Set(t),r=e=>{n.has(e)||(n.add(e),t.push(e))};return Yr(e,r)||Xr(e,r),t.length>0?`${t.join(`
|
|
46
|
+
`)}\n`:``}function Yr(e,t){let n=!1;for(let[r,i]of Object.entries(e)){if(i.type!==`chunk`||i.isEntry!==!0)continue;let e=i.viteMetadata?.importedCss;if(e){let r=[...e];r.length>0&&(n=!0);for(let e of r)t(`<link rel="stylesheet" href="${qr(e)}" />`)}t(`<script type="module" src="${qr(r)}"><\/script>`)}return n}function Xr(e,t){for(let[n,r]of Object.entries(e))r.type===`asset`&&n.endsWith(`.css`)&&!n.includes(`/server/`)&&t(`<link rel="stylesheet" href="${qr(n)}" />`)}function Zr(e){let t=e<0?(-e<<1)+1:e<<1,n=``;do{let e=t&31;t>>>=5,t>0&&(e|=32),n+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`[e]}while(t>0);return n}function Qr(e){let t=[],n=0;for(let r of e){if(r==null){t.push(``);continue}let e=r-n;n=r,t.push(`${Zr(0)}${Zr(0)}${Zr(e)}${Zr(0)}`)}return t.join(`;`)}function $r(e,t){let n=Math.max(1,t.split(`
|
|
47
|
+
`).length),r=Array.from({length:n},(e,t)=>t);return{version:3,file:e,sources:[e],sourcesContent:[t],names:[],mappings:Qr(r)}}function ei(e,t){let n=e.length,r=t.length,i=Array.from({length:r}).fill(null);if(r===0||n===0)return i;if(ni(t,e)){let e=r-n;for(let t=0;t<n;t+=1)i[e+t]=t;return i}if(ri(t,e)){for(let e=0;e<n;e+=1)i[e]=e;return i}return n*r>2e6?ii(e,t):ti(e,t)}function ti(e,t){let n=e.length,r=t.length,i=Array.from({length:r}).fill(null),a=Array.from({length:n+1},()=>new Uint32Array(r+1));for(let i=1;i<=n;i+=1){let n=e[i-1],o=a[i],s=a[i-1];for(let e=1;e<=r;e+=1)o[e]=n===t[e-1]?s[e-1]+1:Math.max(s[e],o[e-1])}let o=n,s=r;for(;o>0&&s>0;)e[o-1]===t[s-1]?(i[s-1]=o-1,--o,--s):a[o-1][s]>=a[o][s-1]?--o:--s;return i}function ni(e,t){if(t.length>e.length)return!1;let n=e.length-t.length;for(let r=0;r<t.length;r+=1)if(e[n+r]!==t[r])return!1;return!0}function ri(e,t){if(t.length>e.length)return!1;for(let n=0;n<t.length;n+=1)if(e[n]!==t[n])return!1;return!0}function ii(e,t){let n=Array.from({length:t.length}).fill(null),r=0,i=0;for(;r<e.length&&i<t.length;)if(e[r]===t[i])n[i]=r,r+=1,i+=1;else{if(i+1<t.length&&e[r]===t[i+1]){i+=1;continue}if(r+1<e.length&&e[r+1]===t[i]){r+=1;continue}i+=1,r+=1}return n}function ai(e,t,n){let r=ei(t.split(`
|
|
48
|
+
`),n.split(`
|
|
49
|
+
`));return{version:3,file:e,sources:[e],sourcesContent:[t],names:[],mappings:Qr(r)}}function oi(e,t,n){return e===t?null:{code:e,map:ai(n,t,e)}}const si=/\.(?:[cm]?[jt]sx?|vue|svelte|mdx?)$/i;function ci(e,t,n){return e.startsWith(`//`)||/^[a-z][a-z\d+.-]*:/i.test(e)?e:e===``||e===t?`${n}${t}`:e.startsWith(`/`)?`${n}${e}`:`${n}${O.posix.normalize(`${O.posix.dirname(t)}/${e}`)}`}function li(e){if(!(`sourceRoot`in e))return;let t=Reflect.get(e,`sourceRoot`);return typeof t==`string`&&t!==``?t:void 0}function ui(e){return e.startsWith(`//`)||/^[a-z][a-z\d+.-]*:/i.test(e)}function di(e,t){if(t==null||ui(e)||e.startsWith(`/`))return e;if(ui(t))try{if(t.startsWith(`//`)){let n=new URL(e,`https:${t}`);return`//${n.host}${n.pathname}${n.search}${n.hash}`}return new URL(e,t).href}catch{let n=t.lastIndexOf(`/`);return`${n>=0?t.slice(0,n+1):`${t}/`}${e}`}let n=t.endsWith(`/`)?`${t}${e}`:`${t}/${e}`;return O.posix.normalize(n)}function fi(e){if(!(`sources`in e))return;let t=Reflect.get(e,`sources`);if(Array.isArray(t))return t.every(e=>e===null||typeof e==`string`)?t:void 0}function pi(e,t,n,r){return e==null?null:ci(di(e,r),t,n)}function mi(e,t,n){let r=fi(e);if(r==null)return e;let i=li(e),a={...e,sources:r.map(e=>pi(e,t,n,i))};return delete a.sourceRoot,a}function hi(e,t,n,r){if(t.startsWith(`file://`))return gi(e,t,r);let i=e.config.base.endsWith(`/`)?e.config.base.slice(0,-1):e.config.base,a=n===`Server`||n===`rsc`,o=n===`Client`||n===`client`;if(a)return _i(e,t,i);if(o)return vi(e,t,i)}function gi(e,t,n){let r;try{r=w(A(t))}catch{return}if(!ce(r,n)||!je(e.config,r)||!si.test(r)||!E.existsSync(r))return;let i=E.statSync(r);if(!i.isFile()||i.size>1048576)return;let a=E.readFileSync(r,`utf-8`);return $r(r,a)}function _i(e,t,n){let r=e.environments.rsc.moduleGraph,i=r.getModuleById(t)??(t.startsWith(`/`)?r.urlToModuleMap.get(t):void 0),a=i?.transformResult?.map;if(i!=null&&a!=null)return mi(a,i.url,n)}function vi(e,t,n){try{let r=new URL(t,`http://localhost`).pathname,i=n!==``&&r.startsWith(n)?r.slice(n.length):r,a=e.environments.client.moduleGraph.urlToModuleMap.get(i),o=a?.transformResult?.map;return a==null||o==null?void 0:mi(o,a.url,n)}catch{return}}function yi(e){let t=O.resolve(e);return{name:`rari:find-source-map-url`,apply:`serve`,configureServer(e){e.middlewares.use((n,r,i)=>{if(se(n.url??``)!==`/__rari_findSourceMapURL`){i();return}let a=new URL(n.url??``,`http://localhost`),o=a.searchParams.get(`filename`),s=a.searchParams.get(`environmentName`)??`Server`;if(o==null||o===``){r.statusCode=400,r.end(`{}`);return}try{let n=hi(e,o,s,t);r.statusCode=n==null?404:200,r.setHeader(`Content-Type`,`application/json`),r.setHeader(`Cache-Control`,`no-store`),r.end(JSON.stringify(n??{}))}catch(e){i(e)}})}}}function bi(e,t={}){let n=O.extname(e),r=n.toLowerCase(),i=r===``?t.defaultExt??``:r,a=O.basename(e,n);return t.sanitizeBase&&(a=a.replaceAll(/[?#]/g,`_`)),t.encodeBase&&(a=encodeURIComponent(a)),{base:a,ext:i}}function xi(e,t,n,r={}){let{base:i,ext:a}=bi(e,r);return`${C(n)}/${i}-${t}${a}`}function Si(e,t,n,r={}){return`/${xi(e,t,n,r)}`}function Ci(e){return`/${e.split(O.sep).join(`/`)}`}function wi(e,t,n){return xi(e,t,n,{defaultExt:`.woff2`,sanitizeBase:!0})}function Ti(e){return Ci(e)}function Ei(e){E.mkdirSync(e,{recursive:!0})}function Di(e,t){return`${e}_${t}`}function Oi(e){return`${(e*100).toFixed(2)}%`}function ki(e,t){if(!Number.isFinite(e.unitsPerEm)||e.unitsPerEm===0||!Number.isFinite(e.xWidthAvg))return null;let n=t===`Times New Roman`?Ne:j;if(!Number.isFinite(n.unitsPerEm)||n.unitsPerEm===0||!Number.isFinite(n.xWidthAvg))return null;let r=e.xWidthAvg/e.unitsPerEm,i=n.xWidthAvg/n.unitsPerEm;if(!Number.isFinite(i)||i===0)return null;let a=r/i;return!Number.isFinite(a)||a===0?null:{fallbackFont:t,sizeAdjust:Oi(a),ascentOverride:Oi(e.ascent/e.unitsPerEm/a),descentOverride:Oi(Math.abs(e.descent)/e.unitsPerEm/a),lineGapOverride:Oi(e.lineGap/e.unitsPerEm/a)}}async function Ai(e){let t=e.replaceAll(/\s+/g,``).replace(/^(.)/,e=>e.toLowerCase());try{let e=await import(`@capsizecss/metrics/${t}`);if(typeof e!=`object`||!e||!(`default`in e))return null;let n=e.default;return typeof n!=`object`||!n||!(`ascent`in n)||!(`descent`in n)||!(`lineGap`in n)||!(`unitsPerEm`in n)||!(`xWidthAvg`in n)||typeof n.ascent!=`number`||typeof n.descent!=`number`||typeof n.lineGap!=`number`||typeof n.unitsPerEm!=`number`||typeof n.xWidthAvg!=`number`?null:{ascent:n.ascent,descent:n.descent,lineGap:n.lineGap,unitsPerEm:n.unitsPerEm,xWidthAvg:n.xWidthAvg,category:`category`in n&&typeof n.category==`string`?n.category:void 0}}catch{return null}}function ji(e){return e===`serif`?`Times New Roman`:`Arial`}const Mi=/* @__PURE__ */ new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`]);function Ni(e){return e===`serif`?`serif`:e===`monospace`?`monospace`:`sans-serif`}function Pi(e){return(e??[]).some(e=>Mi.has(e))}function Fi(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function Ii(e,t){return`url("${Fi(e)}") format("${t}")`}function Li(e){let t=e.toLowerCase();return t.endsWith(`.woff2`)?`woff2`:t.endsWith(`.woff`)?`woff`:t.endsWith(`.ttf`)?`truetype`:t.endsWith(`.otf`)?`opentype`:`woff2`}function Ri(e){return e===`woff`?`font/woff`:e===`truetype`?`font/ttf`:e===`opentype`?`font/otf`:`font/woff2`}function zi(e){let t=e.src.map(e=>Ii(e.url,e.format)).join(`, `),n=(e.declarations??[]).map(e=>` ${e.prop}: ${e.value};`).join(`
|
|
50
|
+
`),r=`@font-face {\n font-family: "${Fi(e.family)}";\n src: ${t};\n font-display: ${e.display};\n font-weight: ${e.weight};\n font-style: ${e.style};\n`;return e.unicodeRange!=null&&e.unicodeRange!==``&&(r+=` unicode-range: ${e.unicodeRange};\n`),n!==``&&(r+=`${n}\n`),r+=`}
|
|
51
|
+
`,r}function Bi(e,t,n,r=`sans-serif`){let i=[`"${Fi(e)}"`];n&&i.push(`"${Fi(`${e} Fallback`)}"`);for(let e of t??[])i.push(e.includes(` `)?`"${Fi(e)}"`:e);return Pi(t)||i.push(r),i.join(`, `)}function Vi(e){return e??`swap`}function Hi(e){return e==null?`400`:String(e)}function Ui(e){return e??`normal`}const Wi=/* @__PURE__ */ new Map,Gi=/* @__PURE__ */ new Map;function Ki(e){return!u(e)||!Array.isArray(e.familyMetadataList)?!1:e.familyMetadataList.every(e=>u(e)&&typeof e.family==`string`&&e.family!==``)}function qi(e){let t=e.replace(/^\)\]\}'\n?/,``);return JSON.parse(t)}function Ji(e){return[...new Set(e)].sort((e,t)=>e.localeCompare(t))}function Yi(e){let t=Ji((e.subsets??[]).filter(e=>e!==`menu`&&e!==``)),n=(e.axes??[]).filter(e=>typeof e.tag==`string`&&e.tag!==``&&typeof e.min==`number`&&typeof e.max==`number`).map(e=>({tag:e.tag,min:e.min,max:e.max})).sort((e,t)=>e.tag.localeCompare(t.tag));return{family:e.family,subsets:t,axisRanges:n}}function Xi(e){if(!Ki(e))throw Error(`Unexpected fonts.google.com/metadata/fonts shape`);let t=/* @__PURE__ */ new Map;for(let n of e.familyMetadataList){let e=Yi(n);t.set(e.family,e)}return t}async function Zi(e){let t=Wi.get(e);if(t!=null)return t;let n=Gi.get(e);if(n!=null)return n;let r=Promise.resolve().then(async()=>{let t=O.join(e,`google-fonts-metadata.json`);if(E.existsSync(t))try{let n=Xi(qi(E.readFileSync(t,`utf8`)));return Wi.set(e,n),n}catch{try{E.unlinkSync(t)}catch{}}let n=await fetch(`https://fonts.google.com/metadata/fonts`,{headers:{"User-Agent":`rari-google-font-meta`},signal:AbortSignal.timeout(3e4)});if(!n.ok)throw Error(`Failed to fetch Google font metadata: ${n.status} ${n.statusText}`);let r=await n.text(),i=Xi(qi(r));return Ei(e),E.writeFileSync(t,r.replace(/^\)\]\}'\n?/,``)),Wi.set(e,i),i});return Gi.set(e,r),r.finally(()=>{Gi.get(e)===r&&Gi.delete(e)})}async function Qi(e,t){try{return(await Zi(e)).get(t)??null}catch(e){return console.warn(`[rari/font] Failed to load Google font metadata for ${t}:`,e),null}}function $i(e,t,n){let r=t.subsets!=null&&t.subsets.length>0,i=r?t.preload!==!1:t.preload===!0,a=t.subsets;if(i&&!r&&console.warn(`[rari/font] ${e}: \`preload\` is true but no \`subsets\` were specified. Specify subsets to avoid downloading unused glyphs, or set \`preload: false\`.`),a==null||a.length===0||n==null||n.length===0)return;let o=new Set(n.map(e=>e.toLowerCase())),s=[...new Set(a.map(e=>e.toLowerCase())).difference(o)];s.length!==0&&console.warn(`[rari/font] ${e}: unknown subset(s) ${s.map(e=>JSON.stringify(e)).join(`, `)}. Available: ${n.join(`, `)}`)}const ea=1e4,ta=/* @__PURE__ */ new Set([`fonts.gstatic.com`]);function na(e){let t=URL.parse(e);if(t==null)throw Error(`Invalid Google font URL: ${e}`);if(t.protocol!==`https:`)throw Error(`Google font URL must use HTTPS: ${e}`);if(!ta.has(t.hostname))throw Error(`Google font URL host not allowlisted (${t.hostname}): ${e}. Allowed: ${[...ta].join(`, `)}`);return t}function ra(e){return e.subsets!=null&&e.subsets.length>0?e.preload!==!1:e.preload===!0}function ia(e){return e.trim().replaceAll(` `,`+`)}function aa(e){if(e==null)return[`400`];if(Array.isArray(e)){let t=e.map(String);return t.length>0?t:[`400`]}return[String(e)]}const oa=/^(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)$/;function sa(e){return oa.test(e.trim())}function ca(e){return e===`variable`||typeof e==`string`&&sa(e)?!0:Array.isArray(e)?e.some(e=>e===`variable`||typeof e==`string`&&sa(e)):!1}function la(e){if(typeof e==`string`){let t=oa.exec(e.trim());if(t!=null)return`${t[1]}..${t[2]}`}if(Array.isArray(e))for(let t of e){if(typeof t!=`string`)continue;let e=oa.exec(t.trim());if(e!=null)return`${e[1]}..${e[2]}`}return`100..900`}function ua(e,t){if(e==null)return null;let n=e.find(e=>e.tag===t);return n==null?null:`${n.min}..${n.max}`}function da(e,t){if(ca(e))return fa(e,t);if(e!=null){let t=aa(e);if(t.length===1)return`${t[0]}..${t[0]}`}return ua(t,`wght`)??`100..900`}function fa(e,t){if(typeof e==`string`&&sa(e))return la(e);if(Array.isArray(e)){for(let t of e)if(typeof t==`string`&&sa(t))return la(t)}return ua(t,`wght`)??la(e)}function pa(e){if(e==null)return[`normal`];if(typeof e==`string`)return[e];let t=e.filter(e=>e!==``);return t.length>0?[...t]:[`normal`]}function ma(e){let t=(e.axes??[]).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t)n.includes(e)||n.push(e);return n}function ha(e){return e==null||ca(e)?null:aa(e)}function ga(e,t,n){let r=ia(e),i=Vi(t.display),a=pa(t.style),o=a.includes(`italic`),s=a.includes(`normal`)||!o,c=ma(t);return`https://fonts.googleapis.com/css2?family=${r}:${ca(t.weight)||c.length>0?_a(t,n,c,o,s):ba(t.weight,o,s)}&display=${i}`}function _a(e,t,n,r,i){let a=[`wght`,...n.filter(e=>e!==`wght`&&e!==`ital`)].sort((e,t)=>e.localeCompare(t)),o=ha(e.weight),s=(e,n)=>e===`wght`?n:ua(t,e)??`1..1000`;if(o!=null)return va(a,o,s,r,i);let c=da(e.weight,t);return ya(a,a.map(e=>s(e,c)),r,i)}function va(e,t,n,r,i){let a=t.map(t=>e.map(e=>n(e,t)).join(`,`));return r&&i?`ital,${e.join(`,`)}@${[...a.map(e=>`0,${e}`),...a.map(e=>`1,${e}`)].join(`;`)}`:r?`ital,${e.join(`,`)}@${a.map(e=>`1,${e}`).join(`;`)}`:e.length===1&&e[0]===`wght`?`wght@${t.join(`;`)}`:`${e.join(`,`)}@${a.join(`;`)}`}function ya(e,t,n,r){return n&&r?`ital,${e.join(`,`)}@0,${t.join(`,`)};1,${t.join(`,`)}`:n?`ital,${e.join(`,`)}@1,${t.join(`,`)}`:e.length===1&&e[0]===`wght`?`wght@${t[0]}`:`${e.join(`,`)}@${t.join(`,`)}`}function ba(e,t,n){let r=aa(e);return t&&n?`ital,wght@${[...r.map(e=>`0,${e}`),...r.map(e=>`1,${e}`)].join(`;`)}`:t?`ital,wght@${r.map(e=>`1,${e}`).join(`;`)}`:`wght@${r.join(`;`)}`}function xa(e){let t=[],n=e.split(`@font-face`);for(let e=1;e<n.length;e+=1){let r=n[e-1]??``,i=n[e]??``,a=i.indexOf(`{`),o=i.indexOf(`}`,a);if(a===-1||o===-1)continue;let s=i.slice(a+1,o),c=/\/\*\s*([\w-]+)\s*\*\/\s*$/.exec(r)?.[1]??null,l=/font-family:\s*'([^']+)'/.exec(s)?.[1]??/font-family:\s*"([^"]+)"/.exec(s)?.[1],u=/font-style:\s*([^;\s]+)\s*;/.exec(s)?.[1]??`normal`,d=/font-weight:([^;]+);/.exec(s)?.[1]?.trim()??`400`,f=/src:\s*url\(([^)]+)\)/.exec(s)?.[1]?.replaceAll(/['"]/g,``),p=/unicode-range:([^;]+);/.exec(s)?.[1]?.trim()??null;l!=null&&f!=null&&f!==``&&t.push({family:l,style:u,weight:d,url:f,subset:c,unicodeRange:p})}return t}function Sa(e,t){if(t==null||t.length===0)return[...e];let n=new Set(t.map(e=>e.toLowerCase()));return e.filter(e=>e.subset!=null&&n.has(e.subset.toLowerCase()))}async function Ca(e,t){if(E.existsSync(t))return E.readFileSync(t);let n=na(e).href,r=null;for(let e=0;e<=3;e+=1){let e=await fetch(n,{signal:AbortSignal.timeout(ea),redirect:`manual`});if(e.status>=300&&e.status<400){let t=e.headers.get(`location`);if(t==null||t===``)throw Error(`Font download redirect missing Location from ${n}`);n=na(new URL(t,n).href).href;continue}r=e;break}if(r==null)throw Error(`Too many redirects downloading font ${e}`);if(!r.ok)throw Error(`Failed to download font ${e}: ${r.status} ${r.statusText}`);let i=Buffer.from(await r.arrayBuffer());return Ei(O.dirname(t)),E.writeFileSync(t,i),i}async function wa(e,t,n){let r=await Qi(n,e);$i(e,t,r?.subsets);let i=ga(e,t,r?.axisRanges),a=O.join(n,`${P(i)}.css`),o;if(E.existsSync(a))o=E.readFileSync(a,`utf8`);else{let t=await fetch(i,{headers:{"User-Agent":`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`},signal:AbortSignal.timeout(ea)});if(!t.ok)throw Error(`Failed to fetch Google Font CSS for ${e}: ${t.status} ${t.statusText}`);o=await t.text(),Ei(n),E.writeFileSync(a,o)}let s=Sa(xa(o),t.subsets);if(s.length===0)throw Error(`No @font-face rules returned for Google font "${e}"`);let c=Vi(t.display),l=ra(t),u=[];for(let r of s){let i=na(r.url),a=P(r.url),o=O.extname(i.pathname)||`.woff2`,s=`${e.replaceAll(/\s+/g,``)}-${r.weight}-${r.style}-${a}${o}`,d=O.join(n,s);await Ca(r.url,d),u.push({family:r.family,style:Ui(r.style),weight:Hi(r.weight),display:c,src:[{url:``,format:Li(d)}],preload:l,variable:t.variable,fallback:t.fallback,adjustFontFallback:t.adjustFontFallback!==!1&&void 0,unicodeRange:r.unicodeRange??void 0,filePaths:[d]})}return u}function Ta(e){return e.replaceAll(`_`,` `)}function Ea(e){return typeof e==`string`?[{path:e}]:e.map(e=>({...e}))}function Da(e,t,n){let r=Vi(e.display),i=e.preload!==!1,a=Ea(e.src);if(a.length===0)throw Error("rari/font/local: `src` must include at least one font file");let o=a.map(r=>{let i=O.isAbsolute(r.path)?r.path:O.resolve(t,r.path);if(!E.existsSync(i))throw Error(`rari/font/local: font file not found: ${r.path} (from ${t})`);let a=O.relative(n,i);if(a.startsWith(`..`)||O.isAbsolute(a))throw Error(`rari/font/local: font file must be inside the project: ${r.path}`);return{absolute:i,weight:Hi(r.weight??e.weight),style:Ui(r.style??e.style),familyBase:O.basename(i,O.extname(i))}}),s=o[0].familyBase;return o.map(t=>({family:s,style:t.style,weight:t.weight,display:r,src:[{url:``,format:Li(t.absolute)}],preload:i,variable:e.variable,fallback:e.fallback,adjustFontFallback:e.adjustFontFallback,declarations:e.declarations,filePaths:[t.absolute]}))}function Oa(e,t){if(e[t]!==`{`)return null;try{let{json:n,end:r}=ka(e,t);return typeof n!=`object`||!n||Array.isArray(n)?null:{value:n,end:r}}catch{return null}}function U(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]??``);)n+=1;return n}function ka(e,t){let n=U(e,t),r=e[n];if(r===`{`)return Na(e,n);if(r===`[`)return Ma(e,n);if(r===`'`||r===`"`)return Aa(e,n);if(r===`-`||r>=`0`&&r<=`9`)return ja(e,n);if(e.startsWith(`true`,n))return{json:!0,end:n+4};if(e.startsWith(`false`,n))return{json:!1,end:n+5};if(e.startsWith(`null`,n))return{json:null,end:n+4};throw Error(`Unsupported token at ${n}`)}function Aa(e,t){let n=e[t],r=t+1,i=``;for(;r<e.length;){let t=e[r];if(t===`\\`){if(r+1>=e.length)throw Error(`Unterminated string escape`);i+=e[r+1],r+=2;continue}if(t===n)return{json:i,end:r+1};i+=t,r+=1}throw Error(`Unterminated string`)}function ja(e,t){let n=/^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/i.exec(e.slice(t));if(n==null)throw Error(`Invalid number`);return{json:Number(n[0]),end:t+n[0].length}}function Ma(e,t){let n=[],r=U(e,t+1);if(e[r]===`]`)return{json:n,end:r+1};for(;r<e.length;){let t=ka(e,r);if(n.push(t.json),r=U(e,t.end),e[r]===`,`){if(r=U(e,r+1),e[r]===`]`)return{json:n,end:r+1};continue}if(e[r]===`]`)return{json:n,end:r+1};throw Error(`Expected comma or ]`)}throw Error(`Unterminated array`)}function Na(e,t){let n={},r=U(e,t+1);if(e[r]===`}`)return{json:n,end:r+1};for(;r<e.length;){let t=Pa(e,r),i=t.key;if(r=t.end,e[r]!==`:`)throw Error(`Expected :`);let a=ka(e,r+1);if(n[i]=a.json,r=U(e,a.end),e[r]===`,`){if(r=U(e,r+1),e[r]===`}`)return{json:n,end:r+1};continue}if(e[r]===`}`)return{json:n,end:r+1};throw Error(`Expected comma or }`)}throw Error(`Unterminated object`)}function Pa(e,t){let n=t;if(e[n]===`'`||e[n]===`"`){let t=Aa(e,n);return{key:t.json,end:U(e,t.end)}}let r=/^[A-Z_$][\w$]*/i.exec(e.slice(n));if(r==null)throw Error(`Expected property name`);return{key:r[0],end:U(e,n+r[0].length)}}const Fa=`rari/font/local`,Ia=`rari/font/google`,La=`\0rari-font-css:`,Ra=/\.(?:woff2?|ttf|otf)$/i;function za(e){if(e!=null){if(typeof e==`string`)return[e];if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}}function Ba(e){if(e===`auto`||e===`block`||e===`swap`||e===`fallback`||e===`optional`)return e}function Va(e){let t=e.src,n;if(typeof t==`string`)n=t;else if(Array.isArray(t))n=t.map(e=>{if(typeof e==`string`)return{path:e};if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`rari/font/local: invalid src entry`);let t=e.path;if(typeof t!=`string`)throw Error(`rari/font/local: src.path must be a string`);return{path:t,weight:typeof e.weight==`string`||typeof e.weight==`number`?e.weight:void 0,style:typeof e.style==`string`?e.style:void 0}});else throw TypeError("rari/font/local: `src` is required");return{src:n,display:Ba(e.display),weight:typeof e.weight==`string`||typeof e.weight==`number`?e.weight:void 0,style:typeof e.style==`string`?e.style:void 0,variable:typeof e.variable==`string`?e.variable:void 0,preload:typeof e.preload==`boolean`?e.preload:void 0,fallback:za(e.fallback),adjustFontFallback:e.adjustFontFallback===!1?!1:e.adjustFontFallback===`Arial`||e.adjustFontFallback===`Times New Roman`?e.adjustFontFallback:void 0,declarations:Ha(e.declarations)}}function Ha(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(typeof n!=`object`||!n||Array.isArray(n))continue;let e=n.prop,r=n.value;typeof e==`string`&&typeof r==`string`&&t.push({prop:e,value:r})}return t.length>0?t:void 0}function Ua(e){let t=e.weight,n=e.style;return{weight:typeof t==`string`||typeof t==`number`?t:Array.isArray(t)?t.filter(e=>typeof e==`string`||typeof e==`number`):void 0,style:typeof n==`string`?n:Array.isArray(n)?n.filter(e=>typeof e==`string`):void 0,subsets:za(e.subsets),display:Ba(e.display),variable:typeof e.variable==`string`?e.variable:void 0,preload:typeof e.preload==`boolean`?e.preload:void 0,fallback:za(e.fallback),adjustFontFallback:typeof e.adjustFontFallback==`boolean`?e.adjustFontFallback:void 0,axes:za(e.axes)}}function Wa(e,t){let n=0;for(let r=t;r<e.length;r+=1){let t=e[r];if(t===`(`)n+=1;else if(t===`)`&&(--n,n===0))return r}return-1}async function Ga(e){try{let t=await Me(E.readFileSync(e));return{ascent:t.ascent,descent:t.descent,lineGap:t.lineGap,unitsPerEm:t.unitsPerEm,xWidthAvg:t.xWidthAvg}}catch{return null}}async function Ka(e,t){let n=await Ai(t);if(e.adjustFontFallback===!1)return{overrides:null,metrics:n};let r=e.adjustFontFallback===`Arial`||e.adjustFontFallback===`Times New Roman`?e.adjustFontFallback:null;return n??=await Ga(e.filePaths[0]),n==null?{overrides:null,metrics:n}:(r??=ji(n.category),{overrides:ki(n,r),metrics:n})}function qa(e,t){return t==null?``:`@font-face {\n font-family: "${e} Fallback";\n src: local("${t.fallbackFont}");\n ascent-override: ${t.ascentOverride};\n descent-override: ${t.descentOverride};\n line-gap-override: ${t.lineGapOverride};\n size-adjust: ${t.sizeAdjust};\n}\n`}async function Ja(e,t,n){let r=[],i=[],a=[];for(let o of e){if(o.filePaths.length===0)continue;let e=o.filePaths[0],s=E.readFileSync(e),c=P(s);a.push(c);let l=wi(e,c,t);r.push({fileName:l,source:s}),i.push({...o,family:n,src:[{url:Ti(l),format:o.src[0]?.format??`woff2`}]})}if(i.length===0)throw Error(`rari/font: no font files resolved`);let o=i[0],s=JSON.stringify({display:o.display,weight:i.map(e=>e.weight),style:i.map(e=>e.style),fallback:o.fallback??null,adjustFontFallback:o.adjustFontFallback??null,declarations:o.declarations??null,unicodeRange:i.map(e=>e.unicodeRange??null),variable:o.variable??null}),c=P(`${a.join(`|`)}|${n}|${s}`),l=Di(`rari_font`,c),u=o.variable==null?null:Di(`rari_font_var`,c),d=await Ka(o,n),f=d.overrides,p=d.metrics,m=``;for(let e of i)m+=zi(e);m+=qa(n,f);let h=Bi(n,o.fallback,f!=null,Ni(p?.category));m+=`.${l} {\n font-family: ${h};\n}\n`,o.variable!=null&&u!=null&&(m+=`.${u} {\n ${o.variable}: ${h};\n}\n`);let g=Number(o.weight),_={className:l,style:{fontFamily:h,fontWeight:Number.isFinite(g)?g:o.weight,fontStyle:o.style===`normal`?void 0:o.style},variable:u??void 0},v=i.filter(e=>e.preload).flatMap(e=>e.src.map(e=>e.url)).filter(e=>e!==``);return{font:_,css:m,cssId:`${La}${c}.css`,assets:r,preloadUrls:v}}function Ya(e){let t=[];for(let n=0;n<e.length;n+=1)t.push(!0);let n=(e,n)=>{for(let r=e;r<n;r+=1)t[r]=!1},r=0;for(;r<e.length;){let t=Xa(e,r);if(t!=null){n(r,t),r=t;continue}r+=1}return t}function Xa(e,t){let n=e.charCodeAt(t);if(n===47&&e.charCodeAt(t+1)===47){let n=e.indexOf(`
|
|
52
|
+
`,t+2);return n===-1?e.length:n}if(n===47&&e.charCodeAt(t+1)===42){let n=e.indexOf(`*/`,t+2);return n===-1?e.length:n+2}return n===34||n===39||n===96?so(e,t):null}function Za(e,t){let n=Ya(e),r=t.replaceAll(`/`,`\\/`),i=RegExp(`import\\s+(\\w+)\\s*,\\s*\\{([^}]+)\\}\\s*from\\s*['"]${r}['"]`,`g`),a=RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*['"]${r}['"]`,`g`),o=RegExp(`import\\s+(\\w+)\\s*from\\s*['"]${r}['"]`,`g`),s=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.split(/\s+as\s+/),n=t[0]?.trim()??``;return{imported:n,local:t[1]?.trim()??n}}).filter(e=>e.imported!==``&&e.local!==``),c=[],l=[],u=[],d=e=>u.some(t=>e>=t.start&&e<t.end);for(let t of e.matchAll(i))n[t.index]&&!d(t.index)&&(u.push({start:t.index,end:t.index+t[0].length}),l.push(t[1]),c.push(...s(t[2])));for(let t of e.matchAll(a))n[t.index]&&!d(t.index)&&(u.push({start:t.index,end:t.index+t[0].length}),c.push(...s(t[1])));for(let t of e.matchAll(o))n[t.index]&&!d(t.index)&&(u.push({start:t.index,end:t.index+t[0].length}),l.push(t[1]));return{names:c.filter(e=>e.imported!==``),defaultNames:l.filter(e=>e!==``),statements:u}}function Qa(e,t){let n=Ya(e),r=t.replaceAll(`/`,`\\/`),i=RegExp(`import\\s+\\*\\s+as\\s+\\w+\\s+from\\s*['"]${r}['"]`,`g`),a=RegExp(`import\\s*['"]${r}['"]`,`g`);for(let t of e.matchAll(i))if(n[t.index])return!0;for(let t of e.matchAll(a))if(n[t.index])return!0;return!1}function $a(e){let t=[`fontFamily: ${JSON.stringify(e.style.fontFamily)}`,e.style.fontWeight==null?null:`fontWeight: ${JSON.stringify(e.style.fontWeight)}`,e.style.fontStyle==null?null:`fontStyle: ${JSON.stringify(e.style.fontStyle)}`].filter(Boolean),n=e.variable==null?``:` variable: ${JSON.stringify(e.variable)},\n`;return`{\n className: ${JSON.stringify(e.className)},\n style: { ${t.join(`, `)} },\n${n}}`}function eo(e){return e>=65&&e<=90||e>=97&&e<=122||e===36||e===95||e>=128}function to(e){return eo(e)||e>=48&&e<=57}function no(e,t){let n=e.indexOf(`
|
|
53
|
+
`,t+2);return n===-1?e.length:n+1}function ro(e,t){let n=e.indexOf(`*/`,t+2);return n===-1?e.length:n+2}function io(e,t){let n=t,r=1;for(;n<e.length&&r>0;){let t=e.charCodeAt(n);if(t===34||t===39||t===96){n=so(e,n);continue}if(t===47&&e.charCodeAt(n+1)===47){n=no(e,n);continue}if(t===47&&e.charCodeAt(n+1)===42){n=ro(e,n);continue}t===123?r+=1:t===125&&--r,n+=1}return n}function ao(e,t,n){let r=t+1;for(;r<e.length;){let t=e.charCodeAt(r);if(t===92){r+=2;continue}if(t===n)return r+1;r+=1}return r}function oo(e,t){let n=t+1;for(;n<e.length;){let t=e.charCodeAt(n);if(t===92){n+=2;continue}if(t===96)return n+1;if(t===36&&e.charCodeAt(n+1)===123){n=io(e,n+2);continue}n+=1}return n}function so(e,t){let n=e.charCodeAt(t);return n===96?oo(e,t):ao(e,t,n)}function co(e,t){let n=e.charCodeAt(t);return n===47&&e.charCodeAt(t+1)===47?no(e,t):n===47&&e.charCodeAt(t+1)===42?ro(e,t):n===34||n===39||n===96?so(e,t):null}function lo(e,t,n){if(!eo(e.charCodeAt(n))||!e.startsWith(t,n))return null;let r=n+t.length,i=n===0?0:e.charCodeAt(n-1);if(n!==0&&to(i)||r<e.length&&to(e.charCodeAt(r)))return null;let a=r;for(;a<e.length&&(e[a]===` `||e[a]===` `||e[a]===`
|
|
54
|
+
`||e[a]===`\r`);)a+=1;return e[a]===`(`?{start:n,openParen:a}:null}function uo(e,t){let n=[],r=0;for(;r<e.length;){let i=co(e,r);if(i!=null){r=i;continue}let a=lo(e,t,r);if(a!=null){n.push(a),r=a.openParen+1;continue}r+=1}return n}async function fo(e,t,n,r){if(!e.includes(`rari/font/`))return null;let i=Za(e,Fa),a=Za(e,Ia);if(Qa(e,Fa)||Qa(e,Ia))throw Error("rari/font only supports default imports from `rari/font/local` and named imports from `rari/font/google` (optionally with `as`). Namespace and side-effect imports are not supported.");if(i.statements.length===0&&a.statements.length===0)return null;let o=e,s=[],c=[],l=[],u=/* @__PURE__ */ new Set,d=O.dirname(t),f=O.join(n,`node_modules`,`.cache`,`rari-fonts`),p=[...i.statements,...a.statements].map(e=>({start:e.start,end:e.end})),m=(e,t,n)=>{for(let e of p)e.start>=t&&(e.start+=n,e.end+=n)},h=async(e,t)=>{let n=t=>{throw Error(`rari/font: failed to transform \`${e}()\` call: ${t}`)};for(let r of uo(o,e).sort((e,t)=>t.start-e.start)){let e=Wa(o,r.openParen);e===-1&&n(`unbalanced parentheses`);let i=po(o,r.openParen,e,n),a=await t(i.optionsLiteral);s.push({id:a.cssId,css:a.css}),u.add(a.cssId);for(let e of a.assets)c.push(e);for(let e of a.preloadUrls)l.includes(e)||l.push(e);let d=$a(a.font);m(r.start,i.spliceEnd,d.length-(i.spliceEnd-r.start)),o=o.slice(0,r.start)+d+o.slice(i.spliceEnd)}};for(let e of i.defaultNames)await h(e,async e=>{if(e==null)throw Error(`rari/font/local: options object required`);let t=Da(Va(e),d,n),i=`Rari ${O.basename(t[0].filePaths[0],O.extname(t[0].filePaths[0]))}`;return Ja(t.map(e=>Object.assign({},e,{family:i})),r,i)});for(let e of a.names)await h(e.local,async t=>{let n=t==null?{}:Ua(t),i=Ta(e.imported);return Ja(await wa(i,n,f),r,i)});let g=[...i.defaultNames,...a.names.map(e=>e.local)];for(let e of g)if(uo(o,e).length>0)throw Error(`rari/font: failed to transform all \`${e}()\` calls; leaving imports in place`);for(let e of p.sort((e,t)=>t.start-e.start))o=o.slice(0,e.start)+o.slice(e.end);let _=[...u].map(e=>`import ${JSON.stringify(e)};`).join(`
|
|
55
|
+
`);return _!==``&&(o=go(o,_)),o===e?null:{code:o,cssModules:s,assets:c,preloadUrls:l}}function po(e,t,n,r){let i=e.slice(t+1,n).trim();if(i===``)return{optionsLiteral:null,spliceEnd:n+1};i.startsWith(`{`)||r(`options must be a static object literal`);let a=Oa(e,e.indexOf(`{`,t));a??r(`options must be a static object literal`);let o=a.end;for(;o<e.length&&/\s/.test(e[o]??``);)o+=1;return e[o]!==`)`&&r(`options must be a static object literal`),{optionsLiteral:a.value,spliceEnd:o+1}}function mo(e,t){let n=t;for(;n<e.length;){let t=e[n];if(t===` `||t===` `||t===`\r`||t===`
|
|
56
|
+
`){n+=1;continue}if(t===`/`&&e[n+1]===`/`){n=no(e,n);continue}if(t===`/`&&e[n+1]===`*`){n=ro(e,n);continue}break}return n}function ho(e,t){let n=e[t];if(n!==`'`&&n!==`"`||!e.startsWith(`use client`,t+1)&&!e.startsWith(`use server`,t+1)||e[t+11]!==n)return null;let r=t+12;return e[r]===`;`&&(r+=1),mo(e,r)}function go(e,t){let n=+(e.charCodeAt(0)===65279),r=0;for(;;){n=mo(e,n);let t=ho(e,n);if(t==null)break;n=t,r=n}return r===0?`${t}\n${e}`:`${e.slice(0,r)}${t}\n${e.slice(r)}`}function _o(e){return e===`.woff`?`font/woff`:e===`.ttf`?`font/ttf`:e===`.otf`?`font/otf`:`font/woff2`}function vo(e){return e===`.woff`?`woff`:e===`.ttf`?`truetype`:e===`.otf`?`opentype`:`woff2`}function yo(e,t){let n=O.resolve(e,t),r;try{r=E.realpathSync(e)}catch{r=O.resolve(e)}let i;try{i=E.realpathSync(n)}catch{return null}let a=O.relative(r,i);if(a.startsWith(`..`)||O.isAbsolute(a))return null;try{if(!E.statSync(i).isFile()||!Ra.test(i))return null}catch{return null}return i}function bo(){let e=process.cwd(),t=`assets`,n=O.join(e,`dist`,`client`),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map;return{name:`rari:font`,enforce:`pre`,configResolved(r){let i=Ut(r);e=i.projectRoot,t=i.assetsDir,n=i.outDir},resolveId(e){return e.startsWith(La)?e:null},load(e){return e.startsWith(La)?r.get(e)??null:null},async transform(n,a){let o=await fo(n,a,e,t);if(o==null)return null;for(let e of o.cssModules)r.set(e.id,e.css);for(let e of o.assets)i.set(e.fileName,e.source);for(let e of o.preloadUrls)Rr(`<link rel="preload" href="${e}" as="font" type="${Ri(vo(O.extname(e).toLowerCase()))}" crossorigin />`);return{code:o.code,map:null}},generateBundle(){for(let[e,t]of i)this.emitFile({type:`asset`,fileName:e,source:t})},configureServer(e){e.middlewares.use((e,t,r)=>{let a=e.url?.split(`?`)[0];if(a==null||a===``){r();return}let o;try{o=decodeURIComponent(a.replace(/^\//,``))}catch{r();return}let s=i.get(o);if(s!=null){t.setHeader(`Content-Type`,_o(O.extname(o).toLowerCase())),t.setHeader(`Cache-Control`,`no-cache`),t.end(s);return}let c=yo(n,o);if(c==null){r();return}t.setHeader(`Content-Type`,_o(O.extname(c).toLowerCase())),t.setHeader(`Cache-Control`,`no-cache`),E.createReadStream(c).pipe(t)})}}}var xo=class extends Error{status;statusText;bodyPreview;constructor(e,t,n){super(`HTTP ${e}: ${t}`),this.name=`HttpError`,this.status=e,this.statusText=t,this.bodyPreview=n}};async function So(e){if(!e.ok){let t;try{t=await e.text()}catch{t=`<unable to read response body>`}let n=t.length>200?`${t.slice(0,200)}...`:t;throw new xo(e.status,e.statusText,n)}}var Co=class{errorCount=0;maxErrors;resetTimeout;resetTimer=null;lastError=null;constructor(e={}){this.maxErrors=e.maxErrors??5,this.resetTimeout=e.resetTimeout??3e4}recordError(e){this.errorCount++,this.lastError=e,this.resetTimer=_e(this.resetTimer),this.resetTimer=setTimeout(()=>{this.reset()},this.resetTimeout),this.errorCount>=this.maxErrors&&this.handleMaxErrorsReached()}reset(){this.errorCount=0,this.lastError=null,this.resetTimer=_e(this.resetTimer)}getErrorCount(){return this.errorCount}getLastError(){return this.lastError}hasReachedMaxErrors(){return this.errorCount>=this.maxErrors}handleMaxErrorsReached(){console.error(`[rari] HMR: Maximum error count (${this.maxErrors}) reached. Consider restarting the dev server if issues persist.`)}dispose(){this.reset()}};function wo(e,t,n){let r=new Set(t),i=/* @__PURE__ */ new Set,a=[...t];for(;a.length>0;){let t=a.pop();if(t==null)break;let o=e.get(t);if(o)for(let e of o)r.has(e)||(r.add(e),a.push(e),(n==null||n(e))&&i.add(e))}return i}function To(e){return u(e)&&e.success===!0&&typeof e.componentId==`string`&&typeof e.filePath==`string`&&typeof e.relativePath==`string`}function Eo(e){return u(e)&&e.success===!1&&typeof e.filePath==`string`&&typeof e.relativePath==`string`&&o(e.error)}function Do(e){return e===`info`||e===`success`||e===`warning`||e===`error`}var Oo=class{serverComponentBuilder;rustServerUrl;pendingUpdates=/* @__PURE__ */ new Map;pendingFiles=/* @__PURE__ */ new Set;batchTimer=null;DEBOUNCE_DELAY=200;errorHandler;logBatch=[];logBatchTimer=null;LOG_BATCH_DELAY=500;constructor(e,t=M()){this.serverComponentBuilder=e,this.rustServerUrl=`http://localhost:${t}`,this.errorHandler=new Co({maxErrors:5,resetTimeout:3e4})}getErrorCount(){return this.errorHandler.getErrorCount()}async handleClientComponentUpdate(e,t){let n=O.relative(k.cwd(),e);try{let r=t.moduleGraph.getModuleById(e);r?(t.moduleGraph.invalidateModule(r),this.errorHandler.reset()):this.queueLog(`warning`,`Client component module not found in graph: ${n}`)}catch(e){let t=c(e,String(e));this.queueLog(`error`,`Failed to update client component: ${n} - ${t}`),this.errorHandler.recordError(d(e))}return Promise.resolve()}async rebuildAndNotifyNow(e,t){this.serverComponentBuilder.invalidateBuildCacheFor(e);let n=await this.serverComponentBuilder.rebuildComponent(e);if(!n.success)throw Error(n.error!=null&&n.error!==``?n.error:`Build failed`);return await this.notifyRustServer(n.componentId,n.bundlePath),t?.hot.send(`rari:server-component-updated`,{id:n.componentId,t:Date.now()}),n}async handleServerComponentUpdate(e,t){this.pendingFiles.add(e);let n=this.pendingUpdates.get(e);return n&&(clearTimeout(n),this.pendingUpdates.delete(e)),this.batchTimer&&clearTimeout(this.batchTimer),this.batchTimer=setTimeout(()=>{(async()=>{let e=[...this.pendingFiles];if(this.pendingFiles.clear(),this.batchTimer=null,e.length===0)return;let n=this.collectDependentPageComponents(e);for(let e of n)this.serverComponentBuilder.invalidateBuildCacheFor(e);let r=[...e,...n],i=await Promise.allSettled(r.map(async e=>{let t=O.relative(k.cwd(),e);try{let n=await this.serverComponentBuilder.rebuildComponent(e);if(!n.success)throw Error(n.error!=null&&n.error!==``?n.error:`Build failed`);return await this.notifyRustServer(n.componentId,n.bundlePath),{success:!0,componentId:n.componentId,filePath:e,relativePath:t}}catch(n){return{success:!1,filePath:e,relativePath:t,error:d(n)}}})),a=[],o=[];if(i.forEach(e=>{e.status===`fulfilled`&&To(e.value)?a.push(e.value):e.status===`fulfilled`&&Eo(e.value)?o.push(e.value):e.status===`rejected`&&o.push({filePath:``,relativePath:`unknown`,error:Error(String(e.reason))})}),a.length>0){let e=Date.now();a.forEach(({componentId:n})=>{t.hot.send(`rari:server-component-updated`,{id:n,t:e})}),this.errorHandler.reset(),t.ws.send({type:`custom`,event:`rari:hmr-error-cleared`,data:{t:e}})}if(o.length>0){let e=Date.now();o.forEach(({relativePath:n,error:r})=>{let i=r.message,a=(r.stack!=null&&r.stack!==``?r.stack:``).substring(0,500);this.queueLog(`error`,`Failed to rebuild: ${n} - ${i}`),this.errorHandler.recordError(r),t.ws.send({type:`custom`,event:`rari:hmr-error`,data:{msg:i,stack:a,file:n,t:e,count:this.errorHandler.getErrorCount(),max:5}})}),this.errorHandler.hasReachedMaxErrors()&&this.queueLog(`error`,`Maximum error count reached (${this.errorHandler.getErrorCount()}). Consider restarting the dev server if issues persist.`)}})()},this.DEBOUNCE_DELAY),Promise.resolve()}relativeBundlePathInsideProject(e){let t=w(e);if(!O.isAbsolute(e))return t;let n=w(O.relative(this.serverComponentBuilder.getProjectRoot(),e));if(n.startsWith(`..`)||O.isAbsolute(n))throw Error(`Bundle path must be inside the project root: ${e}`);return n}assertSuccessfulHmrResponse(e,t,n){if(!u(e))throw Error(`Invalid server response (status ${n}): expected object, got ${typeof e}. Response body: ${t.substring(0,200)}${t.length>200?`...`:``}`);if(e.success===!0)return;let r=typeof e.message==`string`&&e.message!==``?e.message:typeof e.error==`string`&&e.error!==``?e.error:`Component reload failed`;throw Error(r)}async notifyRustServer(e,t){let n=this.relativeBundlePathInsideProject(t);try{let t=await fetch(`${this.rustServerUrl}/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`reload-component`,component_id:e,bundle_path:n})});await So(t);let r=await t.text(),i;try{i=JSON.parse(r)}catch(e){throw Error(`Failed to parse server response (status ${t.status}): ${c(e,String(e))}. Response body: ${r.substring(0,200)}${r.length>200?`...`:``}`)}this.assertSuccessfulHmrResponse(i,r,t.status)}catch(e){throw console.error(`[rari] HMR: Failed to notify Rust server:`,e),e}}collectDependentPageComponents(e){return[...wo(this.serverComponentBuilder.getImportGraph(),e,e=>e.includes(`/app/`)||e.includes(`\\app\\`))]}detectComponentType(e){try{return this.serverComponentBuilder.getModuleAnalysis(e).topLevelUseClient?`client`:`server`}catch{return`unknown`}}queueLog(e,t){this.logBatch.push({type:e,message:t,timestamp:Date.now()}),this.logBatchTimer&&clearTimeout(this.logBatchTimer),this.logBatchTimer=setTimeout(()=>{this.flushLogs()},this.LOG_BATCH_DELAY)}flushLogs(){if(this.logBatch.length===0)return;let e=this.logBatch.reduce((e,t)=>(e[t.type]??=[],e[t.type].push(t),e),{});for(let[t,n]of Object.entries(e))if(Do(t)){if(n.length===1){let e=n[0];this.outputLog(t,e.message)}else{let e=n.map(e=>e.message).join(`
|
|
57
|
+
• `);this.outputLog(t,`${n.length} updates:\n • ${e}`)}}this.logBatch=[],this.logBatchTimer=null}outputLog(e,t){let n=`[rari] HMR:`;switch(e){case`success`:console.warn(`\x1B[32m${n}\x1B[0m ${t}`);break;case`warning`:console.warn(`\x1B[33m${n}\x1B[0m ${t}`);break;case`error`:console.error(`\x1B[31m${n}\x1B[0m ${t}`);break;default:console.warn(`${n} ${t}`)}}dispose(){this.logBatchTimer&&(clearTimeout(this.logBatchTimer),this.flushLogs()),this.batchTimer&&=(clearTimeout(this.batchTimer),null);for(let e of this.pendingUpdates.values())clearTimeout(e);this.pendingUpdates.clear(),this.pendingFiles.clear(),this.errorHandler.dispose()}};function W(e,t){return e.readUInt16BE(t)}function G(e,t){return e.readUInt32BE(t)}function ko(e,t){return e.readUInt32LE(t)}function Ao(e){return e.length<24||e.toString(`ascii`,1,4)!==`PNG`?null:{width:G(e,16),height:G(e,20)}}function jo(e){if(e.length<10)return null;let t=e.toString(`ascii`,0,6);return t!==`GIF87a`&&t!==`GIF89a`?null:{width:e.readUInt16LE(6),height:e.readUInt16LE(8)}}function Mo(e){return e>=192&&e<=195||e>=197&&e<=199||e>=201&&e<=203||e>=205&&e<=207}function No(e,t){if(t+7>=e.length)return null;let n=W(e,t),r=e[t+7]??0,i=8+3*r;if(r<1||n<i||t+n>e.length)return null;let a=W(e,t+3),o=W(e,t+5);return o===0||a===0?null:{height:a,width:o}}function Po(e,t){if(t+1>=e.length)return null;let n=W(e,t);return n<2?null:t+n}function Fo(e){if(e.length<4||e[0]!==255||e[1]!==216)return null;let t=2;for(;t+9<=e.length;){if(e[t]!==255){t+=1;continue}if(t+1>=e.length)return null;let n=e[t+1];if(t+=2,Mo(n))return No(e,t);if(n===217||n===218)return null;let r=Po(e,t);if(r==null)return null;t=r}return null}function Io(e,t){return(e[t]??0)|(e[t+1]??0)<<8|(e[t+2]??0)<<16}function Lo(e){if(e.length<20||e.toString(`ascii`,0,4)!==`RIFF`||e.toString(`ascii`,8,12)!==`WEBP`)return null;let t=e.toString(`ascii`,12,16);if(t===`VP8X`&&e.length>=30)return{width:Io(e,24)+1,height:Io(e,27)+1};if(t===`VP8 `&&e.length>=30)return{width:e.readUInt16LE(26)&16383,height:e.readUInt16LE(28)&16383};if(t===`VP8L`&&e.length>=25){if(e[20]!==47)return null;let t=ko(e,21);return{width:(t&16383)+1,height:(t>>14&16383)+1}}return null}function Ro(e,t,n){if(t+8>n)return null;let r=G(e,t),i=e.toString(`ascii`,t+4,t+8),a=8;if(r===1){if(t+16>n)return null;r=Number(e.readBigUInt64BE(t+8)),a=16}else r===0&&(r=n-t);let o=t+r;return r<a||o>n?null:{type:i,headerSize:a,start:t,end:o}}function*zo(e,t,n){let r=t;for(;r+8<=n;){let t=Ro(e,r,n);if(t==null)return;yield t,r=t.end}}function Bo(e,t){let n=t.start+t.headerSize;return n+4>t.end?null:{version:e[n]??0,flags:(e[n+1]??0)<<16|(e[n+2]??0)<<8|(e[n+3]??0),dataOffset:n+4}}function Vo(e,t){let n=Bo(e,t);return n==null||n.dataOffset+8>t.end?null:{width:G(e,n.dataOffset),height:G(e,n.dataOffset+4)}}function Ho(e,t){let n=Bo(e,t);return n==null?null:n.version===0?n.dataOffset+2>t.end?null:W(e,n.dataOffset):n.dataOffset+4>t.end?null:G(e,n.dataOffset)}function Uo(e,t,n,r){return r<1?t+2>n?null:{itemId:W(e,t),nextOffset:t+2}:t+4>n?null:{itemId:G(e,t),nextOffset:t+4}}function Wo(e,t,n,r,i){let a=t,o=[];for(let t=0;t<r;t+=1)if(i){if(a+2>n)return null;let t=W(e,a);a+=2,o.push(t&32767)}else{if(a+1>n)return null;let t=e[a]??0;a+=1,o.push(t&127)}return{propertyIndexes:o,nextOffset:a}}function Go(e,t){let n=Bo(e,t);if(n==null||n.dataOffset+4>t.end)return null;let r=G(e,n.dataOffset),i=n.dataOffset+4,a=/* @__PURE__ */ new Map,o=!!(n.flags&1);for(let s=0;s<r;s+=1){let r=Uo(e,i,t.end,n.version);if(r==null||(i=r.nextOffset,i+1>t.end))return null;let s=e[i]??0;i+=1;let c=Wo(e,i,t.end,s,o);if(c==null)return null;i=c.nextOffset,a.set(r.itemId,c.propertyIndexes)}return a}function Ko(e){for(let t of zo(e,0,e.length))if(t.type===`meta`)return t;return null}function qo(e,t,n){let r=1,i=null;for(let a of zo(e,t.start+t.headerSize,t.end)){if(a.type===`ispe`){let t=Vo(e,a);t!=null&&(n.set(r,t),i??=t)}r+=1}return i}function Jo(e,t){let n=/* @__PURE__ */ new Map,r=null,i=null;for(let a of zo(e,t.start+t.headerSize,t.end))if(a.type===`ipco`){let t=qo(e,a,n);i??=t}else a.type===`ipma`&&(r=Go(e,a));return{ispeByIndex:n,associations:r,firstIspe:i}}function Yo(e,t,n){if(e==null||t==null)return null;let r=t.get(e);if(r==null)return null;for(let e of r){let t=n.get(e);if(t!=null)return t}return null}function Xo(e){if(e.length<12||e.toString(`ascii`,4,8)!==`ftyp`)return null;let t=Ko(e);if(t==null)return null;let n=t.start+t.headerSize+4;if(n>t.end)return null;let r=null,i=/* @__PURE__ */ new Map,a=null,o=null;for(let s of zo(e,n,t.end)){if(s.type===`pitm`){r=Ho(e,s);continue}if(s.type!==`iprp`)continue;let t=Jo(e,s);i=t.ispeByIndex,a=t.associations,o??=t.firstIspe}return Yo(r,a,i)??o}function Zo(e){return e.length<4?null:e[0]===137&&e.toString(`ascii`,1,4)===`PNG`?Ao(e):e[0]===255&&e[1]===216?Fo(e):e.toString(`ascii`,0,3)===`GIF`?jo(e):e.toString(`ascii`,0,4)===`RIFF`?Lo(e):Xo(e)}const Qo=/\.(?:avif|gif|jpe?g|png|webp)$/i,$o=`\0rari-static-image:`,es=/* @__PURE__ */ new Set([`raw`,`url`,`inline`,`no-inline`]);function ts(e){let t=e.indexOf(`?`);return t===-1?[]:e.slice(t+1).split(`&`).map(e=>e.split(`=`)[0]??``).filter(Boolean)}function ns(e){return ts(e).includes(`rari-static-bypass`)}function rs(e){return ts(e).some(e=>es.has(e))}function is(e,t,n){return Si(e,t,n,{encodeBase:!0})}function as(e,t,n){return`const src = ${JSON.stringify(e)};\nexport default {\n src,\n width: ${t},\n height: ${n},\n};\n`}function os(e){return Qo.test(oe(e))&&!ns(e)&&!rs(e)}function ss(e,t=`assets`){let n=E.readFileSync(e),r=P(n),i=is(e,r,t),a=xi(e,r,t),o=Zo(n);if(o==null)throw Error(`[rari] Unable to read dimensions for static image import: ${e}. Pass explicit width/height to <Image>, or convert the file to png/jpeg/webp/gif/avif.`);return{code:as(i,o.width,o.height),publicPath:i,source:n,fileName:a}}const cs=/* @__PURE__ */ new Map,K=/* @__PURE__ */ new Map;function ls(e,t){let n=cs.get(e);if(n!=null)return n;let r=/* @__PURE__ */ new Map;if(E.existsSync(t))try{let e=f(E.readFileSync(t,`utf8`));if(e!=null)for(let[t,n]of Object.entries(e))typeof n==`string`&&r.set(t,n)}catch{}return cs.set(e,r),r}function us(e,t,n){for(let[r,i]of e)i===n&&r!==t&&e.delete(r);e.set(t,n)}function ds(e,t){let n=new Set(t.values());for(let[r,i]of e){if(!E.existsSync(i)){e.delete(r);continue}n.has(i)&&t.get(r)!==i&&e.delete(r)}}function q(e){return O.basename(e)===`client`?O.dirname(e):e}function fs(e){return O.join(q(e),`server`,`static-image-sources.json`)}function ps(e,t){let n=q(e),i=fs(e);if(t.size===0){try{E.unlinkSync(i)}catch(e){if(r(e)!==`ENOENT`)throw e}cs.delete(n);return}E.mkdirSync(O.dirname(i),{recursive:!0});let a=Object.fromEntries(t);E.writeFileSync(i,`${JSON.stringify(a,null,2)}\n`)}function ms(e){let t=q(e);K.has(t)||K.set(t,/* @__PURE__ */ new Map)}function hs(e){let t=q(e),n=K.get(t);if(n==null)return;let r=ls(t,fs(e));r.clear();for(let[e,t]of n)E.existsSync(t)&&r.set(e,t);ps(e,r),K.delete(t)}function gs(e,t){let n=q(e),r=ls(n,fs(e));for(let[e,n]of t)r.set(e,n);let i=K.get(n);if(i!=null){for(let[e,n]of t)us(i,e,n);return}ds(r,t),ps(e,r)}function _s(e,t){let n=!1;for(let[r,i]of e)i===t&&(e.delete(r),n=!0);return n}function vs(e){switch(e){case`.png`:return`image/png`;case`.gif`:return`image/gif`;case`.webp`:return`image/webp`;case`.avif`:return`image/avif`;case`.svg`:return`image/svg+xml`;default:return`image/jpeg`}}function ys(e){try{return decodeURIComponent(e)}catch{return e}}function bs(e,t,n,r){let i=t?.split(`?`)[0];if(i==null||i===``){r();return}let a=ys(i),o=e.get(i)??e.get(a);if(o==null||o===``){r();return}n.setHeader(`Content-Type`,vs(O.extname(o).toLowerCase())),n.setHeader(`Cache-Control`,`no-cache`),E.createReadStream(o).on(`error`,()=>{n.headersSent||(n.statusCode=404),n.end()}).pipe(n)}function xs(){let e=process.cwd(),t=O.join(e,`dist`,`client`),n=`assets`,r=!1,i=/* @__PURE__ */ new Map;return{name:`rari:static-image`,enforce:`pre`,configResolved(i){let a=Ut(i);e=a.projectRoot,t=a.outDir,n=a.assetsDir,r=i.command===`build`},buildStart(){r&&ms(t)},async resolveId(e,t){if(t==null||t===``||!os(e))return null;let n=await this.resolve(e,t,{skipSelf:!0});if(n==null||n.id===``)return null;let r=oe(n.id);return E.existsSync(r)?$o+r:null},load(e){if(!e.startsWith($o))return null;let r=e.slice(19),a=ss(r,n);return us(i,a.publicPath,r),gs(t,i),this.emitFile({type:`asset`,fileName:a.fileName,source:a.source}),a.code},watchChange(e,n){if(n.event!==`delete`)return;let r=oe(e);if(!_s(i,r))return;let a=K.get(q(t));a!=null&&_s(a,r),gs(t,i)},configureServer(e){e.middlewares.use((e,t,n)=>{bs(i,e.url,t,n)})}}}function Ss(e){let t=w(e);return t===`rari/mdx/registry`||t.startsWith(`rari/mdx/registry?`)?!0:t.endsWith(`/mdx/registry.ts`)||t.endsWith(`/mdx/registry.mts`)||t.endsWith(`/mdx/registry.mjs`)||t.endsWith(`/mdx/registry.js`)||t.endsWith(`/mdx/registry`)?t.includes(`/node_modules/rari/`)||t.includes(`/packages/rari/`):!1}function Cs(e,t){let n=e=>{if(E.existsSync(e))for(let r of E.readdirSync(e,{withFileTypes:!0})){let i=O.join(e,r.name);if(r.isDirectory()){if(r.name===`node_modules`||r.name===`.git`||r.name===`dist`)continue;n(i)}else r.isFile()&&r.name.endsWith(`.mdx`)&&t(i)}};for(let t of e)t&&E.existsSync(t)&&n(t)}function ws(e){let t=/* @__PURE__ */ new Set;return Cs(e,e=>{try{let n=E.readFileSync(e,`utf-8`);for(let e of ve(n))t.add(e)}catch{}}),t}function Ts(e,t){try{if(t.get(e).hasDefaultExport)return O.basename(e,O.extname(e));let n=t.getSource(e).match(x);if(n?.[1]!=null&&n[1]!==``)return n[1]}catch{}return O.basename(e,O.extname(e))}function Es(e){let t=ws(e.contentDirs.map(t=>O.join(e.projectRoot,t)));if(t.size===0)return[];let n=jr(e.componentScanDirs,e.cache),r=[],i=/* @__PURE__ */ new Set;for(let a of n){let n=Ts(a,e.cache);if(n==null||n===``||!t.has(n))continue;let o=Wt(a,e.projectRoot),s=o.startsWith(`/`)?o:`/${o}`,c=n.replace(/[^\w$]/g,`_`);i.has(c)&&(c=`${c}_${r.length}`),i.add(c),r.push({name:n,binding:c,importPath:s,moduleId:o,client:!0})}return r.sort((e,t)=>e.name.localeCompare(t.name))}function Ds(e){let t=ks(e.projectRoot,e.mdxOptions),n=e.srcDir??O.join(e.projectRoot,`src`),r=Ns(e.projectRoot,t.componentsDir,wr(n,Object.values(e.alias??{})));return Es({projectRoot:e.projectRoot,componentsDir:t.componentsDir,contentDirs:t.contentDirs,cache:e.cache,componentScanDirs:r})}function Os(e,t={}){let n=t.importStyle??`root-absolute`,r=t.mode??`vite`;return e.length===0?`import { defineMdxComponents } from 'rari/mdx/define'
|
|
65
58
|
|
|
66
59
|
export const getMDXComponents = defineMdxComponents([])
|
|
67
60
|
`:r===`production`?`import { defineMdxComponents } from 'rari/mdx/define'
|
|
@@ -78,92 +71,25 @@ export const getMDXComponents = defineMdxComponents([
|
|
|
78
71
|
${e.map(e=>` { name: ${JSON.stringify(e.name)}, component: ${e.binding}, id: ${JSON.stringify(e.moduleId)}, client: ${e.client} }`).join(`,
|
|
79
72
|
`)},
|
|
80
73
|
])
|
|
81
|
-
`}function
|
|
82
|
-
`||e===`\r`||e===`\u2028`||e===`\u2029`}function
|
|
83
|
-
`||e===`\r`||e===`\u2028`||e===`\u2029`}function
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
`&&
|
|
87
|
-
`&&a.pop(),i+=1;continue}if(t.kind===`block-comment`){n===`*`&&o===`/`?(a.pop(),i+=2):i+=1;continue}if(t.kind===`single`||t.kind===`double`||t.kind===`template`){if(n===`\\`){i+=2;continue}if(t.kind===`template`&&n===`$`&&o===`{`)return{forceRuntime:!0,endIndex:e.length};(t.kind===`single`&&n===`'`||t.kind===`double`&&n===`"`||t.kind===`template`&&n==="`")&&a.pop(),i+=1;continue}if(n===`/`&&o===`/`){a.push({kind:`line-comment`}),i+=2;continue}if(n===`/`&&o===`*`){a.push({kind:`block-comment`}),i+=2;continue}if(n===`'`){a.push({kind:`single`}),i+=1;continue}if(n===`"`){a.push({kind:`double`}),i+=1;continue}if(n==="`"){a.push({kind:`template`}),i+=1;continue}if(n===`[`){r+=1,i+=1;continue}if(n===`]`){--r,i+=1;continue}if(n===`{`)return{forceRuntime:!0,endIndex:i};i+=1}return r===0?{...ko(e.slice(t,i-1)),endIndex:i}:{forceRuntime:!0,endIndex:e.length}}return{forceRuntime:!0,endIndex:n+1}}function To(e){let t=[{kind:`code`,braceDepth:0}],n=[];for(let r=0;r<e.length;){let i=t.at(-1);if(i===void 0)return{forceRuntime:!0};let a=e[r],o=e[r+1];if(i.kind===`line-comment`){a===`
|
|
88
|
-
`&&t.pop(),r+=1;continue}if(i.kind===`block-comment`){a===`*`&&o===`/`?(t.pop(),r+=2):r+=1;continue}if(i.kind===`single`||i.kind===`double`){if(a===`\\`){r+=2;continue}(i.kind===`single`&&a===`'`||i.kind===`double`&&a===`"`)&&t.pop(),r+=1;continue}if(i.kind===`template`){if(a===`\\`){r+=2;continue}if(a==="`"){t.pop(),r+=1;continue}if(a===`$`&&o===`{`){t.push({kind:`code`,braceDepth:1}),r+=2;continue}r+=1;continue}if(i.kind===`regex`){if(a===`\\`){r+=2;continue}if(a===`[`){t.push({kind:`regex-class`}),r+=1;continue}if(a===`/`){for(t.pop(),r+=1;r<e.length&&/[a-z]/i.test(e.charAt(r));)r+=1;continue}r+=1;continue}if(i.kind===`regex-class`){if(a===`\\`){r+=2;continue}if(a===`]`){t.pop(),r+=1;continue}r+=1;continue}if(a===`/`&&o===`/`){t.push({kind:`line-comment`}),r+=2;continue}if(a===`/`&&o===`*`){t.push({kind:`block-comment`}),r+=2;continue}if(a===`/`&&yo(e,r)){t.push({kind:`regex`}),r+=1;continue}if(a===`'`){t.push({kind:`single`}),r+=1;continue}if(a===`"`){t.push({kind:`double`}),r+=1;continue}if(a==="`"){t.push({kind:`template`}),r+=1;continue}if(a===`{`){i.braceDepth+=1,r+=1;continue}if(a===`}`){--i.braceDepth,r+=1,i.braceDepth===0&&t.length>1&&t.pop();continue}let s=r===0?``:e.charAt(r-1),c=r===0||/[\s;{}]/.test(s);if(i.braceDepth===0&&t.length===1&&c&&e.startsWith(`const matcher`,r)){let t=r+13;if(t<e.length&&/[\w$]/.test(e.charAt(t))){r+=1;continue}let i=t;for(;i<e.length&&/\s/.test(e.charAt(i));)i+=1;if(e.charAt(i)!==`=`){r+=1;continue}let a=wo(e,i);if(a==null||a.forceRuntime)return{forceRuntime:!0};n.push({matcher:a.matcher,forceRuntime:!1}),r=a.endIndex;continue}if(i.braceDepth===0&&t.length===1&&c&&(e.startsWith(`let matcher`,r)||e.startsWith(`var matcher`,r)))return{forceRuntime:!0};r+=1}return n.length===0?null:n.length>1?{forceRuntime:!0}:n[0]??null}function Eo(e){let t=e.trim();if(t===``||t.includes(`&&`))return null;let n=t.split(/\|\|/),r=[],i;for(let e of n){let t=ro.exec(e.trim());if(t==null)return null;let n=t[1]||t[6]||``,a=t[3]||t[5]||``;if(n===``||a===``)return null;if(i==null)i=n;else if(i!==n)return null;r.push(a)}return r.length>0?r:null}function Do(e){let t=[];no.lastIndex=0;for(let n of e.matchAll(no)){let e=n[1],r=n[2],i=n[4],a=Number.parseInt(n[5],10),o=Number.isFinite(a)?a:void 0;if(e===``||i===``||r!==`redirect`&&r!==`rewrite`)continue;let s=Eo(e);if(s==null)return[];for(let e of s)t.push({source:e,type:r,destination:i,...r===`redirect`?{permanent:go(o)}:{}})}return t}function Oo(e){let t=ao.exec(e);return t==null?null:Co(e,t.index+t[0].length-1)}function ko(e){if(e.includes(`{`))return{forceRuntime:!0};let t=[];mo.lastIndex=0;for(let n of e.matchAll(mo)){let e=n[1],r=n[2];if(r===``||e!==`'`&&e!==`"`&&e!=="`")continue;let i=xo(r,e);if(i==null)return{forceRuntime:!0};i!==``&&t.push(i)}return e.replace(mo,``).replace(/[\s,]/g,``)===``&&t.length>0?{matcher:t,forceRuntime:!1}:{forceRuntime:!0}}function Ao(e,t){let n=[{kind:`code`,braceDepth:0}];for(let r=0;r<t;){let i=n.at(-1);if(i===void 0)return null;let a=e.charAt(r),o=e.charAt(r+1);if(i.kind===`line-comment`){a===`
|
|
89
|
-
`&&n.pop(),r+=1;continue}if(i.kind===`block-comment`){a===`*`&&o===`/`?(n.pop(),r+=2):r+=1;continue}if(i.kind===`single`||i.kind===`double`){if(a===`\\`){r+=2;continue}(i.kind===`single`&&a===`'`||i.kind===`double`&&a===`"`)&&n.pop(),r+=1;continue}if(i.kind===`template`){if(a===`\\`){r+=2;continue}if(a==="`"){n.pop(),r+=1;continue}if(a===`$`&&o===`{`){n.push({kind:`code`,braceDepth:1}),r+=2;continue}r+=1;continue}if(i.kind===`regex`){if(a===`\\`){r+=2;continue}if(a===`[`){n.push({kind:`regex-class`}),r+=1;continue}if(a===`/`){for(n.pop(),r+=1;r<t&&/[a-z]/i.test(e.charAt(r));)r+=1;continue}r+=1;continue}if(i.kind===`regex-class`){if(a===`\\`){r+=2;continue}if(a===`]`){n.pop(),r+=1;continue}r+=1;continue}if(a===`/`&&o===`/`){n.push({kind:`line-comment`}),r+=2;continue}if(a===`/`&&o===`*`){n.push({kind:`block-comment`}),r+=2;continue}if(a===`/`&&yo(e,r)){n.push({kind:`regex`}),r+=1;continue}if(a===`'`){n.push({kind:`single`}),r+=1;continue}if(a===`"`){n.push({kind:`double`}),r+=1;continue}if(a==="`"){n.push({kind:`template`}),r+=1;continue}if(a===`{`){i.braceDepth+=1,r+=1;continue}if(a===`}`){--i.braceDepth,r+=1,i.braceDepth===0&&n.length>1&&n.pop();continue}r+=1}let r=n.at(-1);return r?.kind===`code`?r.braceDepth:null}function jo(e,t){return Ao(e,t)===1}function Mo(e){return e.startsWith(`'`)||e.startsWith(`"`)||e.startsWith("`")}function No(e,t){let n=new RegExp(t.source,t.flags.includes(`g`)?t.flags:`${t.flags}g`);for(let t of e.matchAll(n)){let n=Mo(t[0])?t.index:t.index+t[0].indexOf(`matcher`);if(n>=t.index&&jo(e,n))return t}return null}function Po(e,t){let n=t;for(;n<e.length;){let t=e.charAt(n),r=e.charAt(n+1);if(/\s/.test(t)){n+=1;continue}if(t===`/`&&r===`/`){for(n+=2;n<e.length&&!vo(e.charAt(n));)n+=1;continue}if(t===`/`&&r===`*`){for(n+=2;n+1<e.length&&(e.charAt(n)!==`*`||e.charAt(n+1)!==`/`);)n+=1;n+=2;continue}return t===`,`||t===`}`}return!0}function Fo(e,t){let n=t;for(;n<e.length;){let t=e.charAt(n),r=e.charAt(n+1);if(/\s/.test(t)){n+=1;continue}if(t===`/`&&r===`/`){for(n+=2;n<e.length&&!vo(e.charAt(n));)n+=1;continue}if(t===`/`&&r===`*`){for(n+=2;n+1<e.length&&(e.charAt(n)!==`*`||e.charAt(n+1)!==`/`);)n+=1;n+=2;continue}break}return n}function Io(e,t){if(e.charAt(t)!==`[`)return null;let n=Fo(e,t+1);if(n>=e.length)return{endIndex:e.length,forceRuntime:!0};let r=e.charAt(n);if(r===`'`||r===`"`||r==="`"){let t=So(e,n,r);if(t==null)return{endIndex:e.length,forceRuntime:!0};let i=e.slice(n+1,t-1);if(r==="`"&&i.includes("${"))return{endIndex:t,forceRuntime:!0};let a=xo(i,r);return n=Fo(e,t),e.charAt(n)===`]`?{endIndex:n+1,forceRuntime:a===`matcher`}:{endIndex:n,forceRuntime:!0}}return{endIndex:t+1,forceRuntime:!0}}function Lo(e){let t=[{kind:`code`,braceDepth:0}],n=!1;for(let r=0;r<e.length;){let i=t.at(-1);if(i===void 0)return!1;let a=e.charAt(r),o=e.charAt(r+1);if(i.kind===`line-comment`){a===`
|
|
90
|
-
`&&t.pop(),r+=1;continue}if(i.kind===`block-comment`){a===`*`&&o===`/`?(t.pop(),r+=2):r+=1;continue}if(i.kind===`single`||i.kind===`double`){if(a===`\\`){r+=2;continue}(i.kind===`single`&&a===`'`||i.kind===`double`&&a===`"`)&&t.pop(),r+=1;continue}if(i.kind===`template`){if(a===`\\`){r+=2;continue}if(a==="`"){t.pop(),r+=1;continue}if(a===`$`&&o===`{`){t.push({kind:`code`,braceDepth:1}),r+=2;continue}r+=1;continue}if(i.kind===`regex`){if(a===`\\`){r+=2;continue}if(a===`[`){t.push({kind:`regex-class`}),r+=1;continue}if(a===`/`){for(t.pop(),r+=1;r<e.length&&/[a-z]/i.test(e.charAt(r));)r+=1;continue}r+=1;continue}if(i.kind===`regex-class`){if(a===`\\`){r+=2;continue}if(a===`]`){t.pop(),r+=1;continue}r+=1;continue}if(a===`/`&&o===`/`){t.push({kind:`line-comment`}),r+=2;continue}if(a===`/`&&o===`*`){t.push({kind:`block-comment`}),r+=2;continue}if(a===`/`&&yo(e,r)){t.push({kind:`regex`}),r+=1;continue}if(a===`'`){n&&i.braceDepth===1&&(n=!1),t.push({kind:`single`}),r+=1;continue}if(a===`"`){n&&i.braceDepth===1&&(n=!1),t.push({kind:`double`}),r+=1;continue}if(a==="`"){n&&i.braceDepth===1&&(n=!1),t.push({kind:`template`}),r+=1;continue}if(a===`{`){i.braceDepth+=1,i.braceDepth===1&&(n=!0),r+=1;continue}if(a===`}`){--i.braceDepth,n=!1,r+=1,i.braceDepth===0&&t.length>1&&t.pop();continue}if(a===`,`&&i.braceDepth===1){n=!0,r+=1;continue}if(a===`:`&&i.braceDepth===1){n=!1,r+=1;continue}if(n&&i.braceDepth===1&&!/\s/.test(a)){if(a===`.`&&o===`.`&&e.charAt(r+2)===`.`)return!0;if(a===`[`){let t=Io(e,r);if(t?.forceRuntime===!0)return!0;if(t!=null){n=!1,r=t.endIndex;continue}return!0}n=!1}r+=1}return!1}function Ro(e){if(!io.test(e)||!ao.test(e))return{forceRuntime:!1};let t=Oo(e);if(t==null||Lo(t)||No(t,oo)!=null||No(t,lo)!=null)return{forceRuntime:!0};let n=No(t,so)??No(t,uo);if(n!=null){let e=Mo(n[0]),r=e?n[2]:n[1],i=e?n[3]:n[2];if(r===`'`||r===`"`||r==="`"){if(r==="`"&&i.includes("${")||!Po(t,n.index+n[0].length))return{forceRuntime:!0};let e=xo(i,r);return e==null||e===``?{forceRuntime:!0}:{matcher:e,forceRuntime:!1}}}let r=No(t,co)??No(t,fo);return r==null?No(t,ho)==null?No(t,/matcher\s*:/)!=null||No(t,po)!=null?{forceRuntime:!0}:{forceRuntime:!1}:To(e)??{forceRuntime:!0}:Po(t,r.index+r[0].length)?ko(Mo(r[0])?r[2]:r[1]):{forceRuntime:!0}}function zo(e){let{matcher:t,forceRuntime:n}=Ro(e);if(n||eo.test(e))return{requiresRuntime:!0,rules:[],...t==null?{}:{matcher:t}};let r=to.test(e),i=Do(e);return r&&i.length===0?{requiresRuntime:!0,rules:[],...t==null?{}:{matcher:t}}:{requiresRuntime:!1,rules:i,...t==null?{}:{matcher:t}}}function Bo(e){let t=zo(e.code),n=t.requiresRuntime;return{proxyFile:e.proxyFile,enabled:!0,generated:e.generated??(/* @__PURE__ */ new Date()).toISOString(),rules:t.rules,requiresRuntime:n,...n&&e.bundlePath!=null&&e.bundlePath!==``?{bundlePath:e.bundlePath}:{},...t.matcher==null?{}:{matcher:t.matcher}}}const Vo=/@import\s+(?:url\(\s*)?['"](?![a-zA-Z][a-zA-Z0-9+.-]*:|\/\/|\.\/|\.\.\/|\/)[^'"]+['"][^;]*(?:;|$)/g,Ho=/@import\s+(?:url\(\s*((?:\.\/|\.\.\/)[^)\s]+)\s*\)|url\(\s*['"]((?:\.\/|\.\.\/)[^'"]+)['"]\s*\)|['"]((?:\.\/|\.\.\/)[^'"]+)['"])([^;]*)(?:;|$)/g,Uo=/\.css(?:\?.*)?$/,Wo=/\.module\.css(?:\?.*)?$/i;function Go(e){return Wo.test(e.replace(/[?#].*$/,``))}function Ko(e){return e.replace(Vo,``).trim()}function qo(e){let t=e.trim().replace(/^\)\s*/,``),n=null,r=null;if(/^layer\s*\(/i.exec(t)){let e=t.indexOf(`(`),r=t.indexOf(`)`,e);r!==-1&&(n=t.slice(e+1,r).trim(),t=t.slice(r+1).trim())}else/^layer(?:\s|$)/i.test(t)&&(n=``,t=t.replace(/^layer\s*/i,``));if(/^supports\s*\(/i.test(t)){let e=t.indexOf(`(`),n=0,i=-1;for(let r=e;r<t.length;r++){let e=t[r];if(e===`(`)n++;else if(e===`)`&&(n--,n===0)){i=r;break}}i!==-1&&(r=t.slice(e+1,i).trim(),t=t.slice(i+1).trim())}let i=t.trim()===``?null:t.trim();return{layerName:n,supportsCondition:r,mediaQuery:i}}function Jo(e,t){let n=e.trim();return n===``?``:(t.layerName!==null&&(n=t.layerName===``?`@layer {\n${n}\n}`:`@layer ${t.layerName} {\n${n}\n}`),t.supportsCondition!=null&&t.supportsCondition!==``&&(n=`@supports (${t.supportsCondition}) {\n${n}\n}`),t.mediaQuery!=null&&t.mediaQuery!==``&&(n=`@media ${t.mediaQuery} {\n${n}\n}`),n)}function Yo(e,t,n=/* @__PURE__ */ new Set){let r=S.resolve(e);return n.has(r)?``:(n.add(r),t.replace(Ho,(e,t,i,a,o)=>{let s=t??i??a;if(s==null||s===``)return e;let c=S.resolve(S.dirname(r),s);try{return!b.existsSync(c)||!b.statSync(c).isFile()?e:Jo(Xo(c,b.readFileSync(c,`utf-8`),new Set(n)),qo(o))}catch{return e}}).trim())}function Xo(e,t,n=/* @__PURE__ */ new Set){return Yo(e,Ko(t),n)}function Zo(e,t){let n=/* @__PURE__ */ new Set;for(let r of lr(e,t)){if(S.isAbsolute(r)){n.add(S.resolve(r));continue}try{n.add(Ee(S.join(e,`package.json`)).resolve(r))}catch{}}return n}function Qo(e,t,n,r){let i=e.replace(/[?#].*$/,``);if(!Uo.test(i))return null;if(S.isAbsolute(i))return b.existsSync(i)&&b.statSync(i).isFile()?i:null;if(i.startsWith(`./`)||i.startsWith(`../`)){let e=S.resolve(S.dirname(t),i);return b.existsSync(e)&&b.statSync(e).isFile()?e:null}let a=xe(i,r,n);if(a!=null&&a!==``&&b.existsSync(a)&&b.statSync(a).isFile())return a;let o=[t,S.join(n,`package.json`)];for(let e of o)try{let t=Ee(e).resolve(i);if(b.existsSync(t)&&b.statSync(t).isFile())return t}catch{try{let t=w(import.meta.resolve(i,Me(e).href));if(b.existsSync(t)&&b.statSync(t).isFile())return t}catch{}}return null}function $o(e){let t=[];for(let n of yn(e.code)){if(!Uo.test(n.source)||Go(n.source))continue;let r=n.source.includes(`?`)?n.source.slice(n.source.indexOf(`?`)):``;if(/(?:\?|&)raw(?:&|$)/.test(r)||/(?:\?|&)url(?:&|$)/.test(r))continue;let i=Qo(n.source,e.filePath,e.projectRoot,e.aliases);if(i!=null&&!Go(i)&&!e.layoutCssSkip.has(S.resolve(i)))try{let e=Xo(i,b.readFileSync(i,`utf-8`));e!==``&&t.push(e)}catch{}}return t}const es=/^proxy\.(?:tsx?|jsx?|mts|mjs)$/,ts=/^(?:robots|sitemap|feed)\.(?:tsx?|jsx?)$/,ns=/^(?:favicon|icon\d*|apple-icon\d*)\.(?:ico|png|jpe?g|svg)$/i,rs=/^layout\.(?:tsx|ts|jsx|js)$/,is=[{componentId:`rari/image`,devSourceSegments:[`src`,`image`,`image.tsx`],publishedExport:`rari/image`,exports:[`Image`]}],as=S.dirname(w(import.meta.url)),os=S.dirname(as);function ss(e){return e.startsWith(os)}function cs(){let e=S.join(os,`src`,`runtime`,`boundaries`,`error-boundary-wrapper.tsx`);if(b.existsSync(e))return e;try{let e=w(import.meta.resolve(`rari/runtime/ErrorBoundaryWrapper`));if(b.existsSync(e))return e}catch{}return null}function ls(e){let t=y(e);return t.includes(`ErrorBoundaryWrapper`)||t.includes(`/boundaries/error-boundary-wrapper`)||t.endsWith(`/error-boundary-wrapper.tsx`)}function us(e){return l(e)&&l(e.components)}function ds(e,t){if(ls(e))return`virtual:error-boundary-wrapper.tsx`;let n=y(S.relative(t,e));return n.startsWith(`..`)||S.isAbsolute(n)?y(e):n}function fs(e,t){if(ls(e))return`error_boundary_wrapper_${qt(`virtual:error-boundary-wrapper.tsx`)}`;if(ss(e)){let t=y(S.relative(os,e));return`${Yt(t)}_${qt(t)}`}return Xt(e,t)}function ps(e,t){return!e.includes(`node_modules`)&&!t.directives.hasUseClient&&!t.directives.hasUseServer}var ms=class{serverComponents=/* @__PURE__ */ new Map;serverActions=/* @__PURE__ */ new Map;options;projectRoot;buildCache=/* @__PURE__ */ new Map;useCacheBuildId=null;fileImporters=/* @__PURE__ */ new Map;moduleAnalysisCache;discoveredExternalClientComponents=/* @__PURE__ */ new Set;clientComponentFiles=/* @__PURE__ */ new Map;layoutCssSkipSet=null;viteBuilder=null;envEmitLock=Promise.resolve();getLayoutCssSkipSet(){return this.layoutCssSkipSet??=Zo(this.projectRoot,this.options.alias),this.layoutCssSkipSet}resolveServerCssSources(e,t){return $o({filePath:e,code:t,projectRoot:this.projectRoot,aliases:this.options.alias,layoutCssSkip:this.getLayoutCssSkipSet()})}resolveExtraFileOutPath(e){let t=y(e);return t===this.options.assetsDir||t.startsWith(`${this.options.assetsDir}/`)?S.join(this.options.outDir,t):S.join(this.options.outDir,this.options.rscDir,t)}setViteBuilder(e){this.viteBuilder=e}getProjectRoot(){return this.projectRoot}async getEmitBuilder(){return this.viteBuilder??=await me({root:this.projectRoot,logLevel:`error`}),this.viteBuilder}async withEnvEmitLock(e){let t=this.envEmitLock,n;this.envEmitLock=new Promise(e=>{n=e}),await t;try{return await e()}finally{n()}}async emitRscEntries(e,t){return this.withEnvEmitLock(async()=>{let n=await this.getEmitBuilder(),r=await ve({viteBuilder:n,entries:e,minify:t?.minify??this.options.minify,codeSplitting:t?.codeSplitting});if(r==null)throw Error(`Vite RSC environment build failed`);return r})}recordClientComponent(e,t){this.clientComponentFiles.set(e,t)}getClientComponentFiles(){return[...this.clientComponentFiles.entries()].map(([e,t])=>({filePath:e,code:t}))}getClientComponentPaths(){return[...this.clientComponentFiles.keys()]}getModuleAnalysisCache(){return this.moduleAnalysisCache}clearClientComponentFiles(){this.clientComponentFiles.clear()}getComponentCount(){return this.serverComponents.size+this.serverActions.size}hasComponent(e){return this.serverComponents.has(e)||this.serverActions.has(e)}removeComponent(e){this.serverComponents.delete(e),this.serverActions.delete(e),this.moduleAnalysisCache.invalidate(e)}getImportGraph(){let e=/* @__PURE__ */ new Map;for(let[t,n]of this.fileImporters)e.set(t,new Set(n));return e}async writeComponentCssAsset(e,t){if(t.length===0)return[];let n=S.join(this.options.outDir,`assets`,`server`);await b.promises.mkdir(n,{recursive:!0});let r=`${t.join(`
|
|
91
|
-
`)}\n`,i=`${qt(e+r,12)}.css`,a=S.join(n,i);return await b.promises.writeFile(a,r,`utf-8`),[`/assets/server/${i}`]}getComponentIdFromRouteManifestPath(e){return this.getComponentId(S.join(this.projectRoot,`src`,`app`,e))}getComponentReferenceId(e){return this.getReadableComponentId(this.getProjectRelativePath(e))}async writeRouteCssEntries(e){let t=S.join(this.options.outDir,this.options.rscDir,`routes.json`);if(!b.existsSync(t))return;let n=await b.promises.readFile(t,`utf-8`),r=JSON.parse(n);if(!l(r))return;let i=r,a=t=>{if(Array.isArray(t))for(let n of t){if(!l(n))continue;let t=n.filePath;if(typeof t!=`string`||t===``)continue;let r=this.getComponentIdFromRouteManifestPath(t);n.componentId=r;let i=e.components[r]?.css??[];i.length?n.css=i:delete n.css}};a(i.routes),a(i.layouts),a(i.loading),a(i.errors),a(i.notFound),a(i.templates);let o=i.apiRoutes;if(Array.isArray(o))for(let e of o){if(!l(e))continue;let t=e.filePath;typeof t==`string`&&t!==``&&(e.componentId=this.getComponentIdFromRouteManifestPath(t))}await b.promises.writeFile(t,JSON.stringify(i),`utf-8`)}constructor(e,t={}){this.projectRoot=S.resolve(e),this.moduleAnalysisCache=t.moduleAnalysisCache??new Zn;let n=t.rscDir!=null&&t.rscDir!==``?t.rscDir:`server`,r=t.outDir!=null&&t.outDir!==``?t.outDir:S.join(this.projectRoot,`dist`);this.options={outDir:S.isAbsolute(r)?r:S.resolve(this.projectRoot,r),rscDir:n,manifestPath:t.manifestPath!=null&&t.manifestPath!==``?t.manifestPath:S.join(n,`manifest.json`),serverConfigPath:t.serverConfigPath!=null&&t.serverConfigPath!==``?t.serverConfigPath:S.join(n,`config.json`),minify:t.minify??C.env.NODE_ENV===`production`,alias:t.alias??{},assetsDir:t.assetsDir!=null&&t.assetsDir!==``?fe(t.assetsDir):`assets`,define:t.define,csp:t.csp,cacheControl:t.cacheControl,cache:t.cache,action:t.action,jsPoolSize:t.jsPoolSize,origin:t.origin,htmlLimitedBots:t.htmlLimitedBots,experimental:t.experimental,mdx:t.mdx}}getModuleAnalysis(e,t){return this.moduleAnalysisCache.get(e,t)}isServerComponent(e,t){try{return ps(e,this.moduleAnalysisCache.get(e,t))}catch{return!1}}isClientComponent(e,t){try{return this.moduleAnalysisCache.get(e,t).directives.hasUseClient}catch{return!1}}resolveImportedFilePath(e,t){let n=null;if(t.startsWith(`./`)||t.startsWith(`../`)){let r=S.dirname(e);n=S.resolve(r,t)}else if(n=xe(t,this.options.alias,this.projectRoot),(n==null||n===``)&&t.startsWith(`@/`)){let e=t.slice(2);n=S.join(this.projectRoot,`src`,e)}return n==null||n===``?null:Se(n,[``,`.ts`,`.tsx`,`.js`,`.jsx`])}populateImportGraphFromFiles(e){this.fileImporters.clear();for(let{filePath:t,analysis:n}of e)for(let e of qn(n.importSources)){let n=this.resolveImportedFilePath(t,e);n!=null&&n!==``&&(this.fileImporters.has(n)||this.fileImporters.set(n,/* @__PURE__ */ new Set),this.fileImporters.get(n).add(t))}}buildImportGraph(e){let t=hs(this,[e]);this.populateImportGraphFromFiles(t)}isOnlyImportedByClientComponents(e){let t=this.fileImporters.get(e);if(!t||t.size===0)return!1;for(let e of t)if(!this.isClientComponent(e)&&!this.isOnlyImportedByClientComponents(e))return!1;return!0}addServerComponent(e,t,n){let r=t??b.readFileSync(e,`utf-8`),i=n??this.moduleAnalysisCache.get(e,r),a=Kn(i.importSources),o=Gn(i);if(i.directives.hasUseServer){this.serverActions.set(e,{filePath:e,originalCode:r,dependencies:a,hasNodeImports:o});return}ps(e,i)&&this.serverComponents.set(e,{filePath:e,originalCode:r,dependencies:a,hasNodeImports:o})}isServerAction(e,t){return t!=null&&t!==``?this.moduleAnalysisCache.get(t,e).directives.hasUseServer:mn(e).directives.hasUseServer}extractDependencies(e,t){return Kn((t!=null&&t!==``?this.moduleAnalysisCache.get(t,e):mn(e)).importSources)}hasNodeImports(e,t){return Gn(t!=null&&t!==``?this.moduleAnalysisCache.get(t,e):mn(e))}async getTransformedComponentsForDevelopment(e){let t=[];for(let[n]of this.serverComponents)(!e||e(n))&&t.push({componentId:this.getComponentId(n),filePath:n,isAction:!1});for(let[n]of this.serverActions)(!e||e(n))&&t.push({componentId:this.getComponentId(n),filePath:n,isAction:!0});if(t.length===0)return[];let n=await this.emitRscEntries(t.map(({componentId:e,filePath:t})=>({componentId:e,filePath:t})),{minify:this.options.minify,codeSplitting:!1});for(let e of n.extraFiles){let t=this.resolveExtraFileOutPath(e.fileName);await b.promises.mkdir(S.dirname(t),{recursive:!0}),await b.promises.writeFile(t,e.code)}return t.map(e=>{let t=n.outputs.get(e.componentId);if(t==null)throw Error(`Vite RSC environment build missed entry: ${e.componentId}`);return{id:e.componentId,code:t.code,isAction:e.isAction}})}async emitProxyManifest(e){let t=S.join(e,`proxy.json`),r=[...this.serverComponents.entries()].filter(([e])=>es.test(S.basename(e)));if(r.length===0){try{await b.promises.unlink(t)}catch(e){n(e)!==`ENOENT`&&console.warn(`Failed to remove proxy manifest file:`,e)}return}let[i,a]=r[0],o=y(this.getProjectRelativePath(i)),s=this.getComponentId(o),c=y(S.join(this.options.rscDir,`${s}.js`)),l=Bo({proxyFile:o,code:a.originalCode,bundlePath:c});l.requiresRuntime||this.serverComponents.delete(i),await b.promises.writeFile(t,JSON.stringify(l),`utf-8`)}async buildServerComponents(){let e=S.join(this.options.outDir,this.options.rscDir);await b.promises.mkdir(e,{recursive:!0}),await this.emitProxyManifest(e);let t={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()},r=this.options.experimental?.useCache===!0||this.options.experimental?.useCacheRemote!=null,i=[...this.serverComponents.entries(),...this.serverActions.entries()],a=await this.buildRscEntriesWithVite(i);for(let e of a.extraFiles){let t=this.resolveExtraFileOutPath(e.fileName);await b.promises.mkdir(S.dirname(t),{recursive:!0}),await b.promises.writeFile(t,e.code)}for(let[e,n]of a.entries){let r=S.relative(this.projectRoot,e),i=this.getComponentId(e),a=ye(this.options.rscDir,i),o=S.join(this.options.outDir,a);await b.promises.mkdir(S.dirname(o),{recursive:!0}),await b.promises.writeFile(o,n.code,`utf-8`);let s=this.serverComponents.get(e)??this.serverActions.get(e),c=this.resolveServerCssSources(e,s?.originalCode??await b.promises.readFile(e,`utf-8`)),l=[...await this.writeComponentCssAsset(i,n.cssAssetSources.length>0?[...n.cssAssetSources]:c)];t.components[i]={id:i,filePath:e,relativePath:r,bundlePath:a,moduleSpecifier:Me(S.resolve(this.projectRoot,o)).href,dependencies:[...s?.dependencies??[]],hasNodeImports:s?.hasNodeImports??!1,css:l}}r&&(this.useCacheBuildId=qt(JSON.stringify(t.components),16),t.useCacheBuildId=this.useCacheBuildId);let o=S.join(this.options.outDir,this.options.manifestPath);await b.promises.writeFile(o,JSON.stringify(t),`utf-8`),await this.writeRouteCssEntries(t);let s={};this.options.csp&&(s.csp=this.options.csp),this.options.cacheControl&&(s.cacheControl=this.options.cacheControl),this.options.cache&&(s.cache=this.options.cache),this.options.action&&(s.action=this.options.action),this.options.jsPoolSize!=null&&(s.jsPoolSize=this.options.jsPoolSize);let c=this.options.origin?.trim().replace(/\/+$/,``);c!=null&&c!==``&&(s.origin=c),this.options.htmlLimitedBots!=null&&(s.htmlLimitedBots=this.options.htmlLimitedBots),(this.options.experimental?.useCacheRemote!=null||this.useCacheBuildId!=null&&this.useCacheBuildId!==``)&&(s.useCache={...this.options.experimental?.useCacheRemote?{remote:this.options.experimental.useCacheRemote}:{},...this.useCacheBuildId!=null&&this.useCacheBuildId!==``?{buildId:this.useCacheBuildId}:{}},!this.options.experimental?.useCache&&this.options.experimental?.useCacheRemote&&console.warn(`[server-build] experimental.useCacheRemote is set without experimental.useCache; the 'use cache' transform will still run because useCacheRemote is configured.`));let l=S.join(this.options.outDir,this.options.serverConfigPath);if(Object.keys(s).length===0)try{await b.promises.unlink(l)}catch(e){n(e)!==`ENOENT`&&console.warn(`Failed to remove server config file:`,e)}else await b.promises.writeFile(l,JSON.stringify(s),`utf-8`);return t}async buildRscEntriesWithVite(e){let t={entries:/* @__PURE__ */ new Map,extraFiles:[]};if(e.length===0)return t;if(this.viteBuilder==null)throw Error(`Vite builder is required for RSC environment emit`);let n=this.viteBuilder;return this.withEnvEmitLock(async()=>{let t=e.map(([e])=>({componentId:this.getComponentId(e),filePath:e})),r=await ve({viteBuilder:n,entries:t,minify:this.options.minify});if(r==null)throw Error(`Vite RSC environment build failed`);let i=/* @__PURE__ */ new Map;for(let[t]of e){let e=this.getComponentId(t),n=r.outputs.get(e);if(n==null)throw Error(`Vite RSC environment build missed entry: ${e}`);i.set(t,n)}return{entries:i,extraFiles:[...r.extraFiles]}})}async buildMdxRegistry(e){let t=qa({projectRoot:this.projectRoot,mdxOptions:e,alias:this.options.alias,cache:this.moduleAnalysisCache}),n=S.join(this.options.outDir,this.options.manifestPath),r;if(b.existsSync(n)){let e=await b.promises.readFile(n,`utf-8`),t=d(e);r=t&&us(t)?t:{components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()}}else r={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()};r.mdxRegistry=t.map(e=>({name:e.name,id:e.moduleId,client:e.client})),await b.promises.writeFile(n,JSON.stringify(r),`utf-8`)}async buildSSRClientComponents(){let e=S.join(this.options.outDir,`ssr`);await b.promises.mkdir(e,{recursive:!0});let t=[...this.getClientComponentFiles()];for(let e of this.discoveredExternalClientComponents)if(!t.some(t=>t.filePath===e))try{let n=b.readFileSync(e,`utf-8`);t.push({filePath:e,code:n})}catch{}try{let e=cs();if(e!=null&&e!==``){let n=b.readFileSync(e,`utf-8`);t.push({filePath:e,code:n})}}catch{}let n=[];for(let{componentId:e,devSourceSegments:t,publishedExport:r,exports:i}of is){let a=this.resolveExternalClientSourcePath(t,r);if(a!=null&&a!==``)try{let t=b.readFileSync(a,`utf-8`);n.push({componentId:e,filePath:a,code:t,exports:[...i],bundleName:`external_${qt(e)}`})}catch{}}let r={},i=await this.buildSsrEntriesWithVite(t,n);for(let t of i.extraFiles){let n=y(t.fileName),r=n===this.options.assetsDir||n.startsWith(`${this.options.assetsDir}/`)?S.join(this.options.outDir,n):S.join(e,n);await b.promises.mkdir(S.dirname(r),{recursive:!0}),await b.promises.writeFile(r,t.code)}for(let[e,a]of i.entries){let i=n.find(t=>t.filePath===e),o=i?.componentId??ds(e,this.projectRoot),s=`ssr/${i?.bundleName??fs(e,this.projectRoot)}.js`,c=S.join(this.options.outDir,s);await b.promises.mkdir(S.dirname(c),{recursive:!0}),await b.promises.writeFile(c,a.code,`utf-8`);let l=i?.code??t.find(t=>t.filePath===e)?.code??b.readFileSync(e,`utf-8`);r[o]={id:o,filePath:e,bundlePath:s,exports:i?.exports??this.extractExportNames(l)}}await this.writeClientReferenceManifest(e,r)}async buildSsrEntriesWithVite(e,t=[]){let n={entries:/* @__PURE__ */ new Map,extraFiles:[]},r=[...e.map(({filePath:e})=>({entryName:fs(e,this.projectRoot),filePath:e})),...t.map(e=>({entryName:e.bundleName,filePath:e.filePath}))];if(r.length===0)return n;if(this.viteBuilder==null)throw Error(`Vite builder is required for SSR environment emit`);let i=this.viteBuilder;return this.withEnvEmitLock(async()=>{let e=await be({viteBuilder:i,entries:r,minify:this.options.minify});if(e==null)throw Error(`Vite SSR environment build failed`);let t=/* @__PURE__ */ new Map;for(let n of r){let r=e.outputs.get(n.entryName);if(r==null)throw Error(`Vite SSR environment build missed entry: ${n.entryName}`);t.set(n.filePath,{code:r.code})}return{entries:t,extraFiles:[...e.extraFiles]}})}async writeClientReferenceManifest(e,t){let n=S.join(e,`manifest.json`);await b.promises.writeFile(n,JSON.stringify(t),`utf-8`);let r={};for(let[e,n]of Object.entries(t))for(let t of n.exports){let i=`${e}#${t}`;r[i]={id:i,chunks:`/${n.bundlePath}`,name:t}}let i=S.join(this.options.outDir,`server`);await b.promises.mkdir(i,{recursive:!0});let a=S.join(i,`client-reference-manifest.json`);await b.promises.writeFile(a,JSON.stringify(r),`utf-8`)}resolveExternalClientSourcePath(e,t){let n=S.join(os,...e);if(b.existsSync(n))return n;try{let e=w(import.meta.resolve(t));if(b.existsSync(e))return e}catch{}return null}extractExportNames(e){return bn(e)}getProjectRelativePath(e){return Jt(e,this.projectRoot)}getReadableComponentId(e){return Yt(e)}getComponentId(e){return Xt(e,this.projectRoot)}async rebuildComponent(e){rs.test(S.basename(e))&&(this.layoutCssSkipSet=null);let t=this.getComponentId(e),n=await b.promises.readFile(e,`utf-8`),r=this.extractDependencies(n,e),i={filePath:e,originalCode:n,dependencies:r,hasNodeImports:this.hasNodeImports(n,e)};this.isServerAction(n,e)?(this.serverActions.set(e,i),this.serverComponents.delete(e)):(this.serverComponents.set(e,i),this.serverActions.delete(e));let a=S.join(this.options.rscDir,`${t}.js`),o=S.join(this.options.outDir,a),s=this.buildCache.get(e),c=(await b.promises.stat(e)).mtimeMs;if(s&&s.timestamp>=c&&JSON.stringify(s.sourceDependencies)===JSON.stringify(r)){let n=this.serverActions.get(e)??this.serverComponents.get(e);return n&&s.bundledDependencies.length>0&&(n.dependencies=s.bundledDependencies),await b.promises.writeFile(o,s.code,`utf-8`),await this.updateManifestForComponent(t,e,a,s.css),{componentId:t,bundlePath:this.bundlePathForRuntime(o),success:!0}}let l=S.dirname(o);await b.promises.mkdir(l,{recursive:!0});let u=await this.emitRscEntries([{componentId:t,filePath:e}],{minify:this.options.minify}),d=u.outputs.get(t);if(d==null)throw Error(`Vite RSC environment build missed entry: ${t}`);await b.promises.writeFile(o,d.code,`utf-8`);let f=this.resolveServerCssSources(e,n),p=[...await this.writeComponentCssAsset(t,d.cssAssetSources.length>0?[...d.cssAssetSources]:f)];for(let e of u.extraFiles){let t=this.resolveExtraFileOutPath(e.fileName);await b.promises.mkdir(S.dirname(t),{recursive:!0}),await b.promises.writeFile(t,e.code)}let m=this.serverActions.get(e)??this.serverComponents.get(e);return this.buildCache.set(e,{code:d.code,css:p,timestamp:Date.now(),sourceDependencies:r,bundledDependencies:m?.dependencies??r}),await this.updateManifestForComponent(t,e,a,p),{componentId:t,bundlePath:this.bundlePathForRuntime(o),success:!0}}bundlePathForRuntime(e){return y(S.relative(this.projectRoot,e))}manifestCache=null;async updateManifestForComponent(e,t,n,r=[]){let i=S.join(this.options.outDir,this.options.manifestPath),a;if(this.manifestCache)a=this.manifestCache;else if(b.existsSync(i)){let e=await b.promises.readFile(i,`utf-8`),t=d(e);t&&us(t)?(a=t,this.manifestCache=a):(a={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()},this.manifestCache=a)}else a={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()},this.manifestCache=a;let o=this.serverComponents.get(t)??this.serverActions.get(t),s=S.join(this.options.outDir,n),c=Me(S.resolve(this.projectRoot,s)).href;if(o)a.components[e]={id:e,filePath:t,relativePath:S.relative(this.projectRoot,t),bundlePath:n,moduleSpecifier:c,dependencies:[...o.dependencies],hasNodeImports:o.hasNodeImports,css:r};else{let i=await b.promises.readFile(t,`utf-8`);a.components[e]={id:e,filePath:t,relativePath:S.relative(this.projectRoot,t),bundlePath:n,moduleSpecifier:c,dependencies:this.extractDependencies(i,t),hasNodeImports:this.hasNodeImports(i,t),css:r}}a.buildTime=(/* @__PURE__ */ new Date()).toISOString(),await b.promises.writeFile(i,JSON.stringify(a),`utf-8`),await this.writeRouteCssEntries(a),this.manifestCache=a}clearCache(){this.buildCache.clear(),this.manifestCache=null}invalidateBuildCacheFor(e){this.buildCache.delete(e)}};function hs(e,t){let n=[];for(let r of Vn(t))try{let t=Jn(r),i=b.readFileSync(r,`utf-8`),a=e.getModuleAnalysis(r,i);n.push({filePath:r,cacheKey:t,code:i,analysis:a})}catch(e){console.warn(`[server-build] Error reading ${r}:`,s(e,String(e)))}return n}function gs(e,t){return(t??mn(e)).hasComponentExport||_.test(e)||ne.test(e)||ce.test(e)}function _s(e,t,n,r){let i=S.basename(e);if(ts.test(i)||ns.test(i)||i.endsWith(`.d.ts`))return!1;let a=r??n.getModuleAnalysis(e,t);return a.directives.hasUseClient?!1:a.directives.hasUseServer?!0:!n.isOnlyImportedByClientComponents(e)&&ps(e,a)&&gs(t,a)}function vs(e,t,n=[]){let r=hs(t,Hn(e,n));t.clearClientComponentFiles(),t.populateImportGraphFromFiles(r);let i=[],a=[];for(let{filePath:e,code:n,analysis:o}of r)o.directives.hasUseClient&&(a.push(e),t.recordClientComponent(e,n)),_s(e,n,t,o)&&(t.addServerComponent(e,n,o),i.push(e));return{serverComponentPaths:i,clientComponentPaths:a}}function ys(e={}){let t=null,n,r,i={},a=!1;async function o(){if(t){try{await t.buildMdxRegistry(e.mdx)}catch(e){console.warn(`[rari] Failed to build MDX component registry:`,e)}try{let{generateRobotsFile:e}=await import(`./robots-B1bFAd4J.mjs`);await e({appDir:S.join(n,`src`,`app`),outDir:r,aliases:i})}catch(e){console.warn(`[rari] Failed to generate robots.txt:`,e)}try{let{generateSitemapFiles:e}=await import(`./sitemap-DJY3OiJ0.mjs`);await e({appDir:S.join(n,`src`,`app`),outDir:r,aliases:i})}catch(e){console.warn(`[rari] Failed to generate sitemap:`,e)}try{let{generateFeedFile:e}=await import(`./feed-uUGeOZmR.mjs`);await e({appDir:S.join(n,`src`,`app`),outDir:r,aliases:i})}catch(e){console.warn(`[rari] Failed to generate feed:`,e)}try{let e=S.join(r,`server`,`routes.json`);if(b.existsSync(e)){let t=ft(b.readFileSync(e,`utf-8`));t.length>0&&await ut({appDir:S.join(n,`src`,`app`),outDir:r,icons:t})}}catch(e){console.warn(`[rari] Failed to copy app icons:`,e)}try{let t=Ya(n,e.mdx),i=Xa(n,t.contentDirs).filter(e=>{let t=y(S.relative(n,e));return!(t===`public/content`||t.startsWith(`public/content/`)||t===`dist/content`||t.startsWith(`dist/content/`))});i.length>0&&Qa(i,S.join(r,`content`))}catch(e){console.warn(`[rari] Failed to copy MDX content:`,e)}Ra(r)}}return{name:`rari-server-build`,sharedDuringBuild:!0,configResolved(o){n=o.root,r=S.resolve(o.root,o.build.outDir),a=!1;let s=Gt(o);i=s;let c=typeof o.build.assetsDir==`string`&&o.build.assetsDir!==``?fe(o.build.assetsDir):`assets`;t=new ms(n,{...e,alias:s,assetsDir:c,outDir:r,minify:e.minify??o.mode===`production`})},buildStart(){if(!t)return;let e=C.env.NODE_ENV===`production`,r=[S.join(n,`dist`,`cache`,`og`),S.join(n,`dist`,`cache`,`images`)];e&&r.push(`/tmp/rari-og-cache`,`/tmp/rari-image-cache`);for(let e of r)try{b.existsSync(e)&&b.rmSync(e,{recursive:!0,force:!0})}catch(t){console.warn(`[rari] Failed to clear cache ${e}:`,t)}let a=S.join(n,`src`);b.existsSync(a)&&vs(a,t,Object.values(i))},async buildApp(e){if(!t||a)return;let n=e.environments.client;n.isBuilt||await e.build(n);let r=e.environments.rsc,i=e.environments.ssr;await r.init(),await i.init(),t.setViteBuilder(e),await t.buildServerComponents(),await t.buildSSRClientComponents(),a=!0,await o()}}}function bs(e,t,n){if(n.length===0)return e;let r=yn(e).find(e=>e.source===t&&!e.typeOnly&&!e.sideEffectOnly),i=/* @__PURE__ */ new Map;if(r!=null)for(let e of r.named)e.typeOnly||i.set(e.imported,e.local);for(let e of n)i.has(e)||i.set(e,e);let a=[...i.entries()].map(([e,t])=>e===t?e:`${e} as ${t}`);if(r?.namespaceBinding!=null||r?.named.some(e=>e.typeOnly)){let i=n.filter(e=>!r.named.some(t=>!t.typeOnly&&t.imported===e));return i.length===0?e:`${`import { ${[...new Set(i)].join(`, `)} } from ${JSON.stringify(t)};`}\n${e}`}let o=`import ${r?.defaultBinding==null?``:`${r.defaultBinding}, `}{ ${a.join(`, `)} } from ${JSON.stringify(t)};`;return r==null?`${o}\n\n${e}`:e.slice(0,r.start)+o+e.slice(r.end)}function xs(e,t){return`const ${e} = createClientModuleProxy(${JSON.stringify(t)});`}function Ss(e,t,n){return`const ${e} = registerClientReference(
|
|
74
|
+
`}function ks(e,t){return{componentsDir:t?.componentsDir??`src/components`,contentDirs:t?.contentDirs??[`src/content`,`content`,`public/content`]}}function As(e,t){return t.map(t=>O.join(e,t)).filter(e=>E.existsSync(e))}function js(e){let t=[],n=r=>{if(E.existsSync(r))for(let i of E.readdirSync(r,{withFileTypes:!0})){let a=O.join(r,i.name);i.isDirectory()?n(a):i.isFile()&&t.push(w(O.relative(e,a)))}};return n(e),t}function Ms(e,t){for(let n of e)for(let e of js(n)){let r=O.join(n,e),i=O.join(t,e);if(E.existsSync(i)){console.warn(`[rari] Skipping MDX content conflict: ${e} already copied from an earlier content dir`);continue}E.mkdirSync(O.dirname(i),{recursive:!0}),E.copyFileSync(r,i)}}function Ns(e,t,n){let r=O.join(e,t),i=new Set(n);return E.existsSync(r)&&i.add(r),[...i]}const Ps=/\.cookies\b|\.headers\b|\.searchParams\b|\.geo\b|\.ip\b|\bwaitUntil\b|\bfetch\s*\(|RariResponse\.json\b|\.startsWith\s*\(|\.includes\s*\(|\.endsWith\s*\(|\bawait\b|`[^`]*\$\{/,Fs=/RariResponse\.(?:redirect|rewrite)\s*\(/,Is=/if\s*\(([^)]+)\)(?:\s*\{)?\s+return\s+RariResponse\.(redirect|rewrite)\(\s*new\s+URL\(\s*(['"`])([^'"`]+)\3\s*,[^)]+\)(?:\s*,\s*(\d+))?\s*\)/g,Ls=/^(?:(request\.rariUrl\.pathname|pathname|normalizedPath)\s*(?:===|==)\s*(['"`])([^'"`]+)\2|(['"`])([^'"`]+)\4\s*(?:===|==)\s*(request\.rariUrl\.pathname|pathname|normalizedPath))$/,Rs=/export\s+const\s+config\s*=/,zs=/export\s+const\s+config\s*=\s*\{/,Bs=/matcher\s*:\s*\{/,Vs=/matcher\s*:\s*(['"`])([^'"`]+)\1/,Hs=/matcher\s*:\s*\[([^\]]*)\]/,Us=/(['"`])matcher\1\s*:\s*\{/,Ws=/(['"`])matcher\1\s*:\s*(['"`])([^'"`]+)\2/,Gs=/(['"`])matcher\1\s*:\s*\[([^\]]*)\]/,Ks=/(['"`])matcher\1\s*:/,qs=/(['"`])([^'"`]+)\1/g,Js=/(?:^|[{,]\s*)matcher\s*[,}]/;function Ys(e){return e===301||e===308}const Xs=/* @__PURE__ */ new Set([`return`,`throw`,`case`,`else`,`do`,`typeof`,`delete`,`void`,`await`,`yield`,`new`,`in`,`of`,`instanceof`]);function Zs(e){return e===`
|
|
75
|
+
`||e===`\r`||e===`\u2028`||e===`\u2029`}function Qs(e,t){for(t-=2;t>=1;){if(e.charAt(t-1)===`/`&&e.charAt(t)===`*`)return t-2;--t}return t}function $s(e,t,n){for(let r=t;r<n;r++){if(e.charAt(r)===`/`&&e.charAt(r+1)===`/`)return r;if(e.charAt(r)===`/`&&e.charAt(r+1)===`*`){for(r+=2;r<n&&(e.charAt(r)!==`*`||e.charAt(r+1)!==`/`);)r+=1;r+=1}}return-1}function ec(e,t){let n=t-1;for(;n>=0;){for(;n>=0&&/\s/.test(e.charAt(n));)--n;if(n<0)return n;if(e.charAt(n)===`/`&&n>0&&e.charAt(n-1)===`*`){n=Qs(e,n);continue}let t=n;for(;t>0&&!Zs(e.charAt(t-1));)--t;let r=$s(e,t,n);if(r!==-1){n=r-1;continue}break}return n}function tc(e,t){let n=ec(e,t);if(n<0)return!0;let r=e.charAt(n);if(/[)}\]]/.test(r))return!1;if(!/[\w$]/.test(r))return!0;let i=n;for(;i>=0&&/[\w$]/.test(e.charAt(i));)--i;return Xs.has(e.slice(i+1,n+1))}function nc(e){return e===`
|
|
76
|
+
`||e===`\r`||e===`\u2028`||e===`\u2029`}function rc(e){switch(e){case`n`:return`
|
|
77
|
+
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;case`v`:return`\v`;case`0`:return`\0`;case`\\`:case`'`:case`"`:case"`":case`/`:return e;default:return null}}function ic(e,t,n){if(n===`x`){let n=e.slice(t+1,t+3);return/^[\da-f]{2}$/i.test(n)?{char:String.fromCharCode(Number.parseInt(n,16)),end:t+2}:null}if(n!==`u`)return null;if(e.charAt(t+1)===`{`){let n=e.indexOf(`}`,t+2);if(n===-1)return null;let r=e.slice(t+2,n);return/^[\da-f]+$/i.test(r)?{char:String.fromCodePoint(Number.parseInt(r,16)),end:n}:null}let r=e.slice(t+1,t+5);return/^[\da-f]{4}$/i.test(r)?{char:String.fromCharCode(Number.parseInt(r,16)),end:t+4}:null}function ac(e,t,n,r){if(nc(n)){let i=t;return n===`\r`&&e.charAt(t+1)===`
|
|
78
|
+
`&&(i=t+1),{out:r,i}}let i=rc(n);if(i!=null)return{out:r+i,i:t};let a=ic(e,t,n);return a==null?n===`x`||n===`u`?null:{out:r+n,i:t}:{out:r+a.char,i:a.end}}function oc(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e.charAt(r);if(t==="`"&&i===`$`&&e.charAt(r+1)===`{`)return null;if(i!==`\\`){n+=i;continue}if(r+=1,r>=e.length)return null;let a=ac(e,r,e.charAt(r),n);if(a==null)return null;n=a.out,r=a.i}return n}function sc(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`){r+=1;continue}if(n==="`"&&t===`$`&&e[r+1]===`{`)return null;if(t===n)return r+1}return null}function cc(e,t,n,r){return n===`\\`?r+2:((t===`single`&&n===`'`||t===`double`&&n===`"`)&&e.pop(),r+1)}function lc(e,t,n,r){return t===`\\`?r+2:t==="`"?(e.pop(),r+1):t===`$`&&n===`{`?(e.push({kind:`code`,braceDepth:1}),r+2):r+1}function uc(e,t,n,r,i){if(n===`\\`)return r+2;if(n===`[`)return e.push({kind:`regex-class`}),r+1;if(n===`/`){e.pop();let n=r+1;for(;n<i&&/[a-z]/i.test(t.charAt(n));)n+=1;return n}return r+1}function dc(e,t,n){return t===`\\`?n+2:(t===`]`&&e.pop(),n+1)}function fc(e,t,n,r=t.length){let i=e.at(-1);if(i===void 0||i.kind===`code`)return null;let a=t.charAt(n),o=t.charAt(n+1);return i.kind===`line-comment`?(a===`
|
|
79
|
+
`&&e.pop(),n+1):i.kind===`block-comment`?a===`*`&&o===`/`?(e.pop(),n+2):n+1:i.kind===`single`||i.kind===`double`?cc(e,i.kind,a,n):i.kind===`template`?lc(e,a,o,n):i.kind===`regex`?uc(e,t,a,n,r):dc(e,a,n)}function pc(e,t,n){let r=t.charAt(n),i=t.charAt(n+1);return r===`/`&&i===`/`?(e.push({kind:`line-comment`}),n+2):r===`/`&&i===`*`?(e.push({kind:`block-comment`}),n+2):r===`/`&&tc(t,n)?(e.push({kind:`regex`}),n+1):r===`'`?(e.push({kind:`single`}),n+1):r===`"`?(e.push({kind:`double`}),n+1):r==="`"?(e.push({kind:`template`}),n+1):null}function mc(e,t,n){return n===`{`?(e.braceDepth+=1,!0):n===`}`&&(--e.braceDepth,e.braceDepth===0&&t.length>1&&t.pop(),!0)}function hc(e,t,n,r,i){--e.braceDepth;let a=i+1;return e.braceDepth===0?t.length===1?{i:a,done:n.slice(r,a)}:(t.pop(),{i:a,done:null}):{i:a,done:null}}function gc(e,t,n,r){let i=e.at(-1);if(i===void 0)return null;let a=fc(e,t,n);if(a!=null)return{i:a,done:null};if(i.kind!==`code`)return null;let o=pc(e,t,n);if(o!=null)return{i:o,done:null};let s=t.charAt(n);return s===`{`?(i.braceDepth+=1,{i:n+1,done:null}):s===`}`?hc(i,e,t,r,n):{i:n+1,done:null}}function _c(e,t){let n=[{kind:`code`,braceDepth:0}];for(let r=t;r<e.length;){let i=gc(n,e,r,t);if(i==null)return null;if(i.done!=null)return i.done;r=i.i}return null}function vc(e,t,n){if(n==="`"&&sc(e,t,"`")==null)return{forceRuntime:!0,endIndex:e.length};let r=sc(e,t,n);if(r==null)return{forceRuntime:!0,endIndex:e.length};let i=e.slice(t+1,r-1);if(n==="`"&&i.includes("${"))return{forceRuntime:!0,endIndex:r};let a=oc(i,n);return a==null||a===``?{forceRuntime:!0,endIndex:r}:{matcher:a,forceRuntime:!1,endIndex:r}}function yc(e,t,n,r){let i=n[r],a=n[r+1];return i===`\\`?{j:r+2}:t.kind===`template`&&i===`$`&&a===`{`?{j:r,forceRuntime:!0}:((t.kind===`single`&&i===`'`||t.kind===`double`&&i===`"`||t.kind===`template`&&i==="`")&&e.pop(),{j:r+1})}function bc(e,t,n){let r=e.at(-1);return r===void 0?{j:n,forceRuntime:!0}:r.kind===`line-comment`?(t[n]===`
|
|
80
|
+
`&&e.pop(),{j:n+1}):r.kind===`block-comment`?t[n]===`*`&&t[n+1]===`/`?(e.pop(),{j:n+2}):{j:n+1}:r.kind===`single`||r.kind===`double`||r.kind===`template`?yc(e,r,t,n):null}function xc(e,t,n){let r=t[n],i=t[n+1];return r===`/`&&i===`/`?(e.push({kind:`line-comment`}),n+2):r===`/`&&i===`*`?(e.push({kind:`block-comment`}),n+2):r===`'`?(e.push({kind:`single`}),n+1):r===`"`?(e.push({kind:`double`}),n+1):r==="`"?(e.push({kind:`template`}),n+1):null}function Sc(e,t,n){let r=e[t];return r===`[`?{j:t+1,depth:n+1}:r===`]`?{j:t+1,depth:n-1}:r===`{`?{j:t,depth:n,forceRuntime:!0}:{j:t+1,depth:n}}function Cc(e,t){let n=t+1,r=1,i=n,a=[{kind:`code`,braceDepth:0}];for(;i<e.length&&r>0;){let t=bc(a,e,i);if(t!=null){if(t.forceRuntime)return{forceRuntime:!0,endIndex:e.length};i=t.j;continue}let n=xc(a,e,i);if(n!=null){i=n;continue}let o=Sc(e,i,r);if(o.forceRuntime)return{forceRuntime:!0,endIndex:o.j};i=o.j,r=o.depth}return r===0?{...jc(e.slice(n,i-1)),endIndex:i}:{forceRuntime:!0,endIndex:e.length}}function wc(e,t){let n=t+1;for(;n<e.length&&/\s/.test(e[n]);)n+=1;if(n>=e.length)return null;let r=e[n];return r===`'`||r===`"`||r==="`"?vc(e,n,r):r===`[`?Cc(e,n):{forceRuntime:!0,endIndex:n+1}}function Tc(e,t,n,r){let i=t===0?``:e.charAt(t-1),a=t===0||/[\s;{}]/.test(i);if(n.braceDepth!==0||r.length!==1||!a)return null;if(e.startsWith(`let matcher`,t)||e.startsWith(`var matcher`,t))return{nextI:t,forceRuntime:!0};if(!e.startsWith(`const matcher`,t))return null;let o=t+13;if(o<e.length&&/[\w$]/.test(e.charAt(o)))return{nextI:t+1};let s=o;for(;s<e.length&&/\s/.test(e.charAt(s));)s+=1;if(e.charAt(s)!==`=`)return{nextI:t+1};let c=wc(e,s);return c==null||c.forceRuntime?{nextI:t,forceRuntime:!0}:{nextI:c.endIndex,binding:{matcher:c.matcher,forceRuntime:!1}}}function Ec(e,t,n,r){let i=e.at(-1);if(i===void 0)return{nextI:n,forceRuntime:!0};let a=fc(e,t,n);if(a!=null)return{nextI:a};if(i.kind!==`code`)return{nextI:n,forceRuntime:!0};let o=pc(e,t,n);if(o!=null)return{nextI:o};if(mc(i,e,t.charAt(n)))return{nextI:n+1};let s=Tc(t,n,i,e);return s==null?{nextI:n+1}:s.forceRuntime?{nextI:n,forceRuntime:!0}:(s.binding&&r.push(s.binding),{nextI:s.nextI})}function Dc(e){let t=[{kind:`code`,braceDepth:0}],n=[];for(let r=0;r<e.length;){let i=Ec(t,e,r,n);if(i==null||i.forceRuntime)return{forceRuntime:!0};r=i.nextI}return n.length===0?null:n.length>1?{forceRuntime:!0}:n[0]??null}function Oc(e){let t=e.trim();if(t===``||t.includes(`&&`))return null;let n=t.split(/\|\|/),r=[],i;for(let e of n){let t=Ls.exec(e.trim());if(t==null)return null;let n=t[1]||t[6]||``,a=t[3]||t[5]||``;if(n===``||a===``)return null;if(i==null)i=n;else if(i!==n)return null;r.push(a)}return r.length>0?r:null}function kc(e){let t=[];Is.lastIndex=0;for(let n of e.matchAll(Is)){let e=n[1],r=n[2],i=n[4],a=Number.parseInt(n[5],10),o=Number.isFinite(a)?a:void 0;if(e===``||i===``||r!==`redirect`&&r!==`rewrite`)continue;let s=Oc(e);if(s==null)return[];for(let e of s)t.push({source:e,type:r,destination:i,...r===`redirect`?{permanent:Ys(o)}:{}})}return t}function Ac(e){let t=zs.exec(e);return t==null?null:_c(e,t.index+t[0].length-1)}function jc(e){if(e.includes(`{`))return{forceRuntime:!0};let t=[];qs.lastIndex=0;for(let n of e.matchAll(qs)){let e=n[1],r=n[2];if(r===``||e!==`'`&&e!==`"`&&e!=="`")continue;let i=oc(r,e);if(i==null)return{forceRuntime:!0};i!==``&&t.push(i)}return e.replace(qs,``).replace(/[\s,]/g,``)===``&&t.length>0?{matcher:t,forceRuntime:!1}:{forceRuntime:!0}}function Mc(e,t){let n=[{kind:`code`,braceDepth:0}];for(let r=0;r<t;){let i=n.at(-1);if(i===void 0)return null;let a=fc(n,e,r,t);if(a!=null){r=a;continue}if(i.kind!==`code`)return null;let o=pc(n,e,r);if(o!=null){r=o;continue}if(mc(i,n,e.charAt(r))){r+=1;continue}r+=1}let r=n.at(-1);return r?.kind===`code`?r.braceDepth:null}function Nc(e,t){return Mc(e,t)===1}function Pc(e){return e.startsWith(`'`)||e.startsWith(`"`)||e.startsWith("`")}function J(e,t){let n=new RegExp(t.source,t.flags.includes(`g`)?t.flags:`${t.flags}g`);for(let t of e.matchAll(n)){let n=Pc(t[0])?t.index:t.index+t[0].indexOf(`matcher`);if(n>=t.index&&Nc(e,n))return t}return null}function Fc(e,t){let n=t;for(;n<e.length;){let t=Lc(e,n);if(t!=null){n=t;continue}let r=e.charAt(n);return r===`,`||r===`}`}return!0}function Ic(e,t){let n=t;for(;n<e.length;){let t=Lc(e,n);if(t==null)break;n=t}return n}function Lc(e,t){let n=e.charAt(t),r=e.charAt(t+1);if(/\s/.test(n))return t+1;if(n===`/`&&r===`/`){let n=t+2;for(;n<e.length&&!Zs(e.charAt(n));)n+=1;return n}if(n===`/`&&r===`*`){let n=t+2;for(;n+1<e.length&&(e.charAt(n)!==`*`||e.charAt(n+1)!==`/`);)n+=1;return n+2}return null}function Rc(e,t){if(e.charAt(t)!==`[`)return null;let n=Ic(e,t+1);if(n>=e.length)return{endIndex:e.length,forceRuntime:!0};let r=e.charAt(n);if(r===`'`||r===`"`||r==="`"){let t=sc(e,n,r);if(t==null)return{endIndex:e.length,forceRuntime:!0};let i=e.slice(n+1,t-1);if(r==="`"&&i.includes("${"))return{endIndex:t,forceRuntime:!0};let a=oc(i,r);return n=Ic(e,t),e.charAt(n)===`]`?{endIndex:n+1,forceRuntime:a===`matcher`}:{endIndex:n,forceRuntime:!0}}return{endIndex:t+1,forceRuntime:!0}}function zc(e,t,n,r){return n===`'`||n===`"`||n==="`"?{entered:!0,expectPropertyKey:r&&t.braceDepth===1?!1:r}:{entered:!1,expectPropertyKey:r}}function Bc(e,t,n,r){return n===`{`?(e.braceDepth+=1,{handled:!0,expectPropertyKey:e.braceDepth===1||r}):n===`}`?(--e.braceDepth,e.braceDepth===0&&t.length>1&&t.pop(),{handled:!0,expectPropertyKey:!1}):n===`,`&&e.braceDepth===1?{handled:!0,expectPropertyKey:!0}:n===`:`&&e.braceDepth===1?{handled:!0,expectPropertyKey:!1}:{handled:!1,expectPropertyKey:r}}function Vc(e,t,n,r,i,a){if(!r||n.braceDepth!==1||/\s/.test(i))return null;if(i===`.`&&a===`.`&&e.charAt(t+2)===`.`)return{unsafe:!0};if(i===`[`){let n=Rc(e,t);return n?.forceRuntime===!0||n==null?{unsafe:!0}:{unsafe:!1,nextI:n.endIndex,clearExpect:!0}}return{unsafe:!1,clearExpect:!0}}function Hc(e,t,n,r){let i=e.at(-1);if(i===void 0)return null;let a=fc(e,t,n);if(a!=null)return{nextI:a,expectPropertyKey:r};if(i.kind!==`code`)return null;let o=t.charAt(n),s=t.charAt(n+1),c=zc(e,i,o,r);if(c.entered)return{nextI:pc(e,t,n)??n+1,expectPropertyKey:c.expectPropertyKey};let l=pc(e,t,n);if(l!=null)return{nextI:l,expectPropertyKey:r};let u=Bc(i,e,o,r);if(u.handled)return{nextI:n+1,expectPropertyKey:u.expectPropertyKey};let d=Vc(t,n,i,r,o,s);return d==null?{nextI:n+1,expectPropertyKey:r}:d.unsafe?{nextI:n,expectPropertyKey:r,unsafe:!0}:{nextI:d.nextI??n+1,expectPropertyKey:!d.clearExpect&&r}}function Uc(e){let t=[{kind:`code`,braceDepth:0}],n=!1;for(let r=0;r<e.length;){let i=Hc(t,e,r,n);if(i==null)return!1;if(i.unsafe)return!0;n=i.expectPropertyKey,r=i.nextI}return!1}function Wc(e,t){let n=Pc(t[0]),r=n?t[2]:t[1],i=n?t[3]:t[2];if(r!==`'`&&r!==`"`&&r!=="`")return null;if(r==="`"&&i.includes("${")||!Fc(e,t.index+t[0].length))return{forceRuntime:!0};let a=oc(i,r);return a==null||a===``?{forceRuntime:!0}:{matcher:a,forceRuntime:!1}}function Gc(e){if(!Rs.test(e)||!zs.test(e))return{forceRuntime:!1};let t=Ac(e);if(t==null||Uc(t)||J(t,Bs)!=null||J(t,Us)!=null)return{forceRuntime:!0};let n=J(t,Vs)??J(t,Ws);if(n!=null)return Wc(t,n)??{forceRuntime:!1};let r=J(t,Hs)??J(t,Gs);return r==null?J(t,Js)==null?J(t,/matcher\s*:/)!=null||J(t,Ks)!=null?{forceRuntime:!0}:{forceRuntime:!1}:Dc(e)??{forceRuntime:!0}:Fc(t,r.index+r[0].length)?jc(Pc(r[0])?r[2]:r[1]):{forceRuntime:!0}}function Kc(e){let{matcher:t,forceRuntime:n}=Gc(e);if(n||Ps.test(e))return{requiresRuntime:!0,rules:[],...t==null?{}:{matcher:t}};let r=Fs.test(e),i=kc(e);return r&&i.length===0?{requiresRuntime:!0,rules:[],...t==null?{}:{matcher:t}}:{requiresRuntime:!1,rules:i,...t==null?{}:{matcher:t}}}function qc(e){let t=Kc(e.code),n=t.requiresRuntime;return{proxyFile:e.proxyFile,enabled:!0,generated:e.generated??(/* @__PURE__ */ new Date()).toISOString(),rules:t.rules,requiresRuntime:n,...n&&e.bundlePath!=null&&e.bundlePath!==``?{bundlePath:e.bundlePath}:{},...t.matcher==null?{}:{matcher:t.matcher}}}const Jc=/@import\s+(?:url\(\s*)?['"](?![a-zA-Z][a-zA-Z0-9+.-]*:|\/\/|\.\/|\.\.\/|\/)[^'"]+['"][^;]*(?:;|$)/g,Yc=/@import\s+(?:url\(\s*((?:\.\/|\.\.\/)[^)\s]+)\s*\)|url\(\s*['"]((?:\.\/|\.\.\/)[^'"]+)['"]\s*\)|['"]((?:\.\/|\.\.\/)[^'"]+)['"])([^;]*)(?:;|$)/g,Xc=/\.css(?:\?.*)?$/,Zc=/\.module\.css(?:\?.*)?$/i;function Qc(e){return Zc.test(e.replace(/[?#].*$/,``))}function $c(e){return e.replace(Jc,``).trim()}function el(e){if(!/^supports\s*\(/i.test(e))return{supportsCondition:null,rest:e};let t=e.indexOf(`(`),n=0,r=-1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`(`)n++;else if(t===`)`&&(n--,n===0)){r=i;break}}return r===-1?{supportsCondition:null,rest:e}:{supportsCondition:e.slice(t+1,r).trim(),rest:e.slice(r+1).trim()}}function tl(e){if(/^layer\s*\(/i.exec(e)){let t=e.indexOf(`(`),n=e.indexOf(`)`,t);return n===-1?{layerName:null,rest:e}:{layerName:e.slice(t+1,n).trim(),rest:e.slice(n+1).trim()}}return/^layer(?:\s|$)/i.test(e)?{layerName:``,rest:e.replace(/^layer\s*/i,``)}:{layerName:null,rest:e}}function nl(e){let t=e.trim().replace(/^\)\s*/,``),n=tl(t);t=n.rest;let r=el(t);t=r.rest;let i=t.trim()===``?null:t.trim();return{layerName:n.layerName,supportsCondition:r.supportsCondition,mediaQuery:i}}function rl(e,t){let n=e.trim();return n===``?``:(t.layerName!==null&&(n=t.layerName===``?`@layer {\n${n}\n}`:`@layer ${t.layerName} {\n${n}\n}`),t.supportsCondition!=null&&t.supportsCondition!==``&&(n=`@supports (${t.supportsCondition}) {\n${n}\n}`),t.mediaQuery!=null&&t.mediaQuery!==``&&(n=`@media ${t.mediaQuery} {\n${n}\n}`),n)}function il(e,t,n=/* @__PURE__ */ new Set){let r=O.resolve(e);return n.has(r)?``:(n.add(r),t.replace(Yc,(e,t,i,a,o)=>{let s=t??i??a;if(s==null||s===``)return e;let c=O.resolve(O.dirname(r),s);try{return!E.existsSync(c)||!E.statSync(c).isFile()?e:rl(al(c,E.readFileSync(c,`utf-8`),new Set(n)),nl(o))}catch{return e}}).trim())}function al(e,t,n=/* @__PURE__ */ new Set){return il(e,$c(t),n)}function ol(e,t){let n=/* @__PURE__ */ new Set;for(let r of Hr(e,t)){if(O.isAbsolute(r)){n.add(O.resolve(r));continue}try{n.add(we(O.join(e,`package.json`)).resolve(r))}catch{}}return n}function sl(e){return E.existsSync(e)&&E.statSync(e).isFile()?e:null}function cl(e,t,n){let r=[t,O.join(n,`package.json`)];for(let t of r)try{let n=sl(we(t).resolve(e));if(n!=null)return n}catch{try{let n=sl(A(import.meta.resolve(e,ke(t).href)));if(n!=null)return n}catch{}}return null}function ll(e,t,n,r){let i=e.replace(/[?#].*$/,``);if(!Xc.test(i))return null;if(O.isAbsolute(i))return sl(i);if(i.startsWith(`./`)||i.startsWith(`../`))return sl(O.resolve(O.dirname(t),i));let a=T(i,r,n);if(a!=null&&a!==``){let e=sl(a);if(e!=null)return e}return cl(i,t,n)}function ul(e){let t=e.includes(`?`)?e.slice(e.indexOf(`?`)):``;return/(?:\?|&)raw(?:&|$)/.test(t)||/(?:\?|&)url(?:&|$)/.test(t)}function dl(e,t){if(Qc(e)||t.has(O.resolve(e)))return null;try{let t=al(e,E.readFileSync(e,`utf-8`));return t===``?null:t}catch{return null}}function fl(e){let t=[];for(let n of Fn(e.code)){if(!Xc.test(n.source)||Qc(n.source)||ul(n.source))continue;let r=ll(n.source,e.filePath,e.projectRoot,e.aliases);if(r==null)continue;let i=dl(r,e.layoutCssSkip);i!=null&&t.push(i)}return t}const pl=/^proxy\.(?:tsx?|jsx?|mts|mjs)$/,ml=/^(?:robots|sitemap|feed)\.(?:tsx?|jsx?)$/,hl=/^(?:favicon|icon\d*|apple-icon\d*)\.(?:ico|png|jpe?g|svg)$/i,gl=/^layout\.(?:tsx|ts|jsx|js)$/,_l=[{componentId:`rari/image`,devSourceSegments:[`src`,`image`,`image.tsx`],publishedExport:`rari/image`,exports:[`Image`]}],vl=O.dirname(A(import.meta.url)),yl=O.dirname(vl);function bl(e){return e.startsWith(yl)}function xl(){let e=O.join(yl,`src`,`runtime`,`boundaries`,`error-boundary-wrapper.tsx`);if(E.existsSync(e))return e;try{let e=A(import.meta.resolve(`rari/runtime/ErrorBoundaryWrapper`));if(E.existsSync(e))return e}catch{}return null}function Sl(e){let t=w(e);if(t===`virtual:error-boundary-wrapper.tsx`||t.includes(`virtual:error-boundary-wrapper`))return!0;let n=xl();return n!=null&&O.resolve(e)===O.resolve(n)||t.endsWith(`/runtime/boundaries/error-boundary-wrapper.tsx`)}function Cl(e){return u(e)&&u(e.components)}function wl(e,t){if(Sl(e))return`virtual:error-boundary-wrapper.tsx`;let n=w(O.relative(t,e));return n.startsWith(`..`)||O.isAbsolute(n)?w(e):n}function Tl(e,t){if(Sl(e))return`error_boundary_wrapper_${P(`virtual:error-boundary-wrapper.tsx`)}`;if(bl(e)){let t=w(O.relative(yl,e));return`${Gt(t)}_${P(t)}`}return Kt(e,t)}function El(e,t){return!e.includes(`node_modules`)&&!t.directives.hasUseClient&&!t.directives.hasUseServer}var Dl=class{serverComponents=/* @__PURE__ */ new Map;serverActions=/* @__PURE__ */ new Map;options;projectRoot;buildCache=/* @__PURE__ */ new Map;useCacheBuildId=null;fileImporters=/* @__PURE__ */ new Map;moduleAnalysisCache;discoveredExternalClientComponents=/* @__PURE__ */ new Set;clientComponentFiles=/* @__PURE__ */ new Map;layoutCssSkipSet=null;viteBuilder=null;envEmitLock=Promise.resolve();getLayoutCssSkipSet(){return this.layoutCssSkipSet??=ol(this.projectRoot,this.options.alias),this.layoutCssSkipSet}resolveServerCssSources(e,t){return fl({filePath:e,code:t,projectRoot:this.projectRoot,aliases:this.options.alias,layoutCssSkip:this.getLayoutCssSkipSet()})}resolveExtraFileOutPath(e){let t=w(e);return t===this.options.assetsDir||t.startsWith(`${this.options.assetsDir}/`)?O.join(this.options.clientOutDir,t):O.join(this.options.outDir,this.options.rscDir,t)}setViteBuilder(e){this.viteBuilder=e}getProjectRoot(){return this.projectRoot}async getEmitBuilder(){return this.viteBuilder??=await le({root:this.projectRoot,logLevel:`error`}),this.viteBuilder}async withEnvEmitLock(e){let t=this.envEmitLock,n;this.envEmitLock=new Promise(e=>{n=e}),await t;try{return await e()}finally{n()}}async emitRscEntries(e,t){return this.withEnvEmitLock(async()=>{let n=await this.getEmitBuilder(),r=await pe({viteBuilder:n,entries:e,minify:t?.minify??this.options.minify,codeSplitting:t?.codeSplitting});if(r==null)throw Error(`Vite RSC environment build failed`);return r})}recordClientComponent(e,t){this.clientComponentFiles.set(e,t)}getClientComponentFiles(){return[...this.clientComponentFiles.entries()].map(([e,t])=>({filePath:e,code:t}))}getClientComponentPaths(){return[...this.clientComponentFiles.keys()]}getModuleAnalysisCache(){return this.moduleAnalysisCache}clearClientComponentFiles(){this.clientComponentFiles.clear()}getComponentCount(){return this.serverComponents.size+this.serverActions.size}hasComponent(e){return this.serverComponents.has(e)||this.serverActions.has(e)}removeComponent(e){this.serverComponents.delete(e),this.serverActions.delete(e),this.moduleAnalysisCache.invalidate(e)}getImportGraph(){let e=/* @__PURE__ */ new Map;for(let[t,n]of this.fileImporters)e.set(t,new Set(n));return e}async writeComponentCssAsset(e,t){if(t.length===0)return[];let n=O.join(this.options.clientOutDir,`assets`,`server`);await E.promises.mkdir(n,{recursive:!0});let r=`${t.join(`
|
|
81
|
+
`)}\n`,i=`${P(e+r,12)}.css`,a=O.join(n,i);return await E.promises.writeFile(a,r,`utf-8`),[`/assets/server/${i}`]}getComponentIdFromRouteManifestPath(e){return this.getComponentId(O.join(this.projectRoot,`src`,`app`,e))}getComponentReferenceId(e){return this.getReadableComponentId(this.getProjectRelativePath(e))}async writeRouteCssEntries(e){let t=O.join(this.options.outDir,this.options.rscDir,`routes.json`);if(!E.existsSync(t))return;let n=await E.promises.readFile(t,`utf-8`),r=JSON.parse(n);if(!u(r))return;let i=r,a=t=>{if(Array.isArray(t))for(let n of t){if(!u(n))continue;let t=n.filePath;if(typeof t!=`string`||t===``)continue;let r=this.getComponentIdFromRouteManifestPath(t);n.componentId=r;let i=e.components[r]?.css??[];i.length?n.css=i:delete n.css}};a(i.routes),a(i.layouts),a(i.loading),a(i.errors),a(i.notFound),a(i.templates);let o=i.apiRoutes;if(Array.isArray(o))for(let e of o){if(!u(e))continue;let t=e.filePath;typeof t==`string`&&t!==``&&(e.componentId=this.getComponentIdFromRouteManifestPath(t))}await E.promises.writeFile(t,JSON.stringify(i),`utf-8`)}constructor(e,t={}){this.projectRoot=O.resolve(e),this.moduleAnalysisCache=t.moduleAnalysisCache??new Mr;let n=t.rscDir!=null&&t.rscDir!==``?t.rscDir:`server`,r=t.outDir!=null&&t.outDir!==``?t.outDir:xe,i=Se(this.projectRoot,r),a=t.clientOutDir!=null&&t.clientOutDir!==``?Se(this.projectRoot,t.clientOutDir):O.join(i,`client`);this.options={outDir:i,clientOutDir:a,rscDir:n,manifestPath:t.manifestPath!=null&&t.manifestPath!==``?t.manifestPath:O.join(n,`manifest.json`),serverConfigPath:t.serverConfigPath!=null&&t.serverConfigPath!==``?t.serverConfigPath:O.join(n,`config.json`),minify:t.minify??k.env.NODE_ENV===`production`,alias:t.alias??{},assetsDir:t.assetsDir!=null&&t.assetsDir!==``?C(t.assetsDir):`assets`,define:t.define,csp:t.csp,cacheControl:t.cacheControl,cache:t.cache,action:t.action,jsPoolSize:t.jsPoolSize,origin:t.origin,htmlLimitedBots:t.htmlLimitedBots,experimental:t.experimental,mdx:t.mdx}}getModuleAnalysis(e,t){return this.moduleAnalysisCache.get(e,t)}isServerComponent(e,t){try{return El(e,this.moduleAnalysisCache.get(e,t))}catch{return!1}}isClientComponent(e,t){if(Sl(e))return!0;try{return this.moduleAnalysisCache.get(e,t).directives.hasUseClient}catch{return!1}}resolveImportedFilePath(e,t){let n=null;if(t.startsWith(`./`)||t.startsWith(`../`)){let r=O.dirname(e);n=O.resolve(r,t)}else if(n=T(t,this.options.alias,this.projectRoot),(n==null||n===``)&&t.startsWith(`@/`)){let e=t.slice(2);n=O.join(this.projectRoot,`src`,e)}return n==null||n===``?null:ge(n,[``,`.ts`,`.tsx`,`.js`,`.jsx`])}populateImportGraphFromFiles(e){this.fileImporters.clear();for(let{filePath:t,analysis:n}of e)for(let e of kr(n.importSources)){let n=this.resolveImportedFilePath(t,e);n!=null&&n!==``&&(this.fileImporters.has(n)||this.fileImporters.set(n,/* @__PURE__ */ new Set),this.fileImporters.get(n).add(t))}}buildImportGraph(e){let t=Ol(this,[e]);this.populateImportGraphFromFiles(t)}isOnlyImportedByClientComponents(e){let t=this.fileImporters.get(e);if(!t||t.size===0)return!1;for(let e of t)if(!this.isClientComponent(e)&&!this.isOnlyImportedByClientComponents(e))return!1;return!0}addServerComponent(e,t,n){let r=t??E.readFileSync(e,`utf-8`),i=n??this.moduleAnalysisCache.get(e,r),a=Or(i.importSources),o=Dr(i);if(i.directives.hasUseServer){this.serverActions.set(e,{filePath:e,originalCode:r,dependencies:a,hasNodeImports:o});return}El(e,i)&&this.serverComponents.set(e,{filePath:e,originalCode:r,dependencies:a,hasNodeImports:o})}isServerAction(e,t){return t!=null&&t!==``?this.moduleAnalysisCache.get(t,e).directives.hasUseServer:z(e).directives.hasUseServer}extractDependencies(e,t){return Or((t!=null&&t!==``?this.moduleAnalysisCache.get(t,e):z(e)).importSources)}hasNodeImports(e,t){return Dr(t!=null&&t!==``?this.moduleAnalysisCache.get(t,e):z(e))}async getTransformedComponentsForDevelopment(e){let t=[];for(let[n]of this.serverComponents)(!e||e(n))&&t.push({componentId:this.getComponentId(n),filePath:n,isAction:!1});for(let[n]of this.serverActions)(!e||e(n))&&t.push({componentId:this.getComponentId(n),filePath:n,isAction:!0});if(t.length===0)return[];let n=await this.emitRscEntries(t.map(({componentId:e,filePath:t})=>({componentId:e,filePath:t})),{minify:this.options.minify,codeSplitting:!1});for(let e of n.extraFiles){let t=this.resolveExtraFileOutPath(e.fileName);await E.promises.mkdir(O.dirname(t),{recursive:!0}),await E.promises.writeFile(t,e.code)}return t.map(e=>{let t=n.outputs.get(e.componentId);if(t==null)throw Error(`Vite RSC environment build missed entry: ${e.componentId}`);return{id:e.componentId,code:t.code,isAction:e.isAction}})}async emitProxyManifest(e){let t=O.join(e,`proxy.json`),n=[...this.serverComponents.entries()].filter(([e])=>pl.test(O.basename(e)));if(n.length===0){try{await E.promises.unlink(t)}catch(e){r(e)!==`ENOENT`&&console.warn(`Failed to remove proxy manifest file:`,e)}return}let[i,a]=n[0],o=w(this.getProjectRelativePath(i)),s=this.getComponentId(o),c=w(O.join(this.options.rscDir,`${s}.js`)),l=qc({proxyFile:o,code:a.originalCode,bundlePath:c});l.requiresRuntime||this.serverComponents.delete(i),await E.promises.writeFile(t,JSON.stringify(l),`utf-8`)}async buildServerComponents(){let e=O.join(this.options.outDir,this.options.rscDir);await E.promises.mkdir(e,{recursive:!0}),await this.emitProxyManifest(e);let t={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()},n=this.options.experimental?.useCache===!0||this.options.experimental?.useCacheRemote!=null,r=[...this.serverComponents.entries(),...this.serverActions.entries()],i=await this.buildRscEntriesWithVite(r);await this.writeViteBuiltRscEntries(t,i),n&&(this.useCacheBuildId=P(JSON.stringify(t.components),16),t.useCacheBuildId=this.useCacheBuildId);let a=O.join(this.options.outDir,this.options.manifestPath);await E.promises.writeFile(a,JSON.stringify(t),`utf-8`),await this.writeRouteCssEntries(t);let o=this.buildServerConfigObject();return await this.persistServerConfig(o),t}buildServerConfigObject(){let e={};this.options.csp&&(e.csp=this.options.csp),this.options.cacheControl&&(e.cacheControl=this.options.cacheControl),this.options.cache&&(e.cache=this.options.cache),this.options.action&&(e.action=this.options.action),this.options.jsPoolSize!=null&&(e.jsPoolSize=this.options.jsPoolSize);let t=this.options.origin?.trim().replace(/\/+$/,``);return t!=null&&t!==``&&(e.origin=t),this.options.htmlLimitedBots!=null&&(e.htmlLimitedBots=this.options.htmlLimitedBots),this.applyUseCacheServerConfig(e),e}applyUseCacheServerConfig(e){(this.options.experimental?.useCacheRemote!=null||this.useCacheBuildId!=null&&this.useCacheBuildId!==``)&&(e.useCache={...this.options.experimental?.useCacheRemote?{remote:this.options.experimental.useCacheRemote}:{},...this.useCacheBuildId!=null&&this.useCacheBuildId!==``?{buildId:this.useCacheBuildId}:{}},!this.options.experimental?.useCache&&this.options.experimental?.useCacheRemote&&console.warn(`[server-build] experimental.useCacheRemote is set without experimental.useCache; the 'use cache' transform will still run because useCacheRemote is configured.`))}async persistServerConfig(e){let t=O.join(this.options.outDir,this.options.serverConfigPath);if(Object.keys(e).length===0){try{await E.promises.unlink(t)}catch(e){r(e)!==`ENOENT`&&console.warn(`Failed to remove server config file:`,e)}return}await E.promises.writeFile(t,JSON.stringify(e),`utf-8`)}async writeViteBuiltRscEntries(e,t){for(let e of t.extraFiles){let t=this.resolveExtraFileOutPath(e.fileName);await E.promises.mkdir(O.dirname(t),{recursive:!0}),await E.promises.writeFile(t,e.code)}for(let[n,r]of t.entries){let t=O.relative(this.projectRoot,n),i=this.getComponentId(n),a=me(this.options.rscDir,i),o=O.join(this.options.outDir,a);await E.promises.mkdir(O.dirname(o),{recursive:!0}),await E.promises.writeFile(o,r.code,`utf-8`);let s=this.serverComponents.get(n)??this.serverActions.get(n),c=this.resolveServerCssSources(n,s?.originalCode??await E.promises.readFile(n,`utf-8`)),l=[...await this.writeComponentCssAsset(i,r.cssAssetSources.length>0?[...r.cssAssetSources]:c)];e.components[i]={id:i,filePath:n,relativePath:t,bundlePath:a,moduleSpecifier:ke(O.resolve(this.projectRoot,o)).href,dependencies:[...s?.dependencies??[]],hasNodeImports:s?.hasNodeImports??!1,isServerAction:this.serverActions.has(n),css:l}}}async buildRscEntriesWithVite(e){let t={entries:/* @__PURE__ */ new Map,extraFiles:[]};if(e.length===0)return t;if(this.viteBuilder==null)throw Error(`Vite builder is required for RSC environment emit`);let n=this.viteBuilder;return this.withEnvEmitLock(async()=>{let t=e.map(([e])=>({componentId:this.getComponentId(e),filePath:e})),r=await pe({viteBuilder:n,entries:t,minify:this.options.minify});if(r==null)throw Error(`Vite RSC environment build failed`);let i=/* @__PURE__ */ new Map;for(let[t]of e){let e=this.getComponentId(t),n=r.outputs.get(e);if(n==null)throw Error(`Vite RSC environment build missed entry: ${e}`);i.set(t,n)}return{entries:i,extraFiles:[...r.extraFiles]}})}async buildMdxRegistry(e){let t=Ds({projectRoot:this.projectRoot,mdxOptions:e,alias:this.options.alias,cache:this.moduleAnalysisCache}),n=O.join(this.options.outDir,this.options.manifestPath),r;if(E.existsSync(n)){let e=await E.promises.readFile(n,`utf-8`),t=f(e);r=t&&Cl(t)?t:{components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()}}else r={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()};r.mdxRegistry=t.map(e=>({name:e.name,id:e.moduleId,client:e.client})),await E.promises.writeFile(n,JSON.stringify(r),`utf-8`)}collectSsrClientFiles(){let e=[...this.getClientComponentFiles()];for(let t of this.discoveredExternalClientComponents)if(!e.some(e=>e.filePath===t))try{let n=E.readFileSync(t,`utf-8`);e.push({filePath:t,code:n})}catch{}try{let t=xl();if(t!=null&&t!==``){let n=E.readFileSync(t,`utf-8`);e.push({filePath:t,code:n})}}catch{}return e}collectExternalSsrSources(){let e=[];for(let{componentId:t,devSourceSegments:n,publishedExport:r,exports:i}of _l){let a=this.resolveExternalClientSourcePath(n,r);if(a!=null&&a!==``)try{let n=E.readFileSync(a,`utf-8`);e.push({componentId:t,filePath:a,code:n,exports:[...i],bundleName:`external_${P(t)}`})}catch{}}return e}async buildSSRClientComponents(){let e=O.join(this.options.outDir,`ssr`);await E.promises.mkdir(e,{recursive:!0});let t=this.collectSsrClientFiles(),n=this.collectExternalSsrSources(),r={},i=await this.buildSsrEntriesWithVite(t,n);for(let t of i.extraFiles){let n=w(t.fileName),r=n===this.options.assetsDir||n.startsWith(`${this.options.assetsDir}/`)?O.join(this.options.clientOutDir,n):O.join(e,n);await E.promises.mkdir(O.dirname(r),{recursive:!0}),await E.promises.writeFile(r,t.code)}for(let[e,a]of i.entries){let i=n.find(t=>t.filePath===e),o=i?.componentId??wl(e,this.projectRoot),s=`ssr/${i?.bundleName??Tl(e,this.projectRoot)}.js`,c=O.join(this.options.outDir,s);await E.promises.mkdir(O.dirname(c),{recursive:!0}),await E.promises.writeFile(c,a.code,`utf-8`);let l=i?.code??t.find(t=>t.filePath===e)?.code??E.readFileSync(e,`utf-8`);r[o]={id:o,filePath:e,bundlePath:s,exports:i?.exports??this.extractExportNames(l)}}await this.writeClientReferenceManifest(e,r)}async buildSsrEntriesWithVite(e,t=[]){let n={entries:/* @__PURE__ */ new Map,extraFiles:[]},r=[...e.map(({filePath:e})=>({entryName:Tl(e,this.projectRoot),filePath:e})),...t.map(e=>({entryName:e.bundleName,filePath:e.filePath}))];if(r.length===0)return n;if(this.viteBuilder==null)throw Error(`Vite builder is required for SSR environment emit`);let i=this.viteBuilder;return this.withEnvEmitLock(async()=>{let e=await he({viteBuilder:i,entries:r,minify:this.options.minify});if(e==null)throw Error(`Vite SSR environment build failed`);let t=/* @__PURE__ */ new Map;for(let n of r){let r=e.outputs.get(n.entryName);if(r==null)throw Error(`Vite SSR environment build missed entry: ${n.entryName}`);t.set(n.filePath,{code:r.code})}return{entries:t,extraFiles:[...e.extraFiles]}})}async writeClientReferenceManifest(e,t){let n=O.join(e,`manifest.json`);await E.promises.writeFile(n,JSON.stringify(t),`utf-8`);let r={};for(let[e,n]of Object.entries(t))for(let t of n.exports){let i=`${e}#${t}`;r[i]={id:i,chunks:`/${n.bundlePath}`,name:t}}let i=O.join(this.options.outDir,`server`);await E.promises.mkdir(i,{recursive:!0});let a=O.join(i,`client-reference-manifest.json`);await E.promises.writeFile(a,JSON.stringify(r),`utf-8`)}resolveExternalClientSourcePath(e,t){let n=O.join(yl,...e);if(E.existsSync(n))return n;try{let e=A(import.meta.resolve(t));if(E.existsSync(e))return e}catch{}return null}extractExportNames(e){return Vn(e)}getProjectRelativePath(e){return Wt(e,this.projectRoot)}getReadableComponentId(e){return Gt(e)}getComponentId(e){return Kt(e,this.projectRoot)}async rebuildComponent(e){gl.test(O.basename(e))&&(this.layoutCssSkipSet=null);let t=this.getComponentId(e),n=await E.promises.readFile(e,`utf-8`),r=this.extractDependencies(n,e),i={filePath:e,originalCode:n,dependencies:r,hasNodeImports:this.hasNodeImports(n,e)};this.isServerAction(n,e)?(this.serverActions.set(e,i),this.serverComponents.delete(e)):(this.serverComponents.set(e,i),this.serverActions.delete(e));let a=O.join(this.options.rscDir,`${t}.js`),o=O.join(this.options.outDir,a),s=this.buildCache.get(e),c=(await E.promises.stat(e)).mtimeMs;if(s&&s.timestamp>=c&&JSON.stringify(s.sourceDependencies)===JSON.stringify(r)){let n=this.serverActions.get(e)??this.serverComponents.get(e);return n&&s.bundledDependencies.length>0&&(n.dependencies=s.bundledDependencies),await E.promises.writeFile(o,s.code,`utf-8`),await this.updateManifestForComponent(t,e,a,s.css),{componentId:t,bundlePath:this.bundlePathForRuntime(o),success:!0}}let l=O.dirname(o);await E.promises.mkdir(l,{recursive:!0});let u=await this.emitRscEntries([{componentId:t,filePath:e}],{minify:this.options.minify}),d=u.outputs.get(t);if(d==null)throw Error(`Vite RSC environment build missed entry: ${t}`);await E.promises.writeFile(o,d.code,`utf-8`);let f=this.resolveServerCssSources(e,n),p=[...await this.writeComponentCssAsset(t,d.cssAssetSources.length>0?[...d.cssAssetSources]:f)];for(let e of u.extraFiles){let t=this.resolveExtraFileOutPath(e.fileName);await E.promises.mkdir(O.dirname(t),{recursive:!0}),await E.promises.writeFile(t,e.code)}let m=this.serverActions.get(e)??this.serverComponents.get(e);return this.buildCache.set(e,{code:d.code,css:p,timestamp:Date.now(),sourceDependencies:r,bundledDependencies:m?.dependencies??r}),await this.updateManifestForComponent(t,e,a,p),{componentId:t,bundlePath:this.bundlePathForRuntime(o),success:!0}}bundlePathForRuntime(e){return w(O.relative(this.projectRoot,e))}manifestCache=null;async updateManifestForComponent(e,t,n,r=[]){let i=O.join(this.options.outDir,this.options.manifestPath),a;if(this.manifestCache)a=this.manifestCache;else if(E.existsSync(i)){let e=await E.promises.readFile(i,`utf-8`),t=f(e);t&&Cl(t)?(a=t,this.manifestCache=a):(a={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()},this.manifestCache=a)}else a={components:{},buildTime:(/* @__PURE__ */ new Date()).toISOString()},this.manifestCache=a;let o=this.serverComponents.get(t)??this.serverActions.get(t),s=O.join(this.options.outDir,n),c=ke(O.resolve(this.projectRoot,s)).href;if(o)a.components[e]={id:e,filePath:t,relativePath:O.relative(this.projectRoot,t),bundlePath:n,moduleSpecifier:c,dependencies:[...o.dependencies],hasNodeImports:o.hasNodeImports,isServerAction:this.serverActions.has(t),css:r};else{let i=await E.promises.readFile(t,`utf-8`);a.components[e]={id:e,filePath:t,relativePath:O.relative(this.projectRoot,t),bundlePath:n,moduleSpecifier:c,dependencies:this.extractDependencies(i,t),hasNodeImports:this.hasNodeImports(i,t),isServerAction:this.isServerAction(i,t),css:r}}a.buildTime=(/* @__PURE__ */ new Date()).toISOString(),await E.promises.writeFile(i,JSON.stringify(a),`utf-8`),await this.writeRouteCssEntries(a),this.manifestCache=a}clearCache(){this.buildCache.clear(),this.manifestCache=null}invalidateBuildCacheFor(e){this.buildCache.delete(e)}};function Ol(e,t){let n=[];for(let r of Cr(t))try{let t=H(r),i=E.readFileSync(r,`utf-8`),a=e.getModuleAnalysis(r,i);n.push({filePath:r,cacheKey:t,code:i,analysis:a})}catch(e){console.warn(`[server-build] Error reading ${r}:`,c(e,String(e)))}return n}function kl(e,t){return(t??z(e)).hasComponentExport||v.test(e)||te.test(e)||re.test(e)}function Al(e,t,n,r){let i=O.basename(e);if(ml.test(i)||hl.test(i)||i.endsWith(`.d.ts`))return!1;let a=r??n.getModuleAnalysis(e,t);return a.directives.hasUseClient?!1:a.directives.hasUseServer?!0:!n.isOnlyImportedByClientComponents(e)&&El(e,a)&&kl(t,a)}function jl(e,t,n=[]){let r=Ol(t,wr(e,n));t.clearClientComponentFiles(),t.populateImportGraphFromFiles(r);let i=[],a=[];for(let{filePath:e,code:n,analysis:o}of r)o.directives.hasUseClient&&(a.push(e),t.recordClientComponent(e,n)),Al(e,n,t,o)&&(t.addServerComponent(e,n,o),i.push(e));return{serverComponentPaths:i,clientComponentPaths:a}}function Ml(e={}){let t=null,n,r,i,a={},o=!1;async function s(){if(t){try{await t.buildMdxRegistry(e.mdx)}catch(e){console.warn(`[rari] Failed to build MDX component registry:`,e)}try{let{generateRobotsFile:e}=await import(`./robots-BOPIkPcN.mjs`);await e({appDir:O.join(n,`src`,`app`),outDir:r,aliases:a})}catch(e){console.warn(`[rari] Failed to generate robots.txt:`,e)}try{let{generateSitemapFiles:e}=await import(`./sitemap--bdIkWl5.mjs`);await e({appDir:O.join(n,`src`,`app`),outDir:r,aliases:a})}catch(e){console.warn(`[rari] Failed to generate sitemap:`,e)}try{let{generateFeedFile:e}=await import(`./feed-NrJzjZyg.mjs`);await e({appDir:O.join(n,`src`,`app`),outDir:r,aliases:a})}catch(e){console.warn(`[rari] Failed to generate feed:`,e)}try{let e=O.join(i,`server`,`routes.json`);if(E.existsSync(e)){let t=at(E.readFileSync(e,`utf-8`));t.length>0&&await rt({appDir:O.join(n,`src`,`app`),outDir:r,icons:t})}}catch(e){console.warn(`[rari] Failed to copy app icons:`,e)}try{let t=ks(n,e.mdx),a=[`public/content`,w(O.relative(n,O.join(i,`content`))),w(O.relative(n,O.join(r,`content`)))].filter(e=>e!==``&&!e.startsWith(`..`)&&!O.isAbsolute(e)),o=As(n,t.contentDirs).filter(e=>{let t=w(O.relative(n,e));return!a.some(e=>t===e||t.startsWith(`${e}/`))});o.length>0&&Ms(o,O.join(i,`content`))}catch(e){console.warn(`[rari] Failed to copy MDX content:`,e)}hs(r)}}return{name:`rari-server-build`,sharedDuringBuild:!0,configResolved(s){n=s.root,r=be(s.root,s.build.outDir),i=ye(r),o=!1;let c=Ht(s);a=c;let l=typeof s.build.assetsDir==`string`&&s.build.assetsDir!==``?C(s.build.assetsDir):`assets`;t=new Dl(n,{...e,alias:c,assetsDir:l,outDir:i,clientOutDir:r,minify:e.minify??s.mode===`production`})},buildStart(){if(!t)return;let e=O.join(n,`src`);E.existsSync(e)&&jl(e,t,Object.values(a))},async buildApp(e){if(!t||o)return;let n=e.environments.client;n.isBuilt||await e.build(n);let r=e.environments.rsc,i=e.environments.ssr;await r.init(),await i.init(),t.setViteBuilder(e),await t.buildServerComponents(),await t.buildSSRClientComponents(),o=!0,await s()}}}function Nl(e,t,n){if(n.length===0)return e;let r=Fn(e).find(e=>e.source===t&&!e.typeOnly&&!e.sideEffectOnly),i=/* @__PURE__ */ new Map;if(r!=null)for(let e of r.named)e.typeOnly||i.set(e.imported,e.local);for(let e of n)i.has(e)||i.set(e,e);let a=[...i.entries()].map(([e,t])=>e===t?e:`${e} as ${t}`);if(r?.namespaceBinding!=null||r?.named.some(e=>e.typeOnly)){let i=n.filter(e=>!r.named.some(t=>!t.typeOnly&&t.imported===e));return i.length===0?e:`${`import { ${[...new Set(i)].join(`, `)} } from ${JSON.stringify(t)};`}\n${e}`}let o=`import ${r?.defaultBinding==null?``:`${r.defaultBinding}, `}{ ${a.join(`, `)} } from ${JSON.stringify(t)};`;return r==null?`${o}\n\n${e}`:e.slice(0,r.start)+o+e.slice(r.end)}function Pl(e,t){return`const ${e} = createClientModuleProxy(${JSON.stringify(t)});`}function Fl(e,t,n){return`const ${e} = registerClientReference(
|
|
92
82
|
function() {
|
|
93
83
|
throw new Error("Attempted to call ${e} from the server but it's on the client. It can only be rendered as a Component or passed to props of a Client Component.");
|
|
94
84
|
},
|
|
95
85
|
${JSON.stringify(t)},
|
|
96
86
|
${JSON.stringify(n)}
|
|
97
|
-
);`}function
|
|
98
|
-
`),helpers:[...r]}}const ws=/(?:^|[\n\r;])\s*import\s*\{[^}]*\bregisterServerReference\b[^}]*\}\s*from\s*["'][^"'\n]+["']/;function Ts(e){return ws.test(e)}const Es=/* @__PURE__ */ new Set(/* @__PURE__ */ `undefined.NaN.Infinity.arguments.Object.Array.String.Number.Boolean.Symbol.BigInt.Math.Date.JSON.Promise.Error.TypeError.RangeError.Map.Set.WeakMap.WeakSet.RegExp.Proxy.Reflect.Function.console.fetch.process.Buffer.globalThis.global.window.document.navigator.location.crypto.TextEncoder.TextDecoder.URL.URLSearchParams.FormData.Headers.Request.Response.AbortController.AbortSignal.setTimeout.clearTimeout.setInterval.clearInterval.queueMicrotask.structuredClone.atob.btoa.React.jsx.jsxs.Fragment`.split(`.`)),Ds=/* @__PURE__ */ new Set(/* @__PURE__ */ `await.return.throw.if.else.for.while.do.switch.case.break.continue.new.typeof.instanceof.void.delete.yield.class.extends.super.this.try.catch.finally.with.debugger.default.of.in.from.as.import.export.async.function.const.let.var.true.false.null.static.get.set.typeof`.split(`.`));function Os(e){return e>=97&&e<=122||e>=65&&e<=90||e===95||e===36}function ks(e){return Os(e)||e>=48&&e<=57}function O(e,t){let n=e.length;for(;t<n;){let r=e.charCodeAt(t);if(r===32||r===9||r===10||r===13||r===65279){t++;continue}if(r===47&&e.charCodeAt(t+1)===47){for(t+=2;t<n&&e.charCodeAt(t)!==10&&e.charCodeAt(t)!==13;)t++;continue}if(r===47&&e.charCodeAt(t+1)===42){for(t+=2;t<n-1&&(e.charCodeAt(t)!==42||e.charCodeAt(t+1)!==47);)t++;t+=2;continue}break}return t}function As(e,t,n){t++;let r=e.length;for(;t<r;){let r=e.charCodeAt(t);if(r===92){t+=2;continue}if(r===n)return t+1;t++}return t}function js(e,t,n,r){let i=t,a=0,o=e.length;for(;i<o;){let t=Mn(e,i,o);if(t!==-1){i=t;continue}let s=e.charCodeAt(i);if(s===n)a++;else if(s===r&&(a--,a===0))return i+1;i++}return i}function Ms(e,t,n){for(let r=0;r<n.length;r++)if(e.charCodeAt(t+r)!==n.charCodeAt(r))return!1;return!0}function Ns(e,t,n){let r=O(e,t+1);if(r>=n)return!1;let i=e.charCodeAt(r);if(i!==39&&i!==34)return!1;let a=r+1,o=As(e,r,i);if(o-1-a!=10||!Ms(e,a,`use server`))return!1;for(r=o;r<n;){let t=e.charCodeAt(r);if(t===32||t===9){r++;continue}return t===59||t===10||t===13||t===47&&e.charCodeAt(r+1)===47||t===47&&e.charCodeAt(r+1)===42}return!0}function Ps(e,t,n){let r=O(e,t+1),i=e.charCodeAt(r);return i!==39&&i!==34?e.slice(t+1,n):(r=O(e,As(e,r,i)),e.charCodeAt(r)===59&&r++,r=O(e,r),e.slice(r,n))}function Fs(e,t){if(!Os(e.charCodeAt(t)))return null;let n=t+1;for(;n<e.length&&ks(e.charCodeAt(n));)n++;return{name:e.slice(t,n),end:n}}function Is(e,t,n){if(!Ms(e,t,n))return!1;let r=t>0?e.charCodeAt(t-1):-1,i=t+n.length<e.length?e.charCodeAt(t+n.length):-1;return!(r!==-1&&ks(r)||i!==-1&&ks(i))}function Ls(e){let t=/* @__PURE__ */ new Set,n=0,r=e.length;for(;n<r&&(n=O(e,n),!(n>=r));){let r=e.charCodeAt(n);if(r===123||r===91){let i=js(e,n,r,r===123?125:93);for(let r of e.slice(n,i).matchAll(/[a-z_$][\w$]*/gi))r[0]!==`as`&&t.add(r[0]);n=i;continue}if(r===46&&e.charCodeAt(n+1)===46&&e.charCodeAt(n+2)===46){n+=3,n=O(e,n);let r=Fs(e,n);r&&(t.add(r.name),n=r.end);continue}let i=Fs(e,n);if(i){t.add(i.name),n=i.end;continue}n++}return t}function Rs(e){let t=/* @__PURE__ */ new Set;for(let n of e.matchAll(/\b(?:const|let|var|function|class|async\s+function)\s+([A-Za-z_$][\w$]*)/g))t.add(n[1]);return t}function zs(e){let t=/* @__PURE__ */ new Set;for(let n of e.matchAll(/\b(?:import|export)\s+(?:type\s+)?(?:\{([^}]+)\}|(\*\s+as\s+[A-Za-z_$][\w$]*)|([A-Za-z_$][\w$]*))/g)){if(n[1])for(let e of n[1].split(`,`)){let n=e.trim();if(!n||n.startsWith(`type `))continue;let r=(n.split(/\s+as\s+/).at(-1)??``).trim();r&&t.add(r)}if(n[2]){let e=/as\s+([A-Za-z_$][\w$]*)/.exec(n[2]);e&&t.add(e[1])}n[3]&&n[3]!==`type`&&n[3]!==`async`&&n[3]!==`function`&&n[3]!==`class`&&t.add(n[3])}for(let n of e.matchAll(/(?:^|\n)\s*(?:export\s+)?(?:async\s+)?(?:function|class|const|let|var)\s+([A-Za-z_$][\w$]*)/g))t.add(n[1]);return t}function Bs(e,t,n){let r=/* @__PURE__ */ new Set([...Ls(t),...Rs(e),...n,...Es,...Ds]),i=/* @__PURE__ */ new Set,a=0,o=e.length;for(;a<o;){let t=Mn(e,a,o);if(t!==-1){a=t;continue}if(!Os(e.charCodeAt(a))){a++;continue}let n=Fs(e,a);if(n==null){a++;continue}if(a>0&&e.charCodeAt(a-1)===46){a=n.end;continue}if(Us(e,a,n.end)){a=n.end;continue}r.has(n.name)||i.add(n.name),a=n.end}return[...i]}function Vs(e,t){for(;t>0;){let n=e.charCodeAt(t-1);if(n===32||n===9||n===10||n===13||n===65279)t--;else break}return t}function Hs(e,t,n){let r=t-n.length;return r<0||!Is(e,r,n)?null:r}function Us(e,t,n){let r=O(e,n);if(e.charCodeAt(r)!==58)return!1;let i=Vs(e,t);if(i===0)return!1;let a=e.charCodeAt(i-1);return a===123||a===44}function Ws(e,t){let n=Vs(e,t),r=Hs(e,n,`default`);if(r!=null){n=Vs(e,r);let t=Hs(e,n,`export`);if(t!=null)return{start:t,exportKind:`default`,bindingName:null}}if(n>0&&e.charCodeAt(n-1)===61){let r=Vs(e,n-1),i=r;for(;i>0&&ks(e.charCodeAt(i-1));)i--;if(i<r&&Os(e.charCodeAt(i))){let n=e.slice(i,r),a=Vs(e,i),o=Hs(e,a,`const`)??Hs(e,a,`let`)??Hs(e,a,`var`);if(o!=null)return Hs(e,Vs(e,o),`export`)==null?{start:t,exportKind:null,bindingName:n}:{start:t,exportKind:`named`,bindingName:n}}}let i=Hs(e,n,`export`);return i==null?{start:t,exportKind:null,bindingName:null}:{start:i,exportKind:`named`,bindingName:null}}function Gs(e){let t=[],n=e.length,r=0;for(;r<n;){let n=e.charCodeAt(r);if(n===39||n===34||n===96){r=As(e,r,n);continue}if(n===47&&(e.charCodeAt(r+1)===47||e.charCodeAt(r+1)===42)){r=O(e,r);continue}if(Is(e,r,`async`)||Is(e,r,`function`)){let n=r,i=r,a=!1;if(Is(e,i,`async`)&&(a=!0,i=O(e,i+5)),Is(e,i,`function`)){i=O(e,i+8),e.charCodeAt(i)===42&&(i=O(e,i+1));let o=null,s=Fs(e,i);if(s&&(o=s.name,i=O(e,s.end)),e.charCodeAt(i)!==40){r++;continue}let c=js(e,i,40,41),l=e.slice(i+1,c-1);if(i=O(e,c),e.charCodeAt(i)!==123){r++;continue}let u=js(e,i,123,125)-1;Ns(e,i,u)?(t.push({start:n,end:u+1,bodyOpen:i,bodyClose:u,paramsRaw:l,isAsync:a,name:o,kind:o==null?`expression`:`declaration`}),r=u+1):r=i+1;continue}if(a&&e.charCodeAt(i)===40){let a=js(e,i,40,41),o=e.slice(i+1,a-1),s=O(e,a);if(e.charCodeAt(s)===61&&e.charCodeAt(s+1)===62&&(s=O(e,s+2),e.charCodeAt(s)===123)){let i=js(e,s,123,125)-1;Ns(e,s,i)?(t.push({start:n,end:i+1,bodyOpen:s,bodyClose:i,paramsRaw:o,isAsync:!0,name:null,kind:`arrow`}),r=i+1):r=s+1;continue}}}if(e.charCodeAt(r)===40){let n=js(e,r,40,41),i=O(e,n);if(e.charCodeAt(i)===61&&e.charCodeAt(i+1)===62&&(i=O(e,i+2),e.charCodeAt(i)===123)){let a=js(e,i,123,125)-1;Ns(e,i,a)?(t.push({start:r,end:a+1,bodyOpen:i,bodyClose:a,paramsRaw:e.slice(r+1,n-1),isAsync:!1,name:null,kind:`arrow`}),r=a+1):r=i+1;continue}}r++}return t}function Ks(e,t){let n=Gs(e);if(n.length===0)return null;let r=zs(e),i=[],a=[],o=e,s=[],c=!1,l=[...n].sort((e,t)=>t.start-e.start),u=n.length-1;for(let e of l){let n=e.name??`anonymous_server_function`,l=`$$ACTION_${u}_${n.replace(/\W/g,`_`)}`;u--,i.unshift(l);let d=Ps(o,e.bodyOpen,e.bodyClose),f=Bs(d,e.paramsRaw,r),p=[...f,e.paramsRaw.trim()].filter(e=>e!==``).join(`, `),m=e.isAsync?`async `:``,h=f.length>0?`${l}.bind(null, ${f.join(`, `)})`:l,{start:g,exportKind:_,bindingName:ee}=Ws(o,e.start),te=h,v=null;_==="default"?(v=`default`,te=`export default registerServerReference(${h}, ${JSON.stringify(t)}, "default")`):_===`named`&&e.name!=null?(v=e.name,te=`export const ${e.name} = registerServerReference(${h}, ${JSON.stringify(t)}, ${JSON.stringify(e.name)})`):_===`named`&&ee!=null?(v=ee,te=`registerServerReference(${h}, ${JSON.stringify(t)}, ${JSON.stringify(ee)})`):e.kind===`declaration`&&e.name!=null&&(te=`const ${e.name} = ${h}`),v==null?s.unshift(`${m}function ${l}(${p}) {\n${d}\n}`,`registerServerReference(${l}, ${JSON.stringify(t)}, ${JSON.stringify(l)});`):(s.unshift(`${m}function ${l}(${p}) {\n${d}\n}`),a.unshift(v)),c=!0,o=o.slice(0,g)+te+o.slice(e.end)}let d=c?`import { registerServerReference } from ${JSON.stringify(`react-server-dom-rari/server`)};\n`:``;return{code:`${c&&!Ts(o)?d:``}${o}\n\n${s.join(`
|
|
99
|
-
`)}\n`,actionNames:i,rewrittenExportNames:a}}const
|
|
100
|
-
`)},\n])`;return t.replace(
|
|
101
|
-
|
|
102
|
-
`);this.error(e===``?`React Compiler transform failed.`:e)}for(let e of p)this.warn(e);return{code:f.code,map:f.map}}}}var dc=Object.create,fc=Object.defineProperty,pc=Object.getOwnPropertyDescriptor,mc=Object.getOwnPropertyNames,hc=Object.getPrototypeOf,gc=Object.prototype.hasOwnProperty,_c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),vc=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=mc(t),a=0,o=i.length,s;a<o;a++)s=i[a],!gc.call(e,s)&&s!==n&&fc(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=pc(t,s))||r.enumerable});return e},yc=(e,t,n)=>(n=e==null?{}:dc(hc(e)),vc(t||!e||!e.__esModule||!gc.call(e,`default`)?fc(n,`default`,{value:e,enumerable:!0}):n,e)),k=/* @__PURE__ */ Ee(import.meta.url),bc=/* @__PURE__ */ _c(((e,t)=>{let n=k(`node:fs`),r=k(`node:child_process`),i=JSON.parse(n.readFileSync(k.resolve(`rolldown/package.json`),`utf-8`)).version,a=`/tmp/rolldown-${i}`,o=`${a}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;if(!n.existsSync(o)){let e=`@rolldown/binding-wasm32-wasi@${i}`;n.rmSync(a,{recursive:!0,force:!0}),n.mkdirSync(a,{recursive:!0}),console.log(`[rolldown] Downloading ${e} on WebContainer...`),r.execFileSync(`pnpm`,[`i`,e],{cwd:a,stdio:`inherit`})}t.exports=k(o)})),xc=/* @__PURE__ */ _c(((e,t)=>{let{readFileSync:n}=k(`fs`),r=null,i=`native`,a=[],o=()=>{let e=!1;return process.platform===`linux`&&(e=c(),e===null&&(e=l()),e===null&&(e=u())),e},s=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),c=()=>{try{return n(`/usr/bin/ldd`,`utf-8`).includes(`musl`)}catch{return null}},l=()=>{let e=null;return process.report&&typeof process.report.getReport==`function`&&(process.report.excludeNetwork=!0,e=process.report.getReport()),e?e.header&&e.header.glibcVersionRuntime?!1:!!(Array.isArray(e.sharedObjects)&&e.sharedObjects.some(s)):null},u=()=>{try{return k(`child_process`).execSync(`ldd --version`,{encoding:`utf8`}).includes(`musl`)}catch{return!1}};function d(){if(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)try{let e=k(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);return i=e&&typeof e.__napiBindingTarget==`string`?e.__napiBindingTarget:`native`,e}catch(e){a.push(e)}else if(process.platform===`android`){if(process.arch===`arm64`){try{return k(`./rolldown-binding.android-arm64.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-android-arm64`),t=k(`@rolldown/binding-android-arm64/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else if(process.arch===`arm`){try{return k(`./rolldown-binding.android-arm-eabi.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-android-arm-eabi`),t=k(`@rolldown/binding-android-arm-eabi/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else a.push(/* @__PURE__ */ Error(`Unsupported architecture on Android ${process.arch}`))}else if(process.platform===`win32`){if(process.arch===`x64`){if(process.config&&process.config.variables&&process.config.variables.shlib_suffix===`dll.a`||process.config&&process.config.variables&&process.config.variables.node_target_type===`shared_library`){try{return k(`./rolldown-binding.win32-x64-gnu.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-win32-x64-gnu`),t=k(`@rolldown/binding-win32-x64-gnu/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else{try{return k(`./rolldown-binding.win32-x64-msvc.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-win32-x64-msvc`),t=k(`@voidzero-dev/vite-plus-win32-x64-msvc/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}}else if(process.arch===`ia32`){try{return k(`./rolldown-binding.win32-ia32-msvc.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-win32-ia32-msvc`),t=k(`@rolldown/binding-win32-ia32-msvc/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else if(process.arch===`arm64`){try{return k(`./rolldown-binding.win32-arm64-msvc.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-win32-arm64-msvc`),t=k(`@voidzero-dev/vite-plus-win32-arm64-msvc/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else a.push(/* @__PURE__ */ Error(`Unsupported architecture on Windows: ${process.arch}`))}else if(process.platform===`darwin`){try{return k(`./rolldown-binding.darwin-universal.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-darwin-universal`),t=k(`@rolldown/binding-darwin-universal/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}if(process.arch===`x64`){try{return k(`./rolldown-binding.darwin-x64.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-darwin-x64`),t=k(`@voidzero-dev/vite-plus-darwin-x64/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else if(process.arch===`arm64`){try{return k(`./rolldown-binding.darwin-arm64.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-darwin-arm64`),t=k(`@voidzero-dev/vite-plus-darwin-arm64/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else a.push(/* @__PURE__ */ Error(`Unsupported architecture on macOS: ${process.arch}`))}else if(process.platform===`freebsd`){if(process.arch===`x64`){try{return k(`./rolldown-binding.freebsd-x64.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-freebsd-x64`),t=k(`@rolldown/binding-freebsd-x64/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else if(process.arch===`arm64`){try{return k(`./rolldown-binding.freebsd-arm64.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-freebsd-arm64`),t=k(`@rolldown/binding-freebsd-arm64/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else a.push(/* @__PURE__ */ Error(`Unsupported architecture on FreeBSD: ${process.arch}`))}else if(process.platform===`linux`){if(process.arch===`x64`){if(o()){try{return k(`./rolldown-binding.linux-x64-musl.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-linux-x64-musl`),t=k(`@voidzero-dev/vite-plus-linux-x64-musl/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else{try{return k(`../rolldown-binding.linux-x64-gnu.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-linux-x64-gnu`),t=k(`@voidzero-dev/vite-plus-linux-x64-gnu/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}}else if(process.arch===`arm64`){if(o()){try{return k(`./rolldown-binding.linux-arm64-musl.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-linux-arm64-musl`),t=k(`@voidzero-dev/vite-plus-linux-arm64-musl/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else{try{return k(`./rolldown-binding.linux-arm64-gnu.node`)}catch(e){a.push(e)}try{let e=k(`@voidzero-dev/vite-plus-linux-arm64-gnu`),t=k(`@voidzero-dev/vite-plus-linux-arm64-gnu/package.json`).version;if(t!==`0.3.3`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.3.3 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}}else if(process.arch===`arm`){if(o()){try{return k(`./rolldown-binding.linux-arm-musleabihf.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-arm-musleabihf`),t=k(`@rolldown/binding-linux-arm-musleabihf/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else{try{return k(`./rolldown-binding.linux-arm-gnueabihf.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-arm-gnueabihf`),t=k(`@rolldown/binding-linux-arm-gnueabihf/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}}else if(process.arch===`loong64`){if(o()){try{return k(`./rolldown-binding.linux-loong64-musl.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-loong64-musl`),t=k(`@rolldown/binding-linux-loong64-musl/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else{try{return k(`./rolldown-binding.linux-loong64-gnu.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-loong64-gnu`),t=k(`@rolldown/binding-linux-loong64-gnu/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}}else if(process.arch===`riscv64`){if(o()){try{return k(`./rolldown-binding.linux-riscv64-musl.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-riscv64-musl`),t=k(`@rolldown/binding-linux-riscv64-musl/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else{try{return k(`./rolldown-binding.linux-riscv64-gnu.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-riscv64-gnu`),t=k(`@rolldown/binding-linux-riscv64-gnu/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}}else if(process.arch===`ppc64`){try{return k(`./rolldown-binding.linux-ppc64-gnu.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-ppc64-gnu`),t=k(`@rolldown/binding-linux-ppc64-gnu/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else if(process.arch===`s390x`){try{return k(`./rolldown-binding.linux-s390x-gnu.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-linux-s390x-gnu`),t=k(`@rolldown/binding-linux-s390x-gnu/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else a.push(/* @__PURE__ */ Error(`Unsupported architecture on Linux: ${process.arch}`))}else if(process.platform===`openharmony`){if(process.arch===`arm64`){try{return k(`./rolldown-binding.openharmony-arm64.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-openharmony-arm64`),t=k(`@rolldown/binding-openharmony-arm64/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else if(process.arch===`x64`){try{return k(`./rolldown-binding.openharmony-x64.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-openharmony-x64`),t=k(`@rolldown/binding-openharmony-x64/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else if(process.arch===`arm`){try{return k(`./rolldown-binding.openharmony-arm.node`)}catch(e){a.push(e)}try{let e=k(`@rolldown/binding-openharmony-arm`),t=k(`@rolldown/binding-openharmony-arm/package.json`).version;if(t!==`1.2.9`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.2.9 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){a.push(e)}}else a.push(/* @__PURE__ */ Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))}else a.push(/* @__PURE__ */ Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))}function f(e){return e.reduce((e,t)=>{let n;try{n=t&&typeof t.message==`string`?t.message:String(t)}catch{n=`Unknown error`}let r=Error(n);return r.cause=e,r},null)}let p=[`wasm32-wasi`],m=process.env.NAPI_RS_WASI_FLAVOR,h=typeof m==`string`&&m.length>0;if(h&&p.indexOf(m)===-1)throw Error(`Unsupported WASI flavor "`+m+`". Available flavors: `+p.join(`, `));let g=process.env.NAPI_RS_FORCE_WASI===`error`,_=process.env.NAPI_RS_FORCE_WASI===`true`||g||h;if(_||(r=d()),!r||_){let e=null,t=!1,n=[],o=(e,t,n)=>{try{k.resolve(e)}catch(n){if(!n||n.code!==`MODULE_NOT_FOUND`)throw n;if(t){try{k.resolve(e+`/package.json`)}catch(e){if(e&&e.code===`MODULE_NOT_FOUND`)return n;throw n}throw n}return n}if(n){let e=null;for(let t=0;t<n.length;t++)try{return k.resolve(n[t]),null}catch(t){if(!t||t.code!==`MODULE_NOT_FOUND`)throw t;e=t}return e}return null};if(!t&&(!h||m===`wasm32-wasi`)){let s=null,c=!1;try{s=o(`./rolldown-binding.wasi.cjs`,!1,[`./rolldown-binding.wasm32-wasi.debug.wasm`,`./rolldown-binding.wasm32-wasi.wasm`]),c=s!==null,c||(e=k(`../rolldown-binding.wasi.cjs`),r=e,i=`wasm32-wasi`,t=!0)}catch(e){s=e,c=!0}c&&(n.push(s),a.push(s))}if(!t&&(!h||m===`wasm32-wasi`)){let s=null,c=!1;try{if(s=o(`@rolldown/binding-wasm32-wasi`,!0,void 0),c=s!==null,!c){if(process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`){let e=k(`@rolldown/binding-wasm32-wasi/package.json`).version;if(e!==`1.2.9`)throw Error(`WASI binding package version mismatch, expected 1.2.9 but got ${e}. You can reinstall dependencies to fix this issue.`)}e=k(`@rolldown/binding-wasm32-wasi`),r=e,i=`wasm32-wasi`,t=!0}}catch(e){s=e,c=!0}c&&(n.push(s),a.push(s))}if(!t&&_&&!g&&!h&&(r=d()),(g||h)&&!t){let e=/* @__PURE__ */ Error(h?`WASI binding for flavor "`+m+`" not found`:`WASI binding not found and NAPI_RS_FORCE_WASI is set to error`);throw e.cause=f(n),e}}if(!r&&globalThis.process?.versions?.webcontainer)try{r=bc()}catch(e){a.push(e)}if(!r){if(a.length>0){let e=/* @__PURE__ */ Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");throw e.cause=f(a),e}throw Error(`Failed to load native binding`)}function ee(e,t){if(Object.prototype.hasOwnProperty.call(e,`__napiBindingTarget`)){if(e.__napiBindingTarget===t)return t;let n=/* @__PURE__ */ Error('`__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].');throw n.code=`ERR_NAPI_BINDING_TARGET_CONFLICT`,n}if(!Object.isExtensible(e))return t;try{Object.defineProperty(e,"__napiBindingTarget",{configurable:!0,enumerable:!0,value:t,writable:!0})}catch{}return t}t.exports.__napiBindingTarget=ee(r,i),t.exports=r,t.exports.LegalCommentsMode=r.LegalCommentsMode,t.exports.minify=r.minify,t.exports.minifySync=r.minifySync,t.exports.Severity=r.Severity,t.exports.ParseResult=r.ParseResult,t.exports.ExportExportNameKind=r.ExportExportNameKind,t.exports.ExportImportNameKind=r.ExportImportNameKind,t.exports.ExportLocalNameKind=r.ExportLocalNameKind,t.exports.ImportNameKind=r.ImportNameKind,t.exports.parse=r.parse,t.exports.parseSync=r.parseSync,t.exports.rawTransferSupported=r.rawTransferSupported,t.exports.ResolverFactory=r.ResolverFactory,t.exports.EnforceExtension=r.EnforceExtension,t.exports.ModuleType=r.ModuleType,t.exports.sync=r.sync,t.exports.HelperMode=r.HelperMode,t.exports.isolatedDeclaration=r.isolatedDeclaration,t.exports.isolatedDeclarationSync=r.isolatedDeclarationSync,t.exports.moduleRunnerTransform=r.moduleRunnerTransform,t.exports.moduleRunnerTransformSync=r.moduleRunnerTransformSync,t.exports.transform=r.transform,t.exports.transformSync=r.transformSync,t.exports.BindingBundleEndEventData=r.BindingBundleEndEventData,t.exports.BindingBundleErrorEventData=r.BindingBundleErrorEventData,t.exports.BindingBundler=r.BindingBundler,t.exports.BindingCallableBuiltinPlugin=r.BindingCallableBuiltinPlugin,t.exports.BindingChunkingContext=r.BindingChunkingContext,t.exports.BindingDecodedMap=r.BindingDecodedMap,t.exports.BindingDevEngine=r.BindingDevEngine,t.exports.BindingLoadPluginContext=r.BindingLoadPluginContext,t.exports.BindingMagicString=r.BindingMagicString,t.exports.BindingModuleInfo=r.BindingModuleInfo,t.exports.BindingNormalizedOptions=r.BindingNormalizedOptions,t.exports.BindingOutputAsset=r.BindingOutputAsset,t.exports.BindingOutputChunk=r.BindingOutputChunk,t.exports.BindingPluginContext=r.BindingPluginContext,t.exports.BindingRenderedChunk=r.BindingRenderedChunk,t.exports.BindingRenderedChunkMeta=r.BindingRenderedChunkMeta,t.exports.BindingRenderedModule=r.BindingRenderedModule,t.exports.BindingSourceMap=r.BindingSourceMap,t.exports.BindingTransformPluginContext=r.BindingTransformPluginContext,t.exports.BindingWatcher=r.BindingWatcher,t.exports.BindingWatcherBundler=r.BindingWatcherBundler,t.exports.BindingWatcherChangeData=r.BindingWatcherChangeData,t.exports.BindingWatcherEvent=r.BindingWatcherEvent,t.exports.ParallelJsPluginRegistry=r.ParallelJsPluginRegistry,t.exports.TraceSubscriberGuard=r.TraceSubscriberGuard,t.exports.TsconfigCache=r.TsconfigCache,t.exports.__internalForcePanic=r.__internalForcePanic,t.exports.BindingAttachDebugInfo=r.BindingAttachDebugInfo,t.exports.BindingBuiltinPluginName=r.BindingBuiltinPluginName,t.exports.BindingChunkModuleOrderBy=r.BindingChunkModuleOrderBy,t.exports.BindingErrorStage=r.BindingErrorStage,t.exports.BindingLogLevel=r.BindingLogLevel,t.exports.BindingPluginOrder=r.BindingPluginOrder,t.exports.BindingPropertyReadSideEffects=r.BindingPropertyReadSideEffects,t.exports.BindingPropertyWriteSideEffects=r.BindingPropertyWriteSideEffects,t.exports.BindingRebuildStrategy=r.BindingRebuildStrategy,t.exports.collapseSourcemaps=r.collapseSourcemaps,t.exports.enhancedTransform=r.enhancedTransform,t.exports.enhancedTransformSync=r.enhancedTransformSync,t.exports.FilterTokenKind=r.FilterTokenKind,t.exports.getNativeMemoryStats=r.getNativeMemoryStats,t.exports.initTraceSubscriber=r.initTraceSubscriber,t.exports.registerPlugins=r.registerPlugins,t.exports.resetNativeMemoryStats=r.resetNativeMemoryStats,t.exports.resolveTsconfig=r.resolveTsconfig,t.exports.shutdownAsyncRuntime=r.shutdownAsyncRuntime,t.exports.startAsyncRuntime=r.startAsyncRuntime}));function Sc(e,t,{hook:n,id:r}={}){try{let i=e.code;!e.pluginCode&&i!=null&&(typeof i!=`string`||!i.startsWith(`PLUGIN_`))&&(e.pluginCode=i),e.code=`PLUGIN_ERROR`,e.plugin=t,n&&(e.hook=n),r&&(e.id=r)}catch{}finally{return e}}function Cc(e){throw e instanceof Error||(e=Object.assign(Error(e.message),e),Object.defineProperty(e,"name",{value:`RolldownError`,writable:!0})),e}var wc=/* @__PURE__ */ yc(xc(),1),Tc=class{name;_options;enforce;constructor(e,t){this.name=e,this._options=t}};function Ec(e){let t=new wc.BindingCallableBuiltinPlugin(Dc(e)),n=e;for(let r in t){let i=async function(...i){try{return await t[r](...i)}catch(t){return t instanceof Error&&!t.stack?.includes(`at `)&&Error.captureStackTrace(t,n[r]),Cc(Sc(t,e.name,{hook:r,id:r===`transform`?i[2]:void 0}))}},a=t.getOrder(r);n[r]=a==null?i:{handler:i,order:a}}return n}function Dc(e){return{__name:e.name,options:e._options}}function Oc(e){if(e)return kc(e)?e:[e]}function kc(e){return Array.isArray(e)}xc(),xc();var A=/* @__PURE__ */ yc(xc(),1);const Ac=Symbol(`__lazy_fields__`);var jc=class{constructor(){Mc(this)}};function Mc(e){let t=e.constructor[Ac];if(t)for(let[n,r]of t.entries()){let t,i=!1;Object.defineProperty(e,n,{get(){return i||=(t=r.call(this),!0),t},enumerable:!0,configurable:!0})}}function Nc(e){let t=e.constructor[Ac];return t?new Set(t.keys()):/* @__PURE__ */ new Set}function j(e,t,n){e.constructor[Ac]||(e.constructor[Ac]=/* @__PURE__ */ new Map);let r=n.get;return e.constructor[Ac].set(t,r),{enumerable:!1,configurable:!0}}function Pc(e){return e.inner}function M(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var Fc=class extends jc{bindingAsset;type=`asset`;constructor(e){super(),this.bindingAsset=e}get fileName(){return this.bindingAsset.getFileName()}get originalFileName(){return this.bindingAsset.getOriginalFileName()||null}get originalFileNames(){return this.bindingAsset.getOriginalFileNames()}get name(){return this.bindingAsset.getName()??void 0}get names(){return this.bindingAsset.getNames()}get source(){return Pc(this.bindingAsset.getSource())}__rolldown_external_memory_handle__(e){return e&&this.#e(),this.bindingAsset.dropInner()}#e(){for(let e of Nc(this))this[e]}};M([j],Fc.prototype,`fileName`,null),M([j],Fc.prototype,`originalFileName`,null),M([j],Fc.prototype,`originalFileNames`,null),M([j],Fc.prototype,`name`,null),M([j],Fc.prototype,`names`,null),M([j],Fc.prototype,`source`,null);function Ic(e){return{get code(){return e.code},get renderedLength(){return e.code?.length||0},get renderedExports(){return e.renderedExports}}}function Lc(e){let t={};for(let n=0;n<e.values.length;n++){let r=e.keys[n],i=e.values[n];t[r]=Ic(i)}return t}var N=class extends jc{bindingChunk;type=`chunk`;constructor(e){super(),this.bindingChunk=e}get fileName(){return this.bindingChunk.getFileName()}get name(){return this.bindingChunk.getName()}get exports(){return this.bindingChunk.getExports()}get isEntry(){return this.bindingChunk.getIsEntry()}get facadeModuleId(){return this.bindingChunk.getFacadeModuleId()||null}get isDynamicEntry(){return this.bindingChunk.getIsDynamicEntry()}get sourcemapFileName(){return this.bindingChunk.getSourcemapFileName()||null}get preliminaryFileName(){return this.bindingChunk.getPreliminaryFileName()}get code(){return this.bindingChunk.getCode()}get modules(){return Lc(this.bindingChunk.getModules())}get imports(){return this.bindingChunk.getImports()}get dynamicImports(){return this.bindingChunk.getDynamicImports()}get moduleIds(){return this.bindingChunk.getModuleIds()}get map(){let e=this.bindingChunk.getMap();return e?Rc(e):null}__rolldown_external_memory_handle__(e){return e&&this.#e(),this.bindingChunk.dropInner()}#e(){for(let e of Nc(this))this[e]}};M([j],N.prototype,`fileName`,null),M([j],N.prototype,`name`,null),M([j],N.prototype,`exports`,null),M([j],N.prototype,`isEntry`,null),M([j],N.prototype,`facadeModuleId`,null),M([j],N.prototype,`isDynamicEntry`,null),M([j],N.prototype,`sourcemapFileName`,null),M([j],N.prototype,`preliminaryFileName`,null),M([j],N.prototype,`code`,null),M([j],N.prototype,`modules`,null),M([j],N.prototype,`imports`,null),M([j],N.prototype,`dynamicImports`,null),M([j],N.prototype,`moduleIds`,null),M([j],N.prototype,`map`,null);function Rc(e){let t={...JSON.parse(e),toString(){return JSON.stringify(t)},toUrl(){return`data:application/json;charset=utf-8;base64,${Buffer.from(t.toString(),`utf-8`).toString(`base64`)}`}};return t}var zc=class extends jc{onLog;inputPlugins;inner;constructor(e,t,n){super(),this.onLog=t,this.inputPlugins=n,this.inner=e}get shimMissingExports(){return this.inner.shimMissingExports}get input(){return this.inner.input}get cwd(){return this.inner.cwd}get platform(){return this.inner.platform}get context(){return this.inner.context}get plugins(){return this.inputPlugins}};M([j],zc.prototype,`shimMissingExports`,null),M([j],zc.prototype,`input`,null),M([j],zc.prototype,`cwd`,null),M([j],zc.prototype,`platform`,null),M([j],zc.prototype,`context`,null);var P=class extends jc{inner;outputOptions;normalizedOutputPlugins;constructor(e,t,n){super(),this.inner=e,this.outputOptions=t,this.normalizedOutputPlugins=n}get dir(){return this.inner.dir??void 0}get entryFileNames(){return this.inner.entryFilenames||this.outputOptions.entryFileNames}get chunkFileNames(){return this.inner.chunkFilenames||this.outputOptions.chunkFileNames}get assetFileNames(){return this.inner.assetFilenames||this.outputOptions.assetFileNames}get format(){return this.inner.format}get exports(){return this.inner.exports}get sourcemap(){return this.inner.sourcemap}get sourcemapFileNames(){return this.inner.sourcemapFilenames||this.outputOptions.sourcemapFileNames}get sourcemapBaseUrl(){return this.inner.sourcemapBaseUrl??void 0}get shimMissingExports(){return this.inner.shimMissingExports}get name(){return this.inner.name??void 0}get file(){return this.inner.file??void 0}get codeSplitting(){return this.inner.codeSplitting}get inlineDynamicImports(){return!this.inner.codeSplitting}get dynamicImportInCjs(){return this.inner.dynamicImportInCjs}get externalLiveBindings(){return this.inner.externalLiveBindings}get banner(){return Bc(this.outputOptions.banner)}get footer(){return Bc(this.outputOptions.footer)}get postBanner(){return Bc(this.outputOptions.postBanner)}get postFooter(){return Bc(this.outputOptions.postFooter)}get intro(){return Bc(this.outputOptions.intro)}get outro(){return Bc(this.outputOptions.outro)}get esModule(){return this.inner.esModule}get extend(){return this.inner.extend}get globals(){return this.inner.globals||this.outputOptions.globals}get paths(){return this.outputOptions.paths}get hashCharacters(){return this.inner.hashCharacters}get sourcemapDebugIds(){return this.inner.sourcemapDebugIds}get sourcemapExcludeSources(){return this.inner.sourcemapExcludeSources}get sourcemapIgnoreList(){return this.outputOptions.sourcemapIgnoreList}get sourcemapPathTransform(){return this.outputOptions.sourcemapPathTransform}get minify(){let e=this.inner.minify;return typeof e==`object`&&e&&(delete e.codegen,delete e.module,delete e.sourcemap),e}get legalComments(){return this.inner.legalComments}get comments(){let e=this.inner.comments;return{legal:e.legal??!0,annotation:e.annotation??!0,jsdoc:e.jsdoc??!0}}get polyfillRequire(){return this.inner.polyfillRequire}get plugins(){return this.normalizedOutputPlugins}get preserveModules(){return this.inner.preserveModules}get preserveModulesRoot(){return this.inner.preserveModulesRoot}get virtualDirname(){return this.inner.virtualDirname}get topLevelVar(){return this.inner.topLevelVar??!1}get minifyInternalExports(){return this.inner.minifyInternalExports??!1}};M([j],P.prototype,`dir`,null),M([j],P.prototype,`entryFileNames`,null),M([j],P.prototype,`chunkFileNames`,null),M([j],P.prototype,`assetFileNames`,null),M([j],P.prototype,`format`,null),M([j],P.prototype,`exports`,null),M([j],P.prototype,`sourcemap`,null),M([j],P.prototype,`sourcemapFileNames`,null),M([j],P.prototype,`sourcemapBaseUrl`,null),M([j],P.prototype,`shimMissingExports`,null),M([j],P.prototype,`name`,null),M([j],P.prototype,`file`,null),M([j],P.prototype,`codeSplitting`,null),M([j],P.prototype,`inlineDynamicImports`,null),M([j],P.prototype,`dynamicImportInCjs`,null),M([j],P.prototype,`externalLiveBindings`,null),M([j],P.prototype,`banner`,null),M([j],P.prototype,`footer`,null),M([j],P.prototype,`postBanner`,null),M([j],P.prototype,`postFooter`,null),M([j],P.prototype,`intro`,null),M([j],P.prototype,`outro`,null),M([j],P.prototype,`esModule`,null),M([j],P.prototype,`extend`,null),M([j],P.prototype,`globals`,null),M([j],P.prototype,`paths`,null),M([j],P.prototype,`hashCharacters`,null),M([j],P.prototype,`sourcemapDebugIds`,null),M([j],P.prototype,`sourcemapExcludeSources`,null),M([j],P.prototype,`sourcemapIgnoreList`,null),M([j],P.prototype,`sourcemapPathTransform`,null),M([j],P.prototype,`minify`,null),M([j],P.prototype,`legalComments`,null),M([j],P.prototype,`comments`,null),M([j],P.prototype,`polyfillRequire`,null),M([j],P.prototype,`plugins`,null),M([j],P.prototype,`preserveModules`,null),M([j],P.prototype,`preserveModulesRoot`,null),M([j],P.prototype,`virtualDirname`,null),M([j],P.prototype,`topLevelVar`,null),M([j],P.prototype,`minifyInternalExports`,null);function Bc(e){return typeof e==`function`?e:()=>e||``}Object.defineProperty(A.BindingMagicString.prototype,"isRolldownMagicString",{value:!0,writable:!1,configurable:!1});function Vc(e,t){if(typeof e!=`string`)throw TypeError(t)}const Hc=A.BindingMagicString.prototype.append,Uc=A.BindingMagicString.prototype.prepend,Wc=A.BindingMagicString.prototype.appendLeft,Gc=A.BindingMagicString.prototype.appendRight,Kc=A.BindingMagicString.prototype.prependLeft,qc=A.BindingMagicString.prototype.prependRight,Jc=A.BindingMagicString.prototype.overwrite,Yc=A.BindingMagicString.prototype.update;A.BindingMagicString.prototype.append=function(e){return Vc(e,`outro content must be a string`),Hc.call(this,e)},A.BindingMagicString.prototype.prepend=function(e){return Vc(e,`outro content must be a string`),Uc.call(this,e)},A.BindingMagicString.prototype.appendLeft=function(e,t){return Vc(t,`inserted content must be a string`),Wc.call(this,e,t)},A.BindingMagicString.prototype.appendRight=function(e,t){return Vc(t,`inserted content must be a string`),Gc.call(this,e,t)},A.BindingMagicString.prototype.prependLeft=function(e,t){return Vc(t,`inserted content must be a string`),Kc.call(this,e,t)},A.BindingMagicString.prototype.prependRight=function(e,t){return Vc(t,`inserted content must be a string`),qc.call(this,e,t)},A.BindingMagicString.prototype.overwrite=function(e,t,n,r){return Vc(n,`replacement content must be a string`),Jc.call(this,e,t,n,r)},A.BindingMagicString.prototype.update=function(e,t,n,r){return Vc(n,`replacement content must be a string`),Yc.call(this,e,t,n,r)};const Xc=A.BindingMagicString.prototype.replace,Zc=A.BindingMagicString.prototype.replaceAll;A.BindingMagicString.prototype.replace=function(e,t){if(typeof e==`string`)return Xc.call(this,e,t);e.global&&(e.lastIndex=0);let n=this.replaceRegex(e,t);return e.global?e.lastIndex=0:e.sticky&&(e.lastIndex=n===-1?0:n),this},A.BindingMagicString.prototype.replaceAll=function(e,t){if(typeof e==`string`)return Zc.call(this,e,t);if(!e.global)throw TypeError(`MagicString.prototype.replaceAll called with a non-global RegExp argument`);return e.lastIndex=0,this.replaceRegex(e,t),e.lastIndex=0,this},A.BindingMagicString,Le.appendFile,Le.copyFile,Le.mkdir,Le.mkdtemp,Le.readdir,Le.readFile,Le.realpath,Le.rename,Le.rmdir,Le.stat,Le.lstat,Le.unlink,Le.writeFile;const Qc=[`options`,`buildStart`,`resolveId`,`load`,`transform`,`moduleParsed`,`buildEnd`,`onLog`,`resolveDynamicImport`,`closeBundle`,`closeWatcher`,`watchChange`],$c=[`augmentChunkHash`,`outputOptions`,`renderChunk`,`renderStart`,`renderError`,`writeBundle`,`generateBundle`,`resolveFileUrl`],F=[...Qc,...$c,`footer`,`banner`,`intro`,`outro`];F[0],F[0],F[1],F[1],F[2],F[2],F[3],F[3],F[4],F[4],F[5],F[5],F[6],F[6],F[7],F[7],F[8],F[8],F[9],F[9],F[10],F[10],F[11],F[11],F[12],F[12],F[13],F[13],F[14],F[14],F[15],F[15],F[16],F[16],F[17],F[17],F[18],F[18],F[19],F[19],F[20],F[20],F[21],F[21],F[22],F[22],F[23],F[23];const el={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};/* @__NO_SIDE_EFFECTS__ */
|
|
103
|
-
function tl(e){return e?{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}:el}/* @__NO_SIDE_EFFECTS__ */
|
|
104
|
-
function nl(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function I(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??/* @__PURE__ */ nl(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??(e.reference,c.lang,void 0)??(l?(c.lang,void 0):null)??r.message??(c.lang,void 0);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}/* @__NO_SIDE_EFFECTS__ */
|
|
105
|
-
function rl(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}/* @__NO_SIDE_EFFECTS__ */
|
|
106
|
-
function il(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}/* @__NO_SIDE_EFFECTS__ */
|
|
107
|
-
function al(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}function L(e){return e[`~standard`]={version:1,vendor:`valibot`,validate:t=>e[`~run`]({value:t},/* @__PURE__ */ tl())},e}var ol=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};/* @__NO_SIDE_EFFECTS__ */
|
|
108
|
-
function R(e){return{kind:`transformation`,type:`args`,reference:R,async:!1,schema:e,"~run"(e,t){let n=e.value;return e.value=(...e)=>{let r=this.schema[`~run`]({value:e},t);if(r.issues)throw new ol(r.issues);return n(...r.value)},e}}}/* @__NO_SIDE_EFFECTS__ */
|
|
109
|
-
function sl(){return{kind:`transformation`,type:`await`,reference:sl,async:!0,async"~run"(e){return e.value=await e.value,e}}}/* @__NO_SIDE_EFFECTS__ */
|
|
110
|
-
function z(e){return{kind:`metadata`,type:`description`,reference:z,description:e}}/* @__NO_SIDE_EFFECTS__ */
|
|
111
|
-
function cl(e){return{kind:`transformation`,type:`returns`,reference:cl,async:!1,schema:e,"~run"(e,t){let n=e.value;return e.value=(...e)=>{let r=this.schema[`~run`]({value:n(...e)},t);if(r.issues)throw new ol(r.issues);return r.value},e}}}/* @__NO_SIDE_EFFECTS__ */
|
|
112
|
-
function ll(e){return{kind:`transformation`,type:`returns`,reference:ll,async:!1,schema:e,"~run"(e,t){let n=e.value;return e.value=async(...e)=>{let r=await this.schema[`~run`]({value:await n(...e)},t);if(r.issues)throw new ol(r.issues);return r.value},e}}}const ul={abortEarly:!0};/* @__NO_SIDE_EFFECTS__ */
|
|
113
|
-
function dl(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}/* @__NO_SIDE_EFFECTS__ */
|
|
114
|
-
function fl(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}/* @__NO_SIDE_EFFECTS__ */
|
|
115
|
-
function pl(e,t){return!e[`~run`]({value:t},ul).issues}/* @__NO_SIDE_EFFECTS__ */
|
|
116
|
-
function ml(){return L({kind:`schema`,type:`any`,reference:ml,expects:`any`,async:!1,"~run"(e){return e.typed=!0,e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
117
|
-
function B(e,t){return L({kind:`schema`,type:`array`,reference:B,expects:`Array`,async:!1,item:e,message:t,"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else I(this,`type`,e,t);return e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
118
|
-
function V(e){return L({kind:`schema`,type:`boolean`,reference:V,expects:`boolean`,async:!1,message:e,"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
119
|
-
function hl(e,t){return L({kind:`schema`,type:`custom`,reference:hl,expects:`unknown`,async:!1,check:e,message:t,"~run"(e,t){return this.check(e.value)?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
120
|
-
function gl(e){return L({kind:`schema`,type:`function`,reference:gl,expects:`Function`,async:!1,message:e,"~run"(e,t){return typeof e.value==`function`?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
121
|
-
function _l(e,t){return L({kind:`schema`,type:`instance`,reference:_l,expects:e.name,async:!1,class:e,message:t,"~run"(e,t){return e.value instanceof this.class?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
122
|
-
function H(e,t){return L({kind:`schema`,type:`literal`,reference:H,expects:/* @__PURE__ */ nl(e),async:!1,literal:e,message:t,"~run"(e,t){return/* @__PURE__ */ rl(e.value,this.literal)?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
123
|
-
function vl(e){return L({kind:`schema`,type:`never`,reference:vl,expects:`never`,async:!1,message:e,"~run"(e,t){return I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
124
|
-
function yl(e,t){return L({kind:`schema`,type:`nullish`,reference:yl,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,"~run"(e,t){return(e.value===null||e.value===void 0)&&(this.default!==void 0&&(e.value=/* @__PURE__ */ fl(this,e,t)),e.value===null||e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}/* @__NO_SIDE_EFFECTS__ */
|
|
125
|
-
function U(e){return L({kind:`schema`,type:`number`,reference:U,expects:`number`,async:!1,message:e,"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
126
|
-
function bl(e,t){return L({kind:`schema`,type:`object`,reference:bl,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:/* @__PURE__ */ fl(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=/* @__PURE__ */ dl(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(I(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else I(this,`type`,e,t);return e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
127
|
-
function W(e,t){return L({kind:`schema`,type:`optional`,reference:W,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=/* @__PURE__ */ fl(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}/* @__NO_SIDE_EFFECTS__ */
|
|
128
|
-
function xl(e){return L({kind:`schema`,type:`promise`,reference:xl,expects:`Promise`,async:!1,message:e,"~run"(e,t){return e.value instanceof Promise?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
129
|
-
function Sl(e,t,n){return L({kind:`schema`,type:`record`,reference:Sl,expects:`Object`,async:!1,key:e,value:t,message:n,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(/* @__PURE__ */ il(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else I(this,`type`,e,t);return e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
130
|
-
function G(e,t){return L({kind:`schema`,type:`strict_object`,reference:G,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:/* @__PURE__ */ fl(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=/* @__PURE__ */ dl(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(I(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly){for(let r in n)if(!Object.prototype.hasOwnProperty.call(this.entries,r)){I(this,`key`,e,t,{input:r,expected:`never`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]});break}}}else I(this,`type`,e,t);return e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
131
|
-
function K(e){return L({kind:`schema`,type:`string`,reference:K,expects:`string`,async:!1,message:e,"~run"(e,t){return typeof e.value==`string`?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
132
|
-
function q(e,t){return L({kind:`schema`,type:`tuple`,reference:q,expects:`Array`,async:!1,items:e,message:t,"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<this.items.length;r++){let i=n[r],a=this.items[r][`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else I(this,`type`,e,t);return e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
133
|
-
function Cl(e){return L({kind:`schema`,type:`undefined`,reference:Cl,expects:`undefined`,async:!1,message:e,"~run"(e,t){return e.value===void 0?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
134
|
-
function wl(e){let t;if(e)for(let n of e)if(t)for(let e of n.issues)t.push(e);else t=n.issues;return t}/* @__NO_SIDE_EFFECTS__ */
|
|
135
|
-
function J(e,t){return L({kind:`schema`,type:`union`,reference:J,expects:/* @__PURE__ */ al(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,"~run"(e,t){let n,r,i;for(let a of this.options){let o=a[`~run`]({value:e.value},t);if(o.typed){if(o.issues)r?r.push(o):r=[o];else{n=o;break}}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];I(this,`type`,e,t,{issues:/* @__PURE__ */ wl(r)}),e.typed=!0}else if(i?.length===1)return i[0];else I(this,`type`,e,t,{issues:/* @__PURE__ */ wl(i)});return e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
136
|
-
function Tl(e,t){return L({kind:`schema`,type:`union`,reference:Tl,expects:/* @__PURE__ */ al(e.map(e=>e.expects),`|`),async:!0,options:e,message:t,async"~run"(e,t){let n,r,i;for(let a of this.options){let o=await a[`~run`]({value:e.value},t);if(o.typed){if(o.issues)r?r.push(o):r=[o];else{n=o;break}}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];I(this,`type`,e,t,{issues:/* @__PURE__ */ wl(r)}),e.typed=!0}else if(i?.length===1)return i[0];else I(this,`type`,e,t,{issues:/* @__PURE__ */ wl(i)});return e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
137
|
-
function El(e){return L({kind:`schema`,type:`void`,reference:El,expects:`void`,async:!1,message:e,"~run"(e,t){return e.value===void 0?e.typed=!0:I(this,`type`,e,t),e}})}/* @__NO_SIDE_EFFECTS__ */
|
|
138
|
-
function Dl(e,t){let n={...e.entries};for(let e of t)delete n[e];return L({...e,entries:n})}/* @__NO_SIDE_EFFECTS__ */
|
|
139
|
-
function Ol(e,t){let n={};for(let r in e.entries)n[r]=!t||t.includes(r)?/* @__PURE__ */ W(e.entries[r]):e.entries[r];return L({...e,entries:n})}/* @__NO_SIDE_EFFECTS__ */
|
|
140
|
-
function Y(...e){return L({...e[0],pipe:e,"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}})}/* @__NO_SIDE_EFFECTS__ */
|
|
141
|
-
function kl(...e){return L({...e[0],pipe:e,async:!0,async"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=await r[`~run`](t,n))}return t}})}function Al(...e){return ze(...e)}const jl=/* @__PURE__ */ J([/* @__PURE__ */ K(),/* @__PURE__ */ _l(RegExp)]);function X(){return/* @__PURE__ */ gl()}const Ml=/* @__PURE__ */ J([/* @__PURE__ */ H(`debug`),/* @__PURE__ */ H(`info`),/* @__PURE__ */ H(`warn`)]),Nl=/* @__PURE__ */ J([Ml,/* @__PURE__ */ H(`silent`)]),Pl=/* @__PURE__ */ J([Ml,/* @__PURE__ */ H(`error`)]),Fl=/* @__PURE__ */ ml(),Il=/* @__PURE__ */ J([Fl,/* @__PURE__ */ K()]),Ll=/* @__PURE__ */ J([/* @__PURE__ */ K(),/* @__PURE__ */ B(/* @__PURE__ */ K()),/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ K())]),Rl=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ K(),/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ V()])),/* @__PURE__ */ cl(/* @__PURE__ */ yl(/* @__PURE__ */ V()))),zl=/* @__PURE__ */ J([jl,/* @__PURE__ */ B(jl),Rl]),Bl=/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ J([/* @__PURE__ */ H(`asset`),/* @__PURE__ */ H(`base64`),/* @__PURE__ */ H(`binary`),/* @__PURE__ */ H(`copy`),/* @__PURE__ */ H(`css`),/* @__PURE__ */ H(`dataurl`),/* @__PURE__ */ H(`empty`),/* @__PURE__ */ H(`js`),/* @__PURE__ */ H(`json`),/* @__PURE__ */ H(`jsx`),/* @__PURE__ */ H(`text`),/* @__PURE__ */ H(`ts`),/* @__PURE__ */ H(`tsx`)])),Vl=/* @__PURE__ */ bl({assumptions:/* @__PURE__ */ W(/* @__PURE__ */ bl({ignoreFunctionLength:/* @__PURE__ */ W(/* @__PURE__ */ V()),noDocumentAll:/* @__PURE__ */ W(/* @__PURE__ */ V()),objectRestNoSymbols:/* @__PURE__ */ W(/* @__PURE__ */ V()),pureGetters:/* @__PURE__ */ W(/* @__PURE__ */ V()),setPublicClassFields:/* @__PURE__ */ W(/* @__PURE__ */ V())})),typescript:/* @__PURE__ */ W(/* @__PURE__ */ bl({jsxPragma:/* @__PURE__ */ W(/* @__PURE__ */ K()),jsxPragmaFrag:/* @__PURE__ */ W(/* @__PURE__ */ K()),onlyRemoveTypeImports:/* @__PURE__ */ W(/* @__PURE__ */ V()),allowNamespaces:/* @__PURE__ */ W(/* @__PURE__ */ V()),allowDeclareFields:/* @__PURE__ */ W(/* @__PURE__ */ V()),removeClassFieldsWithoutInitializer:/* @__PURE__ */ W(/* @__PURE__ */ V()),optimizeConstEnums:/* @__PURE__ */ W(/* @__PURE__ */ V()),optimizeEnums:/* @__PURE__ */ W(/* @__PURE__ */ V()),declaration:/* @__PURE__ */ W(/* @__PURE__ */ bl({stripInternal:/* @__PURE__ */ W(/* @__PURE__ */ V()),sourcemap:/* @__PURE__ */ W(/* @__PURE__ */ V())})),rewriteImportExtensions:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`rewrite`),/* @__PURE__ */ H(`remove`),/* @__PURE__ */ V()]))})),helpers:/* @__PURE__ */ W(/* @__PURE__ */ bl({mode:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`Runtime`),/* @__PURE__ */ H(`External`)]))})),decorator:/* @__PURE__ */ W(/* @__PURE__ */ bl({legacy:/* @__PURE__ */ W(/* @__PURE__ */ V()),emitDecoratorMetadata:/* @__PURE__ */ W(/* @__PURE__ */ V()),strictNullChecks:/* @__PURE__ */ W(/* @__PURE__ */ V())})),jsx:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(!1),/* @__PURE__ */ H(`preserve`),/* @__PURE__ */ H(`react`),/* @__PURE__ */ H(`react-jsx`),/* @__PURE__ */ G({runtime:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`classic`),/* @__PURE__ */ H(`automatic`)])),/* @__PURE__ */ z(`Which runtime to use`)),development:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Development specific information`)),throwIfNamespace:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Toggles whether to throw an error when a tag name uses an XML namespace`)),pure:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Mark JSX elements and top-level React method calls as pure for tree shaking.`)),importSource:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Import the factory of element and fragment if mode is classic`)),pragma:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Jsx element transformation`)),pragmaFrag:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Jsx fragment transformation`)),refresh:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ ml()])),/* @__PURE__ */ z(`Enable react fast refresh`))})])),target:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),/* @__PURE__ */ B(/* @__PURE__ */ K())])),/* @__PURE__ */ z(`The JavaScript target environment`)),define:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ K())),/* @__PURE__ */ z(`Define global variables (syntax: key:value,key2:value2)`)),inject:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ J([/* @__PURE__ */ K(),/* @__PURE__ */ q([/* @__PURE__ */ K(),/* @__PURE__ */ K()])]))),/* @__PURE__ */ z(`Inject import statements on demand`)),dropLabels:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),/* @__PURE__ */ z(`Remove labeled statements with these label names`)),plugins:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ bl({styledComponents:/* @__PURE__ */ W(/* @__PURE__ */ ml()),taggedTemplateEscape:/* @__PURE__ */ W(/* @__PURE__ */ V())})),/* @__PURE__ */ z(`Third-party plugins to use`))}),Hl=/* @__PURE__ */ G({usePolling:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Use polling-based file watching instead of native OS events`)),pollInterval:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Poll interval in milliseconds (only used when usePolling is true)`)),compareContentsForPolling:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Compare file contents for poll-based watchers (only used when usePolling is true)`)),useDebounce:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Use debounced event delivery at the filesystem level`)),debounceDelay:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Debounce delay in milliseconds (only used when useDebounce is true)`)),debounceTickRate:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Tick rate in milliseconds for debouncer (only used when useDebounce is true)`))}),Ul=/* @__PURE__ */ G({chokidar:/* @__PURE__ */ W(/* @__PURE__ */ vl(`The "watch.chokidar" option is deprecated, please use "watch.watcher" instead of it`)),exclude:/* @__PURE__ */ W(/* @__PURE__ */ J([jl,/* @__PURE__ */ B(jl)])),include:/* @__PURE__ */ W(/* @__PURE__ */ J([jl,/* @__PURE__ */ B(jl)])),watcher:/* @__PURE__ */ W(Hl),notify:/* @__PURE__ */ W(Hl),skipWrite:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Skip the bundle.write() step`)),buildDelay:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Throttle watch rebuilds`)),clearScreen:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to clear the screen when a rebuild is triggered`)),onInvalidate:/* @__PURE__ */ Y(/* @__PURE__ */ W(X()),/* @__PURE__ */ z(`An optional function that will be called immediately every time a module changes that is part of the build.`))}),Wl=/* @__PURE__ */ G({circularDependency:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when detecting circular dependency`)),eval:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Whether to emit warnings when detecting uses of direct `eval`s")),missingGlobalName:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Whether to emit warnings when the `output.globals` option is missing when needed")),missingNameOptionForIifeExport:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Whether to emit warnings when the `output.name` option is missing when needed")),invalidAnnotation:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Whether to emit warnings when a `#__PURE__` / `@__PURE__` annotation has no effect due to its position")),mixedExports:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when the way to export values is ambiguous`)),unresolvedEntry:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when an entrypoint cannot be resolved`)),unresolvedImport:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when an import cannot be resolved`)),filenameConflict:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when files generated have the same name with different contents`)),moduleLevelDirective:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Whether to emit warnings for module-level directives other than `use strict`")),commonJsVariableInEsm:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when a CommonJS variable is used in an ES module`)),importIsUndefined:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when an imported variable is not exported`)),emptyImportMeta:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Whether to emit warnings when `import.meta` is not supported with the output format and is replaced with an empty object (`{}`)")),toleratedTransform:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when detecting tolerated transform`)),cannotCallNamespace:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when a namespace is called as a function`)),configurationFieldConflict:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when a config value is overridden by another config value with a higher priority`)),preferBuiltinFeature:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when a plugin that is covered by a built-in feature is used`)),couldNotCleanDirectory:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when Rolldown could not clean the output directory`)),pluginTimings:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when plugins take significant time during the build process`)),duplicateShebang:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when both the code and postBanner contain shebang`)),unsupportedTsconfigOption:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when a tsconfig option or combination of options is not supported`)),ineffectiveDynamicImport:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when a module is dynamically imported but also statically imported, making the dynamic import ineffective for code splitting`)),largeBarrelModules:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit info logs when a barrel module has a very large number of re-exports (more than 5000)`)),sourcemapBroken:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when a plugin transforms code without generating a sourcemap`)),namespaceConflict:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to emit warnings when multiple star re-exports provide the same name from different modules`))}),Gl=/* @__PURE__ */ G({compress:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({target:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),/* @__PURE__ */ B(/* @__PURE__ */ K())])),dropConsole:/* @__PURE__ */ W(/* @__PURE__ */ V()),dropDebugger:/* @__PURE__ */ W(/* @__PURE__ */ V()),keepNames:/* @__PURE__ */ W(/* @__PURE__ */ G({function:/* @__PURE__ */ V(),class:/* @__PURE__ */ V()})),unused:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ H(`keep_assign`)])),joinVars:/* @__PURE__ */ W(/* @__PURE__ */ V()),sequences:/* @__PURE__ */ W(/* @__PURE__ */ V()),dropLabels:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),maxIterations:/* @__PURE__ */ W(/* @__PURE__ */ U()),treeshake:/* @__PURE__ */ W(/* @__PURE__ */ G({annotations:/* @__PURE__ */ W(/* @__PURE__ */ V()),manualPureFunctions:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),propertyReadSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ H(`always`)])),propertyWriteSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ V()),unknownGlobalSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ V()),invalidImportSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ V())}))})])),mangle:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({toplevel:/* @__PURE__ */ W(/* @__PURE__ */ V()),keepNames:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({function:/* @__PURE__ */ V(),class:/* @__PURE__ */ V()})])),reserved:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),debug:/* @__PURE__ */ W(/* @__PURE__ */ V())})])),mangleProps:/* @__PURE__ */ W(/* @__PURE__ */ G({include:/* @__PURE__ */ _l(RegExp),exclude:/* @__PURE__ */ W(/* @__PURE__ */ _l(RegExp)),reserved:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),quoted:/* @__PURE__ */ W(/* @__PURE__ */ V()),debug:/* @__PURE__ */ W(/* @__PURE__ */ V()),cache:/* @__PURE__ */ W(/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ J([/* @__PURE__ */ K(),/* @__PURE__ */ H(!1)])))})),codegen:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({removeWhitespace:/* @__PURE__ */ W(/* @__PURE__ */ V()),asciiOnly:/* @__PURE__ */ W(/* @__PURE__ */ V()),legalComments:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`none`),/* @__PURE__ */ H(`inline`),/* @__PURE__ */ H(`eof`),/* @__PURE__ */ H(`external`),/* @__PURE__ */ G({linked:/* @__PURE__ */ K()})]))})]))}),Kl=/* @__PURE__ */ G({alias:/* @__PURE__ */ W(/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ J([/* @__PURE__ */ H(!1),/* @__PURE__ */ K(),/* @__PURE__ */ B(/* @__PURE__ */ K())]))),aliasFields:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ B(/* @__PURE__ */ K()))),conditionNames:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),extensionAlias:/* @__PURE__ */ W(/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ B(/* @__PURE__ */ K()))),exportsFields:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ B(/* @__PURE__ */ K()))),extensions:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),mainFields:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),mainFiles:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),modules:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),symlinks:/* @__PURE__ */ W(/* @__PURE__ */ V()),tsconfigFilename:/* @__PURE__ */ W(/* @__PURE__ */ K())}),ql=/* @__PURE__ */ G({moduleSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ ml()),annotations:/* @__PURE__ */ W(/* @__PURE__ */ V()),manualPureFunctions:/* @__PURE__ */ W(/* @__PURE__ */ hl(e=>/* @__PURE__ */ pl(/* @__PURE__ */ B(/* @__PURE__ */ K()),e),`string array`)),unknownGlobalSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ V()),invalidImportSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ V()),commonjs:/* @__PURE__ */ W(/* @__PURE__ */ V()),propertyReadSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(!1),/* @__PURE__ */ H(`always`)])),propertyWriteSideEffects:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(!1),/* @__PURE__ */ H(`always`)]))}),Jl=/* @__PURE__ */ G({inlineConst:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({mode:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`all`),/* @__PURE__ */ H(`smart`)])),pass:/* @__PURE__ */ W(/* @__PURE__ */ U())})])),/* @__PURE__ */ z(`Enable crossmodule constant inlining`)),pifeForModuleWrappers:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Use PIFE pattern for module wrappers`))}),Yl=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([Pl,Il]))),Xl=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([Ml,Fl,Yl]))),Zl=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([Fl,/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ J([Il,/* @__PURE__ */ Y(X(),/* @__PURE__ */ cl(Il))])])))]))),Ql=/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({port:/* @__PURE__ */ W(/* @__PURE__ */ U()),host:/* @__PURE__ */ W(/* @__PURE__ */ K()),implement:/* @__PURE__ */ W(/* @__PURE__ */ K()),skipCommonRuntimeInjection:/* @__PURE__ */ W(/* @__PURE__ */ V()),lazy:/* @__PURE__ */ W(/* @__PURE__ */ V())})]),$l=/* @__PURE__ */ G({input:/* @__PURE__ */ W(Ll),plugins:/* @__PURE__ */ W(/* @__PURE__ */ hl(()=>!0)),external:/* @__PURE__ */ W(zl),makeAbsoluteExternalsRelative:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ H(`ifRelativeSource`)])),resolve:/* @__PURE__ */ W(Kl),cwd:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Current working directory`)),platform:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`browser`),/* @__PURE__ */ H(`neutral`),/* @__PURE__ */ H(`node`)])),/* @__PURE__ */ z(`Platform for which the code should be generated (node, ${Al(`underline`,`browser`)}, neutral)`)),shimMissingExports:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Create shim variables for missing exports`)),treeshake:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),ql])),optimization:/* @__PURE__ */ W(Jl),logLevel:/* @__PURE__ */ Y(/* @__PURE__ */ W(Nl),/* @__PURE__ */ z(`Log level (${Al(`dim`,`silent`)}, ${Al([`underline`,`gray`],`info`)}, debug, ${Al(`yellow`,`warn`)})`)),onLog:/* @__PURE__ */ W(Xl),onwarn:/* @__PURE__ */ W(Zl),moduleTypes:/* @__PURE__ */ Y(/* @__PURE__ */ W(Bl),/* @__PURE__ */ z(`Module types for customized extensions`)),experimental:/* @__PURE__ */ W(/* @__PURE__ */ G({viteMode:/* @__PURE__ */ W(/* @__PURE__ */ V()),resolveNewUrlToAsset:/* @__PURE__ */ W(/* @__PURE__ */ V()),devMode:/* @__PURE__ */ W(Ql),chunkModulesOrder:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`module-id`),/* @__PURE__ */ H(`exec-order`)])),attachDebugInfo:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`none`),/* @__PURE__ */ H(`simple`),/* @__PURE__ */ H(`full`)])),chunkImportMap:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ bl({baseUrl:/* @__PURE__ */ W(/* @__PURE__ */ K()),fileName:/* @__PURE__ */ W(/* @__PURE__ */ K())})])),onDemandWrapping:/* @__PURE__ */ W(/* @__PURE__ */ V()),incrementalBuild:/* @__PURE__ */ W(/* @__PURE__ */ V()),nativeMagicString:/* @__PURE__ */ W(/* @__PURE__ */ V()),chunkOptimization:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({mergeCommonChunks:/* @__PURE__ */ W(/* @__PURE__ */ V()),avoidRedundantChunkLoads:/* @__PURE__ */ W(/* @__PURE__ */ V())})])),lazyBarrel:/* @__PURE__ */ W(/* @__PURE__ */ V())})),transform:/* @__PURE__ */ W(Vl),watch:/* @__PURE__ */ W(/* @__PURE__ */ J([Ul,/* @__PURE__ */ H(!1)])),checks:/* @__PURE__ */ W(Wl),devtools:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ bl({sessionId:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Used to name the build.`))})),/* @__PURE__ */ z(`Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.`)),preserveEntrySignatures:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`strict`),/* @__PURE__ */ H(`allow-extension`),/* @__PURE__ */ H(`exports-only`),/* @__PURE__ */ H(!1)]))),context:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z("The value of `this` at the top level of each module.")),tsconfig:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ K()])),/* @__PURE__ */ z(`Path to the tsconfig.json file.`))}),eu=/* @__PURE__ */ G({input:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),/* @__PURE__ */ z(`Entry file`)),external:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K())),/* @__PURE__ */ z("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),treeshake:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`enable treeshaking`)),makeAbsoluteExternalsRelative:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Prevent normalization of external imports`)),preserveEntrySignatures:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ H(!1)),/* @__PURE__ */ z(`Avoid facade chunks for entry points`)),context:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z("The entity top-level `this` represents."))}),tu=/* @__PURE__ */ Dl(/* @__PURE__ */ G({...$l.entries,...eu.entries}),[`plugins`,`onwarn`,`onLog`,`resolve`,`experimental`,`watch`]),nu=/* @__PURE__ */ J([/* @__PURE__ */ H(`es`),/* @__PURE__ */ H(`cjs`),/* @__PURE__ */ H(`esm`),/* @__PURE__ */ H(`module`),/* @__PURE__ */ H(`commonjs`),/* @__PURE__ */ H(`iife`),/* @__PURE__ */ H(`umd`)]),ru=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ hl(()=>!0)])),/* @__PURE__ */ ll(/* @__PURE__ */ Tl([/* @__PURE__ */ K(),/* @__PURE__ */ kl(/* @__PURE__ */ xl(),/* @__PURE__ */ sl(),/* @__PURE__ */ K())]))),iu=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ hl(()=>!0)])),/* @__PURE__ */ cl(/* @__PURE__ */ K())),au=/* @__PURE__ */ J([/* @__PURE__ */ K(),iu]),ou=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ hl(()=>!0)])),/* @__PURE__ */ cl(/* @__PURE__ */ K())),su=/* @__PURE__ */ J([/* @__PURE__ */ K(),ou]),cu=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ K()])),/* @__PURE__ */ cl(/* @__PURE__ */ K())),lu=/* @__PURE__ */ J([/* @__PURE__ */ V(),cu]),uu=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ K()])),/* @__PURE__ */ cl(/* @__PURE__ */ K())),du=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ K()])),/* @__PURE__ */ cl(/* @__PURE__ */ K())),fu=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ K(),/* @__PURE__ */ bl({})])),/* @__PURE__ */ cl(/* @__PURE__ */ yl(/* @__PURE__ */ K()))),pu=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ K(),/* @__PURE__ */ bl({})])),/* @__PURE__ */ cl(/* @__PURE__ */ yl(/* @__PURE__ */ K()))),mu=/* @__PURE__ */ Y(X(),/* @__PURE__ */ R(/* @__PURE__ */ q([/* @__PURE__ */ K()])),/* @__PURE__ */ cl(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ El(),/* @__PURE__ */ Cl()]))),hu=/* @__PURE__ */ G({includeDependenciesRecursively:/* @__PURE__ */ W(/* @__PURE__ */ V()),minSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),maxSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),minModuleSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),maxModuleSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),minShareCount:/* @__PURE__ */ W(/* @__PURE__ */ U()),groups:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ G({name:/* @__PURE__ */ J([/* @__PURE__ */ K(),pu]),test:/* @__PURE__ */ W(/* @__PURE__ */ J([jl,mu])),priority:/* @__PURE__ */ W(/* @__PURE__ */ U()),minSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),minShareCount:/* @__PURE__ */ W(/* @__PURE__ */ U()),maxSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),minModuleSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),maxModuleSize:/* @__PURE__ */ W(/* @__PURE__ */ U()),entriesAware:/* @__PURE__ */ W(/* @__PURE__ */ V()),entriesAwareMergeThreshold:/* @__PURE__ */ W(/* @__PURE__ */ U()),includeDependenciesRecursively:/* @__PURE__ */ W(/* @__PURE__ */ V()),tags:/* @__PURE__ */ W(/* @__PURE__ */ B(/* @__PURE__ */ K()))})))}),gu=/* @__PURE__ */ G({symbols:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to use Symbol.toStringTag for namespace objects`)),preset:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`es5`),/* @__PURE__ */ H(`es2015`)])),profilerNames:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Whether to add readable names to internal variables for profiling purposes`))}),_u=/* @__PURE__ */ G({dir:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z("Output directory, defaults to `dist` if `file` is not set")),file:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Single output file`)),exports:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`auto`),/* @__PURE__ */ H(`named`),/* @__PURE__ */ H(`default`),/* @__PURE__ */ H(`none`)])),/* @__PURE__ */ z(`Specify a export mode (${Al(`underline`,`auto`)}, named, default, none)`)),hashCharacters:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`base64`),/* @__PURE__ */ H(`base36`),/* @__PURE__ */ H(`hex`)])),/* @__PURE__ */ z(`Use the specified character set for file hashes`)),format:/* @__PURE__ */ Y(/* @__PURE__ */ W(nu),/* @__PURE__ */ z(`Output format of the generated bundle (supports ${Al(`underline`,`esm`)}, cjs, and iife)`)),sourcemap:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ H(`inline`),/* @__PURE__ */ H(`hidden`)])),/* @__PURE__ */ z("Generate sourcemap (`-s inline` for inline, or `-s` for `.map` file)")),sourcemapBaseUrl:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Base URL used to prefix sourcemap paths`)),sourcemapFileNames:/* @__PURE__ */ Y(/* @__PURE__ */ W(au),/* @__PURE__ */ z(`Name pattern for emitted sourcemaps`)),sourcemapDebugIds:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Inject sourcemap debug IDs`)),sourcemapExcludeSources:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Exclude source content from sourcemaps`)),sourcemapIgnoreList:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ hl(()=>!0),jl])),sourcemapPathTransform:/* @__PURE__ */ W(/* @__PURE__ */ hl(()=>!0)),banner:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),ru])),footer:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),ru])),postBanner:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),ru])),postFooter:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),ru])),intro:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),ru])),outro:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ K(),ru])),extend:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Extend global variable defined by name in IIFE / UMD formats`)),esModule:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ H(`if-default-prop`)])),assetFileNames:/* @__PURE__ */ W(su),entryFileNames:/* @__PURE__ */ W(au),chunkFileNames:/* @__PURE__ */ W(au),sanitizeFileName:/* @__PURE__ */ W(lu),minify:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ H(`dce-only`),Gl])),/* @__PURE__ */ z(`Minify the bundled file`)),name:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Name for UMD / IIFE format outputs`)),globals:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ K()),uu])),/* @__PURE__ */ z("Global variable of UMD / IIFE dependencies (syntax: `key:value`)")),paths:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ K()),du])),/* @__PURE__ */ z(`Maps external module IDs to paths`)),generatedCode:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ Ol(gu)),/* @__PURE__ */ z(`Generated code options`)),externalLiveBindings:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`external live bindings`)),inlineDynamicImports:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Inline dynamic imports`)),dynamicImportInCjs:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Dynamic import in CJS output`)),manualChunks:/* @__PURE__ */ W(fu),codeSplitting:/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),hu])),advancedChunks:/* @__PURE__ */ W(hu),legalComments:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ H(`none`),/* @__PURE__ */ H(`inline`)])),/* @__PURE__ */ z(`Control legal comments in the output`)),comments:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({legal:/* @__PURE__ */ W(/* @__PURE__ */ V()),annotation:/* @__PURE__ */ W(/* @__PURE__ */ V()),jsdoc:/* @__PURE__ */ W(/* @__PURE__ */ V())})])),/* @__PURE__ */ z(`Control comments in the output`)),plugins:/* @__PURE__ */ W(/* @__PURE__ */ hl(()=>!0)),polyfillRequire:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Disable require polyfill injection`)),hoistTransitiveImports:/* @__PURE__ */ W(/* @__PURE__ */ H(!1)),preserveModules:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Preserve module structure`)),preserveModulesRoot:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Put preserved modules under this path at root level`)),virtualDirname:/* @__PURE__ */ W(/* @__PURE__ */ K()),minifyInternalExports:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Minify internal exports`)),topLevelVar:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Rewrite top-level declarations to use `var`.")),cleanDir:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Clean output directory before emitting output`)),keepNames:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Keep function and class names after bundling`)),strictExecutionOrder:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Preserve source module execution order across generated chunks.`)),strict:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ H(`auto`)])),/* @__PURE__ */ z('Whether to always output `"use strict"` directive in non-ES module outputs.'))}),vu=(e,t)=>`Code to insert the ${Al(`bold`,e)} of the bundled file (${Al(`bold`,t)} the wrapper function)`,yu=/* @__PURE__ */ G({assetFileNames:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Name pattern for asset files`)),entryFileNames:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Name pattern for emitted entry chunks`)),chunkFileNames:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(`Name pattern for emitted secondary chunks`)),sanitizeFileName:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Sanitize file name`)),banner:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(vu(`top`,`outside`))),footer:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(vu(`bottom`,`outside`))),postBanner:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z("A string to prepend to the top of each chunk. Applied after the `renderChunk` hook and minification")),postFooter:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z("A string to append to the bottom of each chunk. Applied after the `renderChunk` hook and minification")),intro:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(vu(`top`,`inside`))),outro:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ K()),/* @__PURE__ */ z(vu(`bottom`,`inside`))),esModule:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),globals:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ Sl(/* @__PURE__ */ K(),/* @__PURE__ */ K())),/* @__PURE__ */ z("Global variable of UMD / IIFE dependencies (syntax: `key:value`)")),codeSplitting:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ J([/* @__PURE__ */ V(),/* @__PURE__ */ G({minSize:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Minimum size of the chunk`)),minShareCount:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Minimum share count of the chunk`))})])),/* @__PURE__ */ z("Code splitting options. Enabled by default; use `--no-codeSplitting` to disable, or `--codeSplitting.minSize` / `--codeSplitting.minShareCount` to configure")),advancedChunks:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ G({minSize:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Minimum size of the chunk`)),minShareCount:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ U()),/* @__PURE__ */ z(`Minimum share count of the chunk`))})),/* @__PURE__ */ z(`Deprecated: use codeSplitting instead`)),minify:/* @__PURE__ */ Y(/* @__PURE__ */ W(/* @__PURE__ */ V()),/* @__PURE__ */ z(`Minify the bundled file`))}),bu=/* @__PURE__ */ Dl(/* @__PURE__ */ G({..._u.entries,...yu.entries}),[`sourcemapIgnoreList`,`sourcemapPathTransform`,`plugins`,`hoistTransitiveImports`]);({...tu.entries,...bu.entries});const Z={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},xu={silent:{level:-1},fatal:{level:Z.fatal},error:{level:Z.error},warn:{level:Z.warn},log:{level:Z.log},info:{level:Z.info},success:{level:Z.success},fail:{level:Z.fail},ready:{level:Z.info},start:{level:Z.info},box:{level:Z.info},debug:{level:Z.debug},trace:{level:Z.trace},verbose:{level:Z.verbose}};function Su(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function Cu(e,t,n=`.`,r){if(!Su(t))return Cu(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:Su(a)&&Su(i[t])?Cu(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function wu(e){return(...t)=>t.reduce((t,n)=>Cu(t,n,``,e),{})}const Tu=wu();function Eu(e){return Object.prototype.toString.call(e)===`[object Object]`}function Du(e){return!(!Eu(e)||!e.message&&!e.args||e.stack)}let Ou=!1;const ku=[];var Q=class e{options;_lastLog;_mockFn;constructor(e={}){let t=e.types||xu;this.options=Tu({...e,defaults:{...e.defaults},level:Au(e.level,t),reporters:[...e.reporters||[]]},{types:xu,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let e in t){let n={type:e,...this.options.defaults,...t[e]};this[e]=this._wrapLogFn(n),this[e].raw=this._wrapLogFn(n,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=Au(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,t)}create(t){let n=new e({...this.options,...t});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(t!==-1)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,t){e&&(e.__write||=e.write,e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){Ou=!0}resumeLogs(){Ou=!1;let e=ku.splice(0);for(let t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,typeof t==`function`)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>{if(Ou){ku.push([this,e,n,t]);return}return this._logFn(e,n,t)}}_logFn(e,t,n){if((e.level||0)>this.level)return!1;let r={date:/* @__PURE__ */ new Date,args:[],...e,level:Au(e.level,this.options.types)};!n&&t.length===1&&Du(t[0])?Object.assign(r,t[0]):r.args=[...t],r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split(`
|
|
142
|
-
`)),r.args.push(`
|
|
143
|
-
`+r.additional.join(`
|
|
144
|
-
`)),delete r.additional),r.type=typeof r.type==`string`?r.type.toLowerCase():`log`,r.tag=typeof r.tag==`string`?r.tag:``;let i=(e=!1)=>{let t=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&t>0){let e=[...this._lastLog.object.args];t>1&&e.push(`(repeated ${t} times)`),this._log({...this._lastLog.object,args:e}),this._lastLog.count=1}e&&(this._lastLog.object=r,this._log(r))};clearTimeout(this._lastLog.timeout);let a=this._lastLog.time&&r.date?r.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=r.date,a<this.options.throttle)try{let e=JSON.stringify([r.type,r.tag,r.args]),t=this._lastLog.serialized===e;if(this._lastLog.serialized=e,t&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(i,this.options.throttle);return}}catch{}i(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}};function Au(e,t={},n=3){return e===void 0?n:typeof e==`number`?e:t[e]&&t[e].level!==void 0?t[e].level:n}Q.prototype.add=Q.prototype.addReporter,Q.prototype.remove=Q.prototype.removeReporter,Q.prototype.clear=Q.prototype.removeReporter,Q.prototype.withScope=Q.prototype.withTag,Q.prototype.mock=Q.prototype.mockTypes,Q.prototype.pause=Q.prototype.pauseLogs,Q.prototype.resume=Q.prototype.resumeLogs;function ju(e={}){return new Q(e)}function Mu(e,t){let n=process.cwd()+Ae;return e.split(`
|
|
145
|
-
`).splice(t.split(`
|
|
146
|
-
`).length).map(e=>e.trim().replace(`file://`,``).replace(n,``))}function Nu(e,t){return(t.__write||t.write).call(t,e)}const Pu=e=>e?`[${e}]`:``;var Fu=class{formatStack(e,t,n){let r=` `.repeat((n?.errorLevel||0)+1);return r+Mu(e,t).join(`
|
|
147
|
-
${r}`)}formatError(e,t){let n=e.message??Re(t,e),r=e.stack?this.formatStack(e.stack,n,t):``,i=t?.errorLevel||0,a=i>0?`${` `.repeat(i)}[cause]: `:``,o=e.cause?`
|
|
148
|
-
|
|
149
|
-
`+this.formatError(e.cause,{...t,errorLevel:i+1}):``;return a+n+`
|
|
150
|
-
`+r+o}formatArgs(e,t){let n=e.map(e=>e&&typeof e.stack==`string`?this.formatError(e,t):e);return Re(t,...n)}formatDate(e,t){return t.date?e.toLocaleTimeString():``}filterAndJoin(e){return e.filter(Boolean).join(` `)}formatLogObj(e,t){let n=this.formatArgs(e.args,t);return e.type===`box`?`
|
|
151
|
-
`+[Pu(e.tag),e.title&&e.title,...n.split(`
|
|
152
|
-
`)].filter(Boolean).map(e=>` > `+e).join(`
|
|
153
|
-
`)+`
|
|
154
|
-
`:this.filterAndJoin([Pu(e.type),Pu(e.tag),n])}log(e,t){return Nu(this.formatLogObj(e,{columns:t.options.stdout.columns||0,...t.options.formatOptions})+`
|
|
155
|
-
`,e.level<2?t.options.stderr||process.stderr:t.options.stdout||process.stdout)}};const{env:Iu={},argv:Lu=[],platform:Ru=``}=typeof process>`u`?{}:process,zu=`NO_COLOR`in Iu||Lu.includes(`--no-color`),Bu=`FORCE_COLOR`in Iu||Lu.includes(`--color`),Vu=Ru===`win32`,Hu=Iu.TERM===`dumb`,Uu=Be&&Be.isatty&&Be.isatty(1)&&Iu.TERM&&!Hu,Wu=`CI`in Iu&&(`GITHUB_ACTIONS`in Iu||`GITLAB_CI`in Iu||`CIRCLECI`in Iu),Gu=!zu&&(Bu||Vu&&!Hu||Uu||Wu);function Ku(e,t,n,r,i=t.slice(0,Math.max(0,e))+r,a=t.slice(Math.max(0,e+n.length)),o=a.indexOf(n)){return i+(o<0?a:Ku(o,a,n,r))}function qu(e,t,n,r,i){return e<0?n+t+r:n+Ku(e,t,r,i)+r}function Ju(e,t,n=e,r=e.length+1){return i=>i||i!==``&&i!==void 0?qu((``+i).indexOf(t,r),i,e,t,n):``}function $(e,t,n){return Ju(`\x1B[${e}m`,`\x1B[${t}m`,n)}const Yu={reset:$(0,0),bold:$(1,22,`\x1B[22m\x1B[1m`),dim:$(2,22,`\x1B[22m\x1B[2m`),italic:$(3,23),underline:$(4,24),inverse:$(7,27),hidden:$(8,28),strikethrough:$(9,29),black:$(30,39),red:$(31,39),green:$(32,39),yellow:$(33,39),blue:$(34,39),magenta:$(35,39),cyan:$(36,39),white:$(37,39),gray:$(90,39),bgBlack:$(40,49),bgRed:$(41,49),bgGreen:$(42,49),bgYellow:$(43,49),bgBlue:$(44,49),bgMagenta:$(45,49),bgCyan:$(46,49),bgWhite:$(47,49),blackBright:$(90,39),redBright:$(91,39),greenBright:$(92,39),yellowBright:$(93,39),blueBright:$(94,39),magentaBright:$(95,39),cyanBright:$(96,39),whiteBright:$(97,39),bgBlackBright:$(100,49),bgRedBright:$(101,49),bgGreenBright:$(102,49),bgYellowBright:$(103,49),bgBlueBright:$(104,49),bgMagentaBright:$(105,49),bgCyanBright:$(106,49),bgWhiteBright:$(107,49)};function Xu(e=Gu){return e?Yu:Object.fromEntries(Object.keys(Yu).map(e=>[e,String]))}const Zu=Xu();function Qu(e,t=`reset`){return Zu[e]||Zu[t]}const $u=[String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);function ed(e){return e.replace(new RegExp($u,`g`),``)}const td={solid:{tl:`┌`,tr:`┐`,bl:`└`,br:`┘`,h:`─`,v:`│`},double:{tl:`╔`,tr:`╗`,bl:`╚`,br:`╝`,h:`═`,v:`║`},doubleSingle:{tl:`╓`,tr:`╖`,bl:`╙`,br:`╜`,h:`─`,v:`║`},doubleSingleRounded:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`,h:`─`,v:`║`},singleThick:{tl:`┏`,tr:`┓`,bl:`┗`,br:`┛`,h:`━`,v:`┃`},singleDouble:{tl:`╒`,tr:`╕`,bl:`╘`,br:`╛`,h:`═`,v:`│`},singleDoubleRounded:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`,h:`═`,v:`│`},rounded:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`,h:`─`,v:`│`}},nd={borderColor:`white`,borderStyle:`rounded`,valign:`center`,padding:2,marginLeft:1,marginTop:1,marginBottom:1};function rd(e,t={}){let n={...t,style:{...nd,...t.style}},r=e.split(`
|
|
156
|
-
`),i=[],a=Qu(n.style.borderColor),o={...typeof n.style.borderStyle==`string`?td[n.style.borderStyle]||td.solid:n.style.borderStyle};if(a)for(let e in o)o[e]=a(o[e]);let s=n.style.padding%2==0?n.style.padding:n.style.padding+1,c=r.length+s,l=Math.max(...r.map(e=>ed(e).length),n.title?ed(n.title).length:0)+s,u=l+s,d=n.style.marginLeft>0?` `.repeat(n.style.marginLeft):``;if(n.style.marginTop>0&&i.push(``.repeat(n.style.marginTop)),n.title){let e=a?a(n.title):n.title,t=o.h.repeat(Math.floor((l-ed(n.title).length)/2)),r=o.h.repeat(l-ed(n.title).length-ed(t).length+s);i.push(`${d}${o.tl}${t}${e}${r}${o.tr}`)}else i.push(`${d}${o.tl}${o.h.repeat(u)}${o.tr}`);let f=n.style.valign===`center`?Math.floor((c-r.length)/2):n.style.valign===`top`?c-r.length-s:c-r.length;for(let e=0;e<c;e++)if(e<f||e>=f+r.length)i.push(`${d}${o.v}${` `.repeat(u)}${o.v}`);else{let t=r[e-f],n=` `.repeat(s),a=` `.repeat(l-ed(t).length);i.push(`${d}${o.v}${n}${t}${a}${o.v}`)}return i.push(`${d}${o.bl}${o.h.repeat(u)}${o.br}`),n.style.marginBottom>0&&i.push(``.repeat(n.style.marginBottom)),i.join(`
|
|
157
|
-
`)}const id=Object.create(null),ad=e=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?id:globalThis),od=new Proxy(id,{get(e,t){return ad()[t]??id[t]},has(e,t){return t in ad()||t in id},set(e,t,n){let r=ad(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=ad(!0);return delete n[t],!0},ownKeys(){let e=ad(!0);return Object.keys(e)}}),sd=typeof process<`u`&&process.env&&process.env.NODE_ENV||``,cd=[[`APPVEYOR`],[`AWS_AMPLIFY`,`AWS_APP_ID`,{ci:!0}],[`AZURE_PIPELINES`,`SYSTEM_TEAMFOUNDATIONCOLLECTIONURI`],[`AZURE_STATIC`,`INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN`],[`APPCIRCLE`,`AC_APPCIRCLE`],[`BAMBOO`,`bamboo_planKey`],[`BITBUCKET`,`BITBUCKET_COMMIT`],[`BITRISE`,`BITRISE_IO`],[`BUDDY`,`BUDDY_WORKSPACE_ID`],[`BUILDKITE`],[`CIRCLE`,`CIRCLECI`],[`CIRRUS`,`CIRRUS_CI`],[`CLOUDFLARE_PAGES`,`CF_PAGES`,{ci:!0}],[`CODEBUILD`,`CODEBUILD_BUILD_ARN`],[`CODEFRESH`,`CF_BUILD_ID`],[`DRONE`],[`DRONE`,`DRONE_BUILD_EVENT`],[`DSARI`],[`GITHUB_ACTIONS`],[`GITLAB`,`GITLAB_CI`],[`GITLAB`,`CI_MERGE_REQUEST_ID`],[`GOCD`,`GO_PIPELINE_LABEL`],[`LAYERCI`],[`HUDSON`,`HUDSON_URL`],[`JENKINS`,`JENKINS_URL`],[`MAGNUM`],[`NETLIFY`],[`NETLIFY`,`NETLIFY_LOCAL`,{ci:!1}],[`NEVERCODE`],[`RENDER`],[`SAIL`,`SAILCI`],[`SEMAPHORE`],[`SCREWDRIVER`],[`SHIPPABLE`],[`SOLANO`,`TDDIUM`],[`STRIDER`],[`TEAMCITY`,`TEAMCITY_VERSION`],[`TRAVIS`],[`VERCEL`,`NOW_BUILDER`],[`VERCEL`,`VERCEL`,{ci:!1}],[`VERCEL`,`VERCEL_ENV`,{ci:!1}],[`APPCENTER`,`APPCENTER_BUILD_ID`],[`CODESANDBOX`,`CODESANDBOX_SSE`,{ci:!1}],[`CODESANDBOX`,`CODESANDBOX_HOST`,{ci:!1}],[`STACKBLITZ`],[`STORMKIT`],[`CLEAVR`],[`ZEABUR`],[`CODESPHERE`,`CODESPHERE_APP_ID`,{ci:!0}],[`RAILWAY`,`RAILWAY_PROJECT_ID`],[`RAILWAY`,`RAILWAY_SERVICE_ID`],[`DENO-DEPLOY`,`DENO_DEPLOYMENT_ID`],[`FIREBASE_APP_HOSTING`,`FIREBASE_APP_HOSTING`,{ci:!0}]];function ld(){if(globalThis.process?.env)for(let e of cd){let t=e[1]||e[0];if(globalThis.process?.env[t])return{name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL===`/bin/jsh`&&globalThis.process?.versions?.webcontainer?{name:`stackblitz`,ci:!1}:{name:``,ci:!1}}const ud=ld();ud.name;function dd(e){return e?e!==`false`:!1}const fd=globalThis.process?.platform||``,pd=dd(od.CI)||ud.ci!==!1,md=dd(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),hd=dd(od.DEBUG),gd=sd===`test`||dd(od.TEST);od.MINIMAL;const _d=/^win/i.test(fd);!dd(od.NO_COLOR)&&(dd(od.FORCE_COLOR)||(md||_d)&&od.TERM);const vd=(globalThis.process?.versions?.node||``).replace(/^v/,``)||null;Number(vd?.split(`.`)[0]);const yd=globalThis.process||Object.create(null),bd={versions:{}};new Proxy(yd,{get(e,t){if(t===`env`)return od;if(t in e)return e[t];if(t in bd)return bd[t]}});const xd=globalThis.process?.release?.name===`node`,Sd=!!globalThis.Bun||!!globalThis.process?.versions?.bun,Cd=!!globalThis.Deno,wd=!!globalThis.fastly,Td=!!globalThis.Netlify,Ed=!!globalThis.EdgeRuntime,Dd=globalThis.navigator?.userAgent===`Cloudflare-Workers`,Od=[[Td,`netlify`],[Ed,`edge-light`],[Dd,`workerd`],[wd,`fastly`],[Cd,`deno`],[Sd,`bun`],[xd,`node`]];function kd(){let e=Od.find(e=>e[0]);if(e)return{name:e[1]}}kd()?.name;function Ad({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}const jd=Ad();function Md(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(jd,``)}function Nd(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function Pd(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Fd(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101631&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129673||e>=129679&&e<=129734||e>=129742&&e<=129756||e>=129759&&e<=129769||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function Id(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Ld(e,{ambiguousAsWide:t=!1}={}){return Id(e),Pd(e)||Fd(e)||t&&Nd(e)?2:1}const Rd=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,zd=globalThis.Intl?.Segmenter?new Intl.Segmenter:{segment:e=>e.split(``)},Bd=/^\p{Default_Ignorable_Code_Point}$/u;function Vd(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=Md(e)),e.length===0)return 0;let i=0,a={ambiguousAsWide:!n};for(let{segment:t}of zd.segment(e)){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159)&&!(e>=8203&&e<=8207||e===65279)&&!(e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071)&&!(e>=55296&&e<=57343)&&!(e>=65024&&e<=65039)&&!Bd.test(t)){if(Rd().test(t)){i+=2;continue}i+=Ld(e,a)}}return i}function Hd(){let{env:e}=C,{TERM:t,TERM_PROGRAM:n}=e;return C.platform===`win32`?!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask===`{cmd::Cmder}`||n===`Terminus-Sublime`||n===`vscode`||t===`xterm-256color`||t===`alacritty`||t===`rxvt-unicode`||t===`rxvt-unicode-256color`||e.TERMINAL_EMULATOR===`JetBrains-JediTerm`:t!==`linux`}const Ud={info:`cyan`,fail:`red`,success:`green`,ready:`green`,start:`magenta`},Wd={0:`red`,1:`yellow`},Gd=Hd(),Kd=(e,t)=>Gd?e:t,qd={error:Kd(`✖`,`×`),fatal:Kd(`✖`,`×`),ready:Kd(`✔`,`√`),warn:Kd(`⚠`,`‼`),info:Kd(`ℹ`,`i`),success:Kd(`✔`,`√`),debug:Kd(`⚙`,`D`),trace:Kd(`→`,`→`),fail:Kd(`✖`,`×`),start:Kd(`◐`,`o`),log:``};function Jd(e){return typeof Intl!=`object`||!Intl.Segmenter?ed(e).length:Vd(e)}var Yd=class extends Fu{formatStack(e,t,n){let r=` `.repeat((n?.errorLevel||0)+1);return`
|
|
158
|
-
${r}`+Mu(e,t).map(e=>` `+e.replace(/^at +/,e=>Zu.gray(e)).replace(/\((.+)\)/,(e,t)=>`(${Zu.cyan(t)})`)).join(`
|
|
159
|
-
${r}`)}formatType(e,t,n){let r=Ud[e.type]||Wd[e.level]||`gray`;if(t)return Qd(r)(Zu.black(` ${e.type.toUpperCase()} `));let i=typeof qd[e.type]==`string`?qd[e.type]:e.icon||e.type;return i?Zd(r)(i):``}formatLogObj(e,t){let[n,...r]=this.formatArgs(e.args,t).split(`
|
|
160
|
-
`);if(e.type===`box`)return rd(Xd(n+(r.length>0?`
|
|
161
|
-
`+r.join(`
|
|
162
|
-
`):``)),{title:e.title?Xd(e.title):void 0,style:e.style});let i=this.formatDate(e.date,t),a=i&&Zu.gray(i),o=e.badge??e.level<2,s=this.formatType(e,o,t),c=e.tag?Zu.gray(e.tag):``,l,u=this.filterAndJoin([s,Xd(n)]),d=this.filterAndJoin(t.columns?[c,a]:[c]),f=(t.columns||0)-Jd(u)-Jd(d)-2;if(l=f>0&&(t.columns||0)>=80?u+` `.repeat(f)+d:(d?`${Zu.gray(`[${d}]`)} `:``)+u,l+=Xd(r.length>0?`
|
|
163
|
-
`+r.join(`
|
|
164
|
-
`):``),e.type===`trace`){let t=/* @__PURE__ */ Error(`Trace: `+e.message);l+=this.formatStack(t.stack||``,t.message)}return o?`
|
|
165
|
-
`+l+`
|
|
166
|
-
`:l}};function Xd(e){return e.replace(/`([^`]+)`/gm,(e,t)=>Zu.cyan(t)).replace(/\s+_([^_]+)_\s+/gm,(e,t)=>` ${Zu.underline(t)} `)}function Zd(e=`white`){return Zu[e]||Zu.white}function Qd(e=`bgWhite`){return Zu[`bg${e[0].toUpperCase()}${e.slice(1)}`]||Zu.bgWhite}function $d(e={}){let t=ef();return process.env.CONSOLA_LEVEL&&(t=Number.parseInt(process.env.CONSOLA_LEVEL)??t),ju({level:t,defaults:{level:t},stdout:process.stdout,stderr:process.stderr,prompt:(...e)=>import(`./prompt-uaCPq0_A-BW0EkzOD.mjs`).then(t=>t.prompt(...e)),reporters:e.reporters||[e.fancy??!(pd||gd)?new Yd:new Fu],...e})}function ef(){return hd?Z.debug:gd?Z.warn:Z.info}$d(),process.env.ROLLDOWN_TEST?tf():$d({formatOptions:{date:!1}});function tf(){let e=[`silent`,`fatal`,`error`,`warn`,`log`,`info`,`success`,`fail`,`ready`,`start`,`box`,`debug`,`trace`,`verbose`],t=Object.create(null);for(let n of e)t[n]=(...e)=>console.log(...e);return t}xc();function nf(e){return e&&(e.include=Oc(e.include),e.exclude=Oc(e.exclude)),Ec(new Tc(`builtin:vite-react-refresh-wrapper`,e))}var rf=/* @__PURE__ */ yc(xc(),1);typeof process==`object`&&process.versions?.pnp,typeof process==`object`&&process.versions?.pnp,rf.TsconfigCache;var af=/* @__PURE__ */ yc(xc(),1);af.BindingRebuildStrategy,af.ResolverFactory,af.getNativeMemoryStats,af.isolatedDeclaration,af.isolatedDeclarationSync,af.moduleRunnerTransform,af.resetNativeMemoryStats;const of=/\.[cm]?[jt]sx?$/,sf=[/node_modules/,/\/dist\//];function cf(){return[{name:`rari:react-refresh-runtime`,enforce:`pre`,apply:`serve`,resolveId(e){return e===`/@react-refresh`?e:null},load(e){return e===`/@react-refresh`?`/* global window */
|
|
87
|
+
);`}function Il(e,t){let n=[],r=/* @__PURE__ */ new Set;e.namespaceBinding!=null&&(r.add(`createClientModuleProxy`),n.push(Pl(e.namespaceBinding,t))),e.defaultBinding!=null&&(r.add(`registerClientReference`),n.push(Fl(e.defaultBinding,t,`default`)));for(let i of e.named)i.typeOnly||(r.add(`registerClientReference`),n.push(Fl(i.local,t,i.imported)));return n.length===0?{code:``,helpers:[]}:{code:n.join(`
|
|
88
|
+
`),helpers:[...r]}}const Ll=/(?:^|[\n\r;])\s*import\s*\{[^}]*\bregisterServerReference\b[^}]*\}\s*from\s*["'][^"'\n]+["']/;function Rl(e){return Ll.test(e)}const zl=/* @__PURE__ */ new Set(/* @__PURE__ */ `undefined.NaN.Infinity.arguments.Object.Array.String.Number.Boolean.Symbol.BigInt.Math.Date.JSON.Promise.Error.TypeError.RangeError.Map.Set.WeakMap.WeakSet.RegExp.Proxy.Reflect.Function.console.fetch.process.Buffer.globalThis.global.window.document.navigator.location.crypto.TextEncoder.TextDecoder.URL.URLSearchParams.FormData.Headers.Request.Response.AbortController.AbortSignal.setTimeout.clearTimeout.setInterval.clearInterval.queueMicrotask.structuredClone.atob.btoa.React.jsx.jsxs.Fragment`.split(`.`)),Bl=/* @__PURE__ */ new Set(/* @__PURE__ */ `await.return.throw.if.else.for.while.do.switch.case.break.continue.new.typeof.instanceof.void.delete.yield.class.extends.super.this.try.catch.finally.with.debugger.default.of.in.from.as.import.export.async.function.const.let.var.true.false.null.static.get.set.typeof`.split(`.`));function Vl(e){return e>=97&&e<=122||e>=65&&e<=90||e===95||e===36}function Hl(e){return Vl(e)||e>=48&&e<=57}function Y(e,t){let n=e.length;for(;t<n;){let r=Ul(e,t,n);if(r==null)break;t=r}return t}function Ul(e,t,n){let r=e.charCodeAt(t);if(r===32||r===9||r===10||r===13||r===65279)return t+1;if(r===47&&e.charCodeAt(t+1)===47){let r=t+2;for(;r<n&&e.charCodeAt(r)!==10&&e.charCodeAt(r)!==13;)r++;return r}if(r===47&&e.charCodeAt(t+1)===42){let r=t+2;for(;r<n-1&&(e.charCodeAt(r)!==42||e.charCodeAt(r+1)!==47);)r++;return r+2}return null}function Wl(e,t,n){t++;let r=e.length;for(;t<r;){let r=e.charCodeAt(t);if(r===92){t+=2;continue}if(r===n)return t+1;t++}return t}function Gl(e,t,n,r){let i=t,a=0,o=e.length;for(;i<o;){let t=V(e,i,o);if(t!==-1){i=t;continue}let s=e.charCodeAt(i);if(s===n)a++;else if(s===r&&(a--,a===0))return i+1;i++}return i}function Kl(e,t,n){for(let r=0;r<n.length;r++)if(e.charCodeAt(t+r)!==n.charCodeAt(r))return!1;return!0}function ql(e,t,n){let r=Y(e,t+1);if(r>=n)return!1;let i=e.charCodeAt(r);if(i!==39&&i!==34)return!1;let a=r+1,o=Wl(e,r,i);return o-1-a!=10||!Kl(e,a,`use server`)?!1:Jl(e,o,n)}function Jl(e,t,n){let r=t;for(;r<n;){let t=e.charCodeAt(r);if(t===32||t===9){r++;continue}return t===59||t===10||t===13||t===47&&e.charCodeAt(r+1)===47||t===47&&e.charCodeAt(r+1)===42}return!0}function Yl(e,t,n){let r=Y(e,t+1),i=e.charCodeAt(r);return i!==39&&i!==34?e.slice(t+1,n):(r=Y(e,Wl(e,r,i)),e.charCodeAt(r)===59&&r++,r=Y(e,r),e.slice(r,n))}function X(e,t){if(!Vl(e.charCodeAt(t)))return null;let n=t+1;for(;n<e.length&&Hl(e.charCodeAt(n));)n++;return{name:e.slice(t,n),end:n}}function Xl(e,t,n){if(!Kl(e,t,n))return!1;let r=t>0?e.charCodeAt(t-1):-1,i=t+n.length<e.length?e.charCodeAt(t+n.length):-1;return!(r!==-1&&Hl(r)||i!==-1&&Hl(i))}function Zl(e,t,n){return e===0&&t===0&&n===0}function Ql(e,t){return e===40?(t.paren++,null):e===41?(t.paren=Math.max(0,t.paren-1),null):e===123?(t.brace++,null):e===125?Zl(t.paren,t.brace,t.bracket)?-1:(t.brace=Math.max(0,t.brace-1),null):e===91?(t.bracket++,null):e===93?Zl(t.paren,t.brace,t.bracket)?-1:(t.bracket=Math.max(0,t.bracket-1),null):e===44&&Zl(t.paren,t.brace,t.bracket)?-1:null}function $l(e,t,n){let r=Y(e,t+1),i={paren:0,brace:0,bracket:0};for(;r<n;){let t=V(e,r,n);if(t!==-1){r=t;continue}if(Ql(e.charCodeAt(r),i)===-1)return r;r++}return r}function eu(e,t,n,r,i){let a=X(e,t);if(a==null)return t+1;let o=Y(e,a.end);if(n===123&&e.charCodeAt(o)===58)return o+1;i.add(a.name);let s=a.end,c=Y(e,s);return e.charCodeAt(c)===61&&(s=$l(e,c,r-1)),s}function tu(e,t,n){let r=e.charCodeAt(t),i=Gl(e,t,r,r===123?125:93),a=t+1;for(;a<i-1&&(a=Y(e,a),!(a>=i-1));){let t=e.charCodeAt(a);if(t===123||t===91){a=tu(e,a,n);continue}if(t===46&&e.charCodeAt(a+1)===46&&e.charCodeAt(a+2)===46){a=nu(e,a,n);continue}a=eu(e,a,r,i,n)}return i}function nu(e,t,n){t+=3,t=Y(e,t);let r=X(e,t);return r?(n.add(r.name),r.end):t}function ru(e){let t=/* @__PURE__ */ new Set,n=0,r=e.length;for(;n<r&&(n=Y(e,n),!(n>=r));){let r=e.charCodeAt(n);if(r===123||r===91){n=tu(e,n,t);continue}if(r===46&&e.charCodeAt(n+1)===46&&e.charCodeAt(n+2)===46){n=nu(e,n,t);continue}let i=X(e,n);if(i){t.add(i.name),n=i.end;continue}n++}return t}function iu(e){let t=/* @__PURE__ */ new Set;for(let n of e.matchAll(/\b(?:const|let|var|function|class|async\s+function)\s+([A-Za-z_$][\w$]*)/g))t.add(n[1]);return t}function au(e,t){for(let n of e.split(`,`)){let e=n.trim();if(!e||e.startsWith(`type `))continue;let r=(e.split(/\s+as\s+/).at(-1)??``).trim();r&&t.add(r)}}function ou(e){let t=/* @__PURE__ */ new Set;for(let n of e.matchAll(/\b(?:import|export)\s+(?:type\s+)?(?:\{([^}]+)\}|(\*\s+as\s+[A-Za-z_$][\w$]*)|([A-Za-z_$][\w$]*))/g)){if(n[1]&&au(n[1],t),n[2]){let e=/as\s+([A-Za-z_$][\w$]*)/.exec(n[2]);e&&t.add(e[1])}n[3]&&n[3]!==`type`&&n[3]!==`async`&&n[3]!==`function`&&n[3]!==`class`&&t.add(n[3])}for(let n of e.matchAll(/(?:^|\n)\s*(?:export\s+)?(?:async\s+)?(?:function|class|const|let|var)\s+([A-Za-z_$][\w$]*)/g))t.add(n[1]);return t}function su(e,t){return t<=0||e.charCodeAt(t-1)!==46?!1:t<2||e.charCodeAt(t-2)!==46}function cu(e,t,n,r,i){let a=t;for(;a<n;){let t=V(e,a,n);if(t!==-1){a=t;continue}if(!Vl(e.charCodeAt(a))){a++;continue}let o=X(e,a);if(o==null){a++;continue}if(su(e,a)){a=o.end;continue}if(gu(e,a,o.end)){a=o.end;continue}r.has(o.name)||i.add(o.name),a=o.end}}function lu(e,t,n){let r=0,i=e.length;for(;r<i;){let a=V(e,r,i);if(a!==-1){r=a;continue}if(e.charCodeAt(r)===61){let a=e.charCodeAt(r+1);if(a===62||a===61){r++;continue}let o=$l(e,r,i);cu(e,r+1,o,t,n),r=o;continue}r++}}function uu(e,t,n,r){let i=/* @__PURE__ */ new Set([...ru(t),...iu(e),...n,...zl,...Bl]);r!=null&&r!==``&&i.add(r);let a=/* @__PURE__ */ new Set;return cu(e,0,e.length,i,a),lu(t,i,a),[...a]}function du(e,t,n){if(t===n)return e;let r=``,i=0,a=0,o=e.length;for(;i<o;){let s=V(e,i,o);if(s!==-1){i=s;continue}if(!Vl(e.charCodeAt(i))){i++;continue}let c=X(e,i);if(c==null){i++;continue}c.name===t&&!su(e,i)&&!gu(e,i,c.end)&&(r+=e.slice(a,i)+n,a=c.end),i=c.end}return r+e.slice(a)}function fu(e){return e===32||e===9||e===10||e===13||e===65279}function pu(e,t){if(t<2||e.charCodeAt(t-1)!==47||e.charCodeAt(t-2)!==42)return null;let n=-1,r=t-3;for(;r>=0;){let t=e.charCodeAt(r),i=e.charCodeAt(r+1);if(t===47&&i===42){n=r,r--;continue}if(t===42&&i===47){if(r>0&&e.charCodeAt(r-1)===47){r--;continue}break}r--}return n>=0?n:null}function Z(e,t){for(;t>0;){if(fu(e.charCodeAt(t-1))){t--;continue}let n=pu(e,t);if(n==null)break;t=n}return t}function Q(e,t,n){let r=t-n.length;return r<0||!Xl(e,r,n)?null:r}const mu=/* @__PURE__ */ new Set([40,91,44,61,58,63,46,43,45,42,47,37,38,124,94,33,126,60,62]);function hu(e,t){let n=Z(e,t);if(n<=0)return!0;let r=Q(e,n,`default`);if(r!=null)return Q(e,Z(e,r),`export`)!=null;if(Q(e,n,`export`)!=null)return!0;let i=e.charCodeAt(n-1);if(i===59||i===125)return!0;if(i===123){let t=Z(e,n-1);return t<=0||e.charCodeAt(t-1)!==61}let a=!1;for(let r=n;r<t;r++){let t=e.charCodeAt(r);if(t===10||t===13){a=!0;break}}return a?!mu.has(i):!1}function gu(e,t,n){let r=Y(e,n);if(e.charCodeAt(r)!==58)return!1;let i=Z(e,t);if(i===0)return!1;let a=e.charCodeAt(i-1);return a===123||a===44}function _u(e,t,n){if(t<=0||e.charCodeAt(t-1)!==61)return null;let r=Z(e,t-1),i=r;for(;i>0&&Hl(e.charCodeAt(i-1));)i--;if(i>=r||!Vl(e.charCodeAt(i)))return null;let a=e.slice(i,r),o=Z(e,i),s=Q(e,o,`const`)??Q(e,o,`let`)??Q(e,o,`var`);return s==null?null:Q(e,Z(e,s),`export`)==null?{start:n,exportKind:null,bindingName:a}:{start:n,exportKind:`named`,bindingName:a}}function vu(e,t){let n=Z(e,t),r=Q(e,n,`default`);if(r!=null){n=Z(e,r);let t=Q(e,n,`export`);if(t!=null)return{start:t,exportKind:`default`,bindingName:null}}let i=_u(e,n,t);if(i!=null)return i;let a=Q(e,n,`export`);return a==null?{start:t,exportKind:null,bindingName:null}:{start:a,exportKind:`named`,bindingName:null}}function yu(e,t,n,r){if(!Xl(e,n,`function`))return null;n=Y(e,n+8),e.charCodeAt(n)===42&&(n=Y(e,n+1));let i=null,a=X(e,n);if(a&&(i=a.name,n=Y(e,a.end)),e.charCodeAt(n)!==40)return{action:null,nextI:t+1};let o=Gl(e,n,40,41),s=e.slice(n+1,o-1);if(n=Y(e,o),e.charCodeAt(n)!==123)return{action:null,nextI:t+1};let c=Gl(e,n,123,125)-1;if(!ql(e,n,c))return{action:null,nextI:n+1};let l=i!=null&&hu(e,t);return{action:{start:t,end:c+1,bodyOpen:n,bodyClose:c,paramsRaw:s,isAsync:r,name:i,kind:l?`declaration`:`expression`},nextI:c+1}}function bu(e,t,n,r){let i,a;if(e.charCodeAt(n)===40)i=Gl(e,n,40,41),a=e.slice(n+1,i-1);else{let t=X(e,n);if(t==null)return null;i=t.end,a=t.name}let o=Y(e,i);if(e.charCodeAt(o)!==61||e.charCodeAt(o+1)!==62||(o=Y(e,o+2),e.charCodeAt(o)!==123))return null;let s=Gl(e,o,123,125)-1;return ql(e,o,s)?{action:{start:t,end:s+1,bodyOpen:o,bodyClose:s,paramsRaw:a,isAsync:r,name:null,kind:`arrow`},nextI:s+1}:{action:null,nextI:o+1}}function xu(e,t,n){if(!Xl(e,t,`async`)&&!Xl(e,t,`function`))return null;let r=t,i=t,a=!1;Xl(e,i,`async`)&&(a=!0,i=Y(e,i+5));let o=yu(e,r,i,a);if(o!=null)return o.action!=null&&n.push(o.action),o.nextI;if(!a)return null;let s=bu(e,r,i,!0);return s==null?null:(s.action!=null&&n.push(s.action),s.nextI)}function Su(e,t,n){let r=e.charCodeAt(t);if(r===39||r===34||r===96)return Wl(e,t,r);if(r===47&&(e.charCodeAt(t+1)===47||e.charCodeAt(t+1)===42))return Y(e,t);let i=xu(e,t,n);if(i!=null)return i;let a=bu(e,t,t,!1);return a==null?t+1:(a.action!=null&&n.push(a.action),a.nextI)}function Cu(e){let t=[],n=e.length,r=0;for(;r<n;)r=Su(e,r,t);return t}function wu(e,t,n,r,i){return r==="default"?{rewrittenExport:`default`,replacement:`export default registerServerReference(${t}, ${JSON.stringify(n)}, "default")`}:r===`named`&&e.name!=null&&e.kind===`declaration`?{rewrittenExport:e.name,replacement:`export const ${e.name} = registerServerReference(${t}, ${JSON.stringify(n)}, ${JSON.stringify(e.name)})`}:r===`named`&&i!=null?{rewrittenExport:i,replacement:`registerServerReference(${t}, ${JSON.stringify(n)}, ${JSON.stringify(i)})`}:e.kind===`declaration`&&e.name!=null?{replacement:`const ${e.name} = ${t}`,rewrittenExport:null}:{replacement:t,rewrittenExport:null}}function Tu(e,t,n,r,i,a,o,s){if(s==null){e.unshift(`${n}function ${r}(${i}) {\n${a}\n}`,`registerServerReference(${r}, ${JSON.stringify(o)}, ${JSON.stringify(r)});`);return}e.unshift(`${n}function ${r}(${i}) {\n${a}\n}`),t.unshift(s)}function Eu(e,t){let n=Cu(e);if(n.length===0)return null;let r=ou(e),i=[],a=[],o=e,s=[],c=!1,l=[...n].sort((e,t)=>t.start-e.start),u=n.length-1;for(let e of l){let n=e.name??`anonymous_server_function`,l=`$$ACTION_${u}_${n.replace(/\W/g,`_`)}`;u--,i.unshift(l);let d=Yl(o,e.bodyOpen,e.bodyClose),f=e.kind===`expression`&&e.name!=null?e.name:null,p=uu(d,e.paramsRaw,r,f),m=f==null?d:du(d,f,l),h=[...p,e.paramsRaw.trim()].filter(e=>e!==``).join(`, `),g=e.isAsync?`async `:``,_=p.length>0?`${l}.bind(null, ${p.join(`, `)})`:l,{start:v,exportKind:y,bindingName:ee}=vu(o,e.start),{replacement:te,rewrittenExport:ne}=wu(e,_,t,y,ee);Tu(s,a,g,l,h,m,t,ne),c=!0,o=o.slice(0,v)+te+o.slice(e.end)}let d=c?`import { registerServerReference } from ${JSON.stringify(`react-server-dom-rari/server`)};\n`:``;return{code:`${c&&!Rl(o)?d:``}${o}\n\n${s.join(`
|
|
89
|
+
`)}\n`,actionNames:i,rewrittenExportNames:a}}const Du=/import\s+(\w+)\s+from\s+['"]([^'"]+)['"]/g,Ou=/import\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g,ku=/import\s+(\w+)\s*,\s*\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g,Au=/defineMdxComponents\s*\(\s*\{([\s\S]*?)\}\s*\)/;function ju(e,t,n){for(let r of t.split(`,`)){let t=r.trim();if(!t||(t=t.replace(/^type\s+/i,``).trim(),!t))continue;let i=t.split(/\s+as\s+/i),a=(i[1]??i[0]).trim();a&&n.set(a,e)}}function Mu(e){let t=/* @__PURE__ */ new Map;for(let n of e.matchAll(ku))t.set(n[1],n[3]),ju(n[3],n[2],t);for(let n of e.matchAll(Du))t.set(n[1],n[2]);for(let n of e.matchAll(Ou))ju(n[2],n[1],t);return t}function Nu(e){let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`:`);if(r===-1){t.push({name:e,binding:e});continue}let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();i&&a&&t.push({name:i,binding:a})}return t}function Pu(e){try{return z(E.readFileSync(e,`utf-8`)).topLevelUseClient}catch{return!1}}function Fu(e){let{code:t,id:n,projectRoot:r,resolvedAlias:i}=e;if(!t.includes(`defineMdxComponents`)||t.includes(`__RARI_MDX_RESOLVED__`))return null;let a=Au.exec(t);if(!a)return null;let o=Mu(t),s=Nu(a[1]);if(s.length===0)return null;let c=`defineMdxComponents(/* __RARI_MDX_RESOLVED__ */[\n${s.map(({name:e,binding:t})=>{let a=o.get(t);if(a==null||a===``)throw Error(`[rari/mdx] Could not resolve import for MDX component "${e}" (binding "${t}") in ${n}`);let s=fe(a,n,i),c=Wt(s,r),l=Pu(s);return` { name: ${JSON.stringify(e)}, component: ${t}, id: ${JSON.stringify(c)}, client: ${l} }`}).join(`,
|
|
90
|
+
`)},\n])`;return t.replace(Au,c)}const Iu=/forwardRef|memo|\b(?:[A-Z]|use[A-Z0-9])/,Lu=/\.[cm]?[jt]sx?$/,Ru=/['"]use memo['"]/;function zu(e){return{...e===!0?{}:e,target:`19`}}function Bu(e,t){return t.compilationMode===`annotation`?Ru.test(e):Iu.test(e)}function Vu(e){if(e.startsWith(`\0`)||e.includes(`virtual:`))return!1;let t=oe(e);return/\.d\.[cm]?ts$/.test(t)||t.includes(`/dist/`)?!1:Lu.test(t)&&!t.includes(`/node_modules/`)}const Hu=/\.[jt]sx$/;function Uu(e,t=`app`){let n=zu(e),r,i=!0,a=!1,o=!1,c=async e=>{if(r)return r;try{return r=await import(`oxc-transform-react`),r}catch(t){let n=s(t);return e(`React Compiler requires the optional \`oxc-transform-react\` package. Install it before enabling \`rari({ compiler: true })\`.${n==null?``:`\n${n.message}`}`)}};return{name:t===`library`?`rari:react-compiler-library`:`rari:react-compiler`,enforce:`pre`,async config(e,{command:n}){return await c(e=>this.error(e)),t===`library`?(o=!1,a=!1,{}):(o=n===`serve`,{oxc:{jsx:{refresh:!1}},optimizeDeps:{include:[`react/compiler-runtime`]}})},configResolved(e){if(t===`library`){i=e.build.sourcemap!==!1,a=!1,o=!1;return}i=e.command!==`build`||e.build.sourcemap!==!1,a=!e.isProduction,o=!e.isProduction&&e.command===`serve`&&e.server.hmr!==!1},async transform(e,s){if(!Vu(s))return null;let l=oe(s);if(t===`library`&&!Hu.test(l)||Wn(e)||t===`app`&&this.environment.config.consumer===`server`)return null;let{transform:u}=r??await c(e=>this.error(e)),d=Bu(e,n),f=await u(l,e,{jsx:{runtime:`automatic`,development:a,importSource:`react`,refresh:o},reactCompiler:d?n:!1,sourcemap:i}),p=f.errors.map(e=>{let t=e.codeframe;return t!=null&&t!==``?`${e.message}\n${t}`:e.message});if(f.fatal){let e=p.join(`
|
|
91
|
+
|
|
92
|
+
`);this.error(e===``?`React Compiler transform failed.`:e)}for(let e of p)this.warn(e);return{code:f.code,map:f.map}}}}const Wu=/\.[cm]?[jt]sx?$/,Gu=[/node_modules/,/\/dist\//];function Ku(){return[{name:`rari:react-refresh-runtime`,enforce:`pre`,apply:`serve`,resolveId(e){return e===`/@react-refresh`?e:null},load(e){return e===`/@react-refresh`?`/* global window */
|
|
167
93
|
/* eslint-disable eqeqeq, prefer-const, @typescript-eslint/no-empty-function */
|
|
168
94
|
|
|
169
95
|
/*! Copyright (c) Meta Platforms, Inc. and affiliates. **/
|
|
@@ -849,88 +775,108 @@ export const __hmr_import = (module) => import(/* @vite-ignore */ module)
|
|
|
849
775
|
|
|
850
776
|
// For backwards compatibility with @vitejs/plugin-react.
|
|
851
777
|
export default { injectIntoGlobalHook }
|
|
852
|
-
`:null}},{name:`rari:react-refresh-wrapper`,apply:`serve`,applyToEnvironment(e){return e.config.consumer===`client`&&
|
|
778
|
+
`:null}},{name:`rari:react-refresh-wrapper`,apply:`serve`,applyToEnvironment(e){return e.config.consumer===`client`&&Pe({cwd:process.cwd(),include:[Wu],exclude:Gu,jsxImportSource:`react`,reactRefreshHost:``})}}]}let qu;async function Ju(){return qu??=(async()=>{try{let e=await import(`@rari/use-cache`);e.requireNativeAddon();let t=e.transformUseCacheModule;if(typeof t!=`function`)throw TypeError("`@rari/use-cache` did not export transformUseCacheModule");return t}catch(e){let t=e instanceof Error&&e.message!==``?` ${e.message}`:``;throw Error(`\`experimental.useCache\` / \`experimental.useCacheRemote\` requires a working \`@rari/use-cache\` native addon. Install the optional platform package, or run \`just build-addon-dev\` in the monorepo.${t}`)}})(),qu}async function Yu(e){let t=await import(
|
|
853
779
|
/* @vite-ignore */
|
|
854
|
-
e);return
|
|
780
|
+
e);return u(t)?t:{}}function Xu(e,t){e&&(e.notFound&&(t.notFound=!0),e.redirect!=null&&(t.redirect=typeof e.redirect==`string`?e.redirect:e.redirect.destination),e.revalidate!==void 0&&(t.revalidate=e.revalidate),e.props&&(t.props={...t.props,...e.props}))}async function Zu(t,n){try{Xu(await t(),n)}catch(t){if(e(t)){n.notFound=!0;return}throw t}}async function Qu(e,t,n,r){let i=e.getData;typeof i==`function`&&await Zu(async()=>i({params:t,searchParams:n}),r)}async function $u(e,t,n,r){let i=e.getServerSideProps;typeof i==`function`&&await Zu(async()=>i({params:t,searchParams:n}),r)}async function ed(e,t,n){let r=e.getStaticProps;typeof r==`function`&&await Zu(async()=>r({params:t}),n)}
|
|
855
781
|
/* v8 ignore start - requires dynamic imports, better tested in integration/e2e */
|
|
856
|
-
async function
|
|
782
|
+
async function td(e,t,n){try{let r=await Yu(e),i={props:{}};return await Qu(r,t,n,i),await $u(r,t,n,i),await ed(r,t,i),i}catch(t){return console.error(`[rari] Router: Failed to extract server props from ${e}:`,t),{props:{}}}}
|
|
857
783
|
/* v8 ignore stop */
|
|
858
784
|
/* v8 ignore start - requires dynamic imports, better tested in integration/e2e */
|
|
859
|
-
async function
|
|
785
|
+
async function nd(e,t,n){try{let r=await Yu(e);if(typeof r.generateMetadata==`function`){let e=await r.generateMetadata({params:t,searchParams:n});if(u(e))return e}return u(r.metadata)?r.metadata:{}}catch(t){return console.error(`[rari] Router: Failed to extract metadata from ${e}:`,t),{}}}
|
|
860
786
|
/* v8 ignore start - requires dynamic imports, better tested in integration/e2e */
|
|
861
|
-
async function
|
|
787
|
+
async function rd(e){try{let t=await Ue(e);return t==null?[]:p(t)?t:(n(e),[])}catch(t){return console.error(`[rari] Router: Failed to extract static params from ${e}:`,t),[]}}
|
|
862
788
|
/* v8 ignore stop */
|
|
863
789
|
/* v8 ignore start - requires dynamic imports, better tested in integration/e2e */
|
|
864
|
-
async function
|
|
790
|
+
async function id(e){try{let t=await Yu(e);return!!(t.getData??t.getServerSideProps??t.getStaticProps??t.generateMetadata??t.generateStaticParams)}catch{return!1}}
|
|
865
791
|
/* v8 ignore stop */
|
|
866
|
-
const
|
|
792
|
+
const ad=/* @__PURE__ */ new Map;
|
|
867
793
|
/* v8 ignore start - depends on extractServerProps which requires dynamic imports */
|
|
868
|
-
async function
|
|
794
|
+
async function od(e,t,n,r=6e4){let i=`${e}:${JSON.stringify(t)}:${JSON.stringify(n)}`,a=ad.get(i);if(a&&Date.now()-a.timestamp<r)return a.result;let o=await td(e,t,n);return ad.set(i,{result:o,timestamp:Date.now()}),o}
|
|
869
795
|
/* v8 ignore stop */
|
|
870
|
-
function
|
|
796
|
+
function sd(){ad.clear()}
|
|
871
797
|
/* v8 ignore start - cache clearing logic, difficult to test without populating cache via dynamic imports */
|
|
872
|
-
function
|
|
798
|
+
function cd(e){for(let t of ad.keys())t.startsWith(e)&&ad.delete(t)}
|
|
873
799
|
/* v8 ignore stop */
|
|
874
|
-
const
|
|
800
|
+
const ld=/\.(?:js|mjs|cjs|ts|tsx|jsx|css|map|json|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|eot|txt|xml|html|wasm)$/i;async function ud(e,t){let n=[],r=0;for await(let i of e){let a=Uint8Array.from(Te.from(i));if(r+=a.byteLength,r>t)throw e.destroy(),Object.assign(/* @__PURE__ */ Error(`Request body too large`),{statusCode:413});n.push(a)}let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.byteLength;return new Blob([i])}function dd(e){let t=e.slice(e.lastIndexOf(`/`)+1);return ld.test(t)}function $(e,t){return e===t||e.startsWith(`${t}/`)}const fd=/import\s+type\s+(\{[^}]+\})\s+from\s+["']\.\.?\/([^"']+)["'];?/g,pd=/import\s+type\s+(\*\s+as\s+\w+)\s+from\s+["']\.\.?\/([^"']+)["'];?/g,md=/import\s+type\s+(\w+)\s+from\s+["']\.\.?\/([^"']+)["'];?/g,hd=/import\s+(\{[^}]+\})\s+from\s+["']\.\.?\/([^"']+)["'];?/g,gd=/import\s+(\*\s+as\s+\w+)\s+from\s+["']\.\.?\/([^"']+)["'];?/g,_d=/import\s+(\w+)\s+from\s+["']\.\.?\/([^"']+)["'];?/g,vd=/import\s+["']\.\.?\/([^"']+)["'];?/g,yd=/export\s+default\s+(?:async\s+)?function\s+(\w+)/,bd=/^['"]use client['"];?\s*$/gm,xd=/^[./@~#]/;function Sd(e,t){for(let n of Object.keys(t))if(e===n||e.startsWith(`${n}/`))return!0;return!1}function Cd(e){let t=r(e);return t===`ENOENT`||t===`ERR_PACKAGE_PATH_NOT_EXPORTED`||t===`ERR_MODULE_NOT_FOUND`}function wd(e){return e===`react`||e instanceof RegExp&&e.source===`^react$`&&e.flags===``}const Td=/import\s+\{[^}]*\}\s+from\s+['"]react['"]/,Ed=/import\s+[^,\s]+\s*,\s*\{[^}]*\}\s+from\s+['"]react['"]/,Dd=/import React(,\s*\{([^}]*)\})?\s+from\s+['"]react['"];?/,Od=/from(\s*)(['"])(?:\.\/vendor\/react-flight-client\/index|rari\/runtime\/vendor\/react-flight-client\/index)\.mjs\2/g,kd=/\bJSX\b/,Ad=/\{([^}]*)\}/,jd={remotePatterns:[],localPatterns:[],deviceSizes:g,imageSizes:m,formats:h,qualityAllowlist:_,minimumCacheTTL:60};function Md(e){return[{pathname:`/${C(e)}/**`}]}function Nd(e,t,n=!0){let r=[...e??[]];if(!n)return r;for(let e of Md(t))r.some(t=>t.pathname===e.pathname)||r.push({...e});return r}const Pd=/* @__PURE__ */ new Map;async function Fd(e){let t=Pd.get(e);if(t!=null&&t!==``)return t;let n=import.meta.url,i=A(n),a=O.dirname(i),o=[O.join(a,`runtime`,e),O.join(a,`../runtime`,e)];for(let t of o)try{let n=await E.promises.readFile(t,`utf-8`);return t.endsWith(`.ts`)&&(n=n.replace(fd,(e,t,n)=>`import type ${t} from "rari/${n}";`),n=n.replace(pd,(e,t,n)=>`import type ${t} from "rari/${n}";`),n=n.replace(md,(e,t,n)=>`import type ${t} from "rari/${n}";`),n=n.replace(hd,(e,t,n)=>`import ${t} from "rari/${n}";`),n=n.replace(gd,(e,t,n)=>`import ${t} from "rari/${n}";`),n=n.replace(_d,(e,t,n)=>`import ${t} from "rari/${n}";`),n=n.replace(vd,(e,t)=>`import "rari/${t}";`)),Pd.set(e,n),n}catch(e){let n=r(e);n!==`ENOENT`&&n!==`EISDIR`&&console.warn(`[rari] Unexpected error reading ${t}:`,e)}throw Error(`Could not find ${e}. Tried: ${o.join(`, `)}`)}const Id=O.dirname(A(import.meta.url)),Ld=O.dirname(Id);function Rd(){let e=O.join(Ld,`src`,`runtime`,`boundaries`,`error-boundary-wrapper.tsx`);if(E.existsSync(e))return O.resolve(e);try{let e=A(import.meta.resolve(`rari/runtime/ErrorBoundaryWrapper`));if(E.existsSync(e))return O.resolve(e)}catch{}return null}const zd=Rd();function Bd(e){let t=[O.join(Id,`runtime`,e),O.join(Id,`../runtime`,e)];for(let e of t)if(E.existsSync(e))return e;return null}function Vd(e){return e.startsWith(Ld)}async function Hd(){return Fd(`rsc-client-runtime.mjs`)}async function Ud(e,t,n=``){let r=(await Fd(`entry-client.mjs`)).replace(`/*! @preserve CLIENT_COMPONENT_IMPORTS_PLACEHOLDER */`,e).replace(`/*! @preserve CLIENT_COMPONENT_REGISTRATIONS_PLACEHOLDER */`,t);return n===``?r:`${n}\n${r}`}async function Wd(){return Fd(`rsc-references.mjs`)}async function Gd(e,t,n=`assets`,r){let a=O.join(e,`src`),{getBinaryPath:o}=await import(`./platform.mjs`),s=o(),l=De(s,[`scan-images`,`--src`,a],{encoding:`utf8`,cwd:e,shell:!1,timeout:6e4});if(l.error)throw Error(`Failed to scan for image usage: ${l.error.message}`);if(l.signal)throw Error(`Failed to scan for image usage: process terminated by signal ${l.signal}`);if(l.status!==0)throw Error(`Failed to scan for image usage: ${l.stderr||l.stdout||`exit code ${l.status}`}`);let u;try{u={images:i(l.stdout,`images`)??[]}}catch(e){let t=e instanceof SyntaxError?e.message:c(e,String(e)),n=(l.stdout||l.stderr||`(empty)`).slice(0,500);throw Error(`Failed to parse image scanner output as JSON: ${t}. Scanner output: ${n}`,{cause:e})}let d=C(n),f=(()=>{let n=r??t.serverBuild?.clientOutDir??t.serverBuild?.outDir;return n!=null&&n!==``?O.isAbsolute(n)?n:O.resolve(e,n):O.join(e,`dist`,`client`)})(),p=O.basename(f)===`client`?O.dirname(f):f,m=w(O.relative(e,f))||`dist/client`,h={...jd,...t.images,assetsDir:d,outDir:m,localPatterns:Nd(t.images?.localPatterns,d,t.images?.includeBundledAssets!==!1),preoptimizeManifest:u.images},g=O.join(p,`server`);E.existsSync(g)||E.mkdirSync(g,{recursive:!0});let _=O.join(g,`image.json`);E.writeFileSync(_,JSON.stringify(h))}function Kd(e,t,n){try{let r=A(import.meta.resolve(n));t.has(n)||e.push({find:n,replacement:r})}catch(e){Cd(e)||console.warn(`[rari] Unexpected error resolving ${n}:`,e)}}function qd(e,t){let n=A(import.meta.resolve(`react`)),r=A(import.meta.resolve(`react-dom/client`)),i=A(import.meta.resolve(`react/jsx-runtime`)),a=[];return e.has(`react/jsx-runtime`)||a.push({find:`react/jsx-runtime`,replacement:i}),Kd(a,e,`react/jsx-dev-runtime`),Kd(a,e,`react/compiler-runtime`),t||a.push({find:/^react$/,replacement:n}),e.has(`react-dom/client`)||a.push({find:`react-dom/client`,replacement:r}),a}function Jd(e){let t=Bd(e);if(t!=null&&t!==``)return E.readFileSync(t,`utf-8`);throw Error("[rari] Runtime dist not built. Run `pnpm build` in the rari package first.")}function Yd(e){return e.includes(`import React`)||e.includes(`from "react"`)||e.includes(`from 'react'`)?e:`import * as React from 'react';\n${e}`}function Xd(e){let t=`react-server-dom-webpack-client.browser.${e}.js`,n=`react-server-dom-webpack-client.edge.${e}.js`;try{let e=O.dirname(A(import.meta.resolve(`react-server-dom-webpack/package.json`)));return{browserClientPath:O.join(e,`cjs`,t),edgeClientPath:O.join(e,`cjs`,n)}}catch{let e=O.dirname(A(import.meta.url)),r=O.resolve(e,`../../node_modules`);return{browserClientPath:O.join(r,`react-server-dom-webpack/cjs`,t),edgeClientPath:O.join(r,`react-server-dom-webpack/cjs`,n)}}}function Zd(e,t,n,r){return!e&&!t||n===``||$(r,`/api`)||$(r,`/rsc`)}function Qd(e){let{browserClientPath:t,edgeClientPath:n}=Xd(e),r=zt(E.readFileSync(t,`utf-8`),E.readFileSync(n,`utf-8`));return{code:`
|
|
801
|
+
import * as React from 'react';
|
|
802
|
+
import * as ReactDOM from 'react-dom';
|
|
803
|
+
import { callServer as rariCallServer } from 'rari/runtime/call-server';
|
|
875
804
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
805
|
+
const module = { exports: {} };
|
|
806
|
+
const exports = module.exports;
|
|
807
|
+
(function(module, exports, require) {
|
|
808
|
+
${e===`development`?r.replace(`"production" !== process.env.NODE_ENV &&`,`true &&`):r}
|
|
809
|
+
})(module, module.exports, function require(id) {
|
|
810
|
+
if (id === 'react') return React;
|
|
811
|
+
if (id === 'react-dom') return ReactDOM;
|
|
812
|
+
throw new Error('Cannot require "' + id + '" from react-server-dom-webpack client bundle');
|
|
813
|
+
});
|
|
881
814
|
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
815
|
+
const rariFindSourceMapURL = import.meta.env.DEV
|
|
816
|
+
? function rariFindSourceMapURL(filename, environmentName) {
|
|
817
|
+
const url = new URL('/__rari_findSourceMapURL', window.location.origin);
|
|
818
|
+
url.searchParams.set('filename', filename);
|
|
819
|
+
url.searchParams.set('environmentName', environmentName ?? 'Server');
|
|
820
|
+
return url.href;
|
|
821
|
+
}
|
|
822
|
+
: undefined;
|
|
890
823
|
|
|
891
|
-
|
|
892
|
-
|
|
824
|
+
export function createFromFetch(promise, options) {
|
|
825
|
+
return module.exports.createFromFetch(promise, {
|
|
826
|
+
...options,
|
|
827
|
+
callServer: options?.callServer ?? rariCallServer,
|
|
828
|
+
findSourceMapURL: options?.findSourceMapURL ?? rariFindSourceMapURL,
|
|
893
829
|
});
|
|
894
|
-
}`,o}function Se(t,n,r){let i=e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:C.cwd(),a=ye(n);if(r.topLevelUseServer){let e=be(t,r);if(e.length===0)return``;let a=Xt(n,i),o=`import { createServerReference } from "virtual:react-flight-client";
|
|
895
|
-
`;o+=`import { callServer } from "rari/runtime/call-server";
|
|
896
|
-
`;for(let t of e){let e=`${a}#${t}`,n=JSON.stringify(e);o+=t==="default"?`export default createServerReference(${n}, callServer);\n`:`export const ${t} = createServerReference(${n}, callServer);\n`}return o}if(a)return console.warn(`[rari] Server component ${n} should not be imported in client bundle`),``;if(!r.topLevelUseClient)return t;let o=be(t,r);if(o.length===0)return``;let s=JSON.stringify(n),c=`import {registerClientReference} from "react-server-dom-rari/server";
|
|
897
|
-
`;for(let e of o){if(e==="default"){let e=`Attempted to call the default export of ${n} from the server but it's 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.`;c+=`export default `,c+=`registerClientReference(function() {`,c+=`throw new Error(${JSON.stringify(e)});`}else{let t=`Attempted to call ${e}() from the server but ${e} 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.`;c+=`export const ${e} = `,c+=`registerClientReference(function() {`,c+=`throw new Error(${JSON.stringify(t)});`}c+=`},`,c+=`${s},`,c+=`${JSON.stringify(e)});\n`}return c}function Ce(e,t,n){return!n.topLevelUseClient||be(e,n).length===0?e:e.replace(zf,``)}let we=!1;async function Te(){let e=`http://localhost:${qe()}`;try{let t=(await fetch(`${e}/_rari/health`,{signal:AbortSignal.timeout(1e3)})).ok;return we=t,t}catch{return we=!1,!1}}let Ee=null;async function ke(e){return await Te()?!0:(Ee??=(async()=>{try{let t=Date.now()+e,n=50;for(;Date.now()<t;){if(await new Promise(e=>{setTimeout(e,Math.min(n,t-Date.now()))}),await Te())return!0;n=Math.min(n*2,500)}return!1}finally{Ee=null}})(),Ee)}let x={name:`rari`,config(e,{command:t}){if(e.appType=`custom`,e.define??={},t===`serve`||C.env.RARI_SERVER_URL!=null&&C.env.RARI_SERVER_URL!==``||C.env.RARI_HOST!=null&&C.env.RARI_HOST!==``){let t=qe(),n;if(C.env.RARI_SERVER_URL!=null&&C.env.RARI_SERVER_URL!==``)n=C.env.RARI_SERVER_URL;else if(C.env.RARI_HOST!=null&&C.env.RARI_HOST!==``){let e=C.env.RARI_HOST.startsWith(`http`)?C.env.RARI_HOST:`http://${C.env.RARI_HOST}`;n=e.replace(re,``).includes(`:`)?e:`${e}:${t}`}else n=`http://localhost:${t}`;e.define[`import.meta.env.RARI_SERVER_URL`]=JSON.stringify(n)}let n=typeof e.css?.modules==`object`?e.css.modules:{};e.css={...e.css,transformer:e.css?.transformer??`lightningcss`,modules:{...n,pattern:`[hash]_[local]`}},e.resolve??={};let r=e.resolve,a=Array.isArray(r.dedupe)?r.dedupe:[];r.dedupe=[...new Set(a).union(/* @__PURE__ */ new Set([`react`,`react-dom`]))];let o=[];i(r.alias)?o=r.alias:l(r.alias)&&(o=c(r.alias)),o=o.map(e=>e.find===`react`?{find:/^react$/,replacement:e.replacement}:e);let s=new Set(o.map(e=>String(e.find))),u=o.some(e=>Uf(e.find));try{let e=w(import.meta.resolve(`react`)),t=w(import.meta.resolve(`react-dom/client`)),n=w(import.meta.resolve(`react/jsx-runtime`)),i=[];s.has(`react/jsx-runtime`)||i.push({find:`react/jsx-runtime`,replacement:n});try{let e=w(import.meta.resolve(`react/jsx-dev-runtime`));s.has(`react/jsx-dev-runtime`)||i.push({find:`react/jsx-dev-runtime`,replacement:e})}catch(e){Hf(e)||console.warn(`[rari] Unexpected error resolving react/jsx-dev-runtime:`,e)}try{let e=w(import.meta.resolve(`react/compiler-runtime`));s.has(`react/compiler-runtime`)||i.push({find:`react/compiler-runtime`,replacement:e})}catch(e){Hf(e)||console.warn(`[rari] Unexpected error resolving react/compiler-runtime:`,e)}u||i.push({find:/^react$/,replacement:e}),s.has(`react-dom/client`)||i.push({find:`react-dom/client`,replacement:t}),r.alias=[...o,...i]}catch(e){Hf(e)||console.warn(`[rari] Unexpected error configuring React aliases:`,e)}e.environments??={},e.environments.rsc={consumer:`server`,resolve:{conditions:[`react-server`,`node`,`import`]},build:{outDir:`dist/server`,write:!1,copyPublicDir:!1,emitAssets:!0},...e.environments.rsc},e.environments.ssr={consumer:`server`,resolve:{conditions:[`node`,`import`]},build:{outDir:`dist/ssr`,write:!1,copyPublicDir:!1,emitAssets:!0},...e.environments.ssr},e.environments.client={consumer:`client`,resolve:{conditions:[`browser`,`import`]},...e.environments.client},e.builder??={},e.builder.sharedPlugins=!0,e.builder.sharedConfigBuild=!1,e.optimizeDeps??={},e.optimizeDeps.include??=[];for(let t of[`react`,`react-dom`,`react-dom/client`,`react-dom/server`,`react/jsx-runtime`,`react/jsx-dev-runtime`])e.optimizeDeps.include.includes(t)||e.optimizeDeps.include.push(t);if(e.optimizeDeps.exclude??=[],e.optimizeDeps.exclude.includes(`rari`)||e.optimizeDeps.exclude.push(`rari`),t===`build`)for(let t of[`rsc`,`ssr`,`client`]){let n=e.environments[t];n.build!=null&&(n.build.rolldownOptions??={})}e.server??={},e.server.proxy??={};let d=qe();if(e.server.proxy[`/api`]={target:`http://localhost:${d}`,changeOrigin:!0,secure:!1,ws:!0},e.server.proxy[`/_rari`]={target:`http://localhost:${d}`,changeOrigin:!0,secure:!1,ws:!0},t===`build`){e.build??={},e.build.rolldownOptions??={},e.build.rolldownOptions.input={main:er},e.build.rolldownOptions.output??={};let t=Array.isArray(e.build.rolldownOptions.output)?e.build.rolldownOptions.output:[e.build.rolldownOptions.output];for(let e of t)if(e.codeSplitting!==!1&&typeof e.codeSplitting!=`object`&&(e.codeSplitting={}),typeof e.codeSplitting==`object`){e.codeSplitting.groups??=[];let t=e.codeSplitting.groups;e.codeSplitting.groups.push({name(e){if(e.includes(`node_modules`)){for(let n of t)if(n.test!=null){let t=!1;if(typeof n.test==`function`?t=!!n.test(e):n.test instanceof RegExp?t=n.test.test(e):typeof n.test==`string`&&(t=e.includes(n.test)),t)return null}return e.includes(`node_modules/react-dom`)?`react-dom`:e.includes(`node_modules/react`)?`react`:`vendor`}return null}})}}e.environments.client.build??={},e.environments.client.build.rolldownOptions??={},e.environments.client.build.rolldownOptions.input={main:er},e.environments.client.build.rolldownOptions.external??=[];let f=e.environments.client.build.rolldownOptions.external;if(Array.isArray(f)){let e=f.indexOf(`react-server-dom-webpack/client`);e!==-1&&f.splice(e,1)}return e},async buildStart(){if(ir(),e.experimental?.useCache||e.experimental?.useCacheRemote)try{await uf()}catch(e){this.error(e instanceof Error?e:Error(String(e)))}},configResolved(e){let t=Kt(e);m=t.assetsDir,h=t.outDir,Object.assign(p,Gt(e))},async transform(t,n){if(n.endsWith(`.mdx`)&&_(),/\.(?:tsx?|jsx?|mts|mjs)$/.test(n)&&t.includes(`defineMdxComponents`)){let r=tc({code:t,id:n,projectRoot:e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:C.cwd(),resolvedAlias:p});if(r!=null&&r!==``)return{code:r,map:null}}if(!v.test(n))return null;let r=!1;if(e.experimental?.useCache||e.experimental?.useCacheRemote){let e=await uf();if(e){let i=e(t,n);i!=null&&i!==``&&(t=i,r=!0)}}let i=this.environment,o=n.startsWith(`\0`)||n.includes(`virtual:`)?mn(t):(()=>{try{return a.get(n)}catch{return mn(t)}})();if(o.topLevelUseServer)return ae(n,`server`),i.name===`rsc`?xe(t,n,o):Se(t,n,o);if(o.topLevelUseClient){ae(n,`client`),ce(n);for(let e of o.importSources){if(!Bf.test(e)&&!Vf(e,p))continue;let t=_e(e,n,p);b.existsSync(t)&&(a.get(t).topLevelUseServer||(ae(t,`client`),ce(t)))}return Ce(t,n,o)}if(i.name!==`rsc`&&i.name!==`ssr`&&(ne(n)===`client`||ue(n)))return Ce(t,n,o);function s(e){if(!b.existsSync(e))return!1;try{return a.get(e).topLevelUseClient}catch{return!1}}function c(e,t){let n=e,r=[],i=/* @__PURE__ */ new Set;for(let e of yn(n)){if(e.typeOnly||e.sideEffectOnly||!Bf.test(e.source)&&!Vf(e.source,p))continue;let n=_e(e.source,t,p);if(!s(n))continue;ae(n,`client`),ce(n);let a=Cs(e,ie(n));if(a.code!==``){for(let e of a.helpers)i.add(e);r.push({start:e.start,end:e.end,replacement:a.code})}}if(r.length===0)return n;for(let{start:e,end:t,replacement:i}of[...r].sort((e,t)=>t.start-e.start))n=n.slice(0,e)+i+n.slice(t);return i.size>0&&(n=bs(n,`react-server-dom-rari/server`,[...i])),n}if(ye(n)){if(ae(n,`server`),i.name===`rsc`||i.name===`ssr`)return c(xe(t,n,o),n);{let e=Se(t,n,o);return e=`// HMR acceptance for server component
|
|
898
|
-
if (import.meta.hot) {
|
|
899
|
-
import.meta.hot.accept();
|
|
900
|
-
if (typeof globalThis !== 'undefined') {
|
|
901
|
-
if (!globalThis['~rari']) globalThis['~rari'] = {};
|
|
902
|
-
globalThis['~rari'].serverComponents = globalThis['~rari'].serverComponents || new Set();
|
|
903
|
-
globalThis['~rari'].serverComponents.add(${JSON.stringify(n)});
|
|
904
|
-
}
|
|
905
830
|
}
|
|
906
831
|
|
|
907
|
-
|
|
908
|
-
`),t&&(u=t+u),!u.includes(`Suspense`)){let e=Kf.exec(u);e&&(e[1]&&!e[2].includes(`Suspense`)?u=u.replace(e[0],e[0].replace(Yf,`{ Suspense, $1 }`)):e[1]||(u=u.replace(e[0],`import React, { Suspense } from 'react';`)))}let r=C.env.NODE_ENV!==`production`;return(u.includes(`</`)||u.includes(`/>`)||Jf.test(u))&&r&&(u=`'use client';\n\n${u}`,ae(n,`client`)),u}return r?t:null},async configureServer(t){let n=S.resolve(e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:C.cwd()),r=S.join(n,`src`);await lp(n,e,m,h);let i=async()=>{try{let i=new ms(n,{outDir:h,rscDir:`server`,manifestPath:`server/manifest.json`,serverConfigPath:`server/config.json`,alias:p,assetsDir:m,csp:e.csp,cacheControl:e.cacheControl,cache:e.cache,action:e.action,jsPoolSize:e.jsPoolSize,origin:e.origin,htmlLimitedBots:e.htmlLimitedBots,experimental:e.experimental,moduleAnalysisCache:a});if(i.setViteBuilder(await me({root:n,configFile:t.config.configFile,logLevel:`error`})),o=i,f??=new ta(i,qe()),b.existsSync(r)){let e=vs(r,i,Object.values(p));e.serverComponentPaths.length>0&&t.ws.send({type:`custom`,event:`rari:server-components-registry`,data:{serverComponents:e.serverComponentPaths}})}let c=await i.getTransformedComponentsForDevelopment(),l=`http://localhost:${qe()}`;await Promise.all(c.map(async e=>{try{if(e.id.startsWith(`app/`)||e.isAction)return;let t=await fetch(`${l}/_rari/register`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:e.id,component_code:e.code})});if(!t.ok){let e=await t.text();throw Error(`HTTP ${t.status}: ${e}`)}}catch(t){console.error(`[rari] Runtime: Failed to register component ${e.id}:`,s(t,String(t)))}}))}catch(e){console.error(`[rari] Runtime: Component discovery failed:`,s(e,String(e)))}},c=async()=>{try{let e=`http://localhost:${qe()}`,t=ve();await Promise.all([...t].map(async t=>{let n=S.relative(C.cwd(),t),r=S.basename(t).replace(le,``);try{await fetch(`${e}/_rari/register-client`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:r,file_path:n,export_name:`default`})})}catch(e){console.error(`[rari] Runtime: Failed to pre-register client component ${r}:`,e)}}))}catch(e){console.error(`[rari] Runtime: Failed to pre-register client components:`,e)}},g=async()=>{if(u)return;let{getBinaryPath:r,getInstallationInstructions:a}=await import(`./platform.mjs`),o;try{o=r()}catch(e){console.error(`rari binary not found`),console.error(` ${s(e,String(e))}`),console.error(a());return}let l=qe(),d=C.env.NODE_ENV===`production`?`production`:`development`,f=t.config.server.port,m=e.origin?.trim().replace(/\/+$/,``),h=C.env.RARI_ORIGIN?.trim().replace(/\/+$/,``),g=dr(n,p),_=[`--mode`,d,`--port`,l.toString(),`--host`,`127.0.0.1`];u=Oe(o,_,{stdio:[`ignore`,`pipe`,`pipe`],cwd:n,env:{...C.env,RUST_LOG:C.env.RUST_LOG!=null&&C.env.RUST_LOG!==``?C.env.RUST_LOG:`error`,RARI_VITE_PORT:f.toString(),...g.length>0?{RARI_DEV_LAYOUT_CSS:g.join(`,`)}:{},...e.jsPoolSize!=null&&(C.env.RARI_JS_POOL_SIZE==null||C.env.RARI_JS_POOL_SIZE===``)?{RARI_JS_POOL_SIZE:String(e.jsPoolSize)}:{},...m!=null&&m!==``&&(h==null||h===``)?{RARI_ORIGIN:m}:{},...e.htmlLimitedBots!=null&&(C.env.RARI_HTML_LIMITED_BOTS==null||C.env.RARI_HTML_LIMITED_BOTS===``)?{RARI_HTML_LIMITED_BOTS:e.htmlLimitedBots}:{}}}),u.stdout?.on(`data`,e=>{let t=e.toString().trim();t&&console.error(t)}),u.stderr?.on(`data`,e=>{let t=e.toString().trim();t&&!t.includes(`warning`)&&console.error(t)}),u.on(`error`,e=>{we=!1,console.error(`Failed to start rari server:`,e.message),e.message.includes(`ENOENT`)&&console.error(` Binary not found. Please ensure rari is properly installed.`)}),u.on(`exit`,(e,t)=>{u=null,we=!1,t?console.error(`rari server stopped by signal ${t}`):e===0?console.error(`rari server stopped successfully`):e&&console.error(`rari server exited with code ${e}`)}),await ke(1e4)?(await i(),await c()):console.error(`Server failed to become ready for component registration`)},_=async e=>{try{if(!ye(e))return;o??await i();let t=o;if(t==null)return;let n=a.getSource(e);t.addServerComponent(e,n);let r=Zi(t.getImportGraph(),[e]);r.add(e);let c=await t.getTransformedComponentsForDevelopment(e=>r.has(e));if(c.length===0)return;let l=`http://localhost:${qe()}`;await Promise.all(c.map(async e=>{try{let t=await fetch(`${l}/_rari/register`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:e.id,component_code:e.code})});if(!t.ok){let e=await t.text();throw Error(`HTTP ${t.status}: ${e}`)}}catch(t){console.error(`[rari] Failed to register component`,`${e.id}:`,s(t,String(t)))}}))}catch(t){console.error(`[rari] Targeted HMR failed for`,`${e}:`,s(t,String(t)))}};g().catch(e=>{console.error(`[rari] Failed to start Rust server:`,e)}),t.middlewares.use((e,t,n)=>{(async()=>{let r=e.headers.accept,i=e.method??`GET`,a=e.url??``,o=de(a),s=r!=null&&r!==``&&r.includes(`text/x-component`),c=(i===`GET`||i===`HEAD`)&&r?.includes(`text/html`)&&!o.startsWith(`/@`)&&!Af(o,`/node_modules`)&&!Af(o,`/api`)&&!Af(o,`/_rari`)&&!Af(o,`/vite-server`)&&!kf(o);if((s||c)&&a!==``&&!Af(o,`/api`)&&!Af(o,`/rsc`)){if(!we&&!await ke(1e4)){console.error(`[rari] Rust server not ready, cannot proxy ${s?`RSC`:`HTML`} request`),t.headersSent||(t.statusCode=503,t.end(`Server not ready`));return}let n=qe(),r=`http://localhost:${n}${a}`;try{let a={};for(let[t,n]of Object.entries(e.headers))typeof n==`string`?a[t]=n:Array.isArray(n)&&(a[t]=n.join(`,`));a.host=`localhost:${n}`,a[`accept-encoding`]=`identity`;let o=i!==`GET`&&i!==`HEAD`?await Of(e,10485760):void 0,s=await fetch(r,{method:i,headers:a,...o==null?{}:{body:o}});if(t.statusCode=s.status,s.headers.forEach((e,n)=>{n.toLowerCase()!==`content-encoding`&&t.setHeader(n,e)}),i===`HEAD`||!s.body){t.end();return}let c=s.body.getReader();try{let e=!1;for(;!e;){let{done:n,value:r}=await c.read();e=n,!e&&r!=null&&t.write(De.from(r))}t.end()}catch(e){console.error(`[rari] Stream error:`,e),t.headersSent||(t.statusCode=500),t.end()}return}catch(e){if((l(e)&&typeof e.statusCode==`number`?e.statusCode:void 0)===413){t.headersSent||(t.statusCode=413,t.end(`Request Entity Too Large`));return}console.error(`[rari] Failed to proxy ${s?`RSC`:`HTML`} request:`,e),t.headersSent||(t.statusCode=500,t.end(`Internal Server Error`));return}}n()})()}),t.watcher.on(`change`,e=>{(async()=>{v.test(e)&&(se(e),fe(e),a.invalidate(e)),v.test(e)&&pe(e,r)&&ye(e)&&(t.ws.send({type:`custom`,event:`rari:register-server-component`,data:{filePath:e}}),await _(e))})()}),t.middlewares.use(`/api/vite/hmr-transform`,(e,t)=>{if(e.method!==`POST`){t.statusCode=405,t.end(`Method Not Allowed`);return}(async()=>{try{let n=await je(e),r=d(n),i=r&&typeof r.filePath==`string`?r.filePath:void 0;if(i==null||i===``){t.statusCode=400,t.end(JSON.stringify({error:`filePath is required`}));return}await _(i),t.statusCode=200,t.setHeader(`Content-Type`,`application/json`),t.end(JSON.stringify({success:!0,filePath:i,message:`Component transformation completed`}))}catch(e){t.statusCode=500,t.setHeader(`Content-Type`,`application/json`),t.end(JSON.stringify({success:!1,error:s(e,String(e))}))}})()}),t.httpServer?.on(`close`,()=>{if(ge(n),o!=null&&(o.setViteBuilder(null),o=null),f&&=(f.dispose(),null),u){let e=u;u=null,we=!1;let t=!1,n=setTimeout(()=>{t||e.kill(`SIGKILL`)},5e3);n.unref(),e.once(`exit`,()=>{t=!0,clearTimeout(n)}),e.kill(`SIGTERM`);return}we=!1})},resolveId(e,t){if(e===`virtual:rsc-integration`||e===`virtual:rsc-integration.ts`)return`virtual:rsc-integration.ts`;if(e===`virtual:rari-entry-client`||e===`virtual:rari-entry-client.ts`)return`virtual:rari-entry-client.ts`;if(e===`virtual:react-flight-client`||e===`virtual:react-flight-client.ts`)return`virtual:react-flight-client.ts`;if(e===`virtual:app-router-provider`||e===`virtual:app-router-provider.tsx`)return`virtual:app-router-provider.tsx`;if(e===`virtual:client-router`||e===`virtual:client-router.tsx`)return`virtual:client-router.tsx`;if(e===`virtual:error-boundary-wrapper`||e===`virtual:error-boundary-wrapper.tsx`)return`virtual:error-boundary-wrapper.tsx`;if(Ha(e)||e===`virtual:rari-mdx-components`||e===`virtual:rari-mdx-components.ts`)return`virtual:rari-mdx-components.ts`;if(e===`react-server-dom-webpack/client`||e===`react-server-dom-webpack/client.browser`)return`virtual:react-flight-client.ts`;if(e===`./LoadingErrorBoundary`||e===`./LoadingErrorBoundary.tsx`)return`virtual:loading-error-boundary.tsx`;if(e===`react-server-dom-rari/server`)return e;if(t!=null&&t!==``&&t.startsWith(`virtual:`)&&e.startsWith(`./`)){let t=ip(S.basename(e));if(t!=null&&t!==``)return t}if(t!=null&&t!==``&&t.startsWith(`virtual:`)&&e.startsWith(`../`)){let n=import.meta.url,r=w(n),i=S.dirname(r),a=null,o=[S.join(i,`runtime`),S.join(i,`../runtime`)];for(let e of o)if(b.existsSync(e)){a=e;break}if(a!=null&&a!==``){let t=S.join(a,e);if(b.existsSync(t))return t;let n=S.join(a,`../dist`,S.basename(e));if(b.existsSync(n))return n}else console.warn(`[rari] Runtime directory not found, attempting fallback resolution for virtual import.\n Importer: ${t}\n ID: ${e}\n Current Dir: ${i}\n Hint: Runtime lookup failed, trying currentDir as fallback`);let s=S.join(i,e);if(b.existsSync(s))return s;let c=S.join(i,`../dist`,S.basename(e));if(b.existsSync(c))return c}if(C.env.NODE_ENV===`production`)try{let t=S.resolve(e);if(b.existsSync(t)&&ye(t))return{id:e,external:!0}}catch(t){n(t)!==`ENOENT`&&console.warn(`[rari] Unexpected error resolving server component:`,e,t)}return null},async load(t){if(v.test(t)&&this.environment.name===`client`)try{let e=a.get(t);if(e.topLevelUseServer)return Se(a.getSource(t),t,e)}catch{}if(t===`virtual:rari-mdx-components.ts`)return ee();if(t===`virtual:rari-entry-client.ts`){let t=e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:C.cwd(),r=Xn(Hn(S.join(t,`src`),Object.values(p)),a),i=ve().union(new Set(r)),o=[{path:`rari/image`,exports:[`Image`]},{path:`virtual:error-boundary-wrapper.tsx`,exports:[`ErrorBoundaryWrapper`]}],s=[...i].filter(e=>{try{return a.get(e).topLevelUseClient}catch{return!1}}).map(e=>{let t=y(S.relative(C.cwd(),e)),r=t.replace(v,``),i=t.startsWith(`..`)?y(e):t,o=!1,s=``;try{if(!a.get(e).hasDefaultExport){let t=a.getSource(e).match(oe);t&&(o=!0,s=t[1])}}catch(t){n(t)!==`ENOENT`&&console.warn(`[rari] Unexpected error reading component for export detection:`,e,t)}let c=o?s:`default`,l=o?s:S.basename(e,S.extname(e)),u=y(i),d=u.startsWith(`/`)||te.test(u)?u:`/${u}`;return` "${i}": {
|
|
832
|
+
export function createFromReadableStream(stream, options) {
|
|
833
|
+
return module.exports.createFromReadableStream(stream, {
|
|
834
|
+
...options,
|
|
835
|
+
callServer: options?.callServer ?? rariCallServer,
|
|
836
|
+
findSourceMapURL: options?.findSourceMapURL ?? rariFindSourceMapURL,
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
export function createServerReference(id, callServer, encodeFormAction, findSourceMapURL, functionName) {
|
|
841
|
+
return module.exports.createServerReference(
|
|
842
|
+
id,
|
|
843
|
+
callServer ?? rariCallServer,
|
|
844
|
+
encodeFormAction,
|
|
845
|
+
findSourceMapURL ?? rariFindSourceMapURL,
|
|
846
|
+
functionName,
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
export const encodeReply = module.exports.encodeReply;
|
|
851
|
+
export const createTemporaryReferenceSet = module.exports.createTemporaryReferenceSet;
|
|
852
|
+
`}}function $d(e,t){let n=O.relative(t,e),r=!n.startsWith(`..`)&&!O.isAbsolute(n),i=e.includes(`${O.sep}node_modules${O.sep}`),a=e.includes(`${O.sep}packages${O.sep}rari${O.sep}`)||e.includes(`${O.sep}packages${O.sep}use-cache${O.sep}`)||e.includes(`${O.sep}node_modules${O.sep}rari${O.sep}`)||e.includes(`${O.sep}node_modules${O.sep}@rari${O.sep}use-cache${O.sep}`);return r||i||a}function ef(e,t){if(!e.endsWith(`.mjs`)||!E.existsSync(e))return null;try{return $d(E.realpathSync(e),t)?E.readFileSync(e,`utf-8`):(console.warn(`[rari] Refusing to load .mjs file outside project root and node_modules: ${e}`),null)}catch(t){return console.warn(`[rari] Error validating .mjs file path: ${e}`,t),null}}const tf=/* @__PURE__ */ new Map([[`virtual:app-router-provider.tsx`,`AppRouterProvider.mjs`],[`virtual:client-router.tsx`,`ClientRouter.mjs`]]);async function nf(e,t){if(e===`virtual:rari-mdx-components.ts`)return t.buildMdxRegistryModule();if(e===`virtual:rari-entry-client.ts`)return gf(t.resolveProjectRoot(),t.resolvedAlias,t.moduleAnalysisCache,t.getKnownClientComponentPaths);if(e===`react-server-dom-rari/server`)return Wd();let n=tf.get(e);if(n!=null)return Jd(n);if(e===`virtual:error-boundary-wrapper.tsx`)return Yd(Jd(`ErrorBoundaryWrapper.mjs`));if(e===`virtual:rsc-integration.ts`)return(await Hd()).replace(Od,(e,t,n)=>`from${t}${n}virtual:react-flight-client.ts${n}`);if(e===`virtual:react-flight-client.ts`)return Qd(t.environmentMode===`dev`?`development`:`production`)}function rf(e,t){if(k.env.NODE_ENV!==`production`)return null;try{let n=O.resolve(e);if(E.existsSync(n)&&t(n))return{id:e,external:!0}}catch(t){r(t)!==`ENOENT`&&console.warn(`[rari] Unexpected error resolving server component:`,e,t)}return null}function af(e,t){if(!e.includes(`node_modules`))return null;for(let n of t){if(n.test==null)continue;let t=!1;if(typeof n.test==`function`){let r=n.test;t=!!r(e)}else n.test instanceof RegExp?t=n.test.test(e):typeof n.test==`string`&&(t=e.includes(n.test));if(t)return null}return e.includes(`node_modules/react-dom`)?`react-dom`:e.includes(`node_modules/react`)?`react`:`vendor`}function of(e,t,n){return(e===`GET`||e===`HEAD`)&&(t?.includes(`text/html`)??!1)&&!n.startsWith(`/@`)&&!$(n,`/node_modules`)&&!$(n,`/api`)&&!$(n,`/_rari`)&&!$(n,`/assets`)&&!$(n,`/vite-server`)&&!dd(n)}function sf(e,t){let n={};for(let[t,r]of Object.entries(e))typeof r==`string`?n[t]=r:Array.isArray(r)&&(n[t]=r.join(`,`));return n.host=`localhost:${t}`,n[`accept-encoding`]=`identity`,n}async function cf(e,t,n){if(n===`HEAD`||!e.body){t.end();return}let r=e.body.getReader();try{let e=!1;for(;!e;){let{done:n,value:i}=await r.read();e=n,!e&&i!=null&&t.write(Te.from(i))}t.end()}catch(e){console.error(`[rari] Stream error:`,e),t.headersSent||(t.statusCode=500),t.end()}}const lf=/* @__PURE__ */ new Map([[`virtual:rsc-integration`,`virtual:rsc-integration.ts`],[`virtual:rsc-integration.ts`,`virtual:rsc-integration.ts`],[`virtual:rari-entry-client`,`virtual:rari-entry-client.ts`],[`virtual:rari-entry-client.ts`,`virtual:rari-entry-client.ts`],[`virtual:react-flight-client`,`virtual:react-flight-client.ts`],[`virtual:react-flight-client.ts`,`virtual:react-flight-client.ts`],[`virtual:app-router-provider`,`virtual:app-router-provider.tsx`],[`virtual:app-router-provider.tsx`,`virtual:app-router-provider.tsx`],[`virtual:client-router`,`virtual:client-router.tsx`],[`virtual:client-router.tsx`,`virtual:client-router.tsx`],[`virtual:error-boundary-wrapper`,`virtual:error-boundary-wrapper.tsx`],[`virtual:error-boundary-wrapper.tsx`,`virtual:error-boundary-wrapper.tsx`],[`virtual:rari-mdx-components`,`virtual:rari-mdx-components.ts`],[`virtual:rari-mdx-components.ts`,`virtual:rari-mdx-components.ts`]]);function uf(e){return Ss(e)?`virtual:rari-mdx-components.ts`:lf.get(e)??null}function df(e){for(let t of e)if(E.existsSync(t))return t;return null}function ff(e,t){if(e.startsWith(`./`)){let t=Bd(O.basename(e));return t!=null&&t!==``?t:null}if(!e.startsWith(`../`))return null;let n=O.dirname(A(import.meta.url)),r=df([O.join(n,`runtime`),O.join(n,`../runtime`)]);if(r!=null){let t=df([O.join(r,e),O.join(r,`../dist`,O.basename(e))]);if(t!=null)return t}else console.warn(`[rari] Runtime directory not found, attempting fallback resolution for virtual import.\n Importer: ${t}\n ID: ${e}\n Current Dir: ${n}\n Hint: Runtime lookup failed, trying currentDir as fallback`);return df([O.join(n,e),O.join(n,`../dist`,O.basename(e))])}function pf(e,t){let n=!1,i=``;try{if(!t.get(e).hasDefaultExport){let r=t.getSource(e).match(x);r&&(n=!0,i=r[1])}}catch(t){r(t)!==`ENOENT`&&console.warn(`[rari] Unexpected error reading component for export detection:`,e,t)}return{exportName:n?i:`default`,displayName:n?i:O.basename(e,O.extname(e))}}function mf(e,t){let n=w(O.relative(k.cwd(),e)),r=n.replace(S,``),i=n.startsWith(`..`)?w(e):n,{exportName:a,displayName:o}=pf(e,t),s=w(i),c=s.startsWith(`/`)||ne.test(s)?s:`/${s}`;return` "${i}": {
|
|
909
853
|
id: "${r}",
|
|
910
854
|
path: "${i}",
|
|
911
|
-
exportName: "${
|
|
912
|
-
displayName: "${
|
|
855
|
+
exportName: "${a}",
|
|
856
|
+
displayName: "${o}",
|
|
913
857
|
type: "client",
|
|
914
|
-
loader: () =>
|
|
858
|
+
loader: () => import(${JSON.stringify(c)}),
|
|
915
859
|
component: null,
|
|
916
860
|
loading: false,
|
|
917
861
|
registered: false
|
|
918
|
-
}`}).join(
|
|
919
|
-
`),
|
|
920
|
-
`),l=o.flatMap((e,t)=>e.exports.map(n=>`
|
|
862
|
+
}`}function hf(e){return{imports:e.map((e,t)=>`import * as ExternalModule${t} from '${e.path}';`).join(`
|
|
863
|
+
`),registrations:e.flatMap((e,t)=>e.exports.map(n=>{let r=`${e.path}#${n}`;return`
|
|
921
864
|
globalThis['~clientComponents'] = globalThis['~clientComponents'] || {};
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
globalThis['~clientComponents']["${
|
|
865
|
+
{
|
|
866
|
+
const entry = {
|
|
867
|
+
id: "${n}",
|
|
868
|
+
path: "${e.path}",
|
|
869
|
+
type: "client",
|
|
870
|
+
component: ExternalModule${t},
|
|
871
|
+
registered: true
|
|
872
|
+
};
|
|
873
|
+
globalThis['~clientComponents']["${r}"] = entry;
|
|
874
|
+
globalThis['~clientComponents']["${e.path}"] = entry;
|
|
875
|
+
}
|
|
931
876
|
globalThis['~clientComponentPaths'] = globalThis['~clientComponentPaths'] || {};
|
|
932
|
-
globalThis['~clientComponentPaths']["${e.path}"] = "${n}";`)).join(`
|
|
933
|
-
`)
|
|
877
|
+
globalThis['~clientComponentPaths']["${e.path}"] = "${n}";`})).join(`
|
|
878
|
+
`)}}async function gf(e,t,n,r){let i=jr(wr(O.join(e,`src`),Object.values(t)),n),a=r().union(new Set(i)),o=[{path:`rari/image`,exports:[`Image`]},{path:`virtual:error-boundary-wrapper.tsx`,exports:[`ErrorBoundaryWrapper`]}],s=[...a].filter(e=>{try{return n.get(e).topLevelUseClient}catch{return!1}}).map(e=>mf(e,n)).join(`,
|
|
879
|
+
`),c=hf(o),l=[`
|
|
934
880
|
const lazyComponentRegistry = {
|
|
935
881
|
${s}
|
|
936
882
|
};
|
|
@@ -942,36 +888,34 @@ for (const [path, config] of Object.entries(lazyComponentRegistry)) {
|
|
|
942
888
|
globalThis['~clientComponents'][fullId] = config;
|
|
943
889
|
globalThis['~clientComponentPaths'][path] = config.id;
|
|
944
890
|
}
|
|
945
|
-
`,
|
|
946
|
-
`),
|
|
947
|
-
${n}import * as React from 'react';\n${t.slice(n.length)}`}return`
|
|
948
|
-
import * as React from 'react';\n${t}`}return t}throw Error(Ef)}if(t===`virtual:rsc-integration.ts`)return(await op()).replace(qf,(e,t,n)=>`from${t}${n}virtual:react-flight-client.ts${n}`);if(t===`virtual:react-flight-client.ts`){let e,t;try{let n=S.dirname(w(import.meta.resolve(`react-server-dom-webpack/package.json`)));e=S.join(n,`cjs/react-server-dom-webpack-client.browser.production.js`),t=S.join(n,`cjs/react-server-dom-webpack-client.edge.production.js`)}catch{let n=S.dirname(w(import.meta.url)),r=S.resolve(n,`../../node_modules`);e=S.join(r,`react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js`),t=S.join(r,`react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js`)}return{code:`
|
|
949
|
-
import * as React from 'react';
|
|
950
|
-
import * as ReactDOM from 'react-dom';
|
|
951
|
-
import { callServer as rariCallServer } from 'rari/runtime/call-server';
|
|
891
|
+
`,c.registrations].filter(Boolean).join(`
|
|
892
|
+
`),u=Kr(e,t);return Ud(c.imports,l,u)}function _f(e){e.build??={},e.build.outDir??=`dist/client`,e.environments??={},e.environments.rsc={consumer:`server`,resolve:{conditions:[`react-server`,`node`,`import`]},build:{outDir:`dist/server`,write:!1,copyPublicDir:!1,emitAssets:!0},...e.environments.rsc},e.environments.ssr={consumer:`server`,resolve:{conditions:[`node`,`import`]},build:{outDir:`dist/ssr`,write:!1,copyPublicDir:!1,emitAssets:!0},...e.environments.ssr},e.environments.client={consumer:`client`,resolve:{conditions:[`browser`,`import`]},build:{outDir:e.build.outDir,copyPublicDir:!0},...e.environments.client}}function vf(e){e.optimizeDeps??={},e.optimizeDeps.include??=[];for(let t of[`react`,`react-dom`,`react-dom/client`,`react-dom/server`,`react/jsx-runtime`,`react/jsx-dev-runtime`])e.optimizeDeps.include.includes(t)||e.optimizeDeps.include.push(t);e.optimizeDeps.exclude??=[],e.optimizeDeps.exclude.includes(`rari`)||e.optimizeDeps.exclude.push(`rari`)}function yf(e){e.server??={},e.server.proxy??={};let t={target:`http://localhost:${M()}`,changeOrigin:!0,secure:!1};e.server.proxy[`/api`]={...t,ws:!0},e.server.proxy[`/_rari`]={...t,ws:!0},e.server.proxy[`/assets`]=t}const bf=/* @__PURE__ */ new WeakMap;function xf(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=e[n];if(bf.has(r)){if(bf.get(r)===e){t=!0;continue}e.splice(n,1)}}if(t)return;let n={debugName:`rari-vendor`,name(t){return af(t,e)}};bf.set(n,e),e.push(n)}function Sf(e){e.build??={},e.build.rolldownOptions??={},e.build.rolldownOptions.input={main:Nr},e.build.rolldownOptions.output??={};let t=Array.isArray(e.build.rolldownOptions.output)?e.build.rolldownOptions.output:[e.build.rolldownOptions.output];for(let e of t)e.codeSplitting!==!1&&typeof e.codeSplitting!=`object`&&(e.codeSplitting={}),typeof e.codeSplitting==`object`&&(e.codeSplitting.groups??=[],xf(e.codeSplitting.groups))}function Cf(e){e.environments.client.build??={},e.environments.client.build.rolldownOptions??={},e.environments.client.build.rolldownOptions.input={main:Nr},e.environments.client.build.rolldownOptions.external??=[];let t=e.environments.client.build.rolldownOptions.external;if(Array.isArray(t)){let e=t.indexOf(`react-server-dom-webpack/client`);e!==-1&&t.splice(e,1)}}function wf(e){let t=[];return a(e.alias)?t=e.alias:u(e.alias)&&(t=l(e.alias)),t.map(e=>e.find===`react`?{find:/^react$/,replacement:e.replacement}:e)}function Tf(e,t,n){if((u(e)&&typeof e.statusCode==`number`?e.statusCode:void 0)===413){t.headersSent||(t.statusCode=413,t.end(`Request Entity Too Large`));return}console.error(`[rari] Failed to proxy ${n?`RSC`:`HTML`} request:`,e),t.headersSent||(t.statusCode=500,t.end(`Internal Server Error`))}function Ef(e){return e}function Df(e={}){if(e.jsPoolSize!=null){let t=e.jsPoolSize;if(!Number.isInteger(t)||t<1||!Number.isFinite(t))throw Error(`jsPoolSize must be a finite positive integer; received ${String(t)}`)}let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set,r=new Mr,i=null,a=null,o=null,s={},l=`assets`,u=O.join(k.cwd(),`dist`),d=null;function p(){d=null}function m(){return d!=null&&d!==``||(d=Os(Ds({projectRoot:e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd(),mdxOptions:e.mdx,alias:s,cache:r}))),d}function h(e){return t.get(H(e))}function g(t){let n=e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd(),r=w(O.relative(n,t));return r.startsWith(`..`)||O.isAbsolute(r)?w(t):r}function _(e,n){t.set(H(e),n)}function v(e){Ar(t,e)}function y(e){n.add(H(e))}function ee(e){return n.has(H(e))}function te(e){n.delete(e);try{n.delete(E.realpathSync(e))}catch{n.delete(O.resolve(e))}}function ne(){let e=new Set(n);if(i)for(let t of i.getClientComponentPaths())e.add(t);return e}function b(e){if(e.includes(`node_modules`)||Vd(e))return!1;let t=H(e);try{return El(t,r.get(e))}catch{return!1}}function x(e,t){try{let n=new Set(Vn(e));return(t?.hasDefaultExport??Jn(e))&&n.add(`default`),[...n]}catch{return[]}}function re(e){return`${e}
|
|
952
893
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
(function(module, exports, require) {
|
|
956
|
-
${Ht(b.readFileSync(e,`utf-8`),b.readFileSync(t,`utf-8`))}
|
|
957
|
-
})(module, module.exports, function require(id) {
|
|
958
|
-
if (id === 'react') return React;
|
|
959
|
-
if (id === 'react-dom') return ReactDOM;
|
|
960
|
-
throw new Error('Cannot require "' + id + '" from react-server-dom-webpack client bundle');
|
|
961
|
-
});
|
|
962
|
-
export function createFromFetch(promise, options) {
|
|
963
|
-
return module.exports.createFromFetch(promise, {
|
|
964
|
-
...options,
|
|
965
|
-
callServer: options?.callServer ?? rariCallServer,
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
export function createFromReadableStream(stream, options) {
|
|
969
|
-
return module.exports.createFromReadableStream(stream, {
|
|
970
|
-
...options,
|
|
971
|
-
callServer: options?.callServer ?? rariCallServer,
|
|
894
|
+
if (import.meta.hot) {
|
|
895
|
+
import.meta.hot.accept(() => {
|
|
972
896
|
});
|
|
897
|
+
}`}function ae(e,t){let n=yd.exec(e);if(n){let r=n[1];return e+=`
|
|
898
|
+
// Register server reference for default export
|
|
899
|
+
`,e+=`registerServerReference(${r}, ${t}, ${JSON.stringify(`default`)});\n`,e}let r=`__default_export__`,i=br(e,r);return i==null?e:(e=i,e+=`
|
|
900
|
+
// Register server reference for default export
|
|
901
|
+
`,e+=`if (typeof ${r} === "function") {\n`,e+=` registerServerReference(${r}, ${t}, ${JSON.stringify(`default`)});\n`,e+=`}
|
|
902
|
+
`,e)}function oe(e,t,n){return e+=`\n// Register server reference for ${t}\n`,e+=`if (typeof ${t} === "function") {\n`,e+=` registerServerReference(${t}, ${n}, ${JSON.stringify(t)});\n`,e+=`}
|
|
903
|
+
`,e}function C(t,n,r){let i=Kt(n,e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd()),a=Eu(t,i),o=a?.code??t;if(!r.topLevelUseServer)return a==null?t:re(o);let s=x(o,r);if(s.length===0&&a==null)return qn(o,`use server`);let c=JSON.stringify(i);Rl(o)?o+=`
|
|
904
|
+
`:o+=`
|
|
905
|
+
|
|
906
|
+
import {registerServerReference} from "react-server-dom-rari/server";
|
|
907
|
+
`;for(let e of s)if(e==="default")o=ae(o,c);else if(a?.rewrittenExportNames.includes(e))continue;else o=oe(o,e,c);return o=qn(o,`use server`),re(o)}function pe(e,t,n,r){let i=x(e,n);if(i.length===0)return``;let a=Kt(t,r),o=`import { createServerReference } from "virtual:react-flight-client";
|
|
908
|
+
`;o+=`import { callServer } from "rari/runtime/call-server";
|
|
909
|
+
`;for(let e of i){let t=`${a}#${e}`,n=JSON.stringify(t);o+=e==="default"?`export default createServerReference(${n}, callServer);\n`:`export const ${e} = createServerReference(${n}, callServer);\n`}return o}function me(t,n,r){let i=e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd(),a=b(n);if(r.topLevelUseServer)return pe(t,n,r,i);if(a)return console.warn(`[rari] Server component ${n} should not be imported in client bundle`),``;if(!r.topLevelUseClient)return t;let o=x(t,r);if(o.length===0)return``;let s=JSON.stringify(n),c=`import {registerClientReference} from "react-server-dom-rari/server";
|
|
910
|
+
`;for(let e of o){if(e==="default"){let e=`Attempted to call the default export of ${n} from the server but it's 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.`;c+=`export default `,c+=`registerClientReference(function() {`,c+=`throw new Error(${JSON.stringify(e)});`}else{let t=`Attempted to call ${e}() from the server but ${e} 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.`;c+=`export const ${e} = `,c+=`registerClientReference(function() {`,c+=`throw new Error(${JSON.stringify(t)});`}c+=`},`,c+=`${s},`,c+=`${JSON.stringify(e)});\n`}return c}function he(e,t,n){return!n.topLevelUseClient||x(e,n).length===0?e:e.replace(bd,``)}let T=!1;async function ge(){let e=`http://localhost:${M()}`;try{let t=(await fetch(`${e}/_rari/health`,{signal:AbortSignal.timeout(1e3)})).ok;return T=t,t}catch{return T=!1,!1}}let _e=null;async function ve(e){return await ge()?!0:(_e??=(async()=>{try{let t=Date.now()+e,n=50;for(;Date.now()<t;){if(await new Promise(e=>{setTimeout(e,Math.min(n,t-Date.now()))}),await ge())return!0;n=Math.min(n*2,500)}return!1}finally{_e=null}})(),_e)}function ye(e){if(e.includes(`virtual:client-router`)||e.includes(`virtual:app-router-provider`)||e.includes(`virtual:error-boundary-wrapper`)||e.includes(`/navigation/client-router`)||e.includes(`/flight/app-router-provider`)||zd!=null&&O.resolve(e)===zd)return!0;if(!E.existsSync(e))return!1;try{return r.get(e).topLevelUseClient}catch{return!1}}function be(e,t){let n=e,r=[],i=/* @__PURE__ */ new Set;for(let e of Fn(n)){if(e.typeOnly||e.sideEffectOnly||!xd.test(e.source)&&!Sd(e.source,s))continue;let n=fe(e.source,t,s);if(!ye(n))continue;_(n,`client`),y(n);let a=Il(e,g(n));if(a.code!==``){for(let e of a.helpers)i.add(e);r.push({start:e.start,end:e.end,replacement:a.code})}}if(r.length===0)return n;for(let{start:e,end:t,replacement:i}of[...r].sort((e,t)=>t.start-e.start))n=n.slice(0,e)+i+n.slice(t);return i.size>0&&(n=Nl(n,`react-server-dom-rari/server`,[...i])),n}function xe(e,t){for(let n of t.importSources){if(!xd.test(n)&&!Sd(n,s))continue;let t=fe(n,e,s);E.existsSync(t)&&(r.get(t).topLevelUseServer||(_(t,`client`),y(t)))}}function Se(e){if(e.includes(`Suspense`))return e;let t=Dd.exec(e);return t?t[1]&&!t[2].includes(`Suspense`)?e.replace(t[0],t[0].replace(Ad,`{ Suspense, $1 }`)):t[1]?e:e.replace(t[0],`import React, { Suspense } from 'react';`):e}function Ce(e,t,n){return e&&!t&&(n===`rsc`||n===`ssr`)}function we(e,t,n){let r=t.includes(`entry-client`),i=[],a=/* @__PURE__ */ new Set,o=!1;for(let c of Fn(e)){if(c.typeOnly||c.sideEffectOnly||!xd.test(c.source)&&!Sd(c.source,s))continue;let e=fe(c.source,t,s),l=ye(e);if(l&&(_(e,`client`),y(e)),!Ce(l,r,n))continue;let u=Il(c,g(e));if(u.code!==``){for(let e of u.helpers)a.add(e);i.push({start:c.start,end:c.end,replacement:u.code}),o=!0}}return i.length===0?null:{replacements:i,clientRefHelpers:a,needsReactImport:o}}function Te(e,t,n){let r=we(e,t,n);if(r==null)return null;let i=e;for(let{start:e,end:t,replacement:n}of[...r.replacements].sort((e,t)=>t.start-e.start))i=i.slice(0,e)+n+i.slice(t);r.clientRefHelpers.size>0&&(i=Nl(i,`react-server-dom-rari/server`,[...r.clientRefHelpers]));let a=i.includes(`import React`)||Td.test(i)||Ed.test(i);r.needsReactImport&&!a&&(i=`import React from 'react';\n${i}`),i=Se(i);let o=k.env.NODE_ENV!==`production`;return(i.includes(`</`)||i.includes(`/>`)||kd.test(i))&&o&&_(t,`client`),i}function De(e,t,n,r){if(r===`rsc`||r===`ssr`)return be(C(e,t,n),t);let i=me(e,t,n);return`// HMR acceptance for server component
|
|
911
|
+
if (import.meta.hot) {
|
|
912
|
+
import.meta.hot.accept();
|
|
913
|
+
if (typeof globalThis !== 'undefined') {
|
|
914
|
+
if (!globalThis['~rari']) globalThis['~rari'] = {};
|
|
915
|
+
globalThis['~rari'].serverComponents = globalThis['~rari'].serverComponents || new Set();
|
|
916
|
+
globalThis['~rari'].serverComponents.add(${JSON.stringify(t)});
|
|
917
|
+
}
|
|
973
918
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
`}}if(t.endsWith(`.mjs`)&&b.existsSync(t))try{let n=e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:C.cwd(),r=b.realpathSync(t),i=S.relative(n,r),a=!i.startsWith(`..`)&&!S.isAbsolute(i),o=r.includes(`${S.sep}node_modules${S.sep}`),s=r.includes(`${S.sep}packages${S.sep}rari${S.sep}`)||r.includes(`${S.sep}packages${S.sep}use-cache${S.sep}`)||r.includes(`${S.sep}node_modules${S.sep}rari${S.sep}`)||r.includes(`${S.sep}node_modules${S.sep}@rari${S.sep}use-cache${S.sep}`);return a||o||s?b.readFileSync(t,`utf-8`):(console.warn(`[rari] Refusing to load .mjs file outside project root and node_modules: ${t}`),null)}catch(e){return console.warn(`[rari] Error validating .mjs file path: ${t}`,e),null}},async handleHotUpdate({file:e,server:t}){if(he(),e.endsWith(`.mdx`)&&_(),!v.test(e))return;if(se(e),fe(e),a.invalidate(e),_(),e.includes(`/dist/`)||e.includes(`\\dist\\`))return[];let n=f?.detectComponentType(e)??`unknown`,r=e.includes(`/app/`)||e.includes(`\\app\\`),i=(e,t)=>e.endsWith(`${t}.tsx`)||e.endsWith(`${t}.jsx`)||e.endsWith(`${t}.ts`)||e.endsWith(`${t}.js`),o=[`page`,`layout`,`template`,`loading`,`error`,`not-found`].some(t=>i(e,t));if(r&&o){if(f)try{await f.rebuildAndNotifyNow(e,t)}catch(t){console.error(`[rari] HMR: Failed to rebuild app router file`,`${e}:`,s(t,String(t)))}return}if(n!==`client`&&n===`server`)return f&&await f.handleServerComponentUpdate(e,t),[]},generateBundle(e,t){if(this.environment.name!==`client`)return;let n=hr(t);this.emitFile({type:`asset`,fileName:`rari-client-head.html`,source:n})},async writeBundle(){await lp(e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:C.cwd(),e,m,h)}},Ae=ys({...e.serverBuild,csp:e.csp,cacheControl:e.cacheControl,cache:e.cache,action:e.action,jsPoolSize:e.jsPoolSize,origin:e.origin,htmlLimitedBots:e.htmlLimitedBots,experimental:e.experimental,moduleAnalysisCache:a,mdx:e.mdx}),Me={name:`rari:patch-react-server-dom-webpack`,transform(e){if(!e.includes(`__webpack_require__`)&&!e.includes(`__webpack_chunk_load__`))return null;let t=e;return t.includes(`__webpack_chunk_load__`)&&(t=t.replaceAll(`__webpack_chunk_load__`,`__rari_chunk_load__`)),t.includes(`__webpack_require__.u`)&&(t=t.replaceAll(`__webpack_require__.u`,`({}).u`)),t.includes(`__webpack_require__`)&&(t=t.replaceAll(`__webpack_require__`,`__rari_rsc_require__`)),t===e?null:{code:t,map:null}}},Ne=[...cf()];return e.compiler!=null&&e.compiler!==!1&&Ne.push(uc(e.compiler)),Ne.push(x,$n(),Va(),qi(),Me,Ae),e.proxy!==!1&&Ne.push(Ge(e.proxy??{})),e.router!==!1&&Ne.push(Bt(e.router??{})),Ve(Ne)}function fp(e){return{...e,plugins:[dp(),...e.plugins??[]]}}export{e as ApiResponse,wf as clearPropsCache,Tf as clearPropsCacheForComponent,fp as defineRariConfig,up as defineRariOptions,yf as extractMetadata,vf as extractServerProps,Cf as extractServerPropsWithCache,bf as extractStaticParams,Et as generateAppRouteManifest,xf as hasServerSideDataFetching,dp as rari,Ge as rariProxy,Bt as rariRouter};
|
|
919
|
+
|
|
920
|
+
${i}`}function D(e,t){if(t.startsWith(`\0`)||t.includes(`virtual:`))return z(e);try{return r.get(t)}catch{return z(e)}}async function A(t,n){if(!e.experimental?.useCache&&!e.experimental?.useCacheRemote)return{code:t,wasTransformed:!1};let r=(await Ju())(t,n);return r==null||r===``?{code:t,wasTransformed:!1}:{code:r,wasTransformed:!0}}function ke(e,t,n,r){if(n.topLevelUseServer)return _(t,`server`),r===`rsc`?C(e,t,n):me(e,t,n);if(n.topLevelUseClient)return _(t,`client`),y(t),xe(t,n),he(e,t,n);if(r!==`rsc`&&r!==`ssr`&&(h(t)===`client`||ee(t)))return he(e,t,n);if(b(t))return _(t,`server`),De(e,t,n,r);let i=h(t);return i===`server`?r===`rsc`||r===`ssr`?be(C(e,t,n),t):me(e,t,n):i===`client`?he(e,t,n):(_(t,`unknown`),Te(e,t,r))}let Ae={name:`rari`,config(e,{command:t}){e.appType=`custom`,e.define??={};let n=typeof e.css?.modules==`object`?e.css.modules:{};e.css={...e.css,transformer:e.css?.transformer??`lightningcss`,modules:{...n,pattern:`[hash]_[local]`}},e.resolve??={};let r=e.resolve,i=Array.isArray(r.dedupe)?r.dedupe:[];r.dedupe=[...new Set(i).union(/* @__PURE__ */ new Set([`react`,`react-dom`]))];let a=wf(r),o=new Set(a.map(e=>String(e.find))),s=a.some(e=>wd(e.find));try{r.alias=[...a,...qd(o,s)]}catch(e){Cd(e)||console.warn(`[rari] Unexpected error configuring React aliases:`,e)}if(_f(e),e.builder??={},e.builder.sharedPlugins=!0,e.builder.sharedConfigBuild=!1,vf(e),t===`build`)for(let t of[`rsc`,`ssr`,`client`]){let n=e.environments[t];n.build!=null&&(n.build.rolldownOptions??={})}return yf(e),t===`build`&&Sf(e),Cf(e),e},async buildStart(){if(Lr(),e.experimental?.useCache||e.experimental?.useCacheRemote)try{await Ju()}catch(e){this.error(e instanceof Error?e:Error(String(e)))}},configResolved(e){let t=Ut(e);l=t.assetsDir,u=t.outDir,Object.assign(s,Ht(e))},async transform(t,n){if(n.endsWith(`.mdx`)&&p(),/\.(?:tsx?|jsx?|mts|mjs)$/.test(n)&&t.includes(`defineMdxComponents`)){let r=Fu({code:t,id:n,projectRoot:e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd(),resolvedAlias:s});if(r!=null&&r!==``)return oi(r,t,n)}if(!S.test(n))return null;let r=t,i=await A(t,n);t=i.code;let a=ke(t,n,D(t,n),this.environment.name);return a==null?i.wasTransformed?oi(t,r,n):null:oi(a,r,n)},async configureServer(t){let n=O.resolve(e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd()),d=O.join(n,`src`);await Gd(n,e,l,u);let p=/* @__PURE__ */ new Map([[`/installHook.js.map`,`installHook.js`],[`/react_devtools_backend_compact.js.map`,`react_devtools_backend_compact.js`],[`/installHook.js`,null],[`/react_devtools_backend_compact.js`,null]]);t.middlewares.use((e,t,n)=>{let r=se(e.url??``);if(!p.has(r)){n();return}let i=p.get(r);if(t.statusCode=200,t.setHeader(`Cache-Control`,`no-store`),i!=null){t.setHeader(`Content-Type`,`application/json`),t.end(JSON.stringify({version:3,file:i,sources:[i],sourcesContent:[`/* react-devtools extension stub */`],names:[],mappings:`AAAA`}));return}t.setHeader(`Content-Type`,`application/javascript; charset=utf-8`),t.end(`/* react-devtools extension stub */
|
|
921
|
+
`)});let m=async()=>{try{let a=new Dl(n,{outDir:u,rscDir:`server`,manifestPath:`server/manifest.json`,serverConfigPath:`server/config.json`,alias:s,assetsDir:l,csp:e.csp,cacheControl:e.cacheControl,cache:e.cache,action:e.action,jsPoolSize:e.jsPoolSize,origin:e.origin,htmlLimitedBots:e.htmlLimitedBots,experimental:e.experimental,moduleAnalysisCache:r});if(a.setViteBuilder(await le({root:n,configFile:t.config.configFile,logLevel:`error`})),i=a,o??=new Oo(a,M()),E.existsSync(d)){let e=jl(d,a,Object.values(s));e.serverComponentPaths.length>0&&t.ws.send({type:`custom`,event:`rari:server-components-registry`,data:{serverComponents:e.serverComponentPaths}})}let f=await a.getTransformedComponentsForDevelopment(),p=`http://localhost:${M()}`;await Promise.all(f.map(async e=>{try{if(e.id.startsWith(`app/`)||e.isAction)return;let t=await fetch(`${p}/_rari/register`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:e.id,component_code:e.code})});if(!t.ok){let e=await t.text();throw Error(`HTTP ${t.status}: ${e}`)}}catch(t){console.error(`[rari] Runtime: Failed to register component ${e.id}:`,c(t,String(t)))}}))}catch(e){console.error(`[rari] Runtime: Component discovery failed:`,c(e,String(e)))}},h=async()=>{try{let e=`http://localhost:${M()}`,t=ne();await Promise.all([...t].map(async t=>{let n=O.relative(k.cwd(),t),r=O.basename(t).replace(ie,``);try{await fetch(`${e}/_rari/register-client`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:r,file_path:n,export_name:`default`})})}catch(e){console.error(`[rari] Runtime: Failed to pre-register client component ${r}:`,e)}}))}catch(e){console.error(`[rari] Runtime: Failed to pre-register client components:`,e)}},g=async()=>{if(a)return;let{getBinaryPath:r,getInstallationInstructions:i}=await import(`./platform.mjs`),o;try{o=r()}catch(e){console.error(`rari binary not found`),console.error(` ${c(e,String(e))}`),console.error(i());return}let l=M(),u=k.env.NODE_ENV===`production`?`production`:`development`,d=t.config.server.port,f=e.origin?.trim().replace(/\/+$/,``),p=k.env.RARI_ORIGIN?.trim().replace(/\/+$/,``),g=Wr(n,s),_=[`--mode`,u,`--port`,l.toString(),`--host`,`127.0.0.1`];a=Ee(o,_,{stdio:[`ignore`,`pipe`,`pipe`],cwd:n,env:{...k.env,RUST_LOG:k.env.RUST_LOG!=null&&k.env.RUST_LOG!==``?k.env.RUST_LOG:`error`,RARI_VITE_PORT:d.toString(),...g.length>0?{RARI_DEV_LAYOUT_CSS:g.join(`,`)}:{},...e.jsPoolSize!=null&&(k.env.RARI_JS_POOL_SIZE==null||k.env.RARI_JS_POOL_SIZE===``)?{RARI_JS_POOL_SIZE:String(e.jsPoolSize)}:{},...f!=null&&f!==``&&(p==null||p===``)?{RARI_ORIGIN:f}:{},...e.htmlLimitedBots!=null&&(k.env.RARI_HTML_LIMITED_BOTS==null||k.env.RARI_HTML_LIMITED_BOTS===``)?{RARI_HTML_LIMITED_BOTS:e.htmlLimitedBots}:{}}}),a.stdout?.on(`data`,e=>{let t=e.toString().trim();t&&console.error(t)}),a.stderr?.on(`data`,e=>{let t=e.toString().trim();t&&!t.includes(`warning`)&&console.error(t)}),a.on(`error`,e=>{T=!1,console.error(`Failed to start rari server:`,e.message),e.message.includes(`ENOENT`)&&console.error(` Binary not found. Please ensure rari is properly installed.`)}),a.on(`exit`,(e,t)=>{a=null,T=!1,t?console.error(`rari server stopped by signal ${t}`):e===0?console.error(`rari server stopped successfully`):e&&console.error(`rari server exited with code ${e}`)}),await ve(1e4)?(await m(),await h()):console.error(`Server failed to become ready for component registration`)},_=async e=>{try{if(!b(e))return;i??await m();let t=i;if(t==null)return;let n=r.getSource(e);t.addServerComponent(e,n);let a=wo(t.getImportGraph(),[e]);a.add(e);let o=await t.getTransformedComponentsForDevelopment(e=>a.has(e));if(o.length===0)return;let s=`http://localhost:${M()}`;await Promise.all(o.map(async e=>{try{let t=await fetch(`${s}/_rari/register`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({component_id:e.id,component_code:e.code})});if(!t.ok){let e=await t.text();throw Error(`HTTP ${t.status}: ${e}`)}}catch(t){console.error(`[rari] Failed to register component`,`${e.id}:`,c(t,String(t)))}}))}catch(t){console.error(`[rari] Targeted HMR failed for`,`${e}:`,c(t,String(t)))}};g().catch(e=>{console.error(`[rari] Failed to start Rust server:`,e)}),t.middlewares.use((e,t,n)=>{(async()=>{let r=e.headers.accept,i=e.method??`GET`,a=e.url??``,o=se(a),s=r!=null&&r!==``&&r.includes(`text/x-component`);if(Zd(s,of(i,r,o),a,o)){n();return}if(!T&&!await ve(1e4)){console.error(`[rari] Rust server not ready, cannot proxy ${s?`RSC`:`HTML`} request`),t.headersSent||(t.statusCode=503,t.end(`Server not ready`));return}let c=M();try{let n=sf(e.headers,c),r=i!==`GET`&&i!==`HEAD`?await ud(e,10485760):void 0,o=await fetch(`http://localhost:${c}${a}`,{method:i,headers:n,...r==null?{}:{body:r}});t.statusCode=o.status,o.headers.forEach((e,n)=>{n.toLowerCase()!==`content-encoding`&&t.setHeader(n,e)}),await cf(o,t,i)}catch(e){Tf(e,t,s)}})()}),t.watcher.on(`change`,e=>{(async()=>{S.test(e)&&(v(e),te(e),r.invalidate(e)),S.test(e)&&ce(e,d)&&b(e)&&(t.ws.send({type:`custom`,event:`rari:register-server-component`,data:{filePath:e}}),await _(e))})()}),t.middlewares.use(`/api/vite/hmr-transform`,(e,t)=>{if(e.method!==`POST`){t.statusCode=405,t.end(`Method Not Allowed`);return}(async()=>{try{let n=await Oe(e),r=f(n),i=r&&typeof r.filePath==`string`?r.filePath:void 0;if(i==null||i===``){t.statusCode=400,t.end(JSON.stringify({error:`filePath is required`}));return}await _(i),t.statusCode=200,t.setHeader(`Content-Type`,`application/json`),t.end(JSON.stringify({success:!0,filePath:i,message:`Component transformation completed`}))}catch(e){t.statusCode=500,t.setHeader(`Content-Type`,`application/json`),t.end(JSON.stringify({success:!1,error:c(e,String(e))}))}})()}),t.httpServer?.on(`close`,()=>{if(de(n),i!=null&&(i.setViteBuilder(null),i=null),o&&=(o.dispose(),null),a){let e=a;a=null,T=!1;let t=!1,n=setTimeout(()=>{t||e.kill(`SIGKILL`)},5e3);n.unref(),e.once(`exit`,()=>{t=!0,clearTimeout(n)}),e.kill(`SIGTERM`);return}T=!1})},resolveId(e,t){let n=uf(e);if(n!=null)return n;if(e===`react-server-dom-webpack/client`||e===`react-server-dom-webpack/client.browser`)return`virtual:react-flight-client.ts`;if(e===`react-server-dom-rari/server`)return e;if(t!=null&&t!==``&&t.startsWith(`virtual:`)){let n=ff(e,t);if(n!=null)return n}return rf(e,b)},async load(t){if(S.test(t)&&this.environment.name===`client`)try{let e=r.get(t);if(e.topLevelUseServer)return me(r.getSource(t),t,e)}catch{}let n=await nf(t,{buildMdxRegistryModule:m,resolveProjectRoot:()=>e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd(),resolvedAlias:s,moduleAnalysisCache:r,getKnownClientComponentPaths:ne,environmentMode:this.environment.mode});return n===void 0?ef(t,e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd())??void 0:n},async handleHotUpdate({file:e,server:t}){if(ue(),e.endsWith(`.mdx`)&&p(),!S.test(e))return;if(v(e),te(e),r.invalidate(e),p(),e.includes(`/dist/`)||e.includes(`\\dist\\`))return[];let n=o?.detectComponentType(e)??`unknown`,i=e.includes(`/app/`)||e.includes(`\\app\\`),a=(e,t)=>e.endsWith(`${t}.tsx`)||e.endsWith(`${t}.jsx`)||e.endsWith(`${t}.ts`)||e.endsWith(`${t}.js`),s=[`page`,`layout`,`template`,`loading`,`error`,`not-found`].some(t=>a(e,t));if(i&&s){if(o)try{await o.rebuildAndNotifyNow(e,t)}catch(t){console.error(`[rari] HMR: Failed to rebuild app router file`,`${e}:`,c(t,String(t)))}return}if(n!==`client`&&n===`server`)return o&&await o.handleServerComponentUpdate(e,t),[]},generateBundle(e,t){if(this.environment.name!==`client`)return;let n=Jr(t);this.emitFile({type:`asset`,fileName:`rari-client-head.html`,source:n})},async writeBundle(){await Gd(e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd(),e,l,u)}},je=Ml({...e.serverBuild,csp:e.csp,cacheControl:e.cacheControl,cache:e.cache,action:e.action,jsPoolSize:e.jsPoolSize,origin:e.origin,htmlLimitedBots:e.htmlLimitedBots,experimental:e.experimental,moduleAnalysisCache:r,mdx:e.mdx}),Me={name:`rari:patch-react-server-dom-webpack`,transform(e){if(!e.includes(`__webpack_require__`)&&!e.includes(`__webpack_chunk_load__`)&&!e.includes(`__webpack_get_script_filename__`))return null;let t=e;return t.includes(`__webpack_chunk_load__`)&&(t=t.replaceAll(`__webpack_chunk_load__`,`__rari_chunk_load__`)),t.includes(`__webpack_get_script_filename__`)&&(t=t.replaceAll(`__webpack_get_script_filename__`,`__rari_get_script_filename__`)),t.includes(`__webpack_require__.u`)&&(t=t.replaceAll(`__webpack_require__.u`,`({}).u`)),t.includes(`__webpack_require__`)&&(t=t.replaceAll(`__webpack_require__`,`__rari_rsc_require__`)),t===e?null:{code:t,map:null}}},j=[...Ku()];return e.compiler!=null&&e.compiler!==!1&&j.push(Uu(e.compiler)),j.push(Ae,xs(),bo(),Me,je,yi(e.projectRoot!=null&&e.projectRoot!==``?e.projectRoot:k.cwd())),e.proxy!==!1&&j.push(ze(e.proxy??{})),e.router!==!1&&j.push(Mt(e.router??{})),Fe(j)}function Of(e){return{...e,plugins:[Df(),...e.plugins??[]]}}export{t as ApiResponse,sd as clearPropsCache,cd as clearPropsCacheForComponent,Of as defineRariConfig,Ef as defineRariOptions,nd as extractMetadata,td as extractServerProps,od as extractServerPropsWithCache,rd as extractStaticParams,vt as generateAppRouteManifest,id as hasServerSideDataFetching,Df as rari,ze as rariProxy,Mt as rariRouter};
|