rari 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/api-routes-Dc2tv31o.mjs +1 -0
  2. package/dist/cli.d.mts +1 -1
  3. package/dist/cli.mjs +39 -39
  4. package/dist/constants-CRK2JRKf.mjs +1 -0
  5. package/dist/{define-CRafeveU.mjs → define-B_ozIapW.mjs} +1 -1
  6. package/dist/dist-paths-C4EV064W.mjs +1 -0
  7. package/dist/{execute-B1z6YRUF.mjs → execute-CbhDMAQ3.mjs} +1 -1
  8. package/dist/feed-NrJzjZyg.mjs +10 -0
  9. package/dist/form-state-DAygOjc8.mjs +1 -0
  10. package/dist/get-client-component-s7qprTUa.mjs +1 -0
  11. package/dist/headers.d.mts +1 -1
  12. package/dist/image/static.d.mts +1 -0
  13. package/dist/image/static.mjs +1 -0
  14. package/dist/image.d.mts +4 -35
  15. package/dist/image.mjs +1 -1
  16. package/dist/index.d.mts +6 -1
  17. package/dist/index.mjs +1 -1
  18. package/dist/mdx/define.mjs +1 -1
  19. package/dist/mdx.mjs +1 -1
  20. package/dist/navigation-transition-store-CSKrbtbK.mjs +1 -0
  21. package/dist/path-CTEC1xmy.mjs +1 -0
  22. package/dist/preload-modules-Dv_GzGCm.mjs +2 -0
  23. package/dist/proxy/RariResponse.mjs +1 -1
  24. package/dist/proxy/runtime-executor.mjs +1 -1
  25. package/dist/regex-constants-DzXwNGh2.mjs +1 -0
  26. package/dist/{robots-B1bFAd4J.mjs → robots-BOPIkPcN.mjs} +1 -1
  27. package/dist/router-Cl4J7j1A.mjs +1 -0
  28. package/dist/router.d.mts +8 -5
  29. package/dist/router.mjs +1 -1
  30. package/dist/{rsc-vite-build-Cpu5suGN.mjs → rsc-vite-build-CSnu8C3P.mjs} +1 -1
  31. package/dist/runtime/AppRouterProvider.mjs +1 -1
  32. package/dist/runtime/ClientRouter.mjs +4 -4
  33. package/dist/runtime/call-server.mjs +1 -1
  34. package/dist/runtime/entry-client.d.mts +1 -1
  35. package/dist/runtime/entry-client.mjs +3 -3
  36. package/dist/runtime/flight-router-state.d.mts +1 -0
  37. package/dist/runtime/flight-router-state.mjs +1 -1
  38. package/dist/runtime/merge-flight-refresh.d.mts +4 -0
  39. package/dist/runtime/merge-flight-refresh.mjs +1 -1
  40. package/dist/runtime/rsc-client-runtime.d.mts +1 -1
  41. package/dist/runtime/rsc-client-runtime.mjs +1 -1
  42. package/dist/serialize-router-state-uOGGpmBr.mjs +1 -0
  43. package/dist/sitemap--bdIkWl5.mjs +13 -0
  44. package/dist/static-modules-DBL6iFbg.d.mts +61 -0
  45. package/dist/{types-Q-x_0kVB.d.mts → types-C8N3Hc8I.d.mts} +1 -0
  46. package/dist/{types-xTbuE-Js.d.mts → types-DfSnnFaF.d.mts} +3 -1
  47. package/dist/vite.d.mts +3 -1
  48. package/dist/vite.mjs +141 -197
  49. package/dist/{xml-EW5iM39h.mjs → xml-DPsk9WTz.mjs} +1 -1
  50. package/package.json +20 -17
  51. package/dist/api-routes-ChRr3O5-.mjs +0 -1
  52. package/dist/constants-BFdy-wPN.mjs +0 -1
  53. package/dist/feed-uUGeOZmR.mjs +0 -10
  54. package/dist/form-state-DZJs9bve.mjs +0 -1
  55. package/dist/get-client-component-DU5z65us.mjs +0 -1
  56. package/dist/path-C74rvUep.mjs +0 -1
  57. package/dist/preload-modules-1i2BJqux.mjs +0 -2
  58. package/dist/prompt-uaCPq0_A-BW0EkzOD.mjs +0 -45
  59. package/dist/regex-constants-DBMCJbMw.mjs +0 -1
  60. package/dist/router-D6X8JHst.mjs +0 -1
  61. package/dist/runtime/LoadingErrorBoundary.d.mts +0 -10
  62. package/dist/runtime/LoadingErrorBoundary.mjs +0 -1
  63. package/dist/sitemap-DJY3OiJ0.mjs +0 -13
@@ -1 +1 @@
1
- "use client";import{d as e,i as t,p as n,r,v as i,w as a}from"../type-guards-BJXKlA6x.mjs";import{f as o}from"../regex-constants-DBMCJbMw.mjs";import"./action-revalidation-kind.mjs";import{mergeFlightRefresh as s}from"./merge-flight-refresh.mjs";import{currentRouteLocation as c,flightRouteCache as l}from"./flight-route-cache.mjs";import{t as u}from"../preload-modules-1i2BJqux.mjs";import{n as d,r as f}from"../form-state-DZJs9bve.mjs";import{c as ee}from"react/compiler-runtime";import*as p from"react";import{Suspense as m,addTransitionType as h,startTransition as g,use as _,useEffect as v,useLayoutEffect as y,useRef as b,useState as te,useTransition as ne}from"react";import{Fragment as re,jsx as x,jsxs as S}from"react/jsx-runtime";import{createFromFetch as ie,createFromReadableStream as ae}from"virtual:react-flight-client";const oe={position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,padding:`24px`,background:`rgba(220, 38, 38, 0.95)`,color:`white`,borderRadius:`8px`,fontSize:`14px`,zIndex:1e4,maxWidth:`500px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.3)`},C={padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},w={padding:`8px 16px`,background:`rgba(255, 255, 255, 0.2)`,color:`white`,border:`1px solid rgba(255, 255, 255, 0.3)`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},T={fetch:`Failed to fetch updated content from server.`,parse:`Failed to parse server response.`,stale:`Server returned stale content.`,network:`Network error occurred.`};function se(e){return T[e]}function ce(e){let t=ee(27),{failure:n,maxRetries:r,onRefresh:i,onDismiss:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ x(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),s={marginBottom:`12px`,opacity:.9},t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c;t[2]===n.type?c=t[3]:(c=se(n.type),t[2]=n.type,t[3]=c);let l;t[4]===c?l=t[5]:(l=/* @__PURE__ */ x(`div`,{style:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},t[6]=u):u=t[6];let d;t[7]===n.details?d=t[8]:(d=/* @__PURE__ */ x(`div`,{style:u,children:n.details}),t[7]=n.details,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f={marginBottom:`12px`,fontSize:`12px`,opacity:.7},t[9]=f):f=t[9];let p;t[10]!==n.consecutiveFailures||t[11]!==r?(p=/* @__PURE__ */ S(`div`,{style:f,children:[`Consecutive failures: `,n.consecutiveFailures,` / `,r]}),t[10]=n.consecutiveFailures,t[11]=r,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m={display:`flex`,gap:`8px`},t[13]=m):m=t[13];let h;t[14]===i?h=t[15]:(h=/* @__PURE__ */ x(`button`,{onClick:i,type:`button`,style:C,children:`Refresh Page`}),t[14]=i,t[15]=h);let g;t[16]===a?g=t[17]:(g=/* @__PURE__ */ x(`button`,{onClick:a,type:`button`,style:w,children:`Dismiss`}),t[16]=a,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=/* @__PURE__ */ S(`div`,{style:m,children:[h,g]}),t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=/* @__PURE__ */ x(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`}),t[21]=v):v=t[21];let y;return t[22]!==_||t[23]!==l||t[24]!==d||t[25]!==p?(y=/* @__PURE__ */ S(`div`,{style:oe,children:[o,l,d,p,_,v]}),t[22]=_,t[23]=l,t[24]=d,t[25]=p,t[26]=y):y=t[26],y}function le(e){return e.historyKey!=null&&e.historyKey!==``?[`nav`,`nav-traverse`]:e.replace===!0?[`nav`,`nav-replace`]:[`nav`,`nav-forward`]}function E(e){e!=null&&typeof window<`u`&&(e.replace===!0?window.history.replaceState(e.state,``,e.url):window.history.pushState(e.state,``,e.url))}function ue(e){let{parsedPayload:t,shouldScrollToTop:n,navigationId:r,transitionTypes:i,pendingHistory:a,startTransition:o=g,currentNavigationIdRef:s,pendingScrollPayloadRef:c,setRenderKey:l,setRscPayload:u,clearHmrError:d,pendingNavigateCommittedIdRef:f}=e;o(()=>{if(s.current===r){if(i!=null)for(let e of i)h(e);E(a),l(e=>{let r=e+1;return c.current=n?{payload:t,commitKey:r}:null,r}),u(t),d(),f.current=r}})}function de(e){let t=Promise.resolve(e);return t.status=`fulfilled`,t.value=e,t}function D({thenable:e}){return _(e)}function fe(e){let t=ee(4),{content:r}=e,i;t[0]===r?i=t[1]:(i=n(r)?r:de(r),t[0]=r,t[1]=i);let a=i,o;return t[2]===a?o=t[3]:(o=/* @__PURE__ */ x(D,{thenable:a}),t[2]=a,t[3]=o),o}function pe(e){return p.isValidElement(e)||e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function me(e){if(!Array.isArray(e))return e;let t=e;return t.length===1&&p.isValidElement(t[0])?t[0]:t.length>0&&t.every(pe)?p.createElement(p.Fragment,null,...t):e}function he(e,t,n){return e==null||e.commitKey!==n?{shouldScroll:!1,nextPending:null}:t===e.payload?{shouldScroll:!0,nextPending:null}:{shouldScroll:!1,nextPending:e}}const ge=/"timestamp":(\d+)/;function _e(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||p.isValidElement(e)||Array.isArray(e)}function ve(e){return i(e)&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.navigationId==`number`&&i(e.options)}function ye(e){return i(e)&&`element`in e}function be(e){return i(e)&&typeof e.navigationId==`number`&&typeof e.targetPath==`string`}function xe(e){if(!n(e))return e;if(i(e)&&e.status===`fulfilled`)return _e(e.value)?e.value:void 0}function O(h){let g=ee(44),{children:_,initialPayload:oe,onNavigate:C}=h,[w,T]=te(oe),se=b(oe),[E,de]=te(0),[,D]=ne(),pe=b(D),O;g[0]===Symbol.for(`react.memo_cache_sentinel`)?(O={x:0,y:0},g[0]=O):O=g[0];let k=b(O),A=b(null),j;g[1]===Symbol.for(`react.memo_cache_sentinel`)?(j=/* @__PURE__ */ new Map,g[1]=j):j=g[1];let Oe=b(j),M;g[2]===Symbol.for(`react.memo_cache_sentinel`)?(M=/* @__PURE__ */ new Set,g[2]=M):M=g[2];let N=b(M),ke=b(C),P=b(0),Ae=b(null),F;g[3]===Symbol.for(`react.memo_cache_sentinel`)?(F=/* @__PURE__ */ new Map,g[3]=F):F=g[3];let I=b(F),L;g[4]===Symbol.for(`react.memo_cache_sentinel`)?(L=[],g[4]=L):L=g[4];let je=b(L),R=b(null),z=b(0),[B,V]=te(null),H,U;g[5]===C?(H=g[6],U=g[7]):(H=()=>{ke.current=C},U=[C],g[5]=C,g[6]=H,g[7]=U),v(H,U);let W,G;g[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{pe.current=D},G=[D],g[8]=W,g[9]=G):(W=g[8],G=g[9]),v(W,G);let K,q;g[10]!==E||g[11]!==w?(K=()=>{let{shouldScroll:e,nextPending:t}=he(A.current,w,E);A.current=t,e&&window.scrollTo(0,0);let n=Ae.current;n!=null&&(Ae.current=null,window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:n}})))},q=[w,E],g[10]=E,g[11]=w,g[12]=K,g[13]=q):(K=g[12],q=g[13]),y(K,q);let Me=De,J,Ne;g[14]===w?(J=g[15],Ne=g[16]):(J=()=>{se.current=w,w?.element!=null&&Me(w.element)},Ne=[w],g[14]=w,g[15]=J,g[16]=Ne),v(J,Ne);let Pe,Fe;g[17]===w?(Pe=g[18],Fe=g[19]):(Pe=()=>{if(w?.element!=null){let e=w.element;if(i(e)&&`status`in e&&e.status===`rejected`){let t=e.reason;t!=null&&t!==``&&console.error(`[rari] AppRouter: Flight payload rejected:`,t)}}},Fe=[w],g[17]=w,g[18]=Pe,g[19]=Fe),v(Pe,Fe);let Ie;g[20]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=()=>{Oe.current=d()},g[20]=Ie):Ie=g[20];let Le=Ie,Re;g[21]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>{f(Oe.current)},g[21]=Re):Re=g[21];let ze=Re,Be;g[22]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(e,t,n,r)=>{z.current+=1;let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r,consecutiveFailures:z.current};je.current.push(i),je.current.length>10&&je.current.shift(),z.current>=2&&V(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},g[22]=Be):Be=g[22];let Ve=Be,Y=Ee,He;g[23]===Symbol.for(`react.memo_cache_sentinel`)?(He=()=>{z.current>0&&(z.current=0)},g[23]=He):He=g[23];let Ue=He,We;g[24]===Symbol.for(`react.memo_cache_sentinel`)?(We=e=>{if(R.current==null||R.current===``)return!1;if(e===R.current)return!0;let t=ge.exec(e);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1},g[24]=We):We=g[24];let Ge=We,Ke;g[25]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=e=>{u(e,N.current);let t=new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}}),n=ae(t);return{element:n,rawElement:n,flightProtocol:e}},g[25]=Ke):Ke=g[25];let qe=Ke,Je;g[26]===Symbol.for(`react.memo_cache_sentinel`)?(Je=async e=>{let t=await e;if(!t.body)throw Error(`Response has no body stream`);let n=t.clone(),r=ie(Promise.resolve(t));return n.text().then(async e=>{await u(e,N.current),e!==``&&(R.current=e)}).catch(Te),{element:r,rawElement:r,flightProtocol:``}},g[26]=Je):Je=g[26];let Ye=Je,Xe;g[27]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=async(t,n)=>{let r=t!=null&&t!==``?t:window.location.pathname,i=P.current,s=`${i}:${r}${window.location.search}`,c=I.current.get(s);if(c)return c;let l=(async()=>{let t;try{let e=(import.meta.env.RARI_SERVER_URL!=null&&import.meta.env.RARI_SERVER_URL!==``?import.meta.env.RARI_SERVER_URL:window.location.origin).replace(o,``)+r+window.location.search,c=await fetch(e,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(P.current)},cache:`no-store`,signal:n});if(c.ok){let e,n=``;try{if(n=await c.clone().text(),Ge(n)){I.current.delete(s);return}await u(n,N.current);let t=ie(Promise.resolve(c));e={element:t,rawElement:t,flightProtocol:n}}catch(e){let n=a(e);Ve(n,`parse`,`Failed to parse RSC Flight protocol: ${n.message}`,window.location.pathname),t=n}if(t==null)return P.current===i&&(T(e),n!==``&&(R.current=n),Ue()),I.current.delete(s),e}else{let n=/* @__PURE__ */ Error(`Failed to fetch RSC data: ${c.status} ${c.statusText}`);Ve(n,`fetch`,`HTTP ${c.status} when fetching ${e}`,window.location.pathname),t=n}}catch(n){let r=n;e(r)&&!r.message.includes(`Failed to fetch RSC data`)&&!r.message.includes(`Failed to parse`)&&Ve(r,`network`,`Network error: ${r.message}`,window.location.pathname),t=r}if(I.current.delete(s),t!=null)throw a(t)})();return I.current.set(s,l),l},g[27]=Xe):Xe=g[27];let Ze=Xe,Qe=b(qe),$e=b(Ye),X=b(Ze),et;g[28]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>{Qe.current=qe,$e.current=Ye,X.current=Ze},g[28]=et):et=g[28],v(et);let tt,nt;g[29]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>{if(typeof window>`u`)return;let i=async n=>{let r=t(n,ve);if(!r||r.navigationId!==P.current)return;k.current={x:window.scrollX,y:window.scrollY},Le();let i,o=null;try{if(r.rscResponsePromise){let e=await r.rscResponsePromise;if(P.current!==r.navigationId||(i=await $e.current(Promise.resolve(e)),P.current!==r.navigationId))return}else if(r.rscResponse){if(i=await $e.current(Promise.resolve(r.rscResponse)),P.current!==r.navigationId)return}else r.rscFlightProtocol!=null&&r.rscFlightProtocol!==``?i=await Qe.current(r.rscFlightProtocol):r.isStreaming||(i=await X.current(r.to,r.abortSignal))}catch(t){let n=t;if(e(n)&&n.name===`AbortError`)return;o=a(n)}if(o){console.error(`[rari] AppRouter: Navigation failed:`,o),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:r.from,to:r.to,error:o,navigationId:r.navigationId}})),z.current>=3&&Y();return}if((i||!r.isStreaming||P.current!==r.navigationId)&&i&&P.current===r.navigationId){let e=r.pendingHistory?.url,t=e!=null&&e!==``?new URL(e,window.location.origin).hash.length>0:window.location.hash.length>0,n=(r.options.historyKey==null||r.options.historyKey===``)&&!t&&r.options.scroll!==!1,a=r.navigationId;ue({parsedPayload:i,shouldScrollToTop:n,navigationId:a,transitionTypes:le({historyKey:r.options.historyKey,replace:r.options.replace}),pendingHistory:r.pendingHistory,startTransition:pe.current,currentNavigationIdRef:P,pendingScrollPayloadRef:A,setRenderKey:de,setRscPayload:T,clearHmrError:()=>{V(null)},pendingNavigateCommittedIdRef:Ae}),i.flightProtocol!=null&&i.flightProtocol!==``&&(R.current=i.flightProtocol),Ue(),ke.current&&ke.current(r)}},o=async()=>{k.current={x:window.scrollX,y:window.scrollY},Le();try{await X.current(),de(we),V(null)}catch(e){let t=e;console.error(`HMR refetch error:`,r(t,String(t))),z.current>=3&&Y()}requestAnimationFrame(()=>{window.scrollTo(k.current.x,k.current.y),ze()})},u=e=>{let r=t(e,ye);if(r?.element!=null&&(_e(r.element)||n(r.element))){k.current={x:window.scrollX,y:window.scrollY},Le();try{let{pathname:e,search:t}=c();r.revalidationKind===1?l.clear():r.revalidatedPath!=null&&r.revalidatedPath!==``?l.invalidate(r.revalidatedPath,t):l.invalidate(e,t);let i=se.current?.element,a=l.getElement(e,t)??(i!=null&&n(i)?null:i??null),o=r.element,u=n(o)?o:s(a,o);p.startTransition(()=>{T({element:u,rawElement:u}),V(null)}),Me(u),Ue()}catch(e){let t=a(e);Ve(t,`parse`,`Action flight refresh failed: ${t.message}`,window.location.pathname),z.current>=3&&Y()}requestAnimationFrame(()=>{window.scrollTo(k.current.x,k.current.y),ze()})}},d=async()=>{try{await X.current(),de(Ce),V(null)}catch(e){let t=e;console.error(`RSC invalidate error:`,r(t,String(t))),z.current>=3&&Y()}},f=e=>{let n=t(e,be);n&&(N.current.clear(),P.current=n.navigationId,A.current=null)},ee=async()=>{try{await X.current(),V(null)}catch(e){let t=e;console.error(`Manifest update error:`,r(t,String(t))),z.current>=3&&Y()}},m=e=>{i(e)},h=()=>{o()},g=()=>{d()},_=()=>{ee()};return window.addEventListener(`rari:navigation-start`,f),window.addEventListener(`rari:navigate`,m),window.addEventListener(`rari:app-router-rerender`,h),window.addEventListener(`rari:action-flight-refresh`,u),window.addEventListener(`rari:rsc-invalidate`,g),window.addEventListener(`rari:app-router-manifest-updated`,_),()=>{window.removeEventListener(`rari:navigation-start`,f),window.removeEventListener(`rari:navigate`,m),window.removeEventListener(`rari:app-router-rerender`,h),window.removeEventListener(`rari:action-flight-refresh`,u),window.removeEventListener(`rari:rsc-invalidate`,g),window.removeEventListener(`rari:app-router-manifest-updated`,_)}},nt=[],g[29]=tt,g[30]=nt):(tt=g[29],nt=g[30]),v(tt,nt);let rt,it;g[31]===w?(rt=g[32],it=g[33]):(rt=()=>{if(typeof window<`u`&&window.location.hash&&w){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`instant`,block:`start`})})})}},it=[w],g[31]=w,g[32]=rt,g[33]=it),v(rt,it);let at=w?.element??_,ot=me(at),[st,ct]=te(null),lt=xe(ot);if(lt!==void 0&&(st==null||!Object.is(at,st.raw))){let e=me(lt);n(e)||ct({raw:at,content:e})}let ut=st?.content??null,Z;g[34]===B?Z=g[35]:(Z=B&&/* @__PURE__ */ x(ce,{failure:B,maxRetries:3,onRefresh:Se,onDismiss:()=>{V(null)}}),g[34]=B,g[35]=Z);let Q;g[36]===ot?Q=g[37]:(Q=/* @__PURE__ */ x(fe,{content:ot}),g[36]=ot,g[37]=Q);let $;g[38]!==ut||g[39]!==Q?($=/* @__PURE__ */ x(m,{fallback:ut,children:Q}),g[38]=ut,g[39]=Q,g[40]=$):$=g[40];let dt;return g[41]!==Z||g[42]!==$?(dt=/* @__PURE__ */ S(re,{children:[Z,$]}),g[41]=Z,g[42]=$,g[43]=dt):dt=g[43],dt}function Se(){window.location.reload()}function Ce(e){return e+1}function we(e){return e+1}function Te(){}function Ee(){setTimeout(k,1e3)}function k(){window.location.reload()}function De(e){if(e==null||n(e))return;let{pathname:t,search:r}=c();l.set(t,r,e)}export{O as AppRouterProvider};
1
+ "use client";import{d as e,i as t,p as n,r,v as i,w as a}from"../type-guards-BJXKlA6x.mjs";import{r as o}from"../navigation-transition-store-CSKrbtbK.mjs";import"./action-revalidation-kind.mjs";import{isLayoutReuseMarker as s,mergeFlightRefresh as c}from"./merge-flight-refresh.mjs";import{currentRouteLocation as l,flightRouteCache as u}from"./flight-route-cache.mjs";import{n as d,t as f}from"../preload-modules-Dv_GzGCm.mjs";import{n as p,r as m}from"../form-state-DAygOjc8.mjs";import{c as h}from"react/compiler-runtime";import*as g from"react";import{addTransitionType as _,startTransition as v,useEffect as y,useLayoutEffect as b,useRef as x,useState as S,useTransition as ee}from"react";import{Fragment as te,jsx as C,jsxs as w}from"react/jsx-runtime";import{createFromFetch as ne,createFromReadableStream as re}from"virtual:react-flight-client";const T={position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,padding:`24px`,background:`rgba(220, 38, 38, 0.95)`,color:`white`,borderRadius:`8px`,fontSize:`14px`,zIndex:1e4,maxWidth:`500px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.3)`},E={padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},D={padding:`8px 16px`,background:`rgba(255, 255, 255, 0.2)`,color:`white`,border:`1px solid rgba(255, 255, 255, 0.3)`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},O={fetch:`Failed to fetch updated content from server.`,parse:`Failed to parse server response.`,stale:`Server returned stale content.`,network:`Network error occurred.`};function k(e){return O[e]}function ie(e){let t=h(27),{failure:n,maxRetries:r,onRefresh:i,onDismiss:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ C(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),s={marginBottom:`12px`,opacity:.9},t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c;t[2]===n.type?c=t[3]:(c=k(n.type),t[2]=n.type,t[3]=c);let l;t[4]===c?l=t[5]:(l=/* @__PURE__ */ C(`div`,{style:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},t[6]=u):u=t[6];let d;t[7]===n.details?d=t[8]:(d=/* @__PURE__ */ C(`div`,{style:u,children:n.details}),t[7]=n.details,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f={marginBottom:`12px`,fontSize:`12px`,opacity:.7},t[9]=f):f=t[9];let p;t[10]!==n.consecutiveFailures||t[11]!==r?(p=/* @__PURE__ */ w(`div`,{style:f,children:[`Consecutive failures: `,n.consecutiveFailures,` / `,r]}),t[10]=n.consecutiveFailures,t[11]=r,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m={display:`flex`,gap:`8px`},t[13]=m):m=t[13];let g;t[14]===i?g=t[15]:(g=/* @__PURE__ */ C(`button`,{onClick:i,type:`button`,style:E,children:`Refresh Page`}),t[14]=i,t[15]=g);let _;t[16]===a?_=t[17]:(_=/* @__PURE__ */ C(`button`,{onClick:a,type:`button`,style:D,children:`Dismiss`}),t[16]=a,t[17]=_);let v;t[18]!==g||t[19]!==_?(v=/* @__PURE__ */ w(`div`,{style:m,children:[g,_]}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(y=/* @__PURE__ */ C(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`}),t[21]=y):y=t[21];let b;return t[22]!==v||t[23]!==l||t[24]!==d||t[25]!==p?(b=/* @__PURE__ */ w(`div`,{style:T,children:[o,l,d,p,v,y]}),t[22]=v,t[23]=l,t[24]=d,t[25]=p,t[26]=b):b=t[26],b}function ae(e){return e.historyKey!=null&&e.historyKey!==``?[`nav`,`nav-traverse`]:e.replace===!0?[`nav`,`nav-replace`]:[`nav`,`nav-forward`]}function A(e){e!=null&&typeof window<`u`&&(e.replace===!0?window.history.replaceState(e.state,``,e.url):window.history.pushState(e.state,``,e.url))}function j(e){if(e!=null&&e.url!==``)try{let t=`http://localhost/`;if(typeof window<`u`)try{t=window.location.href}catch{}let n=new URL(e.url,t);o({pathname:n.pathname,search:n.search})}catch{}}function oe(e){let{parsedPayload:t,shouldScrollToTop:n,navigationId:r,transitionTypes:i,pendingHistory:a,startTransition:o=v,currentNavigationIdRef:s,pendingScrollPayloadRef:c,setRenderKey:l,setRscPayload:u,clearHmrError:d,pendingNavigateCommittedIdRef:f}=e;o(()=>{if(s.current===r){if(i!=null)for(let e of i)_(e);A(a),j(a),l(e=>{let r=e+1;return c.current=n?{payload:t,commitKey:r}:null,r}),u(t),d(),f.current=r}})}function se(e,t,n){return e==null||e.commitKey!==n?{shouldScroll:!1,nextPending:null}:t===e.payload?{shouldScroll:!0,nextPending:null}:{shouldScroll:!1,nextPending:e}}const ce=/"timestamp":(\d+)/;function le(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||g.isValidElement(e)||Array.isArray(e)}function ue(e){return i(e)&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.navigationId==`number`&&i(e.options)}function de(e){return i(e)&&`element`in e}function fe(e){return i(e)&&typeof e.navigationId==`number`&&typeof e.targetPath==`string`}function pe(e){if(!n(e))return e;if(i(e)&&e.status===`fulfilled`)return le(e.value)?e.value:void 0}function M(e){return g.isValidElement(e)&&(e.type===`html`||e.type===`HTML`)}function N(e){return M(e)||g.isValidElement(e)&&s(e)}function P(e,t){console.error(`[rari] AppRouter: Navigation failed:`,t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:e.from,to:e.to,error:t,navigationId:e.navigationId}}))}function F(e){return e!=null&&!n(e)&&M(e)?e:null}function me(e){let t=e.pendingHistory?.url,n=t!=null&&t!==``?new URL(t,window.location.origin).hash.length>0:window.location.hash.length>0;return(e.options.historyKey==null||e.options.historyKey===``)&&!n&&e.options.scroll!==!1}async function he(e,t,n,r){let i=await I(e.element);if(r!==n)return{kind:`superseded`};if(!N(i))return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let a=F(t);if(g.isValidElement(i)&&s(i)&&a==null)return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: layout-reuse Flight marker requires a previous <html> document`)};let o=a==null?i:c(a,i);return M(o)?{kind:`payload`,payload:{...e,element:o,rawElement:o}}:{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: layout-merged Flight content did not resolve to an <html> document root`)}}async function I(e){let t=d(e);for(let e=0;e<10&&n(t);e+=1)t=d(await t);if(n(t))throw Error(`[rari] AppRouter: Flight content did not resolve to a React node`);return t}function L({children:o,initialPayload:s,onNavigate:h}){let[_,v]=S(s),T=x(s),[E,D]=S(0),[,O]=ee(),k=x(O),A=x({x:0,y:0}),j=x(null),N=x(/* @__PURE__ */ new Map),F=x(/* @__PURE__ */ new Set),L=x(h),R=x(0),z=x(0),B=x(null),V=x(null),H=x(/* @__PURE__ */ new Map),U=x([]),W=x(null),G=x(0),[ge,K]=S(null);y(()=>{L.current=h},[h]),y(()=>{k.current=O},[O]),b(()=>{let{shouldScroll:e,nextPending:t}=se(j.current,_,E);j.current=t,e&&window.scrollTo(0,0);let n=V.current;n!=null&&(V.current=null,window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:n}})))},[_,E]);let _e=e=>{if(e==null||n(e))return;let{pathname:t,search:r}=l();u.set(t,r,e)};y(()=>{T.current=_,_?.element!=null&&_e(_.element)},[_]),y(()=>{if(_?.element!=null){let e=_.element;if(i(e)&&`status`in e&&e.status===`rejected`){let t=e.reason;t!=null&&t!==``&&console.error(`[rari] AppRouter: Flight payload rejected:`,t)}}},[_]);let q=()=>{N.current=p()},ve=()=>{m(N.current)};b(()=>{let e=B.current;e!=null&&_===e&&(B.current=null,window.scrollTo(A.current.x,A.current.y),ve())},[_,E]);let J=(e,t,n,r)=>{G.current+=1;let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r,consecutiveFailures:G.current};U.current.push(i),U.current.length>10&&U.current.shift(),G.current>=2&&K(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},Y=()=>{setTimeout(()=>{window.location.reload()},1e3)},ye=()=>{G.current>0&&(G.current=0)},be=e=>{if(W.current==null||W.current===``)return!1;if(e===W.current)return!0;let t=ce.exec(e);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1},xe=e=>{f(e,F.current);let t=new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}}),n=re(t);return{element:n,rawElement:n,flightProtocol:e}},Se=async e=>{let t=await e;if(!t.body)throw Error(`Response has no body stream`);let n=t.clone(),r=ne(Promise.resolve(t));return n.text().then(async e=>{await f(e,F.current),e!==``&&(W.current=e)}).catch(()=>{}),{element:r,rawElement:r,flightProtocol:``}},Ce=async(t,n)=>{try{let e=await t.clone().text();if(be(e))return H.current.delete(n),`stale`;await f(e,F.current);let r=await I(ne(Promise.resolve(t)));if(!M(r))throw Error(`[rari] AppRouter: refetched Flight content did not resolve to an <html> document root`);return{element:r,rawElement:r,flightProtocol:e}}catch(t){if(e(t)&&t.name===`AbortError`)throw t;let n=a(t),r=Error(`Failed to parse RSC Flight protocol: ${n.message}`,{cause:n});return J(r,`parse`,r.message,window.location.pathname),r}},we=async(t,n,r)=>{let i=t!=null&&t!==``?t:window.location.pathname,o=R.current,s=r?.commit!==!1,c=`${o}:${i}${window.location.search}:${s?`commit`:`defer`}`,l=H.current.get(c);if(l)return l;let u=(async()=>{try{let e=i+window.location.search,t=await fetch(e,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(R.current)},cache:`no-store`,signal:n});if(!t.ok){let n=/* @__PURE__ */ Error(`Failed to fetch RSC data: ${t.status} ${t.statusText}`);throw J(n,`fetch`,`HTTP ${t.status} when fetching ${e}`,window.location.pathname),n}let r=await Ce(t,c);if(r===`stale`)return;if(r instanceof Error)throw r;return R.current===o&&(s&&v(r),r.flightProtocol!=null&&r.flightProtocol!==``&&(W.current=r.flightProtocol),ye()),H.current.delete(c),r}catch(t){throw H.current.delete(c),e(t)&&t.name!==`AbortError`&&!t.message.includes(`Failed to fetch RSC data`)&&!t.message.includes(`Failed to parse`)&&J(t,`network`,`Network error: ${t.message}`,window.location.pathname),a(t)}})();return H.current.set(c,u),u},Te=x(xe),Ee=x(Se),X=x(we);y(()=>{Te.current=xe,Ee.current=Se,X.current=we}),y(()=>{if(typeof window>`u`)return;let i=async e=>{if(e.rscResponsePromise){let t=await e.rscResponsePromise;if(R.current!==e.navigationId)return;let n=await Ee.current(Promise.resolve(t));return R.current===e.navigationId?n:void 0}if(e.rscResponse){let t=await Ee.current(Promise.resolve(e.rscResponse));return R.current===e.navigationId?t:void 0}if(e.rscFlightProtocol!=null&&e.rscFlightProtocol!==``)return Te.current(e.rscFlightProtocol);if(!e.isStreaming)return X.current(e.to,e.abortSignal,{commit:!1})},o=async(e,t)=>{try{let n=await he(t,T.current?.element,e.navigationId,R.current);return n.kind===`superseded`?null:n.kind===`error`?(P(e,n.error),null):R.current===e.navigationId?n.payload:null}catch(t){return P(e,a(t)),null}},s=(e,t)=>{oe({parsedPayload:t,shouldScrollToTop:me(e),navigationId:e.navigationId,transitionTypes:ae({historyKey:e.options.historyKey,replace:e.options.replace}),pendingHistory:e.pendingHistory,startTransition:k.current,currentNavigationIdRef:R,pendingScrollPayloadRef:j,setRenderKey:D,setRscPayload:v,clearHmrError:()=>{K(null)},pendingNavigateCommittedIdRef:V}),t.flightProtocol!=null&&t.flightProtocol!==``&&(W.current=t.flightProtocol),ye(),L.current&&L.current(e)},d=async t=>{try{return{kind:`payload`,payload:await i(t)}}catch(t){return e(t)&&t.name===`AbortError`?{kind:`aborted`}:{kind:`error`,error:a(t)}}},f=async e=>{let n=t(e,ue);if(!n||n.navigationId!==R.current)return;A.current={x:window.scrollX,y:window.scrollY},q();let r=await d(n);if(r.kind===`aborted`)return;if(r.kind===`error`){P(n,r.error),G.current>=3&&Y();return}let i=r.payload;if(i==null&&n.isStreaming&&R.current===n.navigationId||i==null||R.current!==n.navigationId)return;let a=await o(n,i);a!=null&&s(n,a)},p=async()=>{A.current={x:window.scrollX,y:window.scrollY},q();try{await X.current(),D(e=>e+1),K(null)}catch(e){console.error(`HMR refetch error:`,r(e,String(e))),G.current>=3&&Y()}requestAnimationFrame(()=>{window.scrollTo(A.current.x,A.current.y),ve()})},m=e=>{let r=t(e,de);if(r?.element==null||!le(r.element)&&!n(r.element))return;let{pathname:i,search:o}=l(),s=++z.current,d=R.current,f=`${i}${o}`;A.current={x:window.scrollX,y:window.scrollY},q();try{r.revalidationKind===1?u.clear():r.revalidatedPath!=null&&r.revalidatedPath!==``?u.invalidate(r.revalidatedPath,o):u.invalidate(i,o);let e=T.current?.element,t=u.getElement(i,o)??(e!=null&&n(e)?null:e??null),p=r.element;(async()=>{try{let e=await I(p);if(s!==z.current||R.current!==d)return;let{pathname:n,search:r}=l();if(`${n}${r}`!==f)return;let i=await I(c(t,e));if(s!==z.current||R.current!==d)return;let a=l();if(`${a.pathname}${a.search}`!==f)return;if(!M(i)){let e=/* @__PURE__ */ Error(`[rari] AppRouter: action flight refresh did not resolve to an <html> document root`);J(e,`parse`,`Action flight refresh failed: ${e.message}`,window.location.pathname),G.current>=3&&Y();return}let o={element:i,rawElement:i};B.current=o,g.startTransition(()=>{v(o),K(null)}),_e(i),ye()}catch(e){if(s!==z.current||R.current!==d)return;let t=a(e);J(t,`parse`,`Action flight refresh failed: ${t.message}`,window.location.pathname),G.current>=3&&Y()}})()}catch(e){let t=a(e);J(t,`parse`,`Action flight refresh failed: ${t.message}`,window.location.pathname),G.current>=3&&Y()}},h=async()=>{try{await X.current(),D(e=>e+1),K(null)}catch(e){console.error(`RSC invalidate error:`,r(e,String(e))),G.current>=3&&Y()}},_=e=>{let n=t(e,fe);n&&(F.current.clear(),R.current=n.navigationId,z.current+=1,j.current=null,B.current=null)},y=async()=>{try{await X.current(),K(null)}catch(e){console.error(`Manifest update error:`,r(e,String(e))),G.current>=3&&Y()}},b=e=>{f(e)},x=()=>{p()},S=()=>{h()},ee=()=>{y()};return window.addEventListener(`rari:navigation-start`,_),window.addEventListener(`rari:navigate`,b),window.addEventListener(`rari:app-router-rerender`,x),window.addEventListener(`rari:action-flight-refresh`,m),window.addEventListener(`rari:rsc-invalidate`,S),window.addEventListener(`rari:app-router-manifest-updated`,ee),()=>{window.removeEventListener(`rari:navigation-start`,_),window.removeEventListener(`rari:navigate`,b),window.removeEventListener(`rari:app-router-rerender`,x),window.removeEventListener(`rari:action-flight-refresh`,m),window.removeEventListener(`rari:rsc-invalidate`,S),window.removeEventListener(`rari:app-router-manifest-updated`,ee)}},[]),y(()=>{if(typeof window<`u`&&window.location.hash&&_){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`instant`,block:`start`})})})}},[_]);let De=_?.element??o,Z=d(De),[Oe,ke]=S(null),Ae=pe(Z),je=n(Z)&&Ae===void 0,Q=Ae===void 0?n(Z)?null:Z:d(Ae),$=Q!=null&&!n(Q)&&M(Q)?Q:null;if($!=null&&!Object.is($,Oe)&&ke($),je){if(Oe==null)throw Error(`[rari] AppRouter: expected a resolved <html> document root`)}else if($==null)throw Error(`[rari] AppRouter: expected a resolved <html> document root`);return/* @__PURE__ */ w(te,{children:[ge!=null&&/* @__PURE__ */ C(ie,{failure:ge,maxRetries:3,onRefresh:()=>{window.location.reload()},onDismiss:()=>{K(null)}}),je?Oe:$]})}export{L as AppRouterProvider};
@@ -1,7 +1,7 @@
1
- "use client";import{i as e,t}from"../navigate-DuyUa6qD.mjs";import{d as n,h as r,i,n as a,v as o,x as s}from"../type-guards-BJXKlA6x.mjs";import{r as c}from"../path-C74rvUep.mjs";import{t as l}from"../form-state-DZJs9bve.mjs";import{c as u}from"react/compiler-runtime";import{useEffect as d,useLayoutEffect as f,useRef as p,useState as m}from"react";function h(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:c=!1,trailing:l=!0,maxWait:u}=n;function d(t){let n=o,r=s;o=null,s=null,a=t,e.apply(r,n)}function f(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||u!==void 0&&r>=u}function p(){let e=Date.now();if(f(e)){h(e);return}let n=e-i,o=e-a,s=t-n,c=u===void 0?1/0:u-o;r=setTimeout(p,Math.min(s,c))}function m(e){a=e,r=setTimeout(p,t),c&&d(e)}function h(e){if(r=null,l&&o){d(e);return}o=null,s=null}function g(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function _(){r!==null&&h(Date.now())}function v(){return r!==null}function y(...e){let n=Date.now(),a=f(n);if(o=e,s=this,i=n,a){if(r===null){m(i);return}
1
+ "use client";import{i as e,t}from"../navigate-DuyUa6qD.mjs";import{d as n,h as r,i,n as a,v as o}from"../type-guards-BJXKlA6x.mjs";import{r as s}from"../path-CTEC1xmy.mjs";import{t as ee}from"../serialize-router-state-uOGGpmBr.mjs";import{t as c}from"../form-state-DAygOjc8.mjs";import{c as l}from"react/compiler-runtime";import{useEffect as u,useLayoutEffect as d,useRef as f,useState as te}from"react";function p(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:ee=!1,trailing:c=!0,maxWait:l}=n;function u(t){let n=o,r=s;o=null,s=null,a=t,e.apply(r,n)}function d(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||l!==void 0&&r>=l}function f(){let e=Date.now();if(d(e)){p(e);return}let n=e-i,o=e-a,s=t-n,ee=l===void 0?1/0:l-o;r=setTimeout(f,Math.min(s,ee))}function te(e){a=e,r=setTimeout(f,t),ee&&u(e)}function p(e){if(r=null,c&&o){u(e);return}o=null,s=null}function m(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function h(){r!==null&&p(Date.now())}function g(){return r!==null}function _(...e){let n=Date.now(),a=d(n);if(o=e,s=this,i=n,a){if(r===null){te(i);return}
2
2
  /* v8 ignore start - edge case: isInvoking true with existing timeout and maxWait defined */
3
- if(u!==void 0){r=setTimeout(p,t),d(i);return}}r??=setTimeout(p,t)}return y.cancel=g,y.flush=_,y.pending=v,y}const g=/fetch|networkerror|load failed/i;function _(e,t){return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1}}function v(e,t){return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function y(e,t,n){if(t===404)return{type:`not-found`,message:`Page not found`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!1};if(t>=500)return{type:`server-error`,message:`Server error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!0};let r=t===408||t===429;return{type:`fetch-error`,message:`HTTP error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:r}}function b(e,t){return{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function x(e,t){return{type:`parse-error`,message:`Failed to parse server response`,
3
+ if(l!==void 0){r=setTimeout(f,t),u(i);return}}r??=setTimeout(f,t)}return _.cancel=m,_.flush=h,_.pending=g,_}const m=/fetch|networkerror|load failed/i;function h(e,t){return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1}}function g(e,t){return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function _(e,t,n){if(t===404)return{type:`not-found`,message:`Page not found`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!1};if(t>=500)return{type:`server-error`,message:`Server error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!0};let r=t===408||t===429;return{type:`fetch-error`,message:`HTTP error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:r}}function v(e,t){return{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function y(e,t){return{type:`parse-error`,message:`Failed to parse server response`,
4
4
  /* v8 ignore next - defensive check for non-Error values from parse-related condition */
5
- originalError:a(e),url:t,timestamp:Date.now(),retryable:!1}}function S(e,t){return{type:`fetch-error`,message:a(e)?.message??`Unknown error occurred`,originalError:a(e),url:t,timestamp:Date.now(),retryable:!1}}function C(e,t){if(n(e)&&e.name===`AbortError`)return _(e,t);if(n(e)&&(e.name===`TimeoutError`||e.message.includes(`timeout`)))return v(e,t);if(n(e)&&`status`in e){let n=e.status;return typeof n==`number`?y(e,n,t):S(e,t)}return e instanceof TypeError&&g.test(e.message)?b(e,t):e instanceof SyntaxError||n(e)&&e.message.includes(`parse`)?x(e,t):S(e,t)}var ee=class{onError;constructor(e={}){
5
+ originalError:a(e),url:t,timestamp:Date.now(),retryable:!1}}function b(e,t){return{type:`fetch-error`,message:a(e)?.message??`Unknown error occurred`,originalError:a(e),url:t,timestamp:Date.now(),retryable:!1}}function x(e,t){if(n(e)&&e.name===`AbortError`)return h(e,t);if(n(e)&&(e.name===`TimeoutError`||e.message.includes(`timeout`)))return g(e,t);if(n(e)&&`status`in e){let n=e.status;return typeof n==`number`?_(e,n,t):b(e,t)}return e instanceof TypeError&&m.test(e.message)?v(e,t):e instanceof SyntaxError||n(e)&&e.message.includes(`parse`)?y(e,t):b(e,t)}var ne=class{onError;constructor(e={}){
6
6
  /* v8 ignore next - default no-op callback */
7
- this.onError=e.onError??(()=>{})}handleError(e,t){let n=C(e,t);return this.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),n}};function te(e,t){try{let n=t!=null&&t!==``?t:window.location.origin,r=typeof URL.parse==`function`?URL.parse(e,n):new URL(e,n);return r!=null&&r.origin!==n}catch{return!1}}function ne(e){try{let t=typeof URL.parse==`function`?URL.parse(e,window.location.origin):new URL(e,window.location.origin);return t==null?e:`${t.pathname}${t.search}${t.hash}`}catch{return e}}var re=class{stateHistory;routeAccessOrder;maxHistorySize;scrollableSelector;constructor(e={}){this.stateHistory=/* @__PURE__ */ new Map,this.routeAccessOrder=[],this.maxHistorySize=e.maxHistorySize!=null&&e.maxHistorySize!==0?e.maxHistorySize:50,this.scrollableSelector=e.scrollableSelector!=null&&e.scrollableSelector!==``?e.scrollableSelector:`[data-scrollable], .scrollable, [style*="overflow"]`}captureState(e){let t={scrollPositions:this.captureScrollPositions(),formData:this.captureFormData(),focusedElement:this.captureFocusedElement()};return this.storeState(e,t),t}captureScrollPositions(){let e=/* @__PURE__ */ new Map;try{e.set(`window`,{x:window.scrollX,y:window.scrollY,element:`window`}),document.querySelectorAll(this.scrollableSelector).forEach((t,n)=>{if(t instanceof HTMLElement){let r=t.id||`scrollable-${n}`;(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&e.set(r,{x:t.scrollLeft,y:t.scrollTop,element:r})}})}catch{}return e}captureFormData(){let e=/* @__PURE__ */ new Map;try{document.querySelectorAll(`form`).forEach((t,n)=>{let r=t.id||t.name||`form-${n}`,i=new FormData(t);i.entries().next().done||e.set(r,i)})}catch{}return e}captureFocusedElement(){try{let e=document.activeElement;if(e&&e!==document.body){if(e.id)return`#${e.id}`;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.name)return`[name="${e.name}"]`}}catch{}return null}storeState(e,t){let n=this.routeAccessOrder.indexOf(e);for(n!==-1&&this.routeAccessOrder.splice(n,1),this.routeAccessOrder.push(e),this.stateHistory.set(e,t);this.routeAccessOrder.length>this.maxHistorySize;){let e=this.routeAccessOrder.shift();e!=null&&e!==``&&this.stateHistory.delete(e)}}restoreState(e){let t=this.stateHistory.get(e);if(!t)return!1;let n=!0;return this.restoreScrollPositions(t.scrollPositions)||(n=!1),this.restoreFormData(t.formData)||(n=!1),t.focusedElement!=null&&t.focusedElement!==``&&this.restoreFocus(t.focusedElement),n}restoreScrollPositions(e){let t=!0;try{e.forEach((e,n)=>{try{if(n===`window`)window.scrollTo(e.x,e.y);else{let r=document.getElementById(n)??document.querySelector(`[data-scrollable-id="${n}"]`);r instanceof HTMLElement?(r.scrollLeft=e.x,r.scrollTop=e.y):t=!1}}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore scroll positions:`,e),t=!1}return t}restoreFormData(e){let t=!0;try{e.forEach((e,n)=>{try{let r=document.getElementById(n),i=r instanceof HTMLFormElement?r:document.querySelector(`form[name="${n}"]`)??document.querySelectorAll(`form`)[Number.parseInt(n.replace(`form-`,``),10)];i instanceof HTMLFormElement&&l(i,e)||(t=!1)}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore form data:`,e),t=!1}return t}restoreFocus(e){try{let t=document.querySelector(e);t instanceof HTMLElement&&requestAnimationFrame(()=>{try{t.focus()}catch{}})}catch{}}};function w(e){return o(e)&&typeof e.navigationId==`number`}function T(e){return o(e)&&typeof e.navigationId==`number`&&`error`in e}async function ie(e,t){return t.aborted?{error:new DOMException(`Aborted`,`AbortError`)}:new Promise(n=>{function r(){window.removeEventListener(`rari:navigate-committed`,a),window.removeEventListener(`rari:navigate-error`,o),t.removeEventListener(`abort`,s)}function a(t){i(t,w)?.navigationId===e&&(r(),n(`committed`))}function o(t){let a=i(t,T);a?.navigationId===e&&(r(),n({error:a.error}))}function s(){r(),n({error:new DOMException(`Aborted`,`AbortError`)})}window.addEventListener(`rari:navigate-committed`,a),window.addEventListener(`rari:navigate-error`,o),t.addEventListener(`abort`,s,{once:!0})})}function E(e,t){let n=document.querySelector(e);if(n)t.content&&n.setAttribute(`content`,t.content);else{n=document.createElement(`meta`);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);document.head.appendChild(n)}}function D(e){let t=document.querySelector(e);t&&t.remove()}function O(e){e.title!=null&&e.title!==``&&(document.title=e.title),e.description!=null&&e.description!==``?E(`meta[name="description"]`,{name:`description`,content:e.description}):D(`meta[name="description"]`),e.keywords&&e.keywords.length>0?E(`meta[name="keywords"]`,{name:`keywords`,content:e.keywords.join(`, `)}):D(`meta[name="keywords"]`),e.viewport!=null&&e.viewport!==``&&E(`meta[name="viewport"]`,{name:`viewport`,content:e.viewport})}function k(e){let t=document.querySelector(`link[rel="canonical"]`);if(e===void 0){t&&t.remove();return}if(t)t.setAttribute(`href`,e);else{let t=document.createElement(`link`);t.setAttribute(`rel`,`canonical`),t.setAttribute(`href`,e),document.head.appendChild(t)}}function A(e){if(e===void 0){D(`meta[name="robots"]`);return}let t=[];e.index!==void 0&&t.push(e.index?`index`:`noindex`),e.follow!==void 0&&t.push(e.follow?`follow`:`nofollow`),e.nocache&&t.push(`nocache`),t.length>0?E(`meta[name="robots"]`,{name:`robots`,content:t.join(`, `)}):D(`meta[name="robots"]`)}function ae(e){if(e===void 0){D(`meta[property="og:title"]`),D(`meta[property="og:description"]`),D(`meta[property="og:url"]`),D(`meta[property="og:site_name"]`),D(`meta[property="og:type"]`),document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>{e.remove()});return}if(e.title!=null&&e.title!==``?E(`meta[property="og:title"]`,{property:`og:title`,content:e.title}):D(`meta[property="og:title"]`),e.description!=null&&e.description!==``?E(`meta[property="og:description"]`,{property:`og:description`,content:e.description}):D(`meta[property="og:description"]`),e.url!=null&&e.url!==``?E(`meta[property="og:url"]`,{property:`og:url`,content:e.url}):D(`meta[property="og:url"]`),e.siteName!=null&&e.siteName!==``?E(`meta[property="og:site_name"]`,{property:`og:site_name`,content:e.siteName}):D(`meta[property="og:site_name"]`),e.type!=null&&e.type!==``?E(`meta[property="og:type"]`,{property:`og:type`,content:e.type}):D(`meta[property="og:type"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>{e.remove()});for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`property`,`og:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>{e.remove()})}function j(e){if(e===void 0){D(`meta[name="twitter:card"]`),D(`meta[name="twitter:site"]`),D(`meta[name="twitter:creator"]`),D(`meta[name="twitter:title"]`),D(`meta[name="twitter:description"]`),document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>{e.remove()});return}if(e.card!=null&&e.card!==``?E(`meta[name="twitter:card"]`,{name:`twitter:card`,content:e.card}):D(`meta[name="twitter:card"]`),e.site!=null&&e.site!==``?E(`meta[name="twitter:site"]`,{name:`twitter:site`,content:e.site}):D(`meta[name="twitter:site"]`),e.creator!=null&&e.creator!==``?E(`meta[name="twitter:creator"]`,{name:`twitter:creator`,content:e.creator}):D(`meta[name="twitter:creator"]`),e.title!=null&&e.title!==``?E(`meta[name="twitter:title"]`,{name:`twitter:title`,content:e.title}):D(`meta[name="twitter:title"]`),e.description!=null&&e.description!==``?E(`meta[name="twitter:description"]`,{name:`twitter:description`,content:e.description}):D(`meta[name="twitter:description"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>{e.remove()});for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`name`,`twitter:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>{e.remove()})}function oe(e){O(e),k(e.canonical),A(e.robots),ae(e.openGraph),j(e.twitter)}function M(e){return o(e)}function se(i){let a=u(35),{children:o,initialRoute:s}=i,l;a[0]===s?l=a[1]:(l=()=>({currentRoute:typeof window<`u`?`${window.location.pathname}${window.location.search}`:c(s),navigationId:0,error:null}),a[0]=s,a[1]=l);let[g,_]=m(l),v=p(null),y=p(!0),b;a[2]===s?b=a[3]:(b=typeof window<`u`?`${window.location.pathname}${window.location.search}`:c(s),a[2]=s,a[3]=b);let x=p(b),S;a[4]===s?S=a[5]:(S=typeof window<`u`?`${window.location.pathname}${window.location.search}${window.location.hash}`:c(s),a[4]=s,a[5]=S);let C=p(S),w=p(0),T;a[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=new ee({onError:de}),a[6]=T):T=a[6];let E=p(T),D;a[7]===Symbol.for(`react.memo_cache_sentinel`)?(D=/* @__PURE__ */ new Map,a[7]=D):D=a[7];let O=p(D),k;a[8]===Symbol.for(`react.memo_cache_sentinel`)?(k=new re({maxHistorySize:50}),a[8]=k):k=a[8];let A=p(k),ae=ue,j;a[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{v.current&&=(v.current.abort(),null)},a[9]=j):j=a[9];let oe=j,M;a[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{for(let[,e]of O.current.entries())e.abortController.abort();O.current.clear()},a[10]=M):M=a[10];let se=M,N;a[11]===g?N=a[12]:(N=(e,t)=>{O.current.delete(e),y.current&&g.navigationId===t&&_(le)},a[11]=g,a[12]=N);let P=N,F;a[13]===Symbol.for(`react.memo_cache_sentinel`)?(F=(e,t)=>{let n=t===void 0?{}:t,r=`${window.location.pathname}${window.location.search}`,i=e?`${r}#${e}`:r;if(e){let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}i!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&(n.replace?window.history.replaceState(window.history.state,``,i):window.history.pushState(window.history.state,``,i)),C.current=i},a[13]=F):F=a[13];let fe=F,pe=ce,I;if(a[14]===Symbol.for(`react.memo_cache_sentinel`)){let e=(e,t,n)=>{n.historyKey!=null&&n.historyKey!==``?requestAnimationFrame(()=>{A.current.restoreState(e)}):t&&requestAnimationFrame(()=>{let e=n=>{let r=n===void 0?0:n,i=document.getElementById(t);i?i.scrollIntoView({behavior:`smooth`,block:`start`}):r<10&&setTimeout(e,50,r+1)};e()})};I=(t,n,r,i,a)=>{y.current&&w.current===i&&(x.current=t,C.current=a,_(e=>({...e,currentRoute:t,navigationId:i,error:null})),e(t,n,r))},a[14]=I}else I=a[14];let me=I,L;a[15]===P?L=a[16]:(L=(e,t,r,i,a)=>{let o=a===void 0?{}:a;if(n(e)&&e.name===`AbortError`){P(t,r);return}let s=E.current.handleError(e,t);y.current&&(_(e=>({...e,error:s})),window.history.replaceState(window.history.state,``,i)),O.current.delete(t),o.emitEvent!==!1&&window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:i,to:t,error:s,navigationId:r}}))},a[15]=P,a[16]=L);let R=L,he;a[17]!==P||a[18]!==R?(he=async(e,t)=>{let n=t===void 0?{}:t;if(!e||typeof e!=`string`)return;let[r,i]=e.includes(`#`)?e.split(`#`):[e,``],a=c(r);if(a===x.current){fe(i,{replace:n.replace===!0});return}let o=O.current.get(a);if(o)return o.promise;se(),oe();let s=new AbortController;v.current=s,w.current+=1;let l=w.current;window.dispatchEvent(new CustomEvent(`rari:navigation-start`,{detail:{navigationId:l,targetPath:a}}));let u=(async()=>{let e=C.current;try{(n.historyKey==null||n.historyKey===``)&&A.current.captureState(x.current);let t=n.historyKey!=null&&n.historyKey!==``?n.historyKey:ae(),r=window.location.origin+a,o={route:a,navigationId:l,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:t},c=await fetch(r,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(l)},cache:`no-store`,signal:s.signal});if(!c.ok&&c.status!==404){R(/* @__PURE__ */ Error(`Failed to fetch: ${c.status}`),a,l,e);return}if(s.signal.aborted){P(a,l);return}let u=new URL(c.url),d=u.pathname,f=`${u.pathname}${u.search}`,p={...o,route:f},m=`${f}${i?`#${i}`:``}`;if(w.current!==l)return;let h=ie(l,s.signal);if(window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:e,to:d,navigationId:l,options:n,abortSignal:s.signal,rscResponse:c,pendingHistory:{url:m,state:p,replace:n.replace===!0}}})),w.current!==l){s.abort();return}let g=await h;if(w.current!==l)return;if(g!==`committed`){R(g.error,a,l,e,{emitEvent:!1});return}pe(c),me(f,i,n,l,m),O.current.delete(a)}catch(t){R(t,a,l,e)}})();return O.current.set(a,{targetPath:a,navigationId:l,promise:u,abortController:s}),u},a[17]=P,a[18]=R,a[19]=he):he=a[19];let z=he,B=p(z),V;a[20]===z?V=a[21]:(V=()=>(B.current=z,()=>{B.current=null}),a[20]=z,a[21]=V),f(V);let ge=p(null),H,U;a[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{ge.current??=h((e,t)=>{B.current?.(e,t)},50,{leading:!0,trailing:!0,maxWait:200})},U=[],a[22]=H,a[23]=U):(H=a[22],U=a[23]),f(H,U);let W;a[24]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>{if(e.button!==0||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;let t=e.target instanceof Element?e.target:null;for(;t&&!(t instanceof HTMLAnchorElement);)t=t.parentElement;if(!(t instanceof HTMLAnchorElement))return;let n=t;if(n.target&&n.target!==`_self`||n.hasAttribute(`download`))return;let r=n.getAttribute(`href`);if(r==null||r===``||te(r))return;if(r.startsWith(`#`)){e.preventDefault();let t=r.slice(1),n=document.getElementById(t);if(n){n.scrollIntoView({behavior:`smooth`,block:`start`});let e=`${window.location.pathname}${window.location.search}#${t}`;window.history.pushState(window.history.state,``,e),C.current=e}return}e.preventDefault();let i=ne(r);ge.current?.(i,{replace:!1})},a[24]=W):W=a[24];let _e=W,G;a[25]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{let t=`${window.location.pathname}${window.location.search}${window.location.hash}`,n=r(e.state)?e.state:null;B.current&&B.current(t,{replace:!0,scroll:!1,historyKey:n?.key})},a[25]=G):G=a[25];let ve=G,K;a[26]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>{let e=r(window.history.state)?window.history.state:null;if(e?.key==null||e.key===``){let e={route:`${window.location.pathname}${window.location.search}`,navigationId:0,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:ae()};window.history.replaceState(e,``,window.location.pathname+window.location.search+window.location.hash)}},a[26]=K):K=a[26];let q;a[27]===s?q=a[28]:(q=[s],a[27]=s,a[28]=q),d(K,q);let J;a[29]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{if(e.persisted){let e=window.location.pathname;A.current.captureState(e)}},a[29]=J):J=a[29];let ye=J,Y;a[30]===Symbol.for(`react.memo_cache_sentinel`)?(Y=e=>{if(e.persisted){let e=window.location.pathname,t=r(window.history.state)?window.history.state:null;requestAnimationFrame(()=>{A.current.restoreState(e),t?.scrollPosition&&window.scrollTo(t.scrollPosition.x,t.scrollPosition.y)})}},a[30]=Y):Y=a[30];let be=Y,X,Z;a[31]===Symbol.for(`react.memo_cache_sentinel`)?(X=()=>(document.addEventListener(`click`,_e),window.addEventListener(`popstate`,ve),window.addEventListener(`pagehide`,ye),window.addEventListener(`pageshow`,be),()=>{document.removeEventListener(`click`,_e),window.removeEventListener(`popstate`,ve),window.removeEventListener(`pagehide`,ye),window.removeEventListener(`pageshow`,be)}),Z=[],a[31]=X,a[32]=Z):(X=a[31],Z=a[32]),d(X,Z);let Q,$;return a[33]===Symbol.for(`react.memo_cache_sentinel`)?(Q=()=>(y.current=!0,e(async(e,t)=>B.current?.(e,t)??Promise.resolve()),()=>{y.current=!1,t(),oe(),se(),ge.current?.cancel()}),$=[],a[33]=Q,a[34]=$):(Q=a[33],$=a[34]),d(Q,$),o}function ce(e){try{let t=e.headers.get(`x-rari-metadata`);if(t!=null&&t!==``){let e=s(decodeURIComponent(t));e&&M(e)&&oe(e)}}catch(e){console.warn(`[rari] Router: Failed to parse x-rari-metadata header:`,e)}}function le(e){return{...e}}function ue(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hk-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}function de(e){console.error(`[rari] Router: Navigation error:`,e)}export{se as ClientRouter};
7
+ this.onError=e.onError??(()=>{})}handleError(e,t){let n=x(e,t);return this.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),n}};function re(e,t){try{let n=t!=null&&t!==``?t:window.location.origin,r=typeof URL.parse==`function`?URL.parse(e,n):new URL(e,n);return r!=null&&r.origin!==n}catch{return!1}}function ie(e){try{let t=typeof URL.parse==`function`?URL.parse(e,window.location.origin):new URL(e,window.location.origin);return t==null?e:`${t.pathname}${t.search}${t.hash}`}catch{return e}}var ae=class{stateHistory;routeAccessOrder;maxHistorySize;scrollableSelector;constructor(e={}){this.stateHistory=/* @__PURE__ */ new Map,this.routeAccessOrder=[],this.maxHistorySize=e.maxHistorySize!=null&&e.maxHistorySize!==0?e.maxHistorySize:50,this.scrollableSelector=e.scrollableSelector!=null&&e.scrollableSelector!==``?e.scrollableSelector:`[data-scrollable], .scrollable, [style*="overflow"]`}captureState(e){let t={scrollPositions:this.captureScrollPositions(),formData:this.captureFormData(),focusedElement:this.captureFocusedElement()};return this.storeState(e,t),t}captureScrollPositions(){let e=/* @__PURE__ */ new Map;try{e.set(`window`,{x:window.scrollX,y:window.scrollY,element:`window`}),document.querySelectorAll(this.scrollableSelector).forEach((t,n)=>{if(t instanceof HTMLElement){let r=t.id||`scrollable-${n}`;(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&e.set(r,{x:t.scrollLeft,y:t.scrollTop,element:r})}})}catch{}return e}captureFormData(){let e=/* @__PURE__ */ new Map;try{document.querySelectorAll(`form`).forEach((t,n)=>{let r=t.id||t.name||`form-${n}`,i=new FormData(t);i.entries().next().done||e.set(r,i)})}catch{}return e}captureFocusedElement(){try{let e=document.activeElement;if(e&&e!==document.body){if(e.id)return`#${e.id}`;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.name)return`[name="${e.name}"]`}}catch{}return null}storeState(e,t){let n=this.routeAccessOrder.indexOf(e);for(n!==-1&&this.routeAccessOrder.splice(n,1),this.routeAccessOrder.push(e),this.stateHistory.set(e,t);this.routeAccessOrder.length>this.maxHistorySize;){let e=this.routeAccessOrder.shift();e!=null&&e!==``&&this.stateHistory.delete(e)}}restoreState(e){let t=this.stateHistory.get(e);if(!t)return!1;let n=!0;return this.restoreScrollPositions(t.scrollPositions)||(n=!1),this.restoreFormData(t.formData)||(n=!1),t.focusedElement!=null&&t.focusedElement!==``&&this.restoreFocus(t.focusedElement),n}restoreScrollPositions(e){let t=!0;try{e.forEach((e,n)=>{try{if(n===`window`)window.scrollTo(e.x,e.y);else{let r=document.getElementById(n)??document.querySelector(`[data-scrollable-id="${n}"]`);r instanceof HTMLElement?(r.scrollLeft=e.x,r.scrollTop=e.y):t=!1}}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore scroll positions:`,e),t=!1}return t}restoreFormData(e){let t=!0;try{e.forEach((e,n)=>{try{let r=document.getElementById(n),i=r instanceof HTMLFormElement?r:document.querySelector(`form[name="${n}"]`)??document.querySelectorAll(`form`)[Number.parseInt(n.replace(`form-`,``),10)];i instanceof HTMLFormElement&&c(i,e)||(t=!1)}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore form data:`,e),t=!1}return t}restoreFocus(e){try{let t=document.querySelector(e);t instanceof HTMLElement&&requestAnimationFrame(()=>{try{t.focus()}catch{}})}catch{}}};function S(e){return o(e)&&typeof e.navigationId==`number`}function C(e){return o(e)&&typeof e.navigationId==`number`&&`error`in e}async function oe(e,t){return t.aborted?{error:new DOMException(`Aborted`,`AbortError`)}:new Promise(n=>{function r(){window.removeEventListener(`rari:navigate-committed`,a),window.removeEventListener(`rari:navigate-error`,o),t.removeEventListener(`abort`,s)}function a(t){i(t,S)?.navigationId===e&&(r(),n(`committed`))}function o(t){let a=i(t,C);a?.navigationId===e&&(r(),n({error:a.error}))}function s(){r(),n({error:new DOMException(`Aborted`,`AbortError`)})}window.addEventListener(`rari:navigate-committed`,a),window.addEventListener(`rari:navigate-error`,o),t.addEventListener(`abort`,s,{once:!0})})}function w(i){let a=l(35),{children:o,initialRoute:c}=i,m;a[0]===c?m=a[1]:(m=()=>({currentRoute:typeof window<`u`?`${window.location.pathname}${window.location.search}`:s(c),navigationId:0,error:null}),a[0]=c,a[1]=m);let[h,g]=te(m),_=f(null),v=f(!0),y;a[2]===c?y=a[3]:(y=typeof window<`u`?`${window.location.pathname}${window.location.search}`:s(c),a[2]=c,a[3]=y);let b=f(y),x;a[4]===c?x=a[5]:(x=typeof window<`u`?`${window.location.pathname}${window.location.search}${window.location.hash}`:s(c),a[4]=c,a[5]=x);let S=f(x),C=f(0),w;a[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=new ne({onError:le}),a[6]=w):w=a[6];let ue=f(w),T;a[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=/* @__PURE__ */ new Map,a[7]=T):T=a[7];let E=f(T),D;a[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=new ae({maxHistorySize:50}),a[8]=D):D=a[8];let O=f(D),de=ce,k;a[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{_.current&&=(_.current.abort(),null)},a[9]=k):k=a[9];let fe=k,A;a[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{for(let[,e]of E.current.entries())e.abortController.abort();E.current.clear()},a[10]=A):A=a[10];let pe=A,j;a[11]===h?j=a[12]:(j=(e,t)=>{E.current.delete(e),v.current&&h.navigationId===t&&g(se)},a[11]=h,a[12]=j);let M=j,N;a[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t)=>{let n=t===void 0?{}:t,r=`${window.location.pathname}${window.location.search}`,i=e?`${r}#${e}`:r;if(e){let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}i!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&(n.replace?window.history.replaceState(window.history.state,``,i):window.history.pushState(window.history.state,``,i)),S.current=i},a[13]=N):N=a[13];let me=N,P;if(a[14]===Symbol.for(`react.memo_cache_sentinel`)){let e=(e,t,n)=>{n.historyKey!=null&&n.historyKey!==``?requestAnimationFrame(()=>{O.current.restoreState(e)}):t&&requestAnimationFrame(()=>{let e=n=>{let r=n===void 0?0:n,i=document.getElementById(t);i?i.scrollIntoView({behavior:`smooth`,block:`start`}):r<10&&setTimeout(e,50,r+1)};e()})};P=(t,n,r,i,a)=>{v.current&&C.current===i&&(b.current=t,S.current=a,g(e=>({...e,currentRoute:t,navigationId:i,error:null})),e(t,n,r))},a[14]=P}else P=a[14];let he=P,F;a[15]===M?F=a[16]:(F=(e,t,r,i,a)=>{let o=a===void 0?{}:a;if(n(e)&&e.name===`AbortError`){M(t,r);return}let s=ue.current.handleError(e,t);v.current&&(g(e=>({...e,error:s})),window.history.replaceState(window.history.state,``,i)),E.current.delete(t),o.emitEvent!==!1&&window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:i,to:t,error:s,navigationId:r}}))},a[15]=M,a[16]=F);let I=F,L;a[17]!==M||a[18]!==I?(L=async(e,t)=>{let n=t===void 0?{}:t;if(!e||typeof e!=`string`)return;let[r,i]=e.includes(`#`)?e.split(`#`):[e,``],a=s(r);if(a===b.current){me(i,{replace:n.replace===!0});return}let o=E.current.get(a);if(o)return o.promise;pe(),fe();let c=new AbortController;_.current=c,C.current+=1;let l=C.current;window.dispatchEvent(new CustomEvent(`rari:navigation-start`,{detail:{navigationId:l,targetPath:a}}));let u=(async()=>{let e=S.current;try{(n.historyKey==null||n.historyKey===``)&&O.current.captureState(b.current);let t=n.historyKey!=null&&n.historyKey!==``?n.historyKey:de(),r=window.location.origin+a,o={route:a,navigationId:l,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:t},s=await fetch(r,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(l),"rari-router-state":ee()},cache:`no-store`,signal:c.signal});if(!s.ok&&s.status!==404){I(/* @__PURE__ */ Error(`Failed to fetch: ${s.status}`),a,l,e);return}if(c.signal.aborted){M(a,l);return}let u=new URL(s.url),d=u.pathname,f=`${u.pathname}${u.search}`,te={...o,route:f},p=`${f}${i?`#${i}`:``}`;if(C.current!==l)return;let m=oe(l,c.signal);if(window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:e,to:d,navigationId:l,options:n,abortSignal:c.signal,rscResponse:s,pendingHistory:{url:p,state:te,replace:n.replace===!0}}})),C.current!==l){c.abort();return}let h=await m;if(C.current!==l)return;if(h!==`committed`){I(h.error,a,l,e,{emitEvent:!1});return}he(f,i,n,l,p),E.current.delete(a)}catch(t){I(t,a,l,e)}})();return E.current.set(a,{targetPath:a,navigationId:l,promise:u,abortController:c}),u},a[17]=M,a[18]=I,a[19]=L):L=a[19];let R=L,z=f(R),B;a[20]===R?B=a[21]:(B=()=>(z.current=R,()=>{z.current=null}),a[20]=R,a[21]=B),d(B);let V=f(null),H,U;a[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{V.current??=p((e,t)=>{z.current?.(e,t)},50,{leading:!0,trailing:!0,maxWait:200})},U=[],a[22]=H,a[23]=U):(H=a[22],U=a[23]),d(H,U);let W;a[24]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>{if(e.button!==0||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;let t=e.target instanceof Element?e.target:null;for(;t&&!(t instanceof HTMLAnchorElement);)t=t.parentElement;if(!(t instanceof HTMLAnchorElement))return;let n=t;if(n.target&&n.target!==`_self`||n.hasAttribute(`download`))return;let r=n.getAttribute(`href`);if(r==null||r===``||re(r))return;if(r.startsWith(`#`)){e.preventDefault();let t=r.slice(1),n=document.getElementById(t);if(n){n.scrollIntoView({behavior:`smooth`,block:`start`});let e=`${window.location.pathname}${window.location.search}#${t}`;window.history.pushState(window.history.state,``,e),S.current=e}return}e.preventDefault();let i=ie(r);V.current?.(i,{replace:!1})},a[24]=W):W=a[24];let ge=W,G;a[25]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{let t=`${window.location.pathname}${window.location.search}${window.location.hash}`,n=r(e.state)?e.state:null;z.current&&z.current(t,{replace:!0,scroll:!1,historyKey:n?.key})},a[25]=G):G=a[25];let _e=G,K;a[26]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>{let e=r(window.history.state)?window.history.state:null;if(e?.key==null||e.key===``){let e={route:`${window.location.pathname}${window.location.search}`,navigationId:0,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:de()};window.history.replaceState(e,``,window.location.pathname+window.location.search+window.location.hash)}},a[26]=K):K=a[26];let q;a[27]===c?q=a[28]:(q=[c],a[27]=c,a[28]=q),u(K,q);let J;a[29]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{if(e.persisted){let e=window.location.pathname;O.current.captureState(e)}},a[29]=J):J=a[29];let ve=J,Y;a[30]===Symbol.for(`react.memo_cache_sentinel`)?(Y=e=>{if(e.persisted){let e=window.location.pathname,t=r(window.history.state)?window.history.state:null;requestAnimationFrame(()=>{O.current.restoreState(e),t?.scrollPosition&&window.scrollTo(t.scrollPosition.x,t.scrollPosition.y)})}},a[30]=Y):Y=a[30];let ye=Y,X,Z;a[31]===Symbol.for(`react.memo_cache_sentinel`)?(X=()=>(document.addEventListener(`click`,ge),window.addEventListener(`popstate`,_e),window.addEventListener(`pagehide`,ve),window.addEventListener(`pageshow`,ye),()=>{document.removeEventListener(`click`,ge),window.removeEventListener(`popstate`,_e),window.removeEventListener(`pagehide`,ve),window.removeEventListener(`pageshow`,ye)}),Z=[],a[31]=X,a[32]=Z):(X=a[31],Z=a[32]),u(X,Z);let Q,$;return a[33]===Symbol.for(`react.memo_cache_sentinel`)?(Q=()=>(v.current=!0,e(async(e,t)=>z.current?.(e,t)??Promise.resolve()),()=>{v.current=!1,t(),fe(),pe(),V.current?.cancel()}),$=[],a[33]=Q,a[34]=$):(Q=a[33],$=a[34]),u(Q,$),o}function se(e){return{...e}}function ce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hk-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}function le(e){console.error(`[rari] Router: Navigation error:`,e)}export{w as ClientRouter};
@@ -1 +1 @@
1
- import{d as e,v as t}from"../type-guards-BJXKlA6x.mjs";import{buildFlightRouterState as n}from"./flight-router-state.mjs";import{scheduleActionFlightRefresh as r}from"./action-flight-refresh.mjs";import{createFromFetch as i,createTemporaryReferenceSet as a,encodeReply as o}from"virtual:react-flight-client";function s(){if(typeof window>`u`)return{pathname:`/`,search:``,tree:n(`/`)};let e=window.location.pathname;return{pathname:e,search:window.location.search,tree:n(e)}}function c(){return JSON.stringify(s())}const l=3e4;function u(e){if(!t(e))return e;let{"~rariSkipRefresh":n,...r}=e;return r}function d(){return typeof window<`u`?window.location.pathname+window.location.search:`/`}const f=/* @__PURE__ */ new Set([`http:`,`https:`]);function p(e){if(typeof window<`u`)try{let t=new URL(e,window.location.href);if(!f.has(t.protocol))return;t.href!==window.location.href&&(window.location.href=t.href)}catch{}}async function m(t,n){let s=a(),f=await o(n,{temporaryReferences:s}),h={Accept:`text/x-component`,"rsc-action-id":t,"rari-router-state":c()},g;typeof f==`string`&&(h[`Content-Type`]=`text/plain;charset=UTF-8`),g=f;let _;try{_=await fetch(d(),{method:`POST`,headers:h,body:g,signal:AbortSignal.timeout(l)})}catch(n){throw n instanceof DOMException&&n.name===`TimeoutError`||e(n)&&n.name===`AbortError`?Error(`Server action "${t}" timed out after ${l}ms`):n}let v=_.headers.get(`x-action-redirect`);if(v!=null&&v!==``){let[e=``]=v.split(`;`);return e!==``&&p(e),{redirect:e}}let y=_.headers.get(`content-type`),b=y!=null&&y!==``?y:``;if(!b.startsWith(`text/x-component`)){let e=_.status>=400&&b.startsWith(`text/plain`)?await _.text().catch(()=>_.statusText):`Server action "${t}" failed with status ${_.status}: ${_.statusText}`;throw Error(e)}let x=await i(Promise.resolve(_),{callServer:m,temporaryReferences:s}),S=x.a,C=S instanceof Promise?await S:S;return r(_,x,C),u(C)}export{m as callServer};
1
+ import{d as e,v as t}from"../type-guards-BJXKlA6x.mjs";import{t as n}from"../serialize-router-state-uOGGpmBr.mjs";import{scheduleActionFlightRefresh as r}from"./action-flight-refresh.mjs";import{createFromFetch as i,createTemporaryReferenceSet as a,encodeReply as o}from"virtual:react-flight-client";const s=3e4;function c(e){if(!t(e))return e;let{"~rariSkipRefresh":n,...r}=e;return r}function l(){return typeof window<`u`?window.location.pathname+window.location.search:`/`}const u=/* @__PURE__ */ new Set([`http:`,`https:`]);function d(e){if(typeof window<`u`)try{let t=new URL(e,window.location.href);if(!u.has(t.protocol))return;t.href!==window.location.href&&(window.location.href=t.href)}catch{}}async function f(e,t){let s=a(),{headers:l,body:u}=p(await o(t,{temporaryReferences:s}));l.Accept=`text/x-component`,l[`rsc-action-id`]=e,l[`rari-router-state`]=n();let d=await m(e,l,u),_=h(d);if(_!=null)return _;await g(e,d);let v=await i(Promise.resolve(d),{callServer:f,temporaryReferences:s}),y=v.a,b=y instanceof Promise?await y:y;return r(d,v,b),c(b)}function p(e){let t={};return typeof e==`string`&&(t[`Content-Type`]=`text/plain;charset=UTF-8`),{headers:t,body:e}}async function m(t,n,r){try{return await fetch(l(),{method:`POST`,headers:n,body:r,signal:AbortSignal.timeout(s)})}catch(n){throw n instanceof DOMException&&n.name===`TimeoutError`||e(n)&&n.name===`AbortError`?Error(`Server action "${t}" timed out after ${s}ms`):n}}function h(e){let t=e.headers.get(`x-action-redirect`);if(t==null||t===``)return null;let[n=``]=t.split(`;`);return n!==``&&d(n),{redirect:n}}async function g(e,t){let n=t.headers.get(`content-type`),r=n!=null&&n!==``?n:``;if(r.startsWith(`text/x-component`))return;let i=t.status>=400&&r.startsWith(`text/plain`)?await t.text().catch(()=>t.statusText):`Server action "${e}" failed with status ${t.status}: ${t.statusText}`;throw Error(i)}export{f as callServer};
@@ -1,4 +1,4 @@
1
- import "../types-Q-x_0kVB.mjs";
1
+ import "../types-C8N3Hc8I.mjs";
2
2
  import "virtual:rsc-integration.ts";
3
3
  //#region src/runtime/entry-client.d.ts
4
4
  export declare function renderApp(): Promise<void>;
@@ -1,5 +1,5 @@
1
- import{i as e,n as t,r as n,v as r}from"../type-guards-BJXKlA6x.mjs";import{t as i}from"../router-D6X8JHst.mjs";import{a,n as o,r as s}from"../rari-global-5vGzhToD.mjs";import{t as c}from"../preload-modules-1i2BJqux.mjs";import*as l from"react";import{createFromFetch as u,createFromReadableStream as d}from"virtual:react-flight-client";import{createRoot as f,hydrateRoot as p}from"react-dom/client";import{AppRouterProvider as m}from"virtual:app-router-provider";import{ClientRouter as h}from"virtual:client-router";import"virtual:rsc-integration.ts";function g(e,t){if(e.querySelector(`.rari-error[data-rari-hydration-failure]`))return;let n=document.createElement(`div`);n.className=`rari-error`,n.setAttribute(`data-rari-hydration-failure`,`true`),n.setAttribute(`role`,`alert`),n.style.cssText=`color:red;border:1px solid red;padding:10px;border-radius:4px;background-color:#fff5f5;margin:10px 0;`;let r=document.createElement(`strong`);r.textContent=`Failed to load page: `,n.append(r,document.createTextNode(t)),e.prepend(n)}function _(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT);for(;t.nextNode();){let e=t.currentNode;if(e.nodeType===8&&`data`in e){let t=e.data;if(t===`$`||t===`$?`||t===`/$`)return!0}}return!!(e.querySelector(`[data-reactroot]`)||e.querySelectorAll(`template[data-rri]`).length>0)}function v(e){let t=e.tagName;if(t===`SCRIPT`||t===`STYLE`||t===`LINK`||t===`META`||t===`NOSCRIPT`)return!0;let n=typeof e.getAttribute==`function`?e.getAttribute.bind(e):null;return n==null?!1:n(`data-rari-nav-transition`)!=null||n(`aria-hidden`)===`true`}function y(e){let t=e.firstElementChild;for(;t!=null&&v(t);)t=t.nextElementSibling;return t}function b(e){if(_(e))return!0;let t=y(e);return t!==null&&!t.classList.contains(`rari-error`)}function x(e){return _(e)}function S(e){e.querySelectorAll(`.rari-error:not([data-rari-hydration-failure])`).forEach(e=>{e.remove()})}function C(e,t,n){return l.createElement(e,t,n)}function w(){Reflect.set(globalThis,`__rari_client_ready`,!0),window.dispatchEvent(new CustomEvent(`rari:client-ready`))}function T(e){if(e===``)return;let t=()=>{document.title.trim()===``&&(document.title=e)};t(),queueMicrotask(t),requestAnimationFrame(()=>{t(),requestAnimationFrame(t)})}function E(e){let t=document.documentElement,n=document.title.trim();x(t)?(S(t),p(document,e,{onRecoverableError(e){import.meta.env.DEV&&console.warn(`[rari] Hydration mismatch:`,e)}})):f(document).render(e),T(n),w()}
1
+ import{i as e,n as t,p as n,r,v as i}from"../type-guards-BJXKlA6x.mjs";import{t as a}from"../router-Cl4J7j1A.mjs";import{a as o,n as s,r as c}from"../rari-global-5vGzhToD.mjs";import{n as l,t as u}from"../preload-modules-Dv_GzGCm.mjs";import*as d from"react";import{createFromFetch as f,createFromReadableStream as p}from"virtual:react-flight-client";import{createRoot as m,hydrateRoot as h}from"react-dom/client";import{AppRouterProvider as g}from"virtual:app-router-provider";import{ClientRouter as _}from"virtual:client-router";import"virtual:rsc-integration.ts";function v(e,t){if(e.querySelector(`.rari-error[data-rari-hydration-failure]`))return;let n=document.createElement(`div`);n.className=`rari-error`,n.setAttribute(`data-rari-hydration-failure`,`true`),n.setAttribute(`role`,`alert`),n.style.cssText=`color:red;border:1px solid red;padding:10px;border-radius:4px;background-color:#fff5f5;margin:10px 0;`;let r=document.createElement(`strong`);r.textContent=`Failed to load page: `,n.append(r,document.createTextNode(t)),e.prepend(n)}function y(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT);for(;t.nextNode();){let e=t.currentNode;if(e.nodeType===8&&`data`in e){let t=e.data;if(t===`$`||t===`$?`||t===`/$`)return!0}}return!!(e.querySelector(`[data-reactroot]`)||e.querySelectorAll(`template[data-rri]`).length>0)}function b(e){let t=e.tagName;if(t===`SCRIPT`||t===`STYLE`||t===`LINK`||t===`META`||t===`NOSCRIPT`)return!0;let n=typeof e.getAttribute==`function`?e.getAttribute.bind(e):null;return n==null?!1:n(`data-rari-nav-transition`)!=null||n(`aria-hidden`)===`true`}function x(e){let t=e.firstElementChild;for(;t!=null&&b(t);)t=t.nextElementSibling;return t}function S(e){if(y(e))return!0;let t=x(e);return t!==null&&!t.classList.contains(`rari-error`)}function C(e){return y(e)}function w(e){e.querySelectorAll(`.rari-error:not([data-rari-hydration-failure])`).forEach(e=>{e.remove()})}function T(e,t,n){return d.createElement(e,t,n)}async function E(e){let t=l(e);for(let e=0;e<10&&n(t);e+=1)t=l(await t);if(n(t))throw Error(`[rari] Failed to resolve Flight element to a React node`);return t}function D(e){return d.isValidElement(e)&&(e.type===`html`||e.type===`HTML`)}function O(e){if(!D(e))return v(document.body,`RSC payload did not resolve to an <html> document root. Try refreshing the page.`),console.error(`[rari] Hydration skipped: Flight content is not a document root`),!1;let t=d.createElement(g,{initialPayload:{element:e}});return t=T(_,{initialRoute:window.location.pathname},t),t=T(a,{initialPathname:window.location.pathname},t),j(t),!0}function k(){Reflect.set(globalThis,`__rari_client_ready`,!0),window.dispatchEvent(new CustomEvent(`rari:client-ready`))}function A(e){if(e===``)return;let t=()=>{document.title.trim()===``&&(document.title=e)};t(),queueMicrotask(t),requestAnimationFrame(()=>{t(),requestAnimationFrame(t)})}function j(e){let t=document.documentElement,n=document.title.trim();C(t)?(w(t),h(document,e,{onRecoverableError(e){import.meta.env.DEV&&console.warn(`[rari] Hydration mismatch:`,e)}})):m(document).render(e),A(n),k()}
2
2
  /*! @preserve CLIENT_COMPONENT_IMPORTS_PLACEHOLDER */
3
- s(),o();
3
+ c(),s();
4
4
  /*! @preserve CLIENT_COMPONENT_REGISTRATIONS_PLACEHOLDER */
5
- function D(){let e=Reflect.get(globalThis,`__rari_f`);if(Array.isArray(e))return e}function O(e){return r(e)&&typeof e.rscRow==`string`}function k(e){return Array.isArray(e)&&typeof e[1]==`string`}function A(){return!!D()?.some(e=>e!==0)}function j(){let e=D();if(e?.length==null||e.length===0)return null;let t=``,n=[];for(let r of e)r!==0&&(typeof r==`string`?t+=r:k(r)&&n.push(r[1]));if(n.length>0){let e=n.map(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0))),t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}return t?new TextEncoder().encode(t):null}async function M(t,n){let r=new TextDecoder().decode(t);await c(r);let i=a(),o=i.streaming,s=!!(o?.bufferedRows&&o.bufferedRows.length>0);if(n.streaming&&(o?.complete===void 0||s)){let n=new ReadableStream({start(n){let r=!1;n.enqueue(t);let a=t=>{if(r)return;let i=e(t,O);i&&n.enqueue(new TextEncoder().encode(`\n${i.rscRow}`))},o=()=>{r||(r=!0,n.close(),window.removeEventListener(`rari:html-stream-row`,a),window.removeEventListener(`rari:stream-complete`,o))};if(window.addEventListener(`rari:html-stream-row`,a),window.addEventListener(`rari:stream-complete`,o),i.streaming?.bufferedRows){let e=[...i.streaming.bufferedRows];for(let t of e)n.enqueue(new TextEncoder().encode(`\n${t}`));i.streaming.bufferedRows=[]}i.streaming?.complete&&o()}});return d(n)}let l=new ReadableStream({start(e){e.enqueue(t),e.close()}});return d(l)}async function N(){let r=A(),o=j(),s=document.documentElement,c=b(document.body)||_(s),f=a().streaming,p=!!(f?.bufferedRows&&f.bufferedRows.length>0);try{let s,f=!r&&!p&&!c;if(c&&r&&o){let e=`Could not load interactive page data.`;try{s=await M(o,{streaming:!1})}catch(t){e=n(t,`Failed to parse embedded RSC payload.`);try{let t=window.location.pathname+window.location.search,n=import.meta.env.DEV?import.meta.env.RARI_SERVER_URL!=null&&import.meta.env.RARI_SERVER_URL!==``?import.meta.env.RARI_SERVER_URL:`http://localhost:${import.meta.env.VITE_RSC_PORT!=null&&import.meta.env.VITE_RSC_PORT!==``?import.meta.env.VITE_RSC_PORT:`3000`}`:window.location.origin,r=await fetch(n+t,{headers:{Accept:`text/x-component`},cache:`no-store`});r.ok?s=await u(Promise.resolve(r)):e=`Failed to fetch RSC payload fallback: HTTP ${r.status}.`}catch(t){e=n(t,`Failed to fetch RSC payload fallback.`),console.error(`[rari] Failed to fetch RSC payload fallback:`,t)}}if(s!=null){let e=l.createElement(m,{initialPayload:{element:s}});e=C(h,{initialRoute:window.location.pathname},e),e=C(i,{initialPathname:window.location.pathname},e),E(e)}else g(document.body,`${e} Try refreshing the page.`),console.error(`[rari] Hydration skipped: failed to load RSC payload`);return}if(f)try{let e=window.location.pathname+window.location.search,t=(import.meta.env.DEV?import.meta.env.RARI_SERVER_URL!=null&&import.meta.env.RARI_SERVER_URL!==``?import.meta.env.RARI_SERVER_URL:`http://localhost:${import.meta.env.VITE_RSC_PORT!=null&&import.meta.env.VITE_RSC_PORT!==``?import.meta.env.VITE_RSC_PORT:`3000`}`:window.location.origin)+e,n=await fetch(t,{headers:{Accept:`text/x-component`},cache:`no-store`});if(!n.ok&&n.status!==404)throw Error(`Failed to fetch RSC data: ${n.status}`);if(!n.body)throw Error(`RSC response has no body`);s=await u(Promise.resolve(n))}catch(e){if(e instanceof Promise)throw e;console.error(`[rari] Failed to fetch initial RSC data:`,e),s=null}else if(r&&o)try{s=await M(o,{streaming:!0})}catch(e){console.error(`[rari] Failed to parse embedded RSC payload:`,e),console.error(`[rari] Error stack:`,t(e)?.stack??`no stack`),s=null}else if(p)try{let t=new ReadableStream({start(t){let n=n=>{let r=e(n,O);r&&t.enqueue(new TextEncoder().encode(`${r.rscRow}\n`))},r=()=>{t.close(),window.removeEventListener(`rari:html-stream-row`,n),window.removeEventListener(`rari:stream-complete`,r)};window.addEventListener(`rari:html-stream-row`,n),window.addEventListener(`rari:stream-complete`,r);let i=a();if(i.streaming?.bufferedRows){let e=[...i.streaming.bufferedRows];i.streaming.bufferedRows=[];for(let n of e)t.enqueue(new TextEncoder().encode(`${n}\n`))}i.streaming?.complete&&r()}});s=await d(t)}catch(e){console.error(`[rari] Failed to process streaming RSC payload:`,e),s=null}if(s==null)throw Error(`No RSC data available for hydration`);let _=l.createElement(m,{initialPayload:{element:s}});_=C(h,{initialRoute:window.location.pathname},_),_=C(i,{initialPathname:window.location.pathname},_),E(_)}catch(e){console.error(`[rari] Error rendering app:`,e)}}function P(){let e=import.meta.hot;if(!e)return{};let t=e.data;return r(t)?{hasRendered:t.hasRendered===!0}:{}}function F(){let e=import.meta.hot;if(!e)return;let t=e.data;r(t)&&(t.hasRendered=!0)}(!import.meta.hot||P().hasRendered!==!0)&&(N().catch(e=>{console.error(`[rari] Fatal error:`,e)}),F());export{N as renderApp};
5
+ function M(){let e=Reflect.get(globalThis,`__rari_f`);if(Array.isArray(e))return e}function N(e){return i(e)&&typeof e.rscRow==`string`}function P(e){return Array.isArray(e)&&typeof e[1]==`string`}function F(){return!!M()?.some(e=>e!==0)}function I(){let e=M();if(e?.length==null||e.length===0)return null;let t=``,n=[];for(let r of e)r!==0&&(typeof r==`string`?t+=r:P(r)&&n.push(r[1]));if(n.length>0){let e=n.map(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0))),t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}return t?new TextEncoder().encode(t):null}async function L(t,n){let r=new TextDecoder().decode(t);await u(r);let i=o(),a=i.streaming,s=!!(a?.bufferedRows&&a.bufferedRows.length>0);if(n.streaming&&(a?.complete===void 0||s)){let n=new ReadableStream({start(n){let r=!1;n.enqueue(t);let a=t=>{if(r)return;let i=e(t,N);i&&n.enqueue(new TextEncoder().encode(`\n${i.rscRow}`))},o=()=>{r||(r=!0,n.close(),window.removeEventListener(`rari:html-stream-row`,a),window.removeEventListener(`rari:stream-complete`,o))};if(window.addEventListener(`rari:html-stream-row`,a),window.addEventListener(`rari:stream-complete`,o),i.streaming?.bufferedRows){let e=[...i.streaming.bufferedRows];for(let t of e)n.enqueue(new TextEncoder().encode(`\n${t}`));i.streaming.bufferedRows=[]}i.streaming?.complete&&o()}});return p(n)}let c=new ReadableStream({start(e){e.enqueue(t),e.close()}});return p(c)}async function R(e){let t=`Could not load interactive page data.`,n;try{n=await L(e,{streaming:!1})}catch(e){t=r(e,`Failed to parse embedded RSC payload.`);try{let e=window.location.pathname+window.location.search,r=await fetch(e,{headers:{Accept:`text/x-component`},cache:`no-store`});r.ok?n=await f(Promise.resolve(r)):t=`Failed to fetch RSC payload fallback: HTTP ${r.status}.`}catch(e){t=r(e,`Failed to fetch RSC payload fallback.`),console.error(`[rari] Failed to fetch RSC payload fallback:`,e)}}return n==null?(v(document.body,`${t} Try refreshing the page.`),console.error(`[rari] Hydration skipped: failed to load RSC payload`),{ok:!1,errorMessage:t}):(O(await E(n)),{ok:!0,errorMessage:t})}async function z(){try{let e=window.location.pathname+window.location.search,t=await fetch(e,{headers:{Accept:`text/x-component`},cache:`no-store`});if(!t.ok&&t.status!==404)throw Error(`Failed to fetch RSC data: ${t.status}`);if(!t.body)throw Error(`RSC response has no body`);return await f(Promise.resolve(t))}catch(e){if(e instanceof Promise)throw e;return console.error(`[rari] Failed to fetch initial RSC data:`,e),null}}function B(){return new ReadableStream({start(t){let n=n=>{let r=e(n,N);r&&t.enqueue(new TextEncoder().encode(`${r.rscRow}\n`))},r=()=>{t.close(),window.removeEventListener(`rari:html-stream-row`,n),window.removeEventListener(`rari:stream-complete`,r)};window.addEventListener(`rari:html-stream-row`,n),window.addEventListener(`rari:stream-complete`,r);let i=o();if(i.streaming?.bufferedRows){let e=[...i.streaming.bufferedRows];i.streaming.bufferedRows=[];for(let n of e)t.enqueue(new TextEncoder().encode(`${n}\n`))}i.streaming?.complete&&r()}})}async function V(){try{return await p(B())}catch(e){return console.error(`[rari] Failed to process streaming RSC payload:`,e),null}}async function H(e){try{return await L(e,{streaming:!0})}catch(e){return console.error(`[rari] Failed to parse embedded RSC payload:`,e),console.error(`[rari] Error stack:`,t(e)?.stack??`no stack`),null}}async function U(){let e=F(),t=I(),n=document.documentElement,r=S(document.body)||y(n),i=o().streaming,a=!!(i?.bufferedRows&&i.bufferedRows.length>0);try{if(r&&e&&t){await R(t);return}let n=!e&&!a&&!r,i;if(n?i=await z():e&&t?i=await H(t):a&&(i=await V()),i==null)throw Error(`No RSC data available for hydration`);O(await E(i))}catch(e){console.error(`[rari] Error rendering app:`,e)}}function W(){let e=import.meta.hot;if(!e)return{};let t=e.data;return i(t)?{hasRendered:t.hasRendered===!0}:{}}function G(){let e=import.meta.hot;if(!e)return;let t=e.data;i(t)&&(t.hasRendered=!0)}(!import.meta.hot||W().hasRendered!==!0)&&(U().catch(e=>{console.error(`[rari] Fatal error:`,e)}),G());export{U as renderApp};
@@ -7,4 +7,5 @@ export declare function buildFlightRouterState(pathname: string): FlightRouterSt
7
7
  export declare function segmentPathFromRouterState(tree: FlightRouterState): SegmentPath;
8
8
  export declare function segmentPathFromPathname(pathname: string): SegmentPath;
9
9
  export declare function pathnameFromSegmentPath(segmentPath: SegmentPath): string;
10
+ export declare function sharedSegmentPath(fromPathname: string, toPathname: string): SegmentPath;
10
11
  //#endregion
@@ -1 +1 @@
1
- const e=`children`;function t(e){let t=e.length;for(;t>1&&e[t-1]===`/`;)--t;return e.slice(0,t)}function n(n){let r=n===`/`||n===``?`/`:t(n)||`/`,i=r===`/`?[]:r.slice(1).split(`/`).filter(Boolean),a=[``,{}];for(let t=i.length-1;t>=0;--t)a=[i[t],{[e]:a}];return[``,{[e]:a}]}function r(e){let t=[],n=e;for(;n;){let e=n[0],r=n[1];e&&t.push(e),n=r.children}return t}function i(e){return r(n(e))}function a(e){return e.length===0?`/`:`/${e.join(`/`)}`}export{n as buildFlightRouterState,a as pathnameFromSegmentPath,i as segmentPathFromPathname,r as segmentPathFromRouterState};
1
+ const e=`children`;function t(e){let t=e.length;for(;t>1&&e[t-1]===`/`;)--t;return e.slice(0,t)}function n(n){let r=n===`/`||n===``?`/`:t(n)||`/`,i=r===`/`?[]:r.slice(1).split(`/`).filter(Boolean),a=[``,{}];for(let t=i.length-1;t>=0;--t)a=[i[t],{[e]:a}];return[``,{[e]:a}]}function r(e){let t=[],n=e;for(;n;){let e=n[0],r=n[1];e&&t.push(e),n=r.children}return t}function i(e){return r(n(e))}function a(e){return e.length===0?`/`:`/${e.join(`/`)}`}function o(e,t){let n=i(e),r=i(t),a=[],o=Math.min(n.length,r.length);for(let e=0;e<o&&n[e]===r[e];e+=1)a.push(n[e]);return a}export{n as buildFlightRouterState,a as pathnameFromSegmentPath,i as segmentPathFromPathname,r as segmentPathFromRouterState,o as sharedSegmentPath};
@@ -1,4 +1,8 @@
1
1
  import * as React from "react";
2
2
  //#region src/runtime/flight/merge-refresh.d.ts
3
+ export declare const LAYOUT_REUSE_ELEMENT = "rari-layout-reuse";
4
+ export declare const LAYOUT_REUSE_PATH_PROP = "data-rari-layout-path";
5
+ export declare function isLayoutReuseMarker(element: React.ReactElement): boolean;
6
+ export declare function spliceLayoutReuseChildren(current: React.ReactNode, nextPage: React.ReactNode, layoutPath?: string): React.ReactNode;
3
7
  export declare function mergeFlightRefresh(current: React.ReactNode, refresh: React.ReactNode): React.ReactNode;
4
8
  //#endregion
@@ -1 +1 @@
1
- import{l as e,o as t,s as n}from"../type-guards-BJXKlA6x.mjs";import*as r from"react";function i(e){return r.isValidElement(e)}function a(t){return e(t.type)}function o(e,t){let n=r.Children.toArray(e),i=r.Children.toArray(t);if(n.length===0)return t;if(i.length===0)return e;if(n.length!==i.length)return t;let a=n.map((e,t)=>s(e,i[t]));return a.length===1?a[0]:a}function s(e,s){if(e==null)return s;if(s==null)return e;if(!i(e)||!i(s))return s;if(a(e)&&a(s)){let t=n(e.type)?e.type.$$id:void 0,r=n(s.type)?s.type.$$id:void 0;if(t!=null&&t!==``&&r!=null&&r!==``&&t===r&&(e.key??null)===(s.key??null))return s}if(e.type!==s.type)return s;let c=t(e),l=t(s),u=o(c.children,l.children);if(u===l.children)return s;let d=r.Children.toArray(u);return r.cloneElement(s,l,...d)}export{s as mergeFlightRefresh};
1
+ import{l as e,o as t,s as n}from"../type-guards-BJXKlA6x.mjs";import*as r from"react";const i=`rari-layout-reuse`,a=`data-rari-layout-path`;function o(e){return r.isValidElement(e)}function s(t){return e(t.type)}function c(e){return e.type===`head`||e.type===`HEAD`}function l(e){return e.type===`html`||e.type===`HTML`}function u(e){return e.type===`body`||e.type===`BODY`}function d(e){return e.type===i}function f(e){let t=m(e)[a];return typeof t==`string`&&t!==``?t:void 0}function p(e){let t={...e};return delete t.children,t}function m(e){return t(e)}function h(e,t){if(!s(e)||!s(t))return!1;let r=n(e.type)?e.type.$$id:void 0,i=n(t.type)?t.type.$$id:void 0;return r==null||r===``||i==null||i===``||r!==i?!1:(e.key??null)===(t.key??null)}function g(e){return x(m(e).children)}function _(e){return Array.isArray(e)&&e.some(e=>Array.isArray(e))}function v(e,t){let n=e.key,i=typeof n==`string`&&n!==``?`${t}:${n.replace(/^\.+/,``)}`:t;return r.cloneElement(e,{key:i})}function y(e,t,n){return Array.isArray(e)?b(e,t==null?`.${n}`:`${t}:${n}`):e==null||e===!1||e===!0?[]:o(e)&&t!=null?[v(e,`${t}:${n}`)]:[e]}function b(e,t){if(!Array.isArray(e))return e==null||e===!1||e===!0?[]:o(e)&&t!=null?[v(e,t)]:[e];let n=[];for(let r=0;r<e.length;r+=1)n.push(...y(e[r],t,r));return n}function x(e){return e==null||e===!1||e===!0?[]:o(e)||typeof e==`string`||typeof e==`number`?[e]:Array.isArray(e)?b(e,null):r.Children.toArray(e)}function S(e){return o(e)?d(e)?!0:x(m(e).children).some(e=>S(e)):!1}function C(e){let t=e.type;return t===`title`||t===`TITLE`||t===`meta`||t===`META`||t===`link`||t===`LINK`}function w(e){if(e.type!==`link`&&e.type!==`LINK`)return!1;let t=m(e).rel;if(typeof t!=`string`||t===``)return!1;let n=t.toLowerCase();return n===`stylesheet`||n===`preload`||n===`modulepreload`||n===`preconnect`||n===`dns-prefetch`||n===`icon`||n===`shortcut icon`||n===`apple-touch-icon`}function T(e){return e.type===r.Fragment}function E(e){let t=[];for(let n of e){if(o(n)&&T(n)){t.push(...E(g(n)));continue}t.push(n)}return t}function D(e){if(e.type!==`meta`&&e.type!==`META`)return!1;let t=m(e);return t.charSet!=null||t.charset!=null||typeof t.httpEquiv==`string`&&t.httpEquiv.toLowerCase()===`content-type`||typeof t.name==`string`&&t.name.toLowerCase()===`viewport`}function O(e,t){let n=m(e);return E(t).some(e=>{if(!o(e)||!D(e))return!1;let t=m(e);return n.charSet!=null||n.charset!=null?t.charSet!=null||t.charset!=null:typeof n.httpEquiv==`string`&&n.httpEquiv.toLowerCase()===`content-type`?typeof t.httpEquiv==`string`&&t.httpEquiv.toLowerCase()===`content-type`:typeof t.name==`string`&&t.name.toLowerCase()===`viewport`})}function k(e,t){let n=m(e),r=E(g(e)),i=g(t),a=E(i);return I(e,n,[...r.filter(e=>{if(!o(e))return!0;if(e.type===`title`||e.type===`TITLE`)return!1;if(e.type===`meta`||e.type===`META`)return D(e)?!O(e,i):!1;if(!w(e))return!C(e);let t=m(e);return!a.some(e=>{if(!o(e)||!w(e))return!1;let n=m(e);return t.rel!=null&&t.rel===n.rel&&t.href===n.href})}),...a])}function A(e){return e.length===0?null:e.length===1?e[0]:[...e]}function j(e){let t=[];for(let n of x(e))t.push(M(n));return t}function M(e){if(Array.isArray(e))return A(j(e));if(!o(e))return e;if(d(e))return A(j(m(e).children));let t=m(e),n=x(t.children);if(n.length===0)return e;let r=j(n);return!_(t.children)&&r.every((e,t)=>e===n[t])?e:I(e,t,A(r))}function N(e,t){if(e.length===0)return[M(t)];if(e.length===1)return[Z(e[0],t)];let n=[],r=!1;for(let i of e)!r&&o(i)?(r=!0,n.push(Z(i,t))):n.push(i);return r?n:[M(t)]}function P(e,t){let n=[],r=0;for(let i of t){if(o(i)&&d(i)){n.push(...N(e.slice(r),i)),r=e.length;continue}let t=e[r];n.push(t===void 0?M(i):Z(t,i)),r+=1}return r<e.length&&n.push(...e.slice(r)),A(n)}function F(e,t){let n=x(e),r=x(t);return n.length===0?M(t):r.length===0?e:r.some(e=>o(e)&&d(e))?P(n,r):n.length===r.length?A(n.map((e,t)=>Z(e,r[t]))):M(t)}function I(e,t,n){let i=x(n);return r.cloneElement(e,p(t),...i.length===0?[null]:i)}function L(e,t){let n=g(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(o(i)&&f(i)===t)return{parent:e,slotIndex:r}}for(let e=0;e<n.length;e+=1){let r=n[e];if(!o(r))continue;let i=L(r,t);if(i!=null)return i}return null}function R(e){return e.type===`main`||e.type===`MAIN`||g(e).some(e=>o(e)&&R(e))}const z=/* @__PURE__ */ new Set([.../* @__PURE__ */ new Set(/* @__PURE__ */ `area.base.br.col.embed.hr.img.input.link.meta.param.source.track.wbr.AREA.BASE.BR.COL.EMBED.HR.IMG.INPUT.LINK.META.PARAM.SOURCE.TRACK.WBR`.split(`.`)),`script`,`style`,`iframe`,`textarea`,`noscript`,`template`,`canvas`,`video`,`audio`,`object`,`embed`,`svg`,`math`,`select`,`title`,`SCRIPT`,`STYLE`,`IFRAME`,`TEXTAREA`,`NOSCRIPT`,`TEMPLATE`,`CANVAS`,`VIDEO`,`AUDIO`,`OBJECT`,`EMBED`,`SVG`,`MATH`,`SELECT`,`TITLE`]);function B(e){return typeof e.type!=`string`||z.has(e.type)?!1:g(e).length===0}function V(e,t){return h(e,t)?!0:e.type===t.type&&(e.key??null)===(t.key??null)}function H(e,t){let n=g(e);if(n.length===1&&o(n[0]))return Z(n[0],t);if(!o(t)||n.length===0)return t;let r=n.findIndex(e=>o(e)&&V(e,t));if(r<0)return t;let i=[...n];return i[r]=Z(n[r],t),i}function U(e,t,n){let r=L(e,n);if(r==null)return null;let i=m(r.parent),a=g(r.parent),s=[...a],c=a[r.slotIndex];return s[r.slotIndex]=o(c)?I(c,m(c),H(c,t)):t,q(e,r.parent,I(r.parent,i,s))}function W(e,t,n,r,i){let a=[...n];return a[r]=i,I(e,t,a)}function G(e,t,n){let r=m(e),i=g(e);if(e.type===`main`||e.type===`MAIN`)return I(e,r,H(e,t));if(i.length===1&&o(i[0]))return I(e,r,K(i[0],t,n));let a=i.findIndex(e=>o(e)&&(e.type===`main`||e.type===`MAIN`));if(a>=0)return W(e,r,i,a,K(i[a],t,n));for(let a=0;a<i.length;a+=1){let s=i[a];if(o(s)&&R(s))return W(e,r,i,a,K(s,t,n))}for(let n=0;n<i.length;n+=1){let a=i[n];if(o(a)&&B(a))return W(e,r,i,n,I(a,m(a),H(a,t)))}return I(e,r,H(e,t))}function K(e,t,n){if(!o(e))return t;if(o(t)&&d(t)){let r=f(t);return K(e,m(t).children,r??n)}if(n!=null&&n!==``){let r=U(e,t,n);if(r!=null)return r}return G(e,t,n)}function q(e,t,n){if(e===t)return n;let r=m(e),i=g(e),a=[],s=!1;for(let e of i){if(!o(e)){a.push(e);continue}if(e===t){s=!0,a.push(n);continue}let r=q(e,t,n);r!==e&&(s=!0),a.push(r)}return s?I(e,r,a):e}function J(e,t){let n=m(e),r=g(e),i=g(t),a=r.find(e=>o(e)&&c(e)),s=i.find(e=>o(e)&&c(e)),l=r.find(e=>o(e)&&u(e)),d=i.find(e=>o(e)&&u(e)),f=o(a)&&o(s)?k(a,s):o(a)?a:s,p=o(l)&&o(d)?Z(l,d):o(l)?l:d,h=[];return f!=null&&h.push(f),p!=null&&h.push(p),I(e,n,h)}function Y(e,t,n){let r=m(e),i=g(e),a=i.findIndex(e=>o(e)&&u(e)),s=a>=0?i[a]:void 0,c=o(s)?K(s,t.children,n):K(e,t.children,n);if(o(s)&&a>=0){let t=[...i];return t[a]=c,I(e,r,t)}return I(e,r,c)}function X(e,t){let n=m(e),r=m(t),i=x(r.children);if(i.length===1&&o(i[0])&&d(i[0])){let t=i[0];return K(e,m(t).children,f(t))}let a=F(n.children,r.children);return a===r.children?t:S(t)?I(e,n,a):I(t,r,a)}function Z(e,t){if(e==null)return M(t);if(t==null)return e;if(!o(e)||!o(t))return t;if(d(t)){let n=m(t),r=f(t);return l(e)?Y(e,n,r):K(e,n.children,r)}return l(e)&&l(t)&&S(t)?J(e,t):c(e)||c(t)?t:h(e,t)?S(t)?X(e,t):t:e.type===t.type?X(e,t):t}export{i as LAYOUT_REUSE_ELEMENT,a as LAYOUT_REUSE_PATH_PROP,d as isLayoutReuseMarker,Z as mergeFlightRefresh,K as spliceLayoutReuseChildren};
@@ -1,4 +1,4 @@
1
- import "../types-Q-x_0kVB.mjs";
1
+ import "../types-C8N3Hc8I.mjs";
2
2
  //#region src/runtime/shared/get-client-component.d.ts
3
3
  declare function requireClientComponent(id: string): any;
4
4
  //#endregion
@@ -1 +1 @@
1
- import{v as e}from"../type-guards-BJXKlA6x.mjs";import{a as t,i as n,n as r,r as i,t as a}from"../rari-global-5vGzhToD.mjs";import{n as o,r as s}from"../get-client-component-DU5z65us.mjs";if(n().isDevelopment=process.env.NODE_ENV!==`production`,i(),a(),r(),typeof window<`u`&&(o(),Reflect.set(globalThis,`__rari_rsc_require__`,s)),typeof window<`u`){let e=t();e.streaming??={bufferedRows:[]}}if(import.meta.hot){function t(){return import.meta.env.RARI_SERVER_URL!=null&&import.meta.env.RARI_SERVER_URL!==``?import.meta.env.RARI_SERVER_URL:typeof window<`u`?window.location.origin:`http://localhost:3000`}function r(e){if(!e)return!1;try{return n().serverComponents?.has(e)===!0}catch{return!1}}let i=!1,a=[],o=/* @__PURE__ */ new Map;function s(e,t,n){o.set(e,async e=>{n(e)&&await t(e)}),import.meta.hot.on(e,t=>{(async()=>{if(!i){a.push({event:e,data:t});return}try{let n=o.get(e);n&&await n(t)}catch(t){console.error(`[rari] HMR: Error in handler for '${e}':`,t)}})()})}function c(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}function l(t){return e(t)&&Array.isArray(t.serverComponents)}function u(t){return e(t)&&typeof t.path==`string`&&t.path!==``}function d(t){return e(t)}function f(t){return e(t)}function p(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}s(`rari:register-server-component`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set,t.serverComponents.add(e.filePath)},c),s(`rari:server-components-registry`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set;for(let n of e.serverComponents)t.serverComponents.add(n)},l),s(`vite:beforeFullReload`,e=>{r(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},u),s(`rari:server-component-updated`,e=>{let t=e.id!=null&&e.id!==``?e.id:e.componentId,n=e.t!=null&&e.t!==0?e.t:e.timestamp;t!=null&&t!==``?window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:t,filePath:e.filePath!=null&&e.filePath!==``?e.filePath:e.file,type:`server-component`,timestamp:n}})):e.path!=null&&e.path!==``&&r(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},d),s(`rari:app-router-updated`,async n=>{if(n.routePath!=null&&n.routePath!==``||n.affectedRoutes!=null&&n.affectedRoutes.length!==0)try{let r=t(),i=await fetch(`${r}/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:n.filePath})});if(!i.ok)throw Error(`Component reload failed: ${i.status}`);let a=await i.json(),o=e(a)&&a.success===!0,s=e(a)&&a.reloaded===!0,c=e(a)&&a.content_unchanged===!0,l=e(a)&&typeof a.error==`string`?a.error:`Component reload unsuccessful`;if(!o&&!s)throw Error(l);if(c)return;if(await fetch(`${r}/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:n.routePath!=null&&n.routePath!==``?n.routePath:n.filePath,filePath:n.filePath})}),n.metadataChanged&&n.metadata&&(n.metadata.title!=null&&n.metadata.title!==``&&(document.title=n.metadata.title),n.metadata.description!=null&&n.metadata.description!==``)){let e=document.querySelector(`meta[name="description"]`);e||(e=document.createElement(`meta`),e.setAttribute(`name`,`description`),document.head.appendChild(e)),e.setAttribute(`content`,n.metadata.description)}window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:n.routePath,affectedRoutes:n.affectedRoutes??(n.routePath==null?[]:[n.routePath]),currentPath:window.location.pathname,preserveParams:!0}}))}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}},f),s(`rari:server-action-updated`,e=>{window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}}))},p),a.length>0?(async()=>{try{let e=[...a];a.length=0;for(let{event:t,data:n}of e){let e=o.get(t);e&&await e(n)}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{i=!0}})():i=!0}export{};
1
+ import{v as e}from"../type-guards-BJXKlA6x.mjs";import{a as t,i as n,n as r,r as i,t as a}from"../rari-global-5vGzhToD.mjs";import{n as o,r as s}from"../get-client-component-s7qprTUa.mjs";if(n().isDevelopment=process.env.NODE_ENV!==`production`,i(),a(),r(),typeof window<`u`&&(o(),Reflect.set(globalThis,`__rari_rsc_require__`,s)),typeof window<`u`){let e=t();e.streaming??={bufferedRows:[]}}if(import.meta.hot){function t(e){if(!e)return!1;try{return n().serverComponents?.has(e)===!0}catch{return!1}}let r=!1,i=[],a=/* @__PURE__ */ new Map;function o(e,t,n){a.set(e,async e=>{n(e)&&await t(e)}),import.meta.hot.on(e,t=>{(async()=>{if(!r){i.push({event:e,data:t});return}try{let n=a.get(e);n&&await n(t)}catch(t){console.error(`[rari] HMR: Error in handler for '${e}':`,t)}})()})}function s(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}function c(t){return e(t)&&Array.isArray(t.serverComponents)}function l(t){return e(t)&&typeof t.path==`string`&&t.path!==``}function u(t){return e(t)}function d(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}function f(t){return e(t)&&typeof t.filePath==`string`&&t.filePath!==``}o(`rari:register-server-component`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set,t.serverComponents.add(e.filePath)},s),o(`rari:server-components-registry`,e=>{let t=n();t.serverComponents??=/* @__PURE__ */ new Set;for(let n of e.serverComponents)t.serverComponents.add(n)},c),o(`vite:beforeFullReload`,e=>{t(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},l),o(`rari:server-component-updated`,e=>{let n=e.id!=null&&e.id!==``?e.id:e.componentId,r=e.t!=null&&e.t!==0?e.t:e.timestamp;n!=null&&n!==``?window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{componentId:n,filePath:e.filePath!=null&&e.filePath!==``?e.filePath:e.file,type:`server-component`,timestamp:r}})):e.path!=null&&e.path!==``&&t(e.path)&&window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.path}}))},u);function p(e){if(e.title!=null&&e.title!==``&&(document.title=e.title),e.description==null||e.description===``)return;let t=document.querySelector(`meta[name="description"]`);t||(t=document.createElement(`meta`),t.setAttribute(`name`,`description`),document.head.appendChild(t)),t.setAttribute(`content`,e.description)}function m(t){let n=e(t)&&t.success===!0,r=e(t)&&t.reloaded===!0,i=e(t)&&t.content_unchanged===!0,a=e(t)&&typeof t.error==`string`?t.error:`Component reload unsuccessful`;return{ok:n||r,contentUnchanged:i,errorMessage:a}}async function h(e){if(e.routePath!=null&&e.routePath!==``||e.affectedRoutes!=null&&e.affectedRoutes.length!==0)try{let t=await fetch(`/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`register`,file_path:e.filePath})});if(!t.ok)throw Error(`Component reload failed: ${t.status}`);let n=m(await t.json());if(!n.ok)throw Error(n.errorMessage);if(n.contentUnchanged)return;await fetch(`/_rari/hmr`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`invalidate`,componentId:e.routePath!=null&&e.routePath!==``?e.routePath:e.filePath,filePath:e.filePath})}),e.metadataChanged&&e.metadata&&p(e.metadata),window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`,{detail:{routePath:e.routePath,affectedRoutes:e.affectedRoutes??(e.routePath==null?[]:[e.routePath]),currentPath:window.location.pathname,preserveParams:!0}}))}catch(e){console.error(`[rari] HMR: App router update failed:`,e)}}o(`rari:app-router-updated`,h,d),o(`rari:server-action-updated`,e=>{window.dispatchEvent(new CustomEvent(`rari:rsc-invalidate`,{detail:{filePath:e.filePath,type:`server-action`}}))},f),i.length>0?(async()=>{try{let e=[...i];i.length=0;for(let{event:t,data:n}of e){let e=a.get(t);e&&await e(n)}}catch(e){console.error(`[rari] HMR: Error during event replay:`,e)}finally{r=!0}})():r=!0}export{};
@@ -0,0 +1 @@
1
+ import{buildFlightRouterState as e}from"./runtime/flight-router-state.mjs";function t(){if(typeof window>`u`)return{pathname:`/`,search:``,tree:e(`/`)};let t=window.location.pathname;return{pathname:t,search:window.location.search,tree:e(t)}}function n(){return JSON.stringify(t())}export{n as t};
@@ -0,0 +1,13 @@
1
+ import{v as e}from"./type-guards-BJXKlA6x.mjs";import{t}from"./xml-DPsk9WTz.mjs";import{i as n,n as r,t as i}from"./execute-CbhDMAQ3.mjs";import{promises as a}from"node:fs";import o from"node:path";const s=/[^\w-]/g;function c(e){return(typeof e==`string`?new Date(e):e).toISOString()}function l(e){return[` <image:image>`,` <image:loc>${t(e)}</image:loc>`,` </image:image>`].join(`
2
+ `)}function u(e){let n=[` <image:image>`,` <image:loc>${t(e.loc)}</image:loc>`];return e.title!=null&&e.title!==``&&n.push(` <image:title>${t(e.title)}</image:title>`),e.caption!=null&&e.caption!==``&&n.push(` <image:caption>${t(e.caption)}</image:caption>`),e.geoLocation!=null&&e.geoLocation!==``&&n.push(` <image:geo_location>${t(e.geoLocation)}</image:geo_location>`),e.license!=null&&e.license!==``&&n.push(` <image:license>${t(e.license)}</image:license>`),n.push(` </image:image>`),n.join(`
3
+ `)}function d(e){let t=[];for(let n of e)typeof n==`string`?t.push(l(n)):t.push(u(n));return t.join(`
4
+ `)}function f(e){return[` <video:video>`,` <video:title>${t(e.title)}</video:title>`,` <video:thumbnail_loc>${t(e.thumbnail_loc)}</video:thumbnail_loc>`,` <video:description>${t(e.description)}</video:description>`,...p(e),...m(e),...h(e),...g(e),` </video:video>`].join(`
5
+ `)}function p(e){let n=[];return e.content_loc!=null&&e.content_loc!==``&&n.push(` <video:content_loc>${t(e.content_loc)}</video:content_loc>`),e.player_loc!=null&&e.player_loc!==``&&n.push(` <video:player_loc>${t(e.player_loc)}</video:player_loc>`),n}function m(e){let n=[];return e.duration!==void 0&&n.push(` <video:duration>${e.duration}</video:duration>`),e.expiration_date!=null&&e.expiration_date!==``&&n.push(` <video:expiration_date>${t(e.expiration_date)}</video:expiration_date>`),e.rating!==void 0&&n.push(` <video:rating>${e.rating}</video:rating>`),e.view_count!==void 0&&n.push(` <video:view_count>${e.view_count}</video:view_count>`),e.publication_date!=null&&e.publication_date!==``&&n.push(` <video:publication_date>${t(e.publication_date)}</video:publication_date>`),n}function h(e){let t=[];return e.family_friendly!==void 0&&t.push(` <video:family_friendly>${e.family_friendly?`yes`:`no`}</video:family_friendly>`),e.requires_subscription!==void 0&&t.push(` <video:requires_subscription>${e.requires_subscription?`yes`:`no`}</video:requires_subscription>`),e.live!==void 0&&t.push(` <video:live>${e.live?`yes`:`no`}</video:live>`),t}function g(e){let n=[];if(e.restriction&&n.push(` <video:restriction relationship="${t(e.restriction.relationship)}">${t(e.restriction.content)}</video:restriction>`),e.platform&&n.push(` <video:platform relationship="${t(e.platform.relationship)}">${t(e.platform.content)}</video:platform>`),e.uploader){let r=e.uploader.info!=null&&e.uploader.info!==``?` info="${t(e.uploader.info)}"`:``;n.push(` <video:uploader${r}>${t(e.uploader.name)}</video:uploader>`)}if(e.tag)for(let r of e.tag)n.push(` <video:tag>${t(r)}</video:tag>`);return n}function _(e){return e.map(e=>f(e)).join(`
6
+ `)}function v(e){let t=e.some(e=>e.images&&e.images.length>0),n=e.some(e=>e.videos&&e.videos.length>0),r=e.some(e=>e.alternates?.languages),i=[`xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"`];return t&&i.push(`xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"`),n&&i.push(`xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"`),r&&i.push(`xmlns:xhtml="http://www.w3.org/1999/xhtml"`),i}function y(e,n){e.push(` <url>`),e.push(` <loc>${t(n.url)}</loc>`),n.lastModified!=null&&e.push(` <lastmod>${c(n.lastModified)}</lastmod>`),n.changeFrequency&&e.push(` <changefreq>${n.changeFrequency}</changefreq>`),n.priority!==void 0&&e.push(` <priority>${n.priority}</priority>`)}function b(e,n){if(n.alternates?.languages)for(let[r,i]of Object.entries(n.alternates.languages))e.push(` <xhtml:link rel="alternate" hreflang="${t(r)}" href="${t(i)}" />`)}function x(e,t){t.images&&t.images.length>0&&e.push(d(t.images)),t.videos&&t.videos.length>0&&e.push(_(t.videos))}function S(e){let t=[`<?xml version="1.0" encoding="UTF-8"?>`,`<urlset ${v(e).join(` `)}>`];for(let n of e)y(t,n),b(t,n),x(t,n),t.push(` </url>`);return t.push(`</urlset>`),t.join(`
7
+ `)}
8
+ /* v8 ignore start - file system operations, better tested in integration/e2e */
9
+ async function C(e,t=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.json`]){let r=await n({appDir:e,staticFileName:`sitemap.xml`,dynamicBaseName:`sitemap`,extensions:t});return r?[r]:[]}function w(e){return typeof e==`function`||Array.isArray(e)}function T(t){return e(t)?w(t.default):!1}async function E(e,t,n={},r){let a=await i({virtualId:`\0virtual:sitemap`,sourcePath:e.path,sourceCode:t,aliases:n,projectRoot:r,kind:`sitemap`,pluginName:`virtual-sitemap`,label:`sitemap`});if(!T(a))throw Error(`Sitemap module must export a default sitemap array or sitemap generator function`);return a}async function D(e,t){let n=await e.generateSitemaps(),r=o.join(t,`sitemap`);await a.mkdir(r,{recursive:!0});let i=/* @__PURE__ */ new Map;for(let{id:t}of n)try{let n=t.replace(s,`_`);(!n||n.length===0)&&(n=`_`);let c=i.get(n);if(c!==void 0)throw Error(`Duplicate sanitized sitemap ID "${n}": original IDs "${c}" and "${t}" collide`);i.set(n,t);let l=typeof e.default==`function`?await e.default({id:t}):e.default;if(!Array.isArray(l))throw Error(`Sitemap default export must resolve to a sitemap entry array`);let u=S(l),d=o.join(r,`${n}.xml`);await a.writeFile(d,u)}catch(e){throw Error(`Failed to generate sitemap for id "${t}"`,{cause:e})}}async function O(e,t){let n=typeof e.default==`function`?await e.default():e.default;if(!Array.isArray(n))throw Error(`Sitemap default export must resolve to a sitemap entry array`);let r=S(n),i=o.join(t,`sitemap.xml`);await a.writeFile(i,r)}
10
+ /* v8 ignore start - file system operations and dynamic imports, better tested in integration/e2e */
11
+ async function k(e){let{appDir:t,extensions:n,outDir:i,aliases:s={}}=e,c=await C(t,n);if(c.length===0)return!1;await a.mkdir(i,{recursive:!0});let l=c[0];if(l.type===`static`){let e=o.join(i,`sitemap.xml`);return await a.copyFile(l.path,e),!0}try{let e=await E(l,await a.readFile(l.path,`utf-8`),s,r(t));return typeof e.generateSitemaps==`function`?await D(e,i):await O(e,i),!0}catch(e){return console.error(`[rari] Failed to build/execute sitemap file:`,e),!1}}
12
+ /* v8 ignore stop */
13
+ export{k as generateSitemapFiles};
@@ -0,0 +1,61 @@
1
+ //#region src/image/image.d.ts
2
+ interface ImageProps {
3
+ readonly src: string | StaticImageData;
4
+ readonly alt: string;
5
+ readonly width?: number;
6
+ readonly height?: number;
7
+ readonly quality?: number;
8
+ readonly preload?: boolean;
9
+ readonly loading?: 'lazy' | 'eager';
10
+ readonly placeholder?: 'blur' | 'empty';
11
+ readonly blurDataURL?: string;
12
+ readonly fill?: boolean;
13
+ readonly sizes?: string;
14
+ readonly style?: React.CSSProperties;
15
+ readonly className?: string;
16
+ readonly onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
17
+ readonly onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
18
+ readonly unoptimized?: boolean;
19
+ readonly loader?: (props: Readonly<{
20
+ src: string;
21
+ width: number;
22
+ quality: number;
23
+ }>) => string;
24
+ readonly overrideSrc?: string;
25
+ readonly decoding?: 'async' | 'sync' | 'auto';
26
+ }
27
+ interface StaticImageData {
28
+ readonly src: string;
29
+ readonly height: number;
30
+ readonly width: number;
31
+ readonly blurDataURL?: string;
32
+ }
33
+ declare function Image({ src, alt, width, height, quality, preload, loading, placeholder, blurDataURL, fill, sizes, style, className, onLoad, onError, unoptimized, loader, overrideSrc, decoding }: ImageProps): import("react").JSX.Element;
34
+ //#endregion
35
+ //#region src/image/static-modules.d.ts
36
+ declare module '*.avif' {
37
+ const image: StaticImageData;
38
+ export default image;
39
+ }
40
+ declare module '*.gif' {
41
+ const image: StaticImageData;
42
+ export default image;
43
+ }
44
+ declare module '*.jpeg' {
45
+ const image: StaticImageData;
46
+ export default image;
47
+ }
48
+ declare module '*.jpg' {
49
+ const image: StaticImageData;
50
+ export default image;
51
+ }
52
+ declare module '*.png' {
53
+ const image: StaticImageData;
54
+ export default image;
55
+ }
56
+ declare module '*.webp' {
57
+ const image: StaticImageData;
58
+ export default image;
59
+ }
60
+ //#endregion
61
+ export { ImageProps as n, StaticImageData as r, Image as t };
@@ -104,6 +104,7 @@ declare global {
104
104
  '__rari_client_ready'?: boolean;
105
105
  '__rari_f'?: ReadonlyArray<0 | string | readonly [2, string]>;
106
106
  '__rari_chunk_load__'?: (chunkId: string) => Promise<unknown>;
107
+ '__rari_get_script_filename__'?: (chunkId: string) => string;
107
108
  }
108
109
  interface Window {
109
110
  '~rari'?: GlobalWithRari['~rari'];
@@ -7,15 +7,17 @@ declare module 'virtual:react-flight-client' {
7
7
  readonly value?: T;
8
8
  readonly reason?: unknown;
9
9
  }
10
- export function createServerReference<A extends unknown[] = unknown[], R = unknown>(id: string, callServer: (id: string, args: A) => Promise<R>, encodeFormAction?: (args: A) => Promise<FormData | string>): unknown;
10
+ export function createServerReference<A extends unknown[] = unknown[], R = unknown>(id: string, callServer?: (id: string, args: A) => Promise<R>, encodeFormAction?: (args: A) => Promise<FormData | string>, findSourceMapURL?: (filename: string, environmentName: string) => string | null, functionName?: string): unknown;
11
11
  export function createFromReadableStream<T>(stream: ReadableStream<Uint8Array>, options?: Readonly<{
12
12
  readonly callServer?: (id: string, args: readonly unknown[]) => Promise<unknown>;
13
13
  readonly moduleMap?: unknown;
14
14
  readonly moduleLoading?: unknown;
15
+ readonly findSourceMapURL?: (filename: string, environmentName: string) => string | null;
15
16
  }>): Thenable<T>;
16
17
  export function createFromFetch<T>(promiseForResponse: Promise<Response>, options?: Readonly<{
17
18
  readonly callServer?: (id: string, args: readonly unknown[]) => Promise<unknown>;
18
19
  readonly temporaryReferences?: Map<string, unknown>;
20
+ readonly findSourceMapURL?: (filename: string, environmentName: string) => string | null;
19
21
  }>): Thenable<T>;
20
22
  export function createTemporaryReferenceSet(): Map<string, unknown>;
21
23
  export function encodeReply(value: unknown, options?: Readonly<{
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as RouteSegmentType, D as RouteContext, E as ApiRouteHandlers, O as RouteHandler, S as RouteSegment, T as ApiResponse, _ as LayoutProps, a as Sitemap, b as NotFoundEntry, c as SitemapVideo, d as AppRouteMatch, f as ErrorEntry, g as LayoutEntry, h as GenerateStaticParams, i as RobotsRule, l as AppRouteEntry, m as GenerateMetadata, o as SitemapEntry, p as ErrorProps, r as Robots, s as SitemapImage, u as AppRouteManifest, v as LoadingEntry, w as TemplateEntry, x as PageProps, y as Metadata } from "./types-xTbuE-Js.mjs";
1
+ import { C as RouteSegmentType, D as RouteContext, E as ApiRouteHandlers, O as RouteHandler, S as RouteSegment, T as ApiResponse, _ as LayoutProps, a as Sitemap, b as NotFoundEntry, c as SitemapVideo, d as AppRouteMatch, f as ErrorEntry, g as LayoutEntry, h as GenerateStaticParams, i as RobotsRule, l as AppRouteEntry, m as GenerateMetadata, o as SitemapEntry, p as ErrorProps, r as Robots, s as SitemapImage, u as AppRouteManifest, v as LoadingEntry, w as TemplateEntry, x as PageProps, y as Metadata } from "./types-DfSnnFaF.mjs";
2
2
  import { a as ProxyModule, c as RariURL, i as ProxyMatcher, l as RequestCookies, n as ProxyConfig, o as ProxyResult, r as ProxyFunction, s as RariFetchEvent, t as CookieOptions, u as ResponseCookies } from "./types-DAdRjhuk.mjs";
3
3
  import { UserConfig } from "vite-plus";
4
4
  import { ReactCompilerOptions as ReactCompilerOptions$1 } from "oxc-transform-react";
@@ -96,6 +96,7 @@ interface ServerConfig {
96
96
  //#region src/vite/server/build.d.ts
97
97
  interface ServerBuildOptions {
98
98
  readonly outDir?: string;
99
+ readonly clientOutDir?: string;
99
100
  readonly rscDir?: string;
100
101
  readonly manifestPath?: string;
101
102
  readonly serverConfigPath?: string;
@@ -290,6 +291,7 @@ export interface RariOptions {
290
291
  readonly pathname: string;
291
292
  readonly search?: string;
292
293
  }>;
294
+ readonly includeBundledAssets?: boolean;
293
295
  readonly deviceSizes?: readonly number[];
294
296
  readonly imageSizes?: readonly number[];
295
297
  readonly formats?: readonly ('avif' | 'webp')[];