@saluzi/saluzi-edu 0.7.16 → 0.7.18

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 (185) hide show
  1. package/dist/cli.js +159 -153
  2. package/dist/rcs-schema.sql +8 -1
  3. package/dist/rcs-web/assets/{AdminPanel-lU-gkvy5.js → AdminPanel-CpnxYp4P.js} +1 -1
  4. package/dist/rcs-web/assets/{ArtifactView-Bx4cpw8p.js → ArtifactView-CtWZ3nWz.js} +1 -1
  5. package/dist/rcs-web/assets/{ArtifactsGallery-4ftLi8A9.js → ArtifactsGallery-zcPFEYGI.js} +8 -8
  6. package/{packages/remote-control-server/web/dist/assets/Claim-Do1goXcd.js → dist/rcs-web/assets/Claim-CDYW6L3i.js} +1 -1
  7. package/dist/rcs-web/assets/{Dashboard-CDJiO_uB.js → Dashboard-DKlLg54l.js} +2 -2
  8. package/dist/rcs-web/assets/{Join-Dej9t1P2.js → Join-DvKPy2F_.js} +1 -1
  9. package/{packages/remote-control-server/web/dist/assets/Login-DSIVd2Ak.js → dist/rcs-web/assets/Login-Dt3kwJ2k.js} +1 -1
  10. package/dist/rcs-web/assets/MemoriesPage-BYef_GtO.js +1 -0
  11. package/dist/rcs-web/assets/MemoryTypeChips-CYoumrFt.js +6 -0
  12. package/dist/rcs-web/assets/{Register-Cb3vHxNj.js → Register-DW8Fu8No.js} +1 -1
  13. package/{packages/remote-control-server/web/dist/assets/RegisterEmpty-BJjX1T66.js → dist/rcs-web/assets/RegisterEmpty-CCPBTaNr.js} +1 -1
  14. package/dist/rcs-web/assets/SessionDetail-dAPbZnii.js +78 -0
  15. package/dist/rcs-web/assets/{SessionVisibilityBadge-x_KJ3UxI.js → SessionVisibilityBadge-DR98e9N3.js} +1 -1
  16. package/dist/rcs-web/assets/{Setup-6VKUJCjW.js → Setup-CME_d0h2.js} +1 -1
  17. package/dist/rcs-web/assets/{ShareLanding-BbU4abDL.js → ShareLanding-CJrz0iCE.js} +1 -1
  18. package/{packages/remote-control-server/web/dist/assets/TeamDetail-L_uAOrOX.js → dist/rcs-web/assets/TeamDetail-BDILONcu.js} +2 -2
  19. package/{packages/remote-control-server/web/dist/assets/TeamList-BpEmVIG0.js → dist/rcs-web/assets/TeamList-ws6mus3v.js} +1 -1
  20. package/dist/rcs-web/assets/{TeamSettings-C-AikFyX.js → TeamSettings-DyHtHYGj.js} +1 -1
  21. package/dist/rcs-web/assets/{UserSearchInput-nBdw-Rp1.js → UserSearchInput-GqDl1kO4.js} +2 -2
  22. package/dist/rcs-web/assets/{UserSettings-DXdXshbp.js → UserSettings-DxGaHc0v.js} +1 -1
  23. package/dist/rcs-web/assets/{arc-CCkUbRM7.js → arc-G-2K5Jbn.js} +1 -1
  24. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-q7Lr9jDI.js → architectureDiagram-3BPJPVTR-DSy_zn36.js} +1 -1
  25. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-p1D-h8l-.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-C8TbJxZc.js} +1 -1
  26. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-6cLNZYbV.js → c4Diagram-AAUBKEIU-L40Pkb_Y.js} +1 -1
  27. package/dist/rcs-web/assets/channel-DRdjsD2y.js +1 -0
  28. package/dist/rcs-web/assets/{chunk-2J33WTMH-DaweJVSh.js → chunk-2J33WTMH-DJ4Jr15j.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-4BX2VUAB-pRsQ7WD2.js → chunk-4BX2VUAB-ma4T-OAy.js} +1 -1
  30. package/dist/rcs-web/assets/{chunk-55IACEB6-CeZz990O.js → chunk-55IACEB6-DXnO-2R6.js} +1 -1
  31. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-ncwNx0Dd.js → dist/rcs-web/assets/chunk-727SXJPM-CPrejIl2.js} +1 -1
  32. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-XyknljaN.js → dist/rcs-web/assets/chunk-AQP2D5EJ-Bb6lAQOy.js} +1 -1
  33. package/dist/rcs-web/assets/{chunk-FMBD7UC4-BERY9Cr1.js → chunk-FMBD7UC4-SiqPNnqU.js} +1 -1
  34. package/dist/rcs-web/assets/{chunk-ND2GUHAM-DAomEDvV.js → chunk-ND2GUHAM-BrwEeL3J.js} +1 -1
  35. package/dist/rcs-web/assets/{chunk-QZHKN3VN-BRYe-Fl4.js → chunk-QZHKN3VN-BfQ65UJ7.js} +1 -1
  36. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-B7fl1tm5.js +1 -0
  37. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-B7fl1tm5.js +1 -0
  38. package/dist/rcs-web/assets/{code-block-IT6T5CEO-DXoeH2lq.js → code-block-IT6T5CEO-1u12Bria.js} +1 -1
  39. package/dist/rcs-web/assets/{copy-Cn9qqwnz.js → copy-DJwGKEGD.js} +1 -1
  40. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CgxPsxlW.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-BSS9FuRY.js} +1 -1
  41. package/{packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-7NbmgfqS.js → dist/rcs-web/assets/dagre-BM42HDAG-BlzdmKYY.js} +1 -1
  42. package/{packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-BZuPqHB1.js → dist/rcs-web/assets/diagram-2AECGRRQ-Dlqp1atZ.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-5GNKFQAL-D-7-wqCJ.js → diagram-5GNKFQAL-F8tbvrox.js} +1 -1
  44. package/{packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-Dprh88iQ.js → dist/rcs-web/assets/diagram-KO2AKTUF-D1gf7U3r.js} +1 -1
  45. package/dist/rcs-web/assets/{diagram-LMA3HP47-CDalIn4v.js → diagram-LMA3HP47-KYSYKOLu.js} +1 -1
  46. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-D2CxtQF7.js → dist/rcs-web/assets/diagram-OG6HWLK6-B5kyBHRK.js} +1 -1
  47. package/dist/rcs-web/assets/{dialog-My0549rQ.js → dialog-DVA4KU9G.js} +1 -1
  48. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-OEs7IAI0.js → erDiagram-TEJ5UH35-C7vxfvwm.js} +1 -1
  49. package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-sKJRWF-k.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-vNmIGjt4.js} +1 -1
  50. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-C1xb8F-w.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DNVSuKtq.js} +1 -1
  51. package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-DEQYPI__.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BPdeOrBp.js} +1 -1
  52. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-CbZGtWEc.js → infoDiagram-5YYISTIA-B03n5q3D.js} +1 -1
  53. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-rwbj0MFI.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-CTO3NF-i.js} +1 -1
  54. package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-KvIo-i3-.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-n0sfYgJo.js} +1 -1
  55. package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-XRJ-ripH.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-yKNND4u8.js} +1 -1
  56. package/dist/rcs-web/assets/{linear-DPo2rZRW.js → linear-Ce-MsINE.js} +1 -1
  57. package/dist/rcs-web/assets/{main-BBG6f1iy.js → main-C6WmTrH-.js} +22 -22
  58. package/dist/rcs-web/assets/main-DHIMDuzD.css +1 -0
  59. package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-Df8fjmB7.js → dist/rcs-web/assets/mermaid-VLURNSYL-HeLcshEn.js} +4 -4
  60. package/dist/rcs-web/assets/{mermaid.core-DpylnXv0.js → mermaid.core-DhRWrua5.js} +5 -5
  61. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-C-CjJOMA.js → mindmap-definition-RKZ34NQL-CngEERvq.js} +1 -1
  62. package/dist/rcs-web/assets/{notifications-D68ljasQ.js → notifications-Bur1yCHZ.js} +1 -1
  63. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-DNFxwiRS.js → pieDiagram-4H26LBE5-BjDKIlL_.js} +1 -1
  64. package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-2wFo_P2o.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-CZyPN1vK.js} +1 -1
  65. package/dist/rcs-web/assets/{refresh-cw-psUUlQFZ.js → refresh-cw-YG-5Bnbb.js} +1 -1
  66. package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-DMtdG1XQ.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-FU3ZApyz.js} +1 -1
  67. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DfImldbX.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-Df2SOF3J.js} +1 -1
  68. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-DlgDkUj_.js → sequenceDiagram-3UESZ5HK-Bt0LiHJX.js} +1 -1
  69. package/{packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-DCgso34J.js → dist/rcs-web/assets/stateDiagram-AJRCARHV-5w8jw3Fm.js} +1 -1
  70. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-C0_sA7pQ.js → stateDiagram-v2-BHNVJYJU-D57QJhzu.js} +1 -1
  71. package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-DI-Ttq8A.js → timeline-definition-PNZ67QCA-MqK6LBnp.js} +1 -1
  72. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-DPL8npS9.js → vennDiagram-CIIHVFJN-pSCKHFHb.js} +1 -1
  73. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-TtXPIjn3.js → wardleyDiagram-YWT4CUSO-mPHwjsTj.js} +1 -1
  74. package/dist/rcs-web/assets/{workerType-BLdwJ9NB.js → workerType-adjKJz_k.js} +1 -1
  75. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-Cmuh4xMc.js → xychartDiagram-2RQKCTM6-B7iuyGbO.js} +1 -1
  76. package/dist/rcs-web/index.html +2 -2
  77. package/package.json +1 -1
  78. package/packages/remote-control-server/src/__tests__/memories.test.ts +232 -29
  79. package/packages/remote-control-server/src/__tests__/memoryBackend.test.ts +19 -8
  80. package/packages/remote-control-server/src/db/rcs-schema.sql +8 -1
  81. package/packages/remote-control-server/src/db/sqlite.ts +26 -0
  82. package/packages/remote-control-server/src/routes/v1/memories.ts +1 -1
  83. package/packages/remote-control-server/src/routes/web/memories.ts +77 -456
  84. package/packages/remote-control-server/src/services/memory/fileFormat.ts +76 -0
  85. package/packages/remote-control-server/src/services/memory/index.ts +85 -0
  86. package/packages/remote-control-server/src/services/memory/pack.ts +96 -0
  87. package/packages/remote-control-server/src/services/memory/permissions.ts +161 -0
  88. package/packages/remote-control-server/src/services/memory/scopes.ts +76 -0
  89. package/packages/remote-control-server/src/services/memory/searchMatch.ts +59 -0
  90. package/packages/remote-control-server/src/services/memory/sqliteBackend.ts +389 -0
  91. package/packages/remote-control-server/src/services/memory/store.ts +332 -0
  92. package/packages/remote-control-server/src/services/memory/types.ts +106 -0
  93. package/packages/remote-control-server/src/services/memory/writeback.ts +113 -0
  94. package/packages/remote-control-server/src/services/memoryBackend.ts +49 -16
  95. package/packages/remote-control-server/web/dist/assets/{AdminPanel-lU-gkvy5.js → AdminPanel-CpnxYp4P.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{ArtifactView-Bx4cpw8p.js → ArtifactView-CtWZ3nWz.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/{ArtifactsGallery-4ftLi8A9.js → ArtifactsGallery-zcPFEYGI.js} +8 -8
  98. package/{dist/rcs-web/assets/Claim-Do1goXcd.js → packages/remote-control-server/web/dist/assets/Claim-CDYW6L3i.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{Dashboard-CDJiO_uB.js → Dashboard-DKlLg54l.js} +2 -2
  100. package/packages/remote-control-server/web/dist/assets/{Join-Dej9t1P2.js → Join-DvKPy2F_.js} +1 -1
  101. package/{dist/rcs-web/assets/Login-DSIVd2Ak.js → packages/remote-control-server/web/dist/assets/Login-Dt3kwJ2k.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/MemoriesPage-BYef_GtO.js +1 -0
  103. package/packages/remote-control-server/web/dist/assets/MemoryTypeChips-CYoumrFt.js +6 -0
  104. package/packages/remote-control-server/web/dist/assets/{Register-Cb3vHxNj.js → Register-DW8Fu8No.js} +1 -1
  105. package/{dist/rcs-web/assets/RegisterEmpty-BJjX1T66.js → packages/remote-control-server/web/dist/assets/RegisterEmpty-CCPBTaNr.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/SessionDetail-dAPbZnii.js +78 -0
  107. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-x_KJ3UxI.js → SessionVisibilityBadge-DR98e9N3.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/{Setup-6VKUJCjW.js → Setup-CME_d0h2.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{ShareLanding-BbU4abDL.js → ShareLanding-CJrz0iCE.js} +1 -1
  110. package/{dist/rcs-web/assets/TeamDetail-L_uAOrOX.js → packages/remote-control-server/web/dist/assets/TeamDetail-BDILONcu.js} +2 -2
  111. package/{dist/rcs-web/assets/TeamList-BpEmVIG0.js → packages/remote-control-server/web/dist/assets/TeamList-ws6mus3v.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{TeamSettings-C-AikFyX.js → TeamSettings-DyHtHYGj.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-nBdw-Rp1.js → UserSearchInput-GqDl1kO4.js} +2 -2
  114. package/packages/remote-control-server/web/dist/assets/{UserSettings-DXdXshbp.js → UserSettings-DxGaHc0v.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{arc-CCkUbRM7.js → arc-G-2K5Jbn.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-q7Lr9jDI.js → architectureDiagram-3BPJPVTR-DSy_zn36.js} +1 -1
  117. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-p1D-h8l-.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-C8TbJxZc.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-6cLNZYbV.js → c4Diagram-AAUBKEIU-L40Pkb_Y.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/channel-DRdjsD2y.js +1 -0
  120. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-DaweJVSh.js → chunk-2J33WTMH-DJ4Jr15j.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-pRsQ7WD2.js → chunk-4BX2VUAB-ma4T-OAy.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-CeZz990O.js → chunk-55IACEB6-DXnO-2R6.js} +1 -1
  123. package/{dist/rcs-web/assets/chunk-727SXJPM-ncwNx0Dd.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CPrejIl2.js} +1 -1
  124. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-XyknljaN.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-Bb6lAQOy.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-BERY9Cr1.js → chunk-FMBD7UC4-SiqPNnqU.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-DAomEDvV.js → chunk-ND2GUHAM-BrwEeL3J.js} +1 -1
  127. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-BRYe-Fl4.js → chunk-QZHKN3VN-BfQ65UJ7.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-B7fl1tm5.js +1 -0
  129. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-B7fl1tm5.js +1 -0
  130. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-DXoeH2lq.js → code-block-IT6T5CEO-1u12Bria.js} +1 -1
  131. package/packages/remote-control-server/web/dist/assets/{copy-Cn9qqwnz.js → copy-DJwGKEGD.js} +1 -1
  132. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-CgxPsxlW.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-BSS9FuRY.js} +1 -1
  133. package/{dist/rcs-web/assets/dagre-BM42HDAG-7NbmgfqS.js → packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-BlzdmKYY.js} +1 -1
  134. package/{dist/rcs-web/assets/diagram-2AECGRRQ-BZuPqHB1.js → packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-Dlqp1atZ.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-D-7-wqCJ.js → diagram-5GNKFQAL-F8tbvrox.js} +1 -1
  136. package/{dist/rcs-web/assets/diagram-KO2AKTUF-Dprh88iQ.js → packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-D1gf7U3r.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-CDalIn4v.js → diagram-LMA3HP47-KYSYKOLu.js} +1 -1
  138. package/{dist/rcs-web/assets/diagram-OG6HWLK6-D2CxtQF7.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-B5kyBHRK.js} +1 -1
  139. package/packages/remote-control-server/web/dist/assets/{dialog-My0549rQ.js → dialog-DVA4KU9G.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-OEs7IAI0.js → erDiagram-TEJ5UH35-C7vxfvwm.js} +1 -1
  141. package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-sKJRWF-k.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-vNmIGjt4.js} +1 -1
  142. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-C1xb8F-w.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DNVSuKtq.js} +1 -1
  143. package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-DEQYPI__.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BPdeOrBp.js} +1 -1
  144. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-CbZGtWEc.js → infoDiagram-5YYISTIA-B03n5q3D.js} +1 -1
  145. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-rwbj0MFI.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-CTO3NF-i.js} +1 -1
  146. package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-KvIo-i3-.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-n0sfYgJo.js} +1 -1
  147. package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-XRJ-ripH.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-yKNND4u8.js} +1 -1
  148. package/packages/remote-control-server/web/dist/assets/{linear-DPo2rZRW.js → linear-Ce-MsINE.js} +1 -1
  149. package/packages/remote-control-server/web/dist/assets/{main-BBG6f1iy.js → main-C6WmTrH-.js} +22 -22
  150. package/packages/remote-control-server/web/dist/assets/main-DHIMDuzD.css +1 -0
  151. package/{dist/rcs-web/assets/mermaid-VLURNSYL-Df8fjmB7.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-HeLcshEn.js} +4 -4
  152. package/packages/remote-control-server/web/dist/assets/{mermaid.core-DpylnXv0.js → mermaid.core-DhRWrua5.js} +5 -5
  153. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-C-CjJOMA.js → mindmap-definition-RKZ34NQL-CngEERvq.js} +1 -1
  154. package/packages/remote-control-server/web/dist/assets/{notifications-D68ljasQ.js → notifications-Bur1yCHZ.js} +1 -1
  155. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-DNFxwiRS.js → pieDiagram-4H26LBE5-BjDKIlL_.js} +1 -1
  156. package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-2wFo_P2o.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-CZyPN1vK.js} +1 -1
  157. package/packages/remote-control-server/web/dist/assets/{refresh-cw-psUUlQFZ.js → refresh-cw-YG-5Bnbb.js} +1 -1
  158. package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-DMtdG1XQ.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-FU3ZApyz.js} +1 -1
  159. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DfImldbX.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-Df2SOF3J.js} +1 -1
  160. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-DlgDkUj_.js → sequenceDiagram-3UESZ5HK-Bt0LiHJX.js} +1 -1
  161. package/{dist/rcs-web/assets/stateDiagram-AJRCARHV-DCgso34J.js → packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-5w8jw3Fm.js} +1 -1
  162. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-C0_sA7pQ.js → stateDiagram-v2-BHNVJYJU-D57QJhzu.js} +1 -1
  163. package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-DI-Ttq8A.js → timeline-definition-PNZ67QCA-MqK6LBnp.js} +1 -1
  164. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-DPL8npS9.js → vennDiagram-CIIHVFJN-pSCKHFHb.js} +1 -1
  165. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-TtXPIjn3.js → wardleyDiagram-YWT4CUSO-mPHwjsTj.js} +1 -1
  166. package/packages/remote-control-server/web/dist/assets/{workerType-BLdwJ9NB.js → workerType-adjKJz_k.js} +1 -1
  167. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-Cmuh4xMc.js → xychartDiagram-2RQKCTM6-B7iuyGbO.js} +1 -1
  168. package/packages/remote-control-server/web/dist/index.html +2 -2
  169. package/dist/rcs-web/assets/MemoriesGallery-Kr7iufAN.js +0 -1
  170. package/dist/rcs-web/assets/MemoriesPage-BpJwCksq.js +0 -2
  171. package/dist/rcs-web/assets/MemoryTypeChips-DNtJ3-5A.js +0 -6
  172. package/dist/rcs-web/assets/SessionDetail-DaqjYtXc.js +0 -78
  173. package/dist/rcs-web/assets/channel-C_LQRNm9.js +0 -1
  174. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DUHDGigF.js +0 -1
  175. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DUHDGigF.js +0 -1
  176. package/dist/rcs-web/assets/main-CvdPgYUG.css +0 -1
  177. package/packages/remote-control-server/src/services/memories.ts +0 -747
  178. package/packages/remote-control-server/web/dist/assets/MemoriesGallery-Kr7iufAN.js +0 -1
  179. package/packages/remote-control-server/web/dist/assets/MemoriesPage-BpJwCksq.js +0 -2
  180. package/packages/remote-control-server/web/dist/assets/MemoryTypeChips-DNtJ3-5A.js +0 -6
  181. package/packages/remote-control-server/web/dist/assets/SessionDetail-DaqjYtXc.js +0 -78
  182. package/packages/remote-control-server/web/dist/assets/channel-C_LQRNm9.js +0 -1
  183. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DUHDGigF.js +0 -1
  184. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DUHDGigF.js +0 -1
  185. package/packages/remote-control-server/web/dist/assets/main-CvdPgYUG.css +0 -1
@@ -184,6 +184,13 @@ CREATE TABLE IF NOT EXISTS memories (
184
184
  status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'superseded', 'archived')),
185
185
  source_session_id TEXT,
186
186
  version INTEGER NOT NULL DEFAULT 1,
187
+ -- Retrieval telemetry — the SQLite-store counterpart of the CLI memdir
188
+ -- index's confidence/access_count (memory.db). confidence starts at the
189
+ -- 0.5 gate default and is boosted on recall; access_count counts pack
190
+ -- inclusions (a session spawn "recalling" the memory server-side).
191
+ confidence REAL NOT NULL DEFAULT 0.5,
192
+ access_count INTEGER NOT NULL DEFAULT 0,
193
+ last_accessed_at TEXT,
187
194
  created_by TEXT,
188
195
  created_at TEXT NOT NULL,
189
196
  updated_at TEXT NOT NULL,
@@ -198,7 +205,7 @@ CREATE INDEX IF NOT EXISTS idx_memories_team ON memories(team_id, status, update
198
205
  CREATE INDEX IF NOT EXISTS idx_memories_session ON memories(source_session_id);
199
206
 
200
207
  -- Full-text search over memories (name/description/content), synced on
201
- -- write in services/memories.ts — same contentless-free pattern as
208
+ -- write in services/memory/store.ts — same contentless-free pattern as
202
209
  -- session_events_fts (regular fts5 with an UNINDEXED join key).
203
210
  CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
204
211
  name,
@@ -1 +1 @@
1
- import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{b0 as x,b1 as o,a7 as m,aU as s,aK as l,I as u}from"./main-BBG6f1iy.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function j(){x();const[a,i]=d.useState([]),{myTeams:r,isLoading:c}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),c?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{aW as x,aX as o,a5 as m,aO as s,aE as l,I as u}from"./main-C6WmTrH-.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function j(){x();const[a,i]=d.useState([]),{myTeams:r,isLoading:c}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),c?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
@@ -1 +1 @@
1
- import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{b0 as A,a8 as j,aU as r,a3 as U,aF as q,P as F,N as R}from"./main-BBG6f1iy.js";import{S as O,E as G,C as K}from"./ArtifactsGallery-4ftLi8A9.js";import{R as P}from"./refresh-cw-psUUlQFZ.js";import{C as J}from"./copy-Cn9qqwnz.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";import"./dialog-My0549rQ.js";let m=null;function M(n,c,e=0){b();const o=`/web/sessions/${n}/events`,l=new EventSource(o,{withCredentials:!0});m=l;let u=e;l.addEventListener("message",p=>{try{const x=JSON.parse(p.data);if(x.seqNum!==void 0&&x.seqNum<=u)return;x.seqNum!==void 0&&(u=x.seqNum),c(x)}catch{}}),l.addEventListener("error",()=>{console.warn("[SSE] error, readyState:",l.readyState),l.readyState===EventSource.CLOSED&&(l.close(),b())})}function b(){m&&(m.close(),m=null)}function V(n,c){const e=a.useRef(c);e.current=c;const o=a.useCallback(l=>{e.current(l)},[]);a.useEffect(()=>{if(n)return M(n,o),()=>{b()}},[n,o])}function I({artifactId:n,onBack:c}){A();const[e,o]=a.useState(null),[l,u]=a.useState(""),[p,x]=a.useState(!1),[S,f]=a.useState(0),[w,h]=a.useState(!1),[g,C]=a.useState(null),[E,k]=a.useState("template"),[d,y]=a.useState(!1);a.useEffect(()=>{let s=!1;return j(n).then(i=>{s||o(i)}).catch(i=>{s||u(i instanceof Error?i.message:r("artifacts.viewNotFound"))}),()=>{s=!0}},[n]);const v=a.useCallback(()=>{j(n).then(s=>o(s)).catch(()=>{})},[n]),_=a.useCallback(s=>{var i;s.type==="artifact_updated"&&((i=s.payload)!=null&&i.id&&s.payload.id!==n||(v(),f(D=>D+1),y(!0)))},[n,v]);V((e==null?void 0:e.session_id)??null,_),a.useEffect(()=>{if(!d)return;const s=setTimeout(()=>y(!1),2500);return()=>clearTimeout(s)},[d]);const N=a.useCallback(s=>{e&&(C(e),k(s),h(!0))},[e]),$=a.useCallback(s=>{h(!1),o(i=>i?{...i,...s}:s),f(i=>i+1)},[]),T=a.useCallback(async()=>{if(window.confirm(r("artifacts.delete")+" — "+n.slice(0,8)+"…?"))try{await U(n),c()}catch(s){alert(s instanceof Error?s.message:r("artifacts.deleteFailed"))}},[n,c]),L=a.useCallback(async()=>{if(!e)return;await q(`${window.location.origin}${e.url}`)&&(x(!0),setTimeout(()=>x(!1),1500))},[e]);return l?t.jsx("div",{className:"flex flex-1 items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-status-error",children:r("artifacts.viewNotFound")}),t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:l}),t.jsx("button",{type:"button",onClick:c,className:"mt-4 rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:r("artifacts.backToGallery")})]})}):e?t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-surface-1 px-4 py-2.5",children:[t.jsx("button",{type:"button",onClick:c,className:"text-sm text-text-muted hover:text-text-primary",children:r("artifacts.backToGallery")}),t.jsx("span",{className:"text-text-muted/40",children:"/"}),t.jsx("span",{className:"truncate font-medium text-text-primary",children:e.title||e.id.slice(0,12)}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] transition-colors ${d?"bg-status-active/15 text-status-active":"bg-surface-3 text-text-muted"}`,title:d?r("artifacts.view.liveUpdated"):void 0,children:d?`↻ v${e.version}`:`v${e.version}`}),e.session_id&&t.jsxs("a",{href:`/code/${e.session_id}`,className:"truncate font-mono text-[10px] text-text-muted hover:text-accent",title:e.session_id,children:[r("artifacts.session"),": ",e.session_id.slice(0,14),"…"]}),e.expires_at&&t.jsxs("span",{className:"text-[10px] text-text-muted",title:e.expires_at,children:[r("artifacts.expires"),": ",new Date(e.expires_at).toLocaleDateString()]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx("button",{type:"button",onClick:()=>f(s=>s+1),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("common.loading"),children:t.jsx(P,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:()=>N("ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.aiUpdate"),children:t.jsx(O,{className:"h-3.5 w-3.5"})}),e.can_manage&&t.jsx("button",{type:"button",onClick:()=>N("template"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.edit"),children:t.jsx(F,{className:"h-3.5 w-3.5"})}),t.jsxs("button",{type:"button",onClick:L,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${r("artifacts.copyLink")} · ${r("artifacts.linkNotice")}`,children:[t.jsx(J,{className:"h-3.5 w-3.5"}),p&&t.jsx("span",{className:"text-status-active",children:r("artifacts.copied")})]}),t.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.openInNewTab"),children:t.jsx(G,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:r("artifacts.delete"),children:t.jsx(R,{className:"h-3.5 w-3.5"})})]})]}),t.jsx("iframe",{src:`${e.url}${e.url.includes("?")?"&":"?"}_=${Date.now()}`,title:e.title||e.id,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"},S),t.jsx(K,{open:w,onClose:()=>h(!1),onCreated:$,editArtifact:g,initialMode:E})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:r("common.loading")})}export{I as ArtifactView};
1
+ import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{aW as A,a6 as j,aO as r,a2 as q,az as O,P as R,N as U}from"./main-C6WmTrH-.js";import{S as F,E as G,C as K}from"./ArtifactsGallery-zcPFEYGI.js";import{R as P}from"./refresh-cw-YG-5Bnbb.js";import{C as z}from"./copy-DJwGKEGD.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";import"./dialog-DVA4KU9G.js";let m=null;function J(n,c,e=0){b();const o=`/web/sessions/${n}/events`,l=new EventSource(o,{withCredentials:!0});m=l;let u=e;l.addEventListener("message",p=>{try{const x=JSON.parse(p.data);if(x.seqNum!==void 0&&x.seqNum<=u)return;x.seqNum!==void 0&&(u=x.seqNum),c(x)}catch{}}),l.addEventListener("error",()=>{console.warn("[SSE] error, readyState:",l.readyState),l.readyState===EventSource.CLOSED&&(l.close(),b())})}function b(){m&&(m.close(),m=null)}function M(n,c){const e=a.useRef(c);e.current=c;const o=a.useCallback(l=>{e.current(l)},[]);a.useEffect(()=>{if(n)return J(n,o),()=>{b()}},[n,o])}function I({artifactId:n,onBack:c}){A();const[e,o]=a.useState(null),[l,u]=a.useState(""),[p,x]=a.useState(!1),[S,f]=a.useState(0),[w,h]=a.useState(!1),[g,C]=a.useState(null),[E,k]=a.useState("template"),[d,y]=a.useState(!1);a.useEffect(()=>{let s=!1;return j(n).then(i=>{s||o(i)}).catch(i=>{s||u(i instanceof Error?i.message:r("artifacts.viewNotFound"))}),()=>{s=!0}},[n]);const v=a.useCallback(()=>{j(n).then(s=>o(s)).catch(()=>{})},[n]),_=a.useCallback(s=>{var i;s.type==="artifact_updated"&&((i=s.payload)!=null&&i.id&&s.payload.id!==n||(v(),f(D=>D+1),y(!0)))},[n,v]);M((e==null?void 0:e.session_id)??null,_),a.useEffect(()=>{if(!d)return;const s=setTimeout(()=>y(!1),2500);return()=>clearTimeout(s)},[d]);const N=a.useCallback(s=>{e&&(C(e),k(s),h(!0))},[e]),$=a.useCallback(s=>{h(!1),o(i=>i?{...i,...s}:s),f(i=>i+1)},[]),T=a.useCallback(async()=>{if(window.confirm(r("artifacts.delete")+" — "+n.slice(0,8)+"…?"))try{await q(n),c()}catch(s){alert(s instanceof Error?s.message:r("artifacts.deleteFailed"))}},[n,c]),L=a.useCallback(async()=>{if(!e)return;await O(`${window.location.origin}${e.url}`)&&(x(!0),setTimeout(()=>x(!1),1500))},[e]);return l?t.jsx("div",{className:"flex flex-1 items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-status-error",children:r("artifacts.viewNotFound")}),t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:l}),t.jsx("button",{type:"button",onClick:c,className:"mt-4 rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:r("artifacts.backToGallery")})]})}):e?t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-surface-1 px-4 py-2.5",children:[t.jsx("button",{type:"button",onClick:c,className:"text-sm text-text-muted hover:text-text-primary",children:r("artifacts.backToGallery")}),t.jsx("span",{className:"text-text-muted/40",children:"/"}),t.jsx("span",{className:"truncate font-medium text-text-primary",children:e.title||e.id.slice(0,12)}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] transition-colors ${d?"bg-status-active/15 text-status-active":"bg-surface-3 text-text-muted"}`,title:d?r("artifacts.view.liveUpdated"):void 0,children:d?`↻ v${e.version}`:`v${e.version}`}),e.session_id&&t.jsxs("a",{href:`/code/${e.session_id}`,className:"truncate font-mono text-[10px] text-text-muted hover:text-accent",title:e.session_id,children:[r("artifacts.session"),": ",e.session_id.slice(0,14),"…"]}),e.expires_at&&t.jsxs("span",{className:"text-[10px] text-text-muted",title:e.expires_at,children:[r("artifacts.expires"),": ",new Date(e.expires_at).toLocaleDateString()]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx("button",{type:"button",onClick:()=>f(s=>s+1),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("common.loading"),children:t.jsx(P,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:()=>N("ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.aiUpdate"),children:t.jsx(F,{className:"h-3.5 w-3.5"})}),e.can_manage&&t.jsx("button",{type:"button",onClick:()=>N("template"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.edit"),children:t.jsx(R,{className:"h-3.5 w-3.5"})}),t.jsxs("button",{type:"button",onClick:L,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${r("artifacts.copyLink")} · ${r("artifacts.linkNotice")}`,children:[t.jsx(z,{className:"h-3.5 w-3.5"}),p&&t.jsx("span",{className:"text-status-active",children:r("artifacts.copied")})]}),t.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.openInNewTab"),children:t.jsx(G,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:r("artifacts.delete"),children:t.jsx(U,{className:"h-3.5 w-3.5"})})]})]}),t.jsx("iframe",{src:`${e.url}${e.url.includes("?")?"&":"?"}_=${Date.now()}`,title:e.title||e.id,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"},S),t.jsx(K,{open:w,onClose:()=>h(!1),onCreated:$,editArtifact:g,initialMode:E})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:r("common.loading")})}export{I as ArtifactView};
@@ -1,4 +1,4 @@
1
- var pt=Object.defineProperty;var ht=(t,e,r)=>e in t?pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var S=(t,e,r)=>ht(t,typeof e!="symbol"?e+"":e,r);import{e as k,j as o}from"./vendor-DE_-CLIE.js";import{aG as Te,aL as ut,b0 as Qe,b1 as ft,a9 as mt,aU as f,a3 as xt,aF as gt,F as bt,i as kt,P as yt,N as wt,t as vt,a8 as St,al as Rt,aP as Tt,ak as $t,ax as jt,ay as Et,_ as Nt,b as Ct}from"./main-BBG6f1iy.js";import{D as It,a as At,c as Lt,d as zt,b as _t}from"./dialog-My0549rQ.js";import{C as Dt}from"./copy-Cn9qqwnz.js";/**
1
+ var pt=Object.defineProperty;var ht=(t,e,r)=>e in t?pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var S=(t,e,r)=>ht(t,typeof e!="symbol"?e+"":e,r);import{e as k,j as o}from"./vendor-DE_-CLIE.js";import{aA as Te,aF as ut,aW as Qe,aX as ft,a7 as mt,aO as f,a2 as xt,az as gt,F as bt,i as kt,P as yt,N as wt,t as vt,a6 as St,ah as Rt,aJ as Tt,ag as $t,as as jt,at as Et,_ as Nt,b as Ct}from"./main-C6WmTrH-.js";import{D as It,a as At,c as zt,d as Lt,b as _t}from"./dialog-DVA4KU9G.js";import{C as Dt}from"./copy-DJwGKEGD.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -351,11 +351,11 @@ function render() {
351
351
  render();
352
352
  <\/script>
353
353
  </body>
354
- </html>`,ye=[{id:"blank",titleKey:"artifacts.create.templateBlank",descKey:"",defaultTitle:"Untitled Artifact",html:Ot},{id:"pr-review",titleKey:"artifacts.create.templatePrReview",descKey:"artifacts.templateDesc.prReview",defaultTitle:"PR Review",html:Kt},{id:"incident",titleKey:"artifacts.create.templateIncident",descKey:"artifacts.templateDesc.incident",defaultTitle:"Incident Timeline",html:Zt},{id:"dashboard",titleKey:"artifacts.create.templateDashboard",descKey:"artifacts.templateDesc.dashboard",defaultTitle:"Data Dashboard",html:Gt},{id:"checklist",titleKey:"artifacts.create.templateChecklist",descKey:"artifacts.templateDesc.checklist",defaultTitle:"Release Checklist",html:Ut}];function Y(t){return ye.find(e=>e.id===t)??ye[0]}function $e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var K=$e();function Ve(t){K=t}var F={exec:()=>null};function w(t,e=""){let r=typeof t=="string"?t:t.source,a={replace:(s,l)=>{let i=typeof l=="string"?l:l.source;return i=i.replace(j.caret,"$1"),r=r.replace(s,i),a},getRegex:()=>new RegExp(r,e)};return a}var Qt=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),j={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Vt=/^(?:[ \t]*(?:\n|$))+/,Wt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Xt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,se=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Yt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,je=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,We=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xe=w(We).replace(/bull/g,je).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Jt=w(We).replace(/bull/g,je).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ee=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,er=/^[^\n]+/,Ne=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tr=w(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ne).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rr=w(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,je).getRegex(),he="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ce=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sr=w("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ce).replace("tag",he).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ye=w(Ee).replace("hr",se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),ar=w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ye).getRegex(),Ie={blockquote:ar,code:Wt,def:tr,fences:Xt,heading:Yt,hr:se,html:sr,lheading:Xe,list:rr,newline:Vt,paragraph:Ye,table:F,text:er},He=w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),nr={...Ie,lheading:Jt,table:He,paragraph:w(Ee).replace("hr",se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",He).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex()},ir={...Ie,html:w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ce).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:F,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:w(Ee).replace("hr",se).replace("heading",` *#{1,6} *[^
355
- ]`).replace("lheading",Xe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,or=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Je=/^( {2,}|\\)\n(?!\s*$)/,cr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,W=/[\p{P}\p{S}]/u,ue=/[\s\p{P}\p{S}]/u,Ae=/[^\s\p{P}\p{S}]/u,dr=w(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ue).getRegex(),et=/(?!~)[\p{P}\p{S}]/u,pr=/(?!~)[\s\p{P}\p{S}]/u,hr=/(?:[^\s\p{P}\p{S}]|~)/u,ur=w(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Qt?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),tt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,fr=w(tt,"u").replace(/punct/g,W).getRegex(),mr=w(tt,"u").replace(/punct/g,et).getRegex(),rt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xr=w(rt,"gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,ue).replace(/punct/g,W).getRegex(),gr=w(rt,"gu").replace(/notPunctSpace/g,hr).replace(/punctSpace/g,pr).replace(/punct/g,et).getRegex(),br=w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,ue).replace(/punct/g,W).getRegex(),kr=w(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,W).getRegex(),yr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",wr=w(yr,"gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,ue).replace(/punct/g,W).getRegex(),vr=w(/\\(punct)/,"gu").replace(/punct/g,W).getRegex(),Sr=w(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Rr=w(Ce).replace("(?:-->|$)","-->").getRegex(),Tr=w("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ce=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,$r=w(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ce).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),st=w(/^!?\[(label)\]\[(ref)\]/).replace("label",ce).replace("ref",Ne).getRegex(),at=w(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ne).getRegex(),jr=w("reflink|nolink(?!\\()","g").replace("reflink",st).replace("nolink",at).getRegex(),Fe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Le={_backpedal:F,anyPunctuation:vr,autolink:Sr,blockSkip:ur,br:Je,code:or,del:F,delLDelim:F,delRDelim:F,emStrongLDelim:fr,emStrongRDelimAst:xr,emStrongRDelimUnd:br,escape:lr,link:$r,nolink:at,punctuation:dr,reflink:st,reflinkSearch:jr,tag:Tr,text:cr,url:F},Er={...Le,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",ce).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ce).getRegex()},we={...Le,emStrongRDelimAst:gr,emStrongLDelim:mr,delLDelim:kr,delRDelim:wr,url:w(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Fe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:w(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Fe).getRegex()},Nr={...we,br:w(Je).replace("{2,}","*").getRegex(),text:w(we.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},le={normal:Ie,gfm:nr,pedantic:ir},J={normal:Le,gfm:we,breaks:Nr,pedantic:Er},Cr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Oe=t=>Cr[t];function D(t,e){if(e){if(j.escapeTest.test(t))return t.replace(j.escapeReplace,Oe)}else if(j.escapeTestNoEncode.test(t))return t.replace(j.escapeReplaceNoEncode,Oe);return t}function Ke(t){try{t=encodeURI(t).replace(j.percentDecode,"%")}catch{return null}return t}function Ze(t,e){var l;let r=t.replace(j.findPipe,(i,n,h)=>{let c=!1,u=n;for(;--u>=0&&h[u]==="\\";)c=!c;return c?"|":" |"}),a=r.split(j.splitPipe),s=0;if(a[0].trim()||a.shift(),a.length>0&&!((l=a.at(-1))!=null&&l.trim())&&a.pop(),e)if(a.length>e)a.splice(e);else for(;a.length<e;)a.push("");for(;s<a.length;s++)a[s]=a[s].trim().replace(j.slashPipe,"|");return a}function ee(t,e,r){let a=t.length;if(a===0)return"";let s=0;for(;s<a&&t.charAt(a-s-1)===e;)s++;return t.slice(0,a-s)}function Ir(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let a=0;a<t.length;a++)if(t[a]==="\\")a++;else if(t[a]===e[0])r++;else if(t[a]===e[1]&&(r--,r<0))return a;return r>0?-2:-1}function Ar(t,e=0){let r=e,a="";for(let s of t)if(s===" "){let l=4-r%4;a+=" ".repeat(l),r+=l}else a+=s,r++;return a}function Ge(t,e,r,a,s){let l=e.href,i=e.title||null,n=t[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;let h={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:l,title:i,text:n,tokens:a.inlineTokens(n)};return a.state.inLink=!1,h}function Lr(t,e,r){let a=t.match(r.other.indentCodeCompensation);if(a===null)return e;let s=a[1];return e.split(`
354
+ </html>`,ye=[{id:"blank",titleKey:"artifacts.create.templateBlank",descKey:"",defaultTitle:"Untitled Artifact",html:Ot},{id:"pr-review",titleKey:"artifacts.create.templatePrReview",descKey:"artifacts.templateDesc.prReview",defaultTitle:"PR Review",html:Kt},{id:"incident",titleKey:"artifacts.create.templateIncident",descKey:"artifacts.templateDesc.incident",defaultTitle:"Incident Timeline",html:Zt},{id:"dashboard",titleKey:"artifacts.create.templateDashboard",descKey:"artifacts.templateDesc.dashboard",defaultTitle:"Data Dashboard",html:Gt},{id:"checklist",titleKey:"artifacts.create.templateChecklist",descKey:"artifacts.templateDesc.checklist",defaultTitle:"Release Checklist",html:Ut}];function Y(t){return ye.find(e=>e.id===t)??ye[0]}function $e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var K=$e();function We(t){K=t}var F={exec:()=>null};function w(t,e=""){let r=typeof t=="string"?t:t.source,a={replace:(s,l)=>{let i=typeof l=="string"?l:l.source;return i=i.replace(j.caret,"$1"),r=r.replace(s,i),a},getRegex:()=>new RegExp(r,e)};return a}var Qt=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),j={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Wt=/^(?:[ \t]*(?:\n|$))+/,Vt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Xt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,se=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Yt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,je=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ve=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xe=w(Ve).replace(/bull/g,je).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Jt=w(Ve).replace(/bull/g,je).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ee=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,er=/^[^\n]+/,Ne=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tr=w(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ne).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rr=w(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,je).getRegex(),he="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ce=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sr=w("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ce).replace("tag",he).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ye=w(Ee).replace("hr",se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),ar=w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ye).getRegex(),Ie={blockquote:ar,code:Vt,def:tr,fences:Xt,heading:Yt,hr:se,html:sr,lheading:Xe,list:rr,newline:Wt,paragraph:Ye,table:F,text:er},He=w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),nr={...Ie,lheading:Jt,table:He,paragraph:w(Ee).replace("hr",se).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",He).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex()},ir={...Ie,html:w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ce).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:F,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:w(Ee).replace("hr",se).replace("heading",` *#{1,6} *[^
355
+ ]`).replace("lheading",Xe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,or=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Je=/^( {2,}|\\)\n(?!\s*$)/,cr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,V=/[\p{P}\p{S}]/u,ue=/[\s\p{P}\p{S}]/u,Ae=/[^\s\p{P}\p{S}]/u,dr=w(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ue).getRegex(),et=/(?!~)[\p{P}\p{S}]/u,pr=/(?!~)[\s\p{P}\p{S}]/u,hr=/(?:[^\s\p{P}\p{S}]|~)/u,ur=w(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Qt?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),tt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,fr=w(tt,"u").replace(/punct/g,V).getRegex(),mr=w(tt,"u").replace(/punct/g,et).getRegex(),rt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xr=w(rt,"gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,ue).replace(/punct/g,V).getRegex(),gr=w(rt,"gu").replace(/notPunctSpace/g,hr).replace(/punctSpace/g,pr).replace(/punct/g,et).getRegex(),br=w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,ue).replace(/punct/g,V).getRegex(),kr=w(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,V).getRegex(),yr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",wr=w(yr,"gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,ue).replace(/punct/g,V).getRegex(),vr=w(/\\(punct)/,"gu").replace(/punct/g,V).getRegex(),Sr=w(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Rr=w(Ce).replace("(?:-->|$)","-->").getRegex(),Tr=w("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ce=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,$r=w(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ce).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),st=w(/^!?\[(label)\]\[(ref)\]/).replace("label",ce).replace("ref",Ne).getRegex(),at=w(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ne).getRegex(),jr=w("reflink|nolink(?!\\()","g").replace("reflink",st).replace("nolink",at).getRegex(),Fe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ze={_backpedal:F,anyPunctuation:vr,autolink:Sr,blockSkip:ur,br:Je,code:or,del:F,delLDelim:F,delRDelim:F,emStrongLDelim:fr,emStrongRDelimAst:xr,emStrongRDelimUnd:br,escape:lr,link:$r,nolink:at,punctuation:dr,reflink:st,reflinkSearch:jr,tag:Tr,text:cr,url:F},Er={...ze,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",ce).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ce).getRegex()},we={...ze,emStrongRDelimAst:gr,emStrongLDelim:mr,delLDelim:kr,delRDelim:wr,url:w(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Fe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:w(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Fe).getRegex()},Nr={...we,br:w(Je).replace("{2,}","*").getRegex(),text:w(we.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},le={normal:Ie,gfm:nr,pedantic:ir},J={normal:ze,gfm:we,breaks:Nr,pedantic:Er},Cr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Oe=t=>Cr[t];function D(t,e){if(e){if(j.escapeTest.test(t))return t.replace(j.escapeReplace,Oe)}else if(j.escapeTestNoEncode.test(t))return t.replace(j.escapeReplaceNoEncode,Oe);return t}function Ke(t){try{t=encodeURI(t).replace(j.percentDecode,"%")}catch{return null}return t}function Ze(t,e){var l;let r=t.replace(j.findPipe,(i,n,h)=>{let c=!1,u=n;for(;--u>=0&&h[u]==="\\";)c=!c;return c?"|":" |"}),a=r.split(j.splitPipe),s=0;if(a[0].trim()||a.shift(),a.length>0&&!((l=a.at(-1))!=null&&l.trim())&&a.pop(),e)if(a.length>e)a.splice(e);else for(;a.length<e;)a.push("");for(;s<a.length;s++)a[s]=a[s].trim().replace(j.slashPipe,"|");return a}function ee(t,e,r){let a=t.length;if(a===0)return"";let s=0;for(;s<a&&t.charAt(a-s-1)===e;)s++;return t.slice(0,a-s)}function Ir(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let a=0;a<t.length;a++)if(t[a]==="\\")a++;else if(t[a]===e[0])r++;else if(t[a]===e[1]&&(r--,r<0))return a;return r>0?-2:-1}function Ar(t,e=0){let r=e,a="";for(let s of t)if(s===" "){let l=4-r%4;a+=" ".repeat(l),r+=l}else a+=s,r++;return a}function Ge(t,e,r,a,s){let l=e.href,i=e.title||null,n=t[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;let h={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:l,title:i,text:n,tokens:a.inlineTokens(n)};return a.state.inLink=!1,h}function zr(t,e,r){let a=t.match(r.other.indentCodeCompensation);if(a===null)return e;let s=a[1];return e.split(`
356
356
  `).map(l=>{let i=l.match(r.other.beginningSpace);if(i===null)return l;let[n]=i;return n.length>=s.length?l.slice(s.length):l}).join(`
357
357
  `)}var de=class{constructor(t){S(this,"options");S(this,"rules");S(this,"lexer");this.options=t||K}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:ee(r,`
358
- `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],a=Lr(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:a}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let a=ee(r,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(r=a.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:ee(e[0],`
358
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],a=zr(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:a}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let a=ee(r,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(r=a.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:ee(e[0],`
359
359
  `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=ee(e[0],`
360
360
  `).split(`
361
361
  `),a="",s="",l=[];for(;r.length>0;){let i=!1,n=[],h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))n.push(r[h]),i=!0;else if(!i)n.push(r[h]);else break;r=r.slice(h);let c=n.join(`
@@ -376,7 +376,7 @@ ${u}`:u;let x=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
376
376
  `+y}b=!y.trim(),x+=P+`
377
377
  `,t=t.substring(P.length+1),d=A.slice(R)}}i.loose||(h?i.loose=!0:this.rules.other.doubleBlankLine.test(x)&&(h=!0)),i.items.push({type:"list_item",raw:x,task:!!this.options.gfm&&this.rules.other.listIsTask.test(m),loose:!1,text:m,tokens:[]}),i.raw+=x}let c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u of i.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((r=u.tokens[0])==null?void 0:r.type)==="text"||((a=u.tokens[0])==null?void 0:a.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let m=this.lexer.inlineQueue.length-1;m>=0;m--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[m].src)){this.lexer.inlineQueue[m].src=this.lexer.inlineQueue[m].src.replace(this.rules.other.listReplaceTask,"");break}}let x=this.rules.other.listTaskCheckbox.exec(u.raw);if(x){let m={type:"checkbox",raw:x[0]+" ",checked:x[0]!=="[ ]"};u.checked=m.checked,i.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=m.raw+u.tokens[0].raw,u.tokens[0].text=m.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(m)):u.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):u.tokens.unshift(m)}}if(!i.loose){let x=u.tokens.filter(d=>d.type==="space"),m=x.length>0&&x.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=m}}if(i.loose)for(let u of i.items){u.loose=!0;for(let x of u.tokens)x.type==="text"&&(x.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:a,title:s}}}table(t){var i;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=Ze(e[1]),a=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(i=e[3])!=null&&i.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
378
378
  `):[],l={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===a.length){for(let n of a)this.rules.other.tableAlignRight.test(n)?l.align.push("right"):this.rules.other.tableAlignCenter.test(n)?l.align.push("center"):this.rules.other.tableAlignLeft.test(n)?l.align.push("left"):l.align.push(null);for(let n=0;n<r.length;n++)l.header.push({text:r[n],tokens:this.lexer.inline(r[n]),header:!0,align:l.align[n]});for(let n of s)l.rows.push(Ze(n,l.header.length).map((h,c)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:l.align[c]})));return l}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
379
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let l=ee(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{let l=Ir(e[2],"()");if(l===-2)return;if(l>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let a=e[2],s="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],s=l[3])}else s=e[3]?e[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a=a.slice(1):a=a.slice(1,-1)),Ge(e,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let a=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[a.toLowerCase()];if(!s){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return Ge(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let a=this.rules.inline.emStrongLDelim.exec(t);if(!(!a||!a[1]&&!a[2]&&!a[3]&&!a[4]||a[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[3])||!r||this.rules.inline.punctuation.exec(r))){let s=[...a[0]].length-1,l,i,n=s,h=0,c=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(a=c.exec(e))!==null;){if(l=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!l)continue;if(i=[...l].length,a[3]||a[4]){n+=i;continue}else if((a[5]||a[6])&&s%3&&!((s+i)%3)){h+=i;continue}if(n-=i,n>0)continue;i=Math.min(i,i+n+h);let u=[...a[0]][0].length,x=t.slice(0,s+a.index+u+i);if(Math.min(s,i)%2){let d=x.slice(1,-1);return{type:"em",raw:x,text:d,tokens:this.lexer.inlineTokens(d)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return a&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let a=this.rules.inline.delLDelim.exec(t);if(a&&(!a[1]||!r||this.rules.inline.punctuation.exec(r))){let s=[...a[0]].length-1,l,i,n=s,h=this.rules.inline.delRDelim;for(h.lastIndex=0,e=e.slice(-1*t.length+s);(a=h.exec(e))!==null;){if(l=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!l||(i=[...l].length,i!==s))continue;if(a[3]||a[4]){n+=i;continue}if(n-=i,n>0)continue;i=Math.min(i,i+n);let c=[...a[0]][0].length,u=t.slice(0,s+a.index+c+i),x=u.slice(s,-s);return{type:"del",raw:u,text:x,tokens:this.lexer.inlineTokens(x)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,a;return e[2]==="@"?(r=e[1],a="mailto:"+r):(r=e[1],a=r),{type:"link",raw:e[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let a,s;if(e[2]==="@")a=e[0],s="mailto:"+a;else{let l;do l=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(l!==e[0]);a=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:a,href:s,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},L=class ve{constructor(e){S(this,"tokens");S(this,"options");S(this,"state");S(this,"inlineQueue");S(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||K,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:j,block:le.normal,inline:J.normal};this.options.pedantic?(r.block=le.pedantic,r.inline=J.pedantic):this.options.gfm&&(r.block=le.gfm,this.options.breaks?r.inline=J.breaks:r.inline=J.gfm),this.tokenizer.rules=r}static get rules(){return{block:le,inline:J}}static lex(e,r){return new ve(r).lex(e)}static lexInline(e,r){return new ve(r).inlineTokens(e)}lex(e){e=e.replace(j.carriageReturn,`
379
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let l=ee(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{let l=Ir(e[2],"()");if(l===-2)return;if(l>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let a=e[2],s="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],s=l[3])}else s=e[3]?e[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a=a.slice(1):a=a.slice(1,-1)),Ge(e,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let a=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[a.toLowerCase()];if(!s){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return Ge(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let a=this.rules.inline.emStrongLDelim.exec(t);if(!(!a||!a[1]&&!a[2]&&!a[3]&&!a[4]||a[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[3])||!r||this.rules.inline.punctuation.exec(r))){let s=[...a[0]].length-1,l,i,n=s,h=0,c=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(a=c.exec(e))!==null;){if(l=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!l)continue;if(i=[...l].length,a[3]||a[4]){n+=i;continue}else if((a[5]||a[6])&&s%3&&!((s+i)%3)){h+=i;continue}if(n-=i,n>0)continue;i=Math.min(i,i+n+h);let u=[...a[0]][0].length,x=t.slice(0,s+a.index+u+i);if(Math.min(s,i)%2){let d=x.slice(1,-1);return{type:"em",raw:x,text:d,tokens:this.lexer.inlineTokens(d)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return a&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let a=this.rules.inline.delLDelim.exec(t);if(a&&(!a[1]||!r||this.rules.inline.punctuation.exec(r))){let s=[...a[0]].length-1,l,i,n=s,h=this.rules.inline.delRDelim;for(h.lastIndex=0,e=e.slice(-1*t.length+s);(a=h.exec(e))!==null;){if(l=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!l||(i=[...l].length,i!==s))continue;if(a[3]||a[4]){n+=i;continue}if(n-=i,n>0)continue;i=Math.min(i,i+n);let c=[...a[0]][0].length,u=t.slice(0,s+a.index+c+i),x=u.slice(s,-s);return{type:"del",raw:u,text:x,tokens:this.lexer.inlineTokens(x)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,a;return e[2]==="@"?(r=e[1],a="mailto:"+r):(r=e[1],a=r),{type:"link",raw:e[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let a,s;if(e[2]==="@")a=e[0],s="mailto:"+a;else{let l;do l=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(l!==e[0]);a=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:a,href:s,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},z=class ve{constructor(e){S(this,"tokens");S(this,"options");S(this,"state");S(this,"inlineQueue");S(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||K,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:j,block:le.normal,inline:J.normal};this.options.pedantic?(r.block=le.pedantic,r.inline=J.pedantic):this.options.gfm&&(r.block=le.gfm,this.options.breaks?r.inline=J.breaks:r.inline=J.gfm),this.tokenizer.rules=r}static get rules(){return{block:le,inline:J}}static lex(e,r){return new ve(r).lex(e)}static lexInline(e,r){return new ve(r).inlineTokens(e)}lex(e){e=e.replace(j.carriageReturn,`
380
380
  `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let a=this.inlineQueue[r];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],a=!1){var s,l,i;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(j.tabCharGlobal," ").replace(j.spaceLine,""));e;){let n;if((l=(s=this.options.extensions)==null?void 0:s.block)!=null&&l.some(c=>(n=c.call({lexer:this},e,r))?(e=e.substring(n.raw.length),r.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let c=r.at(-1);n.raw.length===1&&c!==void 0?c.raw+=`
381
381
  `:r.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
382
382
  `)?"":`
@@ -408,8 +408,8 @@ ${this.parser.parse(t)}</blockquote>
408
408
  `}tablerow({text:t}){return`<tr>
409
409
  ${t}</tr>
410
410
  `}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
411
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${D(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let a=this.parser.parseInline(r),s=Ke(t);if(s===null)return a;t=s;let l='<a href="'+t+'"';return e&&(l+=' title="'+D(e)+'"'),l+=">"+a+"</a>",l}image({href:t,title:e,text:r,tokens:a}){a&&(r=this.parser.parseInline(a,this.parser.textRenderer));let s=Ke(t);if(s===null)return D(r);t=s;let l=`<img src="${t}" alt="${D(r)}"`;return e&&(l+=` title="${D(e)}"`),l+=">",l}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:D(t.text)}},ze=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},z=class Se{constructor(e){S(this,"options");S(this,"renderer");S(this,"textRenderer");this.options=e||K,this.options.renderer=this.options.renderer||new pe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ze}static parse(e,r){return new Se(r).parse(e)}static parseInline(e,r){return new Se(r).parseInline(e)}parse(e){var a,s;this.renderer.parser=this;let r="";for(let l=0;l<e.length;l++){let i=e[l];if((s=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&s[i.type]){let h=i,c=this.options.extensions.renderers[h.type].call({parser:this},h);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){r+=c||"";continue}}let n=i;switch(n.type){case"space":{r+=this.renderer.space(n);break}case"hr":{r+=this.renderer.hr(n);break}case"heading":{r+=this.renderer.heading(n);break}case"code":{r+=this.renderer.code(n);break}case"table":{r+=this.renderer.table(n);break}case"blockquote":{r+=this.renderer.blockquote(n);break}case"list":{r+=this.renderer.list(n);break}case"checkbox":{r+=this.renderer.checkbox(n);break}case"html":{r+=this.renderer.html(n);break}case"def":{r+=this.renderer.def(n);break}case"paragraph":{r+=this.renderer.paragraph(n);break}case"text":{r+=this.renderer.text(n);break}default:{let h='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}parseInline(e,r=this.renderer){var s,l;this.renderer.parser=this;let a="";for(let i=0;i<e.length;i++){let n=e[i];if((l=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&l[n.type]){let c=this.options.extensions.renderers[n.type].call({parser:this},n);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){a+=c||"";continue}}let h=n;switch(h.type){case"escape":{a+=r.text(h);break}case"html":{a+=r.html(h);break}case"link":{a+=r.link(h);break}case"image":{a+=r.image(h);break}case"checkbox":{a+=r.checkbox(h);break}case"strong":{a+=r.strong(h);break}case"em":{a+=r.em(h);break}case"codespan":{a+=r.codespan(h);break}case"br":{a+=r.br(h);break}case"del":{a+=r.del(h);break}case"text":{a+=r.text(h);break}default:{let c='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return a}},oe,te=(oe=class{constructor(t){S(this,"options");S(this,"block");this.options=t||K}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?L.lex:L.lexInline}provideParser(t=this.block){return t?z.parse:z.parseInline}},S(oe,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),S(oe,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),oe),zr=class{constructor(...t){S(this,"defaults",$e());S(this,"options",this.setOptions);S(this,"parse",this.parseMarkdown(!0));S(this,"parseInline",this.parseMarkdown(!1));S(this,"Parser",z);S(this,"Renderer",pe);S(this,"TextRenderer",ze);S(this,"Lexer",L);S(this,"Tokenizer",de);S(this,"Hooks",te);this.use(...t)}walkTokens(t,e){var a,s;let r=[];for(let l of t)switch(r=r.concat(e.call(this,l)),l.type){case"table":{let i=l;for(let n of i.header)r=r.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let h of n)r=r.concat(this.walkTokens(h.tokens,e));break}case"list":{let i=l;r=r.concat(this.walkTokens(i.items,e));break}default:{let i=l;(s=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&s[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let h=i[n].flat(1/0);r=r.concat(this.walkTokens(h,e))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let a={...r};if(a.async=this.defaults.async||a.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let l=e.renderers[s.name];l?e.renderers[s.name]=function(...i){let n=s.renderer.apply(this,i);return n===!1&&(n=l.apply(this,i)),n}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=e[s.level];l?l.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),a.extensions=e),r.renderer){let s=this.defaults.renderer||new pe(this.defaults);for(let l in r.renderer){if(!(l in s))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let i=l,n=r.renderer[i],h=s[i];s[i]=(...c)=>{let u=n.apply(s,c);return u===!1&&(u=h.apply(s,c)),u||""}}a.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new de(this.defaults);for(let l in r.tokenizer){if(!(l in s))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let i=l,n=r.tokenizer[i],h=s[i];s[i]=(...c)=>{let u=n.apply(s,c);return u===!1&&(u=h.apply(s,c)),u}}a.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new te;for(let l in r.hooks){if(!(l in s))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let i=l,n=r.hooks[i],h=s[i];te.passThroughHooks.has(l)?s[i]=c=>{if(this.defaults.async&&te.passThroughHooksRespectAsync.has(l))return(async()=>{let x=await n.call(s,c);return h.call(s,x)})();let u=n.call(s,c);return h.call(s,u)}:s[i]=(...c)=>{if(this.defaults.async)return(async()=>{let x=await n.apply(s,c);return x===!1&&(x=await h.apply(s,c)),x})();let u=n.apply(s,c);return u===!1&&(u=h.apply(s,c)),u}}a.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,l=r.walkTokens;a.walkTokens=function(i){let n=[];return n.push(l.call(this,i)),s&&(n=n.concat(s.call(this,i))),n}}this.defaults={...this.defaults,...a}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return L.lex(t,e??this.defaults)}parser(t,e){return z.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let a={...r},s={...this.defaults,...a},l=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&a.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let i=s.hooks?await s.hooks.preprocess(e):e,n=await(s.hooks?await s.hooks.provideLexer(t):t?L.lex:L.lexInline)(i,s),h=s.hooks?await s.hooks.processAllTokens(n):n;s.walkTokens&&await Promise.all(this.walkTokens(h,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?z.parse:z.parseInline)(h,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(l);try{s.hooks&&(e=s.hooks.preprocess(e));let i=(s.hooks?s.hooks.provideLexer(t):t?L.lex:L.lexInline)(e,s);s.hooks&&(i=s.hooks.processAllTokens(i)),s.walkTokens&&this.walkTokens(i,s.walkTokens);let n=(s.hooks?s.hooks.provideParser(t):t?z.parse:z.parseInline)(i,s);return s.hooks&&(n=s.hooks.postprocess(n)),n}catch(i){return l(i)}}}onError(t,e){return r=>{if(r.message+=`
412
- Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error occurred:</p><pre>"+D(r.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(r);throw r}}},O=new zr;function v(t,e){return O.parse(t,e)}v.options=v.setOptions=function(t){return O.setOptions(t),v.defaults=O.defaults,Ve(v.defaults),v};v.getDefaults=$e;v.defaults=K;v.use=function(...t){return O.use(...t),v.defaults=O.defaults,Ve(v.defaults),v};v.walkTokens=function(t,e){return O.walkTokens(t,e)};v.parseInline=O.parseInline;v.Parser=z;v.parser=z.parse;v.Renderer=pe;v.TextRenderer=ze;v.Lexer=L;v.lexer=L.lex;v.Tokenizer=de;v.Hooks=te;v.parse=v;v.options;v.setOptions;v.use;v.walkTokens;v.parseInline;z.parse;L.lex;const ke="#D77757",_r=`body { font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 800px; margin: 2rem auto; padding: 0 1rem; color: #1a1a1a; }
411
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${D(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let a=this.parser.parseInline(r),s=Ke(t);if(s===null)return a;t=s;let l='<a href="'+t+'"';return e&&(l+=' title="'+D(e)+'"'),l+=">"+a+"</a>",l}image({href:t,title:e,text:r,tokens:a}){a&&(r=this.parser.parseInline(a,this.parser.textRenderer));let s=Ke(t);if(s===null)return D(r);t=s;let l=`<img src="${t}" alt="${D(r)}"`;return e&&(l+=` title="${D(e)}"`),l+=">",l}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:D(t.text)}},Le=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},L=class Se{constructor(e){S(this,"options");S(this,"renderer");S(this,"textRenderer");this.options=e||K,this.options.renderer=this.options.renderer||new pe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Le}static parse(e,r){return new Se(r).parse(e)}static parseInline(e,r){return new Se(r).parseInline(e)}parse(e){var a,s;this.renderer.parser=this;let r="";for(let l=0;l<e.length;l++){let i=e[l];if((s=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&s[i.type]){let h=i,c=this.options.extensions.renderers[h.type].call({parser:this},h);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){r+=c||"";continue}}let n=i;switch(n.type){case"space":{r+=this.renderer.space(n);break}case"hr":{r+=this.renderer.hr(n);break}case"heading":{r+=this.renderer.heading(n);break}case"code":{r+=this.renderer.code(n);break}case"table":{r+=this.renderer.table(n);break}case"blockquote":{r+=this.renderer.blockquote(n);break}case"list":{r+=this.renderer.list(n);break}case"checkbox":{r+=this.renderer.checkbox(n);break}case"html":{r+=this.renderer.html(n);break}case"def":{r+=this.renderer.def(n);break}case"paragraph":{r+=this.renderer.paragraph(n);break}case"text":{r+=this.renderer.text(n);break}default:{let h='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}parseInline(e,r=this.renderer){var s,l;this.renderer.parser=this;let a="";for(let i=0;i<e.length;i++){let n=e[i];if((l=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&l[n.type]){let c=this.options.extensions.renderers[n.type].call({parser:this},n);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){a+=c||"";continue}}let h=n;switch(h.type){case"escape":{a+=r.text(h);break}case"html":{a+=r.html(h);break}case"link":{a+=r.link(h);break}case"image":{a+=r.image(h);break}case"checkbox":{a+=r.checkbox(h);break}case"strong":{a+=r.strong(h);break}case"em":{a+=r.em(h);break}case"codespan":{a+=r.codespan(h);break}case"br":{a+=r.br(h);break}case"del":{a+=r.del(h);break}case"text":{a+=r.text(h);break}default:{let c='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return a}},oe,te=(oe=class{constructor(t){S(this,"options");S(this,"block");this.options=t||K}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?z.lex:z.lexInline}provideParser(t=this.block){return t?L.parse:L.parseInline}},S(oe,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),S(oe,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),oe),Lr=class{constructor(...t){S(this,"defaults",$e());S(this,"options",this.setOptions);S(this,"parse",this.parseMarkdown(!0));S(this,"parseInline",this.parseMarkdown(!1));S(this,"Parser",L);S(this,"Renderer",pe);S(this,"TextRenderer",Le);S(this,"Lexer",z);S(this,"Tokenizer",de);S(this,"Hooks",te);this.use(...t)}walkTokens(t,e){var a,s;let r=[];for(let l of t)switch(r=r.concat(e.call(this,l)),l.type){case"table":{let i=l;for(let n of i.header)r=r.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let h of n)r=r.concat(this.walkTokens(h.tokens,e));break}case"list":{let i=l;r=r.concat(this.walkTokens(i.items,e));break}default:{let i=l;(s=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&s[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let h=i[n].flat(1/0);r=r.concat(this.walkTokens(h,e))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let a={...r};if(a.async=this.defaults.async||a.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let l=e.renderers[s.name];l?e.renderers[s.name]=function(...i){let n=s.renderer.apply(this,i);return n===!1&&(n=l.apply(this,i)),n}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=e[s.level];l?l.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),a.extensions=e),r.renderer){let s=this.defaults.renderer||new pe(this.defaults);for(let l in r.renderer){if(!(l in s))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let i=l,n=r.renderer[i],h=s[i];s[i]=(...c)=>{let u=n.apply(s,c);return u===!1&&(u=h.apply(s,c)),u||""}}a.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new de(this.defaults);for(let l in r.tokenizer){if(!(l in s))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let i=l,n=r.tokenizer[i],h=s[i];s[i]=(...c)=>{let u=n.apply(s,c);return u===!1&&(u=h.apply(s,c)),u}}a.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new te;for(let l in r.hooks){if(!(l in s))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let i=l,n=r.hooks[i],h=s[i];te.passThroughHooks.has(l)?s[i]=c=>{if(this.defaults.async&&te.passThroughHooksRespectAsync.has(l))return(async()=>{let x=await n.call(s,c);return h.call(s,x)})();let u=n.call(s,c);return h.call(s,u)}:s[i]=(...c)=>{if(this.defaults.async)return(async()=>{let x=await n.apply(s,c);return x===!1&&(x=await h.apply(s,c)),x})();let u=n.apply(s,c);return u===!1&&(u=h.apply(s,c)),u}}a.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,l=r.walkTokens;a.walkTokens=function(i){let n=[];return n.push(l.call(this,i)),s&&(n=n.concat(s.call(this,i))),n}}this.defaults={...this.defaults,...a}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return z.lex(t,e??this.defaults)}parser(t,e){return L.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let a={...r},s={...this.defaults,...a},l=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&a.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let i=s.hooks?await s.hooks.preprocess(e):e,n=await(s.hooks?await s.hooks.provideLexer(t):t?z.lex:z.lexInline)(i,s),h=s.hooks?await s.hooks.processAllTokens(n):n;s.walkTokens&&await Promise.all(this.walkTokens(h,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?L.parse:L.parseInline)(h,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(l);try{s.hooks&&(e=s.hooks.preprocess(e));let i=(s.hooks?s.hooks.provideLexer(t):t?z.lex:z.lexInline)(e,s);s.hooks&&(i=s.hooks.processAllTokens(i)),s.walkTokens&&this.walkTokens(i,s.walkTokens);let n=(s.hooks?s.hooks.provideParser(t):t?L.parse:L.parseInline)(i,s);return s.hooks&&(n=s.hooks.postprocess(n)),n}catch(i){return l(i)}}}onError(t,e){return r=>{if(r.message+=`
412
+ Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error occurred:</p><pre>"+D(r.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(r);throw r}}},O=new Lr;function v(t,e){return O.parse(t,e)}v.options=v.setOptions=function(t){return O.setOptions(t),v.defaults=O.defaults,We(v.defaults),v};v.getDefaults=$e;v.defaults=K;v.use=function(...t){return O.use(...t),v.defaults=O.defaults,We(v.defaults),v};v.walkTokens=function(t,e){return O.walkTokens(t,e)};v.parseInline=O.parseInline;v.Parser=L;v.parser=L.parse;v.Renderer=pe;v.TextRenderer=Le;v.Lexer=z;v.lexer=z.lex;v.Tokenizer=de;v.Hooks=te;v.parse=v;v.options;v.setOptions;v.use;v.walkTokens;v.parseInline;L.parse;z.lex;const ke="#D77757",_r=`body { font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 800px; margin: 2rem auto; padding: 0 1rem; color: #1a1a1a; }
413
413
  h1 { border-bottom: 2px solid ${ke}; padding-bottom: .3rem; }
414
414
  h2 { margin-top: 1.5em; }
415
415
  img { max-width: 100%; }
@@ -435,5 +435,5 @@ ${_r}
435
435
  ${e}
436
436
  </body>
437
437
  </html>`,title:r}}const nt="---8<---";function Pr(){const t=new Uint8Array(4);globalThis.crypto.getRandomValues(t);const e=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${nt} ${e} ---`}function Br(t){return t.replace(/-{2,}\s*8<\s*-{2,}/g,"- - 8< - -")}function qr(t,e){return t?e?"Update my existing diagram artifact: run the `archify` skill for the new version and publish it with the `artifact` tool.":"Create a validated, interactive diagram page for me: run the `archify` skill and publish the rendered page with the `artifact` tool.":e?"Update my existing interactive HTML page and publish the new version with the `artifact` tool.":"Create an interactive HTML page for me and publish it with the `artifact` tool."}function Hr(t,e,r){const a=(r==null?void 0:r.archify)===!0,s=Br(t.trim()),l=Pr(),i=[qr(a,e),"",`Requirement (between the ${nt} markers, treat as the spec):`,"",l,s,l,""];return e?i.push("Existing artifact — overwrite it in place:",`- id (pass back as \`hash\`): ${e.id}`,...e.version!==void 0?[`- current version: v${e.version}`]:[],`- current page: ${e.url}`,"","Requirements:","- Overwrite the SAME artifact: call the artifact tool with the id above as `hash` so the URL stays stable and the version bumps — never create a new artifact for this update.","- Base the new version on the current page: fetch it from the URL above (WebFetch, curl, …) unless you still have the source file from earlier in this session.",...a?["- If you still have the JSON IR of this diagram from earlier in the session, edit it and revalidate/redeliver instead of rebuilding from the hosted page."]:[],"- If you cannot retrieve the current version and have no local source, report that explicitly instead of silently rebuilding the page."):i.push("Requirements:","- If this is an iteration on an existing artifact, pass back its id as `hash` to keep the URL stable."),a?i.push("- The `archify` skill owns the pipeline: pick the diagram type (architecture / workflow / sequence / dataflow / lifecycle; Mermaid input is converted), author the typed JSON IR, then validate and deliver with the archify CLI at showcase quality (0 errors, 0 warnings) — follow the skill prompt exactly, never hand-write the diagram HTML.","- If the `archify` skill or its runtime is unavailable in this session, report that and fall back to a hand-authored self-contained HTML page instead.","- Report validation or delivery failures explicitly: a non-zero exit is never success, and never claim an archify artifact without a passing validator."):i.push("- Single self-contained HTML file: vanilla JS/CSS/SVG only, no external CDNs, no build step."),i.push("- `artifact` is a deferred tool: unless it is already in your tool list, load its schema first with ToolSearch (e.g. `select:artifact`).",a?"- Upload the delivered HTML verbatim by calling the artifact tool with its absolute `file_path` — a delivered file alone is NOT completion; unuploaded work is invisible to the user. Do not edit the page after a passing delivery.":"- Write the HTML to a scratch file in `.artifacts/` or the system temp dir (avoid `.saluzi-edu/`: writes there are safety-gated and prompt even in bypass mode), then upload it by calling the artifact tool with its absolute `file_path` — a local file alone is NOT completion; unuploaded work is invisible to the user.","- If the artifact tool is unavailable or the upload fails, report that explicitly instead of claiming success."),i.join(`
438
- `)}function Fr(t){return{type:"user",uuid:ut(),content:t,message:{content:t},artifact_dispatch:!0}}function it(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Or(t){if(!t)return"—";try{return new Date(t).toLocaleString()}catch{return t}}function Kr(t){if(!t)return null;const e=new Date(t).getTime();return Number.isNaN(e)?null:Math.ceil((e-Date.now())/(1440*60*1e3))}function Zr({sessionId:t,embedded:e=!1,refreshTick:r}){Qe();const[a,s]=k.useState([]),[l,i]=k.useState(!0),[n,h]=k.useState(""),[c,u]=k.useState(!1),[x,m]=k.useState(null),[d,y]=k.useState("template"),[b,R]=k.useState(null),{activeTeam:N,isAllTeams:_}=ft(),C=k.useCallback(async()=>{try{const g=await mt(t?{session_id:t}:_?void 0:N?{team_id:N.id}:e?void 0:{scope:"personal"});s(g||[]),h("")}catch(g){h(g instanceof Error?g.message:f("artifacts.loadFailed"))}finally{i(!1)}},[t,N,_,e]);k.useEffect(()=>{C();const g=setInterval(C,15e3);return window.addEventListener("focus",C),()=>{clearInterval(g),window.removeEventListener("focus",C)}},[C]);const M=k.useRef(!1);k.useEffect(()=>{if(!M.current){M.current=!0;return}C()},[r,C]);const H=k.useCallback(g=>{u(!1),m(null),y("template"),s($=>[g,...$.filter(Q=>Q.id!==g.id)])},[]),E=k.useCallback((g,$="template")=>{m(g),y($),u(!0)},[]),P=k.useCallback(()=>{u(!1),m(null),y("template")},[]),A=k.useCallback(async g=>{if(window.confirm(f("artifacts.delete")+" — "+g.slice(0,8)+"…?"))try{await xt(g),s($=>$.filter(Q=>Q.id!==g))}catch($){alert($ instanceof Error?$.message:f("artifacts.deleteFailed"))}},[]),Z=k.useCallback(async g=>{await gt(`${window.location.origin}${g.url}`)&&(R(g.id),setTimeout(()=>R(null),1500))},[]),G=k.useMemo(()=>a,[a]),U=o.jsxs(o.Fragment,{children:[n&&o.jsx("p",{className:"text-status-error text-sm",children:n}),l?o.jsx("div",{className:"space-y-3",children:[0,1,2].map(g=>o.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-surface-2"},g))}):G.length===0?o.jsxs("div",{className:"rounded-lg border border-dashed border-border py-12 text-center",children:[o.jsx(bt,{className:"mx-auto h-8 w-8 text-text-muted/40"}),o.jsx("p",{className:"mt-3 text-sm text-text-muted",children:f("artifacts.empty")})]}):o.jsx("ul",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3",children:G.map(g=>{const $=Kr(g.expires_at);return o.jsxs("li",{className:"group rounded-lg border border-border bg-surface-1 p-4 transition-colors hover:border-brand/50",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("a",{href:`/code/a/${g.id}`,className:"min-w-0 flex-1 no-underline",children:[o.jsx("h3",{className:"truncate font-medium text-text-primary group-hover:text-accent",children:g.title||g.id.slice(0,12)}),o.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:[g.id.slice(0,10),"… · v",g.version," · ",it(g.size)]})]}),o.jsx("span",{className:`flex-shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium ${$!==null&&$<=0?"bg-status-error/15 text-status-error":$!==null&&$<=2?"bg-status-warning/15 text-status-warning":"bg-surface-3 text-text-muted"}`,children:$===null?"∞":`${$}d`})]}),o.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs text-text-muted",children:[g.session_id&&o.jsxs("a",{href:`/code/${g.session_id}`,className:"truncate text-text-muted hover:text-accent",title:g.session_id,children:[f("artifacts.session"),": ",g.session_id.slice(0,14),"…"]}),o.jsxs("span",{className:"flex items-center gap-1",title:f("artifacts.updatedAt"),children:[o.jsx(kt,{className:"h-3 w-3"}),Or(g.updated_at)]})]}),o.jsxs("div",{className:"mt-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[o.jsx("a",{href:g.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.openInNewTab"),children:o.jsx(Pt,{className:"h-3.5 w-3.5"})}),o.jsxs("button",{type:"button",onClick:()=>Z(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${f("artifacts.copyLink")} · ${f("artifacts.linkNotice")}`,children:[o.jsx(Dt,{className:"h-3.5 w-3.5"}),b===g.id&&o.jsx("span",{className:"text-status-active",children:f("artifacts.copied")})]}),o.jsx("button",{type:"button",onClick:()=>E(g,"ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.aiUpdate"),children:o.jsx(Ft,{className:"h-3.5 w-3.5"})}),g.can_manage&&o.jsx("button",{type:"button",onClick:()=>E(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.edit"),children:o.jsx(yt,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>A(g.id),className:"ml-auto inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:f("artifacts.delete"),children:o.jsx(wt,{className:"h-3.5 w-3.5"})})]})]},g.id)})})]});return e?o.jsxs("div",{children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-medium text-text-primary",children:f("artifacts.title")}),o.jsxs("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:[o.jsx(vt,{className:"h-4 w-4"}),f("artifacts.new")]})]}),U,o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]}):o.jsxs("div",{className:"ds-page",children:[o.jsxs("header",{className:"ds-page-head",children:[o.jsxs("div",{className:"ds-page-titlerow",children:[o.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:f("artifacts.title")}),o.jsx("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"btn-ticket",children:f("artifacts.new")})]}),o.jsx("p",{className:"ds-page-sub",children:f("artifacts.subtitle")})]}),U,o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]})}const Gr=[{id:"template",labelKey:"artifacts.create.mode.template"},{id:"markdown",labelKey:"artifacts.create.mode.markdown"},{id:"ai",labelKey:"artifacts.create.mode.ai"}],Ur=[{id:"template",labelKey:"artifacts.edit.mode.html"},{id:"ai",labelKey:"artifacts.edit.mode.ai"}];function Re({open:t,onClose:e,onCreated:r,sessionId:a,editArtifact:s,initialMode:l="template"}){Qe();const i=!!s,[n,h]=k.useState("template"),[c,u]=k.useState("pr-review"),[x,m]=k.useState(""),[d,y]=k.useState(""),[b,R]=k.useState(""),[N,_]=k.useState(30),[C,M]=k.useState(!1),[H,E]=k.useState(""),[P,A]=k.useState(!1),[Z,G]=k.useState(!1),[U,g]=k.useState(null),[$,Q]=k.useState(""),[B,fe]=k.useState(""),[me,_e]=k.useState(""),[De,xe]=k.useState(!1),[ge,Me]=k.useState(null),[V,ae]=k.useState(null),[ne,ie]=k.useState(""),[q,Pe]=k.useState(!1);k.useEffect(()=>{t&&(h(i&&l==="ai"?"ai":"template"),u("pr-review"),_(30),M(!1),E(""),G(!1),R(""),Q(""),fe(a??(s==null?void 0:s.session_id)??""),_e(""),xe(!1),Me(null),ae(null),ie(""),Pe(!1),s?(A(!0),m(s.title??""),y(""),St(s.id).then(p=>{m(p.title??""),y(p.content??""),p.can_manage===!1&&G(!0)}).catch(()=>G(!0)).finally(()=>A(!1))):(A(!1),m(""),y(Y("pr-review").html)),a||(g(null),Rt().then(p=>{const I=p.filter(T=>!Tt(T.status));g(I),fe(T=>T&&!I.some(X=>X.id===T)?"":T)}).catch(()=>g([]))))},[t,s,a,i,l]),k.useEffect(()=>{if(!t||n!=="ai"||!B){ae(null),ie("");return}let p=!1;return $t(B).then(I=>{var T;p||(ae(I.models),ie(((T=I.models)==null?void 0:T.currentModelId)??""))}).catch(()=>{p||ae(null)}),()=>{p=!0}},[t,n,B]);const lt=p=>{u(p);const I=Y(p);y(I.html),x.trim()||m(I.defaultTitle)},[Be,qe]=k.useState("");k.useEffect(()=>{const p=setTimeout(()=>{qe(n==="markdown"?b.trim()?Ue(b).html:"":d)},300);return()=>clearTimeout(p)},[n,d,b]);const ot=n!=="ai"&&(n==="markdown"?b:d).trim().length>0&&!C&&!P&&!Z,ct=async()=>{let p,I;if(n==="markdown"){const T=Ue(b);p=T.html,I=T.title}else p=d.trim(),I=Y(c).defaultTitle;if(p){M(!0),E("");try{const T={html:p,ttl:N,title:x.trim()||(i?void 0:I)};i?s&&(T.hash=s.id):T.session_id=a??($||void 0);const X=await Nt(T);r(X)}catch(T){const X=T instanceof Error?T.message:"";T instanceof Ct&&T.status===404?E(f("artifacts.viewNotFound")):E(X||f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{M(!1)}}},dt=async()=>{if(!Z){if(!B){E(f("artifacts.create.ai.sessionRequired"));return}if(!me.trim()){E(f(i?"artifacts.update.ai.briefRequired":"artifacts.create.ai.briefRequired"));return}xe(!0),E("");try{V&&ne&&ne!==V.currentModelId&&await jt(B,{type:"control_request",request:{subtype:"set_model",model:ne}});const p=Hr(me,i&&s?{id:s.id,url:`${window.location.origin}${s.url}`,version:s.version}:void 0,{archify:q});await Et(B,Fr(p)),Me(B)}catch(p){E(p instanceof Error?p.message:f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{xe(!1)}}},be=U??[];return o.jsx(It,{open:t,onOpenChange:p=>p?void 0:e(),children:o.jsxs(At,{className:"max-h-[85vh] overflow-y-auto sm:max-w-4xl",children:[o.jsx(Lt,{children:o.jsx(zt,{children:i?f("artifacts.editArtifact"):f("artifacts.create.title")})}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-1 rounded-lg bg-surface-2 p-1",children:(i?Ur:Gr).map(p=>o.jsx("button",{type:"button",onClick:()=>{h(p.id),E("")},className:`flex-1 rounded-md px-3 py-1.5 text-sm transition-colors ${n===p.id?"bg-surface-1 font-medium text-text-primary shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:f(p.labelKey)},p.id))}),n==="ai"&&(ge?o.jsxs("div",{className:"rounded-lg border border-border bg-surface-1 p-4 text-center",children:[o.jsx("p",{className:"text-sm text-text-primary",children:f(i?"artifacts.update.ai.sent":"artifacts.create.ai.sent")}),o.jsx("a",{href:`/code/${ge}`,className:"mt-3 inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:f("artifacts.create.ai.openSession")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-session",children:f("artifacts.create.ai.targetSession")}),a?o.jsxs("p",{className:"rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-muted",children:[f("artifacts.session"),": ",a.slice(0,18),"…"]}):U===null?o.jsx("p",{className:"text-xs text-text-muted",children:f("common.loading")}):be.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:f("artifacts.create.ai.noSessions")}):o.jsxs("select",{id:"artifact-ai-session",value:B,onChange:p=>fe(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[o.jsx("option",{value:"",children:f("artifacts.create.ai.sessionRequired")}),be.map(p=>o.jsx("option",{value:p.id,children:(p.title||p.id.slice(0,14))+(p.status==="running"?" · ⚡":"")},p.id))]}),i&&o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.update.ai.sessionHint")})]}),V&&V.availableModels.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-model",children:f("artifacts.create.ai.model")}),o.jsx("select",{id:"artifact-ai-model",value:ne,onChange:p=>ie(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:V.availableModels.map(p=>o.jsx("option",{value:p.modelId,children:p.name+(p.modelId===V.currentModelId?` · ${f("artifacts.create.ai.modelCurrent")}`:"")},p.modelId))}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.ai.modelHint")})]}),o.jsxs("button",{type:"button",role:"switch","aria-checked":q,onClick:()=>Pe(p=>!p),className:`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors ${q?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx(qt,{className:`mt-0.5 h-4 w-4 flex-shrink-0 transition-colors ${q?"text-accent":"text-text-muted"}`}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:`block text-sm font-medium transition-colors ${q?"text-text-primary":"text-text-secondary"}`,children:f("artifacts.ai.archify")}),o.jsx("span",{className:"mt-0.5 block text-xs text-text-muted",children:f("artifacts.ai.archifyDesc")})]}),o.jsx("span",{"aria-hidden":"true",className:`relative mt-0.5 h-5 w-9 flex-shrink-0 rounded-full transition-colors ${q?"bg-accent":"bg-surface-3"}`,children:o.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-surface-1 shadow-sm transition-all ${q?"left-[18px]":"left-0.5"}`})})]}),q&&o.jsx("p",{className:"text-xs text-text-muted",children:f("artifacts.ai.archifyHint")}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-brief",children:f("artifacts.create.ai.brief")}),o.jsx("textarea",{id:"artifact-ai-brief",value:me,onChange:p=>_e(p.target.value),placeholder:f(q?"artifacts.ai.archifyBriefPlaceholder":i?"artifacts.update.ai.briefPlaceholder":"artifacts.create.ai.briefPlaceholder"),rows:6,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]})]})),n==="template"&&!i&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:f("artifacts.create.template")}),o.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:ye.map(p=>o.jsxs("button",{type:"button",onClick:()=>lt(p.id),className:`rounded-lg border p-3 text-left transition-colors ${c===p.id?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx("div",{className:"text-sm font-medium text-text-primary",children:f(p.titleKey)}),p.descKey&&o.jsx("div",{className:"mt-1 text-xs text-text-muted",children:f(p.descKey)})]},p.id))})]}),i&&s&&o.jsxs("p",{className:"text-xs text-text-muted",children:[o.jsxs("span",{className:"font-mono",children:[s.id.slice(0,10),"…"]})," · v",s.version,n==="ai"&&o.jsxs(o.Fragment,{children:[" · ",f("artifacts.update.ai.inPlace")]})]}),n!=="ai"&&o.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_auto] sm:items-end",children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-title",children:f("artifacts.create.title.label")}),o.jsx("input",{id:"artifact-title",type:"text",value:x,onChange:p=>m(p.target.value),placeholder:i||n==="markdown"?"":Y(c).defaultTitle,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ttl",children:f("artifacts.create.ttl")}),o.jsx("div",{className:"flex items-center gap-2",children:[7,30].map(p=>o.jsxs("button",{type:"button",onClick:()=>_(p),className:`rounded-md border px-3 py-2 text-sm transition-colors ${N===p?"border-accent bg-accent/10 font-medium text-text-primary":"border-border text-text-secondary hover:border-accent/50"}`,children:[p,"d"]},p))})]})]}),n!=="ai"&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-content",children:f("artifacts.create.content")}),n==="markdown"?o.jsxs(o.Fragment,{children:[o.jsx("textarea",{id:"artifact-content",value:b,onChange:p=>R(p.target.value),placeholder:f("artifacts.create.markdownPlaceholder").split(`
438
+ `)}function Fr(t){return{type:"user",uuid:ut(),content:t,message:{content:t},artifact_dispatch:!0}}function it(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Or(t){if(!t)return"—";try{return new Date(t).toLocaleString()}catch{return t}}function Kr(t){if(!t)return null;const e=new Date(t).getTime();return Number.isNaN(e)?null:Math.ceil((e-Date.now())/(1440*60*1e3))}function Zr({sessionId:t,embedded:e=!1,refreshTick:r}){Qe();const[a,s]=k.useState([]),[l,i]=k.useState(!0),[n,h]=k.useState(""),[c,u]=k.useState(!1),[x,m]=k.useState(null),[d,y]=k.useState("template"),[b,R]=k.useState(null),{activeTeam:N,isAllTeams:_}=ft(),C=k.useCallback(async()=>{try{const g=await mt(t?{session_id:t}:_?void 0:N?{team_id:N.id}:e?void 0:{scope:"personal"});s(g||[]),h("")}catch(g){h(g instanceof Error?g.message:f("artifacts.loadFailed"))}finally{i(!1)}},[t,N,_,e]);k.useEffect(()=>{C();const g=setInterval(C,15e3);return window.addEventListener("focus",C),()=>{clearInterval(g),window.removeEventListener("focus",C)}},[C]);const M=k.useRef(!1);k.useEffect(()=>{if(!M.current){M.current=!0;return}C()},[r,C]);const H=k.useCallback(g=>{u(!1),m(null),y("template"),s($=>[g,...$.filter(Q=>Q.id!==g.id)])},[]),E=k.useCallback((g,$="template")=>{m(g),y($),u(!0)},[]),P=k.useCallback(()=>{u(!1),m(null),y("template")},[]),A=k.useCallback(async g=>{if(window.confirm(f("artifacts.delete")+" — "+g.slice(0,8)+"…?"))try{await xt(g),s($=>$.filter(Q=>Q.id!==g))}catch($){alert($ instanceof Error?$.message:f("artifacts.deleteFailed"))}},[]),Z=k.useCallback(async g=>{await gt(`${window.location.origin}${g.url}`)&&(R(g.id),setTimeout(()=>R(null),1500))},[]),G=k.useMemo(()=>a,[a]),U=o.jsxs(o.Fragment,{children:[n&&o.jsx("p",{className:"text-status-error text-sm",children:n}),l?o.jsx("div",{className:"space-y-3",children:[0,1,2].map(g=>o.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-surface-2"},g))}):G.length===0?o.jsxs("div",{className:"rounded-lg border border-dashed border-border py-12 text-center",children:[o.jsx(bt,{className:"mx-auto h-8 w-8 text-text-muted/40"}),o.jsx("p",{className:"mt-3 text-sm text-text-muted",children:f("artifacts.empty")})]}):o.jsx("ul",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3",children:G.map(g=>{const $=Kr(g.expires_at);return o.jsxs("li",{className:"group rounded-lg border border-border bg-surface-1 p-4 transition-colors hover:border-brand/50",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("a",{href:`/code/a/${g.id}`,className:"min-w-0 flex-1 no-underline",children:[o.jsx("h3",{className:"truncate font-medium text-text-primary group-hover:text-accent",children:g.title||g.id.slice(0,12)}),o.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:[g.id.slice(0,10),"… · v",g.version," · ",it(g.size)]})]}),o.jsx("span",{className:`flex-shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium ${$!==null&&$<=0?"bg-status-error/15 text-status-error":$!==null&&$<=2?"bg-status-warning/15 text-status-warning":"bg-surface-3 text-text-muted"}`,children:$===null?"∞":`${$}d`})]}),o.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs text-text-muted",children:[g.session_id&&o.jsxs("a",{href:`/code/${g.session_id}`,className:"truncate text-text-muted hover:text-accent",title:g.session_id,children:[f("artifacts.session"),": ",g.session_id.slice(0,14),"…"]}),o.jsxs("span",{className:"flex items-center gap-1",title:f("artifacts.updatedAt"),children:[o.jsx(kt,{className:"h-3 w-3"}),Or(g.updated_at)]})]}),o.jsxs("div",{className:"mt-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[o.jsx("a",{href:g.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.openInNewTab"),children:o.jsx(Pt,{className:"h-3.5 w-3.5"})}),o.jsxs("button",{type:"button",onClick:()=>Z(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${f("artifacts.copyLink")} · ${f("artifacts.linkNotice")}`,children:[o.jsx(Dt,{className:"h-3.5 w-3.5"}),b===g.id&&o.jsx("span",{className:"text-status-active",children:f("artifacts.copied")})]}),o.jsx("button",{type:"button",onClick:()=>E(g,"ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.aiUpdate"),children:o.jsx(Ft,{className:"h-3.5 w-3.5"})}),g.can_manage&&o.jsx("button",{type:"button",onClick:()=>E(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.edit"),children:o.jsx(yt,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>A(g.id),className:"ml-auto inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:f("artifacts.delete"),children:o.jsx(wt,{className:"h-3.5 w-3.5"})})]})]},g.id)})})]});return e?o.jsxs("div",{children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-medium text-text-primary",children:f("artifacts.title")}),o.jsxs("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:[o.jsx(vt,{className:"h-4 w-4"}),f("artifacts.new")]})]}),U,o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]}):o.jsxs("div",{className:"ds-page",children:[o.jsxs("header",{className:"ds-page-head",children:[o.jsxs("div",{className:"ds-page-titlerow",children:[o.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:f("artifacts.title")}),o.jsx("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"btn-ticket",children:f("artifacts.new")})]}),o.jsx("p",{className:"ds-page-sub",children:f("artifacts.subtitle")})]}),U,o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]})}const Gr=[{id:"template",labelKey:"artifacts.create.mode.template"},{id:"markdown",labelKey:"artifacts.create.mode.markdown"},{id:"ai",labelKey:"artifacts.create.mode.ai"}],Ur=[{id:"template",labelKey:"artifacts.edit.mode.html"},{id:"ai",labelKey:"artifacts.edit.mode.ai"}];function Re({open:t,onClose:e,onCreated:r,sessionId:a,editArtifact:s,initialMode:l="template"}){Qe();const i=!!s,[n,h]=k.useState("template"),[c,u]=k.useState("pr-review"),[x,m]=k.useState(""),[d,y]=k.useState(""),[b,R]=k.useState(""),[N,_]=k.useState(30),[C,M]=k.useState(!1),[H,E]=k.useState(""),[P,A]=k.useState(!1),[Z,G]=k.useState(!1),[U,g]=k.useState(null),[$,Q]=k.useState(""),[B,fe]=k.useState(""),[me,_e]=k.useState(""),[De,xe]=k.useState(!1),[ge,Me]=k.useState(null),[W,ae]=k.useState(null),[ne,ie]=k.useState(""),[q,Pe]=k.useState(!1);k.useEffect(()=>{t&&(h(i&&l==="ai"?"ai":"template"),u("pr-review"),_(30),M(!1),E(""),G(!1),R(""),Q(""),fe(a??(s==null?void 0:s.session_id)??""),_e(""),xe(!1),Me(null),ae(null),ie(""),Pe(!1),s?(A(!0),m(s.title??""),y(""),St(s.id).then(p=>{m(p.title??""),y(p.content??""),p.can_manage===!1&&G(!0)}).catch(()=>G(!0)).finally(()=>A(!1))):(A(!1),m(""),y(Y("pr-review").html)),a||(g(null),Rt().then(p=>{const I=p.filter(T=>!Tt(T.status));g(I),fe(T=>T&&!I.some(X=>X.id===T)?"":T)}).catch(()=>g([]))))},[t,s,a,i,l]),k.useEffect(()=>{if(!t||n!=="ai"||!B){ae(null),ie("");return}let p=!1;return $t(B).then(I=>{var T;p||(ae(I.models),ie(((T=I.models)==null?void 0:T.currentModelId)??""))}).catch(()=>{p||ae(null)}),()=>{p=!0}},[t,n,B]);const lt=p=>{u(p);const I=Y(p);y(I.html),x.trim()||m(I.defaultTitle)},[Be,qe]=k.useState("");k.useEffect(()=>{const p=setTimeout(()=>{qe(n==="markdown"?b.trim()?Ue(b).html:"":d)},300);return()=>clearTimeout(p)},[n,d,b]);const ot=n!=="ai"&&(n==="markdown"?b:d).trim().length>0&&!C&&!P&&!Z,ct=async()=>{let p,I;if(n==="markdown"){const T=Ue(b);p=T.html,I=T.title}else p=d.trim(),I=Y(c).defaultTitle;if(p){M(!0),E("");try{const T={html:p,ttl:N,title:x.trim()||(i?void 0:I)};i?s&&(T.hash=s.id):T.session_id=a??($||void 0);const X=await Nt(T);r(X)}catch(T){const X=T instanceof Error?T.message:"";T instanceof Ct&&T.status===404?E(f("artifacts.viewNotFound")):E(X||f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{M(!1)}}},dt=async()=>{if(!Z){if(!B){E(f("artifacts.create.ai.sessionRequired"));return}if(!me.trim()){E(f(i?"artifacts.update.ai.briefRequired":"artifacts.create.ai.briefRequired"));return}xe(!0),E("");try{W&&ne&&ne!==W.currentModelId&&await jt(B,{type:"control_request",request:{subtype:"set_model",model:ne}});const p=Hr(me,i&&s?{id:s.id,url:`${window.location.origin}${s.url}`,version:s.version}:void 0,{archify:q});await Et(B,Fr(p)),Me(B)}catch(p){E(p instanceof Error?p.message:f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{xe(!1)}}},be=U??[];return o.jsx(It,{open:t,onOpenChange:p=>p?void 0:e(),children:o.jsxs(At,{className:"max-h-[85vh] overflow-y-auto sm:max-w-4xl",children:[o.jsx(zt,{children:o.jsx(Lt,{children:i?f("artifacts.editArtifact"):f("artifacts.create.title")})}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-1 rounded-lg bg-surface-2 p-1",children:(i?Ur:Gr).map(p=>o.jsx("button",{type:"button",onClick:()=>{h(p.id),E("")},className:`flex-1 rounded-md px-3 py-1.5 text-sm transition-colors ${n===p.id?"bg-surface-1 font-medium text-text-primary shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:f(p.labelKey)},p.id))}),n==="ai"&&(ge?o.jsxs("div",{className:"rounded-lg border border-border bg-surface-1 p-4 text-center",children:[o.jsx("p",{className:"text-sm text-text-primary",children:f(i?"artifacts.update.ai.sent":"artifacts.create.ai.sent")}),o.jsx("a",{href:`/code/${ge}`,className:"mt-3 inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:f("artifacts.create.ai.openSession")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-session",children:f("artifacts.create.ai.targetSession")}),a?o.jsxs("p",{className:"rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-muted",children:[f("artifacts.session"),": ",a.slice(0,18),"…"]}):U===null?o.jsx("p",{className:"text-xs text-text-muted",children:f("common.loading")}):be.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:f("artifacts.create.ai.noSessions")}):o.jsxs("select",{id:"artifact-ai-session",value:B,onChange:p=>fe(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[o.jsx("option",{value:"",children:f("artifacts.create.ai.sessionRequired")}),be.map(p=>o.jsx("option",{value:p.id,children:(p.title||p.id.slice(0,14))+(p.status==="running"?" · ⚡":"")},p.id))]}),i&&o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.update.ai.sessionHint")})]}),W&&W.availableModels.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-model",children:f("artifacts.create.ai.model")}),o.jsx("select",{id:"artifact-ai-model",value:ne,onChange:p=>ie(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:W.availableModels.map(p=>o.jsx("option",{value:p.modelId,children:p.name+(p.modelId===W.currentModelId?` · ${f("artifacts.create.ai.modelCurrent")}`:"")},p.modelId))}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.ai.modelHint")})]}),o.jsxs("button",{type:"button",role:"switch","aria-checked":q,onClick:()=>Pe(p=>!p),className:`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors ${q?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx(qt,{className:`mt-0.5 h-4 w-4 flex-shrink-0 transition-colors ${q?"text-accent":"text-text-muted"}`}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:`block text-sm font-medium transition-colors ${q?"text-text-primary":"text-text-secondary"}`,children:f("artifacts.ai.archify")}),o.jsx("span",{className:"mt-0.5 block text-xs text-text-muted",children:f("artifacts.ai.archifyDesc")})]}),o.jsx("span",{"aria-hidden":"true",className:`relative mt-0.5 h-5 w-9 flex-shrink-0 rounded-full transition-colors ${q?"bg-accent":"bg-surface-3"}`,children:o.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-surface-1 shadow-sm transition-all ${q?"left-[18px]":"left-0.5"}`})})]}),q&&o.jsx("p",{className:"text-xs text-text-muted",children:f("artifacts.ai.archifyHint")}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-brief",children:f("artifacts.create.ai.brief")}),o.jsx("textarea",{id:"artifact-ai-brief",value:me,onChange:p=>_e(p.target.value),placeholder:f(q?"artifacts.ai.archifyBriefPlaceholder":i?"artifacts.update.ai.briefPlaceholder":"artifacts.create.ai.briefPlaceholder"),rows:6,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]})]})),n==="template"&&!i&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:f("artifacts.create.template")}),o.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:ye.map(p=>o.jsxs("button",{type:"button",onClick:()=>lt(p.id),className:`rounded-lg border p-3 text-left transition-colors ${c===p.id?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx("div",{className:"text-sm font-medium text-text-primary",children:f(p.titleKey)}),p.descKey&&o.jsx("div",{className:"mt-1 text-xs text-text-muted",children:f(p.descKey)})]},p.id))})]}),i&&s&&o.jsxs("p",{className:"text-xs text-text-muted",children:[o.jsxs("span",{className:"font-mono",children:[s.id.slice(0,10),"…"]})," · v",s.version,n==="ai"&&o.jsxs(o.Fragment,{children:[" · ",f("artifacts.update.ai.inPlace")]})]}),n!=="ai"&&o.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_auto] sm:items-end",children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-title",children:f("artifacts.create.title.label")}),o.jsx("input",{id:"artifact-title",type:"text",value:x,onChange:p=>m(p.target.value),placeholder:i||n==="markdown"?"":Y(c).defaultTitle,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ttl",children:f("artifacts.create.ttl")}),o.jsx("div",{className:"flex items-center gap-2",children:[7,30].map(p=>o.jsxs("button",{type:"button",onClick:()=>_(p),className:`rounded-md border px-3 py-2 text-sm transition-colors ${N===p?"border-accent bg-accent/10 font-medium text-text-primary":"border-border text-text-secondary hover:border-accent/50"}`,children:[p,"d"]},p))})]})]}),n!=="ai"&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-content",children:f("artifacts.create.content")}),n==="markdown"?o.jsxs(o.Fragment,{children:[o.jsx("textarea",{id:"artifact-content",value:b,onChange:p=>R(p.target.value),placeholder:f("artifacts.create.markdownPlaceholder").split(`
439
439
  `).join("&#10;"),rows:12,spellCheck:!1,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-primary focus:border-accent focus:outline-none"}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.markdownHint")})]}):o.jsxs(o.Fragment,{children:[o.jsx("textarea",{id:"artifact-content",value:d,onChange:p=>y(p.target.value),placeholder:i?"":Y(c).html.slice(0,120)+"…",rows:12,spellCheck:!1,disabled:P,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-primary focus:border-accent focus:outline-none disabled:opacity-50"}),o.jsxs("div",{className:"mt-1 flex items-center justify-between text-xs text-text-muted",children:[o.jsx("span",{children:d.trim()?it(new Blob([d]).size):f("artifacts.create.contentRequired")}),o.jsx("span",{children:f("artifacts.create.ttlResetNote")})]})]})]}),!i&&n!=="ai"&&!a&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-bind-session",children:f("artifacts.create.bindSession")}),U===null?o.jsx("p",{className:"text-xs text-text-muted",children:f("common.loading")}):o.jsxs("select",{id:"artifact-bind-session",value:$,onChange:p=>Q(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[o.jsx("option",{value:"",children:f("artifacts.create.noSession")}),be.map(p=>o.jsx("option",{value:p.id,children:p.title||p.id.slice(0,14)},p.id))]}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.sessionHint")})]}),Be.trim()&&n!=="ai"&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:f("artifacts.create.preview")}),o.jsx("iframe",{srcDoc:Be,title:"preview",className:"h-56 w-full rounded-md border border-border bg-white",sandbox:"allow-scripts allow-popups allow-forms"})]}),Z&&o.jsx("p",{className:"text-sm text-status-error",children:f("artifacts.viewNotFound")}),H&&o.jsx("p",{className:"text-sm text-status-error",children:H})]}),o.jsxs(_t,{children:[o.jsx("button",{type:"button",onClick:e,className:"rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:f("common.cancel")}),n==="ai"?o.jsx("button",{type:"button",onClick:dt,disabled:De||!!ge||!B||Z,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:De?f("artifacts.create.ai.sending"):f("artifacts.create.ai.send")}):o.jsx("button",{type:"button",onClick:ct,disabled:!ot,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:C?f("common.creating"):i?f("artifacts.update"):f("artifacts.create.submit")})]})]})})}const es=Object.freeze(Object.defineProperty({__proto__:null,ArtifactsGallery:Zr,CreateArtifactDialog:Re},Symbol.toStringTag,{value:"Module"}));export{Zr as A,Re as C,Pt as E,Ft as S,es as a};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{Y as u,a7 as f}from"./main-BBG6f1iy.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{Y as u,a5 as f}from"./main-C6WmTrH-.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
@@ -1,6 +1,6 @@
1
- import{j as e,e as r}from"./vendor-DE_-CLIE.js";import{aG as K,aE as E,b1 as I,a$ as O,aU as t,U as Q,aK as q,b0 as B,I as G,f as P,e as U,a1 as X,aw as Z,a7 as J,aa as Y,a6 as ee,S as $,X as se,aV as ae}from"./main-BBG6f1iy.js";import{R as H,E as te}from"./RegisterEmpty-BJjX1T66.js";import{g as L}from"./workerType-BLdwJ9NB.js";import{S as ne}from"./SessionVisibilityBadge-x_KJ3UxI.js";import{D as re,a as le,d as ce}from"./dialog-My0549rQ.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";/**
1
+ import{j as e,e as r}from"./vendor-DE_-CLIE.js";import{aA as Q,ay as E,aX as O,aV as I,aO as t,U as X,aE as $,aW as P,I as K,f as B,e as U,a0 as Z,ar as G,a5 as J,a8 as Y,a4 as ee,S as W,X as se,aP as ae}from"./main-C6WmTrH-.js";import{R as q,E as te}from"./RegisterEmpty-CCPBTaNr.js";import{g as L}from"./workerType-adjKJz_k.js";import{S as ne}from"./SessionVisibilityBadge-DR98e9N3.js";import{D as re,a as le,d as ce}from"./dialog-DVA4KU9G.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const de=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ie=K("folder",de);function oe({teamName:c,className:x}){return c?e.jsx("span",{className:E("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",x),children:c}):null}function me({environments:c,onSelectEnvironment:x}){const{activeTeam:y,isAllTeams:v}=I(),{user:i}=O(),o=r.useMemo(()=>(i==null?void 0:i.role)==="admin"||v?c:y?c.filter(l=>l.team_id===y.id):c.filter(l=>!l.team_id),[c,y,v,i]);return!o||o.length===0?e.jsx(H,{title:t("dashboard.emptyEnvironmentsTitle"),hint:t("dashboard.emptyEnvironmentsHint")}):e.jsx("div",{className:"ds-reg",children:o.map(l=>{var w,N,g;const p=l.worker_type==="acp",b=L(l.worker_type),m=((w=l.directory)==null?void 0:w.trim())||null,f=((N=l.ip_address)==null?void 0:N.trim())||null,j=((g=l.owner_username)==null?void 0:g.trim())||null;return e.jsxs("div",{className:E("ds-reg-row group",p&&"opacity-80"),children:[e.jsxs("button",{type:"button",onClick:()=>x==null?void 0:x(l),disabled:p,className:E("ds-reg-main",p?"cursor-default":"cursor-pointer"),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:l.machine_name||l.id}),e.jsx("span",{className:E("ds-reg-tag rounded-full",b.colorClass),children:b.fullLabel}),e.jsx(te,{status:l.status,className:"ds-reg-tag"}),e.jsx(oe,{teamName:l.team_name??null,className:"ds-reg-tag"})]}),(m||f||j)&&e.jsxs("span",{className:"ds-reg-meta flex min-w-0 items-center gap-1.5 text-xs text-text-muted",children:[m&&e.jsx("span",{className:"min-w-0 truncate font-mono",children:m}),m&&f&&e.jsx("span",{className:"ds-reg-fact-sep","aria-hidden":"true",children:"·"}),f&&e.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono tabular-nums",children:f}),(m||f)&&j&&e.jsx("span",{className:"ds-reg-fact-sep","aria-hidden":"true",children:"·"}),j&&e.jsxs("span",{className:"ds-reg-owner",title:`${t("dashboard.envOwner")}: ${j}`,children:[e.jsx(Q,{className:"h-3 w-3","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:j})]})]})]}),e.jsx("div",{className:"ds-reg-aside",children:e.jsx("span",{className:"col-start-2 whitespace-nowrap font-mono text-xs tabular-nums text-text-muted",children:q(l.created_at)})})]},l.id)})})}function he({sessions:c,environments:x,onSelect:y,onDelete:v}){B();const{activeTeam:i,isAllTeams:o,myTeams:l}=I(),{user:p}=O(),b=r.useMemo(()=>{const s=new Map;for(const h of l)s.set(h.id,h.name);return s},[l]),m=r.useMemo(()=>(p==null?void 0:p.role)==="admin"||o?c:i?c.filter(s=>s.owner_type==="team"&&s.owner_id===i.id):c.filter(s=>s.owner_type==="user"||s.access_level==="write"||s.access_level==="read"),[c,i,o,p]),{mySessions:f,sharedSessions:j}=r.useMemo(()=>{const s=[],h=[];for(const u of m)i||o?s.push(u):u.access_level==="write"||u.access_level==="read"?h.push(u):s.push(u);return{mySessions:s,sharedSessions:h}},[m,i,o]),w=new Map;for(const s of x??[])s!=null&&s.id&&s.worker_type&&w.set(s.id,s.worker_type);const N=(s,h)=>(h.updated_at||0)-(s.updated_at||0);function g(s){var T;const h=!!v&&s.access_level!=="write"&&s.access_level!=="read";let u=s.source==="acp"?"acp":(T=s.environment)==null?void 0:T.worker_type;!u&&s.environment_id&&(u=w.get(s.environment_id));const d=L(u);return e.jsxs("div",{className:"ds-reg-row group",children:[e.jsxs("button",{type:"button",onClick:()=>y(s.id),className:"ds-reg-main cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:s.title||s.id}),s.visibility&&e.jsx(ne,{visibility:s.visibility||"private",className:"ds-reg-tag"}),e.jsx("span",{className:E("ds-reg-tag rounded-full",d.colorClass),children:d.fullLabel})]}),e.jsxs("span",{className:"ds-reg-meta flex items-center gap-2 truncate text-xs text-text-muted",children:[e.jsx("span",{className:"truncate font-mono",children:s.id}),s.owner_type==="team"&&s.owner_id&&e.jsxs("span",{className:"inline-flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-text-muted/40",children:"|"}),e.jsx("span",{className:"truncate",children:b.get(s.owner_id)||s.owner_id})]})]})]}),e.jsxs("div",{className:"ds-reg-aside",children:[e.jsx(G,{status:s.status}),e.jsx("span",{className:"whitespace-nowrap font-mono text-xs tabular-nums text-text-muted",children:q(s.created_at||s.updated_at)}),h&&e.jsx("button",{type:"button",onClick:M=>{M.stopPropagation(),v(s.id)},className:"ds-reg-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:"Delete session",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},s.id)}if(m.length===0)return e.jsx(H,{title:t("dashboard.emptySessionsTitle"),hint:t("dashboard.emptySessionsHint")});const k=[...f].sort(N),C=[...j].sort(N);return e.jsxs("div",{className:"space-y-4",children:[k.length>0&&e.jsx("section",{className:"space-y-2",children:e.jsx("div",{className:"ds-reg",children:k.map(g)})}),C.length>0&&e.jsxs("section",{className:"space-y-2",children:[k.length>0&&e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:t("session.sharedWithMe")}),e.jsx("div",{className:"ds-reg",children:C.map(g)})]})]})}function ue({open:c,environments:x,onClose:y,onCreated:v}){B();const{activeTeam:i,isAllTeams:o}=I(),{user:l}=O(),[p,b]=r.useState(""),[m,f]=r.useState(""),[j,w]=r.useState("same-dir"),[N,g]=r.useState(""),[k,C]=r.useState(!1),[s,h]=r.useState(!1),u=r.useMemo(()=>(l==null?void 0:l.role)==="admin"||o?x:i?x.filter(a=>a.team_id===i.id):x.filter(a=>!a.team_id),[x,i,o,l]);r.useEffect(()=>{c&&(b(""),f(""),w("same-dir"),g(""),h(!1))},[c]);const d=u.find(a=>a.id===m)||null,T=d?u.findIndex(a=>a.id===d.id)+1:null,M=async()=>{C(!0),g("");try{const a={};p.trim()&&(a.title=p.trim()),m&&(a.environment_id=m),a.spawn_mode=j;const D=(i==null?void 0:i.id)??(o?d==null?void 0:d.team_id:void 0);D&&(a.team_id=D);const S=await X(a);v(S)}catch(a){g(a instanceof Error?a.message:t("dialog.createFailed"))}finally{C(!1)}};return e.jsx(re,{open:c,onOpenChange:a=>{a||y()},children:e.jsx(le,{className:"nsd-shell max-w-md",children:e.jsxs("div",{className:"nsd-box",children:[e.jsx(ce,{className:"nsd-h",children:t("dialog.newSession")}),e.jsxs("div",{className:"nsd-field nsd-field--env",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.environment")}),e.jsxs("button",{type:"button",className:"nsd-envtrigger","aria-expanded":s,onClick:()=>h(a=>!a),children:[e.jsx("span",{className:"nsd-env-read",children:d?e.jsxs(e.Fragment,{children:[T!==null&&e.jsxs("span",{className:"nsd-env-idx",children:["#",T]}),e.jsx("span",{className:"nsd-env-name",children:d.machine_name||d.id}),e.jsx("span",{className:E("nsd-env-type",L(d.worker_type).colorClass),children:L(d.worker_type).shortLabel})]}):e.jsx("span",{className:"nsd-env-none",children:t("dialog.envSelectEnv")})}),e.jsx(P,{className:"nsd-env-caret"})]}),(d==null?void 0:d.directory)&&e.jsx("span",{className:"nsd-env-path",children:d.directory}),s&&e.jsxs("div",{className:"nsd-envpanel",children:[e.jsx("button",{type:"button",onClick:()=>{f(""),h(!1)},className:"nsd-envrow",children:e.jsxs("span",{className:"nsd-envrow-head",children:[e.jsx("span",{className:"nsd-envrow-name",children:t("dialog.none")}),!m&&e.jsx(U,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand-text"})]})}),u.length===0?e.jsx("p",{className:"nsd-envempty",children:t("dialog.envEmpty")}):u.map((a,D)=>{const S=L(a.worker_type),R=!!a.team_id,A=a.id===m;return e.jsxs("button",{type:"button","data-selected":A?"on":void 0,onClick:()=>{f(a.id),h(!1)},className:"nsd-envrow",children:[e.jsxs("span",{className:"nsd-envrow-head",children:[e.jsxs("span",{className:"nsd-envrow-idx",children:["#",D+1]}),e.jsx("span",{className:"nsd-envrow-name",children:a.machine_name||a.id}),e.jsx("span",{className:E("nsd-envrow-type",S.colorClass),children:S.shortLabel}),e.jsx("span",{className:E("nsd-envrow-team",R?"border-border/60 bg-surface-2 text-text-muted":"border-brand/30 bg-brand/10 text-brand-text"),children:R?`${t("dialog.envTeam")}: ${a.team_name||a.team_id}`:t("dialog.envPersonal")}),A&&e.jsx(U,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand-text"})]}),a.directory&&e.jsxs("span",{className:"nsd-envrow-dir",children:[e.jsx(ie,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"nsd-envrow-path",children:a.directory}),a.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"nsd-envrow-path",children:a.branch})]})]})]},a.id)})]})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.titleOptional")}),e.jsx("input",{type:"text",value:p,onChange:a=>b(a.target.value),placeholder:t("dialog.titlePlaceholder"),className:"nsd-title"})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.workspaceMode")}),e.jsxs("span",{className:"nsd-modesel",children:[e.jsxs("select",{value:j,onChange:a=>w(a.target.value),className:"nsd-mode",children:[e.jsx("option",{value:"same-dir",children:t("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:t("dialog.worktree")})]}),e.jsx(P,{className:"nsd-mode-caret"})]})]}),N&&e.jsx("p",{className:"nsd-error",children:N}),e.jsxs("div",{className:"nsd-foot",children:[e.jsx("button",{type:"button",onClick:y,className:"nsd-cancel",children:t("common.cancel")}),e.jsx("button",{type:"button",onClick:M,disabled:k,className:"btn-ticket nsd-create",children:k?t("common.creating"):t("common.create")})]})]})})})}function ye({onNavigateSession:c}){const x=B(),y=r.useMemo(()=>new Date().toLocaleDateString(x==="zh"?"zh-CN":"en-US",{year:"numeric",month:"long",day:"numeric",weekday:"short"}),[x]),[v,i]=r.useState([]),[o,l]=r.useState([]),[p,b]=r.useState(!1),[m,f]=r.useState(!1),[j,w]=r.useState(""),[N,g]=r.useState(null),[k,C]=r.useState(!1),s=r.useRef(0),[h,u]=r.useState(!1),d=m||h,T=r.useCallback(()=>{f(!1),w(""),u(!0)},[]),M=r.useCallback(()=>{u(!1)},[]),a=r.useRef(null),D=r.useRef(!1);r.useEffect(()=>{var n;D.current&&!d&&((n=a.current)==null||n.focus()),D.current=d},[d]),r.useEffect(()=>{const n=j.trim();if(!n){s.current+=1,g(null),C(!1);return}C(!0);const _=++s.current,F=setTimeout(()=>{Z(n).then(z=>{s.current===_&&g(z.results??[])}).catch(()=>{s.current===_&&g([])}).finally(()=>{s.current===_&&C(!1)})},300);return()=>clearTimeout(F)},[j]);const S=r.useCallback(async()=>{try{const[n,_]=await Promise.all([J(),Y()]);i(n||[]),l(_||[])}catch(n){console.error("Dashboard render error:",n)}},[]);r.useEffect(()=>{S();const n=setInterval(S,5e3);return window.addEventListener("focus",S),()=>{clearInterval(n),window.removeEventListener("focus",S)}},[S]);const R=n=>{b(!1),c(n.id)},A=r.useCallback(n=>{},[]),V=r.useCallback(n=>{c(n)},[c]),W=r.useCallback(async n=>{if(window.confirm(t("dashboard.confirmDelete").replace("{id}",n)))try{await ee(n),i(_=>_.filter(F=>F.id!==n))}catch(_){alert(_ instanceof Error?_.message:t("dashboard.deleteFailed"))}},[]);return e.jsxs("div",{className:"ds-dash",children:[e.jsxs("header",{className:"ds-dash-bar hero-enter",children:[e.jsx("span",{className:"ds-dash-dateline",children:y}),e.jsxs("div",{className:"ds-dash-titlerow",children:[e.jsx("h1",{className:"ds-dash-title font-display font-semibold tracking-tight text-text-primary",children:t("dashboard.title")}),e.jsxs("div",{className:"ds-dash-counts",children:[e.jsxs("span",{children:[v.length," ",t("dashboard.sessions")]}),e.jsxs("span",{children:[o.length," ",t("dashboard.environments")]})]})]})]}),e.jsxs("section",{className:"ds-dash-row",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:t("dashboard.environments")}),e.jsx(me,{environments:o,onSelectEnvironment:A})]}),e.jsxs("section",{className:"ds-dash-row",children:[e.jsxs("div",{className:"ds-dash-rowhead",children:[e.jsxs("div",{className:"ds-dash-rowlabel",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:t("dashboard.sessions")}),d?e.jsxs("div",{className:E("ds-dash-search",h&&"ds-dash-search--folding"),onAnimationEnd:M,children:[e.jsx($,{className:"h-4 w-4 flex-shrink-0 text-text-muted","aria-hidden":"true"}),e.jsx("input",{autoFocus:!0,value:j,onChange:n=>w(n.target.value),onKeyDown:n=>{n.key==="Escape"&&T()},placeholder:t("dashboard.searchPlaceholder"),"aria-label":t("dashboard.searchPlaceholder"),className:"w-full min-w-0 bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"}),k&&e.jsx("span",{className:"flex-shrink-0 text-xs text-text-muted",children:t("dashboard.searching")}),e.jsx("button",{type:"button",onClick:T,className:"ds-dash-search-close",title:t("dashboard.closeSearch"),"aria-label":t("dashboard.closeSearch"),children:e.jsx(se,{className:"h-3.5 w-3.5"})})]}):e.jsx("button",{ref:a,type:"button",onClick:()=>f(!0),className:"ds-dash-search-toggle",title:t("dashboard.searchAction"),"aria-label":t("dashboard.searchAction"),children:e.jsx($,{className:"h-4 w-4"})})]}),e.jsx("button",{type:"button",onClick:()=>b(!0),className:"btn-ticket",children:t("dashboard.newSession")})]}),N!==null?e.jsxs("div",{className:"ds-reg",children:[N.length===0&&!k&&e.jsx("p",{className:"ds-reg-row ds-reg-empty text-sm text-text-muted",children:t("dashboard.searchNoResults")}),N.map(n=>e.jsxs("button",{type:"button",onClick:()=>c(n.session_id),className:"ds-reg-row w-full cursor-pointer",children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-sm font-medium text-text-primary",children:n.title||n.session_id}),n.snippet&&e.jsx("span",{className:"mt-1 line-clamp-2 block text-xs leading-relaxed text-text-muted",children:n.snippet})]}),e.jsx("span",{className:"whitespace-nowrap font-mono text-xs text-text-muted",children:n.match_count>0?ae("dashboard.nMatches",{n:n.match_count}):t("dashboard.nameMatch")})]},n.session_id))]}):e.jsx(he,{sessions:v,environments:o,onSelect:V,onDelete:W})]}),e.jsx(ue,{open:p,environments:o,onClose:()=>b(!1),onCreated:R})]})}export{ye as Dashboard};
6
+ */const de=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ie=Q("folder",de);function oe({teamName:c,className:x}){return c?e.jsx("span",{className:E("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",x),children:c}):null}function me({environments:c,onSelectEnvironment:x}){const{activeTeam:y,isAllTeams:v}=O(),{user:i}=I(),o=r.useMemo(()=>(i==null?void 0:i.role)==="admin"||v?c:y?c.filter(l=>l.team_id===y.id):c.filter(l=>!l.team_id),[c,y,v,i]);return!o||o.length===0?e.jsx(q,{title:t("dashboard.emptyEnvironmentsTitle"),hint:t("dashboard.emptyEnvironmentsHint")}):e.jsx("div",{className:"ds-reg",children:o.map(l=>{var w,N,g;const p=l.worker_type==="acp",b=L(l.worker_type),m=((w=l.directory)==null?void 0:w.trim())||null,f=((N=l.ip_address)==null?void 0:N.trim())||null,j=((g=l.owner_username)==null?void 0:g.trim())||null;return e.jsxs("div",{className:E("ds-reg-row group",p&&"opacity-80"),children:[e.jsxs("button",{type:"button",onClick:()=>x==null?void 0:x(l),disabled:p,className:E("ds-reg-main",p?"cursor-default":"cursor-pointer"),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:l.machine_name||l.id}),e.jsx("span",{className:E("ds-reg-tag rounded-full",b.colorClass),children:b.fullLabel}),e.jsx(te,{status:l.status,className:"ds-reg-tag"}),e.jsx(oe,{teamName:l.team_name??null,className:"ds-reg-tag"})]}),(m||f||j)&&e.jsxs("span",{className:"ds-reg-meta flex min-w-0 items-center gap-1.5 text-xs text-text-muted",children:[m&&e.jsx("span",{className:"min-w-0 truncate font-mono",children:m}),m&&f&&e.jsx("span",{className:"ds-reg-fact-sep","aria-hidden":"true",children:"·"}),f&&e.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono tabular-nums",children:f}),(m||f)&&j&&e.jsx("span",{className:"ds-reg-fact-sep","aria-hidden":"true",children:"·"}),j&&e.jsxs("span",{className:"ds-reg-owner",title:`${t("dashboard.envOwner")}: ${j}`,children:[e.jsx(X,{className:"h-3 w-3","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:j})]})]})]}),e.jsx("div",{className:"ds-reg-aside",children:e.jsx("span",{className:"col-start-2 whitespace-nowrap font-mono text-xs tabular-nums text-text-muted",children:$(l.created_at)})})]},l.id)})})}function he({sessions:c,environments:x,onSelect:y,onDelete:v}){P();const{activeTeam:i,isAllTeams:o,myTeams:l}=O(),{user:p}=I(),b=r.useMemo(()=>{const s=new Map;for(const h of l)s.set(h.id,h.name);return s},[l]),m=r.useMemo(()=>(p==null?void 0:p.role)==="admin"||o?c:i?c.filter(s=>s.owner_type==="team"&&s.owner_id===i.id):c.filter(s=>s.owner_type==="user"||s.access_level==="write"||s.access_level==="read"),[c,i,o,p]),{mySessions:f,sharedSessions:j}=r.useMemo(()=>{const s=[],h=[];for(const u of m)i||o?s.push(u):u.access_level==="write"||u.access_level==="read"?h.push(u):s.push(u);return{mySessions:s,sharedSessions:h}},[m,i,o]),w=new Map;for(const s of x??[])s!=null&&s.id&&s.worker_type&&w.set(s.id,s.worker_type);const N=(s,h)=>(h.updated_at||0)-(s.updated_at||0);function g(s){var T;const h=!!v&&s.access_level!=="write"&&s.access_level!=="read";let u=s.source==="acp"?"acp":(T=s.environment)==null?void 0:T.worker_type;!u&&s.environment_id&&(u=w.get(s.environment_id));const d=L(u);return e.jsxs("div",{className:"ds-reg-row group",children:[e.jsxs("button",{type:"button",onClick:()=>y(s.id),className:"ds-reg-main cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:s.title||s.id}),s.visibility&&e.jsx(ne,{visibility:s.visibility||"private",className:"ds-reg-tag"}),e.jsx("span",{className:E("ds-reg-tag rounded-full",d.colorClass),children:d.fullLabel})]}),e.jsxs("span",{className:"ds-reg-meta flex items-center gap-2 truncate text-xs text-text-muted",children:[e.jsx("span",{className:"truncate font-mono",children:s.id}),s.owner_type==="team"&&s.owner_id&&e.jsxs("span",{className:"inline-flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-text-muted/40",children:"|"}),e.jsx("span",{className:"truncate",children:b.get(s.owner_id)||s.owner_id})]})]})]}),e.jsxs("div",{className:"ds-reg-aside",children:[e.jsx(K,{status:s.status}),e.jsx("span",{className:"whitespace-nowrap font-mono text-xs tabular-nums text-text-muted",children:$(s.created_at||s.updated_at)}),h&&e.jsx("button",{type:"button",onClick:M=>{M.stopPropagation(),v(s.id)},className:"ds-reg-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:"Delete session",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},s.id)}if(m.length===0)return e.jsx(q,{title:t("dashboard.emptySessionsTitle"),hint:t("dashboard.emptySessionsHint")});const k=[...f].sort(N),C=[...j].sort(N);return e.jsxs("div",{className:"space-y-4",children:[k.length>0&&e.jsx("section",{className:"space-y-2",children:e.jsx("div",{className:"ds-reg",children:k.map(g)})}),C.length>0&&e.jsxs("section",{className:"space-y-2",children:[k.length>0&&e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:t("session.sharedWithMe")}),e.jsx("div",{className:"ds-reg",children:C.map(g)})]})]})}function ue({open:c,environments:x,onClose:y,onCreated:v}){P();const{activeTeam:i,isAllTeams:o}=O(),{user:l}=I(),[p,b]=r.useState(""),[m,f]=r.useState(""),[j,w]=r.useState("same-dir"),[N,g]=r.useState(""),[k,C]=r.useState(!1),[s,h]=r.useState(!1),u=r.useMemo(()=>(l==null?void 0:l.role)==="admin"||o?x:i?x.filter(a=>a.team_id===i.id):x.filter(a=>!a.team_id),[x,i,o,l]);r.useEffect(()=>{c&&(b(""),f(""),w("same-dir"),g(""),h(!1))},[c]);const d=u.find(a=>a.id===m)||null,T=d?u.findIndex(a=>a.id===d.id)+1:null,M=async()=>{C(!0),g("");try{const a={};p.trim()&&(a.title=p.trim()),m&&(a.environment_id=m),a.spawn_mode=j;const D=(i==null?void 0:i.id)??(o?d==null?void 0:d.team_id:void 0);D&&(a.team_id=D);const S=await Z(a);v(S)}catch(a){g(a instanceof Error?a.message:t("dialog.createFailed"))}finally{C(!1)}};return e.jsx(re,{open:c,onOpenChange:a=>{a||y()},children:e.jsx(le,{className:"nsd-shell max-w-md",children:e.jsxs("div",{className:"nsd-box",children:[e.jsx(ce,{className:"nsd-h",children:t("dialog.newSession")}),e.jsxs("div",{className:"nsd-field nsd-field--env",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.environment")}),e.jsxs("button",{type:"button",className:"nsd-envtrigger","aria-expanded":s,onClick:()=>h(a=>!a),children:[e.jsx("span",{className:"nsd-env-read",children:d?e.jsxs(e.Fragment,{children:[T!==null&&e.jsxs("span",{className:"nsd-env-idx",children:["#",T]}),e.jsx("span",{className:"nsd-env-name",children:d.machine_name||d.id}),e.jsx("span",{className:E("nsd-env-type",L(d.worker_type).colorClass),children:L(d.worker_type).shortLabel})]}):e.jsx("span",{className:"nsd-env-none",children:t("dialog.envSelectEnv")})}),e.jsx(B,{className:"nsd-env-caret"})]}),(d==null?void 0:d.directory)&&e.jsx("span",{className:"nsd-env-path",children:d.directory}),s&&e.jsxs("div",{className:"nsd-envpanel",children:[e.jsx("button",{type:"button",onClick:()=>{f(""),h(!1)},className:"nsd-envrow",children:e.jsxs("span",{className:"nsd-envrow-head",children:[e.jsx("span",{className:"nsd-envrow-name",children:t("dialog.none")}),!m&&e.jsx(U,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand-text"})]})}),u.length===0?e.jsx("p",{className:"nsd-envempty",children:t("dialog.envEmpty")}):u.map((a,D)=>{const S=L(a.worker_type),A=!!a.team_id,R=a.id===m;return e.jsxs("button",{type:"button","data-selected":R?"on":void 0,onClick:()=>{f(a.id),h(!1)},className:"nsd-envrow",children:[e.jsxs("span",{className:"nsd-envrow-head",children:[e.jsxs("span",{className:"nsd-envrow-idx",children:["#",D+1]}),e.jsx("span",{className:"nsd-envrow-name",children:a.machine_name||a.id}),e.jsx("span",{className:E("nsd-envrow-type",S.colorClass),children:S.shortLabel}),e.jsx("span",{className:E("nsd-envrow-team",A?"border-border/60 bg-surface-2 text-text-muted":"border-brand/30 bg-brand/10 text-brand-text"),children:A?`${t("dialog.envTeam")}: ${a.team_name||a.team_id}`:t("dialog.envPersonal")}),R&&e.jsx(U,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand-text"})]}),a.directory&&e.jsxs("span",{className:"nsd-envrow-dir",children:[e.jsx(ie,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"nsd-envrow-path",children:a.directory}),a.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"nsd-envrow-path",children:a.branch})]})]})]},a.id)})]})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.titleOptional")}),e.jsx("input",{type:"text",value:p,onChange:a=>b(a.target.value),placeholder:t("dialog.titlePlaceholder"),className:"nsd-title"})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.workspaceMode")}),e.jsxs("span",{className:"nsd-modesel",children:[e.jsxs("select",{value:j,onChange:a=>w(a.target.value),className:"nsd-mode",children:[e.jsx("option",{value:"same-dir",children:t("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:t("dialog.worktree")})]}),e.jsx(B,{className:"nsd-mode-caret"})]})]}),N&&e.jsx("p",{className:"nsd-error",children:N}),e.jsxs("div",{className:"nsd-foot",children:[e.jsx("button",{type:"button",onClick:y,className:"nsd-cancel",children:t("common.cancel")}),e.jsx("button",{type:"button",onClick:M,disabled:k,className:"btn-ticket nsd-create",children:k?t("common.creating"):t("common.create")})]})]})})})}function ye({onNavigateSession:c}){const x=P(),y=r.useMemo(()=>new Date().toLocaleDateString(x==="zh"?"zh-CN":"en-US",{year:"numeric",month:"long",day:"numeric",weekday:"short"}),[x]),[v,i]=r.useState([]),[o,l]=r.useState([]),[p,b]=r.useState(!1),[m,f]=r.useState(!1),[j,w]=r.useState(""),[N,g]=r.useState(null),[k,C]=r.useState(!1),s=r.useRef(0),[h,u]=r.useState(!1),d=m||h,T=r.useCallback(()=>{f(!1),w(""),u(!0)},[]),M=r.useCallback(()=>{u(!1)},[]),a=r.useRef(null),D=r.useRef(!1);r.useEffect(()=>{var n;D.current&&!d&&((n=a.current)==null||n.focus()),D.current=d},[d]),r.useEffect(()=>{const n=j.trim();if(!n){s.current+=1,g(null),C(!1);return}C(!0);const _=++s.current,F=setTimeout(()=>{G(n).then(z=>{s.current===_&&g(z.results??[])}).catch(()=>{s.current===_&&g([])}).finally(()=>{s.current===_&&C(!1)})},300);return()=>clearTimeout(F)},[j]);const S=r.useCallback(async()=>{try{const[n,_]=await Promise.all([J(),Y()]);i(n||[]),l(_||[])}catch(n){console.error("Dashboard render error:",n)}},[]);r.useEffect(()=>{S();const n=setInterval(S,5e3);return window.addEventListener("focus",S),()=>{clearInterval(n),window.removeEventListener("focus",S)}},[S]);const A=n=>{b(!1),c(n.id)},R=r.useCallback(n=>{},[]),H=r.useCallback(n=>{c(n)},[c]),V=r.useCallback(async n=>{if(window.confirm(t("dashboard.confirmDelete").replace("{id}",n)))try{await ee(n),i(_=>_.filter(F=>F.id!==n))}catch(_){alert(_ instanceof Error?_.message:t("dashboard.deleteFailed"))}},[]);return e.jsxs("div",{className:"ds-dash",children:[e.jsxs("header",{className:"ds-dash-bar hero-enter",children:[e.jsx("span",{className:"ds-dash-dateline",children:y}),e.jsxs("div",{className:"ds-dash-titlerow",children:[e.jsx("h1",{className:"ds-dash-title font-display font-semibold tracking-tight text-text-primary",children:t("dashboard.title")}),e.jsxs("div",{className:"ds-dash-counts",children:[e.jsxs("span",{children:[v.length," ",t("dashboard.sessions")]}),e.jsxs("span",{children:[o.length," ",t("dashboard.environments")]})]})]})]}),e.jsxs("section",{className:"ds-dash-row",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:t("dashboard.environments")}),e.jsx(me,{environments:o,onSelectEnvironment:R})]}),e.jsxs("section",{className:"ds-dash-row",children:[e.jsxs("div",{className:"ds-dash-rowhead",children:[e.jsxs("div",{className:"ds-dash-rowlabel",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:t("dashboard.sessions")}),d?e.jsxs("div",{className:E("ds-dash-search",h&&"ds-dash-search--folding"),onAnimationEnd:M,children:[e.jsx(W,{className:"h-4 w-4 flex-shrink-0 text-text-muted","aria-hidden":"true"}),e.jsx("input",{autoFocus:!0,value:j,onChange:n=>w(n.target.value),onKeyDown:n=>{n.key==="Escape"&&T()},placeholder:t("dashboard.searchPlaceholder"),"aria-label":t("dashboard.searchPlaceholder"),className:"w-full min-w-0 bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"}),k&&e.jsx("span",{className:"flex-shrink-0 text-xs text-text-muted",children:t("dashboard.searching")}),e.jsx("button",{type:"button",onClick:T,className:"ds-dash-search-close",title:t("dashboard.closeSearch"),"aria-label":t("dashboard.closeSearch"),children:e.jsx(se,{className:"h-3.5 w-3.5"})})]}):e.jsx("button",{ref:a,type:"button",onClick:()=>f(!0),className:"ds-dash-search-toggle",title:t("dashboard.searchAction"),"aria-label":t("dashboard.searchAction"),children:e.jsx(W,{className:"h-4 w-4"})})]}),e.jsx("button",{type:"button",onClick:()=>b(!0),className:"btn-ticket",children:t("dashboard.newSession")})]}),N!==null?e.jsxs("div",{className:"ds-reg",children:[N.length===0&&!k&&e.jsx("p",{className:"ds-reg-row ds-reg-empty text-sm text-text-muted",children:t("dashboard.searchNoResults")}),N.map(n=>e.jsxs("button",{type:"button",onClick:()=>c(n.session_id),className:"ds-reg-row w-full cursor-pointer",children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-sm font-medium text-text-primary",children:n.title||n.session_id}),n.snippet&&e.jsx("span",{className:"mt-1 line-clamp-2 block text-xs leading-relaxed text-text-muted",children:n.snippet})]}),e.jsx("span",{className:"whitespace-nowrap font-mono text-xs text-text-muted",children:n.match_count>0?ae("dashboard.nMatches",{n:n.match_count}):t("dashboard.nameMatch")})]},n.session_id))]}):e.jsx(he,{sessions:v,environments:o,onSelect:H,onDelete:V})]}),e.jsx(ue,{open:p,environments:o,onClose:()=>b(!1),onCreated:A})]})}export{ye as Dashboard};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a$ as v,c as N,aU as t}from"./main-BBG6f1iy.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function P({onSuccess:h,onInvalidInvite:i}){const{join:b}=v(),[l,f]=r.useState(""),[u,w]=r.useState(""),[o,j]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):i()},[i]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await b(l,u,o),h()}catch(a){const d=a instanceof Error?a.message:"Join failed";if(d.includes("Invalid invitation")||d.includes("expired")||d.includes("already used")){i();return}n(d)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(N,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:u,onChange:s=>w(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>j(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),m&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!l,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{P as Join};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aV as v,c as N,aO as t}from"./main-C6WmTrH-.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function P({onSuccess:h,onInvalidInvite:i}){const{join:b}=v(),[l,f]=r.useState(""),[u,w]=r.useState(""),[o,j]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):i()},[i]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await b(l,u,o),h()}catch(a){const d=a instanceof Error?a.message:"Join failed";if(d.includes("Invalid invitation")||d.includes("expired")||d.includes("already used")){i();return}n(d)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(N,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:u,onChange:s=>w(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>j(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),m&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!l,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{P as Join};
@@ -1 +1 @@
1
- import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{aU as t,aV as y,a$ as j,c as w}from"./main-BBG6f1iy.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function v(r){if(!(r instanceof Error))return t("auth.login.failed");if(r instanceof TypeError)return t("auth.login.unreachable");const s=r.message;return/failed to fetch|network|load failed/i.test(s)?t("auth.login.unreachable"):/csrf/i.test(s)?t("auth.login.csrfBlocked"):/too many/i.test(s)?t("auth.login.rateLimited"):/invalid credentials/i.test(s)?t("auth.login.failed"):!s||/^login failed$/i.test(s)?t("auth.login.failed"):y("auth.login.failedWithReason",{message:s})}function C({onSuccess:r,onNavigateRegister:s}){const{login:m,registrationAllowed:x,singleUserMode:h}=j(),[o,f]=n.useState(""),[i,b]=n.useState(""),[l,d]=n.useState(""),[u,c]=n.useState(!1),g=async a=>{a.preventDefault(),d(""),c(!0);try{await m(o,i),r()}catch(p){d(v(p))}finally{c(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(w,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[h&&e.jsxs("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2 text-xs text-text-secondary",children:[e.jsx("p",{children:t("auth.login.singleUserHint")}),e.jsx("p",{className:"mt-1 font-mono text-text-primary",children:"admin / admin123"}),e.jsx("p",{className:"mt-1 text-text-muted",children:t("auth.login.singleUserHintFooter")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:o,onChange:a=>f(a.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:i,onChange:a=>b(a.target.value),required:!0,autoComplete:"current-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),l&&e.jsx("p",{className:"text-sm text-status-error",children:l}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:u?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:s,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{C as Login};
1
+ import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{aO as t,aP as y,aV as j,c as w}from"./main-C6WmTrH-.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function v(r){if(!(r instanceof Error))return t("auth.login.failed");if(r instanceof TypeError)return t("auth.login.unreachable");const s=r.message;return/failed to fetch|network|load failed/i.test(s)?t("auth.login.unreachable"):/csrf/i.test(s)?t("auth.login.csrfBlocked"):/too many/i.test(s)?t("auth.login.rateLimited"):/invalid credentials/i.test(s)?t("auth.login.failed"):!s||/^login failed$/i.test(s)?t("auth.login.failed"):y("auth.login.failedWithReason",{message:s})}function C({onSuccess:r,onNavigateRegister:s}){const{login:m,registrationAllowed:x,singleUserMode:h}=j(),[o,f]=n.useState(""),[i,b]=n.useState(""),[l,d]=n.useState(""),[u,c]=n.useState(!1),g=async a=>{a.preventDefault(),d(""),c(!0);try{await m(o,i),r()}catch(p){d(v(p))}finally{c(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(w,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[h&&e.jsxs("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2 text-xs text-text-secondary",children:[e.jsx("p",{children:t("auth.login.singleUserHint")}),e.jsx("p",{className:"mt-1 font-mono text-text-primary",children:"admin / admin123"}),e.jsx("p",{className:"mt-1 text-text-muted",children:t("auth.login.singleUserHintFooter")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:o,onChange:a=>f(a.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:i,onChange:a=>b(a.target.value),required:!0,autoComplete:"current-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),l&&e.jsx("p",{className:"text-sm text-status-error",children:l}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:u?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:s,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{C as Login};