@rubytech/create-maxy-code 0.1.103 → 0.1.104

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 (108) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
  3. package/payload/platform/plugins/admin/PLUGIN.md +5 -1
  4. package/payload/platform/plugins/admin/hooks/__tests__/session-end-retrospective.test.sh +396 -0
  5. package/payload/platform/plugins/admin/hooks/session-end-retrospective.sh +268 -0
  6. package/payload/platform/plugins/admin/mcp/dist/index.js +57 -0
  7. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  8. package/payload/platform/plugins/docs/references/admin-ui.md +7 -5
  9. package/payload/platform/plugins/docs/references/session-retrospective.md +20 -0
  10. package/payload/platform/scripts/seed-neo4j.sh +18 -1
  11. package/payload/platform/services/claude-session-manager/dist/fs-watcher.d.ts +12 -1
  12. package/payload/platform/services/claude-session-manager/dist/fs-watcher.d.ts.map +1 -1
  13. package/payload/platform/services/claude-session-manager/dist/fs-watcher.js +4 -0
  14. package/payload/platform/services/claude-session-manager/dist/fs-watcher.js.map +1 -1
  15. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  16. package/payload/platform/services/claude-session-manager/dist/http-server.js +43 -2
  17. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  18. package/payload/platform/services/claude-session-manager/dist/index.js +5 -0
  19. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  20. package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts +9 -0
  21. package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts.map +1 -1
  22. package/payload/platform/services/claude-session-manager/dist/jsonl-path.js +12 -0
  23. package/payload/platform/services/claude-session-manager/dist/jsonl-path.js.map +1 -1
  24. package/payload/platform/services/claude-session-manager/dist/permission-mode-tail.d.ts +20 -0
  25. package/payload/platform/services/claude-session-manager/dist/permission-mode-tail.d.ts.map +1 -0
  26. package/payload/platform/services/claude-session-manager/dist/permission-mode-tail.js +71 -0
  27. package/payload/platform/services/claude-session-manager/dist/permission-mode-tail.js.map +1 -0
  28. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +7 -0
  29. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  30. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +49 -2
  31. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  32. package/payload/platform/services/claude-session-manager/dist/session-sidecar.d.ts +11 -1
  33. package/payload/platform/services/claude-session-manager/dist/session-sidecar.d.ts.map +1 -1
  34. package/payload/platform/services/claude-session-manager/dist/session-sidecar.js +10 -0
  35. package/payload/platform/services/claude-session-manager/dist/session-sidecar.js.map +1 -1
  36. package/payload/platform/templates/agents/admin/IDENTITY.md +16 -0
  37. package/payload/server/public/assets/{ChatInput-DeBN_eCm.css → ChatInput-CJ50oqWt.css} +1 -1
  38. package/payload/server/public/assets/{Checkbox-Dd6lh79E.js → Checkbox-DGZG9BKc.js} +1 -1
  39. package/payload/server/public/assets/{admin-B_-v60En.js → admin-BvzMvMGo.js} +54 -54
  40. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-Nnicj9Oi.js → architectureDiagram-Q4EWVU46-Dw16BhiX.js} +1 -1
  41. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-NuGXhtpA.js → blockDiagram-DXYQGD6D-DIOpmf5Y.js} +1 -1
  42. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-DusOs1B8.js → c4Diagram-AHTNJAMY-Tdb_HZeX.js} +1 -1
  43. package/payload/server/public/assets/channel-DThrH4QF.js +1 -0
  44. package/payload/server/public/assets/{chunk-336JU56O-L4okIbRn.js → chunk-336JU56O-CebpwDDe.js} +2 -2
  45. package/payload/server/public/assets/{chunk-426QAEUC-WhvqbTM0.js → chunk-426QAEUC-BtRCmfDU.js} +1 -1
  46. package/payload/server/public/assets/{chunk-4TB4RGXK-Bby5RW_e.js → chunk-4TB4RGXK-BZ3GEWs3.js} +1 -1
  47. package/payload/server/public/assets/{chunk-5FUZZQ4R-veZxFPER.js → chunk-5FUZZQ4R-iDI6Xu0U.js} +1 -1
  48. package/payload/server/public/assets/{chunk-5PVQY5BW-BwG8uJC1.js → chunk-5PVQY5BW-SQD_EpYa.js} +1 -1
  49. package/payload/server/public/assets/{chunk-EDXVE4YY-DgQhTM1z.js → chunk-EDXVE4YY-CtCcA7_e.js} +1 -1
  50. package/payload/server/public/assets/{chunk-ENJZ2VHE-DpBKyLeu.js → chunk-ENJZ2VHE-pXVGVCbb.js} +1 -1
  51. package/payload/server/public/assets/{chunk-ICPOFSXX-Bb8kEMah.js → chunk-ICPOFSXX-Dkzg9o2N.js} +1 -1
  52. package/payload/server/public/assets/{chunk-OYMX7WX6-BUrpyQuA.js → chunk-OYMX7WX6-1ZZWzf9F.js} +1 -1
  53. package/payload/server/public/assets/{chunk-U2HBQHQK-D0mOjNKD.js → chunk-U2HBQHQK-CpQ3kzO0.js} +1 -1
  54. package/payload/server/public/assets/{chunk-X2U36JSP-CQ7VnONI.js → chunk-X2U36JSP-C2LkxroC.js} +1 -1
  55. package/payload/server/public/assets/{chunk-YZCP3GAM-BWgvd9aw.js → chunk-YZCP3GAM-Bl5jBOt5.js} +1 -1
  56. package/payload/server/public/assets/{chunk-ZZ45TVLE-UFB_t9gw.js → chunk-ZZ45TVLE-CHtnptPS.js} +1 -1
  57. package/payload/server/public/assets/classDiagram-6PBFFD2Q-BC6oGTNX.js +1 -0
  58. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-COwC5Umh.js +1 -0
  59. package/payload/server/public/assets/clone-Chp7hvnA.js +1 -0
  60. package/payload/server/public/assets/{dagre-VrERS_-G.js → dagre-BziN0Nkh.js} +1 -1
  61. package/payload/server/public/assets/{dagre-KV5264BT-w7RChnHk.js → dagre-KV5264BT-B7OG1g1Y.js} +1 -1
  62. package/payload/server/public/assets/data-BAgaPs4j.js +1 -0
  63. package/payload/server/public/assets/{diagram-5BDNPKRD-DDdrN3bf.js → diagram-5BDNPKRD-Bf31nIDs.js} +1 -1
  64. package/payload/server/public/assets/{diagram-G4DWMVQ6-B_lLNyeb.js → diagram-G4DWMVQ6-DQu85hhH.js} +1 -1
  65. package/payload/server/public/assets/{diagram-MMDJMWI5-Da0x1Yf0.js → diagram-MMDJMWI5-5tstbs4y.js} +1 -1
  66. package/payload/server/public/assets/{diagram-TYMM5635-DoFKKnVr.js → diagram-TYMM5635--MOV1U4o.js} +1 -1
  67. package/payload/server/public/assets/{erDiagram-SMLLAGMA-DBPmAPTe.js → erDiagram-SMLLAGMA-BtAnOJmd.js} +1 -1
  68. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-CnkJzYU4.js → flowDiagram-DWJPFMVM-CybiCIih.js} +1 -1
  69. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-BM9c9VN5.js → ganttDiagram-T4ZO3ILL-B44jN7Cy.js} +1 -1
  70. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-C-1OqQDw.js → gitGraphDiagram-UUTBAWPF-CT7iYcwg.js} +1 -1
  71. package/payload/server/public/assets/graph-Cma7EArf.js +1 -0
  72. package/payload/server/public/assets/{graph-labels-BkDqelbQ.js → graph-labels-DyKk6Sxf.js} +1 -1
  73. package/payload/server/public/assets/{graphlib-Be3_mRCh.js → graphlib-DP4o0pYL.js} +1 -1
  74. package/payload/server/public/assets/{infoDiagram-42DDH7IO-o4FB6Zjb.js → infoDiagram-42DDH7IO-CvxFpFHN.js} +1 -1
  75. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-BlnRfx6Z.js → ishikawaDiagram-UXIWVN3A-CUwWLPeR.js} +1 -1
  76. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-Da26YPBj.js → journeyDiagram-VCZTEJTY-y-OnGgLi.js} +1 -1
  77. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-C1jVbsV0.js → kanban-definition-6JOO6SKY-BhrSe8R4.js} +1 -1
  78. package/payload/server/public/assets/{lib-CKcXekKF.js → lib-CpkYtEDz.js} +5 -5
  79. package/payload/server/public/assets/{line-BS0h3YlR.js → line-C9uS7z4J.js} +1 -1
  80. package/payload/server/public/assets/{mermaid-parser.core-4FY7A26h.js → mermaid-parser.core-Cg4ZdKp-.js} +1 -1
  81. package/payload/server/public/assets/{mermaid.core-CD1JRYmG.js → mermaid.core-BHdKOsex.js} +3 -3
  82. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-BmCJ5q81.js → mindmap-definition-QFDTVHPH-NBYiXHo7.js} +1 -1
  83. package/payload/server/public/assets/{page-D6QVxITy.js → page-B4IWl3aZ.js} +1 -1
  84. package/payload/server/public/assets/{page-1atlhFFT.js → page-D9YpwhIu.js} +1 -1
  85. package/payload/server/public/assets/{pieDiagram-DEJITSTG-ClXRAXST.js → pieDiagram-DEJITSTG-CbojC64C.js} +1 -1
  86. package/payload/server/public/assets/{public-7fuvQJwF.js → public-BtOXjy3A.js} +5 -5
  87. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-D17aBgPP.js → quadrantDiagram-34T5L4WZ-CnnoZXcL.js} +1 -1
  88. package/payload/server/public/assets/{requirementDiagram-MS252O5E-CUpkUJlh.js → requirementDiagram-MS252O5E-DFRFRtyJ.js} +1 -1
  89. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-DnrrGp2c.js → sankeyDiagram-XADWPNL6-DU5gcpzO.js} +1 -1
  90. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-CMprmJg9.js → sequenceDiagram-FGHM5R23-BN7HZ6Hq.js} +1 -1
  91. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-BdpBUtXc.js → stateDiagram-FHFEXIEX-DG6cCjvg.js} +1 -1
  92. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CvVd1Q_q.js +1 -0
  93. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-u7JucCMs.js → timeline-definition-GMOUNBTQ-qmV-8SEV.js} +1 -1
  94. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-CP1Q9zf2.js → vennDiagram-DHZGUBPP-BMXQ1s3n.js} +1 -1
  95. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-BOVxInz5.js → wardleyDiagram-NUSXRM2D-CoAdP1Gw.js} +1 -1
  96. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-Dcx1f04K.js → xychartDiagram-5P7HB3ND-CZlfGTEn.js} +1 -1
  97. package/payload/server/public/data.html +5 -5
  98. package/payload/server/public/graph.html +6 -6
  99. package/payload/server/public/index.html +8 -8
  100. package/payload/server/public/public.html +5 -5
  101. package/payload/server/public/assets/channel-sqt9QaiU.js +0 -1
  102. package/payload/server/public/assets/classDiagram-6PBFFD2Q-rYq1YLUo.js +0 -1
  103. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-Cc4tKtqG.js +0 -1
  104. package/payload/server/public/assets/clone-SdNqIUjS.js +0 -1
  105. package/payload/server/public/assets/data-DQafmlMy.js +0 -1
  106. package/payload/server/public/assets/graph-CTM-V4lS.js +0 -1
  107. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DPekwBDP.js +0 -1
  108. /package/payload/server/public/assets/{ChatInput-DBdyKbiU.js → ChatInput-DJsqm_Gf.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-DD-I1_y5.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,m as c,p as l,r as u,t as d,u as f,v as p,x as m}from"./ChatInput-DBdyKbiU.js";var h=p(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),g=p(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),_=p(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),v=p(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),y=p(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),b=p(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),x=p(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),S=p(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),C=p(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),w=p(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),T=p(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),E=p(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),D=p(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),O=p(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),ee=p(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),k=p(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),te=p(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),A=p(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),j=p(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ne=p(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),re=p(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ie=p(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ae=p(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),M=p(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),N=e(m(),1),P=i(),oe=`maxy-shell-side-px`;function se(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function F(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-se());return Math.min(Math.max(e,248),n)}function I(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(oe);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return F(t)}catch{}return 264}function L({targetSelector:e=`.platform`}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(()=>I()),i=(0,N.useRef)(n);(0,N.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,N.useCallback)(()=>{r(e=>{let t=F(e);return t===e?e:t})},[]);(0,N.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(F(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(oe,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=F(264);r(e);try{window.localStorage.removeItem(oe)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,P.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var ce=!1;function le(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function ue(){let e=typeof crypto<`u`&&typeof crypto.randomUUID==`function`;if(!ce){ce=!0;let t=typeof window<`u`&&`isSecureContext`in window?window.isSecureContext:!1;console.info(`[idempotency] uuid-source=${e?`native`:`getRandomValues`} secureContext=${t}`)}return e?crypto.randomUUID():le()}function de(e){let t=e.trim();return t.length>=1&&t.length<=200}function R(e,t,n,r){let i=e===`pane`?`pane-action`:`sidebar-${t}`;console.info(`[admin-ui] ${i} sessionId=${n.slice(0,8)} action=${t} outcome=${r}`)}var fe=/session_([A-Za-z0-9_-]+)/;function z(e){if(!e)return null;let t=e.match(fe);return t?t[1]:null}async function pe(e,t,n,r,i){let a=z(r)??`unknown`,o=e=>e.slice(0,8),s=t===`pane`?`pane-action action=resume-archive`:`sidebar-resume-archive`,c;try{let t=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:`archive`})});c=t.ok?`ok`:t.status===409?`409`:`error`;let r=`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=${c}`;c===`error`?console.error(r):console.info(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=error detail=${t}`)}finally{i.refetch()}}function me(e,t,n=`pane`){let[r,i]=(0,N.useState)(null),a=(0,N.useRef)(!1),o=(0,N.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};if(a.current)return R(n,`resume`,r,`skipped-in-flight`),{ok:!1,error:`in-flight`};a.current=!0,i(`resume`);let o=ue();try{let i=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:r,channel:`browser`,idempotencyKey:o})}),a=await i.json();if(!i.ok||!(`sessionId`in a)){let e=a.error??`POST returned ${i.status}`;return R(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),R(n,`resume`,r,`200`),pe(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return R(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{a.current=!1,i(null)}},[e,t,n]),s=(0,N.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`end`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/stop?session_key=${encodeURIComponent(e)}`,{method:`POST`});if(!i.ok){let e=await i.text().catch(()=>``);return R(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`POST /stop ${i.status} ${e.slice(0,200)}`}}return R(n,`end`,r,`204`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return R(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),c=(0,N.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`purge`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}?purge=1&session_key=${encodeURIComponent(e)}`,{method:`DELETE`});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`DELETE ?purge=1 ${i.status}`;return R(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),R(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return R(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),l=(0,N.useCallback)(async(r,a)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(a);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:a})});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`POST /archive ${i.status}`;return R(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),R(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return R(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]);return{inFlight:r,resume:o,end:s,purge:c,archive:(0,N.useCallback)(e=>l(e,`archive`),[l]),unarchive:(0,N.useCallback)(e=>l(e,`unarchive`),[l]),rename:(0,N.useCallback)(async(t,r)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`rename`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(t)}/rename?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:r})});if(!i.ok){let e=await i.json().catch(()=>({})),r=e.detail||e.error||`POST /rename ${i.status}`;return R(n,`rename`,t,String(i.status)),{ok:!1,error:r,reason:e.reason}}return R(n,`rename`,t,`200`),{ok:!0}}catch(e){let r=e instanceof Error?e.message:String(e);return R(n,`rename`,t,`threw`),{ok:!1,error:r}}finally{i(null)}},[e,n])}}function B(e){return`code.session.pinned.${e}`}function V(e){if(typeof window>`u`)return new Set;try{let t=window.localStorage.getItem(B(e));if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function he(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(B(e),JSON.stringify([...t]))}catch{}}function ge(e){let[t,n]=(0,N.useState)(()=>V(e));(0,N.useEffect)(()=>{n(V(e))},[e]);let r=(0,N.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),he(e,r),r})},[e]);return{pinned:t,isPinned:(0,N.useCallback)(e=>t.has(e),[t]),togglePin:r}}function _e(e){let{businessName:i,onLaunchBrowser:o,onNavigate:s,onToggleSidebar:l,sidebarOpen:u,onLogout:d,browserLaunching:f}=e,[p,m]=(0,N.useState)(!1),h=(0,N.useRef)(null),g=(0,N.useRef)(null),[_,v]=(0,N.useState)(null),[y,C]=(0,N.useState)(!1),[D,k]=(0,N.useState)(null),[te,A]=(0,N.useState)(null),[j,re]=(0,N.useState)(null),[ie,ae]=(0,N.useState)(``);(0,N.useEffect)(()=>{ae(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,N.useEffect)(()=>{if(!p)return;let e=e=>{h.current&&!h.current.contains(e.target)&&m(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]),(0,N.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&m(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]),(0,N.useEffect)(()=>{p&&g.current?.focus()},[p]),(0,N.useEffect)(()=>{if(!p)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||re(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[p]);let oe=(0,N.useCallback)(()=>{m(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),se=(0,N.useCallback)(()=>{m(!1),o()},[o]),F=(0,N.useCallback)(e=>{m(!1),s(e)},[s]),I=(0,N.useCallback)(async()=>{if(_!==null){v(null),A(null);return}C(!0),k(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);v((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),k(e instanceof Error?e.message:String(e)),v([])}finally{C(!1)}},[_]),L=(0,N.useCallback)(e=>{A(null),v(t=>t?.filter(t=>t.slug!==e)??null),fetch(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[]),ce=(0,N.useCallback)(()=>{m(!1),d()},[d]),le=i||n.productName;return(0,P.jsxs)(`header`,{className:`admin-header`,children:[(0,P.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":u?`Hide sidebar`:`Show sidebar`,title:u?`Hide sidebar`:`Show sidebar`,"aria-expanded":u,onClick:l,children:u?(0,P.jsx)(O,{size:20,strokeWidth:1.5}):(0,P.jsx)(ee,{size:20,strokeWidth:1.5})}),(0,P.jsxs)(`div`,{className:`chat-header-label`,children:[(0,P.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,P.jsx)(`img`,{src:r,alt:``,className:`chat-logo`})}),(0,P.jsx)(`h1`,{className:`chat-tagline`,children:le})]}),(0,P.jsxs)(`div`,{className:`chat-burger-wrap`,ref:h,children:[(0,P.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:oe,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":p,children:(0,P.jsx)(E,{size:20})}),p&&(0,P.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,P.jsxs)(`button`,{ref:g,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:se,disabled:f,children:[(0,P.jsx)(c,{size:14}),` Browser`,f&&(0,P.jsx)(w,{size:12,className:`spin`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>F(`data`),children:[(0,P.jsx)(b,{size:14}),` Data`]}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>F(`graph`),children:[(0,P.jsx)(ne,{size:14}),` Graph`]}),(0,P.jsx)(`div`,{className:`chat-menu-divider`}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:I,children:[(0,P.jsx)(x,{size:14}),` Public`,y&&(0,P.jsx)(w,{size:12,className:`spin`})]}),_!==null&&(0,P.jsxs)(`div`,{className:`chat-menu-agents`,children:[D&&(0,P.jsx)(`span`,{className:`chat-menu-agent-error`,children:D}),_.length===0&&!D&&(0,P.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),_.map(e=>(0,P.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,P.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,P.jsxs)(`span`,{className:`agent-text`,children:[(0,P.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,P.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),te===e.slug?(0,P.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>L(e.slug),children:(0,P.jsx)(t,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>A(null),children:(0,P.jsx)(M,{size:12})})]}):(0,P.jsxs)(`span`,{className:`agent-actions`,children:[(0,P.jsx)(`a`,{href:`${ie}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>m(!1),children:(0,P.jsx)(x,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>A(e.slug),children:(0,P.jsx)(a,{size:12})})]})]},e.slug))]}),(0,P.jsx)(`div`,{className:`chat-menu-divider`}),(0,P.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,P.jsx)(S,{size:14}),(0,P.jsxs)(`span`,{className:`version-installed`,children:[j?`v${j.installed}`:`…`,j&&!j.updateAvailable&&(0,P.jsx)(`span`,{className:`version-uptodate-dot`}),j?.updateAvailable&&(0,P.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ce,children:[(0,P.jsx)(T,{size:14}),` Log out`]})]})]})]})}var ve=`maxy-admin-session`,ye=typeof BroadcastChannel<`u`;function H(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`rotation`&&typeof t.newKey==`string`&&t.newKey.length>0&&(t.surface===`chat`||t.surface===`graph`||t.surface===`data`||t.surface===`sessions`)&&typeof t.ts==`number`}function be(e){if(!ye)return()=>{};let t=new BroadcastChannel(ve),n=t=>{if(!H(t.data)){console.warn(`[admin-session-broadcast] outcome=received-malformed payload=${JSON.stringify(t.data)}`);return}e(t.data)};return t.addEventListener(`message`,n),()=>{t.removeEventListener(`message`,n),t.close()}}var xe=`maxy-admin-session-key`;function U(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function W(e){let t;try{t=await e.clone().json()}catch{return`parse-failed`}if(typeof t!=`object`||!t)return`unknown-401`;let n=t.code;return n===`session-missing`||n===`session-not-registered`||n===`session-expired-age`||n===`grant-expired`?n:`unknown-401`}function Se(){try{return sessionStorage.getItem(xe)}catch{return null}}function Ce(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,N.useState)(t),a=(0,N.useRef)(t);(0,N.useEffect)(()=>{a.current=r},[r]),(0,N.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,N.useState)(0),[c,l]=(0,N.useState)(null);(0,N.useEffect)(()=>be(e=>{let t=a.current.slice(0,8),r=e.newKey.slice(0,8);e.newKey!==a.current&&(console.log(`[admin-session-broadcast] outcome=received oldKey=${t} newKey=${r} surface=${n} senderSurface=${e.surface}`),i(e.newKey),s(e=>e+1),l(null))}),[n]);let u=(0,N.useCallback)(()=>{try{sessionStorage.removeItem(xe)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,N.useCallback)(async(e,t)=>{let r=a.current,o=U(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await W(c);if(d===`session-missing`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),u(),c;if(d!==`session-not-registered`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:d}),c;let f=Se();if(!f||f===r)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=session-not-registered-no-fresh-key surface=${n} path=${e}`),l({message:`Your admin session was renewed in another tab. Click to reload.`,reason:`session-not-registered`}),c;i(f),a.current=f,s(e=>e+1),console.log(`[useAdminFetch] outcome=retry-after-rotation oldKey=${r.slice(0,8)} newKey=${f.slice(0,8)} surface=${n} path=${e}`);let p=U(e,f),m=await fetch(p,t);return m.status===401&&(console.warn(`[useAdminFetch] outcome=redirect-to-login reason=second-401-after-retry surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:`session-not-registered`})),m},[u,n]),cacheKey:r,sessionRefetchNonce:o,banner:c,reloadToLogin:u}}var we=`/api/admin/claude-sessions/events`,Te=`admin-session-list-view`,G=`admin-session-list-include-subagents`,Ee=`admin-session-list-include-background`;function De(e){return e===`active`||e===`archived`||e===`all`}function Oe(){let e={rows:[],view:`active`,includeBackground:!1,connected:!1},t=new Map,n=new Set,r=null,i=null,a=0,o=0,s=null,c=!1,l=!1;function u(){let n=[...t.values()].sort((e,t)=>t.updatedAt===e.updatedAt?e.sessionId<t.sessionId?-1:1:t.updatedAt-e.updatedAt);e={...e,rows:n}}function d(){for(let e of n)e()}function f(e,n){if(e===`row-removed`){let e=n?.sessionId;if(typeof e!=`string`||!t.delete(e))return;u(),d();return}let r=n;if(typeof r.sessionId!=`string`)return;let i={sessionId:r.sessionId,live:r.live===!0,status:r.status===`busy`?`busy`:r.status===`idle`?`idle`:r.status===`detached`?`detached`:`gone`,agentLabel:typeof r.agentLabel==`string`&&r.agentLabel.length>0?r.agentLabel:null,cwd:typeof r.cwd==`string`?r.cwd:null,firstPrompt:typeof r.firstPrompt==`string`&&r.firstPrompt.length>0?r.firstPrompt:null,titleSource:r.titleSource===`user`||r.titleSource===`ai`?r.titleSource:null,updatedAt:typeof r.updatedAt==`number`?r.updatedAt:0,url:typeof r.url==`string`&&r.url.length>0?r.url:null,archived:r.archived===!0};t.set(i.sessionId,i),u(),d()}function p(t){if(r&&s===t||(r&&=(r.close(),null),!t))return;s=t,c=!1,l=!1;let n=U(we,t);try{r=new EventSource(n)}catch(e){console.error(`[admin-ui] session-row-store EventSource construct failed:`,e),h(`auto`);return}r.addEventListener(`open`,()=>{c=!0,a=0,e={...e,connected:!0},d(),console.info(`[admin-ui] session-row-store connected events-received=${o}`)});for(let e of[`row-created`,`row-updated`,`row-archived`,`row-removed`])r.addEventListener(e,t=>{o+=1;try{f(e,JSON.parse(t.data))}catch(t){console.error(`[admin-ui] session-row-store parse failed kind=${e}:`,t)}});r.addEventListener(`error`,()=>{r&&=(r.close(),null),e={...e,connected:!1},d(),!c&&!l&&(l=!0,m(n)),h(`auto`)})}async function m(e){let t=a+1,n=0,r=`unknown`;try{let t=await fetch(e,{method:`GET`});n=t.status,r=t.status>=400&&t.status<500?await W(t):`unknown`}catch(e){console.error(`[admin-ui] session-row-store sse-error-probe-failed:`,e);return}console.error(`[admin-ui] session-row-store sse-error status=${n} code=${r} attempt=${t}`)}function h(e){if(i)return;a+=1;let t=Math.min(1e3*2**Math.min(a,5),3e4);console.info(`[admin-ui] session-row-store reconnect trigger=${e} attempt=${a} delay-ms=${t}`),i=setTimeout(()=>{i=null,s&&p(s)},t)}function g(){i&&=(clearTimeout(i),null),a=0,r&&=(r.close(),null),console.info(`[admin-ui] session-row-store reconnect trigger=manual attempt=0 delay-ms=0`),s&&p(s)}function _(){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(Te);De(t)&&(e={...e,view:t});let n=window.localStorage.getItem(G);if(n===null){let e=window.localStorage.getItem(Ee);e!==null&&(window.localStorage.setItem(G,e),window.localStorage.removeItem(Ee),n=e,console.info(`[admin-ui] session-list-storage-migrated from=${Ee} to=${G} value=${e}`))}n===`1`&&(e={...e,includeBackground:!0})}catch{}}function v(t){e={...e,view:t};try{window.localStorage.setItem(Te,t)}catch{}d()}function y(t){e={...e,includeBackground:t};try{window.localStorage.setItem(G,t?`1`:`0`)}catch{}d()}function b(e){return n.add(e),()=>{n.delete(e)}}function x(){return e}function S(){r&&=(r.close(),null),i&&=(clearTimeout(i),null),s=null,e={...e,connected:!1}}function C(e,t){f(e,t)}function w(t){e={...e,connected:t},d()}function T(){t.clear(),u(),d()}function E(e){let n=new Set(e),r=0;for(let e of[...t.keys()])n.has(e)||(t.delete(e),r+=1);r!==0&&(console.info(`[admin-ui] session-row-store reconcile evicted=${r} kept=${t.size}`),u(),d())}return _(),{subscribe:b,getSnapshot:x,connect:p,disconnect:S,setView:v,setIncludeBackground:y,reconnectNow:g,reconcileFromList:E,_injectEventForTesting:C,_setConnectedForTesting:w,_clearRowsForTesting:T}}var K=Oe();K._injectEventForTesting,K.connect,K._setConnectedForTesting,K.getSnapshot,K.reconcileFromList;function ke(e){let t=(0,N.useSyncExternalStore)(K.subscribe,K.getSnapshot,K.getSnapshot);(0,N.useEffect)(()=>{e&&K.connect(e)},[e]);let n=(0,N.useCallback)(e=>K.setView(e),[]),r=(0,N.useCallback)(e=>K.setIncludeBackground(e),[]),i=(0,N.useCallback)(()=>K.reconnectNow(),[]),a=(0,N.useCallback)(e=>K.reconcileFromList(e),[]);return{rows:t.rows,view:t.view,includeBackground:t.includeBackground,connected:t.connected,setView:n,setIncludeBackground:r,reconnectNow:i,reconcileFromList:a}}function Ae(e,t,n){return e.filter(e=>!(t===`active`&&e.archived||t===`archived`&&!e.archived||!n&&e.agentLabel!==null&&e.agentLabel!==`admin`))}var q=6e4,J=60*q,je=24*J,Me=q,Ne=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Pe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Fe(e){return e<10?`0${e}`:String(e)}function Ie(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Le(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-Me)return`—`;let r=n<0?0:n;if(r<q)return`just now`;if(r<J)return`${Math.floor(r/q)}m`;if(r<je)return`${Math.floor(r/J)}h`;let i=new Date(t),a=new Date(e),o=Math.round((Ie(i)-Ie(a))/je);if(o===1)return`yesterday`;if(o>=2&&o<=6)return Pe[a.getDay()];let s=Fe(a.getDate()),c=Ne[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}function Re(e=3e4){let[t,n]=(0,N.useState)(()=>Date.now());return(0,N.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var ze={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Y=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],X=`Plan does not include auto mode`,Be=[{value:void 0,label:`Default`},{value:`claude-opus-4-7`,label:`Opus 4.7`},{value:`claude-sonnet-4-6`,label:`Sonnet 4.6`},{value:`claude-haiku-4-5`,label:`Haiku 4.5`}];function Ve({seedMode:e,seedModel:n,submitting:r,error:i,onSubmit:a,onCancel:s,onErrorClear:c}){let[l,u]=(0,N.useState)(``),[f,p]=(0,N.useState)(e),[m,h]=(0,N.useState)(n),[g,_]=(0,N.useState)(!1),[v,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(null),C=(0,N.useRef)(null),T=(0,N.useRef)(null),E=(0,N.useRef)(null);(0,N.useEffect)(()=>{C.current?.focus()},[]),(0,N.useEffect)(()=>{let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/claude-capabilities`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;S(r.autoModeAvailable),console.info(`[admin-ui] capability-fetch ok=true autoModeAvailable=${r.autoModeAvailable} seatTier=${r.seatTier??`null`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] capability-fetch ok=false reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[]);let D=(0,N.useMemo)(()=>e=>e===`auto`&&x===!1,[x]);(0,N.useEffect)(()=>{function e(e){if(e.key===`Escape`){if(g){_(!1),e.stopPropagation();return}if(v){b(!1),e.stopPropagation();return}s(`esc`)}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[g,v,s]),(0,N.useEffect)(()=>{if(!g&&!v)return;function e(e){g&&T.current&&!T.current.contains(e.target)&&_(!1),v&&E.current&&!E.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[g,v]);let O=l.trim(),ee=O.length>0&&!r,k=(0,N.useCallback)(()=>{if(O.length===0||r)return;let e=window.open(`about:blank`,`_blank`);console.info(`[admin-ui] new-session-modal-placeholder-open outcome=${e===null?`blocked`:`ok`}`),a({message:l,permissionMode:f,model:m,placeholder:e})},[l,f,m,O,r,a]);function te(e){e.preventDefault(),k()}let A=Be.find(e=>e.value===m)?.label??`Default`;return(0,P.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-modal-title`,className:`new-session-modal-overlay`,onClick:e=>{e.target===e.currentTarget&&s(`backdrop`)},children:(0,P.jsxs)(`div`,{className:`new-session-modal`,children:[(0,P.jsx)(`h2`,{id:`new-session-modal-title`,className:`new-session-modal-title`,children:`New session`}),(0,P.jsxs)(`form`,{className:`new-session-modal-form`,onSubmit:te,children:[(0,P.jsx)(`div`,{className:`chat-form`,children:(0,P.jsx)(d,{ref:C,value:l,onChange:e=>{u(e),i&&c()},placeholder:`What should this session do?`,disabled:r})}),i&&(0,P.jsx)(`div`,{className:`tunnel-route__error`,role:`alert`,children:i}),(0,P.jsxs)(`div`,{className:`new-session-modal-actions`,children:[(0,P.jsxs)(`div`,{className:`new-session-modal-pickers`,children:[(0,P.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:T,children:[(0,P.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!g;console.info(`[admin-ui] new-session-modal-mode-picker action=${e?`open`:`close`} current=${f}`),_(e)},disabled:r,"aria-haspopup":`menu`,"aria-expanded":g,"aria-label":`Permission mode for this session`,children:[ze[f],(0,P.jsx)(o,{size:12,"aria-hidden":`true`})]}),g&&(0,P.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,P.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,P.jsx)(`span`,{children:`Mode`})}),Y.map((e,n)=>{let r=D(e);return(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,disabled:r,title:r?X:void 0,"aria-disabled":r||void 0,onClick:()=>{r||(console.info(`[admin-ui] new-session-modal-mode-change from=${f} to=${e} trigger=click`),p(e),_(!1))},children:[(0,P.jsx)(`span`,{children:ze[e]}),(0,P.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===f&&(0,P.jsx)(t,{size:12}),(0,P.jsx)(`span`,{children:n+1})]})]},e)})]})]}),(0,P.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:E,children:[(0,P.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!v;console.info(`[admin-ui] new-session-modal-model-picker action=${e?`open`:`close`} current=${m??`default`}`),b(e)},disabled:r,"aria-haspopup":`menu`,"aria-expanded":v,"aria-label":`Model for this session`,children:[A,(0,P.jsx)(o,{size:12,"aria-hidden":`true`})]}),v&&(0,P.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Model`,children:[(0,P.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,P.jsx)(`span`,{children:`Model`})}),Be.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] new-session-modal-model-change from=${m??`default`} to=${e.value??`default`} trigger=click`),h(e.value),b(!1)},children:[(0,P.jsx)(`span`,{children:e.label}),(0,P.jsx)(`span`,{className:`side-mode-popover-shortcut`,children:e.value===m&&(0,P.jsx)(t,{size:12})})]},e.label))]})]})]}),(0,P.jsxs)(`div`,{className:`new-session-modal-buttons`,children:[(0,P.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:()=>s(`button`),disabled:r,children:`Cancel`}),(0,P.jsx)(`button`,{type:`submit`,className:`new-session-modal-submit`,disabled:!ee,"aria-label":`Send`,children:r?(0,P.jsx)(w,{size:14,className:`spinning`}):(0,P.jsx)(y,{size:14})})]})]})]})]})})}var He=1e4,Ue=(0,N.forwardRef)(function(e,r){let{businessName:i,cacheKey:c,role:u,userName:d,userAvatar:f,sessions:p,sessionsLoading:m,sessionsError:y,ensureSessionsLoaded:b,refetchSessions:S,onSelectArtefact:T,onSelectProjects:E,onSelectPeople:D,onSelectTasks:O,onSelectAgents:ee,onCloseMobileDrawer:j,onSelectSession:ne,selectedSessionId:M,collapsed:oe,mobileDrawerOpen:se,recentsActions:F}=e,[I,L]=(0,N.useState)(null),[ce,le]=(0,N.useState)(null),[ue,R]=(0,N.useState)(!1);(0,N.useEffect)(()=>{b()},[b]);let fe=(0,N.useRef)(null),[z,pe]=(0,N.useState)(!1),[B,V]=(0,N.useState)(`default`),[he,_e]=(0,N.useState)(void 0),ve=(0,N.useRef)(null),[ye,H]=(0,N.useState)(null),[be,xe]=(0,N.useState)(!1),U=(0,N.useRef)(0),W=(0,N.useRef)(new Map),Se=n.productName,Ce=typeof d==`string`?d:d===null?`name unavailable`:i||Se,we=(Ce.trim().charAt(0)||`?`).toUpperCase(),Te=ge(n.hostname),G=ke(c),Ee=(0,N.useMemo)(()=>{let e=Ae(G.rows,G.view,G.includeBackground);if(Te.pinned.size===0)return e;let t=[],n=[];for(let r of e)(Te.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[G.rows,G.view,G.includeBackground,Te.pinned]),De=Ee.length,Oe=Re(3e4);(0,N.useEffect)(()=>{if(W.current.size!==0)for(let e of G.rows){let t=W.current.get(e.sessionId);if(!t||e.url===null)continue;W.current.delete(e.sessionId),clearTimeout(t.timeoutId);let n=e.sessionId.slice(0,8);if(t.placeholder.closed){console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${n}`);continue}t.placeholder.location.href=e.url,console.info(`[admin-ui] new-session-auto-open outcome=ok sessionId=${n}`)}},[G.rows]),(0,N.useEffect)(()=>{let e=W.current;return()=>{for(let{timeoutId:t}of e.values())clearTimeout(t);e.clear()}},[]);let[K,q]=(0,N.useState)(`chat`),[J,je]=(0,N.useState)([]),[Me,Ne]=(0,N.useState)(!1),[Pe,Fe]=(0,N.useState)(null),[Ie,ze]=(0,N.useState)(!1);(0,N.useImperativeHandle)(r,()=>({patchArtefact(e,t){je(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[Y,X]=(0,N.useState)(!1),Be=(0,N.useRef)(null),Ue={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},We=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`];(0,N.useEffect)(()=>{if(!c)return;let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(c)}`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;let i=r.permissionMode,a=r.model??void 0;V(i),_e(a),ve.current={permissionMode:i,model:a},console.info(`[admin-ui] session-defaults-hydrate permissionMode=${i} model=${a??`default`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] session-defaults-hydrate-failed reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[c]);let Ke=(0,N.useCallback)(async(e,t)=>{if(!c||!ve.current)return;let n=ve.current,r=Date.now();console.info(`[admin-ui] session-defaults-put from={mode:${n.permissionMode},model:${n.model??`default`}} to={mode:${e.permissionMode},model:${e.model??`default`}} trigger=${t}`);try{let t=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(c)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({permissionMode:e.permissionMode,model:e.model??null})});if(!t.ok)throw Error(`status ${t.status}`);ve.current=e,console.info(`[admin-ui] session-defaults-put-ok ms=${Date.now()-r}`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] session-defaults-put-failed reason="${t}" ms=${Date.now()-r}`),V(n.permissionMode),_e(n.model)}},[c]);(0,N.useEffect)(()=>{if(!Y)return;function e(e){Be.current&&!Be.current.contains(e.target)&&(console.info(`[admin-ui] sidebar-mode-picker action=close mode=${B}`),X(!1))}function t(e){if(e.key===`Escape`){console.info(`[admin-ui] sidebar-mode-picker action=close mode=${B}`),X(!1);return}let t=[`1`,`2`,`3`,`4`,`5`].indexOf(e.key);if(t>=0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let n=We[t];n&&(e.preventDefault(),console.info(`[admin-ui] sidebar-mode-picker action=select mode=${n} via=shortcut`),V(n),X(!1),Ke({permissionMode:n,model:he},`sidebar`))}}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[Y,B,he,Ke]),(0,N.useEffect)(()=>{function e(e){e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.key===`m`||e.key===`M`)&&(e.preventDefault(),X(e=>{let t=!e;return console.info(`[admin-ui] sidebar-mode-picker action=${t?`open`:`close`} mode=${B} via=shortcut`),t}))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[B]);let Xe=(0,N.useCallback)(async()=>{if(c){ze(!0),Fe(null);try{let e=await fetch(`/api/admin/sidebar-artefacts?session_key=${encodeURIComponent(c)}`);if(!e.ok)throw Error(`status ${e.status}`);je((await e.json()).artefacts??[]),Ne(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Fe(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{ze(!1)}}},[c]),Ze=()=>{q(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${De}`)},Qe=()=>{q(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Me?J.length:0} collapsed=${oe}`),Me||Xe()},Z=1.5,$e=K===`chat`?`Sessions`:`Artefacts`,et=K===`chat`?m?`…`:String(De):Ie?`…`:String(J.length),tt=K===`chat`?m:Ie,nt=()=>{console.info(`[admin-ui] sidebar-refresh surface=${K}`),K===`chat`?S().then(e=>{e!==null&&G.reconcileFromList(e.map(e=>e.sessionId))}):Xe()},rt=(0,N.useCallback)(()=>{if(z||!c){console.info(`[admin-ui] sidebar-new-session-click-ignored startingSession=${z} cacheKey=${c?`set`:`missing`}`);return}H(null),U.current=Date.now(),console.info(`[admin-ui] sidebar-new-session-modal-open seedMode=${B} cacheKey-prefix=${c.slice(0,8)}`),xe(!0)},[c,z,B]),it=(0,N.useCallback)(e=>{let t=U.current?Date.now()-U.current:0;console.info(`[admin-ui] sidebar-new-session-modal-cancel reason=${e} dwell-ms=${t}`),H(null),xe(!1)},[]),at=(0,N.useCallback)(async e=>{if(z||!c)return;let t=U.current?Date.now()-U.current:0,n=Date.now();console.info(`[admin-ui] sidebar-new-session-modal-submit permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length} dwell-ms=${t}`),pe(!0),H(null);try{console.info(`[admin-ui] sidebar-new-session-fetch-start permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length}`);let t={channel:`browser`,permissionMode:e.permissionMode,initialMessage:e.message};e.model!==void 0&&(t.model=e.model);let r=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(c)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),i=Date.now()-n;console.info(`[admin-ui] sidebar-new-session-fetch-done status=${r.status} ok=${r.ok} ms=${i}`);let a=await r.json();if(!r.ok||!(`sessionId`in a)){let e=a,t=e.error??`POST returned ${r.status}`,i=e.reason?`${t}: ${e.reason}`:t;console.error(`[admin-ui] sidebar-new-session-failed status=${r.status} ms=${Date.now()-n} error=${t} reason=${e.reason??`none`} tail=${JSON.stringify(e.stderrTail??``)}`),H(i);return}console.info(`[admin-ui] sidebar-new-session-ok pid=${a.pid} sessionId=${a.sessionId.slice(0,8)} permissionMode=${e.permissionMode} model=${e.model??`default`} ms=${Date.now()-n}`),F.setSessions(e=>[a,...e]),xe(!1);let o=a.sessionId,s=o.slice(0,8);if(e.placeholder===null)console.info(`[admin-ui] new-session-auto-open outcome=fallback sessionId=${s}`),ne(o);else{let t=setTimeout(()=>{let e=W.current.get(o);e&&(W.current.delete(o),e.placeholder.closed||e.placeholder.close(),console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${s}`))},He);W.current.set(o,{placeholder:e.placeholder,timeoutId:t})}}catch(e){let t=e instanceof Error?e.message:String(e);H(t),console.error(`[admin-ui] sidebar-new-session-threw ms=${Date.now()-n} message=${t}`)}finally{pe(!1)}},[c,z,F,ne]),Q=me(c,F,`sidebar`),ot=(0,N.useCallback)(async e=>{let t=await Q.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[Q]),st=(0,N.useCallback)(async e=>{R(!0),le(null);let t=await Q.purge(e);t.ok?L(null):le(t.error??`purge failed`),R(!1)},[Q]),ct=(0,N.useCallback)(async e=>{let t=await Q.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[Q]),lt=(0,N.useCallback)(async e=>{let t=await Q.archive(e);t.ok||console.error(`[admin-ui] sidebar-archive failed: ${t.error}`)},[Q]),ut=(0,N.useCallback)(async e=>{let t=await Q.unarchive(e);t.ok||console.error(`[admin-ui] sidebar-unarchive failed: ${t.error}`)},[Q]),[dt,$]=(0,N.useState)(null),[ft,pt]=(0,N.useState)(``),mt=(0,N.useCallback)(async(e,t)=>{let n=ft.trim();if(n.length===0||!de(n)){$(null);return}if(n===(t??``)){$(null);return}let r=await Q.rename(e,n);r.ok||console.error(`[admin-ui] sidebar-rename failed: ${r.error}`),$(null)},[ft,Q]),ht=(0,N.useCallback)(()=>{$(null)},[]);return(0,P.jsxs)(`aside`,{className:`side`,children:[K===`chat`&&(0,P.jsxs)(`div`,{className:`side-new-session-row`,ref:Be,children:[(0,P.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:rt,disabled:z||!c,children:[z?(0,P.jsx)(w,{size:14,className:`spinning`}):(0,P.jsx)(te,{size:14}),(0,P.jsx)(`span`,{children:`New session`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!Y;console.info(`[admin-ui] sidebar-mode-picker action=${e?`open`:`close`} mode=${B}`),X(e)},disabled:z,"aria-haspopup":`menu`,"aria-expanded":Y,"aria-label":`Permission mode for the next session`,title:`Shift+Cmd+M`,children:[Ue[B],(0,P.jsx)(o,{size:12,"aria-hidden":`true`})]}),Y&&(0,P.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,P.jsxs)(`div`,{className:`side-mode-popover-head`,children:[(0,P.jsx)(`span`,{children:`Mode`}),(0,P.jsx)(`span`,{className:`side-mode-popover-shortcut`,"aria-hidden":`true`,children:`⇧⌘M`})]}),We.map((e,n)=>(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] sidebar-mode-picker action=select mode=${e}`),V(e),X(!1),Ke({permissionMode:e,model:he},`sidebar`)},children:[(0,P.jsx)(`span`,{children:Ue[e]}),(0,P.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===B&&(0,P.jsx)(t,{size:12}),(0,P.jsx)(`span`,{children:n+1})]})]},e))]})]}),(0,P.jsxs)(`nav`,{className:`side-nav`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`nav-row${K===`chat`?` active`:``}`,onClick:Ze,children:[(0,P.jsx)(ie,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),D(),j()},children:[(0,P.jsx)(ae,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`People`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),ee(),j()},children:[(0,P.jsx)(_,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Agents`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),E(),j()},children:[(0,P.jsx)(v,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Projects`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),O(),j()},children:[(0,P.jsx)(C,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row${K===`artefacts`?` active`:``}`,onClick:Qe,children:[(0,P.jsx)(s,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,P.jsx)(`span`,{className:`kbd`})]})]}),(0,P.jsxs)(`div`,{className:`side-list`,ref:fe,children:[(0,P.jsxs)(`div`,{className:`group-head`,children:[(0,P.jsx)(`span`,{children:$e}),(0,P.jsxs)(`span`,{className:`group-head-meta`,children:[(0,P.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${$e.toLowerCase()}`,"aria-label":`Refresh ${$e.toLowerCase()}`,onClick:nt,disabled:tt,children:(0,P.jsx)(A,{size:12,className:tt?`spinning`:void 0})}),(0,P.jsx)(`span`,{children:et})]})]}),K===`chat`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(qe,{view:G.view,setView:e=>{console.info(`[admin-ui] sidebar-view-change view=${e}`),G.setView(e)},connected:G.connected,reconnectNow:G.reconnectNow}),y&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:y}),Ee.map(e=>{let t=M===e.sessionId,n=dt===e.sessionId;return(0,P.jsxs)(`div`,{className:`conv${t?` active`:``}`,children:[n?(0,P.jsxs)(`span`,{className:`conv-name-line`,style:{flex:1,minWidth:0},children:[(0,P.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,P.jsx)(Je,{live:e.live,status:e.status}),(0,P.jsx)(`input`,{type:`text`,value:ft,autoFocus:!0,maxLength:200,onChange:e=>pt(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),mt(e.sessionId,e.firstPrompt)):t.key===`Escape`&&(t.preventDefault(),ht())},onBlur:()=>{mt(e.sessionId,e.firstPrompt)},className:`conv-name`,"aria-label":`Rename session`,style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`inherit`,font:`inherit`}})]}):(0,P.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{ne(e.sessionId),j()},title:`Show metadata`,children:[(0,P.jsxs)(`span`,{className:`conv-name-line`,children:[(0,P.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,P.jsx)(Je,{live:e.live,status:e.status}),e.firstPrompt?(0,P.jsx)(`span`,{className:`conv-name`,children:e.firstPrompt}):(0,P.jsxs)(`span`,{className:`conv-name`,style:{fontStyle:`italic`,opacity:.6},children:[`(unnamed · `,e.sessionId.slice(0,8),`)`]})]}),(0,P.jsx)(`span`,{className:`conv-timestamp`,children:Le(e.updatedAt,Oe)})]}),!n&&(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Rename`,"aria-label":`Rename session`,onClick:()=>{pt(e.firstPrompt??``),$(e.sessionId)},children:(0,P.jsx)(k,{size:13})}),e.url!==null&&(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>Ye(e.url,e.sessionId),children:(0,P.jsx)(x,{size:13})}),e.live?(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void ct(e.sessionId),disabled:Q.inFlight===`end`,children:Q.inFlight===`end`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(re,{size:13})}):e.archived?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Unarchive session`,"aria-label":`Unarchive session`,onClick:()=>void ut(e.sessionId),disabled:Q.inFlight===`unarchive`,children:Q.inFlight===`unarchive`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(h,{size:13})}),(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{le(null),L({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,P.jsx)(a,{size:13})})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void ot(e.sessionId),disabled:Q.inFlight===`resume`,children:Q.inFlight===`resume`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(l,{size:13})}),(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Archive session`,"aria-label":`Archive session`,onClick:()=>void lt(e.sessionId),disabled:Q.inFlight===`archive`,children:Q.inFlight===`archive`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(g,{size:13})}),(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{le(null),L({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,P.jsx)(a,{size:13})})]})]},e.sessionId)})]}),K===`artefacts`&&(0,P.jsxs)(P.Fragment,{children:[Pe&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Pe}),Me&&!Pe&&J.length===0&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),J.map(e=>(0,P.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>{T({docId:e.id,name:e.name,content:e.content,editable:e.editable,mimeType:e.mimeType,skipReason:e.skipReason},`sidebar-artefacts`),j()},children:[(0,P.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,P.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,P.jsx)(Ge,{}),(0,P.jsxs)(`div`,{className:`side-foot`,children:[(0,P.jsx)(`div`,{className:`avatar`,children:f?(0,P.jsx)(`img`,{src:f,alt:Ce}):we}),(0,P.jsxs)(`div`,{className:`who`,children:[(0,P.jsx)(`span`,{className:`name`,children:Ce}),(0,P.jsx)(`span`,{className:`role`,children:u??`operator`})]})]}),be&&(0,P.jsx)(Ve,{seedMode:B,seedModel:he,submitting:z,error:ye,onSubmit:e=>void at(e),onCancel:it,onErrorClear:()=>H(null)}),I&&(0,P.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!ue&&L(null)},children:(0,P.jsxs)(`div`,{className:`modal-card`,children:[(0,P.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,P.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript for `,(0,P.jsx)(`strong`,{children:I.displayName??I.sessionId.slice(0,8)}),`. The action cannot be undone.`]}),ce&&(0,P.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:ce}),(0,P.jsxs)(`div`,{className:`modal-action-row`,children:[(0,P.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:ue,onClick:()=>L(null),children:`Cancel`}),(0,P.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:ue,onClick:()=>void st(I.sessionId),children:ue?(0,P.jsx)(w,{size:13,className:`spinning`}):`Purge`})]})]})})]})}),We=5e3;function Ge(){let[e,t]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},We))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=Math.max(n??0,r??0),f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,P.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,P.jsxs)(`div`,{className:`system-stats__row`,children:[(0,P.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,P.jsx)(`span`,{className:`system-stats__sep`,children:`·`}),(0,P.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]})]}),(0,P.jsx)(`div`,{className:`system-stats__bar`,children:(0,P.jsx)(`div`,{className:`system-stats__bar-fill`,style:{width:`${Math.round(d*100)}%`}})})]})}var Ke=[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`all`,label:`All`}];function qe(e){let{view:t,setView:n,connected:r,reconnectNow:i}=e;return(0,P.jsx)(`div`,{className:`session-view-controls`,children:(0,P.jsxs)(`div`,{className:`session-view-segmented`,role:`tablist`,"aria-label":`Session view`,children:[Ke.map(e=>(0,P.jsx)(`button`,{type:`button`,role:`tab`,className:`session-view-tab${t===e.value?` active`:``}`,"aria-selected":t===e.value,onClick:()=>n(e.value),children:e.label},e.value)),r?(0,P.jsx)(`span`,{className:`session-view-connection connected`,"aria-label":`Live updates connected.`,title:`Live updates connected.`}):(0,P.jsx)(`button`,{type:`button`,className:`session-view-connection disconnected`,"aria-label":`Live updates paused. Click to retry.`,title:`Live updates paused. Click to retry.`,onClick:i})]})})}function Je({live:e,status:t}){return e?t===`busy`?(0,P.jsxs)(`span`,{className:`session-status session-status-busy`,"aria-label":`session busy`,children:[(0,P.jsx)(`span`,{className:`session-status-dot`}),(0,P.jsx)(`span`,{className:`session-status-dot`}),(0,P.jsx)(`span`,{className:`session-status-dot`})]}):t===`detached`?(0,P.jsx)(`span`,{className:`session-status session-status-detached`,"aria-label":`session detached — manager restart survivor`}):(0,P.jsx)(`span`,{className:`session-status session-status-idle`,"aria-label":`session idle`}):(0,P.jsx)(`span`,{className:`session-status session-status-archived`,"aria-label":`session archived`})}function Ye(e,t){let n=t.slice(0,8),r=window.open(e,`_blank`,`noopener,noreferrer`)===null?`blocked`:`ok`;console.info(`[admin-ui] sidebar-open-in-new-tab outcome=${r} sessionId=${n}`)}function Xe(){(0,N.useEffect)(()=>{function e(e){e.data?.type===`vnc-clipboard`&&typeof e.data.text==`string`&&u(e.data.text)}window.addEventListener(`message`,e);let t=null;return typeof BroadcastChannel<`u`&&(t=new BroadcastChannel(`maxy-vnc-clipboard`),t.onmessage=e=>{typeof e.data==`string`&&u(e.data)}),()=>{window.removeEventListener(`message`,e),t?.close()}},[])}function Ze({handlePopout:e,disabled:t=!1}){let n=(0,N.useCallback)(()=>{delete document.body.dataset.dragPopoutActive},[]);(0,N.useEffect)(()=>()=>n(),[n]);let r=(0,N.useCallback)(e=>{if(t){e.preventDefault();return}let n=e.target;if(n.closest(`.editor-base__actions`)||n.closest(`.browser-viewer__actions`)){e.preventDefault();return}if(!document.querySelector(`.chat-messages`)){e.preventDefault();return}e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,``),document.body.dataset.dragPopoutActive=`true`},[t,n]),i=(0,N.useCallback)(t=>{if(n(),t.clientX===0&&t.clientY===0)return;let r=document.querySelector(`.chat-messages`);if(!r)return;let i=r.getBoundingClientRect();(t.clientX<i.left||t.clientX>i.right||t.clientY<i.top||t.clientY>i.bottom)&&e()},[e,n]);return t?{draggable:!1,onDragStart:()=>{},onDragEnd:()=>{}}:{draggable:!0,onDragStart:r,onDragEnd:i}}function Qe(e){(0,N.useEffect)(()=>{let t=Date.now(),r=`/api/admin/browser-iframe/event`,i={brand:n.productName,surface:e};return fetch(r,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:`mount`,...i}),keepalive:!0}).catch(()=>{}),()=>{let e=JSON.stringify({event:`unmount`,durationMs:Date.now()-t,...i});try{let t=new Blob([e],{type:`application/json`});navigator.sendBeacon(r,t)||fetch(r,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:e,keepalive:!0}).catch(()=>{})}catch{}}},[e])}var Z=`maxy-vnc-overlay-popout`;function $e(e){let[t,r]=(0,N.useState)(!1),i=(0,N.useRef)(null),a=(0,N.useRef)(null),o=(0,N.useCallback)(()=>{a.current&&=(clearInterval(a.current),null),i.current&&!i.current.closed&&i.current.close(),i.current=null,r(!1)},[]),s=(0,N.useCallback)(()=>{let t=`/vnc-popout.html?title=${encodeURIComponent(n.productName)}`,s=window.open(t,Z,`width=1024,height=768`);s&&(i.current=s,r(!0),a.current=setInterval(()=>{i.current?.closed&&(o(),e?.())},500))},[o,e]);return(0,N.useEffect)(()=>()=>o(),[o]),{poppedOut:t,popout:s,cleanupPopout:o}}var et=(0,N.forwardRef)(function({onClose:e},t){Xe(),Qe(`overlay`);let{poppedOut:r,popout:i,cleanupPopout:a}=$e(e);return(0,N.useImperativeHandle)(t,()=>({popout:i}),[i]),r?(0,P.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,P.jsx)(c,{className:`browser-viewer__icon`}),(0,P.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,P.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>a(),"aria-label":`Pop back in`}),e&&(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:M,onClick:()=>{a(),e()},"aria-label":`Close`})]}):(0,P.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-surface__iframe`,title:n.productName})});function tt({onClose:e}){Xe(),Qe(`overlay`);let{poppedOut:t,popout:r,cleanupPopout:i}=$e(e),a=(0,N.useCallback)(()=>{i(),e()},[i,e]);(0,N.useEffect)(()=>{if(t)return;let e=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,a]);let o=Ze({handlePopout:r,disabled:t});return t?(0,P.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,P.jsx)(c,{className:`browser-viewer__icon`}),(0,P.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,P.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>{i()},"aria-label":`Pop back in`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:M,onClick:a,"aria-label":`Close`})]}):(0,P.jsxs)(`div`,{className:`browser-viewer-fullscreen`,children:[(0,P.jsxs)(`div`,{className:`browser-viewer-fullscreen__bar`,...o,children:[(0,P.jsx)(c,{className:`browser-viewer__icon`}),(0,P.jsx)(`span`,{className:`browser-viewer-fullscreen__title`,children:n.productName}),(0,P.jsxs)(`div`,{className:`browser-viewer-fullscreen__actions`,children:[(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:x,onClick:r,"aria-label":`Pop out`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:M,onClick:a,"aria-label":`Close`})]})]}),(0,P.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-viewer-fullscreen__iframe`,title:n.productName})]})}function nt(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function rt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2]||r[3]!==i[3])return!1}return!0}function it(e){let[t,n]=(0,N.useState)([]),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(null),l=(0,N.useRef)([]),u=(0,N.useCallback)(async t=>{if(!e||!t&&s===e)return null;i(!0),o(null);try{let t=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`claude-sessions fetch returned ${t.status}`);let r=await t.json(),i=Array.isArray(r)?r:r.sessions??[],a=nt(i),o=rt(l.current,a);return o||(n(i),l.current=a),c(e),console.info(`[admin-ui] sessions-poll outcome=${o?`unchanged`:`changed`} count=${i.length} cacheKey=${e.slice(0,8)}`),i}catch(t){return console.info(`[admin-ui] sessions-poll outcome=error count=0 cacheKey=${e.slice(0,8)}`),console.error(`[admin/claude-sessions] fetch failed:`,t),o(t instanceof Error?t.message:String(t)),null}finally{i(!1)}},[e,s]);(0,N.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,N.useCallback)(()=>u(!1),[u]),f=(0,N.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var at=`admin-sidebar-collapsed`,Q=`admin-sidebar-drawer-open`;function ot(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(at)===`1`}catch{return!1}}function st(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(at,`1`):window.sessionStorage.removeItem(at)}catch{}}function ct(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Q)===`1`}catch{return!1}}function lt(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Q,`1`):window.sessionStorage.removeItem(Q)}catch{}}var ut=720;function dt(e){let{cacheKey:t,businessName:n,onLaunchBrowser:r,onLogout:i,browserLaunching:a,userName:o,userAvatar:s,role:c,selectedSessionId:l,onSelectSession:u,onSelectArtefact:d,dataArtefact:f=`closed`,children:p,footer:m}=e,[h,g]=(0,N.useState)(()=>ot()),[_,v]=(0,N.useState)(()=>ct()),[y,b]=(0,N.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${ut}px)`).matches);(0,N.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${ut}px)`),t=e=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let x=(0,N.useCallback)(e=>{st(e),g(e)},[]),S=(0,N.useCallback)(e=>{lt(e),v(e)},[]);(0,N.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} collapsed=${h} drawer=${_}`)},[]);let C=y?_:!h,w=(0,N.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${ut}px)`).matches){let e=_;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),S(!e)}else{let e=h;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),x(!e)}},[h,_,x,S]),T=(0,N.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),[E,D]=(0,N.useState)(!1),[O,ee]=(0,N.useState)(!1),k=(0,N.useCallback)(async()=>{if(E)return;D(!0);let e=typeof window<`u`?window.location?.pathname??``:``,t=`n/a`;try{let n=await fetch(`/api/admin/browser/launch`,{method:`POST`});t=n.status;let r=await n.json().catch(()=>({ok:!1,error:`Invalid response`}));if(!r.ok)throw Error(r.error??`Failed to launch browser`);ee(!0),console.info(`[admin-ui] header-menu-browser-launch outcome=ok source=shell-overlay route=${e} httpStatus=${t}`)}catch(n){console.error(`[admin-ui] header-menu-browser-launch outcome=error source=shell-overlay route=${e} httpStatus=${t} error="${n instanceof Error?n.message:String(n)}"`),window.alert(n instanceof Error?n.message:`Failed to launch browser`)}finally{D(!1)}},[E]),te=a??E,A=it(t),j=ke(t),ne=(0,N.useMemo)(()=>j.rows.map(e=>e.sessionId),[j.rows]),re=(0,N.useCallback)(e=>{if(u){u(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[u]),ie=(0,N.useCallback)(e=>{d&&d(e)},[d]),ae={collapsed:h,mobileDrawerOpen:_,sidebarOpen:C,onToggleSidebar:w,setMobileDrawerOpen:S,sessionsState:A,sessionRowIds:ne,sessionRowsConnected:j.connected};return(0,P.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,P.jsx)(_e,{businessName:n,onLaunchBrowser:r??k,onNavigate:T,onToggleSidebar:w,sidebarOpen:C,onLogout:i,browserLaunching:te}),(0,P.jsxs)(`div`,{className:`platform${_?` menu-open`:``}${h?` sidebar-collapsed`:``}`,"data-artefact":f,children:[(0,P.jsx)(Ue,{businessName:n,cacheKey:t,role:c??null,userName:o,userAvatar:s??null,sessions:A.sessions,sessionsLoading:A.loading,sessionsError:A.error,ensureSessionsLoaded:A.ensureLoaded,refetchSessions:A.refetch,onSelectArtefact:ie,onSelectProjects:()=>{window.location.href=`/graph?label=Project`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>S(!1),onSelectSession:re,selectedSessionId:l??null,collapsed:h,mobileDrawerOpen:_,recentsActions:{setSessions:A.setSessions,refetch:A.refetch}}),typeof p==`function`?p(ae):p]}),_&&(0,P.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>S(!1)}),O&&(0,P.jsx)(tt,{onClose:()=>ee(!1)}),m]})}var $={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#82A06A`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`},ft=`#94A3B8`;Object.freeze(Object.keys($)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var pt=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.AdminConversation.PublicConversation.Task.Project.Event.Workflow.Email.EmailAccount.Agent`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));function mt(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call($,e[t]))return e[t];return e[0]??null}function ht(e){return $[e]??`#94A3B8`}function gt(e){let t=mt(e),n=t?ht(t):ft,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call($,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{x as C,h as E,w as S,g as T,j as _,dt as a,k as b,Ze as c,de as d,me as f,ne as g,re as h,gt as i,Ce as l,M as m,ht as n,tt as o,L as p,mt as r,et as s,pt as t,ge as u,A as v,b as w,D as x,te as y};
1
+ import{o as e}from"./chunk-DD-I1_y5.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,m as c,p as l,r as u,t as d,u as f,v as p,x as m}from"./ChatInput-DJsqm_Gf.js";var h=p(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),g=p(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),_=p(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),v=p(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),y=p(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),b=p(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),x=p(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),S=p(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),C=p(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),w=p(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),T=p(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),E=p(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),D=p(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),O=p(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),ee=p(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),k=p(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),te=p(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),A=p(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),j=p(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ne=p(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),re=p(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ie=p(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ae=p(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),M=p(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),N=e(m(),1),P=i(),oe=`maxy-shell-side-px`;function se(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function F(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-se());return Math.min(Math.max(e,248),n)}function I(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(oe);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return F(t)}catch{}return 264}function L({targetSelector:e=`.platform`}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(()=>I()),i=(0,N.useRef)(n);(0,N.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,N.useCallback)(()=>{r(e=>{let t=F(e);return t===e?e:t})},[]);(0,N.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(F(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(oe,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=F(264);r(e);try{window.localStorage.removeItem(oe)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,P.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var ce=!1;function le(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function ue(){let e=typeof crypto<`u`&&typeof crypto.randomUUID==`function`;if(!ce){ce=!0;let t=typeof window<`u`&&`isSecureContext`in window?window.isSecureContext:!1;console.info(`[idempotency] uuid-source=${e?`native`:`getRandomValues`} secureContext=${t}`)}return e?crypto.randomUUID():le()}function de(e){let t=e.trim();return t.length>=1&&t.length<=200}function R(e,t,n,r){let i=e===`pane`?`pane-action`:`sidebar-${t}`;console.info(`[admin-ui] ${i} sessionId=${n.slice(0,8)} action=${t} outcome=${r}`)}var fe=/session_([A-Za-z0-9_-]+)/;function z(e){if(!e)return null;let t=e.match(fe);return t?t[1]:null}async function pe(e,t,n,r,i){let a=z(r)??`unknown`,o=e=>e.slice(0,8),s=t===`pane`?`pane-action action=resume-archive`:`sidebar-resume-archive`,c;try{let t=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:`archive`})});c=t.ok?`ok`:t.status===409?`409`:`error`;let r=`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=${c}`;c===`error`?console.error(r):console.info(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=error detail=${t}`)}finally{i.refetch()}}function me(e,t,n=`pane`){let[r,i]=(0,N.useState)(null),a=(0,N.useRef)(!1),o=(0,N.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};if(a.current)return R(n,`resume`,r,`skipped-in-flight`),{ok:!1,error:`in-flight`};a.current=!0,i(`resume`);let o=ue();try{let i=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:r,channel:`browser`,idempotencyKey:o})}),a=await i.json();if(!i.ok||!(`sessionId`in a)){let e=a.error??`POST returned ${i.status}`;return R(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),R(n,`resume`,r,`200`),pe(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return R(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{a.current=!1,i(null)}},[e,t,n]),s=(0,N.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`end`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/stop?session_key=${encodeURIComponent(e)}`,{method:`POST`});if(!i.ok){let e=await i.text().catch(()=>``);return R(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`POST /stop ${i.status} ${e.slice(0,200)}`}}return R(n,`end`,r,`204`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return R(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),c=(0,N.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`purge`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}?purge=1&session_key=${encodeURIComponent(e)}`,{method:`DELETE`});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`DELETE ?purge=1 ${i.status}`;return R(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),R(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return R(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),l=(0,N.useCallback)(async(r,a)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(a);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:a})});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`POST /archive ${i.status}`;return R(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),R(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return R(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]);return{inFlight:r,resume:o,end:s,purge:c,archive:(0,N.useCallback)(e=>l(e,`archive`),[l]),unarchive:(0,N.useCallback)(e=>l(e,`unarchive`),[l]),rename:(0,N.useCallback)(async(t,r)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`rename`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(t)}/rename?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:r})});if(!i.ok){let e=await i.json().catch(()=>({})),r=e.detail||e.error||`POST /rename ${i.status}`;return R(n,`rename`,t,String(i.status)),{ok:!1,error:r,reason:e.reason}}return R(n,`rename`,t,`200`),{ok:!0}}catch(e){let r=e instanceof Error?e.message:String(e);return R(n,`rename`,t,`threw`),{ok:!1,error:r}}finally{i(null)}},[e,n])}}function B(e){return`code.session.pinned.${e}`}function V(e){if(typeof window>`u`)return new Set;try{let t=window.localStorage.getItem(B(e));if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function he(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(B(e),JSON.stringify([...t]))}catch{}}function ge(e){let[t,n]=(0,N.useState)(()=>V(e));(0,N.useEffect)(()=>{n(V(e))},[e]);let r=(0,N.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),he(e,r),r})},[e]);return{pinned:t,isPinned:(0,N.useCallback)(e=>t.has(e),[t]),togglePin:r}}function _e(e){let{businessName:i,onLaunchBrowser:o,onNavigate:s,onToggleSidebar:l,sidebarOpen:u,onLogout:d,browserLaunching:f}=e,[p,m]=(0,N.useState)(!1),h=(0,N.useRef)(null),g=(0,N.useRef)(null),[_,v]=(0,N.useState)(null),[y,C]=(0,N.useState)(!1),[D,k]=(0,N.useState)(null),[te,A]=(0,N.useState)(null),[j,re]=(0,N.useState)(null),[ie,ae]=(0,N.useState)(``);(0,N.useEffect)(()=>{ae(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,N.useEffect)(()=>{if(!p)return;let e=e=>{h.current&&!h.current.contains(e.target)&&m(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]),(0,N.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&m(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]),(0,N.useEffect)(()=>{p&&g.current?.focus()},[p]),(0,N.useEffect)(()=>{if(!p)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||re(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[p]);let oe=(0,N.useCallback)(()=>{m(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),se=(0,N.useCallback)(()=>{m(!1),o()},[o]),F=(0,N.useCallback)(e=>{m(!1),s(e)},[s]),I=(0,N.useCallback)(async()=>{if(_!==null){v(null),A(null);return}C(!0),k(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);v((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),k(e instanceof Error?e.message:String(e)),v([])}finally{C(!1)}},[_]),L=(0,N.useCallback)(e=>{A(null),v(t=>t?.filter(t=>t.slug!==e)??null),fetch(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[]),ce=(0,N.useCallback)(()=>{m(!1),d()},[d]),le=i||n.productName;return(0,P.jsxs)(`header`,{className:`admin-header`,children:[(0,P.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":u?`Hide sidebar`:`Show sidebar`,title:u?`Hide sidebar`:`Show sidebar`,"aria-expanded":u,onClick:l,children:u?(0,P.jsx)(O,{size:20,strokeWidth:1.5}):(0,P.jsx)(ee,{size:20,strokeWidth:1.5})}),(0,P.jsxs)(`div`,{className:`chat-header-label`,children:[(0,P.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,P.jsx)(`img`,{src:r,alt:``,className:`chat-logo`})}),(0,P.jsx)(`h1`,{className:`chat-tagline`,children:le})]}),(0,P.jsxs)(`div`,{className:`chat-burger-wrap`,ref:h,children:[(0,P.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:oe,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":p,children:(0,P.jsx)(E,{size:20})}),p&&(0,P.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,P.jsxs)(`button`,{ref:g,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:se,disabled:f,children:[(0,P.jsx)(c,{size:14}),` Browser`,f&&(0,P.jsx)(w,{size:12,className:`spin`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>F(`data`),children:[(0,P.jsx)(b,{size:14}),` Data`]}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>F(`graph`),children:[(0,P.jsx)(ne,{size:14}),` Graph`]}),(0,P.jsx)(`div`,{className:`chat-menu-divider`}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:I,children:[(0,P.jsx)(x,{size:14}),` Public`,y&&(0,P.jsx)(w,{size:12,className:`spin`})]}),_!==null&&(0,P.jsxs)(`div`,{className:`chat-menu-agents`,children:[D&&(0,P.jsx)(`span`,{className:`chat-menu-agent-error`,children:D}),_.length===0&&!D&&(0,P.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),_.map(e=>(0,P.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,P.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,P.jsxs)(`span`,{className:`agent-text`,children:[(0,P.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,P.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),te===e.slug?(0,P.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>L(e.slug),children:(0,P.jsx)(t,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>A(null),children:(0,P.jsx)(M,{size:12})})]}):(0,P.jsxs)(`span`,{className:`agent-actions`,children:[(0,P.jsx)(`a`,{href:`${ie}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>m(!1),children:(0,P.jsx)(x,{size:12})}),(0,P.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>A(e.slug),children:(0,P.jsx)(a,{size:12})})]})]},e.slug))]}),(0,P.jsx)(`div`,{className:`chat-menu-divider`}),(0,P.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,P.jsx)(S,{size:14}),(0,P.jsxs)(`span`,{className:`version-installed`,children:[j?`v${j.installed}`:`…`,j&&!j.updateAvailable&&(0,P.jsx)(`span`,{className:`version-uptodate-dot`}),j?.updateAvailable&&(0,P.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,P.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ce,children:[(0,P.jsx)(T,{size:14}),` Log out`]})]})]})]})}var ve=`maxy-admin-session`,ye=typeof BroadcastChannel<`u`;function H(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`rotation`&&typeof t.newKey==`string`&&t.newKey.length>0&&(t.surface===`chat`||t.surface===`graph`||t.surface===`data`||t.surface===`sessions`)&&typeof t.ts==`number`}function be(e){if(!ye)return()=>{};let t=new BroadcastChannel(ve),n=t=>{if(!H(t.data)){console.warn(`[admin-session-broadcast] outcome=received-malformed payload=${JSON.stringify(t.data)}`);return}e(t.data)};return t.addEventListener(`message`,n),()=>{t.removeEventListener(`message`,n),t.close()}}var xe=`maxy-admin-session-key`;function U(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function W(e){let t;try{t=await e.clone().json()}catch{return`parse-failed`}if(typeof t!=`object`||!t)return`unknown-401`;let n=t.code;return n===`session-missing`||n===`session-not-registered`||n===`session-expired-age`||n===`grant-expired`?n:`unknown-401`}function Se(){try{return sessionStorage.getItem(xe)}catch{return null}}function Ce(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,N.useState)(t),a=(0,N.useRef)(t);(0,N.useEffect)(()=>{a.current=r},[r]),(0,N.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,N.useState)(0),[c,l]=(0,N.useState)(null);(0,N.useEffect)(()=>be(e=>{let t=a.current.slice(0,8),r=e.newKey.slice(0,8);e.newKey!==a.current&&(console.log(`[admin-session-broadcast] outcome=received oldKey=${t} newKey=${r} surface=${n} senderSurface=${e.surface}`),i(e.newKey),s(e=>e+1),l(null))}),[n]);let u=(0,N.useCallback)(()=>{try{sessionStorage.removeItem(xe)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,N.useCallback)(async(e,t)=>{let r=a.current,o=U(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await W(c);if(d===`session-missing`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),u(),c;if(d!==`session-not-registered`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:d}),c;let f=Se();if(!f||f===r)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=session-not-registered-no-fresh-key surface=${n} path=${e}`),l({message:`Your admin session was renewed in another tab. Click to reload.`,reason:`session-not-registered`}),c;i(f),a.current=f,s(e=>e+1),console.log(`[useAdminFetch] outcome=retry-after-rotation oldKey=${r.slice(0,8)} newKey=${f.slice(0,8)} surface=${n} path=${e}`);let p=U(e,f),m=await fetch(p,t);return m.status===401&&(console.warn(`[useAdminFetch] outcome=redirect-to-login reason=second-401-after-retry surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:`session-not-registered`})),m},[u,n]),cacheKey:r,sessionRefetchNonce:o,banner:c,reloadToLogin:u}}var we=`/api/admin/claude-sessions/events`,Te=`admin-session-list-view`,G=`admin-session-list-include-subagents`,Ee=`admin-session-list-include-background`;function De(e){return e===`active`||e===`archived`||e===`all`}function Oe(){let e={rows:[],view:`active`,includeBackground:!1,connected:!1},t=new Map,n=new Set,r=null,i=null,a=0,o=0,s=null,c=!1,l=!1;function u(){let n=[...t.values()].sort((e,t)=>t.updatedAt===e.updatedAt?e.sessionId<t.sessionId?-1:1:t.updatedAt-e.updatedAt);e={...e,rows:n}}function d(){for(let e of n)e()}function f(e,n){if(e===`row-removed`){let e=n?.sessionId;if(typeof e!=`string`||!t.delete(e))return;u(),d();return}let r=n;if(typeof r.sessionId!=`string`)return;let i={sessionId:r.sessionId,live:r.live===!0,status:r.status===`busy`?`busy`:r.status===`idle`?`idle`:r.status===`detached`?`detached`:`gone`,agentLabel:typeof r.agentLabel==`string`&&r.agentLabel.length>0?r.agentLabel:null,cwd:typeof r.cwd==`string`?r.cwd:null,firstPrompt:typeof r.firstPrompt==`string`&&r.firstPrompt.length>0?r.firstPrompt:null,titleSource:r.titleSource===`user`||r.titleSource===`ai`?r.titleSource:null,updatedAt:typeof r.updatedAt==`number`?r.updatedAt:0,url:typeof r.url==`string`&&r.url.length>0?r.url:null,archived:r.archived===!0};t.set(i.sessionId,i),u(),d()}function p(t){if(r&&s===t||(r&&=(r.close(),null),!t))return;s=t,c=!1,l=!1;let n=U(we,t);try{r=new EventSource(n)}catch(e){console.error(`[admin-ui] session-row-store EventSource construct failed:`,e),h(`auto`);return}r.addEventListener(`open`,()=>{c=!0,a=0,e={...e,connected:!0},d(),console.info(`[admin-ui] session-row-store connected events-received=${o}`)});for(let e of[`row-created`,`row-updated`,`row-archived`,`row-removed`])r.addEventListener(e,t=>{o+=1;try{f(e,JSON.parse(t.data))}catch(t){console.error(`[admin-ui] session-row-store parse failed kind=${e}:`,t)}});r.addEventListener(`error`,()=>{r&&=(r.close(),null),e={...e,connected:!1},d(),!c&&!l&&(l=!0,m(n)),h(`auto`)})}async function m(e){let t=a+1,n=0,r=`unknown`;try{let t=await fetch(e,{method:`GET`});n=t.status,r=t.status>=400&&t.status<500?await W(t):`unknown`}catch(e){console.error(`[admin-ui] session-row-store sse-error-probe-failed:`,e);return}console.error(`[admin-ui] session-row-store sse-error status=${n} code=${r} attempt=${t}`)}function h(e){if(i)return;a+=1;let t=Math.min(1e3*2**Math.min(a,5),3e4);console.info(`[admin-ui] session-row-store reconnect trigger=${e} attempt=${a} delay-ms=${t}`),i=setTimeout(()=>{i=null,s&&p(s)},t)}function g(){i&&=(clearTimeout(i),null),a=0,r&&=(r.close(),null),console.info(`[admin-ui] session-row-store reconnect trigger=manual attempt=0 delay-ms=0`),s&&p(s)}function _(){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(Te);De(t)&&(e={...e,view:t});let n=window.localStorage.getItem(G);if(n===null){let e=window.localStorage.getItem(Ee);e!==null&&(window.localStorage.setItem(G,e),window.localStorage.removeItem(Ee),n=e,console.info(`[admin-ui] session-list-storage-migrated from=${Ee} to=${G} value=${e}`))}n===`1`&&(e={...e,includeBackground:!0})}catch{}}function v(t){e={...e,view:t};try{window.localStorage.setItem(Te,t)}catch{}d()}function y(t){e={...e,includeBackground:t};try{window.localStorage.setItem(G,t?`1`:`0`)}catch{}d()}function b(e){return n.add(e),()=>{n.delete(e)}}function x(){return e}function S(){r&&=(r.close(),null),i&&=(clearTimeout(i),null),s=null,e={...e,connected:!1}}function C(e,t){f(e,t)}function w(t){e={...e,connected:t},d()}function T(){t.clear(),u(),d()}function E(e){let n=new Set(e),r=0;for(let e of[...t.keys()])n.has(e)||(t.delete(e),r+=1);r!==0&&(console.info(`[admin-ui] session-row-store reconcile evicted=${r} kept=${t.size}`),u(),d())}return _(),{subscribe:b,getSnapshot:x,connect:p,disconnect:S,setView:v,setIncludeBackground:y,reconnectNow:g,reconcileFromList:E,_injectEventForTesting:C,_setConnectedForTesting:w,_clearRowsForTesting:T}}var K=Oe();K._injectEventForTesting,K.connect,K._setConnectedForTesting,K.getSnapshot,K.reconcileFromList;function ke(e){let t=(0,N.useSyncExternalStore)(K.subscribe,K.getSnapshot,K.getSnapshot);(0,N.useEffect)(()=>{e&&K.connect(e)},[e]);let n=(0,N.useCallback)(e=>K.setView(e),[]),r=(0,N.useCallback)(e=>K.setIncludeBackground(e),[]),i=(0,N.useCallback)(()=>K.reconnectNow(),[]),a=(0,N.useCallback)(e=>K.reconcileFromList(e),[]);return{rows:t.rows,view:t.view,includeBackground:t.includeBackground,connected:t.connected,setView:n,setIncludeBackground:r,reconnectNow:i,reconcileFromList:a}}function Ae(e,t,n){return e.filter(e=>!(t===`active`&&e.archived||t===`archived`&&!e.archived||!n&&e.agentLabel!==null&&e.agentLabel!==`admin`))}var q=6e4,J=60*q,je=24*J,Me=q,Ne=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Pe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Fe(e){return e<10?`0${e}`:String(e)}function Ie(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Le(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-Me)return`—`;let r=n<0?0:n;if(r<q)return`just now`;if(r<J)return`${Math.floor(r/q)}m`;if(r<je)return`${Math.floor(r/J)}h`;let i=new Date(t),a=new Date(e),o=Math.round((Ie(i)-Ie(a))/je);if(o===1)return`yesterday`;if(o>=2&&o<=6)return Pe[a.getDay()];let s=Fe(a.getDate()),c=Ne[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}function Re(e=3e4){let[t,n]=(0,N.useState)(()=>Date.now());return(0,N.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var ze={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Y=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],X=`Plan does not include auto mode`,Be=[{value:void 0,label:`Default`},{value:`claude-opus-4-7`,label:`Opus 4.7`},{value:`claude-sonnet-4-6`,label:`Sonnet 4.6`},{value:`claude-haiku-4-5`,label:`Haiku 4.5`}];function Ve({seedMode:e,seedModel:n,submitting:r,error:i,onSubmit:a,onCancel:s,onErrorClear:c}){let[l,u]=(0,N.useState)(``),[f,p]=(0,N.useState)(e),[m,h]=(0,N.useState)(n),[g,_]=(0,N.useState)(!1),[v,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(null),C=(0,N.useRef)(null),T=(0,N.useRef)(null),E=(0,N.useRef)(null);(0,N.useEffect)(()=>{C.current?.focus()},[]),(0,N.useEffect)(()=>{let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/claude-capabilities`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;S(r.autoModeAvailable),console.info(`[admin-ui] capability-fetch ok=true autoModeAvailable=${r.autoModeAvailable} seatTier=${r.seatTier??`null`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] capability-fetch ok=false reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[]);let D=(0,N.useMemo)(()=>e=>e===`auto`&&x===!1,[x]);(0,N.useEffect)(()=>{function e(e){if(e.key===`Escape`){if(g){_(!1),e.stopPropagation();return}if(v){b(!1),e.stopPropagation();return}s(`esc`)}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[g,v,s]),(0,N.useEffect)(()=>{if(!g&&!v)return;function e(e){g&&T.current&&!T.current.contains(e.target)&&_(!1),v&&E.current&&!E.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[g,v]);let O=l.trim(),ee=O.length>0&&!r,k=(0,N.useCallback)(()=>{if(O.length===0||r)return;let e=window.open(`about:blank`,`_blank`);console.info(`[admin-ui] new-session-modal-placeholder-open outcome=${e===null?`blocked`:`ok`}`),a({message:l,permissionMode:f,model:m,placeholder:e})},[l,f,m,O,r,a]);function te(e){e.preventDefault(),k()}let A=Be.find(e=>e.value===m)?.label??`Default`;return(0,P.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-modal-title`,className:`new-session-modal-overlay`,onClick:e=>{e.target===e.currentTarget&&s(`backdrop`)},children:(0,P.jsxs)(`div`,{className:`new-session-modal`,children:[(0,P.jsx)(`h2`,{id:`new-session-modal-title`,className:`new-session-modal-title`,children:`New session`}),(0,P.jsxs)(`form`,{className:`new-session-modal-form`,onSubmit:te,children:[(0,P.jsx)(`div`,{className:`chat-form`,children:(0,P.jsx)(d,{ref:C,value:l,onChange:e=>{u(e),i&&c()},placeholder:`What should this session do?`,disabled:r})}),i&&(0,P.jsx)(`div`,{className:`tunnel-route__error`,role:`alert`,children:i}),(0,P.jsxs)(`div`,{className:`new-session-modal-actions`,children:[(0,P.jsxs)(`div`,{className:`new-session-modal-pickers`,children:[(0,P.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:T,children:[(0,P.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!g;console.info(`[admin-ui] new-session-modal-mode-picker action=${e?`open`:`close`} current=${f}`),_(e)},disabled:r,"aria-haspopup":`menu`,"aria-expanded":g,"aria-label":`Permission mode for this session`,children:[ze[f],(0,P.jsx)(o,{size:12,"aria-hidden":`true`})]}),g&&(0,P.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,P.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,P.jsx)(`span`,{children:`Mode`})}),Y.map((e,n)=>{let r=D(e);return(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,disabled:r,title:r?X:void 0,"aria-disabled":r||void 0,onClick:()=>{r||(console.info(`[admin-ui] new-session-modal-mode-change from=${f} to=${e} trigger=click`),p(e),_(!1))},children:[(0,P.jsx)(`span`,{children:ze[e]}),(0,P.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===f&&(0,P.jsx)(t,{size:12}),(0,P.jsx)(`span`,{children:n+1})]})]},e)})]})]}),(0,P.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:E,children:[(0,P.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!v;console.info(`[admin-ui] new-session-modal-model-picker action=${e?`open`:`close`} current=${m??`default`}`),b(e)},disabled:r,"aria-haspopup":`menu`,"aria-expanded":v,"aria-label":`Model for this session`,children:[A,(0,P.jsx)(o,{size:12,"aria-hidden":`true`})]}),v&&(0,P.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Model`,children:[(0,P.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,P.jsx)(`span`,{children:`Model`})}),Be.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] new-session-modal-model-change from=${m??`default`} to=${e.value??`default`} trigger=click`),h(e.value),b(!1)},children:[(0,P.jsx)(`span`,{children:e.label}),(0,P.jsx)(`span`,{className:`side-mode-popover-shortcut`,children:e.value===m&&(0,P.jsx)(t,{size:12})})]},e.label))]})]})]}),(0,P.jsxs)(`div`,{className:`new-session-modal-buttons`,children:[(0,P.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:()=>s(`button`),disabled:r,children:`Cancel`}),(0,P.jsx)(`button`,{type:`submit`,className:`new-session-modal-submit`,disabled:!ee,"aria-label":`Send`,children:r?(0,P.jsx)(w,{size:14,className:`spinning`}):(0,P.jsx)(y,{size:14})})]})]})]})]})})}var He=1e4,Ue=(0,N.forwardRef)(function(e,r){let{businessName:i,cacheKey:c,role:u,userName:d,userAvatar:f,sessions:p,sessionsLoading:m,sessionsError:y,ensureSessionsLoaded:b,refetchSessions:S,onSelectArtefact:T,onSelectProjects:E,onSelectPeople:D,onSelectTasks:O,onSelectAgents:ee,onCloseMobileDrawer:j,onSelectSession:ne,selectedSessionId:M,collapsed:oe,mobileDrawerOpen:se,recentsActions:F}=e,[I,L]=(0,N.useState)(null),[ce,le]=(0,N.useState)(null),[ue,R]=(0,N.useState)(!1);(0,N.useEffect)(()=>{b()},[b]);let fe=(0,N.useRef)(null),[z,pe]=(0,N.useState)(!1),[B,V]=(0,N.useState)(`default`),[he,_e]=(0,N.useState)(void 0),ve=(0,N.useRef)(null),[ye,H]=(0,N.useState)(null),[be,xe]=(0,N.useState)(!1),U=(0,N.useRef)(0),W=(0,N.useRef)(new Map),Se=n.productName,Ce=typeof d==`string`?d:d===null?`name unavailable`:i||Se,we=(Ce.trim().charAt(0)||`?`).toUpperCase(),Te=ge(n.hostname),G=ke(c),Ee=(0,N.useMemo)(()=>{let e=Ae(G.rows,G.view,G.includeBackground);if(Te.pinned.size===0)return e;let t=[],n=[];for(let r of e)(Te.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[G.rows,G.view,G.includeBackground,Te.pinned]),De=Ee.length,Oe=Re(3e4);(0,N.useEffect)(()=>{if(W.current.size!==0)for(let e of G.rows){let t=W.current.get(e.sessionId);if(!t||e.url===null)continue;W.current.delete(e.sessionId),clearTimeout(t.timeoutId);let n=e.sessionId.slice(0,8);if(t.placeholder.closed){console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${n}`);continue}t.placeholder.location.href=e.url,console.info(`[admin-ui] new-session-auto-open outcome=ok sessionId=${n}`)}},[G.rows]),(0,N.useEffect)(()=>{let e=W.current;return()=>{for(let{timeoutId:t}of e.values())clearTimeout(t);e.clear()}},[]);let[K,q]=(0,N.useState)(`chat`),[J,je]=(0,N.useState)([]),[Me,Ne]=(0,N.useState)(!1),[Pe,Fe]=(0,N.useState)(null),[Ie,ze]=(0,N.useState)(!1);(0,N.useImperativeHandle)(r,()=>({patchArtefact(e,t){je(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[Y,X]=(0,N.useState)(!1),Be=(0,N.useRef)(null),Ue={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},We=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`];(0,N.useEffect)(()=>{if(!c)return;let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(c)}`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;let i=r.permissionMode,a=r.model??void 0;V(i),_e(a),ve.current={permissionMode:i,model:a},console.info(`[admin-ui] session-defaults-hydrate permissionMode=${i} model=${a??`default`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] session-defaults-hydrate-failed reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[c]);let Ke=(0,N.useCallback)(async(e,t)=>{if(!c||!ve.current)return;let n=ve.current,r=Date.now();console.info(`[admin-ui] session-defaults-put from={mode:${n.permissionMode},model:${n.model??`default`}} to={mode:${e.permissionMode},model:${e.model??`default`}} trigger=${t}`);try{let t=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(c)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({permissionMode:e.permissionMode,model:e.model??null})});if(!t.ok)throw Error(`status ${t.status}`);ve.current=e,console.info(`[admin-ui] session-defaults-put-ok ms=${Date.now()-r}`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] session-defaults-put-failed reason="${t}" ms=${Date.now()-r}`),V(n.permissionMode),_e(n.model)}},[c]);(0,N.useEffect)(()=>{if(!Y)return;function e(e){Be.current&&!Be.current.contains(e.target)&&(console.info(`[admin-ui] sidebar-mode-picker action=close mode=${B}`),X(!1))}function t(e){if(e.key===`Escape`){console.info(`[admin-ui] sidebar-mode-picker action=close mode=${B}`),X(!1);return}let t=[`1`,`2`,`3`,`4`,`5`].indexOf(e.key);if(t>=0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let n=We[t];n&&(e.preventDefault(),console.info(`[admin-ui] sidebar-mode-picker action=select mode=${n} via=shortcut`),V(n),X(!1),Ke({permissionMode:n,model:he},`sidebar`))}}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[Y,B,he,Ke]),(0,N.useEffect)(()=>{function e(e){e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.key===`m`||e.key===`M`)&&(e.preventDefault(),X(e=>{let t=!e;return console.info(`[admin-ui] sidebar-mode-picker action=${t?`open`:`close`} mode=${B} via=shortcut`),t}))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[B]);let Xe=(0,N.useCallback)(async()=>{if(c){ze(!0),Fe(null);try{let e=await fetch(`/api/admin/sidebar-artefacts?session_key=${encodeURIComponent(c)}`);if(!e.ok)throw Error(`status ${e.status}`);je((await e.json()).artefacts??[]),Ne(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Fe(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{ze(!1)}}},[c]),Ze=()=>{q(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${De}`)},Qe=()=>{q(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Me?J.length:0} collapsed=${oe}`),Me||Xe()},Z=1.5,$e=K===`chat`?`Sessions`:`Artefacts`,et=K===`chat`?m?`…`:String(De):Ie?`…`:String(J.length),tt=K===`chat`?m:Ie,nt=()=>{console.info(`[admin-ui] sidebar-refresh surface=${K}`),K===`chat`?S().then(e=>{e!==null&&G.reconcileFromList(e.map(e=>e.sessionId))}):Xe()},rt=(0,N.useCallback)(()=>{if(z||!c){console.info(`[admin-ui] sidebar-new-session-click-ignored startingSession=${z} cacheKey=${c?`set`:`missing`}`);return}H(null),U.current=Date.now(),console.info(`[admin-ui] sidebar-new-session-modal-open seedMode=${B} cacheKey-prefix=${c.slice(0,8)}`),xe(!0)},[c,z,B]),it=(0,N.useCallback)(e=>{let t=U.current?Date.now()-U.current:0;console.info(`[admin-ui] sidebar-new-session-modal-cancel reason=${e} dwell-ms=${t}`),H(null),xe(!1)},[]),at=(0,N.useCallback)(async e=>{if(z||!c)return;let t=U.current?Date.now()-U.current:0,n=Date.now();console.info(`[admin-ui] sidebar-new-session-modal-submit permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length} dwell-ms=${t}`),pe(!0),H(null);try{console.info(`[admin-ui] sidebar-new-session-fetch-start permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length}`);let t={channel:`browser`,permissionMode:e.permissionMode,initialMessage:e.message};e.model!==void 0&&(t.model=e.model);let r=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(c)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),i=Date.now()-n;console.info(`[admin-ui] sidebar-new-session-fetch-done status=${r.status} ok=${r.ok} ms=${i}`);let a=await r.json();if(!r.ok||!(`sessionId`in a)){let e=a,t=e.error??`POST returned ${r.status}`,i=e.reason?`${t}: ${e.reason}`:t;console.error(`[admin-ui] sidebar-new-session-failed status=${r.status} ms=${Date.now()-n} error=${t} reason=${e.reason??`none`} tail=${JSON.stringify(e.stderrTail??``)}`),H(i);return}console.info(`[admin-ui] sidebar-new-session-ok pid=${a.pid} sessionId=${a.sessionId.slice(0,8)} permissionMode=${e.permissionMode} model=${e.model??`default`} ms=${Date.now()-n}`),F.setSessions(e=>[a,...e]),xe(!1);let o=a.sessionId,s=o.slice(0,8);if(e.placeholder===null)console.info(`[admin-ui] new-session-auto-open outcome=fallback sessionId=${s}`),ne(o);else{let t=setTimeout(()=>{let e=W.current.get(o);e&&(W.current.delete(o),e.placeholder.closed||e.placeholder.close(),console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${s}`))},He);W.current.set(o,{placeholder:e.placeholder,timeoutId:t})}}catch(e){let t=e instanceof Error?e.message:String(e);H(t),console.error(`[admin-ui] sidebar-new-session-threw ms=${Date.now()-n} message=${t}`)}finally{pe(!1)}},[c,z,F,ne]),Q=me(c,F,`sidebar`),ot=(0,N.useCallback)(async e=>{let t=await Q.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[Q]),st=(0,N.useCallback)(async e=>{R(!0),le(null);let t=await Q.purge(e);t.ok?L(null):le(t.error??`purge failed`),R(!1)},[Q]),ct=(0,N.useCallback)(async e=>{let t=await Q.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[Q]),lt=(0,N.useCallback)(async e=>{let t=await Q.archive(e);t.ok||console.error(`[admin-ui] sidebar-archive failed: ${t.error}`)},[Q]),ut=(0,N.useCallback)(async e=>{let t=await Q.unarchive(e);t.ok||console.error(`[admin-ui] sidebar-unarchive failed: ${t.error}`)},[Q]),[dt,$]=(0,N.useState)(null),[ft,pt]=(0,N.useState)(``),mt=(0,N.useCallback)(async(e,t)=>{let n=ft.trim();if(n.length===0||!de(n)){$(null);return}if(n===(t??``)){$(null);return}let r=await Q.rename(e,n);r.ok||console.error(`[admin-ui] sidebar-rename failed: ${r.error}`),$(null)},[ft,Q]),ht=(0,N.useCallback)(()=>{$(null)},[]);return(0,P.jsxs)(`aside`,{className:`side`,children:[K===`chat`&&(0,P.jsxs)(`div`,{className:`side-new-session-row`,ref:Be,children:[(0,P.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:rt,disabled:z||!c,children:[z?(0,P.jsx)(w,{size:14,className:`spinning`}):(0,P.jsx)(te,{size:14}),(0,P.jsx)(`span`,{children:`New session`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!Y;console.info(`[admin-ui] sidebar-mode-picker action=${e?`open`:`close`} mode=${B}`),X(e)},disabled:z,"aria-haspopup":`menu`,"aria-expanded":Y,"aria-label":`Permission mode for the next session`,title:`Shift+Cmd+M`,children:[Ue[B],(0,P.jsx)(o,{size:12,"aria-hidden":`true`})]}),Y&&(0,P.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,P.jsxs)(`div`,{className:`side-mode-popover-head`,children:[(0,P.jsx)(`span`,{children:`Mode`}),(0,P.jsx)(`span`,{className:`side-mode-popover-shortcut`,"aria-hidden":`true`,children:`⇧⌘M`})]}),We.map((e,n)=>(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] sidebar-mode-picker action=select mode=${e}`),V(e),X(!1),Ke({permissionMode:e,model:he},`sidebar`)},children:[(0,P.jsx)(`span`,{children:Ue[e]}),(0,P.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===B&&(0,P.jsx)(t,{size:12}),(0,P.jsx)(`span`,{children:n+1})]})]},e))]})]}),(0,P.jsxs)(`nav`,{className:`side-nav`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`nav-row${K===`chat`?` active`:``}`,onClick:Ze,children:[(0,P.jsx)(ie,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),D(),j()},children:[(0,P.jsx)(ae,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`People`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),ee(),j()},children:[(0,P.jsx)(_,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Agents`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),E(),j()},children:[(0,P.jsx)(v,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Projects`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),O(),j()},children:[(0,P.jsx)(C,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,P.jsx)(`span`,{className:`kbd`})]}),(0,P.jsxs)(`button`,{type:`button`,className:`nav-row${K===`artefacts`?` active`:``}`,onClick:Qe,children:[(0,P.jsx)(s,{size:20,strokeWidth:Z}),(0,P.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,P.jsx)(`span`,{className:`kbd`})]})]}),(0,P.jsxs)(`div`,{className:`side-list`,ref:fe,children:[(0,P.jsxs)(`div`,{className:`group-head`,children:[(0,P.jsx)(`span`,{children:$e}),(0,P.jsxs)(`span`,{className:`group-head-meta`,children:[(0,P.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${$e.toLowerCase()}`,"aria-label":`Refresh ${$e.toLowerCase()}`,onClick:nt,disabled:tt,children:(0,P.jsx)(A,{size:12,className:tt?`spinning`:void 0})}),(0,P.jsx)(`span`,{children:et})]})]}),K===`chat`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(qe,{view:G.view,setView:e=>{console.info(`[admin-ui] sidebar-view-change view=${e}`),G.setView(e)},connected:G.connected,reconnectNow:G.reconnectNow}),y&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:y}),Ee.map(e=>{let t=M===e.sessionId,n=dt===e.sessionId;return(0,P.jsxs)(`div`,{className:`conv${t?` active`:``}`,children:[n?(0,P.jsxs)(`span`,{className:`conv-name-line`,style:{flex:1,minWidth:0},children:[(0,P.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,P.jsx)(Je,{live:e.live,status:e.status}),(0,P.jsx)(`input`,{type:`text`,value:ft,autoFocus:!0,maxLength:200,onChange:e=>pt(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),mt(e.sessionId,e.firstPrompt)):t.key===`Escape`&&(t.preventDefault(),ht())},onBlur:()=>{mt(e.sessionId,e.firstPrompt)},className:`conv-name`,"aria-label":`Rename session`,style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`inherit`,font:`inherit`}})]}):(0,P.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{ne(e.sessionId),j()},title:`Show metadata`,children:[(0,P.jsxs)(`span`,{className:`conv-name-line`,children:[(0,P.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,P.jsx)(Je,{live:e.live,status:e.status}),e.firstPrompt?(0,P.jsx)(`span`,{className:`conv-name`,children:e.firstPrompt}):(0,P.jsxs)(`span`,{className:`conv-name`,style:{fontStyle:`italic`,opacity:.6},children:[`(unnamed · `,e.sessionId.slice(0,8),`)`]})]}),(0,P.jsx)(`span`,{className:`conv-timestamp`,children:Le(e.updatedAt,Oe)})]}),!n&&(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Rename`,"aria-label":`Rename session`,onClick:()=>{pt(e.firstPrompt??``),$(e.sessionId)},children:(0,P.jsx)(k,{size:13})}),e.url!==null&&(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>Ye(e.url,e.sessionId),children:(0,P.jsx)(x,{size:13})}),e.live?(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void ct(e.sessionId),disabled:Q.inFlight===`end`,children:Q.inFlight===`end`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(re,{size:13})}):e.archived?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Unarchive session`,"aria-label":`Unarchive session`,onClick:()=>void ut(e.sessionId),disabled:Q.inFlight===`unarchive`,children:Q.inFlight===`unarchive`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(h,{size:13})}),(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{le(null),L({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,P.jsx)(a,{size:13})})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void ot(e.sessionId),disabled:Q.inFlight===`resume`,children:Q.inFlight===`resume`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(l,{size:13})}),(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Archive session`,"aria-label":`Archive session`,onClick:()=>void lt(e.sessionId),disabled:Q.inFlight===`archive`,children:Q.inFlight===`archive`?(0,P.jsx)(w,{size:13,className:`spinning`}):(0,P.jsx)(g,{size:13})}),(0,P.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{le(null),L({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,P.jsx)(a,{size:13})})]})]},e.sessionId)})]}),K===`artefacts`&&(0,P.jsxs)(P.Fragment,{children:[Pe&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Pe}),Me&&!Pe&&J.length===0&&(0,P.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),J.map(e=>(0,P.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>{T({docId:e.id,name:e.name,content:e.content,editable:e.editable,mimeType:e.mimeType,skipReason:e.skipReason},`sidebar-artefacts`),j()},children:[(0,P.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,P.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,P.jsx)(Ge,{}),(0,P.jsxs)(`div`,{className:`side-foot`,children:[(0,P.jsx)(`div`,{className:`avatar`,children:f?(0,P.jsx)(`img`,{src:f,alt:Ce}):we}),(0,P.jsxs)(`div`,{className:`who`,children:[(0,P.jsx)(`span`,{className:`name`,children:Ce}),(0,P.jsx)(`span`,{className:`role`,children:u??`operator`})]})]}),be&&(0,P.jsx)(Ve,{seedMode:B,seedModel:he,submitting:z,error:ye,onSubmit:e=>void at(e),onCancel:it,onErrorClear:()=>H(null)}),I&&(0,P.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!ue&&L(null)},children:(0,P.jsxs)(`div`,{className:`modal-card`,children:[(0,P.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,P.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript for `,(0,P.jsx)(`strong`,{children:I.displayName??I.sessionId.slice(0,8)}),`. The action cannot be undone.`]}),ce&&(0,P.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:ce}),(0,P.jsxs)(`div`,{className:`modal-action-row`,children:[(0,P.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:ue,onClick:()=>L(null),children:`Cancel`}),(0,P.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:ue,onClick:()=>void st(I.sessionId),children:ue?(0,P.jsx)(w,{size:13,className:`spinning`}):`Purge`})]})]})})]})}),We=5e3;function Ge(){let[e,t]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},We))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=e=>{if(e===null)return{width:`0%`,background:`var(--text-tertiary)`};let t=Math.min(1,Math.max(0,e)),n=Math.round(140*(1-t));return{width:`${Math.round(t*100)}%`,background:`hsl(${n}, 65%, 45%)`}},f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,P.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,P.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,P.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,P.jsx)(`div`,{className:`system-stats__bar`,children:(0,P.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,P.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,P.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,P.jsx)(`div`,{className:`system-stats__bar`,children:(0,P.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var Ke=[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`all`,label:`All`}];function qe(e){let{view:t,setView:n,connected:r,reconnectNow:i}=e;return(0,P.jsx)(`div`,{className:`session-view-controls`,children:(0,P.jsxs)(`div`,{className:`session-view-segmented`,role:`tablist`,"aria-label":`Session view`,children:[Ke.map(e=>(0,P.jsx)(`button`,{type:`button`,role:`tab`,className:`session-view-tab${t===e.value?` active`:``}`,"aria-selected":t===e.value,onClick:()=>n(e.value),children:e.label},e.value)),r?(0,P.jsx)(`span`,{className:`session-view-connection connected`,"aria-label":`Live updates connected.`,title:`Live updates connected.`}):(0,P.jsx)(`button`,{type:`button`,className:`session-view-connection disconnected`,"aria-label":`Live updates paused. Click to retry.`,title:`Live updates paused. Click to retry.`,onClick:i})]})})}function Je({live:e,status:t}){return e?t===`busy`?(0,P.jsxs)(`span`,{className:`session-status session-status-busy`,"aria-label":`session busy`,children:[(0,P.jsx)(`span`,{className:`session-status-dot`}),(0,P.jsx)(`span`,{className:`session-status-dot`}),(0,P.jsx)(`span`,{className:`session-status-dot`})]}):t===`detached`?(0,P.jsx)(`span`,{className:`session-status session-status-detached`,"aria-label":`session detached — manager restart survivor`}):(0,P.jsx)(`span`,{className:`session-status session-status-idle`,"aria-label":`session idle`}):(0,P.jsx)(`span`,{className:`session-status session-status-archived`,"aria-label":`session archived`})}function Ye(e,t){let n=t.slice(0,8),r=window.open(e,`_blank`,`noopener,noreferrer`)===null?`blocked`:`ok`;console.info(`[admin-ui] sidebar-open-in-new-tab outcome=${r} sessionId=${n}`)}function Xe(){(0,N.useEffect)(()=>{function e(e){e.data?.type===`vnc-clipboard`&&typeof e.data.text==`string`&&u(e.data.text)}window.addEventListener(`message`,e);let t=null;return typeof BroadcastChannel<`u`&&(t=new BroadcastChannel(`maxy-vnc-clipboard`),t.onmessage=e=>{typeof e.data==`string`&&u(e.data)}),()=>{window.removeEventListener(`message`,e),t?.close()}},[])}function Ze({handlePopout:e,disabled:t=!1}){let n=(0,N.useCallback)(()=>{delete document.body.dataset.dragPopoutActive},[]);(0,N.useEffect)(()=>()=>n(),[n]);let r=(0,N.useCallback)(e=>{if(t){e.preventDefault();return}let n=e.target;if(n.closest(`.editor-base__actions`)||n.closest(`.browser-viewer__actions`)){e.preventDefault();return}if(!document.querySelector(`.chat-messages`)){e.preventDefault();return}e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,``),document.body.dataset.dragPopoutActive=`true`},[t,n]),i=(0,N.useCallback)(t=>{if(n(),t.clientX===0&&t.clientY===0)return;let r=document.querySelector(`.chat-messages`);if(!r)return;let i=r.getBoundingClientRect();(t.clientX<i.left||t.clientX>i.right||t.clientY<i.top||t.clientY>i.bottom)&&e()},[e,n]);return t?{draggable:!1,onDragStart:()=>{},onDragEnd:()=>{}}:{draggable:!0,onDragStart:r,onDragEnd:i}}function Qe(e){(0,N.useEffect)(()=>{let t=Date.now(),r=`/api/admin/browser-iframe/event`,i={brand:n.productName,surface:e};return fetch(r,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:`mount`,...i}),keepalive:!0}).catch(()=>{}),()=>{let e=JSON.stringify({event:`unmount`,durationMs:Date.now()-t,...i});try{let t=new Blob([e],{type:`application/json`});navigator.sendBeacon(r,t)||fetch(r,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:e,keepalive:!0}).catch(()=>{})}catch{}}},[e])}var Z=`maxy-vnc-overlay-popout`;function $e(e){let[t,r]=(0,N.useState)(!1),i=(0,N.useRef)(null),a=(0,N.useRef)(null),o=(0,N.useCallback)(()=>{a.current&&=(clearInterval(a.current),null),i.current&&!i.current.closed&&i.current.close(),i.current=null,r(!1)},[]),s=(0,N.useCallback)(()=>{let t=`/vnc-popout.html?title=${encodeURIComponent(n.productName)}`,s=window.open(t,Z,`width=1024,height=768`);s&&(i.current=s,r(!0),a.current=setInterval(()=>{i.current?.closed&&(o(),e?.())},500))},[o,e]);return(0,N.useEffect)(()=>()=>o(),[o]),{poppedOut:t,popout:s,cleanupPopout:o}}var et=(0,N.forwardRef)(function({onClose:e},t){Xe(),Qe(`overlay`);let{poppedOut:r,popout:i,cleanupPopout:a}=$e(e);return(0,N.useImperativeHandle)(t,()=>({popout:i}),[i]),r?(0,P.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,P.jsx)(c,{className:`browser-viewer__icon`}),(0,P.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,P.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>a(),"aria-label":`Pop back in`}),e&&(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:M,onClick:()=>{a(),e()},"aria-label":`Close`})]}):(0,P.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-surface__iframe`,title:n.productName})});function tt({onClose:e}){Xe(),Qe(`overlay`);let{poppedOut:t,popout:r,cleanupPopout:i}=$e(e),a=(0,N.useCallback)(()=>{i(),e()},[i,e]);(0,N.useEffect)(()=>{if(t)return;let e=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,a]);let o=Ze({handlePopout:r,disabled:t});return t?(0,P.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,P.jsx)(c,{className:`browser-viewer__icon`}),(0,P.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,P.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>{i()},"aria-label":`Pop back in`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:M,onClick:a,"aria-label":`Close`})]}):(0,P.jsxs)(`div`,{className:`browser-viewer-fullscreen`,children:[(0,P.jsxs)(`div`,{className:`browser-viewer-fullscreen__bar`,...o,children:[(0,P.jsx)(c,{className:`browser-viewer__icon`}),(0,P.jsx)(`span`,{className:`browser-viewer-fullscreen__title`,children:n.productName}),(0,P.jsxs)(`div`,{className:`browser-viewer-fullscreen__actions`,children:[(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:x,onClick:r,"aria-label":`Pop out`}),(0,P.jsx)(f,{variant:`ghost`,size:`sm`,icon:M,onClick:a,"aria-label":`Close`})]})]}),(0,P.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-viewer-fullscreen__iframe`,title:n.productName})]})}function nt(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function rt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2]||r[3]!==i[3])return!1}return!0}function it(e){let[t,n]=(0,N.useState)([]),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(null),l=(0,N.useRef)([]),u=(0,N.useCallback)(async t=>{if(!e||!t&&s===e)return null;i(!0),o(null);try{let t=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`claude-sessions fetch returned ${t.status}`);let r=await t.json(),i=Array.isArray(r)?r:r.sessions??[],a=nt(i),o=rt(l.current,a);return o||(n(i),l.current=a),c(e),console.info(`[admin-ui] sessions-poll outcome=${o?`unchanged`:`changed`} count=${i.length} cacheKey=${e.slice(0,8)}`),i}catch(t){return console.info(`[admin-ui] sessions-poll outcome=error count=0 cacheKey=${e.slice(0,8)}`),console.error(`[admin/claude-sessions] fetch failed:`,t),o(t instanceof Error?t.message:String(t)),null}finally{i(!1)}},[e,s]);(0,N.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,N.useCallback)(()=>u(!1),[u]),f=(0,N.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var at=`admin-sidebar-collapsed`,Q=`admin-sidebar-drawer-open`;function ot(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(at)===`1`}catch{return!1}}function st(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(at,`1`):window.sessionStorage.removeItem(at)}catch{}}function ct(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Q)===`1`}catch{return!1}}function lt(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Q,`1`):window.sessionStorage.removeItem(Q)}catch{}}var ut=720;function dt(e){let{cacheKey:t,businessName:n,onLaunchBrowser:r,onLogout:i,browserLaunching:a,userName:o,userAvatar:s,role:c,selectedSessionId:l,onSelectSession:u,onSelectArtefact:d,dataArtefact:f=`closed`,children:p,footer:m}=e,[h,g]=(0,N.useState)(()=>ot()),[_,v]=(0,N.useState)(()=>ct()),[y,b]=(0,N.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${ut}px)`).matches);(0,N.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${ut}px)`),t=e=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let x=(0,N.useCallback)(e=>{st(e),g(e)},[]),S=(0,N.useCallback)(e=>{lt(e),v(e)},[]);(0,N.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} collapsed=${h} drawer=${_}`)},[]);let C=y?_:!h,w=(0,N.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${ut}px)`).matches){let e=_;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),S(!e)}else{let e=h;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),x(!e)}},[h,_,x,S]),T=(0,N.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),[E,D]=(0,N.useState)(!1),[O,ee]=(0,N.useState)(!1),k=(0,N.useCallback)(async()=>{if(E)return;D(!0);let e=typeof window<`u`?window.location?.pathname??``:``,t=`n/a`;try{let n=await fetch(`/api/admin/browser/launch`,{method:`POST`});t=n.status;let r=await n.json().catch(()=>({ok:!1,error:`Invalid response`}));if(!r.ok)throw Error(r.error??`Failed to launch browser`);ee(!0),console.info(`[admin-ui] header-menu-browser-launch outcome=ok source=shell-overlay route=${e} httpStatus=${t}`)}catch(n){console.error(`[admin-ui] header-menu-browser-launch outcome=error source=shell-overlay route=${e} httpStatus=${t} error="${n instanceof Error?n.message:String(n)}"`),window.alert(n instanceof Error?n.message:`Failed to launch browser`)}finally{D(!1)}},[E]),te=a??E,A=it(t),j=ke(t),ne=(0,N.useMemo)(()=>j.rows.map(e=>e.sessionId),[j.rows]),re=(0,N.useCallback)(e=>{if(u){u(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[u]),ie=(0,N.useCallback)(e=>{d&&d(e)},[d]),ae={collapsed:h,mobileDrawerOpen:_,sidebarOpen:C,onToggleSidebar:w,setMobileDrawerOpen:S,sessionsState:A,sessionRowIds:ne,sessionRowsConnected:j.connected};return(0,P.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,P.jsx)(_e,{businessName:n,onLaunchBrowser:r??k,onNavigate:T,onToggleSidebar:w,sidebarOpen:C,onLogout:i,browserLaunching:te}),(0,P.jsxs)(`div`,{className:`platform${_?` menu-open`:``}${h?` sidebar-collapsed`:``}`,"data-artefact":f,children:[(0,P.jsx)(Ue,{businessName:n,cacheKey:t,role:c??null,userName:o,userAvatar:s??null,sessions:A.sessions,sessionsLoading:A.loading,sessionsError:A.error,ensureSessionsLoaded:A.ensureLoaded,refetchSessions:A.refetch,onSelectArtefact:ie,onSelectProjects:()=>{window.location.href=`/graph?label=Project`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>S(!1),onSelectSession:re,selectedSessionId:l??null,collapsed:h,mobileDrawerOpen:_,recentsActions:{setSessions:A.setSessions,refetch:A.refetch}}),typeof p==`function`?p(ae):p]}),_&&(0,P.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>S(!1)}),O&&(0,P.jsx)(tt,{onClose:()=>ee(!1)}),m]})}var $={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#82A06A`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`},ft=`#94A3B8`;Object.freeze(Object.keys($)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var pt=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.AdminConversation.PublicConversation.Task.Project.Event.Workflow.Email.EmailAccount.Agent`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));function mt(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call($,e[t]))return e[t];return e[0]??null}function ht(e){return $[e]??`#94A3B8`}function gt(e){let t=mt(e),n=t?ht(t):ft,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call($,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{x as C,h as E,w as S,g as T,j as _,dt as a,k as b,Ze as c,de as d,me as f,ne as g,re as h,gt as i,Ce as l,M as m,ht as n,tt as o,L as p,mt as r,et as s,pt as t,ge as u,A as v,b as w,D as x,te as y};
@@ -1 +1 @@
1
- import{C as e,E as t,S as n,T as r,a as i,b as a,c as o,i as s,n as c,s as l,t as u,w as d,x as f}from"./reduce-tk-xY6Fv.js";import{C as p,E as m,g as ee,h,l as g,p as te,u as _,v,w as ne}from"./_baseFor-BHtDrjIo.js";import{n as y,t as b}from"./isEmpty-BWl67LAZ.js";import{A as re,C as x,D as S,E as ie,M as ae,O as oe,T as se,j as C,k as ce,w,x as T,y as le}from"./chunk-5PVQY5BW-BwG8uJC1.js";function ue(e,t){return e&&w(t,f(t),e)}function de(e,t){return e&&w(t,x(t),e)}function fe(e,t){return w(e,n(e),t)}var E=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,n(e)),e=oe(e);return t}:e;function pe(e,t){return w(e,E(e),t)}function me(e){return d(e,x,E)}var he=Object.prototype.hasOwnProperty;function ge(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&he.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function _e(e,t){var n=t?C(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var D=/\w*$/;function O(e){var t=new e.constructor(e.source,D.exec(e));return t.lastIndex=e.lastIndex,t}var k=m?m.prototype:void 0,A=k?k.valueOf:void 0;function j(e){return A?Object(A.call(e)):{}}var M=`[object Boolean]`,N=`[object Date]`,P=`[object Map]`,F=`[object Number]`,I=`[object RegExp]`,ve=`[object Set]`,ye=`[object String]`,be=`[object Symbol]`,xe=`[object ArrayBuffer]`,Se=`[object DataView]`,Ce=`[object Float32Array]`,we=`[object Float64Array]`,Te=`[object Int8Array]`,Ee=`[object Int16Array]`,De=`[object Int32Array]`,Oe=`[object Uint8Array]`,ke=`[object Uint8ClampedArray]`,Ae=`[object Uint16Array]`,je=`[object Uint32Array]`;function Me(e,t,n){var r=e.constructor;switch(t){case xe:return C(e);case M:case N:return new r(+e);case Se:return _e(e,n);case Ce:case we:case Te:case Ee:case De:case Oe:case ke:case Ae:case je:return re(e,n);case P:return new r;case F:case ye:return new r(e);case I:return O(e);case ve:return new r;case be:return j(e)}}var Ne=`[object Map]`;function Pe(e){return h(e)&&y(e)==Ne}var L=g&&g.isMap,Fe=L?_(L):Pe,Ie=`[object Set]`;function Le(e){return h(e)&&y(e)==Ie}var R=g&&g.isSet,Re=R?_(R):Le,ze=1,Be=2,Ve=4,z=`[object Arguments]`,He=`[object Array]`,Ue=`[object Boolean]`,We=`[object Date]`,Ge=`[object Error]`,B=`[object Function]`,Ke=`[object GeneratorFunction]`,qe=`[object Map]`,Je=`[object Number]`,V=`[object Object]`,Ye=`[object RegExp]`,Xe=`[object Set]`,Ze=`[object String]`,Qe=`[object Symbol]`,$e=`[object WeakMap]`,et=`[object ArrayBuffer]`,tt=`[object DataView]`,nt=`[object Float32Array]`,rt=`[object Float64Array]`,it=`[object Int8Array]`,at=`[object Int16Array]`,ot=`[object Int32Array]`,st=`[object Uint8Array]`,ct=`[object Uint8ClampedArray]`,lt=`[object Uint16Array]`,ut=`[object Uint32Array]`,H={};H[z]=H[He]=H[et]=H[tt]=H[Ue]=H[We]=H[nt]=H[rt]=H[it]=H[at]=H[ot]=H[qe]=H[Je]=H[V]=H[Ye]=H[Xe]=H[Ze]=H[Qe]=H[st]=H[ct]=H[lt]=H[ut]=!0,H[Ge]=H[B]=H[$e]=!1;function U(e,t,n,r,i,o){var c,l=t&ze,u=t&Be,d=t&Ve;if(n&&(c=i?n(e,r,i,o):n(e)),c!==void 0)return c;if(!ne(e))return e;var p=ee(e);if(p){if(c=ge(e),!l)return ce(e,c)}else{var m=y(e),h=m==B||m==Ke;if(te(e))return ae(e,l);if(m==V||m==z||h&&!i){if(c=u||h?{}:S(e),!l)return u?pe(e,de(c,e)):fe(e,ue(c,e))}else{if(!H[m])return i?e:{};c=Me(e,m,l)}}o||=new v;var g=o.get(e);if(g)return g;o.set(e,c),Re(e)?e.forEach(function(r){c.add(U(r,t,n,r,e,o))}):Fe(e)&&e.forEach(function(r,i){c.set(i,U(r,t,n,i,e,o))});var _=p?void 0:(d?u?me:a:u?x:f)(e);return s(_||e,function(r,i){_&&(i=r,r=e[i]),se(c,i,U(r,t,n,i,e,o))}),c}function W(e,n){return t(n,function(t){return e[t]})}function G(e){return e==null?[]:W(e,f(e))}function K(e){return e===void 0}var dt=le(function(e){return i(l(e,1,ie,!0))}),ft=`\0`,q=`\0`,J=``,Y=class{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,`directed`)?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,`compound`)?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=T(void 0),this._defaultEdgeLabelFn=T(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[q]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return p(e)||(e=T(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return f(this._nodes)}sources(){var e=this;return o(this.nodes(),function(t){return b(e._in[t])})}sinks(){var e=this;return o(this.nodes(),function(t){return b(e._out[t])})}setNodes(e,t){var n=arguments,r=this;return c(e,function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=q,this._children[e]={},this._children[q][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],c(this.children(e),e=>{this.setParent(e)}),delete this._children[e]),c(f(this._in[e]),t),delete this._in[e],delete this._preds[e],c(f(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(K(t))t=q;else{t+=``;for(var n=t;!K(n);n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==q)return t}}children(e){if(K(e)&&(e=q),this._isCompound){var t=this._children[e];if(t)return f(t)}else if(e===q)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return f(t)}successors(e){var t=this._sucs[e];if(t)return f(t)}neighbors(e){var t=this.predecessors(e);if(t)return dt(t,this.successors(e))}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;c(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),c(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&c(t.nodes(),function(e){t.setParent(e,i(e))}),t}setDefaultEdgeLabel(e){return p(e)||(e=T(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return G(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return u(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,K(n)||(n=``+n);var o=Q(this._isDirected,e,t,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(!K(n)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(e,t,n);var s=pt(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,X(this._preds[t],e),X(this._sucs[e],t),this._in[t][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?$(this._isDirected,arguments[0]):Q(this._isDirected,e,t,n);return this._edgeLabels[r]}hasEdge(e,t,n){var r=arguments.length===1?$(this._isDirected,arguments[0]):Q(this._isDirected,e,t,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?$(this._isDirected,arguments[0]):Q(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],Z(this._preds[t],e),Z(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=G(n);return t?o(r,function(e){return e.v===t}):r}}outEdges(e,t){var n=this._out[e];if(n){var r=G(n);return t?o(r,function(e){return e.w===t}):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};Y.prototype._nodeCount=0,Y.prototype._edgeCount=0;function X(e,t){e[t]?e[t]++:e[t]=1}function Z(e,t){--e[t]||delete e[t]}function Q(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+J+a+J+(K(r)?ft:r)}function pt(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function $(e,t){return Q(e,t.v,t.w,t.name)}export{U as i,K as n,G as r,Y as t};
1
+ import{C as e,E as t,S as n,T as r,a as i,b as a,c as o,i as s,n as c,s as l,t as u,w as d,x as f}from"./reduce-tk-xY6Fv.js";import{C as p,E as m,g as ee,h,l as g,p as te,u as _,v,w as ne}from"./_baseFor-BHtDrjIo.js";import{n as y,t as b}from"./isEmpty-BWl67LAZ.js";import{A as re,C as x,D as S,E as ie,M as ae,O as oe,T as se,j as C,k as ce,w,x as T,y as le}from"./chunk-5PVQY5BW-SQD_EpYa.js";function ue(e,t){return e&&w(t,f(t),e)}function de(e,t){return e&&w(t,x(t),e)}function fe(e,t){return w(e,n(e),t)}var E=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,n(e)),e=oe(e);return t}:e;function pe(e,t){return w(e,E(e),t)}function me(e){return d(e,x,E)}var he=Object.prototype.hasOwnProperty;function ge(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&he.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function _e(e,t){var n=t?C(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var D=/\w*$/;function O(e){var t=new e.constructor(e.source,D.exec(e));return t.lastIndex=e.lastIndex,t}var k=m?m.prototype:void 0,A=k?k.valueOf:void 0;function j(e){return A?Object(A.call(e)):{}}var M=`[object Boolean]`,N=`[object Date]`,P=`[object Map]`,F=`[object Number]`,I=`[object RegExp]`,ve=`[object Set]`,ye=`[object String]`,be=`[object Symbol]`,xe=`[object ArrayBuffer]`,Se=`[object DataView]`,Ce=`[object Float32Array]`,we=`[object Float64Array]`,Te=`[object Int8Array]`,Ee=`[object Int16Array]`,De=`[object Int32Array]`,Oe=`[object Uint8Array]`,ke=`[object Uint8ClampedArray]`,Ae=`[object Uint16Array]`,je=`[object Uint32Array]`;function Me(e,t,n){var r=e.constructor;switch(t){case xe:return C(e);case M:case N:return new r(+e);case Se:return _e(e,n);case Ce:case we:case Te:case Ee:case De:case Oe:case ke:case Ae:case je:return re(e,n);case P:return new r;case F:case ye:return new r(e);case I:return O(e);case ve:return new r;case be:return j(e)}}var Ne=`[object Map]`;function Pe(e){return h(e)&&y(e)==Ne}var L=g&&g.isMap,Fe=L?_(L):Pe,Ie=`[object Set]`;function Le(e){return h(e)&&y(e)==Ie}var R=g&&g.isSet,Re=R?_(R):Le,ze=1,Be=2,Ve=4,z=`[object Arguments]`,He=`[object Array]`,Ue=`[object Boolean]`,We=`[object Date]`,Ge=`[object Error]`,B=`[object Function]`,Ke=`[object GeneratorFunction]`,qe=`[object Map]`,Je=`[object Number]`,V=`[object Object]`,Ye=`[object RegExp]`,Xe=`[object Set]`,Ze=`[object String]`,Qe=`[object Symbol]`,$e=`[object WeakMap]`,et=`[object ArrayBuffer]`,tt=`[object DataView]`,nt=`[object Float32Array]`,rt=`[object Float64Array]`,it=`[object Int8Array]`,at=`[object Int16Array]`,ot=`[object Int32Array]`,st=`[object Uint8Array]`,ct=`[object Uint8ClampedArray]`,lt=`[object Uint16Array]`,ut=`[object Uint32Array]`,H={};H[z]=H[He]=H[et]=H[tt]=H[Ue]=H[We]=H[nt]=H[rt]=H[it]=H[at]=H[ot]=H[qe]=H[Je]=H[V]=H[Ye]=H[Xe]=H[Ze]=H[Qe]=H[st]=H[ct]=H[lt]=H[ut]=!0,H[Ge]=H[B]=H[$e]=!1;function U(e,t,n,r,i,o){var c,l=t&ze,u=t&Be,d=t&Ve;if(n&&(c=i?n(e,r,i,o):n(e)),c!==void 0)return c;if(!ne(e))return e;var p=ee(e);if(p){if(c=ge(e),!l)return ce(e,c)}else{var m=y(e),h=m==B||m==Ke;if(te(e))return ae(e,l);if(m==V||m==z||h&&!i){if(c=u||h?{}:S(e),!l)return u?pe(e,de(c,e)):fe(e,ue(c,e))}else{if(!H[m])return i?e:{};c=Me(e,m,l)}}o||=new v;var g=o.get(e);if(g)return g;o.set(e,c),Re(e)?e.forEach(function(r){c.add(U(r,t,n,r,e,o))}):Fe(e)&&e.forEach(function(r,i){c.set(i,U(r,t,n,i,e,o))});var _=p?void 0:(d?u?me:a:u?x:f)(e);return s(_||e,function(r,i){_&&(i=r,r=e[i]),se(c,i,U(r,t,n,i,e,o))}),c}function W(e,n){return t(n,function(t){return e[t]})}function G(e){return e==null?[]:W(e,f(e))}function K(e){return e===void 0}var dt=le(function(e){return i(l(e,1,ie,!0))}),ft=`\0`,q=`\0`,J=``,Y=class{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,`directed`)?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,`compound`)?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=T(void 0),this._defaultEdgeLabelFn=T(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[q]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return p(e)||(e=T(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return f(this._nodes)}sources(){var e=this;return o(this.nodes(),function(t){return b(e._in[t])})}sinks(){var e=this;return o(this.nodes(),function(t){return b(e._out[t])})}setNodes(e,t){var n=arguments,r=this;return c(e,function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=q,this._children[e]={},this._children[q][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],c(this.children(e),e=>{this.setParent(e)}),delete this._children[e]),c(f(this._in[e]),t),delete this._in[e],delete this._preds[e],c(f(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(K(t))t=q;else{t+=``;for(var n=t;!K(n);n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==q)return t}}children(e){if(K(e)&&(e=q),this._isCompound){var t=this._children[e];if(t)return f(t)}else if(e===q)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return f(t)}successors(e){var t=this._sucs[e];if(t)return f(t)}neighbors(e){var t=this.predecessors(e);if(t)return dt(t,this.successors(e))}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;c(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),c(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&c(t.nodes(),function(e){t.setParent(e,i(e))}),t}setDefaultEdgeLabel(e){return p(e)||(e=T(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return G(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return u(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,K(n)||(n=``+n);var o=Q(this._isDirected,e,t,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(!K(n)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(e,t,n);var s=pt(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,X(this._preds[t],e),X(this._sucs[e],t),this._in[t][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?$(this._isDirected,arguments[0]):Q(this._isDirected,e,t,n);return this._edgeLabels[r]}hasEdge(e,t,n){var r=arguments.length===1?$(this._isDirected,arguments[0]):Q(this._isDirected,e,t,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?$(this._isDirected,arguments[0]):Q(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],Z(this._preds[t],e),Z(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=G(n);return t?o(r,function(e){return e.v===t}):r}}outEdges(e,t){var n=this._out[e];if(n){var r=G(n);return t?o(r,function(e){return e.w===t}):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};Y.prototype._nodeCount=0,Y.prototype._edgeCount=0;function X(e,t){e[t]?e[t]++:e[t]=1}function Z(e,t){--e[t]||delete e[t]}function Q(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+J+a+J+(K(r)?ft:r)}function pt(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function $(e,t){return Q(e,t.v,t.w,t.name)}export{U as i,K as n,G as r,Y as t};
@@ -1,2 +1,2 @@
1
- import"./chunk-K5T4RW27-B_ZUrFUq.js";import"./chunk-7N4EOEYR-BvMbitX7.js";import"./chunk-67CJDMHE-BG6-9r6c.js";import"./chunk-KGLVRYIC-CcWTvRlI.js";import"./chunk-FOC6F5B3-f9cFywhd.js";import"./chunk-AA7GKIK3-CE8mGBD5.js";import"./chunk-2KRD3SAO-Di4bO8ir.js";import"./chunk-ORNJ4GCN-B4Z5L25I.js";import"./chunk-LIHQZDEY-D-5-peQw.js";import"./chunk-CIAEETIT-VfnIdN-h.js";import{g as e,h as t}from"./src-B6XdH6xq.js";import{c as n}from"./chunk-ICPOFSXX-Bb8kEMah.js";import{t as r}from"./chunk-426QAEUC-WhvqbTM0.js";import{t as i}from"./mermaid-parser.core-4FY7A26h.js";var a={parse:t(async t=>{let n=await i(`info`,t);e.debug(n)},`parse`)},o={version:`11.14.0`},s={parser:a,db:{getVersion:t(()=>o.version,`getVersion`)},renderer:{draw:t((t,i,a)=>{e.debug(`rendering info diagram
1
+ import"./chunk-K5T4RW27-B_ZUrFUq.js";import"./chunk-7N4EOEYR-BvMbitX7.js";import"./chunk-67CJDMHE-BG6-9r6c.js";import"./chunk-KGLVRYIC-CcWTvRlI.js";import"./chunk-FOC6F5B3-f9cFywhd.js";import"./chunk-AA7GKIK3-CE8mGBD5.js";import"./chunk-2KRD3SAO-Di4bO8ir.js";import"./chunk-ORNJ4GCN-B4Z5L25I.js";import"./chunk-LIHQZDEY-D-5-peQw.js";import"./chunk-CIAEETIT-VfnIdN-h.js";import{g as e,h as t}from"./src-B6XdH6xq.js";import{c as n}from"./chunk-ICPOFSXX-Dkzg9o2N.js";import{t as r}from"./chunk-426QAEUC-BtRCmfDU.js";import{t as i}from"./mermaid-parser.core-Cg4ZdKp-.js";var a={parse:t(async t=>{let n=await i(`info`,t);e.debug(n)},`parse`)},o={version:`11.14.0`},s={parser:a,db:{getVersion:t(()=>o.version,`getVersion`)},renderer:{draw:t((t,i,a)=>{e.debug(`rendering info diagram
2
2
  `+t);let o=r(i);n(o,100,400,!0),o.append(`g`).append(`text`).attr(`x`,100).attr(`y`,40).attr(`class`,`version`).attr(`font-size`,32).style(`text-anchor`,`middle`).text(`v${a}`)},`draw`)}};export{s as diagram};
@@ -1,4 +1,4 @@
1
- import{h as e}from"./src-B6XdH6xq.js";import{B as t,C as n,V as r,W as i,_ as a,a as o,b as s,c,s as l,v as u}from"./chunk-ICPOFSXX-Bb8kEMah.js";import"./dist-Bd4S37oi.js";import{f as d}from"./chunk-5PVQY5BW-BwG8uJC1.js";import{t as f}from"./chunk-426QAEUC-WhvqbTM0.js";import{t as p}from"./rough.esm-DKRO8IF-.js";var m=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,14],i=[1,12],a=[1,13],o=[6,7,8],s=[1,20],c=[1,18],l=[1,19],u=[6,7,11],d=[1,6,13,14],f=[1,23],p=[1,24],m=[1,6,7,11,13,14],h={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`ISHIKAWA`,11:`EOF`,13:`SPACELIST`,14:`TEXT`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 15:r.addNode(a[s-1].length,a[s].trim());break;case 16:r.addNode(0,a[s].trim());break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:a},t(o,[2,3]),{1:[2,2]},t(o,[2,4]),t(o,[2,5]),{1:[2,6],6:r,12:15,13:i,14:a},{6:r,9:16,12:11,13:i,14:a},{6:s,7:c,10:17,11:l},t(u,[2,18],{14:[1,21]}),t(u,[2,16]),t(u,[2,17]),{6:s,7:c,10:22,11:l},{1:[2,7],6:r,12:15,13:i,14:a},t(d,[2,14],{7:f,11:p}),t(m,[2,8]),t(m,[2,9]),t(m,[2,10]),t(u,[2,15]),t(d,[2,13],{7:f,11:p}),t(m,[2,11]),t(m,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{h as e}from"./src-B6XdH6xq.js";import{B as t,C as n,V as r,W as i,_ as a,a as o,b as s,c,s as l,v as u}from"./chunk-ICPOFSXX-Dkzg9o2N.js";import"./dist-Bd4S37oi.js";import{f as d}from"./chunk-5PVQY5BW-SQD_EpYa.js";import{t as f}from"./chunk-426QAEUC-BtRCmfDU.js";import{t as p}from"./rough.esm-DKRO8IF-.js";var m=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,14],i=[1,12],a=[1,13],o=[6,7,8],s=[1,20],c=[1,18],l=[1,19],u=[6,7,11],d=[1,6,13,14],f=[1,23],p=[1,24],m=[1,6,7,11,13,14],h={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`ISHIKAWA`,11:`EOF`,13:`SPACELIST`,14:`TEXT`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 15:r.addNode(a[s-1].length,a[s].trim());break;case 16:r.addNode(0,a[s].trim());break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:a},t(o,[2,3]),{1:[2,2]},t(o,[2,4]),t(o,[2,5]),{1:[2,6],6:r,12:15,13:i,14:a},{6:r,9:16,12:11,13:i,14:a},{6:s,7:c,10:17,11:l},t(u,[2,18],{14:[1,21]}),t(u,[2,16]),t(u,[2,17]),{6:s,7:c,10:22,11:l},{1:[2,7],6:r,12:15,13:i,14:a},t(d,[2,14],{7:f,11:p}),t(m,[2,8]),t(m,[2,9]),t(m,[2,10]),t(u,[2,15]),t(d,[2,13],{7:f,11:p}),t(m,[2,11]),t(m,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};h.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{h as e,p as t}from"./src-B6XdH6xq.js";import{B as n,C as r,V as i,W as a,_ as o,a as s,b as c,c as l,v as u}from"./chunk-ICPOFSXX-Bb8kEMah.js";import"./dist-Bd4S37oi.js";import{t as d}from"./arc-DMDAZHAN.js";import{t as f}from"./chunk-FMBD7UC4-w-yBZsN2.js";import{a as p,n as m,o as h,s as g}from"./chunk-YZCP3GAM-BWgvd9aw.js";var _=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[6,8,10,11,12,14,16,17,18],r=[1,9],i=[1,10],a=[1,11],o=[1,12],s=[1,13],c=[1,14],l={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:`error`,4:`journey`,6:`EOF`,8:`SPACE`,10:`NEWLINE`,11:`title`,12:`acc_title`,13:`acc_title_value`,14:`acc_descr`,15:`acc_descr_value`,16:`acc_descr_multiline_value`,17:`section`,18:`taskName`,19:`taskData`},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 2:this.$=[];break;case 3:a[s-1].push(a[s]),this.$=a[s-1];break;case 4:case 5:this.$=a[s];break;case 6:case 7:this.$=[];break;case 8:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 9:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 10:case 11:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 12:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 13:r.addTask(a[s-1],a[s]),this.$=`task`;break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},t(n,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:i,14:a,16:o,17:s,18:c},t(n,[2,7],{1:[2,1]}),t(n,[2,3]),{9:15,11:r,12:i,14:a,16:o,17:s,18:c},t(n,[2,5]),t(n,[2,6]),t(n,[2,8]),{13:[1,16]},{15:[1,17]},t(n,[2,11]),t(n,[2,12]),{19:[1,18]},t(n,[2,4]),t(n,[2,9]),t(n,[2,10]),t(n,[2,13])],defaultActions:{},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{h as e,p as t}from"./src-B6XdH6xq.js";import{B as n,C as r,V as i,W as a,_ as o,a as s,b as c,c as l,v as u}from"./chunk-ICPOFSXX-Dkzg9o2N.js";import"./dist-Bd4S37oi.js";import{t as d}from"./arc-DMDAZHAN.js";import{t as f}from"./chunk-FMBD7UC4-w-yBZsN2.js";import{a as p,n as m,o as h,s as g}from"./chunk-YZCP3GAM-Bl5jBOt5.js";var _=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[6,8,10,11,12,14,16,17,18],r=[1,9],i=[1,10],a=[1,11],o=[1,12],s=[1,13],c=[1,14],l={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:`error`,4:`journey`,6:`EOF`,8:`SPACE`,10:`NEWLINE`,11:`title`,12:`acc_title`,13:`acc_title_value`,14:`acc_descr`,15:`acc_descr_value`,16:`acc_descr_multiline_value`,17:`section`,18:`taskName`,19:`taskData`},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 2:this.$=[];break;case 3:a[s-1].push(a[s]),this.$=a[s-1];break;case 4:case 5:this.$=a[s];break;case 6:case 7:this.$=[];break;case 8:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 9:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 10:case 11:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 12:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 13:r.addTask(a[s-1],a[s]),this.$=`task`;break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},t(n,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:i,14:a,16:o,17:s,18:c},t(n,[2,7],{1:[2,1]}),t(n,[2,3]),{9:15,11:r,12:i,14:a,16:o,17:s,18:c},t(n,[2,5]),t(n,[2,6]),t(n,[2,8]),{13:[1,16]},{15:[1,17]},t(n,[2,11]),t(n,[2,12]),{19:[1,18]},t(n,[2,4]),t(n,[2,9]),t(n,[2,10]),t(n,[2,13])],defaultActions:{},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};l.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{g as e,h as t}from"./src-B6XdH6xq.js";import{$ as n,K as r,L as i,Q as a,b as o,d as s,tt as c}from"./chunk-ICPOFSXX-Bb8kEMah.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-BwG8uJC1.js";import{t as l}from"./chunk-426QAEUC-WhvqbTM0.js";import"./chunk-U2HBQHQK-D0mOjNKD.js";import{t as u}from"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-ZZ45TVLE-UFB_t9gw.js";import"./chunk-X2U36JSP-CQ7VnONI.js";import{a as d,c as f,i as p}from"./chunk-5FUZZQ4R-veZxFPER.js";import{n as m,t as h}from"./chunk-XPW4576I-m1Y_r88I.js";var g=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,13],i=[1,12],a=[1,15],o=[1,16],s=[1,20],c=[1,19],l=[6,7,8],u=[1,26],d=[1,24],f=[1,25],p=[6,7,11],m=[1,31],h=[6,7,11,24],g=[1,6,13,16,17,20,23],_=[1,35],v=[1,36],y=[1,6,7,11,13,16,17,20,23],b=[1,38],x={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`KANBAN`,11:`EOF`,13:`SPACELIST`,16:`ICON`,17:`CLASS`,20:`NODE_DSTART`,21:`NODE_DESCR`,22:`NODE_DEND`,23:`NODE_ID`,24:`SHAPE_DATA`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace(`Stop NL `);break;case 9:r.getLogger().trace(`Stop EOF `);break;case 11:r.getLogger().trace(`Stop NL2 `);break;case 12:r.getLogger().trace(`Stop EOF2 `);break;case 15:r.getLogger().info(`Node: `,a[s-1].id),r.addNode(a[s-2].length,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 16:r.getLogger().info(`Node: `,a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 17:r.getLogger().trace(`Icon: `,a[s]),r.decorateNode({icon:a[s]});break;case 18:case 23:r.decorateNode({class:a[s]});break;case 19:r.getLogger().trace(`SPACELIST`);break;case 20:r.getLogger().trace(`Node: `,a[s-1].id),r.addNode(0,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 21:r.getLogger().trace(`Node: `,a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 22:r.decorateNode({icon:a[s]});break;case 27:r.getLogger().trace(`node found ..`,a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 28:this.$={id:a[s],descr:a[s],type:0};break;case 29:r.getLogger().trace(`node found ..`,a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 30:this.$=a[s-1]+a[s];break;case 31:this.$=a[s];break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:r,9:22,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:u,7:d,10:23,11:f},e(p,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:c}),e(p,[2,19]),e(p,[2,21],{15:30,24:m}),e(p,[2,22]),e(p,[2,23]),e(h,[2,25]),e(h,[2,26]),e(h,[2,28],{20:[1,32]}),{21:[1,33]},{6:u,7:d,10:34,11:f},{1:[2,7],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},e(g,[2,14],{7:_,11:v}),e(y,[2,8]),e(y,[2,9]),e(y,[2,10]),e(p,[2,16],{15:37,24:m}),e(p,[2,17]),e(p,[2,18]),e(p,[2,20],{24:b}),e(h,[2,31]),{21:[1,39]},{22:[1,40]},e(g,[2,13],{7:_,11:v}),e(y,[2,11]),e(y,[2,12]),e(p,[2,15],{24:b}),e(h,[2,30]),{22:[1,41]},e(h,[2,27]),e(h,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{g as e,h as t}from"./src-B6XdH6xq.js";import{$ as n,K as r,L as i,Q as a,b as o,d as s,tt as c}from"./chunk-ICPOFSXX-Dkzg9o2N.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-SQD_EpYa.js";import{t as l}from"./chunk-426QAEUC-BtRCmfDU.js";import"./chunk-U2HBQHQK-CpQ3kzO0.js";import{t as u}from"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-ZZ45TVLE-CHtnptPS.js";import"./chunk-X2U36JSP-C2LkxroC.js";import{a as d,c as f,i as p}from"./chunk-5FUZZQ4R-iDI6Xu0U.js";import{n as m,t as h}from"./chunk-XPW4576I-m1Y_r88I.js";var g=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,13],i=[1,12],a=[1,15],o=[1,16],s=[1,20],c=[1,19],l=[6,7,8],u=[1,26],d=[1,24],f=[1,25],p=[6,7,11],m=[1,31],h=[6,7,11,24],g=[1,6,13,16,17,20,23],_=[1,35],v=[1,36],y=[1,6,7,11,13,16,17,20,23],b=[1,38],x={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`KANBAN`,11:`EOF`,13:`SPACELIST`,16:`ICON`,17:`CLASS`,20:`NODE_DSTART`,21:`NODE_DESCR`,22:`NODE_DEND`,23:`NODE_ID`,24:`SHAPE_DATA`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace(`Stop NL `);break;case 9:r.getLogger().trace(`Stop EOF `);break;case 11:r.getLogger().trace(`Stop NL2 `);break;case 12:r.getLogger().trace(`Stop EOF2 `);break;case 15:r.getLogger().info(`Node: `,a[s-1].id),r.addNode(a[s-2].length,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 16:r.getLogger().info(`Node: `,a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 17:r.getLogger().trace(`Icon: `,a[s]),r.decorateNode({icon:a[s]});break;case 18:case 23:r.decorateNode({class:a[s]});break;case 19:r.getLogger().trace(`SPACELIST`);break;case 20:r.getLogger().trace(`Node: `,a[s-1].id),r.addNode(0,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 21:r.getLogger().trace(`Node: `,a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 22:r.decorateNode({icon:a[s]});break;case 27:r.getLogger().trace(`node found ..`,a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 28:this.$={id:a[s],descr:a[s],type:0};break;case 29:r.getLogger().trace(`node found ..`,a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 30:this.$=a[s-1]+a[s];break;case 31:this.$=a[s];break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:r,9:22,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:u,7:d,10:23,11:f},e(p,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:c}),e(p,[2,19]),e(p,[2,21],{15:30,24:m}),e(p,[2,22]),e(p,[2,23]),e(h,[2,25]),e(h,[2,26]),e(h,[2,28],{20:[1,32]}),{21:[1,33]},{6:u,7:d,10:34,11:f},{1:[2,7],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},e(g,[2,14],{7:_,11:v}),e(y,[2,8]),e(y,[2,9]),e(y,[2,10]),e(p,[2,16],{15:37,24:m}),e(p,[2,17]),e(p,[2,18]),e(p,[2,20],{24:b}),e(h,[2,31]),{21:[1,39]},{22:[1,40]},e(g,[2,13],{7:_,11:v}),e(y,[2,11]),e(y,[2,12]),e(p,[2,15],{24:b}),e(h,[2,30]),{22:[1,41]},e(h,[2,27]),e(h,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};x.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`