wiki-viewer 1.9.1 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +3 -0
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/routes-manifest.json +22 -0
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- 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/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- 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 +2 -2
- package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +3 -4
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +10 -11
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +4 -5
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +3 -4
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +3 -4
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +3 -4
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js +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/assets/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/[...all]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/auth/[...all]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/share/[token]/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/share/[token]/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/share/[token]/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/share/[token]/route.js +14 -0
- package/.next/standalone/.next/server/app/api/share/[token]/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/share/[token]/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/share/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/share/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/share/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/share/route.js +14 -0
- package/.next/standalone/.next/server/app/api/share/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/share/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/set-root/route.js +2 -2
- package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/upload/[...path]/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/content/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/slugs/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/api/wiki/watch/route.js +1 -1
- package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page.js +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/s/[token]/page/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/s/[token]/page/build-manifest.json +16 -0
- package/.next/standalone/.next/server/app/s/[token]/page/next-font-manifest.json +10 -0
- package/.next/standalone/.next/server/app/s/[token]/page/react-loadable-manifest.json +1 -0
- package/.next/standalone/.next/server/app/s/[token]/page/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/s/[token]/page.js +14 -0
- package/.next/standalone/.next/server/app/s/[token]/page.js.map +5 -0
- package/.next/standalone/.next/server/app/s/[token]/page.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/signin/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/signin/page.js +2 -2
- package/.next/standalone/.next/server/app/signin/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/chunks/0dti_kysely_dist_esm_0u.fq2l._.js +1 -1
- package/.next/standalone/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0d2jbo5.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01hp8ax._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__02scxiu._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__07nnfjx._.js +16 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12q8ch8._.js → [root-of-the-server]__08n~vj1._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__09s9qkd._.js +1 -1
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12ee_s6._.js → [root-of-the-server]__0bfl4v7._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0n3i3vu._.js +16 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ncjv3e._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s8ovh5._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0~.-3yk._.js → [root-of-the-server]__0x3m4up._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yzle76._.js +20 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z.pwwj._.js +20 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zgb.q2._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__00qu86p._.js → [root-of-the-server]__0zq0rlw._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-inabx._.js → [root-of-the-server]__12y5z5j._.js} +2 -2
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_share_[token]_route_actions_0~m-o26.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_share_route_actions_0gz4h.j.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules__pnpm_0aj5g-w._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_auth_admin_ts_0g4i6v_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/08s9_dagre-d3-es_src_dagre_index_0iwjukf.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_0p1dt3f.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_0hyln.b._.js → 0~w0_katex_dist_katex_mjs_03gdxkb._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_diagram-OG6HWLK6_mjs_0t5sus6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_erDiagram-TEJ5UH35_mjs_0v6rnqy._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_sankeyDiagram-5OEKKPKP_mjs_11ifrnu._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_mermaid_core_mjs_0hj_n-~._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__00lk0r~._.js → [root-of-the-server]__06mzg2t._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oh...2._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0osa2xb._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__02twzph._.js → [root-of-the-server]__0xwdc44._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0du58sw._.js → [root-of-the-server]__0~2q.a0._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0r9zg10._.js +115 -0
- package/.next/standalone/.next/server/chunks/ssr/_0wmhtx3._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0~a9dyk._.js +115 -0
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_s_[token]_page_actions_0bubzp7.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0s4yn43._.js → node_modules__pnpm_0-w6~h.._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0fh.6ir._.js → node_modules__pnpm_0.eeqiu._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0d~ida~._.js → node_modules__pnpm_016w5te._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0iikbcy._.js → node_modules__pnpm_04o4n28._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0elpfsb._.js → node_modules__pnpm_05bngu6._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xa.ko1._.js → node_modules__pnpm_05cs0sp._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_05~w-ok._.js → node_modules__pnpm_05w~588._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_00y7foi._.js → node_modules__pnpm_05~bobn._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0arbjru._.js → node_modules__pnpm_07jyfax._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0s8fvbn._.js → node_modules__pnpm_07s54yb._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c7u76a._.js → node_modules__pnpm_09ygxyg._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules__pnpm_0aq-myi._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_12.ymhl._.js → node_modules__pnpm_0dx-.0x._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0beormu._.js → node_modules__pnpm_0e.k7ds._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_03.1jli._.js → node_modules__pnpm_0fvoxey._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.kyqfq._.js → node_modules__pnpm_0klv8-e._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules__pnpm_0lzb-n~._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.~goq~._.js → node_modules__pnpm_0m4c6iy._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0dbr7c2._.js → node_modules__pnpm_0ms-2au._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0vyv.lz._.js → node_modules__pnpm_0nni9e7._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09d5yyu._.js → node_modules__pnpm_0oihvhk._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b5fla7._.js → node_modules__pnpm_0q0mf37._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_03z3na-._.js → node_modules__pnpm_0q2jvgv._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0mvih7b._.js → node_modules__pnpm_0qy4lz-._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09eo8jh._.js → node_modules__pnpm_0uea699._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0qd2ovj._.js → node_modules__pnpm_0xxpa5a._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0adm8h6._.js → node_modules__pnpm_0z4ojf1._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0tq8zs6._.js → node_modules__pnpm_11u67yf._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0fm6wcx._.js → node_modules__pnpm_13fk5i4._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +19 -0
- package/.next/standalone/.next/server/edge/chunks/0p91_next_dist_0nh.6nc._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/next-font-manifest.js +1 -1
- package/.next/standalone/.next/server/next-font-manifest.json +3 -0
- 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/03zepg.10g9nk.js +21 -0
- package/.next/standalone/.next/static/chunks/07pa3l2g0aoxc.css +2 -0
- package/.next/standalone/.next/static/chunks/07rj172u~.3lw.js +113 -0
- package/.next/standalone/.next/static/chunks/0cre2g95gqnc_.js +1 -0
- package/.next/standalone/.next/static/chunks/{144e01xuvhx~x.js → 0g5dv59skfo1z.js} +1 -1
- package/.next/standalone/.next/static/chunks/0l794ei7~55us.js +17 -0
- package/.next/standalone/.next/static/chunks/{14n5cp8rr-k_b.js → 0qiz7kkyaxa93.js} +1 -1
- package/.next/standalone/.next/static/chunks/0r9y0mkr29ns6.js +113 -0
- package/.next/standalone/.next/static/chunks/0vhw1us0pjfdy.js +1 -0
- package/.next/standalone/.next/static/chunks/{06iw_iy5e90d4.js → 0vp-ahhagxptc.js} +1 -1
- package/.next/standalone/.next/static/chunks/0xpx9ekm-~h19.js +1 -0
- package/.next/standalone/.next/static/chunks/{0b84.439zffwm.js → 0yhis._5rr6tc.js} +1 -1
- package/.next/standalone/.next/static/chunks/139g2hzko-flp.js +1 -0
- package/.next/standalone/.next/static/chunks/{turbopack-0lf4~b-ofzbm6.js → turbopack-12~z-mr7b9b50.js} +1 -1
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/src/app/api/share/[token]/route.ts +269 -0
- package/.next/standalone/src/app/api/share/route.ts +127 -0
- package/.next/standalone/src/app/globals.css +2 -0
- package/.next/standalone/src/app/page.tsx +21 -0
- package/.next/standalone/src/app/s/[token]/page.tsx +357 -0
- package/.next/standalone/src/components/share-dialog.tsx +307 -0
- package/.next/standalone/src/components/ui/switch.tsx +1 -1
- package/.next/standalone/src/lib/shared-docs/db.ts +177 -0
- package/.next/standalone/src/middleware.ts +1 -0
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-244bv._.js +0 -16
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__012753j._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__03p0ob1._.js +0 -16
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gda_iu._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jk1uf4._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nd.b_c._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13aid91._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +0 -131
- package/.next/standalone/.next/static/chunks/09-jtayuhrq~b.js +0 -1
- package/.next/standalone/.next/static/chunks/0vp2gi~fq70je.js +0 -21
- package/.next/standalone/.next/static/chunks/125_k3o0s4cid.js +0 -129
- package/.next/standalone/.next/static/chunks/135c~rq_ux73w.js +0 -1
- package/.next/standalone/.next/static/chunks/167ph4xws_-61.css +0 -2
- /package/.next/standalone/.next/static/{NN8w2BNeE9aJeGzUsWJ8G → 30WI22NYlyxn2Cei0x9Om}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{NN8w2BNeE9aJeGzUsWJ8G → 30WI22NYlyxn2Cei0x9Om}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{NN8w2BNeE9aJeGzUsWJ8G → 30WI22NYlyxn2Cei0x9Om}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,952683,e=>{"use strict";var t=e.i(44501),a=e.i(425732),n=e.i(605993);let s=(0,n.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var r=e.i(43240),i=e.i(367092),l=e.i(10137),o=e.i(391548);let c=(0,n.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var d=e.i(73302),u=e.i(530229),p=e.i(764143),m=e.i(916767);let h=(0,n.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),x=(0,n.default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var f=e.i(845478),g=e.i(375707),g=g,b=e.i(702166),w=e.i(691520);let y=(0,n.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),v=(0,n.default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),N=(0,n.default)("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),k=(0,n.default)("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),j=(0,n.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),_=(0,n.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),E=(0,n.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),C=(0,n.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),S=(0,n.default)("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),M=(0,n.default)("share",[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]]),A=(0,n.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),O=(0,n.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);var T=e.i(920978),D=e.i(924782),I=e.i(22245),R=e.i(101685),L=e.i(519455),F=e.i(776639);function B({open:e,onOpenChange:a,title:n,description:s,confirmLabel:r="Delete",onConfirm:i,variant:l="destructive"}){return(0,t.jsx)(F.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(F.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsx)(F.DialogTitle,{children:n}),(0,t.jsx)(F.DialogDescription,{children:s})]}),(0,t.jsxs)(F.DialogFooter,{className:"gap-2 sm:gap-0",children:[(0,t.jsx)(L.Button,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),(0,t.jsx)(L.Button,{variant:l,onClick:()=>{i(),a(!1)},children:r})]})]})})}var P=e.i(313393);let z=(0,n.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var $=e.i(671485),U=e.i(975157);function q({path:e,badge:a,sublabel:n,showBreadcrumb:s=!0,leading:r,children:i,className:l}){return(0,t.jsxs)("div",{className:(0,U.cn)("flex shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-4 py-2",l),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r,e&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",title:e,children:e.split("/").pop()??e}),a&&(0,t.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground/50",children:a}),n&&(0,t.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground/40",children:n})]}),(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:i})]})}function K(e){let t=[],a="",n=!1,s=[];for(let r=0;r<e.length;r++){let i=e[r],l=e[r+1];n?'"'===i&&'"'===l?(a+='"',r++):'"'===i?n=!1:a+=i:'"'===i?n=!0:","===i?(s.push(a),a=""):"\n"===i||"\r"===i&&"\n"===l?(s.push(a),a="",s.length>0&&t.push(s),s=[],"\r"===i&&r++):a+=i}return s.push(a),s.some(e=>""!==e)&&t.push(s),t}function H(e){return e.map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n")}function W({path:e}){let[a,n]=(0,R.useState)([]),[s,r]=(0,R.useState)(""),[i,l]=(0,R.useState)(!1),[o,d]=(0,R.useState)(!1),[u,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(null),x=`/api/assets/${e}`;(0,R.useEffect)(()=>{(0,$.wsFetch)(x).then(e=>e.text()).then(e=>{r(e),n(K(e)),d(!1)})},[x]);let f=(0,R.useCallback)((e,t,a)=>{n(n=>{let s=n.map(e=>[...e]);for(;s.length<=e;)s.push([]);for(;s[e].length<=t;)s[e].push("");return s[e][t]=a,s}),d(!0)},[]),g=async()=>{p(!0);let t=i?s:H(a);try{await (0,$.wsFetch)(`/api/assets/${e}`,{method:"PUT",headers:{"Content-Type":"text/plain"},body:t}),i?n(K(s)):r(t),d(!1)}catch(e){console.error("Failed to save CSV:",e)}p(!1)},b=a[0]||[],w=a.slice(1);return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsxs)(q,{path:e,badge:`CSV${a.length>0?` (${a.length-1} rows)`:""}`,children:[o&&(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:g,disabled:u,children:[(0,t.jsx)(z,{className:"h-3.5 w-3.5"}),u?"Saving...":"Save"]}),(0,t.jsxs)("button",{onClick:()=>{i?n(K(s)):r(H(a)),l(!i)},className:`flex items-center gap-1.5 px-2.5 py-1 text-[11px] rounded-md transition-colors border border-border ${i?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`,children:[(0,t.jsx)(P.Code2,{className:"h-3 w-3"}),i?"Table":"Source"]}),(0,t.jsx)("button",{onClick:()=>window.open(x,"_blank"),className:"inline-flex items-center justify-center rounded-md h-8 w-8 hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",title:"Download CSV",children:(0,t.jsx)(c,{className:"h-4 w-4"})})]}),i?(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,t.jsx)("textarea",{value:s,onChange:e=>{r(e.target.value),d(!0)},className:"w-full h-full min-h-[calc(100vh-12rem)] bg-transparent font-mono text-[13px] leading-relaxed resize-none focus:outline-none",spellCheck:!1})}):(0,t.jsxs)("div",{className:"flex-1 overflow-auto",children:[(0,t.jsxs)("table",{className:"w-full border-collapse text-[13px]",children:[(0,t.jsx)("thead",{className:"sticky top-0 z-10",children:(0,t.jsxs)("tr",{className:"bg-muted/80 backdrop-blur-sm",children:[(0,t.jsx)("th",{className:"border border-border px-1 py-1 text-center text-[10px] text-muted-foreground w-8",children:"#"}),b.map((e,a)=>(0,t.jsx)("th",{className:"border border-border px-3 py-1.5 text-left font-medium text-foreground min-w-[100px]",children:m?.r===0&&m?.c===a?(0,t.jsx)("input",{autoFocus:!0,className:"w-full bg-transparent outline-none",value:e,onChange:e=>f(0,a,e.target.value),onBlur:()=>h(null),onKeyDown:e=>{("Enter"===e.key||"Escape"===e.key)&&h(null),"Tab"===e.key&&(e.preventDefault(),h({r:0,c:a+1<b.length?a+1:0}))}}):(0,t.jsx)("span",{className:"cursor-text",onDoubleClick:()=>h({r:0,c:a}),children:e||" "})},a))]})}),(0,t.jsx)("tbody",{children:w.map((e,a)=>{let s=a+1;return(0,t.jsxs)("tr",{className:"hover:bg-accent/30 transition-colors group",children:[(0,t.jsxs)("td",{className:"border border-border px-1 py-1 text-center text-[10px] text-muted-foreground/50",children:[(0,t.jsx)("span",{className:"group-hover:hidden",children:a+1}),(0,t.jsx)("button",{className:"hidden group-hover:inline text-red-400 hover:text-red-300 text-[10px]",onClick:()=>{n(e=>e.filter((e,t)=>t!==s)),d(!0)},title:"Delete row",children:"×"})]}),b.map((a,n)=>{let r=e[n]??"",i=m?.r===s&&m?.c===n;return(0,t.jsx)("td",{className:"border border-border px-3 py-1.5",children:i?(0,t.jsx)("input",{autoFocus:!0,className:"w-full bg-transparent outline-none",value:r,onChange:e=>f(s,n,e.target.value),onBlur:()=>h(null),onKeyDown:e=>{"Escape"===e.key&&h(null),"Enter"===e.key&&h({r:s+1,c:n}),"Tab"===e.key&&(e.preventDefault(),e.shiftKey?h({r:s,c:Math.max(0,n-1)}):h({r:n+1>=b.length?s+1:s,c:n+1>=b.length?0:n+1}))}}):(0,t.jsx)("span",{className:"cursor-text",onDoubleClick:()=>h({r:s,c:n}),children:r||" "})},n)})]},a)})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-t border-border",children:[(0,t.jsx)("button",{onClick:()=>{let e=a[0]?.length||1;n(t=>[...t,Array(e).fill("")]),d(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-accent",children:"+ Add row"}),(0,t.jsx)("button",{onClick:()=>{n(e=>e.map(e=>[...e,""])),d(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-accent",children:"+ Add column"})]})]})]})}var G=e.i(912235);function V({path:e}){let a=(0,$.withWs)(`/api/assets/${e}`),n=e.split("/").pop()||e,s=n.includes(".")?n.split(".").pop()?.toUpperCase():"",r=async()=>{try{await (0,$.wsFetch)("/api/system/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}catch{}};return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsx)(q,{path:e,badge:s||void 0}),(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center max-w-sm",children:[(0,t.jsx)("div",{className:"flex size-16 items-center justify-center rounded-2xl bg-muted",children:(0,t.jsx)(d.File,{className:"size-8 text-muted-foreground/50"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:n}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"This file type can't be previewed in Cabinet."})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(L.Button,{variant:"outline",size:"sm",className:"gap-2",onClick:r,children:[(0,t.jsx)(h,{className:"h-4 w-4"}),"Open in Finder"]}),(0,t.jsxs)(L.Button,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>{let e=document.createElement("a");e.href=a,e.download=n,e.click()},children:[(0,t.jsx)(c,{className:"h-4 w-4"}),"Download"]})]})]})})]})}var Z=e.i(412473);function X({path:e,title:a}){let n=(0,$.withWs)(`/api/assets/${e}`),s=e.split("/").pop()||e,r=s.includes(".")?s.split(".").pop()?.toUpperCase():"IMG";return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsxs)(q,{path:e,badge:r,children:[(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=n,e.download=s,e.click()},children:[(0,t.jsx)(c,{className:"h-3.5 w-3.5"}),"Download"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),"Open in new tab"]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto flex items-center justify-center bg-[#1a1a1a] p-8",children:(0,t.jsx)("img",{src:n,alt:a,className:"max-w-full max-h-full object-contain rounded-md shadow-lg",style:{imageRendering:"auto"}})})]})}function Q({path:e,type:a}){let n=(0,$.withWs)(`/api/assets/${e}`),s=e.split("/").pop()||e,r=s.includes(".")?s.split(".").pop()?.toUpperCase():a.toUpperCase();return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsxs)(q,{path:e,badge:r,children:[(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=n,e.download=s,e.click()},children:[(0,t.jsx)(c,{className:"h-3.5 w-3.5"}),"Download"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),"Open in new tab"]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto flex items-center justify-center bg-[#1a1a1a] p-8",children:"video"===a?(0,t.jsx)("video",{src:n,controls:!0,className:"max-w-full max-h-full rounded-md shadow-lg",children:"Your browser does not support the video element."}):(0,t.jsxs)("div",{className:"w-full max-w-lg space-y-4",children:[(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm",children:s}),(0,t.jsx)("audio",{src:n,controls:!0,className:"w-full",children:"Your browser does not support the audio element."})]})})]})}var J=e.i(301138);let Y=(0,n.default)("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),ee=(0,n.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),et=(0,n.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function ea({path:a,title:n}){let[s,i]=(0,R.useState)(""),[l,d]=(0,R.useState)(""),[u,p]=(0,R.useState)(""),[m,h]=(0,R.useState)(!0),[x,f]=(0,R.useState)(!1),[g,b]=(0,R.useState)(!1),[w,y]=(0,R.useState)(1),[v,N]=(0,R.useState)({x:0,y:0}),[k,j]=(0,R.useState)(!1),_=(0,R.useRef)({x:0,y:0,panX:0,panY:0}),E=(0,R.useRef)(null),C=(0,R.useRef)(null),S=(0,R.useRef)(0),M=(0,R.useCallback)(e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-.25:.25;y(e=>Math.min(Math.max(e+t,.25),5))}},[]),A=(0,R.useCallback)(e=>{0===e.button&&(j(!0),_.current={x:e.clientX,y:e.clientY,panX:v.x,panY:v.y},e.target.setPointerCapture(e.pointerId))},[v]),O=(0,R.useCallback)(e=>{k&&N({x:_.current.panX+(e.clientX-_.current.x),y:_.current.panY+(e.clientY-_.current.y)})},[k]),T=(0,R.useCallback)(()=>{j(!1)},[]),D=(0,$.withWs)(`/api/assets/${a}`);a.split("/").pop();let I=(0,R.useCallback)(async()=>{h(!0),p("");try{let t=await (0,$.wsFetch)(D);if(!t.ok)throw Error("Failed to fetch file");let a=await t.text();i(a);let n=(await e.A(890793)).default;n.initialize({startOnLoad:!1,theme:document.documentElement.classList.contains("dark")?"dark":"default",securityLevel:"loose",suppressErrorRendering:!0}),await n.parse(a.trim());let s=`mermaid-${++S.current}`,{svg:r}=await n.render(s,a.trim());d(r)}catch(e){document.querySelectorAll('[id^="dmermaid-"], [id^="d"]:has(> .error-icon)').forEach(e=>e.remove()),p(e instanceof Error?e.message:"Failed to render diagram")}finally{h(!1)}},[D]);return(0,R.useEffect)(()=>{I()},[I]),(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsxs)(q,{path:a,badge:"MERMAID",children:[(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:`h-7 gap-1.5 text-xs ${x?"bg-muted":""}`,onClick:()=>f(e=>!e),children:[x?(0,t.jsx)(J.Eye,{className:"h-3.5 w-3.5"}):(0,t.jsx)(P.Code2,{className:"h-3.5 w-3.5"}),x?"Diagram":"Code"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{navigator.clipboard.writeText(s),b(!0),setTimeout(()=>b(!1),2e3)},children:[g?(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"}),g?"Copied":"Copy"]}),l&&!x&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"h-4 w-px bg-border mx-0.5"}),(0,t.jsx)(L.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>y(e=>Math.max(e-.25,.25)),title:"Zoom out",children:(0,t.jsx)(et,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground tabular-nums w-10 text-center select-none",children:[Math.round(100*w),"%"]}),(0,t.jsx)(L.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>y(e=>Math.min(e+.25,5)),title:"Zoom in",children:(0,t.jsx)(ee,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(L.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{y(1),N({x:0,y:0})},title:"Reset view",children:(0,t.jsx)(Y,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("div",{className:"h-4 w-px bg-border mx-0.5"})]}),l&&(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{if(!l)return;let e=new Blob([l],{type:"image/svg+xml"}),t=URL.createObjectURL(e),a=document.createElement("a");a.href=t,a.download=`${n}.svg`,a.click(),URL.revokeObjectURL(t)},children:[(0,t.jsx)(c,{className:"h-3.5 w-3.5"}),"SVG"]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:m?(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Rendering diagram..."}):x?(0,t.jsx)("pre",{className:"p-4 text-[13px] leading-relaxed font-mono bg-[#1e1e1e]",children:(0,t.jsx)("code",{children:s.split("\n").map((e,a)=>(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"inline-block w-12 pr-4 text-right text-[#858585] select-none shrink-0",children:a+1}),(0,t.jsx)("span",{className:"text-[#d4d4d4] flex-1",children:e||"\n"})]},a))})}):u?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-sm p-8",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsx)("div",{className:"h-10 w-10 rounded-full bg-red-500/10 flex items-center justify-center",children:(0,t.jsx)(P.Code2,{className:"h-5 w-5 text-red-500"})}),(0,t.jsx)("p",{className:"text-red-500 font-medium",children:"Diagram syntax error"})]}),(0,t.jsx)("pre",{className:"text-muted-foreground text-xs max-w-lg text-left bg-muted rounded-md p-3 overflow-auto whitespace-pre-wrap",children:u}),(0,t.jsx)(L.Button,{variant:"outline",size:"sm",onClick:()=>f(!0),children:"View source to fix"})]}):(0,t.jsx)("div",{ref:C,className:"relative w-full h-full overflow-hidden",style:{cursor:k?"grabbing":"grab"},onWheel:M,onPointerDown:A,onPointerMove:O,onPointerUp:T,children:(0,t.jsx)("div",{ref:E,className:"flex items-center justify-center p-8 min-h-full [&_svg]:max-w-full origin-center select-none",style:{transform:`translate(${v.x}px, ${v.y}px) scale(${w})`},dangerouslySetInnerHTML:{__html:l}})})})]})}var en=e.i(790070),es=e.i(944404),er=e.i(334609),ei=e.i(844552),el="[0-9](_*[0-9])*",eo=`\\.(${el})`,ec="[0-9a-fA-F](_*[0-9a-fA-F])*",ed={className:"number",variants:[{begin:`(\\b(${el})((${eo})|\\.)?|(${eo}))[eE][+-]?(${el})[fFdD]?\\b`},{begin:`\\b(${el})((${eo})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${eo})[fFdD]?\\b`},{begin:`\\b(${el})[fFdD]\\b`},{begin:`\\b0[xX]((${ec})\\.?|(${ec})?\\.(${ec}))[pP][+-]?(${el})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ec})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0},eu=e.i(441228),ep=e.i(576500),em="[0-9](_*[0-9])*",eh=`\\.(${em})`,ex="[0-9a-fA-F](_*[0-9a-fA-F])*",ef={className:"number",variants:[{begin:`(\\b(${em})((${eh})|\\.)?|(${eh}))[eE][+-]?(${em})[fFdD]?\\b`},{begin:`\\b(${em})((${eh})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${eh})[fFdD]?\\b`},{begin:`\\b(${em})[fFdD]\\b`},{begin:`\\b0[xX]((${ex})\\.?|(${ex})?\\.(${ex}))[pP][+-]?(${em})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ex})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};let eg=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],eb=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ew=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ey=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),ev=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),eN=ew.concat(ey).sort().reverse();var ek=e.i(194633),ej=e.i(32033),e_=e.i(623568);let eE=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],eC=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),eS=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),eM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),eA=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();var eO=e.i(42420),eT=e.i(278909);function eD(e){return e?"string"==typeof e?e:e.source:null}function eI(e){return eR("(?=",e,")")}function eR(...e){return e.map(e=>eD(e)).join("")}function eL(...e){let t;return"("+(("object"==typeof(t=e[e.length-1])&&t.constructor===Object?(e.splice(e.length-1,1),t):{}).capture?"":"?:")+e.map(e=>eD(e)).join("|")+")"}let eF=e=>eR(/\b/,e,/\w$/.test(e)?/\b/:/\B/),eB=["Protocol","Type"].map(eF),eP=["init","self"].map(eF),ez=["Any","Self"],e$=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],eU=["false","nil","true"],eq=["assignment","associativity","higherThan","left","lowerThan","none","right"],eK=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],eH=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],eW=eL(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),eG=eL(eW,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),eV=eR(eW,eG,"*"),eZ=eL(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),eX=eL(eZ,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),eQ=eR(eZ,eX,"*"),eJ=eR(/[A-Z]/,eX,"*"),eY=["attached","autoclosure",eR(/convention\(/,eL("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",eR(/objc\(/,eQ,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],e0=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];var e1=e.i(532270),e2=e.i(503658),e3=e.i(185503);let e5={arduino:function(e){let t,a,n,s,r,i,l,o,c,d,u,p,m,h,x,f,g=(t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="[a-zA-Z_]\\w*::",r="(?!struct)("+(n="decltype\\(auto\\)")+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",i={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},u=t.optional(s)+e.IDENT_RE+"\\s*\\(",x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p={type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]},contains:(h=[m={className:"function.dispatch",relevance:0,keywords:{_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},c,i,a,e.C_BLOCK_COMMENT_MODE,o,l]).concat([{begin:/\(/,end:/\)/,keywords:p,contains:h.concat(["self"]),relevance:0}]),relevance:0},f={className:"function",begin:"("+r+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[l,o]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,l,o,i,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,l,o,i]}]},i,a,e.C_BLOCK_COMMENT_MODE,c]},{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(x,f,m,h,[c,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:p,contains:["self",i]},{begin:e.IDENT_RE+"::",keywords:p},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}),b=g.keywords;return b.type=[...b.type,"boolean","byte","word","String"],b.literal=[...b.literal,"DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"],b.built_in=[...b.built_in,"KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],b._hints=["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],g.name="Arduino",g.aliases=["ino"],g.supersetOf="cpp",g},bash:es.default,c:function(e){let t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),n="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",r="("+n+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",i={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},l={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},u=t.optional(s)+e.IDENT_RE+"\\s*\\(",p={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},m=[c,i,a,e.C_BLOCK_COMMENT_MODE,o,l],h={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:m.concat([{begin:/\(/,end:/\)/,keywords:p,contains:m.concat(["self"]),relevance:0}]),relevance:0},x={begin:"("+r+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,l,o,i,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,l,o,i]}]},i,a,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C",aliases:["h"],keywords:p,disableAutodetect:!0,illegal:"</",contains:[].concat(h,x,m,[c,{begin:e.IDENT_RE+"::",keywords:p},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:l,keywords:p}}},cpp:function(e){let t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),n="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",r="(?!struct)("+n+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",i={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},u=t.optional(s)+e.IDENT_RE+"\\s*\\(",p={type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]},m={className:"function.dispatch",relevance:0,keywords:{_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},h=[m,c,i,a,e.C_BLOCK_COMMENT_MODE,o,l],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:h.concat([{begin:/\(/,end:/\)/,keywords:p,contains:h.concat(["self"]),relevance:0}]),relevance:0},f={className:"function",begin:"("+r+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[l,o]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,l,o,i,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,l,o,i]}]},i,a,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(x,f,m,h,[c,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:p,contains:["self",i]},{begin:e.IDENT_RE+"::",keywords:p},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}},csharp:function(e){let t={keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"]),built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],literal:["default","false","null","true"]},a=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),n={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},s={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},r=e.inherit(s,{illegal:/\n/}),i={className:"subst",begin:/\{/,end:/\}/,keywords:t},l=e.inherit(i,{illegal:/\n/}),o={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,l]},c={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},i]},d=e.inherit(c,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},l]});i.contains=[c,o,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,n,e.C_BLOCK_COMMENT_MODE],l.contains=[d,o,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,n,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let u={variants:[{className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},c,o,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},p={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},m=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",h={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:t,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},u,n,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+m+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:t,contains:[{beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial",relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,p],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:t,relevance:0,contains:[u,n,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},h]}},css:er.default,diff:function(e){let t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}},go:ei.default,graphql:function(e){let t=e.regex;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}},ini:function(e){let t=e.regex,a={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},n=e.COMMENT();n.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let s={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},r={className:"literal",begin:/\bon|off|true|false|yes|no\b/},i={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},l=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[n,{className:"section",begin:/\[+/,end:/\]+/},{begin:t.concat(l,"(\\s*\\.\\s*",l,")*",t.lookahead(/\s*=\s*[^#\s]/)),className:"attr",starts:{end:/$/,contains:[n,{begin:/\[/,end:/\]/,contains:[n,r,s,i,a,"self"],relevance:0},r,s,i,a]}}]}},java:function(e){let t=e.regex,a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",n=a+function e(t,a,n){return -1===n?"":t.replace(a,s=>e(t,a,n-1))}("(?:<"+a+"~~~(?:\\s*,\\s*"+a+"~~~)*>)?",/~~~/g,2),s={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},r={className:"meta",begin:"@"+a,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},i={className:"params",begin:/\(/,end:/\)/,keywords:s,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:s,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,a),/\s+/,a,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,a],className:{1:"keyword",3:"title.class"},contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+n+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:s,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:s,relevance:0,contains:[r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,ed,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},ed,r]}},javascript:eu.default,json:ep.default,kotlin:function(e){let t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},a={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},n={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,n]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,n]}]};n.contains.push(r);let i={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(r,{className:"string"}),"self"]}]},o=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),c={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]};return c.variants[1].contains=[c],c.variants[1].contains=[c],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,o,{className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},a,i,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[c,e.C_LINE_COMMENT_MODE,o],relevance:0},e.C_LINE_COMMENT_MODE,o,i,l,r,e.C_NUMBER_MODE]},o]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},i,l]},r,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:"\n"},ef]}},less:function(e){let t={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},a="[\\w-]+",n="("+a+"|@\\{"+a+"\\})",s=[],r=[],i=function(e){return{className:"string",begin:"~?"+e+".*?"+e}},l=function(e,t,a){return{className:e,begin:t,relevance:a}},o={$pattern:/[a-z-]+/,keyword:"and or not only",attribute:eb.join(" ")};r.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,i("'"),i('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,{begin:"\\(",end:"\\)",contains:r,keywords:o,relevance:0},l("variable","@@?"+a,10),l("variable","@\\{"+a+"\\}"),l("built_in","~?`[^`]*?`"),{className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);let c=r.concat({begin:/\{/,end:/\}/,contains:s}),d={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(r)},u={begin:n+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ev.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:r}}]},p={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:n,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:"[<='$\"]",relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,l("keyword","all\\b"),l("variable","@\\{"+a+"\\}"),{begin:"\\b("+eg.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,l("selector-tag",n,0),l("selector-id","#"+n),l("selector-class","\\."+n,0),l("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+ew.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+ey.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:c},{begin:"!important"},t.FUNCTION_DISPATCH]},m={begin:a+":(:)?"+`(${eN.join("|")})`,returnBegin:!0,contains:[p]};return s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:o,returnEnd:!0,contains:r,relevance:0}},{className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a}],starts:{end:"[;}]",returnEnd:!0,contains:c}},m,u,p,d,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:s}},lua:function(e){let t="\\[=*\\[",a="\\]=*\\]",n={begin:t,end:a,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,a,{contains:[n],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:a,contains:[n],relevance:5}])}},makefile:function(e){let t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},n={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,a,{className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,a]},n,{className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},{className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]}]}},markdown:ek.default,objectivec:function(e){let t=/[a-zA-Z@][a-zA-Z0-9_]*/,a={$pattern:t,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:{"variable.language":["this","super"],$pattern:t,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},illegal:"</",contains:[{className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+a.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:a,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}},perl:function(e){let t=e.regex,a=/[dualxmsipngr]{0,12}/,n={$pattern:/[\w.]+/,keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot class close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl field fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map method mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0"},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:n},r={begin:/->\{/,end:/\}/},i={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[i]},o={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},c=[e.BACKSLASH_ESCAPE,s,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],u=(e,n,s="\\1")=>{let r="\\1"===s?s:t.concat(s,n);return t.concat(t.concat("(?:",e,")"),n,/(?:\\.|[^\\\/])*?/,r,/(?:\\.|[^\\\/])*?/,s,a)},p=(e,n,s)=>t.concat(t.concat("(?:",e,")"),n,/(?:\\.|[^\\\/])*?/,s,a),m=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),r,{className:"string",contains:c,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},o,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:u("s|tr|y",t.either(...d,{capture:!0}))},{begin:u("s|tr|y","\\(","\\)")},{begin:u("s|tr|y","\\[","\\]")},{begin:u("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,i]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,i,o]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=m,r.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:n,contains:m}},php:function(e){let t,a=e.regex,n=/(?![A-Za-z0-9])(?![$])/,s=a.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),r=a.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=a.concat(/[A-Z]+/,n),l={scope:"variable",match:"\\$+"+s},o={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(o)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(o),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},p=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),m="[ \n]",h={scope:"string",variants:[d,c,u,p]},x={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},f=["false","null","true"],g=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],b=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],w={keyword:g,literal:(t=[],f.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t),built_in:b},y=e=>e.map(e=>e.replace(/\|\d+$/,"")),v={variants:[{match:[/new/,a.concat(m,"+"),a.concat("(?!",y(b).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},N=a.concat(s,"\\b(?!\\()"),k={variants:[{match:[a.concat(/::/,a.lookahead(/(?!class\b)/)),N],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,a.concat(/::/,a.lookahead(/(?!class\b)/)),N],scope:{1:"title.class",3:"variable.constant"}},{match:[r,a.concat("::",a.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},j={scope:"attr",match:a.concat(s,a.lookahead(":"),a.lookahead(/(?!::)/))},_={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[j,l,k,e.C_BLOCK_COMMENT_MODE,h,x,v]},E={relevance:0,match:[/\b/,a.concat("(?!fn\\b|function\\b|",y(g).join("\\b|"),"|",y(b).join("\\b|"),"\\b)"),s,a.concat(m,"*"),a.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[_]};_.contains.push(E);let C=[j,k,e.C_BLOCK_COMMENT_MODE,h,x,v],S={begin:a.concat(/#\[\s*\\?/,a.either(r,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:f,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:f,keyword:["new","array"]},contains:["self",...C]},...C,{scope:"meta",variants:[{match:r},{match:i}]}]};return{case_insensitive:!1,keywords:w,contains:[S,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},l,E,k,{match:[/const/,/\s/,s],scope:{1:"keyword",3:"variable.constant"}},v,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:w,contains:["self",S,l,k,e.C_BLOCK_COMMENT_MODE,h,x]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},h,x]}},"php-template":function(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}},plaintext:function(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}},python:ej.default,"python-repl":function(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}},r:function(e){let t=e.regex,a=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,n=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:a,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:a},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,n]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,n]},{scope:{1:"punctuation",2:"number"},match:[r,n]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,n]}]},{scope:{3:"operator"},match:[a,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}},ruby:function(e){let t=e.regex,a="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",n=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(n,/(::\w+)*/),r={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},i={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},o=[e.COMMENT("#","$",{contains:[i]}),e.COMMENT("^=begin","^=end",{contains:[i],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:r},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},u="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${u}))?([eE][+-]?(${u})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:r}]},h=[d,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:r},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:r},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:n,scope:"title.class"},{match:[/def/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:a}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:r},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,o),relevance:0}].concat(l,o);c.contains=h,m.contains=h;let x=[{begin:/^\s*=>/,starts:{end:"$",contains:h}},{className:"meta.prompt",begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])",starts:{end:"$",keywords:r,contains:h}}];return o.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:r,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(x).concat(o).concat(h)}},rust:e_.default,scss:function(e){let t={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},a="@[a-z-]+",n={className:"variable",begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+eE.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+eS.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+eM.join("|")+")"},n,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+eA.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,n,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:eC.join(" ")},contains:[{begin:a,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},n,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}},shell:eO.default,sql:eT.default,swift:function(e){let t={match:/\s+/,relevance:0},a=e.COMMENT("/\\*","\\*/",{contains:["self"]}),n=[e.C_LINE_COMMENT_MODE,a],s={match:[/\./,eL(...eB,...eP)],className:{2:"keyword"}},r={match:eR(/\./,eL(...e$)),relevance:0},i=e$.filter(e=>"string"==typeof e).concat(["_|0"]),l={variants:[{className:"keyword",match:eL(...e$.filter(e=>"string"!=typeof e).concat(ez).map(eF),...eP)}]},o={$pattern:eL(/\b\w+/,/#\w+/),keyword:i.concat(eK),literal:eU},c=[s,r,l],d=[{match:eR(/\./,eL(...eH)),relevance:0},{className:"built_in",match:eR(/\b/,eL(...eH),/(?=\()/)}],u={match:/->/,relevance:0},p=[u,{className:"operator",relevance:0,variants:[{match:eV},{match:`\\.(\\.|${eG})+`}]}],m="([0-9]_*)+",h="([0-9a-fA-F]_*)+",x={className:"number",relevance:0,variants:[{match:`\\b(${m})(\\.(${m}))?([eE][+-]?(${m}))?\\b`},{match:`\\b0x(${h})(\\.(${h}))?([pP][+-]?(${m}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},f=(e="")=>({className:"subst",variants:[{match:eR(/\\/,e,/[0\\tnr"']/)},{match:eR(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),g=(e="")=>({className:"subst",label:"interpol",begin:eR(/\\/,e,/\(/),end:/\)/}),b=(e="")=>({begin:eR(e,/"""/),end:eR(/"""/,e),contains:[f(e),((e="")=>({className:"subst",match:eR(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}))(e),g(e)]}),w=(e="")=>({begin:eR(e,/"/),end:eR(/"/,e),contains:[f(e),g(e)]}),y={className:"string",variants:[b(),b("#"),b("##"),b("###"),w(),w("#"),w("##"),w("###")]},v=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],N=e=>{let t=eR(e,/\//),a=eR(/\//,e);return{begin:t,end:a,contains:[...v,{scope:"comment",begin:`#(?!.*${a})`,end:/$/}]}},k={scope:"regexp",variants:[N("###"),N("##"),N("#"),{begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:v}]},j={match:eR(/`/,eQ,/`/)},_=[j,{className:"variable",match:/\$\d+/},{className:"variable",match:`\\$${eX}+`}],E=[{match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:e0,contains:[...p,x,y]}]}},{scope:"keyword",match:eR(/@/,eL(...eY),eI(eL(/\(/,/\s+/)))},{scope:"meta",match:eR(/@/,eQ)}],C={match:eI(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:eR(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,eX,"+")},{className:"type",match:eJ,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:eR(/\s+&\s+/,eI(eJ)),relevance:0}]},S={begin:/</,end:/>/,keywords:o,contains:[...n,...c,...E,u,C]};C.contains.push(S);let M={begin:/\(/,end:/\)/,relevance:0,keywords:o,contains:["self",{match:eR(eQ,/\s*:/),keywords:"_|0",relevance:0},...n,k,...c,...d,...p,x,y,..._,...E,C]},A={begin:/</,end:/>/,keywords:"repeat each",contains:[...n,C]},O={begin:/\(/,end:/\)/,keywords:o,contains:[{begin:eL(eI(eR(eQ,/\s*:/)),eI(eR(eQ,/\s+/,eQ,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:eQ}]},...n,...c,...p,x,y,...E,C,M],endsParent:!0,illegal:/["']/},T={match:[/(func|macro)/,/\s+/,eL(j.match,eQ,eV)],className:{1:"keyword",3:"title.function"},contains:[A,O,t],illegal:[/\[/,/%/]},D={begin:[/precedencegroup/,/\s+/,eJ],className:{1:"keyword",3:"title"},contains:[C],keywords:[...eq,...eU],end:/}/},I={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,eQ,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:o,contains:[A,...c,{begin:/:/,end:/\{/,keywords:o,contains:[{scope:"title.class.inherited",match:eJ},...c],relevance:0}]};for(let e of y.variants){let t=e.contains.find(e=>"interpol"===e.label);t.keywords=o;let a=[...c,...d,...p,x,y,..._];t.contains=[...a,{begin:/\(/,end:/\)/,contains:["self",...a]}]}return{name:"Swift",keywords:o,contains:[...n,T,{match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[A,O,t],illegal:/\[|%/},{match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},{match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},I,{match:[/operator/,/\s+/,eV],className:{1:"keyword",3:"title"}},D,{beginKeywords:"import",end:/$/,contains:[...n],relevance:0},k,...c,...d,...p,x,y,..._,...E,C,M]}},typescript:e1.default,vbnet:function(e){let t=e.regex,a=/\d{1,2}\/\d{1,2}\/\d{4}/,n=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,r=/\d{1,2}(:\d{1,2}){1,2}/,i={className:"literal",variants:[{begin:t.concat(/# */,t.either(n,a),/ *#/)},{begin:t.concat(/# */,r,/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,t.either(n,a),/ +/,t.either(s,r),/ *#/)}]},l=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),o=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i,{className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{className:"label",begin:/^\w+:/},l,o,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[o]}]}},wasm:function(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"]},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},{className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}},xml:e2.default,yaml:e3.default};var e4=e.i(993667),e9=e.i(797715);let e7=(0,e4.createLowlight)(e5);function e6(e){return Array.isArray(e)?e.join(""):e??""}let e8=/\x1b\[[0-9;]*[A-Za-z]/g;function te(e){return e.replace(e8,"")}function tt({output:e}){if("stream"===e.output_type){let a=te(e6(e.text)),n="stderr"===e.name;return(0,t.jsx)("pre",{className:`whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md ${n?"bg-[rgba(139,46,62,0.06)] text-[#8B2E3E]":"bg-[#F5EEDC] text-[#2A221B]"}`,children:a})}if("error"===e.output_type){let a=e.traceback.map(te).join("\n");return(0,t.jsxs)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[rgba(139,46,62,0.08)] text-[#8B2E3E] border border-[rgba(139,46,62,0.18)]",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[e.ename,": ",e.evalue]}),a?`
|
|
2
|
+
|
|
3
|
+
${a}`:""]})}let a=e.data||{};if(a["image/png"]){let e=`data:image/png;base64,${e6(a["image/png"]).replace(/\s/g,"")}`;return(0,t.jsx)("img",{src:e,alt:"output",className:"max-w-full rounded-md bg-card p-2"})}if(a["image/jpeg"]){let e=`data:image/jpeg;base64,${e6(a["image/jpeg"]).replace(/\s/g,"")}`;return(0,t.jsx)("img",{src:e,alt:"output",className:"max-w-full rounded-md bg-card p-2"})}if(a["image/svg+xml"]){let e=e6(a["image/svg+xml"]);return(0,t.jsx)("div",{className:"max-w-full rounded-md bg-card p-2 overflow-auto",dangerouslySetInnerHTML:{__html:e}})}if(a["text/html"]){let e=e6(a["text/html"]);return(0,t.jsx)("iframe",{srcDoc:`<!doctype html><html><head><base target="_blank"><style>body{margin:0;padding:8px;font-family:-apple-system,BlinkMacSystemFont,Inter,system-ui,sans-serif;background:#FFF9E9;color:#2A221B;font-size:13px}table{border-collapse:collapse}th,td{border:1px solid #D4C4B0;padding:4px 8px;text-align:left}thead{background:#EFE5CC}</style></head><body>${e}</body></html>`,sandbox:"allow-scripts",className:"w-full bg-[#FFF9E9] rounded-md border border-[#E8DDC5]",style:{height:360}})}return a["text/plain"]?(0,t.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[#F5EEDC] text-[#2A221B]",children:te(e6(a["text/plain"]))}):null}function ta({cell:e,language:a}){let n=e6(e.source),s=(0,R.useMemo)(()=>(function(e,t){try{let a=t?e7.highlight(t,e):e7.highlightAuto(e);return(0,en.toHtml)(a)}catch{return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}})(n,a),[n,a]),r=e.execution_count??" ",i=(e.outputs?.length??0)>0;return(0,t.jsxs)("div",{className:"grid grid-cols-[60px_1fr] gap-3 mb-5",children:[(0,t.jsxs)("div",{className:"text-right pt-3 select-none font-mono text-[11px] text-[#8B5E3C]",children:["In [",r,"]:"]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("pre",{className:"whitespace-pre overflow-x-auto font-mono text-[13px] leading-relaxed px-4 py-3 rounded-md bg-[#FFF9E9] border border-[#E8DDC5] text-[#2A221B]",children:(0,t.jsx)("code",{dangerouslySetInnerHTML:{__html:s}})}),i&&(0,t.jsxs)("div",{className:"mt-2 grid grid-cols-[60px_1fr] gap-3",children:[(0,t.jsxs)("div",{className:"text-right pt-3 select-none font-mono text-[11px] text-[#8B2E3E]",children:["Out[",r,"]:"]}),(0,t.jsx)("div",{className:"space-y-2",children:e.outputs?.map((e,a)=>(0,t.jsx)(tt,{output:e},a))})]})]})]})}function tn({cell:e}){let[a,n]=(0,R.useState)("");return(0,R.useEffect)(()=>{let t=!1;return(0,e9.markdownToHtml)(e6(e.source)).then(e=>{t||n(e)}),()=>{t=!0}},[e.source]),(0,t.jsx)("div",{className:"prose prose-sm max-w-none mb-5 px-1 [&_h1]:font-serif [&_h2]:font-serif [&_h3]:font-serif [&_a]:text-[#8B5E3C] [&_a:hover]:underline [&_code]:bg-[#F5EEDC] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-[#8B2E3E]",dangerouslySetInnerHTML:{__html:a}})}function ts({cell:e}){return(0,t.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[#F5EEDC] text-[#2A221B] mb-5",children:e6(e.source)})}function tr({path:e}){let[n,s]=(0,R.useState)(null),[i,l]=(0,R.useState)(!0),[d,u]=(0,R.useState)(null),[p,m]=(0,R.useState)(!1),h=(0,$.withWs)(`/api/assets/${e}`),x=e.split("/").pop()||e,f=(0,R.useCallback)(async()=>{l(!0),u(null);try{let e=await (0,$.wsFetch)(h);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();s(t)}catch(e){u(e instanceof Error?e.message:"Failed to load notebook")}finally{l(!1)}},[h]);(0,R.useEffect)(()=>{f()},[f]);let g=n?.metadata?.language_info?.name||n?.metadata?.kernelspec?.name||"python",b=n?.cells?.length??0,w=n?.cells?.filter(e=>"code"===e.cell_type).length??0,y=n?.cells?.some(e=>"code"===e.cell_type&&(e.outputs?.length??0)>0)??!1;return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsxs)(q,{path:e,badge:"IPYNB",sublabel:`${b} cells \xb7 ${w} code \xb7 ${g}`,children:[(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{navigator.clipboard.writeText(`jupyter lab ${e}`),m(!0),setTimeout(()=>m(!1),2e3)},title:"Copy: jupyter lab <path>",children:[p?(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"}),p?"Copied":"Copy run cmd"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=h,e.download=x,e.click()},children:[(0,t.jsx)(c,{className:"h-3.5 w-3.5"}),"Download"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(h,"_blank"),children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),"Raw JSON"]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto bg-[#F5EEDC]",children:i?(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-[#7A6B5D] text-sm",children:"Loading notebook…"}):d?(0,t.jsxs)("div",{className:"flex items-center justify-center h-full text-[#8B2E3E] text-sm gap-2",children:[(0,t.jsx)(a.AlertCircle,{className:"h-4 w-4"})," ",d]}):n?(0,t.jsxs)("div",{className:"max-w-[1100px] mx-auto py-8 px-6",children:[!y&&w>0&&(0,t.jsxs)("div",{className:"mb-6 rounded-md border border-[#E8DDC5] bg-[#FFF9E9] px-4 py-3 text-[13px] text-[#7A6B5D]",children:[(0,t.jsx)("span",{className:"font-semibold text-[#0c0a09]",children:"This notebook hasn't been run yet."})," ","Code and markdown cells display below; outputs appear once the author runs the notebook in Jupyter (or you do, then re-save)."]}),n.cells?.map((e,a)=>"markdown"===e.cell_type?(0,t.jsx)(tn,{cell:e},a):"raw"===e.cell_type?(0,t.jsx)(ts,{cell:e},a):(0,t.jsx)(ta,{cell:e,language:g},a))]}):null})]})}function ti({path:e,extLabel:a,external:n,hideFinder:s}){let r=(0,$.withWs)(`/api/assets/${e}`),i=e.split("/").pop()||e,l=async()=>{try{await (0,$.wsFetch)("/api/system/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}catch{}};return(0,t.jsxs)(q,{path:e,badge:a||void 0,children:[n&&(0,t.jsxs)("a",{href:n.href,target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-[11px] h-7 px-2.5 rounded-md border border-border hover:bg-accent transition-colors",children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),n.label]}),!s&&(0,t.jsxs)(L.Button,{variant:"outline",size:"sm",className:"gap-1.5 text-[11px] h-7",onClick:l,title:"Open in Finder",children:[(0,t.jsx)(h,{className:"h-3.5 w-3.5"}),"Reveal"]}),!s&&(0,t.jsxs)(L.Button,{variant:"outline",size:"sm",className:"gap-1.5 text-[11px] h-7",onClick:()=>{let e=document.createElement("a");e.href=r,e.download=i,e.click()},title:"Download original",children:[(0,t.jsx)(c,{className:"h-3.5 w-3.5"}),"Download"]})]})}function tl({path:a,title:n}){let s=(0,R.useRef)(null),[r,i]=(0,R.useState)(!0),[l,o]=(0,R.useState)(null);return(0,R.useEffect)(()=>{let t=!1,n=s.current;if(n)return n.innerHTML="",(async()=>{i(!0),o(null);try{let[{renderAsync:s},r]=await Promise.all([e.A(410052),(0,$.wsFetch)(`/api/assets/${a}`)]);if(t)return;if(!r.ok)throw Error(`Failed to load file (${r.status})`);let l=await r.blob();if(t)return;await s(l,n,void 0,{className:"docx-rendered",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!1,breakPages:!0,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,experimental:!0,useBase64URL:!0}),t||i(!1)}catch(e){t||(o(e instanceof Error?e.message:"Failed to render document"),i(!1))}})(),()=>{t=!0}},[a]),(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsx)(ti,{path:a,title:n,extLabel:"DOCX"}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto bg-muted/30",children:[r&&!l&&(0,t.jsxs)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin mr-2"}),"Rendering document…"]}),l&&(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-destructive",children:l}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),(0,t.jsx)("div",{ref:s,className:"docx-viewer-body mx-auto max-w-5xl py-6 px-4"})]})]})}function to({path:a,title:n}){let s=(0,R.useRef)(null),[r,i]=(0,R.useState)(!0),[l,o]=(0,R.useState)(null);return(0,R.useEffect)(()=>{let t=!1,n=s.current;if(!n)return;n.innerHTML="";let r=null;return(async()=>{i(!0),o(null);try{let[{init:s},l]=await Promise.all([e.A(355350),(0,$.wsFetch)(`/api/assets/${a}`)]);if(t)return;if(!l.ok)throw Error(`Failed to load file (${l.status})`);let o=await l.arrayBuffer();if(t)return;let c=n.clientWidth||960,d=Math.round(9*c/16);r=s(n,{width:c,height:d,mode:"list"}),await r.preview(o),t||i(!1)}catch(e){t||(o(e instanceof Error?e.message:"Failed to render presentation"),i(!1))}})(),()=>{t=!0;try{r?.destroy?.()}catch{}}},[a]),(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsx)(ti,{path:a,title:n,extLabel:"PPTX"}),(0,t.jsxs)("div",{className:"flex-1 overflow-auto bg-muted/30 py-4",children:[r&&!l&&(0,t.jsxs)("div",{className:"h-[60vh] flex items-center justify-center text-muted-foreground",children:[(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin mr-2"}),"Rendering slides…"]}),l&&(0,t.jsx)("div",{className:"h-[60vh] flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-destructive",children:l}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),(0,t.jsx)("div",{ref:s,className:"pptx-viewer-body mx-auto max-w-5xl px-4"})]})]})}function tc({path:a,title:n}){let[s,r]=(0,R.useState)(null),[i,l]=(0,R.useState)(0),[o,c]=(0,R.useState)(!0),[d,u]=(0,R.useState)(null);(0,R.useEffect)(()=>{let t=!1;return c(!0),u(null),r(null),(async()=>{try{let[n,s]=await Promise.all([e.A(432302),(0,$.wsFetch)(`/api/assets/${a}`)]);if(t)return;if(!s.ok)throw Error(`Failed to load file (${s.status})`);let i=await s.arrayBuffer();if(t)return;let o=n.read(i,{type:"array",cellDates:!0,cellStyles:!0}),d=o.SheetNames.map(e=>({name:e,html:n.utils.sheet_to_html(o.Sheets[e],{editable:!1})}));if(t)return;r(d),l(0),c(!1)}catch(e){t||(u(e instanceof Error?e.message:"Failed to parse spreadsheet"),c(!1))}})(),()=>{t=!0}},[a]);let p=(0,R.useMemo)(()=>s?.[i]??null,[s,i]);return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsx)(ti,{path:a,title:n,extLabel:"XLSX"}),s&&s.length>1&&(0,t.jsx)("div",{className:"flex items-center gap-0.5 border-b border-border bg-muted/40 px-2 overflow-x-auto scrollbar-none",children:s.map((e,a)=>(0,t.jsx)("button",{type:"button",onClick:()=>l(a),className:(0,U.cn)("px-3 py-1.5 text-[12px] rounded-t whitespace-nowrap transition-colors",a===i?"bg-background text-foreground font-medium border-t border-x border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:e.name},e.name+a))}),(0,t.jsxs)("div",{className:"flex-1 overflow-auto",children:[o&&!d&&(0,t.jsxs)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin mr-2"}),"Parsing spreadsheet…"]}),d&&(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-destructive",children:d}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),p&&(0,t.jsx)("div",{className:"xlsx-sheet p-3 text-[12px]",dangerouslySetInnerHTML:{__html:p.html}})]})]})}function td({path:e,title:a}){let n=(0,$.withWs)(`/api/assets/${e}`);return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsx)(q,{path:e,badge:"PDF",children:(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),"Open in new tab"]})}),(0,t.jsx)("iframe",{src:n,className:"flex-1 w-full border-0",title:a})]})}let tu=(0,n.default)("wrap-text",[["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["path",{d:"M3 18h7",key:"sq21v6"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]),tp=(0,e4.createLowlight)(e5),tm={".js":"javascript",".cjs":"javascript",".mjs":"javascript",".ts":"typescript",".tsx":"typescript",".jsx":"javascript",".py":"python",".rb":"ruby",".php":"php",".sh":"bash",".bash":"bash",".zsh":"bash",".ps1":"powershell",".css":"css",".scss":"scss",".html":"xml",".json":"json",".jsonc":"json",".yaml":"yaml",".yml":"yaml",".toml":"ini",".ini":"ini",".xml":"xml",".sql":"sql",".graphql":"graphql",".gql":"graphql",".go":"go",".rs":"rust",".swift":"swift",".java":"java",".kt":"kotlin",".kts":"kotlin",".c":"c",".cpp":"cpp",".h":"c",".env":"bash",".txt":"",".text":"",".log":"",".rst":"",".mdx":"markdown"};function th({path:e}){let[a,n]=(0,R.useState)(null),[s,i]=(0,R.useState)(!1),[l,d]=(0,R.useState)(!0),[u,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(!1),x=(0,$.withWs)(`/api/assets/${e}`),f=e.split("/").pop()||e,g=tm[f.includes(".")?`.${f.split(".").pop()?.toLowerCase()}`:""]??"",b=(0,R.useCallback)(async()=>{d(!0);try{let e=await (0,$.wsFetch)(x);if(e.ok){let t=new Uint8Array(await e.arrayBuffer());!function(e){let t=Math.min(e.length,8192);if(0===t)return!1;let a=0;for(let n=0;n<t;n++){let t=e[n];if(0===t)return!0;(t<9||t>13&&t<32)&&a++}return a/t>.3}(t)?n(new TextDecoder("utf-8").decode(t)):i(!0)}}catch{}finally{d(!1)}},[x]);(0,R.useEffect)(()=>{b()},[b]);let w=(0,R.useMemo)(()=>{if(!a)return[];try{let e=g?tp.highlight(g,a):tp.highlightAuto(a);return(0,en.toHtml)(e).split("\n")}catch{return a.split("\n").map(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"))}},[a,g]);return s?(0,t.jsx)(V,{path:e,title:f}):(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsxs)(q,{path:e,badge:f.includes(".")?f.split(".").pop()?.toUpperCase()??"TEXT":"TEXT",sublabel:g||void 0,children:[(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:`h-7 gap-1.5 text-xs ${u?"bg-muted":""}`,onClick:()=>p(e=>!e),title:u?"Disable line wrap":"Enable line wrap",children:[(0,t.jsx)(tu,{className:"h-3.5 w-3.5"}),"Wrap"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{a&&(navigator.clipboard.writeText(a),h(!0),setTimeout(()=>h(!1),2e3))},title:"Copy file contents",children:[m?(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"}),m?"Copied":"Copy"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=x,e.download=f,e.click()},title:"Download file",children:[(0,t.jsx)(c,{className:"h-3.5 w-3.5"}),"Download"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(x,"_blank"),children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),"Raw"]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto source-viewer-code bg-[#1e1e1e]",children:l?(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):(0,t.jsx)("table",{className:"w-full border-collapse text-[13px] leading-relaxed font-mono",children:(0,t.jsx)("tbody",{children:w.map((e,a)=>(0,t.jsxs)("tr",{className:"hover:bg-white/5",children:[(0,t.jsx)("td",{className:"w-12 pr-4 text-right text-[#858585] select-none align-top sticky left-0 bg-[#1e1e1e]",children:a+1}),(0,t.jsx)("td",{className:`text-[#d4d4d4] pl-2 ${u?"whitespace-pre-wrap break-all":"whitespace-pre"}`,dangerouslySetInnerHTML:{__html:e||" "}})]},a))})})})]})}var tx=e.i(794469);function tf({path:e,title:a,src:n,fullscreen:s,onExit:r}){let i=(0,$.withWs)(n??`/api/assets/${e}/index.html`),l=s&&r?(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:r,title:"Exit app",children:[(0,t.jsx)(tx.ArrowLeft,{className:"h-3.5 w-3.5"}),"Exit app"]}):null;return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsx)(q,{path:e,badge:s?"App":void 0,showBreadcrumb:!s,leading:s?(0,t.jsxs)(t.Fragment,{children:[l,(0,t.jsx)("span",{className:"truncate text-[13px] font-medium text-foreground",children:a})]}):null,children:(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(i,"_blank"),children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),"Open in new tab"]})}),(0,t.jsx)("iframe",{src:i,className:"flex-1 w-full border-0 bg-card",title:a,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation-by-user-activation"})]})}let tg=(0,n.default)("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),tb=(0,n.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var tw=e.i(755146);let ty={stopped:"Stopped",installing:"Installing dependencies…",starting:"Starting…",running:"Running",error:"Error"};function tv({path:e,title:n}){let[s,r]=(0,R.useState)("stopped"),[l,o]=(0,R.useState)(null),[c,d]=(0,R.useState)([]),[u,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(!1),[x,f]=(0,R.useState)(0),[g,b]=(0,R.useState)([]),[y,v]=(0,R.useState)(null),N=(0,R.useRef)(null),k=(0,R.useRef)(null),j=`/api/app-proxy/${e}/`,_=()=>{N.current&&(clearInterval(N.current),N.current=null)},E=(0,R.useCallback)(async()=>{try{let t=await (0,$.wsFetch)(`/api/wiki/app?path=${encodeURIComponent(e)}`);if(!t.ok)return;let a=await t.json();r(a.status),d(a.logs??[]),a.scripts&&b(a.scripts),void 0!==a.defaultScript&&v(a.defaultScript),a.port&&o(a.port),a.error&&p(a.error),("running"===a.status||"stopped"===a.status||"error"===a.status)&&_()}catch{}},[e]);(0,R.useEffect)(()=>("installing"===s||"starting"===s?N.current||(N.current=setInterval(E,800)):_(),_),[s,E]),(0,R.useEffect)(()=>{k.current?.scrollIntoView({behavior:"smooth"})},[c]),(0,R.useEffect)(()=>{E()},[E]);let S=async t=>{p(null),d([]),r("starting");try{let a=await (0,$.wsFetch)("/api/wiki/app",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,script:t})}),n=await a.json();if(!a.ok||n.error){r("error"),p(n.error??"Failed to start");return}n.port&&o(n.port),await E()}catch(e){r("error"),p(String(e))}},M=async()=>{await (0,$.wsFetch)("/api/wiki/app",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),r("stopped"),o(null)},A=async()=>{await M(),await S(),f(e=>e+1)},T=g.filter(e=>e!==y);return(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,t.jsxs)(q,{path:e,badge:"Node app",children:["running"===s&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>f(e=>e+1),children:[(0,t.jsx)(C,{className:"h-3.5 w-3.5"}),"Refresh"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(j,"_blank"),children:[(0,t.jsx)(Z.ExternalLink,{className:"h-3.5 w-3.5"}),"Open in new tab"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:A,children:[(0,t.jsx)(C,{className:"h-3.5 w-3.5"}),"Restart"]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs text-destructive hover:text-destructive",onClick:M,children:[(0,t.jsx)(tb,{className:"h-3.5 w-3.5"}),"Stop"]})]}),(0,t.jsxs)(L.Button,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>h(e=>!e),children:[(0,t.jsx)(O,{className:"h-3.5 w-3.5"}),"Logs"]})]}),m&&(0,t.jsxs)("div",{className:"border-b bg-black/90 text-green-400 font-mono text-xs h-40 overflow-auto p-2 shrink-0",children:[0===c.length?(0,t.jsx)("span",{className:"text-muted-foreground",children:"No output yet."}):c.map((e,a)=>(0,t.jsx)("div",{className:"whitespace-pre-wrap leading-5",children:e},a)),(0,t.jsx)("div",{ref:k})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:["stopped"===s&&(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4",children:[(0,t.jsxs)("div",{className:"text-center space-y-1",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:n}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Node.js app — will be started on a local port"})]}),(0,t.jsxs)("div",{className:"inline-flex items-stretch overflow-hidden rounded-full bg-primary text-primary-foreground shadow-e-1",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>S(),className:"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors hover:bg-primary-foreground/10 focus-visible:outline-none",children:[(0,t.jsx)(tg,{className:"h-4 w-4"}),"Launch app",y&&(0,t.jsxs)("span",{className:"opacity-70",children:["(",y,")"]})]}),T.length>0&&(0,t.jsxs)(tw.DropdownMenu,{children:[(0,t.jsx)(tw.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:"inline-flex items-center justify-center border-l border-l-primary-foreground/20 px-2 transition-colors hover:bg-primary-foreground/10 focus-visible:outline-none","aria-label":"Choose script to launch",children:(0,t.jsx)(i.ChevronDown,{className:"h-4 w-4"})})}),(0,t.jsxs)(tw.DropdownMenuContent,{align:"end",children:[(0,t.jsx)(tw.DropdownMenuLabel,{children:"Run script"}),(0,t.jsx)(tw.DropdownMenuSeparator,{}),g.map(e=>(0,t.jsxs)(tw.DropdownMenuItem,{onSelect:()=>S(e),className:"gap-2 font-mono text-xs",children:[(0,t.jsx)(tg,{className:"h-3.5 w-3.5"}),e,e===y&&(0,t.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"default"})]},e))]})]})]})]}),("installing"===s||"starting"===s)&&(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",children:[(0,t.jsx)(w.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ty[s]}),l&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground/60",children:["port ",l]})]}),"error"===s&&(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-6",children:[(0,t.jsx)(a.AlertCircle,{className:"h-8 w-8 text-destructive"}),(0,t.jsxs)("div",{className:"text-center space-y-1 max-w-md",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-destructive",children:"Failed to start app"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:u??"Unknown error"})]}),(0,t.jsxs)(L.Button,{onClick:()=>S(),variant:"outline",className:"gap-2",children:[(0,t.jsx)(C,{className:"h-4 w-4"}),"Try again"]})]}),"running"===s&&(0,t.jsx)("iframe",{src:j,className:"flex-1 w-full border-0 bg-card",title:n,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-top-navigation-by-user-activation"},x)]})]})}let tN=(0,n.default)("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),tk=(0,n.default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),tj=(0,n.default)("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);function t_({onSelect:e}){let[a,n]=(0,R.useState)(null),[s,r]=(0,R.useState)(!0),[i,o]=(0,R.useState)(null),[c,d]=(0,R.useState)(""),[u,p]=(0,R.useState)(!1),[x,f]=(0,R.useState)([]),[g,b]=(0,R.useState)(!1),y=(0,R.useRef)(null),v=(0,R.useRef)(null),N=(0,R.useCallback)(async(e,t=!0)=>{v.current&&(clearTimeout(v.current),v.current=null),r(!0),o(null);try{let a=await fetch(`/api/system/browse?path=${encodeURIComponent(e)}`);if(!a.ok){let e=await a.json();o(e.error??"Cannot open directory");return}let s=await a.json();n(s),t&&d(s.path)}catch{o("Network error")}finally{r(!1)}},[]);(0,R.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/system/config");if(t.ok&&!e){let e=await t.json();f(e.pinnedPaths??[]),await N(e.lastOpenedPath??"");return}}catch{}e||await N("")})(),()=>{e=!0}},[]);let k=async t=>{let n=t??a?.path;if(n){p(!0);try{let t=await fetch("/api/system/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rootDir:n})});if(!t.ok){let e=await t.json();o(e.message??e.error??"Cannot use that directory");return}let{workspace:a}=await t.json();e(a.id)}catch{o("Network error")}finally{p(!1)}}},j=!!a&&x.includes(a.path),E=async()=>{if(a){b(!0);try{let e=j?"unpin":"pin";(await fetch("/api/system/pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path,action:e})})).ok&&f(t=>"pin"===e?[...t,a.path]:t.filter(e=>e!==a.path))}catch{}finally{b(!1)}}},C=async e=>{try{(await fetch("/api/system/pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,action:"unpin"})})).ok&&f(t=>t.filter(t=>t!==e))}catch{}},S=(a?.path??"").split(/[/\\]/).filter(Boolean).reduce((e,t)=>{let a=e[e.length-1]?.path??"/";return e.push({label:t,path:`${"/"===a?"":a}/${t}`}),e},[{label:"/",path:"/"}]);return(0,t.jsx)("div",{className:"flex flex-1 items-center justify-center bg-background p-4",children:(0,t.jsxs)("div",{className:"flex w-full max-w-xl flex-col gap-4",children:[(0,t.jsxs)("div",{className:"text-center space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-1",children:[(0,t.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-8 w-8"}),(0,t.jsx)("span",{className:"text-xl font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,t.jsx)("h1",{className:"text-xl font-medium",children:"Choose a directory"}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Select the folder wiki-viewer should serve.",(0,t.jsx)("br",{}),"This directory lives on the server — use the browser below."]})]}),(0,t.jsxs)("div",{className:"rounded-lg border bg-card shadow-sm overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 border-b px-3 py-2 bg-muted",children:(0,t.jsx)("input",{ref:y,className:"flex-1 bg-transparent text-sm outline-none font-mono min-w-0",value:c,onChange:e=>{let t=e.target.value;d(t),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{v.current=null,N(t.trim(),!1)},500)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v.current&&(clearTimeout(v.current),v.current=null),N(c.trim())),"Escape"===e.key&&(v.current&&(clearTimeout(v.current),v.current=null),d(a?.path??""),y.current?.blur())},spellCheck:!1,placeholder:"Enter a path…"})}),(0,t.jsx)("div",{className:"flex items-center gap-1 border-b px-3 py-1.5 bg-muted/50 overflow-x-auto shrink-0 min-h-[32px]",children:S.map((e,a)=>(0,t.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[a>0&&(0,t.jsx)(l.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50"}),(0,t.jsx)("button",{type:"button",className:"text-xs hover:text-foreground text-muted-foreground transition-colors rounded px-0.5",onClick:()=>N(e.path),children:0===a?(0,t.jsx)(tN,{className:"h-3.5 w-3.5"}):e.label})]},e.path))}),(0,t.jsx)("div",{className:"max-h-60 overflow-y-auto",children:s?(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):i?(0,t.jsx)("div",{className:"px-4 py-3 text-sm text-destructive",children:i}):(0,t.jsxs)(t.Fragment,{children:[a?.parent&&(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>N(a.parent),children:[(0,t.jsx)(m.Folder,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"font-mono text-xs",children:".."})]}),a?.entries.length===0&&(0,t.jsx)("p",{className:"px-4 py-3 text-sm text-muted-foreground/60",children:"No subdirectories"}),a?.entries.map(e=>(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>N(e.path),children:[(0,t.jsx)(m.Folder,{className:"h-4 w-4 shrink-0 text-warning"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.path))]})}),(0,t.jsxs)("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 bg-muted",children:[(0,t.jsxs)("button",{type:"button",className:(0,U.cn)("flex items-center gap-1.5 text-xs transition-colors rounded px-1.5 py-1",j?"text-foreground hover:text-destructive":"text-muted-foreground hover:text-foreground"),title:j?"Unpin this path":"Pin this path for quick access",onClick:E,disabled:g||!a,children:[g?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):j?(0,t.jsx)(tj,{className:"h-3.5 w-3.5"}):(0,t.jsx)(_,{className:"h-3.5 w-3.5"}),j?"Unpin":"Pin"]}),(0,t.jsxs)(L.Button,{size:"sm",className:"shrink-0 gap-1.5",disabled:!a||u,onClick:()=>k(),children:[u?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(h,{className:"h-3.5 w-3.5"}),"Select"]})]})]}),x.length>0&&(0,t.jsxs)("div",{className:"rounded-lg border bg-card shadow-sm overflow-hidden",children:[(0,t.jsx)("div",{className:"px-3 py-2 border-b bg-muted",children:(0,t.jsxs)("span",{className:"text-xs font-medium text-muted-foreground flex items-center gap-1.5",children:[(0,t.jsx)(_,{className:"h-3 w-3"})," Pinned"]})}),(0,t.jsx)("div",{className:"max-h-40 overflow-y-auto",children:x.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-accent group",children:[(0,t.jsxs)("button",{type:"button",className:"flex-1 flex items-center gap-2 text-sm text-left min-w-0",onClick:()=>N(e),children:[(0,t.jsx)(m.Folder,{className:"h-4 w-4 shrink-0 text-warning"}),(0,t.jsx)("span",{className:"truncate font-mono text-xs",children:e})]}),(0,t.jsx)("button",{type:"button",className:"shrink-0 text-muted-foreground/50 hover:text-destructive opacity-0 group-hover:opacity-100 transition-all",onClick:()=>C(e),title:"Remove pin",children:(0,t.jsx)(I.X,{className:"h-3.5 w-3.5"})})]},e))})]}),a?.shortcuts&&a.shortcuts.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 justify-center",children:a.shortcuts.map(e=>(0,t.jsxs)(L.Button,{variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>N(e.path),children:["Home"===e.label?(0,t.jsx)(tk,{className:"h-3 w-3"}):(0,t.jsx)(tN,{className:"h-3 w-3"}),e.label]},e.path))})]})})}var tE=e.i(894013),tC=e.i(46951);let tS=tC.Root;tC.Trigger;let tM=tC.Close,tA=tC.Portal,tO=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(tC.Overlay,{ref:n,className:(0,U.cn)("fixed inset-0 z-40 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a}));tO.displayName="SheetOverlay";let tT={bottom:"inset-x-0 bottom-0 data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom",top:"inset-x-0 top-0 data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top",left:"inset-y-0 left-0 data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left",right:"inset-y-0 right-0 data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right"},tD=R.forwardRef(({side:e="bottom",showClose:a=!1,className:n,children:s,...r},i)=>(0,t.jsxs)(tA,{children:[(0,t.jsx)(tO,{}),(0,t.jsxs)(tC.Content,{ref:i,className:(0,U.cn)("fixed z-50 bg-background shadow-golden transition-all ease-in-out","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",tT[e],n),...r,children:[s,a&&(0,t.jsxs)(tC.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none",children:[(0,t.jsx)(I.X,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));tD.displayName="SheetContent",R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(tC.Title,{ref:n,className:(0,U.cn)("text-sm font-medium leading-none tracking-tight",e),...a})).displayName="SheetTitle",R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(tC.Description,{ref:n,className:(0,U.cn)("text-sm text-muted-foreground",e),...a})).displayName="SheetDescription";var tI=e.i(417385),tR=e.i(199075);function tL(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean)}function tF({open:e,onOpenChange:n}){let[s,r]=(0,R.useState)(!1),[i,l]=(0,R.useState)(!1),[o,c]=(0,R.useState)(null),[d,u]=(0,R.useState)("env"),[p,m]=(0,R.useState)(""),[h,x]=(0,R.useState)(""),[f,g]=(0,R.useState)(null),{data:b}=tR.authClient.useSession(),[y,v]=(0,R.useState)(!1),[N,k]=(0,R.useState)([]),[j,_]=(0,R.useState)([]),[E,C]=(0,R.useState)(null),[S,M]=(0,R.useState)(null),[A,O]=(0,R.useState)(""),[T,D]=(0,R.useState)(""),[F,B]=(0,R.useState)(!1),[P,z]=(0,R.useState)(null),$=(0,R.useCallback)(async()=>{try{let e=await fetch("/api/system/admins");if(!e.ok)return;let t=await e.json();v(!!t.isAdmin),k(t.admins??[]),_(t.users??[])}catch{}},[]),U=(0,R.useCallback)(async()=>{r(!0),c(null);try{let e=await fetch("/api/system/auth-settings");if(!e.ok)throw Error("Failed to load settings");let t=await e.json();m(t.allowedEmails.join("\n")),x(t.allowedDomains.join("\n")),u(t.source),g("number"==typeof t.rateLimit?t.rateLimit:null)}catch(e){c(e instanceof Error?e.message:"Failed to load")}finally{r(!1)}},[]);async function q(){l(!0),c(null);try{let e=await fetch("/api/system/auth-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({allowedEmails:tL(p),allowedDomains:tL(h)})}),t=await e.json();if(!e.ok){c(t.error??"Save failed"),(0,tI.showError)(t.error??"Save failed");return}t.source&&u(t.source),n(!1)}catch{c("Save failed")}finally{l(!1)}}(0,R.useEffect)(()=>{e&&(U(),$())},[e,U,$]);let K=0===tL(p).length&&0===tL(h).length;return(0,t.jsx)(tS,{open:e,onOpenChange:n,children:(0,t.jsxs)(tD,{side:"right",className:"w-80 sm:max-w-md flex flex-col border-l border-border p-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Settings"}),(0,t.jsxs)(tM,{className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,t.jsx)(I.X,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]}),s?(0,t.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,t.jsxs)("div",{className:"flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[b?.user&&(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Account"}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border bg-muted/40 p-3",children:[(0,t.jsxs)("div",{className:"text-sm min-w-0",children:[(0,t.jsx)("div",{className:"font-medium truncate",children:b.user.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:b.user.email})]}),(0,t.jsx)("button",{type:"button",onClick:async()=>{await tR.authClient.signOut(),window.location.href="/signin"},className:"ml-2 shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent",children:"Sign out"})]})]}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Signup allowlist"}),(0,t.jsxs)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:["Control who can create an account. Leave both lists empty to allow any email. Saving here overrides the"," ",(0,t.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AUTH_ALLOWED_EMAILS"})," ","and"," ",(0,t.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AUTH_ALLOWED_DOMAIN"})," ","environment variables."]}),"env"===d&&(0,t.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:[(0,t.jsx)(a.AlertCircle,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:"Current values come from environment variables. Saving moves the allowlist into config and takes precedence going forward."})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:"allowed-emails",className:"text-sm font-medium",children:"Allowed emails"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"One per line (or comma-separated). Exact match, case-insensitive."}),(0,t.jsx)("textarea",{id:"allowed-emails",value:p,onChange:e=>m(e.target.value),spellCheck:!1,rows:5,placeholder:"alice@example.com bob@example.com",className:"w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-primary"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:"allowed-domains",className:"text-sm font-medium",children:"Allowed domains"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"One per line (or comma-separated). Matches any email at that domain."}),(0,t.jsx)("textarea",{id:"allowed-domains",value:h,onChange:e=>x(e.target.value),spellCheck:!1,rows:4,placeholder:"example.com trusted.org",className:"w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-primary"})]}),K&&(0,t.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning-ink",children:[(0,t.jsx)(a.AlertCircle,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:"Both lists are empty. Anyone with the signup URL can create an account."})]}),o&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[(0,t.jsx)(a.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),o]})]}),y&&(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Admins"}),(0,t.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Admins can create workspaces, add users, and manage access."}),E&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[(0,t.jsx)(a.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),E]}),(0,t.jsxs)("div",{className:"space-y-2 rounded-md border border-border p-3",children:[(0,t.jsx)("div",{className:"text-xs font-medium",children:"Add user"}),P?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Created ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:P.email}),". Share this temporary password now, it will not be shown again."]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"flex-1 rounded bg-muted px-2 py-1.5 font-mono text-sm select-all",children:P.tempPassword}),(0,t.jsx)("button",{type:"button",className:"shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent",onClick:()=>void navigator.clipboard?.writeText(P.tempPassword),children:"Copy"})]}),(0,t.jsx)("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:()=>{z(null),O(""),D(""),$()},children:"Done"})]}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("input",{type:"email",value:A,onChange:e=>O(e.target.value),placeholder:"email@team.com",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-primary"}),(0,t.jsx)("input",{type:"text",value:T,onChange:e=>D(e.target.value),placeholder:"Name (optional)",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-primary"}),(0,t.jsxs)(L.Button,{size:"sm",className:"w-full gap-1.5",disabled:F||!A.trim(),onClick:async()=>{B(!0),C(null);try{let e=await fetch("/api/system/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:A.trim(),name:T.trim()})}),t=await e.json();e.ok&&t.tempPassword?z({email:t.email??A.trim(),tempPassword:t.tempPassword}):C(t.message??t.error??"Failed to create user")}catch{C("Network error")}finally{B(!1)}},children:[F&&(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),"Create user"]})]})]}),(0,t.jsxs)("div",{className:"space-y-1 rounded-md border border-border overflow-hidden",children:[j.map(e=>{let a=N.includes(e.id);return(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/40 hover:bg-muted/60 transition-colors",children:[(0,t.jsxs)("div",{className:"text-sm min-w-0",children:[(0,t.jsx)("div",{className:"font-medium truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.email})]}),(0,t.jsx)("button",{type:"button",disabled:S===e.id,className:"ml-2 shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent disabled:opacity-50",onClick:async()=>{M(e.id),C(null);try{let t=await fetch("/api/system/admins",{method:a?"DELETE":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e.id})}),n=await t.json();t.ok?n.admins&&k(n.admins):C(n.message??n.error??"Failed")}catch{C("Network error")}finally{M(null)}},children:S===e.id?(0,t.jsx)(w.Loader2,{className:"h-3 w-3 animate-spin"}):a?"Demote":"Promote"})]},e.id)}),0===j.length&&(0,t.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No users yet."})]})]}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Agent rate limit"}),(0,t.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Per agent"}),(0,t.jsx)("span",{className:"font-mono",children:null!==f?`${f} ops/min`:"--"})]}),(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground/60",children:["Override with ",(0,t.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AGENT_RATE_LIMIT"})," env var."]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3 shrink-0",children:[(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",onClick:()=>n(!1),disabled:i,children:"Cancel"}),(0,t.jsxs)(L.Button,{size:"sm",onClick:q,disabled:i||s,className:"gap-1.5",children:[i&&(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),"Save"]})]})]})})}var tB=e.i(567776);let tP=(0,n.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var tz=e.i(793479),t$=e.i(291967),tU=e.i(967928),tq=e.i(543250),tK=e.i(417256),tH=e.i(461614),tW=e.i(980939),tG="Switch",[tV,tZ]=(0,tq.createContextScope)(tG),[tX,tQ]=tV(tG),tJ=R.forwardRef((e,a)=>{let{__scopeSwitch:n,name:s,checked:r,defaultChecked:i,required:l,disabled:o,value:c="on",onCheckedChange:d,form:u,...p}=e,[m,h]=R.useState(null),x=(0,tU.useComposedRefs)(a,e=>h(e)),f=R.useRef(!1),g=!m||u||!!m.closest("form"),[b,w]=(0,tK.useControllableState)({prop:r,defaultProp:i??!1,onChange:d,caller:tG});return(0,t.jsxs)(tX,{scope:n,checked:b,disabled:o,children:[(0,t.jsx)(tW.Primitive.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":t2(b),"data-disabled":o?"":void 0,disabled:o,value:c,...p,ref:x,onClick:(0,t$.composeEventHandlers)(e.onClick,e=>{w(e=>!e),g&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})}),g&&(0,t.jsx)(t1,{control:m,bubbles:!f.current,name:s,value:c,checked:b,required:l,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});tJ.displayName=tG;var tY="SwitchThumb",t0=R.forwardRef((e,a)=>{let{__scopeSwitch:n,...s}=e,r=tQ(tY,n);return(0,t.jsx)(tW.Primitive.span,{"data-state":t2(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:a})});t0.displayName=tY;var t1=R.forwardRef(({__scopeSwitch:e,control:a,checked:n,bubbles:s=!0,...r},i)=>{let l,o=R.useRef(null),c=(0,tU.useComposedRefs)(o,i),d=(l=R.useRef({value:n,previous:n}),R.useMemo(()=>(l.current.value!==n&&(l.current.previous=l.current.value,l.current.value=n),l.current.previous),[n])),u=(0,tH.useSize)(a);return R.useEffect(()=>{let e=o.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(d!==n&&t){let a=new Event("click",{bubbles:s});t.call(e,n),e.dispatchEvent(a)}},[d,n,s]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function t2(e){return e?"checked":"unchecked"}function t3({className:e,...a}){return(0,t.jsx)(tJ,{"data-slot":"switch",className:(0,U.cn)("peer data-[state=checked]:bg-[var(--switch-checked)] data-[state=unchecked]:bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-sm border-2 border-transparent shadow-e-1 transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer",e),...a,children:(0,t.jsx)(t0,{"data-slot":"switch-thumb",className:"bg-background pointer-events-none block size-4 rounded-sm shadow-e-1 ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"})})}t1.displayName="SwitchBubbleInput";var t5=e.i(110204);function t4({open:e,onOpenChange:a,filePath:n}){let[s,i]=(0,R.useState)([]),[l,c]=(0,R.useState)(!0),[d,u]=(0,R.useState)(!1),[p,m]=(0,R.useState)(""),[h,x]=(0,R.useState)(!1),[g,b]=(0,R.useState)(!1),[y,v]=(0,R.useState)("7"),[N,k]=(0,R.useState)(null),j=(0,R.useCallback)(async()=>{c(!0);try{let e=await (0,$.wsFetch)(`/api/share?path=${encodeURIComponent(n)}`);if(e.ok){let t=await e.json();i(t.shares??[])}}catch{}c(!1)},[n]);(0,R.useEffect)(()=>{e&&j()},[e,j]);let _=async()=>{u(!0);try{let e={path:n};if(h&&p.trim()&&(e.password=p.trim()),g&&y){let t=new Date;t.setDate(t.getDate()+Number(y)),e.expiresAt=t.toISOString()}let t=await (0,$.wsFetch)("/api/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();(0,tI.showError)(e.error??"Failed to create share link");return}(0,tI.showSuccess)("Share link created"),m(""),x(!1),b(!1),v("7"),await j()}catch{(0,tI.showError)("Failed to create share link")}finally{u(!1)}},E=async e=>{try{if(!(await fetch(`/api/share/${e}`,{method:"DELETE"})).ok)return void(0,tI.showError)("Failed to revoke share link");(0,tI.showSuccess)("Share link revoked"),await j()}catch{(0,tI.showError)("Failed to revoke share link")}};return(0,t.jsx)(F.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(F.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsx)(F.DialogTitle,{children:"Share document"}),(0,t.jsx)(F.DialogDescription,{children:"Create a public link to share this document as read-only."})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"rounded-sm border border-border p-3 space-y-3",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:"New share link"}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(t5.Label,{htmlFor:"share-pwd",className:"text-xs gap-1.5 flex items-center",children:[(0,t.jsx)(tB.Lock,{className:"h-3 w-3 text-muted-foreground"}),"Password protect"]}),(0,t.jsx)(t3,{id:"share-pwd",checked:h,onCheckedChange:x})]}),h&&(0,t.jsx)(tz.Input,{type:"password",placeholder:"Set a password",value:p,onChange:e=>m(e.target.value)}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(t5.Label,{htmlFor:"share-expiry",className:"text-xs gap-1.5 flex items-center",children:[(0,t.jsx)(tP,{className:"h-3 w-3 text-muted-foreground"}),"Set expiration"]}),(0,t.jsx)(t3,{id:"share-expiry",checked:g,onCheckedChange:b})]}),g&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(tz.Input,{type:"number",min:1,max:365,value:y,onChange:e=>v(e.target.value),className:"w-20"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"days"})]}),(0,t.jsxs)(L.Button,{size:"sm",className:"w-full gap-1.5",onClick:_,disabled:d,children:[d?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(f.Globe,{className:"h-3.5 w-3.5"}),"Create link"]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:s.length>0?`Active links (${s.length})`:l?"Loading...":"No active links"}),l&&(0,t.jsx)("div",{className:"flex justify-center py-2",children:(0,t.jsx)(w.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),s.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-sm border border-border p-2",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"flex items-center gap-1.5",children:(0,t.jsxs)("span",{className:"text-xs font-mono truncate",children:[window.location.origin,"/s/",e.token]})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[e.hasPassword&&(0,t.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[(0,t.jsx)(tB.Lock,{className:"h-2.5 w-2.5"}),"pwd"]}),e.expiresAt&&(0,t.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[(0,t.jsx)(tP,{className:"h-2.5 w-2.5"}),function(e){let t=new Date(e),a=new Date,n=t.getTime()-a.getTime();if(n<=0)return"expired";let s=Math.floor(n/864e5),r=Math.floor(n%864e5/36e5);return s>0?`${s}d`:r>0?`${r}h`:"<1h"}(e.expiresAt)]}),(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[e.viewCount," view",1!==e.viewCount?"s":""]}),e.isExpired&&(0,t.jsx)("span",{className:"text-[10px] text-destructive",children:"expired"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Copy link",onClick:()=>{var t,a;let n;return t=e.url,a=e.token,n=`${window.location.origin}${t}`,void(navigator.clipboard.writeText(n),k(a),setTimeout(()=>k(null),2e3))},children:N===e.token?(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",title:"Revoke link",onClick:()=>E(e.token),children:(0,t.jsx)(T.Trash2,{className:"h-3.5 w-3.5"})})]})]},e.id))]})]})]})})}var t9=e.i(515288),t7=e.i(918552),t6=e.i(136131),t8="ContextMenu",[ae,at]=(0,tq.createContextScope)(t8,[t7.createMenuScope]),aa=(0,t7.createMenuScope)(),[an,as]=ae(t8),ar=e=>{let{__scopeContextMenu:a,children:n,onOpenChange:s,dir:r,modal:i=!0}=e,[l,o]=R.useState(!1),c=aa(a),d=(0,t6.useCallbackRef)(s),u=R.useCallback(e=>{o(e),d(e)},[d]);return(0,t.jsx)(an,{scope:a,open:l,onOpenChange:u,modal:i,children:(0,t.jsx)(t7.Root,{...c,dir:r,open:l,onOpenChange:u,modal:i,children:n})})};ar.displayName=t8;var ai="ContextMenuTrigger",al=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,disabled:s=!1,...r}=e,i=as(ai,n),l=aa(n),o=R.useRef({x:0,y:0}),c=R.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...o.current})}),d=R.useRef(0),u=R.useCallback(()=>window.clearTimeout(d.current),[]),p=e=>{o.current={x:e.clientX,y:e.clientY},i.onOpenChange(!0)};return R.useEffect(()=>u,[u]),R.useEffect(()=>void(s&&u()),[s,u]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(t7.Anchor,{...l,virtualRef:c}),(0,t.jsx)(tW.Primitive.span,{"data-state":i.open?"open":"closed","data-disabled":s?"":void 0,...r,ref:a,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:s?e.onContextMenu:(0,t$.composeEventHandlers)(e.onContextMenu,e=>{u(),p(e),e.preventDefault()}),onPointerDown:s?e.onPointerDown:(0,t$.composeEventHandlers)(e.onPointerDown,aw(e=>{u(),d.current=window.setTimeout(()=>p(e),700)})),onPointerMove:s?e.onPointerMove:(0,t$.composeEventHandlers)(e.onPointerMove,aw(u)),onPointerCancel:s?e.onPointerCancel:(0,t$.composeEventHandlers)(e.onPointerCancel,aw(u)),onPointerUp:s?e.onPointerUp:(0,t$.composeEventHandlers)(e.onPointerUp,aw(u))})]})});al.displayName=ai;var ao=e=>{let{__scopeContextMenu:a,...n}=e,s=aa(a);return(0,t.jsx)(t7.Portal,{...s,...n})};ao.displayName="ContextMenuPortal";var ac="ContextMenuContent",ad=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=as(ac,n),i=aa(n),l=R.useRef(!1);return(0,t.jsx)(t7.Content,{...i,...s,ref:a,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&l.current&&t.preventDefault(),l.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||r.modal||(l.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ad.displayName=ac,R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.Group,{...r,...s,ref:a})}).displayName="ContextMenuGroup";var au=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.Label,{...r,...s,ref:a})});au.displayName="ContextMenuLabel";var ap=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.Item,{...r,...s,ref:a})});ap.displayName="ContextMenuItem";var am=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.CheckboxItem,{...r,...s,ref:a})});am.displayName="ContextMenuCheckboxItem",R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.RadioGroup,{...r,...s,ref:a})}).displayName="ContextMenuRadioGroup";var ah=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.RadioItem,{...r,...s,ref:a})});ah.displayName="ContextMenuRadioItem";var ax=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.ItemIndicator,{...r,...s,ref:a})});ax.displayName="ContextMenuItemIndicator";var af=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.Separator,{...r,...s,ref:a})});af.displayName="ContextMenuSeparator",R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.Arrow,{...r,...s,ref:a})}).displayName="ContextMenuArrow";var ag=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.SubTrigger,{...r,...s,ref:a})});ag.displayName="ContextMenuSubTrigger";var ab=R.forwardRef((e,a)=>{let{__scopeContextMenu:n,...s}=e,r=aa(n);return(0,t.jsx)(t7.SubContent,{...r,...s,ref:a,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function aw(e){return t=>"mouse"!==t.pointerType?e(t):void 0}ab.displayName="ContextMenuSubContent";var ay=e.i(149427);R.forwardRef(({className:e,inset:a,children:n,...s},r)=>(0,t.jsxs)(ag,{ref:r,className:(0,U.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",e),...s,children:[n,(0,t.jsx)(l.ChevronRight,{className:"ml-auto h-4 w-4"})]})).displayName=ag.displayName,R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(ab,{ref:n,className:(0,U.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})).displayName=ab.displayName;let av=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(ao,{children:(0,t.jsx)(ad,{ref:n,className:(0,U.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));av.displayName=ad.displayName;let aN=R.forwardRef(({className:e,inset:a,...n},s)=>(0,t.jsx)(ap,{ref:s,className:(0,U.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...n}));aN.displayName=ap.displayName,R.forwardRef(({className:e,children:a,checked:n,...s},i)=>(0,t.jsxs)(am,{ref:i,className:(0,U.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...s,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(ax,{children:(0,t.jsx)(r.Check,{className:"h-4 w-4"})})}),a]})).displayName=am.displayName,R.forwardRef(({className:e,children:a,...n},s)=>(0,t.jsxs)(ah,{ref:s,className:(0,U.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(ax,{children:(0,t.jsx)(ay.Circle,{className:"h-2 w-2 fill-current"})})}),a]})).displayName=ah.displayName,R.forwardRef(({className:e,inset:a,...n},s)=>(0,t.jsx)(au,{ref:s,className:(0,U.cn)("px-2 py-1.5 text-sm font-normal",a&&"pl-8",e),...n})).displayName=au.displayName;let ak=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(af,{ref:n,className:(0,U.cn)("-mx-1 my-1 h-px bg-muted",e),...a}));ak.displayName=af.displayName;var aj=e.i(534537);function a_(e){return e?`wiki-recent-files-${e}`:"wiki-recent-files"}function aE(e){try{let t=localStorage.getItem(a_(e));return t?JSON.parse(t):[]}catch{return[]}}let aC=(0,aj.create)(e=>({recents:[],loadForWorkspace:t=>{e({recents:aE(t)})},push:(t,a)=>{let n=aE(a).filter(e=>e.path!==t.path),s=[t,...n].slice(0,15);localStorage.setItem(a_(a),JSON.stringify(s)),e({recents:s})}}));function aS(e){return e?`wiki-pinned-files-${e}`:"wiki-pinned-files"}function aM(e){try{let t=localStorage.getItem(aS(e));return t?JSON.parse(t):[]}catch{return[]}}let aA=(0,aj.create)((e,t)=>({pins:[],loadForWorkspace:t=>{e({pins:aM(t)})},toggle:(t,a)=>{let n=aM(a),s=n.some(e=>e.path===t.path)?n.filter(e=>e.path!==t.path):[...n,t];localStorage.setItem(aS(a),JSON.stringify(s)),e({pins:s})},isPinned:e=>t().pins.some(t=>t.path===e)})),aO=(0,n.default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);var aT=e.i(24800);let aD=(0,n.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),aI=(0,n.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var aR=e.i(187014);function aL(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function aF({scope:e}){return(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground/70 font-mono",children:[e.paths.join(", ")," · ",e.ops.join(",")]})}function aB({reg:e,onApprove:a,onDeny:n}){let[s,r]=(0,R.useState)(!1);async function i(t){r(!0);try{await t(e.registrationId)}finally{r(!1)}}return(0,t.jsxs)("li",{className:"py-1.5 border-b border-border/40 last:border-0",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-xs font-mono truncate",children:e.displayName}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:e.agentId}),(0,t.jsx)(aF,{scope:e.requestedScope})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsxs)(L.Button,{size:"sm",variant:"default",className:"h-6 px-2 text-[10px]",disabled:s,onClick:()=>void i(a),title:"Approve",children:[(0,t.jsx)(aD,{className:"h-3 w-3 mr-0.5"}),"Approve"]}),(0,t.jsxs)(L.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 text-[10px] text-destructive hover:text-destructive",disabled:s,onClick:()=>void i(n),title:"Deny",children:[(0,t.jsx)(aI,{className:"h-3 w-3 mr-0.5"}),"Deny"]})]})]}),(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 mt-0.5",children:["Requested ",aL(e.requestedAt)]})]})}function aP({agent:e,onRevoke:a}){let[n,s]=(0,R.useState)(!1);return(0,t.jsxs)("li",{className:"py-1.5 border-b border-border/40 last:border-0",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-xs font-mono truncate",children:e.displayName}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:e.id}),(0,t.jsx)(aF,{scope:e.scope})]}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0 text-destructive hover:text-destructive",disabled:n,onClick:async()=>{s(!0);try{await a(e.id)}finally{s(!1)}},title:"Revoke agent",children:(0,t.jsx)(T.Trash2,{className:"h-3 w-3"})})]}),(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 mt-0.5",children:["Last seen ",aL(e.lastSeen)]})]})}function az(){let[e,a]=(0,R.useState)([]),[n,s]=(0,R.useState)([]),[r,i]=(0,R.useState)(!1);(0,R.useEffect)(()=>{fetch("/api/owner/init",{credentials:"same-origin"}).then(e=>{(e.ok||204===e.status)&&i(!0)}).catch(()=>{i(!0)})},[]);let l=(0,R.useCallback)(async()=>{try{let e=await fetch("/api/agent/admin/registrations",{credentials:"same-origin"});if(!e.ok)return;let t=await e.json();a(t.pending)}catch{}},[]),o=(0,R.useCallback)(async()=>{try{let e=await fetch("/api/agent/admin/agents",{credentials:"same-origin"});if(!e.ok)return;let t=await e.json();s(t.agents)}catch{}},[]);(0,R.useEffect)(()=>{if(!r)return;l(),o();let e=setInterval(()=>void l(),5e3),t=setInterval(()=>void o(),3e4);return()=>{clearInterval(e),clearInterval(t)}},[r,l,o]);let c=(0,R.useCallback)(async e=>{(await fetch(`/api/agent/admin/registrations/${e}/approve`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"})).ok?(aR.toast.success("Agent approved"),await Promise.all([l(),o()])):aR.toast.error("Failed to approve agent")},[l,o]),d=(0,R.useCallback)(async e=>{(await fetch(`/api/agent/admin/registrations/${e}/deny`,{method:"POST",credentials:"same-origin"})).ok?(aR.toast.success("Registration denied"),await l()):aR.toast.error("Failed to deny registration")},[l]),u=(0,R.useCallback)(async e=>{(await fetch(`/api/agent/admin/agents/${encodeURIComponent(e)}/revoke`,{method:"POST",credentials:"same-origin"})).ok?(aR.toast.success("Agent revoked"),await o()):aR.toast.error("Failed to revoke agent")},[o]);return(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Agents · approve & manage access"}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0",title:"Refresh",onClick:()=>void Promise.all([l(),o()]),children:(0,t.jsx)(C,{className:"h-3 w-3"})})]}),e.length>0&&(0,t.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-50/10 p-2",children:[(0,t.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-amber-600/80 mb-1 flex items-center gap-1",children:[(0,t.jsx)(tP,{className:"h-3 w-3"}),"Waiting for your approval (",e.length,")"]}),(0,t.jsx)("ul",{children:e.map(e=>(0,t.jsx)(aB,{reg:e,onApprove:c,onDeny:d},e.registrationId))})]}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-2",children:0===n.length?(0,t.jsxs)("p",{className:"text-xs text-muted-foreground/60 py-1",children:["No assistants connected yet."," ",(0,t.jsx)("span",{className:"text-muted-foreground/40",children:"Connect one above; once it requests access it’ll appear here for you to approve."})]}):(0,t.jsx)("ul",{children:n.map(e=>(0,t.jsx)(aP,{agent:e,onRevoke:u},e.id))})}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground/60 leading-relaxed",children:"Each assistant gets its own access that you can revoke anytime. New requests appear above for your approval before they can read or edit anything."})]})}function a$({event:e}){var a;let n=e.path.split("/").pop()??e.path,s="string"==typeof e.ref?e.ref:"";return(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1.5 border-b border-border/50 last:border-0",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-mono text-foreground/80 truncate",title:e.path,children:n}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground shrink-0",children:function(e){let t=Math.floor(Math.max(0,Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let a=Math.floor(t/60);if(a<60)return`${a}m ago`;let n=Math.floor(a/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}(e.at)})]}),(0,t.jsxs)("p",{className:"text-[11px] text-muted-foreground truncate",children:[(0,t.jsx)("span",{className:"text-foreground/60",children:e.by})," ",{"block.replace":"replaced","block.insertAfter":"inserted after","block.insertBefore":"inserted before","block.delete":"deleted","block.append":"appended","block.prepend":"prepended","comment.add":"commented on","comment.reply":"replied to comment","comment.resolve":"resolved comment","comment.reopen":"reopened comment","suggestion.add":"suggested","suggestion.accept":"accepted suggestion","suggestion.reject":"rejected suggestion"}[a=e.type]??a,s&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground/60",children:s})]})]})]})}let aU="npx skills add anh-chu/wiki-viewer/agents/wiki-viewer-skill";function aq(e){let[t,a]=(0,R.useState)(!1);return{copied:t,copy:(0,R.useCallback)(async()=>{await navigator.clipboard.writeText(e()),a(!0),setTimeout(()=>a(!1),1500)},[e])}}function aK({currentPath:e}){let a=(0,aT.useAIPanelStore)(e=>e.isOpen),n=(0,aT.useAIPanelStore)(e=>e.close),i=(0,aT.useAIPanelStore)(e=>e.activity),l=(0,aT.useAIPanelStore)(e=>e.connections),c=(0,aT.useAIPanelStore)(e=>e.loadActivity),{copied:d,copy:u}=function(e){let[t,a]=(0,R.useState)(!1);return{copied:t,copy:(0,R.useCallback)(async()=>{let t=window.location.origin,n=`# 1. Register
|
|
4
|
+
REG=$(curl -s -X POST -H 'Content-Type: application/json' \\
|
|
5
|
+
-d '{"id":"ai:claude","displayName":"Claude"}' \\
|
|
6
|
+
${t}/api/agent/register)
|
|
7
|
+
REG_ID=$(echo $REG | jq -r .registrationId)
|
|
8
|
+
|
|
9
|
+
# 2. Approve in AI Panel, then poll:
|
|
10
|
+
curl -s ${t}/api/agent/register/$REG_ID
|
|
11
|
+
# → {"status":"approved","token":"..."}
|
|
12
|
+
TOKEN=<paste token here>
|
|
13
|
+
|
|
14
|
+
# 3. Read snapshot
|
|
15
|
+
curl -s -H "Authorization: Bearer $TOKEN" \\
|
|
16
|
+
-H "X-Agent-Id: ai:claude" \\
|
|
17
|
+
${t}/api/agent/files/${e??"<path/to/file.md>"}`;await navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),1500)},[e])}}(e??null),[p,m]=(0,R.useState)(""),h=(0,R.useRef)(null),x=window.location.origin,f=(0,R.useCallback)(()=>aU,[]),g=(0,R.useCallback)(()=>p.replace(/\$WIKI_URL/g,x),[p,x]),b=(0,R.useCallback)(()=>`npx wiki-viewer-mcp register --url ${x} --id ai:myagent --name "My Agent"`,[x]),w=(0,R.useCallback)(()=>JSON.stringify({servers:{"wiki-viewer":{command:"npx",args:["wiki-viewer-mcp"],env:{WIKI_VIEWER_URL:x,WIKI_VIEWER_TOKEN:"<token from register>",WIKI_VIEWER_AGENT_ID:"ai:myagent"}}}},null,2),[x]),y=aq(f),v=aq(g),N=aq(b),k=aq(w);return((0,R.useEffect)(()=>{if(a)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&n()}},[a,n]),(0,R.useEffect)(()=>{a&&h.current?.focus()},[a]),(0,R.useEffect)(()=>{if(!a)return;c();let e=setInterval(()=>void c(),1e4);return()=>clearInterval(e)},[a,c]),(0,R.useEffect)(()=>{a&&fetch("/api/agents/install").then(e=>e.json()).then(e=>{e.bootstrapPrompt&&m(e.bootstrapPrompt)}).catch(()=>void 0)},[a]),a)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-[1px]",onClick:n,"aria-hidden":!0}),(0,t.jsxs)("aside",{ref:h,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,t.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(s,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-sm font-semibold",children:"AI Agent"})]}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:n,title:"Close panel (Esc)",children:(0,t.jsx)(I.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-5 px-4 py-4",children:[(0,t.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 p-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Work with this wiki using AI"}),(0,t.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,t.jsx)("span",{className:"font-medium text-foreground/80",children:"Agents"})," below before it gets access."]})]}),(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,t.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Co-write docs with you"}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Edits arrive as suggestions with comments you accept or revert. No MCP needed."}),(0,t.jsx)(L.Button,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void v.copy(),disabled:!p,children:v.copied?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"})," Paste into any chatbot"]})}),(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 pt-1",children:["Or install once so it sticks"," ",(0,t.jsx)("span",{className:"text-muted-foreground/40",children:"· Claude, OpenCode"}),":"]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:aU}),(0,t.jsx)(L.Button,{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,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"})})]})]}),(0,t.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,t.jsxs)("p",{className:"text-xs font-semibold text-foreground",children:["Edit files directly"," ",(0,t.jsx)("span",{className:"font-normal text-muted-foreground/60",children:"· Claude Code, Cursor, Codex"})]}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Native read / search / edit tools over MCP. Run to request access:"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:b()}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void N.copy(),children:N.copied?(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground/50",children:["Approve in ",(0,t.jsx)("span",{className:"font-medium text-foreground/70",children:"Agents"}),", then add to your tool:"]}),(0,t.jsx)(L.Button,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void k.copy(),children:k.copied?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"})," Copy config (mcp.json)"]})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"For developers:"}),(0,t.jsxs)("button",{type:"button",onClick:()=>void u(),className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[d?(0,t.jsx)(r.Check,{className:"h-3 w-3 text-green-500"}):(0,t.jsx)(o.Copy,{className:"h-3 w-3"})," curl example"]}),(0,t.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,t.jsx)(Z.ExternalLink,{className:"h-3 w-3"})," skill"]}),(0,t.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,t.jsx)(Z.ExternalLink,{className:"h-3 w-3"})," install JSON"]})]})]}),(0,t.jsx)(az,{}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:["Active Connections"," ",(0,t.jsx)("span",{className:"normal-case font-normal text-muted-foreground/50",children:"(last 5 min)"})]}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:0===l.length?(0,t.jsxs)("p",{className:"text-xs text-muted-foreground/60 flex items-center gap-1.5",children:[(0,t.jsx)(aO,{className:"h-3.5 w-3.5"}),"No recent activity"]}):(0,t.jsx)("ul",{className:"space-y-1.5",children:l.map(e=>(0,t.jsxs)("li",{className:"flex items-center justify-between text-xs",children:[(0,t.jsx)("span",{className:"font-mono text-foreground/80 truncate",children:e.by}),(0,t.jsxs)("span",{className:"text-muted-foreground shrink-0",children:[e.opCount," op",1!==e.opCount?"s":""]})]},e.by))})})]}),(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Recent Activity"}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-1 max-h-72 overflow-y-auto",children:0===i.length?(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60 py-2",children:"No events recorded"}):i.map(e=>(0,t.jsx)(a$,{event:e},`${e.path}-${e.id}`))})]}),(0,t.jsx)("section",{children:(0,t.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}var aH=e.i(580330),aW=e.i(409082),aG=e.i(877031),aV=e.i(847463),aZ=e.i(917356),aX=/[\\\/_+.#"@\[\(\{&]/,aQ=/[\\\/_+.#"@\[\(\{&]/g,aJ=/[\s-]/,aY=/[\s-]/g;function a0(e){return e.toLowerCase().replace(aY," ")}var a1=e.i(750110),a2=e.i(433616),a3='[cmdk-group=""]',a5='[cmdk-group-items=""]',a4='[cmdk-item=""]',a9=`${a4}:not([aria-disabled="true"])`,a7="cmdk-item-select",a6="data-value",a8=(e,t,a)=>{var n;return n=e,function e(t,a,n,s,r,i,l){if(i===a.length)return r===t.length?1:.99;var o=`${r},${i}`;if(void 0!==l[o])return l[o];for(var c,d,u,p,m=s.charAt(i),h=n.indexOf(m,r),x=0;h>=0;)(c=e(t,a,n,s,h+1,i+1,l))>x&&(h===r?c*=1:aX.test(t.charAt(h-1))?(c*=.8,(u=t.slice(r,h-1).match(aQ))&&r>0&&(c*=Math.pow(.999,u.length))):aJ.test(t.charAt(h-1))?(c*=.9,(p=t.slice(r,h-1).match(aY))&&r>0&&(c*=Math.pow(.999,p.length))):(c*=.17,r>0&&(c*=Math.pow(.999,h-r))),t.charAt(h)!==a.charAt(i)&&(c*=.9999)),(c<.1&&n.charAt(h-1)===s.charAt(i+1)||s.charAt(i+1)===s.charAt(i)&&n.charAt(h-1)!==s.charAt(i))&&.1*(d=e(t,a,n,s,h+1,i+2,l))>c&&(c=.1*d),c>x&&(x=c),h=n.indexOf(m,h+1);return l[o]=x,x}(n=a&&a.length>0?`${n+" "+a.join(" ")}`:n,t,a0(n),a0(t),0,0,{})},ne=R.createContext(void 0),nt=R.createContext(void 0),na=R.createContext(void 0),nn=R.forwardRef((e,t)=>{let a=nm(()=>{var t,a;return{search:"",value:null!=(a=null!=(t=e.value)?t:e.defaultValue)?a:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=nm(()=>new Set),s=nm(()=>new Map),r=nm(()=>new Map),i=nm(()=>new Set),l=nu(e),{label:o,children:c,value:d,onValueChange:u,filter:p,shouldFilter:m,loop:h,disablePointerSelection:x=!1,vimBindings:f=!0,...g}=e,b=(0,a2.useId)(),w=(0,a2.useId)(),y=(0,a2.useId)(),v=R.useRef(null),N=nf();np(()=>{if(void 0!==d){let e=d.trim();a.current.value=e,k.emit()}},[d]),np(()=>{N(6,M)},[]);let k=R.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>a.current,setState:(e,t,n)=>{var s,r,i,o;if(!Object.is(a.current[e],t)){if(a.current[e]=t,"search"===e)S(),E(),N(1,C);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(y);e?e.focus():null==(s=document.getElementById(b))||s.focus()}if(N(7,()=>{var e;a.current.selectedItemId=null==(e=A())?void 0:e.id,k.emit()}),n||N(5,M),(null==(r=l.current)?void 0:r.value)!==void 0){null==(o=(i=l.current).onValueChange)||o.call(i,null!=t?t:"");return}}k.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),j=R.useMemo(()=>({value:(e,t,n)=>{var s;t!==(null==(s=r.current.get(e))?void 0:s.value)&&(r.current.set(e,{value:t,keywords:n}),a.current.filtered.items.set(e,_(t,n)),N(2,()=>{E(),k.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),N(3,()=>{S(),E(),a.current.value||C(),k.emit()}),()=>{r.current.delete(e),n.current.delete(e),a.current.filtered.items.delete(e);let t=A();N(4,()=>{S(),(null==t?void 0:t.getAttribute("id"))===e&&C(),k.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{r.current.delete(e),s.current.delete(e)}),filter:()=>l.current.shouldFilter,label:o||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:y,labelId:w,listInnerRef:v}),[]);function _(e,t){var n,s;let r=null!=(s=null==(n=l.current)?void 0:n.filter)?s:a8;return e?r(e,a.current.search,t):0}function E(){if(!a.current.search||!1===l.current.shouldFilter)return;let e=a.current.filtered.items,t=[];a.current.filtered.groups.forEach(a=>{let n=s.current.get(a),r=0;n.forEach(t=>{r=Math.max(e.get(t),r)}),t.push([a,r])});let n=v.current;O().sort((t,a)=>{var n,s;let r=t.getAttribute("id"),i=a.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(s=e.get(r))?s:0)}).forEach(e=>{let t=e.closest(a5);t?t.appendChild(e.parentElement===t?e:e.closest(`${a5} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${a5} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let a=null==(t=v.current)?void 0:t.querySelector(`${a3}[${a6}="${encodeURIComponent(e[0])}"]`);null==a||a.parentElement.appendChild(a)})}function C(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(a6);k.setState("value",t||void 0)}function S(){var e,t,i,o;if(!a.current.search||!1===l.current.shouldFilter){a.current.filtered.count=n.current.size;return}a.current.filtered.groups=new Set;let c=0;for(let s of n.current){let n=_(null!=(t=null==(e=r.current.get(s))?void 0:e.value)?t:"",null!=(o=null==(i=r.current.get(s))?void 0:i.keywords)?o:[]);a.current.filtered.items.set(s,n),n>0&&c++}for(let[e,t]of s.current)for(let n of t)if(a.current.filtered.items.get(n)>0){a.current.filtered.groups.add(e);break}a.current.filtered.count=c}function M(){var e,t,a;let n=A();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(a=null==(t=n.closest(a3))?void 0:t.querySelector('[cmdk-group-heading=""]'))||a.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function A(){var e;return null==(e=v.current)?void 0:e.querySelector(`${a4}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=v.current)?void 0:e.querySelectorAll(a9))||[])}function T(e){let t=O()[e];t&&k.setState("value",t.getAttribute(a6))}function D(e){var t;let a=A(),n=O(),s=n.findIndex(e=>e===a),r=n[s+e];null!=(t=l.current)&&t.loop&&(r=s+e<0?n[n.length-1]:s+e===n.length?n[0]:n[s+e]),r&&k.setState("value",r.getAttribute(a6))}function I(e){let t=A(),a=null==t?void 0:t.closest(a3),n;for(;a&&!n;)n=null==(a=e>0?function(e,t){let a=e.nextElementSibling;for(;a;){if(a.matches(t))return a;a=a.nextElementSibling}}(a,a3):function(e,t){let a=e.previousElementSibling;for(;a;){if(a.matches(t))return a;a=a.previousElementSibling}}(a,a3))?void 0:a.querySelector(a9);n?k.setState("value",n.getAttribute(a6)):D(e)}let L=()=>T(O().length-1),F=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):D(1)},B=e=>{e.preventDefault(),e.metaKey?T(0):e.altKey?I(-1):D(-1)};return R.createElement(a1.Primitive.div,{ref:t,tabIndex:-1,...g,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=g.onKeyDown)||t.call(g,e);let a=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||a))switch(e.key){case"n":case"j":f&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":f&&e.ctrlKey&&B(e);break;case"ArrowUp":B(e);break;case"Home":e.preventDefault(),T(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=A();if(t){let e=new Event(a7);t.dispatchEvent(e)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:nb},o),ng(e,e=>R.createElement(nt.Provider,{value:k},R.createElement(ne.Provider,{value:j},e))))}),ns=R.forwardRef((e,t)=>{var a,n;let s=(0,a2.useId)(),r=R.useRef(null),i=R.useContext(na),l=R.useContext(ne),o=nu(e),c=null!=(n=null==(a=o.current)?void 0:a.forceMount)?n:null==i?void 0:i.forceMount;np(()=>{if(!c)return l.item(s,null==i?void 0:i.id)},[c]);let d=nx(s,r,[e.value,e.children,r],e.keywords),u=R.useContext(nt),p=nh(e=>e.value&&e.value===d.current),m=nh(e=>!!c||!1===l.filter()||!e.search||e.filtered.items.get(s)>0);function h(){var e,t;x(),null==(t=(e=o.current).onSelect)||t.call(e,d.current)}function x(){u.setState("value",d.current,!0)}if(R.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(a7,h),()=>t.removeEventListener(a7,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:f,value:g,onSelect:b,forceMount:w,keywords:y,...v}=e;return R.createElement(a1.Primitive.div,{ref:(0,tU.composeRefs)(r,t),...v,id:s,"cmdk-item":"",role:"option","aria-disabled":!!f,"aria-selected":!!p,"data-disabled":!!f,"data-selected":!!p,onPointerMove:f||l.getDisablePointerSelection()?void 0:x,onClick:f?void 0:h},e.children)}),nr=R.forwardRef((e,t)=>{let{heading:a,children:n,forceMount:s,...r}=e,i=(0,a2.useId)(),l=R.useRef(null),o=R.useRef(null),c=(0,a2.useId)(),d=R.useContext(ne),u=nh(e=>!!s||!1===d.filter()||!e.search||e.filtered.groups.has(i));np(()=>d.group(i),[]),nx(i,l,[e.value,e.heading,o]);let p=R.useMemo(()=>({id:i,forceMount:s}),[s]);return R.createElement(a1.Primitive.div,{ref:(0,tU.composeRefs)(l,t),...r,"cmdk-group":"",role:"presentation",hidden:!u||void 0},a&&R.createElement("div",{ref:o,"cmdk-group-heading":"","aria-hidden":!0,id:c},a),ng(e,e=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?c:void 0},R.createElement(na.Provider,{value:p},e))))}),ni=R.forwardRef((e,t)=>{let{alwaysRender:a,...n}=e,s=R.useRef(null),r=nh(e=>!e.search);return a||r?R.createElement(a1.Primitive.div,{ref:(0,tU.composeRefs)(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),nl=R.forwardRef((e,t)=>{let{onValueChange:a,...n}=e,s=null!=e.value,r=R.useContext(nt),i=nh(e=>e.search),l=nh(e=>e.selectedItemId),o=R.useContext(ne);return R.useEffect(()=>{null!=e.value&&r.setState("search",e.value)},[e.value]),R.createElement(a1.Primitive.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":o.listId,"aria-labelledby":o.labelId,"aria-activedescendant":l,id:o.inputId,type:"text",value:s?e.value:i,onChange:e=>{s||r.setState("search",e.target.value),null==a||a(e.target.value)}})}),no=R.forwardRef((e,t)=>{let{children:a,label:n="Suggestions",...s}=e,r=R.useRef(null),i=R.useRef(null),l=nh(e=>e.selectedItemId),o=R.useContext(ne);return R.useEffect(()=>{if(i.current&&r.current){let e=i.current,t=r.current,a,n=new ResizeObserver(()=>{a=requestAnimationFrame(()=>{let a=e.offsetHeight;t.style.setProperty("--cmdk-list-height",a.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(a),n.unobserve(e)}}},[]),R.createElement(a1.Primitive.div,{ref:(0,tU.composeRefs)(r,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:o.listId},ng(e,e=>R.createElement("div",{ref:(0,tU.composeRefs)(i,o.listInnerRef),"cmdk-list-sizer":""},e)))}),nc=R.forwardRef((e,t)=>{let{open:a,onOpenChange:n,overlayClassName:s,contentClassName:r,container:i,...l}=e;return R.createElement(tC.Root,{open:a,onOpenChange:n},R.createElement(tC.Portal,{container:i},R.createElement(tC.Overlay,{"cmdk-overlay":"",className:s}),R.createElement(tC.Content,{"aria-label":e.label,"cmdk-dialog":"",className:r},R.createElement(nn,{ref:t,...l}))))}),nd=Object.assign(nn,{List:no,Item:ns,Input:nl,Group:nr,Separator:ni,Dialog:nc,Empty:R.forwardRef((e,t)=>nh(e=>0===e.filtered.count)?R.createElement(a1.Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:R.forwardRef((e,t)=>{let{progress:a,children:n,label:s="Loading...",...r}=e;return R.createElement(a1.Primitive.div,{ref:t,...r,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ng(e,e=>R.createElement("div",{"aria-hidden":!0},e)))})});function nu(e){let t=R.useRef(e);return np(()=>{t.current=e}),t}var np="u"<typeof window?R.useEffect:R.useLayoutEffect;function nm(e){let t=R.useRef();return void 0===t.current&&(t.current=e()),t}function nh(e){let t=R.useContext(nt),a=()=>e(t.snapshot());return R.useSyncExternalStore(t.subscribe,a,a)}function nx(e,t,a,n=[]){let s=R.useRef(),r=R.useContext(ne);return np(()=>{var i;let l=(()=>{var e;for(let t of a){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),o=n.map(e=>e.trim());r.value(e,l,o),null==(i=t.current)||i.setAttribute(a6,l),s.current=l}),s}var nf=()=>{let[e,t]=R.useState(),a=nm(()=>new Map);return np(()=>{a.current.forEach(e=>e()),a.current=new Map},[e]),(e,n)=>{a.current.set(e,n),t({})}};function ng({asChild:e,children:t},a){let n;return e&&R.isValidElement(t)?R.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},a(t.props.children)):a(t)}var nb={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let nw=(0,n.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),ny=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(nd,{ref:n,className:(0,U.cn)("flex h-full w-full flex-col overflow-hidden rounded-sm bg-popover text-popover-foreground",e),...a}));function nv({children:e,shouldFilter:a,...n}){return(0,t.jsx)(F.Dialog,{...n,children:(0,t.jsxs)(F.DialogContent,{className:"overflow-hidden p-0 shadow-golden max-w-lg",children:[(0,t.jsx)(F.DialogTitle,{className:"sr-only",children:"Search"}),(0,t.jsx)(ny,{shouldFilter:a,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})]})})}ny.displayName=nd.displayName;let nN=R.forwardRef(({className:e,...a},n)=>(0,t.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,t.jsx)(nw,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,t.jsx)(nd.Input,{ref:n,className:(0,U.cn)("flex h-11 w-full rounded-sm bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...a})]}));nN.displayName=nd.Input.displayName;let nk=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(nd.List,{ref:n,className:(0,U.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...a}));nk.displayName=nd.List.displayName;let nj=R.forwardRef((e,a)=>(0,t.jsx)(nd.Empty,{ref:a,className:"py-6 text-center text-sm text-muted-foreground",...e}));nj.displayName=nd.Empty.displayName;let n_=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(nd.Group,{ref:n,className:(0,U.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground",e),...a}));n_.displayName=nd.Group.displayName;let nE=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(nd.Separator,{ref:n,className:(0,U.cn)("-mx-1 h-px bg-border",e),...a}));nE.displayName=nd.Separator.displayName;let nC=R.forwardRef(({className:e,...a},n)=>(0,t.jsx)(nd.Item,{ref:n,className:(0,U.cn)("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...a}));nC.displayName=nd.Item.displayName;let nS=null,nM=(0,aj.create)(e=>({query:"",results:[],loading:!1,truncated:!1,open:!1,setQuery:t=>e({query:t}),setOpen:t=>e({open:t}),clear:()=>{nS?.abort(),e({query:"",results:[],loading:!1,truncated:!1})},search:async t=>{nS?.abort();let a=new AbortController;if(nS=a,!t.trim())return void e({results:[],loading:!1,truncated:!1});e({loading:!0});try{let n=await (0,$.wsFetch)("/api/wiki/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,limit:30}),signal:a.signal});if(!n.ok)return void e({results:[],loading:!1,truncated:!1});let s=await n.json();if(a.signal.aborted)return;e({results:s.matches??[],truncated:!!s.truncated,loading:!1})}catch(t){"AbortError"!==t.name&&e({loading:!1})}}}));var nA=e.i(395624);function nO({html:e}){let a=function(e){let t,a=[],n=/<mark>([\s\S]*?)<\/mark>/g,s=0;for(;null!==(t=n.exec(e));)t.index>s&&a.push({text:e.slice(s,t.index),mark:!1}),a.push({text:t[1]??"",mark:!0}),s=t.index+t[0].length;return s<e.length&&a.push({text:e.slice(s),mark:!1}),a}(e);return(0,t.jsx)(t.Fragment,{children:a.map((e,a)=>e.mark?(0,t.jsx)("mark",{className:"bg-yellow-200 dark:bg-yellow-700 rounded-[2px] px-[1px]",children:e.text},a):(0,t.jsx)("span",{children:e.text},a))})}function nT({onOpenFile:e,onToggleSidebar:a=()=>void 0,onNewFile:n=()=>void 0,onCopyPath:r=()=>void 0}){let i=nM(e=>e.open),l=nM(e=>e.setOpen),c=nM(e=>e.query),d=nM(e=>e.setQuery),p=nM(e=>e.results),m=nM(e=>e.loading),h=nM(e=>e.truncated),x=nM(e=>e.search),{resolvedTheme:f,setTheme:g}=(0,aZ.useTheme)(),b=(0,aT.useAIPanelStore)(e=>e.toggle),w=(0,nA.useViewWidthStore)(e=>e.width),y=(0,nA.useViewWidthStore)(e=>e.cycle),v=c.trimStart(),N=""===v||v.startsWith(">"),k=N?"":c;function j(e){e(),l(!1),d("")}(0,R.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),l(!i))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,l]),(0,R.useEffect)(()=>{if(!i||N)return;let e=setTimeout(()=>{x(k)},120);return()=>clearTimeout(e)},[k,N,i,x]);let _=(nA.VIEW_WIDTH_ORDER.indexOf(w)+1)%nA.VIEW_WIDTH_ORDER.length,E=nA.VIEW_WIDTH_LABEL[nA.VIEW_WIDTH_ORDER[_]];return(0,t.jsxs)(nv,{open:i,onOpenChange:e=>{l(e),e||d("")},shouldFilter:!1,children:[(0,t.jsx)(nN,{placeholder:"Search files… ( > for actions )",value:c,onValueChange:d}),(0,t.jsxs)(nk,{children:[N&&(0,t.jsxs)(n_,{heading:"Actions",children:[(0,t.jsxs)(nC,{value:"toggle-dark-mode",onSelect:()=>j(()=>g("dark"===f?"light":"dark")),children:["dark"===f?(0,t.jsx)(aV.Sun,{className:"mr-2 h-4 w-4"}):(0,t.jsx)(aW.Moon,{className:"mr-2 h-4 w-4"}),"dark"===f?"Switch to light mode":"Switch to dark mode"]}),(0,t.jsxs)(nC,{value:"toggle-ai-panel",onSelect:()=>j(b),children:[(0,t.jsx)(s,{className:"mr-2 h-4 w-4"}),"Toggle AI panel"]}),(0,t.jsxs)(nC,{value:"toggle-sidebar",onSelect:()=>j(a),children:[(0,t.jsx)(aG.PanelLeft,{className:"mr-2 h-4 w-4"}),"Toggle sidebar"]}),(0,t.jsxs)(nC,{value:"new-file",onSelect:()=>j(n),children:[(0,t.jsx)(u.FilePlus,{className:"mr-2 h-4 w-4"}),"New file"]}),(0,t.jsxs)(nC,{value:"copy-path",onSelect:()=>j(r),children:[(0,t.jsx)(o.Copy,{className:"mr-2 h-4 w-4"}),"Copy current file path"]}),(0,t.jsxs)(nC,{value:"cycle-view-width",onSelect:()=>j(y),children:[(0,t.jsx)(aH.AlignCenter,{className:"mr-2 h-4 w-4"}),(0,t.jsxs)("span",{children:["Change view width"," ",(0,t.jsxs)("span",{className:"text-muted-foreground",children:["(",nA.VIEW_WIDTH_LABEL[w]," → ",E,")"]})]})]})]}),!N&&(0,t.jsxs)(t.Fragment,{children:[m&&(0,t.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Searching…"}),!m&&""!==k.trim()&&0===p.length&&(0,t.jsx)(nj,{children:"No matches."}),p.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nE,{}),(0,t.jsx)(n_,{heading:h?"Top results (refine query for more)":"Results",children:p.map(a=>(0,t.jsx)(nC,{value:a.path,onSelect:()=>{e(a.path),l(!1),d("")},children:(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"truncate font-mono text-xs",children:a.path}),a.snippet&&(0,t.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:(0,t.jsx)(nO,{html:a.snippet})})]})},a.path))})]})]})]})]})}function nD({onOpenFile:e}){let a=nM(e=>e.query),n=nM(e=>e.setQuery),s=nM(e=>e.results),r=nM(e=>e.loading),i=nM(e=>e.search),l=nM(e=>e.clear),[o,c]=(0,R.useState)(0),d=(0,R.useRef)(null);function u(t){let a=s[t];a&&(e(a.path),l())}return(0,R.useEffect)(()=>{c(0)},[s]),(0,R.useEffect)(()=>{let e=d.current?.querySelector(`[data-idx="${o}"]`);e?.scrollIntoView({block:"nearest"})},[o]),(0,t.jsxs)("div",{className:"flex flex-col gap-1 px-2 py-1.5",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(nw,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 opacity-50"}),(0,t.jsx)("input",{type:"text",className:"w-full rounded-sm border bg-transparent py-1 pl-7 pr-2 text-xs outline-none focus:ring-1 focus:ring-ring",placeholder:"Search… (⌘K)",value:a,onChange:e=>{n(e.target.value),i(e.target.value)},onKeyDown:e=>{"Escape"===e.key?l():0!==s.length&&("ArrowDown"===e.key?(e.preventDefault(),c(e=>(e+1)%s.length)):"ArrowUp"===e.key?(e.preventDefault(),c(e=>(e-1+s.length)%s.length)):"Enter"===e.key&&(e.preventDefault(),u(o)))}})]}),""!==a.trim()&&(0,t.jsxs)("div",{ref:d,className:"max-h-64 overflow-y-auto rounded-sm border bg-popover",children:[r&&(0,t.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Searching…"}),!r&&0===s.length&&(0,t.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No matches"}),s.map((e,a)=>(0,t.jsxs)("button",{type:"button","data-idx":a,onClick:()=>u(a),onMouseEnter:()=>c(a),className:`block w-full px-2 py-1 text-left ${a===o?"bg-accent":"hover:bg-accent"}`,children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs",children:e.path}),e.snippet&&(0,t.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:(0,t.jsx)(nO,{html:e.snippet})})]},e.path))]})]})}var nI=e.i(96701),nR=e.i(780569),nL=e.i(246542);function nF(e){return e.split(".").pop()?.toLowerCase()??""}function nB(e,t){if("node-app"===t)return"node-app";if("app"===t)return"app";if("dir"===t)return"fallback";let a=e.split("/").pop()??e;if(a.startsWith(".")&&-1===a.indexOf(".",1))return"source";let n=nF(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"):"source"}let nP=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 nz(e){let t=nB(e,"file");return"editor"===t||"text"===t||nP.has(nF(e))}function n$(e){return["md","markdown"].includes(nF(e))}function nU(e){return"image"===nB(e,"file")}async function nq(e){let t=await (0,$.wsFetch)(`/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 nK(e,t,a){return e.map(e=>e.path===t?a(e):e.children?{...e,children:nK(e.children,t,a)}:e)}e.s(["default",0,function(){let e;(0,nL.useWikiSlugsStore)(e=>e.loadedAt),(0,R.useEffect)(()=>{nL.useWikiSlugsStore.getState().load()},[]);let[n,F]=(0,R.useState)(null),[P,z]=(0,R.useState)(null),[q,K]=(0,R.useState)(()=>(0,$.getActiveWorkspaceId)()),[H,Z]=(0,R.useState)([]),[J,Y]=(0,R.useState)(!1),[ee,et]=(0,R.useState)(!1),[en,es]=(0,R.useState)(null),er=(0,R.useCallback)(async()=>{try{let e=await fetch("/api/system/workspaces");if(!e.ok)throw Error("Failed");let t=await e.json();if(Z(t.workspaces),Y(t.isAdmin),t.workspaces.length>0){F(!0);let e=new URLSearchParams(window.location.search).get("ws"),a=e?t.workspaces.find(t=>t.id===e):null,n=a??[...t.workspaces].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];if(K(n.id),z(n.rootDir),!a){let e=new URL(location.href);e.searchParams.set("ws",n.id),history.replaceState(null,"",e.toString())}}else F(!1)}catch{F(!1)}},[]);(0,R.useEffect)(()=>{er()},[er]);let ei=(0,nI.useEditorStore)(e=>e.currentPath),el=aC(e=>e.recents),[eo,ec]=(0,R.useState)(!1),[ed,eu]=(0,R.useState)(!0),ep=aA(e=>e.pins),em=(0,R.useRef)(null),eh=(0,aT.useAIPanelStore)(e=>e.activity),ex=(0,R.useMemo)(()=>{let e=new Date(Date.now()-6e4).toISOString(),t=new Set;for(let a of eh)a.at>=e&&a.path&&a.by?.startsWith("ai:")&&t.add(a.path);return t},[eh]);(0,R.useEffect)(()=>{let e=()=>{aT.useAIPanelStore.getState().loadActivity()};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),(0,R.useEffect)(()=>{aC.getState().loadForWorkspace(q),aA.getState().loadForWorkspace(q)},[q]);let ef=(0,R.useRef)(new URLSearchParams(window.location.search).get("path")),eg=(0,R.useRef)(!1),[eb,ew]=(0,R.useState)([]),[ey,ev]=(0,R.useState)(!1),[eN,ek]=(0,R.useState)(!1),ej=(0,R.useRef)(!1),[e_,eE]=(0,R.useState)(!1),[eC,eS]=(0,R.useState)(!1),[eM,eA]=(0,R.useState)(null),eO=(0,R.useRef)(null),eT=(0,R.useRef)(""),[eD,eI]=(0,R.useState)(null),[eR,eL]=(0,R.useState)(""),[eF,eB]=(0,R.useState)(null),[eP,ez]=(0,R.useState)(null),[e$,eU]=(0,R.useState)(""),[eq,eK]=(0,R.useState)(null),[eH,eW]=(0,R.useState)(null),[eG,eV]=(0,R.useState)(!1),[eZ,eX]=(0,R.useState)(null),[eQ,eJ]=(0,R.useState)(!1),[eY,e0]=(0,R.useState)(0),[e1,e2]=(0,R.useState)(!1),[e3,e5]=(0,R.useState)(!1),[e4,e7]=(0,R.useState)(!1),[e6,e8]=(0,R.useState)(null),[te,tt]=(0,R.useState)(0),[ta,tn]=(0,R.useState)(!1),[ts,ti]=(0,R.useState)(!1),[tu,tp]=(0,R.useState)(""),[tm,tx]=(0,R.useState)(!1),[tg,tb]=(0,R.useState)(null),ty=(0,R.useRef)(null),[tN,tk]=(0,R.useState)(null),tj=(0,R.useRef)(null),tC=(0,R.useRef)(!1),tS=(0,R.useRef)(async()=>{});(0,R.useEffect)(()=>{ey||ej.current||(ej.current=!0,ek(!0),nq("").then(e=>{ew(e),ev(!0),ek(!1)}).catch(()=>{ej.current=!1,ek(!1)}))},[ey]);let tM=(0,R.useCallback)(async e=>{let t=e.split("/");if(t.length<=1)return;let a=[],n="";for(let e=0;e<t.length-1;e++)n=n?`${n}/${t[e]}`:t[e],a.push({prefix:n,children:await nq(n)});ew(e=>{let t=e;for(let{prefix:e,children:n}of a)t=nK(t,e,e=>({...e,children:n,expanded:!0}));return t})},[]),tA=(0,R.useCallback)(async e=>{let t=await nq(e);""===e?ew(e=>{let a=new Map(e.map(e=>[e.path,e]));return t.map(e=>{let t=a.get(e.path);return t&&("dir"===t.type||"app"===t.type)?{...e,expanded:t.expanded,children:t.children}:e})}):ew(a=>nK(a,e,e=>({...e,children:t,expanded:!0})))},[]),tO=(0,R.useCallback)(e=>{let t=[];for(let a of e)("dir"===a.type||"app"===a.type||"node-app"===a.type)&&a.expanded&&a.children&&(t.push(a.path),t.push(...tO(a.children)));return t},[]),tT=(0,R.useCallback)(async()=>{eE(!0);try{let e=tO(eb),t=await nq("");for(let a of(ew(t),e)){let e=await nq(a);ew(t=>nK(t,a,t=>({...t,children:e,expanded:!0})))}}finally{eE(!1)}},[eb,tO]),tD=(0,R.useCallback)(async()=>{if(eZ){if(n$(eZ.name)){tn(!0);try{await nI.useEditorStore.getState().loadPage(eZ.path)}finally{tn(!1)}return}if(["editor","text"].includes(nB(eZ.name,eZ.nodeType))||nz(eZ.name)){tn(!0);try{let e=await (0,$.wsFetch)(`/api/wiki/content?path=${encodeURIComponent(eZ.path)}`);if(e.ok){let t=await e.json();e8(t.content),tt(Number(e.headers.get("X-Wiki-Revision")??0))}}catch{}tn(!1)}}},[eZ]);async function tR(e){if("dir"===e.type||"app"===e.type||"node-app"===e.type)if(e.expanded)ew(t=>nK(t,e.path,e=>({...e,expanded:!1})));else if(void 0===e.children){ew(t=>nK(t,e.path,e=>({...e,loading:!0})));let t=await nq(e.path);ew(a=>nK(a,e.path,e=>({...e,loading:!1,children:t,expanded:!0})))}else ew(t=>nK(t,e.path,e=>({...e,expanded:!0})))}async function tL(e){if("file"===e.type&&aC.getState().push({path:e.path,name:e.name},q),eX({path:e.path,name:e.name,nodeType:"app"===e.type?"app":"node-app"===e.type?"node-app":"file"}),ti(!1),tb(null),e8(null),tt(0),"file"===e.type&&n$(e.name)){tn(!0);try{await nI.useEditorStore.getState().loadPage(e.path)}finally{tn(!1)}return}if(["editor","text"].includes(nB(e.name,e.type))||nz(e.name)){tn(!0);try{let t=await (0,$.wsFetch)(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(t.ok){let e=await t.json();e8(e.content),tt(Number(t.headers.get("X-Wiki-Revision")??0))}}catch{}tn(!1)}}(0,R.useEffect)(()=>{eZ&&n$(eZ.name)&&nI.useEditorStore.getState().currentPath!==eZ.path&&nI.useEditorStore.getState().loadPage(eZ.path)},[eZ]),(0,R.useEffect)(()=>{tj.current=eZ},[eZ]),(0,R.useEffect)(()=>{tC.current=ts},[ts]),(0,R.useEffect)(()=>{tS.current=tD},[tD]),(0,R.useEffect)(()=>{if(!n)return;let e=new Map,t=new EventSource((0,$.withWs)("/api/wiki/watch"));return t.onmessage=t=>{var a;let n;try{n=JSON.parse(t.data)}catch{return}let{type:s,path:r}=n,i=r.split("/");if(a=i.length>1?i.slice(0,-1).join("/"):"",e.has(a)&&clearTimeout(e.get(a)),e.set(a,setTimeout(()=>{e.delete(a),tA(a)},300)),"change"===s&&tj.current?.path===r&&!tC.current){let t=`__file__${r}`;e.has(t)&&clearTimeout(e.get(t)),e.set(t,setTimeout(()=>{e.delete(t),tS.current()},400))}},()=>{for(let a of(t.close(),e.values()))clearTimeout(a)}},[n,tA]),(0,R.useEffect)(()=>{eJ(!1)},[]);let tB=(0,R.useCallback)(e=>{let t=e.split("/").pop()??e;tM(e),tL({path:e,name:t,type:"file"})},[tM]);(0,R.useEffect)(()=>{if(!ei||eZ&&eZ.path===ei)return;let e=ei.split("/").pop()??ei;tL({path:ei,name:e,type:"file"})},[ei]),(0,R.useEffect)(()=>{let e=new URL(window.location.href);eZ?e.searchParams.set("path",eZ.path):e.searchParams.delete("path"),window.history.replaceState(null,"",e.toString())},[eZ]),(0,R.useEffect)(()=>{if(eg.current||!ey)return;let e=ef.current;if(!e){eg.current=!0;return}eg.current=!0,(async()=>{let t=e.split("/"),a=t[t.length-1],n=t.slice(0,-1).join("/"),s=(await nq(n)).find(t=>t.path===e);s&&(await tM(e),tL({path:e,name:a,type:s.type,modifiedAt:s.modifiedAt}))})()},[ey,tM]);let tP=(0,R.useCallback)(async e=>{if(e===q)return;try{await fetch(`/api/system/workspaces/${e}/open`,{method:"POST"})}catch{}let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.pushState(null,"",t.toString()),eX(null),e8(null),ti(!1),ew([]),ev(!1),ej.current=!1,nL.useWikiSlugsStore.getState().invalidate();let a=H.find(t=>t.id===e);a&&z(a.rootDir),K(e)},[q,H]),tz=(0,R.useCallback)(async()=>{if(en)try{if(!(await fetch(`/api/system/workspaces/${en}`,{method:"DELETE"})).ok)throw Error("Failed");if(en===q){let e=H.filter(e=>e.id!==en);if(e.length>0){let t=[...e].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];await tP(t.id)}else F(!1)}await er()}catch{}finally{es(null)}},[en,q,H,tP,er]);async function t$(){if(!eZ)return;tx(!0),tb(null);let e=await (0,$.wsFetch)("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eZ.path,content:tu,baseRevision:te})});if(e.ok){let t=await e.json();"number"==typeof t.revision&&tt(t.revision),e8(tu),ti(!1)}else tb((await e.json()).error??"Save failed");tx(!1)}let tU=(0,R.useCallback)(async(e,t)=>{let a=Array.from(e);if(a.length){eS(!0),eA(null);try{for(let e of a){let a=new FormData;a.append("file",e),a.append("dir",t);let n=await (0,$.wsFetch)("/api/wiki/upload",{method:"POST",body:a});if(!n.ok){let e=await n.json();eA(e.error??"Upload failed"),(0,tI.showError)(e.error??"Upload failed");break}}await tA(t)}catch{eA("Upload failed.")}finally{eS(!1),eO.current&&(eO.current.value="")}}},[tA]);function tq(e){eT.current=e,eO.current?.click()}async function tK(){let e=eR.trim();if(!e||null===eD)return;eB(null);let t=eD?`${eD}/${e}`:e,a=await (0,$.wsFetch)("/api/wiki/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});a.ok?(eI(null),eL(""),await tA(eD),""!==eD&&ew(e=>nK(e,eD,e=>({...e,expanded:!0})))):eB((await a.json()).error??"Failed")}async function tH(){let e=e$.trim();if(!e||null===eP)return;eK(null);let t=e.includes(".")?e:`${e}.md`,a=eP?`${eP}/${t}`:t,n=await (0,$.wsFetch)("/api/wiki/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});n.ok?(ez(null),eU(""),await tA(eP),""!==eP&&ew(e=>nK(e,eP,e=>({...e,expanded:!0}))),tL({path:a,name:t,type:"file",modifiedAt:new Date().toISOString()})):eK((await n.json()).error??"Failed")}function tW(e){navigator.clipboard.writeText(e),(0,tI.showSuccess)("Path copied")}function tG(e){let t=e.replace(/\.(md|markdown)$/i,"");navigator.clipboard.writeText(`[[${t}]]`),(0,tI.showSuccess)("Wiki link copied")}function tV(e){let t=new URL(location.href);t.searchParams.set("path",e),q&&t.searchParams.set("ws",q),navigator.clipboard.writeText(t.toString()),(0,tI.showSuccess)("URL copied")}async function tZ(e){if(eZ?.path===e&&null!==e6)return e6;if(nI.useEditorStore.getState().currentPath===e)return nI.useEditorStore.getState().content;let t=await (0,$.wsFetch)(`/api/wiki/content?path=${encodeURIComponent(e)}`);if(!t.ok)throw Error("Cannot copy content");return(await t.json()).content}async function tX(e){try{let t=await tZ(e);await navigator.clipboard.writeText(t),(0,tI.showSuccess)("Raw content copied")}catch{(0,tI.showError)("Could not copy file content")}}async function tQ(e,t){try{let a=await tZ(e);if(!n$(t)){await navigator.clipboard.writeText(a),(0,tI.showSuccess)("Content copied");return}let n=await (0,e9.markdownToHtml)(a,{pagePath:e,sanitize:!0});"ClipboardItem"in window&&navigator.clipboard.write?await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([n],{type:"text/html"}),"text/plain":new Blob([a],{type:"text/plain"})})]):await navigator.clipboard.writeText(a),(0,tI.showSuccess)("Formatted content copied")}catch{(0,tI.showError)("Could not copy formatted content")}}function tJ(e){return(0,t.jsxs)(tw.DropdownMenu,{children:[(0,t.jsx)(tw.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(L.Button,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 px-2 text-xs",title:"Copy path, wiki link, or URL",children:[(0,t.jsx)(o.Copy,{className:"h-3.5 w-3.5"}),"Copy",(0,t.jsx)(i.ChevronDown,{className:"h-3 w-3 opacity-60"})]})}),(0,t.jsxs)(tw.DropdownMenuContent,{align:"end",className:"w-44",children:[(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tW(e.path),children:[(0,t.jsx)(o.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),n$(e.name)&&(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tG(e.name),children:[(0,t.jsx)(p.FileText,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,t.jsx)(tw.DropdownMenuSeparator,{}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tV(e.path),children:[(0,t.jsx)(b.Link,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),nz(e.name)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tw.DropdownMenuSeparator,{}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>void tX(e.path),children:[(0,t.jsx)(p.FileText,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>void tQ(e.path,e.name),children:[(0,t.jsx)(p.FileText,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]})]})]})}async function tY(){eH&&(await (0,$.wsFetch)("/api/wiki",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:eH})}),(eZ?.path===eH||eZ?.path.startsWith(`${eH}/`))&&(eX(null),e8(null)),ew(e=>(function e(t,a){return t.filter(e=>e.path!==a).map(t=>t.children?{...t,children:e(t.children,a)}:t)})(e,eH)),eW(null))}function t0(e,t,a){e.preventDefault(),e.stopPropagation();let n=ty.current;!n||n.path===t||t.startsWith(`${n.path}/`)||(e.dataTransfer.dropEffect="move",tk("root"===a?"":t))}async function t1(e,t){e.preventDefault(),e.stopPropagation(),tk(null);let a=ty.current;if(ty.current=null,!a||a.path===t||t.startsWith(`${a.path}/`))return;let n=t?`${t}/${a.name}`:a.name;if(n!==a.path&&(await (0,$.wsFetch)("/api/wiki/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a.path,to:n})})).ok){let e=a.path.includes("/")?a.path.split("/").slice(0,-1).join("/"):"";await tA(e),t!==e&&await tA(t),eZ?.path===a.path&&eX({path:n,name:a.name,nodeType:eZ.nodeType})}}let t2=eZ?nB(eZ.name,eZ.nodeType):null,t3=(0,nA.useViewWidthStore)(e=>e.width),t5=null===t2||"editor"===t2||"text"===t2||"source"===t2||"notebook"===t2||"fallback"===t2,t7=t5?nA.VIEW_WIDTH_CLASS[t3]:"";return(0,t.jsxs)("div",{className:"flex h-screen gap-0 overflow-hidden bg-background",children:[null===n&&(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!1===n&&(0,t.jsx)(t_,{onSelect:e=>{let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.replaceState(null,"",t.toString()),ev(!1),ej.current=!1,K(e),F(!0),er()}}),!0===n&&ee&&(0,t.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,t.jsx)("div",{className:"flex items-center justify-end border-b px-3 py-2 bg-muted shrink-0",children:(0,t.jsxs)(L.Button,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>et(!1),children:[(0,t.jsx)(I.X,{className:"h-3.5 w-3.5"})," Cancel"]})}),(0,t.jsx)(t_,{onSelect:e=>{et(!1),er(),tP(e)}})]}),!0===n&&!ee&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nT,{onOpenFile:tB,onToggleSidebar:()=>e2(e=>!e),onNewFile:()=>ez(""),onCopyPath:()=>{eZ&&navigator.clipboard.writeText(eZ.path)}}),!e1&&(0,t.jsxs)(t9.Card,{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,t.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b bg-muted shrink-0",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-5 w-5 shrink-0"}),(0,t.jsx)("span",{className:"truncate text-xs font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 shrink-0",title:"Collapse sidebar",onClick:()=>e2(!0),children:(0,t.jsx)(N,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 border-b bg-muted/50 shrink-0",children:[(0,t.jsxs)(tw.DropdownMenu,{children:[(0,t.jsx)(tw.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(L.Button,{size:"sm",variant:"ghost",className:"h-7 gap-1 px-2 text-xs",disabled:eC,children:[eC?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(E,{className:"h-3.5 w-3.5"}),"New",(0,t.jsx)(i.ChevronDown,{className:"h-3 w-3 opacity-60"})]})}),(0,t.jsxs)(tw.DropdownMenuContent,{align:"start",className:"w-44",children:[(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>{ez(""),eU(""),eK(null)},children:[(0,t.jsx)(u.FilePlus,{className:"mr-2 h-3.5 w-3.5"}),"New file"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>{eI(""),eL(""),eB(null)},children:[(0,t.jsx)(x,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tq(""),disabled:eC,children:[(0,t.jsx)(D.Upload,{className:"mr-2 h-3.5 w-3.5"}),"Upload"]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh tree",onClick:tT,disabled:e_,children:e_?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(C,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(tE.ThemeToggle,{}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"AI Agent panel",onClick:()=>aT.useAIPanelStore.getState().toggle(),children:(0,t.jsx)(s,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Settings",onClick:()=>e5(!0),children:(0,t.jsx)(S,{className:"h-3.5 w-3.5"})})]})]}),eM&&(0,t.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,t.jsx)(a.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),eM]}),""===eD&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,t.jsx)(m.Folder,{className:"h-4 w-4 shrink-0 text-warning"}),(0,t.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:eR,onChange:e=>eL(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tK(),"Escape"===e.key&&(eI(null),eL(""))}}),eF&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:eF}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tK,children:(0,t.jsx)(r.Check,{className:"h-3 w-3"})}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{eI(null),eL("")},children:(0,t.jsx)(I.X,{className:"h-3 w-3"})})]}),""===eP&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,t.jsx)(p.FileText,{className:"h-4 w-4 shrink-0 text-accent"}),(0,t.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:e$,onChange:e=>eU(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tH(),"Escape"===e.key&&(ez(null),eU(""))}}),eq&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:eq}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tH,children:(0,t.jsx)(r.Check,{className:"h-3 w-3"})}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{ez(null),eU("")},children:(0,t.jsx)(I.X,{className:"h-3 w-3"})})]}),(0,t.jsx)("div",{className:"border-b",children:(0,t.jsx)(nD,{onOpenFile:tB})}),(0,t.jsxs)("div",{ref:em,className:(0,U.cn)("flex-1 overflow-auto py-1",""===tN&&"ring-2 ring-inset ring-primary bg-primary/5"),onDragOver:e=>t0(e,"","root"),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||tk(null)},onDrop:e=>t1(e,""),children:[ep.length>0&&(0,t.jsxs)("div",{className:"border-b mb-1",children:[(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>ec(e=>!e),children:[eo?(0,t.jsx)(l.ChevronRight,{className:"h-3 w-3"}):(0,t.jsx)(i.ChevronDown,{className:"h-3 w-3"}),(0,t.jsx)(_,{className:"h-3 w-3"}),"Pinned",(0,t.jsx)("span",{className:"ml-auto text-[9px] tabular-nums opacity-60",children:ep.length})]}),!eo&&ep.map(e=>(0,t.jsxs)("div",{role:"button",tabIndex:0,className:(0,U.cn)("group flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eZ?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void tL({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),tL({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}))},children:[(0,t.jsx)(A,{className:"h-3 w-3 shrink-0 fill-current text-amber-400"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs",children:e.name}),(0,t.jsx)("span",{className:"max-w-[80px] truncate text-[10px] text-muted-foreground/60",children:e.path.split("/").slice(0,-1).join("/")}),(0,t.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground/50 opacity-0 transition-colors hover:bg-muted hover:text-amber-400 group-hover:opacity-100 focus:opacity-100",title:"Remove from pinned",onClick:t=>{t.stopPropagation(),aA.getState().toggle({path:e.path,name:e.name},q)},children:(0,t.jsx)(I.X,{className:"h-3 w-3"})})]},e.path))]}),el.length>0&&(0,t.jsxs)("div",{className:"border-b mb-1",children:[(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center gap-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",onClick:()=>eu(e=>!e),children:[ed?(0,t.jsx)(l.ChevronRight,{className:"h-3 w-3"}):(0,t.jsx)(i.ChevronDown,{className:"h-3 w-3"}),"Recent",(0,t.jsx)("span",{className:"ml-auto text-[9px] tabular-nums opacity-60",children:el.length})]}),!ed&&el.slice(0,8).map(e=>(0,t.jsxs)("div",{role:"button",tabIndex:0,className:(0,U.cn)("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer transition-colors select-none",eZ?.path===e.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted"),onClick:()=>void tL({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),tL({path:e.path,name:e.name,type:e.type??"file",modifiedAt:""}))},children:[(0,t.jsx)(p.FileText,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 truncate text-xs",children:e.name}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground/60 truncate max-w-[80px]",children:e.path.split("/").slice(0,-1).join("/")})]},e.path))]}),eN?(0,t.jsx)("div",{className:"flex justify-center py-6",children:(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===eb.length?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[(0,t.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,t.jsx)(p.FileText,{className:"h-6 w-6 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"No files yet"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload files or add them to the configured directory"})]}),(0,t.jsxs)(L.Button,{size:"sm",variant:"outline",className:"w-full gap-1.5 max-w-[180px]",onClick:()=>tq(""),disabled:eC,children:[eC?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(D.Upload,{className:"h-3.5 w-3.5"}),"Upload Files"]})]}):function e(a,n=0){return a.map(a=>{let s=ep.some(e=>e.path===a.path);return(0,t.jsxs)(ar,{children:[(0,t.jsx)(al,{asChild:!0,children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{role:"treeitem",tabIndex:0,draggable:!0,onKeyDown:e=>{if("Enter"===e.key||" "===e.key)e.preventDefault(),"dir"===a.type?tR(a):"app"===a.type||"node-app"===a.type?(tL(a),tR(a)):tL(a);else if("ArrowDown"===e.key){e.preventDefault();let t=em.current;if(!t)return;let a=Array.from(t.querySelectorAll('[role="treeitem"]')),n=a.indexOf(e.currentTarget);a[n+1]?.focus()}else if("ArrowUp"===e.key){e.preventDefault();let t=em.current;if(!t)return;let a=Array.from(t.querySelectorAll('[role="treeitem"]')),n=a.indexOf(e.currentTarget);a[n-1]?.focus()}else if("ArrowRight"===e.key){if(e.preventDefault(),"dir"===a.type||"app"===a.type||"node-app"===a.type)if(a.expanded){let t=em.current;if(!t)return;let a=Array.from(t.querySelectorAll('[role="treeitem"]')),n=a.indexOf(e.currentTarget);a[n+1]?.focus()}else tR(a)}else if("ArrowLeft"===e.key){if(e.preventDefault(),("dir"===a.type||"app"===a.type||"node-app"===a.type)&&a.expanded)tR(a);else if(n>0){let t=em.current;if(!t)return;let a=Array.from(t.querySelectorAll('[role="treeitem"]')),n=e.currentTarget,s=a.indexOf(n),r=Number.parseInt(n.style.paddingLeft??"0",10);for(let e=s-1;e>=0;e--)if(Number.parseInt(a[e].style.paddingLeft??"0",10)<r){a[e].focus();break}}}},onDragStart:e=>{ty.current=a,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a.path)},onDragOver:e=>"dir"===a.type?t0(e,a.path,"dir"):e.preventDefault(),onDragLeave:()=>tk(null),onDrop:e=>"dir"===a.type?t1(e,a.path):e.preventDefault(),className:(0,U.cn)("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer group transition-colors select-none",eZ?.path===a.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted",tN===a.path&&"ring-2 ring-primary bg-primary-soft",a.name.startsWith(".")&&"opacity-40"),style:{paddingLeft:`${14*n+8}px`},onClick:()=>{"dir"===a.type?tR(a):"app"===a.type||"node-app"===a.type?(tL(a),tR(a)):tL(a)},children:["dir"===a.type||"app"===a.type||"node-app"===a.type?a.loading?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):a.expanded?(0,t.jsx)(i.ChevronDown,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,t.jsx)(l.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,t.jsx)("span",{className:"w-3.5 shrink-0"}),"dir"===a.type?a.expanded?(0,t.jsx)(h,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-warning")}):(0,t.jsx)(m.Folder,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-warning")}):"app"===a.type?(0,t.jsx)(f.Globe,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-foreground/70")}):"node-app"===a.type?(0,t.jsx)(O,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-emerald-500")}):"html"===nB(a.name,"file")?(0,t.jsx)(f.Globe,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-foreground/60")}):nU(a.name)?(0,t.jsx)(g.default,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-sunshine-700")}):nz(a.name)?(0,t.jsx)(p.FileText,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-foreground/70")}):(0,t.jsx)(d.File,{className:(0,U.cn)("h-4 w-4 shrink-0",eZ?.path!==a.path&&"text-foreground/60")}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.name}),ex.has(a.path)&&(0,t.jsx)("span",{className:"ml-0.5 h-1.5 w-1.5 rounded-full bg-emerald-400 shrink-0 animate-pulse",title:"Agent recently active"}),(0,t.jsx)("div",{className:"flex max-w-0 shrink-0 items-center overflow-hidden opacity-0 transition-all duration-150 group-hover:max-w-7 group-hover:opacity-100 focus-within:max-w-7 focus-within:opacity-100",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,t.jsxs)(tw.DropdownMenu,{children:[(0,t.jsx)(tw.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"File actions",children:(0,t.jsx)(v,{className:"h-3.5 w-3.5"})})}),(0,t.jsxs)(tw.DropdownMenuContent,{align:"end",className:"w-48",children:[(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tW(a.path),children:[(0,t.jsx)(o.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Copy path"]}),n$(a.name)&&(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tG(a.name),children:[(0,t.jsx)(p.FileText,{className:"mr-2 h-3.5 w-3.5"}),"Copy wiki link"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tV(a.path),children:[(0,t.jsx)(b.Link,{className:"mr-2 h-3.5 w-3.5"}),"Copy URL"]}),"file"===a.type&&nz(a.name)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>void tX(a.path),children:[(0,t.jsx)(p.FileText,{className:"mr-2 h-3.5 w-3.5"}),"Copy raw content"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>void tQ(a.path,a.name),children:[(0,t.jsx)(p.FileText,{className:"mr-2 h-3.5 w-3.5"}),"Copy formatted content"]})]}),(0,t.jsx)(tw.DropdownMenuSeparator,{}),"dir"===a.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(tw.DropdownMenuItem,{onClick:async()=>{a.expanded||await tR(a),ez(a.path),eU(""),eK(null)},children:[(0,t.jsx)(u.FilePlus,{className:"mr-2 h-3.5 w-3.5"}),"New file here"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>tq(a.path),children:[(0,t.jsx)(D.Upload,{className:"mr-2 h-3.5 w-3.5"}),"Upload here"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>{eI(a.path),eL(""),eB(null)},children:[(0,t.jsx)(x,{className:"mr-2 h-3.5 w-3.5"}),"New subfolder"]}),(0,t.jsx)(tw.DropdownMenuSeparator,{})]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>{let e,t;return e=(0,$.withWs)(`/api/wiki/download?path=${encodeURIComponent(a.path)}`),void((t=document.createElement("a")).href=e,t.download="file"===a.type?a.name:`${a.name}.zip`,document.body.appendChild(t),t.click(),t.remove())},children:[(0,t.jsx)(c,{className:"mr-2 h-3.5 w-3.5"}),"file"===a.type?"Download":"Download as zip"]}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>aA.getState().toggle({path:a.path,name:a.name,type:"dir"===a.type?"file":a.type},q),children:[(0,t.jsx)(A,{className:(0,U.cn)("mr-2 h-3.5 w-3.5",s&&"fill-current text-amber-400")}),s?"Unpin":"Pin to top"]}),(0,t.jsx)(tw.DropdownMenuSeparator,{}),(0,t.jsxs)(tw.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>{eW(a.path),eV("file"!==a.type)},children:[(0,t.jsx)(T.Trash2,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]})})]}),eD===a.path&&"dir"===a.type&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,t.jsx)("span",{className:"w-3.5 shrink-0"}),(0,t.jsx)(m.Folder,{className:"h-4 w-4 shrink-0 text-warning"}),(0,t.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:eR,onChange:e=>eL(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tK(),"Escape"===e.key&&(eI(null),eL(""))}}),eF&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:eF}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tK,children:(0,t.jsx)(r.Check,{className:"h-3 w-3"})}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{eI(null),eL("")},children:(0,t.jsx)(I.X,{className:"h-3 w-3"})})]}),eP===a.path&&"dir"===a.type&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,t.jsx)("span",{className:"w-3.5 shrink-0"}),(0,t.jsx)(p.FileText,{className:"h-4 w-4 shrink-0 text-accent"}),(0,t.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:e$,onChange:e=>eU(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tH(),"Escape"===e.key&&(ez(null),eU(""))}}),eq&&(0,t.jsx)("span",{className:"text-xs text-destructive",children:eq}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tH,children:(0,t.jsx)(r.Check,{className:"h-3 w-3"})}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{ez(null),eU("")},children:(0,t.jsx)(I.X,{className:"h-3 w-3"})})]}),("dir"===a.type||"app"===a.type||"node-app"===a.type)&&a.expanded&&a.children&&a.children.length>0&&e(a.children,n+1),("dir"===a.type||"app"===a.type||"node-app"===a.type)&&a.expanded&&a.children?.length===0&&(0,t.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"})]})}),(0,t.jsxs)(av,{children:[(0,t.jsx)(aN,{onSelect:()=>tW(a.path),children:"Copy path"}),n$(a.name)&&(0,t.jsx)(aN,{onSelect:()=>tG(a.name),children:"Copy wiki link"}),(0,t.jsx)(ak,{}),(0,t.jsx)(aN,{onSelect:()=>tV(a.path),children:"Copy URL"}),"file"===a.type&&nz(a.name)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ak,{}),(0,t.jsx)(aN,{onSelect:()=>void tX(a.path),children:"Copy raw content"}),(0,t.jsx)(aN,{onSelect:()=>void tQ(a.path,a.name),children:"Copy formatted content"})]})]})]},a.path)})}(eb)]}),(0,t.jsx)("div",{className:"border-t px-2 py-2 bg-muted shrink-0",children:(0,t.jsxs)(tw.DropdownMenu,{children:[(0,t.jsx)(tw.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(L.Button,{size:"sm",variant:"ghost",className:"w-full h-auto justify-between gap-2 px-2 py-1.5 text-left",title:P??"",children:[(0,t.jsxs)("span",{className:"flex flex-col min-w-0",children:[(0,t.jsx)("span",{className:"truncate text-xs font-medium",children:H.find(e=>e.id===q)?.name??"Workspace"}),(0,t.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:P??""})]}),(0,t.jsx)(i.ChevronDown,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),(0,t.jsxs)(tw.DropdownMenuContent,{align:"start",className:"w-60",children:[H.map(e=>(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>void tP(e.id),className:(0,U.cn)("gap-2",e.id===q&&"font-medium"),children:[e.id===q?(0,t.jsx)(r.Check,{className:"h-3.5 w-3.5 shrink-0"}):(0,t.jsx)("span",{className:"w-3.5 shrink-0"}),(0,t.jsxs)("span",{className:"flex flex-col min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:e.rootDir})]}),J&&(0,t.jsx)("button",{className:"ml-auto shrink-0 rounded p-0.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:"Delete workspace (does not delete files)",onClick:t=>{t.stopPropagation(),es(e.id)},children:(0,t.jsx)(T.Trash2,{className:"h-3.5 w-3.5"})})]},e.id)),J&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tw.DropdownMenuSeparator,{}),(0,t.jsxs)(tw.DropdownMenuItem,{onClick:()=>et(!0),children:[(0,t.jsx)(x,{className:"mr-2 h-3.5 w-3.5"}),"Add workspace…"]})]})]})]})})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[e1&&(0,t.jsx)(L.Button,{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:()=>e2(!1),children:(0,t.jsx)(k,{className:"h-3.5 w-3.5"})}),eZ?"node-app"===t2?(0,t.jsx)(tv,{path:eZ.path,title:eZ.name}):"app"===t2||"html"===t2?(e="html"===t2?`/api/assets/${eZ.path}`:void 0,eQ?(0,t.jsx)(tf,{path:eZ.path,title:eZ.name,src:e,fullscreen:!0,onExit:()=>eJ(!1)}):(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)(f.Globe,{className:"h-4 w-4 shrink-0 text-accent"}),(0,t.jsx)("span",{className:"text-sm font-normal truncate",title:eZ.path,children:eZ.path})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tJ(eZ),"html"===t2&&!ts&&null!==e6&&(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Edit source",onClick:()=>{ti(!0),tp(e6),tb(null)},children:(0,t.jsx)(j,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:()=>e0(e=>e+1),children:(0,t.jsx)(C,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)(L.Button,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>eJ(!0),children:[(0,t.jsx)(y,{className:"h-3.5 w-3.5"}),"Open fullscreen"]}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eX(null),ti(!1)},children:(0,t.jsx)(I.X,{className:"h-3.5 w-3.5"})})]})]}),ts&&"html"===t2?(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,t.jsx)("textarea",{value:tu,onChange:e=>tp(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,t.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[tg&&(0,t.jsx)("span",{className:"text-xs text-destructive mr-auto",children:tg}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",onClick:()=>{ti(!1),tb(null)},children:"Cancel"}),(0,t.jsxs)(L.Button,{size:"sm",className:"gap-1",onClick:t$,disabled:tm,children:[tm&&(0,t.jsx)(w.Loader2,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,t.jsx)(tf,{path:eZ.path,title:eZ.name,src:e},eY)]})):(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[nU(eZ.name)?(0,t.jsx)(g.default,{className:"h-4 w-4 shrink-0 text-sunshine-700"}):nz(eZ.name)?(0,t.jsx)(p.FileText,{className:"h-4 w-4 shrink-0 text-accent"}):(0,t.jsx)(d.File,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-sm font-normal truncate",title:eZ.path,children:eZ.path})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[tJ(eZ),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Share",onClick:()=>e7(!0),children:(0,t.jsx)(M,{className:"h-3.5 w-3.5"})}),nz(eZ.name)&&!ts&&(null!==e6||n$(eZ.name))&&(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{ti(!0),tp(e6??""),tb(null),n$(eZ.name)&&nI.useEditorStore.getState().loadPage(eZ.path)},children:(0,t.jsx)(j,{className:"h-3.5 w-3.5"})}),nz(eZ.name)&&!ts&&(null!==e6||n$(eZ.name))&&(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:tD,disabled:ta,children:ta?(0,t.jsx)(w.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(C,{className:"h-3.5 w-3.5"})}),t5&&(0,t.jsx)(nR.ViewWidthToggle,{}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eX(null),e8(null),ti(!1)},children:(0,t.jsx)(I.X,{className:"h-3.5 w-3.5"})})]})]}),ts?(0,t.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:n$(eZ.name)?(0,t.jsx)(G.KBEditor,{}):(0,t.jsx)("textarea",{value:tu,onChange:e=>tp(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"})}):n$(eZ.name)?(0,t.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:ta?(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,t.jsx)(G.KBEditor,{mode:"viewing"})}):(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4 min-h-0",children:(0,t.jsx)("div",{className:(0,U.cn)("mx-auto w-full",t7),children:ta?(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)(w.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):"csv"===t2?(0,t.jsx)(W,{path:eZ.path,title:eZ.name}):"pdf"===t2?(0,t.jsx)(td,{path:eZ.path,title:eZ.name}):"mermaid"===t2?(0,t.jsx)(ea,{path:eZ.path,title:eZ.name}):"notebook"===t2?(0,t.jsx)(tr,{path:eZ.path,title:eZ.name}):"image"===t2?(0,t.jsx)(X,{path:eZ.path,title:eZ.name}):"media"===t2?(0,t.jsx)(Q,{path:eZ.path,title:eZ.name,type:["mp4","webm","mov","m4v"].includes(nF(eZ.name))?"video":"audio"}):"docx"===t2?(0,t.jsx)(tl,{path:eZ.path,title:eZ.name}):"xlsx"===t2?(0,t.jsx)(tc,{path:eZ.path,title:eZ.name}):"pptx"===t2?(0,t.jsx)(to,{path:eZ.path,title:eZ.name}):"source"===t2?(0,t.jsx)(th,{path:eZ.path,title:eZ.name}):"fallback"===t2?(0,t.jsx)(V,{path:eZ.path,title:eZ.name}):null!==e6?(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words leading-relaxed",children:e6}):nz(eZ.name)?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Could not load file."}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Preview not available for this file type."})})}),ts&&!n$(eZ.name)&&(0,t.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[tg&&(0,t.jsx)("span",{className:"text-xs text-destructive mr-auto",children:tg}),(0,t.jsx)(L.Button,{size:"sm",variant:"ghost",onClick:()=>{ti(!1),tb(null)},children:"Cancel"}),(0,t.jsxs)(L.Button,{size:"sm",className:"gap-1",onClick:t$,disabled:tm,children:[tm&&(0,t.jsx)(w.Loader2,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,t.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[(0,t.jsx)(p.FileText,{className:"h-8 w-8 text-muted-foreground"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a file to view or edit"})]})})]}),(0,t.jsx)(t4,{open:e4,onOpenChange:e7,filePath:eZ?.path??""}),(0,t.jsx)(tF,{open:e3,onOpenChange:e5}),(0,t.jsx)(aK,{currentPath:eZ?.path}),(0,t.jsx)("input",{ref:eO,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&tU(e.target.files,eT.current)}}),(0,t.jsx)(B,{open:!!eH,onOpenChange:e=>{e||eW(null)},title:eG?"Delete folder?":"Delete file?",description:eG?`"${eH?.split("/").pop()}" and all its contents will be permanently deleted.`:`"${eH?.split("/").pop()}" will be permanently removed.`,onConfirm:tY}),(0,t.jsx)(B,{open:!!en,onOpenChange:e=>{e||es(null)},title:"Delete workspace?",description:`"${H.find(e=>e.id===en)?.name??""}" will be removed from the workspace list. Files on disk are NOT deleted.`,onConfirm:tz})]})]},q??"none")}],952683)}]);
|