wiki-viewer 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/{17~r3.8awh3qg.js → 0-qve5g~myvo-.js} +1 -1
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/packages/wiki-viewer-mcp/bench-e2e.mjs +166 -0
- package/.next/standalone/packages/wiki-viewer-mcp/bench-latency.mjs +87 -0
- package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +28 -0
- package/.next/standalone/src/app/page.tsx +11 -1
- package/.next/standalone/src/tests/proof/bench-write.ts +179 -0
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- /package/.next/standalone/.next/static/{_avhhNXTnEvzPnQc1sIDF → HeeYGbBsAF0r0T0mY60Mo}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{_avhhNXTnEvzPnQc1sIDF → HeeYGbBsAF0r0T0mY60Mo}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{_avhhNXTnEvzPnQc1sIDF → HeeYGbBsAF0r0T0mY60Mo}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/0zay6349~v_wc.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/0vp-ahhagxptc.js" async=""></script><script src="/_next/static/chunks/turbopack-12~z-mr7b9b50.js" async=""></script><script src="/_next/static/chunks/0umlolnxs~j3r.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><script src="/_next/static/chunks/0ky8fha87kp0_.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><title>Wiki Viewer</title><meta name="description" content="Local file browser, viewer, and editor"/><link rel="icon" href="/icon.svg?icon.0_efx.p39qv7r.svg" sizes="any" type="image/svg+xml"/><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body class="inter_5901b7c6-module__ec5Qua__variable font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><script>((a,b,c,d,e,f,g,h)=>{let i=document.documentElement,j=["light","dark"];function k(b){var c;(Array.isArray(a)?a:[a]).forEach(a=>{let c="class"===a,d=c&&f?e.map(a=>f[a]||a):e;c?(i.classList.remove(...d),i.classList.add(f&&f[b]?f[b]:b)):i.setAttribute(a,b)}),c=b,h&&j.includes(c)&&(i.style.colorScheme=c)}if(d)k(d);else try{let a=localStorage.getItem(b)||c,d=g&&"system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a;k(d)}catch(a){}})("class","theme","system",null,["light","dark"],null,true,true)</script><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[427423,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ThemeProvider\"]\n3:I[902063,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n4:I[259666,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n5:I[187014,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"Toaster\"]\n6:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\na:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ViewportBoundary\"]\nc:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"MetadataBoundary\"]\ne:I[514743,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\",1]\n:HL[\"/_next/static/chunks/0zay6349~v_wc.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0zay6349~v_wc.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/0umlolnxs~j3r.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/057umwogp53v_.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/_next/static/chunks/0ky8fha87kp0_.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"inter_5901b7c6-module__ec5Qua__variable font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"children\":[[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"$L5\",null,{\"theme\":\"system\",\"position\":\"bottom-right\",\"toastOptions\":{\"className\":\"border-border bg-card text-card-foreground\"}}]]}]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,null]},null,false,\"$@9\"]},null,false,null],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0zay6349~v_wc.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"_avhhNXTnEvzPnQc1sIDF\"}\n"])</script><script>self.__next_f.push([1,"f:[]\n9:\"$Wf\"\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"10:I[319772,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"IconMark\"]\n8:null\nd:[[\"$\",\"title\",\"0\",{\"children\":\"Wiki Viewer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Local file browser, viewer, and editor\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/icon.svg?icon.0_efx.p39qv7r.svg\",\"sizes\":\"any\",\"type\":\"image/svg+xml\"}],[\"$\",\"$L10\",\"3\",{}]]\n"])</script></body></html>
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/0zay6349~v_wc.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/0vp-ahhagxptc.js" async=""></script><script src="/_next/static/chunks/turbopack-12~z-mr7b9b50.js" async=""></script><script src="/_next/static/chunks/0umlolnxs~j3r.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><script src="/_next/static/chunks/0ky8fha87kp0_.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><title>Wiki Viewer</title><meta name="description" content="Local file browser, viewer, and editor"/><link rel="icon" href="/icon.svg?icon.0_efx.p39qv7r.svg" sizes="any" type="image/svg+xml"/><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body class="inter_5901b7c6-module__ec5Qua__variable font-sans antialiased"><div hidden=""><!--$--><!--/$--></div><script>((a,b,c,d,e,f,g,h)=>{let i=document.documentElement,j=["light","dark"];function k(b){var c;(Array.isArray(a)?a:[a]).forEach(a=>{let c="class"===a,d=c&&f?e.map(a=>f[a]||a):e;c?(i.classList.remove(...d),i.classList.add(f&&f[b]?f[b]:b)):i.setAttribute(a,b)}),c=b,h&&j.includes(c)&&(i.style.colorScheme=c)}if(d)k(d);else try{let a=localStorage.getItem(b)||c,d=g&&"system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a;k(d)}catch(a){}})("class","theme","system",null,["light","dark"],null,true,true)</script><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[427423,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ThemeProvider\"]\n3:I[902063,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n4:I[259666,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\"]\n5:I[187014,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"Toaster\"]\n6:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\na:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"ViewportBoundary\"]\nc:I[62711,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"MetadataBoundary\"]\ne:I[514743,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"default\",1]\n:HL[\"/_next/static/chunks/0zay6349~v_wc.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0zay6349~v_wc.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/0umlolnxs~j3r.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/057umwogp53v_.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/_next/static/chunks/0ky8fha87kp0_.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"inter_5901b7c6-module__ec5Qua__variable font-sans antialiased\",\"children\":[\"$\",\"$L2\",null,{\"children\":[[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"$L5\",null,{\"theme\":\"system\",\"position\":\"bottom-right\",\"toastOptions\":{\"className\":\"border-border bg-card text-card-foreground\"}}]]}]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:0:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,null]},null,false,\"$@9\"]},null,false,null],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0zay6349~v_wc.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"HeeYGbBsAF0r0T0mY60Mo\"}\n"])</script><script>self.__next_f.push([1,"f:[]\n9:\"$Wf\"\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"10:I[319772,[\"/_next/static/chunks/0umlolnxs~j3r.js\",\"/_next/static/chunks/057umwogp53v_.js\",\"/_next/static/chunks/0ky8fha87kp0_.js\"],\"IconMark\"]\n8:null\nd:[[\"$\",\"title\",\"0\",{\"children\":\"Wiki Viewer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Local file browser, viewer, and editor\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/icon.svg?icon.0_efx.p39qv7r.svg\",\"sizes\":\"any\",\"type\":\"image/svg+xml\"}],[\"$\",\"$L10\",\"3\",{}]]\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/0vp-ahhagxptc.js" async=""></script><script src="/_next/static/chunks/turbopack-12~z-mr7b9b50.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[902063,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n3:I[259666,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n4:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"ViewportBoundary\"]\na:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"MetadataBoundary\"]\nc:I[514743,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"
|
|
1
|
+
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/0vp-ahhagxptc.js" async=""></script><script src="/_next/static/chunks/turbopack-12~z-mr7b9b50.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[902063,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n3:I[259666,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n4:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"ViewportBoundary\"]\na:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"MetadataBoundary\"]\nc:I[514743,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"HeeYGbBsAF0r0T0mY60Mo\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
|
|
@@ -126,4 +126,4 @@ TOKEN=<paste token here>
|
|
|
126
126
|
# 3. Read snapshot
|
|
127
127
|
curl -s -H "Authorization: Bearer $TOKEN" \\
|
|
128
128
|
-H "X-Agent-Id: ai:claude" \\
|
|
129
|
-
${t}/api/agent/files/${e??"<path/to/file.md>"}`;await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)},[e])}}(e??null),[l,c]=(0,Q.useState)(""),d=(0,Q.useRef)(null),u=window.location.origin,h=(0,Q.useCallback)(()=>IR,[]),p=(0,Q.useCallback)(()=>l.replace(/\$WIKI_URL/g,u),[l,u]),f=(0,Q.useCallback)(()=>`npx wiki-viewer-mcp register --url ${u} --id ai:myagent --name "My Agent"`,[u]),m=(0,Q.useCallback)(()=>JSON.stringify({servers:{"wiki-viewer":{command:"npx",args:["wiki-viewer-mcp"],env:{WIKI_VIEWER_URL:u,WIKI_VIEWER_TOKEN:"<token from register>",WIKI_VIEWER_AGENT_ID:"ai:myagent"}}}},null,2),[u]),g=IL(h),b=IL(p),y=IL(f),x=IL(m);return((0,Q.useEffect)(()=>{if(t)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&n()}},[t,n]),(0,Q.useEffect)(()=>{t&&d.current?.focus()},[t]),(0,Q.useEffect)(()=>{if(!t)return;o();let e=setInterval(()=>void o(),1e4);return()=>clearInterval(e)},[t,o]),(0,Q.useEffect)(()=>{t&&fetch("/api/agents/install").then(e=>e.json()).then(e=>{e.bootstrapPrompt&&c(e.bootstrapPrompt)}).catch(()=>void 0)},[t]),t)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-[1px]",onClick:n,"aria-hidden":!0}),(0,X.jsxs)("aside",{ref:d,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"AI Agent Panel",className:"fixed right-0 top-0 bottom-0 z-50 flex w-80 flex-col border-l border-border bg-background shadow-xl outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)(ei,{className:"h-4 w-4 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-semibold",children:"AI Agent"})]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:n,title:"Close panel (Esc)",children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-5 px-4 py-4",children:[(0,X.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 p-3",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Work with this wiki using AI"}),(0,X.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:["Connect Claude, Cursor, ChatGPT, and more. Pick by what you want — each option gives a copy-paste setup. You approve every assistant in ",(0,X.jsx)("span",{className:"font-medium text-foreground/80",children:"Agents"})," below before it gets access."]})]}),(0,X.jsxs)("section",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Co-write docs with you"}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Edits arrive as suggestions with comments you accept or revert. No MCP needed."}),(0,X.jsx)(tG,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void b.copy(),disabled:!l,children:b.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})," Paste into any chatbot"]})}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 pt-1",children:["Or install once so it sticks"," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"· Claude, OpenCode"}),":"]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:IR}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void g.copy(),children:g.copied?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})})]})]}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("p",{className:"text-xs font-semibold text-foreground",children:["Edit files directly"," ",(0,X.jsx)("span",{className:"font-normal text-muted-foreground/60",children:"· Claude Code, Cursor, Codex"})]}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Native read / search / edit tools over MCP. Run to request access:"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:f()}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void y.copy(),children:y.copied?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50",children:["Approve in ",(0,X.jsx)("span",{className:"font-medium text-foreground/70",children:"Agents"}),", then add to your tool:"]}),(0,X.jsx)(tG,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void x.copy(),children:x.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})," Copy config (mcp.json)"]})})]}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"For developers:"}),(0,X.jsxs)("button",{type:"button",onClick:()=>void a(),className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[s?(0,X.jsx)(eo,{className:"h-3 w-3 text-green-500"}):(0,X.jsx)(_b,{className:"h-3 w-3"})," curl example"]}),(0,X.jsxs)("a",{href:"/api/agents/skill",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kr,{className:"h-3 w-3"})," skill"]}),(0,X.jsxs)("a",{href:"/api/agents/install",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kr,{className:"h-3 w-3"})," install JSON"]})]})]}),(0,X.jsx)(II,{}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:["Active Connections"," ",(0,X.jsx)("span",{className:"normal-case font-normal text-muted-foreground/50",children:"(last 5 min)"})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:0===i.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 flex items-center gap-1.5",children:[(0,X.jsx)(IT,{className:"h-3.5 w-3.5"}),"No recent activity"]}):(0,X.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,X.jsxs)("li",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"font-mono text-foreground/80 truncate",children:e.by}),(0,X.jsxs)("span",{className:"text-muted-foreground shrink-0",children:[e.opCount," op",1!==e.opCount?"s":""]})]},e.by))})})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Recent Activity"}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-1 max-h-72 overflow-y-auto",children:0===r.length?(0,X.jsx)("p",{className:"text-xs text-muted-foreground/60 py-2",children:"No events recorded"}):r.map(e=>(0,X.jsx)(ID,{event:e},`${e.path}-${e.id}`))})]}),(0,X.jsx)("section",{children:(0,X.jsx)("a",{href:"/docs/agent-collab-plan.md",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline hover:no-underline",children:"Agent collaboration docs →"})})]})]})]}):null}function Ij({className:e}){let t=Ey(e=>e.width),n=Ey(e=>e.setWidth);return(0,X.jsxs)(OZ,{children:[(0,X.jsx)(O1,{asChild:!0,children:(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:`Content width: ${Eg[t]}`,children:(0,X.jsx)(w0,{className:"h-3.5 w-3.5"})})}),(0,X.jsx)(Ii,{align:"end",className:"w-36",children:Eb.map(e=>(0,X.jsxs)(Io,{onClick:()=>n(e),className:"flex items-center justify-between text-xs",children:[Eg[e],e===t&&(0,X.jsx)(eo,{className:"h-3.5 w-3.5"})]},e))})]})}function IB(e){return e.split(".").pop()?.toLowerCase()??""}function IF(e,t){if("node-app"===t)return"node-app";if("app"===t)return"app";if("dir"===t)return"fallback";let n=IB(e);return n?["md","markdown"].includes(n)?"editor":"txt"===n?"text":["csv","tsv"].includes(n)?"csv":"pdf"===n?"pdf":["mmd","mermaid"].includes(n)?"mermaid":"ipynb"===n?"notebook":["png","jpg","jpeg","gif","webp","svg","avif","ico","bmp"].includes(n)?"image":["mp4","webm","mov","m4v","mp3","wav","ogg","m4a","aac"].includes(n)?"media":"docx"===n?"docx":["xlsx","xlsm"].includes(n)?"xlsx":"pptx"===n?"pptx":"html"===n?"html":["py","js","ts","tsx","jsx","go","rs","java","c","cpp","h","sh","bash","zsh","rb","php","swift","kt","lua","sql","yaml","yml","toml","json","xml","css","scss"].includes(n)?"source":"fallback":"fallback"}let IH=new Set(["txt","md","markdown","json","yaml","yml","toml","csv","tsv","xml","html","css","js","ts","tsx","jsx","sh","bash","zsh","rb","py","go","rs","java","c","cpp","h","php","swift","kt","lua","sql","scss","mmd","mermaid","ini","env","log","conf"]);function IU(e){let t=IF(e,"file");return"editor"===t||"text"===t||IH.has(IB(e))}function Iz(e){return["md","markdown"].includes(IB(e))}function I$(e){return"image"===IF(e,"file")}async function IG(e){let t=await fetch(`/api/wiki?dir=${encodeURIComponent(e)}`);return t.ok?(await t.json()).entries.map(t=>({name:t.name,path:e?`${e}/${t.name}`:t.name,type:t.type,size:t.size,modifiedAt:t.modifiedAt,expanded:!1})):[]}function Iq(e,t,n){return e.map(e=>e.path===t?n(e):e.children?{...e,children:Iq(e.children,t,n)}:e)}e.s(["default",0,function(){let e;Ex(e=>e.loadedAt),(0,Q.useEffect)(()=>{Ex.getState().load()},[]);let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{fetch("/api/system/root-status").then(e=>e.json()).then(e=>{n(e.configured),i(e.path)}).catch(()=>n(!1))},[]);let o=Eu(e=>e.currentPath),s=(0,Q.useRef)(new URLSearchParams(window.location.search).get("path")),a=(0,Q.useRef)(!1),[l,c]=(0,Q.useState)([]),[d,u]=(0,Q.useState)(!1),[h,p]=(0,Q.useState)(!1),f=(0,Q.useRef)(!1),[m,g]=(0,Q.useState)(!1),[b,y]=(0,Q.useState)(!1),[x,v]=(0,Q.useState)(null),E=(0,Q.useRef)(null),w=(0,Q.useRef)(""),[k,T]=(0,Q.useState)(null),[N,A]=(0,Q.useState)(""),[S,C]=(0,Q.useState)(null),[_,M]=(0,Q.useState)(null),[O,I]=(0,Q.useState)(""),[D,R]=(0,Q.useState)(null),[L,P]=(0,Q.useState)(null),[j,B]=(0,Q.useState)(!1),[F,H]=(0,Q.useState)(null),[U,z]=(0,Q.useState)(!1),[$,G]=(0,Q.useState)(0),[q,V]=(0,Q.useState)(!1),[W,K]=(0,Q.useState)(!1),[Y,J]=(0,Q.useState)(null),[Z,ee]=(0,Q.useState)(!1),[et,en]=(0,Q.useState)(!1),[eC,e_]=(0,Q.useState)(""),[eM,eO]=(0,Q.useState)(!1),[eI,eD]=(0,Q.useState)(null),eR=(0,Q.useRef)(null),[eL,eP]=(0,Q.useState)(null),ej=(0,Q.useRef)(null),eB=(0,Q.useRef)(!1),eF=(0,Q.useRef)(async()=>{});(0,Q.useEffect)(()=>{d||f.current||(f.current=!0,p(!0),IG("").then(e=>{c(e),u(!0),p(!1)}).catch(()=>{f.current=!1,p(!1)}))},[d]);let eH=(0,Q.useCallback)(async e=>{let t=e.split("/");if(t.length<=1)return;let n=[],r="";for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push({prefix:r,children:await IG(r)});c(e=>{let t=e;for(let{prefix:e,children:r}of n)t=Iq(t,e,e=>({...e,children:r,expanded:!0}));return t})},[]),eU=(0,Q.useCallback)(async e=>{let t=await IG(e);""===e?c(e=>{let n=new Map(e.map(e=>[e.path,e]));return t.map(e=>{let t=n.get(e.path);return t&&("dir"===t.type||"app"===t.type)?{...e,expanded:t.expanded,children:t.children}:e})}):c(n=>Iq(n,e,e=>({...e,children:t,expanded:!0})))},[]),ez=(0,Q.useCallback)(e=>{let t=[];for(let n of e)("dir"===n.type||"app"===n.type)&&n.expanded&&n.children&&(t.push(n.path),t.push(...ez(n.children)));return t},[]),e$=(0,Q.useCallback)(async()=>{g(!0);try{let e=ez(l),t=await IG("");for(let n of(c(t),e)){let e=await IG(n);c(t=>Iq(t,n,t=>({...t,children:e,expanded:!0})))}}finally{g(!1)}},[l,ez]),eG=(0,Q.useCallback)(async()=>{if(F&&(["editor","text"].includes(IF(F.name,F.nodeType))||IU(F.name))){ee(!0);try{let e=await fetch(`/api/wiki/content?path=${encodeURIComponent(F.path)}`);if(e.ok){let t=await e.json();J(t.content)}}catch{}ee(!1)}},[F]);async function eq(e){if("dir"===e.type||"app"===e.type)if(e.expanded)c(t=>Iq(t,e.path,e=>({...e,expanded:!1})));else if(void 0===e.children){c(t=>Iq(t,e.path,e=>({...e,loading:!0})));let t=await IG(e.path);c(n=>Iq(n,e.path,e=>({...e,loading:!1,children:t,expanded:!0})))}else c(t=>Iq(t,e.path,e=>({...e,expanded:!0})))}async function eV(e){if(H({path:e.path,name:e.name,nodeType:"app"===e.type?"app":"node-app"===e.type?"node-app":"file"}),en(!1),eD(null),J(null),["editor","text"].includes(IF(e.name,e.type))||IU(e.name)){ee(!0);try{let t=await fetch(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(t.ok){let e=await t.json();J(e.content)}}catch{}ee(!1)}}(0,Q.useEffect)(()=>{ej.current=F},[F]),(0,Q.useEffect)(()=>{eB.current=et},[et]),(0,Q.useEffect)(()=>{eF.current=eG},[eG]),(0,Q.useEffect)(()=>{if(!t)return;let e=new Map,n=new EventSource("/api/wiki/watch");return n.onmessage=t=>{var n;let r;try{r=JSON.parse(t.data)}catch{return}let{type:i,path:o}=r,s=o.split("/");if(n=s.length>1?s.slice(0,-1).join("/"):"",e.has(n)&&clearTimeout(e.get(n)),e.set(n,setTimeout(()=>{e.delete(n),eU(n)},300)),"change"===i&&ej.current?.path===o&&!eB.current){let t=`__file__${o}`;e.has(t)&&clearTimeout(e.get(t)),e.set(t,setTimeout(()=>{e.delete(t),eF.current()},400))}},()=>{for(let t of(n.close(),e.values()))clearTimeout(t)}},[t,eU]),(0,Q.useEffect)(()=>{z(!1)},[]),(0,Q.useEffect)(()=>{if(!o||F&&F.path===o)return;let e=o.split("/").pop()??o;eV({path:o,name:e,type:"file"})},[o]),(0,Q.useEffect)(()=>{let e=new URL(window.location.href);F?e.searchParams.set("path",F.path):e.searchParams.delete("path"),window.history.replaceState(null,"",e.toString())},[F]),(0,Q.useEffect)(()=>{if(a.current||!d)return;let e=s.current;if(!e){a.current=!0;return}a.current=!0,(async()=>{let t=e.split("/"),n=t[t.length-1],r=t.slice(0,-1).join("/"),i=(await IG(r)).find(t=>t.path===e);i&&(await eH(e),eV({path:e,name:n,type:i.type,modifiedAt:i.modifiedAt}))})()},[d,eH]);let eW=async()=>{await fetch("/api/system/clear-root",{method:"POST"}),H(null),J(null),en(!1),c([]),u(!1),f.current=!1,i(null),n(!1)};async function eK(){if(!F)return;eO(!0),eD(null);let e=await fetch("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:F.path,content:eC})});e.ok?(J(eC),en(!1)):eD((await e.json()).error??"Save failed"),eO(!1)}let eY=(0,Q.useCallback)(async(e,t)=>{let n=Array.from(e);if(n.length){y(!0),v(null);try{for(let e of n){let n=new FormData;n.append("file",e),n.append("dir",t);let r=await fetch("/api/wiki/upload",{method:"POST",body:n});if(!r.ok){let e=await r.json();v(e.error??"Upload failed"),_o(e.error??"Upload failed");break}}await eU(t)}catch{v("Upload failed.")}finally{y(!1),E.current&&(E.current.value="")}}},[eU]);function eX(e){w.current=e,E.current?.click()}async function eQ(){let e=N.trim();if(!e||null===k)return;C(null);let t=k?`${k}/${e}`:e,n=await fetch("/api/wiki/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});n.ok?(T(null),A(""),await eU(k),""!==k&&c(e=>Iq(e,k,e=>({...e,expanded:!0})))):C((await n.json()).error??"Failed")}async function eJ(){let e=O.trim();if(!e||null===_)return;R(null);let t=e.includes(".")?e:`${e}.md`,n=_?`${_}/${t}`:t,r=await fetch("/api/wiki/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});r.ok?(M(null),I(""),await eU(_),""!==_&&c(e=>Iq(e,_,e=>({...e,expanded:!0}))),eV({path:n,name:t,type:"file",modifiedAt:new Date().toISOString()})):R((await r.json()).error??"Failed")}async function eZ(){L&&(await fetch("/api/wiki",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:L})}),(F?.path===L||F?.path.startsWith(`${L}/`))&&(H(null),J(null)),c(e=>(function e(t,n){return t.filter(e=>e.path!==n).map(t=>t.children?{...t,children:e(t.children,n)}:t)})(e,L)),P(null))}function e0(e,t,n){e.preventDefault(),e.stopPropagation();let r=eR.current;!r||r.path===t||t.startsWith(`${r.path}/`)||(e.dataTransfer.dropEffect="move",eP("root"===n?"":t))}async function e1(e,t){e.preventDefault(),e.stopPropagation(),eP(null);let n=eR.current;if(eR.current=null,!n||n.path===t||t.startsWith(`${n.path}/`))return;let r=t?`${t}/${n.name}`:n.name;if(r!==n.path&&(await fetch("/api/wiki/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:n.path,to:r})})).ok){let e=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"";await eU(e),t!==e&&await eU(t),F?.path===n.path&&H({path:r,name:n.name,nodeType:F.nodeType})}}let e2=F?IF(F.name,F.nodeType):null,e3=Ey(e=>e.width),e5=null===e2||"editor"===e2||"text"===e2||"source"===e2||"notebook"===e2||"fallback"===e2,e4=e5?Ef[e3]:"";return(0,X.jsxs)("div",{className:"flex h-screen gap-0 overflow-hidden bg-background",children:[null===t&&(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsx)(eg,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!1===t&&(0,X.jsx)(MC,{onSelect:e=>{u(!1),f.current=!1,i(e),n(!0)}}),!0===t&&(0,X.jsxs)(X.Fragment,{children:[!q&&(0,X.jsxs)(Ig,{className:"flex flex-col w-72 shrink-0 overflow-hidden rounded-none border-r border-l-0 border-t-0 border-b-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-5 w-5 shrink-0"}),(0,X.jsx)("span",{className:"truncate text-xs font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 shrink-0",title:"Collapse sidebar",onClick:()=>V(!0),children:(0,X.jsx)(ey,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 border-b bg-muted/50 shrink-0",children:[(0,X.jsxs)(OZ,{children:[(0,X.jsx)(O1,{asChild:!0,children:(0,X.jsxs)(tG,{size:"sm",variant:"ghost",className:"h-7 gap-1 px-2 text-xs",disabled:b,children:[b?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eE,{className:"h-3.5 w-3.5"}),"New",(0,X.jsx)(es,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ii,{align:"start",className:"w-44",children:[(0,X.jsxs)(Io,{onClick:()=>{M(""),I(""),R(null)},children:[(0,X.jsx)(ec,{className:"mr-2 h-3.5 w-3.5"}),"New file"]}),(0,X.jsxs)(Io,{onClick:()=>{T(""),A(""),C(null)},children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}),(0,X.jsxs)(Io,{onClick:()=>eX(""),disabled:b,children:[(0,X.jsx)(eA,{className:"mr-2 h-3.5 w-3.5"}),"Upload"]})]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh tree",onClick:e$,disabled:m,children:m?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(Ic,{}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"AI Agent panel",onClick:()=>Ee.getState().toggle(),children:(0,X.jsx)(ei,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Settings",onClick:()=>K(!0),children:(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})})]})]}),x&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),x]}),""===k&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(eu,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:N,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eQ(),"Escape"===e.key&&(T(null),A(""))}}),S&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:S}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:eQ,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{T(null),A("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),""===_&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:O,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eJ(),"Escape"===e.key&&(M(null),I(""))}}),D&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:D}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:eJ,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{M(null),I("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),(0,X.jsx)("div",{className:tz("flex-1 overflow-auto py-1",""===eL&&"ring-2 ring-inset ring-primary bg-primary/5"),onDragOver:e=>e0(e,"","root"),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||eP(null)},onDrop:e=>e1(e,""),children:h?(0,X.jsx)("div",{className:"flex justify-center py-6",children:(0,X.jsx)(eg,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===l.length?(0,X.jsxs)("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[(0,X.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,X.jsx)(ed,{className:"h-6 w-6 text-muted-foreground"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:"No files yet"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload files or add them to the configured directory"})]}),(0,X.jsxs)(tG,{size:"sm",variant:"outline",className:"w-full gap-1.5 max-w-[180px]",onClick:()=>eX(""),disabled:b,children:[b?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eA,{className:"h-3.5 w-3.5"}),"Upload Files"]})]}):function e(t,n=0){return t.map(t=>(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{role:"treeitem",tabIndex:0,draggable:!0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),"dir"===t.type?eq(t):"app"===t.type?(eV(t),eq(t)):eV(t))},onDragStart:e=>{eR.current=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.path)},onDragOver:e=>"dir"===t.type?e0(e,t.path,"dir"):e.preventDefault(),onDragLeave:()=>eP(null),onDrop:e=>"dir"===t.type?e1(e,t.path):e.preventDefault(),className:tz("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer group transition-colors select-none",F?.path===t.path?"bg-accent text-accent-foreground":"hover:bg-accent/50",eL===t.path&&"ring-2 ring-primary bg-primary-soft",t.name.startsWith(".")&&"opacity-40"),style:{paddingLeft:`${14*n+8}px`},onClick:()=>{"dir"===t.type?eq(t):"app"===t.type?(eV(t),eq(t)):eV(t)},children:["dir"===t.type||"app"===t.type?t.loading?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):t.expanded?(0,X.jsx)(es,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)(ea,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),"dir"===t.type?t.expanded?(0,X.jsx)(eh,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-warning")}):(0,X.jsx)(eu,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-warning")}):"app"===t.type?(0,X.jsx)(ef,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-accent")}):"node-app"===t.type?(0,X.jsx)(eT,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-emerald-500")}):"html"===IF(t.name,"file")?(0,X.jsx)(ef,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-accent/70")}):I$(t.name)?(0,X.jsx)(em,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-sunshine-700")}):IU(t.name)?(0,X.jsx)(ed,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-accent")}):(0,X.jsx)(el,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-muted-foreground")}),(0,X.jsx)("span",{className:"flex-1 truncate",children:t.name}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:["dir"===t.type&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"New file here (default .md)",onClick:async()=>{t.expanded||await eq(t),M(t.path),I(""),R(null)},children:(0,X.jsx)(ec,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"Upload here",onClick:()=>eX(t.path),children:(0,X.jsx)(eA,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"New subfolder",onClick:()=>{T(t.path),A(""),C(null)},children:(0,X.jsx)(ep,{className:"h-3 w-3"})})]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-destructive hover:text-destructive",title:"Delete",onClick:()=>{P(t.path),B("file"!==t.type)},children:(0,X.jsx)(eN,{className:"h-3 w-3"})})]})]}),k===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(eu,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:N,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eQ(),"Escape"===e.key&&(T(null),A(""))}}),S&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:S}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:eQ,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{T(null),A("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),_===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:O,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eJ(),"Escape"===e.key&&(M(null),I(""))}}),D&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:D}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:eJ,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{M(null),I("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),("dir"===t.type||"app"===t.type)&&t.expanded&&t.children&&t.children.length>0&&e(t.children,n+1),("dir"===t.type||"app"===t.type)&&t.expanded&&t.children?.length===0&&(0,X.jsx)("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(n+1)*14+8+14+6+16+6}px`},children:"Empty"})]},t.path))}(l)}),(0,X.jsxs)("div",{className:"border-t px-3 py-2 flex items-center gap-2 bg-muted shrink-0",children:[(0,X.jsx)("span",{className:"flex-1 text-xs text-muted-foreground font-mono truncate",title:r??"",children:r??""}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 shrink-0 text-xs px-2 text-muted-foreground hover:text-foreground",onClick:eW,children:"Change"})]})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[q&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-7 w-7 p-0 rounded-full bg-background/50 backdrop-blur-xl backdrop-saturate-150 border border-white/[0.08] text-foreground/60 hover:text-foreground/90 hover:bg-background/70 shadow-[0_0_12px_rgba(0,0,0,0.15)] [transform:translate(-50%,-50%)_translateZ(0)]",title:"Show sidebar",onClick:()=>V(!1),children:(0,X.jsx)(ex,{className:"h-3.5 w-3.5"})}),F?"node-app"===e2?(0,X.jsx)(Mk,{path:F.path,title:F.name}):"app"===e2||"html"===e2?(e="html"===e2?`/api/assets/${F.path}`:void 0,U?(0,X.jsx)(Mx,{path:F.path,title:F.name,src:e,fullscreen:!0,onExit:()=>z(!1)}):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,X.jsx)(ef,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:F.path,children:F.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["html"===e2&&!et&&null!==Y&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Edit source",onClick:()=>{en(!0),e_(Y),eD(null)},children:(0,X.jsx)(ev,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:()=>G(e=>e+1),children:(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)(tG,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>z(!0),children:[(0,X.jsx)(eb,{className:"h-3.5 w-3.5"}),"Open fullscreen"]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{H(null),en(!1)},children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})})]})]}),et&&"html"===e2?(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,X.jsx)("textarea",{value:eC,onChange:e=>e_(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"}),(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[eI&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:eI}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",onClick:()=>{en(!1),eD(null)},children:"Cancel"}),(0,X.jsxs)(tG,{size:"sm",className:"gap-1",onClick:eK,disabled:eM,children:[eM&&(0,X.jsx)(eg,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)(Mx,{path:F.path,title:F.name,src:e},$)]})):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[I$(F.name)?(0,X.jsx)(em,{className:"h-4 w-4 shrink-0 text-sunshine-700"}):IU(F.name)?(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-accent"}):(0,X.jsx)(el,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:F.path,children:F.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[IU(F.name)&&!et&&null!==Y&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{en(!0),e_(Y),eD(null),Iz(F.name)&&Eu.getState().loadPage(F.path)},children:(0,X.jsx)(ev,{className:"h-3.5 w-3.5"})}),IU(F.name)&&!et&&null!==Y&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:eG,disabled:Z,children:Z?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})}),e5&&(0,X.jsx)(Ij,{}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{H(null),J(null),en(!1)},children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})})]})]}),et?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:Iz(F.name)?(0,X.jsx)(_p,{}):(0,X.jsx)("textarea",{value:eC,onChange:e=>e_(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"})}):(0,X.jsx)("div",{className:"flex-1 overflow-auto p-4 min-h-0",children:(0,X.jsx)("div",{className:tz("mx-auto w-full",e4),children:Z?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(eg,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):"csv"===e2?(0,X.jsx)(rz,{path:F.path,title:F.name}):"pdf"===e2?(0,X.jsx)(Mf,{path:F.path,title:F.name}):"mermaid"===e2?(0,X.jsx)(_w,{path:F.path,title:F.name}):"notebook"===e2?(0,X.jsx)(Mc,{path:F.path,title:F.name}):"image"===e2?(0,X.jsx)(_m,{path:F.path,title:F.name}):"media"===e2?(0,X.jsx)(_g,{path:F.path,title:F.name,type:["mp4","webm","mov","m4v"].includes(IB(F.name))?"video":"audio"}):"docx"===e2?(0,X.jsx)(Mu,{path:F.path,title:F.name}):"xlsx"===e2?(0,X.jsx)(Mp,{path:F.path,title:F.name}):"pptx"===e2?(0,X.jsx)(Mh,{path:F.path,title:F.name}):"source"===e2?(0,X.jsx)(My,{path:F.path,title:F.name}):"fallback"===e2?(0,X.jsx)(_f,{path:F.path,title:F.name}):null!==Y?["md","markdown"].includes(IB(F.name))?(()=>{let{data:e,body:t}=function(e){let t=Iw.exec(e);if(!t)return{data:{},body:e};let n=t[1],r=e.slice(t[0].length),i=n.split(/\r?\n/).find(e=>""!==e.trim())??"";if(/^\s*(#{1,6}\s|<|>|-\s|\*\s|\d+\.\s)/.test(i))return{data:{},body:e};let o={},s=n.split(/\r?\n/),a=0;for(;a<s.length;){let e=s[a];if(!e||/^\s*#/.test(e)){a+=1;continue}let t=/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(e);if(!t){a+=1;continue}let n=t[1],r=t[2];if(""===r.trim()){let e=[],t=a+1;for(;t<s.length&&/^\s+-\s+/.test(s[t]);){let n=/^\s+-\s+(.*)$/.exec(s[t]);n&&e.push(Ik(n[1])),t+=1}if(e.length>0){o[n]=e,a=t;continue}o[n]="",a+=1;continue}o[n]=Ik(r),a+=1}return 0===Object.keys(o).length?{data:{},body:e}:{data:o,body:r}}(Y);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{data:e}),(0,X.jsx)(IE,{markdown:t,pagePath:F.path,onNavigate:(e,t)=>{eV({path:e,name:e.split("/").pop()??e,type:"file"}),t&&setTimeout(()=>{document.getElementById(t)?.scrollIntoView({behavior:"smooth"})},200)}})]})})():(0,X.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words leading-relaxed",children:Y}):IU(F.name)?(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Could not load file."}):(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Preview not available for this file type."})})}),et&&(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[eI&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:eI}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",onClick:()=>{en(!1),eD(null)},children:"Cancel"}),(0,X.jsxs)(tG,{size:"sm",className:"gap-1",onClick:eK,disabled:eM,children:[eM&&(0,X.jsx)(eg,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[(0,X.jsx)(ed,{className:"h-8 w-8 text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a file to view or edit"})]})})]}),(0,X.jsx)(Im,{open:W,onOpenChange:K}),(0,X.jsx)(IP,{currentPath:F?.path}),(0,X.jsx)("input",{ref:E,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&eY(e.target.files,w.current)}}),(0,X.jsx)(rL,{open:!!L,onOpenChange:e=>{e||P(null)},title:j?"Delete folder?":"Delete file?",description:j?`"${L?.split("/").pop()}" and all its contents will be permanently deleted.`:`"${L?.split("/").pop()}" will be permanently removed.`,onConfirm:eZ})]})]})}],952683)}]);
|
|
129
|
+
${t}/api/agent/files/${e??"<path/to/file.md>"}`;await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)},[e])}}(e??null),[l,c]=(0,Q.useState)(""),d=(0,Q.useRef)(null),u=window.location.origin,h=(0,Q.useCallback)(()=>IR,[]),p=(0,Q.useCallback)(()=>l.replace(/\$WIKI_URL/g,u),[l,u]),f=(0,Q.useCallback)(()=>`npx wiki-viewer-mcp register --url ${u} --id ai:myagent --name "My Agent"`,[u]),m=(0,Q.useCallback)(()=>JSON.stringify({servers:{"wiki-viewer":{command:"npx",args:["wiki-viewer-mcp"],env:{WIKI_VIEWER_URL:u,WIKI_VIEWER_TOKEN:"<token from register>",WIKI_VIEWER_AGENT_ID:"ai:myagent"}}}},null,2),[u]),g=IL(h),b=IL(p),y=IL(f),x=IL(m);return((0,Q.useEffect)(()=>{if(t)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&n()}},[t,n]),(0,Q.useEffect)(()=>{t&&d.current?.focus()},[t]),(0,Q.useEffect)(()=>{if(!t)return;o();let e=setInterval(()=>void o(),1e4);return()=>clearInterval(e)},[t,o]),(0,Q.useEffect)(()=>{t&&fetch("/api/agents/install").then(e=>e.json()).then(e=>{e.bootstrapPrompt&&c(e.bootstrapPrompt)}).catch(()=>void 0)},[t]),t)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-[1px]",onClick:n,"aria-hidden":!0}),(0,X.jsxs)("aside",{ref:d,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"AI Agent Panel",className:"fixed right-0 top-0 bottom-0 z-50 flex w-80 flex-col border-l border-border bg-background shadow-xl outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)(ei,{className:"h-4 w-4 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-semibold",children:"AI Agent"})]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:n,title:"Close panel (Esc)",children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-5 px-4 py-4",children:[(0,X.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 p-3",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Work with this wiki using AI"}),(0,X.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:["Connect Claude, Cursor, ChatGPT, and more. Pick by what you want — each option gives a copy-paste setup. You approve every assistant in ",(0,X.jsx)("span",{className:"font-medium text-foreground/80",children:"Agents"})," below before it gets access."]})]}),(0,X.jsxs)("section",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Co-write docs with you"}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Edits arrive as suggestions with comments you accept or revert. No MCP needed."}),(0,X.jsx)(tG,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void b.copy(),disabled:!l,children:b.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})," Paste into any chatbot"]})}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 pt-1",children:["Or install once so it sticks"," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"· Claude, OpenCode"}),":"]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:IR}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void g.copy(),children:g.copied?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})})]})]}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("p",{className:"text-xs font-semibold text-foreground",children:["Edit files directly"," ",(0,X.jsx)("span",{className:"font-normal text-muted-foreground/60",children:"· Claude Code, Cursor, Codex"})]}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Native read / search / edit tools over MCP. Run to request access:"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:f()}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void y.copy(),children:y.copied?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50",children:["Approve in ",(0,X.jsx)("span",{className:"font-medium text-foreground/70",children:"Agents"}),", then add to your tool:"]}),(0,X.jsx)(tG,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void x.copy(),children:x.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_b,{className:"h-3.5 w-3.5"})," Copy config (mcp.json)"]})})]}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"For developers:"}),(0,X.jsxs)("button",{type:"button",onClick:()=>void a(),className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[s?(0,X.jsx)(eo,{className:"h-3 w-3 text-green-500"}):(0,X.jsx)(_b,{className:"h-3 w-3"})," curl example"]}),(0,X.jsxs)("a",{href:"/api/agents/skill",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kr,{className:"h-3 w-3"})," skill"]}),(0,X.jsxs)("a",{href:"/api/agents/install",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kr,{className:"h-3 w-3"})," install JSON"]})]})]}),(0,X.jsx)(II,{}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:["Active Connections"," ",(0,X.jsx)("span",{className:"normal-case font-normal text-muted-foreground/50",children:"(last 5 min)"})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:0===i.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 flex items-center gap-1.5",children:[(0,X.jsx)(IT,{className:"h-3.5 w-3.5"}),"No recent activity"]}):(0,X.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,X.jsxs)("li",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"font-mono text-foreground/80 truncate",children:e.by}),(0,X.jsxs)("span",{className:"text-muted-foreground shrink-0",children:[e.opCount," op",1!==e.opCount?"s":""]})]},e.by))})})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Recent Activity"}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-1 max-h-72 overflow-y-auto",children:0===r.length?(0,X.jsx)("p",{className:"text-xs text-muted-foreground/60 py-2",children:"No events recorded"}):r.map(e=>(0,X.jsx)(ID,{event:e},`${e.path}-${e.id}`))})]}),(0,X.jsx)("section",{children:(0,X.jsx)("a",{href:"/docs/agent-collab-plan.md",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline hover:no-underline",children:"Agent collaboration docs →"})})]})]})]}):null}function Ij({className:e}){let t=Ey(e=>e.width),n=Ey(e=>e.setWidth);return(0,X.jsxs)(OZ,{children:[(0,X.jsx)(O1,{asChild:!0,children:(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:`Content width: ${Eg[t]}`,children:(0,X.jsx)(w0,{className:"h-3.5 w-3.5"})})}),(0,X.jsx)(Ii,{align:"end",className:"w-36",children:Eb.map(e=>(0,X.jsxs)(Io,{onClick:()=>n(e),className:"flex items-center justify-between text-xs",children:[Eg[e],e===t&&(0,X.jsx)(eo,{className:"h-3.5 w-3.5"})]},e))})]})}function IB(e){return e.split(".").pop()?.toLowerCase()??""}function IF(e,t){if("node-app"===t)return"node-app";if("app"===t)return"app";if("dir"===t)return"fallback";let n=IB(e);return n?["md","markdown"].includes(n)?"editor":"txt"===n?"text":["csv","tsv"].includes(n)?"csv":"pdf"===n?"pdf":["mmd","mermaid"].includes(n)?"mermaid":"ipynb"===n?"notebook":["png","jpg","jpeg","gif","webp","svg","avif","ico","bmp"].includes(n)?"image":["mp4","webm","mov","m4v","mp3","wav","ogg","m4a","aac"].includes(n)?"media":"docx"===n?"docx":["xlsx","xlsm"].includes(n)?"xlsx":"pptx"===n?"pptx":"html"===n?"html":["py","js","ts","tsx","jsx","go","rs","java","c","cpp","h","sh","bash","zsh","rb","php","swift","kt","lua","sql","yaml","yml","toml","json","xml","css","scss"].includes(n)?"source":"fallback":"fallback"}let IH=new Set(["txt","md","markdown","json","yaml","yml","toml","csv","tsv","xml","html","css","js","ts","tsx","jsx","sh","bash","zsh","rb","py","go","rs","java","c","cpp","h","php","swift","kt","lua","sql","scss","mmd","mermaid","ini","env","log","conf"]);function IU(e){let t=IF(e,"file");return"editor"===t||"text"===t||IH.has(IB(e))}function Iz(e){return["md","markdown"].includes(IB(e))}function I$(e){return"image"===IF(e,"file")}async function IG(e){let t=await fetch(`/api/wiki?dir=${encodeURIComponent(e)}`);return t.ok?(await t.json()).entries.map(t=>({name:t.name,path:e?`${e}/${t.name}`:t.name,type:t.type,size:t.size,modifiedAt:t.modifiedAt,expanded:!1})):[]}function Iq(e,t,n){return e.map(e=>e.path===t?n(e):e.children?{...e,children:Iq(e.children,t,n)}:e)}e.s(["default",0,function(){let e;Ex(e=>e.loadedAt),(0,Q.useEffect)(()=>{Ex.getState().load()},[]);let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{fetch("/api/system/root-status").then(e=>e.json()).then(e=>{n(e.configured),i(e.path)}).catch(()=>n(!1))},[]);let o=Eu(e=>e.currentPath),s=(0,Q.useRef)(new URLSearchParams(window.location.search).get("path")),a=(0,Q.useRef)(!1),[l,c]=(0,Q.useState)([]),[d,u]=(0,Q.useState)(!1),[h,p]=(0,Q.useState)(!1),f=(0,Q.useRef)(!1),[m,g]=(0,Q.useState)(!1),[b,y]=(0,Q.useState)(!1),[x,v]=(0,Q.useState)(null),E=(0,Q.useRef)(null),w=(0,Q.useRef)(""),[k,T]=(0,Q.useState)(null),[N,A]=(0,Q.useState)(""),[S,C]=(0,Q.useState)(null),[_,M]=(0,Q.useState)(null),[O,I]=(0,Q.useState)(""),[D,R]=(0,Q.useState)(null),[L,P]=(0,Q.useState)(null),[j,B]=(0,Q.useState)(!1),[F,H]=(0,Q.useState)(null),[U,z]=(0,Q.useState)(!1),[$,G]=(0,Q.useState)(0),[q,V]=(0,Q.useState)(!1),[W,K]=(0,Q.useState)(!1),[Y,J]=(0,Q.useState)(null),[Z,ee]=(0,Q.useState)(0),[et,en]=(0,Q.useState)(!1),[eC,e_]=(0,Q.useState)(!1),[eM,eO]=(0,Q.useState)(""),[eI,eD]=(0,Q.useState)(!1),[eR,eL]=(0,Q.useState)(null),eP=(0,Q.useRef)(null),[ej,eB]=(0,Q.useState)(null),eF=(0,Q.useRef)(null),eH=(0,Q.useRef)(!1),eU=(0,Q.useRef)(async()=>{});(0,Q.useEffect)(()=>{d||f.current||(f.current=!0,p(!0),IG("").then(e=>{c(e),u(!0),p(!1)}).catch(()=>{f.current=!1,p(!1)}))},[d]);let ez=(0,Q.useCallback)(async e=>{let t=e.split("/");if(t.length<=1)return;let n=[],r="";for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push({prefix:r,children:await IG(r)});c(e=>{let t=e;for(let{prefix:e,children:r}of n)t=Iq(t,e,e=>({...e,children:r,expanded:!0}));return t})},[]),e$=(0,Q.useCallback)(async e=>{let t=await IG(e);""===e?c(e=>{let n=new Map(e.map(e=>[e.path,e]));return t.map(e=>{let t=n.get(e.path);return t&&("dir"===t.type||"app"===t.type)?{...e,expanded:t.expanded,children:t.children}:e})}):c(n=>Iq(n,e,e=>({...e,children:t,expanded:!0})))},[]),eG=(0,Q.useCallback)(e=>{let t=[];for(let n of e)("dir"===n.type||"app"===n.type)&&n.expanded&&n.children&&(t.push(n.path),t.push(...eG(n.children)));return t},[]),eq=(0,Q.useCallback)(async()=>{g(!0);try{let e=eG(l),t=await IG("");for(let n of(c(t),e)){let e=await IG(n);c(t=>Iq(t,n,t=>({...t,children:e,expanded:!0})))}}finally{g(!1)}},[l,eG]),eV=(0,Q.useCallback)(async()=>{if(F&&(["editor","text"].includes(IF(F.name,F.nodeType))||IU(F.name))){en(!0);try{let e=await fetch(`/api/wiki/content?path=${encodeURIComponent(F.path)}`);if(e.ok){let t=await e.json();J(t.content),ee(Number(e.headers.get("X-Wiki-Revision")??0))}}catch{}en(!1)}},[F]);async function eW(e){if("dir"===e.type||"app"===e.type)if(e.expanded)c(t=>Iq(t,e.path,e=>({...e,expanded:!1})));else if(void 0===e.children){c(t=>Iq(t,e.path,e=>({...e,loading:!0})));let t=await IG(e.path);c(n=>Iq(n,e.path,e=>({...e,loading:!1,children:t,expanded:!0})))}else c(t=>Iq(t,e.path,e=>({...e,expanded:!0})))}async function eK(e){if(H({path:e.path,name:e.name,nodeType:"app"===e.type?"app":"node-app"===e.type?"node-app":"file"}),e_(!1),eL(null),J(null),ee(0),["editor","text"].includes(IF(e.name,e.type))||IU(e.name)){en(!0);try{let t=await fetch(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(t.ok){let e=await t.json();J(e.content),ee(Number(t.headers.get("X-Wiki-Revision")??0))}}catch{}en(!1)}}(0,Q.useEffect)(()=>{eF.current=F},[F]),(0,Q.useEffect)(()=>{eH.current=eC},[eC]),(0,Q.useEffect)(()=>{eU.current=eV},[eV]),(0,Q.useEffect)(()=>{if(!t)return;let e=new Map,n=new EventSource("/api/wiki/watch");return n.onmessage=t=>{var n;let r;try{r=JSON.parse(t.data)}catch{return}let{type:i,path:o}=r,s=o.split("/");if(n=s.length>1?s.slice(0,-1).join("/"):"",e.has(n)&&clearTimeout(e.get(n)),e.set(n,setTimeout(()=>{e.delete(n),e$(n)},300)),"change"===i&&eF.current?.path===o&&!eH.current){let t=`__file__${o}`;e.has(t)&&clearTimeout(e.get(t)),e.set(t,setTimeout(()=>{e.delete(t),eU.current()},400))}},()=>{for(let t of(n.close(),e.values()))clearTimeout(t)}},[t,e$]),(0,Q.useEffect)(()=>{z(!1)},[]),(0,Q.useEffect)(()=>{if(!o||F&&F.path===o)return;let e=o.split("/").pop()??o;eK({path:o,name:e,type:"file"})},[o]),(0,Q.useEffect)(()=>{let e=new URL(window.location.href);F?e.searchParams.set("path",F.path):e.searchParams.delete("path"),window.history.replaceState(null,"",e.toString())},[F]),(0,Q.useEffect)(()=>{if(a.current||!d)return;let e=s.current;if(!e){a.current=!0;return}a.current=!0,(async()=>{let t=e.split("/"),n=t[t.length-1],r=t.slice(0,-1).join("/"),i=(await IG(r)).find(t=>t.path===e);i&&(await ez(e),eK({path:e,name:n,type:i.type,modifiedAt:i.modifiedAt}))})()},[d,ez]);let eY=async()=>{await fetch("/api/system/clear-root",{method:"POST"}),H(null),J(null),e_(!1),c([]),u(!1),f.current=!1,i(null),n(!1)};async function eX(){if(!F)return;eD(!0),eL(null);let e=await fetch("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:F.path,content:eM,baseRevision:Z})});if(e.ok){let t=await e.json();"number"==typeof t.revision&&ee(t.revision),J(eM),e_(!1)}else eL((await e.json()).error??"Save failed");eD(!1)}let eQ=(0,Q.useCallback)(async(e,t)=>{let n=Array.from(e);if(n.length){y(!0),v(null);try{for(let e of n){let n=new FormData;n.append("file",e),n.append("dir",t);let r=await fetch("/api/wiki/upload",{method:"POST",body:n});if(!r.ok){let e=await r.json();v(e.error??"Upload failed"),_o(e.error??"Upload failed");break}}await e$(t)}catch{v("Upload failed.")}finally{y(!1),E.current&&(E.current.value="")}}},[e$]);function eJ(e){w.current=e,E.current?.click()}async function eZ(){let e=N.trim();if(!e||null===k)return;C(null);let t=k?`${k}/${e}`:e,n=await fetch("/api/wiki/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});n.ok?(T(null),A(""),await e$(k),""!==k&&c(e=>Iq(e,k,e=>({...e,expanded:!0})))):C((await n.json()).error??"Failed")}async function e0(){let e=O.trim();if(!e||null===_)return;R(null);let t=e.includes(".")?e:`${e}.md`,n=_?`${_}/${t}`:t,r=await fetch("/api/wiki/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});r.ok?(M(null),I(""),await e$(_),""!==_&&c(e=>Iq(e,_,e=>({...e,expanded:!0}))),eK({path:n,name:t,type:"file",modifiedAt:new Date().toISOString()})):R((await r.json()).error??"Failed")}async function e1(){L&&(await fetch("/api/wiki",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:L})}),(F?.path===L||F?.path.startsWith(`${L}/`))&&(H(null),J(null)),c(e=>(function e(t,n){return t.filter(e=>e.path!==n).map(t=>t.children?{...t,children:e(t.children,n)}:t)})(e,L)),P(null))}function e2(e,t,n){e.preventDefault(),e.stopPropagation();let r=eP.current;!r||r.path===t||t.startsWith(`${r.path}/`)||(e.dataTransfer.dropEffect="move",eB("root"===n?"":t))}async function e3(e,t){e.preventDefault(),e.stopPropagation(),eB(null);let n=eP.current;if(eP.current=null,!n||n.path===t||t.startsWith(`${n.path}/`))return;let r=t?`${t}/${n.name}`:n.name;if(r!==n.path&&(await fetch("/api/wiki/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:n.path,to:r})})).ok){let e=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"";await e$(e),t!==e&&await e$(t),F?.path===n.path&&H({path:r,name:n.name,nodeType:F.nodeType})}}let e5=F?IF(F.name,F.nodeType):null,e4=Ey(e=>e.width),e6=null===e5||"editor"===e5||"text"===e5||"source"===e5||"notebook"===e5||"fallback"===e5,e9=e6?Ef[e4]:"";return(0,X.jsxs)("div",{className:"flex h-screen gap-0 overflow-hidden bg-background",children:[null===t&&(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsx)(eg,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!1===t&&(0,X.jsx)(MC,{onSelect:e=>{u(!1),f.current=!1,i(e),n(!0)}}),!0===t&&(0,X.jsxs)(X.Fragment,{children:[!q&&(0,X.jsxs)(Ig,{className:"flex flex-col w-72 shrink-0 overflow-hidden rounded-none border-r border-l-0 border-t-0 border-b-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-5 w-5 shrink-0"}),(0,X.jsx)("span",{className:"truncate text-xs font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 shrink-0",title:"Collapse sidebar",onClick:()=>V(!0),children:(0,X.jsx)(ey,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 border-b bg-muted/50 shrink-0",children:[(0,X.jsxs)(OZ,{children:[(0,X.jsx)(O1,{asChild:!0,children:(0,X.jsxs)(tG,{size:"sm",variant:"ghost",className:"h-7 gap-1 px-2 text-xs",disabled:b,children:[b?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eE,{className:"h-3.5 w-3.5"}),"New",(0,X.jsx)(es,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ii,{align:"start",className:"w-44",children:[(0,X.jsxs)(Io,{onClick:()=>{M(""),I(""),R(null)},children:[(0,X.jsx)(ec,{className:"mr-2 h-3.5 w-3.5"}),"New file"]}),(0,X.jsxs)(Io,{onClick:()=>{T(""),A(""),C(null)},children:[(0,X.jsx)(ep,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}),(0,X.jsxs)(Io,{onClick:()=>eJ(""),disabled:b,children:[(0,X.jsx)(eA,{className:"mr-2 h-3.5 w-3.5"}),"Upload"]})]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh tree",onClick:eq,disabled:m,children:m?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(Ic,{}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"AI Agent panel",onClick:()=>Ee.getState().toggle(),children:(0,X.jsx)(ei,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Settings",onClick:()=>K(!0),children:(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})})]})]}),x&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),x]}),""===k&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(eu,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:N,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eZ(),"Escape"===e.key&&(T(null),A(""))}}),S&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:S}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:eZ,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{T(null),A("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),""===_&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:O,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&e0(),"Escape"===e.key&&(M(null),I(""))}}),D&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:D}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:e0,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{M(null),I("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),(0,X.jsx)("div",{className:tz("flex-1 overflow-auto py-1",""===ej&&"ring-2 ring-inset ring-primary bg-primary/5"),onDragOver:e=>e2(e,"","root"),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||eB(null)},onDrop:e=>e3(e,""),children:h?(0,X.jsx)("div",{className:"flex justify-center py-6",children:(0,X.jsx)(eg,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===l.length?(0,X.jsxs)("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[(0,X.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,X.jsx)(ed,{className:"h-6 w-6 text-muted-foreground"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:"No files yet"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload files or add them to the configured directory"})]}),(0,X.jsxs)(tG,{size:"sm",variant:"outline",className:"w-full gap-1.5 max-w-[180px]",onClick:()=>eJ(""),disabled:b,children:[b?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eA,{className:"h-3.5 w-3.5"}),"Upload Files"]})]}):function e(t,n=0){return t.map(t=>(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{role:"treeitem",tabIndex:0,draggable:!0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),"dir"===t.type?eW(t):"app"===t.type?(eK(t),eW(t)):eK(t))},onDragStart:e=>{eP.current=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.path)},onDragOver:e=>"dir"===t.type?e2(e,t.path,"dir"):e.preventDefault(),onDragLeave:()=>eB(null),onDrop:e=>"dir"===t.type?e3(e,t.path):e.preventDefault(),className:tz("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer group transition-colors select-none",F?.path===t.path?"bg-accent text-accent-foreground":"hover:bg-accent/50",ej===t.path&&"ring-2 ring-primary bg-primary-soft",t.name.startsWith(".")&&"opacity-40"),style:{paddingLeft:`${14*n+8}px`},onClick:()=>{"dir"===t.type?eW(t):"app"===t.type?(eK(t),eW(t)):eK(t)},children:["dir"===t.type||"app"===t.type?t.loading?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):t.expanded?(0,X.jsx)(es,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)(ea,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),"dir"===t.type?t.expanded?(0,X.jsx)(eh,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-warning")}):(0,X.jsx)(eu,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-warning")}):"app"===t.type?(0,X.jsx)(ef,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-accent")}):"node-app"===t.type?(0,X.jsx)(eT,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-emerald-500")}):"html"===IF(t.name,"file")?(0,X.jsx)(ef,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-accent/70")}):I$(t.name)?(0,X.jsx)(em,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-sunshine-700")}):IU(t.name)?(0,X.jsx)(ed,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-accent")}):(0,X.jsx)(el,{className:tz("h-4 w-4 shrink-0",F?.path!==t.path&&"text-muted-foreground")}),(0,X.jsx)("span",{className:"flex-1 truncate",children:t.name}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:["dir"===t.type&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"New file here (default .md)",onClick:async()=>{t.expanded||await eW(t),M(t.path),I(""),R(null)},children:(0,X.jsx)(ec,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"Upload here",onClick:()=>eJ(t.path),children:(0,X.jsx)(eA,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"New subfolder",onClick:()=>{T(t.path),A(""),C(null)},children:(0,X.jsx)(ep,{className:"h-3 w-3"})})]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-destructive hover:text-destructive",title:"Delete",onClick:()=>{P(t.path),B("file"!==t.type)},children:(0,X.jsx)(eN,{className:"h-3 w-3"})})]})]}),k===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(eu,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:N,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eZ(),"Escape"===e.key&&(T(null),A(""))}}),S&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:S}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:eZ,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{T(null),A("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),_===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:O,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&e0(),"Escape"===e.key&&(M(null),I(""))}}),D&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:D}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:e0,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{M(null),I("")},children:(0,X.jsx)(eS,{className:"h-3 w-3"})})]}),("dir"===t.type||"app"===t.type)&&t.expanded&&t.children&&t.children.length>0&&e(t.children,n+1),("dir"===t.type||"app"===t.type)&&t.expanded&&t.children?.length===0&&(0,X.jsx)("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(n+1)*14+8+14+6+16+6}px`},children:"Empty"})]},t.path))}(l)}),(0,X.jsxs)("div",{className:"border-t px-3 py-2 flex items-center gap-2 bg-muted shrink-0",children:[(0,X.jsx)("span",{className:"flex-1 text-xs text-muted-foreground font-mono truncate",title:r??"",children:r??""}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-6 shrink-0 text-xs px-2 text-muted-foreground hover:text-foreground",onClick:eY,children:"Change"})]})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[q&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-7 w-7 p-0 rounded-full bg-background/50 backdrop-blur-xl backdrop-saturate-150 border border-white/[0.08] text-foreground/60 hover:text-foreground/90 hover:bg-background/70 shadow-[0_0_12px_rgba(0,0,0,0.15)] [transform:translate(-50%,-50%)_translateZ(0)]",title:"Show sidebar",onClick:()=>V(!1),children:(0,X.jsx)(ex,{className:"h-3.5 w-3.5"})}),F?"node-app"===e5?(0,X.jsx)(Mk,{path:F.path,title:F.name}):"app"===e5||"html"===e5?(e="html"===e5?`/api/assets/${F.path}`:void 0,U?(0,X.jsx)(Mx,{path:F.path,title:F.name,src:e,fullscreen:!0,onExit:()=>z(!1)}):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,X.jsx)(ef,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:F.path,children:F.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["html"===e5&&!eC&&null!==Y&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Edit source",onClick:()=>{e_(!0),eO(Y),eL(null)},children:(0,X.jsx)(ev,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:()=>G(e=>e+1),children:(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)(tG,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>z(!0),children:[(0,X.jsx)(eb,{className:"h-3.5 w-3.5"}),"Open fullscreen"]}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{H(null),e_(!1)},children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})})]})]}),eC&&"html"===e5?(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,X.jsx)("textarea",{value:eM,onChange:e=>eO(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"}),(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[eR&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:eR}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",onClick:()=>{e_(!1),eL(null)},children:"Cancel"}),(0,X.jsxs)(tG,{size:"sm",className:"gap-1",onClick:eX,disabled:eI,children:[eI&&(0,X.jsx)(eg,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)(Mx,{path:F.path,title:F.name,src:e},$)]})):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[I$(F.name)?(0,X.jsx)(em,{className:"h-4 w-4 shrink-0 text-sunshine-700"}):IU(F.name)?(0,X.jsx)(ed,{className:"h-4 w-4 shrink-0 text-accent"}):(0,X.jsx)(el,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:F.path,children:F.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[IU(F.name)&&!eC&&null!==Y&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{e_(!0),eO(Y),eL(null),Iz(F.name)&&Eu.getState().loadPage(F.path)},children:(0,X.jsx)(ev,{className:"h-3.5 w-3.5"})}),IU(F.name)&&!eC&&null!==Y&&(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:eV,disabled:et,children:et?(0,X.jsx)(eg,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ew,{className:"h-3.5 w-3.5"})}),e6&&(0,X.jsx)(Ij,{}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{H(null),J(null),e_(!1)},children:(0,X.jsx)(eS,{className:"h-3.5 w-3.5"})})]})]}),eC?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:Iz(F.name)?(0,X.jsx)(_p,{}):(0,X.jsx)("textarea",{value:eM,onChange:e=>eO(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"})}):(0,X.jsx)("div",{className:"flex-1 overflow-auto p-4 min-h-0",children:(0,X.jsx)("div",{className:tz("mx-auto w-full",e9),children:et?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(eg,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):"csv"===e5?(0,X.jsx)(rz,{path:F.path,title:F.name}):"pdf"===e5?(0,X.jsx)(Mf,{path:F.path,title:F.name}):"mermaid"===e5?(0,X.jsx)(_w,{path:F.path,title:F.name}):"notebook"===e5?(0,X.jsx)(Mc,{path:F.path,title:F.name}):"image"===e5?(0,X.jsx)(_m,{path:F.path,title:F.name}):"media"===e5?(0,X.jsx)(_g,{path:F.path,title:F.name,type:["mp4","webm","mov","m4v"].includes(IB(F.name))?"video":"audio"}):"docx"===e5?(0,X.jsx)(Mu,{path:F.path,title:F.name}):"xlsx"===e5?(0,X.jsx)(Mp,{path:F.path,title:F.name}):"pptx"===e5?(0,X.jsx)(Mh,{path:F.path,title:F.name}):"source"===e5?(0,X.jsx)(My,{path:F.path,title:F.name}):"fallback"===e5?(0,X.jsx)(_f,{path:F.path,title:F.name}):null!==Y?["md","markdown"].includes(IB(F.name))?(()=>{let{data:e,body:t}=function(e){let t=Iw.exec(e);if(!t)return{data:{},body:e};let n=t[1],r=e.slice(t[0].length),i=n.split(/\r?\n/).find(e=>""!==e.trim())??"";if(/^\s*(#{1,6}\s|<|>|-\s|\*\s|\d+\.\s)/.test(i))return{data:{},body:e};let o={},s=n.split(/\r?\n/),a=0;for(;a<s.length;){let e=s[a];if(!e||/^\s*#/.test(e)){a+=1;continue}let t=/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(e);if(!t){a+=1;continue}let n=t[1],r=t[2];if(""===r.trim()){let e=[],t=a+1;for(;t<s.length&&/^\s+-\s+/.test(s[t]);){let n=/^\s+-\s+(.*)$/.exec(s[t]);n&&e.push(Ik(n[1])),t+=1}if(e.length>0){o[n]=e,a=t;continue}o[n]="",a+=1;continue}o[n]=Ik(r),a+=1}return 0===Object.keys(o).length?{data:{},body:e}:{data:o,body:r}}(Y);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iv,{data:e}),(0,X.jsx)(IE,{markdown:t,pagePath:F.path,onNavigate:(e,t)=>{eK({path:e,name:e.split("/").pop()??e,type:"file"}),t&&setTimeout(()=>{document.getElementById(t)?.scrollIntoView({behavior:"smooth"})},200)}})]})})():(0,X.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words leading-relaxed",children:Y}):IU(F.name)?(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Could not load file."}):(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Preview not available for this file type."})})}),eC&&(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[eR&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:eR}),(0,X.jsx)(tG,{size:"sm",variant:"ghost",onClick:()=>{e_(!1),eL(null)},children:"Cancel"}),(0,X.jsxs)(tG,{size:"sm",className:"gap-1",onClick:eX,disabled:eI,children:[eI&&(0,X.jsx)(eg,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[(0,X.jsx)(ed,{className:"h-8 w-8 text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a file to view or edit"})]})})]}),(0,X.jsx)(Im,{open:W,onOpenChange:K}),(0,X.jsx)(IP,{currentPath:F?.path}),(0,X.jsx)("input",{ref:E,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&eQ(e.target.files,w.current)}}),(0,X.jsx)(rL,{open:!!L,onOpenChange:e=>{e||P(null)},title:j?"Delete folder?":"Delete file?",description:j?`"${L?.split("/").pop()}" and all its contents will be permanently deleted.`:`"${L?.split("/").pop()}" will be permanently removed.`,onConfirm:e1})]})]})}],952683)}]);
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end MCP benchmark — measures the FULL stack a remote agent crosses,
|
|
3
|
+
* minus the LLM: MCP stdio JSON-RPC -> shim fetch (keep-alive or not) -> HTTP
|
|
4
|
+
* -> Next standalone server -> route handler -> disk.
|
|
5
|
+
*
|
|
6
|
+
* It spawns the real Next standalone server on a loopback port with an
|
|
7
|
+
* isolated temp ROOT_DIR + temp HOME (seeded agent registry), then drives the
|
|
8
|
+
* REAL wiki-viewer-mcp shim over stdio via the MCP SDK client.
|
|
9
|
+
*
|
|
10
|
+
* Run from repo root:
|
|
11
|
+
* node packages/wiki-viewer-mcp/bench-e2e.mjs
|
|
12
|
+
* Requires: `npm run build` (root) and shim built (npm --prefix packages/wiki-viewer-mcp run build).
|
|
13
|
+
* Env: BENCH_ITERS (default 50), BENCH_WARMUP (default 10), BENCH_URL (skip spawning, hit a remote instance)
|
|
14
|
+
*/
|
|
15
|
+
import { spawn } from "node:child_process";
|
|
16
|
+
import { mkdtemp, writeFile, mkdir, rm } from "node:fs/promises";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
|
|
22
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
23
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
24
|
+
|
|
25
|
+
const ITERS = Number(process.env.BENCH_ITERS) || 50;
|
|
26
|
+
const WARMUP = Number(process.env.BENCH_WARMUP) || 10;
|
|
27
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
28
|
+
const REPO = path.resolve(HERE, "../..");
|
|
29
|
+
|
|
30
|
+
function sha256hex(buf) {
|
|
31
|
+
return createHash("sha256").update(buf).digest("hex");
|
|
32
|
+
}
|
|
33
|
+
function pct(s, p) { return s[Math.min(s.length - 1, Math.floor((p / 100) * s.length))]; }
|
|
34
|
+
function stats(label, samples) {
|
|
35
|
+
const s = [...samples].sort((a, b) => a - b);
|
|
36
|
+
const mean = s.reduce((a, b) => a + b, 0) / s.length;
|
|
37
|
+
return { label, p50: pct(s, 50), p95: pct(s, 95), p99: pct(s, 99), mean, max: s[s.length - 1] };
|
|
38
|
+
}
|
|
39
|
+
async function timeIt(fn) { const t = performance.now(); await fn(); return performance.now() - t; }
|
|
40
|
+
|
|
41
|
+
function waitForLog(child, re, timeoutMs = 30000) {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const to = setTimeout(() => reject(new Error("server start timeout")), timeoutMs);
|
|
44
|
+
const onData = (d) => {
|
|
45
|
+
const s = d.toString();
|
|
46
|
+
if (re.test(s)) { clearTimeout(to); child.stdout.off("data", onData); child.stderr.off("data", onData); resolve(); }
|
|
47
|
+
};
|
|
48
|
+
child.stdout.on("data", onData);
|
|
49
|
+
child.stderr.on("data", onData);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function main() {
|
|
54
|
+
let serverProc = null;
|
|
55
|
+
let baseUrl = process.env.BENCH_URL;
|
|
56
|
+
let tmpHome, tmpRoot;
|
|
57
|
+
const TOKEN = randomBytes(32).toString("hex");
|
|
58
|
+
const AGENT_ID = "ai:bench";
|
|
59
|
+
|
|
60
|
+
if (!baseUrl) {
|
|
61
|
+
const PORT = 3917;
|
|
62
|
+
tmpHome = await mkdtemp(path.join(tmpdir(), "bench-e2e-home-"));
|
|
63
|
+
tmpRoot = await mkdtemp(path.join(tmpdir(), "bench-e2e-root-"));
|
|
64
|
+
// Seed registry: ~/.wiki-viewer/agents.json with our agent + hashed token
|
|
65
|
+
const tokenHash = sha256hex(TOKEN);
|
|
66
|
+
await mkdir(path.join(tmpHome, ".wiki-viewer"), { recursive: true });
|
|
67
|
+
const now = new Date().toISOString();
|
|
68
|
+
await writeFile(
|
|
69
|
+
path.join(tmpHome, ".wiki-viewer", "agents.json"),
|
|
70
|
+
JSON.stringify({
|
|
71
|
+
version: 1,
|
|
72
|
+
agents: {
|
|
73
|
+
[AGENT_ID]: {
|
|
74
|
+
id: AGENT_ID, displayName: "Bench", tokenHash,
|
|
75
|
+
scope: { paths: ["**/*"], ops: ["read", "mutate", "delete"] },
|
|
76
|
+
createdAt: now, lastSeen: now,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
}, null, 2),
|
|
80
|
+
{ mode: 0o600 },
|
|
81
|
+
);
|
|
82
|
+
await writeFile(path.join(tmpRoot, "bench.md"), "# Doc\n\n" + "lorem ipsum dolor sit amet. ".repeat(40));
|
|
83
|
+
|
|
84
|
+
serverProc = spawn("node", [path.join(REPO, ".next/standalone/server.js")], {
|
|
85
|
+
env: {
|
|
86
|
+
...process.env,
|
|
87
|
+
HOME: tmpHome,
|
|
88
|
+
ROOT_DIR: tmpRoot,
|
|
89
|
+
PORT: String(PORT),
|
|
90
|
+
HOSTNAME: "127.0.0.1",
|
|
91
|
+
WIKI_ALLOW_INSECURE: "1",
|
|
92
|
+
NODE_ENV: "production",
|
|
93
|
+
},
|
|
94
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
95
|
+
});
|
|
96
|
+
await waitForLog(serverProc, /Ready|started server|Listening|localhost:|127\.0\.0\.1:/i);
|
|
97
|
+
baseUrl = `http://127.0.0.1:${PORT}`;
|
|
98
|
+
// settle
|
|
99
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Drive the REAL shim over stdio
|
|
103
|
+
const transport = new StdioClientTransport({
|
|
104
|
+
command: "node",
|
|
105
|
+
args: [path.join(HERE, "dist/index.js")],
|
|
106
|
+
env: {
|
|
107
|
+
...process.env,
|
|
108
|
+
WIKI_VIEWER_URL: baseUrl,
|
|
109
|
+
WIKI_VIEWER_TOKEN: TOKEN,
|
|
110
|
+
WIKI_VIEWER_AGENT_ID: AGENT_ID,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
const client = new Client({ name: "bench", version: "0" }, { capabilities: {} });
|
|
114
|
+
await client.connect(transport);
|
|
115
|
+
|
|
116
|
+
const call = (name, args) => client.callTool({ name, arguments: args });
|
|
117
|
+
|
|
118
|
+
const bodyBase = "# Doc\n\n" + "lorem ipsum dolor sit amet. ".repeat(40);
|
|
119
|
+
|
|
120
|
+
// Warm + measure read_file
|
|
121
|
+
const readS = [], writeS = [], editS = [];
|
|
122
|
+
for (let i = 0; i < WARMUP + ITERS; i++) {
|
|
123
|
+
const t = await timeIt(async () => { await call("read_file", { path: "bench.md" }); });
|
|
124
|
+
if (i >= WARMUP) readS.push(t);
|
|
125
|
+
}
|
|
126
|
+
// write_file (whole file) — read once to prime sha cache in shim
|
|
127
|
+
await call("read_file", { path: "bench.md" });
|
|
128
|
+
for (let i = 0; i < WARMUP + ITERS; i++) {
|
|
129
|
+
const t = await timeIt(async () => {
|
|
130
|
+
await call("write_file", { path: "bench.md", content: bodyBase + "\n\nw " + i, force: true });
|
|
131
|
+
});
|
|
132
|
+
if (i >= WARMUP) writeS.push(t);
|
|
133
|
+
}
|
|
134
|
+
// edit_file (read+replace+write inside one tool call)
|
|
135
|
+
await call("write_file", { path: "bench.md", content: bodyBase + "\n\nseed", force: true });
|
|
136
|
+
for (let i = 0; i < WARMUP + ITERS; i++) {
|
|
137
|
+
const find = i === 0 ? "seed" : "e " + (i - 1);
|
|
138
|
+
const t = await timeIt(async () => {
|
|
139
|
+
await call("edit_file", { path: "bench.md", find, replace: "e " + i });
|
|
140
|
+
});
|
|
141
|
+
if (i >= WARMUP) editS.push(t);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const results = [stats("read_file", readS), stats("write_file (whole-file)", writeS), stats("edit_file (read+write)", editS)];
|
|
145
|
+
console.log(`\nE2E MCP benchmark — full stack minus LLM (iters=${ITERS}, warmup=${WARMUP})`);
|
|
146
|
+
console.log(`target: ${baseUrl}${serverProc ? " (local standalone)" : " (remote)"}\n`);
|
|
147
|
+
console.log(["tool".padEnd(26), "p50", "p95", "p99", "mean", "max"].join(" "));
|
|
148
|
+
for (const r of results) {
|
|
149
|
+
console.log([
|
|
150
|
+
r.label.padEnd(26),
|
|
151
|
+
`${r.p50.toFixed(1)}ms`.padStart(8),
|
|
152
|
+
`${r.p95.toFixed(1)}ms`.padStart(8),
|
|
153
|
+
`${r.p99.toFixed(1)}ms`.padStart(8),
|
|
154
|
+
`${r.mean.toFixed(1)}ms`.padStart(8),
|
|
155
|
+
`${r.max.toFixed(1)}ms`.padStart(8),
|
|
156
|
+
].join(" "));
|
|
157
|
+
}
|
|
158
|
+
console.log("");
|
|
159
|
+
|
|
160
|
+
await client.close();
|
|
161
|
+
if (serverProc) serverProc.kill("SIGTERM");
|
|
162
|
+
if (tmpHome) await rm(tmpHome, { recursive: true, force: true });
|
|
163
|
+
if (tmpRoot) await rm(tmpRoot, { recursive: true, force: true });
|
|
164
|
+
process.exit(0);
|
|
165
|
+
}
|
|
166
|
+
main().catch((e) => { console.error(e); process.exit(1); });
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Latency-model benchmark: proves how per-call TCP/TLS handshakes (no keep-alive)
|
|
3
|
+
* vs pooled keep-alive connections behave under WAN-like RTT.
|
|
4
|
+
*
|
|
5
|
+
* It does NOT need the full Next server — it runs a tiny local HTTP server that
|
|
6
|
+
* sleeps RTT/2 before responding (modeling one-way latency), then compares:
|
|
7
|
+
* A) fetch with a fresh connection each call (no keep-alive)
|
|
8
|
+
* B) fetch over a pooled keep-alive agent (undici)
|
|
9
|
+
*
|
|
10
|
+
* For each, it models a "write" (1 request) and an "edit" (2 requests: GET+PUT).
|
|
11
|
+
*
|
|
12
|
+
* Run: node packages/wiki-viewer-mcp/bench-latency.mjs [rttMs]
|
|
13
|
+
*/
|
|
14
|
+
import http from "node:http";
|
|
15
|
+
import { Agent, fetch as undiciFetch } from "undici";
|
|
16
|
+
|
|
17
|
+
const RTT = Number(process.argv[2] ?? process.env.RTT_MS ?? 80); // round-trip ms
|
|
18
|
+
const ITERS = Number(process.env.ITERS ?? 30);
|
|
19
|
+
const ONE_WAY = RTT / 2;
|
|
20
|
+
|
|
21
|
+
function sleep(ms) { return new Promise((r) => setTimeout(r, ms)); }
|
|
22
|
+
|
|
23
|
+
// Local server that injects one-way latency on both receive and send.
|
|
24
|
+
const server = http.createServer(async (req, res) => {
|
|
25
|
+
// drain body
|
|
26
|
+
for await (const _ of req) { /* consume */ }
|
|
27
|
+
await sleep(ONE_WAY); // network: client -> server
|
|
28
|
+
res.writeHead(200, { "Content-Type": "application/json", ETag: '"sha256:abc"', "X-File-Size": "1024" });
|
|
29
|
+
res.end(JSON.stringify({ sha256: "sha256:abc", size: 1024 }));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function pct(s, p) { return s[Math.min(s.length - 1, Math.floor((p / 100) * s.length))]; }
|
|
33
|
+
function summarize(label, samples) {
|
|
34
|
+
const s = [...samples].sort((a, b) => a - b);
|
|
35
|
+
const mean = s.reduce((a, b) => a + b, 0) / s.length;
|
|
36
|
+
return `${label.padEnd(40)} p50=${pct(s, 50).toFixed(0)}ms p95=${pct(s, 95).toFixed(0)}ms mean=${mean.toFixed(0)}ms`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function bench(label, doCall) {
|
|
40
|
+
const samples = [];
|
|
41
|
+
for (let i = 0; i < ITERS + 5; i++) {
|
|
42
|
+
const t = performance.now();
|
|
43
|
+
await doCall();
|
|
44
|
+
if (i >= 5) samples.push(performance.now() - t);
|
|
45
|
+
}
|
|
46
|
+
return summarize(label, samples);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function main() {
|
|
50
|
+
await new Promise((r) => server.listen(0, "127.0.0.1", r));
|
|
51
|
+
const port = server.address().port;
|
|
52
|
+
const base = `http://127.0.0.1:${port}/x`;
|
|
53
|
+
|
|
54
|
+
// A) No keep-alive: force a fresh connection per request.
|
|
55
|
+
const noKa = new Agent({ pipelining: 0, connections: 1, keepAliveTimeout: 1, keepAliveMaxTimeout: 1 });
|
|
56
|
+
// B) Pooled keep-alive.
|
|
57
|
+
const ka = new Agent({ keepAliveTimeout: 30_000, keepAliveMaxTimeout: 60_000, connections: 10 });
|
|
58
|
+
|
|
59
|
+
const req = (dispatcher, method) =>
|
|
60
|
+
undiciFetch(base, { method, dispatcher, headers: { "content-type": "application/octet-stream" }, body: method === "PUT" ? "x".repeat(1024) : undefined })
|
|
61
|
+
.then((r) => r.arrayBuffer());
|
|
62
|
+
|
|
63
|
+
// Model a COLD connection: TCP(1 RTT) + TLS(≈2 RTT) handshake before the
|
|
64
|
+
// request even goes out. Real HTTPS over WAN pays this on every call when
|
|
65
|
+
// the client doesn't reuse connections. We add it explicitly because
|
|
66
|
+
// loopback can't reproduce handshake cost.
|
|
67
|
+
const HANDSHAKE_RTTS = Number(process.env.HANDSHAKE_RTTS ?? 3); // TCP+TLS ≈ 3 RTT
|
|
68
|
+
const freshReq = async (method) => {
|
|
69
|
+
await sleep(HANDSHAKE_RTTS * RTT); // cold-connection handshake penalty
|
|
70
|
+
const d = new Agent({ keepAliveTimeout: 1, connections: 1 });
|
|
71
|
+
await req(d, method);
|
|
72
|
+
await d.close();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
console.log(`\nlatency model — RTT=${RTT}ms, iters=${ITERS}\n`);
|
|
76
|
+
console.log(await bench("write · fresh conn per call (no keep-alive)", () => freshReq("PUT")));
|
|
77
|
+
console.log(await bench("write · pooled keep-alive", () => req(ka, "PUT")));
|
|
78
|
+
console.log(await bench("edit · fresh conn per call (GET+PUT)", async () => { await freshReq("GET"); await freshReq("PUT"); }));
|
|
79
|
+
console.log(await bench("edit · pooled keep-alive (GET+PUT)", async () => { await req(ka, "GET"); await req(ka, "PUT"); }));
|
|
80
|
+
console.log("");
|
|
81
|
+
console.log("Note: 'fresh conn' pays TCP handshake (+~1 RTT) per call; real HTTPS adds TLS (+1-2 RTT).");
|
|
82
|
+
console.log("");
|
|
83
|
+
|
|
84
|
+
await noKa.close(); await ka.close();
|
|
85
|
+
server.close();
|
|
86
|
+
}
|
|
87
|
+
main().catch((e) => { console.error(e); process.exit(1); });
|