agentstudio 0.4.2 → 0.4.3
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.
- package/config/engineConfig.d.ts +15 -0
- package/config/engineConfig.d.ts.map +1 -1
- package/config/engineConfig.js +30 -0
- package/config/engineConfig.js.map +1 -1
- package/config/index.d.ts.map +1 -1
- package/config/index.js +14 -0
- package/config/index.js.map +1 -1
- package/config/paths.d.ts +5 -0
- package/config/paths.d.ts.map +1 -1
- package/config/paths.js +6 -1
- package/config/paths.js.map +1 -1
- package/engines/claude/__tests__/supportedModels.test.d.ts +6 -4
- package/engines/claude/__tests__/supportedModels.test.d.ts.map +1 -1
- package/engines/claude/__tests__/supportedModels.test.js +55 -13
- package/engines/claude/__tests__/supportedModels.test.js.map +1 -1
- package/engines/claude/aguiAdapter.d.ts.map +1 -1
- package/engines/claude/aguiAdapter.js +8 -0
- package/engines/claude/aguiAdapter.js.map +1 -1
- package/engines/claude/claudeEngine.d.ts +36 -3
- package/engines/claude/claudeEngine.d.ts.map +1 -1
- package/engines/claude/claudeEngine.js +132 -13
- package/engines/claude/claudeEngine.js.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +29 -2
- package/index.js.map +1 -1
- package/middleware/callChain.d.ts +10 -0
- package/middleware/callChain.d.ts.map +1 -0
- package/middleware/callChain.js +24 -0
- package/middleware/callChain.js.map +1 -0
- package/middleware/requestId.d.ts +8 -0
- package/middleware/requestId.d.ts.map +1 -0
- package/middleware/requestId.js +18 -0
- package/middleware/requestId.js.map +1 -0
- package/package.json +1 -1
- package/prompts/gameDevSystemPrompt.d.ts +15 -0
- package/prompts/gameDevSystemPrompt.d.ts.map +1 -0
- package/prompts/gameDevSystemPrompt.js +37 -0
- package/prompts/gameDevSystemPrompt.js.map +1 -0
- package/prompts/vibeGamingPrompt.d.ts +13 -0
- package/prompts/vibeGamingPrompt.d.ts.map +1 -0
- package/prompts/vibeGamingPrompt.js +125 -0
- package/prompts/vibeGamingPrompt.js.map +1 -0
- package/public/assets/{AgentsPage-BsZdkqzM.js → AgentsPage-CHee5mUh.js} +1 -1
- package/public/assets/{Button-CMTSYiKV.js → Button-D5qiS7CR.js} +1 -1
- package/public/assets/ChatPage-B7-rn9mH.js +478 -0
- package/public/assets/{CommandForm-DwGvE9A_.js → CommandForm-CMfgHNm5.js} +1 -1
- package/public/assets/{CommandsPage-qDWzq8xp.js → CommandsPage-B4rjtVWk.js} +1 -1
- package/public/assets/{CursorConfigPage-DpUdJzRi.js → CursorConfigPage-DQ-3b3ti.js} +1 -1
- package/public/assets/{DashboardPage-BhqKOzob.js → DashboardPage-BowdW2Xj.js} +1 -1
- package/public/assets/{EngineGate-BjHJu955.js → EngineGate-DYNvEEbW.js} +1 -1
- package/public/assets/{FileBrowser-DboOOM_v.js → FileBrowser-DHyCacM6.js} +1 -1
- package/public/assets/{FileExplorer-x5R0Tcmk.js → FileExplorer-BprfeAH_.js} +1 -1
- package/public/assets/GeneralSettingsPage-C6hJ_zTw.js +1 -0
- package/public/assets/{HooksPage-DDGc0GGV.js → HooksPage-BwE2Zm3X.js} +1 -1
- package/public/assets/{LandingPage-CvY4n9Rh.js → LandingPage-DKvwbGX1.js} +1 -1
- package/public/assets/{LoginPage-C-PZfjYC.js → LoginPage-BpZhqRAN.js} +1 -1
- package/public/assets/{McpAdminSettingsPage-CIILVzB8.js → McpAdminSettingsPage-DuvsM5TX.js} +1 -1
- package/public/assets/{McpPage-B4nQUJag.js → McpPage-Hu8vyMhX.js} +1 -1
- package/public/assets/{MemorySettingsPage-eu6tsuUh.js → MemorySettingsPage-gIWSsrES.js} +1 -1
- package/public/assets/{ModelsPage-Bb5vSsuc.js → ModelsPage-Cosb3hHI.js} +1 -1
- package/public/assets/PluginsPage-CuNui9NV.js +12 -0
- package/public/assets/{ProjectSelector-CybrDbBY.js → ProjectSelector-CyBlHb2H.js} +1 -1
- package/public/assets/{ProjectsPage-DRl-0B4G.js → ProjectsPage-DYhCvH07.js} +1 -1
- package/public/assets/{RulesPage-DUt33RkX.js → RulesPage-C32P_Aqz.js} +1 -1
- package/public/assets/{ScheduledTasksPage-CTDYYRIN.js → ScheduledTasksPage-ixn5qoiD.js} +1 -1
- package/public/assets/SettingsLayout-C_7jR0Te.js +1 -0
- package/public/assets/{SkillsPage-Lzw8I9vR.js → SkillsPage-C-WS4N1Y.js} +1 -1
- package/public/assets/{SubagentForm-BzzeWg0W.js → SubagentForm-BbxljQUp.js} +1 -1
- package/public/assets/{SubagentsPage-bX2XWdJ0.js → SubagentsPage-D66TBaeN.js} +1 -1
- package/public/assets/{SystemInfoPage-nEIQbtwG.js → SystemInfoPage-DXVUncTe.js} +1 -1
- package/public/assets/{TelemetrySettingsPage-q167I4G9.js → TelemetrySettingsPage-Cp3vOu7X.js} +1 -1
- package/public/assets/{ToastTestPage-j224d3QR.js → ToastTestPage-03up9yZR.js} +1 -1
- package/public/assets/{ToolsList-CTsQr53G.js → ToolsList-BZFBEuvQ.js} +1 -1
- package/public/assets/UnifiedToolSelector-DJN7ASu1.js +1 -0
- package/public/assets/{VersionSettingsPage-BwpwiLyl.js → VersionSettingsPage-DppWaX--.js} +1 -1
- package/public/assets/{VoiceSettingsPage-d3l9AWBn.js → VoiceSettingsPage-BWJLeedX.js} +1 -1
- package/public/assets/{WebSocketTunnelPage-BqEUE7mr.js → WebSocketTunnelPage-BPeSTgEZ.js} +1 -1
- package/public/assets/{_basePickBy-DHabY031.js → _basePickBy-0UeYrifO.js} +1 -1
- package/public/assets/{_baseUniq-B1lmu3qr.js → _baseUniq-Q0NUbuSr.js} +1 -1
- package/public/assets/{agents-KlPdWQ8K.js → agents-DR9EZMs5.js} +1 -1
- package/public/assets/{arc-6sRLTBcr.js → arc-BV8erW1-.js} +1 -1
- package/public/assets/{architectureDiagram-VXUJARFQ-kwdTmjuB.js → architectureDiagram-VXUJARFQ-BIodTu6s.js} +1 -1
- package/public/assets/{blockDiagram-VD42YOAC-CYO9EYkJ.js → blockDiagram-VD42YOAC-4H3KjsGf.js} +1 -1
- package/public/assets/{c4Diagram-YG6GDRKO-gAp3--Ee.js → c4Diagram-YG6GDRKO-J2ovCYEr.js} +1 -1
- package/public/assets/channel-gveiJv4S.js +1 -0
- package/public/assets/{chunk-4BX2VUAB-DQVsL-J6.js → chunk-4BX2VUAB-D7Mc44O6.js} +1 -1
- package/public/assets/{chunk-55IACEB6-DVsfnY5X.js → chunk-55IACEB6-CMASo37Z.js} +1 -1
- package/public/assets/{chunk-B4BG7PRW-BNmOvuIn.js → chunk-B4BG7PRW-2T3W2IB6.js} +1 -1
- package/public/assets/{chunk-DI55MBZ5-BkucWe8Y.js → chunk-DI55MBZ5-FR9qswmO.js} +1 -1
- package/public/assets/{chunk-FMBD7UC4-BsvfEdnB.js → chunk-FMBD7UC4-Bz2LO9q3.js} +1 -1
- package/public/assets/{chunk-QN33PNHL-DSecsNtM.js → chunk-QN33PNHL-D7mfK9Pm.js} +1 -1
- package/public/assets/{chunk-QZHKN3VN-DhvrZSqy.js → chunk-QZHKN3VN-AkuNbqQU.js} +1 -1
- package/public/assets/{chunk-TZMSLE5B-BqQ674GC.js → chunk-TZMSLE5B-DtY3rhWy.js} +1 -1
- package/public/assets/classDiagram-2ON5EDUG-f-lJUj27.js +1 -0
- package/public/assets/classDiagram-v2-WZHVMYZB-f-lJUj27.js +1 -0
- package/public/assets/clone-D5-Tsf9e.js +1 -0
- package/public/assets/{cose-bilkent-S5V4N54A-D9ZC6LmB.js → cose-bilkent-S5V4N54A-BuEw-qDX.js} +1 -1
- package/public/assets/{dagre-6UL2VRFP-s7YD2ZcY.js → dagre-6UL2VRFP-D-NrLBGh.js} +1 -1
- package/public/assets/{diagram-PSM6KHXK-C7jhP5tx.js → diagram-PSM6KHXK-BFjWOHNz.js} +1 -1
- package/public/assets/{diagram-QEK2KX5R-B348GmS1.js → diagram-QEK2KX5R-C0YlDb8t.js} +1 -1
- package/public/assets/{diagram-S2PKOQOG-Cu-zjwc9.js → diagram-S2PKOQOG-BLKbR12g.js} +1 -1
- package/public/assets/{erDiagram-Q2GNP2WA-tM4HKBpy.js → erDiagram-Q2GNP2WA-Cov6xnUk.js} +1 -1
- package/public/assets/{flowDiagram-NV44I4VS-DjCIshpi.js → flowDiagram-NV44I4VS-DTMKSJI1.js} +1 -1
- package/public/assets/{ganttDiagram-LVOFAZNH-Q6plkI5G.js → ganttDiagram-LVOFAZNH-DR0bcfHY.js} +1 -1
- package/public/assets/{gitGraphDiagram-NY62KEGX-B3Uw90Yt.js → gitGraphDiagram-NY62KEGX-CvxYSabY.js} +1 -1
- package/public/assets/{graph-Bp0jlxBT.js → graph-BYXvelIL.js} +1 -1
- package/public/assets/{index-f67nhEoX.js → index-BIGPvi1D.js} +44 -44
- package/public/assets/infoDiagram-F6ZHWCRC-CL9g-UgS.js +2 -0
- package/public/assets/{journeyDiagram-XKPGCS4Q-CgQogtHU.js → journeyDiagram-XKPGCS4Q-Df8G0pW8.js} +1 -1
- package/public/assets/{kanban-definition-3W4ZIXB7-Cv7kVxyy.js → kanban-definition-3W4ZIXB7-DhoP7TG_.js} +1 -1
- package/public/assets/{layout-6bkH32V1.js → layout-CgO4Vp_y.js} +1 -1
- package/public/assets/{linear-DWoZ6Tbm.js → linear-CaY74pOB.js} +1 -1
- package/public/assets/{mindmap-definition-VGOIOE7T-D5wd9HsH.js → mindmap-definition-VGOIOE7T-CVK2y0WQ.js} +1 -1
- package/public/assets/{pieDiagram-ADFJNKIX-8vPxErLm.js → pieDiagram-ADFJNKIX-BQt_waQk.js} +1 -1
- package/public/assets/{quadrantDiagram-AYHSOK5B-Pn0NZ9k7.js → quadrantDiagram-AYHSOK5B-DvLFoDeH.js} +1 -1
- package/public/assets/{requirementDiagram-UZGBJVZJ-C7u8MiN1.js → requirementDiagram-UZGBJVZJ-C4lqjEUP.js} +1 -1
- package/public/assets/{sankeyDiagram-TZEHDZUN-C660O4mw.js → sankeyDiagram-TZEHDZUN-BKIDyl6M.js} +1 -1
- package/public/assets/{sequenceDiagram-WL72ISMW-pXBA2_3B.js → sequenceDiagram-WL72ISMW-BeyhJ61U.js} +1 -1
- package/public/assets/{stateDiagram-FKZM4ZOC-CxZMM1Lf.js → stateDiagram-FKZM4ZOC-CKyn6eKl.js} +1 -1
- package/public/assets/stateDiagram-v2-4FDKWEC3-DogBVcJE.js +1 -0
- package/public/assets/{table-Clz57edU.js → table-BgVewkB5.js} +1 -1
- package/public/assets/{timeline-definition-IT6M3QCI-Crg44TaP.js → timeline-definition-IT6M3QCI-Cm5SIAmT.js} +1 -1
- package/public/assets/tools-crrPnehB.js +1 -0
- package/public/assets/{treemap-KMMF4GRG-bFxwBWXw.js → treemap-KMMF4GRG-CUMeoVWM.js} +1 -1
- package/public/assets/{ui-components-DjgDPiqV.js → ui-components-D1pZO0y-.js} +1 -1
- package/public/assets/{useAgents-8KXN6U61.js → useAgents-M4lcWvy0.js} +1 -1
- package/public/assets/{useClaudeVersions-DicHLV6A.js → useClaudeVersions-CKT_fq1t.js} +1 -1
- package/public/assets/{useCommands-DbSH48ba.js → useCommands-vaoVPEDI.js} +1 -1
- package/public/assets/{useProjects-Bbh6hJMM.js → useProjects-D1ElB-WS.js} +1 -1
- package/public/assets/{useSessions-DOa4-xiB.js → useSessions-Dp1kUl43.js} +1 -1
- package/public/assets/{xychartDiagram-PRI3JC2R-DG3KmjD-.js → xychartDiagram-PRI3JC2R-Cy-SHDyX.js} +1 -1
- package/public/index.html +4 -4
- package/routes/a2a.d.ts.map +1 -1
- package/routes/a2a.js +27 -7
- package/routes/a2a.js.map +1 -1
- package/routes/agents.d.ts.map +1 -1
- package/routes/agents.js +234 -38
- package/routes/agents.js.map +1 -1
- package/routes/agui.d.ts.map +1 -1
- package/routes/agui.js +44 -1
- package/routes/agui.js.map +1 -1
- package/routes/gitVersions.d.ts.map +1 -1
- package/routes/gitVersions.js +80 -1
- package/routes/gitVersions.js.map +1 -1
- package/routes/marketplaceSkills.d.ts +18 -0
- package/routes/marketplaceSkills.d.ts.map +1 -0
- package/routes/marketplaceSkills.js +190 -0
- package/routes/marketplaceSkills.js.map +1 -0
- package/routes/plugins.d.ts.map +1 -1
- package/routes/plugins.js +48 -7
- package/routes/plugins.js.map +1 -1
- package/routes/projects.d.ts.map +1 -1
- package/routes/projects.js +34 -0
- package/routes/projects.js.map +1 -1
- package/schemas/a2a.d.ts +35 -4
- package/schemas/a2a.d.ts.map +1 -1
- package/schemas/a2a.js +9 -1
- package/schemas/a2a.js.map +1 -1
- package/services/__tests__/agentImporter.test.js +197 -0
- package/services/__tests__/agentImporter.test.js.map +1 -1
- package/services/__tests__/pluginInstaller.test.js +2 -1
- package/services/__tests__/pluginInstaller.test.js.map +1 -1
- package/services/agentImporter.d.ts +7 -0
- package/services/agentImporter.d.ts.map +1 -1
- package/services/agentImporter.js +57 -4
- package/services/agentImporter.js.map +1 -1
- package/services/builtinMarketplaceService.d.ts +56 -0
- package/services/builtinMarketplaceService.d.ts.map +1 -0
- package/services/builtinMarketplaceService.js +328 -0
- package/services/builtinMarketplaceService.js.map +1 -0
- package/services/claudeSession.d.ts.map +1 -1
- package/services/claudeSession.js +15 -4
- package/services/claudeSession.js.map +1 -1
- package/services/claudeVersionStorage.js +6 -6
- package/services/claudeVersionStorage.js.map +1 -1
- package/services/gitVersionService.d.ts +22 -0
- package/services/gitVersionService.d.ts.map +1 -1
- package/services/gitVersionService.js +117 -19
- package/services/gitVersionService.js.map +1 -1
- package/services/marketplaceSkillService.d.ts +129 -0
- package/services/marketplaceSkillService.d.ts.map +1 -0
- package/services/marketplaceSkillService.js +358 -0
- package/services/marketplaceSkillService.js.map +1 -0
- package/services/marketplaceUpdateService.d.ts.map +1 -1
- package/services/marketplaceUpdateService.js +29 -2
- package/services/marketplaceUpdateService.js.map +1 -1
- package/services/pluginCopyInstall.d.ts +60 -0
- package/services/pluginCopyInstall.d.ts.map +1 -0
- package/services/pluginCopyInstall.js +290 -0
- package/services/pluginCopyInstall.js.map +1 -0
- package/services/pluginInstallStrategy.d.ts +39 -0
- package/services/pluginInstallStrategy.d.ts.map +1 -0
- package/services/pluginInstallStrategy.js +50 -0
- package/services/pluginInstallStrategy.js.map +1 -0
- package/services/pluginInstaller.d.ts +10 -0
- package/services/pluginInstaller.d.ts.map +1 -1
- package/services/pluginInstaller.js +70 -20
- package/services/pluginInstaller.js.map +1 -1
- package/services/pluginParser.d.ts +17 -1
- package/services/pluginParser.d.ts.map +1 -1
- package/services/pluginParser.js +161 -84
- package/services/pluginParser.js.map +1 -1
- package/services/pluginPaths.d.ts +3 -3
- package/services/pluginPaths.d.ts.map +1 -1
- package/services/pluginPaths.js +33 -14
- package/services/pluginPaths.js.map +1 -1
- package/services/pluginScanner.js +2 -2
- package/services/pluginScanner.js.map +1 -1
- package/services/pluginSymlink.d.ts +10 -0
- package/services/pluginSymlink.d.ts.map +1 -1
- package/services/pluginSymlink.js +117 -1
- package/services/pluginSymlink.js.map +1 -1
- package/services/preSendGuard/__tests__/preSendGuard.test.d.ts +2 -0
- package/services/preSendGuard/__tests__/preSendGuard.test.d.ts.map +1 -0
- package/services/preSendGuard/__tests__/preSendGuard.test.js +102 -0
- package/services/preSendGuard/__tests__/preSendGuard.test.js.map +1 -0
- package/services/preSendGuard/configResolver.d.ts +8 -0
- package/services/preSendGuard/configResolver.d.ts.map +1 -0
- package/services/preSendGuard/configResolver.js +181 -0
- package/services/preSendGuard/configResolver.js.map +1 -0
- package/services/preSendGuard/index.d.ts +9 -0
- package/services/preSendGuard/index.d.ts.map +1 -0
- package/services/preSendGuard/index.js +165 -0
- package/services/preSendGuard/index.js.map +1 -0
- package/services/preSendGuard/providers/httpAuditProvider.d.ts +3 -0
- package/services/preSendGuard/providers/httpAuditProvider.d.ts.map +1 -0
- package/services/preSendGuard/providers/httpAuditProvider.js +98 -0
- package/services/preSendGuard/providers/httpAuditProvider.js.map +1 -0
- package/services/preSendGuard/providers/noopProvider.d.ts +3 -0
- package/services/preSendGuard/providers/noopProvider.d.ts.map +1 -0
- package/services/preSendGuard/providers/noopProvider.js +13 -0
- package/services/preSendGuard/providers/noopProvider.js.map +1 -0
- package/services/runFinishedHooks.d.ts +29 -0
- package/services/runFinishedHooks.d.ts.map +1 -0
- package/services/runFinishedHooks.js +57 -0
- package/services/runFinishedHooks.js.map +1 -0
- package/testing/index.d.ts +18 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/index.js +25 -0
- package/testing/index.js.map +1 -0
- package/testing/mockSdkQuery.d.ts +49 -0
- package/testing/mockSdkQuery.d.ts.map +1 -0
- package/testing/mockSdkQuery.js +209 -0
- package/testing/mockSdkQuery.js.map +1 -0
- package/testing/scenarioLoader.d.ts +71 -0
- package/testing/scenarioLoader.d.ts.map +1 -0
- package/testing/scenarioLoader.js +224 -0
- package/testing/scenarioLoader.js.map +1 -0
- package/types/a2a.d.ts +5 -0
- package/types/a2a.d.ts.map +1 -1
- package/types/agents.d.ts +32 -0
- package/types/agents.d.ts.map +1 -1
- package/types/agents.js +1 -0
- package/types/agents.js.map +1 -1
- package/types/engine.d.ts +6 -0
- package/types/engine.d.ts.map +1 -1
- package/types/plugins.d.ts +12 -2
- package/types/plugins.d.ts.map +1 -1
- package/types/preSendGuard.d.ts +51 -0
- package/types/preSendGuard.d.ts.map +1 -0
- package/types/preSendGuard.js +3 -0
- package/types/preSendGuard.js.map +1 -0
- package/utils/__tests__/claudeUtils.test.js +89 -1
- package/utils/__tests__/claudeUtils.test.js.map +1 -1
- package/utils/claudeUtils.d.ts +1 -1
- package/utils/claudeUtils.d.ts.map +1 -1
- package/utils/claudeUtils.js +92 -37
- package/utils/claudeUtils.js.map +1 -1
- package/public/assets/ChatPage-D8buVhfb.js +0 -478
- package/public/assets/GeneralSettingsPage-DYdwai51.js +0 -1
- package/public/assets/PluginsPage-DD92Xk6X.js +0 -12
- package/public/assets/SettingsLayout-LGC-0pQl.js +0 -1
- package/public/assets/UnifiedToolSelector-BP6fuyzG.js +0 -1
- package/public/assets/channel-D9wyZF1L.js +0 -1
- package/public/assets/classDiagram-2ON5EDUG-DwEqkkEb.js +0 -1
- package/public/assets/classDiagram-v2-WZHVMYZB-DwEqkkEb.js +0 -1
- package/public/assets/clone-3wFPaI2j.js +0 -1
- package/public/assets/infoDiagram-F6ZHWCRC-HUfwv_JT.js +0 -2
- package/public/assets/stateDiagram-v2-4FDKWEC3-CmurzrWf.js +0 -1
- package/public/assets/tools-BZTR2NP1.js +0 -1
|
@@ -1,478 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-s7YD2ZcY.js","assets/graph-Bp0jlxBT.js","assets/_baseUniq-B1lmu3qr.js","assets/layout-6bkH32V1.js","assets/_basePickBy-DHabY031.js","assets/clone-3wFPaI2j.js","assets/data-structures-ChC1tqVg.js","assets/monaco-editor-BWfQfpij.js","assets/syntax-highlighting-DGbNjS3S.js","assets/agents-KlPdWQ8K.js","assets/tools-BZTR2NP1.js","assets/ui-components-DjgDPiqV.js","assets/agents-DwCY2K8p.css","assets/useAgents-8KXN6U61.js","assets/useSessions-DOa4-xiB.js","assets/index-f67nhEoX.js","assets/index-gbHlIp96.css","assets/useCommands-DbSH48ba.js","assets/useClaudeVersions-DicHLV6A.js","assets/FileExplorer-x5R0Tcmk.js","assets/UnifiedToolSelector-BP6fuyzG.js","assets/FileBrowser-DboOOM_v.js","assets/ProjectSelector-CybrDbBY.js","assets/cose-bilkent-S5V4N54A-D9ZC6LmB.js","assets/cytoscape.esm-DtBltrT8.js","assets/c4Diagram-YG6GDRKO-gAp3--Ee.js","assets/chunk-TZMSLE5B-BqQ674GC.js","assets/flowDiagram-NV44I4VS-DjCIshpi.js","assets/chunk-FMBD7UC4-BsvfEdnB.js","assets/chunk-55IACEB6-DVsfnY5X.js","assets/chunk-QN33PNHL-DSecsNtM.js","assets/channel-D9wyZF1L.js","assets/erDiagram-Q2GNP2WA-tM4HKBpy.js","assets/gitGraphDiagram-NY62KEGX-B3Uw90Yt.js","assets/chunk-4BX2VUAB-DQVsL-J6.js","assets/chunk-QZHKN3VN-DhvrZSqy.js","assets/treemap-KMMF4GRG-bFxwBWXw.js","assets/ganttDiagram-LVOFAZNH-Q6plkI5G.js","assets/linear-DWoZ6Tbm.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-C4B-KCzX.js","assets/infoDiagram-F6ZHWCRC-HUfwv_JT.js","assets/pieDiagram-ADFJNKIX-8vPxErLm.js","assets/arc-6sRLTBcr.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AYHSOK5B-Pn0NZ9k7.js","assets/xychartDiagram-PRI3JC2R-DG3KmjD-.js","assets/requirementDiagram-UZGBJVZJ-C7u8MiN1.js","assets/sequenceDiagram-WL72ISMW-pXBA2_3B.js","assets/classDiagram-2ON5EDUG-DwEqkkEb.js","assets/chunk-B4BG7PRW-BNmOvuIn.js","assets/classDiagram-v2-WZHVMYZB-DwEqkkEb.js","assets/stateDiagram-FKZM4ZOC-CxZMM1Lf.js","assets/chunk-DI55MBZ5-BkucWe8Y.js","assets/stateDiagram-v2-4FDKWEC3-CmurzrWf.js","assets/journeyDiagram-XKPGCS4Q-CgQogtHU.js","assets/timeline-definition-IT6M3QCI-Crg44TaP.js","assets/mindmap-definition-VGOIOE7T-D5wd9HsH.js","assets/kanban-definition-3W4ZIXB7-Cv7kVxyy.js","assets/sankeyDiagram-TZEHDZUN-C660O4mw.js","assets/diagram-S2PKOQOG-Cu-zjwc9.js","assets/diagram-QEK2KX5R-B348GmS1.js","assets/blockDiagram-VD42YOAC-CYO9EYkJ.js","assets/architectureDiagram-VXUJARFQ-kwdTmjuB.js","assets/diagram-PSM6KHXK-C7jhP5tx.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as d}from"./data-structures-ChC1tqVg.js";import{r as L,g as bh,W as $r}from"./monaco-editor-BWfQfpij.js";import{A as ar,a as gr,o as Hp,u as kh,h as rv,l as qp,d as Up,p as nv,S as sv}from"./agents-KlPdWQ8K.js";import{g as iv,h as Vp,i as Gp,j as Yp,k as av}from"./useAgents-8KXN6U61.js";import{u as Xp}from"./useSessions-DOa4-xiB.js";import{u as fe,B as De,T as Me,b as ov,K as lv,c as cv}from"./tools-BZTR2NP1.js";import{m as tn,S as Yc,aB as uv,o as hv,_ as Kp,I as Xc,b4 as Qp,b5 as Zp,X as es,k as Tt,l as Ht,R as to,L as Qn,C as _n,n as ro,j as ts,Z as no,aV as dv,$ as oc,b6 as fv,b7 as Ra,b8 as Jp,E as gv,az as em,aI as pv,aF as mv,V as wh,b9 as Kc,c as Gd,w as vh,Y as xv,d as Ch,as as Yd,f as Xd,u as tm,aE as cl,v as ul,au as yv,ae as rm,y as nm,P as sm,G as bv,ba as qs,bb as kv,aA as im,aW as wv,r as am,an as vv,bc as Cv,ah as Kd,ac as om,b as lm,z as Qd,af as Sv,ad as Zd}from"./ui-components-DjgDPiqV.js";import{d as _v,o as cm,m as Tv,e as Sh,b as _h,p as Nv,u as Ev}from"./index-f67nhEoX.js";import{u as Qc,f as Zc}from"./useCommands-DbSH48ba.js";import{u as Av}from"./useClaudeVersions-DicHLV6A.js";import{e as Jc,E as eu,F as Jd}from"./FileExplorer-x5R0Tcmk.js";import{c as Ve,h as um}from"./syntax-highlighting-DGbNjS3S.js";import{U as Th}from"./UnifiedToolSelector-BP6fuyzG.js";import{F as Mv}from"./FileBrowser-DboOOM_v.js";import{P as jv}from"./ProjectSelector-CybrDbBY.js";const Iv={showMcpToolSelector:!0,showImageUpload:!0,showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0},Lv={showMcpToolSelector:!1,showImageUpload:!0,showPermissionSelector:!1,showProviderSelector:!1,showModelSelector:!0,showEnvVars:!1};function zi(e){return e==="cursor"?Lv:Iv}async function $v(e){try{const t=await gr(`${ar}/agui/engines/${e}`);return t.ok?await t.json():(console.warn(`[AGUI] Failed to fetch engine info: ${t.status}`),null)}catch(t){return console.warn("[AGUI] Error fetching engine info:",t),null}}const Dv=()=>{const e=L.useCallback(async n=>{const{message:s,engineType:i="claude",workspace:a,sessionId:o,model:l,providerId:c,permissionMode:u,mcpTools:h,envVars:f,timeout:g,onAguiEvent:p,onError:m,abortController:y,agentId:x="claude-code",images:k,channel:v="web"}=n;try{console.log(`🚀 [AGUI] Starting ${i} chat request`);let _,C;i==="cursor"?(_=`${ar}/agui/chat`,C={message:s,engineType:"cursor",workspace:a,timeout:g},o&&(C.sessionId=o),l&&(C.model=l,console.log(`🎯 [AGUI] Cursor model: ${l}`)),k&&k.length>0&&(C.images=k,console.log(`🖼️ [AGUI] Cursor images: ${k.length} image(s)`))):(_=`${ar}/agents/chat`,C={message:s,agentId:x,sessionId:o,projectPath:a,mcpTools:h,permissionMode:u,model:l,claudeVersion:c,envVars:f,images:k,channel:v,outputFormat:"agui"}),console.log(`🚀 [AGUI] Endpoint: ${_}`);const w=await gr(_,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(C),signal:y?.signal});if(!w.ok)throw new Error(`AGUI chat request failed: ${w.status} ${w.statusText}`);const S=w.body?.getReader(),F=new TextDecoder;let A="",T=o||"";if(!S)throw new Error("No response body");for(;;){if(y?.signal.aborted)throw S.cancel(),new DOMException("Request aborted","AbortError");const{done:j,value:M}=await S.read();if(j)break;const P=F.decode(M,{stream:!0});A+=P;const $=A.split(`
|
|
3
|
-
`);A=$.pop()||"";for(const R of $)if(!(!R.trim()||R.startsWith(":"))&&!R.startsWith("event:")&&R.startsWith("data:")){const I=R.slice(5).trim();if(!I)continue;try{const O=JSON.parse(I);O.type==="RUN_STARTED"&&O.threadId&&(T=O.threadId),p&&p(O)}catch{console.warn("[AGUI] Failed to parse event:",I.substring(0,100))}}}return console.log(`✅ [AGUI] Chat completed, sessionId: ${T}`),{sessionId:T,success:!0}}catch(_){return console.error("[AGUI] Chat error:",_),m&&_ instanceof Error&&m(_),{sessionId:o||"",success:!1,error:_ instanceof Error?_.message:String(_)}}},[]),t=L.useCallback(async()=>{try{const n=await gr(`${ar}/agui/engines`);if(!n.ok)throw new Error(`Failed to get engines: ${n.status}`);return(await n.json()).engines||[]}catch(n){return console.error("[AGUI] Failed to get engines:",n),[]}},[]),r=L.useCallback(async(n,s="claude")=>{try{return(await gr(`${ar}/agui/sessions/${n}/interrupt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engineType:s})})).ok}catch(i){return console.error("[AGUI] Failed to interrupt session:",i),!1}},[]);return{sendMessage:e,getEngines:t,interruptSession:r}},ze=Hp((e,t)=>({currentAgent:null,selectedEngine:"claude",engineUICapabilities:zi("claude"),engineModels:[],messages:[],isAiTyping:!1,currentSessionId:null,mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0},pendingUserQuestion:null,activeA2AStreams:{},sidebarCollapsed:!1,setCurrentAgent:r=>e(n=>({currentAgent:r,...n.currentAgent?.id!==r?.id?{messages:[],isAiTyping:!1,currentSessionId:null}:{}})),setSelectedEngine:r=>e(n=>({selectedEngine:r,engineUICapabilities:zi(r),...n.selectedEngine!==r?{messages:[],isAiTyping:!1,currentSessionId:null}:{}})),setEngineUICapabilities:r=>e({engineUICapabilities:r}),setEngineModels:r=>e({engineModels:r}),addMessage:r=>e(n=>({messages:[...n.messages,{...r,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,timestamp:Date.now(),agentId:n.currentAgent?.id||"unknown",messageParts:[]}]})),updateMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,...n}:i)})),addTextPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"text",content:n,order:(i.messageParts||[]).length}]}:i)})),addThinkingPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"thinking",content:n,order:(i.messageParts||[]).length}]}:i)})),updateTextPartInMessage:(r,n,s)=>e(i=>({messages:i.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="text"&&o.id===n?{...o,content:s}:o)}:a)})),updateThinkingPartInMessage:(r,n,s)=>e(i=>({messages:i.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="thinking"&&o.id===n?{...o,content:s}:o)}:a)})),addCompactSummaryPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"compactSummary",content:n,order:(i.messageParts||[]).length}]}:i)})),addCommandPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"command",content:n,order:(i.messageParts||[]).length}]}:i)})),addToolPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"tool",toolData:{...n,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,isExecuting:n.isExecuting??!1},order:(i.messageParts||[]).length}]}:i)})),updateToolPartInMessage:(r,n,s)=>e(i=>({messages:i.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="tool"&&(o.toolData?.id===n||o.toolData?.claudeId===n)?{...o,toolData:o.toolData?{...o.toolData,...s}:void 0}:o)}:a)})),interruptAllExecutingTools:()=>e(r=>({messages:r.messages.map(n=>({...n,messageParts:n.messageParts?.map(s=>s.type==="tool"&&s.toolData?.isExecuting?{...s,toolData:{...s.toolData,isExecuting:!1,isInterrupted:!0}}:s)}))})),setAiTyping:r=>e({isAiTyping:r}),setCurrentSessionId:r=>e({currentSessionId:r}),clearMessages:()=>e({messages:[]}),loadSessionMessages:r=>e({messages:r}),updateMcpStatus:r=>e(n=>({mcpStatus:{...n.mcpStatus,...r,lastUpdated:Date.now()}})),clearMcpStatus:()=>e({mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0}}),setPendingUserQuestion:r=>e({pendingUserQuestion:r}),setA2AStreamStart:(r,n,s)=>e(i=>({activeA2AStreams:{...i.activeA2AStreams,[r]:{sessionId:n,agentUrl:r,message:s,startedAt:Date.now(),isStreaming:!0,events:[]}}})),setA2AStreamEnd:r=>e(n=>{const s=n.activeA2AStreams[r];return s?{activeA2AStreams:{...n.activeA2AStreams,[r]:{...s,isStreaming:!1}}}:n}),addA2AStreamEvent:(r,n)=>e(s=>{const i=s.activeA2AStreams[r];return i?{activeA2AStreams:{...s.activeA2AStreams,[r]:{...i,events:[...i.events,n]}}}:{activeA2AStreams:{...s.activeA2AStreams,[r]:{sessionId:n.sessionId||"",agentUrl:r,message:"",startedAt:Date.now(),isStreaming:!0,events:[n]}}}}),getA2AStreamByUrl:r=>t().activeA2AStreams[r],setSidebarCollapsed:r=>e({sidebarCollapsed:r})}));class ft{static instance;static STORAGE_KEY="active_chat_tabs";static WAKEUP_SIGNAL_KEY="tab_wakeup_signal";static WAKEUP_RESPONSE_KEY="tab_wakeup_response";static TAB_TIMEOUT=300*1e3;currentTabId;cleanupInterval;lastKnownSession=null;sessionResumeHistory=[];constructor(){this.currentTabId=this.generateTabId(),this.startCleanupTimer(),this.setupBeforeUnloadHandler(),console.log(`📱 TabManager initialized with ID: ${this.currentTabId}`)}static getInstance(){return ft.instance||(ft.instance=new ft),ft.instance}registerCurrentTab(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r),i={agentId:t,sessionId:r,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title};n[s]=i,this.saveActiveTabs(n),console.log(`📱 Tab registered: ${this.currentTabId} for session ${r}`),this.lastKnownSession={agentId:t,sessionId:r}}updateCurrentTabActivity(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r);n[s]&&n[s].tabId===this.currentTabId&&(n[s].lastSeen=Date.now(),n[s].url=window.location.href,n[s].title=document.title,this.saveActiveTabs(n),this.lastKnownSession={agentId:t,sessionId:r})}hasActiveTab(t,r){return this.findActiveTabForSession(t,r)!==null}findActiveTabForSession(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r);if(n[s]&&Date.now()-n[s].lastSeen<ft.TAB_TIMEOUT)return n[s];for(const[i,a]of Object.entries(n))if(a.agentId===t&&a.sessionId===r){if(Date.now()-a.lastSeen<ft.TAB_TIMEOUT)return a;delete n[i],this.saveActiveTabs(n),console.log(`🗑️ Cleaned up expired tab: ${r}`)}return null}async wakeupExistingTab(t,r,n){if(!this.findActiveTabForSession(t,r))return!1;const i={type:"WAKEUP",agentId:t,sessionId:r,requestId:this.generateRequestId(),timestamp:Date.now(),sourceUrl:n||window.location.href};return console.log(`🔔 Sending wakeup signal for session: ${r}`),localStorage.setItem(ft.WAKEUP_SIGNAL_KEY,JSON.stringify(i)),new Promise(a=>{const o=setTimeout(()=>{console.log(`⏰ Wakeup timeout for session ${r}`),a(!1)},2e3),c=setInterval(()=>{const u=localStorage.getItem(ft.WAKEUP_RESPONSE_KEY);if(u)try{const h=JSON.parse(u);if(h.requestId===i.requestId){clearTimeout(o),localStorage.removeItem(ft.WAKEUP_RESPONSE_KEY),console.log(`✅ Tab awakened successfully: ${r}`),a(h.success);return}}catch(h){console.error("Error parsing wakeup response:",h)}},100);setTimeout(()=>clearInterval(c),2e3)})}setupWakeupListener(t,r){const n=i=>{if(i.key===ft.WAKEUP_SIGNAL_KEY&&i.newValue)try{const a=JSON.parse(i.newValue);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&this.handleWakeupSignal(a)}catch(a){console.error("Error handling wakeup signal:",a)}};window.addEventListener("storage",n);const s=setInterval(()=>{const i=localStorage.getItem(ft.WAKEUP_SIGNAL_KEY);if(i)try{const a=JSON.parse(i);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&Date.now()-a.timestamp<5e3&&this.handleWakeupSignal(a)}catch(a){console.error("Error polling wakeup signal:",a)}},500);return console.log(`🎯 Wakeup listener setup for session: ${r}`),()=>{window.removeEventListener("storage",n),clearInterval(s),console.log(`🎯 Wakeup listener cleaned up for session: ${r}`)}}updateCurrentTabSession(t,r,n,s){const i=this.getActiveTabs(),a=this.getTabKey(t,r);i[a]&&i[a].tabId===this.currentTabId&&delete i[a];const o=this.getTabKey(n,s);i[o]={agentId:n,sessionId:s,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(i),console.log(`🔄 Tab session updated: ${r} → ${s}`),this.lastKnownSession={agentId:n,sessionId:s}}unregisterCurrentTabSession(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r);n[s]&&n[s].tabId===this.currentTabId&&(delete n[s],this.saveActiveTabs(n),console.log(`📤 Unregistered current tab from session: ${r}`)),this.lastKnownSession&&this.lastKnownSession.agentId===t&&this.lastKnownSession.sessionId===r&&(this.lastKnownSession=null)}handleSessionResume(t,r,n){const s=this.getActiveTabs(),i=this.getTabKey(t,r),a=this.getTabKey(t,n);s[i]&&s[i].tabId===this.currentTabId?(delete s[i],s[a]={agentId:t,sessionId:n,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(s),console.log(`🔄 Session resumed: ${r} → ${n}`),this.lastKnownSession={agentId:t,sessionId:n}):(this.registerCurrentTab(t,n),console.log(`🆕 Resumed session registered: ${n}`))}recordSessionResume(t,r,n){this.sessionResumeHistory.push({originalSessionId:r,newSessionId:n,timestamp:Date.now(),agentId:t}),this.sessionResumeHistory.length>100&&(this.sessionResumeHistory=this.sessionResumeHistory.slice(-100)),console.log(`📝 Recorded session resume: ${r} → ${n}`)}smartUpdateCurrentTab(){const t=window.location.href,r=this.parseSessionFromUrl(t);if(!r){this.lastKnownSession&&(this.unregisterCurrentTabSession(this.lastKnownSession.agentId,this.lastKnownSession.sessionId),this.lastKnownSession=null);return}const{agentId:n,sessionId:s}=r;if(this.lastKnownSession){const{agentId:i,sessionId:a}=this.lastKnownSession;a!==s||i!==n?this.sessionResumeHistory.find(l=>l.originalSessionId===a&&l.newSessionId===s&&l.agentId===n&&Date.now()-l.timestamp<3e4)?(this.handleSessionResume(n,a,s),console.log(`🔄 Detected session resume via URL: ${a} → ${s}`)):(this.updateCurrentTabSession(i,a,n,s),console.log(`🎯 Regular session switch: ${a} → ${s}`)):this.updateCurrentTabActivity(n,s)}else this.registerCurrentTab(n,s),console.log(`🎯 Initial session register: ${s}`);this.lastKnownSession={agentId:n,sessionId:s}}startSmartMonitoring(){this.smartUpdateCurrentTab();const t=()=>{setTimeout(()=>this.smartUpdateCurrentTab(),100)};window.addEventListener("popstate",t);const r=history.pushState,n=history.replaceState;return history.pushState=function(...s){r.apply(this,s),t()},history.replaceState=function(...s){n.apply(this,s),t()},console.log(`🎯 Smart monitoring started for tab: ${this.currentTabId}`),()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=n,console.log(`🛑 Smart monitoring stopped for tab: ${this.currentTabId}`)}}handleWakeupSignal(t){console.log(`🔔 Received wakeup signal for session: ${t.sessionId}`);try{if(window.focus(),window.parent&&window.parent!==window&&window.parent.focus(),document.hidden){const n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}}catch(n){console.log("Focus attempt failed:",n)}this.flashPageTitle(),this.playNotificationSound(),t.sourceUrl&&t.sourceUrl!==window.location.href?this.isSameSession(t.sourceUrl,window.location.href)?(console.log("🎯 URLs point to same session, forcing visibility"),this.makePageVisible()):(console.log(`🔄 Navigating to: ${t.sourceUrl}`),window.history.replaceState(null,"",t.sourceUrl),window.location.reload()):this.makePageVisible();const r={requestId:t.requestId,agentId:t.agentId,sessionId:t.sessionId,success:!0,timestamp:Date.now()};localStorage.setItem(ft.WAKEUP_RESPONSE_KEY,JSON.stringify(r)),localStorage.removeItem(ft.WAKEUP_SIGNAL_KEY),this.updateCurrentTabActivity(t.agentId,t.sessionId),console.log(`✅ Wakeup signal processed successfully for session: ${t.sessionId}`)}flashPageTitle(){const t=document.title;let r=0;const n=setInterval(()=>{document.title=r%2===0?"🔔 会话已唤起":t,r++,r>6&&(clearInterval(n),document.title=t)},500),s=()=>{clearInterval(n),document.title=t,window.removeEventListener("focus",s)};window.addEventListener("focus",s)}playNotificationSound(){try{const t=new(window.AudioContext||window.webkitAudioContext),r=t.createOscillator(),n=t.createGain();r.connect(n),n.connect(t.destination),r.frequency.setValueAtTime(800,t.currentTime),r.frequency.setValueAtTime(600,t.currentTime+.1),n.gain.setValueAtTime(.1,t.currentTime),n.gain.exponentialRampToValueAtTime(.01,t.currentTime+.2),r.start(t.currentTime),r.stop(t.currentTime+.2)}catch(t){console.log("Audio notification not supported:",t)}}makePageVisible(){try{window.scrollTo(0,0),document.fullscreenEnabled&&document.documentElement.requestFullscreen?.()?.then(()=>{setTimeout(()=>{document.exitFullscreen?.()},100)}).catch(n=>console.log("Fullscreen toggle failed:",n));const t=document.createElement("div");t.style.cssText=`
|
|
4
|
-
position: fixed;
|
|
5
|
-
top: 50%;
|
|
6
|
-
left: 50%;
|
|
7
|
-
transform: translate(-50%, -50%);
|
|
8
|
-
background: rgba(59, 130, 246, 0.9);
|
|
9
|
-
color: white;
|
|
10
|
-
padding: 20px 40px;
|
|
11
|
-
border-radius: 12px;
|
|
12
|
-
font-size: 18px;
|
|
13
|
-
font-weight: bold;
|
|
14
|
-
z-index: 999999;
|
|
15
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
|
16
|
-
animation: bounce 0.6s ease-in-out;
|
|
17
|
-
`;const r=document.createElement("style");r.textContent=`
|
|
18
|
-
@keyframes bounce {
|
|
19
|
-
0%, 20%, 53%, 80%, 100% {
|
|
20
|
-
transform: translate(-50%, -50%) translateY(0);
|
|
21
|
-
}
|
|
22
|
-
40%, 43% {
|
|
23
|
-
transform: translate(-50%, -50%) translateY(-20px);
|
|
24
|
-
}
|
|
25
|
-
70% {
|
|
26
|
-
transform: translate(-50%, -50%) translateY(-10px);
|
|
27
|
-
}
|
|
28
|
-
90% {
|
|
29
|
-
transform: translate(-50%, -50%) translateY(-5px);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`,document.head.appendChild(r),t.textContent="🎯 会话已激活",document.body.appendChild(t),setTimeout(()=>{document.body.contains(t)&&document.body.removeChild(t),document.head.contains(r)&&document.head.removeChild(r)},2e3),console.log("🎯 Made page more visible")}catch(t){console.log("Make page visible failed:",t)}}parseSessionFromUrl(t){try{const r=new URL(t),n=r.pathname.split("/"),s=n.indexOf("chat");if(s!==-1&&n[s+1]){const i=n[s+1],a=r.searchParams.get("session");if(i&&a)return{agentId:i,sessionId:a}}return null}catch(r){return console.error("Error parsing session from URL:",r),null}}isSameSession(t,r){try{const n=this.parseSessionFromUrl(t),s=this.parseSessionFromUrl(r);return!n||!s?!1:n.agentId===s.agentId&&n.sessionId===s.sessionId}catch(n){return console.error("Error comparing session URLs:",n),!1}}getActiveTabs(){try{const t=localStorage.getItem(ft.STORAGE_KEY);return t?JSON.parse(t):{}}catch(t){return console.error("Error reading active tabs:",t),{}}}saveActiveTabs(t){try{localStorage.setItem(ft.STORAGE_KEY,JSON.stringify(t))}catch(r){console.error("Error saving active tabs:",r)}}getTabKey(t,r){return`${t}_${r}`}generateTabId(){return`tab_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}generateRequestId(){return`req_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}startCleanupTimer(){this.cleanupInterval=window.setInterval(()=>{this.cleanupExpiredTabs()},6e4)}cleanupExpiredTabs(){const t=this.getActiveTabs(),r=Date.now();let n=0;Object.keys(t).forEach(s=>{r-t[s].lastSeen>ft.TAB_TIMEOUT&&(delete t[s],n++)}),n>0&&(this.saveActiveTabs(t),console.log(`🗑️ Cleaned up ${n} expired tabs`))}setupBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{const t=this.getActiveTabs();Object.keys(t).forEach(r=>{t[r].tabId===this.currentTabId&&delete t[r]}),this.saveActiveTabs(t)})}getDebugInfo(){return{tabs:this.getActiveTabs(),currentTabId:this.currentTabId,lastKnownSession:this.lastKnownSession,resumeHistory:this.sessionResumeHistory}}clearAllTabs(){localStorage.removeItem(ft.STORAGE_KEY),localStorage.removeItem(ft.WAKEUP_SIGNAL_KEY),localStorage.removeItem(ft.WAKEUP_RESPONSE_KEY),this.sessionResumeHistory=[],this.lastKnownSession=null,console.log("🗑️ All tab records cleared")}stopCleanupTimer(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=void 0,console.log("🛑 Cleanup timer stopped"))}}const Fr=ft.getInstance();window.tabManagerDebug={showTabs:()=>console.table(Fr.getDebugInfo().tabs),clearAll:()=>Fr.clearAllTabs(),testWakeup:(e,t)=>Fr.wakeupExistingTab(e,t),getCurrentTabId:()=>Fr.getDebugInfo().currentTabId,getDebugInfo:()=>Fr.getDebugInfo()};const Bv=({agentId:e,sessionId:t,projectPath:r,enabled:n=!0,interval:s=3e4,shouldCheckExistence:i=!1})=>{const a=L.useRef(null),o=L.useRef(0),l=L.useRef(!0),c=L.useRef(!1),u=L.useCallback(async()=>{if(!e||!t)return!1;try{const m=`${ar}/sessions/${e}/${t}/check`,y=await gr(m);if(y.ok){const x=await y.json();return console.log(`🔍 Session existence check: ${t} - ${x.exists?"exists":"not found"}`),x.exists}return!1}catch(m){return console.error("❌ Error checking session existence:",m),!1}},[e,t]),h=L.useCallback(async()=>{if(!(!e||!t||!n))try{const m=`${ar}/sessions/${e}/${t}/heartbeat`,y=await gr(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r,timestamp:Date.now()})});if(y.ok){const x=await y.json();o.current=x.timestamp,console.log(`💓 Session heartbeat sent successfully: ${t}`),Fr.updateCurrentTabActivity(e,t)}else console.warn(`⚠️ Failed to send heartbeat for session ${t}:`,y.status)}catch(m){console.error("💔 Error sending session heartbeat:",m)}},[e,t,r,n]),f=L.useCallback(()=>{l.current=!document.hidden,l.current&&n&&t&&h()},[h,n,t]),g=L.useCallback(async()=>{if(!(!n||!t||a.current)){if(i&&!c.current){const m=await u();if(c.current=!0,!m){console.log(`⏸️ Session ${t} not found in SessionManager, heartbeat not started`);return}}console.log(`💓 Starting heartbeat for session: ${t}`),h(),a.current=setInterval(()=>{h()},s)}},[n,t,h,s,i,u]),p=L.useCallback(()=>{a.current&&(console.log(`💔 Stopping heartbeat for session: ${t}`),clearInterval(a.current),a.current=null)},[t]);return L.useEffect(()=>(c.current=!1,t&&n?g():p(),()=>{p()}),[t,n,g,p]),L.useEffect(()=>(document.addEventListener("visibilitychange",f),()=>{document.removeEventListener("visibilitychange",f)}),[f]),L.useEffect(()=>()=>{p()},[p]),{sendHeartbeat:h,startHeartbeat:g,stopHeartbeat:p,checkSessionExists:u,lastHeartbeat:o.current}},hm=({agentId:e,sessionId:t,projectPath:r,enabled:n=!0,interval:s=3e4,isNewSession:i=!1,hasSuccessfulResponse:a=!1})=>{const o=L.useRef(null),l=L.useRef(!1),c=!t||!n?!1:i?a:!0,h=Bv({agentId:e,sessionId:t,projectPath:r,enabled:c,interval:s,shouldCheckExistence:!i&&!!t});return L.useEffect(()=>{o.current!==t&&(l.current=!1,o.current=t)},[t]),L.useEffect(()=>{c&&t&&!l.current&&(l.current=!0,console.log(`🚀 Heartbeat enabled for session: ${t} (new: ${i}, hasResponse: ${a})`))},[c,t,i,a]),{...h,isHeartbeatActive:c&&l.current}},dm=()=>{const[e,t]=L.useState(!1);return L.useEffect(()=>{const r=()=>{t(window.innerWidth<640)};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),{isCompactMode:e}},fm=({isOpen:e,onToggle:t,sessions:r,currentSessionId:n,onSwitchSession:s,isLoading:i=!1,searchTerm:a,onSearchChange:o})=>{const{t:l}=fe("components"),c=L.useRef(null),u=L.useRef(null);L.useEffect(()=>{console.log("🎯 [DROPDOWN DEBUG] SessionsDropdown sessions updated:",{sessionCount:r.length,currentSessionId:n,searchTerm:a,sessions:r.map((f,g)=>({index:g+1,id:f.id,title:f.title,lastUpdated:f.lastUpdated,messageCount:f.messageCount,isCurrent:f.id===n}))})},[r,n,a]),L.useEffect(()=>{const f=g=>{c.current&&!c.current.contains(g.target)&&t()};return e&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[e,t]),L.useEffect(()=>{e&&u.current&&setTimeout(()=>u.current?.focus(),100)},[e]);const h=r;return e?d.jsxs("div",{ref:c,className:"absolute top-full right-0 mt-1 w-80 bg-white rounded-lg shadow-lg border border-gray-200 z-50",children:[d.jsx("div",{className:"flex items-center justify-between p-3 border-b border-gray-100",children:d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(tn,{className:"w-4 h-4 text-gray-600"}),d.jsx("span",{className:"text-sm font-medium text-gray-900",children:l("sessionDropdown.sessionHistory")})]})}),d.jsx("div",{className:"p-3 border-b border-gray-100",children:d.jsxs("div",{className:"relative",children:[d.jsx(Yc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),d.jsx("input",{ref:u,type:"text",value:a,onChange:f=>o(f.target.value),placeholder:l("sessionDropdown.searchPlaceholder"),className:"w-full pl-9 pr-3 py-2 text-sm text-gray-900 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent placeholder-gray-500"})]})}),d.jsx("div",{className:"max-h-80 overflow-y-auto",children:i?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-600"})}):h.length>0?d.jsx("div",{className:"py-2",children:h.map((f,g)=>d.jsxs("div",{onClick:()=>{console.log(`🖱️ [DROPDOWN DEBUG] Clicking session ${g+1}:`,{id:f.id,title:f.title,isCurrent:f.id===n}),s(f.id)},className:`mx-2 px-3 py-2 rounded cursor-pointer hover:bg-gray-50 transition-colors ${n===f.id?"bg-blue-50 border border-blue-200":"border border-transparent"}`,children:[d.jsxs("div",{className:"text-sm font-medium text-gray-900 truncate",title:`ID: ${f.id}`,children:[g+1,". ",f.title]}),d.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[l("sessionDropdown.messageCount",{count:f.messageCount})," • ",new Date(f.lastUpdated).toLocaleString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]},f.id))}):d.jsx("div",{className:"text-center py-8",children:a?d.jsxs("div",{children:[d.jsx(Yc,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),d.jsx("p",{className:"text-sm text-gray-500",children:l("sessionDropdown.noMatchingSessions")})]}):d.jsxs("div",{children:[d.jsx(tn,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),d.jsx("p",{className:"text-sm text-gray-500",children:l("sessionDropdown.noSessionHistory")}),d.jsx("p",{className:"text-xs text-gray-400 mt-1",children:l("sessionDropdown.sessionWillAppear")})]})})})]}):null};function Rv(e,t){return t?e.replace(/@([\w.-]+(?:\/[\w.-]+)*(?:\.\w+)?)/g,(r,n)=>n.startsWith("/")?n:t+"/"+n):e}function Pv(e,t,r){let n=e.content;return t&&(n=n.replace(/\$ARGUMENTS/g,t)),n=Rv(n,r),`<command-message>${t?`${e.description} (参数: ${t})`:e.description}</command-message><command-name>${n}</command-name>`}function Wi(e){return e.startsWith("/")}function Fv(e){return e.startsWith("/")?e.slice(1):""}const gm=({textareaRef:e,inputMessage:t,setInputMessage:r})=>{const[n,s]=L.useState([]),[i,a]=L.useState(null),[o,l]=L.useState(!1),c=L.useCallback(_=>{if(!e.current)return;const C=e.current,w=C.selectionStart||0,S=C.selectionEnd||0,F=t,A=F.substring(0,w)+_+F.substring(S);r(A),setTimeout(()=>{C.selectionStart=C.selectionEnd=w+_.length,C.focus()},0)},[t,r,e]),u=L.useCallback(_=>{const C=Date.now().toString()+Math.random().toString(36).substr(2,9),w=new FileReader;w.onload=S=>{S.target?.result&&s(F=>{const A=[...F,{id:C,file:_,preview:S.target.result}],j=`[image${A.length}]`;return c(j),A})},w.readAsDataURL(_)},[c]),h=L.useCallback(_=>{const C=_.target.files;if(!C)return;Array.from(C).filter(S=>S.type.startsWith("image/")&&["image/jpeg","image/png","image/gif","image/webp"].includes(S.type)).forEach(u),_.target&&(_.target.value="")},[u]),f=L.useCallback(_=>{s(C=>C.filter(w=>w.id!==_))},[]),g=L.useCallback(_=>{a(_)},[]),p=L.useCallback(_=>{const C=_.clipboardData?.items;if(!C)return;let w=!1;for(let S=0;S<C.length;S++){const F=C[S];if(F.type.startsWith("image/")){w=!0;const A=F.getAsFile();A&&u(A)}}w&&_.preventDefault()},[u]),m=L.useCallback(_=>{_.preventDefault(),l(!0)},[]),y=L.useCallback(_=>{_.preventDefault(),l(!1)},[]),x=L.useCallback(_=>{_.preventDefault(),l(!1);const C=_.dataTransfer?.files;if(!C)return;Array.from(C).filter(S=>S.type.startsWith("image/")&&["image/jpeg","image/png","image/gif","image/webp"].includes(S.type)).forEach(u)},[u]),k=L.useCallback(()=>{s([])},[]),v=L.useCallback(()=>n.map(_=>({id:_.id,data:_.preview.split(",")[1],mediaType:_.file.type,name:_.file.name})),[n]);return{selectedImages:n,previewImage:i,isDragOver:o,handleImageSelect:h,handleImageRemove:f,handleImagePreview:g,handlePaste:p,handleDragOver:m,handleDragLeave:y,handleDrop:x,clearImages:k,getImagesForBackend:v,setPreviewImage:a}},pm=({messagesContainerRef:e,messagesEndRef:t,messages:r,isAiTyping:n})=>{const[s,i]=L.useState(!1),[a,o]=L.useState(0),l=L.useCallback((h=100)=>{if(!e.current)return!1;const{scrollTop:f,scrollHeight:g,clientHeight:p}=e.current;return g-f-p<h},[e]),c=L.useCallback((h="smooth")=>{t.current?.scrollIntoView({behavior:h})},[t]),u=L.useCallback(()=>{const h=l();i(!h),h&&o(0)},[l]);return L.useEffect(()=>{const h=e.current;if(h)return h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)},[u,e]),L.useEffect(()=>{s?o(h=>h+1):c()},[r,n,s,c]),{isUserScrolling:s,newMessagesCount:a,scrollToBottom:c,setNewMessagesCount:o,setIsUserScrolling:i}},mm=({projectPath:e,textareaRef:t})=>{const{t:r}=fe("components"),[n,s]=L.useState(!1),[i,a]=L.useState(""),[o,l]=L.useState(null),[c,u]=L.useState(0),[h,f]=L.useState(null),[g,p]=L.useState(!1),[m,y]=L.useState(null),x=[{id:"init",name:"init",description:r("systemCommands.init.description"),content:"/init",scope:"system",isSystem:!0},{id:"clear",name:"clear",description:r("systemCommands.clear.description"),content:"/clear",scope:"system",isSystem:!0},{id:"compact",name:"compact",description:r("systemCommands.compact.description"),content:"/compact",scope:"system",isSystem:!0},{id:"agents",name:"agents",description:r("systemCommands.agents.description"),content:"/agents",scope:"system",isSystem:!0},{id:"settings",name:"settings",description:r("systemCommands.settings.description"),content:"/settings",scope:"system",isSystem:!0},{id:"help",name:"help",description:r("systemCommands.help.description"),content:"/help",scope:"system",isSystem:!0}],{data:k,error:v}=Qc({scope:"user",search:i}),{data:_,error:C}=Zc({projectId:e||"",search:i}),{data:w}=Qc({scope:"user"}),{data:S}=Zc({projectId:e||""}),F=Array.isArray(k?.commands)?k.commands:[],A=Array.isArray(_?.commands)?_.commands:[],T=Array.isArray(w?.commands)?w.commands:[],j=Array.isArray(S?.commands)?S.commands:[],M=L.useCallback(D=>{const X=x.find(V=>V.name===D),N=j.find(V=>V.name===D),B=T.find(V=>V.name===D);return!!(X||N||B)},[x,j,T]),P=L.useCallback(()=>{const D=x.map(B=>B.content),X=j.map(B=>`/${B.name}`),N=T.map(B=>`/${B.name}`);return[...D,...X,...N].join(", ")},[x,j,T]),$=v||C,R=L.useMemo(()=>[...x.filter(X=>X.name.toLowerCase().includes(i.toLowerCase())||X.description.toLowerCase().includes(i.toLowerCase())),...A,...F],[F,A,i,x]);L.useEffect(()=>{u(D=>R.length>0&&D>=R.length?0:D)},[R.length]);const I=L.useCallback(D=>{if(h&&f(null),D.length>0&&D[D.length-1]==="@"){const X=D.substring(0,D.length-1);if(X.length===0||/\s$/.test(X)){y(D.length-1),p(!0),t.current?.blur();return}}},[h,t]),O=L.useCallback(D=>(l(D),s(!1),`/${D.name}`),[]),W=L.useCallback(()=>{s(!1)},[]),Z=L.useCallback((D,X)=>{if(!t.current||m===null)return X;let N=D;e&&D.startsWith(e)&&(N=D.slice(e.length),N.startsWith("/")&&(N=N.slice(1)));const B=X.substring(0,m),V=X.substring(m+1),H=B+"@"+N+" "+V;return p(!1),y(null),setTimeout(()=>{if(t.current){const q=m+1+N.length+1;t.current.selectionStart=t.current.selectionEnd=q,t.current.focus()}},0),H},[m,e,t]),E=L.useCallback(()=>{p(!1),y(null),setTimeout(()=>{t.current?.focus()},0)},[t]);return{showCommandSelector:n,commandSearch:i,selectedCommand:o,selectedCommandIndex:c,commandWarning:h,showFileBrowser:g,atSymbolPosition:m,allCommands:R,SYSTEM_COMMANDS:x,userCommands:T,projectCommands:j,hasCommandsLoadError:$,userCommandsError:v,projectCommandsError:C,setSelectedCommand:l,setSelectedCommandIndex:u,setCommandWarning:f,setShowCommandSelector:s,setShowFileBrowser:p,setAtSymbolPosition:y,setCommandSearch:a,handleInputChange:I,handleCommandSelect:O,handleCommandSelectorClose:W,handleFileSelect:Z,handleFileBrowserClose:E,isCommandDefined:M,getAllAvailableCommands:P}},xm=({agent:e})=>{const[t,r]=L.useState(!1),[n,s]=L.useState([]),[i,a]=L.useState([]),[o,l]=L.useState(!1),[c,u]=L.useState("bypassPermissions"),[h,f]=L.useState("sonnet"),[g,p]=L.useState(!1),[m,y]=L.useState(!1),[x,k]=L.useState(void 0),[v,_]=L.useState(!1),[C,w]=L.useState(!1),[S,F]=L.useState({});return L.useEffect(()=>{if(e?.allowedTools?.length>0){const A=e.allowedTools.filter(M=>M.enabled),T=[],j=[];A.forEach(M=>{if(M.name.includes(".")&&!M.name.startsWith("mcp__")){const[P,$]=M.name.split("."),R=`mcp__${P}__${$}`;j.push(R)}else M.name.startsWith("mcp__")?j.push(M.name):T.push(M.name)}),s(T),a(j),l(j.length>0)}},[e?.allowedTools]),{showToolSelector:t,selectedRegularTools:n,selectedMcpTools:i,mcpToolsEnabled:o,permissionMode:c,selectedModel:h,showPermissionDropdown:g,showModelDropdown:m,selectedClaudeVersion:x,showVersionDropdown:v,isVersionLocked:C,setShowToolSelector:r,setSelectedRegularTools:s,setSelectedMcpTools:a,setMcpToolsEnabled:l,setPermissionMode:u,setSelectedModel:f,setShowPermissionDropdown:p,setShowModelDropdown:y,setSelectedClaudeVersion:k,setShowVersionDropdown:_,setIsVersionLocked:w,envVars:S,setEnvVars:F}},ym=({initialModel:e="sonnet",initialVersion:t,skipModelValidation:r=!1})=>{const{data:n}=Av(),[s,i]=L.useState(e),[a,o]=L.useState(t),[l,c]=L.useState(!1),u=L.useMemo(()=>{if(!n?.versions)return[];if(a){const y=n.versions.find(k=>k.id===a),x=y?.models||[];return console.log(`📦 availableModels computed: selectedClaudeVersion=${a}, found version=${y?.name}, models=`,x.map(k=>k.id)),x}const p=n.versions.find(y=>y.id===n.defaultVersionId)||n.versions[0],m=p?.models||[];return console.log(`📦 availableModels computed (using default): defaultVersion=${p?.name}, models=`,m.map(y=>y.id)),m},[n,a]);return L.useEffect(()=>{r||u.length>0&&(u.some(m=>m.id===s)||(console.log(`🔄 Model validation: selectedModel=${s} is not in availableModels:`,u.map(m=>m.id),`selectedClaudeVersion=${a}, resetting to ${u[0].id}`),i(u[0].id)))},[u,s,a,r]),{claudeVersionsData:n,availableModels:u,selectedModel:s,selectedClaudeVersion:a,isVersionLocked:l,setSelectedModel:i,setSelectedClaudeVersion:o,setIsVersionLocked:c,handleVersionChange:p=>{o(p);const m=n?.versions.find(y=>y.id===p);m&&m.models&&m.models.length>0&&i(m.models[0].id)},handleModelChange:p=>{i(p)},resetToDefaults:()=>{o(void 0),i(e),c(!1)}}},Ov={activeTasks:new Map},tu=Hp((e,t)=>({...Ov,registerTaskTool:(r,n)=>{console.log("📋 [SubAgentStore] Registering Task tool:",r,"sessionId:",n),e(s=>{const i=new Map(s.activeTasks);return i.has(r)||i.set(r,{parentToolUseId:r,sessionId:n,messageFlow:[],startedAt:Date.now(),lastUpdatedAt:Date.now()}),{activeTasks:i}})},activateSubAgent:(r,n)=>{if(t().activeTasks.has(r)){console.log("📋 [SubAgentStore] SubAgent already active for:",r);return}console.log("📋 [SubAgentStore] Activating SubAgent for parentToolUseId:",r),e(i=>{const a=new Map(i.activeTasks);return a.set(r,{parentToolUseId:r,sessionId:n,messageFlow:[],startedAt:Date.now(),lastUpdatedAt:Date.now()}),{activeTasks:a}})},addSubAgentMessagePart:(r,n)=>{e(s=>{if(!s.activeTasks.get(r)){console.log("📋 [SubAgentStore] Creating new task for parentToolUseId:",r);const u=new Map(s.activeTasks);return u.set(r,{parentToolUseId:r,sessionId:"",messageFlow:[{id:`msg_${r}_${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[n]}],startedAt:Date.now(),lastUpdatedAt:Date.now()}),{activeTasks:u}}const a=new Map(s.activeTasks),o=a.get(r),l=o.messageFlow.findIndex(u=>u.messageParts.some(h=>h.id===n.id));let c;if(l>=0)c=o.messageFlow.map((u,h)=>h===l?{...u,messageParts:u.messageParts.map(f=>f.id===n.id?n:f)}:u);else{const u=o.messageFlow[o.messageFlow.length-1];u&&u.role==="assistant"?c=[...o.messageFlow.slice(0,-1),{...u,messageParts:[...u.messageParts,n]}]:c=[...o.messageFlow,{id:`msg_${r}_${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[n]}]}return a.set(r,{...o,messageFlow:c,lastUpdatedAt:Date.now()}),console.log("📋 [SubAgentStore] Added message part to",r,"type:",n.type,"total parts:",c.reduce((u,h)=>u+h.messageParts.length,0)),{activeTasks:a}})},getSubAgentMessageFlow:r=>t().activeTasks.get(r)?.messageFlow||[],clearSubAgentTask:r=>{console.log("📋 [SubAgentStore] Clearing SubAgent task:",r),e(n=>{const s=new Map(n.activeTasks);return s.delete(r),{activeTasks:s}})},reset:()=>{console.log("📋 [SubAgentStore] Resetting state"),e({activeTasks:new Map})}})),zv=({agentId:e,currentSessionId:t,projectPath:r,isCompactCommand:n=!1,abortControllerRef:s,onSessionChange:i,setIsInitializingSession:a,setCurrentSessionId:o,setIsNewSession:l,setAiTyping:c,setHasSuccessfulResponse:u})=>{const{t:h}=fe("components"),f=kh(),{addMessage:g,addTextPartToMessage:p,addThinkingPartToMessage:m,updateTextPartInMessage:y,updateThinkingPartInMessage:x,addToolPartToMessage:k,updateToolPartInMessage:v,updateMcpStatus:_,setPendingUserQuestion:C,setA2AStreamStart:w,setA2AStreamEnd:S,addA2AStreamEvent:F}=ze(),A=L.useRef(null),T=L.useRef(new Map),j=L.useRef({activeBlocks:new Map,currentMessageId:null,isStreaming:!1,wasStreamProcessed:!1,pendingUpdate:null,rafId:null}),M=L.useCallback((E,D,X)=>{const N=j.current;N.pendingUpdate={blockId:E,content:D,type:X},N.rafId===null&&(N.rafId=requestAnimationFrame(()=>{const B=N.pendingUpdate,V=A.current;if(!B||!V){N.rafId=null;return}const H=N.activeBlocks.get(B.blockId);if(!H||!H.partId){console.warn("🌊 [STREAMING] No partId found for block:",B.blockId),N.rafId=null;return}B.type==="text"?y(V,H.partId,B.content):B.type==="thinking"&&x(V,H.partId,B.content),N.pendingUpdate=null,N.rafId=null}))},[y,x]),P=L.useCallback((E,D)=>`${E}-${Date.now()}-${D}`,[]),{registerTaskTool:$,activateSubAgent:R,addSubAgentMessagePart:I}=tu.getState(),O=L.useCallback(E=>{try{const D=E;D.type==="system"&&D.subtype==="init"&&console.log("📋 [INIT] Received system init message, not intercepting");const X=D.isSidechain===!0,N=D.parentToolUseId;if(X&&N){console.log("🎯 [SIDECHAIN] Intercepted sub-agent message, parentToolUseId:",N,"type:",D.type);const B=N,V=D.sessionId||D.session_id;if(V&&R(B,V),D.type==="stream_event"&&D.event){const H=D.event;if(H.type==="content_block_start"&&H.content_block){const q=H.index,Y=H.content_block;if(Y.type==="text"){const J=`part_${B}_text_${q}_${Date.now()}`;I(B,{id:J,type:"text",content:"",order:q}),T.current.set(`${B}-${q}`,J),console.log("🎯 [SIDECHAIN] Started text block:",J)}else if(Y.type==="thinking"){const J=`part_${B}_thinking_${q}_${Date.now()}`;I(B,{id:J,type:"thinking",content:"",order:q}),T.current.set(`${B}-${q}`,J)}else if(Y.type==="tool_use"){const J=`part_${B}_tool_${q}_${Date.now()}`;I(B,{id:J,type:"tool",toolData:{id:Y.id,toolName:Y.name,toolInput:{},isError:!1},order:q}),T.current.set(`${B}-${q}`,J),console.log("🎯 [SIDECHAIN] Added tool_use to sub-agent:",Y.name)}}if(H.type==="content_block_delta"&&H.delta){const q=H.index,Y=H.delta,J=T.current.get(`${B}-${q}`);if(J){const we=tu.getState().activeTasks.get(B);if(we)for(const Ne of we.messageFlow){const Ce=Ne.messageParts.find(Le=>Le.id===J);if(Ce){if(Y.type==="text_delta"&&Y.text){const Le=(Ce.content||"")+Y.text;I(B,{...Ce,content:Le}),Le.length%100<10&&console.log("🎯 [SIDECHAIN] Text accumulated:",Le.length,"chars")}else if(Y.type==="thinking_delta"&&Y.thinking){const Le=(Ce.content||"")+Y.thinking;I(B,{...Ce,content:Le})}break}}}}}if(D.type==="assistant"&&D.message){const H=D.message;if(console.log("🎯 [SIDECHAIN] Processing assistant message, blocks:",H.content?.length||0),H.content&&Array.isArray(H.content))for(let q=0;q<H.content.length;q++){const Y=H.content[q];Y.type==="text"&&Y.text?(console.log("🎯 [SIDECHAIN] Adding text from assistant:",Y.text.substring(0,50)),I(B,{id:`part_${B}_text_${q}_${Date.now()}`,type:"text",content:Y.text,order:q})):Y.type==="thinking"&&Y.thinking?I(B,{id:`part_${B}_thinking_${q}_${Date.now()}`,type:"thinking",content:Y.thinking,order:q}):Y.type==="tool_use"&&(I(B,{id:`part_${B}_tool_${q}_${Date.now()}`,type:"tool",toolData:{id:Y.id,toolName:Y.name,toolInput:Y.input||{},isError:!1},order:q}),console.log("🎯 [SIDECHAIN] Added tool_use from assistant:",Y.name))}}if(D.type==="user"&&D.message){const H=D.message;if(H.content&&Array.isArray(H.content))for(const q of H.content){const Y=q;if(Y.type==="text"){console.log("🎯 [SIDECHAIN] Skipping user text (task prompt already shown)");continue}Y.type==="tool_result"&&Y.tool_use_id&&console.log("🎯 [SIDECHAIN] Tool result for:",Y.tool_use_id,"error:",Y.is_error)}}return}if(D.type==="stream_event"&&D.event){const B=D.event;if(console.log("🌊 [STREAMING] Detected stream_event:",B.type,"Full event:",JSON.stringify(D).substring(0,200)),j.current.wasStreamProcessed=!0,B.type==="message_start"){if(A.current)console.log("🌊 [STREAMING] message_start: AI message already exists, skipping:",A.current);else{g({content:"",role:"assistant"});const H=ze.getState();A.current=H.messages[H.messages.length-1].id,j.current.currentMessageId=A.current,j.current.isStreaming=!0,console.log("🌊 [STREAMING] message_start: Created new AI message with ID:",A.current)}return}if(B.type==="content_block_start"){const V=B.index,H=B.content_block;if(!A.current){g({content:"",role:"assistant"});const re=ze.getState();A.current=re.messages[re.messages.length-1].id,j.current.currentMessageId=A.current,j.current.isStreaming=!0}const q=`block-${A.current}-${V}`,Y=Date.now();if(j.current.activeBlocks.has(q)){console.warn("🌊 [STREAMING] content_block_start: Block already exists, skipping:",q);return}if(H.type==="text"){p(A.current,"");const re=ze.getState().messages.find(Le=>Le.id===A.current),Ne=re?.messageParts?.[re.messageParts.length-1]?.id,Ce={blockId:q,type:"text",content:"",isComplete:!1,messageId:A.current,partId:Ne,startedAt:Y,lastUpdatedAt:Y};j.current.activeBlocks.set(q,Ce),console.log("🌊 [STREAMING] content_block_start: Initialized text block",q,"partId:",Ne)}else if(H.type==="thinking"){m(A.current,"");const re=ze.getState().messages.find(Le=>Le.id===A.current),Ne=re?.messageParts?.[re.messageParts.length-1]?.id,Ce={blockId:q,type:"thinking",content:"",isComplete:!1,messageId:A.current,partId:Ne,startedAt:Y,lastUpdatedAt:Y};j.current.activeBlocks.set(q,Ce),console.log("🤔 [STREAMING] content_block_start: Initialized thinking block",q,"partId:",Ne)}else if(H.type==="tool_use"){if(console.log("🔧 [STREAMING] content_block_start: Processing tool_use",{toolName:H.name,claudeId:H.id,blockId:q,messageId:A.current}),H.name==="Task"){const re=t||D.sessionId||D.session_id;re&&H.id&&(console.log("🎯 [TASK] Registering Task tool for sub-agent tracking:",H.id),$(H.id,re))}const J={toolName:H.name,toolInput:{},isExecuting:!0,claudeId:H.id};try{k(A.current,J),console.log("🔧 [STREAMING] content_block_start: addToolPartToMessage completed");const re=ze.getState();console.log("🔧 [STREAMING] content_block_start: Got store state, messages count:",re.messages.length);const we=re.messages.find(Xe=>Xe.id===A.current);console.log("🔧 [STREAMING] content_block_start: Found current message:",!!we,"parts count:",we?.messageParts?.length);const Ne=we?.messageParts?.[we.messageParts.length-1];console.log("🔧 [STREAMING] content_block_start: Latest part:",{exists:!!Ne,type:Ne?.type,hasToolData:!!Ne?.toolData,toolDataId:Ne?.toolData?.id});const Ce=Ne?.toolData?.id;Ce||console.error("🔧 [STREAMING] content_block_start: ⚠️ partId is undefined! Latest part:",Ne);const Le={blockId:q,type:"tool_use",content:"",isComplete:!1,messageId:A.current,partId:Ce,startedAt:Y,lastUpdatedAt:Y};j.current.activeBlocks.set(q,Le),console.log("🔧 [STREAMING] content_block_start: ✅ Initialized tool_use block",H.name,"blockId:",q,"partId:",Ce,"claudeId:",H.id)}catch(re){throw console.error("🔧 [STREAMING] content_block_start: ❌ Error processing tool_use:",re),re}}return}if(B.type==="content_block_delta"&&A.current){const V=B.index,H=B.delta,q=`block-${A.current}-${V}`,Y=Date.now();if(H.type==="text_delta"&&H.text!==void 0){let J=j.current.activeBlocks.get(q);if(J)J.content+=H.text,J.lastUpdatedAt=Y,console.log(`🌊 [STREAMING] content_block_delta: Accumulated text delta "${H.text}" to block ${q}, total: "${J.content.substring(0,50)}..."`);else{console.warn("🌊 [STREAMING] content_block_delta: Missing content_block_start for text block, creating fallback"),p(A.current,"");const we=ze.getState().messages.find(Le=>Le.id===A.current),Ce=we?.messageParts?.[we.messageParts.length-1]?.id;J={blockId:q,type:"text",content:H.text,isComplete:!1,messageId:A.current,partId:Ce,startedAt:Y,lastUpdatedAt:Y},j.current.activeBlocks.set(q,J),console.log(`🌊 [STREAMING] content_block_delta: Created text block ${q} (fallback) with partId: ${Ce}, content: "${H.text}"`)}M(q,J.content,"text")}else if(H.type==="thinking_delta"&&H.thinking!==void 0){let J=j.current.activeBlocks.get(q);if(J)J.content+=H.thinking,J.lastUpdatedAt=Y,console.log(`🤔 [STREAMING] content_block_delta: Accumulated thinking delta "${H.thinking}" to block ${q}, total: "${J.content.substring(0,50)}..."`);else{console.warn("🤔 [STREAMING] content_block_delta: Missing content_block_start for thinking block, creating fallback"),m(A.current,"");const we=ze.getState().messages.find(Le=>Le.id===A.current),Ce=we?.messageParts?.[we.messageParts.length-1]?.id;J={blockId:q,type:"thinking",content:H.thinking,isComplete:!1,messageId:A.current,partId:Ce,startedAt:Y,lastUpdatedAt:Y},j.current.activeBlocks.set(q,J),console.log(`🤔 [STREAMING] content_block_delta: Created thinking block ${q} (fallback) with partId: ${Ce}, content: "${H.thinking}"`)}M(q,J.content,"thinking")}else if(H.type==="input_json_delta"){const J=H.partial_json||"";let re=j.current.activeBlocks.get(q);if(re){re.content+=J,re.lastUpdatedAt=Y;const we=re.content,Ne=we.trim();if(re.partId&&Ne.endsWith("}"))try{const Ce=JSON.parse(we);v(A.current,re.partId,{toolInput:Ce}),console.log(`🔧 [STREAMING] content_block_delta: Updated tool_use block ${q}, parsed complete JSON`)}catch{console.log(`🔧 [STREAMING] content_block_delta: JSON not yet complete for ${q}, length: ${we.length}`)}}else{if(console.warn("🔧 [STREAMING] content_block_delta: Missing content_block_start for tool block, creating fallback"),!B.content_block||B.content_block.type!=="tool_use"){console.error("🔧 [STREAMING] content_block_delta: Missing content_block info for tool, cannot create fallback");return}const we=B.content_block.name,Ne=B.content_block.id;k(A.current,{toolName:we,toolInput:{},isExecuting:!0,claudeId:Ne});const Le=ze.getState().messages.find(Ze=>Ze.id===A.current),ct=Le?.messageParts?.[Le.messageParts.length-1]?.toolData?.id;re={blockId:q,type:"tool_use",content:J,isComplete:!1,messageId:A.current,partId:ct,startedAt:Y,lastUpdatedAt:Y},j.current.activeBlocks.set(q,re),console.log("🔧 [STREAMING] content_block_delta: Created tool_use block (fallback)",we,"blockId:",q,"partId:",ct,"initial fragment:",J)}}return}if(B.type==="content_block_stop"&&A.current){const V=B.index,H=`block-${A.current}-${V}`,q=j.current.activeBlocks.get(H);if(q){q.isComplete=!0,console.log(`🌊 [STREAMING] content_block_stop: Block ${H} complete, type: ${q.type}, content length: ${q.content.length}`);const Y=j.current;if(Y.pendingUpdate?.blockId===H){console.log(`🌊 [STREAMING] content_block_stop: Flushing pending RAF for ${H} immediately`),Y.rafId!==null&&(cancelAnimationFrame(Y.rafId),Y.rafId=null);const J=Y.pendingUpdate;q.partId&&(J.type==="text"?y(A.current,q.partId,J.content):J.type==="thinking"&&x(A.current,q.partId,J.content),console.log(`🌊 [STREAMING] content_block_stop: Flushed ${J.type} content for ${H}, length: ${J.content.length}`)),Y.pendingUpdate=null}else if((q.type==="text"||q.type==="thinking")&&q.partId)console.log(`🌊 [STREAMING] content_block_stop: Final check - ensuring ${q.type} content saved, length: ${q.content.length}`),q.type==="text"?y(A.current,q.partId,q.content):q.type==="thinking"&&x(A.current,q.partId,q.content);else if(q.type==="tool_use"&&q.partId&&q.content){console.log(`🔧 [STREAMING] content_block_stop: Finalizing tool_use block ${H}, accumulated JSON length: ${q.content.length}`);try{const J=JSON.parse(q.content);v(A.current,q.partId,{toolInput:J}),console.log(`🔧 [STREAMING] content_block_stop: Successfully parsed final tool input for ${H}`)}catch(J){console.error(`🔧 [STREAMING] content_block_stop: Failed to parse final tool JSON for ${H}:`,J,"content:",q.content.substring(0,200))}}j.current.activeBlocks.delete(H),console.log(`🌊 [STREAMING] content_block_stop: Cleaned up block ${H}`)}return}if(B.type==="message_delta"){console.log("🌊 [STREAMING] message_delta:",B.delta);return}if(B.type==="message_stop"){if(j.current.isStreaming){console.log("🌊 [STREAMING] message_stop: Finalizing all streaming blocks, count:",j.current.activeBlocks.size);const V=A.current,H=j.current;if(H.pendingUpdate&&H.rafId!==null){console.log(`🌊 [STREAMING] message_stop: Flushing pending RAF for ${H.pendingUpdate.blockId}`),cancelAnimationFrame(H.rafId),H.rafId=null;const q=H.pendingUpdate,Y=H.activeBlocks.get(q.blockId);Y&&Y.partId&&V&&(q.type==="text"?y(V,Y.partId,q.content):q.type==="thinking"&&x(V,Y.partId,q.content),console.log(`🌊 [STREAMING] message_stop: Flushed ${q.type} content, length: ${q.content.length}`)),H.pendingUpdate=null}V&&H.activeBlocks.forEach(q=>{q.isComplete=!0,(q.type==="text"||q.type==="thinking")&&q.partId?(console.log(`🌊 [STREAMING] message_stop: Final check for ${q.type} block ${q.blockId}, length: ${q.content.length}`),q.type==="text"?y(V,q.partId,q.content):q.type==="thinking"&&x(V,q.partId,q.content)):q.partId||console.error(`❌ [STREAMING] message_stop: Missing partId for block ${q.blockId}, content LOST:`,q.content.substring(0,100))}),H.isStreaming=!1,H.currentMessageId=null,H.activeBlocks.clear(),console.log("🌊 [STREAMING] message_stop: All blocks finalized and cleared")}return}console.warn("🌊 [STREAMING] Unknown stream_event type:",B.type);return}if(D.type==="error"){console.error("Claude Code SDK error:",D),c(!1),a(!1),s.current=null;let B="";D.subtype&&D.message?(console.log("📋 Processing structured error with subtype:",D.subtype),B=`❌ **${{error_during_execution:h("agentChat.executionError"),error_max_turns:h("agentChat.maxTurnsReached"),error_max_budget_usd:h("agentChat.maxBudgetReached"),error_max_structured_output_retries:h("agentChat.maxRetriesReached")}[D.subtype]||h("agentChat.processingError")}**
|
|
33
|
-
|
|
34
|
-
${D.message}`,B+=`
|
|
35
|
-
|
|
36
|
-
**${h("agentChatPanel.errors.suggestedActions")}**
|
|
37
|
-
`,D.subtype==="error_max_budget_usd"?B+=`- ${h("agentChatPanel.errors.checkBudget")}
|
|
38
|
-
`:D.subtype==="error_max_turns"&&(B+=`- ${h("agentChatPanel.errors.increaseMaxTurns")}
|
|
39
|
-
`),B+=`- ${h("agentChatPanel.errors.resendMessage")}
|
|
40
|
-
`,B+=`- ${h("agentChatPanel.errors.refreshPage")}`):D.error==="Claude Code SDK failed"&&D.message&&typeof D.message=="string"?(B=`${h("agentChat.errorMessages.claudeCodeSDKError")}
|
|
41
|
-
|
|
42
|
-
`,D.message.includes("not valid JSON")?B+=h("agentChatPanel.errors.jsonParseError"):D.message.includes("timeout")?B+=h("agentChatPanel.errors.timeoutError"):D.message.includes("context window")||D.message.includes("context_window")?B+=h("agentChatPanel.errors.contextWindowError"):B+=`${D.message}
|
|
43
|
-
|
|
44
|
-
**${h("agentChatPanel.errors.suggestedActions")}**
|
|
45
|
-
- ${h("agentChatPanel.errors.resendMessage")}
|
|
46
|
-
- ${h("agentChatPanel.errors.refreshPage")}`):(B=`${h("agentChat.errorMessages.claudeCodeSDKError")}
|
|
47
|
-
|
|
48
|
-
`,B+=`${D.message||D.error||h("agentChatPanel.errors.unknownError")}
|
|
49
|
-
|
|
50
|
-
**${h("agentChatPanel.errors.suggestedActions")}**
|
|
51
|
-
- ${h("agentChatPanel.errors.resendMessage")}
|
|
52
|
-
- ${h("agentChatPanel.errors.refreshPage")}`),A.current?p(A.current,`
|
|
53
|
-
|
|
54
|
-
`+B):g({content:B,role:"assistant"});return}if(D.type==="system"&&D.subtype==="init"&&(D.sessionId||D.session_id)){const B=D.sessionId||D.session_id;console.log("Setting session ID from AI response:",B),a(!1),!t&&B&&(o(B),l(!0),i&&i(B),f.invalidateQueries({queryKey:["agent-sessions",e]}));return}if(D.type==="mcp_status"){if(console.log("📡 MCP Status Event:",D),D.subtype==="connection_failed"){const B=D.failedServers||[];console.warn("🚨 MCP服务器连接失败:",B),_({hasError:!0,connectionErrors:B,lastError:`连接失败: ${B.map(V=>V.name).join(", ")}`})}else if(D.subtype==="connection_success"){const B=D.connectedServers||[];console.log("✅ MCP服务器连接成功:",B.map(V=>V.name)),_({hasError:!1,connectedServers:B,connectionErrors:[],lastError:null})}return}if(D.type==="mcp_error"){if(console.log("❌ MCP Error Event:",D),D.subtype==="execution_failed"){const B=D,V=B.tool||"未知工具",H=B.error||"执行失败",q=B.details||"";console.error("❌ MCP工具执行失败:",{tool:V,error:H,details:q}),_({hasError:!0,lastError:`工具执行失败: ${V} - ${H}`,lastErrorDetails:q})}return}if(D.type==="awaiting_user_input"){console.log("🎤 [AskUserQuestion] Received awaiting_user_input event:",D);const B=D;C({toolUseId:B.toolUseId,toolName:B.toolName,questions:B.toolInput?.questions||[],timestamp:Date.now()}),console.log("🎤 [AskUserQuestion] Set pending question, MCP tool is waiting for user response");return}if(D.type==="a2a_stream_start"){const B=D;w(B.agentUrl,B.sessionId,B.message);return}if(D.type==="a2a_stream_data"){const B=D;B.agentUrl&&F(B.agentUrl,{type:B.event?.type||"unknown",sessionId:B.event?.sessionId,message:B.event?.message,timestamp:B.timestamp});return}if(D.type==="a2a_stream_end"){const B=D,V=ze.getState();for(const[H,q]of Object.entries(V.activeA2AStreams))if(q.sessionId===B.sessionId){S(H);break}return}if(D.type==="session_resumed"&&D.subtype==="new_branch"){const B=D;console.log("🔄 Session resumed with new branch:",B),console.log("🔄 Updating session ID from",t,"to",B.newSessionId),a(!1),o(B.newSessionId),l(!0),i&&(console.log("🔄 Updating URL with new session ID:",B.newSessionId),i(B.newSessionId)),g({content:`${h("agentChat.sessionResumed")}
|
|
55
|
-
|
|
56
|
-
${B.message}
|
|
57
|
-
|
|
58
|
-
${h("agentChat.sessionIdUpdated")}`,role:"assistant"}),f.invalidateQueries({queryKey:["agent-sessions",e]}),t&&B.originalSessionId&&B.newSessionId&&(Fr.handleSessionResume(e,B.originalSessionId,B.newSessionId),Fr.recordSessionResume(e,B.originalSessionId,B.newSessionId),console.log(`🎯 TabManager updated for session resume: ${B.originalSessionId} → ${B.newSessionId}`)),console.log("✅ Session resume handling complete");return}if(D.type==="system"&&D.subtype==="init")return;if(D.type==="assistant"){if(j.current.wasStreamProcessed){console.log("📝 [ASSISTANT] Skipping assistant message - already processed via stream_event (prevents duplicates)");return}if(!A.current){g({content:"",role:"assistant"});const V=ze.getState();A.current=V.messages[V.messages.length-1].id,console.log("📝 Created new AI message with ID:",A.current)}if(D.message&&typeof D.message=="object"&&"content"in D.message&&D.message.content&&A.current){console.log("📝 Processing assistant message content blocks:",D.message.content.length,"aiMessageId:",A.current);for(const B of D.message.content)if(console.log("📝 Processing block:",{type:B.type,hasText:!!B.text,hasThinking:!!B.thinking,textLength:B.text?.length,thinkingLength:B.thinking?.length,toolName:B.name}),B.type==="text")B.text?(console.log("📝 Adding text part:",B.text.substring(0,100)+(B.text.length>100?"...":"")),n&&console.log("📦 Detected /compact command response, adding as compactSummary"),p(A.current,B.text)):console.warn("📝 Text block has no text content");else if(B.type==="thinking")B.thinking?(console.log("🤔 Adding thinking part:",B.thinking.substring(0,100)+(B.thinking.length>100?"...":"")),m(A.current,B.thinking)):console.warn("🤔 Thinking block has no thinking content");else if(B.type==="tool_use"){if(B.name){console.log("📝 Adding tool part:",B.name,"id:",B.id),B.name==="BashOutput"&&console.log("🐚 [BashOutput] Tool use detected, claudeId:",B.id,"input:",B.input);const V={toolName:B.name,toolInput:B.input||{},isExecuting:!0,claudeId:B.id};k(A.current,V)}}else console.log("📝 Unknown block type:",B.type)}else console.warn("📝 No content or aiMessageId for assistant message:",{hasMessage:!!D.message,hasContent:!!D.message?.content,aiMessageId:A.current});return}if(D.type==="user"){if(D.message&&typeof D.message=="object"&&"content"in D.message&&D.message.content&&A.current){for(const B of D.message.content)if(B.type==="tool_result"&&B.tool_use_id){console.log("🔧 Processing tool_result for tool_use_id:",B.tool_use_id,"content:",B.content,"is_error:",B.is_error);const V=ze.getState();let H=null,q=null;for(const Y of V.messages)if(Y.messageParts){const J=Y.messageParts.find(re=>re.type==="tool"&&re.toolData?.claudeId===B.tool_use_id);if(J){H=J,q=Y.id;break}}if(console.log("🔧 Found target tool:",{toolData:H?.toolData,messageId:q,currentMessageId:A.current}),H?.toolData&&q){const Y=typeof B.content=="string"?B.content:Array.isArray(B.content)?B.content.map(J=>J.text||String(J)).join(""):JSON.stringify(B.content);if(console.log("🔧 Updating tool with result, setting isExecuting: false"),H.toolData.toolName==="Task"&&H.toolData.claudeId){const J=H.toolData.claudeId;console.log("🎯 [TASK] Task tool completed, appending result to sub-agent flow:",J),Y&&typeof Y=="string"&&Y.trim()&&(I(J,{id:`part_${J}_result_${Date.now()}`,type:"text",content:Y,order:9999}),console.log("🎯 [TASK] Appended result text to sub-agent flow, length:",Y.length))}H.toolData.toolName==="BashOutput"&&console.log("🐚 [BashOutput] Updating tool result:",{toolId:H.toolData.id,messageId:q,toolResult:Y?.substring(0,200),rawContent:B.content}),v(q,H.toolData.id,{toolResult:Y,isError:B.is_error||!1,isExecuting:!1})}else{console.warn("🔧 No target tool found for tool_use_id:",B.tool_use_id);const Y=V.messages.flatMap(J=>(J.messageParts||[]).filter(re=>re.type==="tool").map(re=>({claudeId:re.toolData?.claudeId,toolName:re.toolData?.toolName,isExecuting:re.toolData?.isExecuting})));console.warn("🔧 Available tools:",Y)}}}return}if(D.type==="assistant"&&D.message&&typeof D.message=="object"&&"content"in D.message&&D.message.content&&A.current){for(const B of D.message.content)if(B.type==="tool_result"&&B.tool_use_id){console.log("🔧 Processing tool_result in assistant message for tool_use_id:",B.tool_use_id);const V=ze.getState();let H=null,q=null;for(const Y of V.messages)if(Y.messageParts){const J=Y.messageParts.find(re=>re.type==="tool"&&re.toolData?.claudeId===B.tool_use_id);if(J){H=J,q=Y.id;break}}if(console.log("🔧 Found target tool in assistant message:",{toolData:H?.toolData,messageId:q,currentMessageId:A.current}),H?.toolData&&q){const Y=typeof B.content=="string"?B.content:Array.isArray(B.content)?B.content.map(J=>J.text||String(J)).join(""):JSON.stringify(B.content);console.log("🔧 Updating tool with result in assistant message, setting isExecuting: false"),v(q,H.toolData.id,{toolResult:Y,isError:B.is_error||!1,isExecuting:!1})}else console.warn("🔧 No target tool found for tool_use_id in assistant message:",B.tool_use_id)}return}if(D.type==="result"){console.log("Received result event:",{subtype:D.subtype,isSideChain:D.isSideChain});const B=D.isSideChain;if(B?console.log("Side chain result received, continuing main task..."):(console.log("Main task result received, stopping AI typing..."),j.current.isStreaming&&(console.log("🌊 [STREAMING] Finalizing all streaming blocks"),j.current.activeBlocks.forEach(V=>{V.isComplete=!0,console.log(`🌊 [STREAMING] Marked block ${V.blockId} as complete`)}),j.current.isStreaming=!1,j.current.currentMessageId=null,j.current.rafId!==null&&(cancelAnimationFrame(j.current.rafId),j.current.rafId=null),j.current.activeBlocks.clear()),s.current=null,c(!1),D.subtype==="success"&&(u(!0),console.log("✅ Marked session as having successful response for heartbeat"),Jc.emit(eu.AI_RESPONSE_COMPLETE,{agentId:e,sessionId:t,projectPath:r}),console.log("📡 Emitted AI_RESPONSE_COMPLETE event"))),!B){if(!A.current&&D.subtype==="success"){console.log("📝 Creating AI message from result event - no assistant messages received");const H=D.result;if(H&&typeof H=="string"){g({content:"",role:"assistant"});const Y=ze.getState();A.current=Y.messages[Y.messages.length-1].id,A.current&&p(A.current,H),console.log("📝 Added result content to new AI message:",H.substring(0,100))}else{console.warn("📝 Result event with no content - creating empty success message");const q={content:h("agentChat.taskComplete"),role:"assistant"};g(q);const Y=ze.getState();A.current=Y.messages[Y.messages.length-1].id}}if(A.current){const q=ze.getState().messages.find(Y=>Y.id===A.current);q?.messageParts&&q.messageParts.forEach(Y=>{Y.type==="tool"&&Y.toolData?.isExecuting&&(console.log("Force completing tool:",Y.toolData.toolName,"claudeId:",Y.toolData.claudeId),v(A.current,Y.toolData.id,{isExecuting:!1,toolResult:Y.toolData.toolResult||h("agentChat.executionCompleted")}))})}let V="";D.subtype==="success"?V="":D.subtype==="error_max_turns"?(V=`
|
|
59
|
-
|
|
60
|
-
${h("agentChat.maxTurnsReached")}`,D.permission_denials&&D.permission_denials.length>0&&(V+=`
|
|
61
|
-
|
|
62
|
-
${h("agentChat.permissionDenials")}`,D.permission_denials.forEach((H,q)=>{V+=`
|
|
63
|
-
${q+1}. ${H.tool_name}: \`${H.tool_input.command||H.tool_input.description||JSON.stringify(H.tool_input)}\``}),V+=`
|
|
64
|
-
|
|
65
|
-
${h("agentChat.permissionNote")}`)):D.subtype==="error_during_execution"?(V=`
|
|
66
|
-
|
|
67
|
-
${h("agentChat.executionError")}`,D.errors&&Array.isArray(D.errors)&&(V+=`
|
|
68
|
-
|
|
69
|
-
${D.errors.join(`
|
|
70
|
-
`)}`)):D.subtype==="error_max_budget_usd"?(V=`
|
|
71
|
-
|
|
72
|
-
${h("agentChat.maxBudgetReached")}`,D.errors&&Array.isArray(D.errors)&&(V+=`
|
|
73
|
-
|
|
74
|
-
${D.errors.join(`
|
|
75
|
-
`)}`)):D.subtype==="error_max_structured_output_retries"?(V=`
|
|
76
|
-
|
|
77
|
-
${h("agentChat.maxRetriesReached")}`,D.errors&&Array.isArray(D.errors)&&(V+=`
|
|
78
|
-
|
|
79
|
-
${D.errors.join(`
|
|
80
|
-
`)}`)):D.subtype==="error"?(V=`
|
|
81
|
-
|
|
82
|
-
${h("agentChat.processingError")}`,D.errors&&Array.isArray(D.errors)&&(V+=`
|
|
83
|
-
|
|
84
|
-
${D.errors.join(`
|
|
85
|
-
`)}`)):V=`
|
|
86
|
-
|
|
87
|
-
${h("agentChat.processingComplete")}`,A.current&&V&&p(A.current,V),t&&f.invalidateQueries({queryKey:["agent-sessions",e]})}return}}catch(D){console.error("❌ [STREAMING] Error in handleStreamMessage:",D),console.error("❌ [STREAMING] Error stack:",D instanceof Error?D.stack:"No stack trace"),console.error("❌ [STREAMING] Event data:",JSON.stringify(E).substring(0,500));try{A.current?p(A.current,`
|
|
88
|
-
|
|
89
|
-
❌ **Streaming Error**: ${D instanceof Error?D.message:String(D)}
|
|
90
|
-
|
|
91
|
-
Please refresh the page and try again.`):g({content:`❌ **Streaming Error**: ${D instanceof Error?D.message:String(D)}
|
|
92
|
-
|
|
93
|
-
Please refresh the page and try again.`,role:"assistant"})}catch(X){console.error("❌ [STREAMING] Failed to display error message:",X)}c(!1)}},[e,t,r,n,s,i,a,o,l,c,u,h,f,g,p,m,y,x,k,v,_,C,w,S,F,M,P]),W=L.useCallback(E=>{if(console.error("SSE error:",E),c(!1),a(!1),s.current=null,E instanceof DOMException&&E.name==="AbortError"){console.log("Request was aborted by user");return}let D=h("agentChat.genericError");E instanceof Error&&(E.message.includes("network")||E.message.includes("fetch")?D=h("agentChatPanel.errors.networkError"):E.message.includes("timeout")?D=h("agentChatPanel.errors.requestTimeout"):E.message.includes("rate limit")||E.message.includes("429")?D=h("agentChatPanel.errors.rateLimit"):E.message.includes("unauthorized")||E.message.includes("401")?D=h("agentChatPanel.errors.unauthorized"):E.message.includes("forbidden")||E.message.includes("403")?D=h("agentChatPanel.errors.forbidden"):E.message.includes("500")||E.message.includes("internal server")?D=h("agentChatPanel.errors.internalServerError"):D=`❌ **${h("agentChatPanel.errors.processingError")}**
|
|
94
|
-
|
|
95
|
-
${E.message||h("agentChatPanel.errors.unknownErrorRetry")}`),A.current?p(A.current,`
|
|
96
|
-
|
|
97
|
-
`+D):g({content:D,role:"assistant"})},[s,c,a,h,g,p]),Z=L.useCallback(()=>{A.current=null,j.current.wasStreamProcessed=!1,j.current.isStreaming=!1,j.current.currentMessageId=null},[]);return{handleStreamMessage:O,handleStreamError:W,resetMessageId:Z}};class Wv{agentStore;onNewSession;onNavigate;onConfirm;constructor(t){this.agentStore=t.agentStore,this.onNewSession=t.onNewSession,this.onNavigate=t.onNavigate,this.onConfirm=t.onConfirm}async executeCommand(t,r){switch(t.name.toLowerCase()){case"clear":return this.handleClearCommand();case"init":return this.handleInitCommand();case"compact":return this.handleCompactCommand();case"agents":return this.handleAgentsCommand();case"settings":return this.handleSettingsCommand();case"help":return this.handleHelpCommand();default:return this.handleCustomCommand(t,r)}}handleClearCommand(){return this.onNewSession?(this.onNewSession(),{shouldSendToBackend:!1,message:"已清空对话,开始新会话",action:"newSession"}):(this.agentStore.clearMessages(),{shouldSendToBackend:!1,message:"已清空对话历史",action:"none"})}handleInitCommand(){return{shouldSendToBackend:!0}}handleCompactCommand(){return{shouldSendToBackend:!0}}handleAgentsCommand(){const t="是否要跳转到代理管理页面?";return this.onConfirm&&this.onConfirm(t,()=>{this.onNavigate&&this.onNavigate("/agents")}),{shouldSendToBackend:!1,message:t,action:"confirm",actionData:{path:"/agents"}}}handleSettingsCommand(){const t="是否要跳转到设置页面?";return this.onConfirm&&this.onConfirm(t,()=>{this.onNavigate&&this.onNavigate("/settings")}),{shouldSendToBackend:!1,message:t,action:"confirm",actionData:{path:"/settings"}}}handleHelpCommand(){return{shouldSendToBackend:!1,message:`
|
|
98
|
-
可用命令:
|
|
99
|
-
• /clear - 清空对话历史
|
|
100
|
-
• /init - 初始化项目或重置对话上下文
|
|
101
|
-
• /compact - 压缩对话历史
|
|
102
|
-
• /agents - 管理AI代理
|
|
103
|
-
• /settings - 打开设置页面
|
|
104
|
-
• /help - 显示帮助信息
|
|
105
|
-
`.trim(),action:"none"}}handleCustomCommand(t,r){return t.name.includes("nav")||t.name.includes("goto")||"namespace"in t&&t.namespace==="nav"?{shouldSendToBackend:!1,message:`导航命令 ${t.name} 需要前端处理`,action:"confirm"}:t.name.includes("ui")||t.name.includes("show")||"namespace"in t&&t.namespace==="ui"?{shouldSendToBackend:!1,message:`UI命令 ${t.name} 在前端执行`,action:"none"}:{shouldSendToBackend:!0}}}function Hv(e){return new Wv(e)}const bm=e=>{const{agent:t,projectPath:r,inputMessage:n,selectedImages:s,isAiTyping:i,currentSessionId:a,hasCommandsLoadError:o,userCommandsError:l,projectCommandsError:c,SYSTEM_COMMANDS:u,userCommands:h,projectCommands:f,selectedCommand:g,selectedRegularTools:p,selectedMcpTools:m,mcpToolsEnabled:y,permissionMode:x,selectedModel:k,selectedClaudeVersion:v,abortControllerRef:_,onSessionChange:C,setInputMessage:w,clearImages:S,setSelectedCommand:F,setShowCommandSelector:A,setCommandWarning:T,setIsInitializingSession:j,setCurrentSessionId:M,setIsNewSession:P,setAiTyping:$,setHasSuccessfulResponse:R,setConfirmMessage:I,setConfirmAction:O,setShowConfirmDialog:W,handleNewSession:Z,isCommandDefined:E,getAllAvailableCommands:D,envVars:X}=e,{t:N}=fe("components"),{addMessage:B,addCommandPartToMessage:V,addTextPartToMessage:H,selectedEngine:q,updateMessage:Y,addToolPartToMessage:J,updateToolPartInMessage:re}=ze(),we=iv(),Ne=Dv(),Ce=L.useRef(!1),Le={agentId:t.id,currentSessionId:a,projectPath:r,isCompactCommand:Ce.current,abortControllerRef:_,onSessionChange:C,setIsInitializingSession:j,setCurrentSessionId:M,setIsNewSession:P,setAiTyping:$,setHasSuccessfulResponse:R},{handleStreamMessage:Xe,handleStreamError:ct,resetMessageId:Ze}=zv(Le),vt=L.useCallback(()=>{if(i||!n.trim()&&s.length===0)return!0;if(Wi(n)){const We=n.slice(1).split(" ")[0].toLowerCase();return!E(We)}return!1},[n,i,s,E]),Nt=L.useCallback(async()=>{if(!n.trim()&&s.length===0||i)return;let We=n.trim();const ut=[...s].map(je=>({id:je.id,data:je.preview.split(",")[1],mediaType:je.file.type,name:je.file.name}));if(Wi(n)){const je=n.slice(1).split(" ")[0].toLowerCase();if(!E(je)){T(o?N("agentChat.commandsLoadErrorWarning",{command:je,commands:u.map(se=>se.content).join(", "),errorMessage:l?.message||c?.message||"Unknown error"}):N("agentChat.unknownCommandWarning",{command:je,commands:D()}));return}T(null);const G=Hv({agentStore:ze.getState(),onNewSession:Z,onNavigate:se=>{_v(N("agentChat.navigateToAlert",{path:se}))},onConfirm:(se,be)=>{I(se),O(()=>be),W(!0)}});let Q=g;if(Q||(Q=u.find(se=>se.name===je)||f.find(se=>se.name===je)||h.find(se=>se.name===je)||null),Q){const se=await G.executeCommand(Q);if(se.shouldSendToBackend){We=n.trim(),B({content:"",role:"user",images:ut});const ie=ze.getState(),Ge=ie.messages[ie.messages.length-1].id;V(Ge,We)}else{const be=n.slice(Q.content.length).trim()||void 0,ie=Pv(Q,be,r);B({content:ie,role:"user",images:ut}),w(""),S(),F(null),A(!1),se.message&&se.action!=="confirm"&&B({content:se.message,role:"assistant"});return}}}else T(null);w(""),S(),F(null),A(!1),Wi(n.trim())||B({content:We||N("agentChat.sendImage"),role:"user",images:ut});const Vt={};$(!0),a||(console.log("🆕 No current session, will create new session"),j(!0));const Et=new AbortController;_.current=Et,Ce.current=We.trim()==="/compact",Ze();try{const je=[...p,...y&&m.length>0?m:[]];if(q==="cursor"){console.log("🚀 [MessageSender] Using Cursor Engine");let G=null,Q="";const se=new Map,be=ie=>{switch(console.log(`📨 [AGUI] Event: ${ie.type}`,ie),ie.type){case"RUN_STARTED":j(!1),ie.threadId&&ie.threadId!==a&&(M(ie.threadId),P(!0),C?.(ie.threadId));break;case"RUN_FINISHED":$(!1),R(!0);break;case"RUN_ERROR":console.error("[AGUI] Run error:",ie.error),B({role:"assistant",content:`❌ **Error**: ${ie.error}`}),$(!1);break;case"TEXT_MESSAGE_START":G=ie.messageId,Q="",B({role:"assistant",content:""});break;case"TEXT_MESSAGE_CONTENT":if(G){Q+=ie.content;const Ie=ze.getState(),Ee=Ie.messages[Ie.messages.length-1];Ee&&Ee.role==="assistant"&&Y(Ee.id,{content:Q})}break;case"TEXT_MESSAGE_END":break;case"TOOL_CALL_START":se.set(ie.toolCallId,{name:ie.toolName,args:""});let Ge=ze.getState(),nt=Ge.messages[Ge.messages.length-1];(!nt||nt.role!=="assistant")&&(B({role:"assistant",content:""}),Ge=ze.getState(),nt=Ge.messages[Ge.messages.length-1]),nt&&nt.role==="assistant"&&J(nt.id,{toolName:ie.toolName,toolInput:{},isExecuting:!0,claudeId:ie.toolCallId});break;case"TOOL_CALL_ARGS":const st=se.get(ie.toolCallId);if(st){st.args+=ie.args;try{const Ie=JSON.parse(st.args),Ee=ze.getState(),Gt=Ee.messages[Ee.messages.length-1];Gt&&Gt.role==="assistant"&&re(Gt.id,ie.toolCallId,{toolInput:Ie})}catch{}}break;case"TOOL_CALL_END":const xt=se.get(ie.toolCallId);if(xt)try{const Ie=JSON.parse(xt.args),Ee=ze.getState(),Gt=Ee.messages[Ee.messages.length-1];Gt&&Gt.role==="assistant"&&re(Gt.id,ie.toolCallId,{toolInput:Ie,isExecuting:!1})}catch{const Ie=ze.getState(),Ee=Ie.messages[Ie.messages.length-1];Ee&&Ee.role==="assistant"&&re(Ee.id,ie.toolCallId,{isExecuting:!1})}break;case"TOOL_CALL_RESULT":const tt=ze.getState(),Se=tt.messages[tt.messages.length-1];Se&&Se.role==="assistant"&&re(Se.id,ie.toolCallId,{toolResult:ie.result,isError:ie.isError||!1,isExecuting:!1});break;case"CUSTOM":{const Ie=ie;if(Ie.name==="session_id_updated"&&Ie.data?.sessionId){const Ee=Ie.data.sessionId;console.log(`🔄 [AGUI] Session ID updated from CLI: ${Ee}`),M(Ee),C?.(Ee)}break}}};await Ne.sendMessage({message:We,engineType:"cursor",workspace:r||".",sessionId:a||void 0,model:k,images:ut.length>0?ut:void 0,abortController:Et,onAguiEvent:be,onError:ie=>{console.error("[AGUI] Error:",ie),B({role:"assistant",content:`❌ **Error**: ${ie.message}`}),$(!1)}})}else console.log("🚀 [MessageSender] Using Claude Engine"),await we.mutateAsync({agentId:t.id,message:We,images:ut.length>0?ut:void 0,context:Vt,sessionId:a,projectPath:r,mcpTools:je.length>0?je:void 0,permissionMode:x,model:k,claudeVersion:v,envVars:X,channel:"web",abortController:Et,onMessage:Xe,onError:ct})}catch(je){if(console.error("Chat error:",je),$(!1),j(!1),_.current=null,je instanceof DOMException&&je.name==="AbortError"){console.log("Request was aborted by user");return}let G=N("agentChatPanel.errors.connectionFailed");je instanceof Error&&(je.message.includes("Failed to fetch")||je.message.includes("NetworkError")?G=N("agentChatPanel.errors.networkConnectionFailed"):je.message.includes("timeout")?G=N("agentChatPanel.errors.connectionTimeout"):G=`❌ **${N("agentChatPanel.errors.connectionError")}**
|
|
106
|
-
|
|
107
|
-
${je.message||N("agentChatPanel.errors.cannotConnectRetry")}`),B({content:G,role:"assistant"})}},[t,r,n,s,i,a,o,l,c,u,h,f,g,p,m,y,x,k,v,q,_,C,w,S,F,A,T,j,M,P,$,R,Z,E,D,N,B,V,H,Y,J,re,we,Ne,Xe,ct,Ze,I,O,W]);return{isSendDisabled:vt,handleSendMessage:Nt,handleStreamMessage:Xe,handleStreamError:ct,resetMessageId:Ze}},km=({agentId:e,currentSessionId:t,onSessionChange:r,textareaRef:n})=>{const s=kh(),{setCurrentSessionId:i,clearMessages:a}=ze(),[o,l]=L.useState(!1),[c,u]=L.useState(!1),[h,f]=L.useState(!1),g=L.useCallback(y=>{console.log(`[SessionManager] Switching to session ${y}`),i(y),l(!0),u(!1),f(!1),r&&r(y),a(),s.invalidateQueries({queryKey:["agent-session-messages",e,y]})},[e,r,i,a,s]),p=L.useCallback(()=>{i(null),a(),u(!0),f(!1),r&&r(null),setTimeout(()=>{n?.current?.focus()},0)},[r,i,a,n]),m=L.useCallback(()=>{t&&(l(!0),a(),s.invalidateQueries({queryKey:["agent-session-messages",e,t]}))},[e,t,a,s]);return{isLoadingMessages:o,isNewSession:c,hasSuccessfulResponse:h,setIsLoadingMessages:l,setIsNewSession:u,setHasSuccessfulResponse:f,setCurrentSessionId:i,handleSwitchSession:g,handleNewSession:p,handleRefreshMessages:m}},wm=()=>{const[e,t]=L.useState(!1),[r,n]=L.useState(!1),[s,i]=L.useState(!1),[a,o]=L.useState(!1),[l,c]=L.useState(""),[u,h]=L.useState(null),[f,g]=L.useState(""),[p,m]=L.useState(!1),[y,x]=L.useState(!1),k=L.useCallback(()=>{u&&u(),n(!1),c(""),h(null)},[u]),v=L.useCallback(()=>{n(!1),c(""),h(null)},[]);return{showSessions:e,showConfirmDialog:r,showMobileSettings:s,showMcpStatusModal:a,confirmMessage:l,confirmAction:u,searchTerm:f,isStopping:p,isInitializingSession:y,setShowSessions:t,setShowConfirmDialog:n,setShowMobileSettings:i,setShowMcpStatusModal:o,setConfirmMessage:c,setConfirmAction:h,setSearchTerm:g,setIsStopping:m,setIsInitializingSession:x,handleConfirmDialog:k,handleCancelDialog:v}};function qv(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Uv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gv={};function ef(e,t){return(Gv.jsx?Vv:Uv).test(e)}const Yv=/[ \t\n\f\r]/g;function Xv(e){return typeof e=="object"?e.type==="text"?tf(e.value):!1:tf(e)}function tf(e){return e.replace(Yv,"")===""}class pa{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}pa.prototype.normal={};pa.prototype.property={};pa.prototype.space=void 0;function vm(e,t){const r={},n={};for(const s of e)Object.assign(r,s.property),Object.assign(n,s.normal);return new pa(r,n,t)}function ru(e){return e.toLowerCase()}class nr{constructor(t,r){this.attribute=r,this.property=t}}nr.prototype.attribute="";nr.prototype.booleanish=!1;nr.prototype.boolean=!1;nr.prototype.commaOrSpaceSeparated=!1;nr.prototype.commaSeparated=!1;nr.prototype.defined=!1;nr.prototype.mustUseProperty=!1;nr.prototype.number=!1;nr.prototype.overloadedBoolean=!1;nr.prototype.property="";nr.prototype.spaceSeparated=!1;nr.prototype.space=void 0;let Kv=0;const Ae=us(),pt=us(),nu=us(),te=us(),et=us(),Is=us(),ir=us();function us(){return 2**++Kv}const su=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ae,booleanish:pt,commaOrSpaceSeparated:ir,commaSeparated:Is,number:te,overloadedBoolean:nu,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),lc=Object.keys(su);class Nh extends nr{constructor(t,r,n,s){let i=-1;if(super(t,r),rf(this,"space",s),typeof n=="number")for(;++i<lc.length;){const a=lc[i];rf(this,lc[i],(n&su[a])===su[a])}}}Nh.prototype.defined=!0;function rf(e,t,r){r&&(e[t]=r)}function ti(e){const t={},r={};for(const[n,s]of Object.entries(e.properties)){const i=new Nh(n,e.transform(e.attributes||{},n),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[ru(n)]=n,r[ru(i.attribute)]=n}return new pa(t,r,e.space)}const Cm=ti({properties:{ariaActiveDescendant:null,ariaAtomic:pt,ariaAutoComplete:null,ariaBusy:pt,ariaChecked:pt,ariaColCount:te,ariaColIndex:te,ariaColSpan:te,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:pt,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:pt,ariaFlowTo:et,ariaGrabbed:pt,ariaHasPopup:null,ariaHidden:pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:te,ariaLive:null,ariaModal:pt,ariaMultiLine:pt,ariaMultiSelectable:pt,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:te,ariaPressed:pt,ariaReadOnly:pt,ariaRelevant:null,ariaRequired:pt,ariaRoleDescription:et,ariaRowCount:te,ariaRowIndex:te,ariaRowSpan:te,ariaSelected:pt,ariaSetSize:te,ariaSort:null,ariaValueMax:te,ariaValueMin:te,ariaValueNow:te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Sm(e,t){return t in e?e[t]:t}function _m(e,t){return Sm(e,t.toLowerCase())}const Qv=ti({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Is,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:Ae,allowPaymentRequest:Ae,allowUserMedia:Ae,alt:null,as:null,async:Ae,autoCapitalize:null,autoComplete:et,autoFocus:Ae,autoPlay:Ae,blocking:et,capture:null,charSet:null,checked:Ae,cite:null,className:et,cols:te,colSpan:null,content:null,contentEditable:pt,controls:Ae,controlsList:et,coords:te|Is,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ae,defer:Ae,dir:null,dirName:null,disabled:Ae,download:nu,draggable:pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ae,formTarget:null,headers:et,height:te,hidden:nu,high:te,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:Ae,inputMode:null,integrity:null,is:null,isMap:Ae,itemId:null,itemProp:et,itemRef:et,itemScope:Ae,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ae,low:te,manifest:null,max:null,maxLength:te,media:null,method:null,min:null,minLength:te,multiple:Ae,muted:Ae,name:null,nonce:null,noModule:Ae,noValidate:Ae,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ae,optimum:te,pattern:null,ping:et,placeholder:null,playsInline:Ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ae,referrerPolicy:null,rel:et,required:Ae,reversed:Ae,rows:te,rowSpan:te,sandbox:et,scope:null,scoped:Ae,seamless:Ae,selected:Ae,shadowRootClonable:Ae,shadowRootDelegatesFocus:Ae,shadowRootMode:null,shape:null,size:te,sizes:null,slot:null,span:te,spellCheck:pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:te,step:null,style:null,tabIndex:te,target:null,title:null,translate:null,type:null,typeMustMatch:Ae,useMap:null,value:pt,width:te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:te,borderColor:null,bottomMargin:te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ae,declare:Ae,event:null,face:null,frame:null,frameBorder:null,hSpace:te,leftMargin:te,link:null,longDesc:null,lowSrc:null,marginHeight:te,marginWidth:te,noResize:Ae,noHref:Ae,noShade:Ae,noWrap:Ae,object:null,profile:null,prompt:null,rev:null,rightMargin:te,rules:null,scheme:null,scrolling:pt,standby:null,summary:null,text:null,topMargin:te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ae,disableRemotePlayback:Ae,prefix:null,property:null,results:te,security:null,unselectable:null},space:"html",transform:_m}),Zv=ti({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ir,accentHeight:te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:te,amplitude:te,arabicForm:null,ascent:te,attributeName:null,attributeType:null,azimuth:te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:te,by:null,calcMode:null,capHeight:te,className:et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:te,diffuseConstant:te,direction:null,display:null,dur:null,divisor:te,dominantBaseline:null,download:Ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:te,enableBackground:null,end:null,event:null,exponent:te,externalResourcesRequired:null,fill:null,fillOpacity:te,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Is,g2:Is,glyphName:Is,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:te,horizOriginX:te,horizOriginY:te,id:null,ideographic:te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:te,k:te,k1:te,k2:te,k3:te,k4:te,kernelMatrix:ir,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:te,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:te,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:te,overlineThickness:te,paintOrder:null,panose1:null,path:null,pathLength:te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:te,pointsAtY:te,pointsAtZ:te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ir,rev:ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ir,requiredFeatures:ir,requiredFonts:ir,requiredFormats:ir,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:te,specularExponent:te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:te,strikethroughThickness:te,string:null,stroke:null,strokeDashArray:ir,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:te,strokeOpacity:te,strokeWidth:null,style:null,surfaceScale:te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ir,tabIndex:te,tableValues:null,target:null,targetX:te,targetY:te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ir,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:te,underlineThickness:te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:te,values:null,vAlphabetic:te,vMathematical:te,vectorEffect:null,vHanging:te,vIdeographic:te,version:null,vertAdvY:te,vertOriginX:te,vertOriginY:te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Sm}),Tm=ti({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Nm=ti({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_m}),Em=ti({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Jv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},eC=/[A-Z]/g,nf=/-[a-z]/g,tC=/^data[-\w.:]+$/i;function rC(e,t){const r=ru(t);let n=t,s=nr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&tC.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(nf,sC);n="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!nf.test(i)){let a=i.replace(eC,nC);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Nh}return new s(n,t)}function nC(e){return"-"+e.toLowerCase()}function sC(e){return e.charAt(1).toUpperCase()}const iC=vm([Cm,Qv,Tm,Nm,Em],"html"),Eh=vm([Cm,Zv,Tm,Nm,Em],"svg");function aC(e){return e.join(" ").trim()}var Ss={},cc,sf;function oC(){if(sf)return cc;sf=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
|
|
108
|
-
`,c="/",u="*",h="",f="comment",g="declaration";cc=function(m,y){if(typeof m!="string")throw new TypeError("First argument must be a string");if(!m)return[];y=y||{};var x=1,k=1;function v(P){var $=P.match(t);$&&(x+=$.length);var R=P.lastIndexOf(l);k=~R?P.length-R:k+P.length}function _(){var P={line:x,column:k};return function($){return $.position=new C(P),F(),$}}function C(P){this.start=P,this.end={line:x,column:k},this.source=y.source}C.prototype.content=m;function w(P){var $=new Error(y.source+":"+x+":"+k+": "+P);if($.reason=P,$.filename=y.source,$.line=x,$.column=k,$.source=m,!y.silent)throw $}function S(P){var $=P.exec(m);if($){var R=$[0];return v(R),m=m.slice(R.length),$}}function F(){S(r)}function A(P){var $;for(P=P||[];$=T();)$!==!1&&P.push($);return P}function T(){var P=_();if(!(c!=m.charAt(0)||u!=m.charAt(1))){for(var $=2;h!=m.charAt($)&&(u!=m.charAt($)||c!=m.charAt($+1));)++$;if($+=2,h===m.charAt($-1))return w("End of comment missing");var R=m.slice(2,$-2);return k+=2,v(R),m=m.slice($),k+=2,P({type:f,comment:R})}}function j(){var P=_(),$=S(n);if($){if(T(),!S(s))return w("property missing ':'");var R=S(i),I=P({type:g,property:p($[0].replace(e,h)),value:R?p(R[0].replace(e,h)):h});return S(a),I}}function M(){var P=[];A(P);for(var $;$=j();)$!==!1&&(P.push($),A(P));return P}return F(),M()};function p(m){return m?m.replace(o,h):h}return cc}var af;function lC(){if(af)return Ss;af=1;var e=Ss&&Ss.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ss,"__esModule",{value:!0}),Ss.default=r;const t=e(oC());function r(n,s){let i=null;if(!n||typeof n!="string")return i;const a=(0,t.default)(n),o=typeof s=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;o?s(c,u,l):u&&(i=i||{},i[c]=u)}),i}return Ss}var pi={},of;function cC(){if(of)return pi;of=1,Object.defineProperty(pi,"__esModule",{value:!0}),pi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(c){return!c||r.test(c)||e.test(c)},a=function(c,u){return u.toUpperCase()},o=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(s,o):c=c.replace(n,o),c.replace(t,a))};return pi.camelCase=l,pi}var mi,lf;function uC(){if(lf)return mi;lf=1;var e=mi&&mi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(lC()),r=cC();function n(s,i){var a={};return!s||typeof s!="string"||(0,t.default)(s,function(o,l){o&&l&&(a[(0,r.camelCase)(o,i)]=l)}),a}return n.default=n,mi=n,mi}var hC=uC();const dC=bh(hC),Am=Mm("end"),Ah=Mm("start");function Mm(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function fC(e){const t=Ah(e),r=Am(e);if(t&&r)return{start:t,end:r}}function Hi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cf(e.position):"start"in e||"end"in e?cf(e):"line"in e||"column"in e?iu(e):""}function iu(e){return uf(e&&e.line)+":"+uf(e&&e.column)}function cf(e){return iu(e&&e.start)+"-"+iu(e&&e.end)}function uf(e){return e&&typeof e=="number"?e:1}class Dt extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let s="",i={},a=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?i.ruleId=n:(i.source=n.slice(0,l),i.ruleId=n.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Hi(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;const Mh={}.hasOwnProperty,gC=new Map,pC=/[A-Z]/g,mC=new Set(["table","tbody","thead","tfoot","tr"]),xC=new Set(["td","th"]),jm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=TC(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=_C(r,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Eh:iC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Im(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function Im(e,t,r){if(t.type==="element")return bC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return kC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return vC(e,t,r);if(t.type==="mdxjsEsm")return wC(e,t);if(t.type==="root")return CC(e,t,r);if(t.type==="text")return SC(e,t)}function bC(e,t,r){const n=e.schema;let s=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(s=Eh,e.schema=s),e.ancestors.push(t);const i=$m(e,t.tagName,!1),a=NC(e,t);let o=Ih(e,t);return mC.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!Xv(l):!0})),Lm(e,a,i,t),jh(a,o),e.ancestors.pop(),e.schema=n,e.create(t,i,a,r)}function kC(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ji(e,t.position)}function wC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ji(e,t.position)}function vC(e,t,r){const n=e.schema;let s=n;t.name==="svg"&&n.space==="html"&&(s=Eh,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:$m(e,t.name,!0),a=EC(e,t),o=Ih(e,t);return Lm(e,a,i,t),jh(a,o),e.ancestors.pop(),e.schema=n,e.create(t,i,a,r)}function CC(e,t,r){const n={};return jh(n,Ih(e,t)),e.create(t,e.Fragment,n,r)}function SC(e,t){return t.value}function Lm(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function jh(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function _C(e,t,r){return n;function n(s,i,a,o){const c=Array.isArray(a.children)?r:t;return o?c(i,a,o):c(i,a)}}function TC(e,t){return r;function r(n,s,i,a){const o=Array.isArray(i.children),l=Ah(n);return t(s,i,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function NC(e,t){const r={};let n,s;for(s in t.properties)if(s!=="children"&&Mh.call(t.properties,s)){const i=AC(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&xC.has(t.tagName)?n=o:r[a]=o}}if(n){const i=r.style||(r.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function EC(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(r,e.evaluater.evaluateExpression(o.argument))}else Ji(e,t.position);else{const s=n.name;let i;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const o=n.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else Ji(e,t.position);else i=n.value===null?!0:n.value;r[s]=i}return r}function Ih(e,t){const r=[];let n=-1;const s=e.passKeys?new Map:gC;for(;++n<t.children.length;){const i=t.children[n];let a;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=s.get(l)||0;a=l+"-"+c,s.set(l,c+1)}}const o=Im(e,i,a);o!==void 0&&r.push(o)}return r}function AC(e,t,r){const n=rC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?qv(r):aC(r)),n.property==="style"){let s=typeof r=="object"?r:MC(e,String(r));return e.stylePropertyNameCase==="css"&&(s=jC(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&n.space?Jv[n.property]||n.property:n.attribute,r]}}function MC(e,t){try{return dC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,s=new Dt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=jm+"#cannot-parse-style-attribute",s}}function $m(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,a;for(;++i<s.length;){const o=ef(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}n=a}else n=ef(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const s=n.value;return Mh.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(n);Ji(e)}function Ji(e,t){const r=new Dt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=jm+"#cannot-handle-mdx-estrees-without-createevaluater",r}function jC(e){const t={};let r;for(r in e)Mh.call(e,r)&&(t[IC(r)]=e[r]);return t}function IC(e){let t=e.replace(pC,LC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function LC(e){return"-"+e.toLowerCase()}const uc={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},$C={};function Lh(e,t){const r=$C,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Dm(e,n,s)}function Dm(e,t,r){if(DC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return hf(e.children,t,r)}return Array.isArray(e)?hf(e,t,r):""}function hf(e,t,r){const n=[];let s=-1;for(;++s<e.length;)n[s]=Dm(e[s],t,r);return n.join("")}function DC(e){return!!(e&&typeof e=="object")}const df=document.createElement("i");function $h(e){const t="&"+e+";";df.innerHTML=t;const r=df.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function or(e,t,r,n){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,r=r>0?r:0,n.length<1e4)a=Array.from(n),a.unshift(t,r),e.splice(...a);else for(r&&e.splice(t,r);i<n.length;)a=n.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function fr(e,t){return e.length>0?(or(e,e.length,0,t),e):t}const ff={}.hasOwnProperty;function Bm(e){const t={};let r=-1;for(;++r<e.length;)BC(t,e[r]);return t}function BC(e,t){let r;for(r in t){const s=(ff.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];let a;if(i)for(a in i){ff.call(s,a)||(s[a]=[]);const o=i[a];RC(s[a],Array.isArray(o)?o:o?[o]:[])}}}function RC(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);or(e,0,0,n)}function Rm(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Nr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ft=jn(/[A-Za-z]/),jt=jn(/[\dA-Za-z]/),PC=jn(/[#-'*+\--9=?A-Z^-~]/);function wo(e){return e!==null&&(e<32||e===127)}const au=jn(/\d/),FC=jn(/[\dA-Fa-f]/),OC=jn(/[!-/:-@[-`{-~]/);function ke(e){return e!==null&&e<-2}function Qe(e){return e!==null&&(e<0||e===32)}function Re(e){return e===-2||e===-1||e===32}const hl=jn(new RegExp("\\p{P}|\\p{S}","u")),rs=jn(/\s/);function jn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ri(e){const t=[];let r=-1,n=0,s=0;for(;++r<e.length;){const i=e.charCodeAt(r);let a="";if(i===37&&jt(e.charCodeAt(r+1))&&jt(e.charCodeAt(r+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(r+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(n,r),encodeURIComponent(a)),n=r+s+1,a=""),s&&(r+=s,s=0)}return t.join("")+e.slice(n)}function Oe(e,t,r,n){const s=n?n-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return Re(l)?(e.enter(r),o(l)):t(l)}function o(l){return Re(l)&&i++<s?(e.consume(l),o):(e.exit(r),t(l))}}const zC={tokenize:WC};function WC(e){const t=e.attempt(this.parser.constructs.contentInitial,n,s);let r;return t;function n(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Oe(e,t,"linePrefix")}function s(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ke(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),a)}}const HC={tokenize:qC},gf={tokenize:UC};function qC(e){const t=this,r=[];let n=0,s,i,a;return o;function o(v){if(n<r.length){const _=r[n];return t.containerState=_[1],e.attempt(_[0].continuation,l,c)(v)}return c(v)}function l(v){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&k();const _=t.events.length;let C=_,w;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){w=t.events[C][1].end;break}x(n);let S=_;for(;S<t.events.length;)t.events[S][1].end={...w},S++;return or(t.events,C+1,0,t.events.slice(_)),t.events.length=S,c(v)}return o(v)}function c(v){if(n===r.length){if(!s)return f(v);if(s.currentConstruct&&s.currentConstruct.concrete)return p(v);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(gf,u,h)(v)}function u(v){return s&&k(),x(n),f(v)}function h(v){return t.parser.lazy[t.now().line]=n!==r.length,a=t.now().offset,p(v)}function f(v){return t.containerState={},e.attempt(gf,g,p)(v)}function g(v){return n++,r.push([t.currentConstruct,t.containerState]),f(v)}function p(v){if(v===null){s&&k(),x(0),e.consume(v);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),m(v)}function m(v){if(v===null){y(e.exit("chunkFlow"),!0),x(0),e.consume(v);return}return ke(v)?(e.consume(v),y(e.exit("chunkFlow")),n=0,t.interrupt=void 0,o):(e.consume(v),m)}function y(v,_){const C=t.sliceStream(v);if(_&&C.push(null),v.previous=i,i&&(i.next=v),i=v,s.defineSkip(v.start),s.write(C),t.parser.lazy[v.start.line]){let w=s.events.length;for(;w--;)if(s.events[w][1].start.offset<a&&(!s.events[w][1].end||s.events[w][1].end.offset>a))return;const S=t.events.length;let F=S,A,T;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(A){T=t.events[F][1].end;break}A=!0}for(x(n),w=S;w<t.events.length;)t.events[w][1].end={...T},w++;or(t.events,F+1,0,t.events.slice(S)),t.events.length=w}}function x(v){let _=r.length;for(;_-- >v;){const C=r[_];t.containerState=C[1],C[0].exit.call(t,e)}r.length=v}function k(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function UC(e,t,r){return Oe(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Us(e){if(e===null||Qe(e)||rs(e))return 1;if(hl(e))return 2}function dl(e,t,r){const n=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!n.includes(i)&&(t=i(t,r),n.push(i))}return t}const ou={name:"attention",resolveAll:VC,tokenize:GC};function VC(e,t){let r=-1,n,s,i,a,o,l,c,u;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[n][1].end},f={...e[r][1].start};pf(h,-l),pf(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[n][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},s={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[n][1].end={...a.start},e[r][1].start={...o.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=fr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=fr(c,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),c=fr(c,dl(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=fr(c,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[r][1].end.offset-e[r][1].start.offset?(u=2,c=fr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):u=0,or(e,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function GC(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,s=Us(n);let i;return a;function a(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const c=e.exit("attentionSequence"),u=Us(l),h=!u||u===2&&s||r.includes(l),f=!s||s===2&&u||r.includes(n);return c._open=!!(i===42?h:h&&(s||!f)),c._close=!!(i===42?f:f&&(u||!h)),t(l)}}function pf(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const YC={name:"autolink",tokenize:XC};function XC(e,t,r){let n=0;return s;function s(g){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(g){return Ft(g)?(e.consume(g),a):g===64?r(g):c(g)}function a(g){return g===43||g===45||g===46||jt(g)?(n=1,o(g)):c(g)}function o(g){return g===58?(e.consume(g),n=0,l):(g===43||g===45||g===46||jt(g))&&n++<32?(e.consume(g),o):(n=0,c(g))}function l(g){return g===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):g===null||g===32||g===60||wo(g)?r(g):(e.consume(g),l)}function c(g){return g===64?(e.consume(g),u):PC(g)?(e.consume(g),c):r(g)}function u(g){return jt(g)?h(g):r(g)}function h(g){return g===46?(e.consume(g),n=0,u):g===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):f(g)}function f(g){if((g===45||jt(g))&&n++<63){const p=g===45?f:h;return e.consume(g),p}return r(g)}}const ma={partial:!0,tokenize:KC};function KC(e,t,r){return n;function n(i){return Re(i)?Oe(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||ke(i)?t(i):r(i)}}const Pm={continuation:{tokenize:ZC},exit:JC,name:"blockQuote",tokenize:QC};function QC(e,t,r){const n=this;return s;function s(a){if(a===62){const o=n.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return r(a)}function i(a){return Re(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function ZC(e,t,r){const n=this;return s;function s(a){return Re(a)?Oe(e,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(Pm,t,r)(a)}}function JC(e){e.exit("blockQuote")}const Fm={name:"characterEscape",tokenize:eS};function eS(e,t,r){return n;function n(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return OC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(i)}}const Om={name:"characterReference",tokenize:tS};function tS(e,t,r){const n=this;let s=0,i,a;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,a=jt,u(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=FC,u):(e.enter("characterReferenceValue"),i=7,a=au,u(h))}function u(h){if(h===59&&s){const f=e.exit("characterReferenceValue");return a===jt&&!$h(n.sliceSerialize(f))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&s++<i?(e.consume(h),u):r(h)}}const mf={partial:!0,tokenize:nS},xf={concrete:!0,name:"codeFenced",tokenize:rS};function rS(e,t,r){const n=this,s={partial:!0,tokenize:C};let i=0,a=0,o;return l;function l(w){return c(w)}function c(w){const S=n.events[n.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===o?(a++,e.consume(w),u):a<3?r(w):(e.exit("codeFencedFenceSequence"),Re(w)?Oe(e,h,"whitespace")(w):h(w))}function h(w){return w===null||ke(w)?(e.exit("codeFencedFence"),n.interrupt?t(w):e.check(mf,m,_)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||ke(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):Re(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Oe(e,g,"whitespace")(w)):w===96&&w===o?r(w):(e.consume(w),f)}function g(w){return w===null||ke(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||ke(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===o?r(w):(e.consume(w),p)}function m(w){return e.attempt(s,_,y)(w)}function y(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),x}function x(w){return i>0&&Re(w)?Oe(e,k,"linePrefix",i+1)(w):k(w)}function k(w){return w===null||ke(w)?e.check(mf,m,_)(w):(e.enter("codeFlowValue"),v(w))}function v(w){return w===null||ke(w)?(e.exit("codeFlowValue"),k(w)):(e.consume(w),v)}function _(w){return e.exit("codeFenced"),t(w)}function C(w,S,F){let A=0;return T;function T(R){return w.enter("lineEnding"),w.consume(R),w.exit("lineEnding"),j}function j(R){return w.enter("codeFencedFence"),Re(R)?Oe(w,M,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):M(R)}function M(R){return R===o?(w.enter("codeFencedFenceSequence"),P(R)):F(R)}function P(R){return R===o?(A++,w.consume(R),P):A>=a?(w.exit("codeFencedFenceSequence"),Re(R)?Oe(w,$,"whitespace")(R):$(R)):F(R)}function $(R){return R===null||ke(R)?(w.exit("codeFencedFence"),S(R)):F(R)}}}function nS(e,t,r){const n=this;return s;function s(a){return a===null?r(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return n.parser.lazy[n.now().line]?r(a):t(a)}}const hc={name:"codeIndented",tokenize:iS},sS={partial:!0,tokenize:aS};function iS(e,t,r){const n=this;return s;function s(c){return e.enter("codeIndented"),Oe(e,i,"linePrefix",5)(c)}function i(c){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):r(c)}function a(c){return c===null?l(c):ke(c)?e.attempt(sS,a,l)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||ke(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),o)}function l(c){return e.exit("codeIndented"),t(c)}}function aS(e,t,r){const n=this;return s;function s(a){return n.parser.lazy[n.now().line]?r(a):ke(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Oe(e,i,"linePrefix",5)(a)}function i(a){const o=n.events[n.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):ke(a)?s(a):r(a)}}const oS={name:"codeText",previous:cS,resolve:lS,tokenize:uS};function lS(e){let t=e.length-4,r=3,n,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)s===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(s=n):(n===t||e[n][1].type==="lineEnding")&&(e[s][1].type="codeTextData",n!==s+2&&(e[s][1].end=e[n-1][1].end,e.splice(s+2,n-s-2),t-=n-s-2,n=s+2),s=void 0);return e}function cS(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uS(e,t,r){let n=0,s,i;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),n++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),s=0,u(h)):ke(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||ke(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),c)}function u(h){return h===96?(e.consume(h),s++,u):s===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",c(h))}}class hS{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const s=r||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return n&&xi(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),xi(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),xi(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);xi(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);xi(this.left,r.reverse())}}}function xi(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function zm(e){const t={};let r=-1,n,s,i,a,o,l,c;const u=new hS(e);for(;++r<u.length;){for(;r in t;)r=t[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,dS(u,r)),r=t[r],c=!0);else if(n[1]._container){for(i=r,s=void 0;i--;)if(a=u.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(n[1].end={...u.get(s)[1].start},o=u.slice(s,r),o.unshift(n),u.splice(s,r-s+1,o))}}return or(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function dS(e,t){const r=e.get(t)[1],n=e.get(t)[2];let s=t-1;const i=[];let a=r._tokenizer;a||(a=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],c={};let u,h,f=-1,g=r,p=0,m=0;const y=[m];for(;g;){for(;e.get(++s)[1]!==g;);i.push(s),g._tokenizer||(u=n.sliceStream(g),g.next||u.push(null),h&&a.defineSkip(g.start),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=g,g=g.next}for(g=r;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(m=f+1,y.push(m),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(a.events=[],g?(g._tokenizer=void 0,g.previous=void 0):y.pop(),f=y.length;f--;){const x=o.slice(y[f],y[f+1]),k=i.pop();l.push([k,k+x.length-1]),e.splice(k,2,x)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const fS={resolve:pS,tokenize:mS},gS={partial:!0,tokenize:xS};function pS(e){return zm(e),e}function mS(e,t){let r;return n;function n(o){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(o)}function s(o){return o===null?i(o):ke(o)?e.check(gS,a,i)(o):(e.consume(o),s)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function xS(e,t,r){const n=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Oe(e,i,"linePrefix")}function i(a){if(a===null||ke(a))return r(a);const o=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(n.parser.constructs.flow,r,t)(a)}}function Wm(e,t,r,n,s,i,a,o,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return h;function h(x){return x===60?(e.enter(n),e.enter(s),e.enter(i),e.consume(x),e.exit(i),f):x===null||x===32||x===41||wo(x)?r(x):(e.enter(n),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(x))}function f(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(s),e.exit(n),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===62?(e.exit("chunkString"),e.exit(o),f(x)):x===null||x===60||ke(x)?r(x):(e.consume(x),x===92?p:g)}function p(x){return x===60||x===62||x===92?(e.consume(x),g):g(x)}function m(x){return!u&&(x===null||x===41||Qe(x))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(n),t(x)):u<c&&x===40?(e.consume(x),u++,m):x===41?(e.consume(x),u--,m):x===null||x===32||x===40||wo(x)?r(x):(e.consume(x),x===92?y:m)}function y(x){return x===40||x===41||x===92?(e.consume(x),m):m(x)}}function Hm(e,t,r,n,s,i){const a=this;let o=0,l;return c;function c(g){return e.enter(n),e.enter(s),e.consume(g),e.exit(s),e.enter(i),u}function u(g){return o>999||g===null||g===91||g===93&&!l||g===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?r(g):g===93?(e.exit(i),e.enter(s),e.consume(g),e.exit(s),e.exit(n),t):ke(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===null||g===91||g===93||ke(g)||o++>999?(e.exit("chunkString"),u(g)):(e.consume(g),l||(l=!Re(g)),g===92?f:h)}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function qm(e,t,r,n,s,i){let a;return o;function o(f){return f===34||f===39||f===40?(e.enter(n),e.enter(s),e.consume(f),e.exit(s),a=f===40?41:f,l):r(f)}function l(f){return f===a?(e.enter(s),e.consume(f),e.exit(s),e.exit(n),t):(e.enter(i),c(f))}function c(f){return f===a?(e.exit(i),l(a)):f===null?r(f):ke(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Oe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||ke(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:u)}function h(f){return f===a||f===92?(e.consume(f),u):u(f)}}function qi(e,t){let r;return n;function n(s){return ke(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,n):Re(s)?Oe(e,n,r?"linePrefix":"lineSuffix")(s):t(s)}}const yS={name:"definition",tokenize:kS},bS={partial:!0,tokenize:wS};function kS(e,t,r){const n=this;let s;return i;function i(g){return e.enter("definition"),a(g)}function a(g){return Hm.call(n,e,o,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function o(g){return s=Nr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),l):r(g)}function l(g){return Qe(g)?qi(e,c)(g):c(g)}function c(g){return Wm(e,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function u(g){return e.attempt(bS,h,h)(g)}function h(g){return Re(g)?Oe(e,f,"whitespace")(g):f(g)}function f(g){return g===null||ke(g)?(e.exit("definition"),n.parser.defined.push(s),t(g)):r(g)}}function wS(e,t,r){return n;function n(o){return Qe(o)?qi(e,s)(o):r(o)}function s(o){return qm(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Re(o)?Oe(e,a,"whitespace")(o):a(o)}function a(o){return o===null||ke(o)?t(o):r(o)}}const vS={name:"hardBreakEscape",tokenize:CS};function CS(e,t,r){return n;function n(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return ke(i)?(e.exit("hardBreakEscape"),t(i)):r(i)}}const SS={name:"headingAtx",resolve:_S,tokenize:TS};function _S(e,t){let r=e.length-2,n=3,s,i;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(s={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},i={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},or(e,n,r-n+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function TS(e,t,r){let n=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&n++<6?(e.consume(u),a):u===null||Qe(u)?(e.exit("atxHeadingSequence"),o(u)):r(u)}function o(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||ke(u)?(e.exit("atxHeading"),t(u)):Re(u)?Oe(e,o,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),o(u))}function c(u){return u===null||u===35||Qe(u)?(e.exit("atxHeadingText"),o(u)):(e.consume(u),c)}}const NS=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],yf=["pre","script","style","textarea"],ES={concrete:!0,name:"htmlFlow",resolveTo:jS,tokenize:IS},AS={partial:!0,tokenize:$S},MS={partial:!0,tokenize:LS};function jS(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function IS(e,t,r){const n=this;let s,i,a,o,l;return c;function c(N){return u(N)}function u(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),h}function h(N){return N===33?(e.consume(N),f):N===47?(e.consume(N),i=!0,m):N===63?(e.consume(N),s=3,n.interrupt?t:E):Ft(N)?(e.consume(N),a=String.fromCharCode(N),y):r(N)}function f(N){return N===45?(e.consume(N),s=2,g):N===91?(e.consume(N),s=5,o=0,p):Ft(N)?(e.consume(N),s=4,n.interrupt?t:E):r(N)}function g(N){return N===45?(e.consume(N),n.interrupt?t:E):r(N)}function p(N){const B="CDATA[";return N===B.charCodeAt(o++)?(e.consume(N),o===B.length?n.interrupt?t:M:p):r(N)}function m(N){return Ft(N)?(e.consume(N),a=String.fromCharCode(N),y):r(N)}function y(N){if(N===null||N===47||N===62||Qe(N)){const B=N===47,V=a.toLowerCase();return!B&&!i&&yf.includes(V)?(s=1,n.interrupt?t(N):M(N)):NS.includes(a.toLowerCase())?(s=6,B?(e.consume(N),x):n.interrupt?t(N):M(N)):(s=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(N):i?k(N):v(N))}return N===45||jt(N)?(e.consume(N),a+=String.fromCharCode(N),y):r(N)}function x(N){return N===62?(e.consume(N),n.interrupt?t:M):r(N)}function k(N){return Re(N)?(e.consume(N),k):T(N)}function v(N){return N===47?(e.consume(N),T):N===58||N===95||Ft(N)?(e.consume(N),_):Re(N)?(e.consume(N),v):T(N)}function _(N){return N===45||N===46||N===58||N===95||jt(N)?(e.consume(N),_):C(N)}function C(N){return N===61?(e.consume(N),w):Re(N)?(e.consume(N),C):v(N)}function w(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),l=N,S):Re(N)?(e.consume(N),w):F(N)}function S(N){return N===l?(e.consume(N),l=null,A):N===null||ke(N)?r(N):(e.consume(N),S)}function F(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Qe(N)?C(N):(e.consume(N),F)}function A(N){return N===47||N===62||Re(N)?v(N):r(N)}function T(N){return N===62?(e.consume(N),j):r(N)}function j(N){return N===null||ke(N)?M(N):Re(N)?(e.consume(N),j):r(N)}function M(N){return N===45&&s===2?(e.consume(N),I):N===60&&s===1?(e.consume(N),O):N===62&&s===4?(e.consume(N),D):N===63&&s===3?(e.consume(N),E):N===93&&s===5?(e.consume(N),Z):ke(N)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(AS,X,P)(N)):N===null||ke(N)?(e.exit("htmlFlowData"),P(N)):(e.consume(N),M)}function P(N){return e.check(MS,$,X)(N)}function $(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),R}function R(N){return N===null||ke(N)?P(N):(e.enter("htmlFlowData"),M(N))}function I(N){return N===45?(e.consume(N),E):M(N)}function O(N){return N===47?(e.consume(N),a="",W):M(N)}function W(N){if(N===62){const B=a.toLowerCase();return yf.includes(B)?(e.consume(N),D):M(N)}return Ft(N)&&a.length<8?(e.consume(N),a+=String.fromCharCode(N),W):M(N)}function Z(N){return N===93?(e.consume(N),E):M(N)}function E(N){return N===62?(e.consume(N),D):N===45&&s===2?(e.consume(N),E):M(N)}function D(N){return N===null||ke(N)?(e.exit("htmlFlowData"),X(N)):(e.consume(N),D)}function X(N){return e.exit("htmlFlow"),t(N)}}function LS(e,t,r){const n=this;return s;function s(a){return ke(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):r(a)}function i(a){return n.parser.lazy[n.now().line]?r(a):t(a)}}function $S(e,t,r){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ma,t,r)}}const DS={name:"htmlText",tokenize:BS};function BS(e,t,r){const n=this;let s,i,a;return o;function o(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),c):E===47?(e.consume(E),C):E===63?(e.consume(E),v):Ft(E)?(e.consume(E),F):r(E)}function c(E){return E===45?(e.consume(E),u):E===91?(e.consume(E),i=0,p):Ft(E)?(e.consume(E),k):r(E)}function u(E){return E===45?(e.consume(E),g):r(E)}function h(E){return E===null?r(E):E===45?(e.consume(E),f):ke(E)?(a=h,O(E)):(e.consume(E),h)}function f(E){return E===45?(e.consume(E),g):h(E)}function g(E){return E===62?I(E):E===45?f(E):h(E)}function p(E){const D="CDATA[";return E===D.charCodeAt(i++)?(e.consume(E),i===D.length?m:p):r(E)}function m(E){return E===null?r(E):E===93?(e.consume(E),y):ke(E)?(a=m,O(E)):(e.consume(E),m)}function y(E){return E===93?(e.consume(E),x):m(E)}function x(E){return E===62?I(E):E===93?(e.consume(E),x):m(E)}function k(E){return E===null||E===62?I(E):ke(E)?(a=k,O(E)):(e.consume(E),k)}function v(E){return E===null?r(E):E===63?(e.consume(E),_):ke(E)?(a=v,O(E)):(e.consume(E),v)}function _(E){return E===62?I(E):v(E)}function C(E){return Ft(E)?(e.consume(E),w):r(E)}function w(E){return E===45||jt(E)?(e.consume(E),w):S(E)}function S(E){return ke(E)?(a=S,O(E)):Re(E)?(e.consume(E),S):I(E)}function F(E){return E===45||jt(E)?(e.consume(E),F):E===47||E===62||Qe(E)?A(E):r(E)}function A(E){return E===47?(e.consume(E),I):E===58||E===95||Ft(E)?(e.consume(E),T):ke(E)?(a=A,O(E)):Re(E)?(e.consume(E),A):I(E)}function T(E){return E===45||E===46||E===58||E===95||jt(E)?(e.consume(E),T):j(E)}function j(E){return E===61?(e.consume(E),M):ke(E)?(a=j,O(E)):Re(E)?(e.consume(E),j):A(E)}function M(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(e.consume(E),s=E,P):ke(E)?(a=M,O(E)):Re(E)?(e.consume(E),M):(e.consume(E),$)}function P(E){return E===s?(e.consume(E),s=void 0,R):E===null?r(E):ke(E)?(a=P,O(E)):(e.consume(E),P)}function $(E){return E===null||E===34||E===39||E===60||E===61||E===96?r(E):E===47||E===62||Qe(E)?A(E):(e.consume(E),$)}function R(E){return E===47||E===62||Qe(E)?A(E):r(E)}function I(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):r(E)}function O(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),W}function W(E){return Re(E)?Oe(e,Z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):Z(E)}function Z(E){return e.enter("htmlTextData"),a(E)}}const Dh={name:"labelEnd",resolveAll:OS,resolveTo:zS,tokenize:WS},RS={tokenize:HS},PS={tokenize:qS},FS={tokenize:US};function OS(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const s=n.type==="labelImage"?4:2;n.type="data",t+=s}}return e.length!==r.length&&or(e,0,e.length,r),e}function zS(e,t){let r=e.length,n=0,s,i,a,o;for(;r--;)if(s=e[r][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=r,s.type!=="labelLink")){n=2;break}}else s.type==="labelEnd"&&(a=r);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[i+n+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=fr(o,e.slice(i+1,i+n+3)),o=fr(o,[["enter",u,t]]),o=fr(o,dl(t.parser.constructs.insideSpan.null,e.slice(i+n+4,a-3),t)),o=fr(o,[["exit",u,t],e[a-2],e[a-1],["exit",c,t]]),o=fr(o,e.slice(a+1)),o=fr(o,[["exit",l,t]]),or(e,i,e.length,o),e}function WS(e,t,r){const n=this;let s=n.events.length,i,a;for(;s--;)if((n.events[s][1].type==="labelImage"||n.events[s][1].type==="labelLink")&&!n.events[s][1]._balanced){i=n.events[s][1];break}return o;function o(f){return i?i._inactive?h(f):(a=n.parser.defined.includes(Nr(n.sliceSerialize({start:i.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):r(f)}function l(f){return f===40?e.attempt(RS,u,a?u:h)(f):f===91?e.attempt(PS,u,a?c:h)(f):a?u(f):h(f)}function c(f){return e.attempt(FS,u,h)(f)}function u(f){return t(f)}function h(f){return i._balanced=!0,r(f)}}function HS(e,t,r){return n;function n(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),s}function s(h){return Qe(h)?qi(e,i)(h):i(h)}function i(h){return h===41?u(h):Wm(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Qe(h)?qi(e,l)(h):u(h)}function o(h){return r(h)}function l(h){return h===34||h===39||h===40?qm(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):u(h)}function c(h){return Qe(h)?qi(e,u)(h):u(h)}function u(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):r(h)}}function qS(e,t,r){const n=this;return s;function s(o){return Hm.call(n,e,i,a,"reference","referenceMarker","referenceString")(o)}function i(o){return n.parser.defined.includes(Nr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(o):r(o)}function a(o){return r(o)}}function US(e,t,r){return n;function n(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):r(i)}}const VS={name:"labelStartImage",resolveAll:Dh.resolveAll,tokenize:GS};function GS(e,t,r){const n=this;return s;function s(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):r(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const YS={name:"labelStartLink",resolveAll:Dh.resolveAll,tokenize:XS};function XS(e,t,r){const n=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):t(a)}}const dc={name:"lineEnding",tokenize:KS};function KS(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Oe(e,t,"linePrefix")}}const so={name:"thematicBreak",tokenize:QS};function QS(e,t,r){let n=0,s;return i;function i(c){return e.enter("thematicBreak"),a(c)}function a(c){return s=c,o(c)}function o(c){return c===s?(e.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||ke(c))?(e.exit("thematicBreak"),t(c)):r(c)}function l(c){return c===s?(e.consume(c),n++,l):(e.exit("thematicBreakSequence"),Re(c)?Oe(e,o,"whitespace")(c):o(c))}}const Jt={continuation:{tokenize:t2},exit:n2,name:"list",tokenize:e2},ZS={partial:!0,tokenize:s2},JS={partial:!0,tokenize:r2};function e2(e,t,r){const n=this,s=n.events[n.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(g){const p=n.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!n.containerState.marker||g===n.containerState.marker:au(g)){if(n.containerState.type||(n.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),g===42||g===45?e.check(so,r,c)(g):c(g);if(!n.interrupt||g===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(g)}return r(g)}function l(g){return au(g)&&++a<10?(e.consume(g),l):(!n.interrupt||a<2)&&(n.containerState.marker?g===n.containerState.marker:g===41||g===46)?(e.exit("listItemValue"),c(g)):r(g)}function c(g){return e.enter("listItemMarker"),e.consume(g),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||g,e.check(ma,n.interrupt?r:u,e.attempt(ZS,f,h))}function u(g){return n.containerState.initialBlankLine=!0,i++,f(g)}function h(g){return Re(g)?(e.enter("listItemPrefixWhitespace"),e.consume(g),e.exit("listItemPrefixWhitespace"),f):r(g)}function f(g){return n.containerState.size=i+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(g)}}function t2(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(ma,s,i);function s(o){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Oe(e,t,"listItemIndent",n.containerState.size+1)(o)}function i(o){return n.containerState.furtherBlankLines||!Re(o)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(o)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(JS,t,a)(o))}function a(o){return n.containerState._closeFlow=!0,n.interrupt=void 0,Oe(e,e.attempt(Jt,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function r2(e,t,r){const n=this;return Oe(e,s,"listItemIndent",n.containerState.size+1);function s(i){const a=n.events[n.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?t(i):r(i)}}function n2(e){e.exit(this.containerState.type)}function s2(e,t,r){const n=this;return Oe(e,s,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=n.events[n.events.length-1];return!Re(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):r(i)}}const bf={name:"setextUnderline",resolveTo:i2,tokenize:a2};function i2(e,t){let r=e.length,n,s,i;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!i&&e[r][1].type==="definition"&&(i=r);const a={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=a,e.push(["exit",a,t]),e}function a2(e,t,r){const n=this;let s;return i;function i(c){let u=n.events.length,h;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){h=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(e.enter("setextHeadingLine"),s=c,a(c)):r(c)}function a(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===s?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),Re(c)?Oe(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ke(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const o2={tokenize:l2};function l2(e){const t=this,r=e.attempt(ma,n,e.attempt(this.parser.constructs.flowInitial,s,Oe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(fS,s)),"linePrefix")));return r;function n(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const c2={resolveAll:Vm()},u2=Um("string"),h2=Um("text");function Um(e){return{resolveAll:Vm(e==="text"?d2:void 0),tokenize:t};function t(r){const n=this,s=this.parser.constructs[e],i=r.attempt(s,a,o);return a;function a(u){return c(u)?i(u):o(u)}function o(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),i(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;const h=s[u];let f=-1;if(h)for(;++f<h.length;){const g=h[f];if(!g.previous||g.previous.call(n,n.previous))return!0}return!1}}}function Vm(e){return t;function t(r,n){let s=-1,i;for(;++s<=r.length;)i===void 0?r[s]&&r[s][1].type==="data"&&(i=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==i+2&&(r[i][1].end=r[s-1][1].end,r.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(r,n):r}}function d2(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],s=t.sliceStream(n);let i=s.length,a=-1,o=0,l;for(;i--;){const c=s[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(o=0),o){const c={type:r===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:n.start._bufferIndex+a,_index:n.start._index+i,line:n.end.line,column:n.end.column-o,offset:n.end.offset-o},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const f2={42:Jt,43:Jt,45:Jt,48:Jt,49:Jt,50:Jt,51:Jt,52:Jt,53:Jt,54:Jt,55:Jt,56:Jt,57:Jt,62:Pm},g2={91:yS},p2={[-2]:hc,[-1]:hc,32:hc},m2={35:SS,42:so,45:[bf,so],60:ES,61:bf,95:so,96:xf,126:xf},x2={38:Om,92:Fm},y2={[-5]:dc,[-4]:dc,[-3]:dc,33:VS,38:Om,42:ou,60:[YC,DS],91:YS,92:[vS,Fm],93:Dh,95:ou,96:oS},b2={null:[ou,c2]},k2={null:[42,95]},w2={null:[]},v2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:k2,contentInitial:g2,disable:w2,document:f2,flow:m2,flowInitial:p2,insideSpan:b2,string:x2,text:y2},Symbol.toStringTag,{value:"Module"}));function C2(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},i=[];let a=[],o=[];const l={attempt:S(C),check:S(w),consume:k,enter:v,exit:_,interrupt:S(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:g,write:h};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function h(j){return a=fr(a,j),y(),a[a.length-1]!==null?[]:(F(t,0),c.events=dl(i,c.events,c),c.events)}function f(j,M){return _2(g(j),M)}function g(j){return S2(a,j)}function p(){const{_bufferIndex:j,_index:M,line:P,column:$,offset:R}=n;return{_bufferIndex:j,_index:M,line:P,column:$,offset:R}}function m(j){s[j.line]=j.column,T()}function y(){let j;for(;n._index<a.length;){const M=a[n._index];if(typeof M=="string")for(j=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===j&&n._bufferIndex<M.length;)x(M.charCodeAt(n._bufferIndex));else x(M)}}function x(j){u=u(j)}function k(j){ke(j)?(n.line++,n.column=1,n.offset+=j===-3?2:1,T()):j!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===a[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=j}function v(j,M){const P=M||{};return P.type=j,P.start=p(),c.events.push(["enter",P,c]),o.push(P),P}function _(j){const M=o.pop();return M.end=p(),c.events.push(["exit",M,c]),M}function C(j,M){F(j,M.from)}function w(j,M){M.restore()}function S(j,M){return P;function P($,R,I){let O,W,Z,E;return Array.isArray($)?X($):"tokenize"in $?X([$]):D($);function D(H){return q;function q(Y){const J=Y!==null&&H[Y],re=Y!==null&&H.null,we=[...Array.isArray(J)?J:J?[J]:[],...Array.isArray(re)?re:re?[re]:[]];return X(we)(Y)}}function X(H){return O=H,W=0,H.length===0?I:N(H[W])}function N(H){return q;function q(Y){return E=A(),Z=H,H.partial||(c.currentConstruct=H),H.name&&c.parser.constructs.disable.null.includes(H.name)?V():H.tokenize.call(M?Object.assign(Object.create(c),M):c,l,B,V)(Y)}}function B(H){return j(Z,E),R}function V(H){return E.restore(),++W<O.length?N(O[W]):I}}}function F(j,M){j.resolveAll&&!i.includes(j)&&i.push(j),j.resolve&&or(c.events,M,c.events.length-M,j.resolve(c.events.slice(M),c)),j.resolveTo&&(c.events=j.resolveTo(c.events,c))}function A(){const j=p(),M=c.previous,P=c.currentConstruct,$=c.events.length,R=Array.from(o);return{from:$,restore:I};function I(){n=j,c.previous=M,c.currentConstruct=P,c.events.length=$,o=R,T()}}function T(){n.line in s&&n.column<2&&(n.column=s[n.line],n.offset+=s[n.line]-1)}}function S2(e,t){const r=t.start._index,n=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let a;if(r===s)a=[e[r].slice(n,i)];else{if(a=e.slice(r,s),n>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(n):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function _2(e,t){let r=-1;const n=[];let s;for(;++r<e.length;){const i=e[r];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
109
|
-
`;break}case-3:{a=`\r
|
|
110
|
-
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,n.push(a)}return n.join("")}function T2(e){const n={constructs:Bm([v2,...(e||{}).extensions||[]]),content:s(zC),defined:[],document:s(HC),flow:s(o2),lazy:{},string:s(u2),text:s(h2)};return n;function s(i){return a;function a(o){return C2(n,i,o)}}}function N2(e){for(;!zm(e););return e}const kf=/[\0\t\n\r]/g;function E2(){let e=1,t="",r=!0,n;return s;function s(i,a,o){const l=[];let c,u,h,f,g;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,t="",r&&(i.charCodeAt(0)===65279&&h++,r=void 0);h<i.length;){if(kf.lastIndex=h,c=kf.exec(i),f=c&&c.index!==void 0?c.index:i.length,g=i.charCodeAt(f),!c){t=i.slice(h);break}if(g===10&&h===f&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),h<f&&(l.push(i.slice(h,f)),e+=f-h),g){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:n=!0,e=1}h=f+1}return o&&(n&&l.push(-5),t&&l.push(t),l.push(null)),l}}const A2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function M2(e){return e.replace(A2,j2)}function j2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),i=s===120||s===88;return Rm(r.slice(i?2:1),i?16:10)}return $h(r)||e}const Gm={}.hasOwnProperty;function I2(e,t,r){return typeof t!="string"&&(r=t,t=void 0),L2(r)(N2(T2(r).document().write(E2()(e,t,!0))))}function L2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Nt),autolinkProtocol:A,autolinkEmail:A,atxHeading:i(Xe),blockQuote:i(re),characterEscape:A,characterReference:A,codeFenced:i(we),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(we,a),codeText:i(Ne,a),codeTextData:A,data:A,codeFlowValue:A,definition:i(Ce),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Le),hardBreakEscape:i(ct),hardBreakTrailing:i(ct),htmlFlow:i(Ze,a),htmlFlowData:A,htmlText:i(Ze,a),htmlTextData:A,image:i(vt),label:a,link:i(Nt),listItem:i(Rt),listItemValue:f,listOrdered:i(We,h),listUnordered:i(We),paragraph:i(ut),reference:N,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Xe),strong:i(Vt),thematicBreak:i(je)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:J,autolinkProtocol:Y,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:H,characterReference:q,codeFenced:l(y),codeFencedFence:m,codeFencedFenceInfo:g,codeFencedFenceMeta:p,codeFlowValue:T,codeIndented:l(x),codeText:l(R),codeTextData:T,data:T,definition:l(),definitionDestinationString:_,definitionLabelString:k,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(P),htmlFlowData:T,htmlText:l($),htmlTextData:T,image:l(O),label:Z,labelText:W,lineEnding:j,link:l(I),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:E,resourceTitleString:D,resource:X,setextHeading:l(F),setextHeadingLineSequence:S,setextHeadingText:w,strong:l(),thematicBreak:l()}};Ym(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(G){let Q={type:"root",children:[]};const se={stack:[Q],tokenStack:[],config:t,enter:o,exit:c,buffer:a,resume:u,data:r},be=[];let ie=-1;for(;++ie<G.length;)if(G[ie][1].type==="listOrdered"||G[ie][1].type==="listUnordered")if(G[ie][0]==="enter")be.push(ie);else{const Ge=be.pop();ie=s(G,Ge,ie)}for(ie=-1;++ie<G.length;){const Ge=t[G[ie][0]];Gm.call(Ge,G[ie][1].type)&&Ge[G[ie][1].type].call(Object.assign({sliceSerialize:G[ie][2].sliceSerialize},se),G[ie][1])}if(se.tokenStack.length>0){const Ge=se.tokenStack[se.tokenStack.length-1];(Ge[1]||wf).call(se,void 0,Ge[0])}for(Q.position={start:wn(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:wn(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},ie=-1;++ie<t.transforms.length;)Q=t.transforms[ie](Q)||Q;return Q}function s(G,Q,se){let be=Q-1,ie=-1,Ge=!1,nt,st,xt,tt;for(;++be<=se;){const Se=G[be];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?ie++:ie--,tt=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(nt&&!tt&&!ie&&!xt&&(xt=be),tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:tt=void 0}if(!ie&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||ie===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(nt){let Ie=be;for(st=void 0;Ie--;){const Ee=G[Ie];if(Ee[1].type==="lineEnding"||Ee[1].type==="lineEndingBlank"){if(Ee[0]==="exit")continue;st&&(G[st][1].type="lineEndingBlank",Ge=!0),Ee[1].type="lineEnding",st=Ie}else if(!(Ee[1].type==="linePrefix"||Ee[1].type==="blockQuotePrefix"||Ee[1].type==="blockQuotePrefixWhitespace"||Ee[1].type==="blockQuoteMarker"||Ee[1].type==="listItemIndent"))break}xt&&(!st||xt<st)&&(nt._spread=!0),nt.end=Object.assign({},st?G[st][1].start:Se[1].end),G.splice(st||be,0,["exit",nt,Se[2]]),be++,se++}if(Se[1].type==="listItemPrefix"){const Ie={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};nt=Ie,G.splice(be,0,["enter",Ie,Se[2]]),be++,se++,xt=void 0,tt=!0}}}return G[Q][1]._spread=Ge,se}function i(G,Q){return se;function se(be){o.call(this,G(be),be),Q&&Q.call(this,be)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(G,Q,se){this.stack[this.stack.length-1].children.push(G),this.stack.push(G),this.tokenStack.push([Q,se||void 0]),G.position={start:wn(Q.start),end:void 0}}function l(G){return Q;function Q(se){G&&G.call(this,se),c.call(this,se)}}function c(G,Q){const se=this.stack.pop(),be=this.tokenStack.pop();if(be)be[0].type!==G.type&&(Q?Q.call(this,G,be[0]):(be[1]||wf).call(this,G,be[0]));else throw new Error("Cannot close `"+G.type+"` ("+Hi({start:G.start,end:G.end})+"): it’s not open");se.position.end=wn(G.end)}function u(){return Lh(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(G){if(this.data.expectingFirstListItemValue){const Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(G),10),this.data.expectingFirstListItemValue=void 0}}function g(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=G}function p(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=G}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.value=G.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.value=G.replace(/(\r?\n|\r)$/g,"")}function k(G){const Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=Nr(this.sliceSerialize(G)).toLowerCase()}function v(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.title=G}function _(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.url=G}function C(G){const Q=this.stack[this.stack.length-1];if(!Q.depth){const se=this.sliceSerialize(G).length;Q.depth=se}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function S(G){const Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(G).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function A(G){const se=this.stack[this.stack.length-1].children;let be=se[se.length-1];(!be||be.type!=="text")&&(be=Et(),be.position={start:wn(G.start),end:void 0},se.push(be)),this.stack.push(be)}function T(G){const Q=this.stack.pop();Q.value+=this.sliceSerialize(G),Q.position.end=wn(G.end)}function j(G){const Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const se=Q.children[Q.children.length-1];se.position.end=wn(G.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Q.type)&&(A.call(this,G),T.call(this,G))}function M(){this.data.atHardBreak=!0}function P(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.value=G}function $(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.value=G}function R(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.value=G}function I(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=Q,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function O(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=Q,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function W(G){const Q=this.sliceSerialize(G),se=this.stack[this.stack.length-2];se.label=M2(Q),se.identifier=Nr(Q).toLowerCase()}function Z(){const G=this.stack[this.stack.length-1],Q=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){const be=G.children;se.children=be}else se.alt=Q}function E(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.url=G}function D(){const G=this.resume(),Q=this.stack[this.stack.length-1];Q.title=G}function X(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function B(G){const Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=Nr(this.sliceSerialize(G)).toLowerCase(),this.data.referenceType="full"}function V(G){this.data.characterReferenceType=G.type}function H(G){const Q=this.sliceSerialize(G),se=this.data.characterReferenceType;let be;se?(be=Rm(Q,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):be=$h(Q);const ie=this.stack[this.stack.length-1];ie.value+=be}function q(G){const Q=this.stack.pop();Q.position.end=wn(G.end)}function Y(G){T.call(this,G);const Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(G)}function J(G){T.call(this,G);const Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(G)}function re(){return{type:"blockquote",children:[]}}function we(){return{type:"code",lang:null,meta:null,value:""}}function Ne(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Le(){return{type:"emphasis",children:[]}}function Xe(){return{type:"heading",depth:0,children:[]}}function ct(){return{type:"break"}}function Ze(){return{type:"html",value:""}}function vt(){return{type:"image",title:null,url:"",alt:null}}function Nt(){return{type:"link",title:null,url:"",children:[]}}function We(G){return{type:"list",ordered:G.type==="listOrdered",start:null,spread:G._spread,children:[]}}function Rt(G){return{type:"listItem",spread:G._spread,checked:null,children:[]}}function ut(){return{type:"paragraph",children:[]}}function Vt(){return{type:"strong",children:[]}}function Et(){return{type:"text",value:""}}function je(){return{type:"thematicBreak"}}}function wn(e){return{line:e.line,column:e.column,offset:e.offset}}function Ym(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?Ym(e,n):$2(e,n)}}function $2(e,t){let r;for(r in t)if(Gm.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function wf(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Hi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Hi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Hi({start:t.start,end:t.end})+") is still open")}function D2(e){const t=this;t.parser=r;function r(n){return I2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function B2(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function R2(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
111
|
-
`}]}function P2(e,t){const r=t.value?t.value+`
|
|
112
|
-
`:"",n={};t.lang&&(n.className=["language-"+t.lang]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function F2(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function O2(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function z2(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),s=ri(n.toLowerCase()),i=e.footnoteOrder.indexOf(n);let a,o=e.footnoteCounts.get(n);o===void 0?(o=0,e.footnoteOrder.push(n),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(n,o);const l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function W2(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function H2(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Xm(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=n:s.push({type:"text",value:n}),s}function q2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Xm(e,t);const s={src:ri(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function U2(e,t){const r={src:ri(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function V2(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function G2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Xm(e,t);const s={href:ri(n.url||"")};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Y2(e,t){const r={href:ri(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function X2(e,t,r){const n=e.all(t),s=r?K2(r):Km(t),i={},a=[];if(typeof t.checked=="boolean"){const u=n[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<n.length;){const u=n[o];(s||o!==0||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
|
|
113
|
-
`}),u.type==="element"&&u.tagName==="p"&&!s?a.push(...u.children):a.push(u)}const l=n[n.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
|
|
114
|
-
`});const c={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,c),e.applyData(t,c)}function K2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=Km(r[n])}return t}function Km(e){const t=e.spread;return t??e.children.length>1}function Q2(e,t){const r={},n=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++s<n.length;){const a=n[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,i),e.applyData(t,i)}function Z2(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function J2(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function e_(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function t_(e,t){const r=e.all(t),n=r.shift(),s=[];if(n){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],a),s.push(a)}if(r.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},o=Ah(t.children[1]),l=Am(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function r_(e,t,r){const n=r?r.children:void 0,i=(n?n.indexOf(t):1)===0?"th":"td",a=r&&r.type==="table"?r.align:void 0,o=a?a.length:t.children.length;let l=-1;const c=[];for(;++l<o;){const h=t.children[l],f={},g=a?a[l]:void 0;g&&(f.align=g);let p={type:"element",tagName:i,properties:f,children:[]};h&&(p.children=e.all(h),e.patch(h,p),p=e.applyData(h,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function n_(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const vf=9,Cf=32;function s_(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),s=0;const i=[];for(;n;)i.push(Sf(t.slice(s,n.index),s>0,!0),n[0]),s=n.index+n[0].length,n=r.exec(t);return i.push(Sf(t.slice(s),s>0,!1)),i.join("")}function Sf(e,t,r){let n=0,s=e.length;if(t){let i=e.codePointAt(n);for(;i===vf||i===Cf;)n++,i=e.codePointAt(n)}if(r){let i=e.codePointAt(s-1);for(;i===vf||i===Cf;)s--,i=e.codePointAt(s-1)}return s>n?e.slice(n,s):""}function i_(e,t){const r={type:"text",value:s_(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function a_(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const o_={blockquote:B2,break:R2,code:P2,delete:F2,emphasis:O2,footnoteReference:z2,heading:W2,html:H2,imageReference:q2,image:U2,inlineCode:V2,linkReference:G2,link:Y2,listItem:X2,list:Q2,paragraph:Z2,root:J2,strong:e_,table:t_,tableCell:n_,tableRow:r_,text:i_,thematicBreak:a_,toml:Pa,yaml:Pa,definition:Pa,footnoteDefinition:Pa};function Pa(){}const Qm=-1,fl=0,Ui=1,vo=2,Bh=3,Rh=4,Ph=5,Fh=6,Zm=7,Jm=8,_f=typeof self=="object"?self:globalThis,l_=(e,t)=>{const r=(s,i)=>(e.set(i,s),s),n=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case fl:case Qm:return r(a,s);case Ui:{const o=r([],s);for(const l of a)o.push(n(l));return o}case vo:{const o=r({},s);for(const[l,c]of a)o[n(l)]=n(c);return o}case Bh:return r(new Date(a),s);case Rh:{const{source:o,flags:l}=a;return r(new RegExp(o,l),s)}case Ph:{const o=r(new Map,s);for(const[l,c]of a)o.set(n(l),n(c));return o}case Fh:{const o=r(new Set,s);for(const l of a)o.add(n(l));return o}case Zm:{const{name:o,message:l}=a;return r(new _f[o](l),s)}case Jm:return r(BigInt(a),s);case"BigInt":return r(Object(BigInt(a)),s);case"ArrayBuffer":return r(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return r(new DataView(o),a)}}return r(new _f[i](a),s)};return n},Tf=e=>l_(new Map,e)(0),_s="",{toString:c_}={},{keys:u_}=Object,yi=e=>{const t=typeof e;if(t!=="object"||!e)return[fl,t];const r=c_.call(e).slice(8,-1);switch(r){case"Array":return[Ui,_s];case"Object":return[vo,_s];case"Date":return[Bh,_s];case"RegExp":return[Rh,_s];case"Map":return[Ph,_s];case"Set":return[Fh,_s];case"DataView":return[Ui,r]}return r.includes("Array")?[Ui,r]:r.includes("Error")?[Zm,r]:[vo,r]},Fa=([e,t])=>e===fl&&(t==="function"||t==="symbol"),h_=(e,t,r,n)=>{const s=(a,o)=>{const l=n.push(a)-1;return r.set(o,l),l},i=a=>{if(r.has(a))return r.get(a);let[o,l]=yi(a);switch(o){case fl:{let u=a;switch(l){case"bigint":o=Jm,u=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([Qm],a)}return s([o,u],a)}case Ui:{if(l){let f=a;return l==="DataView"?f=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(a)),s([l,[...f]],a)}const u=[],h=s([o,u],a);for(const f of a)u.push(i(f));return h}case vo:{if(l)switch(l){case"BigInt":return s([l,a.toString()],a);case"Boolean":case"Number":case"String":return s([l,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const u=[],h=s([o,u],a);for(const f of u_(a))(e||!Fa(yi(a[f])))&&u.push([i(f),i(a[f])]);return h}case Bh:return s([o,a.toISOString()],a);case Rh:{const{source:u,flags:h}=a;return s([o,{source:u,flags:h}],a)}case Ph:{const u=[],h=s([o,u],a);for(const[f,g]of a)(e||!(Fa(yi(f))||Fa(yi(g))))&&u.push([i(f),i(g)]);return h}case Fh:{const u=[],h=s([o,u],a);for(const f of a)(e||!Fa(yi(f)))&&u.push(i(f));return h}}const{message:c}=a;return s([o,{name:l,message:c}],a)};return i},Nf=(e,{json:t,lossy:r}={})=>{const n=[];return h_(!(t||r),!!t,new Map,n)(e),n},Co=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Tf(Nf(e,t)):structuredClone(e):(e,t)=>Tf(Nf(e,t));function d_(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function f_(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function g_(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||d_,n=e.options.footnoteBackLabel||f_,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),h=String(c.identifier).toUpperCase(),f=ri(h.toLowerCase());let g=0;const p=[],m=e.footnoteCounts.get(h);for(;m!==void 0&&++g<=m;){p.length>0&&p.push({type:"text",value:" "});let k=typeof r=="string"?r:r(l,g);typeof k=="string"&&(k={type:"text",value:k}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,g),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const k=y.children[y.children.length-1];k&&k.type==="text"?k.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...p)}else u.push(...p);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,x),o.push(x)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Co(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
115
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
116
|
-
`}]}}const gl=(function(e){if(e==null)return y_;if(typeof e=="function")return pl(e);if(typeof e=="object")return Array.isArray(e)?p_(e):m_(e);if(typeof e=="string")return x_(e);throw new Error("Expected function, string, or object as test")});function p_(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=gl(e[r]);return pl(n);function n(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function m_(e){const t=e;return pl(r);function r(n){const s=n;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function x_(e){return pl(t);function t(r){return r&&r.type===e}}function pl(e){return t;function t(r,n,s){return!!(b_(r)&&e.call(this,r,typeof n=="number"?n:void 0,s||void 0))}}function y_(){return!0}function b_(e){return e!==null&&typeof e=="object"&&"type"in e}const e0=[],k_=!0,lu=!1,w_="skip";function t0(e,t,r,n){let s;typeof t=="function"&&typeof r!="function"?(n=r,r=t):s=t;const i=gl(s),a=n?-1:1;o(e,void 0,[])();function o(l,c,u){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const g=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(g?"<"+g+">":""))+")"})}return f;function f(){let g=e0,p,m,y;if((!t||i(l,c,u[u.length-1]||void 0))&&(g=v_(r(l,u)),g[0]===lu))return g;if("children"in l&&l.children){const x=l;if(x.children&&g[0]!==w_)for(m=(n?x.children.length:-1)+a,y=u.concat(x);m>-1&&m<x.children.length;){const k=x.children[m];if(p=o(k,m,y)(),p[0]===lu)return p;m=typeof p[1]=="number"?p[1]:m+a}}return g}}}function v_(e){return Array.isArray(e)?e:typeof e=="number"?[k_,e]:e==null?e0:[e]}function Oh(e,t,r,n){let s,i,a;typeof t=="function"&&typeof r!="function"?(i=void 0,a=t,s=r):(i=t,a=r,s=n),t0(e,i,o,s);function o(l,c){const u=c[c.length-1],h=u?u.children.indexOf(l):void 0;return a(l,h,u)}}const cu={}.hasOwnProperty,C_={};function S_(e,t){const r=t||C_,n=new Map,s=new Map,i=new Map,a={...o_,...r.handlers},o={all:c,applyData:T_,definitionById:n,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:l,options:r,patch:__,wrap:E_};return Oh(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const h=u.type==="definition"?n:s,f=String(u.identifier).toUpperCase();h.has(f)||h.set(f,u)}}),o;function l(u,h){const f=u.type,g=o.handlers[f];if(cu.call(o.handlers,f)&&g)return g(o,u,h);if(o.options.passThrough&&o.options.passThrough.includes(f)){if("children"in u){const{children:m,...y}=u,x=Co(y);return x.children=o.all(u),x}return Co(u)}return(o.options.unknownHandler||N_)(o,u,h)}function c(u){const h=[];if("children"in u){const f=u.children;let g=-1;for(;++g<f.length;){const p=o.one(f[g],u);if(p){if(g&&f[g-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=Ef(p.value)),!Array.isArray(p)&&p.type==="element")){const m=p.children[0];m&&m.type==="text"&&(m.value=Ef(m.value))}Array.isArray(p)?h.push(...p):h.push(p)}}}return h}}function __(e,t){e.position&&(t.position=fC(e))}function T_(e,t){let r=t;if(e&&e.data){const n=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const a="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:a}}r.type==="element"&&i&&Object.assign(r.properties,Co(i)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function N_(e,t){const r=t.data||{},n="value"in t&&!(cu.call(r,"hProperties")||cu.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function E_(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
|
|
117
|
-
`});++n<e.length;)n&&r.push({type:"text",value:`
|
|
118
|
-
`}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
119
|
-
`}),r}function Ef(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Af(e,t){const r=S_(e,t),n=r.one(e,void 0),s=g_(r),i=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
120
|
-
`},s),i}function A_(e,t){return e&&"run"in e?async function(r,n){const s=Af(r,{file:n,...t});await e.run(s,n)}:function(r,n){return Af(r,{file:n,...e||t})}}function Mf(e){if(e)throw e}var fc,jf;function M_(){if(jf)return fc;jf=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},i=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!h)return!1;var f;for(f in c);return typeof f>"u"||e.call(c,f)},a=function(c,u){r&&u.name==="__proto__"?r(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},o=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(n)return n(c,u).value}else return;return c[u]};return fc=function l(){var c,u,h,f,g,p,m=arguments[0],y=1,x=arguments.length,k=!1;for(typeof m=="boolean"&&(k=m,m=arguments[1]||{},y=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});y<x;++y)if(c=arguments[y],c!=null)for(u in c)h=o(m,u),f=o(c,u),m!==f&&(k&&f&&(i(f)||(g=s(f)))?(g?(g=!1,p=h&&s(h)?h:[]):p=h&&i(h)?h:{},a(m,{name:u,newValue:l(k,p,f)})):typeof f<"u"&&a(m,{name:u,newValue:f}));return m},fc}var j_=M_();const gc=bh(j_);function uu(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function I_(){const e=[],t={run:r,use:n};return t;function r(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...s);function o(l,...c){const u=e[++i];let h=-1;if(l){a(l);return}for(;++h<s.length;)(c[h]===null||c[h]===void 0)&&(c[h]=s[h]);s=c,u?L_(u,o)(...c):a(null,...c)}}function n(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function L_(e,t){let r;return n;function n(...a){const o=e.length>a.length;let l;o&&a.push(s);try{l=e.apply(this,a)}catch(c){const u=c;if(o&&r)throw u;return s(u)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(a,...o){r||(r=!0,t(a,...o))}function i(a){s(null,a)}}const Rr={basename:$_,dirname:D_,extname:B_,join:R_,sep:"/"};function $_(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');xa(e);let r=0,n=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){r=s+1;break}}else n<0&&(i=!0,n=s+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){r=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(n=s):(o=-1,n=a));return r===n?n=a:n<0&&(n=e.length),e.slice(r,n)}function D_(e){if(xa(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function B_(e){xa(e);let t=e.length,r=-1,n=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){n=t+1;break}continue}r<0&&(a=!0,r=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||r<0||i===0||i===1&&s===r-1&&s===n+1?"":e.slice(s,r)}function R_(...e){let t=-1,r;for(;++t<e.length;)xa(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":P_(r)}function P_(e){xa(e);const t=e.codePointAt(0)===47;let r=F_(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function F_(e,t){let r="",n=0,s=-1,i=0,a=-1,o,l;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),s=a,i=0;continue}}else if(r.length>0){r="",n=0,s=a,i=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(s+1,a):r=e.slice(s+1,a),n=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return r}function xa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const O_={cwd:z_};function z_(){return"/"}function hu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function W_(e){if(typeof e=="string")e=new URL(e);else if(!hu(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return H_(e)}function H_(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const pc=["history","path","basename","stem","extname","dirname"];class r0{constructor(t){let r;t?hu(t)?r={path:t}:typeof t=="string"||q_(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":O_.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<pc.length;){const i=pc[n];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let s;for(s in r)pc.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Rr.basename(this.path):void 0}set basename(t){xc(t,"basename"),mc(t,"basename"),this.path=Rr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Rr.dirname(this.path):void 0}set dirname(t){If(this.basename,"dirname"),this.path=Rr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Rr.extname(this.path):void 0}set extname(t){if(mc(t,"extname"),If(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Rr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){hu(t)&&(t=W_(t)),xc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Rr.basename(this.path,this.extname):void 0}set stem(t){xc(t,"stem"),mc(t,"stem"),this.path=Rr.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const s=this.message(t,r,n);throw s.fatal=!0,s}info(t,r,n){const s=this.message(t,r,n);return s.fatal=void 0,s}message(t,r,n){const s=new Dt(t,r,n);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function mc(e,t){if(e&&e.includes(Rr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Rr.sep+"`")}function xc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function If(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function q_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const U_=(function(e){const n=this.constructor.prototype,s=n[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,n),i}),V_={}.hasOwnProperty;class zh extends U_{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=I_()}copy(){const t=new zh;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(gc(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(kc("data",this.frozen),this.namespace[t]=r,this):V_.call(this.namespace,t)&&this.namespace[t]||void 0:t?(kc("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const s=r.call(t,...n);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Oa(t),n=this.parser||this.Parser;return yc("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),yc("process",this.parser||this.Parser),bc("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(i,a){const o=Oa(t),l=n.parse(o);n.run(l,o,function(u,h,f){if(u||!h||!f)return c(u);const g=h,p=n.stringify(g,f);X_(p)?f.value=p:f.result=p,c(u,f)});function c(u,h){u||!h?a(u):i?i(h):r(void 0,h)}}}processSync(t){let r=!1,n;return this.freeze(),yc("processSync",this.parser||this.Parser),bc("processSync",this.compiler||this.Compiler),this.process(t,s),$f("processSync","process",r),n;function s(i,a){r=!0,Mf(i),n=a}}run(t,r,n){Lf(t),this.freeze();const s=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?i(void 0,n):new Promise(i);function i(a,o){const l=Oa(r);s.run(t,l,c);function c(u,h,f){const g=h||t;u?o(u):a?a(g):n(void 0,g,f)}}}runSync(t,r){let n=!1,s;return this.run(t,r,i),$f("runSync","run",n),s;function i(a,o){Mf(a),s=o,n=!0}}stringify(t,r){this.freeze();const n=Oa(r),s=this.compiler||this.Compiler;return bc("stringify",s),Lf(t),s(t,n)}use(t,...r){const n=this.attachers,s=this.namespace;if(kc("use",this.frozen),t!=null)if(typeof t=="function")l(t,r);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...h]=c;l(u,h)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(s.settings=gc(!0,s.settings,c.settings))}function o(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const h=c[u];i(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let h=-1,f=-1;for(;++h<n.length;)if(n[h][0]===c){f=h;break}if(f===-1)n.push([c,...u]);else if(u.length>0){let[g,...p]=u;const m=n[f][1];uu(m)&&uu(g)&&(g=gc(!0,m,g)),n[f]=[c,g,...p]}}}}const G_=new zh().freeze();function yc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function bc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function kc(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Lf(e){if(!uu(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $f(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Oa(e){return Y_(e)?e:new r0(e)}function Y_(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function X_(e){return typeof e=="string"||K_(e)}function K_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Q_="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Df=[],Bf={allowDangerousHtml:!0},Z_=/^(https?|ircs?|mailto|xmpp)$/i,J_=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function eT(e){const t=tT(e),r=rT(e);return nT(t.runSync(t.parse(r),r),e)}function tT(e){const t=e.rehypePlugins||Df,r=e.remarkPlugins||Df,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Bf}:Bf;return G_().use(D2).use(r).use(A_,n).use(t)}function rT(e){const t=e.children||"",r=new r0;return typeof t=="string"&&(r.value=t),r}function nT(e,t){const r=t.allowedElements,n=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||sT;for(const u of J_)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Q_+u.id,void 0);return Oh(e,c),yC(e,{Fragment:d.Fragment,components:s,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(u,h,f){if(u.type==="raw"&&f&&typeof h=="number")return a?f.children.splice(h,1):f.children[h]={type:"text",value:u.value},h;if(u.type==="element"){let g;for(g in uc)if(Object.hasOwn(uc,g)&&Object.hasOwn(u.properties,g)){const p=u.properties[g],m=uc[g];(m===null||m.includes(u.tagName))&&(u.properties[g]=l(String(p||""),g,u))}}if(u.type==="element"){let g=r?!r.includes(u.tagName):i?i.includes(u.tagName):!1;if(!g&&n&&typeof h=="number"&&(g=!n(u,h,f)),g&&f&&typeof h=="number")return o&&u.children?f.children.splice(h,1,...u.children):f.children.splice(h,1),h}}}function sT(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||r!==-1&&t>r||n!==-1&&t>n||Z_.test(e.slice(0,t))?e:""}function Rf(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,s=r.indexOf(t);for(;s!==-1;)n++,s=r.indexOf(t,s+t.length);return n}function iT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function aT(e,t,r){const s=gl((r||{}).ignore||[]),i=oT(t);let a=-1;for(;++a<i.length;)t0(e,"text",o);function o(c,u){let h=-1,f;for(;++h<u.length;){const g=u[h],p=f?f.children:void 0;if(s(g,p?p.indexOf(g):void 0,f))return;f=g}if(f)return l(c,u)}function l(c,u){const h=u[u.length-1],f=i[a][0],g=i[a][1];let p=0;const y=h.children.indexOf(c);let x=!1,k=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){const _=v.index,C={index:v.index,input:v.input,stack:[...u,c]};let w=g(...v,C);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?f.lastIndex=_+1:(p!==_&&k.push({type:"text",value:c.value.slice(p,_)}),Array.isArray(w)?k.push(...w):w&&k.push(w),p=_+v[0].length,x=!0),!f.global)break;v=f.exec(c.value)}return x?(p<c.value.length&&k.push({type:"text",value:c.value.slice(p)}),h.children.splice(y,1,...k)):k=[c],y+k.length}}function oT(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const s=r[n];t.push([lT(s[0]),cT(s[1])])}return t}function lT(e){return typeof e=="string"?new RegExp(iT(e),"g"):e}function cT(e){return typeof e=="function"?e:function(){return e}}const wc="phrasing",vc=["autolink","link","image","label"];function uT(){return{transforms:[xT],enter:{literalAutolink:dT,literalAutolinkEmail:Cc,literalAutolinkHttp:Cc,literalAutolinkWww:Cc},exit:{literalAutolink:mT,literalAutolinkEmail:pT,literalAutolinkHttp:fT,literalAutolinkWww:gT}}}function hT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:wc,notInConstruct:vc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:wc,notInConstruct:vc},{character:":",before:"[ps]",after:"\\/",inConstruct:wc,notInConstruct:vc}]}}function dT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Cc(e){this.config.enter.autolinkProtocol.call(this,e)}function fT(e){this.config.exit.autolinkProtocol.call(this,e)}function gT(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function pT(e){this.config.exit.autolinkEmail.call(this,e)}function mT(e){this.exit(e)}function xT(e){aT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,yT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),bT]],{ignore:["link","linkReference"]})}function yT(e,t,r,n,s){let i="";if(!n0(s)||(/^w/i.test(t)&&(r=t+r,t="",i="http://"),!kT(r)))return!1;const a=wT(r+n);if(!a[0])return!1;const o={type:"link",title:null,url:i+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function bT(e,t,r,n){return!n0(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function kT(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function wT(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const s=Rf(e,"(");let i=Rf(e,")");for(;n!==-1&&s>i;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),i++;return[e,r]}function n0(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||rs(r)||hl(r))&&(!t||r!==47)}s0.peek=MT;function vT(){this.buffer()}function CT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ST(){this.buffer()}function _T(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function TT(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Nr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function NT(e){this.exit(e)}function ET(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Nr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function AT(e){this.exit(e)}function MT(){return"["}function s0(e,t,r,n){const s=r.createTracker(n);let i=s.move("[^");const a=r.enter("footnoteReference"),o=r.enter("reference");return i+=s.move(r.safe(r.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function jT(){return{enter:{gfmFootnoteCallString:vT,gfmFootnoteCall:CT,gfmFootnoteDefinitionLabelString:ST,gfmFootnoteDefinition:_T},exit:{gfmFootnoteCallString:TT,gfmFootnoteCall:NT,gfmFootnoteDefinitionLabelString:ET,gfmFootnoteDefinition:AT}}}function IT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:s0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,s,i,a){const o=i.createTracker(a);let l=o.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=o.move(i.safe(i.associationId(n),{before:l,after:"]"})),u(),l+=o.move("]:"),n.children&&n.children.length>0&&(o.shift(4),l+=o.move((t?`
|
|
121
|
-
`:" ")+i.indentLines(i.containerFlow(n,o.current()),t?i0:LT))),c(),l}}function LT(e,t,r){return t===0?e:i0(e,t,r)}function i0(e,t,r){return(r?"":" ")+e}const $T=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];a0.peek=FT;function DT(){return{canContainEols:["delete"],enter:{strikethrough:RT},exit:{strikethrough:PT}}}function BT(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$T}],handlers:{delete:a0}}}function RT(e){this.enter({type:"delete",children:[]},e)}function PT(e){this.exit(e)}function a0(e,t,r,n){const s=r.createTracker(n),i=r.enter("strikethrough");let a=s.move("~~");return a+=r.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function FT(){return"~"}function OT(e){return e.length}function zT(e,t){const r=t||{},n=(r.align||[]).concat(),s=r.stringLength||OT,i=[],a=[],o=[],l=[];let c=0,u=-1;for(;++u<e.length;){const m=[],y=[];let x=-1;for(e[u].length>c&&(c=e[u].length);++x<e[u].length;){const k=WT(e[u][x]);if(r.alignDelimiters!==!1){const v=s(k);y[x]=v,(l[x]===void 0||v>l[x])&&(l[x]=v)}m.push(k)}a[u]=m,o[u]=y}let h=-1;if(typeof n=="object"&&"length"in n)for(;++h<c;)i[h]=Pf(n[h]);else{const m=Pf(n);for(;++h<c;)i[h]=m}h=-1;const f=[],g=[];for(;++h<c;){const m=i[h];let y="",x="";m===99?(y=":",x=":"):m===108?y=":":m===114&&(x=":");let k=r.alignDelimiters===!1?1:Math.max(1,l[h]-y.length-x.length);const v=y+"-".repeat(k)+x;r.alignDelimiters!==!1&&(k=y.length+k+x.length,k>l[h]&&(l[h]=k),g[h]=k),f[h]=v}a.splice(1,0,f),o.splice(1,0,g),u=-1;const p=[];for(;++u<a.length;){const m=a[u],y=o[u];h=-1;const x=[];for(;++h<c;){const k=m[h]||"";let v="",_="";if(r.alignDelimiters!==!1){const C=l[h]-(y[h]||0),w=i[h];w===114?v=" ".repeat(C):w===99?C%2?(v=" ".repeat(C/2+.5),_=" ".repeat(C/2-.5)):(v=" ".repeat(C/2),_=v):_=" ".repeat(C)}r.delimiterStart!==!1&&!h&&x.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&k==="")&&(r.delimiterStart!==!1||h)&&x.push(" "),r.alignDelimiters!==!1&&x.push(v),x.push(k),r.alignDelimiters!==!1&&x.push(_),r.padding!==!1&&x.push(" "),(r.delimiterEnd!==!1||h!==c-1)&&x.push("|")}p.push(r.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return p.join(`
|
|
122
|
-
`)}function WT(e){return e==null?"":String(e)}function Pf(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function HT(e,t,r,n){const s=r.enter("blockquote"),i=r.createTracker(n);i.move("> "),i.shift(2);const a=r.indentLines(r.containerFlow(e,i.current()),qT);return s(),a}function qT(e,t,r){return">"+(r?"":" ")+e}function UT(e,t){return Ff(e,t.inConstruct,!0)&&!Ff(e,t.notInConstruct,!1)}function Ff(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return!0;return!1}function Of(e,t,r,n){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===`
|
|
123
|
-
`&&UT(r.stack,r.unsafe[s]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
124
|
-
`}function VT(e,t){const r=String(e);let n=r.indexOf(t),s=n,i=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===s?++i>a&&(a=i):i=1,s=n+t.length,n=r.indexOf(t,s);return a}function GT(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function YT(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function XT(e,t,r,n){const s=YT(r),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(GT(e,r)){const h=r.enter("codeIndented"),f=r.indentLines(i,KT);return h(),f}const o=r.createTracker(n),l=s.repeat(Math.max(VT(i,s)+1,3)),c=r.enter("codeFenced");let u=o.move(l);if(e.lang){const h=r.enter(`codeFencedLang${a}`);u+=o.move(r.safe(e.lang,{before:u,after:" ",encode:["`"],...o.current()})),h()}if(e.lang&&e.meta){const h=r.enter(`codeFencedMeta${a}`);u+=o.move(" "),u+=o.move(r.safe(e.meta,{before:u,after:`
|
|
125
|
-
`,encode:["`"],...o.current()})),h()}return u+=o.move(`
|
|
126
|
-
`),i&&(u+=o.move(i+`
|
|
127
|
-
`)),u+=o.move(l),c(),u}function KT(e,t,r){return(r?"":" ")+e}function Wh(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function QT(e,t,r,n){const s=Wh(r),i=s==='"'?"Quote":"Apostrophe",a=r.enter("definition");let o=r.enter("label");const l=r.createTracker(n);let c=l.move("[");return c+=l.move(r.safe(r.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=r.enter("destinationRaw"),c+=l.move(r.safe(e.url,{before:c,after:e.title?" ":`
|
|
128
|
-
`,...l.current()}))),o(),e.title&&(o=r.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(r.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),o()),a(),c}function ZT(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ea(e){return"&#x"+e.toString(16).toUpperCase()+";"}function So(e,t,r){const n=Us(e),s=Us(t);return n===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}o0.peek=JT;function o0(e,t,r,n){const s=ZT(r),i=r.enter("emphasis"),a=r.createTracker(n),o=a.move(s);let l=a.move(r.containerPhrasing(e,{after:s,before:o,...a.current()}));const c=l.charCodeAt(0),u=So(n.before.charCodeAt(n.before.length-1),c,s);u.inside&&(l=ea(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=So(n.after.charCodeAt(0),h,s);f.inside&&(l=l.slice(0,-1)+ea(h));const g=a.move(s);return i(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},o+l+g}function JT(e,t,r){return r.options.emphasis||"*"}function eN(e,t){let r=!1;return Oh(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,lu}),!!((!e.depth||e.depth<3)&&Lh(e)&&(t.options.setext||r))}function tN(e,t,r,n){const s=Math.max(Math.min(6,e.depth||1),1),i=r.createTracker(n);if(eN(e,r)){const u=r.enter("headingSetext"),h=r.enter("phrasing"),f=r.containerPhrasing(e,{...i.current(),before:`
|
|
129
|
-
`,after:`
|
|
130
|
-
`});return h(),u(),f+`
|
|
131
|
-
`+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
132
|
-
`))+1))}const a="#".repeat(s),o=r.enter("headingAtx"),l=r.enter("phrasing");i.move(a+" ");let c=r.containerPhrasing(e,{before:"# ",after:`
|
|
133
|
-
`,...i.current()});return/^[\t ]/.test(c)&&(c=ea(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,r.options.closeAtx&&(c+=" "+a),l(),o(),c}l0.peek=rN;function l0(e){return e.value||""}function rN(){return"<"}c0.peek=nN;function c0(e,t,r,n){const s=Wh(r),i=s==='"'?"Quote":"Apostrophe",a=r.enter("image");let o=r.enter("label");const l=r.createTracker(n);let c=l.move("![");return c+=l.move(r.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=r.enter("destinationRaw"),c+=l.move(r.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=r.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(r.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),o()),c+=l.move(")"),a(),c}function nN(){return"!"}u0.peek=sN;function u0(e,t,r,n){const s=e.referenceType,i=r.enter("imageReference");let a=r.enter("label");const o=r.createTracker(n);let l=o.move("![");const c=r.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=r.stack;r.stack=[],a=r.enter("reference");const h=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return a(),r.stack=u,i(),s==="full"||!c||c!==h?l+=o.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function sN(){return"!"}h0.peek=iN;function h0(e,t,r){let n=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(n);)s+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++i<r.unsafe.length;){const a=r.unsafe[i],o=r.compilePattern(a);let l;if(a.atBreak)for(;l=o.exec(n);){let c=l.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(l.index+1)}}return s+n+s}function iN(){return"`"}function d0(e,t){const r=Lh(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}f0.peek=aN;function f0(e,t,r,n){const s=Wh(r),i=s==='"'?"Quote":"Apostrophe",a=r.createTracker(n);let o,l;if(d0(e,r)){const u=r.stack;r.stack=[],o=r.enter("autolink");let h=a.move("<");return h+=a.move(r.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),o(),r.stack=u,h}o=r.enter("link"),l=r.enter("label");let c=a.move("[");return c+=a.move(r.containerPhrasing(e,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=r.enter(`title${i}`),c+=a.move(" "+s),c+=a.move(r.safe(e.title,{before:c,after:s,...a.current()})),c+=a.move(s),l()),c+=a.move(")"),o(),c}function aN(e,t,r){return d0(e,r)?"<":"["}g0.peek=oN;function g0(e,t,r,n){const s=e.referenceType,i=r.enter("linkReference");let a=r.enter("label");const o=r.createTracker(n);let l=o.move("[");const c=r.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=r.stack;r.stack=[],a=r.enter("reference");const h=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return a(),r.stack=u,i(),s==="full"||!c||c!==h?l+=o.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function oN(){return"["}function Hh(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function lN(e){const t=Hh(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function cN(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function p0(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function uN(e,t,r,n){const s=r.enter("list"),i=r.bulletCurrent;let a=e.ordered?cN(r):Hh(r);const o=e.ordered?a==="."?")":".":lN(r);let l=t&&r.bulletLastUsed?a===r.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&u&&(!u.children||!u.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),p0(r)===a&&u){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=o),r.bulletCurrent=a;const c=r.containerFlow(e,n);return r.bulletLastUsed=a,r.bulletCurrent=i,s(),c}function hN(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function dN(e,t,r,n){const s=hN(r);let i=r.bulletCurrent||Hh(r);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=r.createTracker(n);o.move(i+" ".repeat(a-i.length)),o.shift(a);const l=r.enter("listItem"),c=r.indentLines(r.containerFlow(e,o.current()),u);return l(),c;function u(h,f,g){return f?(g?"":" ".repeat(a))+h:(g?i:i+" ".repeat(a-i.length))+h}}function fN(e,t,r,n){const s=r.enter("paragraph"),i=r.enter("phrasing"),a=r.containerPhrasing(e,n);return i(),s(),a}const gN=gl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function pN(e,t,r,n){return(e.children.some(function(a){return gN(a)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function mN(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}m0.peek=xN;function m0(e,t,r,n){const s=mN(r),i=r.enter("strong"),a=r.createTracker(n),o=a.move(s+s);let l=a.move(r.containerPhrasing(e,{after:s,before:o,...a.current()}));const c=l.charCodeAt(0),u=So(n.before.charCodeAt(n.before.length-1),c,s);u.inside&&(l=ea(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=So(n.after.charCodeAt(0),h,s);f.inside&&(l=l.slice(0,-1)+ea(h));const g=a.move(s+s);return i(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},o+l+g}function xN(e,t,r){return r.options.strong||"*"}function yN(e,t,r,n){return r.safe(e.value,n)}function bN(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function kN(e,t,r){const n=(p0(r)+(r.options.ruleSpaces?" ":"")).repeat(bN(r));return r.options.ruleSpaces?n.slice(0,-1):n}const x0={blockquote:HT,break:Of,code:XT,definition:QT,emphasis:o0,hardBreak:Of,heading:tN,html:l0,image:c0,imageReference:u0,inlineCode:h0,link:f0,linkReference:g0,list:uN,listItem:dN,paragraph:fN,root:pN,strong:m0,text:yN,thematicBreak:kN};function wN(){return{enter:{table:vN,tableData:zf,tableHeader:zf,tableRow:SN},exit:{codeText:_N,table:CN,tableData:Sc,tableHeader:Sc,tableRow:Sc}}}function vN(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function CN(e){this.exit(e),this.data.inTable=void 0}function SN(e){this.enter({type:"tableRow",children:[]},e)}function Sc(e){this.exit(e)}function zf(e){this.enter({type:"tableCell",children:[]},e)}function _N(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,TN));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function TN(e,t){return t==="|"?t:e}function NN(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,s=t.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
134
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:l,tableRow:o}};function a(g,p,m,y){return c(u(g,m,y),g.align)}function o(g,p,m,y){const x=h(g,m,y),k=c([x]);return k.slice(0,k.indexOf(`
|
|
135
|
-
`))}function l(g,p,m,y){const x=m.enter("tableCell"),k=m.enter("phrasing"),v=m.containerPhrasing(g,{...y,before:i,after:i});return k(),x(),v}function c(g,p){return zT(g,{align:p,alignDelimiters:n,padding:r,stringLength:s})}function u(g,p,m){const y=g.children;let x=-1;const k=[],v=p.enter("table");for(;++x<y.length;)k[x]=h(y[x],p,m);return v(),k}function h(g,p,m){const y=g.children;let x=-1;const k=[],v=p.enter("tableRow");for(;++x<y.length;)k[x]=l(y[x],g,p,m);return v(),k}function f(g,p,m){let y=x0.inlineCode(g,p,m);return m.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function EN(){return{exit:{taskListCheckValueChecked:Wf,taskListCheckValueUnchecked:Wf,paragraph:MN}}}function AN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:jN}}}function Wf(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function MN(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const s=t.children;let i=-1,a;for(;++i<s.length;){const o=s[i];if(o.type==="paragraph"){a=o;break}}a===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function jN(e,t,r,n){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=r.createTracker(n);i&&o.move(a);let l=x0.listItem(e,t,r,{...n,...o.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+a}}function IN(){return[uT(),jT(),DT(),wN(),EN()]}function LN(e){return{extensions:[hT(),IT(e),BT(),NN(e),AN()]}}const $N={tokenize:ON,partial:!0},y0={tokenize:zN,partial:!0},b0={tokenize:WN,partial:!0},k0={tokenize:HN,partial:!0},DN={tokenize:qN,partial:!0},w0={name:"wwwAutolink",tokenize:PN,previous:C0},v0={name:"protocolAutolink",tokenize:FN,previous:S0},ln={name:"emailAutolink",tokenize:RN,previous:_0},Hr={};function BN(){return{text:Hr}}let zn=48;for(;zn<123;)Hr[zn]=ln,zn++,zn===58?zn=65:zn===91&&(zn=97);Hr[43]=ln;Hr[45]=ln;Hr[46]=ln;Hr[95]=ln;Hr[72]=[ln,v0];Hr[104]=[ln,v0];Hr[87]=[ln,w0];Hr[119]=[ln,w0];function RN(e,t,r){const n=this;let s,i;return a;function a(h){return!du(h)||!_0.call(n,n.previous)||qh(n.events)?r(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(h))}function o(h){return du(h)?(e.consume(h),o):h===64?(e.consume(h),l):r(h)}function l(h){return h===46?e.check(DN,u,c)(h):h===45||h===95||jt(h)?(i=!0,e.consume(h),l):u(h)}function c(h){return e.consume(h),s=!0,l}function u(h){return i&&s&&Ft(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):r(h)}}function PN(e,t,r){const n=this;return s;function s(a){return a!==87&&a!==119||!C0.call(n,n.previous)||qh(n.events)?r(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($N,e.attempt(y0,e.attempt(b0,i),r),r)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function FN(e,t,r){const n=this;let s="",i=!1;return a;function a(h){return(h===72||h===104)&&S0.call(n,n.previous)&&!qh(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(h),e.consume(h),o):r(h)}function o(h){if(Ft(h)&&s.length<5)return s+=String.fromCodePoint(h),e.consume(h),o;if(h===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return r(h)}function l(h){return h===47?(e.consume(h),i?c:(i=!0,l)):r(h)}function c(h){return h===null||wo(h)||Qe(h)||rs(h)||hl(h)?r(h):e.attempt(y0,e.attempt(b0,u),r)(h)}function u(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function ON(e,t,r){let n=0;return s;function s(a){return(a===87||a===119)&&n<3?(n++,e.consume(a),s):a===46&&n===3?(e.consume(a),i):r(a)}function i(a){return a===null?r(a):t(a)}}function zN(e,t,r){let n,s,i;return a;function a(c){return c===46||c===95?e.check(k0,l,o)(c):c===null||Qe(c)||rs(c)||c!==45&&hl(c)?l(c):(i=!0,e.consume(c),a)}function o(c){return c===95?n=!0:(s=n,n=void 0),e.consume(c),a}function l(c){return s||n||!i?r(c):t(c)}}function WN(e,t){let r=0,n=0;return s;function s(a){return a===40?(r++,e.consume(a),s):a===41&&n<r?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(k0,t,i)(a):a===null||Qe(a)||rs(a)?t(a):(e.consume(a),s)}function i(a){return a===41&&n++,e.consume(a),s}}function HN(e,t,r){return n;function n(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),n):o===38?(e.consume(o),i):o===93?(e.consume(o),s):o===60||o===null||Qe(o)||rs(o)?t(o):r(o)}function s(o){return o===null||o===40||o===91||Qe(o)||rs(o)?t(o):n(o)}function i(o){return Ft(o)?a(o):r(o)}function a(o){return o===59?(e.consume(o),n):Ft(o)?(e.consume(o),a):r(o)}}function qN(e,t,r){return n;function n(i){return e.consume(i),s}function s(i){return jt(i)?r(i):t(i)}}function C0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qe(e)}function S0(e){return!Ft(e)}function _0(e){return!(e===47||du(e))}function du(e){return e===43||e===45||e===46||e===95||jt(e)}function qh(e){let t=e.length,r=!1;for(;t--;){const n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const UN={tokenize:JN,partial:!0};function VN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:KN,continuation:{tokenize:QN},exit:ZN}},text:{91:{name:"gfmFootnoteCall",tokenize:XN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:GN,resolveTo:YN}}}}function GN(e,t,r){const n=this;let s=n.events.length;const i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a;for(;s--;){const l=n.events[s][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return r(l);const c=Nr(n.sliceSerialize({start:a.end,end:n.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?r(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function YN(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...o),e}function XN(e,t,r){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let i=0,a;return o;function o(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?r(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(i>999||h===93&&!a||h===null||h===91||Qe(h))return r(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(Nr(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(h)}return Qe(h)||(a=!0),i++,e.consume(h),h===92?u:c}function u(h){return h===91||h===92||h===93?(e.consume(h),i++,c):c(h)}}function KN(e,t,r){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let i,a=0,o;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(p)}function u(p){if(a>999||p===93&&!o||p===null||p===91||Qe(p))return r(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return i=Nr(n.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Qe(p)||(o=!0),a++,e.consume(p),p===92?h:u}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,u):u(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s.includes(i)||s.push(i),Oe(e,g,"gfmFootnoteDefinitionWhitespace")):r(p)}function g(p){return t(p)}}function QN(e,t,r){return e.check(ma,t,e.attempt(UN,t,r))}function ZN(e){e.exit("gfmFootnoteDefinition")}function JN(e,t,r){const n=this;return Oe(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=n.events[n.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):r(i)}}function eE(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:i,resolveAll:s};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function s(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},h={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",u,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",h,o]],g=o.parser.constructs.insideSpan.null;g&&or(f,f.length,0,dl(g,a.slice(c+1,l),o)),or(f,f.length,0,[["exit",h,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",u,o]]),or(a,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,o,l){const c=this.previous,u=this.events;let h=0;return f;function f(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(a.enter("strikethroughSequenceTemporary"),g(p))}function g(p){const m=Us(c);if(p===126)return h>1?l(p):(a.consume(p),h++,g);if(h<2&&!r)return l(p);const y=a.exit("strikethroughSequenceTemporary"),x=Us(p);return y._open=!x||x===2&&!!m,y._close=!m||m===2&&!!x,o(p)}}}class tE{constructor(){this.map=[]}add(t,r,n){rE(this,t,r,n)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let s=n.pop();for(;s;){for(const i of s)t.push(i);s=n.pop()}this.map.length=0}}function rE(e,t,r,n){let s=0;if(!(r===0&&n.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=r,e.map[s][2].push(...n);return}s+=1}e.map.push([t,r,n])}}function nE(e,t){let r=!1;const n=[];for(;t<e.length;){const s=e[t];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=n.length-1;n[i]=n[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function sE(){return{flow:{null:{name:"table",tokenize:iE,resolveAll:aE}}}}function iE(e,t,r){const n=this;let s=0,i=0,a;return o;function o(T){let j=n.events.length-1;for(;j>-1;){const $=n.events[j][1].type;if($==="lineEnding"||$==="linePrefix")j--;else break}const M=j>-1?n.events[j][1].type:null,P=M==="tableHead"||M==="tableRow"?w:l;return P===w&&n.parser.lazy[n.now().line]?r(T):P(T)}function l(T){return e.enter("tableHead"),e.enter("tableRow"),c(T)}function c(T){return T===124||(a=!0,i+=1),u(T)}function u(T){return T===null?r(T):ke(T)?i>1?(i=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),g):r(T):Re(T)?Oe(e,u,"whitespace")(T):(i+=1,a&&(a=!1,s+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),a=!0,u):(e.enter("data"),h(T)))}function h(T){return T===null||T===124||Qe(T)?(e.exit("data"),u(T)):(e.consume(T),T===92?f:h)}function f(T){return T===92||T===124?(e.consume(T),h):h(T)}function g(T){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(T):(e.enter("tableDelimiterRow"),a=!1,Re(T)?Oe(e,p,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):p(T))}function p(T){return T===45||T===58?y(T):T===124?(a=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),m):C(T)}function m(T){return Re(T)?Oe(e,y,"whitespace")(T):y(T)}function y(T){return T===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),x):T===45?(i+=1,x(T)):T===null||ke(T)?_(T):C(T)}function x(T){return T===45?(e.enter("tableDelimiterFiller"),k(T)):C(T)}function k(T){return T===45?(e.consume(T),k):T===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(T))}function v(T){return Re(T)?Oe(e,_,"whitespace")(T):_(T)}function _(T){return T===124?p(T):T===null||ke(T)?!a||s!==i?C(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):C(T)}function C(T){return r(T)}function w(T){return e.enter("tableRow"),S(T)}function S(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),S):T===null||ke(T)?(e.exit("tableRow"),t(T)):Re(T)?Oe(e,S,"whitespace")(T):(e.enter("data"),F(T))}function F(T){return T===null||T===124||Qe(T)?(e.exit("data"),S(T)):(e.consume(T),T===92?A:F)}function A(T){return T===92||T===124?(e.consume(T),F):F(T)}}function aE(e,t){let r=-1,n=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,c,u,h;const f=new tE;for(;++r<e.length;){const g=e[r],p=g[1];g[0]==="enter"?p.type==="tableHead"?(o=!1,l!==0&&(Hf(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(r,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(n=!0,h=void 0,i=[0,0,0,0],a=[0,r+1,0,0],o&&(o=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(r,0,[["enter",u,t]])),s=p.type==="tableDelimiterRow"?2:u?3:1):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(n=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=za(f,t,i,s,void 0,h),i=[0,0,0,0]),a[2]=r)):p.type==="tableCellDivider"&&(n?n=!1:(i[1]!==0&&(a[0]=a[1],h=za(f,t,i,s,void 0,h)),i=a,a=[i[1],r,0,0])):p.type==="tableHead"?(o=!0,l=r):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=r,i[1]!==0?(a[0]=a[1],h=za(f,t,i,s,r,h)):a[1]!==0&&(h=za(f,t,a,s,r,h)),s=0):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=r)}for(l!==0&&Hf(f,t,l,c,u),f.consume(t.events),r=-1;++r<t.events.length;){const g=t.events[r];g[0]==="enter"&&g[1].type==="table"&&(g[1]._align=nE(t.events,r))}return e}function za(e,t,r,n,s,i){const a=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",o="tableContent";r[0]!==0&&(i.end=Object.assign({},Es(t.events,r[0])),e.add(r[0],0,[["exit",i,t]]));const l=Es(t.events,r[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(r[1],0,[["enter",i,t]]),r[2]!==0){const c=Es(t.events,r[2]),u=Es(t.events,r[3]),h={type:o,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(r[2],0,[["enter",h,t]]),n!==2){const f=t.events[r[2]],g=t.events[r[3]];if(f[1].end=Object.assign({},g[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){const p=r[2]+1,m=r[3]-r[2]-1;e.add(p,m,[])}}e.add(r[3]+1,0,[["exit",h,t]])}return s!==void 0&&(i.end=Object.assign({},Es(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function Hf(e,t,r,n,s){const i=[],a=Es(t.events,r);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),n.end=Object.assign({},a),i.push(["exit",n,t]),e.add(r+1,0,i)}function Es(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const oE={name:"tasklistCheck",tokenize:cE};function lE(){return{text:{91:oE}}}function cE(e,t,r){const n=this;return s;function s(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Qe(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):r(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(l)}function o(l){return ke(l)?t(l):Re(l)?e.check({tokenize:uE},t,r)(l):r(l)}}function uE(e,t,r){return Oe(e,n,"whitespace");function n(s){return s===null?r(s):t(s)}}function hE(e){return Bm([BN(),VN(),eE(e),sE(),lE()])}const dE={};function fE(e){const t=this,r=e||dE,n=t.data(),s=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);s.push(hE(r)),i.push(IN()),a.push(LN(r))}const T0={'code[class*="language-"]':{color:"#ccc",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"#ccc",background:"#2d2d2d",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},':not(pre) > code[class*="language-"]':{background:"#2d2d2d",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"#999"},"block-comment":{color:"#999"},prolog:{color:"#999"},doctype:{color:"#999"},cdata:{color:"#999"},punctuation:{color:"#ccc"},tag:{color:"#e2777a"},"attr-name":{color:"#e2777a"},namespace:{color:"#e2777a"},deleted:{color:"#e2777a"},"function-name":{color:"#6196cc"},boolean:{color:"#f08d49"},number:{color:"#f08d49"},function:{color:"#f08d49"},property:{color:"#f8c555"},"class-name":{color:"#f8c555"},constant:{color:"#f8c555"},symbol:{color:"#f8c555"},selector:{color:"#cc99cd"},important:{color:"#cc99cd",fontWeight:"bold"},atrule:{color:"#cc99cd"},keyword:{color:"#cc99cd"},builtin:{color:"#cc99cd"},string:{color:"#7ec699"},char:{color:"#7ec699"},"attr-value":{color:"#7ec699"},regex:{color:"#7ec699"},variable:{color:"#7ec699"},operator:{color:"#67cdcc"},entity:{color:"#67cdcc",cursor:"help"},url:{color:"#67cdcc"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},inserted:{color:"green"}},gE={'pre[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",background:"#1e1e1e"},'code[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'pre[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},':not(pre) > code[class*="language-"]':{padding:".1em .3em",borderRadius:".3em",color:"#db4c69",background:"#1e1e1e"},".namespace":{Opacity:".7"},"doctype.doctype-tag":{color:"#569CD6"},"doctype.name":{color:"#9cdcfe"},comment:{color:"#6a9955"},prolog:{color:"#6a9955"},punctuation:{color:"#d4d4d4"},".language-html .language-css .token.punctuation":{color:"#d4d4d4"},".language-html .language-javascript .token.punctuation":{color:"#d4d4d4"},property:{color:"#9cdcfe"},tag:{color:"#569cd6"},boolean:{color:"#569cd6"},number:{color:"#b5cea8"},constant:{color:"#9cdcfe"},symbol:{color:"#b5cea8"},inserted:{color:"#b5cea8"},unit:{color:"#b5cea8"},selector:{color:"#d7ba7d"},"attr-name":{color:"#9cdcfe"},string:{color:"#ce9178"},char:{color:"#ce9178"},builtin:{color:"#ce9178"},deleted:{color:"#ce9178"},".language-css .token.string.url":{textDecoration:"underline"},operator:{color:"#d4d4d4"},entity:{color:"#569cd6"},"operator.arrow":{color:"#569CD6"},atrule:{color:"#ce9178"},"atrule.rule":{color:"#c586c0"},"atrule.url":{color:"#9cdcfe"},"atrule.url.function":{color:"#dcdcaa"},"atrule.url.punctuation":{color:"#d4d4d4"},keyword:{color:"#569CD6"},"keyword.module":{color:"#c586c0"},"keyword.control-flow":{color:"#c586c0"},function:{color:"#dcdcaa"},"function.maybe-class-name":{color:"#dcdcaa"},regex:{color:"#d16969"},important:{color:"#569cd6"},italic:{fontStyle:"italic"},"class-name":{color:"#4ec9b0"},"maybe-class-name":{color:"#4ec9b0"},console:{color:"#9cdcfe"},parameter:{color:"#9cdcfe"},interpolation:{color:"#9cdcfe"},"punctuation.interpolation-punctuation":{color:"#569cd6"},variable:{color:"#9cdcfe"},"imports.maybe-class-name":{color:"#9cdcfe"},"exports.maybe-class-name":{color:"#9cdcfe"},escape:{color:"#d7ba7d"},"tag.punctuation":{color:"#808080"},cdata:{color:"#808080"},"attr-value":{color:"#ce9178"},"attr-value.punctuation":{color:"#ce9178"},"attr-value.punctuation.attr-equals":{color:"#d4d4d4"},namespace:{color:"#4ec9b0"},'pre[class*="language-javascript"]':{color:"#9cdcfe"},'code[class*="language-javascript"]':{color:"#9cdcfe"},'pre[class*="language-jsx"]':{color:"#9cdcfe"},'code[class*="language-jsx"]':{color:"#9cdcfe"},'pre[class*="language-typescript"]':{color:"#9cdcfe"},'code[class*="language-typescript"]':{color:"#9cdcfe"},'pre[class*="language-tsx"]':{color:"#9cdcfe"},'code[class*="language-tsx"]':{color:"#9cdcfe"},'pre[class*="language-css"]':{color:"#ce9178"},'code[class*="language-css"]':{color:"#ce9178"},'pre[class*="language-html"]':{color:"#d4d4d4"},'code[class*="language-html"]':{color:"#d4d4d4"},".language-regex .token.anchor":{color:"#dcdcaa"},".language-html .token.punctuation":{color:"#808080"},'pre[class*="language-"] > code[class*="language-"]':{position:"relative",zIndex:"1"},".line-highlight.line-highlight":{background:"#f7ebc6",boxShadow:"inset 5px 0 0 #f7d87c",zIndex:"0"}};var qf={name:"mermaid",version:"11.12.0",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.11",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}},io={exports:{}},pE=io.exports,Uf;function mE(){return Uf||(Uf=1,(function(e,t){(function(r,n){e.exports=n()})(pE,(function(){var r=1e3,n=6e4,s=36e5,i="millisecond",a="second",o="minute",l="hour",c="day",u="week",h="month",f="quarter",g="year",p="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var R=["th","st","nd","rd"],I=$%100;return"["+$+(R[(I-20)%10]||R[I]||R[0])+"]"}},v=function($,R,I){var O=String($);return!O||O.length>=R?$:""+Array(R+1-O.length).join(I)+$},_={s:v,z:function($){var R=-$.utcOffset(),I=Math.abs(R),O=Math.floor(I/60),W=I%60;return(R<=0?"+":"-")+v(O,2,"0")+":"+v(W,2,"0")},m:function $(R,I){if(R.date()<I.date())return-$(I,R);var O=12*(I.year()-R.year())+(I.month()-R.month()),W=R.clone().add(O,h),Z=I-W<0,E=R.clone().add(O+(Z?-1:1),h);return+(-(O+(I-W)/(Z?W-E:E-W))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:g,w:u,d:c,D:p,h:l,m:o,s:a,ms:i,Q:f}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},C="en",w={};w[C]=k;var S="$isDayjsObject",F=function($){return $ instanceof M||!(!$||!$[S])},A=function $(R,I,O){var W;if(!R)return C;if(typeof R=="string"){var Z=R.toLowerCase();w[Z]&&(W=Z),I&&(w[Z]=I,W=Z);var E=R.split("-");if(!W&&E.length>1)return $(E[0])}else{var D=R.name;w[D]=R,W=D}return!O&&W&&(C=W),W||!O&&C},T=function($,R){if(F($))return $.clone();var I=typeof R=="object"?R:{};return I.date=$,I.args=arguments,new M(I)},j=_;j.l=A,j.i=F,j.w=function($,R){return T($,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var M=(function(){function $(I){this.$L=A(I.locale,null,!0),this.parse(I),this.$x=this.$x||I.x||{},this[S]=!0}var R=$.prototype;return R.parse=function(I){this.$d=(function(O){var W=O.date,Z=O.utc;if(W===null)return new Date(NaN);if(j.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var E=W.match(y);if(E){var D=E[2]-1||0,X=(E[7]||"0").substring(0,3);return Z?new Date(Date.UTC(E[1],D,E[3]||1,E[4]||0,E[5]||0,E[6]||0,X)):new Date(E[1],D,E[3]||1,E[4]||0,E[5]||0,E[6]||0,X)}}return new Date(W)})(I),this.init()},R.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},R.$utils=function(){return j},R.isValid=function(){return this.$d.toString()!==m},R.isSame=function(I,O){var W=T(I);return this.startOf(O)<=W&&W<=this.endOf(O)},R.isAfter=function(I,O){return T(I)<this.startOf(O)},R.isBefore=function(I,O){return this.endOf(O)<T(I)},R.$g=function(I,O,W){return j.u(I)?this[O]:this.set(W,I)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(I,O){var W=this,Z=!!j.u(O)||O,E=j.p(I),D=function(J,re){var we=j.w(W.$u?Date.UTC(W.$y,re,J):new Date(W.$y,re,J),W);return Z?we:we.endOf(c)},X=function(J,re){return j.w(W.toDate()[J].apply(W.toDate("s"),(Z?[0,0,0,0]:[23,59,59,999]).slice(re)),W)},N=this.$W,B=this.$M,V=this.$D,H="set"+(this.$u?"UTC":"");switch(E){case g:return Z?D(1,0):D(31,11);case h:return Z?D(1,B):D(0,B+1);case u:var q=this.$locale().weekStart||0,Y=(N<q?N+7:N)-q;return D(Z?V-Y:V+(6-Y),B);case c:case p:return X(H+"Hours",0);case l:return X(H+"Minutes",1);case o:return X(H+"Seconds",2);case a:return X(H+"Milliseconds",3);default:return this.clone()}},R.endOf=function(I){return this.startOf(I,!1)},R.$set=function(I,O){var W,Z=j.p(I),E="set"+(this.$u?"UTC":""),D=(W={},W[c]=E+"Date",W[p]=E+"Date",W[h]=E+"Month",W[g]=E+"FullYear",W[l]=E+"Hours",W[o]=E+"Minutes",W[a]=E+"Seconds",W[i]=E+"Milliseconds",W)[Z],X=Z===c?this.$D+(O-this.$W):O;if(Z===h||Z===g){var N=this.clone().set(p,1);N.$d[D](X),N.init(),this.$d=N.set(p,Math.min(this.$D,N.daysInMonth())).$d}else D&&this.$d[D](X);return this.init(),this},R.set=function(I,O){return this.clone().$set(I,O)},R.get=function(I){return this[j.p(I)]()},R.add=function(I,O){var W,Z=this;I=Number(I);var E=j.p(O),D=function(B){var V=T(Z);return j.w(V.date(V.date()+Math.round(B*I)),Z)};if(E===h)return this.set(h,this.$M+I);if(E===g)return this.set(g,this.$y+I);if(E===c)return D(1);if(E===u)return D(7);var X=(W={},W[o]=n,W[l]=s,W[a]=r,W)[E]||1,N=this.$d.getTime()+I*X;return j.w(N,this)},R.subtract=function(I,O){return this.add(-1*I,O)},R.format=function(I){var O=this,W=this.$locale();if(!this.isValid())return W.invalidDate||m;var Z=I||"YYYY-MM-DDTHH:mm:ssZ",E=j.z(this),D=this.$H,X=this.$m,N=this.$M,B=W.weekdays,V=W.months,H=W.meridiem,q=function(re,we,Ne,Ce){return re&&(re[we]||re(O,Z))||Ne[we].slice(0,Ce)},Y=function(re){return j.s(D%12||12,re,"0")},J=H||function(re,we,Ne){var Ce=re<12?"AM":"PM";return Ne?Ce.toLowerCase():Ce};return Z.replace(x,(function(re,we){return we||(function(Ne){switch(Ne){case"YY":return String(O.$y).slice(-2);case"YYYY":return j.s(O.$y,4,"0");case"M":return N+1;case"MM":return j.s(N+1,2,"0");case"MMM":return q(W.monthsShort,N,V,3);case"MMMM":return q(V,N);case"D":return O.$D;case"DD":return j.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return q(W.weekdaysMin,O.$W,B,2);case"ddd":return q(W.weekdaysShort,O.$W,B,3);case"dddd":return B[O.$W];case"H":return String(D);case"HH":return j.s(D,2,"0");case"h":return Y(1);case"hh":return Y(2);case"a":return J(D,X,!0);case"A":return J(D,X,!1);case"m":return String(X);case"mm":return j.s(X,2,"0");case"s":return String(O.$s);case"ss":return j.s(O.$s,2,"0");case"SSS":return j.s(O.$ms,3,"0");case"Z":return E}return null})(re)||E.replace(":","")}))},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(I,O,W){var Z,E=this,D=j.p(O),X=T(I),N=(X.utcOffset()-this.utcOffset())*n,B=this-X,V=function(){return j.m(E,X)};switch(D){case g:Z=V()/12;break;case h:Z=V();break;case f:Z=V()/3;break;case u:Z=(B-N)/6048e5;break;case c:Z=(B-N)/864e5;break;case l:Z=B/s;break;case o:Z=B/n;break;case a:Z=B/r;break;default:Z=B}return W?Z:j.a(Z)},R.daysInMonth=function(){return this.endOf(h).$D},R.$locale=function(){return w[this.$L]},R.locale=function(I,O){if(!I)return this.$L;var W=this.clone(),Z=A(I,O,!0);return Z&&(W.$L=Z),W},R.clone=function(){return j.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},$})(),P=M.prototype;return T.prototype=P,[["$ms",i],["$s",a],["$m",o],["$H",l],["$W",c],["$M",h],["$y",g],["$D",p]].forEach((function($){P[$[1]]=function(R){return this.$g(R,$[0],$[1])}})),T.extend=function($,R){return $.$i||($(R,M,T),$.$i=!0),T},T.locale=A,T.isDayjs=F,T.unix=function($){return T(1e3*$)},T.en=w[C],T.Ls=w,T.p={},T}))})(io)),io.exports}var xE=mE();const yE=bh(xE);var N0=Object.defineProperty,b=(e,t)=>N0(e,"name",{value:t,configurable:!0}),bE=(e,t)=>{for(var r in t)N0(e,r,{get:t[r],enumerable:!0})},Xr={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},K={trace:b((...e)=>{},"trace"),debug:b((...e)=>{},"debug"),info:b((...e)=>{},"info"),warn:b((...e)=>{},"warn"),error:b((...e)=>{},"error"),fatal:b((...e)=>{},"fatal")},Uh=b(function(e="fatal"){let t=Xr.fatal;typeof e=="string"?e.toLowerCase()in Xr&&(t=Xr[e]):typeof e=="number"&&(t=e),K.trace=()=>{},K.debug=()=>{},K.info=()=>{},K.warn=()=>{},K.error=()=>{},K.fatal=()=>{},t<=Xr.fatal&&(K.fatal=console.error?console.error.bind(console,dr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",dr("FATAL"))),t<=Xr.error&&(K.error=console.error?console.error.bind(console,dr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",dr("ERROR"))),t<=Xr.warn&&(K.warn=console.warn?console.warn.bind(console,dr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",dr("WARN"))),t<=Xr.info&&(K.info=console.info?console.info.bind(console,dr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",dr("INFO"))),t<=Xr.debug&&(K.debug=console.debug?console.debug.bind(console,dr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",dr("DEBUG"))),t<=Xr.trace&&(K.trace=console.debug?console.debug.bind(console,dr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",dr("TRACE")))},"setLogLevel"),dr=b(e=>`%c${yE().format("ss.SSS")} : ${e} : `,"format");const ao={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},n)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,i=2*r-s;switch(n){case"r":return ao.hue2rgb(i,s,e+1/3)*255;case"g":return ao.hue2rgb(i,s,e)*255;case"b":return ao.hue2rgb(i,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},n)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),i=Math.min(e,t,r),a=(s+i)/2;if(n==="l")return a*100;if(s===i)return 0;const o=s-i,l=a>.5?o/(2-s-i):o/(s+i);if(n==="s")return l*100;switch(s){case e:return((t-r)/o+(t<r?6:0))*60;case t:return((r-e)/o+2)*60;case r:return((e-t)/o+4)*60;default:return-1}}},kE={clamp:(e,t,r)=>t>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},wE={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},Te={channel:ao,lang:kE,unit:wE},vn={};for(let e=0;e<=255;e++)vn[e]=Te.unit.dec2hex(e);const At={ALL:0,RGB:1,HSL:2};class vE{constructor(){this.type=At.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=At.ALL}is(t){return this.type===t}}class CE{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new vE}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=At.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:n,l:s}=t;r===void 0&&(t.h=Te.channel.rgb2hsl(t,"h")),n===void 0&&(t.s=Te.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=Te.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:n,b:s}=t;r===void 0&&(t.r=Te.channel.hsl2rgb(t,"r")),n===void 0&&(t.g=Te.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=Te.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(At.HSL)&&r!==void 0?r:(this._ensureHSL(),Te.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(At.HSL)&&r!==void 0?r:(this._ensureHSL(),Te.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(At.HSL)&&r!==void 0?r:(this._ensureHSL(),Te.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(At.RGB)&&r!==void 0?r:(this._ensureRGB(),Te.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(At.RGB)&&r!==void 0?r:(this._ensureRGB(),Te.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(At.RGB)&&r!==void 0?r:(this._ensureRGB(),Te.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(At.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(At.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(At.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(At.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(At.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(At.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const ml=new CE({r:0,g:0,b:0,a:0},"transparent"),Ls={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Ls.re);if(!t)return;const r=t[1],n=parseInt(r,16),s=r.length,i=s%4===0,a=s>4,o=a?1:17,l=a?8:4,c=i?0:-1,u=a?255:15;return ml.set({r:(n>>l*(c+3)&u)*o,g:(n>>l*(c+2)&u)*o,b:(n>>l*(c+1)&u)*o,a:i?(n&u)*o/255:1},e)},stringify:e=>{const{r:t,g:r,b:n,a:s}=e;return s<1?`#${vn[Math.round(t)]}${vn[Math.round(r)]}${vn[Math.round(n)]}${vn[Math.round(s*255)]}`:`#${vn[Math.round(t)]}${vn[Math.round(r)]}${vn[Math.round(n)]}`}},Vn={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Vn.hueRe);if(t){const[,r,n]=t;switch(n){case"grad":return Te.channel.clamp.h(parseFloat(r)*.9);case"rad":return Te.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Te.channel.clamp.h(parseFloat(r)*360)}}return Te.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Vn.re);if(!r)return;const[,n,s,i,a,o]=r;return ml.set({h:Vn._hue2deg(n),s:Te.channel.clamp.s(parseFloat(s)),l:Te.channel.clamp.l(parseFloat(i)),a:a?Te.channel.clamp.a(o?parseFloat(a)/100:parseFloat(a)):1},e)},stringify:e=>{const{h:t,s:r,l:n,a:s}=e;return s<1?`hsla(${Te.lang.round(t)}, ${Te.lang.round(r)}%, ${Te.lang.round(n)}%, ${s})`:`hsl(${Te.lang.round(t)}, ${Te.lang.round(r)}%, ${Te.lang.round(n)}%)`}},Vi={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=Vi.colors[e];if(t)return Ls.parse(t)},stringify:e=>{const t=Ls.stringify(e);for(const r in Vi.colors)if(Vi.colors[r]===t)return r}},Ii={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Ii.re);if(!r)return;const[,n,s,i,a,o,l,c,u]=r;return ml.set({r:Te.channel.clamp.r(s?parseFloat(n)*2.55:parseFloat(n)),g:Te.channel.clamp.g(a?parseFloat(i)*2.55:parseFloat(i)),b:Te.channel.clamp.b(l?parseFloat(o)*2.55:parseFloat(o)),a:c?Te.channel.clamp.a(u?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:n,a:s}=e;return s<1?`rgba(${Te.lang.round(t)}, ${Te.lang.round(r)}, ${Te.lang.round(n)}, ${Te.lang.round(s)})`:`rgb(${Te.lang.round(t)}, ${Te.lang.round(r)}, ${Te.lang.round(n)})`}},zr={format:{keyword:Vi,hex:Ls,rgb:Ii,rgba:Ii,hsl:Vn,hsla:Vn},parse:e=>{if(typeof e!="string")return e;const t=Ls.parse(e)||Ii.parse(e)||Vn.parse(e)||Vi.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(At.HSL)||e.data.r===void 0?Vn.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Ii.stringify(e):Ls.stringify(e)},E0=(e,t)=>{const r=zr.parse(e);for(const n in t)r[n]=Te.channel.clamp[n](t[n]);return zr.stringify(r)},Gi=(e,t,r=0,n=1)=>{if(typeof e!="number")return E0(e,{a:t});const s=ml.set({r:Te.channel.clamp.r(e),g:Te.channel.clamp.g(t),b:Te.channel.clamp.b(r),a:Te.channel.clamp.a(n)});return zr.stringify(s)},SE=e=>{const{r:t,g:r,b:n}=zr.parse(e),s=.2126*Te.channel.toLinear(t)+.7152*Te.channel.toLinear(r)+.0722*Te.channel.toLinear(n);return Te.lang.round(s)},_E=e=>SE(e)>=.5,ya=e=>!_E(e),A0=(e,t,r)=>{const n=zr.parse(e),s=n[t],i=Te.channel.clamp[t](s+r);return s!==i&&(n[t]=i),zr.stringify(n)},ce=(e,t)=>A0(e,"l",t),xe=(e,t)=>A0(e,"l",-t),U=(e,t)=>{const r=zr.parse(e),n={};for(const s in t)t[s]&&(n[s]=r[s]+t[s]);return E0(e,n)},TE=(e,t,r=50)=>{const{r:n,g:s,b:i,a}=zr.parse(e),{r:o,g:l,b:c,a:u}=zr.parse(t),h=r/100,f=h*2-1,g=a-u,m=((f*g===-1?f:(f+g)/(1+f*g))+1)/2,y=1-m,x=n*m+o*y,k=s*m+l*y,v=i*m+c*y,_=a*h+u*(1-h);return Gi(x,k,v,_)},ne=(e,t=100)=>{const r=zr.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,TE(r,e,t)};/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:M0,setPrototypeOf:Vf,isFrozen:NE,getPrototypeOf:EE,getOwnPropertyDescriptor:AE}=Object;let{freeze:qt,seal:pr,create:fu}=Object,{apply:gu,construct:pu}=typeof Reflect<"u"&&Reflect;qt||(qt=function(t){return t});pr||(pr=function(t){return t});gu||(gu=function(t,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(r,s)});pu||(pu=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return new t(...n)});const Wa=Ut(Array.prototype.forEach),ME=Ut(Array.prototype.lastIndexOf),Gf=Ut(Array.prototype.pop),bi=Ut(Array.prototype.push),jE=Ut(Array.prototype.splice),oo=Ut(String.prototype.toLowerCase),_c=Ut(String.prototype.toString),Tc=Ut(String.prototype.match),ki=Ut(String.prototype.replace),IE=Ut(String.prototype.indexOf),LE=Ut(String.prototype.trim),vr=Ut(Object.prototype.hasOwnProperty),Pt=Ut(RegExp.prototype.test),wi=$E(TypeError);function Ut(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return gu(e,t,n)}}function $E(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return pu(e,r)}}function Be(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oo;Vf&&Vf(e,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=r(s);i!==s&&(NE(t)||(t[n]=i),s=i)}e[s]=!0}return e}function DE(e){for(let t=0;t<e.length;t++)vr(e,t)||(e[t]=null);return e}function Zr(e){const t=fu(null);for(const[r,n]of M0(e))vr(e,r)&&(Array.isArray(n)?t[r]=DE(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=Zr(n):t[r]=n);return t}function vi(e,t){for(;e!==null;){const n=AE(e,t);if(n){if(n.get)return Ut(n.get);if(typeof n.value=="function")return Ut(n.value)}e=EE(e)}function r(){return null}return r}const Yf=qt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Nc=qt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ec=qt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),BE=qt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ac=qt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),RE=qt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Xf=qt(["#text"]),Kf=qt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Mc=qt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Qf=qt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ha=qt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),PE=pr(/\{\{[\w\W]*|[\w\W]*\}\}/gm),FE=pr(/<%[\w\W]*|[\w\W]*%>/gm),OE=pr(/\$\{[\w\W]*/gm),zE=pr(/^data-[\-\w.\u00B7-\uFFFF]+$/),WE=pr(/^aria-[\-\w]+$/),j0=pr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),HE=pr(/^(?:\w+script|data):/i),qE=pr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),I0=pr(/^html$/i),UE=pr(/^[a-z][.\w]*(-[.\w]+)+$/i);var Zf=Object.freeze({__proto__:null,ARIA_ATTR:WE,ATTR_WHITESPACE:qE,CUSTOM_ELEMENT:UE,DATA_ATTR:zE,DOCTYPE_NAME:I0,ERB_EXPR:FE,IS_ALLOWED_URI:j0,IS_SCRIPT_OR_DATA:HE,MUSTACHE_EXPR:PE,TMPLIT_EXPR:OE});const Ci={element:1,text:3,progressingInstruction:7,comment:8,document:9},VE=function(){return typeof window>"u"?null:window},GE=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(n=r.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Jf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function L0(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:VE();const t=le=>L0(le);if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==Ci.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:o,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:g}=e,p=l.prototype,m=vi(p,"cloneNode"),y=vi(p,"remove"),x=vi(p,"nextSibling"),k=vi(p,"childNodes"),v=vi(p,"parentNode");if(typeof a=="function"){const le=r.createElement("template");le.content&&le.content.ownerDocument&&(r=le.content.ownerDocument)}let _,C="";const{implementation:w,createNodeIterator:S,createDocumentFragment:F,getElementsByTagName:A}=r,{importNode:T}=n;let j=Jf();t.isSupported=typeof M0=="function"&&typeof v=="function"&&w&&w.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:P,TMPLIT_EXPR:$,DATA_ATTR:R,ARIA_ATTR:I,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:W,CUSTOM_ELEMENT:Z}=Zf;let{IS_ALLOWED_URI:E}=Zf,D=null;const X=Be({},[...Yf,...Nc,...Ec,...Ac,...Xf]);let N=null;const B=Be({},[...Kf,...Mc,...Qf,...Ha]);let V=Object.seal(fu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),H=null,q=null;const Y=Object.seal(fu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let J=!0,re=!0,we=!1,Ne=!0,Ce=!1,Le=!0,Xe=!1,ct=!1,Ze=!1,vt=!1,Nt=!1,We=!1,Rt=!0,ut=!1;const Vt="user-content-";let Et=!0,je=!1,G={},Q=null;const se=Be({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let be=null;const ie=Be({},["audio","video","img","source","image","track"]);let Ge=null;const nt=Be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),st="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",tt="http://www.w3.org/1999/xhtml";let Se=tt,Ie=!1,Ee=null;const Gt=Be({},[st,xt,tt],_c);let un=Be({},["mi","mo","mn","ms","mtext"]),hn=Be({},["annotation-xml"]);const ci=Be({},["title","style","font","a","script"]);let jr=null;const Bn=["application/xhtml+xml","text/html"],ms="text/html";let lt=null,br=null;const xs=r.createElement("form"),dn=function(z){return z instanceof RegExp||z instanceof Function},ur=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(br&&br===z)){if((!z||typeof z!="object")&&(z={}),z=Zr(z),jr=Bn.indexOf(z.PARSER_MEDIA_TYPE)===-1?ms:z.PARSER_MEDIA_TYPE,lt=jr==="application/xhtml+xml"?_c:oo,D=vr(z,"ALLOWED_TAGS")?Be({},z.ALLOWED_TAGS,lt):X,N=vr(z,"ALLOWED_ATTR")?Be({},z.ALLOWED_ATTR,lt):B,Ee=vr(z,"ALLOWED_NAMESPACES")?Be({},z.ALLOWED_NAMESPACES,_c):Gt,Ge=vr(z,"ADD_URI_SAFE_ATTR")?Be(Zr(nt),z.ADD_URI_SAFE_ATTR,lt):nt,be=vr(z,"ADD_DATA_URI_TAGS")?Be(Zr(ie),z.ADD_DATA_URI_TAGS,lt):ie,Q=vr(z,"FORBID_CONTENTS")?Be({},z.FORBID_CONTENTS,lt):se,H=vr(z,"FORBID_TAGS")?Be({},z.FORBID_TAGS,lt):Zr({}),q=vr(z,"FORBID_ATTR")?Be({},z.FORBID_ATTR,lt):Zr({}),G=vr(z,"USE_PROFILES")?z.USE_PROFILES:!1,J=z.ALLOW_ARIA_ATTR!==!1,re=z.ALLOW_DATA_ATTR!==!1,we=z.ALLOW_UNKNOWN_PROTOCOLS||!1,Ne=z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ce=z.SAFE_FOR_TEMPLATES||!1,Le=z.SAFE_FOR_XML!==!1,Xe=z.WHOLE_DOCUMENT||!1,vt=z.RETURN_DOM||!1,Nt=z.RETURN_DOM_FRAGMENT||!1,We=z.RETURN_TRUSTED_TYPE||!1,Ze=z.FORCE_BODY||!1,Rt=z.SANITIZE_DOM!==!1,ut=z.SANITIZE_NAMED_PROPS||!1,Et=z.KEEP_CONTENT!==!1,je=z.IN_PLACE||!1,E=z.ALLOWED_URI_REGEXP||j0,Se=z.NAMESPACE||tt,un=z.MATHML_TEXT_INTEGRATION_POINTS||un,hn=z.HTML_INTEGRATION_POINTS||hn,V=z.CUSTOM_ELEMENT_HANDLING||{},z.CUSTOM_ELEMENT_HANDLING&&dn(z.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=z.CUSTOM_ELEMENT_HANDLING.tagNameCheck),z.CUSTOM_ELEMENT_HANDLING&&dn(z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),z.CUSTOM_ELEMENT_HANDLING&&typeof z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(V.allowCustomizedBuiltInElements=z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ce&&(re=!1),Nt&&(vt=!0),G&&(D=Be({},Xf),N=[],G.html===!0&&(Be(D,Yf),Be(N,Kf)),G.svg===!0&&(Be(D,Nc),Be(N,Mc),Be(N,Ha)),G.svgFilters===!0&&(Be(D,Ec),Be(N,Mc),Be(N,Ha)),G.mathMl===!0&&(Be(D,Ac),Be(N,Qf),Be(N,Ha))),z.ADD_TAGS&&(typeof z.ADD_TAGS=="function"?Y.tagCheck=z.ADD_TAGS:(D===X&&(D=Zr(D)),Be(D,z.ADD_TAGS,lt))),z.ADD_ATTR&&(typeof z.ADD_ATTR=="function"?Y.attributeCheck=z.ADD_ATTR:(N===B&&(N=Zr(N)),Be(N,z.ADD_ATTR,lt))),z.ADD_URI_SAFE_ATTR&&Be(Ge,z.ADD_URI_SAFE_ATTR,lt),z.FORBID_CONTENTS&&(Q===se&&(Q=Zr(Q)),Be(Q,z.FORBID_CONTENTS,lt)),Et&&(D["#text"]=!0),Xe&&Be(D,["html","head","body"]),D.table&&(Be(D,["tbody"]),delete H.tbody),z.TRUSTED_TYPES_POLICY){if(typeof z.TRUSTED_TYPES_POLICY.createHTML!="function")throw wi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw wi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=z.TRUSTED_TYPES_POLICY,C=_.createHTML("")}else _===void 0&&(_=GE(g,s)),_!==null&&typeof C=="string"&&(C=_.createHTML(""));qt&&qt(z),br=z}},fn=Be({},[...Nc,...Ec,...BE]),ys=Be({},[...Ac,...RE]),bs=function(z){let ee=v(z);(!ee||!ee.tagName)&&(ee={namespaceURI:Se,tagName:"template"});const oe=oo(z.tagName),Ye=oo(ee.tagName);return Ee[z.namespaceURI]?z.namespaceURI===xt?ee.namespaceURI===tt?oe==="svg":ee.namespaceURI===st?oe==="svg"&&(Ye==="annotation-xml"||un[Ye]):!!fn[oe]:z.namespaceURI===st?ee.namespaceURI===tt?oe==="math":ee.namespaceURI===xt?oe==="math"&&hn[Ye]:!!ys[oe]:z.namespaceURI===tt?ee.namespaceURI===xt&&!hn[Ye]||ee.namespaceURI===st&&!un[Ye]?!1:!ys[oe]&&(ci[oe]||!fn[oe]):!!(jr==="application/xhtml+xml"&&Ee[z.namespaceURI]):!1},Ct=function(z){bi(t.removed,{element:z});try{v(z).removeChild(z)}catch{y(z)}},Yt=function(z,ee){try{bi(t.removed,{attribute:ee.getAttributeNode(z),from:ee})}catch{bi(t.removed,{attribute:null,from:ee})}if(ee.removeAttribute(z),z==="is")if(vt||Nt)try{Ct(ee)}catch{}else try{ee.setAttribute(z,"")}catch{}},ks=function(z){let ee=null,oe=null;if(Ze)z="<remove></remove>"+z;else{const Ke=Tc(z,/^[\r\n\t ]+/);oe=Ke&&Ke[0]}jr==="application/xhtml+xml"&&Se===tt&&(z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+z+"</body></html>");const Ye=_?_.createHTML(z):z;if(Se===tt)try{ee=new f().parseFromString(Ye,jr)}catch{}if(!ee||!ee.documentElement){ee=w.createDocument(Se,"template",null);try{ee.documentElement.innerHTML=Ie?C:Ye}catch{}}const it=ee.body||ee.documentElement;return z&&oe&&it.insertBefore(r.createTextNode(oe),it.childNodes[0]||null),Se===tt?A.call(ee,Xe?"html":"body")[0]:Xe?ee.documentElement:it},gn=function(z){return S.call(z.ownerDocument||z,z,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ir=function(z){return z instanceof h&&(typeof z.nodeName!="string"||typeof z.textContent!="string"||typeof z.removeChild!="function"||!(z.attributes instanceof u)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function")},pn=function(z){return typeof o=="function"&&z instanceof o};function Xt(le,z,ee){Wa(le,oe=>{oe.call(t,z,ee,br)})}const Rn=function(z){let ee=null;if(Xt(j.beforeSanitizeElements,z,null),Ir(z))return Ct(z),!0;const oe=lt(z.nodeName);if(Xt(j.uponSanitizeElement,z,{tagName:oe,allowedTags:D}),Le&&z.hasChildNodes()&&!pn(z.firstElementChild)&&Pt(/<[/\w!]/g,z.innerHTML)&&Pt(/<[/\w!]/g,z.textContent)||z.nodeType===Ci.progressingInstruction||Le&&z.nodeType===Ci.comment&&Pt(/<[/\w]/g,z.data))return Ct(z),!0;if(!(Y.tagCheck instanceof Function&&Y.tagCheck(oe))&&(!D[oe]||H[oe])){if(!H[oe]&&mn(oe)&&(V.tagNameCheck instanceof RegExp&&Pt(V.tagNameCheck,oe)||V.tagNameCheck instanceof Function&&V.tagNameCheck(oe)))return!1;if(Et&&!Q[oe]){const Ye=v(z)||z.parentNode,it=k(z)||z.childNodes;if(it&&Ye){const Ke=it.length;for(let ht=Ke-1;ht>=0;--ht){const Kt=m(it[ht],!0);Kt.__removalCount=(z.__removalCount||0)+1,Ye.insertBefore(Kt,x(z))}}}return Ct(z),!0}return z instanceof l&&!bs(z)||(oe==="noscript"||oe==="noembed"||oe==="noframes")&&Pt(/<\/no(script|embed|frames)/i,z.innerHTML)?(Ct(z),!0):(Ce&&z.nodeType===Ci.text&&(ee=z.textContent,Wa([M,P,$],Ye=>{ee=ki(ee,Ye," ")}),z.textContent!==ee&&(bi(t.removed,{element:z.cloneNode()}),z.textContent=ee)),Xt(j.afterSanitizeElements,z,null),!1)},ws=function(z,ee,oe){if(Rt&&(ee==="id"||ee==="name")&&(oe in r||oe in xs))return!1;if(!(re&&!q[ee]&&Pt(R,ee))){if(!(J&&Pt(I,ee))){if(!(Y.attributeCheck instanceof Function&&Y.attributeCheck(ee,z))){if(!N[ee]||q[ee]){if(!(mn(z)&&(V.tagNameCheck instanceof RegExp&&Pt(V.tagNameCheck,z)||V.tagNameCheck instanceof Function&&V.tagNameCheck(z))&&(V.attributeNameCheck instanceof RegExp&&Pt(V.attributeNameCheck,ee)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(ee,z))||ee==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&Pt(V.tagNameCheck,oe)||V.tagNameCheck instanceof Function&&V.tagNameCheck(oe))))return!1}else if(!Ge[ee]){if(!Pt(E,ki(oe,W,""))){if(!((ee==="src"||ee==="xlink:href"||ee==="href")&&z!=="script"&&IE(oe,"data:")===0&&be[z])){if(!(we&&!Pt(O,ki(oe,W,"")))){if(oe)return!1}}}}}}}return!0},mn=function(z){return z!=="annotation-xml"&&Tc(z,Z)},xn=function(z){Xt(j.beforeSanitizeAttributes,z,null);const{attributes:ee}=z;if(!ee||Ir(z))return;const oe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0};let Ye=ee.length;for(;Ye--;){const it=ee[Ye],{name:Ke,namespaceURI:ht,value:Kt}=it,hr=lt(Ke),Gr=Kt;let ot=Ke==="value"?Gr:LE(Gr);if(oe.attrName=hr,oe.attrValue=ot,oe.keepAttr=!0,oe.forceKeepAttr=void 0,Xt(j.uponSanitizeAttribute,z,oe),ot=oe.attrValue,ut&&(hr==="id"||hr==="name")&&(Yt(Ke,z),ot=Vt+ot),Le&&Pt(/((--!?|])>)|<\/(style|title|textarea)/i,ot)){Yt(Ke,z);continue}if(hr==="attributename"&&Tc(ot,"href")){Yt(Ke,z);continue}if(oe.forceKeepAttr)continue;if(!oe.keepAttr){Yt(Ke,z);continue}if(!Ne&&Pt(/\/>/i,ot)){Yt(Ke,z);continue}Ce&&Wa([M,P,$],vs=>{ot=ki(ot,vs," ")});const Pn=lt(z.nodeName);if(!ws(Pn,hr,ot)){Yt(Ke,z);continue}if(_&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!ht)switch(g.getAttributeType(Pn,hr)){case"TrustedHTML":{ot=_.createHTML(ot);break}case"TrustedScriptURL":{ot=_.createScriptURL(ot);break}}if(ot!==Gr)try{ht?z.setAttributeNS(ht,Ke,ot):z.setAttribute(Ke,ot),Ir(z)?Ct(z):Gf(t.removed)}catch{Yt(Ke,z)}}Xt(j.afterSanitizeAttributes,z,null)},yn=function le(z){let ee=null;const oe=gn(z);for(Xt(j.beforeSanitizeShadowDOM,z,null);ee=oe.nextNode();)Xt(j.uponSanitizeShadowNode,ee,null),Rn(ee),xn(ee),ee.content instanceof i&&le(ee.content);Xt(j.afterSanitizeShadowDOM,z,null)};return t.sanitize=function(le){let z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ee=null,oe=null,Ye=null,it=null;if(Ie=!le,Ie&&(le="<!-->"),typeof le!="string"&&!pn(le))if(typeof le.toString=="function"){if(le=le.toString(),typeof le!="string")throw wi("dirty is not a string, aborting")}else throw wi("toString is not a function");if(!t.isSupported)return le;if(ct||ur(z),t.removed=[],typeof le=="string"&&(je=!1),je){if(le.nodeName){const Kt=lt(le.nodeName);if(!D[Kt]||H[Kt])throw wi("root node is forbidden and cannot be sanitized in-place")}}else if(le instanceof o)ee=ks("<!---->"),oe=ee.ownerDocument.importNode(le,!0),oe.nodeType===Ci.element&&oe.nodeName==="BODY"||oe.nodeName==="HTML"?ee=oe:ee.appendChild(oe);else{if(!vt&&!Ce&&!Xe&&le.indexOf("<")===-1)return _&&We?_.createHTML(le):le;if(ee=ks(le),!ee)return vt?null:We?C:""}ee&&Ze&&Ct(ee.firstChild);const Ke=gn(je?le:ee);for(;Ye=Ke.nextNode();)Rn(Ye),xn(Ye),Ye.content instanceof i&&yn(Ye.content);if(je)return le;if(vt){if(Nt)for(it=F.call(ee.ownerDocument);ee.firstChild;)it.appendChild(ee.firstChild);else it=ee;return(N.shadowroot||N.shadowrootmode)&&(it=T.call(n,it,!0)),it}let ht=Xe?ee.outerHTML:ee.innerHTML;return Xe&&D["!doctype"]&&ee.ownerDocument&&ee.ownerDocument.doctype&&ee.ownerDocument.doctype.name&&Pt(I0,ee.ownerDocument.doctype.name)&&(ht="<!DOCTYPE "+ee.ownerDocument.doctype.name+`>
|
|
136
|
-
`+ht),Ce&&Wa([M,P,$],Kt=>{ht=ki(ht,Kt," ")}),_&&We?_.createHTML(ht):ht},t.setConfig=function(){let le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ur(le),ct=!0},t.clearConfig=function(){br=null,ct=!1},t.isValidAttribute=function(le,z,ee){br||ur({});const oe=lt(le),Ye=lt(z);return ws(oe,Ye,ee)},t.addHook=function(le,z){typeof z=="function"&&bi(j[le],z)},t.removeHook=function(le,z){if(z!==void 0){const ee=ME(j[le],z);return ee===-1?void 0:jE(j[le],ee,1)[0]}return Gf(j[le])},t.removeHooks=function(le){j[le]=[]},t.removeAllHooks=function(){j=Jf()},t}var Vs=L0(),$0=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Yi=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,YE=/\s*%%.*\n/gm,Bs,D0=(Bs=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},b(Bs,"UnknownDiagramError"),Bs),ns={},Vh=b(function(e,t){e=e.replace($0,"").replace(Yi,"").replace(YE,`
|
|
137
|
-
`);for(const[r,{detector:n}]of Object.entries(ns))if(n(e,t))return r;throw new D0(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),mu=b((...e)=>{for(const{id:t,detector:r,loader:n}of e)B0(t,r,n)},"registerLazyLoadedDiagrams"),B0=b((e,t,r)=>{ns[e]&&K.warn(`Detector with key ${e} already exists. Overwriting.`),ns[e]={detector:t,loader:r},K.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),XE=b(e=>ns[e].loader,"getDiagramLoader"),xu=b((e,t,{depth:r=2,clobber:n=!1}={})=>{const s={depth:r,clobber:n};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(i=>xu(e,i,s)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(i=>{e.includes(i)||e.push(i)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(i=>{typeof t[i]=="object"&&(e[i]===void 0||typeof e[i]=="object")?(e[i]===void 0&&(e[i]=Array.isArray(t[i])?[]:{}),e[i]=xu(e[i],t[i],{depth:r-1,clobber:n})):(n||typeof e[i]!="object"&&typeof t[i]!="object")&&(e[i]=t[i])}),e)},"assignWithDepth"),bt=xu,xl="#ffffff",yl="#f2f2f2",Ot=b((e,t)=>t?U(e,{s:-40,l:10}):U(e,{s:-40,l:-10}),"mkBorder"),Rs,KE=(Rs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||U(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||U(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Ot(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Ot(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Ot(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Ot(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||ne(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||ne(this.tertiaryColor),this.lineColor=this.lineColor||ne(this.background),this.arrowheadColor=this.arrowheadColor||ne(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||ne(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||ce(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||xe(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||xe(this.mainBkg,10)):(this.rowOdd=this.rowOdd||ce(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||ce(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||U(this.primaryColor,{h:30}),this.cScale4=this.cScale4||U(this.primaryColor,{h:60}),this.cScale5=this.cScale5||U(this.primaryColor,{h:90}),this.cScale6=this.cScale6||U(this.primaryColor,{h:120}),this.cScale7=this.cScale7||U(this.primaryColor,{h:150}),this.cScale8=this.cScale8||U(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||U(this.primaryColor,{h:270}),this.cScale10=this.cScale10||U(this.primaryColor,{h:300}),this.cScale11=this.cScale11||U(this.primaryColor,{h:330}),this.darkMode)for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScale"+r]=xe(this["cScale"+r],75);else for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScale"+r]=xe(this["cScale"+r],25);for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScaleInv"+r]=this["cScaleInv"+r]||ne(this["cScale"+r]);for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this.darkMode?this["cScalePeer"+r]=this["cScalePeer"+r]||ce(this["cScale"+r],10):this["cScalePeer"+r]=this["cScalePeer"+r]||xe(this["cScale"+r],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScaleLabel"+r]=this["cScaleLabel"+r]||this.scaleLabelColor;const t=this.darkMode?-4:-1;for(let r=0;r<5;r++)this["surface"+r]=this["surface"+r]||U(this.mainBkg,{h:180,s:-15,l:t*(5+r*3)}),this["surfacePeer"+r]=this["surfacePeer"+r]||U(this.mainBkg,{h:180,s:-15,l:t*(8+r*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||U(this.primaryColor,{h:64}),this.fillType3=this.fillType3||U(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||U(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||U(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||U(this.primaryColor,{h:128}),this.fillType7=this.fillType7||U(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||U(this.primaryColor,{l:-10}),this.pie5=this.pie5||U(this.secondaryColor,{l:-10}),this.pie6=this.pie6||U(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||U(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||U(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||U(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||U(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||U(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||U(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||U(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||U(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||U(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||U(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||U(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||U(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ya(this.quadrant1Fill)?ce(this.quadrant1Fill):xe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?xe(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||U(this.primaryColor,{h:-30}),this.git4=this.git4||U(this.primaryColor,{h:-60}),this.git5=this.git5||U(this.primaryColor,{h:-90}),this.git6=this.git6||U(this.primaryColor,{h:60}),this.git7=this.git7||U(this.primaryColor,{h:120}),this.darkMode?(this.git0=ce(this.git0,25),this.git1=ce(this.git1,25),this.git2=ce(this.git2,25),this.git3=ce(this.git3,25),this.git4=ce(this.git4,25),this.git5=ce(this.git5,25),this.git6=ce(this.git6,25),this.git7=ce(this.git7,25)):(this.git0=xe(this.git0,25),this.git1=xe(this.git1,25),this.git2=xe(this.git2,25),this.git3=xe(this.git3,25),this.git4=xe(this.git4,25),this.git5=xe(this.git5,25),this.git6=xe(this.git6,25),this.git7=xe(this.git7,25)),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Rs,"Theme"),Rs),QE=b(e=>{const t=new KE;return t.calculate(e),t},"getThemeVariables"),Ps,ZE=(Ps=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=ce(this.primaryColor,16),this.tertiaryColor=U(this.primaryColor,{h:-160}),this.primaryBorderColor=ne(this.background),this.secondaryBorderColor=Ot(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ot(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.tertiaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=ce(ne("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Gi(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=xe("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=xe(this.sectionBkgColor,10),this.taskBorderColor=Gi(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Gi(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||ce(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||xe(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){this.secondBkg=ce(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=ce(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=ce(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=U(this.primaryColor,{h:64}),this.fillType3=U(this.secondaryColor,{h:64}),this.fillType4=U(this.primaryColor,{h:-64}),this.fillType5=U(this.secondaryColor,{h:-64}),this.fillType6=U(this.primaryColor,{h:128}),this.fillType7=U(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||U(this.primaryColor,{h:30}),this.cScale4=this.cScale4||U(this.primaryColor,{h:60}),this.cScale5=this.cScale5||U(this.primaryColor,{h:90}),this.cScale6=this.cScale6||U(this.primaryColor,{h:120}),this.cScale7=this.cScale7||U(this.primaryColor,{h:150}),this.cScale8=this.cScale8||U(this.primaryColor,{h:210}),this.cScale9=this.cScale9||U(this.primaryColor,{h:270}),this.cScale10=this.cScale10||U(this.primaryColor,{h:300}),this.cScale11=this.cScale11||U(this.primaryColor,{h:330});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||ne(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScalePeer"+t]=this["cScalePeer"+t]||ce(this["cScale"+t],10);for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||U(this.mainBkg,{h:30,s:-30,l:-(-10+t*4)}),this["surfacePeer"+t]=this["surfacePeer"+t]||U(this.mainBkg,{h:30,s:-30,l:-(-7+t*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||U(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||U(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||U(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||U(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||U(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||U(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ya(this.quadrant1Fill)?ce(this.quadrant1Fill):xe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?xe(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=ce(this.secondaryColor,20),this.git1=ce(this.pie2||this.secondaryColor,20),this.git2=ce(this.pie3||this.tertiaryColor,20),this.git3=ce(this.pie4||U(this.primaryColor,{h:-30}),20),this.git4=ce(this.pie5||U(this.primaryColor,{h:-60}),20),this.git5=ce(this.pie6||U(this.primaryColor,{h:-90}),10),this.git6=ce(this.pie7||U(this.primaryColor,{h:60}),10),this.git7=ce(this.pie8||U(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||ne(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||ne(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||ce(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||ce(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Ps,"Theme"),Ps),JE=b(e=>{const t=new ZE;return t.calculate(e),t},"getThemeVariables"),Fs,eA=(Fs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=U(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=U(this.primaryColor,{h:-160}),this.primaryBorderColor=Ot(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ot(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ot(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.tertiaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=Gi(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||U(this.primaryColor,{h:30}),this.cScale4=this.cScale4||U(this.primaryColor,{h:60}),this.cScale5=this.cScale5||U(this.primaryColor,{h:90}),this.cScale6=this.cScale6||U(this.primaryColor,{h:120}),this.cScale7=this.cScale7||U(this.primaryColor,{h:150}),this.cScale8=this.cScale8||U(this.primaryColor,{h:210}),this.cScale9=this.cScale9||U(this.primaryColor,{h:270}),this.cScale10=this.cScale10||U(this.primaryColor,{h:300}),this.cScale11=this.cScale11||U(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||xe(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||xe(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=xe(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||xe(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||U(this["cScale"+t],{h:180});for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||U(this.mainBkg,{h:30,l:-(5+t*5)}),this["surfacePeer"+t]=this["surfacePeer"+t]||U(this.mainBkg,{h:30,l:-(7+t*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||ne(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||ne(this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=ce(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||ce(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||ce(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=U(this.primaryColor,{h:64}),this.fillType3=U(this.secondaryColor,{h:64}),this.fillType4=U(this.primaryColor,{h:-64}),this.fillType5=U(this.secondaryColor,{h:-64}),this.fillType6=U(this.primaryColor,{h:128}),this.fillType7=U(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||U(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||U(this.primaryColor,{l:-10}),this.pie5=this.pie5||U(this.secondaryColor,{l:-30}),this.pie6=this.pie6||U(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||U(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||U(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||U(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||U(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||U(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||U(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||U(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||U(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||U(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||U(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||U(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||U(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ya(this.quadrant1Fill)?ce(this.quadrant1Fill):xe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||U(this.primaryColor,{h:-30}),this.git4=this.git4||U(this.primaryColor,{h:-60}),this.git5=this.git5||U(this.primaryColor,{h:-90}),this.git6=this.git6||U(this.primaryColor,{h:60}),this.git7=this.git7||U(this.primaryColor,{h:120}),this.darkMode?(this.git0=ce(this.git0,25),this.git1=ce(this.git1,25),this.git2=ce(this.git2,25),this.git3=ce(this.git3,25),this.git4=ce(this.git4,25),this.git5=ce(this.git5,25),this.git6=ce(this.git6,25),this.git7=ce(this.git7,25)):(this.git0=xe(this.git0,25),this.git1=xe(this.git1,25),this.git2=xe(this.git2,25),this.git3=xe(this.git3,25),this.git4=xe(this.git4,25),this.git5=xe(this.git5,25),this.git6=xe(this.git6,25),this.git7=xe(this.git7,25)),this.gitInv0=this.gitInv0||xe(ne(this.git0),25),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||ne(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||ne(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(Object.keys(this).forEach(n=>{this[n]==="calculated"&&(this[n]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Fs,"Theme"),Fs),tA=b(e=>{const t=new eA;return t.calculate(e),t},"getThemeVariables"),Os,rA=(Os=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=ce("#cde498",10),this.primaryBorderColor=Ot(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ot(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ot(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.primaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.actorBorder=xe(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||U(this.primaryColor,{h:30}),this.cScale4=this.cScale4||U(this.primaryColor,{h:60}),this.cScale5=this.cScale5||U(this.primaryColor,{h:90}),this.cScale6=this.cScale6||U(this.primaryColor,{h:120}),this.cScale7=this.cScale7||U(this.primaryColor,{h:150}),this.cScale8=this.cScale8||U(this.primaryColor,{h:210}),this.cScale9=this.cScale9||U(this.primaryColor,{h:270}),this.cScale10=this.cScale10||U(this.primaryColor,{h:300}),this.cScale11=this.cScale11||U(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||xe(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||xe(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=xe(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||xe(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||U(this["cScale"+t],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||U(this.mainBkg,{h:30,s:-30,l:-(5+t*5)}),this["surfacePeer"+t]=this["surfacePeer"+t]||U(this.mainBkg,{h:30,s:-30,l:-(8+t*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||ce(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||ce(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=U(this.primaryColor,{h:64}),this.fillType3=U(this.secondaryColor,{h:64}),this.fillType4=U(this.primaryColor,{h:-64}),this.fillType5=U(this.secondaryColor,{h:-64}),this.fillType6=U(this.primaryColor,{h:128}),this.fillType7=U(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||U(this.primaryColor,{l:-30}),this.pie5=this.pie5||U(this.secondaryColor,{l:-30}),this.pie6=this.pie6||U(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||U(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||U(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||U(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||U(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||U(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||U(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||U(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||U(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||U(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||U(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||U(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||U(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ya(this.quadrant1Fill)?ce(this.quadrant1Fill):xe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||U(this.primaryColor,{h:-30}),this.git4=this.git4||U(this.primaryColor,{h:-60}),this.git5=this.git5||U(this.primaryColor,{h:-90}),this.git6=this.git6||U(this.primaryColor,{h:60}),this.git7=this.git7||U(this.primaryColor,{h:120}),this.darkMode?(this.git0=ce(this.git0,25),this.git1=ce(this.git1,25),this.git2=ce(this.git2,25),this.git3=ce(this.git3,25),this.git4=ce(this.git4,25),this.git5=ce(this.git5,25),this.git6=ce(this.git6,25),this.git7=ce(this.git7,25)):(this.git0=xe(this.git0,25),this.git1=xe(this.git1,25),this.git2=xe(this.git2,25),this.git3=xe(this.git3,25),this.git4=xe(this.git4,25),this.git5=xe(this.git5,25),this.git6=xe(this.git6,25),this.git7=xe(this.git7,25)),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||ne(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||ne(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Os,"Theme"),Os),nA=b(e=>{const t=new rA;return t.calculate(e),t},"getThemeVariables"),zs,sA=(zs=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=ce(this.contrast,55),this.background="#ffffff",this.tertiaryColor=U(this.primaryColor,{h:-160}),this.primaryBorderColor=Ot(this.primaryColor,this.darkMode),this.secondaryBorderColor=Ot(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Ot(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.tertiaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||ce(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.secondBkg=ce(this.contrast,55),this.border2=this.contrast,this.actorBorder=ce(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||ne(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this.darkMode?this["cScalePeer"+t]=this["cScalePeer"+t]||ce(this["cScale"+t],10):this["cScalePeer"+t]=this["cScalePeer"+t]||xe(this["cScale"+t],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||U(this.mainBkg,{l:-(5+t*5)}),this["surfacePeer"+t]=this["surfacePeer"+t]||U(this.mainBkg,{l:-(8+t*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=ce(this.contrast,30),this.sectionBkgColor2=ce(this.contrast,30),this.taskBorderColor=xe(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=ce(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=xe(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=U(this.primaryColor,{h:64}),this.fillType3=U(this.secondaryColor,{h:64}),this.fillType4=U(this.primaryColor,{h:-64}),this.fillType5=U(this.secondaryColor,{h:-64}),this.fillType6=U(this.primaryColor,{h:128}),this.fillType7=U(this.secondaryColor,{h:128});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||U(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||U(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||U(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||U(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||U(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||U(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ya(this.quadrant1Fill)?ce(this.quadrant1Fill):xe(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=xe(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||U(this.primaryColor,{h:-30}),this.git4=this.pie5||U(this.primaryColor,{h:-60}),this.git5=this.pie6||U(this.primaryColor,{h:-90}),this.git6=this.pie7||U(this.primaryColor,{h:60}),this.git7=this.pie8||U(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(zs,"Theme"),zs),iA=b(e=>{const t=new sA;return t.calculate(e),t},"getThemeVariables"),rn={base:{getThemeVariables:QE},dark:{getThemeVariables:JE},default:{getThemeVariables:tA},forest:{getThemeVariables:nA},neutral:{getThemeVariables:iA}},Lr={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},R0={...Lr,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:rn.default.getThemeVariables(),sequence:{...Lr.sequence,messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:b(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:b(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...Lr.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Lr.c4,useWidth:void 0,personFont:b(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Lr.flowchart,inheritDir:!1},external_personFont:b(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:b(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:b(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:b(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:b(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:b(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:b(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:b(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:b(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:b(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:b(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:b(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:b(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:b(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:b(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:b(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:b(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:b(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:b(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:b(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Lr.pie,useWidth:984},xyChart:{...Lr.xyChart,useWidth:void 0},requirement:{...Lr.requirement,useWidth:void 0},packet:{...Lr.packet},radar:{...Lr.radar},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","}},P0=b((e,t="")=>Object.keys(e).reduce((r,n)=>Array.isArray(e[n])?r:typeof e[n]=="object"&&e[n]!==null?[...r,t+n,...P0(e[n],"")]:[...r,t+n],[]),"keyify"),aA=new Set(P0(R0,"")),F0=R0,_o=b(e=>{if(K.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>_o(t));return}for(const t of Object.keys(e)){if(K.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!aA.has(t)||e[t]==null){K.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){K.debug("sanitizing object",t),_o(e[t]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)t.includes(n)&&(K.debug("sanitizing css option",t),e[t]=oA(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}K.debug("After sanitization",e)}},"sanitizeDirective"),oA=b(e=>{let t=0,r=0;for(const n of e){if(t<r)return"{ /* ERROR: Unbalanced CSS */ }";n==="{"?t++:n==="}"&&r++}return t!==r?"{ /* ERROR: Unbalanced CSS */ }":e},"sanitizeCss"),Gs=Object.freeze(F0),er=bt({},Gs),To,ss=[],Xi=bt({},Gs),bl=b((e,t)=>{let r=bt({},e),n={};for(const s of t)W0(s),n=bt(n,s);if(r=bt(r,n),n.theme&&n.theme in rn){const s=bt({},To),i=bt(s.themeVariables||{},n.themeVariables);r.theme&&r.theme in rn&&(r.themeVariables=rn[r.theme].getThemeVariables(i))}return Xi=r,H0(Xi),Xi},"updateCurrentConfig"),lA=b(e=>(er=bt({},Gs),er=bt(er,e),e.theme&&rn[e.theme]&&(er.themeVariables=rn[e.theme].getThemeVariables(e.themeVariables)),bl(er,ss),er),"setSiteConfig"),cA=b(e=>{To=bt({},e)},"saveConfigFromInitialize"),uA=b(e=>(er=bt(er,e),bl(er,ss),er),"updateSiteConfig"),O0=b(()=>bt({},er),"getSiteConfig"),z0=b(e=>(H0(e),bt(Xi,e),It()),"setConfig"),It=b(()=>bt({},Xi),"getConfig"),W0=b(e=>{e&&(["secure",...er.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(K.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&W0(e[t])}))},"sanitize"),hA=b(e=>{_o(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),ss.push(e),bl(er,ss)},"addDirective"),No=b((e=er)=>{ss=[],bl(e,ss)},"reset"),dA={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},eg={},fA=b(e=>{eg[e]||(K.warn(dA[e]),eg[e]=!0)},"issueWarning"),H0=b(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&fA("LAZY_LOAD_DEPRECATED")},"checkConfig"),x9=b(()=>{let e={};To&&(e=bt(e,To));for(const t of ss)e=bt(e,t);return e},"getUserDefinedConfig"),ba=/<br\s*\/?>/gi,gA=b(e=>e?V0(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),pA=(()=>{let e=!1;return()=>{e||(q0(),e=!0)}})();function q0(){const e="data-temp-href-target";Vs.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Vs.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}b(q0,"setupDompurifyHooks");var U0=b(e=>(pA(),Vs.sanitize(e)),"removeScript"),tg=b((e,t)=>{if(t.flowchart?.htmlLabels!==!1){const r=t.securityLevel;r==="antiscript"||r==="strict"?e=U0(e):r!=="loose"&&(e=V0(e),e=e.replace(/</g,"<").replace(/>/g,">"),e=e.replace(/=/g,"="),e=bA(e))}return e},"sanitizeMore"),mr=b((e,t)=>e&&(t.dompurifyConfig?e=Vs.sanitize(tg(e,t),t.dompurifyConfig).toString():e=Vs.sanitize(tg(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),mA=b((e,t)=>typeof e=="string"?mr(e,t):e.flat().map(r=>mr(r,t)),"sanitizeTextOrArray"),xA=b(e=>ba.test(e),"hasBreaks"),yA=b(e=>e.split(ba),"splitBreaks"),bA=b(e=>e.replace(/#br#/g,"<br/>"),"placeholderToBreak"),V0=b(e=>e.replace(ba,"#br#"),"breakToPlaceholder"),kA=b(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),wt=b(e=>!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),wA=b(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),vA=b(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),rg=b(function(e){const t=e.split(/(,)/),r=[];for(let n=0;n<t.length;n++){let s=t[n];if(s===","&&n>0&&n+1<t.length){const i=t[n-1],a=t[n+1];CA(i,a)&&(s=i+","+a,n++,r.pop())}r.push(SA(s))}return r.join("")},"parseGenericTypes"),yu=b((e,t)=>Math.max(0,e.split(t).length-1),"countOccurrence"),CA=b((e,t)=>{const r=yu(e,"~"),n=yu(t,"~");return r===1&&n===1},"shouldCombineSets"),SA=b(e=>{const t=yu(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const n=[...e];let s=n.indexOf("~"),i=n.lastIndexOf("~");for(;s!==-1&&i!==-1&&s!==i;)n[s]="<",n[i]=">",s=n.indexOf("~"),i=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),ng=b(()=>window.MathMLElement!==void 0,"isMathMLSupported"),bu=/\$\$(.*)\$\$/g,Ys=b(e=>(e.match(bu)?.length??0)>0,"hasKatex"),y9=b(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await Gh(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);const s={width:r.clientWidth,height:r.clientHeight};return r.remove(),s},"calculateMathMLDimensions"),_A=b(async(e,t)=>{if(!Ys(e))return e;if(!(ng()||t.legacyMathML||t.forceLegacyMathML))return e.replace(bu,"MathML is unsupported in this environment.");{const{default:r}=await Ve(async()=>{const{default:s}=await import("./katex-qrhCpa0F.js");return{default:s}},[]),n=t.forceLegacyMathML||!ng()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(ba).map(s=>Ys(s)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${s}</div>`:`<div>${s}</div>`).join("").replace(bu,(s,i)=>r.renderToString(i,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),Gh=b(async(e,t)=>mr(await _A(e,t),t),"renderKatexSanitized"),ni={getRows:gA,sanitizeText:mr,sanitizeTextOrArray:mA,hasBreaks:xA,splitBreaks:yA,lineBreakRegex:ba,removeScript:U0,getUrl:kA,evaluate:wt,getMax:wA,getMin:vA},TA=b(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),NA=b(function(e,t,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${t}px;`)):(n.set("height",e),n.set("width",t)),n},"calculateSvgSizeAttrs"),G0=b(function(e,t,r,n){const s=NA(t,r,n);TA(e,s)},"configureSvgSize"),EA=b(function(e,t,r,n){const s=t.node().getBBox(),i=s.width,a=s.height;K.info(`SVG bounds: ${i}x${a}`,s);let o=0,l=0;K.info(`Graph bounds: ${o}x${l}`,e),o=i+r*2,l=a+r*2,K.info(`Calculated bounds: ${o}x${l}`),G0(t,l,o,n);const c=`${s.x-r} ${s.y-r} ${s.width+2*r} ${s.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),lo={},AA=b((e,t,r)=>{let n="";return e in lo&&lo[e]?n=lo[e](r):K.warn(`No theme found for ${e}`),` & {
|
|
138
|
-
font-family: ${r.fontFamily};
|
|
139
|
-
font-size: ${r.fontSize};
|
|
140
|
-
fill: ${r.textColor}
|
|
141
|
-
}
|
|
142
|
-
@keyframes edge-animation-frame {
|
|
143
|
-
from {
|
|
144
|
-
stroke-dashoffset: 0;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
@keyframes dash {
|
|
148
|
-
to {
|
|
149
|
-
stroke-dashoffset: 0;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
& .edge-animation-slow {
|
|
153
|
-
stroke-dasharray: 9,5 !important;
|
|
154
|
-
stroke-dashoffset: 900;
|
|
155
|
-
animation: dash 50s linear infinite;
|
|
156
|
-
stroke-linecap: round;
|
|
157
|
-
}
|
|
158
|
-
& .edge-animation-fast {
|
|
159
|
-
stroke-dasharray: 9,5 !important;
|
|
160
|
-
stroke-dashoffset: 900;
|
|
161
|
-
animation: dash 20s linear infinite;
|
|
162
|
-
stroke-linecap: round;
|
|
163
|
-
}
|
|
164
|
-
/* Classes common for multiple diagrams */
|
|
165
|
-
|
|
166
|
-
& .error-icon {
|
|
167
|
-
fill: ${r.errorBkgColor};
|
|
168
|
-
}
|
|
169
|
-
& .error-text {
|
|
170
|
-
fill: ${r.errorTextColor};
|
|
171
|
-
stroke: ${r.errorTextColor};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
& .edge-thickness-normal {
|
|
175
|
-
stroke-width: 1px;
|
|
176
|
-
}
|
|
177
|
-
& .edge-thickness-thick {
|
|
178
|
-
stroke-width: 3.5px
|
|
179
|
-
}
|
|
180
|
-
& .edge-pattern-solid {
|
|
181
|
-
stroke-dasharray: 0;
|
|
182
|
-
}
|
|
183
|
-
& .edge-thickness-invisible {
|
|
184
|
-
stroke-width: 0;
|
|
185
|
-
fill: none;
|
|
186
|
-
}
|
|
187
|
-
& .edge-pattern-dashed{
|
|
188
|
-
stroke-dasharray: 3;
|
|
189
|
-
}
|
|
190
|
-
.edge-pattern-dotted {
|
|
191
|
-
stroke-dasharray: 2;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
& .marker {
|
|
195
|
-
fill: ${r.lineColor};
|
|
196
|
-
stroke: ${r.lineColor};
|
|
197
|
-
}
|
|
198
|
-
& .marker.cross {
|
|
199
|
-
stroke: ${r.lineColor};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
& svg {
|
|
203
|
-
font-family: ${r.fontFamily};
|
|
204
|
-
font-size: ${r.fontSize};
|
|
205
|
-
}
|
|
206
|
-
& p {
|
|
207
|
-
margin: 0
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
${n}
|
|
211
|
-
|
|
212
|
-
${t}
|
|
213
|
-
`},"getStyles"),MA=b((e,t)=>{t!==void 0&&(lo[e]=t)},"addStylesForDiagram"),jA=AA,Y0={};bE(Y0,{clear:()=>IA,getAccDescription:()=>BA,getAccTitle:()=>$A,getDiagramTitle:()=>PA,setAccDescription:()=>DA,setAccTitle:()=>LA,setDiagramTitle:()=>RA});var Yh="",Xh="",Kh="",Qh=b(e=>mr(e,It()),"sanitizeText"),IA=b(()=>{Yh="",Kh="",Xh=""},"clear"),LA=b(e=>{Yh=Qh(e).replace(/^\s+/g,"")},"setAccTitle"),$A=b(()=>Yh,"getAccTitle"),DA=b(e=>{Kh=Qh(e).replace(/\n\s+/g,`
|
|
214
|
-
`)},"setAccDescription"),BA=b(()=>Kh,"getAccDescription"),RA=b(e=>{Xh=Qh(e)},"setDiagramTitle"),PA=b(()=>Xh,"getDiagramTitle"),sg=K,FA=Uh,qe=It,b9=z0,k9=Gs,Zh=b(e=>mr(e,qe()),"sanitizeText"),OA=EA,zA=b(()=>Y0,"getCommonDb"),Eo={},Ao=b((e,t,r)=>{Eo[e]&&sg.warn(`Diagram with id ${e} already registered. Overwriting.`),Eo[e]=t,r&&B0(e,r),MA(e,t.styles),t.injectUtils?.(sg,FA,qe,Zh,OA,zA(),()=>{})},"registerDiagram"),ku=b(e=>{if(e in Eo)return Eo[e];throw new WA(e)},"getDiagram"),Ws,WA=(Ws=class extends Error{constructor(t){super(`Diagram ${t} not found.`)}},b(Ws,"DiagramNotFoundError"),Ws),HA={value:()=>{}};function X0(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new co(r)}function co(e){this._=e}function qA(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",s=r.indexOf(".");if(s>=0&&(n=r.slice(s+1),r=r.slice(0,s)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}co.prototype=X0.prototype={constructor:co,on:function(e,t){var r=this._,n=qA(e+"",r),s,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((s=(e=n[i]).type)&&(s=UA(r[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(s=(e=n[i]).type)r[s]=ig(r[s],e.name,t);else if(t==null)for(s in r)r[s]=ig(r[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new co(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var r=new Array(s),n=0,s,i;n<s;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],n=0,s=i.length;n<s;++n)i[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],s=0,i=n.length;s<i;++s)n[s].value.apply(t,r)}};function UA(e,t){for(var r=0,n=e.length,s;r<n;++r)if((s=e[r]).name===t)return s.value}function ig(e,t,r){for(var n=0,s=e.length;n<s;++n)if(e[n].name===t){e[n]=HA,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var wu="http://www.w3.org/1999/xhtml";const ag={svg:"http://www.w3.org/2000/svg",xhtml:wu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kl(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),ag.hasOwnProperty(t)?{space:ag[t],local:e}:e}function VA(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===wu&&t.documentElement.namespaceURI===wu?t.createElement(e):t.createElementNS(r,e)}}function GA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function K0(e){var t=kl(e);return(t.local?GA:VA)(t)}function YA(){}function Jh(e){return e==null?YA:function(){return this.querySelector(e)}}function XA(e){typeof e!="function"&&(e=Jh(e));for(var t=this._groups,r=t.length,n=new Array(r),s=0;s<r;++s)for(var i=t[s],a=i.length,o=n[s]=new Array(a),l,c,u=0;u<a;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),o[u]=c);return new lr(n,this._parents)}function KA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function QA(){return[]}function Q0(e){return e==null?QA:function(){return this.querySelectorAll(e)}}function ZA(e){return function(){return KA(e.apply(this,arguments))}}function JA(e){typeof e=="function"?e=ZA(e):e=Q0(e);for(var t=this._groups,r=t.length,n=[],s=[],i=0;i<r;++i)for(var a=t[i],o=a.length,l,c=0;c<o;++c)(l=a[c])&&(n.push(e.call(l,l.__data__,c,a)),s.push(l));return new lr(n,s)}function Z0(e){return function(){return this.matches(e)}}function J0(e){return function(t){return t.matches(e)}}var eM=Array.prototype.find;function tM(e){return function(){return eM.call(this.children,e)}}function rM(){return this.firstElementChild}function nM(e){return this.select(e==null?rM:tM(typeof e=="function"?e:J0(e)))}var sM=Array.prototype.filter;function iM(){return Array.from(this.children)}function aM(e){return function(){return sM.call(this.children,e)}}function oM(e){return this.selectAll(e==null?iM:aM(typeof e=="function"?e:J0(e)))}function lM(e){typeof e!="function"&&(e=Z0(e));for(var t=this._groups,r=t.length,n=new Array(r),s=0;s<r;++s)for(var i=t[s],a=i.length,o=n[s]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&o.push(l);return new lr(n,this._parents)}function ex(e){return new Array(e.length)}function cM(){return new lr(this._enter||this._groups.map(ex),this._parents)}function Mo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Mo.prototype={constructor:Mo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function uM(e){return function(){return e}}function hM(e,t,r,n,s,i){for(var a=0,o,l=t.length,c=i.length;a<c;++a)(o=t[a])?(o.__data__=i[a],n[a]=o):r[a]=new Mo(e,i[a]);for(;a<l;++a)(o=t[a])&&(s[a]=o)}function dM(e,t,r,n,s,i,a){var o,l,c=new Map,u=t.length,h=i.length,f=new Array(u),g;for(o=0;o<u;++o)(l=t[o])&&(f[o]=g=a.call(l,l.__data__,o,t)+"",c.has(g)?s[o]=l:c.set(g,l));for(o=0;o<h;++o)g=a.call(e,i[o],o,i)+"",(l=c.get(g))?(n[o]=l,l.__data__=i[o],c.delete(g)):r[o]=new Mo(e,i[o]);for(o=0;o<u;++o)(l=t[o])&&c.get(f[o])===l&&(s[o]=l)}function fM(e){return e.__data__}function gM(e,t){if(!arguments.length)return Array.from(this,fM);var r=t?dM:hM,n=this._parents,s=this._groups;typeof e!="function"&&(e=uM(e));for(var i=s.length,a=new Array(i),o=new Array(i),l=new Array(i),c=0;c<i;++c){var u=n[c],h=s[c],f=h.length,g=pM(e.call(u,u&&u.__data__,c,n)),p=g.length,m=o[c]=new Array(p),y=a[c]=new Array(p),x=l[c]=new Array(f);r(u,h,m,y,x,g,t);for(var k=0,v=0,_,C;k<p;++k)if(_=m[k]){for(k>=v&&(v=k+1);!(C=y[v])&&++v<p;);_._next=C||null}}return a=new lr(a,n),a._enter=o,a._exit=l,a}function pM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function mM(){return new lr(this._exit||this._groups.map(ex),this._parents)}function xM(e,t,r){var n=this.enter(),s=this,i=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),r==null?i.remove():r(i),n&&s?n.merge(s).order():s}function yM(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,s=r.length,i=n.length,a=Math.min(s,i),o=new Array(s),l=0;l<a;++l)for(var c=r[l],u=n[l],h=c.length,f=o[l]=new Array(h),g,p=0;p<h;++p)(g=c[p]||u[p])&&(f[p]=g);for(;l<s;++l)o[l]=r[l];return new lr(o,this._parents)}function bM(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],s=n.length-1,i=n[s],a;--s>=0;)(a=n[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function kM(e){e||(e=wM);function t(h,f){return h&&f?e(h.__data__,f.__data__):!h-!f}for(var r=this._groups,n=r.length,s=new Array(n),i=0;i<n;++i){for(var a=r[i],o=a.length,l=s[i]=new Array(o),c,u=0;u<o;++u)(c=a[u])&&(l[u]=c);l.sort(t)}return new lr(s,this._parents).order()}function wM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function vM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function CM(){return Array.from(this)}function SM(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],s=0,i=n.length;s<i;++s){var a=n[s];if(a)return a}return null}function _M(){let e=0;for(const t of this)++e;return e}function TM(){return!this.node()}function NM(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var s=t[r],i=0,a=s.length,o;i<a;++i)(o=s[i])&&e.call(o,o.__data__,i,s);return this}function EM(e){return function(){this.removeAttribute(e)}}function AM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MM(e,t){return function(){this.setAttribute(e,t)}}function jM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function IM(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function LM(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function $M(e,t){var r=kl(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?AM:EM:typeof t=="function"?r.local?LM:IM:r.local?jM:MM)(r,t))}function tx(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function DM(e){return function(){this.style.removeProperty(e)}}function BM(e,t,r){return function(){this.style.setProperty(e,t,r)}}function RM(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function PM(e,t,r){return arguments.length>1?this.each((t==null?DM:typeof t=="function"?RM:BM)(e,t,r??"")):Xs(this.node(),e)}function Xs(e,t){return e.style.getPropertyValue(t)||tx(e).getComputedStyle(e,null).getPropertyValue(t)}function FM(e){return function(){delete this[e]}}function OM(e,t){return function(){this[e]=t}}function zM(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function WM(e,t){return arguments.length>1?this.each((t==null?FM:typeof t=="function"?zM:OM)(e,t)):this.node()[e]}function rx(e){return e.trim().split(/^|\s+/)}function ed(e){return e.classList||new nx(e)}function nx(e){this._node=e,this._names=rx(e.getAttribute("class")||"")}nx.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function sx(e,t){for(var r=ed(e),n=-1,s=t.length;++n<s;)r.add(t[n])}function ix(e,t){for(var r=ed(e),n=-1,s=t.length;++n<s;)r.remove(t[n])}function HM(e){return function(){sx(this,e)}}function qM(e){return function(){ix(this,e)}}function UM(e,t){return function(){(t.apply(this,arguments)?sx:ix)(this,e)}}function VM(e,t){var r=rx(e+"");if(arguments.length<2){for(var n=ed(this.node()),s=-1,i=r.length;++s<i;)if(!n.contains(r[s]))return!1;return!0}return this.each((typeof t=="function"?UM:t?HM:qM)(r,t))}function GM(){this.textContent=""}function YM(e){return function(){this.textContent=e}}function XM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function KM(e){return arguments.length?this.each(e==null?GM:(typeof e=="function"?XM:YM)(e)):this.node().textContent}function QM(){this.innerHTML=""}function ZM(e){return function(){this.innerHTML=e}}function JM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ej(e){return arguments.length?this.each(e==null?QM:(typeof e=="function"?JM:ZM)(e)):this.node().innerHTML}function tj(){this.nextSibling&&this.parentNode.appendChild(this)}function rj(){return this.each(tj)}function nj(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function sj(){return this.each(nj)}function ij(e){var t=typeof e=="function"?e:K0(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function aj(){return null}function oj(e,t){var r=typeof e=="function"?e:K0(e),n=t==null?aj:typeof t=="function"?t:Jh(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function lj(){var e=this.parentNode;e&&e.removeChild(this)}function cj(){return this.each(lj)}function uj(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hj(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function dj(e){return this.select(e?hj:uj)}function fj(e){return arguments.length?this.property("__data__",e):this.node().__data__}function gj(e){return function(t){e.call(this,t,this.__data__)}}function pj(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function mj(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,s=t.length,i;r<s;++r)i=t[r],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++n]=i;++n?t.length=n:delete this.__on}}}function xj(e,t,r){return function(){var n=this.__on,s,i=gj(t);if(n){for(var a=0,o=n.length;a<o;++a)if((s=n[a]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=r),s.value=t;return}}this.addEventListener(e.type,i,r),s={type:e.type,name:e.name,value:t,listener:i,options:r},n?n.push(s):this.__on=[s]}}function yj(e,t,r){var n=pj(e+""),s,i=n.length,a;if(arguments.length<2){var o=this.node().__on;if(o){for(var l=0,c=o.length,u;l<c;++l)for(s=0,u=o[l];s<i;++s)if((a=n[s]).type===u.type&&a.name===u.name)return u.value}return}for(o=t?xj:mj,s=0;s<i;++s)this.each(o(n[s],t,r));return this}function ax(e,t,r){var n=tx(e),s=n.CustomEvent;typeof s=="function"?s=new s(t,r):(s=n.document.createEvent("Event"),r?(s.initEvent(t,r.bubbles,r.cancelable),s.detail=r.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function bj(e,t){return function(){return ax(this,e,t)}}function kj(e,t){return function(){return ax(this,e,t.apply(this,arguments))}}function wj(e,t){return this.each((typeof t=="function"?kj:bj)(e,t))}function*vj(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],s=0,i=n.length,a;s<i;++s)(a=n[s])&&(yield a)}var ox=[null];function lr(e,t){this._groups=e,this._parents=t}function ka(){return new lr([[document.documentElement]],ox)}function Cj(){return this}lr.prototype=ka.prototype={constructor:lr,select:XA,selectAll:JA,selectChild:nM,selectChildren:oM,filter:lM,data:gM,enter:cM,exit:mM,join:xM,merge:yM,selection:Cj,order:bM,sort:kM,call:vM,nodes:CM,node:SM,size:_M,empty:TM,each:NM,attr:$M,style:PM,property:WM,classed:VM,text:KM,html:ej,raise:rj,lower:sj,append:ij,insert:oj,remove:cj,clone:dj,datum:fj,on:yj,dispatch:wj,[Symbol.iterator]:vj};function Fe(e){return typeof e=="string"?new lr([[document.querySelector(e)]],[document.documentElement]):new lr([[e]],ox)}function td(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function lx(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function wa(){}var ta=.7,jo=1/ta,$s="\\s*([+-]?\\d+)\\s*",ra="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Or="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sj=/^#([0-9a-f]{3,8})$/,_j=new RegExp(`^rgb\\(${$s},${$s},${$s}\\)$`),Tj=new RegExp(`^rgb\\(${Or},${Or},${Or}\\)$`),Nj=new RegExp(`^rgba\\(${$s},${$s},${$s},${ra}\\)$`),Ej=new RegExp(`^rgba\\(${Or},${Or},${Or},${ra}\\)$`),Aj=new RegExp(`^hsl\\(${ra},${Or},${Or}\\)$`),Mj=new RegExp(`^hsla\\(${ra},${Or},${Or},${ra}\\)$`),og={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};td(wa,na,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:lg,formatHex:lg,formatHex8:jj,formatHsl:Ij,formatRgb:cg,toString:cg});function lg(){return this.rgb().formatHex()}function jj(){return this.rgb().formatHex8()}function Ij(){return cx(this).formatHsl()}function cg(){return this.rgb().formatRgb()}function na(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Sj.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?ug(t):r===3?new rr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?qa(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?qa(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_j.exec(e))?new rr(t[1],t[2],t[3],1):(t=Tj.exec(e))?new rr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nj.exec(e))?qa(t[1],t[2],t[3],t[4]):(t=Ej.exec(e))?qa(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Aj.exec(e))?fg(t[1],t[2]/100,t[3]/100,1):(t=Mj.exec(e))?fg(t[1],t[2]/100,t[3]/100,t[4]):og.hasOwnProperty(e)?ug(og[e]):e==="transparent"?new rr(NaN,NaN,NaN,0):null}function ug(e){return new rr(e>>16&255,e>>8&255,e&255,1)}function qa(e,t,r,n){return n<=0&&(e=t=r=NaN),new rr(e,t,r,n)}function Lj(e){return e instanceof wa||(e=na(e)),e?(e=e.rgb(),new rr(e.r,e.g,e.b,e.opacity)):new rr}function vu(e,t,r,n){return arguments.length===1?Lj(e):new rr(e,t,r,n??1)}function rr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}td(rr,vu,lx(wa,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ta:Math.pow(ta,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rr(Zn(this.r),Zn(this.g),Zn(this.b),Io(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:hg,formatHex:hg,formatHex8:$j,formatRgb:dg,toString:dg}));function hg(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function $j(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function dg(){const e=Io(this.opacity);return`${e===1?"rgb(":"rgba("}${Zn(this.r)}, ${Zn(this.g)}, ${Zn(this.b)}${e===1?")":`, ${e})`}`}function Io(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gn(e){return e=Zn(e),(e<16?"0":"")+e.toString(16)}function fg(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new _r(e,t,r,n)}function cx(e){if(e instanceof _r)return new _r(e.h,e.s,e.l,e.opacity);if(e instanceof wa||(e=na(e)),!e)return new _r;if(e instanceof _r)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,s=Math.min(t,r,n),i=Math.max(t,r,n),a=NaN,o=i-s,l=(i+s)/2;return o?(t===i?a=(r-n)/o+(r<n)*6:r===i?a=(n-t)/o+2:a=(t-r)/o+4,o/=l<.5?i+s:2-i-s,a*=60):o=l>0&&l<1?0:a,new _r(a,o,l,e.opacity)}function Dj(e,t,r,n){return arguments.length===1?cx(e):new _r(e,t,r,n??1)}function _r(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}td(_r,Dj,lx(wa,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new _r(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ta:Math.pow(ta,e),new _r(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,s=2*r-n;return new rr(jc(e>=240?e-240:e+120,s,n),jc(e,s,n),jc(e<120?e+240:e-120,s,n),this.opacity)},clamp(){return new _r(gg(this.h),Ua(this.s),Ua(this.l),Io(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Io(this.opacity);return`${e===1?"hsl(":"hsla("}${gg(this.h)}, ${Ua(this.s)*100}%, ${Ua(this.l)*100}%${e===1?")":`, ${e})`}`}}));function gg(e){return e=(e||0)%360,e<0?e+360:e}function Ua(e){return Math.max(0,Math.min(1,e||0))}function jc(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const rd=e=>()=>e;function ux(e,t){return function(r){return e+r*t}}function Bj(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function w9(e,t){var r=t-e;return r?ux(e,r>180||r<-180?r-360*Math.round(r/360):r):rd(isNaN(e)?t:e)}function Rj(e){return(e=+e)==1?hx:function(t,r){return r-t?Bj(t,r,e):rd(isNaN(t)?r:t)}}function hx(e,t){var r=t-e;return r?ux(e,r):rd(isNaN(e)?t:e)}const pg=(function e(t){var r=Rj(t);function n(s,i){var a=r((s=vu(s)).r,(i=vu(i)).r),o=r(s.g,i.g),l=r(s.b,i.b),c=hx(s.opacity,i.opacity);return function(u){return s.r=a(u),s.g=o(u),s.b=l(u),s.opacity=c(u),s+""}}return n.gamma=e,n})(1);function Cn(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Cu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ic=new RegExp(Cu.source,"g");function Pj(e){return function(){return e}}function Fj(e){return function(t){return e(t)+""}}function Oj(e,t){var r=Cu.lastIndex=Ic.lastIndex=0,n,s,i,a=-1,o=[],l=[];for(e=e+"",t=t+"";(n=Cu.exec(e))&&(s=Ic.exec(t));)(i=s.index)>r&&(i=t.slice(r,i),o[a]?o[a]+=i:o[++a]=i),(n=n[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:Cn(n,s)})),r=Ic.lastIndex;return r<t.length&&(i=t.slice(r),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?Fj(l[0].x):Pj(t):(t=l.length,function(c){for(var u=0,h;u<t;++u)o[(h=l[u]).i]=h.x(c);return o.join("")})}var mg=180/Math.PI,Su={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function dx(e,t,r,n,s,i){var a,o,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*r+t*n)&&(r-=e*l,n-=t*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),e*n<t*r&&(e=-e,t=-t,l=-l,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*mg,skewX:Math.atan(l)*mg,scaleX:a,scaleY:o}}var Va;function zj(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Su:dx(t.a,t.b,t.c,t.d,t.e,t.f)}function Wj(e){return e==null||(Va||(Va=document.createElementNS("http://www.w3.org/2000/svg","g")),Va.setAttribute("transform",e),!(e=Va.transform.baseVal.consolidate()))?Su:(e=e.matrix,dx(e.a,e.b,e.c,e.d,e.e,e.f))}function fx(e,t,r,n){function s(c){return c.length?c.pop()+" ":""}function i(c,u,h,f,g,p){if(c!==h||u!==f){var m=g.push("translate(",null,t,null,r);p.push({i:m-4,x:Cn(c,h)},{i:m-2,x:Cn(u,f)})}else(h||f)&&g.push("translate("+h+t+f+r)}function a(c,u,h,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:h.push(s(h)+"rotate(",null,n)-2,x:Cn(c,u)})):u&&h.push(s(h)+"rotate("+u+n)}function o(c,u,h,f){c!==u?f.push({i:h.push(s(h)+"skewX(",null,n)-2,x:Cn(c,u)}):u&&h.push(s(h)+"skewX("+u+n)}function l(c,u,h,f,g,p){if(c!==h||u!==f){var m=g.push(s(g)+"scale(",null,",",null,")");p.push({i:m-4,x:Cn(c,h)},{i:m-2,x:Cn(u,f)})}else(h!==1||f!==1)&&g.push(s(g)+"scale("+h+","+f+")")}return function(c,u){var h=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,h,f),a(c.rotate,u.rotate,h,f),o(c.skewX,u.skewX,h,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,f),c=u=null,function(g){for(var p=-1,m=f.length,y;++p<m;)h[(y=f[p]).i]=y.x(g);return h.join("")}}}var Hj=fx(zj,"px, ","px)","deg)"),qj=fx(Wj,", ",")",")"),Ks=0,Li=0,Si=0,gx=1e3,Lo,$i,$o=0,is=0,wl=0,sa=typeof performance=="object"&&performance.now?performance:Date,px=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function nd(){return is||(px(Uj),is=sa.now()+wl)}function Uj(){is=0}function Do(){this._call=this._time=this._next=null}Do.prototype=mx.prototype={constructor:Do,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?nd():+r)+(t==null?0:+t),!this._next&&$i!==this&&($i?$i._next=this:Lo=this,$i=this),this._call=e,this._time=r,_u()},stop:function(){this._call&&(this._call=null,this._time=1/0,_u())}};function mx(e,t,r){var n=new Do;return n.restart(e,t,r),n}function Vj(){nd(),++Ks;for(var e=Lo,t;e;)(t=is-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ks}function xg(){is=($o=sa.now())+wl,Ks=Li=0;try{Vj()}finally{Ks=0,Yj(),is=0}}function Gj(){var e=sa.now(),t=e-$o;t>gx&&(wl-=t,$o=e)}function Yj(){for(var e,t=Lo,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Lo=r);$i=e,_u(n)}function _u(e){if(!Ks){Li&&(Li=clearTimeout(Li));var t=e-is;t>24?(e<1/0&&(Li=setTimeout(xg,e-sa.now()-wl)),Si&&(Si=clearInterval(Si))):(Si||($o=sa.now(),Si=setInterval(Gj,gx)),Ks=1,px(xg))}}function yg(e,t,r){var n=new Do;return t=t==null?0:+t,n.restart(s=>{n.stop(),e(s+t)},t,r),n}var Xj=X0("start","end","cancel","interrupt"),Kj=[],xx=0,bg=1,Tu=2,uo=3,kg=4,Nu=5,ho=6;function vl(e,t,r,n,s,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;Qj(e,r,{name:t,index:n,group:s,on:Xj,tween:Kj,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:xx})}function sd(e,t){var r=Mr(e,t);if(r.state>xx)throw new Error("too late; already scheduled");return r}function qr(e,t){var r=Mr(e,t);if(r.state>uo)throw new Error("too late; already running");return r}function Mr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Qj(e,t,r){var n=e.__transition,s;n[t]=r,r.timer=mx(i,0,r.time);function i(c){r.state=bg,r.timer.restart(a,r.delay,r.time),r.delay<=c&&a(c-r.delay)}function a(c){var u,h,f,g;if(r.state!==bg)return l();for(u in n)if(g=n[u],g.name===r.name){if(g.state===uo)return yg(a);g.state===kg?(g.state=ho,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete n[u]):+u<t&&(g.state=ho,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete n[u])}if(yg(function(){r.state===uo&&(r.state=kg,r.timer.restart(o,r.delay,r.time),o(c))}),r.state=Tu,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Tu){for(r.state=uo,s=new Array(f=r.tween.length),u=0,h=-1;u<f;++u)(g=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(s[++h]=g);s.length=h+1}}function o(c){for(var u=c<r.duration?r.ease.call(null,c/r.duration):(r.timer.restart(l),r.state=Nu,1),h=-1,f=s.length;++h<f;)s[h].call(e,u);r.state===Nu&&(r.on.call("end",e,e.__data__,r.index,r.group),l())}function l(){r.state=ho,r.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function Zj(e,t){var r=e.__transition,n,s,i=!0,a;if(r){t=t==null?null:t+"";for(a in r){if((n=r[a]).name!==t){i=!1;continue}s=n.state>Tu&&n.state<Nu,n.state=ho,n.timer.stop(),n.on.call(s?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[a]}i&&delete e.__transition}}function Jj(e){return this.each(function(){Zj(this,e)})}function eI(e,t){var r,n;return function(){var s=qr(this,e),i=s.tween;if(i!==r){n=r=i;for(var a=0,o=n.length;a<o;++a)if(n[a].name===t){n=n.slice(),n.splice(a,1);break}}s.tween=n}}function tI(e,t,r){var n,s;if(typeof r!="function")throw new Error;return function(){var i=qr(this,e),a=i.tween;if(a!==n){s=(n=a).slice();for(var o={name:t,value:r},l=0,c=s.length;l<c;++l)if(s[l].name===t){s[l]=o;break}l===c&&s.push(o)}i.tween=s}}function rI(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=Mr(this.node(),r).tween,s=0,i=n.length,a;s<i;++s)if((a=n[s]).name===e)return a.value;return null}return this.each((t==null?eI:tI)(r,e,t))}function id(e,t,r){var n=e._id;return e.each(function(){var s=qr(this,n);(s.value||(s.value={}))[t]=r.apply(this,arguments)}),function(s){return Mr(s,n).value[t]}}function yx(e,t){var r;return(typeof t=="number"?Cn:t instanceof na?pg:(r=na(t))?(t=r,pg):Oj)(e,t)}function nI(e){return function(){this.removeAttribute(e)}}function sI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function iI(e,t,r){var n,s=r+"",i;return function(){var a=this.getAttribute(e);return a===s?null:a===n?i:i=t(n=a,r)}}function aI(e,t,r){var n,s=r+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===s?null:a===n?i:i=t(n=a,r)}}function oI(e,t,r){var n,s,i;return function(){var a,o=r(this),l;return o==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=o+"",a===l?null:a===n&&l===s?i:(s=l,i=t(n=a,o)))}}function lI(e,t,r){var n,s,i;return function(){var a,o=r(this),l;return o==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=o+"",a===l?null:a===n&&l===s?i:(s=l,i=t(n=a,o)))}}function cI(e,t){var r=kl(e),n=r==="transform"?qj:yx;return this.attrTween(e,typeof t=="function"?(r.local?lI:oI)(r,n,id(this,"attr."+e,t)):t==null?(r.local?sI:nI)(r):(r.local?aI:iI)(r,n,t))}function uI(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function hI(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function dI(e,t){var r,n;function s(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&hI(e,i)),r}return s._value=t,s}function fI(e,t){var r,n;function s(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&uI(e,i)),r}return s._value=t,s}function gI(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=kl(e);return this.tween(r,(n.local?dI:fI)(n,t))}function pI(e,t){return function(){sd(this,e).delay=+t.apply(this,arguments)}}function mI(e,t){return t=+t,function(){sd(this,e).delay=t}}function xI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pI:mI)(t,e)):Mr(this.node(),t).delay}function yI(e,t){return function(){qr(this,e).duration=+t.apply(this,arguments)}}function bI(e,t){return t=+t,function(){qr(this,e).duration=t}}function kI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?yI:bI)(t,e)):Mr(this.node(),t).duration}function wI(e,t){if(typeof t!="function")throw new Error;return function(){qr(this,e).ease=t}}function vI(e){var t=this._id;return arguments.length?this.each(wI(t,e)):Mr(this.node(),t).ease}function CI(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;qr(this,e).ease=r}}function SI(e){if(typeof e!="function")throw new Error;return this.each(CI(this._id,e))}function _I(e){typeof e!="function"&&(e=Z0(e));for(var t=this._groups,r=t.length,n=new Array(r),s=0;s<r;++s)for(var i=t[s],a=i.length,o=n[s]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&o.push(l);return new sn(n,this._parents,this._name,this._id)}function TI(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,s=r.length,i=Math.min(n,s),a=new Array(n),o=0;o<i;++o)for(var l=t[o],c=r[o],u=l.length,h=a[o]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(h[g]=f);for(;o<n;++o)a[o]=t[o];return new sn(a,this._parents,this._name,this._id)}function NI(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function EI(e,t,r){var n,s,i=NI(t)?sd:qr;return function(){var a=i(this,e),o=a.on;o!==n&&(s=(n=o).copy()).on(t,r),a.on=s}}function AI(e,t){var r=this._id;return arguments.length<2?Mr(this.node(),r).on.on(e):this.each(EI(r,e,t))}function MI(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function jI(){return this.on("end.remove",MI(this._id))}function II(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Jh(e));for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a)for(var o=n[a],l=o.length,c=i[a]=new Array(l),u,h,f=0;f<l;++f)(u=o[f])&&(h=e.call(u,u.__data__,f,o))&&("__data__"in u&&(h.__data__=u.__data__),c[f]=h,vl(c[f],t,r,f,c,Mr(u,r)));return new sn(i,this._parents,t,r)}function LI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Q0(e));for(var n=this._groups,s=n.length,i=[],a=[],o=0;o<s;++o)for(var l=n[o],c=l.length,u,h=0;h<c;++h)if(u=l[h]){for(var f=e.call(u,u.__data__,h,l),g,p=Mr(u,r),m=0,y=f.length;m<y;++m)(g=f[m])&&vl(g,t,r,m,f,p);i.push(f),a.push(u)}return new sn(i,a,t,r)}var $I=ka.prototype.constructor;function DI(){return new $I(this._groups,this._parents)}function BI(e,t){var r,n,s;return function(){var i=Xs(this,e),a=(this.style.removeProperty(e),Xs(this,e));return i===a?null:i===r&&a===n?s:s=t(r=i,n=a)}}function bx(e){return function(){this.style.removeProperty(e)}}function RI(e,t,r){var n,s=r+"",i;return function(){var a=Xs(this,e);return a===s?null:a===n?i:i=t(n=a,r)}}function PI(e,t,r){var n,s,i;return function(){var a=Xs(this,e),o=r(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(e),Xs(this,e))),a===l?null:a===n&&l===s?i:(s=l,i=t(n=a,o))}}function FI(e,t){var r,n,s,i="style."+t,a="end."+i,o;return function(){var l=qr(this,e),c=l.on,u=l.value[i]==null?o||(o=bx(t)):void 0;(c!==r||s!==u)&&(n=(r=c).copy()).on(a,s=u),l.on=n}}function OI(e,t,r){var n=(e+="")=="transform"?Hj:yx;return t==null?this.styleTween(e,BI(e,n)).on("end.style."+e,bx(e)):typeof t=="function"?this.styleTween(e,PI(e,n,id(this,"style."+e,t))).each(FI(this._id,e)):this.styleTween(e,RI(e,n,t),r).on("end.style."+e,null)}function zI(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function WI(e,t,r){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&zI(e,a,r)),n}return i._value=t,i}function HI(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,WI(e,t,r??""))}function qI(e){return function(){this.textContent=e}}function UI(e){return function(){var t=e(this);this.textContent=t??""}}function VI(e){return this.tween("text",typeof e=="function"?UI(id(this,"text",e)):qI(e==null?"":e+""))}function GI(e){return function(t){this.textContent=e.call(this,t)}}function YI(e){var t,r;function n(){var s=e.apply(this,arguments);return s!==r&&(t=(r=s)&&GI(s)),t}return n._value=e,n}function XI(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,YI(e))}function KI(){for(var e=this._name,t=this._id,r=kx(),n=this._groups,s=n.length,i=0;i<s;++i)for(var a=n[i],o=a.length,l,c=0;c<o;++c)if(l=a[c]){var u=Mr(l,t);vl(l,e,r,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new sn(n,this._parents,e,r)}function QI(){var e,t,r=this,n=r._id,s=r.size();return new Promise(function(i,a){var o={value:a},l={value:function(){--s===0&&i()}};r.each(function(){var c=qr(this,n),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(o),t._.interrupt.push(o),t._.end.push(l)),c.on=t}),s===0&&i()})}var ZI=0;function sn(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function kx(){return++ZI}var Kr=ka.prototype;sn.prototype={constructor:sn,select:II,selectAll:LI,selectChild:Kr.selectChild,selectChildren:Kr.selectChildren,filter:_I,merge:TI,selection:DI,transition:KI,call:Kr.call,nodes:Kr.nodes,node:Kr.node,size:Kr.size,empty:Kr.empty,each:Kr.each,on:AI,attr:cI,attrTween:gI,style:OI,styleTween:HI,text:VI,textTween:XI,remove:jI,tween:rI,delay:xI,duration:kI,ease:vI,easeVarying:SI,end:QI,[Symbol.iterator]:Kr[Symbol.iterator]};function JI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var eL={time:null,delay:0,duration:250,ease:JI};function tL(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function rL(e){var t,r;e instanceof sn?(t=e._id,e=e._name):(t=kx(),(r=eL).time=nd(),e=e==null?null:e+"");for(var n=this._groups,s=n.length,i=0;i<s;++i)for(var a=n[i],o=a.length,l,c=0;c<o;++c)(l=a[c])&&vl(l,e,t,c,a,r||tL(l,t));return new sn(n,this._parents,e,t)}ka.prototype.interrupt=Jj;ka.prototype.transition=rL;const Eu=Math.PI,Au=2*Eu,Hn=1e-6,nL=Au-Hn;function wx(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function sL(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return wx;const r=10**t;return function(n){this._+=n[0];for(let s=1,i=n.length;s<i;++s)this._+=Math.round(arguments[s]*r)/r+n[s]}}class iL{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?wx:sL(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,s){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+s}`}bezierCurveTo(t,r,n,s,i,a){this._append`C${+t},${+r},${+n},${+s},${this._x1=+i},${this._y1=+a}`}arcTo(t,r,n,s,i){if(t=+t,r=+r,n=+n,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,l=n-t,c=s-r,u=a-t,h=o-r,f=u*u+h*h;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(f>Hn)if(!(Math.abs(h*l-c*u)>Hn)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let g=n-a,p=s-o,m=l*l+c*c,y=g*g+p*p,x=Math.sqrt(m),k=Math.sqrt(f),v=i*Math.tan((Eu-Math.acos((m+f-y)/(2*x*k)))/2),_=v/k,C=v/x;Math.abs(_-1)>Hn&&this._append`L${t+_*u},${r+_*h}`,this._append`A${i},${i},0,0,${+(h*g>u*p)},${this._x1=t+C*l},${this._y1=r+C*c}`}}arc(t,r,n,s,i,a){if(t=+t,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(s),l=n*Math.sin(s),c=t+o,u=r+l,h=1^a,f=a?s-i:i-s;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Hn||Math.abs(this._y1-u)>Hn)&&this._append`L${c},${u}`,n&&(f<0&&(f=f%Au+Au),f>nL?this._append`A${n},${n},0,1,${h},${t-o},${r-l}A${n},${n},0,1,${h},${this._x1=c},${this._y1=u}`:f>Hn&&this._append`A${n},${n},0,${+(f>=Eu)},${h},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+s}h${-n}Z`}toString(){return this._}}function Ts(e){return function(){return e}}const v9=Math.abs,C9=Math.atan2,S9=Math.cos,_9=Math.max,T9=Math.min,N9=Math.sin,E9=Math.sqrt,wg=1e-12,ad=Math.PI,vg=ad/2,A9=2*ad;function M9(e){return e>1?0:e<-1?ad:Math.acos(e)}function j9(e){return e>=1?vg:e<=-1?-vg:Math.asin(e)}function aL(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new iL(t)}function oL(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vx(e){this._context=e}vx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Bo(e){return new vx(e)}function lL(e){return e[0]}function cL(e){return e[1]}function uL(e,t){var r=Ts(!0),n=null,s=Bo,i=null,a=aL(o);e=typeof e=="function"?e:e===void 0?lL:Ts(e),t=typeof t=="function"?t:t===void 0?cL:Ts(t);function o(l){var c,u=(l=oL(l)).length,h,f=!1,g;for(n==null&&(i=s(g=a())),c=0;c<=u;++c)!(c<u&&r(h=l[c],c,l))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+e(h,c,l),+t(h,c,l));if(g)return i=null,g+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Ts(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Ts(+l),o):t},o.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Ts(!!l),o):r},o.curve=function(l){return arguments.length?(s=l,n!=null&&(i=s(n)),o):s},o.context=function(l){return arguments.length?(l==null?n=i=null:i=s(n=l),o):n},o}class Cx{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Sx(e){return new Cx(e,!0)}function _x(e){return new Cx(e,!1)}function Nn(){}function Ro(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Cl(e){this._context=e}Cl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ro(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ro(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fo(e){return new Cl(e)}function Tx(e){this._context=e}Tx.prototype={areaStart:Nn,areaEnd:Nn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ro(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function hL(e){return new Tx(e)}function Nx(e){this._context=e}Nx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ro(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function dL(e){return new Nx(e)}function Ex(e,t){this._basis=new Cl(e),this._beta=t}Ex.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],s=t[0],i=e[r]-n,a=t[r]-s,o=-1,l;++o<=r;)l=o/r,this._basis.point(this._beta*e[o]+(1-this._beta)*(n+l*i),this._beta*t[o]+(1-this._beta)*(s+l*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const fL=(function e(t){function r(n){return t===1?new Cl(n):new Ex(n,t)}return r.beta=function(n){return e(+n)},r})(.85);function Po(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function od(e,t){this._context=e,this._k=(1-t)/6}od.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Po(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Po(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Ax=(function e(t){function r(n){return new od(n,t)}return r.tension=function(n){return e(+n)},r})(0);function ld(e,t){this._context=e,this._k=(1-t)/6}ld.prototype={areaStart:Nn,areaEnd:Nn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Po(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const gL=(function e(t){function r(n){return new ld(n,t)}return r.tension=function(n){return e(+n)},r})(0);function cd(e,t){this._context=e,this._k=(1-t)/6}cd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Po(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const pL=(function e(t){function r(n){return new cd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function ud(e,t,r){var n=e._x1,s=e._y1,i=e._x2,a=e._y2;if(e._l01_a>wg){var o=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*o-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,s=(s*o-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>wg){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*c+e._x1*e._l23_2a-t*e._l12_2a)/u,a=(a*c+e._y1*e._l23_2a-r*e._l12_2a)/u}e._context.bezierCurveTo(n,s,i,a,e._x2,e._y2)}function Mx(e,t){this._context=e,this._alpha=t}Mx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:ud(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const jx=(function e(t){function r(n){return t?new Mx(n,t):new od(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function Ix(e,t){this._context=e,this._alpha=t}Ix.prototype={areaStart:Nn,areaEnd:Nn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:ud(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const mL=(function e(t){function r(n){return t?new Ix(n,t):new ld(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function Lx(e,t){this._context=e,this._alpha=t}Lx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ud(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const xL=(function e(t){function r(n){return t?new Lx(n,t):new cd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function $x(e){this._context=e}$x.prototype={areaStart:Nn,areaEnd:Nn,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function yL(e){return new $x(e)}function Cg(e){return e<0?-1:1}function Sg(e,t,r){var n=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(n||s<0&&-0),a=(r-e._y1)/(s||n<0&&-0),o=(i*s+a*n)/(n+s);return(Cg(i)+Cg(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(o))||0}function _g(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Lc(e,t,r){var n=e._x0,s=e._y0,i=e._x1,a=e._y1,o=(i-n)/3;e._context.bezierCurveTo(n+o,s+o*t,i-o,a-o*r,i,a)}function Fo(e){this._context=e}Fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Lc(this,this._t0,_g(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Lc(this,_g(this,r=Sg(this,e,t)),r);break;default:Lc(this,this._t0,r=Sg(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Dx(e){this._context=new Bx(e)}(Dx.prototype=Object.create(Fo.prototype)).point=function(e,t){Fo.prototype.point.call(this,t,e)};function Bx(e){this._context=e}Bx.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,s,i){this._context.bezierCurveTo(t,e,n,r,i,s)}};function Rx(e){return new Fo(e)}function Px(e){return new Dx(e)}function Fx(e){this._context=e}Fx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Tg(e),s=Tg(t),i=0,a=1;a<r;++i,++a)this._context.bezierCurveTo(n[0][i],s[0][i],n[1][i],s[1][i],e[a],t[a]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Tg(e){var t,r=e.length-1,n,s=new Array(r),i=new Array(r),a=new Array(r);for(s[0]=0,i[0]=2,a[0]=e[0]+2*e[1],t=1;t<r-1;++t)s[t]=1,i[t]=4,a[t]=4*e[t]+2*e[t+1];for(s[r-1]=2,i[r-1]=7,a[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=s[t]/i[t-1],i[t]-=n,a[t]-=n*a[t-1];for(s[r-1]=a[r-1]/i[r-1],t=r-2;t>=0;--t)s[t]=(a[t]-s[t+1])/i[t];for(i[r-1]=(e[r]+s[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-s[t+1];return[s,i]}function Ox(e){return new Fx(e)}function Sl(e,t){this._context=e,this._t=t}Sl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function zx(e){return new Sl(e,.5)}function Wx(e){return new Sl(e,0)}function Hx(e){return new Sl(e,1)}function Di(e,t,r){this.k=e,this.x=t,this.y=r}Di.prototype={constructor:Di,scale:function(e){return e===1?this:new Di(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Di(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Di.prototype;var bL=b(e=>{const{securityLevel:t}=qe();let r=Fe("body");if(t==="sandbox"){const i=Fe(`#i${e}`).node()?.contentDocument??document;r=Fe(i.body)}return r.select(`#${e}`)},"selectSvgElement");function hd(e){return typeof e>"u"||e===null}b(hd,"isNothing");function qx(e){return typeof e=="object"&&e!==null}b(qx,"isObject");function Ux(e){return Array.isArray(e)?e:hd(e)?[]:[e]}b(Ux,"toArray");function Vx(e,t){var r,n,s,i;if(t)for(i=Object.keys(t),r=0,n=i.length;r<n;r+=1)s=i[r],e[s]=t[s];return e}b(Vx,"extend");function Gx(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}b(Gx,"repeat");function Yx(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}b(Yx,"isNegativeZero");var kL=hd,wL=qx,vL=Ux,CL=Gx,SL=Yx,_L=Vx,kt={isNothing:kL,isObject:wL,toArray:vL,repeat:CL,isNegativeZero:SL,extend:_L};function dd(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
|
|
215
|
-
|
|
216
|
-
`+e.mark.snippet),n+" "+r):n}b(dd,"formatError");function Qs(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=dd(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}b(Qs,"YAMLException$1");Qs.prototype=Object.create(Error.prototype);Qs.prototype.constructor=Qs;Qs.prototype.toString=b(function(t){return this.name+": "+dd(this,t)},"toString");var tr=Qs;function go(e,t,r,n,s){var i="",a="",o=Math.floor(s/2)-1;return n-t>o&&(i=" ... ",t=n-o+i.length),r-n>o&&(a=" ...",r=n+o-a.length),{str:i+e.slice(t,r).replace(/\t/g,"→")+a,pos:n-t+i.length}}b(go,"getLine");function po(e,t){return kt.repeat(" ",t-e.length)+e}b(po,"padStart");function Xx(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],s=[],i,a=-1;i=r.exec(e.buffer);)s.push(i.index),n.push(i.index+i[0].length),e.position<=i.index&&a<0&&(a=n.length-2);a<0&&(a=n.length-1);var o="",l,c,u=Math.min(e.line+t.linesAfter,s.length).toString().length,h=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(a-l<0);l++)c=go(e.buffer,n[a-l],s[a-l],e.position-(n[a]-n[a-l]),h),o=kt.repeat(" ",t.indent)+po((e.line-l+1).toString(),u)+" | "+c.str+`
|
|
217
|
-
`+o;for(c=go(e.buffer,n[a],s[a],e.position,h),o+=kt.repeat(" ",t.indent)+po((e.line+1).toString(),u)+" | "+c.str+`
|
|
218
|
-
`,o+=kt.repeat("-",t.indent+u+3+c.pos)+`^
|
|
219
|
-
`,l=1;l<=t.linesAfter&&!(a+l>=s.length);l++)c=go(e.buffer,n[a+l],s[a+l],e.position-(n[a]-n[a+l]),h),o+=kt.repeat(" ",t.indent)+po((e.line+l+1).toString(),u)+" | "+c.str+`
|
|
220
|
-
`;return o.replace(/\n$/,"")}b(Xx,"makeSnippet");var TL=Xx,NL=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],EL=["scalar","sequence","mapping"];function Kx(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}b(Kx,"compileStyleAliases");function Qx(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(NL.indexOf(r)===-1)throw new tr('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Kx(t.styleAliases||null),EL.indexOf(this.kind)===-1)throw new tr('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}b(Qx,"Type$1");var Lt=Qx;function Mu(e,t){var r=[];return e[t].forEach(function(n){var s=r.length;r.forEach(function(i,a){i.tag===n.tag&&i.kind===n.kind&&i.multi===n.multi&&(s=a)}),r[s]=n}),r}b(Mu,"compileList");function Zx(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function n(s){s.multi?(e.multi[s.kind].push(s),e.multi.fallback.push(s)):e[s.kind][s.tag]=e.fallback[s.tag]=s}for(b(n,"collectType"),t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(n);return e}b(Zx,"compileMap");function Oo(e){return this.extend(e)}b(Oo,"Schema$1");Oo.prototype.extend=b(function(t){var r=[],n=[];if(t instanceof Lt)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new tr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(i){if(!(i instanceof Lt))throw new tr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new tr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new tr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(i){if(!(i instanceof Lt))throw new tr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Oo.prototype);return s.implicit=(this.implicit||[]).concat(r),s.explicit=(this.explicit||[]).concat(n),s.compiledImplicit=Mu(s,"implicit"),s.compiledExplicit=Mu(s,"explicit"),s.compiledTypeMap=Zx(s.compiledImplicit,s.compiledExplicit),s},"extend");var AL=Oo,ML=new Lt("tag:yaml.org,2002:str",{kind:"scalar",construct:b(function(e){return e!==null?e:""},"construct")}),jL=new Lt("tag:yaml.org,2002:seq",{kind:"sequence",construct:b(function(e){return e!==null?e:[]},"construct")}),IL=new Lt("tag:yaml.org,2002:map",{kind:"mapping",construct:b(function(e){return e!==null?e:{}},"construct")}),LL=new AL({explicit:[ML,jL,IL]});function Jx(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}b(Jx,"resolveYamlNull");function ey(){return null}b(ey,"constructYamlNull");function ty(e){return e===null}b(ty,"isNull");var $L=new Lt("tag:yaml.org,2002:null",{kind:"scalar",resolve:Jx,construct:ey,predicate:ty,represent:{canonical:b(function(){return"~"},"canonical"),lowercase:b(function(){return"null"},"lowercase"),uppercase:b(function(){return"NULL"},"uppercase"),camelcase:b(function(){return"Null"},"camelcase"),empty:b(function(){return""},"empty")},defaultStyle:"lowercase"});function ry(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}b(ry,"resolveYamlBoolean");function ny(e){return e==="true"||e==="True"||e==="TRUE"}b(ny,"constructYamlBoolean");function sy(e){return Object.prototype.toString.call(e)==="[object Boolean]"}b(sy,"isBoolean");var DL=new Lt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:ry,construct:ny,predicate:sy,represent:{lowercase:b(function(e){return e?"true":"false"},"lowercase"),uppercase:b(function(e){return e?"TRUE":"FALSE"},"uppercase"),camelcase:b(function(e){return e?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function iy(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}b(iy,"isHexCode");function ay(e){return 48<=e&&e<=55}b(ay,"isOctCode");function oy(e){return 48<=e&&e<=57}b(oy,"isDecCode");function ly(e){if(e===null)return!1;var t=e.length,r=0,n=!1,s;if(!t)return!1;if(s=e[r],(s==="-"||s==="+")&&(s=e[++r]),s==="0"){if(r+1===t)return!0;if(s=e[++r],s==="b"){for(r++;r<t;r++)if(s=e[r],s!=="_"){if(s!=="0"&&s!=="1")return!1;n=!0}return n&&s!=="_"}if(s==="x"){for(r++;r<t;r++)if(s=e[r],s!=="_"){if(!iy(e.charCodeAt(r)))return!1;n=!0}return n&&s!=="_"}if(s==="o"){for(r++;r<t;r++)if(s=e[r],s!=="_"){if(!ay(e.charCodeAt(r)))return!1;n=!0}return n&&s!=="_"}}if(s==="_")return!1;for(;r<t;r++)if(s=e[r],s!=="_"){if(!oy(e.charCodeAt(r)))return!1;n=!0}return!(!n||s==="_")}b(ly,"resolveYamlInteger");function cy(e){var t=e,r=1,n;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),n=t[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),t=t.slice(1),n=t[0]),t==="0")return 0;if(n==="0"){if(t[1]==="b")return r*parseInt(t.slice(2),2);if(t[1]==="x")return r*parseInt(t.slice(2),16);if(t[1]==="o")return r*parseInt(t.slice(2),8)}return r*parseInt(t,10)}b(cy,"constructYamlInteger");function uy(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!kt.isNegativeZero(e)}b(uy,"isInteger");var BL=new Lt("tag:yaml.org,2002:int",{kind:"scalar",resolve:ly,construct:cy,predicate:uy,represent:{binary:b(function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},"binary"),octal:b(function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},"octal"),decimal:b(function(e){return e.toString(10)},"decimal"),hexadecimal:b(function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),RL=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function hy(e){return!(e===null||!RL.test(e)||e[e.length-1]==="_")}b(hy,"resolveYamlFloat");function dy(e){var t,r;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}b(dy,"constructYamlFloat");var PL=/^[-+]?[0-9]+e/;function fy(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(kt.isNegativeZero(e))return"-0.0";return r=e.toString(10),PL.test(r)?r.replace("e",".e"):r}b(fy,"representYamlFloat");function gy(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||kt.isNegativeZero(e))}b(gy,"isFloat");var FL=new Lt("tag:yaml.org,2002:float",{kind:"scalar",resolve:hy,construct:dy,predicate:gy,represent:fy,defaultStyle:"lowercase"}),py=LL.extend({implicit:[$L,DL,BL,FL]}),OL=py,my=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),xy=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function yy(e){return e===null?!1:my.exec(e)!==null||xy.exec(e)!==null}b(yy,"resolveYamlTimestamp");function by(e){var t,r,n,s,i,a,o,l=0,c=null,u,h,f;if(t=my.exec(e),t===null&&(t=xy.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(r,n,s));if(i=+t[4],a=+t[5],o=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=+t[10],h=+(t[11]||0),c=(u*60+h)*6e4,t[9]==="-"&&(c=-c)),f=new Date(Date.UTC(r,n,s,i,a,o,l)),c&&f.setTime(f.getTime()-c),f}b(by,"constructYamlTimestamp");function ky(e){return e.toISOString()}b(ky,"representYamlTimestamp");var zL=new Lt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:yy,construct:by,instanceOf:Date,represent:ky});function wy(e){return e==="<<"||e===null}b(wy,"resolveYamlMerge");var WL=new Lt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:wy}),fd=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
221
|
-
\r`;function vy(e){if(e===null)return!1;var t,r,n=0,s=e.length,i=fd;for(r=0;r<s;r++)if(t=i.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}b(vy,"resolveYamlBinary");function Cy(e){var t,r,n=e.replace(/[\r\n=]/g,""),s=n.length,i=fd,a=0,o=[];for(t=0;t<s;t++)t%4===0&&t&&(o.push(a>>16&255),o.push(a>>8&255),o.push(a&255)),a=a<<6|i.indexOf(n.charAt(t));return r=s%4*6,r===0?(o.push(a>>16&255),o.push(a>>8&255),o.push(a&255)):r===18?(o.push(a>>10&255),o.push(a>>2&255)):r===12&&o.push(a>>4&255),new Uint8Array(o)}b(Cy,"constructYamlBinary");function Sy(e){var t="",r=0,n,s,i=e.length,a=fd;for(n=0;n<i;n++)n%3===0&&n&&(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]),r=(r<<8)+e[n];return s=i%3,s===0?(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]):s===2?(t+=a[r>>10&63],t+=a[r>>4&63],t+=a[r<<2&63],t+=a[64]):s===1&&(t+=a[r>>2&63],t+=a[r<<4&63],t+=a[64],t+=a[64]),t}b(Sy,"representYamlBinary");function _y(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}b(_y,"isBinary");var HL=new Lt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:vy,construct:Cy,predicate:_y,represent:Sy}),qL=Object.prototype.hasOwnProperty,UL=Object.prototype.toString;function Ty(e){if(e===null)return!0;var t=[],r,n,s,i,a,o=e;for(r=0,n=o.length;r<n;r+=1){if(s=o[r],a=!1,UL.call(s)!=="[object Object]")return!1;for(i in s)if(qL.call(s,i))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}b(Ty,"resolveYamlOmap");function Ny(e){return e!==null?e:[]}b(Ny,"constructYamlOmap");var VL=new Lt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Ty,construct:Ny}),GL=Object.prototype.toString;function Ey(e){if(e===null)return!0;var t,r,n,s,i,a=e;for(i=new Array(a.length),t=0,r=a.length;t<r;t+=1){if(n=a[t],GL.call(n)!=="[object Object]"||(s=Object.keys(n),s.length!==1))return!1;i[t]=[s[0],n[s[0]]]}return!0}b(Ey,"resolveYamlPairs");function Ay(e){if(e===null)return[];var t,r,n,s,i,a=e;for(i=new Array(a.length),t=0,r=a.length;t<r;t+=1)n=a[t],s=Object.keys(n),i[t]=[s[0],n[s[0]]];return i}b(Ay,"constructYamlPairs");var YL=new Lt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Ey,construct:Ay}),XL=Object.prototype.hasOwnProperty;function My(e){if(e===null)return!0;var t,r=e;for(t in r)if(XL.call(r,t)&&r[t]!==null)return!1;return!0}b(My,"resolveYamlSet");function jy(e){return e!==null?e:{}}b(jy,"constructYamlSet");var KL=new Lt("tag:yaml.org,2002:set",{kind:"mapping",resolve:My,construct:jy}),Iy=OL.extend({implicit:[zL,WL],explicit:[HL,VL,YL,KL]}),En=Object.prototype.hasOwnProperty,zo=1,Ly=2,$y=3,Wo=4,$c=1,QL=2,Ng=3,ZL=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,JL=/[\x85\u2028\u2029]/,e$=/[,\[\]\{\}]/,Dy=/^(?:!|!!|![a-z\-]+!)$/i,By=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ju(e){return Object.prototype.toString.call(e)}b(ju,"_class");function Er(e){return e===10||e===13}b(Er,"is_EOL");function Tn(e){return e===9||e===32}b(Tn,"is_WHITE_SPACE");function zt(e){return e===9||e===32||e===10||e===13}b(zt,"is_WS_OR_EOL");function Yn(e){return e===44||e===91||e===93||e===123||e===125}b(Yn,"is_FLOW_INDICATOR");function Ry(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}b(Ry,"fromHexCode");function Py(e){return e===120?2:e===117?4:e===85?8:0}b(Py,"escapedHexLen");function Fy(e){return 48<=e&&e<=57?e-48:-1}b(Fy,"fromDecimalCode");function Iu(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
222
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}b(Iu,"simpleEscapeSequence");function Oy(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}b(Oy,"charFromCodepoint");var zy=new Array(256),Wy=new Array(256);for(Wn=0;Wn<256;Wn++)zy[Wn]=Iu(Wn)?1:0,Wy[Wn]=Iu(Wn);var Wn;function Hy(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Iy,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}b(Hy,"State$1");function gd(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=TL(r),new tr(t,r)}b(gd,"generateError");function pe(e,t){throw gd(e,t)}b(pe,"throwError");function ia(e,t){e.onWarning&&e.onWarning.call(null,gd(e,t))}b(ia,"throwWarning");var Eg={YAML:b(function(t,r,n){var s,i,a;t.version!==null&&pe(t,"duplication of %YAML directive"),n.length!==1&&pe(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),s===null&&pe(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&pe(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&ia(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:b(function(t,r,n){var s,i;n.length!==2&&pe(t,"TAG directive accepts exactly two arguments"),s=n[0],i=n[1],Dy.test(s)||pe(t,"ill-formed tag handle (first argument) of the TAG directive"),En.call(t.tagMap,s)&&pe(t,'there is a previously declared suffix for "'+s+'" tag handle'),By.test(i)||pe(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{pe(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i},"handleTagDirective")};function nn(e,t,r,n){var s,i,a,o;if(t<r){if(o=e.input.slice(t,r),n)for(s=0,i=o.length;s<i;s+=1)a=o.charCodeAt(s),a===9||32<=a&&a<=1114111||pe(e,"expected valid JSON character");else ZL.test(o)&&pe(e,"the stream contains non-printable characters");e.result+=o}}b(nn,"captureSegment");function Lu(e,t,r,n){var s,i,a,o;for(kt.isObject(r)||pe(e,"cannot merge mappings; the provided source object is unacceptable"),s=Object.keys(r),a=0,o=s.length;a<o;a+=1)i=s[a],En.call(t,i)||(t[i]=r[i],n[i]=!0)}b(Lu,"mergeMappings");function Xn(e,t,r,n,s,i,a,o,l){var c,u;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),c=0,u=s.length;c<u;c+=1)Array.isArray(s[c])&&pe(e,"nested arrays are not supported inside keys"),typeof s=="object"&&ju(s[c])==="[object Object]"&&(s[c]="[object Object]");if(typeof s=="object"&&ju(s)==="[object Object]"&&(s="[object Object]"),s=String(s),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(i))for(c=0,u=i.length;c<u;c+=1)Lu(e,t,i[c],r);else Lu(e,t,i,r);else!e.json&&!En.call(r,s)&&En.call(t,s)&&(e.line=a||e.line,e.lineStart=o||e.lineStart,e.position=l||e.position,pe(e,"duplicated mapping key")),s==="__proto__"?Object.defineProperty(t,s,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[s]=i,delete r[s];return t}b(Xn,"storeMappingPair");function _l(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):pe(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}b(_l,"readLineBreak");function gt(e,t,r){for(var n=0,s=e.input.charCodeAt(e.position);s!==0;){for(;Tn(s);)s===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&s===35)do s=e.input.charCodeAt(++e.position);while(s!==10&&s!==13&&s!==0);if(Er(s))for(_l(e),s=e.input.charCodeAt(e.position),n++,e.lineIndent=0;s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);else break}return r!==-1&&n!==0&&e.lineIndent<r&&ia(e,"deficient indentation"),n}b(gt,"skipSeparationSpace");function va(e){var t=e.position,r;return r=e.input.charCodeAt(t),!!((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)&&(t+=3,r=e.input.charCodeAt(t),r===0||zt(r)))}b(va,"testDocumentSeparator");function Tl(e,t){t===1?e.result+=" ":t>1&&(e.result+=kt.repeat(`
|
|
223
|
-
`,t-1))}b(Tl,"writeFoldedLines");function qy(e,t,r){var n,s,i,a,o,l,c,u,h=e.kind,f=e.result,g;if(g=e.input.charCodeAt(e.position),zt(g)||Yn(g)||g===35||g===38||g===42||g===33||g===124||g===62||g===39||g===34||g===37||g===64||g===96||(g===63||g===45)&&(s=e.input.charCodeAt(e.position+1),zt(s)||r&&Yn(s)))return!1;for(e.kind="scalar",e.result="",i=a=e.position,o=!1;g!==0;){if(g===58){if(s=e.input.charCodeAt(e.position+1),zt(s)||r&&Yn(s))break}else if(g===35){if(n=e.input.charCodeAt(e.position-1),zt(n))break}else{if(e.position===e.lineStart&&va(e)||r&&Yn(g))break;if(Er(g))if(l=e.line,c=e.lineStart,u=e.lineIndent,gt(e,!1,-1),e.lineIndent>=t){o=!0,g=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=l,e.lineStart=c,e.lineIndent=u;break}}o&&(nn(e,i,a,!1),Tl(e,e.line-l),i=a=e.position,o=!1),Tn(g)||(a=e.position+1),g=e.input.charCodeAt(++e.position)}return nn(e,i,a,!1),e.result?!0:(e.kind=h,e.result=f,!1)}b(qy,"readPlainScalar");function Uy(e,t){var r,n,s;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=s=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(nn(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,s=e.position;else return!0;else Er(r)?(nn(e,n,s,!0),Tl(e,gt(e,!1,t)),n=s=e.position):e.position===e.lineStart&&va(e)?pe(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);pe(e,"unexpected end of the stream within a single quoted scalar")}b(Uy,"readSingleQuotedScalar");function Vy(e,t){var r,n,s,i,a,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return nn(e,r,e.position,!0),e.position++,!0;if(o===92){if(nn(e,r,e.position,!0),o=e.input.charCodeAt(++e.position),Er(o))gt(e,!1,t);else if(o<256&&zy[o])e.result+=Wy[o],e.position++;else if((a=Py(o))>0){for(s=a,i=0;s>0;s--)o=e.input.charCodeAt(++e.position),(a=Ry(o))>=0?i=(i<<4)+a:pe(e,"expected hexadecimal character");e.result+=Oy(i),e.position++}else pe(e,"unknown escape sequence");r=n=e.position}else Er(o)?(nn(e,r,n,!0),Tl(e,gt(e,!1,t)),r=n=e.position):e.position===e.lineStart&&va(e)?pe(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}pe(e,"unexpected end of the stream within a double quoted scalar")}b(Vy,"readDoubleQuotedScalar");function Gy(e,t){var r=!0,n,s,i,a=e.tag,o,l=e.anchor,c,u,h,f,g,p=Object.create(null),m,y,x,k;if(k=e.input.charCodeAt(e.position),k===91)u=93,g=!1,o=[];else if(k===123)u=125,g=!0,o={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),k=e.input.charCodeAt(++e.position);k!==0;){if(gt(e,!0,t),k=e.input.charCodeAt(e.position),k===u)return e.position++,e.tag=a,e.anchor=l,e.kind=g?"mapping":"sequence",e.result=o,!0;r?k===44&&pe(e,"expected the node content, but found ','"):pe(e,"missed comma between flow collection entries"),y=m=x=null,h=f=!1,k===63&&(c=e.input.charCodeAt(e.position+1),zt(c)&&(h=f=!0,e.position++,gt(e,!0,t))),n=e.line,s=e.lineStart,i=e.position,as(e,t,zo,!1,!0),y=e.tag,m=e.result,gt(e,!0,t),k=e.input.charCodeAt(e.position),(f||e.line===n)&&k===58&&(h=!0,k=e.input.charCodeAt(++e.position),gt(e,!0,t),as(e,t,zo,!1,!0),x=e.result),g?Xn(e,o,p,y,m,x,n,s,i):h?o.push(Xn(e,null,p,y,m,x,n,s,i)):o.push(m),gt(e,!0,t),k=e.input.charCodeAt(e.position),k===44?(r=!0,k=e.input.charCodeAt(++e.position)):r=!1}pe(e,"unexpected end of the stream within a flow collection")}b(Gy,"readFlowCollection");function Yy(e,t){var r,n,s=$c,i=!1,a=!1,o=t,l=0,c=!1,u,h;if(h=e.input.charCodeAt(e.position),h===124)n=!1;else if(h===62)n=!0;else return!1;for(e.kind="scalar",e.result="";h!==0;)if(h=e.input.charCodeAt(++e.position),h===43||h===45)$c===s?s=h===43?Ng:QL:pe(e,"repeat of a chomping mode identifier");else if((u=Fy(h))>=0)u===0?pe(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?pe(e,"repeat of an indentation width identifier"):(o=t+u-1,a=!0);else break;if(Tn(h)){do h=e.input.charCodeAt(++e.position);while(Tn(h));if(h===35)do h=e.input.charCodeAt(++e.position);while(!Er(h)&&h!==0)}for(;h!==0;){for(_l(e),e.lineIndent=0,h=e.input.charCodeAt(e.position);(!a||e.lineIndent<o)&&h===32;)e.lineIndent++,h=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>o&&(o=e.lineIndent),Er(h)){l++;continue}if(e.lineIndent<o){s===Ng?e.result+=kt.repeat(`
|
|
224
|
-
`,i?1+l:l):s===$c&&i&&(e.result+=`
|
|
225
|
-
`);break}for(n?Tn(h)?(c=!0,e.result+=kt.repeat(`
|
|
226
|
-
`,i?1+l:l)):c?(c=!1,e.result+=kt.repeat(`
|
|
227
|
-
`,l+1)):l===0?i&&(e.result+=" "):e.result+=kt.repeat(`
|
|
228
|
-
`,l):e.result+=kt.repeat(`
|
|
229
|
-
`,i?1+l:l),i=!0,a=!0,l=0,r=e.position;!Er(h)&&h!==0;)h=e.input.charCodeAt(++e.position);nn(e,r,e.position,!1)}return!0}b(Yy,"readBlockScalar");function $u(e,t){var r,n=e.tag,s=e.anchor,i=[],a,o=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,pe(e,"tab characters must not be used in indentation")),!(l!==45||(a=e.input.charCodeAt(e.position+1),!zt(a))));){if(o=!0,e.position++,gt(e,!0,-1)&&e.lineIndent<=t){i.push(null),l=e.input.charCodeAt(e.position);continue}if(r=e.line,as(e,t,$y,!1,!0),i.push(e.result),gt(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&l!==0)pe(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return o?(e.tag=n,e.anchor=s,e.kind="sequence",e.result=i,!0):!1}b($u,"readBlockSequence");function Xy(e,t,r){var n,s,i,a,o,l,c=e.tag,u=e.anchor,h={},f=Object.create(null),g=null,p=null,m=null,y=!1,x=!1,k;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=h),k=e.input.charCodeAt(e.position);k!==0;){if(!y&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,pe(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),i=e.line,(k===63||k===58)&&zt(n))k===63?(y&&(Xn(e,h,f,g,p,null,a,o,l),g=p=m=null),x=!0,y=!0,s=!0):y?(y=!1,s=!0):pe(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,k=n;else{if(a=e.line,o=e.lineStart,l=e.position,!as(e,r,Ly,!1,!0))break;if(e.line===i){for(k=e.input.charCodeAt(e.position);Tn(k);)k=e.input.charCodeAt(++e.position);if(k===58)k=e.input.charCodeAt(++e.position),zt(k)||pe(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(Xn(e,h,f,g,p,null,a,o,l),g=p=m=null),x=!0,y=!1,s=!1,g=e.tag,p=e.result;else if(x)pe(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=u,!0}else if(x)pe(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=u,!0}if((e.line===i||e.lineIndent>t)&&(y&&(a=e.line,o=e.lineStart,l=e.position),as(e,t,Wo,!0,s)&&(y?p=e.result:m=e.result),y||(Xn(e,h,f,g,p,m,a,o,l),g=p=m=null),gt(e,!0,-1),k=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&k!==0)pe(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&Xn(e,h,f,g,p,null,a,o,l),x&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=h),x}b(Xy,"readBlockMapping");function Ky(e){var t,r=!1,n=!1,s,i,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&pe(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(r=!0,a=e.input.charCodeAt(++e.position)):a===33?(n=!0,s="!!",a=e.input.charCodeAt(++e.position)):s="!",t=e.position,r){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(i=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):pe(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!zt(a);)a===33&&(n?pe(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),Dy.test(s)||pe(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),e$.test(i)&&pe(e,"tag suffix cannot contain flow indicator characters")}i&&!By.test(i)&&pe(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{pe(e,"tag name is malformed: "+i)}return r?e.tag=i:En.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:pe(e,'undeclared tag handle "'+s+'"'),!0}b(Ky,"readTagProperty");function Qy(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&pe(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!zt(r)&&!Yn(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&pe(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}b(Qy,"readAnchorProperty");function Zy(e){var t,r,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!zt(n)&&!Yn(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&pe(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),En.call(e.anchorMap,r)||pe(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],gt(e,!0,-1),!0}b(Zy,"readAlias");function as(e,t,r,n,s){var i,a,o,l=1,c=!1,u=!1,h,f,g,p,m,y;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=o=Wo===r||$y===r,n&>(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;Ky(e)||Qy(e);)gt(e,!0,-1)?(c=!0,o=i,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):o=!1;if(o&&(o=c||s),(l===1||Wo===r)&&(zo===r||Ly===r?m=t:m=t+1,y=e.position-e.lineStart,l===1?o&&($u(e,y)||Xy(e,y,m))||Gy(e,m)?u=!0:(a&&Yy(e,m)||Uy(e,m)||Vy(e,m)?u=!0:Zy(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&pe(e,"alias node should not have any properties")):qy(e,m,zo===r)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(u=o&&$u(e,y))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&pe(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),h=0,f=e.implicitTypes.length;h<f;h+=1)if(p=e.implicitTypes[h],p.resolve(e.result)){e.result=p.construct(e.result),e.tag=p.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(En.call(e.typeMap[e.kind||"fallback"],e.tag))p=e.typeMap[e.kind||"fallback"][e.tag];else for(p=null,g=e.typeMap.multi[e.kind||"fallback"],h=0,f=g.length;h<f;h+=1)if(e.tag.slice(0,g[h].tag.length)===g[h].tag){p=g[h];break}p||pe(e,"unknown tag !<"+e.tag+">"),e.result!==null&&p.kind!==e.kind&&pe(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):pe(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}b(as,"composeNode");function Jy(e){var t=e.position,r,n,s,i=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(gt(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(i=!0,a=e.input.charCodeAt(++e.position),r=e.position;a!==0&&!zt(a);)a=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),s=[],n.length<1&&pe(e,"directive name must not be less than one character in length");a!==0;){for(;Tn(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Er(a));break}if(Er(a))break;for(r=e.position;a!==0&&!zt(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(r,e.position))}a!==0&&_l(e),En.call(Eg,n)?Eg[n](e,n,s):ia(e,'unknown document directive "'+n+'"')}if(gt(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,gt(e,!0,-1)):i&&pe(e,"directives end mark is expected"),as(e,e.lineIndent-1,Wo,!1,!0),gt(e,!0,-1),e.checkLineBreaks&&JL.test(e.input.slice(t,e.position))&&ia(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&va(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,gt(e,!0,-1));return}if(e.position<e.length-1)pe(e,"end of the stream or a document separator is expected");else return}b(Jy,"readDocument");function pd(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
230
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new Hy(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,pe(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Jy(r);return r.documents}b(pd,"loadDocuments");function t$(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=pd(e,r);if(typeof t!="function")return n;for(var s=0,i=n.length;s<i;s+=1)t(n[s])}b(t$,"loadAll$1");function eb(e,t){var r=pd(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new tr("expected a single document in the stream, but found more")}}b(eb,"load$1");var r$=eb,n$={load:r$},tb=Object.prototype.toString,rb=Object.prototype.hasOwnProperty,md=65279,s$=9,aa=10,i$=13,a$=32,o$=33,l$=34,Du=35,c$=37,u$=38,h$=39,d$=42,nb=44,f$=45,Ho=58,g$=61,p$=62,m$=63,x$=64,sb=91,ib=93,y$=96,ab=123,b$=124,ob=125,Bt={};Bt[0]="\\0";Bt[7]="\\a";Bt[8]="\\b";Bt[9]="\\t";Bt[10]="\\n";Bt[11]="\\v";Bt[12]="\\f";Bt[13]="\\r";Bt[27]="\\e";Bt[34]='\\"';Bt[92]="\\\\";Bt[133]="\\N";Bt[160]="\\_";Bt[8232]="\\L";Bt[8233]="\\P";var k$=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],w$=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function lb(e,t){var r,n,s,i,a,o,l;if(t===null)return{};for(r={},n=Object.keys(t),s=0,i=n.length;s<i;s+=1)a=n[s],o=String(t[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),l=e.compiledTypeMap.fallback[a],l&&rb.call(l.styleAliases,o)&&(o=l.styleAliases[o]),r[a]=o;return r}b(lb,"compileStyleMap");function cb(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else if(e<=4294967295)r="U",n=8;else throw new tr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+kt.repeat("0",n-t.length)+t}b(cb,"encodeHex");var v$=1,oa=2;function ub(e){this.schema=e.schema||Iy,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=kt.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=lb(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?oa:v$,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}b(ub,"State");function Bu(e,t){for(var r=kt.repeat(" ",t),n=0,s=-1,i="",a,o=e.length;n<o;)s=e.indexOf(`
|
|
231
|
-
`,n),s===-1?(a=e.slice(n),n=o):(a=e.slice(n,s+1),n=s+1),a.length&&a!==`
|
|
232
|
-
`&&(i+=r),i+=a;return i}b(Bu,"indentString");function qo(e,t){return`
|
|
233
|
-
`+kt.repeat(" ",e.indent*t)}b(qo,"generateNextLine");function hb(e,t){var r,n,s;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(s=e.implicitTypes[r],s.resolve(t))return!0;return!1}b(hb,"testImplicitResolving");function la(e){return e===a$||e===s$}b(la,"isWhitespace");function Zs(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==md||65536<=e&&e<=1114111}b(Zs,"isPrintable");function Ru(e){return Zs(e)&&e!==md&&e!==i$&&e!==aa}b(Ru,"isNsCharOrWhitespace");function Pu(e,t,r){var n=Ru(e),s=n&&!la(e);return(r?n:n&&e!==nb&&e!==sb&&e!==ib&&e!==ab&&e!==ob)&&e!==Du&&!(t===Ho&&!s)||Ru(t)&&!la(t)&&e===Du||t===Ho&&s}b(Pu,"isPlainSafe");function db(e){return Zs(e)&&e!==md&&!la(e)&&e!==f$&&e!==m$&&e!==Ho&&e!==nb&&e!==sb&&e!==ib&&e!==ab&&e!==ob&&e!==Du&&e!==u$&&e!==d$&&e!==o$&&e!==b$&&e!==g$&&e!==p$&&e!==h$&&e!==l$&&e!==c$&&e!==x$&&e!==y$}b(db,"isPlainSafeFirst");function fb(e){return!la(e)&&e!==Ho}b(fb,"isPlainSafeLast");function js(e,t){var r=e.charCodeAt(t),n;return r>=55296&&r<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}b(js,"codePointAt");function xd(e){var t=/^\n* /;return t.test(e)}b(xd,"needIndentIndicator");var gb=1,Fu=2,pb=3,mb=4,As=5;function xb(e,t,r,n,s,i,a,o){var l,c=0,u=null,h=!1,f=!1,g=n!==-1,p=-1,m=db(js(e,0))&&fb(js(e,e.length-1));if(t||a)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=js(e,l),!Zs(c))return As;m=m&&Pu(c,u,o),u=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=js(e,l),c===aa)h=!0,g&&(f=f||l-p-1>n&&e[p+1]!==" ",p=l);else if(!Zs(c))return As;m=m&&Pu(c,u,o),u=c}f=f||g&&l-p-1>n&&e[p+1]!==" "}return!h&&!f?m&&!a&&!s(e)?gb:i===oa?As:Fu:r>9&&xd(e)?As:a?i===oa?As:Fu:f?mb:pb}b(xb,"chooseScalarStyle");function yb(e,t,r,n,s){e.dump=(function(){if(t.length===0)return e.quotingType===oa?'""':"''";if(!e.noCompatMode&&(k$.indexOf(t)!==-1||w$.test(t)))return e.quotingType===oa?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),o=n||e.flowLevel>-1&&r>=e.flowLevel;function l(c){return hb(e,c)}switch(b(l,"testAmbiguity"),xb(t,o,e.indent,a,l,e.quotingType,e.forceQuotes&&!n,s)){case gb:return t;case Fu:return"'"+t.replace(/'/g,"''")+"'";case pb:return"|"+Ou(t,e.indent)+zu(Bu(t,i));case mb:return">"+Ou(t,e.indent)+zu(Bu(bb(t,a),i));case As:return'"'+kb(t)+'"';default:throw new tr("impossible error: invalid scalar style")}})()}b(yb,"writeScalar");function Ou(e,t){var r=xd(e)?String(t):"",n=e[e.length-1]===`
|
|
234
|
-
`,s=n&&(e[e.length-2]===`
|
|
235
|
-
`||e===`
|
|
236
|
-
`),i=s?"+":n?"":"-";return r+i+`
|
|
237
|
-
`}b(Ou,"blockHeader");function zu(e){return e[e.length-1]===`
|
|
238
|
-
`?e.slice(0,-1):e}b(zu,"dropEndingNewline");function bb(e,t){for(var r=/(\n+)([^\n]*)/g,n=(function(){var c=e.indexOf(`
|
|
239
|
-
`);return c=c!==-1?c:e.length,r.lastIndex=c,Wu(e.slice(0,c),t)})(),s=e[0]===`
|
|
240
|
-
`||e[0]===" ",i,a;a=r.exec(e);){var o=a[1],l=a[2];i=l[0]===" ",n+=o+(!s&&!i&&l!==""?`
|
|
241
|
-
`:"")+Wu(l,t),s=i}return n}b(bb,"foldString");function Wu(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,s=0,i,a=0,o=0,l="";n=r.exec(e);)o=n.index,o-s>t&&(i=a>s?a:o,l+=`
|
|
242
|
-
`+e.slice(s,i),s=i+1),a=o;return l+=`
|
|
243
|
-
`,e.length-s>t&&a>s?l+=e.slice(s,a)+`
|
|
244
|
-
`+e.slice(a+1):l+=e.slice(s),l.slice(1)}b(Wu,"foldLine");function kb(e){for(var t="",r=0,n,s=0;s<e.length;r>=65536?s+=2:s++)r=js(e,s),n=Bt[r],!n&&Zs(r)?(t+=e[s],r>=65536&&(t+=e[s+1])):t+=n||cb(r);return t}b(kb,"escapeString");function wb(e,t,r){var n="",s=e.tag,i,a,o;for(i=0,a=r.length;i<a;i+=1)o=r[i],e.replacer&&(o=e.replacer.call(r,String(i),o)),(Wr(e,t,o,!1,!1)||typeof o>"u"&&Wr(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=s,e.dump="["+n+"]"}b(wb,"writeFlowSequence");function Hu(e,t,r,n){var s="",i=e.tag,a,o,l;for(a=0,o=r.length;a<o;a+=1)l=r[a],e.replacer&&(l=e.replacer.call(r,String(a),l)),(Wr(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&Wr(e,t+1,null,!0,!0,!1,!0))&&((!n||s!=="")&&(s+=qo(e,t)),e.dump&&aa===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}b(Hu,"writeBlockSequence");function vb(e,t,r){var n="",s=e.tag,i=Object.keys(r),a,o,l,c,u;for(a=0,o=i.length;a<o;a+=1)u="",n!==""&&(u+=", "),e.condenseFlow&&(u+='"'),l=i[a],c=r[l],e.replacer&&(c=e.replacer.call(r,l,c)),Wr(e,t,l,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Wr(e,t,c,!1,!1)&&(u+=e.dump,n+=u));e.tag=s,e.dump="{"+n+"}"}b(vb,"writeFlowMapping");function Cb(e,t,r,n){var s="",i=e.tag,a=Object.keys(r),o,l,c,u,h,f;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new tr("sortKeys must be a boolean or a function");for(o=0,l=a.length;o<l;o+=1)f="",(!n||s!=="")&&(f+=qo(e,t)),c=a[o],u=r[c],e.replacer&&(u=e.replacer.call(r,c,u)),Wr(e,t+1,c,!0,!0,!0)&&(h=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,h&&(e.dump&&aa===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,h&&(f+=qo(e,t)),Wr(e,t+1,u,!0,h)&&(e.dump&&aa===e.dump.charCodeAt(0)?f+=":":f+=": ",f+=e.dump,s+=f));e.tag=i,e.dump=s||"{}"}b(Cb,"writeBlockMapping");function qu(e,t,r){var n,s,i,a,o,l;for(s=r?e.explicitTypes:e.implicitTypes,i=0,a=s.length;i<a;i+=1)if(o=s[i],(o.instanceOf||o.predicate)&&(!o.instanceOf||typeof t=="object"&&t instanceof o.instanceOf)&&(!o.predicate||o.predicate(t))){if(r?o.multi&&o.representName?e.tag=o.representName(t):e.tag=o.tag:e.tag="?",o.represent){if(l=e.styleMap[o.tag]||o.defaultStyle,tb.call(o.represent)==="[object Function]")n=o.represent(t,l);else if(rb.call(o.represent,l))n=o.represent[l](t,l);else throw new tr("!<"+o.tag+'> tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}b(qu,"detectType");function Wr(e,t,r,n,s,i,a){e.tag=null,e.dump=r,qu(e,r,!1)||qu(e,r,!0);var o=tb.call(e.dump),l=n,c;n&&(n=e.flowLevel<0||e.flowLevel>t);var u=o==="[object Object]"||o==="[object Array]",h,f;if(u&&(h=e.duplicates.indexOf(r),f=h!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(s=!1),f&&e.usedDuplicates[h])e.dump="*ref_"+h;else{if(u&&f&&!e.usedDuplicates[h]&&(e.usedDuplicates[h]=!0),o==="[object Object]")n&&Object.keys(e.dump).length!==0?(Cb(e,t,e.dump,s),f&&(e.dump="&ref_"+h+e.dump)):(vb(e,t,e.dump),f&&(e.dump="&ref_"+h+" "+e.dump));else if(o==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?Hu(e,t-1,e.dump,s):Hu(e,t,e.dump,s),f&&(e.dump="&ref_"+h+e.dump)):(wb(e,t,e.dump),f&&(e.dump="&ref_"+h+" "+e.dump));else if(o==="[object String]")e.tag!=="?"&&yb(e,e.dump,t,i,l);else{if(o==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new tr("unacceptable kind of an object to dump "+o)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}b(Wr,"writeNode");function Sb(e,t){var r=[],n=[],s,i;for(Uo(e,r,n),s=0,i=n.length;s<i;s+=1)t.duplicates.push(r[n[s]]);t.usedDuplicates=new Array(i)}b(Sb,"getDuplicateReferences");function Uo(e,t,r){var n,s,i;if(e!==null&&typeof e=="object")if(s=t.indexOf(e),s!==-1)r.indexOf(s)===-1&&r.push(s);else if(t.push(e),Array.isArray(e))for(s=0,i=e.length;s<i;s+=1)Uo(e[s],t,r);else for(n=Object.keys(e),s=0,i=n.length;s<i;s+=1)Uo(e[n[s]],t,r)}b(Uo,"inspectNode");function C$(e,t){t=t||{};var r=new ub(t);r.noRefs||Sb(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Wr(r,0,n,!0,!0)?r.dump+`
|
|
245
|
-
`:""}b(C$,"dump$1");function S$(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}b(S$,"renamed");var _$=py,T$=n$.load;/*! Bundled license information:
|
|
246
|
-
|
|
247
|
-
js-yaml/dist/js-yaml.mjs:
|
|
248
|
-
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
|
|
249
|
-
*/var Mt={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4},Ag={arrow_point:9,arrow_cross:12.5,arrow_circle:12.5};function Bi(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=at(e),t=at(t);const[r,n]=[e.x,e.y],[s,i]=[t.x,t.y],a=s-r,o=i-n;return{angle:Math.atan(o/a),deltaX:a,deltaY:o}}b(Bi,"calculateDeltaAndAngle");var at=b(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),N$=b(e=>({x:b(function(t,r,n){let s=0;const i=at(n[0]).x<at(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(Mt,e.arrowTypeStart)){const{angle:g,deltaX:p}=Bi(n[0],n[1]);s=Mt[e.arrowTypeStart]*Math.cos(g)*(p>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Mt,e.arrowTypeEnd)){const{angle:g,deltaX:p}=Bi(n[n.length-1],n[n.length-2]);s=Mt[e.arrowTypeEnd]*Math.cos(g)*(p>=0?1:-1)}const a=Math.abs(at(t).x-at(n[n.length-1]).x),o=Math.abs(at(t).y-at(n[n.length-1]).y),l=Math.abs(at(t).x-at(n[0]).x),c=Math.abs(at(t).y-at(n[0]).y),u=Mt[e.arrowTypeStart],h=Mt[e.arrowTypeEnd],f=1;if(a<h&&a>0&&o<h){let g=h+f-a;g*=i==="right"?-1:1,s-=g}if(l<u&&l>0&&c<u){let g=u+f-l;g*=i==="right"?-1:1,s+=g}return at(t).x+s},"x"),y:b(function(t,r,n){let s=0;const i=at(n[0]).y<at(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(Mt,e.arrowTypeStart)){const{angle:g,deltaY:p}=Bi(n[0],n[1]);s=Mt[e.arrowTypeStart]*Math.abs(Math.sin(g))*(p>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Mt,e.arrowTypeEnd)){const{angle:g,deltaY:p}=Bi(n[n.length-1],n[n.length-2]);s=Mt[e.arrowTypeEnd]*Math.abs(Math.sin(g))*(p>=0?1:-1)}const a=Math.abs(at(t).y-at(n[n.length-1]).y),o=Math.abs(at(t).x-at(n[n.length-1]).x),l=Math.abs(at(t).y-at(n[0]).y),c=Math.abs(at(t).x-at(n[0]).x),u=Mt[e.arrowTypeStart],h=Mt[e.arrowTypeEnd],f=1;if(a<h&&a>0&&o<h){let g=h+f-a;g*=i==="up"?-1:1,s-=g}if(l<u&&l>0&&c<u){let g=u+f-l;g*=i==="up"?-1:1,s+=g}return at(t).y+s},"y")}),"getLineFunctionsWithOffset"),yd=b(({flowchart:e})=>{const t=e?.subGraphTitleMargin?.top??0,r=e?.subGraphTitleMargin?.bottom??0,n=t+r;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins"),E$=b(e=>{const{handDrawnSeed:t}=qe();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),si=b(e=>{const t=A$([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),A$=b(e=>{const t=new Map;return e.forEach(r=>{const[n,s]=r.split(":");t.set(n.trim(),s?.trim())}),t},"styles2Map"),_b=b(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),de=b(e=>{const{stylesArray:t}=si(e),r=[],n=[],s=[],i=[];return t.forEach(a=>{const o=a[0];_b(o)?r.push(a.join(":")+" !important"):(n.push(a.join(":")+" !important"),o.includes("stroke")&&s.push(a.join(":")+" !important"),o==="fill"&&i.push(a.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:t,borderStyles:s,backgroundStyles:i}},"styles2String"),he=b((e,t)=>{const{themeVariables:r,handDrawnSeed:n}=qe(),{nodeBorder:s,mainBkg:i}=r,{stylesMap:a}=si(e);return Object.assign({roughness:.7,fill:a.get("fill")||i,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:a.get("stroke")||s,seed:n,strokeWidth:a.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:M$(a.get("stroke-dasharray"))},t)},"userNodeOverrides"),M$=b(e=>{if(!e)return[0,0];const t=e.trim().split(/\s+/).map(Number);if(t.length===1){const s=isNaN(t[0])?0:t[0];return[s,s]}const r=isNaN(t[0])?0:t[0],n=isNaN(t[1])?0:t[1];return[r,n]},"getStrokeDashArray"),_i={},yt={},Mg;function j$(){return Mg||(Mg=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.BLANK_URL=yt.relativeFirstCharacters=yt.whitespaceEscapeCharsRegex=yt.urlSchemeRegex=yt.ctrlCharactersRegex=yt.htmlCtrlEntityRegex=yt.htmlEntitiesRegex=yt.invalidProtocolRegex=void 0,yt.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,yt.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,yt.htmlCtrlEntityRegex=/&(newline|tab);/gi,yt.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,yt.urlSchemeRegex=/^.+(:|:)/gim,yt.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,yt.relativeFirstCharacters=[".","/"],yt.BLANK_URL="about:blank"),yt}var jg;function I$(){if(jg)return _i;jg=1,Object.defineProperty(_i,"__esModule",{value:!0}),_i.sanitizeUrl=void 0;var e=j$();function t(a){return e.relativeFirstCharacters.indexOf(a[0])>-1}function r(a){var o=a.replace(e.ctrlCharactersRegex,"");return o.replace(e.htmlEntitiesRegex,function(l,c){return String.fromCharCode(c)})}function n(a){return URL.canParse(a)}function s(a){try{return decodeURIComponent(a)}catch{return a}}function i(a){if(!a)return e.BLANK_URL;var o,l=s(a.trim());do l=r(l).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),l=s(l),o=l.match(e.ctrlCharactersRegex)||l.match(e.htmlEntitiesRegex)||l.match(e.htmlCtrlEntityRegex)||l.match(e.whitespaceEscapeCharsRegex);while(o&&o.length>0);var c=l;if(!c)return e.BLANK_URL;if(t(c))return c;var u=c.trimStart(),h=u.match(e.urlSchemeRegex);if(!h)return c;var f=h[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(f))return e.BLANK_URL;var g=u.replace(/\\/g,"/");if(f==="mailto:"||f.includes("://"))return g;if(f==="http:"||f==="https:"){if(!n(g))return e.BLANK_URL;var p=new URL(g);return p.protocol=p.protocol.toLowerCase(),p.hostname=p.hostname.toLowerCase(),p.toString()}return g}return _i.sanitizeUrl=i,_i}var L$=I$(),Tb=typeof global=="object"&&global&&global.Object===Object&&global,$$=typeof self=="object"&&self&&self.Object===Object&&self,Ur=Tb||$$||Function("return this")(),Vo=Ur.Symbol,Nb=Object.prototype,D$=Nb.hasOwnProperty,B$=Nb.toString,Ti=Vo?Vo.toStringTag:void 0;function R$(e){var t=D$.call(e,Ti),r=e[Ti];try{e[Ti]=void 0;var n=!0}catch{}var s=B$.call(e);return n&&(t?e[Ti]=r:delete e[Ti]),s}var P$=Object.prototype,F$=P$.toString;function O$(e){return F$.call(e)}var z$="[object Null]",W$="[object Undefined]",Ig=Vo?Vo.toStringTag:void 0;function ii(e){return e==null?e===void 0?W$:z$:Ig&&Ig in Object(e)?R$(e):O$(e)}function hs(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var H$="[object AsyncFunction]",q$="[object Function]",U$="[object GeneratorFunction]",V$="[object Proxy]";function bd(e){if(!hs(e))return!1;var t=ii(e);return t==q$||t==U$||t==H$||t==V$}var Dc=Ur["__core-js_shared__"],Lg=(function(){var e=/[^.]+$/.exec(Dc&&Dc.keys&&Dc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function G$(e){return!!Lg&&Lg in e}var Y$=Function.prototype,X$=Y$.toString;function ds(e){if(e!=null){try{return X$.call(e)}catch{}try{return e+""}catch{}}return""}var K$=/[\\^$.*+?()[\]{}|]/g,Q$=/^\[object .+?Constructor\]$/,Z$=Function.prototype,J$=Object.prototype,e4=Z$.toString,t4=J$.hasOwnProperty,r4=RegExp("^"+e4.call(t4).replace(K$,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function n4(e){if(!hs(e)||G$(e))return!1;var t=bd(e)?r4:Q$;return t.test(ds(e))}function s4(e,t){return e?.[t]}function fs(e,t){var r=s4(e,t);return n4(r)?r:void 0}var ca=fs(Object,"create");function i4(){this.__data__=ca?ca(null):{},this.size=0}function a4(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var o4="__lodash_hash_undefined__",l4=Object.prototype,c4=l4.hasOwnProperty;function u4(e){var t=this.__data__;if(ca){var r=t[e];return r===o4?void 0:r}return c4.call(t,e)?t[e]:void 0}var h4=Object.prototype,d4=h4.hasOwnProperty;function f4(e){var t=this.__data__;return ca?t[e]!==void 0:d4.call(t,e)}var g4="__lodash_hash_undefined__";function p4(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ca&&t===void 0?g4:t,this}function os(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}os.prototype.clear=i4;os.prototype.delete=a4;os.prototype.get=u4;os.prototype.has=f4;os.prototype.set=p4;function m4(){this.__data__=[],this.size=0}function Nl(e,t){return e===t||e!==e&&t!==t}function El(e,t){for(var r=e.length;r--;)if(Nl(e[r][0],t))return r;return-1}var x4=Array.prototype,y4=x4.splice;function b4(e){var t=this.__data__,r=El(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():y4.call(t,r,1),--this.size,!0}function k4(e){var t=this.__data__,r=El(t,e);return r<0?void 0:t[r][1]}function w4(e){return El(this.__data__,e)>-1}function v4(e,t){var r=this.__data__,n=El(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function cn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}cn.prototype.clear=m4;cn.prototype.delete=b4;cn.prototype.get=k4;cn.prototype.has=w4;cn.prototype.set=v4;var ua=fs(Ur,"Map");function C4(){this.size=0,this.__data__={hash:new os,map:new(ua||cn),string:new os}}function S4(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Al(e,t){var r=e.__data__;return S4(t)?r[typeof t=="string"?"string":"hash"]:r.map}function _4(e){var t=Al(this,e).delete(e);return this.size-=t?1:0,t}function T4(e){return Al(this,e).get(e)}function N4(e){return Al(this,e).has(e)}function E4(e,t){var r=Al(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function In(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}In.prototype.clear=C4;In.prototype.delete=_4;In.prototype.get=T4;In.prototype.has=N4;In.prototype.set=E4;var A4="Expected a function";function Ca(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(A4);var r=function(){var n=arguments,s=t?t.apply(this,n):n[0],i=r.cache;if(i.has(s))return i.get(s);var a=e.apply(this,n);return r.cache=i.set(s,a)||i,a};return r.cache=new(Ca.Cache||In),r}Ca.Cache=In;function M4(){this.__data__=new cn,this.size=0}function j4(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function I4(e){return this.__data__.get(e)}function L4(e){return this.__data__.has(e)}var $4=200;function D4(e,t){var r=this.__data__;if(r instanceof cn){var n=r.__data__;if(!ua||n.length<$4-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new In(n)}return r.set(e,t),this.size=r.size,this}function ai(e){var t=this.__data__=new cn(e);this.size=t.size}ai.prototype.clear=M4;ai.prototype.delete=j4;ai.prototype.get=I4;ai.prototype.has=L4;ai.prototype.set=D4;var Go=(function(){try{var e=fs(Object,"defineProperty");return e({},"",{}),e}catch{}})();function kd(e,t,r){t=="__proto__"&&Go?Go(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Uu(e,t,r){(r!==void 0&&!Nl(e[t],r)||r===void 0&&!(t in e))&&kd(e,t,r)}function B4(e){return function(t,r,n){for(var s=-1,i=Object(t),a=n(t),o=a.length;o--;){var l=a[++s];if(r(i[l],l,i)===!1)break}return t}}var R4=B4(),Eb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$g=Eb&&typeof module=="object"&&module&&!module.nodeType&&module,P4=$g&&$g.exports===Eb,Dg=P4?Ur.Buffer:void 0,Bg=Dg?Dg.allocUnsafe:void 0;function F4(e,t){if(t)return e.slice();var r=e.length,n=Bg?Bg(r):new e.constructor(r);return e.copy(n),n}var Rg=Ur.Uint8Array;function O4(e){var t=new e.constructor(e.byteLength);return new Rg(t).set(new Rg(e)),t}function z4(e,t){var r=t?O4(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function W4(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Pg=Object.create,H4=(function(){function e(){}return function(t){if(!hs(t))return{};if(Pg)return Pg(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();function Ab(e,t){return function(r){return e(t(r))}}var Mb=Ab(Object.getPrototypeOf,Object),q4=Object.prototype;function Ml(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||q4;return e===r}function U4(e){return typeof e.constructor=="function"&&!Ml(e)?H4(Mb(e)):{}}function Sa(e){return e!=null&&typeof e=="object"}var V4="[object Arguments]";function Fg(e){return Sa(e)&&ii(e)==V4}var jb=Object.prototype,G4=jb.hasOwnProperty,Y4=jb.propertyIsEnumerable,Yo=Fg((function(){return arguments})())?Fg:function(e){return Sa(e)&&G4.call(e,"callee")&&!Y4.call(e,"callee")},Xo=Array.isArray,X4=9007199254740991;function Ib(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=X4}function jl(e){return e!=null&&Ib(e.length)&&!bd(e)}function K4(e){return Sa(e)&&jl(e)}function Q4(){return!1}var Lb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Og=Lb&&typeof module=="object"&&module&&!module.nodeType&&module,Z4=Og&&Og.exports===Lb,zg=Z4?Ur.Buffer:void 0,J4=zg?zg.isBuffer:void 0,wd=J4||Q4,e5="[object Object]",t5=Function.prototype,r5=Object.prototype,$b=t5.toString,n5=r5.hasOwnProperty,s5=$b.call(Object);function i5(e){if(!Sa(e)||ii(e)!=e5)return!1;var t=Mb(e);if(t===null)return!0;var r=n5.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&$b.call(r)==s5}var a5="[object Arguments]",o5="[object Array]",l5="[object Boolean]",c5="[object Date]",u5="[object Error]",h5="[object Function]",d5="[object Map]",f5="[object Number]",g5="[object Object]",p5="[object RegExp]",m5="[object Set]",x5="[object String]",y5="[object WeakMap]",b5="[object ArrayBuffer]",k5="[object DataView]",w5="[object Float32Array]",v5="[object Float64Array]",C5="[object Int8Array]",S5="[object Int16Array]",_5="[object Int32Array]",T5="[object Uint8Array]",N5="[object Uint8ClampedArray]",E5="[object Uint16Array]",A5="[object Uint32Array]",rt={};rt[w5]=rt[v5]=rt[C5]=rt[S5]=rt[_5]=rt[T5]=rt[N5]=rt[E5]=rt[A5]=!0;rt[a5]=rt[o5]=rt[b5]=rt[l5]=rt[k5]=rt[c5]=rt[u5]=rt[h5]=rt[d5]=rt[f5]=rt[g5]=rt[p5]=rt[m5]=rt[x5]=rt[y5]=!1;function M5(e){return Sa(e)&&Ib(e.length)&&!!rt[ii(e)]}function j5(e){return function(t){return e(t)}}var Db=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ki=Db&&typeof module=="object"&&module&&!module.nodeType&&module,I5=Ki&&Ki.exports===Db,Bc=I5&&Tb.process,Wg=(function(){try{var e=Ki&&Ki.require&&Ki.require("util").types;return e||Bc&&Bc.binding&&Bc.binding("util")}catch{}})(),Hg=Wg&&Wg.isTypedArray,vd=Hg?j5(Hg):M5;function Vu(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var L5=Object.prototype,$5=L5.hasOwnProperty;function D5(e,t,r){var n=e[t];(!($5.call(e,t)&&Nl(n,r))||r===void 0&&!(t in e))&&kd(e,t,r)}function B5(e,t,r,n){var s=!r;r||(r={});for(var i=-1,a=t.length;++i<a;){var o=t[i],l=void 0;l===void 0&&(l=e[o]),s?kd(r,o,l):D5(r,o,l)}return r}function R5(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var P5=9007199254740991,F5=/^(?:0|[1-9]\d*)$/;function Bb(e,t){var r=typeof e;return t=t??P5,!!t&&(r=="number"||r!="symbol"&&F5.test(e))&&e>-1&&e%1==0&&e<t}var O5=Object.prototype,z5=O5.hasOwnProperty;function W5(e,t){var r=Xo(e),n=!r&&Yo(e),s=!r&&!n&&wd(e),i=!r&&!n&&!s&&vd(e),a=r||n||s||i,o=a?R5(e.length,String):[],l=o.length;for(var c in e)(t||z5.call(e,c))&&!(a&&(c=="length"||s&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Bb(c,l)))&&o.push(c);return o}function H5(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var q5=Object.prototype,U5=q5.hasOwnProperty;function V5(e){if(!hs(e))return H5(e);var t=Ml(e),r=[];for(var n in e)n=="constructor"&&(t||!U5.call(e,n))||r.push(n);return r}function Rb(e){return jl(e)?W5(e,!0):V5(e)}function G5(e){return B5(e,Rb(e))}function Y5(e,t,r,n,s,i,a){var o=Vu(e,r),l=Vu(t,r),c=a.get(l);if(c){Uu(e,r,c);return}var u=i?i(o,l,r+"",e,t,a):void 0,h=u===void 0;if(h){var f=Xo(l),g=!f&&wd(l),p=!f&&!g&&vd(l);u=l,f||g||p?Xo(o)?u=o:K4(o)?u=W4(o):g?(h=!1,u=F4(l,!0)):p?(h=!1,u=z4(l,!0)):u=[]:i5(l)||Yo(l)?(u=o,Yo(o)?u=G5(o):(!hs(o)||bd(o))&&(u=U4(l))):h=!1}h&&(a.set(l,u),s(u,l,n,i,a),a.delete(l)),Uu(e,r,u)}function Pb(e,t,r,n,s){e!==t&&R4(t,function(i,a){if(s||(s=new ai),hs(i))Y5(e,t,a,r,Pb,n,s);else{var o=n?n(Vu(e,a),i,a+"",e,t,s):void 0;o===void 0&&(o=i),Uu(e,a,o)}},Rb)}function Fb(e){return e}function X5(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var qg=Math.max;function K5(e,t,r){return t=qg(t===void 0?e.length-1:t,0),function(){for(var n=arguments,s=-1,i=qg(n.length-t,0),a=Array(i);++s<i;)a[s]=n[t+s];s=-1;for(var o=Array(t+1);++s<t;)o[s]=n[s];return o[t]=r(a),X5(e,this,o)}}function Q5(e){return function(){return e}}var Z5=Go?function(e,t){return Go(e,"toString",{configurable:!0,enumerable:!1,value:Q5(t),writable:!0})}:Fb,J5=800,eD=16,tD=Date.now;function rD(e){var t=0,r=0;return function(){var n=tD(),s=eD-(n-r);if(r=n,s>0){if(++t>=J5)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var nD=rD(Z5);function sD(e,t){return nD(K5(e,t,Fb),e+"")}function iD(e,t,r){if(!hs(r))return!1;var n=typeof t;return(n=="number"?jl(r)&&Bb(t,r.length):n=="string"&&t in r)?Nl(r[t],e):!1}function aD(e){return sD(function(t,r){var n=-1,s=r.length,i=s>1?r[s-1]:void 0,a=s>2?r[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,a&&iD(r[0],r[1],a)&&(i=s<3?void 0:i,s=1),t=Object(t);++n<s;){var o=r[n];o&&e(t,o,n,i)}return t})}var oD=aD(function(e,t,r){Pb(e,t,r)}),lD="",cD={curveBasis:fo,curveBasisClosed:hL,curveBasisOpen:dL,curveBumpX:Sx,curveBumpY:_x,curveBundle:fL,curveCardinalClosed:gL,curveCardinalOpen:pL,curveCardinal:Ax,curveCatmullRomClosed:mL,curveCatmullRomOpen:xL,curveCatmullRom:jx,curveLinear:Bo,curveLinearClosed:yL,curveMonotoneX:Rx,curveMonotoneY:Px,curveNatural:Ox,curveStep:zx,curveStepAfter:Hx,curveStepBefore:Wx},uD=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,hD=b(function(e,t){const r=Ob(e,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const a=r.map(o=>o.args);_o(a),n=bt(n,[...a])}else n=r.args;if(!n)return;let s=Vh(e,t);const i="config";return n[i]!==void 0&&(s==="flowchart-v2"&&(s="flowchart"),n[s]=n[i],delete n[i]),n},"detectInit"),Ob=b(function(e,t=null){try{const r=new RegExp(`[%]{2}(?![{]${uD.source})(?=[}][%]{2}).*
|
|
250
|
-
`,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),K.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let n;const s=[];for(;(n=Yi.exec(e))!==null;)if(n.index===Yi.lastIndex&&Yi.lastIndex++,n&&!t||t&&n[1]?.match(t)||t&&n[2]?.match(t)){const i=n[1]?n[1]:n[2],a=n[3]?n[3].trim():n[4]?JSON.parse(n[4].trim()):null;s.push({type:i,args:a})}return s.length===0?{type:e,args:null}:s.length===1?s[0]:s}catch(r){return K.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),dD=b(function(e){return e.replace(Yi,"")},"removeDirectives"),fD=b(function(e,t){for(const[r,n]of t.entries())if(n.match(e))return r;return-1},"isSubstringInArray");function Cd(e,t){if(!e)return t;const r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return cD[r]??t}b(Cd,"interpolateToCurve");function zb(e,t){const r=e.trim();if(r)return t.securityLevel!=="loose"?L$.sanitizeUrl(r):r}b(zb,"formatUrl");var gD=b((e,...t)=>{const r=e.split("."),n=r.length-1,s=r[n];let i=window;for(let a=0;a<n;a++)if(i=i[r[a]],!i){K.error(`Function name: ${e} not found in window`);return}i[s](...t)},"runFunc");function Sd(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}b(Sd,"distance");function Wb(e){let t,r=0;e.forEach(s=>{r+=Sd(s,t),t=s});const n=r/2;return _d(e,n)}b(Wb,"traverseEdge");function Hb(e){return e.length===1?e[0]:Wb(e)}b(Hb,"calcLabelPosition");var Ug=b((e,t=2)=>{const r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),_d=b((e,t)=>{let r,n=t;for(const s of e){if(r){const i=Sd(s,r);if(i===0)return r;if(i<n)n-=i;else{const a=n/i;if(a<=0)return r;if(a>=1)return{x:s.x,y:s.y};if(a>0&&a<1)return{x:Ug((1-a)*r.x+a*s.x,5),y:Ug((1-a)*r.y+a*s.y,5)}}}r=s}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),pD=b((e,t,r)=>{K.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());const s=_d(t,25),i=e?10:5,a=Math.atan2(t[0].y-s.y,t[0].x-s.x),o={x:0,y:0};return o.x=Math.sin(a)*i+(t[0].x+s.x)/2,o.y=-Math.cos(a)*i+(t[0].y+s.y)/2,o},"calcCardinalityPosition");function qb(e,t,r){const n=structuredClone(r);K.info("our points",n),t!=="start_left"&&t!=="start_right"&&n.reverse();const s=25+e,i=_d(n,s),a=10+e*.5,o=Math.atan2(n[0].y-i.y,n[0].x-i.x),l={x:0,y:0};return t==="start_left"?(l.x=Math.sin(o+Math.PI)*a+(n[0].x+i.x)/2,l.y=-Math.cos(o+Math.PI)*a+(n[0].y+i.y)/2):t==="end_right"?(l.x=Math.sin(o-Math.PI)*a+(n[0].x+i.x)/2-5,l.y=-Math.cos(o-Math.PI)*a+(n[0].y+i.y)/2-5):t==="end_left"?(l.x=Math.sin(o)*a+(n[0].x+i.x)/2-5,l.y=-Math.cos(o)*a+(n[0].y+i.y)/2-5):(l.x=Math.sin(o)*a+(n[0].x+i.x)/2,l.y=-Math.cos(o)*a+(n[0].y+i.y)/2),l}b(qb,"calcTerminalLabelPosition");function Ub(e){let t="",r="";for(const n of e)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":t=t+n+";");return{style:t,labelStyle:r}}b(Ub,"getStylesFromArray");var Vg=0,mD=b(()=>(Vg++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Vg),"generateId");function Vb(e){let t="";const r="0123456789abcdef",n=r.length;for(let s=0;s<e;s++)t+=r.charAt(Math.floor(Math.random()*n));return t}b(Vb,"makeRandomHex");var xD=b(e=>Vb(e.length),"random"),yD=b(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),bD=b(function(e,t){const r=t.text.replace(ni.lineBreakRegex," "),[,n]=Il(t.fontSize),s=e.append("text");s.attr("x",t.x),s.attr("y",t.y),s.style("text-anchor",t.anchor),s.style("font-family",t.fontFamily),s.style("font-size",n),s.style("font-weight",t.fontWeight),s.attr("fill",t.fill),t.class!==void 0&&s.attr("class",t.class);const i=s.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.attr("fill",t.fill),i.text(r),s},"drawSimpleText"),kD=Ca((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),ni.lineBreakRegex.test(e)))return e;const n=e.split(" ").filter(Boolean),s=[];let i="";return n.forEach((a,o)=>{const l=an(`${a} `,r),c=an(i,r);if(l>t){const{hyphenatedStrings:f,remainingWord:g}=wD(a,t,"-",r);s.push(i,...f),i=g}else c+l>=t?(s.push(i),i=a):i=[i,a].filter(Boolean).join(" ");o+1===n.length&&s.push(i)}),s.filter(a=>a!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),wD=Ca((e,t,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);const s=[...e],i=[];let a="";return s.forEach((o,l)=>{const c=`${a}${o}`;if(an(c,n)>=t){const h=l+1,f=s.length===h,g=`${c}${r}`;i.push(f?c:g),a=""}else a=c}),{hyphenatedStrings:i,remainingWord:a}},(e,t,r="-",n)=>`${e}${t}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function Gb(e,t){return Td(e,t).height}b(Gb,"calculateTextHeight");function an(e,t){return Td(e,t).width}b(an,"calculateTextWidth");var Td=Ca((e,t)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:s=400}=t;if(!e)return{width:0,height:0};const[,i]=Il(r),a=["sans-serif",n],o=e.split(ni.lineBreakRegex),l=[],c=Fe("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const u=c.append("svg");for(const f of a){let g=0;const p={width:0,height:0,lineHeight:0};for(const m of o){const y=yD();y.text=m||lD;const x=bD(u,y).style("font-size",i).style("font-weight",s).style("font-family",f),k=(x._groups||x)[0][0].getBBox();if(k.width===0&&k.height===0)throw new Error("svg element not in render tree");p.width=Math.round(Math.max(p.width,k.width)),g=Math.round(k.height),p.height+=g,p.lineHeight=Math.round(Math.max(p.lineHeight,g))}l.push(p)}u.remove();const h=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[h]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),Hs,vD=(Hs=class{constructor(t=!1,r){this.count=0,this.count=r?r.length:0,this.next=t?()=>this.count++:()=>Date.now()}},b(Hs,"InitIDGenerator"),Hs),Ga,CD=b(function(e){return Ga=Ga||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Ga.innerHTML=e,unescape(Ga.textContent)},"entityDecode");function Nd(e){return"str"in e}b(Nd,"isDetailedError");var SD=b((e,t,r,n)=>{if(!n)return;const s=e.node()?.getBBox();s&&e.append("text").text(n).attr("text-anchor","middle").attr("x",s.x+s.width/2).attr("y",-r).attr("class",t)},"insertTitle"),Il=b(e=>{if(typeof e=="number")return[e,e+"px"];const t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function Ed(e,t){return oD({},e,t)}b(Ed,"cleanAndMerge");var Tr={assignWithDepth:bt,wrapLabel:kD,calculateTextHeight:Gb,calculateTextWidth:an,calculateTextDimensions:Td,cleanAndMerge:Ed,detectInit:hD,detectDirective:Ob,isSubstringInArray:fD,interpolateToCurve:Cd,calcLabelPosition:Hb,calcCardinalityPosition:pD,calcTerminalLabelPosition:qb,formatUrl:zb,getStylesFromArray:Ub,generateId:mD,random:xD,runFunc:gD,entityDecode:CD,insertTitle:SD,isLabelCoordinateInPath:Yb,parseFontSize:Il,InitIDGenerator:vD},_D=b(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){const n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"fl°°"+n+"¶ß":"fl°"+n+"¶ß"}),t},"encodeEntities"),gs=b(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),I9=b((e,t,{counter:r=0,prefix:n,suffix:s},i)=>i||`${n?`${n}_`:""}${e}_${t}_${r}${s?`_${s}`:""}`,"getEdgeId");function $t(e){return e??null}b($t,"handleUndefinedAttr");function Yb(e,t){const r=Math.round(e.x),n=Math.round(e.y),s=t.replace(/(\d+\.\d+)/g,i=>Math.round(parseFloat(i)).toString());return s.includes(r.toString())||s.includes(n.toString())}b(Yb,"isLabelCoordinateInPath");const TD=Object.freeze({left:0,top:0,width:16,height:16}),Ko=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Xb=Object.freeze({...TD,...Ko}),ND=Object.freeze({...Xb,body:"",hidden:!1}),ED=Object.freeze({width:null,height:null}),AD=Object.freeze({...ED,...Ko}),MD=(e,t,r,n="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;n=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const o=s.pop(),l=s.pop(),c={provider:s.length>0?s[0]:n,prefix:l,name:o};return Rc(c)?c:null}const i=s[0],a=i.split("-");if(a.length>1){const o={provider:n,prefix:a.shift(),name:a.join("-")};return Rc(o)?o:null}if(r&&n===""){const o={provider:n,prefix:"",name:i};return Rc(o,r)?o:null}return null},Rc=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;function jD(e,t){const r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);const n=((e.rotate||0)+(t.rotate||0))%4;return n&&(r.rotate=n),r}function Gg(e,t){const r=jD(e,t);for(const n in ND)n in Ko?n in e&&!(n in r)&&(r[n]=Ko[n]):n in t?r[n]=t[n]:n in e&&(r[n]=e[n]);return r}function ID(e,t){const r=e.icons,n=e.aliases||Object.create(null),s=Object.create(null);function i(a){if(r[a])return s[a]=[];if(!(a in s)){s[a]=null;const o=n[a]&&n[a].parent,l=o&&i(o);l&&(s[a]=[o].concat(l))}return s[a]}return(t||Object.keys(r).concat(Object.keys(n))).forEach(i),s}function Yg(e,t,r){const n=e.icons,s=e.aliases||Object.create(null);let i={};function a(o){i=Gg(n[o]||s[o],i)}return a(t),r.forEach(a),Gg(e,i)}function LD(e,t){if(e.icons[t])return Yg(e,t,[]);const r=ID(e,[t])[t];return r?Yg(e,t,r):null}const $D=/(-?[0-9.]*[0-9]+[0-9.]*)/g,DD=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Xg(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;const n=e.split($D);if(n===null||!n.length)return e;const s=[];let i=n.shift(),a=DD.test(i);for(;;){if(a){const o=parseFloat(i);isNaN(o)?s.push(i):s.push(Math.ceil(o*t*r)/r)}else s.push(i);if(i=n.shift(),i===void 0)return s.join("");a=!a}}function BD(e,t="defs"){let r="";const n=e.indexOf("<"+t);for(;n>=0;){const s=e.indexOf(">",n),i=e.indexOf("</"+t);if(s===-1||i===-1)break;const a=e.indexOf(">",i);if(a===-1)break;r+=e.slice(s+1,i).trim(),e=e.slice(0,n).trim()+e.slice(a+1)}return{defs:r,content:e}}function RD(e,t){return e?"<defs>"+e+"</defs>"+t:t}function PD(e,t,r){const n=BD(e);return RD(n.defs,t+n.content+r)}const FD=e=>e==="unset"||e==="undefined"||e==="none";function OD(e,t){const r={...Xb,...e},n={...AD,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let i=r.body;[r,n].forEach(m=>{const y=[],x=m.hFlip,k=m.vFlip;let v=m.rotate;x?k?v+=2:(y.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),y.push("scale(-1 1)"),s.top=s.left=0):k&&(y.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),y.push("scale(1 -1)"),s.top=s.left=0);let _;switch(v<0&&(v-=Math.floor(v/4)*4),v=v%4,v){case 1:_=s.height/2+s.top,y.unshift("rotate(90 "+_.toString()+" "+_.toString()+")");break;case 2:y.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:_=s.width/2+s.left,y.unshift("rotate(-90 "+_.toString()+" "+_.toString()+")");break}v%2===1&&(s.left!==s.top&&(_=s.left,s.left=s.top,s.top=_),s.width!==s.height&&(_=s.width,s.width=s.height,s.height=_)),y.length&&(i=PD(i,'<g transform="'+y.join(" ")+'">',"</g>"))});const a=n.width,o=n.height,l=s.width,c=s.height;let u,h;a===null?(h=o===null?"1em":o==="auto"?c:o,u=Xg(h,l/c)):(u=a==="auto"?l:a,h=o===null?Xg(u,c/l):o==="auto"?c:o);const f={},g=(m,y)=>{FD(y)||(f[m]=y.toString())};g("width",u),g("height",h);const p=[s.left,s.top,l,c];return f.viewBox=p.join(" "),{attributes:f,viewBox:p,body:i}}const zD=/\sid="(\S+)"/g,WD="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let HD=0;function qD(e,t=WD){const r=[];let n;for(;n=zD.exec(e);)r.push(n[1]);if(!r.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return r.forEach(i=>{const a=typeof t=="function"?t(i):t+(HD++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+a+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}function UD(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in t)r+=" "+n+'="'+t[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+e+"</svg>"}function Ad(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ps=Ad();function Kb(e){ps=e}var Qi={exec:()=>null};function He(e,t=""){let r=typeof e=="string"?e:e.source,n={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(Wt.caret,"$1"),r=r.replace(s,a),n},getRegex:()=>new RegExp(r,t)};return n}var Wt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},VD=/^(?:[ \t]*(?:\n|$))+/,GD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,YD=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_a=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,XD=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Md=/(?:[*+-]|\d{1,9}[.)])/,Qb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Zb=He(Qb).replace(/bull/g,Md).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),KD=He(Qb).replace(/bull/g,Md).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),jd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,QD=/^[^\n]+/,Id=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ZD=He(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Id).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),JD=He(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Md).getRegex(),Ll="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ld=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,e3=He("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ld).replace("tag",Ll).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Jb=He(jd).replace("hr",_a).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ll).getRegex(),t3=He(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Jb).getRegex(),$d={blockquote:t3,code:GD,def:ZD,fences:YD,heading:XD,hr:_a,html:e3,lheading:Zb,list:JD,newline:VD,paragraph:Jb,table:Qi,text:QD},Kg=He("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_a).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ll).getRegex(),r3={...$d,lheading:KD,table:Kg,paragraph:He(jd).replace("hr",_a).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Kg).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ll).getRegex()},n3={...$d,html:He(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ld).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Qi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:He(jd).replace("hr",_a).replace("heading",` *#{1,6} *[^
|
|
251
|
-
]`).replace("lheading",Zb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},s3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,i3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ek=/^( {2,}|\\)\n(?!\s*$)/,a3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$l=/[\p{P}\p{S}]/u,Dd=/[\s\p{P}\p{S}]/u,tk=/[^\s\p{P}\p{S}]/u,o3=He(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Dd).getRegex(),rk=/(?!~)[\p{P}\p{S}]/u,l3=/(?!~)[\s\p{P}\p{S}]/u,c3=/(?:[^\s\p{P}\p{S}]|~)/u,u3=/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,nk=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,h3=He(nk,"u").replace(/punct/g,$l).getRegex(),d3=He(nk,"u").replace(/punct/g,rk).getRegex(),sk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",f3=He(sk,"gu").replace(/notPunctSpace/g,tk).replace(/punctSpace/g,Dd).replace(/punct/g,$l).getRegex(),g3=He(sk,"gu").replace(/notPunctSpace/g,c3).replace(/punctSpace/g,l3).replace(/punct/g,rk).getRegex(),p3=He("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,tk).replace(/punctSpace/g,Dd).replace(/punct/g,$l).getRegex(),m3=He(/\\(punct)/,"gu").replace(/punct/g,$l).getRegex(),x3=He(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),y3=He(Ld).replace("(?:-->|$)","-->").getRegex(),b3=He("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",y3).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,k3=He(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Qo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ik=He(/^!?\[(label)\]\[(ref)\]/).replace("label",Qo).replace("ref",Id).getRegex(),ak=He(/^!?\[(ref)\](?:\[\])?/).replace("ref",Id).getRegex(),w3=He("reflink|nolink(?!\\()","g").replace("reflink",ik).replace("nolink",ak).getRegex(),Qg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bd={_backpedal:Qi,anyPunctuation:m3,autolink:x3,blockSkip:u3,br:ek,code:i3,del:Qi,emStrongLDelim:h3,emStrongRDelimAst:f3,emStrongRDelimUnd:p3,escape:s3,link:k3,nolink:ak,punctuation:o3,reflink:ik,reflinkSearch:w3,tag:b3,text:a3,url:Qi},v3={...Bd,link:He(/^!?\[(label)\]\((.*?)\)/).replace("label",Qo).getRegex(),reflink:He(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Qo).getRegex()},Gu={...Bd,emStrongRDelimAst:g3,emStrongLDelim:d3,url:He(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Qg).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:He(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Qg).getRegex()},C3={...Gu,br:He(ek).replace("{2,}","*").getRegex(),text:He(Gu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ya={normal:$d,gfm:r3,pedantic:n3},Ni={normal:Bd,gfm:Gu,breaks:C3,pedantic:v3},S3={"&":"&","<":"<",">":">",'"':""","'":"'"},Zg=e=>S3[e];function Dr(e,t){if(t){if(Wt.escapeTest.test(e))return e.replace(Wt.escapeReplace,Zg)}else if(Wt.escapeTestNoEncode.test(e))return e.replace(Wt.escapeReplaceNoEncode,Zg);return e}function Jg(e){try{e=encodeURI(e).replace(Wt.percentDecode,"%")}catch{return null}return e}function ep(e,t){let r=e.replace(Wt.findPipe,(i,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),n=r.split(Wt.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Wt.slashPipe,"|");return n}function Ei(e,t,r){let n=e.length;if(n===0)return"";let s=0;for(;s<n&&e.charAt(n-s-1)===t;)s++;return e.slice(0,n-s)}function _3(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let n=0;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]===t[0])r++;else if(e[n]===t[1]&&(r--,r<0))return n;return r>0?-2:-1}function tp(e,t,r,n,s){let i=t.href,a=t.title||null,o=e[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:a,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,l}function T3(e,t,r){let n=e.match(r.other.indentCodeCompensation);if(n===null)return t;let s=n[1];return t.split(`
|
|
252
|
-
`).map(i=>{let a=i.match(r.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=s.length?i.slice(s.length):i}).join(`
|
|
253
|
-
`)}var Zo=class{options;rules;lexer;constructor(t){this.options=t||ps}space(t){let r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){let r=this.rules.block.code.exec(t);if(r){let n=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ei(n,`
|
|
254
|
-
`)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let n=r[0],s=T3(n,r[3]||"",this.rules);return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:s}}}heading(t){let r=this.rules.block.heading.exec(t);if(r){let n=r[2].trim();if(this.rules.other.endingHash.test(n)){let s=Ei(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:Ei(r[0],`
|
|
255
|
-
`)}}blockquote(t){let r=this.rules.block.blockquote.exec(t);if(r){let n=Ei(r[0],`
|
|
256
|
-
`).split(`
|
|
257
|
-
`),s="",i="",a=[];for(;n.length>0;){let o=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),o=!0;else if(!o)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
|
|
258
|
-
`),h=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
259
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
260
|
-
${u}`:u,i=i?`${i}
|
|
261
|
-
${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,a,!0),this.lexer.state.top=f,n.length===0)break;let g=a.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let p=g,m=p.raw+`
|
|
262
|
-
`+n.join(`
|
|
263
|
-
`),y=this.blockquote(m);a[a.length-1]=y,s=s.substring(0,s.length-p.raw.length)+y.raw,i=i.substring(0,i.length-p.text.length)+y.text;break}else if(g?.type==="list"){let p=g,m=p.raw+`
|
|
264
|
-
`+n.join(`
|
|
265
|
-
`),y=this.list(m);a[a.length-1]=y,s=s.substring(0,s.length-g.raw.length)+y.raw,i=i.substring(0,i.length-p.raw.length)+y.raw,n=m.substring(a.at(-1).raw.length).split(`
|
|
266
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(t){let r=this.rules.block.list.exec(t);if(r){let n=r[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;t;){let c=!1,u="",h="";if(!(r=a.exec(t))||this.rules.block.hr.test(t))break;u=r[0],t=t.substring(u.length);let f=r[2].split(`
|
|
267
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),g=t.split(`
|
|
268
|
-
`,1)[0],p=!f.trim(),m=0;if(this.options.pedantic?(m=2,h=f.trimStart()):p?m=r[1].length+1:(m=r[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,h=f.slice(m),m+=r[1].length),p&&this.rules.other.blankLine.test(g)&&(u+=g+`
|
|
269
|
-
`,t=t.substring(g.length+1),c=!0),!c){let k=this.rules.other.nextBulletRegex(m),v=this.rules.other.hrRegex(m),_=this.rules.other.fencesBeginRegex(m),C=this.rules.other.headingBeginRegex(m),w=this.rules.other.htmlBeginRegex(m);for(;t;){let S=t.split(`
|
|
270
|
-
`,1)[0],F;if(g=S,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),F=g):F=g.replace(this.rules.other.tabCharGlobal," "),_.test(g)||C.test(g)||w.test(g)||k.test(g)||v.test(g))break;if(F.search(this.rules.other.nonSpaceChar)>=m||!g.trim())h+=`
|
|
271
|
-
`+F.slice(m);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(f)||C.test(f)||v.test(f))break;h+=`
|
|
272
|
-
`+g}!p&&!g.trim()&&(p=!0),u+=S+`
|
|
273
|
-
`,t=t.substring(S.length+1),f=F.slice(m)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0));let y=null,x;this.options.gfm&&(y=this.rules.other.listIsTask.exec(h),y&&(x=y[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:u,task:!!y,checked:x,loose:!1,text:h,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){let u=i.items[c].tokens.filter(f=>f.type==="space"),h=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=h}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(t){let r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){let r=this.rules.block.def.exec(t);if(r){let n=r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:s,title:i}}}table(t){let r=this.rules.block.table.exec(t);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let n=ep(r[1]),s=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=r[3]?.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
274
|
-
`):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(ep(o,a.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[c]})));return a}}lheading(t){let r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){let r=this.rules.block.paragraph.exec(t);if(r){let n=r[1].charAt(r[1].length-1)===`
|
|
275
|
-
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){let r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(t){let r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){let r=this.rules.inline.link.exec(t);if(r){let n=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=Ei(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=_3(r[2],"()");if(a===-2)return;if(a>-1){let o=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,o).trim(),r[3]=""}}let s=r[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=r[3]?r[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),tp(r,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(t,r){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=r[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return tp(n,i,n[0],this.lexer,this.rules)}}emStrong(t,r,n=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,l=i,c=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,r=r.slice(-1*t.length+i);(s=u.exec(r))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){l+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let h=[...s[0]][0].length,f=t.slice(0,i+s.index+h+o);if(Math.min(i,o)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let g=f.slice(2,-2);return{type:"strong",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(t){let r=this.rules.inline.code.exec(t);if(r){let n=r[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:r[0],text:n}}}br(t){let r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){let r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){let r=this.rules.inline.autolink.exec(t);if(r){let n,s;return r[2]==="@"?(n=r[1],s="mailto:"+n):(n=r[1],s=n),{type:"link",raw:r[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let r;if(r=this.rules.inline.url.exec(t)){let n,s;if(r[2]==="@")n=r[0],s="mailto:"+n;else{let i;do i=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(i!==r[0]);n=r[0],r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let r=this.rules.inline.text.exec(t);if(r){let n=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:n}}}},Cr=class Yu{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ps,this.options.tokenizer=this.options.tokenizer||new Zo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Wt,block:Ya.normal,inline:Ni.normal};this.options.pedantic?(r.block=Ya.pedantic,r.inline=Ni.pedantic):this.options.gfm&&(r.block=Ya.gfm,this.options.breaks?r.inline=Ni.breaks:r.inline=Ni.gfm),this.tokenizer.rules=r}static get rules(){return{block:Ya,inline:Ni}}static lex(t,r){return new Yu(r).lex(t)}static lexInline(t,r){return new Yu(r).inlineTokens(t)}lex(t){t=t.replace(Wt.carriageReturn,`
|
|
276
|
-
`),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],n=!1){for(this.options.pedantic&&(t=t.replace(Wt.tabCharGlobal," ").replace(Wt.spaceLine,""));t;){let s;if(this.options.extensions?.block?.some(a=>(s=a.call({lexer:this},t,r))?(t=t.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.space(t)){t=t.substring(s.raw.length);let a=r.at(-1);s.raw.length===1&&a!==void 0?a.raw+=`
|
|
277
|
-
`:r.push(s);continue}if(s=this.tokenizer.code(t)){t=t.substring(s.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
278
|
-
`)?"":`
|
|
279
|
-
`)+s.raw,a.text+=`
|
|
280
|
-
`+s.text,this.inlineQueue.at(-1).src=a.text):r.push(s);continue}if(s=this.tokenizer.fences(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.heading(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.hr(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.blockquote(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.list(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.html(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.def(t)){t=t.substring(s.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
281
|
-
`)?"":`
|
|
282
|
-
`)+s.raw,a.text+=`
|
|
283
|
-
`+s.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},r.push(s));continue}if(s=this.tokenizer.table(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.lheading(t)){t=t.substring(s.raw.length),r.push(s);continue}let i=t;if(this.options.extensions?.startBlock){let a=1/0,o=t.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},o),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),a<1/0&&a>=0&&(i=t.substring(0,a+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let a=r.at(-1);n&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
284
|
-
`)?"":`
|
|
285
|
-
`)+s.raw,a.text+=`
|
|
286
|
-
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(s),n=i.length!==t.length,t=t.substring(s.raw.length);continue}if(s=this.tokenizer.text(t)){t=t.substring(s.raw.length);let a=r.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
287
|
-
`)?"":`
|
|
288
|
-
`)+s.raw,a.text+=`
|
|
289
|
-
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(s);continue}if(t){let a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n=t,s=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,a="";for(;t;){i||(a=""),i=!1;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},t,r))?(t=t.substring(o.raw.length),r.push(o),!0):!1))continue;if(o=this.tokenizer.escape(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.tag(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.link(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(o.raw.length);let c=r.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):r.push(o);continue}if(o=this.tokenizer.emStrong(t,n,a)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.codespan(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.br(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.del(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.autolink(t)){t=t.substring(o.raw.length),r.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(t))){t=t.substring(o.raw.length),r.push(o);continue}let l=t;if(this.options.extensions?.startInline){let c=1/0,u=t.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(o=this.tokenizer.inlineText(l)){t=t.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(a=o.raw.slice(-1)),i=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):r.push(o);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return r}},Jo=class{options;parser;constructor(t){this.options=t||ps}space(t){return""}code({text:t,lang:r,escaped:n}){let s=(r||"").match(Wt.notSpaceStart)?.[0],i=t.replace(Wt.endingNewline,"")+`
|
|
290
|
-
`;return s?'<pre><code class="language-'+Dr(s)+'">'+(n?i:Dr(i,!0))+`</code></pre>
|
|
291
|
-
`:"<pre><code>"+(n?i:Dr(i,!0))+`</code></pre>
|
|
292
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
293
|
-
${this.parser.parse(t)}</blockquote>
|
|
294
|
-
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:r}){return`<h${r}>${this.parser.parseInline(t)}</h${r}>
|
|
295
|
-
`}hr(t){return`<hr>
|
|
296
|
-
`}list(t){let r=t.ordered,n=t.start,s="";for(let o=0;o<t.items.length;o++){let l=t.items[o];s+=this.listitem(l)}let i=r?"ol":"ul",a=r&&n!==1?' start="'+n+'"':"";return"<"+i+a+`>
|
|
297
|
-
`+s+"</"+i+`>
|
|
298
|
-
`}listitem(t){let r="";if(t.task){let n=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+Dr(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):r+=n+" "}return r+=this.parser.parse(t.tokens,!!t.loose),`<li>${r}</li>
|
|
299
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
300
|
-
`}table(t){let r="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);r+=this.tablerow({text:n});let s="";for(let i=0;i<t.rows.length;i++){let a=t.rows[i];n="";for(let o=0;o<a.length;o++)n+=this.tablecell(a[o]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
301
|
-
<thead>
|
|
302
|
-
`+r+`</thead>
|
|
303
|
-
`+s+`</table>
|
|
304
|
-
`}tablerow({text:t}){return`<tr>
|
|
305
|
-
${t}</tr>
|
|
306
|
-
`}tablecell(t){let r=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+r+`</${n}>
|
|
307
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Dr(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:r,tokens:n}){let s=this.parser.parseInline(n),i=Jg(t);if(i===null)return s;t=i;let a='<a href="'+t+'"';return r&&(a+=' title="'+Dr(r)+'"'),a+=">"+s+"</a>",a}image({href:t,title:r,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Jg(t);if(i===null)return Dr(n);t=i;let a=`<img src="${t}" alt="${n}"`;return r&&(a+=` title="${Dr(r)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Dr(t.text)}},Rd=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Sr=class Xu{options;renderer;textRenderer;constructor(t){this.options=t||ps,this.options.renderer=this.options.renderer||new Jo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rd}static parse(t,r){return new Xu(r).parse(t)}static parseInline(t,r){return new Xu(r).parseInline(t)}parse(t,r=!0){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);continue}case"hr":{n+=this.renderer.hr(a);continue}case"heading":{n+=this.renderer.heading(a);continue}case"code":{n+=this.renderer.code(a);continue}case"table":{n+=this.renderer.table(a);continue}case"blockquote":{n+=this.renderer.blockquote(a);continue}case"list":{n+=this.renderer.list(a);continue}case"html":{n+=this.renderer.html(a);continue}case"def":{n+=this.renderer.def(a);continue}case"paragraph":{n+=this.renderer.paragraph(a);continue}case"text":{let o=a,l=this.renderer.text(o);for(;s+1<t.length&&t[s+1].type==="text";)o=t[++s],l+=`
|
|
308
|
-
`+this.renderer.text(o);r?n+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):n+=l;continue}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,r=this.renderer){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=o||"";continue}}let a=i;switch(a.type){case"escape":{n+=r.text(a);break}case"html":{n+=r.html(a);break}case"link":{n+=r.link(a);break}case"image":{n+=r.image(a);break}case"strong":{n+=r.strong(a);break}case"em":{n+=r.em(a);break}case"codespan":{n+=r.codespan(a);break}case"br":{n+=r.br(a);break}case"del":{n+=r.del(a);break}case"text":{n+=r.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}},Ri=class{options;block;constructor(t){this.options=t||ps}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Cr.lex:Cr.lexInline}provideParser(){return this.block?Sr.parse:Sr.parseInline}},N3=class{defaults=Ad();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Sr;Renderer=Jo;TextRenderer=Rd;Lexer=Cr;Tokenizer=Zo;Hooks=Ri;constructor(...t){this.use(...t)}walkTokens(t,r){let n=[];for(let s of t)switch(n=n.concat(r.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,r));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,r));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,r));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,r))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,r)))}}return n}use(...t){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=r.renderers[i.name];a?r.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:r.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=r[i.level];a?a.unshift(i.tokenizer):r[i.level]=[i.tokenizer],i.start&&(i.level==="block"?r.startBlock?r.startBlock.push(i.start):r.startBlock=[i.start]:i.level==="inline"&&(r.startInline?r.startInline.push(i.start):r.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(r.childTokens[i.name]=i.childTokens)}),s.extensions=r),n.renderer){let i=this.defaults.renderer||new Jo(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,l=n.renderer[o],c=i[o];i[o]=(...u)=>{let h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Zo(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,l=n.tokenizer[o],c=i[o];i[o]=(...u)=>{let h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Ri;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,l=n.hooks[o],c=i[o];Ri.passThroughHooks.has(a)?i[o]=u=>{if(this.defaults.async&&Ri.passThroughHooksRespectAsync.has(a))return(async()=>{let f=await l.call(i,u);return c.call(i,f)})();let h=l.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await l.apply(i,u);return f===!1&&(f=await c.apply(i,u)),f})();let h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return Cr.lex(t,r??this.defaults)}parser(t,r){return Sr.parse(t,r??this.defaults)}parseMarkdown(t){return(r,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(r):r,l=await(i.hooks?await i.hooks.provideLexer():t?Cr.lex:Cr.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():t?Sr.parse:Sr.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(r=i.hooks.preprocess(r));let o=(i.hooks?i.hooks.provideLexer():t?Cr.lex:Cr.lexInline)(r,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():t?Sr.parse:Sr.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(t,r){return n=>{if(n.message+=`
|
|
309
|
-
Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+Dr(n.message+"",!0)+"</pre>";return r?Promise.resolve(s):s}if(r)return Promise.reject(n);throw n}}},ls=new N3;function Ue(e,t){return ls.parse(e,t)}Ue.options=Ue.setOptions=function(e){return ls.setOptions(e),Ue.defaults=ls.defaults,Kb(Ue.defaults),Ue};Ue.getDefaults=Ad;Ue.defaults=ps;Ue.use=function(...e){return ls.use(...e),Ue.defaults=ls.defaults,Kb(Ue.defaults),Ue};Ue.walkTokens=function(e,t){return ls.walkTokens(e,t)};Ue.parseInline=ls.parseInline;Ue.Parser=Sr;Ue.parser=Sr.parse;Ue.Renderer=Jo;Ue.TextRenderer=Rd;Ue.Lexer=Cr;Ue.lexer=Cr.lex;Ue.Tokenizer=Zo;Ue.Hooks=Ri;Ue.parse=Ue;Ue.options;Ue.setOptions;Ue.use;Ue.walkTokens;Ue.parseInline;Sr.parse;Cr.lex;function ok(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=Array.from(typeof e=="string"?[e]:e);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,"");var s=n.reduce(function(o,l){var c=l.match(/\n([\t ]+|(?!\s).)/g);return c?o.concat(c.map(function(u){var h,f;return(f=(h=u.match(/[\t ]/g))===null||h===void 0?void 0:h.length)!==null&&f!==void 0?f:0})):o},[]);if(s.length){var i=new RegExp(`
|
|
310
|
-
[ ]{`+Math.min.apply(Math,s)+"}","g");n=n.map(function(o){return o.replace(i,`
|
|
311
|
-
`)})}n[0]=n[0].replace(/^\r?\n/,"");var a=n[0];return t.forEach(function(o,l){var c=a.match(/(?:^|\n)( *)$/),u=c?c[1]:"",h=o;typeof o=="string"&&o.includes(`
|
|
312
|
-
`)&&(h=String(o).split(`
|
|
313
|
-
`).map(function(f,g){return g===0?f:""+u+f}).join(`
|
|
314
|
-
`)),a+=h+n[l+1]}),a}var E3={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},Ku=new Map,lk=new Map,A3=b(e=>{for(const t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(K.debug("Registering icon pack:",t.name),"loader"in t)lk.set(t.name,t.loader);else if("icons"in t)Ku.set(t.name,t.icons);else throw K.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),ck=b(async(e,t)=>{const r=MD(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);const n=r.prefix||t;if(!n)throw new Error(`Icon name must contain a prefix: ${e}`);let s=Ku.get(n);if(!s){const a=lk.get(n);if(!a)throw new Error(`Icon set not found: ${r.prefix}`);try{s={...await a(),prefix:n},Ku.set(n,s)}catch(o){throw K.error(o),new Error(`Failed to load icon set: ${r.prefix}`)}}const i=LD(s,r.name);if(!i)throw new Error(`Icon not found: ${e}`);return i},"getRegisteredIconData"),M3=b(async e=>{try{return await ck(e),!0}catch{return!1}},"isIconAvailable"),Ta=b(async(e,t,r)=>{let n;try{n=await ck(e,t?.fallbackPrefix)}catch(a){K.error(a),n=E3}const s=OD(n,t),i=UD(qD(s.body),{...s.attributes,...r});return mr(i,It())},"getIconSVG");function uk(e,{markdownAutoWrap:t}){const n=e.replace(/<br\/>/g,`
|
|
315
|
-
`).replace(/\n{2,}/g,`
|
|
316
|
-
`),s=ok(n);return t===!1?s.replace(/ /g," "):s}b(uk,"preprocessMarkdown");function hk(e,t={}){const r=uk(e,t),n=Ue.lexer(r),s=[[]];let i=0;function a(o,l="normal"){o.type==="text"?o.text.split(`
|
|
317
|
-
`).forEach((u,h)=>{h!==0&&(i++,s.push([])),u.split(" ").forEach(f=>{f=f.replace(/'/g,"'"),f&&s[i].push({content:f,type:l})})}):o.type==="strong"||o.type==="em"?o.tokens.forEach(c=>{a(c,o.type)}):o.type==="html"&&s[i].push({content:o.text,type:"normal"})}return b(a,"processNode"),n.forEach(o=>{o.type==="paragraph"?o.tokens?.forEach(l=>{a(l)}):o.type==="html"?s[i].push({content:o.text,type:"normal"}):s[i].push({content:o.raw,type:"normal"})}),s}b(hk,"markdownToLines");function dk(e,{markdownAutoWrap:t}={}){const r=Ue.lexer(e);function n(s){return s.type==="text"?t===!1?s.text.replace(/\n */g,"<br/>").replace(/ /g," "):s.text.replace(/\n */g,"<br/>"):s.type==="strong"?`<strong>${s.tokens?.map(n).join("")}</strong>`:s.type==="em"?`<em>${s.tokens?.map(n).join("")}</em>`:s.type==="paragraph"?`<p>${s.tokens?.map(n).join("")}</p>`:s.type==="space"?"":s.type==="html"?`${s.text}`:s.type==="escape"?s.text:(K.warn(`Unsupported markdown: ${s.type}`),s.raw)}return b(n,"output"),r.map(n).join("")}b(dk,"markdownToHTML");function fk(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}b(fk,"splitTextToChars");function gk(e,t){const r=fk(t.content);return Pd(e,[],r,t.type)}b(gk,"splitWordToFitWidth");function Pd(e,t,r,n){if(r.length===0)return[{content:t.join(""),type:n},{content:"",type:n}];const[s,...i]=r,a=[...t,s];return e([{content:a.join(""),type:n}])?Pd(e,a,i,n):(t.length===0&&s&&(t.push(s),r.shift()),[{content:t.join(""),type:n},{content:r.join(""),type:n}])}b(Pd,"splitWordToFitWidthRecursion");function pk(e,t){if(e.some(({content:r})=>r.includes(`
|
|
318
|
-
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return el(e,t)}b(pk,"splitLineToFitWidth");function el(e,t,r=[],n=[]){if(e.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let s="";e[0].content===" "&&(s=" ",e.shift());const i=e.shift()??{content:" ",type:"normal"},a=[...n];if(s!==""&&a.push({content:s,type:"normal"}),a.push(i),t(a))return el(e,t,r,a);if(n.length>0)r.push(n),e.unshift(i);else if(i.content){const[o,l]=gk(t,i);r.push([o]),l.content&&e.unshift(l)}return el(e,t,r)}b(el,"splitLineToFitWidthRecursion");function Qu(e,t){t&&e.attr("style",t)}b(Qu,"applyStyle");async function mk(e,t,r,n,s=!1,i=It()){const a=e.append("foreignObject");a.attr("width",`${10*r}px`),a.attr("height",`${10*r}px`);const o=a.append("xhtml:div"),l=Ys(t.label)?await Gh(t.label.replace(ni.lineBreakRegex,`
|
|
319
|
-
`),i):mr(t.label,i),c=t.isNode?"nodeLabel":"edgeLabel",u=o.append("span");u.html(l),Qu(u,t.labelStyle),u.attr("class",`${c} ${n}`),Qu(o,t.labelStyle),o.style("display","table-cell"),o.style("white-space","nowrap"),o.style("line-height","1.5"),o.style("max-width",r+"px"),o.style("text-align","center"),o.attr("xmlns","http://www.w3.org/1999/xhtml"),s&&o.attr("class","labelBkg");let h=o.node().getBoundingClientRect();return h.width===r&&(o.style("display","table"),o.style("white-space","break-spaces"),o.style("width",r+"px"),h=o.node().getBoundingClientRect()),a.node()}b(mk,"addHtmlSpan");function Dl(e,t,r){return e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em")}b(Dl,"createTspan");function xk(e,t,r){const n=e.append("text"),s=Dl(n,1,t);Bl(s,r);const i=s.node().getComputedTextLength();return n.remove(),i}b(xk,"computeWidthOfText");function j3(e,t,r){const n=e.append("text"),s=Dl(n,1,t);Bl(s,[{content:r,type:"normal"}]);const i=s.node()?.getBoundingClientRect();return i&&n.remove(),i}b(j3,"computeDimensionOfText");function yk(e,t,r,n=!1){const i=t.append("g"),a=i.insert("rect").attr("class","background").attr("style","stroke: none"),o=i.append("text").attr("y","-10.1");let l=0;for(const c of r){const u=b(f=>xk(i,1.1,f)<=e,"checkWidth"),h=u(c)?[c]:pk(c,u);for(const f of h){const g=Dl(o,l,1.1);Bl(g,f),l++}}if(n){const c=o.node().getBBox(),u=2;return a.attr("x",c.x-u).attr("y",c.y-u).attr("width",c.width+2*u).attr("height",c.height+2*u),i.node()}else return o.node()}b(yk,"createFormattedText");function Bl(e,t){e.text(""),t.forEach((r,n)=>{const s=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?s.text(r.content):s.text(" "+r.content)})}b(Bl,"updateTextContentAndStyles");async function bk(e,t={}){const r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(s,i,a)=>(r.push((async()=>{const o=`${i}:${a}`;return await M3(o)?await Ta(o,void 0,{class:"label-icon"}):`<i class='${mr(s,t).replace(":"," ")}'></i>`})()),s));const n=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}b(bk,"replaceIconSubstring");var Ln=b(async(e,t="",{style:r="",isTitle:n=!1,classes:s="",useHtmlLabels:i=!0,isNode:a=!0,width:o=200,addSvgBackground:l=!1}={},c)=>{if(K.debug("XYZ createText",t,r,n,s,i,a,"addSvgBackground: ",l),i){const u=dk(t,c),h=await bk(gs(u),c),f=t.replace(/\\\\/g,"\\"),g={isNode:a,label:Ys(t)?f:h,labelStyle:r.replace("fill:","color:")};return await mk(e,g,o,s,l,c)}else{const u=t.replace(/<br\s*\/?>/g,"<br/>"),h=hk(u.replace("<br>","<br/>"),c),f=yk(o,e,h,t?l:!1);if(a){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Fe(f).attr("style",g)}else{const g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Fe(f).select("rect").attr("style",g.replace(/background:/g,"fill:"));const p=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Fe(f).select("text").attr("style",p)}return f}},"createText");function Pc(e,t,r){if(e&&e.length){const[n,s]=t,i=Math.PI/180*r,a=Math.cos(i),o=Math.sin(i);for(const l of e){const[c,u]=l;l[0]=(c-n)*a-(u-s)*o+n,l[1]=(c-n)*o+(u-s)*a+s}}}function I3(e,t){return e[0]===t[0]&&e[1]===t[1]}function L3(e,t,r,n=1){const s=r,i=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,o=[0,0];if(s)for(const c of a)Pc(c,o,s);const l=(function(c,u,h){const f=[];for(const k of c){const v=[...k];I3(v[0],v[v.length-1])||v.push([v[0][0],v[0][1]]),v.length>2&&f.push(v)}const g=[];u=Math.max(u,.1);const p=[];for(const k of f)for(let v=0;v<k.length-1;v++){const _=k[v],C=k[v+1];if(_[1]!==C[1]){const w=Math.min(_[1],C[1]);p.push({ymin:w,ymax:Math.max(_[1],C[1]),x:w===_[1]?_[0]:C[0],islope:(C[0]-_[0])/(C[1]-_[1])})}}if(p.sort(((k,v)=>k.ymin<v.ymin?-1:k.ymin>v.ymin?1:k.x<v.x?-1:k.x>v.x?1:k.ymax===v.ymax?0:(k.ymax-v.ymax)/Math.abs(k.ymax-v.ymax))),!p.length)return g;let m=[],y=p[0].ymin,x=0;for(;m.length||p.length;){if(p.length){let k=-1;for(let v=0;v<p.length&&!(p[v].ymin>y);v++)k=v;p.splice(0,k+1).forEach((v=>{m.push({s:y,edge:v})}))}if(m=m.filter((k=>!(k.edge.ymax<=y))),m.sort(((k,v)=>k.edge.x===v.edge.x?0:(k.edge.x-v.edge.x)/Math.abs(k.edge.x-v.edge.x))),(h!==1||x%u==0)&&m.length>1)for(let k=0;k<m.length;k+=2){const v=k+1;if(v>=m.length)break;const _=m[k].edge,C=m[v].edge;g.push([[Math.round(_.x),y],[Math.round(C.x),y]])}y+=h,m.forEach((k=>{k.edge.x=k.edge.x+h*k.edge.islope})),x++}return g})(a,i,n);if(s){for(const c of a)Pc(c,o,-s);(function(c,u,h){const f=[];c.forEach((g=>f.push(...g))),Pc(f,u,h)})(l,o,-s)}return l}function Na(e,t){var r;const n=t.hachureAngle+90;let s=t.hachureGap;s<0&&(s=4*t.strokeWidth),s=Math.round(Math.max(s,.1));let i=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(i=s),L3(e,s,n,i||1)}class Fd{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){const n=Na(t,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(t,r){const n=[];for(const s of t)n.push(...this.helper.doubleLineOps(s[0][0],s[0][1],s[1][0],s[1][1],r));return n}}function Rl(e){const t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}class $3 extends Fd{fillPolygons(t,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const s=Na(t,Object.assign({},r,{hachureGap:n})),i=Math.PI/180*r.hachureAngle,a=[],o=.5*n*Math.cos(i),l=.5*n*Math.sin(i);for(const[c,u]of s)Rl([c,u])&&a.push([[c[0]-o,c[1]+l],[...u]],[[c[0]+o,c[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(a,r)}}}class D3 extends Fd{fillPolygons(t,r){const n=this._fillPolygons(t,r),s=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),i=this._fillPolygons(t,s);return n.ops=n.ops.concat(i.ops),n}}class B3{constructor(t){this.helper=t}fillPolygons(t,r){const n=Na(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(t,r){const n=[];let s=r.hachureGap;s<0&&(s=4*r.strokeWidth),s=Math.max(s,.1);let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);const a=s/4;for(const o of t){const l=Rl(o),c=l/s,u=Math.ceil(c)-1,h=l-u*s,f=(o[0][0]+o[1][0])/2-s/4,g=Math.min(o[0][1],o[1][1]);for(let p=0;p<u;p++){const m=g+h+p*s,y=f-a+2*Math.random()*a,x=m-a+2*Math.random()*a,k=this.helper.ellipse(y,x,i,i,r);n.push(...k.ops)}}return{type:"fillSketch",ops:n}}}class R3{constructor(t){this.helper=t}fillPolygons(t,r){const n=Na(t,r);return{type:"fillSketch",ops:this.dashedLine(n,r)}}dashedLine(t,r){const n=r.dashOffset<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashOffset,s=r.dashGap<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashGap,i=[];return t.forEach((a=>{const o=Rl(a),l=Math.floor(o/(n+s)),c=(o+s-l*(n+s))/2;let u=a[0],h=a[1];u[0]>h[0]&&(u=a[1],h=a[0]);const f=Math.atan((h[1]-u[1])/(h[0]-u[0]));for(let g=0;g<l;g++){const p=g*(n+s),m=p+n,y=[u[0]+p*Math.cos(f)+c*Math.cos(f),u[1]+p*Math.sin(f)+c*Math.sin(f)],x=[u[0]+m*Math.cos(f)+c*Math.cos(f),u[1]+m*Math.sin(f)+c*Math.sin(f)];i.push(...this.helper.doubleLineOps(y[0],y[1],x[0],x[1],r))}})),i}}class P3{constructor(t){this.helper=t}fillPolygons(t,r){const n=r.hachureGap<0?4*r.strokeWidth:r.hachureGap,s=r.zigzagOffset<0?n:r.zigzagOffset,i=Na(t,r=Object.assign({},r,{hachureGap:n+s}));return{type:"fillSketch",ops:this.zigzagLines(i,s,r)}}zigzagLines(t,r,n){const s=[];return t.forEach((i=>{const a=Rl(i),o=Math.round(a/(2*r));let l=i[0],c=i[1];l[0]>c[0]&&(l=i[1],c=i[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let h=0;h<o;h++){const f=2*h*r,g=2*(h+1)*r,p=Math.sqrt(2*Math.pow(r,2)),m=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],y=[l[0]+g*Math.cos(u),l[1]+g*Math.sin(u)],x=[m[0]+p*Math.cos(u+Math.PI/4),m[1]+p*Math.sin(u+Math.PI/4)];s.push(...this.helper.doubleLineOps(m[0],m[1],x[0],x[1],n),...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],n))}})),s}}const Zt={};class F3{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const O3=0,Fc=1,rp=2,Xa={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Oc(e,t){return e.type===t}function Od(e){const t=[],r=(function(a){const o=new Array;for(;a!=="";)if(a.match(/^([ \t\r\n,]+)/))a=a.substr(RegExp.$1.length);else if(a.match(/^([aAcChHlLmMqQsStTvVzZ])/))o[o.length]={type:O3,text:RegExp.$1},a=a.substr(RegExp.$1.length);else{if(!a.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];o[o.length]={type:Fc,text:`${parseFloat(RegExp.$1)}`},a=a.substr(RegExp.$1.length)}return o[o.length]={type:rp,text:""},o})(e);let n="BOD",s=0,i=r[s];for(;!Oc(i,rp);){let a=0;const o=[];if(n==="BOD"){if(i.text!=="M"&&i.text!=="m")return Od("M0,0"+e);s++,a=Xa[i.text],n=i.text}else Oc(i,Fc)?a=Xa[n]:(s++,a=Xa[i.text],n=i.text);if(!(s+a<r.length))throw new Error("Path data ended short");for(let l=s;l<s+a;l++){const c=r[l];if(!Oc(c,Fc))throw new Error("Param not a number: "+n+","+c.text);o[o.length]=+c.text}if(typeof Xa[n]!="number")throw new Error("Bad segment: "+n);{const l={key:n,data:o};t.push(l),s+=a,i=r[s],n==="M"&&(n="L"),n==="m"&&(n="l")}}return t}function kk(e){let t=0,r=0,n=0,s=0;const i=[];for(const{key:a,data:o}of e)switch(a){case"M":i.push({key:"M",data:[...o]}),[t,r]=o,[n,s]=o;break;case"m":t+=o[0],r+=o[1],i.push({key:"M",data:[t,r]}),n=t,s=r;break;case"L":i.push({key:"L",data:[...o]}),[t,r]=o;break;case"l":t+=o[0],r+=o[1],i.push({key:"L",data:[t,r]});break;case"C":i.push({key:"C",data:[...o]}),t=o[4],r=o[5];break;case"c":{const l=o.map(((c,u)=>u%2?c+r:c+t));i.push({key:"C",data:l}),t=l[4],r=l[5];break}case"Q":i.push({key:"Q",data:[...o]}),t=o[2],r=o[3];break;case"q":{const l=o.map(((c,u)=>u%2?c+r:c+t));i.push({key:"Q",data:l}),t=l[2],r=l[3];break}case"A":i.push({key:"A",data:[...o]}),t=o[5],r=o[6];break;case"a":t+=o[5],r+=o[6],i.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],t,r]});break;case"H":i.push({key:"H",data:[...o]}),t=o[0];break;case"h":t+=o[0],i.push({key:"H",data:[t]});break;case"V":i.push({key:"V",data:[...o]}),r=o[0];break;case"v":r+=o[0],i.push({key:"V",data:[r]});break;case"S":i.push({key:"S",data:[...o]}),t=o[2],r=o[3];break;case"s":{const l=o.map(((c,u)=>u%2?c+r:c+t));i.push({key:"S",data:l}),t=l[2],r=l[3];break}case"T":i.push({key:"T",data:[...o]}),t=o[0],r=o[1];break;case"t":t+=o[0],r+=o[1],i.push({key:"T",data:[t,r]});break;case"Z":case"z":i.push({key:"Z",data:[]}),t=n,r=s}return i}function wk(e){const t=[];let r="",n=0,s=0,i=0,a=0,o=0,l=0;for(const{key:c,data:u}of e){switch(c){case"M":t.push({key:"M",data:[...u]}),[n,s]=u,[i,a]=u;break;case"C":t.push({key:"C",data:[...u]}),n=u[4],s=u[5],o=u[2],l=u[3];break;case"L":t.push({key:"L",data:[...u]}),[n,s]=u;break;case"H":n=u[0],t.push({key:"L",data:[n,s]});break;case"V":s=u[0],t.push({key:"L",data:[n,s]});break;case"S":{let h=0,f=0;r==="C"||r==="S"?(h=n+(n-o),f=s+(s-l)):(h=n,f=s),t.push({key:"C",data:[h,f,...u]}),o=u[0],l=u[1],n=u[2],s=u[3];break}case"T":{const[h,f]=u;let g=0,p=0;r==="Q"||r==="T"?(g=n+(n-o),p=s+(s-l)):(g=n,p=s);const m=n+2*(g-n)/3,y=s+2*(p-s)/3,x=h+2*(g-h)/3,k=f+2*(p-f)/3;t.push({key:"C",data:[m,y,x,k,h,f]}),o=g,l=p,n=h,s=f;break}case"Q":{const[h,f,g,p]=u,m=n+2*(h-n)/3,y=s+2*(f-s)/3,x=g+2*(h-g)/3,k=p+2*(f-p)/3;t.push({key:"C",data:[m,y,x,k,g,p]}),o=h,l=f,n=g,s=p;break}case"A":{const h=Math.abs(u[0]),f=Math.abs(u[1]),g=u[2],p=u[3],m=u[4],y=u[5],x=u[6];h===0||f===0?(t.push({key:"C",data:[n,s,y,x,y,x]}),n=y,s=x):(n!==y||s!==x)&&(vk(n,s,y,x,h,f,g,p,m).forEach((function(k){t.push({key:"C",data:k})})),n=y,s=x);break}case"Z":t.push({key:"Z",data:[]}),n=i,s=a}r=c}return t}function Ai(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function vk(e,t,r,n,s,i,a,o,l,c){const u=(h=a,Math.PI*h/180);var h;let f=[],g=0,p=0,m=0,y=0;if(c)[g,p,m,y]=c;else{[e,t]=Ai(e,t,-u),[r,n]=Ai(r,n,-u);const P=(e-r)/2,$=(t-n)/2;let R=P*P/(s*s)+$*$/(i*i);R>1&&(R=Math.sqrt(R),s*=R,i*=R);const I=s*s,O=i*i,W=I*O-I*$*$-O*P*P,Z=I*$*$+O*P*P,E=(o===l?-1:1)*Math.sqrt(Math.abs(W/Z));m=E*s*$/i+(e+r)/2,y=E*-i*P/s+(t+n)/2,g=Math.asin(parseFloat(((t-y)/i).toFixed(9))),p=Math.asin(parseFloat(((n-y)/i).toFixed(9))),e<m&&(g=Math.PI-g),r<m&&(p=Math.PI-p),g<0&&(g=2*Math.PI+g),p<0&&(p=2*Math.PI+p),l&&g>p&&(g-=2*Math.PI),!l&&p>g&&(p-=2*Math.PI)}let x=p-g;if(Math.abs(x)>120*Math.PI/180){const P=p,$=r,R=n;p=l&&p>g?g+120*Math.PI/180*1:g+120*Math.PI/180*-1,f=vk(r=m+s*Math.cos(p),n=y+i*Math.sin(p),$,R,s,i,a,0,l,[p,P,m,y])}x=p-g;const k=Math.cos(g),v=Math.sin(g),_=Math.cos(p),C=Math.sin(p),w=Math.tan(x/4),S=4/3*s*w,F=4/3*i*w,A=[e,t],T=[e+S*v,t-F*k],j=[r+S*C,n-F*_],M=[r,n];if(T[0]=2*A[0]-T[0],T[1]=2*A[1]-T[1],c)return[T,j,M].concat(f);{f=[T,j,M].concat(f);const P=[];for(let $=0;$<f.length;$+=3){const R=Ai(f[$][0],f[$][1],u),I=Ai(f[$+1][0],f[$+1][1],u),O=Ai(f[$+2][0],f[$+2][1],u);P.push([R[0],R[1],I[0],I[1],O[0],O[1]])}return P}}const z3={randOffset:function(e,t){return _e(e,t)},randOffsetWithRange:function(e,t,r){return tl(e,t,r)},ellipse:function(e,t,r,n,s){const i=Sk(r,n,s);return Zu(e,t,s,i).opset},doubleLineOps:function(e,t,r,n,s){return An(e,t,r,n,s,!0)}};function Ck(e,t,r,n,s){return{type:"path",ops:An(e,t,r,n,s)}}function mo(e,t,r){const n=(e||[]).length;if(n>2){const s=[];for(let i=0;i<n-1;i++)s.push(...An(e[i][0],e[i][1],e[i+1][0],e[i+1][1],r));return t&&s.push(...An(e[n-1][0],e[n-1][1],e[0][0],e[0][1],r)),{type:"path",ops:s}}return n===2?Ck(e[0][0],e[0][1],e[1][0],e[1][1],r):{type:"path",ops:[]}}function W3(e,t,r,n,s){return(function(i,a){return mo(i,!0,a)})([[e,t],[e+r,t],[e+r,t+n],[e,t+n]],s)}function np(e,t){if(e.length){const r=typeof e[0][0]=="number"?[e]:e,n=Ka(r[0],1*(1+.2*t.roughness),t),s=t.disableMultiStroke?[]:Ka(r[0],1.5*(1+.22*t.roughness),ap(t));for(let i=1;i<r.length;i++){const a=r[i];if(a.length){const o=Ka(a,1*(1+.2*t.roughness),t),l=t.disableMultiStroke?[]:Ka(a,1.5*(1+.22*t.roughness),ap(t));for(const c of o)c.op!=="move"&&n.push(c);for(const c of l)c.op!=="move"&&s.push(c)}}return{type:"path",ops:n.concat(s)}}return{type:"path",ops:[]}}function Sk(e,t,r){const n=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),s=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*n)),i=2*Math.PI/s;let a=Math.abs(e/2),o=Math.abs(t/2);const l=1-r.curveFitting;return a+=_e(a*l,r),o+=_e(o*l,r),{increment:i,rx:a,ry:o}}function Zu(e,t,r,n){const[s,i]=op(n.increment,e,t,n.rx,n.ry,1,n.increment*tl(.1,tl(.4,1,r),r),r);let a=rl(s,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[o]=op(n.increment,e,t,n.rx,n.ry,1.5,0,r),l=rl(o,null,r);a=a.concat(l)}return{estimatedPoints:i,opset:{type:"path",ops:a}}}function sp(e,t,r,n,s,i,a,o,l){const c=e,u=t;let h=Math.abs(r/2),f=Math.abs(n/2);h+=_e(.01*h,l),f+=_e(.01*f,l);let g=s,p=i;for(;g<0;)g+=2*Math.PI,p+=2*Math.PI;p-g>2*Math.PI&&(g=0,p=2*Math.PI);const m=2*Math.PI/l.curveStepCount,y=Math.min(m/2,(p-g)/2),x=lp(y,c,u,h,f,g,p,1,l);if(!l.disableMultiStroke){const k=lp(y,c,u,h,f,g,p,1.5,l);x.push(...k)}return a&&(o?x.push(...An(c,u,c+h*Math.cos(g),u+f*Math.sin(g),l),...An(c,u,c+h*Math.cos(p),u+f*Math.sin(p),l)):x.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+h*Math.cos(g),u+f*Math.sin(g)]})),{type:"path",ops:x}}function ip(e,t){const r=wk(kk(Od(e))),n=[];let s=[0,0],i=[0,0];for(const{key:a,data:o}of r)switch(a){case"M":i=[o[0],o[1]],s=[o[0],o[1]];break;case"L":n.push(...An(i[0],i[1],o[0],o[1],t)),i=[o[0],o[1]];break;case"C":{const[l,c,u,h,f,g]=o;n.push(...H3(l,c,u,h,f,g,i,t)),i=[f,g];break}case"Z":n.push(...An(i[0],i[1],s[0],s[1],t)),i=[s[0],s[1]]}return{type:"path",ops:n}}function zc(e,t){const r=[];for(const n of e)if(n.length){const s=t.maxRandomnessOffset||0,i=n.length;if(i>2){r.push({op:"move",data:[n[0][0]+_e(s,t),n[0][1]+_e(s,t)]});for(let a=1;a<i;a++)r.push({op:"lineTo",data:[n[a][0]+_e(s,t),n[a][1]+_e(s,t)]})}}return{type:"fillPath",ops:r}}function Ns(e,t){return(function(r,n){let s=r.fillStyle||"hachure";if(!Zt[s])switch(s){case"zigzag":Zt[s]||(Zt[s]=new $3(n));break;case"cross-hatch":Zt[s]||(Zt[s]=new D3(n));break;case"dots":Zt[s]||(Zt[s]=new B3(n));break;case"dashed":Zt[s]||(Zt[s]=new R3(n));break;case"zigzag-line":Zt[s]||(Zt[s]=new P3(n));break;default:s="hachure",Zt[s]||(Zt[s]=new Fd(n))}return Zt[s]})(t,z3).fillPolygons(e,t)}function ap(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function _k(e){return e.randomizer||(e.randomizer=new F3(e.seed||0)),e.randomizer.next()}function tl(e,t,r,n=1){return r.roughness*n*(_k(r)*(t-e)+e)}function _e(e,t,r=1){return tl(-e,e,t,r)}function An(e,t,r,n,s,i=!1){const a=i?s.disableMultiStrokeFill:s.disableMultiStroke,o=Ju(e,t,r,n,s,!0,!1);if(a)return o;const l=Ju(e,t,r,n,s,!0,!0);return o.concat(l)}function Ju(e,t,r,n,s,i,a){const o=Math.pow(e-r,2)+Math.pow(t-n,2),l=Math.sqrt(o);let c=1;c=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=s.maxRandomnessOffset||0;u*u*100>o&&(u=l/10);const h=u/2,f=.2+.2*_k(s);let g=s.bowing*s.maxRandomnessOffset*(n-t)/200,p=s.bowing*s.maxRandomnessOffset*(e-r)/200;g=_e(g,s,c),p=_e(p,s,c);const m=[],y=()=>_e(h,s,c),x=()=>_e(u,s,c),k=s.preserveVertices;return a?m.push({op:"move",data:[e+(k?0:y()),t+(k?0:y())]}):m.push({op:"move",data:[e+(k?0:_e(u,s,c)),t+(k?0:_e(u,s,c))]}),a?m.push({op:"bcurveTo",data:[g+e+(r-e)*f+y(),p+t+(n-t)*f+y(),g+e+2*(r-e)*f+y(),p+t+2*(n-t)*f+y(),r+(k?0:y()),n+(k?0:y())]}):m.push({op:"bcurveTo",data:[g+e+(r-e)*f+x(),p+t+(n-t)*f+x(),g+e+2*(r-e)*f+x(),p+t+2*(n-t)*f+x(),r+(k?0:x()),n+(k?0:x())]}),m}function Ka(e,t,r){if(!e.length)return[];const n=[];n.push([e[0][0]+_e(t,r),e[0][1]+_e(t,r)]),n.push([e[0][0]+_e(t,r),e[0][1]+_e(t,r)]);for(let s=1;s<e.length;s++)n.push([e[s][0]+_e(t,r),e[s][1]+_e(t,r)]),s===e.length-1&&n.push([e[s][0]+_e(t,r),e[s][1]+_e(t,r)]);return rl(n,null,r)}function rl(e,t,r){const n=e.length,s=[];if(n>3){const i=[],a=1-r.curveTightness;s.push({op:"move",data:[e[1][0],e[1][1]]});for(let o=1;o+2<n;o++){const l=e[o];i[0]=[l[0],l[1]],i[1]=[l[0]+(a*e[o+1][0]-a*e[o-1][0])/6,l[1]+(a*e[o+1][1]-a*e[o-1][1])/6],i[2]=[e[o+1][0]+(a*e[o][0]-a*e[o+2][0])/6,e[o+1][1]+(a*e[o][1]-a*e[o+2][1])/6],i[3]=[e[o+1][0],e[o+1][1]],s.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}}else n===3?(s.push({op:"move",data:[e[1][0],e[1][1]]}),s.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):n===2&&s.push(...Ju(e[0][0],e[0][1],e[1][0],e[1][1],r,!0,!0));return s}function op(e,t,r,n,s,i,a,o){const l=[],c=[];if(o.roughness===0){e/=4,c.push([t+n*Math.cos(-e),r+s*Math.sin(-e)]);for(let u=0;u<=2*Math.PI;u+=e){const h=[t+n*Math.cos(u),r+s*Math.sin(u)];l.push(h),c.push(h)}c.push([t+n*Math.cos(0),r+s*Math.sin(0)]),c.push([t+n*Math.cos(e),r+s*Math.sin(e)])}else{const u=_e(.5,o)-Math.PI/2;c.push([_e(i,o)+t+.9*n*Math.cos(u-e),_e(i,o)+r+.9*s*Math.sin(u-e)]);const h=2*Math.PI+u-.01;for(let f=u;f<h;f+=e){const g=[_e(i,o)+t+n*Math.cos(f),_e(i,o)+r+s*Math.sin(f)];l.push(g),c.push(g)}c.push([_e(i,o)+t+n*Math.cos(u+2*Math.PI+.5*a),_e(i,o)+r+s*Math.sin(u+2*Math.PI+.5*a)]),c.push([_e(i,o)+t+.98*n*Math.cos(u+a),_e(i,o)+r+.98*s*Math.sin(u+a)]),c.push([_e(i,o)+t+.9*n*Math.cos(u+.5*a),_e(i,o)+r+.9*s*Math.sin(u+.5*a)])}return[c,l]}function lp(e,t,r,n,s,i,a,o,l){const c=i+_e(.1,l),u=[];u.push([_e(o,l)+t+.9*n*Math.cos(c-e),_e(o,l)+r+.9*s*Math.sin(c-e)]);for(let h=c;h<=a;h+=e)u.push([_e(o,l)+t+n*Math.cos(h),_e(o,l)+r+s*Math.sin(h)]);return u.push([t+n*Math.cos(a),r+s*Math.sin(a)]),u.push([t+n*Math.cos(a),r+s*Math.sin(a)]),rl(u,null,l)}function H3(e,t,r,n,s,i,a,o){const l=[],c=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3];let u=[0,0];const h=o.disableMultiStroke?1:2,f=o.preserveVertices;for(let g=0;g<h;g++)g===0?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(f?0:_e(c[0],o)),a[1]+(f?0:_e(c[0],o))]}),u=f?[s,i]:[s+_e(c[g],o),i+_e(c[g],o)],l.push({op:"bcurveTo",data:[e+_e(c[g],o),t+_e(c[g],o),r+_e(c[g],o),n+_e(c[g],o),u[0],u[1]]});return l}function Mi(e){return[...e]}function cp(e,t=0){const r=e.length;if(r<3)throw new Error("A curve must have at least three points.");const n=[];if(r===3)n.push(Mi(e[0]),Mi(e[1]),Mi(e[2]),Mi(e[2]));else{const s=[];s.push(e[0],e[0]);for(let o=1;o<e.length;o++)s.push(e[o]),o===e.length-1&&s.push(e[o]);const i=[],a=1-t;n.push(Mi(s[0]));for(let o=1;o+2<s.length;o++){const l=s[o];i[0]=[l[0],l[1]],i[1]=[l[0]+(a*s[o+1][0]-a*s[o-1][0])/6,l[1]+(a*s[o+1][1]-a*s[o-1][1])/6],i[2]=[s[o+1][0]+(a*s[o][0]-a*s[o+2][0])/6,s[o+1][1]+(a*s[o][1]-a*s[o+2][1])/6],i[3]=[s[o+1][0],s[o+1][1]],n.push(i[1],i[2],i[3])}}return n}function xo(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function q3(e,t,r){const n=xo(t,r);if(n===0)return xo(e,t);let s=((e[0]-t[0])*(r[0]-t[0])+(e[1]-t[1])*(r[1]-t[1]))/n;return s=Math.max(0,Math.min(1,s)),xo(e,qn(t,r,s))}function qn(e,t,r){return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function eh(e,t,r,n){const s=n||[];if((function(o,l){const c=o[l+0],u=o[l+1],h=o[l+2],f=o[l+3];let g=3*u[0]-2*c[0]-f[0];g*=g;let p=3*u[1]-2*c[1]-f[1];p*=p;let m=3*h[0]-2*f[0]-c[0];m*=m;let y=3*h[1]-2*f[1]-c[1];return y*=y,g<m&&(g=m),p<y&&(p=y),g+p})(e,t)<r){const o=e[t+0];s.length?(i=s[s.length-1],a=o,Math.sqrt(xo(i,a))>1&&s.push(o)):s.push(o),s.push(e[t+3])}else{const l=e[t+0],c=e[t+1],u=e[t+2],h=e[t+3],f=qn(l,c,.5),g=qn(c,u,.5),p=qn(u,h,.5),m=qn(f,g,.5),y=qn(g,p,.5),x=qn(m,y,.5);eh([l,f,m,x],0,r,s),eh([x,y,p,h],0,r,s)}var i,a;return s}function U3(e,t){return nl(e,0,e.length,t)}function nl(e,t,r,n,s){const i=s||[],a=e[t],o=e[r-1];let l=0,c=1;for(let u=t+1;u<r-1;++u){const h=q3(e[u],a,o);h>l&&(l=h,c=u)}return Math.sqrt(l)>n?(nl(e,t,c+1,n,i),nl(e,c,r,n,i)):(i.length||i.push(a),i.push(o)),i}function Wc(e,t=.15,r){const n=[],s=(e.length-1)/3;for(let i=0;i<s;i++)eh(e,3*i,t,n);return r&&r>0?nl(n,0,n.length,r):n}const sr="none";class sl{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,r,n){return{shape:t,sets:r||[],options:n||this.defaultOptions}}line(t,r,n,s,i){const a=this._o(i);return this._d("line",[Ck(t,r,n,s,a)],a)}rectangle(t,r,n,s,i){const a=this._o(i),o=[],l=W3(t,r,n,s,a);if(a.fill){const c=[[t,r],[t+n,r],[t+n,r+s],[t,r+s]];a.fillStyle==="solid"?o.push(zc([c],a)):o.push(Ns([c],a))}return a.stroke!==sr&&o.push(l),this._d("rectangle",o,a)}ellipse(t,r,n,s,i){const a=this._o(i),o=[],l=Sk(n,s,a),c=Zu(t,r,a,l);if(a.fill)if(a.fillStyle==="solid"){const u=Zu(t,r,a,l).opset;u.type="fillPath",o.push(u)}else o.push(Ns([c.estimatedPoints],a));return a.stroke!==sr&&o.push(c.opset),this._d("ellipse",o,a)}circle(t,r,n,s){const i=this.ellipse(t,r,n,n,s);return i.shape="circle",i}linearPath(t,r){const n=this._o(r);return this._d("linearPath",[mo(t,!1,n)],n)}arc(t,r,n,s,i,a,o=!1,l){const c=this._o(l),u=[],h=sp(t,r,n,s,i,a,o,!0,c);if(o&&c.fill)if(c.fillStyle==="solid"){const f=Object.assign({},c);f.disableMultiStroke=!0;const g=sp(t,r,n,s,i,a,!0,!1,f);g.type="fillPath",u.push(g)}else u.push((function(f,g,p,m,y,x,k){const v=f,_=g;let C=Math.abs(p/2),w=Math.abs(m/2);C+=_e(.01*C,k),w+=_e(.01*w,k);let S=y,F=x;for(;S<0;)S+=2*Math.PI,F+=2*Math.PI;F-S>2*Math.PI&&(S=0,F=2*Math.PI);const A=(F-S)/k.curveStepCount,T=[];for(let j=S;j<=F;j+=A)T.push([v+C*Math.cos(j),_+w*Math.sin(j)]);return T.push([v+C*Math.cos(F),_+w*Math.sin(F)]),T.push([v,_]),Ns([T],k)})(t,r,n,s,i,a,c));return c.stroke!==sr&&u.push(h),this._d("arc",u,c)}curve(t,r){const n=this._o(r),s=[],i=np(t,n);if(n.fill&&n.fill!==sr)if(n.fillStyle==="solid"){const a=np(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));s.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{const a=[],o=t;if(o.length){const l=typeof o[0][0]=="number"?[o]:o;for(const c of l)c.length<3?a.push(...c):c.length===3?a.push(...Wc(cp([c[0],c[0],c[1],c[2]]),10,(1+n.roughness)/2)):a.push(...Wc(cp(c),10,(1+n.roughness)/2))}a.length&&s.push(Ns([a],n))}return n.stroke!==sr&&s.push(i),this._d("curve",s,n)}polygon(t,r){const n=this._o(r),s=[],i=mo(t,!0,n);return n.fill&&(n.fillStyle==="solid"?s.push(zc([t],n)):s.push(Ns([t],n))),n.stroke!==sr&&s.push(i),this._d("polygon",s,n)}path(t,r){const n=this._o(r),s=[];if(!t)return this._d("path",s,n);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const i=n.fill&&n.fill!=="transparent"&&n.fill!==sr,a=n.stroke!==sr,o=!!(n.simplification&&n.simplification<1),l=(function(u,h,f){const g=wk(kk(Od(u))),p=[];let m=[],y=[0,0],x=[];const k=()=>{x.length>=4&&m.push(...Wc(x,h)),x=[]},v=()=>{k(),m.length&&(p.push(m),m=[])};for(const{key:C,data:w}of g)switch(C){case"M":v(),y=[w[0],w[1]],m.push(y);break;case"L":k(),m.push([w[0],w[1]]);break;case"C":if(!x.length){const S=m.length?m[m.length-1]:y;x.push([S[0],S[1]])}x.push([w[0],w[1]]),x.push([w[2],w[3]]),x.push([w[4],w[5]]);break;case"Z":k(),m.push([y[0],y[1]])}if(v(),!f)return p;const _=[];for(const C of p){const w=U3(C,f);w.length&&_.push(w)}return _})(t,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),c=ip(t,n);if(i)if(n.fillStyle==="solid")if(l.length===1){const u=ip(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));s.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else s.push(zc(l,n));else s.push(Ns(l,n));return a&&(o?l.forEach((u=>{s.push(mo(u,!1,n))})):s.push(c)),this._d("path",s,n)}opsToPath(t,r){let n="";for(const s of t.ops){const i=typeof r=="number"&&r>=0?s.data.map((a=>+a.toFixed(r))):s.data;switch(s.op){case"move":n+=`M${i[0]} ${i[1]} `;break;case"bcurveTo":n+=`C${i[0]} ${i[1]}, ${i[2]} ${i[3]}, ${i[4]} ${i[5]} `;break;case"lineTo":n+=`L${i[0]} ${i[1]} `}}return n.trim()}toPaths(t){const r=t.sets||[],n=t.options||this.defaultOptions,s=[];for(const i of r){let a=null;switch(i.type){case"path":a={d:this.opsToPath(i),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:sr};break;case"fillPath":a={d:this.opsToPath(i),stroke:sr,strokeWidth:0,fill:n.fill||sr};break;case"fillSketch":a=this.fillSketch(i,n)}a&&s.push(a)}return s}fillSketch(t,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||sr,strokeWidth:n,fill:sr}}_mergedShape(t){return t.filter(((r,n)=>n===0||r.op!=="move"))}}class V3{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new sl(r)}draw(t){const r=t.sets||[],n=t.options||this.getDefaultOptions(),s=this.ctx,i=t.options.fixedDecimalPlaceDigits;for(const a of r)switch(a.type){case"path":s.save(),s.strokeStyle=n.stroke==="none"?"transparent":n.stroke,s.lineWidth=n.strokeWidth,n.strokeLineDash&&s.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(s.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(s,a,i),s.restore();break;case"fillPath":{s.save(),s.fillStyle=n.fill||"";const o=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(s,a,i,o),s.restore();break}case"fillSketch":this.fillSketch(s,a,n)}}fillSketch(t,r,n){let s=n.fillWeight;s<0&&(s=n.strokeWidth/2),t.save(),n.fillLineDash&&t.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(t.lineDashOffset=n.fillLineDashOffset),t.strokeStyle=n.fill||"",t.lineWidth=s,this._drawToContext(t,r,n.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,n,s="nonzero"){t.beginPath();for(const i of r.ops){const a=typeof n=="number"&&n>=0?i.data.map((o=>+o.toFixed(n))):i.data;switch(i.op){case"move":t.moveTo(a[0],a[1]);break;case"bcurveTo":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":t.lineTo(a[0],a[1])}}r.type==="fillPath"?t.fill(s):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,n,s,i){const a=this.gen.line(t,r,n,s,i);return this.draw(a),a}rectangle(t,r,n,s,i){const a=this.gen.rectangle(t,r,n,s,i);return this.draw(a),a}ellipse(t,r,n,s,i){const a=this.gen.ellipse(t,r,n,s,i);return this.draw(a),a}circle(t,r,n,s){const i=this.gen.circle(t,r,n,s);return this.draw(i),i}linearPath(t,r){const n=this.gen.linearPath(t,r);return this.draw(n),n}polygon(t,r){const n=this.gen.polygon(t,r);return this.draw(n),n}arc(t,r,n,s,i,a,o=!1,l){const c=this.gen.arc(t,r,n,s,i,a,o,l);return this.draw(c),c}curve(t,r){const n=this.gen.curve(t,r);return this.draw(n),n}path(t,r){const n=this.gen.path(t,r);return this.draw(n),n}}const Qa="http://www.w3.org/2000/svg";class G3{constructor(t,r){this.svg=t,this.gen=new sl(r)}draw(t){const r=t.sets||[],n=t.options||this.getDefaultOptions(),s=this.svg.ownerDocument||window.document,i=s.createElementNS(Qa,"g"),a=t.options.fixedDecimalPlaceDigits;for(const o of r){let l=null;switch(o.type){case"path":l=s.createElementNS(Qa,"path"),l.setAttribute("d",this.opsToPath(o,a)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=s.createElementNS(Qa,"path"),l.setAttribute("d",this.opsToPath(o,a)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(s,o,n)}l&&i.appendChild(l)}return i}fillSketch(t,r,n){let s=n.fillWeight;s<0&&(s=n.strokeWidth/2);const i=t.createElementNS(Qa,"path");return i.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),i.setAttribute("stroke",n.fill||""),i.setAttribute("stroke-width",s+""),i.setAttribute("fill","none"),n.fillLineDash&&i.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&i.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,n,s,i){const a=this.gen.line(t,r,n,s,i);return this.draw(a)}rectangle(t,r,n,s,i){const a=this.gen.rectangle(t,r,n,s,i);return this.draw(a)}ellipse(t,r,n,s,i){const a=this.gen.ellipse(t,r,n,s,i);return this.draw(a)}circle(t,r,n,s){const i=this.gen.circle(t,r,n,s);return this.draw(i)}linearPath(t,r){const n=this.gen.linearPath(t,r);return this.draw(n)}polygon(t,r){const n=this.gen.polygon(t,r);return this.draw(n)}arc(t,r,n,s,i,a,o=!1,l){const c=this.gen.arc(t,r,n,s,i,a,o,l);return this.draw(c)}curve(t,r){const n=this.gen.curve(t,r);return this.draw(n)}path(t,r){const n=this.gen.path(t,r);return this.draw(n)}}var ue={canvas:(e,t)=>new V3(e,t),svg:(e,t)=>new G3(e,t),generator:e=>new sl(e),newSeed:()=>sl.newSeed()},ve=b(async(e,t,r)=>{let n;const s=t.useHtmlLabels||wt(qe()?.htmlLabels);r?n=r:n="node default";const i=e.insert("g").attr("class",n).attr("id",t.domId||t.id),a=i.insert("g").attr("class","label").attr("style",$t(t.labelStyle));let o;t.label===void 0?o="":o=typeof t.label=="string"?t.label:t.label[0];const l=await Ln(a,mr(gs(o),qe()),{useHtmlLabels:s,width:t.width||qe().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img});let c=l.getBBox();const u=(t?.padding??0)/2;if(s){const h=l.children[0],f=Fe(l),g=h.getElementsByTagName("img");if(g){const p=o.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...g].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",p){const k=qe().fontSize?qe().fontSize:window.getComputedStyle(document.body).fontSize,v=5,[_=F0.fontSize]=Il(k),C=_*v+"px";m.style.minWidth=C,m.style.maxWidth=C}else m.style.width="100%";y(m)}b(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}c=h.getBoundingClientRect(),f.attr("width",c.width),f.attr("height",c.height)}return s?a.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"):a.attr("transform","translate(0, "+-c.height/2+")"),t.centerLabel&&a.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),a.insert("rect",":first-child"),{shapeSvg:i,bbox:c,halfPadding:u,label:a}},"labelHelper"),Hc=b(async(e,t,r)=>{const n=r.useHtmlLabels||wt(qe()?.flowchart?.htmlLabels),s=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),i=await Ln(s,mr(gs(t),qe()),{useHtmlLabels:n,width:r.width||qe()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let a=i.getBBox();const o=r.padding/2;if(wt(qe()?.flowchart?.htmlLabels)){const l=i.children[0],c=Fe(i);a=l.getBoundingClientRect(),c.attr("width",a.width),c.attr("height",a.height)}return n?s.attr("transform","translate("+-a.width/2+", "+-a.height/2+")"):s.attr("transform","translate(0, "+-a.height/2+")"),r.centerLabel&&s.attr("transform","translate("+-a.width/2+", "+-a.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:e,bbox:a,halfPadding:o,label:s}},"insertLabel"),ge=b((e,t)=>{const r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),ye=b((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");function Pe(e){const t=e.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}b(Pe,"createPathFromPoints");function Mn(e,t,r,n,s,i){const a=[],l=r-e,c=n-t,u=l/i,h=2*Math.PI/u,f=t+c/2;for(let g=0;g<=50;g++){const p=g/50,m=e+p*l,y=f+s*Math.sin(h*(m-e));a.push({x:m,y})}return a}b(Mn,"generateFullSineWavePoints");function ha(e,t,r,n,s,i){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:-g,y:-p})}return a}b(ha,"generateCirclePoints");var Y3=b((e,t)=>{var r=e.x,n=e.y,s=t.x-r,i=t.y-n,a=e.width/2,o=e.height/2,l,c;return Math.abs(i)*a>Math.abs(s)*o?(i<0&&(o=-o),l=i===0?0:o*s/i,c=o):(s<0&&(a=-a),l=a,c=s===0?0:a*i/s),{x:r+l,y:n+c}},"intersectRect"),oi=Y3;function Tk(e,t){t&&e.attr("style",t)}b(Tk,"applyStyle");async function Nk(e){const t=Fe(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),r=t.append("xhtml:div"),n=qe();let s=e.label;e.label&&Ys(e.label)&&(s=await Gh(e.label.replace(ni.lineBreakRegex,`
|
|
320
|
-
`),n));const a='<span class="'+(e.isNode?"nodeLabel":"edgeLabel")+'" '+(e.labelStyle?'style="'+e.labelStyle+'"':"")+">"+s+"</span>";return r.html(mr(a,n)),Tk(r,e.labelStyle),r.style("display","inline-block"),r.style("padding-right","1px"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}b(Nk,"addHtmlLabel");var X3=b(async(e,t,r,n)=>{let s=e||"";if(typeof s=="object"&&(s=s[0]),wt(qe().flowchart.htmlLabels)){s=s.replace(/\\n|\n/g,"<br />"),K.info("vertexText"+s);const i={isNode:n,label:gs(s).replace(/fa[blrs]?:fa-[\w-]+/g,o=>`<i class='${o.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await Nk(i)}else{const i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("style",t.replace("color:","fill:"));let a=[];typeof s=="string"?a=s.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(s)?a=s:a=[];for(const o of a){const l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),r?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=o.trim(),i.appendChild(l)}return i}},"createLabel"),Kn=X3,$n=b((e,t,r,n,s)=>["M",e+s,t,"H",e+r-s,"A",s,s,0,0,1,e+r,t+s,"V",t+n-s,"A",s,s,0,0,1,e+r-s,t+n,"H",e+s,"A",s,s,0,0,1,e,t+n-s,"V",t+s,"A",s,s,0,0,1,e+s,t,"Z"].join(" "),"createRoundedRectPathD"),Ek=b(async(e,t)=>{K.info("Creating subgraph rect for ",t.id,t);const r=qe(),{themeVariables:n,handDrawnSeed:s}=r,{clusterBkg:i,clusterBorder:a}=n,{labelStyles:o,nodeStyles:l,borderStyles:c,backgroundStyles:u}=de(t),h=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=wt(r.flowchart.htmlLabels),g=h.insert("g").attr("class","cluster-label "),p=await Ln(g,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0});let m=p.getBBox();if(wt(r.flowchart.htmlLabels)){const S=p.children[0],F=Fe(p);m=S.getBoundingClientRect(),F.attr("width",m.width),F.attr("height",m.height)}const y=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;const x=t.height,k=t.x-y/2,v=t.y-x/2;K.trace("Data ",t,JSON.stringify(t));let _;if(t.look==="handDrawn"){const S=ue.svg(h),F=he(t,{roughness:.7,fill:i,stroke:a,fillWeight:3,seed:s}),A=S.path($n(k,v,y,x,0),F);_=h.insert(()=>(K.debug("Rough node insert CXC",A),A),":first-child"),_.select("path:nth-child(2)").attr("style",c.join(";")),_.select("path").attr("style",u.join(";").replace("fill","stroke"))}else _=h.insert("rect",":first-child"),_.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",k).attr("y",v).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:C}=yd(r);if(g.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+C})`),o){const S=g.select("span");S&&S.attr("style",o)}const w=_.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(S){return oi(t,S)},{cluster:h,labelBBox:m}},"rect"),K3=b((e,t)=>{const r=e.insert("g").attr("class","note-cluster").attr("id",t.id),n=r.insert("rect",":first-child"),s=0*t.padding,i=s/2;n.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-i).attr("y",t.y-t.height/2-i).attr("width",t.width+s).attr("height",t.height+s).attr("fill","none");const a=n.node().getBBox();return t.width=a.width,t.height=a.height,t.intersect=function(o){return oi(t,o)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),Q3=b(async(e,t)=>{const r=qe(),{themeVariables:n,handDrawnSeed:s}=r,{altBackground:i,compositeBackground:a,compositeTitleBackground:o,nodeBorder:l}=n,c=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),u=c.insert("g",":first-child"),h=c.insert("g").attr("class","cluster-label");let f=c.append("rect");const g=h.node().appendChild(await Kn(t.label,t.labelStyle,void 0,!0));let p=g.getBBox();if(wt(r.flowchart.htmlLabels)){const A=g.children[0],T=Fe(g);p=A.getBoundingClientRect(),T.attr("width",p.width),T.attr("height",p.height)}const m=0*t.padding,y=m/2,x=(t.width<=p.width+t.padding?p.width+t.padding:t.width)+m;t.width<=p.width+t.padding?t.diff=(x-t.width)/2-t.padding:t.diff=-t.padding;const k=t.height+m,v=t.height+m-p.height-6,_=t.x-x/2,C=t.y-k/2;t.width=x;const w=t.y-t.height/2-y+p.height+2;let S;if(t.look==="handDrawn"){const A=t.cssClasses.includes("statediagram-cluster-alt"),T=ue.svg(c),j=t.rx||t.ry?T.path($n(_,C,x,k,10),{roughness:.7,fill:o,fillStyle:"solid",stroke:l,seed:s}):T.rectangle(_,C,x,k,{seed:s});S=c.insert(()=>j,":first-child");const M=T.rectangle(_,w,x,v,{fill:A?i:a,fillStyle:A?"hachure":"solid",stroke:l,seed:s});S=c.insert(()=>j,":first-child"),f=c.insert(()=>M)}else S=u.insert("rect",":first-child"),S.attr("class","outer").attr("x",_).attr("y",C).attr("width",x).attr("height",k).attr("data-look",t.look),f.attr("class","inner").attr("x",_).attr("y",w).attr("width",x).attr("height",v);h.attr("transform",`translate(${t.x-p.width/2}, ${C+1-(wt(r.flowchart.htmlLabels)?0:3)})`);const F=S.node().getBBox();return t.height=F.height,t.offsetX=0,t.offsetY=p.height-t.padding/2,t.labelBBox=p,t.intersect=function(A){return oi(t,A)},{cluster:c,labelBBox:p}},"roundedWithTitle"),Z3=b(async(e,t)=>{K.info("Creating subgraph rect for ",t.id,t);const r=qe(),{themeVariables:n,handDrawnSeed:s}=r,{clusterBkg:i,clusterBorder:a}=n,{labelStyles:o,nodeStyles:l,borderStyles:c,backgroundStyles:u}=de(t),h=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=wt(r.flowchart.htmlLabels),g=h.insert("g").attr("class","cluster-label "),p=await Ln(g,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width});let m=p.getBBox();if(wt(r.flowchart.htmlLabels)){const S=p.children[0],F=Fe(p);m=S.getBoundingClientRect(),F.attr("width",m.width),F.attr("height",m.height)}const y=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;const x=t.height,k=t.x-y/2,v=t.y-x/2;K.trace("Data ",t,JSON.stringify(t));let _;if(t.look==="handDrawn"){const S=ue.svg(h),F=he(t,{roughness:.7,fill:i,stroke:a,fillWeight:4,seed:s}),A=S.path($n(k,v,y,x,t.rx),F);_=h.insert(()=>(K.debug("Rough node insert CXC",A),A),":first-child"),_.select("path:nth-child(2)").attr("style",c.join(";")),_.select("path").attr("style",u.join(";").replace("fill","stroke"))}else _=h.insert("rect",":first-child"),_.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",k).attr("y",v).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:C}=yd(r);if(g.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+C})`),o){const S=g.select("span");S&&S.attr("style",o)}const w=_.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(S){return oi(t,S)},{cluster:h,labelBBox:m}},"kanbanSection"),J3=b((e,t)=>{const r=qe(),{themeVariables:n,handDrawnSeed:s}=r,{nodeBorder:i}=n,a=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),o=a.insert("g",":first-child"),l=0*t.padding,c=t.width+l;t.diff=-t.padding;const u=t.height+l,h=t.x-c/2,f=t.y-u/2;t.width=c;let g;if(t.look==="handDrawn"){const y=ue.svg(a).rectangle(h,f,c,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:i,seed:s});g=a.insert(()=>y,":first-child")}else g=o.insert("rect",":first-child"),g.attr("class","divider").attr("x",h).attr("y",f).attr("width",c).attr("height",u).attr("data-look",t.look);const p=g.node().getBBox();return t.height=p.height,t.offsetX=0,t.offsetY=0,t.intersect=function(m){return oi(t,m)},{cluster:a,labelBBox:{}}},"divider"),eB=Ek,tB={rect:Ek,squareRect:eB,roundedWithTitle:Q3,noteGroup:K3,divider:J3,kanbanSection:Z3},Ak=new Map,rB=b(async(e,t)=>{const r=t.shape||"rect",n=await tB[r](e,t);return Ak.set(t.id,n),n},"insertCluster"),P9=b(()=>{Ak=new Map},"clear");function Mk(e,t){return e.intersect(t)}b(Mk,"intersectNode");var nB=Mk;function jk(e,t,r,n){var s=e.x,i=e.y,a=s-n.x,o=i-n.y,l=Math.sqrt(t*t*o*o+r*r*a*a),c=Math.abs(t*r*a/l);n.x<s&&(c=-c);var u=Math.abs(t*r*o/l);return n.y<i&&(u=-u),{x:s+c,y:i+u}}b(jk,"intersectEllipse");var Ik=jk;function Lk(e,t,r){return Ik(e,t,t,r)}b(Lk,"intersectCircle");var sB=Lk;function $k(e,t,r,n){{const s=t.y-e.y,i=e.x-t.x,a=t.x*e.y-e.x*t.y,o=s*r.x+i*r.y+a,l=s*n.x+i*n.y+a,c=1e-6;if(o!==0&&l!==0&&th(o,l))return;const u=n.y-r.y,h=r.x-n.x,f=n.x*r.y-r.x*n.y,g=u*e.x+h*e.y+f,p=u*t.x+h*t.y+f;if(Math.abs(g)<c&&Math.abs(p)<c&&th(g,p))return;const m=s*h-u*i;if(m===0)return;const y=Math.abs(m/2);let x=i*f-h*a;const k=x<0?(x-y)/m:(x+y)/m;x=u*a-s*f;const v=x<0?(x-y)/m:(x+y)/m;return{x:k,y:v}}}b($k,"intersectLine");function th(e,t){return e*t>0}b(th,"sameSign");var iB=$k;function Dk(e,t,r){let n=e.x,s=e.y,i=[],a=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(u){a=Math.min(a,u.x),o=Math.min(o,u.y)}):(a=Math.min(a,t.x),o=Math.min(o,t.y));let l=n-e.width/2-a,c=s-e.height/2-o;for(let u=0;u<t.length;u++){let h=t[u],f=t[u<t.length-1?u+1:0],g=iB(e,r,{x:l+h.x,y:c+h.y},{x:l+f.x,y:c+f.y});g&&i.push(g)}return i.length?(i.length>1&&i.sort(function(u,h){let f=u.x-r.x,g=u.y-r.y,p=Math.sqrt(f*f+g*g),m=h.x-r.x,y=h.y-r.y,x=Math.sqrt(m*m+y*y);return p<x?-1:p===x?0:1}),i[0]):e}b(Dk,"intersectPolygon");var aB=Dk,ae={node:nB,circle:sB,ellipse:Ik,polygon:aB,rect:oi};function Bk(e,t){const{labelStyles:r}=de(t);t.labelStyle=r;const n=ye(t);let s=n;n||(s="anchor");const i=e.insert("g").attr("class",s).attr("id",t.domId||t.id),a=1,{cssStyles:o}=t,l=ue.svg(i),c=he(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(c.roughness=0);const u=l.circle(0,0,a*2,c),h=i.insert(()=>u,":first-child");return h.attr("class","anchor").attr("style",$t(o)),ge(t,h),t.intersect=function(f){return K.info("Circle intersect",t,a,f),ae.circle(t,a,f)},i}b(Bk,"anchor");function rh(e,t,r,n,s,i,a){const l=(e+r)/2,c=(t+n)/2,u=Math.atan2(n-t,r-e),h=(r-e)/2,f=(n-t)/2,g=h/s,p=f/i,m=Math.sqrt(g**2+p**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const y=Math.sqrt(1-m**2),x=l+y*i*Math.sin(u)*(a?-1:1),k=c-y*s*Math.cos(u)*(a?-1:1),v=Math.atan2((t-k)/i,(e-x)/s);let C=Math.atan2((n-k)/i,(r-x)/s)-v;a&&C<0&&(C+=2*Math.PI),!a&&C>0&&(C-=2*Math.PI);const w=[];for(let S=0;S<20;S++){const F=S/19,A=v+F*C,T=x+s*Math.cos(A),j=k+i*Math.sin(A);w.push({x:T,y:j})}return w}b(rh,"generateArcPoints");async function Rk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=i.width+t.padding+20,o=i.height+t.padding,l=o/2,c=l/(2.5+o/50),{cssStyles:u}=t,h=[{x:a/2,y:-o/2},{x:-a/2,y:-o/2},...rh(-a/2,-o/2,-a/2,o/2,c,l,!1),{x:a/2,y:o/2},...rh(a/2,o/2,a/2,-o/2,c,l,!0)],f=ue.svg(s),g=he(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=Pe(h),m=f.path(p,g),y=s.insert(()=>m,":first-child");return y.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",n),y.attr("transform",`translate(${c/2}, 0)`),ge(t,y),t.intersect=function(x){return ae.polygon(t,h,x)},s}b(Rk,"bowTieRect");function Dn(e,t,r,n){return e.insert("polygon",":first-child").attr("points",n.map(function(s){return s.x+","+s.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}b(Dn,"insertPolygonShape");async function Pk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=i.height+t.padding,o=12,l=i.width+t.padding+o,c=0,u=l,h=-a,f=0,g=[{x:c+o,y:h},{x:u,y:h},{x:u,y:f},{x:c,y:f},{x:c,y:h+o},{x:c+o,y:h}];let p;const{cssStyles:m}=t;if(t.look==="handDrawn"){const y=ue.svg(s),x=he(t,{}),k=Pe(g),v=y.path(k,x);p=s.insert(()=>v,":first-child").attr("transform",`translate(${-l/2}, ${a/2})`),m&&p.attr("style",m)}else p=Dn(s,l,a,g);return n&&p.attr("style",n),ge(t,p),t.intersect=function(y){return ae.polygon(t,g,y)},s}b(Pk,"card");function Fk(e,t){const{nodeStyles:r}=de(t);t.label="";const n=e.insert("g").attr("class",ye(t)).attr("id",t.domId??t.id),{cssStyles:s}=t,i=Math.max(28,t.width??0),a=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}],o=ue.svg(n),l=he(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Pe(a),u=o.path(c,l),h=n.insert(()=>u,":first-child");return s&&t.look!=="handDrawn"&&h.selectAll("path").attr("style",s),r&&t.look!=="handDrawn"&&h.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(f){return ae.polygon(t,a,f)},n}b(Fk,"choice");async function zd(e,t,r){const{labelStyles:n,nodeStyles:s}=de(t);t.labelStyle=n;const{shapeSvg:i,bbox:a,halfPadding:o}=await ve(e,t,ye(t)),l=r?.padding??o,c=a.width/2+l;let u;const{cssStyles:h}=t;if(t.look==="handDrawn"){const f=ue.svg(i),g=he(t,{}),p=f.circle(0,0,c*2,g);u=i.insert(()=>p,":first-child"),u.attr("class","basic label-container").attr("style",$t(h))}else u=i.insert("circle",":first-child").attr("class","basic label-container").attr("style",s).attr("r",c).attr("cx",0).attr("cy",0);return ge(t,u),t.calcIntersect=function(f,g){const p=f.width/2;return ae.circle(f,p,g)},t.intersect=function(f){return K.info("Circle intersect",t,c,f),ae.circle(t,c,f)},i}b(zd,"circle");function Ok(e){const t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=e*2,s={x:n/2*t,y:n/2*r},i={x:-(n/2)*t,y:n/2*r},a={x:-(n/2)*t,y:-(n/2)*r},o={x:n/2*t,y:-(n/2)*r};return`M ${i.x},${i.y} L ${o.x},${o.y}
|
|
321
|
-
M ${s.x},${s.y} L ${a.x},${a.y}`}b(Ok,"createLine");function zk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r,t.label="";const s=e.insert("g").attr("class",ye(t)).attr("id",t.domId??t.id),i=Math.max(30,t?.width??0),{cssStyles:a}=t,o=ue.svg(s),l=he(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=o.circle(0,0,i*2,l),u=Ok(i),h=o.path(u,l),f=s.insert(()=>c,":first-child");return f.insert(()=>h),a&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",a),n&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",n),ge(t,f),t.intersect=function(g){return K.info("crossedCircle intersect",t,{radius:i,point:g}),ae.circle(t,i,g)},s}b(zk,"crossedCircle");function Jr(e,t,r,n=100,s=0,i=180){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:-g,y:-p})}return a}b(Jr,"generateCirclePoints");async function Wk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,h=[...Jr(o/2,-l/2,c,30,-90,0),{x:-o/2-c,y:c},...Jr(o/2+c*2,-c,c,20,-180,-270),...Jr(o/2+c*2,c,c,20,-90,-180),{x:-o/2-c,y:-l/2},...Jr(o/2,l/2,c,20,0,90)],f=[{x:o/2,y:-l/2-c},{x:-o/2,y:-l/2-c},...Jr(o/2,-l/2,c,20,-90,0),{x:-o/2-c,y:-c},...Jr(o/2+o*.1,-c,c,20,-180,-270),...Jr(o/2+o*.1,c,c,20,-90,-180),{x:-o/2-c,y:l/2},...Jr(o/2,l/2,c,20,0,90),{x:-o/2,y:l/2+c},{x:o/2,y:l/2+c}],g=ue.svg(s),p=he(t,{fill:"none"});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const y=Pe(h).replace("Z",""),x=g.path(y,p),k=Pe(f),v=g.path(k,{...p}),_=s.insert("g",":first-child");return _.insert(()=>v,":first-child").attr("stroke-opacity",0),_.insert(()=>x,":first-child"),_.attr("class","text"),u&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${c}, 0)`),a.attr("transform",`translate(${-o/2+c-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),ge(t,_),t.intersect=function(C){return ae.polygon(t,f,C)},s}b(Wk,"curlyBraceLeft");function en(e,t,r,n=100,s=0,i=180){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:g,y:p})}return a}b(en,"generateCirclePoints");async function Hk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,h=[...en(o/2,-l/2,c,20,-90,0),{x:o/2+c,y:-c},...en(o/2+c*2,-c,c,20,-180,-270),...en(o/2+c*2,c,c,20,-90,-180),{x:o/2+c,y:l/2},...en(o/2,l/2,c,20,0,90)],f=[{x:-o/2,y:-l/2-c},{x:o/2,y:-l/2-c},...en(o/2,-l/2,c,20,-90,0),{x:o/2+c,y:-c},...en(o/2+c*2,-c,c,20,-180,-270),...en(o/2+c*2,c,c,20,-90,-180),{x:o/2+c,y:l/2},...en(o/2,l/2,c,20,0,90),{x:o/2,y:l/2+c},{x:-o/2,y:l/2+c}],g=ue.svg(s),p=he(t,{fill:"none"});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const y=Pe(h).replace("Z",""),x=g.path(y,p),k=Pe(f),v=g.path(k,{...p}),_=s.insert("g",":first-child");return _.insert(()=>v,":first-child").attr("stroke-opacity",0),_.insert(()=>x,":first-child"),_.attr("class","text"),u&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${-c}, 0)`),a.attr("transform",`translate(${-o/2+(t.padding??0)/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),ge(t,_),t.intersect=function(C){return ae.polygon(t,f,C)},s}b(Hk,"curlyBraceRight");function St(e,t,r,n=100,s=0,i=180){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:-g,y:-p})}return a}b(St,"generateCirclePoints");async function qk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,h=[...St(o/2,-l/2,c,30,-90,0),{x:-o/2-c,y:c},...St(o/2+c*2,-c,c,20,-180,-270),...St(o/2+c*2,c,c,20,-90,-180),{x:-o/2-c,y:-l/2},...St(o/2,l/2,c,20,0,90)],f=[...St(-o/2+c+c/2,-l/2,c,20,-90,-180),{x:o/2-c/2,y:c},...St(-o/2-c/2,-c,c,20,0,90),...St(-o/2-c/2,c,c,20,-90,0),{x:o/2-c/2,y:-c},...St(-o/2+c+c/2,l/2,c,30,-180,-270)],g=[{x:o/2,y:-l/2-c},{x:-o/2,y:-l/2-c},...St(o/2,-l/2,c,20,-90,0),{x:-o/2-c,y:-c},...St(o/2+c*2,-c,c,20,-180,-270),...St(o/2+c*2,c,c,20,-90,-180),{x:-o/2-c,y:l/2},...St(o/2,l/2,c,20,0,90),{x:-o/2,y:l/2+c},{x:o/2-c-c/2,y:l/2+c},...St(-o/2+c+c/2,-l/2,c,20,-90,-180),{x:o/2-c/2,y:c},...St(-o/2-c/2,-c,c,20,0,90),...St(-o/2-c/2,c,c,20,-90,0),{x:o/2-c/2,y:-c},...St(-o/2+c+c/2,l/2,c,30,-180,-270)],p=ue.svg(s),m=he(t,{fill:"none"});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const x=Pe(h).replace("Z",""),k=p.path(x,m),_=Pe(f).replace("Z",""),C=p.path(_,m),w=Pe(g),S=p.path(w,{...m}),F=s.insert("g",":first-child");return F.insert(()=>S,":first-child").attr("stroke-opacity",0),F.insert(()=>k,":first-child"),F.insert(()=>C,":first-child"),F.attr("class","text"),u&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",n),F.attr("transform",`translate(${c-c/4}, 0)`),a.attr("transform",`translate(${-o/2+(t.padding??0)/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),ge(t,F),t.intersect=function(A){return ae.polygon(t,g,A)},s}b(qk,"curlyBraces");async function Uk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=80,o=20,l=Math.max(a,(i.width+(t.padding??0)*2)*1.25,t?.width??0),c=Math.max(o,i.height+(t.padding??0)*2,t?.height??0),u=c/2,{cssStyles:h}=t,f=ue.svg(s),g=he(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=l,m=c,y=p-u,x=m/4,k=[{x:y,y:0},{x,y:0},{x:0,y:m/2},{x,y:m},{x:y,y:m},...ha(-y,-m/2,u,50,270,90)],v=Pe(k),_=f.path(v,g),C=s.insert(()=>_,":first-child");return C.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",n),C.attr("transform",`translate(${-l/2}, ${-c/2})`),ge(t,C),t.intersect=function(w){return ae.polygon(t,k,w)},s}b(Uk,"curvedTrapezoid");var oB=b((e,t,r,n,s,i)=>[`M${e},${t+i}`,`a${s},${i} 0,0,0 ${r},0`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),lB=b((e,t,r,n,s,i)=>[`M${e},${t+i}`,`M${e+r},${t+i}`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),cB=b((e,t,r,n,s,i)=>[`M${e-r/2},${-n/2}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function Vk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+t.padding,t.width??0),l=o/2,c=l/(2.5+o/50),u=Math.max(i.height+c+t.padding,t.height??0);let h;const{cssStyles:f}=t;if(t.look==="handDrawn"){const g=ue.svg(s),p=lB(0,0,o,u,l,c),m=cB(0,c,o,u,l,c),y=g.path(p,he(t,{})),x=g.path(m,he(t,{fill:"none"}));h=s.insert(()=>x,":first-child"),h=s.insert(()=>y,":first-child"),h.attr("class","basic label-container"),f&&h.attr("style",f)}else{const g=oB(0,0,o,u,l,c);h=s.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",$t(f)).attr("style",n)}return h.attr("label-offset-y",c),h.attr("transform",`translate(${-o/2}, ${-(u/2+c)})`),ge(t,h),a.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+(t.padding??0)/1.5-(i.y-(i.top??0))})`),t.intersect=function(g){const p=ae.rect(t,g),m=p.x-(t.x??0);if(l!=0&&(Math.abs(m)<(t.width??0)/2||Math.abs(m)==(t.width??0)/2&&Math.abs(p.y-(t.y??0))>(t.height??0)/2-c)){let y=c*c*(1-m*m/(l*l));y>0&&(y=Math.sqrt(y)),y=c-y,g.y-(t.y??0)>0&&(y=-y),p.y+=y}return p},s}b(Vk,"cylinder");async function Gk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=i.width+t.padding,l=i.height+t.padding,c=l*.2,u=-o/2,h=-l/2-c/2,{cssStyles:f}=t,g=ue.svg(s),p=he(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=[{x:u,y:h+c},{x:-u,y:h+c},{x:-u,y:-h},{x:u,y:-h},{x:u,y:h},{x:-u,y:h},{x:-u,y:h+c}],y=g.polygon(m.map(k=>[k.x,k.y]),p),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),a.attr("transform",`translate(${u+(t.padding??0)/2-(i.x-(i.left??0))}, ${h+c+(t.padding??0)/2-(i.y-(i.top??0))})`),ge(t,x),t.intersect=function(k){return ae.rect(t,k)},s}b(Gk,"dividedRectangle");async function Yk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a}=await ve(e,t,ye(t)),l=i.width/2+a+5,c=i.width/2+a;let u;const{cssStyles:h}=t;if(t.look==="handDrawn"){const f=ue.svg(s),g=he(t,{roughness:.2,strokeWidth:2.5}),p=he(t,{roughness:.2,strokeWidth:1.5}),m=f.circle(0,0,l*2,g),y=f.circle(0,0,c*2,p);u=s.insert("g",":first-child"),u.attr("class",$t(t.cssClasses)).attr("style",$t(h)),u.node()?.appendChild(m),u.node()?.appendChild(y)}else{u=s.insert("g",":first-child");const f=u.insert("circle",":first-child"),g=u.insert("circle");u.attr("class","basic label-container").attr("style",n),f.attr("class","outer-circle").attr("style",n).attr("r",l).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",n).attr("r",c).attr("cx",0).attr("cy",0)}return ge(t,u),t.intersect=function(f){return K.info("DoubleCircle intersect",t,l,f),ae.circle(t,l,f)},s}b(Yk,"doublecircle");function Xk(e,t,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:s}=de(t);t.label="",t.labelStyle=n;const i=e.insert("g").attr("class",ye(t)).attr("id",t.domId??t.id),a=7,{cssStyles:o}=t,l=ue.svg(i),{nodeBorder:c}=r,u=he(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(u.roughness=0);const h=l.circle(0,0,a*2,u),f=i.insert(()=>h,":first-child");return f.selectAll("path").attr("style",`fill: ${c} !important;`),o&&o.length>0&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",o),s&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",s),ge(t,f),t.intersect=function(g){return K.info("filledCircle intersect",t,{radius:a,point:g}),ae.circle(t,a,g)},i}b(Xk,"filledCircle");async function Kk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=i.width+(t.padding??0),l=o+i.height,c=o+i.height,u=[{x:0,y:-l},{x:c,y:-l},{x:c/2,y:0}],{cssStyles:h}=t,f=ue.svg(s),g=he(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=Pe(u),m=f.path(p,g),y=s.insert(()=>m,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`);return h&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),t.width=o,t.height=l,ge(t,y),a.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-l/2+(t.padding??0)/2+(i.y-(i.top??0))})`),t.intersect=function(x){return K.info("Triangle intersect",t,u,x),ae.polygon(t,u,x)},s}b(Kk,"flippedTriangle");function Qk(e,t,{dir:r,config:{state:n,themeVariables:s}}){const{nodeStyles:i}=de(t);t.label="";const a=e.insert("g").attr("class",ye(t)).attr("id",t.domId??t.id),{cssStyles:o}=t;let l=Math.max(70,t?.width??0),c=Math.max(10,t?.height??0);r==="LR"&&(l=Math.max(10,t?.width??0),c=Math.max(70,t?.height??0));const u=-1*l/2,h=-1*c/2,f=ue.svg(a),g=he(t,{stroke:s.lineColor,fill:s.lineColor});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=f.rectangle(u,h,l,c,g),m=a.insert(()=>p,":first-child");o&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",o),i&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",i),ge(t,m);const y=n?.padding??0;return t.width&&t.height&&(t.width+=y/2||0,t.height+=y/2||0),t.intersect=function(x){return ae.rect(t,x)},a}b(Qk,"forkJoin");async function Zk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const s=80,i=50,{shapeSvg:a,bbox:o}=await ve(e,t,ye(t)),l=Math.max(s,o.width+(t.padding??0)*2,t?.width??0),c=Math.max(i,o.height+(t.padding??0)*2,t?.height??0),u=c/2,{cssStyles:h}=t,f=ue.svg(a),g=he(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=[{x:-l/2,y:-c/2},{x:l/2-u,y:-c/2},...ha(-l/2+u,0,u,50,90,270),{x:l/2-u,y:c/2},{x:-l/2,y:c/2}],m=Pe(p),y=f.path(m,g),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),ge(t,x),t.intersect=function(k){return K.info("Pill intersect",t,{radius:u,point:k}),ae.polygon(t,p,k)},a}b(Zk,"halfRoundedRectangle");async function Jk(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=i.height+(t.padding??0),o=i.width+(t.padding??0)*2.5,{cssStyles:l}=t,c=ue.svg(s),u=he(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let h=o/2;const f=h/6;h=h+f;const g=a/2,p=g/2,m=h-p,y=[{x:-m,y:-g},{x:0,y:-g},{x:m,y:-g},{x:h,y:0},{x:m,y:g},{x:0,y:g},{x:-m,y:g},{x:-h,y:0}],x=Pe(y),k=c.path(x,u),v=s.insert(()=>k,":first-child");return v.attr("class","basic label-container"),l&&t.look!=="handDrawn"&&v.selectChildren("path").attr("style",l),n&&t.look!=="handDrawn"&&v.selectChildren("path").attr("style",n),t.width=o,t.height=a,ge(t,v),t.intersect=function(_){return ae.polygon(t,y,_)},s}b(Jk,"hexagon");async function ew(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.label="",t.labelStyle=r;const{shapeSvg:s}=await ve(e,t,ye(t)),i=Math.max(30,t?.width??0),a=Math.max(30,t?.height??0),{cssStyles:o}=t,l=ue.svg(s),c=he(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const u=[{x:0,y:0},{x:i,y:0},{x:0,y:a},{x:i,y:a}],h=Pe(u),f=l.path(h,c),g=s.insert(()=>f,":first-child");return g.attr("class","basic label-container"),o&&t.look!=="handDrawn"&&g.selectChildren("path").attr("style",o),n&&t.look!=="handDrawn"&&g.selectChildren("path").attr("style",n),g.attr("transform",`translate(${-i/2}, ${-a/2})`),ge(t,g),t.intersect=function(p){return K.info("Pill intersect",t,{points:u}),ae.polygon(t,u,p)},s}b(ew,"hourglass");async function tw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=de(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,label:h}=await ve(e,t,"icon-shape default"),f=t.pos==="t",g=o,p=o,{nodeBorder:m}=r,{stylesMap:y}=si(t),x=-p/2,k=-g/2,v=t.label?8:0,_=ue.svg(c),C=he(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const w=_.rectangle(x,k,p,g,C),S=Math.max(p,u.width),F=g+u.height+v,A=_.rectangle(-S/2,-F/2,S,F,{...C,fill:"transparent",stroke:"none"}),T=c.insert(()=>w,":first-child"),j=c.insert(()=>A);if(t.icon){const M=c.append("g");M.html(`<g>${await Ta(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const P=M.node().getBBox(),$=P.width,R=P.height,I=P.x,O=P.y;M.attr("transform",`translate(${-$/2-I},${f?u.height/2+v/2-R/2-O:-u.height/2-v/2-R/2-O})`),M.attr("style",`color: ${y.get("stroke")??m};`)}return h.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-F/2:F/2-u.height})`),T.attr("transform",`translate(0,${f?u.height/2+v/2:-u.height/2-v/2})`),ge(t,j),t.intersect=function(M){if(K.info("iconSquare intersect",t,M),!t.label)return ae.rect(t,M);const P=t.x??0,$=t.y??0,R=t.height??0;let I=[];return f?I=[{x:P-u.width/2,y:$-R/2},{x:P+u.width/2,y:$-R/2},{x:P+u.width/2,y:$-R/2+u.height+v},{x:P+p/2,y:$-R/2+u.height+v},{x:P+p/2,y:$+R/2},{x:P-p/2,y:$+R/2},{x:P-p/2,y:$-R/2+u.height+v},{x:P-u.width/2,y:$-R/2+u.height+v}]:I=[{x:P-p/2,y:$-R/2},{x:P+p/2,y:$-R/2},{x:P+p/2,y:$-R/2+g},{x:P+u.width/2,y:$-R/2+g},{x:P+u.width/2/2,y:$+R/2},{x:P-u.width/2,y:$+R/2},{x:P-u.width/2,y:$-R/2+g},{x:P-p/2,y:$-R/2+g}],ae.polygon(t,I,M)},c}b(tw,"icon");async function rw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=de(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,label:h}=await ve(e,t,"icon-shape default"),f=20,g=t.label?8:0,p=t.pos==="t",{nodeBorder:m,mainBkg:y}=r,{stylesMap:x}=si(t),k=ue.svg(c),v=he(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const _=x.get("fill");v.stroke=_??y;const C=c.append("g");t.icon&&C.html(`<g>${await Ta(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const w=C.node().getBBox(),S=w.width,F=w.height,A=w.x,T=w.y,j=Math.max(S,F)*Math.SQRT2+f*2,M=k.circle(0,0,j,v),P=Math.max(j,u.width),$=j+u.height+g,R=k.rectangle(-P/2,-$/2,P,$,{...v,fill:"transparent",stroke:"none"}),I=c.insert(()=>M,":first-child"),O=c.insert(()=>R);return C.attr("transform",`translate(${-S/2-A},${p?u.height/2+g/2-F/2-T:-u.height/2-g/2-F/2-T})`),C.attr("style",`color: ${x.get("stroke")??m};`),h.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-$/2:$/2-u.height})`),I.attr("transform",`translate(0,${p?u.height/2+g/2:-u.height/2-g/2})`),ge(t,O),t.intersect=function(W){return K.info("iconSquare intersect",t,W),ae.rect(t,W)},c}b(rw,"iconCircle");async function nw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=de(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,halfPadding:h,label:f}=await ve(e,t,"icon-shape default"),g=t.pos==="t",p=o+h*2,m=o+h*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:k}=si(t),v=-m/2,_=-p/2,C=t.label?8:0,w=ue.svg(c),S=he(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const F=k.get("fill");S.stroke=F??x;const A=w.path($n(v,_,m,p,5),S),T=Math.max(m,u.width),j=p+u.height+C,M=w.rectangle(-T/2,-j/2,T,j,{...S,fill:"transparent",stroke:"none"}),P=c.insert(()=>A,":first-child").attr("class","icon-shape2"),$=c.insert(()=>M);if(t.icon){const R=c.append("g");R.html(`<g>${await Ta(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const I=R.node().getBBox(),O=I.width,W=I.height,Z=I.x,E=I.y;R.attr("transform",`translate(${-O/2-Z},${g?u.height/2+C/2-W/2-E:-u.height/2-C/2-W/2-E})`),R.attr("style",`color: ${k.get("stroke")??y};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${g?-j/2:j/2-u.height})`),P.attr("transform",`translate(0,${g?u.height/2+C/2:-u.height/2-C/2})`),ge(t,$),t.intersect=function(R){if(K.info("iconSquare intersect",t,R),!t.label)return ae.rect(t,R);const I=t.x??0,O=t.y??0,W=t.height??0;let Z=[];return g?Z=[{x:I-u.width/2,y:O-W/2},{x:I+u.width/2,y:O-W/2},{x:I+u.width/2,y:O-W/2+u.height+C},{x:I+m/2,y:O-W/2+u.height+C},{x:I+m/2,y:O+W/2},{x:I-m/2,y:O+W/2},{x:I-m/2,y:O-W/2+u.height+C},{x:I-u.width/2,y:O-W/2+u.height+C}]:Z=[{x:I-m/2,y:O-W/2},{x:I+m/2,y:O-W/2},{x:I+m/2,y:O-W/2+p},{x:I+u.width/2,y:O-W/2+p},{x:I+u.width/2/2,y:O+W/2},{x:I-u.width/2,y:O+W/2},{x:I-u.width/2,y:O-W/2+p},{x:I-m/2,y:O-W/2+p}],ae.polygon(t,Z,R)},c}b(nw,"iconRounded");async function sw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=de(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,halfPadding:h,label:f}=await ve(e,t,"icon-shape default"),g=t.pos==="t",p=o+h*2,m=o+h*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:k}=si(t),v=-m/2,_=-p/2,C=t.label?8:0,w=ue.svg(c),S=he(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const F=k.get("fill");S.stroke=F??x;const A=w.path($n(v,_,m,p,.1),S),T=Math.max(m,u.width),j=p+u.height+C,M=w.rectangle(-T/2,-j/2,T,j,{...S,fill:"transparent",stroke:"none"}),P=c.insert(()=>A,":first-child"),$=c.insert(()=>M);if(t.icon){const R=c.append("g");R.html(`<g>${await Ta(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const I=R.node().getBBox(),O=I.width,W=I.height,Z=I.x,E=I.y;R.attr("transform",`translate(${-O/2-Z},${g?u.height/2+C/2-W/2-E:-u.height/2-C/2-W/2-E})`),R.attr("style",`color: ${k.get("stroke")??y};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${g?-j/2:j/2-u.height})`),P.attr("transform",`translate(0,${g?u.height/2+C/2:-u.height/2-C/2})`),ge(t,$),t.intersect=function(R){if(K.info("iconSquare intersect",t,R),!t.label)return ae.rect(t,R);const I=t.x??0,O=t.y??0,W=t.height??0;let Z=[];return g?Z=[{x:I-u.width/2,y:O-W/2},{x:I+u.width/2,y:O-W/2},{x:I+u.width/2,y:O-W/2+u.height+C},{x:I+m/2,y:O-W/2+u.height+C},{x:I+m/2,y:O+W/2},{x:I-m/2,y:O+W/2},{x:I-m/2,y:O-W/2+u.height+C},{x:I-u.width/2,y:O-W/2+u.height+C}]:Z=[{x:I-m/2,y:O-W/2},{x:I+m/2,y:O-W/2},{x:I+m/2,y:O-W/2+p},{x:I+u.width/2,y:O-W/2+p},{x:I+u.width/2/2,y:O+W/2},{x:I-u.width/2,y:O+W/2},{x:I-u.width/2,y:O-W/2+p},{x:I-m/2,y:O-W/2+p}],ae.polygon(t,Z,R)},c}b(sw,"iconSquare");async function iw(e,t,{config:{flowchart:r}}){const n=new Image;n.src=t?.img??"",await n.decode();const s=Number(n.naturalWidth.toString().replace("px","")),i=Number(n.naturalHeight.toString().replace("px",""));t.imageAspectRatio=s/i;const{labelStyles:a}=de(t);t.labelStyle=a;const o=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;const l=Math.max(t.label?o??0:0,t?.assetWidth??s),c=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:l,u=t.constraint==="on"?c/t.imageAspectRatio:t?.assetHeight??i;t.width=Math.max(c,o??0);const{shapeSvg:h,bbox:f,label:g}=await ve(e,t,"image-shape default"),p=t.pos==="t",m=-c/2,y=-u/2,x=t.label?8:0,k=ue.svg(h),v=he(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const _=k.rectangle(m,y,c,u,v),C=Math.max(c,f.width),w=u+f.height+x,S=k.rectangle(-C/2,-w/2,C,w,{...v,fill:"none",stroke:"none"}),F=h.insert(()=>_,":first-child"),A=h.insert(()=>S);if(t.img){const T=h.append("image");T.attr("href",t.img),T.attr("width",c),T.attr("height",u),T.attr("preserveAspectRatio","none"),T.attr("transform",`translate(${-c/2},${p?w/2-u:-w/2})`)}return g.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${p?-u/2-f.height/2-x/2:u/2-f.height/2+x/2})`),F.attr("transform",`translate(0,${p?f.height/2+x/2:-f.height/2-x/2})`),ge(t,A),t.intersect=function(T){if(K.info("iconSquare intersect",t,T),!t.label)return ae.rect(t,T);const j=t.x??0,M=t.y??0,P=t.height??0;let $=[];return p?$=[{x:j-f.width/2,y:M-P/2},{x:j+f.width/2,y:M-P/2},{x:j+f.width/2,y:M-P/2+f.height+x},{x:j+c/2,y:M-P/2+f.height+x},{x:j+c/2,y:M+P/2},{x:j-c/2,y:M+P/2},{x:j-c/2,y:M-P/2+f.height+x},{x:j-f.width/2,y:M-P/2+f.height+x}]:$=[{x:j-c/2,y:M-P/2},{x:j+c/2,y:M-P/2},{x:j+c/2,y:M-P/2+u},{x:j+f.width/2,y:M-P/2+u},{x:j+f.width/2/2,y:M+P/2},{x:j-f.width/2,y:M+P/2},{x:j-f.width/2,y:M-P/2+u},{x:j-c/2,y:M-P/2+u}],ae.polygon(t,$,T)},h}b(iw,"imageSquare");async function aw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=Math.max(i.width+(t.padding??0)*2,t?.width??0),o=Math.max(i.height+(t.padding??0)*2,t?.height??0),l=[{x:0,y:0},{x:a,y:0},{x:a+3*o/6,y:-o},{x:-3*o/6,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=ue.svg(s),f=he(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Dn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,ge(t,c),t.intersect=function(h){return ae.polygon(t,l,h)},s}b(aw,"inv_trapezoid");async function Pl(e,t,r){const{labelStyles:n,nodeStyles:s}=de(t);t.labelStyle=n;const{shapeSvg:i,bbox:a}=await ve(e,t,ye(t)),o=Math.max(a.width+r.labelPaddingX*2,t?.width||0),l=Math.max(a.height+r.labelPaddingY*2,t?.height||0),c=-o/2,u=-l/2;let h,{rx:f,ry:g}=t;const{cssStyles:p}=t;if(r?.rx&&r.ry&&(f=r.rx,g=r.ry),t.look==="handDrawn"){const m=ue.svg(i),y=he(t,{}),x=f||g?m.path($n(c,u,o,l,f||0),y):m.rectangle(c,u,o,l,y);h=i.insert(()=>x,":first-child"),h.attr("class","basic label-container").attr("style",$t(p))}else h=i.insert("rect",":first-child"),h.attr("class","basic label-container").attr("style",s).attr("rx",$t(f)).attr("ry",$t(g)).attr("x",c).attr("y",u).attr("width",o).attr("height",l);return ge(t,h),t.calcIntersect=function(m,y){return ae.rect(m,y)},t.intersect=function(m){return ae.rect(t,m)},i}b(Pl,"drawRect");async function ow(e,t){const{shapeSvg:r,bbox:n,label:s}=await ve(e,t,"label"),i=r.insert("rect",":first-child");return i.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),s.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),ge(t,i),t.intersect=function(l){return ae.rect(t,l)},r}b(ow,"labelRect");async function lw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=Math.max(i.width+(t.padding??0),t?.width??0),o=Math.max(i.height+(t.padding??0),t?.height??0),l=[{x:0,y:0},{x:a+3*o/6,y:0},{x:a,y:-o},{x:-(3*o)/6,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=ue.svg(s),f=he(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Dn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,ge(t,c),t.intersect=function(h){return ae.polygon(t,l,h)},s}b(lw,"lean_left");async function cw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=Math.max(i.width+(t.padding??0),t?.width??0),o=Math.max(i.height+(t.padding??0),t?.height??0),l=[{x:-3*o/6,y:0},{x:a,y:0},{x:a+3*o/6,y:-o},{x:0,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=ue.svg(s),f=he(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Dn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,ge(t,c),t.intersect=function(h){return ae.polygon(t,l,h)},s}b(cw,"lean_right");function uw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.label="",t.labelStyle=r;const s=e.insert("g").attr("class",ye(t)).attr("id",t.domId??t.id),{cssStyles:i}=t,a=Math.max(35,t?.width??0),o=Math.max(35,t?.height??0),l=7,c=[{x:a,y:0},{x:0,y:o+l/2},{x:a-2*l,y:o+l/2},{x:0,y:2*o},{x:a,y:o-l/2},{x:2*l,y:o-l/2}],u=ue.svg(s),h=he(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const f=Pe(c),g=u.path(f,h),p=s.insert(()=>g,":first-child");return i&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",i),n&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",n),p.attr("transform",`translate(-${a/2},${-o})`),ge(t,p),t.intersect=function(m){return K.info("lightningBolt intersect",t,m),ae.polygon(t,c,m)},s}b(uw,"lightningBolt");var uB=b((e,t,r,n,s,i,a)=>[`M${e},${t+i}`,`a${s},${i} 0,0,0 ${r},0`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+i+a}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),hB=b((e,t,r,n,s,i,a)=>[`M${e},${t+i}`,`M${e+r},${t+i}`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+i+a}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),dB=b((e,t,r,n,s,i)=>[`M${e-r/2},${-n/2}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function hw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0),t.width??0),l=o/2,c=l/(2.5+o/50),u=Math.max(i.height+c+(t.padding??0),t.height??0),h=u*.1;let f;const{cssStyles:g}=t;if(t.look==="handDrawn"){const p=ue.svg(s),m=hB(0,0,o,u,l,c,h),y=dB(0,c,o,u,l,c),x=he(t,{}),k=p.path(m,x),v=p.path(y,x);s.insert(()=>v,":first-child").attr("class","line"),f=s.insert(()=>k,":first-child"),f.attr("class","basic label-container"),g&&f.attr("style",g)}else{const p=uB(0,0,o,u,l,c,h);f=s.insert("path",":first-child").attr("d",p).attr("class","basic label-container").attr("style",$t(g)).attr("style",n)}return f.attr("label-offset-y",c),f.attr("transform",`translate(${-o/2}, ${-(u/2+c)})`),ge(t,f),a.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+c-(i.y-(i.top??0))})`),t.intersect=function(p){const m=ae.rect(t,p),y=m.x-(t.x??0);if(l!=0&&(Math.abs(y)<(t.width??0)/2||Math.abs(y)==(t.width??0)/2&&Math.abs(m.y-(t.y??0))>(t.height??0)/2-c)){let x=c*c*(1-y*y/(l*l));x>0&&(x=Math.sqrt(x)),x=c-x,p.y-(t.y??0)>0&&(x=-x),m.y+=x}return m},s}b(hw,"linedCylinder");async function dw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/4,u=l+c,{cssStyles:h}=t,f=ue.svg(s),g=he(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=[{x:-o/2-o/2*.1,y:-u/2},{x:-o/2-o/2*.1,y:u/2},...Mn(-o/2-o/2*.1,u/2,o/2+o/2*.1,u/2,c,.8),{x:o/2+o/2*.1,y:-u/2},{x:-o/2-o/2*.1,y:-u/2},{x:-o/2,y:-u/2},{x:-o/2,y:u/2*1.1},{x:-o/2,y:-u/2}],m=f.polygon(p.map(x=>[x.x,x.y]),g),y=s.insert(()=>m,":first-child");return y.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",h),n&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",n),y.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-o/2+(t.padding??0)+o/2*.1/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c/2-(i.y-(i.top??0))})`),ge(t,y),t.intersect=function(x){return ae.polygon(t,p,x)},s}b(dw,"linedWaveEdgedRect");async function fw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=5,u=-o/2,h=-l/2,{cssStyles:f}=t,g=ue.svg(s),p=he(t,{}),m=[{x:u-c,y:h+c},{x:u-c,y:h+l+c},{x:u+o-c,y:h+l+c},{x:u+o-c,y:h+l},{x:u+o,y:h+l},{x:u+o,y:h+l-c},{x:u+o+c,y:h+l-c},{x:u+o+c,y:h-c},{x:u+c,y:h-c},{x:u+c,y:h},{x:u,y:h},{x:u,y:h+c}],y=[{x:u,y:h+c},{x:u+o-c,y:h+c},{x:u+o-c,y:h+l},{x:u+o,y:h+l},{x:u+o,y:h},{x:u,y:h}];t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const x=Pe(m),k=g.path(x,p),v=Pe(y),_=g.path(v,{...p,fill:"none"}),C=s.insert(()=>_,":first-child");return C.insert(()=>k,":first-child"),C.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),a.attr("transform",`translate(${-(i.width/2)-c-(i.x-(i.left??0))}, ${-(i.height/2)+c-(i.y-(i.top??0))})`),ge(t,C),t.intersect=function(w){return ae.polygon(t,m,w)},s}b(fw,"multiRect");async function gw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/4,u=l+c,h=-o/2,f=-u/2,g=5,{cssStyles:p}=t,m=Mn(h-g,f+u+g,h+o-g,f+u+g,c,.8),y=m?.[m.length-1],x=[{x:h-g,y:f+g},{x:h-g,y:f+u+g},...m,{x:h+o-g,y:y.y-g},{x:h+o,y:y.y-g},{x:h+o,y:y.y-2*g},{x:h+o+g,y:y.y-2*g},{x:h+o+g,y:f-g},{x:h+g,y:f-g},{x:h+g,y:f},{x:h,y:f},{x:h,y:f+g}],k=[{x:h,y:f+g},{x:h+o-g,y:f+g},{x:h+o-g,y:y.y-g},{x:h+o,y:y.y-g},{x:h+o,y:f},{x:h,y:f}],v=ue.svg(s),_=he(t,{});t.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const C=Pe(x),w=v.path(C,_),S=Pe(k),F=v.path(S,_),A=s.insert(()=>w,":first-child");return A.insert(()=>F),A.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",p),n&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",n),A.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-(i.width/2)-g-(i.x-(i.left??0))}, ${-(i.height/2)+g-c/2-(i.y-(i.top??0))})`),ge(t,A),t.intersect=function(T){return ae.polygon(t,x,T)},s}b(gw,"multiWaveEdgedRectangle");async function pw(e,t,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:s}=de(t);t.labelStyle=n,t.useHtmlLabels||It().flowchart?.htmlLabels!==!1||(t.centerLabel=!0);const{shapeSvg:a,bbox:o,label:l}=await ve(e,t,ye(t)),c=Math.max(o.width+(t.padding??0)*2,t?.width??0),u=Math.max(o.height+(t.padding??0)*2,t?.height??0),h=-c/2,f=-u/2,{cssStyles:g}=t,p=ue.svg(a),m=he(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=p.rectangle(h,f,c,u,m),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",g),s&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",s),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),ge(t,x),t.intersect=function(k){return ae.rect(t,k)},a}b(pw,"note");var fB=b((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function mw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=i.width+t.padding,o=i.height+t.padding,l=a+o,c=.5,u=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let h;const{cssStyles:f}=t;if(t.look==="handDrawn"){const g=ue.svg(s),p=he(t,{}),m=fB(0,0,l),y=g.path(m,p);h=s.insert(()=>y,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),f&&h.attr("style",f)}else h=Dn(s,l,l,u),h.attr("transform",`translate(${-l/2+c}, ${l/2})`);return n&&h.attr("style",n),ge(t,h),t.calcIntersect=function(g,p){const m=g.width,y=[{x:m/2,y:0},{x:m,y:-m/2},{x:m/2,y:-m},{x:0,y:-m/2}],x=ae.polygon(g,y,p);return{x:x.x-.5,y:x.y-.5}},t.intersect=function(g){return this.calcIntersect(t,g)},s}b(mw,"question");async function xw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0),t?.width??0),l=Math.max(i.height+(t.padding??0),t?.height??0),c=-o/2,u=-l/2,h=u/2,f=[{x:c+h,y:u},{x:c,y:0},{x:c+h,y:-u},{x:-c,y:-u},{x:-c,y:u}],{cssStyles:g}=t,p=ue.svg(s),m=he(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=Pe(f),x=p.path(y,m),k=s.insert(()=>x,":first-child");return k.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(${-h/2},0)`),a.attr("transform",`translate(${-h/2-i.width/2-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),ge(t,k),t.intersect=function(v){return ae.polygon(t,f,v)},s}b(xw,"rect_left_inv_arrow");async function yw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;let s;t.cssClasses?s="node "+t.cssClasses:s="node default";const i=e.insert("g").attr("class",s).attr("id",t.domId||t.id),a=i.insert("g"),o=i.insert("g").attr("class","label").attr("style",n),l=t.description,c=t.label,u=o.node().appendChild(await Kn(c,t.labelStyle,!0,!0));let h={width:0,height:0};if(wt(qe()?.flowchart?.htmlLabels)){const F=u.children[0],A=Fe(u);h=F.getBoundingClientRect(),A.attr("width",h.width),A.attr("height",h.height)}K.info("Text 2",l);const f=l||[],g=u.getBBox(),p=o.node().appendChild(await Kn(f.join?f.join("<br/>"):f,t.labelStyle,!0,!0)),m=p.children[0],y=Fe(p);h=m.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height);const x=(t.padding||0)/2;Fe(p).attr("transform","translate( "+(h.width>g.width?0:(g.width-h.width)/2)+", "+(g.height+x+5)+")"),Fe(u).attr("transform","translate( "+(h.width<g.width?0:-(g.width-h.width)/2)+", 0)"),h=o.node().getBBox(),o.attr("transform","translate("+-h.width/2+", "+(-h.height/2-x+3)+")");const k=h.width+(t.padding||0),v=h.height+(t.padding||0),_=-h.width/2-x,C=-h.height/2-x;let w,S;if(t.look==="handDrawn"){const F=ue.svg(i),A=he(t,{}),T=F.path($n(_,C,k,v,t.rx||0),A),j=F.line(-h.width/2-x,-h.height/2-x+g.height+x,h.width/2+x,-h.height/2-x+g.height+x,A);S=i.insert(()=>(K.debug("Rough node insert CXC",T),j),":first-child"),w=i.insert(()=>(K.debug("Rough node insert CXC",T),T),":first-child")}else w=a.insert("rect",":first-child"),S=a.insert("line"),w.attr("class","outer title-state").attr("style",n).attr("x",-h.width/2-x).attr("y",-h.height/2-x).attr("width",h.width+(t.padding||0)).attr("height",h.height+(t.padding||0)),S.attr("class","divider").attr("x1",-h.width/2-x).attr("x2",h.width/2+x).attr("y1",-h.height/2-x+g.height+x).attr("y2",-h.height/2-x+g.height+x);return ge(t,w),t.intersect=function(F){return ae.rect(t,F)},i}b(yw,"rectWithTitle");function Pi(e,t,r,n,s,i,a){const l=(e+r)/2,c=(t+n)/2,u=Math.atan2(n-t,r-e),h=(r-e)/2,f=(n-t)/2,g=h/s,p=f/i,m=Math.sqrt(g**2+p**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const y=Math.sqrt(1-m**2),x=l+y*i*Math.sin(u)*(a?-1:1),k=c-y*s*Math.cos(u)*(a?-1:1),v=Math.atan2((t-k)/i,(e-x)/s);let C=Math.atan2((n-k)/i,(r-x)/s)-v;a&&C<0&&(C+=2*Math.PI),!a&&C>0&&(C-=2*Math.PI);const w=[];for(let S=0;S<20;S++){const F=S/19,A=v+F*C,T=x+s*Math.cos(A),j=k+i*Math.sin(A);w.push({x:T,y:j})}return w}b(Pi,"generateArcPoints");async function bw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=t?.padding??0,o=t?.padding??0,l=(t?.width?t?.width:i.width)+a*2,c=(t?.height?t?.height:i.height)+o*2,u=t.radius||5,h=t.taper||5,{cssStyles:f}=t,g=ue.svg(s),p=he(t,{});t.stroke&&(p.stroke=t.stroke),t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=[{x:-l/2+h,y:-c/2},{x:l/2-h,y:-c/2},...Pi(l/2-h,-c/2,l/2,-c/2+h,u,u,!0),{x:l/2,y:-c/2+h},{x:l/2,y:c/2-h},...Pi(l/2,c/2-h,l/2-h,c/2,u,u,!0),{x:l/2-h,y:c/2},{x:-l/2+h,y:c/2},...Pi(-l/2+h,c/2,-l/2,c/2-h,u,u,!0),{x:-l/2,y:c/2-h},{x:-l/2,y:-c/2+h},...Pi(-l/2,-c/2+h,-l/2+h,-c/2,u,u,!0)],y=Pe(m),x=g.path(y,p),k=s.insert(()=>x,":first-child");return k.attr("class","basic label-container outer-path"),f&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),ge(t,k),t.intersect=function(v){return ae.polygon(t,m,v)},s}b(bw,"roundedRect");async function kw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=t?.padding??0,l=Math.max(i.width+(t.padding??0)*2,t?.width??0),c=Math.max(i.height+(t.padding??0)*2,t?.height??0),u=-i.width/2-o,h=-i.height/2-o,{cssStyles:f}=t,g=ue.svg(s),p=he(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=[{x:u,y:h},{x:u+l+8,y:h},{x:u+l+8,y:h+c},{x:u-8,y:h+c},{x:u-8,y:h},{x:u,y:h},{x:u,y:h+c}],y=g.polygon(m.map(k=>[k.x,k.y]),p),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container").attr("style",$t(f)),n&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),a.attr("transform",`translate(${-l/2+4+(t.padding??0)-(i.x-(i.left??0))},${-c/2+(t.padding??0)-(i.y-(i.top??0))})`),ge(t,x),t.intersect=function(k){return ae.rect(t,k)},s}b(kw,"shadedProcess");async function ww(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=-o/2,u=-l/2,{cssStyles:h}=t,f=ue.svg(s),g=he(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=[{x:c,y:u},{x:c,y:u+l},{x:c+o,y:u+l},{x:c+o,y:u-l/2}],m=Pe(p),y=f.path(m,g),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),x.attr("transform",`translate(0, ${l/4})`),a.attr("transform",`translate(${-o/2+(t.padding??0)-(i.x-(i.left??0))}, ${-l/4+(t.padding??0)-(i.y-(i.top??0))})`),ge(t,x),t.intersect=function(k){return ae.polygon(t,p,k)},s}b(ww,"slopedRect");async function vw(e,t){const r={rx:0,ry:0,labelPaddingX:t.labelPaddingX??(t?.padding||0)*2,labelPaddingY:(t?.padding||0)*1};return Pl(e,t,r)}b(vw,"squareRect");async function Cw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=i.height+t.padding,o=i.width+a/4+t.padding,l=a/2,{cssStyles:c}=t,u=ue.svg(s),h=he(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const f=[{x:-o/2+l,y:-a/2},{x:o/2-l,y:-a/2},...ha(-o/2+l,0,l,50,90,270),{x:o/2-l,y:a/2},...ha(o/2-l,0,l,50,270,450)],g=Pe(f),p=u.path(g,h),m=s.insert(()=>p,":first-child");return m.attr("class","basic label-container outer-path"),c&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",c),n&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",n),ge(t,m),t.intersect=function(y){return ae.polygon(t,f,y)},s}b(Cw,"stadium");async function Sw(e,t){return Pl(e,t,{rx:5,ry:5})}b(Sw,"state");function _w(e,t,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:s}=de(t);t.labelStyle=n;const{cssStyles:i}=t,{lineColor:a,stateBorder:o,nodeBorder:l}=r,c=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),u=ue.svg(c),h=he(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const f=u.circle(0,0,14,{...h,stroke:a,strokeWidth:2}),g=o??l,p=u.circle(0,0,5,{...h,fill:g,stroke:g,strokeWidth:2,fillStyle:"solid"}),m=c.insert(()=>f,":first-child");return m.insert(()=>p),i&&m.selectAll("path").attr("style",i),s&&m.selectAll("path").attr("style",s),ge(t,m),t.intersect=function(y){return ae.circle(t,7,y)},c}b(_w,"stateEnd");function Tw(e,t,{config:{themeVariables:r}}){const{lineColor:n}=r,s=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let i;if(t.look==="handDrawn"){const o=ue.svg(s).circle(0,0,14,E$(n));i=s.insert(()=>o),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else i=s.insert("circle",":first-child"),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return ge(t,i),t.intersect=function(a){return ae.circle(t,7,a)},s}b(Tw,"stateStart");async function Nw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=(t?.padding||0)/2,o=i.width+t.padding,l=i.height+t.padding,c=-i.width/2-a,u=-i.height/2-a,h=[{x:0,y:0},{x:o,y:0},{x:o,y:-l},{x:0,y:-l},{x:0,y:0},{x:-8,y:0},{x:o+8,y:0},{x:o+8,y:-l},{x:-8,y:-l},{x:-8,y:0}];if(t.look==="handDrawn"){const f=ue.svg(s),g=he(t,{}),p=f.rectangle(c-8,u,o+16,l,g),m=f.line(c,u,c,u+l,g),y=f.line(c+o,u,c+o,u+l,g);s.insert(()=>m,":first-child"),s.insert(()=>y,":first-child");const x=s.insert(()=>p,":first-child"),{cssStyles:k}=t;x.attr("class","basic label-container").attr("style",$t(k)),ge(t,x)}else{const f=Dn(s,o,l,h);n&&f.attr("style",n),ge(t,f)}return t.intersect=function(f){return ae.polygon(t,h,f)},s}b(Nw,"subroutine");async function Ew(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=Math.max(i.width+(t.padding??0)*2,t?.width??0),o=Math.max(i.height+(t.padding??0)*2,t?.height??0),l=-a/2,c=-o/2,u=.2*o,h=.2*o,{cssStyles:f}=t,g=ue.svg(s),p=he(t,{}),m=[{x:l-u/2,y:c},{x:l+a+u/2,y:c},{x:l+a+u/2,y:c+o},{x:l-u/2,y:c+o}],y=[{x:l+a-u/2,y:c+o},{x:l+a+u/2,y:c+o},{x:l+a+u/2,y:c+o-h}];t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const x=Pe(m),k=g.path(x,p),v=Pe(y),_=g.path(v,{...p,fillStyle:"solid"}),C=s.insert(()=>_,":first-child");return C.insert(()=>k,":first-child"),C.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),ge(t,C),t.intersect=function(w){return ae.polygon(t,m,w)},s}b(Ew,"taggedRect");async function Aw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/4,u=.2*o,h=.2*l,f=l+c,{cssStyles:g}=t,p=ue.svg(s),m=he(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=[{x:-o/2-o/2*.1,y:f/2},...Mn(-o/2-o/2*.1,f/2,o/2+o/2*.1,f/2,c,.8),{x:o/2+o/2*.1,y:-f/2},{x:-o/2-o/2*.1,y:-f/2}],x=-o/2+o/2*.1,k=-f/2-h*.4,v=[{x:x+o-u,y:(k+l)*1.4},{x:x+o,y:k+l-h},{x:x+o,y:(k+l)*.9},...Mn(x+o,(k+l)*1.3,x+o-u,(k+l)*1.5,-l*.03,.5)],_=Pe(y),C=p.path(_,m),w=Pe(v),S=p.path(w,{...m,fillStyle:"solid"}),F=s.insert(()=>S,":first-child");return F.insert(()=>C,":first-child"),F.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&F.selectAll("path").attr("style",n),F.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-o/2+(t.padding??0)-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c/2-(i.y-(i.top??0))})`),ge(t,F),t.intersect=function(A){return ae.polygon(t,y,A)},s}b(Aw,"taggedWaveEdgedRectangle");async function Mw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=Math.max(i.width+t.padding,t?.width||0),o=Math.max(i.height+t.padding,t?.height||0),l=-a/2,c=-o/2,u=s.insert("rect",":first-child");return u.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",l).attr("y",c).attr("width",a).attr("height",o),ge(t,u),t.intersect=function(h){return ae.rect(t,h)},s}b(Mw,"text");var gB=b((e,t,r,n,s,i)=>`M${e},${t}
|
|
322
|
-
a${s},${i} 0,0,1 0,${-n}
|
|
323
|
-
l${r},0
|
|
324
|
-
a${s},${i} 0,0,1 0,${n}
|
|
325
|
-
M${r},${-n}
|
|
326
|
-
a${s},${i} 0,0,0 0,${n}
|
|
327
|
-
l${-r},0`,"createCylinderPathD"),pB=b((e,t,r,n,s,i)=>[`M${e},${t}`,`M${e+r},${t}`,`a${s},${i} 0,0,0 0,${-n}`,`l${-r},0`,`a${s},${i} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),mB=b((e,t,r,n,s,i)=>[`M${e+r/2},${-n/2}`,`a${s},${i} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD");async function jw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a,halfPadding:o}=await ve(e,t,ye(t)),l=t.look==="neo"?o*2:o,c=i.height+l,u=c/2,h=u/(2.5+c/50),f=i.width+h+l,{cssStyles:g}=t;let p;if(t.look==="handDrawn"){const m=ue.svg(s),y=pB(0,0,f,c,h,u),x=mB(0,0,f,c,h,u),k=m.path(y,he(t,{})),v=m.path(x,he(t,{fill:"none"}));p=s.insert(()=>v,":first-child"),p=s.insert(()=>k,":first-child"),p.attr("class","basic label-container"),g&&p.attr("style",g)}else{const m=gB(0,0,f,c,h,u);p=s.insert("path",":first-child").attr("d",m).attr("class","basic label-container").attr("style",$t(g)).attr("style",n),p.attr("class","basic label-container"),g&&p.selectAll("path").attr("style",g),n&&p.selectAll("path").attr("style",n)}return p.attr("label-offset-x",h),p.attr("transform",`translate(${-f/2}, ${c/2} )`),a.attr("transform",`translate(${-(i.width/2)-h-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),ge(t,p),t.intersect=function(m){const y=ae.rect(t,m),x=y.y-(t.y??0);if(u!=0&&(Math.abs(x)<(t.height??0)/2||Math.abs(x)==(t.height??0)/2&&Math.abs(y.x-(t.x??0))>(t.width??0)/2-h)){let k=h*h*(1-x*x/(u*u));k!=0&&(k=Math.sqrt(Math.abs(k))),k=h-k,m.x-(t.x??0)>0&&(k=-k),y.x+=k}return y},s}b(jw,"tiltedCylinder");async function Iw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=i.width+t.padding,o=i.height+t.padding,l=[{x:-3*o/6,y:0},{x:a+3*o/6,y:0},{x:a,y:-o},{x:0,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=ue.svg(s),f=he(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Dn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,ge(t,c),t.intersect=function(h){return ae.polygon(t,l,h)},s}b(Iw,"trapezoid");async function Lw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=60,o=20,l=Math.max(a,i.width+(t.padding??0)*2,t?.width??0),c=Math.max(o,i.height+(t.padding??0)*2,t?.height??0),{cssStyles:u}=t,h=ue.svg(s),f=he(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=[{x:-l/2*.8,y:-c/2},{x:l/2*.8,y:-c/2},{x:l/2,y:-c/2*.6},{x:l/2,y:c/2},{x:-l/2,y:c/2},{x:-l/2,y:-c/2*.6}],p=Pe(g),m=h.path(p,f),y=s.insert(()=>m,":first-child");return y.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",u),n&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),ge(t,y),t.intersect=function(x){return ae.polygon(t,g,x)},s}b(Lw,"trapezoidalPentagon");async function $w(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=wt(qe().flowchart?.htmlLabels),l=i.width+(t.padding??0),c=l+i.height,u=l+i.height,h=[{x:0,y:0},{x:u,y:0},{x:u/2,y:-c}],{cssStyles:f}=t,g=ue.svg(s),p=he(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=Pe(h),y=g.path(m,p),x=s.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${c/2})`);return f&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",f),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),t.width=l,t.height=c,ge(t,x),a.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${c/2-(i.height+(t.padding??0)/(o?2:1)-(i.y-(i.top??0)))})`),t.intersect=function(k){return K.info("Triangle intersect",t,h,k),ae.polygon(t,h,k)},s}b($w,"triangle");async function Dw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/8,u=l+c,{cssStyles:h}=t,g=70-o,p=g>0?g/2:0,m=ue.svg(s),y=he(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=[{x:-o/2-p,y:u/2},...Mn(-o/2-p,u/2,o/2+p,u/2,c,.8),{x:o/2+p,y:-u/2},{x:-o/2-p,y:-u/2}],k=Pe(x),v=m.path(k,y),_=s.insert(()=>v,":first-child");return _.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",h),n&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-o/2+(t.padding??0)-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c-(i.y-(i.top??0))})`),ge(t,_),t.intersect=function(C){return ae.polygon(t,x,C)},s}b(Dw,"waveEdgedRectangle");async function Bw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ye(t)),a=100,o=50,l=Math.max(i.width+(t.padding??0)*2,t?.width??0),c=Math.max(i.height+(t.padding??0)*2,t?.height??0),u=l/c;let h=l,f=c;h>f*u?f=h/u:h=f*u,h=Math.max(h,a),f=Math.max(f,o);const g=Math.min(f*.2,f/4),p=f+g*2,{cssStyles:m}=t,y=ue.svg(s),x=he(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const k=[{x:-h/2,y:p/2},...Mn(-h/2,p/2,h/2,p/2,g,1),{x:h/2,y:-p/2},...Mn(h/2,-p/2,-h/2,-p/2,g,-1)],v=Pe(k),_=y.path(v,x),C=s.insert(()=>_,":first-child");return C.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",m),n&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),ge(t,C),t.intersect=function(w){return ae.polygon(t,k,w)},s}b(Bw,"waveRectangle");async function Rw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ye(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=5,u=-o/2,h=-l/2,{cssStyles:f}=t,g=ue.svg(s),p=he(t,{}),m=[{x:u-c,y:h-c},{x:u-c,y:h+l},{x:u+o,y:h+l},{x:u+o,y:h-c}],y=`M${u-c},${h-c} L${u+o},${h-c} L${u+o},${h+l} L${u-c},${h+l} L${u-c},${h-c}
|
|
328
|
-
M${u-c},${h} L${u+o},${h}
|
|
329
|
-
M${u},${h-c} L${u},${h+l}`;t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const x=g.path(y,p),k=s.insert(()=>x,":first-child");return k.attr("transform",`translate(${c/2}, ${c/2})`),k.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),a.attr("transform",`translate(${-(i.width/2)+c/2-(i.x-(i.left??0))}, ${-(i.height/2)+c/2-(i.y-(i.top??0))})`),ge(t,k),t.intersect=function(v){return ae.polygon(t,m,v)},s}b(Rw,"windowPane");async function Wd(e,t){const r=t;if(r.alias&&(t.label=r.alias),t.look==="handDrawn"){const{themeVariables:X}=It(),{background:N}=X,B={...t,id:t.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${N}`]};await Wd(e,B)}const n=It();t.useHtmlLabels=n.htmlLabels;let s=n.er?.diagramPadding??10,i=n.er?.entityPadding??6;const{cssStyles:a}=t,{labelStyles:o,nodeStyles:l}=de(t);if(r.attributes.length===0&&t.label){const X={rx:0,ry:0,labelPaddingX:s,labelPaddingY:s*1.5};an(t.label,n)+X.labelPaddingX*2<n.er.minEntityWidth&&(t.width=n.er.minEntityWidth);const N=await Pl(e,t,X);if(!wt(n.htmlLabels)){const B=N.select("text"),V=B.node()?.getBBox();B.attr("transform",`translate(${-V.width/2}, 0)`)}return N}n.htmlLabels||(s*=1.25,i*=1.25);let c=ye(t);c||(c="node default");const u=e.insert("g").attr("class",c).attr("id",t.domId||t.id),h=await Ms(u,t.label??"",n,0,0,["name"],o);h.height+=i;let f=0;const g=[],p=[];let m=0,y=0,x=0,k=0,v=!0,_=!0;for(const X of r.attributes){const N=await Ms(u,X.type,n,0,f,["attribute-type"],o);m=Math.max(m,N.width+s);const B=await Ms(u,X.name,n,0,f,["attribute-name"],o);y=Math.max(y,B.width+s);const V=await Ms(u,X.keys.join(),n,0,f,["attribute-keys"],o);x=Math.max(x,V.width+s);const H=await Ms(u,X.comment,n,0,f,["attribute-comment"],o);k=Math.max(k,H.width+s);const q=Math.max(N.height,B.height,V.height,H.height)+i;p.push({yOffset:f,rowHeight:q}),f+=q}let C=4;x<=s&&(v=!1,x=0,C--),k<=s&&(_=!1,k=0,C--);const w=u.node().getBBox();if(h.width+s*2-(m+y+x+k)>0){const X=h.width+s*2-(m+y+x+k);m+=X/C,y+=X/C,x>0&&(x+=X/C),k>0&&(k+=X/C)}const S=m+y+x+k,F=ue.svg(u),A=he(t,{});t.look!=="handDrawn"&&(A.roughness=0,A.fillStyle="solid");let T=0;p.length>0&&(T=p.reduce((X,N)=>X+(N?.rowHeight??0),0));const j=Math.max(w.width+s*2,t?.width||0,S),M=Math.max((T??0)+h.height,t?.height||0),P=-j/2,$=-M/2;u.selectAll("g:not(:first-child)").each((X,N,B)=>{const V=Fe(B[N]),H=V.attr("transform");let q=0,Y=0;if(H){const re=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(H);re&&(q=parseFloat(re[1]),Y=parseFloat(re[2]),V.attr("class").includes("attribute-name")?q+=m:V.attr("class").includes("attribute-keys")?q+=m+y:V.attr("class").includes("attribute-comment")&&(q+=m+y+x))}V.attr("transform",`translate(${P+s/2+q}, ${Y+$+h.height+i/2})`)}),u.select(".name").attr("transform","translate("+-h.width/2+", "+($+i/2)+")");const R=F.rectangle(P,$,j,M,A),I=u.insert(()=>R,":first-child").attr("style",a.join("")),{themeVariables:O}=It(),{rowEven:W,rowOdd:Z,nodeBorder:E}=O;g.push(0);for(const[X,N]of p.entries()){const V=(X+1)%2===0&&N.yOffset!==0,H=F.rectangle(P,h.height+$+N?.yOffset,j,N?.rowHeight,{...A,fill:V?W:Z,stroke:E});u.insert(()=>H,"g.label").attr("style",a.join("")).attr("class",`row-rect-${V?"even":"odd"}`)}let D=F.line(P,h.height+$,j+P,h.height+$,A);u.insert(()=>D).attr("class","divider"),D=F.line(m+P,h.height+$,m+P,M+$,A),u.insert(()=>D).attr("class","divider"),v&&(D=F.line(m+y+P,h.height+$,m+y+P,M+$,A),u.insert(()=>D).attr("class","divider")),_&&(D=F.line(m+y+x+P,h.height+$,m+y+x+P,M+$,A),u.insert(()=>D).attr("class","divider"));for(const X of g)D=F.line(P,h.height+$+X,j+P,h.height+$+X,A),u.insert(()=>D).attr("class","divider");if(ge(t,I),l&&t.look!=="handDrawn"){const N=l.split(";")?.filter(B=>B.includes("stroke"))?.map(B=>`${B}`).join("; ");u.selectAll("path").attr("style",N??""),u.selectAll(".row-rect-even path").attr("style",l)}return t.intersect=function(X){return ae.rect(t,X)},u}b(Wd,"erBox");async function Ms(e,t,r,n=0,s=0,i=[],a=""){const o=e.insert("g").attr("class",`label ${i.join(" ")}`).attr("transform",`translate(${n}, ${s})`).attr("style",a);t!==rg(t)&&(t=rg(t),t=t.replaceAll("<","<").replaceAll(">",">"));const l=o.node().appendChild(await Ln(o,t,{width:an(t,r)+100,style:a,useHtmlLabels:r.htmlLabels},r));if(t.includes("<")||t.includes(">")){let u=l.children[0];for(u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">")}let c=l.getBBox();if(wt(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const h=Fe(l);c=u.getBoundingClientRect(),h.attr("width",c.width),h.attr("height",c.height)}return c}b(Ms,"addText");async function Pw(e,t,r,n,s=r.class.padding??12){const i=n?0:3,a=e.insert("g").attr("class",ye(t)).attr("id",t.domId||t.id);let o=null,l=null,c=null,u=null,h=0,f=0,g=0;if(o=a.insert("g").attr("class","annotation-group text"),t.annotations.length>0){const k=t.annotations[0];await Fi(o,{text:`«${k}»`},0),h=o.node().getBBox().height}l=a.insert("g").attr("class","label-group text"),await Fi(l,t,0,["font-weight: bolder"]);const p=l.node().getBBox();f=p.height,c=a.insert("g").attr("class","members-group text");let m=0;for(const k of t.members){const v=await Fi(c,k,m,[k.parseClassifier()]);m+=v+i}g=c.node().getBBox().height,g<=0&&(g=s/2),u=a.insert("g").attr("class","methods-group text");let y=0;for(const k of t.methods){const v=await Fi(u,k,y,[k.parseClassifier()]);y+=v+i}let x=a.node().getBBox();if(o!==null){const k=o.node().getBBox();o.attr("transform",`translate(${-k.width/2})`)}return l.attr("transform",`translate(${-p.width/2}, ${h})`),x=a.node().getBBox(),c.attr("transform",`translate(0, ${h+f+s*2})`),x=a.node().getBBox(),u.attr("transform",`translate(0, ${h+f+(g?g+s*4:s*2)})`),x=a.node().getBBox(),{shapeSvg:a,bbox:x}}b(Pw,"textHelper");async function Fi(e,t,r,n=[]){const s=e.insert("g").attr("class","label").attr("style",n.join("; ")),i=It();let a="useHtmlLabels"in t?t.useHtmlLabels:wt(i.htmlLabels)??!0,o="";"text"in t?o=t.text:o=t.label,!a&&o.startsWith("\\")&&(o=o.substring(1)),Ys(o)&&(a=!0);const l=await Ln(s,Zh(gs(o)),{width:an(o,i)+50,classes:"markdown-node-label",useHtmlLabels:a},i);let c,u=1;if(a){const h=l.children[0],f=Fe(l);u=h.innerHTML.split("<br>").length,h.innerHTML.includes("</math>")&&(u+=h.innerHTML.split("<mrow>").length-1);const g=h.getElementsByTagName("img");if(g){const p=o.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...g].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",p){const k=i.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,_=parseInt(k,10)*5+"px";m.style.minWidth=_,m.style.maxWidth=_}else m.style.width="100%";y(m)}b(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}c=h.getBoundingClientRect(),f.attr("width",c.width),f.attr("height",c.height)}else{n.includes("font-weight: bolder")&&Fe(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const h=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(h.textContent=o[0]+o.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),o[1]===" "&&(h.textContent=h.textContent[0]+" "+h.textContent.substring(1))),h.textContent==="undefined"&&(h.textContent=""),c=l.getBBox()}return s.attr("transform","translate(0,"+(-c.height/(2*u)+r)+")"),c.height}b(Fi,"addText");async function Fw(e,t){const r=qe(),n=r.class.padding??12,s=n,i=t.useHtmlLabels??wt(r.htmlLabels)??!0,a=t;a.annotations=a.annotations??[],a.members=a.members??[],a.methods=a.methods??[];const{shapeSvg:o,bbox:l}=await Pw(e,t,r,i,s),{labelStyles:c,nodeStyles:u}=de(t);t.labelStyle=c,t.cssStyles=a.styles||"";const h=a.styles?.join(";")||u||"";t.cssStyles||(t.cssStyles=h.replaceAll("!important","").split(";"));const f=a.members.length===0&&a.methods.length===0&&!r.class?.hideEmptyMembersBox,g=ue.svg(o),p=he(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=l.width;let y=l.height;a.members.length===0&&a.methods.length===0?y+=s:a.members.length>0&&a.methods.length===0&&(y+=s*2);const x=-m/2,k=-y/2,v=g.rectangle(x-n,k-n-(f?n:a.members.length===0&&a.methods.length===0?-n/2:0),m+2*n,y+2*n+(f?n*2:a.members.length===0&&a.methods.length===0?-n:0),p),_=o.insert(()=>v,":first-child");_.attr("class","basic label-container");const C=_.node().getBBox();o.selectAll(".text").each((A,T,j)=>{const M=Fe(j[T]),P=M.attr("transform");let $=0;if(P){const W=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(P);W&&($=parseFloat(W[2]))}let R=$+k+n-(f?n:a.members.length===0&&a.methods.length===0?-n/2:0);i||(R-=4);let I=x;(M.attr("class").includes("label-group")||M.attr("class").includes("annotation-group"))&&(I=-M.node()?.getBBox().width/2||0,o.selectAll("text").each(function(O,W,Z){window.getComputedStyle(Z[W]).textAnchor==="middle"&&(I=0)})),M.attr("transform",`translate(${I}, ${R})`)});const w=o.select(".annotation-group").node().getBBox().height-(f?n/2:0)||0,S=o.select(".label-group").node().getBBox().height-(f?n/2:0)||0,F=o.select(".members-group").node().getBBox().height-(f?n/2:0)||0;if(a.members.length>0||a.methods.length>0||f){const A=g.line(C.x,w+S+k+n,C.x+C.width,w+S+k+n,p);o.insert(()=>A).attr("class","divider").attr("style",h)}if(f||a.members.length>0||a.methods.length>0){const A=g.line(C.x,w+S+F+k+s*2+n,C.x+C.width,w+S+F+k+n+s*2,p);o.insert(()=>A).attr("class","divider").attr("style",h)}if(a.look!=="handDrawn"&&o.selectAll("path").attr("style",h),_.select(":nth-child(2)").attr("style",h),o.selectAll(".divider").select("path").attr("style",h),t.labelStyle?o.selectAll("span").attr("style",t.labelStyle):o.selectAll("span").attr("style",h),!i){const A=RegExp(/color\s*:\s*([^;]*)/),T=A.exec(h);if(T){const j=T[0].replace("color","fill");o.selectAll("tspan").attr("style",j)}else if(c){const j=A.exec(c);if(j){const M=j[0].replace("color","fill");o.selectAll("tspan").attr("style",M)}}}return ge(t,_),t.intersect=function(A){return ae.rect(t,A)},o}b(Fw,"classBox");async function Ow(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const s=t,i=t,a=20,o=20,l="verifyMethod"in t,c=ye(t),u=e.insert("g").attr("class",c).attr("id",t.domId??t.id);let h;l?h=await Br(u,`<<${s.type}>>`,0,t.labelStyle):h=await Br(u,"<<Element>>",0,t.labelStyle);let f=h;const g=await Br(u,s.name,f,t.labelStyle+"; font-weight: bold;");if(f+=g+o,l){const w=await Br(u,`${s.requirementId?`ID: ${s.requirementId}`:""}`,f,t.labelStyle);f+=w;const S=await Br(u,`${s.text?`Text: ${s.text}`:""}`,f,t.labelStyle);f+=S;const F=await Br(u,`${s.risk?`Risk: ${s.risk}`:""}`,f,t.labelStyle);f+=F,await Br(u,`${s.verifyMethod?`Verification: ${s.verifyMethod}`:""}`,f,t.labelStyle)}else{const w=await Br(u,`${i.type?`Type: ${i.type}`:""}`,f,t.labelStyle);f+=w,await Br(u,`${i.docRef?`Doc Ref: ${i.docRef}`:""}`,f,t.labelStyle)}const p=(u.node()?.getBBox().width??200)+a,m=(u.node()?.getBBox().height??200)+a,y=-p/2,x=-m/2,k=ue.svg(u),v=he(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const _=k.rectangle(y,x,p,m,v),C=u.insert(()=>_,":first-child");if(C.attr("class","basic label-container").attr("style",n),u.selectAll(".label").each((w,S,F)=>{const A=Fe(F[S]),T=A.attr("transform");let j=0,M=0;if(T){const I=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(T);I&&(j=parseFloat(I[1]),M=parseFloat(I[2]))}const P=M-m/2;let $=y+a/2;(S===0||S===1)&&($=j),A.attr("transform",`translate(${$}, ${P+a})`)}),f>h+g+o){const w=k.line(y,x+h+g+o,y+p,x+h+g+o,v);u.insert(()=>w).attr("style",n)}return ge(t,C),t.intersect=function(w){return ae.rect(t,w)},u}b(Ow,"requirementBox");async function Br(e,t,r,n=""){if(t==="")return 0;const s=e.insert("g").attr("class","label").attr("style",n),i=qe(),a=i.htmlLabels??!0,o=await Ln(s,Zh(gs(t)),{width:an(t,i)+50,classes:"markdown-node-label",useHtmlLabels:a,style:n},i);let l;if(a){const c=o.children[0],u=Fe(o);l=c.getBoundingClientRect(),u.attr("width",l.width),u.attr("height",l.height)}else{const c=o.children[0];for(const u of c.children)u.textContent=u.textContent.replaceAll(">",">").replaceAll("<","<"),n&&u.setAttribute("style",n);l=o.getBBox(),l.height+=6}return s.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}b(Br,"addText");var xB=b(e=>{switch(e){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function zw(e,t,{config:r}){const{labelStyles:n,nodeStyles:s}=de(t);t.labelStyle=n||"";const i=10,a=t.width;t.width=(t.width??200)-10;const{shapeSvg:o,bbox:l,label:c}=await ve(e,t,ye(t)),u=t.padding||10;let h="",f;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(h=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),f=o.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",h).attr("target","_blank"));const g={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1};let p,m;f?{label:p,bbox:m}=await Hc(f,"ticket"in t&&t.ticket||"",g):{label:p,bbox:m}=await Hc(o,"ticket"in t&&t.ticket||"",g);const{label:y,bbox:x}=await Hc(o,"assigned"in t&&t.assigned||"",g);t.width=a;const k=10,v=t?.width||0,_=Math.max(m.height,x.height)/2,C=Math.max(l.height+k*2,t?.height||0)+_,w=-v/2,S=-C/2;c.attr("transform","translate("+(u-v/2)+", "+(-_-l.height/2)+")"),p.attr("transform","translate("+(u-v/2)+", "+(-_+l.height/2)+")"),y.attr("transform","translate("+(u+v/2-x.width-2*i)+", "+(-_+l.height/2)+")");let F;const{rx:A,ry:T}=t,{cssStyles:j}=t;if(t.look==="handDrawn"){const M=ue.svg(o),P=he(t,{}),$=A||T?M.path($n(w,S,v,C,A||0),P):M.rectangle(w,S,v,C,P);F=o.insert(()=>$,":first-child"),F.attr("class","basic label-container").attr("style",j||null)}else{F=o.insert("rect",":first-child"),F.attr("class","basic label-container __APA__").attr("style",s).attr("rx",A??5).attr("ry",T??5).attr("x",w).attr("y",S).attr("width",v).attr("height",C);const M="priority"in t&&t.priority;if(M){const P=o.append("line"),$=w+2,R=S+Math.floor((A??0)/2),I=S+C-Math.floor((A??0)/2);P.attr("x1",$).attr("y1",R).attr("x2",$).attr("y2",I).attr("stroke-width","4").attr("stroke",xB(M))}}return ge(t,F),t.height=C,t.intersect=function(M){return ae.rect(t,M)},o}b(zw,"kanbanItem");async function Ww(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a,label:o}=await ve(e,t,ye(t)),l=i.width+10*a,c=i.height+8*a,u=.15*l,{cssStyles:h}=t,f=i.width+20,g=i.height+20,p=Math.max(l,f),m=Math.max(c,g);o.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`);let y;const x=`M0 0
|
|
330
|
-
a${u},${u} 1 0,0 ${p*.25},${-1*m*.1}
|
|
331
|
-
a${u},${u} 1 0,0 ${p*.25},0
|
|
332
|
-
a${u},${u} 1 0,0 ${p*.25},0
|
|
333
|
-
a${u},${u} 1 0,0 ${p*.25},${m*.1}
|
|
334
|
-
|
|
335
|
-
a${u},${u} 1 0,0 ${p*.15},${m*.33}
|
|
336
|
-
a${u*.8},${u*.8} 1 0,0 0,${m*.34}
|
|
337
|
-
a${u},${u} 1 0,0 ${-1*p*.15},${m*.33}
|
|
338
|
-
|
|
339
|
-
a${u},${u} 1 0,0 ${-1*p*.25},${m*.15}
|
|
340
|
-
a${u},${u} 1 0,0 ${-1*p*.25},0
|
|
341
|
-
a${u},${u} 1 0,0 ${-1*p*.25},0
|
|
342
|
-
a${u},${u} 1 0,0 ${-1*p*.25},${-1*m*.15}
|
|
343
|
-
|
|
344
|
-
a${u},${u} 1 0,0 ${-1*p*.1},${-1*m*.33}
|
|
345
|
-
a${u*.8},${u*.8} 1 0,0 0,${-1*m*.34}
|
|
346
|
-
a${u},${u} 1 0,0 ${p*.1},${-1*m*.33}
|
|
347
|
-
H0 V0 Z`;if(t.look==="handDrawn"){const k=ue.svg(s),v=he(t,{}),_=k.path(x,v);y=s.insert(()=>_,":first-child"),y.attr("class","basic label-container").attr("style",$t(h))}else y=s.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",x);return y.attr("transform",`translate(${-p/2}, ${-m/2})`),ge(t,y),t.calcIntersect=function(k,v){return ae.rect(k,v)},t.intersect=function(k){return K.info("Bang intersect",t,k),ae.rect(t,k)},s}b(Ww,"bang");async function Hw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a,label:o}=await ve(e,t,ye(t)),l=i.width+2*a,c=i.height+2*a,u=.15*l,h=.25*l,f=.35*l,g=.2*l,{cssStyles:p}=t;let m;const y=`M0 0
|
|
348
|
-
a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
|
|
349
|
-
a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
|
|
350
|
-
a${h},${h} 1 0,1 ${l*.35},${l*.2}
|
|
351
|
-
|
|
352
|
-
a${u},${u} 1 0,1 ${l*.15},${c*.35}
|
|
353
|
-
a${g},${g} 1 0,1 ${-1*l*.15},${c*.65}
|
|
354
|
-
|
|
355
|
-
a${h},${u} 1 0,1 ${-1*l*.25},${l*.15}
|
|
356
|
-
a${f},${f} 1 0,1 ${-1*l*.5},0
|
|
357
|
-
a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
|
|
358
|
-
|
|
359
|
-
a${u},${u} 1 0,1 ${-1*l*.1},${-1*c*.35}
|
|
360
|
-
a${g},${g} 1 0,1 ${l*.1},${-1*c*.65}
|
|
361
|
-
H0 V0 Z`;if(t.look==="handDrawn"){const x=ue.svg(s),k=he(t,{}),v=x.path(y,k);m=s.insert(()=>v,":first-child"),m.attr("class","basic label-container").attr("style",$t(p))}else m=s.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return o.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`),m.attr("transform",`translate(${-l/2}, ${-c/2})`),ge(t,m),t.calcIntersect=function(x,k){return ae.rect(x,k)},t.intersect=function(x){return K.info("Cloud intersect",t,x),ae.rect(t,x)},s}b(Hw,"cloud");async function qw(e,t){const{labelStyles:r,nodeStyles:n}=de(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a,label:o}=await ve(e,t,ye(t)),l=i.width+8*a,c=i.height+2*a,u=5,h=`
|
|
362
|
-
M${-l/2} ${c/2-u}
|
|
363
|
-
v${-c+2*u}
|
|
364
|
-
q0,-${u} ${u},-${u}
|
|
365
|
-
h${l-2*u}
|
|
366
|
-
q${u},0 ${u},${u}
|
|
367
|
-
v${c-2*u}
|
|
368
|
-
q0,${u} -${u},${u}
|
|
369
|
-
h${-l+2*u}
|
|
370
|
-
q-${u},0 -${u},-${u}
|
|
371
|
-
Z
|
|
372
|
-
`,f=s.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",n).attr("d",h);return s.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),o.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`),s.append(()=>o.node()),ge(t,f),t.calcIntersect=function(g,p){return ae.rect(g,p)},t.intersect=function(g){return ae.rect(t,g)},s}b(qw,"defaultMindmapNode");async function Uw(e,t){const r={padding:t.padding??0};return zd(e,t,r)}b(Uw,"mindmapCircle");var yB=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:vw},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:bw},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Cw},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Nw},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Vk},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:zd},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:Ww},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:Hw},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:mw},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Jk},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:cw},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:lw},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Iw},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:aw},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Yk},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Mw},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Pk},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:kw},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Tw},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:_w},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Qk},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:ew},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Wk},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Hk},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:qk},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:uw},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:Dw},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Zk},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:jw},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:hw},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Uk},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:Gk},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:$w},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:Rw},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Xk},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Lw},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Kk},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:ww},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:gw},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:fw},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Rk},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:zk},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Aw},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Ew},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Bw},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:xw},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:dw}],bB=b(()=>{const t=[...Object.entries({state:Sw,choice:Fk,note:pw,rectWithTitle:yw,labelRect:ow,iconSquare:sw,iconCircle:rw,icon:tw,iconRounded:nw,imageSquare:iw,anchor:Bk,kanbanItem:zw,mindmapCircle:Uw,defaultMindmapNode:qw,classBox:Fw,erBox:Wd,requirementBox:Ow}),...yB.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(s=>[s,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),Vw=bB();function kB(e){return e in Vw}b(kB,"isValidShape");var Fl=new Map;async function Gw(e,t,r){let n,s;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const i=t.shape?Vw[t.shape]:void 0;if(!i)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let a;r.config.securityLevel==="sandbox"?a="_top":t.linkTarget&&(a=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",a??null),s=await i(n,t,r)}else s=await i(e,t,r),n=s;return t.tooltip&&s.attr("title",t.tooltip),Fl.set(t.id,n),t.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}b(Gw,"insertNode");var F9=b((e,t)=>{Fl.set(t.id,e)},"setNodeElem"),O9=b(()=>{Fl.clear()},"clear"),z9=b(e=>{const t=Fl.get(e.id);K.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const r=8,n=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+n-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),n},"positionNode"),wB=b((e,t,r,n,s,i)=>{t.arrowTypeStart&&up(e,"start",t.arrowTypeStart,r,n,s,i),t.arrowTypeEnd&&up(e,"end",t.arrowTypeEnd,r,n,s,i)},"addEdgeMarkers"),vB={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},up=b((e,t,r,n,s,i,a)=>{const o=vB[r];if(!o){K.warn(`Unknown arrow type: ${r}`);return}const l=o.type,u=`${s}_${i}-${l}${t==="start"?"Start":"End"}`;if(a&&a.trim()!==""){const h=a.replace(/[^\dA-Za-z]/g,"_"),f=`${u}_${h}`;if(!document.getElementById(f)){const g=document.getElementById(u);if(g){const p=g.cloneNode(!0);p.id=f,p.querySelectorAll("path, circle, line").forEach(y=>{y.setAttribute("stroke",a),o.fill&&y.setAttribute("fill",a)}),g.parentNode?.appendChild(p)}}e.attr(`marker-${t}`,`url(${n}#${f})`)}else e.attr(`marker-${t}`,`url(${n}#${u})`)},"addEdgeMarker"),il=new Map,_t=new Map,W9=b(()=>{il.clear(),_t.clear()},"clear"),Za=b(e=>e?e.reduce((r,n)=>r+";"+n,""):"","getLabelStyles"),CB=b(async(e,t)=>{let r=wt(qe().flowchart.htmlLabels);const{labelStyles:n}=de(t);t.labelStyle=n;const s=await Ln(e,t.label,{style:t.labelStyle,useHtmlLabels:r,addSvgBackground:!0,isNode:!1});K.info("abc82",t,t.labelType);const i=e.insert("g").attr("class","edgeLabel"),a=i.insert("g").attr("class","label").attr("data-id",t.id);a.node().appendChild(s);let o=s.getBBox();if(r){const c=s.children[0],u=Fe(s);o=c.getBoundingClientRect(),u.attr("width",o.width),u.attr("height",o.height)}a.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),il.set(t.id,i),t.width=o.width,t.height=o.height;let l;if(t.startLabelLeft){const c=await Kn(t.startLabelLeft,Za(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),_t.get(t.id)||_t.set(t.id,{}),_t.get(t.id).startLeft=u,Oi(l,t.startLabelLeft)}if(t.startLabelRight){const c=await Kn(t.startLabelRight,Za(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=u.node().appendChild(c),h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),_t.get(t.id)||_t.set(t.id,{}),_t.get(t.id).startRight=u,Oi(l,t.startLabelRight)}if(t.endLabelLeft){const c=await Kn(t.endLabelLeft,Za(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),_t.get(t.id)||_t.set(t.id,{}),_t.get(t.id).endLeft=u,Oi(l,t.endLabelLeft)}if(t.endLabelRight){const c=await Kn(t.endLabelRight,Za(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),_t.get(t.id)||_t.set(t.id,{}),_t.get(t.id).endRight=u,Oi(l,t.endLabelRight)}return s},"insertEdgeLabel");function Oi(e,t){qe().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}b(Oi,"setTerminalWidth");var SB=b((e,t)=>{K.debug("Moving label abc88 ",e.id,e.label,il.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath;const n=qe(),{subGraphTitleTotalMargin:s}=yd(n);if(e.label){const i=il.get(e.id);let a=e.x,o=e.y;if(r){const l=Tr.calcLabelPosition(r);K.debug("Moving label "+e.label+" from (",a,",",o,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(a=l.x,o=l.y)}i.attr("transform",`translate(${a}, ${o+s/2})`)}if(e.startLabelLeft){const i=_t.get(e.id).startLeft;let a=e.x,o=e.y;if(r){const l=Tr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}if(e.startLabelRight){const i=_t.get(e.id).startRight;let a=e.x,o=e.y;if(r){const l=Tr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}if(e.endLabelLeft){const i=_t.get(e.id).endLeft;let a=e.x,o=e.y;if(r){const l=Tr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}if(e.endLabelRight){const i=_t.get(e.id).endRight;let a=e.x,o=e.y;if(r){const l=Tr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}},"positionEdgeLabel"),_B=b((e,t)=>{const r=e.x,n=e.y,s=Math.abs(t.x-r),i=Math.abs(t.y-n),a=e.width/2,o=e.height/2;return s>=a||i>=o},"outsideNode"),TB=b((e,t,r)=>{K.debug(`intersection calc abc89:
|
|
373
|
-
outsidePoint: ${JSON.stringify(t)}
|
|
374
|
-
insidePoint : ${JSON.stringify(r)}
|
|
375
|
-
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const n=e.x,s=e.y,i=Math.abs(n-r.x),a=e.width/2;let o=r.x<t.x?a-i:a+i;const l=e.height/2,c=Math.abs(t.y-r.y),u=Math.abs(t.x-r.x);if(Math.abs(s-t.y)*a>Math.abs(n-t.x)*l){let h=r.y<t.y?t.y-l-s:s-l-t.y;o=u*h/c;const f={x:r.x<t.x?r.x+o:r.x-u+o,y:r.y<t.y?r.y+c-h:r.y-c+h};return o===0&&(f.x=t.x,f.y=t.y),u===0&&(f.x=t.x),c===0&&(f.y=t.y),K.debug(`abc89 top/bottom calc, Q ${c}, q ${h}, R ${u}, r ${o}`,f),f}else{r.x<t.x?o=t.x-a-n:o=n-a-t.x;let h=c*o/u,f=r.x<t.x?r.x+u-o:r.x-u+o,g=r.y<t.y?r.y+h:r.y-h;return K.debug(`sides calc abc89, Q ${c}, q ${h}, R ${u}, r ${o}`,{_x:f,_y:g}),o===0&&(f=t.x,g=t.y),u===0&&(f=t.x),c===0&&(g=t.y),{x:f,y:g}}},"intersection"),hp=b((e,t)=>{K.warn("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],s=!1;return e.forEach(i=>{if(K.info("abc88 checking point",i,t),!_B(t,i)&&!s){const a=TB(t,n,i);K.debug("abc88 inside",i,n,a),K.debug("abc88 intersection",a,t);let o=!1;r.forEach(l=>{o=o||l.x===a.x&&l.y===a.y}),r.some(l=>l.x===a.x&&l.y===a.y)?K.warn("abc88 no intersect",a,r):r.push(a),s=!0}else K.warn("abc88 outside",i,n),n=i,s||r.push(i)}),K.debug("returning points",r),r},"cutPathAtIntersect");function Yw(e){const t=[],r=[];for(let n=1;n<e.length-1;n++){const s=e[n-1],i=e[n],a=e[n+1];(s.x===i.x&&i.y===a.y&&Math.abs(i.x-a.x)>5&&Math.abs(i.y-s.y)>5||s.y===i.y&&i.x===a.x&&Math.abs(i.x-s.x)>5&&Math.abs(i.y-a.y)>5)&&(t.push(i),r.push(n))}return{cornerPoints:t,cornerPointPositions:r}}b(Yw,"extractCornerPoints");var dp=b(function(e,t,r){const n=t.x-e.x,s=t.y-e.y,i=Math.sqrt(n*n+s*s),a=r/i;return{x:t.x-a*n,y:t.y-a*s}},"findAdjacentPoint"),NB=b(function(e){const{cornerPointPositions:t}=Yw(e),r=[];for(let n=0;n<e.length;n++)if(t.includes(n)){const s=e[n-1],i=e[n+1],a=e[n],o=dp(s,a,5),l=dp(i,a,5),c=l.x-o.x,u=l.y-o.y;r.push(o);const h=Math.sqrt(2)*2;let f={x:a.x,y:a.y};if(Math.abs(i.x-s.x)>10&&Math.abs(i.y-s.y)>=10){K.debug("Corner point fixing",Math.abs(i.x-s.x),Math.abs(i.y-s.y));const g=5;a.x===o.x?f={x:c<0?o.x-g+h:o.x+g-h,y:u<0?o.y-h:o.y+h}:f={x:c<0?o.x-h:o.x+h,y:u<0?o.y-g+h:o.y+g-h}}else K.debug("Corner point skipping fixing",Math.abs(i.x-s.x),Math.abs(i.y-s.y));r.push(f,l)}else r.push(e[n]);return r},"fixCorners"),EB=b((e,t,r)=>{const n=e-t-r,s=2,i=2,a=s+i,o=Math.floor(n/a),l=Array(o).fill(`${s} ${i}`).join(" ");return`0 ${t} ${l} ${r}`},"generateDashArray"),AB=b(function(e,t,r,n,s,i,a,o=!1){const{handDrawnSeed:l}=qe();let c=t.points,u=!1;const h=s;var f=i;const g=[];for(const $ in t.cssCompiledStyles)_b($)||g.push(t.cssCompiledStyles[$]);K.debug("UIO intersect check",t.points,f.x,h.x),f.intersect&&h.intersect&&!o&&(c=c.slice(1,t.points.length-1),c.unshift(h.intersect(c[0])),K.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],f,f.intersect(c[c.length-1])),c.push(f.intersect(c[c.length-1])));const p=btoa(JSON.stringify(c));t.toCluster&&(K.info("to cluster abc88",r.get(t.toCluster)),c=hp(t.points,r.get(t.toCluster).node),u=!0),t.fromCluster&&(K.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(c,null,2)),c=hp(c.reverse(),r.get(t.fromCluster).node).reverse(),u=!0);let m=c.filter($=>!Number.isNaN($.y));m=NB(m);let y=fo;switch(y=Bo,t.curve){case"linear":y=Bo;break;case"basis":y=fo;break;case"cardinal":y=Ax;break;case"bumpX":y=Sx;break;case"bumpY":y=_x;break;case"catmullRom":y=jx;break;case"monotoneX":y=Rx;break;case"monotoneY":y=Px;break;case"natural":y=Ox;break;case"step":y=zx;break;case"stepAfter":y=Hx;break;case"stepBefore":y=Wx;break;default:y=fo}const{x,y:k}=N$(t),v=uL().x(x).y(k).curve(y);let _;switch(t.thickness){case"normal":_="edge-thickness-normal";break;case"thick":_="edge-thickness-thick";break;case"invisible":_="edge-thickness-invisible";break;default:_="edge-thickness-normal"}switch(t.pattern){case"solid":_+=" edge-pattern-solid";break;case"dotted":_+=" edge-pattern-dotted";break;case"dashed":_+=" edge-pattern-dashed";break;default:_+=" edge-pattern-solid"}let C,w=t.curve==="rounded"?Xw(Kw(m,t),5):v(m);const S=Array.isArray(t.style)?t.style:[t.style];let F=S.find($=>$?.startsWith("stroke:")),A=!1;if(t.look==="handDrawn"){const $=ue.svg(e);Object.assign([],m);const R=$.path(w,{roughness:.3,seed:l});_+=" transition",C=Fe(R).select("path").attr("id",t.id).attr("class"," "+_+(t.classes?" "+t.classes:"")).attr("style",S?S.reduce((O,W)=>O+";"+W,""):"");let I=C.attr("d");C.attr("d",I),e.node().appendChild(C.node())}else{const $=g.join(";"),R=S?S.reduce((X,N)=>X+N+";",""):"";let I="";t.animate&&(I=" edge-animation-fast"),t.animation&&(I=" edge-animation-"+t.animation);const O=($?$+";"+R+";":R)+";"+(S?S.reduce((X,N)=>X+";"+N,""):"");C=e.append("path").attr("d",w).attr("id",t.id).attr("class"," "+_+(t.classes?" "+t.classes:"")+(I??"")).attr("style",O),F=O.match(/stroke:([^;]+)/)?.[1],A=t.animate===!0||!!t.animation||$.includes("animation");const W=C.node(),Z=typeof W.getTotalLength=="function"?W.getTotalLength():0,E=Ag[t.arrowTypeStart]||0,D=Ag[t.arrowTypeEnd]||0;if(t.look==="neo"&&!A){const N=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?EB(Z,E,D):`0 ${E} ${Z-E-D} ${D}`}; stroke-dashoffset: 0;`;C.attr("style",N+C.attr("style"))}}C.attr("data-edge",!0),C.attr("data-et","edge"),C.attr("data-id",t.id),C.attr("data-points",p),t.showPoints&&m.forEach($=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",$.x).attr("cy",$.y)});let T="";(qe().flowchart.arrowMarkerAbsolute||qe().state.arrowMarkerAbsolute)&&(T=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,T=T.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),K.info("arrowTypeStart",t.arrowTypeStart),K.info("arrowTypeEnd",t.arrowTypeEnd),wB(C,t,T,a,n,F);const j=Math.floor(c.length/2),M=c[j];Tr.isLabelCoordinateInPath(M,C.attr("d"))||(u=!0);let P={};return u&&(P.updatedPath=c),P.originalPath=t.points,P},"insertEdge");function Xw(e,t){if(e.length<2)return"";let r="";const n=e.length,s=1e-5;for(let i=0;i<n;i++){const a=e[i],o=e[i-1],l=e[i+1];if(i===0)r+=`M${a.x},${a.y}`;else if(i===n-1)r+=`L${a.x},${a.y}`;else{const c=a.x-o.x,u=a.y-o.y,h=l.x-a.x,f=l.y-a.y,g=Math.hypot(c,u),p=Math.hypot(h,f);if(g<s||p<s){r+=`L${a.x},${a.y}`;continue}const m=c/g,y=u/g,x=h/p,k=f/p,v=m*x+y*k,_=Math.max(-1,Math.min(1,v)),C=Math.acos(_);if(C<s||Math.abs(Math.PI-C)<s){r+=`L${a.x},${a.y}`;continue}const w=Math.min(t/Math.sin(C/2),g/2,p/2),S=a.x-m*w,F=a.y-y*w,A=a.x+x*w,T=a.y+k*w;r+=`L${S},${F}`,r+=`Q${a.x},${a.y} ${A},${T}`}}return r}b(Xw,"generateRoundedPath");function nh(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const r=t.x-e.x,n=t.y-e.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}b(nh,"calculateDeltaAndAngle");function Kw(e,t){const r=e.map(s=>({...s}));if(e.length>=2&&Mt[t.arrowTypeStart]){const s=Mt[t.arrowTypeStart],i=e[0],a=e[1],{angle:o}=nh(i,a),l=s*Math.cos(o),c=s*Math.sin(o);r[0].x=i.x+l,r[0].y=i.y+c}const n=e.length;if(n>=2&&Mt[t.arrowTypeEnd]){const s=Mt[t.arrowTypeEnd],i=e[n-1],a=e[n-2],{angle:o}=nh(a,i),l=s*Math.cos(o),c=s*Math.sin(o);r[n-1].x=i.x-l,r[n-1].y=i.y-c}return r}b(Kw,"applyMarkerOffsetsToPoints");var MB=b((e,t,r,n)=>{t.forEach(s=>{VB[s](e,r,n)})},"insertMarkers"),jB=b((e,t,r)=>{K.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),IB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),LB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),$B=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),DB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),BB=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),RB=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),PB=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),FB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),OB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),zB=b((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const s=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),s.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),WB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),HB=b((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const s=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),s.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),qB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
376
|
-
L20,10
|
|
377
|
-
M20,10
|
|
378
|
-
L0,20`)},"requirement_arrow"),UB=b((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),VB={extension:jB,composition:IB,aggregation:LB,dependency:$B,lollipop:DB,point:BB,circle:RB,cross:PB,barb:FB,only_one:OB,zero_or_one:zB,one_or_more:WB,zero_or_more:HB,requirement_arrow:qB,requirement_contains:UB},GB=MB,YB={common:ni,getConfig:It,insertCluster:rB,insertEdge:AB,insertEdgeLabel:CB,insertMarkers:GB,insertNode:Gw,interpolateToCurve:Cd,labelHelper:ve,log:K,positionEdgeLabel:SB},da={},Qw=b(e=>{for(const t of e)da[t.name]=t},"registerLayoutLoaders"),XB=b(()=>{Qw([{name:"dagre",loader:b(async()=>await Ve(()=>import("./dagre-6UL2VRFP-s7YD2ZcY.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")},{name:"cose-bilkent",loader:b(async()=>await Ve(()=>import("./cose-bilkent-S5V4N54A-D9ZC6LmB.js"),__vite__mapDeps([23,24,7,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")}])},"registerDefaultLayoutLoaders");XB();var H9=b(async(e,t)=>{if(!(e.layoutAlgorithm in da))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=da[e.layoutAlgorithm];return(await r.loader()).render(e,t,YB,{algorithm:r.algorithm})},"render"),q9=b((e="",{fallback:t="dagre"}={})=>{if(e in da)return e;if(t in da)return K.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Zw="comm",Jw="rule",e1="decl",KB="@import",QB="@namespace",ZB="@keyframes",JB="@layer",t1=Math.abs,Hd=String.fromCharCode;function r1(e){return e.trim()}function yo(e,t,r){return e.replace(t,r)}function eR(e,t,r){return e.indexOf(t,r)}function Ds(e,t){return e.charCodeAt(t)|0}function Js(e,t,r){return e.slice(t,r)}function Pr(e){return e.length}function tR(e){return e.length}function Ja(e,t){return t.push(e),e}var Ol=1,ei=1,n1=0,xr=0,mt=0,li="";function qd(e,t,r,n,s,i,a,o){return{value:e,root:t,parent:r,type:n,props:s,children:i,line:Ol,column:ei,length:a,return:"",siblings:o}}function rR(){return mt}function nR(){return mt=xr>0?Ds(li,--xr):0,ei--,mt===10&&(ei=1,Ol--),mt}function Ar(){return mt=xr<n1?Ds(li,xr++):0,ei++,mt===10&&(ei=1,Ol++),mt}function Sn(){return Ds(li,xr)}function bo(){return xr}function zl(e,t){return Js(li,e,t)}function fa(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function sR(e){return Ol=ei=1,n1=Pr(li=e),xr=0,[]}function iR(e){return li="",e}function qc(e){return r1(zl(xr-1,sh(e===91?e+2:e===40?e+1:e)))}function aR(e){for(;(mt=Sn())&&mt<33;)Ar();return fa(e)>2||fa(mt)>3?"":" "}function oR(e,t){for(;--t&&Ar()&&!(mt<48||mt>102||mt>57&&mt<65||mt>70&&mt<97););return zl(e,bo()+(t<6&&Sn()==32&&Ar()==32))}function sh(e){for(;Ar();)switch(mt){case e:return xr;case 34:case 39:e!==34&&e!==39&&sh(mt);break;case 40:e===41&&sh(e);break;case 92:Ar();break}return xr}function lR(e,t){for(;Ar()&&e+mt!==57;)if(e+mt===84&&Sn()===47)break;return"/*"+zl(t,xr-1)+"*"+Hd(e===47?e:Ar())}function cR(e){for(;!fa(Sn());)Ar();return zl(e,xr)}function uR(e){return iR(ko("",null,null,null,[""],e=sR(e),0,[0],e))}function ko(e,t,r,n,s,i,a,o,l){for(var c=0,u=0,h=a,f=0,g=0,p=0,m=1,y=1,x=1,k=0,v="",_=s,C=i,w=n,S=v;y;)switch(p=k,k=Ar()){case 40:if(p!=108&&Ds(S,h-1)==58){eR(S+=yo(qc(k),"&","&\f"),"&\f",t1(c?o[c-1]:0))!=-1&&(x=-1);break}case 34:case 39:case 91:S+=qc(k);break;case 9:case 10:case 13:case 32:S+=aR(p);break;case 92:S+=oR(bo()-1,7);continue;case 47:switch(Sn()){case 42:case 47:Ja(hR(lR(Ar(),bo()),t,r,l),l),(fa(p||1)==5||fa(Sn()||1)==5)&&Pr(S)&&Js(S,-1,void 0)!==" "&&(S+=" ");break;default:S+="/"}break;case 123*m:o[c++]=Pr(S)*x;case 125*m:case 59:case 0:switch(k){case 0:case 125:y=0;case 59+u:x==-1&&(S=yo(S,/\f/g,"")),g>0&&(Pr(S)-h||m===0&&p===47)&&Ja(g>32?gp(S+";",n,r,h-1,l):gp(yo(S," ","")+";",n,r,h-2,l),l);break;case 59:S+=";";default:if(Ja(w=fp(S,t,r,c,u,s,o,v,_=[],C=[],h,i),i),k===123)if(u===0)ko(S,t,w,w,_,i,h,o,C);else{switch(f){case 99:if(Ds(S,3)===110)break;case 108:if(Ds(S,2)===97)break;default:u=0;case 100:case 109:case 115:}u?ko(e,w,w,n&&Ja(fp(e,w,w,0,0,s,o,v,s,_=[],h,C),C),s,C,h,o,n?_:C):ko(S,w,w,w,[""],C,0,o,C)}}c=u=g=0,m=x=1,v=S="",h=a;break;case 58:h=1+Pr(S),g=p;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&nR()==125)continue}switch(S+=Hd(k),k*m){case 38:x=u>0?1:(S+="\f",-1);break;case 44:o[c++]=(Pr(S)-1)*x,x=1;break;case 64:Sn()===45&&(S+=qc(Ar())),f=Sn(),u=h=Pr(v=S+=cR(bo())),k++;break;case 45:p===45&&Pr(S)==2&&(m=0)}}return i}function fp(e,t,r,n,s,i,a,o,l,c,u,h){for(var f=s-1,g=s===0?i:[""],p=tR(g),m=0,y=0,x=0;m<n;++m)for(var k=0,v=Js(e,f+1,f=t1(y=a[m])),_=e;k<p;++k)(_=r1(y>0?g[k]+" "+v:yo(v,/&\f/g,g[k])))&&(l[x++]=_);return qd(e,t,r,s===0?Jw:o,l,c,u,h)}function hR(e,t,r,n){return qd(e,t,r,Zw,Hd(rR()),Js(e,2,-2),0,n)}function gp(e,t,r,n,s){return qd(e,t,r,e1,Js(e,0,n),Js(e,n+1,-1),n,s)}function ih(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function dR(e,t,r,n){switch(e.type){case JB:if(e.children.length)break;case KB:case QB:case e1:return e.return=e.return||e.value;case Zw:return"";case ZB:return e.return=e.value+"{"+ih(e.children,n)+"}";case Jw:if(!Pr(e.value=e.props.join(",")))return""}return Pr(r=ih(e.children,n))?e.return=e.value+"{"+r+"}":""}var fR=Ab(Object.keys,Object),gR=Object.prototype,pR=gR.hasOwnProperty;function mR(e){if(!Ml(e))return fR(e);var t=[];for(var r in Object(e))pR.call(e,r)&&r!="constructor"&&t.push(r);return t}var ah=fs(Ur,"DataView"),oh=fs(Ur,"Promise"),lh=fs(Ur,"Set"),ch=fs(Ur,"WeakMap"),pp="[object Map]",xR="[object Object]",mp="[object Promise]",xp="[object Set]",yp="[object WeakMap]",bp="[object DataView]",yR=ds(ah),bR=ds(ua),kR=ds(oh),wR=ds(lh),vR=ds(ch),Un=ii;(ah&&Un(new ah(new ArrayBuffer(1)))!=bp||ua&&Un(new ua)!=pp||oh&&Un(oh.resolve())!=mp||lh&&Un(new lh)!=xp||ch&&Un(new ch)!=yp)&&(Un=function(e){var t=ii(e),r=t==xR?e.constructor:void 0,n=r?ds(r):"";if(n)switch(n){case yR:return bp;case bR:return pp;case kR:return mp;case wR:return xp;case vR:return yp}return t});var CR="[object Map]",SR="[object Set]",_R=Object.prototype,TR=_R.hasOwnProperty;function kp(e){if(e==null)return!0;if(jl(e)&&(Xo(e)||typeof e=="string"||typeof e.splice=="function"||wd(e)||vd(e)||Yo(e)))return!e.length;var t=Un(e);if(t==CR||t==SR)return!e.size;if(Ml(e))return!mR(e).length;for(var r in e)if(TR.call(e,r))return!1;return!0}var s1="c4",NR=b(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),ER=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-gAp3--Ee.js");return{diagram:t}},__vite__mapDeps([25,26,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:s1,diagram:e}},"loader"),AR={id:s1,detector:NR,loader:ER},MR=AR,i1="flowchart",jR=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),IR=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DjCIshpi.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:i1,diagram:e}},"loader"),LR={id:i1,detector:jR,loader:IR},$R=LR,a1="flowchart-v2",DR=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),BR=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DjCIshpi.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:a1,diagram:e}},"loader"),RR={id:a1,detector:DR,loader:BR},PR=RR,o1="er",FR=b(e=>/^\s*erDiagram/.test(e),"detector"),OR=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-tM4HKBpy.js");return{diagram:t}},__vite__mapDeps([32,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:o1,diagram:e}},"loader"),zR={id:o1,detector:FR,loader:OR},WR=zR,l1="gitGraph",HR=b(e=>/^\s*gitGraph/.test(e),"detector"),qR=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-B3Uw90Yt.js");return{diagram:t}},__vite__mapDeps([33,34,35,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:l1,diagram:e}},"loader"),UR={id:l1,detector:HR,loader:qR},VR=UR,c1="gantt",GR=b(e=>/^\s*gantt/.test(e),"detector"),YR=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./ganttDiagram-LVOFAZNH-Q6plkI5G.js");return{diagram:t}},__vite__mapDeps([37,7,38,39,40,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:c1,diagram:e}},"loader"),XR={id:c1,detector:GR,loader:YR},KR=XR,u1="info",QR=b(e=>/^\s*info/.test(e),"detector"),ZR=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./infoDiagram-F6ZHWCRC-HUfwv_JT.js");return{diagram:t}},__vite__mapDeps([41,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:u1,diagram:e}},"loader"),JR={id:u1,detector:QR,loader:ZR},h1="pie",eP=b(e=>/^\s*pie/.test(e),"detector"),tP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-8vPxErLm.js");return{diagram:t}},__vite__mapDeps([42,34,36,8,7,2,4,5,43,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:h1,diagram:e}},"loader"),rP={id:h1,detector:eP,loader:tP},d1="quadrantChart",nP=b(e=>/^\s*quadrantChart/.test(e),"detector"),sP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-Pn0NZ9k7.js");return{diagram:t}},__vite__mapDeps([45,38,39,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:d1,diagram:e}},"loader"),iP={id:d1,detector:nP,loader:sP},aP=iP,f1="xychart",oP=b(e=>/^\s*xychart(-beta)?/.test(e),"detector"),lP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-DG3KmjD-.js");return{diagram:t}},__vite__mapDeps([46,39,44,38,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:f1,diagram:e}},"loader"),cP={id:f1,detector:oP,loader:lP},uP=cP,g1="requirement",hP=b(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),dP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-C7u8MiN1.js");return{diagram:t}},__vite__mapDeps([47,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:g1,diagram:e}},"loader"),fP={id:g1,detector:hP,loader:dP},gP=fP,p1="sequence",pP=b(e=>/^\s*sequenceDiagram/.test(e),"detector"),mP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-pXBA2_3B.js");return{diagram:t}},__vite__mapDeps([48,26,35,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:p1,diagram:e}},"loader"),xP={id:p1,detector:pP,loader:mP},yP=xP,m1="class",bP=b((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),kP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-DwEqkkEb.js");return{diagram:t}},__vite__mapDeps([49,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:m1,diagram:e}},"loader"),wP={id:m1,detector:bP,loader:kP},vP=wP,x1="classDiagram",CP=b((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),SP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-DwEqkkEb.js");return{diagram:t}},__vite__mapDeps([51,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:x1,diagram:e}},"loader"),_P={id:x1,detector:CP,loader:SP},TP=_P,y1="state",NP=b((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),EP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-CxZMM1Lf.js");return{diagram:t}},__vite__mapDeps([52,53,29,30,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:y1,diagram:e}},"loader"),AP={id:y1,detector:NP,loader:EP},MP=AP,b1="stateDiagram",jP=b((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),IP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-CmurzrWf.js");return{diagram:t}},__vite__mapDeps([54,53,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:b1,diagram:e}},"loader"),LP={id:b1,detector:jP,loader:IP},$P=LP,k1="journey",DP=b(e=>/^\s*journey/.test(e),"detector"),BP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-CgQogtHU.js");return{diagram:t}},__vite__mapDeps([55,26,28,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:k1,diagram:e}},"loader"),RP={id:k1,detector:DP,loader:BP},PP=RP,FP=b((e,t,r)=>{K.debug(`rendering svg for syntax error
|
|
379
|
-
`);const n=bL(t),s=n.append("g");n.attr("viewBox","0 0 2412 512"),G0(n,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),w1={draw:FP},OP=w1,zP={db:{},renderer:w1,parser:{parse:b(()=>{},"parse")}},WP=zP,v1="flowchart-elk",HP=b((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),qP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DjCIshpi.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:v1,diagram:e}},"loader"),UP={id:v1,detector:HP,loader:qP},VP=UP,C1="timeline",GP=b(e=>/^\s*timeline/.test(e),"detector"),YP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-Crg44TaP.js");return{diagram:t}},__vite__mapDeps([56,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:C1,diagram:e}},"loader"),XP={id:C1,detector:GP,loader:YP},KP=XP,S1="mindmap",QP=b(e=>/^\s*mindmap/.test(e),"detector"),ZP=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-D5wd9HsH.js");return{diagram:t}},__vite__mapDeps([57,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:S1,diagram:e}},"loader"),JP={id:S1,detector:QP,loader:ZP},eF=JP,_1="kanban",tF=b(e=>/^\s*kanban/.test(e),"detector"),rF=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-Cv7kVxyy.js");return{diagram:t}},__vite__mapDeps([58,28,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:_1,diagram:e}},"loader"),nF={id:_1,detector:tF,loader:rF},sF=nF,T1="sankey",iF=b(e=>/^\s*sankey(-beta)?/.test(e),"detector"),aF=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-C660O4mw.js");return{diagram:t}},__vite__mapDeps([59,44,39,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:T1,diagram:e}},"loader"),oF={id:T1,detector:iF,loader:aF},lF=oF,N1="packet",cF=b(e=>/^\s*packet(-beta)?/.test(e),"detector"),uF=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-Cu-zjwc9.js");return{diagram:t}},__vite__mapDeps([60,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:N1,diagram:e}},"loader"),hF={id:N1,detector:cF,loader:uF},E1="radar",dF=b(e=>/^\s*radar-beta/.test(e),"detector"),fF=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-B348GmS1.js");return{diagram:t}},__vite__mapDeps([61,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:E1,diagram:e}},"loader"),gF={id:E1,detector:dF,loader:fF},A1="block",pF=b(e=>/^\s*block(-beta)?/.test(e),"detector"),mF=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-CYO9EYkJ.js");return{diagram:t}},__vite__mapDeps([62,28,5,2,1,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:A1,diagram:e}},"loader"),xF={id:A1,detector:pF,loader:mF},yF=xF,M1="architecture",bF=b(e=>/^\s*architecture/.test(e),"detector"),kF=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-kwdTmjuB.js");return{diagram:t}},__vite__mapDeps([63,34,36,8,7,2,4,5,24,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:M1,diagram:e}},"loader"),wF={id:M1,detector:bF,loader:kF},vF=wF,j1="treemap",CF=b(e=>/^\s*treemap/.test(e),"detector"),SF=b(async()=>{const{diagram:e}=await Ve(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-C7jhP5tx.js");return{diagram:t}},__vite__mapDeps([64,30,34,36,8,7,2,4,5,40,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:j1,diagram:e}},"loader"),_F={id:j1,detector:CF,loader:SF},wp=!1,Wl=b(()=>{wp||(wp=!0,Ao("error",WP,e=>e.toLowerCase().trim()==="error"),Ao("---",{db:{clear:b(()=>{},"clear")},styles:{},renderer:{draw:b(()=>{},"draw")},parser:{parse:b(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:b(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),mu(VP,eF,vF),mu(MR,sF,TP,vP,WR,KR,JR,rP,gP,yP,PR,$R,KP,VR,$P,MP,PP,aP,lF,hF,uP,yF,gF,_F))},"addDiagrams"),TF=b(async()=>{K.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(ns).map(async([r,{detector:n,loader:s}])=>{if(s)try{ku(r)}catch{try{const{diagram:i,id:a}=await s();Ao(a,i,n)}catch(i){throw K.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete ns[r],i}}}))).filter(r=>r.status==="rejected");if(t.length>0){K.error(`Failed to load ${t.length} external diagrams`);for(const r of t)K.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),NF="graphics-document document";function I1(e,t){e.attr("role",NF),t!==""&&e.attr("aria-roledescription",t)}b(I1,"setA11yDiagramInfo");function L1(e,t,r,n){if(e.insert!==void 0){if(r){const s=`chart-desc-${n}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${n}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}b(L1,"addSVGa11yTitleDescription");var Jn,uh=(Jn=class{constructor(t,r,n,s,i){this.type=t,this.text=r,this.db=n,this.parser=s,this.renderer=i}static async fromText(t,r={}){const n=It(),s=Vh(t,n);t=_D(t)+`
|
|
380
|
-
`;try{ku(s)}catch{const c=XE(s);if(!c)throw new D0(`Diagram ${s} not found.`);const{id:u,diagram:h}=await c();Ao(u,h)}const{db:i,parser:a,renderer:o,init:l}=ku(s);return a.parser&&(a.parser.yy=i),i.clear?.(),l?.(n),r.title&&i.setDiagramTitle?.(r.title),await a.parse(t),new Jn(s,t,i,a,o)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},b(Jn,"Diagram"),Jn),vp=[],EF=b(()=>{vp.forEach(e=>{e()}),vp=[]},"attachFunctions"),AF=b(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function $1(e){const t=e.match($0);if(!t)return{text:e,metadata:{}};let r=T$(t[1],{schema:_$})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:e.slice(t[0].length),metadata:n}}b($1,"extractFrontMatter");var MF=b(e=>e.replace(/\r\n?/g,`
|
|
381
|
-
`).replace(/<(\w+)([^>]*)>/g,(t,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),jF=b(e=>{const{text:t,metadata:r}=$1(e),{displayMode:n,title:s,config:i={}}=r;return n&&(i.gantt||(i.gantt={}),i.gantt.displayMode=n),{title:s,config:i,text:t}},"processFrontmatter"),IF=b(e=>{const t=Tr.detectInit(e)??{},r=Tr.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:n})=>n==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:dD(e),directive:t}},"processDirectives");function Ud(e){const t=MF(e),r=jF(t),n=IF(r.text),s=Ed(r.config,n.directive);return e=AF(n.text),{code:e,title:r.title,config:s}}b(Ud,"preprocessDiagram");function D1(e){const t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(r)}b(D1,"toBase64");var LF=5e4,$F="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",DF="sandbox",BF="loose",RF="http://www.w3.org/2000/svg",PF="http://www.w3.org/1999/xlink",FF="http://www.w3.org/1999/xhtml",OF="100%",zF="100%",WF="border:0;margin:0;",HF="margin:0",qF="allow-top-navigation-by-user-activation allow-popups",UF='The "iframe" tag is not supported by your browser.',VF=["foreignobject"],GF=["dominant-baseline"];function Vd(e){const t=Ud(e);return No(),hA(t.config??{}),t}b(Vd,"processAndSetConfigs");async function B1(e,t){Wl();try{const{code:r,config:n}=Vd(e);return{diagramType:(await P1(r)).type,config:n}}catch(r){if(t?.suppressErrors)return!1;throw r}}b(B1,"parse");var Cp=b((e,t,r=[])=>`
|
|
382
|
-
.${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),YF=b((e,t=new Map)=>{let r="";if(e.themeCSS!==void 0&&(r+=`
|
|
383
|
-
${e.themeCSS}`),e.fontFamily!==void 0&&(r+=`
|
|
384
|
-
:root { --mermaid-font-family: ${e.fontFamily}}`),e.altFontFamily!==void 0&&(r+=`
|
|
385
|
-
:root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){const a=e.htmlLabels??e.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(o=>{kp(o.styles)||a.forEach(l=>{r+=Cp(o.id,l,o.styles)}),kp(o.textStyles)||(r+=Cp(o.id,"tspan",(o?.textStyles||[]).map(l=>l.replace("color","fill"))))})}return r},"createCssStyles"),XF=b((e,t,r,n)=>{const s=YF(e,r),i=jA(t,s,e.themeVariables);return ih(uR(`${n}{${i}}`),dR)},"createUserStyles"),KF=b((e="",t,r)=>{let n=e;return!r&&!t&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=gs(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),QF=b((e="",t)=>{const r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":zF,n=D1(`<body style="${HF}">${e}</body>`);return`<iframe style="width:${OF};height:${r};${WF}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${qF}">
|
|
386
|
-
${UF}
|
|
387
|
-
</iframe>`},"putIntoIFrame"),Sp=b((e,t,r,n,s)=>{const i=e.append("div");i.attr("id",r),n&&i.attr("style",n);const a=i.append("svg").attr("id",t).attr("width","100%").attr("xmlns",RF);return s&&a.attr("xmlns:xlink",s),a.append("g"),e},"appendDivSvgG");function hh(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}b(hh,"sandboxedIframe");var ZF=b((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),JF=b(async function(e,t,r){Wl();const n=Vd(t);t=n.code;const s=It();K.debug(s),t.length>(s?.maxTextSize??LF)&&(t=$F);const i="#"+e,a="i"+e,o="#"+a,l="d"+e,c="#"+l,u=b(()=>{const P=Fe(f?o:c).node();P&&"remove"in P&&P.remove()},"removeTempElements");let h=Fe("body");const f=s.securityLevel===DF,g=s.securityLevel===BF,p=s.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const M=hh(Fe(r),a);h=Fe(M.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Fe(r);Sp(h,e,l,`font-family: ${p}`,PF)}else{if(ZF(document,e,l,a),f){const M=hh(Fe("body"),a);h=Fe(M.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Fe("body");Sp(h,e,l)}let m,y;try{m=await uh.fromText(t,{title:n.title})}catch(M){if(s.suppressErrorRendering)throw u(),M;m=await uh.fromText("error"),y=M}const x=h.select(c).node(),k=m.type,v=x.firstChild,_=v.firstChild,C=m.renderer.getClasses?.(t,m),w=XF(s,k,C,i),S=document.createElement("style");S.innerHTML=w,v.insertBefore(S,_);try{await m.renderer.draw(t,e,qf.version,m)}catch(M){throw s.suppressErrorRendering?u():OP.draw(t,e,qf.version),M}const F=h.select(`${c} svg`),A=m.db.getAccTitle?.(),T=m.db.getAccDescription?.();F1(k,F,A,T),h.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",FF);let j=h.select(c).node().innerHTML;if(K.debug("config.arrowMarkerAbsolute",s.arrowMarkerAbsolute),j=KF(j,f,wt(s.arrowMarkerAbsolute)),f){const M=h.select(c+" svg").node();j=QF(j,M)}else g||(j=Vs.sanitize(j,{ADD_TAGS:VF,ADD_ATTR:GF,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(EF(),y)throw y;return u(),{diagramType:k,svg:j,bindFunctions:m.db.bindFunctions}},"render");function R1(e={}){const t=bt({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),cA(t),t?.theme&&t.theme in rn?t.themeVariables=rn[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=rn.default.getThemeVariables(t.themeVariables));const r=typeof t=="object"?lA(t):O0();Uh(r.logLevel),Wl()}b(R1,"initialize");var P1=b((e,t={})=>{const{code:r}=Ud(e);return uh.fromText(r,t)},"getDiagramFromText");function F1(e,t,r,n){I1(t,e),L1(t,r,n,t.attr("id"))}b(F1,"addA11yInfo");var cs=Object.freeze({render:JF,parse:B1,getDiagramFromText:P1,initialize:R1,getConfig:It,setConfig:z0,getSiteConfig:O0,updateSiteConfig:uA,reset:b(()=>{No()},"reset"),globalReset:b(()=>{No(Gs)},"globalReset"),defaultConfig:Gs});Uh(It().logLevel);No(It());var eO=b((e,t,r)=>{K.warn(e),Nd(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),O1=b(async function(e={querySelector:".mermaid"}){try{await tO(e)}catch(t){if(Nd(t)&&K.error(t.str),on.parseError&&on.parseError(t),!e.suppressErrors)throw K.error("Use the suppressErrors option to suppress these errors"),t}},"run"),tO=b(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){const n=cs.getConfig();K.debug(`${e?"":"No "}Callback function found`);let s;if(r)s=r;else if(t)s=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");K.debug(`Found ${s.length} diagrams`),n?.startOnLoad!==void 0&&(K.debug("Start On Load: "+n?.startOnLoad),cs.updateSiteConfig({startOnLoad:n?.startOnLoad}));const i=new Tr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let a;const o=[];for(const l of Array.from(s)){if(K.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${i.next()}`;a=l.innerHTML,a=ok(Tr.entityDecode(a)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Tr.detectInit(a);u&&K.debug("Detected early reinit: ",u);try{const{svg:h,bindFunctions:f}=await q1(c,a,l);l.innerHTML=h,e&&await e(c),f&&f(l)}catch(h){eO(h,o,on.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),z1=b(function(e){cs.initialize(e)},"initialize"),rO=b(async function(e,t,r){K.warn("mermaid.init is deprecated. Please use run instead."),e&&z1(e);const n={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await O1(n)},"init"),nO=b(async(e,{lazyLoad:t=!0}={})=>{Wl(),mu(...e),t===!1&&await TF()},"registerExternalDiagrams"),W1=b(function(){if(on.startOnLoad){const{startOnLoad:e}=cs.getConfig();e&&on.run().catch(t=>K.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",W1,!1);var sO=b(function(e){on.parseError=e},"setParseErrorHandler"),al=[],Uc=!1,H1=b(async()=>{if(!Uc){for(Uc=!0;al.length>0;){const e=al.shift();if(e)try{await e()}catch(t){K.error("Error executing queue",t)}}Uc=!1}},"executeQueue"),iO=b(async(e,t)=>new Promise((r,n)=>{const s=b(()=>new Promise((i,a)=>{cs.parse(e,t).then(o=>{i(o),r(o)},o=>{K.error("Error parsing",o),on.parseError?.(o),a(o),n(o)})}),"performCall");al.push(s),H1().catch(n)}),"parse"),q1=b((e,t,r)=>new Promise((n,s)=>{const i=b(()=>new Promise((a,o)=>{cs.render(e,t,r).then(l=>{a(l),n(l)},l=>{K.error("Error parsing",l),on.parseError?.(l),o(l),s(l)})}),"performCall");al.push(i),H1().catch(s)}),"render"),aO=b(()=>Object.keys(ns).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),on={startOnLoad:!0,mermaidAPI:cs,parse:iO,render:q1,init:rO,run:O1,registerExternalDiagrams:nO,registerLayoutLoaders:Qw,initialize:z1,parseError:void 0,contentLoaded:W1,setParseErrorHandler:sO,detectType:Vh,registerIconPacks:A3,getRegisteredDiagramsMetadata:aO},_p=on;/*! Check if previously processed *//*!
|
|
388
|
-
* Wait for document loaded before starting the execution
|
|
389
|
-
*/let oO=0;const lO=({code:e,isDark:t=!1})=>{const r=L.useRef(null),n=L.useRef(null),s=L.useRef(null),[i,a]=L.useState(null),[o]=L.useState(()=>`mermaid-diagram-${++oO}`),[l,c]=L.useState(!1),[u,h]=L.useState(!1),[f,g]=L.useState(!1),[p,m]=L.useState(0),y=async()=>{try{await navigator.clipboard.writeText(e),h(!0),setTimeout(()=>h(!1),2e3)}catch(w){console.error("复制失败:",w)}},x=async(w,S,F=!1,A=!1)=>{try{_p.initialize({startOnLoad:!1,theme:t?"dark":"default",securityLevel:"strict",fontFamily:"ui-sans-serif, system-ui, sans-serif",suppressErrorRendering:!0,themeVariables:{darkMode:t}}),w.innerHTML="";const{svg:T}=await _p.render(S,e),j=document.createElement("div");j.className="flex justify-center items-start w-full h-full",j.innerHTML=T,w.innerHTML="",w.appendChild(j);const M=j.querySelector("svg");if(M){const P=M.getAttribute("viewBox"),$=M.getAttribute("width"),R=M.getAttribute("height");!P&&$&&R&&M.setAttribute("viewBox",`0 0 ${$} ${R}`);let I=0,O=0;const W=P||($&&R?`0 0 ${$} ${R}`:null);if(W){const Z=W.split(/\s+/);Z.length===4&&(I=parseFloat(Z[2]),O=parseFloat(Z[3]))}M.removeAttribute("width"),M.removeAttribute("height"),A?(F?(M.style.maxWidth="100%",M.style.maxHeight="100%",M.style.width="auto",M.style.height="auto"):(M.style.maxWidth="100%",M.style.maxHeight="560px",M.style.width="auto",M.style.height="auto"),F&&I&&O&&console.log("适应模式:以当前显示为 100% 基准")):(M.style.maxWidth="none",M.style.maxHeight="none",M.style.width="auto",M.style.height="auto")}a(null)}catch(T){console.error("Mermaid 渲染错误:",T),a(T instanceof Error?T.message:"渲染图表时发生错误"),setTimeout(()=>{document.querySelectorAll('[id^="dmermaid"], .error-icon, .error-text').forEach(M=>M.remove())},100)}};L.useEffect(()=>{r.current&&x(r.current,o,!1,!0)},[e,t,o]),L.useEffect(()=>{if(f&&n.current){const w=s.current,S=w?{x:w.scrollLeft,y:w.scrollTop}:null,F=p===0;x(n.current,`${o}-fullscreen`,!0,F),S&&w&&p!==0&&setTimeout(()=>{w.scrollLeft=S.x,w.scrollTop=S.y},50)}},[f,e,t,o,p]);const k=w=>{m(w)},v=()=>p===0?100:p,_=()=>{const w=v(),S=Math.min(200,w+10);console.log("放大:",{baseZoom:w,newZoom:S,zoomLevel:p}),k(S)},C=()=>{const w=v(),S=Math.max(50,w-10);console.log("缩小:",{baseZoom:w,newZoom:S,zoomLevel:p}),k(S)};return i?d.jsx("div",{className:"my-2 border border-red-300 dark:border-red-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors list-none",children:[d.jsx("svg",{className:"w-4 h-4 text-red-500 dark:text-red-400 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor",children:d.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),d.jsx("span",{className:"text-sm font-medium text-red-800 dark:text-red-200 flex-1",children:"Mermaid 图表语法错误"}),d.jsx("svg",{className:"w-4 h-4 text-red-600 dark:text-red-400 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d.jsx("div",{className:"border-t border-red-200 dark:border-red-800",children:d.jsxs("div",{className:"p-3 bg-red-50 dark:bg-red-900/10",children:[d.jsxs("div",{className:"mb-3",children:[d.jsx("div",{className:"text-xs font-medium text-red-700 dark:text-red-300 mb-1",children:"错误信息:"}),d.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-white dark:bg-gray-900 p-2 rounded border border-red-200 dark:border-red-800 font-mono",children:i})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-medium text-red-700 dark:text-red-300 mb-1",children:"原始代码:"}),d.jsx("pre",{className:"text-xs bg-white dark:bg-gray-900 p-2 rounded border border-red-200 dark:border-red-800 overflow-x-auto max-h-40 overflow-y-auto",children:d.jsx("code",{className:"text-red-800 dark:text-red-200 font-mono",children:e})})]})]})})]})}):d.jsxs("div",{className:"my-4 border border-gray-200 dark:border-gray-700 rounded-lg bg-white dark:bg-gray-800",children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:[d.jsx("div",{className:"flex items-center space-x-2",children:d.jsxs("div",{className:"flex items-center text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("svg",{className:"w-4 h-4 mr-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),d.jsx("span",{className:"font-medium",children:"Mermaid 图表"})]})}),d.jsxs("div",{className:"flex items-center space-x-1",children:[d.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"全屏查看",children:d.jsx(uv,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>c(!l),className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:l?"隐藏源码":"查看源码",children:d.jsx(hv,{className:"w-4 h-4"})}),d.jsx("button",{onClick:y,className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"复制源码",children:u?d.jsx(Kp,{className:"w-4 h-4 text-green-600 dark:text-green-400"}):d.jsx(Xc,{className:"w-4 h-4"})})]})]}),d.jsx("div",{ref:r,className:"flex items-center justify-center py-3 px-4",style:{maxHeight:"600px",minHeight:"200px"}}),l&&d.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 p-4 rounded-b-lg overflow-x-auto",children:d.jsx("pre",{className:"text-sm text-gray-100 font-mono",children:d.jsx("code",{children:e})})})}),f&&d.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4",children:d.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-2xl w-full h-full max-w-7xl max-h-[90vh] flex flex-col",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[d.jsx("div",{className:"flex items-center space-x-2",children:d.jsxs("div",{className:"flex items-center text-sm text-gray-500 dark:text-gray-400",children:[d.jsx("svg",{className:"w-5 h-5 mr-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),d.jsx("span",{className:"font-medium",children:"Mermaid 图表"})]})}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs("div",{className:"flex items-center space-x-1 border-r border-gray-300 dark:border-gray-600 pr-2 mr-2",children:[d.jsx("button",{onClick:C,className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:`缩小 (当前${v()}%)`,disabled:v()<=50,children:d.jsx(Qp,{className:"w-4 h-4"})}),d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 min-w-[4rem] text-center",children:p===0?"适应":`${p}%`}),d.jsx("button",{onClick:_,className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:`放大 (当前${v()}%)`,disabled:v()>=200,children:d.jsx(Zp,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>k(100),className:"px-2 py-1 text-xs rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"100% 原始大小",children:"100%"}),d.jsx("button",{onClick:()=>k(0),className:`px-2 py-1 text-xs rounded transition-colors ${p===0?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400"}`,title:"适应窗口大小",children:"适应"})]}),d.jsx("button",{onClick:()=>{g(!1),m(0)},className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"关闭",children:d.jsx(es,{className:"w-5 h-5"})})]})]}),d.jsx("div",{ref:s,className:"flex-1 overflow-auto p-6 bg-gray-50 dark:bg-gray-900",children:d.jsx("div",{ref:n,className:p===0?"w-full h-full flex items-center justify-center":"flex items-center justify-center min-h-full",style:p===0?{}:(()=>{const w=p/100;return console.log("应用变换:",{zoomLevel:p,scale:w,message:"适应模式为100%基准,直接应用缩放"}),{transform:`scale(${w})`,transformOrigin:"center center",transition:"transform 0.2s ease-in-out"}})()})})]})})]})},Zi=({content:e,isUserMessage:t=!1})=>{const[r,n]=L.useState(!1),s=i=>t?"text-white":i;return L.useEffect(()=>{const i=()=>{n(document.documentElement.classList.contains("dark"))};i();const a=new MutationObserver(i);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),d.jsx("div",{className:"break-words overflow-wrap-anywhere word-break-break-all",children:d.jsx(eT,{remarkPlugins:[fE],components:{code({inline:i,className:a,children:o,...l}){const c=/language-(\w+)/.exec(a||""),u=c?c[1]:"";return!i&&u==="mermaid"?d.jsx(lO,{code:String(o).replace(/\n$/,""),isDark:r}):!i&&c?d.jsx(um,{style:T0,language:u,PreTag:"div",className:"rounded-md text-sm overflow-auto",wrapLines:!0,wrapLongLines:!0,...l,children:String(o).replace(/\n$/,"")}):d.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200 px-1 py-0.5 rounded text-sm font-mono",...l,children:o})},h1:({children:i})=>d.jsx("h1",{className:`text-lg font-bold mt-4 mb-2 ${s("text-gray-900 dark:text-gray-100")}`,children:i}),h2:({children:i})=>d.jsx("h2",{className:`text-base font-bold mt-3 mb-2 ${s("text-gray-900 dark:text-gray-100")}`,children:i}),h3:({children:i})=>d.jsx("h3",{className:`text-sm font-bold mt-2 mb-1 ${s("text-gray-900 dark:text-gray-100")}`,children:i}),p:({children:i})=>d.jsx("p",{className:`mb-2 leading-relaxed break-words overflow-wrap-anywhere ${s("text-gray-800 dark:text-gray-200")}`,children:i}),ul:({children:i})=>d.jsx("ul",{className:"list-disc list-inside mb-2 space-y-1",children:i}),ol:({children:i})=>d.jsx("ol",{className:"list-decimal list-inside mb-2 space-y-1",children:i}),li:({children:i})=>d.jsx("li",{className:`leading-relaxed break-words overflow-wrap-anywhere ${s("text-gray-800 dark:text-gray-200")}`,children:i}),blockquote:({children:i})=>d.jsx("blockquote",{className:`border-l-4 border-gray-300 dark:border-gray-600 pl-3 italic mb-2 ${s("text-gray-600 dark:text-gray-400")}`,children:i}),strong:({children:i})=>d.jsx("strong",{className:`font-semibold ${s("text-gray-900 dark:text-gray-100")}`,children:i}),em:({children:i})=>d.jsx("em",{className:"italic",children:i}),a:({children:i,href:a})=>d.jsx("a",{href:a,className:"text-blue-600 hover:text-blue-800 underline",target:"_blank",rel:"noopener noreferrer",children:i}),table:({children:i})=>d.jsx("table",{className:"border-collapse border border-gray-300 dark:border-gray-600 mb-2 text-sm",children:i}),th:({children:i})=>d.jsx("th",{className:`border border-gray-300 dark:border-gray-600 px-2 py-1 bg-gray-100 dark:bg-gray-800 font-semibold text-left ${s("text-gray-900 dark:text-gray-100")}`,children:i}),td:({children:i})=>d.jsx("td",{className:`border border-gray-300 dark:border-gray-600 px-2 py-1 ${s("text-gray-800 dark:text-gray-200")}`,children:i})},children:e})})},cO=({text:e,maxLength:t=300})=>{const{t:r}=fe("components"),[n,s]=L.useState(!1),i=e.length>t,a=n||!i?e:e.substring(0,t)+"...";return d.jsxs("div",{children:[d.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap",children:a}),i&&d.jsx("button",{onClick:()=>s(!n),className:"mt-2 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 transition-colors",children:r(n?"subAgentMessageFlow.collapse":"subAgentMessageFlow.expand")})]})},uO=e=>({id:e.toolData?.id||e.id,toolName:e.toolData?.toolName||"Unknown",toolInput:e.toolData?.toolInput||{},toolResult:e.toolData?.toolResult,isExecuting:!1,isError:e.toolData?.isError,timestamp:new Date}),hO=({content:e})=>{const{t}=fe("components"),[r,n]=L.useState(!1);return d.jsxs("details",{className:"my-2",open:r,onToggle:s=>n(s.target.open),children:[d.jsxs("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 text-sm hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none",children:["💭 ",t("subAgentMessageFlow.thinking")]}),d.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"text-gray-600 dark:text-gray-300 text-sm whitespace-pre-wrap break-words leading-relaxed italic",children:e})})]})},dO=e=>e.flatMap(t=>t.messageParts).sort((t,r)=>t.order-r.order),U1=({taskPrompt:e,messageFlow:t,defaultExpanded:r=!1})=>{const{t:n}=fe("components"),[s,i]=L.useState(r),a=t.reduce((l,c)=>l+c.messageParts.filter(u=>u.type==="tool").length,0),o=dO(t);return d.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[d.jsxs("button",{onClick:()=>i(!s),className:"flex items-center space-x-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors w-full",children:[s?d.jsx(Tt,{className:"w-4 h-4 flex-shrink-0"}):d.jsx(Ht,{className:"w-4 h-4 flex-shrink-0"}),d.jsx("span",{className:"font-medium",children:n("subAgentMessageFlow.title")}),d.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",n("subAgentMessageFlow.messageCount",{count:t.length}),", ",n("subAgentMessageFlow.toolCount",{count:a}),")"]})]}),s&&d.jsxs("div",{className:"mt-3 pl-3 border-l-2 border-purple-200 dark:border-purple-800 space-y-3",children:[d.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/30 rounded-lg p-3 border border-blue-200 dark:border-blue-800",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx(to,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"}),d.jsx("span",{className:"text-xs font-medium text-blue-700 dark:text-blue-400",children:n("subAgentMessageFlow.taskInput")})]}),d.jsx(cO,{text:e,maxLength:300})]}),o.map(l=>l.type==="text"&&l.content?d.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:d.jsx(Zi,{content:l.content,isUserMessage:!1})},l.id):l.type==="thinking"&&l.content?d.jsx(hO,{content:l.content},l.id):l.type==="tool"&&l.toolData?d.jsx("div",{children:d.jsx(K1,{execution:uO(l)})},l.id):null)]})]})},fO=e=>{if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.floor(e%6e4/1e3);return`${t}m ${r}s`},gO=({result:e})=>{const{t}=fe("components");return d.jsxs("div",{className:"flex flex-wrap gap-3 mt-3 text-xs",children:[e.status&&d.jsxs("div",{className:`flex items-center space-x-1 px-2 py-1 rounded ${e.status==="completed"?"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400":e.status==="failed"?"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400":"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"}`,children:[e.status==="completed"?d.jsx(_n,{className:"w-3 h-3"}):e.status==="failed"?d.jsx(ro,{className:"w-3 h-3"}):d.jsx(ts,{className:"w-3 h-3"}),d.jsx("span",{children:t(`taskTool.status.${e.status}`)})]}),e.totalDurationMs!==void 0&&d.jsxs("div",{className:"flex items-center space-x-1 px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded text-gray-600 dark:text-gray-400",children:[d.jsx(tn,{className:"w-3 h-3"}),d.jsx("span",{children:fO(e.totalDurationMs)})]}),e.totalToolUseCount!==void 0&&e.totalToolUseCount>0&&d.jsxs("div",{className:"flex items-center space-x-1 px-2 py-1 bg-blue-100 dark:bg-blue-900/30 rounded text-blue-600 dark:text-blue-400",children:[d.jsx(no,{className:"w-3 h-3"}),d.jsx("span",{children:t("taskTool.toolCallCount",{count:e.totalToolUseCount})})]}),e.totalTokens!==void 0&&d.jsxs("div",{className:"flex items-center space-x-1 px-2 py-1 bg-purple-100 dark:bg-purple-900/30 rounded text-purple-600 dark:text-purple-400",children:[d.jsx(dv,{className:"w-3 h-3"}),d.jsxs("span",{children:[e.totalTokens.toLocaleString()," tokens"]})]})]})},pO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=e.toolUseResult,s=e.claudeId||e.toolData?.claudeId;console.log("🎯 [TaskTool] claudeId:",s,"isExecuting:",e.isExecuting);const i=tu(u=>u.activeTasks),a=s?i.get(s):void 0;s&&console.log("🎯 [TaskTool] activeTask:",a?`found with ${a.messageFlow.length} messages`:"not found");const o=L.useMemo(()=>!e.isExecuting&&n?.subAgentMessageFlow?n.subAgentMessageFlow:a?.messageFlow&&a.messageFlow.length>0?a.messageFlow:n?.subAgentMessageFlow||[],[e.isExecuting,n?.subAgentMessageFlow,a?.messageFlow]),l=()=>{if(r.description)return r.description.trim()},c=r.prompt||n?.prompt||"";return d.jsx(De,{execution:e,subtitle:l(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("taskTool.taskDescriptionLabel"),value:r.description}),d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("taskTool.agentType")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 rounded",children:r.subagent_type})]}),r.model&&d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("taskTool.model")}),d.jsx("span",{className:`text-sm px-2 py-1 rounded ${r.model==="sonnet"?"bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300":r.model==="opus"?"bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300":"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300"}`,children:r.model.charAt(0).toUpperCase()+r.model.slice(1)})]}),r.resume&&d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("taskTool.resumeTask")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-300 rounded",children:t("taskTool.fromPreviousExecution")}),d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 font-mono",children:r.resume})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-blue-600 dark:text-blue-400",children:[d.jsx(Qn,{className:"w-4 h-4 animate-spin"}),d.jsx("span",{className:"text-sm",children:r.model?t("taskTool.executingWithModel",{model:r.model}):t("taskTool.executing")}),a&&d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",a.messageFlow.reduce((u,h)=>u+h.messageParts.length,0)," ",t("taskTool.partsReceived"),")"]})]}),!e.isExecuting&&n&&d.jsx(gO,{result:n}),o.length>0&&c&&d.jsx(U1,{taskPrompt:c,messageFlow:o,defaultExpanded:e.isExecuting})]})})},mO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>{if(r.command)return r.command.trim()},s=()=>e.isExecuting?t("bashTool.executing"):e.isError?e.toolResult||t("bashTool.executionError"):e.toolResult||"";return d.jsx(De,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[r.description&&d.jsx("div",{className:"text-sm text-gray-600 mb-2",children:r.description}),d.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 font-mono text-sm",children:[d.jsxs("div",{className:"flex items-start",children:[d.jsx("span",{className:"text-green-400 mr-2 select-none",children:"$"}),d.jsx("span",{className:"text-white break-all flex-1",children:r.command})]}),!e.isExecuting&&e.toolResult&&d.jsx("div",{className:"mt-2",children:d.jsx("pre",{className:`whitespace-pre-wrap break-words ${e.isError?"text-red-400":"text-gray-300"}`,children:s()})}),e.isExecuting&&d.jsx("div",{className:"mt-2",children:d.jsx("span",{className:"text-yellow-400 animate-pulse",children:t("bashTool.executing")})})]}),r.timeout&&d.jsx("div",{className:"text-xs text-gray-500",children:t("bashTool.timeout",{timeout:r.timeout})})]})})},xO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>{if(r.pattern)return r.pattern},s=i=>!i||!i.trim()?t("globTool.noFilesFound"):(i.trim().split(`
|
|
390
|
-
`).filter(o=>o.trim()).length===0,i);return d.jsxs(De,{execution:e,subtitle:n(),hideToolName:!1,showResult:!1,children:[d.jsxs("div",{children:[d.jsx(Me,{label:t("globTool.patternLabel"),value:r.pattern,isCode:!0}),r.path&&d.jsx(Me,{label:t("globTool.pathLabel"),value:r.path})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:t("globTool.matchingResults")}),d.jsx("div",{className:"p-3 rounded-md border bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-700 text-sm font-mono whitespace-pre-wrap break-words text-blue-700 dark:text-blue-300",children:s(e.toolResult)})]})]})},yO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>{if(r.pattern)return`"${r.pattern}"`},s=i=>{if(!i.trim())return t("grepTool.noMatchesFound");const a=r.output_mode||"files_with_matches";return a==="files_with_matches"?i:a==="count"?`${t("grepTool.matchStatistics")}:
|
|
391
|
-
|
|
392
|
-
${i}`:i};return d.jsxs(De,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:[d.jsxs("div",{children:[d.jsx(Me,{label:t("grepTool.patternLabel"),value:r.pattern,isCode:!0}),r.path&&d.jsx(Me,{label:t("grepTool.pathLabel"),value:r.path}),r.glob&&d.jsx(Me,{label:t("grepTool.globLabel"),value:r.glob}),r.type&&d.jsx(Me,{label:t("grepTool.typeLabel"),value:r.type}),r.output_mode&&d.jsx(Me,{label:t("grepTool.outputModeLabel"),value:r.output_mode}),d.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[r["-i"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.ignoreCase")}),r["-n"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.showLineNumbers")}),r["-A"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.afterLines",{count:r["-A"]})}),r["-B"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.beforeLines",{count:r["-B"]})}),r["-C"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.contextLines",{count:r["-C"]})}),r.multiline&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.multilineMode")})]})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:t("grepTool.searchResults")}),d.jsx("div",{className:"p-3 rounded-md border bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-700 text-sm font-mono whitespace-pre-wrap break-words text-green-700 dark:text-green-300",children:s(e.toolResult)})]})]})},bO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>{if(!r.path)return;const s=r.path;return s.split("/").slice(-2).join("/")||s};return d.jsxs(De,{execution:e,subtitle:n(),hideToolName:!1,children:[d.jsxs("div",{children:[d.jsx(Me,{label:t("lsTool.directoryPath"),value:r.path}),r.ignore&&r.ignore.length>0&&d.jsx(Me,{label:t("lsTool.ignorePatterns"),value:r.ignore.join(", ")})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("lsTool.directoryStructure")}),d.jsx("div",{className:"p-3 rounded-md border bg-yellow-50 border-yellow-200 text-sm font-mono whitespace-pre-wrap break-words text-yellow-800",children:e.toolResult})]})]})},kO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput;return d.jsx(De,{execution:e,hideToolName:!1,children:d.jsxs("div",{children:[d.jsxs("div",{className:"mb-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("exitPlanModeTool.implementationPlan")}),d.jsx("div",{className:"p-3 rounded-md border bg-emerald-50 border-emerald-200",children:d.jsx("div",{className:"text-sm text-emerald-800 whitespace-pre-wrap break-words",children:r.plan})})]}),d.jsxs("div",{className:"text-xs text-emerald-600 bg-emerald-100 p-2 rounded",children:["📋 ",t("exitPlanModeTool.planModeExited")]})]})})},wO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>r.file_path?r.file_path.split("/").pop()||r.file_path:void 0;return d.jsx(De,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(Me,{label:t("readTool.readFile"),value:r.file_path}),r.offset&&d.jsx(Me,{label:t("readTool.startLine"),value:r.offset}),r.limit&&d.jsx(Me,{label:t("readTool.readLines"),value:r.limit})]})})};function Vr(){}Vr.prototype={diff:function(t,r){var n,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=s.callback;typeof s=="function"&&(i=s,s={});var a=this;function o(_){return _=a.postProcess(_,s),i?(setTimeout(function(){i(_)},0),!0):_}t=this.castInput(t,s),r=this.castInput(r,s),t=this.removeEmpty(this.tokenize(t,s)),r=this.removeEmpty(this.tokenize(r,s));var l=r.length,c=t.length,u=1,h=l+c;s.maxEditLength!=null&&(h=Math.min(h,s.maxEditLength));var f=(n=s.timeout)!==null&&n!==void 0?n:1/0,g=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(p[0],r,t,0,s);if(p[0].oldPos+1>=c&&m+1>=l)return o(Tp(a,p[0].lastComponent,r,t,a.useLongestToken));var y=-1/0,x=1/0;function k(){for(var _=Math.max(y,-u);_<=Math.min(x,u);_+=2){var C=void 0,w=p[_-1],S=p[_+1];w&&(p[_-1]=void 0);var F=!1;if(S){var A=S.oldPos-_;F=S&&0<=A&&A<l}var T=w&&w.oldPos+1<c;if(!F&&!T){p[_]=void 0;continue}if(!T||F&&w.oldPos<S.oldPos?C=a.addToPath(S,!0,!1,0,s):C=a.addToPath(w,!1,!0,1,s),m=a.extractCommon(C,r,t,_,s),C.oldPos+1>=c&&m+1>=l)return o(Tp(a,C.lastComponent,r,t,a.useLongestToken));p[_]=C,C.oldPos+1>=c&&(x=Math.min(x,_-1)),m+1>=l&&(y=Math.max(y,_+1))}u++}if(i)(function _(){setTimeout(function(){if(u>h||Date.now()>g)return i();k()||_()},0)})();else for(;u<=h&&Date.now()<=g;){var v=k();if(v)return v}},addToPath:function(t,r,n,s,i){var a=t.lastComponent;return a&&!i.oneChangePerToken&&a.added===r&&a.removed===n?{oldPos:t.oldPos+s,lastComponent:{count:a.count+1,added:r,removed:n,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:r,removed:n,previousComponent:a}}},extractCommon:function(t,r,n,s,i){for(var a=r.length,o=n.length,l=t.oldPos,c=l-s,u=0;c+1<a&&l+1<o&&this.equals(n[l+1],r[c+1],i);)c++,l++,u++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return u&&!i.oneChangePerToken&&(t.lastComponent={count:u,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=l,c},equals:function(t,r,n){return n.comparator?n.comparator(t,r):t===r||n.ignoreCase&&t.toLowerCase()===r.toLowerCase()},removeEmpty:function(t){for(var r=[],n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r},castInput:function(t){return t},tokenize:function(t){return Array.from(t)},join:function(t){return t.join("")},postProcess:function(t){return t}};function Tp(e,t,r,n,s){for(var i=[],a;t;)i.push(t),a=t.previousComponent,delete t.previousComponent,t=a;i.reverse();for(var o=0,l=i.length,c=0,u=0;o<l;o++){var h=i[o];if(h.removed)h.value=e.join(n.slice(u,u+h.count)),u+=h.count;else{if(!h.added&&s){var f=r.slice(c,c+h.count);f=f.map(function(g,p){var m=n[u+p];return m.length>g.length?m:g}),h.value=e.join(f)}else h.value=e.join(r.slice(c,c+h.count));c+=h.count,h.added||(u+=h.count)}}return i}function Np(e,t){var r;for(r=0;r<e.length&&r<t.length;r++)if(e[r]!=t[r])return e.slice(0,r);return e.slice(0,r)}function Ep(e,t){var r;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(r=0;r<e.length&&r<t.length;r++)if(e[e.length-(r+1)]!=t[t.length-(r+1)])return e.slice(-r);return e.slice(-r)}function dh(e,t,r){if(e.slice(0,t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't start with prefix ").concat(JSON.stringify(t),"; this is a bug"));return r+e.slice(t.length)}function fh(e,t,r){if(!t)return e+r;if(e.slice(-t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't end with suffix ").concat(JSON.stringify(t),"; this is a bug"));return e.slice(0,-t.length)+r}function ji(e,t){return dh(e,t,"")}function eo(e,t){return fh(e,t,"")}function Ap(e,t){return t.slice(0,vO(e,t))}function vO(e,t){var r=0;e.length>t.length&&(r=e.length-t.length);var n=t.length;e.length<t.length&&(n=e.length);var s=Array(n),i=0;s[0]=0;for(var a=1;a<n;a++){for(t[a]==t[i]?s[a]=s[i]:s[a]=i;i>0&&t[a]!=t[i];)i=s[i];t[a]==t[i]&&i++}i=0;for(var o=r;o<e.length;o++){for(;i>0&&e[o]!=t[i];)i=s[i];e[o]==t[i]&&i++}return i}var ol="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",CO=new RegExp("[".concat(ol,"]+|\\s+|[^").concat(ol,"]"),"ug"),Hl=new Vr;Hl.equals=function(e,t,r){return r.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()};Hl.tokenize=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(t.intlSegmenter){if(t.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(t.intlSegmenter.segment(e),function(i){return i.segment})}else r=e.match(CO)||[];var n=[],s=null;return r.forEach(function(i){/\s/.test(i)?s==null?n.push(i):n.push(n.pop()+i):/\s/.test(s)?n[n.length-1]==s?n.push(n.pop()+i):n.push(s+i):n.push(i),s=i}),n};Hl.join=function(e){return e.map(function(t,r){return r==0?t:t.replace(/^\s+/,"")}).join("")};Hl.postProcess=function(e,t){if(!e||t.oneChangePerToken)return e;var r=null,n=null,s=null;return e.forEach(function(i){i.added?n=i:i.removed?s=i:((n||s)&&Mp(r,s,n,i),r=i,n=null,s=null)}),(n||s)&&Mp(r,s,n,null),e};function Mp(e,t,r,n){if(t&&r){var s=t.value.match(/^\s*/)[0],i=t.value.match(/\s*$/)[0],a=r.value.match(/^\s*/)[0],o=r.value.match(/\s*$/)[0];if(e){var l=Np(s,a);e.value=fh(e.value,a,l),t.value=ji(t.value,l),r.value=ji(r.value,l)}if(n){var c=Ep(i,o);n.value=dh(n.value,o,c),t.value=eo(t.value,c),r.value=eo(r.value,c)}}else if(r)e&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(e&&n){var u=n.value.match(/^\s*/)[0],h=t.value.match(/^\s*/)[0],f=t.value.match(/\s*$/)[0],g=Np(u,h);t.value=ji(t.value,g);var p=Ep(ji(u,g),f);t.value=eo(t.value,p),n.value=dh(n.value,u,p),e.value=fh(e.value,u,u.slice(0,u.length-p.length))}else if(n){var m=n.value.match(/^\s*/)[0],y=t.value.match(/\s*$/)[0],x=Ap(y,m);t.value=eo(t.value,x)}else if(e){var k=e.value.match(/\s*$/)[0],v=t.value.match(/^\s*/)[0],_=Ap(k,v);t.value=ji(t.value,_)}}var SO=new Vr;SO.tokenize=function(e){var t=new RegExp("(\\r?\\n)|[".concat(ol,"]+|[^\\S\\n\\r]+|[^").concat(ol,"]"),"ug");return e.match(t)||[]};var ql=new Vr;ql.tokenize=function(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
393
|
-
`));var r=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var s=0;s<n.length;s++){var i=n[s];s%2&&!t.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r};ql.equals=function(e,t,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
|
|
394
|
-
`))&&(e=e.trim()),(!r.newlineIsToken||!t.includes(`
|
|
395
|
-
`))&&(t=t.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
|
|
396
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
397
|
-
`)&&(t=t.slice(0,-1))),Vr.prototype.equals.call(this,e,t,r)};function jp(e,t,r){return ql.diff(e,t,r)}var _O=new Vr;_O.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var TO=new Vr;TO.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Lp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ip(Object(r),!0).forEach(function(n){AO(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ip(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function NO(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function EO(e){var t=NO(e,"string");return typeof t=="symbol"?t:t+""}function gh(e){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gh(e)}function AO(e,t,r){return t=EO(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vc(e){return MO(e)||jO(e)||IO(e)||LO()}function MO(e){if(Array.isArray(e))return ph(e)}function jO(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function IO(e,t){if(e){if(typeof e=="string")return ph(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ph(e,t)}}function ph(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function LO(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
398
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ga=new Vr;ga.useLongestToken=!0;ga.tokenize=ql.tokenize;ga.castInput=function(e,t){var r=t.undefinedReplacement,n=t.stringifyReplacer,s=n===void 0?function(i,a){return typeof a>"u"?r:a}:n;return typeof e=="string"?e:JSON.stringify(mh(e,null,null,s),s," ")};ga.equals=function(e,t,r){return Vr.prototype.equals.call(ga,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),r)};function mh(e,t,r,n,s){t=t||[],r=r||[],n&&(e=n(s,e));var i;for(i=0;i<t.length;i+=1)if(t[i]===e)return r[i];var a;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),a=new Array(e.length),r.push(a),i=0;i<e.length;i+=1)a[i]=mh(e[i],t,r,n,s);return t.pop(),r.pop(),a}if(e&&e.toJSON&&(e=e.toJSON()),gh(e)==="object"&&e!==null){t.push(e),a={},r.push(a);var o=[],l;for(l in e)Object.prototype.hasOwnProperty.call(e,l)&&o.push(l);for(o.sort(),i=0;i<o.length;i+=1)l=o[i],a[l]=mh(e[l],t,r,n,l);t.pop(),r.pop()}else a=e;return a}var xh=new Vr;xh.tokenize=function(e){return e.slice()};xh.join=xh.removeEmpty=function(e){return e};function $O(e,t,r,n,s,i,a){if(a||(a={}),typeof a=="function"&&(a={callback:a}),typeof a.context>"u"&&(a.context=4),a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){var o=a,l=o.callback;jp(r,n,Lp(Lp({},a),{},{callback:function(h){var f=c(h);l(f)}}))}else return c(jp(r,n,a));function c(u){if(!u)return;u.push({value:"",lines:[]});function h(F){return F.map(function(A){return" "+A})}for(var f=[],g=0,p=0,m=[],y=1,x=1,k=function(){var A=u[v],T=A.lines||DO(A.value);if(A.lines=T,A.added||A.removed){var j;if(!g){var M=u[v-1];g=y,p=x,M&&(m=a.context>0?h(M.lines.slice(-a.context)):[],g-=m.length,p-=m.length)}(j=m).push.apply(j,Vc(T.map(function(O){return(A.added?"+":"-")+O}))),A.added?x+=T.length:y+=T.length}else{if(g)if(T.length<=a.context*2&&v<u.length-2){var P;(P=m).push.apply(P,Vc(h(T)))}else{var $,R=Math.min(T.length,a.context);($=m).push.apply($,Vc(h(T.slice(0,R))));var I={oldStart:g,oldLines:y-g+R,newStart:p,newLines:x-p+R,lines:m};f.push(I),g=0,p=0,m=[]}y+=T.length,x+=T.length}},v=0;v<u.length;v++)k();for(var _=0,C=f;_<C.length;_++)for(var w=C[_],S=0;S<w.lines.length;S++)w.lines[S].endsWith(`
|
|
399
|
-
`)?w.lines[S]=w.lines[S].slice(0,-1):(w.lines.splice(S+1,0,"\"),S++);return{oldFileName:e,newFileName:t,oldHeader:s,newHeader:i,hunks:f}}}function DO(e){var t=e.endsWith(`
|
|
400
|
-
`),r=e.split(`
|
|
401
|
-
`).map(function(n){return n+`
|
|
402
|
-
`});return t?r.pop():r.push(r.pop().slice(0,-1)),r}const V1=({oldText:e,newText:t,oldStartLine:r=1,newStartLine:n=1})=>{const s=$O("old","new",e,t,"","",{context:3});return!s.hunks||s.hunks.length===0?d.jsx("pre",{className:"diff-container",children:d.jsx("code",{children:"No changes detected."})}):d.jsx("pre",{className:"diff-container",children:d.jsx("code",{children:s.hunks.map((i,a)=>{let o=i.oldStart+(r-1),l=i.newStart+(n-1);const c=i.oldStart+(r-1),u=i.newStart+(n-1);return d.jsxs("div",{className:"diff-hunk",children:[d.jsxs("div",{className:"hunk-header",children:[d.jsx("span",{className:"line-gutter",children:"..."}),d.jsx("span",{className:"line-content",children:`@@ -${c},${i.oldLines} +${u},${i.newLines} @@`})]}),i.lines.filter(h=>h.substring(1).trim()!=="No newline at end of file").map((h,f)=>{const g=h.startsWith("+")?"add":h.startsWith("-")?"del":"context";let p="diff-line",m="",y="";switch(g){case"add":p+=" diff-added",y=(l++).toString();break;case"del":p+=" diff-removed",m=(o++).toString();break;case"context":m=(o++).toString(),y=(l++).toString();break}return d.jsxs("div",{className:p,children:[d.jsxs("span",{className:"line-gutter",children:[m.padStart(4)," ",y.padStart(4)]}),d.jsx("span",{className:"line-prefix",children:h.charAt(0)}),d.jsx("span",{className:"line-content",children:h.substring(1)})]},f)})]},a)})})})},BO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=e.toolUseResult,s=()=>r.file_path?r.file_path.split("/").pop()||r.file_path:void 0,i=()=>{if(n?.structuredPatch&&n.structuredPatch.length>0){const l=n.structuredPatch[0];return{oldStartLine:l.oldStart,newStartLine:l.newStart}}return{oldStartLine:1,newStartLine:1}},{oldStartLine:a,newStartLine:o}=i();return d.jsx(De,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(Me,{label:t("editTool.editFile"),value:r.file_path}),r.replace_all&&d.jsx(Me,{label:t("editTool.replaceAll"),value:t("editTool.yes")}),d.jsx("div",{className:"mt-3",children:d.jsx(V1,{oldText:r.old_string,newText:r.new_string,oldStartLine:a,newStartLine:o})})]})})},RO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=Array.isArray(r?.edits)?r.edits:[],s=`${r.file_path} - ${t("multiEditTool.batchEdit",{count:n.length})}`;return d.jsx(De,{execution:e,showResult:!1,subtitle:s,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(Me,{label:t("multiEditTool.filePath"),value:r.file_path}),d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("multiEditTool.batchEdit",{count:n.length})}),d.jsx("div",{className:"space-y-4 max-h-96 overflow-y-auto",children:n.map((i,a)=>d.jsxs("div",{className:"border border-gray-200 rounded-md bg-white",children:[d.jsx("div",{className:"px-3 py-2 bg-gray-50 border-b border-gray-200 rounded-t-md",children:d.jsxs("div",{className:"text-xs font-medium text-gray-600",children:[t("multiEditTool.operation",{number:a+1}),i.replace_all&&d.jsx("span",{className:"ml-2 px-2 py-1 bg-orange-200 text-orange-800 rounded text-xs",children:t("multiEditTool.replaceAll")})]})}),d.jsx("div",{className:"p-3",children:d.jsx(V1,{oldText:i.old_string,newText:i.new_string})})]},a))})]})]})})},$p={".js":"javascript",".jsx":"jsx",".ts":"typescript",".tsx":"tsx",".py":"python",".java":"java",".c":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".h":"c",".hpp":"cpp",".cs":"csharp",".php":"php",".rb":"ruby",".go":"go",".rs":"rust",".swift":"swift",".kt":"kotlin",".scala":"scala",".sh":"bash",".bash":"bash",".zsh":"bash",".fish":"bash",".ps1":"powershell",".sql":"sql",".html":"html",".htm":"html",".xml":"xml",".css":"css",".scss":"scss",".sass":"sass",".less":"less",".json":"json",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".dockerfile":"dockerfile",".docker":"dockerfile",".vim":"vim",".lua":"lua",".r":"r",".R":"r",".matlab":"matlab",".m":"matlab",".pl":"perl",".pm":"perl",".tex":"latex",".cls":"latex",".sty":"latex",".md":"markdown",".markdown":"markdown",".mdown":"markdown",".mkd":"markdown",".mdx":"markdown",".txt":"text",".log":"text",".gitignore":"text",".gitattributes":"text",".editorconfig":"text",".env":"bash",".env.example":"bash",".env.local":"bash",".env.production":"bash",".env.development":"bash",".csv":"csv"};function PO(e){if(!e)return"text";const t=e.toLowerCase().match(/\.[^.]*$/)?.[0];if(t&&$p[t])return $p[t];const r=e.toLowerCase().split("/").pop()||"";return r.startsWith(".env")?"bash":r==="dockerfile"||r==="dockerfile.dev"||r==="dockerfile.prod"?"dockerfile":r==="makefile"||r==="makefile.am"?"makefile":r==="package.json"||r==="tsconfig.json"||r==="tslint.json"?"json":"text"}const FO=({content:e,filePath:t="",className:r=""})=>{const n=PO(t),s=document.documentElement.classList.contains("dark");return d.jsxs("div",{className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md ${r}`,children:[d.jsx("div",{className:"px-4 py-2 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 rounded-t-md",children:d.jsxs("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:["文件内容 (",n,")"]})}),d.jsx("div",{className:"p-4",children:d.jsx(um,{language:n,style:s?gE:T0,customStyle:{margin:0,background:"transparent",fontSize:"14px"},wrapLines:!0,wrapLongLines:!0,showLineNumbers:!0,lineNumberStyle:{minWidth:"3em",paddingRight:"1em",color:s?"#9ca3af":"#666",borderRight:s?"1px solid #4b5563":"1px solid #ddd",marginRight:"1em"},children:e})})]})},OO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>r.file_path?r.file_path.split("/").pop()||r.file_path:void 0;return d.jsx(De,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(Me,{label:t("writeTool.filePath"),value:r.file_path}),d.jsxs("div",{className:"mt-3",children:[d.jsx(FO,{content:r.content,filePath:r.file_path}),d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:t("writeTool.fileSize",{size:r.content?.length||0})})]})]})})},zO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput;return d.jsx(De,{execution:e,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(Me,{label:t("notebookReadTool.notebookPath"),value:r.notebook_path}),r.cell_id&&d.jsx(Me,{label:t("notebookReadTool.cellId"),value:r.cell_id})]})})},WO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput;return d.jsx(De,{execution:e,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(Me,{label:t("notebookEditTool.notebookPath"),value:r.notebook_path}),d.jsxs("div",{className:"flex flex-wrap gap-2 mt-2 mb-3",children:[r.edit_mode&&d.jsx("span",{className:`px-2 py-1 text-xs rounded ${r.edit_mode==="insert"?"bg-green-200 text-green-800":r.edit_mode==="delete"?"bg-red-200 text-red-800":"bg-blue-200 text-blue-800"}`,children:r.edit_mode==="insert"?t("notebookEditTool.insert"):r.edit_mode==="delete"?t("notebookEditTool.delete"):t("notebookEditTool.replace")}),r.cell_type&&d.jsx("span",{className:"px-2 py-1 bg-purple-200 text-purple-800 text-xs rounded",children:r.cell_type==="code"?t("notebookEditTool.code"):t("notebookEditTool.markdown")})]}),r.cell_id&&d.jsx(Me,{label:t("notebookEditTool.cellId"),value:r.cell_id}),r.edit_mode!=="delete"&&d.jsx(Me,{label:t("notebookEditTool.newContent"),value:r.new_source&&r.new_source.length>300?r.new_source.substring(0,300)+`
|
|
403
|
-
`+t("notebookEditTool.truncated"):r.new_source||"",isCode:!0})]})})},HO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>r.server?`${t("listMcpResourcesTool.server")}: ${r.server}`:t("listMcpResourcesTool.allServers");return d.jsx(De,{execution:e,subtitle:n(),hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(oc,{className:"w-4 h-4 text-blue-500"}),d.jsx("h4",{className:"text-sm font-medium text-gray-700",children:t("listMcpResourcesTool.title")})]}),r.server&&d.jsx(Me,{label:t("listMcpResourcesTool.serverName"),value:r.server}),e.toolResult&&d.jsxs("div",{className:"mt-3",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx(fv,{className:"w-4 h-4 text-green-500"}),d.jsx("span",{className:"text-sm font-medium text-gray-700",children:t("listMcpResourcesTool.resources")})]}),d.jsx("div",{className:"bg-gray-50 p-3 rounded-md border border-gray-200",children:d.jsx("pre",{className:"text-sm text-gray-600 whitespace-pre-wrap font-mono",children:e.toolResult})})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-blue-600",children:[d.jsx(oc,{className:"w-4 h-4 animate-pulse"}),d.jsx("span",{className:"text-sm",children:t("listMcpResourcesTool.loading")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600",children:[d.jsx(oc,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("listMcpResourcesTool.error")})]}),d.jsx("div",{className:"text-xs text-gray-500 mt-2 p-2 bg-blue-50 rounded",children:t("listMcpResourcesTool.description")})]})})},qO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>`${r.server}: ${r.uri.split("/").pop()||r.uri}`;return d.jsx(De,{execution:e,subtitle:n(),hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(Ra,{className:"w-5 h-5 text-indigo-500"}),d.jsx("h4",{className:"text-sm font-medium text-gray-700",children:t("readMcpResourceTool.title")})]}),d.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-indigo-50 rounded border border-indigo-200",children:[d.jsx(Ra,{className:"w-4 h-4 text-indigo-600"}),d.jsx("span",{className:"text-sm font-medium text-indigo-800",children:r.server})]}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-1 mb-1",children:[d.jsx(Jp,{className:"w-3 h-3 text-gray-500"}),d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("readMcpResourceTool.resourceUri")})]}),d.jsx("div",{className:"bg-gray-50 p-2 rounded border border-gray-200",children:d.jsx("code",{className:"text-xs text-gray-700 font-mono break-all",children:r.uri})})]}),e.toolResult&&d.jsxs("div",{className:"mt-4",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx(gv,{className:"w-4 h-4 text-green-500"}),d.jsx("span",{className:"text-sm font-medium text-gray-700",children:t("readMcpResourceTool.content")})]}),d.jsx("div",{className:"bg-white p-3 rounded-md border border-gray-200 max-h-96 overflow-y-auto",children:(()=>{try{const s=JSON.parse(e.toolResult);return d.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap font-mono",children:JSON.stringify(s,null,2)})}catch{return d.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:e.toolResult})}})()})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-indigo-600",children:[d.jsx(em,{className:"w-4 h-4 animate-bounce"}),d.jsx("span",{className:"text-sm",children:t("readMcpResourceTool.loading")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600",children:[d.jsx(Ra,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("readMcpResourceTool.error")})]}),d.jsx("div",{className:"text-xs text-gray-500 p-2 bg-gray-50 rounded",children:d.jsxs("div",{className:"flex items-start space-x-1",children:[d.jsx(Ra,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),d.jsx("span",{children:t("readMcpResourceTool.description")})]})}),e.toolResult&&d.jsx("div",{className:"text-xs text-gray-400 text-right",children:t("readMcpResourceTool.contentSize",{size:new Blob([e.toolResult]).size})})]})})},UO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=()=>{const s=r.message_prefix;return s.length>30?`${s.substring(0,30)}...`:s};return d.jsx(De,{execution:e,subtitle:n(),hideToolName:!1,children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(tn,{className:"w-5 h-5 text-purple-500"}),d.jsx("h4",{className:"text-sm font-medium text-gray-700",children:t("timeMachineTool.title")})]}),d.jsx("div",{className:"text-xs text-purple-600 bg-purple-50 p-3 rounded-md border border-purple-200",children:d.jsxs("div",{className:"flex items-start space-x-1",children:[d.jsx(pv,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),d.jsx("span",{children:t("timeMachineTool.description")})]})}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-1 mb-1",children:[d.jsx(mv,{className:"w-3 h-3 text-gray-500"}),d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("timeMachineTool.targetMessage")})]}),d.jsx("div",{className:"bg-gray-50 p-2 rounded border border-gray-200",children:d.jsxs("p",{className:"text-sm text-gray-700 italic",children:['"',r.message_prefix,'"']})})]}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-1 mb-1",children:[d.jsx(wh,{className:"w-3 h-3 text-green-500"}),d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("timeMachineTool.correction")})]}),d.jsx("div",{className:"bg-green-50 p-2 rounded border border-green-200",children:d.jsxs("p",{className:"text-sm text-gray-700",children:['"',r.course_correction,'"']})})]}),r.restore_code!==void 0&&d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs("span",{className:"text-xs font-medium text-gray-600",children:[t("timeMachineTool.restoreCode"),":"]}),d.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${r.restore_code?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:r.restore_code?t("common.enabled"):t("common.disabled")})]}),e.toolResult&&d.jsxs("div",{className:"mt-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-600 mb-1",children:t("timeMachineTool.result")}),d.jsx("div",{className:"bg-purple-50 p-3 rounded-md border border-purple-200",children:d.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:e.toolResult})})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-purple-600",children:[d.jsx(tn,{className:"w-4 h-4 animate-spin"}),d.jsx("span",{className:"text-sm",children:t("timeMachineTool.rewinding")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600",children:[d.jsx(tn,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("timeMachineTool.error")})]})]})})},Qr="__TYPE_SOMETHING__",Dp=({execution:e,onSubmit:t})=>{const{t:r}=fe("components"),n=e.toolInput,s=ze(w=>w.pendingUserQuestion);if(!n||!n.questions||!Array.isArray(n.questions))return d.jsx(De,{execution:e,hideToolName:!1,overrideToolName:r("askUserQuestionTool.title"),children:d.jsx("div",{className:"text-red-600 text-sm",children:r("askUserQuestionTool.invalidInput","Invalid question input")})});const[i,a]=L.useState(new Map),[o,l]=L.useState(!1),[c,u]=L.useState(new Map),h=L.useRef(new Map),f=L.useMemo(()=>{if(!s||!e.toolInput)return!1;const w=e.toolInput.questions,S=s.questions;return!!(w&&S&&w.length===S.length&&w[0]?.question===S[0]?.question)},[s,e]),g=f&&!e.toolResult&&!o,p=L.useMemo(()=>{if(!e.toolResult)return null;const w=String(e.toolResult),S=w.match(/^User response:\s*(.+)$/s);return S?S[1].trim():w.trim()},[e.toolResult]),m=L.useCallback((w,S,F)=>{g&&(a(A=>{const T=new Map(A),j=T.get(w)||[];if(F)if(j.includes(S))T.set(w,j.filter(M=>M!==S));else{const M=j.filter(P=>P!==Qr);T.set(w,[...M,S])}else T.set(w,[S]);return T}),S!==Qr&&u(A=>{const T=new Map(A);return T.delete(w),T}))},[g]),y=L.useCallback((w,S)=>{g&&(a(F=>{const A=new Map(F),T=A.get(w)||[];return S?T.includes(Qr)?A.set(w,T.filter(j=>j!==Qr)):A.set(w,[...T,Qr]):A.set(w,[Qr]),A}),setTimeout(()=>{const F=h.current.get(w);F&&F.focus()},100))},[g]),x=L.useCallback((w,S)=>{u(F=>{const A=new Map(F);return A.set(w,S),A})},[]),k=L.useMemo(()=>{if(!g)return!1;for(let w=0;w<n.questions.length;w++){const S=i.get(w)||[];if(S.length===0)return!1;if(S.includes(Qr)){const F=c.get(w)||"";if(S.length===1&&!F.trim())return!1}}return!0},[g,n.questions.length,i,c]),v=L.useCallback(()=>{const w=[];return n.questions.forEach((S,F)=>{const A=i.get(F)||[];if(A.length>0){const T=[];A.forEach(j=>{if(j===Qr){const M=c.get(F)||"";M.trim()&&T.push(M.trim())}else T.push(j)}),T.length>0&&(n.questions.length===1?w.push(T.join(", ")):w.push(`Q${F+1}: ${T.join(", ")}`))}}),w.join(`
|
|
404
|
-
`)},[n.questions,i,c]),_=L.useCallback(async()=>{if(!(!k||!t||!s)){l(!0);try{const w=v();console.log("🎤 [AskUserQuestion] Submitting response:",w),await t(s.toolUseId,w)}catch(w){console.error("🎤 [AskUserQuestion] Failed to submit response:",w)}finally{l(!1)}}},[k,t,s,v]),C=()=>{const w=n.questions,S=w.length,F=w[0],A=F.header||(F.question.length>30?F.question.substring(0,30)+"...":F.question);return S===1?A:`${A} (+${S-1})`};return d.jsx(De,{execution:e,subtitle:C(),defaultExpanded:!0,showResult:!1,hideToolName:!1,overrideToolName:r("askUserQuestionTool.title"),customIcon:d.jsx(to,{className:"w-4 h-4 text-blue-500"}),children:d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"space-y-4",children:n.questions.map((w,S)=>{const F=i.get(S)||[];return d.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 bg-white",children:[d.jsx("div",{className:"flex items-center justify-between mb-2",children:d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Q",S+1]}),w.header&&d.jsx("span",{className:"text-xs px-2 py-1 bg-blue-100 text-blue-800 rounded-full",children:w.header}),w.multiSelect&&d.jsx("span",{className:"text-xs px-2 py-1 bg-purple-100 text-purple-800 rounded-full",children:r("askUserQuestionTool.multiSelect")})]})}),d.jsx("div",{className:"mb-3",children:d.jsx("p",{className:"text-sm text-gray-800 font-medium",children:w.question})}),d.jsxs("div",{className:"space-y-2",children:[w.options.map((A,T)=>{const j=F.includes(A.label),M=g;return d.jsxs("div",{onClick:()=>m(S,A.label,w.multiSelect||!1),className:`
|
|
405
|
-
flex items-start space-x-2 p-2 rounded border transition-all
|
|
406
|
-
${M?"cursor-pointer":"cursor-default"}
|
|
407
|
-
${j?"border-blue-500 bg-blue-50 ring-1 ring-blue-500":"border-gray-100 hover:bg-gray-50"}
|
|
408
|
-
${!M&&!j?"opacity-60":""}
|
|
409
|
-
`,children:[w.multiSelect?d.jsx(Bp,{className:`w-4 h-4 mt-0.5 ${j?"text-blue-500":"text-gray-400"}`,checked:j}):j?d.jsx(_n,{className:"w-4 h-4 mt-0.5 text-blue-500"}):d.jsx(Kc,{className:"w-4 h-4 mt-0.5 text-gray-400"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("div",{className:`text-sm font-medium ${j?"text-blue-700":"text-gray-700"}`,children:A.label}),A.description&&d.jsx("div",{className:"text-xs text-gray-500 mt-1",children:A.description})]})]},T)}),(()=>{const A=F.includes(Qr),T=g,j=c.get(S)||"",M=p&&!w.options.some(P=>P.label===p);return e.toolResult&&M?d.jsxs("div",{className:"flex items-start space-x-2 p-2 rounded border border-green-500 bg-green-50 ring-1 ring-green-500",children:[d.jsx(_n,{className:"w-4 h-4 mt-0.5 text-green-500"}),d.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[d.jsx(Gd,{className:"w-4 h-4 text-green-600"}),d.jsxs("span",{className:"text-sm font-medium text-green-700",children:[r("askUserQuestionTool.typeSomething")," ",p]})]})]}):d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{onClick:()=>y(S,w.multiSelect||!1),className:`
|
|
410
|
-
flex items-start space-x-2 p-2 rounded border transition-all
|
|
411
|
-
${T?"cursor-pointer":"cursor-default"}
|
|
412
|
-
${A?"border-blue-500 bg-blue-50 ring-1 ring-blue-500":"border-gray-100 border-dashed hover:bg-gray-50"}
|
|
413
|
-
${!T&&!A?"opacity-60":""}
|
|
414
|
-
`,children:[w.multiSelect?d.jsx(Bp,{className:`w-4 h-4 mt-0.5 ${A?"text-blue-500":"text-gray-400"}`,checked:A}):A?d.jsx(_n,{className:"w-4 h-4 mt-0.5 text-blue-500"}):d.jsx(Kc,{className:"w-4 h-4 mt-0.5 text-gray-400"}),d.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[d.jsx(Gd,{className:`w-4 h-4 ${A?"text-blue-500":"text-gray-400"}`}),d.jsx("div",{className:`text-sm font-medium ${A?"text-blue-700":"text-gray-500"}`,children:r("askUserQuestionTool.typeSomething")})]})]}),A&&g&&d.jsx("div",{className:"ml-6",children:d.jsx("input",{ref:P=>{h.current.set(S,P)},type:"text",value:j,onChange:P=>x(S,P.target.value),placeholder:r("askUserQuestionTool.typeSomethingPlaceholder"),className:"w-full px-3 py-2 text-sm border border-blue-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white",onKeyDown:P=>{P.key==="Enter"&&k&&(P.preventDefault(),_())}})})]})})()]})]},S)})}),g&&d.jsx("div",{className:"flex justify-end pt-2",children:d.jsx("button",{onClick:_,disabled:!k||o,className:`
|
|
415
|
-
flex items-center space-x-2 px-4 py-2 rounded-lg text-sm font-medium transition-all
|
|
416
|
-
${k&&!o?"bg-blue-500 text-white hover:bg-blue-600 shadow-sm":"bg-gray-200 text-gray-400 cursor-not-allowed"}
|
|
417
|
-
`,children:o?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),d.jsx("span",{children:r("askUserQuestionTool.submitting")})]}):d.jsxs(d.Fragment,{children:[d.jsx(vh,{className:"w-4 h-4"}),d.jsx("span",{children:r("askUserQuestionTool.submit")})]})})}),e.toolResult&&d.jsxs("div",{className:"flex items-center space-x-2 text-green-600 py-2",children:[d.jsx(Kp,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm font-medium",children:r("askUserQuestionTool.completed")})]}),e.isExecuting&&!f&&d.jsxs("div",{className:"flex items-center space-x-2 text-blue-600 py-2",children:[d.jsx(to,{className:"w-4 h-4 animate-pulse"}),d.jsx("span",{className:"text-sm",children:r("askUserQuestionTool.waitingForResponse")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600 py-2",children:[d.jsx(to,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:r("askUserQuestionTool.error")})]})]})})},Bp=({className:e,checked:t})=>d.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2",strokeWidth:"2"}),t&&d.jsx("path",{d:"M9 12l2 2 4-4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),VO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput;return d.jsxs(De,{execution:e,hideToolName:!1,subtitle:r.url,children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("webFetchTool.urlLabel")}),d.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 text-sm underline break-all",children:r.url})]}),d.jsx(Me,{label:t("webFetchTool.analysisPromptLabel"),value:r.prompt&&r.prompt.length>200?r.prompt.substring(0,200)+`
|
|
418
|
-
`+t("webFetchTool.truncated"):r.prompt||"",isCode:!0})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("webFetchTool.webAnalysisResult")}),d.jsx("div",{className:"p-3 rounded-md border bg-teal-50 border-teal-200 text-sm whitespace-pre-wrap break-words text-teal-800",children:e.toolResult})]})]})},GO=({execution:e})=>{const{t}=fe("components"),r=e.toolInput,n=Array.isArray(r?.allowed_domains)?r.allowed_domains:[],s=Array.isArray(r?.blocked_domains)?r.blocked_domains:[],i=()=>{if(r.query)return`${r.query}`};return d.jsxs(De,{execution:e,subtitle:i(),showResult:!1,hideToolName:!1,children:[d.jsxs("div",{children:[d.jsx(Me,{label:t("webSearchTool.searchQueryLabel"),value:r.query}),(n.length>0||s.length>0)&&d.jsxs("div",{className:"mt-2 space-y-1",children:[n.length>0&&d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs font-medium text-green-600",children:t("webSearchTool.allowedDomains")}),n.map((a,o)=>d.jsx("span",{className:"px-2 py-1 bg-green-100 text-green-700 text-xs rounded",children:a},o))]}),s.length>0&&d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs font-medium text-red-600",children:t("webSearchTool.blockedDomains")}),s.map((a,o)=>d.jsx("span",{className:"px-2 py-1 bg-red-100 text-red-700 text-xs rounded",children:a},o))]})]})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("webSearchTool.searchResults")}),d.jsx("div",{className:"p-3 rounded-md border bg-sky-50 border-sky-200 text-sm whitespace-pre-wrap break-words text-sky-800",children:e.toolResult})]})]})};function G1(e){const t=e.split("__");return t.length!==3||t[0]!=="mcp"?null:{toolId:e,prefix:t[0],serverName:t[1],toolName:t[2]}}function YO(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function XO(e){try{const t=JSON.parse(e);return Array.isArray(t)?{content:t}:t&&typeof t=="object"&&("content"in t||"isError"in t)?t:{content:{type:"text",text:e}}}catch{return{content:{type:"text",text:e}}}}const KO=({content:e})=>{switch(e.type){case"text":return d.jsx("div",{className:"p-3 rounded-md border bg-green-50 border-green-200",children:d.jsx("pre",{className:"text-sm font-mono text-green-700 whitespace-pre-wrap break-words",children:e.text})});case"image":{const{t:r}=fe("components"),n=e;return d.jsxs("div",{className:"p-3 rounded-md border bg-blue-50 border-blue-200",children:[d.jsx("div",{className:"text-xs font-medium text-blue-600 mb-2",children:r("mcpTool.image",{mimeType:n.mimeType})}),d.jsx("img",{src:`data:${n.mimeType};base64,${n.data}`,alt:"MCP Tool Result",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"400px"}})]})}case"resource":{const{t:r}=fe("components"),n=e;return d.jsxs("div",{className:"p-3 rounded-md border bg-purple-50 border-purple-200",children:[d.jsx("div",{className:"text-xs font-medium text-purple-600 mb-2",children:r("mcpTool.resource")}),d.jsxs("div",{className:"text-sm text-purple-700 space-y-1",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.uri"),":"]})," ",n.resource.uri]}),n.resource.name&&d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.name"),":"]})," ",n.resource.name]}),n.resource.description&&d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.description"),":"]})," ",n.resource.description]}),n.resource.mimeType&&d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.type"),":"]})," ",n.resource.mimeType]})]})]})}default:const{t}=fe("components");return d.jsxs("div",{className:"p-3 rounded-md border bg-gray-50 border-gray-200",children:[d.jsx("div",{className:"text-xs font-medium text-gray-600 mb-2",children:t("mcpTool.unknownType",{type:e.type})}),d.jsx("pre",{className:"text-sm font-mono text-gray-700 whitespace-pre-wrap break-words",children:JSON.stringify(e,null,2)})]})}},QO=({result:e,isError:t})=>{const{t:r}=fe("components");if(!e)return null;if(t)return d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:r("mcpTool.errorMessage")}),d.jsx("div",{className:"p-3 rounded-md border bg-red-50 border-red-200 text-red-700 text-sm font-mono whitespace-pre-wrap break-words",children:e})]});const n=XO(e);if(!n||!n.content)return d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:r("mcpTool.executionResult")}),d.jsx("div",{className:"p-3 rounded-md border bg-green-50 border-green-200 text-green-700 text-sm font-mono whitespace-pre-wrap break-words",children:e})]});const s=Array.isArray(n.content)?n.content:[n.content];return d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:r("mcpTool.executionResult")}),n._meta?.progress!==void 0&&n._meta?.progressTotal&&d.jsxs("div",{className:"mb-3 p-2 bg-blue-50 border border-blue-200 rounded text-sm",children:[d.jsx("div",{className:"text-blue-700 mb-1",children:r("mcpTool.progress",{current:n._meta.progress,total:n._meta.progressTotal})}),d.jsx("div",{className:"w-full bg-blue-200 rounded-full h-2",children:d.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${n._meta.progress/n._meta.progressTotal*100}%`}})})]}),d.jsx("div",{className:"space-y-3",children:s.map((i,a)=>d.jsx(KO,{content:i},a))})]})},ZO=({execution:e})=>{const{t}=fe("components"),r=G1(e.toolName);if(!r)return d.jsx(De,{execution:e});const{serverName:n,toolName:s}=r,i=YO(s),a={...e,toolName:i},o=t("mcpTool.subtitle",{toolName:s,serverName:n});return d.jsx(De,{execution:a,subtitle:o,showResult:!1,isMcpTool:!0,hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("mcpTool.parameters"),value:e.toolInput,isCode:!0}),e.toolResult&&d.jsx(QO,{result:e.toolResult,isError:e.isError})]})})},JO=e=>e.filter(t=>t.kind==="text"&&!!t.text).map(t=>t.text).join(""),Rp=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null)return e.response},e6=e=>{if(!e||typeof e!="string")return"Unknown Agent";try{const r=new URL(e).hostname;if(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(r))return r;const s=r.split(".");return s.length>=2?s[0]:r}catch{const t=e.match(/\/([^/]+)$/);return t?t[1]:e}},Y1=({execution:e})=>{const{t}=fe(),r=e.toolInput;let n;if(e.toolResult)if(e.isError===!0)n={success:!1,error:e.toolResult};else{const P=e.toolResult;let $;const R=P.match(/\[System\] Session ID: ([a-f0-9-]+)/);R&&($=R[1]);try{const I=JSON.parse(P);typeof I=="object"&&I!==null?n={success:I.success!==!1,data:I.data||I.response||P,sessionId:I.sessionId||$,contextId:I.contextId,taskId:I.taskId,error:I.error}:n={success:!0,data:P,sessionId:$}}catch{n={success:!0,data:P,sessionId:$}}}const s=r.agentName||e6(r.agentUrl),i=!n&&!e.toolResult,a=n?.status==="running"||n?.status==="pending",o=n?.success===!0||!!n?.data&&!n?.error,l=n?.success===!1||!!n?.error,c=(M,P)=>M?P==="working"?{icon:d.jsx(Qn,{className:"w-4 h-4 animate-spin"}),className:"bg-blue-100 text-blue-800 border-blue-200 dark:bg-blue-900/30 dark:text-blue-300 dark:border-blue-800",text:t("tools.a2a.working","Working")}:P==="input-required"?{icon:d.jsx(ts,{className:"w-4 h-4"}),className:"bg-yellow-100 text-yellow-800 border-yellow-200 dark:bg-yellow-900/30 dark:text-yellow-300 dark:border-yellow-800",text:t("tools.a2a.inputRequired","Input Required")}:{icon:d.jsx(Qn,{className:"w-4 h-4 animate-spin"}),className:"bg-purple-100 text-purple-800 border-purple-200 dark:bg-purple-900/30 dark:text-purple-300 dark:border-purple-800",text:t("tools.a2a.streaming","Streaming...")}:i||a?{icon:d.jsx(Qn,{className:"w-4 h-4 animate-spin"}),className:"bg-blue-100 text-blue-800 border-blue-200 dark:bg-blue-900/30 dark:text-blue-300 dark:border-blue-800",text:a?t("tools.a2a.running","Running"):t("tools.a2a.calling","Calling")}:P==="completed"||o&&!l?{icon:d.jsx(_n,{className:"w-4 h-4"}),className:"bg-green-100 text-green-800 border-green-200 dark:bg-green-900/30 dark:text-green-300 dark:border-green-800",text:t("tools.a2a.success","Success")}:P==="failed"||P==="rejected"||l&&!o?{icon:d.jsx(ro,{className:"w-4 h-4"}),className:"bg-red-100 text-red-800 border-red-200 dark:bg-red-900/30 dark:text-red-300 dark:border-red-800",text:t("tools.a2a.error","Failed")}:P==="canceled"?{icon:d.jsx(ro,{className:"w-4 h-4"}),className:"bg-gray-100 text-gray-800 border-gray-200 dark:bg-gray-800/30 dark:text-gray-300 dark:border-gray-700",text:t("tools.a2a.canceled","Canceled")}:n?{icon:d.jsx(_n,{className:"w-4 h-4"}),className:"bg-green-100 text-green-800 border-green-200 dark:bg-green-900/30 dark:text-green-300 dark:border-green-800",text:t("tools.a2a.success","Success")}:{icon:d.jsx(ro,{className:"w-4 h-4"}),className:"bg-red-100 text-red-800 border-red-200 dark:bg-red-900/30 dark:text-red-300 dark:border-red-800",text:t("tools.a2a.error","Failed")},u=(M,P)=>{let $=s;return r.useTask&&($+=` • ${t("tools.a2a.asyncTask","Async Task")}`),P?$+=` • ${P}`:M?$+=` • ${t("tools.a2a.streaming","Streaming...")}`:i?$+=` • ${t("tools.a2a.calling","Calling...")}`:a?$+=` • ${t("tools.a2a.running","Running...")}`:l&&!o?$+=` • ${t("tools.a2a.error","Failed")}`:(o||n)&&($+=` • ${t("tools.a2a.success","Success")}`),$},[h]=cm(),f=h.get("project"),[g,p]=$r.useState([]),[m]=$r.useState([]),[y,x]=$r.useState(!1),[k,v]=$r.useState(!1),[_]=$r.useState(),C=ze(M=>M.activeA2AStreams[r.agentUrl]),w=C?.sessionId||n?.sessionId||r.sessionId;$r.useEffect(()=>{C?.isStreaming===!0?(v(!0),x(!0)):C&&C.isStreaming===!1&&v(!1)},[C?.isStreaming]),$r.useEffect(()=>{(n?.error||e.isError)&&v(!1)},[n?.error,e.isError]),$r.useEffect(()=>{if(!C?.events||C.events.length===0)return;const M=[];let P=null;const $=new Map;for(const R of C.events)if(R.type==="system")P={id:`sys-${Date.now()}-${Math.random()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[{id:`sys-part-${Date.now()}`,type:"text",content:`[System] Session ID: ${R.sessionId||"N/A"}`,order:0}]},M.push(P);else if(R.type==="assistant"&&R.message?.content){P={id:`assistant-${Date.now()}-${Math.random()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[]},M.push(P);for(const I of R.message.content)if(I.type==="text")P.messageParts.push({id:`text-${Date.now()}-${Math.random()}`,type:"text",content:I.text||"",order:P.messageParts.length});else if(I.type==="tool_use"){const O=I.id||`tool-${Date.now()}`,W={id:O,type:"tool",toolData:{id:O,toolName:I.name||"unknown",toolInput:I.input||{},toolResult:void 0,isError:!1},order:P.messageParts.length};P.messageParts.push(W),I.id&&$.set(I.id,W)}}else if(R.type==="user"&&R.message?.content){for(const I of R.message.content)if(I.type==="tool_result"&&I.tool_use_id){const O=$.get(I.tool_use_id);O&&O.toolData&&(O.toolData.toolResult=typeof I.content=="string"?I.content:JSON.stringify(I.content),O.toolData.isError=I.is_error||!1)}}M.length>0&&p(M)},[C?.events]);const{currentService:S}=Tv(),{getToken:F}=rv(),A=S?F(S.id)?.token:null;$r.useEffect(()=>{if(!w||!f)return;(async()=>{try{const $=`/api/a2a/history/${encodeURIComponent(f)}/${w}`,R=await fetch($,{headers:A?{Authorization:`Bearer ${A}`}:{}});if(!R.ok){console.error("Failed to fetch A2A history:",R.status);return}const{history:I}=await R.json();x(!0),I&&Array.isArray(I)&&T(I),v(!1)}catch(P){console.error("Error fetching A2A history:",P),x(!1),v(!1)}})()},[w,f,A]);const T=M=>{const P=[];let $=null;const R=new Map;for(const I of M)if(I.type==="system")(!$||$.role!=="assistant")&&($={id:`sys-${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[]},P.push($)),$.messageParts.push({id:`sys-part-${Date.now()}`,type:"text",content:`[System] Session ID: ${I.sessionId||"N/A"}`,order:$.messageParts.length});else if(I.type==="assistant"&&I.message?.content){(!$||$.role!=="assistant")&&($={id:I.sessionId||`assistant-${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[]},P.push($));for(const O of I.message.content)if(O.type==="text")$.messageParts.push({id:`text-${Date.now()}-${Math.random()}`,type:"text",content:O.text,order:$.messageParts.length});else if(O.type==="tool_use"){const W={id:O.id||`tool-${Date.now()}`,type:"tool",toolData:{id:O.id,toolName:O.name,toolInput:O.input,toolResult:void 0,isError:!1},order:$.messageParts.length};$.messageParts.push(W),O.id&&R.set(O.id,W)}}else if(I.type==="user"&&I.message?.content){for(const O of I.message.content)if(O.type==="tool_result"&&O.tool_use_id){const W=R.get(O.tool_use_id);W&&W.toolData&&(W.toolData.toolResult=typeof O.content=="string"?O.content:JSON.stringify(O.content),W.toolData.isError=O.is_error||!1)}}p(P)},j=c(k,_);return d.jsx(De,{execution:e,subtitle:u(k,_),showResult:!1,isMcpTool:!0,hideToolName:!1,customIcon:d.jsx(Yd,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),overrideToolName:"call_external_agent",children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-lg p-4 space-y-3",children:[d.jsxs("div",{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full border text-sm font-medium ${j.className}`,children:[j.icon,j.text]}),d.jsxs("div",{className:"bg-white dark:bg-gray-900 border dark:border-gray-700 rounded px-3 py-2 text-sm font-mono text-gray-800 dark:text-gray-200",children:[d.jsx("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:"Agent:"}),d.jsx("span",{className:"break-all",children:r.agentUrl})]}),d.jsxs("div",{className:"bg-white dark:bg-gray-900 border dark:border-gray-700 rounded px-3 py-2 text-sm text-gray-800 dark:text-gray-200",children:[d.jsx("span",{className:"text-gray-500 dark:text-gray-400 mr-2 block mb-1",children:"Message:"}),d.jsx("div",{className:"whitespace-pre-wrap",children:r.message})]})]}),y&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-purple-600 dark:text-purple-400",children:[d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full animate-pulse"}),k&&d.jsx("div",{className:"absolute inset-0 w-2 h-2 bg-purple-500 rounded-full animate-ping"})]}),d.jsx("span",{children:k?_?`${t("tools.a2a.taskState","Task state")}: ${_}`:t("tools.a2a.liveStreaming","Live streaming from external agent..."):t("tools.a2a.connected","Connected to history stream")})]}),g.length>0&&d.jsx(U1,{taskPrompt:r.message,messageFlow:g,defaultExpanded:!0}),m.length>0&&d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:[d.jsx(xv,{className:"w-4 h-4"}),t("tools.a2a.artifacts","Artifacts")," (",m.length,")"]}),d.jsx("div",{className:"space-y-2",children:m.map(M=>d.jsxs("div",{className:"bg-white dark:bg-gray-900 border dark:border-gray-700 rounded-lg p-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-800 dark:text-gray-200 mb-2",children:[d.jsx(Ch,{className:"w-4 h-4 text-blue-500"}),M.name||M.artifactId]}),M.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:M.description}),d.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-gray-800 rounded p-2 overflow-x-auto",children:JO(M.parts)||JSON.stringify(M.parts,null,2)})]},M.artifactId))})]}),n&&!g.length&&d.jsxs(d.Fragment,{children:[Rp(n.data)&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d.jsx(Yd,{className:"w-4 h-4"}),t("tools.a2a.response","Response")]}),d.jsx("pre",{className:"bg-gray-900 text-green-400 rounded-lg px-3 py-2 text-sm font-mono overflow-x-auto whitespace-pre-wrap border dark:border-gray-700",children:Rp(n.data)})]}),n.error&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-red-700 dark:text-red-400 mb-2",children:[d.jsx(ts,{className:"w-4 h-4"}),t("tools.a2a.error","Error")]}),d.jsx("pre",{className:"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-300 border border-red-200 dark:border-red-800 rounded-lg px-3 py-2 text-sm font-mono overflow-x-auto whitespace-pre-wrap",children:n.error})]}),(n.taskId||n.contextId||typeof n.data=="object"&&n.data?.metadata)&&d.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 pt-2 border-t border-gray-200 dark:border-gray-700 space-y-1",children:[n.taskId&&d.jsxs("div",{children:["Task ID: ",n.taskId]}),n.contextId&&d.jsxs("div",{children:["Context ID: ",n.contextId]}),typeof n.data=="object"&&n.data?.metadata&&d.jsxs("div",{children:["Metadata: ",JSON.stringify(n.data.metadata)]})]})]})]})})},t6=({execution:e})=>{const{t}=fe("components"),n=e.toolInput?.skill||t("skillTool.unknownSkill"),s=e.toolUseResult,i=s?.commandName,a=()=>i&&i!==n?`${n} → ${i}`:n,o=d.jsx(Xd,{className:"w-4 h-4"});return d.jsx(De,{execution:e,subtitle:a(),customIcon:o,overrideToolName:t("skillTool.toolName"),hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("skillTool.skillName")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-gradient-to-r from-purple-100 to-pink-100 dark:from-purple-900/30 dark:to-pink-900/30 text-purple-800 dark:text-purple-300 rounded font-medium",children:n})]}),i&&i!==n&&d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("skillTool.commandName")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 rounded font-mono",children:i})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-purple-600 dark:text-purple-400",children:[d.jsx("div",{className:"w-4 h-4 border-2 border-purple-600 dark:border-purple-400 border-t-transparent rounded-full animate-spin"}),d.jsx("span",{className:"text-sm",children:t("skillTool.loading")})]}),!e.isExecuting&&s?.success&&d.jsxs("div",{className:"flex items-center space-x-2 text-green-600 dark:text-green-400",children:[d.jsx(Xd,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("skillTool.launched")})]})]})})},r6={"a2a-client__call_external_agent":Y1};function yr(e,t){return e.toolInput}function cr(e,t){return e.toolUseResult}function n6(e){return{lsToolCall:"LS",readToolCall:"Read",editToolCall:"Edit",writeToolCall:"Write",strReplaceToolCall:"StrReplace",deleteToolCall:"Delete",globToolCall:"Glob",grepToolCall:"Grep",shellToolCall:"Shell",updateTodosToolCall:"TodoWrite",listMcpResourcesToolCall:"ListMcpResources",webFetchToolCall:"WebFetch",semSearchToolCall:"SemanticSearch",mcpToolCall:"MCP"}[e]||e}function s6(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function i6(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${(e%6e4/1e3).toFixed(0)}s`}function Ul(e){return e.split("/").pop()||e}function yh(e){const t=e.split("/");return t[t.length-1]||t[t.length-2]||e}const X1=({node:e,depth:t,defaultExpanded:r=!1})=>{const[n,s]=L.useState(r||t===0),i=yh(e.absPath),a=e.childrenDirs.length>0||e.childrenFiles.length>0;return d.jsxs("div",{className:"select-none",children:[d.jsxs("div",{className:`flex items-center py-0.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded ${a?"cursor-pointer":""}`,style:{paddingLeft:`${t*16}px`},onClick:()=>a&&s(!n),children:[a?n?d.jsx(Tt,{className:"w-3 h-3 text-gray-400 mr-1 flex-shrink-0"}):d.jsx(Ht,{className:"w-3 h-3 text-gray-400 mr-1 flex-shrink-0"}):d.jsx("span",{className:"w-4 mr-1"}),d.jsx(tm,{className:"w-4 h-4 text-yellow-500 dark:text-yellow-400 mr-1.5 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:i}),d.jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["(",e.numFiles,")"]})]}),n&&d.jsxs("div",{children:[e.childrenDirs.map((o,l)=>d.jsx(X1,{node:o,depth:t+1},`dir-${l}-${o.absPath}`)),e.childrenFiles.map((o,l)=>d.jsx(a6,{file:o,depth:t+1},`file-${l}-${o.name}`))]})]})},a6=({file:e,depth:t})=>d.jsxs("div",{className:"flex items-center py-0.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",style:{paddingLeft:`${t*16+16}px`},children:[d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-1.5 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 truncate",children:e.name})]}),o6=({execution:e})=>{const{t}=fe("components"),r=yr(e),n=cr(e),s=()=>{if(!r?.path)return;const i=n?.success?.directoryTreeRoot;return i?`${yh(r.path)} (${i.numFiles} files)`:yh(r.path)};return d.jsx(De,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"LS",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorLsTool.path"),value:r?.path}),r?.ignore&&r.ignore.length>0&&d.jsx(Me,{label:t("cursorLsTool.ignore"),value:r.ignore.join(", ")}),n?.success?.directoryTreeRoot&&d.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800",children:d.jsx(X1,{node:n.success.directoryTreeRoot,depth:0,defaultExpanded:!0})}),n?.success?.directoryTreeRoot?.fullSubtreeExtensionCounts&&d.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 border-t border-gray-200 dark:border-gray-700 pt-2",children:[d.jsxs("span",{className:"font-medium",children:[t("cursorLsTool.extensionStats"),":"]}),d.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:Object.entries(n.success.directoryTreeRoot.fullSubtreeExtensionCounts).sort(([,i],[,a])=>a-i).slice(0,10).map(([i,a])=>d.jsxs("span",{className:"bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded",children:[i,": ",a]},i))})]})]})})},l6=({execution:e})=>{const{t}=fe("components"),r=yr(e),n=cr(e),s=()=>{if(r?.path)return Ul(r.path)};return d.jsx(De,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"Read",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("readTool.readFile"),value:r?.path}),r?.limit&&d.jsx(Me,{label:t("readTool.readLines"),value:r.limit}),n?.success&&d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400 border-t border-gray-200 dark:border-gray-700 pt-2",children:[d.jsx("span",{children:t("cursorReadTool.totalLines",{lines:n.success.totalLines})}),d.jsx("span",{children:t("cursorReadTool.fileSize",{size:s6(n.success.fileSize)})}),n.success.readRange&&d.jsx("span",{children:t("cursorReadTool.readRange",{start:n.success.readRange.startLine,end:n.success.readRange.endLine})}),n.success.exceededLimit&&d.jsx("span",{className:"text-yellow-500 dark:text-yellow-400",children:t("cursorReadTool.exceededLimit")}),n.success.isEmpty&&d.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("cursorReadTool.isEmpty")})]})]})})};function c6(e){if(e)try{const t=JSON.parse(e);if(t.success)return t;if(t.diffString||t.linesAdded!==void 0)return{success:t}}catch{}}const u6=({execution:e})=>{const{t}=fe("components"),[r,n]=L.useState(!1),[s,i]=L.useState(!1),a=yr(e),o=L.useMemo(()=>{const u=cr(e);return u?.success?u:c6(e.toolResult)},[e]),l=()=>{if(!a?.path)return;const u=Ul(a.path);if(o?.success){const{linesAdded:h,linesRemoved:f}=o.success;return`${u} (+${h} -${f})`}return u},c=u=>u.split(`
|
|
419
|
-
`).map((f,g)=>{let p="text-gray-600 dark:text-gray-400",m=null;return f.startsWith("+")?(p="text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-900/20",m=ul):f.startsWith("-")&&(p="text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20",m=yv),d.jsxs("div",{className:`flex items-start ${p} px-2 py-0.5`,children:[m&&d.jsx(m,{className:"w-3 h-3 mr-1 mt-0.5 flex-shrink-0"}),d.jsx("span",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:f.substring(1)||" "})]},g)});return d.jsx(De,{execution:e,subtitle:l(),showResult:!1,hideToolName:!1,overrideToolName:"Edit",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorEditTool.filePath"),value:a?.path}),o?.success&&d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[d.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["+",o.success.linesAdded," ",t("cursorEditTool.linesAdded")]}),d.jsxs("span",{className:"text-red-600 dark:text-red-400",children:["-",o.success.linesRemoved," ",t("cursorEditTool.linesRemoved")]})]}),o?.success?.message&&d.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:o.success.message}),o?.success?.diffString&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorEditTool.viewDiff")}),r?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800",children:c(o.success.diffString)})]}),!o?.success?.diffString&&e.toolResult&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>i(!s),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorEditTool.viewResult","查看结果")}),s?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),s&&d.jsx("div",{className:"max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800 p-2",children:d.jsx("pre",{className:"font-mono text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-all",children:e.toolResult})})]})]})})};function h6(e){if(e)try{const t=JSON.parse(e);if(t.success||t.error)return t;if(t.path&&t.message)return{success:t}}catch{}}const d6=({execution:e})=>{const{t}=fe("components"),[r,n]=L.useState(!1),s=yr(e),i=L.useMemo(()=>{const l=cr(e);return l?.success||l?.error?l:h6(e.toolResult)},[e]),a=()=>{if(s?.path)return Ul(s.path)},o=()=>s?.contents?s.contents.split(`
|
|
420
|
-
`).length:0;return d.jsx(De,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"Write",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorWriteTool.filePath","文件路径"),value:s?.path}),s?.contents&&d.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[d.jsx(Ch,{className:"w-3 h-3"}),d.jsxs("span",{children:[o()," ",t("cursorWriteTool.lines","行")]})]}),i?.success?.message&&d.jsx("div",{className:"text-sm text-green-600 dark:text-green-400",children:i.success.message}),i?.error&&d.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:i.error.error}),s?.contents&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorWriteTool.viewContents","查看内容")}),r?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800 p-2",children:d.jsx("pre",{className:"font-mono text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-all",children:s.contents})})]})]})})},f6=({execution:e})=>{const{t}=fe("components"),r=yr(e),n=cr(e),s=()=>{if(r?.path)return Ul(r.path)},i=n?.error!==void 0,a=n?.success!==void 0;return d.jsx(De,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"Delete",customIcon:d.jsx(nm,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorDeleteTool.path"),value:r?.path}),a&&n.success&&d.jsxs("div",{className:"flex items-center p-3 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:[d.jsx(rm,{className:"w-5 h-5 text-green-500 dark:text-green-400 mr-2 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-green-700 dark:text-green-300",children:n.success.message||t("cursorDeleteTool.deleteSuccess")})]}),i&&n.error&&d.jsxs("div",{className:"flex items-start p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:[d.jsx(ts,{className:"w-5 h-5 text-red-500 dark:text-red-400 mr-2 flex-shrink-0 mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:t("cursorDeleteTool.deleteFailed")}),d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:n.error.error})]})]})]})})},g6=({execution:e})=>{const{t}=fe("components"),[r,n]=L.useState(!0),s=yr(e),i=cr(e),a=()=>{const o=s?.globPattern||"",l=i?.success?.totalFiles;return l!==void 0?`${o} (${l} files)`:o};return d.jsx(De,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"Glob",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorGlobTool.pattern"),value:s?.globPattern}),d.jsx(Me,{label:t("cursorGlobTool.directory"),value:s?.targetDirectory}),i?.success&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{children:t("cursorGlobTool.totalFiles",{count:i.success.totalFiles})}),i.success.clientTruncated&&d.jsx("span",{className:"text-yellow-500 dark:text-yellow-400",children:t("cursorGlobTool.clientTruncated")}),i.success.ripgrepTruncated&&d.jsx("span",{className:"text-yellow-500 dark:text-yellow-400",children:t("cursorGlobTool.ripgrepTruncated")})]}),i.success.files.length>0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsxs("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:[t("cursorGlobTool.matchedFiles")," (",i.success.files.length,")"]}),r?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-48 overflow-auto bg-gray-50 dark:bg-gray-800",children:i.success.files.map((o,l)=>d.jsxs("div",{className:"flex items-center py-1 px-2 hover:bg-gray-100 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 last:border-b-0",children:[d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-2 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 truncate font-mono",children:o})]},l))})]}),i.success.files.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorGlobTool.noFilesFound")})]})]})})},p6=({match:e,pattern:t})=>{const r=(n,s)=>{try{const i=new RegExp(`(${s})`,"gi");return n.split(i).map((o,l)=>i.test(o)?d.jsx("mark",{className:"bg-yellow-200 dark:bg-yellow-900 text-yellow-900 dark:text-yellow-200",children:o},l):d.jsx("span",{children:o},l))}catch{return n}};return d.jsxs("div",{className:`flex py-0.5 ${e.isContextLine?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`,children:[d.jsx("span",{className:"w-12 text-right pr-2 text-gray-400 dark:text-gray-500 flex-shrink-0 font-mono text-xs",children:e.lineNumber}),d.jsxs("span",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:[e.isContextLine?e.content:r(e.content,t),e.contentTruncated&&d.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"..."})]})]})},m6=({fileMatch:e,pattern:t})=>{const[r,n]=L.useState(!0);return d.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[d.jsxs("div",{className:"flex items-center py-1.5 px-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600",onClick:()=>n(!r),children:[r?d.jsx(Tt,{className:"w-3 h-3 text-gray-400 mr-1"}):d.jsx(Ht,{className:"w-3 h-3 text-gray-400 mr-1"}),d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-1.5"}),d.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-gray-300 truncate",children:e.file}),d.jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["(",e.matches.length,")"]})]}),r&&d.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 px-2 py-1",children:e.matches.map((s,i)=>d.jsx(p6,{match:s,pattern:t},i))})]})},x6=({execution:e})=>{const{t}=fe("components"),r=yr(e),n=cr(e),s=()=>{if(!n?.success?.workspaceResults)return[];const u=[];return Object.values(n.success.workspaceResults).forEach(h=>{h.content?.matches&&u.push(...h.content.matches)}),u},i=()=>{if(!n?.success?.workspaceResults)return[];const u=[];return Object.values(n.success.workspaceResults).forEach(h=>{h.files?.files&&u.push(...h.files.files)}),u},a=s(),o=i(),l=a.reduce((u,h)=>u+h.matches.length,0),c=()=>{const u=r?.pattern||"";return n?.success?.outputMode==="files_with_matches"?`"${u}" (${o.length} files)`:`"${u}" (${l} matches)`};return d.jsx(De,{execution:e,subtitle:c(),showResult:!1,hideToolName:!1,overrideToolName:"Grep",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorGrepTool.pattern"),value:r?.pattern,isCode:!0}),d.jsx(Me,{label:t("cursorGrepTool.path"),value:r?.path}),d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[r?.glob&&d.jsxs("span",{className:"bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:["glob: ",r.glob]}),r?.caseInsensitive&&d.jsx("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 px-2 py-0.5 rounded",children:t("cursorGrepTool.caseInsensitive")}),r?.multiline&&d.jsx("span",{className:"bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 px-2 py-0.5 rounded",children:t("cursorGrepTool.multiline")})]}),n?.success&&d.jsxs(d.Fragment,{children:[n.success.outputMode==="content"&&a.length>0&&d.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden max-h-96 overflow-auto",children:a.map((u,h)=>d.jsx(m6,{fileMatch:u,pattern:r?.pattern||""},h))}),n.success.outputMode==="files_with_matches"&&o.length>0&&d.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden max-h-48 overflow-auto bg-gray-50 dark:bg-gray-800",children:o.map((u,h)=>d.jsxs("div",{className:"flex items-center py-1 px-2 hover:bg-gray-100 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 last:border-b-0",children:[d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-2 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 truncate font-mono",children:u})]},h))}),a.length===0&&o.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorGrepTool.noMatchesFound")})]})]})})},y6=({execution:e})=>{const{t}=fe("components"),r=yr(e),n=cr(e),s=()=>{if(!r?.command)return;const c=r.command.trim();return c.length>60?c.slice(0,60)+"...":c},a=n?.success?n.success.interleavedOutput||n.success.stdout+(n.success.stderr?`
|
|
421
|
-
`+n.success.stderr:""):null,o=n?.success?.exitCode,l=o!==void 0&&o!==0;return d.jsx(De,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"Shell",children:d.jsxs("div",{className:"space-y-3",children:[r?.workingDirectory&&d.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{className:"font-medium",children:"CWD:"})," ",r.workingDirectory]}),d.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 font-mono text-sm",children:[d.jsxs("div",{className:"flex items-start",children:[d.jsx("span",{className:"text-green-400 mr-2 select-none",children:"$"}),d.jsx("span",{className:"text-white break-all flex-1",children:r?.command})]}),!e.isExecuting&&a&&d.jsx("div",{className:"mt-2",children:d.jsx("pre",{className:`whitespace-pre-wrap break-words ${l?"text-red-400":"text-gray-300"}`,children:a})}),e.isExecuting&&d.jsx("div",{className:"mt-2",children:d.jsx("span",{className:"text-yellow-400 animate-pulse",children:t("bashTool.executing")})})]}),n?.success&&d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{className:`${l?"text-red-500 dark:text-red-400":"text-green-500 dark:text-green-400"}`,children:t("cursorShellTool.exitCode",{code:o})}),n.success.executionTime!==void 0&&d.jsx("span",{children:t("cursorShellTool.executionTime",{time:i6(n.success.executionTime)})}),n.isBackground&&d.jsx("span",{className:"text-blue-500 dark:text-blue-400",children:t("cursorShellTool.background")})]})]})})},b6=({status:e})=>{switch(e){case"TODO_STATUS_COMPLETED":return d.jsx(rm,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"TODO_STATUS_IN_PROGRESS":return d.jsx(Qn,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 animate-spin"});case"TODO_STATUS_PENDING":default:return d.jsx(Kc,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},k6=e=>{switch(e){case"TODO_STATUS_COMPLETED":return"text-green-700 dark:text-green-400 bg-green-50 dark:bg-green-900/20";case"TODO_STATUS_IN_PROGRESS":return"text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20";case"TODO_STATUS_PENDING":default:return"text-gray-700 dark:text-gray-400 bg-gray-50 dark:bg-gray-800"}},w6=({todo:e})=>d.jsxs("div",{className:`flex items-start p-2 rounded-lg border ${k6(e.status)} border-gray-200 dark:border-gray-700`,children:[d.jsx("div",{className:"flex-shrink-0 mt-0.5",children:d.jsx(b6,{status:e.status})}),d.jsxs("div",{className:"ml-3 flex-1 min-w-0",children:[d.jsx("p",{className:`text-sm ${e.status==="TODO_STATUS_COMPLETED"?"line-through opacity-60":""}`,children:e.content}),e.dependencies.length>0&&d.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:["Dependencies: ",e.dependencies.join(", ")]})]})]}),v6=({execution:e})=>{const{t}=fe("components"),r=yr(e),s=cr(e)?.success?.todos||r?.todos||[],i={completed:s.filter(o=>o.status==="TODO_STATUS_COMPLETED").length,inProgress:s.filter(o=>o.status==="TODO_STATUS_IN_PROGRESS").length,pending:s.filter(o=>o.status==="TODO_STATUS_PENDING").length},a=()=>`${i.completed}/${s.length} completed`;return d.jsx(De,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"TodoWrite",children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[d.jsxs("span",{className:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded",children:[t("cursorTodoTool.completed"),": ",i.completed]}),d.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 px-2 py-0.5 rounded",children:[t("cursorTodoTool.inProgress"),": ",i.inProgress]}),d.jsxs("span",{className:"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-400 px-2 py-0.5 rounded",children:[t("cursorTodoTool.pending"),": ",i.pending]}),r?.merge!==void 0&&d.jsx("span",{className:`px-2 py-0.5 rounded ${r.merge?"bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400":"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400"}`,children:r.merge?t("cursorTodoTool.merge"):t("cursorTodoTool.replace")})]}),s.length>0&&d.jsx("div",{className:"space-y-2 max-h-64 overflow-auto",children:s.map(o=>d.jsx(w6,{todo:o},o.id))}),s.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorTodoTool.noTodos")})]})})},C6=({resource:e})=>d.jsxs("div",{className:"flex items-start p-2 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[d.jsx(Jp,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 mr-2 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:e.name}),e.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:e.description}),d.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[d.jsx("code",{className:"text-xs text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-1.5 py-0.5 rounded truncate",children:e.uri}),e.mimeType&&d.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:e.mimeType})]})]})]}),S6=({execution:e})=>{const{t}=fe("components"),n=cr(e)?.success?.resources||[],s=()=>`${n.length} resources`;return d.jsx(De,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"ListMcpResources",customIcon:d.jsx(sm,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[n.length>0&&d.jsx("div",{className:"space-y-2 max-h-64 overflow-auto",children:n.map((i,a)=>d.jsx(C6,{resource:i},a))}),n.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorMcpResourcesTool.noResources")})]})})},_6=({execution:e})=>{const{t}=fe("components"),[r,n]=L.useState(!1),s=yr(e),i=cr(e),a=()=>{if(s?.url)try{return new URL(s.url).hostname}catch{return s.url.slice(0,40)}},o=i?.error!==void 0,l=i?.success!==void 0;return d.jsx(De,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"WebFetch",customIcon:d.jsx(bv,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorWebFetchTool.url"),value:s?.url}),l&&i.success&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorWebFetchTool.fetchedContent")}),r?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-64 overflow-auto p-3 bg-gray-50 dark:bg-gray-800",children:d.jsx("pre",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words font-mono",children:i.success.markdown.length>2e3?i.success.markdown.slice(0,2e3)+`
|
|
422
|
-
|
|
423
|
-
...(truncated)`:i.success.markdown})})]}),o&&i.error&&d.jsxs("div",{className:"flex items-start p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:[d.jsx(ts,{className:"w-5 h-5 text-red-500 dark:text-red-400 mr-2 flex-shrink-0 mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:t("cursorWebFetchTool.fetchFailed")}),d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:i.error.error})]})]})]})})},T6=({execution:e})=>{const{t}=fe("components"),[r,n]=L.useState(!0),s=yr(e),i=cr(e),a=()=>{if(!s?.query)return;const c=s.query.trim();return c.length>50?c.slice(0,50)+"...":c},o=c=>{const u=[],h=/<search_result\s+path="([^"]+)"\s+startLine="(\d+)"\s+endLine="(\d+)">([\s\S]*?)<\/search_result>/g;let f;for(;(f=h.exec(c))!==null;)u.push({path:f[1],startLine:f[2],endLine:f[3],content:f[4].trim()});return u},l=i?.success?.results?o(i.success.results):[];return d.jsx(De,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"SemanticSearch",customIcon:d.jsx(Yc,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(Me,{label:t("cursorSemSearchTool.query"),value:s?.query}),s?.targetDirectories&&s.targetDirectories.length>0&&d.jsx(Me,{label:t("cursorSemSearchTool.targetDirectories"),value:s.targetDirectories.join(", ")}),s?.explanation&&d.jsx(Me,{label:t("cursorSemSearchTool.explanation"),value:s.explanation}),l.length>0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorSemSearchTool.results",{count:l.length})}),r?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-96 overflow-auto",children:l.map((c,u)=>d.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[d.jsxs("div",{className:"flex items-center px-3 py-2 bg-gray-50 dark:bg-gray-800",children:[d.jsx("span",{className:"text-sm font-mono text-blue-600 dark:text-blue-400 truncate",children:c.path}),d.jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["L",c.startLine,"-",c.endLine]})]}),d.jsx("div",{className:"p-2 bg-gray-900 dark:bg-gray-950",children:d.jsx("pre",{className:"text-xs text-gray-300 whitespace-pre-wrap break-words overflow-auto max-h-40",children:c.content.length>500?c.content.slice(0,500)+`
|
|
424
|
-
...(truncated)`:c.content})})]},u))})]}),i?.success?.results&&l.length===0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-700",children:d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorSemSearchTool.rawResults")})}),d.jsx("div",{className:"p-2 bg-gray-50 dark:bg-gray-800 max-h-64 overflow-auto",children:d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words",children:i.success.results})})]}),i?.success&&!i.success.results&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorSemSearchTool.noResults")})]})})},N6=({content:e})=>{if(e.text?.text)try{const t=JSON.parse(e.text.text);return d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words bg-gray-50 dark:bg-gray-800 p-2 rounded",children:JSON.stringify(t,null,2)})}catch{return d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words",children:e.text.text})}return e.image?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(qs,{className:"w-4 h-4 text-gray-400"}),d.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Image (",e.image.mimeType,")"]}),e.image.data&&d.jsx("img",{src:`data:${e.image.mimeType};base64,${e.image.data}`,alt:"MCP Result",className:"max-w-xs max-h-32 rounded border border-gray-200 dark:border-gray-700"})]}):e.resource?d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"text-blue-600 dark:text-blue-400 font-mono text-xs",children:e.resource.uri}),e.resource.text&&d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words mt-1",children:e.resource.text})]}):null},E6=({execution:e})=>{const{t}=fe("components"),[r,n]=L.useState(!1),[s,i]=L.useState(!0),a=yr(e),o=cr(e),l=()=>{if(a)return`${a.providerIdentifier}:${a.toolName}`},c=o?.success?.isError||o?.error!==void 0;return d.jsx(De,{execution:e,subtitle:l(),showResult:!1,hideToolName:!1,overrideToolName:"MCP",customIcon:d.jsx(sm,{className:"w-4 h-4"}),isMcpTool:!0,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[d.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 px-2 py-0.5 rounded",children:[t("cursorMcpTool.server"),": ",a?.providerIdentifier]}),d.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 px-2 py-0.5 rounded",children:[t("cursorMcpTool.tool"),": ",a?.toolName]})]}),a?.args&&Object.keys(a.args).length>0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorMcpTool.parameters")}),r?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"p-2 bg-gray-50 dark:bg-gray-800",children:d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words",children:JSON.stringify(a.args,null,2)})})]}),o&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:`flex items-center justify-between p-2 cursor-pointer transition-colors ${c?"bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/30":"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30"}`,onClick:()=>i(!s),children:[d.jsxs("div",{className:"flex items-center gap-2",children:[c&&d.jsx(ts,{className:"w-4 h-4 text-red-500"}),d.jsx("span",{className:`text-xs font-medium ${c?"text-red-700 dark:text-red-400":"text-green-700 dark:text-green-400"}`,children:t(c?"cursorMcpTool.error":"cursorMcpTool.result")})]}),s?d.jsx(Tt,{className:"w-4 h-4 text-gray-500"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500"})]}),s&&d.jsxs("div",{className:"p-2 bg-gray-50 dark:bg-gray-800 max-h-64 overflow-auto",children:[o.success?.content&&d.jsx("div",{className:"space-y-2",children:o.success.content.map((u,h)=>d.jsx(N6,{content:u},h))}),o.error&&d.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:o.error.error})]})]})]})})},A6=({execution:e})=>{const{t}=fe("components");switch(e.toolName){case"lsToolCall":return d.jsx(o6,{execution:e});case"readToolCall":return d.jsx(l6,{execution:e});case"editToolCall":case"strReplaceToolCall":return d.jsx(u6,{execution:e});case"writeToolCall":return d.jsx(d6,{execution:e});case"deleteToolCall":return d.jsx(f6,{execution:e});case"globToolCall":return d.jsx(g6,{execution:e});case"grepToolCall":return d.jsx(x6,{execution:e});case"shellToolCall":return d.jsx(y6,{execution:e});case"updateTodosToolCall":return d.jsx(v6,{execution:e});case"listMcpResourcesToolCall":return d.jsx(S6,{execution:e});case"webFetchToolCall":return d.jsx(_6,{execution:e});case"semSearchToolCall":return d.jsx(T6,{execution:e});case"mcpToolCall":return d.jsx(E6,{execution:e});default:return d.jsx(De,{execution:e,overrideToolName:n6(e.toolName),children:d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:t("cursorToolRenderer.unknownCursorTool",{toolName:e.toolName})}),d.jsx("div",{className:"text-xs text-gray-500 bg-gray-100 dark:bg-gray-700 p-2 rounded font-mono overflow-auto max-h-64",children:d.jsx("pre",{className:"whitespace-pre-wrap break-words",children:JSON.stringify(e.toolInput,null,2)})})]})})}};function M6(e){return["lsToolCall","readToolCall","editToolCall","writeToolCall","strReplaceToolCall","deleteToolCall","globToolCall","grepToolCall","shellToolCall","updateTodosToolCall","listMcpResourcesToolCall","webFetchToolCall","semSearchToolCall","mcpToolCall"].includes(e)}const K1=({execution:e,onAskUserQuestionSubmit:t})=>{const{t:r}=fe("components"),n=G1(e.toolName);if(n){if(n.serverName==="ask-user-question"&&n.toolName==="ask_user_question")return d.jsx(Dp,{execution:e,onSubmit:t});const s=`${n.serverName}__${n.toolName}`,i=r6[s];return i?d.jsx(i,{execution:e}):d.jsx(ZO,{execution:e})}if(M6(e.toolName))return d.jsx(A6,{execution:e});switch(e.toolName){case"Task":return d.jsx(pO,{execution:e});case"Bash":return d.jsx(mO,{execution:e});case"BashOutput":return d.jsx(cv,{execution:e});case"KillBash":return d.jsx(lv,{execution:e});case"Glob":return d.jsx(xO,{execution:e});case"Grep":return d.jsx(yO,{execution:e});case"LS":return d.jsx(bO,{execution:e});case"exit_plan_mode":return d.jsx(kO,{execution:e});case"Read":return d.jsx(wO,{execution:e});case"Edit":return d.jsx(BO,{execution:e});case"MultiEdit":return d.jsx(RO,{execution:e});case"Write":return d.jsx(OO,{execution:e});case"NotebookRead":return d.jsx(zO,{execution:e});case"NotebookEdit":return d.jsx(WO,{execution:e});case"ListMcpResources":return d.jsx(HO,{execution:e});case"ReadMcpResource":return d.jsx(qO,{execution:e});case"TimeMachine":return d.jsx(UO,{execution:e});case"AskUserQuestion":return d.jsx(Dp,{execution:e,onSubmit:t});case"WebFetch":return d.jsx(VO,{execution:e});case"TodoWrite":return d.jsx(ov,{execution:e});case"WebSearch":return d.jsx(GO,{execution:e});case"call_external_agent":return d.jsx(Y1,{execution:e});case"Skill":return d.jsx(t6,{execution:e});default:return d.jsx(De,{execution:e,children:d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-gray-600 mb-2",children:r("toolRenderer.unknownToolType")}),d.jsx("div",{className:"text-xs text-gray-500 bg-gray-100 p-2 rounded font-mono",children:JSON.stringify(e.toolInput,null,2)})]})})}},j6=e=>({id:`tool_${Date.now()}_${Math.random()}`,toolName:e.toolName,toolInput:e.toolInput,toolResult:e.toolResult,toolUseResult:e.toolUseResult,isExecuting:e.isExecuting||!1,isError:e.isError||!1,timestamp:new Date,claudeId:e.claudeId}),Pp=e=>{const t=j6(e);return d.jsx(K1,{execution:t,onAskUserQuestionSubmit:e.onAskUserQuestionSubmit})},ll=({images:e,initialIndex:t=0,onClose:r})=>{const[n,s]=L.useState(()=>!e||e.length===0?0:Math.min(t,e.length-1)),[i,a]=L.useState(1),[o,l]=L.useState({x:0,y:0}),[c,u]=L.useState(!1),[h,f]=L.useState({x:0,y:0}),[g,p]=L.useState(0),[m,y]=L.useState(!1),x=L.useRef(null),k=L.useRef(null),v=()=>{if(!x.current||!k.current)return 1;const I=x.current,O=k.current,W=I.naturalWidth,Z=I.naturalHeight,E=O.clientWidth,D=O.clientHeight-120,X=E/W,N=D/Z;return Math.min(X,N,1)},_=()=>{y(!0);const I=v();a(I),l({x:0,y:0})},C=e&&e.length>0?e[n]:"",w=()=>{e&&n>0&&s(n-1)},S=()=>{e&&n<e.length-1&&s(n+1)};L.useEffect(()=>{if(e&&e.length>0){const I=Math.min(t,e.length-1);s(I)}},[e,t]),L.useEffect(()=>{C&&(a(1),l({x:0,y:0}),p(0),u(!1),y(!1))},[C]),L.useEffect(()=>{if(!C)return;const I=O=>{switch(O.key){case"Escape":r();break;case"ArrowLeft":O.preventDefault(),w();break;case"ArrowRight":O.preventDefault(),S();break;case"ArrowUp":O.preventDefault(),w();break;case"ArrowDown":O.preventDefault(),S();break;case"=":case"+":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),F("in"));break;case"-":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),F("out"));break;case"0":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),R());break;case"r":case"R":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),A());break}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[C,n,e?.length]);const F=I=>{a(O=>{const W=I==="in"?O*1.2:O/1.2;return Math.max(.1,Math.min(5,W))})},A=()=>{p(I=>(I+90)%360)},T=I=>{I.target===x.current&&(u(!0),f({x:I.clientX-o.x,y:I.clientY-o.y}))},j=I=>{c&&l({x:I.clientX-h.x,y:I.clientY-h.y})},M=()=>{u(!1)},P=I=>{I.preventDefault();const O=I.deltaY>0?"out":"in";F(O)},$=()=>{if(C){const I=document.createElement("a");I.href=C,I.download=`image-${n+1}.jpg`,I.click()}},R=()=>{const I=v();a(I),l({x:0,y:0}),p(0)};return!e||e.length===0?null:d.jsxs("div",{ref:k,className:"fixed inset-0 bg-black bg-opacity-90 flex items-center justify-center z-50",onClick:I=>{I.target===k.current&&r()},onMouseMove:j,onMouseUp:M,onWheel:P,children:[d.jsxs("div",{className:"absolute top-4 left-1/2 transform -translate-x-1/2 flex items-center space-x-2 bg-black bg-opacity-50 rounded-lg px-4 py-2 z-10",children:[e.length>1&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"text-white text-sm",children:[n+1," / ",e.length]}),d.jsx("div",{className:"w-px h-6 bg-gray-500"})]}),d.jsx("button",{onClick:()=>F("out"),className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"缩小 (Ctrl + -)",children:d.jsx(Qp,{className:"w-5 h-5"})}),d.jsxs("span",{className:"text-white text-sm min-w-16 text-center",children:[Math.round(i*100),"%"]}),d.jsx("button",{onClick:()=>F("in"),className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"放大 (Ctrl + +)",children:d.jsx(Zp,{className:"w-5 h-5"})}),d.jsx("div",{className:"w-px h-6 bg-gray-500"}),d.jsx("button",{onClick:A,className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"旋转 90°",children:d.jsx(kv,{className:"w-5 h-5"})}),d.jsx("button",{onClick:R,className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors text-sm",title:"适应窗口大小",children:"适应"}),d.jsx("button",{onClick:()=>{a(1),l({x:0,y:0}),p(0)},className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors text-sm",title:"显示原始大小",children:"1:1"}),d.jsx("button",{onClick:$,className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"下载图片",children:d.jsx(em,{className:"w-5 h-5"})})]}),e.length>1&&d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:w,disabled:n===0,className:`absolute left-4 top-1/2 transform -translate-y-1/2 text-white p-3 rounded-full transition-all z-10 ${n===0?"opacity-50 cursor-not-allowed":"hover:text-gray-300 hover:bg-white hover:bg-opacity-20"}`,title:"上一张 (←)",children:d.jsx(im,{className:"w-8 h-8"})}),d.jsx("button",{onClick:S,disabled:n===e.length-1,className:`absolute right-4 top-1/2 transform -translate-y-1/2 text-white p-3 rounded-full transition-all z-10 ${n===e.length-1?"opacity-50 cursor-not-allowed":"hover:text-gray-300 hover:bg-white hover:bg-opacity-20"}`,title:"下一张 (→)",children:d.jsx(Ht,{className:"w-8 h-8"})})]}),d.jsx("button",{onClick:r,className:"absolute top-4 right-4 text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded-full transition-colors z-10",title:"关闭预览 (ESC)",children:d.jsx(es,{className:"w-6 h-6"})}),d.jsx("img",{ref:x,src:C,alt:`图片预览 ${n+1}/${e.length}`,className:`max-w-none transition-transform ${c?"cursor-grabbing":"cursor-grab"}`,style:{transform:`translate(${o.x}px, ${o.y}px) scale(${i}) rotate(${g}deg)`,maxHeight:"none",maxWidth:"none",opacity:m?1:0},onLoad:_,onMouseDown:T,onDoubleClick:R,draggable:!1,onClick:I=>I.stopPropagation()}),d.jsx("div",{className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 text-white text-sm bg-black bg-opacity-50 rounded px-3 py-1",children:e.length>1?"方向键切换 • 鼠标拖拽移动 • 滚轮缩放 • 双击适应窗口 • ESC关闭":"鼠标拖拽移动 • 滚轮缩放 • 双击适应窗口 • ESC关闭"})]})},I6=({content:e})=>{const{t}=fe("components"),r=typeof e=="string"?e:Array.isArray(e)?e.map(i=>i.text||JSON.stringify(i)).join(""):String(e),[n,s]=L.useState(!1);return d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800/50",children:[d.jsxs("button",{onClick:()=>s(!n),className:"w-full flex items-center justify-between p-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700/50 transition-colors",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(wv,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),d.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("compactSummary.title")})]}),d.jsxs("div",{className:"flex items-center space-x-1",children:[d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:t(n?"compactSummary.collapse":"compactSummary.expand")}),n?d.jsx(Tt,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}):d.jsx(Ht,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]})]}),n&&d.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4 bg-white dark:bg-gray-800",children:d.jsx("div",{className:"text-sm",children:d.jsx(Zi,{content:r})})})]})},L6=({message:e,onAskUserQuestionSubmit:t})=>{const[r,n]=L.useState([]),[s,i]=L.useState(0),a=()=>{const c=[];return e.messageParts&&e.messageParts.length>0&&e.messageParts.forEach(u=>{u.type==="image"&&u.imageData&&c.push(`data:${u.imageData.mediaType};base64,${u.imageData.data}`)}),e.images&&e.images.length>0&&e.images.forEach(u=>{c.push(`data:${u.mediaType};base64,${u.data}`)}),c},o=c=>{const u=a(),h=u.indexOf(c);n(u),i(h>=0?h:0)},l=()=>{n([]),i(0)};if(e.messageParts&&e.messageParts.length>0){const c=[...e.messageParts].sort((u,h)=>u.order-h.order);return d.jsxs("div",{className:"space-y-3",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2",children:e.images.map(u=>{const h=`data:${u.mediaType};base64,${u.data}`;return d.jsx("img",{src:h,alt:u.filename||"Image",className:"max-w-32 max-h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-700 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>o(h),title:u.filename||"Click to preview"},u.id)})}),c.map(u=>{if(u.type==="command"&&u.content){const h=u.content.trim(),f=h.indexOf(" "),g=f>0?h.substring(0,f):h,p=f>0?h.substring(f+1).trim():"";return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"inline-flex items-center px-2.5 py-1 bg-gray-800 dark:bg-gray-900 text-emerald-400 dark:text-emerald-300 rounded-md text-sm font-mono font-medium",children:g}),p&&d.jsx("span",{className:"text-gray-100 text-sm",children:p})]},u.id)}else{if(u.type==="compactSummary"&&u.content)return d.jsx("div",{children:d.jsx(I6,{content:u.content})},u.id);if(u.type==="text"&&u.content)return d.jsx("div",{children:d.jsx(Zi,{content:u.content,isUserMessage:e.role==="user"})},u.id);if(u.type==="thinking"&&u.content)return d.jsxs("details",{className:"my-2",children:[d.jsx("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 text-sm hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none",children:"💭 思考过程..."}),d.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"text-gray-600 dark:text-gray-300 text-sm whitespace-pre-wrap break-words leading-relaxed italic",children:u.content})})]},u.id);if(u.type==="tool"&&u.toolData)return d.jsx(Pp,{toolName:u.toolData.toolName,toolInput:u.toolData.toolInput,toolResult:u.toolData.toolResult,toolUseResult:u.toolData.toolUseResult,isError:u.toolData.isError,isExecuting:u.toolData.isExecuting,claudeId:u.toolData.claudeId,onAskUserQuestionSubmit:t},u.id);if(u.type==="image"&&u.imageData){const h=`data:${u.imageData.mediaType};base64,${u.imageData.data}`;return d.jsx("div",{className:"inline-block",children:d.jsx("img",{src:h,alt:u.imageData.filename||"Image",className:"max-w-32 max-h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-700 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>o(h),title:u.imageData.filename||"Click to preview"})},u.id)}else if(u.type==="text"&&u.content&&u.content.includes("unknown"))if(u.content.includes('"type":"thinking"')||u.content.includes('"thinking"')||u.content.includes("thinking")){let f=u.content;try{if(u.content.includes('"thinking":')){const g=u.content.match(/"thinking":"([^"]+)"/);g&&g[1]&&(f=g[1].replace(/\\n/g,`
|
|
425
|
-
`).replace(/\\"/g,'"'))}}catch(g){console.warn("Failed to parse thinking content:",g)}return d.jsxs("details",{className:"my-2",children:[d.jsx("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 text-sm hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none",children:"💭 思考过程... (历史消息)"}),d.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"text-gray-600 dark:text-gray-300 text-sm whitespace-pre-wrap break-words leading-relaxed italic",children:f})})]},u.id)}else return d.jsx("div",{children:d.jsx(Zi,{content:u.content,isUserMessage:e.role==="user"})},u.id)}return null}),d.jsx(ll,{images:r,initialIndex:s,onClose:l})]})}return d.jsxs("div",{className:"space-y-2",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2",children:e.images.map(c=>{const u=`data:${c.mediaType};base64,${c.data}`;return d.jsx("img",{src:u,alt:c.filename||"Image",className:"max-w-32 max-h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-700 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>o(u),title:c.filename||"Click to preview"},c.id)})}),e.content&&d.jsx("div",{children:(()=>{const c=e.content.match(/<command-message>.*?<\/command-message>\s*<command-name>(.+?)<\/command-name>/);if(c){const u=c[1].trim(),h=u.indexOf(" "),f=h>0?u.substring(0,h):u,g=h>0?u.substring(h+1).trim():"";return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"inline-flex items-center px-2.5 py-1 bg-gray-800 dark:bg-gray-900 text-emerald-400 dark:text-emerald-300 rounded-md text-sm font-mono font-medium",children:f}),g&&d.jsx("span",{className:"text-gray-100 text-sm",children:g})]})}else return d.jsx(Zi,{content:e.content,isUserMessage:e.role==="user"})})()}),e.toolUsage&&e.toolUsage.length>0&&d.jsx("div",{className:"space-y-2",children:e.toolUsage.map(c=>d.jsx(Pp,{toolName:c.toolName,toolInput:c.toolInput,toolResult:c.toolResult,toolUseResult:c.toolUseResult,isError:c.isError,isExecuting:c.isExecuting,claudeId:c.claudeId,onAskUserQuestionSubmit:t},c.id))}),d.jsx(ll,{images:r,initialIndex:s,onClose:l})]})},Q1=L.memo(L6),$6=({messages:e,isLoadingMessages:t,isInitializingSession:r,isAiTyping:n,isStopping:s,messagesContainerRef:i,messagesEndRef:a,onAskUserQuestionSubmit:o})=>{const{t:l}=fe("components"),c=L.useMemo(()=>e.map(u=>d.jsx("div",{className:"px-4",children:d.jsx("div",{className:`text-sm leading-relaxed break-words overflow-hidden ${u.role==="user"?"text-white p-3 rounded-lg":"text-gray-800 dark:text-gray-200"}`,style:u.role==="user"?{backgroundColor:"hsl(var(--primary))",color:"white"}:{},children:d.jsx(Q1,{message:u,onAskUserQuestionSubmit:o})})},u.id)),[e,o]);return d.jsxs("div",{ref:i,className:"flex-1 overflow-y-auto space-y-4 py-4 relative",children:[t&&d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[d.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 dark:border-gray-100"}),d.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("agentChatPanel.loadingMessages")})]})}),!t&&e.length===0&&d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400"})}),!t&&c,r&&d.jsx("div",{className:"px-4",children:d.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("agentChatPanel.initializingSession")})]})}),!r&&(n||s)&&d.jsx("div",{className:"px-4",children:d.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),s&&d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("agentChat.stopping")})]})}),d.jsx("div",{ref:a})]})},D6=({envVars:e,onChange:t})=>{const{t:r}=fe("components"),[n,s]=L.useState(""),[i,a]=L.useState(""),o=()=>{if(!n.trim())return;const u={...e,[n.trim()]:i};t(u),s(""),a("")},l=u=>{const h={...e};delete h[u],t(h)},c=(u,h,f)=>{if(u!==h){const g={...e};delete g[u],g[h]=f,t(g)}else{const g={...e,[u]:f};t(g)}};return d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:r("agentChat.envVars.title","Environment Variables")}),d.jsxs("div",{className:"space-y-2",children:[Object.entries(e).length===0&&d.jsx("div",{className:"text-sm text-gray-400 italic px-2",children:r("agentChat.envVars.noVars","No environment variables set")}),Object.entries(e).map(([u,h])=>d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"text",value:u,onChange:f=>c(u,f.target.value,h),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.key","KEY")}),d.jsx("span",{className:"text-gray-400",children:"="}),d.jsx("input",{type:"text",value:h,onChange:f=>c(u,u,f.target.value),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.value","VALUE")}),d.jsx("button",{onClick:()=>l(u),className:"p-1 text-gray-400 hover:text-red-500 hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors",title:r("agentChat.envVars.delete","Remove"),children:d.jsx(nm,{className:"w-4 h-4"})})]},u))]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"text",value:n,onChange:u=>s(u.target.value),onKeyDown:u=>u.key==="Enter"&&o(),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.key","NEW_KEY")}),d.jsx("span",{className:"text-gray-400",children:"="}),d.jsx("input",{type:"text",value:i,onChange:u=>a(u.target.value),onKeyDown:u=>u.key==="Enter"&&o(),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.value","VALUE")}),d.jsx("button",{onClick:o,disabled:!n.trim(),className:"p-1 text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900/30 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:r("agentChat.envVars.add","Add"),children:d.jsx(ul,{className:"w-4 h-4"})})]})]})},Z1=({permissionMode:e,onPermissionModeChange:t,selectedClaudeVersion:r,onClaudeVersionChange:n,selectedModel:s,onModelChange:i,availableModels:a,claudeVersionsData:o,isVersionLocked:l,isAiTyping:c,envVars:u,onEnvVarsChange:h,className:f="",engineUICapabilities:g})=>{const{t:p}=fe("components"),[m,y]=L.useState(!1),x=L.useRef(null),k=g||{showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0};L.useEffect(()=>{const M=P=>{x.current&&!x.current.contains(P.target)&&y(!1)};return m&&document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[m]);const v=M=>{t(M)},_=M=>{n(M)},C=M=>{i(M)},w=o?.versions&&o.versions.length>1&&k.showProviderSelector,S=a.length>=2&&k.showModelSelector,F=k.showPermissionSelector,A=k.showEnvVars,T=a.find(M=>M.id===s)?.name||s,j={default:p("agentChat.permissionMode.default"),acceptEdits:p("agentChat.permissionMode.acceptEdits"),bypassPermissions:p("agentChat.permissionMode.bypassPermissions")}[e];return d.jsxs("div",{className:`relative ${f}`,ref:x,children:[d.jsxs("button",{onClick:()=>y(!m),className:`flex items-center space-x-2 px-3 py-2 text-sm rounded-lg transition-colors border ${m?"border-blue-500 bg-blue-50 dark:bg-blue-900/30":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800"}`,disabled:c,title:p("agentChat.settings.title"),children:[d.jsxs("div",{className:"flex items-center space-x-2 text-gray-700 dark:text-gray-300",children:[k.showModelSelector&&d.jsx("span",{className:"font-medium",children:T}),k.showModelSelector&&k.showPermissionSelector&&d.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),k.showPermissionSelector&&d.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:j}),!k.showModelSelector&&!k.showPermissionSelector&&d.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:p("agentChat.settings.title","Settings")})]}),d.jsx(Tt,{className:`w-3 h-3 text-gray-400 transition-transform ${m?"transform rotate-180":""}`})]}),m&&d.jsxs("div",{className:"absolute bottom-full left-0 mb-2 w-[400px] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl shadow-2xl z-50 flex flex-col max-h-[80vh]",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700",children:[d.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[d.jsx(am,{className:"w-4 h-4"}),p("agentChat.settings.title","Chat Configuration")]}),d.jsx("button",{onClick:()=>y(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 p-1 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:d.jsx(es,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"overflow-y-auto p-4 space-y-6",children:[(S||w)&&d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:p("agentChat.settings.modelAndVersion","Supplier & Model")}),d.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[w&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:p("agentChat.settings.claudeVersion")}),d.jsxs("div",{className:"relative",children:[d.jsxs("select",{value:r||"",onChange:M=>_(M.target.value||void 0),disabled:l,className:`w-full appearance-none px-3 py-2 text-sm rounded-lg border bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 ${l?"opacity-50 cursor-not-allowed border-gray-200 dark:border-gray-700":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:[d.jsx("option",{value:"",children:o?.defaultVersionId?`${p("agentChat.claudeVersion.default")} (${o.versions.find(M=>M.id===o.defaultVersionId)?.name})`:p("agentChat.claudeVersion.default")}),o.versions.filter(M=>o.defaultVersionId&&M.id!==o.defaultVersionId).map(M=>d.jsx("option",{value:M.id,children:M.name},M.id))]}),d.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none text-gray-500",children:d.jsx(Tt,{className:"w-4 h-4"})})]})]}),S&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:p("agentChat.settings.model")}),d.jsx("div",{className:"grid grid-cols-1 gap-2 max-h-[200px] overflow-y-auto pr-1",children:a.map(M=>d.jsxs("button",{onClick:()=>C(M.id),className:`flex items-center justify-between px-3 py-2 text-sm rounded-lg border transition-all ${s===M.id?"border-purple-500 bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 shadow-sm":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-700 dark:text-gray-300"}`,children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(vv,{className:"w-4 h-4 opacity-70"}),d.jsx("span",{className:"font-medium",children:M.name})]}),M.isVision&&d.jsx("span",{className:"text-xs bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded text-gray-500",children:"Vision"})]},M.id))})]})]})]}),F&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-gray-100 dark:bg-gray-700"}),d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:p("agentChat.settings.permissionMode")}),d.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{value:"default",label:p("agentChat.permissionMode.default"),icon:no},{value:"acceptEdits",label:p("agentChat.permissionMode.acceptEdits"),icon:no},{value:"bypassPermissions",label:p("agentChat.permissionMode.bypassPermissions"),icon:no}].map(M=>d.jsxs("button",{onClick:()=>v(M.value),className:`flex flex-col items-center justify-center p-2 text-xs rounded-lg border transition-all text-center gap-1.5 h-full ${e===M.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 shadow-sm":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-600 dark:text-gray-400"}`,children:[d.jsx(M.icon,{className:`w-4 h-4 ${e===M.value?"text-blue-500":"text-gray-400"}`}),d.jsx("span",{className:"leading-tight",children:M.label})]},M.value))})]})]}),A&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-gray-100 dark:bg-gray-700"}),d.jsx("div",{children:d.jsx(D6,{envVars:u,onChange:h})})]})]})]})]})};function B6(e={}){const{maxDuration:t=6e4,language:r,provider:n}=e,[s,i]=L.useState("idle"),[a,o]=L.useState(null),[l,c]=L.useState(null),[u,h]=L.useState(!0),f=L.useRef(null),g=L.useRef([]),p=L.useRef(null),m=L.useRef(null),y=L.useCallback(async()=>{h(!0);try{const C=await gr(`${ar}/speech-to-text/status`);if(C.ok){const w=await C.json();c(w)}else c({enabled:!1,availableProviders:[],defaultProvider:null})}catch(C){console.error("Failed to load voice service status:",C),c({enabled:!1,availableProviders:[],defaultProvider:null})}finally{h(!1)}},[]);L.useEffect(()=>{y()},[y]);const x=L.useCallback(()=>{p.current&&(p.current.getTracks().forEach(C=>C.stop()),p.current=null),m.current&&(clearTimeout(m.current),m.current=null),f.current=null,g.current=[]},[]),k=L.useCallback(async()=>{if(!l?.enabled){o("语音服务未启用,请先在设置中配置"),i("error");return}if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){o("您的浏览器不支持录音功能"),i("error");return}x(),o(null),i("recording");try{const C=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});p.current=C;const w=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",S=new MediaRecorder(C,{mimeType:w,audioBitsPerSecond:16e3});f.current=S,g.current=[],S.ondataavailable=F=>{F.data.size>0&&g.current.push(F.data)},S.start(100),t>0&&(m.current=setTimeout(()=>{f.current?.state==="recording"&&f.current.stop()},t))}catch(C){console.error("Failed to start recording:",C),x(),C instanceof DOMException?C.name==="NotAllowedError"?o("请允许使用麦克风"):C.name==="NotFoundError"?o("未找到麦克风设备"):o(`录音失败: ${C.message}`):o("开始录音失败"),i("error")}},[x,t,l?.enabled]),v=L.useCallback(async()=>!f.current||s!=="recording"?null:(i("processing"),new Promise(C=>{const w=f.current;w.onstop=async()=>{try{const S=new Blob(g.current,{type:w.mimeType});if(x(),S.size<1e3){o("录音时间太短"),i("error"),C(null);return}const F=await S.arrayBuffer(),A=btoa(new Uint8Array(F).reduce((P,$)=>P+String.fromCharCode($),"")),T=w.mimeType.includes("webm")?"webm":w.mimeType.includes("mp4")?"m4a":"webm",j=await gr(`${ar}/speech-to-text/transcribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({audioData:A,audioFormat:T,language:r,provider:n})});if(!j.ok){const P=await j.json();throw new Error(P.message||"转写失败")}const M=await j.json();i("idle"),C(M.text||"")}catch(S){console.error("Failed to transcribe audio:",S),o(S instanceof Error?S.message:"语音转写失败"),i("error"),C(null)}},w.stop()})),[x,r,n,s]),_=L.useCallback(()=>{f.current&&f.current.stop(),x(),i("idle"),o(null)},[x]);return L.useEffect(()=>()=>{x()},[x]),{status:s,isRecording:s==="recording",isProcessing:s==="processing",error:a,serviceStatus:l,isServiceLoading:u,startRecording:k,stopRecording:v,cancelRecording:_,refreshServiceStatus:y}}const R6=({onTranscribed:e,disabled:t=!1,language:r,className:n="",onOpenSettings:s})=>{const{t:i}=fe("components"),[a,o]=L.useState(!1),{isRecording:l,isProcessing:c,error:u,serviceStatus:h,isServiceLoading:f,startRecording:g,stopRecording:p,cancelRecording:m}=B6({language:r}),y=L.useCallback(async()=>{if(l){const C=await p();C&&e(C)}else c||await g()},[l,c,g,p,e]),x=L.useCallback(C=>{C.preventDefault(),l&&m()},[l,m]),v=f?{icon:d.jsx(Qn,{className:"w-4 h-4 animate-spin"}),title:i("voiceInput.loading","加载中..."),className:"text-gray-400 dark:text-gray-500 cursor-wait",disabled:!0}:h?.enabled?c?{icon:d.jsx(Qn,{className:"w-4 h-4 animate-spin"}),title:i("voiceInput.processing","转写中..."),className:"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30",disabled:!0}:l?{icon:d.jsx(Kd,{className:"w-4 h-4 animate-pulse"}),title:i("voiceInput.recording","录音中,点击停止"),className:"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 hover:bg-red-100 dark:hover:bg-red-900/50",disabled:!1}:u?{icon:d.jsx(ts,{className:"w-4 h-4"}),title:u,className:"text-yellow-600 dark:text-yellow-400 hover:text-yellow-700 dark:hover:text-yellow-300 hover:bg-yellow-50 dark:hover:bg-yellow-900/30",disabled:!1}:{icon:d.jsx(Kd,{className:"w-4 h-4"}),title:i("voiceInput.start","点击开始语音输入"),className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",disabled:!1}:{icon:d.jsx(Cv,{className:"w-4 h-4"}),title:i("voiceInput.notConfigured","语音服务未配置,点击配置"),className:"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700",disabled:!1,showSettings:!0},_=L.useCallback(async()=>{if(v.showSettings&&s){s();return}await y()},[v.showSettings,s,y]);return d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:_,onContextMenu:x,disabled:t||v.disabled,className:`p-2 transition-colors rounded-lg ${v.className} ${t?"opacity-50 cursor-not-allowed":""} ${n}`,title:v.title,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:v.icon}),l&&d.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-red-500 text-white text-xs rounded-lg whitespace-nowrap shadow-lg z-50",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("span",{className:"w-2 h-2 bg-white rounded-full animate-pulse"}),d.jsx("span",{children:i("voiceInput.recordingHint","点击停止,右键取消")})]}),d.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-red-500"})]}),u&&a&&d.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-yellow-500 text-white text-xs rounded-lg whitespace-nowrap shadow-lg z-50 max-w-[200px]",children:[u,d.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-yellow-500"})]}),v.showSettings&&d.jsx("span",{className:"absolute -top-1 -right-1 w-3 h-3 flex items-center justify-center",children:d.jsx(am,{className:"w-3 h-3 text-gray-400"})})]})},P6=({inputMessage:e,setInputMessage:t,selectedImages:r,isDragOver:n,isAiTyping:s,isSendDisabled:i,showToolSelector:a,setShowToolSelector:o,selectedRegularTools:l,setSelectedRegularTools:c,selectedMcpTools:u,setSelectedMcpTools:h,mcpToolsEnabled:f,setMcpToolsEnabled:g,permissionMode:p,setPermissionMode:m,selectedModel:y,setSelectedModel:x,selectedClaudeVersion:k,setSelectedClaudeVersion:v,availableModels:_,claudeVersionsData:C,isVersionLocked:w,agent:S,textareaRef:F,fileInputRef:A,envVars:T,setEnvVars:j,onSend:M,onStopGeneration:P,onKeyDown:$,onImageSelect:R,onPaste:I,onDragOver:O,onDragLeave:W,onDrop:Z,engineUICapabilities:E,onVoiceTranscribed:D,onOpenVoiceSettings:X})=>{const N=E||{showMcpToolSelector:!0,showImageUpload:!0,showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0},{t:B}=fe("components"),V=L.useCallback(H=>{D&&D(H)},[D]);return d.jsxs("div",{className:`flex-shrink-0 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 ${n?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-700":""}`,onDragOver:O,onDragLeave:W,onDrop:Z,children:[n&&d.jsx("div",{className:"absolute inset-0 bg-blue-100 dark:bg-blue-900/50 bg-opacity-75 flex items-center justify-center z-10 pointer-events-none",children:d.jsxs("div",{className:"text-blue-600 dark:text-blue-300 text-lg font-medium flex items-center space-x-2",children:[d.jsx(qs,{className:"w-6 h-6"}),d.jsx("span",{children:B("agentChat.dropImageHere")})]})}),d.jsx("div",{className:"p-4 pb-2",children:d.jsx("textarea",{ref:F,value:e,onChange:t,onKeyDown:$,onPaste:I,placeholder:r.length>0?B("agentChat.addDescription"):B("agentChat.inputPlaceholder"),rows:1,className:"w-full resize-none border border-gray-300 dark:border-gray-600 rounded-lg px-4 py-3 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:border-transparent transition-all duration-200 disabled:bg-gray-50 dark:disabled:bg-gray-700 disabled:text-gray-500 dark:disabled:text-gray-400",style:{"--focus-ring-color":"hsl(var(--primary))",minHeight:"44px",maxHeight:"120px"},disabled:s})}),d.jsx("div",{className:"px-4 pb-4 pt-2 border-t border-gray-100 dark:border-gray-700",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center space-x-1",children:[d.jsx("input",{ref:A,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",multiple:!0,onChange:R,className:"hidden"}),N.showMcpToolSelector&&d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>o(!a),className:`p-2 transition-colors rounded-lg ${a||l.length>0||f&&u.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:B("agentChat.toolSelection"),disabled:s,children:d.jsx(om,{className:"w-4 h-4"})}),(l.length>0||f&&u.length>0)&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:l.length+(f?u.filter(H=>H.startsWith("mcp__")&&H.split("__").length===3).length:0)}),d.jsx(Th,{isOpen:a,onClose:()=>o(!1),selectedRegularTools:l,onRegularToolsChange:c,selectedMcpTools:u,onMcpToolsChange:h,mcpToolsEnabled:f,onMcpEnabledChange:g,presetTools:S.allowedTools})]}),N.showImageUpload&&d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>A.current?.click(),className:`p-2 transition-colors rounded-lg ${r.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:r.length>0?B("agentChat.imageSelection")+` (${B("agentChat.selectedCount",{count:r.length})})`:B("agentChat.imageSelection"),disabled:s,children:d.jsx(qs,{className:"w-4 h-4"})}),r.length>0&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:r.length})]}),d.jsx(R6,{onTranscribed:V,disabled:s,onOpenSettings:X})]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(Z1,{permissionMode:p,onPermissionModeChange:m,selectedClaudeVersion:k,onClaudeVersionChange:H=>v(H||""),selectedModel:y,onModelChange:x,availableModels:_,claudeVersionsData:C,isVersionLocked:w,isAiTyping:s,envVars:T,onEnvVarsChange:j,engineUICapabilities:N}),s?d.jsxs("button",{onClick:P,className:"flex items-center space-x-2 px-4 py-2 text-white rounded-lg transition-colors text-sm font-medium shadow-sm",style:{backgroundColor:"rgb(239, 68, 68)"},title:B("agentChatPanel.stopGeneration"),children:[d.jsx(lm,{className:"w-4 h-4"}),d.jsx("span",{children:B("agentChatPanel.stop")})]}):d.jsxs("button",{onClick:M,disabled:i,className:"flex items-center space-x-2 px-4 py-2 text-white rounded-lg hover:opacity-90 disabled:bg-gray-300 dark:disabled:bg-gray-700 dark:disabled:text-gray-500 disabled:cursor-not-allowed transition-all duration-200 text-sm font-medium shadow-sm",style:{backgroundColor:i?void 0:"hsl(var(--primary))"},title:s?B("agentChatPanel.aiTyping"):!e.trim()&&r.length===0?B("agentChatPanel.noContentToSend"):B("agentChatPanel.sendMessage"),children:[d.jsx(vh,{className:"w-4 h-4"}),d.jsx("span",{children:B("agentChatPanel.send")})]})]})]})})]})},F6=({inputMessage:e,setInputMessage:t,selectedImages:r,isDragOver:n,isAiTyping:s,isSendDisabled:i,showToolSelector:a,setShowToolSelector:o,selectedRegularTools:l,setSelectedRegularTools:c,selectedMcpTools:u,setSelectedMcpTools:h,mcpToolsEnabled:f,setMcpToolsEnabled:g,permissionMode:p,setPermissionMode:m,selectedModel:y,setSelectedModel:x,selectedClaudeVersion:k,setSelectedClaudeVersion:v,availableModels:_,claudeVersionsData:C,isVersionLocked:w,envVars:S,onEnvVarsChange:F,agent:A,textareaRef:T,fileInputRef:j,onSend:M,onStopGeneration:P,onKeyDown:$,onImageSelect:R,onPaste:I,onDragOver:O,onDragLeave:W,onDrop:Z})=>{const{t:E}=fe("components");return d.jsxs("div",{className:`flex-shrink-0 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 ${n?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-700":""}`,onDragOver:O,onDragLeave:W,onDrop:Z,children:[r.length>0&&d.jsx("div",{className:"p-3 pb-2 border-b border-gray-100 dark:border-gray-700",children:d.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(D=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:D.preview,alt:E("agentChat.imagePreview"),className:"w-12 h-12 object-cover rounded-lg border border-gray-200 dark:border-gray-600 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>{}}),d.jsx("button",{onClick:()=>{},className:"absolute -top-1 -right-1 w-4 h-4 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity text-xs hover:bg-red-600",title:E("agentChat.deleteImage"),children:"×"})]},D.id))})}),n&&d.jsx("div",{className:"absolute inset-0 bg-blue-100 dark:bg-blue-900/50 bg-opacity-75 flex items-center justify-center z-10 pointer-events-none",children:d.jsxs("div",{className:"text-blue-600 dark:text-blue-300 text-sm font-medium flex items-center space-x-2",children:[d.jsx(qs,{className:"w-5 h-5"}),d.jsx("span",{children:E("agentChat.dropImageHere")})]})}),d.jsxs("div",{className:"p-3",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("div",{className:"flex space-x-2",children:[d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>o(!a),className:`p-2 transition-colors rounded-lg ${l.length>0||f&&u.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:l.length>0||f&&u.length>0?E("agentChat.toolSelection")+` (${E("agentChat.selectedCount",{count:l.length+(f?u.length:0)})})`:E("agentChat.toolSelection"),disabled:s,children:d.jsx(om,{className:"w-4 h-4"})}),(l.length>0||f&&u.length>0)&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:l.length+(f?u.filter(D=>D.startsWith("mcp__")&&D.split("__").length===3).length:0)}),d.jsx(Th,{isOpen:a,onClose:()=>o(!1),selectedRegularTools:l,onRegularToolsChange:c,selectedMcpTools:u,onMcpToolsChange:h,mcpToolsEnabled:f,onMcpEnabledChange:g,presetTools:A.allowedTools})]}),d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>j.current?.click(),className:`p-2 transition-colors rounded-lg ${r.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:r.length>0?E("agentChat.imageSelection")+` (${r.length})`:E("agentChat.imageSelection"),disabled:s,children:d.jsx(qs,{className:"w-4 h-4"})}),r.length>0&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:r.length})]})]}),d.jsx(Z1,{permissionMode:p,onPermissionModeChange:m,selectedClaudeVersion:k,onClaudeVersionChange:D=>v(D||""),selectedModel:y,onModelChange:x,availableModels:_,claudeVersionsData:C,isVersionLocked:w,isAiTyping:s,envVars:S,onEnvVarsChange:F})]}),d.jsxs("div",{className:"flex items-end space-x-2",children:[d.jsx("div",{className:"flex-1 relative",children:d.jsx("textarea",{ref:T,value:e,onChange:t,onKeyDown:$,onPaste:I,placeholder:E("agentChat.inputPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none text-sm",rows:e.split(`
|
|
426
|
-
`).length,style:{minHeight:"40px",maxHeight:"120px"},disabled:s})}),s?d.jsx("button",{onClick:P,className:"px-3 py-2 rounded-lg font-medium transition-all duration-200 bg-red-600 dark:bg-red-500 text-white hover:bg-red-700 dark:hover:bg-red-600 shadow-sm",title:E("agentChat.stop"),children:d.jsx(lm,{className:"w-4 h-4"})}):d.jsx("button",{onClick:M,disabled:i,className:`px-3 py-2 rounded-lg font-medium transition-all duration-200 ${i?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 dark:bg-blue-500 text-white hover:bg-blue-700 dark:hover:bg-blue-600 shadow-sm"}`,title:E("agentChat.send"),children:d.jsx(vh,{className:"w-4 h-4"})})]})]}),d.jsx("input",{ref:j,type:"file",accept:"image/*",multiple:!0,onChange:R,style:{display:"none"}})]})},O6=e=>[{id:"init",name:"init",description:e("commandSelector.systemCommands.init.description"),content:"/init",scope:"system",isSystem:!0},{id:"clear",name:"clear",description:e("commandSelector.systemCommands.clear.description"),content:"/clear",scope:"system",isSystem:!0},{id:"compact",name:"compact",description:e("commandSelector.systemCommands.compact.description"),content:"/compact",scope:"system",isSystem:!0},{id:"agents",name:"agents",description:e("commandSelector.systemCommands.agents.description"),content:"/agents",scope:"system",isSystem:!0},{id:"settings",name:"settings",description:e("commandSelector.systemCommands.settings.description"),content:"/settings",scope:"system",isSystem:!0},{id:"help",name:"help",description:e("commandSelector.systemCommands.help.description"),content:"/help",scope:"system",isSystem:!0}],z6=({isOpen:e,onSelect:t,onClose:r,searchTerm:n,position:s,projectId:i,selectedIndex:a=0,onSelectedIndexChange:o})=>{const{t:l}=fe("components"),c=L.useRef(null);L.useEffect(()=>{const S=F=>{c.current&&!c.current.contains(F.target)&&r?.()};if(e)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[e,r]);const{data:u}=Qc({scope:"user",search:n}),{data:h}=Zc({projectId:i||"",search:n}),f=u?.commands||[],g=h?.commands||[],y=[...O6(l).filter(S=>S.name.toLowerCase().includes(n.toLowerCase())||S.description.toLowerCase().includes(n.toLowerCase())),...g,...f];if(L.useEffect(()=>{y.length>0&&a>=y.length&&o?.(0)},[y.length,a,o]),L.useEffect(()=>{if(e&&c.current){const S=c.current.querySelector(`[data-index="${a}"]`);S&&S.scrollIntoView({block:"nearest",behavior:"smooth"})}},[a,e]),!e||y.length===0)return null;const x=65,k=20,v=4,_=s.top-k-v,C=y.length*x,w=Math.min(C,_);return d.jsx("div",{ref:c,className:"fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg min-w-72 max-w-96 overflow-hidden",style:{bottom:window.innerHeight-s.top+v,left:s.left,maxHeight:`${w}px`},children:d.jsx("div",{className:"overflow-y-auto",style:{maxHeight:`${w}px`},children:y.map((S,F)=>{const A="isSystem"in S,T=F===a,j=()=>A?S.name:S.namespace?`${S.namespace}:${S.name}`:S.name;return d.jsx("div",{"data-index":F,className:`px-4 py-3 cursor-pointer flex items-center border-b border-gray-100 dark:border-gray-700 last:border-b-0 ${T?"bg-blue-50 dark:bg-blue-900/30 border-blue-200 dark:border-blue-700":"hover:bg-gray-50 dark:hover:bg-gray-700"}`,onClick:()=>t(S),onMouseEnter:()=>o?.(F),children:d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:`text-sm font-medium truncate ${T?"text-blue-900 dark:text-blue-300":"text-gray-900 dark:text-gray-100"}`,children:j()}),S.description&&d.jsx("div",{className:`text-xs truncate ${T?"text-blue-700 dark:text-blue-400":"text-gray-500 dark:text-gray-400"}`,children:S.description})]})},S.id)})})})},Fp=({showCommandSelector:e,showFileBrowser:t,commandSearch:r,selectedCommandIndex:n,atSymbolPosition:s,projectPath:i,textareaRef:a,inputMessage:o,onCommandSelect:l,onSetInputMessage:c,onSetShowCommandSelector:u,onSetSelectedCommandIndex:h,onSetShowFileBrowser:f,onSetAtSymbolPosition:g})=>{const{t:p}=fe("components"),m=_=>{l(_),c(`/${_.name}`),u(!1),a.current&&a.current.focus()},y=()=>{u(!1)},x=(_,C)=>{if(!a.current||s===null)return;let w=_.replace(/\\/g,"/");if(i){const T=i.replace(/\\/g,"/"),j=T.endsWith("/")?T.slice(0,-1):T;w.startsWith(j)&&(w=w.substring(j.length+1))}const S=o.substring(0,s),F=o.substring(s+1),A=S+"@"+w+" "+F;c(A),f(!1),g(null),setTimeout(()=>{if(a.current){const T=s+1+w.length+1;a.current.setSelectionRange(T,T),a.current.focus()}},0)},k=()=>{f(!1),g(null),setTimeout(()=>{a.current?.focus()},0)},v=()=>{if(!a.current)return{top:0,left:0};const _=a.current.getBoundingClientRect();return{top:_.top,left:_.left}};return d.jsxs(d.Fragment,{children:[d.jsx(z6,{isOpen:e,onSelect:m,onClose:y,searchTerm:r,position:v(),projectId:i,selectedIndex:n,onSelectedIndexChange:h}),t&&d.jsx(Mv,{title:p("agentChat.fileBrowser.title",{projectPath:i?i.split("/").pop():p("agentChat.fileBrowser.currentProject")}),initialPath:i,allowFiles:!0,allowDirectories:!1,restrictToProject:!0,onSelect:x,onClose:k})]})},J1=e=>t=>{if(t.key==="Escape"&&e.showFileBrowser){t.preventDefault(),e.onSetShowFileBrowser(!1),e.onSetAtSymbolPosition(null);return}if(t.key==="Enter"&&!t.shiftKey&&e.showCommandSelector&&e.allCommands.length>0){t.preventDefault();const r=e.allCommands[e.selectedCommandIndex];r&&(e.onCommandSelect(r),e.onSetInputMessage(`/${r.name}`),e.onSetShowCommandSelector(!1),setTimeout(()=>{e.textareaRef.current?.focus()},0));return}if(e.showCommandSelector&&e.allCommands.length>0){if(t.key==="ArrowUp"||t.ctrlKey&&t.key==="p"){t.preventDefault(),e.onSetSelectedCommandIndex(e.selectedCommandIndex>0?e.selectedCommandIndex-1:e.allCommands.length-1);return}if(t.key==="ArrowDown"||t.ctrlKey&&t.key==="n"){t.preventDefault(),e.onSetSelectedCommandIndex(e.selectedCommandIndex<e.allCommands.length-1?e.selectedCommandIndex+1:0);return}if(t.key==="Escape"){t.preventDefault(),e.onSetShowCommandSelector(!1);return}}e.onHandleKeyDown(t)},Op=({isOpen:e,message:t,onConfirm:r,onCancel:n,confirmText:s="确认",cancelText:i="取消"})=>e?d.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[d.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50",onClick:n}),d.jsxs("div",{className:"relative bg-white rounded-lg shadow-lg max-w-md w-full mx-4 p-6",children:[d.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors",children:d.jsx(es,{size:20})}),d.jsxs("div",{className:"pr-8",children:[d.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"命令确认"}),d.jsx("p",{className:"text-gray-700 whitespace-pre-line mb-6",children:t})]}),d.jsxs("div",{className:"flex justify-end space-x-3",children:[d.jsx("button",{onClick:n,className:"px-4 py-2 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg transition-colors",children:i}),d.jsx("button",{onClick:r,className:"px-4 py-2 text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors",children:s})]})]})]}):null,zp=({isOpen:e,onClose:t,mcpStatus:r})=>{const[n,s]=L.useState(new Set),[i,a]=L.useState(null);if(!e)return null;const o=h=>h?new Date(h).toLocaleString():"未知",l=(r.connectedServers?.length||0)>0||(r.connectionErrors?.length||0)>0,c=h=>{const f=new Set(n);f.has(h)?f.delete(h):f.add(h),s(f)},u=async(h,f)=>{try{await navigator.clipboard.writeText(h),a(f),setTimeout(()=>a(null),2e3)}catch(g){console.error("Failed to copy error text:",g)}};return d.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:d.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[r.hasError?d.jsx(Qd,{className:"w-5 h-5 text-red-500"}):d.jsx(_n,{className:"w-5 h-5 text-green-500"}),d.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"MCP 工具状态"})]}),d.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:d.jsx(es,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-4 space-y-4 max-h-[calc(90vh-120px)] overflow-y-auto",children:[d.jsx("div",{className:`p-3 rounded-lg ${r.hasError?"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800"}`,children:d.jsxs("div",{className:"flex items-center space-x-2",children:[r.hasError?d.jsx(Sv,{className:"w-4 h-4 text-red-500"}):d.jsx(Zd,{className:"w-4 h-4 text-green-500"}),d.jsx("span",{className:`font-medium ${r.hasError?"text-red-700 dark:text-red-300":"text-green-700 dark:text-green-300"}`,children:r.hasError?"MCP 工具存在问题":"MCP 工具运行正常"})]})}),r.lastUpdated&&d.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[d.jsx(tn,{className:"w-4 h-4"}),d.jsxs("span",{children:["最后更新: ",o(r.lastUpdated)]})]}),r.connectedServers&&r.connectedServers.length>0&&d.jsxs("div",{children:[d.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:["✅ 已连接的服务器 (",r.connectedServers.length,")"]}),d.jsx("div",{className:"space-y-2",children:r.connectedServers.map((h,f)=>d.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-green-50 dark:bg-green-900/20 rounded border border-green-200 dark:border-green-800",children:[d.jsx(_n,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-green-700 dark:text-green-300 font-medium",children:h.name}),d.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400",children:["(",h.status,")"]})]},f))})]}),r.connectionErrors&&r.connectionErrors.length>0&&d.jsxs("div",{children:[d.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:["❌ 连接失败的服务器 (",r.connectionErrors.length,")"]}),d.jsx("div",{className:"space-y-2",children:r.connectionErrors.map((h,f)=>{const g=n.has(f),p=h.error&&h.error.length>50,m=i===f;return d.jsxs("div",{className:"p-2 bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[d.jsx(Qd,{className:"w-4 h-4 text-red-500 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-red-700 dark:text-red-300 font-medium",children:h.name}),d.jsxs("span",{className:"text-xs text-red-600 dark:text-red-400",children:["(",h.status,")"]}),p&&d.jsx("button",{onClick:()=>c(f),className:"ml-auto p-1 hover:bg-red-100 dark:hover:bg-red-800/30 rounded",title:g?"收起详细错误":"展开详细错误",children:g?d.jsx(Tt,{className:"w-3 h-3 text-red-500"}):d.jsx(Ht,{className:"w-3 h-3 text-red-500"})})]}),h.error&&d.jsx("div",{className:"ml-6",children:p?d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-1",children:g?h.error:`${h.error.substring(0,50)}...`}),g&&d.jsx("div",{className:"flex items-center justify-between mt-2",children:d.jsxs("button",{onClick:()=>u(h.error,f),className:"flex items-center space-x-1 px-2 py-1 text-xs bg-red-100 dark:bg-red-800/30 hover:bg-red-200 dark:hover:bg-red-800/50 rounded transition-colors",title:"复制错误信息",children:[d.jsx(Xc,{className:"w-3 h-3"}),d.jsx("span",{children:m?"已复制":"复制错误"})]})})]}):d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:h.error})})]},f)})})]}),r.lastError&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("h4",{className:"font-medium text-gray-900 dark:text-white",children:"🚨 最近的错误"}),d.jsxs("button",{onClick:()=>u(`${r.lastError}${r.lastErrorDetails?`
|
|
427
|
-
详情: `+r.lastErrorDetails:""}`,-1),className:"flex items-center space-x-1 px-2 py-1 text-xs bg-red-100 dark:bg-red-800/30 hover:bg-red-200 dark:hover:bg-red-800/50 rounded transition-colors",title:"复制错误信息",children:[d.jsx(Xc,{className:"w-3 h-3"}),d.jsx("span",{children:i===-1?"已复制":"复制"})]})]}),d.jsxs("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[d.jsx("p",{className:"text-sm text-red-700 dark:text-red-300 mb-1 font-mono",children:r.lastError}),r.lastErrorDetails&&d.jsx("div",{className:"mt-2 pt-2 border-t border-red-200 dark:border-red-700",children:d.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 font-mono whitespace-pre-wrap",children:[d.jsx("span",{className:"font-semibold",children:"详情:"}),d.jsx("br",{}),r.lastErrorDetails]})})]})]}),!l&&d.jsxs("div",{className:"text-center py-8",children:[d.jsx(Zd,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"暂无 MCP 服务器信息"}),d.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"当使用 MCP 工具时,状态信息将显示在这里"})]})]}),d.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-750",children:d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"MCP (Model Context Protocol) 工具允许 AI 与外部系统交互。 如果遇到连接问题,请检查 MCP 服务器配置。"})})]})})},ev=e=>{const{t}=fe("components"),{inputMessage:r,selectedImages:n,isAiTyping:s,isMobile:i,showToolSelector:a,selectedRegularTools:o,selectedMcpTools:l,mcpToolsEnabled:c,showCommandSelector:u,showFileBrowser:h,commandSearch:f,selectedCommand:g,selectedCommandIndex:p,atSymbolPosition:m,commandWarning:y,permissionMode:x,selectedModel:k,selectedClaudeVersion:v,showMobileSettings:_,isVersionLocked:C,isDragOver:w,previewImage:S,showConfirmDialog:F,confirmMessage:A,showMcpStatusModal:T,availableModels:j,claudeVersionsData:M,agent:P,projectPath:$,mcpStatus:R,textareaRef:I,fileInputRef:O,onSend:W,handleKeyDown:Z,handleImageSelect:E,handleImageRemove:D,handleImagePreview:X,handlePaste:N,handleDragOver:B,handleDragLeave:V,handleDrop:H,handleStopGeneration:q,onSetInputMessage:Y,onSetShowToolSelector:J,onSetSelectedRegularTools:re,onSetSelectedMcpTools:we,onSetMcpToolsEnabled:Ne,onSetPermissionMode:Ce,onSetSelectedModel:Le,onSetSelectedClaudeVersion:Xe,onSetShowMobileSettings:ct,onSetPreviewImage:Ze,onSetShowMcpStatusModal:vt,onCommandSelect:Nt,onSetShowCommandSelector:We,onSetSelectedCommandIndex:Rt,onSetShowFileBrowser:ut,onSetAtSymbolPosition:Vt,onSetCommandWarning:Et,onSetCommandSearch:je,handleConfirmDialog:G,handleCancelDialog:Q,isSendDisabled:se,envVars:be,onSetEnvVars:ie,engineUICapabilities:Ge,onVoiceTranscribed:nt,onOpenVoiceSettings:st}=e,xt=Ge||{showMcpToolSelector:!0,showImageUpload:!0,showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0},tt=L.useCallback(Se=>{const Ie=Se.target.value;if(Y(Ie),y&&Et(null),Ie.length>0&&Ie[Ie.length-1]==="@"){const Ee=Ie.substring(0,Ie.length-1);if(Ee.length===0||/\s$/.test(Ee)){Vt(Ie.length-1),ut(!0),I.current?.blur();return}}if(Wi(Ie)){const Ee=Fv(Ie);Ee!==f&&(je(Ee),Rt(0)),u||We(!0)}else u&&(We(!1),Rt(0))},[y,f,u,Y,Vt,ut,We,Et,Rt,je,I]);return i?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 p-3 space-y-3",children:[y&&d.jsxs("div",{className:"bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg p-2 flex items-start space-x-2",children:[d.jsx("div",{className:"flex-shrink-0",children:d.jsx("svg",{className:"w-4 h-4 text-red-600 dark:text-red-400 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:d.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),d.jsx("div",{className:"flex-1",children:d.jsx("p",{className:"text-xs text-red-800 dark:text-red-300",children:y})})]}),d.jsx(F6,{inputMessage:r,setInputMessage:tt,selectedImages:n,isDragOver:w,isAiTyping:s,isSendDisabled:se(),showToolSelector:a,setShowToolSelector:J,selectedRegularTools:o,setSelectedRegularTools:re,selectedMcpTools:l,setSelectedMcpTools:we,mcpToolsEnabled:c,setMcpToolsEnabled:Ne,permissionMode:x,setPermissionMode:Ce,selectedModel:k,setSelectedModel:Le,selectedClaudeVersion:v,setSelectedClaudeVersion:Xe,availableModels:j,claudeVersionsData:M,isVersionLocked:C,agent:P,textareaRef:I,fileInputRef:O,onSend:W,onStopGeneration:q,onKeyDown:Z,onImageSelect:E,onPaste:N,onDragOver:B,onDragLeave:V,onDrop:H,envVars:be,onEnvVarsChange:ie}),d.jsx(Th,{isOpen:a,onClose:()=>J(!1),selectedRegularTools:o,onRegularToolsChange:re,selectedMcpTools:l,onMcpToolsChange:we,mcpToolsEnabled:c,onMcpEnabledChange:Ne,presetTools:P.allowedTools})]}),_&&d.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:d.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 m-4 max-w-sm w-full",children:[d.jsxs("div",{className:"flex justify-between items-center mb-4",children:[d.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("agentChat.settings")}),d.jsx("button",{onClick:()=>ct(!1),className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:d.jsx(es,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t("agentChat.permissionMode")}),d.jsxs("select",{value:x,onChange:Se=>Ce(Se.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[d.jsx("option",{value:"default",children:t("agentChat.default")}),d.jsx("option",{value:"acceptEdits",children:t("agentChat.acceptEdits")}),d.jsx("option",{value:"bypassPermissions",children:t("agentChat.bypassPermissions")})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t("agentChat.model")}),d.jsx("select",{value:k,onChange:Se=>Le(Se.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:j.map(Se=>d.jsx("option",{value:Se.id,children:Se.name},Se.id))})]}),!C&&d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t("agentChat.version")}),d.jsx("select",{value:v,onChange:Se=>Xe(Se.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:M?.availableVersions?.map(Se=>d.jsx("option",{value:Se.id,children:Se.name},Se.id))})]})]})]})}),d.jsx(Fp,{showCommandSelector:u,showFileBrowser:h,commandSearch:f,selectedCommand:g,selectedCommandIndex:p,atSymbolPosition:m,projectPath:$,textareaRef:I,inputMessage:r,onCommandSelect:Nt,onSetInputMessage:Y,onSetShowCommandSelector:We,onSetSelectedCommandIndex:Rt,onSetShowFileBrowser:ut,onSetAtSymbolPosition:Vt}),d.jsx(Op,{isOpen:F,message:A,onConfirm:G,onCancel:Q}),d.jsx(ll,{images:S?[S]:[],onClose:()=>Ze(null)}),d.jsx(zp,{isOpen:T,onClose:()=>vt(!1),mcpStatus:R})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`flex-shrink-0 border-t border-gray-200 dark:border-gray-700 ${w?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-700":""}`,onDragOver:B,onDragLeave:V,onDrop:H,children:[n.length>0&&d.jsx("div",{className:"p-4 pb-2 border-b border-gray-100 dark:border-gray-700",children:d.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(Se=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:Se.preview,alt:t("agentChat.imagePreview"),className:"w-16 h-16 object-cover rounded-lg border border-gray-200 dark:border-gray-600 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>X(Se.preview)}),d.jsx("button",{onClick:()=>D(Se.id),className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity text-xs hover:bg-red-600",title:t("agentChat.deleteImage"),children:d.jsx(es,{className:"w-3 h-3"})})]},Se.id))})}),w&&d.jsx("div",{className:"absolute inset-0 bg-blue-100 dark:bg-blue-900/50 bg-opacity-75 flex items-center justify-center z-10 pointer-events-none",children:d.jsxs("div",{className:"text-blue-600 dark:text-blue-300 text-lg font-medium flex items-center space-x-2",children:[d.jsx(qs,{className:"w-6 h-6"}),d.jsx("span",{children:t("agentChat.dropImageHere")})]})}),y&&d.jsx("div",{className:"px-4 pt-3 pb-2",children:d.jsxs("div",{className:"bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg p-3 flex items-start space-x-2",children:[d.jsx("div",{className:"flex-shrink-0",children:d.jsx("svg",{className:"w-5 h-5 text-red-600 dark:text-red-400 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:d.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),d.jsx("div",{className:"flex-1",children:d.jsx("p",{className:"text-sm text-red-800 dark:text-red-300",children:y})})]})}),d.jsx(P6,{inputMessage:r,setInputMessage:tt,selectedImages:n,isDragOver:w,isAiTyping:s,isSendDisabled:se(),showToolSelector:a,setShowToolSelector:J,selectedRegularTools:o,setSelectedRegularTools:re,selectedMcpTools:l,setSelectedMcpTools:we,mcpToolsEnabled:c,setMcpToolsEnabled:Ne,permissionMode:x,setPermissionMode:Ce,selectedModel:k,setSelectedModel:Le,selectedClaudeVersion:v,setSelectedClaudeVersion:Xe,availableModels:j,claudeVersionsData:M,isVersionLocked:C,agent:P,textareaRef:I,fileInputRef:O,onSend:W,onStopGeneration:q,onKeyDown:Z,onImageSelect:E,onPaste:N,onDragOver:B,onDragLeave:V,onDrop:H,envVars:be,setEnvVars:ie,engineUICapabilities:xt,onVoiceTranscribed:nt,onOpenVoiceSettings:st})]}),d.jsx(Fp,{showCommandSelector:u,showFileBrowser:h,commandSearch:f,selectedCommand:g,selectedCommandIndex:p,atSymbolPosition:m,projectPath:$,textareaRef:I,inputMessage:r,onCommandSelect:Nt,onSetInputMessage:Y,onSetShowCommandSelector:We,onSetSelectedCommandIndex:Rt,onSetShowFileBrowser:ut,onSetAtSymbolPosition:Vt}),d.jsx(Op,{isOpen:F,message:A,onConfirm:G,onCancel:Q}),d.jsx(ll,{images:S?[S]:[],onClose:()=>Ze(null)}),d.jsx(zp,{isOpen:T,onClose:()=>vt(!1),mcpStatus:R})]})},W6={"cursor-cli":"cursor","claude-sdk":"claude"},tv=({disabled:e=!1})=>{const{engineType:t}=Sh(),{selectedEngine:r,setSelectedEngine:n,setEngineUICapabilities:s,setEngineModels:i}=ze();L.useEffect(()=>{if(t){const o=W6[t]||"claude";r!==o&&(console.log(`[EngineSync] Syncing engine from ${r} to ${o}`),n(o))}},[t,r,n]);const a=L.useCallback(async o=>{try{const l=await $v(o);l?(l.capabilities?.ui?s(l.capabilities.ui):s(zi(o)),l.models&&l.models.length>0&&(i(l.models),console.log(`[EngineSync] Loaded ${l.models.length} models for ${o}`))):s(zi(o))}catch(l){console.warn("[EngineSync] Failed to load engine info:",l),s(zi(o))}},[s,i]);return L.useEffect(()=>{a(r)},[r,a]),null},H6=({agent:e,projectPath:t,onSessionChange:r,initialMessage:n})=>{const{t:s}=fe("components"),{isCompactMode:i}=dm(),{isMobile:a}=_h(),o=L.useRef(null),l=L.useRef(null),c=L.useRef(null),u=L.useRef(null),h=L.useRef(null),[f,g]=L.useState(""),[p,m]=L.useState(!1),[y,x]=L.useState(void 0),[k,v]=L.useState(void 0),{messages:_,isAiTyping:C,currentSessionId:w,mcpStatus:S,pendingUserQuestion:F,selectedEngine:A,addMessage:T,interruptAllExecutingTools:j,setAiTyping:M,loadSessionMessages:P,setPendingUserQuestion:$}=ze(),R=L.useRef(!1);L.useEffect(()=>{n&&!p&&(g(n),m(!0),R.current=!0)},[n,p]);const I=wm(),{showSessions:O,showConfirmDialog:W,showMobileSettings:Z,showMcpStatusModal:E,confirmMessage:D,searchTerm:X,isStopping:N,isInitializingSession:B,setShowSessions:V,setShowConfirmDialog:H,setShowMobileSettings:q,setShowMcpStatusModal:Y,setConfirmMessage:J,setConfirmAction:re,setSearchTerm:we,setIsStopping:Ne,setIsInitializingSession:Ce,handleConfirmDialog:Le,handleCancelDialog:Xe}=I,ct=km({agentId:e.id,currentSessionId:w,onSessionChange:r,textareaRef:c}),{isLoadingMessages:Ze,isNewSession:vt,hasSuccessfulResponse:Nt,setIsLoadingMessages:We,setIsNewSession:Rt,setHasSuccessfulResponse:ut,setCurrentSessionId:Vt,handleSwitchSession:Et,handleNewSession:je,handleRefreshMessages:G}=ct,{selectedImages:Q,previewImage:se,isDragOver:be,handleImageSelect:ie,handleImageRemove:Ge,handleImagePreview:nt,handlePaste:st,handleDragOver:xt,handleDragLeave:tt,handleDrop:Se,clearImages:Ie,setPreviewImage:Ee}=gm({textareaRef:c,inputMessage:f,setInputMessage:g}),Gt=pm({messagesContainerRef:o,messagesEndRef:l,messages:_,isAiTyping:C}),un=mm({projectPath:t,textareaRef:c}),hn=xm({agent:e}),ci=ym({initialModel:k||"sonnet",initialVersion:y}),{commandSearch:jr,selectedCommand:Bn,selectedCommandIndex:ms,commandWarning:lt,showCommandSelector:br,showFileBrowser:xs,atSymbolPosition:dn,allCommands:ur,SYSTEM_COMMANDS:fn,userCommands:ys,projectCommands:bs,userCommandsError:Ct,projectCommandsError:Yt,setSelectedCommand:ks,setSelectedCommandIndex:gn,setCommandWarning:Ir,setShowCommandSelector:pn,setShowFileBrowser:Xt,setAtSymbolPosition:Rn,setCommandSearch:ws,handleCommandSelect:mn,isCommandDefined:xn,getAllAvailableCommands:yn}=un,{selectedModel:le,selectedClaudeVersion:z,isVersionLocked:ee,claudeVersionsData:oe,availableModels:Ye,setSelectedModel:it,setSelectedClaudeVersion:Ke,setIsVersionLocked:ht}=ci;L.useEffect(()=>{t&&(async()=>{try{const Je=await gr(`${ar}/projects/${encodeURIComponent(t)}`);if(Je.ok){const dt=await Je.json();console.log("🔧 Project settings loaded:",dt.project),dt.project.defaultProviderId&&(console.log("🔧 Setting provider to:",dt.project.defaultProviderId),x(dt.project.defaultProviderId),Ke(dt.project.defaultProviderId)),dt.project.defaultModel&&(console.log("🔧 Setting model to:",dt.project.defaultModel),v(dt.project.defaultModel),it(dt.project.defaultModel))}}catch(Je){console.error("Failed to fetch project settings:",Je)}})()},[t,Ke,it]);const{showToolSelector:Kt,selectedRegularTools:hr,selectedMcpTools:Gr,mcpToolsEnabled:ot,permissionMode:Pn,showPermissionDropdown:vs,showModelDropdown:Vl,showVersionDropdown:Gl,setShowToolSelector:Yl,setSelectedRegularTools:Xl,setSelectedMcpTools:Kl,setMcpToolsEnabled:Ql,setPermissionMode:Zl,setShowPermissionDropdown:Ea,setShowModelDropdown:Aa,setShowVersionDropdown:ui,envVars:Ma,setEnvVars:Jl}=hn,{isUserScrolling:bn,newMessagesCount:kn,scrollToBottom:ja,setNewMessagesCount:ec,setIsUserScrolling:tc}=Gt,[Yr,Fn]=L.useState("默认服务");L.useEffect(()=>{const me=qp(),Je=Up(me);Je&&Fn(Je.name)},[]);const On=Vp(),{data:Ia,refetch:La}=Gp(e.id,X,t,A),{data:kr}=Yp(e.id,w,t,A),{data:$a}=Xp();L.useEffect(()=>{O&&(console.log("📋 [Sessions] Dropdown opened, refreshing sessions list..."),La())},[O,La]),hm({agentId:e.id,sessionId:w,projectPath:t,enabled:!!w,isNewSession:vt,hasSuccessfulResponse:Nt}),L.useEffect(()=>Fr.startSmartMonitoring(),[]),L.useEffect(()=>{if(w&&e.id)return console.log(`🎯 Setting up wakeup listener for session: ${w}`),Fr.setupWakeupListener(e.id,w)},[w,e.id]);const hi=Ct||Yt;L.useEffect(()=>{gn(me=>ur.length>0&&me>=ur.length?0:me)},[ur.length]);const rc=me=>{Et(me),V(!1)},nc=()=>{je(),V(!1),we("")},Da=async()=>{if(!(!h.current||!w))try{Ne(!0),console.log("🛑 Stopping generation for session:",w);try{await On.mutateAsync(w),console.log("✅ Successfully interrupted session via API")}catch(me){console.error("❌ Failed to interrupt session:",me);const Je=me instanceof Error?me.message:"Unknown error";T({content:`${s("agentChat.stopFailed")}
|
|
428
|
-
|
|
429
|
-
${Je}`,role:"assistant"}),Ne(!1);return}j(),h.current.abort(),h.current=null,M(!1),Ne(!1),Ce(!1),T({content:s("agentChat.generationStopped"),role:"assistant"})}catch(me){console.error("Error stopping generation:",me),Ne(!1),Ce(!1)}},di=L.useCallback(me=>{me&&(g(Je=>Je.trim()?Je+" "+me:me),c.current?.focus())},[]),fi=L.useCallback(()=>{window.open("/settings/voice","_blank")},[]),{isSendDisabled:gi,handleSendMessage:Cs}=bm({agent:e,projectPath:t,inputMessage:f,selectedImages:Q,isAiTyping:C,currentSessionId:w,hasCommandsLoadError:!!hi,userCommandsError:Ct||void 0,projectCommandsError:Yt||void 0,SYSTEM_COMMANDS:fn,userCommands:ys,projectCommands:bs,selectedCommand:Bn,selectedRegularTools:hr,selectedMcpTools:Gr,mcpToolsEnabled:ot,permissionMode:Pn,selectedModel:le,selectedClaudeVersion:z,abortControllerRef:h,onSessionChange:r,setInputMessage:g,clearImages:Ie,setSelectedCommand:ks,setShowCommandSelector:pn,setCommandWarning:Ir,setIsInitializingSession:Ce,setCurrentSessionId:Vt,setIsNewSession:Rt,setAiTyping:M,setHasSuccessfulResponse:ut,setConfirmMessage:J,setConfirmAction:re,setShowConfirmDialog:H,handleNewSession:je,isCommandDefined:xn,getAllAvailableCommands:yn,envVars:Ma});L.useEffect(()=>{if(!R.current||!f)return;const me=()=>!gi()&&!C?(R.current=!1,Cs(),!0):!1;if(me())return;const Je=setTimeout(()=>{R.current&&me()},500);return()=>clearTimeout(Je)},[f,gi,C,Cs]);const Ba=async(me,Je)=>{console.log("🎤 [AskUserQuestion] Submitting response for tool:",me);try{const dt=await gr(`${ar}/agents/user-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toolUseId:me,response:Je,sessionId:w,agentId:e.id})});if(!dt.ok){const ac=await dt.json().catch(()=>({}));throw new Error(ac.error||`HTTP ${dt.status}`)}console.log("✅ [AskUserQuestion] Response submitted successfully"),$(null)}catch(dt){console.error("🎤 [AskUserQuestion] Submit failed:",dt)}},sc=J1({showCommandSelector:br,showFileBrowser:xs,commandSearch:jr,selectedCommand:Bn,selectedCommandIndex:ms,atSymbolPosition:dn,projectPath:t,textareaRef:c,inputMessage:f,allCommands:ur,onCommandSelect:mn,onSetInputMessage:g,onSetShowCommandSelector:pn,onSetSelectedCommandIndex:gn,onSetShowFileBrowser:Xt,onSetAtSymbolPosition:Rn,onHandleKeyDown:me=>{if(me.key==="Enter"&&!me.shiftKey){if(me.preventDefault(),Wi(f)){const Je=f.slice(1).split(" ")[0].toLowerCase();if(!xn(Je)){Ir(hi?s("agentChat.commandsLoadErrorWarning",{command:Je,commands:fn.map(dt=>dt.content).join(", "),errorMessage:Ct?.message||Yt?.message||"Unknown error"}):s("agentChat.unknownCommandWarning",{command:Je,commands:yn()}));return}}Cs();return}}}),ic=()=>{const me=c.current;me&&(me.style.height="auto",me.style.height=Math.min(me.scrollHeight,100)+"px")};return L.useEffect(()=>{ic()},[f]),L.useEffect(()=>{console.log("🔍 Session messages effect triggered:",{sessionMessagesData:kr?.messages?.length||0,currentSessionId:w,hasSessionMessagesData:!!kr,messagesLength:kr?.messages?.length,isLoadingMessages:Ze}),kr?.messages&&w?(console.log("✅ Loading session messages:",kr.messages.length),P(kr.messages),Ze&&setTimeout(()=>{We(!1)},100)):w&&kr&&kr.messages?.length===0&&(console.log("🗑️ Loading empty session messages"),P([]),Ze&&setTimeout(()=>{We(!1)},100))},[kr,w,P,Ze,s]),L.useEffect(()=>{const me=Je=>{Je.target.closest(".dropdown-container")||(Ea(!1),Aa(!1),ui(!1))};return document.addEventListener("mousedown",me),()=>document.removeEventListener("mousedown",me)},[]),L.useEffect(()=>{if(!w||!$a?.sessions){ht(!1);return}const me=$a.sessions.find(Je=>Je.sessionId===w);me?(console.log(`🔒 Found active session: ${w}, version: ${me.claudeVersionId}, model: ${me.modelId}`),me.claudeVersionId?(z!==me.claudeVersionId&&(console.log(`🔄 Changing Claude version from ${z} to ${me.claudeVersionId}`),Ke(me.claudeVersionId)),me.modelId&&le!==me.modelId&&(console.log(`🔄 Restoring model from ${le} to ${me.modelId}`),it(me.modelId)),ht(!0),console.log(`🔒 Locked to Claude version: ${me.claudeVersionId}, model: ${me.modelId}`)):(ht(!1),console.log("🔓 Session has no specific version, unlocked but keeping user selection"))):(ht(!1),console.log(`🔓 Session ${w} not in active sessions, unlocked but keeping user selection`))},[w,$a,z,le,it]),d.jsxs("div",{className:"flex flex-col h-full bg-white dark:bg-gray-900",children:[d.jsx("div",{className:"flex-shrink-0 h-12 px-4 border-b border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 flex items-center",children:d.jsxs("div",{className:"flex items-center justify-between w-full",children:[d.jsx("div",{className:"flex-1 min-w-0",children:d.jsxs("h1",{className:"text-base font-semibold flex items-center space-x-2 text-gray-900 dark:text-white",children:[d.jsx("span",{className:"text-lg flex-shrink-0",children:e.ui.icon}),d.jsxs("span",{className:"truncate",children:["[",Yr,"]"]}),t&&d.jsx("span",{className:"text-sm opacity-75 font-normal truncate flex-shrink-0",title:t,children:t.split("/").pop()||t}),w&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm opacity-75",children:"-"}),d.jsx("span",{className:"text-sm opacity-75 truncate",children:Ia?.sessions?.find(me=>me.id===w)?.title||s("agentChat.currentSession")})]})]})}),d.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0 ml-2",children:[d.jsx(tv,{disabled:C}),d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("button",{onClick:nc,className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.newSession"),children:d.jsx(ul,{className:"w-4 h-4"})}),d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>V(!O),className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.sessionHistory"),children:d.jsx(tn,{className:"w-4 h-4"})}),d.jsx(fm,{isOpen:O,onToggle:()=>V(!O),sessions:Ia?.sessions||[],currentSessionId:w,onSwitchSession:rc,isLoading:!1,searchTerm:X,onSearchChange:we})]}),d.jsx("button",{onClick:G,disabled:!w||Ze,className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300 disabled:opacity-50 disabled:cursor-not-allowed",title:s("agentChat.refreshMessages"),children:d.jsx(wh,{className:`w-4 h-4 ${Ze?"animate-spin":""}`})})]})]})]})}),d.jsxs("div",{className:"flex-1 relative min-h-0",children:[d.jsxs("div",{ref:o,className:"absolute inset-0 px-5 py-5 overflow-y-auto space-y-4",children:[d.jsx("div",{className:"px-4",children:d.jsx("div",{className:"text-sm leading-relaxed break-words overflow-hidden text-gray-600 dark:text-gray-400",children:e.ui.welcomeMessage||e.description})}),Ze?d.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-3",children:[d.jsxs("div",{className:"flex space-x-2",children:[d.jsx("div",{className:"w-3 h-3 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce"}),d.jsx("div",{className:"w-3 h-3 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-3 h-3 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("agentChat.loadingMessages")})]}):d.jsx($6,{messages:_,isLoadingMessages:Ze,isInitializingSession:B,isAiTyping:C,isStopping:N,messagesContainerRef:o,messagesEndRef:l,isUserScrolling:bn,newMessagesCount:kn,onScrollToBottom:ja,onAskUserQuestionSubmit:Ba}),d.jsx("div",{ref:l})]}),bn&&kn>0&&d.jsxs("button",{onClick:()=>{ja(),tc(!1),ec(0)},className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 bg-blue-500 hover:bg-blue-600 text-white rounded-full px-4 py-2 shadow-lg flex items-center space-x-2 transition-all duration-200 z-10",children:[d.jsx("span",{className:"text-sm font-medium",children:s("agentChat.scrollToLatest")}),d.jsx(Tt,{className:"w-4 h-4"})]})]}),d.jsx(ev,{inputMessage:f,selectedImages:Q,isAiTyping:C,isStopping:N,isMobile:a,showToolSelector:Kt,selectedRegularTools:hr,selectedMcpTools:Gr,mcpToolsEnabled:ot,showCommandSelector:br,showFileBrowser:xs,commandSearch:jr,selectedCommand:Bn,selectedCommandIndex:ms,atSymbolPosition:dn,commandWarning:lt||"",permissionMode:Pn,selectedModel:le,selectedClaudeVersion:z||"",showPermissionDropdown:vs,showModelDropdown:Vl,showVersionDropdown:Gl,showMobileSettings:Z,isCompactMode:i,isVersionLocked:ee,isDragOver:be,previewImage:se,showConfirmDialog:W,confirmMessage:D||"",showMcpStatusModal:E,availableModels:Ye,claudeVersionsData:oe,agent:e,projectPath:t,mcpStatus:S,textareaRef:c,fileInputRef:u,onSend:Cs,handleKeyDown:sc,handleImageSelect:ie,handleImageRemove:Ge,handleImagePreview:nt,handlePaste:st,handleDragOver:xt,handleDragLeave:tt,handleDrop:Se,handleStopGeneration:Da,onSetInputMessage:g,onSetShowToolSelector:Yl,onSetSelectedRegularTools:Xl,onSetSelectedMcpTools:Kl,onSetMcpToolsEnabled:Ql,onSetPermissionMode:Zl,onSetSelectedModel:it,onSetSelectedClaudeVersion:Ke,onSetShowPermissionDropdown:Ea,onSetShowModelDropdown:Aa,onSetShowVersionDropdown:ui,onSetShowMobileSettings:q,onSetPreviewImage:Ee,onSetShowConfirmDialog:H,onSetShowMcpStatusModal:Y,onCommandSelect:mn,onSetShowCommandSelector:pn,onSetSelectedCommandIndex:gn,onSetShowFileBrowser:Xt,onSetAtSymbolPosition:Rn,onSetCommandWarning:Ir,onSetCommandSearch:ws,handleConfirmDialog:Le,handleCancelDialog:Xe,isSendDisabled:()=>gi()||!!F,envVars:Ma,onSetEnvVars:Jl,onVoiceTranscribed:di,onOpenVoiceSettings:fi})]})},q6=({agent:e,projectPath:t,onSessionChange:r,initialMessage:n})=>{const{t:s}=fe("components"),{isCompactMode:i}=dm(),{isMobile:a}=_h(),{engineType:o}=Sh(),l=L.useRef(null),c=L.useRef(null),u=L.useRef(null),h=L.useRef(null),f=L.useRef(null),[g,p]=L.useState(""),[m,y]=L.useState(!1),[x,k]=L.useState(void 0),[v,_]=L.useState(void 0),{messages:C,isAiTyping:w,currentSessionId:S,mcpStatus:F,pendingUserQuestion:A,selectedEngine:T,engineUICapabilities:j,engineModels:M,addMessage:P,interruptAllExecutingTools:$,setAiTyping:R,loadSessionMessages:I,setPendingUserQuestion:O}=ze(),W=L.useRef(!1);L.useEffect(()=>{n&&!m&&(p(n),y(!0),W.current=!0)},[n,m]);const Z=wm(),{showSessions:E,showConfirmDialog:D,showMobileSettings:X,showMcpStatusModal:N,confirmMessage:B,searchTerm:V,isStopping:H,isInitializingSession:q,setShowSessions:Y,setShowConfirmDialog:J,setShowMobileSettings:re,setShowMcpStatusModal:we,setConfirmMessage:Ne,setConfirmAction:Ce,setSearchTerm:Le,setIsStopping:Xe,setIsInitializingSession:ct,handleConfirmDialog:Ze,handleCancelDialog:vt}=Z,Nt=km({agentId:e.id,currentSessionId:S,onSessionChange:r,textareaRef:u}),{isLoadingMessages:We,isNewSession:Rt,hasSuccessfulResponse:ut,setIsLoadingMessages:Vt,setIsNewSession:Et,setHasSuccessfulResponse:je,setCurrentSessionId:G,handleSwitchSession:Q,handleNewSession:se,handleRefreshMessages:be}=Nt,{selectedImages:ie,previewImage:Ge,isDragOver:nt,handleImageSelect:st,handleImageRemove:xt,handleImagePreview:tt,handlePaste:Se,handleDragOver:Ie,handleDragLeave:Ee,handleDrop:Gt,clearImages:un,setPreviewImage:hn}=gm({textareaRef:u,inputMessage:g,setInputMessage:p}),ci=pm({messagesContainerRef:l,messagesEndRef:c,messages:C,isAiTyping:w}),{scrollToBottom:jr,isUserScrolling:Bn,newMessagesCount:ms,setIsUserScrolling:lt,setNewMessagesCount:br}=ci,xs=mm({projectPath:t,textareaRef:u}),{commandSearch:dn,selectedCommand:ur,selectedCommandIndex:fn,commandWarning:ys,showCommandSelector:bs,showFileBrowser:Ct,atSymbolPosition:Yt,allCommands:ks,SYSTEM_COMMANDS:gn,userCommands:Ir,projectCommands:pn,userCommandsError:Xt,projectCommandsError:Rn,setSelectedCommand:ws,setSelectedCommandIndex:mn,setCommandWarning:xn,setShowCommandSelector:yn,setShowFileBrowser:le,setAtSymbolPosition:z,setCommandSearch:ee,handleCommandSelect:oe,isCommandDefined:Ye,getAllAvailableCommands:it}=xs,Ke=xm({agent:e}),{showToolSelector:ht,selectedRegularTools:Kt,selectedMcpTools:hr,mcpToolsEnabled:Gr,permissionMode:ot,showPermissionDropdown:Pn,showModelDropdown:vs,showVersionDropdown:Vl,setShowToolSelector:Gl,setSelectedRegularTools:Yl,setSelectedMcpTools:Xl,setMcpToolsEnabled:Kl,setPermissionMode:Ql,setShowPermissionDropdown:Zl,setShowModelDropdown:Ea,setShowVersionDropdown:Aa,envVars:ui,setEnvVars:Ma}=Ke,Jl=ym({initialModel:v||"sonnet",initialVersion:x,skipModelValidation:T==="cursor"}),{selectedModel:bn,selectedClaudeVersion:kn,isVersionLocked:ja,claudeVersionsData:ec,availableModels:tc,setSelectedModel:Yr,setSelectedClaudeVersion:Fn,setIsVersionLocked:On}=Jl;L.useEffect(()=>{if(T==="cursor"&&M.length>0){const $e=M[0]?.id||"auto";console.log(`[AGUIChatPanel] Switching to Cursor engine, resetting model to: ${$e}`),Yr($e)}},[T,M,Yr]),L.useEffect(()=>{t&&(async()=>{try{const wr=await gr(`${ar}/projects/${encodeURIComponent(t)}`);if(wr.ok){const Qt=await wr.json();console.log("🔧 Project settings loaded:",Qt.project),Qt.project.defaultProviderId&&(console.log("🔧 Setting provider to:",Qt.project.defaultProviderId),k(Qt.project.defaultProviderId),Fn(Qt.project.defaultProviderId)),Qt.project.defaultModel&&(console.log("🔧 Setting model to:",Qt.project.defaultModel),_(Qt.project.defaultModel),Yr(Qt.project.defaultModel))}}catch(wr){console.error("Failed to fetch project settings:",wr)}})()},[t,Fn,Yr]);const[Ia,La]=L.useState("默认服务");L.useEffect(()=>{const $e=qp(),wr=Up($e);wr&&La(wr.name)},[]);const kr=Vp(),hi=o?{"cursor-cli":"cursor","claude-sdk":"claude"}[o]:void 0,rc=!!hi&&T===hi,{data:nc,refetch:Da}=Gp(e.id,V,t,T,rc),{data:di}=Yp(e.id,S,t,T),{data:fi}=Xp();L.useEffect(()=>{E&&Da()},[E,Da]),hm({agentId:e.id,sessionId:S,projectPath:t,enabled:!!S,isNewSession:Rt,hasSuccessfulResponse:ut}),L.useEffect(()=>{di?.messages&&S&&(I(di.messages),We&&setTimeout(()=>Vt(!1),100))},[di,S,I,We]),L.useEffect(()=>{if(!S||!fi?.sessions){On(!1);return}const $e=fi.sessions.find(wr=>wr.sessionId===S);$e?(console.log(`🔒 Found active session: ${S}, version: ${$e.claudeVersionId}, model: ${$e.modelId}`),$e.claudeVersionId?(kn!==$e.claudeVersionId&&(console.log(`🔄 Changing Claude version from ${kn} to ${$e.claudeVersionId}`),Fn($e.claudeVersionId)),$e.modelId&&bn!==$e.modelId&&(console.log(`🔄 Restoring model from ${bn} to ${$e.modelId}`),Yr($e.modelId)),On(!0),console.log(`🔒 Locked to Claude version: ${$e.claudeVersionId}, model: ${$e.modelId}`)):(On(!1),console.log("🔓 Session has no specific version, unlocked but keeping user selection"))):(On(!1),console.log(`🔓 Session ${S} not in active sessions, unlocked but keeping user selection`))},[S,fi,kn,bn,Yr,Fn,On]);const gi=!!(Xt||Rn),{isSendDisabled:Cs,handleSendMessage:Ba}=bm({agent:e,projectPath:t,inputMessage:g,selectedImages:ie,isAiTyping:w,currentSessionId:S,hasCommandsLoadError:gi,SYSTEM_COMMANDS:gn,userCommands:Ir,projectCommands:pn,selectedCommand:ur,selectedRegularTools:Kt,selectedMcpTools:hr,mcpToolsEnabled:Gr,permissionMode:ot,selectedModel:bn,selectedClaudeVersion:kn,abortControllerRef:f,onSessionChange:r,setInputMessage:p,clearImages:un,setSelectedCommand:ws,setShowCommandSelector:yn,setCommandWarning:xn,setIsInitializingSession:ct,setCurrentSessionId:G,setIsNewSession:Et,setAiTyping:R,setHasSuccessfulResponse:je,setConfirmMessage:Ne,setConfirmAction:Ce,setShowConfirmDialog:J,handleNewSession:se,isCommandDefined:Ye,getAllAvailableCommands:it,envVars:ui}),sc=J1({showCommandSelector:bs,showFileBrowser:Ct,commandSearch:dn,selectedCommand:ur,selectedCommandIndex:fn,atSymbolPosition:Yt,projectPath:t,textareaRef:u,inputMessage:g,allCommands:ks,onCommandSelect:oe,onSetInputMessage:p,onSetShowCommandSelector:yn,onSetSelectedCommandIndex:mn,onSetShowFileBrowser:le,onSetAtSymbolPosition:z,onHandleKeyDown:$e=>{if($e.key==="Enter"&&!$e.shiftKey){$e.preventDefault(),Ba();return}}}),ic=async()=>{if(!(!f.current||!S))try{Xe(!0),await kr.mutateAsync(S),$(),f.current.abort(),f.current=null,R(!1),Xe(!1),ct(!1),P({content:s("agentChat.generationStopped"),role:"assistant"})}catch($e){console.error("Error stopping generation:",$e),Xe(!1),ct(!1)}};L.useEffect(()=>{const $e=u.current;$e&&($e.style.height="auto",$e.style.height=Math.min($e.scrollHeight,150)+"px")},[g]);const me=$e=>{Q($e),Y(!1)},Je=()=>{se(),Y(!1),Le("")},dt=async($e,wr)=>{try{const Qt=await gr(`${ar}/agents/user-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toolUseId:$e,response:wr,sessionId:S,agentId:e.id})});if(!Qt.ok)throw new Error(`HTTP ${Qt.status}`);O(null)}catch(Qt){console.error("Submit failed:",Qt)}},ac=L.useMemo(()=>C.map($e=>d.jsx("div",{className:"px-4",children:d.jsx("div",{className:`text-sm leading-relaxed break-words overflow-hidden ${$e.role==="user"?"text-white p-3 rounded-lg bg-gray-800 dark:bg-gray-700":"text-gray-800 dark:text-gray-200"}`,children:d.jsx(Q1,{message:$e,onAskUserQuestionSubmit:dt})})},$e.id)),[C,dt]);return d.jsxs("div",{className:"flex flex-col h-full bg-white dark:bg-gray-900",children:[d.jsx("div",{className:"flex-shrink-0 h-12 px-4 border-b border-gray-200 dark:border-gray-700 bg-gradient-to-r from-blue-50 to-purple-50 dark:from-gray-800 dark:to-gray-800 flex items-center",children:d.jsxs("div",{className:"flex items-center justify-between w-full",children:[d.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[d.jsx("span",{className:"text-lg",children:e.ui.icon}),d.jsxs("h1",{className:"text-base font-semibold text-gray-900 dark:text-white truncate",children:["[",Ia,"]"]}),d.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300 rounded-full",children:"AGUI"}),t&&d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 font-normal truncate",title:t,children:t.split("/").pop()||t})]}),d.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0 ml-2",children:[d.jsx(tv,{disabled:w}),d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("button",{onClick:Je,className:"p-1.5 hover:bg-white/50 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.newSession"),children:d.jsx(ul,{className:"w-4 h-4"})}),d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>Y(!E),className:"p-1.5 hover:bg-white/50 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.sessionHistory"),children:d.jsx(tn,{className:"w-4 h-4"})}),d.jsx(fm,{isOpen:E,onToggle:()=>Y(!E),sessions:nc?.sessions||[],currentSessionId:S,onSwitchSession:me,isLoading:!1,searchTerm:V,onSearchChange:Le})]}),d.jsx("button",{onClick:be,disabled:!S||We,className:"p-1.5 hover:bg-white/50 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300 disabled:opacity-50",title:s("agentChat.refreshMessages"),children:d.jsx(wh,{className:`w-4 h-4 ${We?"animate-spin":""}`})})]})]})]})}),d.jsxs("div",{className:"flex-1 relative min-h-0",children:[d.jsxs("div",{ref:l,className:"absolute inset-0 px-5 py-5 overflow-y-auto space-y-4",onDragOver:Ie,onDragLeave:Ee,onDrop:Gt,children:[d.jsx("div",{className:"px-4",children:d.jsx("div",{className:"text-sm leading-relaxed break-words overflow-hidden text-gray-600 dark:text-gray-400",children:e.ui.welcomeMessage||e.description})}),We&&d.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-3",children:[d.jsxs("div",{className:"flex space-x-2",children:[d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),d.jsx("div",{className:"text-sm text-gray-500",children:s("agentChat.loadingMessages")})]}),!We&&ac,(q||w||H)&&d.jsx("div",{className:"px-4 py-3",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),q&&d.jsx("span",{className:"text-xs text-gray-500",children:s("agentChatPanel.initializingSession")}),H&&d.jsx("span",{className:"text-xs text-gray-500",children:s("agentChat.stopping")})]})}),d.jsx("div",{ref:c})]}),Bn&&ms>0&&d.jsxs("button",{onClick:()=>{jr(),lt(!1),br(0)},className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 bg-blue-500 hover:bg-blue-600 text-white rounded-full px-4 py-2 shadow-lg flex items-center gap-2",children:[d.jsx("span",{className:"text-sm",children:s("agentChat.scrollToLatest")}),d.jsx(Tt,{className:"w-4 h-4"})]}),nt&&d.jsx("div",{className:"absolute inset-0 bg-blue-500/10 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center",children:d.jsx("div",{className:"text-blue-500 font-medium",children:s("agentChat.dropImageHere")})})]}),d.jsx(ev,{inputMessage:g,selectedImages:ie,isAiTyping:w,isStopping:H,isMobile:a,showToolSelector:ht,selectedRegularTools:Kt,selectedMcpTools:hr,mcpToolsEnabled:Gr,showCommandSelector:bs,showFileBrowser:Ct,commandSearch:dn,selectedCommand:ur,selectedCommandIndex:fn,atSymbolPosition:Yt,commandWarning:ys||"",permissionMode:ot,selectedModel:bn,selectedClaudeVersion:kn||"",showPermissionDropdown:Pn,showModelDropdown:vs,showVersionDropdown:Vl,showMobileSettings:X,isCompactMode:i,isVersionLocked:ja,isDragOver:nt,previewImage:Ge,showConfirmDialog:D,confirmMessage:B||"",showMcpStatusModal:N,availableModels:T==="cursor"&&M.length>0?M:tc,claudeVersionsData:ec,agent:e,projectPath:t,mcpStatus:F,textareaRef:u,fileInputRef:h,onSend:Ba,handleKeyDown:sc,handleImageSelect:st,handleImageRemove:xt,handleImagePreview:tt,handlePaste:Se,handleDragOver:Ie,handleDragLeave:Ee,handleDrop:Gt,handleStopGeneration:ic,onSetInputMessage:p,onSetShowToolSelector:Gl,onSetSelectedRegularTools:Yl,onSetSelectedMcpTools:Xl,onSetMcpToolsEnabled:Kl,onSetPermissionMode:Ql,onSetSelectedModel:Yr,onSetSelectedClaudeVersion:Fn,onSetShowPermissionDropdown:Zl,onSetShowModelDropdown:Ea,onSetShowVersionDropdown:Aa,onSetShowMobileSettings:re,onSetPreviewImage:hn,onSetShowConfirmDialog:J,onSetShowMcpStatusModal:we,onCommandSelect:oe,onSetShowCommandSelector:yn,onSetSelectedCommandIndex:mn,onSetShowFileBrowser:le,onSetAtSymbolPosition:z,onSetCommandWarning:xn,onSetCommandSearch:ee,handleConfirmDialog:Ze,handleCancelDialog:vt,isSendDisabled:()=>Cs()||!!A,envVars:ui,onSetEnvVars:Ma,engineUICapabilities:j})]})},Wp=({isPanelVisible:e,onToggle:t,position:r,className:n=""})=>{const a=(r==="left"?e?"left":"right":e?"right":"left")==="left"?im:Ht,o=()=>{const l="fixed top-1/2 transform -translate-y-1/2 z-20";return r==="left"?`${l} left-2`:`${l} right-2`};return d.jsx("button",{onClick:t,className:`
|
|
430
|
-
${o()}
|
|
431
|
-
w-8 h-8 rounded-full
|
|
432
|
-
bg-gray-500/10 dark:bg-gray-400/10
|
|
433
|
-
border border-gray-500/20 dark:border-gray-400/20
|
|
434
|
-
text-gray-600 dark:text-gray-300
|
|
435
|
-
hover:bg-gray-500/20 dark:hover:bg-gray-400/20
|
|
436
|
-
hover:scale-110 hover:border-gray-500/40 dark:hover:border-gray-400/40
|
|
437
|
-
hover:text-gray-800 dark:hover:text-white
|
|
438
|
-
transition-all duration-200 ease-in-out
|
|
439
|
-
flex items-center justify-center
|
|
440
|
-
backdrop-blur-sm
|
|
441
|
-
shadow-sm hover:shadow-md
|
|
442
|
-
${n}
|
|
443
|
-
`,title:r==="left"?e?"隐藏聊天界面":"显示聊天界面":e?"隐藏可视化界面":"显示可视化界面",children:d.jsx(a,{className:"w-4 h-4"})})},U6=({children:e,defaultLeftWidth:t=35,minWidth:r=20,maxWidth:n=80,hideLeftPanel:s=!1,hideRightPanel:i=!1,onToggleLeftPanel:a,onToggleRightPanel:o,mobileLayout:l="stack"})=>{const{isMobile:c,rightPanelOpen:u,setRightPanelOpen:h}=_h(),[f,g]=L.useState(t),[p,m]=L.useState(!1),[y,x]=L.useState("left"),k=L.useRef(null),v=w=>{c||(w.preventDefault(),m(!0))},_=L.useCallback(w=>{if(!p||!k.current||c)return;const S=k.current.getBoundingClientRect(),F=(w.clientX-S.left)/S.width*100,A=Math.min(Math.max(F,r),n);g(A)},[p,r,n,c]),C=L.useCallback(()=>{m(!1)},[]);if(L.useEffect(()=>(p&&!c?(document.addEventListener("mousemove",_),document.addEventListener("mouseup",C),document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",C),document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",C),document.body.style.cursor="",document.body.style.userSelect=""}),[p,_,C,c]),c){if(l==="tabs"){const w=!i;return d.jsxs("div",{className:"flex flex-col h-full bg-gray-100",children:[w&&d.jsxs("div",{className:"flex-shrink-0 flex border-b border-gray-200 bg-white",children:[d.jsx("button",{onClick:()=>{x("left"),h(!1)},className:`flex-1 px-4 py-3 text-sm font-medium transition-colors ${y==="left"&&!u?"text-blue-600 border-b-2 border-blue-600 bg-blue-50":"text-gray-500 hover:text-gray-700 hover:bg-gray-50"}`,children:"Chat"}),d.jsx("button",{onClick:()=>{x("right"),h(!0)},className:`flex-1 px-4 py-3 text-sm font-medium transition-colors ${y==="right"||u?"text-blue-600 border-b-2 border-blue-600 bg-blue-50":"text-gray-500 hover:text-gray-700 hover:bg-gray-50"}`,children:"Preview"})]}),d.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:!i&&w&&(y==="right"||u)?d.jsx("div",{className:"h-full",children:e[1]}):d.jsx("div",{className:"h-full",children:e[0]})})]})}return d.jsxs("div",{className:"flex flex-col h-full bg-gray-100",children:[d.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e[0]}),!i&&u&&d.jsxs("div",{className:"fixed inset-0 z-50 lg:hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50",onClick:()=>h(!1)}),d.jsxs("div",{className:"absolute inset-4 bg-white rounded-lg shadow-xl overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[d.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Preview"}),d.jsx("button",{onClick:()=>h(!1),className:"p-2 text-gray-500 hover:text-gray-700 rounded-md hover:bg-gray-100",children:d.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),d.jsx("div",{className:"h-[calc(100%-73px)]",children:e[1]})]})]}),!i&&!u&&o&&d.jsx("button",{onClick:()=>h(!0),className:"fixed bottom-6 right-6 z-40 bg-blue-600 text-white p-4 rounded-full shadow-lg hover:bg-blue-700 transition-colors lg:hidden",title:"Open Preview",children:d.jsxs("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]})}return d.jsxs("div",{ref:k,className:"flex h-full bg-gray-100 relative",children:[d.jsx("div",{className:`
|
|
444
|
-
flex flex-col relative
|
|
445
|
-
${s?"hidden":"block"}
|
|
446
|
-
`,style:{width:i?"100%":`${f}%`},children:e[0]}),!s&&!i&&d.jsx("div",{className:`
|
|
447
|
-
resize-separator relative z-10
|
|
448
|
-
${p?"w-2 bg-blue-500":"w-1.5 bg-gray-300 hover:bg-blue-400"}
|
|
449
|
-
cursor-col-resize transition-all duration-200
|
|
450
|
-
flex items-center justify-center
|
|
451
|
-
group
|
|
452
|
-
`,onMouseDown:v,children:d.jsx("div",{className:"absolute inset-y-0 flex items-center justify-center",children:d.jsx("div",{className:"flex flex-col items-center justify-center gap-1 py-2",children:d.jsxs("div",{className:"flex gap-0.5 opacity-40 group-hover:opacity-70 transition-opacity",children:[d.jsx("div",{className:"w-0.5 h-4 bg-gray-600 dark:bg-gray-400 rounded-full"}),d.jsx("div",{className:"w-0.5 h-4 bg-gray-600 dark:bg-gray-400 rounded-full"})]})})})}),d.jsx("div",{className:`
|
|
453
|
-
flex flex-col border-l border-gray-200 relative
|
|
454
|
-
${i?"hidden":"block"}
|
|
455
|
-
`,style:{width:s?"100%":`${100-f}%`},children:e[1]}),a&&d.jsx(Wp,{isPanelVisible:!s,onToggle:a,position:"left",className:"panel-toggle-left"}),o&&d.jsx(Wp,{isPanelVisible:!i,onToggle:o,position:"right",className:"panel-toggle-right"})]})},V6=({currentView:e,onViewChange:t,hasCustomComponent:r,className:n=""})=>{if(!r)return null;const s=()=>{t(e==="files"?"custom":"files")},i=e==="files"?tm:Ch,a=e==="files"?"Agent 界面":"文件浏览器";return d.jsxs("button",{onClick:s,className:`
|
|
456
|
-
fixed bottom-6 right-6 z-30
|
|
457
|
-
w-12 h-12 rounded-full
|
|
458
|
-
bg-white dark:bg-gray-800
|
|
459
|
-
border border-gray-200 dark:border-gray-600
|
|
460
|
-
shadow-lg hover:shadow-xl
|
|
461
|
-
text-gray-600 dark:text-gray-300
|
|
462
|
-
hover:text-blue-600 dark:hover:text-blue-400
|
|
463
|
-
hover:bg-blue-50 dark:hover:bg-blue-900/20
|
|
464
|
-
hover:border-blue-200 dark:hover:border-blue-700
|
|
465
|
-
transition-all duration-200 ease-in-out
|
|
466
|
-
flex items-center justify-center
|
|
467
|
-
group
|
|
468
|
-
backdrop-blur-sm
|
|
469
|
-
${n}
|
|
470
|
-
`,title:`切换到${a}`,children:[d.jsx(i,{className:"w-5 h-5"}),d.jsx("div",{className:`
|
|
471
|
-
absolute bottom-full right-0 mb-2 px-2 py-1
|
|
472
|
-
bg-gray-900 dark:bg-gray-700
|
|
473
|
-
text-white text-xs rounded
|
|
474
|
-
opacity-0 group-hover:opacity-100
|
|
475
|
-
transition-opacity duration-200
|
|
476
|
-
pointer-events-none
|
|
477
|
-
whitespace-nowrap
|
|
478
|
-
`,children:a})]})},G6=({agent:e,projectPath:t,CustomComponent:r})=>{const[n,s]=L.useState(r?"custom":"files"),i=!!r;return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-full bg-white dark:bg-gray-900 overflow-hidden",children:i?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:`h-full ${n==="custom"?"block":"hidden"}`,children:d.jsx(r,{agent:e,projectPath:t})}),d.jsx("div",{className:`h-full ${n==="files"?"block":"hidden"}`,children:d.jsx(Jd,{projectPath:t,onFileSelect:a=>{console.log("Selected file:",a)},className:"h-full"})})]}):d.jsx(Jd,{projectPath:t,onFileSelect:a=>{console.log("Selected file:",a)},className:"h-full"})}),d.jsx(V6,{currentView:n,onViewChange:s,hasCustomComponent:i,className:"floating-toggle"})]})},Y6=({projectPath:e})=>{const{t}=fe("agents"),{data:r,isLoading:n,error:s}=nv(e),i=kh(),a=L.useRef({}),o=()=>{i.invalidateQueries({queryKey:["slides",e]}),i.invalidateQueries({queryKey:["slide-content"]}),Object.values(a.current).forEach(c=>{c?.refreshIframe&&c.refreshIframe()})};if(L.useEffect(()=>{const c=u=>{console.log("🔄 Received AI_RESPONSE_COMPLETE event in SlidePreviewPanel:",u),u.projectPath===e&&(console.log("🔄 Auto-refreshing slides after AI response completion"),o())};return Jc.on(eu.AI_RESPONSE_COMPLETE,c),()=>{Jc.off(eu.AI_RESPONSE_COMPLETE,c)}},[e,i]),n)return d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-gray-500",children:t("slidePreview.loading")})});if(s)return d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-red-500",children:t("slidePreview.loadError")})});const l=r?.slides||[];return d.jsxs("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-gray-900",children:[d.jsx("div",{className:"h-12 px-5 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 flex items-center",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center space-x-3",children:[d.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:t("slidePreview.title")}),d.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:r?.title||"Presentation"})]}),d.jsxs("button",{onClick:o,disabled:n,className:"flex items-center space-x-1 px-3 py-1.5 text-sm bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("slidePreview.refreshTitle"),children:[d.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),d.jsx("span",{children:t("slidePreview.refresh")})]})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 dark:text-gray-400 p-5",children:[d.jsx("div",{className:"text-lg mb-2",children:t("slidePreview.noSlides")}),d.jsx("div",{className:"text-sm",children:t("slidePreview.createWithAI")})]}):d.jsx("div",{className:"space-y-4 p-5",children:l.map(c=>d.jsx(sv,{ref:u=>{u?a.current[c.index]=u:delete a.current[c.index]},slide:c,totalSlides:l.length,projectPath:e},c.index))})})]})},X6={rightPanelComponent:Y6,onMount:e=>{console.log(`Slides agent ${e} mounted`)},onUnmount:e=>{console.log(`Slides agent ${e} unmounted`)}},K6={onMount:e=>{console.log(`Chat agent ${e} mounted`)},onUnmount:e=>{console.log(`Chat agent ${e} unmounted`)}},Q6={slides:X6,chat:K6},Z6=e=>Q6[e];function J6({status:e,originalTitle:t=document.title,workingText:r="🤖 AI 正在工作",completedText:n="✅ 已完成",errorText:s="❌ 发生错误",marqueeSpeed:i=300,blinkInterval:a=800}){const o=L.useRef(null),l=L.useRef(!document.hidden),c=L.useRef(t),u=L.useRef("idle");L.useEffect(()=>{document.hidden||(c.current=t)},[t]);const h=()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},f=()=>{h(),document.title=c.current},g=m=>{h();let y=0;const x=`${m}... `,k=()=>{const v=x.slice(y)+x.slice(0,y);document.title=v,y=(y+1)%x.length};k(),o.current=window.setInterval(k,i)},p=m=>{h();let y=!0;const x=()=>{document.title=y?m:c.current,y=!y};x(),o.current=window.setInterval(x,a)};L.useEffect(()=>{const m=()=>{if(l.current=!document.hidden,!document.hidden)f();else{const y=u.current;y==="working"?g(r):y==="completed"?p(n):y==="error"&&p(s)}};return document.addEventListener("visibilitychange",m),()=>{document.removeEventListener("visibilitychange",m),h()}},[r,n,s,i,a]),L.useEffect(()=>{u.current=e,document.hidden&&(e==="working"?g(r):e==="completed"?p(n):e==="error"?p(s):e==="idle"&&f())},[e,r,n,s]),L.useEffect(()=>()=>{h(),document.title=c.current},[])}const Gc="agentstudio:chat-version";function e9(e){return e?"agui":"original"}const t9=()=>{const{t:e}=fe("pages"),{agentId:t}=Nv(),[r]=cm(),n=Ev(),s=r.get("project"),i=r.get("session"),a=r.get("message"),{data:o,isLoading:l,error:c}=av(t),{setCurrentAgent:u,setCurrentSessionId:h,isAiTyping:f}=ze(),{isCursorEngine:g,isLoading:p}=Sh(),[m,y]=L.useState(!1),[x,k]=L.useState(!1),[v,_]=L.useState(!1),[C,w]=L.useState(null),[S,F]=L.useState(!1),A=$r.useRef(!1),[T,j]=L.useState(()=>{const X=localStorage.getItem(Gc);return X==="agui"||X==="original"?X:"original"});L.useEffect(()=>{if(!p&&!localStorage.getItem(Gc)){const N=e9(g);j(N)}},[p,g]),L.useEffect(()=>{const X=N=>{N.key===Gc&&N.newValue&&(N.newValue==="agui"||N.newValue==="original")&&j(N.newValue)};return window.addEventListener("storage",X),()=>window.removeEventListener("storage",X)},[]);const M=o?.agent;L.useEffect(()=>{f?(A.current=!0,F(!1)):A.current&&(document.hidden||(F(!0),A.current=!1))},[f]),L.useEffect(()=>{const X=()=>{!document.hidden&&!f&&A.current&&(F(!0),A.current=!1)};return document.addEventListener("visibilitychange",X),()=>document.removeEventListener("visibilitychange",X)},[f]);const P=L.useMemo(()=>C?"error":f?"working":!f&&A.current&&!S?"completed":"idle",[f,C,S]);J6({status:P,originalTitle:M?`${M.ui.icon} ${M.name} - AgentStudio`:"AgentStudio",workingText:e("chat.tabNotification.working"),completedText:e("chat.tabNotification.completed"),errorText:e("chat.tabNotification.error")}),L.useEffect(()=>{if(c){w(c);const X=setTimeout(()=>w(null),5e3);return()=>clearTimeout(X)}},[c]),L.useEffect(()=>{console.log("🎯 ChatPage agent/session effect:",{hasAgent:!!M,agentId:M?.id,sessionId:i,urlSessionId:r.get("session")}),M&&(console.log("🎯 Setting current agent:",M.id),u(M),i&&(console.log("🎯 Setting session ID:",i),h(i)))},[M,i,u,h]),L.useEffect(()=>{M&&!s&&y(!0)},[M,s]);const $=X=>{const N=new URLSearchParams;N.set("project",X),i&&N.set("session",i),n(`/chat/${t}?${N.toString()}`,{replace:!0}),y(!1)},R=X=>{const N=new URLSearchParams;s&&N.set("project",s),X&&N.set("session",X),n(`/chat/${t}?${N.toString()}`,{replace:!0})},I=()=>{y(!1),n("/agents")},O=L.useMemo(()=>{if(M?.ui?.componentType)return Z6(M.ui.componentType)},[M]),W=O?.rightPanelComponent;if(L.useEffect(()=>{if(!(!M||!O))return O.onMount&&O.onMount(M.id),()=>{O.onUnmount&&O.onUnmount(M.id)}},[M,O]),l)return d.jsx("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),d.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:e("chat.loading")})]})});if(c||!M)return d.jsx("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900 flex items-center justify-center",children:d.jsxs("div",{className:"text-center max-w-md",children:[d.jsx("div",{className:"text-6xl mb-6",children:"❌"}),d.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-4",children:e("chat.agentNotFound")}),d.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:e("chat.agentNotFoundDesc")}),d.jsx("button",{onClick:()=>window.close(),className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:e("chat.closePage")})]})});if(!M.enabled)return d.jsx("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900 flex items-center justify-center",children:d.jsxs("div",{className:"text-center max-w-md",children:[d.jsx("div",{className:"text-6xl mb-6 opacity-50",children:M.ui.icon}),d.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-4",children:e("chat.agentDisabled")}),d.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:e("chat.agentDisabledDesc",{name:M.name})}),d.jsx("div",{className:"flex space-x-4 justify-center",children:d.jsx("button",{onClick:()=>window.close(),className:"px-6 py-3 bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition-colors",children:e("chat.closePage")})})]})});const Z=()=>{const X=!x;k(X),X&&v&&_(!1)},E=()=>{const X=!v;_(X),X&&x&&k(!1)},D=()=>{const X=T==="agui"?q6:H6;return d.jsxs(U6,{hideLeftPanel:x,hideRightPanel:v,onToggleLeftPanel:Z,onToggleRightPanel:E,mobileLayout:"tabs",children:[d.jsx(X,{agent:M,projectPath:s||void 0,onSessionChange:R,initialMessage:a||void 0}),d.jsx(G6,{agent:M,projectPath:s||void 0,CustomComponent:W})]})};return d.jsxs("div",{className:"h-screen bg-gray-100 dark:bg-gray-900",children:[D(),m&&M&&d.jsx(jv,{agent:M,onProjectSelect:$,onClose:I})]})},U9=Object.freeze(Object.defineProperty({__proto__:null,ChatPage:t9},Symbol.toStringTag,{value:"Module"}));export{_9 as $,Gi as A,bE as B,OA as C,Ed as D,It as E,F0 as F,xD as G,ba as H,zr as I,_$ as J,bL as K,qf as L,aL as M,ad as N,S9 as O,N9 as P,Ts as Q,vg as R,wg as S,A9 as T,Te as U,E9 as V,T9 as W,v9 as X,C9 as Y,j9 as Z,b as _,$A as a,rr as a$,M9 as a0,tA as a1,Ys as a2,y9 as a3,Il as a4,lD as a5,kA as a6,Gh as a7,rg as a8,uL as a9,ge as aA,F9 as aB,AB as aC,SB as aD,CB as aE,j3 as aF,oL as aG,x9 as aH,Ta as aI,A3 as aJ,E3 as aK,hs as aL,iD as aM,Rb as aN,Nl as aO,jl as aP,Xo as aQ,Fb as aR,Bb as aS,D5 as aT,rd as aU,Cn as aV,pg as aW,Oj as aX,na as aY,de as aZ,_b as a_,fo as aa,mD as ab,EA as ac,ya as ad,ce as ae,xe as af,Y0 as ag,rB as ah,Gw as ai,z9 as aj,N$ as ak,wt as al,Ln as am,yd as an,bk as ao,gs as ap,Ub as aq,sD as ar,K4 as as,Q5 as at,bd as au,kp as av,GB as aw,O9 as ax,W9 as ay,P9 as az,LA as b,Lj as b0,td as b1,lx as b2,wa as b3,hx as b4,w9 as b5,yE as b6,nD as b7,K5 as b8,R4 as b9,aD as bA,Ml as bB,U9 as bC,kd as ba,j5 as bb,oD as bc,Sa as bd,ii as be,Vo as bf,W5 as bg,mR as bh,Ca as bi,Yo as bj,B5 as bk,Mb as bl,O4 as bm,z4 as bn,Un as bo,Wg as bp,W4 as bq,wd as br,F4 as bs,U4 as bt,ai as bu,In as bv,Rg as bw,vd as bx,Ib as by,lh as bz,qe as c,Fe as d,G0 as e,bt as f,BA as g,an as h,mr as i,L$ as j,ni as k,K as l,Gb as m,b9 as n,q9 as o,RA as p,PA as q,H9 as r,DA as s,T$ as t,Tr as u,kB as v,kD as w,I9 as x,IA as y,k9 as z};
|