@rubytech/create-maxy-code 0.1.97 → 0.1.99

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 (99) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
  3. package/payload/platform/plugins/founder-pack/.claude-plugin/plugin.json +8 -0
  4. package/payload/platform/plugins/founder-pack/skills/investor-data-room/SKILL.md +256 -0
  5. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/business-plan-template.md +61 -0
  6. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/compliance-research-checklist.md +53 -0
  7. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/data-room-structure.md +77 -0
  8. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/deck-blueprint-template.md +38 -0
  9. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/design-tokens-application.md +79 -0
  10. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/html-pdf-pipeline.md +236 -0
  11. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/internal-workings-scrub.md +33 -0
  12. package/payload/platform/plugins/founder-pack/skills/investor-data-room/references/termsheet-template.md +66 -0
  13. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  14. package/payload/platform/services/claude-session-manager/dist/http-server.js +79 -87
  15. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  16. package/payload/platform/services/claude-session-manager/scripts/stash-cleanup.sh +410 -0
  17. package/payload/premium-plugins/.claude-plugin/marketplace.json +5 -0
  18. package/payload/premium-plugins/founder-pack/.claude-plugin/plugin.json +8 -0
  19. package/payload/premium-plugins/founder-pack/skills/investor-data-room/SKILL.md +256 -0
  20. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/business-plan-template.md +61 -0
  21. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/compliance-research-checklist.md +53 -0
  22. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/data-room-structure.md +77 -0
  23. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/deck-blueprint-template.md +38 -0
  24. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/design-tokens-application.md +79 -0
  25. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/html-pdf-pipeline.md +236 -0
  26. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/internal-workings-scrub.md +33 -0
  27. package/payload/premium-plugins/founder-pack/skills/investor-data-room/references/termsheet-template.md +66 -0
  28. package/payload/server/public/assets/{ChatInput-CzQhPt90.css → ChatInput-u7hSrC3q.css} +1 -1
  29. package/payload/server/public/assets/{Checkbox-ynZtDWi3.js → Checkbox-CfiWjuMH.js} +1 -1
  30. package/payload/server/public/assets/{admin-WyIfDMQG.js → admin-D6VRETeg.js} +1 -1
  31. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-Ko_izKmY.js → architectureDiagram-Q4EWVU46-CSAyzBIK.js} +1 -1
  32. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-D58VDC0w.js → blockDiagram-DXYQGD6D-l_AoJo_I.js} +1 -1
  33. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-C-eRXyKi.js → c4Diagram-AHTNJAMY-Dsjc59iO.js} +1 -1
  34. package/payload/server/public/assets/channel-BlwH4wTf.js +1 -0
  35. package/payload/server/public/assets/{chunk-336JU56O-DZLEfLAb.js → chunk-336JU56O-BgAz-EJ4.js} +2 -2
  36. package/payload/server/public/assets/{chunk-426QAEUC-BriTU3L8.js → chunk-426QAEUC-DHF9zZlS.js} +1 -1
  37. package/payload/server/public/assets/{chunk-4TB4RGXK-BdxRL-AY.js → chunk-4TB4RGXK-Cqb1TREv.js} +1 -1
  38. package/payload/server/public/assets/{chunk-5FUZZQ4R-BgEmy7Y3.js → chunk-5FUZZQ4R-CV4WMN8u.js} +1 -1
  39. package/payload/server/public/assets/{chunk-5PVQY5BW-emnbDRLA.js → chunk-5PVQY5BW-CL0bAr0t.js} +1 -1
  40. package/payload/server/public/assets/{chunk-EDXVE4YY-BvCf2Xf2.js → chunk-EDXVE4YY-WY3Sg1Fq.js} +1 -1
  41. package/payload/server/public/assets/{chunk-ENJZ2VHE-DTpEYJRb.js → chunk-ENJZ2VHE-BIVdDrD2.js} +1 -1
  42. package/payload/server/public/assets/{chunk-ICPOFSXX-Ced2j48Y.js → chunk-ICPOFSXX-CUHDQxso.js} +1 -1
  43. package/payload/server/public/assets/{chunk-OYMX7WX6-B21_a3Dv.js → chunk-OYMX7WX6-D1sj6R4f.js} +1 -1
  44. package/payload/server/public/assets/{chunk-U2HBQHQK-CPS3yyXK.js → chunk-U2HBQHQK-BGso49fW.js} +1 -1
  45. package/payload/server/public/assets/{chunk-X2U36JSP-BJ_B5NW7.js → chunk-X2U36JSP-C2tUGTcL.js} +1 -1
  46. package/payload/server/public/assets/{chunk-YZCP3GAM-CMLy-WXm.js → chunk-YZCP3GAM-CLvYLDvo.js} +1 -1
  47. package/payload/server/public/assets/{chunk-ZZ45TVLE-BkLnzCHe.js → chunk-ZZ45TVLE-yHQe8STh.js} +1 -1
  48. package/payload/server/public/assets/classDiagram-6PBFFD2Q-DuEhfP67.js +1 -0
  49. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-zSqemF--.js +1 -0
  50. package/payload/server/public/assets/clone-DUSqJbTD.js +1 -0
  51. package/payload/server/public/assets/{dagre-KV5264BT-RY0E5UAn.js → dagre-KV5264BT-Df1MO_DJ.js} +1 -1
  52. package/payload/server/public/assets/{dagre-Dd_gq4yj.js → dagre-fQyUaxmN.js} +1 -1
  53. package/payload/server/public/assets/data-BFHNkj3Y.js +1 -0
  54. package/payload/server/public/assets/{diagram-5BDNPKRD-DR7XiPLh.js → diagram-5BDNPKRD-E3qTf9lX.js} +1 -1
  55. package/payload/server/public/assets/{diagram-G4DWMVQ6-2EbOfKFs.js → diagram-G4DWMVQ6-DCV-gR0I.js} +1 -1
  56. package/payload/server/public/assets/{diagram-MMDJMWI5-CGcY0Ze7.js → diagram-MMDJMWI5-CZKwrxSp.js} +1 -1
  57. package/payload/server/public/assets/{diagram-TYMM5635-Dk6MmAso.js → diagram-TYMM5635-ClXOl5De.js} +1 -1
  58. package/payload/server/public/assets/{erDiagram-SMLLAGMA-CKvdlUqk.js → erDiagram-SMLLAGMA-v2-MNn-e.js} +1 -1
  59. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-BqKhvCDz.js → flowDiagram-DWJPFMVM-CDFzDH-2.js} +1 -1
  60. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-CeiE-IRb.js → ganttDiagram-T4ZO3ILL-DEA-33qn.js} +1 -1
  61. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-BbPKn7v2.js → gitGraphDiagram-UUTBAWPF-lLy_eZzu.js} +1 -1
  62. package/payload/server/public/assets/graph-Df2aJN0a.js +1 -0
  63. package/payload/server/public/assets/{graph-labels-BzMN9eev.js → graph-labels-CCTdQ2Vi.js} +1 -1
  64. package/payload/server/public/assets/{graphlib-tG6kR59B.js → graphlib-B6Y7yD4A.js} +1 -1
  65. package/payload/server/public/assets/{infoDiagram-42DDH7IO-6MiRGCI1.js → infoDiagram-42DDH7IO-D-Pm-tYB.js} +1 -1
  66. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-BwY4p5mg.js → ishikawaDiagram-UXIWVN3A-DVHkDPv1.js} +1 -1
  67. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-BXAQ_fUi.js → journeyDiagram-VCZTEJTY-CsxM47ah.js} +1 -1
  68. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-ChiiO7Yt.js → kanban-definition-6JOO6SKY-C7EYwNjH.js} +1 -1
  69. package/payload/server/public/assets/{lib-DbPz9cfu.js → lib-iH6Mg9EP.js} +1 -1
  70. package/payload/server/public/assets/{line-B5g5OrOD.js → line-CvBly01q.js} +1 -1
  71. package/payload/server/public/assets/{mermaid-parser.core-BMGzMKJx.js → mermaid-parser.core-D32akjeh.js} +1 -1
  72. package/payload/server/public/assets/{mermaid.core-DLMgkjXn.js → mermaid.core-B3O4X8ja.js} +3 -3
  73. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-BvyzRLAi.js → mindmap-definition-QFDTVHPH-yreoqnSK.js} +1 -1
  74. package/payload/server/public/assets/{page-D93GZ3YQ.js → page-BVuuY21i.js} +1 -1
  75. package/payload/server/public/assets/{page--nZ_z-z7.js → page-Dc2CtJkh.js} +1 -1
  76. package/payload/server/public/assets/{pieDiagram-DEJITSTG--EV9pVfs.js → pieDiagram-DEJITSTG-DEYXlFD5.js} +1 -1
  77. package/payload/server/public/assets/{public-sYW0Dwku.js → public-DknvBIqv.js} +3 -3
  78. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-DJcL08ft.js → quadrantDiagram-34T5L4WZ-CVTVYl5c.js} +1 -1
  79. package/payload/server/public/assets/{requirementDiagram-MS252O5E-D4VdmmSu.js → requirementDiagram-MS252O5E-D438ZRqW.js} +1 -1
  80. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-Dsw3nHRS.js → sankeyDiagram-XADWPNL6-B2Hs1q9K.js} +1 -1
  81. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-CAgemUx5.js → sequenceDiagram-FGHM5R23-BqRHtAoK.js} +1 -1
  82. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-B7dyL9_X.js → stateDiagram-FHFEXIEX-ILOj6_TV.js} +1 -1
  83. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-B2cQBKI1.js +1 -0
  84. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-B7iKswhp.js → timeline-definition-GMOUNBTQ-D-uskEEs.js} +1 -1
  85. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-uFS0i1qX.js → vennDiagram-DHZGUBPP-DJjaoR79.js} +1 -1
  86. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-lDUh4LAD.js → wardleyDiagram-NUSXRM2D-B1EO_5jp.js} +1 -1
  87. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-0v7MEVwW.js → xychartDiagram-5P7HB3ND-CQnz0KUb.js} +1 -1
  88. package/payload/server/public/data.html +5 -5
  89. package/payload/server/public/graph.html +6 -6
  90. package/payload/server/public/index.html +8 -8
  91. package/payload/server/public/public.html +5 -5
  92. package/payload/server/public/assets/channel-CejaITMF.js +0 -1
  93. package/payload/server/public/assets/classDiagram-6PBFFD2Q-BmoqALf4.js +0 -1
  94. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-vMajwCNi.js +0 -1
  95. package/payload/server/public/assets/clone-mvVfHkyg.js +0 -1
  96. package/payload/server/public/assets/data-D2aPJB7w.js +0 -1
  97. package/payload/server/public/assets/graph-B5UWg8zV.js +0 -1
  98. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CImN6Wk6.js +0 -1
  99. /package/payload/server/public/assets/{ChatInput-Cj9JQtYt.js → ChatInput-BmmxQOhM.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-Cj9JQtYt.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`}]]),ee=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`}]]),te=p(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),ne=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`}]]),re=p(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),O=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`}]]),k=p(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),A=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`}]]),ie=p(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ae=p(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),oe=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`}]]),j=p(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),M=e(m(),1),N=i(),se=`maxy-shell-side-px`;function ce(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function P(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-ce());return Math.min(Math.max(e,248),n)}function le(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(se);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return P(t)}catch{}return 264}function F({targetSelector:e=`.platform`}){let t=(0,M.useRef)(null),[n,r]=(0,M.useState)(()=>le()),i=(0,M.useRef)(n);(0,M.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,M.useCallback)(()=>{r(e=>{let t=P(e);return t===e?e:t})},[]);(0,M.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(P(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(se,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=P(264);r(e);try{window.localStorage.removeItem(se)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,N.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var ue=!1;function de(){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 I(){let e=typeof crypto<`u`&&typeof crypto.randomUUID==`function`;if(!ue){ue=!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():de()}function fe(e){let t=e.trim();return t.length>=1&&t.length<=200}function L(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 pe=/session_([A-Za-z0-9_-]+)/;function R(e){if(!e)return null;let t=e.match(pe);return t?t[1]:null}async function me(e,t,n,r,i){let a=R(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 he(e,t,n=`pane`){let[r,i]=(0,M.useState)(null),a=(0,M.useRef)(!1),o=(0,M.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};if(a.current)return L(n,`resume`,r,`skipped-in-flight`),{ok:!1,error:`in-flight`};a.current=!0,i(`resume`);let o=I();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 L(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),L(n,`resume`,r,`200`),me(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return L(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{a.current=!1,i(null)}},[e,t,n]),s=(0,M.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 L(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`POST /stop ${i.status} ${e.slice(0,200)}`}}return L(n,`end`,r,`204`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return L(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),c=(0,M.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 L(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),L(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return L(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),l=(0,M.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 L(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),L(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return L(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),u=(0,M.useCallback)(e=>l(e,`archive`),[l]),d=(0,M.useCallback)(e=>l(e,`unarchive`),[l]),f=(0,M.useCallback)(async n=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`promote-and-resume`);let r=e=>e.slice(0,8),a=null;try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/promote?session_key=${encodeURIComponent(e)}`,{method:`POST`}),o=await i.json().catch(()=>({}));if(console.info(`[admin-ui] promote-and-resume sessionId=${r(n)} step=promote outcome=${i.status}`),!i.ok||typeof o.canonicalSessionId!=`string`){let e=o.detail||o.error||`POST /promote ${i.status}`;return i.status!==200&&t.refetch(),{ok:!1,error:e}}a=o.canonicalSessionId;let s=I(),c=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:a,channel:`browser`,idempotencyKey:s})}),l=await c.json().catch(()=>({}));if(console.info(`[admin-ui] promote-and-resume sessionId=${r(n)} uuid=${r(a)} step=resume outcome=${c.status}`),!c.ok||!(`sessionId`in l)){let e=l.error??`POST /resume ${c.status}`;return t.refetch(),{ok:!1,error:e,canonicalSessionId:a}}return t.setSessions(e=>[l,...e.filter(e=>e.sessionId!==n&&e.sessionId!==a)]),t.refetch(),{ok:!0,canonicalSessionId:a}}catch(e){let i=e instanceof Error?e.message:String(e);return console.error(`[admin-ui] promote-and-resume sessionId=${r(n)} outcome=threw detail=${i}`),t.refetch(),{ok:!1,error:i,canonicalSessionId:a??void 0}}finally{i(null)}},[e,t]);return{inFlight:r,resume:o,end:s,purge:c,archive:u,unarchive:d,rename:(0,M.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 L(n,`rename`,t,String(i.status)),{ok:!1,error:r,reason:e.reason}}return L(n,`rename`,t,`200`),{ok:!0}}catch(e){let r=e instanceof Error?e.message:String(e);return L(n,`rename`,t,`threw`),{ok:!1,error:r}}finally{i(null)}},[e,n]),promoteAndResume:f}}var z=/^[a-f0-9-]{36}\.\d{13}$/;function ge(e){return z.test(e)}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 _e(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(B(e),JSON.stringify([...t]))}catch{}}function ve(e){let[t,n]=(0,M.useState)(()=>V(e));(0,M.useEffect)(()=>{n(V(e))},[e]);let r=(0,M.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),_e(e,r),r})},[e]);return{pinned:t,isPinned:(0,M.useCallback)(e=>t.has(e),[t]),togglePin:r}}function ye(e){let{businessName:i,onLaunchBrowser:o,onNavigate:s,onToggleSidebar:l,sidebarOpen:u,onLogout:d,browserLaunching:f}=e,[p,m]=(0,M.useState)(!1),h=(0,M.useRef)(null),g=(0,M.useRef)(null),[_,v]=(0,M.useState)(null),[y,C]=(0,M.useState)(!1),[D,ne]=(0,M.useState)(null),[re,O]=(0,M.useState)(null),[k,ie]=(0,M.useState)(null),[ae,oe]=(0,M.useState)(``);(0,M.useEffect)(()=>{oe(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,M.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,M.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&m(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]),(0,M.useEffect)(()=>{p&&g.current?.focus()},[p]),(0,M.useEffect)(()=>{if(!p)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||ie(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[p]);let se=(0,M.useCallback)(()=>{m(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),ce=(0,M.useCallback)(()=>{m(!1),o()},[o]),P=(0,M.useCallback)(e=>{m(!1),s(e)},[s]),le=(0,M.useCallback)(async()=>{if(_!==null){v(null),O(null);return}C(!0),ne(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),ne(e instanceof Error?e.message:String(e)),v([])}finally{C(!1)}},[_]),F=(0,M.useCallback)(e=>{O(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))},[]),ue=(0,M.useCallback)(()=>{m(!1),d()},[d]),de=i||n.productName;return(0,N.jsxs)(`header`,{className:`admin-header`,children:[(0,N.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,N.jsx)(ee,{size:20,strokeWidth:1.5}):(0,N.jsx)(te,{size:20,strokeWidth:1.5})}),(0,N.jsxs)(`div`,{className:`chat-header-label`,children:[(0,N.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,N.jsx)(`img`,{src:r,alt:``,className:`chat-logo`})}),(0,N.jsx)(`h1`,{className:`chat-tagline`,children:de})]}),(0,N.jsxs)(`div`,{className:`chat-burger-wrap`,ref:h,children:[(0,N.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:se,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":p,children:(0,N.jsx)(E,{size:20})}),p&&(0,N.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,N.jsxs)(`button`,{ref:g,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ce,disabled:f,children:[(0,N.jsx)(c,{size:14}),` Browser`,f&&(0,N.jsx)(w,{size:12,className:`spin`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>P(`data`),children:[(0,N.jsx)(b,{size:14}),` Data`]}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>P(`graph`),children:[(0,N.jsx)(A,{size:14}),` Graph`]}),(0,N.jsx)(`div`,{className:`chat-menu-divider`}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:le,children:[(0,N.jsx)(x,{size:14}),` Public`,y&&(0,N.jsx)(w,{size:12,className:`spin`})]}),_!==null&&(0,N.jsxs)(`div`,{className:`chat-menu-agents`,children:[D&&(0,N.jsx)(`span`,{className:`chat-menu-agent-error`,children:D}),_.length===0&&!D&&(0,N.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),_.map(e=>(0,N.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,N.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,N.jsxs)(`span`,{className:`agent-text`,children:[(0,N.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,N.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),re===e.slug?(0,N.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,N.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>F(e.slug),children:(0,N.jsx)(t,{size:12})}),(0,N.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>O(null),children:(0,N.jsx)(j,{size:12})})]}):(0,N.jsxs)(`span`,{className:`agent-actions`,children:[(0,N.jsx)(`a`,{href:`${ae}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>m(!1),children:(0,N.jsx)(x,{size:12})}),(0,N.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>O(e.slug),children:(0,N.jsx)(a,{size:12})})]})]},e.slug))]}),(0,N.jsx)(`div`,{className:`chat-menu-divider`}),(0,N.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,N.jsx)(S,{size:14}),(0,N.jsxs)(`span`,{className:`version-installed`,children:[k?`v${k.installed}`:`…`,k&&!k.updateAvailable&&(0,N.jsx)(`span`,{className:`version-uptodate-dot`}),k?.updateAvailable&&(0,N.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ue,children:[(0,N.jsx)(T,{size:14}),` Log out`]})]})]})]})}var be=`maxy-admin-session`,H=typeof BroadcastChannel<`u`;function xe(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 Se(e){if(!H)return()=>{};let t=new BroadcastChannel(be),n=t=>{if(!xe(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 U=`maxy-admin-session-key`;function W(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function Ce(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 we(){try{return sessionStorage.getItem(U)}catch{return null}}function Te(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,M.useState)(t),a=(0,M.useRef)(t);(0,M.useEffect)(()=>{a.current=r},[r]),(0,M.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,M.useState)(0),[c,l]=(0,M.useState)(null);(0,M.useEffect)(()=>Se(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,M.useCallback)(()=>{try{sessionStorage.removeItem(U)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,M.useCallback)(async(e,t)=>{let r=a.current,o=W(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await Ce(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=we();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=W(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 Ee=`/api/admin/claude-sessions/events`,G=`admin-session-list-view`,K=`admin-session-list-include-subagents`,De=`admin-session-list-include-background`;function Oe(e){return e===`active`||e===`archived`||e===`all`}function q(){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=W(Ee,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 Ce(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(G);Oe(t)&&(e={...e,view:t});let n=window.localStorage.getItem(K);if(n===null){let e=window.localStorage.getItem(De);e!==null&&(window.localStorage.setItem(K,e),window.localStorage.removeItem(De),n=e,console.info(`[admin-ui] session-list-storage-migrated from=${De} to=${K} value=${e}`))}n===`1`&&(e={...e,includeBackground:!0})}catch{}}function v(t){e={...e,view:t};try{window.localStorage.setItem(G,t)}catch{}d()}function y(t){e={...e,includeBackground:t};try{window.localStorage.setItem(K,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 J=q();J._injectEventForTesting,J.connect,J._setConnectedForTesting,J.getSnapshot,J.reconcileFromList;function ke(e){let t=(0,M.useSyncExternalStore)(J.subscribe,J.getSnapshot,J.getSnapshot);(0,M.useEffect)(()=>{e&&J.connect(e)},[e]);let n=(0,M.useCallback)(e=>J.setView(e),[]),r=(0,M.useCallback)(e=>J.setIncludeBackground(e),[]),i=(0,M.useCallback)(()=>J.reconnectNow(),[]),a=(0,M.useCallback)(e=>J.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 Y=6e4,je=60*Y,Me=24*je,Ne=Y,Pe=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Fe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Ie(e){return e<10?`0${e}`:String(e)}function Le(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Re(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-Ne)return`—`;let r=n<0?0:n;if(r<Y)return`just now`;if(r<je)return`${Math.floor(r/Y)}m`;if(r<Me)return`${Math.floor(r/je)}h`;let i=new Date(t),a=new Date(e),o=Math.round((Le(i)-Le(a))/Me);if(o===1)return`yesterday`;if(o>=2&&o<=6)return Fe[a.getDay()];let s=Ie(a.getDate()),c=Pe[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}function ze(e=3e4){let[t,n]=(0,M.useState)(()=>Date.now());return(0,M.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var X={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Z=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],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,M.useState)(``),[f,p]=(0,M.useState)(e),[m,h]=(0,M.useState)(n),[g,_]=(0,M.useState)(!1),[v,b]=(0,M.useState)(!1),x=(0,M.useRef)(null),S=(0,M.useRef)(null),C=(0,M.useRef)(null);(0,M.useEffect)(()=>{x.current?.focus()},[]),(0,M.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,M.useEffect)(()=>{if(!g&&!v)return;function e(e){g&&S.current&&!S.current.contains(e.target)&&_(!1),v&&C.current&&!C.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[g,v]);let T=l.trim(),E=T.length>0&&!r,D=(0,M.useCallback)(()=>{if(T.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,T,r,a]);function ee(e){e.preventDefault(),D()}let te=Be.find(e=>e.value===m)?.label??`Default`;return(0,N.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,N.jsxs)(`div`,{className:`new-session-modal`,children:[(0,N.jsx)(`h2`,{id:`new-session-modal-title`,className:`new-session-modal-title`,children:`New session`}),(0,N.jsxs)(`form`,{className:`new-session-modal-form`,onSubmit:ee,children:[(0,N.jsx)(`div`,{className:`chat-form`,children:(0,N.jsx)(d,{ref:x,value:l,onChange:e=>{u(e),i&&c()},placeholder:`What should this session do?`,disabled:r})}),i&&(0,N.jsx)(`div`,{className:`tunnel-route__error`,role:`alert`,children:i}),(0,N.jsxs)(`div`,{className:`new-session-modal-actions`,children:[(0,N.jsxs)(`div`,{className:`new-session-modal-pickers`,children:[(0,N.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:S,children:[(0,N.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:[X[f],(0,N.jsx)(o,{size:12,"aria-hidden":`true`})]}),g&&(0,N.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,N.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,N.jsx)(`span`,{children:`Mode`})}),Z.map((e,n)=>(0,N.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] new-session-modal-mode-change from=${f} to=${e} trigger=click`),p(e),_(!1)},children:[(0,N.jsx)(`span`,{children:X[e]}),(0,N.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===f&&(0,N.jsx)(t,{size:12}),(0,N.jsx)(`span`,{children:n+1})]})]},e))]})]}),(0,N.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:C,children:[(0,N.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:[te,(0,N.jsx)(o,{size:12,"aria-hidden":`true`})]}),v&&(0,N.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Model`,children:[(0,N.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,N.jsx)(`span`,{children:`Model`})}),Be.map(e=>(0,N.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,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{className:`side-mode-popover-shortcut`,children:e.value===m&&(0,N.jsx)(t,{size:12})})]},e.label))]})]})]}),(0,N.jsxs)(`div`,{className:`new-session-modal-buttons`,children:[(0,N.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:()=>s(`button`),disabled:r,children:`Cancel`}),(0,N.jsx)(`button`,{type:`submit`,className:`new-session-modal-submit`,disabled:!E,"aria-label":`Send`,children:r?(0,N.jsx)(w,{size:14,className:`spinning`}):(0,N.jsx)(y,{size:14})})]})]})]})]})})}var He=1e4,Ue=(0,M.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:ee,onSelectAgents:te,onCloseMobileDrawer:k,onSelectSession:A,selectedSessionId:j,collapsed:se,mobileDrawerOpen:ce,recentsActions:P}=e,[le,F]=(0,M.useState)(null),[ue,de]=(0,M.useState)(null),[I,L]=(0,M.useState)(!1);(0,M.useEffect)(()=>{b()},[b]);let pe=(0,M.useRef)(null),[R,me]=(0,M.useState)(!1),[z,B]=(0,M.useState)(`default`),[V,_e]=(0,M.useState)(void 0),ye=(0,M.useRef)(null),[be,H]=(0,M.useState)(null),[xe,Se]=(0,M.useState)(!1),U=(0,M.useRef)(0),W=(0,M.useRef)(new Map),Ce=n.productName,we=typeof d==`string`?d:d===null?`name unavailable`:i||Ce,Te=(we.trim().charAt(0)||`?`).toUpperCase(),Ee=ve(n.hostname),G=ke(c),K=(0,M.useMemo)(()=>{let e=Ae(G.rows,G.view,G.includeBackground);if(Ee.pinned.size===0)return e;let t=[],n=[];for(let r of e)(Ee.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[G.rows,G.view,G.includeBackground,Ee.pinned]),De=K.length,Oe=ze(3e4);(0,M.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,M.useEffect)(()=>{let e=W.current;return()=>{for(let{timeoutId:t}of e.values())clearTimeout(t);e.clear()}},[]);let[q,J]=(0,M.useState)(`chat`),[Y,je]=(0,M.useState)([]),[Me,Ne]=(0,M.useState)(!1),[Pe,Fe]=(0,M.useState)(null),[Ie,Le]=(0,M.useState)(!1);(0,M.useImperativeHandle)(r,()=>({patchArtefact(e,t){je(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[X,Z]=(0,M.useState)(!1),Be=(0,M.useRef)(null),Ue={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},We=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`];(0,M.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;B(i),_e(a),ye.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 Je=(0,M.useCallback)(async(e,t)=>{if(!c||!ye.current)return;let n=ye.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}`);ye.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}`),B(n.permissionMode),_e(n.model)}},[c]);(0,M.useEffect)(()=>{if(!X)return;function e(e){Be.current&&!Be.current.contains(e.target)&&(console.info(`[admin-ui] sidebar-mode-picker action=close mode=${z}`),Z(!1))}function t(e){if(e.key===`Escape`){console.info(`[admin-ui] sidebar-mode-picker action=close mode=${z}`),Z(!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`),B(n),Z(!1),Je({permissionMode:n,model:V},`sidebar`))}}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[X,z,V,Je]),(0,M.useEffect)(()=>{function e(e){e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.key===`m`||e.key===`M`)&&(e.preventDefault(),Z(e=>{let t=!e;return console.info(`[admin-ui] sidebar-mode-picker action=${t?`open`:`close`} mode=${z} via=shortcut`),t}))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[z]);let Ye=(0,M.useCallback)(async()=>{if(c){Le(!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{Le(!1)}}},[c]),Xe=()=>{J(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${De}`)},Ze=()=>{J(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Me?Y.length:0} collapsed=${se}`),Me||Ye()},Q=1.5,Qe=q===`chat`?`Sessions`:`Artefacts`,$e=q===`chat`?m?`…`:String(De):Ie?`…`:String(Y.length),et=q===`chat`?m:Ie,tt=()=>{console.info(`[admin-ui] sidebar-refresh surface=${q}`),q===`chat`?S().then(e=>{e!==null&&G.reconcileFromList(e.map(e=>e.sessionId))}):Ye()},nt=(0,M.useCallback)(()=>{if(R||!c){console.info(`[admin-ui] sidebar-new-session-click-ignored startingSession=${R} cacheKey=${c?`set`:`missing`}`);return}H(null),U.current=Date.now(),console.info(`[admin-ui] sidebar-new-session-modal-open seedMode=${z} cacheKey-prefix=${c.slice(0,8)}`),Se(!0)},[c,R,z]),rt=(0,M.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),Se(!1)},[]),it=(0,M.useCallback)(async e=>{if(R||!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}`),me(!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}`),P.setSessions(e=>[a,...e]),Se(!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}`),A(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{me(!1)}},[c,R,P,A]),$=he(c,P,`sidebar`),at=(0,M.useCallback)(async e=>{let t=await $.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[$]),ot=(0,M.useCallback)(async e=>{L(!0),de(null);let t=await $.purge(e);t.ok?F(null):de(t.error??`purge failed`),L(!1)},[$]),st=(0,M.useCallback)(async e=>{let t=await $.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[$]),ct=(0,M.useCallback)(async e=>{let t=await $.archive(e);t.ok||console.error(`[admin-ui] sidebar-archive failed: ${t.error}`)},[$]),lt=(0,M.useCallback)(async e=>{let t=await $.unarchive(e);t.ok||console.error(`[admin-ui] sidebar-unarchive failed: ${t.error}`)},[$]),ut=(0,M.useCallback)(async e=>{let t=await $.promoteAndResume(e);if(!t.ok){console.error(`[admin-ui] sidebar-promote-and-resume failed sessionId=${e.slice(0,8)} error=${t.error??`unknown`}`);return}t.canonicalSessionId&&A(t.canonicalSessionId)},[$,A]),[dt,ft]=(0,M.useState)(null),[pt,mt]=(0,M.useState)(``),ht=(0,M.useCallback)(async(e,t)=>{let n=pt.trim();if(n.length===0||!fe(n)){ft(null);return}if(n===(t??``)){ft(null);return}let r=await $.rename(e,n);r.ok||console.error(`[admin-ui] sidebar-rename failed: ${r.error}`),ft(null)},[pt,$]),gt=(0,M.useCallback)(()=>{ft(null)},[]);return(0,N.jsxs)(`aside`,{className:`side`,children:[q===`chat`&&(0,N.jsxs)(`div`,{className:`side-new-session-row`,ref:Be,children:[(0,N.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:nt,disabled:R||!c,children:[R?(0,N.jsx)(w,{size:14,className:`spinning`}):(0,N.jsx)(re,{size:14}),(0,N.jsx)(`span`,{children:`New session`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!X;console.info(`[admin-ui] sidebar-mode-picker action=${e?`open`:`close`} mode=${z}`),Z(e)},disabled:R,"aria-haspopup":`menu`,"aria-expanded":X,"aria-label":`Permission mode for the next session`,title:`Shift+Cmd+M`,children:[Ue[z],(0,N.jsx)(o,{size:12,"aria-hidden":`true`})]}),X&&(0,N.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,N.jsxs)(`div`,{className:`side-mode-popover-head`,children:[(0,N.jsx)(`span`,{children:`Mode`}),(0,N.jsx)(`span`,{className:`side-mode-popover-shortcut`,"aria-hidden":`true`,children:`⇧⌘M`})]}),We.map((e,n)=>(0,N.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] sidebar-mode-picker action=select mode=${e}`),B(e),Z(!1),Je({permissionMode:e,model:V},`sidebar`)},children:[(0,N.jsx)(`span`,{children:Ue[e]}),(0,N.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===z&&(0,N.jsx)(t,{size:12}),(0,N.jsx)(`span`,{children:n+1})]})]},e))]})]}),(0,N.jsxs)(`nav`,{className:`side-nav`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`nav-row${q===`chat`?` active`:``}`,onClick:Xe,children:[(0,N.jsx)(ae,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),D(),k()},children:[(0,N.jsx)(oe,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`People`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),te(),k()},children:[(0,N.jsx)(_,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Agents`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),E(),k()},children:[(0,N.jsx)(v,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Projects`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),ee(),k()},children:[(0,N.jsx)(C,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row${q===`artefacts`?` active`:``}`,onClick:Ze,children:[(0,N.jsx)(s,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,N.jsx)(`span`,{className:`kbd`})]})]}),(0,N.jsxs)(`div`,{className:`side-list`,ref:pe,children:[(0,N.jsxs)(`div`,{className:`group-head`,children:[(0,N.jsx)(`span`,{children:Qe}),(0,N.jsxs)(`span`,{className:`group-head-meta`,children:[(0,N.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${Qe.toLowerCase()}`,"aria-label":`Refresh ${Qe.toLowerCase()}`,onClick:tt,disabled:et,children:(0,N.jsx)(O,{size:12,className:et?`spinning`:void 0})}),(0,N.jsx)(`span`,{children:$e})]})]}),q===`chat`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Ge,{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,N.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:y}),K.map(e=>{let t=j===e.sessionId,n=dt===e.sessionId;return(0,N.jsxs)(`div`,{className:`conv${t?` active`:``}`,children:[n?(0,N.jsxs)(`span`,{className:`conv-name-line`,style:{flex:1,minWidth:0},children:[(0,N.jsx)(ae,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,N.jsx)(Ke,{live:e.live,status:e.status}),(0,N.jsx)(`input`,{type:`text`,value:pt,autoFocus:!0,maxLength:200,onChange:e=>mt(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),ht(e.sessionId,e.firstPrompt)):t.key===`Escape`&&(t.preventDefault(),gt())},onBlur:()=>{ht(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,N.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{A(e.sessionId),k()},title:`Show metadata`,children:[(0,N.jsxs)(`span`,{className:`conv-name-line`,children:[(0,N.jsx)(ae,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,N.jsx)(Ke,{live:e.live,status:e.status}),e.firstPrompt?(0,N.jsx)(`span`,{className:`conv-name`,children:e.firstPrompt}):(0,N.jsxs)(`span`,{className:`conv-name`,style:{fontStyle:`italic`,opacity:.6},children:[`(unnamed · `,e.sessionId.slice(0,8),`)`]})]}),(0,N.jsx)(`span`,{className:`conv-timestamp`,children:Re(e.updatedAt,Oe)})]}),!n&&(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Rename`,"aria-label":`Rename session`,onClick:()=>{mt(e.firstPrompt??``),ft(e.sessionId)},children:(0,N.jsx)(ne,{size:13})}),e.url!==null&&(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>qe(e.url,e.sessionId),children:(0,N.jsx)(x,{size:13})}),e.live?(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void st(e.sessionId),disabled:$.inFlight===`end`,children:$.inFlight===`end`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(ie,{size:13})}):e.archived?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Unarchive session`,"aria-label":`Unarchive session`,onClick:()=>void lt(e.sessionId),disabled:$.inFlight===`unarchive`,children:$.inFlight===`unarchive`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(h,{size:13})}),(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{de(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,N.jsx)(a,{size:13})})]}):(0,N.jsxs)(N.Fragment,{children:[ge(e.sessionId)?(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Promote & resume session`,"aria-label":`Promote and resume session`,onClick:()=>void ut(e.sessionId),disabled:$.inFlight===`promote-and-resume`,children:$.inFlight===`promote-and-resume`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(l,{size:13})}):(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void at(e.sessionId),disabled:$.inFlight===`resume`,children:$.inFlight===`resume`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(l,{size:13})}),(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Archive session`,"aria-label":`Archive session`,onClick:()=>void ct(e.sessionId),disabled:$.inFlight===`archive`,children:$.inFlight===`archive`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(g,{size:13})}),(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{de(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,N.jsx)(a,{size:13})})]})]},e.sessionId)})]}),q===`artefacts`&&(0,N.jsxs)(N.Fragment,{children:[Pe&&(0,N.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Pe}),Me&&!Pe&&Y.length===0&&(0,N.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),Y.map(e=>(0,N.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`),k()},children:[(0,N.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,N.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,N.jsxs)(`div`,{className:`side-foot`,children:[(0,N.jsx)(`div`,{className:`avatar`,children:f?(0,N.jsx)(`img`,{src:f,alt:we}):Te}),(0,N.jsxs)(`div`,{className:`who`,children:[(0,N.jsx)(`span`,{className:`name`,children:we}),(0,N.jsx)(`span`,{className:`role`,children:u??`operator`})]})]}),xe&&(0,N.jsx)(Ve,{seedMode:z,seedModel:V,submitting:R,error:be,onSubmit:e=>void it(e),onCancel:rt,onErrorClear:()=>H(null)}),le&&(0,N.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!I&&F(null)},children:(0,N.jsxs)(`div`,{className:`modal-card`,children:[(0,N.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,N.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript for `,(0,N.jsx)(`strong`,{children:le.displayName??le.sessionId.slice(0,8)}),`. The action cannot be undone.`]}),ue&&(0,N.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:ue}),(0,N.jsxs)(`div`,{className:`modal-action-row`,children:[(0,N.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:I,onClick:()=>F(null),children:`Cancel`}),(0,N.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:I,onClick:()=>void ot(le.sessionId),children:I?(0,N.jsx)(w,{size:13,className:`spinning`}):`Purge`})]})]})})]})}),We=[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`all`,label:`All`}];function Ge(e){let{view:t,setView:n,connected:r,reconnectNow:i}=e;return(0,N.jsx)(`div`,{className:`session-view-controls`,children:(0,N.jsxs)(`div`,{className:`session-view-segmented`,role:`tablist`,"aria-label":`Session view`,children:[We.map(e=>(0,N.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,N.jsx)(`span`,{className:`session-view-connection connected`,"aria-label":`Live updates connected.`,title:`Live updates connected.`}):(0,N.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 Ke({live:e,status:t}){return e?t===`busy`?(0,N.jsxs)(`span`,{className:`session-status session-status-busy`,"aria-label":`session busy`,children:[(0,N.jsx)(`span`,{className:`session-status-dot`}),(0,N.jsx)(`span`,{className:`session-status-dot`}),(0,N.jsx)(`span`,{className:`session-status-dot`})]}):t===`detached`?(0,N.jsx)(`span`,{className:`session-status session-status-detached`,"aria-label":`session detached — manager restart survivor`}):(0,N.jsx)(`span`,{className:`session-status session-status-idle`,"aria-label":`session idle`}):(0,N.jsx)(`span`,{className:`session-status session-status-archived`,"aria-label":`session archived`})}function qe(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 Je(){(0,M.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 Ye({handlePopout:e,disabled:t=!1}){let n=(0,M.useCallback)(()=>{delete document.body.dataset.dragPopoutActive},[]);(0,M.useEffect)(()=>()=>n(),[n]);let r=(0,M.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,M.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 Xe(e){(0,M.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 Ze=`maxy-vnc-overlay-popout`;function Q(e){let[t,r]=(0,M.useState)(!1),i=(0,M.useRef)(null),a=(0,M.useRef)(null),o=(0,M.useCallback)(()=>{a.current&&=(clearInterval(a.current),null),i.current&&!i.current.closed&&i.current.close(),i.current=null,r(!1)},[]),s=(0,M.useCallback)(()=>{let t=`/vnc-popout.html?title=${encodeURIComponent(n.productName)}`,s=window.open(t,Ze,`width=1024,height=768`);s&&(i.current=s,r(!0),a.current=setInterval(()=>{i.current?.closed&&(o(),e?.())},500))},[o,e]);return(0,M.useEffect)(()=>()=>o(),[o]),{poppedOut:t,popout:s,cleanupPopout:o}}var Qe=(0,M.forwardRef)(function({onClose:e},t){Je(),Xe(`overlay`);let{poppedOut:r,popout:i,cleanupPopout:a}=Q(e);return(0,M.useImperativeHandle)(t,()=>({popout:i}),[i]),r?(0,N.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,N.jsx)(c,{className:`browser-viewer__icon`}),(0,N.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,N.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>a(),"aria-label":`Pop back in`}),e&&(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:j,onClick:()=>{a(),e()},"aria-label":`Close`})]}):(0,N.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-surface__iframe`,title:n.productName})});function $e({onClose:e}){Je(),Xe(`overlay`);let{poppedOut:t,popout:r,cleanupPopout:i}=Q(e),a=(0,M.useCallback)(()=>{i(),e()},[i,e]);(0,M.useEffect)(()=>{if(t)return;let e=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,a]);let o=Ye({handlePopout:r,disabled:t});return t?(0,N.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,N.jsx)(c,{className:`browser-viewer__icon`}),(0,N.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,N.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>{i()},"aria-label":`Pop back in`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:j,onClick:a,"aria-label":`Close`})]}):(0,N.jsxs)(`div`,{className:`browser-viewer-fullscreen`,children:[(0,N.jsxs)(`div`,{className:`browser-viewer-fullscreen__bar`,...o,children:[(0,N.jsx)(c,{className:`browser-viewer__icon`}),(0,N.jsx)(`span`,{className:`browser-viewer-fullscreen__title`,children:n.productName}),(0,N.jsxs)(`div`,{className:`browser-viewer-fullscreen__actions`,children:[(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:x,onClick:r,"aria-label":`Pop out`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:j,onClick:a,"aria-label":`Close`})]})]}),(0,N.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-viewer-fullscreen__iframe`,title:n.productName})]})}function et(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function tt(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 nt(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),[a,o]=(0,M.useState)(null),[s,c]=(0,M.useState)(null),l=(0,M.useRef)([]),u=(0,M.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=et(i),o=tt(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,M.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,M.useCallback)(()=>u(!1),[u]),f=(0,M.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var rt=`admin-sidebar-collapsed`,it=`admin-sidebar-drawer-open`;function $(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(rt)===`1`}catch{return!1}}function at(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(rt,`1`):window.sessionStorage.removeItem(rt)}catch{}}function ot(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(it)===`1`}catch{return!1}}function st(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(it,`1`):window.sessionStorage.removeItem(it)}catch{}}var ct=720;function lt(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,M.useState)(()=>$()),[_,v]=(0,M.useState)(()=>ot()),[y,b]=(0,M.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${ct}px)`).matches);(0,M.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${ct}px)`),t=e=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let x=(0,M.useCallback)(e=>{at(e),g(e)},[]),S=(0,M.useCallback)(e=>{st(e),v(e)},[]);(0,M.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,M.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${ct}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,M.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),[E,D]=(0,M.useState)(!1),[ee,te]=(0,M.useState)(!1),ne=(0,M.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`);te(!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]),re=a??E,O=nt(t),k=ke(t),A=(0,M.useMemo)(()=>k.rows.map(e=>e.sessionId),[k.rows]),ie=(0,M.useCallback)(e=>{if(u){u(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[u]),ae=(0,M.useCallback)(e=>{d&&d(e)},[d]),oe={collapsed:h,mobileDrawerOpen:_,sidebarOpen:C,onToggleSidebar:w,setMobileDrawerOpen:S,sessionsState:O,sessionRowIds:A,sessionRowsConnected:k.connected};return(0,N.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,N.jsx)(ye,{businessName:n,onLaunchBrowser:r??ne,onNavigate:T,onToggleSidebar:w,sidebarOpen:C,onLogout:i,browserLaunching:re}),(0,N.jsxs)(`div`,{className:`platform${_?` menu-open`:``}${h?` sidebar-collapsed`:``}`,"data-artefact":f,children:[(0,N.jsx)(Ue,{businessName:n,cacheKey:t,role:c??null,userName:o,userAvatar:s??null,sessions:O.sessions,sessionsLoading:O.loading,sessionsError:O.error,ensureSessionsLoaded:O.ensureLoaded,refetchSessions:O.refetch,onSelectArtefact:ae,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:ie,selectedSessionId:l??null,collapsed:h,mobileDrawerOpen:_,recentsActions:{setSessions:O.setSessions,refetch:O.refetch}}),typeof p==`function`?p(oe):p]}),_&&(0,N.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>S(!1)}),ee&&(0,N.jsx)($e,{onClose:()=>te(!1)}),m]})}var ut={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`},dt=`#94A3B8`;Object.freeze(Object.keys(ut)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var ft=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 pt(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(ut,e[t]))return e[t];return e[0]??null}function mt(e){return ut[e]??`#94A3B8`}function ht(e){let t=pt(e),n=t?mt(t):dt,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call(ut,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{w as C,h as D,g as E,D as S,b as T,A as _,lt as a,re as b,Ye as c,ge as d,fe as f,ie as g,j as h,ht as i,Te as l,F as m,mt as n,$e as o,he as p,pt as r,Qe as s,ft as t,ve as u,k as v,x as w,ne as x,O 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-BmmxQOhM.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`}]]),ee=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`}]]),te=p(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),ne=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`}]]),re=p(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),O=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`}]]),k=p(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),A=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`}]]),ie=p(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ae=p(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),oe=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`}]]),j=p(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),M=e(m(),1),N=i(),se=`maxy-shell-side-px`;function ce(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function P(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-ce());return Math.min(Math.max(e,248),n)}function le(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(se);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return P(t)}catch{}return 264}function F({targetSelector:e=`.platform`}){let t=(0,M.useRef)(null),[n,r]=(0,M.useState)(()=>le()),i=(0,M.useRef)(n);(0,M.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,M.useCallback)(()=>{r(e=>{let t=P(e);return t===e?e:t})},[]);(0,M.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(P(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(se,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=P(264);r(e);try{window.localStorage.removeItem(se)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,N.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var ue=!1;function de(){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 I(){let e=typeof crypto<`u`&&typeof crypto.randomUUID==`function`;if(!ue){ue=!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():de()}function fe(e){let t=e.trim();return t.length>=1&&t.length<=200}function L(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 pe=/session_([A-Za-z0-9_-]+)/;function R(e){if(!e)return null;let t=e.match(pe);return t?t[1]:null}async function me(e,t,n,r,i){let a=R(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 he(e,t,n=`pane`){let[r,i]=(0,M.useState)(null),a=(0,M.useRef)(!1),o=(0,M.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};if(a.current)return L(n,`resume`,r,`skipped-in-flight`),{ok:!1,error:`in-flight`};a.current=!0,i(`resume`);let o=I();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 L(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),L(n,`resume`,r,`200`),me(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return L(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{a.current=!1,i(null)}},[e,t,n]),s=(0,M.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 L(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`POST /stop ${i.status} ${e.slice(0,200)}`}}return L(n,`end`,r,`204`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return L(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),c=(0,M.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 L(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),L(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return L(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),l=(0,M.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 L(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),L(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return L(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),u=(0,M.useCallback)(e=>l(e,`archive`),[l]),d=(0,M.useCallback)(e=>l(e,`unarchive`),[l]),f=(0,M.useCallback)(async n=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`promote-and-resume`);let r=e=>e.slice(0,8),a=null;try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/promote?session_key=${encodeURIComponent(e)}`,{method:`POST`}),o=await i.json().catch(()=>({}));if(console.info(`[admin-ui] promote-and-resume sessionId=${r(n)} step=promote outcome=${i.status}`),!i.ok||typeof o.canonicalSessionId!=`string`){let e=o.detail||o.error||`POST /promote ${i.status}`;return i.status!==200&&t.refetch(),{ok:!1,error:e}}a=o.canonicalSessionId;let s=I(),c=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:a,channel:`browser`,idempotencyKey:s})}),l=await c.json().catch(()=>({}));if(console.info(`[admin-ui] promote-and-resume sessionId=${r(n)} uuid=${r(a)} step=resume outcome=${c.status}`),!c.ok||!(`sessionId`in l)){let e=l.error??`POST /resume ${c.status}`;return t.refetch(),{ok:!1,error:e,canonicalSessionId:a}}return t.setSessions(e=>[l,...e.filter(e=>e.sessionId!==n&&e.sessionId!==a)]),t.refetch(),{ok:!0,canonicalSessionId:a}}catch(e){let i=e instanceof Error?e.message:String(e);return console.error(`[admin-ui] promote-and-resume sessionId=${r(n)} outcome=threw detail=${i}`),t.refetch(),{ok:!1,error:i,canonicalSessionId:a??void 0}}finally{i(null)}},[e,t]);return{inFlight:r,resume:o,end:s,purge:c,archive:u,unarchive:d,rename:(0,M.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 L(n,`rename`,t,String(i.status)),{ok:!1,error:r,reason:e.reason}}return L(n,`rename`,t,`200`),{ok:!0}}catch(e){let r=e instanceof Error?e.message:String(e);return L(n,`rename`,t,`threw`),{ok:!1,error:r}}finally{i(null)}},[e,n]),promoteAndResume:f}}var z=/^[a-f0-9-]{36}\.\d{13}$/;function ge(e){return z.test(e)}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 _e(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(B(e),JSON.stringify([...t]))}catch{}}function ve(e){let[t,n]=(0,M.useState)(()=>V(e));(0,M.useEffect)(()=>{n(V(e))},[e]);let r=(0,M.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),_e(e,r),r})},[e]);return{pinned:t,isPinned:(0,M.useCallback)(e=>t.has(e),[t]),togglePin:r}}function ye(e){let{businessName:i,onLaunchBrowser:o,onNavigate:s,onToggleSidebar:l,sidebarOpen:u,onLogout:d,browserLaunching:f}=e,[p,m]=(0,M.useState)(!1),h=(0,M.useRef)(null),g=(0,M.useRef)(null),[_,v]=(0,M.useState)(null),[y,C]=(0,M.useState)(!1),[D,ne]=(0,M.useState)(null),[re,O]=(0,M.useState)(null),[k,ie]=(0,M.useState)(null),[ae,oe]=(0,M.useState)(``);(0,M.useEffect)(()=>{oe(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,M.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,M.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&m(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]),(0,M.useEffect)(()=>{p&&g.current?.focus()},[p]),(0,M.useEffect)(()=>{if(!p)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||ie(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[p]);let se=(0,M.useCallback)(()=>{m(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),ce=(0,M.useCallback)(()=>{m(!1),o()},[o]),P=(0,M.useCallback)(e=>{m(!1),s(e)},[s]),le=(0,M.useCallback)(async()=>{if(_!==null){v(null),O(null);return}C(!0),ne(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),ne(e instanceof Error?e.message:String(e)),v([])}finally{C(!1)}},[_]),F=(0,M.useCallback)(e=>{O(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))},[]),ue=(0,M.useCallback)(()=>{m(!1),d()},[d]),de=i||n.productName;return(0,N.jsxs)(`header`,{className:`admin-header`,children:[(0,N.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,N.jsx)(ee,{size:20,strokeWidth:1.5}):(0,N.jsx)(te,{size:20,strokeWidth:1.5})}),(0,N.jsxs)(`div`,{className:`chat-header-label`,children:[(0,N.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,N.jsx)(`img`,{src:r,alt:``,className:`chat-logo`})}),(0,N.jsx)(`h1`,{className:`chat-tagline`,children:de})]}),(0,N.jsxs)(`div`,{className:`chat-burger-wrap`,ref:h,children:[(0,N.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:se,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":p,children:(0,N.jsx)(E,{size:20})}),p&&(0,N.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,N.jsxs)(`button`,{ref:g,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ce,disabled:f,children:[(0,N.jsx)(c,{size:14}),` Browser`,f&&(0,N.jsx)(w,{size:12,className:`spin`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>P(`data`),children:[(0,N.jsx)(b,{size:14}),` Data`]}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>P(`graph`),children:[(0,N.jsx)(A,{size:14}),` Graph`]}),(0,N.jsx)(`div`,{className:`chat-menu-divider`}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:le,children:[(0,N.jsx)(x,{size:14}),` Public`,y&&(0,N.jsx)(w,{size:12,className:`spin`})]}),_!==null&&(0,N.jsxs)(`div`,{className:`chat-menu-agents`,children:[D&&(0,N.jsx)(`span`,{className:`chat-menu-agent-error`,children:D}),_.length===0&&!D&&(0,N.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),_.map(e=>(0,N.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,N.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,N.jsxs)(`span`,{className:`agent-text`,children:[(0,N.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,N.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),re===e.slug?(0,N.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,N.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>F(e.slug),children:(0,N.jsx)(t,{size:12})}),(0,N.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>O(null),children:(0,N.jsx)(j,{size:12})})]}):(0,N.jsxs)(`span`,{className:`agent-actions`,children:[(0,N.jsx)(`a`,{href:`${ae}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>m(!1),children:(0,N.jsx)(x,{size:12})}),(0,N.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>O(e.slug),children:(0,N.jsx)(a,{size:12})})]})]},e.slug))]}),(0,N.jsx)(`div`,{className:`chat-menu-divider`}),(0,N.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,N.jsx)(S,{size:14}),(0,N.jsxs)(`span`,{className:`version-installed`,children:[k?`v${k.installed}`:`…`,k&&!k.updateAvailable&&(0,N.jsx)(`span`,{className:`version-uptodate-dot`}),k?.updateAvailable&&(0,N.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,N.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ue,children:[(0,N.jsx)(T,{size:14}),` Log out`]})]})]})]})}var be=`maxy-admin-session`,H=typeof BroadcastChannel<`u`;function xe(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 Se(e){if(!H)return()=>{};let t=new BroadcastChannel(be),n=t=>{if(!xe(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 U=`maxy-admin-session-key`;function W(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function Ce(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 we(){try{return sessionStorage.getItem(U)}catch{return null}}function Te(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,M.useState)(t),a=(0,M.useRef)(t);(0,M.useEffect)(()=>{a.current=r},[r]),(0,M.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,M.useState)(0),[c,l]=(0,M.useState)(null);(0,M.useEffect)(()=>Se(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,M.useCallback)(()=>{try{sessionStorage.removeItem(U)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,M.useCallback)(async(e,t)=>{let r=a.current,o=W(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await Ce(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=we();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=W(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 Ee=`/api/admin/claude-sessions/events`,G=`admin-session-list-view`,K=`admin-session-list-include-subagents`,De=`admin-session-list-include-background`;function Oe(e){return e===`active`||e===`archived`||e===`all`}function q(){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=W(Ee,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 Ce(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(G);Oe(t)&&(e={...e,view:t});let n=window.localStorage.getItem(K);if(n===null){let e=window.localStorage.getItem(De);e!==null&&(window.localStorage.setItem(K,e),window.localStorage.removeItem(De),n=e,console.info(`[admin-ui] session-list-storage-migrated from=${De} to=${K} value=${e}`))}n===`1`&&(e={...e,includeBackground:!0})}catch{}}function v(t){e={...e,view:t};try{window.localStorage.setItem(G,t)}catch{}d()}function y(t){e={...e,includeBackground:t};try{window.localStorage.setItem(K,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 J=q();J._injectEventForTesting,J.connect,J._setConnectedForTesting,J.getSnapshot,J.reconcileFromList;function ke(e){let t=(0,M.useSyncExternalStore)(J.subscribe,J.getSnapshot,J.getSnapshot);(0,M.useEffect)(()=>{e&&J.connect(e)},[e]);let n=(0,M.useCallback)(e=>J.setView(e),[]),r=(0,M.useCallback)(e=>J.setIncludeBackground(e),[]),i=(0,M.useCallback)(()=>J.reconnectNow(),[]),a=(0,M.useCallback)(e=>J.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 Y=6e4,je=60*Y,Me=24*je,Ne=Y,Pe=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Fe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Ie(e){return e<10?`0${e}`:String(e)}function Le(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Re(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-Ne)return`—`;let r=n<0?0:n;if(r<Y)return`just now`;if(r<je)return`${Math.floor(r/Y)}m`;if(r<Me)return`${Math.floor(r/je)}h`;let i=new Date(t),a=new Date(e),o=Math.round((Le(i)-Le(a))/Me);if(o===1)return`yesterday`;if(o>=2&&o<=6)return Fe[a.getDay()];let s=Ie(a.getDate()),c=Pe[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}function ze(e=3e4){let[t,n]=(0,M.useState)(()=>Date.now());return(0,M.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var X={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Z=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],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,M.useState)(``),[f,p]=(0,M.useState)(e),[m,h]=(0,M.useState)(n),[g,_]=(0,M.useState)(!1),[v,b]=(0,M.useState)(!1),x=(0,M.useRef)(null),S=(0,M.useRef)(null),C=(0,M.useRef)(null);(0,M.useEffect)(()=>{x.current?.focus()},[]),(0,M.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,M.useEffect)(()=>{if(!g&&!v)return;function e(e){g&&S.current&&!S.current.contains(e.target)&&_(!1),v&&C.current&&!C.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[g,v]);let T=l.trim(),E=T.length>0&&!r,D=(0,M.useCallback)(()=>{if(T.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,T,r,a]);function ee(e){e.preventDefault(),D()}let te=Be.find(e=>e.value===m)?.label??`Default`;return(0,N.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,N.jsxs)(`div`,{className:`new-session-modal`,children:[(0,N.jsx)(`h2`,{id:`new-session-modal-title`,className:`new-session-modal-title`,children:`New session`}),(0,N.jsxs)(`form`,{className:`new-session-modal-form`,onSubmit:ee,children:[(0,N.jsx)(`div`,{className:`chat-form`,children:(0,N.jsx)(d,{ref:x,value:l,onChange:e=>{u(e),i&&c()},placeholder:`What should this session do?`,disabled:r})}),i&&(0,N.jsx)(`div`,{className:`tunnel-route__error`,role:`alert`,children:i}),(0,N.jsxs)(`div`,{className:`new-session-modal-actions`,children:[(0,N.jsxs)(`div`,{className:`new-session-modal-pickers`,children:[(0,N.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:S,children:[(0,N.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:[X[f],(0,N.jsx)(o,{size:12,"aria-hidden":`true`})]}),g&&(0,N.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,N.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,N.jsx)(`span`,{children:`Mode`})}),Z.map((e,n)=>(0,N.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] new-session-modal-mode-change from=${f} to=${e} trigger=click`),p(e),_(!1)},children:[(0,N.jsx)(`span`,{children:X[e]}),(0,N.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===f&&(0,N.jsx)(t,{size:12}),(0,N.jsx)(`span`,{children:n+1})]})]},e))]})]}),(0,N.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:C,children:[(0,N.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:[te,(0,N.jsx)(o,{size:12,"aria-hidden":`true`})]}),v&&(0,N.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Model`,children:[(0,N.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,N.jsx)(`span`,{children:`Model`})}),Be.map(e=>(0,N.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,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{className:`side-mode-popover-shortcut`,children:e.value===m&&(0,N.jsx)(t,{size:12})})]},e.label))]})]})]}),(0,N.jsxs)(`div`,{className:`new-session-modal-buttons`,children:[(0,N.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:()=>s(`button`),disabled:r,children:`Cancel`}),(0,N.jsx)(`button`,{type:`submit`,className:`new-session-modal-submit`,disabled:!E,"aria-label":`Send`,children:r?(0,N.jsx)(w,{size:14,className:`spinning`}):(0,N.jsx)(y,{size:14})})]})]})]})]})})}var He=1e4,Ue=(0,M.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:ee,onSelectAgents:te,onCloseMobileDrawer:k,onSelectSession:A,selectedSessionId:j,collapsed:se,mobileDrawerOpen:ce,recentsActions:P}=e,[le,F]=(0,M.useState)(null),[ue,de]=(0,M.useState)(null),[I,L]=(0,M.useState)(!1);(0,M.useEffect)(()=>{b()},[b]);let pe=(0,M.useRef)(null),[R,me]=(0,M.useState)(!1),[z,B]=(0,M.useState)(`default`),[V,_e]=(0,M.useState)(void 0),ye=(0,M.useRef)(null),[be,H]=(0,M.useState)(null),[xe,Se]=(0,M.useState)(!1),U=(0,M.useRef)(0),W=(0,M.useRef)(new Map),Ce=n.productName,we=typeof d==`string`?d:d===null?`name unavailable`:i||Ce,Te=(we.trim().charAt(0)||`?`).toUpperCase(),Ee=ve(n.hostname),G=ke(c),K=(0,M.useMemo)(()=>{let e=Ae(G.rows,G.view,G.includeBackground);if(Ee.pinned.size===0)return e;let t=[],n=[];for(let r of e)(Ee.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[G.rows,G.view,G.includeBackground,Ee.pinned]),De=K.length,Oe=ze(3e4);(0,M.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,M.useEffect)(()=>{let e=W.current;return()=>{for(let{timeoutId:t}of e.values())clearTimeout(t);e.clear()}},[]);let[q,J]=(0,M.useState)(`chat`),[Y,je]=(0,M.useState)([]),[Me,Ne]=(0,M.useState)(!1),[Pe,Fe]=(0,M.useState)(null),[Ie,Le]=(0,M.useState)(!1);(0,M.useImperativeHandle)(r,()=>({patchArtefact(e,t){je(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[X,Z]=(0,M.useState)(!1),Be=(0,M.useRef)(null),Ue={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},We=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`];(0,M.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;B(i),_e(a),ye.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 Je=(0,M.useCallback)(async(e,t)=>{if(!c||!ye.current)return;let n=ye.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}`);ye.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}`),B(n.permissionMode),_e(n.model)}},[c]);(0,M.useEffect)(()=>{if(!X)return;function e(e){Be.current&&!Be.current.contains(e.target)&&(console.info(`[admin-ui] sidebar-mode-picker action=close mode=${z}`),Z(!1))}function t(e){if(e.key===`Escape`){console.info(`[admin-ui] sidebar-mode-picker action=close mode=${z}`),Z(!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`),B(n),Z(!1),Je({permissionMode:n,model:V},`sidebar`))}}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[X,z,V,Je]),(0,M.useEffect)(()=>{function e(e){e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.key===`m`||e.key===`M`)&&(e.preventDefault(),Z(e=>{let t=!e;return console.info(`[admin-ui] sidebar-mode-picker action=${t?`open`:`close`} mode=${z} via=shortcut`),t}))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[z]);let Ye=(0,M.useCallback)(async()=>{if(c){Le(!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{Le(!1)}}},[c]),Xe=()=>{J(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${De}`)},Ze=()=>{J(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Me?Y.length:0} collapsed=${se}`),Me||Ye()},Q=1.5,Qe=q===`chat`?`Sessions`:`Artefacts`,$e=q===`chat`?m?`…`:String(De):Ie?`…`:String(Y.length),et=q===`chat`?m:Ie,tt=()=>{console.info(`[admin-ui] sidebar-refresh surface=${q}`),q===`chat`?S().then(e=>{e!==null&&G.reconcileFromList(e.map(e=>e.sessionId))}):Ye()},nt=(0,M.useCallback)(()=>{if(R||!c){console.info(`[admin-ui] sidebar-new-session-click-ignored startingSession=${R} cacheKey=${c?`set`:`missing`}`);return}H(null),U.current=Date.now(),console.info(`[admin-ui] sidebar-new-session-modal-open seedMode=${z} cacheKey-prefix=${c.slice(0,8)}`),Se(!0)},[c,R,z]),rt=(0,M.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),Se(!1)},[]),it=(0,M.useCallback)(async e=>{if(R||!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}`),me(!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}`),P.setSessions(e=>[a,...e]),Se(!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}`),A(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{me(!1)}},[c,R,P,A]),$=he(c,P,`sidebar`),at=(0,M.useCallback)(async e=>{let t=await $.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[$]),ot=(0,M.useCallback)(async e=>{L(!0),de(null);let t=await $.purge(e);t.ok?F(null):de(t.error??`purge failed`),L(!1)},[$]),st=(0,M.useCallback)(async e=>{let t=await $.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[$]),ct=(0,M.useCallback)(async e=>{let t=await $.archive(e);t.ok||console.error(`[admin-ui] sidebar-archive failed: ${t.error}`)},[$]),lt=(0,M.useCallback)(async e=>{let t=await $.unarchive(e);t.ok||console.error(`[admin-ui] sidebar-unarchive failed: ${t.error}`)},[$]),ut=(0,M.useCallback)(async e=>{let t=await $.promoteAndResume(e);if(!t.ok){console.error(`[admin-ui] sidebar-promote-and-resume failed sessionId=${e.slice(0,8)} error=${t.error??`unknown`}`);return}t.canonicalSessionId&&A(t.canonicalSessionId)},[$,A]),[dt,ft]=(0,M.useState)(null),[pt,mt]=(0,M.useState)(``),ht=(0,M.useCallback)(async(e,t)=>{let n=pt.trim();if(n.length===0||!fe(n)){ft(null);return}if(n===(t??``)){ft(null);return}let r=await $.rename(e,n);r.ok||console.error(`[admin-ui] sidebar-rename failed: ${r.error}`),ft(null)},[pt,$]),gt=(0,M.useCallback)(()=>{ft(null)},[]);return(0,N.jsxs)(`aside`,{className:`side`,children:[q===`chat`&&(0,N.jsxs)(`div`,{className:`side-new-session-row`,ref:Be,children:[(0,N.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:nt,disabled:R||!c,children:[R?(0,N.jsx)(w,{size:14,className:`spinning`}):(0,N.jsx)(re,{size:14}),(0,N.jsx)(`span`,{children:`New session`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!X;console.info(`[admin-ui] sidebar-mode-picker action=${e?`open`:`close`} mode=${z}`),Z(e)},disabled:R,"aria-haspopup":`menu`,"aria-expanded":X,"aria-label":`Permission mode for the next session`,title:`Shift+Cmd+M`,children:[Ue[z],(0,N.jsx)(o,{size:12,"aria-hidden":`true`})]}),X&&(0,N.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,N.jsxs)(`div`,{className:`side-mode-popover-head`,children:[(0,N.jsx)(`span`,{children:`Mode`}),(0,N.jsx)(`span`,{className:`side-mode-popover-shortcut`,"aria-hidden":`true`,children:`⇧⌘M`})]}),We.map((e,n)=>(0,N.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] sidebar-mode-picker action=select mode=${e}`),B(e),Z(!1),Je({permissionMode:e,model:V},`sidebar`)},children:[(0,N.jsx)(`span`,{children:Ue[e]}),(0,N.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===z&&(0,N.jsx)(t,{size:12}),(0,N.jsx)(`span`,{children:n+1})]})]},e))]})]}),(0,N.jsxs)(`nav`,{className:`side-nav`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`nav-row${q===`chat`?` active`:``}`,onClick:Xe,children:[(0,N.jsx)(ae,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),D(),k()},children:[(0,N.jsx)(oe,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`People`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),te(),k()},children:[(0,N.jsx)(_,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Agents`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),E(),k()},children:[(0,N.jsx)(v,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Projects`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),ee(),k()},children:[(0,N.jsx)(C,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,N.jsx)(`span`,{className:`kbd`})]}),(0,N.jsxs)(`button`,{type:`button`,className:`nav-row${q===`artefacts`?` active`:``}`,onClick:Ze,children:[(0,N.jsx)(s,{size:20,strokeWidth:Q}),(0,N.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,N.jsx)(`span`,{className:`kbd`})]})]}),(0,N.jsxs)(`div`,{className:`side-list`,ref:pe,children:[(0,N.jsxs)(`div`,{className:`group-head`,children:[(0,N.jsx)(`span`,{children:Qe}),(0,N.jsxs)(`span`,{className:`group-head-meta`,children:[(0,N.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${Qe.toLowerCase()}`,"aria-label":`Refresh ${Qe.toLowerCase()}`,onClick:tt,disabled:et,children:(0,N.jsx)(O,{size:12,className:et?`spinning`:void 0})}),(0,N.jsx)(`span`,{children:$e})]})]}),q===`chat`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Ge,{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,N.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:y}),K.map(e=>{let t=j===e.sessionId,n=dt===e.sessionId;return(0,N.jsxs)(`div`,{className:`conv${t?` active`:``}`,children:[n?(0,N.jsxs)(`span`,{className:`conv-name-line`,style:{flex:1,minWidth:0},children:[(0,N.jsx)(ae,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,N.jsx)(Ke,{live:e.live,status:e.status}),(0,N.jsx)(`input`,{type:`text`,value:pt,autoFocus:!0,maxLength:200,onChange:e=>mt(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),ht(e.sessionId,e.firstPrompt)):t.key===`Escape`&&(t.preventDefault(),gt())},onBlur:()=>{ht(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,N.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{A(e.sessionId),k()},title:`Show metadata`,children:[(0,N.jsxs)(`span`,{className:`conv-name-line`,children:[(0,N.jsx)(ae,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,N.jsx)(Ke,{live:e.live,status:e.status}),e.firstPrompt?(0,N.jsx)(`span`,{className:`conv-name`,children:e.firstPrompt}):(0,N.jsxs)(`span`,{className:`conv-name`,style:{fontStyle:`italic`,opacity:.6},children:[`(unnamed · `,e.sessionId.slice(0,8),`)`]})]}),(0,N.jsx)(`span`,{className:`conv-timestamp`,children:Re(e.updatedAt,Oe)})]}),!n&&(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Rename`,"aria-label":`Rename session`,onClick:()=>{mt(e.firstPrompt??``),ft(e.sessionId)},children:(0,N.jsx)(ne,{size:13})}),e.url!==null&&(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>qe(e.url,e.sessionId),children:(0,N.jsx)(x,{size:13})}),e.live?(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void st(e.sessionId),disabled:$.inFlight===`end`,children:$.inFlight===`end`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(ie,{size:13})}):e.archived?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Unarchive session`,"aria-label":`Unarchive session`,onClick:()=>void lt(e.sessionId),disabled:$.inFlight===`unarchive`,children:$.inFlight===`unarchive`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(h,{size:13})}),(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{de(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,N.jsx)(a,{size:13})})]}):(0,N.jsxs)(N.Fragment,{children:[ge(e.sessionId)?(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Promote & resume session`,"aria-label":`Promote and resume session`,onClick:()=>void ut(e.sessionId),disabled:$.inFlight===`promote-and-resume`,children:$.inFlight===`promote-and-resume`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(l,{size:13})}):(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void at(e.sessionId),disabled:$.inFlight===`resume`,children:$.inFlight===`resume`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(l,{size:13})}),(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Archive session`,"aria-label":`Archive session`,onClick:()=>void ct(e.sessionId),disabled:$.inFlight===`archive`,children:$.inFlight===`archive`?(0,N.jsx)(w,{size:13,className:`spinning`}):(0,N.jsx)(g,{size:13})}),(0,N.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{de(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,N.jsx)(a,{size:13})})]})]},e.sessionId)})]}),q===`artefacts`&&(0,N.jsxs)(N.Fragment,{children:[Pe&&(0,N.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Pe}),Me&&!Pe&&Y.length===0&&(0,N.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),Y.map(e=>(0,N.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`),k()},children:[(0,N.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,N.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,N.jsxs)(`div`,{className:`side-foot`,children:[(0,N.jsx)(`div`,{className:`avatar`,children:f?(0,N.jsx)(`img`,{src:f,alt:we}):Te}),(0,N.jsxs)(`div`,{className:`who`,children:[(0,N.jsx)(`span`,{className:`name`,children:we}),(0,N.jsx)(`span`,{className:`role`,children:u??`operator`})]})]}),xe&&(0,N.jsx)(Ve,{seedMode:z,seedModel:V,submitting:R,error:be,onSubmit:e=>void it(e),onCancel:rt,onErrorClear:()=>H(null)}),le&&(0,N.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!I&&F(null)},children:(0,N.jsxs)(`div`,{className:`modal-card`,children:[(0,N.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,N.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript for `,(0,N.jsx)(`strong`,{children:le.displayName??le.sessionId.slice(0,8)}),`. The action cannot be undone.`]}),ue&&(0,N.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:ue}),(0,N.jsxs)(`div`,{className:`modal-action-row`,children:[(0,N.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:I,onClick:()=>F(null),children:`Cancel`}),(0,N.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:I,onClick:()=>void ot(le.sessionId),children:I?(0,N.jsx)(w,{size:13,className:`spinning`}):`Purge`})]})]})})]})}),We=[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`all`,label:`All`}];function Ge(e){let{view:t,setView:n,connected:r,reconnectNow:i}=e;return(0,N.jsx)(`div`,{className:`session-view-controls`,children:(0,N.jsxs)(`div`,{className:`session-view-segmented`,role:`tablist`,"aria-label":`Session view`,children:[We.map(e=>(0,N.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,N.jsx)(`span`,{className:`session-view-connection connected`,"aria-label":`Live updates connected.`,title:`Live updates connected.`}):(0,N.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 Ke({live:e,status:t}){return e?t===`busy`?(0,N.jsxs)(`span`,{className:`session-status session-status-busy`,"aria-label":`session busy`,children:[(0,N.jsx)(`span`,{className:`session-status-dot`}),(0,N.jsx)(`span`,{className:`session-status-dot`}),(0,N.jsx)(`span`,{className:`session-status-dot`})]}):t===`detached`?(0,N.jsx)(`span`,{className:`session-status session-status-detached`,"aria-label":`session detached — manager restart survivor`}):(0,N.jsx)(`span`,{className:`session-status session-status-idle`,"aria-label":`session idle`}):(0,N.jsx)(`span`,{className:`session-status session-status-archived`,"aria-label":`session archived`})}function qe(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 Je(){(0,M.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 Ye({handlePopout:e,disabled:t=!1}){let n=(0,M.useCallback)(()=>{delete document.body.dataset.dragPopoutActive},[]);(0,M.useEffect)(()=>()=>n(),[n]);let r=(0,M.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,M.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 Xe(e){(0,M.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 Ze=`maxy-vnc-overlay-popout`;function Q(e){let[t,r]=(0,M.useState)(!1),i=(0,M.useRef)(null),a=(0,M.useRef)(null),o=(0,M.useCallback)(()=>{a.current&&=(clearInterval(a.current),null),i.current&&!i.current.closed&&i.current.close(),i.current=null,r(!1)},[]),s=(0,M.useCallback)(()=>{let t=`/vnc-popout.html?title=${encodeURIComponent(n.productName)}`,s=window.open(t,Ze,`width=1024,height=768`);s&&(i.current=s,r(!0),a.current=setInterval(()=>{i.current?.closed&&(o(),e?.())},500))},[o,e]);return(0,M.useEffect)(()=>()=>o(),[o]),{poppedOut:t,popout:s,cleanupPopout:o}}var Qe=(0,M.forwardRef)(function({onClose:e},t){Je(),Xe(`overlay`);let{poppedOut:r,popout:i,cleanupPopout:a}=Q(e);return(0,M.useImperativeHandle)(t,()=>({popout:i}),[i]),r?(0,N.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,N.jsx)(c,{className:`browser-viewer__icon`}),(0,N.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,N.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>a(),"aria-label":`Pop back in`}),e&&(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:j,onClick:()=>{a(),e()},"aria-label":`Close`})]}):(0,N.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-surface__iframe`,title:n.productName})});function $e({onClose:e}){Je(),Xe(`overlay`);let{poppedOut:t,popout:r,cleanupPopout:i}=Q(e),a=(0,M.useCallback)(()=>{i(),e()},[i,e]);(0,M.useEffect)(()=>{if(t)return;let e=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,a]);let o=Ye({handlePopout:r,disabled:t});return t?(0,N.jsxs)(`div`,{className:`browser-overlay-popout`,children:[(0,N.jsx)(c,{className:`browser-viewer__icon`}),(0,N.jsx)(`span`,{className:`browser-viewer__title`,children:n.productName}),(0,N.jsx)(`span`,{className:`browser-viewer__popout-label`,children:`Popped out`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:D,onClick:()=>{i()},"aria-label":`Pop back in`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:j,onClick:a,"aria-label":`Close`})]}):(0,N.jsxs)(`div`,{className:`browser-viewer-fullscreen`,children:[(0,N.jsxs)(`div`,{className:`browser-viewer-fullscreen__bar`,...o,children:[(0,N.jsx)(c,{className:`browser-viewer__icon`}),(0,N.jsx)(`span`,{className:`browser-viewer-fullscreen__title`,children:n.productName}),(0,N.jsxs)(`div`,{className:`browser-viewer-fullscreen__actions`,children:[(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:x,onClick:r,"aria-label":`Pop out`}),(0,N.jsx)(f,{variant:`ghost`,size:`sm`,icon:j,onClick:a,"aria-label":`Close`})]})]}),(0,N.jsx)(`iframe`,{src:`/vnc-viewer.html`,className:`browser-viewer-fullscreen__iframe`,title:n.productName})]})}function et(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function tt(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 nt(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),[a,o]=(0,M.useState)(null),[s,c]=(0,M.useState)(null),l=(0,M.useRef)([]),u=(0,M.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=et(i),o=tt(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,M.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,M.useCallback)(()=>u(!1),[u]),f=(0,M.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var rt=`admin-sidebar-collapsed`,it=`admin-sidebar-drawer-open`;function $(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(rt)===`1`}catch{return!1}}function at(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(rt,`1`):window.sessionStorage.removeItem(rt)}catch{}}function ot(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(it)===`1`}catch{return!1}}function st(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(it,`1`):window.sessionStorage.removeItem(it)}catch{}}var ct=720;function lt(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,M.useState)(()=>$()),[_,v]=(0,M.useState)(()=>ot()),[y,b]=(0,M.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${ct}px)`).matches);(0,M.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${ct}px)`),t=e=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let x=(0,M.useCallback)(e=>{at(e),g(e)},[]),S=(0,M.useCallback)(e=>{st(e),v(e)},[]);(0,M.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,M.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${ct}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,M.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),[E,D]=(0,M.useState)(!1),[ee,te]=(0,M.useState)(!1),ne=(0,M.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`);te(!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]),re=a??E,O=nt(t),k=ke(t),A=(0,M.useMemo)(()=>k.rows.map(e=>e.sessionId),[k.rows]),ie=(0,M.useCallback)(e=>{if(u){u(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[u]),ae=(0,M.useCallback)(e=>{d&&d(e)},[d]),oe={collapsed:h,mobileDrawerOpen:_,sidebarOpen:C,onToggleSidebar:w,setMobileDrawerOpen:S,sessionsState:O,sessionRowIds:A,sessionRowsConnected:k.connected};return(0,N.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,N.jsx)(ye,{businessName:n,onLaunchBrowser:r??ne,onNavigate:T,onToggleSidebar:w,sidebarOpen:C,onLogout:i,browserLaunching:re}),(0,N.jsxs)(`div`,{className:`platform${_?` menu-open`:``}${h?` sidebar-collapsed`:``}`,"data-artefact":f,children:[(0,N.jsx)(Ue,{businessName:n,cacheKey:t,role:c??null,userName:o,userAvatar:s??null,sessions:O.sessions,sessionsLoading:O.loading,sessionsError:O.error,ensureSessionsLoaded:O.ensureLoaded,refetchSessions:O.refetch,onSelectArtefact:ae,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:ie,selectedSessionId:l??null,collapsed:h,mobileDrawerOpen:_,recentsActions:{setSessions:O.setSessions,refetch:O.refetch}}),typeof p==`function`?p(oe):p]}),_&&(0,N.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>S(!1)}),ee&&(0,N.jsx)($e,{onClose:()=>te(!1)}),m]})}var ut={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`},dt=`#94A3B8`;Object.freeze(Object.keys(ut)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var ft=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 pt(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(ut,e[t]))return e[t];return e[0]??null}function mt(e){return ut[e]??`#94A3B8`}function ht(e){let t=pt(e),n=t?mt(t):dt,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call(ut,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{w as C,h as D,g as E,D as S,b as T,A as _,lt as a,re as b,Ye as c,ge as d,fe as f,ie as g,j as h,ht as i,Te as l,F as m,mt as n,$e as o,he as p,pt as r,Qe as s,ft as t,ve as u,k as v,x as w,ne as x,O 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-emnbDRLA.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-CL0bAr0t.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-Ced2j48Y.js";import{t as r}from"./chunk-426QAEUC-BriTU3L8.js";import{t as i}from"./mermaid-parser.core-BMGzMKJx.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-CUHDQxso.js";import{t as r}from"./chunk-426QAEUC-DHF9zZlS.js";import{t as i}from"./mermaid-parser.core-D32akjeh.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-Ced2j48Y.js";import"./dist-Bd4S37oi.js";import{f as d}from"./chunk-5PVQY5BW-emnbDRLA.js";import{t as f}from"./chunk-426QAEUC-BriTU3L8.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-CUHDQxso.js";import"./dist-Bd4S37oi.js";import{f as d}from"./chunk-5PVQY5BW-CL0bAr0t.js";import{t as f}from"./chunk-426QAEUC-DHF9zZlS.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-Ced2j48Y.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-CMLy-WXm.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-CUHDQxso.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-CLvYLDvo.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-Ced2j48Y.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-emnbDRLA.js";import{t as l}from"./chunk-426QAEUC-BriTU3L8.js";import"./chunk-U2HBQHQK-CPS3yyXK.js";import{t as u}from"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-ZZ45TVLE-BkLnzCHe.js";import"./chunk-X2U36JSP-BJ_B5NW7.js";import{a as d,c as f,i as p}from"./chunk-5FUZZQ4R-BgEmy7Y3.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-CUHDQxso.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-CL0bAr0t.js";import{t as l}from"./chunk-426QAEUC-DHF9zZlS.js";import"./chunk-U2HBQHQK-BGso49fW.js";import{t as u}from"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-ZZ45TVLE-yHQe8STh.js";import"./chunk-X2U36JSP-C2tUGTcL.js";import{a as d,c as f,i as p}from"./chunk-5FUZZQ4R-CV4WMN8u.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()+`