loki-mode 9.18.4 → 9.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/autonomy/lib/deadline.py +21 -1
  4. package/autonomy/lib/outcome_contract.py +128 -0
  5. package/autonomy/lib/proof-generator.py +45 -0
  6. package/autonomy/lib/proof-verify.py +53 -0
  7. package/autonomy/loki +980 -24
  8. package/autonomy/receipt_jwt.py +308 -0
  9. package/autonomy/run.sh +30 -0
  10. package/autonomy/trigger-server.py +186 -1
  11. package/dashboard/__init__.py +1 -1
  12. package/dashboard/server.py +83 -0
  13. package/dashboard/static/index.html +144 -0
  14. package/docs/COMPETITIVE-SCORECARD.md +76 -0
  15. package/docs/PROOF-PASSPORT.md +29 -0
  16. package/docs/SIGNED-RECEIPTS.md +111 -0
  17. package/docs/metrics.md +32 -0
  18. package/events/emit.sh +31 -0
  19. package/loki-ts/dist/loki.js +2 -2
  20. package/mcp/__init__.py +1 -1
  21. package/package.json +1 -1
  22. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  23. package/tools/proof-passport.py +175 -0
  24. package/web-app/dist/assets/{AdminPage-CcCJ0Sjt.js → AdminPage-DNGNuAge.js} +1 -1
  25. package/web-app/dist/assets/{Avatar-DK8kmayw.js → Avatar-CqAveJaT.js} +1 -1
  26. package/web-app/dist/assets/{Badge-4uAWnemi.js → Badge-BtMejA0Z.js} +1 -1
  27. package/web-app/dist/assets/{Button-BBMk33tk.js → Button-CikxmqSs.js} +1 -1
  28. package/web-app/dist/assets/{ComparePage-bt9rwvST.js → ComparePage-BB8DJBWR.js} +1 -1
  29. package/web-app/dist/assets/EvidenceReceiptPanel-6oquKEjd.js +1 -0
  30. package/web-app/dist/assets/{GitHubIssuesPanel-WDbH47UM.js → GitHubIssuesPanel-5XLYWzWH.js} +1 -1
  31. package/web-app/dist/assets/{GitHubPRsPanel-C2CiYtTx.js → GitHubPRsPanel-DUfmFYeu.js} +1 -1
  32. package/web-app/dist/assets/{HomePage-BQk-MUjn.js → HomePage-DZ4MmOdH.js} +5 -5
  33. package/web-app/dist/assets/{LoginPage-DMOZVGGL.js → LoginPage-VMzI6ROD.js} +1 -1
  34. package/web-app/dist/assets/{MagicPage-Bzp2Nt1z.js → MagicPage-CFbX5gWg.js} +1 -1
  35. package/web-app/dist/assets/{MetricsPage-C39JVdsw.js → MetricsPage-DbL6xmRQ.js} +2 -2
  36. package/web-app/dist/assets/{NotFoundPage-6vT_U9UL.js → NotFoundPage-BUrjXPAR.js} +1 -1
  37. package/web-app/dist/assets/{ProjectPage-BfFcZp-E.js → ProjectPage-iP6dJihg.js} +3 -3
  38. package/web-app/dist/assets/{ProjectsPage-CPMBf8Wt.js → ProjectsPage-BibN9bHl.js} +1 -1
  39. package/web-app/dist/assets/{SettingsPage-BnNN6ETl.js → SettingsPage-C0WJp1hW.js} +1 -1
  40. package/web-app/dist/assets/{ShowcasePage-WDrMf-cx.js → ShowcasePage-DUv0Njp8.js} +1 -1
  41. package/web-app/dist/assets/{SystemSettingsPage-DX4jb2e8.js → SystemSettingsPage-BIaCB0Vn.js} +1 -1
  42. package/web-app/dist/assets/{TeamsPage-BCfqcXzu.js → TeamsPage-BE0szv9r.js} +1 -1
  43. package/web-app/dist/assets/{TemplatesPage-CZvmimDj.js → TemplatesPage-BzkA9kat.js} +1 -1
  44. package/web-app/dist/assets/{TerminalOutput-BlRqFwWV.js → TerminalOutput-DBrdT_Fp.js} +1 -1
  45. package/web-app/dist/assets/{activity-CacZsUyr.js → activity-AbfFz38r.js} +1 -1
  46. package/web-app/dist/assets/{bell-DK2qtHnk.js → bell-DF6Z6y5U.js} +1 -1
  47. package/web-app/dist/assets/{bot-CkcUtHad.js → bot-DQ4np_3n.js} +1 -1
  48. package/web-app/dist/assets/{check-CbCPjX3M.js → check-RWuguCwE.js} +1 -1
  49. package/web-app/dist/assets/{chevron-left-5NUKWw3i.js → chevron-left-VpbQPOkC.js} +1 -1
  50. package/web-app/dist/assets/{circle-alert-S7uFoxC2.js → circle-alert-DwT82lJx.js} +1 -1
  51. package/web-app/dist/assets/{clock-CaQRrIrs.js → clock-BBlUa93G.js} +1 -1
  52. package/web-app/dist/assets/{cloud-DBAX6c0r.js → cloud-Dgbz3VCA.js} +1 -1
  53. package/web-app/dist/assets/{code-xml-De5-EXv3.js → code-xml-r6qqION5.js} +1 -1
  54. package/web-app/dist/assets/{copy-CUkT6k1v.js → copy-DMHj52B8.js} +1 -1
  55. package/web-app/dist/assets/{database-BAWf1Gwt.js → database-uJqHSHR1.js} +1 -1
  56. package/web-app/dist/assets/{dollar-sign-Ji8zk86R.js → dollar-sign-BZagljek.js} +1 -1
  57. package/web-app/dist/assets/{file-code-corner-ChtXoBwS.js → file-code-corner-DMopmhu0.js} +1 -1
  58. package/web-app/dist/assets/{file-plus-bFa37P76.js → file-plus-DU_hT_3w.js} +1 -1
  59. package/web-app/dist/assets/{folder-open-DhXpXscO.js → folder-open-BP5TtQAW.js} +1 -1
  60. package/web-app/dist/assets/{git-commit-horizontal-DVPeDQ3j.js → git-commit-horizontal-zFk_IobS.js} +1 -1
  61. package/web-app/dist/assets/{globe-BPZgPeeu.js → globe-mthCRtfp.js} +1 -1
  62. package/web-app/dist/assets/{hammer-jLCaujYH.js → hammer-BWaLBvSA.js} +1 -1
  63. package/web-app/dist/assets/{index-B-0iHBPO.js → index-BXA3UT6P.js} +3 -3
  64. package/web-app/dist/assets/{index-BfZSDej1.css → index-DgpUuqwR.css} +1 -1
  65. package/web-app/dist/assets/{layers-B1vsrsFW.js → layers-Q1LXV5fy.js} +1 -1
  66. package/web-app/dist/assets/{lightbulb-C-uLoq9Y.js → lightbulb-vRRNJ3dB.js} +1 -1
  67. package/web-app/dist/assets/{loader-circle-JTfD-ZuM.js → loader-circle-KgjeHEcV.js} +1 -1
  68. package/web-app/dist/assets/{lock-G9rxD4gZ.js → lock-BerKqno7.js} +1 -1
  69. package/web-app/dist/assets/{mail-BJ0PTN_V.js → mail-XAxTbprX.js} +1 -1
  70. package/web-app/dist/assets/{package-CXClfLOO.js → package-DLPKWAvW.js} +1 -1
  71. package/web-app/dist/assets/{plus-EoL5OCB7.js → plus-NMxxwHMn.js} +1 -1
  72. package/web-app/dist/assets/{refresh-cw-BjREUnVq.js → refresh-cw-Dt42kYtM.js} +1 -1
  73. package/web-app/dist/assets/{rotate-ccw-DahWX07H.js → rotate-ccw-BCR4Tp9u.js} +1 -1
  74. package/web-app/dist/assets/{save-Dek3gCn1.js → save-sR4MJd42.js} +1 -1
  75. package/web-app/dist/assets/{server-D6V1BAia.js → server-SXkchokx.js} +1 -1
  76. package/web-app/dist/assets/{shield-alert-BtTK5Sxb.js → shield-alert-Bvgp6_Dz.js} +1 -1
  77. package/web-app/dist/assets/{trash-2-BT5o_g0r.js → trash-2-D0IGudH7.js} +1 -1
  78. package/web-app/dist/assets/{trending-down-D4Jk7KF3.js → trending-down-BbFFBq-v.js} +1 -1
  79. package/web-app/dist/assets/{trending-up-EQFTzhEo.js → trending-up-DDrJKL5i.js} +1 -1
  80. package/web-app/dist/assets/{upload-JfI5lCSE.js → upload-C54rjN8K.js} +1 -1
  81. package/web-app/dist/assets/{usePolling-BnhPUuGd.js → usePolling-D7fw4YSM.js} +1 -1
  82. package/web-app/dist/assets/{user-DSUiUYtj.js → user-Cg7fbzdh.js} +1 -1
  83. package/web-app/dist/index.html +2 -2
  84. package/web-app/server.py +78 -0
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-B-0iHBPO.js";/**
1
+ import{c as o}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-B-0iHBPO.js";/**
1
+ import{c as e}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-B-0iHBPO.js";/**
1
+ import{c}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-B-0iHBPO.js";/**
1
+ import{c as e}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-B-0iHBPO.js";/**
1
+ import{c as o}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-B-0iHBPO.js";/**
1
+ import{c as e}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-B-0iHBPO.js";/**
1
+ import{c as a}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-B-0iHBPO.js";/**
1
+ import{c as a}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-B-0iHBPO.js";/**
1
+ import{c as o}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-B-0iHBPO.js";/**
1
+ import{c}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-B-0iHBPO.js";/**
1
+ import{c as a}from"./index-BXA3UT6P.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-BQk-MUjn.js","assets/usePolling-BnhPUuGd.js","assets/TerminalOutput-BlRqFwWV.js","assets/lock-G9rxD4gZ.js","assets/Badge-4uAWnemi.js","assets/clock-CaQRrIrs.js","assets/circle-alert-S7uFoxC2.js","assets/check-CbCPjX3M.js","assets/package-CXClfLOO.js","assets/cloud-DBAX6c0r.js","assets/code-xml-De5-EXv3.js","assets/hammer-jLCaujYH.js","assets/chevron-left-5NUKWw3i.js","assets/layers-B1vsrsFW.js","assets/mail-BJ0PTN_V.js","assets/bell-DK2qtHnk.js","assets/file-code-corner-ChtXoBwS.js","assets/ProjectPage-BfFcZp-E.js","assets/Button-BBMk33tk.js","assets/file-plus-bFa37P76.js","assets/activity-CacZsUyr.js","assets/bot-CkcUtHad.js","assets/loader-circle-JTfD-ZuM.js","assets/dollar-sign-Ji8zk86R.js","assets/refresh-cw-BjREUnVq.js","assets/globe-BPZgPeeu.js","assets/copy-CUkT6k1v.js","assets/git-commit-horizontal-DVPeDQ3j.js","assets/upload-JfI5lCSE.js","assets/plus-EoL5OCB7.js","assets/trash-2-BT5o_g0r.js","assets/rotate-ccw-DahWX07H.js","assets/trending-down-D4Jk7KF3.js","assets/save-Dek3gCn1.js","assets/trending-up-EQFTzhEo.js","assets/folder-open-DhXpXscO.js","assets/server-D6V1BAia.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-CPMBf8Wt.js","assets/lightbulb-C-uLoq9Y.js","assets/TemplatesPage-CZvmimDj.js","assets/database-BAWf1Gwt.js","assets/SettingsPage-BnNN6ETl.js","assets/TeamsPage-BCfqcXzu.js","assets/Avatar-DK8kmayw.js","assets/user-DSUiUYtj.js","assets/AdminPage-CcCJ0Sjt.js","assets/shield-alert-BtTK5Sxb.js","assets/SystemSettingsPage-DX4jb2e8.js","assets/MetricsPage-C39JVdsw.js","assets/MagicPage-Bzp2Nt1z.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-DZ4MmOdH.js","assets/usePolling-D7fw4YSM.js","assets/TerminalOutput-DBrdT_Fp.js","assets/lock-BerKqno7.js","assets/EvidenceReceiptPanel-6oquKEjd.js","assets/Badge-BtMejA0Z.js","assets/clock-BBlUa93G.js","assets/circle-alert-DwT82lJx.js","assets/check-RWuguCwE.js","assets/package-DLPKWAvW.js","assets/cloud-Dgbz3VCA.js","assets/code-xml-r6qqION5.js","assets/hammer-BWaLBvSA.js","assets/chevron-left-VpbQPOkC.js","assets/layers-Q1LXV5fy.js","assets/mail-XAxTbprX.js","assets/bell-DF6Z6y5U.js","assets/file-code-corner-DMopmhu0.js","assets/ProjectPage-iP6dJihg.js","assets/Button-CikxmqSs.js","assets/file-plus-DU_hT_3w.js","assets/activity-AbfFz38r.js","assets/bot-DQ4np_3n.js","assets/loader-circle-KgjeHEcV.js","assets/dollar-sign-BZagljek.js","assets/refresh-cw-Dt42kYtM.js","assets/globe-mthCRtfp.js","assets/copy-DMHj52B8.js","assets/git-commit-horizontal-zFk_IobS.js","assets/upload-C54rjN8K.js","assets/plus-NMxxwHMn.js","assets/trash-2-D0IGudH7.js","assets/rotate-ccw-BCR4Tp9u.js","assets/trending-down-BbFFBq-v.js","assets/save-sR4MJd42.js","assets/trending-up-DDrJKL5i.js","assets/folder-open-BP5TtQAW.js","assets/server-SXkchokx.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-BibN9bHl.js","assets/lightbulb-vRRNJ3dB.js","assets/TemplatesPage-BzkA9kat.js","assets/database-uJqHSHR1.js","assets/SettingsPage-C0WJp1hW.js","assets/TeamsPage-BE0szv9r.js","assets/Avatar-CqAveJaT.js","assets/user-Cg7fbzdh.js","assets/AdminPage-DNGNuAge.js","assets/shield-alert-Bvgp6_Dz.js","assets/SystemSettingsPage-BIaCB0Vn.js","assets/MetricsPage-DbL6xmRQ.js","assets/MagicPage-CFbX5gWg.js"])))=>i.map(i=>d[i]);
2
2
  var P0=Object.defineProperty;var ep=(i,c,r)=>c in i?P0(i,c,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[c]=r;var Ln=(i,c,r)=>ep(i,typeof c!="symbol"?c+"":c,r);(function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const p of m.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&o(p)}).observe(document,{childList:!0,subtree:!0});function r(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function o(d){if(d.ep)return;d.ep=!0;const m=r(d);fetch(d.href,m)}})();function tp(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ls={exports:{}},Bn={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -353,7 +353,7 @@ Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}
353
353
  *
354
354
  * This source code is licensed under the ISC license.
355
355
  * See the LICENSE file in the root directory of this source tree.
356
- */const jg=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Rg=W("zap",jg),fo="/lab/".replace(/\/$/,""),hi=`${window.location.origin}${fo}/api`,Ag=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${fo}/ws`,H2=fo;function Sm(){const i={"Content-Type":"application/json"};try{const c=localStorage.getItem("pl_auth_token");c&&(i.Authorization=`Bearer ${c}`)}catch{}return i}async function k(i,c){const r=await fetch(`${hi}${i}`,{...c,headers:{...Sm(),...c==null?void 0:c.headers}});if(!r.ok){const d=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${d?` - ${d}`:""}`)}if(!(r.headers.get("content-type")||"").includes("application/json"))throw new Error("API endpoint not available. Please restart the server with the latest version.");return r.json()}const Ba={startSession:i=>k("/session/start",{method:"POST",body:JSON.stringify(i)}),quickStart:(i,c="claude")=>k("/session/quick-start",{method:"POST",body:JSON.stringify({prompt:i,provider:c})}),stopSession:()=>k("/session/stop",{method:"POST"}),pauseSession:()=>k("/session/pause",{method:"POST"}),resumeSession:()=>k("/session/resume",{method:"POST"}),getPrdPrefill:()=>k("/session/prd-prefill"),getStatus:()=>k("/session/status"),getAgents:()=>k("/session/agents"),getLogs:(i=200)=>k(`/session/logs?lines=${i}`),getMemorySummary:()=>k("/session/memory"),getChecklist:()=>k("/session/checklist"),getFiles:()=>k("/session/files"),getFileContent:i=>k(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(c)}`),getTemplates:()=>k("/templates"),getTemplateContent:i=>k(`/templates/${encodeURIComponent(i)}`),planSession:(i,c)=>k("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:c})}),generateReport:(i="markdown")=>k("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>k("/session/share",{method:"POST"}),getCurrentProvider:()=>k("/provider/current"),setProvider:i=>k("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>k("/session/metrics"),getSessionsHistory:()=>k("/sessions/history"),getSessionDetail:i=>k(`/sessions/${encodeURIComponent(i)}`),deleteSession:i=>k(`/sessions/${encodeURIComponent(i)}`,{method:"DELETE"}),onboardRepo:i=>k("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:c,content:r})}),createSessionFile:(i,c,r="")=>k(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:c,content:r})}),deleteSessionFile:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:c})}),createSessionDirectory:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:c})}),reviewProject:i=>k(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>k(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>k(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>k(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),fixProject:i=>k(`/sessions/${encodeURIComponent(i)}/fix`,{method:"POST"}),chatMessage:(i,c,r="quick")=>k(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:c,mode:r})}),chatStart:(i,c,r="quick",o)=>k(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:c,mode:r,history:o})}),chatPoll:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(c)}`),chatStreamUrl:(i,c)=>`${hi}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(c)}/stream`,chatCancel:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(c)}/cancel`,{method:"POST"}),getPreviewInfo:i=>k(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:c||null})}),stop:i=>k(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>k(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>k("/secrets"),setSecret:(i,c)=>k("/secrets",{method:"POST",body:JSON.stringify({key:i,value:c})}),deleteSecret:i=>k(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getServices:i=>k(`/sessions/${encodeURIComponent(i)}/services`),getTeams:()=>k("/teams"),createTeam:i=>k("/teams",{method:"POST",body:JSON.stringify({name:i})}),getTeamMembers:i=>k(`/teams/${encodeURIComponent(i)}/members`),addTeamMember:(i,c,r)=>k(`/teams/${encodeURIComponent(i)}/members`,{method:"POST",body:JSON.stringify({email:c,role:r})}),getAuditLog:()=>k("/audit-log"),getServiceLogs:(i,c,r=50)=>k(`/sessions/${encodeURIComponent(i)}/devserver/logs${c?`?service=${encodeURIComponent(c)}&tail=${r}`:`?tail=${r}`}`),getCheckpoints:i=>k(`/sessions/${encodeURIComponent(i)}/checkpoints`),restoreCheckpoint:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/checkpoints/${encodeURIComponent(c)}/restore`,{method:"POST"}),previewChanges:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/chat/preview`,{method:"POST",body:JSON.stringify({message:c})}),searchFiles:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/files/search?q=${encodeURIComponent(c)}`),restartService:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/devserver/restart-service`,{method:"POST",body:JSON.stringify({service:c})}),deployProject:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/deploy`,{method:"POST",body:JSON.stringify({platform:c})}),githubPush:i=>k(`/sessions/${encodeURIComponent(i)}/github/push`,{method:"POST"}),getGitHubIssues:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/issues?${new URLSearchParams({...c?{state:c}:{},...r?{limit:String(r)}:{}}).toString()}`),getGitHubIssue:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/issues/${c}`),fixGitHubIssue:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/issues/${c}/fix`,{method:"POST"}),getGitHubPRs:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/prs?${new URLSearchParams({...c?{state:c}:{},...r?{limit:String(r)}:{}}).toString()}`),getGitHubPR:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}`),getGitHubPRDiff:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}/diff`),reviewGitHubPR:(i,c,r,o)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}/review`,{method:"POST",body:JSON.stringify({action:r,body:o})}),mergeGitHubPR:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}/merge`,{method:"POST",body:JSON.stringify({method:r})}),getWorkflowRuns:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs?${new URLSearchParams({...c?{limit:String(c)}:{}}).toString()}`),getWorkflowRunDetail:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}`),getWorkflowRunLogs:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}/logs`),getWorkflows:i=>k(`/sessions/${encodeURIComponent(i)}/github/workflows`),dispatchWorkflow:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/workflows/dispatch`,{method:"POST",body:JSON.stringify({workflow:c,ref:r})}),rerunWorkflow:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}/rerun`,{method:"POST"}),cancelWorkflow:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}/cancel`,{method:"POST"}),importGitHubRepo:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/import`,{method:"POST",body:JSON.stringify({repo:c,...r?{branch:r}:{}})}),getDeployStatus:()=>k("/deploy/status"),connectVercel:i=>k("/deploy/vercel/connect",{method:"POST",body:JSON.stringify({token:i})}),connectNetlify:i=>k("/deploy/netlify/connect",{method:"POST",body:JSON.stringify({token:i})}),disconnectPlatform:i=>k(`/deploy/${encodeURIComponent(i)}/disconnect`,{method:"POST"}),getMe:()=>k("/auth/me"),getGitHubAuthUrl:()=>k("/auth/github/url"),getGoogleAuthUrl:()=>k("/auth/google/url"),githubCallback:(i,c)=>k("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:c})}),googleCallback:(i,c,r)=>k("/auth/google/callback",{method:"POST",body:JSON.stringify({code:i,state:c,redirect_uri:r||`${window.location.origin}${window.location.pathname}`})}),git:{status:i=>k(`/sessions/${encodeURIComponent(i)}/git/status`),log:(i,c=20)=>k(`/sessions/${encodeURIComponent(i)}/git/log?limit=${c}`),branches:i=>k(`/sessions/${encodeURIComponent(i)}/git/branches`),commit:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/git/commit`,{method:"POST",body:JSON.stringify({message:c,files:r})}),createBranch:(i,c,r=!0)=>k(`/sessions/${encodeURIComponent(i)}/git/branch`,{method:"POST",body:JSON.stringify({name:c,checkout:r})}),checkoutBranch:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/git/checkout`,{method:"POST",body:JSON.stringify({name:c})}),push:i=>k(`/sessions/${encodeURIComponent(i)}/git/push`,{method:"POST"}),pr:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/git/pr`,{method:"POST",body:JSON.stringify({title:c,body:r})})},generateDocs:i=>k(`/sessions/${encodeURIComponent(i)}/docs/generate`,{method:"POST"}),getDocsStatus:i=>k(`/sessions/${encodeURIComponent(i)}/docs/status`),getDocFiles:i=>k(`/sessions/${encodeURIComponent(i)}/docs/files`),getDocFileContent:async(i,c)=>{const r=await fetch(`${hi}/sessions/${encodeURIComponent(i)}/docs/files/${encodeURIComponent(c)}`,{headers:Sm()});if(!r.ok)throw new Error(`API error ${r.status}: ${r.statusText}`);return r.text()},chatImageUpload:async(i,c)=>{const r=new FormData;r.append("image",c);const o=await fetch(`${hi}/sessions/${encodeURIComponent(i)}/chat/image`,{method:"POST",headers:{...(()=>{const d={};try{const m=localStorage.getItem("pl_auth_token");m&&(d.Authorization=`Bearer ${m}`)}catch{}return d})()},body:r});if(!o.ok){const d=await o.text().catch(()=>"");throw new Error(`API error ${o.status}: ${o.statusText}${d?` - ${d}`:""}`)}return o.json()}};class Og{constructor(c){Ln(this,"ws",null);Ln(this,"listeners",new Map);Ln(this,"reconnectTimer",null);Ln(this,"url");this.url=c||Ag}connect(){var c;((c=this.ws)==null?void 0:c.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const o=JSON.parse(r.data);if(o.type==="ping"){this.send({type:"pong"});return}this.emit(o.type,o.data||o)}catch{}},this.ws.onclose=()=>{this.emit("disconnected",{}),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}on(c,r){return this.listeners.has(c)||this.listeners.set(c,new Set),this.listeners.get(c).add(r),()=>{var o;return(o=this.listeners.get(c))==null?void 0:o.delete(r)}}emit(c,r){var o,d;(o=this.listeners.get(c))==null||o.forEach(m=>m(r)),(d=this.listeners.get("*"))==null||d.forEach(m=>m({type:c,data:r}))}send(c){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(c))}disconnect(){var c;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(c=this.ws)==null||c.close(),this.ws=null}}const Js="pl_auth_token",Em=v.createContext({user:null,loading:!0,login:()=>{},logout:()=>{},isLocalMode:!0});function Mg(i,c,r){c(!1),r({email:i.sub||i.email||"",name:i.name||"",avatar_url:i.avatar||"",authenticated:!0})}function Dg({children:i}){const[c,r]=v.useState(null),[o,d]=v.useState(!0),[m,p]=v.useState(!0),E=lo(),x=kt();v.useEffect(()=>{let H=!1;async function L(){const B=new URLSearchParams(window.location.search),U=B.get("token"),Q=B.get("code");if(U)localStorage.setItem(Js,U),window.history.replaceState({},"",window.location.pathname);else if(Q)try{const q=sessionStorage.getItem("pl_oauth_provider")||"github",I=sessionStorage.getItem("pl_oauth_state")||"";sessionStorage.removeItem("pl_oauth_state"),sessionStorage.removeItem("pl_oauth_provider");let J;if(q==="google"?J=await Ba.googleCallback(Q,I):J=await Ba.githubCallback(Q,I),!H){localStorage.setItem(Js,J.token),window.history.replaceState({},"",window.location.pathname),p(!1),r({email:J.user.email,name:J.user.name,avatar_url:J.user.avatar_url,authenticated:!0}),d(!1);return}}catch{window.history.replaceState({},"",window.location.pathname)}try{const q=await Ba.getMe();if(H)return;q.local_mode?(p(!0),r(null)):q.authenticated?Mg(q,p,r):(p(!1),r(null))}catch{if(H)return;p(!0),r(null)}finally{H||d(!1)}}return L(),()=>{H=!0}},[]);const y=v.useCallback(H=>{H==="github"?Ba.getGitHubAuthUrl().then(L=>{try{const U=new URL(L.url).searchParams.get("state");U&&(sessionStorage.setItem("pl_oauth_state",U),sessionStorage.setItem("pl_oauth_provider","github"))}catch{}window.location.href=L.url}).catch(()=>{}):H==="google"&&Ba.getGoogleAuthUrl().then(L=>{try{const U=new URL(L.url).searchParams.get("state");U&&(sessionStorage.setItem("pl_oauth_state",U),sessionStorage.setItem("pl_oauth_provider","google"))}catch{}window.location.href=L.url}).catch(()=>{})},[]),z=v.useCallback(()=>{localStorage.removeItem(Js),r(null),x.pathname!=="/login"&&E("/login",{replace:!0})},[E,x.pathname]),_=v.useMemo(()=>({user:c,loading:o,login:y,logout:z,isLocalMode:m}),[c,o,y,z,m]);return h.jsx(Em.Provider,{value:_,children:i})}function _m(){return v.useContext(Em)}function Ug(){const[i,c]=v.useState(()=>typeof window>"u"?"light":localStorage.getItem("pl_theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"));v.useEffect(()=>{document.documentElement.classList.toggle("dark",i==="dark"),localStorage.setItem("pl_theme",i)},[i]);const r=v.useCallback(()=>{c(o=>o==="light"?"dark":"light")},[]);return{theme:i,toggleTheme:r,isDark:i==="dark"}}const Tm="pl_discovered_features";function zm(){try{const i=localStorage.getItem(Tm);if(i)return new Set(JSON.parse(i))}catch{}return new Set}function wg(i){try{localStorage.setItem(Tm,JSON.stringify([...i]))}catch{}}function Hg(i){const c=zm();c.has(i)||(c.add(i),wg(c),window.dispatchEvent(new CustomEvent("pl_feature_discovered",{detail:i})))}function kg({feature:i,className:c=""}){const[r,o]=v.useState(!0);return v.useEffect(()=>{o(zm().has(i))},[i]),v.useEffect(()=>{const d=m=>{m.detail===i&&o(!0)};return window.addEventListener("pl_feature_discovered",d),()=>window.removeEventListener("pl_feature_discovered",d)},[i]),r?null:h.jsxs("span",{className:`relative inline-flex ${c}`,"aria-hidden":"true",children:[h.jsx("span",{className:"absolute inline-flex h-2.5 w-2.5 rounded-full bg-primary/40 animate-ping"}),h.jsx("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-primary"})]})}const Nm="pl_getting_started_steps",wh="pl_getting_started_dismissed",Hh="pl_getting_started_collapsed",kh=[{id:"create_project",label:"Create your first project",description:"Describe what you want to build or pick a template to get started.",icon:vm},{id:"try_chat",label:"Try the AI chat",description:"Ask the AI to modify, explain, or improve your code.",icon:so},{id:"preview_app",label:"Preview your app",description:"Open the Preview tab to see your application running live.",icon:pm},{id:"explore_templates",label:"Explore templates",description:"Browse the template gallery for inspiration and quick starts.",icon:co},{id:"deploy_app",label:"Deploy your app",description:"Push your project live with one click using the Deploy tab.",icon:oo}];function Lh(){try{const i=localStorage.getItem(Nm);if(i)return new Set(JSON.parse(i))}catch{}return new Set}function Lg(i){try{localStorage.setItem(Nm,JSON.stringify([...i]))}catch{}}function Bg(){const[i,c]=v.useState(!1),[r,o]=v.useState(!1),[d,m]=v.useState(new Set);v.useEffect(()=>{try{if(localStorage.getItem(wh)==="1"){c(!0);return}o(localStorage.getItem(Hh)==="1")}catch{}m(Lh())},[]),v.useEffect(()=>{const L=()=>m(Lh());return window.addEventListener("pl_step_complete",L),()=>window.removeEventListener("pl_step_complete",L)},[]);const p=v.useCallback(L=>{m(B=>{const U=new Set(B);return U.has(L)?U.delete(L):U.add(L),Lg(U),U})},[]),E=()=>{c(!0);try{localStorage.setItem(wh,"1")}catch{}},x=()=>{o(L=>{const B=!L;try{localStorage.setItem(Hh,B?"1":"0")}catch{}return B})};if(i)return null;const y=d.size,z=kh.length,_=y/z*100,H=y===z;return h.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[h.jsxs("button",{onClick:x,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-hover transition-colors",children:[h.jsx(kv,{size:16,className:"text-primary flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-sm font-heading font-bold text-ink",children:"Getting Started"}),h.jsxs("span",{className:"text-[11px] text-muted-accessible font-mono",children:[y,"/",z]})]}),h.jsx("div",{className:"h-1 bg-border rounded-full mt-1.5 overflow-hidden",children:h.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-500",style:{width:`${_}%`}})})]}),h.jsx("div",{className:"flex items-center gap-1",children:r?h.jsx(nv,{size:14,className:"text-muted"}):h.jsx(mm,{size:14,className:"text-muted"})})]}),!r&&h.jsxs("div",{className:"border-t border-border",children:[h.jsx("div",{className:"px-3 py-2 space-y-0.5",children:kh.map(L=>{const B=d.has(L.id),U=L.icon;return h.jsxs("button",{onClick:()=>p(L.id),className:`w-full flex items-start gap-3 px-3 py-2.5 rounded-lg text-left transition-colors ${B?"opacity-60 hover:opacity-80":"hover:bg-hover"}`,children:[h.jsx("div",{className:"mt-0.5 flex-shrink-0",children:B?h.jsx(rv,{size:16,className:"text-success"}):h.jsx(yv,{size:16,className:"text-border"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:`text-xs font-medium ${B?"text-muted line-through":"text-ink"}`,children:L.label}),!B&&h.jsx("p",{className:"text-[11px] text-muted-accessible mt-0.5 leading-relaxed",children:L.description})]}),h.jsx(U,{size:14,className:`flex-shrink-0 mt-0.5 ${B?"text-muted":"text-primary/50"}`})]},L.id)})}),h.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-t border-border",children:[H?h.jsx("span",{className:"text-xs text-success font-medium",children:"All done -- you are ready to build!"}):h.jsx("span",{className:"text-[11px] text-muted",children:"Complete each step to learn the basics."}),h.jsxs("button",{onClick:E,className:"flex items-center gap-1 text-[11px] text-muted hover:text-ink transition-colors",children:[h.jsx(ea,{size:11}),"Dismiss"]})]})]})]})}const Bh="pl_sidebar_collapsed",qg=[{to:"/",label:"Home",icon:Ov},{to:"/projects",label:"Projects",icon:_v},{to:"/templates",label:"Templates",icon:co,discoveryFeature:"templates"},{to:"/showcase",label:"Showcase",icon:ro},{to:"/magic",label:"Magic",icon:Tg},{to:"/metrics",label:"Metrics",icon:lv},{to:"/compare",label:"Compare",icon:Rv},{to:"/teams",label:"Teams",icon:xg}],Yg=[{to:"/settings",label:"Settings",icon:xm},{to:"/admin",label:"Admin",icon:ug},{to:"/admin/settings",label:"System",icon:Ng}];function Gg(){const[i,c]=v.useState(typeof window<"u"?window.innerWidth<768:!1);return v.useEffect(()=>{const r=()=>c(window.innerWidth<768);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i}function Qg({wsConnected:i,version:c,onOpenDocs:r}){const o=Gg(),d=kt(),{theme:m,toggleTheme:p}=Ug(),[E,x]=v.useState(!1),[y,z]=v.useState(()=>{try{return localStorage.getItem(Bh)==="1"}catch{return!1}});v.useEffect(()=>{try{localStorage.setItem(Bh,y?"1":"0")}catch{}},[y]),v.useEffect(()=>{o&&x(!1)},[d.pathname,o]);const _=o?E:!y,H=_?240:64,L=U=>["flex items-center gap-3 px-3 py-2 text-sm transition-colors rounded-[5px]",!_&&"justify-center",U?"bg-[#553DE9]/8 text-[#553DE9] font-medium border-l-2 border-[#553DE9]":"text-[#36342E] hover:bg-[#F8F4F0]"].filter(Boolean).join(" "),B=h.jsxs("aside",{className:"flex flex-col h-full border-r border-[#ECEAE3] bg-white transition-[width] duration-200",style:{width:H,minWidth:H},children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-[#ECEAE3]",children:[_&&h.jsxs("div",{className:"flex flex-col",children:[h.jsx("span",{className:"font-heading text-lg font-bold leading-tight text-[#36342E]",children:"Purple Lab"}),h.jsx("span",{className:"text-xs text-[#6B6960]",children:"Powered by Loki"})]}),o?h.jsx("button",{type:"button","aria-label":E?"Close menu":"Open menu",title:E?"Close menu":"Open menu",onClick:()=>x(!E),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:E?h.jsx(ea,{size:16}):h.jsx(Yv,{size:16})}):h.jsx("button",{type:"button","aria-label":y?"Expand sidebar":"Collapse sidebar",title:y?"Expand sidebar":"Collapse sidebar",onClick:()=>z(!y),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:y?h.jsx(Iv,{size:16}):h.jsx(Wv,{size:16})})]}),h.jsxs("nav",{className:"flex-1 px-2 py-3 flex flex-col gap-1","aria-label":"Main navigation",children:[qg.map(U=>h.jsxs(yi,{to:U.to,end:U.to==="/",className:({isActive:Q})=>L(Q),title:_?void 0:U.label,onClick:()=>{U.discoveryFeature&&Hg(U.discoveryFeature)},children:[h.jsxs("div",{className:"relative",children:[h.jsx(U.icon,{size:18}),U.discoveryFeature&&h.jsx(kg,{feature:U.discoveryFeature,className:"absolute -top-1 -right-1"})]}),_&&h.jsx("span",{children:U.label})]},U.to)),h.jsx("div",{className:"my-2 border-t border-[#ECEAE3]"}),Yg.map(U=>h.jsxs(yi,{to:U.to,className:({isActive:Q})=>L(Q),title:_?void 0:U.label,children:[h.jsx(U.icon,{size:18}),_&&h.jsx("span",{children:U.label})]},U.to)),_&&h.jsx("div",{className:"mt-3 px-1",children:h.jsx(Bg,{})})]}),h.jsxs("div",{className:"px-3 py-3 border-t border-[#ECEAE3] flex flex-col gap-2",children:[h.jsx(Xg,{collapsed:!_}),h.jsxs("div",{className:["flex items-center gap-2 text-xs",!_&&"justify-center"].filter(Boolean).join(" "),children:[h.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),_&&h.jsx("span",{className:"text-[#6B6960]",children:i?"Connected":"Disconnected"})]}),_&&c&&h.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",c]}),h.jsxs("button",{onClick:p,title:m==="dark"?"Light mode":"Dark mode",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!_&&"justify-center"].filter(Boolean).join(" "),children:[m==="dark"?h.jsx(mg,{size:14}):h.jsx(Zv,{size:14}),_&&h.jsx("span",{children:m==="dark"?"Light Mode":"Dark Mode"})]}),h.jsxs("button",{onClick:r,className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!_&&"justify-center"].filter(Boolean).join(" "),title:_?void 0:"Help & Docs",children:[h.jsx(ym,{size:14}),_&&h.jsx("span",{children:"Help & Docs"})]}),h.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!_&&"justify-center"].filter(Boolean).join(" "),title:_?void 0:"Documentation",children:[h.jsx(hm,{size:14}),_&&h.jsx("span",{children:"Docs"})]})]})]});return o&&E?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40 bg-ink/20",onClick:()=>x(!1)}),h.jsx("div",{className:"fixed inset-y-0 left-0 z-50",children:B})]}):B}function Xg({collapsed:i}){const{user:c,logout:r,isLocalMode:o}=_m(),[d,m]=v.useState(!1),p=v.useRef(null);return v.useEffect(()=>{function E(x){p.current&&!p.current.contains(x.target)&&m(!1)}if(d)return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[d]),o||!c?h.jsxs("div",{className:["flex items-center gap-2 text-xs",i&&"justify-center"].filter(Boolean).join(" "),title:i?"Local Mode":void 0,children:[h.jsx(Xv,{size:14,className:"text-[#939084] flex-shrink-0"}),!i&&h.jsx("span",{className:"text-[#939084]",children:"Local Mode"})]}):h.jsxs("div",{className:"relative",ref:p,"data-testid":"user-section",children:[h.jsxs("button",{type:"button",onClick:()=>m(!d),className:["flex items-center gap-2 w-full text-left text-xs rounded-[3px] py-1 px-1 hover:bg-[#F8F4F0] transition-colors",i&&"justify-center"].filter(Boolean).join(" "),title:i?c.name||c.email:void 0,children:[c.avatar_url?h.jsx("img",{src:c.avatar_url,alt:"",className:"w-5 h-5 rounded-full flex-shrink-0"}):h.jsx("div",{className:"w-5 h-5 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:(c.name||c.email||"?")[0].toUpperCase()}),!i&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-[#36342E] truncate flex-1",children:c.name||c.email}),h.jsx(mm,{size:12,className:`text-[#939084] transition-transform ${d?"":"rotate-180"}`})]})]}),d&&h.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-48 bg-white border border-[#ECEAE3] rounded-lg shadow-lg py-1 z-50",children:[h.jsxs("div",{className:"px-3 py-2 border-b border-[#ECEAE3]",children:[h.jsx("p",{className:"text-xs font-medium text-[#36342E] truncate",children:c.name}),h.jsx("p",{className:"text-xs text-[#939084] truncate",children:c.email})]}),h.jsxs(yi,{to:"/settings",onClick:()=>m(!1),className:"flex items-center gap-2 px-3 py-2 text-xs text-[#36342E] hover:bg-[#F8F4F0] transition-colors",children:[h.jsx(xm,{size:14}),"Settings"]}),h.jsxs("button",{type:"button",onClick:()=>{m(!1),r()},className:"flex items-center gap-2 px-3 py-2 text-xs text-[#C45B5B] hover:bg-[#F8F4F0] transition-colors w-full text-left",children:[h.jsx(Bv,{size:14}),"Sign out"]})]})]})}const qa=[];function Vg(i){if(i.key==="Escape"&&qa.length>0){i.preventDefault(),i.stopPropagation();const c=qa[qa.length-1];c()}}let qh=!1;function Zg(){qh||(document.addEventListener("keydown",Vg),qh=!0)}function Jg(i,c){const r=v.useRef(c);r.current=c;const o=v.useCallback(()=>{r.current()},[]);v.useEffect(()=>{if(i)return Zg(),qa.push(o),()=>{const d=qa.indexOf(o);d!==-1&&qa.splice(d,1)}},[i,o])}const Yh=["a[href]","button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Kg(i){const c=v.useRef(null),r=v.useRef(null);return v.useEffect(()=>{if(!i)return;r.current=document.activeElement;const o=c.current;if(!o)return;const d=o.querySelectorAll(Yh);d.length>0&&requestAnimationFrame(()=>d[0].focus());const m=p=>{if(p.key!=="Tab")return;const E=o.querySelectorAll(Yh);if(E.length===0)return;const x=E[0],y=E[E.length-1];p.shiftKey?document.activeElement===x&&(p.preventDefault(),y.focus()):document.activeElement===y&&(p.preventDefault(),x.focus())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m),r.current&&typeof r.current.focus=="function"&&r.current.focus()}},[i]),c}const Gh="pl_onboarding_complete",Gn=[{icon:vm,title:"Write your spec",description:"Describe what you want to build, or choose a template to get started quickly."},{icon:pg,title:"Use the terminal",description:"Run commands directly in the integrated terminal to install dependencies or debug."},{icon:pm,title:"Preview in real-time",description:"Switch to the Preview tab to see your app running with live reload."},{icon:so,title:"Iterate with AI Chat",description:"Ask the AI to modify, fix, or explain your code in the chat panel."}];function $g(){const[i,c]=v.useState(!1),[r,o]=v.useState(0),d=Kg(i);Jg(i,()=>{i&&m()}),v.useEffect(()=>{try{localStorage.getItem(Gh)!=="1"&&c(!0)}catch{}},[]);const m=()=>{c(!1);try{localStorage.setItem(Gh,"1")}catch{}},p=()=>{r<Gn.length-1?o(r+1):m()};if(!i)return null;const E=Gn[r],x=E.icon;return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/30",children:h.jsxs("div",{ref:d,className:"bg-card rounded-card shadow-card-hover border border-border w-full max-w-sm mx-4",children:[h.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-2",children:[h.jsxs("span",{className:"text-[11px] font-mono text-muted-accessible",children:[r+1," / ",Gn.length]}),h.jsx("button",{onClick:m,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Skip onboarding",children:h.jsx(ea,{size:14})})]}),h.jsxs("div",{className:"px-5 pb-4 text-center",children:[h.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:h.jsx(x,{size:24,className:"text-primary"})}),h.jsx("h3",{className:"text-sm font-heading font-bold text-ink mb-1",children:E.title}),h.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed",children:E.description})]}),h.jsx("div",{className:"flex items-center justify-center gap-1.5 pb-4",children:Gn.map((y,z)=>h.jsx("div",{className:`w-1.5 h-1.5 rounded-full transition-colors ${z===r?"bg-primary":"bg-border"}`},z))}),h.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[h.jsx("button",{onClick:m,className:"text-xs text-muted hover:text-ink transition-colors",children:"Skip"}),h.jsx("button",{onClick:p,className:"inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:r<Gn.length-1?h.jsxs(h.Fragment,{children:["Next",h.jsx(dm,{size:12})]}):"Get Started"})]})]})})}const Qh="pl_product_tour_complete",Wg=[{target:'[data-tour="input-box"]',title:"Describe what you want to build",description:"Type a plain-English description of your project here. The more detail you give, the better the result. You can also paste a spec / PRD or select a template.",position:"bottom"},{target:'[data-tour="template-gallery"]',title:"Start from a template",description:"Browse ready-made templates for SaaS apps, landing pages, dashboards, and more. Each template gives you a head start with a proven structure.",position:"bottom"},{target:'[data-tour="build-progress"]',title:"Watch your project come to life",description:"Once you start a build, this bar tracks each phase: planning, building, testing, and reviewing. You will see real-time progress and cost estimates.",position:"bottom"},{target:'[data-tour="preview-tab"]',title:"Preview your running app",description:"Switch to the Preview tab to see your application running live. Changes appear in real time as the AI iterates on your code.",position:"bottom"},{target:'[data-tour="deploy-tab"]',title:"Deploy with one click",description:"When you are happy with the result, head to the Deploy tab to push your project live. Supports Vercel, Netlify, Railway, and more.",position:"bottom"}];function Fg(i){const c=document.querySelector(i);return c?c.getBoundingClientRect():null}function Ig(i,c){if(!i)return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};const r=16,o={position:"fixed",zIndex:60};switch(c){case"bottom":o.top=i.bottom+r,o.left=i.left+i.width/2,o.transform="translateX(-50%)";break;case"top":o.bottom=window.innerHeight-i.top+r,o.left=i.left+i.width/2,o.transform="translateX(-50%)";break;case"left":o.top=i.top+i.height/2,o.right=window.innerWidth-i.left+r,o.transform="translateY(-50%)";break;case"right":o.top=i.top+i.height/2,o.left=i.right+r,o.transform="translateY(-50%)";break}return o}function Pg({steps:i=Wg,onComplete:c}){const[r,o]=v.useState(!1),[d,m]=v.useState(0),[p,E]=v.useState(null),x=v.useRef(0);v.useEffect(()=>{try{if(localStorage.getItem(Qh)!=="1"){const B=setTimeout(()=>o(!0),800);return()=>clearTimeout(B)}}catch{}},[]),v.useEffect(()=>{if(!r||!i[d])return;const B=()=>{const U=Fg(i[d].target);E(U),x.current=requestAnimationFrame(B)};return B(),()=>cancelAnimationFrame(x.current)},[r,d,i]);const y=v.useCallback(()=>{o(!1);try{localStorage.setItem(Qh,"1")}catch{}c==null||c()},[c]),z=v.useCallback(()=>{d<i.length-1?m(B=>B+1):y()},[d,i.length,y]),_=v.useCallback(()=>{m(B=>Math.max(0,B-1))},[]);if(v.useEffect(()=>{if(!r)return;const B=U=>{U.key==="Escape"&&y(),U.key==="ArrowRight"&&z(),U.key==="ArrowLeft"&&_()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[r,y,z,_]),!r||!i[d])return null;const H=i[d],L=8;return h.jsxs("div",{className:"fixed inset-0 z-[55]","aria-modal":"true",role:"dialog",children:[h.jsxs("svg",{className:"absolute inset-0 w-full h-full",onClick:y,style:{zIndex:55},children:[h.jsx("defs",{children:h.jsxs("mask",{id:"tour-spotlight",children:[h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),p&&h.jsx("rect",{x:p.left-L,y:p.top-L,width:p.width+L*2,height:p.height+L*2,rx:"8",fill:"black"})]})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"rgba(0,0,0,0.55)",mask:"url(#tour-spotlight)"})]}),p&&h.jsx("div",{className:"absolute border-2 border-primary rounded-lg pointer-events-none shadow-[0_0_20px_rgba(85,61,233,0.3)]",style:{left:p.left-L,top:p.top-L,width:p.width+L*2,height:p.height+L*2,zIndex:56}}),h.jsxs("div",{className:"w-80 bg-card rounded-xl shadow-2xl border border-border p-0 overflow-hidden",style:{...Ig(p,H.position),zIndex:57},onClick:B=>B.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between px-4 pt-4 pb-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ro,{size:14,className:"text-primary"}),h.jsxs("span",{className:"text-[11px] font-mono text-muted-accessible",children:["Step ",d+1," of ",i.length]})]}),h.jsx("button",{onClick:y,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Skip tour",children:h.jsx(ea,{size:14})})]}),h.jsxs("div",{className:"px-4 pb-3",children:[h.jsx("h3",{className:"text-sm font-heading font-bold text-ink mb-1",children:H.title}),h.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed",children:H.description})]}),h.jsx("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:i.map((B,U)=>h.jsx("button",{onClick:()=>m(U),className:`w-2 h-2 rounded-full transition-all ${U===d?"bg-primary scale-110":U<d?"bg-primary/40":"bg-border"}`,"aria-label":`Go to step ${U+1}`},U))}),h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border bg-hover/30",children:[h.jsxs("button",{onClick:y,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[h.jsx(og,{size:12}),"Skip tour"]}),h.jsxs("div",{className:"flex items-center gap-2",children:[d>0&&h.jsxs("button",{onClick:_,className:"flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded-btn text-ink hover:bg-hover transition-colors",children:[h.jsx(fm,{size:12}),"Back"]}),h.jsx("button",{onClick:z,className:"flex items-center gap-1 px-4 py-1.5 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:d<i.length-1?h.jsxs(h.Fragment,{children:["Next",h.jsx(dm,{size:12})]}):"Let's go!"})]})]})]})]})}const Xh="pl_whats_new_version",Ks="6.73.1",e2=[{icon:ro,title:"Product Tour",description:"New step-by-step guided tour for first-time users. Highlights key UI areas so you never feel lost."},{icon:Kv,title:"Contextual Help Tooltips",description:"Hover over the help icons next to complex features to learn what they do without leaving the page."},{icon:gm,title:"Enhanced Keyboard Shortcuts",description:'Press "?" to open the shortcuts overlay. Shortcuts are now grouped by category with search and filtering.'},{icon:Rg,title:"Getting Started Checklist",description:"A friendly checklist guides you through your first project, from writing a spec to deploying your app."},{icon:cg,title:"In-App Documentation",description:"Browse Quick Start guides, FAQ, and template docs right inside Purple Lab, no context switching required."}];function t2(){const[i,c]=v.useState(!1);v.useEffect(()=>{try{if(localStorage.getItem(Xh)!==Ks){const d=setTimeout(()=>c(!0),1200);return()=>clearTimeout(d)}}catch{}},[]);const r=()=>{c(!1);try{localStorage.setItem(Xh,Ks)}catch{}};return i?h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/30",onClick:r,children:h.jsxs("div",{className:"bg-card rounded-xl shadow-2xl border border-border w-full max-w-md mx-4 overflow-hidden",onClick:o=>o.stopPropagation(),children:[h.jsxs("div",{className:"relative px-6 pt-6 pb-4 text-center border-b border-border bg-gradient-to-b from-primary/5 to-transparent",children:[h.jsx("button",{onClick:r,className:"absolute top-4 right-4 text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Close",children:h.jsx(ea,{size:14})}),h.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:h.jsx(zv,{size:24,className:"text-primary"})}),h.jsx("h2",{className:"text-lg font-heading font-bold text-ink",children:"What's New"}),h.jsxs("p",{className:"text-xs text-muted-accessible mt-1",children:["Purple Lab v",Ks]})]}),h.jsx("div",{className:"px-4 py-4 space-y-3 max-h-[320px] overflow-y-auto terminal-scroll",children:e2.map(o=>{const d=o.icon;return h.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg hover:bg-hover transition-colors",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:h.jsx(d,{size:16,className:"text-primary"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("h3",{className:"text-sm font-medium text-ink",children:o.title}),h.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed mt-0.5",children:o.description})]})]},o.title)})}),h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-border",children:[h.jsxs("a",{href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-primary hover:text-primary-hover transition-colors",children:["Full changelog",h.jsx(bv,{size:11})]}),h.jsx("button",{onClick:r,className:"px-5 py-2 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:"Got it!"})]})]})}):null}const $s=[{id:"quick-start",title:"Quick Start",icon:oo,content:`# Quick Start
356
+ */const jg=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Rg=W("zap",jg),fo="/lab/".replace(/\/$/,""),hi=`${window.location.origin}${fo}/api`,Ag=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${fo}/ws`,H2=fo;function Sm(){const i={"Content-Type":"application/json"};try{const c=localStorage.getItem("pl_auth_token");c&&(i.Authorization=`Bearer ${c}`)}catch{}return i}async function k(i,c){const r=await fetch(`${hi}${i}`,{...c,headers:{...Sm(),...c==null?void 0:c.headers}});if(!r.ok){const d=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${d?` - ${d}`:""}`)}if(!(r.headers.get("content-type")||"").includes("application/json"))throw new Error("API endpoint not available. Please restart the server with the latest version.");return r.json()}const Ba={listProofs:()=>k("/proofs"),proofsSummary:()=>k("/proofs/summary"),getProof:i=>k(`/proofs/${encodeURIComponent(i)}`),startSession:i=>k("/session/start",{method:"POST",body:JSON.stringify(i)}),quickStart:(i,c="claude")=>k("/session/quick-start",{method:"POST",body:JSON.stringify({prompt:i,provider:c})}),stopSession:()=>k("/session/stop",{method:"POST"}),pauseSession:()=>k("/session/pause",{method:"POST"}),resumeSession:()=>k("/session/resume",{method:"POST"}),getPrdPrefill:()=>k("/session/prd-prefill"),getStatus:()=>k("/session/status"),getAgents:()=>k("/session/agents"),getLogs:(i=200)=>k(`/session/logs?lines=${i}`),getMemorySummary:()=>k("/session/memory"),getChecklist:()=>k("/session/checklist"),getFiles:()=>k("/session/files"),getFileContent:i=>k(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(c)}`),getTemplates:()=>k("/templates"),getTemplateContent:i=>k(`/templates/${encodeURIComponent(i)}`),planSession:(i,c)=>k("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:c})}),generateReport:(i="markdown")=>k("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>k("/session/share",{method:"POST"}),getCurrentProvider:()=>k("/provider/current"),setProvider:i=>k("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>k("/session/metrics"),getSessionsHistory:()=>k("/sessions/history"),getSessionDetail:i=>k(`/sessions/${encodeURIComponent(i)}`),deleteSession:i=>k(`/sessions/${encodeURIComponent(i)}`,{method:"DELETE"}),onboardRepo:i=>k("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:c,content:r})}),createSessionFile:(i,c,r="")=>k(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:c,content:r})}),deleteSessionFile:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:c})}),createSessionDirectory:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:c})}),reviewProject:i=>k(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>k(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>k(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>k(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),fixProject:i=>k(`/sessions/${encodeURIComponent(i)}/fix`,{method:"POST"}),chatMessage:(i,c,r="quick")=>k(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:c,mode:r})}),chatStart:(i,c,r="quick",o)=>k(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:c,mode:r,history:o})}),chatPoll:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(c)}`),chatStreamUrl:(i,c)=>`${hi}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(c)}/stream`,chatCancel:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(c)}/cancel`,{method:"POST"}),getPreviewInfo:i=>k(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:c||null})}),stop:i=>k(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>k(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>k("/secrets"),setSecret:(i,c)=>k("/secrets",{method:"POST",body:JSON.stringify({key:i,value:c})}),deleteSecret:i=>k(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getServices:i=>k(`/sessions/${encodeURIComponent(i)}/services`),getTeams:()=>k("/teams"),createTeam:i=>k("/teams",{method:"POST",body:JSON.stringify({name:i})}),getTeamMembers:i=>k(`/teams/${encodeURIComponent(i)}/members`),addTeamMember:(i,c,r)=>k(`/teams/${encodeURIComponent(i)}/members`,{method:"POST",body:JSON.stringify({email:c,role:r})}),getAuditLog:()=>k("/audit-log"),getServiceLogs:(i,c,r=50)=>k(`/sessions/${encodeURIComponent(i)}/devserver/logs${c?`?service=${encodeURIComponent(c)}&tail=${r}`:`?tail=${r}`}`),getCheckpoints:i=>k(`/sessions/${encodeURIComponent(i)}/checkpoints`),restoreCheckpoint:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/checkpoints/${encodeURIComponent(c)}/restore`,{method:"POST"}),previewChanges:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/chat/preview`,{method:"POST",body:JSON.stringify({message:c})}),searchFiles:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/files/search?q=${encodeURIComponent(c)}`),restartService:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/devserver/restart-service`,{method:"POST",body:JSON.stringify({service:c})}),deployProject:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/deploy`,{method:"POST",body:JSON.stringify({platform:c})}),githubPush:i=>k(`/sessions/${encodeURIComponent(i)}/github/push`,{method:"POST"}),getGitHubIssues:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/issues?${new URLSearchParams({...c?{state:c}:{},...r?{limit:String(r)}:{}}).toString()}`),getGitHubIssue:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/issues/${c}`),fixGitHubIssue:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/issues/${c}/fix`,{method:"POST"}),getGitHubPRs:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/prs?${new URLSearchParams({...c?{state:c}:{},...r?{limit:String(r)}:{}}).toString()}`),getGitHubPR:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}`),getGitHubPRDiff:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}/diff`),reviewGitHubPR:(i,c,r,o)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}/review`,{method:"POST",body:JSON.stringify({action:r,body:o})}),mergeGitHubPR:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/prs/${c}/merge`,{method:"POST",body:JSON.stringify({method:r})}),getWorkflowRuns:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs?${new URLSearchParams({...c?{limit:String(c)}:{}}).toString()}`),getWorkflowRunDetail:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}`),getWorkflowRunLogs:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}/logs`),getWorkflows:i=>k(`/sessions/${encodeURIComponent(i)}/github/workflows`),dispatchWorkflow:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/workflows/dispatch`,{method:"POST",body:JSON.stringify({workflow:c,ref:r})}),rerunWorkflow:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}/rerun`,{method:"POST"}),cancelWorkflow:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/github/runs/${c}/cancel`,{method:"POST"}),importGitHubRepo:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/github/import`,{method:"POST",body:JSON.stringify({repo:c,...r?{branch:r}:{}})}),getDeployStatus:()=>k("/deploy/status"),connectVercel:i=>k("/deploy/vercel/connect",{method:"POST",body:JSON.stringify({token:i})}),connectNetlify:i=>k("/deploy/netlify/connect",{method:"POST",body:JSON.stringify({token:i})}),disconnectPlatform:i=>k(`/deploy/${encodeURIComponent(i)}/disconnect`,{method:"POST"}),getMe:()=>k("/auth/me"),getGitHubAuthUrl:()=>k("/auth/github/url"),getGoogleAuthUrl:()=>k("/auth/google/url"),githubCallback:(i,c)=>k("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:c})}),googleCallback:(i,c,r)=>k("/auth/google/callback",{method:"POST",body:JSON.stringify({code:i,state:c,redirect_uri:r||`${window.location.origin}${window.location.pathname}`})}),git:{status:i=>k(`/sessions/${encodeURIComponent(i)}/git/status`),log:(i,c=20)=>k(`/sessions/${encodeURIComponent(i)}/git/log?limit=${c}`),branches:i=>k(`/sessions/${encodeURIComponent(i)}/git/branches`),commit:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/git/commit`,{method:"POST",body:JSON.stringify({message:c,files:r})}),createBranch:(i,c,r=!0)=>k(`/sessions/${encodeURIComponent(i)}/git/branch`,{method:"POST",body:JSON.stringify({name:c,checkout:r})}),checkoutBranch:(i,c)=>k(`/sessions/${encodeURIComponent(i)}/git/checkout`,{method:"POST",body:JSON.stringify({name:c})}),push:i=>k(`/sessions/${encodeURIComponent(i)}/git/push`,{method:"POST"}),pr:(i,c,r)=>k(`/sessions/${encodeURIComponent(i)}/git/pr`,{method:"POST",body:JSON.stringify({title:c,body:r})})},generateDocs:i=>k(`/sessions/${encodeURIComponent(i)}/docs/generate`,{method:"POST"}),getDocsStatus:i=>k(`/sessions/${encodeURIComponent(i)}/docs/status`),getDocFiles:i=>k(`/sessions/${encodeURIComponent(i)}/docs/files`),getDocFileContent:async(i,c)=>{const r=await fetch(`${hi}/sessions/${encodeURIComponent(i)}/docs/files/${encodeURIComponent(c)}`,{headers:Sm()});if(!r.ok)throw new Error(`API error ${r.status}: ${r.statusText}`);return r.text()},chatImageUpload:async(i,c)=>{const r=new FormData;r.append("image",c);const o=await fetch(`${hi}/sessions/${encodeURIComponent(i)}/chat/image`,{method:"POST",headers:{...(()=>{const d={};try{const m=localStorage.getItem("pl_auth_token");m&&(d.Authorization=`Bearer ${m}`)}catch{}return d})()},body:r});if(!o.ok){const d=await o.text().catch(()=>"");throw new Error(`API error ${o.status}: ${o.statusText}${d?` - ${d}`:""}`)}return o.json()}};class Og{constructor(c){Ln(this,"ws",null);Ln(this,"listeners",new Map);Ln(this,"reconnectTimer",null);Ln(this,"url");this.url=c||Ag}connect(){var c;((c=this.ws)==null?void 0:c.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const o=JSON.parse(r.data);if(o.type==="ping"){this.send({type:"pong"});return}this.emit(o.type,o.data||o)}catch{}},this.ws.onclose=()=>{this.emit("disconnected",{}),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}on(c,r){return this.listeners.has(c)||this.listeners.set(c,new Set),this.listeners.get(c).add(r),()=>{var o;return(o=this.listeners.get(c))==null?void 0:o.delete(r)}}emit(c,r){var o,d;(o=this.listeners.get(c))==null||o.forEach(m=>m(r)),(d=this.listeners.get("*"))==null||d.forEach(m=>m({type:c,data:r}))}send(c){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(c))}disconnect(){var c;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(c=this.ws)==null||c.close(),this.ws=null}}const Js="pl_auth_token",Em=v.createContext({user:null,loading:!0,login:()=>{},logout:()=>{},isLocalMode:!0});function Mg(i,c,r){c(!1),r({email:i.sub||i.email||"",name:i.name||"",avatar_url:i.avatar||"",authenticated:!0})}function Dg({children:i}){const[c,r]=v.useState(null),[o,d]=v.useState(!0),[m,p]=v.useState(!0),E=lo(),x=kt();v.useEffect(()=>{let H=!1;async function L(){const B=new URLSearchParams(window.location.search),U=B.get("token"),Q=B.get("code");if(U)localStorage.setItem(Js,U),window.history.replaceState({},"",window.location.pathname);else if(Q)try{const q=sessionStorage.getItem("pl_oauth_provider")||"github",I=sessionStorage.getItem("pl_oauth_state")||"";sessionStorage.removeItem("pl_oauth_state"),sessionStorage.removeItem("pl_oauth_provider");let J;if(q==="google"?J=await Ba.googleCallback(Q,I):J=await Ba.githubCallback(Q,I),!H){localStorage.setItem(Js,J.token),window.history.replaceState({},"",window.location.pathname),p(!1),r({email:J.user.email,name:J.user.name,avatar_url:J.user.avatar_url,authenticated:!0}),d(!1);return}}catch{window.history.replaceState({},"",window.location.pathname)}try{const q=await Ba.getMe();if(H)return;q.local_mode?(p(!0),r(null)):q.authenticated?Mg(q,p,r):(p(!1),r(null))}catch{if(H)return;p(!0),r(null)}finally{H||d(!1)}}return L(),()=>{H=!0}},[]);const y=v.useCallback(H=>{H==="github"?Ba.getGitHubAuthUrl().then(L=>{try{const U=new URL(L.url).searchParams.get("state");U&&(sessionStorage.setItem("pl_oauth_state",U),sessionStorage.setItem("pl_oauth_provider","github"))}catch{}window.location.href=L.url}).catch(()=>{}):H==="google"&&Ba.getGoogleAuthUrl().then(L=>{try{const U=new URL(L.url).searchParams.get("state");U&&(sessionStorage.setItem("pl_oauth_state",U),sessionStorage.setItem("pl_oauth_provider","google"))}catch{}window.location.href=L.url}).catch(()=>{})},[]),z=v.useCallback(()=>{localStorage.removeItem(Js),r(null),x.pathname!=="/login"&&E("/login",{replace:!0})},[E,x.pathname]),_=v.useMemo(()=>({user:c,loading:o,login:y,logout:z,isLocalMode:m}),[c,o,y,z,m]);return h.jsx(Em.Provider,{value:_,children:i})}function _m(){return v.useContext(Em)}function Ug(){const[i,c]=v.useState(()=>typeof window>"u"?"light":localStorage.getItem("pl_theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"));v.useEffect(()=>{document.documentElement.classList.toggle("dark",i==="dark"),localStorage.setItem("pl_theme",i)},[i]);const r=v.useCallback(()=>{c(o=>o==="light"?"dark":"light")},[]);return{theme:i,toggleTheme:r,isDark:i==="dark"}}const Tm="pl_discovered_features";function zm(){try{const i=localStorage.getItem(Tm);if(i)return new Set(JSON.parse(i))}catch{}return new Set}function wg(i){try{localStorage.setItem(Tm,JSON.stringify([...i]))}catch{}}function Hg(i){const c=zm();c.has(i)||(c.add(i),wg(c),window.dispatchEvent(new CustomEvent("pl_feature_discovered",{detail:i})))}function kg({feature:i,className:c=""}){const[r,o]=v.useState(!0);return v.useEffect(()=>{o(zm().has(i))},[i]),v.useEffect(()=>{const d=m=>{m.detail===i&&o(!0)};return window.addEventListener("pl_feature_discovered",d),()=>window.removeEventListener("pl_feature_discovered",d)},[i]),r?null:h.jsxs("span",{className:`relative inline-flex ${c}`,"aria-hidden":"true",children:[h.jsx("span",{className:"absolute inline-flex h-2.5 w-2.5 rounded-full bg-primary/40 animate-ping"}),h.jsx("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-primary"})]})}const Nm="pl_getting_started_steps",wh="pl_getting_started_dismissed",Hh="pl_getting_started_collapsed",kh=[{id:"create_project",label:"Create your first project",description:"Describe what you want to build or pick a template to get started.",icon:vm},{id:"try_chat",label:"Try the AI chat",description:"Ask the AI to modify, explain, or improve your code.",icon:so},{id:"preview_app",label:"Preview your app",description:"Open the Preview tab to see your application running live.",icon:pm},{id:"explore_templates",label:"Explore templates",description:"Browse the template gallery for inspiration and quick starts.",icon:co},{id:"deploy_app",label:"Deploy your app",description:"Push your project live with one click using the Deploy tab.",icon:oo}];function Lh(){try{const i=localStorage.getItem(Nm);if(i)return new Set(JSON.parse(i))}catch{}return new Set}function Lg(i){try{localStorage.setItem(Nm,JSON.stringify([...i]))}catch{}}function Bg(){const[i,c]=v.useState(!1),[r,o]=v.useState(!1),[d,m]=v.useState(new Set);v.useEffect(()=>{try{if(localStorage.getItem(wh)==="1"){c(!0);return}o(localStorage.getItem(Hh)==="1")}catch{}m(Lh())},[]),v.useEffect(()=>{const L=()=>m(Lh());return window.addEventListener("pl_step_complete",L),()=>window.removeEventListener("pl_step_complete",L)},[]);const p=v.useCallback(L=>{m(B=>{const U=new Set(B);return U.has(L)?U.delete(L):U.add(L),Lg(U),U})},[]),E=()=>{c(!0);try{localStorage.setItem(wh,"1")}catch{}},x=()=>{o(L=>{const B=!L;try{localStorage.setItem(Hh,B?"1":"0")}catch{}return B})};if(i)return null;const y=d.size,z=kh.length,_=y/z*100,H=y===z;return h.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[h.jsxs("button",{onClick:x,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-hover transition-colors",children:[h.jsx(kv,{size:16,className:"text-primary flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-sm font-heading font-bold text-ink",children:"Getting Started"}),h.jsxs("span",{className:"text-[11px] text-muted-accessible font-mono",children:[y,"/",z]})]}),h.jsx("div",{className:"h-1 bg-border rounded-full mt-1.5 overflow-hidden",children:h.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-500",style:{width:`${_}%`}})})]}),h.jsx("div",{className:"flex items-center gap-1",children:r?h.jsx(nv,{size:14,className:"text-muted"}):h.jsx(mm,{size:14,className:"text-muted"})})]}),!r&&h.jsxs("div",{className:"border-t border-border",children:[h.jsx("div",{className:"px-3 py-2 space-y-0.5",children:kh.map(L=>{const B=d.has(L.id),U=L.icon;return h.jsxs("button",{onClick:()=>p(L.id),className:`w-full flex items-start gap-3 px-3 py-2.5 rounded-lg text-left transition-colors ${B?"opacity-60 hover:opacity-80":"hover:bg-hover"}`,children:[h.jsx("div",{className:"mt-0.5 flex-shrink-0",children:B?h.jsx(rv,{size:16,className:"text-success"}):h.jsx(yv,{size:16,className:"text-border"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:`text-xs font-medium ${B?"text-muted line-through":"text-ink"}`,children:L.label}),!B&&h.jsx("p",{className:"text-[11px] text-muted-accessible mt-0.5 leading-relaxed",children:L.description})]}),h.jsx(U,{size:14,className:`flex-shrink-0 mt-0.5 ${B?"text-muted":"text-primary/50"}`})]},L.id)})}),h.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-t border-border",children:[H?h.jsx("span",{className:"text-xs text-success font-medium",children:"All done -- you are ready to build!"}):h.jsx("span",{className:"text-[11px] text-muted",children:"Complete each step to learn the basics."}),h.jsxs("button",{onClick:E,className:"flex items-center gap-1 text-[11px] text-muted hover:text-ink transition-colors",children:[h.jsx(ea,{size:11}),"Dismiss"]})]})]})]})}const Bh="pl_sidebar_collapsed",qg=[{to:"/",label:"Home",icon:Ov},{to:"/projects",label:"Projects",icon:_v},{to:"/templates",label:"Templates",icon:co,discoveryFeature:"templates"},{to:"/showcase",label:"Showcase",icon:ro},{to:"/magic",label:"Magic",icon:Tg},{to:"/metrics",label:"Metrics",icon:lv},{to:"/compare",label:"Compare",icon:Rv},{to:"/teams",label:"Teams",icon:xg}],Yg=[{to:"/settings",label:"Settings",icon:xm},{to:"/admin",label:"Admin",icon:ug},{to:"/admin/settings",label:"System",icon:Ng}];function Gg(){const[i,c]=v.useState(typeof window<"u"?window.innerWidth<768:!1);return v.useEffect(()=>{const r=()=>c(window.innerWidth<768);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i}function Qg({wsConnected:i,version:c,onOpenDocs:r}){const o=Gg(),d=kt(),{theme:m,toggleTheme:p}=Ug(),[E,x]=v.useState(!1),[y,z]=v.useState(()=>{try{return localStorage.getItem(Bh)==="1"}catch{return!1}});v.useEffect(()=>{try{localStorage.setItem(Bh,y?"1":"0")}catch{}},[y]),v.useEffect(()=>{o&&x(!1)},[d.pathname,o]);const _=o?E:!y,H=_?240:64,L=U=>["flex items-center gap-3 px-3 py-2 text-sm transition-colors rounded-[5px]",!_&&"justify-center",U?"bg-[#553DE9]/8 text-[#553DE9] font-medium border-l-2 border-[#553DE9]":"text-[#36342E] hover:bg-[#F8F4F0]"].filter(Boolean).join(" "),B=h.jsxs("aside",{className:"flex flex-col h-full border-r border-[#ECEAE3] bg-white transition-[width] duration-200",style:{width:H,minWidth:H},children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-[#ECEAE3]",children:[_&&h.jsxs("div",{className:"flex flex-col",children:[h.jsx("span",{className:"font-heading text-lg font-bold leading-tight text-[#36342E]",children:"Purple Lab"}),h.jsx("span",{className:"text-xs text-[#6B6960]",children:"Powered by Loki"})]}),o?h.jsx("button",{type:"button","aria-label":E?"Close menu":"Open menu",title:E?"Close menu":"Open menu",onClick:()=>x(!E),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:E?h.jsx(ea,{size:16}):h.jsx(Yv,{size:16})}):h.jsx("button",{type:"button","aria-label":y?"Expand sidebar":"Collapse sidebar",title:y?"Expand sidebar":"Collapse sidebar",onClick:()=>z(!y),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:y?h.jsx(Iv,{size:16}):h.jsx(Wv,{size:16})})]}),h.jsxs("nav",{className:"flex-1 px-2 py-3 flex flex-col gap-1","aria-label":"Main navigation",children:[qg.map(U=>h.jsxs(yi,{to:U.to,end:U.to==="/",className:({isActive:Q})=>L(Q),title:_?void 0:U.label,onClick:()=>{U.discoveryFeature&&Hg(U.discoveryFeature)},children:[h.jsxs("div",{className:"relative",children:[h.jsx(U.icon,{size:18}),U.discoveryFeature&&h.jsx(kg,{feature:U.discoveryFeature,className:"absolute -top-1 -right-1"})]}),_&&h.jsx("span",{children:U.label})]},U.to)),h.jsx("div",{className:"my-2 border-t border-[#ECEAE3]"}),Yg.map(U=>h.jsxs(yi,{to:U.to,className:({isActive:Q})=>L(Q),title:_?void 0:U.label,children:[h.jsx(U.icon,{size:18}),_&&h.jsx("span",{children:U.label})]},U.to)),_&&h.jsx("div",{className:"mt-3 px-1",children:h.jsx(Bg,{})})]}),h.jsxs("div",{className:"px-3 py-3 border-t border-[#ECEAE3] flex flex-col gap-2",children:[h.jsx(Xg,{collapsed:!_}),h.jsxs("div",{className:["flex items-center gap-2 text-xs",!_&&"justify-center"].filter(Boolean).join(" "),children:[h.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),_&&h.jsx("span",{className:"text-[#6B6960]",children:i?"Connected":"Disconnected"})]}),_&&c&&h.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",c]}),h.jsxs("button",{onClick:p,title:m==="dark"?"Light mode":"Dark mode",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!_&&"justify-center"].filter(Boolean).join(" "),children:[m==="dark"?h.jsx(mg,{size:14}):h.jsx(Zv,{size:14}),_&&h.jsx("span",{children:m==="dark"?"Light Mode":"Dark Mode"})]}),h.jsxs("button",{onClick:r,className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!_&&"justify-center"].filter(Boolean).join(" "),title:_?void 0:"Help & Docs",children:[h.jsx(ym,{size:14}),_&&h.jsx("span",{children:"Help & Docs"})]}),h.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!_&&"justify-center"].filter(Boolean).join(" "),title:_?void 0:"Documentation",children:[h.jsx(hm,{size:14}),_&&h.jsx("span",{children:"Docs"})]})]})]});return o&&E?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40 bg-ink/20",onClick:()=>x(!1)}),h.jsx("div",{className:"fixed inset-y-0 left-0 z-50",children:B})]}):B}function Xg({collapsed:i}){const{user:c,logout:r,isLocalMode:o}=_m(),[d,m]=v.useState(!1),p=v.useRef(null);return v.useEffect(()=>{function E(x){p.current&&!p.current.contains(x.target)&&m(!1)}if(d)return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[d]),o||!c?h.jsxs("div",{className:["flex items-center gap-2 text-xs",i&&"justify-center"].filter(Boolean).join(" "),title:i?"Local Mode":void 0,children:[h.jsx(Xv,{size:14,className:"text-[#939084] flex-shrink-0"}),!i&&h.jsx("span",{className:"text-[#939084]",children:"Local Mode"})]}):h.jsxs("div",{className:"relative",ref:p,"data-testid":"user-section",children:[h.jsxs("button",{type:"button",onClick:()=>m(!d),className:["flex items-center gap-2 w-full text-left text-xs rounded-[3px] py-1 px-1 hover:bg-[#F8F4F0] transition-colors",i&&"justify-center"].filter(Boolean).join(" "),title:i?c.name||c.email:void 0,children:[c.avatar_url?h.jsx("img",{src:c.avatar_url,alt:"",className:"w-5 h-5 rounded-full flex-shrink-0"}):h.jsx("div",{className:"w-5 h-5 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:(c.name||c.email||"?")[0].toUpperCase()}),!i&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-[#36342E] truncate flex-1",children:c.name||c.email}),h.jsx(mm,{size:12,className:`text-[#939084] transition-transform ${d?"":"rotate-180"}`})]})]}),d&&h.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-48 bg-white border border-[#ECEAE3] rounded-lg shadow-lg py-1 z-50",children:[h.jsxs("div",{className:"px-3 py-2 border-b border-[#ECEAE3]",children:[h.jsx("p",{className:"text-xs font-medium text-[#36342E] truncate",children:c.name}),h.jsx("p",{className:"text-xs text-[#939084] truncate",children:c.email})]}),h.jsxs(yi,{to:"/settings",onClick:()=>m(!1),className:"flex items-center gap-2 px-3 py-2 text-xs text-[#36342E] hover:bg-[#F8F4F0] transition-colors",children:[h.jsx(xm,{size:14}),"Settings"]}),h.jsxs("button",{type:"button",onClick:()=>{m(!1),r()},className:"flex items-center gap-2 px-3 py-2 text-xs text-[#C45B5B] hover:bg-[#F8F4F0] transition-colors w-full text-left",children:[h.jsx(Bv,{size:14}),"Sign out"]})]})]})}const qa=[];function Vg(i){if(i.key==="Escape"&&qa.length>0){i.preventDefault(),i.stopPropagation();const c=qa[qa.length-1];c()}}let qh=!1;function Zg(){qh||(document.addEventListener("keydown",Vg),qh=!0)}function Jg(i,c){const r=v.useRef(c);r.current=c;const o=v.useCallback(()=>{r.current()},[]);v.useEffect(()=>{if(i)return Zg(),qa.push(o),()=>{const d=qa.indexOf(o);d!==-1&&qa.splice(d,1)}},[i,o])}const Yh=["a[href]","button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function Kg(i){const c=v.useRef(null),r=v.useRef(null);return v.useEffect(()=>{if(!i)return;r.current=document.activeElement;const o=c.current;if(!o)return;const d=o.querySelectorAll(Yh);d.length>0&&requestAnimationFrame(()=>d[0].focus());const m=p=>{if(p.key!=="Tab")return;const E=o.querySelectorAll(Yh);if(E.length===0)return;const x=E[0],y=E[E.length-1];p.shiftKey?document.activeElement===x&&(p.preventDefault(),y.focus()):document.activeElement===y&&(p.preventDefault(),x.focus())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m),r.current&&typeof r.current.focus=="function"&&r.current.focus()}},[i]),c}const Gh="pl_onboarding_complete",Gn=[{icon:vm,title:"Write your spec",description:"Describe what you want to build, or choose a template to get started quickly."},{icon:pg,title:"Use the terminal",description:"Run commands directly in the integrated terminal to install dependencies or debug."},{icon:pm,title:"Preview in real-time",description:"Switch to the Preview tab to see your app running with live reload."},{icon:so,title:"Iterate with AI Chat",description:"Ask the AI to modify, fix, or explain your code in the chat panel."}];function $g(){const[i,c]=v.useState(!1),[r,o]=v.useState(0),d=Kg(i);Jg(i,()=>{i&&m()}),v.useEffect(()=>{try{localStorage.getItem(Gh)!=="1"&&c(!0)}catch{}},[]);const m=()=>{c(!1);try{localStorage.setItem(Gh,"1")}catch{}},p=()=>{r<Gn.length-1?o(r+1):m()};if(!i)return null;const E=Gn[r],x=E.icon;return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/30",children:h.jsxs("div",{ref:d,className:"bg-card rounded-card shadow-card-hover border border-border w-full max-w-sm mx-4",children:[h.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-2",children:[h.jsxs("span",{className:"text-[11px] font-mono text-muted-accessible",children:[r+1," / ",Gn.length]}),h.jsx("button",{onClick:m,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Skip onboarding",children:h.jsx(ea,{size:14})})]}),h.jsxs("div",{className:"px-5 pb-4 text-center",children:[h.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:h.jsx(x,{size:24,className:"text-primary"})}),h.jsx("h3",{className:"text-sm font-heading font-bold text-ink mb-1",children:E.title}),h.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed",children:E.description})]}),h.jsx("div",{className:"flex items-center justify-center gap-1.5 pb-4",children:Gn.map((y,z)=>h.jsx("div",{className:`w-1.5 h-1.5 rounded-full transition-colors ${z===r?"bg-primary":"bg-border"}`},z))}),h.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[h.jsx("button",{onClick:m,className:"text-xs text-muted hover:text-ink transition-colors",children:"Skip"}),h.jsx("button",{onClick:p,className:"inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:r<Gn.length-1?h.jsxs(h.Fragment,{children:["Next",h.jsx(dm,{size:12})]}):"Get Started"})]})]})})}const Qh="pl_product_tour_complete",Wg=[{target:'[data-tour="input-box"]',title:"Describe what you want to build",description:"Type a plain-English description of your project here. The more detail you give, the better the result. You can also paste a spec / PRD or select a template.",position:"bottom"},{target:'[data-tour="template-gallery"]',title:"Start from a template",description:"Browse ready-made templates for SaaS apps, landing pages, dashboards, and more. Each template gives you a head start with a proven structure.",position:"bottom"},{target:'[data-tour="build-progress"]',title:"Watch your project come to life",description:"Once you start a build, this bar tracks each phase: planning, building, testing, and reviewing. You will see real-time progress and cost estimates.",position:"bottom"},{target:'[data-tour="preview-tab"]',title:"Preview your running app",description:"Switch to the Preview tab to see your application running live. Changes appear in real time as the AI iterates on your code.",position:"bottom"},{target:'[data-tour="deploy-tab"]',title:"Deploy with one click",description:"When you are happy with the result, head to the Deploy tab to push your project live. Supports Vercel, Netlify, Railway, and more.",position:"bottom"}];function Fg(i){const c=document.querySelector(i);return c?c.getBoundingClientRect():null}function Ig(i,c){if(!i)return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};const r=16,o={position:"fixed",zIndex:60};switch(c){case"bottom":o.top=i.bottom+r,o.left=i.left+i.width/2,o.transform="translateX(-50%)";break;case"top":o.bottom=window.innerHeight-i.top+r,o.left=i.left+i.width/2,o.transform="translateX(-50%)";break;case"left":o.top=i.top+i.height/2,o.right=window.innerWidth-i.left+r,o.transform="translateY(-50%)";break;case"right":o.top=i.top+i.height/2,o.left=i.right+r,o.transform="translateY(-50%)";break}return o}function Pg({steps:i=Wg,onComplete:c}){const[r,o]=v.useState(!1),[d,m]=v.useState(0),[p,E]=v.useState(null),x=v.useRef(0);v.useEffect(()=>{try{if(localStorage.getItem(Qh)!=="1"){const B=setTimeout(()=>o(!0),800);return()=>clearTimeout(B)}}catch{}},[]),v.useEffect(()=>{if(!r||!i[d])return;const B=()=>{const U=Fg(i[d].target);E(U),x.current=requestAnimationFrame(B)};return B(),()=>cancelAnimationFrame(x.current)},[r,d,i]);const y=v.useCallback(()=>{o(!1);try{localStorage.setItem(Qh,"1")}catch{}c==null||c()},[c]),z=v.useCallback(()=>{d<i.length-1?m(B=>B+1):y()},[d,i.length,y]),_=v.useCallback(()=>{m(B=>Math.max(0,B-1))},[]);if(v.useEffect(()=>{if(!r)return;const B=U=>{U.key==="Escape"&&y(),U.key==="ArrowRight"&&z(),U.key==="ArrowLeft"&&_()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[r,y,z,_]),!r||!i[d])return null;const H=i[d],L=8;return h.jsxs("div",{className:"fixed inset-0 z-[55]","aria-modal":"true",role:"dialog",children:[h.jsxs("svg",{className:"absolute inset-0 w-full h-full",onClick:y,style:{zIndex:55},children:[h.jsx("defs",{children:h.jsxs("mask",{id:"tour-spotlight",children:[h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),p&&h.jsx("rect",{x:p.left-L,y:p.top-L,width:p.width+L*2,height:p.height+L*2,rx:"8",fill:"black"})]})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"rgba(0,0,0,0.55)",mask:"url(#tour-spotlight)"})]}),p&&h.jsx("div",{className:"absolute border-2 border-primary rounded-lg pointer-events-none shadow-[0_0_20px_rgba(85,61,233,0.3)]",style:{left:p.left-L,top:p.top-L,width:p.width+L*2,height:p.height+L*2,zIndex:56}}),h.jsxs("div",{className:"w-80 bg-card rounded-xl shadow-2xl border border-border p-0 overflow-hidden",style:{...Ig(p,H.position),zIndex:57},onClick:B=>B.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between px-4 pt-4 pb-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ro,{size:14,className:"text-primary"}),h.jsxs("span",{className:"text-[11px] font-mono text-muted-accessible",children:["Step ",d+1," of ",i.length]})]}),h.jsx("button",{onClick:y,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Skip tour",children:h.jsx(ea,{size:14})})]}),h.jsxs("div",{className:"px-4 pb-3",children:[h.jsx("h3",{className:"text-sm font-heading font-bold text-ink mb-1",children:H.title}),h.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed",children:H.description})]}),h.jsx("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:i.map((B,U)=>h.jsx("button",{onClick:()=>m(U),className:`w-2 h-2 rounded-full transition-all ${U===d?"bg-primary scale-110":U<d?"bg-primary/40":"bg-border"}`,"aria-label":`Go to step ${U+1}`},U))}),h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border bg-hover/30",children:[h.jsxs("button",{onClick:y,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[h.jsx(og,{size:12}),"Skip tour"]}),h.jsxs("div",{className:"flex items-center gap-2",children:[d>0&&h.jsxs("button",{onClick:_,className:"flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded-btn text-ink hover:bg-hover transition-colors",children:[h.jsx(fm,{size:12}),"Back"]}),h.jsx("button",{onClick:z,className:"flex items-center gap-1 px-4 py-1.5 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:d<i.length-1?h.jsxs(h.Fragment,{children:["Next",h.jsx(dm,{size:12})]}):"Let's go!"})]})]})]})]})}const Xh="pl_whats_new_version",Ks="6.73.1",e2=[{icon:ro,title:"Product Tour",description:"New step-by-step guided tour for first-time users. Highlights key UI areas so you never feel lost."},{icon:Kv,title:"Contextual Help Tooltips",description:"Hover over the help icons next to complex features to learn what they do without leaving the page."},{icon:gm,title:"Enhanced Keyboard Shortcuts",description:'Press "?" to open the shortcuts overlay. Shortcuts are now grouped by category with search and filtering.'},{icon:Rg,title:"Getting Started Checklist",description:"A friendly checklist guides you through your first project, from writing a spec to deploying your app."},{icon:cg,title:"In-App Documentation",description:"Browse Quick Start guides, FAQ, and template docs right inside Purple Lab, no context switching required."}];function t2(){const[i,c]=v.useState(!1);v.useEffect(()=>{try{if(localStorage.getItem(Xh)!==Ks){const d=setTimeout(()=>c(!0),1200);return()=>clearTimeout(d)}}catch{}},[]);const r=()=>{c(!1);try{localStorage.setItem(Xh,Ks)}catch{}};return i?h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/30",onClick:r,children:h.jsxs("div",{className:"bg-card rounded-xl shadow-2xl border border-border w-full max-w-md mx-4 overflow-hidden",onClick:o=>o.stopPropagation(),children:[h.jsxs("div",{className:"relative px-6 pt-6 pb-4 text-center border-b border-border bg-gradient-to-b from-primary/5 to-transparent",children:[h.jsx("button",{onClick:r,className:"absolute top-4 right-4 text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Close",children:h.jsx(ea,{size:14})}),h.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:h.jsx(zv,{size:24,className:"text-primary"})}),h.jsx("h2",{className:"text-lg font-heading font-bold text-ink",children:"What's New"}),h.jsxs("p",{className:"text-xs text-muted-accessible mt-1",children:["Purple Lab v",Ks]})]}),h.jsx("div",{className:"px-4 py-4 space-y-3 max-h-[320px] overflow-y-auto terminal-scroll",children:e2.map(o=>{const d=o.icon;return h.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg hover:bg-hover transition-colors",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:h.jsx(d,{size:16,className:"text-primary"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("h3",{className:"text-sm font-medium text-ink",children:o.title}),h.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed mt-0.5",children:o.description})]})]},o.title)})}),h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-border",children:[h.jsxs("a",{href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-primary hover:text-primary-hover transition-colors",children:["Full changelog",h.jsx(bv,{size:11})]}),h.jsx("button",{onClick:r,className:"px-5 py-2 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:"Got it!"})]})]})}):null}const $s=[{id:"quick-start",title:"Quick Start",icon:oo,content:`# Quick Start
357
357
 
358
358
  **1. Create a project**
359
359
  Click "New Project" on the home page, or type a description in the input box and press Enter.
@@ -435,4 +435,4 @@ Reason, Act, Reflect, Verify -- the AI's thinking process. It plans what to do (
435
435
  from { opacity: 0; transform: translateX(100%); }
436
436
  to { opacity: 1; transform: translateX(0); }
437
437
  }
438
- `}),h.jsx("span",{className:`flex-shrink-0 mt-0.5 ${p.icon}`,children:h.jsx(p.IconComponent,{size:18})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:o}),d&&h.jsx("p",{className:"text-xs text-[#6B6960] dark:text-[#8A8880] mt-0.5",children:d})]}),h.jsx("button",{onClick:x,className:"flex-shrink-0 text-[#939084] hover:text-[#36342E] dark:hover:text-[#E8E6E3] transition-colors","aria-label":"Dismiss notification",children:h.jsx(ea,{size:14})})]})}function m2({notifications:i,onDismiss:c}){return i.length===0?null:h.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none","aria-live":"polite",children:i.map(r=>h.jsx(h2,{notification:r,onDismiss:c},r.id))})}const Rm=v.createContext({notify:()=>"",dismiss:()=>{},dismissAll:()=>{}});let y2=0;function p2({children:i}){const[c,r]=v.useState([]),o=v.useCallback(E=>{const x=`notif-${++y2}-${Date.now()}`,y={...E,id:x};if(r(z=>[...z,y]),document.hidden&&"Notification"in window)if(Notification.permission==="granted")try{new Notification(E.title,{body:E.message||""})}catch{}else Notification.permission!=="denied"&&Notification.requestPermission().then(z=>{if(z==="granted")try{new Notification(E.title,{body:E.message||""})}catch{}});return x},[]),d=v.useCallback(E=>{r(x=>x.filter(y=>y.id!==E))},[]),m=v.useCallback(()=>{r([])},[]),p=v.useMemo(()=>({notify:o,dismiss:d,dismissAll:m}),[o,d,m]);return h.jsxs(Rm.Provider,{value:p,children:[i,h.jsx(m2,{notifications:c,onDismiss:d})]})}function k2(){return v.useContext(Rm)}function Vh({children:i}){const{user:c,loading:r,isLocalMode:o}=_m();return r?h.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):o?h.jsx(h.Fragment,{children:i}):c?h.jsx(h.Fragment,{children:i}):h.jsx(o1,{to:"/login",replace:!0})}function pi({variant:i="text",width:c,height:r,className:o=""}){const d="animate-pulse bg-[#ECEAE3]/60 rounded";if(i==="circle"){const m=c||"2rem";return h.jsx("div",{className:`${d} rounded-full flex-shrink-0 ${o}`,style:{width:m,height:m}})}return i==="block"?h.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:c||"100%",height:r||"4rem"}}):h.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:c||"100%",height:r||"0.75rem"}})}function L2(){return h.jsx("div",{className:"p-4 space-y-3",children:[...Array(12)].map((i,c)=>h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(pi,{variant:"text",width:"1.5rem",height:"10px",className:"flex-shrink-0 opacity-40"}),h.jsx(pi,{variant:"text",width:`${20+Math.random()*60}%`,height:"10px"})]},c))})}typeof window<"u"&&window.addEventListener("beforeunload",i=>{delete i.returnValue});const v2=v.lazy(()=>st(()=>import("./HomePage-BQk-MUjn.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))),g2=v.lazy(()=>st(()=>import("./ProjectPage-BfFcZp-E.js").then(i=>i.P),__vite__mapDeps([17,2,3,18,8,16,19,5,20,21,7,22,11,23,24,6,25,26,27,28,29,30,31,32,33,10,34,13,35,36,37]))),b2=v.lazy(()=>st(()=>import("./ProjectsPage-CPMBf8Wt.js"),__vite__mapDeps([38,18,4,5,6,7,39,34,32,1,24,29,35,26,30]))),x2=v.lazy(()=>st(()=>import("./TemplatesPage-CZvmimDj.js"),__vite__mapDeps([40,18,1,12,5,39,13,7,8,25,36,21,41,29]))),S2=v.lazy(()=>st(()=>import("./SettingsPage-BnNN6ETl.js"),__vite__mapDeps([42,31,11,9,22,7,6]))),E2=v.lazy(()=>st(()=>import("./LoginPage-DMOZVGGL.js"),[])),_2=v.lazy(()=>st(()=>import("./TeamsPage-BCfqcXzu.js"),__vite__mapDeps([43,18,44,14,3,20,29,33,30,45,5,16,19,11]))),T2=v.lazy(()=>st(()=>import("./AdminPage-CcCJ0Sjt.js"),__vite__mapDeps([46,18,34,5,44,20,24,25,12,14,7,23,45,41,3,11,47,36]))),z2=v.lazy(()=>st(()=>import("./SystemSettingsPage-DX4jb2e8.js"),__vite__mapDeps([48,18,29,7,26,24,31,5,30,36,11,15,41,47,33]))),N2=v.lazy(()=>st(()=>import("./MetricsPage-C39JVdsw.js"),__vite__mapDeps([49,27,12,16,29,32,5,23,13,34]))),C2=v.lazy(()=>st(()=>import("./ShowcasePage-WDrMf-cx.js"),[])),j2=v.lazy(()=>st(()=>import("./MagicPage-Bzp2Nt1z.js"),__vite__mapDeps([50,28,6,22,10]))),R2=v.lazy(()=>st(()=>import("./ComparePage-bt9rwvST.js"),[])),A2=v.lazy(()=>st(()=>import("./NotFoundPage-6vT_U9UL.js"),[]));function ct(){return h.jsxs("div",{className:"h-screen bg-[#FAF9F6] flex flex-col items-center justify-center gap-3",children:[h.jsx(pi,{variant:"block",width:"200px",height:"24px"}),h.jsx(pi,{variant:"text",width:"140px",height:"12px",className:"opacity-50"})]})}function O2(){return h.jsx(Dg,{children:h.jsx(p2,{children:h.jsxs(d1,{children:[h.jsx(Fe,{path:"/login",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(E2,{})})}),h.jsx(Fe,{path:"/project/:sessionId",element:h.jsx(Vh,{children:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(g2,{})})})}),h.jsxs(Fe,{element:h.jsx(Vh,{children:h.jsx(f2,{})}),children:[h.jsx(Fe,{path:"/",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(v2,{})})}),h.jsx(Fe,{path:"/projects",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(b2,{})})}),h.jsx(Fe,{path:"/templates",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(x2,{})})}),h.jsx(Fe,{path:"/settings",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(S2,{})})}),h.jsx(Fe,{path:"/teams",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(_2,{})})}),h.jsx(Fe,{path:"/metrics",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(N2,{})})}),h.jsx(Fe,{path:"/showcase",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(C2,{})})}),h.jsx(Fe,{path:"/magic",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(j2,{})})}),h.jsx(Fe,{path:"/compare",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(R2,{})})}),h.jsx(Fe,{path:"/admin",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(T2,{})})}),h.jsx(Fe,{path:"/admin/settings",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(z2,{})})}),h.jsx(Fe,{path:"*",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(A2,{})})})]})]})})})}const M2="/lab/".replace(/\/$/,"")||"/";fp.createRoot(document.getElementById("root")).render(h.jsx(v.StrictMode,{children:h.jsx(H1,{basename:M2,children:h.jsx(O2,{})})}));export{_v as $,dm as A,hm as B,ym as C,Wv as D,bv as E,vm as F,Cv as G,L2 as H,Dv as I,fm as J,gm as K,co as L,so as M,pi as N,w2 as O,bm as P,Kv as Q,oo as R,ug as S,gg as T,xg as U,_m as V,U2 as W,ea as X,k2 as Y,Rg as Z,st as _,Ba as a,sm as a0,Ov as a1,Tg as a2,Uh as b,W as c,dg as d,r2 as e,H2 as f,Ng as g,mm as h,nv as i,h as j,pg as k,hv as l,rv as m,lg as n,Kg as o,Jg as p,sv as q,v as r,og as s,Xv as t,lo as u,ro as v,lv as w,cg as x,pm as y,xm as z};
438
+ `}),h.jsx("span",{className:`flex-shrink-0 mt-0.5 ${p.icon}`,children:h.jsx(p.IconComponent,{size:18})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:o}),d&&h.jsx("p",{className:"text-xs text-[#6B6960] dark:text-[#8A8880] mt-0.5",children:d})]}),h.jsx("button",{onClick:x,className:"flex-shrink-0 text-[#939084] hover:text-[#36342E] dark:hover:text-[#E8E6E3] transition-colors","aria-label":"Dismiss notification",children:h.jsx(ea,{size:14})})]})}function m2({notifications:i,onDismiss:c}){return i.length===0?null:h.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none","aria-live":"polite",children:i.map(r=>h.jsx(h2,{notification:r,onDismiss:c},r.id))})}const Rm=v.createContext({notify:()=>"",dismiss:()=>{},dismissAll:()=>{}});let y2=0;function p2({children:i}){const[c,r]=v.useState([]),o=v.useCallback(E=>{const x=`notif-${++y2}-${Date.now()}`,y={...E,id:x};if(r(z=>[...z,y]),document.hidden&&"Notification"in window)if(Notification.permission==="granted")try{new Notification(E.title,{body:E.message||""})}catch{}else Notification.permission!=="denied"&&Notification.requestPermission().then(z=>{if(z==="granted")try{new Notification(E.title,{body:E.message||""})}catch{}});return x},[]),d=v.useCallback(E=>{r(x=>x.filter(y=>y.id!==E))},[]),m=v.useCallback(()=>{r([])},[]),p=v.useMemo(()=>({notify:o,dismiss:d,dismissAll:m}),[o,d,m]);return h.jsxs(Rm.Provider,{value:p,children:[i,h.jsx(m2,{notifications:c,onDismiss:d})]})}function k2(){return v.useContext(Rm)}function Vh({children:i}){const{user:c,loading:r,isLocalMode:o}=_m();return r?h.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):o?h.jsx(h.Fragment,{children:i}):c?h.jsx(h.Fragment,{children:i}):h.jsx(o1,{to:"/login",replace:!0})}function pi({variant:i="text",width:c,height:r,className:o=""}){const d="animate-pulse bg-[#ECEAE3]/60 rounded";if(i==="circle"){const m=c||"2rem";return h.jsx("div",{className:`${d} rounded-full flex-shrink-0 ${o}`,style:{width:m,height:m}})}return i==="block"?h.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:c||"100%",height:r||"4rem"}}):h.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:c||"100%",height:r||"0.75rem"}})}function L2(){return h.jsx("div",{className:"p-4 space-y-3",children:[...Array(12)].map((i,c)=>h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(pi,{variant:"text",width:"1.5rem",height:"10px",className:"flex-shrink-0 opacity-40"}),h.jsx(pi,{variant:"text",width:`${20+Math.random()*60}%`,height:"10px"})]},c))})}typeof window<"u"&&window.addEventListener("beforeunload",i=>{delete i.returnValue});const v2=v.lazy(()=>st(()=>import("./HomePage-DZ4MmOdH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),g2=v.lazy(()=>st(()=>import("./ProjectPage-iP6dJihg.js").then(i=>i.P),__vite__mapDeps([18,2,3,19,9,17,20,6,21,22,8,23,12,24,25,7,26,27,28,29,30,31,32,33,34,11,35,14,36,37,38]))),b2=v.lazy(()=>st(()=>import("./ProjectsPage-BibN9bHl.js"),__vite__mapDeps([39,19,5,6,7,8,40,35,33,1,25,30,36,27,31]))),x2=v.lazy(()=>st(()=>import("./TemplatesPage-BzkA9kat.js"),__vite__mapDeps([41,19,1,13,6,40,14,8,9,26,37,22,42,30]))),S2=v.lazy(()=>st(()=>import("./SettingsPage-C0WJp1hW.js"),__vite__mapDeps([43,32,12,10,23,8,7]))),E2=v.lazy(()=>st(()=>import("./LoginPage-VMzI6ROD.js"),[])),_2=v.lazy(()=>st(()=>import("./TeamsPage-BE0szv9r.js"),__vite__mapDeps([44,19,45,15,3,21,30,34,31,46,6,17,20,12]))),T2=v.lazy(()=>st(()=>import("./AdminPage-DNGNuAge.js"),__vite__mapDeps([47,19,35,6,45,21,25,26,13,15,8,24,46,42,3,12,48,37]))),z2=v.lazy(()=>st(()=>import("./SystemSettingsPage-BIaCB0Vn.js"),__vite__mapDeps([49,19,30,8,27,25,32,6,31,37,12,16,42,48,34]))),N2=v.lazy(()=>st(()=>import("./MetricsPage-DbL6xmRQ.js"),__vite__mapDeps([50,28,13,17,30,33,4,6,24,14,35]))),C2=v.lazy(()=>st(()=>import("./ShowcasePage-DUv0Njp8.js"),[])),j2=v.lazy(()=>st(()=>import("./MagicPage-CFbX5gWg.js"),__vite__mapDeps([51,29,7,23,11]))),R2=v.lazy(()=>st(()=>import("./ComparePage-BB8DJBWR.js"),[])),A2=v.lazy(()=>st(()=>import("./NotFoundPage-BUrjXPAR.js"),[]));function ct(){return h.jsxs("div",{className:"h-screen bg-[#FAF9F6] flex flex-col items-center justify-center gap-3",children:[h.jsx(pi,{variant:"block",width:"200px",height:"24px"}),h.jsx(pi,{variant:"text",width:"140px",height:"12px",className:"opacity-50"})]})}function O2(){return h.jsx(Dg,{children:h.jsx(p2,{children:h.jsxs(d1,{children:[h.jsx(Fe,{path:"/login",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(E2,{})})}),h.jsx(Fe,{path:"/project/:sessionId",element:h.jsx(Vh,{children:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(g2,{})})})}),h.jsxs(Fe,{element:h.jsx(Vh,{children:h.jsx(f2,{})}),children:[h.jsx(Fe,{path:"/",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(v2,{})})}),h.jsx(Fe,{path:"/projects",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(b2,{})})}),h.jsx(Fe,{path:"/templates",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(x2,{})})}),h.jsx(Fe,{path:"/settings",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(S2,{})})}),h.jsx(Fe,{path:"/teams",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(_2,{})})}),h.jsx(Fe,{path:"/metrics",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(N2,{})})}),h.jsx(Fe,{path:"/showcase",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(C2,{})})}),h.jsx(Fe,{path:"/magic",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(j2,{})})}),h.jsx(Fe,{path:"/compare",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(R2,{})})}),h.jsx(Fe,{path:"/admin",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(T2,{})})}),h.jsx(Fe,{path:"/admin/settings",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(z2,{})})}),h.jsx(Fe,{path:"*",element:h.jsx(v.Suspense,{fallback:h.jsx(ct,{}),children:h.jsx(A2,{})})})]})]})})})}const M2="/lab/".replace(/\/$/,"")||"/";fp.createRoot(document.getElementById("root")).render(h.jsx(v.StrictMode,{children:h.jsx(H1,{basename:M2,children:h.jsx(O2,{})})}));export{_v as $,dm as A,hm as B,ym as C,Wv as D,bv as E,vm as F,Cv as G,L2 as H,Dv as I,fm as J,gm as K,co as L,so as M,pi as N,w2 as O,bm as P,Kv as Q,oo as R,ug as S,gg as T,xg as U,_m as V,U2 as W,ea as X,k2 as Y,Rg as Z,st as _,Ba as a,sm as a0,Ov as a1,Tg as a2,Uh as b,W as c,dg as d,r2 as e,H2 as f,Ng as g,mm as h,nv as i,h as j,pg as k,hv as l,rv as m,lg as n,Kg as o,Jg as p,sv as q,v as r,og as s,Xv as t,lo as u,ro as v,lv as w,cg as x,pm as y,xm as z};