@p4code/cli 0.9.21 → 0.9.22

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 (194) hide show
  1. package/dist/{TraceDiagnostics-DEAfnZGb.mjs → TraceDiagnostics-DE0N1Yf6.mjs} +2 -2
  2. package/dist/bin.mjs +1 -1
  3. package/dist/{binCli-IfUU-uWs.mjs → binCli-DC5fHnhS.mjs} +5 -5
  4. package/dist/client/.vite/manifest.json +1101 -1101
  5. package/dist/client/assets/{2NI2N5EU-qP3PpVDC.js → 2NI2N5EU-CgpeJ5KT.js} +2 -2
  6. package/dist/client/assets/{4UO7MD6I-Da5jHHfF.js → 4UO7MD6I-BZfVOqtM.js} +2 -2
  7. package/dist/client/assets/{5B3SVYGG-BGHUtemY.js → 5B3SVYGG-B5V3_tzl.js} +2 -2
  8. package/dist/client/assets/{5GK6JWQ2-DwbHk3MV.js → 5GK6JWQ2-DRzSVTZ0.js} +2 -2
  9. package/dist/client/assets/{5N7A7DKN-B-2quXAp.js → 5N7A7DKN-BX-IFKkJ.js} +2 -2
  10. package/dist/client/assets/{5OC2THR4-DSQWJ0ZQ.js → 5OC2THR4-CGiKcStE.js} +2 -2
  11. package/dist/client/assets/{5S6HY5KT-CAwEcA6I.js → 5S6HY5KT-B5Smgpiz.js} +2 -2
  12. package/dist/client/assets/{6IMQ5BUJ-BABYtiev.js → 6IMQ5BUJ-BSWEueVD.js} +2 -2
  13. package/dist/client/assets/{6OLKWJ4F-CwQRt55E.js → 6OLKWJ4F-0nUReGo5.js} +2 -2
  14. package/dist/client/assets/{74OO7NKP-DZoL_aBI.js → 74OO7NKP-BZ5SCLUX.js} +2 -2
  15. package/dist/client/assets/{75O6YZUN-CoqdPLhF.js → 75O6YZUN-NifBwMlS.js} +2 -2
  16. package/dist/client/assets/{77XECAW3-DM5Itfvk.js → 77XECAW3-_XJOQitm.js} +2 -2
  17. package/dist/client/assets/{ABYRPUBD-C2IaQicJ.js → ABYRPUBD-B5mFmY4q.js} +2 -2
  18. package/dist/client/assets/{AuthSurfaceShell-Dfcdz_aG.js → AuthSurfaceShell-DesOxtee.js} +2 -2
  19. package/dist/client/assets/{BB2UYUI2-DQkTEBDf.js → BB2UYUI2-CxFyfwSJ.js} +2 -2
  20. package/dist/client/assets/{BUM34MOA-DuY83HEN.js → BUM34MOA-Kk83QSsb.js} +2 -2
  21. package/dist/client/assets/{CEQABKGZ-CNAynrzB.js → CEQABKGZ-DLcBenqs.js} +2 -2
  22. package/dist/client/assets/{CXAC5362-B_mhvA6r.js → CXAC5362-BcvLk6NG.js} +2 -2
  23. package/dist/client/assets/{ChatGptUsageButton-DT3CRIhB.js → ChatGptUsageButton-C9D5JFWr.js} +2 -2
  24. package/dist/client/assets/{ChatMarkdown-_SLyl8Hk.js → ChatMarkdown-Ck4FJs_Q.js} +5 -5
  25. package/dist/client/assets/{CodexSetupSection.logic-CqdvWoE6.js → CodexSetupSection.logic-DzEO1qoo.js} +2 -2
  26. package/dist/client/assets/{CommandBlock-DnTIHX5l.js → CommandBlock-C15Q987N.js} +2 -2
  27. package/dist/client/assets/{ConnectAgentSurface-D-Z7Gl3G.js → ConnectAgentSurface-6FVydN17.js} +2 -2
  28. package/dist/client/assets/{DRLTVNUE-Bp-Mh_TD.js → DRLTVNUE-CkNId4Pz.js} +2 -2
  29. package/dist/client/assets/{DYY6UVD2-Dwh9ZkXt.js → DYY6UVD2-B4516qT_.js} +2 -2
  30. package/dist/client/assets/{DevicePanel-MMC7u5qJ.js → DevicePanel-B3CR7kGX.js} +2 -2
  31. package/dist/client/assets/{DeviceSetup-BCrBVLkf.js → DeviceSetup-Lxy9dmqi.js} +2 -2
  32. package/dist/client/assets/{DiffCommentAnnotation-D7iLWjnP.js → DiffCommentAnnotation-CSzNea6G.js} +2 -2
  33. package/dist/client/assets/{DiffFileTree-PCGZGqlB.js → DiffFileTree-CDnFut1y.js} +2 -2
  34. package/dist/client/assets/{DiffPanel-OOedo4tu.js → DiffPanel-KfudIZct.js} +2 -2
  35. package/dist/client/assets/{DiffWorkerPoolProvider-CmorWW2H.js → DiffWorkerPoolProvider-zgaFe3TY.js} +2 -2
  36. package/dist/client/assets/{EmbeddedDesign-CeUGLwuZ.js → EmbeddedDesign-BI3VZqZl.js} +4 -4
  37. package/dist/client/assets/{FNOVOB4O-BJscBtWY.js → FNOVOB4O-Uc8FDPv8.js} +2 -2
  38. package/dist/client/assets/{FileDiff-BMtpmo0v.js → FileDiff-B4Yf4fFg.js} +2 -2
  39. package/dist/client/assets/{FilePreviewPanel-DUqI7pF3.js → FilePreviewPanel-u1jxtxzb.js} +2 -2
  40. package/dist/client/assets/{FoldedSettingsSection-BTMENmDo.js → FoldedSettingsSection-DvzfFn5A.js} +2 -2
  41. package/dist/client/assets/{HDGCDEEZ-BA3H_tu4.js → HDGCDEEZ-DVkQN-82.js} +2 -2
  42. package/dist/client/assets/{HSJLKHB7-BojHXJG0.js → HSJLKHB7-txH19TCj.js} +2 -2
  43. package/dist/client/assets/{IntervalSecondsField-Cpc7UePr.js → IntervalSecondsField-xqmFxAii.js} +2 -2
  44. package/dist/client/assets/JZOYTAAL-BqUoPKcz.js +1 -0
  45. package/dist/client/assets/{K3MD6TGW-hwfRTJ3N.js → K3MD6TGW-4d2yDOzZ.js} +2 -2
  46. package/dist/client/assets/{K7RP3OMA-4mJh9KrG.js → K7RP3OMA-B8vKr81f.js} +2 -2
  47. package/dist/client/assets/{LHDIQX7Q-LIdvhN0m.js → LHDIQX7Q-DAyTfuTY.js} +2 -2
  48. package/dist/client/assets/{LUXOKEGN-B1aHy25-.js → LUXOKEGN-C67XJj3F.js} +2 -2
  49. package/dist/client/assets/{LinkMachineSelect-CM7JZDuM.js → LinkMachineSelect-DoqwB0AR.js} +2 -2
  50. package/dist/client/assets/{MathTypeset-CA2nw_Ej.js → MathTypeset-CMO1aCZc.js} +2 -2
  51. package/dist/client/assets/{ModelLiveLayer-CPk6oSLz.js → ModelLiveLayer-DqW0VhFG.js} +3 -3
  52. package/dist/client/assets/{N3JZAHOW-Dz6QAj1L.js → N3JZAHOW-Bp1sdK_N.js} +2 -2
  53. package/dist/client/assets/{NUIALGQ3-W9kPoZrb.js → NUIALGQ3-D427dlgt.js} +2 -2
  54. package/dist/client/assets/{NoProjectsHero-DrTDAhjM.js → NoProjectsHero-BL0Jsc_V.js} +2 -2
  55. package/dist/client/assets/{O65XPQGZ-CPx16bPB.js → O65XPQGZ-BxqHRP3n.js} +2 -2
  56. package/dist/client/assets/{O7XIQ6OM-CAdGDrqF.js → O7XIQ6OM-CKRD1aP5.js} +2 -2
  57. package/dist/client/assets/{OFQON5FD-DOxYOpsO.js → OFQON5FD-CzS9a25C.js} +2 -2
  58. package/dist/client/assets/{P4ConnectAccountPages-D0qqCxCf.js → P4ConnectAccountPages-Ca1o0JuS.js} +2 -2
  59. package/dist/client/assets/{P4ConnectSidebarSignIn-CtO1hqIS.js → P4ConnectSidebarSignIn-29st82gY.js} +2 -2
  60. package/dist/client/assets/{PJQHF43J-CEic-zJ0.js → PJQHF43J-Ww7-2BqY.js} +2 -2
  61. package/dist/client/assets/{PanelLayoutControls-CPevLAhG.js → PanelLayoutControls-CoWjUmx7.js} +4 -4
  62. package/dist/client/assets/{PierreEntryIcon-oOiSTYpG.js → PierreEntryIcon-UO6zY_i-.js} +2 -2
  63. package/dist/client/assets/{PreviewPanel-BSwObBjW.js → PreviewPanel-BHj7Mvmn.js} +2 -2
  64. package/dist/client/assets/{ProjectDefaultsSettings-BkxL8Xjx.js → ProjectDefaultsSettings-DN1mhFNf.js} +2 -2
  65. package/dist/client/assets/{ProjectFavicon-DYcNXMDQ.js → ProjectFavicon-CyXd4lSF.js} +3 -3
  66. package/dist/client/assets/{ProjectIconPickerDialog-CnlPMGQj.js → ProjectIconPickerDialog-B_D_9SAb.js} +2 -2
  67. package/dist/client/assets/{ProviderAuthTerminal-B1NeqFZE.js → ProviderAuthTerminal-B0GzUrya.js} +2 -2
  68. package/dist/client/assets/{ProviderModelPicker-CLwSFV6Q.js → ProviderModelPicker-DQ3N8RWz.js} +2 -2
  69. package/dist/client/assets/{ProviderSettingsForm-D9GJtzdb.js → ProviderSettingsForm-DefAmKv_.js} +2 -2
  70. package/dist/client/assets/{PullRequestCodeTab-CajEWSe5.js → PullRequestCodeTab-BTwbK3zR.js} +2 -2
  71. package/dist/client/assets/{RHNBAITX-D5lTu0BB.js → RHNBAITX-BsGO-vJB.js} +2 -2
  72. package/dist/client/assets/{ReadOnlySourcePreview-LxG8Br9J.js → ReadOnlySourcePreview-COho36OD.js} +2 -2
  73. package/dist/client/assets/{RenderErrorBoundary-CcI-4Zo3.js → RenderErrorBoundary-CYsCxleQ.js} +2 -2
  74. package/dist/client/assets/{SLD4V6NK-CG_xQFi-.js → SLD4V6NK-BZEKTqDY.js} +2 -2
  75. package/dist/client/assets/{ScheduledTasksSettings-CSygG_5X.js → ScheduledTasksSettings-CpfGXMow.js} +2 -2
  76. package/dist/client/assets/{ScopedSwitch-LzARRHas.js → ScopedSwitch-Cq7B0T7B.js} +2 -2
  77. package/dist/client/assets/{SelfImproveSettingsSection-DjuOvf_q.js → SelfImproveSettingsSection-DZUf-jb0.js} +2 -2
  78. package/dist/client/assets/{SettingsPanels-Ci2h30Aw.js → SettingsPanels-Bk_YhHLm.js} +2 -2
  79. package/dist/client/assets/{SettingsPanels.logic-BkjrmwrI.js → SettingsPanels.logic-UhRGlGN1.js} +2 -2
  80. package/dist/client/assets/{SettingsScopeNotice-96p-bg8p.js → SettingsScopeNotice-Cja-hHOp.js} +2 -2
  81. package/dist/client/assets/{SidebarStageBackdrop-B8YG-M-e.js → SidebarStageBackdrop-DL1ZzaTz.js} +2 -2
  82. package/dist/client/assets/{T3PCR2KE-DyNYo7Zy.js → T3PCR2KE-D049x5K8.js} +2 -2
  83. package/dist/client/assets/{TKWO2OVW-5eCjJCfz.js → TKWO2OVW-Du9gxVgn.js} +2 -2
  84. package/dist/client/assets/{TSHNXIZL-CjI9VTqp.js → TSHNXIZL-pUPHV4Qd.js} +2 -2
  85. package/dist/client/assets/{ThemeEditorPanel-BdfXdTV6.js → ThemeEditorPanel-CcFVvJlQ.js} +2 -2
  86. package/dist/client/assets/{ThreadDetailsItemsMenu-Cgj2yuzU.js → ThreadDetailsItemsMenu-C4wfbepv.js} +4 -4
  87. package/dist/client/assets/{ThreadTerminalDrawer-DBG1eHBS.js → ThreadTerminalDrawer-PkBB7D3Z.js} +2 -2
  88. package/dist/client/assets/{UQJE5E4I-CY9HwTsw.js → UQJE5E4I-BN56DsgT.js} +2 -2
  89. package/dist/client/assets/{USNYFO5S-BW0HcjRg.js → USNYFO5S-DVfAs9Gy.js} +2 -2
  90. package/dist/client/assets/{Virtualizer-NI9bqlwX.js → Virtualizer-Cn_zq3uH.js} +2 -2
  91. package/dist/client/assets/{WEVWDWVA-BF8z-yRH.js → WEVWDWVA-Cz36fo-k.js} +2 -2
  92. package/dist/client/assets/{X5RFHQXM-pdor6bX7.js → X5RFHQXM-CUB_vKAl.js} +2 -2
  93. package/dist/client/assets/{X62E3GBT-C6b2WsLT.js → X62E3GBT-C0wKfqHq.js} +2 -2
  94. package/dist/client/assets/{XBNEOJTC-BxqaKoJL.js → XBNEOJTC-CkYPODhO.js} +2 -2
  95. package/dist/client/assets/{YHV2MVVZ-DO-ICZOV.js → YHV2MVVZ-Cf82W2em.js} +2 -2
  96. package/dist/client/assets/{YURCZMG2-BxKVNupW.js → YURCZMG2-C9tzKn90.js} +2 -2
  97. package/dist/client/assets/{YVG2LODB-BwiP1iS0.js → YVG2LODB-DEZWhxa8.js} +2 -2
  98. package/dist/client/assets/{_chat-DDScEBKF.js → _chat-PsMoIPUC.js} +5 -5
  99. package/dist/client/assets/{_chat.design-360SdjDb.js → _chat.design-CWE-keji.js} +2 -2
  100. package/dist/client/assets/{_chat.index-DsRV2lh0.js → _chat.index-YmI2iiCN.js} +2 -2
  101. package/dist/client/assets/{_chat.new-B_AL_NJ2.js → _chat.new-BQY5ktA8.js} +2 -2
  102. package/dist/client/assets/{_chat.pull-requests-DlL4gjh7.js → _chat.pull-requests-C90JBKAN.js} +2 -2
  103. package/dist/client/assets/{assetUrls-gAudvjhV.js → assetUrls-C78a94Xu.js} +2 -2
  104. package/dist/client/assets/{assets-DaZ46ybf.js → assets-5kUNv3CS.js} +2 -2
  105. package/dist/client/assets/{browserHistoryStore-CIeLvEnV.js → browserHistoryStore-DHI-0j5y.js} +2 -2
  106. package/dist/client/assets/{browserLinkTarget-MQvtO-01.js → browserLinkTarget-D8HUAQg-.js} +2 -2
  107. package/dist/client/assets/{connect-DkCGs4oR.js → connect-Dl6MuR2C.js} +2 -2
  108. package/dist/client/assets/connect-agent-B22xdP4o.js +2 -0
  109. package/dist/client/assets/{design-Djc1_eDF.js → design-BoZx445P.js} +2 -2
  110. package/dist/client/assets/{device-P8L_QiVD.js → device-Ku4cbgo-.js} +2 -2
  111. package/dist/client/assets/{diffRendering-Cb9qJUqp.js → diffRendering-yxIsTMie.js} +2 -2
  112. package/dist/client/assets/{dist-BocOAtMa.js → dist-CkH9xVVz.js} +2 -2
  113. package/dist/client/assets/{duoViewer-Domn2baW.js → duoViewer-_3Xk2sTq.js} +2 -2
  114. package/dist/client/assets/{dynamic-CjS-lEY3.js → dynamic-CwQ-caG2.js} +2 -2
  115. package/dist/client/assets/{embeddedScripts-AO2vzovy.js → embeddedScripts-Cn7aGTAj.js} +2 -2
  116. package/dist/client/assets/{entities-s42SFcbu.js → entities-DOpLfnwX.js} +2 -2
  117. package/dist/client/assets/{fileLinks-BY6FjK66.js → fileLinks-CJ9SYNL6.js} +2 -2
  118. package/dist/client/assets/{fileTreeExpansion-B--IBStv.js → fileTreeExpansion-CdWOFpa-.js} +2 -2
  119. package/dist/client/assets/{getDiffFileInput-B7pCnCeh.js → getDiffFileInput-hLtjvhYr.js} +2 -2
  120. package/dist/client/assets/{index-C5VbGbq-.js → index-etcfxnIt.js} +3 -3
  121. package/dist/client/assets/{lazy-Bpm7QNt6.js → lazy--Qcevr63.js} +4 -4
  122. package/dist/client/assets/{linkedPrompt-DqEOywCR.js → linkedPrompt-D4M9Fbja.js} +2 -2
  123. package/dist/client/assets/{main-BYwnnJ9E.js → main-C04YJQbN.js} +7 -7
  124. package/dist/client/assets/{mediaReference-CW0q8-nM.js → mediaReference-D4rhlY-i.js} +2 -2
  125. package/dist/client/assets/{mediaSource-BgP2sq1w.js → mediaSource-B03Ykm6c.js} +2 -2
  126. package/dist/client/assets/{modelScene-OONljnCt.js → modelScene-CX8s0IGN.js} +2 -2
  127. package/dist/client/assets/{onboarding-DLaBhCVN.js → onboarding-BZ01kUjR.js} +2 -2
  128. package/dist/client/assets/{openFileInPreview-Dpge7x7S.js → openFileInPreview-XKgvCQ1z.js} +2 -2
  129. package/dist/client/assets/{p4ProjectFile-Fd0NSHmZ.js → p4ProjectFile-y2CDxOaL.js} +2 -2
  130. package/dist/client/assets/{pair-BUkFlR8l.js → pair-PXvf9qqC.js} +2 -2
  131. package/dist/client/assets/{phoneViewer-BJj_96At.js → phoneViewer-F9Wt5VkW.js} +2 -2
  132. package/dist/client/assets/{pierre-icons-BptmNFMW.js → pierre-icons-BTVgApcG.js} +2 -2
  133. package/dist/client/assets/{preview-BBssbPEj.js → preview-5pSBET3P.js} +2 -2
  134. package/dist/client/assets/{primary-TNEEuOuT.js → primary-BXI66byW.js} +2 -2
  135. package/dist/client/assets/{primaryCloudLinkState-DbUZbjy4.js → primaryCloudLinkState-DswWb__m.js} +2 -2
  136. package/dist/client/assets/{projectFilesQueryState-CVSEDHhW.js → projectFilesQueryState-B6AeAhgL.js} +2 -2
  137. package/dist/client/assets/{projectScriptEditor-D2C0qPZA.js → projectScriptEditor-DvKvgTs-.js} +2 -2
  138. package/dist/client/assets/{providerSkills-5OBbbZq-.js → providerSkills-D-ytsJU9.js} +2 -2
  139. package/dist/client/assets/{pullRequestDetail.logic-D5hhGj8d.js → pullRequestDetail.logic-DQj9l9DL.js} +2 -2
  140. package/dist/client/assets/{pullRequests-R7416J6H.js → pullRequests-DrQJ8zM2.js} +2 -2
  141. package/dist/client/assets/{queries-Bp7Rbzrz.js → queries-BA_altUI.js} +2 -2
  142. package/dist/client/assets/{relay-V_5ApBIP.js → relay-CTdDIWLg.js} +2 -2
  143. package/dist/client/assets/{renderScheduler-T1-hnpvd.js → renderScheduler-eNIG8tB_.js} +2 -2
  144. package/dist/client/assets/{runtime-B92ivG9b.js → runtime-BvdQMwVb.js} +3 -3
  145. package/dist/client/assets/{scheduledTasksSettings.logic-DOegPD4_.js → scheduledTasksSettings.logic-CKzZuci7.js} +2 -2
  146. package/dist/client/assets/{server-GB5fRm03.js → server-DthHkqkT.js} +2 -2
  147. package/dist/client/assets/{session-CFzb2gMH.js → session-CxeYe0sJ.js} +2 -2
  148. package/dist/client/assets/{session-logic-Cx9524Pd.js → session-logic-2ZMapwqV.js} +2 -2
  149. package/dist/client/assets/{settings-DuV3USCX.js → settings-DAe5Z4UG.js} +2 -2
  150. package/dist/client/assets/{settings.appearance-DtON2De5.js → settings.appearance-wfb5oCmC.js} +2 -2
  151. package/dist/client/assets/settings.archived-BF0zdtbV.js +2 -0
  152. package/dist/client/assets/{settings.computer-use-BuiCBgaZ.js → settings.computer-use-DJQcngZ4.js} +2 -2
  153. package/dist/client/assets/{settings.connections-CTuywqD3.js → settings.connections-CoxujVuf.js} +2 -2
  154. package/dist/client/assets/{settings.data-controls-BTvw7hwA.js → settings.data-controls-DUI06j8l.js} +2 -2
  155. package/dist/client/assets/{settings.decisions-DjyXWkGE.js → settings.decisions-BY4z-aRM.js} +2 -2
  156. package/dist/client/assets/{settings.designs-B7y3Iz_g.js → settings.designs-O0d1vzoU.js} +2 -2
  157. package/dist/client/assets/{settings.diagnostics-muot_u8V.js → settings.diagnostics-CwCeo1mG.js} +2 -2
  158. package/dist/client/assets/{settings.general-CejKrS3r.js → settings.general-CAOwfHEb.js} +2 -2
  159. package/dist/client/assets/{settings.integrations-3B64nKur.js → settings.integrations-2RsLmeUi.js} +2 -2
  160. package/dist/client/assets/{settings.keybindings-DhvXS2QI.js → settings.keybindings-CwvrmKin.js} +2 -2
  161. package/dist/client/assets/{settings.open-source-licenses-nDTYUclU.js → settings.open-source-licenses-DCBCu3U3.js} +2 -2
  162. package/dist/client/assets/{settings.plugins-DJQxiL8Y.js → settings.plugins-8R8eV7IR.js} +2 -2
  163. package/dist/client/assets/{settings.projects-Cf31zLX1.js → settings.projects-Cy_93LuA.js} +3 -3
  164. package/dist/client/assets/{settings.providers-BenYwp5l.js → settings.providers-4HI8om0T.js} +3 -3
  165. package/dist/client/assets/{settings.scheduled-tasks-B0BJtx2Y.js → settings.scheduled-tasks-CHnjcJx8.js} +2 -2
  166. package/dist/client/assets/{settings.secrets-CugtPHky.js → settings.secrets-BgQSmFWY.js} +2 -2
  167. package/dist/client/assets/{settings.snap-shot-9uuaPZ8d.js → settings.snap-shot-C0J6pItQ.js} +2 -2
  168. package/dist/client/assets/{settings.source-control-DECPD9xY.js → settings.source-control-B3kcm55_.js} +2 -2
  169. package/dist/client/assets/{settings.storage-uPkJDu8D.js → settings.storage-Cy6oX7X3.js} +2 -2
  170. package/dist/client/assets/{settingsLayout-BoWaVHvV.js → settingsLayout-YTaL8Lym.js} +2 -2
  171. package/dist/client/assets/{sidebarProjectGrouping-MU2UfzY1.js → sidebarProjectGrouping-BaiZoO-A.js} +2 -2
  172. package/dist/client/assets/{sourceControl-BU6NXFEv.js → sourceControl-j8xaTHat.js} +2 -2
  173. package/dist/client/assets/{sourceControlClients-DBozOkI3.js → sourceControlClients-BxzlzQxJ.js} +2 -2
  174. package/dist/client/assets/{terminal-links-B5f_yaZ1.js → terminal-links-BdsGDJ3O.js} +2 -2
  175. package/dist/client/assets/{terminalSessions-Cg0AQjBU.js → terminalSessions-yZRa64tn.js} +2 -2
  176. package/dist/client/assets/{uiStateStore-u_PaGpa6.js → uiStateStore-CX-sbFiq.js} +2 -2
  177. package/dist/client/assets/{usage-BzExgBit.js → usage-CdxC8YNe.js} +2 -2
  178. package/dist/client/assets/{use-atom-command-Bd7vZxeH.js → use-atom-command-Bsfu4mja.js} +2 -2
  179. package/dist/client/assets/{useHandleNewThread-CA9pnWuC.js → useHandleNewThread-Cv_08eER.js} +2 -2
  180. package/dist/client/assets/{useP4ConnectAuthPrompt-czmNhUqV.js → useP4ConnectAuthPrompt-CW-hut92.js} +2 -2
  181. package/dist/client/assets/{usePullRequestActions-BIPl_xE4.js → usePullRequestActions-BHv9tRFF.js} +2 -2
  182. package/dist/client/assets/{useScopedModelAvailability-UuZvj6HE.js → useScopedModelAvailability-J0i-Sj4p.js} +2 -2
  183. package/dist/client/assets/{useSettings-Dp9RSL-0.js → useSettings-BhGGZc98.js} +2 -2
  184. package/dist/client/assets/{vcsRefInvalidation-CoBKCEWS.js → vcsRefInvalidation-71d-99uY.js} +2 -2
  185. package/dist/client/assets/{welcome-CJjj0VVp.js → welcome-Ytf7jmR7.js} +2 -2
  186. package/dist/client/index.html +1 -1
  187. package/dist/{preview-JlPVV2bV.mjs → preview-CmCyL-Tc.mjs} +2 -2
  188. package/dist/{runtimeLayer-B9K2BVKV.mjs → runtimeLayer-BnJcJFjY.mjs} +2 -2
  189. package/dist/{runtimeLayer-ZFdf4c6R.mjs → runtimeLayer-DnNbGwAf.mjs} +1 -1
  190. package/dist/{server-BnHhGuOc.mjs → server-DXfSgbuj.mjs} +4 -4
  191. package/package.json +1 -1
  192. package/dist/client/assets/JZOYTAAL-Bw2-11fa.js +0 -1
  193. package/dist/client/assets/connect-agent-C4n-OyN3.js +0 -2
  194. package/dist/client/assets/settings.archived-CxxKM6i3.js +0 -2
@@ -1,4 +1,4 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,Al as a,D as o,Ds as s,Eu as c,Lu as l,Os as u,Ts as d,Wo as f,Zn as p,al as m,ar as h,fr as g,gn as _,ir as v,j as y,mr as b,np as x,rr as S,sr as C,t as w,tr as T}from"./utils-DkKLB01I.js";import{Ca as E,Gp as D,Oa as O,Zs as k}from"./src-R7EkrVcv.js";import{Dr as ee,Sr as te,d as ne,dr as A,er as j,f as re,rr as ie,u as ae,xr as oe}from"./runtime-B92ivG9b.js";import{s as se}from"./vcsRefInvalidation-CoBKCEWS.js";import{G as ce}from"./entities-s42SFcbu.js";import{T as le,W as M,_ as N,g as P,u as ue,x as de}from"./TooltipProvider-DiV5KdTq.js";import{$ as fe,K as pe,n as me,q as F}from"./ChatMarkdown-_SLyl8Hk.js";import{t as he}from"./spinner-C-qDE4WQ.js";import{a as ge,h as _e}from"./relay-V_5ApBIP.js";import{C as ve,J as ye,K as be,k as xe,s as Se}from"./useSettings-Dp9RSL-0.js";import{i as Ce,n as we}from"./session-CFzb2gMH.js";import{t as Te}from"./use-atom-command-Bd7vZxeH.js";import{a as Ee}from"./fileLinks-BY6FjK66.js";import{d as De}from"./providerSkills-5OBbbZq-.js";import{t as Oe}from"./toastHelpers-DxXYm50b.js";import{o as ke}from"./queries-Bp7Rbzrz.js";import{H as I,V as L,l as Ae,ot as je,st as Me}from"./diffRendering-Cb9qJUqp.js";import{A as Ne,B as Pe,G as Fe,K as R,T as Ie,a as Le,j as Re,l as z,t as ze}from"./Virtualizer-NI9bqlwX.js";import{B as Be,G as Ve,H as B,J as He,K as V,Q as Ue,U as H,V as We,W as Ge,q as U}from"./getDiffFileInput-B7pCnCeh.js";import{c as Ke,i as qe,n as Je,o as Ye,s as Xe,t as Ze}from"./DiffWorkerPoolProvider-CmorWW2H.js";import{n as Qe}from"./cloneFileDiffMetadata-zVRGqYgv.js";import{S as $e,_ as et,b as tt,c as nt,d as rt,f as it,g as at,h as W,i as ot,l as st,m as G,o as ct,p as lt,r as ut,s as K,t as dt,u as ft,v as pt,x as mt,y as ht}from"./DiffCommentAnnotation-D7iLWjnP.js";import{t as gt}from"./mediaReference-CW0q8-nM.js";import{A as _t,D as vt,E as yt,F as bt,L as xt,M as St,N as Ct,O as wt,R as q,j as Tt,k as Et,w as Dt,z as Ot}from"./ThreadDetailsItemsMenu-Cgj2yuzU.js";import{a as kt,n as At,t as jt}from"./tooltip-CCYU8XGM.js";import{i as Mt,n as Nt,r as Pt,t as Ft}from"./fileCommentAnnotations-BgdL_7u9.js";import{r as It,t as Lt}from"./ReadOnlySourcePreview-LxG8Br9J.js";import{a as Rt,c as zt,i as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt}from"./fileTreeExpansion-B--IBStv.js";import{t as Kt}from"./pierre-icons-BptmNFMW.js";import{t as qt}from"./scroll-area-D2D-AlvC.js";import{t as Jt}from"./observeResize-BESwMMOy.js";import{n as Yt,r as Xt,t as Zt}from"./RightPanelResizeHandle-Cog3JVw0.js";import{t as Qt}from"./assets-DaZ46ybf.js";import{i as $t,n as en,t as tn}from"./assetUrls-gAudvjhV.js";import{w as nn}from"./browserHistoryStore-CIeLvEnV.js";import{i as rn,r as an}from"./openFileInPreview-Dpge7x7S.js";import{t as on}from"./preview-BBssbPEj.js";import{t as sn}from"./PierreEntryIcon-oOiSTYpG.js";import{n as cn}from"./composerTrigger-BGi0iyhl.js";import{r as ln,t as un}from"./input-group-DOUsG7P-.js";import{f as dn,i as fn,l as pn,n as mn,o as hn,t as gn,u as _n}from"./projectFilesQueryState-CVSEDHhW.js";import{Ho as vn,Lo as yn,No as bn}from"./main-BYwnnJ9E.js";import{C as xn,f as Sn,m as Cn,p as wn}from"./_chat-DDScEBKF.js";var Tn={compositeOverBg:Be,contrastRatio:We,deriveMutedFg:B,hoverWouldEraseText:H,isDarkSurface:Ge,isFullyTransparent:Ve,pickReadableForeground:V,relativeLuminance:U,surfacesMatch:He},J=e(t(),1);function En(e,t){return e.isOpen===t.isOpen&&e.value===t.value&&Rt(e.matchingPaths,t.matchingPaths)}function Dn(e){let t=Ht(e,e=>({isOpen:e.isSearchOpen(),matchingPaths:e.getSearchMatchingPaths(),value:e.getSearchValue()}),En);return(0,J.useMemo)(()=>({...t,close:()=>{e.closeSearch()},focusNextMatch:()=>{e.focusNextSearchMatch()},focusPreviousMatch:()=>{e.focusPreviousSearchMatch()},open:t=>{e.openSearch(t)},setValue:t=>{e.setSearch(t)}}),[e,t])}var On=100,kn=`insert`,An=`backspace`,jn=`delete`,Mn=class e{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??On)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}getState(){return{undoStack:this.#e.map(Pn),redoStack:this.#t.map(Pn),maxEntries:this.#n,canCoalesce:this.#r}}getLiveState(){return Object.defineProperties({},{undoStack:{enumerable:!0,get:()=>this.#e},redoStack:{enumerable:!0,get:()=>this.#t},maxEntries:{enumerable:!0,get:()=>this.#n},canCoalesce:{enumerable:!0,get:()=>this.#r}})}static fromState(t){let n=new e({maxEntries:t.maxEntries});return n.#e=t.undoStack,n.#t=t.redoStack,n.#r=t.canCoalesce,n}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){this.#e.length===0?this.push(e):(this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0)}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function Nn(e){return{...e,forwardEdits:e.forwardEdits.map(e=>({...e})),inverseEdits:e.inverseEdits.map(e=>({...e})),selectionsBefore:e.selectionsBefore?.map(Fn),selectionsAfter:e.selectionsAfter?.map(Fn),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice()}}function Pn(e){return{...Nn(e),lineAnnotationsBefore:e.lineAnnotationsBefore?.map(e=>({...e})),lineAnnotationsAfter:e.lineAnnotationsAfter?.map(e=>({...e}))}}function Fn(e){return{...e,start:{...e.start},end:{...e.end}}}function In(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?An:n?jn:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function Ln(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=Bn(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,Al as a,D as o,Ds as s,Eu as c,Lu as l,Os as u,Ts as d,Wo as f,Zn as p,al as m,ar as h,fr as g,gn as _,ir as v,j as y,mr as b,np as x,rr as S,sr as C,t as w,tr as T}from"./utils-DkKLB01I.js";import{Ca as E,Gp as D,Oa as O,Zs as k}from"./src-R7EkrVcv.js";import{Dr as ee,Sr as te,d as ne,dr as A,er as j,f as re,rr as ie,u as ae,xr as oe}from"./runtime-BvdQMwVb.js";import{s as se}from"./vcsRefInvalidation-71d-99uY.js";import{G as ce}from"./entities-DOpLfnwX.js";import{T as le,W as M,_ as N,g as P,u as ue,x as de}from"./TooltipProvider-DiV5KdTq.js";import{$ as fe,K as pe,n as me,q as F}from"./ChatMarkdown-Ck4FJs_Q.js";import{t as he}from"./spinner-C-qDE4WQ.js";import{a as ge,h as _e}from"./relay-CTdDIWLg.js";import{C as ve,J as ye,K as be,k as xe,s as Se}from"./useSettings-BhGGZc98.js";import{i as Ce,n as we}from"./session-CxeYe0sJ.js";import{t as Te}from"./use-atom-command-Bsfu4mja.js";import{a as Ee}from"./fileLinks-CJ9SYNL6.js";import{d as De}from"./providerSkills-D-ytsJU9.js";import{t as Oe}from"./toastHelpers-DxXYm50b.js";import{o as ke}from"./queries-BA_altUI.js";import{H as I,V as L,l as Ae,ot as je,st as Me}from"./diffRendering-yxIsTMie.js";import{A as Ne,B as Pe,G as Fe,K as R,T as Ie,a as Le,j as Re,l as z,t as ze}from"./Virtualizer-Cn_zq3uH.js";import{B as Be,G as Ve,H as B,J as He,K as V,Q as Ue,U as H,V as We,W as Ge,q as U}from"./getDiffFileInput-hLtjvhYr.js";import{c as Ke,i as qe,n as Je,o as Ye,s as Xe,t as Ze}from"./DiffWorkerPoolProvider-zgaFe3TY.js";import{n as Qe}from"./cloneFileDiffMetadata-zVRGqYgv.js";import{S as $e,_ as et,b as tt,c as nt,d as rt,f as it,g as at,h as W,i as ot,l as st,m as G,o as ct,p as lt,r as ut,s as K,t as dt,u as ft,v as pt,x as mt,y as ht}from"./DiffCommentAnnotation-CSzNea6G.js";import{t as gt}from"./mediaReference-D4rhlY-i.js";import{A as _t,D as vt,E as yt,F as bt,L as xt,M as St,N as Ct,O as wt,R as q,j as Tt,k as Et,w as Dt,z as Ot}from"./ThreadDetailsItemsMenu-C4wfbepv.js";import{a as kt,n as At,t as jt}from"./tooltip-CCYU8XGM.js";import{i as Mt,n as Nt,r as Pt,t as Ft}from"./fileCommentAnnotations-BgdL_7u9.js";import{r as It,t as Lt}from"./ReadOnlySourcePreview-COho36OD.js";import{a as Rt,c as zt,i as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt}from"./fileTreeExpansion-CdWOFpa-.js";import{t as Kt}from"./pierre-icons-BTVgApcG.js";import{t as qt}from"./scroll-area-D2D-AlvC.js";import{t as Jt}from"./observeResize-BESwMMOy.js";import{n as Yt,r as Xt,t as Zt}from"./RightPanelResizeHandle-Cog3JVw0.js";import{t as Qt}from"./assets-5kUNv3CS.js";import{i as $t,n as en,t as tn}from"./assetUrls-C78a94Xu.js";import{w as nn}from"./browserHistoryStore-DHI-0j5y.js";import{i as rn,r as an}from"./openFileInPreview-XKgvCQ1z.js";import{t as on}from"./preview-5pSBET3P.js";import{t as sn}from"./PierreEntryIcon-UO6zY_i-.js";import{n as cn}from"./composerTrigger-BGi0iyhl.js";import{r as ln,t as un}from"./input-group-DOUsG7P-.js";import{f as dn,i as fn,l as pn,n as mn,o as hn,t as gn,u as _n}from"./projectFilesQueryState-B6AeAhgL.js";import{Ho as vn,Lo as yn,No as bn}from"./main-C04YJQbN.js";import{C as xn,f as Sn,m as Cn,p as wn}from"./_chat-PsMoIPUC.js";var Tn={compositeOverBg:Be,contrastRatio:We,deriveMutedFg:B,hoverWouldEraseText:H,isDarkSurface:Ge,isFullyTransparent:Ve,pickReadableForeground:V,relativeLuminance:U,surfacesMatch:He},J=e(t(),1);function En(e,t){return e.isOpen===t.isOpen&&e.value===t.value&&Rt(e.matchingPaths,t.matchingPaths)}function Dn(e){let t=Ht(e,e=>({isOpen:e.isSearchOpen(),matchingPaths:e.getSearchMatchingPaths(),value:e.getSearchValue()}),En);return(0,J.useMemo)(()=>({...t,close:()=>{e.closeSearch()},focusNextMatch:()=>{e.focusNextSearchMatch()},focusPreviousMatch:()=>{e.focusPreviousSearchMatch()},open:t=>{e.openSearch(t)},setValue:t=>{e.setSearch(t)}}),[e,t])}var On=100,kn=`insert`,An=`backspace`,jn=`delete`,Mn=class e{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??On)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}getState(){return{undoStack:this.#e.map(Pn),redoStack:this.#t.map(Pn),maxEntries:this.#n,canCoalesce:this.#r}}getLiveState(){return Object.defineProperties({},{undoStack:{enumerable:!0,get:()=>this.#e},redoStack:{enumerable:!0,get:()=>this.#t},maxEntries:{enumerable:!0,get:()=>this.#n},canCoalesce:{enumerable:!0,get:()=>this.#r}})}static fromState(t){let n=new e({maxEntries:t.maxEntries});return n.#e=t.undoStack,n.#t=t.redoStack,n.#r=t.canCoalesce,n}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){this.#e.length===0?this.push(e):(this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0)}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function Nn(e){return{...e,forwardEdits:e.forwardEdits.map(e=>({...e})),inverseEdits:e.inverseEdits.map(e=>({...e})),selectionsBefore:e.selectionsBefore?.map(Fn),selectionsAfter:e.selectionsAfter?.map(Fn),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice()}}function Pn(e){return{...Nn(e),lineAnnotationsBefore:e.lineAnnotationsBefore?.map(e=>({...e})),lineAnnotationsAfter:e.lineAnnotationsAfter?.map(e=>({...e}))}}function Fn(e){return{...e,start:{...e.start},end:{...e.end}}}function In(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?An:n?jn:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function Ln(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=Bn(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
2
2
  `)&&!a.text.includes(`
3
3
  `),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
4
4
  `)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=kn,n!==kn||e.coalescingMode!==void 0&&e.coalescingMode!==kn||t.coalescingMode!==void 0&&t.coalescingMode!==kn))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=jn;else if(c+(o.end-o.start)!==i.start)return!1;else r=An;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1}else return!1}return n!==void 0}function Rn(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=Bn(c.start,e.forwardEdits);o.text.length>0?(i??=kn,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text)):u===o.end?(i??=jn,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text)):(i??=An,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text))}return{forwardEdits:n,inverseEdits:zn(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function zn(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function Bn(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;n<e.start||(n>=e.start+r?n-=i:n=e.start+Math.min(n-e.start,t))}return n}var Vn=new WeakMap;function Hn(e){return Vn.get(e)}function Un(e,t){Vn.set(e,t)}var Wn=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new Mn,a){if(this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new pt(t),this.#i=i,a!=null)this.#a=a;else{let e=this.#r.getLineText(0,!0);this.#a=e.endsWith(`\r
@@ -31,4 +31,4 @@ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJe
31
31
  `)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Br(t,e,n);this.#Wt([i]),this.#Pe(X(i).line),this.#gt(!0),this.#pe=r},s=new ot({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#se);n!==void 0&&this.#dn(n,void 0,this.#pn(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#ce=void 0,this.#Wt(this.#se??[]);return}if(this.#ce=e,n?.syncSelection===!1){this.#Wt(this.#se??[]);let n=this.#se?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#se?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#Wt(this.#se??[]):o(a,!0),a},onClose:()=>{this.#G=void 0,this.#pe=!1,this.#ce=void 0,this.#Wt(this.#se??[])}});this.#G=s,this.#pe=!1}#en(){let e=this.#n?.document,t=this.#se;return e===void 0||t===void 0?``:ti(e,t)}#tn(){let e=this.#n?.document,t=this.#se;return e===void 0||t===void 0?[]:ei(e,t)}#nn(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(io,JSON.stringify(n)))}#rn(){let e=this.#n?.document,t=this.#se;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>Y(e))){let n=oi(e,t);return this.#in(n.edits,n.nextSelectionOffsets),n.text}let n=ti(e,t);return this.#an(``,void 0,!0),n}#in(e,t){let n=this.#n?.document,r=this.#se;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#dn(i,a,this.#pn(i))}#an(e,t=this.#se,n=!1,r=`selection`){if(t===void 0)return;let i=this.#n?.document,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?kr(i,t,e,this.#R,n,r):Er(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#R,void 0,n);s!==void 0&&this.#dn(s,o,this.#pn(s))}#on(e=!1){let t=this.#se,n=this.#n?.document;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=Lr(n,t,e,this.#R,this.#r.tabSize);i!==void 0&&this.#dn(i,r,this.#pn(i))}#sn(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Pr(t,e,this.#Le?(e,t)=>{let n=this.#Sn(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#cn(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Fr(t,e,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#ln(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Nr(t,e,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#un(){let e=this.#se,t=this.#n?.document;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Mr(t,e,this.#R);r!==void 0&&this.#dn(r,n,this.#pn(r))}#dn(e,t,n,r){this.#xe!=null&&this.#Rt(!0);let i=this.#n?.document;if(i!==void 0&&this.#W!==void 0)for(let t of this.#W)t.anchorOffset=Vr(t.anchorOffset,e.changes),t.focusOffset=Vr(t.focusOffset,e.changes),t.caret.anchor=i.positionAt(t.anchorOffset),t.caret.focus=i.positionAt(t.focusOffset);if(e.lineDelta!==0||this.#Le)for(let t of this.#m.keys())t>=e.startLine&&this.#m.delete(t);if(this.#h.size>0){if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#h.delete(e);else for(let t of this.#h.keys())t>=e.startLine&&this.#h.delete(t)}this.#_=void 0;let a=this.#V,o;if(a!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=a.startingLine+a.totalLines;if(n.end.line>=r){let t=n.end.line-a.startingLine+1,i=this.#H===void 0||this.#H===1/0?1/0:this.#H*Za;e.startLine<=r&&t<=i&&this.#Me(n.end.line)?(n.end.line>r&&(o=!0),a={...a,totalLines:t},this.#V=a):o=!0}}if(this.#I&&this.#i!=null&&this.#w!=null?this.#ct(e,n,a,o):i!=null&&(this.#P?.(i,n),n!=null&&(this.#R=n)),t!=null&&this.#Wt(t),this.#M?.__acknowledgeDocumentUpdate(),this.#De(),this.#Vt(e,r?.editSource??`user`),this.#Bt(),this.#fn(e.changes,n??this.#R),r?.skipSearchRefresh!==!0&&this.#G!==void 0&&this.#ce!==void 0&&this.#G.updateMatches({syncSelection:!1}),t!=null&&r?.skipFocus!==!0){let e=t.at(-1);if(e!==void 0&&this.#Pe(X(e).line),this.#A!==void 0)requestAnimationFrame(()=>{this.#A?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=X(t.at(-1));this.#vt(e.line,e.character)}this.focus({preventScroll:!0})}}#fn(e,t){let n=this.getFile(),r=this.#F;n!=null&&r!=null&&r(e,n,t)}#pn(e){if(this.#R!=null){let t=nr(e,this.#R);if(t!=null)return this.#n?.document?.setLastUndoLineAnnotations(this.#R,t),t}}#mn(){let e=this.#w;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=G(e);if(i===void 0||r===void 0||!Rr(r))continue;let a=i-1,o=t.at(-1);o!==void 0&&a<=o[1]+1?o[1]=Math.max(o[1],a):t.push([a,a])}return t}#hn(e){let t=this.#V;return t==null||e>=t.startingLine&&e<t.startingLine+t.totalLines}#gn(e){let t=this.#g.get(e);if(t!==void 0)return t??void 0;let n=this.#V;if(!this.#hn(e))return;let r=this.#w;if(r!==void 0){if(n!==void 0){let{startingLine:i}=n,{children:a}=r;for(let n=e-i;n<=a.length;n++){let r=a[n];if(r===void 0)break;let i=G(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&Rr(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Fe===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#g.set(e,t),t??void 0}}#_n(){if(this.#C===void 0)return 0;if(this.#f===void 0){let e=this.#w?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);this.#f=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseInt(e.slice(0,-2),10):this.#C.offsetWidth}return this.#f}#vn(){if(this.#w===void 0)return 0;if(this.#p===void 0){let e=this.#w.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);this.#p=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseFloat(e.slice(0,-2)):this.#w.offsetWidth}return this.#p}#yn(e){let t=this.#m.get(e);if(t!==void 0)return t;let n=this.#gn(e);if(n===void 0)return-1;let r=n.offsetTop+this.#r.paddingTop;return r+=this.#$e?.top??0,this.#m.set(e,r),r}#bn(e,t){if(this.#_!==void 0&&this.#_[0]===e&&this.#_[1]===t)return[this.#_[2],this.#_[3]];let n=this.#n?.document?.getLineText(e),r=this.#_n()+this.#r.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#$e?.left??0),0];let i=za(n,Math.min(t,n.length)),a=n.slice(0,i),o=Va(a,this.#r.tabSize),s=0,c=0;if(s=o===-1?r+this.#r.measureTextWidth(a):r+o*this.#r.ch,this.#Le){let t=this.#vn();if(2*this.#r.ch+this.#r.measureTextWidth(n)>t){let t=this.#xn(e);if(t==null)return[s+(this.#$e?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=Va(t,this.#r.tabSize);s=o===-1?r+this.#r.measureTextWidth(t):r+o*this.#r.ch;break}}}s+=this.#$e?.left??0}return this.#_===void 0?this.#_=[e,t,s,c]:(this.#_[0]=e,this.#_[1]=t,this.#_[2]=s,this.#_[3]=c),[s,c]}#xn(e){let t=this.#h.get(e);if(t!==void 0)return t;this.#h.size>=Qa&&this.#h.clear();let n=this.#n?.document?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#h.set(e,t),t}let r=this.#w;if(r==null||!r.isConnected)return;let i=W(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#r.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=Ba(n),c=t.left+this.#r.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>{o.setStart(a,u(e)),o.setEnd(a,u(e+1));let t=o.getClientRects();return t.item(t.length-1)??o.getBoundingClientRect()};s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=Ie()&&n-c>this.#r.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#h.set(e,m),m}finally{i.remove()}}#Sn(e){let t=this.#xn(e);if(t!==void 0)return t;let n=this.#n?.document?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Cn({startContainer:e,endContainer:t}){let n=this.#w;return n!==void 0&&n.contains(e)&&n.contains(t)}#wn(e){let t=this.#n?.document?.lineCount??0;return e<0||e>=t?!1:this.#gn(e)!==void 0}};function oo({type:e,editStateKey:t,owner:n,initialState:r,previousSession:i}){if(r!=null&&r.type!==e)throw TypeError(`Editor: initialState: a ${r.type} state cannot initialize a ${e} editor`);let a=r;return t==null?a??i??(e===`file`?{type:`file`}:{type:`file-diff`}):Qn.activate(e,t,n,a)}function so(e){return e instanceof HTMLElement?Number(e.dataset.bufferSize??1):1}function co(e,t){return t!==void 0&&Number.isInteger(t.line)&&Number.isInteger(t.character)&&t.line>=0&&t.line<e.lineCount&&t.character>=0&&t.character<=e.getLineLength(t.line)}function lo(e,t){let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return t>0&&t<e.length&&n>=55296&&n<=56319&&r>=56320&&r<=57343}var Q=n();function uo(e,t){let n=j(t),r=ie(t)?`\\`:`/`,i=t.split(/[\\/]/).filter(Boolean),a=t.startsWith(`\\\\`)?`\\\\`:t.startsWith(`/`)?`/`:``;return[...n?[]:[{label:e,path:``,kind:`project`}],...i.map((e,t)=>{let o=a+i.slice(0,t+1).join(r);return{label:e,path:/^[A-Za-z]:$/.test(o)?`${o}\\`:n&&o===`~`?`~/`:o,kind:t===i.length-1?`file`:`directory`}})]}function fo(e){return uo(``,e).at(-1)?.path??e}function po(e){return j(e)&&!/^\\\\[^\\/]+$/.test(e)}function mo(e,t){let n=fo(t);return uo(``,e).findIndex(e=>e.path===n)}function ho(e,t){return e!==void 0&&mo(e,t)>=0?e:t}function go(e,t){let n=mo(t,e);return n<0?null:uo(``,t)[n+1]?.label??null}function _o(e,t){let n=ie(e)?`\\`:`/`;return(e.endsWith(n)?e:`${e}${n}`)+t.split(`/`).join(n)}function vo(e,t){let n,r=t?`${t}/`:``;return e.flatMap(e=>{if(!e.path.startsWith(r))return[];let t=e.path.slice(r.length);return!t||t.includes(`/`)?[]:[{...e,label:t}]}).toSorted((e,t)=>e.kind===t.kind?(n??=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),n.compare(e.label,t.label)):e.kind===`directory`?-1:1)}function yo(e){if(!e)return null;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var bo=e=>{if(typeof e!=`object`||!e)return null;let t=e;return typeof t.getAttribute==`function`?t.getAttribute(`data-item-path`):null};function xo(e){let t=[],n=[];return{isDragInProgress:()=>n.length>0,handleSelectionChange(e){t=e},handleDragStart(r){if(r.dataTransfer===null)return;let i=null;for(let e of r.composedPath())if(i=bo(e),i!==null)break;if(i===null)return;let a=t.includes(i)?t:[i],o=a.map(t=>{let n=t.replace(/\/+$/,``);return wn(n&&e.mentionPath?e.mentionPath(n):t)}).filter(e=>e!==null);o.length!==0&&(n=a,r.dataTransfer.setData(Sn,o.join(` `)))},handleDragEnd(){if(n.length!==0){for(let t of n)e.deselect(t);n=[]}}}}function So(e){return e.split(`/`).filter(Boolean).length}function Co(e,t){let n=new Set(e),r=new Set(t),i=[],a=[],o=e.filter(e=>!r.has(e)).toSorted((e,t)=>So(e)-So(t));for(let e of o){if(i.some(t=>e.startsWith(t)))continue;let t=e.endsWith(`/`);a.push({type:`remove`,path:e,...t?{recursive:!0}:{}}),t&&i.push(e)}let s=t.filter(e=>!n.has(e)).toSorted((e,t)=>So(e)-So(t));for(let e of s)a.push({type:`add`,path:e});return a}function wo(e,t){let[n,r]=(0,J.useState)(new Map),[i,a]=(0,J.useState)(new Map),[o,s]=(0,J.useState)(0),[c,l]=(0,J.useState)(new Set),u=(0,J.useRef)(new Map),d=(0,J.useRef)(new Map),p=(0,J.useRef)(new Set),m=(0,J.useRef)(new Set),h=(0,J.useRef)(!0),g=(0,J.useRef)(0),_=(0,J.useRef)([]),v=(0,J.useCallback)(function n(i,o=!1){let c=u.current.get(i);if(c){if(!o)return c;let e=d.current.get(i);return e||(e=c.then(()=>{if(d.current.delete(i),h.current)return n(i,!0)}),d.current.set(i,e)),e}if(!o&&p.current.has(i))return Promise.resolve();p.current.add(i),m.current.add(i);let v=ce.listEntries({environmentId:e,input:{cwd:t,directoryPath:i}});s(e=>e+1),o||l(e=>new Set(e).add(i));let y=(async()=>{g.current>=4?await new Promise(e=>_.current.push(e)):g.current++;try{return h.current?await oe(f,v,{refresh:!0,reportFailure:!1,reportDefect:!1}):void 0}finally{let e=_.current.shift();e?e():g.current--}})().then(e=>{if(h.current&&e){if(e._tag===`Success`)r(t=>new Map(t).set(i,e.value.entries.filter(e=>e.path.slice(0,Math.max(0,e.path.lastIndexOf(`/`)))===i))),a(e=>{let t=new Map(e);return t.delete(i),t});else{p.current.delete(i);let t=D(e.cause);a(e=>new Map(e).set(i,t instanceof Error?t.message:`Unable to load folder.`))}}}).finally(()=>{u.current.delete(i),h.current&&(s(e=>e-1),o||l(e=>{let t=new Set(e);return t.delete(i),t}))});return u.current.set(i,y),y},[t,e]);(0,J.useEffect)(()=>(h.current=!0,v(``),()=>{h.current=!1}),[v]);let y=(0,J.useMemo)(()=>{let e=[],t=r=>{for(let i of n.get(r)??[])e.push(i),i.kind===`directory`&&t(i.path)};return t(``),e},[n]),b=(0,J.useMemo)(()=>new Set([``,...y.filter(e=>e.kind===`directory`).map(e=>e.path)]),[y]);return{entries:y,load:v,refresh:(0,J.useCallback)(()=>{let e=[...m.current].filter(e=>b.has(e));for(let t of e){if(!h.current)break;v(t,!0)}},[v,b]),isPending:o>0,loadingDirectories:c,ready:n.has(``),error:[...i].find(([e])=>b.has(e))?.[1]??null}}var $=e(r(),1);function To(e){return e.kind===`directory`?`${e.path}/`:e.path}function Eo(e){let t=(0,Q.c)(12),n;t[0]===e.onRefresh?n=t[1]:(n=(0,$.jsx)(b,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Refresh workspace files`,onClick:e.onRefresh}),t[0]=e.onRefresh,t[1]=n);let r;t[2]===e.isPending?r=t[3]:(r=(0,$.jsx)(vn,{refreshing:e.isPending}),t[2]=e.isPending,t[3]=r);let i;t[4]!==n||t[5]!==r?(i=(0,$.jsx)(kt,{render:n,children:r}),t[4]=n,t[5]=r,t[6]=i):i=t[6];let a=e.isPending?`Refreshing…`:`Refresh files`,o;t[7]===a?o=t[8]:(o=(0,$.jsx)(At,{children:a}),t[7]=a,t[8]=o);let s;return t[9]!==i||t[10]!==o?(s=(0,$.jsxs)(jt,{children:[i,o]}),t[9]=i,t[10]=o,t[11]=s):s=t[11],s}function Do(e){let t=(0,Q.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):(n=t=>e.onValueChange(t.target.value),r=t=>{t.key===`Escape`&&(e.onClose(),t.currentTarget.blur())},t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==e.ariaLabel||t[4]!==e.name||t[5]!==e.value||t[6]!==n||t[7]!==r?(i=(0,$.jsx)(un,{variant:`ghost`,className:`h-7 min-w-0 flex-1`,children:(0,$.jsx)(ln,{type:`search`,name:e.name,size:`sm`,value:e.value,"aria-label":e.ariaLabel,placeholder:`Search files`,spellCheck:!1,onChange:n,onKeyDown:r})}),t[3]=e.ariaLabel,t[4]=e.name,t[5]=e.value,t[6]=n,t[7]=r,t[8]=i):i=t[8],i}function Oo({environmentId:e,cwd:t,projectName:n,selectedPath:r,selectedPathRevealId:i,onOpenFile:a,onRefreshSelectedFile:o,workspaceMutationId:s,hostFolder:c=!1}){let l=e=>c?_o(t,e):e,{resolvedTheme:u}=be(),d=_(),f=De(e),{entries:p,load:m,refresh:h,ready:g,error:v,isPending:y,loadingDirectories:x}=wo(e,t),[S,C]=(0,J.useState)(``),[w,T]=(0,J.useState)(!1),E=ke({environmentId:e,cwd:c?null:t,query:S.slice(0,256)},200),D=(0,J.useMemo)(()=>{let e=new Map(p.map(e=>[e.path,e]));if(S.trim()&&!E.isPending)for(let t of E.entries){e.has(t.path)||e.set(t.path,t);let n=t.path.split(`/`);for(let t=1;t<n.length;t++){let r=n.slice(0,t).join(`/`);e.has(r)||e.set(r,{path:r,kind:`directory`})}}return[...e.values()]},[p,E.entries,E.isPending,S]),O=(0,J.useMemo)(()=>new Map(D.map(e=>[e.path,e.kind])),[D]),k=(0,J.useRef)(O),ee=(0,J.useMemo)(()=>D.map(To),[D]),te=(0,J.useMemo)(()=>D.filter(e=>e.kind===`directory`).map(To),[D]),ne=(0,J.useRef)(null),A=(0,J.useRef)(!1),j=(0,J.useRef)(null),re=(0,J.useRef)(null),ie=(0,J.useRef)(null),ae=async(n,r)=>{let i=ye();if(!i){r.close();return}let a=n.path.replace(/\/$/,``),o=cn(l(a)),s=ie.current,c=s!==null&&performance.now()-s.at<1e3,u=r.anchorElement.getBoundingClientRect(),p=c?{x:s.x,y:s.y}:{x:u.left,y:u.bottom},m={environmentId:e,filePath:a,workspaceRoot:t},h=f.buildItems(m);r.close({restoreFocus:!c});let g=await i.contextMenu.show([...h,{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],p);if(g!==null){if(h.some(e=>e.id===g)||g.startsWith(`editor:`))await f.activate(g,m);else if(g===`copy-mention`)try{await _e(o),ge.add({type:`success`,title:`Mention copied`,description:a})}catch(e){ge.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}else if(g===`add-to-chat`){let e=d?.current;if(!e){ge.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${o} `,{ensureLeadingBoundary:!0})||ge.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}},oe=(0,J.useRef)(ae);(0,J.useEffect)(()=>{oe.current=ae});let se=(0,J.useRef)(x),ce=(0,J.useRef)(null),le=(0,J.useMemo)(()=>xo({deselect:e=>ce.current?.getItem(e)?.deselect(),...c?{mentionPath:e=>_o(t,e)}:{}}),[t,c]),{model:M}=Wt({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{oe.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:`closed`,icons:Kt,onSelectionChange:e=>{if(le.handleSelectionChange(e),A.current||le.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&k.current.get(t)===`file`&&(j.current=t,a(l(t)))},paths:[],renderRowDecoration:({item:e,row:t})=>t.kind===`directory`&&t.isExpanded&&se.current.has(e.path.replace(/\/$/,``))?{icon:`p4-tree-icon-loading`,title:`Loading…`}:null,search:!1,onSearchChange:e=>C(e??``),unsafeCSS:Ut});(0,J.useEffect)(()=>{se.current!==x&&(se.current=x,M.setComposition(M.getComposition()))},[x,M]);let de=Dn(M),fe=Ht(M,e=>Gt(e,te)),pe=()=>{let e=!(w||fe);T(e),Vt(M,te,e)},me=()=>{C(``),de.close()},F=(0,J.useRef)(new Set);(0,J.useEffect)(()=>{let e=new Set(te);for(let t of F.current)e.has(t)||F.current.delete(t);let t=()=>{if(!M.isSearchOpen())for(let e of te){let t=M.getItem(e);t?.isDirectory()&&`isExpanded`in t&&t.isExpanded()?F.current.has(e)||(F.current.add(e),m(e.replace(/\/$/,``))):(t?.isDirectory()&&F.current.has(e)&&T(!1),F.current.delete(e))}};return t(),M.subscribe(t)},[te,m,M]),(0,J.useEffect)(()=>{M.setGitStatus(D.filter(e=>e.ignored).map(e=>({path:To(e),status:`ignored`})))},[D,M]),(0,J.useEffect)(()=>{if(!r)return;let e=new AbortController;return(async()=>{let t=r.split(`/`);for(let n=0;n<t.length&&!e.signal.aborted;n++)await m(t.slice(0,n).join(`/`))})(),()=>{e.abort()}},[m,r]);let he=e=>{C(e),e.trim().length===0?de.close():de.setValue(e)},ve=()=>{h(),S.trim()&&E.refresh(),o?.()};xn({mutationId:s,refresh:()=>{h(),S.trim()&&E.refresh()},resourceKey:`files:${e}:${t}`}),(0,J.useEffect)(()=>{if(!g||ne.current===ee)return;k.current=O;let e=ne.current;if(ne.current=ee,e===null){M.resetPaths(ee);return}let t=Co(e,ee);t.length>0&&M.batch(t)},[g,O,M,ee]),(0,J.useEffect)(()=>{w&&!S.trim()&&Vt(M,te,!0)},[te,w,M,S]),(0,J.useEffect)(()=>{if(!r){re.current=null;return}let e=O.get(r);if(e===void 0){re.current=null;return}let t={path:r,revealId:i},n=re.current;if(n?.path===t.path&&n.revealId===t.revealId)return;let a=e===`directory`?`${r}/`:r,o=M.getItem(a);if(!o)return;if(M.getSelectedPaths().some(e=>e.replace(/\/$/,``)===r)&&j.current===r){j.current=null,re.current=t;return}j.current=null,re.current=t,A.current=!0,C(``),M.closeSearch();for(let e of M.getSelectedPaths())M.getItem(e)?.deselect();let s=r.split(`/`),c=``;for(let e of s.slice(0,-1)){c=c?`${c}/${e}`:e;let t=M.getItem(`${c}/`)??M.getItem(c);t&&`expand`in t&&t.expand()}`expand`in o&&o.expand(),o.select(),M.scrollToPath(a,{focus:!0,offset:`center`}),queueMicrotask(()=>{A.current=!1})},[O,M,r,i]);let xe=(0,J.useRef)(null);return(0,J.useEffect)(()=>{ce.current=M},[M]),(0,J.useEffect)(()=>{let e=xe.current;if(e===null)return;let t=e=>le.handleDragStart(e),n=()=>le.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[le]),(0,$.jsxs)(`div`,{ref:xe,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,onContextMenuCapture:e=>{ie.current={x:e.clientX,y:e.clientY,at:e.timeStamp}},children:[(0,$.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 in-data-[preview-panel-mode=inline]:mb-1 in-data-[preview-panel-mode=inline]:h-9 in-data-[preview-panel-mode=inline]:min-h-9 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[(0,$.jsx)(Eo,{isPending:y,onRefresh:ve}),(0,$.jsx)(Do,{name:`project-files-search`,ariaLabel:`Search ${n} files`,value:de.value,onValueChange:he,onClose:me}),te.length>0&&!c?(0,$.jsx)(b,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":w||fe?`Collapse all folders`:`Expand all folders`,onClick:pe,children:(0,$.jsx)(ue,{className:`size-3.5`,icon:fe?P:N})}):null]}),v||E.error?(0,$.jsxs)(`button`,{type:`button`,onClick:ve,className:`p-4 text-left text-xs leading-relaxed text-destructive`,children:[v??E.error,` Click to retry.`]}):null,S.trim()&&E.truncated&&!E.isPending?(0,$.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground`,children:`More matches available. Refine your search.`}):null,(!g||E.isPending)&&(0,$.jsx)(`div`,{role:`status`,className:`px-3 py-1 text-xs text-muted-foreground`,children:`Loading files…`}),(0,$.jsx)(zt,{model:M,"aria-label":`${n} files`,className:`min-h-0 flex-1 overflow-hidden`,style:Bt(u)})]})}var ko=160,Ao=560,jo=256;function Mo(e){let t=(0,Q.c)(21),{resizable:n,children:r}=e,[i,a]=(0,J.useState)(Ao),o;t[0]===i?o=t[1]:(o={storageKey:`p4code:fileExplorerWidth`,defaultWidth:256,minWidth:ko,maxWidth:i,edge:`left`},t[0]=i,t[1]=o);let{width:s,setWidth:c,handlers:l}=Xt(o),u;t[2]===n?u=t[3]:(u=e=>{let t=e?.parentElement;if(!t||!n)return;let r=()=>a(Math.max(ko,Math.min(Ao,t.clientWidth-jo)));return r(),Jt(t,r)},t[2]=n,t[3]=u);let d=n?`border-l border-border/60`:`flex-1`,f;t[4]===d?f=t[5]:(f=w(`relative flex min-h-0 min-w-0 shrink-0 bg-background`,d),t[4]=d,t[5]=f);let p;t[6]!==n||t[7]!==s?(p=n?{[Yt]:`${s}px`,width:`var(${Yt})`}:void 0,t[6]=n,t[7]=s,t[8]=p):p=t[8];let m;t[9]!==l||t[10]!==i||t[11]!==n||t[12]!==c||t[13]!==s?(m=n?(0,$.jsx)(Zt,{handlers:l,label:`Resize file explorer`,tabIndex:0,"aria-valuenow":s,"aria-valuemin":ko,"aria-valuemax":i,onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t;bb39:switch(e.key){case`ArrowLeft`:t=s+16;break bb39;case`ArrowRight`:t=s-16;break bb39;case`Home`:t=ko;break bb39;case`End`:t=i;break bb39;default:return}e.preventDefault(),e.stopPropagation(),c(t)}}):null,t[9]=l,t[10]=i,t[11]=n,t[12]=c,t[13]=s,t[14]=m):m=t[14];let h;return t[15]!==r||t[16]!==u||t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`aside`,{ref:u,"aria-label":`File explorer`,className:f,style:p,children:[m,r]}),t[15]=r,t[16]=u,t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function No(e,t){return e.slice(e.lastIndexOf(`/`)+1)||t}function Po(e){let t=(0,Q.c)(12),n=e.current?`font-medium text-foreground`:`text-muted-foreground`,r;t[0]===n?r=t[1]:(r=w(`block max-w-40 truncate rounded-sm px-0.5`,n),t[0]=n,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{className:r}),t[2]=r,t[3]=i);let a;t[4]!==e.label||t[5]!==i?(a=(0,$.jsx)(kt,{render:i,children:e.label}),t[4]=e.label,t[5]=i,t[6]=a):a=t[6];let o;t[7]===e.pathLabel?o=t[8]:(o=(0,$.jsx)(At,{side:`top`,children:e.pathLabel}),t[7]=e.pathLabel,t[8]=o);let s;return t[9]!==a||t[10]!==o?(s=(0,$.jsxs)(jt,{children:[a,o]}),t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function Fo(e){let t=(0,Q.c)(40),n=_n(e.environmentId,e.cwd,e.directoryPath,e.workspaceMutationId),{resolvedTheme:r}=be(),o;t[0]===n.data?.entries?o=t[1]:(o=n.data?.entries??[],t[0]=n.data?.entries,t[1]=o);let s=o,c=n.data?.truncated??!1,l;t[2]!==s||t[3]!==e.directoryPath?(l=vo(s,e.directoryPath),t[2]=s,t[3]=e.directoryPath,t[4]=l):l=t[4];let u=l,d=n.data!==null,f,p,g,_,y;if(t[5]!==e){let n=yo(e.directoryPath),r=e.directoryPath!==e.rootPath&&n!==null&&(e.rootPath===``||n===e.rootPath||n.startsWith(`${e.rootPath}/`));f=S,p=`start`,g=`bottom`,_=t=>{t.key===`ArrowLeft`&&r&&n!==null&&(t.preventDefault(),t.stopPropagation(),e.onDirectoryChange(n))},y=r&&n!==null?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(T,{closeOnClick:!1,onClick:()=>e.onDirectoryChange(n),children:[(0,$.jsx)(m,{}),(0,$.jsxs)(`span`,{className:`truncate`,children:[`Back to `,No(n,e.projectName)]})]}),(0,$.jsx)(C,{})]}):null,t[5]=e,t[6]=f,t[7]=p,t[8]=g,t[9]=_,t[10]=y}else f=t[6],p=t[7],g=t[8],_=t[9],y=t[10];let b;t[11]!==u||t[12]!==d||t[13]!==n.data||t[14]!==n.error||t[15]!==n.isPending||t[16]!==n.refresh||t[17]!==c||t[18]!==e||t[19]!==r?(b=n.isPending&&n.data===null?(0,$.jsxs)(T,{disabled:!0,children:[(0,$.jsx)(he,{}),`Loading folder…`]}):n.error&&n.data===null?(0,$.jsxs)(T,{closeOnClick:!1,onClick:n.refresh,children:[(0,$.jsx)(vn,{refreshing:n.isPending}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Retry loading folder`})]}):!d&&!c?(0,$.jsx)(T,{disabled:!0,children:`This folder is no longer available.`}):u.length===0?(0,$.jsx)(T,{disabled:!0,children:c?`No entries from this folder are available in the partial workspace index.`:`This folder is empty.`}):(0,$.jsx)(v,{value:e.currentFilePath,onValueChange:t=>{e.onOpenChange(!1),e.onOpenFile(t)},children:u.map(t=>{let n=t.kind===`file`&&t.path===e.currentFilePath,i=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(sn,{pathValue:t.path,kind:t.kind,theme:r}),(0,$.jsxs)(jt,{children:[(0,$.jsx)(kt,{render:(0,$.jsx)(`span`,{className:w(`min-w-0 flex-1 truncate`,t.ignored&&`text-muted-foreground`)}),children:t.label}),(0,$.jsx)(At,{side:`right`,children:t.path})]})]});return t.kind===`directory`?(0,$.jsxs)(T,{closeOnClick:!1,onClick:()=>e.onDirectoryChange(t.path),children:[i,(0,$.jsx)(a,{})]},t.path):(0,$.jsx)(h,{value:t.path,closeOnClick:!0,"aria-current":n?`page`:void 0,children:(0,$.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:i})},t.path)})}),t[11]=u,t[12]=d,t[13]=n.data,t[14]=n.error,t[15]=n.isPending,t[16]=n.refresh,t[17]=c,t[18]=e,t[19]=r,t[20]=b):b=t[20];let x;t[21]!==e.directoryPath||t[22]!==b?(x=(0,$.jsx)(i,{children:b},e.directoryPath),t[21]=e.directoryPath,t[22]=b,t[23]=x):x=t[23];let E;t[24]!==n.data||t[25]!==n.error||t[26]!==n.isPending||t[27]!==n.refresh?(E=n.error&&n.data!==null?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(C,{}),(0,$.jsxs)(T,{closeOnClick:!1,onClick:n.refresh,children:[(0,$.jsx)(vn,{refreshing:n.isPending}),`Refresh failed — retry`]})]}):null,t[24]=n.data,t[25]=n.error,t[26]=n.isPending,t[27]=n.refresh,t[28]=E):E=t[28];let D;t[29]===c?D=t[30]:(D=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(C,{}),(0,$.jsx)(T,{disabled:!0,children:`Some workspace entries are not shown.`})]}):null,t[29]=c,t[30]=D);let O;return t[31]!==f||t[32]!==p||t[33]!==g||t[34]!==_||t[35]!==y||t[36]!==x||t[37]!==E||t[38]!==D?(O=(0,$.jsxs)(f,{align:p,side:g,onKeyDown:_,children:[y,x,E,D]}),t[31]=f,t[32]=p,t[33]=g,t[34]=_,t[35]=y,t[36]=x,t[37]=E,t[38]=D,t[39]=O):O=t[39],O}function Io(e){let t=(0,Q.c)(28),[n,r]=(0,J.useState)(!1),[i,o]=(0,J.useState)(e.crumb.path),s;t[0]===e.crumb.path?s=t[1]:(s=()=>{r(!1),o(e.crumb.path)},t[0]=e.crumb.path,t[1]=s);let c;t[2]!==e.crumb.path||t[3]!==e.relativePath?(c=[e.crumb.path,e.relativePath],t[2]=e.crumb.path,t[3]=e.relativePath,t[4]=c):c=t[4],(0,J.useEffect)(s,c);let l;t[5]===e.crumb.path?l=t[6]:(l=t=>{r(t),t&&o(e.crumb.path)},t[5]=e.crumb.path,t[6]=l);let u=l,d=`Browse ${e.crumb.label}`,f;t[7]===d?f=t[8]:(f=(0,$.jsx)(`button`,{type:`button`,"aria-label":d,className:`relative mx-0.5 flex h-5 w-4 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/60 outline-none pointer-coarse:after:absolute pointer-coarse:after:-inset-3 hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring data-popup-open:bg-accent data-popup-open:text-foreground`}),t[7]=d,t[8]=f);let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(a,{className:`size-3.5`}),t[9]=m):m=t[9];let h;t[10]===f?h=t[11]:(h=(0,$.jsx)(g,{render:f,children:m}),t[10]=f,t[11]=h);let _;t[12]!==i||t[13]!==u||t[14]!==n||t[15]!==e.crumb.path||t[16]!==e.cwd||t[17]!==e.environmentId||t[18]!==e.onOpenFile||t[19]!==e.projectName||t[20]!==e.relativePath||t[21]!==e.workspaceMutationId?(_=n?(0,$.jsx)(Fo,{cwd:e.cwd,currentFilePath:e.relativePath,directoryPath:i,environmentId:e.environmentId,onDirectoryChange:o,onOpenChange:u,onOpenFile:e.onOpenFile,projectName:e.projectName,rootPath:e.crumb.path,workspaceMutationId:e.workspaceMutationId}):null,t[12]=i,t[13]=u,t[14]=n,t[15]=e.crumb.path,t[16]=e.cwd,t[17]=e.environmentId,t[18]=e.onOpenFile,t[19]=e.projectName,t[20]=e.relativePath,t[21]=e.workspaceMutationId,t[22]=_):_=t[22];let v;return t[23]!==u||t[24]!==n||t[25]!==h||t[26]!==_?(v=(0,$.jsxs)(p,{open:n,onOpenChange:u,children:[h,_]}),t[23]=u,t[24]=n,t[25]=h,t[26]=_,t[27]=v):v=t[27],v}function Lo(e){let t=(0,Q.c)(17),n;t[0]===e?n=t[1]:(n=()=>e.onNavigate(e.crumb.path),t[0]=e,t[1]=n);let r=e.descendant?`text-muted-foreground/70`:`text-muted-foreground`,i;t[2]===r?i=t[3]:(i=w(`relative block max-w-40 cursor-pointer rounded-sm px-0.5 text-left outline-none pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:-inset-y-3 hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,r),t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=(0,$.jsx)(`button`,{type:`button`,onClick:n,className:i}),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;t[7]===e.crumb.label?o=t[8]:(o=(0,$.jsx)(`span`,{className:`block truncate`,children:e.crumb.label}),t[7]=e.crumb.label,t[8]=o);let s;t[9]!==a||t[10]!==o?(s=(0,$.jsx)(kt,{render:a,children:o}),t[9]=a,t[10]=o,t[11]=s):s=t[11];let c=e.crumb.path||e.projectName,l;t[12]===c?l=t[13]:(l=(0,$.jsx)(At,{side:`top`,children:c}),t[12]=c,t[13]=l);let u;return t[14]!==s||t[15]!==l?(u=(0,$.jsxs)(jt,{children:[s,l]}),t[14]=s,t[15]=l,t[16]=u):u=t[16],u}function Ro(e){let t=(0,Q.c)(21),n;t[0]===e.relativePath?n=t[1]:(n=j(e.relativePath),t[0]=e.relativePath,t[1]=n);let r=n,i;t[2]!==e.projectName||t[3]!==e.trail?(i=uo(e.projectName,e.trail),t[2]=e.projectName,t[3]=e.trail,t[4]=i):i=t[4];let o=i,s;t[5]===e.relativePath?s=t[6]:(s=fo(e.relativePath),t[5]=e.relativePath,t[6]=s);let c=s,l;t[7]===c?l=t[8]:(l=e=>e.path===c,t[7]=c,t[8]=l);let u=o.findIndex(l),d;if(t[9]!==o||t[10]!==u||t[11]!==r||t[12]!==e){let n;t[14]!==o.length||t[15]!==u||t[16]!==r||t[17]!==e?(n=(t,n)=>{let i=n===u;return(0,$.jsxs)(`li`,{className:`flex min-w-0 shrink-0 items-center`,"data-file-crumb":!0,"data-current-file-crumb":i,children:[i?(0,$.jsx)(`span`,{"aria-current":`page`,children:(0,$.jsx)(Po,{current:!0,label:t.label,pathLabel:t.path||e.projectName})}):r&&!po(t.path)?(0,$.jsx)(Po,{label:t.label,pathLabel:t.path}):(0,$.jsx)(Lo,{crumb:t,descendant:n>u,onNavigate:e.onNavigateFolder,projectName:e.projectName}),n===o.length-1?null:r?(0,$.jsx)(a,{"aria-hidden":!0,className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):(0,$.jsx)(Io,{...e,crumb:t})]},t.path||`project`)},t[14]=o.length,t[15]=u,t[16]=r,t[17]=e,t[18]=n):n=t[18],d=o.map(n),t[9]=o,t[10]=u,t[11]=r,t[12]=e,t[13]=d}else d=t[13];let f;return t[19]===d?f=t[20]:(f=(0,$.jsx)(`nav`,{"aria-label":`File path`,className:`flex h-full`,children:(0,$.jsx)(`ol`,{className:`flex items-center`,children:d})}),t[19]=d,t[20]=f),f}function zo(e){let t=(0,Q.c)(16),n;t[0]===e.relativePath?n=t[1]:(n=e.relativePath.lastIndexOf(`/`),t[0]=e.relativePath,t[1]=n);let r;t[2]===e.relativePath?r=t[3]:(r=e.relativePath.lastIndexOf(`\\`),t[2]=e.relativePath,t[3]=r);let i=Math.max(n,r),a;t[4]!==i||t[5]!==e.cwd||t[6]!==e.relativePath?(a=i>=0?Ee(e.relativePath.slice(0,i),e.cwd):e.cwd,t[4]=i,t[5]=e.cwd,t[6]=e.relativePath,t[7]=a):a=t[7];let o=a,s;t[8]===e.text?s=t[9]:(s=q(e.text),t[8]=e.text,t[9]=s);let c;return t[10]!==o||t[11]!==e.cwd||t[12]!==e.onTaskListChange||t[13]!==e.threadRef||t[14]!==s?(c=(0,$.jsx)(me,{text:s,cwd:e.cwd,imageBaseDir:o,threadRef:e.threadRef,className:`mx-auto max-w-4xl px-6 py-5`,onTaskListChange:e.onTaskListChange}),t[10]=o,t[11]=e.cwd,t[12]=e.onTaskListChange,t[13]=e.threadRef,t[14]=s,t[15]=c):c=t[15],c}function Bo({root:e,editor:t,onDismiss:n}){n(),t.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function Vo(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function Ho({root:e,editor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||Bo({root:e,editor:t,onDismiss:r})},a=i=>{i.key===`Escape`&&!n()&&Vo(e)&&(i.preventDefault(),i.stopImmediatePropagation(),Bo({root:e,editor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function Uo(e){let t=e.renderedLine===void 0?e.fileTop+e.estimatedLine.top:e.scrollTop+e.renderedLine.top-e.viewportTop,n=e.renderedLine?.height??e.estimatedLine.height,r=Math.max(0,t-Math.max(0,(e.viewportHeight-n)/2));return Math.min(r,Math.max(0,e.scrollHeight-e.viewportHeight))}function Wo(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function Go(e,t,n){return`${e}:${t}:${Wo(n)}`}function Ko(e,t){return e===null||e===`.`||A(e,t)===`.`?null:e}var qo=e=>/\.(?:md|mdx)$/i.test(e);function Jo(e){switch(e.failure){case`path_not_file`:return`The path is a directory or special file, not a regular file.`;case`binary_file`:return`The file is binary and cannot be displayed as text.`;case`workspace_path_outside_root`:return`The requested path is outside the workspace.`;case`resolved_path_outside_root`:return`The path resolves to a location outside the workspace.`;case`operation_failed`:return e.operation===`realpath-workspace-root`?`The workspace folder could not be accessed.`:`The file could not be accessed or read. It may be missing or inaccessible.`;default:return e.message}}function Yo(e){return e.attachmentOpen||e.relativePath&&j(e.relativePath)?!1:e.explorerOpen||e.relativePath===null}function Xo(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}function Zo(e){return e.draft?{_tag:`draft-workspace-file`,cwd:e.workspaceRoot,path:e.absolutePath}:{_tag:e.kind,threadId:e.threadRef.threadId,path:e.absolutePath}}var Qo=class{options;timer=null;latestContents=``;latestRevision=0;confirmedRevision=0;lastChangeAt=0;saving=!1;disposed=!1;constructor(e){this.options=e}change(e){this.disposed||(this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs))}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===this.confirmedRevision||this.options.canPersist?.()===!1)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=(await this.options.persist(e))._tag===`Success`,r=!1;if(n&&(this.confirmedRevision=t,r=this.options.onConfirmed(e)!==!1),this.saving=!1,t===this.latestRevision){r&&this.options.onPendingChange(!1);return}let i=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(i)}},$o=500;function es(e){let t=(0,Q.c)(17),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=Ce(n,E),s=Te(ce.writeFile),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.createRef)(),t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>l.current?.change(e),t[1]=u):u=t[1];let d;t[2]!==r||t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==s?(d={change:u,setup:()=>{let e=new Qo({debounceMs:$o,canPersist:()=>we(n,E),onPendingChange:e=>a(i,e),persist:e=>s({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),onConfirmed:e=>gn(n,r,i,e)});return l.current=e,()=>{l.current=null,e.dispose()}}},t[2]=r,t[3]=n,t[4]=a,t[5]=i,t[6]=s,t[7]=d):d=t[7];let f=d,p;t[8]===f?p=t[9]:(p=[f],t[8]=f,t[9]=p),(0,J.useEffect)(f.setup,p);let m,h;return t[10]!==o||t[11]!==r||t[12]!==n||t[13]!==i||t[14]!==f?(m=()=>{if(!o)return;let e=!1;return queueMicrotask(()=>{if(e)return;let t=hn(n,r,i);t&&f.change(t.contents)}),()=>{e=!0}},h=[o,r,n,i,f],t[10]=o,t[11]=r,t[12]=n,t[13]=i,t[14]=f,t[15]=m,t[16]=h):(m=t[15],h=t[16]),(0,J.useEffect)(m,h),f}var ts=`p4code.fileExplorerOpen`,ns=`p4code.renderMarkdown`,rs=`p4code.renderBrowserFile`,is=`p4code.renderTable`;function as(e){let t=(0,Q.c)(28),n;t[0]!==e.absolutePath||t[1]!==e.draft||t[2]!==e.threadRef||t[3]!==e.workspaceRoot?(n=Zo({kind:`workspace-file`,threadRef:e.threadRef,draft:e.draft,workspaceRoot:e.workspaceRoot,absolutePath:e.absolutePath}),t[0]=e.absolutePath,t[1]=e.draft,t[2]=e.threadRef,t[3]=e.workspaceRoot,t[4]=n):n=t[4];let r=n,i=en(e.environmentId,r),[a,o]=(0,J.useState)(null),s;t[5]!==i._tag||t[6]!==i.url||t[7]!==e.workspaceMutationId?(s=e.workspaceMutationId===null?``:`${i._tag===`Success`&&i.url.includes(`?`)?`&`:`?`}workspace-revision=${encodeURIComponent(e.workspaceMutationId)}`,t[5]=i._tag,t[6]=i.url,t[7]=e.workspaceMutationId,t[8]=s):s=t[8];let c=s,l=i._tag===`Success`?`${i.url}${c}`:null,u=e.alt,d;t[9]!==e.absolutePath||t[10]!==e.workspaceRoot?(d=gt(e.absolutePath,e.workspaceRoot),t[9]=e.absolutePath,t[10]=e.workspaceRoot,t[11]=d):d=t[11];let f;t[12]!==e.environmentId||t[13]!==r?(f={environmentId:e.environmentId,resource:r},t[12]=e.environmentId,t[13]=r,t[14]=f):f=t[14];let p;t[15]!==l||t[16]!==e.alt||t[17]!==d||t[18]!==f?(p={kind:`image`,name:u,src:l,reference:d,asset:f},t[15]=l,t[16]=e.alt,t[17]=d,t[18]=f,t[19]=p):p=t[19];let m=p;if(i._tag===`Failure`||l!==null&&a===l){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load workspace image.`}),t[20]=e):e=t[20];let n;return t[21]===m?n=t[22]:(n=(0,$.jsx)(F,{source:m,children:e}),t[21]=m,t[22]=n),n}let h;return t[23]!==m||t[24]!==i._tag||t[25]!==l||t[26]!==e.alt?(h=i._tag===`Success`&&l!==null?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,$.jsx)(F,{source:m,children:(0,$.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:l,alt:e.alt,onError:()=>o(l)})})}):(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,$.jsx)(he,{size:`lg`})}),t[23]=m,t[24]=i._tag,t[25]=l,t[26]=e.alt,t[27]=h):h=t[27],h}function os(e){let t=(0,Q.c)(19),n=gt(e.absolutePath,e.workspaceRoot).relativePath===void 0?`media-file`:`workspace-file`,r;t[0]!==e.absolutePath||t[1]!==e.draft||t[2]!==e.threadRef||t[3]!==e.workspaceRoot||t[4]!==n?(r=Zo({kind:n,threadRef:e.threadRef,draft:e.draft,workspaceRoot:e.workspaceRoot,absolutePath:e.absolutePath}),t[0]=e.absolutePath,t[1]=e.draft,t[2]=e.threadRef,t[3]=e.workspaceRoot,t[4]=n,t[5]=r):r=t[5];let i=r,a=en(e.environmentId,i),o;t[6]!==a._tag||t[7]!==a.url||t[8]!==e.workspaceMutationId?(o=e.workspaceMutationId===null?``:`${a._tag===`Success`&&a.url.includes(`?`)?`&`:`?`}workspace-revision=${encodeURIComponent(e.workspaceMutationId)}`,t[6]=a._tag,t[7]=a.url,t[8]=e.workspaceMutationId,t[9]=o):o=t[9];let s=o;if(a._tag===`Failure`){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load file preview.`}),t[10]=e):e=t[10],e}if(a._tag!==`Success`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,$.jsx)(he,{size:`lg`})}),t[11]=e):e=t[11],e}let c=`${a.url}${s}`,l=`${e.environmentId}:${i._tag}:${e.threadRef.threadId}:${e.absolutePath}:${e.workspaceMutationId}`,u=e.title,d;t[12]===e.absolutePath?d=t[13]:(d=bt(e.absolutePath),t[12]=e.absolutePath,t[13]=d);let f;return t[14]!==e.title||t[15]!==c||t[16]!==l||t[17]!==d?(f=(0,$.jsx)(Ct,{src:c,documentKey:l,title:u,pdf:d}),t[14]=e.title,t[15]=c,t[16]=l,t[17]=d,t[18]=f):f=t[18],f}function ss(e){let t=(0,Q.c)(36),n;t[0]!==e.absolutePath||t[1]!==e.draft||t[2]!==e.threadRef||t[3]!==e.workspaceRoot?(n=Zo({kind:`media-file`,threadRef:e.threadRef,draft:e.draft,workspaceRoot:e.workspaceRoot,absolutePath:e.absolutePath}),t[0]=e.absolutePath,t[1]=e.draft,t[2]=e.threadRef,t[3]=e.workspaceRoot,t[4]=n):n=t[4];let r=n,i=en(e.environmentId,r),a=tn(e.environmentId,r),o=e.workspaceMutationId,s;t[5]!==e.environmentId||t[6]!==r?(s=JSON.stringify([e.environmentId,r]),t[5]=e.environmentId,t[6]=r,t[7]=s):s=t[7];let c;t[8]===a?c=t[9]:(c=()=>{a().catch(cs)},t[8]=a,t[9]=c);let l;t[10]!==e.workspaceMutationId||t[11]!==s||t[12]!==c?(l={mutationId:o,resourceKey:s,refresh:c},t[10]=e.workspaceMutationId,t[11]=s,t[12]=c,t[13]=l):l=t[13],xn(l);let u;t[14]!==i._tag||t[15]!==i.url||t[16]!==e.workspaceMutationId?(u=e.workspaceMutationId===null?``:`${i._tag===`Success`&&i.url.includes(`?`)?`&`:`?`}workspace-revision=${encodeURIComponent(e.workspaceMutationId)}`,t[14]=i._tag,t[15]=i.url,t[16]=e.workspaceMutationId,t[17]=u):u=t[17];let d=u,f=i._tag===`Success`?`${i.url}${d}`:null,p=i._tag===`Failure`,m=e.name,h=e.workspaceMutationId,g=e.name,_;t[18]!==e.absolutePath||t[19]!==e.workspaceRoot?(_=gt(e.absolutePath,e.workspaceRoot),t[18]=e.absolutePath,t[19]=e.workspaceRoot,t[20]=_):_=t[20];let v;t[21]!==e.environmentId||t[22]!==r?(v={environmentId:e.environmentId,resource:r},t[21]=e.environmentId,t[22]=r,t[23]=v):v=t[23];let y;t[24]!==f||t[25]!==e.name||t[26]!==_||t[27]!==v?(y={kind:`video`,name:g,src:f,reference:_,asset:v},t[24]=f,t[25]=e.name,t[26]=_,t[27]=v,t[28]=y):y=t[28];let b;return t[29]!==f||t[30]!==e.name||t[31]!==e.workspaceMutationId||t[32]!==a||t[33]!==y||t[34]!==p?(b=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,$.jsx)(pe,{src:f,sourceFailed:p,label:m,revision:h,preload:`metadata`,className:`flex h-full min-h-0 w-full max-w-5xl items-center justify-center`,videoClassName:`aspect-auto max-h-full w-auto max-w-full`,onRetry:a,actionsSource:y})}),t[29]=f,t[30]=e.name,t[31]=e.workspaceMutationId,t[32]=a,t[33]=y,t[34]=p,t[35]=b):b=t[35],b}function cs(){}function ls(e){let t=(0,Q.c)(27),n;t[0]!==e.absolutePath||t[1]!==e.draft||t[2]!==e.threadRef||t[3]!==e.workspaceRoot?(n=Zo({kind:`media-file`,threadRef:e.threadRef,draft:e.draft,workspaceRoot:e.workspaceRoot,absolutePath:e.absolutePath}),t[0]=e.absolutePath,t[1]=e.draft,t[2]=e.threadRef,t[3]=e.workspaceRoot,t[4]=n):n=t[4];let r=n,i=en(e.environmentId,r),a=tn(e.environmentId,r),[o,s]=(0,J.useState)(null),c=e.workspaceMutationId,l;t[5]!==e.environmentId||t[6]!==r?(l=JSON.stringify([e.environmentId,r]),t[5]=e.environmentId,t[6]=r,t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=()=>{a().catch(ds)},t[8]=a,t[9]=u);let d;t[10]!==e.workspaceMutationId||t[11]!==l||t[12]!==u?(d={mutationId:c,resourceKey:l,refresh:u},t[10]=e.workspaceMutationId,t[11]=l,t[12]=u,t[13]=d):d=t[13],xn(d);let f;t[14]!==i._tag||t[15]!==i.url||t[16]!==e.workspaceMutationId?(f=e.workspaceMutationId===null?``:`${i._tag===`Success`&&i.url.includes(`?`)?`&`:`?`}workspace-revision=${encodeURIComponent(e.workspaceMutationId)}`,t[14]=i._tag,t[15]=i.url,t[16]=e.workspaceMutationId,t[17]=f):f=t[17];let p=f,m=i._tag===`Success`?`${i.url}${p}`:null;if(i._tag===`Failure`||m!==null&&o===m){let e;return t[18]===a?e=t[19]:(e=(0,$.jsx)(Tt,{message:`Unable to load audio.`,onRetry:()=>{s(null),a().catch(us)}}),t[18]=a,t[19]=e),e}if(m===null){let e;return t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(St,{}),t[20]=e):e=t[20],e}let h;t[21]===m?h=t[22]:(h=()=>s(m),t[21]=m,t[22]=h);let g;return t[23]!==e.name||t[24]!==h||t[25]!==m?(g=(0,$.jsx)(xt,{src:m,name:e.name,onError:h}),t[23]=e.name,t[24]=h,t[25]=m,t[26]=g):g=t[26],g}function us(){}function ds(){}function fs(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function ps(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${vt}]`))e.removeAttribute(vt);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(vt,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(vt,``))}var ms=30,hs=20,gs=2;function _s(e,t,n){let r=(0,Q.c)(5),[i]=(0,J.useState)(vs),a;return r[0]!==e||r[1]!==t||r[2]!==n||r[3]!==i?(a=(r,a,o)=>{if(e===null)return;let s=i.get(e),c=s??{frameId:null,cancelGuard:null,handledRequestId:null,latestRequestId:null};s||i.set(e,c);let l=()=>{c.frameId!==null&&(cancelAnimationFrame(c.frameId),c.frameId=null),c.cancelGuard?.()};if(o===`unmount`){l();return}let u=a.file?.contents;if(ps(r,t===null||u===void 0?null:fs(u,t)),!(a instanceof qe))return;if(c.latestRequestId!==n&&(l(),c.latestRequestId=n,c.handledRequestId=null),t===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);if(!d||(r.style.minHeight=`${Math.ceil(Math.max(a.height,d.clientHeight))}px`,c.handledRequestId===n||c.frameId!==null))return;let f=e=>{let t=a.getLinePosition(e);if(!t)return null;let n=d.getBoundingClientRect(),i=d.scrollTop+r.getBoundingClientRect().top-n.top,o=(r.shadowRoot??r).querySelector(`[data-line="${e}"]`)?.getBoundingClientRect();return Uo({scrollTop:d.scrollTop,scrollHeight:d.scrollHeight,viewportTop:n.top,viewportHeight:d.clientHeight,fileTop:i,estimatedLine:t,...o&&o.height>0?{renderedLine:{top:o.top,height:o.height}}:{}})},p=e=>{let t=hs,n=null,r=()=>{n!==null&&(cancelAnimationFrame(n),n=null),d.removeEventListener(`wheel`,r),d.removeEventListener(`touchstart`,r),d.removeEventListener(`pointerdown`,r,!0),window.removeEventListener(`keydown`,r,!0),c.cancelGuard===r&&(c.cancelGuard=null)};d.addEventListener(`wheel`,r,{passive:!0}),d.addEventListener(`touchstart`,r,{passive:!0}),d.addEventListener(`pointerdown`,r,{passive:!0,capture:!0}),window.addEventListener(`keydown`,r,!0);let i=()=>{if(n=null,--t,t<=0||!d.isConnected){r();return}let a=f(e);a!==null&&Math.abs(d.scrollTop-a)>gs&&(d.scrollTop=a),n=requestAnimationFrame(i)};n=requestAnimationFrame(i),c.cancelGuard=r},m=e=>{c.frameId=requestAnimationFrame(()=>{if(c.frameId=null,c.latestRequestId!==n||!r.isConnected)return;let i=a.file?.contents,o=i===void 0?null:fs(i,t),s=o===null?null:f(o);o===null||s===null?e<ms&&m(e+1):(ps(r,o),d.scrollTop=s,c.handledRequestId=n,p(o))})};m(0)},r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a):a=r[4],a}function vs(){return new Map}var ys=(e,t,n)=>new ao(e,t,n);function bs(e,t,n,r){return{name:n,contents:r,cacheKey:`editor:${e}:${Go(t,n,r)}`}}function xs(e,t){if(e?.isWorkingPool()!==!0||(t.lang??yn(t.name))===`text`)return!1;let n=1;for(let e=t.contents.indexOf(`
32
32
  `);e!==-1;e=t.contents.indexOf(`
33
33
  `,e+1))n+=1;return n<=Me}function Ss(e){let t=(0,Q.c)(15),n=Le(),[r,i]=(0,J.useState)(null),a;t[0]!==e||t[1]!==n?(a=xs(n,e),t[0]=e,t[1]=n,t[2]=a):a=t[2];let o=!a||r===e,s,c;t[3]!==e||t[4]!==o||t[5]!==n?(s=()=>{o||n===void 0||n.primeFileHighlightCache(e).catch(()=>i(e))},c=[e,o,n],t[3]=e,t[4]=o,t[5]=n,t[6]=s,t[7]=c):(s=t[6],c=t[7]),(0,J.useEffect)(s,c);let l;t[8]!==e||t[9]!==o||t[10]!==n?(l=(t,r)=>{o||r===`unmount`||t?.cacheKey!==e.cacheKey||n?.getFileResultCache(e)!==void 0&&i(e)},t[8]=e,t[9]=o,t[10]=n,t[11]=l):l=t[11];let u=l,d;return t[12]!==u||t[13]!==o?(d={ready:o,onPostRender:u},t[12]=u,t[13]=o,t[14]=d):d=t[14],d}function Cs(e){let t=(0,Q.c)(68),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:a,contents:s,resolvedTheme:c,revealRequestId:l,wordWrap:u,onPostRender:d,onPendingChange:f}=e,p=o(As),m=o(ks),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[0]=h):h=t[0];let[g,_]=(0,J.useState)(h),[v,b]=(0,J.useState)(null),x=v?.revealRequestId===l?v.range:null,S;t[1]===l?S=t[2]:(S=e=>{b({revealRequestId:l,range:e})},t[1]=l,t[2]=S);let C=S,w=(0,J.useRef)(null),T=(0,J.useRef)(null),E;t[3]!==r||t[4]!==n||t[5]!==f||t[6]!==i?(E={environmentId:n,cwd:r,relativePath:i,onPendingChange:f},t[3]=r,t[4]=n,t[5]=f,t[6]=i,t[7]=E):E=t[7];let D=es(E),O;t[8]!==s||t[9]!==r||t[10]!==n||t[11]!==i?(O=()=>bs(n,r,i,s),t[8]=s,t[9]=r,t[10]=n,t[11]=i,t[12]=O):O=t[12];let[k,ee]=(0,J.useState)(O),[te,ne]=(0,J.useState)(null);s!==(te??k.contents)&&(ee(bs(n,r,i,s)),ne(null));let{ready:A,onPostRender:j}=Ss(k),re=(0,J.useRef)(null),ie;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie={onAttach:e=>{re.current=e},onComplete:()=>{re.current=null}},t[13]=ie):ie=t[13];let ae=ie,oe;t[14]!==p||t[15]!==a||t[16]!==r||t[17]!==n||t[18]!==i||t[19]!==D?(oe=e=>{let{file:t,lineAnnotations:o}=e;if(t.contents===fn(n,r,i)||(ne(t.contents),pn(n,r,i,t.contents),D.change(t.contents),!o))return;let s=Mt(o);_(e=>e===o?e:s);for(let e of s)for(let n of e.metadata.entries)n.kind===`comment`&&p(a,y({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:t.contents}))},t[14]=p,t[15]=a,t[16]=r,t[17]=n,t[18]=i,t[19]=D,t[20]=oe):oe=t[20];let se=oe,ce;t[21]!==a||t[22]!==m||t[23]!==C?(ce=e=>{C(null),m(a,e),_(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[21]=a,t[22]=m,t[23]=C,t[24]=ce):ce=t[24];let le=ce,M;t[25]!==p||t[26]!==a||t[27]!==s||t[28]!==g||t[29]!==i||t[30]!==C?(M=(e,t)=>{C(null);let n=g.flatMap(Os).find(t=>t.id===e);n&&p(a,y({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:s})),_(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[25]=p,t[26]=a,t[27]=s,t[28]=g,t[29]=i,t[30]=C,t[31]=M):M=t[31];let N=M,P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{re.current?.setSelections([]),re.current?.blur();let{startLine:t,endLine:n}=Pt(e),r={id:Nt(),kind:`draft`,startLine:t,endLine:n,text:``};_(e=>{let t=e.flatMap(Es),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[32]=P):P=t[32];let ue=P,de;t[33]===g?de=t[34]:(de=g.some(ws),t[33]=g,t[34]=de);let fe=de,pe,me;t[35]!==fe||t[36]!==C?(pe=()=>{let e=w.current;if(e)return Ho({root:e,editor:{setSelections:e=>re.current?.setSelections(e)},isBlocked:()=>fe,onDismiss:()=>C(null)})},me=[fe,C],t[35]=fe,t[36]=C,t[37]=pe,t[38]=me):(pe=t[37],me=t[38]),(0,J.useEffect)(pe,me);let F;t[39]===C?F=t[40]:(F=e=>{C(e),e&&ue(e)},t[39]=C,t[40]=F);let he=F,ge;t[41]!==j||t[42]!==d||t[43]!==x?(ge=(e,t,n)=>{d(e,t,n),j(t.file,n),T.current!==null&&(cancelAnimationFrame(T.current),T.current=null),n!==`unmount`&&(T.current=requestAnimationFrame(()=>{T.current=null,e.isConnected&&t.setSelectedLines(x,{notify:!1})}))},t[41]=j,t[42]=d,t[43]=x,t[44]=ge):ge=t[44];let _e=ge,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve={overscrollSize:600,intersectionObserverMargin:1200},t[45]=ve):ve=t[45];let ye=!fe,be=!fe,xe=u?`wrap`:`scroll`,Se;t[46]===c?Se=t[47]:(Se=Ae(c),t[46]=c,t[47]=Se);let Ce;t[48]!==he||t[49]!==_e||t[50]!==c||t[51]!==C||t[52]!==ye||t[53]!==be||t[54]!==xe||t[55]!==Se?(Ce={disableFileHeader:!0,enableGutterUtility:ye,enableLineSelection:be,onGutterUtilityClick:C,onLineSelectionChange:C,onLineSelectionEnd:he,overflow:xe,theme:Se,preferredHighlighter:bn,themeType:c,unsafeCSS:wt,onPostRender:_e},t[48]=he,t[49]=_e,t[50]=c,t[51]=C,t[52]=ye,t[53]=be,t[54]=xe,t[55]=Se,t[56]=Ce):Ce=t[56];let we;t[57]!==le||t[58]!==N?(we=e=>(0,$.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,$.jsx)(dt,{kind:e.kind,rangeLabel:Ft(e.startLine,e.endLine),text:e.text,onCancel:()=>le(e.id),onComment:t=>N(e.id,t),onDelete:()=>le(e.id)},e.id))}),t[57]=le,t[58]=N,t[59]=we):we=t[59];let Te;return t[60]!==A||t[61]!==k||t[62]!==se||t[63]!==g||t[64]!==x||t[65]!==Ce||t[66]!==we?(Te=(0,$.jsx)(z,{createEditor:ys,children:(0,$.jsx)(`div`,{ref:w,className:`flex min-h-0 flex-1`,children:(0,$.jsx)(ze,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:ve,children:(0,$.jsx)(It,{file:k,edit:A,editorOptions:ae,onEditChange:se,options:Ce,selectedLines:x,lineAnnotations:g,renderAnnotation:we,className:`min-h-full`})})})}),t[60]=A,t[61]=k,t[62]=se,t[63]=g,t[64]=x,t[65]=Ce,t[66]=we,t[67]=Te):Te=t[67],Te}function ws(e){return e.metadata.entries.some(Ts)}function Ts(e){return e.kind===`draft`}function Es(e){let t=e.metadata.entries.filter(Ds);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Ds(e){return e.kind!==`draft`}function Os(e){return e.metadata.entries}function ks(e){return e.removeReviewComment}function As(e){return e.addReviewComment}function js(e){let t=(0,Q.c)(18),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,readOnly:s,onPendingChange:c}=e,l;t[0]!==r||t[1]!==n||t[2]!==c||t[3]!==i?(l={environmentId:n,cwd:r,relativePath:i,onPendingChange:c},t[0]=r,t[1]=n,t[2]=c,t[3]=i,t[4]=l):l=t[4];let u=es(l),d;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==u?(d=s?void 0:e=>{let{markerOffset:t,checked:o}=e,s=mn(n,r,i)?.contents??a,c=Xo(s,t,o);c!==s&&(pn(n,r,i,c),u.change(c))},t[5]=a,t[6]=r,t[7]=n,t[8]=s,t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==a||t[13]!==r||t[14]!==i||t[15]!==d||t[16]!==o?(f=(0,$.jsx)(qt,{className:`min-h-0 flex-1`,children:(0,$.jsx)(zo,{text:a,cwd:r,relativePath:i,threadRef:o,onTaskListChange:d})}),t[12]=a,t[13]=r,t[14]=i,t[15]=d,t[16]=o,t[17]=f):f=t[17],f}function Ms(e,t){return e===`markdown`?t?`Show markdown source`:`Show rendered markdown`:e===`table`?t?`Show source`:`Show table`:t?`Show HTML source`:`Show rendered page`}function Ns(){try{return d(ts,k)??!0}catch(e){return console.error(e),!0}}function Ps(e){let t=(0,Q.c)(168),{environmentId:n,cwd:r,projectName:i,relativePath:a,attachment:o,threadRef:s,composerDraftTarget:d,keybindings:f,availableEditors:p,revealLine:m,revealRequestId:h,onOpenFile:g,onNavigateFolder:_,folderTrail:v,onPendingChange:y,selectedFilePending:b,workspaceMutationId:S}=e,C;t[0]!==o||t[1]!==r||t[2]!==a?(C=o===void 0?Ko(a,r):a,t[0]=o,t[1]=r,t[2]=a,t[3]=C):C=t[3];let T=C,D=typeof d==`string`,{resolvedTheme:A}=be(),ie=Se(Is),[oe,ce]=(0,J.useState)(null),N=oe??ie,P=Ce(n,O),pe=xe(),me=fe(n),F=ve(n),_e=nn(n),ye;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ye={reportFailure:!1},t[4]=ye):ye=t[4];let we=$t(Qt.createUrl,ye),De;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(De={reportFailure:!1},t[5]=De):De=t[5];let ke=Te(on.open,De),I;t[6]===T?I=t[7]:(I=T!==null&&re(T),t[6]=T,t[7]=I);let L=I,Ae;t[8]!==L||t[9]!==T?(Ae=T!==null&&!L&&ae(T),t[8]=L,t[9]=T,t[10]=Ae):Ae=t[10];let je=Ae,Me;t[11]!==L||t[12]!==T?(Me=T!==null&&!L&&ne(T),t[11]=L,t[12]=T,t[13]=Me):Me=t[13];let Ne=Me,Pe=Ne||L||je,Fe;t[14]===T?Fe=t[15]:(Fe=T!==null&&bt(T),t[14]=T,t[15]=Fe);let R=Fe,Ie;t[16]!==R||t[17]!==T?(Ie=T!==null&&!R&&an(T),t[16]=R,t[17]=T,t[18]=Ie):Ie=t[18];let Le=Ie,Re;t[19]!==o||t[20]!==T?(Re=o!==void 0||T!==null&&j(T),t[19]=o,t[20]=T,t[21]=Re):Re=t[21];let z=Re,ze=se(n),{canReadFiles:Be}=ze,Ve=Ce(n,E),B=dn(n,r,T,o===void 0&&T!==null),He=B.readError?.resolvedPath??B.readError?.operationPath,V=o===void 0?T??(v===void 0?null:``):null,Ue;t[22]!==V||t[23]!==v?(Ue=V===null?null:ho(v,V),t[22]=V,t[23]=v,t[24]=Ue):Ue=t[24];let H=Ue,We=o===void 0&&(B.isNotFile||v!==void 0&&B.data===null&&B.error===null),Ge=We&&z?T:null,U=We?null:T,[Ke,qe]=(0,J.useState)(Ns),Je=o!==void 0,Ye;t[25]!==Ke||t[26]!==U||t[27]!==Je?(Ye=Yo({relativePath:U,explorerOpen:Ke,attachmentOpen:Je}),t[25]=Ke,t[26]=U,t[27]=Je,t[28]=Ye):Ye=t[28];let Xe=Ye,[Qe,$e]=u(ns,!1,k),[et,tt]=u(rs,!0,k),[nt,rt]=u(is,!0,k),[it,at]=(0,J.useState)(null),W=(0,J.useRef)(null),ot;t[29]===U?ot=t[30]:(ot=U?qo(U):!1,t[29]=U,t[30]=ot);let st=ot,G;t[31]!==o||t[32]!==U?(G=U&&o===void 0?Ot({name:U}):null,t[31]=o,t[32]=U,t[33]=G):G=t[33];let ct=G,lt=m===null||it?.path===T&&it.requestId===h,ut=st&&Qe&&lt,K=R||Le&&et&&lt,dt=ct!==null&&nt&&lt,ft=st?`markdown`:ct?`table`:Le?`html`:null,pt=U!==null&&o===void 0&&ft!==null,mt=U!==null&&B.data!==null&&!(st&&ut)&&!(ct&&dt)&&!K,ht=st?ut:ct?dt:K,gt=st?$e:ct?rt:tt,vt;t[34]!==o||t[35]!==P||t[36]!==L||t[37]!==_e||t[38]!==U?(vt=P&&U!==null&&o===void 0&&!L&&_e&&an(U),t[34]=o,t[35]=P,t[36]=L,t[37]=_e,t[38]=U,t[39]=vt):vt=t[39];let xt=vt,St;t[40]!==H||t[41]!==We||t[42]!==_?(St=e=>{let t=H!==null&&fo(H)===e?H:e;_(t,ho(H??void 0,t),!We)},t[40]=H,t[41]=We,t[42]=_,t[43]=St):St=t[43];let Ct=St,wt;t[44]!==o||t[45]!==V||t[46]!==r||t[47]!==T?(wt=V===``?r:T&&o===void 0?Ee(T,r):null,t[44]=o,t[45]=V,t[46]=r,t[47]=T,t[48]=wt):wt=t[48];let q=wt,Tt=_s(T,m,h),kt=o===void 0&&T!==null&&(We||!Pe&&!R)&&!b,At=`file:${n}:${r}:${T??``}`,jt;t[49]!==B.refresh||t[50]!==kt||t[51]!==At||t[52]!==S?(jt={enabled:kt,mutationId:S,refresh:B.refresh,resourceKey:At},t[49]=B.refresh,t[50]=kt,t[51]=At,t[52]=S,t[53]=jt):jt=t[53],xn(jt);let Mt;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>{let e=W.current?.querySelectorAll(`[data-file-crumb]`);e?.[e.length-1]?.scrollIntoView({block:`nearest`,inline:`end`}),W.current?.querySelector(`[data-current-file-crumb='true']`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},t[54]=Mt):Mt=t[54];let Nt;t[55]!==V||t[56]!==H?(Nt=[V,H],t[55]=V,t[56]=H,t[57]=Nt):Nt=t[57],(0,J.useEffect)(Mt,Nt);let Pt;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=()=>{qe(Fs)},t[58]=Pt):Pt=t[58];let Ft=Pt,It;t[59]!==q||t[60]!==P||t[61]!==Be||t[62]!==we||t[63]!==r||t[64]!==F||t[65]!==ke||t[66]!==s?(It=()=>{Be&&P&&q&&F&&(async()=>{let e=await rn({threadRef:s,filePath:q,workspaceRoot:r,httpBaseUrl:F,createAssetUrl:we,openPreview:ke});if(e._tag===`Success`||te(e))return;let t=ee(e);ge.add(Oe({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[59]=q,t[60]=P,t[61]=Be,t[62]=we,t[63]=r,t[64]=F,t[65]=ke,t[66]=s,t[67]=It):It=t[67];let Rt=It;if(o===void 0&&!Be){if(ze.isPending){let e;return t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(he,{className:`size-4`}),`Checking file access...`]}),t[68]=e):e=t[68],e}let e=ze.error??`This connection cannot read host files.`,n;return t[69]===e?n=t[70]:(n=(0,$.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:e}),t[69]=e,t[70]=n),n}let zt;t[71]!==q||t[72]!==p||t[73]!==V||t[74]!==H||t[75]!==xt||t[76]!==pt||t[77]!==r||t[78]!==n||t[79]!==Ke||t[80]!==Rt||t[81]!==z||t[82]!==f||t[83]!==Ct||t[84]!==g||t[85]!==U||t[86]!==pe||t[87]!==i||t[88]!==T||t[89]!==me||t[90]!==ht||t[91]!==ft||t[92]!==h||t[93]!==gt||t[94]!==mt||t[95]!==N||t[96]!==S?(zt=V!==null&&H!==null?(0,$.jsxs)(`div`,{className:Et,"data-surface-subheader":!0,children:[(0,$.jsx)(qt,{radius:`none`,ref:W,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1`,"data-file-breadcrumbs":!0,children:(0,$.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:(0,$.jsx)(Ro,{cwd:r,environmentId:n,onNavigateFolder:Ct,onOpenFile:g,projectName:i,relativePath:V,trail:H,workspaceMutationId:S})})}),q&&(n===pe||me.mode!==`local-exec`)?(0,$.jsx)(Cn,{environmentId:n,keybindings:f,availableEditors:p,openInCwd:q,compact:!0}):null,pt&&ft?(0,$.jsx)(_t,{label:Ms(ft,ht),pressed:ht,onPress:()=>{let e=!ht;gt(e),at(e&&T!==null?{path:T,requestId:h}:null)},children:(0,$.jsx)(ue,{className:`size-3.5`,icon:ht?de:ft===`table`?M:le})}):null,mt?(0,$.jsx)(_t,{label:N?`Disable word wrap`:`Enable word wrap`,pressed:N,onPress:()=>ce(!N),children:(0,$.jsx)(x,{className:`size-3.5`})}):null,xt?(0,$.jsx)(_t,{label:`Open file in preview browser`,onPress:Rt,children:(0,$.jsx)(l,{className:`size-3.5`})}):null,!z&&U!==null?(0,$.jsx)(_t,{label:Ke?`Hide file explorer`:`Show file explorer`,pressed:Ke,onPress:Ft,children:(0,$.jsx)(c,{className:`size-3.5`})}):null]}):null,t[71]=q,t[72]=p,t[73]=V,t[74]=H,t[75]=xt,t[76]=pt,t[77]=r,t[78]=n,t[79]=Ke,t[80]=Rt,t[81]=z,t[82]=f,t[83]=Ct,t[84]=g,t[85]=U,t[86]=pe,t[87]=i,t[88]=T,t[89]=me,t[90]=ht,t[91]=ft,t[92]=h,t[93]=gt,t[94]=mt,t[95]=N,t[96]=S,t[97]=zt):zt=t[97];let Bt;t[98]!==o||t[99]!==Ve||t[100]!==ze.isPending||t[101]!==z||t[102]!==T?(Bt=T&&!o&&!z&&!Ve&&!ze.isPending?(0,$.jsx)(`div`,{className:`shrink-0 border-b px-3 py-1.5 text-2xs text-muted-foreground`,children:`Read-only connection. Unsaved edits are kept until write access returns.`}):null,t[98]=o,t[99]=Ve,t[100]=ze.isPending,t[101]=z,t[102]=T,t[103]=Bt):Bt=t[103];let Vt;t[104]!==o||t[105]!==B.data||t[106]!==Pe||t[107]!==U||t[108]!==K?(Vt=U&&o===void 0&&!Pe&&!K&&B.data?.truncated?(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-warning/20 bg-warning-surface px-3 py-1.5 text-2xs text-warning-foreground`,children:[`Preview limited to the first 1 MB of a `,B.data.byteLength.toLocaleString(),` byte file.`]}):null,t[104]=o,t[105]=B.data,t[106]=Pe,t[107]=U,t[108]=K,t[109]=Vt):Vt=t[109];let Ht=U?`flex`:`hidden`,Ut;t[110]===Ht?Ut=t[111]:(Ut=w(`min-w-0 flex-1 flex-col overflow-hidden`,Ht),t[110]=Ht,t[111]=Ut);let Wt;t[112]!==q||t[113]!==o||t[114]!==He||t[115]!==Ve||t[116]!==d||t[117]!==r||t[118]!==D||t[119]!==n||t[120]!==B.data||t[121]!==B.error||t[122]!==B.readError||t[123]!==je||t[124]!==We||t[125]!==z||t[126]!==Ne||t[127]!==st||t[128]!==L||t[129]!==Tt||t[130]!==y||t[131]!==T||t[132]!==K||t[133]!==ut||t[134]!==dt||t[135]!==A||t[136]!==h||t[137]!==ct||t[138]!==s||t[139]!==N||t[140]!==S?(Wt=We?null:T&&o?(0,$.jsx)(Dt,{name:o.name,mimeType:o.mimeType,sizeBytes:o.sizeBytes,asset:{environmentId:n,attachmentId:o.id},htmlRender:o.htmlRender===!0,threadRef:s},`${n}:${o.id}`):T&&L&&q?(0,$.jsx)(ss,{environmentId:n,threadRef:s,draft:D,absolutePath:q,workspaceRoot:r,name:T,workspaceMutationId:S},`${n}:${s.threadId}:${q}`):T&&je&&q?(0,$.jsx)(ls,{environmentId:n,threadRef:s,draft:D,absolutePath:q,workspaceRoot:r,name:T,workspaceMutationId:S},`${n}:${s.threadId}:${q}`):T&&Ne&&q?(0,$.jsx)(as,{environmentId:n,threadRef:s,draft:D,absolutePath:q,workspaceRoot:r,alt:T,workspaceMutationId:S},q):T&&K&&q?(0,$.jsx)(os,{environmentId:n,threadRef:s,draft:D,absolutePath:q,workspaceRoot:r,title:T,workspaceMutationId:S},q):T&&B.error&&B.data===null?(0,$.jsx)(`div`,{role:`alert`,className:`scrollbar-gutter-both flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,$.jsxs)(`div`,{className:`my-auto flex shrink-0 flex-col gap-3 px-6 py-6 text-center text-xs leading-relaxed`,children:[(0,$.jsx)(`p`,{className:`text-destructive`,children:B.readError?Jo(B.readError):B.error}),He?(0,$.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Attempted path`,(0,$.jsx)(`code`,{className:`block break-all font-mono text-foreground select-all`,children:He})]}):null,z?null:(0,$.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Workspace folder:`,` `,(0,$.jsx)(`code`,{className:`break-all font-mono select-all`,children:B.readError?.cwd??r}),`. Check the link's path or locate the file in Files.`]})]})}):T&&B.data===null?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,$.jsx)(he,{size:`lg`})}):T&&B.data?st&&ut?(0,$.jsx)(js,{environmentId:n,cwd:r,relativePath:T,threadRef:s,contents:B.data.contents,readOnly:B.data.truncated||z||!Ve,onPendingChange:y},T):ct&&dt?(0,$.jsx)(yt,{name:T,text:B.data.contents,delimiter:ct},T):B.data.truncated||z||!Ve?(0,$.jsx)(Lt,{name:T,text:B.data.contents,cacheKey:Go(r,T,B.data.contents),onPostRender:Tt}):(0,$.jsx)(Ze,{children:(0,$.jsx)(Cs,{environmentId:n,cwd:r,relativePath:T,composerDraftTarget:d,contents:B.data.contents,resolvedTheme:A,revealRequestId:h,wordWrap:N,onPostRender:Tt,onPendingChange:y},`${T}:${A}`)}):null,t[112]=q,t[113]=o,t[114]=He,t[115]=Ve,t[116]=d,t[117]=r,t[118]=D,t[119]=n,t[120]=B.data,t[121]=B.error,t[122]=B.readError,t[123]=je,t[124]=We,t[125]=z,t[126]=Ne,t[127]=st,t[128]=L,t[129]=Tt,t[130]=y,t[131]=T,t[132]=K,t[133]=ut,t[134]=dt,t[135]=A,t[136]=h,t[137]=ct,t[138]=s,t[139]=N,t[140]=S,t[141]=Wt):Wt=t[141];let Gt;t[142]!==Ut||t[143]!==Wt?(Gt=(0,$.jsx)(`div`,{className:Ut,children:Wt}),t[142]=Ut,t[143]=Wt,t[144]=Gt):Gt=t[144];let Kt;t[145]!==H||t[146]!==r||t[147]!==n||t[148]!==B.refresh||t[149]!==Ge||t[150]!==Pe||t[151]!==R||t[152]!==g||t[153]!==U||t[154]!==i||t[155]!==T||t[156]!==h||t[157]!==Xe||t[158]!==S?(Kt=Xe?(0,$.jsx)(Mo,{resizable:!!U,children:(0,$.jsx)(Oo,{environmentId:n,cwd:Ge??r,projectName:Ge??i,hostFolder:Ge!==null,selectedPath:Ge===null?T:go(Ge,H??Ge),selectedPathRevealId:h,onOpenFile:g,workspaceMutationId:S,...U&&!Pe&&!R?{onRefreshSelectedFile:B.refresh}:{}},`${n}:${Ge??r}`)}):null,t[145]=H,t[146]=r,t[147]=n,t[148]=B.refresh,t[149]=Ge,t[150]=Pe,t[151]=R,t[152]=g,t[153]=U,t[154]=i,t[155]=T,t[156]=h,t[157]=Xe,t[158]=S,t[159]=Kt):Kt=t[159];let Jt;t[160]!==Gt||t[161]!==Kt?(Jt=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[Gt,Kt]}),t[160]=Gt,t[161]=Kt,t[162]=Jt):Jt=t[162];let Yt;return t[163]!==zt||t[164]!==Bt||t[165]!==Vt||t[166]!==Jt?(Yt=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[zt,Bt,Vt,Jt]}),t[163]=zt,t[164]=Bt,t[165]=Vt,t[166]=Jt,t[167]=Yt):Yt=t[167],Yt}function Fs(e){let t=!e;try{s(ts,t,k)}catch(e){console.error(e)}return t}function Is(e){return e.wordWrap}export{Ps as default};
34
- //# sourceMappingURL=FilePreviewPanel-DUqI7pF3.js.map
34
+ //# sourceMappingURL=FilePreviewPanel-u1jxtxzb.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Al as i,t as a}from"./utils-DkKLB01I.js";import{G as o,d as s,f as c}from"./settingsLayout-BoWaVHvV.js";import{Ao as l,jo as u,ko as d}from"./main-BYwnnJ9E.js";var f=n(),p=e(t(),1),m=e(r(),1);function h(e){let t=(0,f.c)(56),{id:n,title:r,summary:h,control:g,headerPlacement:_,collapsedContent:v,children:y}=e,b=_===void 0?`inside`:_,[x,S]=(0,p.useState)(!1),[C,w]=(0,p.useState)(v);v!==void 0&&v!==C&&w(v);let T=c(),E=s(n),[D,O]=(0,p.useState)(null);if(T===n&&D!==n&&(O(n),x||S(!0)),b===`outside`){let e=x&&`rotate-90`,s;t[0]===e?s=t[1]:(s=a(`size-4 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,e),t[0]=e,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,m.jsx)(i,{"aria-hidden":!0,className:s}),t[2]=s,t[3]=c);let f;t[4]!==c||t[5]!==r?(f=(0,m.jsx)(`h2`,{children:(0,m.jsxs)(u,{className:`flex min-h-7 items-center gap-2 rounded-md text-sm font-normal text-foreground/70 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[r,c]})}),t[4]=c,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==g||t[8]!==f?(p=(0,m.jsxs)(`div`,{"data-settings-scroll-target":!0,className:`flex min-h-7 items-start justify-between gap-4 px-3 sm:px-4`,children:[f,g]}),t[7]=g,t[8]=f,t[9]=p):p=t[9];let h;t[10]===y?h=t[11]:(h=(0,m.jsx)(l,{children:(0,m.jsx)(o,{children:y})}),t[10]=y,t[11]=h);let _;t[12]!==p||t[13]!==h?(_=(0,m.jsxs)(`div`,{className:`space-y-2.5`,children:[p,h]}),t[12]=p,t[13]=h,t[14]=_):_=t[14];let v;t[15]!==x||t[16]!==_?(v=(0,m.jsx)(d,{open:x,onOpenChange:S,children:_}),t[15]=x,t[16]=_,t[17]=v):v=t[17];let b;return t[18]!==n||t[19]!==v||t[20]!==E?(b=(0,m.jsx)(`section`,{id:n,ref:E,tabIndex:-1,className:`outline-none`,children:v}),t[18]=n,t[19]=v,t[20]=E,t[21]=b):b=t[21],b}let k;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,m.jsx)(o,{divided:!1}),t[22]=k):k=t[22];let A=x&&`rotate-90`,j;t[23]===A?j=t[24]:(j=a(`size-4 shrink-0 text-muted-foreground transition-transform duration-150 motion-reduce:transition-none`,A),t[23]=A,t[24]=j);let M;t[25]===j?M=t[26]:(M=(0,m.jsx)(i,{"aria-hidden":!0,className:j}),t[25]=j,t[26]=M);let N;t[27]===r?N=t[28]:(N=(0,m.jsx)(`span`,{className:`shrink-0 text-sm font-medium`,children:r}),t[27]=r,t[28]=N);let P;t[29]===h?P=t[30]:(P=h?(0,m.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:h}):null,t[29]=h,t[30]=P);let F;t[31]!==M||t[32]!==N||t[33]!==P?(F=(0,m.jsxs)(u,{className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring rounded-md`,children:[M,N,P]}),t[31]=M,t[32]=N,t[33]=P,t[34]=F):F=t[34];let I;t[35]===g?I=t[36]:(I=g?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center`,children:g}):null,t[35]=g,t[36]=I);let L;t[37]!==F||t[38]!==I?(L=(0,m.jsxs)(`div`,{className:`flex items-center gap-4 px-3 sm:px-4`,children:[F,I]}),t[37]=F,t[38]=I,t[39]=L):L=t[39];let R=!x&&v!==void 0,z;t[40]===C?z=t[41]:(z=(0,m.jsx)(l,{children:(0,m.jsx)(`div`,{className:`border-t border-border/50 empty:hidden`,children:C})}),t[40]=C,t[41]=z);let B;t[42]!==R||t[43]!==z?(B=(0,m.jsx)(d,{open:R,children:z}),t[42]=R,t[43]=z,t[44]=B):B=t[44];let V;t[45]===y?V=t[46]:(V=(0,m.jsx)(l,{children:(0,m.jsx)(`div`,{className:`border-t border-border/50 [&>*+*]:border-t [&>*+*]:border-border/50`,children:y})}),t[45]=y,t[46]=V);let H;t[47]!==x||t[48]!==L||t[49]!==B||t[50]!==V?(H=(0,m.jsxs)(d,{open:x,onOpenChange:S,render:k,children:[L,B,V]}),t[47]=x,t[48]=L,t[49]=B,t[50]=V,t[51]=H):H=t[51];let U;return t[52]!==n||t[53]!==H||t[54]!==E?(U=(0,m.jsx)(`section`,{id:n,ref:E,tabIndex:-1,className:`outline-none`,children:H}),t[52]=n,t[53]=H,t[54]=E,t[55]=U):U=t[55],U}export{h as t};
2
- //# sourceMappingURL=FoldedSettingsSection-BTMENmDo.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Al as i,t as a}from"./utils-DkKLB01I.js";import{G as o,d as s,f as c}from"./settingsLayout-YTaL8Lym.js";import{Ao as l,jo as u,ko as d}from"./main-C04YJQbN.js";var f=n(),p=e(t(),1),m=e(r(),1);function h(e){let t=(0,f.c)(56),{id:n,title:r,summary:h,control:g,headerPlacement:_,collapsedContent:v,children:y}=e,b=_===void 0?`inside`:_,[x,S]=(0,p.useState)(!1),[C,w]=(0,p.useState)(v);v!==void 0&&v!==C&&w(v);let T=c(),E=s(n),[D,O]=(0,p.useState)(null);if(T===n&&D!==n&&(O(n),x||S(!0)),b===`outside`){let e=x&&`rotate-90`,s;t[0]===e?s=t[1]:(s=a(`size-4 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,e),t[0]=e,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,m.jsx)(i,{"aria-hidden":!0,className:s}),t[2]=s,t[3]=c);let f;t[4]!==c||t[5]!==r?(f=(0,m.jsx)(`h2`,{children:(0,m.jsxs)(u,{className:`flex min-h-7 items-center gap-2 rounded-md text-sm font-normal text-foreground/70 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[r,c]})}),t[4]=c,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==g||t[8]!==f?(p=(0,m.jsxs)(`div`,{"data-settings-scroll-target":!0,className:`flex min-h-7 items-start justify-between gap-4 px-3 sm:px-4`,children:[f,g]}),t[7]=g,t[8]=f,t[9]=p):p=t[9];let h;t[10]===y?h=t[11]:(h=(0,m.jsx)(l,{children:(0,m.jsx)(o,{children:y})}),t[10]=y,t[11]=h);let _;t[12]!==p||t[13]!==h?(_=(0,m.jsxs)(`div`,{className:`space-y-2.5`,children:[p,h]}),t[12]=p,t[13]=h,t[14]=_):_=t[14];let v;t[15]!==x||t[16]!==_?(v=(0,m.jsx)(d,{open:x,onOpenChange:S,children:_}),t[15]=x,t[16]=_,t[17]=v):v=t[17];let b;return t[18]!==n||t[19]!==v||t[20]!==E?(b=(0,m.jsx)(`section`,{id:n,ref:E,tabIndex:-1,className:`outline-none`,children:v}),t[18]=n,t[19]=v,t[20]=E,t[21]=b):b=t[21],b}let k;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,m.jsx)(o,{divided:!1}),t[22]=k):k=t[22];let A=x&&`rotate-90`,j;t[23]===A?j=t[24]:(j=a(`size-4 shrink-0 text-muted-foreground transition-transform duration-150 motion-reduce:transition-none`,A),t[23]=A,t[24]=j);let M;t[25]===j?M=t[26]:(M=(0,m.jsx)(i,{"aria-hidden":!0,className:j}),t[25]=j,t[26]=M);let N;t[27]===r?N=t[28]:(N=(0,m.jsx)(`span`,{className:`shrink-0 text-sm font-medium`,children:r}),t[27]=r,t[28]=N);let P;t[29]===h?P=t[30]:(P=h?(0,m.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:h}):null,t[29]=h,t[30]=P);let F;t[31]!==M||t[32]!==N||t[33]!==P?(F=(0,m.jsxs)(u,{className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring rounded-md`,children:[M,N,P]}),t[31]=M,t[32]=N,t[33]=P,t[34]=F):F=t[34];let I;t[35]===g?I=t[36]:(I=g?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center`,children:g}):null,t[35]=g,t[36]=I);let L;t[37]!==F||t[38]!==I?(L=(0,m.jsxs)(`div`,{className:`flex items-center gap-4 px-3 sm:px-4`,children:[F,I]}),t[37]=F,t[38]=I,t[39]=L):L=t[39];let R=!x&&v!==void 0,z;t[40]===C?z=t[41]:(z=(0,m.jsx)(l,{children:(0,m.jsx)(`div`,{className:`border-t border-border/50 empty:hidden`,children:C})}),t[40]=C,t[41]=z);let B;t[42]!==R||t[43]!==z?(B=(0,m.jsx)(d,{open:R,children:z}),t[42]=R,t[43]=z,t[44]=B):B=t[44];let V;t[45]===y?V=t[46]:(V=(0,m.jsx)(l,{children:(0,m.jsx)(`div`,{className:`border-t border-border/50 [&>*+*]:border-t [&>*+*]:border-border/50`,children:y})}),t[45]=y,t[46]=V);let H;t[47]!==x||t[48]!==L||t[49]!==B||t[50]!==V?(H=(0,m.jsxs)(d,{open:x,onOpenChange:S,render:k,children:[L,B,V]}),t[47]=x,t[48]=L,t[49]=B,t[50]=V,t[51]=H):H=t[51];let U;return t[52]!==n||t[53]!==H||t[54]!==E?(U=(0,m.jsx)(`section`,{id:n,ref:E,tabIndex:-1,className:`outline-none`,children:H}),t[52]=n,t[53]=H,t[54]=E,t[55]=U):U=t[55],U}export{h as t};
2
+ //# sourceMappingURL=FoldedSettingsSection-DvzfFn5A.js.map
@@ -1,3 +1,3 @@
1
- import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./6OLKWJ4F-CwQRt55E.js";import{f as g,g as _,s as v,t as y,y as b}from"./77XECAW3-DM5Itfvk.js";import{t as x}from"./5B3SVYGG-BGHUtemY.js";import{r as S,t as C}from"./DKTLEL5E-DciMwFJ1.js";import{t as w}from"./5THPTBWS-Ce_hS451.js";import{PeleError as T,_ as E,m as D}from"./lazy-Bpm7QNt6.js";var O=1e4;function k(e,t,n,r,i){let a=e.packet?.[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function A(e){return new T(e,`semantic`,{type:`packet`})}function j(e,t,n){let r=Math.floor(k(t,`bitsPerRow`,32,1,4096)),i=[],a=-1,o=[],s=1;for(let t of e.blocks){let{start:e,end:n,bits:c}=t;if(e!==void 0&&n!==void 0&&n<e)throw A(`Packet block ${e} - ${n} is invalid. End must be greater than start.`);if(e??=a+1,e!==a+1)throw A(`Packet block ${e} - ${n??e} is not contiguous. It should start from ${a+1}.`);if(c===0)throw A(`Packet block ${e} is invalid. Cannot have a zero bit field.`);for(n??=e+(c??1)-1,c??=n-e+1,a=n;o.length<=r+1&&i.length<O;){let a=s*r-1;if(n<=a){o.push({start:e,end:n,bits:c,label:t.label}),n===a&&(i.push(o),o=[],s++);break}o.push({start:e,end:a,bits:a-e,label:t.label}),i.push(o),o=[],s++,e=a+1,c=n-e}}return o.length>0&&i.push(o),{type:`packet`,title:e.title||n,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
1
+ import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./6OLKWJ4F-0nUReGo5.js";import{f as g,g as _,s as v,t as y,y as b}from"./77XECAW3-_XJOQitm.js";import{t as x}from"./5B3SVYGG-B5V3_tzl.js";import{r as S,t as C}from"./DKTLEL5E-DciMwFJ1.js";import{t as w}from"./5THPTBWS-Ce_hS451.js";import{PeleError as T,_ as E,m as D}from"./lazy--Qcevr63.js";var O=1e4;function k(e,t,n,r,i){let a=e.packet?.[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function A(e){return new T(e,`semantic`,{type:`packet`})}function j(e,t,n){let r=Math.floor(k(t,`bitsPerRow`,32,1,4096)),i=[],a=-1,o=[],s=1;for(let t of e.blocks){let{start:e,end:n,bits:c}=t;if(e!==void 0&&n!==void 0&&n<e)throw A(`Packet block ${e} - ${n} is invalid. End must be greater than start.`);if(e??=a+1,e!==a+1)throw A(`Packet block ${e} - ${n??e} is not contiguous. It should start from ${a+1}.`);if(c===0)throw A(`Packet block ${e} is invalid. Cannot have a zero bit field.`);for(n??=e+(c??1)-1,c??=n-e+1,a=n;o.length<=r+1&&i.length<O;){let a=s*r-1;if(n<=a){o.push({start:e,end:n,bits:c,label:t.label}),n===a&&(i.push(o),o=[],s++);break}o.push({start:e,end:a,bits:a-e,label:t.label}),i.push(o),o=[],s++,e=a+1,c=n-e}}return o.length>0&&i.push(o),{type:`packet`,title:e.title||n,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
2
2
  `):void 0,bitsPerRow:r,rows:i}}var M=[{name:`packet-beta`,pattern:`packet-beta`},o(`packet`),{name:`-`,pattern:`-`,longer:[f]},{name:`+`,pattern:`+`},{name:`:`,pattern:`:`},e,m,d,{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y},c,s,h,f,u,p];function N(e){let o=new a(l(e,M,`packet`),M,`packet`),s={$type:`Packet`,blocks:[]},c=()=>{if(o.kind!==-1)for(o.kind!==10&&o.fail(`a line break or the end of input`);o.kind===10;)o.i++};for(;o.kind===10;)o.i++;for(o.accept(0)||o.expect(1);o.kind!==-1;)switch(o.kind){case 10:o.i++;break;case 5:s.accDescr=t(o.take()),c();break;case 6:s.accTitle=i(o.take()),c();break;case 7:s.title=n(o.take()),c();break;case 8:case 3:{let e={$type:`PacketBlock`,label:``};o.accept(3)?e.bits=Number(o.expect(8)):(e.start=Number(o.take()),o.accept(2)&&(e.end=Number(o.expect(8)))),o.expect(4),e.label=r(o.expect(9)),s.blocks.push(e),c();break}default:o.fail(`a field, a title, or a line break`)}return s}function P(e,t,n){return C(n,r=>F(e,t,n,r))}function F(e,t,n,r){let i=n.fontSize??16,a=Math.round(i*.875),o=Math.round(i*.625),s=n.measurer??E(n.fontFamily),c=n.padding??8,l=t.packet??{},u=k(t,`rowHeight`,32,1,400),d=k(t,`bitWidth`,32,1,400),f=k(t,`paddingX`,5,0,400),p=k(t,`paddingY`,5,0,400),m=l.showBits!==!1,h=l.bitOrder===`descending`,C=e.bitsPerRow,T=e.rows;if(r){let t=Math.max(1,Math.floor(((n.maxWidth??320)-2*c)/Math.min(d,18)));C=Math.min(C,Math.max(8,2**Math.floor(Math.log2(t))));let r=e.rows[e.rows.length-1],i=r?.[r.length-1]?.end??0;Math.ceil((i+1)/C)>1e4&&(C=e.bitsPerRow),d=Math.min(d,Math.max(18,((n.maxWidth??320)-2*c)/C));let a=e=>e.bits===e.end-e.start,o=[];for(let t of e.rows)for(let n of t){let t=o[o.length-1];t&&a(t)&&a(n)&&t.label===n.label&&n.start===t.end+1&&n.start%e.bitsPerRow===0?(t.end=n.end,t.bits=t.end-t.start):o.push({...n})}T=[];for(let e of o)for(let t=e.start;t<=e.end;){let n=Math.min(e.end,(Math.floor(t/C)+1)*C-1),r=Math.floor(t/C);(T[r]??(T[r]=[])).push({...e,start:t,end:n}),t=n+1}}let O=new Map;if(r)for(let e of T)for(let t of e){let e=Math.max(1,(t.end-t.start+1)*d-Math.min(f,d-1)-6),n=x(D(t.label).trim(),s,a,e);O.set(t,n)}let A=m?o+4:0,j=T.map(e=>{let t=u;if(r)for(let n of e)t=Math.max(t,O.get(n).height+10);return t}),M=[],N=0;for(let e of j)M.push(N),N+=A+e+p;T.length&&(N-=p);let P=Math.min(f,d-1),F=T.length>0?C*d-P:0,I=v(e.title,!1,s,i,r?S(n):4e3,1),L=I.height>0?I.height+(N>0?12:0):0,R=new Map,z=(e,t)=>{let n=R.get(e);return n||R.set(e,n=new Map),n.has(t)||n.set(t,w(D(e).trim(),t,a,Math.round(i*.5),s)),n.get(t)},B=c+Math.max(0,(I.width-F)/2),V=``,H=``;T.forEach((e,t)=>{let n=c+M[t]+A,i=j[t];for(let t of e){let e=t.end-t.start+1,o=t.start%C,s=B+(h?C-o-e:o)*d,c=e*d-P,l=r?void 0:z(t.label,c-6);if(V+=`<g class="pele-node" data-id="${t.start}-${t.end}"><rect x="${g(s)}" y="${g(n)}" width="${g(c)}" height="${g(i)}" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/>`+(r?y(O.get(t),s+c/2,n+i/2,``):l&&l.size<=i?`<text x="${g(s+c/2)}" y="${g(n+i/2+l.size*.35)}"${l.size===a?``:` font-size="${g(l.size)}"`}>${b(l.text)}</text>`:``)+`</g>`,!m)continue;let u=h?t.end:t.start,f=h?t.start:t.end;H+=e===1?`<text x="${g(s+c/2)}" y="${g(n-4)}" text-anchor="middle">${u}</text>`:`<text x="${g(s)}" y="${g(n-4)}">${u}</text><text x="${g(s+c)}" y="${g(n-4)}" text-anchor="end">${f}</text>`}});let U=Math.ceil(Math.max(F,I.width)+2*c),W=Math.ceil(N+L+2*c),G=(V?`<g class="pele-packet-fields" font-size="${a}" text-anchor="middle">${V}</g>`:``)+(H?`<g class="pele-packet-bits" font-size="${o}" fill="var(--_m)">${H}</g>`:``)+y(I,U/2,W-c-I.height/2,` class="pele-title" font-weight="var(--_tw)"`);return{svg:_(`packet`,U,W,i,n,e,G),width:U,height:W,links:[]}}var I={type:`packet`,parse:(e,t,n)=>j(N(e),t,n),render:P};export{I as packet};
3
- //# sourceMappingURL=HDGCDEEZ-BA3H_tu4.js.map
3
+ //# sourceMappingURL=HDGCDEEZ-DVkQN-82.js.map
@@ -1,3 +1,3 @@
1
- import{a as e,c as t,d as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./6OLKWJ4F-CwQRt55E.js";import{f as h,g,m as _,r as v,s as y,t as b}from"./77XECAW3-DM5Itfvk.js";import{a as x,i as S,s as C}from"./N3JZAHOW-Dz6QAj1L.js";import{o as w,r as ee}from"./DKTLEL5E-DciMwFJ1.js";import{PeleError as T,_ as te}from"./lazy-Bpm7QNt6.js";function E(e){throw new T(e,`semantic`,{type:`architecture`})}var D=class{type=`architecture`;title;accTitle;accDescr;nodes=new Map;groups=new Map;edges=[];layoutHints=[];registered=new Map;register(e,t,n){this.registered.has(t)&&E(`The ${e} id [${t}] is already in use by another ${this.registered.get(t)}`),n!==void 0&&(t===n&&E(`The ${e} [${t}] cannot be placed within itself`),this.registered.has(n)||E(`The ${e} [${t}]'s parent does not exist. Please make sure the parent is created before this ${e}`),this.registered.get(n)===`node`&&E(`The ${e} [${t}]'s parent is not a group`)),this.registered.set(t,e===`group`?`group`:`node`)}addService({id:e,icon:t,iconText:n,title:r,in:i}){this.register(`service`,e,i),this.nodes.set(e,{id:e,type:`service`,icon:t,iconText:n,title:r,in:i})}addJunction({id:e,in:t}){this.register(`junction`,e,t),this.nodes.set(e,{id:e,type:`junction`,in:t})}addGroup({id:e,icon:t,title:n,in:r}){this.register(`group`,e,r),this.groups.set(e,{id:e,icon:t,title:n,in:r})}addEdge({lhsId:e,rhsId:t,lhsDir:n,rhsDir:r,lhsInto:i,rhsInto:a,lhsGroup:o,rhsGroup:s,title:c}){let l=[[`left`,e,o],[`right`,t,s]];for(let[e,t]of l)this.registered.has(t)||E(`The ${e}-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);for(let[e,t]of l)this.nodes.has(t)||E(`The ${e}-hand id [${t}] is a group. Add {group} to a service inside it instead.`);let u=this.nodes.get(e).in;if(u!==void 0&&u===this.nodes.get(t).in)for(let[e,t,n]of l)n&&E(`The ${e}-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);this.edges.push({lhsId:e,lhsDir:n,lhsInto:i,lhsGroup:o,rhsId:t,rhsDir:r,rhsInto:a,rhsGroup:s,title:c})}addLayoutHint(e){e.members.length<2&&E(`An align directive requires at least two members; got ${e.members.length}`);let t=new Set;for(let n of e.members)this.registered.get(n)!==`node`&&E(`align ${e.direction} references [${n}], which is not a service or junction`),t.has(n)&&E(`align ${e.direction} lists [${n}] more than once`),t.add(n);this.layoutHints.push(e)}};function O(e,t){e.accDescr&&(t.accDescr=e.accDescr.replace(/\n\s+/g,`
1
+ import{a as e,c as t,d as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./6OLKWJ4F-0nUReGo5.js";import{f as h,g,m as _,r as v,s as y,t as b}from"./77XECAW3-_XJOQitm.js";import{a as x,i as S,s as C}from"./N3JZAHOW-Bp1sdK_N.js";import{o as w,r as ee}from"./DKTLEL5E-DciMwFJ1.js";import{PeleError as T,_ as te}from"./lazy--Qcevr63.js";function E(e){throw new T(e,`semantic`,{type:`architecture`})}var D=class{type=`architecture`;title;accTitle;accDescr;nodes=new Map;groups=new Map;edges=[];layoutHints=[];registered=new Map;register(e,t,n){this.registered.has(t)&&E(`The ${e} id [${t}] is already in use by another ${this.registered.get(t)}`),n!==void 0&&(t===n&&E(`The ${e} [${t}] cannot be placed within itself`),this.registered.has(n)||E(`The ${e} [${t}]'s parent does not exist. Please make sure the parent is created before this ${e}`),this.registered.get(n)===`node`&&E(`The ${e} [${t}]'s parent is not a group`)),this.registered.set(t,e===`group`?`group`:`node`)}addService({id:e,icon:t,iconText:n,title:r,in:i}){this.register(`service`,e,i),this.nodes.set(e,{id:e,type:`service`,icon:t,iconText:n,title:r,in:i})}addJunction({id:e,in:t}){this.register(`junction`,e,t),this.nodes.set(e,{id:e,type:`junction`,in:t})}addGroup({id:e,icon:t,title:n,in:r}){this.register(`group`,e,r),this.groups.set(e,{id:e,icon:t,title:n,in:r})}addEdge({lhsId:e,rhsId:t,lhsDir:n,rhsDir:r,lhsInto:i,rhsInto:a,lhsGroup:o,rhsGroup:s,title:c}){let l=[[`left`,e,o],[`right`,t,s]];for(let[e,t]of l)this.registered.has(t)||E(`The ${e}-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);for(let[e,t]of l)this.nodes.has(t)||E(`The ${e}-hand id [${t}] is a group. Add {group} to a service inside it instead.`);let u=this.nodes.get(e).in;if(u!==void 0&&u===this.nodes.get(t).in)for(let[e,t,n]of l)n&&E(`The ${e}-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);this.edges.push({lhsId:e,lhsDir:n,lhsInto:i,lhsGroup:o,rhsId:t,rhsDir:r,rhsInto:a,rhsGroup:s,title:c})}addLayoutHint(e){e.members.length<2&&E(`An align directive requires at least two members; got ${e.members.length}`);let t=new Set;for(let n of e.members)this.registered.get(n)!==`node`&&E(`align ${e.direction} references [${n}], which is not a service or junction`),t.has(n)&&E(`align ${e.direction} lists [${n}] more than once`),t.add(n);this.layoutHints.push(e)}};function O(e,t){e.accDescr&&(t.accDescr=e.accDescr.replace(/\n\s+/g,`
2
2
  `)),e.accTitle&&(t.accTitle=e.accTitle.replace(/^\s+/g,``)),e.title&&(t.title=e.title);for(let n of e.groups)t.addGroup(n);for(let n of e.services)t.addService(n);for(let n of e.junctions)t.addJunction(n);for(let n of e.edges)t.addEdge(n);for(let n of e.alignments)t.addLayoutHint({direction:n.direction,members:[...n.members]})}var k={name:`ID`,pattern:/[\w]([-\w]*\w)?/y};function A(e){return{name:e,pattern:e,longer:[k]}}var j=[A(`architecture-beta`),A(`junction`),A(`service`),A(`column`),A(`group`),A(`align`),A(`row`),{name:`--`,pattern:`--`,longer:[d]},A(`in`),{name:`:`,pattern:`:`},{name:`-`,pattern:`-`,longer:[d]},{name:`ARROW_DIRECTION`,pattern:/L|R|T|B/y},{name:`ARROW_GROUP`,pattern:/\{group\}/y},{name:`ARROW_INTO`,pattern:/<|>/y},e,p,u,s,k,o,m,d,l,f,{name:`ARCH_ICON`,pattern:/\([\w-:]+\)/y},{name:`ARCH_TITLE`,pattern:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[^\[\]\r\n]+)\]/y}];function M(e){let t=e.slice(1,-1).trim();return(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))&&(t=t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\'/g,`'`)),t.trim()}function N(e){let o=new a(c(e,j,`architecture`),j,`architecture`),s={$type:`Architecture`,groups:[],services:[],junctions:[],edges:[],alignments:[]},l=e=>o.kinds[o.i]===e,u=()=>{if(o.kind!==-1)for(o.kind!==19&&o.fail(`a line break or the end of input`);o.kind===19;)o.i++};for(;o.kind===19;)o.i++;for(o.expect(0);o.kind!==-1;){switch(o.kind){case 19:o.i++;continue;case 14:s.accDescr=t(o.take());break;case 15:s.accTitle=i(o.take());break;case 16:s.title=n(o.take());break;case 4:{o.i++;let e={$type:`Group`,id:o.expect(18)};l(24)&&(e.icon=o.take().slice(1,-1)),l(25)&&(e.title=M(o.take())),o.accept(8)&&(e.in=o.expect(18)),s.groups.push(e);break}case 2:{o.i++;let e={$type:`Service`,id:o.expect(18)};l(17)?e.iconText=r(o.take()):l(24)&&(e.icon=o.take().slice(1,-1)),l(25)&&(e.title=M(o.take())),o.accept(8)&&(e.in=o.expect(18)),s.services.push(e);break}case 1:{o.i++;let e={$type:`Junction`,id:o.expect(18)};o.accept(8)&&(e.in=o.expect(18)),s.junctions.push(e);break}case 18:{let e=o.take(),t=o.accept(12);o.expect(9);let n=o.expect(11),r=o.accept(13),i;o.accept(7)||(l(10)||o.fail(`'--' or '-'`),o.i++,i=M(o.expect(25)),o.expect(10));let a=o.accept(13),c=o.expect(11);o.expect(9);let u=o.expect(18),d=o.accept(12);s.edges.push({$type:`Edge`,lhsId:e,lhsGroup:t,lhsDir:n,lhsInto:r,title:i,rhsInto:a,rhsDir:c,rhsId:u,rhsGroup:d});break}case 5:{o.i++,!l(6)&&!l(3)&&o.fail(`'row' or 'column'`);let e=o.take(),t=[o.expect(18),o.expect(18)];for(;l(18);)t.push(o.take());s.alignments.push({$type:`Alignment`,direction:e,members:t});break}default:o.fail(`a group, a service, a junction, an edge, an alignment, a title, or a line break`)}u()}return s}var P=new Map([[`database`,`M4 6a8 3 0 1 0 16 0a8 3 0 1 0-16 0M4 6v12a8 3 0 0 0 16 0V6M4 12a8 3 0 0 0 16 0`],[`server`,`M3 4h18v7H3zM3 13h18v7H3zM7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6`],[`disk`,`M5 3h14v18H5zM12 6.5a4 4 0 1 0 0 8a4 4 0 1 0 0-8M12 10.5h.01M8 18h3`],[`internet`,`M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0M3 12h18M12 3a13 13 0 0 0 0 18M12 3a13 13 0 0 1 0 18`],[`cloud`,`M7 18a4 4 0 0 1-.5-7.97A6 6 0 0 1 18 9.5a4.25 4.25 0 0 1-.5 8.5z`]]);function F(e){let t=P.get(e);return t===void 0?``:`<path d="${t}" stroke="var(--_fg)" stroke-width="1.5"/>`}var I=[-1,1,0,0],L=[0,0,-1,1];function ne(e){return e===`L`?0:e===`R`?1:e===`T`?2:3}var R=64,z=2**25,B=2**26;function re(e,t,n,r){let i=e.length,a=t.length,o=a,s=new Map,c=new Map,l=new Int32Array(i+a).fill(o),u=new Int32Array(a+1),d=[];for(let e=0;e<=a;e++)d.push([]);t.forEach((e,t)=>{c.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&n!==t?(l[i+t]=n,u[t]=u[n]+1):u[t]=1}),e.forEach((e,t)=>{s.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&(l[t]=n),d[l[t]].push(t)});for(let e=0;e<a;e++)d[l[i+e]].push(i+e);let f=[],p=[],m=[],h=[],g=[],_=[],v=Array(i+a),y=Array(i+a),b=(e,t,n,r,a)=>{if(e===t)return;let o=e,s=t,c=l[e],d=l[t];for(;c!==d;)u[c]>=u[d]?(o=i+c,c=l[o]):(s=i+d,d=l[s]);let v=f.length;f.push(e),p.push(t),m.push(n),h.push(r),g.push(o),_.push(s),(a[o]??=[]).push(v),(a[s]??=[]).push(v)};for(let e of r){let t=e.direction===`row`;for(let n=1;n<e.members.length;n++){let r=s.get(e.members[n-1]),i=s.get(e.members[n]);r!==void 0&&i!==void 0&&b(r,i,t?1:3,t?0:2,v)}}for(let e of[!1,!0])for(let t of n){if(t.lhsDir===t.rhsDir!==e)continue;let n=s.get(t.lhsId),r=s.get(t.rhsId);n!==void 0&&r!==void 0&&b(n,r,ne(t.lhsDir),ne(t.rhsDir),y)}let x=new Int32Array(i+a),S=new Int32Array(i+a),C=new Int32Array(i+a).fill(1),w=new Int32Array(i+a).fill(1),ee=new Uint8Array(i+a),T=[],te=new Map,E=[],D=new Map,O=0,k=0,A=0,j=(e,t)=>{k=0,A=0;for(let n=e;n!==t;n=i+l[n])k+=x[n],A+=S[n]},M=(e,t,n)=>{if(x[e]=t,S[e]=n,ee[e]=1,T.push(e),C[e]*w[e]>R)E.push(e);else for(let r=n;r<n+w[e];r++)for(let n=t;n<t+C[e];n++)te.set((n+z)*B+r+z,e)},N=(e,t,n,r,i)=>x[e]<t+r&&t<x[e]+C[e]&&S[e]<n+i&&n<S[e]+w[e],P=(e,t,n,r)=>{if(n*r>R){for(let i=O;i<T.length;i++)if(N(T[i],e,t,n,r))return T[i];return-1}for(let i=t;i<t+r;i++)for(let t=e;t<e+n;t++){let e=te.get((t+z)*B+i+z);if(e!==void 0)return e}for(let i of E)if(N(i,e,t,n,r))return i;return-1},F=(e,t,n,r,i,a)=>{let o=`${e},${t},${n},${r},${i},${a}`,s=D.get(o)??0;for(;;){let o=P(e+s*i,t+s*a,n,r);if(o<0)break;s=i>0?x[o]+C[o]-e:i<0?e+n-x[o]:a>0?S[o]+w[o]-t:t+r-S[o]}return D.set(o,s),s},re=(e,t)=>{let n=g[t]===e,r=n?_[t]:g[t];if(ee[r])return;let i=n?m[t]:h[t],a=n?h[t]:m[t];j(n?f[t]:p[t],e);let o=k,s=A;j(n?p[t]:f[t],r);let c=I[i],l=L[i],u=0,d=0,v=I[i]+I[a]===0&&L[i]+L[a]===0;i===a?(c=+(I[i]===0),l=1-c):v||(u=-I[a],d=-L[a]);let b,T;if(c===0?(T=l>0?S[e]+w[e]:S[e]-w[r],b=x[e]+o+u-k):(b=c>0?x[e]+C[e]:x[e]-C[r],T=S[e]+s+d-A),v){let e=y[r];if(e!==void 0&&e.length>1){let t=[];for(let n of e){let e=_[n]===r,o=e?g[n]:_[n];if(!ee[o]||(e?m[n]:h[n])!==i||(e?h[n]:m[n])!==a)continue;j(e?f[n]:p[n],o);let s=c===0?x[o]+k:S[o]+A;j(e?p[n]:f[n],r),t.push(s-(c===0?k:A))}t.length>1&&(t.sort((e,t)=>e-t),c===0?b=t[t.length-1>>1]:T=t[t.length-1>>1])}let t=+(c===0),n=1-t,o=F(b,T,C[r],w[r],t,n),s=o===0?0:F(b,T,C[r],w[r],-t,-n),l=o<=s?o:-s;b+=t*l,T+=n*l}else{let e=F(b,T,C[r],w[r],c,l);b+=c*e,T+=l*e}M(r,b,T)},V=e=>{let t=d[e];if(t.length===0)return;T.length=0;let n=[];for(let e of t){if(ee[e])continue;O=T.length,n.push(O),te.clear(),E.length=0,D.clear(),M(e,0,0);let t=O,r=O,i=0;for(;;){if(t<T.length){let e=T[t++],n=v[e];if(n!==void 0)for(let t of n)re(e,t);continue}if(r>=T.length)break;let e=y[T[r]];e===void 0||i>=e.length?(r++,i=0):re(T[r],e[i++])}}n.push(T.length);let r=n.length-1,o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=0,f=0;for(let e=0;e<r;e++){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=n[e];o<n[e+1];o++){let e=T[o];t=Math.min(t,x[e]),r=Math.min(r,S[e]),i=Math.max(i,x[e]+C[e]),a=Math.max(a,S[e]+w[e])}o[e]=t,s[e]=r,c[e]=i-t,l[e]=a-r,u+=c[e]*l[e],f=Math.max(f,c[e])}let p=Math.max(f,Math.ceil(Math.sqrt(u*2))),m=0,h=0,g=0,_=0;for(let e=0;e<r;e++){m>0&&m+c[e]>p&&(h+=g,m=0,g=0);for(let t=n[e];t<n[e+1];t++)x[T[t]]+=m-o[e],S[T[t]]+=h-s[e];m+=c[e],g=Math.max(g,l[e]),_=Math.max(_,m)}e<a&&(C[i+e]=_,w[i+e]=h+g)};for(let e=a-1;e>=0;e--)V(e);V(o);let H=new Int32Array(a),U=new Int32Array(a),ie=new Int32Array(a),ae=new Uint8Array(a);for(let e=0;e<a;e++){let t=l[i+e];ie[e]=t===o?-1:t,H[e]=x[i+e]+(t===o?0:H[t]),U[e]=S[i+e]+(t===o?0:U[t]),d[e].length===0&&(ae[e]=1)}let oe=new Int32Array(i),se=new Int32Array(i),ce=new Int32Array(i);for(let e=0;e<i;e++){let t=l[e];ce[e]=t===o?-1:t,oe[e]=x[e]+(t===o?0:H[t]),se[e]=S[e]+(t===o?0:U[t])}return{col:oe,row:se,groupCol:H,groupRow:U,groupCols:C.slice(i),groupRows:w.slice(i),groupParent:ie,groupEmpty:ae,nodeParent:ce}}var V=12,H=6,U=4,ie=3,ae=[-1,1,0,0],oe=[0,0,-1,1];function se(e,t,n,r,i){let a=e.architecture,o=typeof a==`object`&&a&&!Array.isArray(a)?a[t]:void 0;return typeof o==`number`&&Number.isFinite(o)?Math.min(i,Math.max(r,o)):n}function ce(e){let t=new Map;for(let n of e.sort((e,t)=>e-t))t.has(n)||t.set(n,t.size);return t}function le(e,t,n,r,i){return`<svg class="pele-icon" data-icon="${v(e)}" x="${h(t)}" y="${h(n)}" width="${h(r)}" height="${h(r)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i?.(e)??F(e)}</svg>`}function ue(e,t,n,r){let i=e.lines.length>n;if(!i&&e.width<=t)return e;let a=r.width(`…`,e.size,0),o=[],s=[],c=0;for(let l=0;l<Math.min(n,e.lines.length);l++){let u=e.lines[l].map(e=>({...e})),d=e.widths[l];if(d>t||i&&l===n-1)for(;;){let n=u[u.length-1];if(n===void 0){u.push({text:`…`,style:0,width:a}),d=a;break}let i=d-n.width;if(n.icon===void 0&&i+a<t){let o=0,s=n.text.length;for(;o<s;){let c=o+s+1>>1;i+r.width(n.text.slice(0,c),e.size,n.style)+a<=t?o=c:s=c-1}let c=o>0?n.text.charCodeAt(o-1):0;c>=55296&&c<=56319&&o--,n.text=n.text.slice(0,o).trimEnd()+`…`,n.width=r.width(n.text,e.size,n.style),d=i+n.width;break}u.pop(),d=i}o.push(u),s.push(d),c=Math.max(c,d)}return{...e,lines:o,widths:s,width:c,height:o.length*e.lineHeight}}function de(e,t){let{x:n,y:r,dx:i,dy:a}=e,{x:o,y:s,dx:c,dy:l}=t,u=n+i*V,d=r+a*V,f=o+c*V,p=s+l*V;if(i*c+a*l===0){let e=i===0?n:o,t=i===0?s:r;return(e-n)*i+(t-r)*a>0&&(e-o)*c+(t-s)*l>0?[n,r,e,t,o,s]:i===0?[n,r,u,d,f,d,f,p,o,s]:[n,r,u,d,u,p,f,p,o,s]}let m=i!==0,h=m?s-r:o-n;if(i===-c&&a===-l){if((o-n)*i+(s-r)*a>0){if(Math.abs(h)<.5)return[n,r,o,s];if(m){let a=i>0?e.x1:t.x1,c=i>0?t.x0:e.x0,l=a<c?(a+c)/2:(n+o)/2;return[n,r,l,r,l,s,o,s]}let c=a>0?e.y1:t.y1,l=a>0?t.y0:e.y0,u=c<l?(c+l)/2:(r+s)/2;return[n,r,n,u,o,u,o,s]}}else if(Math.abs(h)>=1){if(m){let e=i>0?Math.max(n,o)+V:Math.min(n,o)-V;return[n,r,e,r,e,s,o,s]}let e=a>0?Math.max(r,s)+V:Math.min(r,s)-V;return[n,r,n,e,o,e,o,s]}if(m){let i=e.y1+V<=t.y0?(e.y1+t.y0)/2:t.y1+V<=e.y0?(t.y1+e.y0)/2:Math.max(e.y1,t.y1)+V;return[n,r,u,r,u,i,f,i,f,s,o,s]}let g=e.x1+V<=t.x0?(e.x1+t.x0)/2:t.x1+V<=e.x0?(t.x1+e.x0)/2:Math.max(e.x1,t.x1)+V;return[n,r,n,d,g,d,g,p,o,p,o,s]}function fe(e){let t=[e[0],e[1]];for(let n=2;n<e.length;n+=2){let r=e[n],i=e[n+1],a=t.length,o=Math.abs(r-t[a-2])<.01,s=Math.abs(i-t[a-1])<.01;o&&s||(a>=4&&(o&&Math.abs(t[a-4]-t[a-2])<.01||s&&Math.abs(t[a-3]-t[a-1])<.01)?(t[a-2]=r,t[a-1]=i):t.push(r,i))}return t}function pe(e,t,n){let r=e.length/2,i=Array(r),a=Array(r);for(let t=0;t<r;t++)i[t]=e[t*2],a[t]=e[t*2+1];let o=(e,t,n)=>{let r=Math.hypot(i[t]-i[e],a[t]-a[e]),o=Math.min(n,Math.max(0,r-1));r>0&&o>0&&(i[e]+=(i[t]-i[e])/r*o,a[e]+=(a[t]-a[e])/r*o)};o(0,1,t),o(r-1,r-2,n);let s=`M${h(i[0])},${h(a[0])}`;for(let e=1;e<r-1;e++){let t=Math.hypot(i[e]-i[e-1],a[e]-a[e-1]),n=Math.hypot(i[e+1]-i[e],a[e+1]-a[e]),r=Math.min(H,t/2,n/2);if(r<.5){s+=`L${h(i[e])},${h(a[e])}`;continue}let o=i[e]-(i[e]-i[e-1])/t*r,c=a[e]-(a[e]-a[e-1])/t*r,l=i[e]+(i[e+1]-i[e])/n*r,u=a[e]+(a[e+1]-a[e])/n*r;s+=`L${h(o)},${h(c)}Q${h(i[e])},${h(a[e])} ${h(l)},${h(u)}`}return s+`L${h(i[r-1])},${h(a[r-1])}`}function W(e,t,n){return w(n,r=>G(e,t,n,r))}function G(e,t,n,r){let i=se(t,`iconSize`,48,8,512),a=se(t,`fontSize`,n.fontSize??16,4,128),o=Math.min(se(t,`padding`,20,0,256),r?12:1/0),s=Math.round(a*.875),c=n.measurer??te(n.fontFamily),l=n.padding??8,u=n.icons,d=i/2,f=[...e.nodes.values()],p=[...e.groups.values()],m=f.length,w=p.length,T=re(f,p,e.edges,e.layoutHints),E=new Map;f.forEach((e,t)=>E.set(e.id,t));let D=Array(m),O=new Float64Array(m),k=new Float64Array(m),A=r?Math.max(i,64):Math.max(i*2.25,96);for(let e=0;e<m;e++){let t=f[e],n=y(t.type===`service`?t.title:void 0,!0,c,a,A);D[e]=n,O[e]=Math.max(i,2*Math.ceil(n.width/2)),k[e]=i+(n.height>0?U+n.height:0)}let j=[],M=[];for(let e=0;e<m;e++)j.push(T.col[e]),M.push(T.row[e]);for(let e=0;e<w;e++)T.groupEmpty[e]&&(j.push(T.groupCol[e]),M.push(T.groupRow[e]));let N=ce(j),P=ce(M),F=N.size,I=P.size,L=new Float64Array(F),R=new Float64Array(I),z=r?Math.max(24,2*V):Math.max(40,Math.round(i*.75)),B=new Float64Array(F).fill(z),H=new Float64Array(I).fill(z),W=new Int32Array(m),G=new Int32Array(m);for(let e=0;e<m;e++){let t=W[e]=N.get(T.col[e]),n=G[e]=P.get(T.row[e]);L[t]=Math.max(L[t],O[e]),R[n]=Math.max(R[n],k[e])}for(let e=0;e<w;e++){if(!T.groupEmpty[e])continue;let t=N.get(T.groupCol[e]),n=P.get(T.groupRow[e]);L[t]=Math.max(L[t],i),R[n]=Math.max(R[n],d)}let me=e.edges.length,he=Array(me),ge=new Int32Array(me*2);for(let t=0;t<me;t++){let n=e.edges[t],r=ge[t*2]=E.get(n.lhsId)??-1,i=ge[t*2+1]=E.get(n.rhsId)??-1,a=y(n.title,!0,c,s,160);if(he[t]=a,!(a.width===0||r<0||i<0)){if(W[r]!==W[i]){let e=Math.min(W[r],W[i]);B[e]=Math.max(B[e],Math.ceil(a.width)+28)}else if(L[W[r]]=Math.max(L[W[r]],2*Math.ceil(a.width/2)+8),G[r]!==G[i]){let e=Math.min(G[r],G[i]);H[e]=Math.max(H[e],Math.ceil(a.height)+24)}}}let _e=Array(w),K=new Int32Array(w),q=new Int32Array(w),J=new Int32Array(w),Y=new Int32Array(w),ve=new Float64Array(w),ye=new Float64Array(w),be=new Float64Array(w),xe=new Float64Array(w),X=new Float64Array(w),Se=new Float64Array(w),Ce=new Float64Array(F),we=new Float64Array(F),Te=new Float64Array(I),Ee=new Float64Array(I),De=Math.round(a*1.25);for(let e=0;e<w;e++){K[e]=N.get(T.groupCol[e]),q[e]=N.get(T.groupCol[e]+T.groupCols[e]-1),J[e]=P.get(T.groupRow[e]),Y[e]=P.get(T.groupRow[e]+T.groupRows[e]-1);let t=y(p[e].title,!0,c,a,r?Math.max(80,ee(n)/2):320);_e[e]=t;let i=p[e].icon?De:0;X[e]=t.width+i+(t.width>0&&i>0?6:0),Se[e]=Math.max(t.height,i)}for(let e=w-1;e>=0;e--){let t=o+ve[e],n=o+ye[e],r=(Se[e]>0?Math.max(o,Se[e]+12):o)+be[e],i=o+xe[e];if(X[e]>0){let r=t+n;for(let t=K[e];t<=q[e];t++)r+=L[t]+(t<q[e]?we[t]+B[t]+Ce[t+1]:0);X[e]+20>r&&(n+=Math.ceil(X[e]+20-r))}ve[e]=t,ye[e]=n,be[e]=r,xe[e]=i,Ce[K[e]]=Math.max(Ce[K[e]],t),we[q[e]]=Math.max(we[q[e]],n),Te[J[e]]=Math.max(Te[J[e]],r),Ee[Y[e]]=Math.max(Ee[Y[e]],i);let a=T.groupParent[e];a<0||(K[a]===K[e]&&(ve[a]=Math.max(ve[a],t)),q[a]===q[e]&&(ye[a]=Math.max(ye[a],n)),J[a]===J[e]&&(be[a]=Math.max(be[a],r)),Y[a]===Y[e]&&(xe[a]=Math.max(xe[a],i)))}let Oe=new Float64Array(F),Z=new Float64Array(I),ke=0;for(let e=0;e<F;e++)Oe[e]=ke+Ce[e],ke=Oe[e]+L[e]+we[e]+(e<F-1?B[e]:0);let Ae=0;for(let e=0;e<I;e++)Z[e]=Ae+Te[e],Ae=Z[e]+R[e]+Ee[e]+(e<I-1?H[e]:0);let Q=0,je=0,Me=ke,Ne=Ae,Pe=e=>Oe[K[e]]-ve[e],Fe=e=>Oe[q[e]]+L[q[e]]+ye[e],Ie=e=>Z[J[e]]-be[e],Le=e=>Z[Y[e]]+R[Y[e]]+xe[e],Re=e=>Oe[W[e]]+L[W[e]]/2,ze=(e,t,n)=>{let r=ae[t],i=oe[t],a=Re(e),o=Z[G[e]],s={x:a,y:o+d,dx:r,dy:i,x0:a-O[e]/2,y0:o,x1:a+O[e]/2,y1:o+k[e],gap:0,wire:!1};f[e].type===`junction`?(s.x0=s.x1=a,s.y0=s.y1=s.y,s.gap=ie):r===0?s.y=i<0?o:o+k[e]+(D[e].height>0?2:0):s.x=a+r*d;let c=n?T.nodeParent[e]:-1;return c>=0&&(s.x0=Pe(c),s.x1=Fe(c),s.y0=Ie(c),s.y1=Le(c),s.gap=0,s.wire=f[e].type===`junction`,r===0?s.y=i<0?s.y0:s.y1:s.x=r<0?s.x0:s.x1),s},Be=``,Ve=``,$=[],He=x(`arrow_point`);for(let t=0;t<me;t++){let n=e.edges[t],r=ge[t*2],i=ge[t*2+1];if(r<0||i<0)continue;let a=ze(r,ne(n.lhsDir),n.lhsGroup),o=ze(i,ne(n.rhsDir),n.rhsGroup);a.x===o.x&&a.y===o.y&&a.dx===o.dx&&(a.x-=8*Math.abs(a.dy),a.y-=8*Math.abs(a.dx),o.x+=8*Math.abs(a.dy),o.y+=8*Math.abs(a.dx));let s=de(a,o);a.wire&&s.unshift(Re(r),Z[G[r]]+d),o.wire&&s.push(Re(i),Z[G[i]]+d);let c=fe(s);if(c.length<4)continue;let l=v(`${n.lhsId}-${n.rhsId}`);Be+=`<g class="pele-edge" data-id="${l}"><path d="${pe(c,n.lhsInto&&!a.wire?He+a.gap:0,n.rhsInto&&!o.wire?He+o.gap:0)}"/>`+(n.lhsInto?C(`arrow_point`,a.x+a.dx*a.gap,a.y+a.dy*a.gap,-a.dx,-a.dy,`var(--_l)`):``)+(n.rhsInto?C(`arrow_point`,o.x+o.dx*o.gap,o.y+o.dy*o.gap,-o.dx,-o.dy,`var(--_l)`):``)+`</g>`;let f=-1,p=-1,m=-1,h=-1,g=he[t];for(let e=0;e<c.length;e+=2)Q=Math.min(Q,c[e]-4),Me=Math.max(Me,c[e]+4),je=Math.min(je,c[e+1]-4),Ne=Math.max(Ne,c[e+1]+4);for(let e=0;e+3<c.length;e+=2){let t=Math.abs(c[e+1]-c[e+3])<.01,n=Math.abs(c[e]-c[e+2])+Math.abs(c[e+1]-c[e+3]);t||$.push(c[e],Math.min(c[e+1],c[e+3]),Math.max(c[e+1],c[e+3])),n>p&&(f=e,p=n),t&&n>h&&(m=e,h=n)}if(g.width>0){let e=h>=g.width+8?m:f,t=(c[e]+c[e+2])/2,r=(c[e+1]+c[e+3])/2,i=g.width+8,s=Math.abs(c[e]-c[e+2])<.01;for(let e of[a,o])t+i/2<=e.x0||t-i/2>=e.x1||r+g.height/2<=e.y0||r-g.height/2>=e.y1||(s?t=t>=(e.x0+e.x1)/2?e.x1+i/2+4:e.x0-i/2-4:r=r>=(e.y0+e.y1)/2?e.y1+g.height/2+4:e.y0-g.height/2-4);Q=Math.min(Q,t-i/2),Me=Math.max(Me,t+i/2),je=Math.min(je,r-g.height/2),Ne=Math.max(Ne,r+g.height/2),Ve+=S(`${n.lhsId}-${n.rhsId}`,g,t,r,``,u)}}let Ue=``;for(let e=0;e<w;e++){let t=p[e],n=Pe(e),r=Ie(e),i=Fe(e)-n,a=_e[e],o=``;if(X[e]>0){let s=r+Se[e]+12,c=[];for(let e=0;e<$.length;e+=3)$[e+1]<s&&$[e+2]>r&&$[e]>n&&$[e]<n+i&&c.push($[e]);c.sort((e,t)=>e-t),c.push(n+i-4);let l=n+10;for(let t of c){if(t-6-l>=X[e])break;l=Math.max(l,t+6)}l+X[e]>n+i-4&&(l=n+10);let d=r+6+Se[e]/2,f=l;t.icon&&(o+=le(t.icon,l,d-De/2,De,u),f+=De+6),o+=b(a,f+a.width/2,d,` class="pele-cluster-label" fill="var(--_m)"`,u)}Ue+=`<g class="pele-cluster" data-id="${v(t.id)}"><rect x="${h(n)}" y="${h(r)}" width="${h(i)}" height="${h(Le(e)-r)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${_}/>`+o+`</g>`}let We=``,Ge=i*.5,Ke=Math.max(6,Math.round(a*.75));for(let e=0;e<m;e++){let t=f[e],n=`data-id="${v(t.id)}" transform="translate(${h(Re(e))},${h(Z[G[e]])})"`;if(t.type===`junction`){We+=`<g class="pele-node pele-junction" ${n}><circle cy="${h(d)}" r="${ie}" fill="var(--_l)"/></g>`;continue}let r=``;if(t.icon)r=le(t.icon,-Ge/2,(i-Ge)/2,Ge,u);else if(t.iconText){let e=y(t.iconText,!1,c,Ke,i-8),n=Math.max(1,Math.floor((i-4)/(e.lineHeight||1)));r=b(ue(e,i-8,n,c),0,d,` class="pele-icon-text" font-size="${Ke}"`,u)}We+=`<g class="pele-node pele-service" ${n}><rect x="${h(-d)}" width="${h(i)}" height="${h(i)}" fill="var(--_s)" stroke="var(--_b)"${_}/>`+r+b(D[e],0,i+U+D[e].height/2,` class="pele-label"`,u)+`</g>`}let qe=y(e.title,!1,c,a,r?ee(n):4e3,1),Je=qe.height>0?qe.height+12:0,Ye=Math.ceil(Math.max(Me-Q,qe.width)+2*l),Xe=Math.ceil(Ne-je+Je+2*l),Ze=Math.round((Ye-(Me-Q))/2-Q),Qe=Math.round(l+Je-je),$e=(Ue?`<g class="pele-clusters">${Ue}</g>`:``)+(Be?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round" stroke-linejoin="round">${Be}</g>`:``)+(Ve?`<g class="pele-edge-labels" font-size="${s}">${Ve}</g>`:``)+(We?`<g class="pele-nodes">${We}</g>`:``);return{svg:g(`architecture`,Ye,Xe,a,n,e,b(qe,Ye/2,l+qe.height/2,` class="pele-title" font-weight="var(--_tw)"`)+($e?`<g transform="translate(${Ze},${Qe})">${$e}</g>`:``)),width:Ye,height:Xe,links:[]}}var me={type:`architecture`,parse(e,t,n){let r=new D;return n&&(r.title=n),O(N(e),r),r},render:W};export{me as architecture};
3
- //# sourceMappingURL=HSJLKHB7-BojHXJG0.js.map
3
+ //# sourceMappingURL=HSJLKHB7-txH19TCj.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{a as i,i as a,n as o,r as s,t as c}from"./number-field-BkDsfSCt.js";import{l}from"./SettingsPanels.logic-BkjrmwrI.js";var u=n(),d=e(t(),1),f=e(r(),1);function p(e){let t=(0,u.c)(29),{label:n,value:r,min:p,step:h,onCommit:g}=e,_=r,v;t[0]!==_||t[1]!==r?(v={saved:r,draft:_,committed:r,revision:0},t[0]=_,t[1]=r,t[2]=v):v=t[2];let[y,b]=(0,d.useState)(v);y.saved!==r&&b({...y,saved:r,draft:r,committed:r});let x=y.draft,S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>b(t=>({...t,draft:e})),t[3]=S):S=t[3];let C;t[4]!==y.committed||t[5]!==y.revision||t[6]!==p||t[7]!==g?(C=e=>{if(e===null){b(m);return}let t=l(e,p);if(t===y.committed){b(e=>({...e,draft:t}));return}let n=y.revision+1;b(e=>({...e,draft:t,committed:t,revision:n})),g(t,{onFailed:()=>b(e=>e.revision===n?{...e,committed:e.saved,draft:e.draft===t?e.saved:e.draft}:e)})},t[4]=y.committed,t[5]=y.revision,t[6]=p,t[7]=g,t[8]=C):C=t[8];let w=`Decrease ${n}`,T;t[9]===w?T=t[10]:(T=(0,f.jsx)(o,{"aria-label":w}),t[9]=w,t[10]=T);let E;t[11]===n?E=t[12]:(E=n.charAt(0).toUpperCase(),t[11]=n,t[12]=E);let D;t[13]===n?D=t[14]:(D=n.slice(1),t[13]=n,t[14]=D);let O=`${E}${D} in seconds`,k;t[15]===O?k=t[16]:(k=(0,f.jsx)(i,{"aria-label":O}),t[15]=O,t[16]=k);let A=`Increase ${n}`,j;t[17]===A?j=t[18]:(j=(0,f.jsx)(a,{"aria-label":A}),t[17]=A,t[18]=j);let M;t[19]!==k||t[20]!==j||t[21]!==T?(M=(0,f.jsxs)(s,{children:[T,k,j]}),t[19]=k,t[20]=j,t[21]=T,t[22]=M):M=t[22];let N;return t[23]!==y.draft||t[24]!==p||t[25]!==h||t[26]!==M||t[27]!==C?(N=(0,f.jsx)(c,{value:x,min:p,step:h,size:`sm`,className:`w-32`,onValueChange:S,onValueCommitted:C,children:M}),t[23]=y.draft,t[24]=p,t[25]=h,t[26]=M,t[27]=C,t[28]=N):N=t[28],N}function m(e){return{...e,draft:e.saved}}export{p as t};
2
- //# sourceMappingURL=IntervalSecondsField-Cpc7UePr.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{a as i,i as a,n as o,r as s,t as c}from"./number-field-BkDsfSCt.js";import{l}from"./SettingsPanels.logic-UhRGlGN1.js";var u=n(),d=e(t(),1),f=e(r(),1);function p(e){let t=(0,u.c)(29),{label:n,value:r,min:p,step:h,onCommit:g}=e,_=r,v;t[0]!==_||t[1]!==r?(v={saved:r,draft:_,committed:r,revision:0},t[0]=_,t[1]=r,t[2]=v):v=t[2];let[y,b]=(0,d.useState)(v);y.saved!==r&&b({...y,saved:r,draft:r,committed:r});let x=y.draft,S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>b(t=>({...t,draft:e})),t[3]=S):S=t[3];let C;t[4]!==y.committed||t[5]!==y.revision||t[6]!==p||t[7]!==g?(C=e=>{if(e===null){b(m);return}let t=l(e,p);if(t===y.committed){b(e=>({...e,draft:t}));return}let n=y.revision+1;b(e=>({...e,draft:t,committed:t,revision:n})),g(t,{onFailed:()=>b(e=>e.revision===n?{...e,committed:e.saved,draft:e.draft===t?e.saved:e.draft}:e)})},t[4]=y.committed,t[5]=y.revision,t[6]=p,t[7]=g,t[8]=C):C=t[8];let w=`Decrease ${n}`,T;t[9]===w?T=t[10]:(T=(0,f.jsx)(o,{"aria-label":w}),t[9]=w,t[10]=T);let E;t[11]===n?E=t[12]:(E=n.charAt(0).toUpperCase(),t[11]=n,t[12]=E);let D;t[13]===n?D=t[14]:(D=n.slice(1),t[13]=n,t[14]=D);let O=`${E}${D} in seconds`,k;t[15]===O?k=t[16]:(k=(0,f.jsx)(i,{"aria-label":O}),t[15]=O,t[16]=k);let A=`Increase ${n}`,j;t[17]===A?j=t[18]:(j=(0,f.jsx)(a,{"aria-label":A}),t[17]=A,t[18]=j);let M;t[19]!==k||t[20]!==j||t[21]!==T?(M=(0,f.jsxs)(s,{children:[T,k,j]}),t[19]=k,t[20]=j,t[21]=T,t[22]=M):M=t[22];let N;return t[23]!==y.draft||t[24]!==p||t[25]!==h||t[26]!==M||t[27]!==C?(N=(0,f.jsx)(c,{value:x,min:p,step:h,size:`sm`,className:`w-32`,onValueChange:S,onValueCommitted:C,children:M}),t[23]=y.draft,t[24]=p,t[25]=h,t[26]=M,t[27]=C,t[28]=N):N=t[28],N}function m(e){return{...e,draft:e.saved}}export{p as t};
2
+ //# sourceMappingURL=IntervalSecondsField-xqmFxAii.js.map
@@ -0,0 +1 @@
1
+ export{t as flowchart}from"./O65XPQGZ-BxqHRP3n.js";
@@ -1,2 +1,2 @@
1
- import{a as e}from"./6OLKWJ4F-CwQRt55E.js";var t=/[\t ]*accDescr(?:[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)|\s*({))/y;function n(){let e=!1;return(n,r)=>{t.lastIndex=r;let i=t.exec(n);if(i===null)return-1;let a=t.lastIndex;if(i[1]===void 0)return a;if(e)return-1;let o=n.indexOf(`}`,a);return e=o===-1,o+1||-1}}function r(t=`ACC_DESCR`){return{...e,name:t,scanner:n}}export{r as t};
2
- //# sourceMappingURL=K3MD6TGW-hwfRTJ3N.js.map
1
+ import{a as e}from"./6OLKWJ4F-0nUReGo5.js";var t=/[\t ]*accDescr(?:[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)|\s*({))/y;function n(){let e=!1;return(n,r)=>{t.lastIndex=r;let i=t.exec(n);if(i===null)return-1;let a=t.lastIndex;if(i[1]===void 0)return a;if(e)return-1;let o=n.indexOf(`}`,a);return e=o===-1,o+1||-1}}function r(t=`ACC_DESCR`){return{...e,name:t,scanner:n}}export{r as t};
2
+ //# sourceMappingURL=K3MD6TGW-4d2yDOzZ.js.map
@@ -1,4 +1,4 @@
1
- import{_ as e,d as t,f as n,g as r,l as i,m as a,r as o,s,t as c}from"./77XECAW3-DM5Itfvk.js";import{i as l}from"./DKTLEL5E-DciMwFJ1.js";import{t as u}from"./RVARI57O-CgA1WoRv.js";import{PeleError as d,_ as f,a as p,c as m,i as h,r as g,s as _,u as v}from"./lazy-Bpm7QNt6.js";var y=/^\d+$/,b=/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/,x=/^\d+px$/;function S(e,t,n){return new d(`value for ${e} ${t} is invalid, please use a valid ${n}`,`semantic`,{type:`quadrantChart`})}function C(e){let t=e.trim(),n=t.indexOf(`:`);if(n===-1)return[t,`undefined`];let r=t.slice(n+1).trimStart(),i=r.indexOf(`:`);return[t.slice(0,n).trimEnd(),i===-1?r:r.slice(0,i).trimEnd()]}function w(e){let t={};for(let n of e){let[e,r]=C(n);if(e===`radius`){if(!y.test(r))throw S(e,r,`number`);t.radius=parseInt(r)}else if(e===`color`){if(!b.test(r))throw S(e,r,`hex code`);t.color=r}else if(e===`stroke-color`){if(!b.test(r))throw S(e,r,`hex code`);t.strokeColor=r}else if(e===`stroke-width`){if(!x.test(r))throw S(e,r,`number of pixels (eg. 10px)`);t.strokeWidth=r}else throw new d(`style named ${e} is not supported.`,`semantic`,{type:`quadrantChart`})}return t}function T(e){return{text:e.text.trim(),type:e.type}}var E=class{type=`quadrantChart`;title;accTitle;accDescr;quadrants=[void 0,void 0,void 0,void 0];xAxisLeft;xAxisRight;yAxisBottom;yAxisTop;points=[];classes=new Map;setQuadrant1Text(e){this.quadrants[0]=T(e)}setQuadrant2Text(e){this.quadrants[1]=T(e)}setQuadrant3Text(e){this.quadrants[2]=T(e)}setQuadrant4Text(e){this.quadrants[3]=T(e)}setXAxisLeftText(e){this.xAxisLeft=T(e)}setXAxisRightText(e){this.xAxisRight=T(e)}setYAxisBottomText(e){this.yAxisBottom=T(e)}setYAxisTopText(e){this.yAxisTop=T(e)}addPoint(e,t,n,r,i){this.points.push({x:Number(n),y:Number(r),text:T(e),className:t,...w(i)})}addClass(e,t){this.classes.set(e,w(t))}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
1
+ import{_ as e,d as t,f as n,g as r,l as i,m as a,r as o,s,t as c}from"./77XECAW3-_XJOQitm.js";import{i as l}from"./DKTLEL5E-DciMwFJ1.js";import{t as u}from"./RVARI57O-CgA1WoRv.js";import{PeleError as d,_ as f,a as p,c as m,i as h,r as g,s as _,u as v}from"./lazy--Qcevr63.js";var y=/^\d+$/,b=/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/,x=/^\d+px$/;function S(e,t,n){return new d(`value for ${e} ${t} is invalid, please use a valid ${n}`,`semantic`,{type:`quadrantChart`})}function C(e){let t=e.trim(),n=t.indexOf(`:`);if(n===-1)return[t,`undefined`];let r=t.slice(n+1).trimStart(),i=r.indexOf(`:`);return[t.slice(0,n).trimEnd(),i===-1?r:r.slice(0,i).trimEnd()]}function w(e){let t={};for(let n of e){let[e,r]=C(n);if(e===`radius`){if(!y.test(r))throw S(e,r,`number`);t.radius=parseInt(r)}else if(e===`color`){if(!b.test(r))throw S(e,r,`hex code`);t.color=r}else if(e===`stroke-color`){if(!b.test(r))throw S(e,r,`hex code`);t.strokeColor=r}else if(e===`stroke-width`){if(!x.test(r))throw S(e,r,`number of pixels (eg. 10px)`);t.strokeWidth=r}else throw new d(`style named ${e} is not supported.`,`semantic`,{type:`quadrantChart`})}return t}function T(e){return{text:e.text.trim(),type:e.type}}var E=class{type=`quadrantChart`;title;accTitle;accDescr;quadrants=[void 0,void 0,void 0,void 0];xAxisLeft;xAxisRight;yAxisBottom;yAxisTop;points=[];classes=new Map;setQuadrant1Text(e){this.quadrants[0]=T(e)}setQuadrant2Text(e){this.quadrants[1]=T(e)}setQuadrant3Text(e){this.quadrants[2]=T(e)}setQuadrant4Text(e){this.quadrants[3]=T(e)}setXAxisLeftText(e){this.xAxisLeft=T(e)}setXAxisRightText(e){this.xAxisRight=T(e)}setYAxisBottomText(e){this.yAxisBottom=T(e)}setYAxisTopText(e){this.yAxisTop=T(e)}addPoint(e,t,n,r,i){this.points.push({x:Number(n),y:Number(r),text:T(e),className:t,...w(i)})}addClass(e,t){this.classes.set(e,w(t))}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
2
2
  `)}},D=`$end.INVALID.NEWLINE.title.title_value.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.X-AXIS.Y-AXIS.AXIS-TEXT-DELIMITER.QUADRANT_1.QUADRANT_2.QUADRANT_3.QUADRANT_4.CLASSDEF.MD_STR.STR.class_name.point_start.point_x.point_y.QUADRANT.ALPHA.UNICODE_TEXT.COLON.PLUS.COMMA.EQUALS.MULT.BRKT.UNDERSCORE.DOT.AMP.MINUS.NUM.SPACE.SEMI.PUNCTUATION.EOF`.split(`.`),O=[41,4,6,8,9,19],k=new Uint8Array(128);for(let[e,t]of[[`:`,27],[`+`,28],[`,`,29],[`=`,30],[`*`,31],[`#`,32],[`_`,33],[`.`,34],[`&`,35],[`-`,36],[` \v\f`,38],[`;`,39],["!$%'`?\\/",40]])for(let n=0;n<e.length;n++)k[e.charCodeAt(n)]=t;function A(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=0,l=0,d=0,f=0,v=0,y=0,b=0,x=0,S=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},C=e=>{a.push(o),o=e},w=()=>{a.length>0&&(o=a.pop())},T=n=>{let r=e.indexOf(`
3
3
  `,n);return r===-1?t:r},E=t=>{for(;e.charCodeAt(t)===32;)t++;return t},D=n=>{for(;n<t&&g(e.charCodeAt(n));)n++;return n},A=n=>{let r=e.charCodeAt(n);if(r===49)return n+1;if(r!==48)return-1;let i=n+1;if(i<t&&!p(e.charCodeAt(i))&&_(e.charCodeAt(i+1)))for(i+=2;_(e.charCodeAt(i));)i++;return i};t:for(;s<t;){let n=e.charCodeAt(s),r=e.charCodeAt(s+1);switch(o){case 0:break;case 1:case 2:case 3:S(O[o],s,T(s)),w();continue;case 4:if(n===125)s++,w();else{let n=e.indexOf(`}`,s);S(9,s,n===-1?t:n)}continue;case 5:if(n===34)s++,w();else{let n=e.indexOf(`"`,s);S(19,s,n===-1?t:n)}continue;case 6:if(n===96&&r===34){s+=2,w();continue}if(n!==96&&n!==34){let n=s+1;for(let r=e.charCodeAt(n);n<t&&r!==96&&r!==34;r=e.charCodeAt(++n));S(18,s,n);continue}break t;case 7:if(h(n)){let t=s+1;for(;h(e.charCodeAt(t));)t++;S(20,s,t),w();continue}break t;case 8:{let t=A(s);if(t!==-1){S(22,s,t),C(9);continue}let n=D(s);if(e.charCodeAt(n)===93){s=E(n+1),w();continue}break t}case 9:{let t=D(s);if(e.charCodeAt(t)===44){s=D(t+1),o=10;continue}break t}case 10:{let e=A(s);if(e!==-1){S(23,s,e),w();continue}break t}}if(n===37&&r===37){s=T(s+2);continue}if(n!==125&&r===37&&e.charCodeAt(s+2)===37){s=T(s+3);continue}if(n===10||n===13){let t=s+1;for(let n=e.charCodeAt(t);n===10||n===13;n=e.charCodeAt(++t));S(2,s,t);continue}let i=n|32;if(i===116&&u(e,s,`title`)&&!h(e.charCodeAt(s+5))){S(3,s,s+5),C(1);continue}if(i===97&&u(e,s,`acc`)){let t=u(e,s+3,`descr`);if(t||u(e,s+3,`title`)){let n=D(s+8),r=e.charCodeAt(n);if(r===58){S(t?7:5,s,D(n+1)),C(t?3:2);continue}if(r===123&&t){s=D(n+1),C(4);continue}}}let a=s;n===32&&((s<c||s>=l)&&(c=s,l=E(s)),a=l);let p=e.charCodeAt(a),j=p|32,M=0,N=0;if(j===120&&u(e,a,`x-axis`))M=10,N=a+6;else if(j===121&&u(e,a,`y-axis`))M=11,N=a+6;else if(p===45){if(a<d||a>=f)for(d=a,f=a;e.charCodeAt(f)===45;)f++;f-a>=2&&e.charCodeAt(f)===62&&(M=12,N=f+1)}else if(j===113&&u(e,a,`quadrant`)){let t=e.charCodeAt(a+9);e.charCodeAt(a+8)===45&&t>=49&&t<=52?(M=13+t-49,N=a+10):u(e,a+8,`chart`)&&(M=24,N=a+13)}if(M!==0)S(M,s,E(N));else if(i===99&&u(e,s,`classdef`)&&!h(e.charCodeAt(s+8)))S(17,s,s+8);else if(n===34)r===96?(s+=2,C(6)):(s++,C(5));else if(n===58&&r===58&&e.charCodeAt(s+2)===58)s+=3,C(7);else{if(n===58||g(n)){let t=s;if(n!==58&&((s<v||s>=y)&&(v=s,y=D(s)),t=y),e.charCodeAt(t)===58&&((t+1<b||t+1>=x)&&(b=t+1,x=D(t+1)),e.charCodeAt(x)===91)){S(21,s,D(x+1)),C(8);continue}}if(m(n)){let t=s+1;for(;m(e.charCodeAt(t));)t++;S(25,s,t)}else if(n>=128){let t=s+1;for(;e.charCodeAt(t)>=128;)t++;S(26,s,t)}else if(_(n)){let t=s+1;for(;_(e.charCodeAt(t));)t++;S(37,s,t)}else if(k[n]!==0)S(k[n],s,s+1);else break}}return s<t?(n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}):(o<O.length&&(n.push(O[o]),r.push(``),i.push(t)),n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i})}function j(...e){let t=new Uint8Array(42);for(let n of e)t[n]=1;return t}var M=j(40,35,37,25,29,28,30,31,34,32,33,26),N=j(25,37,36,29,27,35,32,31,26),P=j(25,37,27,38,32,36),F=j(2,39,41),I=[`setQuadrant1Text`,`setQuadrant2Text`,`setQuadrant3Text`,`setQuadrant4Text`],L=`'STR', 'MD_STR', 'ALPHA', 'NUM', 'UNICODE_TEXT', 'PUNCTUATION'`;function R(e,t){let{types:n,texts:r,starts:i}=A(e),a=0,o=t=>{let r=n[a];throw r===1?v(`quadrantChart`,e,i[a],``,!0):v(`quadrantChart`,e,i[a],`Expecting ${t}, got '${D[r]}'`)},s=e=>(n[a]!==e&&o(`'${D[e]}'`),r[a++]),c=e=>e===19||e===18||M[e]===1,l=()=>{let e=n[a];c(e)||o(L);let t=r[a++];for(;M[n[a]]===1||n[a]===38||n[a]===36;)t+=r[a++];return{text:t,type:e===18?`markdown`:`text`}},u=()=>{let e=[];for(;;){P[n[a]]===0&&o(`'ALPHA', 'NUM', 'COLON', 'SPACE', 'BRKT', 'MINUS'`);let t=r[a++];for(;P[n[a]]===1;)t+=r[a++];if(e.push(t.trim()),n[a]!==29)return e;a++}};for(;F[n[a]]===1||n[a]===38;)a++;for(s(24);n[a]!==0;){for(;n[a]===38;)a++;let e=n[a];switch(e){case 17:{a++,s(38),N[n[a]]===0&&o(`'ALPHA', 'NUM', 'UNICODE_TEXT'`);let e=r[a++];for(;N[n[a]]===1;)e+=r[a++];s(38),t.addClass(e,u());break}case 10:case 11:{a++;let r=l(),i;n[a]===12&&(a++,c(n[a])?i=l():r.text+=` ⟶ `),e===10?(t.setXAxisLeftText(r),i&&t.setXAxisRightText(i)):(t.setYAxisBottomText(r),i&&t.setYAxisTopText(i));break}case 13:case 14:case 15:case 16:a++,t[I[e-13]](l());break;case 3:a++,t.setDiagramTitle(s(4).trim());break;case 5:a++,t.setAccTitle(s(6).trim());break;case 7:a++,t.setAccDescription(s(8).trim());break;case 9:t.setAccDescription(r[a++].trim());break;default:if(c(e)){let e=l(),i=n[a]===20?r[a++]:``;s(21);let o=s(22),c=s(23);t.addPoint(e,i,o,c,P[n[a]]===1?u():[])}}F[n[a]]===0&&o(`'NEWLINE', 'SEMI', 'EOF'`),a++}}var ee=4,te=300;function z(e,t){return e.quadrantChart?.[t]}function B(e,t,n,r){let i=z(e,t);return typeof i==`number`&&i>=0?Math.min(i,r):n}function ne(e){return e.startsWith(`#`)?e:`#`+e}function V(u,d,p){let m=p.fontSize??16,h=Math.round(m*.875),g=Math.round(m*.75),_=p.measurer??f(p.fontFamily),v=Math.round(Math.max(100,B(d,`chartWidth`,500,4e3))),y=Math.round(l(p,v,280)),b=Math.round(Math.max(100,B(d,`chartHeight`,500,4e3))*y/v),x=B(d,`quadrantPadding`,p.padding??8,200),S=B(d,`xAxisLabelPadding`,5,200),C=B(d,`yAxisLabelPadding`,5,200),w=u.points.length>0,T=(e,t,n)=>s(e?.text,e?.type===`markdown`,_,t,Math.max(n,40)),E=s(u.title,!1,_,m,Math.max(y-2*x,40),1),D=B(d,`titlePadding`,10,200),O=E.height>0?E.height+D:0,k=!!(u.xAxisLeft?.text||u.xAxisRight?.text),A=!!(u.yAxisBottom?.text||u.yAxisTop?.text),j=w||z(d,`xAxisPosition`)===`bottom`,M=z(d,`yAxisPosition`)===`right`,N=y-2*x,P=T(u.xAxisLeft,h,u.xAxisRight?N/2-16:N),F=T(u.xAxisRight,h,N/2-16),I=Math.max(P.height,F.height),L=k?I+S:0,R=b-2*x-O-L,V=T(u.yAxisBottom,h,u.yAxisTop?R/2-16:R),H=T(u.yAxisTop,h,R/2-16),U=Math.max(V.height,H.height),re=A?U+C:0,W=x+(M?0:re),G=x+O+(j?0:L),K=Math.max(0,N-re),q=Math.max(0,R),J=Math.max(0,(K-ee)/2),Y=Math.max(0,(q-ee)/2),X=[W+J,G,W+K-J,G+q,W,G+Y,W+K,G+q-Y],ie=(e,t,n,r,i)=>{for(let a=e;a<X.length;a+=4)if(t<X[a+2]&&r>X[a]&&n<X[a+3]&&i>X[a+1])return!1;return!0},ae=B(d,`quadrantTextTopPadding`,5,200),oe=``;for(let e=0;e<4;e++){let t=e===0||e===3?W+K-J:W,r=e<2?G:G+q-Y,i=T(u.quadrants[e],m,J-16),o=t+J/2,s=w?r+ae+i.height/2:r+Y/2;X.push(o-i.width/2,s-i.height/2,o+i.width/2,s+i.height/2),oe+=`<g class="pele-quadrant" data-id="${e+1}"><rect x="${n(t)}" y="${n(r)}" width="${n(J)}" height="${n(Y)}"${a}/>`+c(i,o,s,` class="pele-label" fill="var(--_fg)" stroke="none"`)+`</g>`}let Z=``;if(k){let e=j?G+q+S+I/2:G-S-I/2;Z+=c(P,F.height>0?W+K/4:W+P.width/2,e,``)+c(F,W+K*3/4,e,``)}if(A){let e=M?W+K+C+U/2:W-C-U/2,t=(t,r)=>t.height>0?`<g transform="translate(${n(e)},${n(r)}) rotate(-90)">${c(t,0,0,``)}</g>`:``;Z+=t(V,H.height>0?G+q*3/4:G+q-V.width/2)+t(H,G+q/4)}let se=B(d,`pointRadius`,5,200),ce=B(d,`pointTextPadding`,5,200),le=t(0),Q=[],ue=[];for(let t of u.points){if(!(t.x>=0&&t.x<=1&&t.y>=0&&t.y<=1))continue;let r=u.classes.get(t.className),a=Math.min(t.radius??r?.radius??se,2e3),s=t.color??r?.color,c=t.strokeColor??r?.strokeColor,l=t.strokeWidth??r?.strokeWidth,d=[];s&&d.push(`fill:`+ne(s)),l&&(c&&d.push(`stroke:`+ne(c)),d.push(`stroke-width:`+l));let f=W+t.x*K,p=G+(1-t.y)*q;Q.push({cx:f,cy:p,reach:a+(l?Math.min(parseInt(l),400)/2:0),text:T(t.text,g,200)}),ue.push(`<circle class="pele-point${e(t.className)}" data-id="${o(t.text.text)}" cx="${n(f)}" cy="${n(p)}" r="${n(a)}"${l&&!c?` stroke="${le}"`:``}${i(d).shape}/>`)}let $=Q.length<=te;if($)for(let{cx:e,cy:t,reach:n}of Q)X.push(e-n,t-n,e+n,t+n);let de=``;for(let{cx:e,cy:t,reach:n,text:r}of Q){let i=r.width/2,a=r.size*.6+(r.height-r.lineHeight)/2,o=n+ce,s=[e,t+o+a,e,t-o-a,e+o+i,t,e-o-i,t],l=e,u=s[1],d=!1;for(let e=0;e<16;e+=2){let t=e%8,n=t<4&&r.width<K?Math.min(Math.max(s[t],W+i),W+K-i):s[t],o=s[t+1];if(n-i<W||n+i>W+K||o-a<G||o+a>G+q)continue;let c=!$||ie(e<8?0:8,n-i,o-a,n+i,o+a);if((!d||c)&&(l=n,u=o,d=!0),c)break}$&&X.push(l-i,u-a,l+i,u+a),de+=c(r,l,u,` class="pele-label"`)}let fe=c(E,y/2,D/2+E.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g class="pele-quadrants" fill="var(--_s)" stroke="var(--_b)">${oe}</g>`+(Z?`<g class="pele-axis-labels" font-size="${h}" fill="var(--_m)">${Z}</g>`:``)+(Q.length>0?`<g class="pele-points" fill="${le}">${ue.reverse().join(``)}</g><g class="pele-point-labels" font-size="${g}">${de}</g>`:``);return{svg:r(`quadrantChart`,y,b,m,p,u,fe),width:y,height:b,links:[]}}var H={type:`quadrantChart`,parse(e,t,n){let r=new E;return r.title=n,R(e,r),r},render:V};export{H as quadrantChart};
4
- //# sourceMappingURL=K7RP3OMA-4mJh9KrG.js.map
4
+ //# sourceMappingURL=K7RP3OMA-B8vKr81f.js.map
@@ -1,4 +1,4 @@
1
- import{_ as e,f as t,g as n,h as r,l as i,n as a,o,r as s,s as c,t as l,y as u}from"./77XECAW3-DM5Itfvk.js";import{a as d,i as f,l as p,s as m}from"./N3JZAHOW-Dz6QAj1L.js";import{a as h,t as g}from"./DKTLEL5E-DciMwFJ1.js";import{r as _}from"./74OO7NKP-DZoL_aBI.js";import{i as v,n as y,r as b,t as x}from"./NUIALGQ3-W9kPoZrb.js";import{t as ee}from"./TSHNXIZL-CjI9VTqp.js";import{PeleError as S,_ as te,c as C,l as w,o as T,s as E}from"./lazy-Bpm7QNt6.js";var D=`EOF USECASE ACTOR SYSTEM_BOUNDARY END DIRECTION TD TB BT LR RL NOTE FOR JSON CLASS_DEF CLASS STYLE INCLUDE EXTEND TRUE FALSE IDENTIFIER NUMBER AT COMMA COLON HASH_COLOR CSS_IDENTIFIER CSS_ESCAPED_COMMA DASH DOT PERCENT CSS_PUNCTUATION LABEL_PUNCTUATION LABEL_SYMBOL PLAIN_STRING MARKDOWN_STRING UNCLOSED_MARKDOWN_STRING COMMENT NEWLINE ACC_DESCR_BLOCK ACC_TITLE_LINE ACC_DESCR_LINE JSON_DECLARATION_START JSON_OBJECT_LITERAL UNCLOSED_JSON_OBJECT_LITERAL GENERALIZATION DEPENDENCY_ARROW STEREOTYPE_START STEREOTYPE_END STEREOTYPE_TEXT UNCLOSED_STEREOTYPE_TEXT CLASS_SEPARATOR FORWARD_SOLID BACKWARD_SOLID FORWARD_CIRCLE BACKWARD_CIRCLE FORWARD_CROSS BACKWARD_CROSS MARKERLESS_SOLID METADATA_START LBRACE RBRACE LBRACKET RBRACKET LPAREN RPAREN`.split(` `),O=1,k=2,A=new Uint8Array(128);for(let e=48;e<=57;e++)A[e]=O;for(let e=65;e<=90;e++)A[e]=A[e+32]=O;A[95]=O;for(let e of`!#$&*+/=?^|~`)A[e.charCodeAt(0)]=k;var j=[0,12,5,14,3,9,2,2,2,2,2,4,3,4,8,5,5,7,6,4,5];function M(e){return e<128&&(A[e]&O)!==0}function N(e,t,n){for(let r=0;r<n.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function ne(e,t,n){switch(n){case 97:return e.startsWith(`actor`,t)?2:0;case 115:return e.startsWith(`systemBoundary`,t)?3:e.startsWith(`style`,t)?16:0;case 101:return e.startsWith(`end`,t)?4:N(e,t,`extend`)?18:0;case 69:return N(e,t,`extend`)?18:0;case 100:return e.startsWith(`direction`,t)?5:0;case 84:return e.startsWith(`TD`,t)?6:e.startsWith(`TB`,t)?7:0;case 66:return e.startsWith(`BT`,t)?8:0;case 76:return e.startsWith(`LR`,t)?9:0;case 82:return e.startsWith(`RL`,t)?10:0;case 110:return e.startsWith(`note`,t)?11:0;case 102:return e.startsWith(`for`,t)?12:e.startsWith(`false`,t)?20:0;case 106:return e.startsWith(`json`,t)?13:0;case 99:return e.startsWith(`classDef`,t)?14:e.startsWith(`class`,t)?15:0;case 105:case 73:return N(e,t,`include`)?17:0;case 116:return e.startsWith(`true`,t)?19:0;case 117:return+!!e.startsWith(`usecase-beta`,t);default:return 0}}function P(e,t){let n=1,r=0;for(let i=0;i<t;i++){let a=e.charCodeAt(i);a!==10&&a!==13||(a===13&&i+1<t&&e.charCodeAt(i+1)===10&&i++,n++,r=i+1)}return[n,t-r+1]}function re(e,t,n){let[r,i]=P(e,t);return`line ${r}, column ${i} [${t},${n})`}function ie(e,t,n){for(let r=t+1;r<e.length;r++){let t=e.charCodeAt(r);if(t===n)return r+1;if(t===10||t===13)return-1}return-1}function ae(e,t){let n=e.charCodeAt(t);return n!==34&&n!==39||n===34&&e.charCodeAt(t+1)===96||ie(e,t,n)!==-1}function oe(e,t,n){let[r,i]=P(e,t);return new S(`Error lexing usecase diagram: unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters. at line ${r}, column ${i} [${t},${t+n})`,`syntax`,{type:`usecase`,line:r,column:i})}function se(e){let t=[],n=[],r=[],i=e.length,a=0,o=!0,s=!1;for(;a<i;){let c=e.charCodeAt(a);if(c===32||c===9){a++;continue}let l,u=a+1,d=!1;if(c<128&&(A[c]&O)!==0){if(l=0,c===97&&o&&e.startsWith(`acc`,a)){let t=e.startsWith(`Descr`,a+3);if(t||e.startsWith(`Title`,a+3)){let n=a+8;for(;T(e.charCodeAt(n));)n++;let r=e.charCodeAt(n);if(r===58)for(l=t?42:41,u=n+1;u<i&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;else if(r===123&&t&&!s){let t=e.indexOf(`}`,n+1);t===-1?s=!0:(l=40,u=t+1)}}}else if(c===106&&e.startsWith(`json`,a)&&T(e.charCodeAt(a+4))){let s=a+5;for(;T(e.charCodeAt(s));)s++;let c=s;for(;M(e.charCodeAt(s));)s++;if(s>c){for(;T(e.charCodeAt(s));)s++;if(e.charCodeAt(s)===64){for(s++;T(e.charCodeAt(s));)s++;if(e.charCodeAt(s)===123){t.push(43),n.push(a),r.push(s),a=s;let c=0,l=!1,u=!1,d=s;for(;d<i;d++){let t=e.charCodeAt(d);if(l)u?u=!1:t===92?u=!0:t===34&&(l=!1);else if(t===34)l=!0;else if(t===123)c++;else if(t===125&&--c===0)break}t.push(d<i?44:45),n.push(s),a=d<i?d+1:i,r.push(a),o=!1;continue}}}}if(l===0){for(;u<i&&M(e.charCodeAt(u));)u++;let t=ne(e,a,c);if(t!==0)t===1||u-a===j[t]?(l=t,u=a+j[t]):l=21;else if((c===111||c===120)&&e.charCodeAt(a+1)===45&&e.charCodeAt(a+2)===45)l=c===111?56:58,u=a+3;else if(E(c)){let t=a+1;for(;E(e.charCodeAt(t));)t++;if(e.charCodeAt(t)===46&&E(e.charCodeAt(t+1))){for(l=22,u=t+2;E(e.charCodeAt(u));)u++;for(;C(e.charCodeAt(u));)u++}else l=21}else for(l=21;e.charCodeAt(u)===45&&M(e.charCodeAt(u+1));)for(l=27,u+=2;M(e.charCodeAt(u));)u++}}else if(c===10)l=39,d=!0;else if(c===13)l=39,d=!0,e.charCodeAt(u)===10&&u++;else if(c===34||c===39){if(c===34&&e.charCodeAt(a+1)===96){let t=e.indexOf('`"',a+2);l=t===-1?37:36,u=t===-1?i:t+2}else if(l=35,u=ie(e,a,c),u===-1){let t=a+1;for(;t<i&&!ae(e,t);)t++;throw oe(e,a,t-a)}}else if(c===37){if(o&&e.charCodeAt(u)===37)for(l=38;u<i&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;else l=31}else if(c===45){if(e.charCodeAt(u)!==45)l=29;else{for(;e.charCodeAt(u)===45;)u++;let t=e.charCodeAt(u),n=u-a===2;n&&t===124&&e.charCodeAt(u+1)===62?(l=46,u+=2):t===62?(l=53,u++):n&&(t===111||t===120)?(l=t===111?55:57,u++):l=59}}else if(c===46){let t=e.charCodeAt(u);if(t===46&&e.charCodeAt(u+1)===62)l=47,u+=2;else if(E(t)){for(l=22;E(e.charCodeAt(u));)u++;for(;C(e.charCodeAt(u));)u++}else l=30}else if(c===60){if(e.charCodeAt(u)===60){if(t.push(48),n.push(a),r.push(a+2),o=!1,a+=2,a>=i)break;if(e.charCodeAt(a)===62&&e.charCodeAt(a+1)===62)l=49,u=a+2;else{let o=a,s=!1;for(;o<i;o++){let t=e.charCodeAt(o);if(t===10||t===13)break;if(t===62&&e.charCodeAt(o+1)===62){s=!0;break}}if(s&&e.slice(a,o).trim()!==``)t.push(50),n.push(a),r.push(o),l=49,a=o,u=o+2;else{for(;o<i&&e.charCodeAt(o)!==10&&e.charCodeAt(o)!==13;)o++;if(o===a){for(;o<i&&(e.charCodeAt(o)===10||e.charCodeAt(o)===13);)o++;throw oe(e,a,o-a)}l=51,u=o}}}else if(e.charCodeAt(u)===45&&e.charCodeAt(u+1)===45)for(l=54,u+=2;e.charCodeAt(u)===45;)u++;else l=33}else if(c===58)e.charCodeAt(u)===58&&e.charCodeAt(u+1)===58?(l=52,u+=2):l=25;else if(c===64)e.charCodeAt(u)===123?(l=60,u++):l=23;else if(c===123)l=61;else if(c===125)l=62;else if(c===91)l=63;else if(c===93)l=64;else if(c===40)l=65;else if(c===41)l=66;else if(c===44)l=24;else if(c===35){for(;w(e.charCodeAt(u));)u++;l=u>a+1?26:32}else if(c===92)e.charCodeAt(u)===44?(l=28,u++):l=33;else if(c<127&&c>32)l=(A[c]&k)===0?33:32;else for(l=34;u<i;){let t=e.charCodeAt(u);if(t>=32&&t<127||t===9||t===10||t===13)break;u++}t.push(l),n.push(a),r.push(u),a=u,o=d}for(let e=0;e<3;e++)t.push(0),n.push(i),r.push(i);return{types:t,starts:n,ends:r}}function ce(){return{type:`usecase`,actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,direction:`LR`,title:void 0,accTitle:``,accDescr:``,accDescription:``,source:``,headerSpan:[0,0],statements:[]}}function le(){return{elements:[],boundaries:[],jsons:[],relationships:[],notes:[],metadata:[],classes:[],styles:[],classDefs:[],direction:void 0,accTitle:``,accDescription:``}}function F(e,t){if(t.length===0)return;let n=new Set(e);for(let r of t)n.has(r)||(n.add(r),e.push(r))}function ue(e){let t=new Set([`actor`,`usecase`,`boundary`,`edge`]);for(let{key:n,value:r}of e)if(n===`icon`)t.clear(),t.add(`actor`);else if(n===`animate`||n===`animation`)t.clear(),t.add(`edge`);else if(n===`type`)t.clear(),r===`rect`||r===`package`?t.add(`boundary`):(r===`normal`||r===`hollow`||r===`awesome`)&&t.add(`actor`);else if(n===`business`)t.delete(`boundary`),t.delete(`edge`);else return;return t.size===1?[...t][0]:void 0}function de(e,t,n,r,i){let a=ce(),{actors:o,useCases:s,systemBoundaries:c}=a,l=new Map,u=new Map,d=new Map,f=new Map,p=new Map,m=t=>re(e,t[0],t[1]),h=(t,n)=>{let[r,i]=P(e,n[0]);return new S(t,`semantic`,{type:`usecase`,line:r,column:i})},g=(e,t)=>{throw h(`${e} at ${m(t)}`,t)},_=(e,t,n,r,i)=>{let a=e=>e===void 0?``:` (label "${e}")`;throw h(`${e} at ${m(t)}${a(r)}; previous declaration at ${m(n)}${a(i)}`,t)},v=(e,t,n)=>g(`Metadata property '${n.key}' is invalid for ${t} '${e}'`,n.keySpan),y=(e,t)=>{let n=p.get(e);(n===void 0||t<n)&&p.set(e,t)},b=e=>[...e].sort((e,t)=>(p.get(e.id)??0)-(p.get(t.id)??0)),x=(e,t)=>{l.set(e.id,{kind:t,span:e.span,generated:e.generated,label:e.label.text})},ee=(e,t)=>{let n=l.get(e.id);if(!n)return;let r=e.generated?e.label.text:void 0,i=n.generated?n.label:void 0;n.kind!==t&&_(`ID '${e.id}' is declared as both ${n.kind} and ${t}`,e.span,n.span,r,i),(n.generated||e.generated)&&_(`Generated ID '${e.id}' collides with another declaration`,e.span,n.span,r,i)},te=(e,t,n)=>{let r=l.get(e);r&&_(`ID '${e}' is declared more than once (${r.kind} and ${t})`,n,r.span,void 0,r.generated?r.label:void 0),l.set(e,{kind:t,span:n,generated:!1})},C=(e,t,n)=>{let{key:r,value:i}=t,a=a=>{!n&&a!==void 0&&a!==i&&_(`Actor '${e.id}' has conflicting ${r} metadata`,t.keySpan,e.span)};r===`type`&&(i===`normal`||i===`hollow`||i===`awesome`)?(a(e.actorType),e.actorType=i):r===`icon`&&typeof i==`string`?(a(e.icon),e.icon=i):r===`business`&&typeof i==`boolean`?(a(e.business),e.business=i):v(e.id,`actor`,t)},w=(e,t,n)=>{for(let r of t??[])e.kind===`actor`?C(e,r,n):r.key===`business`&&typeof r.value==`boolean`?(!n&&e.business!==void 0&&e.business!==r.value&&_(`Use case '${e.id}' has conflicting business metadata`,r.keySpan,e.span),e.business=r.value):v(e.id,`usecase`,r)},T=e=>{let t;if(e.kind===`actor`){s.delete(e.id);let n={id:e.id,label:e.label.text,labelType:e.label.type,business:e.business??!1,classes:[...e.classes],type:e.icon?`icon`:e.actorType??`normal`,styles:o.get(e.id)?.styles??[]};e.icon&&(n.icon=e.icon),o.set(e.id,n),t=n}else o.delete(e.id),t={id:e.id,label:e.label.text,labelType:e.label.type,business:e.business??!1,classes:[...e.classes],shape:e.shape??`ellipse`,styles:s.get(e.id)?.styles??[]},s.set(e.id,t);e.stereotype&&(t.stereotype=e.stereotype),e.parent?.id&&(t.parentId=e.parent.id)},E=e=>{ee(e,e.kind);let t=e.parent?.id?e.parent:void 0,n=u.get(e.id);if(n)(n.label.text!==e.label.text||n.label.type!==e.label.type)&&_(`ID '${e.id}' has conflicting labels`,e.span,n.span),e.shape&&n.shape&&e.shape!==n.shape&&_(`Use case '${e.id}' has conflicting shapes`,e.span,n.span),t&&n.parent?.id&&t.id!==n.parent.id&&_(`Element '${e.id}' belongs to more than one system boundary`,t.span,n.parent.span),e.stereotype&&n.stereotype&&e.stereotype!==n.stereotype&&_(`Element '${e.id}' has conflicting stereotypes`,e.span,n.stereotypeSpan??n.span),n.shape??=e.shape,n.parent??=e.parent,n.stereotype??=e.stereotype,n.stereotypeSpan??=e.stereotype?e.span:void 0,F(n.classes,e.classes),w(n,e.metadata,!1);else{let n={kind:e.kind,id:e.id,label:e.label,span:e.span,generated:e.generated,classes:[...e.classes],parent:t,shape:e.shape,stereotype:e.stereotype,stereotypeSpan:e.stereotype?e.span:void 0};w(n,e.metadata,!1),u.set(e.id,n),x(e,e.kind)}},D=e=>{ee(e,`boundary`);let t=d.get(e.id);t?((t.label.text!==e.label.text||t.label.type!==e.label.type)&&_(`Boundary '${e.id}' has conflicting titles`,e.span,t.span),F(t.classes,e.classes)):(d.set(e.id,{...e,classes:[...e.classes],members:[]}),x(e,`boundary`))},O=e=>{e.classed&&!e.declares&&g(`Relationship endpoint '${e.id}' uses ::: without declaring the node`,e.span);let t=l.get(e.id);return t?t.kind:(u.set(e.id,{...e,kind:`usecase`,shape:`ellipse`,classes:[]}),x(e,`usecase`),y(e.id,e.span[0]),`usecase`)},k=(e,t)=>{let n=l.get(e)?.kind;return(n===`actor`?o.get(e):n===`usecase`?s.get(e):n===`boundary`?c.get(e):n===`json`?a.jsonNodes.get(e):f.get(e))??g(`Class/style target '${e}' is unresolved or anonymous`,t)},A=[];for(let{source:e,target:n}of t.relationships)y(e.id,e.span[0]),y(n.id,n.span[0]);for(let e of t.elements)y(e.id,e.span[0]),A.push({offset:e.span[0],run:()=>E(e)});for(let e of t.boundaries)y(e.id,e.span[0]),A.push({offset:e.span[0],run:()=>D(e)});for(let e of t.jsons)y(e.id,e.span[0]),A.push({offset:e.span[0],run:()=>te(e.id,`json`,e.span)});for(let{id:e,idSpan:n}of t.relationships)e&&n&&A.push({offset:n[0],run:()=>te(e,`edge`,n)});A.sort((e,t)=>e.offset-t.offset);for(let e of A)e.run();for(let e of b(u.values()))T(e);for(let e of b(d.values()))c.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:`rect`,members:[],classes:[],styles:[]});for(let e of b(t.jsons))a.jsonNodes.set(e.id,{id:e.id,value:e.value,propertyOrder:e.propertyOrder,classes:[...e.classes],styles:[]});let j=0;for(let e of t.relationships){let{source:t,target:n,type:r}=e,i=O(t),o=O(n),s=e=>e===`actor`||e===`usecase`||e===`json`;s(i)||_(`Relationship source '${t.id}' cannot be ${i}`,t.span,l.get(t.id).span),s(o)||_(`Relationship target '${n.id}' cannot be ${o}`,n.span,l.get(n.id).span),r!==`include`&&r!==`extend`||i===`usecase`&&o===`usecase`||g(`${r} relationship requires use-case endpoints`,e.span),r===`generalization`&&(i===`json`||i!==o)&&g(`Generalization requires actor-to-actor or use-case-to-use-case endpoints`,e.span),r===`association`&&(i===`json`||o===`json`)&&e.arrowType>2&&g(`JSON relationship '${t.id}' to '${n.id}' permits only point, reversed-point, or markerless solid association`,e.span);let c=e.id??`edge-${j++}`,u={id:c,explicitId:!!e.id,source:t.id,target:n.id,type:r,arrowType:e.arrowType,minlen:e.minlen,classes:[],styles:[],animate:!1};e.label&&(u.label=e.label.text,u.labelType=e.label.type),a.relationships.push(u),f.set(c,u)}let M=new Map(o),N=new Map(s);o.clear(),s.clear();for(let e of b(u.values())){let t=M.get(e.id),n=N.get(e.id);t?o.set(e.id,t):n?s.set(e.id,n):T(e)}for(let{target:e,span:n,properties:r,statement:i}of t.metadata){let t=l.get(e);if(!t){let t=ue(r);return g(`Metadata target '${e}' is unresolved${t?` (metadata implies ${t})`:``}`,n)}let a=t.kind;a===`actor`||a===`usecase`?w(u.get(e),r,!0):a===`edge`&&(i.kind=`edgeMetadata`,i.edges=[{id:e,span:i.span,idSpan:n,metadata:i.metadata}],delete i.nodes);let o=d.get(e),s=f.get(e);for(let t of a===`actor`||a===`usecase`?[]:r){let{key:n,value:r}=t;a===`boundary`&&o&&n===`type`&&(r===`rect`||r===`package`)?o.type=r:a===`edge`&&s&&n===`animate`&&typeof r==`boolean`?s.animate=r:a===`edge`&&s&&n===`animation`&&(r===`fast`||r===`slow`)?(s.animation=r,s.animate=!0):v(e,a,t)}}for(let e of a.relationships)e.animation&&(e.animate=!0);for(let e of u.values())e.kind===`actor`?(e.icon&&e.actorType&&e.actorType!==`normal`&&g(`Actor '${e.id}' cannot combine icon with type '${e.actorType}'`,e.span),e.business&&(e.icon||e.actorType===`awesome`)&&g(`Business actor '${e.id}' must use normal or hollow geometry`,e.span)):e.shape===`rect`&&e.business&&g(`Rectangular use case '${e.id}' cannot be a business use case`,e.span),T(e);for(let e of[...t.elements].sort((e,t)=>e.span[0]-t.span[0])){if(!e.parent?.id)continue;let t=d.get(e.parent.id).members;t.includes(e.id)||t.push(e.id)}for(let e of d.values()){let t=c.get(e.id);t.type=e.type??`rect`,t.members=e.members,t.classes=[...e.classes]}let ne=0;for(let e of t.notes){let t=l.get(e.target);if(!t)return g(`Note target '${e.target}' is unresolved`,e.span);t.kind!==`actor`&&t.kind!==`usecase`&&_(`Note target '${e.target}' must be an actor or use case, not ${t.kind}`,e.span,t.span);let n=`note-${ne++}`;a.notes.set(n,{id:n,target:e.target,label:e.label.text,labelType:e.label.type})}for(let e of t.classDefs)for(let t of e.ids)a.classDefs.set(t,{id:t,styles:[...e.styles]});for(let e of t.classes)for(let t of e.targets)F(k(t.id,t.span).classes,e.classes);for(let e of t.styles)k(e.target,e.span).styles.push(...e.styles);return a.direction=t.direction??a.direction,a.title=i,a.accTitle=t.accTitle,a.accDescription=t.accDescription,a.accDescr=t.accDescription.replace(/\n\s+/g,`
1
+ import{_ as e,f as t,g as n,h as r,l as i,n as a,o,r as s,s as c,t as l,y as u}from"./77XECAW3-_XJOQitm.js";import{a as d,i as f,l as p,s as m}from"./N3JZAHOW-Bp1sdK_N.js";import{a as h,t as g}from"./DKTLEL5E-DciMwFJ1.js";import{r as _}from"./74OO7NKP-BZ5SCLUX.js";import{i as v,n as y,r as b,t as x}from"./NUIALGQ3-D427dlgt.js";import{t as ee}from"./TSHNXIZL-pUPHV4Qd.js";import{PeleError as S,_ as te,c as C,l as w,o as T,s as E}from"./lazy--Qcevr63.js";var D=`EOF USECASE ACTOR SYSTEM_BOUNDARY END DIRECTION TD TB BT LR RL NOTE FOR JSON CLASS_DEF CLASS STYLE INCLUDE EXTEND TRUE FALSE IDENTIFIER NUMBER AT COMMA COLON HASH_COLOR CSS_IDENTIFIER CSS_ESCAPED_COMMA DASH DOT PERCENT CSS_PUNCTUATION LABEL_PUNCTUATION LABEL_SYMBOL PLAIN_STRING MARKDOWN_STRING UNCLOSED_MARKDOWN_STRING COMMENT NEWLINE ACC_DESCR_BLOCK ACC_TITLE_LINE ACC_DESCR_LINE JSON_DECLARATION_START JSON_OBJECT_LITERAL UNCLOSED_JSON_OBJECT_LITERAL GENERALIZATION DEPENDENCY_ARROW STEREOTYPE_START STEREOTYPE_END STEREOTYPE_TEXT UNCLOSED_STEREOTYPE_TEXT CLASS_SEPARATOR FORWARD_SOLID BACKWARD_SOLID FORWARD_CIRCLE BACKWARD_CIRCLE FORWARD_CROSS BACKWARD_CROSS MARKERLESS_SOLID METADATA_START LBRACE RBRACE LBRACKET RBRACKET LPAREN RPAREN`.split(` `),O=1,k=2,A=new Uint8Array(128);for(let e=48;e<=57;e++)A[e]=O;for(let e=65;e<=90;e++)A[e]=A[e+32]=O;A[95]=O;for(let e of`!#$&*+/=?^|~`)A[e.charCodeAt(0)]=k;var j=[0,12,5,14,3,9,2,2,2,2,2,4,3,4,8,5,5,7,6,4,5];function M(e){return e<128&&(A[e]&O)!==0}function N(e,t,n){for(let r=0;r<n.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function ne(e,t,n){switch(n){case 97:return e.startsWith(`actor`,t)?2:0;case 115:return e.startsWith(`systemBoundary`,t)?3:e.startsWith(`style`,t)?16:0;case 101:return e.startsWith(`end`,t)?4:N(e,t,`extend`)?18:0;case 69:return N(e,t,`extend`)?18:0;case 100:return e.startsWith(`direction`,t)?5:0;case 84:return e.startsWith(`TD`,t)?6:e.startsWith(`TB`,t)?7:0;case 66:return e.startsWith(`BT`,t)?8:0;case 76:return e.startsWith(`LR`,t)?9:0;case 82:return e.startsWith(`RL`,t)?10:0;case 110:return e.startsWith(`note`,t)?11:0;case 102:return e.startsWith(`for`,t)?12:e.startsWith(`false`,t)?20:0;case 106:return e.startsWith(`json`,t)?13:0;case 99:return e.startsWith(`classDef`,t)?14:e.startsWith(`class`,t)?15:0;case 105:case 73:return N(e,t,`include`)?17:0;case 116:return e.startsWith(`true`,t)?19:0;case 117:return+!!e.startsWith(`usecase-beta`,t);default:return 0}}function P(e,t){let n=1,r=0;for(let i=0;i<t;i++){let a=e.charCodeAt(i);a!==10&&a!==13||(a===13&&i+1<t&&e.charCodeAt(i+1)===10&&i++,n++,r=i+1)}return[n,t-r+1]}function re(e,t,n){let[r,i]=P(e,t);return`line ${r}, column ${i} [${t},${n})`}function ie(e,t,n){for(let r=t+1;r<e.length;r++){let t=e.charCodeAt(r);if(t===n)return r+1;if(t===10||t===13)return-1}return-1}function ae(e,t){let n=e.charCodeAt(t);return n!==34&&n!==39||n===34&&e.charCodeAt(t+1)===96||ie(e,t,n)!==-1}function oe(e,t,n){let[r,i]=P(e,t);return new S(`Error lexing usecase diagram: unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters. at line ${r}, column ${i} [${t},${t+n})`,`syntax`,{type:`usecase`,line:r,column:i})}function se(e){let t=[],n=[],r=[],i=e.length,a=0,o=!0,s=!1;for(;a<i;){let c=e.charCodeAt(a);if(c===32||c===9){a++;continue}let l,u=a+1,d=!1;if(c<128&&(A[c]&O)!==0){if(l=0,c===97&&o&&e.startsWith(`acc`,a)){let t=e.startsWith(`Descr`,a+3);if(t||e.startsWith(`Title`,a+3)){let n=a+8;for(;T(e.charCodeAt(n));)n++;let r=e.charCodeAt(n);if(r===58)for(l=t?42:41,u=n+1;u<i&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;else if(r===123&&t&&!s){let t=e.indexOf(`}`,n+1);t===-1?s=!0:(l=40,u=t+1)}}}else if(c===106&&e.startsWith(`json`,a)&&T(e.charCodeAt(a+4))){let s=a+5;for(;T(e.charCodeAt(s));)s++;let c=s;for(;M(e.charCodeAt(s));)s++;if(s>c){for(;T(e.charCodeAt(s));)s++;if(e.charCodeAt(s)===64){for(s++;T(e.charCodeAt(s));)s++;if(e.charCodeAt(s)===123){t.push(43),n.push(a),r.push(s),a=s;let c=0,l=!1,u=!1,d=s;for(;d<i;d++){let t=e.charCodeAt(d);if(l)u?u=!1:t===92?u=!0:t===34&&(l=!1);else if(t===34)l=!0;else if(t===123)c++;else if(t===125&&--c===0)break}t.push(d<i?44:45),n.push(s),a=d<i?d+1:i,r.push(a),o=!1;continue}}}}if(l===0){for(;u<i&&M(e.charCodeAt(u));)u++;let t=ne(e,a,c);if(t!==0)t===1||u-a===j[t]?(l=t,u=a+j[t]):l=21;else if((c===111||c===120)&&e.charCodeAt(a+1)===45&&e.charCodeAt(a+2)===45)l=c===111?56:58,u=a+3;else if(E(c)){let t=a+1;for(;E(e.charCodeAt(t));)t++;if(e.charCodeAt(t)===46&&E(e.charCodeAt(t+1))){for(l=22,u=t+2;E(e.charCodeAt(u));)u++;for(;C(e.charCodeAt(u));)u++}else l=21}else for(l=21;e.charCodeAt(u)===45&&M(e.charCodeAt(u+1));)for(l=27,u+=2;M(e.charCodeAt(u));)u++}}else if(c===10)l=39,d=!0;else if(c===13)l=39,d=!0,e.charCodeAt(u)===10&&u++;else if(c===34||c===39){if(c===34&&e.charCodeAt(a+1)===96){let t=e.indexOf('`"',a+2);l=t===-1?37:36,u=t===-1?i:t+2}else if(l=35,u=ie(e,a,c),u===-1){let t=a+1;for(;t<i&&!ae(e,t);)t++;throw oe(e,a,t-a)}}else if(c===37){if(o&&e.charCodeAt(u)===37)for(l=38;u<i&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;else l=31}else if(c===45){if(e.charCodeAt(u)!==45)l=29;else{for(;e.charCodeAt(u)===45;)u++;let t=e.charCodeAt(u),n=u-a===2;n&&t===124&&e.charCodeAt(u+1)===62?(l=46,u+=2):t===62?(l=53,u++):n&&(t===111||t===120)?(l=t===111?55:57,u++):l=59}}else if(c===46){let t=e.charCodeAt(u);if(t===46&&e.charCodeAt(u+1)===62)l=47,u+=2;else if(E(t)){for(l=22;E(e.charCodeAt(u));)u++;for(;C(e.charCodeAt(u));)u++}else l=30}else if(c===60){if(e.charCodeAt(u)===60){if(t.push(48),n.push(a),r.push(a+2),o=!1,a+=2,a>=i)break;if(e.charCodeAt(a)===62&&e.charCodeAt(a+1)===62)l=49,u=a+2;else{let o=a,s=!1;for(;o<i;o++){let t=e.charCodeAt(o);if(t===10||t===13)break;if(t===62&&e.charCodeAt(o+1)===62){s=!0;break}}if(s&&e.slice(a,o).trim()!==``)t.push(50),n.push(a),r.push(o),l=49,a=o,u=o+2;else{for(;o<i&&e.charCodeAt(o)!==10&&e.charCodeAt(o)!==13;)o++;if(o===a){for(;o<i&&(e.charCodeAt(o)===10||e.charCodeAt(o)===13);)o++;throw oe(e,a,o-a)}l=51,u=o}}}else if(e.charCodeAt(u)===45&&e.charCodeAt(u+1)===45)for(l=54,u+=2;e.charCodeAt(u)===45;)u++;else l=33}else if(c===58)e.charCodeAt(u)===58&&e.charCodeAt(u+1)===58?(l=52,u+=2):l=25;else if(c===64)e.charCodeAt(u)===123?(l=60,u++):l=23;else if(c===123)l=61;else if(c===125)l=62;else if(c===91)l=63;else if(c===93)l=64;else if(c===40)l=65;else if(c===41)l=66;else if(c===44)l=24;else if(c===35){for(;w(e.charCodeAt(u));)u++;l=u>a+1?26:32}else if(c===92)e.charCodeAt(u)===44?(l=28,u++):l=33;else if(c<127&&c>32)l=(A[c]&k)===0?33:32;else for(l=34;u<i;){let t=e.charCodeAt(u);if(t>=32&&t<127||t===9||t===10||t===13)break;u++}t.push(l),n.push(a),r.push(u),a=u,o=d}for(let e=0;e<3;e++)t.push(0),n.push(i),r.push(i);return{types:t,starts:n,ends:r}}function ce(){return{type:`usecase`,actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,direction:`LR`,title:void 0,accTitle:``,accDescr:``,accDescription:``,source:``,headerSpan:[0,0],statements:[]}}function le(){return{elements:[],boundaries:[],jsons:[],relationships:[],notes:[],metadata:[],classes:[],styles:[],classDefs:[],direction:void 0,accTitle:``,accDescription:``}}function F(e,t){if(t.length===0)return;let n=new Set(e);for(let r of t)n.has(r)||(n.add(r),e.push(r))}function ue(e){let t=new Set([`actor`,`usecase`,`boundary`,`edge`]);for(let{key:n,value:r}of e)if(n===`icon`)t.clear(),t.add(`actor`);else if(n===`animate`||n===`animation`)t.clear(),t.add(`edge`);else if(n===`type`)t.clear(),r===`rect`||r===`package`?t.add(`boundary`):(r===`normal`||r===`hollow`||r===`awesome`)&&t.add(`actor`);else if(n===`business`)t.delete(`boundary`),t.delete(`edge`);else return;return t.size===1?[...t][0]:void 0}function de(e,t,n,r,i){let a=ce(),{actors:o,useCases:s,systemBoundaries:c}=a,l=new Map,u=new Map,d=new Map,f=new Map,p=new Map,m=t=>re(e,t[0],t[1]),h=(t,n)=>{let[r,i]=P(e,n[0]);return new S(t,`semantic`,{type:`usecase`,line:r,column:i})},g=(e,t)=>{throw h(`${e} at ${m(t)}`,t)},_=(e,t,n,r,i)=>{let a=e=>e===void 0?``:` (label "${e}")`;throw h(`${e} at ${m(t)}${a(r)}; previous declaration at ${m(n)}${a(i)}`,t)},v=(e,t,n)=>g(`Metadata property '${n.key}' is invalid for ${t} '${e}'`,n.keySpan),y=(e,t)=>{let n=p.get(e);(n===void 0||t<n)&&p.set(e,t)},b=e=>[...e].sort((e,t)=>(p.get(e.id)??0)-(p.get(t.id)??0)),x=(e,t)=>{l.set(e.id,{kind:t,span:e.span,generated:e.generated,label:e.label.text})},ee=(e,t)=>{let n=l.get(e.id);if(!n)return;let r=e.generated?e.label.text:void 0,i=n.generated?n.label:void 0;n.kind!==t&&_(`ID '${e.id}' is declared as both ${n.kind} and ${t}`,e.span,n.span,r,i),(n.generated||e.generated)&&_(`Generated ID '${e.id}' collides with another declaration`,e.span,n.span,r,i)},te=(e,t,n)=>{let r=l.get(e);r&&_(`ID '${e}' is declared more than once (${r.kind} and ${t})`,n,r.span,void 0,r.generated?r.label:void 0),l.set(e,{kind:t,span:n,generated:!1})},C=(e,t,n)=>{let{key:r,value:i}=t,a=a=>{!n&&a!==void 0&&a!==i&&_(`Actor '${e.id}' has conflicting ${r} metadata`,t.keySpan,e.span)};r===`type`&&(i===`normal`||i===`hollow`||i===`awesome`)?(a(e.actorType),e.actorType=i):r===`icon`&&typeof i==`string`?(a(e.icon),e.icon=i):r===`business`&&typeof i==`boolean`?(a(e.business),e.business=i):v(e.id,`actor`,t)},w=(e,t,n)=>{for(let r of t??[])e.kind===`actor`?C(e,r,n):r.key===`business`&&typeof r.value==`boolean`?(!n&&e.business!==void 0&&e.business!==r.value&&_(`Use case '${e.id}' has conflicting business metadata`,r.keySpan,e.span),e.business=r.value):v(e.id,`usecase`,r)},T=e=>{let t;if(e.kind===`actor`){s.delete(e.id);let n={id:e.id,label:e.label.text,labelType:e.label.type,business:e.business??!1,classes:[...e.classes],type:e.icon?`icon`:e.actorType??`normal`,styles:o.get(e.id)?.styles??[]};e.icon&&(n.icon=e.icon),o.set(e.id,n),t=n}else o.delete(e.id),t={id:e.id,label:e.label.text,labelType:e.label.type,business:e.business??!1,classes:[...e.classes],shape:e.shape??`ellipse`,styles:s.get(e.id)?.styles??[]},s.set(e.id,t);e.stereotype&&(t.stereotype=e.stereotype),e.parent?.id&&(t.parentId=e.parent.id)},E=e=>{ee(e,e.kind);let t=e.parent?.id?e.parent:void 0,n=u.get(e.id);if(n)(n.label.text!==e.label.text||n.label.type!==e.label.type)&&_(`ID '${e.id}' has conflicting labels`,e.span,n.span),e.shape&&n.shape&&e.shape!==n.shape&&_(`Use case '${e.id}' has conflicting shapes`,e.span,n.span),t&&n.parent?.id&&t.id!==n.parent.id&&_(`Element '${e.id}' belongs to more than one system boundary`,t.span,n.parent.span),e.stereotype&&n.stereotype&&e.stereotype!==n.stereotype&&_(`Element '${e.id}' has conflicting stereotypes`,e.span,n.stereotypeSpan??n.span),n.shape??=e.shape,n.parent??=e.parent,n.stereotype??=e.stereotype,n.stereotypeSpan??=e.stereotype?e.span:void 0,F(n.classes,e.classes),w(n,e.metadata,!1);else{let n={kind:e.kind,id:e.id,label:e.label,span:e.span,generated:e.generated,classes:[...e.classes],parent:t,shape:e.shape,stereotype:e.stereotype,stereotypeSpan:e.stereotype?e.span:void 0};w(n,e.metadata,!1),u.set(e.id,n),x(e,e.kind)}},D=e=>{ee(e,`boundary`);let t=d.get(e.id);t?((t.label.text!==e.label.text||t.label.type!==e.label.type)&&_(`Boundary '${e.id}' has conflicting titles`,e.span,t.span),F(t.classes,e.classes)):(d.set(e.id,{...e,classes:[...e.classes],members:[]}),x(e,`boundary`))},O=e=>{e.classed&&!e.declares&&g(`Relationship endpoint '${e.id}' uses ::: without declaring the node`,e.span);let t=l.get(e.id);return t?t.kind:(u.set(e.id,{...e,kind:`usecase`,shape:`ellipse`,classes:[]}),x(e,`usecase`),y(e.id,e.span[0]),`usecase`)},k=(e,t)=>{let n=l.get(e)?.kind;return(n===`actor`?o.get(e):n===`usecase`?s.get(e):n===`boundary`?c.get(e):n===`json`?a.jsonNodes.get(e):f.get(e))??g(`Class/style target '${e}' is unresolved or anonymous`,t)},A=[];for(let{source:e,target:n}of t.relationships)y(e.id,e.span[0]),y(n.id,n.span[0]);for(let e of t.elements)y(e.id,e.span[0]),A.push({offset:e.span[0],run:()=>E(e)});for(let e of t.boundaries)y(e.id,e.span[0]),A.push({offset:e.span[0],run:()=>D(e)});for(let e of t.jsons)y(e.id,e.span[0]),A.push({offset:e.span[0],run:()=>te(e.id,`json`,e.span)});for(let{id:e,idSpan:n}of t.relationships)e&&n&&A.push({offset:n[0],run:()=>te(e,`edge`,n)});A.sort((e,t)=>e.offset-t.offset);for(let e of A)e.run();for(let e of b(u.values()))T(e);for(let e of b(d.values()))c.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:`rect`,members:[],classes:[],styles:[]});for(let e of b(t.jsons))a.jsonNodes.set(e.id,{id:e.id,value:e.value,propertyOrder:e.propertyOrder,classes:[...e.classes],styles:[]});let j=0;for(let e of t.relationships){let{source:t,target:n,type:r}=e,i=O(t),o=O(n),s=e=>e===`actor`||e===`usecase`||e===`json`;s(i)||_(`Relationship source '${t.id}' cannot be ${i}`,t.span,l.get(t.id).span),s(o)||_(`Relationship target '${n.id}' cannot be ${o}`,n.span,l.get(n.id).span),r!==`include`&&r!==`extend`||i===`usecase`&&o===`usecase`||g(`${r} relationship requires use-case endpoints`,e.span),r===`generalization`&&(i===`json`||i!==o)&&g(`Generalization requires actor-to-actor or use-case-to-use-case endpoints`,e.span),r===`association`&&(i===`json`||o===`json`)&&e.arrowType>2&&g(`JSON relationship '${t.id}' to '${n.id}' permits only point, reversed-point, or markerless solid association`,e.span);let c=e.id??`edge-${j++}`,u={id:c,explicitId:!!e.id,source:t.id,target:n.id,type:r,arrowType:e.arrowType,minlen:e.minlen,classes:[],styles:[],animate:!1};e.label&&(u.label=e.label.text,u.labelType=e.label.type),a.relationships.push(u),f.set(c,u)}let M=new Map(o),N=new Map(s);o.clear(),s.clear();for(let e of b(u.values())){let t=M.get(e.id),n=N.get(e.id);t?o.set(e.id,t):n?s.set(e.id,n):T(e)}for(let{target:e,span:n,properties:r,statement:i}of t.metadata){let t=l.get(e);if(!t){let t=ue(r);return g(`Metadata target '${e}' is unresolved${t?` (metadata implies ${t})`:``}`,n)}let a=t.kind;a===`actor`||a===`usecase`?w(u.get(e),r,!0):a===`edge`&&(i.kind=`edgeMetadata`,i.edges=[{id:e,span:i.span,idSpan:n,metadata:i.metadata}],delete i.nodes);let o=d.get(e),s=f.get(e);for(let t of a===`actor`||a===`usecase`?[]:r){let{key:n,value:r}=t;a===`boundary`&&o&&n===`type`&&(r===`rect`||r===`package`)?o.type=r:a===`edge`&&s&&n===`animate`&&typeof r==`boolean`?s.animate=r:a===`edge`&&s&&n===`animation`&&(r===`fast`||r===`slow`)?(s.animation=r,s.animate=!0):v(e,a,t)}}for(let e of a.relationships)e.animation&&(e.animate=!0);for(let e of u.values())e.kind===`actor`?(e.icon&&e.actorType&&e.actorType!==`normal`&&g(`Actor '${e.id}' cannot combine icon with type '${e.actorType}'`,e.span),e.business&&(e.icon||e.actorType===`awesome`)&&g(`Business actor '${e.id}' must use normal or hollow geometry`,e.span)):e.shape===`rect`&&e.business&&g(`Rectangular use case '${e.id}' cannot be a business use case`,e.span),T(e);for(let e of[...t.elements].sort((e,t)=>e.span[0]-t.span[0])){if(!e.parent?.id)continue;let t=d.get(e.parent.id).members;t.includes(e.id)||t.push(e.id)}for(let e of d.values()){let t=c.get(e.id);t.type=e.type??`rect`,t.members=e.members,t.classes=[...e.classes]}let ne=0;for(let e of t.notes){let t=l.get(e.target);if(!t)return g(`Note target '${e.target}' is unresolved`,e.span);t.kind!==`actor`&&t.kind!==`usecase`&&_(`Note target '${e.target}' must be an actor or use case, not ${t.kind}`,e.span,t.span);let n=`note-${ne++}`;a.notes.set(n,{id:n,target:e.target,label:e.label.text,labelType:e.label.type})}for(let e of t.classDefs)for(let t of e.ids)a.classDefs.set(t,{id:t,styles:[...e.styles]});for(let e of t.classes)for(let t of e.targets)F(k(t.id,t.span).classes,e.classes);for(let e of t.styles)k(e.target,e.span).styles.push(...e.styles);return a.direction=t.direction??a.direction,a.title=i,a.accTitle=t.accTitle,a.accDescription=t.accDescription,a.accDescr=t.accDescription.replace(/\n\s+/g,`
2
2
  `),a.source=e,a.headerSpan=n,a.statements=r,a}var I=class extends Error{constructor(e){super(`Invalid JSON token`),this.offset=e}offset};function fe(e){let t=new Map,n=[],r=[],i=e.length,a=0,o=``,s=0,c=()=>{for(;a<i;){let t=e.charCodeAt(a);if(t!==32&&t!==9&&t!==10&&t!==13)return;a++}},l=t=>{a++;let n=``;for(;a<i;){let r=a,i=e[a++];if(i===`"`)return n;if(i.charCodeAt(0)<32)throw new I(r);if(i!==`\\`){t&&(n+=i);continue}let o=a,s=e[a++],c;if(s===`"`||s===`\\`||s===`/`)c=s;else if(s===`b`)c=`\b`;else if(s===`f`)c=`\f`;else if(s===`n`)c=`
3
3
  `;else if(s===`r`)c=`\r`;else if(s===`t`)c=` `;else if(s===`u`){let t=e.slice(a,a+4);if(!/^[\dA-Fa-f]{4}$/.test(t))throw new I(a);c=String.fromCharCode(parseInt(t,16)),a+=4}else throw new I(o);t&&(n+=c)}throw new I(a)},u=t=>{for(let n=0;n<t.length;n++)if(e[a+n]!==t[n])throw new I(a+n);a+=t.length},d=()=>{if(e.charCodeAt(a)===45&&a++,e.charCodeAt(a)===48)a++;else if(E(e.charCodeAt(a)))for(;E(e.charCodeAt(a));)a++;else throw new I(a);if(e.charCodeAt(a)===46){if(a++,!E(e.charCodeAt(a)))throw new I(a);for(;E(e.charCodeAt(a));)a++}if((e.charCodeAt(a)|32)==101){if(a++,(e.charCodeAt(a)===43||e.charCodeAt(a)===45)&&a++,!E(e.charCodeAt(a)))throw new I(a);for(;E(e.charCodeAt(a));)a++}};for(c();;)if(s===0){c();let i=e.charCodeAt(a);if(s=2,i===123){a++;let i=[];t.set(o,i),n.push(o),c(),e.charCodeAt(a)===125?a++:(r.push({object:!0,pointer:o,keys:i,ranges:new Map,key:``,from:0,index:0}),s=1)}else if(i===91)a++,c(),e.charCodeAt(a)===93?a++:(r.push({object:!1,pointer:o,keys:[],ranges:new Map,key:``,from:0,index:0}),o+=`/0`,s=0);else if(i===34)l(!1);else if(i===116)u(`true`);else if(i===102)u(`false`);else if(i===110)u(`null`);else if(i===45||E(i))d();else throw new I(a)}else if(s===1){let i=r[r.length-1];if(e.charCodeAt(a)!==34)throw new I(a);let u=l(!0),d=i.ranges.get(u);if(d===void 0)i.keys.push(u);else for(let e=d[0];e<d[1];e++)t.delete(n[e]);if(i.key=u,i.from=n.length,c(),e.charCodeAt(a)!==58)throw new I(a);a++,o=`${i.pointer}/${u.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`,s=0}else{let t=r[r.length-1];if(t===void 0)break;t.object?t.ranges.set(t.key,[t.from,n.length]):t.index++,c();let i=e.charCodeAt(a);if(i===(t.object?125:93))a++,r.pop();else{if(i!==44)throw new I(a);a++,c(),o=`${t.pointer}/${t.index}`,s=+!!t.object}}if(c(),a!==i)throw new I(a);return t}function pe(e,t,n,r){let i=Math.min(Math.max(t,0),e.length);for(let t=0;t<i;t++){let i=e.charCodeAt(t);i===13?(n++,r=1):i===10?(t===0||e.charCodeAt(t-1)!==13)&&(n++,r=1):r++}return[n,r]}function me(e,t,n,r){let i=/\bposition (\d+)\b/.exec(e);if(i)return pe(t,parseInt(i[1],10),n,r);let a=/\bline (\d+) column (\d+)\b/.exec(e);if(a){let e=parseInt(a[1],10),t=parseInt(a[2],10);return[n+e-1,e===1?r+t-1:t]}if(/unexpected end|end of json input/i.test(e))return pe(t,t.length,n,r)}function he(e,t,n){return new S(`${e} (line ${t}, column ${n})`,`syntax`,{type:`usecase`,line:t,column:n})}function ge(e,t){let n;try{n=JSON.parse(e)}catch(n){let r=n instanceof Error?n.message:String(n),[i,a]=t(),o=me(r,e,i,a);if(!o){let t=0;try{fe(e)}catch(e){e instanceof I&&(t=e.offset)}o=pe(e,t,i,a)}throw he(`Invalid JSON: ${r}`,o[0],o[1])}if(typeof n!=`object`||!n||Array.isArray(n)){let[e,n]=t();throw he(`JSON value must have an object root`,e,n)}return{value:n,propertyOrder:fe(e)}}var _e=1,ve=2,ye=4,be=8,xe=16,Se=32,Ce=64,we=`DEPENDENCY_ARROW|GENERALIZATION|FORWARD_SOLID|BACKWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|BACKWARD_CIRCLE|FORWARD_CROSS|BACKWARD_CROSS`,Te=`IDENTIFIER|PLAIN_STRING|MARKDOWN_STRING`,Ee=`PLAIN_STRING|MARKDOWN_STRING|LABEL_TEXT`,De=`ACC_TITLE_LINE|ACC_DESCR_LINE|ACC_DESCR_BLOCK|DIRECTION|ACTOR|SYSTEM_BOUNDARY|NOTE|JSON_DECLARATION_START|CLASS_DEF|CLASS|STYLE`,Oe=`WORD|PLAIN_STRING|NUMBER|HASH_COLOR|CSS_IDENTIFIER|CSS_ESCAPED_COMMA|DASH|DOT|PERCENT|CSS_PUNCTUATION|COLON|LPAREN|RPAREN|LBRACKET|RBRACKET|LBRACE|RBRACE|AT|MARKERLESS_SOLID`,L=new Uint8Array(67);function R(e,t){for(let n of e.split(`|`))if(n===`WORD`)for(let e=1;e<=21;e++)L[e]|=t;else L[D.indexOf(n)]|=t}R(`NEWLINE|COMMENT|${De}|${Te}`,_e),R(`IDENTIFIER|${we}`,ve),R(Oe,ye),R(`STEREOTYPE_START|CLASS_SEPARATOR|IDENTIFIER|${we}|NEWLINE|EOF`,be),R(`NEWLINE|COMMENT|ACTOR|${Te}`,xe),R(`FORWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|FORWARD_CROSS`,Se),R(`NEWLINE|IDENTIFIER|PLAIN_STRING|RBRACE`,Ce);var ke=new Set([`allowmixing`,`newpage`,`package`,`rectangle`,`skinparam`]),z=``,B=[],V=[],H=[],U=0,Ae=0,W,je,Me=[],Ne=0,Pe=0;function G(e){return z.slice(V[e],H[e])}function K(e){return[V[e],H[e]]}function Fe(e){let[t,n]=P(z,V[U]);throw new S(`Error parsing usecase diagram: ${e} at line ${t}, column ${n} [${V[U]},${H[U]})`,`syntax`,{type:`usecase`,line:t,column:n})}function Ie(e){Fe(`Expecting token of type --> ${e} <-- but found --> '${G(U)}' <--`)}function q(e){return B[U]!==e&&Ie(D[e]),U++}function J(e){Fe(`Expecting: one of these possible Token sequences:
4
4
  ${e.split(`|`).map((e,t)=>` ${t+1}. [${e}]`).join(`
@@ -6,4 +6,4 @@ ${e.split(`|`).map((e,t)=>` ${t+1}. [${e}]`).join(`
6
6
  but found: '${G(U)}'`)}function Le(){let e=Te.split(`|`),t=e.flatMap(e=>[`NEWLINE`,`IDENTIFIER`,`PLAIN_STRING`,`RBRACE`].map(t=>`${e}, METADATA_START, ${t}`)),n=`STEREOTYPE_START|CLASS_SEPARATOR|IDENTIFIER|${we}|NEWLINE|EOF`.split(`|`),r=e.flatMap((e,t)=>(t===0?[`LPAREN`,`LBRACKET`,...n]:n).map(t=>`${e}, ${t}`));return[De,...t,...r,...t].join(`|`)}function Re(e){return e>=1&&e<=21}function ze(e){return e>=1&&e<=34}function Y(){Ae=H[U-1],B[U]===39?U++:B[U]!==0&&J(`NEWLINE|EOF`)}function X(e){let t=B[e]===36?2:+(B[e]===35);return[V[e]+t,H[e]-t]}function Be(e){let t=X(e);return{text:z.slice(t[0],t[1]),type:B[e]===36?`markdown`:`text`,span:t}}function Ve(e){return e.replace(/\W/g,`_`)}function He(){let e=B[U];if(e===35||e===36)return Be(U++);ze(e)||J(Ee);let t=U;for(;ze(B[U]);)U++;let n=[V[t],H[U-1]];return{text:z.slice(n[0],n[1]),type:`text`,span:n}}function Z(e){return e===21||e===35}function Ue(){let e=U;Z(B[U])||J(`IDENTIFIER|PLAIN_STRING`),U++,q(25);let t=U,n=B[U];!Z(n)&&n!==19&&n!==20&&J(`IDENTIFIER|PLAIN_STRING|TRUE|FALSE`),U++;let r=X(e),i=X(t);return{key:z.slice(r[0],r[1]),value:n===19||n!==20&&z.slice(i[0],i[1]),span:[V[e],H[t]],keySpan:r,valueSpan:i}}function We(){let e=B[U],t=B[U+1],n=B[U+2];return e===24?Z(t)||t===39&&(n===39||Z(n)):e===39?t===24||Z(t)||t===39&&(n===39||n===24||Z(n)):!1}function Ge(){q(60);let e=[];for(;B[U]===39;)U++;if(Z(B[U])){for(e.push(Ue());We();){if(B[U]===24)U++;else{for(;B[U]===39;)U++;B[U]===24&&U++}for(;B[U]===39;)U++;e.push(Ue())}for(B[U]===24&&U++;B[U]===39;)U++}return q(62),e}function Ke(e){return e.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))}function qe(e,t){do{U++;let n=q(21);e.push(G(n)),t.push(K(n))}while(B[U]===24)}function Je(e){let t=U,n=B[U],r={id:``,label:void 0,span:X(t),generated:n!==21,classes:[],classSpans:[],explicit:!1,nodeSpan:[0,0]};if(n===21){U++,r.id=G(t);let n=B[U];n===65||e&&n===63?(U++,r.label=He(),q(n===65?66:64),r.shape=n===65?`ellipse`:`rect`):r.label=Be(t)}else n===35||n===36?(U++,r.label=Be(t),r.id=Ve(r.label.text)):J(Te);return r}function Ye(e){let t=U,n=Je(!e);if(e&&(n.shape=void 0),B[U]===60&&(n.metadata=Ge()),B[U]===48){U++;let e=q(50);q(49),n.stereotype=G(e).trim(),n.stereotypeSpan=K(e)}return B[U]===52&&qe(n.classes,n.classSpans),n.explicit=!!(n.shape||n.metadata||n.stereotype),n.nodeSpan=[V[t],H[U-1]],n}function Xe(e,t){return{id:e.id,kind:t,label:e.label,span:e.span,generated:e.generated,parent:je,shape:e.shape,metadata:e.metadata,stereotype:e.stereotype,classes:e.classes}}function Ze(e,t){return{id:e.id,label:e.label,span:e.span,generated:e.generated,declares:t,classed:e.classes.length>0}}function Qe(e,t){let n={id:e.id,span:e.nodeSpan,idSpan:e.span,labelSpan:e.label.span};return t&&(n.defines=!0),e.stereotypeSpan&&(n.stereotypeSpan=e.stereotypeSpan),e.metadata&&(n.metadata=Ke(e.metadata)),e.classSpans.length>0&&(n.classSpans=e.classSpans),n}function $e(e){if(B[U]<1||B[U]>36)return!1;for(let t=U+1;;t++){let n=B[t];if(n===59||(L[n]&e)!==0)return!0;if(n<1||n>36)return!1}}function et(e){let t=H[e]-V[e]-(B[e]===59?0:1);return Math.max(1,t-1)}function tt(){let e=U,t={type:`association`,arrowType:0,minlen:1,target:void 0,span:[0,0]};B[U]===21&&B[U+1]===23&&(t.explicitId=G(U),t.explicitIdSpan=K(U),U+=2);let n=U,r=B[U++];if(r===47)q(25),B[U]!==17&&B[U]!==18&&J(`INCLUDE|EXTEND`),t.type=B[U]===17?`include`:`extend`,t.label={text:t.type,type:`text`,span:K(U)},U++;else if(r===46)t.type=`generalization`;else if(r===53)t.minlen=et(n);else if(r===54)t.arrowType=1,H[n]-V[n]===3&&$e(0)?(t.label=He(),t.minlen=et(q(59))):t.minlen=et(n);else if(r===59){if(t.arrowType=2,H[n]-V[n]===2&&$e(Se)){t.label=He();let e=B[U];e===53?t.arrowType=0:e===55?t.arrowType=3:e===57?t.arrowType=4:e!==59&&J(`FORWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|FORWARD_CROSS`),(t.arrowType===0||t.arrowType===2)&&(t.minlen=et(U)),U++}else t.minlen=et(n)}else r===55?t.arrowType=3:r===57?t.arrowType=4:r===56||r===58?(t.arrowType=r===56?5:6,$e(0)&&(t.label=He(),q(59))):(U--,J(we));return t.target=Ye(!1),t.span=[V[e],H[U-1]],t}function Q(e){return{kind:e,span:[0,0]}}function nt(e,t,n,r){let i=n.target;i.explicit&&W.elements.push(Xe(i,`usecase`)),W.relationships.push({source:Ze(e,t),target:Ze(i,i.explicit),span:n.span,id:n.explicitId,idSpan:n.explicitIdSpan,type:n.type,arrowType:n.arrowType,label:n.label,minlen:n.minlen}),r.push(Qe(i,i.explicit));let a=Q(`edge`);return a.nodes=r,a.edges=[{id:n.explicitId??`edge-${Ne++}`,span:a.span}],n.explicitIdSpan&&(a.edges[0].idSpan=n.explicitIdSpan),n.label&&(a.edges[0].labelSpan=n.label.span),a}function rt(e){let t=Q(`node`);return t.nodes=e,t}function it(e){U++;let t=[Ye(!0)],n;if(B[U]===24)do U++,t.push(Ye(!0));while(B[U]===24);else e&&(L[B[U]]&ve)!==0&&(n=tt());Y();for(let e of t)W.elements.push(Xe(e,`actor`));let r=t.map(e=>Qe(e,!0));return n?nt(t[0],!0,n,r):rt(r)}function at(e){let t=Ye(!1),n=e&&(L[B[U]]&ve)!==0?tt():void 0;Y(),n||(t.explicit=!0,t.shape??=`ellipse`),t.explicit&&W.elements.push(Xe(t,`usecase`));let r=[Qe(t,t.explicit)];return n?nt(t,t.explicit,n,r):rt(r)}function ot(){U++;let e=Je(!0),t={id:e.id,label:e.label,span:e.span,generated:e.generated,classes:e.classes},n=B[U]===60?Ge():void 0;B[U]===52&&qe(e.classes,e.classSpans),Y(),W.boundaries.push(t),je=t;let r=[];for(;(L[B[U]]&xe)!==0;)r.push(ft(!1));je=void 0;let i=q(4);Y();let a=Q(`group`);return a.group=t.id,a.idSpan=t.span,a.titleSpan=t.label.span,a.endSpan=K(i),a.classSpans=e.classSpans,r.length>0&&(a.children=r),n&&(a.metadata=Ke(n),W.metadata.push({target:t.id,span:t.span,properties:n,statement:a})),a}function st(){let e=U,t=B[U];for(Re(t)||t===27?U++:t===59?(U++,Re(B[U])||Ie(`WORD`),U++):J(`WORD|CSS_IDENTIFIER|MARKERLESS_SOLID`),q(25),(L[B[U]]&ye)===0&&Fe(`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::
7
7
  <[${Oe.replaceAll(`|`,`] ,[`)}]>
8
8
  but found: '${G(U)}'`);(L[B[U]]&ye)!==0;)U++;return z.slice(V[e],H[U-1]).replaceAll(`\\,`,`,`)}function ct(){let e=[st()];for(;B[U]===24;)U++,e.push(st());return e}function lt(){let e=[q(21)];for(;B[U]===24;)U++,e.push(q(21));return e}function ut(e){let t=X(e);return{id:G(e),span:t,idSpan:t}}function dt(){let e=U,t=B[U],n;if(t===41||t===42||t===40){U++;let r=G(e);t===40?W.accDescription=r.slice(r.indexOf(`{`)+1,r.lastIndexOf(`}`)).trim():t===42?W.accDescription=r.slice(r.indexOf(`:`)+1).trim():W.accTitle=r.slice(r.indexOf(`:`)+1).trim(),n=Q(t===41?`accTitle`:`accDescr`)}else if(t===5){U++;let e=B[U];(e<6||e>10)&&J(`TD|TB|BT|LR|RL`),W.direction=e===6?`TB`:G(U),U++,n=Q(`direction`)}else{if(t===2)return it(!0);if(t===3)return ot();if(t===11){U++,q(12);let e=q(21),t=He();W.notes.push({target:G(e),span:K(e),label:t}),n=Q(`note`),n.ref=`note-${Pe++}`,n.refSpan=t.span,n.nodes=[ut(e)]}else if(t===43){U++;let t=q(44),r=[],i=[];B[U]===52&&qe(r,i);let a=V[e]+4;for(;z.charCodeAt(a)===32||z.charCodeAt(a)===9;)a++;let o=a;for(;/\w/.test(z.charAt(o));)o++;let s={id:z.slice(a,o),value:{},propertyOrder:new Map,span:[a,o],classes:r};W.jsons.push(s),Me.push([s,t]),n=Q(`json`),n.nodes=[{id:s.id,span:s.span,idSpan:s.span,defines:!0,classSpans:i}],n.classSpans=i}else if(t===14){U++;let e=lt();W.classDefs.push({ids:e.map(G),styles:ct()}),n=Q(`classDef`),n.ref=G(e[0]),n.refSpan=K(e[0])}else if(t===15){U++;let e=lt(),t=lt();W.classes.push({targets:e.map(e=>({id:G(e),span:K(e)})),classes:t.map(G)}),n=Q(`classAssign`),n.ref=G(t[0]),n.refSpan=K(t[0]),n.nodes=e.map(ut)}else if(t===16){U++;let e=q(21);W.styles.push({target:G(e),span:K(e),styles:ct()}),n=Q(`style`),n.nodes=[ut(e)]}else{let r=B[U+1];if(r===60){(L[B[U+2]]&Ce)===0&&J(Le()),U++;let r=ut(e);t!==21&&(r.id=Ve(z.slice(r.span[0],r.span[1])));let i=Ge();n=Q(`metadata`),n.nodes=[r],n.metadata=Ke(i),W.metadata.push({target:r.id,span:r.span,properties:i,statement:n})}else return((L[r]&be)===0&&(t!==21||r!==65&&r!==63)||t===21&&ke.has(G(e).toLowerCase()))&&J(Le()),at(!0)}}return Y(),n}function ft(e){let t=U,n=B[U];if(n===39)return U++,{kind:`blank`,span:K(t)};if(n===38)return U++,Y(),{kind:`comment`,span:K(t)};let r=e?dt():n===2?it(!1):at(!1);if(r.span=[V[t],Ae],r.edges)for(let e of r.edges)e.span=r.span;return r}function pt(e,t){z=e,{types:B,starts:V,ends:H}=se(e),U=0,W=le(),je=void 0,Me=[],Ne=0,Pe=0;try{let n=q(1);Y();let r=[];for(;(L[B[U]]&_e)!==0;)r.push(ft(!0));B[U]!==0&&Fe(`Redundant input, expecting EOF but found: ${G(U)}`);for(let[t,n]of Me){let r=ge(G(n),()=>P(e,V[n]));t.value=r.value,t.propertyOrder=r.propertyOrder}return de(e,W,K(n),r,t)}finally{z=``,B=V=H=Me=[]}}var mt={normal:`usecaseActor`,hollow:`usecaseActorHollow`,awesome:`usecaseActorAwesome`,icon:`usecaseActorIcon`},ht=[[`none`,`arrow_point`],[`arrow_point`,`none`],[`none`,`none`],[`none`,`arrow_circle`],[`none`,`arrow_cross`],[`arrow_circle`,`none`],[`arrow_cross`,`none`]];function gt(e){return typeof e==`string`?e:e===null?`null`:String(e)}function _t(e){let t=[],n=[[e.value,``,``]],r=[];for(;n.length>0;){let[i,a,o]=n.pop();if(r.length=0,Array.isArray(i))i.length===0?t.push({key:a,accessibleKey:a,value:`[]`}):i.every(e=>typeof e!=`object`||!e)?i.forEach((e,n)=>t.push({key:n===0?a:``,accessibleKey:a,value:gt(e)})):i.forEach((e,t)=>r.push([e,`${a}[${t}]`,`${o}/${t}`]));else if(typeof i==`object`&&i){let n=i,s=e.propertyOrder.get(o)??Object.keys(n);s.length===0&&t.push({key:a,accessibleKey:a,value:`{}`});for(let e of s)r.push([Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0,a?`${a}.${e}`:e,`${o}/${e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`])}else t.push({key:a,accessibleKey:a,value:gt(i)});for(let e=r.length-1;e>=0;e--)n.push(r[e])}return t}function vt(...e){return e.filter(Boolean).join(` `)}function yt(e){return e.type===`generalization`?[`none`,`extension`]:e.type===`association`?ht[e.arrowType]??ht[2]:ht[0]}function bt(e){let t=[],n=[],r=t=>{let n=new Map;for(let r of[`default`,...t]){let t=e.classDefs.get(r);if(t)for(let e of t.styles){let t=e.trim(),r=t.indexOf(`:`),i=(r===-1?t:t.slice(0,r)).trim();i&&n.set(i,t)}}return[...n.values()]};for(let n of e.actors.values())t.push({id:n.id,label:n.label,labelType:n.labelType,shape:mt[n.type],isGroup:!1,padding:10,cssClasses:vt(`default`,`usecase-actor`,`usecase-actor-${n.type}`,n.business&&`usecase-business`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),actorType:n.type,business:n.business,icon:n.icon||void 0,stereotype:n.stereotype||void 0,parentId:n.parentId||void 0});for(let n of e.useCases.values()){let e=n.shape===`ellipse`;t.push({id:n.id,label:n.label,labelType:n.labelType,shape:e?n.business?`usecaseBusiness`:`usecaseEllipse`:`rect`,isGroup:!1,padding:e?20:10,cssClasses:vt(`default`,`usecase-element`,`usecase-${n.shape}`,n.business&&`usecase-business`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),business:n.business,stereotype:n.stereotype||void 0,parentId:n.parentId||void 0})}for(let n of e.notes.values())t.push({id:n.id,label:n.label,labelType:n.labelType,shape:`note`,isGroup:!1,padding:10,cssClasses:`default usecase-note`,cssStyles:[],cssCompiledStyles:r([]),noteTarget:n.target});for(let n of e.jsonNodes.values())t.push({id:n.id,label:n.id,labelType:`text`,shape:`usecaseJsonTable`,isGroup:!1,padding:10,cssClasses:vt(`default`,`usecase-json-table`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),jsonRows:_t(n)});for(let n of e.systemBoundaries.values())t.push({id:n.id,label:n.label,labelType:n.labelType,shape:`usecaseSystemBoundary`,isGroup:!0,padding:20,cssClasses:vt(`default`,`system-boundary`,`system-boundary-${n.type}`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),boundaryType:n.type});for(let t of e.relationships){let e=t.type===`include`||t.type===`extend`,[i,a]=yt(t),o=t.animate||t.animation!==void 0,s={id:t.id,start:t.source,end:t.target,relationshipType:t.type,pattern:e?`dotted`:`solid`,arrowTypeStart:i,arrowTypeEnd:a,classes:vt(`default`,`relationship`,`relationship-${t.type}`,...t.classes,o&&`edge-animation-${t.animation??`fast`}`),style:[...t.styles],cssCompiledStyles:r(t.classes),animate:t.animate,animation:t.animation,minlen:t.minlen,explicitId:t.explicitId,internal:!1};e?(s.label=t.type,s.labelType=`text`):t.type===`association`&&(t.label&&(s.label=t.label),t.labelType&&(s.labelType=t.labelType)),n.push(s)}for(let t of e.notes.values())n.push({id:`${t.id}-edge`,start:t.id,end:t.target,relationshipType:`note`,pattern:`dotted`,arrowTypeStart:`none`,arrowTypeEnd:`none`,classes:`default relationship relationship-note`,style:[],cssCompiledStyles:r([]),animate:!1,minlen:1,explicitId:!1,internal:!0});return{nodes:t,edges:n}}var xt=32,St=16,Ct=72,wt=20,Tt=26,Et=40,Dt=60,Ot=6,kt=6,At=10,jt=8,Mt=9,Nt=12,Pt=14,Ft=` fill="var(--_s)" stroke="var(--_b)"`;function It(e,t,n){let r=e.usecase?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}function Lt(e){return e.replace(/[&<>\\]/g,e=>`&#${e.charCodeAt(0)};`)}function $(e,t,n,r,i,a=0){return c(e&&!t?Lt(e):e,t,n,r,i,a)}function Rt(e,t,n,r){let i=n===1||n===2?1:-1,a=n===1||n===3,o=(a?e.w:e.h)/2,s=0;if(e.kind===0)a?(o=Et/2+3,s=(Dt-e.h)/2):o+=2;else if(e.kind===1){let t=(a?e.h:e.w)/2;o*=Math.sqrt(Math.max(1-(r/t)**2,0))}return a?[t.x+i*o,t.y+s+r]:[t.x+r,t.y+i*o]}function zt(e,t){let n=t===1||t===3;if(e.kind===0)return n?Dt*.5:Et*.6;let r=n?e.h:e.w;return e.kind===1?r*.6:r-16}function Bt(e,t,n){let r=new Map,i=(e,n,i,a)=>{let o=t[e];if(o.isGroup)return;let s=n[i]-o.x,c=n[i+1]-o.y,l;if(Math.abs(Math.abs(c)-o.h/2)<.5)l=c<0?0:2;else if(Math.abs(Math.abs(s)-o.w/2)<.5)l=s<0?3:1;else return;let u=e*4+l,d={route:n,at:i,toward:n[a+(l&1?1:0)]},f=r.get(u);f?f.push(d):r.set(u,[d])};for(let t of e){let e=t.route.length-3;t.src===t.dst||e<3||(i(t.src,t.route,0,3),i(t.dst,t.route,e,e-3))}for(let[e,i]of r){let r=e>>2,a=e&3,o=n[r],s=i.length>1?Math.min(Pt,zt(o,a)/(i.length-1)):0;i.sort((e,t)=>e.toward-t.toward);for(let e=0;e<i.length;e++){let[n,c]=Rt(o,t[r],a,(e-(i.length-1)/2)*s);i[e].route[i[e].at]=n,i[e].route[i[e].at+1]=c}}}function Vt(e,n,r,i,a){let o=e-r*Nt,s=n-i*Nt,c=Nt*.5;return`<path class="pele-marker" d="M${t(e)},${t(n)}L${t(o-i*c)},${t(s+r*c)}L${t(o+i*c)},${t(s-r*c)}Z" fill="var(--_bg)" stroke="${a}" stroke-linejoin="round"/>`}function Ht(e){return e===`extension`?Nt:d(e)}function Ut(e,t,n,r,i,a){return e===`extension`?Vt(t,n,r,i,a):m(e,t,n,r,i,a)}function Wt(e,n){let r=e.node,i=e.style.shape,a=` fill="none" stroke="var(--_b)"${e.style.line}`,c=-21,l=9,u;return r.actorType===`hollow`?(l=8,u=`<circle cy="-21" r="8" fill="var(--_bg)" stroke="var(--_b)"${i}/><path d="M-20,-9H20V0H5.5L20,15.5L12,25.5L0,12L-12,25.5L-20,15.5L-5.5,0H-20Z" fill="var(--_bg)" stroke="var(--_b)" stroke-linejoin="round"${i}/>`):r.actorType===`awesome`?u=`<path d="M0,-30A11,11 0 1 1 0,-8A11,11 0 1 1 0,-30ZM-20,25C-20,9 -12,-3 0,-3C12,-3 20,9 20,25C20,28 18,30 15,30H-15C-18,30 -20,28 -20,25Z" fill="var(--_b)"${i}/>`:r.actorType===`icon`?(c=-14,l=12,u=`<rect x="-22" y="-26" width="44" height="44"${o(Ft+i)}/><svg class="pele-icon" data-icon="${s(r.icon??``)}" x="-14" y="-18" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${n?.(r.icon??``)??``}</svg>`):u=`<circle cy="-21" r="9"${Ft}${i}/><path d="M0,-12V10M-14,-3H14M0,10L-12,30M0,10L12,30"${a}/>`,r.business&&(u+=`<path class="pele-business" d="M${t(.12*l)},${t(c+.99*l)}L${t(.92*l)},${t(c-.39*l)}"${a}/>`),u}function Gt(e,t,n){return h(e.direction)?g(n,r=>Kt(e,t,n,r)):Kt(e,t,n,!1)}function Kt(r,a,c,d){let m=bt(r),h=c.fontSize??16,g=Math.round(h*.875),S=Math.round(h*.8125),C=c.measurer??te(c.fontFamily),w=c.padding??8,T=c.icons,E=d?`TB`:b(r.direction),D=E===`LR`||E===`RL`,O=new Map,k=[],A=[];m.nodes.forEach((e,t)=>O.set(e.id,t));for(let e of m.nodes){let t=i(e.cssStyles.length>0?e.cssCompiledStyles.concat(e.cssStyles):e.cssCompiledStyles),n=+!!t.bold|(t.italic?2:0),r=t.fontSize??h,a=e.labelType===`markdown`,o=$(e.stereotype&&`«${e.stereotype}»`,!1,C,S,200,n),s={node:e,kind:2,style:t,label:o,stereotype:o,w:0,h:0,rows:[],keyW:0,headH:0,loops:0},c;if(e.isGroup){s.kind=4,s.label=$(e.label,a,C,r,4e3,n);let t=s.label.height;c=x(0,0),c.isGroup=!0,c.padX=wt,c.padBottom=wt,c.padTop=e.boundaryType===`package`?t+2*kt+16:t>0?t+16:wt,c.minW=s.label.width+2*wt}else{if(e.jsonRows){s.kind=3,s.label=$(e.label,!1,C,r,4e3,n|1);let t=0;for(let r of e.jsonRows){let e=$(r.key,!1,C,g,4e3,n),i=$(r.value,!1,C,g,260,n);s.rows.push([e,i]),s.keyW=Math.max(s.keyW,e.width),t=Math.max(t,i.width),s.h+=Math.max(e.height,i.height,Math.round(g*1.5))+jt}s.keyW>0&&(s.keyW+=2*At),s.headH=Math.max(s.label.height,Math.round(r*1.5))+jt,s.w=Math.max(s.label.width+2*At,s.rows.length>0?s.keyW+t+2*At:0,72),s.h+=s.headH}else if(e.actorType)s.kind=0,s.label=$(e.label,a,C,r,140,n),s.w=Math.max(Et,s.label.width,o.width),s.h=Dt+Ot+o.height+s.label.height;else{s.label=$(e.label,a,C,e.shape===`note`?g:r,180,n);let t=Math.max(s.label.width,o.width),i=s.label.height+o.height;e.shape===`usecaseEllipse`||e.shape===`usecaseBusiness`?(s.kind=1,s.w=Math.max(t+2*e.padding+(e.business?16:4),88),s.h=Math.max(i+28,48)):e.shape===`note`?(s.w=t+2*e.padding+6,s.h=i+18):(s.w=Math.max(t+2*e.padding+12,80),s.h=Math.max(i+24,44))}c=x(s.w,s.h)}c.seq=k.length,k.push(s),A.push(c)}m.nodes.forEach((e,t)=>{A[t].parent=e.parentId===void 0?-1:O.get(e.parentId)??-1});let j=[],M=[],N=[];for(let e of m.edges){let t=O.get(e.start),n=O.get(e.end);if(t===void 0||n===void 0)continue;let r=$(e.relationshipType===`include`||e.relationshipType===`extend`?`«${e.label}»`:e.label,e.labelType===`markdown`,C,g,200);t===n&&(k[t].loops++,D?A[t].h+=2*(Tt+(r.height>0?r.height+8:0)):A[t].w+=2*(Tt+(r.width>0?r.width+12:0))),N.push(e),M.push(r),j.push({src:t,dst:n,minlen:e.minlen,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0})}let ne=v(A,j,E,{nodeSep:It(a,`nodeSpacing`,xt),edgeSep:St,rankSep:It(a,`rankSpacing`,Ct),portSep:20}),P=ee(r.title,C,h,4e3),re=P.height>0?P.height+12:0,ie=Math.max(ne.width,P.width),ae=w+(ie-ne.width)/2,oe=w+re;y(A,j,ae,oe);let se=Math.ceil(ie+2*w),ce=Math.ceil(ne.height+re+2*w),le=new Map;for(let e of j)_(le,e.route);Bt(j,A,k);let F=``,ue=``;for(let n=0;n<k.length;n++){let r=k[n],i=A[n],a=r.node,c=e(a.cssClasses.replace(/^default\s?/,``)),u=s(a.id),d=r.style.text,f=r.style.shape,p=r.w,m=r.h;if(r.kind===4){let e=i.x-i.w/2,n=i.y-i.h/2,s=` fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${f}`,p=` class="pele-cluster-label" fill="var(--_m)"${d}`,m;if(a.boundaryType===`package`){let a=Math.min(r.label.width+2*kt+8,i.w),o=r.label.height+2*kt;m=`<rect class="pele-boundary-tab" x="${t(e)}" y="${t(n)}" width="${t(a)}" height="${t(o)}"${s}/><rect x="${t(e)}" y="${t(n+o)}" width="${t(i.w)}" height="${t(i.h-o)}"${s}/>`+l(r.label,e+a/2,n+o/2,p,T)}else m=`<rect x="${t(e)}" y="${t(n)}" width="${t(i.w)}" height="${t(i.h)}"${o(s)}/>`+l(r.label,qt(i,r.label.width,le),n+8+r.label.height/2,p,T);F+=`<g class="pele-cluster pele-boundary${c}" data-id="${u}">${m}</g>`;continue}let h,_;if(r.kind===0){_=`pele-actor`;let e=-m/2,n=e+Dt+Ot+r.stereotype.height/2;h=`<g class="pele-actor-figure" transform="translate(0,${t(e+Dt/2)})">${Wt(r,T)}</g>`+l(r.stereotype,0,n,` class="pele-stereotype" font-size="${S}" fill="var(--_m)"`,T)+l(r.label,0,m/2-r.label.height/2,` class="pele-label"${d}`,T)}else if(r.kind===3){_=`pele-json`;let e=-p/2,n=-m/2+r.headH,i=``,a=`M${t(e)},${t(n)}H${t(e+p)}`;r.keyW>0&&(a+=`M${t(e+r.keyW)},${t(n)}V${t(m/2)}`);for(let[t,a]of r.rows){let o=Math.max(t.height,a.height,Math.round(g*1.5))+jt;i+=l(t,e+At+t.width/2,n+o/2,` class="pele-json-key" fill="var(--_m)"`,T)+Jt(a,e+r.keyW+At,n+o/2,` class="pele-json-value"${d}`,T),n+=o}h=`<rect x="${t(e)}" y="${t(-m/2)}" width="${t(p)}" height="${t(m)}"${o(Ft+f)}/><path class="pele-json-lines" d="${a}" fill="none" stroke="var(--_b)"${r.style.line}/>`+l(r.label,0,-m/2+r.headH/2,` class="pele-label" font-weight="var(--_hw)"${d}`,T)+`<g font-size="${g}">${i}</g>`}else{let e=r.stereotype.height/2,n;if(r.kind===1){if(_=`pele-usecase`,n=`<ellipse rx="${t(p/2)}" ry="${t(m/2)}"${Ft}${f}/>`,a.business){let e=p/2-15,i=p/2-5,a=e=>m/2*Math.sqrt(1-(e/(p/2))**2);n+=`<path class="pele-business" d="M${t(e)},${t(a(e))}L${t(i)},${t(-a(i))}" fill="none" stroke="var(--_b)"${r.style.line}/>`}}else if(a.shape===`note`){_=`pele-note`;let e=p/2,i=m/2;n=`<path d="M${t(-e)},${t(-i)}H${t(e-Mt)}L${t(e)},${t(Mt-i)}V${t(i)}H${t(-e)}Z" fill="var(--_a)" stroke="var(--_b)" stroke-linejoin="round"${f}/><path d="M${t(e-Mt)},${t(-i)}V${t(Mt-i)}H${t(e)}" fill="none" stroke="var(--_b)" stroke-linejoin="round"${r.style.line}/>`}else _=`pele-usecase`,n=`<rect x="${t(-p/2)}" y="${t(-m/2)}" width="${t(p)}" height="${t(m)}"${o(Ft+f)}/>`;h=n+l(r.stereotype,0,-r.label.height/2,` class="pele-stereotype" font-size="${S}" fill="var(--_m)"`,T)+l(r.label,0,e,` class="pele-label"${a.shape===`note`?` font-size="${g}"`:``}${d}`,T)}ue+=`<g class="pele-node ${_}${c}" data-id="${u}" transform="translate(${t(i.x)},${t(i.y)})">${h}</g>`}let de=``,I=``,fe=new Map;for(let n=0;n<j.length;n++){let r=j[n],a=N[n],o=M[n],c=a.style.length>0||a.cssCompiledStyles.length>0?i(a.cssCompiledStyles.concat(a.style)):void 0,l=a.arrowTypeStart,d=a.arrowTypeEnd,m;if(r.src===r.dst){let e=A[r.src],n=k[r.src],i=fe.get(r.src)??0;fe.set(r.src,i+1);let a=D?2:1,s=Math.min(zt(n,a)/2,8+i*6),c=Tt+i*8,[u,f]=Rt(n,e,a,-s),[p,h]=Rt(n,e,a,s),g=Math.hypot(c,s)||1,_=D?s/g:c/g,v=D?c/g:s/g,y=Ht(l),b=Ht(d),x=(e,n,r,i)=>D?`${t(e+r*s*+!!i)},${t(n+i)}`:`${t(e+i)},${t(n+r*s*+!!i)}`,ee=D?u-_*y:u+_*y,S=D?f+v*y:f-v*y,te=p+_*b,C=h+v*b;m={d:`M${t(ee)},${t(S)}C${x(u,f,-1,c)} ${x(p,h,1,c)} ${t(te)},${t(C)}`,sx:u,sy:f,sdx:D?_:-_,sdy:D?-v:v,ex:p,ey:h,edx:-_,edy:-v},D?(r.labelX=e.x,r.labelY=Math.max(f,h)+c*.75+6+o.height/2):(r.labelX=Math.max(u,p)+c*.75+8+o.width/2,r.labelY=e.y)}else{if(r.route.length<6)continue;m=p(r.route,void 0,Ht(l),Ht(d))}let h=c?.stroke?u(c.stroke):`var(--_l)`,g=a.internal?`2 3`:a.pattern===`dotted`?`5 4`:a.animate?`9 5`:``;if(de+=`<g class="pele-edge pele-${a.relationshipType}${e(a.classes.replace(/^default relationship relationship-\S+\s?/,``))}" data-id="${s(a.id)}"${c?.line??``}><path d="${m.d}"${g?` stroke-dasharray="${g}"`:``}/>`+Ut(l,m.sx,m.sy,m.sdx,m.sdy,h)+Ut(d,m.ex,m.ey,m.edx,m.edy,h)+`</g>`,o.width>0){let e=r.labelX,t=r.labelY,n=a.relationshipType===`include`||a.relationshipType===`extend`;I+=f(a.id,o,e,t,(n?` fill="var(--_m)"`:``)+(c?.text??``),T)}}return{svg:n(`usecase`,se,ce,h,c,r,l(P,se/2,w+P.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(F?`<g class="pele-clusters">${F}</g>`:``)+(de?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${de}</g>`:``)+(I?`<g class="pele-edge-labels" font-size="${g}">${I}</g>`:``)+`<g class="pele-nodes">${ue}</g>`),width:se,height:ce,links:[]}}function qt(e,t,n){let r=n.get(Math.round(e.y-e.h/2));if(t===0||r===void 0)return e.x;let i=e.x-e.w/2+6,a=e.x+e.w/2-6,o=r.filter(e=>e>i&&e<a).sort((e,t)=>e-t);o.push(a);let s=t/2+6,c=e.x,l=1/0,u=0,d=i;for(let t of o){if(t-d>=2*s){let n=Math.min(Math.max(e.x,d+s),t-s);Math.abs(n-e.x)<l&&(l=Math.abs(n-e.x),c=n)}else l===1/0&&t-d>u&&(u=t-d,c=(d+t)/2);d=t}return c}function Jt(e,t,n,i,o){if(e.lines.length<2)return l(e,t+e.width/2,n,i,o);let s=``;for(let c=0;c<e.lines.length;c++)s+=l(a(e,c),t+e.widths[c]/2,n-e.height/2+r(e,c),i,o);return s}var Yt={type:`usecase`,math:!0,parse:(e,t,n)=>pt(e,n),render:Gt};export{Yt as usecase};
9
- //# sourceMappingURL=LHDIQX7Q-LIdvhN0m.js.map
9
+ //# sourceMappingURL=LHDIQX7Q-DAyTfuTY.js.map
@@ -1,3 +1,3 @@
1
- import{d as e,f as t,g as n,m as r,r as i,t as a}from"./77XECAW3-DM5Itfvk.js";import{t as o}from"./DKTLEL5E-DciMwFJ1.js";import{i as s,r as c,t as l}from"./WEVWDWVA-BF8z-yRH.js";import{n as u,t as d}from"./5GK6JWQ2-DwbHk3MV.js";import{_ as f,i as p,r as m,u as h}from"./lazy-Bpm7QNt6.js";function g(e){let t=new Set;for(let n of e)for(let e of n.people)t.add(e);return[...t].sort()}var _=class{type=`journey`;title;accTitle;accDescr;sections=[];tasks=[];currentSection=``;setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
1
+ import{d as e,f as t,g as n,m as r,r as i,t as a}from"./77XECAW3-_XJOQitm.js";import{t as o}from"./DKTLEL5E-DciMwFJ1.js";import{i as s,r as c,t as l}from"./WEVWDWVA-Cz36fo-k.js";import{n as u,t as d}from"./5GK6JWQ2-DRzSVTZ0.js";import{_ as f,i as p,r as m,u as h}from"./lazy--Qcevr63.js";function g(e){let t=new Set;for(let n of e)for(let e of n.people)t.add(e);return[...t].sort()}var _=class{type=`journey`;title;accTitle;accDescr;sections=[];tasks=[];currentSection=``;setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
2
2
  `)}addSection(e){this.currentSection=e,this.sections.push(e)}addTask(e,t){let n=t.substring(1).split(`:`),r=n.length===1?[]:n[1].split(`,`).map(e=>e.trim());this.tasks.push({task:e,score:Number(n[0]),people:r,section:this.currentSection})}getActors(){return g(this.tasks)}},v=[`$end`,`EOF`,`INVALID`,`NEWLINE`,`journey`,`title`,`acc_title`,`acc_title_value`,`acc_descr`,`acc_descr_value`,`acc_descr_multiline_value`,`section`,`taskName`,`taskData`,`:`];function y(e,t,n){let r=e.length,i=t;for(;i<r;i++){let t=e.charCodeAt(i);if(t===35||t===10||t===59||n&&t===58)break}return i}function b(e){let t=e.length,n=[],r=[],i=[],a={types:n,texts:r,starts:i},o=0,u=(t,a)=>{n.push(t),r.push(e.slice(o,a)),i.push(o),o=a};for(;o=c(e,o),!(o>=t);){let t=e.charCodeAt(o),n=o+1;if(t===10){for(;e.charCodeAt(n)===10;)n++;u(3,n)}else s(e,o,`journey`)&&!p(e.charCodeAt(o+7))?u(4,o+7):s(e,o,`title`)&&m(e.charCodeAt(o+5))&&(n=y(e,o+6,!1),n>o+6)?u(5,n):(n=l(e,o,a,6),n===o?s(e,o,`section`)&&m(e.charCodeAt(o+7))&&(n=y(e,o+8,!0),n>o+8)?u(11,n):t===58?(n=y(e,o+1,!1),u(n>o+1?13:14,n>o+1?n:o+1)):t===59?u(2,o+1):u(12,y(e,o+1,!0)):o=n)}return(i.length===0||i[i.length-1]<t)&&u(1,t),u(0,t),a}var x=`'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'taskName'`;function S(e,t){let{types:n,texts:r,starts:i}=b(e),a=(t,r)=>{let a=n[t]===0?`1`:v[n[t]];throw h(`journey`,e,i[t],`Expecting ${r}, got '${a}'`)};n[0]!==4&&a(0,`'journey'`);for(let e=1;;e++){let i=r[e];switch(n[e]){case 3:break;case 5:t.setDiagramTitle(i.substring(6));break;case 6:t.setAccTitle(r[++e].trim());break;case 8:t.setAccDescription(r[++e].trim());break;case 10:t.setAccDescription(i.trim());break;case 11:t.addSection(i.substring(8));break;case 12:n[++e]!==13&&a(e,`'taskData'`),t.addTask(i,r[e]);break;case 1:return;default:a(e,x)}}}var C=10,w=8,T=124,E=200,D=12,ee=6,O=24,k=26,A=11,j=5,te=13,ne=20,M=`<circle cx="-3.6" cy="-2.8" r="1.3"/><circle cx="3.6" cy="-2.8" r="1.3"/>`,N={happy:`M-5,2A6,6 0 0 0 5,2`,neutral:`M-4.5,4.5H4.5`,sad:`M-5,6.5A6,6 0 0 1 5,6.5`};function re(e,n,r){return`<g class="pele-face pele-face-${r}" transform="translate(${t(e)},${t(n)})"><circle r="${A}" fill="var(--_bg)" stroke="var(--_l)"/><g fill="var(--_l)">${M}</g><path d="${N[r]}" fill="none" stroke="var(--_l)" stroke-linecap="round"/></g>`}function P(e,t,n){return o(n,r=>F(e,t,n,r))}function F(o,s,c,l){let p=c.fontSize??16,m=Math.round(p*.875),h=Math.round(p*.75),_=c.measurer??f(c.fontFamily),v=c.padding??8;if(l)return ie(o,c);let y=o.tasks,b=y.length,x=g(y).filter(e=>e!==``),S=new Map;x.forEach((e,t)=>S.set(e,t));let M=T,N=y.map(e=>u(e.task,_,m,M)),P=0;for(let e of N)P=Math.max(P,e.width);P>M&&(M=Math.min(Math.ceil(P),E),N=y.map(e=>d(e.task,_,m,M)));let F=M+2*C,I=F+D,L=b>0?b*I-D:0,R=Math.round(m*1.5),ae=Math.max(L,240),z=[],B=0,V=0,H=0;for(let e of x){let t=d(e,_,m,ae-2*j-6),n=2*j+6+t.width;H>0&&H+n>ae&&(H=0,V+=4);let r=H>0?z[z.length-1].y:V,i=Math.max(t.height,R);z.push({name:e,label:t,x:H,y:r,h:i}),H+=n,B=Math.max(B,H),V=Math.max(V,r+i),H+=ne}let U=b>0?O+L:0,W=d(o.title,_,p,Math.max(U,320),1),oe=W.height>0?W.height+16:0,G=Math.max(U,W.width,b>0?O+B:0),K=v+(G-U)/2+O,q=v+oe,se=[],J=0;for(let e=0;e<b;){let t=e+1;for(;t<b&&y[t].section===y[e].section;)t++;let n;y[e].section!==``&&(n=d(y[e].section,_,m,(t-e)*I-D-2*C,1),J=Math.max(J,Math.max(n.height,R)+2*ee)),se.push({start:e,count:t-e,label:n}),e=t}let Y=R;for(let e of N)Y=Math.max(Y,e.height);let ce=x.length>0?2*j+6:0,X=Y+ce+2*w,Z=q+(J>0?J+ee:0),le=Z+X+A+16,ue=le+4*k,de=K+L,Q=``,$=q;if(b>0){let n=``,o=``;for(let e=5;e>=1;e--){let r=le+(5-e)*k;n+=`M${t(K-6)},${t(r)}H${t(de)}`,o+=`<text x="${t(K-12)}" y="${t(r+h*.35)}">${e}</text>`}Q+=`<path class="pele-grid" d="${n}" fill="none" stroke="var(--_a)"/><g class="pele-scale" font-size="${h}" text-anchor="end" fill="var(--_m)">${o}</g>`;let s=``,c=``,l=``,u=[];y.forEach((n,o)=>{let d=K+o*I,f=d+F/2,p=n.score,h=le+(5-(Number.isNaN(p)?3:Math.min(5,Math.max(1,p))))*k;s+=`${o===0?`M`:`L`}${t(f)},${t(h)}`,c+=`M${t(f)},${t(Z+X)}V${t(h-A)}`,l+=re(f,h,p>3?`happy`:p<3?`sad`:`neutral`);let g=``,_=n.people.filter(e=>e!==``),v=Math.min(te,(F-2*C-2*j)/Math.max(_.length-1,1));_.forEach((n,r)=>{g+=`<circle class="pele-actor" cx="${t(f+(r-(_.length-1)/2)*v)}" cy="${t(Z+X-w-j)}" r="${j}" fill="${e(S.get(n)??0)}" stroke="var(--_s)"><title>${i(n)}</title></circle>`}),u.push(`<g class="pele-node pele-task" data-id="${i(n.task.trim())}"><rect x="${t(d)}" y="${t(Z)}" width="${t(F)}" height="${t(X)}" fill="var(--_s)" stroke="var(--_b)"${r}/>`+a(N[o],f,Z+w+Y/2,` font-size="${m}"`)+g+`</g>`)}),Q+=`<path class="pele-stems" d="${c}" fill="none" stroke="var(--_b)" stroke-dasharray="2 3"/>`+(b>1?`<path class="pele-edge" d="${s}" fill="none" stroke="var(--_l)" stroke-linejoin="round"/>`:``)+l;for(let e of se){let n=u.slice(e.start,e.start+e.count).join(``);if(!e.label){Q+=n;continue}let o=K+e.start*I,s=e.count*I-D;Q+=`<g class="pele-cluster pele-section" data-id="${i(y[e.start].section.trim())}"><rect x="${t(o)}" y="${t(q)}" width="${t(s)}" height="${t(J)}" fill="var(--_a)"${r}/>`+a(e.label,o+s/2,q+J/2,` font-size="${m}" font-weight="var(--_hw)"`)+n+`</g>`}if($=ue+A,z.length>0){let n=K+(L-B)/2,r=$+16,o=``;for(let s of z){let c=r+s.y+s.h/2;o+=`<g class="pele-legend-item" data-id="${i(s.name)}"><circle cx="${t(n+s.x+j)}" cy="${t(c)}" r="${j}" fill="${e(S.get(s.name)??0)}"/>`+a(s.label,n+s.x+2*j+6+s.label.width/2,c,``)+`</g>`}Q+=`<g class="pele-legend" font-size="${m}">${o}</g>`,$=r+V}}let fe=Math.ceil(G+2*v),pe=Math.ceil(Math.max($,v)+v),me=a(W,v+G/2,v+W.height/2,` class="pele-title" font-weight="var(--_tw)"`)+Q;return{svg:n(`journey`,fe,pe,p,c,o,me),width:fe,height:pe,links:[]}}function ie(i,o){let s=o.fontSize??16,c=Math.round(s*.875),l=o.measurer??f(o.fontFamily),u=o.padding??8,p=Math.max(140,(o.maxWidth??320)-2*u),m=d(i.title,l,s,p,1),h=g(i.tasks).filter(e=>e!==``),_=new Map(h.map((e,t)=>[e,t])),v=u+(m.height?m.height+16:0),y,b=``,x=m.width;i.tasks.forEach((n,o)=>{if(n.section!==y){y=n.section;let e=d(y,l,s,p-16,1);e.height&&(b+=a(e,u+8+e.width/2,v+e.height/2,` class="pele-cluster-label" font-weight="var(--_hw)"`),x=Math.max(x,e.width+16),v+=e.height+8)}let f=d(n.task,l,c,p-72),m=n.people.filter(e=>e!==``).map(e=>({name:e,label:d(e,l,c,p-44)})),h=Math.max(f.height,42),g=2*w+h;for(let e of m)g+=Math.max(16,e.label.height)+4;let S=Math.max(p,f.width+72);b+=`<g class="pele-node pele-journey-step" data-id="${o}"><rect x="${t(u)}" y="${t(v)}" width="${t(S)}" height="${t(g)}" fill="var(--_s)" stroke="var(--_b)"${r}/>`,b+=a(f,u+C+f.width/2,v+w+f.height/2,` class="pele-label"`);let T=u+S-28;b+=re(T,v+w+A,n.score>3?`happy`:n.score<3?`sad`:`neutral`),Number.isNaN(n.score)||(b+=`<text class="pele-journey-score" x="${t(T)}" y="${t(v+w+2*A+c)}" font-size="${c}" text-anchor="middle">${t(Math.min(5,Math.max(1,n.score)))}</text>`);let E=v+w+h+4;for(let n of m){let r=Math.max(16,n.label.height);b+=`<circle class="pele-actor" cx="${t(u+16)}" cy="${t(E+r/2)}" r="${j}" fill="${e(_.get(n.name))}"/>`+a(n.label,u+28+n.label.width/2,E+r/2,` class="pele-journey-actor" font-size="${c}"`),E+=r+4}b+=`</g>`,v+=g,o+1<i.tasks.length&&(b+=`<path class="pele-edge" d="M${t(u+S/2)},${t(v)}v16" fill="none" stroke="var(--_l)"/>`),v+=16,x=Math.max(x,S)});let S=Math.ceil(x+2*u),T=Math.ceil(Math.max(u+m.height,v-(i.tasks.length?16:0))+u),E=a(m,S/2,u+m.height/2,` class="pele-title" font-weight="var(--_tw)"`)+b;return{svg:n(`journey`,S,T,s,o,i,E),width:S,height:T,links:[]}}var I={type:`journey`,parse(e,t,n){let r=new _;return r.title=n,S(e,r),r},render:P};export{I as journey};
3
- //# sourceMappingURL=LUXOKEGN-B1aHy25-.js.map
3
+ //# sourceMappingURL=LUXOKEGN-C67XJj3F.js.map