@jingyi0605/codingns 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/assets/AdaptiveButlerPage-CLHLiZSY.js +2 -0
- package/dist/public/assets/{App-CHsm-VrM.js → App-FYuZfAoO.js} +6 -6
- package/dist/public/assets/{BootstrapPage-Bp0KfySv.js → BootstrapPage-3xpnsG-A.js} +1 -1
- package/dist/public/assets/ConversationPage-C5_ZqhU3.js +9 -0
- package/dist/public/assets/{DesktopDetachPreviewPage-DlDSb_tf.js → DesktopDetachPreviewPage-B77MG82y.js} +1 -1
- package/dist/public/assets/{DesktopModal-Csj5AdAN.js → DesktopModal-K5bEcj38.js} +1 -1
- package/dist/public/assets/{DesktopWindowPage-CacXiWjV.js → DesktopWindowPage-DbG-RBAf.js} +1 -1
- package/dist/public/assets/{FileContextPanel-DzMUQvE5.js → FileContextPanel-C-1yOton.js} +1 -1
- package/dist/public/assets/{GitSidebar-C8IC18GH.js → GitSidebar-DFHAPT3S.js} +1 -1
- package/dist/public/assets/{MobileCreateSessionSheet-BtqR_hKc.js → MobileCreateSessionSheet-gOyAZ857.js} +1 -1
- package/dist/public/assets/{MobileSheet-Co-qPMBD.js → MobileSheet-D0MfNkTv.js} +1 -1
- package/dist/public/assets/{PluginAccessOverview-D-KXkcyj.js → PluginAccessOverview-IrYIPLg3.js} +1 -1
- package/dist/public/assets/{PluginContainerPage-BKwCIs4r.js → PluginContainerPage-b9LQVuqG.js} +1 -1
- package/dist/public/assets/{PluginDetailPage-Djv_swcO.js → PluginDetailPage-BX7gohai.js} +1 -1
- package/dist/public/assets/{PluginsListPage-DAECNoN6.js → PluginsListPage-R0SibHMi.js} +1 -1
- package/dist/public/assets/{PureConversationPage-DP1X7Hix.js → PureConversationPage-CcakFvo0.js} +1 -1
- package/dist/public/assets/{RelayConnectEntryPage-xL_IPH8a.js → RelayConnectEntryPage-cAVq_kNM.js} +1 -1
- package/dist/public/assets/{ServerSettingsModal-CyhMgk10.js → ServerSettingsModal-BJwYHdKD.js} +1 -1
- package/dist/public/assets/{SessionIndexPage-CVEz50tc.js → SessionIndexPage-CJKRHB_F.js} +1 -1
- package/dist/public/assets/SettingsPage-Csp7wEBC.js +2 -0
- package/dist/public/assets/{TerminalManagerPanel-wVnoRA8u.js → TerminalManagerPanel-2HG-NyfR.js} +1 -1
- package/dist/public/assets/{ToolFilesPage-BospXumK.js → ToolFilesPage-BAZdjNaF.js} +1 -1
- package/dist/public/assets/{ToolGitPage-B2zOeCAD.js → ToolGitPage-CGkPmgsz.js} +1 -1
- package/dist/public/assets/{ToolProcessesPage-BDShao4b.js → ToolProcessesPage-BHpS7-VH.js} +1 -1
- package/dist/public/assets/{ToolsHomePage-s4zH7D9M.js → ToolsHomePage-DDGqYwYU.js} +1 -1
- package/dist/public/assets/{WorkbenchLandingPage-D51QCU_u.js → WorkbenchLandingPage-B4aooEYJ.js} +1 -1
- package/dist/public/assets/WorkbenchLayout-DrAvGjGK.js +1083 -0
- package/dist/public/assets/{WorkbenchModal-YsyEdJ_m.js → WorkbenchModal-BK5ix8YI.js} +1 -1
- package/dist/public/assets/WorkbenchShellRoute-DpycFsbp.css +1 -0
- package/dist/public/assets/WorkbenchShellRoute-p1FvkoPN.js +1 -0
- package/dist/public/assets/{WorkspaceDebugDetailPage-CMjNLqFq.js → WorkspaceDebugDetailPage-CPgAe8dd.js} +1 -1
- package/dist/public/assets/{WorkspaceDetailPage-CKxTbPKh.js → WorkspaceDetailPage-YM85dTGg.js} +1 -1
- package/dist/public/assets/{WorkspaceHomePage-CEy4ShCu.js → WorkspaceHomePage-DPPvwM93.js} +1 -1
- package/dist/public/assets/{client-runtime-manager-BFXU9DmS.js → client-runtime-manager-Clq-8rWh.js} +1 -1
- package/dist/public/assets/{host-alias-Zb2xyVrf.js → host-alias-BxzpRYrt.js} +1 -1
- package/dist/public/assets/index-BArTKWXk.js +50 -0
- package/dist/public/assets/index-CqKepLbu.css +1 -0
- package/dist/public/assets/{login-direct-candidate-resolver-DL8DS-Si.js → login-direct-candidate-resolver-BiWwFKnk.js} +1 -1
- package/dist/public/assets/peer-host-config-sync-kTom1_pp.js +1 -0
- package/dist/public/assets/{plugin-permission-copy-DrLk22m5.js → plugin-permission-copy-1_1wViri.js} +1 -1
- package/dist/public/assets/{plugins-api-COF4oh24.js → plugins-api-C0JqR2-W.js} +1 -1
- package/dist/public/assets/{preferences-service-CEWNV1w9.js → preferences-service-DWeLWZST.js} +1 -1
- package/dist/public/assets/{relay-entry-Cmc8vTlE.js → relay-entry-ClEd3cjN.js} +1 -1
- package/dist/public/assets/{useRegisteredDebugTemplates-FdmHG2S4.js → useRegisteredDebugTemplates-wJGOYam9.js} +1 -1
- package/dist/public/assets/{workbench-navigation-ED0157V-.js → workbench-navigation-vIWt3Rv_.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/server/modules/client/client-controller.d.ts +1 -0
- package/dist/server/modules/client/client-controller.js +4 -0
- package/dist/server/modules/client/client-controller.js.map +1 -1
- package/dist/server/modules/client/client-service.d.ts +3 -0
- package/dist/server/modules/client/client-service.js +3 -0
- package/dist/server/modules/client/client-service.js.map +1 -1
- package/dist/server/modules/client/npm-global-package-service.js +32 -7
- package/dist/server/modules/client/npm-global-package-service.js.map +1 -1
- package/dist/server/modules/peer-host/host-ws-proxy-service.js +73 -12
- package/dist/server/modules/peer-host/host-ws-proxy-service.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-client.d.ts +2 -0
- package/dist/server/modules/provider/provider-discovery-helper-client.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-process.js +6 -3
- package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-runtime.js +4 -1
- package/dist/server/modules/provider/provider-discovery-runtime.js.map +1 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +84 -20
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/session-controller.js +2 -1
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.d.ts +8 -0
- package/dist/server/modules/sessions/session-history-service.js +123 -5
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +27 -0
- package/dist/server/modules/sessions/session-live-runtime-service.js +457 -9
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-permission-request-service.d.ts +17 -1
- package/dist/server/modules/sessions/session-permission-request-service.js +397 -9
- package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-config-service.js +1 -0
- package/dist/server/modules/sessions/session-provider-config-service.js.map +1 -1
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +15 -1
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-process-handlers.d.ts +1 -0
- package/dist/server/modules/tasks/task-helper-process-handlers.js +4 -1
- package/dist/server/modules/tasks/task-helper-process-handlers.js.map +1 -1
- package/dist/server/modules/workbench/workbench-service.js +7 -4
- package/dist/server/modules/workbench/workbench-service.js.map +1 -1
- package/dist/server/routes/client.js +1 -0
- package/dist/server/routes/client.js.map +1 -1
- package/dist/server/shared/utils/peer-host-proxy-log.d.ts +3 -0
- package/dist/server/shared/utils/peer-host-proxy-log.js +48 -0
- package/dist/server/shared/utils/peer-host-proxy-log.js.map +1 -0
- package/dist/server/storage/repositories/session-send-queue-repository.d.ts +1 -0
- package/dist/server/storage/repositories/session-send-queue-repository.js +23 -0
- package/dist/server/storage/repositories/session-send-queue-repository.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/index.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/index.js +1 -0
- package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +2 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +93 -12
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +3 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +116 -2
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +19 -8
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +27 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +48 -4
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +53 -15
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +30 -2
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -1
- package/package.json +2 -1
- package/scripts/claude-hook-bridge.cjs +167 -0
- package/dist/public/assets/AdaptiveButlerPage-BYETYaIe.js +0 -2
- package/dist/public/assets/ConversationPage-BCrNml1k.js +0 -9
- package/dist/public/assets/SettingsPage-CQNCrgaj.js +0 -2
- package/dist/public/assets/WorkbenchLayout-Bo2BbMY6.js +0 -1081
- package/dist/public/assets/WorkbenchShellRoute-D3l4aWJS.js +0 -1
- package/dist/public/assets/WorkbenchShellRoute-D5fnyF8z.css +0 -1
- package/dist/public/assets/index-BilHJjYU.js +0 -50
- package/dist/public/assets/index-OR7OITpQ.css +0 -1
- package/dist/public/assets/peer-host-config-sync-d2ZcPC5P.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js","assets/ServerSettingsModal-
|
|
2
|
-
var Fn=Object.defineProperty;var Vn=(e,t,r)=>t in e?Fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _e=(e,t,r)=>Vn(e,typeof t!="symbol"?t+"":t,r);import{u as Qe,j as p,t as le,a as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js","assets/ServerSettingsModal-BJwYHdKD.js","assets/index-BArTKWXk.js","assets/index-CqKepLbu.css","assets/relay-entry-ClEd3cjN.js","assets/WorkbenchModal-BK5ix8YI.js","assets/DesktopModal-K5bEcj38.js","assets/BootstrapPage-3xpnsG-A.js","assets/RelayConnectEntryPage-cAVq_kNM.js","assets/DesktopDetachPreviewPage-B77MG82y.js","assets/DesktopWindowPage-DbG-RBAf.js","assets/WorkbenchLayout-DrAvGjGK.js","assets/workbench-navigation-vIWt3Rv_.js","assets/host-alias-BxzpRYrt.js","assets/MobileSheet-D0MfNkTv.js","assets/WorkbenchLayout-BZdfVest.css","assets/FileContextPanel-C-1yOton.js","assets/GitSidebar-DFHAPT3S.js","assets/TerminalManagerPanel-2HG-NyfR.js","assets/WorkbenchShellRoute-p1FvkoPN.js","assets/WorkbenchShellRoute-DpycFsbp.css","assets/WorkbenchLandingPage-B4aooEYJ.js","assets/WorkspaceHomePage-DPPvwM93.js","assets/butler-records-events-DgWCG364.js","assets/MobileCreateSessionSheet-gOyAZ857.js","assets/WorkspaceDetailPage-YM85dTGg.js","assets/useRegisteredDebugTemplates-wJGOYam9.js","assets/WorkspaceDebugDetailPage-CPgAe8dd.js","assets/SessionIndexPage-CJKRHB_F.js","assets/styles-DwSuZo1w.js","assets/styles-BhKoKfQ_.css","assets/ConversationPage-C5_ZqhU3.js","assets/PureConversationPage-CcakFvo0.js","assets/ToolsHomePage-DDGqYwYU.js","assets/ToolFilesPage-BAZdjNaF.js","assets/ToolGitPage-CGkPmgsz.js","assets/ToolProcessesPage-BHpS7-VH.js","assets/PluginsListPage-R0SibHMi.js","assets/plugins-api-C0JqR2-W.js","assets/PluginDetailPage-BX7gohai.js","assets/PluginAccessOverview-IrYIPLg3.js","assets/plugin-permission-copy-1_1wViri.js","assets/PluginContainerPage-b9LQVuqG.js","assets/AdaptiveButlerPage-CLHLiZSY.js","assets/SettingsPage-Csp7wEBC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Fn=Object.defineProperty;var Vn=(e,t,r)=>t in e?Fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _e=(e,t,r)=>Vn(e,typeof t!="symbol"?t+"":t,r);import{u as Qe,j as p,t as le,a as Qt,g as Bn,r as zn,b as f,R as Hn,c as be,_ as z,d as Wn,e as he,h as Mt,f as He,i as Dt,n as Kr,k as Yr,l as $n,m as Kn,o as _t,p as Yn,q as Gn,s as Jn,v as qn,w as Xn,x as $t,y as Qn,z as Zn,A as ea,B as ta,C as ra,I as na}from"./index-BArTKWXk.js";function aa(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(n,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const ia=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function oa({variant:e="default",className:t}){const r=Qe(a=>a.profile.language);function n(a){a!==r&&Qt({language:a}).catch(()=>{})}return p.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[p.jsx("span",{className:"language-switcher-label",children:le("common.language")}),p.jsx("div",{className:"language-switcher-options",role:"group","aria-label":le("common.language"),children:ia.map(a=>p.jsx("button",{type:"button",className:`language-switcher-option${r===a.id?" active":""}`,"aria-pressed":r===a.id,onClick:()=>n(a.id),children:le(a.labelKey)},a.id))})]})}var Gr=zn();const sa=Bn(Gr),la=aa({__proto__:null,default:sa},[Gr]);/**
|
|
3
3
|
* @remix-run/router v1.23.2
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
@@ -8,8 +8,8 @@ var Fn=Object.defineProperty;var Vn=(e,t,r)=>t in e?Fn(e,t,{enumerable:!0,config
|
|
|
8
8
|
* LICENSE.md file in the root directory of this source tree.
|
|
9
9
|
*
|
|
10
10
|
* @license MIT
|
|
11
|
-
*/function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},J.apply(this,arguments)}var re;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(re||(re={}));const wr="popstate";function ca(e){e===void 0&&(e={});function t(n,a){let{pathname:i,search:o,hash:l}=n.location;return ct("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:dt(a)}return da(t,r,null,e)}function U(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function $e(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ua(){return Math.random().toString(36).substr(2,8)}function br(e,t){return{usr:e.state,key:e.key,idx:t}}function ct(e,t,r,n){return r===void 0&&(r=null),J({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ue(t):t,{state:r,key:t&&t.key||n||ua()})}function dt(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Ue(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function da(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,l=re.Pop,c=null,d=m();d==null&&(d=0,o.replaceState(J({},o.state,{idx:d}),""));function m(){return(o.state||{idx:null}).idx}function g(){l=re.Pop;let D=m(),F=D==null?null:D-d;d=D,c&&c({action:l,location:E.location,delta:F})}function w(D,F){l=re.Push;let L=ct(E.location,D,F);d=m()+1;let G=br(L,d),ee=E.createHref(L);try{o.pushState(G,"",ee)}catch(K){if(K instanceof DOMException&&K.name==="DataCloneError")throw K;a.location.assign(ee)}i&&c&&c({action:l,location:E.location,delta:1})}function b(D,F){l=re.Replace;let L=ct(E.location,D,F);d=m();let G=br(L,d),ee=E.createHref(L);o.replaceState(G,"",ee),i&&c&&c({action:l,location:E.location,delta:0})}function P(D){let F=a.location.origin!=="null"?a.location.origin:a.location.href,L=typeof D=="string"?D:dt(D);return L=L.replace(/ $/,"%20"),U(F,"No window.location.(origin|href) available to create URL for href: "+L),new URL(L,F)}let E={get action(){return l},get location(){return e(a,o)},listen(D){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(wr,g),c=D,()=>{a.removeEventListener(wr,g),c=null}},createHref(D){return t(a,D)},createURL:P,encodeLocation(D){let F=P(D);return{pathname:F.pathname,search:F.search,hash:F.hash}},push:w,replace:b,go(D){return o.go(D)}};return E}var H;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(H||(H={}));const fa=new Set(["lazy","caseSensitive","path","id","index","children"]);function ha(e){return e.index===!0}function Lt(e,t,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),e.map((a,i)=>{let o=[...r,String(i)],l=typeof a.id=="string"?a.id:o.join("-");if(U(a.index!==!0||!a.children,"Cannot specify children on an index route"),U(!n[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),ha(a)){let c=J({},a,t(a),{id:l});return n[l]=c,c}else{let c=J({},a,t(a),{id:l,children:void 0});return n[l]=c,a.children&&(c.children=Lt(a.children,t,o,n)),c}})}function Be(e,t,r){return r===void 0&&(r="/"),Tt(e,t,r,!1)}function Tt(e,t,r,n){let a=typeof t=="string"?Ue(t):t,i=ft(a.pathname||"/",r);if(i==null)return null;let o=Jr(e);ma(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=Pa(i);l=Ra(o[c],d,n)}return l}function pa(e,t){let{route:r,pathname:n,params:a}=e;return{id:r.id,pathname:n,params:a,data:t[r.id],handle:r.handle}}function Jr(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(U(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let d=Me([n,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(U(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),Jr(i.children,t,m,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:Ea(d,i.index),routesMeta:m})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of qr(i.path))a(i,o,c)}),t}function qr(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=qr(n.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function ma(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Sa(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const ga=/^:[\w-]+$/,va=3,ya=2,wa=1,ba=10,xa=-2,xr=e=>e==="*";function Ea(e,t){let r=e.split("/"),n=r.length;return r.some(xr)&&(n+=xa),t&&(n+=ya),r.filter(a=>!xr(a)).reduce((a,i)=>a+(ga.test(i)?va:i===""?wa:ba),n)}function Sa(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function Ra(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,a={},i="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],d=l===n.length-1,m=i==="/"?t:t.slice(i.length)||"/",g=Er({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},m),w=c.route;if(!g&&d&&r&&!n[n.length-1].route.index&&(g=Er({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},m)),!g)return null;Object.assign(a,g.params),o.push({params:a,pathname:Me([i,g.pathname]),pathnameBase:La(Me([i,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(i=Me([i,g.pathnameBase]))}return o}function Er(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=_a(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((d,m,g)=>{let{paramName:w,isOptional:b}=m;if(w==="*"){let E=l[g]||"";o=i.slice(0,i.length-E.length).replace(/(.)\/+$/,"$1")}const P=l[g];return b&&!P?d[w]=void 0:d[w]=(P||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function _a(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),$e(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Pa(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return $e(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ft(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Ta=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ca=e=>Ta.test(e);function Da(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?Ue(e):e,i;if(r)if(Ca(r))i=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),$e(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=Sr(r.substring(1),"/"):i=Sr(r,t)}else i=t;return{pathname:i,search:Na(n),hash:ja(a)}}function Sr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Ft(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Xr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Zt(e,t){let r=Xr(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function er(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=Ue(e):(a=J({},e),U(!a.pathname||!a.pathname.includes("?"),Ft("?","pathname","search",a)),U(!a.pathname||!a.pathname.includes("#"),Ft("#","pathname","hash",a)),U(!a.search||!a.search.includes("#"),Ft("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=r;else{let g=t.length-1;if(!n&&o.startsWith("..")){let w=o.split("/");for(;w[0]==="..";)w.shift(),g-=1;a.pathname=w.join("/")}l=g>=0?t[g]:"/"}let c=Da(a,l),d=o&&o!=="/"&&o.endsWith("/"),m=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||m)&&(c.pathname+="/"),c}const Me=e=>e.join("/").replace(/\/\/+/g,"/"),La=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Na=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ja=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Nt{constructor(t,r,n,a){a===void 0&&(a=!1),this.status=t,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function ut(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Qr=["post","put","patch","delete"],Ia=new Set(Qr),Ma=["get",...Qr],Ua=new Set(Ma),Oa=new Set([301,302,303,307,308]),ka=new Set([307,308]),Vt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Aa={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},at={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},tr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Fa=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Zr="remix-router-transitions";function Va(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",n=!r;U(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let s=e.detectErrorBoundary;a=u=>({hasErrorBoundary:s(u)})}else a=Fa;let i={},o=Lt(e.routes,a,void 0,i),l,c=e.basename||"/",d=e.dataStrategy||Wa,m=e.patchRoutesOnNavigation,g=J({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),w=null,b=new Set,P=null,E=null,D=null,F=e.hydrationData!=null,L=Be(o,e.history.location,c),G=!1,ee=null;if(L==null&&!m){let s=ce(404,{pathname:e.history.location.pathname}),{matches:u,route:h}=Mr(o);L=u,ee={[h.id]:s}}L&&!e.hydrationData&&xt(L,o,e.history.location.pathname).active&&(L=null);let K;if(L)if(L.some(s=>s.route.lazy))K=!1;else if(!L.some(s=>s.route.loader))K=!0;else if(g.v7_partialHydration){let s=e.hydrationData?e.hydrationData.loaderData:null,u=e.hydrationData?e.hydrationData.errors:null;if(u){let h=L.findIndex(y=>u[y.route.id]!==void 0);K=L.slice(0,h+1).every(y=>!Kt(y.route,s,u))}else K=L.every(h=>!Kt(h.route,s,u))}else K=e.hydrationData!=null;else if(K=!1,L=[],g.v7_partialHydration){let s=xt(null,o,e.history.location.pathname);s.active&&s.matches&&(G=!0,L=s.matches)}let me,v={historyAction:e.history.action,location:e.history.location,matches:L,initialized:K,navigation:Vt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||ee,fetchers:new Map,blockers:new Map},j=re.Pop,V=!1,M,ne=!1,q=new Map,oe=null,ae=!1,se=!1,Ke=[],Ye=new Set,Z=new Map,Te=0,Ce=-1,xe=new Map,ue=new Set,De=new Map,Oe=new Map,de=new Set,Ee=new Map,ve=new Map,ke;function vt(){if(w=e.history.listen(s=>{let{action:u,location:h,delta:y}=s;if(ke){ke(),ke=void 0;return}$e(ve.size===0||y!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let x=mr({currentLocation:v.location,nextLocation:h,historyAction:u});if(x&&y!=null){let C=new Promise(N=>{ke=N});e.history.go(y*-1),bt(x,{state:"blocked",location:h,proceed(){bt(x,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),C.then(()=>e.history.go(y))},reset(){let N=new Map(v.blockers);N.set(x,at),W({blockers:N})}});return}return Ae(u,h)}),r){ai(t,q);let s=()=>ii(t,q);t.addEventListener("pagehide",s),oe=()=>t.removeEventListener("pagehide",s)}return v.initialized||Ae(re.Pop,v.location,{initialHydration:!0}),me}function k(){w&&w(),oe&&oe(),b.clear(),M&&M.abort(),v.fetchers.forEach((s,u)=>wt(u)),v.blockers.forEach((s,u)=>pr(u))}function fe(s){return b.add(s),()=>b.delete(s)}function W(s,u){u===void 0&&(u={}),v=J({},v,s);let h=[],y=[];g.v7_fetcherPersist&&v.fetchers.forEach((x,C)=>{x.state==="idle"&&(de.has(C)?y.push(C):h.push(C))}),de.forEach(x=>{!v.fetchers.has(x)&&!Z.has(x)&&y.push(x)}),[...b].forEach(x=>x(v,{deletedFetchers:y,viewTransitionOpts:u.viewTransitionOpts,flushSync:u.flushSync===!0})),g.v7_fetcherPersist?(h.forEach(x=>v.fetchers.delete(x)),y.forEach(x=>wt(x))):y.forEach(x=>de.delete(x))}function ye(s,u,h){var y,x;let{flushSync:C}=h===void 0?{}:h,N=v.actionData!=null&&v.navigation.formMethod!=null&&ge(v.navigation.formMethod)&&v.navigation.state==="loading"&&((y=s.state)==null?void 0:y._isRedirect)!==!0,R;u.actionData?Object.keys(u.actionData).length>0?R=u.actionData:R=null:N?R=v.actionData:R=null;let _=u.loaderData?jr(v.loaderData,u.loaderData,u.matches||[],u.errors):v.loaderData,S=v.blockers;S.size>0&&(S=new Map(S),S.forEach((O,ie)=>S.set(ie,at)));let T=V===!0||v.navigation.formMethod!=null&&ge(v.navigation.formMethod)&&((x=s.state)==null?void 0:x._isRedirect)!==!0;l&&(o=l,l=void 0),ae||j===re.Pop||(j===re.Push?e.history.push(s,s.state):j===re.Replace&&e.history.replace(s,s.state));let I;if(j===re.Pop){let O=q.get(v.location.pathname);O&&O.has(s.pathname)?I={currentLocation:v.location,nextLocation:s}:q.has(s.pathname)&&(I={currentLocation:s,nextLocation:v.location})}else if(ne){let O=q.get(v.location.pathname);O?O.add(s.pathname):(O=new Set([s.pathname]),q.set(v.location.pathname,O)),I={currentLocation:v.location,nextLocation:s}}W(J({},u,{actionData:R,loaderData:_,historyAction:j,location:s,initialized:!0,navigation:Vt,revalidation:"idle",restoreScrollPosition:vr(s,u.matches||v.matches),preventScrollReset:T,blockers:S}),{viewTransitionOpts:I,flushSync:C===!0}),j=re.Pop,V=!1,ne=!1,ae=!1,se=!1,Ke=[]}async function yt(s,u){if(typeof s=="number"){e.history.go(s);return}let h=$t(v.location,v.matches,c,g.v7_prependBasename,s,g.v7_relativeSplatPath,u==null?void 0:u.fromRouteId,u==null?void 0:u.relative),{path:y,submission:x,error:C}=Rr(g.v7_normalizeFormMethod,!1,h,u),N=v.location,R=ct(v.location,y,u&&u.state);R=J({},R,e.history.encodeLocation(R));let _=u&&u.replace!=null?u.replace:void 0,S=re.Push;_===!0?S=re.Replace:_===!1||x!=null&&ge(x.formMethod)&&x.formAction===v.location.pathname+v.location.search&&(S=re.Replace);let T=u&&"preventScrollReset"in u?u.preventScrollReset===!0:void 0,I=(u&&u.flushSync)===!0,O=mr({currentLocation:N,nextLocation:R,historyAction:S});if(O){bt(O,{state:"blocked",location:R,proceed(){bt(O,{state:"proceeding",proceed:void 0,reset:void 0,location:R}),yt(s,u)},reset(){let ie=new Map(v.blockers);ie.set(O,at),W({blockers:ie})}});return}return await Ae(S,R,{submission:x,pendingError:C,preventScrollReset:T,replace:u&&u.replace,enableViewTransition:u&&u.viewTransition,flushSync:I})}function _n(){if(Ut(),W({revalidation:"loading"}),v.navigation.state!=="submitting"){if(v.navigation.state==="idle"){Ae(v.historyAction,v.location,{startUninterruptedRevalidation:!0});return}Ae(j||v.historyAction,v.navigation.location,{overrideNavigation:v.navigation,enableViewTransition:ne===!0})}}async function Ae(s,u,h){M&&M.abort(),M=null,j=s,ae=(h&&h.startUninterruptedRevalidation)===!0,Un(v.location,v.matches),V=(h&&h.preventScrollReset)===!0,ne=(h&&h.enableViewTransition)===!0;let y=l||o,x=h&&h.overrideNavigation,C=h!=null&&h.initialHydration&&v.matches&&v.matches.length>0&&!G?v.matches:Be(y,u,c),N=(h&&h.flushSync)===!0;if(C&&v.initialized&&!se&&qa(v.location,u)&&!(h&&h.submission&&ge(h.submission.formMethod))){ye(u,{matches:C},{flushSync:N});return}let R=xt(C,y,u.pathname);if(R.active&&R.matches&&(C=R.matches),!C){let{error:$,notFoundMatches:B,route:X}=Ot(u.pathname);ye(u,{matches:B,loaderData:{},errors:{[X.id]:$}},{flushSync:N});return}M=new AbortController;let _=Xe(e.history,u,M.signal,h&&h.submission),S;if(h&&h.pendingError)S=[ze(C).route.id,{type:H.error,error:h.pendingError}];else if(h&&h.submission&&ge(h.submission.formMethod)){let $=await Pn(_,u,h.submission,C,R.active,{replace:h.replace,flushSync:N});if($.shortCircuited)return;if($.pendingActionResult){let[B,X]=$.pendingActionResult;if(pe(X)&&ut(X.error)&&X.error.status===404){M=null,ye(u,{matches:$.matches,loaderData:{},errors:{[B]:X.error}});return}}C=$.matches||C,S=$.pendingActionResult,x=Bt(u,h.submission),N=!1,R.active=!1,_=Xe(e.history,_.url,_.signal)}let{shortCircuited:T,matches:I,loaderData:O,errors:ie}=await Tn(_,u,C,R.active,x,h&&h.submission,h&&h.fetcherSubmission,h&&h.replace,h&&h.initialHydration===!0,N,S);T||(M=null,ye(u,J({matches:I||C},Ir(S),{loaderData:O,errors:ie})))}async function Pn(s,u,h,y,x,C){C===void 0&&(C={}),Ut();let N=ri(u,h);if(W({navigation:N},{flushSync:C.flushSync===!0}),x){let S=await Et(y,u.pathname,s.signal);if(S.type==="aborted")return{shortCircuited:!0};if(S.type==="error"){let T=ze(S.partialMatches).route.id;return{matches:S.partialMatches,pendingActionResult:[T,{type:H.error,error:S.error}]}}else if(S.matches)y=S.matches;else{let{notFoundMatches:T,error:I,route:O}=Ot(u.pathname);return{matches:T,pendingActionResult:[O.id,{type:H.error,error:I}]}}}let R,_=lt(y,u);if(!_.route.action&&!_.route.lazy)R={type:H.error,error:ce(405,{method:s.method,pathname:u.pathname,routeId:_.route.id})};else if(R=(await et("action",v,s,[_],y,null))[_.route.id],s.signal.aborted)return{shortCircuited:!0};if(We(R)){let S;return C&&C.replace!=null?S=C.replace:S=Dr(R.response.headers.get("Location"),new URL(s.url),c,e.history)===v.location.pathname+v.location.search,await Fe(s,R,!0,{submission:h,replace:S}),{shortCircuited:!0}}if(Ie(R))throw ce(400,{type:"defer-action"});if(pe(R)){let S=ze(y,_.route.id);return(C&&C.replace)!==!0&&(j=re.Push),{matches:y,pendingActionResult:[S.route.id,R]}}return{matches:y,pendingActionResult:[_.route.id,R]}}async function Tn(s,u,h,y,x,C,N,R,_,S,T){let I=x||Bt(u,C),O=C||N||Or(I),ie=!ae&&(!g.v7_partialHydration||!_);if(y){if(ie){let Q=lr(T);W(J({navigation:I},Q!==void 0?{actionData:Q}:{}),{flushSync:S})}let A=await Et(h,u.pathname,s.signal);if(A.type==="aborted")return{shortCircuited:!0};if(A.type==="error"){let Q=ze(A.partialMatches).route.id;return{matches:A.partialMatches,loaderData:{},errors:{[Q]:A.error}}}else if(A.matches)h=A.matches;else{let{error:Q,notFoundMatches:Je,route:nt}=Ot(u.pathname);return{matches:Je,loaderData:{},errors:{[nt.id]:Q}}}}let $=l||o,[B,X]=Pr(e.history,v,h,O,u,g.v7_partialHydration&&_===!0,g.v7_skipActionErrorRevalidation,se,Ke,Ye,de,De,ue,$,c,T);if(kt(A=>!(h&&h.some(Q=>Q.route.id===A))||B&&B.some(Q=>Q.route.id===A)),Ce=++Te,B.length===0&&X.length===0){let A=fr();return ye(u,J({matches:h,loaderData:{},errors:T&&pe(T[1])?{[T[0]]:T[1].error}:null},Ir(T),A?{fetchers:new Map(v.fetchers)}:{}),{flushSync:S}),{shortCircuited:!0}}if(ie){let A={};if(!y){A.navigation=I;let Q=lr(T);Q!==void 0&&(A.actionData=Q)}X.length>0&&(A.fetchers=Cn(X)),W(A,{flushSync:S})}X.forEach(A=>{Ne(A.key),A.controller&&Z.set(A.key,A.controller)});let Ge=()=>X.forEach(A=>Ne(A.key));M&&M.signal.addEventListener("abort",Ge);let{loaderResults:tt,fetcherResults:Re}=await cr(v,h,B,X,s);if(s.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",Ge),X.forEach(A=>Z.delete(A.key));let we=Pt(tt);if(we)return await Fe(s,we.result,!0,{replace:R}),{shortCircuited:!0};if(we=Pt(Re),we)return ue.add(we.key),await Fe(s,we.result,!0,{replace:R}),{shortCircuited:!0};let{loaderData:At,errors:rt}=Nr(v,h,tt,T,X,Re,Ee);Ee.forEach((A,Q)=>{A.subscribe(Je=>{(Je||A.done)&&Ee.delete(Q)})}),g.v7_partialHydration&&_&&v.errors&&(rt=J({},v.errors,rt));let Ve=fr(),St=hr(Ce),Rt=Ve||St||X.length>0;return J({matches:h,loaderData:At,errors:rt},Rt?{fetchers:new Map(v.fetchers)}:{})}function lr(s){if(s&&!pe(s[1]))return{[s[0]]:s[1].data};if(v.actionData)return Object.keys(v.actionData).length===0?null:v.actionData}function Cn(s){return s.forEach(u=>{let h=v.fetchers.get(u.key),y=it(void 0,h?h.data:void 0);v.fetchers.set(u.key,y)}),new Map(v.fetchers)}function Dn(s,u,h,y){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ne(s);let x=(y&&y.flushSync)===!0,C=l||o,N=$t(v.location,v.matches,c,g.v7_prependBasename,h,g.v7_relativeSplatPath,u,y==null?void 0:y.relative),R=Be(C,N,c),_=xt(R,C,N);if(_.active&&_.matches&&(R=_.matches),!R){Se(s,u,ce(404,{pathname:N}),{flushSync:x});return}let{path:S,submission:T,error:I}=Rr(g.v7_normalizeFormMethod,!0,N,y);if(I){Se(s,u,I,{flushSync:x});return}let O=lt(R,S),ie=(y&&y.preventScrollReset)===!0;if(T&&ge(T.formMethod)){Ln(s,u,S,O,R,_.active,x,ie,T);return}De.set(s,{routeId:u,path:S}),Nn(s,u,S,O,R,_.active,x,ie,T)}async function Ln(s,u,h,y,x,C,N,R,_){Ut(),De.delete(s);function S(te){if(!te.route.action&&!te.route.lazy){let qe=ce(405,{method:_.formMethod,pathname:h,routeId:u});return Se(s,u,qe,{flushSync:N}),!0}return!1}if(!C&&S(y))return;let T=v.fetchers.get(s);Le(s,ni(_,T),{flushSync:N});let I=new AbortController,O=Xe(e.history,h,I.signal,_);if(C){let te=await Et(x,new URL(O.url).pathname,O.signal,s);if(te.type==="aborted")return;if(te.type==="error"){Se(s,u,te.error,{flushSync:N});return}else if(te.matches){if(x=te.matches,y=lt(x,h),S(y))return}else{Se(s,u,ce(404,{pathname:h}),{flushSync:N});return}}Z.set(s,I);let ie=Te,B=(await et("action",v,O,[y],x,s))[y.route.id];if(O.signal.aborted){Z.get(s)===I&&Z.delete(s);return}if(g.v7_fetcherPersist&&de.has(s)){if(We(B)||pe(B)){Le(s,je(void 0));return}}else{if(We(B))if(Z.delete(s),Ce>ie){Le(s,je(void 0));return}else return ue.add(s),Le(s,it(_)),Fe(O,B,!1,{fetcherSubmission:_,preventScrollReset:R});if(pe(B)){Se(s,u,B.error);return}}if(Ie(B))throw ce(400,{type:"defer-action"});let X=v.navigation.location||v.location,Ge=Xe(e.history,X,I.signal),tt=l||o,Re=v.navigation.state!=="idle"?Be(tt,v.navigation.location,c):v.matches;U(Re,"Didn't find any matches after fetcher action");let we=++Te;xe.set(s,we);let At=it(_,B.data);v.fetchers.set(s,At);let[rt,Ve]=Pr(e.history,v,Re,_,X,!1,g.v7_skipActionErrorRevalidation,se,Ke,Ye,de,De,ue,tt,c,[y.route.id,B]);Ve.filter(te=>te.key!==s).forEach(te=>{let qe=te.key,yr=v.fetchers.get(qe),An=it(void 0,yr?yr.data:void 0);v.fetchers.set(qe,An),Ne(qe),te.controller&&Z.set(qe,te.controller)}),W({fetchers:new Map(v.fetchers)});let St=()=>Ve.forEach(te=>Ne(te.key));I.signal.addEventListener("abort",St);let{loaderResults:Rt,fetcherResults:A}=await cr(v,Re,rt,Ve,Ge);if(I.signal.aborted)return;I.signal.removeEventListener("abort",St),xe.delete(s),Z.delete(s),Ve.forEach(te=>Z.delete(te.key));let Q=Pt(Rt);if(Q)return Fe(Ge,Q.result,!1,{preventScrollReset:R});if(Q=Pt(A),Q)return ue.add(Q.key),Fe(Ge,Q.result,!1,{preventScrollReset:R});let{loaderData:Je,errors:nt}=Nr(v,Re,Rt,void 0,Ve,A,Ee);if(v.fetchers.has(s)){let te=je(B.data);v.fetchers.set(s,te)}hr(we),v.navigation.state==="loading"&&we>Ce?(U(j,"Expected pending action"),M&&M.abort(),ye(v.navigation.location,{matches:Re,loaderData:Je,errors:nt,fetchers:new Map(v.fetchers)})):(W({errors:nt,loaderData:jr(v.loaderData,Je,Re,nt),fetchers:new Map(v.fetchers)}),se=!1)}async function Nn(s,u,h,y,x,C,N,R,_){let S=v.fetchers.get(s);Le(s,it(_,S?S.data:void 0),{flushSync:N});let T=new AbortController,I=Xe(e.history,h,T.signal);if(C){let B=await Et(x,new URL(I.url).pathname,I.signal,s);if(B.type==="aborted")return;if(B.type==="error"){Se(s,u,B.error,{flushSync:N});return}else if(B.matches)x=B.matches,y=lt(x,h);else{Se(s,u,ce(404,{pathname:h}),{flushSync:N});return}}Z.set(s,T);let O=Te,$=(await et("loader",v,I,[y],x,s))[y.route.id];if(Ie($)&&($=await rr($,I.signal,!0)||$),Z.get(s)===T&&Z.delete(s),!I.signal.aborted){if(de.has(s)){Le(s,je(void 0));return}if(We($))if(Ce>O){Le(s,je(void 0));return}else{ue.add(s),await Fe(I,$,!1,{preventScrollReset:R});return}if(pe($)){Se(s,u,$.error);return}U(!Ie($),"Unhandled fetcher deferred data"),Le(s,je($.data))}}async function Fe(s,u,h,y){let{submission:x,fetcherSubmission:C,preventScrollReset:N,replace:R}=y===void 0?{}:y;u.response.headers.has("X-Remix-Revalidate")&&(se=!0);let _=u.response.headers.get("Location");U(_,"Expected a Location header on the redirect Response"),_=Dr(_,new URL(s.url),c,e.history);let S=ct(v.location,_,{_isRedirect:!0});if(r){let B=!1;if(u.response.headers.has("X-Remix-Reload-Document"))B=!0;else if(tr.test(_)){const X=e.history.createURL(_);B=X.origin!==t.location.origin||ft(X.pathname,c)==null}if(B){R?t.location.replace(_):t.location.assign(_);return}}M=null;let T=R===!0||u.response.headers.has("X-Remix-Replace")?re.Replace:re.Push,{formMethod:I,formAction:O,formEncType:ie}=v.navigation;!x&&!C&&I&&O&&ie&&(x=Or(v.navigation));let $=x||C;if(ka.has(u.response.status)&&$&&ge($.formMethod))await Ae(T,S,{submission:J({},$,{formAction:_}),preventScrollReset:N||V,enableViewTransition:h?ne:void 0});else{let B=Bt(S,x);await Ae(T,S,{overrideNavigation:B,fetcherSubmission:C,preventScrollReset:N||V,enableViewTransition:h?ne:void 0})}}async function et(s,u,h,y,x,C){let N,R={};try{N=await $a(d,s,u,h,y,x,C,i,a)}catch(_){return y.forEach(S=>{R[S.route.id]={type:H.error,error:_}}),R}for(let[_,S]of Object.entries(N))if(Xa(S)){let T=S.result;R[_]={type:H.redirect,response:Ga(T,h,_,x,c,g.v7_relativeSplatPath)}}else R[_]=await Ya(S);return R}async function cr(s,u,h,y,x){let C=s.matches,N=et("loader",s,x,h,u,null),R=Promise.all(y.map(async T=>{if(T.matches&&T.match&&T.controller){let O=(await et("loader",s,Xe(e.history,T.path,T.controller.signal),[T.match],T.matches,T.key))[T.match.route.id];return{[T.key]:O}}else return Promise.resolve({[T.key]:{type:H.error,error:ce(404,{pathname:T.path})}})})),_=await N,S=(await R).reduce((T,I)=>Object.assign(T,I),{});return await Promise.all([ei(u,_,x.signal,C,s.loaderData),ti(u,S,y)]),{loaderResults:_,fetcherResults:S}}function Ut(){se=!0,Ke.push(...kt()),De.forEach((s,u)=>{Z.has(u)&&Ye.add(u),Ne(u)})}function Le(s,u,h){h===void 0&&(h={}),v.fetchers.set(s,u),W({fetchers:new Map(v.fetchers)},{flushSync:(h&&h.flushSync)===!0})}function Se(s,u,h,y){y===void 0&&(y={});let x=ze(v.matches,u);wt(s),W({errors:{[x.route.id]:h},fetchers:new Map(v.fetchers)},{flushSync:(y&&y.flushSync)===!0})}function ur(s){return Oe.set(s,(Oe.get(s)||0)+1),de.has(s)&&de.delete(s),v.fetchers.get(s)||Aa}function wt(s){let u=v.fetchers.get(s);Z.has(s)&&!(u&&u.state==="loading"&&xe.has(s))&&Ne(s),De.delete(s),xe.delete(s),ue.delete(s),g.v7_fetcherPersist&&de.delete(s),Ye.delete(s),v.fetchers.delete(s)}function jn(s){let u=(Oe.get(s)||0)-1;u<=0?(Oe.delete(s),de.add(s),g.v7_fetcherPersist||wt(s)):Oe.set(s,u),W({fetchers:new Map(v.fetchers)})}function Ne(s){let u=Z.get(s);u&&(u.abort(),Z.delete(s))}function dr(s){for(let u of s){let h=ur(u),y=je(h.data);v.fetchers.set(u,y)}}function fr(){let s=[],u=!1;for(let h of ue){let y=v.fetchers.get(h);U(y,"Expected fetcher: "+h),y.state==="loading"&&(ue.delete(h),s.push(h),u=!0)}return dr(s),u}function hr(s){let u=[];for(let[h,y]of xe)if(y<s){let x=v.fetchers.get(h);U(x,"Expected fetcher: "+h),x.state==="loading"&&(Ne(h),xe.delete(h),u.push(h))}return dr(u),u.length>0}function In(s,u){let h=v.blockers.get(s)||at;return ve.get(s)!==u&&ve.set(s,u),h}function pr(s){v.blockers.delete(s),ve.delete(s)}function bt(s,u){let h=v.blockers.get(s)||at;U(h.state==="unblocked"&&u.state==="blocked"||h.state==="blocked"&&u.state==="blocked"||h.state==="blocked"&&u.state==="proceeding"||h.state==="blocked"&&u.state==="unblocked"||h.state==="proceeding"&&u.state==="unblocked","Invalid blocker state transition: "+h.state+" -> "+u.state);let y=new Map(v.blockers);y.set(s,u),W({blockers:y})}function mr(s){let{currentLocation:u,nextLocation:h,historyAction:y}=s;if(ve.size===0)return;ve.size>1&&$e(!1,"A router only supports one blocker at a time");let x=Array.from(ve.entries()),[C,N]=x[x.length-1],R=v.blockers.get(C);if(!(R&&R.state==="proceeding")&&N({currentLocation:u,nextLocation:h,historyAction:y}))return C}function Ot(s){let u=ce(404,{pathname:s}),h=l||o,{matches:y,route:x}=Mr(h);return kt(),{notFoundMatches:y,route:x,error:u}}function kt(s){let u=[];return Ee.forEach((h,y)=>{(!s||s(y))&&(h.cancel(),u.push(y),Ee.delete(y))}),u}function Mn(s,u,h){if(P=s,D=u,E=h||null,!F&&v.navigation===Vt){F=!0;let y=vr(v.location,v.matches);y!=null&&W({restoreScrollPosition:y})}return()=>{P=null,D=null,E=null}}function gr(s,u){return E&&E(s,u.map(y=>pa(y,v.loaderData)))||s.key}function Un(s,u){if(P&&D){let h=gr(s,u);P[h]=D()}}function vr(s,u){if(P){let h=gr(s,u),y=P[h];if(typeof y=="number")return y}return null}function xt(s,u,h){if(m)if(s){if(Object.keys(s[0].params).length>0)return{active:!0,matches:Tt(u,h,c,!0)}}else return{active:!0,matches:Tt(u,h,c,!0)||[]};return{active:!1,matches:null}}async function Et(s,u,h,y){if(!m)return{type:"success",matches:s};let x=s;for(;;){let C=l==null,N=l||o,R=i;try{await m({signal:h,path:u,matches:x,fetcherKey:y,patch:(T,I)=>{h.aborted||Cr(T,I,N,R,a)}})}catch(T){return{type:"error",error:T,partialMatches:x}}finally{C&&!h.aborted&&(o=[...o])}if(h.aborted)return{type:"aborted"};let _=Be(N,u,c);if(_)return{type:"success",matches:_};let S=Tt(N,u,c,!0);if(!S||x.length===S.length&&x.every((T,I)=>T.route.id===S[I].route.id))return{type:"success",matches:null};x=S}}function On(s){i={},l=Lt(s,a,void 0,i)}function kn(s,u){let h=l==null;Cr(s,u,l||o,i,a),h&&(o=[...o],W({}))}return me={get basename(){return c},get future(){return g},get state(){return v},get routes(){return o},get window(){return t},initialize:vt,subscribe:fe,enableScrollRestoration:Mn,navigate:yt,fetch:Dn,revalidate:_n,createHref:s=>e.history.createHref(s),encodeLocation:s=>e.history.encodeLocation(s),getFetcher:ur,deleteFetcher:jn,dispose:k,getBlocker:In,deleteBlocker:pr,patchRoutes:kn,_internalFetchControllers:Z,_internalActiveDeferreds:Ee,_internalSetRoutes:On},me}function Ba(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function $t(e,t,r,n,a,i,o,l){let c,d;if(o){c=[];for(let g of t)if(c.push(g),g.route.id===o){d=g;break}}else c=t,d=t[t.length-1];let m=er(a||".",Zt(c,i),ft(e.pathname,r)||e.pathname,l==="path");if(a==null&&(m.search=e.search,m.hash=e.hash),(a==null||a===""||a===".")&&d){let g=nr(m.search);if(d.route.index&&!g)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&g){let w=new URLSearchParams(m.search),b=w.getAll("index");w.delete("index"),b.filter(E=>E).forEach(E=>w.append("index",E));let P=w.toString();m.search=P?"?"+P:""}}return n&&r!=="/"&&(m.pathname=m.pathname==="/"?r:Me([r,m.pathname])),dt(m)}function Rr(e,t,r,n){if(!n||!Ba(n))return{path:r};if(n.formMethod&&!Za(n.formMethod))return{path:r,error:ce(405,{method:n.formMethod})};let a=()=>({path:r,error:ce(400,{type:"invalid-body"})}),i=n.formMethod||"get",o=e?i.toUpperCase():i.toLowerCase(),l=rn(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!ge(o))return a();let w=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((b,P)=>{let[E,D]=P;return""+b+E+"="+D+`
|
|
12
|
-
`},""):String(n.body);return{path:r,submission:{formMethod:o,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:w}}}else if(n.formEncType==="application/json"){if(!ge(o))return a();try{let w=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:o,formAction:l,formEncType:n.formEncType,formData:void 0,json:w,text:void 0}}}catch{return a()}}}U(typeof FormData=="function","FormData is not available in this environment");let c,d;if(n.formData)c=Yt(n.formData),d=n.formData;else if(n.body instanceof FormData)c=Yt(n.body),d=n.body;else if(n.body instanceof URLSearchParams)c=n.body,d=Lr(c);else if(n.body==null)c=new URLSearchParams,d=new FormData;else try{c=new URLSearchParams(n.body),d=Lr(c)}catch{return a()}let m={formMethod:o,formAction:l,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:d,json:void 0,text:void 0};if(ge(m.formMethod))return{path:r,submission:m};let g=Ue(r);return t&&g.search&&nr(g.search)&&c.append("index",""),g.search="?"+c,{path:dt(g),submission:m}}function _r(e,t,r){r===void 0&&(r=!1);let n=e.findIndex(a=>a.route.id===t);return n>=0?e.slice(0,r?n+1:n):e}function Pr(e,t,r,n,a,i,o,l,c,d,m,g,w,b,P,E){let D=E?pe(E[1])?E[1].error:E[1].data:void 0,F=e.createURL(t.location),L=e.createURL(a),G=r;i&&t.errors?G=_r(r,Object.keys(t.errors)[0],!0):E&&pe(E[1])&&(G=_r(r,E[0]));let ee=E?E[1].statusCode:void 0,K=o&&ee&&ee>=400,me=G.filter((j,V)=>{let{route:M}=j;if(M.lazy)return!0;if(M.loader==null)return!1;if(i)return Kt(M,t.loaderData,t.errors);if(za(t.loaderData,t.matches[V],j)||c.some(oe=>oe===j.route.id))return!0;let ne=t.matches[V],q=j;return Tr(j,J({currentUrl:F,currentParams:ne.params,nextUrl:L,nextParams:q.params},n,{actionResult:D,actionStatus:ee,defaultShouldRevalidate:K?!1:l||F.pathname+F.search===L.pathname+L.search||F.search!==L.search||en(ne,q)}))}),v=[];return g.forEach((j,V)=>{if(i||!r.some(ae=>ae.route.id===j.routeId)||m.has(V))return;let M=Be(b,j.path,P);if(!M){v.push({key:V,routeId:j.routeId,path:j.path,matches:null,match:null,controller:null});return}let ne=t.fetchers.get(V),q=lt(M,j.path),oe=!1;w.has(V)?oe=!1:d.has(V)?(d.delete(V),oe=!0):ne&&ne.state!=="idle"&&ne.data===void 0?oe=l:oe=Tr(q,J({currentUrl:F,currentParams:t.matches[t.matches.length-1].params,nextUrl:L,nextParams:r[r.length-1].params},n,{actionResult:D,actionStatus:ee,defaultShouldRevalidate:K?!1:l})),oe&&v.push({key:V,routeId:j.routeId,path:j.path,matches:M,match:q,controller:new AbortController})}),[me,v]}function Kt(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let n=t!=null&&t[e.id]!==void 0,a=r!=null&&r[e.id]!==void 0;return!n&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!n&&!a}function za(e,t,r){let n=!t||r.route.id!==t.route.id,a=e[r.route.id]===void 0;return n||a}function en(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Tr(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Cr(e,t,r,n,a){var i;let o;if(e){let d=n[e];U(d,"No route found to patch children into: routeId = "+e),d.children||(d.children=[]),o=d.children}else o=r;let l=t.filter(d=>!o.some(m=>tn(d,m))),c=Lt(l,a,[e||"_","patch",String(((i=o)==null?void 0:i.length)||"0")],n);o.push(...c)}function tn(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,n)=>{var a;return(a=t.children)==null?void 0:a.some(i=>tn(r,i))}):!1}async function Ha(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let a=r[e.id];U(a,"No route found in manifest");let i={};for(let o in n){let c=a[o]!==void 0&&o!=="hasErrorBoundary";$e(!c,'Route "'+a.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!c&&!fa.has(o)&&(i[o]=n[o])}Object.assign(a,i),Object.assign(a,J({},t(a),{lazy:void 0}))}async function Wa(e){let{matches:t}=e,r=t.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,i,o)=>Object.assign(a,{[r[o].route.id]:i}),{})}async function $a(e,t,r,n,a,i,o,l,c,d){let m=i.map(b=>b.route.lazy?Ha(b.route,c,l):void 0),g=i.map((b,P)=>{let E=m[P],D=a.some(L=>L.route.id===b.route.id);return J({},b,{shouldLoad:D,resolve:async L=>(L&&n.method==="GET"&&(b.route.lazy||b.route.loader)&&(D=!0),D?Ka(t,n,b,E,L,d):Promise.resolve({type:H.data,result:void 0}))})}),w=await e({matches:g,request:n,params:i[0].params,fetcherKey:o,context:d});try{await Promise.all(m)}catch{}return w}async function Ka(e,t,r,n,a,i){let o,l,c=d=>{let m,g=new Promise((P,E)=>m=E);l=()=>m(),t.signal.addEventListener("abort",l);let w=P=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):d({request:t,params:r.params,context:i},...P!==void 0?[P]:[]),b=(async()=>{try{return{type:"data",result:await(a?a(E=>w(E)):w())}}catch(P){return{type:"error",result:P}}})();return Promise.race([b,g])};try{let d=r.route[e];if(n)if(d){let m,[g]=await Promise.all([c(d).catch(w=>{m=w}),n]);if(m!==void 0)throw m;o=g}else if(await n,d=r.route[e],d)o=await c(d);else if(e==="action"){let m=new URL(t.url),g=m.pathname+m.search;throw ce(405,{method:t.method,pathname:g,routeId:r.route.id})}else return{type:H.data,result:void 0};else if(d)o=await c(d);else{let m=new URL(t.url),g=m.pathname+m.search;throw ce(404,{pathname:g})}U(o.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:H.error,result:d}}finally{l&&t.signal.removeEventListener("abort",l)}return o}async function Ya(e){let{result:t,type:r}=e;if(nn(t)){let g;try{let w=t.headers.get("Content-Type");w&&/\bapplication\/json\b/.test(w)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(w){return{type:H.error,error:w}}return r===H.error?{type:H.error,error:new Nt(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:H.data,data:g,statusCode:t.status,headers:t.headers}}if(r===H.error){if(Ur(t)){var n,a;if(t.data instanceof Error){var i,o;return{type:H.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:H.error,error:new Nt(((n=t.init)==null?void 0:n.status)||500,void 0,t.data),statusCode:ut(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:H.error,error:t,statusCode:ut(t)?t.status:void 0}}if(Qa(t)){var l,c;return{type:H.deferred,deferredData:t,statusCode:(l=t.init)==null?void 0:l.status,headers:((c=t.init)==null?void 0:c.headers)&&new Headers(t.init.headers)}}if(Ur(t)){var d,m;return{type:H.data,data:t.data,statusCode:(d=t.init)==null?void 0:d.status,headers:(m=t.init)!=null&&m.headers?new Headers(t.init.headers):void 0}}return{type:H.data,data:t}}function Ga(e,t,r,n,a,i){let o=e.headers.get("Location");if(U(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!tr.test(o)){let l=n.slice(0,n.findIndex(c=>c.route.id===r)+1);o=$t(new URL(t.url),l,a,!0,o,i),e.headers.set("Location",o)}return e}function Dr(e,t,r,n){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(tr.test(e)){let i=e,o=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(a.includes(o.protocol))throw new Error("Invalid redirect location");let l=ft(o.pathname,r)!=null;if(o.origin===t.origin&&l)return o.pathname+o.search+o.hash}try{let i=n.createURL(e);if(a.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Xe(e,t,r,n){let a=e.createURL(rn(t)).toString(),i={signal:r};if(n&&ge(n.formMethod)){let{formMethod:o,formEncType:l}=n;i.method=o.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(n.json)):l==="text/plain"?i.body=n.text:l==="application/x-www-form-urlencoded"&&n.formData?i.body=Yt(n.formData):i.body=n.formData}return new Request(a,i)}function Yt(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function Lr(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ja(e,t,r,n,a){let i={},o=null,l,c=!1,d={},m=r&&pe(r[1])?r[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let w=g.route.id,b=t[w];if(U(!We(b),"Cannot handle redirect results in processLoaderData"),pe(b)){let P=b.error;m!==void 0&&(P=m,m=void 0),o=o||{};{let E=ze(e,w);o[E.route.id]==null&&(o[E.route.id]=P)}i[w]=void 0,c||(c=!0,l=ut(b.error)?b.error.status:500),b.headers&&(d[w]=b.headers)}else Ie(b)?(n.set(w,b.deferredData),i[w]=b.deferredData.data,b.statusCode!=null&&b.statusCode!==200&&!c&&(l=b.statusCode),b.headers&&(d[w]=b.headers)):(i[w]=b.data,b.statusCode&&b.statusCode!==200&&!c&&(l=b.statusCode),b.headers&&(d[w]=b.headers))}),m!==void 0&&r&&(o={[r[0]]:m},i[r[0]]=void 0),{loaderData:i,errors:o,statusCode:l||200,loaderHeaders:d}}function Nr(e,t,r,n,a,i,o){let{loaderData:l,errors:c}=Ja(t,r,n,o);return a.forEach(d=>{let{key:m,match:g,controller:w}=d,b=i[m];if(U(b,"Did not find corresponding fetcher result"),!(w&&w.signal.aborted))if(pe(b)){let P=ze(e.matches,g==null?void 0:g.route.id);c&&c[P.route.id]||(c=J({},c,{[P.route.id]:b.error})),e.fetchers.delete(m)}else if(We(b))U(!1,"Unhandled fetcher revalidation redirect");else if(Ie(b))U(!1,"Unhandled fetcher deferred data");else{let P=je(b.data);e.fetchers.set(m,P)}}),{loaderData:l,errors:c}}function jr(e,t,r,n){let a=J({},t);for(let i of r){let o=i.route.id;if(t.hasOwnProperty(o)?t[o]!==void 0&&(a[o]=t[o]):e[o]!==void 0&&i.route.loader&&(a[o]=e[o]),n&&n.hasOwnProperty(o))break}return a}function Ir(e){return e?pe(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ze(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function Mr(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ce(e,t){let{pathname:r,routeId:n,method:a,type:i,message:o}=t===void 0?{}:t,l="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(l="Bad Request",a&&r&&n?c="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":i==="defer-action"?c="defer() is not supported in actions":i==="invalid-body"&&(c="Unable to encode submission body")):e===403?(l="Forbidden",c='Route "'+n+'" does not match URL "'+r+'"'):e===404?(l="Not Found",c='No route matches URL "'+r+'"'):e===405&&(l="Method Not Allowed",a&&r&&n?c="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(c='Invalid request method "'+a.toUpperCase()+'"')),new Nt(e||500,l,new Error(c),!0)}function Pt(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,a]=t[r];if(We(a))return{key:n,result:a}}}function rn(e){let t=typeof e=="string"?Ue(e):e;return dt(J({},t,{hash:""}))}function qa(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Xa(e){return nn(e.result)&&Oa.has(e.result.status)}function Ie(e){return e.type===H.deferred}function pe(e){return e.type===H.error}function We(e){return(e&&e.type)===H.redirect}function Ur(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Qa(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function nn(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Za(e){return Ua.has(e.toLowerCase())}function ge(e){return Ia.has(e.toLowerCase())}async function ei(e,t,r,n,a){let i=Object.entries(t);for(let o=0;o<i.length;o++){let[l,c]=i[o],d=e.find(w=>(w==null?void 0:w.route.id)===l);if(!d)continue;let m=n.find(w=>w.route.id===d.route.id),g=m!=null&&!en(m,d)&&(a&&a[d.route.id])!==void 0;Ie(c)&&g&&await rr(c,r,!1).then(w=>{w&&(t[l]=w)})}}async function ti(e,t,r){for(let n=0;n<r.length;n++){let{key:a,routeId:i,controller:o}=r[n],l=t[a];e.find(d=>(d==null?void 0:d.route.id)===i)&&Ie(l)&&(U(o,"Expected an AbortController for revalidating fetcher deferred result"),await rr(l,o.signal,!0).then(d=>{d&&(t[a]=d)}))}}async function rr(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:H.data,data:e.deferredData.unwrappedData}}catch(a){return{type:H.error,error:a}}return{type:H.data,data:e.deferredData.data}}}function nr(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function lt(e,t){let r=typeof t=="string"?Ue(t).search:t.search;if(e[e.length-1].route.index&&nr(r||""))return e[e.length-1];let n=Xr(e);return n[n.length-1]}function Or(e){let{formMethod:t,formAction:r,formEncType:n,text:a,formData:i,json:o}=e;if(!(!t||!r||!n)){if(a!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:r,formEncType:n,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:o,text:void 0}}}function Bt(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function ri(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function it(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ni(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function je(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function ai(e,t){try{let r=e.sessionStorage.getItem(Zr);if(r){let n=JSON.parse(r);for(let[a,i]of Object.entries(n||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function ii(e,t){if(t.size>0){let r={};for(let[n,a]of t)r[n]=[...a];try{e.sessionStorage.setItem(Zr,JSON.stringify(r))}catch(n){$e(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/**
|
|
11
|
+
*/function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},J.apply(this,arguments)}var re;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(re||(re={}));const wr="popstate";function ca(e){e===void 0&&(e={});function t(n,a){let{pathname:i,search:o,hash:l}=n.location;return ct("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:dt(a)}return da(t,r,null,e)}function U(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function $e(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ua(){return Math.random().toString(36).substr(2,8)}function br(e,t){return{usr:e.state,key:e.key,idx:t}}function ct(e,t,r,n){return r===void 0&&(r=null),J({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ue(t):t,{state:r,key:t&&t.key||n||ua()})}function dt(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Ue(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function da(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,l=re.Pop,c=null,d=m();d==null&&(d=0,o.replaceState(J({},o.state,{idx:d}),""));function m(){return(o.state||{idx:null}).idx}function g(){l=re.Pop;let D=m(),F=D==null?null:D-d;d=D,c&&c({action:l,location:E.location,delta:F})}function w(D,F){l=re.Push;let L=ct(E.location,D,F);d=m()+1;let G=br(L,d),ee=E.createHref(L);try{o.pushState(G,"",ee)}catch(K){if(K instanceof DOMException&&K.name==="DataCloneError")throw K;a.location.assign(ee)}i&&c&&c({action:l,location:E.location,delta:1})}function b(D,F){l=re.Replace;let L=ct(E.location,D,F);d=m();let G=br(L,d),ee=E.createHref(L);o.replaceState(G,"",ee),i&&c&&c({action:l,location:E.location,delta:0})}function P(D){let F=a.location.origin!=="null"?a.location.origin:a.location.href,L=typeof D=="string"?D:dt(D);return L=L.replace(/ $/,"%20"),U(F,"No window.location.(origin|href) available to create URL for href: "+L),new URL(L,F)}let E={get action(){return l},get location(){return e(a,o)},listen(D){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(wr,g),c=D,()=>{a.removeEventListener(wr,g),c=null}},createHref(D){return t(a,D)},createURL:P,encodeLocation(D){let F=P(D);return{pathname:F.pathname,search:F.search,hash:F.hash}},push:w,replace:b,go(D){return o.go(D)}};return E}var H;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(H||(H={}));const fa=new Set(["lazy","caseSensitive","path","id","index","children"]);function ha(e){return e.index===!0}function Lt(e,t,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),e.map((a,i)=>{let o=[...r,String(i)],l=typeof a.id=="string"?a.id:o.join("-");if(U(a.index!==!0||!a.children,"Cannot specify children on an index route"),U(!n[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),ha(a)){let c=J({},a,t(a),{id:l});return n[l]=c,c}else{let c=J({},a,t(a),{id:l,children:void 0});return n[l]=c,a.children&&(c.children=Lt(a.children,t,o,n)),c}})}function Be(e,t,r){return r===void 0&&(r="/"),Tt(e,t,r,!1)}function Tt(e,t,r,n){let a=typeof t=="string"?Ue(t):t,i=ft(a.pathname||"/",r);if(i==null)return null;let o=Jr(e);ma(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=Pa(i);l=Ra(o[c],d,n)}return l}function pa(e,t){let{route:r,pathname:n,params:a}=e;return{id:r.id,pathname:n,params:a,data:t[r.id],handle:r.handle}}function Jr(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(U(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let d=Me([n,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(U(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),Jr(i.children,t,m,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:Ea(d,i.index),routesMeta:m})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of qr(i.path))a(i,o,c)}),t}function qr(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=qr(n.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function ma(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Sa(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const ga=/^:[\w-]+$/,va=3,ya=2,wa=1,ba=10,xa=-2,xr=e=>e==="*";function Ea(e,t){let r=e.split("/"),n=r.length;return r.some(xr)&&(n+=xa),t&&(n+=ya),r.filter(a=>!xr(a)).reduce((a,i)=>a+(ga.test(i)?va:i===""?wa:ba),n)}function Sa(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function Ra(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,a={},i="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],d=l===n.length-1,m=i==="/"?t:t.slice(i.length)||"/",g=Er({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},m),w=c.route;if(!g&&d&&r&&!n[n.length-1].route.index&&(g=Er({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},m)),!g)return null;Object.assign(a,g.params),o.push({params:a,pathname:Me([i,g.pathname]),pathnameBase:La(Me([i,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(i=Me([i,g.pathnameBase]))}return o}function Er(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=_a(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((d,m,g)=>{let{paramName:w,isOptional:b}=m;if(w==="*"){let E=l[g]||"";o=i.slice(0,i.length-E.length).replace(/(.)\/+$/,"$1")}const P=l[g];return b&&!P?d[w]=void 0:d[w]=(P||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function _a(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),$e(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Pa(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return $e(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ft(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Ta=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ca=e=>Ta.test(e);function Da(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?Ue(e):e,i;if(r)if(Ca(r))i=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),$e(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=Sr(r.substring(1),"/"):i=Sr(r,t)}else i=t;return{pathname:i,search:Na(n),hash:ja(a)}}function Sr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Vt(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Xr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Zt(e,t){let r=Xr(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function er(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=Ue(e):(a=J({},e),U(!a.pathname||!a.pathname.includes("?"),Vt("?","pathname","search",a)),U(!a.pathname||!a.pathname.includes("#"),Vt("#","pathname","hash",a)),U(!a.search||!a.search.includes("#"),Vt("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=r;else{let g=t.length-1;if(!n&&o.startsWith("..")){let w=o.split("/");for(;w[0]==="..";)w.shift(),g-=1;a.pathname=w.join("/")}l=g>=0?t[g]:"/"}let c=Da(a,l),d=o&&o!=="/"&&o.endsWith("/"),m=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||m)&&(c.pathname+="/"),c}const Me=e=>e.join("/").replace(/\/\/+/g,"/"),La=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Na=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ja=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Nt{constructor(t,r,n,a){a===void 0&&(a=!1),this.status=t,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function ut(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Qr=["post","put","patch","delete"],Ia=new Set(Qr),Ma=["get",...Qr],Ua=new Set(Ma),Oa=new Set([301,302,303,307,308]),ka=new Set([307,308]),Bt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Aa={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},at={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},tr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Fa=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Zr="remix-router-transitions";function Va(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",n=!r;U(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let s=e.detectErrorBoundary;a=u=>({hasErrorBoundary:s(u)})}else a=Fa;let i={},o=Lt(e.routes,a,void 0,i),l,c=e.basename||"/",d=e.dataStrategy||Wa,m=e.patchRoutesOnNavigation,g=J({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),w=null,b=new Set,P=null,E=null,D=null,F=e.hydrationData!=null,L=Be(o,e.history.location,c),G=!1,ee=null;if(L==null&&!m){let s=ce(404,{pathname:e.history.location.pathname}),{matches:u,route:h}=Mr(o);L=u,ee={[h.id]:s}}L&&!e.hydrationData&&xt(L,o,e.history.location.pathname).active&&(L=null);let K;if(L)if(L.some(s=>s.route.lazy))K=!1;else if(!L.some(s=>s.route.loader))K=!0;else if(g.v7_partialHydration){let s=e.hydrationData?e.hydrationData.loaderData:null,u=e.hydrationData?e.hydrationData.errors:null;if(u){let h=L.findIndex(y=>u[y.route.id]!==void 0);K=L.slice(0,h+1).every(y=>!Yt(y.route,s,u))}else K=L.every(h=>!Yt(h.route,s,u))}else K=e.hydrationData!=null;else if(K=!1,L=[],g.v7_partialHydration){let s=xt(null,o,e.history.location.pathname);s.active&&s.matches&&(G=!0,L=s.matches)}let me,v={historyAction:e.history.action,location:e.history.location,matches:L,initialized:K,navigation:Bt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||ee,fetchers:new Map,blockers:new Map},j=re.Pop,V=!1,M,ne=!1,q=new Map,oe=null,ae=!1,se=!1,Ke=[],Ye=new Set,Z=new Map,Te=0,Ce=-1,xe=new Map,ue=new Set,De=new Map,Oe=new Map,de=new Set,Ee=new Map,ve=new Map,ke;function vt(){if(w=e.history.listen(s=>{let{action:u,location:h,delta:y}=s;if(ke){ke(),ke=void 0;return}$e(ve.size===0||y!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let x=mr({currentLocation:v.location,nextLocation:h,historyAction:u});if(x&&y!=null){let C=new Promise(N=>{ke=N});e.history.go(y*-1),bt(x,{state:"blocked",location:h,proceed(){bt(x,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),C.then(()=>e.history.go(y))},reset(){let N=new Map(v.blockers);N.set(x,at),W({blockers:N})}});return}return Ae(u,h)}),r){ai(t,q);let s=()=>ii(t,q);t.addEventListener("pagehide",s),oe=()=>t.removeEventListener("pagehide",s)}return v.initialized||Ae(re.Pop,v.location,{initialHydration:!0}),me}function k(){w&&w(),oe&&oe(),b.clear(),M&&M.abort(),v.fetchers.forEach((s,u)=>wt(u)),v.blockers.forEach((s,u)=>pr(u))}function fe(s){return b.add(s),()=>b.delete(s)}function W(s,u){u===void 0&&(u={}),v=J({},v,s);let h=[],y=[];g.v7_fetcherPersist&&v.fetchers.forEach((x,C)=>{x.state==="idle"&&(de.has(C)?y.push(C):h.push(C))}),de.forEach(x=>{!v.fetchers.has(x)&&!Z.has(x)&&y.push(x)}),[...b].forEach(x=>x(v,{deletedFetchers:y,viewTransitionOpts:u.viewTransitionOpts,flushSync:u.flushSync===!0})),g.v7_fetcherPersist?(h.forEach(x=>v.fetchers.delete(x)),y.forEach(x=>wt(x))):y.forEach(x=>de.delete(x))}function ye(s,u,h){var y,x;let{flushSync:C}=h===void 0?{}:h,N=v.actionData!=null&&v.navigation.formMethod!=null&&ge(v.navigation.formMethod)&&v.navigation.state==="loading"&&((y=s.state)==null?void 0:y._isRedirect)!==!0,R;u.actionData?Object.keys(u.actionData).length>0?R=u.actionData:R=null:N?R=v.actionData:R=null;let _=u.loaderData?jr(v.loaderData,u.loaderData,u.matches||[],u.errors):v.loaderData,S=v.blockers;S.size>0&&(S=new Map(S),S.forEach((O,ie)=>S.set(ie,at)));let T=V===!0||v.navigation.formMethod!=null&&ge(v.navigation.formMethod)&&((x=s.state)==null?void 0:x._isRedirect)!==!0;l&&(o=l,l=void 0),ae||j===re.Pop||(j===re.Push?e.history.push(s,s.state):j===re.Replace&&e.history.replace(s,s.state));let I;if(j===re.Pop){let O=q.get(v.location.pathname);O&&O.has(s.pathname)?I={currentLocation:v.location,nextLocation:s}:q.has(s.pathname)&&(I={currentLocation:s,nextLocation:v.location})}else if(ne){let O=q.get(v.location.pathname);O?O.add(s.pathname):(O=new Set([s.pathname]),q.set(v.location.pathname,O)),I={currentLocation:v.location,nextLocation:s}}W(J({},u,{actionData:R,loaderData:_,historyAction:j,location:s,initialized:!0,navigation:Bt,revalidation:"idle",restoreScrollPosition:vr(s,u.matches||v.matches),preventScrollReset:T,blockers:S}),{viewTransitionOpts:I,flushSync:C===!0}),j=re.Pop,V=!1,ne=!1,ae=!1,se=!1,Ke=[]}async function yt(s,u){if(typeof s=="number"){e.history.go(s);return}let h=Kt(v.location,v.matches,c,g.v7_prependBasename,s,g.v7_relativeSplatPath,u==null?void 0:u.fromRouteId,u==null?void 0:u.relative),{path:y,submission:x,error:C}=Rr(g.v7_normalizeFormMethod,!1,h,u),N=v.location,R=ct(v.location,y,u&&u.state);R=J({},R,e.history.encodeLocation(R));let _=u&&u.replace!=null?u.replace:void 0,S=re.Push;_===!0?S=re.Replace:_===!1||x!=null&&ge(x.formMethod)&&x.formAction===v.location.pathname+v.location.search&&(S=re.Replace);let T=u&&"preventScrollReset"in u?u.preventScrollReset===!0:void 0,I=(u&&u.flushSync)===!0,O=mr({currentLocation:N,nextLocation:R,historyAction:S});if(O){bt(O,{state:"blocked",location:R,proceed(){bt(O,{state:"proceeding",proceed:void 0,reset:void 0,location:R}),yt(s,u)},reset(){let ie=new Map(v.blockers);ie.set(O,at),W({blockers:ie})}});return}return await Ae(S,R,{submission:x,pendingError:C,preventScrollReset:T,replace:u&&u.replace,enableViewTransition:u&&u.viewTransition,flushSync:I})}function _n(){if(Ot(),W({revalidation:"loading"}),v.navigation.state!=="submitting"){if(v.navigation.state==="idle"){Ae(v.historyAction,v.location,{startUninterruptedRevalidation:!0});return}Ae(j||v.historyAction,v.navigation.location,{overrideNavigation:v.navigation,enableViewTransition:ne===!0})}}async function Ae(s,u,h){M&&M.abort(),M=null,j=s,ae=(h&&h.startUninterruptedRevalidation)===!0,Un(v.location,v.matches),V=(h&&h.preventScrollReset)===!0,ne=(h&&h.enableViewTransition)===!0;let y=l||o,x=h&&h.overrideNavigation,C=h!=null&&h.initialHydration&&v.matches&&v.matches.length>0&&!G?v.matches:Be(y,u,c),N=(h&&h.flushSync)===!0;if(C&&v.initialized&&!se&&qa(v.location,u)&&!(h&&h.submission&&ge(h.submission.formMethod))){ye(u,{matches:C},{flushSync:N});return}let R=xt(C,y,u.pathname);if(R.active&&R.matches&&(C=R.matches),!C){let{error:$,notFoundMatches:B,route:X}=kt(u.pathname);ye(u,{matches:B,loaderData:{},errors:{[X.id]:$}},{flushSync:N});return}M=new AbortController;let _=Xe(e.history,u,M.signal,h&&h.submission),S;if(h&&h.pendingError)S=[ze(C).route.id,{type:H.error,error:h.pendingError}];else if(h&&h.submission&&ge(h.submission.formMethod)){let $=await Pn(_,u,h.submission,C,R.active,{replace:h.replace,flushSync:N});if($.shortCircuited)return;if($.pendingActionResult){let[B,X]=$.pendingActionResult;if(pe(X)&&ut(X.error)&&X.error.status===404){M=null,ye(u,{matches:$.matches,loaderData:{},errors:{[B]:X.error}});return}}C=$.matches||C,S=$.pendingActionResult,x=zt(u,h.submission),N=!1,R.active=!1,_=Xe(e.history,_.url,_.signal)}let{shortCircuited:T,matches:I,loaderData:O,errors:ie}=await Tn(_,u,C,R.active,x,h&&h.submission,h&&h.fetcherSubmission,h&&h.replace,h&&h.initialHydration===!0,N,S);T||(M=null,ye(u,J({matches:I||C},Ir(S),{loaderData:O,errors:ie})))}async function Pn(s,u,h,y,x,C){C===void 0&&(C={}),Ot();let N=ri(u,h);if(W({navigation:N},{flushSync:C.flushSync===!0}),x){let S=await Et(y,u.pathname,s.signal);if(S.type==="aborted")return{shortCircuited:!0};if(S.type==="error"){let T=ze(S.partialMatches).route.id;return{matches:S.partialMatches,pendingActionResult:[T,{type:H.error,error:S.error}]}}else if(S.matches)y=S.matches;else{let{notFoundMatches:T,error:I,route:O}=kt(u.pathname);return{matches:T,pendingActionResult:[O.id,{type:H.error,error:I}]}}}let R,_=lt(y,u);if(!_.route.action&&!_.route.lazy)R={type:H.error,error:ce(405,{method:s.method,pathname:u.pathname,routeId:_.route.id})};else if(R=(await et("action",v,s,[_],y,null))[_.route.id],s.signal.aborted)return{shortCircuited:!0};if(We(R)){let S;return C&&C.replace!=null?S=C.replace:S=Dr(R.response.headers.get("Location"),new URL(s.url),c,e.history)===v.location.pathname+v.location.search,await Fe(s,R,!0,{submission:h,replace:S}),{shortCircuited:!0}}if(Ie(R))throw ce(400,{type:"defer-action"});if(pe(R)){let S=ze(y,_.route.id);return(C&&C.replace)!==!0&&(j=re.Push),{matches:y,pendingActionResult:[S.route.id,R]}}return{matches:y,pendingActionResult:[_.route.id,R]}}async function Tn(s,u,h,y,x,C,N,R,_,S,T){let I=x||zt(u,C),O=C||N||Or(I),ie=!ae&&(!g.v7_partialHydration||!_);if(y){if(ie){let Q=lr(T);W(J({navigation:I},Q!==void 0?{actionData:Q}:{}),{flushSync:S})}let A=await Et(h,u.pathname,s.signal);if(A.type==="aborted")return{shortCircuited:!0};if(A.type==="error"){let Q=ze(A.partialMatches).route.id;return{matches:A.partialMatches,loaderData:{},errors:{[Q]:A.error}}}else if(A.matches)h=A.matches;else{let{error:Q,notFoundMatches:Je,route:nt}=kt(u.pathname);return{matches:Je,loaderData:{},errors:{[nt.id]:Q}}}}let $=l||o,[B,X]=Pr(e.history,v,h,O,u,g.v7_partialHydration&&_===!0,g.v7_skipActionErrorRevalidation,se,Ke,Ye,de,De,ue,$,c,T);if(At(A=>!(h&&h.some(Q=>Q.route.id===A))||B&&B.some(Q=>Q.route.id===A)),Ce=++Te,B.length===0&&X.length===0){let A=fr();return ye(u,J({matches:h,loaderData:{},errors:T&&pe(T[1])?{[T[0]]:T[1].error}:null},Ir(T),A?{fetchers:new Map(v.fetchers)}:{}),{flushSync:S}),{shortCircuited:!0}}if(ie){let A={};if(!y){A.navigation=I;let Q=lr(T);Q!==void 0&&(A.actionData=Q)}X.length>0&&(A.fetchers=Cn(X)),W(A,{flushSync:S})}X.forEach(A=>{Ne(A.key),A.controller&&Z.set(A.key,A.controller)});let Ge=()=>X.forEach(A=>Ne(A.key));M&&M.signal.addEventListener("abort",Ge);let{loaderResults:tt,fetcherResults:Re}=await cr(v,h,B,X,s);if(s.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",Ge),X.forEach(A=>Z.delete(A.key));let we=Pt(tt);if(we)return await Fe(s,we.result,!0,{replace:R}),{shortCircuited:!0};if(we=Pt(Re),we)return ue.add(we.key),await Fe(s,we.result,!0,{replace:R}),{shortCircuited:!0};let{loaderData:Ft,errors:rt}=Nr(v,h,tt,T,X,Re,Ee);Ee.forEach((A,Q)=>{A.subscribe(Je=>{(Je||A.done)&&Ee.delete(Q)})}),g.v7_partialHydration&&_&&v.errors&&(rt=J({},v.errors,rt));let Ve=fr(),St=hr(Ce),Rt=Ve||St||X.length>0;return J({matches:h,loaderData:Ft,errors:rt},Rt?{fetchers:new Map(v.fetchers)}:{})}function lr(s){if(s&&!pe(s[1]))return{[s[0]]:s[1].data};if(v.actionData)return Object.keys(v.actionData).length===0?null:v.actionData}function Cn(s){return s.forEach(u=>{let h=v.fetchers.get(u.key),y=it(void 0,h?h.data:void 0);v.fetchers.set(u.key,y)}),new Map(v.fetchers)}function Dn(s,u,h,y){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ne(s);let x=(y&&y.flushSync)===!0,C=l||o,N=Kt(v.location,v.matches,c,g.v7_prependBasename,h,g.v7_relativeSplatPath,u,y==null?void 0:y.relative),R=Be(C,N,c),_=xt(R,C,N);if(_.active&&_.matches&&(R=_.matches),!R){Se(s,u,ce(404,{pathname:N}),{flushSync:x});return}let{path:S,submission:T,error:I}=Rr(g.v7_normalizeFormMethod,!0,N,y);if(I){Se(s,u,I,{flushSync:x});return}let O=lt(R,S),ie=(y&&y.preventScrollReset)===!0;if(T&&ge(T.formMethod)){Ln(s,u,S,O,R,_.active,x,ie,T);return}De.set(s,{routeId:u,path:S}),Nn(s,u,S,O,R,_.active,x,ie,T)}async function Ln(s,u,h,y,x,C,N,R,_){Ot(),De.delete(s);function S(te){if(!te.route.action&&!te.route.lazy){let qe=ce(405,{method:_.formMethod,pathname:h,routeId:u});return Se(s,u,qe,{flushSync:N}),!0}return!1}if(!C&&S(y))return;let T=v.fetchers.get(s);Le(s,ni(_,T),{flushSync:N});let I=new AbortController,O=Xe(e.history,h,I.signal,_);if(C){let te=await Et(x,new URL(O.url).pathname,O.signal,s);if(te.type==="aborted")return;if(te.type==="error"){Se(s,u,te.error,{flushSync:N});return}else if(te.matches){if(x=te.matches,y=lt(x,h),S(y))return}else{Se(s,u,ce(404,{pathname:h}),{flushSync:N});return}}Z.set(s,I);let ie=Te,B=(await et("action",v,O,[y],x,s))[y.route.id];if(O.signal.aborted){Z.get(s)===I&&Z.delete(s);return}if(g.v7_fetcherPersist&&de.has(s)){if(We(B)||pe(B)){Le(s,je(void 0));return}}else{if(We(B))if(Z.delete(s),Ce>ie){Le(s,je(void 0));return}else return ue.add(s),Le(s,it(_)),Fe(O,B,!1,{fetcherSubmission:_,preventScrollReset:R});if(pe(B)){Se(s,u,B.error);return}}if(Ie(B))throw ce(400,{type:"defer-action"});let X=v.navigation.location||v.location,Ge=Xe(e.history,X,I.signal),tt=l||o,Re=v.navigation.state!=="idle"?Be(tt,v.navigation.location,c):v.matches;U(Re,"Didn't find any matches after fetcher action");let we=++Te;xe.set(s,we);let Ft=it(_,B.data);v.fetchers.set(s,Ft);let[rt,Ve]=Pr(e.history,v,Re,_,X,!1,g.v7_skipActionErrorRevalidation,se,Ke,Ye,de,De,ue,tt,c,[y.route.id,B]);Ve.filter(te=>te.key!==s).forEach(te=>{let qe=te.key,yr=v.fetchers.get(qe),An=it(void 0,yr?yr.data:void 0);v.fetchers.set(qe,An),Ne(qe),te.controller&&Z.set(qe,te.controller)}),W({fetchers:new Map(v.fetchers)});let St=()=>Ve.forEach(te=>Ne(te.key));I.signal.addEventListener("abort",St);let{loaderResults:Rt,fetcherResults:A}=await cr(v,Re,rt,Ve,Ge);if(I.signal.aborted)return;I.signal.removeEventListener("abort",St),xe.delete(s),Z.delete(s),Ve.forEach(te=>Z.delete(te.key));let Q=Pt(Rt);if(Q)return Fe(Ge,Q.result,!1,{preventScrollReset:R});if(Q=Pt(A),Q)return ue.add(Q.key),Fe(Ge,Q.result,!1,{preventScrollReset:R});let{loaderData:Je,errors:nt}=Nr(v,Re,Rt,void 0,Ve,A,Ee);if(v.fetchers.has(s)){let te=je(B.data);v.fetchers.set(s,te)}hr(we),v.navigation.state==="loading"&&we>Ce?(U(j,"Expected pending action"),M&&M.abort(),ye(v.navigation.location,{matches:Re,loaderData:Je,errors:nt,fetchers:new Map(v.fetchers)})):(W({errors:nt,loaderData:jr(v.loaderData,Je,Re,nt),fetchers:new Map(v.fetchers)}),se=!1)}async function Nn(s,u,h,y,x,C,N,R,_){let S=v.fetchers.get(s);Le(s,it(_,S?S.data:void 0),{flushSync:N});let T=new AbortController,I=Xe(e.history,h,T.signal);if(C){let B=await Et(x,new URL(I.url).pathname,I.signal,s);if(B.type==="aborted")return;if(B.type==="error"){Se(s,u,B.error,{flushSync:N});return}else if(B.matches)x=B.matches,y=lt(x,h);else{Se(s,u,ce(404,{pathname:h}),{flushSync:N});return}}Z.set(s,T);let O=Te,$=(await et("loader",v,I,[y],x,s))[y.route.id];if(Ie($)&&($=await rr($,I.signal,!0)||$),Z.get(s)===T&&Z.delete(s),!I.signal.aborted){if(de.has(s)){Le(s,je(void 0));return}if(We($))if(Ce>O){Le(s,je(void 0));return}else{ue.add(s),await Fe(I,$,!1,{preventScrollReset:R});return}if(pe($)){Se(s,u,$.error);return}U(!Ie($),"Unhandled fetcher deferred data"),Le(s,je($.data))}}async function Fe(s,u,h,y){let{submission:x,fetcherSubmission:C,preventScrollReset:N,replace:R}=y===void 0?{}:y;u.response.headers.has("X-Remix-Revalidate")&&(se=!0);let _=u.response.headers.get("Location");U(_,"Expected a Location header on the redirect Response"),_=Dr(_,new URL(s.url),c,e.history);let S=ct(v.location,_,{_isRedirect:!0});if(r){let B=!1;if(u.response.headers.has("X-Remix-Reload-Document"))B=!0;else if(tr.test(_)){const X=e.history.createURL(_);B=X.origin!==t.location.origin||ft(X.pathname,c)==null}if(B){R?t.location.replace(_):t.location.assign(_);return}}M=null;let T=R===!0||u.response.headers.has("X-Remix-Replace")?re.Replace:re.Push,{formMethod:I,formAction:O,formEncType:ie}=v.navigation;!x&&!C&&I&&O&&ie&&(x=Or(v.navigation));let $=x||C;if(ka.has(u.response.status)&&$&&ge($.formMethod))await Ae(T,S,{submission:J({},$,{formAction:_}),preventScrollReset:N||V,enableViewTransition:h?ne:void 0});else{let B=zt(S,x);await Ae(T,S,{overrideNavigation:B,fetcherSubmission:C,preventScrollReset:N||V,enableViewTransition:h?ne:void 0})}}async function et(s,u,h,y,x,C){let N,R={};try{N=await $a(d,s,u,h,y,x,C,i,a)}catch(_){return y.forEach(S=>{R[S.route.id]={type:H.error,error:_}}),R}for(let[_,S]of Object.entries(N))if(Xa(S)){let T=S.result;R[_]={type:H.redirect,response:Ga(T,h,_,x,c,g.v7_relativeSplatPath)}}else R[_]=await Ya(S);return R}async function cr(s,u,h,y,x){let C=s.matches,N=et("loader",s,x,h,u,null),R=Promise.all(y.map(async T=>{if(T.matches&&T.match&&T.controller){let O=(await et("loader",s,Xe(e.history,T.path,T.controller.signal),[T.match],T.matches,T.key))[T.match.route.id];return{[T.key]:O}}else return Promise.resolve({[T.key]:{type:H.error,error:ce(404,{pathname:T.path})}})})),_=await N,S=(await R).reduce((T,I)=>Object.assign(T,I),{});return await Promise.all([ei(u,_,x.signal,C,s.loaderData),ti(u,S,y)]),{loaderResults:_,fetcherResults:S}}function Ot(){se=!0,Ke.push(...At()),De.forEach((s,u)=>{Z.has(u)&&Ye.add(u),Ne(u)})}function Le(s,u,h){h===void 0&&(h={}),v.fetchers.set(s,u),W({fetchers:new Map(v.fetchers)},{flushSync:(h&&h.flushSync)===!0})}function Se(s,u,h,y){y===void 0&&(y={});let x=ze(v.matches,u);wt(s),W({errors:{[x.route.id]:h},fetchers:new Map(v.fetchers)},{flushSync:(y&&y.flushSync)===!0})}function ur(s){return Oe.set(s,(Oe.get(s)||0)+1),de.has(s)&&de.delete(s),v.fetchers.get(s)||Aa}function wt(s){let u=v.fetchers.get(s);Z.has(s)&&!(u&&u.state==="loading"&&xe.has(s))&&Ne(s),De.delete(s),xe.delete(s),ue.delete(s),g.v7_fetcherPersist&&de.delete(s),Ye.delete(s),v.fetchers.delete(s)}function jn(s){let u=(Oe.get(s)||0)-1;u<=0?(Oe.delete(s),de.add(s),g.v7_fetcherPersist||wt(s)):Oe.set(s,u),W({fetchers:new Map(v.fetchers)})}function Ne(s){let u=Z.get(s);u&&(u.abort(),Z.delete(s))}function dr(s){for(let u of s){let h=ur(u),y=je(h.data);v.fetchers.set(u,y)}}function fr(){let s=[],u=!1;for(let h of ue){let y=v.fetchers.get(h);U(y,"Expected fetcher: "+h),y.state==="loading"&&(ue.delete(h),s.push(h),u=!0)}return dr(s),u}function hr(s){let u=[];for(let[h,y]of xe)if(y<s){let x=v.fetchers.get(h);U(x,"Expected fetcher: "+h),x.state==="loading"&&(Ne(h),xe.delete(h),u.push(h))}return dr(u),u.length>0}function In(s,u){let h=v.blockers.get(s)||at;return ve.get(s)!==u&&ve.set(s,u),h}function pr(s){v.blockers.delete(s),ve.delete(s)}function bt(s,u){let h=v.blockers.get(s)||at;U(h.state==="unblocked"&&u.state==="blocked"||h.state==="blocked"&&u.state==="blocked"||h.state==="blocked"&&u.state==="proceeding"||h.state==="blocked"&&u.state==="unblocked"||h.state==="proceeding"&&u.state==="unblocked","Invalid blocker state transition: "+h.state+" -> "+u.state);let y=new Map(v.blockers);y.set(s,u),W({blockers:y})}function mr(s){let{currentLocation:u,nextLocation:h,historyAction:y}=s;if(ve.size===0)return;ve.size>1&&$e(!1,"A router only supports one blocker at a time");let x=Array.from(ve.entries()),[C,N]=x[x.length-1],R=v.blockers.get(C);if(!(R&&R.state==="proceeding")&&N({currentLocation:u,nextLocation:h,historyAction:y}))return C}function kt(s){let u=ce(404,{pathname:s}),h=l||o,{matches:y,route:x}=Mr(h);return At(),{notFoundMatches:y,route:x,error:u}}function At(s){let u=[];return Ee.forEach((h,y)=>{(!s||s(y))&&(h.cancel(),u.push(y),Ee.delete(y))}),u}function Mn(s,u,h){if(P=s,D=u,E=h||null,!F&&v.navigation===Bt){F=!0;let y=vr(v.location,v.matches);y!=null&&W({restoreScrollPosition:y})}return()=>{P=null,D=null,E=null}}function gr(s,u){return E&&E(s,u.map(y=>pa(y,v.loaderData)))||s.key}function Un(s,u){if(P&&D){let h=gr(s,u);P[h]=D()}}function vr(s,u){if(P){let h=gr(s,u),y=P[h];if(typeof y=="number")return y}return null}function xt(s,u,h){if(m)if(s){if(Object.keys(s[0].params).length>0)return{active:!0,matches:Tt(u,h,c,!0)}}else return{active:!0,matches:Tt(u,h,c,!0)||[]};return{active:!1,matches:null}}async function Et(s,u,h,y){if(!m)return{type:"success",matches:s};let x=s;for(;;){let C=l==null,N=l||o,R=i;try{await m({signal:h,path:u,matches:x,fetcherKey:y,patch:(T,I)=>{h.aborted||Cr(T,I,N,R,a)}})}catch(T){return{type:"error",error:T,partialMatches:x}}finally{C&&!h.aborted&&(o=[...o])}if(h.aborted)return{type:"aborted"};let _=Be(N,u,c);if(_)return{type:"success",matches:_};let S=Tt(N,u,c,!0);if(!S||x.length===S.length&&x.every((T,I)=>T.route.id===S[I].route.id))return{type:"success",matches:null};x=S}}function On(s){i={},l=Lt(s,a,void 0,i)}function kn(s,u){let h=l==null;Cr(s,u,l||o,i,a),h&&(o=[...o],W({}))}return me={get basename(){return c},get future(){return g},get state(){return v},get routes(){return o},get window(){return t},initialize:vt,subscribe:fe,enableScrollRestoration:Mn,navigate:yt,fetch:Dn,revalidate:_n,createHref:s=>e.history.createHref(s),encodeLocation:s=>e.history.encodeLocation(s),getFetcher:ur,deleteFetcher:jn,dispose:k,getBlocker:In,deleteBlocker:pr,patchRoutes:kn,_internalFetchControllers:Z,_internalActiveDeferreds:Ee,_internalSetRoutes:On},me}function Ba(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Kt(e,t,r,n,a,i,o,l){let c,d;if(o){c=[];for(let g of t)if(c.push(g),g.route.id===o){d=g;break}}else c=t,d=t[t.length-1];let m=er(a||".",Zt(c,i),ft(e.pathname,r)||e.pathname,l==="path");if(a==null&&(m.search=e.search,m.hash=e.hash),(a==null||a===""||a===".")&&d){let g=nr(m.search);if(d.route.index&&!g)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&g){let w=new URLSearchParams(m.search),b=w.getAll("index");w.delete("index"),b.filter(E=>E).forEach(E=>w.append("index",E));let P=w.toString();m.search=P?"?"+P:""}}return n&&r!=="/"&&(m.pathname=m.pathname==="/"?r:Me([r,m.pathname])),dt(m)}function Rr(e,t,r,n){if(!n||!Ba(n))return{path:r};if(n.formMethod&&!Za(n.formMethod))return{path:r,error:ce(405,{method:n.formMethod})};let a=()=>({path:r,error:ce(400,{type:"invalid-body"})}),i=n.formMethod||"get",o=e?i.toUpperCase():i.toLowerCase(),l=rn(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!ge(o))return a();let w=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((b,P)=>{let[E,D]=P;return""+b+E+"="+D+`
|
|
12
|
+
`},""):String(n.body);return{path:r,submission:{formMethod:o,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:w}}}else if(n.formEncType==="application/json"){if(!ge(o))return a();try{let w=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:o,formAction:l,formEncType:n.formEncType,formData:void 0,json:w,text:void 0}}}catch{return a()}}}U(typeof FormData=="function","FormData is not available in this environment");let c,d;if(n.formData)c=Gt(n.formData),d=n.formData;else if(n.body instanceof FormData)c=Gt(n.body),d=n.body;else if(n.body instanceof URLSearchParams)c=n.body,d=Lr(c);else if(n.body==null)c=new URLSearchParams,d=new FormData;else try{c=new URLSearchParams(n.body),d=Lr(c)}catch{return a()}let m={formMethod:o,formAction:l,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:d,json:void 0,text:void 0};if(ge(m.formMethod))return{path:r,submission:m};let g=Ue(r);return t&&g.search&&nr(g.search)&&c.append("index",""),g.search="?"+c,{path:dt(g),submission:m}}function _r(e,t,r){r===void 0&&(r=!1);let n=e.findIndex(a=>a.route.id===t);return n>=0?e.slice(0,r?n+1:n):e}function Pr(e,t,r,n,a,i,o,l,c,d,m,g,w,b,P,E){let D=E?pe(E[1])?E[1].error:E[1].data:void 0,F=e.createURL(t.location),L=e.createURL(a),G=r;i&&t.errors?G=_r(r,Object.keys(t.errors)[0],!0):E&&pe(E[1])&&(G=_r(r,E[0]));let ee=E?E[1].statusCode:void 0,K=o&&ee&&ee>=400,me=G.filter((j,V)=>{let{route:M}=j;if(M.lazy)return!0;if(M.loader==null)return!1;if(i)return Yt(M,t.loaderData,t.errors);if(za(t.loaderData,t.matches[V],j)||c.some(oe=>oe===j.route.id))return!0;let ne=t.matches[V],q=j;return Tr(j,J({currentUrl:F,currentParams:ne.params,nextUrl:L,nextParams:q.params},n,{actionResult:D,actionStatus:ee,defaultShouldRevalidate:K?!1:l||F.pathname+F.search===L.pathname+L.search||F.search!==L.search||en(ne,q)}))}),v=[];return g.forEach((j,V)=>{if(i||!r.some(ae=>ae.route.id===j.routeId)||m.has(V))return;let M=Be(b,j.path,P);if(!M){v.push({key:V,routeId:j.routeId,path:j.path,matches:null,match:null,controller:null});return}let ne=t.fetchers.get(V),q=lt(M,j.path),oe=!1;w.has(V)?oe=!1:d.has(V)?(d.delete(V),oe=!0):ne&&ne.state!=="idle"&&ne.data===void 0?oe=l:oe=Tr(q,J({currentUrl:F,currentParams:t.matches[t.matches.length-1].params,nextUrl:L,nextParams:r[r.length-1].params},n,{actionResult:D,actionStatus:ee,defaultShouldRevalidate:K?!1:l})),oe&&v.push({key:V,routeId:j.routeId,path:j.path,matches:M,match:q,controller:new AbortController})}),[me,v]}function Yt(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let n=t!=null&&t[e.id]!==void 0,a=r!=null&&r[e.id]!==void 0;return!n&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!n&&!a}function za(e,t,r){let n=!t||r.route.id!==t.route.id,a=e[r.route.id]===void 0;return n||a}function en(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Tr(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Cr(e,t,r,n,a){var i;let o;if(e){let d=n[e];U(d,"No route found to patch children into: routeId = "+e),d.children||(d.children=[]),o=d.children}else o=r;let l=t.filter(d=>!o.some(m=>tn(d,m))),c=Lt(l,a,[e||"_","patch",String(((i=o)==null?void 0:i.length)||"0")],n);o.push(...c)}function tn(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,n)=>{var a;return(a=t.children)==null?void 0:a.some(i=>tn(r,i))}):!1}async function Ha(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let a=r[e.id];U(a,"No route found in manifest");let i={};for(let o in n){let c=a[o]!==void 0&&o!=="hasErrorBoundary";$e(!c,'Route "'+a.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!c&&!fa.has(o)&&(i[o]=n[o])}Object.assign(a,i),Object.assign(a,J({},t(a),{lazy:void 0}))}async function Wa(e){let{matches:t}=e,r=t.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,i,o)=>Object.assign(a,{[r[o].route.id]:i}),{})}async function $a(e,t,r,n,a,i,o,l,c,d){let m=i.map(b=>b.route.lazy?Ha(b.route,c,l):void 0),g=i.map((b,P)=>{let E=m[P],D=a.some(L=>L.route.id===b.route.id);return J({},b,{shouldLoad:D,resolve:async L=>(L&&n.method==="GET"&&(b.route.lazy||b.route.loader)&&(D=!0),D?Ka(t,n,b,E,L,d):Promise.resolve({type:H.data,result:void 0}))})}),w=await e({matches:g,request:n,params:i[0].params,fetcherKey:o,context:d});try{await Promise.all(m)}catch{}return w}async function Ka(e,t,r,n,a,i){let o,l,c=d=>{let m,g=new Promise((P,E)=>m=E);l=()=>m(),t.signal.addEventListener("abort",l);let w=P=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):d({request:t,params:r.params,context:i},...P!==void 0?[P]:[]),b=(async()=>{try{return{type:"data",result:await(a?a(E=>w(E)):w())}}catch(P){return{type:"error",result:P}}})();return Promise.race([b,g])};try{let d=r.route[e];if(n)if(d){let m,[g]=await Promise.all([c(d).catch(w=>{m=w}),n]);if(m!==void 0)throw m;o=g}else if(await n,d=r.route[e],d)o=await c(d);else if(e==="action"){let m=new URL(t.url),g=m.pathname+m.search;throw ce(405,{method:t.method,pathname:g,routeId:r.route.id})}else return{type:H.data,result:void 0};else if(d)o=await c(d);else{let m=new URL(t.url),g=m.pathname+m.search;throw ce(404,{pathname:g})}U(o.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:H.error,result:d}}finally{l&&t.signal.removeEventListener("abort",l)}return o}async function Ya(e){let{result:t,type:r}=e;if(nn(t)){let g;try{let w=t.headers.get("Content-Type");w&&/\bapplication\/json\b/.test(w)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(w){return{type:H.error,error:w}}return r===H.error?{type:H.error,error:new Nt(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:H.data,data:g,statusCode:t.status,headers:t.headers}}if(r===H.error){if(Ur(t)){var n,a;if(t.data instanceof Error){var i,o;return{type:H.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:H.error,error:new Nt(((n=t.init)==null?void 0:n.status)||500,void 0,t.data),statusCode:ut(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:H.error,error:t,statusCode:ut(t)?t.status:void 0}}if(Qa(t)){var l,c;return{type:H.deferred,deferredData:t,statusCode:(l=t.init)==null?void 0:l.status,headers:((c=t.init)==null?void 0:c.headers)&&new Headers(t.init.headers)}}if(Ur(t)){var d,m;return{type:H.data,data:t.data,statusCode:(d=t.init)==null?void 0:d.status,headers:(m=t.init)!=null&&m.headers?new Headers(t.init.headers):void 0}}return{type:H.data,data:t}}function Ga(e,t,r,n,a,i){let o=e.headers.get("Location");if(U(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!tr.test(o)){let l=n.slice(0,n.findIndex(c=>c.route.id===r)+1);o=Kt(new URL(t.url),l,a,!0,o,i),e.headers.set("Location",o)}return e}function Dr(e,t,r,n){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(tr.test(e)){let i=e,o=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(a.includes(o.protocol))throw new Error("Invalid redirect location");let l=ft(o.pathname,r)!=null;if(o.origin===t.origin&&l)return o.pathname+o.search+o.hash}try{let i=n.createURL(e);if(a.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Xe(e,t,r,n){let a=e.createURL(rn(t)).toString(),i={signal:r};if(n&&ge(n.formMethod)){let{formMethod:o,formEncType:l}=n;i.method=o.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(n.json)):l==="text/plain"?i.body=n.text:l==="application/x-www-form-urlencoded"&&n.formData?i.body=Gt(n.formData):i.body=n.formData}return new Request(a,i)}function Gt(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function Lr(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ja(e,t,r,n,a){let i={},o=null,l,c=!1,d={},m=r&&pe(r[1])?r[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let w=g.route.id,b=t[w];if(U(!We(b),"Cannot handle redirect results in processLoaderData"),pe(b)){let P=b.error;m!==void 0&&(P=m,m=void 0),o=o||{};{let E=ze(e,w);o[E.route.id]==null&&(o[E.route.id]=P)}i[w]=void 0,c||(c=!0,l=ut(b.error)?b.error.status:500),b.headers&&(d[w]=b.headers)}else Ie(b)?(n.set(w,b.deferredData),i[w]=b.deferredData.data,b.statusCode!=null&&b.statusCode!==200&&!c&&(l=b.statusCode),b.headers&&(d[w]=b.headers)):(i[w]=b.data,b.statusCode&&b.statusCode!==200&&!c&&(l=b.statusCode),b.headers&&(d[w]=b.headers))}),m!==void 0&&r&&(o={[r[0]]:m},i[r[0]]=void 0),{loaderData:i,errors:o,statusCode:l||200,loaderHeaders:d}}function Nr(e,t,r,n,a,i,o){let{loaderData:l,errors:c}=Ja(t,r,n,o);return a.forEach(d=>{let{key:m,match:g,controller:w}=d,b=i[m];if(U(b,"Did not find corresponding fetcher result"),!(w&&w.signal.aborted))if(pe(b)){let P=ze(e.matches,g==null?void 0:g.route.id);c&&c[P.route.id]||(c=J({},c,{[P.route.id]:b.error})),e.fetchers.delete(m)}else if(We(b))U(!1,"Unhandled fetcher revalidation redirect");else if(Ie(b))U(!1,"Unhandled fetcher deferred data");else{let P=je(b.data);e.fetchers.set(m,P)}}),{loaderData:l,errors:c}}function jr(e,t,r,n){let a=J({},t);for(let i of r){let o=i.route.id;if(t.hasOwnProperty(o)?t[o]!==void 0&&(a[o]=t[o]):e[o]!==void 0&&i.route.loader&&(a[o]=e[o]),n&&n.hasOwnProperty(o))break}return a}function Ir(e){return e?pe(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ze(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function Mr(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ce(e,t){let{pathname:r,routeId:n,method:a,type:i,message:o}=t===void 0?{}:t,l="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(l="Bad Request",a&&r&&n?c="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":i==="defer-action"?c="defer() is not supported in actions":i==="invalid-body"&&(c="Unable to encode submission body")):e===403?(l="Forbidden",c='Route "'+n+'" does not match URL "'+r+'"'):e===404?(l="Not Found",c='No route matches URL "'+r+'"'):e===405&&(l="Method Not Allowed",a&&r&&n?c="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(c='Invalid request method "'+a.toUpperCase()+'"')),new Nt(e||500,l,new Error(c),!0)}function Pt(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,a]=t[r];if(We(a))return{key:n,result:a}}}function rn(e){let t=typeof e=="string"?Ue(e):e;return dt(J({},t,{hash:""}))}function qa(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Xa(e){return nn(e.result)&&Oa.has(e.result.status)}function Ie(e){return e.type===H.deferred}function pe(e){return e.type===H.error}function We(e){return(e&&e.type)===H.redirect}function Ur(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Qa(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function nn(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Za(e){return Ua.has(e.toLowerCase())}function ge(e){return Ia.has(e.toLowerCase())}async function ei(e,t,r,n,a){let i=Object.entries(t);for(let o=0;o<i.length;o++){let[l,c]=i[o],d=e.find(w=>(w==null?void 0:w.route.id)===l);if(!d)continue;let m=n.find(w=>w.route.id===d.route.id),g=m!=null&&!en(m,d)&&(a&&a[d.route.id])!==void 0;Ie(c)&&g&&await rr(c,r,!1).then(w=>{w&&(t[l]=w)})}}async function ti(e,t,r){for(let n=0;n<r.length;n++){let{key:a,routeId:i,controller:o}=r[n],l=t[a];e.find(d=>(d==null?void 0:d.route.id)===i)&&Ie(l)&&(U(o,"Expected an AbortController for revalidating fetcher deferred result"),await rr(l,o.signal,!0).then(d=>{d&&(t[a]=d)}))}}async function rr(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:H.data,data:e.deferredData.unwrappedData}}catch(a){return{type:H.error,error:a}}return{type:H.data,data:e.deferredData.data}}}function nr(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function lt(e,t){let r=typeof t=="string"?Ue(t).search:t.search;if(e[e.length-1].route.index&&nr(r||""))return e[e.length-1];let n=Xr(e);return n[n.length-1]}function Or(e){let{formMethod:t,formAction:r,formEncType:n,text:a,formData:i,json:o}=e;if(!(!t||!r||!n)){if(a!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:r,formEncType:n,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:o,text:void 0}}}function zt(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function ri(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function it(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ni(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function je(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function ai(e,t){try{let r=e.sessionStorage.getItem(Zr);if(r){let n=JSON.parse(r);for(let[a,i]of Object.entries(n||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function ii(e,t){if(t.size>0){let r={};for(let[n,a]of t)r[n]=[...a];try{e.sessionStorage.setItem(Zr,JSON.stringify(r))}catch(n){$e(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/**
|
|
13
13
|
* React Router v6.30.3
|
|
14
14
|
*
|
|
15
15
|
* Copyright (c) Remix Software Inc.
|
|
@@ -18,7 +18,7 @@ var Fn=Object.defineProperty;var Vn=(e,t,r)=>t in e?Fn(e,t,{enumerable:!0,config
|
|
|
18
18
|
* LICENSE.md file in the root directory of this source tree.
|
|
19
19
|
*
|
|
20
20
|
* @license MIT
|
|
21
|
-
*/function jt(){return jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jt.apply(this,arguments)}const
|
|
21
|
+
*/function jt(){return jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jt.apply(this,arguments)}const Ut=f.createContext(null),an=f.createContext(null),ht=f.createContext(null),ar=f.createContext(null),Pe=f.createContext({outlet:null,matches:[],isDataRoute:!1}),on=f.createContext(null);function pt(){return f.useContext(ar)!=null}function mt(){return pt()||U(!1),f.useContext(ar).location}function sn(e){f.useContext(ht).static||f.useLayoutEffect(e)}function ir(){let{isDataRoute:e}=f.useContext(Pe);return e?wi():oi()}function oi(){pt()||U(!1);let e=f.useContext(Ut),{basename:t,future:r,navigator:n}=f.useContext(ht),{matches:a}=f.useContext(Pe),{pathname:i}=mt(),o=JSON.stringify(Zt(a,r.v7_relativeSplatPath)),l=f.useRef(!1);return sn(()=>{l.current=!0}),f.useCallback(function(d,m){if(m===void 0&&(m={}),!l.current)return;if(typeof d=="number"){n.go(d);return}let g=er(d,JSON.parse(o),i,m.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Me([t,g.pathname])),(m.replace?n.replace:n.push)(g,m.state,m)},[t,n,o,i,e])}const si=f.createContext(null);function li(e){let t=f.useContext(Pe).outlet;return t&&f.createElement(si.Provider,{value:e},t)}function as(){let{matches:e}=f.useContext(Pe),t=e[e.length-1];return t?t.params:{}}function ci(e,t,r,n){pt()||U(!1);let{navigator:a}=f.useContext(ht),{matches:i}=f.useContext(Pe),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=mt(),m;m=d;let g=m.pathname||"/",w=g;if(c!=="/"){let E=c.replace(/^\//,"").split("/");w="/"+g.replace(/^\//,"").split("/").slice(E.length).join("/")}let b=Be(e,{pathname:w});return pi(b&&b.map(E=>Object.assign({},E,{params:Object.assign({},l,E.params),pathname:Me([c,a.encodeLocation?a.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?c:Me([c,a.encodeLocation?a.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),i,r,n)}function ui(){let e=yi(),t=ut(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),r?f.createElement("pre",{style:a},r):null,null)}const di=f.createElement(ui,null);class fi extends f.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?f.createElement(Pe.Provider,{value:this.props.routeContext},f.createElement(on.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hi(e){let{routeContext:t,match:r,children:n}=e,a=f.useContext(Ut);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),f.createElement(Pe.Provider,{value:t},n)}function pi(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(a=r)==null?void 0:a.errors;if(l!=null){let m=o.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);m>=0||U(!1),o=o.slice(0,Math.min(o.length,m+1))}let c=!1,d=-1;if(r&&n&&n.v7_partialHydration)for(let m=0;m<o.length;m++){let g=o[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=m),g.route.id){let{loaderData:w,errors:b}=r,P=g.route.loader&&w[g.route.id]===void 0&&(!b||b[g.route.id]===void 0);if(g.route.lazy||P){c=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((m,g,w)=>{let b,P=!1,E=null,D=null;r&&(b=l&&g.route.id?l[g.route.id]:void 0,E=g.route.errorElement||di,c&&(d<0&&w===0?(bi("route-fallback"),P=!0,D=null):d===w&&(P=!0,D=g.route.hydrateFallbackElement||null)));let F=t.concat(o.slice(0,w+1)),L=()=>{let G;return b?G=E:P?G=D:g.route.Component?G=f.createElement(g.route.Component,null):g.route.element?G=g.route.element:G=m,f.createElement(hi,{match:g,routeContext:{outlet:m,matches:F,isDataRoute:r!=null},children:G})};return r&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?f.createElement(fi,{location:r.location,revalidation:r.revalidation,component:E,error:b,children:L(),routeContext:{outlet:null,matches:F,isDataRoute:!0}}):L()},null)}var ln=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(ln||{}),cn=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(cn||{});function mi(e){let t=f.useContext(Ut);return t||U(!1),t}function gi(e){let t=f.useContext(an);return t||U(!1),t}function vi(e){let t=f.useContext(Pe);return t||U(!1),t}function un(e){let t=vi(),r=t.matches[t.matches.length-1];return r.route.id||U(!1),r.route.id}function yi(){var e;let t=f.useContext(on),r=gi(cn.UseRouteError),n=un();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function wi(){let{router:e}=mi(ln.UseNavigateStable),t=un(),r=f.useRef(!1);return sn(()=>{r.current=!0}),f.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,jt({fromRouteId:t},i)))},[e,t])}const kr={};function bi(e,t,r){kr[e]||(kr[e]=!0)}function xi(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function dn(e){let{to:t,replace:r,state:n,relative:a}=e;pt()||U(!1);let{future:i,static:o}=f.useContext(ht),{matches:l}=f.useContext(Pe),{pathname:c}=mt(),d=ir(),m=er(t,Zt(l,i.v7_relativeSplatPath),c,a==="path"),g=JSON.stringify(m);return f.useEffect(()=>d(JSON.parse(g),{replace:r,state:n,relative:a}),[d,g,a,r,n]),null}function Ei(e){return li(e.context)}function Si(e){let{basename:t="/",children:r=null,location:n,navigationType:a=re.Pop,navigator:i,static:o=!1,future:l}=e;pt()&&U(!1);let c=t.replace(/^\/*/,"/"),d=f.useMemo(()=>({basename:c,navigator:i,static:o,future:jt({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof n=="string"&&(n=Ue(n));let{pathname:m="/",search:g="",hash:w="",state:b=null,key:P="default"}=n,E=f.useMemo(()=>{let D=ft(m,c);return D==null?null:{location:{pathname:D,search:g,hash:w,state:b,key:P},navigationType:a}},[c,m,g,w,b,P,a]);return E==null?null:f.createElement(ht.Provider,{value:d},f.createElement(ar.Provider,{children:r,value:E}))}new Promise(()=>{});function Ri(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:f.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:f.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:f.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
|
|
22
22
|
* React Router DOM v6.30.3
|
|
23
23
|
*
|
|
24
24
|
* Copyright (c) Remix Software Inc.
|
|
@@ -27,4 +27,4 @@ var Fn=Object.defineProperty;var Vn=(e,t,r)=>t in e?Fn(e,t,{enumerable:!0,config
|
|
|
27
27
|
* LICENSE.md file in the root directory of this source tree.
|
|
28
28
|
*
|
|
29
29
|
* @license MIT
|
|
30
|
-
*/function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},It.apply(this,arguments)}function Gt(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function _i(e,t){let r=Gt(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const Pi="6";try{window.__reactRouterVersion=Pi}catch{}function Ti(e,t){return Va({basename:void 0,future:It({},void 0,{v7_prependBasename:!0}),history:ca({window:void 0}),hydrationData:Ci(),routes:e,mapRouteProperties:Ri,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function Ci(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=It({},t,{errors:Di(t.errors)})),t}function Di(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&a.__type==="RouteErrorResponse")r[n]=new Nt(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let o=new i(a.message);o.stack="",r[n]=o}catch{}}if(r[n]==null){let i=new Error(a.message);i.stack="",r[n]=i}}else r[n]=a;return r}const Li=f.createContext({isTransitioning:!1}),Ni=f.createContext(new Map),ji="startTransition",Ar=Hn[ji],Ii="flushSync",Fr=la[Ii];function Mi(e){Ar?Ar(e):e()}function ot(e){Fr?Fr(e):e()}class Ui{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function Oi(e){let{fallbackElement:t,router:r,future:n}=e,[a,i]=f.useState(r.state),[o,l]=f.useState(),[c,d]=f.useState({isTransitioning:!1}),[m,g]=f.useState(),[w,b]=f.useState(),[P,E]=f.useState(),D=f.useRef(new Map),{v7_startTransition:F}=n||{},L=f.useCallback(j=>{F?Mi(j):j()},[F]),G=f.useCallback((j,V)=>{let{deletedFetchers:M,flushSync:ne,viewTransitionOpts:q}=V;j.fetchers.forEach((ae,se)=>{ae.data!==void 0&&D.current.set(se,ae.data)}),M.forEach(ae=>D.current.delete(ae));let oe=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!q||oe){ne?ot(()=>i(j)):L(()=>i(j));return}if(ne){ot(()=>{w&&(m&&m.resolve(),w.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:q.currentLocation,nextLocation:q.nextLocation})});let ae=r.window.document.startViewTransition(()=>{ot(()=>i(j))});ae.finished.finally(()=>{ot(()=>{g(void 0),b(void 0),l(void 0),d({isTransitioning:!1})})}),ot(()=>b(ae));return}w?(m&&m.resolve(),w.skipTransition(),E({state:j,currentLocation:q.currentLocation,nextLocation:q.nextLocation})):(l(j),d({isTransitioning:!0,flushSync:!1,currentLocation:q.currentLocation,nextLocation:q.nextLocation}))},[r.window,w,m,D,L]);f.useLayoutEffect(()=>r.subscribe(G),[r,G]),f.useEffect(()=>{c.isTransitioning&&!c.flushSync&&g(new Ui)},[c]),f.useEffect(()=>{if(m&&o&&r.window){let j=o,V=m.promise,M=r.window.document.startViewTransition(async()=>{L(()=>i(j)),await V});M.finished.finally(()=>{g(void 0),b(void 0),l(void 0),d({isTransitioning:!1})}),b(M)}},[L,o,m,r.window]),f.useEffect(()=>{m&&o&&a.location.key===o.location.key&&m.resolve()},[m,w,a.location,o]),f.useEffect(()=>{!c.isTransitioning&&P&&(l(P.state),d({isTransitioning:!0,flushSync:!1,currentLocation:P.currentLocation,nextLocation:P.nextLocation}),E(void 0))},[c.isTransitioning,P]),f.useEffect(()=>{},[]);let ee=f.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:j=>r.navigate(j),push:(j,V,M)=>r.navigate(j,{state:V,preventScrollReset:M==null?void 0:M.preventScrollReset}),replace:(j,V,M)=>r.navigate(j,{replace:!0,state:V,preventScrollReset:M==null?void 0:M.preventScrollReset})}),[r]),K=r.basename||"/",me=f.useMemo(()=>({router:r,navigator:ee,static:!1,basename:K}),[r,ee,K]),v=f.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return f.useEffect(()=>xi(n,r.future),[n,r.future]),f.createElement(f.Fragment,null,f.createElement(Mt.Provider,{value:me},f.createElement(an.Provider,{value:a},f.createElement(Ni.Provider,{value:D.current},f.createElement(Li.Provider,{value:c},f.createElement(Si,{basename:K,location:a.location,navigationType:a.historyAction,navigator:ee,future:v},a.initialized||r.future.v7_partialHydration?f.createElement(ki,{routes:r.routes,future:r.future,state:a}):t))))),null)}const ki=f.memo(Ai);function Ai(e){let{routes:t,future:r,state:n}=e;return ci(t,void 0,n,r)}var Vr;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Vr||(Vr={}));var Br;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Br||(Br={}));function Fi(e){let t=f.useRef(Gt(e)),r=f.useRef(!1),n=mt(),a=f.useMemo(()=>_i(n.search,r.current?null:t.current),[n.search]),i=ir(),o=f.useCallback((l,c)=>{const d=Gt(typeof l=="function"?l(a):l);r.current=!0,i("?"+d,c)},[i,a]);return[a,o]}let zt=null;function st(){return be().bridge}function Vi(){return{runtime:{isAvailable(){return st().supported},getPlatformInfo(){return st().getPlatformInfo()}},fs:{openFile(e){return st().openLocalFile(e)},revealInFileManager(e){return st().revealInFileManager(e)},pickDirectory(){return st().pickDirectory()}}}}function Bi(){return zt||(zt=Vi()),zt}function zi(){if(typeof window>"u"||window.self!==window.top)return;const e=Bi();window.__CODINGNS_DESKTOP_BRIDGE_INSTALLED__=!0,Object.defineProperty(window,"CodingNSDesktop",{configurable:!0,writable:!1,value:e})}const Hi="desktop://window-lifecycle",Wi=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function $i(e){return e instanceof HTMLInputElement?!Wi.has(e.type.toLowerCase()):!1}function Ki(e){const t=e.activeElement;if($i(t)||t instanceof HTMLTextAreaElement){const r=t.selectionStart??0,n=t.selectionEnd??r;return n<=r?null:t.value.slice(r,n)}return null}function Yi(e){const t=Ki(e);if(t!==null)return t;const r=e.getSelection();if(!r||r.isCollapsed)return null;const n=r.toString();return n.length>0?n:null}function Gi(e,t){var a;const r=(a=e.execCommand)==null?void 0:a.bind(e);if(typeof r!="function")return!1;const n=e.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.opacity="0",e.body.append(n),n.select();try{return r("copy")}catch{return!1}finally{n.remove()}}async function Ji(e,t,r){var a,i;try{if(await r(t))return}catch{}const n=(a=e.defaultView)==null?void 0:a.navigator;if((i=n==null?void 0:n.clipboard)!=null&&i.writeText)try{await n.clipboard.writeText(t);return}catch{}Gi(e,t)}function qi(e){const{window:t,document:r,writeClipboardText:n}=e;function a(i){if(i.defaultPrevented||!i.metaKey||i.ctrlKey||i.altKey||i.key.toLowerCase()!=="c")return;const o=Yi(r);o&&(i.preventDefault(),Ji(r,o,n))}return t.addEventListener("keydown",a,!0),()=>{t.removeEventListener("keydown",a,!0)}}const fn=f.createContext(null),Xi=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function Qi(e){if(typeof document>"u")return;const{documentElement:t,body:r}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),r&&(r.dataset.runtimePlatform=e.platform,r.dataset.osFamily=e.ui.osFamily,r.dataset.windowControls=e.ui.windowControlsStyle,r.dataset.viewportClass=e.viewportClass,r.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function Jt(){var e;if(!(typeof document>"u"))for(const t of Xi)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function Zi(e){if(typeof document>"u")return;if(!e){Jt();return}const t=[document.documentElement,document.body].filter(n=>!!n),r=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const n of t)for(const[a,i]of r)n.style.setProperty(a,i)}function eo(){if(!(typeof window>"u"))return window.innerWidth}function to({children:e}){const[t,r]=f.useState(()=>eo()),n=f.useMemo(()=>be({viewportWidth:t}),[t]);return f.useEffect(()=>{zi()},[]),f.useEffect(()=>{if(typeof window>"u")return;function a(){r(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),f.useEffect(()=>{Qi(n)},[n]),f.useEffect(()=>{if(!(typeof window>"u"||typeof document>"u")&&!(!n.isDesktop||n.ui.osFamily!=="macos"||!n.bridge.supported))return qi({window,document,writeClipboardText:async a=>(await n.bridge.writeClipboardText(a)).ok})},[n]),f.useEffect(()=>()=>{Jt()},[]),f.useEffect(()=>{let a=!1,i=null;return!n.isDesktop||!n.bridge.supported?()=>{a=!0}:(z(()=>import("./event-DvH9tcej.js").then(o=>o.c),[]).then(async({listen:o})=>{const l=await o(Hi,c=>{const d=c.payload,m=d==null?void 0:d.descriptor;m!=null&&m.windowId&&(n.windows.registerDescriptor(m),d.isOpen?n.windows.markWindowOpen(m.windowId):n.windows.markWindowClosed(m.windowId))});if(a){l();return}i=l}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),f.useEffect(()=>{let a=!1,i=null;async function o(){var c,d;const l=await n.bridge.getRuntimeInfo();a||Zi(l.ok?(d=(c=l.value)==null?void 0:c.windowChrome)==null?void 0:d.macosTitlebar:null)}return!n.isDesktop||n.ui.osFamily!=="macos"||!n.ui.prefersOverlayTitlebar?(Jt(),()=>{a=!0}):(o(),z(()=>import("./window-BVUB8gMK.js").then(l=>l.w),__vite__mapDeps([0,1])).then(async({getCurrentWindow:l})=>{const c=await l().onScaleChanged(()=>{o()});if(a){c();return}i=c}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),p.jsx(fn.Provider,{value:n,children:e})}function gt(){return f.useContext(fn)??be()}const is=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function os(e){return le(e.labelKey)}function ro(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function hn(e,t){return t?ro():e}function no(){const{theme:e,autoTheme:t}=Wn.getState().profile;return hn(e,t)}function ao(e){Xt({theme:e,autoTheme:!1}).catch(()=>{})}function io(e){Xt({autoTheme:e}).catch(()=>{})}function pn(e){typeof window>"u"||document.documentElement.setAttribute("data-theme",e)}function oo(){const e=Qe(n=>n.profile.theme),t=Qe(n=>n.profile.autoTheme);return{theme:hn(e,t),selectedTheme:e,autoTheme:t,setTheme:ao,setAutoTheme:io}}function so(){pn(no())}function lo({children:e}){const t=Qe(n=>n.profile.theme),r=Qe(n=>n.profile.autoTheme);return f.useEffect(()=>{so()},[t,r]),f.useEffect(()=>{if(!r||typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{pn(n.matches?"dark":"light")};return a(),typeof n.addEventListener=="function"?(n.addEventListener("change",a),()=>n.removeEventListener("change",a)):(n.addListener(a),()=>n.removeListener(a))},[r]),p.jsx(p.Fragment,{children:e})}const co={showToast:()=>"",dismissToast:()=>{}},mn=f.createContext(co);function uo(){return`toast-${Math.random().toString(36).slice(2,10)}`}function fo({toast:e,onDismiss:t}){const{id:r,title:n,description:a,tone:i,durationMs:o,action:l}=e;return f.useEffect(()=>{if(o===null)return;const c=window.setTimeout(()=>{t(r)},o);return()=>{window.clearTimeout(c)}},[o,r,t,n,a,i]),p.jsxs("article",{className:"toast-card","data-tone":i,role:i==="error"?"alert":"status",children:[p.jsxs("div",{className:"toast-body",children:[p.jsx("strong",{className:"toast-title",children:n}),a?p.jsx("p",{className:"toast-description",children:a}):null]}),p.jsxs("div",{className:"toast-actions",children:[l?p.jsx("button",{className:"toast-action",type:"button",onClick:()=>{l.onClick(),t(r)},children:l.label}):null,p.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(r),children:"×"})]})]})}function ho({children:e}){const[t,r]=f.useState([]),n=f.useCallback(o=>{r(l=>l.filter(c=>c.id!==o))},[]),a=f.useCallback(o=>{const l=o.id??uo(),c={id:l,title:o.title,description:o.description,tone:o.tone??"info",durationMs:o.durationMs===void 0?4200:o.durationMs,action:o.action};return r(d=>{const m=d.findIndex(w=>w.id===l);if(m===-1)return[...d,c];const g=[...d];return g[m]=c,g}),l},[]),i=f.useMemo(()=>({showToast:a,dismissToast:n}),[n,a]);return p.jsxs(mn.Provider,{value:i,children:[e,p.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(o=>p.jsx(fo,{toast:o,onDismiss:n},o.id))})]})}function ss(){return f.useContext(mn)}const Ct="1.0.0-beta.1",gn=f.createContext(Ct);function po({children:e}){const t=gt(),[r,n]=f.useState(Ct);return f.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(i=>{var l,c;if(a)return;const o=i.ok?(c=(l=i.value)==null?void 0:l.version)==null?void 0:c.trim():"";n(o||Ct)}),()=>{a=!0}):(n(Ct),()=>{a=!0})},[t]),p.jsx(gn.Provider,{value:r,children:e})}function mo(){return f.useContext(gn)}const zr={latestState:null,lastNotifiedVersion:null,pendingRestartVersion:null};class go{constructor(){_e(this,"state",zr);_e(this,"listeners",new Set);_e(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));_e(this,"getState",()=>this.state)}recordState(t){const r=Ht(this.state.pendingRestartVersion),n=Ht(t.currentVersion);this.state={latestState:t,lastNotifiedVersion:t.hasUpdate?this.state.lastNotifiedVersion:null,pendingRestartVersion:r&&r===n?null:this.state.pendingRestartVersion},this.emit()}markVersionNotified(t){this.state.lastNotifiedVersion!==t&&(this.state={...this.state,lastNotifiedVersion:t},this.emit())}markRestartPending(t){const r=Ht(t);!r||this.state.pendingRestartVersion===r||(this.state={...this.state,pendingRestartVersion:r},this.emit())}reset(){this.state=zr,this.emit()}emit(){for(const t of this.listeners)t()}}const Ze=new go;function Ht(e){const t=e==null?void 0:e.trim();return t||null}function vo(e){return f.useSyncExternalStore(Ze.subscribe,()=>e(Ze.getState()))}function yo(){return Ze.getState()}function wo(e){Ze.recordState(e)}function bo(e){Ze.markVersionNotified(e)}function xo(e){Ze.markRestartPending(e)}async function Eo(){const e=be(),t=he.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function So(e={}){const t=e.notify??"never",r=await Eo();return wo(r),await vn(r,t),r}async function vn(e,t){await _o(e,t)}async function Ro(){const e=be(),t=he.getState();return e.bridge.downloadUpdate(t.releaseChannel)}async function ls(){const e=be(),t=he.getState();return e.bridge.installUpdate(t.releaseChannel)}function cs(e){xo(e)}async function us(){var e;if(typeof window>"u"||typeof((e=window.__TAURI_INTERNALS__)==null?void 0:e.invoke)!="function")throw new Error("当前运行环境不支持桌面应用重启。");try{await window.__TAURI_INTERNALS__.invoke("restart_application")}catch(t){throw new Error(t instanceof Error?t.message:"重启应用失败。")}}async function _o(e,t){var i,o,l;if(!e.hasUpdate||t==="never")return;const r=((o=(i=e.manifest)==null?void 0:i.version)==null?void 0:o.trim())||e.currentVersion.trim();if(!r)return;const n=yo().lastNotifiedVersion;if(t==="always"||n!==r)try{(await be().bridge.showNotification(le("settings.releaseUpdateReady"),((l=e.manifest)==null?void 0:l.version)??e.currentVersion)).ok&&bo(r)}catch{}}async function Po(){const e=he.getState();return Qt.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}async function ds(e){const t=he.getState();return Qt.request("/api/client/service-update/install",{method:"POST",body:JSON.stringify({packageName:e,channel:t.releaseChannel})})}async function fs(e){return Qt.request(`/api/client/service-update/tasks/${encodeURIComponent(e)}`)}async function To(e={}){const[t,r]=await Promise.allSettled([Po(),So(e)]);return{servicePackage:t.status==="fulfilled"?t.value.packages[0]??null:null,serviceError:t.status==="rejected"?Hr(t.reason):null,clientState:r.status==="fulfilled"?r.value:null,clientError:r.status==="rejected"?Hr(r.reason):null}}function Hr(e){return e instanceof Error&&e.message.trim()?e.message:"检查更新失败"}const Co=3600*1e3;function Do(){const e=He(i=>i.platform),t=He(i=>i.autoCheckUpdate),r=He(i=>i.autoDownloadUpdate),n=He(i=>i.releaseChannel),a=vo(i=>i.pendingRestartVersion);return f.useEffect(()=>{if(e!=="desktop"||!t||a)return;async function i(){await Lo(r)}i();const o=window.setInterval(()=>{i()},Co);return()=>{window.clearInterval(o)}},[t,r,a,e,n]),null}async function Lo(e){try{const t=await To({notify:"never"}),r=t.servicePackage,n=t.clientState,a=!!(r!=null&&r.hasUpdate&&!r.restartRequired),i=!!(n!=null&&n.hasUpdate&&n.manifest);if(e&&(n!=null&&n.hasUpdate)&&n.manifest){const o=await Ro();if(!o.ok)return;await be().bridge.showNotification(le("settings.releaseDownloadedNotificationTitle"),le("settings.releaseDownloadedNotificationBody",{version:o.version??n.manifest.version}));return}if(a&&i){await be().bridge.showNotification(le("settings.softwareUpdate"),le("settings.updateBothReady"));return}if(a){await be().bridge.showNotification(le("settings.serverUpdateReady"),`${le("settings.serverTargetVersion")}: ${(r==null?void 0:r.latestVersion)??"-"}`);return}i&&n&&await vn(n,"if-new")}catch{}}const yn="codingns.server.base-url.history",or=6,wn="__custom__";function bn(){return typeof window<"u"&&typeof window.localStorage<"u"}function xn(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function sr(e){if(!e)return null;try{return Kr(e)}catch{return null}}function En(){if(!bn())return[];const e=window.localStorage.getItem(yn);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?sr(r):null).filter(r=>!!r):[]}catch{return[]}}function No(e){const t=new Set,r=[];for(const n of e)!n||t.has(n)||(t.add(n),r.push(n));return r}function jo(e){const t=new Set,r=[];for(const n of e)!n||t.has(n.value)||(t.add(n.value),r.push(n));return r}function Io(e,t){const r=En();return No([e,...t,...r,sr(xn())]).slice(0,or)}function Mo(e){const t=Dt(e),r=En().map(l=>({value:l,source:"history"})),n=sr(xn()),a=e.hosts.map(l=>({value:l.baseUrl,source:"saved"})),i=Kn(e).map(l=>({value:l.baseUrl,source:"discovered"})),o=t?{value:t.baseUrl,source:Yr(t)?"discovered":"saved"}:null;return jo([o,...a,...i,...r,n?{value:n,source:"origin"}:null]).slice(0,or)}function Uo(e){bn()&&window.localStorage.setItem(yn,JSON.stringify(e.slice(0,or)))}class Oo{constructor(){_e(this,"state",this.createState(he.getState()));_e(this,"listeners",new Set);_e(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));_e(this,"getState",()=>this.state);he.subscribe(()=>{const t=this.createState(he.getState());t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((r,n)=>r===this.state.options[n])&&t.presetOptions.length===this.state.presetOptions.length&&t.presetOptions.every((r,n)=>{const a=this.state.presetOptions[n];return(a==null?void 0:a.value)===r.value&&(a==null?void 0:a.source)===r.source})||(this.state=t,this.emit())})}setBaseUrl(t){const r=he.getState(),n=Dt(r);if(!n)return!1;const a=Kr(t),i=a!==n.baseUrl,o=Ao(a,n);if(Yr(n))return he.updateRuntime({discoveredHosts:r.discoveredHosts.map(c=>c.id===n.id?{...c,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:c)}),this.state=this.createState(he.getState()),this.emit(),i;const l=r.hosts.map(c=>c.id===n.id?{...c,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:c);return this.state=this.createState({...r,hosts:l}),this.emit(),he.update({hosts:l}),i}reset(){this.state=this.createState(he.getState()),this.emit()}createState(t){const r=Dt(t),n=(r==null?void 0:r.baseUrl)??"",a=Mo(t),i=Io(n,a.map(o=>o.value));return Uo(i),{baseUrl:n,options:i,presetOptions:a}}emit(){for(const t of this.listeners)t()}}const qt=new Oo;function ko(e){return f.useSyncExternalStore(qt.subscribe,()=>e(qt.getState()))}function hs(e,t){return t.includes(e)?e:wn}function ps(){return wn}function Ao(e,t){const r=$n(e);if(!r)return null;const n=t==null?void 0:t.relayTunnel,a=(n==null?void 0:n.provider)==="codingns_relay"&&n.tunnelDomain===r.tunnelDomain&&n.controlBaseUrl===r.controlBaseUrl,i=((n==null?void 0:n.candidateEndpoints)??[]).filter(o=>o.kind!=="relay");return{provider:"codingns_relay",enabled:!0,tunnelDomain:r.tunnelDomain,controlBaseUrl:r.controlBaseUrl,bindingId:a?(n==null?void 0:n.bindingId)??null:null,hostFingerprint:a?(n==null?void 0:n.hostFingerprint)??null:null,candidateEndpoints:[{endpointId:`relay-entry:${r.relayBaseUrl}`,kind:"relay",url:r.relayBaseUrl,priority:0,expiresAt:null,source:"user_saved"},...i]}}const Fo={login(e,t){return _t.login(e,t)},bootstrap(e,t,r){return _t.bootstrap(e,t,r)},refresh(){return _t.refresh()},logout(){_t.clear()}},Vo=f.lazy(async()=>({default:(await z(()=>import("./ServerSettingsModal-CyhMgk10.js"),__vite__mapDeps([2,3,4,5,6,7]))).ServerSettingsModal})),Wr="width=device-width, initial-scale=1.0, viewport-fit=cover",Bo="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function zo(){const e=f.useRef(null);return f.useEffect(()=>{const t=e.current;if(!t)return;const r=t.getContext("2d");if(!r)return;let n;const a=()=>{o(),l()};let i=[];const o=()=>{t.width=window.innerWidth,t.height=window.innerHeight},l=()=>{i=[];const d=Math.min(50,Math.floor(t.width*t.height/25e3));for(let m=0;m<d;m++)i.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},c=()=>{r.clearRect(0,0,t.width,t.height),i.forEach((d,m)=>{d.x+=d.vx,d.y+=d.vy,d.x<0&&(d.x=t.width),d.x>t.width&&(d.x=0),d.y<0&&(d.y=t.height),d.y>t.height&&(d.y=0),r.beginPath(),r.arc(d.x,d.y,d.size,0,Math.PI*2),r.fillStyle=`rgba(10, 132, 255, ${d.opacity})`,r.fill(),i.slice(m+1).forEach(g=>{const w=d.x-g.x,b=d.y-g.y,P=Math.sqrt(w*w+b*b);P<150&&(r.beginPath(),r.moveTo(d.x,d.y),r.lineTo(g.x,g.y),r.strokeStyle=`rgba(10, 132, 255, ${.1*(1-P/150)})`,r.stroke())})}),n=requestAnimationFrame(c)};return o(),l(),c(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(n)}},[]),p.jsx("canvas",{ref:e,className:"particle-canvas"})}function Ho({text:e}){return p.jsx("span",{className:"glitch-text","data-text":e,children:e})}function Wo({text:e}){const[t,r]=f.useState(""),[n,a]=f.useState(!0);return f.useEffect(()=>{let i=0,o=null;const l=setInterval(()=>{i<=e.length?(r(e.slice(0,i)),i++):(clearInterval(l),o=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(l),o!==null&&window.clearTimeout(o)}},[e]),p.jsxs("span",{className:"typewriter-text",children:[t,n&&p.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function $o(e){const t=e==null?void 0:e.captcha;if(typeof t!="object"||t===null)return null;const r=t.captchaId,n=t.imageDataUrl;return typeof r!="string"||typeof n!="string"?null:{captchaId:r,imageDataUrl:n}}function Ko(){const e=ir(),t=Yn(),[r]=Fi(),n=gt(),a=mo(),i=He(k=>Gn(k)),o=Jn(n.platform),l=f.useMemo(()=>qn(n),[n]),c=f.useMemo(()=>l?Xn(i):{credentials:null,legacyServerBaseUrl:null},[i,l]),d=c.credentials,m=c.legacyServerBaseUrl,[g,w]=f.useState(()=>(d==null?void 0:d.username)??"admin"),[b,P]=f.useState(()=>(d==null?void 0:d.password)??""),[E,D]=f.useState(null),[F,L]=f.useState(""),[G,ee]=f.useState(()=>!!d),K=ko(k=>k.baseUrl),[me,v]=f.useState(K),[j,V]=f.useState(null),[M,ne]=f.useState(!1),[q,oe]=f.useState(!1),[ae,se]=f.useState(null),[Ke,Ye]=f.useState(!1),Z=Wt(k=>k.session),Te=f.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:Ce}=oo(),xe=f.useRef(!1),ue=n.isNativeMobile,De=f.useMemo(()=>Ce==="light"?"light":"dark",[Ce]);f.useEffect(()=>{w((d==null?void 0:d.username)??"admin"),P((d==null?void 0:d.password)??""),D(null),L(""),ee(!!d)},[d]),f.useEffect(()=>{if(typeof document>"u")return;const k=document.querySelector('meta[name="viewport"]');if(!(k instanceof HTMLMetaElement))return;const fe=k.getAttribute("content")??Wr;return ue?k.setAttribute("content",Bo):k.setAttribute("content",Wr),()=>{k.setAttribute("content",fe)}},[ue]),f.useEffect(()=>{xe.current||(xe.current=!0,!(!l||!m||m===K)&&(qt.setBaseUrl(m),v(m)))},[K,l,m]),f.useEffect(()=>{if(Z){e(Te,{replace:!0});return}if(!me)return;let k=!1;const fe=window.setTimeout(()=>{z(async()=>{const{probeHost:W}=await import("./index-BilHJjYU.js").then(ye=>ye.ae);return{probeHost:W}},__vite__mapDeps([3,4])).then(({probeHost:W})=>W(me)).then(W=>{k||(W.demoMode&&(Ye(!0),Qn()&&V(t("auth.demoSessionExpired"))),W.reachable&&!W.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{k||V(t("auth.authUnavailable"))})},0);return()=>{k=!0,window.clearTimeout(fe)}},[Z,e,me,Te,t]);async function Oe(k){k.preventDefault(),ne(!0),V(null),v(K),l&&!G&&i&&Zn(i);try{const fe=E?{username:g,password:b,captchaId:E.captchaId,captchaCode:F}:{username:g,password:b};await Fo.login(fe,K),D(null),L("");const{userPreferenceStore:W}=await z(async()=>{const{userPreferenceStore:ye}=await import("./index-BilHJjYU.js").then(yt=>yt.ad);return{userPreferenceStore:ye}},__vite__mapDeps([3,4]));await W.refreshForAuthenticatedUser(),l&&G&&i&&ea({hostId:i,username:g,password:b}),e(Te,{replace:!0})}catch(fe){if(fe instanceof ta){if(fe.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}const W=$o(fe.data);W?(D(W),L("")):fe.errorCode==="INVALID_CREDENTIALS"&&(D(null),L("")),V(fe.message)}else V(t("auth.authUnavailable"))}finally{ne(!1)}}function de(k){w(k),d!=null&&d.username&&k.trim()!==d.username&&(P(""),ee(!1)),E&&(D(null),L(""))}function Ee(k){v(k),V(null)}const ve="login-username",ke="login-password",vt="login-captcha";return p.jsxs("main",{className:"cyber-login-page","data-theme":De,"data-native-mobile":ue?"true":"false",children:[p.jsxs("div",{className:"cyber-bg",children:[p.jsx("div",{className:"cyber-grid"}),p.jsx("div",{className:"cyber-glow cyber-glow-1"}),p.jsx("div",{className:"cyber-glow cyber-glow-2"}),p.jsx(zo,{})]}),p.jsx("div",{className:"scanlines"}),p.jsxs("div",{className:"cyber-login-container",children:[p.jsx("div",{className:"cyber-login-toolbar",children:p.jsx(oa,{variant:"compact"})}),p.jsxs("div",{className:"cyber-login-content",children:[p.jsxs("div",{className:"cyber-brand",children:[p.jsx("div",{className:"cyber-logo",children:p.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),p.jsx("h1",{className:"cyber-brand-title",children:p.jsx(Ho,{text:"CodingNS"})}),p.jsx("p",{className:"cyber-brand-subtitle",children:p.jsx(Wo,{text:t("auth.loginSubtitle")})})]}),p.jsxs("div",{className:"cyber-card",children:[p.jsx("div",{className:"cyber-corner corner-tl"}),p.jsx("div",{className:"cyber-corner corner-tr"}),p.jsx("div",{className:"cyber-corner corner-bl"}),p.jsx("div",{className:"cyber-corner corner-br"}),p.jsxs("div",{className:"cyber-card-header",children:[p.jsx("div",{className:"cyber-line"}),p.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),p.jsx("div",{className:"cyber-line"})]}),Ke?p.jsxs("div",{className:"cyber-demo-banner",children:[p.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),p.jsx("span",{children:t("auth.demoBanner")})]}):null,p.jsxs("form",{className:"cyber-form",onSubmit:Oe,children:[p.jsxs("div",{className:`cyber-field ${ae==="username"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:ve,children:[p.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),p.jsx("input",{id:ve,"aria-label":t("auth.username"),className:"cyber-input",value:g,onChange:k=>de(k.target.value),onFocus:()=>se("username"),onBlur:()=>se(null),autoComplete:"username"})]}),p.jsxs("div",{className:`cyber-field ${ae==="password"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:ke,children:[p.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),p.jsx("input",{id:ke,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:b,onChange:k=>P(k.target.value),onFocus:()=>se("password"),onBlur:()=>se(null),autoComplete:"current-password"})]}),E?p.jsxs("div",{className:"cyber-captcha-panel",children:[p.jsx("img",{alt:t("auth.captchaImageAlt"),className:"cyber-captcha-image",draggable:!1,src:E.imageDataUrl}),p.jsx("p",{className:"cyber-captcha-hint",children:t("auth.captchaHint")}),p.jsxs("div",{className:`cyber-field ${ae==="captcha"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:vt,children:[p.jsx("span",{className:"cyber-field-icon",children:"#"}),t("auth.captcha")]}),p.jsx("input",{id:vt,"aria-label":t("auth.captcha"),className:"cyber-input",placeholder:t("auth.captchaPlaceholder"),value:F,onChange:k=>L(k.target.value),onFocus:()=>se("captcha"),onBlur:()=>se(null),autoComplete:"one-time-code"})]})]}):null,l?p.jsxs("label",{className:"cyber-remember-toggle",children:[p.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:G,onChange:k=>ee(k.target.checked)}),p.jsx("span",{children:t("auth.rememberPassword")})]}):null,j?p.jsxs("div",{className:"cyber-status","data-tone":"error",children:[p.jsx("span",{className:"cyber-status-icon",children:"⚠"}),p.jsx("span",{children:j})]}):null,p.jsxs("button",{className:`cyber-submit ${M?"loading":""}`,type:"submit",disabled:M,children:[p.jsx("span",{className:"cyber-submit-glow"}),p.jsx("span",{className:"cyber-submit-border"}),p.jsx("span",{className:"cyber-submit-text",children:M?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),o?p.jsxs("div",{className:"cyber-footer",children:[p.jsxs("div",{className:"cyber-divider",children:[p.jsx("span",{className:"cyber-divider-line"}),p.jsx("span",{className:"cyber-divider-text",children:"//"}),p.jsx("span",{className:"cyber-divider-line"})]}),p.jsxs("button",{className:"cyber-server-btn",onClick:()=>oe(!0),type:"button",children:[p.jsx("span",{className:"cyber-server-icon",children:"⚙"}),p.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),p.jsx("span",{className:"cyber-server-current",children:K})]})]}):null]})]}),p.jsxs("div",{className:"cyber-version",children:[p.jsxs("span",{className:"cyber-version-text",children:["v",a]}),p.jsx("span",{className:"cyber-version-divider",children:"|"}),p.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),o&&q?p.jsx(f.Suspense,{fallback:null,children:p.jsx(Vo,{isOpen:q,onClose:()=>oe(!1),onSave:Ee})}):null]})}function Sn(){return p.jsx("main",{className:"page-center app-shell",children:p.jsxs("section",{className:"auth-card surface-card",children:[p.jsx("h1",{children:le("auth.trustedEntryOnlyTitle")}),p.jsx("p",{className:"status-text",children:le("auth.trustedEntryOnlyDescription")}),p.jsxs("div",{className:"field-group",children:[p.jsx("span",{children:le("auth.trustedEntryOnlyHintTitle")}),p.jsx("span",{className:"auth-server-value",children:le("auth.trustedEntryOnlyHint")})]})]})})}function Yo({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function Go(){return!1}function Rn(e,t,r=Go()){var i,o;if(!r||t!=="web")return!1;const n=Dt(e),a=n==null?void 0:n.relayTunnel;return!(a!=null&&a.enabled&&((i=a.tunnelDomain)!=null&&i.trim())&&((o=a.controlBaseUrl)!=null&&o.trim()))}function Jo({runtimeKey:e,children:t}){return p.jsx("div",{children:t},e)}function qo(){const e=ra();return p.jsx(Jo,{runtimeKey:e,children:p.jsx(Ei,{})})}function Xo(){const e=He(i=>i),t=gt(),r=Wt(i=>i.session),n=Wt(i=>i.sessionReady),a=mt();if(Rn(e,t.platform))return p.jsx(Sn,{});if(!r){const i=`${a.pathname}${a.search}`;return p.jsx(dn,{to:`/login?returnTo=${encodeURIComponent(i)}`,replace:!0})}return n?p.jsx(qo,{}):p.jsx("div",{children:le("common.loading")})}function Qo(){const e=He(r=>r),t=gt();return Rn(e,t.platform)?p.jsx(Sn,{}):p.jsx(Ko,{})}function $r(){const e=gt(),t=Yo(e);return p.jsx(dn,{to:t==="mobile"?"/workspaces":"/landing",replace:!0})}function Y(e,t){return async()=>({Component:(await e())[t]})}const Zo=[{path:"/bootstrap",lazy:Y(()=>z(()=>import("./BootstrapPage-Bp0KfySv.js"),__vite__mapDeps([8,3,4])),"BootstrapPage")},{path:"/login",element:p.jsx(Qo,{})},{path:"/connect/:tunnelDomain",lazy:Y(()=>z(()=>import("./RelayConnectEntryPage-xL_IPH8a.js"),__vite__mapDeps([9,3,4,5])),"RelayConnectEntryPage")},{path:"/desktop-window-preview",lazy:Y(()=>z(()=>import("./DesktopDetachPreviewPage-DlDSb_tf.js"),__vite__mapDeps([10,3,4])),"DesktopDetachPreviewPage")},{path:"/",element:p.jsx(Xo,{}),children:[{path:"desktop-window/:windowId",lazy:Y(()=>z(()=>import("./DesktopWindowPage-CacXiWjV.js"),__vite__mapDeps([11,3,4,12,13,0,1,14,7,5,6,15,16,17,18,19])),"DesktopWindowPage")},{lazy:Y(()=>z(()=>import("./WorkbenchShellRoute-D3l4aWJS.js"),__vite__mapDeps([20,3,4,12,13,0,1,14,7,5,6,15,16,21])),"WorkbenchShellRoute"),children:[{index:!0,element:p.jsx($r,{})},{path:"landing",lazy:Y(()=>z(()=>import("./WorkbenchLandingPage-D51QCU_u.js"),__vite__mapDeps([22,3,4,12,13,0,1,14,7,5,6,15,16])),"WorkbenchLandingPage")},{path:"workspaces",lazy:Y(()=>z(()=>import("./WorkspaceHomePage-CEy4ShCu.js"),__vite__mapDeps([23,3,4,12,13,0,1,14,7,5,6,15,16,24,25])),"WorkspaceHomePage")},{path:"workspaces/:workspaceId",lazy:Y(()=>z(()=>import("./WorkspaceDetailPage-CKxTbPKh.js"),__vite__mapDeps([26,3,4,12,13,0,1,14,7,5,6,15,16,27,25])),"WorkspaceDetailPage")},{path:"workspaces/:workspaceId/debug",lazy:Y(()=>z(()=>import("./WorkspaceDebugDetailPage-CMjNLqFq.js"),__vite__mapDeps([28,3,4,27,12,13,0,1,14,7,5,6,15,16])),"WorkspaceDebugDetailPage")},{path:"workspaces/:workspaceId/sessions",lazy:Y(()=>z(()=>import("./SessionIndexPage-CVEz50tc.js"),__vite__mapDeps([29,3,4,12,13,0,1,14,7,5,6,15,16,25,30,31])),"SessionIndexPage")},{path:"workspaces/:workspaceId/sessions/:sessionId",lazy:Y(()=>z(()=>import("./ConversationPage-BCrNml1k.js"),__vite__mapDeps([32,3,4,7,13,12,0,1,14,5,6,15,16,17,18,19,30,31])),"ConversationPage")},{path:"documents",element:null},{path:"workbench",element:null},{path:"workspaces/:workspaceId/chats",lazy:Y(()=>z(()=>import("./PureConversationPage-DP1X7Hix.js"),__vite__mapDeps([33,3,4,12,13,0,1,14,7,5,6,15,16])),"PureConversationPage")},{path:"workspaces/:workspaceId/chats/new",lazy:Y(()=>z(()=>import("./PureConversationPage-DP1X7Hix.js"),__vite__mapDeps([33,3,4,12,13,0,1,14,7,5,6,15,16])),"PureConversationPage")},{path:"workspaces/:workspaceId/chats/:chatId",lazy:Y(()=>z(()=>import("./PureConversationPage-DP1X7Hix.js"),__vite__mapDeps([33,3,4,12,13,0,1,14,7,5,6,15,16])),"PureConversationPage")},{path:"workspaces/:workspaceId/tools",lazy:Y(()=>z(()=>import("./ToolsHomePage-s4zH7D9M.js"),__vite__mapDeps([34,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolsHomePage")},{path:"workspaces/:workspaceId/tools/files",lazy:Y(()=>z(()=>import("./ToolFilesPage-BospXumK.js"),__vite__mapDeps([35,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolFilesPage")},{path:"workspaces/:workspaceId/tools/git",lazy:Y(()=>z(()=>import("./ToolGitPage-B2zOeCAD.js"),__vite__mapDeps([36,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolGitPage")},{path:"workspaces/:workspaceId/tools/processes",lazy:Y(()=>z(()=>import("./ToolProcessesPage-BDShao4b.js"),__vite__mapDeps([37,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolProcessesPage")},{path:"workspaces/:workspaceId/terminals",lazy:Y(()=>z(()=>import("./WorkbenchLayout-Bo2BbMY6.js").then(e=>e.ct),__vite__mapDeps([12,3,4,13,0,1,14,7,5,6,15,16])),"TerminalPage")},{path:"workspaces/:workspaceId/plugins",lazy:Y(()=>z(()=>import("./PluginsListPage-DAECNoN6.js"),__vite__mapDeps([38,3,4,13,39])),"PluginsListPage")},{path:"workspaces/:workspaceId/plugins/:pluginId",lazy:Y(()=>z(()=>import("./PluginDetailPage-Djv_swcO.js"),__vite__mapDeps([40,3,4,13,39,41,42])),"PluginDetailPage")},{path:"workspaces/:workspaceId/plugins/:pluginId/run",lazy:Y(()=>z(()=>import("./PluginContainerPage-BKwCIs4r.js"),__vite__mapDeps([43,3,4,13,39,7,15,42])),"PluginContainerPage")},{path:"workspaces/:workspaceId/butler",lazy:Y(()=>z(()=>import("./AdaptiveButlerPage-BYETYaIe.js"),__vite__mapDeps([44,3,4,12,13,0,1,14,7,5,6,15,16,24])),"AdaptiveButlerPage")},{path:"settings",lazy:Y(()=>z(()=>import("./SettingsPage-CQNCrgaj.js"),__vite__mapDeps([45,3,4,12,13,0,1,14,7,5,6,15,16,39,41,42])),"SettingsPage")},{path:"settings/:section",lazy:Y(()=>z(()=>import("./SettingsPage-CQNCrgaj.js"),__vite__mapDeps([45,3,4,12,13,0,1,14,7,5,6,15,16,39,41,42])),"SettingsPage")},{path:"*",element:p.jsx($r,{})}]}]}];function es(){return Ti(Zo)}function ts(){const e=Qe(r=>r.profile.language),t=f.useMemo(()=>es(),[]);return p.jsx(to,{children:p.jsx(po,{children:p.jsx(na,{language:e,children:p.jsx(lo,{children:p.jsxs(ho,{children:[p.jsx(Do,{}),p.jsx(Oi,{router:t})]})})})})})}const ms=Object.freeze(Object.defineProperty({__proto__:null,App:ts},Symbol.toStringTag,{value:"Module"}));export{ht as A,hs as B,ps as C,qt as D,ms as E,oa as L,dn as N,Ei as O,to as P,lo as T,ko as a,Fo as b,as as c,Fi as d,gt as e,ss as f,Gr as g,mt as h,Bi as i,vo as j,So as k,ls as l,cs as m,Ro as n,us as o,To as p,ds as q,Yo as r,fs as s,Po as t,ir as u,mo as v,oo as w,is as x,os as y,Er as z};
|
|
30
|
+
*/function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},It.apply(this,arguments)}function Jt(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function _i(e,t){let r=Jt(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const Pi="6";try{window.__reactRouterVersion=Pi}catch{}function Ti(e,t){return Va({basename:void 0,future:It({},void 0,{v7_prependBasename:!0}),history:ca({window:void 0}),hydrationData:Ci(),routes:e,mapRouteProperties:Ri,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function Ci(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=It({},t,{errors:Di(t.errors)})),t}function Di(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&a.__type==="RouteErrorResponse")r[n]=new Nt(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let o=new i(a.message);o.stack="",r[n]=o}catch{}}if(r[n]==null){let i=new Error(a.message);i.stack="",r[n]=i}}else r[n]=a;return r}const Li=f.createContext({isTransitioning:!1}),Ni=f.createContext(new Map),ji="startTransition",Ar=Hn[ji],Ii="flushSync",Fr=la[Ii];function Mi(e){Ar?Ar(e):e()}function ot(e){Fr?Fr(e):e()}class Ui{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function Oi(e){let{fallbackElement:t,router:r,future:n}=e,[a,i]=f.useState(r.state),[o,l]=f.useState(),[c,d]=f.useState({isTransitioning:!1}),[m,g]=f.useState(),[w,b]=f.useState(),[P,E]=f.useState(),D=f.useRef(new Map),{v7_startTransition:F}=n||{},L=f.useCallback(j=>{F?Mi(j):j()},[F]),G=f.useCallback((j,V)=>{let{deletedFetchers:M,flushSync:ne,viewTransitionOpts:q}=V;j.fetchers.forEach((ae,se)=>{ae.data!==void 0&&D.current.set(se,ae.data)}),M.forEach(ae=>D.current.delete(ae));let oe=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!q||oe){ne?ot(()=>i(j)):L(()=>i(j));return}if(ne){ot(()=>{w&&(m&&m.resolve(),w.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:q.currentLocation,nextLocation:q.nextLocation})});let ae=r.window.document.startViewTransition(()=>{ot(()=>i(j))});ae.finished.finally(()=>{ot(()=>{g(void 0),b(void 0),l(void 0),d({isTransitioning:!1})})}),ot(()=>b(ae));return}w?(m&&m.resolve(),w.skipTransition(),E({state:j,currentLocation:q.currentLocation,nextLocation:q.nextLocation})):(l(j),d({isTransitioning:!0,flushSync:!1,currentLocation:q.currentLocation,nextLocation:q.nextLocation}))},[r.window,w,m,D,L]);f.useLayoutEffect(()=>r.subscribe(G),[r,G]),f.useEffect(()=>{c.isTransitioning&&!c.flushSync&&g(new Ui)},[c]),f.useEffect(()=>{if(m&&o&&r.window){let j=o,V=m.promise,M=r.window.document.startViewTransition(async()=>{L(()=>i(j)),await V});M.finished.finally(()=>{g(void 0),b(void 0),l(void 0),d({isTransitioning:!1})}),b(M)}},[L,o,m,r.window]),f.useEffect(()=>{m&&o&&a.location.key===o.location.key&&m.resolve()},[m,w,a.location,o]),f.useEffect(()=>{!c.isTransitioning&&P&&(l(P.state),d({isTransitioning:!0,flushSync:!1,currentLocation:P.currentLocation,nextLocation:P.nextLocation}),E(void 0))},[c.isTransitioning,P]),f.useEffect(()=>{},[]);let ee=f.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:j=>r.navigate(j),push:(j,V,M)=>r.navigate(j,{state:V,preventScrollReset:M==null?void 0:M.preventScrollReset}),replace:(j,V,M)=>r.navigate(j,{replace:!0,state:V,preventScrollReset:M==null?void 0:M.preventScrollReset})}),[r]),K=r.basename||"/",me=f.useMemo(()=>({router:r,navigator:ee,static:!1,basename:K}),[r,ee,K]),v=f.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return f.useEffect(()=>xi(n,r.future),[n,r.future]),f.createElement(f.Fragment,null,f.createElement(Ut.Provider,{value:me},f.createElement(an.Provider,{value:a},f.createElement(Ni.Provider,{value:D.current},f.createElement(Li.Provider,{value:c},f.createElement(Si,{basename:K,location:a.location,navigationType:a.historyAction,navigator:ee,future:v},a.initialized||r.future.v7_partialHydration?f.createElement(ki,{routes:r.routes,future:r.future,state:a}):t))))),null)}const ki=f.memo(Ai);function Ai(e){let{routes:t,future:r,state:n}=e;return ci(t,void 0,n,r)}var Vr;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Vr||(Vr={}));var Br;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Br||(Br={}));function Fi(e){let t=f.useRef(Jt(e)),r=f.useRef(!1),n=mt(),a=f.useMemo(()=>_i(n.search,r.current?null:t.current),[n.search]),i=ir(),o=f.useCallback((l,c)=>{const d=Jt(typeof l=="function"?l(a):l);r.current=!0,i("?"+d,c)},[i,a]);return[a,o]}let Ht=null;function st(){return be().bridge}function Vi(){return{runtime:{isAvailable(){return st().supported},getPlatformInfo(){return st().getPlatformInfo()}},fs:{openFile(e){return st().openLocalFile(e)},revealInFileManager(e){return st().revealInFileManager(e)},pickDirectory(){return st().pickDirectory()}}}}function Bi(){return Ht||(Ht=Vi()),Ht}function zi(){if(typeof window>"u"||window.self!==window.top)return;const e=Bi();window.__CODINGNS_DESKTOP_BRIDGE_INSTALLED__=!0,Object.defineProperty(window,"CodingNSDesktop",{configurable:!0,writable:!1,value:e})}const Hi="desktop://window-lifecycle",Wi=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function $i(e){return e instanceof HTMLInputElement?!Wi.has(e.type.toLowerCase()):!1}function Ki(e){const t=e.activeElement;if($i(t)||t instanceof HTMLTextAreaElement){const r=t.selectionStart??0,n=t.selectionEnd??r;return n<=r?null:t.value.slice(r,n)}return null}function Yi(e){const t=Ki(e);if(t!==null)return t;const r=e.getSelection();if(!r||r.isCollapsed)return null;const n=r.toString();return n.length>0?n:null}function Gi(e,t){var a;const r=(a=e.execCommand)==null?void 0:a.bind(e);if(typeof r!="function")return!1;const n=e.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.opacity="0",e.body.append(n),n.select();try{return r("copy")}catch{return!1}finally{n.remove()}}async function Ji(e,t,r){var a,i;try{if(await r(t))return}catch{}const n=(a=e.defaultView)==null?void 0:a.navigator;if((i=n==null?void 0:n.clipboard)!=null&&i.writeText)try{await n.clipboard.writeText(t);return}catch{}Gi(e,t)}function qi(e){const{window:t,document:r,writeClipboardText:n}=e;function a(i){if(i.defaultPrevented||!i.metaKey||i.ctrlKey||i.altKey||i.key.toLowerCase()!=="c")return;const o=Yi(r);o&&(i.preventDefault(),Ji(r,o,n))}return t.addEventListener("keydown",a,!0),()=>{t.removeEventListener("keydown",a,!0)}}const fn=f.createContext(null),Xi=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function Qi(e){if(typeof document>"u")return;const{documentElement:t,body:r}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),r&&(r.dataset.runtimePlatform=e.platform,r.dataset.osFamily=e.ui.osFamily,r.dataset.windowControls=e.ui.windowControlsStyle,r.dataset.viewportClass=e.viewportClass,r.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function qt(){var e;if(!(typeof document>"u"))for(const t of Xi)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function Zi(e){if(typeof document>"u")return;if(!e){qt();return}const t=[document.documentElement,document.body].filter(n=>!!n),r=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const n of t)for(const[a,i]of r)n.style.setProperty(a,i)}function eo(){if(!(typeof window>"u"))return window.innerWidth}function to({children:e}){const[t,r]=f.useState(()=>eo()),n=f.useMemo(()=>be({viewportWidth:t}),[t]);return f.useEffect(()=>{zi()},[]),f.useEffect(()=>{if(typeof window>"u")return;function a(){r(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),f.useEffect(()=>{Qi(n)},[n]),f.useEffect(()=>{if(!(typeof window>"u"||typeof document>"u")&&!(!n.isDesktop||n.ui.osFamily!=="macos"||!n.bridge.supported))return qi({window,document,writeClipboardText:async a=>(await n.bridge.writeClipboardText(a)).ok})},[n]),f.useEffect(()=>()=>{qt()},[]),f.useEffect(()=>{let a=!1,i=null;return!n.isDesktop||!n.bridge.supported?()=>{a=!0}:(z(()=>import("./event-DvH9tcej.js").then(o=>o.c),[]).then(async({listen:o})=>{const l=await o(Hi,c=>{const d=c.payload,m=d==null?void 0:d.descriptor;m!=null&&m.windowId&&(n.windows.registerDescriptor(m),d.isOpen?n.windows.markWindowOpen(m.windowId):n.windows.markWindowClosed(m.windowId))});if(a){l();return}i=l}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),f.useEffect(()=>{let a=!1,i=null;async function o(){var c,d;const l=await n.bridge.getRuntimeInfo();a||Zi(l.ok?(d=(c=l.value)==null?void 0:c.windowChrome)==null?void 0:d.macosTitlebar:null)}return!n.isDesktop||n.ui.osFamily!=="macos"||!n.ui.prefersOverlayTitlebar?(qt(),()=>{a=!0}):(o(),z(()=>import("./window-BVUB8gMK.js").then(l=>l.w),__vite__mapDeps([0,1])).then(async({getCurrentWindow:l})=>{const c=await l().onScaleChanged(()=>{o()});if(a){c();return}i=c}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),p.jsx(fn.Provider,{value:n,children:e})}function gt(){return f.useContext(fn)??be()}const is=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function os(e){return le(e.labelKey)}function ro(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function hn(e,t){return t?ro():e}function no(){const{theme:e,autoTheme:t}=Wn.getState().profile;return hn(e,t)}function ao(e){Qt({theme:e,autoTheme:!1}).catch(()=>{})}function io(e){Qt({autoTheme:e}).catch(()=>{})}function pn(e){typeof window>"u"||document.documentElement.setAttribute("data-theme",e)}function oo(){const e=Qe(n=>n.profile.theme),t=Qe(n=>n.profile.autoTheme);return{theme:hn(e,t),selectedTheme:e,autoTheme:t,setTheme:ao,setAutoTheme:io}}function so(){pn(no())}function lo({children:e}){const t=Qe(n=>n.profile.theme),r=Qe(n=>n.profile.autoTheme);return f.useEffect(()=>{so()},[t,r]),f.useEffect(()=>{if(!r||typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{pn(n.matches?"dark":"light")};return a(),typeof n.addEventListener=="function"?(n.addEventListener("change",a),()=>n.removeEventListener("change",a)):(n.addListener(a),()=>n.removeListener(a))},[r]),p.jsx(p.Fragment,{children:e})}const co={showToast:()=>"",dismissToast:()=>{}},mn=f.createContext(co);function uo(){return`toast-${Math.random().toString(36).slice(2,10)}`}function fo({toast:e,onDismiss:t}){const{id:r,title:n,description:a,tone:i,durationMs:o,action:l}=e;return f.useEffect(()=>{if(o===null)return;const c=window.setTimeout(()=>{t(r)},o);return()=>{window.clearTimeout(c)}},[o,r,t,n,a,i]),p.jsxs("article",{className:"toast-card","data-tone":i,role:i==="error"?"alert":"status",children:[p.jsxs("div",{className:"toast-body",children:[p.jsx("strong",{className:"toast-title",children:n}),a?p.jsx("p",{className:"toast-description",children:a}):null]}),p.jsxs("div",{className:"toast-actions",children:[l?p.jsx("button",{className:"toast-action",type:"button",onClick:()=>{l.onClick(),t(r)},children:l.label}):null,p.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(r),children:"×"})]})]})}function ho({children:e}){const[t,r]=f.useState([]),n=f.useCallback(o=>{r(l=>l.filter(c=>c.id!==o))},[]),a=f.useCallback(o=>{const l=o.id??uo(),c={id:l,title:o.title,description:o.description,tone:o.tone??"info",durationMs:o.durationMs===void 0?4200:o.durationMs,action:o.action};return r(d=>{const m=d.findIndex(w=>w.id===l);if(m===-1)return[...d,c];const g=[...d];return g[m]=c,g}),l},[]),i=f.useMemo(()=>({showToast:a,dismissToast:n}),[n,a]);return p.jsxs(mn.Provider,{value:i,children:[e,p.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(o=>p.jsx(fo,{toast:o,onDismiss:n},o.id))})]})}function ss(){return f.useContext(mn)}const Ct="1.0.0-beta.3",gn=f.createContext(Ct);function po({children:e}){const t=gt(),[r,n]=f.useState(Ct);return f.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(i=>{var l,c;if(a)return;const o=i.ok?(c=(l=i.value)==null?void 0:l.version)==null?void 0:c.trim():"";n(o||Ct)}),()=>{a=!0}):(n(Ct),()=>{a=!0})},[t]),p.jsx(gn.Provider,{value:r,children:e})}function mo(){return f.useContext(gn)}const zr={latestState:null,lastNotifiedVersion:null,pendingRestartVersion:null};class go{constructor(){_e(this,"state",zr);_e(this,"listeners",new Set);_e(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));_e(this,"getState",()=>this.state)}recordState(t){const r=Wt(this.state.pendingRestartVersion),n=Wt(t.currentVersion);this.state={latestState:t,lastNotifiedVersion:t.hasUpdate?this.state.lastNotifiedVersion:null,pendingRestartVersion:r&&r===n?null:this.state.pendingRestartVersion},this.emit()}markVersionNotified(t){this.state.lastNotifiedVersion!==t&&(this.state={...this.state,lastNotifiedVersion:t},this.emit())}markRestartPending(t){const r=Wt(t);!r||this.state.pendingRestartVersion===r||(this.state={...this.state,pendingRestartVersion:r},this.emit())}reset(){this.state=zr,this.emit()}emit(){for(const t of this.listeners)t()}}const Ze=new go;function Wt(e){const t=e==null?void 0:e.trim();return t||null}function vo(e){return f.useSyncExternalStore(Ze.subscribe,()=>e(Ze.getState()))}function yo(){return Ze.getState()}function wo(e){Ze.recordState(e)}function bo(e){Ze.markVersionNotified(e)}function xo(e){Ze.markRestartPending(e)}async function Eo(){const e=be(),t=he.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function So(e={}){const t=e.notify??"never",r=await Eo();return wo(r),await vn(r,t),r}async function vn(e,t){await _o(e,t)}async function Ro(){const e=be(),t=he.getState();return e.bridge.downloadUpdate(t.releaseChannel)}async function ls(){const e=be(),t=he.getState();return e.bridge.installUpdate(t.releaseChannel)}function cs(e){xo(e)}async function us(){var e;if(typeof window>"u"||typeof((e=window.__TAURI_INTERNALS__)==null?void 0:e.invoke)!="function")throw new Error("当前运行环境不支持桌面应用重启。");try{await window.__TAURI_INTERNALS__.invoke("restart_application")}catch(t){throw new Error(t instanceof Error?t.message:"重启应用失败。")}}async function _o(e,t){var i,o,l;if(!e.hasUpdate||t==="never")return;const r=((o=(i=e.manifest)==null?void 0:i.version)==null?void 0:o.trim())||e.currentVersion.trim();if(!r)return;const n=yo().lastNotifiedVersion;if(t==="always"||n!==r)try{(await be().bridge.showNotification(le("settings.releaseUpdateReady"),((l=e.manifest)==null?void 0:l.version)??e.currentVersion)).ok&&bo(r)}catch{}}async function ds(){return(await Mt.request("/api/client/host-version")).version}async function Po(){const e=he.getState();return Mt.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}async function fs(e){const t=he.getState();return Mt.request("/api/client/service-update/install",{method:"POST",body:JSON.stringify({packageName:e,channel:t.releaseChannel})})}async function hs(e){return Mt.request(`/api/client/service-update/tasks/${encodeURIComponent(e)}`)}async function To(e={}){const[t,r]=await Promise.allSettled([Po(),So(e)]);return{servicePackage:t.status==="fulfilled"?t.value.packages[0]??null:null,serviceError:t.status==="rejected"?Hr(t.reason):null,clientState:r.status==="fulfilled"?r.value:null,clientError:r.status==="rejected"?Hr(r.reason):null}}function Hr(e){return e instanceof Error&&e.message.trim()?e.message:"检查更新失败"}const Co=3600*1e3;function Do(){const e=He(i=>i.platform),t=He(i=>i.autoCheckUpdate),r=He(i=>i.autoDownloadUpdate),n=He(i=>i.releaseChannel),a=vo(i=>i.pendingRestartVersion);return f.useEffect(()=>{if(e!=="desktop"||!t||a)return;async function i(){await Lo(r)}i();const o=window.setInterval(()=>{i()},Co);return()=>{window.clearInterval(o)}},[t,r,a,e,n]),null}async function Lo(e){try{const t=await To({notify:"never"}),r=t.servicePackage,n=t.clientState,a=!!(r!=null&&r.hasUpdate&&!r.restartRequired),i=!!(n!=null&&n.hasUpdate&&n.manifest);if(e&&(n!=null&&n.hasUpdate)&&n.manifest){const o=await Ro();if(!o.ok)return;await be().bridge.showNotification(le("settings.releaseDownloadedNotificationTitle"),le("settings.releaseDownloadedNotificationBody",{version:o.version??n.manifest.version}));return}if(a&&i){await be().bridge.showNotification(le("settings.softwareUpdate"),le("settings.updateBothReady"));return}if(a){await be().bridge.showNotification(le("settings.serverUpdateReady"),`${le("settings.serverTargetVersion")}: ${(r==null?void 0:r.latestVersion)??"-"}`);return}i&&n&&await vn(n,"if-new")}catch{}}const yn="codingns.server.base-url.history",or=6,wn="__custom__";function bn(){return typeof window<"u"&&typeof window.localStorage<"u"}function xn(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function sr(e){if(!e)return null;try{return Kr(e)}catch{return null}}function En(){if(!bn())return[];const e=window.localStorage.getItem(yn);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?sr(r):null).filter(r=>!!r):[]}catch{return[]}}function No(e){const t=new Set,r=[];for(const n of e)!n||t.has(n)||(t.add(n),r.push(n));return r}function jo(e){const t=new Set,r=[];for(const n of e)!n||t.has(n.value)||(t.add(n.value),r.push(n));return r}function Io(e,t){const r=En();return No([e,...t,...r,sr(xn())]).slice(0,or)}function Mo(e){const t=Dt(e),r=En().map(l=>({value:l,source:"history"})),n=sr(xn()),a=e.hosts.map(l=>({value:l.baseUrl,source:"saved"})),i=Kn(e).map(l=>({value:l.baseUrl,source:"discovered"})),o=t?{value:t.baseUrl,source:Yr(t)?"discovered":"saved"}:null;return jo([o,...a,...i,...r,n?{value:n,source:"origin"}:null]).slice(0,or)}function Uo(e){bn()&&window.localStorage.setItem(yn,JSON.stringify(e.slice(0,or)))}class Oo{constructor(){_e(this,"state",this.createState(he.getState()));_e(this,"listeners",new Set);_e(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));_e(this,"getState",()=>this.state);he.subscribe(()=>{const t=this.createState(he.getState());t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((r,n)=>r===this.state.options[n])&&t.presetOptions.length===this.state.presetOptions.length&&t.presetOptions.every((r,n)=>{const a=this.state.presetOptions[n];return(a==null?void 0:a.value)===r.value&&(a==null?void 0:a.source)===r.source})||(this.state=t,this.emit())})}setBaseUrl(t){const r=he.getState(),n=Dt(r);if(!n)return!1;const a=Kr(t),i=a!==n.baseUrl,o=Ao(a,n);if(Yr(n))return he.updateRuntime({discoveredHosts:r.discoveredHosts.map(c=>c.id===n.id?{...c,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:c)}),this.state=this.createState(he.getState()),this.emit(),i;const l=r.hosts.map(c=>c.id===n.id?{...c,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:c);return this.state=this.createState({...r,hosts:l}),this.emit(),he.update({hosts:l}),i}reset(){this.state=this.createState(he.getState()),this.emit()}createState(t){const r=Dt(t),n=(r==null?void 0:r.baseUrl)??"",a=Mo(t),i=Io(n,a.map(o=>o.value));return Uo(i),{baseUrl:n,options:i,presetOptions:a}}emit(){for(const t of this.listeners)t()}}const Xt=new Oo;function ko(e){return f.useSyncExternalStore(Xt.subscribe,()=>e(Xt.getState()))}function ps(e,t){return t.includes(e)?e:wn}function ms(){return wn}function Ao(e,t){const r=$n(e);if(!r)return null;const n=t==null?void 0:t.relayTunnel,a=(n==null?void 0:n.provider)==="codingns_relay"&&n.tunnelDomain===r.tunnelDomain&&n.controlBaseUrl===r.controlBaseUrl,i=((n==null?void 0:n.candidateEndpoints)??[]).filter(o=>o.kind!=="relay");return{provider:"codingns_relay",enabled:!0,tunnelDomain:r.tunnelDomain,controlBaseUrl:r.controlBaseUrl,bindingId:a?(n==null?void 0:n.bindingId)??null:null,hostFingerprint:a?(n==null?void 0:n.hostFingerprint)??null:null,candidateEndpoints:[{endpointId:`relay-entry:${r.relayBaseUrl}`,kind:"relay",url:r.relayBaseUrl,priority:0,expiresAt:null,source:"user_saved"},...i]}}const Fo={login(e,t){return _t.login(e,t)},bootstrap(e,t,r){return _t.bootstrap(e,t,r)},refresh(){return _t.refresh()},logout(){_t.clear()}},Vo=f.lazy(async()=>({default:(await z(()=>import("./ServerSettingsModal-BJwYHdKD.js"),__vite__mapDeps([2,3,4,5,6,7]))).ServerSettingsModal})),Wr="width=device-width, initial-scale=1.0, viewport-fit=cover",Bo="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function zo(){const e=f.useRef(null);return f.useEffect(()=>{const t=e.current;if(!t)return;const r=t.getContext("2d");if(!r)return;let n;const a=()=>{o(),l()};let i=[];const o=()=>{t.width=window.innerWidth,t.height=window.innerHeight},l=()=>{i=[];const d=Math.min(50,Math.floor(t.width*t.height/25e3));for(let m=0;m<d;m++)i.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},c=()=>{r.clearRect(0,0,t.width,t.height),i.forEach((d,m)=>{d.x+=d.vx,d.y+=d.vy,d.x<0&&(d.x=t.width),d.x>t.width&&(d.x=0),d.y<0&&(d.y=t.height),d.y>t.height&&(d.y=0),r.beginPath(),r.arc(d.x,d.y,d.size,0,Math.PI*2),r.fillStyle=`rgba(10, 132, 255, ${d.opacity})`,r.fill(),i.slice(m+1).forEach(g=>{const w=d.x-g.x,b=d.y-g.y,P=Math.sqrt(w*w+b*b);P<150&&(r.beginPath(),r.moveTo(d.x,d.y),r.lineTo(g.x,g.y),r.strokeStyle=`rgba(10, 132, 255, ${.1*(1-P/150)})`,r.stroke())})}),n=requestAnimationFrame(c)};return o(),l(),c(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(n)}},[]),p.jsx("canvas",{ref:e,className:"particle-canvas"})}function Ho({text:e}){return p.jsx("span",{className:"glitch-text","data-text":e,children:e})}function Wo({text:e}){const[t,r]=f.useState(""),[n,a]=f.useState(!0);return f.useEffect(()=>{let i=0,o=null;const l=setInterval(()=>{i<=e.length?(r(e.slice(0,i)),i++):(clearInterval(l),o=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(l),o!==null&&window.clearTimeout(o)}},[e]),p.jsxs("span",{className:"typewriter-text",children:[t,n&&p.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function $o(e){const t=e==null?void 0:e.captcha;if(typeof t!="object"||t===null)return null;const r=t.captchaId,n=t.imageDataUrl;return typeof r!="string"||typeof n!="string"?null:{captchaId:r,imageDataUrl:n}}function Ko(){const e=ir(),t=Yn(),[r]=Fi(),n=gt(),a=mo(),i=He(k=>Gn(k)),o=Jn(n.platform),l=f.useMemo(()=>qn(n),[n]),c=f.useMemo(()=>l?Xn(i):{credentials:null,legacyServerBaseUrl:null},[i,l]),d=c.credentials,m=c.legacyServerBaseUrl,[g,w]=f.useState(()=>(d==null?void 0:d.username)??"admin"),[b,P]=f.useState(()=>(d==null?void 0:d.password)??""),[E,D]=f.useState(null),[F,L]=f.useState(""),[G,ee]=f.useState(()=>!!d),K=ko(k=>k.baseUrl),[me,v]=f.useState(K),[j,V]=f.useState(null),[M,ne]=f.useState(!1),[q,oe]=f.useState(!1),[ae,se]=f.useState(null),[Ke,Ye]=f.useState(!1),Z=$t(k=>k.session),Te=f.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:Ce}=oo(),xe=f.useRef(!1),ue=n.isNativeMobile,De=f.useMemo(()=>Ce==="light"?"light":"dark",[Ce]);f.useEffect(()=>{w((d==null?void 0:d.username)??"admin"),P((d==null?void 0:d.password)??""),D(null),L(""),ee(!!d)},[d]),f.useEffect(()=>{if(typeof document>"u")return;const k=document.querySelector('meta[name="viewport"]');if(!(k instanceof HTMLMetaElement))return;const fe=k.getAttribute("content")??Wr;return ue?k.setAttribute("content",Bo):k.setAttribute("content",Wr),()=>{k.setAttribute("content",fe)}},[ue]),f.useEffect(()=>{xe.current||(xe.current=!0,!(!l||!m||m===K)&&(Xt.setBaseUrl(m),v(m)))},[K,l,m]),f.useEffect(()=>{if(Z){e(Te,{replace:!0});return}if(!me)return;let k=!1;const fe=window.setTimeout(()=>{z(async()=>{const{probeHost:W}=await import("./index-BArTKWXk.js").then(ye=>ye.ae);return{probeHost:W}},__vite__mapDeps([3,4])).then(({probeHost:W})=>W(me)).then(W=>{k||(W.demoMode&&(Ye(!0),Qn()&&V(t("auth.demoSessionExpired"))),W.reachable&&!W.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{k||V(t("auth.authUnavailable"))})},0);return()=>{k=!0,window.clearTimeout(fe)}},[Z,e,me,Te,t]);async function Oe(k){k.preventDefault(),ne(!0),V(null),v(K),l&&!G&&i&&Zn(i);try{const fe=E?{username:g,password:b,captchaId:E.captchaId,captchaCode:F}:{username:g,password:b};await Fo.login(fe,K),D(null),L("");const{userPreferenceStore:W}=await z(async()=>{const{userPreferenceStore:ye}=await import("./index-BArTKWXk.js").then(yt=>yt.ad);return{userPreferenceStore:ye}},__vite__mapDeps([3,4]));await W.refreshForAuthenticatedUser(),l&&G&&i&&ea({hostId:i,username:g,password:b}),e(Te,{replace:!0})}catch(fe){if(fe instanceof ta){if(fe.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}const W=$o(fe.data);W?(D(W),L("")):fe.errorCode==="INVALID_CREDENTIALS"&&(D(null),L("")),V(fe.message)}else V(t("auth.authUnavailable"))}finally{ne(!1)}}function de(k){w(k),d!=null&&d.username&&k.trim()!==d.username&&(P(""),ee(!1)),E&&(D(null),L(""))}function Ee(k){v(k),V(null)}const ve="login-username",ke="login-password",vt="login-captcha";return p.jsxs("main",{className:"cyber-login-page","data-theme":De,"data-native-mobile":ue?"true":"false",children:[p.jsxs("div",{className:"cyber-bg",children:[p.jsx("div",{className:"cyber-grid"}),p.jsx("div",{className:"cyber-glow cyber-glow-1"}),p.jsx("div",{className:"cyber-glow cyber-glow-2"}),p.jsx(zo,{})]}),p.jsx("div",{className:"scanlines"}),p.jsxs("div",{className:"cyber-login-container",children:[p.jsx("div",{className:"cyber-login-toolbar",children:p.jsx(oa,{variant:"compact"})}),p.jsxs("div",{className:"cyber-login-content",children:[p.jsxs("div",{className:"cyber-brand",children:[p.jsx("div",{className:"cyber-logo",children:p.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),p.jsx("h1",{className:"cyber-brand-title",children:p.jsx(Ho,{text:"CodingNS"})}),p.jsx("p",{className:"cyber-brand-subtitle",children:p.jsx(Wo,{text:t("auth.loginSubtitle")})})]}),p.jsxs("div",{className:"cyber-card",children:[p.jsx("div",{className:"cyber-corner corner-tl"}),p.jsx("div",{className:"cyber-corner corner-tr"}),p.jsx("div",{className:"cyber-corner corner-bl"}),p.jsx("div",{className:"cyber-corner corner-br"}),p.jsxs("div",{className:"cyber-card-header",children:[p.jsx("div",{className:"cyber-line"}),p.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),p.jsx("div",{className:"cyber-line"})]}),Ke?p.jsxs("div",{className:"cyber-demo-banner",children:[p.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),p.jsx("span",{children:t("auth.demoBanner")})]}):null,p.jsxs("form",{className:"cyber-form",onSubmit:Oe,children:[p.jsxs("div",{className:`cyber-field ${ae==="username"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:ve,children:[p.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),p.jsx("input",{id:ve,"aria-label":t("auth.username"),className:"cyber-input",value:g,onChange:k=>de(k.target.value),onFocus:()=>se("username"),onBlur:()=>se(null),autoComplete:"username"})]}),p.jsxs("div",{className:`cyber-field ${ae==="password"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:ke,children:[p.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),p.jsx("input",{id:ke,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:b,onChange:k=>P(k.target.value),onFocus:()=>se("password"),onBlur:()=>se(null),autoComplete:"current-password"})]}),E?p.jsxs("div",{className:"cyber-captcha-panel",children:[p.jsx("img",{alt:t("auth.captchaImageAlt"),className:"cyber-captcha-image",draggable:!1,src:E.imageDataUrl}),p.jsx("p",{className:"cyber-captcha-hint",children:t("auth.captchaHint")}),p.jsxs("div",{className:`cyber-field ${ae==="captcha"?"focused":""}`,children:[p.jsx("div",{className:"cyber-field-border",children:p.jsx("div",{className:"cyber-field-border-glow"})}),p.jsxs("label",{className:"cyber-field-label",htmlFor:vt,children:[p.jsx("span",{className:"cyber-field-icon",children:"#"}),t("auth.captcha")]}),p.jsx("input",{id:vt,"aria-label":t("auth.captcha"),className:"cyber-input",placeholder:t("auth.captchaPlaceholder"),value:F,onChange:k=>L(k.target.value),onFocus:()=>se("captcha"),onBlur:()=>se(null),autoComplete:"one-time-code"})]})]}):null,l?p.jsxs("label",{className:"cyber-remember-toggle",children:[p.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:G,onChange:k=>ee(k.target.checked)}),p.jsx("span",{children:t("auth.rememberPassword")})]}):null,j?p.jsxs("div",{className:"cyber-status","data-tone":"error",children:[p.jsx("span",{className:"cyber-status-icon",children:"⚠"}),p.jsx("span",{children:j})]}):null,p.jsxs("button",{className:`cyber-submit ${M?"loading":""}`,type:"submit",disabled:M,children:[p.jsx("span",{className:"cyber-submit-glow"}),p.jsx("span",{className:"cyber-submit-border"}),p.jsx("span",{className:"cyber-submit-text",children:M?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),o?p.jsxs("div",{className:"cyber-footer",children:[p.jsxs("div",{className:"cyber-divider",children:[p.jsx("span",{className:"cyber-divider-line"}),p.jsx("span",{className:"cyber-divider-text",children:"//"}),p.jsx("span",{className:"cyber-divider-line"})]}),p.jsxs("button",{className:"cyber-server-btn",onClick:()=>oe(!0),type:"button",children:[p.jsx("span",{className:"cyber-server-icon",children:"⚙"}),p.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),p.jsx("span",{className:"cyber-server-current",children:K})]})]}):null]})]}),p.jsxs("div",{className:"cyber-version",children:[p.jsxs("span",{className:"cyber-version-text",children:["v",a]}),p.jsx("span",{className:"cyber-version-divider",children:"|"}),p.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),o&&q?p.jsx(f.Suspense,{fallback:null,children:p.jsx(Vo,{isOpen:q,onClose:()=>oe(!1),onSave:Ee})}):null]})}function Sn(){return p.jsx("main",{className:"page-center app-shell",children:p.jsxs("section",{className:"auth-card surface-card",children:[p.jsx("h1",{children:le("auth.trustedEntryOnlyTitle")}),p.jsx("p",{className:"status-text",children:le("auth.trustedEntryOnlyDescription")}),p.jsxs("div",{className:"field-group",children:[p.jsx("span",{children:le("auth.trustedEntryOnlyHintTitle")}),p.jsx("span",{className:"auth-server-value",children:le("auth.trustedEntryOnlyHint")})]})]})})}function Yo({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function Go(){return!1}function Rn(e,t,r=Go()){var i,o;if(!r||t!=="web")return!1;const n=Dt(e),a=n==null?void 0:n.relayTunnel;return!(a!=null&&a.enabled&&((i=a.tunnelDomain)!=null&&i.trim())&&((o=a.controlBaseUrl)!=null&&o.trim()))}function Jo({runtimeKey:e,children:t}){return p.jsx("div",{children:t},e)}function qo(){const e=ra();return p.jsx(Jo,{runtimeKey:e,children:p.jsx(Ei,{})})}function Xo(){const e=He(i=>i),t=gt(),r=$t(i=>i.session),n=$t(i=>i.sessionReady),a=mt();if(Rn(e,t.platform))return p.jsx(Sn,{});if(!r){const i=`${a.pathname}${a.search}`;return p.jsx(dn,{to:`/login?returnTo=${encodeURIComponent(i)}`,replace:!0})}return n?p.jsx(qo,{}):p.jsx("div",{children:le("common.loading")})}function Qo(){const e=He(r=>r),t=gt();return Rn(e,t.platform)?p.jsx(Sn,{}):p.jsx(Ko,{})}function $r(){const e=gt(),t=Yo(e);return p.jsx(dn,{to:t==="mobile"?"/workspaces":"/landing",replace:!0})}function Y(e,t){return async()=>({Component:(await e())[t]})}const Zo=[{path:"/bootstrap",lazy:Y(()=>z(()=>import("./BootstrapPage-3xpnsG-A.js"),__vite__mapDeps([8,3,4])),"BootstrapPage")},{path:"/login",element:p.jsx(Qo,{})},{path:"/connect/:tunnelDomain",lazy:Y(()=>z(()=>import("./RelayConnectEntryPage-cAVq_kNM.js"),__vite__mapDeps([9,3,4,5])),"RelayConnectEntryPage")},{path:"/desktop-window-preview",lazy:Y(()=>z(()=>import("./DesktopDetachPreviewPage-B77MG82y.js"),__vite__mapDeps([10,3,4])),"DesktopDetachPreviewPage")},{path:"/",element:p.jsx(Xo,{}),children:[{path:"desktop-window/:windowId",lazy:Y(()=>z(()=>import("./DesktopWindowPage-DbG-RBAf.js"),__vite__mapDeps([11,3,4,12,13,0,1,14,7,5,6,15,16,17,18,19])),"DesktopWindowPage")},{lazy:Y(()=>z(()=>import("./WorkbenchShellRoute-p1FvkoPN.js"),__vite__mapDeps([20,3,4,12,13,0,1,14,7,5,6,15,16,21])),"WorkbenchShellRoute"),children:[{index:!0,element:p.jsx($r,{})},{path:"landing",lazy:Y(()=>z(()=>import("./WorkbenchLandingPage-B4aooEYJ.js"),__vite__mapDeps([22,3,4,12,13,0,1,14,7,5,6,15,16])),"WorkbenchLandingPage")},{path:"workspaces",lazy:Y(()=>z(()=>import("./WorkspaceHomePage-DPPvwM93.js"),__vite__mapDeps([23,3,4,12,13,0,1,14,7,5,6,15,16,24,25])),"WorkspaceHomePage")},{path:"workspaces/:workspaceId",lazy:Y(()=>z(()=>import("./WorkspaceDetailPage-YM85dTGg.js"),__vite__mapDeps([26,3,4,12,13,0,1,14,7,5,6,15,16,27,25])),"WorkspaceDetailPage")},{path:"workspaces/:workspaceId/debug",lazy:Y(()=>z(()=>import("./WorkspaceDebugDetailPage-CPgAe8dd.js"),__vite__mapDeps([28,3,4,27,12,13,0,1,14,7,5,6,15,16])),"WorkspaceDebugDetailPage")},{path:"workspaces/:workspaceId/sessions",lazy:Y(()=>z(()=>import("./SessionIndexPage-CJKRHB_F.js"),__vite__mapDeps([29,3,4,12,13,0,1,14,7,5,6,15,16,25,30,31])),"SessionIndexPage")},{path:"workspaces/:workspaceId/sessions/:sessionId",lazy:Y(()=>z(()=>import("./ConversationPage-C5_ZqhU3.js"),__vite__mapDeps([32,3,4,7,13,12,0,1,14,5,6,15,16,17,18,19,30,31])),"ConversationPage")},{path:"documents",element:null},{path:"workbench",element:null},{path:"workspaces/:workspaceId/chats",lazy:Y(()=>z(()=>import("./PureConversationPage-CcakFvo0.js"),__vite__mapDeps([33,3,4,12,13,0,1,14,7,5,6,15,16])),"PureConversationPage")},{path:"workspaces/:workspaceId/chats/new",lazy:Y(()=>z(()=>import("./PureConversationPage-CcakFvo0.js"),__vite__mapDeps([33,3,4,12,13,0,1,14,7,5,6,15,16])),"PureConversationPage")},{path:"workspaces/:workspaceId/chats/:chatId",lazy:Y(()=>z(()=>import("./PureConversationPage-CcakFvo0.js"),__vite__mapDeps([33,3,4,12,13,0,1,14,7,5,6,15,16])),"PureConversationPage")},{path:"workspaces/:workspaceId/tools",lazy:Y(()=>z(()=>import("./ToolsHomePage-DDGqYwYU.js"),__vite__mapDeps([34,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolsHomePage")},{path:"workspaces/:workspaceId/tools/files",lazy:Y(()=>z(()=>import("./ToolFilesPage-BAZdjNaF.js"),__vite__mapDeps([35,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolFilesPage")},{path:"workspaces/:workspaceId/tools/git",lazy:Y(()=>z(()=>import("./ToolGitPage-CGkPmgsz.js"),__vite__mapDeps([36,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolGitPage")},{path:"workspaces/:workspaceId/tools/processes",lazy:Y(()=>z(()=>import("./ToolProcessesPage-BHpS7-VH.js"),__vite__mapDeps([37,3,4,12,13,0,1,14,7,5,6,15,16])),"ToolProcessesPage")},{path:"workspaces/:workspaceId/terminals",lazy:Y(()=>z(()=>import("./WorkbenchLayout-DrAvGjGK.js").then(e=>e.ct),__vite__mapDeps([12,3,4,13,0,1,14,7,5,6,15,16])),"TerminalPage")},{path:"workspaces/:workspaceId/plugins",lazy:Y(()=>z(()=>import("./PluginsListPage-R0SibHMi.js"),__vite__mapDeps([38,3,4,13,39])),"PluginsListPage")},{path:"workspaces/:workspaceId/plugins/:pluginId",lazy:Y(()=>z(()=>import("./PluginDetailPage-BX7gohai.js"),__vite__mapDeps([40,3,4,13,39,41,42])),"PluginDetailPage")},{path:"workspaces/:workspaceId/plugins/:pluginId/run",lazy:Y(()=>z(()=>import("./PluginContainerPage-b9LQVuqG.js"),__vite__mapDeps([43,3,4,13,39,7,15,42])),"PluginContainerPage")},{path:"workspaces/:workspaceId/butler",lazy:Y(()=>z(()=>import("./AdaptiveButlerPage-CLHLiZSY.js"),__vite__mapDeps([44,3,4,12,13,0,1,14,7,5,6,15,16,24])),"AdaptiveButlerPage")},{path:"settings",lazy:Y(()=>z(()=>import("./SettingsPage-Csp7wEBC.js"),__vite__mapDeps([45,3,4,12,13,0,1,14,7,5,6,15,16,39,41,42])),"SettingsPage")},{path:"settings/:section",lazy:Y(()=>z(()=>import("./SettingsPage-Csp7wEBC.js"),__vite__mapDeps([45,3,4,12,13,0,1,14,7,5,6,15,16,39,41,42])),"SettingsPage")},{path:"*",element:p.jsx($r,{})}]}]}];function es(){return Ti(Zo)}function ts(){const e=Qe(r=>r.profile.language),t=f.useMemo(()=>es(),[]);return p.jsx(to,{children:p.jsx(po,{children:p.jsx(na,{language:e,children:p.jsx(lo,{children:p.jsxs(ho,{children:[p.jsx(Do,{}),p.jsx(Oi,{router:t})]})})})})})}const gs=Object.freeze(Object.defineProperty({__proto__:null,App:ts},Symbol.toStringTag,{value:"Module"}));export{Er as A,ht as B,ps as C,ms as D,Xt as E,gs as F,oa as L,dn as N,Ei as O,to as P,lo as T,ko as a,Fo as b,as as c,Fi as d,gt as e,ss as f,Gr as g,mt as h,Bi as i,vo as j,So as k,ls as l,cs as m,Ro as n,us as o,ds as p,To as q,Yo as r,fs as s,hs as t,ir as u,Po as v,mo as w,oo as x,is as y,os as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,j as s,t as e,B as v}from"./index-
|
|
1
|
+
import{b as t,j as s,t as e,B as v}from"./index-BArTKWXk.js";import{u as S,a as w,b as N}from"./App-FYuZfAoO.js";function T(){const h=S(),m=w(a=>a.baseUrl),[l,x]=t.useState("admin"),[n,f]=t.useState(""),[u,j]=t.useState(""),[i,r]=t.useState(null),[b,o]=t.useState("error"),[c,d]=t.useState(!1);async function g(a){if(a.preventDefault(),n!==u){o("error"),r(e("auth.bootstrapMismatch"));return}d(!0),r(null);try{await N.bootstrap(l,n),o("success"),r(e("auth.bootstrapSuccess")),window.setTimeout(()=>h("/login",{replace:!0}),500)}catch(p){o("error"),p instanceof v?r(p.message):r(e("auth.authUnavailable"))}finally{d(!1)}}return s.jsx("main",{className:"page-center app-shell",children:s.jsxs("section",{className:"auth-card surface-card",children:[s.jsx("h1",{children:e("auth.bootstrapTitle")}),s.jsx("p",{className:"status-text",children:e("auth.bootstrapSubtitle")}),s.jsxs("div",{className:"field-group",children:[s.jsx("span",{children:e("auth.serverCurrent")}),s.jsx("span",{className:"auth-server-value",children:m})]}),s.jsxs("form",{className:"auth-form",onSubmit:g,children:[s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.username")}),s.jsx("input",{value:l,onChange:a=>x(a.target.value)})]}),s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.password")}),s.jsx("input",{type:"password",value:n,onChange:a=>f(a.target.value)})]}),s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.confirmPassword")}),s.jsx("input",{type:"password",value:u,onChange:a=>j(a.target.value)})]}),i?s.jsx("p",{className:"status-text","data-tone":b,children:i}):null,s.jsx("button",{className:"primary-button",type:"submit",disabled:c,children:c?e("common.loading"):e("auth.submitBootstrap")})]})]})})}export{T as BootstrapPage};
|