@myagentroam/server 0.13.44 → 0.13.46

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 (349) hide show
  1. package/node_modules/@myagentroam/protocol/package.json +1 -1
  2. package/node_modules/@myagentroam/server-core/package.json +2 -2
  3. package/node_modules/@myagentroam-enterprise/server-implementation/package.json +3 -3
  4. package/package.json +5 -5
  5. package/web/assets/{AuditManagementPage-BHnu7Uuy.js → AuditManagementPage-D24WAE02.js} +1 -1
  6. package/web/assets/{BusyIndicator-MYxuzJwk.js → BusyIndicator-DPIylucr.js} +1 -1
  7. package/web/assets/{CodeFileEditor-6wA0F6L5.js → CodeFileEditor-DZH3z1wp.js} +3 -3
  8. package/web/assets/{ConversationTemplateManagementPage-Cb4fq0Q_.js → ConversationTemplateManagementPage-Btt_NPoW.js} +1 -1
  9. package/web/assets/{ConversationTemplateManagementPage-wPP70yj-.js → ConversationTemplateManagementPage-UP7M6LDt.js} +1 -1
  10. package/web/assets/{EnterpriseUserManagementPage-DPDEBDAF.js → EnterpriseUserManagementPage-DTzu7YZ-.js} +1 -1
  11. package/web/assets/{EnvironmentSecretManager-UetBt5MA.js → EnvironmentSecretManager-DQEsXukI.js} +1 -1
  12. package/web/assets/{FilePreviewLoading-C1U4PIWp.js → FilePreviewLoading-D3TMSEqz.js} +1 -1
  13. package/web/assets/{HtmlPreviewFrame-BTWUz9WL.js → HtmlPreviewFrame-BQDQJ4Op.js} +3 -3
  14. package/web/assets/{LicenseManagementPage-Cks_9oi7.js → LicenseManagementPage-BVtIrG9R.js} +1 -1
  15. package/web/assets/{ManagementPagination-DPkT2Szp.js → ManagementPagination-B5EhEHBn.js} +1 -1
  16. package/web/assets/{MarAgentModelManagementPage-CvhRRF2S.js → MarAgentModelManagementPage-BRGx8eAf.js} +1 -1
  17. package/web/assets/{MarAgentModelManagementPage-DtyCkQDG.js → MarAgentModelManagementPage-D4H1W851.js} +1 -1
  18. package/web/assets/{MarIcon-DZpYRja5.js → MarIcon-_Gp54--s.js} +1 -1
  19. package/web/assets/{MarkdownFilePreview-DHC2ib-l.js → MarkdownFilePreview-DqTjLXe4.js} +2 -2
  20. package/web/assets/{McpDetailsDialog-BbgB5wUa.js → McpDetailsDialog-DXRaC8Ur.js} +1 -1
  21. package/web/assets/{McpSourceManagementPage-BADuwaR-.js → McpSourceManagementPage-Wc5YUx9m.js} +1 -1
  22. package/web/assets/{McpSourceManagementPage-KKmB9J_9.js → McpSourceManagementPage-sR6sfcPM.js} +1 -1
  23. package/web/assets/{NodeDetailsDialogs-BCeO8lj7.js → NodeDetailsDialogs-D6dEHxuc.js} +1 -1
  24. package/web/assets/NodeManagementPage-CHDHcbEo.js +1 -0
  25. package/web/assets/NodeManagementPage-DFDSI2FF.js +1 -0
  26. package/web/assets/{OAuthManagementPage-C9MFlLHg.js → OAuthManagementPage-DBSmSI6k.js} +1 -1
  27. package/web/assets/{OrganizationManagementPage-K9iZPEZS.js → OrganizationManagementPage-CIe1TzSv.js} +1 -1
  28. package/web/assets/{RemoteDesktopPage-4M-9MTJ0.js → RemoteDesktopPage-x23ZZrhq.js} +1 -1
  29. package/web/assets/{ResourceManagementPanel-hTAD6hGe.js → ResourceManagementPanel-DR6edhkE.js} +2 -2
  30. package/web/assets/{ResourceManagementPanel-pOHW0iLl.css → ResourceManagementPanel-Ds5sSATD.css} +1 -1
  31. package/web/assets/{ResourceManagementPanel.vue_vue_type_script_setup_true_lang-CpDjO11T.js → ResourceManagementPanel.vue_vue_type_script_setup_true_lang-DMA7WK9r.js} +1 -1
  32. package/web/assets/SecretManagementPage-CwWzuBiF.js +1 -0
  33. package/web/assets/{SecretManagementPage-BwfDda0c.js → SecretManagementPage-Dhqo7QIz.js} +1 -1
  34. package/web/assets/{SecretManagementPage.vue_vue_type_script_setup_true_lang-BpUH2FnR.js → SecretManagementPage.vue_vue_type_script_setup_true_lang-B40SB2mf.js} +1 -1
  35. package/web/assets/{SessionSharePage-rAKTzF4n.css → SessionSharePage-BctU3nV4.css} +1 -1
  36. package/web/assets/{SessionSharePage-DG1CLWm2.js → SessionSharePage-Chaad8md.js} +2 -2
  37. package/web/assets/{SettingsContent-CmxQPFgj.js → SettingsContent-D4ev-z8t.js} +1 -1
  38. package/web/assets/{SettingsContent-nUnmQWWb.js → SettingsContent-t2Rr1xMB.js} +1 -1
  39. package/web/assets/{SkillCenterPage-DMcYMaeX.js → SkillCenterPage-B3ZlNhyv.js} +1 -1
  40. package/web/assets/SkillCenterPage-Dw8N3Zuu.js +1 -0
  41. package/web/assets/{SkillDetailsDialog-DmKR9VCs.js → SkillDetailsDialog-BihyohIA.js} +1 -1
  42. package/web/assets/{SkillSourceManagementPage-BXqRKxx4.js → SkillSourceManagementPage-BeJkYb2h.js} +1 -1
  43. package/web/assets/{SkillSourceManagementPage-mrYw5v5S.js → SkillSourceManagementPage-DR0Cguzi.js} +1 -1
  44. package/web/assets/{StandaloneFilePreviewPage-QL0d6Y27.js → StandaloneFilePreviewPage-CpM37Mmi.js} +1 -1
  45. package/web/assets/{SystemConfigurationPage-D_BFLcsF.js → SystemConfigurationPage-BzEVKhD4.js} +1 -1
  46. package/web/assets/SystemConfigurationPage-Djq5syqR.js +1 -0
  47. package/web/assets/{SystemInformationPage-ClzmFNrA.js → SystemInformationPage-BkBZIqnq.js} +1 -1
  48. package/web/assets/{TerminalTabView-CXbhaQ5i.js → TerminalTabView-BcWl8q3n.js} +1 -1
  49. package/web/assets/WorkbenchPage-C0kAOOaq.js +22 -0
  50. package/web/assets/WorkbenchPage-C9OHSl7s.css +1 -0
  51. package/web/assets/WorkspaceManagementPage-BUAqsZWu.js +1 -0
  52. package/web/assets/WorkspaceManagementPage-BjZNzMBj.js +1 -0
  53. package/web/assets/{_baseIteratee-D6vE6jHm.js → _baseIteratee-DGGNUsro.js} +1 -1
  54. package/web/assets/{abnfDiagram-VCTEODGH-DbNSoria.js → abnfDiagram-VCTEODGH-nu83ycJK.js} +1 -1
  55. package/web/assets/{advancedFormat-C51D1Ue3.js → advancedFormat-BM0CjPa7.js} +1 -1
  56. package/web/assets/{arc-Hc0Y76Iy.js → arc-B_HN3f5X.js} +1 -1
  57. package/web/assets/{architectureDiagram-5GKGNRK7-Drud3gHc.js → architectureDiagram-5GKGNRK7-CR42d30L.js} +1 -1
  58. package/web/assets/{blockDiagram-OSKFZWR5-Bh12CqHR.js → blockDiagram-OSKFZWR5-CagzyL1X.js} +1 -1
  59. package/web/assets/{c4Diagram-7LVT6UL2-BRURwbey.js → c4Diagram-7LVT6UL2-BaSRqDS9.js} +1 -1
  60. package/web/assets/{catalog-ownership-service-B1Ip9msX.js → catalog-ownership-service-R75gy5oR.js} +1 -1
  61. package/web/assets/{catalog-page-service-B54h6Yts.js → catalog-page-service-YfCinpQH.js} +1 -1
  62. package/web/assets/channel-CJIgruji.js +1 -0
  63. package/web/assets/{chunk-2Q5K7J3B-B3UklVaN.js → chunk-2Q5K7J3B-BSUaQFxz.js} +1 -1
  64. package/web/assets/{chunk-5VM5RSS4-C-u6Icfj.js → chunk-5VM5RSS4-ClzKvinA.js} +1 -1
  65. package/web/assets/{chunk-F27PBJKO-Cgwc09Ty.js → chunk-F27PBJKO-DqF6dvmm.js} +1 -1
  66. package/web/assets/{chunk-HLEWEB6X-B0I9KA_o.js → chunk-HLEWEB6X-CcaN5AOm.js} +1 -1
  67. package/web/assets/{chunk-JWPE2WC7-hrGvO2JH.js → chunk-JWPE2WC7-D96Jc0b8.js} +1 -1
  68. package/web/assets/{chunk-POPQ4Y6H-BnMmtKRL.js → chunk-POPQ4Y6H-BhMg6HZq.js} +1 -1
  69. package/web/assets/{chunk-SVP7TREG-D1SIIIL0.js → chunk-SVP7TREG-BDtMwRf3.js} +1 -1
  70. package/web/assets/{chunk-XXDRQBXY-DQ9RD0qp.js → chunk-XXDRQBXY-BAGSTwdh.js} +1 -1
  71. package/web/assets/{chunk-ZLD2IHE6-BJ5PXdhB.js → chunk-ZLD2IHE6-DwD5v_Qt.js} +1 -1
  72. package/web/assets/classDiagram-CYGNFDIV-Bc6hLUtM.js +1 -0
  73. package/web/assets/classDiagram-v2-TLXNO2FR-Bc6hLUtM.js +1 -0
  74. package/web/assets/{conversation-history-CKIYKBne.js → conversation-history-9qOGJuIn.js} +1 -1
  75. package/web/assets/{cose-bilkent-JH36ORCC-CGnU2Jsr.js → cose-bilkent-JH36ORCC-V433lwW0.js} +1 -1
  76. package/web/assets/{cynefin-OW5HDTMX-KBpmuuGI.js → cynefin-OW5HDTMX-DbCc3oak.js} +1 -1
  77. package/web/assets/{cynefinDiagram-5FMLGOSQ-CbUyUJ_9.js → cynefinDiagram-5FMLGOSQ-O9xO06G7.js} +1 -1
  78. package/web/assets/{dagre-OS7QT2EB-LQ6pV_Lg.js → dagre-OS7QT2EB-Cjvy8Xkv.js} +1 -1
  79. package/web/assets/{diagram-S7CK7UJ4-D07VmbXL.js → diagram-S7CK7UJ4-DHhUiQRf.js} +1 -1
  80. package/web/assets/{diagram-UQ7AKVKN-BibZgYFy.js → diagram-UQ7AKVKN-WCgF1h0B.js} +1 -1
  81. package/web/assets/{diagram-VSXAHHWV-DTsmR17P.js → diagram-VSXAHHWV-iZeH5UxE.js} +1 -1
  82. package/web/assets/{diagram-VX7I27RA-B2uTpJCj.js → diagram-VX7I27RA-D9gNMqe7.js} +1 -1
  83. package/web/assets/{diagram-Z3DM3KII-CFVQgaHi.js → diagram-Z3DM3KII-BRujj2F_.js} +1 -1
  84. package/web/assets/{ebnfDiagram-PWID7BFC-lU_1k7vL.js → ebnfDiagram-PWID7BFC-CEPGVpjt.js} +1 -1
  85. package/web/assets/{el-alert-i4sPRF3y.js → el-alert-yKx8f4IB.js} +1 -1
  86. package/web/assets/{el-cascader-CDcAZHHU.js → el-cascader-BfOdMwHH.js} +1 -1
  87. package/web/assets/{el-checkbox-B99Su3CQ.js → el-checkbox-DHOiz1ip.js} +1 -1
  88. package/web/assets/{el-date-picker-CNIdttaY.js → el-date-picker-Da3xJt5c.js} +1 -1
  89. package/web/assets/{el-descriptions-DfwV9BeX.js → el-descriptions-CnR_kGVC.js} +1 -1
  90. package/web/assets/{el-form-item-Dkt7ZmiR.js → el-form-item-CJ7BE2c7.js} +1 -1
  91. package/web/assets/{el-input-CmMxlyJC.js → el-input-DFFaatHT.js} +1 -1
  92. package/web/assets/{el-input-number-DeInZ_Ah.js → el-input-number-D3LBKWRL.js} +1 -1
  93. package/web/assets/{el-radio-D1gLKQQQ.js → el-radio-Di81kFIf.js} +1 -1
  94. package/web/assets/{el-scrollbar-BygTOJ7z.js → el-scrollbar-Ce8F0IKz.js} +1 -1
  95. package/web/assets/{el-select-BLDSb9Md.js → el-select-34WQsw5v.js} +1 -1
  96. package/web/assets/{el-switch-Ddl5W_pV.js → el-switch-CEhxFw5Q.js} +1 -1
  97. package/web/assets/{el-tab-pane-dV5TbC0S.js → el-tab-pane-BsaBHZUl.js} +1 -1
  98. package/web/assets/{el-table-column-XTG5R-N3.js → el-table-column-B1P8Ht7D.js} +1 -1
  99. package/web/assets/{enterprise-management-service-OyYyO0kK.js → enterprise-management-service-Im_CjdHn.js} +1 -1
  100. package/web/assets/{erDiagram-2YWLMYGG-BlNb-EVe.js → erDiagram-2YWLMYGG-B2wacNnK.js} +1 -1
  101. package/web/assets/{error-presentation-CSmvVKzH.js → error-presentation-Be_WE-ex.js} +1 -1
  102. package/web/assets/{flowDiagram-T62WH6J4-CEXQevvx.js → flowDiagram-T62WH6J4-4f_0qoYS.js} +1 -1
  103. package/web/assets/{ganttDiagram-EL5Y4UJY-jvUiNFh-.js → ganttDiagram-EL5Y4UJY-CwXZoyy5.js} +1 -1
  104. package/web/assets/{gitGraphDiagram-WWUBYQGX-DdwyXs6p.js → gitGraphDiagram-WWUBYQGX-CMuKirK1.js} +1 -1
  105. package/web/assets/{hosted-conversation-template-client-BYeoe2O1.js → hosted-conversation-template-client-OSjwYZWq.js} +1 -1
  106. package/web/assets/{index-6blav931.js → index-15bKzsV5.js} +1 -1
  107. package/web/assets/{index-BOFmJvuG.js → index-B1aFxFdE.js} +1 -1
  108. package/web/assets/{index-BIu5bROM.js → index-B34Vd6az.js} +1 -1
  109. package/web/assets/{index-CfxSWNkF.js → index-B5huIIud.js} +1 -1
  110. package/web/assets/{index-aFFtDNr2.js → index-B6ZXOqD3.js} +1 -1
  111. package/web/assets/{index-byCryyWq.js → index-B6ndmt6R.js} +1 -1
  112. package/web/assets/{index-DmG8QA-j.js → index-B8758_mc.js} +1 -1
  113. package/web/assets/{index-CXn-uZXL.js → index-BD9MoiV5.js} +1 -1
  114. package/web/assets/{index-CTzG9h40.js → index-BFAG63XN.js} +1 -1
  115. package/web/assets/{index-x6bcL8gu.js → index-BNLBlSfm.js} +1 -1
  116. package/web/assets/{index-_dnRSAmr.js → index-BXt11iXj.js} +1 -1
  117. package/web/assets/{index-MbLD9MMG.js → index-Bgn4I2DA.js} +1 -1
  118. package/web/assets/{index-CimpfbnH.js → index-BkHkMR5E.js} +1 -1
  119. package/web/assets/{index-BJElJ5WQ.js → index-C4qbawt-.js} +1 -1
  120. package/web/assets/{index-Bxn7pft6.js → index-CrbpqiXB.js} +1 -1
  121. package/web/assets/{index-Dq52qE9T.js → index-CuTCxMrp.js} +1 -1
  122. package/web/assets/{index-BZAB3p1R.js → index-CwKEKyhz.js} +1 -1
  123. package/web/assets/{index-xlMtvKI5.js → index-CwLAF5FG.js} +1 -1
  124. package/web/assets/{index-HcLGmFz6.js → index-D25Eg-N7.js} +10 -10
  125. package/web/assets/{index-CC4hONE9.js → index-D5xOcg7v.js} +1 -1
  126. package/web/assets/{index-B_x8TQfS.js → index-DON5Dm3d.js} +1 -1
  127. package/web/assets/{index-eKlFh7Gc.js → index-DP0H0xtt.js} +1 -1
  128. package/web/assets/{index-DLHDCDc-.js → index-DlntDttL.js} +1 -1
  129. package/web/assets/{index-C5GmUt48.js → index-Dx9h43Hu.js} +1 -1
  130. package/web/assets/{index-DJbDMFLj.js → index-DyXKa6Ac.js} +1 -1
  131. package/web/assets/{index-CEdSyn4k.js → index-TSUEMhm7.js} +1 -1
  132. package/web/assets/{index-CEanUWoi.js → index-UJK6ZYpS.js} +1 -1
  133. package/web/assets/{index-sxnr4KA1.js → index-c7bgXD2f.js} +1 -1
  134. package/web/assets/{index-Dy-iz5ML.js → index-jVwIVZk9.js} +1 -1
  135. package/web/assets/infoDiagram-FKFFQAWI-T3bPeqFi.js +2 -0
  136. package/web/assets/{isArrayLikeObject-ZvOzSYjq.js → isArrayLikeObject-C4rAg3Qo.js} +1 -1
  137. package/web/assets/{ishikawaDiagram-5VMMS53U-B_VYT4vV.js → ishikawaDiagram-5VMMS53U-DQr1DRrv.js} +1 -1
  138. package/web/assets/{journeyDiagram-EYS64GPL-DuSJE0uB.js → journeyDiagram-EYS64GPL-CE4wm_Hu.js} +1 -1
  139. package/web/assets/{kanban-definition-UXKFOSKX-B9L0Y66o.js → kanban-definition-UXKFOSKX-CnrpCGpL.js} +1 -1
  140. package/web/assets/{layout-Bh1hHNL6.js → layout-DQ32uLDL.js} +1 -1
  141. package/web/assets/{linear-B58zYo2z.js → linear-Vy9TvjJs.js} +1 -1
  142. package/web/assets/{management-url-service-4vWC3-nC.js → management-url-service-QLIuV0JJ.js} +1 -1
  143. package/web/assets/{mcp-center-service-DFNR-TZm.js → mcp-center-service-Dy2YmF8O.js} +1 -1
  144. package/web/assets/{merge-CfAF3e7V.js → merge-CGtXKfZF.js} +1 -1
  145. package/web/assets/{mermaid.core-CpkB2-G5.js → mermaid.core-DXrRFDyF.js} +5 -5
  146. package/web/assets/{message-box-service-BMjc6Na7.js → message-box-service-D6NDomD6.js} +1 -1
  147. package/web/assets/{mindmap-definition-THT77NOG-D06wRkJk.js → mindmap-definition-THT77NOG-aaDlRgwM.js} +1 -1
  148. package/web/assets/{mobile-dialog-return-service-B05lwAuG.js → mobile-dialog-return-service-Bg4lvWpS.js} +1 -1
  149. package/web/assets/{oauth-callback-C81CpC20.js → oauth-callback-A16kzKMv.js} +1 -1
  150. package/web/assets/{pegDiagram-XKGWAZYB-ojCInnSj.js → pegDiagram-XKGWAZYB-SQKB56Rd.js} +1 -1
  151. package/web/assets/{pieDiagram-E7YTZNPT-SD1HGVi4.js → pieDiagram-E7YTZNPT-CMRRrcV1.js} +1 -1
  152. package/web/assets/{quadrantDiagram-AXDQQJYC-CZqzzWHC.js → quadrantDiagram-AXDQQJYC-BALRCq14.js} +1 -1
  153. package/web/assets/{railroadDiagram-O6MQD6OU-CfEviAY9.js → railroadDiagram-O6MQD6OU-BspenC8m.js} +1 -1
  154. package/web/assets/{requirementDiagram-IS5BZ75X-BqB08RSG.js → requirementDiagram-IS5BZ75X-Bu-gDEq4.js} +1 -1
  155. package/web/assets/{runner-presentation-KywUJ5TY.js → runner-presentation-X7lYFguw.js} +1 -1
  156. package/web/assets/{sankeyDiagram-P5KCCOFB-DdRWbZia.js → sankeyDiagram-P5KCCOFB-CcqWfV-z.js} +1 -1
  157. package/web/assets/{sequenceDiagram-WJ2MYXX4-BvYAqC1p.js → sequenceDiagram-WJ2MYXX4-BVhAHXTf.js} +1 -1
  158. package/web/assets/{session-share-client-service-yMaOuR4w.js → session-share-client-service-CesG_4dV.js} +1 -1
  159. package/web/assets/{sizeCapture-INFHLROL-N_rZepbu.js → sizeCapture-INFHLROL-WOfar180.js} +1 -1
  160. package/web/assets/{stateDiagram-XQSTLZYL-DVlGch-z.js → stateDiagram-XQSTLZYL-FsuMTdKU.js} +1 -1
  161. package/web/assets/stateDiagram-v2-IH3M54BS-COsHT19i.js +1 -0
  162. package/web/assets/{swimlanes-V6O3JKXN-Ci4DfL4Y.js → swimlanes-V6O3JKXN-DwhIEzOl.js} +1 -1
  163. package/web/assets/swimlanesDiagram-JKAHXJPX-C8dzANUf.js +8 -0
  164. package/web/assets/{time-presentation-qi0uJ1fq.js → time-presentation-Bm_av3wq.js} +1 -1
  165. package/web/assets/{timeline-definition-24CTP7MA-BAbo6vvA.js → timeline-definition-24CTP7MA-B5n4vMYo.js} +1 -1
  166. package/web/assets/{union-DVxeg9h3.js → union-BTEejhH_.js} +1 -1
  167. package/web/assets/{use-form-common-props-CZ8CMPWx.js → use-form-common-props-RrTc8Wio.js} +1 -1
  168. package/web/assets/{use-wheel-BfDFQNQi.js → use-wheel-DMAZK3wC.js} +1 -1
  169. package/web/assets/{vennDiagram-4TSXK5OY-JLJqhoxn.js → vennDiagram-4TSXK5OY-BD_CXOs3.js} +1 -1
  170. package/web/assets/{vnode-Cx28ZsCC.js → vnode-pdBG4bg6.js} +1 -1
  171. package/web/assets/{wardleyDiagram-VM6X3IG4-Dg2Zxtfh.js → wardleyDiagram-VM6X3IG4-DDFGll4B.js} +1 -1
  172. package/web/assets/{workbench-composer-interaction-controller-5DeoJe6t.js → workbench-composer-interaction-controller-r5AA_gO3.js} +1 -1
  173. package/web/assets/{workbench-live-service-sT0L_6DL.js → workbench-live-service-CVMdiRH6.js} +1 -1
  174. package/web/assets/{workbench-presentation-4-kMnNtd.js → workbench-presentation-SdBUS92X.js} +1 -1
  175. package/web/assets/{xychartDiagram-S5SC5T6Z-DKZHkaYF.js → xychartDiagram-S5SC5T6Z-DCoPY2AO.js} +1 -1
  176. package/web/docs/404.html +2 -2
  177. package/web/docs/administration/account.html +3 -3
  178. package/web/docs/administration/audit.html +3 -3
  179. package/web/docs/administration/conversation-templates.html +3 -3
  180. package/web/docs/administration/email-notifications.html +3 -3
  181. package/web/docs/administration/license.html +3 -3
  182. package/web/docs/administration/nodes-workspaces.html +3 -3
  183. package/web/docs/administration/oauth.html +3 -3
  184. package/web/docs/administration/secrets.html +3 -3
  185. package/web/docs/administration/template-workspace-maintenance.html +3 -3
  186. package/web/docs/administration/users-organizations.html +3 -3
  187. package/web/docs/assets/{app.D1g-MQhG.js → app.D46HhfMQ.js} +1 -1
  188. package/web/docs/assets/chunks/@localSearchIndexen-US.BCgrivSE.js +1 -0
  189. package/web/docs/assets/chunks/@localSearchIndexroot.BVnSIgXd.js +1 -0
  190. package/web/docs/assets/chunks/{VPLocalSearchBox.CiA_6vfi.js → VPLocalSearchBox.8cHZG_OO.js} +1 -1
  191. package/web/docs/assets/chunks/{theme.BMpZW60U.js → theme.CfShhM7K.js} +2 -2
  192. package/web/docs/assets/en-US_getting-started_connect-node.md.DTuAQmSv.js +1 -0
  193. package/web/docs/assets/{en-US_getting-started_connect-node.md.CYnCa9x2.lean.js → en-US_getting-started_connect-node.md.DTuAQmSv.lean.js} +1 -1
  194. package/web/docs/assets/en-US_getting-started_register-workspace.md.CKdln64A.js +1 -0
  195. package/web/docs/assets/en-US_getting-started_register-workspace.md.CKdln64A.lean.js +1 -0
  196. package/web/docs/assets/getting-started_connect-node.md.BNawG401.js +1 -0
  197. package/web/docs/assets/{getting-started_connect-node.md.DUcMxlch.lean.js → getting-started_connect-node.md.BNawG401.lean.js} +1 -1
  198. package/web/docs/assets/getting-started_register-workspace.md.DZsk0FQ0.js +1 -0
  199. package/web/docs/assets/{getting-started_register-workspace.md.BW-xjHjl.lean.js → getting-started_register-workspace.md.DZsk0FQ0.lean.js} +1 -1
  200. package/web/docs/concepts/architecture.html +3 -3
  201. package/web/docs/concepts/data-and-security.html +3 -3
  202. package/web/docs/concepts/files-git-terminal.html +3 -3
  203. package/web/docs/concepts/node-and-workspace.html +3 -3
  204. package/web/docs/concepts/permissions-and-sharing.html +3 -3
  205. package/web/docs/concepts/runner-control.html +3 -3
  206. package/web/docs/concepts/secrets.html +3 -3
  207. package/web/docs/concepts/session-run-turn.html +3 -3
  208. package/web/docs/deployment/backup-restore.html +3 -3
  209. package/web/docs/deployment/network.html +3 -3
  210. package/web/docs/deployment/node-installation.html +3 -3
  211. package/web/docs/deployment/node-linux.html +3 -3
  212. package/web/docs/deployment/node-macos.html +3 -3
  213. package/web/docs/deployment/node-windows.html +3 -3
  214. package/web/docs/deployment/production.html +3 -3
  215. package/web/docs/deployment/security-checklist.html +3 -3
  216. package/web/docs/deployment/upgrade.html +3 -3
  217. package/web/docs/en-US/administration/account.html +3 -3
  218. package/web/docs/en-US/administration/audit.html +3 -3
  219. package/web/docs/en-US/administration/conversation-templates.html +3 -3
  220. package/web/docs/en-US/administration/email-notifications.html +3 -3
  221. package/web/docs/en-US/administration/license.html +3 -3
  222. package/web/docs/en-US/administration/nodes-workspaces.html +3 -3
  223. package/web/docs/en-US/administration/oauth.html +3 -3
  224. package/web/docs/en-US/administration/secrets.html +3 -3
  225. package/web/docs/en-US/administration/template-workspace-maintenance.html +3 -3
  226. package/web/docs/en-US/administration/users-organizations.html +3 -3
  227. package/web/docs/en-US/concepts/architecture.html +3 -3
  228. package/web/docs/en-US/concepts/data-and-security.html +3 -3
  229. package/web/docs/en-US/concepts/files-git-terminal.html +3 -3
  230. package/web/docs/en-US/concepts/node-and-workspace.html +3 -3
  231. package/web/docs/en-US/concepts/permissions-and-sharing.html +3 -3
  232. package/web/docs/en-US/concepts/runner-control.html +3 -3
  233. package/web/docs/en-US/concepts/secrets.html +3 -3
  234. package/web/docs/en-US/concepts/session-run-turn.html +3 -3
  235. package/web/docs/en-US/deployment/backup-restore.html +3 -3
  236. package/web/docs/en-US/deployment/network.html +3 -3
  237. package/web/docs/en-US/deployment/node-installation.html +3 -3
  238. package/web/docs/en-US/deployment/node-linux.html +3 -3
  239. package/web/docs/en-US/deployment/node-macos.html +3 -3
  240. package/web/docs/en-US/deployment/node-windows.html +3 -3
  241. package/web/docs/en-US/deployment/production.html +3 -3
  242. package/web/docs/en-US/deployment/security-checklist.html +3 -3
  243. package/web/docs/en-US/deployment/upgrade.html +3 -3
  244. package/web/docs/en-US/getting-started/connect-node.html +5 -5
  245. package/web/docs/en-US/getting-started/first-agent-session.html +3 -3
  246. package/web/docs/en-US/getting-started/first-login.html +3 -3
  247. package/web/docs/en-US/getting-started/next-steps.html +3 -3
  248. package/web/docs/en-US/getting-started/npm-quick-start.html +3 -3
  249. package/web/docs/en-US/getting-started/overview.html +3 -3
  250. package/web/docs/en-US/getting-started/prerequisites.html +3 -3
  251. package/web/docs/en-US/getting-started/register-workspace.html +5 -5
  252. package/web/docs/en-US/getting-started/server-installation.html +3 -3
  253. package/web/docs/en-US/operations/marctl.html +3 -3
  254. package/web/docs/en-US/reference/configuration.html +3 -3
  255. package/web/docs/en-US/reference/keyboard-shortcuts.html +3 -3
  256. package/web/docs/en-US/reference/limits.html +3 -3
  257. package/web/docs/en-US/reference/ports-paths-data.html +3 -3
  258. package/web/docs/en-US/reference/status-and-errors.html +3 -3
  259. package/web/docs/en-US/runners/claude-code.html +3 -3
  260. package/web/docs/en-US/runners/codex.html +3 -3
  261. package/web/docs/en-US/runners/mar-agent.html +3 -3
  262. package/web/docs/en-US/runners/opencode.html +3 -3
  263. package/web/docs/en-US/runners/overview.html +3 -3
  264. package/web/docs/en-US/runners/runner-troubleshooting.html +3 -3
  265. package/web/docs/en-US/troubleshooting/node-offline.html +3 -3
  266. package/web/docs/en-US/troubleshooting/quick-diagnosis.html +3 -3
  267. package/web/docs/en-US/troubleshooting/session-run.html +3 -3
  268. package/web/docs/en-US/troubleshooting/terminal.html +3 -3
  269. package/web/docs/en-US/troubleshooting/workspace-files.html +3 -3
  270. package/web/docs/en-US/workbench/composer.html +3 -3
  271. package/web/docs/en-US/workbench/context-and-plan.html +3 -3
  272. package/web/docs/en-US/workbench/conversation.html +3 -3
  273. package/web/docs/en-US/workbench/file-reference-and-attachment.html +3 -3
  274. package/web/docs/en-US/workbench/files.html +3 -3
  275. package/web/docs/en-US/workbench/git-changes.html +3 -3
  276. package/web/docs/en-US/workbench/git-history.html +3 -3
  277. package/web/docs/en-US/workbench/hosted-conversations.html +3 -3
  278. package/web/docs/en-US/workbench/mobile.html +3 -3
  279. package/web/docs/en-US/workbench/navigation.html +3 -3
  280. package/web/docs/en-US/workbench/remote-desktop.html +3 -3
  281. package/web/docs/en-US/workbench/sessions.html +3 -3
  282. package/web/docs/en-US/workbench/skills.html +3 -3
  283. package/web/docs/en-US/workbench/terminal.html +3 -3
  284. package/web/docs/getting-started/connect-node.html +5 -5
  285. package/web/docs/getting-started/first-agent-session.html +3 -3
  286. package/web/docs/getting-started/first-login.html +3 -3
  287. package/web/docs/getting-started/next-steps.html +3 -3
  288. package/web/docs/getting-started/npm-quick-start.html +3 -3
  289. package/web/docs/getting-started/overview.html +3 -3
  290. package/web/docs/getting-started/prerequisites.html +3 -3
  291. package/web/docs/getting-started/register-workspace.html +5 -5
  292. package/web/docs/getting-started/server-installation.html +3 -3
  293. package/web/docs/hashmap.json +1 -1
  294. package/web/docs/operations/marctl.html +3 -3
  295. package/web/docs/reference/configuration.html +3 -3
  296. package/web/docs/reference/keyboard-shortcuts.html +3 -3
  297. package/web/docs/reference/limits.html +3 -3
  298. package/web/docs/reference/ports-paths-data.html +3 -3
  299. package/web/docs/reference/status-and-errors.html +3 -3
  300. package/web/docs/runners/claude-code.html +3 -3
  301. package/web/docs/runners/codex.html +3 -3
  302. package/web/docs/runners/mar-agent.html +3 -3
  303. package/web/docs/runners/opencode.html +3 -3
  304. package/web/docs/runners/overview.html +3 -3
  305. package/web/docs/runners/runner-troubleshooting.html +3 -3
  306. package/web/docs/troubleshooting/node-offline.html +3 -3
  307. package/web/docs/troubleshooting/quick-diagnosis.html +3 -3
  308. package/web/docs/troubleshooting/session-run.html +3 -3
  309. package/web/docs/troubleshooting/terminal.html +3 -3
  310. package/web/docs/troubleshooting/workspace-files.html +3 -3
  311. package/web/docs/workbench/composer.html +3 -3
  312. package/web/docs/workbench/context-and-plan.html +3 -3
  313. package/web/docs/workbench/conversation.html +3 -3
  314. package/web/docs/workbench/file-reference-and-attachment.html +3 -3
  315. package/web/docs/workbench/files.html +3 -3
  316. package/web/docs/workbench/git-changes.html +3 -3
  317. package/web/docs/workbench/git-history.html +3 -3
  318. package/web/docs/workbench/hosted-conversations.html +3 -3
  319. package/web/docs/workbench/mobile.html +3 -3
  320. package/web/docs/workbench/navigation.html +3 -3
  321. package/web/docs/workbench/remote-desktop.html +3 -3
  322. package/web/docs/workbench/sessions.html +3 -3
  323. package/web/docs/workbench/skills.html +3 -3
  324. package/web/docs/workbench/terminal.html +3 -3
  325. package/web/index.html +2 -2
  326. package/web/service-worker.js +1 -1
  327. package/web/web-version.json +1 -1
  328. package/web/assets/NodeManagementPage-B2dMj8EF.js +0 -1
  329. package/web/assets/NodeManagementPage-K4Z8tlhJ.js +0 -1
  330. package/web/assets/SecretManagementPage-lb2DTG0a.js +0 -1
  331. package/web/assets/SkillCenterPage-BpTynj6P.js +0 -1
  332. package/web/assets/SystemConfigurationPage-jb6Oy_YV.js +0 -1
  333. package/web/assets/WorkbenchPage-CN59HcEF.js +0 -22
  334. package/web/assets/WorkbenchPage-CR14GGcS.css +0 -1
  335. package/web/assets/WorkspaceManagementPage-CJqY6DGM.js +0 -1
  336. package/web/assets/WorkspaceManagementPage-I2WKlA-S.js +0 -1
  337. package/web/assets/channel-pV0VKhUQ.js +0 -1
  338. package/web/assets/classDiagram-CYGNFDIV-Degg8S4g.js +0 -1
  339. package/web/assets/classDiagram-v2-TLXNO2FR-Degg8S4g.js +0 -1
  340. package/web/assets/infoDiagram-FKFFQAWI-NZSa1F-m.js +0 -2
  341. package/web/assets/stateDiagram-v2-IH3M54BS-Lv_ZQx86.js +0 -1
  342. package/web/assets/swimlanesDiagram-JKAHXJPX-msIfKYZU.js +0 -8
  343. package/web/docs/assets/chunks/@localSearchIndexen-US.CJTOZB6f.js +0 -1
  344. package/web/docs/assets/chunks/@localSearchIndexroot.BERjrRBV.js +0 -1
  345. package/web/docs/assets/en-US_getting-started_connect-node.md.CYnCa9x2.js +0 -1
  346. package/web/docs/assets/en-US_getting-started_register-workspace.md.D3j75IC2.js +0 -1
  347. package/web/docs/assets/en-US_getting-started_register-workspace.md.D3j75IC2.lean.js +0 -1
  348. package/web/docs/assets/getting-started_connect-node.md.DUcMxlch.js +0 -1
  349. package/web/docs/assets/getting-started_register-workspace.md.BW-xjHjl.js +0 -1
@@ -0,0 +1,8 @@
1
+ import{c as r,s as o}from"./flowDiagram-T62WH6J4-4f_0qoYS.js";import{_ as e}from"./mermaid.core-DXrRFDyF.js";import"./index-D25Eg-N7.js";import"./chunk-5VM5RSS4-ClzKvinA.js";import"./chunk-XXDRQBXY-BAGSTwdh.js";import"./chunk-POPQ4Y6H-BhMg6HZq.js";import"./chunk-F27PBJKO-DqF6dvmm.js";import"./FilePreviewLoading-D3TMSEqz.js";import"./use-form-common-props-RrTc8Wio.js";import"./el-scrollbar-Ce8F0IKz.js";import"./el-input-DFFaatHT.js";import"./mobile-dialog-return-service-Bg4lvWpS.js";import"./BusyIndicator-DPIylucr.js";import"./channel-CJIgruji.js";import"./isArrayLikeObject-C4rAg3Qo.js";import"./_baseIteratee-DGGNUsro.js";import"./union-BTEejhH_.js";import"./_baseFindIndex-D7XfJLKM.js";var m=e(t=>`${o(t)}
2
+ .swimlane.cluster rect {
3
+ stroke: ${t.clusterBorder} !important;
4
+ }
5
+ [data-look="neo"].cluster rect {
6
+ filter: none;
7
+ }
8
+ `,"getStyles"),i=m,B=r({defaultLayout:"swimlane",styles:i});export{B as diagram};
@@ -1 +1 @@
1
- import"./index-HcLGmFz6.js";function c(r,a){const t=new Date(r),e=a===void 0?{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds()}:Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(t).map(({type:n,value:s})=>[n,s])),o=n=>String(n).padStart(2,"0");return`${String(e.year).padStart(4,"0")}-${o(e.month)}-${o(e.day)} ${o(e.hour)}:${o(e.minute)}:${o(e.second)}`}function d(r){const a=Math.max(0,Math.floor(r/1e3)),t=a%60,e=Math.floor(a/60),o=e%60,n=Math.floor(e/60);return n>0?`${n}h ${o}m ${t}s`:o>0?`${o}m ${t}s`:`${t}s`}export{c as f,d as p};
1
+ import"./index-D25Eg-N7.js";function c(r,a){const t=new Date(r),e=a===void 0?{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds()}:Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(t).map(({type:n,value:s})=>[n,s])),o=n=>String(n).padStart(2,"0");return`${String(e.year).padStart(4,"0")}-${o(e.month)}-${o(e.day)} ${o(e.hour)}:${o(e.minute)}:${o(e.second)}`}function d(r){const a=Math.max(0,Math.floor(r/1e3)),t=a%60,e=Math.floor(a/60),o=e%60,n=Math.floor(e/60);return n>0?`${n}h ${o}m ${t}s`:o>0?`${o}m ${t}s`:`${t}s`}export{c as f,d as p};
@@ -1,4 +1,4 @@
1
- import{_ as o,A as pt,ab as Rt,ac as Ct,ad as Wt,c as gt,l as E,G as Pt,a2 as Bt,ae as ft,j as U,v as Vt,af as Ft,r as zt}from"./mermaid.core-CpkB2-G5.js";import{d as ot}from"./arc-Hc0Y76Iy.js";import"./index-HcLGmFz6.js";import"./FilePreviewLoading-C1U4PIWp.js";import"./use-form-common-props-CZ8CMPWx.js";import"./el-scrollbar-BygTOJ7z.js";import"./el-input-CmMxlyJC.js";import"./mobile-dialog-return-service-B05lwAuG.js";import"./BusyIndicator-MYxuzJwk.js";import"./isArrayLikeObject-ZvOzSYjq.js";import"./_baseIteratee-D6vE6jHm.js";import"./union-DVxeg9h3.js";import"./_baseFindIndex-D7XfJLKM.js";var tt=(function(){var e=o(function(k,s,d,l){for(d=d||{},l=k.length;l--;d[k[l]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],h=[1,15],c=[1,16],a=[1,19],f=[1,20],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(s,d,l,p,x,u,S){var v=u.length-1;switch(x){case 1:return u[v-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:p.addTask(u[v],0,""),this.$=u[v];break;case 19:p.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(s,d){if(d.recoverable)this.trace(s);else{var l=new Error(s);throw l.hash=d,l}},"parseError"),parse:o(function(s){var d=this,l=[0],p=[],x=[null],u=[],S=this.table,v="",I=0,R=0,W=2,O=1,L=u.slice.call(arguments,1),w=Object.create(this.lexer),H={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(H.yy[V]=this.yy[V]);w.setInput(s,H.yy),H.yy.lexer=w,H.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var F=w.yylloc;u.push(F);var K=w.options&&w.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function N(A){l.length=l.length-2*A,x.length=x.length-A,u.length=u.length-A}o(N,"popStack");function b(){var A;return A=p.pop()||w.lex()||O,typeof A!="number"&&(A instanceof Array&&(p=A,A=p.pop()),A=d.symbols_[A]||A),A}o(b,"lex");for(var _,$,T,P,C={},G,B,X,Z;;){if($=l[l.length-1],this.defaultActions[$]?T=this.defaultActions[$]:((_===null||typeof _>"u")&&(_=b()),T=S[$]&&S[$][_]),typeof T>"u"||!T.length||!T[0]){var Y="";Z=[];for(G in S[$])this.terminals_[G]&&G>W&&Z.push("'"+this.terminals_[G]+"'");w.showPosition?Y="Parse error on line "+(I+1)+`:
1
+ import{_ as o,A as pt,ab as Rt,ac as Ct,ad as Wt,c as gt,l as E,G as Pt,a2 as Bt,ae as ft,j as U,v as Vt,af as Ft,r as zt}from"./mermaid.core-DXrRFDyF.js";import{d as ot}from"./arc-B_HN3f5X.js";import"./index-D25Eg-N7.js";import"./FilePreviewLoading-D3TMSEqz.js";import"./use-form-common-props-RrTc8Wio.js";import"./el-scrollbar-Ce8F0IKz.js";import"./el-input-DFFaatHT.js";import"./mobile-dialog-return-service-Bg4lvWpS.js";import"./BusyIndicator-DPIylucr.js";import"./isArrayLikeObject-C4rAg3Qo.js";import"./_baseIteratee-DGGNUsro.js";import"./union-BTEejhH_.js";import"./_baseFindIndex-D7XfJLKM.js";var tt=(function(){var e=o(function(k,s,d,l){for(d=d||{},l=k.length;l--;d[k[l]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],h=[1,15],c=[1,16],a=[1,19],f=[1,20],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(s,d,l,p,x,u,S){var v=u.length-1;switch(x){case 1:return u[v-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:p.addTask(u[v],0,""),this.$=u[v];break;case 19:p.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(s,d){if(d.recoverable)this.trace(s);else{var l=new Error(s);throw l.hash=d,l}},"parseError"),parse:o(function(s){var d=this,l=[0],p=[],x=[null],u=[],S=this.table,v="",I=0,R=0,W=2,O=1,L=u.slice.call(arguments,1),w=Object.create(this.lexer),H={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(H.yy[V]=this.yy[V]);w.setInput(s,H.yy),H.yy.lexer=w,H.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var F=w.yylloc;u.push(F);var K=w.options&&w.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function N(A){l.length=l.length-2*A,x.length=x.length-A,u.length=u.length-A}o(N,"popStack");function b(){var A;return A=p.pop()||w.lex()||O,typeof A!="number"&&(A instanceof Array&&(p=A,A=p.pop()),A=d.symbols_[A]||A),A}o(b,"lex");for(var _,$,T,P,C={},G,B,X,Z;;){if($=l[l.length-1],this.defaultActions[$]?T=this.defaultActions[$]:((_===null||typeof _>"u")&&(_=b()),T=S[$]&&S[$][_]),typeof T>"u"||!T.length||!T[0]){var Y="";Z=[];for(G in S[$])this.terminals_[G]&&G>W&&Z.push("'"+this.terminals_[G]+"'");w.showPosition?Y="Parse error on line "+(I+1)+`:
2
2
  `+w.showPosition()+`
3
3
  Expecting `+Z.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Y="Parse error on line "+(I+1)+": Unexpected "+(_==O?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Y,{text:w.match,token:this.terminals_[_]||_,line:w.yylineno,loc:F,expected:Z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+_);switch(T[0]){case 1:l.push(_),x.push(w.yytext),u.push(w.yylloc),l.push(T[1]),_=null,R=w.yyleng,v=w.yytext,I=w.yylineno,F=w.yylloc;break;case 2:if(B=this.productions_[T[1]][1],C.$=x[x.length-B],C._$={first_line:u[u.length-(B||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(B||1)].first_column,last_column:u[u.length-1].last_column},K&&(C._$.range=[u[u.length-(B||1)].range[0],u[u.length-1].range[1]]),P=this.performAction.apply(C,[v,R,I,H.yy,T[1],x,u].concat(L)),typeof P<"u")return P;B&&(l=l.slice(0,-1*B*2),x=x.slice(0,-1*B),u=u.slice(0,-1*B)),l.push(this.productions_[T[1]][0]),x.push(C.$),u.push(C._$),X=S[l[l.length-2]][l[l.length-1]],l.push(X);break;case 3:return!0}}return!0},"parse")},m=(function(){var k={EOF:1,parseError:o(function(d,l){if(this.yy.parser)this.yy.parser.parseError(d,l);else throw new Error(d)},"parseError"),setInput:o(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:o(function(s){var d=s.length,l=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===p.length?this.yylloc.first_column:0)+p[p.length-l.length].length-l[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(s){this.unput(this.match.slice(s))},"less"),pastInput:o(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{bi as u,bj as g,bk as I,bl as w,bm as A}from"./index-HcLGmFz6.js";import{b as m,i as p}from"./isArrayLikeObject-ZvOzSYjq.js";import{b as x}from"./_baseFindIndex-D7XfJLKM.js";function N(){}function R(n){return n!==n}function S(n,e,t){for(var r=t-1,o=n.length;++r<o;)if(n[r]===e)return r;return-1}function F(n,e,t){return e===e?S(n,e,t):x(n,R,t)}function O(n,e){var t=n==null?0:n.length;return!!t&&F(n,e,0)>-1}var d=1/0,j=u&&1/g(new u([,-0]))[1]==d?function(n){return new u(n)}:N,k=200;function v(n,e,t){var r=-1,o=O,h=n.length,b=!0,s=[],i=s;if(h>=k){var c=j(n);if(c)return g(c);b=!1,o=w,i=new I}else i=s;n:for(;++r<h;){var f=n[r],a=f;if(f=f!==0?f:0,b&&a===a){for(var l=i.length;l--;)if(i[l]===a)continue n;s.push(f)}else o(i,a,t)||(i!==s&&i.push(a),s.push(f))}return s}var T=m(function(n){return v(A(n,1,p,!0))});export{T as u};
1
+ import{bi as u,bj as g,bk as I,bl as w,bm as A}from"./index-D25Eg-N7.js";import{b as m,i as p}from"./isArrayLikeObject-C4rAg3Qo.js";import{b as x}from"./_baseFindIndex-D7XfJLKM.js";function N(){}function R(n){return n!==n}function S(n,e,t){for(var r=t-1,o=n.length;++r<o;)if(n[r]===e)return r;return-1}function F(n,e,t){return e===e?S(n,e,t):x(n,R,t)}function O(n,e){var t=n==null?0:n.length;return!!t&&F(n,e,0)>-1}var d=1/0,j=u&&1/g(new u([,-0]))[1]==d?function(n){return new u(n)}:N,k=200;function v(n,e,t){var r=-1,o=O,h=n.length,b=!0,s=[],i=s;if(h>=k){var c=j(n);if(c)return g(c);b=!1,o=w,i=new I}else i=s;n:for(;++r<h;){var f=n[r],a=f;if(f=f!==0?f:0,b&&a===a){for(var l=i.length;l--;)if(i[l]===a)continue n;s.push(f)}else o(i,a,t)||(i!==s&&i.push(a),s.push(f))}return s}var T=m(function(n){return v(A(n,1,p,!0))});export{T as u};
@@ -1 +1 @@
1
- import{k as r,O as f,P as l,Q as t,R as a,S as p,L as n,f as v}from"./index-HcLGmFz6.js";const i=s=>{const e=f();return r(()=>e?.proxy?.$props?.[s])},b=(s,e={})=>{const o=v(void 0),m=e.prop?o:i("size"),u=e.global?o:l(),c=e.form?{size:void 0}:t(a,void 0),d=e.formItem?{size:void 0}:t(p,void 0);return r(()=>m.value||n(s)||d?.size||c?.size||u.value||"")},x=s=>{const e=i("disabled"),o=t(a,void 0);return r(()=>e.value??n(s)??o?.disabled??!1)};export{x as a,b as u};
1
+ import{k as r,O as f,P as l,Q as t,R as a,S as p,L as n,f as v}from"./index-D25Eg-N7.js";const i=s=>{const e=f();return r(()=>e?.proxy?.$props?.[s])},b=(s,e={})=>{const o=v(void 0),m=e.prop?o:i("size"),u=e.global?o:l(),c=e.form?{size:void 0}:t(a,void 0),d=e.formItem?{size:void 0}:t(p,void 0);return r(()=>m.value||n(s)||d?.size||c?.size||u.value||"")},x=s=>{const e=i("disabled"),o=t(a,void 0);return r(()=>e.value??n(s)??o?.disabled??!1)};export{x as a,b as u};
@@ -1 +1 @@
1
- import{s as c}from"./index-HcLGmFz6.js";import{c as h,r as d}from"./el-input-CmMxlyJC.js";const F=({atEndEdge:n,atStartEdge:f,layout:i},u)=>{let l,r=0;const o=e=>e<0&&f.value||e>0&&n.value;return{hasReachedEdge:o,onWheel:e=>{h(l);let{deltaX:s,deltaY:t}=e;e.shiftKey&&t!==0&&(s=t,t=0);const a=i.value==="horizontal"?s:t;o(a)||(r+=a,!c()&&a!==0&&e.preventDefault(),l=d(()=>{u(r),r=0}))}}};export{F as u};
1
+ import{s as c}from"./index-D25Eg-N7.js";import{c as h,r as d}from"./el-input-DFFaatHT.js";const F=({atEndEdge:n,atStartEdge:f,layout:i},u)=>{let l,r=0;const o=e=>e<0&&f.value||e>0&&n.value;return{hasReachedEdge:o,onWheel:e=>{h(l);let{deltaX:s,deltaY:t}=e;e.shiftKey&&t!==0&&(s=t,t=0);const a=i.value==="horizontal"?s:t;o(a)||(r+=a,!c()&&a!==0&&e.preventDefault(),l=d(()=>{u(r),r=0}))}}};export{F as u};
@@ -1,4 +1,4 @@
1
- import{b1 as Wt,s as Kt,g as Ht,q as Yt,p as Xt,a as Zt,b as Jt,_ as w,A as wt,G as Qt,j as ot,am as $t,ab as te,ac as ee,ad as ne,d as se,r as ie,D as oe,E as re}from"./mermaid.core-CpkB2-G5.js";import"./index-HcLGmFz6.js";import"./FilePreviewLoading-C1U4PIWp.js";import"./use-form-common-props-CZ8CMPWx.js";import"./el-scrollbar-BygTOJ7z.js";import"./el-input-CmMxlyJC.js";import"./mobile-dialog-return-service-B05lwAuG.js";import"./BusyIndicator-MYxuzJwk.js";import"./isArrayLikeObject-ZvOzSYjq.js";import"./_baseIteratee-D6vE6jHm.js";import"./union-DVxeg9h3.js";import"./_baseFindIndex-D7XfJLKM.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Tt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),T=Math.atan2(f.x-p.x,f.y-p.y);let _=T-M;_<0&&(_+=2*Math.PI);const S=T-_/2;let g=q(y,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Et(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Et(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Tt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*r>=0&&(n=a),Math.abs(f)<o||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt($(t,t))}function ft(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let v=0;v<b;++v){const c=n.slice();c[v]=c[v]?c[v]*i:o,p[v+1]=c,p[v+1].fx=t(c),p[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)p[b][c]=v[c];p[b].fx=v.fx}const T=(v,c)=>v.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v<e;++v){if(p.sort(T),s.history){const x=p.map(d=>{const D=d.slice();return D.fx=d.fx,D.id=d.id,D});x.sort((d,D)=>d.id-D.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x<b;++x)h=Math.max(h,Math.abs(p[0][x]-p[1][x]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let x=0;x<b;++x){_[x]=0;for(let d=0;d<b;++d)_[x]+=p[d][x];_[x]/=b}const c=p[b];if(J(S,1+f,_,-f,c),S.fx=t(S),S.fx<p[0].fx)J(m,1+u,_,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let x=!1;if(S.fx>c.fx?(J(g,1+a,_,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(J(g,1-a*f,_,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):x=!0),x){if(y>=1)break;for(let d=1;d<p.length;++d)J(p[d],1-y,p[0],y,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(T),{fx:p[0].fx,x:p[0]}}function ue(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,y=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,T){for(let _=0;_<16;++_)if(i=(p+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||u>=T)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,T=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ue(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ft(r,e.fxprime,-1);else{J(o,1,i.fxprime,-1,e.fxprime);const y=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/y);J(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||tt,i=he(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=zt(a=>{const y={};for(let h=0;h<r.length;++h){const b=r[h];y[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(y,i)},l,n).x;for(let a=0;a<r.length;++a){const y=r[a];o[y].x=u[2*a],o[y].y=u[2*a+1]}return o}const Rt=1e-10;function ht(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const h=String(f.sets[y]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-y*y;h>0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=de(t,e,i);const l=ut(o.map(ut))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=ct(o.length*2).map(Math.random),p=fe(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,y={};for(let h=0;h<e.length;++h){const b=e[h];y[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ft(h.x,l);return y}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const y of t)if(y.sets.length===1){const h=y.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[h]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;b<i[y].length;++b)h+=i[y][b].size*i[y][b].weight;o.push({set:y,size:h})});function r(y,h){return h.size-y.size}o.sort(r);const l={};function f(y){return y.set in l}function u(y,h){e[h].x=y.x,e[h].y=y.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let y=1;y<o.length;++y){const h=o[y].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ht(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){const v=e[b[m].set],c=ht(p.radius,v.radius,b[m].size),x=Et({x:S.x,y:S.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let T=1e50,_=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<T&&(T=g,_=S)}u(_,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=xt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const o=jt(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=dt(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),y=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Ot(o.map(b=>({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,T={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in T)return T[x];var d=T[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const D=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&D.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(j=>D.has(j)));let I={},C={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Ct(k,r,h)),I=Nt(k,s,e,i,f),C=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const O=x.select("svg");n?O.attr("viewBox",`0 0 ${s} ${e}`):O.attr("width",s).attr("height",e);const R={};let E=!1;O.selectAll(".venn-area path").each(function(k){const j=this.getAttribute("d");k.sets.length==1&&j&&!b&&(E=!0,R[k.sets[0]]=Me(j))});function A(k){return j=>{const H=k.sets.map(et=>{let Y=R[et],Z=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-j)+Z.x*j,y:Y.y*(1-j)+Z.y*j,radius:Y.radius*(1-j)+Z.radius*j}});return St(H,p)}}const G=O.selectAll(".venn-area").data(d,k=>k.sets),P=G.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),L=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function K(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;E&&typeof z.transition=="function"?(z=K(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(j=>I[j])),p);const N=z.selectAll("text").filter(k=>k.sets in C).text(k=>V(k)).attr("x",k=>Math.floor(C[k.sets].x)).attr("y",k=>Math.floor(C[k.sets].y));u&&(E?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const F=K(G.exit()).remove();typeof G.transition=="function"&&F.selectAll("path").attrTween("d",A);const X=F.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(L.style("font-size","0px"),N.style("font-size",y),X.style("font-size","0px")),{circles:I,textCentres:C,nodes:G,enter:P,update:z,exit:F}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Dt:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const T=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${T+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function Ft(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Ft(t,[]):Tt(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const y=Ft(u,a,s);e[r]=y,y.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
1
+ import{b1 as Wt,s as Kt,g as Ht,q as Yt,p as Xt,a as Zt,b as Jt,_ as w,A as wt,G as Qt,j as ot,am as $t,ab as te,ac as ee,ad as ne,d as se,r as ie,D as oe,E as re}from"./mermaid.core-DXrRFDyF.js";import"./index-D25Eg-N7.js";import"./FilePreviewLoading-D3TMSEqz.js";import"./use-form-common-props-RrTc8Wio.js";import"./el-scrollbar-Ce8F0IKz.js";import"./el-input-DFFaatHT.js";import"./mobile-dialog-return-service-Bg4lvWpS.js";import"./BusyIndicator-DPIylucr.js";import"./isArrayLikeObject-C4rAg3Qo.js";import"./_baseIteratee-DGGNUsro.js";import"./union-BTEejhH_.js";import"./_baseFindIndex-D7XfJLKM.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Tt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),T=Math.atan2(f.x-p.x,f.y-p.y);let _=T-M;_<0&&(_+=2*Math.PI);const S=T-_/2;let g=q(y,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Et(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Et(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Tt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*r>=0&&(n=a),Math.abs(f)<o||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt($(t,t))}function ft(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let v=0;v<b;++v){const c=n.slice();c[v]=c[v]?c[v]*i:o,p[v+1]=c,p[v+1].fx=t(c),p[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)p[b][c]=v[c];p[b].fx=v.fx}const T=(v,c)=>v.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v<e;++v){if(p.sort(T),s.history){const x=p.map(d=>{const D=d.slice();return D.fx=d.fx,D.id=d.id,D});x.sort((d,D)=>d.id-D.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x<b;++x)h=Math.max(h,Math.abs(p[0][x]-p[1][x]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let x=0;x<b;++x){_[x]=0;for(let d=0;d<b;++d)_[x]+=p[d][x];_[x]/=b}const c=p[b];if(J(S,1+f,_,-f,c),S.fx=t(S),S.fx<p[0].fx)J(m,1+u,_,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let x=!1;if(S.fx>c.fx?(J(g,1+a,_,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(J(g,1-a*f,_,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):x=!0),x){if(y>=1)break;for(let d=1;d<p.length;++d)J(p[d],1-y,p[0],y,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(T),{fx:p[0].fx,x:p[0]}}function ue(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,y=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,T){for(let _=0;_<16;++_)if(i=(p+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||u>=T)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,T=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ue(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ft(r,e.fxprime,-1);else{J(o,1,i.fxprime,-1,e.fxprime);const y=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/y);J(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||tt,i=he(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=zt(a=>{const y={};for(let h=0;h<r.length;++h){const b=r[h];y[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(y,i)},l,n).x;for(let a=0;a<r.length;++a){const y=r[a];o[y].x=u[2*a],o[y].y=u[2*a+1]}return o}const Rt=1e-10;function ht(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const h=String(f.sets[y]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-y*y;h>0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=de(t,e,i);const l=ut(o.map(ut))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=ct(o.length*2).map(Math.random),p=fe(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,y={};for(let h=0;h<e.length;++h){const b=e[h];y[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ft(h.x,l);return y}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const y of t)if(y.sets.length===1){const h=y.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[h]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;b<i[y].length;++b)h+=i[y][b].size*i[y][b].weight;o.push({set:y,size:h})});function r(y,h){return h.size-y.size}o.sort(r);const l={};function f(y){return y.set in l}function u(y,h){e[h].x=y.x,e[h].y=y.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let y=1;y<o.length;++y){const h=o[y].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ht(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){const v=e[b[m].set],c=ht(p.radius,v.radius,b[m].size),x=Et({x:S.x,y:S.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let T=1e50,_=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<T&&(T=g,_=S)}u(_,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=xt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const o=jt(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=dt(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),y=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Ot(o.map(b=>({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,T={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in T)return T[x];var d=T[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const D=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&D.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(j=>D.has(j)));let I={},C={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Ct(k,r,h)),I=Nt(k,s,e,i,f),C=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const O=x.select("svg");n?O.attr("viewBox",`0 0 ${s} ${e}`):O.attr("width",s).attr("height",e);const R={};let E=!1;O.selectAll(".venn-area path").each(function(k){const j=this.getAttribute("d");k.sets.length==1&&j&&!b&&(E=!0,R[k.sets[0]]=Me(j))});function A(k){return j=>{const H=k.sets.map(et=>{let Y=R[et],Z=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-j)+Z.x*j,y:Y.y*(1-j)+Z.y*j,radius:Y.radius*(1-j)+Z.radius*j}});return St(H,p)}}const G=O.selectAll(".venn-area").data(d,k=>k.sets),P=G.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),L=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function K(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;E&&typeof z.transition=="function"?(z=K(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(j=>I[j])),p);const N=z.selectAll("text").filter(k=>k.sets in C).text(k=>V(k)).attr("x",k=>Math.floor(C[k.sets].x)).attr("y",k=>Math.floor(C[k.sets].y));u&&(E?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const F=K(G.exit()).remove();typeof G.transition=="function"&&F.selectAll("path").attrTween("d",A);const X=F.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(L.style("font-size","0px"),N.style("font-size",y),X.style("font-size","0px")),{circles:I,textCentres:C,nodes:G,enter:P,update:z,exit:F}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Dt:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const T=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${T+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function Ft(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Ft(t,[]):Tt(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const y=Ft(u,a,s);e[r]=y,y.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
2
2
  M`,t,n),e.push(`
3
3
  m`,-s,0),e.push(`
4
4
  a`,s,s,0,1,0,s*2,0),e.push(`
@@ -1 +1 @@
1
- import{B as p,C as a,D as u,E as f,F as m,G as i,H as b}from"./index-HcLGmFz6.js";const c="utils/vue/vnode";function y(s){return a(s)&&s.type===u}const E=s=>{if(!a(s))return f(c,"[getNormalizedProps] must be a VNode"),{};const o=s.props||{},t=(a(s.type)?s.type.props:void 0)||{},e={};return Object.keys(t).forEach(r=>{m(t[r],"default")&&(e[r]=t[r].default)}),Object.keys(o).forEach(r=>{e[i(r)]=o[r]}),e},n=s=>{const o=p(s)?s:[s],t=[];return o.forEach(e=>{p(e)?t.push(...n(e)):a(e)&&e.component?.subTree?t.push(e,...n(e.component.subTree)):a(e)&&p(e.children)?t.push(...n(e.children)):a(e)&&e.shapeFlag===2?t.push(...n(e.type())):t.push(e)}),t};export{n as f,E as g,y as i};
1
+ import{B as p,C as a,D as u,E as f,F as m,G as i,H as b}from"./index-D25Eg-N7.js";const c="utils/vue/vnode";function y(s){return a(s)&&s.type===u}const E=s=>{if(!a(s))return f(c,"[getNormalizedProps] must be a VNode"),{};const o=s.props||{},t=(a(s.type)?s.type.props:void 0)||{},e={};return Object.keys(t).forEach(r=>{m(t[r],"default")&&(e[r]=t[r].default)}),Object.keys(o).forEach(r=>{e[i(r)]=o[r]}),e},n=s=>{const o=p(s)?s:[s],t=[];return o.forEach(e=>{p(e)?t.push(...n(e)):a(e)&&e.component?.subTree?t.push(e,...n(e.component.subTree)):a(e)&&p(e.children)?t.push(...n(e.children)):a(e)&&e.shapeFlag===2?t.push(...n(e.type())):t.push(e)}),t};export{n as f,E as g,y as i};
@@ -1,4 +1,4 @@
1
- import{p as Mt}from"./chunk-JWPE2WC7-hrGvO2JH.js";import{s as Nt,g as zt,q as Lt,p as Tt,a as At,b as Xt,_ as u,X as Et,A as Yt,D as J,l as Q,G as It,d as Bt,r as Ft,c as V}from"./mermaid.core-CpkB2-G5.js";import{p as Rt}from"./cynefin-OW5HDTMX-KBpmuuGI.js";import"./index-HcLGmFz6.js";import"./FilePreviewLoading-C1U4PIWp.js";import"./use-form-common-props-CZ8CMPWx.js";import"./el-scrollbar-BygTOJ7z.js";import"./el-input-CmMxlyJC.js";import"./mobile-dialog-return-service-B05lwAuG.js";import"./BusyIndicator-MYxuzJwk.js";import"./isArrayLikeObject-ZvOzSYjq.js";import"./_baseIteratee-D6vE6jHm.js";import"./union-DVxeg9h3.js";import"./_baseFindIndex-D7XfJLKM.js";var G=u((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),A=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),K=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Mt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{const h=A(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{const h=A(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,m)}),o.notes.forEach(e=>{const h=A(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(m,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,m)})}),o.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=K(e.fromPort)??K(e.toPort);const{flow:d,label:m}=Ot(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,g=m??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{const h=r.getNode(e.component);if(h?.y!==void 0){const a=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){const e=o.annotations[0],h=A(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{const h=A(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{const h=A(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{const h=A(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void 0},parse:u(async o=>{const r=await Rt("wardley",o);Q.debug(r);const e=tt.parser?.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},E,Dt=(E=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,h]of this.nodes)if(h.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},u(E,"WardleyBuilder"),E),k=new Dt;function et(){return V()["wardley-beta"]}u(et,"getConfig");function at(o,r,e,h,a,d,m,C,g){k.addNode({id:o,label:r,x:e,y:h,className:a,labelOffsetX:d,labelOffsetY:m,inertia:C,sourceStrategy:g})}u(at,"addNode");function rt(o,r,e=!1,h,a){k.addLink({source:o,target:r,dashed:e,label:h,flow:a})}u(rt,"addLink");function ot(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}u(ot,"addTrend");function nt(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}u(nt,"addAnnotation");function st(o,r,e){k.addNote({text:o,x:r,y:e})}u(st,"addNote");function it(o,r,e){k.addAccelerator({name:o,x:r,y:e})}u(it,"addAccelerator");function dt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}u(dt,"addDeaccelerator");function lt(o,r){k.setAnnotationsBox(o,r)}u(lt,"setAnnotationsBox");function ct(o,r){k.setSize(o,r)}u(ct,"setSize");function pt(o){k.startPipeline(o)}u(pt,"startPipeline");function ft(o,r){k.addPipelineComponent(o,r)}u(ft,"addPipelineComponent");function ht(o){k.setAxes(o)}u(ht,"updateAxes");function xt(o){return k.getNode(o)}u(xt,"getNode");function gt(o){return k.resolveNodeId(o)}u(gt,"resolveNodeId");function yt(){return k.build()}u(yt,"getWardleyData");function ut(){k.clear(),Ft()}u(ut,"clear");var Gt={getConfig:et,addNode:at,addLink:rt,addTrend:ot,addAnnotation:nt,addNote:st,addAccelerator:it,addDeaccelerator:dt,setAnnotationsBox:lt,setSize:ct,startPipeline:pt,addPipelineComponent:ft,updateAxes:ht,getNode:xt,resolveNodeId:gt,getWardleyData:yt,clear:ut,setAccTitle:Xt,getAccTitle:At,setDiagramTitle:Tt,getDiagramTitle:Lt,getAccDescription:zt,setAccDescription:Nt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{const{themeVariables:o}=V();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=u(()=>{const o=V()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=u((o,r,e,h)=>{Q.debug(`Rendering Wardley map
1
+ import{p as Mt}from"./chunk-JWPE2WC7-D96Jc0b8.js";import{s as Nt,g as zt,q as Lt,p as Tt,a as At,b as Xt,_ as u,X as Et,A as Yt,D as J,l as Q,G as It,d as Bt,r as Ft,c as V}from"./mermaid.core-DXrRFDyF.js";import{p as Rt}from"./cynefin-OW5HDTMX-DbCc3oak.js";import"./index-D25Eg-N7.js";import"./FilePreviewLoading-D3TMSEqz.js";import"./use-form-common-props-RrTc8Wio.js";import"./el-scrollbar-Ce8F0IKz.js";import"./el-input-DFFaatHT.js";import"./mobile-dialog-return-service-Bg4lvWpS.js";import"./BusyIndicator-DPIylucr.js";import"./isArrayLikeObject-C4rAg3Qo.js";import"./_baseIteratee-DGGNUsro.js";import"./union-BTEejhH_.js";import"./_baseFindIndex-D7XfJLKM.js";var G=u((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),A=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),K=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Mt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{const h=A(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{const h=A(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,m)}),o.notes.forEach(e=>{const h=A(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(m,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,m)})}),o.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=K(e.fromPort)??K(e.toPort);const{flow:d,label:m}=Ot(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,g=m??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{const h=r.getNode(e.component);if(h?.y!==void 0){const a=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){const e=o.annotations[0],h=A(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{const h=A(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{const h=A(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{const h=A(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void 0},parse:u(async o=>{const r=await Rt("wardley",o);Q.debug(r);const e=tt.parser?.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},E,Dt=(E=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,h]of this.nodes)if(h.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},u(E,"WardleyBuilder"),E),k=new Dt;function et(){return V()["wardley-beta"]}u(et,"getConfig");function at(o,r,e,h,a,d,m,C,g){k.addNode({id:o,label:r,x:e,y:h,className:a,labelOffsetX:d,labelOffsetY:m,inertia:C,sourceStrategy:g})}u(at,"addNode");function rt(o,r,e=!1,h,a){k.addLink({source:o,target:r,dashed:e,label:h,flow:a})}u(rt,"addLink");function ot(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}u(ot,"addTrend");function nt(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}u(nt,"addAnnotation");function st(o,r,e){k.addNote({text:o,x:r,y:e})}u(st,"addNote");function it(o,r,e){k.addAccelerator({name:o,x:r,y:e})}u(it,"addAccelerator");function dt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}u(dt,"addDeaccelerator");function lt(o,r){k.setAnnotationsBox(o,r)}u(lt,"setAnnotationsBox");function ct(o,r){k.setSize(o,r)}u(ct,"setSize");function pt(o){k.startPipeline(o)}u(pt,"startPipeline");function ft(o,r){k.addPipelineComponent(o,r)}u(ft,"addPipelineComponent");function ht(o){k.setAxes(o)}u(ht,"updateAxes");function xt(o){return k.getNode(o)}u(xt,"getNode");function gt(o){return k.resolveNodeId(o)}u(gt,"resolveNodeId");function yt(){return k.build()}u(yt,"getWardleyData");function ut(){k.clear(),Ft()}u(ut,"clear");var Gt={getConfig:et,addNode:at,addLink:rt,addTrend:ot,addAnnotation:nt,addNote:st,addAccelerator:it,addDeaccelerator:dt,setAnnotationsBox:lt,setSize:ct,startPipeline:pt,addPipelineComponent:ft,updateAxes:ht,getNode:xt,resolveNodeId:gt,getWardleyData:yt,clear:ut,setAccTitle:Xt,getAccTitle:At,setDiagramTitle:Tt,getDiagramTitle:Lt,getAccDescription:zt,setAccDescription:Nt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{const{themeVariables:o}=V();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=u(()=>{const o=V()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=u((o,r,e,h)=>{Q.debug(`Rendering Wardley map
2
2
  `+o);const a=jt(),d=Ht(),m=a.nodeRadius*1.6,C=h.db,g=C.getWardleyData(),R=C.getDiagramTitle(),S=g.size?.width??a.width,b=g.size?.height??a.height,Y=It(r);Y.selectAll("*").remove(),Bt(Y,b,S,a.useMaxWidth),Y.attr("viewBox",`0 0 ${S} ${b}`);const v=Y.append("g").attr("class","wardley-map"),q=Y.append("defs");q.append("marker").attr("id",`arrow-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${r}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);const I=S-a.padding*2,B=b-a.padding*2;R&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(R);const z=u(t=>a.padding+t/100*I,"projectX"),L=u(t=>b-a.padding-t/100*B,"projectY"),O=v.append("g").attr("class","wardley-axes");O.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const mt=g.axes.xLabel??"Evolution",wt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+I/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(mt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+B/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+B/2})`).text(wt);const F=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:qt;if(F.length>0){const t=v.append("g").attr("class","wardley-stages"),s=g.axes.stageBoundaries,n=[];if(s&&s.length===F.length){let i=0;s.forEach(p=>{n.push({start:i,end:p}),i=p})}else{const i=1/F.length;F.forEach((p,l)=>{n.push({start:l*i,end:(l+1)*i})})}F.forEach((i,p)=>{const l=n[p],f=a.padding+l.start*I,x=a.padding+l.end*I,y=(f+x)/2;p>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){const t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const n=s/4,i=a.padding+I*n;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-B*n).attr("y2",b-a.padding-B*n).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:z(t.x),y:L(t.y),node:t})}),g.pipelines.length>0){const t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(n=>{if(n.componentIds.length===0)return;const i=n.componentIds.map(x=>({id:x,pos:c.get(x),node:g.nodes.find(y=>y.id===x)})).filter(x=>x.pos&&x.node).sort((x,y)=>x.node.x-y.node.x);for(let x=0;x<i.length-1;x++){const y=i[x],w=i[x+1];s.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",y.pos.x).attr("y1",y.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let p=1/0,l=-1/0,f=0;if(n.componentIds.forEach(x=>{const y=c.get(x);y&&(p=Math.min(p,y.x),l=Math.max(l,y.x),f=y.y)}),p!==1/0&&l!==-1/0){const y=a.nodeRadius*4,w=f-y/2,P=c.get(n.nodeId);if(P){const N=(p+l)/2;P.x=N,P.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",w).attr("width",l-p+30).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=v.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||Z.get(t.target)?.has(t.source)));_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.x+l/x*p}).attr("y1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.y+f/x*p}).attr("x2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.x+l/x*p}).attr("y2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.y+f/x*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${r})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${r})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=n.y-s.y,l=n.x-s.x,f=Math.sqrt(l*l+p*p),x=8,y=p/f;return i+y*x}).attr("y",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.y+n.y)/2,p=n.x-s.x,l=n.y-s.y,f=Math.sqrt(p*p+l*l),x=8,y=-p/f;return i+y*x}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=(s.y+n.y)/2,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f),y=8,w=f/x,P=-l/x,N=i+w*y,W=p+P*y;let X=Math.atan2(f,l)*180/Math.PI;return(X>90||X<-90)&&(X+=180),`rotate(${X} ${N} ${W})`}).text(t=>t.label);const kt=v.append("g").attr("class","wardley-trends"),bt=g.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const n=z(t.targetX),i=L(t.targetY),p=n-s.x,l=i-s.y,f=Math.sqrt(p*p+l*l),x=a.nodeRadius+2,y=f>x?n-p/f*x:n,w=f>x?i-l/f*x:i;return{origin:s,targetX:n,targetY:i,adjustedX2:y,adjustedY2:w}}).filter(t=>t!==null);kt.selectAll("line").data(bt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${r})`);const M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const T=M.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let n=t.isPipelineParent?m/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y1",t=>{const s=c.get(t.id),n=t.isPipelineParent?m:a.nodeRadius*2;return s.y-n/2}).attr("x2",t=>{const s=c.get(t.id);let n=t.isPipelineParent?m/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y2",t=>{const s=c.get(t.id),n=t.isPipelineParent?m:a.nodeRadius*2;return s.y+n/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let n=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(n+=10);const i=t.labelOffsetX??n;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let n=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(n-=10);const i=t.labelOffsetY??n;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=v.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(s=>{const n=s.coordinates.map(i=>({x:z(i.x),y:L(i.y)}));if(n.length>1)for(let i=0;i<n.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",n[i].x).attr("y1",n[i].y).attr("x2",n[i+1].x).attr("y2",n[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach(i=>{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),g.annotationsBox){let s=z(g.annotationsBox.x),n=L(g.annotationsBox.y);const i=10,p=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),x=[...g.annotations].filter(w=>w.text).sort((w,P)=>w.number-P.number),y=[];if(x.forEach((w,P)=>{const N=f.append("text").attr("x",s+i).attr("y",n+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);y.push(N)}),y.length>0){let w=0,P=0;y.forEach(j=>{const D=j.node(),Ct=D.getComputedTextLength();w=Math.max(w,Ct);const St=D.getBBox();P=Math.max(P,St.height)});const N=w+i*2+105,W=x.length*p+i*2+P/2,X=a.padding,$t=S-a.padding-N,vt=a.padding,Pt=b-a.padding-W;s=Math.max(X,Math.min(s,$t)),n=Math.max(vt,Math.min(n,Pt)),y.forEach((j,D)=>{j.attr("x",s+i).attr("y",n+i+(D+1)*p)}),f.insert("rect","text").attr("x",s).attr("y",n).attr("width",N).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=v.append("g").attr("class","wardley-notes");g.notes.forEach(s=>{const n=z(s.x),i=L(s.y);t.append("text").attr("x",n).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(g.accelerators.length>0){const t=v.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(s=>{const n=z(s.x),i=L(s.y),p=60,l=30,f=20,x=`
3
3
  M ${n} ${i-l/2}
4
4
  L ${n+p-f} ${i-l/2}
@@ -1,4 +1,4 @@
1
- import{c as ct}from"./uuid-BmNSYLtZ.js";import{ax as Wo,am as Ko,eM as Tt,eN as Qo,m as Ce,ap as Yo,o as s,J as oe,K as be,p as Ve,N as C,n as u,a6 as Se,L as d,Y as f,Z as le,a8 as Et,d5 as _n,k as X,cO as Jo,B as Xo,f as K,aF as Zo,au as ea,eO as ta,eP as na,eQ as jt,eR as no,t as l,A as st,eS as oa,af as mt,e as Xe,eT as aa,w as Ae,ab as Me,eU as ia,M as He,co as oo,eV as sn,eW as ra,eX as Oe,eY as sa,eZ as la,e_ as bn,r as ao,cp as ca,cz as io,aK as ln,T as dt,ac as Ke,a1 as Ge,X as I,a5 as yn,q as ne,V as ke,H as re,at as ro,_ as Ee,d0 as da,$ as Ue,e$ as kn,Q as Cn,f0 as ua,e0 as fa,a0 as Lt,dP as ma,as as gt,a3 as xe,aw as wn,e2 as ga,f1 as va,l as En,c9 as pa,a4 as In,bx as Qe,aY as ha}from"./index-HcLGmFz6.js";import{l as xn,i as _a,r as ba,a as ya,C as Sn,b as Tn,c as An,m as ka,d as Rn,e as St,f as _e,g as Ca,h as wa,j as Ea,k as Pn,n as Ht,o as Ia,p as xa}from"./conversation-history-CKIYKBne.js";import{E as Sa}from"./message-box-service-BMjc6Na7.js";import{A as $n,r as Ta,g as so,E as lo,e as co,M as Aa,H as Dn,t as Ra,B as Ln,p as Pa,h as At,n as xt,o as cn,q as Mn,F as $a}from"./FilePreviewLoading-C1U4PIWp.js";import{e as uo}from"./error-presentation-CSmvVKzH.js";import{a as Ze,E as fo}from"./el-input-CmMxlyJC.js";import{M as ye}from"./MarIcon-DZpYRja5.js";import{B as lt}from"./BusyIndicator-MYxuzJwk.js";import{o as mo,a as Da,E as La}from"./el-checkbox-B99Su3CQ.js";import{a as Ma,E as Oa}from"./el-radio-D1gLKQQQ.js";/* empty css */import{E as Na}from"./el-scrollbar-BygTOJ7z.js";import{f as it,p as qt}from"./time-presentation-qi0uJ1fq.js";/* empty css */import{C as ja,E as qa,b as Ua,a as Ba}from"./el-select-BLDSb9Md.js";/* empty css */import{E as go,u as Jt,m as Xt}from"./mobile-dialog-return-service-B05lwAuG.js";import{l as On,r as Nn}from"./runner-presentation-KywUJ5TY.js";const Fa=Ko({...mo(Tt,["ariaLabel","gpuAcceleration","rawContent"]),placement:$n.placement,tabindex:$n.tabindex,effect:{...Tt.effect,default:"light"},title:String,width:{type:[String,Number],default:150},offset:{...Tt.offset,default:void 0},persistent:{...Tt.persistent,default:!0}}),Ha={"update:visible":e=>Wo(e),"before-enter":()=>!0,"before-leave":()=>!0,"after-enter":()=>!0,"after-leave":()=>!0};({...mo(Qo,["gpuAcceleration"])});var za=Ce({name:"ElPopover",__name:"popover",props:Fa,emits:Ha,setup(e,{expose:t,emit:n}){const o=e,a=n,r=X(()=>{const D=_n.props;return Jo(o,Xo(D)?D:Object.keys(D))}),i=Yo("popover"),c=K(),m=X(()=>d(c)?.popperRef),p=X(()=>[{width:Zo(o.width)},o.popperStyle]),v=X(()=>[i.b(),o.popperClass,{[i.m("plain")]:!!o.content}]),g=X(()=>o.transition===`${i.namespace.value}-fade-in-linear`),b=()=>{c.value?.hide()},w=()=>{a("before-enter")},O=()=>{a("before-leave")},R=()=>{a("after-enter")},$=()=>{a("update:visible",!1),a("after-leave")};return t({popperRef:m,hide:b}),(D,M)=>(s(),oe(d(_n),Et({ref_key:"tooltipRef",ref:c},r.value,{"aria-label":e.title,"popper-class":v.value,"popper-style":p.value,"gpu-acceleration":g.value,onBeforeShow:w,onBeforeHide:O,onShow:R,onHide:$}),{content:be(()=>[e.title?(s(),u("div",{key:0,class:Se(d(i).e("title")),role:"title"},f(e.title),3)):C("v-if",!0),Ve(D.$slots,"default",{hide:b},()=>[le(f(e.content),1)])]),default:be(()=>[D.$slots.reference?Ve(D.$slots,"reference",{key:0}):C("v-if",!0)]),_:3},16,["aria-label","popper-class","popper-style","gpu-acceleration"]))}}),Ga=za;const jn=(e,t)=>{const n=(t.arg||t.value)?.popperRef;n&&(n.triggerRef=e)};var Va={mounted(e,t){jn(e,t)},updated(e,t){jn(e,t)}};const Wa="popover",Ka=ta(Va,Wa),vo=ea(Ga,{directive:Ka});function kp(e,t,n,o=ct()){const a=na.parse({...t,id:o}),r=[...e,a],i=jt("mar_references",{references:r});if(n.length+i.length+1>no)throw new Error("COMPOSER_TAG_INVALID");return r}function Zt(e){const t=e.customTitle?.trim();if(t)return t;const n=e.runnerTitle?.trim();return n===void 0||n===""||n==="Untitled session"||n.toLocaleLowerCase()==="new session"?l("generated.sessionPresentation.newSession"):n}function po(e){return typeof e?.externalSessionId=="string"&&e.externalSessionId.length>0}function Cp(e){return!po(e)}function wp(e){return e.trim().replace(/\s+/g," ").slice(0,160)}function ho(e){return e.activity!==void 0?e.activity:"IDLE"}function Ep(e){return{RUNNING:l("generated.sessionPresentation.running"),IDLE:l("generated.sessionPresentation.ready")}[ho(e)]}function Qa(e){return{STARTING:l("generated.sessionPresentation.starting"),RUNNING:l("generated.sessionPresentation.running2"),SUCCEEDED:l("generated.sessionPresentation.completed"),FAILED:l("generated.sessionPresentation.failed"),CANCELLED:l("generated.sessionPresentation.cancelled"),INTERRUPTED:l("generated.sessionPresentation.interrupted"),LOST:l("generated.sessionPresentation.connectionLost")}[e]??e}const Ya=new Set(["PREPARING","RUNNING","WAITING_INPUT","WAITING_APPROVAL","SUCCEEDED","FAILED","CANCELLED","INTERRUPTED","LOST"]);function qn(e){return e==null||typeof e=="number"&&Number.isInteger(e)&&e>=0}function Ja(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.id=="string"&&t.id.length>0&&typeof t.kind=="string"&&t.kind.length>0&&typeof t.status=="string"&&t.status.length>0}function dn(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.id=="string"&&t.id.length>0&&typeof t.turnId=="string"&&t.turnId.length>0&&typeof t.sessionId=="string"&&t.sessionId.length>0&&(t.runId===null||typeof t.runId=="string"&&t.runId.length>0)&&typeof t.index=="number"&&Number.isInteger(t.index)&&t.index>=0&&typeof t.status=="string"&&Ya.has(t.status)&&Array.isArray(t.items)&&t.items.every(Ja)&&qn(t.startedAt)&&qn(t.completedAt)}function _o(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return;const n=e;if(!(n.unit!=="SEGMENT"||!Array.isArray(n.segments)||!n.segments.every(dn)||new Set(n.segments.map(a=>a.sessionId)).size>1))return ft({unit:"SEGMENT",segments:n.segments,nextCursor:typeof n.nextCursor=="string"?n.nextCursor:null,...typeof n.snapshotSequence=="number"?{snapshotSequence:n.snapshotSequence}:t===void 0?{}:{snapshotSequence:t},...n.source==="official"||n.source==="native"||n.source==="runtime"?{source:n.source}:{},...typeof n.readAt=="number"?{readAt:n.readAt}:{},...typeof n.latestVisibleAt=="number"?{latestVisibleAt:n.latestVisibleAt}:{},...n.deferredOlderHistory===!0?{deferredOlderHistory:!0}:{}})}function ft(e){if(!Array.isArray(e.segments))throw new Error("The conversation history response contains no segments.");const t=e;if(!t.segments.every(dn))throw new Error("The conversation Segment response contains an invalid Segment.");return{...t,turns:t.segments.map(n=>({id:n.id,turnId:n.turnId,segmentIndex:n.index,sessionId:n.sessionId,runId:n.runId,status:n.status,...n.rewind===void 0?{}:{rewind:n.rewind},items:n.items,...n.startedAt===void 0?{}:{startedAt:n.startedAt},...n.completedAt===void 0?{}:{completedAt:n.completedAt}}))}}function zt(e,t){const n=[...e];for(const[o,a]of t.entries()){const r=n.findIndex(c=>c.id===a.id);if(r>=0){const c=n[r],m=a.rewind??(c.sessionId===a.sessionId?c.rewind:void 0);n.splice(r,1,m===void 0?a:{...a,rewind:m});continue}if(a.turnId!==void 0&&a.segmentIndex!==void 0){const c=n.findIndex(p=>p.turnId===a.turnId&&p.segmentIndex!==void 0&&p.segmentIndex>a.segmentIndex),m=n.findLastIndex(p=>p.turnId===a.turnId);if(c>=0||m>=0){n.splice(c>=0?c:m+1,0,a);continue}}const i=t.slice(o+1).find(c=>n.some(m=>m.id===c.id));if(i!==void 0){n.splice(n.findIndex(c=>c.id===i.id),0,a);continue}n.push(a)}return n}function bo(e,t,n){const o=e.findLastIndex(i=>i.runId===t&&(n===void 0||(i.turnId??i.id)===n));if(o<0)return-1;const a=e[o].turnId??e[o].id;let r=o;for(const[i,c]of e.entries())c.runId===t&&(c.turnId??c.id)===a&&(c.segmentIndex??-1)>(e[r].segmentIndex??-1)&&(r=i);return r}function Xa(e,t,n){const o=bo(e,t);return e.map((a,r)=>r===o&&a.status!==n?{...a,status:n}:a)}function Za(e){let t,n,o,a,r,i=0,c=!1,m=!1,p=0;function v(){t!==void 0&&clearTimeout(t),o?.abort(new st("WATCH_CANCELLED","The watch was stopped or replaced.")),t=void 0,o=void 0,n=void 0,a=void 0,r=void 0,i=0,c=!1,m=!1,p=0}function g(){t!==void 0&&clearTimeout(t),t=void 0,c=!0}async function b(D,M,_){const E=setTimeout(()=>_.abort(new st("WATCH_REQUEST_TIMEOUT","The watch request timed out.")),e.requestTimeoutMs);try{if(await e.renew(D,_.signal,M),o!==_||a!==D)return;r=Date.now(),i=0,m=!1,p=0}catch(y){if(o!==_||a!==D)return;const x=_.signal.aborted&&y instanceof Error&&y.name==="AbortError"?_.signal.reason:y;if(e.recovery!==void 0&&(M==="renew"||m)){e.recovery.onFailure(x),M==="initial"&&(p+=1),!c&&e.recovery.retryable(x)&&p<e.maxFailures?m=!0:(g(),e.onExpired());return}if(M==="initial")throw c=!0,i=0,r=void 0,x;i+=1;const N=r!==void 0&&Date.now()-r>=e.confirmationTimeoutMs;(i>=e.maxFailures||N)&&(e.onExpired(),i=0,r=void 0)}finally{clearTimeout(E)}}function w(D,M){if(c||n!==void 0||a!==D||!e.eligible(D))return n;const _=new AbortController;o=_;const E=b(D,M,_).finally(()=>{n===E&&(n=void 0,o=void 0,O(D))});return n=E,E}function O(D){t!==void 0&&clearTimeout(t),!(c||a!==D)&&(t=setTimeout(()=>{t=void 0,w(D,m?"initial":"renew")?.catch(()=>{})},e.heartbeatMs))}function R(D,M=!1){if(!e.eligible(D)){v();return}if(a===D){if(n!==void 0)return n;if(t!==void 0)return}if(v(),c=!1,a=D,!M)return w(D,"initial");O(D)}function $(D){a===D&&(r=Date.now(),i=0)}return{start:R,pause:g,stop:v,confirm:$,isWatching:D=>a===D}}function Ip(e){const t=()=>e.workbenchConnectionId===void 0?"local-test-connection":e.workbenchConnectionId(),n=()=>e.position==="secondary"?e.enabled?.()===!0:e.enabled?.()!==!1;let o,a,r,i,c,m;const p=mt();let v,g=0,b;function w(h=new st("WATCH_CANCELLED","The watch was stopped or replaced.")){const A=b;A!==void 0&&(b=void 0,A.removeAbortListener(),A.reject(h))}function O(h,A,U){return w(),new Promise((z,Z)=>{const F=()=>{b?.watchId===A&&w(U?.reason instanceof Error?U.reason:new st("WATCH_CANCELLED","The watch was stopped or replaced."))};U?.addEventListener("abort",F,{once:!0}),b={sessionId:h,watchId:A,resolve:z,reject:Z,removeAbortListener:()=>U?.removeEventListener("abort",F),events:[]},U?.aborted===!0&&F()})}function R(h){return n()&&e.selectedSessionId.value===h&&D(h)}function $(h){return D(h.id)}function D(h){return!h.startsWith("draft:")&&(typeof document>"u"||document.visibilityState==="visible")}async function M(h,A,U="renew"){if(!n())return;const z=e.workspaceTarget.value?.nodeId,Z=e.workspaceTarget.value?.workspaceId,F=t();if(z===void 0||Z===void 0||F===void 0||e.selectedSessionId.value!==h)return;U==="initial"?(p.value=void 0,o=ct().replace(/-/g,""),m=void 0,a=h,r=z,i=Z):o??=ct().replace(/-/g,"");const q=o,ee=U==="initial"?O(h,q,A):void 0;ee?.catch(()=>{});let se=!1,pe;try{if(pe=await e.request(`/api/agent-sessions/${e.sessionPathId(h)}/watch`,{method:"POST",body:JSON.stringify({nodeId:z,workspaceId:Z,workbenchConnectionId:F,watchId:q,mode:U,...e.position===void 0?{}:{position:e.position},unit:"SEGMENT"}),...A===void 0?{}:{signal:A}}),se=!0,e.workspaceTarget.value?.nodeId!==z||e.workspaceTarget.value?.workspaceId!==Z||e.selectedSessionId.value!==h||t()!==F||o!==q){b?.watchId===q&&w(),await ee?.catch(()=>{});return}typeof pe?.nodeGeneration=="string"&&a===h&&(m=pe.nodeGeneration),await ee}catch(me){throw b?.watchId===q&&w(),await ee?.catch(()=>{}),se&&Xe(me)==="WATCH_REQUEST_TIMEOUT"?new st("SESSION_WATCH_SNAPSHOT_TIMEOUT","The initial session snapshot did not arrive before the watch deadline."):me}}const _=Za({heartbeatMs:e.heartbeatMs,requestTimeoutMs:e.requestTimeoutMs,confirmationTimeoutMs:e.confirmationTimeoutMs,maxFailures:3,eligible:R,renew:(h,A,U)=>M(h,A,U),onExpired:e.refreshSnapshot});function E(h,A={}){if(!n())return;const U=t();if(a===h&&c!==U)return x(h,A.preserveFailures!==!0);a!==h&&(o=ct().replace(/-/g,""),m=void 0,A.preserveFailures!==!0&&(g=0),a=h,r=e.workspaceTarget.value?.nodeId,i=e.workspaceTarget.value?.workspaceId,c=U);const z=_.start(h,A.skipImmediateRenew===!0),Z=o,F=z?.then(()=>{if(o!==Z||t()!==U)throw new st("WATCH_CANCELLED","The watch was stopped or replaced.")});return F?.catch(()=>{}),F}function y(){p.value=void 0,w();const h=a,A=o,U=r,z=i,Z=c;a=void 0,r=void 0,i=void 0,c=void 0,o=void 0,m=void 0,g=0,v!==void 0&&clearTimeout(v),v=void 0,_.stop(),!(h===void 0||A===void 0||U===void 0||z===void 0||Z===void 0)&&e.request(`/api/agent-sessions/${e.sessionPathId(h)}/watch`,{method:"DELETE",body:JSON.stringify({nodeId:U,workspaceId:z,workbenchConnectionId:Z,watchId:A,...e.position===void 0?{}:{position:e.position}})}).catch(()=>{})}function x(h,A=!0){return p.value=void 0,v!==void 0&&clearTimeout(v),v=void 0,w(),_.stop(),a=void 0,r=void 0,i=void 0,c=void 0,o=void 0,m=void 0,A&&(g=0),E(h,{preserveFailures:!A})}function N(h){return x(h)??Promise.resolve()}function B(){v!==void 0&&clearTimeout(v),v=void 0,_.pause()}function T(h){if(typeof h!="object"||h===null)return!1;const A=h;if(A.type!=="watch.session.snapshot"&&A.type!=="watch.session.event"||A.workbenchConnectionId!==t()||A.nodeId!==e.workspaceTarget.value?.nodeId||A.workspaceId!==i||A.sessionId!==a||o===void 0||A.watchId!==o||typeof A.nodeGeneration!="string"||m!==void 0&&A.nodeGeneration!==m)return!1;m??=A.nodeGeneration,g=0;const U=a;if(U===void 0)return!1;if(A.type==="watch.session.event"){const ee=A.event;if(ee!==void 0&&typeof ee.sequence=="number"&&["node","session","conversation","run","queue","workspace"].includes(String(ee.category))&&"payload"in ee){const se={nodeId:A.nodeId,sequence:ee.sequence,category:ee.category,payload:ee.payload};b?.sessionId===U&&b.watchId===o?b.events.push(se):e.applyEvent?.(se)}return!0}if(A.payload===void 0)return!1;const z=A.payload,Z=z.kind==="session-watch-snapshot"&&typeof z.sequence=="number"&&typeof z.session=="object"&&z.session!==null&&Array.isArray(z.runs)?z:void 0;if(Z!==void 0){e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"session",payload:{session:Z.session}});const ee=Z.runs;if(e.applyRunsSnapshot!==void 0)e.applyRunsSnapshot(ee);else for(const se of ee)e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"run",payload:{run:se}});typeof Z.queue=="object"&&Z.queue!==null&&e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"queue",payload:{sessionId:U,queue:Z.queue}},"initial"),"context"in Z&&e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"session",payload:{sessionId:U,context:Z.context}}),Z.performance!==void 0&&e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"conversation",payload:{sessionId:U,performance:Z.performance}})}const F=Z?.conversation??A.payload,q=_o(F)??ft(F);if(b?.sessionId===U&&b.watchId===o){const ee=b;b=void 0,ee.removeAbortListener(),e.applySnapshot(U,q,A.historyReset===!0?"reset":"initial"),p.value={watchId:ee.watchId,nodeId:A.nodeId,workspaceId:A.workspaceId,sessionId:U,connectionId:A.workbenchConnectionId};const se=typeof Z?.sequence=="number"?Z.sequence:q.snapshotSequence;for(const pe of ee.events){const me=pe.category==="conversation"?q.snapshotSequence??se:se;me!==void 0&&pe.sequence<=me||e.applyEvent?.(pe)}return ee.resolve(),!0}return Promise.resolve(e.applySnapshot(U,q,A.historyReset===!0?"reset":"refresh")).then(ee=>{if(ee&&e.followConversation.value)return e.scrollAfterLayout()}),!0}function W(h){if(h.type!=="watch.failed"||h.watchType!=="session"||h.watchId!==o||h.workbenchConnectionId!==t()||h.sessionId!==a||h.nodeId!==e.workspaceTarget.value?.nodeId||h.workspaceId!==i||typeof h.nodeGeneration!="string"||m!==void 0&&h.nodeGeneration!==m)return!1;m??=h.nodeGeneration;const A=a;return A===void 0?!0:b?.sessionId===A&&b.watchId===o?(w(new st(oa(h.code)?h.code:"SESSION_HISTORY_INITIAL_FAILED",typeof h.message=="string"&&h.message.length>0&&h.message.length<=1e3?h.message:"Unable to load the initial session snapshot.")),_.pause(),!0):g>=3?(y(),e.refreshSnapshot(),!0):(g+=1,_.pause(),v=setTimeout(()=>{v=void 0,e.selectedSessionId.value===A&&x(A,!1)},Math.min(e.heartbeatMs,1e3*2**(g-1))),!0)}function S(){document.visibilityState!=="visible"&&y()}function G(h,A){h!==void 0&&A!==void 0&&h.id===e.selectedSessionId.value&&ho(h)==="RUNNING"&&A.id===h.id&&$(A)&&E(A.id)}return{hasInitialSessionSnapshot:h=>p.value!==void 0&&p.value.watchId===o&&p.value.nodeId===e.workspaceTarget.value?.nodeId&&p.value.workspaceId===e.workspaceTarget.value?.workspaceId&&p.value.sessionId===h&&e.selectedSessionId.value===h&&p.value.connectionId===t(),canWatchSessionHistory:h=>n()&&$(h),initializeSelectedSessionWatch:N,beginSelectedSessionWatch:E,restartSelectedSessionWatch:x,pauseSelectedSessionWatch:B,stopSelectedSessionWatch:y,reconcileWorkspaceSnapshot:G,handleEvent(h){return typeof h!="object"||h===null?!1:W(h)||T(h)},handleSessionWatchVisibility:S}}const ei=new TextEncoder;function Ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function en(e,t){if(e===t)return!0;if(Array.isArray(e))return Array.isArray(t)&&e.length===t.length&&e.every((a,r)=>en(a,t[r]));if(!Ut(e)||!Ut(t))return!1;const n=Object.keys(e).filter(a=>e[a]!==void 0),o=Object.keys(t).filter(a=>t[a]!==void 0);return n.length===o.length&&n.every(a=>Object.hasOwn(t,a)&&en(e[a],t[a]))}function ti(e){const t=mt([]),n=K(null),o=ni({...e,turns:t,nextCursor:n});return{turns:t,nextCursor:n,projection:o}}function ni(e){const t=new Map,n=new Map,o=new Map;let a=0,r=0;const i=new Map;let c,m=!1;const p=e.scheduleTextDeltaFlush??(j=>{if(typeof requestAnimationFrame=="function"){const Q=requestAnimationFrame(j);return()=>cancelAnimationFrame(Q)}return queueMicrotask(j),()=>{}}),v=j=>`${j.sessionId}:${j.id}`,g=(j,Q)=>`${v(j)}:${Q}`;function b(j,Q){if(Q.length<j.length){const te=new Set(Q.map(ce=>v(ce))),ve=new Set(Q.map(ce=>ce.runId));for(const ce of j){if(te.has(v(ce)))continue;t.delete(v(ce));const ue=`${v(ce)}:`;for(const L of n.keys())L.startsWith(ue)&&n.delete(L);St(ce)&&!ve.has(ce.runId)&&o.delete(ce.runId)}}}function w(j){b(e.turns.value,j),e.turns.value=[...j]}function O(){w(e.limitHistory(e.turns.value))}function R(){return e.turns.value.length<=Sn?!1:(w(Tn(e.turns.value,Rn)),e.nextCursor.value=null,!0)}function $(){ee(),n.clear(),t.clear(),o.clear(),r=0,a=0}function D(j){$()}function M(j,Q){$(),e.turns.value=[...j],e.nextCursor.value=Q}function _(j){const Q=new Set(e.turns.value.map(te=>te.id));e.turns.value=e.limitHistory([...j.turns.filter(te=>!Q.has(te.id)),...e.turns.value]),e.nextCursor.value=j.nextCursor}function E(j){e.turns.value=e.limitHistory(zt(e.turns.value,j.turns)),e.nextCursor.value=j.nextCursor}function y(){e.nextCursor.value=null}function x(j,Q){e.turns.value=Xa(e.turns.value,j,Q)}function N(j){let Q=!1;const te=e.turns.value.map(ve=>{if(!T(ve,j))return ve;let ce=!1;const ue=ve.items.map(L=>L.id!==j||L.kind!=="user_message"||!Ut(L.payload)||L.payload.clientMessageId!==j?L:(ce=!0,Q=!0,{...L,payload:{...L.payload,delivery:"ACCEPTED"}}));return ce?{...ve,items:ue}:ve});return Q&&(e.turns.value=te),Q}function B(j){const Q=e.turns.value.filter(te=>!T(te,j));return Q.length===e.turns.value.length?!1:(e.turns.value=Q,!0)}function T(j,Q){return j.id===Q&&j.runId===null&&j.items.some(te=>te.id===Q&&te.kind==="user_message"&&Ut(te.payload)&&te.payload.clientMessageId===Q)}function W(j,Q){F();const te=`${j}:`;for(const ve of t.keys())ve.startsWith(te)&&t.delete(ve);for(const ve of n.keys())ve.startsWith(te)&&n.delete(ve);for(const ve of Q)o.delete(ve)}function S(j,Q){if(Q===void 0)return;a=Math.max(a,Q);const te=v(j);t.set(te,Math.max(t.get(te)??0,Q))}function G(j,Q){return bo(e.turns.value,j,Q)}function h(j,Q){return Q!==void 0&&Q<=(o.get(j)??-1)}function A(j,Q){const te=typeof Q.segmentId=="string"?Q.segmentId:void 0,ve=typeof Q.turnId=="string"?Q.turnId:void 0;if(te===void 0){if(typeof Q.itemId=="string"){const he=e.turns.value.findIndex(Te=>Te.runId===j&&(ve===void 0||(Te.turnId??Te.id)===ve)&&Te.items.some(De=>De.id===Q.itemId));if(he>=0)return he}return G(j,ve)}const ce=e.turns.value.findIndex(he=>he.id===te&&(he.runId===j||he.runId===null));if(ce>=0)return e.turns.value[ce].runId===null&&(e.turns.value=e.turns.value.map((he,Te)=>Te===ce?{...he,runId:j}:he)),ce;if(ve===void 0||typeof Q.segmentIndex!="number"||!Number.isInteger(Q.segmentIndex)||Q.segmentIndex<0)return-1;F();const ue=G(j,ve),L=ue>=0?ue:e.turns.value.findLastIndex(he=>he.turnId===ve&&he.runId===null),H=e.turns.value[L];if(H===void 0)return-1;const Y=Q.segmentIndex;if(Y<=(H.segmentIndex??-1))return-1;const we={...H,id:te,turnId:ve,runId:j,segmentIndex:Y,items:[],startedAt:null,completedAt:null};return e.turns.value=zt(e.turns.value,[{...H,status:"SUCCEEDED"},we]),R()&&e.onRecentWindowOverflow(),e.turns.value.findIndex(he=>he.id===te&&he.runId===j)}function U(j,Q,te){if(h(j,te))return;const ve=A(j,Q),ce=e.turns.value[ve];if(ce===void 0||oi(ce.status))return;const ue=typeof Q.itemId=="string"?Q.itemId:void 0,L=ue===void 0?void 0:ce.items.find(H=>H.id===ue&&H.kind==="assistant_message");if(!(L!==void 0&&Pt(L.status))&&!(ue!==void 0&&te!==void 0&&te<=(n.get(g(ce,ue))??-1)))return{turnIndex:ve,turn:ce}}function z(j,Q,te,ve=Date.now()){F();const ce=_e(Q);if(ce===void 0)return!1;const{itemId:ue,kind:L,status:H}=ce;if(typeof ue!="string"||typeof L!="string"||typeof H!="string"||h(j,te))return!1;const Y=A(j,ce);if(Y<0)return!1;const we=e.turns.value[Y],he=we.items.findIndex(ae=>ae.id===ue),Te=he<0?void 0:we.items[he],De=g(we,ue);if(te!==void 0&&te<=(n.get(De)??Number.NEGATIVE_INFINITY)||Te!==void 0&&Pt(Te.status)&&!Pt(H))return!1;const Ie=Rt(ve)?ve:Date.now(),$e=we.items.at(-1),je=we.items.map(ae=>ae.id===$e?.id&&ae.kind==="assistant_message"&&ae.status==="IN_PROGRESS"?{...ae,status:"COMPLETED",completedAt:Ie}:ae),fe=Rt(ce.startedAt)?ce.startedAt:Te?.startedAt??Ie,k=ce.completedAt===null?null:Rt(ce.completedAt)?ce.completedAt:Pt(H)?Te?.completedAt??Ie:Te?.completedAt??null,P={id:ue,kind:L,status:H,...ce.processGroup===void 0?{}:{processGroup:aa.parse(ce.processGroup)},...typeof ce.parentItemId=="string"?{parentItemId:ce.parentItemId}:{},startedAt:fe,completedAt:k,payload:An(ce.merge===!0&&Te!==void 0?ka(Te.payload,ce.payload,ce.append):ce.payload)};return he<0?je.push(P):je.splice(he,1,P),e.turns.value=e.turns.value.map((ae,Re)=>Re===Y?{...ae,items:je,startedAt:ae.startedAt??P.startedAt}:ae),te!==void 0&&n.set(De,te),S(we,te),O(),!0}function Z(j,Q,te,ve=Date.now()){const ce=_e(Q),ue=ce?.text;if(typeof ue!="string"||ue.length===0||ce===void 0)return!1;const L=U(j,ce,te);if(L===void 0)return!1;const{turnIndex:H,turn:Y}=L,we=typeof ce?.itemId=="string"?ce.itemId:void 0,he=Y.items.at(-1),Te=we===void 0&&he?.kind==="assistant_message"&&he.status==="IN_PROGRESS",De=we===void 0?Te?Y.items.length-1:-1:Y.items.findIndex(Re=>Re.id===we&&Re.kind==="assistant_message"),Ie=De>=0?Y.items[De].id:we??`${j}:assistant:${te??"live"}`,$e=De<0?void 0:Y.items[De],je=g(Y,Ie);if(te!==void 0&&te<=(n.get(je)??Number.NEGATIVE_INFINITY))return!1;const fe=_e($e?.payload),k=`${typeof fe?.text=="string"?fe.text:""}${ue}`,P={id:Ie,kind:"assistant_message",status:"IN_PROGRESS",startedAt:$e?.startedAt??(Rt(ve)?ve:Date.now()),completedAt:null,payload:{...fe??{},...An({text:k}),format:"markdown",model:null}},ae=[...Y.items];return De<0?ae.push(P):ae.splice(De,1,P),e.turns.value=e.turns.value.map((Re,Fe)=>Fe===H?{...Re,items:ae,startedAt:Re.startedAt??P.startedAt}:Re),te!==void 0&&n.set(je,te),r+=ei.encode(ue).byteLength,r>=64*1024?(S(Y,te),O(),r=0,!0):(S(Y,te),!0)}function F(){c?.(),c=void 0,m=!1,q()}function q(){if(i.size===0)return;const j=[...i.values()];i.clear();for(const Q of j)Z(Q.runId,Q,Q.sequence,Q.createdAt)}function ee(){c?.(),c=void 0,m=!1,i.clear()}function se(j,Q,te,ve=Date.now()){const ce=_e(Q),ue=ce?.text;if(typeof ue!="string"||ue.length===0)return!1;const L=ce!==void 0&&typeof ce.itemId=="string"?ce.itemId:void 0;if(ce===void 0)return!1;const H=U(j,ce,te);if(H===void 0)return!1;const Y=H.turn,we=`${j}\0${Y.id}\0${L??""}`,he=i.get(we);if(he!==void 0&&te!==void 0&&te<=(he.sequence??-1))return!1;if(he===void 0?i.set(we,{runId:j,...L===void 0?{}:{itemId:L},turnId:Y.turnId??Y.id,...Y.segmentIndex===void 0?{}:{segmentId:Y.id,segmentIndex:Y.segmentIndex},text:ue,chunks:[{text:ue,sequence:te}],...te===void 0?{}:{sequence:te},createdAt:ve}):(he.text+=ue,he.chunks.push({text:ue,sequence:te}),te!==void 0&&(he.sequence=te)),!m){m=!0;const Te=p(()=>{m=!1,c=void 0,q()});m?c=Te:Te()}return!0}function pe(j,Q){S(j,Q),!(!St(j)||Q===void 0)&&o.set(j.runId,Math.max(o.get(j.runId)??0,Q))}function me(j){return j.snapshotSequence!==void 0&&j.snapshotSequence<a}function ge(j){if(F(),me(j))return!1;const Q=e.turns.value,ve=j.turns.map(xn),ce=new Map(Q.map(Ie=>[Ie.id,Ie])),ue=ve.map(Ie=>{const $e=ce.get(Ie.id);if($e===void 0)return S(Ie,j.snapshotSequence),Ie;const je=t.get(v(Ie));if(je!==void 0&&j.snapshotSequence!==void 0&&je>j.snapshotSequence)return $e;S(Ie,j.snapshotSequence);const fe=$e.items.filter(_a);return fe.length===0?Ie:{...Ie,items:ba(Ie.items,$e.items,fe)}}),L=ya(zt(Q,ue)),H=Q.at(-1)?.id,Y=L.findIndex(Ie=>Ie.id===H),he=L.slice(Y+1).some(Ie=>!ce.has(Ie.id))&&L.length>Sn,Te=e.limitHistory(he?Tn(L,Rn):L).map(Ie=>{const $e=ce.get(Ie.id);return $e!==void 0&&en($e,Ie)?$e:Ie}),De=Q.length!==Te.length||Q.some((Ie,$e)=>Ie!==Te[$e]);return b(L,Te),he&&(e.nextCursor.value=null),!he&&e.nextCursor.value===null&&j.nextCursor!==null&&Te[0]?.id===j.turns[0]?.id&&(e.nextCursor.value=j.nextCursor),De&&(e.turns.value=Te),he&&e.onRecentWindowOverflow(),De}function J(j){return F(),me(j)?!1:(V(j),!0)}function V(j){const Q=j.turns.map(xn),te=[...i.values()];$(),e.turns.value=e.limitHistory(Q),e.nextCursor.value=j.nextCursor,a=j.snapshotSequence??0;for(const ve of e.turns.value)pe(ve,j.snapshotSequence);for(const ve of te){const ce=j.snapshotSequence;if(ce===void 0)continue;const ue=ve.chunks.filter(L=>L.sequence!==void 0&&L.sequence>ce);ue.length!==0&&Z(ve.runId,{...ve,text:ue.map(L=>L.text).join("")},ue.at(-1).sequence,ve.createdAt)}}function ie(j){return F(),me(j)?!1:(V(j),!0)}return{resetHistory:$,restore:D,restoreWindow:M,mergeOlderPage:_,recoverWindow:E,clearCursor:y,syncRunStatus:x,updateOptimisticUserMessage:N,removeOptimisticUserMessage:B,clearSession:W,markLive:S,mergeItem:z,mergeTextDelta:se,flushPendingTextDeltas:F,mergeLatest:ge,replaceRecent:J,replaceAuthoritative:ie}}function Rt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Pt(e){return["COMPLETED","FAILED","DECLINED","CANCELLED","INTERRUPTED"].includes(e)}function oi(e){return["SUCCEEDED","FAILED","CANCELLED","INTERRUPTED","LOST"].includes(e)}function yo(e){const t=tn(e);return t?.kind==="context_compaction"&&t.status==="COMPLETED"}function ai(e){const t=tn(e),n=tn(t?.payload);return yo(e)&&n?.retainedContext===!0}function xp(e,t){return yo(e)?ai(e)?null:t==null?t:{...t,usedTokens:0,percentage:0,...t.gcCount===void 0?{}:{gcCount:0},...t.gcCount===void 0&&t.gcReclaimedTokens===void 0?{}:{gcReclaimedTokens:0}}:t}function Sp(e){const{turns:t,nextCursor:n,projection:o}=ti({onRecentWindowOverflow:e,limitHistory:Ca});let a=0,r;const i=K(0);function c(){r!==void 0&&(clearTimeout(r.timer),r.resolve(),r=void 0)}function m(){c(),i.value+=1;const v=i.value;return new Promise(g=>{const b=setTimeout(()=>{r?.version===v&&(r=void 0,g())},1e4);r={version:v,resolve:g,timer:b}})}function p(v){r?.version===v&&c()}return{turns:t,nextCursor:n,projection:o,loadingInitial:K(!1),initialLoadFailed:K(!1),initialFailureCause:mt(),loadingOlder:K(!1),channelInput:K(""),channelToken:K(),contextUsage:K(),initialRenderVersion:i,beginInitialRender:m,confirmInitialRender:p,cancelInitialRender:c,nextDetailRequest:()=>++a,currentDetailRequest:()=>a}}function tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function ii(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"&&typeof e.sessionId=="string"&&typeof e.status=="string"}function ri(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"&&typeof e.workspaceId=="string"&&(e.runner==="codex"||e.runner==="claude-code"||e.runner==="opencode"||e.runner==="mar-agent")&&!e.id.startsWith("draft:")}function Tp(e){function t(a,r){const i=e.setNodeConnection?.(a,r);r&&i===!1&&e.onNodeConnected(a)}function n(a,r="event"){const i=_e(a.payload);if(a.category==="node"&&typeof i?.connected=="boolean"){t(a.nodeId,i.connected);return}if(a.category==="workspace"&&i!==void 0){typeof i.workspaceId=="string"&&typeof i.topic=="string"&&e.invalidateWorkspace(a.nodeId,i.workspaceId,i.topic);return}if(a.category==="queue"&&i!==void 0){const{sessionId:g,queue:b}=i;if(typeof g=="string"&&a.nodeId===e.workspaceTarget.value?.nodeId&&typeof b=="object"&&b!==null){const w=e.selectedSession?.value,O=w?.id===g&&w.workspaceId===e.workspaceTarget.value?.workspaceId?w:e.sessions.value.find(R=>R.id===g&&R.workspaceId===e.workspaceTarget.value?.workspaceId);O!==void 0&&po(O)&&e.cacheQueue(a.nodeId,O.workspaceId,g,b,r),g===e.selectedSessionId.value&&e.mergeQueue(b,r)}return}if(a.category==="session"&&i!==void 0&&a.nodeId===e.workspaceTarget.value?.nodeId){const g=i.session;if(ri(g)){const b=g.id===e.selectedSessionId.value;b&&g.activity!==void 0&&g.activity!=="RUNNING"&&e.settleSessionRuns(g.id),e.mergeSessions([g]),b&&g.activity==="RUNNING"&&e.observeSessionRunning(g.id)}typeof i.sessionId=="string"&&"context"in i&&e.updateContext(i.sessionId,i.context??null);return}if(a.category==="run"&&i!==void 0&&ii(i.run)){const g=i.run;if(e.syncTurnStatus(g.id,g.status,g.sessionId),a.nodeId===e.workspaceTarget.value?.nodeId&&e.cacheRun(g),g.sessionId===e.selectedSessionId.value&&a.nodeId===e.workspaceTarget.value?.nodeId){const b=e.acceptRun(g);["STARTING","RUNNING","CANCELLING"].includes(b.status)&&e.openRun(g.id)}return}if(a.category!=="conversation"||i===void 0)return;if(i.performance!==void 0){a.nodeId===e.workspaceTarget.value?.nodeId&&typeof i.sessionId=="string"&&i.sessionId===e.selectedSessionId.value&&e.receivePerformance?.(i.sessionId,i.performance);return}const c=_e(i.item);if(c!==void 0&&typeof i.runId=="string"&&a.nodeId===e.workspaceTarget.value?.nodeId&&i.sessionId===e.selectedSessionId.value){e.mergeItem(i.runId,c,a.sequence,typeof c.startedAt=="number"?c.startedAt:void 0);return}const m=_e(i.delta);if(m!==void 0&&typeof m.runId=="string"&&typeof m.itemId=="string"&&typeof m.text=="string"&&a.nodeId===e.workspaceTarget.value?.nodeId&&i.sessionId===e.selectedSessionId.value){e.mergeTextDelta(m.runId,m,a.sequence,typeof m.createdAt=="number"?m.createdAt:void 0);return}const p=_o(i.snapshot,a.sequence);if(p!==void 0&&a.nodeId===e.workspaceTarget.value?.nodeId){const g=p.turns[0]?.sessionId??(typeof i.sessionId=="string"?i.sessionId:void 0);g!==void 0&&e.applyConversationSnapshot(g,p,"refresh");return}const v=i.turn;if(wa(v)&&a.nodeId===e.workspaceTarget.value?.nodeId){if(!Array.isArray(i.segments)||!i.segments.every(dn))return;const g=ft({segments:i.segments,nextCursor:e.conversationNextCursor.value,snapshotSequence:a.sequence}).turns;if(g.length===0)return;for(const b of g)e.markLiveTurn(b,a.sequence),e.cacheTurn(b);v.sessionId===e.selectedSessionId.value&&e.mergeTurns({turns:g,nextCursor:e.conversationNextCursor.value,snapshotSequence:a.sequence});return}}function o(a){(a.category==="node"||a.category==="workspace")&&n(a)}return{apply:n,applyBroadcast:o,updateNodeConnection:t}}function Ap(e){let t=!1,n=!1,o=0;const a=K("");function r(){o+=1,t=!1,n=!1,e.loadingOlder.value=!1,a.value=""}Ae([e.workspaceTarget,e.selectedSessionId],r,{flush:"sync"});async function i(){await c(e.pageSize)}async function c(g){const b=e.workspaceTarget.value?.nodeId,w=e.selectedSessionId.value,O=e.nextCursor.value;if(b===void 0||w===void 0||O===null||e.loadingOlder.value||t)return;const R=o;e.loadingOlder.value=!0,a.value="";let $=O;try{let D;try{D=await m(b,w,g,$)}catch(_){if(Xe(_)!=="EVENT_CURSOR_INVALID")throw _;if(e.workspaceTarget.value?.nodeId!==b||e.selectedSessionId.value!==w||o!==R||e.nextCursor.value!==$)return;const E=await p(b,w,$,R);if(E===void 0||e.workspaceTarget.value?.nodeId!==b||e.selectedSessionId.value!==w||o!==R||e.nextCursor.value!==(E??$))return;if(E===null){const y=e.capturePrependAnchor();e.clearCursor(),await Me(),o===R&&e.workspaceTarget.value?.nodeId===b&&e.selectedSessionId.value===w&&e.nextCursor.value===null&&y();return}$=E,D=await m(b,w,g,$)}if(e.workspaceTarget.value?.nodeId!==b||e.selectedSessionId.value!==w||o!==R||e.nextCursor.value!==$)return;const M=e.capturePrependAnchor();e.mergeOlderPage(D),await Me(),o===R&&e.workspaceTarget.value?.nodeId===b&&e.selectedSessionId.value===w&&M()}catch(D){e.workspaceTarget.value?.nodeId===b&&e.selectedSessionId.value===w&&o===R&&e.nextCursor.value===$&&(a.value=l("generated.workbenchConversationPagingService.unableToLoadEarlierConversationHistory",{value0:e.errorMessage(D)}))}finally{o===R&&(e.loadingOlder.value=!1)}}async function m(g,b,w,O){const R=await e.request(`/api/agent-sessions/${e.sessionPathId(b)}/turns?nodeId=${encodeURIComponent(g)}&limit=${w}&cursor=${encodeURIComponent(O)}&unit=SEGMENT`);return ft(R)}async function p(g,b,w,O){const R=await e.request(`/api/agent-sessions/${e.sessionPathId(b)}/turns?nodeId=${encodeURIComponent(g)}&limit=${e.recentSegmentWindowSize}&unit=SEGMENT`),$=ft(R);if(e.workspaceTarget.value?.nodeId!==g||e.selectedSessionId.value!==b||o!==O||e.nextCursor.value!==w)return;const D=$.nextCursor===null?{...$,nextCursor:w}:$;if(e.recoverWindow(D),await Me(),!(e.workspaceTarget.value?.nodeId!==g||e.selectedSessionId.value!==b||o!==O||e.nextCursor.value!==D.nextCursor))return $.nextCursor}async function v(){const g=e.workspaceTarget.value?.nodeId,b=e.selectedSessionId.value;if(g===void 0||b===void 0)return;if(t){n=!0;return}t=!0;let w=o;try{do{n=!1,w=++o,e.loadingOlder.value=!1,a.value="";const O=await e.request(`/api/agent-sessions/${e.sessionPathId(b)}/turns?nodeId=${encodeURIComponent(g)}&limit=${e.recentSegmentWindowSize}&unit=SEGMENT`),R=ft(O);if(o!==w||e.workspaceTarget.value?.nodeId!==g||e.selectedSessionId.value!==b)return;n||e.replaceRecent(R)}while(n)}catch{}finally{o===w&&(t=!1)}}return{resetWindow:r,olderHistoryError:a,loadOlderConversationTurns:i,refreshRecentConversationTurns:v}}const si=28,Un=48;function Rp(){const e=K(),t=K(!0),n=K(!1);let o,a,r,i=0,c;function m(_){e.value=_,o=_?.clientWidth,a=_?.clientHeight,r=_?.scrollHeight,i=_?.scrollTop??0,c=void 0}function p(_){const E=_.clientWidth!==o||_.clientHeight!==a||_.scrollHeight!==r;return o=_.clientWidth,a=_.clientHeight,r=_.scrollHeight,E}function v(_){const E=_.getBoundingClientRect(),y=_.ownerDocument.elementFromPoint(E.left+E.width/2,E.top+E.height/2);c=y!==null&&y!==_&&_.contains(y)?{element:y,top:y.getBoundingClientRect().top}:void 0}function g(_){const E=e.value;if(E===void 0||n.value)return;const y=p(E),x=c!==void 0&&E.contains(c.element)&&Math.abs(c.element.getBoundingClientRect().top-c.top)<1,N=!x&&E.scrollTop<i-1,B=!x&&E.scrollTop>i,T=E.scrollHeight-E.scrollTop-E.clientHeight;if(i=E.scrollTop,y&&(!N&&!B||t.value&&T<=1)){t.value?O():c===void 0&&v(E);return}t.value=!N&&(t.value||B)&&T<si,t.value?c=void 0:(N||B||c===void 0)&&v(E),N&&E.scrollTop<Un&&E.scrollHeight>E.clientHeight+Un&&_()}function b(){const _=e.value;_===void 0||!p(_)||!t.value||M()}function w(){const _=e.value;_!==void 0&&(t.value=!1,n.value=!1,p(_),i=_.scrollTop,v(_))}function O(){const _=e.value;_!==void 0&&(_.scrollTop=_.scrollHeight,i=_.scrollTop,t.value=!0,c=void 0)}function R(_){const E=e.value;if(E===void 0)return()=>{};const y=E.scrollHeight,x=E.scrollTop,N=_&&t.value;return()=>{if(!(e.value!==E||E.scrollTop!==x)){if(N){t.value&&(O(),p(E));return}E.scrollTop=x+(E.scrollHeight-y),i=E.scrollTop,p(E),t.value||v(E)}}}function $(){return R(!0)}function D(){return R(!1)}async function M(_=()=>!0){const E=e.value;E===void 0||!_()||(O(),await Me(),!(e.value!==E||!t.value||!_())&&(O(),await new Promise(y=>requestAnimationFrame(()=>y())),!(e.value!==E||!t.value||!_())&&(O(),await new Promise(y=>setTimeout(y,50)),!(e.value!==E||!t.value||!_())&&O())))}return{element:e,following:t,positioningInitialConversation:n,setElement:m,handleScroll:g,handleResize:b,stopFollowing:w,scrollToLatest:O,captureRenderAnchor:$,capturePrependAnchor:D,scrollToLatestAfterLayout:M}}const li=5e3;function nn(e){return`session:${e===void 0||e.startsWith("draft:")?"draft":e}`}function Pp(){const e=ci(),t={};return{...e.bind(()=>t),clear:e.clear,transferSession:(n,o)=>e.transfer(t,t,n,o)}}function ci(){let e=new WeakMap;const t=new Map,n=new Set,o=new WeakMap;function a(g){const b=JSON.stringify([g.nodeId,g.workspaceId,g.kind,g.kind==="session"?g.sessionId:null]);let w=t.get(b);return w===void 0&&(w={},t.set(b,w),o.set(w,b)),w}const r=K(0),i={};function c(g){let b=e.get(g);return b===void 0&&(b={slots:new Set([g]),tokens:mt([])},e.set(g,b)),b}function m(g){const b=X(()=>(r.value,c(g()??i)));function w(O,R,$=li){const D=b.value;if(D.tokens.value.length!==0)return;const M={group:D,context:O,active:!0};function _(){return M.active?(M.active=!1,clearTimeout(M.timeout),n.delete(_),M.group.tokens.value=M.group.tokens.value.filter(E=>E!==M),!0):!1}return D.tokens.value=[...D.tokens.value,M],n.add(_),$!==null&&(M.timeout=setTimeout(()=>{_()&&R?.()},$)),_}return{pending:X(()=>b.value.tokens.value.length!==0),context:X(()=>b.value.tokens.value.find(O=>O.context!==void 0)?.context),begin:w}}function p(g,b,w,O,R=!1){const $=e.get(g);if($===void 0)return;const D=e.get(b)??$;for(const M of $.tokens.value)M.context===nn(w)&&(M.context=nn(O)),M.group=D;if(D!==$){D.tokens.value=[...D.tokens.value,...$.tokens.value];for(const M of $.slots)e.set(M,D),D.slots.add(M)}else D.tokens.value=[...D.tokens.value];if(e.set(b,D),D.slots.add(b),R&&g!==b){e.delete(g),D.slots.delete(g);const M=o.get(g);M!==void 0&&t.get(M)===g&&t.delete(M)}r.value+=1}function v(){for(const g of n)g();t.clear(),e=new WeakMap,r.value+=1}return{bind:m,transfer:p,forTarget:a,clear:v}}const $p="";function Dp(e,t=[]){const n=e??K(t);function o(m){if(n.value.some(v=>v.name===m.name))return!1;const p={name:m.name,source:m.source,skillFilePath:m.skillFilePath,available:!0};return n.value=[...n.value,p],!0}function a(m){n.value=n.value.filter(p=>p.name!==m)}function r(){n.value=[]}function i(m){n.value=m.filter(ko)}function c(m){const p=new Map(m.map(v=>[v.name,v]));n.value=n.value.map(v=>{const g=p.get(v.name);return g===void 0?{...v,available:!1}:{name:g.name,source:g.source,skillFilePath:g.skillFilePath,available:!0}})}return{tokens:n,select:o,remove:a,clear:r,restore:i,reconcile:c}}function di(e,t,n=[]){const o=[t,e.length>0?jt("mar_skills",{action:"use",instruction:ia,skills:e.map(a=>({name:a.name,source:a.source,path:a.skillFilePath}))}):"",n.length>0?jt("mar_references",{references:[...n]}):""].filter(a=>a.length>0).join(`
1
+ import{c as ct}from"./uuid-BmNSYLtZ.js";import{ax as Wo,am as Ko,eM as Tt,eN as Qo,m as Ce,ap as Yo,o as s,J as oe,K as be,p as Ve,N as C,n as u,a6 as Se,L as d,Y as f,Z as le,a8 as Et,d5 as _n,k as X,cO as Jo,B as Xo,f as K,aF as Zo,au as ea,eO as ta,eP as na,eQ as jt,eR as no,t as l,A as st,eS as oa,af as mt,e as Xe,eT as aa,w as Ae,ab as Me,eU as ia,M as He,co as oo,eV as sn,eW as ra,eX as Oe,eY as sa,eZ as la,e_ as bn,r as ao,cp as ca,cz as io,aK as ln,T as dt,ac as Ke,a1 as Ge,X as I,a5 as yn,q as ne,V as ke,H as re,at as ro,_ as Ee,d0 as da,$ as Ue,e$ as kn,Q as Cn,f0 as ua,e0 as fa,a0 as Lt,dP as ma,as as gt,a3 as xe,aw as wn,e2 as ga,f1 as va,l as En,c9 as pa,a4 as In,bx as Qe,aY as ha}from"./index-D25Eg-N7.js";import{l as xn,i as _a,r as ba,a as ya,C as Sn,b as Tn,c as An,m as ka,d as Rn,e as St,f as _e,g as Ca,h as wa,j as Ea,k as Pn,n as Ht,o as Ia,p as xa}from"./conversation-history-9qOGJuIn.js";import{E as Sa}from"./message-box-service-D6NDomD6.js";import{A as $n,r as Ta,g as so,E as lo,e as co,M as Aa,H as Dn,t as Ra,B as Ln,p as Pa,h as At,n as xt,o as cn,q as Mn,F as $a}from"./FilePreviewLoading-D3TMSEqz.js";import{e as uo}from"./error-presentation-Be_WE-ex.js";import{a as Ze,E as fo}from"./el-input-DFFaatHT.js";import{M as ye}from"./MarIcon-_Gp54--s.js";import{B as lt}from"./BusyIndicator-DPIylucr.js";import{o as mo,a as Da,E as La}from"./el-checkbox-DHOiz1ip.js";import{a as Ma,E as Oa}from"./el-radio-Di81kFIf.js";/* empty css */import{E as Na}from"./el-scrollbar-Ce8F0IKz.js";import{f as it,p as qt}from"./time-presentation-Bm_av3wq.js";/* empty css */import{C as ja,E as qa,b as Ua,a as Ba}from"./el-select-34WQsw5v.js";/* empty css */import{E as go,u as Jt,m as Xt}from"./mobile-dialog-return-service-Bg4lvWpS.js";import{l as On,r as Nn}from"./runner-presentation-X7lYFguw.js";const Fa=Ko({...mo(Tt,["ariaLabel","gpuAcceleration","rawContent"]),placement:$n.placement,tabindex:$n.tabindex,effect:{...Tt.effect,default:"light"},title:String,width:{type:[String,Number],default:150},offset:{...Tt.offset,default:void 0},persistent:{...Tt.persistent,default:!0}}),Ha={"update:visible":e=>Wo(e),"before-enter":()=>!0,"before-leave":()=>!0,"after-enter":()=>!0,"after-leave":()=>!0};({...mo(Qo,["gpuAcceleration"])});var za=Ce({name:"ElPopover",__name:"popover",props:Fa,emits:Ha,setup(e,{expose:t,emit:n}){const o=e,a=n,r=X(()=>{const D=_n.props;return Jo(o,Xo(D)?D:Object.keys(D))}),i=Yo("popover"),c=K(),m=X(()=>d(c)?.popperRef),p=X(()=>[{width:Zo(o.width)},o.popperStyle]),v=X(()=>[i.b(),o.popperClass,{[i.m("plain")]:!!o.content}]),g=X(()=>o.transition===`${i.namespace.value}-fade-in-linear`),b=()=>{c.value?.hide()},w=()=>{a("before-enter")},O=()=>{a("before-leave")},R=()=>{a("after-enter")},$=()=>{a("update:visible",!1),a("after-leave")};return t({popperRef:m,hide:b}),(D,M)=>(s(),oe(d(_n),Et({ref_key:"tooltipRef",ref:c},r.value,{"aria-label":e.title,"popper-class":v.value,"popper-style":p.value,"gpu-acceleration":g.value,onBeforeShow:w,onBeforeHide:O,onShow:R,onHide:$}),{content:be(()=>[e.title?(s(),u("div",{key:0,class:Se(d(i).e("title")),role:"title"},f(e.title),3)):C("v-if",!0),Ve(D.$slots,"default",{hide:b},()=>[le(f(e.content),1)])]),default:be(()=>[D.$slots.reference?Ve(D.$slots,"reference",{key:0}):C("v-if",!0)]),_:3},16,["aria-label","popper-class","popper-style","gpu-acceleration"]))}}),Ga=za;const jn=(e,t)=>{const n=(t.arg||t.value)?.popperRef;n&&(n.triggerRef=e)};var Va={mounted(e,t){jn(e,t)},updated(e,t){jn(e,t)}};const Wa="popover",Ka=ta(Va,Wa),vo=ea(Ga,{directive:Ka});function kp(e,t,n,o=ct()){const a=na.parse({...t,id:o}),r=[...e,a],i=jt("mar_references",{references:r});if(n.length+i.length+1>no)throw new Error("COMPOSER_TAG_INVALID");return r}function Zt(e){const t=e.customTitle?.trim();if(t)return t;const n=e.runnerTitle?.trim();return n===void 0||n===""||n==="Untitled session"||n.toLocaleLowerCase()==="new session"?l("generated.sessionPresentation.newSession"):n}function po(e){return typeof e?.externalSessionId=="string"&&e.externalSessionId.length>0}function Cp(e){return!po(e)}function wp(e){return e.trim().replace(/\s+/g," ").slice(0,160)}function ho(e){return e.activity!==void 0?e.activity:"IDLE"}function Ep(e){return{RUNNING:l("generated.sessionPresentation.running"),IDLE:l("generated.sessionPresentation.ready")}[ho(e)]}function Qa(e){return{STARTING:l("generated.sessionPresentation.starting"),RUNNING:l("generated.sessionPresentation.running2"),SUCCEEDED:l("generated.sessionPresentation.completed"),FAILED:l("generated.sessionPresentation.failed"),CANCELLED:l("generated.sessionPresentation.cancelled"),INTERRUPTED:l("generated.sessionPresentation.interrupted"),LOST:l("generated.sessionPresentation.connectionLost")}[e]??e}const Ya=new Set(["PREPARING","RUNNING","WAITING_INPUT","WAITING_APPROVAL","SUCCEEDED","FAILED","CANCELLED","INTERRUPTED","LOST"]);function qn(e){return e==null||typeof e=="number"&&Number.isInteger(e)&&e>=0}function Ja(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.id=="string"&&t.id.length>0&&typeof t.kind=="string"&&t.kind.length>0&&typeof t.status=="string"&&t.status.length>0}function dn(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.id=="string"&&t.id.length>0&&typeof t.turnId=="string"&&t.turnId.length>0&&typeof t.sessionId=="string"&&t.sessionId.length>0&&(t.runId===null||typeof t.runId=="string"&&t.runId.length>0)&&typeof t.index=="number"&&Number.isInteger(t.index)&&t.index>=0&&typeof t.status=="string"&&Ya.has(t.status)&&Array.isArray(t.items)&&t.items.every(Ja)&&qn(t.startedAt)&&qn(t.completedAt)}function _o(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return;const n=e;if(!(n.unit!=="SEGMENT"||!Array.isArray(n.segments)||!n.segments.every(dn)||new Set(n.segments.map(a=>a.sessionId)).size>1))return ft({unit:"SEGMENT",segments:n.segments,nextCursor:typeof n.nextCursor=="string"?n.nextCursor:null,...typeof n.snapshotSequence=="number"?{snapshotSequence:n.snapshotSequence}:t===void 0?{}:{snapshotSequence:t},...n.source==="official"||n.source==="native"||n.source==="runtime"?{source:n.source}:{},...typeof n.readAt=="number"?{readAt:n.readAt}:{},...typeof n.latestVisibleAt=="number"?{latestVisibleAt:n.latestVisibleAt}:{},...n.deferredOlderHistory===!0?{deferredOlderHistory:!0}:{}})}function ft(e){if(!Array.isArray(e.segments))throw new Error("The conversation history response contains no segments.");const t=e;if(!t.segments.every(dn))throw new Error("The conversation Segment response contains an invalid Segment.");return{...t,turns:t.segments.map(n=>({id:n.id,turnId:n.turnId,segmentIndex:n.index,sessionId:n.sessionId,runId:n.runId,status:n.status,...n.rewind===void 0?{}:{rewind:n.rewind},items:n.items,...n.startedAt===void 0?{}:{startedAt:n.startedAt},...n.completedAt===void 0?{}:{completedAt:n.completedAt}}))}}function zt(e,t){const n=[...e];for(const[o,a]of t.entries()){const r=n.findIndex(c=>c.id===a.id);if(r>=0){const c=n[r],m=a.rewind??(c.sessionId===a.sessionId?c.rewind:void 0);n.splice(r,1,m===void 0?a:{...a,rewind:m});continue}if(a.turnId!==void 0&&a.segmentIndex!==void 0){const c=n.findIndex(p=>p.turnId===a.turnId&&p.segmentIndex!==void 0&&p.segmentIndex>a.segmentIndex),m=n.findLastIndex(p=>p.turnId===a.turnId);if(c>=0||m>=0){n.splice(c>=0?c:m+1,0,a);continue}}const i=t.slice(o+1).find(c=>n.some(m=>m.id===c.id));if(i!==void 0){n.splice(n.findIndex(c=>c.id===i.id),0,a);continue}n.push(a)}return n}function bo(e,t,n){const o=e.findLastIndex(i=>i.runId===t&&(n===void 0||(i.turnId??i.id)===n));if(o<0)return-1;const a=e[o].turnId??e[o].id;let r=o;for(const[i,c]of e.entries())c.runId===t&&(c.turnId??c.id)===a&&(c.segmentIndex??-1)>(e[r].segmentIndex??-1)&&(r=i);return r}function Xa(e,t,n){const o=bo(e,t);return e.map((a,r)=>r===o&&a.status!==n?{...a,status:n}:a)}function Za(e){let t,n,o,a,r,i=0,c=!1,m=!1,p=0;function v(){t!==void 0&&clearTimeout(t),o?.abort(new st("WATCH_CANCELLED","The watch was stopped or replaced.")),t=void 0,o=void 0,n=void 0,a=void 0,r=void 0,i=0,c=!1,m=!1,p=0}function g(){t!==void 0&&clearTimeout(t),t=void 0,c=!0}async function b(D,M,_){const E=setTimeout(()=>_.abort(new st("WATCH_REQUEST_TIMEOUT","The watch request timed out.")),e.requestTimeoutMs);try{if(await e.renew(D,_.signal,M),o!==_||a!==D)return;r=Date.now(),i=0,m=!1,p=0}catch(y){if(o!==_||a!==D)return;const x=_.signal.aborted&&y instanceof Error&&y.name==="AbortError"?_.signal.reason:y;if(e.recovery!==void 0&&(M==="renew"||m)){e.recovery.onFailure(x),M==="initial"&&(p+=1),!c&&e.recovery.retryable(x)&&p<e.maxFailures?m=!0:(g(),e.onExpired());return}if(M==="initial")throw c=!0,i=0,r=void 0,x;i+=1;const N=r!==void 0&&Date.now()-r>=e.confirmationTimeoutMs;(i>=e.maxFailures||N)&&(e.onExpired(),i=0,r=void 0)}finally{clearTimeout(E)}}function w(D,M){if(c||n!==void 0||a!==D||!e.eligible(D))return n;const _=new AbortController;o=_;const E=b(D,M,_).finally(()=>{n===E&&(n=void 0,o=void 0,O(D))});return n=E,E}function O(D){t!==void 0&&clearTimeout(t),!(c||a!==D)&&(t=setTimeout(()=>{t=void 0,w(D,m?"initial":"renew")?.catch(()=>{})},e.heartbeatMs))}function R(D,M=!1){if(!e.eligible(D)){v();return}if(a===D){if(n!==void 0)return n;if(t!==void 0)return}if(v(),c=!1,a=D,!M)return w(D,"initial");O(D)}function $(D){a===D&&(r=Date.now(),i=0)}return{start:R,pause:g,stop:v,confirm:$,isWatching:D=>a===D}}function Ip(e){const t=()=>e.workbenchConnectionId===void 0?"local-test-connection":e.workbenchConnectionId(),n=()=>e.position==="secondary"?e.enabled?.()===!0:e.enabled?.()!==!1;let o,a,r,i,c,m;const p=mt();let v,g=0,b;function w(h=new st("WATCH_CANCELLED","The watch was stopped or replaced.")){const A=b;A!==void 0&&(b=void 0,A.removeAbortListener(),A.reject(h))}function O(h,A,U){return w(),new Promise((z,Z)=>{const F=()=>{b?.watchId===A&&w(U?.reason instanceof Error?U.reason:new st("WATCH_CANCELLED","The watch was stopped or replaced."))};U?.addEventListener("abort",F,{once:!0}),b={sessionId:h,watchId:A,resolve:z,reject:Z,removeAbortListener:()=>U?.removeEventListener("abort",F),events:[]},U?.aborted===!0&&F()})}function R(h){return n()&&e.selectedSessionId.value===h&&D(h)}function $(h){return D(h.id)}function D(h){return!h.startsWith("draft:")&&(typeof document>"u"||document.visibilityState==="visible")}async function M(h,A,U="renew"){if(!n())return;const z=e.workspaceTarget.value?.nodeId,Z=e.workspaceTarget.value?.workspaceId,F=t();if(z===void 0||Z===void 0||F===void 0||e.selectedSessionId.value!==h)return;U==="initial"?(p.value=void 0,o=ct().replace(/-/g,""),m=void 0,a=h,r=z,i=Z):o??=ct().replace(/-/g,"");const q=o,ee=U==="initial"?O(h,q,A):void 0;ee?.catch(()=>{});let se=!1,pe;try{if(pe=await e.request(`/api/agent-sessions/${e.sessionPathId(h)}/watch`,{method:"POST",body:JSON.stringify({nodeId:z,workspaceId:Z,workbenchConnectionId:F,watchId:q,mode:U,...e.position===void 0?{}:{position:e.position},unit:"SEGMENT"}),...A===void 0?{}:{signal:A}}),se=!0,e.workspaceTarget.value?.nodeId!==z||e.workspaceTarget.value?.workspaceId!==Z||e.selectedSessionId.value!==h||t()!==F||o!==q){b?.watchId===q&&w(),await ee?.catch(()=>{});return}typeof pe?.nodeGeneration=="string"&&a===h&&(m=pe.nodeGeneration),await ee}catch(me){throw b?.watchId===q&&w(),await ee?.catch(()=>{}),se&&Xe(me)==="WATCH_REQUEST_TIMEOUT"?new st("SESSION_WATCH_SNAPSHOT_TIMEOUT","The initial session snapshot did not arrive before the watch deadline."):me}}const _=Za({heartbeatMs:e.heartbeatMs,requestTimeoutMs:e.requestTimeoutMs,confirmationTimeoutMs:e.confirmationTimeoutMs,maxFailures:3,eligible:R,renew:(h,A,U)=>M(h,A,U),onExpired:e.refreshSnapshot});function E(h,A={}){if(!n())return;const U=t();if(a===h&&c!==U)return x(h,A.preserveFailures!==!0);a!==h&&(o=ct().replace(/-/g,""),m=void 0,A.preserveFailures!==!0&&(g=0),a=h,r=e.workspaceTarget.value?.nodeId,i=e.workspaceTarget.value?.workspaceId,c=U);const z=_.start(h,A.skipImmediateRenew===!0),Z=o,F=z?.then(()=>{if(o!==Z||t()!==U)throw new st("WATCH_CANCELLED","The watch was stopped or replaced.")});return F?.catch(()=>{}),F}function y(){p.value=void 0,w();const h=a,A=o,U=r,z=i,Z=c;a=void 0,r=void 0,i=void 0,c=void 0,o=void 0,m=void 0,g=0,v!==void 0&&clearTimeout(v),v=void 0,_.stop(),!(h===void 0||A===void 0||U===void 0||z===void 0||Z===void 0)&&e.request(`/api/agent-sessions/${e.sessionPathId(h)}/watch`,{method:"DELETE",body:JSON.stringify({nodeId:U,workspaceId:z,workbenchConnectionId:Z,watchId:A,...e.position===void 0?{}:{position:e.position}})}).catch(()=>{})}function x(h,A=!0){return p.value=void 0,v!==void 0&&clearTimeout(v),v=void 0,w(),_.stop(),a=void 0,r=void 0,i=void 0,c=void 0,o=void 0,m=void 0,A&&(g=0),E(h,{preserveFailures:!A})}function N(h){return x(h)??Promise.resolve()}function B(){v!==void 0&&clearTimeout(v),v=void 0,_.pause()}function T(h){if(typeof h!="object"||h===null)return!1;const A=h;if(A.type!=="watch.session.snapshot"&&A.type!=="watch.session.event"||A.workbenchConnectionId!==t()||A.nodeId!==e.workspaceTarget.value?.nodeId||A.workspaceId!==i||A.sessionId!==a||o===void 0||A.watchId!==o||typeof A.nodeGeneration!="string"||m!==void 0&&A.nodeGeneration!==m)return!1;m??=A.nodeGeneration,g=0;const U=a;if(U===void 0)return!1;if(A.type==="watch.session.event"){const ee=A.event;if(ee!==void 0&&typeof ee.sequence=="number"&&["node","session","conversation","run","queue","workspace"].includes(String(ee.category))&&"payload"in ee){const se={nodeId:A.nodeId,sequence:ee.sequence,category:ee.category,payload:ee.payload};b?.sessionId===U&&b.watchId===o?b.events.push(se):e.applyEvent?.(se)}return!0}if(A.payload===void 0)return!1;const z=A.payload,Z=z.kind==="session-watch-snapshot"&&typeof z.sequence=="number"&&typeof z.session=="object"&&z.session!==null&&Array.isArray(z.runs)?z:void 0;if(Z!==void 0){e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"session",payload:{session:Z.session}});const ee=Z.runs;if(e.applyRunsSnapshot!==void 0)e.applyRunsSnapshot(ee);else for(const se of ee)e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"run",payload:{run:se}});typeof Z.queue=="object"&&Z.queue!==null&&e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"queue",payload:{sessionId:U,queue:Z.queue}},"initial"),"context"in Z&&e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"session",payload:{sessionId:U,context:Z.context}}),Z.performance!==void 0&&e.applyEvent?.({nodeId:A.nodeId,sequence:Z.sequence,category:"conversation",payload:{sessionId:U,performance:Z.performance}})}const F=Z?.conversation??A.payload,q=_o(F)??ft(F);if(b?.sessionId===U&&b.watchId===o){const ee=b;b=void 0,ee.removeAbortListener(),e.applySnapshot(U,q,A.historyReset===!0?"reset":"initial"),p.value={watchId:ee.watchId,nodeId:A.nodeId,workspaceId:A.workspaceId,sessionId:U,connectionId:A.workbenchConnectionId};const se=typeof Z?.sequence=="number"?Z.sequence:q.snapshotSequence;for(const pe of ee.events){const me=pe.category==="conversation"?q.snapshotSequence??se:se;me!==void 0&&pe.sequence<=me||e.applyEvent?.(pe)}return ee.resolve(),!0}return Promise.resolve(e.applySnapshot(U,q,A.historyReset===!0?"reset":"refresh")).then(ee=>{if(ee&&e.followConversation.value)return e.scrollAfterLayout()}),!0}function W(h){if(h.type!=="watch.failed"||h.watchType!=="session"||h.watchId!==o||h.workbenchConnectionId!==t()||h.sessionId!==a||h.nodeId!==e.workspaceTarget.value?.nodeId||h.workspaceId!==i||typeof h.nodeGeneration!="string"||m!==void 0&&h.nodeGeneration!==m)return!1;m??=h.nodeGeneration;const A=a;return A===void 0?!0:b?.sessionId===A&&b.watchId===o?(w(new st(oa(h.code)?h.code:"SESSION_HISTORY_INITIAL_FAILED",typeof h.message=="string"&&h.message.length>0&&h.message.length<=1e3?h.message:"Unable to load the initial session snapshot.")),_.pause(),!0):g>=3?(y(),e.refreshSnapshot(),!0):(g+=1,_.pause(),v=setTimeout(()=>{v=void 0,e.selectedSessionId.value===A&&x(A,!1)},Math.min(e.heartbeatMs,1e3*2**(g-1))),!0)}function S(){document.visibilityState!=="visible"&&y()}function G(h,A){h!==void 0&&A!==void 0&&h.id===e.selectedSessionId.value&&ho(h)==="RUNNING"&&A.id===h.id&&$(A)&&E(A.id)}return{hasInitialSessionSnapshot:h=>p.value!==void 0&&p.value.watchId===o&&p.value.nodeId===e.workspaceTarget.value?.nodeId&&p.value.workspaceId===e.workspaceTarget.value?.workspaceId&&p.value.sessionId===h&&e.selectedSessionId.value===h&&p.value.connectionId===t(),canWatchSessionHistory:h=>n()&&$(h),initializeSelectedSessionWatch:N,beginSelectedSessionWatch:E,restartSelectedSessionWatch:x,pauseSelectedSessionWatch:B,stopSelectedSessionWatch:y,reconcileWorkspaceSnapshot:G,handleEvent(h){return typeof h!="object"||h===null?!1:W(h)||T(h)},handleSessionWatchVisibility:S}}const ei=new TextEncoder;function Ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function en(e,t){if(e===t)return!0;if(Array.isArray(e))return Array.isArray(t)&&e.length===t.length&&e.every((a,r)=>en(a,t[r]));if(!Ut(e)||!Ut(t))return!1;const n=Object.keys(e).filter(a=>e[a]!==void 0),o=Object.keys(t).filter(a=>t[a]!==void 0);return n.length===o.length&&n.every(a=>Object.hasOwn(t,a)&&en(e[a],t[a]))}function ti(e){const t=mt([]),n=K(null),o=ni({...e,turns:t,nextCursor:n});return{turns:t,nextCursor:n,projection:o}}function ni(e){const t=new Map,n=new Map,o=new Map;let a=0,r=0;const i=new Map;let c,m=!1;const p=e.scheduleTextDeltaFlush??(j=>{if(typeof requestAnimationFrame=="function"){const Q=requestAnimationFrame(j);return()=>cancelAnimationFrame(Q)}return queueMicrotask(j),()=>{}}),v=j=>`${j.sessionId}:${j.id}`,g=(j,Q)=>`${v(j)}:${Q}`;function b(j,Q){if(Q.length<j.length){const te=new Set(Q.map(ce=>v(ce))),ve=new Set(Q.map(ce=>ce.runId));for(const ce of j){if(te.has(v(ce)))continue;t.delete(v(ce));const ue=`${v(ce)}:`;for(const L of n.keys())L.startsWith(ue)&&n.delete(L);St(ce)&&!ve.has(ce.runId)&&o.delete(ce.runId)}}}function w(j){b(e.turns.value,j),e.turns.value=[...j]}function O(){w(e.limitHistory(e.turns.value))}function R(){return e.turns.value.length<=Sn?!1:(w(Tn(e.turns.value,Rn)),e.nextCursor.value=null,!0)}function $(){ee(),n.clear(),t.clear(),o.clear(),r=0,a=0}function D(j){$()}function M(j,Q){$(),e.turns.value=[...j],e.nextCursor.value=Q}function _(j){const Q=new Set(e.turns.value.map(te=>te.id));e.turns.value=e.limitHistory([...j.turns.filter(te=>!Q.has(te.id)),...e.turns.value]),e.nextCursor.value=j.nextCursor}function E(j){e.turns.value=e.limitHistory(zt(e.turns.value,j.turns)),e.nextCursor.value=j.nextCursor}function y(){e.nextCursor.value=null}function x(j,Q){e.turns.value=Xa(e.turns.value,j,Q)}function N(j){let Q=!1;const te=e.turns.value.map(ve=>{if(!T(ve,j))return ve;let ce=!1;const ue=ve.items.map(L=>L.id!==j||L.kind!=="user_message"||!Ut(L.payload)||L.payload.clientMessageId!==j?L:(ce=!0,Q=!0,{...L,payload:{...L.payload,delivery:"ACCEPTED"}}));return ce?{...ve,items:ue}:ve});return Q&&(e.turns.value=te),Q}function B(j){const Q=e.turns.value.filter(te=>!T(te,j));return Q.length===e.turns.value.length?!1:(e.turns.value=Q,!0)}function T(j,Q){return j.id===Q&&j.runId===null&&j.items.some(te=>te.id===Q&&te.kind==="user_message"&&Ut(te.payload)&&te.payload.clientMessageId===Q)}function W(j,Q){F();const te=`${j}:`;for(const ve of t.keys())ve.startsWith(te)&&t.delete(ve);for(const ve of n.keys())ve.startsWith(te)&&n.delete(ve);for(const ve of Q)o.delete(ve)}function S(j,Q){if(Q===void 0)return;a=Math.max(a,Q);const te=v(j);t.set(te,Math.max(t.get(te)??0,Q))}function G(j,Q){return bo(e.turns.value,j,Q)}function h(j,Q){return Q!==void 0&&Q<=(o.get(j)??-1)}function A(j,Q){const te=typeof Q.segmentId=="string"?Q.segmentId:void 0,ve=typeof Q.turnId=="string"?Q.turnId:void 0;if(te===void 0){if(typeof Q.itemId=="string"){const he=e.turns.value.findIndex(Te=>Te.runId===j&&(ve===void 0||(Te.turnId??Te.id)===ve)&&Te.items.some(De=>De.id===Q.itemId));if(he>=0)return he}return G(j,ve)}const ce=e.turns.value.findIndex(he=>he.id===te&&(he.runId===j||he.runId===null));if(ce>=0)return e.turns.value[ce].runId===null&&(e.turns.value=e.turns.value.map((he,Te)=>Te===ce?{...he,runId:j}:he)),ce;if(ve===void 0||typeof Q.segmentIndex!="number"||!Number.isInteger(Q.segmentIndex)||Q.segmentIndex<0)return-1;F();const ue=G(j,ve),L=ue>=0?ue:e.turns.value.findLastIndex(he=>he.turnId===ve&&he.runId===null),H=e.turns.value[L];if(H===void 0)return-1;const Y=Q.segmentIndex;if(Y<=(H.segmentIndex??-1))return-1;const we={...H,id:te,turnId:ve,runId:j,segmentIndex:Y,items:[],startedAt:null,completedAt:null};return e.turns.value=zt(e.turns.value,[{...H,status:"SUCCEEDED"},we]),R()&&e.onRecentWindowOverflow(),e.turns.value.findIndex(he=>he.id===te&&he.runId===j)}function U(j,Q,te){if(h(j,te))return;const ve=A(j,Q),ce=e.turns.value[ve];if(ce===void 0||oi(ce.status))return;const ue=typeof Q.itemId=="string"?Q.itemId:void 0,L=ue===void 0?void 0:ce.items.find(H=>H.id===ue&&H.kind==="assistant_message");if(!(L!==void 0&&Pt(L.status))&&!(ue!==void 0&&te!==void 0&&te<=(n.get(g(ce,ue))??-1)))return{turnIndex:ve,turn:ce}}function z(j,Q,te,ve=Date.now()){F();const ce=_e(Q);if(ce===void 0)return!1;const{itemId:ue,kind:L,status:H}=ce;if(typeof ue!="string"||typeof L!="string"||typeof H!="string"||h(j,te))return!1;const Y=A(j,ce);if(Y<0)return!1;const we=e.turns.value[Y],he=we.items.findIndex(ae=>ae.id===ue),Te=he<0?void 0:we.items[he],De=g(we,ue);if(te!==void 0&&te<=(n.get(De)??Number.NEGATIVE_INFINITY)||Te!==void 0&&Pt(Te.status)&&!Pt(H))return!1;const Ie=Rt(ve)?ve:Date.now(),$e=we.items.at(-1),je=we.items.map(ae=>ae.id===$e?.id&&ae.kind==="assistant_message"&&ae.status==="IN_PROGRESS"?{...ae,status:"COMPLETED",completedAt:Ie}:ae),fe=Rt(ce.startedAt)?ce.startedAt:Te?.startedAt??Ie,k=ce.completedAt===null?null:Rt(ce.completedAt)?ce.completedAt:Pt(H)?Te?.completedAt??Ie:Te?.completedAt??null,P={id:ue,kind:L,status:H,...ce.processGroup===void 0?{}:{processGroup:aa.parse(ce.processGroup)},...typeof ce.parentItemId=="string"?{parentItemId:ce.parentItemId}:{},startedAt:fe,completedAt:k,payload:An(ce.merge===!0&&Te!==void 0?ka(Te.payload,ce.payload,ce.append):ce.payload)};return he<0?je.push(P):je.splice(he,1,P),e.turns.value=e.turns.value.map((ae,Re)=>Re===Y?{...ae,items:je,startedAt:ae.startedAt??P.startedAt}:ae),te!==void 0&&n.set(De,te),S(we,te),O(),!0}function Z(j,Q,te,ve=Date.now()){const ce=_e(Q),ue=ce?.text;if(typeof ue!="string"||ue.length===0||ce===void 0)return!1;const L=U(j,ce,te);if(L===void 0)return!1;const{turnIndex:H,turn:Y}=L,we=typeof ce?.itemId=="string"?ce.itemId:void 0,he=Y.items.at(-1),Te=we===void 0&&he?.kind==="assistant_message"&&he.status==="IN_PROGRESS",De=we===void 0?Te?Y.items.length-1:-1:Y.items.findIndex(Re=>Re.id===we&&Re.kind==="assistant_message"),Ie=De>=0?Y.items[De].id:we??`${j}:assistant:${te??"live"}`,$e=De<0?void 0:Y.items[De],je=g(Y,Ie);if(te!==void 0&&te<=(n.get(je)??Number.NEGATIVE_INFINITY))return!1;const fe=_e($e?.payload),k=`${typeof fe?.text=="string"?fe.text:""}${ue}`,P={id:Ie,kind:"assistant_message",status:"IN_PROGRESS",startedAt:$e?.startedAt??(Rt(ve)?ve:Date.now()),completedAt:null,payload:{...fe??{},...An({text:k}),format:"markdown",model:null}},ae=[...Y.items];return De<0?ae.push(P):ae.splice(De,1,P),e.turns.value=e.turns.value.map((Re,Fe)=>Fe===H?{...Re,items:ae,startedAt:Re.startedAt??P.startedAt}:Re),te!==void 0&&n.set(je,te),r+=ei.encode(ue).byteLength,r>=64*1024?(S(Y,te),O(),r=0,!0):(S(Y,te),!0)}function F(){c?.(),c=void 0,m=!1,q()}function q(){if(i.size===0)return;const j=[...i.values()];i.clear();for(const Q of j)Z(Q.runId,Q,Q.sequence,Q.createdAt)}function ee(){c?.(),c=void 0,m=!1,i.clear()}function se(j,Q,te,ve=Date.now()){const ce=_e(Q),ue=ce?.text;if(typeof ue!="string"||ue.length===0)return!1;const L=ce!==void 0&&typeof ce.itemId=="string"?ce.itemId:void 0;if(ce===void 0)return!1;const H=U(j,ce,te);if(H===void 0)return!1;const Y=H.turn,we=`${j}\0${Y.id}\0${L??""}`,he=i.get(we);if(he!==void 0&&te!==void 0&&te<=(he.sequence??-1))return!1;if(he===void 0?i.set(we,{runId:j,...L===void 0?{}:{itemId:L},turnId:Y.turnId??Y.id,...Y.segmentIndex===void 0?{}:{segmentId:Y.id,segmentIndex:Y.segmentIndex},text:ue,chunks:[{text:ue,sequence:te}],...te===void 0?{}:{sequence:te},createdAt:ve}):(he.text+=ue,he.chunks.push({text:ue,sequence:te}),te!==void 0&&(he.sequence=te)),!m){m=!0;const Te=p(()=>{m=!1,c=void 0,q()});m?c=Te:Te()}return!0}function pe(j,Q){S(j,Q),!(!St(j)||Q===void 0)&&o.set(j.runId,Math.max(o.get(j.runId)??0,Q))}function me(j){return j.snapshotSequence!==void 0&&j.snapshotSequence<a}function ge(j){if(F(),me(j))return!1;const Q=e.turns.value,ve=j.turns.map(xn),ce=new Map(Q.map(Ie=>[Ie.id,Ie])),ue=ve.map(Ie=>{const $e=ce.get(Ie.id);if($e===void 0)return S(Ie,j.snapshotSequence),Ie;const je=t.get(v(Ie));if(je!==void 0&&j.snapshotSequence!==void 0&&je>j.snapshotSequence)return $e;S(Ie,j.snapshotSequence);const fe=$e.items.filter(_a);return fe.length===0?Ie:{...Ie,items:ba(Ie.items,$e.items,fe)}}),L=ya(zt(Q,ue)),H=Q.at(-1)?.id,Y=L.findIndex(Ie=>Ie.id===H),he=L.slice(Y+1).some(Ie=>!ce.has(Ie.id))&&L.length>Sn,Te=e.limitHistory(he?Tn(L,Rn):L).map(Ie=>{const $e=ce.get(Ie.id);return $e!==void 0&&en($e,Ie)?$e:Ie}),De=Q.length!==Te.length||Q.some((Ie,$e)=>Ie!==Te[$e]);return b(L,Te),he&&(e.nextCursor.value=null),!he&&e.nextCursor.value===null&&j.nextCursor!==null&&Te[0]?.id===j.turns[0]?.id&&(e.nextCursor.value=j.nextCursor),De&&(e.turns.value=Te),he&&e.onRecentWindowOverflow(),De}function J(j){return F(),me(j)?!1:(V(j),!0)}function V(j){const Q=j.turns.map(xn),te=[...i.values()];$(),e.turns.value=e.limitHistory(Q),e.nextCursor.value=j.nextCursor,a=j.snapshotSequence??0;for(const ve of e.turns.value)pe(ve,j.snapshotSequence);for(const ve of te){const ce=j.snapshotSequence;if(ce===void 0)continue;const ue=ve.chunks.filter(L=>L.sequence!==void 0&&L.sequence>ce);ue.length!==0&&Z(ve.runId,{...ve,text:ue.map(L=>L.text).join("")},ue.at(-1).sequence,ve.createdAt)}}function ie(j){return F(),me(j)?!1:(V(j),!0)}return{resetHistory:$,restore:D,restoreWindow:M,mergeOlderPage:_,recoverWindow:E,clearCursor:y,syncRunStatus:x,updateOptimisticUserMessage:N,removeOptimisticUserMessage:B,clearSession:W,markLive:S,mergeItem:z,mergeTextDelta:se,flushPendingTextDeltas:F,mergeLatest:ge,replaceRecent:J,replaceAuthoritative:ie}}function Rt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Pt(e){return["COMPLETED","FAILED","DECLINED","CANCELLED","INTERRUPTED"].includes(e)}function oi(e){return["SUCCEEDED","FAILED","CANCELLED","INTERRUPTED","LOST"].includes(e)}function yo(e){const t=tn(e);return t?.kind==="context_compaction"&&t.status==="COMPLETED"}function ai(e){const t=tn(e),n=tn(t?.payload);return yo(e)&&n?.retainedContext===!0}function xp(e,t){return yo(e)?ai(e)?null:t==null?t:{...t,usedTokens:0,percentage:0,...t.gcCount===void 0?{}:{gcCount:0},...t.gcCount===void 0&&t.gcReclaimedTokens===void 0?{}:{gcReclaimedTokens:0}}:t}function Sp(e){const{turns:t,nextCursor:n,projection:o}=ti({onRecentWindowOverflow:e,limitHistory:Ca});let a=0,r;const i=K(0);function c(){r!==void 0&&(clearTimeout(r.timer),r.resolve(),r=void 0)}function m(){c(),i.value+=1;const v=i.value;return new Promise(g=>{const b=setTimeout(()=>{r?.version===v&&(r=void 0,g())},1e4);r={version:v,resolve:g,timer:b}})}function p(v){r?.version===v&&c()}return{turns:t,nextCursor:n,projection:o,loadingInitial:K(!1),initialLoadFailed:K(!1),initialFailureCause:mt(),loadingOlder:K(!1),channelInput:K(""),channelToken:K(),contextUsage:K(),initialRenderVersion:i,beginInitialRender:m,confirmInitialRender:p,cancelInitialRender:c,nextDetailRequest:()=>++a,currentDetailRequest:()=>a}}function tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function ii(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"&&typeof e.sessionId=="string"&&typeof e.status=="string"}function ri(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"&&typeof e.workspaceId=="string"&&(e.runner==="codex"||e.runner==="claude-code"||e.runner==="opencode"||e.runner==="mar-agent")&&!e.id.startsWith("draft:")}function Tp(e){function t(a,r){const i=e.setNodeConnection?.(a,r);r&&i===!1&&e.onNodeConnected(a)}function n(a,r="event"){const i=_e(a.payload);if(a.category==="node"&&typeof i?.connected=="boolean"){t(a.nodeId,i.connected);return}if(a.category==="workspace"&&i!==void 0){typeof i.workspaceId=="string"&&typeof i.topic=="string"&&e.invalidateWorkspace(a.nodeId,i.workspaceId,i.topic);return}if(a.category==="queue"&&i!==void 0){const{sessionId:g,queue:b}=i;if(typeof g=="string"&&a.nodeId===e.workspaceTarget.value?.nodeId&&typeof b=="object"&&b!==null){const w=e.selectedSession?.value,O=w?.id===g&&w.workspaceId===e.workspaceTarget.value?.workspaceId?w:e.sessions.value.find(R=>R.id===g&&R.workspaceId===e.workspaceTarget.value?.workspaceId);O!==void 0&&po(O)&&e.cacheQueue(a.nodeId,O.workspaceId,g,b,r),g===e.selectedSessionId.value&&e.mergeQueue(b,r)}return}if(a.category==="session"&&i!==void 0&&a.nodeId===e.workspaceTarget.value?.nodeId){const g=i.session;if(ri(g)){const b=g.id===e.selectedSessionId.value;b&&g.activity!==void 0&&g.activity!=="RUNNING"&&e.settleSessionRuns(g.id),e.mergeSessions([g]),b&&g.activity==="RUNNING"&&e.observeSessionRunning(g.id)}typeof i.sessionId=="string"&&"context"in i&&e.updateContext(i.sessionId,i.context??null);return}if(a.category==="run"&&i!==void 0&&ii(i.run)){const g=i.run;if(e.syncTurnStatus(g.id,g.status,g.sessionId),a.nodeId===e.workspaceTarget.value?.nodeId&&e.cacheRun(g),g.sessionId===e.selectedSessionId.value&&a.nodeId===e.workspaceTarget.value?.nodeId){const b=e.acceptRun(g);["STARTING","RUNNING","CANCELLING"].includes(b.status)&&e.openRun(g.id)}return}if(a.category!=="conversation"||i===void 0)return;if(i.performance!==void 0){a.nodeId===e.workspaceTarget.value?.nodeId&&typeof i.sessionId=="string"&&i.sessionId===e.selectedSessionId.value&&e.receivePerformance?.(i.sessionId,i.performance);return}const c=_e(i.item);if(c!==void 0&&typeof i.runId=="string"&&a.nodeId===e.workspaceTarget.value?.nodeId&&i.sessionId===e.selectedSessionId.value){e.mergeItem(i.runId,c,a.sequence,typeof c.startedAt=="number"?c.startedAt:void 0);return}const m=_e(i.delta);if(m!==void 0&&typeof m.runId=="string"&&typeof m.itemId=="string"&&typeof m.text=="string"&&a.nodeId===e.workspaceTarget.value?.nodeId&&i.sessionId===e.selectedSessionId.value){e.mergeTextDelta(m.runId,m,a.sequence,typeof m.createdAt=="number"?m.createdAt:void 0);return}const p=_o(i.snapshot,a.sequence);if(p!==void 0&&a.nodeId===e.workspaceTarget.value?.nodeId){const g=p.turns[0]?.sessionId??(typeof i.sessionId=="string"?i.sessionId:void 0);g!==void 0&&e.applyConversationSnapshot(g,p,"refresh");return}const v=i.turn;if(wa(v)&&a.nodeId===e.workspaceTarget.value?.nodeId){if(!Array.isArray(i.segments)||!i.segments.every(dn))return;const g=ft({segments:i.segments,nextCursor:e.conversationNextCursor.value,snapshotSequence:a.sequence}).turns;if(g.length===0)return;for(const b of g)e.markLiveTurn(b,a.sequence),e.cacheTurn(b);v.sessionId===e.selectedSessionId.value&&e.mergeTurns({turns:g,nextCursor:e.conversationNextCursor.value,snapshotSequence:a.sequence});return}}function o(a){(a.category==="node"||a.category==="workspace")&&n(a)}return{apply:n,applyBroadcast:o,updateNodeConnection:t}}function Ap(e){let t=!1,n=!1,o=0;const a=K("");function r(){o+=1,t=!1,n=!1,e.loadingOlder.value=!1,a.value=""}Ae([e.workspaceTarget,e.selectedSessionId],r,{flush:"sync"});async function i(){await c(e.pageSize)}async function c(g){const b=e.workspaceTarget.value?.nodeId,w=e.selectedSessionId.value,O=e.nextCursor.value;if(b===void 0||w===void 0||O===null||e.loadingOlder.value||t)return;const R=o;e.loadingOlder.value=!0,a.value="";let $=O;try{let D;try{D=await m(b,w,g,$)}catch(_){if(Xe(_)!=="EVENT_CURSOR_INVALID")throw _;if(e.workspaceTarget.value?.nodeId!==b||e.selectedSessionId.value!==w||o!==R||e.nextCursor.value!==$)return;const E=await p(b,w,$,R);if(E===void 0||e.workspaceTarget.value?.nodeId!==b||e.selectedSessionId.value!==w||o!==R||e.nextCursor.value!==(E??$))return;if(E===null){const y=e.capturePrependAnchor();e.clearCursor(),await Me(),o===R&&e.workspaceTarget.value?.nodeId===b&&e.selectedSessionId.value===w&&e.nextCursor.value===null&&y();return}$=E,D=await m(b,w,g,$)}if(e.workspaceTarget.value?.nodeId!==b||e.selectedSessionId.value!==w||o!==R||e.nextCursor.value!==$)return;const M=e.capturePrependAnchor();e.mergeOlderPage(D),await Me(),o===R&&e.workspaceTarget.value?.nodeId===b&&e.selectedSessionId.value===w&&M()}catch(D){e.workspaceTarget.value?.nodeId===b&&e.selectedSessionId.value===w&&o===R&&e.nextCursor.value===$&&(a.value=l("generated.workbenchConversationPagingService.unableToLoadEarlierConversationHistory",{value0:e.errorMessage(D)}))}finally{o===R&&(e.loadingOlder.value=!1)}}async function m(g,b,w,O){const R=await e.request(`/api/agent-sessions/${e.sessionPathId(b)}/turns?nodeId=${encodeURIComponent(g)}&limit=${w}&cursor=${encodeURIComponent(O)}&unit=SEGMENT`);return ft(R)}async function p(g,b,w,O){const R=await e.request(`/api/agent-sessions/${e.sessionPathId(b)}/turns?nodeId=${encodeURIComponent(g)}&limit=${e.recentSegmentWindowSize}&unit=SEGMENT`),$=ft(R);if(e.workspaceTarget.value?.nodeId!==g||e.selectedSessionId.value!==b||o!==O||e.nextCursor.value!==w)return;const D=$.nextCursor===null?{...$,nextCursor:w}:$;if(e.recoverWindow(D),await Me(),!(e.workspaceTarget.value?.nodeId!==g||e.selectedSessionId.value!==b||o!==O||e.nextCursor.value!==D.nextCursor))return $.nextCursor}async function v(){const g=e.workspaceTarget.value?.nodeId,b=e.selectedSessionId.value;if(g===void 0||b===void 0)return;if(t){n=!0;return}t=!0;let w=o;try{do{n=!1,w=++o,e.loadingOlder.value=!1,a.value="";const O=await e.request(`/api/agent-sessions/${e.sessionPathId(b)}/turns?nodeId=${encodeURIComponent(g)}&limit=${e.recentSegmentWindowSize}&unit=SEGMENT`),R=ft(O);if(o!==w||e.workspaceTarget.value?.nodeId!==g||e.selectedSessionId.value!==b)return;n||e.replaceRecent(R)}while(n)}catch{}finally{o===w&&(t=!1)}}return{resetWindow:r,olderHistoryError:a,loadOlderConversationTurns:i,refreshRecentConversationTurns:v}}const si=28,Un=48;function Rp(){const e=K(),t=K(!0),n=K(!1);let o,a,r,i=0,c;function m(_){e.value=_,o=_?.clientWidth,a=_?.clientHeight,r=_?.scrollHeight,i=_?.scrollTop??0,c=void 0}function p(_){const E=_.clientWidth!==o||_.clientHeight!==a||_.scrollHeight!==r;return o=_.clientWidth,a=_.clientHeight,r=_.scrollHeight,E}function v(_){const E=_.getBoundingClientRect(),y=_.ownerDocument.elementFromPoint(E.left+E.width/2,E.top+E.height/2);c=y!==null&&y!==_&&_.contains(y)?{element:y,top:y.getBoundingClientRect().top}:void 0}function g(_){const E=e.value;if(E===void 0||n.value)return;const y=p(E),x=c!==void 0&&E.contains(c.element)&&Math.abs(c.element.getBoundingClientRect().top-c.top)<1,N=!x&&E.scrollTop<i-1,B=!x&&E.scrollTop>i,T=E.scrollHeight-E.scrollTop-E.clientHeight;if(i=E.scrollTop,y&&(!N&&!B||t.value&&T<=1)){t.value?O():c===void 0&&v(E);return}t.value=!N&&(t.value||B)&&T<si,t.value?c=void 0:(N||B||c===void 0)&&v(E),N&&E.scrollTop<Un&&E.scrollHeight>E.clientHeight+Un&&_()}function b(){const _=e.value;_===void 0||!p(_)||!t.value||M()}function w(){const _=e.value;_!==void 0&&(t.value=!1,n.value=!1,p(_),i=_.scrollTop,v(_))}function O(){const _=e.value;_!==void 0&&(_.scrollTop=_.scrollHeight,i=_.scrollTop,t.value=!0,c=void 0)}function R(_){const E=e.value;if(E===void 0)return()=>{};const y=E.scrollHeight,x=E.scrollTop,N=_&&t.value;return()=>{if(!(e.value!==E||E.scrollTop!==x)){if(N){t.value&&(O(),p(E));return}E.scrollTop=x+(E.scrollHeight-y),i=E.scrollTop,p(E),t.value||v(E)}}}function $(){return R(!0)}function D(){return R(!1)}async function M(_=()=>!0){const E=e.value;E===void 0||!_()||(O(),await Me(),!(e.value!==E||!t.value||!_())&&(O(),await new Promise(y=>requestAnimationFrame(()=>y())),!(e.value!==E||!t.value||!_())&&(O(),await new Promise(y=>setTimeout(y,50)),!(e.value!==E||!t.value||!_())&&O())))}return{element:e,following:t,positioningInitialConversation:n,setElement:m,handleScroll:g,handleResize:b,stopFollowing:w,scrollToLatest:O,captureRenderAnchor:$,capturePrependAnchor:D,scrollToLatestAfterLayout:M}}const li=5e3;function nn(e){return`session:${e===void 0||e.startsWith("draft:")?"draft":e}`}function Pp(){const e=ci(),t={};return{...e.bind(()=>t),clear:e.clear,transferSession:(n,o)=>e.transfer(t,t,n,o)}}function ci(){let e=new WeakMap;const t=new Map,n=new Set,o=new WeakMap;function a(g){const b=JSON.stringify([g.nodeId,g.workspaceId,g.kind,g.kind==="session"?g.sessionId:null]);let w=t.get(b);return w===void 0&&(w={},t.set(b,w),o.set(w,b)),w}const r=K(0),i={};function c(g){let b=e.get(g);return b===void 0&&(b={slots:new Set([g]),tokens:mt([])},e.set(g,b)),b}function m(g){const b=X(()=>(r.value,c(g()??i)));function w(O,R,$=li){const D=b.value;if(D.tokens.value.length!==0)return;const M={group:D,context:O,active:!0};function _(){return M.active?(M.active=!1,clearTimeout(M.timeout),n.delete(_),M.group.tokens.value=M.group.tokens.value.filter(E=>E!==M),!0):!1}return D.tokens.value=[...D.tokens.value,M],n.add(_),$!==null&&(M.timeout=setTimeout(()=>{_()&&R?.()},$)),_}return{pending:X(()=>b.value.tokens.value.length!==0),context:X(()=>b.value.tokens.value.find(O=>O.context!==void 0)?.context),begin:w}}function p(g,b,w,O,R=!1){const $=e.get(g);if($===void 0)return;const D=e.get(b)??$;for(const M of $.tokens.value)M.context===nn(w)&&(M.context=nn(O)),M.group=D;if(D!==$){D.tokens.value=[...D.tokens.value,...$.tokens.value];for(const M of $.slots)e.set(M,D),D.slots.add(M)}else D.tokens.value=[...D.tokens.value];if(e.set(b,D),D.slots.add(b),R&&g!==b){e.delete(g),D.slots.delete(g);const M=o.get(g);M!==void 0&&t.get(M)===g&&t.delete(M)}r.value+=1}function v(){for(const g of n)g();t.clear(),e=new WeakMap,r.value+=1}return{bind:m,transfer:p,forTarget:a,clear:v}}const $p="";function Dp(e,t=[]){const n=e??K(t);function o(m){if(n.value.some(v=>v.name===m.name))return!1;const p={name:m.name,source:m.source,skillFilePath:m.skillFilePath,available:!0};return n.value=[...n.value,p],!0}function a(m){n.value=n.value.filter(p=>p.name!==m)}function r(){n.value=[]}function i(m){n.value=m.filter(ko)}function c(m){const p=new Map(m.map(v=>[v.name,v]));n.value=n.value.map(v=>{const g=p.get(v.name);return g===void 0?{...v,available:!1}:{name:g.name,source:g.source,skillFilePath:g.skillFilePath,available:!0}})}return{tokens:n,select:o,remove:a,clear:r,restore:i,reconcile:c}}function di(e,t,n=[]){const o=[t,e.length>0?jt("mar_skills",{action:"use",instruction:ia,skills:e.map(a=>({name:a.name,source:a.source,path:a.skillFilePath}))}):"",n.length>0?jt("mar_references",{references:[...n]}):""].filter(a=>a.length>0).join(`
2
2
  `).trim();if(o.length>no)throw new Error("COMPOSER_MESSAGE_TOO_LARGE");return o}function ui(e){return e.some(t=>!t.available)}function Lp(e){return Array.isArray(e)?e.filter(ko):[]}function ko(e){return typeof e=="object"&&e!==null&&"name"in e&&typeof e.name=="string"&&e.name.length>0&&"source"in e&&(e.source==="NODE_HOME"||e.source==="WORKSPACE")&&"skillFilePath"in e&&typeof e.skillFilePath=="string"&&e.skillFilePath.length>0&&"available"in e&&typeof e.available=="boolean"}const Co=new Set(["SUCCEEDED","FAILED","CANCELLED","INTERRUPTED","LOST"]);function Bn(e){return e==="STARTING"?1:e==="RUNNING"?2:e==="CANCELLING"?3:Co.has(e)?4:-1}function ze(e){return Co.has(e)}function Gt(e,t){return e===void 0?t:e.version!==void 0&&t.version!==void 0&&e.version!==t.version?e.version>t.version?e:t:Bn(e.status)>Bn(t.status)?e:t}function fi(e,t){return e?.id??t.workspaceId}function mi(e,t){return e??(t?"QUEUE":"SEND")}function Mp(e){const t=oo(),n=()=>t?.active!==!1;let o;const a=(i,c,m,p,v,g)=>JSON.stringify([i,c,m,p,v,g.map(b=>b.id)]);async function r(i,c=!1,m,p){if(!n()||e.workspaceTarget.value?.nodeId===void 0||!e.composerOpen.value||e.submissionAvailable?.()===!1)return;const v=e.workspaceTarget.value?.nodeId,g=e.workspaceTarget.value?.workspaceId,b=()=>e.workspaceTarget.value?.nodeId===v&&e.workspaceTarget.value?.workspaceId===g,w=e.captureDraft();if(w===void 0)return;const O=w.input,R=w.skillTokens,$=w.references,D=O.value,_=D.trim();if(p===void 0&&m===void 0&&ui(R.value)){e.notice(l("composer.skillUnavailable"),"warning");return}let E;try{E=p?.input??m??di(R.value,O.value,$?.value)}catch(me){e.notice(l("generated.workbenchSessionMessageService.unableToSendTheMessage",{value0:e.errorMessage(me)}),"error",me);return}const y=p?.command??(m===void 0?e.selectedCommand.value:void 0);if(y!==void 0&&e.commandAvailable?.(y)===!1||y===void 0&&E.length===0&&e.attachments.value.length===0)return;if(e.attachmentsPending.value&&y===void 0&&m===void 0){e.notice(l("generated.workbenchSessionMessageService.attachmentsAreStillUploadingOrFailedWait"),"warning");return}const x=mi(i,e.composerBusy.value),N=e.draftOpen.value||e.selectedSessionId.value?.startsWith("draft:")===!0,B=p?.input??(c&&y!==void 0?`/${y.id}`:E);if(N&&y!==void 0&&!(y.id==="fast"&&y.runner==="codex")){if(y.interaction==="IMMEDIATE_ACTION"||y.interaction==="DESTRUCTIVE_ACTION"){e.notice(l("generated.workbenchSessionMessageService.sendARegularMessageToCreateThe"),"warning");return}e.stageDraftCommand(y,B),c||(O.value="",w.persist()),p===void 0&&(e.selectedCommand.value=void 0,e.commandPickerOpen.value=!1);return}if(y?.interaction==="DESTRUCTIVE_ACTION"){const me=e.selectedSessionId.value;try{await Sa.confirm(l("generated.workbenchSessionMessageService.clearSessionConfirmation"),l("generated.workbenchSessionMessageService.clearSession"),{closeIcon:He("close"),icon:He("warning"),type:"warning",confirmButtonText:l("generated.workbenchSessionMessageService.confirmClearSession"),cancelButtonText:l("generated.workbenchSessionMessageService.cancelClearSession"),confirmButtonClass:"el-button--danger"})}catch{return}if(me===void 0||!b()||e.selectedSessionId.value!==me||e.submissionAvailable?.()===!1||e.commandAvailable?.(y)===!1)return}const T=m===void 0?[...e.attachments.value]:[],W=R.value,S=$?.value,G=e.selectedWorkspace.value;let h=!1,A,U,z;const Z=e.selectedSessionId.value,F=e.beginSubmission(nn(Z),()=>{n()&&e.workspaceTarget.value?.nodeId===v&&e.workspaceTarget.value?.workspaceId===g&&e.selectedSessionId.value===(A?.id??Z)&&e.notice(l("workbench.submissionTimedOut"),"warning")});if(F===void 0)return;const q=w.retain?.(),ee=me=>{q!==void 0?q.settle(me):(me(),w.persist())},se=e.retainAttachments(y===void 0?T:[]);let pe=!1;try{if(y?.id==="fast"&&y.runner==="codex"){const ue=await e.request("/api/runner-commands",{method:"POST",body:JSON.stringify({nodeId:v,runner:"codex",commandId:"fast",input:`/fast ${e.fastEnabled.value?"off":"on"}`})});F()&&b()&&e.selectedSessionId.value===Z&&(e.fastEnabled.value=ue.enabled,!c&&O.value===D&&D.trim()===E&&ee(()=>{O.value=""}),p===void 0&&(e.selectedCommand.value=void 0,e.commandPickerOpen.value=!1));return}const me=N;h=me;const ge=e.draftOpen.value?await e.draft?.create(e.temporaryTitle(_)):e.selectedSession.value;if(!n())return;if(ge===void 0)throw new Error("SESSION_NOT_FOUND");if(A=ge,me&&ge.id.startsWith("draft:")&&(U=e.sessions.value.find(ue=>ue.id===ge.id&&ue.workspaceId===ge.workspaceId)),y!==void 0){await e.executeCommand(ge,y,B),F()&&(!c&&O.value===D&&D.trim()===E&&ee(()=>{O.value=""}),p===void 0&&b()&&e.selectedSessionId.value===ge.id&&(e.selectedCommand.value=void 0,e.commandPickerOpen.value=!1));return}if(me&&G===void 0)throw new Error(l("generated.workbenchSessionMessageService.selectAWorkspaceBeforeSendingAMessage"));const J=fi(G,ge),V=a(v,J,ge.id,E,x,T);o?.signature!==V&&(o=void 0);const ie=o?.clientMessageId??ct();z={signature:V,clientMessageId:ie},o=z,e.scrollToLatest();const j=await e.request(me?"/api/agent-sessions/start":`/api/agent-sessions/${e.sessionPathId(ge.id)}/messages`,{method:"POST",body:JSON.stringify({nodeId:v,...me?{workspaceId:J,runner:ge.runner,cwd:G.path,modelId:ge.modelId,effort:ge.effort,access:ge.access,...ge.runnerTitle?{title:ge.runnerTitle}:{},deferredCommands:e.deferredCommands.value.map(ue=>({commandId:ue.command.id,input:ue.input}))}:{workspaceId:J,...ge.runner==="mar-agent"?{modelId:ge.modelId}:{}},clientMessageId:ie,content:E,deliveryIntent:x,computerUse:ge.runner==="mar-agent",attachmentIds:T.map(ue=>ue.id)})});if(!n())return;e.consumeAttachments(T),me&&w.createdSession?.(j.session),o===z&&(o=void 0),me&&b()&&e.selectedSessionId.value===ge.id&&(e.deferredCommands.value=[]);const Q=e.selectedSessionId.value,te=b(),ve=te&&Q===ge.id;if(ge.id!==j.session.id&&e.migrateSessionCache(v,ge.workspaceId,ge.id,j.session.id,j.session),te&&e.replaceSession(ge.id,j.session),me&&te&&e.selectedSessionId.value===j.session.id&&e.beginSessionWatch(j.session.id),ve||te&&Q===j.session.id){const ue=e.acceptRun({...j.run,sessionId:j.run.sessionId??j.session.id});(j.delivery===void 0||j.delivery==="STARTED")&&!ze(ue.status)&&e.openRun(j.run.id)}else e.cacheRun(v,ge.workspaceId,{...j.run,sessionId:j.run.sessionId??j.session.id,workspaceId:j.run.workspaceId??ge.workspaceId});(ve||te&&(Q===j.session.id||e.selectedSessionId.value===j.session.id))&&e.scrollToLatestAfterLayout(),pe=F(),m===void 0&&O.value===D&&R.value===W&&$?.value===S&&ee(()=>{O.value="",R.value=[],$!==void 0&&($.value=[])})}catch(me){if(!n())return;if(o===z&&Xe(me)!==void 0&&(o=void 0),pe=F(),h&&pe){const ge=U!==void 0&&e.sessions.value.includes(U);b()&&ge&&U!==void 0&&e.removeSessionExact(U),b()&&ge&&e.selectedSessionId.value===A?.id&&e.draft?.restore()}pe&&e.notice(l("generated.workbenchSessionMessageService.unableToSendTheMessage",{value0:e.errorMessage(me)}),"error",me)}finally{q?.release(),se(),F()}}return{send:r}}function Op(e){const t=oo(),n=a=>Xe(a)==="RUN_NOT_FOUND";async function o(){const a=e.workspaceTarget.value?.nodeId,r=e.workspaceTarget.value?.workspaceId,i=e.selectedSessionId.value;if(a===void 0||r===void 0||i===void 0)return;const c=e.currentRevision(),m=()=>t?.active!==!1&&e.workspaceTarget.value?.nodeId===a&&e.workspaceTarget.value.workspaceId===r&&e.selectedSessionId.value===i&&e.currentRevision()===c,p=e.activeRun.value,v=e.beginSubmission(`session:${i}`);if(v!==void 0){if(p===void 0){try{const g=await e.request(`/api/agent-sessions/${e.sessionPathId(i)}/interrupt`,{method:"POST",body:JSON.stringify({nodeId:a})});m()&&(e.runService.mergeSnapshots([g.run]),e.selectedRunId.value=g.run.id)}catch(g){const b=v();m()&&!n(g)&&b&&e.notice(l("generated.workbenchRunControlService.runOperationDenied",{value0:e.errorMessage(g)}),"error",g)}finally{v()}return}try{const g=await e.request(`/api/agent-runs/${encodeURIComponent(p.id)}/interrupt`,{method:"POST",body:JSON.stringify({nodeId:a})});m()&&g.run!==void 0&&e.runService.replaceExistingRun(g.run)}catch(g){const b=v();m()&&!n(g)&&b&&e.notice(l("generated.workbenchRunControlService.runOperationDenied2",{value0:e.errorMessage(g)}),"error",g)}finally{v()}}}return{stopActiveRun:o}}async function gi(e){return Ta(new Uint8Array(await e.arrayBuffer()))}const Fn=5*1024*1024,vi=16e6;function wo(e){return["image/bmp","image/x-bmp","image/x-ms-bmp","image/x-windows-bmp"].includes(e.type)||(e.type===""||e.type==="application/octet-stream")&&/\.bmp$/iu.test(e.name)}async function pi(e){if(!wo(e))return e;if(e.size===0||e.size>Fn)throw new Error("COMPOSER_IMAGE_LIMIT_EXCEEDED");let t;try{if(t=await createImageBitmap(e),t.width*t.height>vi)throw new Error("COMPOSER_IMAGE_LIMIT_EXCEEDED");const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const o=n.getContext("2d");if(o===null)throw new Error("COMPOSER_IMAGE_CONVERSION_FAILED");o.drawImage(t,0,0);const a=await new Promise(i=>n.toBlob(i,"image/png"));if(a===null||a.size===0||a.type!=="image/png")throw new Error("COMPOSER_IMAGE_CONVERSION_FAILED");if(a.size>Fn)throw new Error("COMPOSER_IMAGE_LIMIT_EXCEEDED");const r=/\.bmp$/iu.test(e.name)?e.name.replace(/\.bmp$/iu,".png"):`${e.name}.png`;return new File([a],r,{type:"image/png",lastModified:e.lastModified})}catch(n){throw Xe(n)==="COMPOSER_IMAGE_LIMIT_EXCEEDED"?n:new Error("COMPOSER_IMAGE_CONVERSION_FAILED")}finally{t?.close()}}const hi=5,_i=5*1024*1024,Hn=10*1024*1024,bi=512*1024;function Np(e){const t=K([]);let n=new Map;const o=(S,G)=>S!==void 0&&G!==void 0&&S.nodeId===G.nodeId&&S.workspaceId===G.workspaceId&&S.pane===G.pane,a=(S,G="main")=>S===void 0?void 0:{nodeId:S.nodeId,workspaceId:S.workspaceId,pane:G},r=()=>a(e.context()),i=new Map,c=S=>JSON.stringify([S.nodeId,S.workspaceId,S.id]);function m(S){return S===void 0?[]:t.value.filter(G=>o(n.get(G.id),S))}const p=X(()=>m(r())),v=K(!1),g=K(),b=K(!1),w=new Map,O=new Map,R=S=>n.has(S.id);function $(S,G){for(const h of G){const A=m(S);if(A.length>=hi)return e.notice(l("generated.composerAttachmentService.theFirstMessageCanIncludeUpTo"),"warning");if(h.size===0||h.size>_i){e.notice(l("generated.composerAttachmentService.attachmentMustBeLargerThan0And",{value0:h.name}),"warning");continue}if(A.reduce((Z,F)=>Z+F.file.size,0)+h.size>Hn)return e.notice(l("generated.composerAttachmentService.totalAttachmentSizeCannotExceed10MiB"),"warning");if(S===void 0)return e.notice(l("generated.composerAttachmentService.selectAnOnlineWorkspaceBeforeAddingAttachments"),"warning");const z={id:ct(),file:h,nodeId:S.nodeId,workspaceId:S.workspaceId,previewUrl:h.type.startsWith("image/")?URL.createObjectURL(h):null,receivedBytes:0,status:"UPLOADING"};n.set(z.id,{...S}),t.value=[...t.value,z],B(z)}}function D(S){const G=t.value.find(h=>h.id===S);g.value?.id===S&&(b.value=!1),G?.previewUrl!==null&&G?.previewUrl!==void 0&&URL.revokeObjectURL(G.previewUrl),t.value=t.value.filter(h=>h.id!==S),n.delete(S),G!==void 0&&W(G)}function M(S,G=!0){if(S===void 0)return;const h=m(S);h.some(U=>U.id===g.value?.id)&&(b.value=!1);for(const U of h)U.previewUrl!==null&&URL.revokeObjectURL(U.previewUrl),G&&W(U),n.delete(U.id);const A=new Set(h.map(U=>U.id));t.value=t.value.filter(U=>!A.has(U.id))}function _(){b.value=!1,g.value=void 0,v.value=!1;for(const S of t.value)S.previewUrl!==null&&URL.revokeObjectURL(S.previewUrl),W(S,!1);t.value=[],n=new Map}function E(S){const G=S.map(c);for(const A of G)i.set(A,(i.get(A)??0)+1);let h=!1;return()=>{if(!h){h=!0;for(const A of G){const U=i.get(A)-1;U===0?i.delete(A):i.set(A,U)}}}}function y(S){t.value=t.value.filter(G=>S.some(h=>h.id===G.id&&h.nodeId===G.nodeId&&h.workspaceId===G.workspaceId)?(g.value?.id===G.id&&(b.value=!1),G.previewUrl!==null&&URL.revokeObjectURL(G.previewUrl),n.delete(G.id),!1):!0)}function x(S){S.previewUrl!==null&&(g.value=S,b.value=!0)}function N(S,G="main"){const h=()=>a(S(),G);return{attachments:X(()=>m(h())),add:A=>$(h(),A),remove:A=>{o(n.get(A),h())&&D(A)},clear:(A=!0)=>M(h(),A)}}async function B(S){const G=n;try{if(wo(S.file)){const z=await pi(S.file),Z=t.value.find(q=>q.id===S.id);if(Z===void 0)return;if(t.value.filter(q=>o(n.get(q.id),n.get(Z.id))).reduce((q,ee)=>q+(ee.id===Z.id?z.size:ee.file.size),0)>Hn)throw new Error("COMPOSER_IMAGE_LIMIT_EXCEEDED");Z.file=z,S=Z}const h=e.direct?.generation(S.nodeId);if(h!==void 0){const z=new AbortController;w.set(S.id,z);try{if(!t.value.some(q=>q.id===S.id))throw new Error("UPLOAD_CANCELLED");S.transport="DIRECT";const Z=await gi(S.file);if(z.signal.aborted)throw new Error("UPLOAD_CANCELLED");await e.direct.upload({nodeId:S.nodeId,nodeGeneration:h,descriptor:{direction:"UPLOAD",resource:{kind:"WORKSPACE_FILE",workspaceId:S.workspaceId,path:S.file.name},fileName:S.file.name,size:S.file.size,sha256:Z,overwrite:!1,composerAttachment:{id:S.id,mime:S.file.type||"application/octet-stream"}},file:S.file,onProgress:q=>{S.receivedBytes=q},signal:z.signal});const F=t.value.find(q=>q.id===S.id);F!==void 0&&(F.status="COMPLETED");return}catch{if(!t.value.some(Z=>Z.id===S.id))return;S.receivedBytes=0,S.transport="SERVER",S.directFallback=!0}finally{w.delete(S.id)}}S.transport="SERVER";const A=await e.request(`/api/workspaces/${encodeURIComponent(S.workspaceId)}/uploads`,{method:"POST",body:JSON.stringify({nodeId:S.nodeId,name:S.file.name,mime:S.file.type||"application/octet-stream",size:S.file.size,overwrite:!1,composerAttachmentId:S.id})});if(!t.value.some(z=>z.id===S.id)){G===n&&await W({...S,uploadId:A.upload.uploadId});return}const U=t.value.find(z=>z.id===S.id);if(U===void 0)return;for(U.uploadId=A.upload.uploadId,U.receivedBytes=A.upload.receivedBytes;U.receivedBytes<U.file.size;){if(!R(U))return;const z=U.receivedBytes,Z=U.file.slice(z,Math.min(U.file.size,z+bi)),F=await T(U,z,Z);if(!R(U))return;U.receivedBytes=F.receivedBytes}if(!R(U))return;if(U.uploadId===void 0)throw new Error("COMPOSER_ATTACHMENT_UPLOAD_FAILED");await e.request(`/api/workspaces/${encodeURIComponent(S.workspaceId)}/uploads/${encodeURIComponent(U.uploadId)}/complete`,{method:"POST",body:JSON.stringify({nodeId:S.nodeId})}),U.status="COMPLETED"}catch(h){const A=t.value.find(U=>U.id===S.id);if(A===void 0)return;A.status="FAILED",A.error=uo(h),window.setTimeout(()=>D(S.id),1e3)}}async function T(S,G,h){let A,U=!1;for(let z=0;z<3;z+=1){if(!R(S))throw new Error("UPLOAD_CANCELLED");try{return await new Promise((Z,F)=>{const q=new XMLHttpRequest;O.set(S.id,q);const ee=`/api/workspaces/${encodeURIComponent(S.workspaceId)}/uploads/${encodeURIComponent(S.uploadId??"")}/chunks?nodeId=${encodeURIComponent(S.nodeId)}&offset=${G}`;q.open("POST",e.resourceUrl?.(ee)??ee),q.withCredentials=!0,q.setRequestHeader("content-type","application/octet-stream"),q.setRequestHeader("x-csrf-token",e.csrfToken.value),q.upload.onprogress=se=>{se.lengthComputable&&(S.receivedBytes=Math.min(S.file.size,G+se.loaded))},q.onerror=()=>F(new Error("UPLOAD_NETWORK_FAILED")),q.onabort=()=>F(new Error("UPLOAD_CANCELLED")),q.onload=()=>{if(!R(S)){F(new Error("UPLOAD_CANCELLED"));return}if(q.status<200||q.status>=300){let se;try{se=JSON.parse(q.responseText).error?.code}catch{se=void 0}se==="UNAUTHENTICATED"&&e.onUnauthenticated(),F(new Error(se??`REQUEST_FAILED_${q.status}`));return}try{const se=JSON.parse(q.responseText);if(!Number.isSafeInteger(se.upload?.receivedBytes))throw new Error("NODE_RESPONSE_INVALID");Z({receivedBytes:se.upload?.receivedBytes})}catch(se){F(se)}},q.send(h)})}catch(Z){if(A=Z,!R(S)||Xe(Z)==="UPLOAD_CANCELLED"||Xe(Z)==="UNAUTHENTICATED")throw Z;if(Xe(Z)==="CSRF_INVALID"){if(U)throw Z;U=!0,await e.renewCsrfToken()}S.receivedBytes=G}finally{O.delete(S.id)}}throw A instanceof Error?A:new Error("COMPOSER_ATTACHMENT_UPLOAD_FAILED")}async function W(S,G=!0){if(w.get(S.id)?.abort(),w.delete(S.id),O.get(S.id)?.abort(),O.delete(S.id),!G||i.has(c(S)))return;const h=S.status==="COMPLETED"?S.id:S.uploadId;h!==void 0&&await e.request(`/api/workspaces/${encodeURIComponent(S.workspaceId)}/uploads/${encodeURIComponent(h)}/cancel`,{method:"POST",body:JSON.stringify({nodeId:S.nodeId})}).catch(()=>{})}return{attachments:p,dragging:v,preview:g,previewOpen:b,add:S=>$(r(),S),remove:D,clear:(S=!0)=>M(r(),S),clearAll:_,forTarget:N,retainForSubmission:E,consume:y,openPreview:x}}const et=new Set(["STARTING","RUNNING","CANCELLING"]);function jp(e){const t=K([]),n=K(),o=new Set,a=new Set,r=new Set,i=new Map;function c(_){const E=t.value.find(x=>x.id===_.id),y=Gt(E,_);return t.value=[y,...t.value.filter(x=>x.id!==_.id)],y}function m(_){t.value=[..._]}function p(_){t.value=t.value.map(E=>E.id===_.id?_:E)}function v(_){const E=new Map(t.value.map(T=>[T.id,T])),y=new Set(_.map(T=>T.id));for(const T of _)ze(T.status)&&i.delete(T.id);const N=_.filter(T=>!et.has(T.status)||!a.has(T.sessionId??"")&&!i.has(T.id)).map(T=>Gt(E.get(T.id),T)),B=t.value.filter(T=>T.sessionId===e.value&&!y.has(T.id)&&et.has(T.status));t.value=[...B,...N];for(const T of t.value)T.sessionId!==void 0&&et.has(T.status)&&o.delete(T.sessionId)}function g(_,E){for(const h of _){const A=i.get(h.id);A!==void 0&&!A.requested&&A.sessionId===h.sessionId&&et.has(h.status)&&!r.has(A.sessionId)&&!a.has(A.sessionId)&&i.delete(h.id)}const y=new Map(E.map(h=>[h.id,h])),x=new Map(t.value.map(h=>[h.id,h])),N=new Set(_.map(h=>h.id)),B=t.value.filter(h=>{if(N.has(h.id))return!1;const A=y.get(h.id);return A===void 0||h.sessionId!==A.sessionId||h.workspaceId!==A.workspaceId||h.version!==A.version||h.status!==A.status||h.recoveryState!==A.recoveryState||h.clientMessageId!==A.clientMessageId||h.createdAt!==A.createdAt}),W=_.filter(h=>!et.has(h.status)||!a.has(h.sessionId??"")&&!i.has(h.id)).map(h=>Gt(x.get(h.id),h)),S=new Set(B.map(h=>h.id)),G=E.filter(h=>!N.has(h.id)&&!S.has(h.id));t.value=[...B,...W],n.value!==void 0&&!t.value.some(h=>h.id===n.value&&et.has(h.status))&&(n.value=void 0);for(const h of _)ze(h.status)&&i.delete(h.id);for(const h of G)i.delete(h.id);for(const h of t.value)h.sessionId!==void 0&&et.has(h.status)&&o.delete(h.sessionId)}function b(_,E){E!==void 0&&!o.has(_)||(o.add(_),E!==void 0&&(a.delete(_),i.set(E,{sessionId:_,requested:!0})))}function w(_){o.add(_),a.add(_),r.add(_);for(const E of i.values())E.sessionId===_&&(E.requested=!0)}function O(_,E=!1){const y=new Set(t.value.filter(x=>x.sessionId===_&&et.has(x.status)).map(x=>x.id));y.size>0&&(t.value=t.value.filter(x=>!y.has(x.id))),n.value!==void 0&&y.has(n.value)&&(n.value=void 0),y.size>0&&o.add(_),E&&w(_);for(const x of y)i.set(x,{sessionId:_,requested:r.has(_)||i.get(x)?.requested===!0});return y.size>0}function R(_){r.has(_)||o.delete(_)}function $(_){o.delete(_),a.delete(_),r.delete(_);for(const[E,y]of i)y.sessionId===_&&i.delete(E)}function D(_){o.delete(_),a.delete(_),r.delete(_)}function M(_){return _!==void 0&&o.has(_)}return{runs:t,selectedRunId:n,acceptRun:c,replaceRuns:m,replaceExistingRun:p,mergeSnapshots:v,mergeAuthoritativeSnapshot:g,markSessionInterrupted:b,markSessionInterruptionPending:w,settleSessionRuns:O,observeSessionRunning:R,clearSessionInterruption:$,resumeSessionAfterInterruption:D,sessionInterruptionSettled:M}}function qp(e){const t=K(),n=K(),o=e?.draft??K(),a=X({get:()=>o.value?.content??"",set:m=>{o.value!==void 0&&(o.value={...o.value,content:m},e?.persist())}});function r(m){if(n.value=m.queueItemId,o.value?.queueItemId===m.queueItemId)return;const p=sn(m.content),v=p.flatMap(w=>w.kind==="text"?[w.text]:w.kind==="mar_steer"?[w.payload.message]:[]).join("").trim(),g=p.filter(w=>w.kind!=="text"&&w.kind!=="mar_steer"&&w.kind!=="mar_session_origin"&&w.kind!=="mar_channel").map(w=>w.raw).join(`
3
3
  `),b=p.filter(w=>w.kind==="mar_session_origin"||w.kind==="mar_channel").map(w=>w.raw).join(`
4
4
  `);o.value={queueItemId:m.queueItemId,content:v,tags:g,origin:b},e?.persist()}function i(){o.value?.queueItemId===n.value&&(o.value=void 0,e?.persist()),n.value=void 0}function c(){t.value=void 0,n.value=o.value?.queueItemId}return{draggingQueueItemId:t,editingQueueItemId:n,editingContent:a,startEditing:r,finishEditing:i,rebind:c,serializeEditedContent:m=>[o.value?.origin,m.trim(),o.value?.tags].filter(Boolean).join(`
@@ -1 +1 @@
1
- import{r as J,a as q,b as U,c as _,d as B,f as x,g as j,h as G,i as V,j as F}from"./index-HcLGmFz6.js";const z=1e4;function K(n){const i=new Map,I=new Set;let s,o,l=500,k=!1,g,m,y=!1;const c=x(!1);let d,v,P=0;const f=new Map;function S(){v!==void 0&&clearInterval(v),v=void 0,f.clear()}function N(){if(s===void 0||s.readyState!==WebSocket.OPEN)return;if(f.size>0){w();return}const t=String(++P);f.set(t,performance.now()),s.send(JSON.stringify({type:"ping",id:t}))}function R(){S(),N(),v=setInterval(N,z)}function D(){const t=new URL(n.endpoint?.()??"/api/workbench/live",window.location.origin);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.toString()}function M(){}function b(){if(c.value)return Promise.resolve(!0);if(d===void 0){let t;d={promise:new Promise(a=>{t=a}),resolve:t}}return d.promise}function p(t){const e=d;d=void 0,e?.resolve(t)}function E(t){if(typeof t!="object"||t===null||Array.isArray(t))return;const e=t;if(e.type==="workbench.ready"&&typeof e.workbenchConnectionId=="string"&&typeof e.workbenchResumeToken=="string"){n.diagnostics?.setConnectionState("connected"),g=e.workbenchConnectionId,m=e.workbenchResumeToken;const r=e.resumed===!0;c.value=!0,n.onReady?.(g,r),p(!0),y&&n.onConnectionRestored?.(r),y&&r&&n.onReconnect(),y=!1,R();return}if(e.type==="pong"&&typeof e.id=="string"){const r=f.get(e.id);r!==void 0&&(f.delete(e.id),n.diagnostics?.setPingLatency?.(performance.now()-r));return}if(e.type==="watch.event"&&e.event!==void 0){n.onWatchEvent?.(e.event);return}if(typeof e.type=="string"&&e.type.startsWith("direct.")){const r=j.safeParse(e);if(!r.success){n.onInvalidMessage();return}n.onDirectMessage?.(r.data);return}if(typeof e.type=="string"&&e.type.startsWith("terminal.direct.")){const r=G.safeParse(e);if(!r.success){n.onInvalidMessage();return}n.onTerminalDirectMessage?.(r.data);return}if(typeof e.type=="string"&&e.type.startsWith("desktop.direct.")){const r=V.safeParse(e);r.success?n.onDesktopDirectMessage?.(r.data):n.onInvalidMessage();return}if(typeof e.type=="string"&&e.type.startsWith("desktop.relay.")){const r=F.safeParse(e);r.success?n.onDesktopRelayMessage?.(r.data):n.onInvalidMessage();return}if(n.onNotificationMessage?.(e))return;if(e.type==="resync-required"&&typeof e.nodeId=="string"){n.diagnostics?.resetActiveRuns(),i.delete(e.nodeId),n.onResyncRequired(e.nodeId);return}if(e.type==="node.upgrade"&&typeof e.nodeId=="string"){n.onNodeUpgrade?.(e.nodeId,e.snapshot);return}if(e.type==="node"&&typeof e.nodeId=="string"&&typeof e.connected=="boolean"){let r=!1;e.connected?I.delete(e.nodeId)&&(i.delete(e.nodeId),r=!0):(I.add(e.nodeId),i.delete(e.nodeId)),n.onNodeConnection(e.nodeId,e.connected),e.reason==="CONNECTION_REPLACED"&&(n.diagnostics?.resetActiveRuns(),i.delete(e.nodeId),n.onNodeReplaced(e.nodeId),r=!0),r&&n.onResyncRequired(e.nodeId);return}if(e.type!=="event"||typeof e.event!="object"||e.event===null)return;const a=e.event;if(typeof a.nodeId!="string"||!Number.isInteger(a.sequence)||typeof a.category!="string")return;const u=a.sequence;u<=(i.get(a.nodeId)??0)||(i.set(a.nodeId,u),n.onEvent(a))}function h(){if(!n.canConnect()||s!==void 0)return;n.diagnostics?.setConnectionState("connecting");const t=new WebSocket(D());s=t,t.addEventListener("open",()=>{if(s!==t)return;const e=k;k=!0,l=500,i.clear(),y=e,c.value=!1,t.send(JSON.stringify({type:"resume",...g===void 0?{}:{workbenchConnectionId:g},...m===void 0?{}:{workbenchResumeToken:m}}))}),t.addEventListener("message",e=>{if(s!==t)return;const a=performance.now(),u=String(e.data);let r;try{r=JSON.parse(u),E(r)}catch{n.onInvalidMessage()}finally{n.diagnostics?.observeFrame({bytes:u.length,durationMs:performance.now()-a,message:r})}}),t.addEventListener("close",e=>{if(s===t){if(s=void 0,c.value=!1,S(),n.diagnostics?.setConnectionState("disconnected"),e.code===4001&&e.reason==="UNAUTHENTICATED"){p(!1),n.onUnauthenticated(),n.onDisconnected?.();return}if(n.onDisconnected?.(),!n.canConnect()){p(!1);return}o=setTimeout(()=>{o=void 0,h()},l),l=Math.min(l*2,3e4)}})}function C(){o!==void 0&&clearTimeout(o),o=void 0;const t=s;s=void 0,c.value=!1,p(!1),S(),n.diagnostics?.setConnectionState("disconnected"),t?.close(1e3,"PAGE_CLOSED")}function w(){if(!n.canConnect())return;o!==void 0&&clearTimeout(o),o=void 0;const t=s;s=void 0,c.value=!1,S(),n.diagnostics?.setConnectionState("connecting"),t?.close(4e3,"PAGE_VISIBLE_RECONNECT"),h()}function O(t){const e=B.safeParse(t);return!e.success||!c.value||s===void 0||s.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function T(t){const e=_.safeParse(t);return!e.success||!c.value||s===void 0||s.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function W(t){const e=U.safeParse(t);return!e.success||!c.value||s?.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function A(t){const e=q.safeParse(t);return!e.success||!c.value||s?.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function L(t){c.value&&s?.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:"session-share.visitor",visitor:t}))}return{connected:J(c),waitForReady:b,restore:M,connect:h,reconnect:w,close:C,sendDirect:O,sendTerminalDirect:T,sendDesktopDirect:W,sendDesktopRelay:A,updateShareVisitor:L}}export{K as c};
1
+ import{r as J,a as q,b as U,c as _,d as B,f as x,g as j,h as G,i as V,j as F}from"./index-D25Eg-N7.js";const z=1e4;function K(n){const i=new Map,I=new Set;let s,o,l=500,k=!1,g,m,y=!1;const c=x(!1);let d,v,P=0;const f=new Map;function S(){v!==void 0&&clearInterval(v),v=void 0,f.clear()}function N(){if(s===void 0||s.readyState!==WebSocket.OPEN)return;if(f.size>0){w();return}const t=String(++P);f.set(t,performance.now()),s.send(JSON.stringify({type:"ping",id:t}))}function R(){S(),N(),v=setInterval(N,z)}function D(){const t=new URL(n.endpoint?.()??"/api/workbench/live",window.location.origin);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.toString()}function M(){}function b(){if(c.value)return Promise.resolve(!0);if(d===void 0){let t;d={promise:new Promise(a=>{t=a}),resolve:t}}return d.promise}function p(t){const e=d;d=void 0,e?.resolve(t)}function E(t){if(typeof t!="object"||t===null||Array.isArray(t))return;const e=t;if(e.type==="workbench.ready"&&typeof e.workbenchConnectionId=="string"&&typeof e.workbenchResumeToken=="string"){n.diagnostics?.setConnectionState("connected"),g=e.workbenchConnectionId,m=e.workbenchResumeToken;const r=e.resumed===!0;c.value=!0,n.onReady?.(g,r),p(!0),y&&n.onConnectionRestored?.(r),y&&r&&n.onReconnect(),y=!1,R();return}if(e.type==="pong"&&typeof e.id=="string"){const r=f.get(e.id);r!==void 0&&(f.delete(e.id),n.diagnostics?.setPingLatency?.(performance.now()-r));return}if(e.type==="watch.event"&&e.event!==void 0){n.onWatchEvent?.(e.event);return}if(typeof e.type=="string"&&e.type.startsWith("direct.")){const r=j.safeParse(e);if(!r.success){n.onInvalidMessage();return}n.onDirectMessage?.(r.data);return}if(typeof e.type=="string"&&e.type.startsWith("terminal.direct.")){const r=G.safeParse(e);if(!r.success){n.onInvalidMessage();return}n.onTerminalDirectMessage?.(r.data);return}if(typeof e.type=="string"&&e.type.startsWith("desktop.direct.")){const r=V.safeParse(e);r.success?n.onDesktopDirectMessage?.(r.data):n.onInvalidMessage();return}if(typeof e.type=="string"&&e.type.startsWith("desktop.relay.")){const r=F.safeParse(e);r.success?n.onDesktopRelayMessage?.(r.data):n.onInvalidMessage();return}if(n.onNotificationMessage?.(e))return;if(e.type==="resync-required"&&typeof e.nodeId=="string"){n.diagnostics?.resetActiveRuns(),i.delete(e.nodeId),n.onResyncRequired(e.nodeId);return}if(e.type==="node.upgrade"&&typeof e.nodeId=="string"){n.onNodeUpgrade?.(e.nodeId,e.snapshot);return}if(e.type==="node"&&typeof e.nodeId=="string"&&typeof e.connected=="boolean"){let r=!1;e.connected?I.delete(e.nodeId)&&(i.delete(e.nodeId),r=!0):(I.add(e.nodeId),i.delete(e.nodeId)),n.onNodeConnection(e.nodeId,e.connected),e.reason==="CONNECTION_REPLACED"&&(n.diagnostics?.resetActiveRuns(),i.delete(e.nodeId),n.onNodeReplaced(e.nodeId),r=!0),r&&n.onResyncRequired(e.nodeId);return}if(e.type!=="event"||typeof e.event!="object"||e.event===null)return;const a=e.event;if(typeof a.nodeId!="string"||!Number.isInteger(a.sequence)||typeof a.category!="string")return;const u=a.sequence;u<=(i.get(a.nodeId)??0)||(i.set(a.nodeId,u),n.onEvent(a))}function h(){if(!n.canConnect()||s!==void 0)return;n.diagnostics?.setConnectionState("connecting");const t=new WebSocket(D());s=t,t.addEventListener("open",()=>{if(s!==t)return;const e=k;k=!0,l=500,i.clear(),y=e,c.value=!1,t.send(JSON.stringify({type:"resume",...g===void 0?{}:{workbenchConnectionId:g},...m===void 0?{}:{workbenchResumeToken:m}}))}),t.addEventListener("message",e=>{if(s!==t)return;const a=performance.now(),u=String(e.data);let r;try{r=JSON.parse(u),E(r)}catch{n.onInvalidMessage()}finally{n.diagnostics?.observeFrame({bytes:u.length,durationMs:performance.now()-a,message:r})}}),t.addEventListener("close",e=>{if(s===t){if(s=void 0,c.value=!1,S(),n.diagnostics?.setConnectionState("disconnected"),e.code===4001&&e.reason==="UNAUTHENTICATED"){p(!1),n.onUnauthenticated(),n.onDisconnected?.();return}if(n.onDisconnected?.(),!n.canConnect()){p(!1);return}o=setTimeout(()=>{o=void 0,h()},l),l=Math.min(l*2,3e4)}})}function C(){o!==void 0&&clearTimeout(o),o=void 0;const t=s;s=void 0,c.value=!1,p(!1),S(),n.diagnostics?.setConnectionState("disconnected"),t?.close(1e3,"PAGE_CLOSED")}function w(){if(!n.canConnect())return;o!==void 0&&clearTimeout(o),o=void 0;const t=s;s=void 0,c.value=!1,S(),n.diagnostics?.setConnectionState("connecting"),t?.close(4e3,"PAGE_VISIBLE_RECONNECT"),h()}function O(t){const e=B.safeParse(t);return!e.success||!c.value||s===void 0||s.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function T(t){const e=_.safeParse(t);return!e.success||!c.value||s===void 0||s.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function W(t){const e=U.safeParse(t);return!e.success||!c.value||s?.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function A(t){const e=q.safeParse(t);return!e.success||!c.value||s?.readyState!==WebSocket.OPEN?!1:(s.send(JSON.stringify(e.data)),!0)}function L(t){c.value&&s?.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:"session-share.visitor",visitor:t}))}return{connected:J(c),waitForReady:b,restore:M,connect:h,reconnect:w,close:C,sendDirect:O,sendTerminalDirect:T,sendDesktopDirect:W,sendDesktopRelay:A,updateShareVisitor:L}}export{K as c};