agor-live 0.21.2 → 0.22.0
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/dist/cli/commands/branch/env/restart.js +1 -1
- package/dist/cli/commands/branch/env/start.js +1 -1
- package/dist/cli/commands/branch/env/stop.js +1 -1
- package/dist/core/api/index.cjs +5 -1
- package/dist/core/api/index.d.ts +6 -1
- package/dist/core/api/index.d.ts.map +1 -1
- package/dist/core/api/index.js +5 -1
- package/dist/core/claude/index.cjs +162 -14
- package/dist/core/claude/index.js +166 -18
- package/dist/core/client/index.cjs +43 -3
- package/dist/core/client/index.js +37 -3
- package/dist/core/config/browser.cjs +2 -2
- package/dist/core/config/browser.js +2 -2
- package/dist/core/config/config-manager.d.ts.map +1 -1
- package/dist/core/config/constants.d.ts +1 -1
- package/dist/core/config/index.cjs +174 -20
- package/dist/core/config/index.js +178 -24
- package/dist/core/config/types.d.ts +8 -0
- package/dist/core/config/types.d.ts.map +1 -1
- package/dist/core/db/index.cjs +495 -86
- package/dist/core/db/index.js +482 -75
- package/dist/core/db/repositories/artifacts.d.ts.map +1 -1
- package/dist/core/db/repositories/branches.d.ts +13 -1
- package/dist/core/db/repositories/branches.d.ts.map +1 -1
- package/dist/core/db/repositories/gateway-channels.d.ts.map +1 -1
- package/dist/core/db/repositories/index.d.ts +1 -0
- package/dist/core/db/repositories/index.d.ts.map +1 -1
- package/dist/core/db/repositories/session-relationships.d.ts +30 -0
- package/dist/core/db/repositories/session-relationships.d.ts.map +1 -0
- package/dist/core/db/repositories/users.d.ts +11 -0
- package/dist/core/db/repositories/users.d.ts.map +1 -1
- package/dist/core/db/schema.d.ts +421 -4
- package/dist/core/db/schema.d.ts.map +1 -1
- package/dist/core/db/schema.postgres.d.ts +226 -2
- package/dist/core/db/schema.postgres.d.ts.map +1 -1
- package/dist/core/db/schema.sqlite.d.ts +228 -2
- package/dist/core/db/schema.sqlite.d.ts.map +1 -1
- package/dist/core/drizzle/postgres/0050_artifact_source_session.sql +3 -0
- package/dist/core/drizzle/postgres/0051_session_relationships.sql +26 -0
- package/dist/core/drizzle/postgres/meta/_journal.json +14 -0
- package/dist/core/drizzle/sqlite/0059_artifact_source_session.sql +2 -0
- package/dist/core/drizzle/sqlite/0060_session_relationships.sql +23 -0
- package/dist/core/drizzle/sqlite/meta/_journal.json +14 -0
- package/dist/core/gateway/connector-registry.d.ts.map +1 -1
- package/dist/core/gateway/connector.d.ts +22 -0
- package/dist/core/gateway/connector.d.ts.map +1 -1
- package/dist/core/gateway/connectors/slack.d.ts +35 -3
- package/dist/core/gateway/connectors/slack.d.ts.map +1 -1
- package/dist/core/gateway/connectors/teams.d.ts +107 -0
- package/dist/core/gateway/connectors/teams.d.ts.map +1 -0
- package/dist/core/gateway/context.d.ts.map +1 -1
- package/dist/core/gateway/index.cjs +552 -52
- package/dist/core/gateway/index.d.ts +3 -2
- package/dist/core/gateway/index.d.ts.map +1 -1
- package/dist/core/gateway/index.js +544 -52
- package/dist/core/gateway/system-message.d.ts +21 -0
- package/dist/core/gateway/system-message.d.ts.map +1 -1
- package/dist/core/index.cjs +616 -127
- package/dist/core/index.js +597 -116
- package/dist/core/mcp/index.cjs +146 -9
- package/dist/core/mcp/index.js +146 -9
- package/dist/core/mcp/template-resolver.d.ts.map +1 -1
- package/dist/core/seed/index.cjs +375 -59
- package/dist/core/seed/index.js +378 -62
- package/dist/core/sessions/index.cjs +19 -0
- package/dist/core/sessions/index.js +19 -0
- package/dist/core/templates/agor-system-prompt.md +21 -53
- package/dist/core/templates/session-context.cjs +2 -73
- package/dist/core/templates/session-context.d.ts +9 -53
- package/dist/core/templates/session-context.d.ts.map +1 -1
- package/dist/core/templates/session-context.js +2 -72
- package/dist/core/tools/mcp/jwt-auth.cjs +2 -20
- package/dist/core/tools/mcp/jwt-auth.d.ts.map +1 -1
- package/dist/core/tools/mcp/jwt-auth.js +2 -20
- package/dist/core/tools/mcp/oauth-mcp-transport.cjs +2 -15
- package/dist/core/tools/mcp/oauth-mcp-transport.d.ts.map +1 -1
- package/dist/core/tools/mcp/oauth-mcp-transport.js +2 -15
- package/dist/core/tools/mcp/oauth-refresh.cjs +167 -19
- package/dist/core/tools/mcp/oauth-refresh.js +167 -19
- package/dist/core/types/artifact.d.ts +5 -1
- package/dist/core/types/artifact.d.ts.map +1 -1
- package/dist/core/types/branch.d.ts +14 -0
- package/dist/core/types/branch.d.ts.map +1 -1
- package/dist/core/types/gateway.d.ts +1 -1
- package/dist/core/types/gateway.d.ts.map +1 -1
- package/dist/core/types/id.d.ts +1 -0
- package/dist/core/types/id.d.ts.map +1 -1
- package/dist/core/types/index.cjs +36 -0
- package/dist/core/types/index.js +30 -0
- package/dist/core/types/session.d.ts +65 -1
- package/dist/core/types/session.d.ts.map +1 -1
- package/dist/core/types/task.d.ts +9 -0
- package/dist/core/types/task.d.ts.map +1 -1
- package/dist/core/unix/index.cjs +371 -55
- package/dist/core/unix/index.js +374 -58
- package/dist/core/unix/unix-integration-service.d.ts +10 -7
- package/dist/core/unix/unix-integration-service.d.ts.map +1 -1
- package/dist/core/utils/permission-mode-mapper.cjs +19 -0
- package/dist/core/utils/permission-mode-mapper.js +19 -0
- package/dist/daemon/declarations.d.ts +7 -0
- package/dist/daemon/declarations.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.js +53 -1
- package/dist/daemon/index.js +3760 -2107
- package/dist/daemon/main.js +3760 -2107
- package/dist/daemon/mcp/server.js +155 -17
- package/dist/daemon/mcp/tools/analytics.js +6 -7
- package/dist/daemon/mcp/tools/artifacts.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/artifacts.js +7 -7
- package/dist/daemon/mcp/tools/boards.js +6 -7
- package/dist/daemon/mcp/tools/branches.js +6 -7
- package/dist/daemon/mcp/tools/card-types.js +6 -7
- package/dist/daemon/mcp/tools/cards.js +6 -7
- package/dist/daemon/mcp/tools/environment.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/environment.js +19 -12
- package/dist/daemon/mcp/tools/knowledge.js +6 -7
- package/dist/daemon/mcp/tools/mcp-servers.js +6 -7
- package/dist/daemon/mcp/tools/messages.js +6 -7
- package/dist/daemon/mcp/tools/proxies.js +6 -7
- package/dist/daemon/mcp/tools/repos.js +6 -7
- package/dist/daemon/mcp/tools/schedules.js +6 -7
- package/dist/daemon/mcp/tools/search.js +6 -7
- package/dist/daemon/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/sessions.js +140 -11
- package/dist/daemon/mcp/tools/tasks.js +6 -7
- package/dist/daemon/mcp/tools/users.js +6 -7
- package/dist/daemon/mcp/tools/widgets.js +7 -8
- package/dist/daemon/register-hooks.d.ts +5 -1
- package/dist/daemon/register-hooks.d.ts.map +1 -1
- package/dist/daemon/register-hooks.js +404 -179
- package/dist/daemon/register-routes.d.ts.map +1 -1
- package/dist/daemon/register-routes.js +360 -162
- package/dist/daemon/register-services.d.ts.map +1 -1
- package/dist/daemon/register-services.js +1928 -671
- package/dist/daemon/services/artifacts.d.ts +10 -1
- package/dist/daemon/services/artifacts.d.ts.map +1 -1
- package/dist/daemon/services/artifacts.js +25 -1
- package/dist/daemon/services/branches.d.ts +11 -1
- package/dist/daemon/services/branches.d.ts.map +1 -1
- package/dist/daemon/services/branches.js +470 -184
- package/dist/daemon/services/claude-models.js +879 -339
- package/dist/daemon/services/gateway.d.ts +58 -2
- package/dist/daemon/services/gateway.d.ts.map +1 -1
- package/dist/daemon/services/gateway.js +590 -47
- package/dist/daemon/services/groups.d.ts +2 -0
- package/dist/daemon/services/groups.d.ts.map +1 -1
- package/dist/daemon/services/groups.js +56 -0
- package/dist/daemon/services/mcp-servers.d.ts.map +1 -1
- package/dist/daemon/services/mcp-servers.js +0 -6
- package/dist/daemon/services/scheduler.d.ts.map +1 -1
- package/dist/daemon/services/scheduler.js +6 -2
- package/dist/daemon/services/sessions.d.ts +11 -3
- package/dist/daemon/services/sessions.d.ts.map +1 -1
- package/dist/daemon/services/sessions.js +68 -7
- package/dist/daemon/services/tasks.d.ts +13 -2
- package/dist/daemon/services/tasks.d.ts.map +1 -1
- package/dist/daemon/services/tasks.js +42 -26
- package/dist/daemon/startup.js +6 -2
- package/dist/daemon/utils/session-stop.d.ts +43 -0
- package/dist/daemon/utils/session-stop.d.ts.map +1 -0
- package/dist/daemon/utils/session-stop.js +102 -0
- package/dist/daemon/utils/session-task-state.d.ts +7 -2
- package/dist/daemon/utils/session-task-state.d.ts.map +1 -1
- package/dist/daemon/utils/session-task-state.js +9 -3
- package/dist/daemon/utils/session-tasks.d.ts +4 -4
- package/dist/daemon/utils/session-tasks.d.ts.map +1 -1
- package/dist/daemon/utils/session-tasks.js +4 -8
- package/dist/executor/commands/environment.d.ts +13 -0
- package/dist/executor/commands/environment.d.ts.map +1 -0
- package/dist/executor/commands/environment.js +287 -0
- package/dist/executor/commands/index.d.ts.map +1 -1
- package/dist/executor/commands/index.js +5 -1
- package/dist/executor/commands/unix.d.ts +8 -1
- package/dist/executor/commands/unix.d.ts.map +1 -1
- package/dist/executor/commands/unix.js +157 -2
- package/dist/executor/payload-types.d.ts +201 -5
- package/dist/executor/payload-types.d.ts.map +1 -1
- package/dist/executor/payload-types.js +98 -0
- package/dist/executor/sdk-handlers/base/mcp-scoping.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/base/mcp-scoping.js +14 -0
- package/dist/executor/sdk-handlers/claude/message-processor.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/message-processor.js +0 -1
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts +1 -0
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/query-builder.js +91 -39
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts +12 -5
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/codex/prompt-service.js +72 -30
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/copilot/prompt-service.js +4 -13
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/gemini/prompt-service.js +4 -13
- package/dist/ui/assets/App-DcEY8Ota.js +3 -0
- package/dist/ui/assets/App-DcEY8Ota.js.gz +0 -0
- package/dist/ui/assets/{ArtifactConsentModal-ParNk5kW.js → ArtifactConsentModal-CiCbK9iv.js} +1 -1
- package/dist/ui/assets/ArtifactConsentModal-CiCbK9iv.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js +9 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js +18 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js.gz +0 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js +34 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js.gz +0 -0
- package/dist/ui/assets/{CodeEditor.inner-D51Z_CLQ.js → CodeEditor.inner-DBgsP4tn.js} +2 -2
- package/dist/ui/assets/CodeEditor.inner-DBgsP4tn.js.gz +0 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js +1 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js +24 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js.gz +0 -0
- package/dist/ui/assets/MarketingScreenshotPage-9Qd7eZsm.css +1 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js +143 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js.gz +0 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js +1 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js.gz +0 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js +20 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js.gz +0 -0
- package/dist/ui/assets/{App-BAdBsEnV.css → SessionCanvas-mEmYGZhC.css} +1 -1
- package/dist/ui/assets/SessionCanvas-mEmYGZhC.css.gz +0 -0
- package/dist/ui/assets/{StreamdownDemoPage-B9wbgp2s.js → StreamdownDemoPage-wzWaqWwr.js} +1 -1
- package/dist/ui/assets/StreamdownDemoPage-wzWaqWwr.js.gz +0 -0
- package/dist/ui/assets/{ThemeSwitcher-ubn6IOz9.js → ThemeSwitcher-Dly2y9pi.js} +1 -1
- package/dist/ui/assets/ThemeSwitcher-Dly2y9pi.js.gz +0 -0
- package/dist/ui/assets/antd-CfbbHJOz.js +401 -0
- package/dist/ui/assets/antd-CfbbHJOz.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-CykGFbQU.js +1 -0
- package/dist/ui/assets/{architectureDiagram-VXUJARFQ-ChmZt3zk.js → architectureDiagram-VXUJARFQ-C8HXAenz.js} +1 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-C8HXAenz.js.gz +0 -0
- package/dist/ui/assets/{blockDiagram-VD42YOAC-CzGHAHao.js → blockDiagram-VD42YOAC-BhZaEN19.js} +1 -1
- package/dist/ui/assets/blockDiagram-VD42YOAC-BhZaEN19.js.gz +0 -0
- package/dist/ui/assets/{c4Diagram-YG6GDRKO-DscJyaWN.js → c4Diagram-YG6GDRKO-Dk_UH-sY.js} +1 -1
- package/dist/ui/assets/c4Diagram-YG6GDRKO-Dk_UH-sY.js.gz +0 -0
- package/dist/ui/assets/channel-D6_nUWlW.js +1 -0
- package/dist/ui/assets/{chunk-4BX2VUAB-DoWpTvP8.js → chunk-4BX2VUAB-XprbG2TG.js} +1 -1
- package/dist/ui/assets/chunk-55IACEB6-ByzqIgSb.js +1 -0
- package/dist/ui/assets/{chunk-ABZYJK2D-RzDCrjE6.js → chunk-ABZYJK2D-BJcrryHK.js} +1 -1
- package/dist/ui/assets/chunk-ABZYJK2D-BJcrryHK.js.gz +0 -0
- package/dist/ui/assets/{chunk-AGHRB4JF-jidCS5Of.js → chunk-AGHRB4JF-DvxmfbM0.js} +1 -1
- package/dist/ui/assets/chunk-AGHRB4JF-DvxmfbM0.js.gz +0 -0
- package/dist/ui/assets/{chunk-ATLVNIR6-BEIIfJtC.js → chunk-ATLVNIR6-DbeJ0OrR.js} +1 -1
- package/dist/ui/assets/chunk-ATLVNIR6-DbeJ0OrR.js.gz +0 -0
- package/dist/ui/assets/{chunk-B4BG7PRW-B8b6dQQ2.js → chunk-B4BG7PRW-C53q2ggf.js} +1 -1
- package/dist/ui/assets/chunk-B4BG7PRW-C53q2ggf.js.gz +0 -0
- package/dist/ui/assets/{chunk-CVBHYZKI-D-mQAfrk.js → chunk-CVBHYZKI-B3EBSlb3.js} +1 -1
- package/dist/ui/assets/{chunk-DI55MBZ5-BfATX3V8.js → chunk-DI55MBZ5-vIyNEQN-.js} +1 -1
- package/dist/ui/assets/chunk-DI55MBZ5-vIyNEQN-.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-B3ObkuOm.js +1 -0
- package/dist/ui/assets/{chunk-FMBD7UC4-fqXscNvc.js → chunk-FMBD7UC4-rddmfK-Z.js} +1 -1
- package/dist/ui/assets/{chunk-HN2XXSSU-BCHvD80g.js → chunk-HN2XXSSU-Dttqcg3b.js} +1 -1
- package/dist/ui/assets/chunk-HN2XXSSU-Dttqcg3b.js.gz +0 -0
- package/dist/ui/assets/{chunk-JA3XYJ7Z-Cp6dqHnY.js → chunk-JA3XYJ7Z-DbNDev3D.js} +1 -1
- package/dist/ui/assets/chunk-JA3XYJ7Z-DbNDev3D.js.gz +0 -0
- package/dist/ui/assets/{chunk-JZLCHNYA-cKMooY3y.js → chunk-JZLCHNYA-EUmx2y4H.js} +1 -1
- package/dist/ui/assets/chunk-JZLCHNYA-EUmx2y4H.js.gz +0 -0
- package/dist/ui/assets/{chunk-MI3HLSF2-BlzO5wOE.js → chunk-MI3HLSF2-65n9Mkyc.js} +1 -1
- package/dist/ui/assets/chunk-MI3HLSF2-65n9Mkyc.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js +2 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js.gz +0 -0
- package/dist/ui/assets/{chunk-QN33PNHL-DIHGQ_pd.js → chunk-QN33PNHL-DsRKK6NR.js} +1 -1
- package/dist/ui/assets/{chunk-QXUST7PY-C9l0muI0.js → chunk-QXUST7PY-BCYnMiS3.js} +1 -1
- package/dist/ui/assets/chunk-QXUST7PY-BCYnMiS3.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-HucAw4xW.js +1 -0
- package/dist/ui/assets/{chunk-S3R3BYOJ-VJiLzt2o.js → chunk-S3R3BYOJ-CWMEa9Dc.js} +1 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-CWMEa9Dc.js.gz +0 -0
- package/dist/ui/assets/{chunk-TZMSLE5B-DZwI0C_2.js → chunk-TZMSLE5B-BuQUQcTr.js} +1 -1
- package/dist/ui/assets/chunk-TZMSLE5B-BuQUQcTr.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-CUT3rPTB.js +1 -0
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-CUT3rPTB.js +1 -0
- package/dist/ui/assets/{cose-bilkent-S5V4N54A-Ipik-oSD.js → cose-bilkent-S5V4N54A-CnPB3ARO.js} +1 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-CnPB3ARO.js.gz +0 -0
- package/dist/ui/assets/cursor-QEb7m-rN.png +0 -0
- package/dist/ui/assets/{dagre-6UL2VRFP-BDpyWQnh.js → dagre-6UL2VRFP-DhS-k_Se.js} +1 -1
- package/dist/ui/assets/dagre-6UL2VRFP-DhS-k_Se.js.gz +0 -0
- package/dist/ui/assets/{dagre-CgA4KhUX.js → dagre-KgLoHEuy.js} +1 -1
- package/dist/ui/assets/dagre-KgLoHEuy.js.gz +0 -0
- package/dist/ui/assets/{diagram-PSM6KHXK-B4GRzxLJ.js → diagram-PSM6KHXK-BZg3MJmb.js} +1 -1
- package/dist/ui/assets/diagram-PSM6KHXK-BZg3MJmb.js.gz +0 -0
- package/dist/ui/assets/{diagram-QEK2KX5R-BWPW28XI.js → diagram-QEK2KX5R-BPCitvbo.js} +1 -1
- package/dist/ui/assets/diagram-QEK2KX5R-BPCitvbo.js.gz +0 -0
- package/dist/ui/assets/{diagram-S2PKOQOG-BIHhcGoV.js → diagram-S2PKOQOG-NW4uK6sx.js} +1 -1
- package/dist/ui/assets/diagram-S2PKOQOG-NW4uK6sx.js.gz +0 -0
- package/dist/ui/assets/{editor-C-HJ7Yw0.js → editor-CzFWIUw2.js} +1 -1
- package/dist/ui/assets/editor-CzFWIUw2.js.gz +0 -0
- package/dist/ui/assets/{emoji-D8F6B62m.js → emoji-Dkz4Zzv_.js} +1 -1
- package/dist/ui/assets/emoji-Dkz4Zzv_.js.gz +0 -0
- package/dist/ui/assets/{erDiagram-Q2GNP2WA-ubTaAFcK.js → erDiagram-Q2GNP2WA-me1fboaf.js} +1 -1
- package/dist/ui/assets/erDiagram-Q2GNP2WA-me1fboaf.js.gz +0 -0
- package/dist/ui/assets/{flowDiagram-NV44I4VS-BHLCTYjI.js → flowDiagram-NV44I4VS-DzE8dGsh.js} +1 -1
- package/dist/ui/assets/flowDiagram-NV44I4VS-DzE8dGsh.js.gz +0 -0
- package/dist/ui/assets/{ganttDiagram-LVOFAZNH-ClC3pay1.js → ganttDiagram-LVOFAZNH-CFQD09Mi.js} +2 -2
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-CFQD09Mi.js.gz +0 -0
- package/dist/ui/assets/{gitGraph-F6HP7TQM-DghoobE6.js → gitGraph-F6HP7TQM-CfFE_uAC.js} +1 -1
- package/dist/ui/assets/{gitGraphDiagram-NY62KEGX-Clqpiswu.js → gitGraphDiagram-NY62KEGX-CaVoxU4C.js} +1 -1
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-CaVoxU4C.js.gz +0 -0
- package/dist/ui/assets/index-BN5_Qq7R.js +324 -0
- package/dist/ui/assets/index-BN5_Qq7R.js.gz +0 -0
- package/dist/ui/assets/index-DxuPq13l.css +1 -0
- package/dist/ui/assets/index-DxuPq13l.css.gz +0 -0
- package/dist/ui/assets/{info-NVLQJR56-0ZldEXPQ.js → info-NVLQJR56-i_xHYg3f.js} +1 -1
- package/dist/ui/assets/{infoDiagram-ER5ION4S-DMmPX-il.js → infoDiagram-ER5ION4S-2NL93b78.js} +1 -1
- package/dist/ui/assets/{journeyDiagram-XKPGCS4Q-CrVickA2.js → journeyDiagram-XKPGCS4Q-CZF-2DHU.js} +1 -1
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CZF-2DHU.js.gz +0 -0
- package/dist/ui/assets/{kanban-definition-3W4ZIXB7-C_BsdHYL.js → kanban-definition-3W4ZIXB7-CfvJIOny.js} +1 -1
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-CfvJIOny.js.gz +0 -0
- package/dist/ui/assets/{line-CfBP7Yic.js → line-DDv8kOJk.js} +1 -1
- package/dist/ui/assets/{linear-BsjageUB.js → linear-Daef-l29.js} +1 -1
- package/dist/ui/assets/linear-Daef-l29.js.gz +0 -0
- package/dist/ui/assets/{mermaid-parser.core-DZdP-NFq.js → mermaid-parser.core-CdK9QgYV.js} +2 -2
- package/dist/ui/assets/mermaid-parser.core-CdK9QgYV.js.gz +0 -0
- package/dist/ui/assets/{mermaid.core-TNrI0pHG.js → mermaid.core-D6GS9mU-.js} +3 -3
- package/dist/ui/assets/mermaid.core-D6GS9mU-.js.gz +0 -0
- package/dist/ui/assets/message-SqLqNYcv.js +36 -0
- package/dist/ui/assets/message-SqLqNYcv.js.gz +0 -0
- package/dist/ui/assets/{mindmap-definition-VGOIOE7T-BbmaUjMY.js → mindmap-definition-VGOIOE7T-Cb3QMflX.js} +1 -1
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-Cb3QMflX.js.gz +0 -0
- package/dist/ui/assets/{packet-BFZMPI3H-D_ZhkXuT.js → packet-BFZMPI3H-Bm2uwz4i.js} +1 -1
- package/dist/ui/assets/{particles-Dv28pjOd.js → particles-DsJFOarW.js} +1 -1
- package/dist/ui/assets/particles-DsJFOarW.js.gz +0 -0
- package/dist/ui/assets/{pie-7BOR55EZ-Dn0Q3qNx.js → pie-7BOR55EZ-5i17tVnF.js} +1 -1
- package/dist/ui/assets/{pieDiagram-ADFJNKIX-BbyjfYu8.js → pieDiagram-ADFJNKIX-BxIwQWvw.js} +1 -1
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BxIwQWvw.js.gz +0 -0
- package/dist/ui/assets/{quadrantDiagram-AYHSOK5B-Bc3GqMKz.js → quadrantDiagram-AYHSOK5B-B5HPe4ga.js} +1 -1
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-B5HPe4ga.js.gz +0 -0
- package/dist/ui/assets/{radar-NHE76QYJ-BHwoAy1q.js → radar-NHE76QYJ-BTn-tq0k.js} +1 -1
- package/dist/ui/assets/{reactflow-BVYPxNhc.js → reactflow-Bf74ngoo.js} +2 -2
- package/dist/ui/assets/reactflow-Bf74ngoo.js.gz +0 -0
- package/dist/ui/assets/{requirementDiagram-UZGBJVZJ-BQaKKL09.js → requirementDiagram-UZGBJVZJ-YfI6llkX.js} +1 -1
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-YfI6llkX.js.gz +0 -0
- package/dist/ui/assets/{sandpack-BQW_FQ7G.js → sandpack-D7koO5op.js} +1 -1
- package/dist/ui/assets/sandpack-D7koO5op.js.gz +0 -0
- package/dist/ui/assets/{sankeyDiagram-TZEHDZUN-DiJvDvhb.js → sankeyDiagram-TZEHDZUN-DOk_B10B.js} +1 -1
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DOk_B10B.js.gz +0 -0
- package/dist/ui/assets/{sequenceDiagram-WL72ISMW-Dw32824o.js → sequenceDiagram-WL72ISMW-DAe4Um17.js} +1 -1
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-DAe4Um17.js.gz +0 -0
- package/dist/ui/assets/{stateDiagram-FKZM4ZOC-BCOpNdHV.js → stateDiagram-FKZM4ZOC-CCesDu_C.js} +1 -1
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-CCesDu_C.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-CMlIrsoO.js +1 -0
- package/dist/ui/assets/{syntax-VJrU5BEu.js → syntax-C-M-8jOU.js} +1 -1
- package/dist/ui/assets/syntax-C-M-8jOU.js.gz +0 -0
- package/dist/ui/assets/{theme-DZtFA8b4.js → theme-BQZdiqwv.js} +1 -1
- package/dist/ui/assets/{timeline-definition-IT6M3QCI-Jh_WZzXv.js → timeline-definition-IT6M3QCI-D6P5txjT.js} +1 -1
- package/dist/ui/assets/timeline-definition-IT6M3QCI-D6P5txjT.js.gz +0 -0
- package/dist/ui/assets/{treemap-KMMF4GRG-CPYIgjxE.js → treemap-KMMF4GRG-Bitm3gy4.js} +1 -1
- package/dist/ui/assets/{knowledgeRoutes-CivaUqha.js → useUserLocalStorage-Ckb8HsIw.js} +1 -1
- package/dist/ui/assets/useUserLocalStorage-Ckb8HsIw.js.gz +0 -0
- package/dist/ui/assets/{xychartDiagram-PRI3JC2R-CERc7Rdb.js → xychartDiagram-PRI3JC2R-CsybjUbd.js} +1 -1
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CsybjUbd.js.gz +0 -0
- package/dist/ui/index.html +13 -11
- package/dist/ui/index.html.gz +0 -0
- package/package.json +10 -9
- package/dist/ui/assets/App-9s2WHM6S.js +0 -22
- package/dist/ui/assets/App-9s2WHM6S.js.gz +0 -0
- package/dist/ui/assets/App-BAdBsEnV.css.gz +0 -0
- package/dist/ui/assets/ArtifactConsentModal-ParNk5kW.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js +0 -9
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js +0 -18
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js.gz +0 -0
- package/dist/ui/assets/CodeEditor.inner-D51Z_CLQ.js.gz +0 -0
- package/dist/ui/assets/ConversationView-Dyddw2b1.js +0 -34
- package/dist/ui/assets/ConversationView-Dyddw2b1.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-CdftslnF.js +0 -24
- package/dist/ui/assets/KnowledgePage-CdftslnF.js.gz +0 -0
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js +0 -1
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js.gz +0 -0
- package/dist/ui/assets/StreamdownDemoPage-B9wbgp2s.js.gz +0 -0
- package/dist/ui/assets/ThemeSwitcher-ubn6IOz9.js.gz +0 -0
- package/dist/ui/assets/antd-C-HfEC4E.js +0 -400
- package/dist/ui/assets/antd-C-HfEC4E.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-dkBewUpN.js +0 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-ChmZt3zk.js.gz +0 -0
- package/dist/ui/assets/blockDiagram-VD42YOAC-CzGHAHao.js.gz +0 -0
- package/dist/ui/assets/c4Diagram-YG6GDRKO-DscJyaWN.js.gz +0 -0
- package/dist/ui/assets/channel-DvRQqEqC.js +0 -1
- package/dist/ui/assets/chunk-55IACEB6-DojF2pZN.js +0 -1
- package/dist/ui/assets/chunk-ABZYJK2D-RzDCrjE6.js.gz +0 -0
- package/dist/ui/assets/chunk-AGHRB4JF-jidCS5Of.js.gz +0 -0
- package/dist/ui/assets/chunk-ATLVNIR6-BEIIfJtC.js.gz +0 -0
- package/dist/ui/assets/chunk-B4BG7PRW-B8b6dQQ2.js.gz +0 -0
- package/dist/ui/assets/chunk-DI55MBZ5-BfATX3V8.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-BKt6lPJM.js +0 -1
- package/dist/ui/assets/chunk-HN2XXSSU-BCHvD80g.js.gz +0 -0
- package/dist/ui/assets/chunk-JA3XYJ7Z-Cp6dqHnY.js.gz +0 -0
- package/dist/ui/assets/chunk-JZLCHNYA-cKMooY3y.js.gz +0 -0
- package/dist/ui/assets/chunk-MI3HLSF2-BlzO5wOE.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js +0 -2
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js.gz +0 -0
- package/dist/ui/assets/chunk-QXUST7PY-C9l0muI0.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-CZskCFCf.js +0 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-VJiLzt2o.js.gz +0 -0
- package/dist/ui/assets/chunk-TZMSLE5B-DZwI0C_2.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-BFASUbmZ.js +0 -1
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-BFASUbmZ.js +0 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-Ipik-oSD.js.gz +0 -0
- package/dist/ui/assets/dagre-6UL2VRFP-BDpyWQnh.js.gz +0 -0
- package/dist/ui/assets/dagre-CgA4KhUX.js.gz +0 -0
- package/dist/ui/assets/diagram-PSM6KHXK-B4GRzxLJ.js.gz +0 -0
- package/dist/ui/assets/diagram-QEK2KX5R-BWPW28XI.js.gz +0 -0
- package/dist/ui/assets/diagram-S2PKOQOG-BIHhcGoV.js.gz +0 -0
- package/dist/ui/assets/editor-C-HJ7Yw0.js.gz +0 -0
- package/dist/ui/assets/emoji-D8F6B62m.js.gz +0 -0
- package/dist/ui/assets/erDiagram-Q2GNP2WA-ubTaAFcK.js.gz +0 -0
- package/dist/ui/assets/flowDiagram-NV44I4VS-BHLCTYjI.js.gz +0 -0
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-ClC3pay1.js.gz +0 -0
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-Clqpiswu.js.gz +0 -0
- package/dist/ui/assets/index-D9OElx9A.css +0 -1
- package/dist/ui/assets/index-D9OElx9A.css.gz +0 -0
- package/dist/ui/assets/index-DxPuzG7E.js +0 -350
- package/dist/ui/assets/index-DxPuzG7E.js.gz +0 -0
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CrVickA2.js.gz +0 -0
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-C_BsdHYL.js.gz +0 -0
- package/dist/ui/assets/knowledgeRoutes-CivaUqha.js.gz +0 -0
- package/dist/ui/assets/linear-BsjageUB.js.gz +0 -0
- package/dist/ui/assets/mermaid-parser.core-DZdP-NFq.js.gz +0 -0
- package/dist/ui/assets/mermaid.core-TNrI0pHG.js.gz +0 -0
- package/dist/ui/assets/message-BtWWJ9Af.js +0 -36
- package/dist/ui/assets/message-BtWWJ9Af.js.gz +0 -0
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-BbmaUjMY.js.gz +0 -0
- package/dist/ui/assets/particles-Dv28pjOd.js.gz +0 -0
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BbyjfYu8.js.gz +0 -0
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-Bc3GqMKz.js.gz +0 -0
- package/dist/ui/assets/reactflow-BVYPxNhc.js.gz +0 -0
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-BQaKKL09.js.gz +0 -0
- package/dist/ui/assets/sandpack-BQW_FQ7G.js.gz +0 -0
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DiJvDvhb.js.gz +0 -0
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-Dw32824o.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-BCOpNdHV.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-Cuqwvgfg.js +0 -1
- package/dist/ui/assets/syntax-VJrU5BEu.js.gz +0 -0
- package/dist/ui/assets/timeline-definition-IT6M3QCI-Jh_WZzXv.js.gz +0 -0
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CERc7Rdb.js.gz +0 -0
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeEditor.inner-D51Z_CLQ.js","assets/rolldown-runtime--c01j_DQ.js","assets/sandpack-BQW_FQ7G.js","assets/antd-C-HfEC4E.js","assets/editor-C-HJ7Yw0.js","assets/angular-html-HOxwNvyT.js","assets/html-B2jixUwZ.js","assets/css-DoNhQY6j.js","assets/javascript-B0z-AXw4.js","assets/angular-ts-Ov9R9Ljq.js","assets/scss-DbrHP5dI.js","assets/apl-CXOUvgw5.js","assets/json-DXfqaPEF.js","assets/xml-BGEfOfoz.js","assets/java-DUjKRM5T.js","assets/astro-CVgXjgWt.js","assets/postcss-BXeXVLqQ.js","assets/tsx-37JSciWV.js","assets/typescript-CdMIlDjx.js","assets/blade-BoqMnz_b.js","assets/html-derivative-DDwnamny.js","assets/sql-DF8Xc7bQ.js","assets/bsl-BkkzgIyY.js","assets/sdbl-bTVj8UrX.js","assets/c-DOayRvVf.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/cobol-Xel1q7J4.js","assets/coffee-CPGd8RFL.js","assets/cpp-DcSExVLf.js","assets/glsl-CDvScVSv.js","assets/regexp-B9Q6kuZt.js","assets/crystal-DSuicNBl.js","assets/shellscript-DmsGrsQL.js","assets/edge-193c5yJY.js","assets/elixir-ND4M129Z.js","assets/elm-2Xpf1qa1.js","assets/erb-B3CzWkDu.js","assets/ruby-BGs-nVm6.js","assets/graphql-CLdnI2jj.js","assets/jsx-xIBTuBAZ.js","assets/haml-B_7gR2-C.js","assets/lua-CdPd6TdG.js","assets/yaml-Ce3AqKtC.js","assets/erlang-Cphh6RMH.js","assets/markdown-BYOwaDjH.js","assets/fortran-fixed-form-BJLMMyj_.js","assets/fortran-free-form-B3N2jM_P.js","assets/fsharp-D13ZGOAj.js","assets/gdresource-DJtKbqXX.js","assets/gdscript-CtYHxktr.js","assets/gdshader-CBce3t8t.js","assets/git-commit-BSykSTBG.js","assets/diff-woXpYk--.js","assets/git-rebase-CPlAfnUu.js","assets/glimmer-js-CxAZE7iu.js","assets/glimmer-ts-CNJweuJS.js","assets/hack-U_u3qiXF.js","assets/handlebars-CIGlWSZz.js","assets/http-BEmBIeh2.js","assets/hurl-BoVPi727.js","assets/csv-Dx-8-gkx.js","assets/hxml-B0Qn7Nwc.js","assets/haxe-OTjmBuCE.js","assets/jinja-DHg7q1DE.js","assets/jison-Bi4c9iNP.js","assets/julia-w0S0kN7z.js","assets/r-D6SIBEiO.js","assets/latex-ed26ywxS.js","assets/tex-C_btdDbR.js","assets/liquid-CAruNf-N.js","assets/marko-DJQST3lL.js","assets/less-DVTAwKKz.js","assets/mdc-BpPhzEd0.js","assets/nginx-D0L6l3UG.js","assets/nim-CXwZWzWk.js","assets/perl-Bu8Q5Bv6.js","assets/php-B4SpY2t5.js","assets/pug-BaOpKkdB.js","assets/qml-sjeCigfm.js","assets/razor-BDd5S6a7.js","assets/csharp-BEKXm5hI.js","assets/rst-BIVXRxMh.js","assets/cmake-Bj61d0ZC.js","assets/sas-B2Nr8S2D.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-BLlGThAF.js","assets/soy-y67J1JBf.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-DWwtR4o7.js","assets/svelte-BVXg4aFm.js","assets/templ-B35jE-cr.js","assets/go-DNk2CfY5.js","assets/ts-tags-B1RVrAVr.js","assets/twig-BaTGNYMW.js","assets/vue-C1368MUJ.js","assets/vue-html-CMU60TJw.js","assets/vue-vine-B0ZobtBU.js","assets/stylus-B6D30XZt.js","assets/xsl-D3QHn1W2.js","assets/mermaid.core-TNrI0pHG.js","assets/chunk-JA3XYJ7Z-Cp6dqHnY.js","assets/reactflow-BVYPxNhc.js","assets/reactflow-8hax8RNO.css","assets/chunk-AGHRB4JF-jidCS5Of.js","assets/chunk-S3R3BYOJ-VJiLzt2o.js","assets/dist-CSqJezV7.js","assets/math-Bi_r_ZWc.js","assets/chunk-ABZYJK2D-RzDCrjE6.js","assets/isArrayLikeObject-CjHW3d_5.js","assets/isEmpty-CyN-1FA0.js","assets/chunk-6MN3ZHY7-Chms2Ycd.js","assets/chunk-ATLVNIR6-BEIIfJtC.js","assets/chunk-CVBHYZKI-D-mQAfrk.js","assets/chunk-EXTU4WIE-BKt6lPJM.js","assets/chunk-HN2XXSSU-BCHvD80g.js","assets/chunk-JZLCHNYA-cKMooY3y.js","assets/chunk-MI3HLSF2-BlzO5wOE.js","assets/chunk-N4CR4FBY-pASDorUx.js","assets/chunk-QXUST7PY-C9l0muI0.js","assets/line-CfBP7Yic.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/katex-C_WiJGP_.css","assets/App-9s2WHM6S.js","assets/ConversationView-Dyddw2b1.js","assets/AutocompleteTextarea-3RchrIgk.js","assets/message-BtWWJ9Af.js","assets/__vite-browser-external-BBPYNvOp.js","assets/theme-DZtFA8b4.js","assets/emoji-D8F6B62m.js","assets/AutocompleteTextarea-x1XGuNl0.css","assets/ArtifactConsentModal-ParNk5kW.js","assets/ThemeSwitcher-ubn6IOz9.js","assets/knowledgeRoutes-CivaUqha.js","assets/xterm-BkujP7YO.js","assets/xterm-BrP-ENHg.css","assets/App-BAdBsEnV.css","assets/KnowledgePage-CdftslnF.js","assets/ArtifactFullscreenPage-VQxLMCiN.js","assets/MobileApp-BdBMpnJ1.js","assets/StreamdownDemoPage-B9wbgp2s.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e,r as t,t as n}from"./rolldown-runtime--c01j_DQ.js";import{$ as r,$t as i,A as a,An as o,At as s,B as c,Bt as l,C as u,Cn as d,Ct as f,D as p,E as m,En as h,Et as g,F as _,Ft as v,G as y,Gn as b,Gt as x,H as S,Hn as C,Ht as w,I as T,In as E,It as D,Jn as O,K as k,Kn as A,Kt as ee,L as j,Ln as M,Lt as N,M as te,Mn as P,Mt as ne,Nn as re,Nt as ie,O as ae,Ot as oe,P as F,Pn as se,Pt as ce,Qt as le,Rn as ue,Rt as de,Sn as fe,Tn as pe,Tt as me,U as he,Un as ge,Ut as _e,V as ve,Vt as ye,W as be,Wn as I,Wt as xe,X as Se,Xn as Ce,Xt as we,Y as Te,Yt as Ee,Z as De,Zt as L,_n as Oe,_t as ke,a as Ae,b as je,bn as Me,cn as R,d as Ne,dn as Pe,dt as Fe,et as Ie,fn as Le,gt as Re,h as ze,i as Be,in as Ve,it as He,jn as Ue,jt as We,kn as Ge,l as Ke,ln as qe,m as Je,mt as Ye,n as Xe,nn as Ze,nt as Qe,o as $e,on as z,ot as et,pn as tt,pt as nt,qn as rt,qt as it,rn as at,s as ot,sn as st,st as ct,tn as B,u as lt,v as ut,vn as dt,vt as ft,w as pt,wn as V,wt as mt,xn as ht,xt as gt,y as _t,yn as vt,z as yt,zt as bt}from"./antd-C-HfEC4E.js";import{A as xt,B as St,Ct,D as wt,E as Tt,F as Et,H as Dt,I as Ot,L as kt,M as At,N as jt,O as Mt,P as Nt,R as Pt,S as Ft,St as It,T as Lt,Tt as Rt,U as zt,V as Bt,W as Vt,_ as Ht,_t as Ut,at as Wt,b as Gt,bt as Kt,c as qt,d as Jt,f as Yt,ft as Xt,g as Zt,gt as Qt,h as $t,ht as en,i as tn,it as nn,j as rn,k as an,m as on,mt as sn,n as cn,o as ln,ot as un,pt as dn,rt as fn,s as pn,t as mn,u as hn,ut as gn,v as _n,vt as vn,w as yn,wt as bn,x as xn,xt as Sn,y as Cn,yt as wn,z as Tn}from"./message-BtWWJ9Af.js";import{c as H,o as En,s as Dn}from"./sandpack-BQW_FQ7G.js";import{N as On}from"./editor-C-HJ7Yw0.js";import{n as kn,r as An,t as jn}from"./particles-Dv28pjOd.js";import{a as Mn,i as Nn,r as Pn}from"./emoji-D8F6B62m.js";import{a as Fn,c as In,d as Ln,f as Rn,i as zn,l as Bn,n as Vn,o as Hn,p as Un,r as Wn,s as Gn,t as Kn,u as qn}from"./syntax-VJrU5BEu.js";import{n as Jn}from"./theme-DZtFA8b4.js";import{t as Yn}from"./katex-CamJ39w1.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Xn={session:(e=>[e.title,e.description,e.agentic_tool]),branch:(e=>[e.name,e.ref,e.notes,e.issue_url,e.pull_request_url,Xt(e)?.displayName]),artifact:(e=>[e.name,e.description]),board:(e=>[e.name,e.description]),mcp:(e=>[e.name,e.display_name,e.description])};function Zn(e,t){let n=e.map(e=>e.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!1;let r=t.filter(e=>!!e).join(`
|
|
3
|
-
`).toLowerCase();return n.every(e=>r.includes(e))}function Qn(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}var $n=O(),U=e(Ce(),1),W=On(),er=(0,U.forwardRef)(({variant:e=`outlined`,...t},n)=>(0,W.jsx)(v,{ref:n,variant:e,...t}));er.displayName=`Tag`,v.CheckableTag;var tr=Object.assign(er,{CheckableTag:v.CheckableTag}),nr=`/ui/assets/cc-CYmbalCD.png`,rr=`/ui/assets/claude-code-cli-D5DHHf2_.png`,ir=`/ui/assets/codex-4sLD1mVS.png`,ar=`/ui/assets/copilot-CI1k0esO.png`,or=`/ui/assets/gemini-ajOb7iAl.png`,sr=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAADWklEQVR4nGKRktJjGEyAaaAdgA5GHUQIjDqIEBh1ECEw6iBCYNRBhMCgcxALkeoc7C3zchK5ubnIsOP48bMNzf1EKmYkprYXEhI4enA9Hx/PxUvXDh859f//f+JdE+jvwcvLraXnTKR6okKoqCCVj4/n/v1HAUEpv37/Jt41/Hy8oSE+fRNmE6+FcBpSU1WKjQ5mYGC4fPUmSa5hYGCoqy188eLV/IWriNdCOIQa6gpZWJhJcgcE2NmaBwW4e/jE/f37j2oOcnW2tbezwCrFz8+XEB8qyM+HS6+Pj8uPHz8jw/0YYEnu379/O3YdOHX6IvkOqq7MxSU1a3q7srLC2nXbfvz4iVXB0mXr0UT0dDWXLJxkYOLx7dt3chzEwcGuqqqIVSrA393czNDVI+r2nQd4TEADQoL8ly/sERTgx+MgfImakZERqzg3N2dNVd6yFRtJcg0DAwMxiYmEklpIkB/CyMtJ4uPlmTBxDkmuIRIQW1IzMDBYWZqkpURdvnIjLSX6zNmLIiJCIiJCBHX9Z2C4d+/hz5+/iLQFX0nNyclx58ZhZJF/IPD/P8P////+MzD8hwEoC5chp05fCA5Lh5ST1y7vM7P0ffrsBS5LiQ2hHz9+5hfVb9+xn6RChYGBYeWyaSRVNfgchJyoG5r6tmzdS5JTGBgYHB0sLcwN3b1iiNdCVKJet3774qXrSHUNGxtrU33xvAUrb9y8CxFhZmYCpyp8AYYvhP7+/csADu2qmk40KStLYxNj/M0ERhtrUyUlee0Xr/NyEiFChgY6//79//zpC5kO+vnz17adB7w8HPfsXP7l61dkKSVFudNnLl2/cRuP9us3bkMUCAsLMjAw8HBzu7nYXrl26/OXr/j8gb89xMjIaKCvxcrKiizY1lz29dv3oNBUkhK4sLDg2ZPbCoobNmzciUcZgVz2////8xeuIosE+LvLykq5ekaTmt0a6grPX7iC3zWkFYwMDAwiwoItjSWNzRMePXpKkkZrKxN/P3dv3ziCKklzUFFh2rdvP46fPKugIEu8LilJ8e6O6tWrt1y+cpPKDrp+/ba7q926VbNI0vXnz9+jx07XNfYSo5ioRj49waDrl406iBAYdRAhMOogQmDUQYTAqIMIgUHnIEAAAAD//xjiMCmHkZcfAAAAAElFTkSuQmCC`,{useToken:cr}=ce,lr={"claude-code":nr,"claude-code-cli":rr,codex:ir,gemini:or,opencode:sr,copilot:ar},ur=new Set([`claude-code-cli`]),dr=({tool:e,size:t=32,className:n=``})=>{let{token:r}=cr(),i=lr[e],a=ur.has(e)?`#fff`:`#000`;return i?(0,W.jsx)(`div`,{className:`tool-icon ${n}`,style:{width:t,height:t,borderRadius:`50%`,background:a,border:`1px solid ${r.colorBorder}`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:t*.1,flexShrink:0,overflow:`hidden`},children:(0,W.jsx)(`img`,{src:i,alt:`${e} logo`,style:{width:`100%`,height:`100%`,objectFit:`contain`}})}):(0,W.jsx)(`div`,{className:`tool-icon ${n}`,style:{width:t,height:t,borderRadius:`50%`,background:a,border:`1px solid ${r.colorBorder}`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:t*.6,flexShrink:0},children:{"claude-code":`🤖`,codex:`💻`,gemini:`💎`,opencode:`🌐`,copilot:`✈️`,cursor:`⌘`}[e]||`🤖`})},fr=({agent:e,selected:t=!1,onClick:n})=>(0,W.jsx)(Me,{hoverable:!0,onClick:n,style:{borderColor:t?`#1890ff`:void 0,borderWidth:t?2:1,cursor:`pointer`},styles:{body:{padding:12}},children:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},size:4,children:[(0,W.jsx)(z,{style:{width:`100%`,justifyContent:`space-between`},size:8,children:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(dr,{tool:e.id,size:24}),(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:`14px`},children:e.name}),e.beta&&(0,W.jsx)(tr,{color:`warning`,children:`BETA`})]})}),e.version&&(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:`11px`},children:[`Version: `,e.version]}),e.description&&(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:`12px`},children:e.description})]})}),{Text:pr}=s,mr=({agents:e,selectedAgentId:t,onSelect:n,variant:r=`cards`,columns:i=3,showHelperText:a=!1,helperText:o=`Click on an agent card to select it`,showComparisonLink:s=!1})=>r===`select`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(P,{value:t??void 0,onChange:e=>n(e),style:{width:`100%`},options:e.map(e=>({value:e.id,label:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(dr,{tool:e.id,size:16}),(0,W.jsx)(`span`,{children:e.name}),e.beta&&(0,W.jsx)(tr,{color:`warning`,children:`BETA`})]})}))}),s&&(0,W.jsx)(hr,{})]}):(0,W.jsxs)(W.Fragment,{children:[a&&!t&&(0,W.jsx)(pr,{type:`secondary`,style:{fontSize:12,marginBottom:8,display:`block`},children:o}),(0,W.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${i}, 1fr)`,gap:8,marginTop:8},children:e.map(e=>(0,W.jsx)(fr,{agent:e,selected:t===e.id,onClick:()=>n(e.id)},e.id))}),s&&(0,W.jsx)(hr,{})]}),hr=()=>(0,W.jsxs)(pr,{type:`secondary`,style:{fontSize:11,marginTop:8,display:`block`,textAlign:`center`},children:[`Compare features:`,` `,(0,W.jsx)(`a`,{href:`https://agor.live/guide/sdk-comparison`,target:`_blank`,rel:`noopener noreferrer`,children:`SDK Comparison Guide`})]}),gr=[{id:`claude-code`,name:`Claude Code`,icon:`🤖`,description:`Anthropic Claude coding agent`},{id:`codex`,name:`Codex`,icon:`💻`,description:`OpenAI Codex coding agent`},{id:`gemini`,name:`Gemini`,icon:`💎`,description:`Google Gemini coding agent`},{id:`opencode`,name:`OpenCode`,icon:`🌐`,description:`Open-source terminal AI with 75+ LLM providers`,beta:!0},{id:`cursor`,name:`Cursor SDK`,icon:`⌘`,description:`Cursor agentic runtime via the Cursor SDK`,beta:!0},{id:`copilot`,name:`GitHub Copilot`,icon:`✈️`,description:`GitHub Copilot agentic runtime`,beta:!0},{id:`claude-code-cli`,name:`Claude Code CLI`,icon:`🤖`,description:`Anthropic Claude CLI, billed to your Pro/Max subscription`,beta:!0}],_r={buildSha:null,userEmail:null};function vr(e){_r={..._r,...e}}function yr(){return _r}var br=`https://github.com/preset-io/agor/issues/new`,xr=4e3;function Sr(e){return e?e.match(/in\s+([A-Za-z0-9_$.]+)/)?.[1]??`unknown component`:`unknown component`}function Cr(e,t,n={}){let{buildSha:r,userEmail:i}=yr(),a=(n.now??new Date).toISOString(),o=n.href??(typeof window<`u`?window.location.href:`unknown`),s=n.userAgent??(typeof navigator<`u`?navigator.userAgent:`unknown`),c=Sr(t?.componentStack);return[`## UI crash report`,``,`- **When:** ${a}`,`- **Where:** ${o}`,`- **Component:** ${c}`,`- **User:** ${i??`(not signed in)`}`,`- **Build:** ${r??`unknown`}`,`- **Browser:** ${s}`,`- **Error:** ${e.message||String(e)}`,``,`### Component stack`,"```",(t?.componentStack??`(unavailable)`).trim(),"```",``,`### Error stack`,"```",(e.stack??`(unavailable)`).trim(),"```",``].join(`
|
|
4
|
-
`)}function wr(e,t,n={}){let r=`UI crash: ${Sr(t?.componentStack)} — ${e.message?.slice(0,80)??`unknown error`}`,i=Cr(e,t,n);return i.length>4e3&&(i=`${i.slice(0,xr)}\n\n_(truncated — see full report copied to clipboard)_`),`${br}?${new URLSearchParams({title:r,body:i,labels:`bug`}).toString()}`}var{Title:Tr,Paragraph:Er,Text:Dr}=s;function Or({error:e,errorInfo:t}){let{token:n}=ce.useToken(),[i,a]=(0,U.useState)(!1),o=async()=>{await cn(Cr(e,t))&&(a(!0),setTimeout(()=>a(!1),2e3))},s=()=>{window.location.reload()},c=wr(e,t),l=Sr(t?.componentStack);return(0,W.jsx)(`div`,{style:{minHeight:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,backgroundColor:n.colorBgLayout},children:(0,W.jsxs)(Me,{style:{maxWidth:640,width:`100%`,textAlign:`center`},styles:{body:{padding:`2.5rem 2rem`}},children:[(0,W.jsx)(r,{style:{fontSize:96,color:n.colorTextTertiary,marginBottom:n.marginLG}}),(0,W.jsx)(Tr,{level:2,style:{marginTop:0,marginBottom:n.marginXS},children:`Well, that wasn't supposed to happen.`}),(0,W.jsx)(Er,{style:{color:n.colorTextSecondary,marginBottom:n.marginLG},children:`The UI hit an unexpected error and couldn't finish rendering. Reloading usually gets you going again. If it keeps happening, the report below will help us fix it.`}),(0,W.jsxs)(z,{wrap:!0,style:{justifyContent:`center`,marginBottom:n.marginLG},children:[(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:o,children:i?`Copied!`:`Copy error details`}),(0,W.jsx)(V,{icon:(0,W.jsx)(De,{}),href:c,target:`_blank`,rel:`noopener noreferrer`,children:`Report on GitHub`}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(x,{}),onClick:s,children:`Reload page`})]}),(0,W.jsx)(ue,{ghost:!0,items:[{key:`details`,label:(0,W.jsx)(Dr,{type:`secondary`,children:`Show technical details`}),children:(0,W.jsxs)(`div`,{style:{textAlign:`left`},children:[(0,W.jsxs)(Er,{style:{marginBottom:n.marginSM},children:[(0,W.jsx)(Dr,{strong:!0,children:`Component:`}),` `,(0,W.jsx)(Dr,{code:!0,children:l}),(0,W.jsx)(`br`,{}),(0,W.jsx)(Dr,{strong:!0,children:`Error:`}),` `,(0,W.jsx)(Dr,{code:!0,children:e.message||String(e)})]}),(0,W.jsx)(`pre`,{style:{maxHeight:240,overflow:`auto`,fontSize:12,padding:n.paddingSM,backgroundColor:n.colorBgContainerDisabled,borderRadius:n.borderRadiusSM,margin:0},children:(t?.componentStack??e.stack??`(no stack available)`).trim()})]})}]})]})})}var kr=class extends U.Component{state={error:null,errorInfo:null,resetKey:this.props.resetKey};static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{error:null,errorInfo:null,resetKey:e.resetKey}}componentDidCatch(e,t){console.error(`ErrorBoundary caught render error:`,e,t.componentStack),this.setState({errorInfo:t})}render(){let{error:e,errorInfo:t}=this.state,{variant:n=`scoped`,fallbackTitle:r,children:i}=this.props;return e?n===`global`?(0,W.jsx)(Or,{error:e,errorInfo:t}):(0,W.jsx)(I,{type:`error`,showIcon:!0,title:r??`Something went wrong rendering this view.`,description:e.message||String(e)}):i}},{Text:Ar}=s;function jr({open:e,user:t,onChangePassword:n,onLogout:r}){let[i]=B.useForm(),[a,o]=(0,U.useState)(!1),[s,l]=(0,U.useState)(null),{token:u}=ce.useToken();return(0,W.jsxs)(it,{title:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Xe,{style:{color:u.colorWarning,marginRight:8}}),`Password Change Required`]}),open:e,onOk:async()=>{if(t)try{let e=await i.validateFields();o(!0),l(null),await n(t.user_id,e.newPassword),i.resetFields()}catch(e){e instanceof Error&&l(e.message)}finally{o(!1)}},okText:`Change Password`,cancelText:`Logout`,onCancel:r,confirmLoading:a,closable:!1,mask:{closable:!1},keyboard:!1,width:400,children:[(0,W.jsx)(I,{type:`warning`,title:`Your administrator requires you to change your password before continuing.`,style:{marginBottom:24},showIcon:!0}),s&&(0,W.jsx)(I,{type:`error`,title:s,style:{marginBottom:16},showIcon:!0,closable:!0,onClose:()=>l(null)}),(0,W.jsxs)(B,{form:i,layout:`vertical`,children:[(0,W.jsx)(B.Item,{name:`newPassword`,label:`New Password`,rules:[{required:!0,message:`Please enter a new password`},{min:8,message:`Password must be at least 8 characters`}],children:(0,W.jsx)(L.Password,{prefix:(0,W.jsx)(c,{style:{color:u.colorTextQuaternary}}),placeholder:`Enter new password`,autoComplete:`new-password`})}),(0,W.jsx)(B.Item,{name:`confirmPassword`,label:`Confirm Password`,dependencies:[`newPassword`],rules:[{required:!0,message:`Please confirm your password`},({getFieldValue:e})=>({validator(t,n){return!n||e(`newPassword`)===n?Promise.resolve():Promise.reject(Error(`Passwords do not match`))}})],children:(0,W.jsx)(L.Password,{prefix:(0,W.jsx)(c,{style:{color:u.colorTextQuaternary}}),placeholder:`Confirm new password`,autoComplete:`new-password`})})]}),(0,W.jsx)(Ar,{type:`secondary`,style:{fontSize:12},children:`After changing your password, you will be able to continue using the application.`})]})}var Mr=new Set([`sessions`,`branches`,`boards`,`repos`,`users`,`mcp-servers`,`artifacts`]);function Nr({phase:e=`loading`,connecting:t=!1,loadingStage:n=`fetching`,items:r=[],message:i}){let{token:a}=ce.useToken(),[o,c]=(0,U.useState)(!1),l=i??(t?`Connecting to daemon…`:n===`indexing`?`Indexing workspace data…`:`Loading workspace data…`),u=!t&&r.length>0,d=r.filter(e=>Mr.has(e.key)),f=r.filter(e=>!Mr.has(e.key)),p=f.filter(e=>e.done).length,m=f.length-p,h=m>0?`Show details (${m} pending)`:`Show details (${p}/${f.length} loaded)`,g=({key:e,label:t,done:n,count:r})=>(0,W.jsxs)(Ve,{align:`center`,justify:`space-between`,gap:a.sizeSM,children:[(0,W.jsxs)(Ve,{align:`center`,gap:a.sizeSM,children:[(0,W.jsx)(Ve,{align:`center`,justify:`center`,style:{width:a.sizeMD},children:n?(0,W.jsx)(A,{style:{color:a.colorSuccess}}):(0,W.jsx)(Ee,{size:`small`})}),(0,W.jsx)(s.Text,{type:n?`secondary`:void 0,disabled:!n,children:t})]}),(0,W.jsx)(tr,{color:n?`success`:void 0,variant:`filled`,style:{marginInlineEnd:0,minWidth:28,textAlign:`center`},children:r})]},e);return(0,W.jsxs)(Ve,{vertical:!0,align:`center`,justify:`center`,style:{minHeight:`100vh`,backgroundColor:a.colorBgLayout,opacity:e===`fading`?0:1,transition:`opacity 280ms ease-out`},children:[(0,W.jsx)(Ee,{size:`large`}),(0,W.jsx)(s.Text,{type:`secondary`,style:{marginTop:a.marginMD},children:l}),u&&(0,W.jsxs)(Ve,{vertical:!0,gap:a.sizeXXS,style:{marginTop:a.marginLG,minWidth:200},children:[d.map(g),f.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>c(e=>!e),style:{alignSelf:`center`,paddingInline:0},children:o?`Hide details`:h}),o&&f.map(g)]})]})]})}var Pr={1:`43px`,2:`34px`,3:`27px`,4:`23px`,5:`18px`},Fr=({level:e=3,style:t,className:n})=>(0,W.jsx)(`h1`,{className:n,style:{margin:0,fontSize:Pr[e],lineHeight:1.35,background:`linear-gradient(90deg, #2e9a92 0%, #7fe8df 50%, #a8f5ed 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`,fontWeight:700,width:`fit-content`,...t},children:`agor`}),Ir={background:{color:{value:`transparent`}},fpsLimit:60,interactivity:{events:{onHover:{enable:!0,mode:`attract`},resize:{enable:!0}},modes:{attract:{distance:200,duration:.4,speed:3}}},particles:{color:{value:`#2e9a92`},links:{color:`#2e9a92`,distance:150,enable:!0,opacity:.2,width:1},move:{direction:`none`,enable:!0,outModes:{default:`bounce`},random:!1,speed:1,straight:!1},number:{density:{enable:!0,width:1920,height:1080},value:150},opacity:{value:.4},shape:{type:`circle`},size:{value:{min:1,max:3}}},detectRetina:!0},Lr=t({ParticleBackground:()=>Rr}),Rr=(0,U.memo)(function(){let e=(0,U.useId)(),[t,n]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{kn(async e=>{await jn(e)}).then(()=>{n(!0)})},[]),t?(0,W.jsx)(An,{id:e,particlesLoaded:async e=>{},options:Ir,style:{position:`absolute`,width:`100%`,height:`100%`,top:0,left:0,zIndex:0}}):null}),{Text:zr}=s,Br=`agor user create-admin`;function Vr(){let{token:e}=ce.useToken();return(0,W.jsxs)(z,{orientation:`vertical`,size:4,style:{width:`100%`},children:[(0,W.jsx)(zr,{type:`secondary`,style:{fontSize:12},children:`First-time server setup? Create the initial admin account:`}),(0,W.jsx)(zr,{code:!0,copyable:{text:Br},style:{fontSize:12,background:e.colorFillTertiary,border:`1px solid ${e.colorBorderSecondary}`,borderRadius:e.borderRadiusSM,padding:`2px 6px`},children:Br})]})}function Hr({onLogin:e,loading:t=!1,error:n,externalLaunchLoginRedirectUrl:r}){let[i]=B.useForm(),[a,o]=(0,U.useState)(!1),[s,l]=(0,U.useState)(!1),{token:u}=ce.useToken(),d=!!r,f=!d||s,p=n?.startsWith(`Launch sign-in failed`)??!1;return(0,W.jsxs)(`div`,{style:{minHeight:`100dvh`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f1f1e 100%)`,padding:`16px`,position:`relative`,overflow:`auto`},children:[(0,W.jsx)(Rr,{}),(0,W.jsx)(`a`,{href:`https://particles.js.org`,target:`_blank`,rel:`noopener noreferrer`,style:{position:`fixed`,bottom:16,right:16,fontSize:10,color:`rgba(46, 154, 146, 0.3)`,textDecoration:`none`,zIndex:0,transition:`color 0.3s`},onMouseEnter:e=>{e.currentTarget.style.color=`rgba(46, 154, 146, 0.6)`},onMouseLeave:e=>{e.currentTarget.style.color=`rgba(46, 154, 146, 0.3)`},children:`🤍 tsparticles`}),(0,W.jsxs)(Me,{style:{width:`100%`,maxWidth:420,borderRadius:12,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.4)`,position:`relative`,zIndex:1,margin:`auto`},variant:`borderless`,children:[(0,W.jsx)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`,marginBottom:24},children:(0,W.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,W.jsx)(`img`,{src:`/ui/favicon.png`,alt:`Agor Logo`,style:{width:72,height:72,marginBottom:16,objectFit:`cover`,borderRadius:`50%`,display:`block`,margin:`0 auto 16px`}}),(0,W.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,marginBottom:12},children:(0,W.jsx)(Fr,{level:1})}),(0,W.jsx)(`div`,{children:(0,W.jsx)(zr,{type:`secondary`,children:`Team command center for all things agentic`})}),(0,W.jsx)(Oe,{style:{margin:`16px 0 0 0`}})]})}),n&&(0,W.jsx)(I,{type:`error`,title:p?`Launch sign-in failed`:`Login Failed`,description:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsx)(`div`,{children:n}),!p&&(0,W.jsx)(`div`,{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${u.colorBorderSecondary}`},children:(0,W.jsx)(Vr,{})})]}),showIcon:!0,closable:!0,style:{marginBottom:24}}),d&&(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`,marginBottom:24},children:[!n&&(0,W.jsx)(I,{type:`info`,title:`Open from your workspace`,description:`This runtime is configured for external launch sign-in. Return to your workspace to open a fresh launch link.`,showIcon:!0}),(0,W.jsx)(V,{type:`primary`,href:r,block:!0,"data-testid":`external-launch-return`,children:`Return to workspace`}),!s&&(0,W.jsx)(V,{type:`link`,block:!0,onClick:()=>l(!0),children:`Use local login instead`})]}),f&&(0,W.jsxs)(W.Fragment,{children:[d&&(0,W.jsx)(Oe,{style:{margin:`0 0 24px 0`},children:`Local login`}),(0,W.jsxs)(B,{form:i,name:`login`,layout:`vertical`,onFinish:async t=>{o(!0);try{await e(t.email,t.password)}finally{o(!1)}},autoComplete:`off`,children:[(0,W.jsx)(B.Item,{name:`email`,rules:[{required:!0,message:`Please enter your email`},{type:`email`,message:`Please enter a valid email`}],children:(0,W.jsx)(L,{prefix:(0,W.jsx)(j,{style:{color:u.colorTextQuaternary}}),placeholder:`Email address`,autoComplete:`email`})}),(0,W.jsx)(B.Item,{name:`password`,rules:[{required:!0,message:`Please enter your password`}],children:(0,W.jsx)(L.Password,{prefix:(0,W.jsx)(c,{style:{color:u.colorTextQuaternary}}),placeholder:`Password`,autoComplete:`current-password`})}),(0,W.jsx)(B.Item,{style:{marginBottom:8},children:(0,W.jsx)(V,{type:`primary`,htmlType:`submit`,loading:a||t,block:!0,children:`Sign In`})})]})]}),f&&!n&&(0,W.jsx)(`div`,{style:{textAlign:`center`,marginTop:24},children:(0,W.jsx)(Vr,{})})]})]})}var Ur=`preset-io/agor-assistant`,Wr=`https://github.com/preset-io/agor-assistant.git`;function Gr(e){let t,n;for(let r of e){if(r.slug?.includes(`agor-assistant-private`)||r.remote_url?.includes(`agor-assistant-private`))return r;!t&&r.slug===`preset-io/agor-assistant`&&(t=r),!n&&(r.remote_url?.includes(`agor-assistant`)||r.remote_url?.includes(`agor-openclaw`))&&(n=r)}return t||n}function Kr(e){return(0,U.useMemo)(()=>Gr(e),[e])}function qr(e,t){let n=[],r=new Map;for(let i of e){let e=i[1];t?.readyOnly&&e.clone_status!==`ready`&&e.clone_status!==void 0||(n.push(e),r.set(e.repo_id,i))}let i=Gr(n);if(i)return r.get(i.repo_id)}var Jr=n((e=>{e.__esModule=!0,e.extend=a,e.indexOf=l,e.escapeExpression=u,e.isEmpty=d,e.createFrame=f,e.blockParams=p,e.appendContextPath=m;var t={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"`":```,"=":`=`},n=/[&<>"'`=]/g,r=/[&<>"'`=]/;function i(e){return t[e]}function a(e){for(var t=1;t<arguments.length;t++)for(var n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&(e[n]=arguments[t][n]);return e}var o=Object.prototype.toString;e.toString=o;var s=function(e){return typeof e==`function`};s(/x/)&&(e.isFunction=s=function(e){return typeof e==`function`&&o.call(e)===`[object Function]`}),e.isFunction=s;var c=Array.isArray||function(e){return e&&typeof e==`object`?o.call(e)===`[object Array]`:!1};e.isArray=c;function l(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function u(e){if(typeof e!=`string`){if(e&&e.toHTML)return e.toHTML();if(e==null)return``;if(!e)return e+``;e=``+e}return r.test(e)?e.replace(n,i):e}function d(e){return!e&&e!==0?!0:!!(c(e)&&e.length===0)}function f(e){var t=a({},e);return t._parent=e,t}function p(e,t){return e.path=t,e}function m(e,t){return(e?e+`.`:``)+t}})),Yr=n(((e,t)=>{e.__esModule=!0;var n=[`description`,`fileName`,`lineNumber`,`endLineNumber`,`message`,`name`,`number`,`stack`];function r(e,t){var i=t&&t.loc,a=void 0,o=void 0,s=void 0,c=void 0;i&&(a=i.start.line,o=i.end.line,s=i.start.column,c=i.end.column,e+=` - `+a+`:`+s);for(var l=Error.prototype.constructor.call(this,e),u=0;u<n.length;u++)this[n[u]]=l[n[u]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{i&&(this.lineNumber=a,this.endLineNumber=o,Object.defineProperty?(Object.defineProperty(this,"column",{value:s,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:c,enumerable:!0})):(this.column=s,this.endColumn=c))}catch{}}r.prototype=Error(),e.default=r,t.exports=e.default})),Xr=n(((e,t)=>{e.__esModule=!0;var n=Jr();e.default=function(e){e.registerHelper(`blockHelperMissing`,function(t,r){var i=r.inverse,a=r.fn;if(t===!0)return a(this);if(t===!1||t==null)return i(this);if(n.isArray(t))return t.length>0?(r.ids&&=[r.name],e.helpers.each(t,r)):i(this);if(r.data&&r.ids){var o=n.createFrame(r.data);o.contextPath=n.appendContextPath(r.data.contextPath,r.name),r={data:o}}return a(t,r)})},t.exports=e.default})),Zr=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Jr(),i=n(Yr());e.default=function(e){e.registerHelper(`each`,function(e,t){if(!t)throw new i.default(`Must pass iterator to #each`);var n=t.fn,a=t.inverse,o=0,s=``,c=void 0,l=void 0;t.data&&t.ids&&(l=r.appendContextPath(t.data.contextPath,t.ids[0])+`.`),r.isFunction(e)&&(e=e.call(this)),t.data&&(c=r.createFrame(t.data));function u(t,i,a){c&&(c.key=t,c.index=i,c.first=i===0,c.last=!!a,l&&(c.contextPath=l+t)),s+=n(e[t],{data:c,blockParams:r.blockParams([e[t],t],[l+t,null])})}if(e&&typeof e==`object`)if(r.isArray(e))for(var d=e.length;o<d;o++)o in e&&u(o,o,o===e.length-1);else if(typeof Symbol==`function`&&e[Symbol.iterator]){for(var f=[],p=e[Symbol.iterator](),m=p.next();!m.done;m=p.next())f.push(m.value);e=f;for(var d=e.length;o<d;o++)u(o,o,o===e.length-1)}else (function(){var t=void 0;Object.keys(e).forEach(function(e){t!==void 0&&u(t,o-1),t=e,o++}),t!==void 0&&u(t,o-1,!0)})();return o===0&&(s=a(this)),s})},t.exports=e.default})),Qr=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=n(Yr());e.default=function(e){e.registerHelper(`helperMissing`,function(){if(arguments.length!==1)throw new r.default(`Missing helper: "`+arguments[arguments.length-1].name+`"`)})},t.exports=e.default})),$r=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Jr(),i=n(Yr());e.default=function(e){e.registerHelper(`if`,function(e,t){if(arguments.length!=2)throw new i.default(`#if requires exactly one argument`);return r.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||r.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper(`unless`,function(t,n){if(arguments.length!=2)throw new i.default(`#unless requires exactly one argument`);return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=e.default})),ei=n(((e,t)=>{e.__esModule=!0,e.default=function(e){e.registerHelper(`log`,function(){for(var t=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)t.push(arguments[r]);var i=1;n.hash.level==null?n.data&&n.data.level!=null&&(i=n.data.level):i=n.hash.level,t[0]=i,e.log.apply(e,t)})},t.exports=e.default})),ti=n(((e,t)=>{e.__esModule=!0,e.default=function(e){e.registerHelper(`lookup`,function(e,t,n){return e&&n.lookupProperty(e,t)})},t.exports=e.default})),ni=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Jr(),i=n(Yr());e.default=function(e){e.registerHelper(`with`,function(e,t){if(arguments.length!=2)throw new i.default(`#with requires exactly one argument`);r.isFunction(e)&&(e=e.call(this));var n=t.fn;if(r.isEmpty(e))return t.inverse(this);var a=t.data;return t.data&&t.ids&&(a=r.createFrame(t.data),a.contextPath=r.appendContextPath(t.data.contextPath,t.ids[0])),n(e,{data:a,blockParams:r.blockParams([e],[a&&a.contextPath])})})},t.exports=e.default})),ri=n((e=>{e.__esModule=!0,e.registerDefaultHelpers=l,e.moveHelperToHooks=u;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(Xr()),r=t(Zr()),i=t(Qr()),a=t($r()),o=t(ei()),s=t(ti()),c=t(ni());function l(e){n.default(e),r.default(e),i.default(e),a.default(e),o.default(e),s.default(e),c.default(e)}function u(e,t,n){e.helpers[t]&&(e.hooks[t]=e.helpers[t],n||(e.helpers[t]=void 0))}})),ii=n(((e,t)=>{e.__esModule=!0;var n=Jr();e.default=function(e){e.registerDecorator(`inline`,function(e,t,r,i){var a=e;return t.partials||(t.partials={},a=function(i,a){var o=r.partials;r.partials=n.extend({},o,t.partials);var s=e(i,a);return r.partials=o,s}),t.partials[i.args[0]]=i.fn,a})},t.exports=e.default})),ai=n((e=>{e.__esModule=!0,e.registerDefaultDecorators=r;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(ii());function r(e){n.default(e)}})),oi=n(((e,t)=>{e.__esModule=!0;var n=Jr(),r={methodMap:[`debug`,`info`,`warn`,`error`],level:`info`,lookupLevel:function(e){if(typeof e==`string`){var t=n.indexOf(r.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=r.lookupLevel(e),typeof console<`u`&&r.lookupLevel(r.level)<=e){var t=r.methodMap[e];console[t]||(t=`log`);var n=[...arguments].slice(1);console[t].apply(console,n)}}};e.default=r,t.exports=e.default})),si=n((e=>{e.__esModule=!0,e.createProtoAccessControl=a,e.resultIsAllowed=o,e.resetLoggedProperties=l;function t(e){return e&&e.__esModule?e:{default:e}}var n=Jr(),r=t(oi()),i=Object.create(null);function a(e){var t=Object.create(null);t.__proto__=!1,n.extend(t,e.allowedProtoProperties);var r=Object.create(null);return r.constructor=!1,r.__defineGetter__=!1,r.__defineSetter__=!1,r.__lookupGetter__=!1,r.__lookupSetter__=!1,n.extend(r,e.allowedProtoMethods),{properties:{whitelist:t,defaultValue:e.allowProtoPropertiesByDefault},methods:{whitelist:r,defaultValue:e.allowProtoMethodsByDefault}}}function o(e,t,n){return s(typeof e==`function`?t.methods:t.properties,n)}function s(e,t){return e.whitelist[t]===void 0?e.defaultValue===void 0?(c(t),!1):e.defaultValue:e.whitelist[t]===!0}function c(e){i[e]!==!0&&(i[e]=!0,r.default.log(`error`,`Handlebars: Access has been denied to resolve the property "`+e+`" because it is not an "own property" of its parent.
|
|
5
|
-
You can add a runtime option to disable the check or this warning:
|
|
6
|
-
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}function l(){Object.keys(i).forEach(function(e){delete i[e]})}})),ci=n((e=>{e.__esModule=!0,e.HandlebarsEnvironment=l;function t(e){return e&&e.__esModule?e:{default:e}}var n=Jr(),r=t(Yr()),i=ri(),a=ai(),o=t(oi()),s=si();e.VERSION=`4.7.9`,e.COMPILER_REVISION=8,e.LAST_COMPATIBLE_COMPILER_REVISION=7,e.REVISION_CHANGES={1:`<= 1.0.rc.2`,2:`== 1.0.0-rc.3`,3:`== 1.0.0-rc.4`,4:`== 1.x.x`,5:`== 2.0.0-alpha.x`,6:`>= 2.0.0-beta.1`,7:`>= 4.0.0 <4.3.0`,8:`>= 4.3.0`};var c=`[object Object]`;function l(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},i.registerDefaultHelpers(this),a.registerDefaultDecorators(this)}l.prototype={constructor:l,logger:o.default,log:o.default.log,registerHelper:function(e,t){if(n.toString.call(e)===c){if(t)throw new r.default(`Arg not supported with multiple helpers`);n.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(n.toString.call(e)===c)n.extend(this.partials,e);else{if(t===void 0)throw new r.default(`Attempting to register a partial called "`+e+`" as undefined`);this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(n.toString.call(e)===c){if(t)throw new r.default(`Arg not supported with multiple decorators`);n.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){s.resetLoggedProperties()}},e.log=o.default.log,e.createFrame=n.createFrame,e.logger=o.default})),li=n(((e,t)=>{e.__esModule=!0;function n(e){this.string=e}n.prototype.toString=n.prototype.toHTML=function(){return``+this.string},e.default=n,t.exports=e.default})),ui=n((e=>{e.__esModule=!0,e.wrapHelper=t;function t(e,t){return typeof e==`function`?function(){var n=arguments[arguments.length-1];return arguments[arguments.length-1]=t(n),e.apply(this,arguments)}:e}})),di=n((e=>{e.__esModule=!0,e.checkRevision=l,e.template=u,e.wrapProgram=d,e.resolvePartial=f,e.invokePartial=p,e.noop=m;function t(e){return e&&e.__esModule?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var r=n(Jr()),i=t(Yr()),a=ci(),o=ri(),s=ui(),c=si();function l(e){var t=e&&e[0]||1,n=a.COMPILER_REVISION;if(!(t>=a.LAST_COMPATIBLE_COMPILER_REVISION&&t<=a.COMPILER_REVISION))if(t<a.LAST_COMPATIBLE_COMPILER_REVISION){var r=a.REVISION_CHANGES[n],o=a.REVISION_CHANGES[t];throw new i.default(`Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version (`+r+`) or downgrade your runtime to an older version (`+o+`).`)}else throw new i.default(`Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version (`+e[1]+`).`)}function u(e,t){if(!t)throw new i.default(`No environment passed to template`);if(!e||!e.main)throw new i.default(`Unknown template object: `+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var n=e.compiler&&e.compiler[0]===7;function a(n,a,o){o.hash&&(a=r.extend({},a,o.hash),o.ids&&(o.ids[0]=!0)),n=t.VM.resolvePartial.call(this,n,a,o),o.hooks=this.hooks,o.protoAccessControl=this.protoAccessControl;var s=t.VM.invokePartial.call(this,n,a,o);if(s==null&&t.compile&&(o.partials[o.name]=t.compile(n,e.compilerOptions,t),s=o.partials[o.name](a,o)),s!=null){if(o.indent){for(var c=s.split(`
|
|
7
|
-
`),l=0,u=c.length;l<u&&!(!c[l]&&l+1===u);l++)c[l]=o.indent+c[l];s=c.join(`
|
|
8
|
-
`)}return s}else throw new i.default(`The partial `+o.name+` could not be compiled when running in runtime-only mode`)}var s={strict:function(e,t,n){if(!e||!(t in e))throw new i.default(`"`+t+`" not defined in `+e,{loc:n});return s.lookupProperty(e,t)},lookupProperty:function(e,t){var n=e[t];if(n==null||Object.prototype.hasOwnProperty.call(e,t)||c.resultIsAllowed(n,s.protoAccessControl,t))return n},lookup:function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r]&&s.lookupProperty(e[r],t);if(i!=null)return i}},lambda:function(e,t){return typeof e==`function`?e.call(t):e},escapeExpression:r.escapeExpression,invokePartial:a,fn:function(t){var n=e[t];return n.decorator=e[t+`_d`],n},programs:[],program:function(e,t,n,r,i){var a=this.programs[e],o=this.fn(e);return t||i||r||n?a=d(this,e,o,t,n,r,i):a||=this.programs[e]=d(this,e,o),a},data:function(e,t){for(;e&&t--;)e=e._parent;return e},mergeIfNeeded:function(e,t){var n=e||t;return e&&t&&e!==t&&(n=r.extend({},t,e)),n},nullContext:Object.seal({}),noop:t.VM.noop,compilerInfo:e.compiler};function l(t){var n=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],r=n.data;l._setup(n),!n.partial&&e.useData&&(r=g(t,r));var i=void 0,a=e.useBlockParams?[]:void 0;e.useDepths&&(i=n.depths?t==n.depths[0]?n.depths:[t].concat(n.depths):[t]);function o(t){return``+e.main(s,t,s.helpers,s.partials,r,a,i)}return o=_(e.main,o,s,n.depths||[],r,a),o(t,n)}return l.isTop=!0,l._setup=function(i){if(i.partial)s.protoAccessControl=i.protoAccessControl,s.helpers=i.helpers,s.partials=i.partials,s.decorators=i.decorators,s.hooks=i.hooks;else{var a={};v(a,t.helpers,s),v(a,i.helpers,s),s.helpers=a,e.usePartial&&(s.partials=s.mergeIfNeeded(i.partials,t.partials)),(e.usePartial||e.useDecorators)&&(s.decorators=r.extend({},t.decorators,i.decorators)),s.hooks={},s.protoAccessControl=c.createProtoAccessControl(i);var l=i.allowCallsToHelperMissing||n;o.moveHelperToHooks(s,`helperMissing`,l),o.moveHelperToHooks(s,`blockHelperMissing`,l)}},l._child=function(t,n,r,a){if(e.useBlockParams&&!r)throw new i.default(`must pass block params`);if(e.useDepths&&!a)throw new i.default(`must pass parent depths`);return d(s,t,e[t],n,0,r,a)},l}function d(e,t,n,r,i,a,o){function s(t){var i=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],s=o;return o&&t!=o[0]&&!(t===e.nullContext&&o[0]===null)&&(s=[t].concat(o)),n(e,t,e.helpers,e.partials,i.data||r,a&&[i.blockParams].concat(a),s)}return s=_(n,s,e,o,r,a),s.program=t,s.depth=o?o.length:0,s.blockParams=i||0,s}function f(e,t,n){return e?!e.call&&!n.name&&(n.name=e,e=h(n.partials,e)):e=n.name===`@partial-block`?h(n.data,`partial-block`):h(n.partials,n.name),e}function p(e,t,n){var o=h(n.data,`partial-block`);n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var s=void 0;if(n.fn&&n.fn!==m&&(function(){n.data=a.createFrame(n.data);var e=n.fn;s=n.data[`partial-block`]=function(t){var n=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];return n.data=a.createFrame(n.data),n.data[`partial-block`]=o,e(t,n)},e.partials&&(n.partials=r.extend({},n.partials,e.partials))})(),e===void 0&&s&&(e=s),e===void 0)throw new i.default(`The partial `+n.name+` could not be found`);if(e instanceof Function)return e(t,n)}function m(){return``}function h(e,t){if(e&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function g(e,t){return(!t||!(`root`in t))&&(t=t?a.createFrame(t):{},t.root=e),t}function _(e,t,n,i,a,o){if(e.decorator){var s={};t=e.decorator(t,s,n,i&&i[0],a,o,i),r.extend(t,s)}return t}function v(e,t,n){t&&Object.keys(t).forEach(function(r){var i=t[r];e[r]=y(i,n)})}function y(e,t){var n=t.lookupProperty;return s.wrapHelper(e,function(e){return e.lookupProperty=n,e})}})),fi=n(((e,t)=>{e.__esModule=!0,e.default=function(e){(function(){typeof globalThis!=`object`&&(Object.prototype.__defineGetter__(`__magic__`,function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var t=globalThis.Handlebars;e.noConflict=function(){return globalThis.Handlebars===e&&(globalThis.Handlebars=t),e}},t.exports=e.default})),pi=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}function r(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var i=r(ci()),a=n(li()),o=n(Yr()),s=r(Jr()),c=r(di()),l=n(fi());function u(){var e=new i.HandlebarsEnvironment;return s.extend(e,i),e.SafeString=a.default,e.Exception=o.default,e.Utils=s,e.escapeExpression=s.escapeExpression,e.VM=c,e.template=function(t){return c.template(t,e)},e}var d=u();d.create=u,l.default(d),d.default=d,e.default=d,t.exports=e.default})),mi=n(((e,t)=>{e.__esModule=!0;var n={helpers:{helperExpression:function(e){return e.type===`SubExpression`||(e.type===`MustacheStatement`||e.type===`BlockStatement`)&&!!(e.params&&e.params.length||e.hash)},scopedId:function(e){return/^\.|this\b/.test(e.original)},simpleId:function(e){return e.parts.length===1&&!n.helpers.scopedId(e)&&!e.depth}}};e.default=n,t.exports=e.default})),hi=n(((e,t)=>{e.__esModule=!0,e.default=(function(){var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:`error`,5:`EOF`,14:`COMMENT`,15:`CONTENT`,18:`END_RAW_BLOCK`,19:`OPEN_RAW_BLOCK`,23:`CLOSE_RAW_BLOCK`,29:`OPEN_BLOCK`,33:`CLOSE`,34:`OPEN_INVERSE`,39:`OPEN_INVERSE_CHAIN`,44:`INVERSE`,47:`OPEN_ENDBLOCK`,48:`OPEN`,51:`OPEN_UNESCAPED`,54:`CLOSE_UNESCAPED`,55:`OPEN_PARTIAL`,60:`OPEN_PARTIAL_BLOCK`,65:`OPEN_SEXPR`,68:`CLOSE_SEXPR`,72:`ID`,73:`EQUALS`,75:`OPEN_BLOCK_PARAMS`,77:`CLOSE_BLOCK_PARAMS`,80:`STRING`,81:`NUMBER`,82:`BOOLEAN`,83:`UNDEFINED`,84:`NULL`,85:`DATA`,87:`SEP`},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 2:this.$=r.prepareProgram(a[s]);break;case 3:this.$=a[s];break;case 4:this.$=a[s];break;case 5:this.$=a[s];break;case 6:this.$=a[s];break;case 7:this.$=a[s];break;case 8:this.$=a[s];break;case 9:this.$={type:`CommentStatement`,value:r.stripComment(a[s]),strip:r.stripFlags(a[s],a[s]),loc:r.locInfo(this._$)};break;case 10:this.$={type:`ContentStatement`,original:a[s],value:a[s],loc:r.locInfo(this._$)};break;case 11:this.$=r.prepareRawBlock(a[s-2],a[s-1],a[s],this._$);break;case 12:this.$={path:a[s-3],params:a[s-2],hash:a[s-1]};break;case 13:this.$=r.prepareBlock(a[s-3],a[s-2],a[s-1],a[s],!1,this._$);break;case 14:this.$=r.prepareBlock(a[s-3],a[s-2],a[s-1],a[s],!0,this._$);break;case 15:this.$={open:a[s-5],path:a[s-4],params:a[s-3],hash:a[s-2],blockParams:a[s-1],strip:r.stripFlags(a[s-5],a[s])};break;case 16:this.$={path:a[s-4],params:a[s-3],hash:a[s-2],blockParams:a[s-1],strip:r.stripFlags(a[s-5],a[s])};break;case 17:this.$={path:a[s-4],params:a[s-3],hash:a[s-2],blockParams:a[s-1],strip:r.stripFlags(a[s-5],a[s])};break;case 18:this.$={strip:r.stripFlags(a[s-1],a[s-1]),program:a[s]};break;case 19:var c=r.prepareBlock(a[s-2],a[s-1],a[s],a[s],!1,this._$),l=r.prepareProgram([c],a[s-1].loc);l.chained=!0,this.$={strip:a[s-2].strip,program:l,chain:!0};break;case 20:this.$=a[s];break;case 21:this.$={path:a[s-1],strip:r.stripFlags(a[s-2],a[s])};break;case 22:this.$=r.prepareMustache(a[s-3],a[s-2],a[s-1],a[s-4],r.stripFlags(a[s-4],a[s]),this._$);break;case 23:this.$=r.prepareMustache(a[s-3],a[s-2],a[s-1],a[s-4],r.stripFlags(a[s-4],a[s]),this._$);break;case 24:this.$={type:`PartialStatement`,name:a[s-3],params:a[s-2],hash:a[s-1],indent:``,strip:r.stripFlags(a[s-4],a[s]),loc:r.locInfo(this._$)};break;case 25:this.$=r.preparePartialBlock(a[s-2],a[s-1],a[s],this._$);break;case 26:this.$={path:a[s-3],params:a[s-2],hash:a[s-1],strip:r.stripFlags(a[s-4],a[s])};break;case 27:this.$=a[s];break;case 28:this.$=a[s];break;case 29:this.$={type:`SubExpression`,path:a[s-3],params:a[s-2],hash:a[s-1],loc:r.locInfo(this._$)};break;case 30:this.$={type:`Hash`,pairs:a[s],loc:r.locInfo(this._$)};break;case 31:this.$={type:`HashPair`,key:r.id(a[s-2]),value:a[s],loc:r.locInfo(this._$)};break;case 32:this.$=r.id(a[s-1]);break;case 33:this.$=a[s];break;case 34:this.$=a[s];break;case 35:this.$={type:`StringLiteral`,value:a[s],original:a[s],loc:r.locInfo(this._$)};break;case 36:this.$={type:`NumberLiteral`,value:Number(a[s]),original:Number(a[s]),loc:r.locInfo(this._$)};break;case 37:this.$={type:`BooleanLiteral`,value:a[s]===`true`,original:a[s]===`true`,loc:r.locInfo(this._$)};break;case 38:this.$={type:`UndefinedLiteral`,original:void 0,value:void 0,loc:r.locInfo(this._$)};break;case 39:this.$={type:`NullLiteral`,original:null,value:null,loc:r.locInfo(this._$)};break;case 40:this.$=a[s];break;case 41:this.$=a[s];break;case 42:this.$=r.preparePath(!0,a[s],this._$);break;case 43:this.$=r.preparePath(!1,a[s],this._$);break;case 44:a[s-2].push({part:r.id(a[s]),original:a[s],separator:a[s-1]}),this.$=a[s-2];break;case 45:this.$=[{part:r.id(a[s]),original:a[s]}];break;case 46:this.$=[];break;case 47:a[s-1].push(a[s]);break;case 48:this.$=[];break;case 49:a[s-1].push(a[s]);break;case 50:this.$=[];break;case 51:a[s-1].push(a[s]);break;case 58:this.$=[];break;case 59:a[s-1].push(a[s]);break;case 64:this.$=[];break;case 65:a[s-1].push(a[s]);break;case 70:this.$=[];break;case 71:a[s-1].push(a[s]);break;case 78:this.$=[];break;case 79:a[s-1].push(a[s]);break;case 82:this.$=[];break;case 83:a[s-1].push(a[s]);break;case 86:this.$=[];break;case 87:a[s-1].push(a[s]);break;case 90:this.$=[];break;case 91:a[s-1].push(a[s]);break;case 94:this.$=[];break;case 95:a[s-1].push(a[s]);break;case 98:this.$=[a[s]];break;case 99:a[s-1].push(a[s]);break;case 100:this.$=[a[s]];break;case 101:a[s-1].push(a[s]);break}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(e,t){throw Error(e)},parse:function(e){var t=this,n=[0],r=[null],i=[],a=this.table,o=``,s=0,c=0,l=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,this.lexer.yylloc===void 0&&(this.lexer.yylloc={});var u=this.lexer.yylloc;i.push(u);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError==`function`&&(this.parseError=this.yy.parseError);function f(){var e=t.lexer.lex()||1;return typeof e!=`number`&&(e=t.symbols_[e]||e),e}for(var p,m,h,g,_,v={},y,b,x,S;;){if(h=n[n.length-1],this.defaultActions[h]?g=this.defaultActions[h]:(p??=f(),g=a[h]&&a[h][p]),g===void 0||!g.length||!g[0]){var C=``;if(!l){for(y in S=[],a[h])this.terminals_[y]&&y>2&&S.push(`'`+this.terminals_[y]+`'`);C=this.lexer.showPosition?`Parse error on line `+(s+1)+`:
|
|
9
|
-
`+this.lexer.showPosition()+`
|
|
10
|
-
Expecting `+S.join(`, `)+`, got '`+(this.terminals_[p]||p)+`'`:`Parse error on line `+(s+1)+`: Unexpected `+(p==1?`end of input`:`'`+(this.terminals_[p]||p)+`'`),this.parseError(C,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:u,expected:S})}}if(g[0]instanceof Array&&g.length>1)throw Error(`Parse Error: multiple actions possible at state: `+h+`, token: `+p);switch(g[0]){case 1:n.push(p),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[1]),p=null,m?(p=m,m=null):(c=this.lexer.yyleng,o=this.lexer.yytext,s=this.lexer.yylineno,u=this.lexer.yylloc,l>0&&l--);break;case 2:if(b=this.productions_[g[1]][1],v.$=r[r.length-b],v._$={first_line:i[i.length-(b||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(b||1)].first_column,last_column:i[i.length-1].last_column},d&&(v._$.range=[i[i.length-(b||1)].range[0],i[i.length-1].range[1]]),_=this.performAction.call(v,o,c,s,this.yy,g[1],r,i),_!==void 0)return _;b&&(n=n.slice(0,-1*b*2),r=r.slice(0,-1*b),i=i.slice(0,-1*b)),n.push(this.productions_[g[1]][0]),r.push(v.$),i.push(v._$),x=a[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}};e.lexer=(function(){var e={EOF:1,parseError:function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},showPosition:function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
11
|
-
`+t+`^`},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r,i;this._more||(this.yytext=``,this.match=``);for(var a=this._currentRules(),o=0;o<a.length&&(n=this._input.match(this.rules[a[o]]),!(n&&(!t||n[0].length>t[0].length)&&(t=n,r=o,!this.options.flex)));o++);return t?(i=t[0].match(/(?:\r\n?|\n).*/g),i&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,a[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
|
|
12
|
-
`+this.showPosition(),{text:``,token:null,line:this.yylineno})},lex:function(){var e=this.next();return e===void 0?this.lex():e},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)}};return e.options={},e.performAction=function(e,t,n,r){function i(e,n){return t.yytext=t.yytext.substring(e,t.yyleng-n+e)}switch(n){case 0:if(t.yytext.slice(-2)===`\\\\`?(i(0,1),this.begin(`mu`)):t.yytext.slice(-1)===`\\`?(i(0,1),this.begin(`emu`)):this.begin(`mu`),t.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin(`raw`),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]===`raw`?15:(i(5,9),`END_RAW_BLOCK`);case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin(`raw`),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(t.yytext),this.popState(),this.begin(`com`);break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return t.yytext=i(1,2).replace(/\\"/g,`"`),80;case 32:return t.yytext=i(1,2).replace(/\\'/g,`'`),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return t.yytext=t.yytext.replace(/\\([\\\]])/g,`$1`),72;case 43:return`INVALID`;case 44:return 5}},e.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],e.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},e})();function t(){this.yy={}}return t.prototype=e,e.Parser=t,new t})(),t.exports=e.default})),gi=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=n(Yr());function i(){this.parents=[]}i.prototype={constructor:i,mutating:!1,acceptKey:function(e,t){var n=this.accept(e[t]);if(this.mutating){if(n&&!i.prototype[n.type])throw new r.default(`Unexpected node type "`+n.type+`" found when accepting `+t+` on `+e.type);e[t]=n}},acceptRequired:function(e,t){if(this.acceptKey(e,t),!e[t])throw new r.default(e.type+` requires `+t)},acceptArray:function(e){for(var t=0,n=e.length;t<n;t++)this.acceptKey(e,t),e[t]||(e.splice(t,1),t--,n--)},accept:function(e){if(e){if(!this[e.type])throw new r.default(`Unknown type: `+e.type,e);this.current&&this.parents.unshift(this.current),this.current=e;var t=this[e.type](e);if(this.current=this.parents.shift(),!this.mutating||t)return t;if(t!==!1)return e}},Program:function(e){this.acceptArray(e.body)},MustacheStatement:a,Decorator:a,BlockStatement:o,DecoratorBlock:o,PartialStatement:s,PartialBlockStatement:function(e){s.call(this,e),this.acceptKey(e,`program`)},ContentStatement:function(){},CommentStatement:function(){},SubExpression:a,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(e){this.acceptArray(e.pairs)},HashPair:function(e){this.acceptRequired(e,`value`)}};function a(e){this.acceptRequired(e,`path`),this.acceptArray(e.params),this.acceptKey(e,`hash`)}function o(e){a.call(this,e),this.acceptKey(e,`program`),this.acceptKey(e,`inverse`)}function s(e){this.acceptRequired(e,`name`),this.acceptArray(e.params),this.acceptKey(e,`hash`)}e.default=i,t.exports=e.default})),_i=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=n(gi());function i(){var e=arguments.length<=0||arguments[0]===void 0?{}:arguments[0];this.options=e}i.prototype=new r.default,i.prototype.Program=function(e){var t=!this.options.ignoreStandalone,n=!this.isRootSeen;this.isRootSeen=!0;for(var r=e.body,i=0,l=r.length;i<l;i++){var u=r[i],d=this.accept(u);if(d){var f=a(r,i,n),p=o(r,i,n),m=d.openStandalone&&f,h=d.closeStandalone&&p,g=d.inlineStandalone&&f&&p;d.close&&s(r,i,!0),d.open&&c(r,i,!0),t&&g&&(s(r,i),c(r,i)&&u.type===`PartialStatement`&&(u.indent=/([ \t]+$)/.exec(r[i-1].original)[1])),t&&m&&(s((u.program||u.inverse).body),c(r,i)),t&&h&&(s(r,i),c((u.inverse||u.program).body))}}return e},i.prototype.BlockStatement=i.prototype.DecoratorBlock=i.prototype.PartialBlockStatement=function(e){this.accept(e.program),this.accept(e.inverse);var t=e.program||e.inverse,n=e.program&&e.inverse,r=n,i=n;if(n&&n.chained)for(r=n.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var l={open:e.openStrip.open,close:e.closeStrip.close,openStandalone:o(t.body),closeStandalone:a((r||t).body)};if(e.openStrip.close&&s(t.body,null,!0),n){var u=e.inverseStrip;u.open&&c(t.body,null,!0),u.close&&s(r.body,null,!0),e.closeStrip.open&&c(i.body,null,!0),!this.options.ignoreStandalone&&a(t.body)&&o(r.body)&&(c(t.body),s(r.body))}else e.closeStrip.open&&c(t.body,null,!0);return l},i.prototype.Decorator=i.prototype.MustacheStatement=function(e){return e.strip},i.prototype.PartialStatement=i.prototype.CommentStatement=function(e){var t=e.strip||{};return{inlineStandalone:!0,open:t.open,close:t.close}};function a(e,t,n){t===void 0&&(t=e.length);var r=e[t-1],i=e[t-2];if(!r)return n;if(r.type===`ContentStatement`)return(i||!n?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(r.original)}function o(e,t,n){t===void 0&&(t=-1);var r=e[t+1],i=e[t+2];if(!r)return n;if(r.type===`ContentStatement`)return(i||!n?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(r.original)}function s(e,t,n){var r=e[t==null?0:t+1];if(!(!r||r.type!==`ContentStatement`||!n&&r.rightStripped)){var i=r.value;r.value=r.value.replace(n?/^\s+/:/^[ \t]*\r?\n?/,``),r.rightStripped=r.value!==i}}function c(e,t,n){var r=e[t==null?e.length-1:t-1];if(!(!r||r.type!==`ContentStatement`||!n&&r.leftStripped)){var i=r.value;return r.value=r.value.replace(n?/\s+$/:/[ \t]+$/,``),r.leftStripped=r.value!==i,r.leftStripped}}e.default=i,t.exports=e.default})),vi=n((e=>{e.__esModule=!0,e.SourceLocation=i,e.id=a,e.stripFlags=o,e.stripComment=s,e.preparePath=c,e.prepareMustache=l,e.prepareRawBlock=u,e.prepareBlock=d,e.prepareProgram=f,e.preparePartialBlock=p;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(Yr());function r(e,t){if(t=t.path?t.path.original:t,e.path.original!==t){var r={loc:e.path.loc};throw new n.default(e.path.original+` doesn't match `+t,r)}}function i(e,t){this.source=e,this.start={line:t.first_line,column:t.first_column},this.end={line:t.last_line,column:t.last_column}}function a(e){return/^\[.*\]$/.test(e)?e.substring(1,e.length-1):e}function o(e,t){return{open:e.charAt(2)===`~`,close:t.charAt(t.length-3)===`~`}}function s(e){return e.replace(/^\{\{~?!-?-?/,``).replace(/-?-?~?\}\}$/,``)}function c(e,t,r){r=this.locInfo(r);for(var i=e?`@`:``,a=[],o=0,s=0,c=t.length;s<c;s++){var l=t[s].part,u=t[s].original!==l;if(i+=(t[s].separator||``)+l,!u&&(l===`..`||l===`.`||l===`this`)){if(a.length>0)throw new n.default(`Invalid path: `+i,{loc:r});l===`..`&&o++}else a.push(l)}return{type:`PathExpression`,data:e,depth:o,parts:a,original:i,loc:r}}function l(e,t,n,r,i,a){var o=r.charAt(3)||r.charAt(2),s=o!==`{`&&o!==`&`;return{type:/\*/.test(r)?`Decorator`:`MustacheStatement`,path:e,params:t,hash:n,escaped:s,strip:i,loc:this.locInfo(a)}}function u(e,t,n,i){r(e,n),i=this.locInfo(i);var a={type:`Program`,body:t,strip:{},loc:i};return{type:`BlockStatement`,path:e.path,params:e.params,hash:e.hash,program:a,openStrip:{},inverseStrip:{},closeStrip:{},loc:i}}function d(e,t,i,a,o,s){a&&a.path&&r(e,a);var c=/\*/.test(e.open);t.blockParams=e.blockParams;var l=void 0,u=void 0;if(i){if(c)throw new n.default(`Unexpected inverse block on decorator`,i);i.chain&&(i.program.body[0].closeStrip=a.strip),u=i.strip,l=i.program}return o&&(o=l,l=t,t=o),{type:c?`DecoratorBlock`:`BlockStatement`,path:e.path,params:e.params,hash:e.hash,program:t,inverse:l,openStrip:e.strip,inverseStrip:u,closeStrip:a&&a.strip,loc:this.locInfo(s)}}function f(e,t){if(!t&&e.length){var n=e[0].loc,r=e[e.length-1].loc;n&&r&&(t={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:`Program`,body:e,strip:{},loc:t}}function p(e,t,n,i){return r(e,n),{type:`PartialBlockStatement`,name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:n&&n.strip,loc:this.locInfo(i)}}})),yi=n((e=>{e.__esModule=!0,e.parseWithoutProcessing=l,e.parse=u;function t(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function n(e){return e&&e.__esModule?e:{default:e}}var r=n(hi()),i=n(_i()),a=t(vi()),o=n(Yr()),s=Jr();e.parser=r.default;var c={};s.extend(c,a);function l(e,t){return e.type===`Program`?(d(e),e):(r.default.yy=c,c.locInfo=function(e){return new c.SourceLocation(t&&t.srcName,e)},r.default.parse(e))}function u(e,t){var n=l(e,t);return new i.default(t).accept(n)}function d(e){f(e)}function f(e){if(e!=null){if(Array.isArray(e)){e.forEach(f);return}if(typeof e==`object`){if(e.type===`PathExpression`){if(!p(e.depth))throw new o.default(`Invalid AST: PathExpression.depth must be an integer`);if(!Array.isArray(e.parts))throw new o.default(`Invalid AST: PathExpression.parts must be an array`);for(var t=0;t<e.parts.length;t++)if(typeof e.parts[t]!=`string`)throw new o.default(`Invalid AST: PathExpression.parts must only contain strings`)}else if(e.type===`NumberLiteral`){if(typeof e.value!=`number`||!isFinite(e.value))throw new o.default(`Invalid AST: NumberLiteral.value must be a number`)}else if(e.type===`BooleanLiteral`&&typeof e.value!=`boolean`)throw new o.default(`Invalid AST: BooleanLiteral.value must be a boolean`);Object.keys(e).forEach(function(t){t!==`loc`&&f(e[t])})}}}function p(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e&&e>=0}})),bi=n((e=>{e.__esModule=!0,e.Compiler=o,e.precompile=s,e.compile=c;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(Yr()),r=Jr(),i=t(mi()),a=[].slice;function o(){}o.prototype={compiler:o,equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var n=0;n<t;n++){var r=this.opcodes[n],i=e.opcodes[n];if(r.opcode!==i.opcode||!l(r.args,i.args))return!1}t=this.children.length;for(var n=0;n<t;n++)if(!this.children[n].equals(e.children[n]))return!1;return!0},guid:0,compile:function(e,t){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=t,this.stringParams=t.stringParams,this.trackIds=t.trackIds,t.blockParams=t.blockParams||[],t.knownHelpers=r.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},t.knownHelpers),this.accept(e)},compileProgram:function(e){var t=new this.compiler().compile(e,this.options),n=this.guid++;return this.usePartial=this.usePartial||t.usePartial,this.children[n]=t,this.useDepths=this.useDepths||t.useDepths,n},accept:function(e){if(!this[e.type])throw new n.default(`Unknown type: `+e.type,e);this.sourceNode.unshift(e);var t=this[e.type](e);return this.sourceNode.shift(),t},Program:function(e){this.options.blockParams.unshift(e.blockParams);for(var t=e.body,n=t.length,r=0;r<n;r++)this.accept(t[r]);return this.options.blockParams.shift(),this.isSimple=n===1,this.blockParams=e.blockParams?e.blockParams.length:0,this},BlockStatement:function(e){u(e);var t=e.program,n=e.inverse;t&&=this.compileProgram(t),n&&=this.compileProgram(n);var r=this.classifySexpr(e);r===`helper`?this.helperSexpr(e,t,n):r===`simple`?(this.simpleSexpr(e),this.opcode(`pushProgram`,t),this.opcode(`pushProgram`,n),this.opcode(`emptyHash`),this.opcode(`blockValue`,e.path.original)):(this.ambiguousSexpr(e,t,n),this.opcode(`pushProgram`,t),this.opcode(`pushProgram`,n),this.opcode(`emptyHash`),this.opcode(`ambiguousBlockValue`)),this.opcode(`append`)},DecoratorBlock:function(e){var t=e.program&&this.compileProgram(e.program),n=this.setupFullMustacheParams(e,t,void 0),r=e.path;this.useDecorators=!0,this.opcode(`registerDecorator`,n.length,r.original)},PartialStatement:function(e){this.usePartial=!0;var t=e.program;t&&=this.compileProgram(e.program);var r=e.params;if(r.length>1)throw new n.default(`Unsupported number of partial arguments: `+r.length,e);r.length||(this.options.explicitPartialContext?this.opcode(`pushLiteral`,`undefined`):r.push({type:`PathExpression`,parts:[],depth:0}));var i=e.name.original,a=e.name.type===`SubExpression`;a&&this.accept(e.name),this.setupFullMustacheParams(e,t,void 0,!0);var o=e.indent||``;this.options.preventIndent&&o&&(this.opcode(`appendContent`,o),o=``),this.opcode(`invokePartial`,a,i,o),this.opcode(`append`)},PartialBlockStatement:function(e){this.PartialStatement(e)},MustacheStatement:function(e){this.SubExpression(e),e.escaped&&!this.options.noEscape?this.opcode(`appendEscaped`):this.opcode(`append`)},Decorator:function(e){this.DecoratorBlock(e)},ContentStatement:function(e){e.value&&this.opcode(`appendContent`,e.value)},CommentStatement:function(){},SubExpression:function(e){u(e);var t=this.classifySexpr(e);t===`simple`?this.simpleSexpr(e):t===`helper`?this.helperSexpr(e):this.ambiguousSexpr(e)},ambiguousSexpr:function(e,t,n){var r=e.path,i=r.parts[0],a=t!=null||n!=null;this.opcode(`getContext`,r.depth),this.opcode(`pushProgram`,t),this.opcode(`pushProgram`,n),r.strict=!0,this.accept(r),this.opcode(`invokeAmbiguous`,i,a)},simpleSexpr:function(e){var t=e.path;t.strict=!0,this.accept(t),this.opcode(`resolvePossibleLambda`)},helperSexpr:function(e,t,r){var a=this.setupFullMustacheParams(e,t,r),o=e.path,s=o.parts[0];if(this.options.knownHelpers[s])this.opcode(`invokeKnownHelper`,a.length,s);else if(this.options.knownHelpersOnly)throw new n.default(`You specified knownHelpersOnly, but used the unknown helper `+s,e);else o.strict=!0,o.falsy=!0,this.accept(o),this.opcode(`invokeHelper`,a.length,o.original,i.default.helpers.simpleId(o))},PathExpression:function(e){this.addDepth(e.depth),this.opcode(`getContext`,e.depth);var t=e.parts[0],n=i.default.helpers.scopedId(e),r=!e.depth&&!n&&this.blockParamIndex(t);r?this.opcode(`lookupBlockParam`,r,e.parts):t?e.data?(this.options.data=!0,this.opcode(`lookupData`,e.depth,e.parts,e.strict)):this.opcode(`lookupOnContext`,e.parts,e.falsy,e.strict,n):this.opcode(`pushContext`)},StringLiteral:function(e){this.opcode(`pushString`,e.value)},NumberLiteral:function(e){this.opcode(`pushLiteral`,e.value)},BooleanLiteral:function(e){this.opcode(`pushLiteral`,e.value)},UndefinedLiteral:function(){this.opcode(`pushLiteral`,`undefined`)},NullLiteral:function(){this.opcode(`pushLiteral`,`null`)},Hash:function(e){var t=e.pairs,n=0,r=t.length;for(this.opcode(`pushHash`);n<r;n++)this.pushParam(t[n].value);for(;n--;)this.opcode(`assignToHash`,t[n].key);this.opcode(`popHash`)},opcode:function(e){this.opcodes.push({opcode:e,args:a.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(e){e&&(this.useDepths=!0)},classifySexpr:function(e){var t=i.default.helpers.simpleId(e.path),n=t&&!!this.blockParamIndex(e.path.parts[0]),r=!n&&i.default.helpers.helperExpression(e),a=!n&&(r||t);if(a&&!r){var o=e.path.parts[0],s=this.options;s.knownHelpers[o]?r=!0:s.knownHelpersOnly&&(a=!1)}return r?`helper`:a?`ambiguous`:`simple`},pushParams:function(e){for(var t=0,n=e.length;t<n;t++)this.pushParam(e[t])},pushParam:function(e){var t=e.value==null?e.original||``:e.value;if(this.stringParams)t.replace&&(t=t.replace(/^(\.?\.\/)*/g,``).replace(/\//g,`.`)),e.depth&&this.addDepth(e.depth),this.opcode(`getContext`,e.depth||0),this.opcode(`pushStringParam`,t,e.type),e.type===`SubExpression`&&this.accept(e);else{if(this.trackIds){var n=void 0;if(e.parts&&!i.default.helpers.scopedId(e)&&!e.depth&&(n=this.blockParamIndex(e.parts[0])),n){var r=e.parts.slice(1).join(`.`);this.opcode(`pushId`,`BlockParam`,n,r)}else t=e.original||t,t.replace&&(t=t.replace(/^this(?:\.|$)/,``).replace(/^\.\//,``).replace(/^\.$/,``)),this.opcode(`pushId`,e.type,t)}this.accept(e)}},setupFullMustacheParams:function(e,t,n,r){var i=e.params;return this.pushParams(i),this.opcode(`pushProgram`,t),this.opcode(`pushProgram`,n),e.hash?this.accept(e.hash):this.opcode(`emptyHash`,r),i},blockParamIndex:function(e){for(var t=0,n=this.options.blockParams.length;t<n;t++){var i=this.options.blockParams[t],a=i&&r.indexOf(i,e);if(i&&a>=0)return[t,a]}}};function s(e,t,r){if(e==null||typeof e!=`string`&&e.type!==`Program`)throw new n.default(`You must pass a string or Handlebars AST to Handlebars.precompile. You passed `+e);t||={},`data`in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i=r.parse(e,t),a=new r.Compiler().compile(i,t);return new r.JavaScriptCompiler().compile(a,t)}function c(e,t,i){if(t===void 0&&(t={}),e==null||typeof e!=`string`&&e.type!==`Program`)throw new n.default(`You must pass a string or Handlebars AST to Handlebars.compile. You passed `+e);t=r.extend({},t),`data`in t||(t.data=!0),t.compat&&(t.useDepths=!0);var a=void 0;function o(){var n=i.parse(e,t),r=new i.Compiler().compile(n,t),a=new i.JavaScriptCompiler().compile(r,t,void 0,!0);return i.template(a)}function s(e,t){return a||=o(),a.call(this,e,t)}return s._setup=function(e){return a||=o(),a._setup(e)},s._child=function(e,t,n,r){return a||=o(),a._child(e,t,n,r)},s}function l(e,t){if(e===t)return!0;if(r.isArray(e)&&r.isArray(t)&&e.length===t.length){for(var n=0;n<e.length;n++)if(!l(e[n],t[n]))return!1;return!0}}function u(e){if(!e.path.parts){var t=e.path;e.path={type:`PathExpression`,data:!1,depth:0,parts:[t.original+``],original:t.original+``,loc:t.loc}}}})),xi=n((e=>{var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``);e.encode=function(e){if(0<=e&&e<t.length)return t[e];throw TypeError(`Must be between 0 and 63: `+e)},e.decode=function(e){var t=65,n=90,r=97,i=122,a=48;return t<=e&&e<=n?e-t:r<=e&&e<=i?e-r+26:a<=e&&e<=57?e-a+52:e==43?62:e==47?63:-1}})),Si=n((e=>{var t=xi(),n=5,r=1<<n,i=r-1,a=r;function o(e){return e<0?(-e<<1)+1:(e<<1)+0}function s(e){var t=(e&1)==1,n=e>>1;return t?-n:n}e.encode=function(e){var r=``,s,c=o(e);do s=c&i,c>>>=n,c>0&&(s|=a),r+=t.encode(s);while(c>0);return r},e.decode=function(e,r,o){var c=e.length,l=0,u=0,d,f;do{if(r>=c)throw Error(`Expected more digits in base 64 VLQ value.`);if(f=t.decode(e.charCodeAt(r++)),f===-1)throw Error(`Invalid base64 digit: `+e.charAt(r-1));d=!!(f&a),f&=i,l+=f<<u,u+=n}while(d);o.value=s(l),o.rest=r}})),Ci=n((e=>{function t(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw Error(`"`+t+`" is a required argument.`)}e.getArg=t;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function i(e){var t=e.match(n);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}e.urlParse=i;function a(e){var t=``;return e.scheme&&(t+=e.scheme+`:`),t+=`//`,e.auth&&(t+=e.auth+`@`),e.host&&(t+=e.host),e.port&&(t+=`:`+e.port),e.path&&(t+=e.path),t}e.urlGenerate=a;function o(t){var n=t,r=i(t);if(r){if(!r.path)return t;n=r.path}for(var o=e.isAbsolute(n),s=n.split(/\/+/),c,l=0,u=s.length-1;u>=0;u--)c=s[u],c===`.`?s.splice(u,1):c===`..`?l++:l>0&&(c===``?(s.splice(u+1,l),l=0):(s.splice(u,2),l--));return n=s.join(`/`),n===``&&(n=o?`/`:`.`),r?(r.path=n,a(r)):n}e.normalize=o;function s(e,t){e===``&&(e=`.`),t===``&&(t=`.`);var n=i(t),s=i(e);if(s&&(e=s.path||`/`),n&&!n.scheme)return s&&(n.scheme=s.scheme),a(n);if(n||t.match(r))return t;if(s&&!s.host&&!s.path)return s.host=t,a(s);var c=t.charAt(0)===`/`?t:o(e.replace(/\/+$/,``)+`/`+t);return s?(s.path=c,a(s)):c}e.join=s,e.isAbsolute=function(e){return e.charAt(0)===`/`||n.test(e)};function c(e,t){e===``&&(e=`.`),e=e.replace(/\/$/,``);for(var n=0;t.indexOf(e+`/`)!==0;){var r=e.lastIndexOf(`/`);if(r<0||(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/)))return t;++n}return Array(n+1).join(`../`)+t.substr(e.length+1)}e.relative=c;var l=function(){return!(`__proto__`in Object.create(null))}();function u(e){return e}function d(e){return p(e)?`$`+e:e}e.toSetString=l?u:d;function f(e){return p(e)?e.slice(1):e}e.fromSetString=l?u:f;function p(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var n=t-10;n>=0;n--)if(e.charCodeAt(n)!==36)return!1;return!0}function m(e,t,n){var r=g(e.source,t.source);return r!==0||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:g(e.name,t.name)}e.compareByOriginalPositions=m;function h(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=g(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:g(e.name,t.name)}e.compareByGeneratedPositionsDeflated=h;function g(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function _(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=g(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:g(e.name,t.name)}e.compareByGeneratedPositionsInflated=_;function v(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,``))}e.parseSourceMapInput=v;function y(e,t,n){if(t||=``,e&&(e[e.length-1]!==`/`&&t[0]!==`/`&&(e+=`/`),t=e+t),n){var r=i(n);if(!r)throw Error(`sourceMapURL could not be parsed`);if(r.path){var c=r.path.lastIndexOf(`/`);c>=0&&(r.path=r.path.substring(0,c+1))}t=s(a(r),t)}return o(t)}e.computeSourceURL=y})),wi=n((e=>{var t=Ci(),n=Object.prototype.hasOwnProperty,r=typeof Map<`u`;function i(){this._array=[],this._set=r?new Map:Object.create(null)}i.fromArray=function(e,t){for(var n=new i,r=0,a=e.length;r<a;r++)n.add(e[r],t);return n},i.prototype.size=function(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},i.prototype.add=function(e,i){var a=r?e:t.toSetString(e),o=r?this.has(e):n.call(this._set,a),s=this._array.length;(!o||i)&&this._array.push(e),o||(r?this._set.set(e,s):this._set[a]=s)},i.prototype.has=function(e){if(r)return this._set.has(e);var i=t.toSetString(e);return n.call(this._set,i)},i.prototype.indexOf=function(e){if(r){var i=this._set.get(e);if(i>=0)return i}else{var a=t.toSetString(e);if(n.call(this._set,a))return this._set[a]}throw Error(`"`+e+`" is not in the set.`)},i.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw Error(`No element indexed by `+e)},i.prototype.toArray=function(){return this._array.slice()},e.ArraySet=i})),Ti=n((e=>{var t=Ci();function n(e,n){var r=e.generatedLine,i=n.generatedLine,a=e.generatedColumn,o=n.generatedColumn;return i>r||i==r&&o>=a||t.compareByGeneratedPositionsInflated(e,n)<=0}function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}r.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},r.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},r.prototype.toArray=function(){return this._sorted||=(this._array.sort(t.compareByGeneratedPositionsInflated),!0),this._array},e.MappingList=r})),Ei=n((e=>{var t=Si(),n=Ci(),r=wi().ArraySet,i=Ti().MappingList;function a(e){e||={},this._file=n.getArg(e,`file`,null),this._sourceRoot=n.getArg(e,`sourceRoot`,null),this._skipValidation=n.getArg(e,`skipValidation`,!1),this._sources=new r,this._names=new r,this._mappings=new i,this._sourcesContents=null}a.prototype._version=3,a.fromSourceMap=function(e){var t=e.sourceRoot,r=new a({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var i={generated:{line:e.generatedLine,column:e.generatedColumn}};e.source!=null&&(i.source=e.source,t!=null&&(i.source=n.relative(t,i.source)),i.original={line:e.originalLine,column:e.originalColumn},e.name!=null&&(i.name=e.name)),r.addMapping(i)}),e.sources.forEach(function(i){var a=i;t!==null&&(a=n.relative(t,i)),r._sources.has(a)||r._sources.add(a);var o=e.sourceContentFor(i);o!=null&&r.setSourceContent(i,o)}),r},a.prototype.addMapping=function(e){var t=n.getArg(e,`generated`),r=n.getArg(e,`original`,null),i=n.getArg(e,`source`,null),a=n.getArg(e,`name`,null);this._skipValidation||this._validateMapping(t,r,i,a),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:i,name:a})},a.prototype.setSourceContent=function(e,t){var r=e;this._sourceRoot!=null&&(r=n.relative(this._sourceRoot,r)),t==null?this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null)):(this._sourcesContents||=Object.create(null),this._sourcesContents[n.toSetString(r)]=t)},a.prototype.applySourceMap=function(e,t,i){var a=t;if(t==null){if(e.file==null)throw Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);a=e.file}var o=this._sourceRoot;o!=null&&(a=n.relative(o,a));var s=new r,c=new r;this._mappings.unsortedForEach(function(t){if(t.source===a&&t.originalLine!=null){var r=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});r.source!=null&&(t.source=r.source,i!=null&&(t.source=n.join(i,t.source)),o!=null&&(t.source=n.relative(o,t.source)),t.originalLine=r.line,t.originalColumn=r.column,r.name!=null&&(t.name=r.name))}var l=t.source;l!=null&&!s.has(l)&&s.add(l);var u=t.name;u!=null&&!c.has(u)&&c.add(u)},this),this._sources=s,this._names=c,e.sources.forEach(function(t){var r=e.sourceContentFor(t);r!=null&&(i!=null&&(t=n.join(i,t)),o!=null&&(t=n.relative(o,t)),this.setSourceContent(t,r))},this)},a.prototype._validateMapping=function(e,t,n,r){if(t&&typeof t.line!=`number`&&typeof t.column!=`number`)throw Error(`original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.`);if(!(e&&`line`in e&&`column`in e&&e.line>0&&e.column>=0&&!t&&!n&&!r)&&!(e&&`line`in e&&`column`in e&&t&&`line`in t&&`column`in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw Error(`Invalid mapping: `+JSON.stringify({generated:e,source:n,original:t,name:r}))},a.prototype._serializeMappings=function(){for(var e=0,r=1,i=0,a=0,o=0,s=0,c=``,l,u,d,f,p=this._mappings.toArray(),m=0,h=p.length;m<h;m++){if(u=p[m],l=``,u.generatedLine!==r)for(e=0;u.generatedLine!==r;)l+=`;`,r++;else if(m>0){if(!n.compareByGeneratedPositionsInflated(u,p[m-1]))continue;l+=`,`}l+=t.encode(u.generatedColumn-e),e=u.generatedColumn,u.source!=null&&(f=this._sources.indexOf(u.source),l+=t.encode(f-s),s=f,l+=t.encode(u.originalLine-1-a),a=u.originalLine-1,l+=t.encode(u.originalColumn-i),i=u.originalColumn,u.name!=null&&(d=this._names.indexOf(u.name),l+=t.encode(d-o),o=d)),c+=l}return c},a.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;t!=null&&(e=n.relative(t,e));var r=n.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},a.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},a.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.SourceMapGenerator=a})),Di=n((e=>{e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2;function t(n,r,i,a,o,s){var c=Math.floor((r-n)/2)+n,l=o(i,a[c],!0);return l===0?c:l>0?r-c>1?t(c,r,i,a,o,s):s==e.LEAST_UPPER_BOUND?r<a.length?r:-1:c:c-n>1?t(n,c,i,a,o,s):s==e.LEAST_UPPER_BOUND?c:n<0?-1:n}e.search=function(n,r,i,a){if(r.length===0)return-1;var o=t(-1,r.length,n,r,i,a||e.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&i(r[o],r[o-1],!0)===0;)--o;return o}})),Oi=n((e=>{function t(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function n(e,t){return Math.round(e+Math.random()*(t-e))}function r(e,i,a,o){if(a<o){var s=n(a,o),c=a-1;t(e,s,o);for(var l=e[o],u=a;u<o;u++)i(e[u],l)<=0&&(c+=1,t(e,c,u));t(e,c+1,u);var d=c+1;r(e,i,a,d-1),r(e,i,d+1,o)}}e.quickSort=function(e,t){r(e,t,0,e.length-1)}})),ki=n((e=>{var t=Ci(),n=Di(),r=wi().ArraySet,i=Si(),a=Oi().quickSort;function o(e,n){var r=e;return typeof e==`string`&&(r=t.parseSourceMapInput(e)),r.sections==null?new s(r,n):new l(r,n)}o.fromSourceMap=function(e,t){return s.fromSourceMap(e,t)},o.prototype._version=3,o.prototype.__generatedMappings=null,Object.defineProperty(o.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),o.prototype.__originalMappings=null,Object.defineProperty(o.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),o.prototype._charIsMappingSeparator=function(e,t){var n=e.charAt(t);return n===`;`||n===`,`},o.prototype._parseMappings=function(e,t){throw Error(`Subclasses must implement _parseMappings`)},o.GENERATED_ORDER=1,o.ORIGINAL_ORDER=2,o.GREATEST_LOWER_BOUND=1,o.LEAST_UPPER_BOUND=2,o.prototype.eachMapping=function(e,n,r){var i=n||null,a=r||o.GENERATED_ORDER,s;switch(a){case o.GENERATED_ORDER:s=this._generatedMappings;break;case o.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw Error(`Unknown order of iteration.`)}var c=this.sourceRoot;s.map(function(e){var n=e.source===null?null:this._sources.at(e.source);return n=t.computeSourceURL(c,n,this._sourceMapURL),{source:n,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name===null?null:this._names.at(e.name)}},this).forEach(e,i)},o.prototype.allGeneratedPositionsFor=function(e){var r=t.getArg(e,`line`),i={source:t.getArg(e,`source`),originalLine:r,originalColumn:t.getArg(e,`column`,0)};if(i.source=this._findSourceIndex(i.source),i.source<0)return[];var a=[],o=this._findMapping(i,this._originalMappings,`originalLine`,`originalColumn`,t.compareByOriginalPositions,n.LEAST_UPPER_BOUND);if(o>=0){var s=this._originalMappings[o];if(e.column===void 0)for(var c=s.originalLine;s&&s.originalLine===c;)a.push({line:t.getArg(s,`generatedLine`,null),column:t.getArg(s,`generatedColumn`,null),lastColumn:t.getArg(s,`lastGeneratedColumn`,null)}),s=this._originalMappings[++o];else for(var l=s.originalColumn;s&&s.originalLine===r&&s.originalColumn==l;)a.push({line:t.getArg(s,`generatedLine`,null),column:t.getArg(s,`generatedColumn`,null),lastColumn:t.getArg(s,`lastGeneratedColumn`,null)}),s=this._originalMappings[++o]}return a},e.SourceMapConsumer=o;function s(e,n){var i=e;typeof e==`string`&&(i=t.parseSourceMapInput(e));var a=t.getArg(i,`version`),o=t.getArg(i,`sources`),s=t.getArg(i,`names`,[]),c=t.getArg(i,`sourceRoot`,null),l=t.getArg(i,`sourcesContent`,null),u=t.getArg(i,`mappings`),d=t.getArg(i,`file`,null);if(a!=this._version)throw Error(`Unsupported version: `+a);c&&=t.normalize(c),o=o.map(String).map(t.normalize).map(function(e){return c&&t.isAbsolute(c)&&t.isAbsolute(e)?t.relative(c,e):e}),this._names=r.fromArray(s.map(String),!0),this._sources=r.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(e){return t.computeSourceURL(c,e,n)}),this.sourceRoot=c,this.sourcesContent=l,this._mappings=u,this._sourceMapURL=n,this.file=d}s.prototype=Object.create(o.prototype),s.prototype.consumer=o,s.prototype._findSourceIndex=function(e){var n=e;if(this.sourceRoot!=null&&(n=t.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);var r;for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==e)return r;return-1},s.fromSourceMap=function(e,n){var i=Object.create(s.prototype),o=i._names=r.fromArray(e._names.toArray(),!0),l=i._sources=r.fromArray(e._sources.toArray(),!0);i.sourceRoot=e._sourceRoot,i.sourcesContent=e._generateSourcesContent(i._sources.toArray(),i.sourceRoot),i.file=e._file,i._sourceMapURL=n,i._absoluteSources=i._sources.toArray().map(function(e){return t.computeSourceURL(i.sourceRoot,e,n)});for(var u=e._mappings.toArray().slice(),d=i.__generatedMappings=[],f=i.__originalMappings=[],p=0,m=u.length;p<m;p++){var h=u[p],g=new c;g.generatedLine=h.generatedLine,g.generatedColumn=h.generatedColumn,h.source&&(g.source=l.indexOf(h.source),g.originalLine=h.originalLine,g.originalColumn=h.originalColumn,h.name&&(g.name=o.indexOf(h.name)),f.push(g)),d.push(g)}return a(i.__originalMappings,t.compareByOriginalPositions),i},s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function c(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}s.prototype._parseMappings=function(e,n){for(var r=1,o=0,s=0,l=0,u=0,d=0,f=e.length,p=0,m={},h={},g=[],_=[],v,y,b,x,S;p<f;)if(e.charAt(p)===`;`)r++,p++,o=0;else if(e.charAt(p)===`,`)p++;else{for(v=new c,v.generatedLine=r,x=p;x<f&&!this._charIsMappingSeparator(e,x);x++);if(y=e.slice(p,x),b=m[y],b)p+=y.length;else{for(b=[];p<x;)i.decode(e,p,h),S=h.value,p=h.rest,b.push(S);if(b.length===2)throw Error(`Found a source, but no line and column`);if(b.length===3)throw Error(`Found a source and line, but no column`);m[y]=b}v.generatedColumn=o+b[0],o=v.generatedColumn,b.length>1&&(v.source=u+b[1],u+=b[1],v.originalLine=s+b[2],s=v.originalLine,v.originalLine+=1,v.originalColumn=l+b[3],l=v.originalColumn,b.length>4&&(v.name=d+b[4],d+=b[4])),_.push(v),typeof v.originalLine==`number`&&g.push(v)}a(_,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=_,a(g,t.compareByOriginalPositions),this.__originalMappings=g},s.prototype._findMapping=function(e,t,r,i,a,o){if(e[r]<=0)throw TypeError(`Line must be greater than or equal to 1, got `+e[r]);if(e[i]<0)throw TypeError(`Column must be greater than or equal to 0, got `+e[i]);return n.search(e,t,a,o)},s.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},s.prototype.originalPositionFor=function(e){var n={generatedLine:t.getArg(e,`line`),generatedColumn:t.getArg(e,`column`)},r=this._findMapping(n,this._generatedMappings,`generatedLine`,`generatedColumn`,t.compareByGeneratedPositionsDeflated,t.getArg(e,`bias`,o.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===n.generatedLine){var a=t.getArg(i,`source`,null);a!==null&&(a=this._sources.at(a),a=t.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var s=t.getArg(i,`name`,null);return s!==null&&(s=this._names.at(s)),{source:a,line:t.getArg(i,`originalLine`,null),column:t.getArg(i,`originalColumn`,null),name:s}}}return{source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1},s.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var i=e;this.sourceRoot!=null&&(i=t.relative(this.sourceRoot,i));var a;if(this.sourceRoot!=null&&(a=t.urlParse(this.sourceRoot))){var o=i.replace(/^file:\/\//,``);if(a.scheme==`file`&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!a.path||a.path==`/`)&&this._sources.has(`/`+i))return this.sourcesContent[this._sources.indexOf(`/`+i)]}if(n)return null;throw Error(`"`+i+`" is not in the SourceMap.`)},s.prototype.generatedPositionFor=function(e){var n=t.getArg(e,`source`);if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:t.getArg(e,`line`),originalColumn:t.getArg(e,`column`)},i=this._findMapping(r,this._originalMappings,`originalLine`,`originalColumn`,t.compareByOriginalPositions,t.getArg(e,`bias`,o.GREATEST_LOWER_BOUND));if(i>=0){var a=this._originalMappings[i];if(a.source===r.source)return{line:t.getArg(a,`generatedLine`,null),column:t.getArg(a,`generatedColumn`,null),lastColumn:t.getArg(a,`lastGeneratedColumn`,null)}}return{line:null,column:null,lastColumn:null}},e.BasicSourceMapConsumer=s;function l(e,n){var i=e;typeof e==`string`&&(i=t.parseSourceMapInput(e));var a=t.getArg(i,`version`),s=t.getArg(i,`sections`);if(a!=this._version)throw Error(`Unsupported version: `+a);this._sources=new r,this._names=new r;var c={line:-1,column:0};this._sections=s.map(function(e){if(e.url)throw Error(`Support for url field in sections not implemented.`);var r=t.getArg(e,`offset`),i=t.getArg(r,`line`),a=t.getArg(r,`column`);if(i<c.line||i===c.line&&a<c.column)throw Error(`Section offsets must be ordered and non-overlapping.`);return c=r,{generatedOffset:{generatedLine:i+1,generatedColumn:a+1},consumer:new o(t.getArg(e,`map`),n)}})}l.prototype=Object.create(o.prototype),l.prototype.constructor=o,l.prototype._version=3,Object.defineProperty(l.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}}),l.prototype.originalPositionFor=function(e){var r={generatedLine:t.getArg(e,`line`),generatedColumn:t.getArg(e,`column`)},i=n.search(r,this._sections,function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn}),a=this._sections[i];return a?a.consumer.originalPositionFor({line:r.generatedLine-(a.generatedOffset.generatedLine-1),column:r.generatedColumn-(a.generatedOffset.generatedLine===r.generatedLine?a.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},l.prototype.sourceContentFor=function(e,t){for(var n=0;n<this._sections.length;n++){var r=this._sections[n].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw Error(`"`+e+`" is not in the SourceMap.`)},l.prototype.generatedPositionFor=function(e){for(var n=0;n<this._sections.length;n++){var r=this._sections[n];if(r.consumer._findSourceIndex(t.getArg(e,`source`))!==-1){var i=r.consumer.generatedPositionFor(e);if(i)return{line:i.line+(r.generatedOffset.generatedLine-1),column:i.column+(r.generatedOffset.generatedLine===i.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},l.prototype._parseMappings=function(e,n){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var i=this._sections[r],o=i.consumer._generatedMappings,s=0;s<o.length;s++){var c=o[s],l=i.consumer._sources.at(c.source);l=t.computeSourceURL(i.consumer.sourceRoot,l,this._sourceMapURL),this._sources.add(l),l=this._sources.indexOf(l);var u=null;c.name&&(u=i.consumer._names.at(c.name),this._names.add(u),u=this._names.indexOf(u));var d={source:l,generatedLine:c.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:c.generatedColumn+(i.generatedOffset.generatedLine===c.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:c.originalLine,originalColumn:c.originalColumn,name:u};this.__generatedMappings.push(d),typeof d.originalLine==`number`&&this.__originalMappings.push(d)}a(this.__generatedMappings,t.compareByGeneratedPositionsDeflated),a(this.__originalMappings,t.compareByOriginalPositions)},e.IndexedSourceMapConsumer=l})),Ai=n((e=>{var t=Ei().SourceMapGenerator,n=Ci(),r=/(\r?\n)/,i=10,a=`$$$isSourceNode$$$`;function o(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=e??null,this.column=t??null,this.source=n??null,this.name=i??null,this[a]=!0,r!=null&&this.add(r)}o.fromStringWithSourceMap=function(e,t,i){var a=new o,s=e.split(r),c=0,l=function(){return e()+(e()||``);function e(){return c<s.length?s[c++]:void 0}},u=1,d=0,f=null;return t.eachMapping(function(e){if(f!==null)if(u<e.generatedLine)p(f,l()),u++,d=0;else{var t=s[c]||``,n=t.substr(0,e.generatedColumn-d);s[c]=t.substr(e.generatedColumn-d),d=e.generatedColumn,p(f,n),f=e;return}for(;u<e.generatedLine;)a.add(l()),u++;if(d<e.generatedColumn){var t=s[c]||``;a.add(t.substr(0,e.generatedColumn)),s[c]=t.substr(e.generatedColumn),d=e.generatedColumn}f=e},this),c<s.length&&(f&&p(f,l()),a.add(s.splice(c).join(``))),t.sources.forEach(function(e){var r=t.sourceContentFor(e);r!=null&&(i!=null&&(e=n.join(i,e)),a.setSourceContent(e,r))}),a;function p(e,t){if(e===null||e.source===void 0)a.add(t);else{var r=i?n.join(i,e.source):e.source;a.add(new o(e.originalLine,e.originalColumn,r,t,e.name))}}},o.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else if(e[a]||typeof e==`string`)e&&this.children.push(e);else throw TypeError(`Expected a SourceNode, string, or an array of SourceNodes and strings. Got `+e);return this},o.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else if(e[a]||typeof e==`string`)this.children.unshift(e);else throw TypeError(`Expected a SourceNode, string, or an array of SourceNodes and strings. Got `+e);return this},o.prototype.walk=function(e){for(var t,n=0,r=this.children.length;n<r;n++)t=this.children[n],t[a]?t.walk(e):t!==``&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},o.prototype.join=function(e){var t,n,r=this.children.length;if(r>0){for(t=[],n=0;n<r-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this},o.prototype.replaceRight=function(e,t){var n=this.children[this.children.length-1];return n[a]?n.replaceRight(e,t):typeof n==`string`?this.children[this.children.length-1]=n.replace(e,t):this.children.push(``.replace(e,t)),this},o.prototype.setSourceContent=function(e,t){this.sourceContents[n.toSetString(e)]=t},o.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;t<r;t++)this.children[t][a]&&this.children[t].walkSourceContents(e);for(var i=Object.keys(this.sourceContents),t=0,r=i.length;t<r;t++)e(n.fromSetString(i[t]),this.sourceContents[i[t]])},o.prototype.toString=function(){var e=``;return this.walk(function(t){e+=t}),e},o.prototype.toStringWithSourceMap=function(e){var n={code:``,line:1,column:0},r=new t(e),a=!1,o=null,s=null,c=null,l=null;return this.walk(function(e,t){n.code+=e,t.source!==null&&t.line!==null&&t.column!==null?((o!==t.source||s!==t.line||c!==t.column||l!==t.name)&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name}),o=t.source,s=t.line,c=t.column,l=t.name,a=!0):a&&=(r.addMapping({generated:{line:n.line,column:n.column}}),o=null,!1);for(var u=0,d=e.length;u<d;u++)e.charCodeAt(u)===i?(n.line++,n.column=0,u+1===d?(o=null,a=!1):a&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name})):n.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:n.code,map:r}},e.SourceNode=o})),ji=n((e=>{e.SourceMapGenerator=Ei().SourceMapGenerator,e.SourceMapConsumer=ki().SourceMapConsumer,e.SourceNode=Ai().SourceNode})),Mi=n(((e,t)=>{e.__esModule=!0;var n=Jr(),r=void 0;try{(typeof define!=`function`||!define.amd)&&(r=ji().SourceNode)}catch{}r||(r=function(e,t,n,r){this.src=``,r&&this.add(r)},r.prototype={add:function(e){n.isArray(e)&&(e=e.join(``)),this.src+=e},prepend:function(e){n.isArray(e)&&(e=e.join(``)),this.src=e+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}});function i(e,t,r){if(n.isArray(e)){for(var i=[],a=0,o=e.length;a<o;a++)i.push(t.wrap(e[a],r));return i}else if(typeof e==`boolean`||typeof e==`number`)return e+``;return e}function a(e){this.srcFile=e,this.source=[]}a.prototype={isEmpty:function(){return!this.source.length},prepend:function(e,t){this.source.unshift(this.wrap(e,t))},push:function(e,t){this.source.push(this.wrap(e,t))},merge:function(){var e=this.empty();return this.each(function(t){e.add([` `,t,`
|
|
13
|
-
`])}),e},each:function(e){for(var t=0,n=this.source.length;t<n;t++)e(this.source[t])},empty:function(){var e=this.currentLocation||{start:{}};return new r(e.start.line,e.start.column,this.srcFile)},wrap:function(e){var t=arguments.length<=1||arguments[1]===void 0?this.currentLocation||{start:{}}:arguments[1];return e instanceof r?e:(e=i(e,this,t),new r(t.start.line,t.start.column,this.srcFile,e))},functionCall:function(e,t,n){return n=this.generateList(n),this.wrap([e,t?`.`+t+`(`:`(`,n,`)`])},quotedString:function(e){return`"`+(e+``).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)+`"`},objectLiteral:function(e){var t=this,n=[];Object.keys(e).forEach(function(r){var a=i(e[r],t);a!==`undefined`&&n.push([t.quotedString(r),`:`,a])});var r=this.generateList(n);return r.prepend(`{`),r.add(`}`),r},generateList:function(e){for(var t=this.empty(),n=0,r=e.length;n<r;n++)n&&t.add(`,`),t.add(i(e[n],this));return t},generateArray:function(e){var t=this.generateList(e);return t.prepend(`[`),t.add(`]`),t}},e.default=a,t.exports=e.default})),Ni=n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=ci(),i=n(Yr()),a=Jr(),o=n(Mi());function s(e){this.value=e}function c(){}c.prototype={nameLookup:function(e,t){return this.internalNameLookup(e,t)},depthedLookup:function(e){return[this.aliasable(`container.lookup`),`(depths, `,JSON.stringify(e),`)`]},compilerInfo:function(){var e=r.COMPILER_REVISION;return[e,r.REVISION_CHANGES[e]]},appendToBuffer:function(e,t,n){return a.isArray(e)||(e=[e]),e=this.source.wrap(e,t),this.environment.isSimple?[`return `,e,`;`]:n?[`buffer += `,e,`;`]:(e.appendToBuffer=!0,e)},initializeBuffer:function(){return this.quotedString(``)},internalNameLookup:function(e,t){return this.lookupPropertyFunctionIsUsed=!0,[`lookupProperty(`,e,`,`,JSON.stringify(t),`)`]},lookupPropertyFunctionIsUsed:!1,compile:function(e,t,n,r){this.environment=e,this.options=t,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!r,this.name=this.environment.name,this.isChild=!!n,this.context=n||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(e,t),this.useDepths=this.useDepths||e.useDepths||e.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||e.useBlockParams;var a=e.opcodes,o=void 0,s=void 0,c=void 0,l=void 0;for(c=0,l=a.length;c<l;c++)o=a[c],this.source.currentLocation=o.loc,s||=o.loc,this[o.opcode].apply(this,o.args);if(this.source.currentLocation=s,this.pushSource(``),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new i.default(`Compile completed with content left on stack`);this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend([`var decorators = container.decorators, `,this.lookupPropertyFunctionVarDeclaration(),`;
|
|
14
|
-
`]),this.decorators.push(`return fn;`),r?this.decorators=Function.apply(this,[`fn`,`props`,`container`,`depth0`,`data`,`blockParams`,`depths`,this.decorators.merge()]):(this.decorators.prepend(`function(fn, props, container, depth0, data, blockParams, depths) {
|
|
15
|
-
`),this.decorators.push(`}
|
|
16
|
-
`),this.decorators=this.decorators.merge()));var u=this.createFunctionContext(r);if(this.isChild)return u;var d={compiler:this.compilerInfo(),main:u};this.decorators&&(d.main_d=this.decorators,d.useDecorators=!0);var f=this.context,p=f.programs,m=f.decorators;for(c=0,l=p.length;c<l;c++)d[c]=p[c],m[c]&&(d[c+`_d`]=m[c],d.useDecorators=!0);return this.environment.usePartial&&(d.usePartial=!0),this.options.data&&(d.useData=!0),this.useDepths&&(d.useDepths=!0),this.useBlockParams&&(d.useBlockParams=!0),this.options.compat&&(d.compat=!0),r?d.compilerOptions=this.options:(d.compiler=JSON.stringify(d.compiler),this.source.currentLocation={start:{line:1,column:0}},d=this.objectLiteral(d),t.srcName?(d=d.toStringWithSourceMap({file:t.destName}),d.map=d.map&&d.map.toString()):d=d.toString()),d},preamble:function(){this.lastContext=0,this.source=new o.default(this.options.srcName),this.decorators=new o.default(this.options.srcName)},createFunctionContext:function(e){var t=this,n=``,r=this.stackVars.concat(this.registers.list);r.length>0&&(n+=`, `+r.join(`, `));var i=0;Object.keys(this.aliases).forEach(function(e){var r=t.aliases[e];r.children&&r.referenceCount>1&&(n+=`, alias`+ ++i+`=`+e,r.children[0]=`alias`+i)}),this.lookupPropertyFunctionIsUsed&&(n+=`, `+this.lookupPropertyFunctionVarDeclaration());var a=[`container`,`depth0`,`helpers`,`partials`,`data`];(this.useBlockParams||this.useDepths)&&a.push(`blockParams`),this.useDepths&&a.push(`depths`);var o=this.mergeSource(n);return e?(a.push(o),Function.apply(this,a)):this.source.wrap([`function(`,a.join(`,`),`) {
|
|
17
|
-
`,o,`}`])},mergeSource:function(e){var t=this.environment.isSimple,n=!this.forceBuffer,r=void 0,i=void 0,a=void 0,o=void 0;return this.source.each(function(e){e.appendToBuffer?(a?e.prepend(` + `):a=e,o=e):(a&&=(i?a.prepend(`buffer += `):r=!0,o.add(`;`),o=void 0),i=!0,t||(n=!1))}),n?a?(a.prepend(`return `),o.add(`;`)):i||this.source.push(`return "";`):(e+=`, buffer = `+(r?``:this.initializeBuffer()),a?(a.prepend(`return buffer + `),o.add(`;`)):this.source.push(`return buffer;`)),e&&this.source.prepend(`var `+e.substring(2)+(r?``:`;
|
|
18
|
-
`)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return`lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
20
|
-
return parent[propertyName];
|
|
21
|
-
}
|
|
22
|
-
return undefined
|
|
23
|
-
}`},blockValue:function(e){var t=this.aliasable(`container.hooks.blockHelperMissing`),n=[this.contextName(0)];this.setupHelperArgs(e,0,n);var r=this.popStack();n.splice(1,0,r),this.push(this.source.functionCall(t,`call`,n))},ambiguousBlockValue:function(){var e=this.aliasable(`container.hooks.blockHelperMissing`),t=[this.contextName(0)];this.setupHelperArgs(``,0,t,!0),this.flushInline();var n=this.topStack();t.splice(1,0,n),this.pushSource([`if (!`,this.lastHelper,`) { `,n,` = `,this.source.functionCall(e,`call`,t),`}`])},appendContent:function(e){this.pendingContent?e=this.pendingContent+e:this.pendingLocation=this.source.currentLocation,this.pendingContent=e},append:function(){if(this.isInline())this.replaceStack(function(e){return[` != null ? `,e,` : ""`]}),this.pushSource(this.appendToBuffer(this.popStack()));else{var e=this.popStack();this.pushSource([`if (`,e,` != null) { `,this.appendToBuffer(e,void 0,!0),` }`]),this.environment.isSimple&&this.pushSource([`else { `,this.appendToBuffer(`''`,void 0,!0),` }`])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable(`container.escapeExpression`),`(`,this.popStack(),`)`]))},getContext:function(e){this.lastContext=e},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(e,t,n,r){var i=0;!r&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(e[i++])):this.pushContext(),this.resolvePath(`context`,e,i,t,n)},lookupBlockParam:function(e,t){this.useBlockParams=!0,this.push([`blockParams[`,e[0],`][`,e[1],`]`]),this.resolvePath(`context`,t,1)},lookupData:function(e,t,n){e?this.pushStackLiteral(`container.data(data, `+e+`)`):this.pushStackLiteral(`data`),this.resolvePath(`data`,t,0,!0,n)},resolvePath:function(e,t,n,r,i){var a=this;if(this.options.strict||this.options.assumeObjects){this.push(l(this.options.strict&&i,this,t,n,e));return}for(var o=t.length,s=function(n){a.replaceStack(function(i){var o=a.nameLookup(i,t[n],e);return r?[` && `,o]:[` != null ? `,o,` : `,i]})},c=n;c<o;c++)s(c)},resolvePossibleLambda:function(){this.push([this.aliasable(`container.lambda`),`(`,this.popStack(),`, `,this.contextName(0),`)`])},pushStringParam:function(e,t){this.pushContext(),this.pushString(t),t!==`SubExpression`&&(typeof e==`string`?this.pushString(e):this.pushStackLiteral(e))},emptyHash:function(e){this.trackIds&&this.push(`{}`),this.stringParams&&(this.push(`{}`),this.push(`{}`)),this.pushStackLiteral(e?`undefined`:`{}`)},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var e=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(e.ids)),this.stringParams&&(this.push(this.objectLiteral(e.contexts)),this.push(this.objectLiteral(e.types))),this.push(this.objectLiteral(e.values))},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){e==null?this.pushStackLiteral(null):this.pushStackLiteral(this.programExpression(e))},registerDecorator:function(e,t){var n=this.nameLookup(`decorators`,t,`decorator`),r=this.setupHelperArgs(t,e);this.decorators.push([`var decorator = `,n,`;`]),this.decorators.push([`if (typeof decorator !== "function") { throw new Error(`,this.quotedString(`Missing decorator: "`+t+`"`),`); }`]),this.decorators.push([`fn = `,this.decorators.functionCall(`decorator`,``,[`fn`,`props`,`container`,r]),` || fn;`])},invokeHelper:function(e,t,n){var r=this.popStack(),i=this.setupHelper(e,t),a=[];n&&a.push(i.name),a.push(r),this.options.strict||a.push(this.aliasable(`container.hooks.helperMissing`));var o=[`(`,this.itemsSeparatedBy(a,`||`),`)`],s=this.source.functionCall(o,`call`,i.callParams);this.push(s)},itemsSeparatedBy:function(e,t){var n=[];n.push(e[0]);for(var r=1;r<e.length;r++)n.push(t,e[r]);return n},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.push(this.source.functionCall(n.name,`call`,n.callParams))},invokeAmbiguous:function(e,t){this.useRegister(`helper`);var n=this.popStack();this.emptyHash();var r=this.setupHelper(0,e,t),i=[`(`,`(helper = `,this.lastHelper=this.nameLookup(`helpers`,e,`helper`),` || `,n,`)`];this.options.strict||(i[0]=`(helper = `,i.push(` != null ? helper : `,this.aliasable(`container.hooks.helperMissing`))),this.push([`(`,i,r.paramsInit?[`),(`,r.paramsInit]:[],`),`,`(typeof helper === `,this.aliasable(`"function"`),` ? `,this.source.functionCall(`helper`,`call`,r.callParams),` : helper))`])},invokePartial:function(e,t,n){var r=[],i=this.setupParams(t,1,r);e&&(t=this.popStack(),delete i.name),n&&(i.indent=JSON.stringify(n)),i.helpers=`helpers`,i.partials=`partials`,i.decorators=`container.decorators`,e?r.unshift(t):r.unshift(this.nameLookup(`partials`,t,`partial`)),this.options.compat&&(i.depths=`depths`),i=this.objectLiteral(i),r.push(i),this.push(this.source.functionCall(`container.invokePartial`,``,r))},assignToHash:function(e){var t=this.popStack(),n=void 0,r=void 0,i=void 0;this.trackIds&&(i=this.popStack()),this.stringParams&&(r=this.popStack(),n=this.popStack());var a=this.hash;n&&(a.contexts[e]=n),r&&(a.types[e]=r),i&&(a.ids[e]=i),a.values[e]=t},pushId:function(e,t,n){e===`BlockParam`?this.pushStackLiteral(`blockParams[`+t[0]+`].path[`+t[1]+`]`+(n?` + `+JSON.stringify(`.`+n):``)):e===`PathExpression`?this.pushString(t):e===`SubExpression`?this.pushStackLiteral(`true`):this.pushStackLiteral(`null`)},compiler:c,compileChildren:function(e,t){for(var n=e.children,r=void 0,i=void 0,a=0,o=n.length;a<o;a++){r=n[a],i=new this.compiler;var s=this.matchExistingProgram(r);if(s==null){var c=this.context.programs.push(``)-1;r.index=c,r.name=`program`+c,this.context.programs[c]=i.compile(r,t,this.context,!this.precompile),this.context.decorators[c]=i.decorators,this.context.environments[c]=r,this.useDepths=this.useDepths||i.useDepths,this.useBlockParams=this.useBlockParams||i.useBlockParams,r.useDepths=this.useDepths,r.useBlockParams=this.useBlockParams}else r.index=s.index,r.name=`program`+s.index,this.useDepths=this.useDepths||s.useDepths,this.useBlockParams=this.useBlockParams||s.useBlockParams}},matchExistingProgram:function(e){for(var t=0,n=this.context.environments.length;t<n;t++){var r=this.context.environments[t];if(r&&r.equals(e))return r}},programExpression:function(e){var t=this.environment.children[e],n=[t.index,`data`,t.blockParams];return(this.useBlockParams||this.useDepths)&&n.push(`blockParams`),this.useDepths&&n.push(`depths`),`container.program(`+n.join(`, `)+`)`},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},push:function(e){return e instanceof s||(e=this.source.wrap(e)),this.inlineStack.push(e),e},pushStackLiteral:function(e){this.push(new s(e))},pushSource:function(e){this.pendingContent&&=(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),void 0),e&&this.source.push(e)},replaceStack:function(e){var t=[`(`],n=void 0,r=void 0,a=void 0;if(!this.isInline())throw new i.default(`replaceStack on non-inline`);var o=this.popStack(!0);if(o instanceof s)n=[o.value],t=[`(`,n],a=!0;else{r=!0;var c=this.incrStack();t=[`((`,this.push(c),` = `,o,`)`],n=this.topStack()}var l=e.call(this,n);a||this.popStack(),r&&this.stackSlot--,this.push(t.concat(l,`)`))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push(`stack`+this.stackSlot),this.topStackName()},topStackName:function(){return`stack`+this.stackSlot},flushInline:function(){var e=this.inlineStack;this.inlineStack=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];if(r instanceof s)this.compileStack.push(r);else{var i=this.incrStack();this.pushSource([i,` = `,r,`;`]),this.compileStack.push(i)}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),n=(t?this.inlineStack:this.compileStack).pop();if(!e&&n instanceof s)return n.value;if(!t){if(!this.stackSlot)throw new i.default(`Invalid stack pop`);this.stackSlot--}return n},topStack:function(){var e=this.isInline()?this.inlineStack:this.compileStack,t=e[e.length-1];return t instanceof s?t.value:t},contextName:function(e){return this.useDepths&&e?`depths[`+e+`]`:`depth`+e},quotedString:function(e){return this.source.quotedString(e)},objectLiteral:function(e){return this.source.objectLiteral(e)},aliasable:function(e){var t=this.aliases[e];return t?(t.referenceCount++,t):(t=this.aliases[e]=this.source.wrap(e),t.aliasable=!0,t.referenceCount=1,t)},setupHelper:function(e,t,n){var r=[];return{params:r,paramsInit:this.setupHelperArgs(t,e,r,n),name:this.nameLookup(`helpers`,t,`helper`),callParams:[this.aliasable(this.contextName(0)+` != null ? `+this.contextName(0)+` : (container.nullContext || {})`)].concat(r)}},setupParams:function(e,t,n){var r={},i=[],a=[],o=[],s=!n,c=void 0;s&&(n=[]),r.name=this.quotedString(e),r.hash=this.popStack(),this.trackIds&&(r.hashIds=this.popStack()),this.stringParams&&(r.hashTypes=this.popStack(),r.hashContexts=this.popStack());var l=this.popStack(),u=this.popStack();(u||l)&&(r.fn=u||`container.noop`,r.inverse=l||`container.noop`);for(var d=t;d--;)c=this.popStack(),n[d]=c,this.trackIds&&(o[d]=this.popStack()),this.stringParams&&(a[d]=this.popStack(),i[d]=this.popStack());return s&&(r.args=this.source.generateArray(n)),this.trackIds&&(r.ids=this.source.generateArray(o)),this.stringParams&&(r.types=this.source.generateArray(a),r.contexts=this.source.generateArray(i)),this.options.data&&(r.data=`data`),this.useBlockParams&&(r.blockParams=`blockParams`),r},setupHelperArgs:function(e,t,n,r){var i=this.setupParams(e,t,n);return i.loc=JSON.stringify(this.source.currentLocation),i=this.objectLiteral(i),r?(this.useRegister(`options`),n.push(`options`),[`options=`,i]):n?(n.push(i),``):i}},(function(){for(var e=`break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false`.split(` `),t=c.RESERVED_WORDS={},n=0,r=e.length;n<r;n++)t[e[n]]=!0})(),c.isValidJavaScriptVariableName=function(e){return!c.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)};function l(e,t,n,r,i){var a=t.popStack(),o=n.length;e&&o--;for(var s=r;s<o;s++)a=t.nameLookup(a,n[s],i);return e?[t.aliasable(`container.strict`),`(`,a,`, `,t.quotedString(n[o]),`, `,JSON.stringify(t.source.currentLocation),` )`]:a}e.default=c,t.exports=e.default})),Pi=e(n(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=n(pi()),i=n(mi()),a=yi(),o=bi(),s=n(Ni()),c=n(gi()),l=n(fi()),u=r.default.create;function d(){var e=u();return e.compile=function(t,n){return o.compile(t,n,e)},e.precompile=function(t,n){return o.precompile(t,n,e)},e.AST=i.default,e.Compiler=o.Compiler,e.JavaScriptCompiler=s.default,e.Parser=a.parser,e.parse=a.parse,e.parseWithoutProcessing=a.parseWithoutProcessing,e}var f=d();f.create=d,l.default(f),f.Visitor=c.default,f.default=f,e.default=f,t.exports=e.default}))(),1),Fi=!1;function Ii(){Pi.default.registerHelper(`add`,(e,t)=>{let n=Number(e),r=Number(t);return Number.isNaN(n)||Number.isNaN(r)?(console.warn(`⚠️ add helper received non-numeric values: ${e}, ${t}`),0):n+r}),Pi.default.registerHelper(`sub`,(e,t)=>{let n=Number(e),r=Number(t);return Number.isNaN(n)||Number.isNaN(r)?(console.warn(`⚠️ sub helper received non-numeric values: ${e}, ${t}`),0):n-r}),Pi.default.registerHelper(`mul`,(e,t)=>{let n=Number(e),r=Number(t);return Number.isNaN(n)||Number.isNaN(r)?(console.warn(`⚠️ mul helper received non-numeric values: ${e}, ${t}`),0):n*r}),Pi.default.registerHelper(`div`,(e,t)=>{let n=Number(e),r=Number(t);return Number.isNaN(n)||Number.isNaN(r)?(console.warn(`⚠️ div helper received non-numeric values: ${e}, ${t}`),0):r===0?(console.warn(`⚠️ div helper received zero divisor`),0):n/r}),Pi.default.registerHelper(`mod`,(e,t)=>{let n=Number(e),r=Number(t);return Number.isNaN(n)||Number.isNaN(r)?(console.warn(`⚠️ mod helper received non-numeric values: ${e}, ${t}`),0):r===0?(console.warn(`⚠️ mod helper received zero divisor`),0):n%r}),Pi.default.registerHelper(`uppercase`,e=>String(e||``).toUpperCase()),Pi.default.registerHelper(`lowercase`,e=>String(e||``).toLowerCase()),Pi.default.registerHelper(`replace`,(e,t,n)=>String(e||``).split(t).join(n)),Pi.default.registerHelper(`eq`,(e,t)=>e===t),Pi.default.registerHelper(`neq`,(e,t)=>e!==t),Pi.default.registerHelper(`gt`,(e,t)=>Number(e)>Number(t)),Pi.default.registerHelper(`lt`,(e,t)=>Number(e)<Number(t)),Pi.default.registerHelper(`gte`,(e,t)=>Number(e)>=Number(t)),Pi.default.registerHelper(`lte`,(e,t)=>Number(e)<=Number(t)),Pi.default.registerHelper(`default`,(e,t)=>e??t),Pi.default.registerHelper(`json`,e=>JSON.stringify(e,null,2)),Pi.default.registerHelper(`isDefined`,e=>e!==void 0),Fi=!0}function Li(e,t,n={}){if(!e||typeof e!=`string`)return``;Fi||Ii();try{return Pi.default.compile(e)(t)}catch(r){return console.error(`❌ Handlebars template error:`,r),console.error(`Template:`,e),console.error(`Context keys:`,Object.keys(t)),n.onError===`raw`?e:``}}var Ri=`### First boot instructions for Agor Assistant
|
|
24
|
-
|
|
25
|
-
Context:
|
|
26
|
-
- Assistant: {{assistant.displayName}} {{assistant.emoji}}
|
|
27
|
-
{{#if assistant.description}}- Assistant description: {{assistant.description}}
|
|
28
|
-
{{/if}}{{#if user.name}}- User: {{user.name}}{{#if user.email}} <{{user.email}}>{{/if}}
|
|
29
|
-
{{else}}{{#if user.email}}- User email: {{user.email}}
|
|
30
|
-
{{/if}}{{/if}}
|
|
31
|
-
Read BOOTSTRAP.md, then say hello and ask only the next useful questions to shape this assistant.`;function zi({displayName:e,emoji:t,description:n,userName:r,userEmail:i}){let a=r?.trim(),o=i?.trim();return{assistant:{displayName:e.trim()||`My Assistant`,emoji:t?.trim()||`🤖`,...n?.trim()?{description:n.trim()}:{}},...a||o?{user:{...a?{name:a}:{},...o?{email:o}:{}}}:{},firstSession:!0}}function Bi(e){return Li(Ri,zi(e),{onError:`raw`})}async function Vi({client:e,boardId:t,assistantName:n,assistantEmoji:r}){if(!(!e||!t))try{await e.service(`boards`).ensureAssistantWelcomeNote({boardId:t,assistantName:n,assistantEmoji:r})}catch(e){console.warn(`Failed to create assistant welcome note:`,e)}}function Hi(e){if(!e)return``;let t=e.replace(/\\/g,`/`).split(`/`).filter(Boolean),n=t[t.length-1]||``;if(!n)return``;let r=n.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``);return r?`local/${r}`:``}function Ui(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}var Wi=e=>new Promise(t=>setTimeout(t,e));async function Gi(e,t,{timeoutMs:n=3e4,intervalMs:r=500}={}){if(!e)return;let i=Date.now()+n,a;for(;Date.now()<i;){let n=await e.service(`branches`).get(t);if(a=n.filesystem_status,!a||a===`ready`)return;if(a===`failed`)throw Error(n.error_message||`Branch filesystem creation failed`);if(a===`deleted`||a===`cleaned`||a===`preserved`)throw Error(`Branch filesystem is ${a}`);await Wi(r)}throw Error(`Timed out waiting for branch filesystem to become ready (${a})`)}async function Ki({client:e,branchId:t,boardId:n,sessionConfig:r,onCreateSession:i,onStatusChange:a}){a?.(`Preparing assistant worktree…`),await Gi(e,t),a?.(`Starting first session…`);let o=await i(r,n);if(!o)throw Error(`First assistant session could not be created.`);return o}var qi=({onEmojiClick:e})=>(0,W.jsx)(Pn,{onEmojiClick:e,theme:Mn.DARK,emojiStyle:Nn.NATIVE,width:350,height:400}),Ji=({value:e,onChange:t,defaultEmoji:n=`📋`,disabled:r=!1})=>{let[i,a]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{style:{display:`flex`,gap:0},children:[(0,W.jsx)(L,{prefix:(0,W.jsx)(`span`,{style:{fontSize:14},children:e||n}),readOnly:!0,disabled:r,style:{cursor:`default`,width:40,borderTopRightRadius:0,borderBottomRightRadius:0}}),(0,W.jsx)(Ge,{content:(0,W.jsx)(qi,{onEmojiClick:e=>{t?.(e.emoji),a(!1)}}),trigger:r?[]:`click`,open:r?!1:i,onOpenChange:e=>{r||a(e)},placement:`right`,children:(0,W.jsx)(V,{icon:(0,W.jsx)(ut,{}),disabled:r,style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:`none`}})})]})},Yi=({fieldName:e,defaultEmoji:t})=>(0,W.jsx)(B.Item,{name:e,noStyle:!0,initialValue:t,children:(0,W.jsx)(Ji,{defaultEmoji:t})}),{Text:Xi,Title:Zi,Paragraph:Qi}=s,{useToken:$i}=ce,ea=12e4;function ta(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,`-`).replace(/-{2,}/g,`-`).replace(/^-|-$/g,``)}function na(e){return e?ta(e.name||e.email.split(`@`)[0]||`user`):`user`}function ra(e){return e===`assistant`?[`welcome`,`identity`,`api-keys`,`clone`,`board`,`branch`]:e===`own-repo`?[`welcome`,`api-keys`,`add-repo`,`clone`,`board`,`branch`]:[`welcome`]}function ia(e,t){return e.indexOf(t)}function aa(e,t=`api-key`){return e===`claude-code`&&t===`claude-subscription-token`?`CLAUDE_CODE_OAUTH_TOKEN`:gn[e]??`ANTHROPIC_API_KEY`}function oa(e,t=`api-key`){if(e===`claude-code`&&t===`claude-subscription-token`)return`sk-ant-oat01-...`;switch(e){case`claude-code`:return`sk-ant-...`;case`codex`:return`sk-...`;case`gemini`:return`AIza...`;case`copilot`:return`ghp_...`;case`cursor`:return`key_...`;default:return`sk-ant-...`}}var sa={"claude-code":`Claude Code`,"claude-code-cli":`Claude Code CLI`,codex:`Codex (OpenAI)`,gemini:`Gemini`,opencode:`OpenCode`,copilot:`GitHub Copilot`,cursor:`Cursor SDK`};function ca(e){return e.clone_status===`ready`||e.clone_status===void 0}function la(e){return qr(e,{readyOnly:!0})}function ua(e,t){let n=t.remoteUrl?It(t.remoteUrl):``;for(let[r,i]of e)if(ca(i)&&(n&&i.remote_url&&It(i.remote_url)===n||t.slug&&i.slug===t.slug||t.localPath&&i.local_path===t.localPath))return r;return null}var da=[{value:`claude-code`,title:`Claude Code`,eyebrow:`Recommended`},{value:`codex`,title:`Codex`,eyebrow:`Recommended`}],fa=[{value:`gemini`,label:`Gemini`},{value:`copilot`,label:`GitHub Copilot`},{value:`opencode`,label:`OpenCode`},{value:`cursor`,label:`Cursor SDK (Beta)`}],pa=new Set(da.map(e=>e.value)),ma={"claude-code":{label:`platform.claude.com/settings/keys`,url:`https://platform.claude.com/settings/keys`},"claude-code-cli":{label:`platform.claude.com/settings/keys`,url:`https://platform.claude.com/settings/keys`},codex:{label:`platform.openai.com/api-keys`,url:`https://platform.openai.com/api-keys`},gemini:{label:`aistudio.google.com`,url:`https://aistudio.google.com/apikey`},copilot:{label:`github.com/features/copilot`,url:`https://github.com/features/copilot`},cursor:{label:`cursor.com`,url:`https://cursor.com`},opencode:null};function ha(e){return e===`codex`?`codex-cli-auth`:`api-key`}function ga(e){return e===`claude-code`?[{value:`claude-subscription-token`,label:`Subscription`},{value:`api-key`,label:`API key`}]:e===`codex`?[{value:`codex-cli-auth`,label:`CLI sign-in`},{value:`api-key`,label:`API key`}]:null}function _a({open:e,onComplete:t,repoById:n,branchById:r,boardById:i,user:a,client:o,onCreateRepo:c,onCreateLocalRepo:l,onCreateBranch:u,onCreateSession:f,onUpdateUser:p,onCheckAuth:h,assistantPending:g,frameworkRepoUrl:_}){let{token:y}=$i(),[b,x]=(0,U.useState)(null),[C,w]=(0,U.useState)(`welcome`),T=(0,U.useCallback)(e=>{w(t=>e)},[]),[E,D]=(0,U.useState)(null),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(``),[M,N]=(0,U.useState)(``),[te,ne]=(0,U.useState)(``),[re,ie]=(0,U.useState)(`remote`),[ae,oe]=(0,U.useState)(``),[F,se]=(0,U.useState)(`My Assistant`),[ce,le]=(0,U.useState)(`🤖`),[ue,de]=(0,U.useState)(``),[fe,pe]=(0,U.useState)(`api-key`),[me,he]=(0,U.useState)(`claude-code`),[ge,_e]=(0,U.useState)(`claude-code`),[ve,ye]=(0,U.useState)(!1),[be,Se]=(0,U.useState)(!1),[Ce,we]=(0,U.useState)(null),[Te,De]=(0,U.useState)(!1),[Oe,ke]=(0,U.useState)(null),[Ae,je]=(0,U.useState)(null),[R,Ne]=(0,U.useState)(null),Pe=(0,U.useRef)(null),[Fe,Ie]=(0,U.useState)(0),Le=(0,U.useRef)(null),ze=(0,U.useRef)(new Set),Be=(0,U.useMemo)(()=>ra(b),[b]),Ve=ia(Be,C),He=na(a),Ue=_||`https://github.com/preset-io/agor-assistant.git`,We=a?.agentic_tools?.[`claude-code`],Ge=a?.agentic_tools?.codex,Ke=a?.agentic_tools?.gemini,qe=a?.agentic_tools?.copilot,Je=a?.agentic_tools?.cursor,Ye=!!(We?.ANTHROPIC_API_KEY||We?.CLAUDE_CODE_OAUTH_TOKEN||a?.env_vars?.ANTHROPIC_API_KEY),Xe=!!(Ge?.OPENAI_API_KEY||a?.env_vars?.OPENAI_API_KEY),Ze=!!(Ke?.GEMINI_API_KEY||a?.env_vars?.GEMINI_API_KEY),Qe=!!(qe?.COPILOT_GITHUB_TOKEN||a?.env_vars?.COPILOT_GITHUB_TOKEN),$e=!!(Je?.CURSOR_API_KEY||a?.env_vars?.CURSOR_API_KEY),et=e=>{switch(e){case`claude-code`:return Ye;case`codex`:return Xe;case`gemini`:return Ze;case`copilot`:return Qe;case`cursor`:return $e;case`opencode`:return Ye||Xe||Ze;default:return!1}},tt=(0,U.useCallback)(()=>{de(``),D(null),we(null),De(!1)},[]),nt=(0,U.useCallback)((e,t={})=>{he(e),pe(ha(e)),pa.has(e)&&_e(e),ye(t.useDifferentProvider??!pa.has(e)),tt()},[tt]),rt=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(!e||rt.current||!a)return;rt.current=!0;let t=a.preferences?.onboarding,o=a.preferences?.mainBoardId;if(!t?.path){g&&!b&&x(`assistant`);return}let s=(t.path===`persisted-agent`?`assistant`:t.path)===`assistant`,c=s&&t.branchId&&r.get(t.branchId)?.created_by===a.user_id?t.branchId:void 0,l=s&&o&&i.get(o)?.created_by===a.user_id?o:void 0,u=s&&t.repoId&&n.has(t.repoId)?t.repoId:void 0;(t.branchId!==c||o!==l||t.repoId!==u)&&console.warn(`[OnboardingWizard] Dropping resume references not owned by current user`,{user_id:a.user_id,claimed:{branchId:t.branchId,mainBoardId:o,repoId:t.repoId},valid:{branchId:c,boardId:l,repoId:u}}),x(`assistant`),typeof t.assistantDisplayName==`string`&&(se(t.assistantDisplayName),oe(`private-${Ui(t.assistantDisplayName||`My Assistant`)}`)),typeof t.assistantEmoji==`string`&&le(t.assistantEmoji),l&&je(l),u&&ke(u),c&&Ne(c),T(c||l?`branch`:u?`board`:`identity`)},[e,a,g,b,n,i,r,T]);let at=(0,U.useRef)(!1);(0,U.useEffect)(()=>{a&&!at.current&&(at.current=!0,oe(`private-${He}`))},[a,He]),(0,U.useEffect)(()=>{if(!(C!==`clone`||!O)){if(b===`assistant`){let e=la(n);if(e){ke(e[0]),k(!1),D(null),Pe.current&&=(clearTimeout(Pe.current),null),T(`board`);return}}else if(b===`own-repo`&&(A||te)){let e=ua(n,{remoteUrl:A,slug:M,localPath:te});if(e){ke(e),k(!1),D(null),Pe.current&&=(clearTimeout(Pe.current),null),T(`board`);return}}}},[C,O,b,n,A,M,te,T]),(0,U.useEffect)(()=>{if(Oe||C!==`board`&&C!==`branch`)return;let e=ua(n,{remoteUrl:A,slug:M,localPath:te});if(e){ke(e);return}if(b===`assistant`){let e=la(n);e&&ke(e[0])}},[C,Oe,n,A,M,te,b]),(0,U.useEffect)(()=>{if(C!==`clone`||!O)return;let e;for(let[,t]of n)if(t.clone_status===`failed`&&!ze.current.has(t.repo_id)&&(b===`assistant`&&(t.slug===`preset-io/agor-assistant`||t.remote_url?.includes(`agor-assistant`))||b===`own-repo`&&(A&&t.remote_url&&It(t.remote_url)===It(A)||M&&t.slug===M||te&&t.local_path===te))){e=t;break}if(!e)return;let t=e.clone_error?.message??`Clone failed (exit ${e.clone_error?.exit_code??`?`}).`;k(!1),D(t),Pe.current&&=(clearTimeout(Pe.current),null)},[C,O,b,n,A,M,te]),(0,U.useEffect)(()=>{if(!o?.io)return;let e=(e,t)=>b===`assistant`&&e===`preset-io/agor-assistant`||b===`own-repo`&&(t&&t===A||e&&e===M),t=e=>{C!==`clone`||!O||(k(!1),D(e),Pe.current&&=(clearTimeout(Pe.current),null))},n=n=>{e(n.slug,n.url)&&t(n.error)},r=n=>{n.clone_status===`failed`&&e(n.slug,n.remote_url)&&t(n.clone_error?.message??`Clone failed (exit ${n.clone_error?.exit_code??`?`}).`)},i=o.service(`repos`);return o.io.on(`repo:cloneError`,n),i.on(`patched`,r),()=>{o.io.off(`repo:cloneError`,n),i.removeListener(`patched`,r)}},[o,C,O,b,A,M]),(0,U.useEffect)(()=>{!O&&Le.current&&(clearInterval(Le.current),Le.current=null)},[O]),(0,U.useEffect)(()=>()=>{Pe.current&&clearTimeout(Pe.current),Le.current&&clearInterval(Le.current)},[]);let ot=(0,U.useCallback)(e=>{if(!a)return;let t=a.preferences?.onboarding||{},n={...a.preferences,onboarding:{...t,...e}};e.boardId&&(n.mainBoardId=e.boardId),p(a.user_id,{preferences:n})},[a,p]),st=(0,U.useCallback)(()=>{let e=F.trim()||`My Assistant`;se(e),oe(`private-${Ui(e)}`),ot({assistantDisplayName:e,assistantEmoji:ce||`🤖`}),D(null),T(`api-keys`)},[F,ce,ot,T]);(0,U.useEffect)(()=>{Oe&&a?.preferences?.onboarding?.repoId!==Oe&&ot({repoId:Oe})},[Oe,a,ot]);let ct=(0,U.useCallback)(e=>{x(e),D(null),ot({path:e}),T(e===`assistant`?`identity`:`api-keys`)},[ot,T]),lt=(0,U.useCallback)(async()=>{let e=new Set;for(let[t,r]of n)r.clone_status===`failed`&&e.add(t);ze.current=e,D(null),k(!0),Ie(0),Le.current&&clearInterval(Le.current),Le.current=setInterval(()=>{Ie(e=>e+1)},1e3);try{if(b===`assistant`)await c({url:Ue,slug:Ur,default_branch:`main`});else{let e=A.startsWith(`/`)||A.startsWith(`~`);(e?`local`:re)===`remote`?await c({url:A,slug:M||``,default_branch:`main`}):await l({path:e?A:te,slug:M||void 0})}}catch(e){k(!1),D(e instanceof Error?e.message:String(e));return}let t=A.startsWith(`/`)||A.startsWith(`~`),r=b===`assistant`||b===`own-repo`&&(b===`own-repo`&&t?`local`:re)===`remote`;b===`own-repo`&&(r?T(`clone`):(Le.current&&=(clearInterval(Le.current),null),k(!1),T(`board`))),r&&(Pe.current=setTimeout(()=>{k(!1),D(`Clone is taking too long. This could be due to network issues, an unreachable repository, or a missing GITHUB_TOKEN for private repos. Please check and try again.`)},ea))},[b,Ue,re,A,M,te,n,c,l,T]),ut=(0,U.useCallback)(async()=>{let e=a?.preferences?.mainBoardId;if(e&&a&&i.get(e)?.created_by===a.user_id){je(e),b===`assistant`&&await Vi({client:o,boardId:e,assistantName:F.trim()||`My Assistant`,assistantEmoji:ce}),k(!1),T(`branch`);return}D(null),k(!0);let t=a?.name||a?.email?.split(`@`)[0]||`My`,n=b===`assistant`?`${F.trim()||`My Assistant`}'s Board`:`${t}'s Board`,r=b===`assistant`?ce||`🤖`:`🏠`;try{if(!o)throw Error(`Not connected`);let e=await o.service(`boards`).create({name:n,icon:r});e?.board_id&&(je(e.board_id),ot({boardId:e.board_id}),b===`assistant`&&await Vi({client:o,boardId:e.board_id,assistantName:F.trim()||`My Assistant`,assistantEmoji:ce}),k(!1),T(`branch`))}catch(e){k(!1),D(`Failed to create board: ${e instanceof Error?e.message:String(e)}`)}},[o,a,i,ot,T,b,F,ce]),dt=(0,U.useCallback)(async(e,n)=>{if(!b){D(`Missing onboarding path.`),k(!1);return}D(null),k(!0);try{let r={branch_id:e,agent:me,...b===`assistant`&&{initialPrompt:Bi({displayName:F,emoji:ce,userName:a?.name,userEmail:a?.email})}},i=b===`assistant`?await Ki({client:o,branchId:e,boardId:n,sessionConfig:r,onCreateSession:f}):await f(r,n);i?(k(!1),t({branchId:e,sessionId:i,boardId:n,path:b})):(k(!1),D(`Branch created, but failed to create the first session. Please try again.`))}catch(e){k(!1),D(`Branch created, but failed to create the first session: ${e instanceof Error?e.message:String(e)}`)}},[b,me,F,ce,a?.name,a?.email,f,t,o]),pt=(0,U.useCallback)(async()=>{if(!Oe||!Ae){D(`Missing repo or board. Please go back and try again.`);return}D(null),k(!0);let e=ta(ae),t=n.get(Oe)?.default_branch||`main`;try{let n=b===`assistant`?{kind:`assistant`,displayName:F.trim()||`My Assistant`,emoji:ce||void 0,frameworkRepo:Ur,createdViaOnboarding:!0}:null,r=await u(Oe,{name:e,ref:e,createBranch:!0,sourceBranch:t,pullLatest:!0,boardId:Ae,...n?{custom_context:{assistant:n}}:{}});r?(Ne(r.branch_id),ot({branchId:r.branch_id}),b===`assistant`&&await o?.service(`boards`).setPrimaryAssistant({boardId:Ae,branchId:r.branch_id}),await dt(r.branch_id,Ae)):(k(!1),D(`Failed to create branch. Please try again.`))}catch(e){k(!1),D(`Failed to create branch: ${e instanceof Error?e.message:String(e)}`)}},[Oe,Ae,b,ae,F,ce,n,u,o,ot,dt]),ht=(0,U.useCallback)(async()=>{if(!(!a||!ue.trim())){D(null),k(!0);try{let e=aa(me,fe),t=me===`opencode`?`claude-code`:me;await p(a.user_id,{agentic_tools:{[t]:{[e]:ue.trim()}}}),k(!1),T(b===`own-repo`?`add-repo`:`clone`)}catch(e){k(!1),D(`Failed to save API key: ${e instanceof Error?e.message:String(e)}`)}}},[a,ue,fe,me,b,p,T]),_t=(0,U.useCallback)(()=>{T(b===`own-repo`?`add-repo`:`clone`)},[b,T]),yt=(0,U.useCallback)(async()=>{if(!h)return;Se(!0),we(null);let e=await h(me,fe===`codex-cli-auth`?void 0:ue.trim()||void 0);Se(!1),we(e)},[h,me,ue,fe]),xt=(0,U.useCallback)(()=>{a&&t({branchId:``,sessionId:``,boardId:``,path:`assistant`})},[a,t]),St=(0,U.useCallback)(()=>{D(null);let e=Ve;e>0&&T(Be[e-1])},[Ve,Be,T]),Ct=()=>(0,W.jsxs)(`div`,{style:{padding:`8px 0`},children:[(0,W.jsx)(Zi,{level:3,style:{marginBottom:8},children:`Welcome to Agor ✨`}),(0,W.jsxs)(Qi,{style:{marginBottom:14,fontSize:15},children:[`Start by creating your`,` `,(0,W.jsx)(s.Link,{strong:!0,href:`https://agor.live/guide/assistants`,target:`_blank`,rel:`noopener noreferrer`,children:`Agor assistant`}),`: a persistent agent that can help you set up the workspace and keep things moving.`]}),(0,W.jsxs)(`div`,{style:{background:y.colorPrimaryBg,border:`1px solid ${y.colorPrimaryBorder}`,borderRadius:8,padding:`14px 16px`,marginBottom:16},children:[(0,W.jsx)(Xi,{strong:!0,children:`Your assistant can help:`}),(0,W.jsxs)(`ul`,{style:{margin:`10px 0 0`,paddingLeft:20,color:y.colorTextSecondary},children:[(0,W.jsx)(`li`,{children:`🧰 Connect tools and credentials`}),(0,W.jsx)(`li`,{children:`🗺️ Set up your board and workflow`}),(0,W.jsx)(`li`,{children:`🤝 Coordinate other agents and sessions`}),(0,W.jsx)(`li`,{children:`💬 Show you around and answer questions`})]})]}),(0,W.jsxs)(Qi,{type:`secondary`,style:{marginBottom:24,fontSize:14},children:[`Want the bigger picture first? Read the`,` `,(0,W.jsx)(s.Link,{href:`https://agor.live/guide/getting-started`,target:`_blank`,rel:`noopener noreferrer`,children:`getting started guide`}),`.`]}),(0,W.jsx)(V,{type:`primary`,size:`large`,icon:(0,W.jsx)(m,{}),onClick:()=>ct(`assistant`),children:`Create your assistant`})]}),wt=()=>(0,W.jsxs)(`div`,{style:{padding:`16px 0`},children:[(0,W.jsx)(Zi,{level:4,children:`Name Your Assistant`}),(0,W.jsx)(Qi,{type:`secondary`,children:`Pick the name and emoji this assistant will use in its first bootstrap session.`}),(0,W.jsx)(B,{layout:`vertical`,children:(0,W.jsx)(B.Item,{label:`Name`,required:!0,children:(0,W.jsxs)(z.Compact,{style:{display:`flex`},children:[(0,W.jsx)(Ji,{value:ce,onChange:le,defaultEmoji:`🤖`}),(0,W.jsx)(L,{placeholder:`e.g. PR Reviewer, Command Center`,value:F,onChange:e=>se(e.target.value),autoFocus:!0,style:{flex:1}})]})})}),(0,W.jsx)(V,{type:`primary`,onClick:st,disabled:!F.trim(),children:`Continue`})]}),Tt=()=>(0,W.jsxs)(`div`,{style:{padding:`16px 0`},children:[(0,W.jsx)(Zi,{level:4,children:`Add Your Repository`}),(0,W.jsx)(Qi,{type:`secondary`,children:`Connect a Git repository to get started. You can clone a remote repo or register a local one.`}),(0,W.jsxs)(z,{style:{marginBottom:16},children:[(0,W.jsx)(V,{type:re===`remote`?`primary`:`default`,size:`small`,onClick:()=>ie(`remote`),children:`Remote URL`}),(0,W.jsx)(V,{type:re===`local`?`primary`:`default`,size:`small`,onClick:()=>ie(`local`),children:`Local Path`})]}),re===`remote`?(0,W.jsxs)(B,{layout:`vertical`,children:[(0,W.jsx)(B.Item,{label:`Git URL`,required:!0,children:(0,W.jsx)(L,{placeholder:`https://github.com/user/repo.git`,value:A,onChange:e=>{let t=e.target.value;if(j(t),t)try{let e=t.startsWith(`/`)||t.startsWith(`~`)?Hi(t):Kt(t);e&&N(e)}catch{}}})}),(0,W.jsx)(B.Item,{label:`Slug (optional)`,validateStatus:M&&!Sn(M)?`error`:``,help:M&&!Sn(M)?`Must be org/name format (e.g. "my-org/my-repo")`:void 0,extra:`Auto-detected from URL (editable)`,children:(0,W.jsx)(L,{placeholder:`user/repo`,value:M,onChange:e=>N(e.target.value)})})]}):(0,W.jsxs)(B,{layout:`vertical`,children:[(0,W.jsx)(B.Item,{label:`Local Path`,required:!0,children:(0,W.jsx)(L,{placeholder:`/path/to/your/repo`,value:te,onChange:e=>{let t=e.target.value;if(ne(t),!t)return;let n=Hi(t);n&&N(n)}})}),(0,W.jsx)(B.Item,{label:`Slug (optional)`,validateStatus:M&&!Sn(M)?`error`:``,help:M&&!Sn(M)?`Must be org/name format (e.g. "my-org/my-repo")`:void 0,extra:`Auto-detected from path (editable)`,children:(0,W.jsx)(L,{placeholder:`local/repo`,value:M,onChange:e=>N(e.target.value)})})]}),(0,W.jsx)(V,{type:`primary`,onClick:lt,loading:O,disabled:re===`remote`?!A.trim():!te.trim(),children:re===`remote`?`Clone Repository`:`Add Local Repository`})]}),Et=()=>(0,W.jsx)(`div`,{style:{textAlign:`center`,padding:`32px 0`},children:O?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ee,{size:`large`}),(0,W.jsx)(Qi,{style:{marginTop:16},children:b===`assistant`?`Cloning assistant framework...`:`Setting up your repository...`}),(0,W.jsx)(Xi,{type:`secondary`,children:Fe<10?`This may take a moment`:Fe<30?`Cloning in progress... (${Fe}s)`:`Still working... large repos can take a while (${Fe}s)`})]}):E?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(I,{type:`error`,message:`Clone failed`,description:E,showIcon:!0,style:{marginBottom:16,textAlign:`left`}}),(0,W.jsx)(V,{type:`primary`,onClick:lt,children:`Retry`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(xe,{status:`success`,title:`Repository Ready`,subTitle:b===`assistant`?`Assistant framework cloned successfully.`:`Your repository is ready.`}),(0,W.jsx)(V,{type:`primary`,onClick:()=>T(`board`),children:`Continue`})]})}),Dt=()=>(0,W.jsx)(`div`,{style:{textAlign:`center`,padding:`32px 0`},children:E?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(I,{type:`error`,message:E,showIcon:!0,style:{marginBottom:16,textAlign:`left`}}),(0,W.jsx)(V,{type:`primary`,onClick:ut,children:`Retry`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ee,{size:`large`}),(0,W.jsx)(Zi,{level:4,style:{marginTop:16},children:b===`assistant`?`Setting up your assistant's board`:`Creating your board`}),(0,W.jsx)(Qi,{type:`secondary`,style:{marginBottom:0},children:b===`assistant`?`Agor is creating a board where your assistant can organize its work.`:`Agor is creating a personal board for your work.`})]})}),Ot=()=>{let e=(Oe?n.get(Oe)?.default_branch:null)||`main`;return R&&Ae?(0,W.jsxs)(`div`,{style:{textAlign:`center`,padding:`24px 0`},children:[(0,W.jsx)(xe,{icon:(0,W.jsx)(Re,{style:{color:y.colorSuccess}}),title:b===`assistant`?`Assistant Branch Ready`:`Branch Created`,subTitle:b===`assistant`?`Start your assistant to finish onboarding.`:`The branch is ready. Create the first session to finish onboarding.`}),E&&(0,W.jsx)(I,{type:`error`,message:E,showIcon:!0,style:{marginBottom:16,textAlign:`left`}}),(0,W.jsx)(V,{type:`primary`,size:`large`,onClick:()=>dt(R,Ae),loading:O,children:b===`assistant`?`Start Assistant`:`Create First Session`})]}):(0,W.jsxs)(`div`,{style:{padding:`16px 0`},children:[(0,W.jsx)(Zi,{level:4,children:b===`assistant`?`Name Your Assistant Branch`:`Create Your Branch`}),(0,W.jsx)(Qi,{type:`secondary`,children:b===`assistant`?`Your assistant works from its own branch: a safe place to use tools and keep setup context.`:`A branch is an isolated workspace backed by its own git branch. Name it whatever you like. We’ll create the first session after the branch is ready.`}),(0,W.jsx)(B,{layout:`vertical`,children:(0,W.jsx)(B.Item,{label:`Branch name`,extra:b===`assistant`?void 0:(0,W.jsxs)(W.Fragment,{children:[`Used as both the directory name and the new branch name. Forked from`,` `,(0,W.jsx)(Xi,{code:!0,children:e}),`.`]}),children:(0,W.jsx)(L,{placeholder:`private-${He}`,value:ae,onChange:e=>oe(e.target.value)})})}),E&&(0,W.jsx)(I,{type:`error`,message:E,showIcon:!0,style:{marginBottom:16}}),(0,W.jsx)(V,{type:`primary`,onClick:pt,loading:O,disabled:!ae.trim(),children:b===`assistant`?`Create Branch & Start Assistant`:`Create Branch & First Session`})]})},kt=()=>{let e=et(me),t=ga(me),n=me===`codex`&&fe===`codex-cli-auth`,r=aa(me,fe);return(0,W.jsxs)(`div`,{style:{padding:`16px 0`},children:[(0,W.jsx)(Zi,{level:4,children:`Choose an LLM Provider`}),(0,W.jsx)(Qi,{type:`secondary`,style:{marginBottom:16},children:`Pick what powers your assistant. You can change this later.`}),(0,W.jsxs)(z,{direction:`vertical`,size:`middle`,style:{width:`100%`,marginBottom:16},children:[(0,W.jsx)(`div`,{role:`radiogroup`,"aria-label":`Recommended LLM providers`,style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(220px, 1fr))`,gap:12},children:da.map(e=>{let t=me===e.value;return(0,W.jsx)(Me,{size:`small`,style:{borderColor:t?y.colorPrimary:y.colorBorder,background:t?y.colorPrimaryBg:void 0},styles:{body:{padding:0}},children:(0,W.jsx)(`label`,{style:{display:`block`,width:`100%`,cursor:`pointer`,padding:14},children:(0,W.jsxs)(z,{align:`center`,size:10,style:{width:`100%`},children:[(0,W.jsx)(dr,{tool:e.value,size:32}),(0,W.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(`div`,{children:(0,W.jsx)(Xi,{strong:!0,children:e.title})}),(0,W.jsx)(`div`,{children:(0,W.jsx)(v,{color:t?`blue`:`default`,children:e.eyebrow})})]}),(0,W.jsx)(`input`,{type:`radio`,name:`recommended-agent`,value:e.value,checked:t,onChange:()=>nt(e.value,{useDifferentProvider:!1}),style:{accentColor:y.colorPrimary}})]})})},e.value)})}),(0,W.jsx)(vt,{checked:ve,onChange:e=>{let t=e.target.checked;nt(t?fa[0].value:ge,{useDifferentProvider:t})},children:`Use a different provider`}),ve&&(0,W.jsx)(B,{layout:`vertical`,children:(0,W.jsx)(B.Item,{label:`Other LLM providers`,style:{marginBottom:0},children:(0,W.jsx)(P,{value:pa.has(me)?void 0:me,onChange:e=>nt(e,{useDifferentProvider:!0}),options:fa,style:{width:`100%`}})})})]}),e&&!Te?(0,W.jsxs)(`div`,{style:{textAlign:`center`,padding:`8px 0`},children:[(0,W.jsx)(xe,{style:{padding:`16px 0`},icon:(0,W.jsx)(Re,{style:{color:y.colorSuccess}}),title:`${sa[me]} is configured`,subTitle:`You're all set to use ${sa[me]}.`}),(0,W.jsxs)(z,{direction:`vertical`,size:`small`,children:[(0,W.jsx)(V,{type:`primary`,onClick:_t,children:`Continue`}),(0,W.jsx)(V,{type:`link`,onClick:()=>De(!0),children:`Use a different API key instead`})]})]}):(0,W.jsxs)(W.Fragment,{children:[e&&Te&&(0,W.jsx)(`div`,{style:{marginBottom:12},children:(0,W.jsx)(V,{type:`link`,onClick:()=>{De(!1),de(``)},style:{padding:0},children:`← Back to detected authentication`})}),t&&(0,W.jsx)(d.Group,{value:fe,onChange:e=>{pe(e.target.value),de(``),we(null)},style:{width:`100%`,marginBottom:16},children:(0,W.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, minmax(0, 1fr))`,gap:8},children:t.map(e=>{let t=fe===e.value;return(0,W.jsx)(d,{value:e.value,style:{alignItems:`center`,border:t?`1px solid var(--ant-color-primary)`:`1px solid var(--ant-color-border)`,borderRadius:8,display:`flex`,marginInlineEnd:0,padding:`8px 12px`},children:(0,W.jsx)(Xi,{strong:t,children:e.label})},e.value)})})}),me===`claude-code`?fe===`claude-subscription-token`?(0,W.jsx)(I,{type:`info`,showIcon:!0,style:{marginBottom:16,textAlign:`left`},description:(0,W.jsxs)(`span`,{children:[`Run `,(0,W.jsx)(Xi,{code:!0,children:`claude setup-token`}),` on the machine Agor runs sessions on, then paste the printed token below.`]})}):(0,W.jsxs)(Qi,{type:`secondary`,style:{marginBottom:16},children:[`Paste an `,(0,W.jsx)(Xi,{code:!0,children:`ANTHROPIC_API_KEY`}),` from`,` `,(0,W.jsx)(s.Link,{href:`https://platform.claude.com/settings/keys`,target:`_blank`,children:`Claude Console`}),` `,`for pay-as-you-go API billing.`]}):me===`codex`?n?(0,W.jsx)(I,{type:`info`,showIcon:!0,style:{marginBottom:16,textAlign:`left`},description:(0,W.jsxs)(`span`,{children:[`Run `,(0,W.jsx)(Xi,{code:!0,children:`codex login --device-auth`}),` on the machine Agor runs sessions on; Agor uses that local auth when no `,(0,W.jsx)(Xi,{code:!0,children:`OPENAI_API_KEY`}),` is set.`]})}):(0,W.jsxs)(Qi,{type:`secondary`,style:{marginBottom:16},children:[`Paste an `,(0,W.jsx)(Xi,{code:!0,children:`OPENAI_API_KEY`}),` from`,` `,(0,W.jsx)(s.Link,{href:`https://platform.openai.com/api-keys`,target:`_blank`,children:`OpenAI Platform`}),` `,`for API billing, automation, or team-managed keys.`]}):ma[me]?(0,W.jsxs)(Qi,{type:`secondary`,style:{marginBottom:16},children:[`Paste your `,r,` below. Get one at`,` `,(0,W.jsx)(s.Link,{href:ma[me]?.url,target:`_blank`,rel:`noopener noreferrer`,children:ma[me]?.label}),`.`]}):null,me===`opencode`&&(0,W.jsx)(Qi,{type:`secondary`,style:{marginBottom:16},children:`OpenCode supports 75+ LLM providers. Configure the appropriate API key for your chosen provider below.`}),!n&&(0,W.jsx)(B,{layout:`vertical`,children:(0,W.jsx)(B.Item,{label:r,children:(0,W.jsx)(L.Password,{placeholder:oa(me,fe),value:ue,onChange:e=>{de(e.target.value),we(null)}})})}),E&&(0,W.jsx)(I,{type:`error`,message:E,showIcon:!0,style:{marginBottom:16}}),Ce&&(Ce.authenticated?(0,W.jsx)(I,{type:`success`,showIcon:!0,style:{marginBottom:16,textAlign:`left`},message:`Connection works`,description:Ce.hint||(n?`Click Continue with Codex CLI auth to use this machine login.`:`Click Save & Continue to store this key.`)}):(0,W.jsx)(I,{type:`warning`,showIcon:!0,style:{marginBottom:16,textAlign:`left`},message:`Not authenticated`,description:Ce.hint})),(0,W.jsxs)(z,{wrap:!0,children:[n?(0,W.jsx)(V,{type:`primary`,onClick:_t,disabled:O,children:`Continue with Codex CLI auth`}):(0,W.jsx)(V,{type:`primary`,onClick:ht,loading:O,disabled:!ue.trim(),icon:(0,W.jsx)(S,{}),children:`Save & Continue`}),h&&(0,W.jsx)(V,{onClick:yt,loading:be,disabled:O,children:`Test Connection`}),!n&&(0,W.jsx)(V,{onClick:_t,disabled:O,children:`Continue without key`})]})]})]})},At=()=>{switch(C){case`welcome`:return Ct();case`identity`:return wt();case`add-repo`:return Tt();case`clone`:return Et();case`board`:return Dt();case`branch`:return Ot();case`api-keys`:return kt();default:return null}},jt=(0,U.useMemo)(()=>b===`assistant`?[{key:`identity`,title:`Assistant`,icon:(0,W.jsx)(m,{})},{key:`api-keys`,title:`LLM Provider`,icon:(0,W.jsx)(mt,{})},{key:`branch`,title:`Workspace`,icon:(0,W.jsx)(ft,{})}]:b===`own-repo`?[{key:`api-keys`,title:`LLM Provider`,icon:(0,W.jsx)(mt,{})},{key:`add-repo`,title:`Repo`,icon:(0,W.jsx)(bt,{})},{key:`branch`,title:`Workspace`,icon:(0,W.jsx)(ft,{})}]:[],[b]),Mt=(0,U.useMemo)(()=>!b||C===`welcome`?-1:b===`assistant`?C===`identity`?0:C===`api-keys`?1:2:C===`api-keys`?0:C===`add-repo`||C===`clone`?1:2,[b,C]);return(0,U.useEffect)(()=>{C===`clone`&&b===`assistant`&&!O&&!E&&!Oe&<()},[C,b,O,E,Oe,lt]),(0,U.useEffect)(()=>{C===`board`&&!O&&!E&&!Ae&&ut()},[C,O,E,Ae,ut]),(0,W.jsxs)(it,{open:e,closable:!1,mask:{closable:!1},keyboard:!1,footer:(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`0 8px`},children:[(0,W.jsxs)(z,{size:`middle`,children:[(0,W.jsx)(s.Link,{href:`https://agor.live/guide/getting-started`,target:`_blank`,style:{fontSize:12},children:`Getting Started Docs`}),(0,W.jsx)(s.Link,{href:`https://github.com/preset-io/agor`,target:`_blank`,style:{fontSize:12},children:`GitHub`})]}),(0,W.jsx)(z,{size:`small`,children:(0,W.jsx)(ee,{title:`Skip setup?`,description:(0,W.jsxs)(`div`,{style:{maxWidth:250},children:[`Are you sure? Your assistant has been waiting their whole life to meet you.`,(0,W.jsx)(`br`,{}),(0,W.jsx)(`br`,{}),(0,W.jsx)(Xi,{type:`secondary`,style:{fontSize:12},children:`(You can always come back via Settings)`})]}),okText:`Skip anyway`,cancelText:`Go back`,onConfirm:xt,children:(0,W.jsx)(V,{type:`text`,size:`small`,style:{color:y.colorTextTertiary},children:`Skip setup`})})})]}),width:640,styles:{body:{minHeight:360,padding:`24px 32px`}},children:[!b||C===`welcome`||jt.length===0?null:(0,W.jsx)(`ol`,{"aria-label":`Onboarding progress`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:10,marginBottom:24,padding:0,listStyle:`none`},children:jt.map((e,t)=>{let n=t===Mt,r=n?y.colorPrimary:y.colorTextDisabled;return(0,W.jsxs)(`li`,{"aria-current":n?`step`:void 0,style:{display:`flex`,alignItems:`center`,gap:10,color:r},children:[(0,W.jsxs)(z,{direction:`vertical`,size:4,align:`center`,children:[(0,W.jsx)(`div`,{style:{width:34,height:34,borderRadius:999,display:`flex`,alignItems:`center`,justifyContent:`center`,color:r,background:n?y.colorPrimaryBg:y.colorFillTertiary,border:`1px solid ${n?y.colorPrimary:y.colorBorder}`,opacity:n?1:.55},children:e.icon}),(0,W.jsx)(Xi,{style:{color:r,fontSize:12,fontWeight:n?600:void 0,opacity:n?1:.65},children:e.title})]}),t<jt.length-1&&(0,W.jsx)(gt,{style:{color:y.colorTextDisabled,opacity:.55,fontSize:12}})]},e.key)})}),At(),C!==`welcome`&&Ve>1&&!O&&(0,W.jsx)(`div`,{style:{marginTop:16},children:(0,W.jsx)(V,{type:`link`,onClick:St,style:{padding:0},children:`← Back`})})]})}var va=5e3,ya=(0,U.createContext)(null);function ba({children:e}){let t=(0,U.useRef)(null),n=(0,U.useRef)(null),r=(0,U.useRef)(null),i=(0,U.useMemo)(()=>({recenterRef:t,boardSwitcherRef:n,pendingRef:r}),[]);return(0,W.jsx)(ya.Provider,{value:i,children:e})}function xa(e,t){(0,U.useEffect)(()=>{if(e)return e.current=t,()=>{e.current===t&&(e.current=null)}},[e,t])}function Sa(e){xa((0,U.useContext)(ya)?.recenterRef,e)}function Ca(e){xa((0,U.useContext)(ya)?.boardSwitcherRef,e)}function wa(){let e=(0,U.useContext)(ya);return(0,U.useCallback)(()=>{let t=e?.pendingRef.current;return t?Date.now()>t.expiresAt?(e.pendingRef.current=null,null):(e.pendingRef.current=null,t.nodeId):null},[e])}function Ta(){let e=(0,U.useContext)(ya);return(0,U.useCallback)((t,n)=>e?e.recenterRef.current?.(t)?!0:n?.boardId&&e.boardSwitcherRef.current?(e.pendingRef.current={nodeId:t,expiresAt:Date.now()+va},e.boardSwitcherRef.current(n.boardId),!0):!1:!1,[e])}var Ea=(0,U.createContext)({connected:!1,connecting:!1,outOfSync:!1,capturedSha:null,currentSha:null}),Da=Ea.Provider;function Oa(){return!Aa().canMutate}function ka(){return(0,U.useContext)(Ea)}function Aa(){let{connected:e,connecting:t,outOfSync:n}=(0,U.useContext)(Ea);return n?{canMutate:!1,reason:`out-of-sync`,message:`Daemon was upgraded — refresh the page to continue.`}:t?{canMutate:!1,reason:`reconnecting`,message:`Reconnecting to daemon…`}:e?{canMutate:!0,reason:null,message:null}:{canMutate:!1,reason:`disconnected`,message:`Disconnected from daemon. Action unavailable.`}}var ja=(0,U.createContext)(void 0),{darkAlgorithm:Ma,defaultAlgorithm:Na}=ce,Pa=(0,U.createContext)(void 0),Fa=`agor:themeMode`,Ia=`agor:customTheme`,La=({children:e})=>{let[t,n]=(0,U.useState)(()=>localStorage.getItem(Fa)||`dark`),[r,i]=(0,U.useState)(()=>{let e=localStorage.getItem(Ia);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to parse custom theme from localStorage:`,e),null}return null}),a=e=>{n(e),localStorage.setItem(Fa,e)},o=e=>{if(e){let{algorithm:t,...n}=e;i(n),localStorage.setItem(Ia,JSON.stringify(n))}else i(null),localStorage.removeItem(Ia)},s=(0,U.useMemo)(()=>{let e={token:{colorPrimary:`#2e9a92`,colorSuccess:`#52c41a`,colorWarning:`#faad14`,colorError:`#ff4d4f`,colorInfo:`#2e9a92`,colorLink:`#2e9a92`,borderRadius:8,fontFamily:`'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif`}};return t===`custom`&&r?{...e,...r,token:{...e.token,...r.token},algorithm:Ma}:{...e,algorithm:t===`dark`?Ma:Na}},[t,r]),c=(0,U.useCallback)(()=>s,[s]),l=t!==`light`;return(0,U.useEffect)(()=>{c(),document.body.style.backgroundColor=l?`#141414`:`#f0f2f5`,l?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`)},[l,c]),(0,W.jsx)(Pa.Provider,{value:{themeMode:t,setThemeMode:a,customTheme:r,setCustomTheme:o,getCurrentThemeConfig:c,isDark:l},children:e})},Ra=()=>{let e=(0,U.useContext)(Pa);if(!e)throw Error(`useTheme must be used within a ThemeProvider`);return e};function za(){if(typeof window<`u`){let e=window.AGOR_DAEMON_URL;if(e)return e}let e=3031;if(typeof window<`u`){if(window.location.pathname.startsWith(`/ui`))return window.location.origin;let t=window.location.origin,n=new URL(t);return`${n.protocol}//${n.hostname}:${e}`}return`http://${bn.DEFAULT_HOST}:${e}`}za();function Ba(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.code==`number`)return t.code;if(typeof t.statusCode==`number`)return t.statusCode;if(typeof t.status==`number`)return t.status}function Va(e){let t=Ba(e);if(t===401||t===403)return!0;if(!e||typeof e!=`object`)return!1;let n=e;return n.name===`NotAuthenticated`||n.className===`not-authenticated`}function Ha(e){if(Va(e))return!1;let t=Ba(e);if(t===0||t===408||t===429||t!==void 0&&t>=500)return!0;if(!e||typeof e!=`object`)return!1;let n=e,r=typeof n.message==`string`?n.message.toLowerCase():``,i=e instanceof Error?e.constructor.name:``;return i===`TypeError`&&r.includes(`fetch`)?!0:r.includes(`connection`)||r.includes(`timeout`)||r.includes(`websocket`)||r.includes(`transport`)||r.includes(`failed to fetch`)||r.includes(`networkerror`)||r.includes(`network error`)||r.includes(`load failed`)||i===`TransportError`||i===`WebSocketError`}var Ua=`agor-access-token`,Wa=`agor-refresh-token`;async function Ga(e,t){return await e.service(`authentication/refresh`).create({refreshToken:t})}function Ka(e,t){localStorage.setItem(Ua,e),t&&localStorage.setItem(Wa,t)}function qa(){return localStorage.getItem(Wa)}function Ja(){return localStorage.getItem(Ua)}function Ya(){localStorage.removeItem(Ua),localStorage.removeItem(Wa)}async function Xa(e,t){let n=await Ga(e,t);return Ka(n.accessToken,n.refreshToken),n}var Za=`agor:tokens-refreshed`,Qa=`agor:tokens-refresh-unrecoverable`,$a=null,eo=!1,to=class extends Error{constructor(e=`Refresh token is invalid or expired`,t){super(e,t),this.name=`RefreshUnrecoverableError`}};function no(){eo=!1}function ro(e,t){return eo?Promise.reject(new to):$a||($a=Xa(e,t).then(e=>(eo=!1,typeof window<`u`&&window.dispatchEvent(new CustomEvent(Za,{detail:e})),e)).catch(e=>{throw Va(e)?(eo=!0,typeof window<`u`&&window.dispatchEvent(new CustomEvent(Qa)),new to(void 0,{cause:e})):e}).finally(()=>{$a=null}),$a)}async function io(e){let t=qa();if(!t)return null;let n=await ro(e,t);return await e.authenticate({strategy:`jwt`,accessToken:n.accessToken}),n}function ao(e={}){let{url:t=za(),accessToken:n}=e,[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!!n),[s,c]=(0,U.useState)(null),l=(0,U.useRef)(null),u=(0,U.useRef)(n);u.current=n;let d=!!n;return(0,U.useEffect)(()=>{let e=!0,n=null,r=!1,a=0,s=null,f=()=>{s!==null&&(clearTimeout(s),s=null)},p=null,m=()=>{p!==null&&(clearTimeout(p),p=null)},h=()=>{p===null&&(p=setTimeout(()=>{p=null,e&&i(!1)},1500))};async function g(){if(!d){o(!1),i(!1),c(null),l.current=null;return}i(!1),o(!0),c(null),n=on(t,!1),l.current=n;let p=new Set([`authentication`,`authentication/refresh`]);n.hooks({around:{all:[async(e,t)=>{let r=e.path;if(typeof r==`string`&&p.has(r)){await t();return}try{await t()}catch(t){if(!Va(t)||(e.params??{})._refreshRetried||!n)throw t;try{if(!await io(n))throw t}catch{throw t}let i=e.arguments?[...e.arguments]:[],a=i.length-1,o=i[a],s=typeof o==`object`&&!!o&&!Array.isArray(o),c={...s?o:{},_refreshRetried:!0};s?i[a]=c:i.push(c);let l=n.service(r),u=l[e.method];if(typeof u!=`function`)throw t;e.result=await u.call(l,...i)}}]}}),typeof window<`u`&&(window.__agorClient=n),n.io.on(`connect`,async()=>{if(e){let e=r;if(r=!0,a=0,f(),m(),!e)return;let t=u.current;try{if(t)try{await n.authenticate({strategy:`jwt`,accessToken:t}),i(!0),o(!1),c(null);return}catch{try{if(await io(n)){i(!0),o(!1),c(null);return}}catch(e){if(console.error(`❌ Refresh failed on reconnect:`,e),e instanceof to||Va(e)){o(!1),i(!1),c(`Session expired. Please log in again.`);return}i(!1),o(!0);return}}console.error(`❌ Re-authentication failed after reconnect - all tokens expired`),o(!1),i(!1),c(`Session expired. Please log in again.`)}catch(e){console.error(`❌ Re-authentication failed after reconnect:`,e),o(!1),i(!1)}}}),n.io.on(`disconnect`,t=>{if(e)if(r?h():i(!1),t===`io server disconnect`){if(a>=10){o(!1),m(),i(!1),c(`Lost connection to daemon after multiple attempts. Please reload the page.`);return}o(!0);let t=a++,r=Math.min(500*2**t,3e4);f(),s=setTimeout(()=>{s=null,e&&n?.io.connect()},r)}else (t===`transport close`||t===`transport error`||t===`ping timeout`)&&o(!0)}),n.io.on(`connect_error`,t=>{e&&(r?(o(!0),i(!1)):(c(`Daemon is not running. Start it with: cd apps/agor-daemon && pnpm dev`),o(!1),i(!1)))}),n.io.connect();try{await new Promise((e,t)=>{let r=setTimeout(()=>{t(Error(`Connection timeout`))},5e3);if(n.io.connected){clearTimeout(r),e();return}n.io.once(`connect`,()=>{clearTimeout(r),e()}),n.io.once(`connect_error`,e=>{clearTimeout(r),t(e)})})}catch{e&&(c(`Failed to connect to daemon. Make sure it is running on :3030`),o(!1),i(!1));return}let g=u.current;try{g&&await n.authenticate({strategy:`jwt`,accessToken:g})}catch{e&&(c(`Authentication failed. Please log in again.`),o(!1),i(!1));return}e&&(i(!0),o(!1),c(null))}g();let _=t=>{if(!e)return;let r=t.detail;!r||!n||n.io.connected&&n.authenticate({strategy:`jwt`,accessToken:r.accessToken}).then(()=>{e&&(i(!0),o(!1),c(null))}).catch(e=>{console.error(`In-place re-authentication failed after token refresh:`,e)})};return window.addEventListener(Za,_),()=>{e=!1,f(),m(),window.removeEventListener(Za,_),n?.io&&(n.io.removeAllListeners(),n.io.close()),typeof window<`u`&&window.__agorClient===n&&delete window.__agorClient}},[t,d]),{client:l.current,connected:r,connecting:a,error:s,retryConnection:()=>{let e=l.current;e?.io&&(e.io.connected&&e.io.disconnect(),o(!0),c(null),e.io.connect())}}}var oo=`agor.debug.initialLoad`;function so(){return typeof window>`u`?null:window}function co(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function lo(e){return Math.round(e*10)/10}function uo(e){return e instanceof Error?e.message:String(e)}function fo(e=so()){if(!e)return!1;let t=null;try{t=new URLSearchParams(e.location.search).get(`debugLoad`)}catch{t=null}try{return t===`1`?e.localStorage.setItem(oo,`1`):t===`0`&&e.localStorage.removeItem(oo),e.localStorage.getItem(oo)===`1`}catch{return t===`1`}}function po(){return fo()}function mo(e){let t=co(),n=new Date().toISOString(),r=new Map(e.map(e=>[e.key,e.label])),i=[],a=[],o=null,s=null,c=null,l=null;return{markStage:e=>{a.push({stage:e,atMs:lo(co()-t)})},startFetchPhase(){o=co()},endFetchPhase(){s=co()},startIndexing(){c=co()},endIndexing(){l=co()},track(e,t){let n=co();return t.then(t=>(i.push({key:e,label:r.get(e)??e,durationMs:lo(co()-n),count:t.length,status:`success`}),t),t=>{throw i.push({key:e,label:r.get(e)??e,durationMs:lo(co()-n),count:null,status:`error`,error:uo(t)}),t})},finish(e,r){let u={label:`Agor initial load`,startedAt:n,totalMs:lo(co()-t),fetchPhaseMs:o===null?null:lo((s??co())-o),indexingMs:c===null?null:lo((l??co())-c),status:e,error:r===void 0?void 0:uo(r),fetches:[...i].sort((e,t)=>e.key.localeCompare(t.key)),stageTransitions:[...a]},d=so();return d&&(d.__AGOR_INITIAL_LOAD_TIMINGS__=u),typeof console<`u`&&((console.groupCollapsed??console.group)?.call(console,`[Agor initial load]`,{status:u.status,totalMs:u.totalMs,fetchPhaseMs:u.fetchPhaseMs,indexingMs:u.indexingMs}),console.table?.(u.fetches),u.stageTransitions.length>0&&console.log(`stageTransitions`,u.stageTransitions),u.error&&console.warn(`[Agor initial load] failed`,u.error),console.log(`Copy from window.__AGOR_INITIAL_LOAD_TIMINGS__`,u),console.groupEnd?.()),u}}}function ho(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var go=[{key:`sessions`,label:`Sessions`},{key:`boards`,label:`Boards`},{key:`board-objects`,label:`Board objects`},{key:`board-comments`,label:`Board comments`},{key:`branches`,label:`Branches`},{key:`repos`,label:`Repos`},{key:`users`,label:`Users`},{key:`cards`,label:`Cards`},{key:`card-types`,label:`Card types`},{key:`mcp-servers`,label:`MCP servers`},{key:`session-mcp-servers`,label:`Session MCP links`},{key:`gateway-channels`,label:`Gateway channels`},{key:`artifacts`,label:`Artifacts`}],_o={sessionById:new Map,sessionsByBranch:new Map,boardById:new Map,boardObjectById:new Map,boardObjectsByBoardId:new Map,boardObjectByBranchId:new Map,boardObjectByCardId:new Map,commentById:new Map,cardById:new Map,cardTypeById:new Map,repoById:new Map,branchById:new Map,userById:new Map,mcpServerById:new Map,gatewayChannelById:new Map,artifactById:new Map,sessionMcpServerIds:new Map,userAuthenticatedMcpServerIds:new Set};function vo(e,t,n){let r=e.get(t);if(r&&ho(r,n))return e;let i=new Map(e);return i.set(t,n),i}function yo(e,t){let n=e.get(t.board_id);if(!n?.some(e=>e.object_id===t.object_id))return e;let r=new Map(e),i=n.filter(e=>e.object_id!==t.object_id);return i.length>0?r.set(t.board_id,i):r.delete(t.board_id),r}function bo(e,t,n){let r=e.boardObjectById.get(t.object_id);if(n===`create`&&r||n===`patch`&&r&&ho(r,t))return e;let i=new Map(e.boardObjectById);i.set(t.object_id,t);let a=e.boardObjectsByBoardId;r&&r.board_id!==t.board_id&&(a=yo(a,r));let o=a.get(t.board_id)??[],s=o.findIndex(e=>e.object_id===t.object_id);if(s===-1||o[s]!==t||!ho(o[s],t)){let e=new Map(a);if(s===-1)e.set(t.board_id,[...o,t]);else{let n=[...o];n[s]=t,e.set(t.board_id,n)}a=e}let c=e.boardObjectByBranchId;if(r?.branch_id&&r.branch_id!==t.branch_id&&(c=new Map(c),c.delete(r.branch_id)),t.branch_id){let n=c.get(t.branch_id);(!n||!ho(n,t))&&(c=c===e.boardObjectByBranchId?new Map(c):c,c.set(t.branch_id,t))}let l=e.boardObjectByCardId;if(r?.card_id&&r.card_id!==t.card_id&&(l=new Map(l),l.delete(r.card_id)),t.card_id){let n=l.get(t.card_id);(!n||!ho(n,t))&&(l=l===e.boardObjectByCardId?new Map(l):l,l.set(t.card_id,t))}return{...e,boardObjectById:i,boardObjectsByBoardId:a,boardObjectByBranchId:c,boardObjectByCardId:l}}function xo(e,t){let n=e.boardObjectById.get(t.object_id);if(!n)return e;let r=new Map(e.boardObjectById);r.delete(n.object_id);let i=e.boardObjectByBranchId;n.branch_id&&i.get(n.branch_id)?.object_id===n.object_id&&(i=new Map(i),i.delete(n.branch_id));let a=e.boardObjectByCardId;return n.card_id&&a.get(n.card_id)?.object_id===n.object_id&&(a=new Map(a),a.delete(n.card_id)),{...e,boardObjectById:r,boardObjectsByBoardId:yo(e.boardObjectsByBoardId,n),boardObjectByBranchId:i,boardObjectByCardId:a}}function So(e,t){let n=t?.enabled??!0,[r,i]=(0,U.useState)(_o),a=e=>t=>i(n=>{let r=typeof t==`function`?t(n[e]):t;return Object.is(r,n[e])?n:{...n,[e]:r}}),o=a(`sessionById`),s=a(`sessionsByBranch`),c=a(`boardById`),l=a(`commentById`),u=a(`cardById`),d=a(`cardTypeById`),f=a(`repoById`),p=a(`branchById`),m=a(`userById`),h=a(`mcpServerById`),g=a(`gatewayChannelById`),_=a(`artifactById`),v=a(`sessionMcpServerIds`),y=a(`userAuthenticatedMcpServerIds`),[b,x]=(0,U.useState)(!0),[S,C]=(0,U.useState)(`idle`),[w,T]=(0,U.useState)(null),[E,D]=(0,U.useState)({}),[O,k]=(0,U.useState)(!1),A=(0,U.useRef)(!1),ee=(0,U.useRef)(!1),j=(0,U.useCallback)(async({silent:t=!1}={})=>{if(!e||!n)return;let r=!t&&po()?mo(go):null,a=null,o;try{t||(x(!0),C(`fetching`),r?.markStage(`fetching`),T(null),D({}));let n=(e,n)=>(r?.track(e,n)??n).then(n=>(t||D(t=>({...t,[e]:n.length})),n));r?.startFetchPhase();let[o,s,c,l,u,d,f,p,m,h,g,_,v,y]=await Promise.all([n(`sessions`,e.service(`sessions`).findAll({query:{archived:!1,$limit:Rt.DEFAULT_LIMIT,$sort:{updated_at:-1}}})),n(`boards`,e.service(`boards`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`board-objects`,e.service(`board-objects`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`board-comments`,e.service(`board-comments`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`cards`,e.service(`cards`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`card-types`,e.service(`card-types`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`repos`,e.service(`repos`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`branches`,e.service(`branches`).findAll({query:{archived:!1,$limit:Rt.DEFAULT_LIMIT}})),n(`users`,e.service(`users`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`mcp-servers`,e.service(`mcp-servers`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`session-mcp-servers`,e.service(`session-mcp-servers`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`gateway-channels`,e.service(`gateway-channels`).findAll({query:{$limit:Rt.DEFAULT_LIMIT}})),n(`artifacts`,e.service(`artifacts`).findAll({query:{$limit:Rt.DEFAULT_LIMIT,$select:[`artifact_id`,`branch_id`,`board_id`,`name`,`description`,`path`,`template`,`build_status`,`build_errors`,`content_hash`,`public`,`created_by`,`created_at`,`updated_at`,`archived`,`archived_at`,`fullscreen_url`,`url`]}})),e.service(`mcp-servers/oauth-status`).find().catch(()=>({authenticated_server_ids:[]}))]);r?.endFetchPhase(),t||(C(`indexing`),r?.markStage(`indexing`),r?.startIndexing(),await new Promise(e=>{if(typeof window>`u`||typeof window.requestAnimationFrame!=`function`){e();return}window.requestAnimationFrame(()=>e())}));let b=new Map,S=new Map;for(let e of o){b.set(e.session_id,e);let t=e.branch_id;S.has(t)||S.set(t,[]),S.get(t).push(e)}let w=new Map;for(let e of s)w.set(e.board_id,e);let E=new Map,O=new Map,k=new Map,A=new Map;for(let e of c){E.set(e.object_id,e);let t=O.get(e.board_id);t?t.push(e):O.set(e.board_id,[e]),e.branch_id&&k.set(e.branch_id,e),e.card_id&&A.set(e.card_id,e)}let j=new Map;for(let e of l)j.set(e.comment_id,e);let M=new Map;for(let e of u)M.set(e.card_id,e);let N=new Map;for(let e of d)N.set(e.card_type_id,e);let te=new Map;for(let e of f)te.set(e.repo_id,e);let P=new Map;for(let e of p)P.set(e.branch_id,e);let ne=new Map;for(let e of m)ne.set(e.user_id,e);let re=new Map;for(let e of h)re.set(e.mcp_server_id,e);let ie=new Map;for(let e of _)ie.set(e.id,e);let ae=new Map;for(let e of v)ae.set(e.artifact_id,e);let oe=new Map;for(let e of g)oe.has(e.session_id)||oe.set(e.session_id,[]),oe.get(e.session_id).push(e.mcp_server_id);i({sessionById:b,sessionsByBranch:S,boardById:w,boardObjectById:E,boardObjectsByBoardId:O,boardObjectByBranchId:k,boardObjectByCardId:A,commentById:j,cardById:M,cardTypeById:N,repoById:te,branchById:P,userById:ne,mcpServerById:re,gatewayChannelById:ie,artifactById:ae,sessionMcpServerIds:oe,userAuthenticatedMcpServerIds:new Set(y?.authenticated_server_ids??[])}),r?.endIndexing(),a=`success`,t&&(ee.current=!1)}catch(e){t?(console.warn(`[useAgorData] silent refetch failed:`,e),ee.current=!0):(a=`error`,o=e,T(e instanceof Error?e.message:`Failed to fetch data`))}finally{t||(x(!1),C(`idle`),r?.markStage(`idle`),a&&r?.finish(a,o))}},[e,n]);(0,U.useEffect)(()=>{e||(i(_o),k(!1))},[e]),(0,U.useEffect)(()=>{if(!e||!n){x(!1),C(`idle`);return}O||j().then(()=>k(!0));let t=e.service(`sessions`),r=e=>{e.archived||(o(t=>{if(t.has(e.session_id))return t;let n=new Map(t);return n.set(e.session_id,e),n}),s(t=>{let n=t.get(e.branch_id)||[];if(n.some(t=>t.session_id===e.session_id))return t;let r=new Map(t);return r.set(e.branch_id,[...n,e]),r}))},a=e=>{let t=e.archived===!0,n=null;o(r=>{let i=r.get(e.session_id);if(n=i?.branch_id||null,t){if(!i)return r;let t=new Map(r);return t.delete(e.session_id),t}if(i&&ho(i,e))return r;let a=new Map(r);return a.set(e.session_id,e),a}),s(r=>{let i=!1,a=new Map(r),o=e.branch_id,s=t=>{let n=a.get(t)||[],r=n.filter(t=>t.session_id!==e.session_id);r.length!==n.length&&(i=!0,r.length>0?a.set(t,r):a.delete(t))};if(t)return n&&s(n),s(o),i?a:r;n&&n!==o&&s(n);let c=a.get(o)||[],l=c.findIndex(t=>t.session_id===e.session_id);if(l===-1)return a.set(o,[...c,e]),a;if(c[l]===e||ho(c[l],e))return i?a:r;let u=[...c];return u[l]=e,a.set(o,u),a})},b=e=>{o(t=>{if(!t.has(e.session_id))return t;let n=new Map(t);return n.delete(e.session_id),n}),s(t=>{let n=t.get(e.branch_id);if(!n?.some(t=>t.session_id===e.session_id))return t;let r=new Map(t),i=n.filter(t=>t.session_id!==e.session_id);return i.length>0?r.set(e.branch_id,i):r.delete(e.branch_id),r})};t.on(`created`,r),t.on(`patched`,a),t.on(`updated`,a),t.on(`removed`,b);let S=e.service(`boards`),w=e=>{c(t=>{if(t.has(e.board_id))return t;let n=new Map(t);return n.set(e.board_id,e),n})},T=e=>{c(t=>vo(t,e.board_id,e))},E=e=>{c(t=>{if(!t.has(e.board_id))return t;let n=new Map(t);return n.delete(e.board_id),n})};S.on(`created`,w),S.on(`patched`,T),S.on(`updated`,T),S.on(`removed`,E);let D=e.service(`board-objects`),M=e=>{i(t=>bo(t,e,`create`))},N=e=>{i(t=>bo(t,e,`patch`))},te=e=>{i(t=>xo(t,e))};D.on(`created`,M),D.on(`patched`,N),D.on(`updated`,N),D.on(`removed`,te);let P=e.service(`repos`),ne=e=>{f(t=>{if(t.has(e.repo_id))return t;let n=new Map(t);return n.set(e.repo_id,e),n})},re=e=>{f(t=>vo(t,e.repo_id,e))},ie=e=>{f(t=>{if(!t.has(e.repo_id))return t;let n=new Map(t);return n.delete(e.repo_id),n})};P.on(`created`,ne),P.on(`patched`,re),P.on(`updated`,re),P.on(`removed`,ie);let ae=e.service(`branches`),oe=e=>{e.archived||p(t=>{if(t.has(e.branch_id))return t;let n=new Map(t);return n.set(e.branch_id,e),n})},F=e=>{p(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n}),s(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n}),o(t=>{let n=!1,r=new Map(t);for(let[i,a]of t.entries())a.branch_id===e&&(r.delete(i),n=!0);return n?r:t})},se=e=>{if(e.archived){F(e.branch_id);return}p(t=>vo(t,e.branch_id,e))},ce=e=>{F(e.branch_id)};ae.on(`created`,oe),ae.on(`patched`,se),ae.on(`updated`,se),ae.on(`removed`,ce);let le=e.service(`users`),ue=e=>{m(t=>{if(t.has(e.user_id))return t;let n=new Map(t);return n.set(e.user_id,e),n})},de=e=>{m(t=>vo(t,e.user_id,e))},fe=e=>{m(t=>{if(!t.has(e.user_id))return t;let n=new Map(t);return n.delete(e.user_id),n})};le.on(`created`,ue),le.on(`patched`,de),le.on(`updated`,de),le.on(`removed`,fe);let pe=e.service(`mcp-servers`),me=e=>{h(t=>{if(t.has(e.mcp_server_id))return t;let n=new Map(t);return n.set(e.mcp_server_id,e),n})},he=e=>{h(t=>vo(t,e.mcp_server_id,e))},ge=e=>{h(t=>{if(!t.has(e.mcp_server_id))return t;let n=new Map(t);return n.delete(e.mcp_server_id),n})};pe.on(`created`,me),pe.on(`patched`,he),pe.on(`updated`,he),pe.on(`removed`,ge);let _e=e.service(`gateway-channels`),ve=e=>{g(t=>{if(t.has(e.id))return t;let n=new Map(t);return n.set(e.id,e),n})},ye=e=>{g(t=>vo(t,e.id,e))},be=e=>{g(t=>{if(!t.has(e.id))return t;let n=new Map(t);return n.delete(e.id),n})};_e.on(`created`,ve),_e.on(`patched`,ye),_e.on(`updated`,ye),_e.on(`removed`,be);let I=e.service(`cards`),xe=e=>{u(t=>{if(t.has(e.card_id))return t;let n=new Map(t);return n.set(e.card_id,e),n})},Se=e=>{u(t=>vo(t,e.card_id,e))},Ce=e=>{u(t=>{if(!t.has(e.card_id))return t;let n=new Map(t);return n.delete(e.card_id),n})};I.on(`created`,xe),I.on(`patched`,Se),I.on(`updated`,Se),I.on(`removed`,Ce);let we=e.service(`card-types`),Te=e=>{d(t=>{if(t.has(e.card_type_id))return t;let n=new Map(t);return n.set(e.card_type_id,e),n})},Ee=e=>{d(t=>vo(t,e.card_type_id,e))},De=e=>{d(t=>{if(!t.has(e.card_type_id))return t;let n=new Map(t);return n.delete(e.card_type_id),n})};we.on(`created`,Te),we.on(`patched`,Ee),we.on(`updated`,Ee),we.on(`removed`,De);let L=e.service(`artifacts`),Oe=e=>{_(t=>{if(t.has(e.artifact_id))return t;let n=new Map(t);return n.set(e.artifact_id,e),n})},ke=e=>{_(t=>vo(t,e.artifact_id,e)),window.dispatchEvent(new CustomEvent(`agor:artifact-patched`,{detail:{artifactId:e.artifact_id,contentHash:e.content_hash}}))},Ae=e=>{_(t=>{if(!t.has(e.artifact_id))return t;let n=new Map(t);return n.delete(e.artifact_id),n})};L.on(`created`,Oe),L.on(`patched`,ke),L.on(`updated`,ke),L.on(`removed`,Ae);let je=e=>{window.dispatchEvent(new CustomEvent(`agor:artifact-runtime-query`,{detail:e}))};L.on(`agor-query`,je);let Me=e.service(`session-mcp-servers`),R=e=>{v(t=>{let n=t.get(e.session_id)||[];if(n.includes(e.mcp_server_id))return t;let r=new Map(t);return r.set(e.session_id,[...n,e.mcp_server_id]),r})},Ne=e=>{v(t=>{let n=t.get(e.session_id)||[],r=n.filter(t=>t!==e.mcp_server_id);if(r.length===n.length)return t;let i=new Map(t);return r.length>0?i.set(e.session_id,r):i.delete(e.session_id),i})};Me.on(`created`,R),Me.on(`removed`,Ne);let Pe=e.service(`board-comments`),Fe=e=>{l(t=>{if(t.has(e.comment_id))return t;let n=new Map(t);return n.set(e.comment_id,e),n})},Ie=e=>{l(t=>vo(t,e.comment_id,e))},Le=e=>{l(t=>{if(!t.has(e.comment_id))return t;let n=new Map(t);return n.delete(e.comment_id),n})};Pe.on(`created`,Fe),Pe.on(`patched`,Ie),Pe.on(`updated`,Ie),Pe.on(`removed`,Le);let Re=async t=>{if(!(!t.success||!t.mcp_server_id)){(t.oauth_mode||`per_user`)===`per_user`&&y(e=>{if(e.has(t.mcp_server_id))return e;let n=new Set(e);return n.add(t.mcp_server_id),n});try{let n=await e.service(`mcp-servers`).get(t.mcp_server_id);h(e=>vo(e,n.mcp_server_id,n))}catch(e){console.warn(`[OAuth] Failed to refetch MCP server after re-auth:`,e)}}};e.io.on(`oauth:completed`,Re);let ze=async t=>{if(t.mcp_server_id){y(e=>{if(!e.has(t.mcp_server_id))return e;let n=new Set(e);return n.delete(t.mcp_server_id),n}),h(e=>{let n=e.get(t.mcp_server_id);if(!n?.auth?.oauth_access_token)return e;let r=new Map(e);return r.set(t.mcp_server_id,{...n,auth:{...n.auth,oauth_access_token:void 0,oauth_token_expires_at:void 0}}),r});try{let n=await e.service(`mcp-servers`).get(t.mcp_server_id);h(e=>vo(e,n.mcp_server_id,n))}catch(e){console.warn(`[OAuth] Failed to refetch MCP server after disconnect:`,e)}}};e.io.on(`oauth:disconnected`,ze);let Be=async()=>{if(O&&!A.current){A.current=!0;try{await j({silent:!0})}finally{A.current=!1}}};e.io.on(`connect`,Be);let Ve=()=>{ee.current&&Be()};return window.addEventListener(Za,Ve),()=>{e.io.off(`oauth:completed`,Re),e.io.off(`oauth:disconnected`,ze),e.io.off(`connect`,Be),window.removeEventListener(Za,Ve),t.removeListener(`created`,r),t.removeListener(`patched`,a),t.removeListener(`updated`,a),t.removeListener(`removed`,b),S.removeListener(`created`,w),S.removeListener(`patched`,T),S.removeListener(`updated`,T),S.removeListener(`removed`,E),D.removeListener(`created`,M),D.removeListener(`patched`,N),D.removeListener(`updated`,N),D.removeListener(`removed`,te),P.removeListener(`created`,ne),P.removeListener(`patched`,re),P.removeListener(`updated`,re),P.removeListener(`removed`,ie),ae.removeListener(`created`,oe),ae.removeListener(`patched`,se),ae.removeListener(`updated`,se),ae.removeListener(`removed`,ce),le.removeListener(`created`,ue),le.removeListener(`patched`,de),le.removeListener(`updated`,de),le.removeListener(`removed`,fe),pe.removeListener(`created`,me),pe.removeListener(`patched`,he),pe.removeListener(`updated`,he),pe.removeListener(`removed`,ge),Me.removeListener(`created`,R),Me.removeListener(`removed`,Ne),Pe.removeListener(`created`,Fe),Pe.removeListener(`patched`,Ie),Pe.removeListener(`updated`,Ie),Pe.removeListener(`removed`,Le),_e.removeListener(`created`,ve),_e.removeListener(`patched`,ye),_e.removeListener(`updated`,ye),_e.removeListener(`removed`,be),I.removeListener(`created`,xe),I.removeListener(`patched`,Se),I.removeListener(`updated`,Se),I.removeListener(`removed`,Ce),we.removeListener(`created`,Te),we.removeListener(`patched`,Ee),we.removeListener(`updated`,Ee),we.removeListener(`removed`,De),L.removeListener(`created`,Oe),L.removeListener(`patched`,ke),L.removeListener(`updated`,ke),L.removeListener(`removed`,Ae),L.removeListener(`agor-query`,je)}},[e,n,j,O]);let M=(0,U.useMemo)(()=>go.map(({key:e,label:t})=>{let n=E[e];return{key:e,label:t,done:n!==void 0,count:n??0}}),[E]),N=go.every(({key:e})=>E[e]!==void 0);return{...r,initialLoadItems:M,initialLoadComplete:N,loadingStage:S,loading:b,error:w,refetch:j}}function Co(e){let t=e.split(`.`);if(t.length!==3)return null;let n=t[1];if(!n)return null;try{let e=Do(n),t=JSON.parse(e);if(t&&typeof t==`object`&&`exp`in t){let e=t.exp;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}return null}catch{return null}}function wo(e){let t=Co(e);return t===null?null:t*1e3}function To(e,t=Date.now()){let n=wo(e);return n===null?null:n-t}function Eo(e,t){let n=To(e);return n===null?!0:n<=t}function Do(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t+`=`.repeat((4-t.length%4)%4);if(typeof Buffer<`u`)return Buffer.from(n,`base64`).toString(`utf8`);let r=globalThis.atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return new TextDecoder().decode(i)}var Oo=`launch_code`;function ko(e){let t=new URLSearchParams(e).get(Oo);return t?.trim()?t:null}function Ao(){if(typeof window>`u`)return;let e=new URL(window.location.href);e.searchParams.has(`launch_code`)&&(e.searchParams.delete(Oo),window.history.replaceState(window.history.state,document.title,`${e.pathname}${e.search}${e.hash}`))}async function jo(e,t){let n=await e.service(`auth/launch`).create({launchCode:t});return Ka(n.accessToken,n.refreshToken),n}function Mo(){let[e,t]=(0,U.useState)({user:null,accessToken:null,authenticated:!1,loading:!0,error:null}),n=(0,U.useCallback)(async(e=0,r)=>{t(e=>({...e,loading:!0,error:null}));let i=Ja(),a=qa(),o=!!i||!!a,s=r||(typeof window<`u`?ko(window.location.search):null),c=!1,l=!1;async function u(e){if(!i&&!a)return!1;if(i)try{let n=await e.authenticate({strategy:`jwt`,accessToken:i});return t({user:n.user,accessToken:n.accessToken,authenticated:!0,loading:!1,error:null}),!0}catch{}if(a)try{let n=await ro(e,a);return t({user:n.user,accessToken:n.accessToken,authenticated:!0,loading:!1,error:null}),!0}catch{}return!1}try{let r=await $t(za());if(s){c=!0,Ao();try{let e=await jo(r,s);no(),t({user:e.user,accessToken:e.accessToken,authenticated:!0,loading:!1,error:null});return}catch(t){if(Ha(t)&&e<5){let t=Math.min(2e3*1.5**e,1e4);return await new Promise(e=>setTimeout(e,t)),n(e+1,s)}if(l=!0,!o)throw t;console.warn(`Launch sign-in failed; falling back to stored auth tokens:`,t)}}if(!o){t({user:null,accessToken:null,authenticated:!1,loading:!1,error:l?`Launch sign-in failed. The one-time launch code may have expired or already been used.`:null});return}if(await u(r))return;Ya(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:l?`Launch sign-in failed. The one-time launch code may have expired or already been used.`:null})}catch(r){let i=Ha(r);if(i&&e<5){let t=Math.min(2e3*1.5**e,1e4);return await new Promise(e=>setTimeout(e,t)),n(e+1,c&&s||void 0)}if(!i&&!(c&&o)&&(console.error(`Authentication failure, clearing tokens:`,r),Ya()),c&&o&&await u(await $t(za())))return;t({user:null,accessToken:null,authenticated:!1,loading:!1,error:i?`Connection lost - waiting for daemon...`:c?`Launch sign-in failed. The one-time launch code may have expired or already been used.`:null})}},[]);(0,U.useEffect)(()=>{n()},[n]),(0,U.useEffect)(()=>{let t=async()=>{if(document.visibilityState!==`visible`)return;if(!e.authenticated){(Ja()||qa())&&n();return}let t=Ja();if(!t||!Eo(t,6e4))return;let r=qa();if(r)try{await ro(await $t(za()),r)}catch(e){if(e instanceof to)return;Ha(e)||n()}};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e.authenticated,n]),(0,U.useEffect)(()=>{if(e.authenticated||e.loading||!(Ja()||qa()))return;let t=setInterval(()=>{n()},3e3);return()=>clearInterval(t)},[e.authenticated,e.loading,n]),(0,U.useEffect)(()=>{if(!e.authenticated||!e.accessToken)return;let n=To(e.accessToken),r=n===null?3e5:Math.max(1e3,n-6e4),i=setTimeout(async()=>{let e=qa();if(e)try{await ro(await $t(za()),e)}catch(e){if(e instanceof to)return;console.error(`Failed to auto-refresh token:`,e),Ha(e)?t(e=>({...e,error:`Connection lost - waiting for daemon...`})):(Ya(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:`Session expired, please login again`}))}},r);return()=>clearTimeout(i)},[e.authenticated,e.accessToken]),(0,U.useEffect)(()=>{let e=e=>{let n=e.detail;n&&t(e=>({...e,accessToken:n.accessToken,user:n.user,authenticated:!0}))};return window.addEventListener(Za,e),()=>window.removeEventListener(Za,e)},[]),(0,U.useEffect)(()=>{let e=()=>{Ya(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:`Session expired, please login again`})};return window.addEventListener(Qa,e),()=>window.removeEventListener(Qa,e)},[]);let r=async(e,n)=>{t(e=>({...e,loading:!0,error:null}));try{let r=await(await $t(za())).authenticate({strategy:`local`,email:e,password:n});return Ka(r.accessToken,r.refreshToken),no(),t({user:r.user,accessToken:r.accessToken,authenticated:!0,loading:!1,error:null}),!0}catch(e){console.error(`❌ Login failed:`,e);let n=e instanceof Error?e.message:`Login failed`;return console.error(`❌ Error message:`,n),t(e=>({...e,loading:!1,error:n})),!1}},i=async()=>{Ya(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:null})};return{...e,login:r,logout:i,reAuthenticate:n}}function No(){let[e,t]=(0,U.useState)(null),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(void 0),[c,l]=(0,U.useState)(void 0),[u,d]=(0,U.useState)(!0),[f,p]=(0,U.useState)(null);return(0,U.useEffect)(()=>{async function e(){try{let e=await fetch(`${za()}/health`);if(!e.ok)throw Error(`Failed to fetch auth config: ${e.statusText}`);let n=await e.json();t(n.auth),r(n.instance??null),a(n.onboarding??null),s(n.services),l(n.features),p(null)}catch(e){p(e instanceof Error?e:Error(String(e))),t({requireAuth:!0}),r(null),a(null),s(void 0),l(void 0)}finally{d(!1)}}e()},[]),{config:e,instanceConfig:n,onboardingConfig:i,servicesConfig:o,featuresConfig:c,loading:u,error:f}}function Po(e){let[t,n]=(0,U.useState)(!1),{showError:r}=mn();return{createBoard:async t=>{if(!e)return null;try{return n(!0),await e.service(`boards`).create(t)}catch(e){return r(`Failed to create board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},updateBoard:async(t,i)=>{if(!e)return null;try{return n(!0),await e.service(`boards`).patch(t,i)}catch(e){return r(`Failed to update board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},deleteBoard:async t=>{if(!e)return!1;try{return n(!0),await e.service(`boards`).remove(t),!0}catch(e){return r(`Failed to delete board: ${e instanceof Error?e.message:String(e)}`),!1}finally{n(!1)}},archiveBoard:async t=>{if(!e)return null;try{return n(!0),await e.service(`boards/${t}/archive`).create({})}catch(e){return r(`Failed to archive board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},unarchiveBoard:async t=>{if(!e)return null;try{return n(!0),await e.service(`boards/${t}/unarchive`).create({})}catch(e){return r(`Failed to unarchive board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},loading:t}}function Fo(){let{modal:e}=M.useApp();return{confirm:t=>e.confirm(t),info:t=>e.info(t),warning:t=>e.warning(t),error:t=>e.error(t),success:t=>e.success(t)}}function Io(){let{confirm:e}=Fo(),{token:t}=ce.useToken();return n=>e({title:`Nuke environment?`,icon:(0,W.jsx)(Qe,{style:{color:t.colorError}}),content:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:(0,W.jsx)(`strong`,{children:`This is a destructive operation.`})}),(0,W.jsx)(`p`,{children:`This typically removes all Docker volumes, databases, and other environment state. Source files in the branch are not deleted, but anything stored inside containers or volumes may be lost.`})]}),okText:`Nuke environment`,okType:`danger`,cancelText:`Cancel`,onOk:n})}function Lo({connecting:e,loading:t,dataError:n,mustChangePassword:r,initialLoadComplete:i}){let[a,o]=(0,U.useState)(`loading`);return(0,U.useEffect)(()=>{!e&&!t&&a===`loading`&&(n||r?o(`done`):i&&o(`complete`))},[e,t,a,n,r,i]),(0,U.useEffect)(()=>{if(a===`complete`){let e=setTimeout(()=>o(`fading`),250);return()=>clearTimeout(e)}if(a===`fading`){let e=setTimeout(()=>o(`done`),280);return()=>clearTimeout(e)}},[a]),a}function Ro(e,t){if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return console.error(`Error reading localStorage key "${e}":`,n),t}}function zo(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,JSON.stringify(t))}catch(t){console.error(`Error setting localStorage key "${e}":`,t)}}var Bo=`agor-local-storage-change`;function Vo(e,t){let n=(0,U.useCallback)(()=>Ro(e,t),[t,e]),[r,i]=(0,U.useState)(n),a=(0,U.useRef)(e);a.current=e;let o=(0,U.useCallback)(e=>{try{i(t=>{let n=e instanceof Function?e(t):e;return zo(a.current,n),typeof window<`u`&&window.dispatchEvent(new CustomEvent(Bo,{detail:{key:a.current,value:n}})),n})}catch(e){console.error(`Error setting localStorage key "${a.current}":`,e)}},[]);return(0,U.useEffect)(()=>{if(typeof window>`u`)return;let t=t=>{t.key===e&&i(n())},r=t=>{let n=t;n.detail?.key===e&&i(n.detail.value)};return window.addEventListener(`storage`,t),window.addEventListener(Bo,r),()=>{window.removeEventListener(`storage`,t),window.removeEventListener(Bo,r)}},[e,n]),[r,o]}function Ho(){let{user:e}=Mo(),t=e?.role;return(0,U.useMemo)(()=>({role:t,isAdmin:St(t,Pt.ADMIN),isSuperAdmin:St(t,Pt.SUPERADMIN),hasRole:e=>St(t,e)}),[t])}var Uo=`agor:recentBoardIds`,Wo=10;function Go(e,t){let[n,r]=Vo(Uo,[]),i=(0,U.useCallback)(e=>{r(t=>[e,...t.filter(t=>t!==e)].slice(0,Wo))},[r]);return{recentBoards:(0,U.useMemo)(()=>{let r=new Map(e.map(e=>[e.board_id,e]));return n.filter(e=>e!==t&&r.has(e)).map(e=>r.get(e)).slice(0,3)},[n,t,e]),recentBoardIds:n,trackBoardVisit:i}}var Ko=6e4;function qo(e,t){return!e||!t||e===`dev`||t===`dev`?!1:e!==t}function Jo(e,t=za(),n=Ko){let[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),s=(0,U.useRef)(null),c=(0,U.useCallback)(e=>{e&&(o(e),s.current===null&&(s.current=e,i(e)))},[]);return(0,U.useEffect)(()=>{let e=new AbortController,r=t.replace(/\/$/,``),i=()=>{fetch(`${r}/health`,{signal:e.signal}).then(e=>e.ok?e.json():null).then(e=>{typeof e?.buildSha==`string`&&c(e.buildSha)}).catch(()=>{})};i();let a=n>0?setInterval(i,n):null;return()=>{e.abort(),a!==null&&clearInterval(a)}},[t,n,c]),(0,U.useEffect)(()=>{if(!e?.io)return;let t=e=>{typeof e?.buildSha==`string`&&c(e.buildSha)};return e.io.on(`server-info`,t),()=>{e.io.off(`server-info`,t)}},[e,c]),{capturedSha:r,currentSha:a,outOfSync:qo(r,a)}}function Yo(){return(0,U.useContext)(ja)}function Xo(e){return Wt(Yo(),e)}function Zo(e){return un(Yo(),e)}function Qo(e){let[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(null),a=async t=>{if(!e)return i(`Client not connected`),null;try{if(n(!0),i(null),!t.branch_id)throw Error(`Branch ID is required`);let r=t.agent,a=t.permissionMode||Vt(r),o={mode:a};if(r===`codex`){let e=Et(a);o.codex={sandboxMode:t.codexSandboxMode??e.sandboxMode,approvalPolicy:t.codexApprovalPolicy??e.approvalPolicy,networkAccess:t.codexNetworkAccess??e.networkAccess}}return await e.service(`sessions`).create({agentic_tool:r,status:zt.IDLE,title:t.title||void 0,description:t.initialPrompt||void 0,branch_id:t.branch_id,model_config:t.modelConfig?{...t.modelConfig,...t.effort&&{effort:t.effort},updated_at:new Date().toISOString()}:t.effort?{effort:t.effort,updated_at:new Date().toISOString()}:void 0,permission_config:o})}catch(e){return i(e instanceof Error?e.message:`Failed to create session`),console.error(`Failed to create session:`,e),null}finally{n(!1)}},o=async(t,r)=>{if(!e)throw i(`Client not connected`),Error(`Client not connected`);try{n(!0),i(null);let a=await e.service(`sessions/${t}/fork`).create({prompt:r});return r.trim()&&await e.sessions.prompt(a.session_id,r,{messageSource:`agor`}),a}catch(e){let t=e instanceof Error?e.message:`Failed to fork session`;throw i(t),console.error(`Failed to fork session:`,e),e instanceof Error?e:Error(t)}finally{n(!1)}},s=async(t,r)=>{if(!e)throw i(`Client not connected`),Error(`Client not connected`);try{n(!0),i(null);let a=await e.service(`sessions/${t}/fork`).create({prompt:r});return await e.service(`sessions`).patch(a.session_id,{fork_origin:`btw`}),r.trim()&&await e.sessions.prompt(a.session_id,r,{messageSource:`agor`}),a}catch(e){let t=e instanceof Error?e.message:`Failed to create btw fork`;throw i(t),console.error(`Failed to create btw fork:`,e),e instanceof Error?e:Error(t)}finally{n(!1)}},c=async(t,r)=>{if(!e)throw i(`Client not connected`),Error(`Client not connected`);try{n(!0),i(null);let a=await e.service(`sessions/${t}/spawn`).create(r);return r.prompt?.trim()&&await e.sessions.prompt(a.session_id,r.prompt,{messageSource:`agor`}),a}catch(e){let t=e instanceof Error?e.message:`Failed to spawn session`;throw i(t),console.error(`Failed to spawn session:`,e),e instanceof Error?e:Error(t)}finally{n(!1)}},l=async(t,n)=>{if(!e)return i(`Client not connected`),null;try{return i(null),await e.service(`sessions`).patch(t,n)}catch(e){return i(e instanceof Error?e.message:`Failed to update session`),console.error(`Failed to update session:`,e),null}};return{createSession:a,updateSession:l,deleteSession:async t=>{if(!e)return i(`Client not connected`),!1;try{return i(null),await e.service(`sessions`).remove(t),!0}catch(e){return i(e instanceof Error?e.message:`Failed to delete session`),console.error(`Failed to delete session:`,e),!1}},archiveSession:async e=>l(e,{archived:!0,archived_reason:`manual`}),unarchiveSession:async e=>l(e,{archived:!1,archived_reason:void 0}),forkSession:o,btwForkSession:s,spawnSession:c,creating:t,error:r}}var $o=[`boards`,`repos`,`branches`,`assistants`,`cards`,`artifacts`,`mcp`,`agentic-tools`,`gateway`,`groups`,`users`,`about`];function es(){let e=hn(),t=Jt(),n=e.state?.settingsBackgroundPath??null,r=(0,U.useMemo)(()=>{let t=e.pathname.match(/\/settings(?:\/([^/]+))?(?:\/([^/]+))?\/?$/);if(!t)return{isOpen:!1,section:`boards`,itemId:null};let[,n,r]=t;return{isOpen:!0,section:$o.includes(n)?n:`boards`,itemId:r||null}},[e.pathname]),i=(0,U.useCallback)((r=`boards`,i)=>{t(i?`/settings/${r}/${i}/`:`/settings/${r}/`,{state:{settingsBackgroundPath:e.pathname.startsWith(`/settings`)?n||`/`:`${e.pathname}${e.search}${e.hash}`}})},[e.hash,e.pathname,e.search,t,n]),a=(0,U.useCallback)(()=>{t(n||`/`)},[t,n]),o=(0,U.useCallback)(e=>{t(`/settings/${e}/`,{state:n?{settingsBackgroundPath:n}:void 0})},[t,n]),s=(0,U.useCallback)(e=>{t(`/settings/${r.section}/${e}/`,{state:n?{settingsBackgroundPath:n}:void 0})},[t,r.section,n]),c=(0,U.useCallback)(()=>{t(`/settings/${r.section}/`,{state:n?{settingsBackgroundPath:n}:void 0})},[t,r.section,n]);return{...r,openSettings:i,closeSettings:a,setSection:o,openItem:s,closeItem:c}}function ts(e,t,n={}){let{enabled:r=!0,reactiveOptions:i}=n,a=i?.taskHydration??`lazy`,[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null);return(0,U.useEffect)(()=>{if(!e||!t||!r){s(null),l(null);return}let n=wt(e,t,{taskHydration:a});s(n);let i=!1,o=()=>{i||l(n.state)};o();let c=n.subscribe(o);return n.ready().then(o).catch(o),()=>{i=!0,c(),Tt(e,t,{taskHydration:a})}},[e,t,r,a]),(0,U.useEffect)(()=>{if(!o)return;let e=()=>{let e=o.state;!e.error||e.terminal||o.resync()},t=()=>{document.visibilityState===`visible`&&e()},n=()=>{e()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(Za,n),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(Za,n)}},[o]),{handle:o,state:c}}function ns(e,t,n,r){let i=fn(e,Array.from(t,e=>({id:n(e)})));return i.length===0?null:i.length===1?i[0].id:(r?.(e,i.length),null)}function rs(e,t,n){for(let n of t.values())if(n.slug===e)return n.board_id;return ns(e,t.values(),e=>e.board_id,n)}function is(e,t,n){return ns(e,t.values(),e=>e.session_id,n)}function as(e,t,n){return ns(e,t.values(),e=>e.branch_id,n)}function os(e,t,n){return ns(e,t.values(),e=>e.artifact_id,n)}function ss(e,t){return t.get(e)?.slug}function cs(e,t){return rn(e,ss(e,t))}function ls(e){let{currentBoardId:t,currentSessionId:n,boardById:r,sessionById:i,branchById:a,artifactById:o,onBoardChange:s,onSessionChange:c,onActiveUrlTargetChange:l}=e,u=Jt(),d=hn(),f=Yt(),p=Ta(),m=(0,U.useRef)(!1),h=(0,U.useRef)(null),g=(0,U.useRef)(t),_=(0,U.useRef)(n),v=(0,U.useRef)(null),y=(0,U.useRef)(null),b=(0,U.useRef)(null),x=(0,U.useRef)(null),S=(0,U.useRef)({board:!1,session:!1,branch:!1,artifact:!1}),C=(0,U.useRef)(null),w=(0,U.useRef)(null);(0,U.useEffect)(()=>{g.current=t,_.current=n},[t,n]),(0,U.useEffect)(()=>()=>{C.current&&=(clearTimeout(C.current),null)},[]);let T=f.boardParam||null,E=f.sessionShortId||null,D=f.branchShortId||null,O=f.artifactShortId||null,k=d.pathname.startsWith(`/settings`),A=(0,U.useCallback)((e,t)=>t?Nt(t):e?cs(e,r):`/`,[r]),ee=(0,U.useCallback)(()=>{if(m.current||n===null&&[Mt.branch,Mt.artifact].some(e=>d.pathname.startsWith(`/${e}/`)))return;let e=A(t,n),r=`${(d.pathname+d.search).replace(/\/$/,``)}/`;`${e.replace(/\/$/,``)}/`!==r&&e!==h.current&&(h.current=e,u(e,{replace:!0}))},[t,n,A,d.pathname,d.search,u]),j=(0,U.useCallback)((e,t,n)=>{},[]),M=(0,U.useCallback)(e=>rs(e,r,(e,t)=>j(`board`,e,t)),[r,j]),N=(0,U.useCallback)(e=>is(e,i,(e,t)=>j(`session`,e,t)),[i,j]),te=(0,U.useCallback)(e=>as(e,a,(e,t)=>j(`branch`,e,t)),[a,j]),P=(0,U.useCallback)(e=>os(e,o,(e,t)=>j(`artifact`,e,t)),[o,j]);(0,U.useEffect)(()=>{let e=T!==v.current||E!==y.current||D!==b.current||O!==x.current;e&&(S.current={board:!1,session:!1,branch:!1,artifact:!1},v.current=T,y.current=E,b.current=D,x.current=O,C.current&&=(clearTimeout(C.current),null));let t=S.current.board&&S.current.session&&S.current.branch&&S.current.artifact;if(!e&&t)return;if(!T&&!E&&!D&&!O){let e=d.pathname===`/`||d.pathname===``;if(!k&&!e){m.current=!0,u(`/`,{replace:!0}),setTimeout(()=>{m.current=!1},0);return}!k&&g.current&&(m.current=!0,s(``),_.current&&c(null),setTimeout(()=>{m.current=!1},0)),l&&w.current!==null&&(w.current=null,l(null));return}if(T&&r.size===0||E&&(i.size===0||a.size===0)||D&&a.size===0||O&&o.size===0)return;let n=null,f=null,h=null,A=null;if(T&&(n=M(T),n&&(S.current.board=!0)),E){if(f=N(E),f){S.current.session=!0;let e=i.get(f),t=e?.branch_id?a.get(e.branch_id):void 0;t?.board_id&&(n=t.board_id,h=t.branch_id)}}else S.current.session=!0;if(D){let e=te(D);if(e){S.current.branch=!0,A={kind:`branch`,id:e};let t=a.get(e);t?.board_id&&(n=t.board_id,h=e)}}else S.current.branch=!0;if(O){let e=P(O);if(e){S.current.artifact=!0,A={kind:`artifact`,id:e};let t=o.get(e);t?.board_id&&(n=t.board_id,h=e)}}else S.current.artifact=!0;if(l){let e=w.current;(e===null!=(A===null)||e!==null&&A!==null&&(e.kind!==A.kind||e.id!==A.id))&&(w.current=A,l(A))}let ee=n&&n!==g.current,j=E?f:null,ne=j!==_.current;if((ee||ne)&&(m.current=!0,ee&&n&&s(n),ne&&c(j),setTimeout(()=>{m.current=!1},0)),e&&h&&n){let e=h,t=n;C.current=setTimeout(()=>{C.current=null,p(e,{boardId:t})},50)}},[T,E,D,O,r.size,i,a,o,M,N,te,P,s,c,l,k,p,d.pathname,u]),(0,U.useEffect)(()=>{m.current||k||!T&&!E&&!D&&!O&&d.pathname!==`/`&&d.pathname!==``||r.size!==0&&(T&&!S.current.board||E&&!S.current.session||D&&!S.current.branch||O&&!S.current.artifact||ee())},[r.size,T,E,D,O,k,ee,d.pathname])}function us(e){return Array.from(e.values())}function ds(e,t){let n=Array.from(e.values());return t?n.sort(t):n}function fs(e){return Qn(e).map(e=>e.trim().toLowerCase()).filter(Boolean)}function ps(e){return e==null?[]:Array.isArray(e)?e.flatMap(ps):[String(e)]}function ms(e,t,n){let r=fs(t);return r.length===0?!0:Zn(r,n.flatMap(t=>ps(t(e))))}function hs(e,t,n){return fs(t).length===0?e:e.filter(e=>ms(e,t,n))}function gs(e,t=2){let n=e.trim().toLowerCase(),r=_s(Qn(e).filter(e=>e.length>=t)),i=n.split(/\s+/).filter(Boolean);return n.length>=t&&i.length>0&&i.every(e=>e.length>=t)&&!r.includes(n)&&r.unshift(n),r.sort((e,t)=>t.length-e.length)}function _s(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var vs=({text:e,query:t=``,terms:n,minTermLength:r=2})=>{let{token:i}=ce.useToken(),a=n??gs(t,r);if(!e||a.length===0)return(0,W.jsx)(W.Fragment,{children:e});let o=a.map(ys).filter(Boolean);if(o.length===0)return(0,W.jsx)(W.Fragment,{children:e});let s=RegExp(`(${o.join(`|`)})`,`gi`);return(0,W.jsx)(W.Fragment,{children:e.split(s).map((e,t)=>e?a.some(t=>t.toLowerCase()===e.toLowerCase())?(0,W.jsx)(`mark`,{style:{backgroundColor:i.colorWarning,color:`rgba(0, 0, 0, 0.88)`,padding:`0 ${i.paddingXXS}px`,borderRadius:i.borderRadiusSM,fontWeight:600},children:e},t):(0,W.jsx)(`span`,{children:e},t):null)})};function ys(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var bs=new Set([`authorization`,`connection`,`content-length`,`cookie`,`host`,`mcp-session-id`,`te`,`trailer`,`transfer-encoding`,`upgrade`]),xs=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Ss(e){return xs.test(e)}function Cs(e){return bs.has(e.toLowerCase())}function ws(e){return e?e.includes(`{{`)&&e.includes(`}}`):!1}function Ts(e){let t={};return e.oauth_authorization_url&&typeof e.oauth_authorization_url==`string`&&(t.oauth_authorization_url=e.oauth_authorization_url),e.oauth_token_url&&typeof e.oauth_token_url==`string`&&(t.oauth_token_url=e.oauth_token_url),e.oauth_client_id&&typeof e.oauth_client_id==`string`&&(t.oauth_client_id=e.oauth_client_id),e.oauth_client_secret&&typeof e.oauth_client_secret==`string`&&(t.oauth_client_secret=e.oauth_client_secret),e.oauth_scope&&typeof e.oauth_scope==`string`&&(t.oauth_scope=e.oauth_scope),t.oauth_grant_type=typeof e.oauth_grant_type==`string`?e.oauth_grant_type:`client_credentials`,t.oauth_mode=e.oauth_mode===`shared`?`shared`:`per_user`,t}function Es(e){if(!e.url||typeof e.url!=`string`)return null;let t={mcp_url:e.url};return e.oauth_token_url&&typeof e.oauth_token_url==`string`&&(t.token_url=e.oauth_token_url),e.oauth_client_id&&typeof e.oauth_client_id==`string`&&!ws(e.oauth_client_id)&&(t.client_id=e.oauth_client_id),e.oauth_client_secret&&typeof e.oauth_client_secret==`string`&&!ws(e.oauth_client_secret)&&(t.client_secret=e.oauth_client_secret),e.oauth_scope&&typeof e.oauth_scope==`string`&&(t.scope=e.oauth_scope),e.oauth_grant_type&&typeof e.oauth_grant_type==`string`&&(t.grant_type=e.oauth_grant_type),t}function Ds(e){let t=e.auth_type;if(t!==`bearer`&&t!==`jwt`&&t!==`oauth`)return;let n={type:t};return t===`bearer`?typeof e.auth_token==`string`&&(n.token=e.auth_token):t===`jwt`?(typeof e.jwt_api_url==`string`&&(n.api_url=e.jwt_api_url),typeof e.jwt_api_token==`string`&&(n.api_token=e.jwt_api_token),typeof e.jwt_api_secret==`string`&&(n.api_secret=e.jwt_api_secret)):Object.assign(n,Ts(e)),n}function Os(e){if(!(typeof e!=`string`||!e.trim()))try{return JSON.parse(e)}catch{return}}function ks(e){if(!(typeof e!=`string`||!e.trim()))try{let t=JSON.parse(e),n={};for(let[e,r]of Object.entries(t))e.toLowerCase()!==`authorization`&&typeof r==`string`&&(n[e]=r);return n}catch{return}}function As(e){if(typeof e!=`string`||!e.trim())return;let t;try{t=JSON.parse(e)}catch{return`Custom HTTP headers must be valid JSON`}if(!t||typeof t!=`object`||Array.isArray(t))return`Custom HTTP headers must be a JSON object`;for(let[e,n]of Object.entries(t)){let t=e.trim();if(!t)return`Custom HTTP header names cannot be empty`;if(!Ss(t))return`Invalid custom HTTP header name: ${e}`;if(Cs(t))return`Custom HTTP header ${t} is reserved and cannot be configured here`;if(typeof n!=`string`)return`Custom HTTP header values must be strings`}}var{TextArea:js}=L;function Ms(e){return e!==`stdio`}var Ns=({mode:e,transport:t,onTransportChange:n,authType:r=`none`,onAuthTypeChange:i,form:a,client:c,serverId:l,onTestConnection:u,testing:d=!1,testResult:f,onSaveFirst:p})=>{let{showSuccess:m,showError:g,showWarning:_,showInfo:y}=mn(),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),[O,k]=(0,U.useState)(!1),A=(0,U.useRef)(null);(0,U.useEffect)(()=>()=>{A.current?.()},[]);let[ee,j]=(0,U.useState)(l);(0,U.useEffect)(()=>{j(l)},[l]);let M=B.useWatch(`oauth_authorization_url`,a),N=B.useWatch(`oauth_token_url`,a),te=B.useWatch(`oauth_scope`,a),ne=B.useWatch(`oauth_client_id`,a),re=B.useWatch(`oauth_client_secret`,a),ie=B.useWatch(`oauth_mode`,a),ae=B.useWatch(`env`,a),oe=B.useWatch(`headers`,a),F=typeof ae==`string`&&ae.trim().length>0,ce=Ms(t)&&typeof oe==`string`&&oe.trim().length>0,le=[M,N,te,ne,re].some(e=>typeof e==`string`&&e.trim().length>0)||typeof ie==`string`&&ie!==`per_user`,de=async()=>{if(!c){g(`Client not available`);return}let e=ee;if(!e&&p){y(`Saving MCP server before testing...`);let t=await p();if(!t){g(`Failed to save MCP server`);return}e=t,j(t)}let t=Es(a.getFieldsValue(!0));if(!t){g(`MCP URL is required`);return}T(!0);let n=({authUrl:e})=>{window.open(e,`_blank`,`noopener,noreferrer`)};c.io.on(`oauth:open_browser`,n);try{y(`Starting OAuth authentication flow...`);let n=await c.service(`mcp-servers/oauth-start`).create({mcp_url:t.mcp_url,mcp_server_id:e,client_id:t.client_id});if(n.success&&n.state){D(!0),y(`Authenticating... complete sign-in in the new tab.`);let e=e=>{e.state===n.state&&e.success&&(m(`OAuth authentication successful!`),D(!1),C(!1),t())},t=()=>{c.io.off(`oauth:completed`,e),A.current=null};A.current?.(),A.current=t,c.io.on(`oauth:completed`,e)}else g(n.error||`Failed to start OAuth flow`)}catch(e){g(`OAuth flow error: ${e instanceof Error?e.message:String(e)}`)}finally{c.io.off(`oauth:open_browser`,n),T(!1)}},fe=async()=>{if(!c){g(`Client not available`);return}if(!ee){g(`Cannot disconnect: MCP server must be saved first`);return}k(!0);try{let e=await c.service(`mcp-servers/oauth-disconnect`).create({mcp_server_id:ee});e.success?(m(e.message||`OAuth connection removed`),C(!0)):g(e.error||`Failed to disconnect OAuth`)}catch(e){g(`Disconnect error: ${e instanceof Error?e.message:String(e)}`)}finally{k(!1)}},pe=async()=>{if(!c){g(`Client not available`);return}let e=a.getFieldsValue(!0),t=e.auth_type||r;x(!0);try{if(t===`jwt`){let t=e.jwt_api_url,n=e.jwt_api_token,r=e.jwt_api_secret;if(!t||!n||!r){g(`Please fill in all JWT authentication fields`);return}let i=await c.service(`mcp-servers/test-jwt`).create({api_url:t,api_token:n,api_secret:r});i.success?m(`JWT authentication successful - token received`):g(i.error||`JWT authentication failed`)}else if(t===`oauth`){let t=Es(e);if(!t){_(`Please enter MCP URL first to test OAuth authentication`);return}let n=await c.service(`mcp-servers/test-oauth`).create(t);if(n.success)if(n.requiresBrowserFlow)C(!0),y(n.message||`OAuth 2.1 detected. Click "Start OAuth Flow" to authenticate in browser.`);else if(n.oauthType===`none`)C(!1),m(`MCP server accessible without authentication`);else{let e=n.message||`OAuth authentication successful`;n.tokenUrlSource===`auto-detected`&&(e+=` (token URL auto-detected)`),n.mcpStatus!==void 0&&(e+=` | MCP server responded with ${n.mcpStatus}`),m(e)}else{let e=n.error||`OAuth authentication failed`;n.hint&&(e+=`\n\nHint: ${n.hint}`),g(e)}}else t===`bearer`?e.auth_token?m(`Bearer token configured`):_(`No bearer token provided`):y(`No authentication required - ready to use`)}catch(e){g(`Connection test failed: ${e instanceof Error?e.message:`Unknown error`}`)}finally{x(!1)}},me=Ms(t),he=me&&r===`oauth`,ge=e===`create`,ve=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(_e,{gutter:16,children:[(0,W.jsx)(dt,{span:12,children:ge?(0,W.jsx)(B.Item,{label:`Name (Internal ID)`,name:`name`,rules:[{required:!0,message:`Please enter a server name`},{pattern:/^[a-z][a-z0-9_-]*$/,message:`Lowercase letters, digits, _ or - only; must start with a letter`},{max:64,message:`Maximum 64 characters`}],tooltip:`Internal identifier - lowercase, no spaces (e.g., filesystem, sentry, context7)`,children:(0,W.jsx)(L,{placeholder:`context7`})}):(0,W.jsx)(B.Item,{label:`Name (Internal ID)`,name:`name`,tooltip:`Internal identifier - cannot be changed after creation`,children:(0,W.jsx)(L,{disabled:!0})})}),(0,W.jsx)(dt,{span:12,children:(0,W.jsx)(B.Item,{label:ge?`Display Name (Optional)`:`Display Name`,name:`display_name`,tooltip:`User-friendly name shown in UI (e.g., Context7 MCP)`,children:(0,W.jsx)(L,{placeholder:ge?`Context7 MCP`:`Filesystem Access`})})})]}),(0,W.jsxs)(_e,{gutter:16,children:[(0,W.jsx)(dt,{span:12,children:(0,W.jsx)(B.Item,{label:`Scope`,name:`scope`,initialValue:ge?`session`:`global`,tooltip:`Where this server is available`,children:(0,W.jsxs)(P,{children:[(0,W.jsx)(P.Option,{value:`global`,children:`Global (all sessions)`}),(0,W.jsx)(P.Option,{value:`session`,children:`Session`})]})})}),(0,W.jsx)(dt,{span:12,children:(0,W.jsx)(B.Item,{label:`Enabled`,name:`enabled`,valuePropName:`checked`,initialValue:!0,children:(0,W.jsx)(ye,{})})})]}),(0,W.jsx)(B.Item,{label:`Description`,name:`description`,children:(0,W.jsx)(js,{placeholder:`Optional description...`,rows:2})})]}),be=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(I,{title:(0,W.jsxs)(W.Fragment,{children:[`Use `,(0,W.jsx)(s.Text,{code:!0,children:`{{ user.env.VAR }}`}),` to inject your environment variables.`]}),type:`info`,showIcon:!0,style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:`Transport`,name:`transport`,rules:e===`create`?[{required:!0}]:[],initialValue:e===`create`?`stdio`:void 0,tooltip:`Connection method: stdio for local processes, HTTP/SSE for remote servers`,children:(0,W.jsxs)(P,{onChange:e=>n?.(e),children:[(0,W.jsx)(P.Option,{value:`stdio`,children:`stdio (Local process)`}),(0,W.jsx)(P.Option,{value:`http`,children:`HTTP`}),(0,W.jsx)(P.Option,{value:`sse`,children:`SSE (Server-Sent Events)`})]})}),t===`stdio`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Command`,name:`command`,rules:e===`create`?[{required:!0,message:`Please enter a command`}]:[],tooltip:`Command to execute (e.g., npx, node, python)`,children:(0,W.jsx)(L,{placeholder:`npx`})}),(0,W.jsx)(B.Item,{label:`Arguments`,name:`args`,tooltip:`Comma-separated arguments. Each argument will be passed separately to the command. Example: -y, @modelcontextprotocol/server-filesystem, /allowed/path`,children:(0,W.jsx)(L,{placeholder:`-y, @modelcontextprotocol/server-filesystem, /allowed/path`})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`URL`,name:`url`,rules:e===`create`?[{required:!0,message:`Please enter a URL`}]:[],tooltip:`Server URL. Supports templates like {{ user.env.MCP_URL }}`,children:(0,W.jsx)(L,{placeholder:`https://mcp.example.com`})}),(0,W.jsx)(B.Item,{label:`Auth Type`,name:`auth_type`,initialValue:`none`,tooltip:`Authentication method for the MCP server`,children:(0,W.jsxs)(P,{onChange:e=>{C(!1),e!==`jwt`&&a.setFieldsValue({jwt_api_url:void 0,jwt_api_token:void 0,jwt_api_secret:void 0}),e!==`bearer`&&a.setFieldsValue({auth_token:void 0}),e!==`oauth`&&a.setFieldsValue({oauth_authorization_url:void 0,oauth_token_url:void 0,oauth_client_id:void 0,oauth_client_secret:void 0,oauth_scope:void 0}),i?.(e)},children:[(0,W.jsx)(P.Option,{value:`none`,children:`None`}),(0,W.jsx)(P.Option,{value:`bearer`,children:`Bearer Token`}),(0,W.jsx)(P.Option,{value:`jwt`,children:`JWT`}),(0,W.jsx)(P.Option,{value:`oauth`,children:`OAuth 2.1`})]})}),r===`bearer`&&(0,W.jsx)(B.Item,{label:`Token`,name:`auth_token`,rules:[{required:!0,message:`Please enter a bearer token`}],tooltip:`Bearer token. Supports templates like {{ user.env.API_TOKEN }}`,children:(0,W.jsx)(L.Password,{placeholder:`{{ user.env.API_TOKEN }} or raw token`})}),r===`jwt`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`API URL`,name:`jwt_api_url`,rules:[{required:!0,message:`Please enter the API URL`}],tooltip:`JWT auth API URL. Supports templates.`,children:(0,W.jsx)(L,{placeholder:`https://auth.example.com/token`})}),(0,W.jsx)(B.Item,{label:`API Token`,name:`jwt_api_token`,rules:[{required:!0,message:`Please enter the API token`}],tooltip:`JWT API token. Supports templates like {{ user.env.JWT_TOKEN }}`,children:(0,W.jsx)(L.Password,{placeholder:`{{ user.env.JWT_TOKEN }} or raw token`})}),(0,W.jsx)(B.Item,{label:`API Secret`,name:`jwt_api_secret`,rules:[{required:!0,message:`Please enter the API secret`}],tooltip:`JWT API secret. Supports templates like {{ user.env.JWT_SECRET }}`,children:(0,W.jsx)(L.Password,{placeholder:`{{ user.env.JWT_SECRET }} or raw secret`})})]})]}),(r!==`none`||me)&&(0,W.jsx)(B.Item,{label:`Actions`,style:{marginBottom:16},children:(0,W.jsxs)(z,{wrap:!0,children:[r!==`none`&&(0,W.jsx)(V,{type:`default`,loading:b,onClick:pe,children:`Test Authentication`}),r===`oauth`&&S&&(0,W.jsx)(V,{type:`primary`,loading:w,onClick:de,children:`Start OAuth Flow`}),r===`oauth`&&ee&&!S&&(0,W.jsx)(V,{type:`default`,danger:!0,loading:O,onClick:fe,children:`Disconnect OAuth`}),me&&(0,W.jsx)(V,{type:`default`,icon:(0,W.jsx)(mt,{}),onClick:u,loading:d,children:d?`Testing...`:`Test Connection`})]})}),f?.success&&(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(I,{type:`success`,title:`Connected: ${f.toolCount} tools, ${f.resourceCount} resources, ${f.promptCount} prompts`,showIcon:!0,style:{marginBottom:8}}),f.tools&&f.tools.length>0&&(0,W.jsxs)(`div`,{style:{marginTop:8},children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`Tools:`}),(0,W.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:f.tools.map(e=>(0,W.jsx)(o,{title:e.description||`No description`,placement:`top`,children:(0,W.jsx)(v,{color:`blue`,style:{marginBottom:4,cursor:`help`},children:e.name})},e.name))})]}),f.resources&&f.resources.length>0&&(0,W.jsxs)(`div`,{style:{marginTop:8},children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`Resources:`}),(0,W.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:f.resources.map(e=>(0,W.jsx)(o,{title:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:e.uri}),e.mimeType&&(0,W.jsx)(`div`,{style:{opacity:.7,fontSize:11},children:e.mimeType})]}),placement:`top`,children:(0,W.jsx)(v,{color:`cyan`,style:{marginBottom:4,cursor:`help`},children:e.name})},e.uri))})]}),f.prompts&&f.prompts.length>0&&(0,W.jsxs)(`div`,{style:{marginTop:8},children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`Prompts:`}),(0,W.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:f.prompts.map(e=>(0,W.jsx)(o,{title:e.description||`No description`,placement:`top`,children:(0,W.jsx)(v,{color:`purple`,style:{marginBottom:4,cursor:`help`},children:e.name})},e.name))})]})]}),f&&!f.success&&(0,W.jsx)(I,{type:`error`,title:`Connection failed`,description:f.error,showIcon:!0,style:{marginBottom:16}}),he&&(0,W.jsx)(ue,{ghost:!0,destroyOnHidden:!1,expandIcon:({isActive:e})=>(0,W.jsx)(se,{rotate:e?180:0}),items:[{key:`advanced-oauth`,forceRender:!0,label:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(s.Text,{strong:!0,children:`Advanced — OAuth settings`}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`(auto-discovered when blank)`}),le&&(0,W.jsx)(o,{title:`Customized — one or more values overridden`,children:(0,W.jsx)(h,{color:`orange`})})]}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(I,{title:`OAuth defaults are usually fine`,description:(0,W.jsxs)(`ul`,{style:{margin:0,paddingLeft:20,fontSize:12},children:[(0,W.jsx)(`li`,{children:`Modern OAuth 2.1 servers support discovery (RFC 8414 / RFC 9728) and Dynamic Client Registration — leave everything here blank.`}),(0,W.jsx)(`li`,{children:`Set Client ID / Client Secret only for servers that require a pre-registered OAuth app (e.g. Figma, GitHub).`}),(0,W.jsx)(`li`,{children:`Override the URLs only if the server doesn't expose a discovery document or you need a non-default endpoint.`})]}),type:`info`,showIcon:!0,style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:`Client ID`,name:`oauth_client_id`,tooltip:`Required for servers that don't support Dynamic Client Registration (e.g. Figma, GitHub). Register an OAuth app with the provider and paste the client ID here. Leave blank to use DCR.`,children:(0,W.jsx)(L,{placeholder:`Enter client ID or {{ user.env.OAUTH_CLIENT_ID }}`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Client Secret`,name:`oauth_client_secret`,tooltip:`Required for servers that use confidential clients (e.g. Figma). The secret is sent via HTTP Basic Auth during token exchange.`,children:(0,W.jsx)(L.Password,{placeholder:`Enter client secret or {{ user.env.OAUTH_CLIENT_SECRET }}`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`OAuth Mode`,name:`oauth_mode`,initialValue:`per_user`,tooltip:`Per User: Each user authenticates separately (recommended). Shared: One token for all users.`,children:(0,W.jsxs)(P,{children:[(0,W.jsx)(P.Option,{value:`per_user`,children:`Per User (each user authenticates) - Recommended`}),(0,W.jsx)(P.Option,{value:`shared`,children:`Shared (single token for all users)`})]})}),(0,W.jsx)(B.Item,{label:`Authorization URL`,name:`oauth_authorization_url`,tooltip:`OAuth authorization endpoint for browser-based login. Leave empty for auto-discovery (RFC 8414).`,children:(0,W.jsx)(L,{placeholder:`https://auth.example.com/oauth/authorize`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Token URL`,name:`oauth_token_url`,tooltip:`OAuth token endpoint. Leave empty for auto-discovery (OAuth 2.1 RFC 9728)`,children:(0,W.jsx)(L,{placeholder:`Auto-detect or {{ user.env.OAUTH_TOKEN_URL }}`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Scope`,name:`oauth_scope`,tooltip:`Optional: OAuth scopes (space-separated, e.g., 'read write')`,children:(0,W.jsx)(L,{placeholder:`Leave empty or specify scopes`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Grant Type`,name:`oauth_grant_type`,initialValue:`client_credentials`,tooltip:`OAuth grant type for Client Credentials flow. OAuth 2.1 auto-discovery uses Authorization Code with PKCE instead.`,children:(0,W.jsx)(P,{disabled:!0,children:(0,W.jsx)(P.Option,{value:`client_credentials`,children:`Client Credentials`})})})]})}]})]});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ue,{ghost:!0,destroyOnHidden:!1,defaultActiveKey:[`basic`,`connection`],expandIcon:({isActive:e})=>(0,W.jsx)(se,{rotate:e?180:0}),items:[{key:`basic`,label:(0,W.jsx)(s.Text,{strong:!0,children:`Basic Information`}),children:ve},{key:`connection`,label:(0,W.jsx)(s.Text,{strong:!0,children:`Connection`}),children:be},{key:`advanced-config`,label:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(s.Text,{strong:!0,children:`Advanced Configuration`}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`(headers and environment variables)`}),(ce||F)&&(0,W.jsx)(o,{title:`Advanced configuration set`,children:(0,W.jsx)(h,{color:`orange`})})]}),children:(0,W.jsxs)(W.Fragment,{children:[me&&(0,W.jsx)(B.Item,{label:`Custom HTTP Headers`,name:`headers`,tooltip:`JSON object of additional headers for HTTP/SSE transports. Values support templates like {{ user.env.DATADOG_API_KEY }}. Authorization is configured via Auth Type, not here.`,rules:[{validator:async(e,t)=>{let n=As(t);if(n)throw Error(n)}}],children:(0,W.jsx)(js,{placeholder:`{"DD-API-KEY": "{{ user.env.DATADOG_API_KEY }}", "X-Datadog-Parent-Org-Id": "123"}`,rows:3})}),(0,W.jsx)(B.Item,{label:`Environment Variables`,name:`env`,tooltip:`JSON object of environment variables. Values support templates like {{ user.env.VAR_NAME }}`,children:(0,W.jsx)(js,{placeholder:`{"GITHUB_TOKEN": "{{ user.env.GITHUB_TOKEN }}", "ALLOWED_PATHS": "/path"}`,rows:3})})]})}]}),(0,W.jsx)(it,{title:`OAuth Authentication`,open:E,onCancel:()=>{D(!1),A.current?.()},footer:[(0,W.jsx)(V,{onClick:()=>{D(!1),A.current?.()},children:`Cancel`},`cancel`)],children:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(s.Paragraph,{children:`Waiting for authentication to complete in the browser tab...`}),(0,W.jsx)(s.Paragraph,{children:`This dialog will close automatically once sign-in is complete.`})]})})]})},Ps=({server:e,open:t,client:n,onClose:r})=>{let{showSuccess:i,showError:a}=mn(),[o]=B.useForm(),[s,c]=(0,U.useState)(`stdio`),[l,u]=(0,U.useState)(`none`),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(null);(0,U.useEffect)(()=>{if(!t||!e)return;m(null);let n=e.auth?.type||`none`;u(n),c(e.transport||(e.url?`http`:`stdio`)),o.resetFields();let r={name:e.name,display_name:e.display_name,description:e.description,transport:e.transport||(e.url?`http`:`stdio`),command:e.command,args:e.args?.join(`, `),url:e.url,scope:e.scope,enabled:e.enabled,env:e.env?JSON.stringify(e.env,null,2):void 0,headers:e.headers?JSON.stringify(e.headers,null,2):void 0,auth_type:n};n===`bearer`?r.auth_token=e.auth?.token:n===`jwt`?(r.jwt_api_url=e.auth?.api_url,r.jwt_api_token=e.auth?.api_token,r.jwt_api_secret=e.auth?.api_secret):n===`oauth`&&(r.oauth_authorization_url=e.auth?.oauth_authorization_url,r.oauth_token_url=e.auth?.oauth_token_url,r.oauth_client_id=e.auth?.oauth_client_id,r.oauth_client_secret=e.auth?.oauth_client_secret,r.oauth_scope=e.auth?.oauth_scope,r.oauth_grant_type=e.auth?.oauth_grant_type||`client_credentials`,r.oauth_mode=e.auth?.oauth_mode||`per_user`),o.setFieldsValue(r)},[t,e?.mcp_server_id,o]);let h=()=>{o.resetFields(),c(`stdio`),u(`none`),m(null),r()};return(0,W.jsx)(it,{title:`Edit MCP Server`,open:t,onOk:async()=>{if(!(!e||!n))try{await o.validateFields();let t=o.getFieldsValue(!0),r={display_name:t.display_name,description:t.description,scope:t.scope,enabled:t.enabled,transport:t.transport};t.transport===`stdio`?(r.command=t.command,r.args=t.args?.split(`,`).map(e=>e.trim())||[]):(r.url=t.url,r.headers=ks(t.headers));let a=Os(t.env);a&&(r.env=a),r.auth=Ds(t),await n.service(`mcp-servers`).patch(e.mcp_server_id,r),i(`MCP server updated successfully`),h()}catch(e){a(e instanceof Error?e.message:`Failed to update server`)}},onCancel:h,okText:`Save`,width:600,destroyOnHidden:!0,children:(0,W.jsx)(B,{form:o,layout:`vertical`,style:{marginTop:16},children:(0,W.jsx)(Ns,{mode:`edit`,transport:s,onTransportChange:c,authType:l,onAuthTypeChange:u,form:o,client:n,serverId:e?.mcp_server_id,onTestConnection:async()=>{if(!n||!e){a(`Client not available`);return}let t=o.getFieldsValue(!0);if(!t.url){a(`URL is required to test connection`);return}if(t.transport===`stdio`){a(`Connection test is not available for stdio transport`);return}try{await o.validateFields([`headers`])}catch{a(`Please fix custom HTTP headers before testing`);return}f(!0),m(null);try{let r=await n.service(`mcp-servers/discover`).create({mcp_server_id:e.mcp_server_id,url:t.url,transport:t.transport||`http`,auth:Ds(t),headers:ks(t.headers)});r.success&&r.capabilities?m({success:!0,toolCount:r.capabilities.tools,resourceCount:r.capabilities.resources,promptCount:r.capabilities.prompts,tools:r.tools,resources:r.resources,prompts:r.prompts}):m({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:r.error||`Connection test failed`})}catch(e){m({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:e instanceof Error?e.message:`Unknown error`})}finally{f(!1)}},testing:d,testResult:p})})})};function Fs(e){let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i}m ago`:a<24?`${a}h ago`:o<7?`${o}d ago`:o<30?`${Math.floor(o/7)}w ago`:o<365?`${Math.floor(o/30)}mo ago`:`${Math.floor(o/365)}y ago`}function Is(e){if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!Number.isNaN(t.getTime()))return Fs(t)}function Ls(e){let t=typeof e==`string`?new Date(e):e;return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`}function Rs(e,t){let n=Fs(e),r=Ls(e);return t===void 0?`${n}\n${r}`:`${n}\n${r}\nMessage index: ${t}`}var zs=({id:e,label:t,icon:n,color:r,copyLabel:i,metadataCard:a})=>{let{showSuccess:o,showError:s}=mn(),c=(0,W.jsx)(tr,{icon:(0,W.jsx)(n,{}),color:r,style:{margin:0,fontSize:10,cursor:`pointer`,fontFamily:`monospace`},onClick:a?void 0:async()=>{await cn(e)?o(`${i} copied: ${e}`):s(`Failed to copy to clipboard`)},children:t??nn(e)});return a?(0,W.jsx)(Ge,{content:a,title:null,trigger:`click`,placement:`left`,children:c}):c};function Bs(e){return e<50?`rgba(82, 196, 26, 0.12)`:e<80?`rgba(250, 173, 20, 0.12)`:`rgba(255, 77, 79, 0.12)`}function Vs(e){return Number.isFinite(e)?Math.max(0,Math.min(100,e)):0}function Hs(e,t,n){return n&&Number.isFinite(n.percentage)?Vs(n.percentage):!e||!t?0:Vs(e/t*100)}function Us(e,t,n){if(!n&&(!e||!t))return;let r=Hs(e,t,n);return`linear-gradient(to right, ${Bs(r)} ${r}%, transparent ${r}%)`}var Ws=`-dirty`;function Gs(e){return e?e.endsWith(Ws)?{cleanSha:e.slice(0,-6),isDirty:!0}:{cleanSha:e,isDirty:!1}:{cleanSha:``,isDirty:!1}}var Ks=({label:e,id:t})=>{let{token:n}=ce.useToken();return(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,padding:`2px 0`},children:[(0,W.jsx)(`span`,{style:{minWidth:84,flexShrink:0,color:n.colorTextSecondary,fontSize:`0.85em`},children:e}),(0,W.jsx)(s.Text,{copyable:{text:t,tooltips:[`Copy`,`Copied!`]},style:{fontFamily:n.fontFamilyCode,fontSize:`0.85em`,wordBreak:`break-all`},children:t})]})},qs=({session:e})=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Ks,{label:`Agor`,id:e.session_id}),e.sdk_session_id&&(0,W.jsx)(Ks,{label:e.agentic_tool||`SDK`,id:e.sdk_session_id})]}),Js=({session:e})=>(0,W.jsx)(Ge,{title:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(y,{style:{marginRight:8}}),`Session IDs`]}),content:(0,W.jsx)(`div`,{style:{width:400,maxWidth:`90vw`},children:(0,W.jsx)(qs,{session:e})}),trigger:`click`,placement:`topLeft`,children:(0,W.jsx)(o,{title:`Session IDs`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(y,{}),"aria-label":`Session IDs`})})});function Ys(e){if(e.includes(`sonnet`)){let t=e.match(/sonnet-(\d)-(\d)/);return t?`sonnet-${t[1]}.${t[2]}`:`sonnet`}if(e.includes(`haiku`)){let t=e.match(/haiku-(\d)-(\d)/);return t?`haiku-${t[1]}.${t[2]}`:`haiku`}if(e.includes(`opus`)){let t=e.match(/opus-(\d)-(\d)/);return t?`opus-${t[1]}.${t[2]}`:`opus`}return e}function Xs(e){return e?.trim().replace(/\.git$/,``).replace(/^\/+|\/+$/g,``).toLowerCase()||void 0}function Zs(e){try{return new URL(e).hostname.toLowerCase()}catch{return e.match(/^[^@]+@([^:]+):/)?.[1]?.toLowerCase()}}function Qs(e){if(!(!e||Zs(e)!==`github.com`))try{return Xs(Kt(e))}catch{return}}function $s(e){let t=e.pathname.split(`/`).filter(Boolean);if(!(e.hostname!==`github.com`||t.length<2))return Xs(`${t[0]}/${t[1]}`)}function ec(e){return Qs(e?.remote_url)}function tc(e,t={}){try{let n=new URL(e),r=n.pathname.split(`/`).filter(Boolean);if(n.hostname===`github.com`&&r.length>=4){let[e,i,a,o]=r,s=`${e}/${i}`;return(a===`issues`||a===`pull`)&&$s(n)===ec(t.currentRepo)?`#${o}`:`${s}#${o}`}if(n.hostname===`app.shortcut.com`&&r.length>=3)return`${r[1]}/${r[2]}`;if(n.hostname.includes(`atlassian.net`)||n.hostname.includes(`jira`))return r[r.length-1]||n.hostname;if(n.hostname===`linear.app`){let e=r.indexOf(`issue`);return e!==-1&&r[e+1]?r[e+1]:r[r.length-1]||n.hostname}return r[r.length-1]||n.hostname}catch{return e.split(`/`).pop()||`?`}}function nc(e){try{let{hostname:t}=new URL(e);return t===`github.com`||t.endsWith(`.github.com`)}catch{return!1}}var rc={branch:`cyan`,session:`default`,board:`blue`,assistant:`geekblue`,mcp:`purple`,user:`orange`,artifact:`gold`,repo:`default`},ic={message:`default`,tool:`default`,token:`default`,model:`default`,git:`default`,session:rc.session,success:`green`,error:`red`,warning:`orange`,processing:`cyan`,fork:`cyan`,spawn:`purple`,report:`green`,concept:`geekblue`,branch:rc.branch},ac=({icon:e,color:t=`default`,children:n,onClick:r,tooltip:i})=>{let{token:a}=ce.useToken(),o=(0,W.jsx)(tr,{icon:e,color:t,style:{cursor:r?`pointer`:`default`},onClick:r,children:(0,W.jsx)(`span`,{style:{fontFamily:a.fontFamilyCode,lineHeight:1},children:n})});return i?(0,W.jsx)(`span`,{title:i,children:o}):o},oc=({count:e,estimatedCost:t,inputTokens:n,outputTokens:r,cacheReadTokens:i,cacheCreationTokens:a,style:s})=>{let c=n!==void 0||r!==void 0?(0,W.jsxs)(`div`,{children:[n!==void 0&&(0,W.jsxs)(`div`,{children:[`Input: `,n.toLocaleString()]}),r!==void 0&&(0,W.jsxs)(`div`,{children:[`Output: `,r.toLocaleString()]}),i!==void 0&&i>0&&(0,W.jsxs)(`div`,{children:[`Cache Read: `,i.toLocaleString()]}),a!==void 0&&a>0&&(0,W.jsxs)(`div`,{children:[`Cache Creation: `,a.toLocaleString()]}),t!==void 0&&(0,W.jsxs)(`div`,{children:[`Est. Cost: $`,t.toFixed(4)]})]}):t===void 0?void 0:`Est. Cost: $${t.toFixed(4)}`,l=(0,W.jsx)(tr,{icon:(0,W.jsx)(lt,{}),color:ic.token,style:s,children:e.toLocaleString()});return c?(0,W.jsx)(o,{title:c,children:l}):l},sc=({used:e,limit:t,percentage:n,taskMetadata:r})=>{let{token:i}=ce.useToken(),a=[],o=r?.raw_sdk_response,s=r?.normalized_sdk_response,c=s?.contextUsageSnapshot??null;return c&&a.push({key:`sdk-context-usage`,label:`Context Window (SDK)`,children:(0,W.jsxs)(`div`,{style:{fontSize:`0.9em`,color:i.colorTextSecondary},children:[(0,W.jsxs)(`div`,{children:[`Used: `,(0,W.jsx)(`strong`,{children:c.totalTokens.toLocaleString()}),` tokens`]}),(0,W.jsxs)(`div`,{children:[`Limit: `,(0,W.jsx)(`strong`,{children:c.maxTokens.toLocaleString()}),` tokens`]}),(0,W.jsxs)(`div`,{children:[`Percentage: `,(0,W.jsxs)(`strong`,{children:[c.percentage,`%`]})]}),(0,W.jsx)(`div`,{style:{fontSize:`0.85em`,color:i.colorTextTertiary,marginTop:4},children:`Authoritative snapshot reported by the agent (Claude SDK getContextUsage() or Codex CLI token_count event).`})]})}),o&&typeof o==`object`&&o&&`modelUsage`in o&&o.modelUsage&&a.push({key:`per-model`,label:`Per-Model Usage`,children:(0,W.jsx)(`div`,{style:{fontSize:`0.9em`},children:Object.entries(o.modelUsage).map(([e,t])=>((t.inputTokens||0)+(t.outputTokens||0),(0,W.jsxs)(`div`,{style:{marginBottom:12},children:[(0,W.jsx)(`div`,{style:{fontWeight:500,marginBottom:4},children:e}),(0,W.jsxs)(`div`,{style:{marginLeft:12,fontSize:`0.95em`,color:i.colorTextSecondary},children:[(0,W.jsxs)(`div`,{children:[`Input: `,t.inputTokens?.toLocaleString()||0]}),(0,W.jsxs)(`div`,{children:[`Output: `,t.outputTokens?.toLocaleString()||0]}),t.cacheCreationInputTokens!==void 0&&t.cacheCreationInputTokens>0&&(0,W.jsxs)(`div`,{children:[`Cache creation: `,t.cacheCreationInputTokens.toLocaleString()]}),t.cacheReadInputTokens!==void 0&&t.cacheReadInputTokens>0&&(0,W.jsxs)(`div`,{children:[`Cache read: `,t.cacheReadInputTokens.toLocaleString()]}),(0,W.jsxs)(`div`,{style:{marginTop:4,fontWeight:500,color:i.colorText},children:[`Context limit: `,t.contextWindow?.toLocaleString()||0]})]})]},e)))})}),o&&a.push({key:`raw-sdk-response`,label:`🔍 Raw SDK Response`,children:(0,W.jsx)(`pre`,{style:{fontSize:`0.75em`,fontFamily:i.fontFamilyCode,background:i.colorBgContainer,padding:8,borderRadius:4,overflowX:`auto`,maxHeight:300,margin:0,border:`1px solid ${i.colorBorder}`},children:JSON.stringify(o,null,2)})}),(0,W.jsxs)(`div`,{style:{width:400,maxWidth:`90vw`},children:[(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(`div`,{style:{fontWeight:600,fontSize:`1.05em`,marginBottom:8},children:`Context Window Usage`}),(0,W.jsxs)(`div`,{style:{fontSize:`1.1em`,fontFamily:i.fontFamilyCode},children:[e.toLocaleString(),t>0?` / ${t.toLocaleString()}`:``,` `,t>0&&(0,W.jsxs)(`span`,{style:{color:i.colorTextSecondary},children:[`(`,n,`%)`]})]}),(0,W.jsx)(`div`,{style:{fontSize:`0.85em`,color:i.colorTextTertiary,marginTop:6},children:t>0?`Current context window snapshot`:`Current context window snapshot (limit unknown)`})]}),s&&(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(`div`,{style:{fontWeight:500,marginBottom:6},children:`Token Breakdown`}),(0,W.jsxs)(`div`,{style:{fontSize:`0.9em`,marginLeft:12,color:i.colorTextSecondary},children:[(0,W.jsxs)(`div`,{children:[`Input: `,s.tokenUsage.inputTokens.toLocaleString()]}),(0,W.jsxs)(`div`,{children:[`Output: `,s.tokenUsage.outputTokens.toLocaleString()]}),(s.tokenUsage.cacheCreationTokens??0)>0&&(0,W.jsxs)(`div`,{children:[`Cache creation: `,s.tokenUsage.cacheCreationTokens?.toLocaleString()]}),(s.tokenUsage.cacheReadTokens??0)>0&&(0,W.jsxs)(`div`,{children:[`Cache read: `,s.tokenUsage.cacheReadTokens?.toLocaleString()]}),(0,W.jsxs)(`div`,{style:{marginTop:4,fontWeight:500,color:i.colorText},children:[`Total: `,s.tokenUsage.totalTokens.toLocaleString()]})]})]}),(r?.model||r?.duration_ms!==void 0)&&(0,W.jsxs)(`div`,{style:{fontSize:`0.85em`,color:i.colorTextSecondary,paddingTop:12,borderTop:`1px solid ${i.colorBorderSecondary}`,marginBottom:16},children:[r?.model&&(0,W.jsxs)(`div`,{children:[`Model: `,(0,W.jsx)(`span`,{style:{fontFamily:i.fontFamilyCode},children:r.model})]}),r?.duration_ms!==void 0&&(0,W.jsxs)(`div`,{children:[`Duration: `,(r.duration_ms/1e3).toFixed(2),`s`]})]}),a.length>0&&(0,W.jsx)(ue,{size:`small`,ghost:!0,items:a,style:{fontSize:`0.9em`}})]})},cc=({used:e,limit:t,taskMetadata:n,style:r})=>{let i=n?.normalized_sdk_response?.contextUsageSnapshot,a=i?.totalTokens??e,o=i?.maxTokens??t,s=o>0,c=s?Math.round(Hs(a,o,i)):0,l=(0,W.jsx)(tr,{icon:(0,W.jsx)(te,{}),color:s?c<50?`green`:c<80?`orange`:`red`:`blue`,style:r,children:s?`${c}%`:`?`});return(0,W.jsx)(Ge,{content:(0,W.jsx)(sc,{used:a,limit:o,percentage:c,taskMetadata:n}),title:null,trigger:`hover`,placement:`top`,mouseEnterDelay:.3,children:l})},lc=({model:e,style:t})=>(0,W.jsx)(tr,{icon:(0,W.jsx)(m,{}),color:ic.model,style:t,children:Ys(e)}),uc=()=>(0,W.jsx)(`span`,{"aria-hidden":`true`,style:{display:`inline-flex`,flexShrink:0,marginLeft:6},children:(0,W.jsx)(h,{status:`warning`})}),dc=({branch:e,sha:t,branchName:n,showDirtyIndicator:r=!0,style:i})=>{let{token:a}=ce.useToken(),{cleanSha:s,isDirty:c}=Gs(t),l=s.substring(0,7),u=c&&r,d=e&&e!==n,f=u?`Git commit SHA (working tree has uncommitted changes) · click to copy`:`Git commit SHA · click to copy`,p=async e=>{e.stopPropagation(),await cn(s)};return(0,W.jsx)(o,{title:f,children:(0,W.jsxs)(tr,{icon:(0,W.jsx)(Ie,{}),color:ic.git,style:{...i,cursor:`pointer`},onClick:p,children:[d&&(0,W.jsxs)(`span`,{children:[e,` : `]}),(0,W.jsx)(`span`,{style:{fontFamily:a.fontFamilyCode},children:l}),u&&(0,W.jsx)(uc,{})]})})},fc=({status:e,style:t})=>{let n={completed:{icon:(0,W.jsx)(Re,{}),color:ic.success,text:`Completed`},failed:{icon:(0,W.jsx)(Ye,{}),color:ic.error,text:`Failed`},running:{icon:(0,W.jsx)(Ke,{}),color:ic.processing,text:`Running`},timed_out:{icon:(0,W.jsx)(qe,{}),color:ic.warning,text:`Timed Out`},idle:{icon:(0,W.jsx)(Ke,{}),color:ic.session,text:`Idle`},pending:{icon:(0,W.jsx)(Ke,{}),color:ic.session,text:`Pending`}}[e];return n?(0,W.jsx)(tr,{icon:n.icon,color:n.color,style:t,children:n.text}):(0,W.jsx)(tr,{icon:(0,W.jsx)(Ke,{}),color:ic.session,style:t,children:e})},pc=({fromSessionId:e,taskId:t,messageIndex:n,style:r})=>{let i=t=>{t.stopPropagation(),cn(e)};return(0,W.jsx)(o,{title:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{children:[`Forked from session `,nn(e)]}),n!==void 0&&(0,W.jsxs)(`div`,{children:[`Message index: `,n]}),(0,W.jsx)(`div`,{style:{marginTop:4,fontSize:`0.9em`,opacity:.8},children:`Click to copy session ID`})]}),children:(0,W.jsxs)(tr,{icon:(0,W.jsx)(Ie,{}),color:ic.fork,style:{...r,cursor:`pointer`},onClick:i,children:[`FORKED from `,nn(e),n!==void 0&&` as of message ${n}`]})})},mc=({fromSessionId:e,taskId:t,messageIndex:n,style:r})=>{let i=t=>{t.stopPropagation(),cn(e)};return(0,W.jsx)(o,{title:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{children:[`Spawned from session `,nn(e)]}),n!==void 0&&(0,W.jsxs)(`div`,{children:[`Message index: `,n]}),(0,W.jsx)(`div`,{style:{marginTop:4,fontSize:`0.9em`,opacity:.8},children:`Click to copy session ID`})]}),children:(0,W.jsxs)(tr,{icon:(0,W.jsx)(ft,{}),color:ic.spawn,style:{...r,cursor:`pointer`},onClick:i,children:[`SPAWNED from `,nn(e),n!==void 0&&` as of message ${n}`]})})},hc=({icon:e,color:t,label:n,emoji:r,compact:i=!1,title:a,onClick:o,maxWidth:s=220,code:c=!1,ariaLabel:l,"aria-label":u,style:d})=>{let{token:f}=ce.useToken(),p=n!=null&&n!==``,m=!!o,h=u??l;return(0,W.jsx)(tr,{icon:e,color:t,title:a,"aria-label":h,role:m?`button`:void 0,tabIndex:m?0:void 0,onKeyDown:e=>{!o||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),o(e))},style:{maxWidth:i?`100%`:void 0,marginInlineEnd:i?0:void 0,cursor:m?`pointer`:`default`,...d},onClick:o,children:p&&(0,W.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:r?4:void 0,maxWidth:i?s:void 0,overflow:i?`hidden`:void 0,textOverflow:i?`ellipsis`:void 0,whiteSpace:i?`nowrap`:void 0,verticalAlign:i?`bottom`:void 0,fontFamily:c?f.fontFamilyCode:f.fontFamily},children:[r&&(0,W.jsx)(`span`,{style:{fontFamily:f.fontFamily},children:r}),n]})})},gc=({branch:e,compact:t=!1,title:n,emoji:r,onClick:i,style:a})=>(0,W.jsx)(hc,{icon:(0,W.jsx)(ft,{}),color:rc.branch,label:e,emoji:r,compact:t,title:n,onClick:i,code:!0,style:a}),_c=({board:e,compact:t=!1,title:n,onClick:r,style:i})=>(0,W.jsx)(hc,{icon:(0,W.jsx)(me,{}),color:rc.board,label:e.name,emoji:e.icon,compact:t,title:n??e.name,onClick:r,style:i}),vc=({user:e,compact:t=!1,title:n,onClick:r,style:i})=>{let a=e.name||e.email||`Someone`;return(0,W.jsx)(hc,{icon:(0,W.jsx)(Be,{}),color:rc.user,label:a,emoji:e.emoji,compact:t,title:n??a,onClick:r,maxWidth:180,style:i})},yc=({name:e,emoji:t,compact:n=!1,title:r,onClick:i,style:a})=>(0,W.jsx)(hc,{icon:(0,W.jsx)(m,{}),color:rc.assistant,label:e,emoji:t,compact:n,title:r??e,onClick:i,code:!0,style:a}),bc=({label:e,compact:t=!1,title:n,ariaLabel:r,"aria-label":i,onClick:a,style:o})=>(0,W.jsx)(hc,{icon:(0,W.jsx)($e,{}),color:rc.session,label:e,compact:t,title:n,ariaLabel:i??r,onClick:a,style:o}),xc=({namespace:e,style:t})=>(0,W.jsx)(hc,{color:`default`,label:e,compact:!0,title:e,style:t}),Sc=({repoName:e,branchName:t,onClick:n,color:r=`cyan`,size:i,style:a})=>{let{token:o}=ce.useToken();return(0,W.jsx)(tr,{icon:(0,W.jsx)(ft,{}),color:r,style:{...a,cursor:n?`pointer`:`default`},onClick:n,children:(0,W.jsxs)(`span`,{style:{fontFamily:o.fontFamilyCode},children:[e,t&&(0,W.jsxs)(W.Fragment,{children:[` `,(0,W.jsx)(me,{style:{fontSize:`0.85em`,opacity:.7}}),` `,t]})]})})};function Cc(e){return nc(e)?(0,W.jsx)(De,{}):(0,W.jsx)(ve,{})}function wc(e){return nc(e)?(0,W.jsx)(De,{}):(0,W.jsx)(ft,{})}var Tc={maxWidth:160,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`inline-block`,verticalAlign:`middle`},Ec=({issueUrl:e,issueNumber:t,currentRepo:n,style:r})=>{let i=t||tc(e,{currentRepo:n});return(0,W.jsx)(o,{title:e,children:(0,W.jsx)(tr,{icon:Cc(e),color:ic.git,style:{...r,cursor:`pointer`,maxWidth:220},onClick:()=>window.open(e,`_blank`),children:(0,W.jsxs)(`span`,{style:Tc,children:[`Issue: `,i]})})})},Dc=({prUrl:e,prNumber:t,currentRepo:n,style:r})=>{let i=t||tc(e,{currentRepo:n});return(0,W.jsx)(o,{title:e,children:(0,W.jsx)(tr,{icon:wc(e),color:ic.git,style:{...r,cursor:`pointer`,maxWidth:220},onClick:()=>window.open(e,`_blank`),children:(0,W.jsxs)(`span`,{style:Tc,children:[`PR: `,i]})})})},Oc=({scheduledRunAt:e,style:t})=>{let n=new Date(e),r=n.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),i=`Scheduled run at ${n.toLocaleString(`en-US`,{dateStyle:`medium`,timeStyle:`medium`})}\nRun ID: ${e}`;return(0,W.jsx)(ac,{icon:(0,W.jsx)(qe,{}),color:ic.processing,tooltip:i,children:r})},kc=({channelType:e,channelName:t,style:n})=>(0,W.jsx)(tr,{icon:(()=>{switch((e||``).toLowerCase()){case`slack`:return(0,W.jsx)(_t,{});case`discord`:return(0,W.jsx)(T,{});default:return(0,W.jsx)(T,{})}})(),color:ic.success,style:n,children:t});function Ac(e,t={}){let{fallbackChars:n=200,includeAgentFallback:r=!1,includeIdFallback:i=!1}=t;return e.title?e.title:e.description?e.description.length>n?`${e.description.substring(0,n)}...`:e.description:r?e.agentic_tool:i?`Session ${nn(e.session_id)}`:`Untitled Session`}function jc(e=2,t=1.5){return{display:`-webkit-box`,WebkitLineClamp:e,WebkitBoxOrient:`vertical`,overflow:`hidden`,textOverflow:`ellipsis`,maxHeight:`${e*t}em`,lineHeight:t}}var Mc={small:12,default:14,large:18},Nc=({user:e,showName:t=!0,size:n=`default`})=>{let r=Mc[n],{token:i}=ce.useToken();return(0,W.jsx)(o,{title:`${e.name||e.email} (${e.role})`,children:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(`span`,{style:{fontSize:r},children:e.emoji||`👤`}),t&&(0,W.jsx)(`span`,{style:{backgroundColor:i.colorBgTextHover,borderRadius:`3px`,padding:`0 2px`,fontWeight:600},children:e.name||e.email.split(`@`)[0]})]})})},Pc=({createdBy:e,currentUserId:t,userById:n,prefix:r=`Created by`})=>{if(e===t)return null;let i=n.get(e);return!i||e===`anonymous`?(0,W.jsx)(tr,{color:`default`,style:{fontSize:11},children:e===`anonymous`?`Anonymous`:`Unknown User`}):(0,W.jsx)(tr,{color:`blue`,style:{fontSize:11},children:(0,W.jsx)(Nc,{user:i,showName:!0,size:`small`})})},{Text:Fc}=s,Ic=({session:e,branch:t,repo:n,userById:r=new Map,currentUserId:i,compact:a=!0})=>{let{token:o}=ce.useToken();return(0,W.jsxs)(`div`,{style:{width:400,maxWidth:`90vw`},children:[(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,W.jsx)(dr,{tool:e.agentic_tool,size:24}),(0,W.jsx)(`div`,{style:{flex:1,minWidth:0},children:(0,W.jsx)(Fc,{strong:!0,style:{fontSize:`1.05em`,display:`block`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:Ac(e,{fallbackChars:60,includeAgentFallback:!0})})})]}),(0,W.jsx)(`div`,{style:{marginBottom:8},children:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(Fc,{type:`secondary`,style:{fontSize:`0.85em`},children:`Status:`}),(0,W.jsx)(fc,{status:e.status})]})})]}),(0,W.jsx)(`div`,{style:{marginBottom:12,paddingTop:12,borderTop:`1px solid ${o.colorBorderSecondary}`},children:(0,W.jsx)(qs,{session:e})}),(e.genealogy.forked_from_session_id||e.genealogy.parent_session_id)&&(0,W.jsxs)(`div`,{style:{marginBottom:12},children:[(0,W.jsx)(`div`,{style:{fontWeight:600,fontSize:`0.85em`,marginBottom:8},children:`Genealogy`}),(0,W.jsxs)(z,{size:4,children:[e.genealogy.forked_from_session_id&&(0,W.jsx)(pc,{fromSessionId:e.genealogy.forked_from_session_id}),e.genealogy.parent_session_id&&(0,W.jsx)(mc,{fromSessionId:e.genealogy.parent_session_id})]})]}),t&&n&&(0,W.jsxs)(`div`,{style:{marginBottom:12},children:[(0,W.jsx)(`div`,{style:{fontWeight:600,fontSize:`0.85em`,marginBottom:8},children:`Branch`}),(0,W.jsxs)(z,{size:4,wrap:!0,children:[(0,W.jsx)(Sc,{repoName:n.slug}),(0,W.jsx)(tr,{icon:(0,W.jsx)(de,{}),color:ic.branch,children:(0,W.jsx)(`span`,{style:{fontFamily:o.fontFamilyCode},children:t.name})})]})]}),(0,W.jsxs)(`div`,{style:{fontSize:`0.85em`,color:o.colorTextSecondary,paddingTop:12,borderTop:`1px solid ${o.colorBorderSecondary}`},children:[e.created_by&&(0,W.jsx)(`div`,{style:{marginBottom:4},children:(0,W.jsx)(Pc,{createdBy:e.created_by,currentUserId:i,userById:r,prefix:`Created by`})}),(0,W.jsxs)(`div`,{style:{marginBottom:4},children:[(0,W.jsx)(Fc,{type:`secondary`,children:`Created: `}),new Date(e.created_at).toLocaleString()]}),(0,W.jsxs)(`div`,{style:{marginBottom:4},children:[(0,W.jsx)(Fc,{type:`secondary`,children:`Agent: `}),e.agentic_tool]}),e.permission_config?.mode&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Fc,{type:`secondary`,children:`Permission mode: `}),e.permission_config.mode]})]})]})},Lc=[Bt.RUNNING,Bt.STOPPING,Bt.AWAITING_PERMISSION,Bt.AWAITING_INPUT],Rc={[Bt.RUNNING]:{icon:(0,W.jsx)(k,{}),color:ic.processing},[Bt.STOPPING]:{icon:(0,W.jsx)(F,{}),color:ic.warning},[Bt.AWAITING_PERMISSION]:{icon:(0,W.jsx)(F,{}),color:ic.warning},[Bt.AWAITING_INPUT]:{icon:(0,W.jsx)(Ze,{}),color:ic.processing},[Bt.COMPLETED]:{icon:(0,W.jsx)(Re,{}),color:ic.success},[Bt.FAILED]:{icon:(0,W.jsx)(Ye,{}),color:ic.error},[Bt.STOPPED]:{icon:(0,W.jsx)(Je,{}),color:ic.warning},[zt.IDLE]:{icon:(0,W.jsx)(k,{}),color:ic.session},[Bt.TIMED_OUT]:{icon:(0,W.jsx)(qe,{}),color:ic.warning},[Bt.CREATED]:{icon:(0,W.jsx)(k,{}),color:ic.session,label:`00:00`},[Bt.QUEUED]:{icon:(0,W.jsx)(qe,{}),color:ic.session,label:`Queued`},pending:{icon:(0,W.jsx)(k,{}),color:ic.session}};function zc(e){if(!e)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e.getTime();if(typeof e==`number`)return Number.isFinite(e)?e:null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Bc(e){if(!Number.isFinite(e)||e<=0)return`00:00`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=n.toString().padStart(2,`0`),o=r.toString().padStart(2,`0`),s=i.toString().padStart(2,`0`);return n>0?`${a}:${o}:${s}`:`${o}:${s}`}var Vc=({status:e,startedAt:t,endedAt:n,durationMs:r,lastExecutorHeartbeatAt:i,style:a})=>{let{token:o}=ce.useToken(),s=(0,U.useMemo)(()=>zc(t),[t]),c=(0,U.useMemo)(()=>zc(n),[n]),l=(0,U.useMemo)(()=>zc(i??void 0),[i]),u=(0,U.useMemo)(()=>typeof r==`number`&&r>=0?r:s&&c&&c>=s?c-s:null,[r,s,c]),[d,f]=(0,U.useState)(()=>u===null?s?Math.max(0,Date.now()-s):0:u);(0,U.useEffect)(()=>{if(u!==null){f(u);return}if(!s){f(0);return}f(Math.max(0,Date.now()-s))},[u,s]),(0,U.useEffect)(()=>{if(!s||!Lc.includes(e))return;let t=window.setInterval(()=>{f(Math.max(0,Date.now()-s))},1e3);return()=>window.clearInterval(t)},[s,e]);let p=Lc.includes(e),m=(0,U.useMemo)(()=>{let e={color:o.colorTextSecondary,minWidth:60},t={fontFamily:o.fontFamilyCode,color:o.colorText},n={display:`flex`,gap:8,alignItems:`baseline`},r=l?Math.max(0,Date.now()-l):null;return(0,W.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,fontSize:12},children:[s&&(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Started`}),(0,W.jsx)(`span`,{style:t,children:Ls(new Date(s))})]}),(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Ended`}),(0,W.jsx)(`span`,{style:t,children:p?`In progress...`:c?Ls(new Date(c)):`—`})]}),(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Duration`}),(0,W.jsx)(`span`,{style:t,children:Bc(d)})]}),l&&(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Heartbeat`}),(0,W.jsxs)(`span`,{style:t,children:[(0,W.jsx)(Te,{style:{marginRight:4}}),r===null?`—`:`${Bc(r)} ago`,(0,W.jsx)(`span`,{style:{color:o.colorTextSecondary,marginLeft:6},children:Ls(new Date(l))})]})]})]})},[s,c,p,d,l,o]);if(!s&&u===null)return null;let h=Rc[e]||Rc.pending,g=h.label??Bc(d);return(0,W.jsx)(Ge,{content:m,placement:`bottom`,children:(0,W.jsx)(tr,{icon:h.icon,color:h.color,style:a,children:(0,W.jsx)(`span`,{style:{fontFamily:o.fontFamilyCode,lineHeight:1},children:g})})})};function Hc(e){let t=e-Date.now(),n=Math.floor(Math.abs(t)/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24),o=n<60?`${n}s`:r<60?`${r}m`:i<24?`${i}h`:`${a}d`;return t>=0?{verb:`Expires`,phrase:`in ${o}`}:{verb:`Expired`,phrase:`${o} ago`}}function Uc(e){switch(e){case`missing_token_endpoint`:return`missing OAuth token endpoint — re-authenticate, or ask an admin to save the token URL in this MCP server’s OAuth settings`;case`missing_client_id`:return`missing OAuth client ID for this grant — re-authenticate, or ask an admin to check the MCP server OAuth settings`;case`needs_reauth`:return`refresh token is no longer valid — sign in again`;case`token_refresh_failed`:return`provider token refresh failed — try again, or sign in again if it keeps failing`;default:return e||`unknown error`}}var Wc=({server:e,needsAuth:t,client:n})=>{let{showSuccess:r,showInfo:i,showWarning:a,showError:s}=mn(),{isAdmin:c}=Ho(),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(void 0),h=e.auth?.type===`oauth`,g=p??e.auth?.oauth_token_expires_at,_=async()=>{if(n)try{let t=await n.service(`mcp-servers/oauth-start`).create({mcp_url:e.url,mcp_server_id:e.mcp_server_id,client_id:e.auth?.oauth_client_id});if(t.success&&t.authorizationUrl){if(window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`),i(`Complete sign-in in the new tab.`),t.state){let i=a=>{a.state===t.state&&a.success&&(r(`${e.display_name||e.name} authenticated!`),n.io.off(`oauth:completed`,i))};n.io.on(`oauth:completed`,i),setTimeout(()=>n.io.off(`oauth:completed`,i),300*1e3)}}else t.success||s(t.error||`Failed to start OAuth flow`)}catch(e){s(`OAuth error: ${e instanceof Error?e.message:String(e)}`)}},v=async()=>{if(!(!n||l)){u(!0);try{let t=await n.service(`mcp-servers/oauth-refresh`).create({mcp_server_id:e.mcp_server_id});t.success?(m(t.expires_at),r(t.expires_at?`${e.display_name||e.name} refreshed — expires ${Hc(t.expires_at).phrase}`:`${e.display_name||e.name} refreshed`)):t.error===`needs_reauth`||t.error===`missing_client_id`?(a(Uc(t.error)),await _()):s(`Refresh failed: ${Uc(t.error)}`)}catch(e){s(`Refresh error: ${e instanceof Error?e.message:String(e)}`)}finally{u(!1)}}},y;if(!h)y=`${e.transport.toUpperCase()} MCP server`;else if(g){let e=new Date(g),{verb:t,phrase:n}=Hc(g);y=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{children:[t,` `,n]}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12},children:Ls(e)}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12,marginTop:4},children:`Click to refresh now`})]})}else y=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{children:`Expires in: unknown`}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12},children:`Provider returned no expiry. Token is used until it stops working.`}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12,marginTop:4},children:`Click to refresh now`})]});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o,{title:t?`Click to authenticate`:y,children:(0,W.jsxs)(tr,{color:t?`orange`:rc.mcp,icon:t?(0,W.jsx)(yt,{}):l?(0,W.jsx)(x,{spin:!0}):(0,W.jsx)(mt,{}),style:{cursor:l?`wait`:h?`pointer`:`default`},onClick:t?_:h?v:void 0,children:[e.display_name||e.name,c&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Edit MCP server`,title:`Edit MCP server`,onClick:e=>{e.stopPropagation(),f(!0)},style:{marginLeft:8,padding:0,background:`transparent`,border:`none`,color:`inherit`,fontSize:11,lineHeight:1,opacity:.55,cursor:`pointer`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.55`},onFocus:e=>{e.currentTarget.style.opacity=`1`},onBlur:e=>{e.currentTarget.style.opacity=`0.55`},children:(0,W.jsx)(ne,{})})]})}),c&&(0,W.jsx)(Ps,{server:e,open:d,client:n,onClose:()=>f(!1)})]})},Gc=({mcpServerById:e,client:t,onCreate:n,onDelete:r})=>{let{showError:i}=mn(),[a,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(null),[m,g]=(0,U.useState)(null),[_]=B.useForm(),[y,b]=(0,U.useState)(`stdio`),[x,S]=(0,U.useState)(`none`),[C,w]=(0,U.useState)(!1),[T,E]=(0,U.useState)(!1),[O,k]=(0,U.useState)(null),[A,j]=(0,U.useState)(``);(0,U.useEffect)(()=>{if(f&&e.has(f.mcp_server_id)){let t=e.get(f.mcp_server_id);t&&t!==f&&p(t)}},[e,f]);let M=e=>{let t={name:e.name,display_name:e.display_name,description:e.description,transport:e.transport,scope:e.scope||`global`,enabled:e.enabled??!0,source:`user`};if(e.transport===`stdio`)t.command=e.command,t.args=e.args?.split(`,`).map(e=>e.trim())||[];else{t.url=e.url;let n=ks(e.headers);n&&(t.headers=n)}let n=Ds(e);n&&(t.auth=n);let r=Os(e.env);return r&&(t.env=r),t},N=async()=>{if(!t)return null;try{await _.validateFields();let e=M(_.getFieldsValue(!0)),n=await t.service(`mcp-servers`).create(e);return E(!0),n.mcp_server_id||null}catch{return null}},te=()=>{_.resetFields(),o(!1),b(`stdio`),S(`none`),k(null),E(!1)},P=()=>{if(T){te();return}_.validateFields().then(()=>{let e=M(_.getFieldsValue(!0));n?.(e),te()}).catch(e=>{if(console.error(`Form validation failed:`,e),e.errorFields&&e.errorFields.length>0){let t=e.errorFields[0];i(t.errors[0]||`Please fill in required fields`)}})},re=async()=>{if(!t){i(`Client not available`);return}let e=_.getFieldsValue(!0);if(!e.url){i(`URL is required to test connection`);return}if(e.transport===`stdio`){i(`Connection test is not available for stdio transport`);return}try{await _.validateFields([`headers`])}catch{i(`Please fix custom HTTP headers before testing`);return}w(!0),k(null);try{let n=await t.service(`mcp-servers/discover`).create({url:e.url,transport:e.transport||`http`,auth:Ds(e),headers:ks(e.headers)});n.success&&n.capabilities?k({success:!0,toolCount:n.capabilities.tools,resourceCount:n.capabilities.resources,promptCount:n.capabilities.prompts,tools:n.tools,resources:n.resources,prompts:n.prompts}):k({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:n.error||`Connection test failed`})}catch(e){k({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:e instanceof Error?e.message:`Unknown error`})}finally{w(!1)}},ae=e=>{p(e),l(!0)},oe=()=>{l(!1),p(null)},F=e=>{g(e),d(!0)},se=e=>{r?.(e)},ce=e=>{let t=e.tools?.length||0;return(e.transport||(e.url?`http`:`stdio`))===`stdio`?{status:`default`,text:`Local process`,color:`#8c8c8c`}:t>0?{status:`success`,text:`${t} tools`,color:`#52c41a`}:{status:`default`,text:`Not tested`,color:`#8c8c8c`}},ue=[{title:`Name`,dataIndex:`name`,key:`name`,width:180,render:(e,t)=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:(0,W.jsx)(vs,{text:t.display_name||t.name,query:A})}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:(0,W.jsx)(vs,{text:t.name,query:A})})]})},{title:`Transport`,dataIndex:`transport`,key:`transport`,width:100,render:e=>(0,W.jsx)(v,{color:e===`stdio`?`blue`:`green`,children:e.toUpperCase()})},{title:`Scope`,dataIndex:`scope`,key:`scope`,width:100,render:e=>(0,W.jsx)(v,{color:{global:`purple`,repo:`cyan`,session:`magenta`}[e],children:e})},{title:`Status`,dataIndex:`enabled`,key:`enabled`,width:80,render:e=>e?(0,W.jsx)(h,{status:`success`,text:`Enabled`}):(0,W.jsx)(h,{status:`default`,text:`Disabled`})},{title:`Health`,key:`health`,width:120,render:(e,t)=>{let n=ce(t);return(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,W.jsx)(h,{status:n.status}),(0,W.jsx)(s.Text,{style:{fontSize:12,color:n.color},children:n.text})]})}},{title:`Source`,dataIndex:`source`,key:`source`,width:100,render:e=>(0,W.jsx)(s.Text,{type:`secondary`,children:(0,W.jsx)(vs,{text:e,query:A})})},{title:`Actions`,key:`actions`,width:140,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(le,{}),onClick:()=>F(t),title:`View details`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>ae(t),title:`Edit`}),(0,W.jsx)(ee,{title:`Delete MCP server?`,description:`Are you sure you want to delete "${t.display_name||t.name}"?`,onConfirm:()=>se(t.mcp_server_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0,title:`Delete`})})]})}],de=(0,U.useMemo)(()=>hs(ds(e,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),A,[e=>e.name,e=>e.display_name,e=>e.description,e=>e.transport,e=>e.scope,e=>e.source,e=>e.url,e=>e.command,e=>e.args,e=>e.enabled,e=>e.tools?.flatMap(e=>[e.name,e.description])]),[e,A]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Configure Model Context Protocol servers for enhanced AI capabilities.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, URL, command, tools, transport, or scope`,value:A,onChange:e=>j(e.target.value),style:{width:360}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>o(!0),children:`New MCP Server`})]})]}),(0,W.jsx)(D,{dataSource:de,columns:ue,rowKey:`mcp_server_id`,pagination:{pageSize:10,showSizeChanger:!0},size:`small`}),(0,W.jsx)(it,{title:`Add MCP Server`,open:a,onOk:P,onCancel:te,okText:T?`Done`:`Create`,width:600,children:(0,W.jsx)(B,{form:_,layout:`vertical`,style:{marginTop:16},children:(0,W.jsx)(Ns,{mode:`create`,transport:y,onTransportChange:b,authType:x,onAuthTypeChange:S,form:_,client:t,onTestConnection:re,testing:C,testResult:O,onSaveFirst:N})})}),(0,W.jsx)(Ps,{server:f,open:c,client:t,onClose:oe}),(0,W.jsx)(it,{title:`MCP Server Details`,open:u,onCancel:()=>{d(!1),g(null)},footer:[(0,W.jsx)(V,{onClick:()=>d(!1),children:`Close`},`close`)],width:700,children:m&&(0,W.jsxs)(R,{bordered:!0,column:1,size:`small`,style:{marginTop:16},children:[(0,W.jsx)(R.Item,{label:`ID`,children:nn(m.mcp_server_id)}),(0,W.jsx)(R.Item,{label:`Name`,children:m.name}),m.display_name&&(0,W.jsx)(R.Item,{label:`Display Name`,children:m.display_name}),m.description&&(0,W.jsx)(R.Item,{label:`Description`,children:m.description}),(0,W.jsx)(R.Item,{label:`Transport`,children:(0,W.jsx)(v,{color:m.transport===`stdio`?`blue`:`green`,children:m.transport.toUpperCase()})}),(0,W.jsx)(R.Item,{label:`Scope`,children:(0,W.jsx)(v,{children:m.scope})}),(0,W.jsx)(R.Item,{label:`Source`,children:m.source}),(0,W.jsx)(R.Item,{label:`Status`,children:m.enabled?(0,W.jsx)(h,{status:`success`,text:`Enabled`}):(0,W.jsx)(h,{status:`default`,text:`Disabled`})}),m.command&&(0,W.jsx)(R.Item,{label:`Command`,children:m.command}),m.args&&m.args.length>0&&(0,W.jsx)(R.Item,{label:`Arguments`,children:m.args.join(`, `)}),m.url&&(0,W.jsx)(R.Item,{label:`URL`,children:m.url}),m.headers&&Object.keys(m.headers).length>0&&(0,W.jsx)(R.Item,{label:`Custom HTTP Headers`,children:(0,W.jsx)(`pre`,{style:{margin:0,fontSize:12},children:JSON.stringify(m.headers,null,2)})}),m.env&&Object.keys(m.env).length>0&&(0,W.jsx)(R.Item,{label:`Environment Variables`,children:(0,W.jsx)(`pre`,{style:{margin:0,fontSize:12},children:JSON.stringify(m.env,null,2)})}),m.tools&&m.tools.length>0&&(0,W.jsxs)(R.Item,{label:`Tools`,children:[m.tools.length,` tools`]}),m.resources&&m.resources.length>0&&(0,W.jsxs)(R.Item,{label:`Resources`,children:[m.resources.length,` resources`]}),m.prompts&&m.prompts.length>0&&(0,W.jsxs)(R.Item,{label:`Prompts`,children:[m.prompts.length,` prompts`]}),(0,W.jsx)(R.Item,{label:`Created`,children:new Date(m.created_at).toLocaleString()}),m.updated_at&&(0,W.jsx)(R.Item,{label:`Updated`,children:new Date(m.updated_at).toLocaleString()})]})})]})},Kc=({branch:e,canEdit:t,state:n,setField:r})=>{let i=Xt(e);return i?(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsxs)(z,{children:[i.emoji?(0,W.jsx)(`span`,{style:{fontSize:20},children:i.emoji}):(0,W.jsx)(m,{style:{fontSize:20}}),(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:16},children:`Assistant Configuration`})]}),(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,children:[(0,W.jsx)(B.Item,{label:`Display Name`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(L,{value:n.displayName,onChange:e=>r(`displayName`,e.target.value),placeholder:`Assistant display name`,disabled:!t})}),(0,W.jsx)(B.Item,{label:`Icon`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(Ji,{value:n.emoji,onChange:e=>r(`emoji`,e),defaultEmoji:`🤖`,disabled:!t})}),(0,W.jsx)(B.Item,{label:`Description`,labelCol:{span:6},wrapperCol:{span:18},tooltip:`What does this assistant do? Visible to other agents via MCP.`,children:(0,W.jsx)(L.TextArea,{value:n.description,onChange:e=>r(`description`,e.target.value),placeholder:`What does this assistant do?`,rows:2,disabled:!t})})]}),(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[i.frameworkRepo&&(0,W.jsx)(R.Item,{label:`Framework Repo`,children:(0,W.jsx)(s.Text,{code:!0,children:i.frameworkRepo})}),i.frameworkVersion&&(0,W.jsx)(R.Item,{label:`Framework Version`,children:(0,W.jsx)(s.Text,{code:!0,children:i.frameworkVersion})}),(0,W.jsx)(R.Item,{label:`Created via`,children:i.createdViaOnboarding?(0,W.jsx)(tr,{color:`blue`,children:`Onboarding Wizard`}):(0,W.jsx)(tr,{children:`Manual`})})]})]})}):null},qc=[`start`,`stop`,`nuke`,`logs`],Jc=/^https?:\/\//i;function Yc(e){return Jc.test(e.trim())}function Xc(e,t){return e===t||e.endsWith(`.${t}`)}function Zc(e){let t=e.split(`.`);if(t.length!==4)return!1;let n=t.map(e=>Number(e));if(n.some(e=>!Number.isInteger(e)||e<0||e>255))return!1;let[r,i]=n;return r===0||r===10||r===127||r===169&&i===254||r===172&&i>=16&&i<=31||r===192&&i===168||r>=224}function Qc(e){let t=e.replace(/^\[|\]$/g,``).toLowerCase();if(!t.includes(`:`))return!1;let n=t.match(/:ffff:(\d+\.\d+\.\d+\.\d+)$/);if(n)return Zc(n[1]);let r=t.split(`:`).filter(Boolean),i=r.lastIndexOf(`ffff`);if(i>=0&&r.length-i===3){let e=Number.parseInt(r[i+1],16),t=Number.parseInt(r[i+2],16);if(Number.isInteger(e)&&Number.isInteger(t)&&e>=0&&e<=65535&&t>=0&&t<=65535)return Zc(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}let a=Number.parseInt(r[0]??``,16);return t===`::1`||t===`::`||Number.isInteger(a)&&a>=65152&&a<=65215||Number.isInteger(a)&&a>=64512&&a<=65023}function $c(e){let t;try{t=jt(e,`managed environment webhook`)}catch{return!1}if(!t)return!1;let n=new URL(t),r=n.hostname.toLowerCase();return!(n.username||n.password||r===`localhost`||Xc(r,`localhost`)||r===`metadata.google.internal`||Xc(r,`internal`)||r.endsWith(`.local`)||Zc(r)||Qc(r))}function el(e,t=`environment webhook`){let n=jt(e,t);if(!n)throw Error(`${t} must be a valid http(s) URL`);let r=new URL(n);if(r.username||r.password)throw Error(`${t} must not include URL credentials`);if(!$c(n))throw Error(`${t} is blocked by Agor's managed-environment webhook policy`);return n}function tl(e,t,n=`managed environment`){for(let r of qc){let i=e[r];if(i?.trim()){if(Yc(i)){el(i,`${n} ${r} webhook`);continue}if(t===`webhook-only`)throw Error(`${n} ${r} must render to an http(s) URL webhook on this Agor instance`)}}}function nl(e,t,n=`repo environment`){for(let r of Object.keys(e.variants)){let i=sn(e,r);if(!i)continue;let a={start:i.start,stop:i.stop,nuke:i.nuke,logs:i.logs};for(let e of qc){let i=a[e];i?.includes(`{{`)||tl({[e]:i},t,`${n} variant "${r}"`)}}}function rl(e){if(!e)return`stopped`;if(e.status===`running`){let t=e.last_health_check?.status;return t===`healthy`?`healthy`:t===`unhealthy`?`unhealthy`:`running`}return e.status}function il(e){switch(e){case`stopped`:return`Stopped`;case`starting`:return`Starting...`;case`healthy`:return`Healthy`;case`unhealthy`:return`Unhealthy`;case`running`:return`Running`;case`stopping`:return`Stopping...`;case`error`:return`Error`;default:return`Unknown`}}var al=({value:e,onChange:t,readOnly:n=!1,placeholder:r,rows:i=14,height:a,minHeight:o,maxHeight:s})=>(0,W.jsx)(`textarea`,{value:e,onChange:e=>t?.(e.target.value),readOnly:n,placeholder:r,rows:i,style:{width:`100%`,boxSizing:`border-box`,fontFamily:`monospace`,fontSize:12,height:a,minHeight:o??`${i*20}px`,maxHeight:s,padding:8,margin:0,border:`1px solid var(--ant-color-border, #424242)`,borderRadius:6,background:`var(--ant-color-fill-alter, transparent)`,color:`var(--ant-color-text)`,overflow:`auto`,resize:s?`none`:`vertical`}}),ol=(0,U.lazy)(async()=>{try{return await H(()=>import(`./CodeEditor.inner-D51Z_CLQ.js`),__vite__mapDeps([0,1,2,3,4]))}catch(e){return console.error(`Failed to load CodeMirror editor; falling back to plain text editor.`,e),{default:al}}}),sl=e=>(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(al,{...e,readOnly:!0}),children:(0,W.jsx)(ol,{...e})}),cl=n(((e,t)=>{t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/})),ll=n(((e,t)=>{t.exports=/[\0-\x1F\x7F-\x9F]/})),ul=n(((e,t)=>{t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/})),dl=n(((e,t)=>{t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/})),fl=n(((e,t)=>{t.exports=function(e){var t={};t.src_Any=cl().source,t.src_Cc=ll().source,t.src_Z=ul().source,t.src_P=dl().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);var n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!-|_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|`+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]).|`+(e&&e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`).|;(?!`+t.src_ZCc+`).|\\!+(?!`+t.src_ZCc+`|[!]).|\\?(?!`+t.src_ZCc+`|[?]).)+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}})),pl=n(((e,t)=>{function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function r(e){return Object.prototype.toString.call(e)}function i(e){return r(e)===`[object String]`}function a(e){return r(e)===`[object Object]`}function o(e){return r(e)===`[object RegExp]`}function s(e){return r(e)===`[object Function]`}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var l={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function u(e){return Object.keys(e||{}).reduce(function(e,t){return e||l.hasOwnProperty(t)},!1)}var d={"http:":{validate:function(e,t,n){var r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){var r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,p=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function m(e){e.__index__=-1,e.__text_cache__=``}function h(e){return function(t,n){var r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function g(){return function(e,t){t.normalize(e)}}function _(e){var t=e.re=fl()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);var l=[];e.__compiled__={};function u(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){var n=e.__schemas__[t];if(n!==null){var r={validate:null,link:null};if(e.__compiled__[t]=r,a(n)){o(n.validate)?r.validate=h(n.validate):s(n.validate)?r.validate=n.validate:u(t,n),s(n.normalize)?r.normalize=n.normalize:n.normalize?u(t,n):r.normalize=g();return}if(i(n)){l.push(t);return}u(t,n)}}),l.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:g()};var d=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`ig`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),m(e)}function v(e,t){var n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function y(e,t){var n=new v(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function b(e,t){if(!(this instanceof b))return new b(e,t);t||u(e)&&(t=e,e={}),this.__opts__=n({},l,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=n({},d,e),this.__compiled__={},this.__tlds__=p,this.__tlds_replaced__=!1,this.re={},_(this)}b.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},b.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},b.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},b.prototype.pretest=function(e){return this.re.pretest.test(e)},b.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},b.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(y(this,t)),t=this.__last_index__);for(var r=t?e.slice(t):e;this.test(r);)n.push(y(this,t)),r=r.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},b.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},b.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},b.prototype.onCompile=function(){},t.exports=b})),ml=e(n((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=h;var a=i(Dn()),o=En(),s=i(pl()),c=r(Ce());function l(e,t=!1){return e=(0,o.escapeCarriageReturn)(g(e)),a.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:t})}function u(e){let t=``;return e.bg&&(t+=`${e.bg}-bg `),e.fg&&(t+=`${e.fg}-fg `),e.decoration&&(t+=`ansi-${e.decoration} `),t===``?null:(t=t.substring(0,t.length-1),t)}function d(e){let t={};switch(e.bg&&(t.backgroundColor=`rgb(${e.bg})`),e.fg&&(t.color=`rgb(${e.fg})`),e.decoration){case`bold`:t.fontWeight=`bold`;break;case`dim`:t.opacity=`0.5`;break;case`italic`:t.fontStyle=`italic`;break;case`hidden`:t.visibility=`hidden`;break;case`strikethrough`:t.textDecoration=`line-through`;break;case`underline`:t.textDecoration=`underline`;break;case`blink`:t.textDecoration=`blink`;break;default:break}return t}function f(e,t,n,r){let i=t?null:d(n),a=t?u(n):null;return e?e===`fuzzy`?m(n,r,i,a):p(n,r,i,a):c.createElement(`span`,{style:i,key:r,className:a},n.content)}function p(e,t,n,r){let i=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,o=0,s;for(;(s=a.exec(e.content))!==null;){let[,t,n]=s,r=s.index+t.length;r>o&&i.push(e.content.substring(o,r));let l=n.startsWith(`www.`)?`http://${n}`:n;i.push(c.createElement(`a`,{key:o,href:l,target:`_blank`},`${n}`)),o=a.lastIndex}return o<e.content.length&&i.push(e.content.substring(o)),c.createElement(`span`,{style:n,key:t,className:r},i)}function m(e,t,n,r){let i=(0,s.default)({fuzzyEmail:!1}).tlds([`io`],!0);if(!i.pretest(e.content))return c.createElement(`span`,{style:n,key:t,className:r},e.content);let a=i.match(e.content);if(!a)return c.createElement(`span`,{style:n,key:t,className:r},e.content);let o=[e.content.substring(0,a[0]?.index)];return a.forEach((t,n)=>{o.push(c.createElement(`a`,{href:t.url,target:`_blank`,key:n},e.content.substring(t.index,t.lastIndex))),a[n+1]&&o.push(e.content.substring(a[n].lastIndex,a[n+1]?.index))}),a[a.length-1].lastIndex!==e.content.length&&o.push(e.content.substring(a[a.length-1].lastIndex,e.content.length)),c.createElement(`span`,{style:n,key:t,className:r},o)}function h(e){let{className:t,useClasses:n,children:r,linkify:i}=e;return c.createElement(`code`,{className:t},l(r??``,n??!1).map(f.bind(null,i??!1,n??!1)))}function g(e){let t=e;do e=t,t=e.replace(/[^\n]\x08/gm,``);while(t.length<e.length);return e}}))(),1),hl=ml.default.default,gl=typeof ml.default==`function`?ml.default:hl??ml.default,{Text:_l}=s,vl=({open:e,onClose:t,branch:n,client:r})=>{let{token:i}=ce.useToken(),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!0),d=(0,U.useRef)(null),f=(0,U.useRef)(null),p=(0,U.useRef)(null),m=(0,U.useCallback)(async(e=!1,t=!1)=>{if(!r)return;let i=d.current,a=i&&Math.abs(i.scrollHeight-i.scrollTop-i.clientHeight)<10;t&&c(!0);try{let t=await r.service(`branches/logs`).find({query:{branch_id:n.branch_id}});o(t),f.current=t;let s=!!f.current;e&&(a||!s)&&setTimeout(()=>{i?.scrollTo({top:i.scrollHeight,behavior:`smooth`})},100)}catch(e){let t={logs:``,timestamp:new Date().toISOString(),error:e instanceof Error?e.message:`Failed to fetch logs`};o(t),f.current=t}finally{t&&c(!1)}},[r,n.branch_id]);return(0,U.useEffect)(()=>{e?m(!0,!0):(o(null),f.current=null)},[e,m]),(0,U.useEffect)(()=>(p.current&&=(clearInterval(p.current),null),l&&e&&(p.current=setInterval(()=>{m(!0)},3e3)),()=>{p.current&&=(clearInterval(p.current),null)}),[l,e,m]),(0,W.jsx)(it,{title:`Environment Logs - ${n.name}`,open:e,onCancel:t,width:900,style:{top:20},footer:[(0,W.jsx)(vt,{checked:l,onChange:e=>u(e.target.checked),children:`Auto-refresh`},`auto-refresh`),(0,W.jsx)(V,{icon:(0,W.jsx)(x,{}),onClick:()=>m(!1,!0),loading:s,children:`Refresh`},`refresh`),(0,W.jsx)(V,{onClick:t,children:`Close`},`close`)],children:(0,W.jsx)(kr,{fallbackTitle:`Couldn't render the logs viewer.`,resetKey:a?.timestamp,children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[a&&!a.error&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(_l,{type:`secondary`,style:{fontSize:12},children:[`Fetched at: `,(e=>new Date(e).toLocaleString())(a.timestamp)]}),a.truncated&&(0,W.jsx)(I,{title:`Logs truncated (showing last 500 lines)`,type:`warning`,showIcon:!0,style:{marginTop:8},banner:!0})]}),a?.error&&(0,W.jsx)(I,{title:`Error fetching logs`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:a.error}),a.error.includes(`No logs command`)&&(0,W.jsx)(`div`,{style:{marginTop:8,fontSize:12},children:`Configure a 'logs' command in .env-config.yaml to view logs.`})]}),type:`error`,showIcon:!0}),a&&!a.error&&(0,W.jsx)(`div`,{ref:d,style:{backgroundColor:`#000`,border:`1px solid ${i.colorBorder}`,borderRadius:i.borderRadius,padding:16,height:`60vh`,overflowY:`auto`,fontFamily:`monospace`,fontSize:12,whiteSpace:`pre-wrap`,wordBreak:`break-word`,color:`#fff`},children:a.logs?(0,W.jsx)(gl,{children:String(a.logs)}):`(no logs)`}),s&&!a&&(0,W.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:i.colorTextSecondary,height:`60vh`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`Loading logs...`})]})})})},yl=`https://agor.live/guide/environment-configuration`;function bl(e){return{start:e.start_command||void 0,stop:e.stop_command||void 0,nuke:e.nuke_command||void 0,logs:e.logs_command||void 0,health:e.health_check_url||void 0,app:e.app_url||void 0}}function xl(e){try{return Qt(e,{indent:2,lineWidth:100,noRefs:!0})}catch{return``}}var Sl=({branch:e,repo:t,client:n,onUpdateRepo:r,onUpdateBranch:i,canControlEnvironment:c})=>{let{token:l}=ce.useToken(),{showSuccess:d,showError:f}=mn(),{confirm:p}=Fo(),m=Io(),{isAdmin:h}=Ho(),{featuresConfig:g}=No(),_=g?.managedEnvsExecutionMode??`hybrid`,y=_===`webhook-only`,b=c??h,S=b?void 0:`Requires branch 'all' permission or admin access`,w=y?`This instance uses webhook-managed environments. Use public http(s) URLs for start, stop, nuke, and logs.`:`This instance supports shell commands and URL webhooks for start, stop, nuke, and logs.`,T=y?`version: 2
|
|
32
|
-
default: remote
|
|
33
|
-
variants:
|
|
34
|
-
remote:
|
|
35
|
-
start: https://env.example.com/start?branch={{branch.name}}
|
|
36
|
-
stop: https://env.example.com/stop?branch={{branch.name}}
|
|
37
|
-
health: https://apps.example.com/{{branch.name}}/health
|
|
38
|
-
app: https://apps.example.com/{{branch.name}}
|
|
39
|
-
`:`version: 2
|
|
40
|
-
default: lean
|
|
41
|
-
variants:
|
|
42
|
-
lean:
|
|
43
|
-
start: docker compose up -d
|
|
44
|
-
stop: docker compose down
|
|
45
|
-
`,[E,D]=(0,U.useState)(!1),[O,k]=(0,U.useState)(()=>t.environment?xl(t.environment):``),[A,ee]=(0,U.useState)(null),[j,M]=(0,U.useState)(!1),[N,te]=(0,U.useState)(()=>xl(bl(e))),[re,ie]=(0,U.useState)(null),F=t.environment?Object.keys(t.environment.variants):[],[se,le]=(0,U.useState)(e.environment_variant??t.environment?.default??F[0]??``),[ue,de]=(0,U.useState)(!1),[fe,pe]=(0,U.useState)(e.environment_instance?.status||`stopped`),[me,he]=(0,U.useState)(e.environment_instance?.last_health_check),[ge,_e]=(0,U.useState)(e.environment_instance?.last_error),[ve,ye]=(0,U.useState)(!1),[be,xe]=(0,U.useState)(!1),[Se,Ce]=(0,U.useState)(!1),[we,Te]=(0,U.useState)(!1),[De,L]=(0,U.useState)(!1),Oe=(0,U.useRef)(e),ke=(0,U.useRef)(t);(0,U.useEffect)(()=>{pe(e.environment_instance?.status||`stopped`),he(e.environment_instance?.last_health_check),_e(e.environment_instance?.last_error);let t=Oe.current!==e;Oe.current=e,t&&!j&&(te(xl(bl(e))),ie(null)),t&&e.environment_variant&&le(e.environment_variant)},[e,j]),(0,U.useEffect)(()=>{let e=ke.current!==t;ke.current=t,e&&!E&&(k(t.environment?xl(t.environment):``),ee(null))},[t,E]),(0,U.useEffect)(()=>{if(!n)return;let t=t=>{let n=t;n.branch_id===e.branch_id&&(pe(n.environment_instance?.status||`stopped`),he(n.environment_instance?.last_health_check),_e(n.environment_instance?.last_error))};return n.service(`branches`).on(`patched`,t),()=>n.service(`branches`).removeListener(`patched`,t)},[n,e.branch_id]);let je=async()=>{if(n){ye(!0);try{await n.service(`branches/${e.branch_id}/start`).create({}),d(`Environment started successfully`)}catch(e){f(e instanceof Error?e.message:`Failed to start environment`)}finally{ye(!1)}}},R=async()=>{if(n){xe(!0);try{await n.service(`branches/${e.branch_id}/stop`).create({}),d(`Environment stopped successfully`)}catch(e){f(e instanceof Error?e.message:`Failed to stop environment`)}finally{xe(!1)}}},Ne=async()=>{if(n){Ce(!0);try{await n.service(`branches/${e.branch_id}/restart`).create({}),d(`Environment restarted successfully`)}catch(e){f(e instanceof Error?e.message:`Failed to restart environment`)}finally{Ce(!1)}}},Pe=()=>{n&&m(async()=>{Te(!0);try{await n.service(`branches/${e.branch_id}/nuke`).create({}),d(`Environment nuked successfully`)}catch(e){f(e instanceof Error?e.message:`Failed to nuke environment`)}finally{Te(!1)}})},Fe=se!==e.environment_variant,Ie=fe===`running`||fe===`starting`,Le=!b||!t.environment||!se||Fe&&Ie||ue,ze=b?t.environment?Fe&&Ie?`Stop the environment before switching variants (currently ${fe})`:void 0:`Configure repo environment variants first`:S,Be=async()=>{if(n){de(!0);try{let t=await n.service(`branches/${e.branch_id}/render-environment`).create({variant:se});d(Fe?`Rendered variant "${se}" to branch`:`Re-rendered branch environment`),te(xl(bl(t))),ie(null),t.environment_variant&&le(t.environment_variant)}catch(e){f(e instanceof Error?e.message:`Failed to render environment`)}finally{de(!1)}}},Ve=()=>{if(!Le){if(h&&N.trim()!==xl(bl(e)).trim()){p({title:`Discard local snapshot edits?`,content:`The branch has unsaved manual edits in the snapshot editor. Rendering will overwrite them.`,okText:`Render anyway`,okType:`danger`,cancelText:`Cancel`,onOk:Be});return}Be()}},He=e=>{if(!e.trim())return ee(`Empty — paste or write a RepoEnvironment YAML document`),null;let t;try{t=Ut(e)}catch(e){return ee(e instanceof Error?e.message:`Invalid YAML`),null}try{let e=en(t);if(y)try{nl(e,_)}catch(e){return ee(e instanceof Error?e.message:`Invalid webhook lifecycle URL`),null}return ee(null),e}catch(e){return ee(e instanceof Error?e.message:`Invalid RepoEnvironment`),null}},Ue=()=>{if(!r)return;let e=He(O);e&&(r(t.repo_id,{environment:e}),D(!1))},We=()=>{k(t.environment?xl(t.environment):``),ee(null),D(!1)},Ge=e=>{if(!e.trim())return ie("Empty — provide at least `start` and `stop`"),null;let t;try{t=Ut(e)}catch(e){return ie(e instanceof Error?e.message:`Invalid YAML`),null}if(typeof t!=`object`||!t)return ie(`Expected a YAML mapping (object)`),null;let n=t;if(!n.start||typeof n.start!=`string`)return ie("`start` is required and must be a string"),null;if(!n.stop||typeof n.stop!=`string`)return ie("`stop` is required and must be a string"),null;if(y)try{tl({start:n.start,stop:n.stop,nuke:n.nuke,logs:n.logs},_,`branch environment`)}catch(e){return ie(e instanceof Error?e.message:`Invalid webhook lifecycle URL`),null}return ie(null),n},Ke=()=>{if(!i)return;let t=Ge(N);t&&(i(e.branch_id,{start_command:t.start||void 0,stop_command:t.stop||void 0,nuke_command:t.nuke||void 0,logs_command:t.logs||void 0,health_check_url:t.health||void 0,app_url:t.app||void 0}),M(!1))},qe=()=>{te(xl(bl(e))),ie(null),M(!1)},Je=()=>{if(!n||!r)return;let i=t.environment?Object.keys(t.environment.variants):[];p({title:`Import .agor.yml?`,icon:(0,W.jsx)(oe,{}),content:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{children:[`This will replace your repo-level variants with the contents of `,(0,W.jsx)(`code`,{children:`.agor.yml`}),` `,`in this branch.`]}),i.length>0&&(0,W.jsxs)(`p`,{style:{marginBottom:4},children:[`Current variants that will be replaced:`,` `,i.map(e=>(0,W.jsx)(v,{style:{marginBottom:4},children:e},e))]}),(0,W.jsxs)(`p`,{style:{marginTop:8},children:[`Your `,(0,W.jsx)(`code`,{children:`template_overrides`}),` and branch-level snapshots are preserved.`]})]}),okText:`Import`,cancelText:`Cancel`,onOk:async()=>{try{let i=await n.service(`repos/${t.repo_id}/import-agor-yml`).create({branch_id:e.branch_id});i.environment&&k(xl(i.environment)),r(t.repo_id,{environment:i.environment}),d(`Imported .agor.yml`)}catch(e){f(e instanceof Error?e.message:`Failed to import .agor.yml`)}}})},Ze=()=>{n&&p({title:`Export to .agor.yml?`,icon:(0,W.jsx)(Ae,{}),content:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{children:[`This will overwrite `,(0,W.jsx)(`code`,{children:`.agor.yml`}),` in the repo root (this branch's working copy).`]}),(0,W.jsxs)(`p`,{children:[(0,W.jsx)(`code`,{children:`template_overrides`}),` stays local and will not be written.`]})]}),okText:`Export`,cancelText:`Cancel`,onOk:async()=>{try{await n.service(`repos/${t.repo_id}/export-agor-yml`).create({branch_id:e.branch_id}),d(`Environment configuration exported to .agor.yml`)}catch(e){f(e instanceof Error?e.message:`Failed to export .agor.yml`)}}})},$e=rl(e.environment_instance),et=!!t.environment,tt=!et,rt=j,it=E,ot=(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:11},children:(0,W.jsx)(`a`,{href:yl,target:`_blank`,rel:`noopener noreferrer`,children:`Documentation`})}),st=(0,U.useMemo)(()=>{let e=il($e);switch($e){case`healthy`:return(0,W.jsx)(s.Text,{strong:!0,style:{color:l.colorSuccess},children:e});case`unhealthy`:return(0,W.jsx)(s.Text,{strong:!0,style:{color:l.colorError},children:e});case`running`:return(0,W.jsx)(s.Text,{strong:!0,style:{color:l.colorInfo},children:e});case`starting`:case`stopping`:return(0,W.jsx)(s.Text,{strong:!0,children:e});case`error`:return(0,W.jsx)(s.Text,{strong:!0,type:`danger`,children:e});default:return(0,W.jsx)(s.Text,{type:`secondary`,children:e})}},[$e,l]),ct=me?me.status===`healthy`?(0,W.jsx)(Re,{style:{color:l.colorSuccess}}):me.status===`unhealthy`?(0,W.jsx)(Ye,{style:{color:l.colorError}}):(0,W.jsx)(Xe,{style:{color:l.colorWarning}}):null,B=F.map(e=>{let n=t.environment?.variants[e]?.description,r=t.environment?.default===e;return{value:e,label:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`strong`,{children:e}),r&&(0,W.jsx)(v,{color:`blue`,style:{marginLeft:6,fontSize:10},children:`default`}),n&&(0,W.jsx)(s.Text,{type:`secondary`,style:{marginLeft:8,fontSize:11},children:n})]})}});return(0,W.jsxs)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:[(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[et&&(0,W.jsxs)(Me,{size:`small`,children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[fe===`running`&&(0,W.jsx)(Ee,{size:`small`}),ct,st,(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(V,{type:`primary`,size:`small`,icon:ve?(0,W.jsx)(C,{}):(0,W.jsx)(a,{}),onClick:je,loading:ve,disabled:!b||fe===`running`||fe===`starting`||ve||be||Se,title:S,children:`Start`}),(0,W.jsx)(V,{size:`small`,icon:be?(0,W.jsx)(C,{}):(0,W.jsx)(ae,{}),onClick:R,loading:be,disabled:!b,title:S,danger:!0,children:`Stop`}),(0,W.jsx)(V,{size:`small`,icon:Se?(0,W.jsx)(C,{}):(0,W.jsx)(x,{}),onClick:Ne,disabled:!b||ve||be||Se,loading:Se,title:S,children:`Restart`}),e.nuke_command&&(0,W.jsx)(V,{size:`small`,icon:we?(0,W.jsx)(C,{}):(0,W.jsx)(Qe,{}),onClick:Pe,disabled:!b||ve||be||Se||we,loading:we,danger:!0,title:S??`Nuke environment (destructive - removes all data and volumes)`,children:`Nuke`}),(0,W.jsx)(V,{size:`small`,icon:(0,W.jsx)(at,{}),onClick:()=>L(!0),disabled:!b||!e.logs_command,title:b?e.logs_command?void 0:`Configure a logs command in the variant to enable`:S,children:`View Logs`})]}),fe===`error`&&(me?.message||ge)&&(0,W.jsx)(I,{style:{marginTop:12,fontSize:11},type:`error`,showIcon:!0,title:me?.message||`Environment Error`,description:ge&&(0,W.jsx)(`pre`,{style:{maxHeight:200,overflow:`auto`,margin:0,fontSize:11,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:ge})})]}),tt&&(0,W.jsx)(I,{type:`info`,showIcon:!0,title:`No environment variants configured`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{style:{marginBottom:8},children:h?`Import from an existing .agor.yml or add variants in the repo editor below.`:`Ask an admin to set up environment commands in the repo editor below.`}),h&&(0,W.jsx)(z,{children:(0,W.jsx)(V,{size:`small`,icon:(0,W.jsx)(oe,{}),onClick:Je,children:`Import from .agor.yml`})}),(0,W.jsx)(`div`,{style:{marginTop:8},children:(0,W.jsx)(`a`,{href:yl,target:`_blank`,rel:`noopener noreferrer`,children:`Documentation: environment variants`})})]})}),(0,W.jsx)(Me,{size:`small`,title:(0,W.jsxs)(z,{children:[(0,W.jsx)(nt,{}),(0,W.jsx)(`span`,{children:`Repository environment (shared)`}),(0,W.jsx)(v,{color:`orange`,style:{fontSize:10},children:`Affects all branches on this repo`})]}),extra:(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(o,{title:h?`Replace variants with contents of .agor.yml in this branch`:`Only admins can import .agor.yml`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(oe,{}),onClick:Je,disabled:!h,children:`Import`})}),(0,W.jsx)(o,{title:et?h?`Write variants + default to .agor.yml (template_overrides stripped)`:`Only admins can export .agor.yml`:`No configuration to export`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(Ae,{}),onClick:Ze,disabled:!h||!et,children:`Export`})}),!E&&(0,W.jsx)(o,{title:h?rt?`Finish editing the branch snapshot first`:void 0:`Only admins can edit repo environment`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>D(!0),disabled:!h||rt,children:`Edit`})})]}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsx)(I,{type:`info`,showIcon:!0,message:y?`Webhook-managed environments`:`Managed environments`,description:w,style:{fontSize:12}}),(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:11},children:[`YAML representation of `,(0,W.jsx)(`code`,{children:`repo.environment`}),`. Includes `,(0,W.jsx)(`code`,{children:`version`}),`,`,` `,(0,W.jsx)(`code`,{children:`default`}),`, `,(0,W.jsx)(`code`,{children:`variants`}),`, and optional`,` `,(0,W.jsx)(`code`,{children:`template_overrides`}),`. `,ot]}),(0,W.jsx)(sl,{value:O,onChange:e=>{k(e),A&&ee(null)},language:`yaml`,placeholder:tt&&h?T:``,readOnly:!E,rows:10,maxHeight:`480px`}),A&&(0,W.jsx)(I,{type:`error`,showIcon:!0,title:`Invalid repo environment: ${A}`}),E&&(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`primary`,size:`small`,icon:(0,W.jsx)(u,{}),onClick:Ue,children:`Save`}),(0,W.jsx)(V,{size:`small`,onClick:We,children:`Cancel`})]})]})}),(0,W.jsx)(Me,{size:`small`,children:(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:13},children:`Variant:`}),(0,W.jsx)(P,{value:se||void 0,onChange:le,style:{minWidth:260},size:`small`,options:B,disabled:!et,placeholder:tt?`No variants configured — ask an admin`:`Select a variant`}),Fe&&(0,W.jsx)(v,{color:`gold`,style:{fontSize:10},children:`will replace snapshot`}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(o,{title:ze,children:(0,W.jsx)(V,{type:`primary`,size:`small`,icon:ue?(0,W.jsx)(C,{}):(0,W.jsx)(lt,{}),onClick:Ve,loading:ue,disabled:Le,children:`Render`})})]})}),(0,W.jsx)(Me,{size:`small`,title:(0,W.jsxs)(z,{children:[(0,W.jsx)(a,{}),(0,W.jsxs)(`span`,{children:[`Branch environment: `,e.name]}),e.environment_variant&&(0,W.jsxs)(v,{color:`blue`,style:{fontSize:10},children:[`rendered from: `,e.environment_variant]})]}),extra:!j&&(0,W.jsx)(o,{title:h?it?`Finish editing the repo environment first`:`Edit the rendered commands for this branch only`:`Only admins can edit the rendered snapshot directly`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>M(!0),disabled:!h||it,children:`Edit`})}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:11},children:[`Rendered snapshot persisted on this branch (fields: `,(0,W.jsx)(`code`,{children:`start`}),`,`,` `,(0,W.jsx)(`code`,{children:`stop`}),`, `,(0,W.jsx)(`code`,{children:`nuke`}),`, `,(0,W.jsx)(`code`,{children:`logs`}),`, `,(0,W.jsx)(`code`,{children:`health`}),`,`,` `,(0,W.jsx)(`code`,{children:`app`}),`). `,w,` Click Render above to regenerate from the variant.`]}),(0,W.jsx)(sl,{value:N,onChange:e=>{te(e),re&&ie(null)},language:`yaml`,readOnly:!j,rows:10,maxHeight:`480px`}),re&&(0,W.jsx)(I,{type:`error`,showIcon:!0,title:`Invalid snapshot: ${re}`}),j&&(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`primary`,size:`small`,icon:(0,W.jsx)(u,{}),onClick:Ke,children:`Save`}),(0,W.jsx)(V,{size:`small`,onClick:qe,children:`Cancel`})]})]})})]}),(0,W.jsx)(vl,{open:De,onClose:()=>L(!1),branch:e,client:n})]})},Cl=({children:e,language:t=`typescript`,showLineNumbers:n=!1,customStyle:r,PreTag:i=`pre`,codeTagProps:a})=>{let{token:o}=ce.useToken();return(0,W.jsx)(Wn,{language:t,style:Jn(o)?Vn:Kn,showLineNumbers:n,customStyle:{margin:0,borderRadius:o.borderRadius,...r},PreTag:i,codeTagProps:a,children:e})},wl={js:`javascript`,cjs:`javascript`,mjs:`javascript`,ts:`typescript`,jsx:`jsx`,tsx:`tsx`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,css:`css`,scss:`scss`,html:`html`,xml:`xml`,json:`json`,yaml:`yaml`,yml:`yaml`,sh:`bash`,bash:`bash`,sql:`sql`,graphql:`graphql`,proto:`protobuf`,toml:`toml`,vue:`vue`,svelte:`svelte`,md:`markdown`,markdown:`markdown`,env:`bash`};function Tl(e){return wl[e.split(`.`).pop()?.toLowerCase()??``]??`text`}var El=({file:e,open:t,onClose:n,loading:r})=>{let{showSuccess:i}=mn();if(!e)return null;let a=Tl(e.path);return(0,W.jsx)(it,{title:e.path,open:t,onCancel:n,width:900,styles:{body:{maxHeight:`70vh`,overflow:`auto`}},footer:[(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:async()=>{await cn(e.path),i(`Path copied to clipboard!`)},children:`Copy Path`},`copy-path`),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(We,{}),onClick:async()=>{await cn(e.content),i(`Content copied to clipboard!`)},children:`Copy Content`},`copy-content`),(0,W.jsx)(V,{onClick:n,children:`Close`},`close`)],children:r?(0,W.jsx)(Ee,{style:{display:`block`,padding:`2rem`},description:`Loading file…`}):(0,W.jsx)(Cl,{language:a,showLineNumbers:!0,children:e.content})})},{Search:Dl}=L,Ol=300;function kl(e,t,n,r){let i=t?e.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())||e.path.toLowerCase().includes(t.toLowerCase())):e,a=new Map;for(let e of i){let t=e.path.split(`/`),i=``;for(let e=0;e<t.length-1;e++){let n=t[e],r=i;if(i=i?`${i}/${n}`:n,!a.has(i)&&(a.set(i,{key:i,title:(0,W.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:8},children:[(0,W.jsx)(de,{}),(0,W.jsx)(`strong`,{children:n})]}),isLeaf:!1,children:[]}),r&&a.has(r))){let e=a.get(r);e.children=e.children||[],e.children.push(a.get(i))}}let s=e.path.endsWith(`.md`)?He:l,c=t[t.length-1],u=(e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`)(e.size),d=`${e.path} (${u})`,f={key:e.path,title:(0,W.jsx)(o,{title:d,mouseEnterDelay:.5,children:(0,W.jsxs)(`div`,{style:{display:`inline-flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`},children:[(0,W.jsxs)(`span`,{style:{flex:1,minWidth:0,display:`inline-flex`,alignItems:`center`,gap:8},children:[(0,W.jsx)(s,{}),c]}),(0,W.jsxs)(`span`,{style:{marginLeft:8,whiteSpace:`nowrap`,display:`inline-flex`,gap:4},children:[(0,W.jsx)(o,{title:`Copy path`,children:(0,W.jsx)(V,{size:`small`,type:`text`,icon:(0,W.jsx)(We,{}),onClick:t=>{t.stopPropagation(),r&&r(e)}})}),n&&(0,W.jsx)(o,{title:`Download file`,children:(0,W.jsx)(V,{size:`small`,type:`text`,icon:(0,W.jsx)(oe,{}),onClick:t=>{t.stopPropagation(),n(e)}})})]})]})}),isLeaf:!0,file:e};if(i&&a.has(i)){let e=a.get(i);e.children=e.children||[],e.children.push(f)}else a.set(e.path,f)}let s=[],c=new Set(a.keys());for(let[e,t]of a.entries()){let n=e.split(`/`).slice(0,-1).join(`/`);(!n||!c.has(n))&&s.push(t)}let u=e=>{let t=e.filter(e=>!e.isLeaf),n=e.filter(e=>e.isLeaf);return t.sort((e,t)=>e.key.localeCompare(t.key)),n.sort((e,t)=>e.key.localeCompare(t.key)),t.forEach(e=>{e.children&&=u(e.children)}),[...t,...n]};return u(s)}var Al=(0,U.memo)(({files:e,onFileClick:t,onDownload:n,loading:r=!1,emptyMessage:i=`No files found`})=>{let[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)([]),{showSuccess:d}=mn(),f=(0,U.useRef)(n);f.current=n;let p=(0,U.useRef)(t);p.current=t;let m=(0,U.useRef)(null),h=(0,U.useRef)(null),g=(0,U.useCallback)(async e=>{await cn(e.path),d(`Path copied to clipboard!`)},[d]),_=(0,U.useCallback)(e=>{f.current?.(e)},[]),v=(0,U.useMemo)(()=>kl(e,a,_,g),[e,a,_,g]),y=(0,U.useCallback)((e,t)=>{t.node.isLeaf&&t.node.file&&p.current(t.node.file)},[]),b=(0,U.useCallback)(e=>{let t=[],n=e=>{e.isLeaf||t.push(e.key),e.children&&e.children.forEach(n)};return e.forEach(n),t},[]),x=(0,U.useCallback)(e=>{let t=e.target.value;c(t),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(t),h.current=t},Ol)},[]),S=(0,U.useCallback)(e=>{m.current&&clearTimeout(m.current),c(e),o(e),h.current=e},[]);(0,U.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let C=(0,U.useRef)(v);(0,U.useEffect)(()=>{if(C.current!==v&&h.current!==null){let e=h.current;if(h.current=null,e){let e=b(v);u(t=>e.length!==t.length||!e.every(e=>t.includes(e))?e:t)}else u(e=>e.length>0?[]:e)}C.current=v},[v,b]);let w=(0,U.useCallback)(e=>{u(e)},[]);return r?(0,W.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:48},children:(0,W.jsx)(Ee,{size:`large`})}):!r&&e.length===0?(0,W.jsx)(`div`,{style:{padding:48},children:(0,W.jsx)(E,{description:i})}):(0,W.jsxs)(`div`,{style:{padding:`0 24px`},children:[(0,W.jsx)(`div`,{style:{marginBottom:16},children:(0,W.jsx)(Dl,{placeholder:`Search files...`,allowClear:!0,value:s,onSearch:S,onChange:x,style:{width:`100%`}})}),(0,W.jsx)(N,{className:`agor-flat-tree`,treeData:v,onSelect:y,showIcon:!1,expandedKeys:l,onExpand:w,style:{background:`transparent`,borderRadius:0,padding:0},virtual:!0,height:600})]})},(e,t)=>e.loading===t.loading&&e.emptyMessage===t.emptyMessage&&e.files===t.files),jl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ml=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nl={};function Pl(e,t){return((t||Nl).jsx?Ml:jl).test(e)}var Fl=/[ \t\n\f\r]/g;function Il(e){return typeof e==`object`?e.type===`text`?Ll(e.value):!1:Ll(e)}function Ll(e){return e.replace(Fl,``)===``}var Rl=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
46
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),zl=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Rl());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Bl=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Vl=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(zl()),r=Bl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Hl=Wl(`end`),Ul=Wl(`start`);function Wl(e){return t;function t(t){let n=t&&t.position&&t.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 Gl(e){let t=Ul(e),n=Hl(e);if(t&&n)return{start:t,end:n}}function Kl(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Jl(e.position):`start`in e||`end`in e?Jl(e):`line`in e||`column`in e?ql(e):``}function ql(e){return Yl(e&&e.line)+`:`+Yl(e&&e.column)}function Jl(e){return ql(e&&e.start)+`-`+ql(e&&e.end)}function Yl(e){return e&&typeof e==`number`?e:1}var Xl=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let 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=r,this.line=o?o.line:void 0,this.name=Kl(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}};Xl.prototype.file=``,Xl.prototype.name=``,Xl.prototype.reason=``,Xl.prototype.message=``,Xl.prototype.stack=``,Xl.prototype.column=void 0,Xl.prototype.line=void 0,Xl.prototype.ancestors=void 0,Xl.prototype.cause=void 0,Xl.prototype.fatal=void 0,Xl.prototype.place=void 0,Xl.prototype.ruleId=void 0,Xl.prototype.source=void 0;var Zl=e(Vl(),1),Ql={}.hasOwnProperty,$l=new Map,eu=/[A-Z]/g,tu=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),nu=new Set([`td`,`th`]);function ru(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=mu(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=pu(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Ln:qn,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=iu(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function iu(e,t,n){if(t.type===`element`)return au(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ou(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return cu(e,t,n);if(t.type===`mdxjsEsm`)return su(e,t);if(t.type===`root`)return lu(e,t,n);if(t.type===`text`)return uu(e,t)}function au(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ln,e.schema=i),e.ancestors.push(t);let a=bu(e,t.tagName,!1),o=hu(e,t),s=_u(e,t);return tu.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Il(e):!0})),du(e,o,a,t),fu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ou(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}xu(e,t.position)}function su(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xu(e,t.position)}function cu(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ln,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:bu(e,t.name,!0),o=gu(e,t),s=_u(e,t);return du(e,o,a,t),fu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function lu(e,t,n){let r={};return fu(r,_u(e,t)),e.create(t,e.Fragment,r,n)}function uu(e,t){return t.value}function du(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function fu(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function pu(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function mu(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ul(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function hu(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ql.call(t.properties,i)){let a=vu(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&nu.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function gu(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else xu(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else xu(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function _u(e,t){let n=[],r=-1,i=e.passKeys?new Map:$l;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=iu(e,a,o);s!==void 0&&n.push(s)}return n}function vu(e,t,n){let r=Rn(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Bn(n):In(n)),r.property===`style`){let t=typeof n==`object`?n:yu(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Su(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Un[r.property]||r.property:r.attribute,n]}}function yu(e,t){try{return(0,Zl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Xl("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function bu(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Pl(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Pl(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ql.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);xu(e)}function xu(e,t){let n=new Xl("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function Su(e){let t={},n;for(n in e)Ql.call(e,n)&&(t[Cu(n)]=e[n]);return t}function Cu(e){let t=e.replace(eu,wu);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function wu(e){return`-`+e.toLowerCase()}var Tu={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`]},Eu={};function Du(e,t){let n=t||Eu;return Ou(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Ou(e,t,n){if(Au(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ku(e.children,t,n)}return Array.isArray(e)?ku(e,t,n):``}function ku(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Ou(e[i],t,n);return r.join(``)}function Au(e){return!!(e&&typeof e==`object`)}function ju(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Mu(e,t){return e.length>0?(ju(e,e.length,0,t),e):t}var Nu={}.hasOwnProperty;function Pu(e){let t={},n=-1;for(;++n<e.length;)Fu(t,e[n]);return t}function Fu(e,t){let n;for(n in t){let r=(Nu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Nu.call(r,a)||(r[a]=[]);let e=i[a];Iu(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Iu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);ju(e,0,0,r)}function Lu(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Ru(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var zu=Zu(/[A-Za-z]/),Bu=Zu(/[\dA-Za-z]/),Vu=Zu(/[#-'*+\--9=?A-Z^-~]/);function Hu(e){return e!==null&&(e<32||e===127)}var Uu=Zu(/\d/),Wu=Zu(/[\dA-Fa-f]/),Gu=Zu(/[!-/:-@[-`{-~]/);function Ku(e){return e!==null&&e<-2}function qu(e){return e!==null&&(e<0||e===32)}function Ju(e){return e===-2||e===-1||e===32}var Yu=Zu(/\p{P}|\p{S}/u),Xu=Zu(/\s/);function Zu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Qu(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Bu(e.charCodeAt(n+1))&&Bu(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function $u(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Ju(r)?(e.enter(n),s(r)):t(r)}function s(r){return Ju(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var ed={tokenize:td};function td(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$u(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Ku(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var nd={tokenize:id},rd={tokenize:ad};function id(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return ju(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(rd,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(rd,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Ku(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;ju(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ad(e,t,n){return $u(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function od(e){if(e===null||qu(e)||Xu(e))return 1;if(Yu(e))return 2}function sd(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var cd={name:`attention`,resolveAll:ld,tokenize:ud};function ld(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};dd(d,-c),dd(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Mu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Mu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Mu(l,sd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Mu(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Mu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ju(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function ud(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=od(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=od(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function dd(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var fd={name:`autolink`,tokenize:pd};function pd(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return zu(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Bu(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Bu(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Hu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Vu(t)?(e.consume(t),l):n(t)}function u(e){return Bu(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Bu(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var md={partial:!0,tokenize:hd};function hd(e,t,n){return r;function r(t){return Ju(t)?$u(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Ku(e)?t(e):n(e)}}var gd={continuation:{tokenize:vd},exit:yd,name:`blockQuote`,tokenize:_d};function _d(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Ju(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function vd(e,t,n){let r=this;return i;function i(t){return Ju(t)?$u(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(gd,t,n)(r)}}function yd(e){e.exit(`blockQuote`)}var bd={name:`characterEscape`,tokenize:xd};function xd(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Gu(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Sd={name:`characterReference`,tokenize:Cd};function Cd(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Bu,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Wu,u):(e.enter(`characterReferenceValue`),a=7,o=Uu,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Bu&&!zn(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var wd={partial:!0,tokenize:Dd},Td={concrete:!0,name:`codeFenced`,tokenize:Ed};function Ed(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Ju(t)?$u(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Ku(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(wd,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Ku(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Ju(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$u(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Ku(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Ku(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Ju(t)?$u(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Ku(t)?e.check(wd,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Ku(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Ju(t)?$u(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Ju(t)?$u(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Ku(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Dd(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Od={name:`codeIndented`,tokenize:Ad},kd={partial:!0,tokenize:jd};function Ad(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$u(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Ku(t)?e.attempt(kd,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Ku(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function jd(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Ku(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$u(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Ku(e)?i(e):n(e)}}var Md={name:`codeText`,previous:Pd,resolve:Nd,tokenize:Fd};function Nd(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Pd(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Fd(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Ku(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Ku(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Id=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Ld(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Ld(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ld(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Ld(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Ld(this.left,t.reverse())}}};function Ld(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Rd(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Id(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,zd(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return ju(e,0,1/0,u.slice(0)),!l}function zd(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Bd={resolve:Hd,tokenize:Ud},Vd={partial:!0,tokenize:Wd};function Hd(e){return Rd(e),e}function Ud(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Ku(t)?e.check(Vd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Wd(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$u(e,a,`linePrefix`)}function a(i){if(i===null||Ku(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Gd(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Hu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Ku(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||qu(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Hu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Kd(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Ku(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Ku(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Ju(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function qd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Ku(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$u(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Ku(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Jd(e,t){let n;return r;function r(i){return Ku(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Ju(i)?$u(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Yd={name:`definition`,tokenize:Zd},Xd={partial:!0,tokenize:Qd};function Zd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Kd.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Ru(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return qu(t)?Jd(e,l)(t):l(t)}function l(t){return Gd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Xd,d,d)(t)}function d(t){return Ju(t)?$u(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Ku(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Qd(e,t,n){return r;function r(t){return qu(t)?Jd(e,i)(t):n(t)}function i(t){return qd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Ju(t)?$u(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Ku(e)?t(e):n(e)}}var $d={name:`hardBreakEscape`,tokenize:ef};function ef(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Ku(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var tf={name:`headingAtx`,resolve:nf,tokenize:rf};function nf(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},ju(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function rf(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||qu(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Ku(n)?(e.exit(`atxHeading`),t(n)):Ju(n)?$u(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||qu(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var af=`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`.split(`.`),of=[`pre`,`script`,`style`,`textarea`],sf={concrete:!0,name:`htmlFlow`,resolveTo:uf,tokenize:df},cf={partial:!0,tokenize:pf},lf={partial:!0,tokenize:ff};function uf(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 df(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:P):zu(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):zu(a)?(e.consume(a),i=4,r.interrupt?t:P):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:P):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return zu(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||qu(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&of.includes(l)?(i=1,r.interrupt?t(s):O(s)):af.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Bu(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Ju(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||zu(t)?(e.consume(t),b):Ju(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Bu(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Ju(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Ju(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Ku(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||qu(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Ju(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Ku(t)?O(t):Ju(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),ne):t===63&&i===3?(e.consume(t),P):t===93&&i===5?(e.consume(t),te):Ku(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(cf,re,k)(t)):t===null||Ku(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(lf,A,re)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||Ku(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),P):O(t)}function M(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return of.includes(n)?(e.consume(t),ne):O(t)}return zu(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function te(t){return t===93?(e.consume(t),P):O(t)}function P(t){return t===62?(e.consume(t),ne):t===45&&i===2?(e.consume(t),P):O(t)}function ne(t){return t===null||Ku(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),ne)}function re(n){return e.exit(`htmlFlow`),t(n)}}function ff(e,t,n){let r=this;return i;function i(t){return Ku(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function pf(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(md,t,n)}}var mf={name:`htmlText`,tokenize:hf};function hf(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):zu(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):zu(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Ku(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Ku(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):Ku(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Ku(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return zu(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Bu(t)?(e.consume(t),S):C(t)}function C(t){return Ku(t)?(o=C,M(t)):Ju(t)?(e.consume(t),C):j(t)}function w(t){return t===45||Bu(t)?(e.consume(t),w):t===47||t===62||qu(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||zu(t)?(e.consume(t),E):Ku(t)?(o=T,M(t)):Ju(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||Bu(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Ku(t)?(o=D,M(t)):Ju(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Ku(t)?(o=O,M(t)):Ju(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):Ku(t)?(o=k,M(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||qu(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||qu(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return Ju(t)?$u(e,te,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):te(t)}function te(t){return e.enter(`htmlTextData`),o(t)}}var gf={name:`labelEnd`,resolveAll:bf,resolveTo:xf,tokenize:Sf},_f={tokenize:Cf},vf={tokenize:wf},yf={tokenize:Tf};function bf(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&ju(e,0,e.length,n),e}function xf(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Mu(s,e.slice(a+1,a+r+3)),s=Mu(s,[[`enter`,u,t]]),s=Mu(s,sd(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Mu(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Mu(s,e.slice(o+1)),s=Mu(s,[[`exit`,c,t]]),ju(e,a,e.length,s),e}function Sf(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Ru(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(_f,u,o?u:d)(t):t===91?e.attempt(vf,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(yf,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Cf(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return qu(t)?Jd(e,a)(t):a(t)}function a(t){return t===41?u(t):Gd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return qu(t)?Jd(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?qd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return qu(t)?Jd(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function wf(e,t,n){let r=this;return i;function i(t){return Kd.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Ru(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Tf(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Ef={name:`labelStartImage`,resolveAll:gf.resolveAll,tokenize:Df};function Df(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Of={name:`labelStartLink`,resolveAll:gf.resolveAll,tokenize:kf};function kf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Af={name:`lineEnding`,tokenize:jf};function jf(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$u(e,t,`linePrefix`)}}var Mf={name:`thematicBreak`,tokenize:Nf};function Nf(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Ku(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Ju(t)?$u(e,s,`whitespace`)(t):s(t))}}var Pf={continuation:{tokenize:Rf},exit:Bf,name:`list`,tokenize:Lf},Ff={partial:!0,tokenize:Vf},If={partial:!0,tokenize:zf};function Lf(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Uu(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Mf,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Uu(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(md,r.interrupt?n:u,e.attempt(Ff,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Ju(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Rf(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(md,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$u(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Ju(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(If,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$u(e,e.attempt(Pf,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function zf(e,t,n){let r=this;return $u(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Bf(e){e.exit(this.containerState.type)}function Vf(e,t,n){let r=this;return $u(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Ju(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Hf={name:`setextUnderline`,resolveTo:Uf,tokenize:Wf};function Uf(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Wf(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Ju(t)?$u(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Ku(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Gf={tokenize:Kf};function Kf(e){let t=this,n=e.attempt(md,r,e.attempt(this.parser.constructs.flowInitial,i,$u(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Bd,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var qf={resolveAll:Zf()},Jf=Xf(`string`),Yf=Xf(`text`);function Xf(e){return{resolveAll:Zf(e===`text`?Qf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Zf(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Qf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var $f=t({attentionMarkers:()=>sp,contentInitial:()=>tp,disable:()=>cp,document:()=>ep,flow:()=>rp,flowInitial:()=>np,insideSpan:()=>op,string:()=>ip,text:()=>ap}),ep={42:Pf,43:Pf,45:Pf,48:Pf,49:Pf,50:Pf,51:Pf,52:Pf,53:Pf,54:Pf,55:Pf,56:Pf,57:Pf,62:gd},tp={91:Yd},np={[-2]:Od,[-1]:Od,32:Od},rp={35:tf,42:Mf,45:[Hf,Mf],60:sf,61:Hf,95:Mf,96:Td,126:Td},ip={38:Sd,92:bd},ap={[-5]:Af,[-4]:Af,[-3]:Af,33:Ef,38:Sd,42:cd,60:[fd,mf],91:Of,92:[$d,bd],93:gf,95:cd,96:Md},op={null:[cd,qf]},sp={null:[42,95]},cp={null:[]};function lp(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Mu(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=sd(a,l.events,l),l.events):[]}function f(e,t){return dp(p(e),t)}function p(e){return up(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Ku(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ju(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function up(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function dp(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
47
|
-
`;break;case-3:o=`\r
|
|
48
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function fp(e){let t={constructs:Pu([$f,...(e||{}).extensions||[]]),content:n(ed),defined:[],document:n(nd),flow:n(Gf),lazy:{},string:n(Jf),text:n(Yf)};return t;function n(e){return n;function n(n){return lp(t,e,n)}}}function pp(e){for(;!Rd(e););return e}var mp=/[\0\t\n\r]/g;function hp(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(mp.lastIndex=u,c=mp.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var gp=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _p(e){return e.replace(gp,vp)}function vp(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Lu(n.slice(t?2:1),t?16:10)}return zn(n)||e}var yp={}.hasOwnProperty;function bp(e,t,n){return typeof t!=`string`&&(n=t,t=void 0),xp(n)(pp(fp(n).document().write(hp()(e,t,!0))))}function xp(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ye),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(ue),characterEscape:T,characterReference:T,codeFenced:a(de),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(de,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(_e,o),htmlFlowData:T,htmlText:a(_e,o),htmlTextData:T,image:a(ve),label:o,link:a(ye),listItem:a(I),listItemValue:f,listOrdered:a(be,d),listUnordered:a(be),paragraph:a(xe),reference:ie,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Se),thematicBreak:a(we)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:le,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:F,characterReference:se,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ee),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(M),label:te,labelText:N,lineEnding:D,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:P,resourceTitleString:ne,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Cp(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];yp.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Tp).call(a,void 0,e[0])}for(r.position={start:Sp(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Sp(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Sp(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Tp).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Kl({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Sp(e.end)}function u(){return Du(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ru(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:Sp(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Sp(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Sp(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=_p(t),n.identifier=Ru(t).toLowerCase()}function te(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function re(){this.data.inReference=void 0}function ie(){this.data.referenceType=`collapsed`}function ae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ru(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function oe(e){this.data.characterReferenceType=e.type}function F(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Lu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=zn(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=Sp(e.end)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ue(){return{type:`blockquote`,children:[]}}function de(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function me(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function _e(){return{type:`html`,value:``}}function ve(){return{type:`image`,title:null,url:``,alt:null}}function ye(){return{type:`link`,title:null,url:``,children:[]}}function be(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function I(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function we(){return{type:`thematicBreak`}}}function Sp(e){return{line:e.line,column:e.column,offset:e.offset}}function Cp(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Cp(e,r):wp(e,r)}}function wp(e,t){let n;for(n in t)if(yp.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Tp(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Kl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Kl({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Kl({start:t.start,end:t.end})+`) is still open`)}function Ep(e){let t=this;t.parser=n;function n(n){return bp(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Dp(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Op(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
49
|
-
`}]}function kp(e,t){let n=t.value?t.value+`
|
|
50
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Ap(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jp(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mp(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Qu(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Np(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Pp(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Fp(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Ip(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fp(e,t);let i={src:Qu(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Lp(e,t){let n={src:Qu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Rp(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function zp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fp(e,t);let i={href:Qu(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Bp(e,t){let n={href:Qu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Vp(e,t,n){let r=e.all(t),i=n?Hp(n):Up(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
51
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
52
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Hp(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Up(n[r])}return t}function Up(e){return e.spread??e.children.length>1}function Wp(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Gp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function qp(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jp(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Ul(t.children[1]),o=Hl(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Yp(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Xp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Zp=9,Qp=32;function $p(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(em(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(em(t.slice(i),i>0,!1)),a.join(``)}function em(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Zp||t===Qp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Zp||t===Qp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function tm(e,t){let n={type:`text`,value:$p(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function nm(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var rm={blockquote:Dp,break:Op,code:kp,delete:Ap,emphasis:jp,footnoteReference:Mp,heading:Np,html:Pp,imageReference:Ip,image:Lp,inlineCode:Rp,linkReference:zp,link:Bp,listItem:Vp,list:Wp,paragraph:Gp,root:Kp,strong:qp,table:Jp,tableCell:Xp,tableRow:Yp,text:tm,thematicBreak:nm,toml:im,yaml:im,definition:im,footnoteDefinition:im};function im(){}var am=typeof self==`object`?self:globalThis,om=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new am[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new am[a](o),i)};return r},sm=e=>om(new Map,e)(0),cm=``,{toString:lm}={},{keys:um}=Object,dm=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=lm.call(e).slice(8,-1);switch(n){case`Array`:return[1,cm];case`Object`:return[2,cm];case`Date`:return[3,cm];case`RegExp`:return[4,cm];case`Map`:return[5,cm];case`Set`:return[6,cm];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},fm=([e,t])=>e===0&&(t===`function`||t===`symbol`),pm=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=dm(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of um(r))(e||!fm(dm(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(fm(dm(n))||fm(dm(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!fm(dm(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},mm=(e,{json:t,lossy:n}={})=>{let r=[];return pm(!(t||n),!!t,new Map,r)(e),r},hm=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?sm(mm(e,t)):structuredClone(e):(e,t)=>sm(mm(e,t));function gm(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function _m(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function vm(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||gm,r=e.options.footnoteBackLabel||_m,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Qu(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...hm(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
53
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
54
|
-
`}]}}var ym=(function(e){if(e==null)return wm;if(typeof e==`function`)return Cm(e);if(typeof e==`object`)return Array.isArray(e)?bm(e):xm(e);if(typeof e==`string`)return Sm(e);throw Error(`Expected function, string, or object as test`)});function bm(e){let t=[],n=-1;for(;++n<e.length;)t[n]=ym(e[n]);return Cm(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function xm(e){let t=e;return Cm(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Sm(e){return Cm(t);function t(t){return t&&t.type===e}}function Cm(e){return t;function t(t,n,r){return!!(Tm(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function wm(){return!0}function Tm(e){return typeof e==`object`&&!!e&&`type`in e}function Em(e){return e}var Dm=[],Om=`skip`;function km(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=ym(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Em(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Dm,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Am(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Am(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Dm:[e]}function jm(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),km(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Mm={}.hasOwnProperty,Nm={};function Pm(e,t){let n=t||Nm,r=new Map,i=new Map,a={all:s,applyData:Im,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...rm,...n.handlers},one:o,options:n,patch:Fm,wrap:Rm};return jm(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(Mm.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=hm(n);return r.children=a.all(e),r}return hm(e)}return(a.options.unknownHandler||Lm)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=zm(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=zm(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Fm(e,t){e.position&&(t.position=Gl(e))}function Im(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,hm(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Lm(e,t){let n=t.data||{},r=`value`in t&&!(Mm.call(n,`hProperties`)||Mm.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Rm(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
55
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
56
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
57
|
-
`}),n}function zm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Bm(e,t){let n=Pm(e,t),r=n.one(e,void 0),i=vm(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
58
|
-
`},i)),a}function Vm(e,t){return e&&`run`in e?async function(n,r){let i=Bm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Bm(n,{file:r,...e||t})}}function Hm(e){if(e)throw e}var Um=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Wm(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Gm(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Km(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Km(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var qm={basename:Jm,dirname:Ym,extname:Xm,join:Zm,sep:`/`};function Jm(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);eh(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Ym(e){if(eh(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Xm(e){eh(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Zm(...e){let t=-1,n;for(;++t<e.length;)eh(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Qm(n)}function Qm(e){eh(e);let t=e.codePointAt(0)===47,n=$m(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function $m(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function eh(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var th={cwd:nh};function nh(){return`/`}function rh(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function ih(e){if(typeof e==`string`)e=new URL(e);else if(!rh(e)){let t=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:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return ah(e)}function ah(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var oh=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],sh=class{constructor(e){let t;t=e?rh(e)?{path:e}:typeof e==`string`||dh(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:th.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<oh.length;){let e=oh[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)oh.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?qm.basename(this.path):void 0}set basename(e){lh(e,`basename`),ch(e,`basename`),this.path=qm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?qm.dirname(this.path):void 0}set dirname(e){uh(this.basename,`dirname`),this.path=qm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?qm.extname(this.path):void 0}set extname(e){if(ch(e,`extname`),uh(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=qm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){rh(e)&&(e=ih(e)),lh(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?qm.basename(this.path,this.extname):void 0}set stem(e){lh(e,`stem`),ch(e,`stem`),this.path=qm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Xl(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function ch(e,t){if(e&&e.includes(qm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+qm.sep+"`")}function lh(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function uh(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function dh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var fh=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),ph=e(Um(),1),mh={}.hasOwnProperty,hh=new class e extends fh{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=Gm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,ph.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(vh(`data`,this.frozen),this.namespace[e]=t,this):mh.call(this.namespace,e)&&this.namespace[e]||void 0:e?(vh(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=xh(e),n=this.parser||this.Parser;return gh(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),gh(`process`,this.parser||this.Parser),_h(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=xh(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Ch(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),gh(`processSync`,this.parser||this.Parser),_h(`processSync`,this.compiler||this.Compiler),this.process(e,r),bh(`processSync`,`process`,t),n;function r(e,r){t=!0,Hm(e),n=r}}run(e,t,n){yh(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=xh(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),bh(`runSync`,`run`,n),r;function i(e,t){Hm(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=xh(t),r=this.compiler||this.Compiler;return _h(`stringify`,r),yh(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(vh(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw 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(e.plugins),e.settings&&(r.settings=(0,ph.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Wm(o)&&Wm(r)&&(r=(0,ph.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function gh(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function _h(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function vh(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yh(e){if(!Wm(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function bh(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xh(e){return Sh(e)?e:new sh(e)}function Sh(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Ch(e){return typeof e==`string`||wh(e)}function wh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Th=[],Eh={allowDangerousHtml:!0},Dh=/^(https?|ircs?|mailto|xmpp)$/i,Oh=[{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 kh(e){let t=Ah(e),n=jh(e);return Mh(t.runSync(t.parse(n),n),e)}function Ah(e){let t=e.rehypePlugins||Th,n=e.remarkPlugins||Th,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Eh}:Eh;return hh().use(Ep).use(n).use(Vm,r).use(t)}function jh(e){let t=e.children||``,n=new sh;return typeof t==`string`?n.value=t:``+t,n}function Mh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Nh;for(let e of Oh)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return jm(e,l),ru(e,{Fragment:W.Fragment,components:i,ignoreInvalidStyle:!0,jsx:W.jsx,jsxs:W.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Tu)if(Object.hasOwn(Tu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Tu[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Nh(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Dh.test(e.slice(0,t))?e:``}function Ph({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,blockedImageClass:i=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:a=`text-gray-500`}){let o=t.length&&!t.every(e=>e===`*`),s=n.length&&!n.every(e=>e===`*`);if(!e&&(o||s))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return o=>{jm(o,Bh(e,t,n,r,i,a))}}function Fh(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}return null}}function Ih(e){return typeof e==`string`?e.startsWith(`/`):!1}var Lh=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`]);function Rh(e,t,n,r=!1,i=!1){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;let a=Fh(e,n);if(!a||!Lh.has(a.protocol))return null;if(a.protocol===`mailto:`)return a.href;let o=Ih(e);return a&&t.some(e=>{let t=Fh(e,n);return!t||t.origin!==a.origin?!1:a.href.startsWith(t.href)})?o?a.pathname+a.search+a.hash:a.href:t.includes(`*`)?a.protocol!==`https:`&&a.protocol!==`http:`?null:o?a.pathname+a.search+a.hash:a.href:null}var zh=Symbol(`node-seen`),Bh=(e,t,n,r,i,a)=>{let o=(s,c,l)=>{if(s.type!==`element`||s[zh])return!0;if(s.tagName===`a`){let n=Rh(s.properties.href,t,e,!1,!1);return n===null?(s[zh]=!0,jm(s,o),l&&typeof c==`number`&&(l.children[c]={type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(s.properties.href),class:a},children:[...s.children,{type:`text`,value:` [blocked]`}]}),Om):(s.properties.href=n,s.properties.target=`_blank`,s.properties.rel=`noopener noreferrer`,!0)}if(s.tagName===`img`){let t=Rh(s.properties.src,n,e,r,!0);return t===null?(s[zh]=!0,jm(s,o),l&&typeof c==`number`&&(l.children[c]={type:`element`,tagName:`span`,properties:{class:i},children:[{type:`text`,value:`[Image blocked: `+String(s.properties.alt||`No description`)+`]`}]}),Om):(s.properties.src=t,!0)}return!0};return o};function Vh(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=Hh(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=Hh(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function Hh(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
59
|
-
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var Uh={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},Wh={}.hasOwnProperty,Gh=Object.prototype;function Kh(e,t){let n=t||{};return qh({file:n.file||void 0,location:!1,schema:n.space===`svg`?Ln:qn,verbose:n.verbose||!1},e)}function qh(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},Xh(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:Jh(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=Vh(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},Xh(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},Xh(e,r,n),n}default:return n=Yh(e,t),n}}function Jh(e,t){let n=-1,r=[];for(;++n<t.length;){let i=qh(e,t[n]);r.push(i)}return r}function Yh(e,t){let n=e.schema;e.schema=t.namespaceURI===Uh.svg?Ln:qn;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;Wh.call(Gh,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?Gn:Hn)(t.tagName,i,Jh(e,t.childNodes));if(Xh(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&Qh(r.startTag),o=r&&r.endTag&&Qh(r.endTag),s=qh(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function Xh(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=Zh(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function Zh(e,t,n){let r=Qh(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)Wh.call(n.attrs,i)&&(r[Rn(e.schema,i).property]=Qh(n.attrs[i]));n.startTag;let a=Qh(n.startTag),o=n.endTag?Qh(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function Qh(e){let t=$h({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=$h({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function $h(e){return e.line&&e.column?e:void 0}var eg=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),G;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(G||={});var tg={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function ng(e){return e>=55296&&e<=57343}function rg(e){return e>=56320&&e<=57343}function ig(e,t){return(e-55296)*1024+9216+t}function ag(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function og(e){return e>=64976&&e<=65007||eg.has(e)}var K;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(K||={});var sg=65536,cg=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=sg,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(rg(t))return this.pos++,this._addGap(),ig(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(K.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let n=this.html.charCodeAt(t);return n===G.CARRIAGE_RETURN?G.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let e=this.html.charCodeAt(this.pos);return e===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):e===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,ng(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===G.LINE_FEED||e===G.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){ag(e)?this._err(K.controlCharacterInInputStream):og(e)&&this._err(K.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},lg;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(lg||={});function ug(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var dg=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),fg=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function pg(e){return e>=55296&&e<=57343||e>1114111?65533:fg.get(e)??e}var mg;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(mg||={});var hg=32,gg;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(gg||={});function _g(e){return e>=mg.ZERO&&e<=mg.NINE}function vg(e){return e>=mg.UPPER_A&&e<=mg.UPPER_F||e>=mg.LOWER_A&&e<=mg.LOWER_F}function yg(e){return e>=mg.UPPER_A&&e<=mg.UPPER_Z||e>=mg.LOWER_A&&e<=mg.LOWER_Z||_g(e)}function bg(e){return e===mg.EQUALS||yg(e)}var xg;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(xg||={});var Sg;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Sg||={});var Cg=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=xg.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Sg.Strict}startEntity(e){this.decodeMode=e,this.state=xg.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case xg.EntityStart:return e.charCodeAt(t)===mg.NUM?(this.state=xg.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=xg.NamedEntity,this.stateNamedEntity(e,t));case xg.NumericStart:return this.stateNumericStart(e,t);case xg.NumericDecimal:return this.stateNumericDecimal(e,t);case xg.NumericHex:return this.stateNumericHex(e,t);case xg.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|hg)===mg.LOWER_X?(this.state=xg.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=xg.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(_g(r)||vg(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(_g(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===mg.SEMI)this.consumed+=1;else if(this.decodeMode===Sg.Strict)return 0;return this.emitCodePoint(pg(this.result),this.consumed),this.errors&&(e!==mg.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&gg.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=wg(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Sg.Attribute&&(i===0||bg(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&gg.VALUE_LENGTH)>>14,i!==0){if(a===mg.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Sg.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&gg.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~gg.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case xg.NamedEntity:return this.result!==0&&(this.decodeMode!==Sg.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case xg.NumericDecimal:return this.emitNumericEntity(0,2);case xg.NumericHex:return this.emitNumericEntity(0,3);case xg.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case xg.EntityStart:return 0}}};function wg(e,t,n,r){let i=(t&gg.BRANCH_LENGTH)>>7,a=t&gg.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var q;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(q||={});var Tg;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(Tg||={});var Eg;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(Eg||={});var J;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(J||={});var Y;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(Y||={});var Dg=new Map([[J.A,Y.A],[J.ADDRESS,Y.ADDRESS],[J.ANNOTATION_XML,Y.ANNOTATION_XML],[J.APPLET,Y.APPLET],[J.AREA,Y.AREA],[J.ARTICLE,Y.ARTICLE],[J.ASIDE,Y.ASIDE],[J.B,Y.B],[J.BASE,Y.BASE],[J.BASEFONT,Y.BASEFONT],[J.BGSOUND,Y.BGSOUND],[J.BIG,Y.BIG],[J.BLOCKQUOTE,Y.BLOCKQUOTE],[J.BODY,Y.BODY],[J.BR,Y.BR],[J.BUTTON,Y.BUTTON],[J.CAPTION,Y.CAPTION],[J.CENTER,Y.CENTER],[J.CODE,Y.CODE],[J.COL,Y.COL],[J.COLGROUP,Y.COLGROUP],[J.DD,Y.DD],[J.DESC,Y.DESC],[J.DETAILS,Y.DETAILS],[J.DIALOG,Y.DIALOG],[J.DIR,Y.DIR],[J.DIV,Y.DIV],[J.DL,Y.DL],[J.DT,Y.DT],[J.EM,Y.EM],[J.EMBED,Y.EMBED],[J.FIELDSET,Y.FIELDSET],[J.FIGCAPTION,Y.FIGCAPTION],[J.FIGURE,Y.FIGURE],[J.FONT,Y.FONT],[J.FOOTER,Y.FOOTER],[J.FOREIGN_OBJECT,Y.FOREIGN_OBJECT],[J.FORM,Y.FORM],[J.FRAME,Y.FRAME],[J.FRAMESET,Y.FRAMESET],[J.H1,Y.H1],[J.H2,Y.H2],[J.H3,Y.H3],[J.H4,Y.H4],[J.H5,Y.H5],[J.H6,Y.H6],[J.HEAD,Y.HEAD],[J.HEADER,Y.HEADER],[J.HGROUP,Y.HGROUP],[J.HR,Y.HR],[J.HTML,Y.HTML],[J.I,Y.I],[J.IMG,Y.IMG],[J.IMAGE,Y.IMAGE],[J.INPUT,Y.INPUT],[J.IFRAME,Y.IFRAME],[J.KEYGEN,Y.KEYGEN],[J.LABEL,Y.LABEL],[J.LI,Y.LI],[J.LINK,Y.LINK],[J.LISTING,Y.LISTING],[J.MAIN,Y.MAIN],[J.MALIGNMARK,Y.MALIGNMARK],[J.MARQUEE,Y.MARQUEE],[J.MATH,Y.MATH],[J.MENU,Y.MENU],[J.META,Y.META],[J.MGLYPH,Y.MGLYPH],[J.MI,Y.MI],[J.MO,Y.MO],[J.MN,Y.MN],[J.MS,Y.MS],[J.MTEXT,Y.MTEXT],[J.NAV,Y.NAV],[J.NOBR,Y.NOBR],[J.NOFRAMES,Y.NOFRAMES],[J.NOEMBED,Y.NOEMBED],[J.NOSCRIPT,Y.NOSCRIPT],[J.OBJECT,Y.OBJECT],[J.OL,Y.OL],[J.OPTGROUP,Y.OPTGROUP],[J.OPTION,Y.OPTION],[J.P,Y.P],[J.PARAM,Y.PARAM],[J.PLAINTEXT,Y.PLAINTEXT],[J.PRE,Y.PRE],[J.RB,Y.RB],[J.RP,Y.RP],[J.RT,Y.RT],[J.RTC,Y.RTC],[J.RUBY,Y.RUBY],[J.S,Y.S],[J.SCRIPT,Y.SCRIPT],[J.SEARCH,Y.SEARCH],[J.SECTION,Y.SECTION],[J.SELECT,Y.SELECT],[J.SOURCE,Y.SOURCE],[J.SMALL,Y.SMALL],[J.SPAN,Y.SPAN],[J.STRIKE,Y.STRIKE],[J.STRONG,Y.STRONG],[J.STYLE,Y.STYLE],[J.SUB,Y.SUB],[J.SUMMARY,Y.SUMMARY],[J.SUP,Y.SUP],[J.TABLE,Y.TABLE],[J.TBODY,Y.TBODY],[J.TEMPLATE,Y.TEMPLATE],[J.TEXTAREA,Y.TEXTAREA],[J.TFOOT,Y.TFOOT],[J.TD,Y.TD],[J.TH,Y.TH],[J.THEAD,Y.THEAD],[J.TITLE,Y.TITLE],[J.TR,Y.TR],[J.TRACK,Y.TRACK],[J.TT,Y.TT],[J.U,Y.U],[J.UL,Y.UL],[J.SVG,Y.SVG],[J.VAR,Y.VAR],[J.WBR,Y.WBR],[J.XMP,Y.XMP]]);function Og(e){return Dg.get(e)??Y.UNKNOWN}var X=Y,kg={[q.HTML]:new Set([X.ADDRESS,X.APPLET,X.AREA,X.ARTICLE,X.ASIDE,X.BASE,X.BASEFONT,X.BGSOUND,X.BLOCKQUOTE,X.BODY,X.BR,X.BUTTON,X.CAPTION,X.CENTER,X.COL,X.COLGROUP,X.DD,X.DETAILS,X.DIR,X.DIV,X.DL,X.DT,X.EMBED,X.FIELDSET,X.FIGCAPTION,X.FIGURE,X.FOOTER,X.FORM,X.FRAME,X.FRAMESET,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HEADER,X.HGROUP,X.HR,X.HTML,X.IFRAME,X.IMG,X.INPUT,X.LI,X.LINK,X.LISTING,X.MAIN,X.MARQUEE,X.MENU,X.META,X.NAV,X.NOEMBED,X.NOFRAMES,X.NOSCRIPT,X.OBJECT,X.OL,X.P,X.PARAM,X.PLAINTEXT,X.PRE,X.SCRIPT,X.SECTION,X.SELECT,X.SOURCE,X.STYLE,X.SUMMARY,X.TABLE,X.TBODY,X.TD,X.TEMPLATE,X.TEXTAREA,X.TFOOT,X.TH,X.THEAD,X.TITLE,X.TR,X.TRACK,X.UL,X.WBR,X.XMP]),[q.MATHML]:new Set([X.MI,X.MO,X.MN,X.MS,X.MTEXT,X.ANNOTATION_XML]),[q.SVG]:new Set([X.TITLE,X.FOREIGN_OBJECT,X.DESC]),[q.XLINK]:new Set,[q.XML]:new Set,[q.XMLNS]:new Set},Ag=new Set([X.H1,X.H2,X.H3,X.H4,X.H5,X.H6]);new Set([J.STYLE,J.SCRIPT,J.XMP,J.IFRAME,J.NOEMBED,J.NOFRAMES,J.PLAINTEXT]);var Z;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Z||={});var jg={DATA:Z.DATA,RCDATA:Z.RCDATA,RAWTEXT:Z.RAWTEXT,SCRIPT_DATA:Z.SCRIPT_DATA,PLAINTEXT:Z.PLAINTEXT,CDATA_SECTION:Z.CDATA_SECTION};function Mg(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function Ng(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function Pg(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function Fg(e){return Pg(e)||Ng(e)}function Ig(e){return Fg(e)||Mg(e)}function Lg(e){return e+32}function Rg(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function zg(e){return Rg(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function Bg(e){return e===G.NULL?K.nullCharacterReference:e>1114111?K.characterReferenceOutsideUnicodeRange:ng(e)?K.surrogateCharacterReference:og(e)?K.noncharacterCharacterReference:ag(e)||e===G.CARRIAGE_RETURN?K.controlCharacterReference:null}var Vg=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Z.DATA,this.returnState=Z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new cg(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Cg(dg,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(K.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(K.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=Bg(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:lg.START_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:lg.END_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:lg.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:lg.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(ug(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(K.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=Og(e.tagName),e.type===lg.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(K.endTagWithAttributes),e.selfClosing&&this._err(K.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case lg.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case lg.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case lg.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:lg.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=Rg(e)?lg.WHITESPACE_CHARACTER:e===G.NULL?lg.NULL_CHARACTER:lg.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(lg.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Sg.Attribute:Sg.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Z.DATA:this._stateData(e);break;case Z.RCDATA:this._stateRcdata(e);break;case Z.RAWTEXT:this._stateRawtext(e);break;case Z.SCRIPT_DATA:this._stateScriptData(e);break;case Z.PLAINTEXT:this._statePlaintext(e);break;case Z.TAG_OPEN:this._stateTagOpen(e);break;case Z.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Z.TAG_NAME:this._stateTagName(e);break;case Z.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Z.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Z.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Z.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Z.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Z.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Z.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Z.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Z.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Z.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Z.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Z.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Z.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Z.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Z.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Z.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Z.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Z.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Z.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Z.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Z.BOGUS_COMMENT:this._stateBogusComment(e);break;case Z.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Z.COMMENT_START:this._stateCommentStart(e);break;case Z.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Z.COMMENT:this._stateComment(e);break;case Z.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Z.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Z.COMMENT_END:this._stateCommentEnd(e);break;case Z.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Z.DOCTYPE:this._stateDoctype(e);break;case Z.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Z.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Z.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Z.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Z.CDATA_SECTION:this._stateCdataSection(e);break;case Z.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Z.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Z.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Z.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.TAG_OPEN;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitCodePoint(e);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case G.AMPERSAND:this._startCharacterReference();break;case G.LESS_THAN_SIGN:this.state=Z.RCDATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.RAWTEXT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Fg(e))this._createStartTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.EXCLAMATION_MARK:this.state=Z.MARKUP_DECLARATION_OPEN;break;case G.SOLIDUS:this.state=Z.END_TAG_OPEN;break;case G.QUESTION_MARK:this._err(K.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e);break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Z.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Fg(e))this._createEndTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.GREATER_THAN_SIGN:this._err(K.missingEndTagName),this.state=Z.DATA;break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.tagName+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(Ng(e)?Lg(e):e)}}_stateRcdataLessThanSign(e){e===G.SOLIDUS?this.state=Z.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Fg(e)?(this.state=Z.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Z.BEFORE_ATTRIBUTE_NAME,!1;case G.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Z.SELF_CLOSING_START_TAG,!1;case G.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Z.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===G.SOLIDUS?this.state=Z.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Fg(e)?(this.state=Z.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case G.SOLIDUS:this.state=Z.SCRIPT_DATA_END_TAG_OPEN;break;case G.EXCLAMATION_MARK:this.state=Z.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Fg(e)?(this.state=Z.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===G.SOLIDUS?this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Fg(e)?(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Fg(e)?(this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(tg.SCRIPT,!1)&&zg(this.preprocessor.peek(tg.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<tg.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===G.SOLIDUS?(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(tg.SCRIPT,!1)&&zg(this.preprocessor.peek(tg.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<tg.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._err(K.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Z.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this._leaveAttrName(),this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._leaveAttrName(),this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:this._err(K.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(Ng(e)?Lg(e):e)}}_stateAfterAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.EQUALS_SIGN:this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:this.state=Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case G.APOSTROPHE:this.state=Z.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingAttributeValue),this.state=Z.DATA,this.emitCurrentTagToken();break;default:this.state=Z.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case G.APOSTROPHE:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.AMPERSAND:this._startCharacterReference();break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:case G.EQUALS_SIGN:case G.GRAVE_ACCENT:this._err(K.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this._leaveAttrValue(),this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.missingWhitespaceBetweenAttributes),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case G.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Z.DATA,this.emitCurrentTagToken();break}case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.unexpectedSolidusInTag),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(tg.DASH_DASH,!0)?(this._createCommentToken(tg.DASH_DASH.length+1),this.state=Z.COMMENT_START):this._consumeSequenceIfMatch(tg.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(tg.DOCTYPE.length+1),this.state=Z.DOCTYPE):this._consumeSequenceIfMatch(tg.CDATA_START,!0)?this.inForeignNode?this.state=Z.CDATA_SECTION:(this._err(K.cdataInHtmlContent),this._createCommentToken(tg.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Z.BOGUS_COMMENT):this._ensureHibernation()||(this._err(K.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_START_DASH;break;case G.GREATER_THAN_SIGN:{this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.GREATER_THAN_SIGN:this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END_DASH;break;case G.LESS_THAN_SIGN:t.data+=`<`,this.state=Z.COMMENT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case G.EXCLAMATION_MARK:t.data+=`!`,this.state=Z.COMMENT_LESS_THAN_SIGN_BANG;break;case G.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Z.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Z.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==G.GREATER_THAN_SIGN&&e!==G.EOF&&this._err(K.nestedComment),this.state=Z.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EXCLAMATION_MARK:this.state=Z.COMMENT_END_BANG;break;case G.HYPHEN_MINUS:t.data+=`-`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:t.data+=`--!`,this.state=Z.COMMENT_END_DASH;break;case G.GREATER_THAN_SIGN:this._err(K.incorrectlyClosedComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Z.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(K.missingWhitespaceBeforeDoctypeName),this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Ng(e))this._createDoctypeToken(String.fromCharCode(Lg(e))),this.state=Z.DOCTYPE_NAME;else switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.NULL:this._err(K.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Z.DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:{this._err(K.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Z.DATA;break}case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Z.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.AFTER_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.NULL:this._err(K.unexpectedNullCharacter),t.name+=`�`;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(Ng(e)?Lg(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(tg.PUBLIC,!1)?this.state=Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(tg.SYSTEM,!1)?this.state=Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(K.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.NULL:this._err(K.unexpectedNullCharacter);break;case G.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case G.RIGHT_SQUARE_BRACKET:this.state=Z.CDATA_SECTION_BRACKET;break;case G.EOF:this._err(K.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===G.RIGHT_SQUARE_BRACKET?this.state=Z.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA;break;case G.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(G.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Ig(this.preprocessor.peek(1))?Z.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Ig(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===G.SEMICOLON&&this._err(K.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},Hg=new Set([Y.DD,Y.DT,Y.LI,Y.OPTGROUP,Y.OPTION,Y.P,Y.RB,Y.RP,Y.RT,Y.RTC]),Ug=new Set([...Hg,Y.CAPTION,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]),Wg=new Set([Y.APPLET,Y.CAPTION,Y.HTML,Y.MARQUEE,Y.OBJECT,Y.TABLE,Y.TD,Y.TEMPLATE,Y.TH]),Gg=new Set([...Wg,Y.OL,Y.UL]),Kg=new Set([...Wg,Y.BUTTON]),qg=new Set([Y.ANNOTATION_XML,Y.MI,Y.MN,Y.MO,Y.MS,Y.MTEXT]),Jg=new Set([Y.DESC,Y.FOREIGN_OBJECT,Y.TITLE]),Yg=new Set([Y.TR,Y.TEMPLATE,Y.HTML]),Xg=new Set([Y.TBODY,Y.TFOOT,Y.THEAD,Y.TEMPLATE,Y.HTML]),Zg=new Set([Y.TABLE,Y.TEMPLATE,Y.HTML]),Qg=new Set([Y.TD,Y.TH]),$g=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=Y.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===Y.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===q.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==q.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Ag,q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Qg,q.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(Zg,q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Xg,q.HTML)}clearBackToTableRowContext(){this.clearBackTo(Yg,q.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===Y.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===Y.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case q.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case q.SVG:if(Jg.has(r))return!1;break;case q.MATHML:if(qg.has(r))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Wg)}hasInListItemScope(e){return this.hasInDynamicScope(e,Gg)}hasInButtonScope(e){return this.hasInDynamicScope(e,Kg)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case q.HTML:if(Ag.has(t))return!0;if(Wg.has(t))return!1;break;case q.SVG:if(Jg.has(t))return!1;break;case q.MATHML:if(qg.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===q.HTML)switch(this.tagIDs[e]){case Y.TBODY:case Y.THEAD:case Y.TFOOT:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.OPTION:case Y.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Hg.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Ug.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Ug.has(this.currentTagId);)this.pop()}},e_=3,t_;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(t_||={});var n_={type:t_.Marker},r_=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===t_.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<e_)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<e_)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=e_&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(n_)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:t_.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:t_.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(n_);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===t_.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===t_.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===t_.Element&&t.element===e)}},i_={createDocument(){return{nodeName:`#document`,mode:Eg.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};i_.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(i_.isTextNode(n)){n.value+=t;return}}i_.appendChild(e,i_.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&i_.isTextNode(r)?r.value+=t:i_.insertBefore(e,i_.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},a_=`html`,o_=`about:legacy-compat`,s_=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,c_=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),l_=[...c_,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],u_=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),d_=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],f_=[...d_,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function p_(e,t){return t.some(t=>e.startsWith(t))}function m_(e){return e.name===a_&&e.publicId===null&&(e.systemId===null||e.systemId===o_)}function h_(e){if(e.name!==a_)return Eg.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===s_)return Eg.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),u_.has(n))return Eg.QUIRKS;let e=t===null?l_:c_;if(p_(n,e))return Eg.QUIRKS;if(e=t===null?d_:f_,p_(n,e))return Eg.LIMITED_QUIRKS}return Eg.NO_QUIRKS}var g_={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},__=`definitionurl`,v_=`definitionURL`,y_=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),b_=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:q.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:q.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:q.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:q.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:q.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:q.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:q.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:q.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:q.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:q.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:q.XMLNS}]]),x_=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),S_=new Set([Y.B,Y.BIG,Y.BLOCKQUOTE,Y.BODY,Y.BR,Y.CENTER,Y.CODE,Y.DD,Y.DIV,Y.DL,Y.DT,Y.EM,Y.EMBED,Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6,Y.HEAD,Y.HR,Y.I,Y.IMG,Y.LI,Y.LISTING,Y.MENU,Y.META,Y.NOBR,Y.OL,Y.P,Y.PRE,Y.RUBY,Y.S,Y.SMALL,Y.SPAN,Y.STRONG,Y.STRIKE,Y.SUB,Y.SUP,Y.TABLE,Y.TT,Y.U,Y.UL,Y.VAR]);function C_(e){let t=e.tagID;return t===Y.FONT&&e.attrs.some(({name:e})=>e===Tg.COLOR||e===Tg.SIZE||e===Tg.FACE)||S_.has(t)}function w_(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===__){e.attrs[t].name=v_;break}}function T_(e){for(let t=0;t<e.attrs.length;t++){let n=y_.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function E_(e){for(let t=0;t<e.attrs.length;t++){let n=b_.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function D_(e){let t=x_.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Og(e.tagName))}function O_(e,t){return t===q.MATHML&&(e===Y.MI||e===Y.MO||e===Y.MN||e===Y.MS||e===Y.MTEXT)}function k_(e,t,n){if(t===q.MATHML&&e===Y.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===Tg.ENCODING){let t=n[e].value.toLowerCase();return t===g_.TEXT_HTML||t===g_.APPLICATION_XML}}return t===q.SVG&&(e===Y.FOREIGN_OBJECT||e===Y.DESC||e===Y.TITLE)}function A_(e,t,n,r){return(!r||r===q.HTML)&&k_(e,t,n)||(!r||r===q.MATHML)&&O_(e,t)}var j_=`hidden`,M_=8,N_=3,Q;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(Q||={});var P_={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},F_=new Set([Y.TABLE,Y.TBODY,Y.TFOOT,Y.THEAD,Y.TR]),I_={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:i_,onParseError:null},L_=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Q.INITIAL,this.originalInsertionMode=Q.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...I_,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Vg(this.options,this),this.activeFormattingElements=new r_(this.treeAdapter),this.fragmentContextID=n?Og(this.treeAdapter.getTagName(n)):Y.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new $g(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...I_,...t};e??=n.treeAdapter.createElement(J.TEMPLATE,q.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,q.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===Y.TEMPLATE&&i.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??P_,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===q.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,q.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Q.TEXT}switchToPlaintextParsing(){this.insertionMode=Q.TEXT,this.originalInsertionMode=Q.IN_BODY,this.tokenizer.state=jg.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===J.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==q.HTML))switch(this.fragmentContextID){case Y.TITLE:case Y.TEXTAREA:this.tokenizer.state=jg.RCDATA;break;case Y.STYLE:case Y.XMP:case Y.IFRAME:case Y.NOEMBED:case Y.NOFRAMES:case Y.NOSCRIPT:this.tokenizer.state=jg.RAWTEXT;break;case Y.SCRIPT:this.tokenizer.state=jg.SCRIPT_DATA;break;case Y.PLAINTEXT:this.tokenizer.state=jg.PLAINTEXT;break;default:}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,q.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,q.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(J.HTML,q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,Y.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===lg.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===Y.SVG&&this.treeAdapter.getTagName(t)===J.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===q.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===Y.MGLYPH||e.tagID===Y.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,q.HTML)}_processToken(e){switch(e.type){case lg.CHARACTER:this.onCharacter(e);break;case lg.NULL_CHARACTER:this.onNullCharacter(e);break;case lg.COMMENT:this.onComment(e);break;case lg.DOCTYPE:this.onDoctype(e);break;case lg.START_TAG:this._processStartTag(e);break;case lg.END_TAG:this.onEndTag(e);break;case lg.EOF:this.onEof(e);break;case lg.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,n){return A_(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===t_.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(Y.P),this.openElements.popUntilTagNamePopped(Y.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case Y.TR:this.insertionMode=Q.IN_ROW;return;case Y.TBODY:case Y.THEAD:case Y.TFOOT:this.insertionMode=Q.IN_TABLE_BODY;return;case Y.CAPTION:this.insertionMode=Q.IN_CAPTION;return;case Y.COLGROUP:this.insertionMode=Q.IN_COLUMN_GROUP;return;case Y.TABLE:this.insertionMode=Q.IN_TABLE;return;case Y.BODY:this.insertionMode=Q.IN_BODY;return;case Y.FRAMESET:this.insertionMode=Q.IN_FRAMESET;return;case Y.SELECT:this._resetInsertionModeForSelect(e);return;case Y.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case Y.HTML:this.insertionMode=this.headElement?Q.AFTER_HEAD:Q.BEFORE_HEAD;return;case Y.TD:case Y.TH:if(e>0){this.insertionMode=Q.IN_CELL;return}break;case Y.HEAD:if(e>0){this.insertionMode=Q.IN_HEAD;return}break}this.insertionMode=Q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===Y.TEMPLATE)break;if(e===Y.TABLE){this.insertionMode=Q.IN_SELECT_IN_TABLE;return}}this.insertionMode=Q.IN_SELECT}_isElementCausesFosterParenting(e){return F_.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case Y.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===q.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case Y.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return kg[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){tb(this,e);return}switch(this.insertionMode){case Q.INITIAL:X_(this,e);break;case Q.BEFORE_HTML:$_(this,e);break;case Q.BEFORE_HEAD:nv(this,e);break;case Q.IN_HEAD:ov(this,e);break;case Q.IN_HEAD_NO_SCRIPT:lv(this,e);break;case Q.AFTER_HEAD:fv(this,e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:hv(this,e);break;case Q.TEXT:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:uy(this,e);break;case Q.IN_TABLE_TEXT:Cy(this,e);break;case Q.IN_COLUMN_GROUP:Ay(this,e);break;case Q.AFTER_BODY:Ky(this,e);break;case Q.AFTER_AFTER_BODY:Qy(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){eb(this,e);return}switch(this.insertionMode){case Q.INITIAL:X_(this,e);break;case Q.BEFORE_HTML:$_(this,e);break;case Q.BEFORE_HEAD:nv(this,e);break;case Q.IN_HEAD:ov(this,e);break;case Q.IN_HEAD_NO_SCRIPT:lv(this,e);break;case Q.AFTER_HEAD:fv(this,e);break;case Q.TEXT:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:uy(this,e);break;case Q.IN_COLUMN_GROUP:Ay(this,e);break;case Q.AFTER_BODY:Ky(this,e);break;case Q.AFTER_AFTER_BODY:Qy(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){G_(this,e);return}switch(this.insertionMode){case Q.INITIAL:case Q.BEFORE_HTML:case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_TEMPLATE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:G_(this,e);break;case Q.IN_TABLE_TEXT:wy(this,e);break;case Q.AFTER_BODY:K_(this,e);break;case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:q_(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Q.INITIAL:Y_(this,e);break;case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:this._err(e,K.misplacedDoctype);break;case Q.IN_TABLE_TEXT:wy(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,K.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?rb(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:X_(this,e);break;case Q.BEFORE_HTML:Z_(this,e);break;case Q.BEFORE_HEAD:ev(this,e);break;case Q.IN_HEAD:rv(this,e);break;case Q.IN_HEAD_NO_SCRIPT:sv(this,e);break;case Q.AFTER_HEAD:uv(this,e);break;case Q.IN_BODY:Jv(this,e);break;case Q.IN_TABLE:yy(this,e);break;case Q.IN_TABLE_TEXT:wy(this,e);break;case Q.IN_CAPTION:Ey(this,e);break;case Q.IN_COLUMN_GROUP:Oy(this,e);break;case Q.IN_TABLE_BODY:jy(this,e);break;case Q.IN_ROW:Ny(this,e);break;case Q.IN_CELL:Fy(this,e);break;case Q.IN_SELECT:Ly(this,e);break;case Q.IN_SELECT_IN_TABLE:zy(this,e);break;case Q.IN_TEMPLATE:Vy(this,e);break;case Q.AFTER_BODY:Wy(this,e);break;case Q.IN_FRAMESET:qy(this,e);break;case Q.AFTER_FRAMESET:Yy(this,e);break;case Q.AFTER_AFTER_BODY:Zy(this,e);break;case Q.AFTER_AFTER_FRAMESET:$y(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?ib(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:X_(this,e);break;case Q.BEFORE_HTML:Q_(this,e);break;case Q.BEFORE_HEAD:tv(this,e);break;case Q.IN_HEAD:iv(this,e);break;case Q.IN_HEAD_NO_SCRIPT:cv(this,e);break;case Q.AFTER_HEAD:dv(this,e);break;case Q.IN_BODY:oy(this,e);break;case Q.TEXT:cy(this,e);break;case Q.IN_TABLE:by(this,e);break;case Q.IN_TABLE_TEXT:wy(this,e);break;case Q.IN_CAPTION:Dy(this,e);break;case Q.IN_COLUMN_GROUP:ky(this,e);break;case Q.IN_TABLE_BODY:My(this,e);break;case Q.IN_ROW:Py(this,e);break;case Q.IN_CELL:Iy(this,e);break;case Q.IN_SELECT:Ry(this,e);break;case Q.IN_SELECT_IN_TABLE:By(this,e);break;case Q.IN_TEMPLATE:Hy(this,e);break;case Q.AFTER_BODY:Gy(this,e);break;case Q.IN_FRAMESET:Jy(this,e);break;case Q.AFTER_FRAMESET:Xy(this,e);break;case Q.AFTER_AFTER_BODY:Qy(this,e);break;default:}}onEof(e){switch(this.insertionMode){case Q.INITIAL:X_(this,e);break;case Q.BEFORE_HTML:$_(this,e);break;case Q.BEFORE_HEAD:nv(this,e);break;case Q.IN_HEAD:ov(this,e);break;case Q.IN_HEAD_NO_SCRIPT:lv(this,e);break;case Q.AFTER_HEAD:fv(this,e);break;case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:sy(this,e);break;case Q.TEXT:ly(this,e);break;case Q.IN_TABLE_TEXT:wy(this,e);break;case Q.IN_TEMPLATE:Uy(this,e);break;case Q.AFTER_BODY:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:J_(this,e);break;default:}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===G.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.TEXT:case Q.IN_COLUMN_GROUP:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:this._insertCharacters(e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:case Q.AFTER_BODY:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:mv(this,e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:uy(this,e);break;case Q.IN_TABLE_TEXT:Sy(this,e);break;default:}}};function R_(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):ay(e,t),n}function z_(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function B_(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=N_;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=V_(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function V_(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function H_(e,t,n){let r=Og(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===Y.TEMPLATE&&i===q.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function U_(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function W_(e,t){for(let n=0;n<M_;n++){let n=R_(e,t);if(!n)break;let r=z_(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=B_(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&H_(e,a,i),U_(e,r,n)}}function G_(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function K_(e,t){e._appendCommentNode(t,e.openElements.items[0])}function q_(e,t){e._appendCommentNode(t,e.document)}function J_(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function Y_(e,t){e._setDocumentType(t);let n=t.forceQuirks?Eg.QUIRKS:h_(t);m_(t)||e._err(t,K.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Q.BEFORE_HTML}function X_(e,t){e._err(t,K.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Eg.QUIRKS),e.insertionMode=Q.BEFORE_HTML,e._processToken(t)}function Z_(e,t){t.tagID===Y.HTML?(e._insertElement(t,q.HTML),e.insertionMode=Q.BEFORE_HEAD):$_(e,t)}function Q_(e,t){let n=t.tagID;(n===Y.HTML||n===Y.HEAD||n===Y.BODY||n===Y.BR)&&$_(e,t)}function $_(e,t){e._insertFakeRootElement(),e.insertionMode=Q.BEFORE_HEAD,e._processToken(t)}function ev(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.HEAD:e._insertElement(t,q.HTML),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD;break;default:nv(e,t)}}function tv(e,t){let n=t.tagID;n===Y.HEAD||n===Y.BODY||n===Y.HTML||n===Y.BR?nv(e,t):e._err(t,K.endTagWithoutMatchingOpenElement)}function nv(e,t){e._insertFakeElement(J.HEAD,Y.HEAD),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD,e._processToken(t)}function rv(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TITLE:e._switchToTextParsing(t,jg.RCDATA);break;case Y.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,jg.RAWTEXT):(e._insertElement(t,q.HTML),e.insertionMode=Q.IN_HEAD_NO_SCRIPT);break;case Y.NOFRAMES:case Y.STYLE:e._switchToTextParsing(t,jg.RAWTEXT);break;case Y.SCRIPT:e._switchToTextParsing(t,jg.SCRIPT_DATA);break;case Y.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:ov(e,t)}}function iv(e,t){switch(t.tagID){case Y.HEAD:e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD;break;case Y.BODY:case Y.BR:case Y.HTML:ov(e,t);break;case Y.TEMPLATE:av(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function av(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==Y.TEMPLATE&&e._err(t,K.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,K.endTagWithoutMatchingOpenElement)}function ov(e,t){e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD,e._processToken(t)}function sv(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.BASEFONT:case Y.BGSOUND:case Y.HEAD:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.STYLE:rv(e,t);break;case Y.NOSCRIPT:e._err(t,K.nestedNoscriptInHead);break;default:lv(e,t)}}function cv(e,t){switch(t.tagID){case Y.NOSCRIPT:e.openElements.pop(),e.insertionMode=Q.IN_HEAD;break;case Y.BR:lv(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function lv(e,t){let n=t.type===lg.EOF?K.openElementsLeftAfterEof:K.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Q.IN_HEAD,e._processToken(t)}function uv(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.BODY:e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_BODY;break;case Y.FRAMESET:e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET;break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:e._err(t,K.abandonedHeadElementChild),e.openElements.push(e.headElement,Y.HEAD),rv(e,t),e.openElements.remove(e.headElement);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:fv(e,t)}}function dv(e,t){switch(t.tagID){case Y.BODY:case Y.HTML:case Y.BR:fv(e,t);break;case Y.TEMPLATE:av(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function fv(e,t){e._insertFakeElement(J.BODY,Y.BODY),e.insertionMode=Q.IN_BODY,pv(e,t)}function pv(e,t){switch(t.type){case lg.CHARACTER:hv(e,t);break;case lg.WHITESPACE_CHARACTER:mv(e,t);break;case lg.COMMENT:G_(e,t);break;case lg.START_TAG:Jv(e,t);break;case lg.END_TAG:oy(e,t);break;case lg.EOF:sy(e,t);break;default:}}function mv(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function hv(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function gv(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function _v(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function vv(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET)}function yv(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function bv(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Ag.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,q.HTML)}function xv(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Sv(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),n||(e.formElement=e.openElements.current))}function Cv(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===Y.LI&&r===Y.LI||(n===Y.DD||n===Y.DT)&&(r===Y.DD||r===Y.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==Y.ADDRESS&&r!==Y.DIV&&r!==Y.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function wv(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.tokenizer.state=jg.PLAINTEXT}function Tv(e,t){e.openElements.hasInScope(Y.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1}function Ev(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(J.A);n&&(W_(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Dv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Ov(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(Y.NOBR)&&(W_(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function kv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Av(e,t){e.treeAdapter.getDocumentMode(e.document)!==Eg.QUIRKS&&e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_TABLE}function jv(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Mv(e){let t=ug(e,Tg.TYPE);return t!=null&&t.toLowerCase()===j_}function Nv(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),Mv(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Pv(e,t){e._appendElement(t,q.HTML),t.ackSelfClosing=!0}function Fv(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Iv(e,t){t.tagName=J.IMG,t.tagID=Y.IMG,jv(e,t)}function Lv(e,t){e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.tokenizer.state=jg.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Q.TEXT}function Rv(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,jg.RAWTEXT)}function zv(e,t){e.framesetOk=!1,e._switchToTextParsing(t,jg.RAWTEXT)}function Bv(e,t){e._switchToTextParsing(t,jg.RAWTEXT)}function Vv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Q.IN_TABLE||e.insertionMode===Q.IN_CAPTION||e.insertionMode===Q.IN_TABLE_BODY||e.insertionMode===Q.IN_ROW||e.insertionMode===Q.IN_CELL?Q.IN_SELECT_IN_TABLE:Q.IN_SELECT}function Hv(e,t){e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function Uv(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,q.HTML)}function Wv(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(Y.RTC),e._insertElement(t,q.HTML)}function Gv(e,t){e._reconstructActiveFormattingElements(),w_(t),E_(t),t.selfClosing?e._appendElement(t,q.MATHML):e._insertElement(t,q.MATHML),t.ackSelfClosing=!0}function Kv(e,t){e._reconstructActiveFormattingElements(),T_(t),E_(t),t.selfClosing?e._appendElement(t,q.SVG):e._insertElement(t,q.SVG),t.ackSelfClosing=!0}function qv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function Jv(e,t){switch(t.tagID){case Y.I:case Y.S:case Y.B:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.SMALL:case Y.STRIKE:case Y.STRONG:Dv(e,t);break;case Y.A:Ev(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:bv(e,t);break;case Y.P:case Y.DL:case Y.OL:case Y.UL:case Y.DIV:case Y.DIR:case Y.NAV:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.DETAILS:case Y.ADDRESS:case Y.ARTICLE:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:yv(e,t);break;case Y.LI:case Y.DD:case Y.DT:Cv(e,t);break;case Y.BR:case Y.IMG:case Y.WBR:case Y.AREA:case Y.EMBED:case Y.KEYGEN:jv(e,t);break;case Y.HR:Fv(e,t);break;case Y.RB:case Y.RTC:Uv(e,t);break;case Y.RT:case Y.RP:Wv(e,t);break;case Y.PRE:case Y.LISTING:xv(e,t);break;case Y.XMP:Rv(e,t);break;case Y.SVG:Kv(e,t);break;case Y.HTML:gv(e,t);break;case Y.BASE:case Y.LINK:case Y.META:case Y.STYLE:case Y.TITLE:case Y.SCRIPT:case Y.BGSOUND:case Y.BASEFONT:case Y.TEMPLATE:rv(e,t);break;case Y.BODY:_v(e,t);break;case Y.FORM:Sv(e,t);break;case Y.NOBR:Ov(e,t);break;case Y.MATH:Gv(e,t);break;case Y.TABLE:Av(e,t);break;case Y.INPUT:Nv(e,t);break;case Y.PARAM:case Y.TRACK:case Y.SOURCE:Pv(e,t);break;case Y.IMAGE:Iv(e,t);break;case Y.BUTTON:Tv(e,t);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:kv(e,t);break;case Y.IFRAME:zv(e,t);break;case Y.SELECT:Vv(e,t);break;case Y.OPTION:case Y.OPTGROUP:Hv(e,t);break;case Y.NOEMBED:case Y.NOFRAMES:Bv(e,t);break;case Y.FRAMESET:vv(e,t);break;case Y.TEXTAREA:Lv(e,t);break;case Y.NOSCRIPT:e.options.scriptingEnabled?Bv(e,t):qv(e,t);break;case Y.PLAINTEXT:wv(e,t);break;case Y.COL:case Y.TH:case Y.TD:case Y.TR:case Y.HEAD:case Y.FRAME:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.CAPTION:case Y.COLGROUP:break;default:qv(e,t)}}function Yv(e,t){if(e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Xv(e,t){e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,Gy(e,t))}function Zv(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Qv(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(Y.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(Y.FORM):n&&e.openElements.remove(n))}function $v(e){e.openElements.hasInButtonScope(Y.P)||e._insertFakeElement(J.P,Y.P),e._closePElement()}function ey(e){e.openElements.hasInListItemScope(Y.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(Y.LI),e.openElements.popUntilTagNamePopped(Y.LI))}function ty(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function ny(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ry(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function iy(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(J.BR,Y.BR),e.openElements.pop(),e.framesetOk=!1}function ay(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==Y.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function oy(e,t){switch(t.tagID){case Y.A:case Y.B:case Y.I:case Y.S:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.NOBR:case Y.SMALL:case Y.STRIKE:case Y.STRONG:W_(e,t);break;case Y.P:$v(e);break;case Y.DL:case Y.UL:case Y.OL:case Y.DIR:case Y.DIV:case Y.NAV:case Y.PRE:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.BUTTON:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.ADDRESS:case Y.ARTICLE:case Y.DETAILS:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.LISTING:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:Zv(e,t);break;case Y.LI:ey(e);break;case Y.DD:case Y.DT:ty(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:ny(e);break;case Y.BR:iy(e);break;case Y.BODY:Yv(e,t);break;case Y.HTML:Xv(e,t);break;case Y.FORM:Qv(e);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:ry(e,t);break;case Y.TEMPLATE:av(e,t);break;default:ay(e,t)}}function sy(e,t){e.tmplInsertionModeStack.length>0?Uy(e,t):J_(e,t)}function cy(e,t){var n;t.tagID===Y.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function ly(e,t){e._err(t,K.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function uy(e,t){if(e.openElements.currentTagId!==void 0&&F_.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Q.IN_TABLE_TEXT,t.type){case lg.CHARACTER:Cy(e,t);break;case lg.WHITESPACE_CHARACTER:Sy(e,t);break}else xy(e,t)}function dy(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CAPTION}function fy(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_COLUMN_GROUP}function py(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.COLGROUP,Y.COLGROUP),e.insertionMode=Q.IN_COLUMN_GROUP,Oy(e,t)}function my(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_TABLE_BODY}function hy(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.TBODY,Y.TBODY),e.insertionMode=Q.IN_TABLE_BODY,jy(e,t)}function gy(e,t){e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function _y(e,t){Mv(t)?e._appendElement(t,q.HTML):xy(e,t),t.ackSelfClosing=!0}function vy(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,q.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function yy(e,t){switch(t.tagID){case Y.TD:case Y.TH:case Y.TR:hy(e,t);break;case Y.STYLE:case Y.SCRIPT:case Y.TEMPLATE:rv(e,t);break;case Y.COL:py(e,t);break;case Y.FORM:vy(e,t);break;case Y.TABLE:gy(e,t);break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:my(e,t);break;case Y.INPUT:_y(e,t);break;case Y.CAPTION:dy(e,t);break;case Y.COLGROUP:fy(e,t);break;default:xy(e,t)}}function by(e,t){switch(t.tagID){case Y.TABLE:e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode());break;case Y.TEMPLATE:av(e,t);break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:xy(e,t)}}function xy(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,pv(e,t),e.fosterParentingEnabled=n}function Sy(e,t){e.pendingCharacterTokens.push(t)}function Cy(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function wy(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)xy(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var Ty=new Set([Y.CAPTION,Y.COL,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]);function Ey(e,t){let n=t.tagID;Ty.has(n)?e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,yy(e,t)):Jv(e,t)}function Dy(e,t){let n=t.tagID;switch(n){case Y.CAPTION:case Y.TABLE:e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,n===Y.TABLE&&by(e,t));break;case Y.BODY:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:oy(e,t)}}function Oy(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.COL:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TEMPLATE:rv(e,t);break;default:Ay(e,t)}}function ky(e,t){switch(t.tagID){case Y.COLGROUP:e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TEMPLATE:av(e,t);break;case Y.COL:break;default:Ay(e,t)}}function Ay(e,t){e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE,e._processToken(t))}function jy(e,t){switch(t.tagID){case Y.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_ROW;break;case Y.TH:case Y.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(J.TR,Y.TR),e.insertionMode=Q.IN_ROW,Ny(e,t);break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,yy(e,t));break;default:yy(e,t)}}function My(e,t){let n=t.tagID;switch(t.tagID){case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,by(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:case Y.TR:break;default:by(e,t)}}function Ny(e,t){switch(t.tagID){case Y.TH:case Y.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CELL,e.activeFormattingElements.insertMarker();break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,jy(e,t));break;default:yy(e,t)}}function Py(e,t){switch(t.tagID){case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY);break;case Y.TABLE:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,My(e,t));break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(Y.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,My(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:break;default:by(e,t)}}function Fy(e,t){let n=t.tagID;Ty.has(n)?(e.openElements.hasInTableScope(Y.TD)||e.openElements.hasInTableScope(Y.TH))&&(e._closeTableCell(),Ny(e,t)):Jv(e,t)}function Iy(e,t){let n=t.tagID;switch(n){case Y.TD:case Y.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_ROW);break;case Y.TABLE:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),Py(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:break;default:oy(e,t)}}function Ly(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.OPTGROUP:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.HR:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.INPUT:case Y.KEYGEN:case Y.TEXTAREA:case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),t.tagID!==Y.SELECT&&e._processStartTag(t));break;case Y.SCRIPT:case Y.TEMPLATE:rv(e,t);break;default:}}function Ry(e,t){switch(t.tagID){case Y.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===Y.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===Y.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop();break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop();break;case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode());break;case Y.TEMPLATE:av(e,t);break;default:}}function zy(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Ly(e,t)}function By(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Ry(e,t)}function Vy(e,t){switch(t.tagID){case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:rv(e,t);break;case Y.CAPTION:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.tmplInsertionModeStack[0]=Q.IN_TABLE,e.insertionMode=Q.IN_TABLE,yy(e,t);break;case Y.COL:e.tmplInsertionModeStack[0]=Q.IN_COLUMN_GROUP,e.insertionMode=Q.IN_COLUMN_GROUP,Oy(e,t);break;case Y.TR:e.tmplInsertionModeStack[0]=Q.IN_TABLE_BODY,e.insertionMode=Q.IN_TABLE_BODY,jy(e,t);break;case Y.TD:case Y.TH:e.tmplInsertionModeStack[0]=Q.IN_ROW,e.insertionMode=Q.IN_ROW,Ny(e,t);break;default:e.tmplInsertionModeStack[0]=Q.IN_BODY,e.insertionMode=Q.IN_BODY,Jv(e,t)}}function Hy(e,t){t.tagID===Y.TEMPLATE&&av(e,t)}function Uy(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):J_(e,t)}function Wy(e,t){t.tagID===Y.HTML?Jv(e,t):Ky(e,t)}function Gy(e,t){if(t.tagID===Y.HTML){if(e.fragmentContext||(e.insertionMode=Q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===Y.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else Ky(e,t)}function Ky(e,t){e.insertionMode=Q.IN_BODY,pv(e,t)}function qy(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.FRAMESET:e._insertElement(t,q.HTML);break;case Y.FRAME:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.NOFRAMES:rv(e,t);break;default:}}function Jy(e,t){t.tagID===Y.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==Y.FRAMESET&&(e.insertionMode=Q.AFTER_FRAMESET))}function Yy(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.NOFRAMES:rv(e,t);break;default:}}function Xy(e,t){t.tagID===Y.HTML&&(e.insertionMode=Q.AFTER_AFTER_FRAMESET)}function Zy(e,t){t.tagID===Y.HTML?Jv(e,t):Qy(e,t)}function Qy(e,t){e.insertionMode=Q.IN_BODY,pv(e,t)}function $y(e,t){switch(t.tagID){case Y.HTML:Jv(e,t);break;case Y.NOFRAMES:rv(e,t);break;default:}}function eb(e,t){t.chars=`�`,e._insertCharacters(t)}function tb(e,t){e._insertCharacters(t),e.framesetOk=!1}function nb(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==q.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function rb(e,t){if(C_(t))nb(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===q.MATHML?w_(t):r===q.SVG&&(D_(t),T_(t)),E_(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function ib(e,t){if(t.tagID===Y.P||t.tagID===Y.BR){nb(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===q.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}new Set([J.AREA,J.BASE,J.BASEFONT,J.BGSOUND,J.BR,J.COL,J.EMBED,J.FRAME,J.HR,J.IMG,J.INPUT,J.KEYGEN,J.LINK,J.META,J.PARAM,J.SOURCE,J.TRACK,J.WBR]);function ab(e,t){return L_.parse(e,t)}function ob(e,t,n){typeof e==`string`&&(n=t,t=e,e=null);let r=L_.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}var sb={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},cb=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,lb=/-[a-z]/g,ub=/%c(?:([-+])(\d+))?/g,db=/%x/g,fb={2:!0,1:!1,0:null},pb={};function mb(e,t){let n=t||pb,r=n.onerror,i=e instanceof sh?e:new sh(e),a=n.fragment?ob:ab,o=String(i);return Kh(a(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?s:null,scriptingEnabled:!1}),{file:i,space:n.space,verbose:n.verbose});function s(e){let t=e.code,a=hb(t),s=n[a]??!0,c=typeof s==`number`?s:+!!s;if(c){let n=sb[a],o=new Xl(l(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});i.path&&(o.file=i.path,o.name=i.path+`:`+o.name),o.fatal=fb[c],o.note=l(n.description),o.url=n.url===!1?void 0:cb+t,r(o)}function l(t){return t.replace(ub,n).replace(db,r);function n(t,n,r){let i=(r?Number.parseInt(r,10):0)*(n===`-`?-1:1);return _b(o.charAt(e.startOffset+i))}function r(){return vb(o.charCodeAt(e.startOffset))}}}}function hb(e){return e.replace(lb,gb)}function gb(e){return e.charAt(1).toUpperCase()}function _b(e){return e==="`"?"` ` `":e}function vb(e){return`0x`+e.toString(16).toUpperCase()}function yb(e,t){let n=(t||{}).force||!1;jm(e,r);function r(e){n?delete e.position:e.position=void 0}}function bb(e,t){let n=mb(e,t);return yb(n,{force:!0}),delete n.data,n}var xb=(function(e,t,n){let r=ym(n);if(!e||!e.type||!e.children)throw Error(`Expected parent node`);if(typeof t==`number`){if(t<0||t===1/0)throw Error(`Expected positive finite number as index`)}else if(t=e.children.indexOf(t),t<0)throw Error(`Expected child node or index`);for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Sb=(function(e){if(e==null)return Eb;if(typeof e==`string`)return wb(e);if(typeof e==`object`)return Cb(e);if(typeof e==`function`)return Tb(e);throw Error("Expected function, string, or array as `test`")});function Cb(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Sb(e[n]);return Tb(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function wb(e){return Tb(t);function t(t){return t.tagName===e}}function Tb(e){return t;function t(t,n,r){return!!(Db(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Eb(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function Db(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var Ob=/\n/g,kb=/[\t ]+/g,Ab=Sb(`br`),jb=Sb(Wb),Mb=Sb(`p`),Nb=Sb(`tr`),Pb=Sb([`datalist`,`head`,`noembed`,`noframes`,`noscript`,`rp`,`script`,`style`,`template`,`title`,Ub,Gb]),Fb=Sb(`address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp`.split(`.`));function Ib(e,t){let n=t||{},r=`children`in e?e.children:[],i=Fb(e),a=Hb(e,{whitespace:n.whitespace||`normal`,breakBefore:!1,breakAfter:!1}),o=[];(e.type===`text`||e.type===`comment`)&&o.push(...zb(e,{whitespace:a,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<r.length;)o.push(...Lb(r[s],e,{whitespace:a,breakBefore:s?void 0:i,breakAfter:s<r.length-1?Ab(r[s+1]):i}));let c=[],l;for(s=-1;++s<o.length;){let e=o[s];typeof e==`number`?l!==void 0&&e>l&&(l=e):e&&(l!==void 0&&l>-1&&c.push(`
|
|
60
|
-
`.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function Lb(e,t,n){return e.type===`element`?Rb(e,t,n):e.type===`text`?n.whitespace===`normal`?zb(e,n):Bb(e):[]}function Rb(e,t,n){let r=Hb(e,n),i=e.children||[],a=-1,o=[];if(Pb(e))return o;let s,c;for(Ab(e)||Nb(e)&&xb(t,e,Nb)?c=`
|
|
61
|
-
`:Mb(e)?(s=2,c=2):Fb(e)&&(s=1,c=1);++a<i.length;)o=o.concat(Lb(i[a],e,{whitespace:r,breakBefore:a?void 0:s,breakAfter:a<i.length-1?Ab(i[a+1]):c}));return jb(e)&&xb(t,e,jb)&&o.push(` `),s&&o.unshift(s),c&&o.push(c),o}function zb(e,t){let n=String(e.value),r=[],i=[],a=0;for(;a<=n.length;){Ob.lastIndex=a;let e=Ob.exec(n),i=e&&`index`in e?e.index:n.length;r.push(Vb(n.slice(a,i).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,``),a===0?t.breakBefore:!0,i===n.length?t.breakAfter:!0)),a=i+1}let o=-1,s;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),s=void 0):r[o]?(typeof s==`number`&&i.push(s),i.push(r[o]),s=0):(o===0||o===r.length-1)&&i.push(0);return i}function Bb(e){return[String(e.value)]}function Vb(e,t,n){let r=[],i=0,a;for(;i<e.length;){kb.lastIndex=i;let n=kb.exec(e);a=n?n.index:e.length,!i&&!a&&n&&!t&&r.push(``),i!==a&&r.push(e.slice(i,a)),i=n?a+n[0].length:a}return i!==a&&!n&&r.push(``),r.join(` `)}function Hb(e,t){if(e.type===`element`){let n=e.properties||{};switch(e.tagName){case`listing`:case`plaintext`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return n.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return n.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}}return t.whitespace}function Ub(e){return!!(e.properties||{}).hidden}function Wb(e){return e.tagName===`td`||e.tagName===`th`}function Gb(e){return e.tagName===`dialog`&&!(e.properties||{}).open}var Kb={},qb=[];function Jb(e){let t=e||Kb;return function(e,n){km(e,`element`,function(e,r){let i=Array.isArray(e.properties.className)?e.properties.className:qb,a=i.includes(`language-math`),o=i.includes(`math-display`),s=i.includes(`math-inline`),c=o;if(!a&&!o&&!s)return;let l=r[r.length-1],u=e;if(e.tagName===`code`&&a&&l&&l.type===`element`&&l.tagName===`pre`&&(u=l,l=r[r.length-2],c=!0),!l)return;let d=Ib(u,{whitespace:`pre`}),f;try{f=Yn.renderToString(d,{...t,displayMode:c,throwOnError:!0})}catch(i){let a=i,o=a.name.toLowerCase();n.message(`Could not render math with KaTeX`,{ancestors:[...r,e],cause:a,place:e.position,ruleId:o,source:`rehype-katex`});try{f=Yn.renderToString(d,{...t,displayMode:c,strict:`ignore`,throwOnError:!1})}catch{f=[{type:`element`,tagName:`span`,properties:{className:[`katex-error`],style:`color:`+(t.errorColor||`#cc0000`),title:String(i)},children:[{type:`text`,value:d}]}]}}typeof f==`string`&&(f=bb(f,{fragment:!0}).children);let p=l.children.indexOf(u);return l.children.splice(p,1,...f),Om})}}var Yb=class{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}};Yb.prototype.property={},Yb.prototype.normal={},Yb.prototype.space=null;function Xb(e,t){let n={},r={},i=-1;for(;++i<e.length;)Object.assign(n,e[i].property),Object.assign(r,e[i].normal);return new Yb(n,r,t)}function Zb(e){return e.toLowerCase()}var Qb=class{constructor(e,t){this.property=e,this.attribute=t}};Qb.prototype.space=null,Qb.prototype.boolean=!1,Qb.prototype.booleanish=!1,Qb.prototype.overloadedBoolean=!1,Qb.prototype.number=!1,Qb.prototype.commaSeparated=!1,Qb.prototype.spaceSeparated=!1,Qb.prototype.commaOrSpaceSeparated=!1,Qb.prototype.mustUseProperty=!1,Qb.prototype.defined=!1;var $b=t({boolean:()=>tx,booleanish:()=>nx,commaOrSpaceSeparated:()=>ox,commaSeparated:()=>ax,number:()=>$,overloadedBoolean:()=>rx,spaceSeparated:()=>ix}),ex=0,tx=sx(),nx=sx(),rx=sx(),$=sx(),ix=sx(),ax=sx(),ox=sx();function sx(){return 2**++ex}var cx=Object.keys($b),lx=class extends Qb{constructor(e,t,n,r){let i=-1;if(super(e,t),ux(this,`space`,r),typeof n==`number`)for(;++i<cx.length;){let e=cx[i];ux(this,cx[i],(n&$b[e])===$b[e])}}};lx.prototype.defined=!0;function ux(e,t,n){n&&(e[t]=n)}var dx={}.hasOwnProperty;function fx(e){let t={},n={},r;for(r in e.properties)if(dx.call(e.properties,r)){let i=e.properties[r],a=new lx(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Zb(r)]=r,n[Zb(a.attribute)]=r}return new Yb(t,n,e.space)}var px=fx({space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),mx=fx({space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function hx(e,t){return t in e?e[t]:t}function gx(e,t){return hx(e,t.toLowerCase())}var _x=fx({space:`xmlns`,attributes:{xmlnsxlink:`xmlns:xlink`},transform:gx,properties:{xmlns:null,xmlnsXLink:null}}),vx=fx({transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:nx,ariaAutoComplete:null,ariaBusy:nx,ariaChecked:nx,ariaColCount:$,ariaColIndex:$,ariaColSpan:$,ariaControls:ix,ariaCurrent:null,ariaDescribedBy:ix,ariaDetails:null,ariaDisabled:nx,ariaDropEffect:ix,ariaErrorMessage:null,ariaExpanded:nx,ariaFlowTo:ix,ariaGrabbed:nx,ariaHasPopup:null,ariaHidden:nx,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ix,ariaLevel:$,ariaLive:null,ariaModal:nx,ariaMultiLine:nx,ariaMultiSelectable:nx,ariaOrientation:null,ariaOwns:ix,ariaPlaceholder:null,ariaPosInSet:$,ariaPressed:nx,ariaReadOnly:nx,ariaRelevant:null,ariaRequired:nx,ariaRoleDescription:ix,ariaRowCount:$,ariaRowIndex:$,ariaRowSpan:$,ariaSelected:nx,ariaSetSize:$,ariaSort:null,ariaValueMax:$,ariaValueMin:$,ariaValueNow:$,ariaValueText:null,role:null}}),yx=fx({space:`html`,attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},transform:gx,mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ax,acceptCharset:ix,accessKey:ix,action:null,allow:null,allowFullScreen:tx,allowPaymentRequest:tx,allowUserMedia:tx,alt:null,as:null,async:tx,autoCapitalize:null,autoComplete:ix,autoFocus:tx,autoPlay:tx,blocking:ix,capture:null,charSet:null,checked:tx,cite:null,className:ix,cols:$,colSpan:null,content:null,contentEditable:nx,controls:tx,controlsList:ix,coords:$|ax,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tx,defer:tx,dir:null,dirName:null,disabled:tx,download:rx,draggable:nx,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tx,formTarget:null,headers:ix,height:$,hidden:tx,high:$,href:null,hrefLang:null,htmlFor:ix,httpEquiv:ix,id:null,imageSizes:null,imageSrcSet:null,inert:tx,inputMode:null,integrity:null,is:null,isMap:tx,itemId:null,itemProp:ix,itemRef:ix,itemScope:tx,itemType:ix,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tx,low:$,manifest:null,max:null,maxLength:$,media:null,method:null,min:null,minLength:$,multiple:tx,muted:tx,name:null,nonce:null,noModule:tx,noValidate:tx,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:tx,optimum:$,pattern:null,ping:ix,placeholder:null,playsInline:tx,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tx,referrerPolicy:null,rel:ix,required:tx,reversed:tx,rows:$,rowSpan:$,sandbox:ix,scope:null,scoped:tx,seamless:tx,selected:tx,shadowRootClonable:tx,shadowRootDelegatesFocus:tx,shadowRootMode:null,shape:null,size:$,sizes:null,slot:null,span:$,spellCheck:nx,src:null,srcDoc:null,srcLang:null,srcSet:null,start:$,step:null,style:null,tabIndex:$,target:null,title:null,translate:null,type:null,typeMustMatch:tx,useMap:null,value:nx,width:$,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ix,axis:null,background:null,bgColor:null,border:$,borderColor:null,bottomMargin:$,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tx,declare:tx,event:null,face:null,frame:null,frameBorder:null,hSpace:$,leftMargin:$,link:null,longDesc:null,lowSrc:null,marginHeight:$,marginWidth:$,noResize:tx,noHref:tx,noShade:tx,noWrap:tx,object:null,profile:null,prompt:null,rev:null,rightMargin:$,rules:null,scheme:null,scrolling:nx,standby:null,summary:null,text:null,topMargin:$,valueType:null,version:null,vAlign:null,vLink:null,vSpace:$,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tx,disableRemotePlayback:tx,prefix:null,property:null,results:$,security:null,unselectable:null}}),bx=fx({space:`svg`,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`},transform:hx,properties:{about:ox,accentHeight:$,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:$,amplitude:$,arabicForm:null,ascent:$,attributeName:null,attributeType:null,azimuth:$,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:$,by:null,calcMode:null,capHeight:$,className:ix,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:$,diffuseConstant:$,direction:null,display:null,dur:null,divisor:$,dominantBaseline:null,download:tx,dx:null,dy:null,edgeMode:null,editable:null,elevation:$,enableBackground:null,end:null,event:null,exponent:$,externalResourcesRequired:null,fill:null,fillOpacity:$,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:ax,g2:ax,glyphName:ax,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:$,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:$,horizOriginX:$,horizOriginY:$,id:null,ideographic:$,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:$,k:$,k1:$,k2:$,k3:$,k4:$,kernelMatrix:ox,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:$,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:$,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:$,overlineThickness:$,paintOrder:null,panose1:null,path:null,pathLength:$,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ix,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:$,pointsAtY:$,pointsAtZ:$,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ox,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ox,rev:ox,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ox,requiredFeatures:ox,requiredFonts:ox,requiredFormats:ox,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:$,specularExponent:$,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:$,strikethroughThickness:$,string:null,stroke:null,strokeDashArray:ox,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:$,strokeOpacity:$,strokeWidth:null,style:null,surfaceScale:$,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ox,tabIndex:$,tableValues:null,target:null,targetX:$,targetY:$,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ox,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:$,underlineThickness:$,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:$,values:null,vAlphabetic:$,vMathematical:$,vectorEffect:null,vHanging:$,vIdeographic:$,version:null,vertAdvY:$,vertOriginX:$,vertOriginY:$,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:$,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),xx=/^data[-\w.:]+$/i,Sx=/-[a-z]/g,Cx=/[A-Z]/g;function wx(e,t){let n=Zb(t),r=t,i=Qb;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&xx.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Sx,Ex);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Sx.test(e)){let n=e.replace(Cx,Tx);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=lx}return new i(r,t)}function Tx(e){return`-`+e.toLowerCase()}function Ex(e){return e.charAt(1).toUpperCase()}var Dx=Xb([mx,px,_x,vx,yx],`html`),Ox=Xb([mx,px,_x,vx,bx],`svg`),kx={}.hasOwnProperty;function Ax(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&kx.call(t,e)){let n=String(t[e]);i=kx.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var jx={},Mx={}.hasOwnProperty,Nx=Ax(`type`,{handlers:{root:Fx,element:Bx,text:Rx,comment:zx,doctype:Lx}});function Px(e,t){let n=(t||jx).space;return Nx(e,n===`svg`?Ox:Dx)}function Fx(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=Hx(e.children,n,t),Ux(e,n),n}function Ix(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=Hx(e.children,n,t),Ux(e,n),n}function Lx(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return Ux(e,t),t}function Rx(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return Ux(e,t),t}function zx(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return Ux(e,t),t}function Bx(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=Ox);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&Mx.call(e.properties,a)){let t=Vx(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Uh[o],childNodes:[],parentNode:null};return s.childNodes=Hx(e.children,s,r),Ux(e,s),e.tagName===`template`&&e.content&&(s.content=Ix(e.content,r)),s}function Vx(e,t,n){let r=wx(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?Bn(n):In(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=Uh[r.space]}return i}function Hx(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=Nx(e[r],n);a.parentNode=t,i.push(a)}return i}function Ux(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var Wx=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Gx=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,Kx=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),qx={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function Jx(e,t){let n=cS(e),r=Ax(`type`,{handlers:{root:Xx,element:Zx,text:Qx,comment:tS,doctype:$x,raw:nS},unknown:rS}),i={parser:n?new L_(qx):L_.getFragmentParser(void 0,qx),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),iS(i,Ul());let a=Kh(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&jm(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function Yx(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function Xx(e,t){Yx(e.children,t)}function Zx(e,t){oS(e,t),Yx(e.children,t),sS(e,t)}function Qx(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:lg.CHARACTER,chars:e.value,location:lS(e)};iS(t,Ul(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function $x(e,t){let n={type:lg.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:lS(e)};iS(t,Ul(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function eS(e,t){t.stitches=!0;let n=uS(e);`children`in e&&`children`in n&&(n.children=Jx({type:`root`,children:e.children},t.options).children),tS({type:`comment`,value:{stitch:n}},t)}function tS(e,t){let n=e.value,r={type:lg.COMMENT,data:n,location:lS(e)};iS(t,Ul(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function nS(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,aS(t,Ul(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Gx,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function rS(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))eS(n,t);else{let e=``;throw Kx.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function iS(e,t){aS(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=jg.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function aS(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function oS(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===jg.PLAINTEXT)return;iS(t,Ul(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:Uh.html;i===Uh.html&&n===`svg`&&(i=Uh.svg);let a=Px({...e,children:[]},{space:i===Uh.svg?`svg`:`html`}),o={type:lg.START_TAG,tagName:n,tagID:Og(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:lS(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function sS(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Wx.includes(n)||t.parser.tokenizer.state===jg.PLAINTEXT)return;iS(t,Hl(e));let r={type:lg.END_TAG,tagName:n,tagID:Og(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:lS(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===jg.RCDATA||t.parser.tokenizer.state===jg.RAWTEXT||t.parser.tokenizer.state===jg.SCRIPT_DATA)&&(t.parser.tokenizer.state=jg.DATA)}function cS(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function lS(e){let t=Ul(e)||{line:void 0,column:void 0,offset:void 0},n=Hl(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function uS(e){return`children`in e?hm({...e,children:[]}):hm(e)}function dS(e){return function(t,n){return Jx(t,{...e,file:n})}}var fS={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533},pS={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:`CDATA[`,characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:`content`,contentTypeDocument:`document`,contentTypeFlow:`flow`,contentTypeString:`string`,contentTypeText:`text`,hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4},mS={data:`data`,whitespace:`whitespace`,lineEnding:`lineEnding`,lineEndingBlank:`lineEndingBlank`,linePrefix:`linePrefix`,lineSuffix:`lineSuffix`,atxHeading:`atxHeading`,atxHeadingSequence:`atxHeadingSequence`,atxHeadingText:`atxHeadingText`,autolink:`autolink`,autolinkEmail:`autolinkEmail`,autolinkMarker:`autolinkMarker`,autolinkProtocol:`autolinkProtocol`,characterEscape:`characterEscape`,characterEscapeValue:`characterEscapeValue`,characterReference:`characterReference`,characterReferenceMarker:`characterReferenceMarker`,characterReferenceMarkerNumeric:`characterReferenceMarkerNumeric`,characterReferenceMarkerHexadecimal:`characterReferenceMarkerHexadecimal`,characterReferenceValue:`characterReferenceValue`,codeFenced:`codeFenced`,codeFencedFence:`codeFencedFence`,codeFencedFenceSequence:`codeFencedFenceSequence`,codeFencedFenceInfo:`codeFencedFenceInfo`,codeFencedFenceMeta:`codeFencedFenceMeta`,codeFlowValue:`codeFlowValue`,codeIndented:`codeIndented`,codeText:`codeText`,codeTextData:`codeTextData`,codeTextPadding:`codeTextPadding`,codeTextSequence:`codeTextSequence`,content:`content`,definition:`definition`,definitionDestination:`definitionDestination`,definitionDestinationLiteral:`definitionDestinationLiteral`,definitionDestinationLiteralMarker:`definitionDestinationLiteralMarker`,definitionDestinationRaw:`definitionDestinationRaw`,definitionDestinationString:`definitionDestinationString`,definitionLabel:`definitionLabel`,definitionLabelMarker:`definitionLabelMarker`,definitionLabelString:`definitionLabelString`,definitionMarker:`definitionMarker`,definitionTitle:`definitionTitle`,definitionTitleMarker:`definitionTitleMarker`,definitionTitleString:`definitionTitleString`,emphasis:`emphasis`,emphasisSequence:`emphasisSequence`,emphasisText:`emphasisText`,escapeMarker:`escapeMarker`,hardBreakEscape:`hardBreakEscape`,hardBreakTrailing:`hardBreakTrailing`,htmlFlow:`htmlFlow`,htmlFlowData:`htmlFlowData`,htmlText:`htmlText`,htmlTextData:`htmlTextData`,image:`image`,label:`label`,labelText:`labelText`,labelLink:`labelLink`,labelImage:`labelImage`,labelMarker:`labelMarker`,labelImageMarker:`labelImageMarker`,labelEnd:`labelEnd`,link:`link`,paragraph:`paragraph`,reference:`reference`,referenceMarker:`referenceMarker`,referenceString:`referenceString`,resource:`resource`,resourceDestination:`resourceDestination`,resourceDestinationLiteral:`resourceDestinationLiteral`,resourceDestinationLiteralMarker:`resourceDestinationLiteralMarker`,resourceDestinationRaw:`resourceDestinationRaw`,resourceDestinationString:`resourceDestinationString`,resourceMarker:`resourceMarker`,resourceTitle:`resourceTitle`,resourceTitleMarker:`resourceTitleMarker`,resourceTitleString:`resourceTitleString`,setextHeading:`setextHeading`,setextHeadingText:`setextHeadingText`,setextHeadingLine:`setextHeadingLine`,setextHeadingLineSequence:`setextHeadingLineSequence`,strong:`strong`,strongSequence:`strongSequence`,strongText:`strongText`,thematicBreak:`thematicBreak`,thematicBreakSequence:`thematicBreakSequence`,blockQuote:`blockQuote`,blockQuotePrefix:`blockQuotePrefix`,blockQuoteMarker:`blockQuoteMarker`,blockQuotePrefixWhitespace:`blockQuotePrefixWhitespace`,listOrdered:`listOrdered`,listUnordered:`listUnordered`,listItemIndent:`listItemIndent`,listItemMarker:`listItemMarker`,listItemPrefix:`listItemPrefix`,listItemPrefixWhitespace:`listItemPrefixWhitespace`,listItemValue:`listItemValue`,chunkDocument:`chunkDocument`,chunkContent:`chunkContent`,chunkFlow:`chunkFlow`,chunkText:`chunkText`,chunkString:`chunkString`};function hS(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function gS(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function _S(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||e===129736||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function vS(e){return hS(e)?`ambiguous`:gS(e)?`fullwidth`:e===8361||e>=65377&&e<=65470||e>=65474&&e<=65479||e>=65482&&e<=65487||e>=65490&&e<=65495||e>=65498&&e<=65500||e>=65512&&e<=65518?`halfwidth`:e>=32&&e<=126||e===162||e===163||e===165||e===166||e===172||e===175||e>=10214&&e<=10221||e===10629||e===10630?`narrow`:_S(e)?`wide`:`neutral`}function yS(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function bS(e){return yS(e),vS(e)}var xS=Object.defineProperty,SS=(e,t,n)=>t in e?xS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CS=(e,t,n)=>SS(e,typeof t==`symbol`?t:t+``,n);function wS(e){return/^\p{Emoji_Presentation}/u.test(String.fromCodePoint(e))}function TS(e){if(!e||e<4352)return!1;switch(bS(e)){case`fullwidth`:case`halfwidth`:return!0;case`wide`:return!wS(e);case`narrow`:return!1;case`ambiguous`:return 917760<=e&&e<=917999?null:!1;case`neutral`:return/^\p{sc=Hangul}/u.test(String.fromCodePoint(e))}}function ES(e,t){return t!==65025||!e||e<8216?!1:e===8216||e===8217||e===8220||e===8221}function DS(e){return e!==null&&e>=65024&&e<=65038}var OS=AS(/\p{P}|\p{S}/u),kS=AS(/\s/);function AS(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCodePoint(t))}}var jS;(e=>{e.spaceOrPunctuation=3,e.cjk=4096,e.cjkPunctuation=4098,e.ivs=8192,e.cjkOrIvs=12288,e.nonEmojiGeneralUseVS=16384,e.variationSelector=24576,e.ivsToCjkRightShift=1})(jS||={});function MS(e){if(e===fS.eof||qu(e)||kS(e))return pS.characterGroupWhitespace;let t=0;if(e>=4352){if(DS(e))return jS.nonEmojiGeneralUseVS;switch(TS(e)){case null:return jS.ivs;case!0:t|=jS.cjk;break}}return OS(e)&&(t|=pS.characterGroupPunctuation),t}function NS(e,t,n){if(!BS(e))return e;let r=t(),i=MS(r);return!r||FS(i)?e:ES(r,n)?jS.cjkPunctuation:PS(i)}function PS(e){return e&~jS.ivs}function FS(e){return!!(e&pS.characterGroupWhitespace)}function IS(e){return(e&jS.cjkPunctuation)===pS.characterGroupPunctuation}function LS(e){return!!(e&jS.cjk)}function RS(e){return e===jS.ivs}function zS(e){return!!(e&jS.cjkOrIvs)}function BS(e){return e===jS.nonEmojiGeneralUseVS}function VS(e){return!!(e&jS.spaceOrPunctuation)}function HS(e){return!!(e&&e>=55296&&e<=56319)}function US(e){return!!(e&&e>=56320&&e<=57343)}function WS(e,t,n){if(t._bufferIndex<2)return e;let r=n({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return r&&r>=65536?r:e}function GS(e,t,n){let r=e>=65536?2:1;if(t._bufferIndex<1+r)return null;let i=t._bufferIndex-r-2,a=n({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-r}}),o=a.charCodeAt(a.length-1);if(Number.isNaN(o))return null;if(a.length<2||o<56320||57343<o)return o;let s=a.codePointAt(0);return s&&s>=65536?s:o}var KS=class{constructor(e,t,n){this.previousCode=e,this.nowPoint=t,this.sliceSerialize=n,CS(this,`cachedValue`)}value(){return this.cachedValue===void 0&&(this.cachedValue=GS(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function qS(e,t,n){let r=n({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return r&&r>=65536?r:e}var JS={name:`attention`,resolveAll:YS,tokenize:XS};function YS(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};ZS(d,-c),ZS(f,c),o={type:c>1?mS.strongSequence:mS.emphasisSequence,start:d,end:{...e[r][1].end}},s={type:c>1?mS.strongSequence:mS.emphasisSequence,start:{...e[n][1].start},end:f},a={type:c>1?mS.strongText:mS.emphasisText,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?mS.strong:mS.emphasis,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Mu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Mu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),t.parser.constructs.insideSpan.null,l=Mu(l,sd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Mu(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Mu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ju(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function XS(e,t){let n=this.parser.constructs.attentionMarkers.null,{now:r,sliceSerialize:i,previous:a}=this,o=US(a)?WS(a,r(),i):a,s=MS(o),c=new KS(o,r(),i),l=NS(s,c.value.bind(c),o),u;return d;function d(t){return t===fS.asterisk||fS.underscore,u=t,e.enter(`attentionSequence`),f(t)}function f(a){if(a===u)return e.consume(a),f;let s=e.exit(`attentionSequence`),c=MS(HS(a)?qS(a,r(),i):a),d=IS(l),p=d||FS(l),m=IS(c),h=m||FS(c),g=zS(l),_=!h||m&&(p||g)||n.includes(a),v=!p||d&&(h||LS(c))||n.includes(o);return s._open=!!(u===fS.asterisk?_:_&&(VS(l)||!v)),s._close=!!(u===fS.asterisk?v:v&&(VS(c)||!_)),t(a)}}function ZS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}function QS(){return{text:{[fS.asterisk]:JS,[fS.underscore]:JS},insideSpan:{null:[JS]}}}function $S(){let e=this.data();(e.micromarkExtensions||=[]).push(QS())}function eC(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{[fS.tilde]:n},insideSpan:{null:[n]},attentionMarkers:{null:[fS.tilde]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ju(o,o.length,0,sd(s,e.slice(r+1,n),t)),ju(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ju(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=mS.data);return e}function i(e,n,r){let{now:i,sliceSerialize:a,previous:o}=this,s=US(o)?WS(o,i(),a):o,c=MS(s),l=new KS(s,i(),a),u=NS(c,l.value.bind(l),s),d=this.events,f=0;return p;function p(t){return fS.tilde,s===fS.tilde&&d[d.length-1][1].type!==mS.characterEscape?r(t):(e.enter(`strikethroughSequenceTemporary`),m(t))}function m(o){let c=MS(s);if(o===fS.tilde)return f>1?r(o):(e.consume(o),f++,m);if(f<2&&!t)return r(o);let l=e.exit(`strikethroughSequenceTemporary`),d=MS(HS(o)?qS(o,i(),a):o),p=IS(u)||FS(u),h=IS(d)||FS(d),g=LS(u)||RS(c);return l._open=!h||d===pS.attentionSideAfter&&(p||g),l._close=!p||c===pS.attentionSideAfter&&(h||LS(d)),n(o)}}}function tC(e){let t=this.data();(t.micromarkExtensions||=[]).push(eC(e))}function nC(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function rC(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function iC(e,t,n){let r=ym((n||{}).ignore||[]),i=aC(t),a=-1;for(;++a<i.length;)km(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function aC(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([oC(e[0]),sC(e[1])])}return t}function oC(e){return typeof e==`string`?new RegExp(rC(e),`g`):e}function sC(e){return typeof e==`function`?e:function(){return e}}var cC=`phrasing`,lC=[`autolink`,`link`,`image`,`label`];function uC(){return{transforms:[vC],enter:{literalAutolink:fC,literalAutolinkEmail:pC,literalAutolinkHttp:pC,literalAutolinkWww:pC},exit:{literalAutolink:_C,literalAutolinkEmail:gC,literalAutolinkHttp:mC,literalAutolinkWww:hC}}}function dC(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:cC,notInConstruct:lC},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:cC,notInConstruct:lC},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:cC,notInConstruct:lC}]}}function fC(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function pC(e){this.config.enter.autolinkProtocol.call(this,e)}function mC(e){this.config.exit.autolinkProtocol.call(this,e)}function hC(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function gC(e){this.config.exit.autolinkEmail.call(this,e)}function _C(e){this.exit(e)}function vC(e){iC(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,yC],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bC]],{ignore:[`link`,`linkReference`]})}function yC(e,t,n,r,i){let a=``;if(!CC(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!xC(n)))return!1;let o=SC(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function bC(e,t,n,r){return!CC(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function xC(e){let 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 SC(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=nC(e,`(`),a=nC(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function CC(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Xu(n)||Yu(n))&&(!t||n!==47)}NC.peek=MC;function wC(){this.buffer()}function TC(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function EC(){this.buffer()}function DC(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function OC(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ru(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kC(e){this.exit(e)}function AC(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ru(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jC(e){this.exit(e)}function MC(){return`[`}function NC(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function PC(){return{enter:{gfmFootnoteCallString:wC,gfmFootnoteCall:TC,gfmFootnoteDefinitionLabelString:EC,gfmFootnoteDefinition:DC},exit:{gfmFootnoteCallString:OC,gfmFootnoteCall:kC,gfmFootnoteDefinitionLabelString:AC,gfmFootnoteDefinition:jC}}}function FC(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:NC},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
62
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?LC:IC))),s(),o}}function IC(e,t,n){return t===0?e:LC(e,t,n)}function LC(e,t,n){return(n?``:` `)+e}var RC=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];UC.peek=WC;function zC(){return{canContainEols:[`delete`],enter:{strikethrough:VC},exit:{strikethrough:HC}}}function BC(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:RC}],handlers:{delete:UC}}}function VC(e){this.enter({type:`delete`,children:[]},e)}function HC(e){this.exit(e)}function UC(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function WC(){return`~`}function GC(e){return e.length}function KC(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||GC,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=qC(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=JC(r[d]);else{let e=JC(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
63
|
-
`)}function qC(e){return e==null?``:String(e)}function JC(e){let 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 YC(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),XC);return i(),o}function XC(e,t,n){return`>`+(n?``:` `)+e}function ZC(e,t){return QC(e,t.inConstruct,!0)&&!QC(e,t.notInConstruct,!1)}function QC(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function $C(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
64
|
-
`&&ZC(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
65
|
-
`}function ew(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function tw(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 nw(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function rw(e,t,n,r){let i=nw(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(tw(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,iw);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(ew(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
66
|
-
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
67
|
-
`),a&&(u+=s.move(a+`
|
|
68
|
-
`)),u+=s.move(c),l(),u}function iw(e,t,n){return(n?``:` `)+e}function aw(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ow(e,t,n,r){let i=aw(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
69
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function sw(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function cw(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function lw(e,t,n){let r=od(e),i=od(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}uw.peek=dw;function uw(e,t,n,r){let i=sw(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=lw(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=cw(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=lw(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+cw(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function dw(e,t,n){return n.options.emphasis||`*`}function fw(e,t){let n=!1;return jm(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&Du(e)&&(t.options.setext||n))}function pw(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(fw(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
70
|
-
`,after:`
|
|
71
|
-
`});return r(),t(),o+`
|
|
72
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
73
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
74
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=cw(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}mw.peek=hw;function mw(e){return e.value||``}function hw(){return`<`}gw.peek=_w;function gw(e,t,n,r){let i=aw(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function _w(){return`!`}vw.peek=yw;function vw(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function yw(){return`!`}bw.peek=xw;function bw(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function xw(){return"`"}function Sw(e,t){let n=Du(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Cw.peek=ww;function Cw(e,t,n,r){let i=aw(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Sw(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function ww(e,t,n){return Sw(e,n)?`<`:`[`}Tw.peek=Ew;function Tw(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Ew(){return`[`}function Dw(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Ow(e){let t=Dw(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function kw(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Aw(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function jw(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?kw(n):Dw(n),s=e.ordered?o===`.`?`)`:`.`:Ow(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Aw(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Mw(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Nw(e,t,n,r){let i=Mw(n),a=n.bulletCurrent||Dw(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Pw(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Fw=ym([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Iw(e,t,n,r){return(e.children.some(function(e){return Fw(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Lw(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Rw.peek=zw;function Rw(e,t,n,r){let i=Lw(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=lw(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=cw(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=lw(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+cw(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function zw(e,t,n){return n.options.strong||`*`}function Bw(e,t,n,r){return n.safe(e.value,r)}function Vw(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Hw(e,t,n){let r=(Aw(n)+(n.options.ruleSpaces?` `:``)).repeat(Vw(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Uw={blockquote:YC,break:$C,code:rw,definition:ow,emphasis:uw,hardBreak:$C,heading:pw,html:mw,image:gw,imageReference:vw,inlineCode:bw,link:Cw,linkReference:Tw,list:jw,listItem:Nw,paragraph:Pw,root:Iw,strong:Rw,text:Bw,thematicBreak:Hw};function Ww(){return{enter:{table:Gw,tableData:Yw,tableHeader:Yw,tableRow:qw},exit:{codeText:Xw,table:Kw,tableData:Jw,tableHeader:Jw,tableRow:Jw}}}function Gw(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Kw(e){this.exit(e),this.data.inTable=void 0}function qw(e){this.enter({type:`tableRow`,children:[]},e)}function Jw(e){this.exit(e)}function Yw(e){this.enter({type:`tableCell`,children:[]},e)}function Xw(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Zw));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Zw(e,t){return t===`|`?t:e}function Qw(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
75
|
-
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
76
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return KC(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Uw.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function $w(){return{exit:{taskListCheckValueChecked:tT,taskListCheckValueUnchecked:tT,paragraph:nT}}}function eT(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:rT}}}function tT(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function nT(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function rT(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Uw.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function iT(){return[uC(),PC(),zC(),Ww(),$w()]}function aT(e){return{extensions:[dC(),FC(e),BC(),Qw(e),eT()]}}var oT={tokenize:bT,partial:!0},sT={tokenize:xT,partial:!0},cT={tokenize:ST,partial:!0},lT={tokenize:CT,partial:!0},uT={tokenize:wT,partial:!0},dT={name:`wwwAutolink`,tokenize:vT,previous:TT},fT={name:`protocolAutolink`,tokenize:yT,previous:ET},pT={name:`emailAutolink`,tokenize:_T,previous:DT},mT={};function hT(){return{text:mT}}for(var gT=48;gT<123;)mT[gT]=pT,gT++,gT===58?gT=65:gT===91&&(gT=97);mT[43]=pT,mT[45]=pT,mT[46]=pT,mT[95]=pT,mT[72]=[pT,fT],mT[104]=[pT,fT],mT[87]=[pT,dT],mT[119]=[pT,dT];function _T(e,t,n){let r=this,i,a;return o;function o(t){return!OT(t)||!DT.call(r,r.previous)||kT(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return OT(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(uT,u,l)(t):t===45||t===95||Bu(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&zu(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function vT(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!TT.call(r,r.previous)||kT(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(oT,e.attempt(sT,e.attempt(cT,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function yT(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&ET.call(r,r.previous)&&!kT(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(zu(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Hu(t)||qu(t)||Xu(t)||Yu(t)?n(t):e.attempt(sT,e.attempt(cT,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function bT(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function xT(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(lT,c,s)(t):t===null||qu(t)||Xu(t)||t!==45&&Yu(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function ST(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(lT,t,a)(o):o===null||qu(o)||Xu(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function CT(e,t,n){return r;function r(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),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||qu(o)||Xu(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||qu(e)||Xu(e)?t(e):r(e)}function a(e){return zu(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):zu(t)?(e.consume(t),o):n(t)}}function wT(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Bu(e)?n(e):t(e)}}function TT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||qu(e)}function ET(e){return!zu(e)}function DT(e){return!(e===47||OT(e))}function OT(e){return e===43||e===45||e===46||e===95||Bu(e)}function kT(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var AT={tokenize:RT,partial:!0};function jT(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:FT,continuation:{tokenize:IT},exit:LT}},text:{91:{name:`gfmFootnoteCall`,tokenize:PT},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:MT,resolveTo:NT}}}}function MT(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Ru(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function NT(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function PT(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||qu(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Ru(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return qu(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function FT(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||qu(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Ru(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return qu(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),$u(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function IT(e,t,n){return e.check(md,t,e.attempt(AT,t,n))}function LT(e){e.exit(`gfmFootnoteDefinition`)}function RT(e,t,n){let r=this;return $u(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function zT(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ju(o,o.length,0,sd(s,e.slice(r+1,n),t)),ju(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ju(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=od(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=od(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var BT=class{constructor(){this.map=[]}add(e,t,n){VT(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function VT(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function HT(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function UT(){return{flow:{null:{name:`table`,tokenize:WT,resolveAll:GT}}}}function WT(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Ku(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Ju(t)?$u(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||qu(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Ju(t)?$u(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Ju(t)?$u(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Ku(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Ju(t)?$u(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Ku(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Ku(n)?(e.exit(`tableRow`),t(n)):Ju(n)?$u(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||qu(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function GT(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new BT;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(qT(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=KT(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=KT(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=KT(f,t,o,i,n,d)):(o[0]=o[1],d=KT(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&qT(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=HT(t.events,n))}return e}function KT(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},JT(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=JT(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=JT(t.events,n[2]),a=JT(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},JT(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function qT(e,t,n,r,i){let a=[],o=JT(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function JT(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var YT={name:`tasklistCheck`,tokenize:ZT};function XT(){return{text:{91:YT}}}function ZT(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return qu(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Ku(r)?t(r):Ju(r)?e.check({tokenize:QT},t,n)(r):n(r)}}function QT(e,t,n){return $u(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function $T(e){return Pu([hT(),jT(),zT(e),UT(),XT()])}var eE={};function tE(e){let t=this,n=e||eE,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push($T(n)),a.push(iT()),o.push(aT(n))}function nE(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function rE(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:`
|
|
77
|
-
`,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max(ew(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:`
|
|
78
|
-
`,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(`
|
|
79
|
-
`),i&&(c+=a.move(i+`
|
|
80
|
-
`)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++s<r.unsafe.length;){let e=r.unsafe[s];if(!e.atBreak)continue;let t=r.compilePattern(e),n;for(;n=t.exec(i);){let e=n.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=i.slice(0,e)+` `+i.slice(n.index+1)}}return o+i+o}function i(){return`$`}}var iE={tokenize:oE,concrete:!0,name:`mathFlow`},aE={tokenize:sE,partial:!0};function oE(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){return e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),c(t)}function c(t){return t===36?(e.consume(t),o++,c):o<2?n(t):(e.exit(`mathFlowFenceSequence`),$u(e,l,`whitespace`)(t))}function l(t){return t===null||Ku(t)?d(t):(e.enter(`mathFlowFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===null||Ku(t)?(e.exit(`chunkString`),e.exit(`mathFlowFenceMeta`),d(t)):t===36?n(t):(e.consume(t),u)}function d(n){return e.exit(`mathFlowFence`),r.interrupt?t(n):e.attempt(aE,f,g)(n)}function f(t){return e.attempt({tokenize:_,partial:!0},g,p)(t)}function p(t){return(a?$u(e,m,`linePrefix`,a+1):m)(t)}function m(t){return t===null?g(t):Ku(t)?e.attempt(aE,f,g)(t):(e.enter(`mathFlowValue`),h(t))}function h(t){return t===null||Ku(t)?(e.exit(`mathFlowValue`),m(t)):(e.consume(t),h)}function g(n){return e.exit(`mathFlow`),t(n)}function _(e,t,n){let i=0;return $u(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),s(t)}function s(t){return t===36?(i++,e.consume(t),s):i<o?n(t):(e.exit(`mathFlowFenceSequence`),$u(e,c,`whitespace`)(t))}function c(r){return r===null||Ku(r)?(e.exit(`mathFlowFence`),t(r)):n(r)}}}function sE(e,t,n){let r=this;return i;function i(n){return n===null?t(n):(e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function cE(e){let t=(e||{}).singleDollarTextMath;return t??=!0,{tokenize:n,resolve:lE,previous:uE,name:`mathText`};function n(e,n,r){let i=0,a,o;return s;function s(t){return e.enter(`mathText`),e.enter(`mathTextSequence`),c(t)}function c(n){return n===36?(e.consume(n),i++,c):i<2&&!t?r(n):(e.exit(`mathTextSequence`),l(n))}function l(t){return t===null?r(t):t===36?(o=e.enter(`mathTextSequence`),a=0,d(t)):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),l):Ku(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),l):(e.enter(`mathTextData`),u(t))}function u(t){return t===null||t===32||t===36||Ku(t)?(e.exit(`mathTextData`),l(t)):(e.consume(t),u)}function d(t){return t===36?(e.consume(t),a++,d):a===i?(e.exit(`mathTextSequence`),e.exit(`mathText`),n(t)):(o.type=`mathTextData`,u(t))}}}function lE(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`mathTextData`){e[t][1].type=`mathTextPadding`,e[n][1].type=`mathTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`mathTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function uE(e){return e!==36||this.events[this.events.length-1][1].type===`characterEscape`}function dE(e){return{flow:{36:iE},text:{36:cE(e)}}}var fE={};function pE(e){let t=this,n=e||fE,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(dE(n)),a.push(nE()),o.push(rE(n))}var mE=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),hE=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),gE=e=>{let t=hE(e);return t.charAt(0).toUpperCase()+t.slice(1)},_E=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),vE=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},yE={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},bE=(0,U.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,U.createElement)(`svg`,{ref:c,...yE,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:_E(`lucide`,i),...!a&&!vE(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,U.createElement)(e,t)),...Array.isArray(a)?a:[a]])),xE=(e,t)=>{let n=(0,U.forwardRef)(({className:n,...r},i)=>(0,U.createElement)(bE,{ref:i,iconNode:t,className:_E(`lucide-${mE(gE(e))}`,`lucide-${e}`,n),...r}));return n.displayName=gE(e),n},SE=xE(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),CE=xE(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),wE=xE(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),TE=xE(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),EE=xE(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),DE=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function OE(e){return kE(e)}function kE(e){return Array.isArray(e)?AE(e):e instanceof RegExp?e:typeof e==`object`?jE(e):e}function AE(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=kE(e[n]);return t}function jE(e){let t={};for(let n in e)t[n]=kE(e[n]);return t}function ME(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function NE(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?NE(e.substring(0,e.length-1)):e.substr(~t+1)}var PE=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,FE=class{static hasCaptures(e){return e===null?!1:(PE.lastIndex=0,PE.test(e))}static replaceCaptures(e,t,n){return e.replace(PE,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function IE(e,t){return e<t?-1:+(e>t)}function LE(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=IE(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function RE(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function zE(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var BE=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},VE=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(KE(e),t)}static createFromParsedTheme(e,t){return YE(e,t)}_cachedMatchRoot=new BE(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>UE(e.parent,t.parentScopes));return n?new GE(n.fontStyle,n.foreground,n.background):null}},HE=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function UE(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!WE(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function WE(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var GE=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function KE(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&RE(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&RE(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new qE(l,u,e,o,s,c)}}return n}var qE=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},JE=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(JE||{});function YE(e,t){e.sort((e,t)=>{let n=IE(e.scope,t.scope);return n!==0||(n=LE(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new XE(t),o=new GE(n,a.getId(r),a.getId(i)),s=new $E(new QE(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new VE(a,o,s)}var XE=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},ZE=Object.freeze([]),QE=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||ZE,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},$E=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),QE.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(LE(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new QE(e,t,n,r,i))}},eD=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=nD(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function tD(e){return e}function nD(e){return e}function rD(e,t){let n=[],r=aD(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(iD(i)){let e=[];do e.push(i),i=r.next();while(iD(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function iD(e){return!!e&&!!e.match(/[\w\.:]+/)}function aD(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function oD(e){typeof e.dispose==`function`&&e.dispose()}var sD=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},cD=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},lD=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},uD=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new sD(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new lD;for(let n of e)dD(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof sD){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function dD(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof sD?pD({baseGrammar:a,selfGrammar:i},r):fD(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new sD(e))}function fD(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];mD([r],t,n)}}function pD(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&mD(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&mD(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function mD(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?ME({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&mD(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=bD(i);switch(a.kind){case 0:pD({...t,selfGrammar:t.baseGrammar},n);break;case 1:pD(t,n);break;case 2:fD(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?fD(a.ruleName,i,n):pD(i,n)}else a.kind===4?n.add(new cD(a.scopeName,a.ruleName)):n.add(new sD(a.scopeName));break}}}var hD=class{kind=0},gD=class{kind=1},_D=class{constructor(e){this.ruleName=e}kind=2},vD=class{constructor(e){this.scopeName=e}kind=3},yD=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function bD(e){if(e===`$base`)return new hD;if(e===`$self`)return new gD;let t=e.indexOf(`#`);return t===-1?new vD(e):t===0?new _D(e.substring(1)):new yD(e.substring(0,t),e.substring(t+1))}var xD=/\\(\d+)/,SD=/\\(\d+)/g,CD=-1,wD=-2;function TD(e){return e}function ED(e){return e}var DD=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=FE.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=FE.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${NE(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:FE.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:FE.replaceCaptures(this._contentName,e,t)}},OD=class extends DD{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},kD=class extends DD{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new PD(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new FD,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},AD=class extends DD{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new FD,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},jD=class extends DD{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new PD(i,this.id),this.beginCaptures=a,this._end=new PD(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new FD;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},MD=class extends DD{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new PD(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new PD(o,wD),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new FD;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new FD,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},ND=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new OD(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new kD(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=ME({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new AD(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new MD(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new jD(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=bD(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof AD||e instanceof jD||e instanceof MD)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},PD=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=xD.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return SD.lastIndex=0,this.source.replace(SD,(e,t)=>zE(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},FD=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new ID(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new ID(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},ID=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
81
|
-
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},LD=class{constructor(e,t){this.languageId=e,this.tokenType=t}},RD=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new LD(e,8),this._embeddedLanguagesMatcher=new zD(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new LD(0,0);_getBasicScopeAttributes=new BE(e=>new LD(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},zD=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>zE(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var BD=!1,VD=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function HD(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=UD(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new VD(i,!0);f()}return new VD(i,!1);function f(){let o=WD(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===CD){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),XD(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof jD){let r=o;XD(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof MD){let r=o;XD(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(XD(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function UD(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof MD&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=JD(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==wD){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),XD(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function WD(e,t,n,r,i,a){let o=GD(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=KD(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function GD(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=qD(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function KD(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=qD(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function qD(e,t,n,r,i){return BD?{ruleScanner:e.compile(t,n),findOptions:YD(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function JD(e,t,n,r,i){return BD?{ruleScanner:e.compileWhile(t,n),findOptions:YD(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function YD(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function XD(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));HD(e,p,n&&d.start===0,d.start,f,i,!1,0),oD(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new ZD(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ZD=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function QD(e,t,n,r,i,a,o,s){return new nO(e,t,n,r,i,a,o,s)}function $D(e,t,n,r,i){let a=rD(t,eO),o=ND.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function eO(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(tO(t[r],e))return n=r+1,!0;return!1})}function tO(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var nO=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new RD(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=rO(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=rD(e,eO);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)$D(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&$D(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(TD(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[ED(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=rO(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=ND.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===aO.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=eD.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?iO.createRootAndLookUpScopeName(a,r,this):iO.createRoot(`unknown`,r),t=new aO(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
82
|
-
`;let a=this.createOnigString(e),o=a.content.length,s=new sO(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=HD(this,a,i,0,t,s,!0,r);return oD(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function rO(e,t){return e=OE(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var iO=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=HE.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new HE(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new HE(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),eD.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},aO=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?iO.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:ED(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=iO.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,TD(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,iO.fromExtension(r,n.contentNameScopesList))}},oO=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):rD(e,eO).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>rD(e,eO).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},sO=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=eD.set(n,0,tD(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=eD.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},cO=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,QD(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},lO=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new cO(VE.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(VE.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new oO(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new uD(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},uO=aO.NULL,dO=/["&'<>`]/g,fO=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,pO=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,mO=/[|\\{}()[\]^$+*?.]/g,hO=new WeakMap;function gO(e,t){if(e=e.replace(t.subset?_O(t.subset):dO,r),t.subset||t.escapeOnly)return e;return e.replace(fO,n).replace(pO,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function _O(e){let t=hO.get(e);return t||(t=vO(e),hO.set(e,t)),t}function vO(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(mO,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var yO=/[\dA-Fa-f]/;function bO(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!yO.test(String.fromCharCode(t))?r:r+`;`}var xO=/\d/;function SO(e,t,n){let r=`&#`+String(e);return n&&t&&!xO.test(String.fromCharCode(t))?r:r+`;`}var CO={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},wO=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],TO={}.hasOwnProperty,EO={},DO;for(DO in CO)TO.call(CO,DO)&&(EO[CO[DO]]=DO);var OO=/[^\dA-Za-z]/;function kO(e,t,n,r){let i=String.fromCharCode(e);if(TO.call(EO,i)){let e=EO[i],a=`&`+e;return n&&Fn.includes(e)&&!wO.includes(e)&&(!r||t&&t!==61&&OO.test(String.fromCharCode(t)))?a:a+`;`}return``}function AO(e,t,n){let r=bO(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=kO(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=SO(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function jO(e,t){return gO(e,Object.assign({format:AO},t))}var MO=/^>|^->|<!--|-->|--!>|<!-$/g,NO=[`>`],PO=[`<`,`>`];function FO(e,t,n,r){return r.settings.bogusComments?`<?`+jO(e.value,Object.assign({},r.settings.characterReferences,{subset:NO}))+`>`:`<!--`+e.value.replace(MO,i)+`-->`;function i(e){return jO(e,Object.assign({},r.settings.characterReferences,{subset:PO}))}}function IO(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var LO=BO(1),RO=BO(-1),zO=[];function BO(e){return t;function t(t,n,r){let i=t?t.children:zO,a=(n||0)+e,o=i[a];if(!r)for(;o&&Il(o);)a+=e,o=i[a];return o}}var VO={}.hasOwnProperty;function HO(e){return t;function t(t,n,r){return VO.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var UO=HO({body:KO,caption:WO,colgroup:WO,dd:XO,dt:YO,head:WO,html:GO,li:JO,optgroup:QO,option:$O,p:qO,rp:ZO,rt:ZO,tbody:tk,td:ik,tfoot:nk,th:ik,thead:ek,tr:rk});function WO(e,t,n){let r=LO(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Il(r.value.charAt(0)))}function GO(e,t,n){let r=LO(n,t);return!r||r.type!==`comment`}function KO(e,t,n){let r=LO(n,t);return!r||r.type!==`comment`}function qO(e,t,n){let r=LO(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function JO(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&r.tagName===`li`}function YO(e,t,n){let r=LO(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function XO(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function ZO(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function QO(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function $O(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function ek(e,t,n){let r=LO(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function tk(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function nk(e,t,n){return!LO(n,t)}function rk(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function ik(e,t,n){let r=LO(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var ak=HO({body:ck,colgroup:lk,head:sk,html:ok,tbody:uk});function ok(e){let t=LO(e,-1);return!t||t.type!==`comment`}function sk(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ck(e){let t=LO(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Il(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function lk(e,t,n){let r=RO(n,t),i=LO(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&UO(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function uk(e,t,n){let r=RO(n,t),i=LO(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&UO(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var dk={name:[[`
|
|
83
|
-
\f\r &/=>`.split(``),`
|
|
84
|
-
\f\r "&'/=>\``.split(``)],[`\0
|
|
85
|
-
\f\r "&'/<=>`.split(``),`\0
|
|
86
|
-
\f\r "&'/<=>\``.split(``)]],unquoted:[[`
|
|
87
|
-
\f\r &>`.split(``),`\0
|
|
88
|
-
\f\r "&'<=>\``.split(``)],[`\0
|
|
89
|
-
\f\r "&'<=>\``.split(``),`\0
|
|
90
|
-
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function fk(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1:r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Ln);let l=pk(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!ak(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!UO(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function pk(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=mk(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function mk(e,t,n){let r=Rn(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=jO(r.attribute,Object.assign({},e.settings.characterReferences,{subset:dk.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Bn:In)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=jO(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:dk.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&nC(n,o)>nC(n,e.alternative)&&(o=e.alternative),s=o+jO(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?dk.single:dk.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var hk=[`<`,`&`];function gk(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:jO(e.value,Object.assign({},r.settings.characterReferences,{subset:hk}))}function _k(e,t,n,r){return r.settings.allowDangerousHtml?e.value:gk(e,t,n,r)}function vk(e,t,n,r){return r.all(e)}var yk=Ax(`type`,{invalid:bk,unknown:xk,handlers:{comment:FO,doctype:IO,element:fk,raw:_k,root:vk,text:gk}});function bk(e){throw Error("Expected node, not `"+e+"`")}function xk(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Sk={},Ck={},wk=[];function Tk(e,t){let n=t||Sk,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Ek,all:Dk,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Wx,characterReferences:n.characterReferences||Ck,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Ln:qn,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Ek(e,t,n){return yk(e,t,n,this)}function Dk(e){let t=[],n=e&&e.children||wk,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}function Ok(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function kk(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Ak(e){return Array.isArray(e)?e:[e]}async function jk(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Mk(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Nk(e){return e===`ansi`||Mk(e)}function Pk(e){return e===`none`}function Fk(e){return Pk(e)}function Ik(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(/\s+/g);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function Lk(e,t=!1){let n=e.split(/(\r?\n)/g),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}function Rk(e){let t=Lk(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function zk(e,t,n){let r=new Set;for(let t of e.matchAll(/lang=["']([\w-]+)["']/g))r.add(t[1]);for(let t of e.matchAll(/(?:```|~~~)([\w-]+)/g))r.add(t[1]);for(let t of e.matchAll(/\\begin\{([\w-]+)\}/g))r.add(t[1]);if(!n)return Array.from(r);let i=n.getBundledLanguages();return Array.from(r).filter(e=>e&&i[e])}var Bk=`light-dark()`,Vk=[`color`,`background-color`];function Hk(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Uk(e,t){let n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?Hk(e,t):e})):e}function Wk(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>Gk(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&Vk.includes(a))if(r===Bk&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new DE('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[a]=`light-dark(${o[e][a]||`inherit`}, ${o[r][a]||`inherit`})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s;else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function Gk(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&JE.Italic&&(t[`font-style`]=`italic`),e.fontStyle&JE.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&JE.Underline&&n.push(`underline`),e.fontStyle&JE.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Kk(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}var qk=new WeakMap;function Jk(e,t){qk.set(e,t)}function Yk(e){return qk.get(e)}var Xk=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Ak(n).map(e=>[e,uO])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Zk(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Zk(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function Qk(e,t){if(!(e instanceof Xk))throw new DE(`Invalid grammar state`);return e.getInternalStack(t)}function $k(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new DE(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}else{let t=r.lines[e.line];if(t===void 0)throw new DE(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new DE(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}},r=Rk(t.source),i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));eA(i),e.set(t.meta,{decorations:i,converter:r,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return Uk(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=Array.from(e.children).filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new DE(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=tA(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new DE(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new DE(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Ik(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function eA(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new DE(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new DE(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function tA(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(tA).join(``):``}var nA=[$k()];function rA(e){let t=iA(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...nA]}function iA(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var aA=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],oA={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function sA(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function cA(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}else if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function lA(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:`resetAll`});else if(r<=9)oA[r]&&t.push({type:`setDecoration`,value:oA[r]});else if(r<=29){let e=oA[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:aA[r-30]}});else if(r===38){let n=cA(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:aA[r-40]}});else if(r===48){let n=cA(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:aA[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:aA[r-100+8]}})}return t}function uA(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=sA(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=lA(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var dA={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function fA(e=dA){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<aA.length;e++)r.push(t(aA[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var pA={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function mA(e,t,n){let r=Ok(e,n),i=Lk(t),a=fA(Object.fromEntries(aA.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||pA[t]]}))),o=uA();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=kk(i,r),o=kk(o,r),n.decorations.has(`dim`)&&(i=hA(i));let s=JE.None;return n.decorations.has(`bold`)&&(s|=JE.Bold),n.decorations.has(`italic`)&&(s|=JE.Italic),n.decorations.has(`underline`)&&(s|=JE.Underline),n.decorations.has(`strikethrough`)&&(s|=JE.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function hA(e){let t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/i);if(t)if(t[3]){let e=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,`0`);return`#${t[1]}${t[2]}${e}`}else if(t[2])return`#${t[1]}${t[2]}80`;else return`#${Array.from(t[1]).map(e=>`${e}${e}`).join(``)}80`;let n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function gA(e,t,n={}){let{lang:r=`text`,theme:i=e.getLoadedThemes()[0]}=n;if(Mk(r)||Pk(i))return Lk(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:a,colorMap:o}=e.setTheme(i);if(r===`ansi`)return mA(a,t,n);let s=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new DE(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(a.name))throw new DE(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return vA(t,s,a,o,n)}function _A(...e){if(e.length===2)return Yk(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Mk(i)||Pk(a))throw new DE(`Plain language does not have grammar state`);if(i===`ansi`)throw new DE(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Xk(yA(n,c,o,s,r).stateStack,c.name,o.name)}function vA(e,t,n,r,i){let a=yA(e,t,n,r,i),o=new Xk(yA(e,t,n,r,i).stateStack,t.name,n.name);return Jk(a.tokens,o),a.tokens}function yA(e,t,n,r,i){let a=Ok(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=Lk(e),l=i.grammarState?Qk(i.grammarState,n.name)??uO:i.grammarContextCode==null?uO:yA(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e<f;e++){let[f,p]=c[e];if(f===``){u=[],d.push([]);continue}if(o>0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:f.length;if(t===o)continue;let s=_.tokens[2*e+1],c=kk(r[eD.getForeground(s)],a),l=eD.getFontStyle(s),d={content:f.substring(t,o),offset:p+t,color:c,fontStyle:l};if(i.includeExplanation){let e=[];if(i.includeExplanation!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(/,/).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=f.substring(t.startIndex,t.endIndex);r+=n.length,d.explanation.push({content:n,scopes:i.includeExplanation===`scopeName`?bA(t.scopes):xA(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function bA(e){return e.map(e=>({scopeName:e}))}function xA(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:wA(e,i,t.slice(0,r))}}return n}function SA(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function CA(e,t,n){if(!SA(e[e.length-1],t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)SA(e[r],n[i])&&--r,--i;return r===-1}function wA(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(CA(e,t,n)){r.push(a);break}return r}function TA(e,t,n){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=r.map(r=>{let i=gA(e,t,{...n,theme:r.theme});return{tokens:i,state:Yk(i),theme:typeof r.theme==`string`?r.theme:r.theme.name}}),a=EA(...i.map(e=>e.tokens)),o=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,n)=>{let{content:a,explanation:s,offset:c,...l}=e[t][i];o.variants[r[n].color]=l}),o})),s=i[0].state?new Xk(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&Jk(o,s),o}function EA(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}function DA(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new DE("`themes` option must not be empty");let p=TA(e,t,n);if(c=Yk(p),l&&Bk!==l&&!f.find(e=>e.color===l))throw new DE(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>Wk(e,h,u,l,d))),c&&Jk(a,c);let g=f.map(e=>Ok(e.theme,n));i=OA(f,m,g,u,l,`fg`,d),r=OA(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Ok(n.theme,n);a=gA(e,t,n);let l=e.getTheme(n.theme);r=kk(l.bg,s),i=kk(l.fg,s),o=l.name,c=Yk(a)}else throw new DE("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function OA(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=kk(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===Bk&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new DE('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${kk(t[r][a],n[r])||`inherit`}, ${kk(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function kA(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>kA(e,t,n),codeToTokens:(t,n)=>DA(e,t,n)}){let i=t;for(let e of rA(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=DA(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=jA(a):d===`never`&&(a=MA(a)),f&&(a=NA(a));let p={...r,get source(){return i}};for(let e of rA(n))a=e.tokens?.call(p,a)||a;return AA(a,{...n,fg:o,bg:s,themeName:c,rootStyle:l},p,u)}function AA(e,t,n,r=Yk(e)){let i=rA(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={type:`element`,tagName:`pre`,properties:{class:`shiki ${t.themeName||``}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([e])=>!e.startsWith(`_`)))},children:[]},u={type:`element`,tagName:`code`,properties:{},children:a},d=[],f={...n,structure:s,addClassToHast:Ik,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return l},get code(){return u},get lines(){return d}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
91
|
-
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=Kk(a.htmlStyle||Gk(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(f,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(f,n,t+1)||n;d.push(n),a.push(n)}}),s===`classic`){for(let e of i)u=e?.code?.call(f,u)||u;l.children.push(u);for(let e of i)l=e?.pre?.call(f,l)||l;o.children.push(l)}let p=o;for(let e of i)p=e?.root?.call(f,p)||p;return r&&Jk(p,r),p}function jA(e){return e.map(e=>{let t=[],n=``,r=0;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&JE.Underline||i.fontStyle&JE.Strikethrough));o&&i.content.match(/^\s+$/)&&e[a+1]?(r||=i.offset,n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=0,n=``):t.push(i)}),t})}function MA(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function NA(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t[t.length-1],r=Kk(e.htmlStyle||Gk(e)),i=Kk(n.htmlStyle||Gk(n)),a=e.fontStyle&&(e.fontStyle&JE.Underline||e.fontStyle&JE.Strikethrough),o=n.fontStyle&&(n.fontStyle&JE.Underline||n.fontStyle&JE.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var PA=Tk;function FA(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>kA(e,t,n),codeToTokens:(t,n)=>DA(e,t,n)},i=PA(kA(e,t,n,r));for(let e of rA(n))i=e.postprocess?.call(r,i,n)||i;return i}var IA={light:`#333333`,dark:`#bbbbbb`},LA={light:`#fffffe`,dark:`#1e1e1e`},RA=`__shiki_resolved`;function zA(e){if(e?.[RA])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?IA.light:IA.dark,n||=t.type===`light`?LA.light:LA.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,RA,{enumerable:!1,writable:!1,value:!0}),t}async function BA(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Nk(e)).map(async e=>await jk(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function VA(e){return(await Promise.all(e.map(async e=>Fk(e)?null:zA(await jk(e))))).filter(e=>!!e)}var HA=3,UA=!1;function WA(e,t=3){if(HA&&!(typeof HA==`number`&&t>HA)){if(UA)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var GA=class extends Error{constructor(e){super(e),this.name=`ShikiError`}},KA=class extends lO{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=zA(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=VE.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){if(this._alias[e]){let t=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],t.has(e))throw new GA(`Circular alias \`${Array.from(t).join(` -> `)} -> ${e}\``);t.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t&&t.embeddedLangs?.some(e=>n.map(([e])=>e).includes(e))).filter(e=>!n.includes(e));throw new GA(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){if(this._langMap.set(e.name,e),this._langGraph.set(e.name,e),e.embeddedLangs)for(let t of e.embeddedLangs)this._langGraph.set(t,this._langMap.get(t))}},qA=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},JA=0;function YA(e){JA+=1,e.warnings!==!1&&JA>=10&&JA%10==0&&console.warn(`[Shiki] ${JA} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new GA("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(zA),i=new KA(new qA(e.engine,n),r,n,e.langAlias),a;function o(e){h();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new GA(`Language \`${e}\` not found, you may need to load it first`);return t}function s(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};h();let t=i.getTheme(e);if(!t)throw new GA(`Theme \`${e}\` not found, you may need to load it first`);return t}function c(e){h();let t=s(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function l(){return h(),i.getLoadedThemes()}function u(){return h(),i.getLoadedLanguages()}function d(...e){h(),i.loadLanguages(e.flat(1))}async function f(...e){return d(await BA(e))}function p(...e){h();for(let t of e.flat(1))i.loadTheme(t)}async function m(...e){return h(),p(await VA(e))}function h(){if(t)throw new GA(`Shiki instance has been disposed`)}function g(){t||(t=!0,i.dispose(),--JA)}return{setTheme:c,getTheme:s,getLanguage:o,getLoadedThemes:l,getLoadedLanguages:u,loadLanguage:f,loadLanguageSync:d,loadTheme:m,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function XA(e){e.engine||WA("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([VA(e.themes||[]),BA(e.langs||[]),e.engine]);return YA({...e,themes:t,langs:n,engine:r})}async function ZA(e){let t=await XA(e);return{getLastGrammarState:(...e)=>_A(t,...e),codeToTokensBase:(e,n)=>gA(t,e,n),codeToTokensWithThemes:(e,n)=>TA(t,e,n),codeToTokens:(e,n)=>DA(t,e,n),codeToHast:(e,n)=>kA(t,e,n),codeToHtml:(e,n)=>FA(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function QA(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(Nk(n))return[];n=e.langAlias?.[n]||n;let r=t[n];if(!r)throw new DE(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(Fk(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new DE(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await ZA({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function $A(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}else{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function ej(e,t){let n=$A(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var tj=[{id:`abap`,name:`ABAP`,import:(()=>H(()=>import(`./abap-CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>H(()=>import(`./actionscript-3-CzQY2Bug.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>H(()=>import(`./ada-C5qYipkI.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>H(()=>import(`./angular-html-HOxwNvyT.js`).then(e=>e.n),__vite__mapDeps([5,1,6,7,8])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>H(()=>import(`./angular-ts-Ov9R9Ljq.js`),__vite__mapDeps([9,5,1,6,7,8,10])))},{id:`apache`,name:`Apache Conf`,import:(()=>H(()=>import(`./apache-U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>H(()=>import(`./apex-BNbugBKF.js`),[]))},{id:`apl`,name:`APL`,import:(()=>H(()=>import(`./apl-CXOUvgw5.js`),__vite__mapDeps([11,7,1,6,8,12,13,14])))},{id:`applescript`,name:`AppleScript`,import:(()=>H(()=>import(`./applescript-CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>H(()=>import(`./ara-4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>H(()=>import(`./asciidoc-CmcyU4-6.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>H(()=>import(`./asm-Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>H(()=>import(`./astro-CVgXjgWt.js`),__vite__mapDeps([15,7,1,8,12,16,17,18])))},{id:`awk`,name:`AWK`,import:(()=>H(()=>import(`./awk-BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>H(()=>import(`./ballerina-B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>H(()=>import(`./bat-Bo4NYOV-.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>H(()=>import(`./beancount-D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>H(()=>import(`./berry-jid5E5RX.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>H(()=>import(`./bibtex-Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>H(()=>import(`./bicep-CUHmPFLl.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>H(()=>import(`./blade-BoqMnz_b.js`),__vite__mapDeps([19,7,1,20,6,8,12,21,13,14])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>H(()=>import(`./bsl-BkkzgIyY.js`),__vite__mapDeps([22,23])))},{id:`c`,name:`C`,import:(()=>H(()=>import(`./c-DOayRvVf.js`).then(e=>e.n),__vite__mapDeps([24,1])))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>H(()=>import(`./cadence-CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>H(()=>import(`./cairo-DLTphjLi.js`),__vite__mapDeps([25,26])))},{id:`clarity`,name:`Clarity`,import:(()=>H(()=>import(`./clarity-SemFz856.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>H(()=>import(`./clojure-DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>H(()=>import(`./cmake-Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>H(()=>import(`./cobol-Xel1q7J4.js`),__vite__mapDeps([27,6,1,7,8,14])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>H(()=>import(`./codeowners-C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>H(()=>import(`./codeql-oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>H(()=>import(`./coffee-CPGd8RFL.js`),__vite__mapDeps([28,8,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>H(()=>import(`./common-lisp-Cv5bFMCO.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>H(()=>import(`./coq-BrsZFFmf.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>H(()=>import(`./cpp-DcSExVLf.js`).then(e=>e.n),__vite__mapDeps([29,1,30,24,31,21])))},{id:`crystal`,name:`Crystal`,import:(()=>H(()=>import(`./crystal-DSuicNBl.js`),__vite__mapDeps([32,24,1,7,6,8,33,21])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>H(()=>import(`./csharp-BEKXm5hI.js`),[]))},{id:`css`,name:`CSS`,import:(()=>H(()=>import(`./css-DoNhQY6j.js`).then(e=>e.n),__vite__mapDeps([7,1])))},{id:`csv`,name:`CSV`,import:(()=>H(()=>import(`./csv-Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>H(()=>import(`./cue-CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>H(()=>import(`./cypher-ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>H(()=>import(`./d-qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>H(()=>import(`./dart-DkHntEIa.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>H(()=>import(`./dax-BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>H(()=>import(`./desktop-Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>H(()=>import(`./diff-woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>H(()=>import(`./docker-IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>H(()=>import(`./dotenv-_5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>H(()=>import(`./dream-maker-DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>H(()=>import(`./edge-193c5yJY.js`),__vite__mapDeps([34,20,1,6,7,8,18])))},{id:`elixir`,name:`Elixir`,import:(()=>H(()=>import(`./elixir-ND4M129Z.js`),__vite__mapDeps([35,6,1,7,8])))},{id:`elm`,name:`Elm`,import:(()=>H(()=>import(`./elm-2Xpf1qa1.js`),__vite__mapDeps([36,30,1,24])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>H(()=>import(`./emacs-lisp-C9PiwqqW.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>H(()=>import(`./erb-B3CzWkDu.js`),__vite__mapDeps([37,6,1,7,8,38,24,29,30,31,21,39,40,17,18,41,42,33,13,14,43])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>H(()=>import(`./erlang-Cphh6RMH.js`),__vite__mapDeps([44,45])))},{id:`fennel`,name:`Fennel`,import:(()=>H(()=>import(`./fennel-DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>H(()=>import(`./fish-BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>H(()=>import(`./fluent-C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>H(()=>import(`./fortran-fixed-form-BJLMMyj_.js`),__vite__mapDeps([46,47])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>H(()=>import(`./fortran-free-form-B3N2jM_P.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>H(()=>import(`./fsharp-D13ZGOAj.js`),__vite__mapDeps([48,45])))},{id:`gdresource`,name:`GDResource`,import:(()=>H(()=>import(`./gdresource-DJtKbqXX.js`),__vite__mapDeps([49,50,51])))},{id:`gdscript`,name:`GDScript`,import:(()=>H(()=>import(`./gdscript-CtYHxktr.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>H(()=>import(`./gdshader-CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>H(()=>import(`./genie-CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>H(()=>import(`./gherkin-DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>H(()=>import(`./git-commit-BSykSTBG.js`),__vite__mapDeps([52,53])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>H(()=>import(`./git-rebase-CPlAfnUu.js`),__vite__mapDeps([54,33,1])))},{id:`gleam`,name:`Gleam`,import:(()=>H(()=>import(`./gleam-CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>H(()=>import(`./glimmer-js-CxAZE7iu.js`),__vite__mapDeps([55,7,1,6,8,18])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>H(()=>import(`./glimmer-ts-CNJweuJS.js`),__vite__mapDeps([56,7,1,6,8,18])))},{id:`glsl`,name:`GLSL`,import:(()=>H(()=>import(`./glsl-CDvScVSv.js`).then(e=>e.n),__vite__mapDeps([30,1,24])))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>H(()=>import(`./gnuplot-7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>H(()=>import(`./go-DNk2CfY5.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>H(()=>import(`./graphql-CLdnI2jj.js`).then(e=>e.n),__vite__mapDeps([39,1,8,40,17,18])))},{id:`groovy`,name:`Groovy`,import:(()=>H(()=>import(`./groovy-CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>H(()=>import(`./hack-U_u3qiXF.js`),__vite__mapDeps([57,6,1,7,8,21])))},{id:`haml`,name:`Ruby Haml`,import:(()=>H(()=>import(`./haml-B_7gR2-C.js`).then(e=>e.n),__vite__mapDeps([41,1,7,8])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>H(()=>import(`./handlebars-CIGlWSZz.js`),__vite__mapDeps([58,7,1,6,8,43])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>H(()=>import(`./haskell-D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>H(()=>import(`./haxe-OTjmBuCE.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>H(()=>import(`./hcl-Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>H(()=>import(`./hjson-CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>H(()=>import(`./hlsl-Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>H(()=>import(`./html-B2jixUwZ.js`).then(e=>e.n),__vite__mapDeps([6,1,7,8])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>H(()=>import(`./html-derivative-DDwnamny.js`).then(e=>e.n),__vite__mapDeps([20,1,6,7,8])))},{id:`http`,name:`HTTP`,import:(()=>H(()=>import(`./http-BEmBIeh2.js`),__vite__mapDeps([59,39,1,8,40,17,18,12,33,13,14])))},{id:`hurl`,name:`Hurl`,import:(()=>H(()=>import(`./hurl-BoVPi727.js`),__vite__mapDeps([60,61,39,1,8,40,17,18,13,14])))},{id:`hxml`,name:`HXML`,import:(()=>H(()=>import(`./hxml-B0Qn7Nwc.js`),__vite__mapDeps([62,63])))},{id:`hy`,name:`Hy`,import:(()=>H(()=>import(`./hy-CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>H(()=>import(`./imba-DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>H(()=>import(`./ini-B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>H(()=>import(`./java-DUjKRM5T.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>H(()=>import(`./javascript-B0z-AXw4.js`).then(e=>e.n),__vite__mapDeps([8,1])))},{id:`jinja`,name:`Jinja`,import:(()=>H(()=>import(`./jinja-DHg7q1DE.js`),__vite__mapDeps([64,6,1,7,8])))},{id:`jison`,name:`Jison`,import:(()=>H(()=>import(`./jison-Bi4c9iNP.js`),__vite__mapDeps([65,8,1])))},{id:`json`,name:`JSON`,import:(()=>H(()=>import(`./json-DXfqaPEF.js`).then(e=>e.n),__vite__mapDeps([12,1])))},{id:`json5`,name:`JSON5`,import:(()=>H(()=>import(`./json5-BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>H(()=>import(`./jsonc-CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>H(()=>import(`./jsonl-CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>H(()=>import(`./jsonnet-CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>H(()=>import(`./jssm-DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>H(()=>import(`./jsx-xIBTuBAZ.js`).then(e=>e.n),__vite__mapDeps([40,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>H(()=>import(`./julia-w0S0kN7z.js`),__vite__mapDeps([66,29,1,30,24,31,21,8,26,67])))},{id:`kdl`,name:`KDL`,import:(()=>H(()=>import(`./kdl-CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>H(()=>import(`./kotlin-DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>H(()=>import(`./kusto-DZOoy8cc.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>H(()=>import(`./latex-ed26ywxS.js`),__vite__mapDeps([68,69,67,1])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>H(()=>import(`./lean-CRnrS228.js`),[]))},{id:`less`,name:`Less`,import:(()=>H(()=>import(`./less-DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>H(()=>import(`./liquid-CAruNf-N.js`),__vite__mapDeps([70,7,1,6,8,12])))},{id:`llvm`,name:`LLVM IR`,import:(()=>H(()=>import(`./llvm-gMuDX7E9.js`),[]))},{id:`log`,name:`Log file`,import:(()=>H(()=>import(`./log-BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>H(()=>import(`./logo-Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>H(()=>import(`./lua-CdPd6TdG.js`).then(e=>e.n),__vite__mapDeps([42,1,24])))},{id:`luau`,name:`Luau`,import:(()=>H(()=>import(`./luau-BVYDJs9u.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>H(()=>import(`./make-Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>H(()=>import(`./markdown-BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>H(()=>import(`./marko-DJQST3lL.js`),__vite__mapDeps([71,7,1,72,10,18])))},{id:`matlab`,name:`MATLAB`,import:(()=>H(()=>import(`./matlab-D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>H(()=>import(`./mdc-BpPhzEd0.js`),__vite__mapDeps([73,20,1,6,7,8,45,43])))},{id:`mdx`,name:`MDX`,import:(()=>H(()=>import(`./mdx-DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>H(()=>import(`./mermaid-CVB5KUjh.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>H(()=>import(`./mipsasm-BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>H(()=>import(`./mojo-BMVD-x3l.js`),[]))},{id:`move`,name:`Move`,import:(()=>H(()=>import(`./move-DAfwgNoA.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>H(()=>import(`./narrat-_X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>H(()=>import(`./nextflow-CKcj7-Pb.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>H(()=>import(`./nginx-D0L6l3UG.js`),__vite__mapDeps([74,42,1,24])))},{id:`nim`,name:`Nim`,import:(()=>H(()=>import(`./nim-CXwZWzWk.js`),__vite__mapDeps([75,24,1,7,30,6,8,45,13,14])))},{id:`nix`,name:`Nix`,import:(()=>H(()=>import(`./nix-BMeD4hpW.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>H(()=>import(`./nushell-BRQfS1u5.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>H(()=>import(`./objective-c-D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>H(()=>import(`./objective-cpp-BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>H(()=>import(`./ocaml-O90oeIOV.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>H(()=>import(`./pascal-4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>H(()=>import(`./perl-Bu8Q5Bv6.js`),__vite__mapDeps([76,7,1,6,8,21,13,14])))},{id:`php`,name:`PHP`,import:(()=>H(()=>import(`./php-B4SpY2t5.js`),__vite__mapDeps([77,7,1,6,8,12,21,13,14])))},{id:`pkl`,name:`Pkl`,import:(()=>H(()=>import(`./pkl-ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>H(()=>import(`./plsql-DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>H(()=>import(`./po-BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>H(()=>import(`./polar-C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>H(()=>import(`./postcss-BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>H(()=>import(`./powerquery-DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>H(()=>import(`./powershell-DshXNtvi.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>H(()=>import(`./prisma-BsRQq5mF.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>H(()=>import(`./prolog-iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>H(()=>import(`./proto-9sO0eQ3y.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>H(()=>import(`./pug-BaOpKkdB.js`),__vite__mapDeps([78,7,1,6,8])))},{id:`puppet`,name:`Puppet`,import:(()=>H(()=>import(`./puppet-CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>H(()=>import(`./purescript-9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>H(()=>import(`./python-gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>H(()=>import(`./qml-sjeCigfm.js`),__vite__mapDeps([79,8,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>H(()=>import(`./qmldir-DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>H(()=>import(`./qss-Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>H(()=>import(`./r-D6SIBEiO.js`).then(e=>e.n),__vite__mapDeps([67,1])))},{id:`racket`,name:`Racket`,import:(()=>H(()=>import(`./racket-DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>H(()=>import(`./raku-B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>H(()=>import(`./razor-BDd5S6a7.js`),__vite__mapDeps([80,81,6,1,7,8])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>H(()=>import(`./reg-CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>H(()=>import(`./regexp-B9Q6kuZt.js`).then(e=>e.n),__vite__mapDeps([31,1])))},{id:`rel`,name:`Rel`,import:(()=>H(()=>import(`./rel-BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>H(()=>import(`./riscv-Ckw8ddFX.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>H(()=>import(`./rosmsg-CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>H(()=>import(`./rst-BIVXRxMh.js`),__vite__mapDeps([82,83,29,1,30,24,31,21,20,6,7,8,26,38,39,40,17,18,41,42,33,13,14,43])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>H(()=>import(`./ruby-BGs-nVm6.js`),__vite__mapDeps([38,24,1,29,30,31,21,7,39,8,40,17,18,41,6,42,33,13,14,43])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>H(()=>import(`./rust-Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>H(()=>import(`./sas-B2Nr8S2D.js`),__vite__mapDeps([84,21,1])))},{id:`sass`,name:`Sass`,import:(()=>H(()=>import(`./sass-DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>H(()=>import(`./scala-DKOlJaKm.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>H(()=>import(`./scheme-DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>H(()=>import(`./scss-DbrHP5dI.js`).then(e=>e.n),__vite__mapDeps([10,1,7])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>H(()=>import(`./sdbl-bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>H(()=>import(`./shaderlab-TOUzSsQk.js`),__vite__mapDeps([85,86])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>H(()=>import(`./shellscript-DmsGrsQL.js`).then(e=>e.n),__vite__mapDeps([33,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>H(()=>import(`./shellsession-BLlGThAF.js`),__vite__mapDeps([87,33,1])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>H(()=>import(`./smalltalk-B16xEiuN.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>H(()=>import(`./solidity-DawnnwS6.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>H(()=>import(`./soy-y67J1JBf.js`),__vite__mapDeps([88,6,1,7,8])))},{id:`sparql`,name:`SPARQL`,import:(()=>H(()=>import(`./sparql-D_iOobhT.js`),__vite__mapDeps([89,90])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>H(()=>import(`./splunk-BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>H(()=>import(`./sql-DF8Xc7bQ.js`).then(e=>e.n),__vite__mapDeps([21,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>H(()=>import(`./ssh-config-BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>H(()=>import(`./stata-DWwtR4o7.js`),__vite__mapDeps([91,21,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>H(()=>import(`./stylus-B6D30XZt.js`),[]))},{id:`svelte`,name:`Svelte`,import:(()=>H(()=>import(`./svelte-BVXg4aFm.js`),__vite__mapDeps([92,7,1,8,16,18])))},{id:`swift`,name:`Swift`,import:(()=>H(()=>import(`./swift-C5OpMdXo.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>H(()=>import(`./system-verilog-DJ5XKQeo.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>H(()=>import(`./systemd-BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>H(()=>import(`./talonscript-CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>H(()=>import(`./tasl-DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>H(()=>import(`./tcl-CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>H(()=>import(`./templ-B35jE-cr.js`),__vite__mapDeps([93,7,1,94,8])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>H(()=>import(`./terraform-DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>H(()=>import(`./tex-C_btdDbR.js`),__vite__mapDeps([69,67,1])))},{id:`toml`,name:`TOML`,import:(()=>H(()=>import(`./toml-CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>H(()=>import(`./ts-tags-B1RVrAVr.js`),__vite__mapDeps([95,7,1,30,24,6,8,21,18,13,14])))},{id:`tsv`,name:`TSV`,import:(()=>H(()=>import(`./tsv-sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>H(()=>import(`./tsx-37JSciWV.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`turtle`,name:`Turtle`,import:(()=>H(()=>import(`./turtle-ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>H(()=>import(`./twig-BaTGNYMW.js`),__vite__mapDeps([96,7,1,8,77,6,12,21,13,14,26,38,24,29,30,31,39,40,17,18,41,42,33,43,10])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>H(()=>import(`./typescript-CdMIlDjx.js`).then(e=>e.n),__vite__mapDeps([18,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>H(()=>import(`./typespec-M5HnuNy0.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>H(()=>import(`./typst-DI99ib-x.js`),[]))},{id:`v`,name:`V`,import:(()=>H(()=>import(`./v-DETTlOr0.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>H(()=>import(`./vala-zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>H(()=>import(`./vb-Djn5o6TS.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>H(()=>import(`./verilog-CiiDBU1e.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>H(()=>import(`./vhdl-BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>H(()=>import(`./viml-DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>H(()=>import(`./vue-C1368MUJ.js`),__vite__mapDeps([97,7,1,20,6,8,12,18])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>H(()=>import(`./vue-html-CMU60TJw.js`),__vite__mapDeps([98,8,1,97,7,20,6,12,18])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>H(()=>import(`./vue-vine-B0ZobtBU.js`),__vite__mapDeps([99,7,1,8,72,97,20,6,12,18,16,10,100])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>H(()=>import(`./vyper-CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>H(()=>import(`./wasm-ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>H(()=>import(`./wenyan-C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>H(()=>import(`./wgsl-BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>H(()=>import(`./wikitext-ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>H(()=>import(`./wit-DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>H(()=>import(`./wolfram-DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>H(()=>import(`./xml-BGEfOfoz.js`).then(e=>e.n),__vite__mapDeps([13,1,14])))},{id:`xsl`,name:`XSL`,import:(()=>H(()=>import(`./xsl-D3QHn1W2.js`),__vite__mapDeps([101,13,1,14])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>H(()=>import(`./yaml-Ce3AqKtC.js`).then(e=>e.n),__vite__mapDeps([43,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>H(()=>import(`./zenscript-BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>H(()=>import(`./zig-CMLA9XwU.js`),[]))}],nj=Object.fromEntries(tj.map(e=>[e.id,e.import])),rj=Object.fromEntries(tj.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ij={...nj,...rj},aj=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>H(()=>import(`./andromeeda-C5osXYoj.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>H(()=>import(`./aurora-x-CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>H(()=>import(`./ayu-dark-CXHoNUfW.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>H(()=>import(`./catppuccin-frappe-3VR1Za6u.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>H(()=>import(`./catppuccin-latte-DwIHMF0Q.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>H(()=>import(`./catppuccin-macchiato-DYnBP6_5.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>H(()=>import(`./catppuccin-mocha-DYhrFGRu.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>H(()=>import(`./dark-plus-AMoNTmtj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>H(()=>import(`./dracula-BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>H(()=>import(`./dracula-soft-5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>H(()=>import(`./everforest-dark-sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>H(()=>import(`./everforest-light-Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>H(()=>import(`./github-dark-C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>H(()=>import(`./github-dark-default-DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>H(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>H(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>H(()=>import(`./github-light-EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>H(()=>import(`./github-light-default-BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>H(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>H(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>H(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>H(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>H(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>H(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>H(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>H(()=>import(`./houston-CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>H(()=>import(`./kanagawa-dragon-CXtmUGW6.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>H(()=>import(`./kanagawa-lotus-BN08jTvb.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>H(()=>import(`./kanagawa-wave-CTweb8Dz.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>H(()=>import(`./laserwave-C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>H(()=>import(`./light-plus-DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>H(()=>import(`./material-theme-Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>H(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>H(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>H(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>H(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>H(()=>import(`./min-dark-BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>H(()=>import(`./min-light-DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>H(()=>import(`./monokai-CdkpiU2Y.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>H(()=>import(`./night-owl-DhmEMT88.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>H(()=>import(`./nord-Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>H(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>H(()=>import(`./one-light-DpTtcPZs.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>H(()=>import(`./plastic-DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>H(()=>import(`./poimandres-DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>H(()=>import(`./red-CJ3rzSJv.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>H(()=>import(`./rose-pine-CtiaJAjZ.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>H(()=>import(`./rose-pine-dawn-6gSzoyYH.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>H(()=>import(`./rose-pine-moon-C94p5VwC.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>H(()=>import(`./slack-dark-DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>H(()=>import(`./slack-ochin-B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>H(()=>import(`./snazzy-light-4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>H(()=>import(`./solarized-dark-DV17i1UV.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>H(()=>import(`./solarized-light-DSh2HLQt.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>H(()=>import(`./synthwave-84-nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>H(()=>import(`./tokyo-night-oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>H(()=>import(`./vesper-D5bVUKB1.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>H(()=>import(`./vitesse-black-fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>H(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>H(()=>import(`./vitesse-light-VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),oj=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function sj(){return 2147483648}function cj(){return typeof performance<`u`?performance.now():Date.now()}var lj=(e,t)=>e+(t-e%t)%t;async function uj(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=sj();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,lj(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:cj,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var dj=Object.defineProperty,fj=(e,t,n)=>t in e?dj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pj=(e,t,n)=>fj(e,typeof t==`symbol`?t:t+``,n),mj=null;function hj(e){throw new oj(e.UTF8ToString(e.getLastOnigError()))}var gj=class e{constructor(t){pj(this,`utf16Length`),pj(this,`utf8Length`),pj(this,`utf16Value`),pj(this,`utf8Value`),pj(this,`utf16OffsetToUtf8`),pj(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},_j=class e{constructor(t){if(pj(this,`id`,++e.LAST_ID),pj(this,`_onigBinding`),pj(this,`content`),pj(this,`utf16Length`),pj(this,`utf8Length`),pj(this,`utf16OffsetToUtf8`),pj(this,`utf8OffsetToUtf16`),pj(this,`ptr`),!mj)throw new oj(`Must invoke loadWasm first.`);this._onigBinding=mj,this.content=t;let n=new gj(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=mj.omalloc(1e4),e._sharedPtrInUse=!0,mj.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(mj)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};pj(_j,`LAST_ID`,0),pj(_j,`_sharedPtr`,0),pj(_j,`_sharedPtrInUse`,!1);var vj=_j,yj=class{constructor(e){if(pj(this,`_onigBinding`),pj(this,`_ptr`),!mj)throw new oj(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new gj(e[r]);t[r]=i.createString(mj),n[r]=i.utf8Length}let r=mj.omalloc(4*e.length);mj.HEAPU32.set(t,r/4);let i=mj.omalloc(4*e.length);mj.HEAPU32.set(n,i/4);let a=mj.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)mj.ofree(t[n]);mj.ofree(i),mj.ofree(r),a===0&&hj(mj),this._onigBinding=mj,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new vj(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function bj(e){return typeof e.instantiator==`function`}function xj(e){return typeof e.default==`function`}function Sj(e){return e.data!==void 0}function Cj(e){return typeof Response<`u`&&e instanceof Response}function wj(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Tj;function Ej(e){if(Tj)return Tj;async function t(){mj=await uj(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),bj(n)?n=await n.instantiator(t):xj(n)?n=await n.default(t):(Sj(n)&&(n=n.data),Cj(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Oj(n)(t):await kj(n)(t):wj(n)||n instanceof WebAssembly.Module?n=await Dj(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Dj(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Tj=t(),Tj}function Dj(e){return t=>WebAssembly.instantiate(e,t)}function Oj(e){return t=>WebAssembly.instantiateStreaming(e,t)}function kj(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function Aj(e){return e&&await Ej(e),{createScanner(e){return new yj(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new vj(e)}}}var jj=QA({langs:ij,themes:aj,engine:()=>Aj(H(()=>import(`./wasm-BnjxR4X6.js`),[]))}),{codeToHtml:Mj,codeToHast:Nj,codeToTokens:Pj,codeToTokensBase:Fj,codeToTokensWithThemes:Ij,getSingletonHighlighter:Lj,getLastGrammarState:Rj}=ej(jj,{guessEmbeddedLanguages:zk});function zj(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Bj(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Vj=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),Hj=String.raw;function Uj(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Wj=Hj`\[\^?`,Gj=`c.? | C(?:-.?)?|${Hj`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Hj`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Hj`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Hj`o\{[^\}]*\}?`}|${Hj`\d{1,3}`}`,Kj=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,qj=new RegExp(Hj`
|
|
92
|
-
\\ (?:
|
|
93
|
-
${Gj}
|
|
94
|
-
| [gk]<[^>]*>?
|
|
95
|
-
| [gk]'[^']*'?
|
|
96
|
-
| .
|
|
97
|
-
)
|
|
98
|
-
| \( (?:
|
|
99
|
-
\? (?:
|
|
100
|
-
[:=!>({]
|
|
101
|
-
| <[=!]
|
|
102
|
-
| <[^>]*>
|
|
103
|
-
| '[^']*'
|
|
104
|
-
| ~\|?
|
|
105
|
-
| #(?:[^)\\]|\\.?)*
|
|
106
|
-
| [^:)]*[:)]
|
|
107
|
-
)?
|
|
108
|
-
| \*[^\)]*\)?
|
|
109
|
-
)?
|
|
110
|
-
| (?:${Kj.source})+
|
|
111
|
-
| ${Wj}
|
|
112
|
-
| .
|
|
113
|
-
`.replace(/\s+/g,``),`gsu`),Jj=new RegExp(Hj`
|
|
114
|
-
\\ (?:
|
|
115
|
-
${Gj}
|
|
116
|
-
| .
|
|
117
|
-
)
|
|
118
|
-
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
119
|
-
| ${Wj}
|
|
120
|
-
| &&
|
|
121
|
-
| .
|
|
122
|
-
`.replace(/\s+/g,``),`gsu`);function Yj(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=TM(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(qj.lastIndex=0;s=qj.exec(e);){let t=Xj(a,e,s[0],qj.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(qj.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?DM(e,u):e).flat(),flags:r}}function Xj(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=Zj(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:tM(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:hM(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:nM(n)}}if(a===`K`)return{token:lM(`keep`,n)};if(a===`N`||a===`R`)return{token:cM(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:cM(`any`,n)};if(a===`X`)return{token:cM(`text_segment`,n)};let e=$j(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:bM(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:yM(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:fM(`group`,n)};if(n===`(?>`)return{token:fM(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:fM(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:fM(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:fM(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:dM(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
|
|
123
|
-
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:cM(`dot`,n)}:n===`^`||n===`$`?{token:tM(e.singleline?{"^":Hj`\A`,$:Hj`\Z`}[n]:n,n)}:n===`|`?{token:eM(n)}:Kj.test(n)?{tokens:OM(n)}:{token:rM(zj(n),n)}}function Zj(e,t,n){let r=[sM(t[1]===`^`,t)],i=1,a;for(Jj.lastIndex=n;a=Jj.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(sM(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(rM(93,e));else if(i--,r.push(iM(e)),!i)break}else{let t=Qj(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:Jj.lastIndex||e.length}}function Qj(e){if(e[0]===`\\`)return $j(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Vj.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return cM(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?aM(e):e===`&&`?oM(e):rM(zj(e),e)}function $j(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return vM(e);if(`dDhHsSwW`.includes(n))return SM(e);if(e.startsWith(Hj`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return CM(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return rM(zj(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return rM(EM(e),e);if(_M.has(n))return rM(_M.get(n),e);if(/\d/.test(n))return uM(t,e);if(e===`\\`)throw Error(Hj`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return rM(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function eM(e){return{type:`Alternator`,raw:e}}function tM(e,t){return{type:`Assertion`,kind:e,raw:t}}function nM(e){return{type:`Backreference`,raw:e}}function rM(e,t){return{type:`Character`,value:e,raw:t}}function iM(e){return{type:`CharacterClassClose`,raw:e}}function aM(e){return{type:`CharacterClassHyphen`,raw:e}}function oM(e){return{type:`CharacterClassIntersector`,raw:e}}function sM(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function cM(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function lM(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Uj(n.flags),raw:t}}function uM(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function dM(e){return{type:`GroupClose`,raw:e}}function fM(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function pM(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function mM(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function hM(e){return{type:`Subroutine`,raw:e}}var gM=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),_M=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function vM(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return rM(zj(t.toUpperCase())-64,e)}function yM(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=wM(n),o=wM(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),lM(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,fM(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function bM(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=gM.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return pM(l,r??null,i?.split(`,`)??null,e)}function xM(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return mM(t,n,r,e)}function SM(e){let t=e[1].toLowerCase();return cM({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function CM(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return cM(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function wM(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function TM(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function EM(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function DM(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[nM(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(Hj`Octal encoded byte above 177 unsupported "${n}"`)}else r=zj(t);a.push(rM(r,(e===0?`\\`:``)+t))}return a}function OM(e){let t=[],n=new RegExp(Kj,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(xM(e.slice(0,-1)));continue}}}t.push(xM(e))}return t}function kM(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function AM(e){return jM.has(e.type)}var jM=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function MM(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Yj(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return HM();case`Assertion`:return NM(n);case`Backreference`:return PM(n,a);case`Character`:return KM(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return FM(n,a,t);case`CharacterClassOpen`:return IM(n,a,t);case`CharacterSet`:return LM(n,a);case`Directive`:return XM(n.kind,{flags:n.flags});case`GroupOpen`:return RM(n,a,t);case`NamedCallout`:return eN(n.kind,n.tag,n.arguments);case`Quantifier`:return zM(n,a);case`Subroutine`:return BM(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=rN(ZM(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(Hj`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(Hj`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function NM({kind:e}){return UM(Uj({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===Hj`\B`||e===Hj`\Y`})}function PM({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i)if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,WM(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return WM(r)}return i(+r)}function FM(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),JM(o,e);throw Error(`Invalid character class range`)}return KM(zj(`-`))}function IM({negate:e},t,n){let{tokens:r,walk:i}=t,a=r[t.nextIndex],o=[qM()],s=mN(a);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)o.push(qM()),t.nextIndex++;else{let e=o.at(-1);e.body.push(i(e,n))}s=mN(r[t.nextIndex],a)}let c=qM({negate:e});return o.length===1?c.body=o[0].body:(c.kind=`intersection`,c.body=o.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function LM({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=pN(n);if(Vj.has(r)&&!o?.has(r))e=`posix`,n=r;else return aN(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?tN(n,{negate:t}):YM(e,{negate:t})}function RM(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=oN(e),l=c.type===`AbsenceFunction`,u=uN(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&Bj(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=hN(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(HM()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(lN(t)||t.type===`CapturingGroup`)throw Error(e)}else if(lN(t)||uN(t)&&t.negate)throw Error(e)}}f=hN(r[t.nextIndex])}return t.nextIndex++,c}function zM({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!AM(a))throw Error(`Quantifier requires a repeatable token`);let o=nN(e,t,n,a);return i.body.pop(),o}function BM({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=iN(i);return r.push(o),o}function VM(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:sN(t?.body)}}function HM(e){return{type:`Alternative`,body:cN(e?.body)}}function UM(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function WM(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function GM(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!dN(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:sN(t?.body)}}function KM(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function qM(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:cN(e?.body)}}function JM(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function YM(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function XM(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:Uj(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function ZM(e){return{type:`Flags`,...e}}function QM(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:sN(e?.body)}}function $M(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:sN(e?.body)}}function eN(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function tN(e,t){let n=!!t?.negate;if(!Vj.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function nN(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function rN(e,t){return{type:`Regex`,body:sN(t?.body),flags:e}}function iN(e){return{type:`Subroutine`,ref:e}}function aN(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(pN(e));if(!r){if(n.normalizeUnknownPropertyNames)r=fN(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(Hj`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function oN({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return VM(`repeater`);case`atomic`:return QM({atomic:!0});case`capturing`:return GM(i,{name:n});case`group`:return QM({flags:e});case`lookahead`:case`lookbehind`:return $M({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function sN(e){if(e===void 0)e=[HM()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function cN(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function lN(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function uN(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function dN(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function fN(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function pN(e){return e.replace(/[- _]+/g,``).toLowerCase()}function mN(e,t){return Uj(e,`${t?.type===`Character`&&t.value===93?`Empty`:`Unclosed`} character class`)}function hN(e){return Uj(e,`Unclosed group`)}function gN(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){_N(c).splice(Math.max(0,vN(s)+l),1),l--,u=!0},removeAllNextSiblings(){return _N(c).splice(vN(s)+1)},removeAllPrevSiblings(){let e=vN(s)+l;return l-=e,_N(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,vN(s)+l)]=e:Uj(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(_N(c).splice(Math.max(0,vN(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,vN(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`CapturingGroup`:case`Group`:r(a.body,a);break;case`Alternative`:case`CharacterClass`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`LookaroundAssertion`:r(a.body,a);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function _N(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function vN(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var yN=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function bN(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function xN(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var SN=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function CN(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===SN.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?SN.CHAR_CLASS:SN.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function wN(e,t,n,r){CN(e,t,n,r)}function TN(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===SN.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function EN(e,t,n){return!!TN(e,t,0,n)}function DN(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var ON=new RegExp(String.raw`(?<noncapturingStart>${yN})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function kN(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(ON.lastIndex=Number.isNaN(c)?0:c+7;f=ON.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),bN(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=CN(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},SN.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var AN=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,jN=new RegExp(String.raw`
|
|
124
|
-
\\(?: \d+
|
|
125
|
-
| c[A-Za-z]
|
|
126
|
-
| [gk]<[^>]+>
|
|
127
|
-
| [pPu]\{[^\}]+\}
|
|
128
|
-
| u[A-Fa-f\d]{4}
|
|
129
|
-
| x[A-Fa-f\d]{2}
|
|
130
|
-
)
|
|
131
|
-
| \((?: \? (?: [:=!>]
|
|
132
|
-
| <(?:[=!]|[^>]+>)
|
|
133
|
-
| [A-Za-z\-]+:
|
|
134
|
-
| \(DEFINE\)
|
|
135
|
-
))?
|
|
136
|
-
| (?<qBase>${AN})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
137
|
-
| \\?.
|
|
138
|
-
`.replace(/\s+/g,``),`gsu`);function MN(e){if(!RegExp(`${AN}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(jN.lastIndex=0;o=jN.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a)if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=xN(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}jN.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null);i=s}return{pattern:e}}var NN=String.raw,PN=NN`\(\?R=(?<rDepth>[^\)]+)\)|${NN`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,FN=NN`\(\?<(?![=!])(?<captureName>[^>]+)>`,IN=NN`${FN}|(?<unnamed>\()(?!\?)`,LN=new RegExp(NN`${FN}|${PN}|\(\?|\\?.`,`gsu`),RN=`Cannot use multiple overlapping recursions`;function zN(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(PN,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&EN(e,NN`\(\?\(DEFINE\)`,SN.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=EN(e,NN`\\[1-9]`,SN.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(LN.lastIndex=0;f=LN.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else if(m){if(BN(m),l)throw Error(RN);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(LN.lastIndex);if(EN(s,PN,SN.DEFAULT))throw Error(RN);let c=m-1;e=VN(t,s,c,!1,n,a,d),i=WN(i,t,c,a.length,0,d);break}else if(h){BN(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(RN);break}if(!u)throw Error(NN`Recursive \g cannot be used outside the referenced group "${r===`external`?h:NN`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=DN(e,p);if(o&&EN(m,NN`${FN}|\((?!\?)`,SN.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=VN(_,v,b,!0,n,a,d);i=WN(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,LN.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),LN.lastIndex),s.set(p,LN.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),LN.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function BN(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function VN(e,t,n,r,i,a,o){let s=new Set;r&&wN(e+t,FN,({groups:{captureName:e}})=>{s.add(e)},SN.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${HN(`(?:${e}`,`forward`,...c)}(?:)${HN(`${t})`,`backward`,...c)}${t}`}function HN(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=CN(e,NN`${IN}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),UN(i,n),s?e:`(?<${t}${l}>`}return NN`\k<${c}${l}>`},SN.DEFAULT)}return c}function UN(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function WN(e,t,n,r,i,a){if(e.size&&r){let o=0;wN(t,IN,()=>o++,SN.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var GN=String.fromCodePoint,KN=String.raw,qN={flagGroups:!0,unicodeSets:!0};qN.bugFlagVLiteralHyphenIsRange=qN.unicodeSets?(()=>{try{new RegExp(KN`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,qN.bugNestedClassIgnoresNegation=qN.unicodeSets&&RegExp(`[[^a]]`,`v`).test(`a`);function JN(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function YN(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function XN(e,t){return QN[e]>=QN[t]}function ZN(e,t){if(e==null)throw Error(t??`Value expected`);return e}var QN={ES2025:2025,ES2024:2024,ES2018:2018},$N={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function eP(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!$N[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=qN.flagGroups?`ES2025`:qN.unicodeSets?`ES2024`:`ES2018`),t}var tP=`[ -\r ]`,nP=new Set([GN(304),GN(305)]),rP=KN`[\p{L}\p{M}\p{N}\p{Pc}]`;function iP(e){if(nP.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=cP.get(n),a=oP.get(n),o=sP.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var aP=new Map(`C Other
|
|
139
|
-
Cc Control cntrl
|
|
140
|
-
Cf Format
|
|
141
|
-
Cn Unassigned
|
|
142
|
-
Co Private_Use
|
|
143
|
-
Cs Surrogate
|
|
144
|
-
L Letter
|
|
145
|
-
LC Cased_Letter
|
|
146
|
-
Ll Lowercase_Letter
|
|
147
|
-
Lm Modifier_Letter
|
|
148
|
-
Lo Other_Letter
|
|
149
|
-
Lt Titlecase_Letter
|
|
150
|
-
Lu Uppercase_Letter
|
|
151
|
-
M Mark Combining_Mark
|
|
152
|
-
Mc Spacing_Mark
|
|
153
|
-
Me Enclosing_Mark
|
|
154
|
-
Mn Nonspacing_Mark
|
|
155
|
-
N Number
|
|
156
|
-
Nd Decimal_Number digit
|
|
157
|
-
Nl Letter_Number
|
|
158
|
-
No Other_Number
|
|
159
|
-
P Punctuation punct
|
|
160
|
-
Pc Connector_Punctuation
|
|
161
|
-
Pd Dash_Punctuation
|
|
162
|
-
Pe Close_Punctuation
|
|
163
|
-
Pf Final_Punctuation
|
|
164
|
-
Pi Initial_Punctuation
|
|
165
|
-
Po Other_Punctuation
|
|
166
|
-
Ps Open_Punctuation
|
|
167
|
-
S Symbol
|
|
168
|
-
Sc Currency_Symbol
|
|
169
|
-
Sk Modifier_Symbol
|
|
170
|
-
Sm Math_Symbol
|
|
171
|
-
So Other_Symbol
|
|
172
|
-
Z Separator
|
|
173
|
-
Zl Line_Separator
|
|
174
|
-
Zp Paragraph_Separator
|
|
175
|
-
Zs Space_Separator
|
|
176
|
-
ASCII
|
|
177
|
-
ASCII_Hex_Digit AHex
|
|
178
|
-
Alphabetic Alpha
|
|
179
|
-
Any
|
|
180
|
-
Assigned
|
|
181
|
-
Bidi_Control Bidi_C
|
|
182
|
-
Bidi_Mirrored Bidi_M
|
|
183
|
-
Case_Ignorable CI
|
|
184
|
-
Cased
|
|
185
|
-
Changes_When_Casefolded CWCF
|
|
186
|
-
Changes_When_Casemapped CWCM
|
|
187
|
-
Changes_When_Lowercased CWL
|
|
188
|
-
Changes_When_NFKC_Casefolded CWKCF
|
|
189
|
-
Changes_When_Titlecased CWT
|
|
190
|
-
Changes_When_Uppercased CWU
|
|
191
|
-
Dash
|
|
192
|
-
Default_Ignorable_Code_Point DI
|
|
193
|
-
Deprecated Dep
|
|
194
|
-
Diacritic Dia
|
|
195
|
-
Emoji
|
|
196
|
-
Emoji_Component EComp
|
|
197
|
-
Emoji_Modifier EMod
|
|
198
|
-
Emoji_Modifier_Base EBase
|
|
199
|
-
Emoji_Presentation EPres
|
|
200
|
-
Extended_Pictographic ExtPict
|
|
201
|
-
Extender Ext
|
|
202
|
-
Grapheme_Base Gr_Base
|
|
203
|
-
Grapheme_Extend Gr_Ext
|
|
204
|
-
Hex_Digit Hex
|
|
205
|
-
IDS_Binary_Operator IDSB
|
|
206
|
-
IDS_Trinary_Operator IDST
|
|
207
|
-
ID_Continue IDC
|
|
208
|
-
ID_Start IDS
|
|
209
|
-
Ideographic Ideo
|
|
210
|
-
Join_Control Join_C
|
|
211
|
-
Logical_Order_Exception LOE
|
|
212
|
-
Lowercase Lower
|
|
213
|
-
Math
|
|
214
|
-
Noncharacter_Code_Point NChar
|
|
215
|
-
Pattern_Syntax Pat_Syn
|
|
216
|
-
Pattern_White_Space Pat_WS
|
|
217
|
-
Quotation_Mark QMark
|
|
218
|
-
Radical
|
|
219
|
-
Regional_Indicator RI
|
|
220
|
-
Sentence_Terminal STerm
|
|
221
|
-
Soft_Dotted SD
|
|
222
|
-
Terminal_Punctuation Term
|
|
223
|
-
Unified_Ideograph UIdeo
|
|
224
|
-
Uppercase Upper
|
|
225
|
-
Variation_Selector VS
|
|
226
|
-
White_Space space
|
|
227
|
-
XID_Continue XIDC
|
|
228
|
-
XID_Start XIDS`.split(/\s/).map(e=>[pN(e),e])),oP=new Map([[`s`,GN(383)],[GN(383),`s`]]),sP=new Map([[GN(223),GN(7838)],[GN(107),GN(8490)],[GN(229),GN(8491)],[GN(969),GN(8486)]]),cP=new Map([dP(453),dP(456),dP(459),dP(498),...fP(8072,8079),...fP(8088,8095),...fP(8104,8111),dP(8124),dP(8140),dP(8188)]),lP=new Map([[`alnum`,KN`[\p{Alpha}\p{Nd}]`],[`alpha`,KN`\p{Alpha}`],[`ascii`,KN`\p{ASCII}`],[`blank`,KN`[\p{Zs}\t]`],[`cntrl`,KN`\p{Cc}`],[`digit`,KN`\p{Nd}`],[`graph`,KN`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,KN`\p{Lower}`],[`print`,KN`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,KN`[\p{P}\p{S}]`],[`space`,KN`\p{space}`],[`upper`,KN`\p{Upper}`],[`word`,KN`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,KN`\p{AHex}`]]);function uP(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function dP(e){let t=GN(e);return[t.toLowerCase(),t]}function fP(e,t){return uP(e,t).map(e=>dP(e))}var pP=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function mP(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};vP(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:XN(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};gN(e,hP,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return gN(e,gP,a),gN(e,_P,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var hP={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=QM();e.body[0].body.push($M({negate:!0,body:r}),aN(`Any`));let i=QM();i.body[0].body.push(nN(`greedy`,0,1/0,e)),n(LP(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];YN(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=TP(t.get(e));if(n){let t=QM({flags:n});t.body[0].body=e.body,e.body=[LP(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(LP($M({body:[HM({body:[UM(`string_end`)]}),HM({body:[KM(10)]})]}),t));else if(c===`line_start`)o(LP(PP(KN`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`)if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&jP(e))o(LP($M({negate:!0}),t));else if(d)throw Error(KN`Uses "\G" in a way that requires a subclass`);else o(IP(UM(`string_start`),t)),s.strategy=`clip_search`}else if(!(c===`string_end`||c===`string_start`))if(c===`string_end_newline`)o(LP(PP(KN`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${rP})(?!${rP})|(?<!${rP})(?=${rP}))`,n=`(?:(?<=${rP})(?=${rP})|(?<!${rP})(?!${rP}))`;o(LP(PP(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!NP(n)&&(n=wP(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!NP(r)&&(r=wP(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(LP(qM({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(IP(YM(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(LP(FP(PP(tP),l),t));return}if(s&&(c===`word`||u===`word`)){n(IP(YM(`word`,{negate:l}),t));return}if(c===`any`)n(IP(aN(`Any`),t));else if(c===`digit`)n(IP(aN(`Nd`,{negate:l}),t));else if(c!==`dot`)if(c===`text_segment`){if(r===`strict`)throw Error(KN`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=KN`\p{RI}{2}|${e}(?:\u200D${e})*`;n(LP(PP(KN`(?>\r\n|${i?KN`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(IP(aN(`AHex`,{negate:l}),t));else if(c===`newline`)n(LP(PP(l?`[^
|
|
229
|
-
]`:`(?>\r
|
|
230
|
-
?|[
|
|
231
|
-
\v\f
\u2028\u2029])`),t));else if(c===`posix`)if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${GN(e.codePointAt(0)-1)}${GN(e.codePointAt(2)+1)}-\u{10FFFF}`),n(LP(PP(`[${e}]`),t))}else n(LP(FP(PP(lP.get(u)),l),t));else if(c===`property`)aP.has(pN(u))||(e.key=`sc`);else if(c===`space`)n(IP(aN(`space`,{negate:l}),t));else if(c===`word`)n(LP(FP(PP(rP),l),t));else throw Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`)if(!c.enable&&!c.disable)r();else{let e=QM({flags:c});e.body[0].body=o(),i(LP(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&kM(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(KN`Uses "\K" in a way that's unsupported`);let o=$M({behind:!0});o.body[0].body=a(),i(LP(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(LP($M({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=QM();t.body[0].body.push(e.body),e.body=LP(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=OP(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(KN`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!NP(n)&&(n=wP(n,t),e.ref=n)}},gP={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=IP(SP(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&YN(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=YN(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=JN(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&!(n.type===`CapturingGroup`&&(n.name===a||n.number===a)););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?SP(0):xP(o,r.groupOriginByCopy,null),l=c;if(!s){let e=TP(CP(o,e=>e.type===`Group`&&!!e.flags)),t=e?JN(r.globalFlags,e):r.globalFlags;yP(t,r.currentFlags)||(l=QM({flags:EP(t)}),l.body[0].body.push(c))}n(LP(l,t),{traverse:!s})}},_P={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>bP(t,e));i.length?i.length>1?n(LP(QM({atomic:!0,body:i.reverse().map(e=>HM({body:[WM(e.number)]}))}),t)):e.ref=i[0].number:n(LP($M({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=GM();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function vP(e){gN(e,{"*"({node:e,parent:t}){e.parent=t}})}function yP(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function bP(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=DP(n.parent);for(let r of t){if(r===n)break;if(r===e||kP(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function xP(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=xP(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function SP(e){let t=iN(e);return t.isRecursive=!0,t}function CP(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function wP(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function TP(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function EP({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function DP(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function OP(e){let t=e.find(e=>e.kind===`search_start`||MP(e,{negate:!1})||!AP(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=OP(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function kP(e,t){let n=DP(e)??[];for(let e of n)if(e===t||kP(e,t))return!0;return!1}function AP({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function jP(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function MP(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&kM(e.body[0],{type:`Assertion`,kind:`search_start`})}function NP(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function PP(e,t){let n=MM(e,{...t,unicodePropertyMap:aP}).body;return n.length>1||n[0].body.length>1?QM({body:n}):n[0].body[0]}function FP(e,t){return e.negate=t,e}function IP(e,t){return e.parent=t,e}function LP(e,t){return vP(e),e.parent=t,e}function RP(e,t){let n=eP(t),r=XN(n.target,`ES2024`),i=XN(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];gN(e,zP,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,ZN(BP[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&YN(f._captureTransfers,e.transferTo,[]).push(t)}),f}var zP={"*":{enter({node:e},t){if(QP(e)){let n=t.getCurrentModI();t.pushModI(e.flags?JN({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){QP(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){KP(GN(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),qP(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&pP.has(e.value)&&t.setHasCasedChar()}},BP={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?KN`\B`:KN`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=GN(e),r=JP(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&KP(n)){let e=iP(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of class intersection requires min target ES2024`);qN.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(eF)&&(o=[KM(45),...o.filter(e=>!eF(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||qN.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=QM(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=HM({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(qN.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Use of nested character class requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=JP(n,i),o=JP(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&YP(qP(e)).forEach(e=>{s.add(Array.isArray(e)?`${JP(e[0],i)}-${JP(e[1],i)}`:JP(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:KN`[^\n]`;if(e===`digit`)return t?KN`\D`:KN`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&pP.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?KN`\P`:KN`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?KN`\W`:KN`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=JN(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${XP(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+ZP(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:KN`\g<${t}&R=${r}>`}},VP=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),HP=new Set([`-`,`\\`,`]`,`^`,`[`]),UP=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),WP=new Map([[9,KN`\t`],[10,KN`\n`],[11,KN`\v`],[12,KN`\f`],[13,KN`\r`],[8232,KN`\u2028`],[8233,KN`\u2029`],[65279,KN`\uFEFF`]]),GP=/^\p{Cased}$/u;function KP(e){return GP.test(e)}function qP(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=GN(e);if(!KP(t))continue;let o=iP(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function JP(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(WP.has(e))return WP.get(e);if(e<32||e>126&&e<160||e>262143||t&&$P(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?UP:HP:VP,a=GN(e);return(i.has(a)?`\\`:``)+a}function YP(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function XP(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function ZP({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function QP({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function $P(e){return e>47&&e<58}function eF({type:e,value:t}){return e===`Character`&&t===45}var tF=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=rF(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(nF(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=iF(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function nF(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function rF(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)YN(n,t,{}).transferTo=e;return n}function iF(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function aF(e,t){let n=oF(e,t);return n.options?new tF(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function oF(e,t){let n=eP(t),r=mP(MM(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:aP}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=RP(r,n),a=zN(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=kN(MN(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}var sF=4294967295,cF=class{constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}regexps;findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:sF,end:sF,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function lF(e,t){return aF(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function uF(e={}){let t=Object.assign({target:`auto`,cache:new Map},e);return t.regexConstructor||=e=>lF(e,{target:t.target}),{createScanner(e){return new cF(e,t)},createString(e){return{content:e}}}}var dF=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},fF=(e,t)=>({classGroupId:e,validator:t}),pF=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mF=`-`,hF=[],gF=`arbitrary..`,_F=e=>{let t=bF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return yF(e);let n=e.split(mF);return vF(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?dF(i,t):t:i||hF}return n[e]||hF}}},vF=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=vF(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(mF):e.slice(t).join(mF),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},yF=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?gF+r:void 0})(),bF=e=>{let{theme:t,classGroups:n}=e;return xF(n,t)},xF=(e,t)=>{let n=pF();for(let r in e){let i=e[r];SF(i,n,r,t)}return n},SF=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];CF(i,t,n,r)}},CF=(e,t,n,r)=>{if(typeof e==`string`){wF(e,t,n);return}if(typeof e==`function`){TF(e,t,n,r);return}EF(e,t,n,r)},wF=(e,t,n)=>{let r=e===``?t:DF(t,e);r.classGroupId=n},TF=(e,t,n,r)=>{if(OF(e)){SF(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(fF(n,e))},EF=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];SF(o,DF(t,a),n,r)}},DF=(e,t)=>{let n=e,r=t.split(mF),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=pF(),n.nextPart.set(t,i)),n=i}return n},OF=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,kF=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},AF=`!`,jF=`:`,MF=[],NF=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),PF=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===jF){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(AF)?(c=s.slice(0,-1),l=!0):s.startsWith(AF)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return NF(t,l,c,u)};if(t){let e=t+jF,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):NF(MF,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},FF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},IF=e=>({cache:kF(e.cacheSize),parseClassName:PF(e),sortModifiers:FF(e),..._F(e)}),LF=/\s+/,RF=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(LF),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+AF:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},zF=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=BF(n))&&(i&&(i+=` `),i+=r);return i},BF=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=BF(e[r]))&&(n&&(n+=` `),n+=t);return n},VF=(e,...t)=>{let n,r,i,a,o=o=>(n=IF(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=RF(e,n);return i(e,a),a};return a=o,(...e)=>a(zF(...e))},HF=[],UF=e=>{let t=t=>t[e]||HF;return t.isThemeGetter=!0,t},WF=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,GF=/^\((?:(\w[\w-]*):)?(.+)\)$/i,KF=/^\d+\/\d+$/,qF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,YF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,QF=e=>KF.test(e),$F=e=>!!e&&!Number.isNaN(Number(e)),eI=e=>!!e&&Number.isInteger(Number(e)),tI=e=>e.endsWith(`%`)&&$F(e.slice(0,-1)),nI=e=>qF.test(e),rI=()=>!0,iI=e=>JF.test(e)&&!YF.test(e),aI=()=>!1,oI=e=>XF.test(e),sI=e=>ZF.test(e),cI=e=>!uI(e)&&!gI(e),lI=e=>CI(e,DI,aI),uI=e=>WF.test(e),dI=e=>CI(e,OI,iI),fI=e=>CI(e,kI,$F),pI=e=>CI(e,TI,aI),mI=e=>CI(e,EI,sI),hI=e=>CI(e,jI,oI),gI=e=>GF.test(e),_I=e=>wI(e,OI),vI=e=>wI(e,AI),yI=e=>wI(e,TI),bI=e=>wI(e,DI),xI=e=>wI(e,EI),SI=e=>wI(e,jI,!0),CI=(e,t,n)=>{let r=WF.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},wI=(e,t,n=!1)=>{let r=GF.exec(e);return r?r[1]?t(r[1]):n:!1},TI=e=>e===`position`||e===`percentage`,EI=e=>e===`image`||e===`url`,DI=e=>e===`length`||e===`size`||e===`bg-size`,OI=e=>e===`length`,kI=e=>e===`number`,AI=e=>e===`family-name`,jI=e=>e===`shadow`,MI=VF(()=>{let e=UF(`color`),t=UF(`font`),n=UF(`text`),r=UF(`font-weight`),i=UF(`tracking`),a=UF(`leading`),o=UF(`breakpoint`),s=UF(`container`),c=UF(`spacing`),l=UF(`radius`),u=UF(`shadow`),d=UF(`inset-shadow`),f=UF(`text-shadow`),p=UF(`drop-shadow`),m=UF(`blur`),h=UF(`perspective`),g=UF(`aspect`),_=UF(`ease`),v=UF(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),gI,uI],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[gI,uI,c],T=()=>[QF,`full`,`auto`,...w()],E=()=>[eI,`none`,`subgrid`,gI,uI],D=()=>[`auto`,{span:[`full`,eI,gI,uI]},eI,gI,uI],O=()=>[eI,`auto`,gI,uI],k=()=>[`auto`,`min`,`max`,`fr`,gI,uI],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ee=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],M=()=>[QF,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[e,gI,uI],te=()=>[...b(),yI,pI,{position:[gI,uI]}],P=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,bI,lI,{size:[gI,uI]}],re=()=>[tI,_I,dI],ie=()=>[``,`none`,`full`,l,gI,uI],ae=()=>[``,$F,_I,dI],oe=()=>[`solid`,`dashed`,`dotted`,`double`],F=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],se=()=>[$F,tI,yI,pI],ce=()=>[``,`none`,m,gI,uI],le=()=>[`none`,$F,gI,uI],ue=()=>[`none`,$F,gI,uI],de=()=>[$F,gI,uI],fe=()=>[QF,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[nI],breakpoint:[nI],color:[rI],container:[nI],"drop-shadow":[nI],ease:[`in`,`out`,`in-out`],font:[cI],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[nI],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[nI],shadow:[nI],spacing:[`px`,$F],text:[nI],"text-shadow":[nI],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,QF,uI,gI,g]}],container:[`container`],columns:[{columns:[$F,uI,gI,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[eI,`auto`,gI,uI]}],basis:[{basis:[QF,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[$F,QF,`auto`,`initial`,`none`,uI]}],grow:[{grow:[``,$F,gI,uI]}],shrink:[{shrink:[``,$F,gI,uI]}],order:[{order:[eI,`first`,`last`,`none`,gI,uI]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...ee(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ee()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...ee(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ee(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...ee(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ee()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:M()}],w:[{w:[s,`screen`,...M()]}],"min-w":[{"min-w":[s,`screen`,`none`,...M()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...M()]}],h:[{h:[`screen`,`lh`,...M()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...M()]}],"max-h":[{"max-h":[`screen`,`lh`,...M()]}],"font-size":[{text:[`base`,n,_I,dI]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,gI,fI]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,tI,uI]}],"font-family":[{font:[vI,uI,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,gI,uI]}],"line-clamp":[{"line-clamp":[$F,`none`,gI,fI]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,gI,uI]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,gI,uI]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[$F,`from-font`,`auto`,gI,dI]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[$F,`auto`,gI,uI]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,gI,uI]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,gI,uI]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},eI,gI,uI],radial:[``,gI,uI],conic:[eI,gI,uI]},xI,mI]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[$F,gI,uI]}],"outline-w":[{outline:[``,$F,_I,dI]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,SI,hI]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,SI,hI]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:ae()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[$F,dI]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,f,SI,hI]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[$F,gI,uI]}],"mix-blend":[{"mix-blend":[...F(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":F()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[$F]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[gI,uI]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[$F]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,gI,uI]}],filter:[{filter:[``,`none`,gI,uI]}],blur:[{blur:ce()}],brightness:[{brightness:[$F,gI,uI]}],contrast:[{contrast:[$F,gI,uI]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,SI,hI]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,$F,gI,uI]}],"hue-rotate":[{"hue-rotate":[$F,gI,uI]}],invert:[{invert:[``,$F,gI,uI]}],saturate:[{saturate:[$F,gI,uI]}],sepia:[{sepia:[``,$F,gI,uI]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,gI,uI]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[$F,gI,uI]}],"backdrop-contrast":[{"backdrop-contrast":[$F,gI,uI]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,$F,gI,uI]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$F,gI,uI]}],"backdrop-invert":[{"backdrop-invert":[``,$F,gI,uI]}],"backdrop-opacity":[{"backdrop-opacity":[$F,gI,uI]}],"backdrop-saturate":[{"backdrop-saturate":[$F,gI,uI]}],"backdrop-sepia":[{"backdrop-sepia":[``,$F,gI,uI]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,gI,uI]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[$F,`initial`,gI,uI]}],ease:[{ease:[`linear`,`initial`,_,gI,uI]}],delay:[{delay:[$F,gI,uI]}],animate:[{animate:[`none`,v,gI,uI]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,gI,uI]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":[`scale-3d`],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[gI,uI,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,gI,uI]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,gI,uI]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[$F,_I,dI,fI]}],stroke:[{stroke:[`none`,...N()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function NI(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var PI=NI();function FI(e){PI=e}var II={exec:()=>null};function LI(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(RI.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var RI={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+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},zI=/^(?:[ \t]*(?:\n|$))+/,BI=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,VI=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,HI=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,UI=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,WI=/(?:[*+-]|\d{1,9}[.)])/,GI=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,KI=LI(GI).replace(/bull/g,WI).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(),qI=LI(GI).replace(/bull/g,WI).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(),JI=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,YI=/^[^\n]+/,XI=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ZI=LI(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,XI).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),QI=LI(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,WI).getRegex(),$I=`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`,eL=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,tL=LI(`^ {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`,eL).replace(`tag`,$I).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),nL=LI(JI).replace(`hr`,HI).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`,$I).getRegex(),rL={blockquote:LI(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,nL).getRegex(),code:BI,def:ZI,fences:VI,heading:UI,hr:HI,html:tL,lheading:KI,list:QI,newline:zI,paragraph:nL,table:II,text:YI},iL=LI(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,HI).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`,$I).getRegex(),aL={...rL,lheading:qI,table:iL,paragraph:LI(JI).replace(`hr`,HI).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,iL).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`,$I).getRegex()},oL={...rL,html:LI(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,eL).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:II,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:LI(JI).replace(`hr`,HI).replace(`heading`,` *#{1,6} *[^
|
|
232
|
-
]`).replace(`lheading`,KI).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},sL=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cL=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lL=/^( {2,}|\\)\n(?!\s*$)/,uL=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,dL=/[\p{P}\p{S}]/u,fL=/[\s\p{P}\p{S}]/u,pL=/[^\s\p{P}\p{S}]/u,mL=LI(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,fL).getRegex(),hL=/(?!~)[\p{P}\p{S}]/u,gL=/(?!~)[\s\p{P}\p{S}]/u,_L=/(?:[^\s\p{P}\p{S}]|~)/u,vL=LI(/link|code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`code`,/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),yL=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,bL=LI(yL,`u`).replace(/punct/g,dL).getRegex(),xL=LI(yL,`u`).replace(/punct/g,hL).getRegex(),SL=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,CL=LI(SL,`gu`).replace(/notPunctSpace/g,pL).replace(/punctSpace/g,fL).replace(/punct/g,dL).getRegex(),wL=LI(SL,`gu`).replace(/notPunctSpace/g,_L).replace(/punctSpace/g,gL).replace(/punct/g,hL).getRegex(),TL=LI(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,pL).replace(/punctSpace/g,fL).replace(/punct/g,dL).getRegex(),EL=LI(/\\(punct)/,`gu`).replace(/punct/g,dL).getRegex(),DL=LI(/^<(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(),OL=LI(eL).replace(`(?:-->|$)`,`-->`).getRegex(),kL=LI(`^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`,OL).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),AL=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,jL=LI(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,AL).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ML=LI(/^!?\[(label)\]\[(ref)\]/).replace(`label`,AL).replace(`ref`,XI).getRegex(),NL=LI(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,XI).getRegex(),PL=LI(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,ML).replace(`nolink`,NL).getRegex(),FL=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,IL={_backpedal:II,anyPunctuation:EL,autolink:DL,blockSkip:vL,br:lL,code:cL,del:II,emStrongLDelim:bL,emStrongRDelimAst:CL,emStrongRDelimUnd:TL,escape:sL,link:jL,nolink:NL,punctuation:mL,reflink:ML,reflinkSearch:PL,tag:kL,text:uL,url:II},LL={...IL,link:LI(/^!?\[(label)\]\((.*?)\)/).replace(`label`,AL).getRegex(),reflink:LI(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,AL).getRegex()},RL={...IL,emStrongRDelimAst:wL,emStrongLDelim:xL,url:LI(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,FL).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:LI(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,FL).getRegex()},zL={...RL,br:LI(lL).replace(`{2,}`,`*`).getRegex(),text:LI(RL.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},BL={normal:rL,gfm:aL,pedantic:oL},VL={normal:IL,gfm:RL,breaks:zL,pedantic:LL},HL={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},UL=e=>HL[e];function WL(e,t){if(t){if(RI.escapeTest.test(e))return e.replace(RI.escapeReplace,UL)}else if(RI.escapeTestNoEncode.test(e))return e.replace(RI.escapeReplaceNoEncode,UL);return e}function GL(e){try{e=encodeURI(e).replace(RI.percentDecode,`%`)}catch{return null}return e}function KL(e,t){let n=e.replace(RI.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(RI.splitPipe),r=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(;r<n.length;r++)n[r]=n[r].trim().replace(RI.slashPipe,`|`);return n}function qL(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function JL(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function YL(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function XL(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
233
|
-
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
234
|
-
`)}var ZL=class{options;rules;lexer;constructor(e){this.options=e||PI}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:qL(e,`
|
|
235
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=XL(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=qL(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:qL(t[0],`
|
|
236
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=qL(t[0],`
|
|
237
|
-
`).split(`
|
|
238
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
239
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
240
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
241
|
-
${s}`:s,r=r?`${r}
|
|
242
|
-
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
243
|
-
`+e.join(`
|
|
244
|
-
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
245
|
-
`+e.join(`
|
|
246
|
-
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
247
|
-
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
248
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
249
|
-
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
250
|
-
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
251
|
-
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
252
|
-
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
253
|
-
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
254
|
-
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=KL(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
255
|
-
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(KL(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
256
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=qL(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=JL(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),YL(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return YL(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},QL=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||PI,this.options.tokenizer=this.options.tokenizer||new ZL,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 t={other:RI,block:BL.normal,inline:VL.normal};this.options.pedantic?(t.block=BL.pedantic,t.inline=VL.pedantic):this.options.gfm&&(t.block=BL.gfm,this.options.breaks?t.inline=VL.breaks:t.inline=VL.gfm),this.tokenizer.rules=t}static get rules(){return{block:BL,inline:VL}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(RI.carriageReturn,`
|
|
257
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(RI.tabCharGlobal,` `).replace(RI.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
258
|
-
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
259
|
-
`)?``:`
|
|
260
|
-
`)+r.raw,n.text+=`
|
|
261
|
-
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
262
|
-
`)?``:`
|
|
263
|
-
`)+r.raw,n.text+=`
|
|
264
|
-
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
265
|
-
`)?``:`
|
|
266
|
-
`)+r.raw,a.text+=`
|
|
267
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
268
|
-
`)?``:`
|
|
269
|
-
`)+r.raw,n.text+=`
|
|
270
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[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(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},$L=class{options;parser;constructor(e){this.options=e||PI}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(RI.notSpaceStart)?.[0],i=e.replace(RI.endingNewline,``)+`
|
|
271
|
-
`;return r?`<pre><code class="language-`+WL(r)+`">`+(n?i:WL(i,!0))+`</code></pre>
|
|
272
|
-
`:`<pre><code>`+(n?i:WL(i,!0))+`</code></pre>
|
|
273
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
274
|
-
${this.parser.parse(e)}</blockquote>
|
|
275
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
276
|
-
`}hr(e){return`<hr>
|
|
277
|
-
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
278
|
-
`+r+`</`+i+`>
|
|
279
|
-
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+WL(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
280
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
281
|
-
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
282
|
-
<thead>
|
|
283
|
-
`+t+`</thead>
|
|
284
|
-
`+r+`</table>
|
|
285
|
-
`}tablerow({text:e}){return`<tr>
|
|
286
|
-
${e}</tr>
|
|
287
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
288
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${WL(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=GL(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+WL(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=GL(e);if(i===null)return WL(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${WL(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:WL(e.text)}},eR=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},tR=class e{options;renderer;textRenderer;constructor(e){this.options=e||PI,this.options.renderer=this.options.renderer||new $L,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new eR}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;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 i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
289
|
-
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},nR=class{options;block;constructor(e){this.options=e||PI}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?QL.lex:QL.lexInline}provideParser(){return this.block?tR.parse:tR.parseInline}},rR=new class{defaults=NI();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=tR;Renderer=$L;TextRenderer=eR;Lexer=QL;Tokenizer=ZL;Hooks=nR;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new $L(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ZL(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new nR;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];nR.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&nR.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return QL.lex(e,t??this.defaults)}parser(e,t){return tR.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(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 t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?QL.lex:QL.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?tR.parse:tR.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?QL.lex:QL.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?tR.parse:tR.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
290
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+WL(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function iR(e,t){return rR.parse(e,t)}iR.options=iR.setOptions=function(e){return rR.setOptions(e),iR.defaults=rR.defaults,FI(iR.defaults),iR},iR.getDefaults=NI,iR.defaults=PI,iR.use=function(...e){return rR.use(...e),iR.defaults=rR.defaults,FI(iR.defaults),iR},iR.walkTokens=function(e,t){return rR.walkTokens(e,t)},iR.parseInline=rR.parseInline,iR.Parser=tR,iR.parser=tR.parse,iR.Renderer=$L,iR.TextRenderer=eR,iR.Lexer=QL,iR.lexer=QL.lex,iR.Tokenizer=ZL,iR.Hooks=nR,iR.parse=iR,iR.options,iR.setOptions,iR.use,iR.walkTokens,iR.parseInline,tR.parse,QL.lex;var aR=(...e)=>MI(rt(e)),oR=(e,t,n)=>{let r=typeof t==`string`?new Blob([t],{type:n}):t,i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},sR=(0,U.createContext)({code:``});function cR(e,t=200,n=50){let[r,i]=(0,U.useState)(e),a=(0,U.useRef)(0),o=(0,U.useRef)(null);return(0,U.useEffect)(()=>{let r=Date.now(),s=r-a.current;return o.current&&window.clearTimeout(o.current),s>=t?(i(e),a.current=r):o.current=window.setTimeout(()=>{i(e),a.current=Date.now()},n),()=>{o.current&&window.clearTimeout(o.current)}},[e,t,n]),r}var lR=e=>e<50?{minHighlightInterval:100,debounceMs:500}:e<150?{minHighlightInterval:500,debounceMs:800}:e<300?{minHighlightInterval:1500,debounceMs:1200}:{minHighlightInterval:1/0,debounceMs:1500},uR=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),dR=e=>{let t=e.lastIndexOf(`
|
|
291
|
-
`);return[t>=0?e.slice(0,t+1):``,t>=0?e.slice(t+1):e]},fR=e=>e?[{pre(t){return this.addClassToHast(t,e),t}}]:[],pR=new class{constructor(){this.lightHighlighter=null,this.darkHighlighter=null,this.lightTheme=null,this.darkTheme=null,this.loadedLanguages=new Set,this.initializationPromise=null,this.loadLanguagePromise=null,this.cache=new Map,this.cacheKeys=[],this.MAX_CACHE_SIZE=50,this.highlightQueue=new Map}isLanguageSupported(e){return Object.hasOwn(ij,e)}getFallbackLanguage(){return`text`}getCacheKey(e,t,n){return`${t}::${n||``}::${e}`}addToCache(e,t){if(this.cache.size>=this.MAX_CACHE_SIZE){let e=this.cacheKeys.shift();e&&this.cache.delete(e)}this.cache.set(e,t),this.cacheKeys.push(e)}needsHighlightersInitialization(e){let[t,n]=e;return[!this.lightHighlighter||this.lightTheme!==t,!this.darkHighlighter||this.darkTheme!==n]}async ensureHighlightersInitialized(e,t){let[n,r]=t,[i,a]=e,o=uF({forgiving:!0});this.loadedLanguages.clear(),this.cache.clear(),this.cacheKeys=[],this.highlightQueue.clear(),n&&(this.lightHighlighter=await jj({themes:[i],langs:[],engine:o}),this.lightTheme=i),r&&(this.darkHighlighter=await jj({themes:[a],langs:[],engine:o}),this.darkTheme=a)}async loadLanguage(e){await this.darkHighlighter?.loadLanguage(e),await this.lightHighlighter?.loadLanguage(e),this.loadedLanguages.add(e)}async initializeHighlighters(e){this.initializationPromise&&await this.initializationPromise;let t=this.needsHighlightersInitialization(e),[n,r]=t;(n||r)&&(this.initializationPromise=this.ensureHighlightersInitialized(e,t),await this.initializationPromise,this.initializationPromise=null)}performHighlights(e,t,n){let r=this.isLanguageSupported(t)?t:this.getFallbackLanguage();if(this.lightHighlighter===null||this.darkHighlighter===null||this.lightTheme===null||this.darkTheme===null)throw Error(`highlightCode must be called after initializeHighlighters.`);let i=fR(n);return[this.lightHighlighter.codeToHtml(e,{lang:r,theme:this.lightTheme,transformers:i}),this.darkHighlighter.codeToHtml(e,{lang:r,theme:this.darkTheme,transformers:i})]}async highlightCode(e,t,n,r){let i=this.getCacheKey(e,t,n),a=this.cache.get(i);if(a)return this.cacheKeys=this.cacheKeys.filter(e=>e!==i),this.cacheKeys.push(i),a;let o=this.highlightQueue.get(i);if(o)return o;let s=()=>{if(r!=null&&r.aborted)throw new DOMException(`Aborted`,`AbortError`)},c=(async()=>{try{await new Promise(e=>setTimeout(e,0)),s(),this.initializationPromise&&await this.initializationPromise,s(),this.loadLanguagePromise&&await this.loadLanguagePromise,s(),!this.loadedLanguages.has(t)&&this.isLanguageSupported(t)&&(this.loadLanguagePromise=this.loadLanguage(t),await this.loadLanguagePromise,this.loadLanguagePromise=null),s();let r=this.performHighlights(e,t,n);return this.addToCache(i,r),r}finally{this.highlightQueue.delete(i)}})();return this.highlightQueue.set(i,c),c}},mR=({code:e,language:t,className:n,children:r,preClassName:i,...a})=>{let[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(``),m=cR(e),h=(0,U.useRef)(0),g=(0,U.useRef)(!1),_=(0,U.useRef)(null),v=(0,U.useRef)(0),[y,b]=(0,U.useContext)(Jz);(0,U.useEffect)(()=>{pR.initializeHighlighters([y,b])},[y,b]),(0,U.useEffect)(()=>{g.current=!0,_.current&&_.current.abort(),_.current=new AbortController;let e=_.current.signal;h.current&&clearTimeout(h.current);let[n,r]=dR(m),a=m.split(`
|
|
292
|
-
`).length,{minHighlightInterval:o,debounceMs:c}=lR(a);if(n&&n!==u){let a=Date.now();a-v.current>o||!r?(v.current=a,pR.highlightCode(n,t,i,e).then(([t,i])=>{g.current&&!e.aborted&&(0,U.startTransition)(()=>{s(t),l(i),d(n),p(r)})}).catch(e=>{if(e.name!==`AbortError`)throw e})):p(r)}else p(r);return h.current=window.setTimeout(()=>{r&&m!==u&&!e.aborted&&pR.highlightCode(m,t,i,e).then(([t,n])=>{g.current&&!e.aborted&&(0,U.startTransition)(()=>{s(t),l(n),d(m),p(``)})}).catch(e=>{if(e.name!==`AbortError`)throw e})},c),()=>{var e;g.current=!1,(e=_.current)==null||e.abort()}},[m,t,i]);let x=f?`<span class="line"><span>${uR(f)}</span></span>`:``;return(0,W.jsx)(sR.Provider,{value:{code:e},children:(0,W.jsxs)(`div`,{className:`my-4 w-full overflow-hidden rounded-xl border border-border`,"data-code-block-container":!0,"data-language":t,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs`,"data-code-block-header":!0,"data-language":t,children:[(0,W.jsx)(`span`,{className:`ml-1 font-mono lowercase`,children:t}),(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:r})]}),(0,W.jsx)(`div`,{className:`w-full`,children:(0,W.jsxs)(`div`,{className:`min-w-full`,children:[(0,W.jsx)(`div`,{className:aR(`overflow-x-auto dark:hidden`,n),dangerouslySetInnerHTML:{__html:x?o+x:o},"data-code-block":!0,"data-language":t,...a}),(0,W.jsx)(`div`,{className:aR(`hidden overflow-x-auto dark:block`,n),dangerouslySetInnerHTML:{__html:x?c+x:c},"data-code-block":!0,"data-language":t,...a})]})})]})})},hR={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},gR=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let{code:s}=(0,U.useContext)(sR),{isAnimating:c}=(0,U.useContext)(Zz),l=a??s,u=`file.${n&&n in hR?hR[n]:`txt`}`;return(0,W.jsx)(`button`,{className:aR(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:c,onClick:()=>{try{oR(u,l,`text/plain`),e?.()}catch(e){t?.(e)}},title:`Download file`,type:`button`,...o,children:r??(0,W.jsx)(wE,{size:14})})},_R=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(0),{code:u}=(0,U.useContext)(sR),{isAnimating:d}=(0,U.useContext)(Zz),f=a??u,p=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{s||(await navigator.clipboard.writeText(f),c(!0),e?.(),l.current=window.setTimeout(()=>c(!1),n))}catch(e){t?.(e)}};(0,U.useEffect)(()=>()=>{window.clearTimeout(l.current)},[]);let m=s?SE:CE;return(0,W.jsx)(`button`,{className:aR(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:p,type:`button`,...o,children:r??(0,W.jsx)(m,{size:14})})},vR=/\.[^/.]+$/,yR=({node:e,className:t,src:n,alt:r,...i})=>{let a=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(vR,``)}.${i}`}oR(o,e,e.type)}catch(e){console.error(`Failed to download image:`,e)}};return n?(0,W.jsxs)(`div`,{className:`group relative my-4 inline-block`,"data-streamdown":`image-wrapper`,children:[(0,W.jsx)(`img`,{alt:r,className:aR(`max-w-full rounded-lg`,t),"data-streamdown":`image`,src:n,...i}),(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`}),(0,W.jsx)(`button`,{className:aR(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:a,title:`Download image`,type:`button`,children:(0,W.jsx)(wE,{size:14})})]}):null},bR=0,xR=()=>{bR+=1,bR===1&&(document.body.style.overflow=`hidden`)},SR=()=>{bR=Math.max(0,bR-1),bR===0&&(document.body.style.overflow=``)},CR=async e=>{let t={startOnLoad:!1,theme:`default`,securityLevel:`strict`,fontFamily:`monospace`,suppressErrorRendering:!0,...e},n=(await H(async()=>{let{default:e}=await import(`./mermaid.core-TNrI0pHG.js`);return{default:e}},__vite__mapDeps([102,2,1,3,4,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124]))).default;return n.initialize(t),n},wR=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let[o,s]=(0,U.useState)(!1),{isAnimating:c}=(0,U.useContext)(Zz),l=()=>{s(!o)};return(0,U.useEffect)(()=>{if(o){xR();let e=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),SR()}}},[o]),(0,U.useEffect)(()=>{o?n?.():r&&r()},[o,n,r]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{className:aR(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:c,onClick:l,title:`View fullscreen`,type:`button`,...a,children:(0,W.jsx)(TE,{size:14})}),o&&(0,W.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`,onClick:l,onKeyDown:e=>{e.key===`Escape`&&l()},role:`button`,tabIndex:0,children:[(0,W.jsx)(`button`,{className:`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`,onClick:l,title:`Exit fullscreen`,type:`button`,children:(0,W.jsx)(EE,{size:20})}),(0,W.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-12`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,W.jsx)(`div`,{className:`max-h-full max-w-full`,children:(0,W.jsx)(TR,{chart:e,className:`[&>div]:my-0 [&_svg]:h-auto [&_svg]:min-h-[60vh] [&_svg]:w-auto [&_svg]:min-w-[60vw]`,config:t})})})]})]})},TR=({chart:e,className:t,config:n})=>{let[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(!0),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``);if((0,U.useEffect)(()=>{(async()=>{try{i(null),o(!0);let t=await CR(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),a=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:s}=await t.render(a,e);c(s),u(s)}catch(e){l||s||i(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{o(!1)}})()},[e,n]),a&&!s&&!l)return(0,W.jsx)(`div`,{className:aR(`my-4 flex justify-center p-4`,t),children:(0,W.jsxs)(`div`,{className:`flex items-center space-x-2 text-muted-foreground`,children:[(0,W.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-current border-b-2`}),(0,W.jsx)(`span`,{className:`text-sm`,children:`Loading diagram...`})]})});if(r&&!s&&!l)return(0,W.jsxs)(`div`,{className:aR(`rounded-lg border border-red-200 bg-red-50 p-4`,t),children:[(0,W.jsxs)(`p`,{className:`font-mono text-red-700 text-sm`,children:[`Mermaid Error: `,r]}),(0,W.jsxs)(`details`,{className:`mt-2`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-red-600 text-xs`,children:`Show Code`}),(0,W.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`,children:e})]})]});let d=s||l;return(0,W.jsx)(`div`,{"aria-label":`Mermaid chart`,className:aR(`my-4 flex justify-center`,t),dangerouslySetInnerHTML:{__html:d},role:`img`})};function ER(e){let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}}function DR(e){let{headers:t,rows:n}=e,r=e=>e.includes(`,`)||e.includes(`"`)||e.includes(`
|
|
293
|
-
`)?`"${e.replace(/"/g,`""`)}"`:e,i=[];t.length>0&&i.push(t.map(r).join(`,`));for(let e of n)i.push(e.map(r).join(`,`));return i.join(`
|
|
294
|
-
`)}function OR(e){let{headers:t,rows:n}=e,r=e=>e.replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`),i=[];t.length>0&&i.push(t.map(r).join(` `));for(let e of n)i.push(e.map(r).join(` `));return i.join(`
|
|
295
|
-
`)}function kR(e){let{headers:t,rows:n}=e;if(t.length===0)return``;let r=[],i=t.map(e=>e.replace(/\|/g,`\\|`));r.push(`| ${i.join(` | `)} |`),r.push(`| ${t.map(()=>`---`).join(` | `)} |`);for(let e of n){let n=[...e];for(;n.length<t.length;)n.push(``);let i=n.map(e=>e.replace(/\|/g,`\\|`));r.push(`| ${i.join(` | `)} |`)}return r.join(`
|
|
296
|
-
`)}var AR=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(null),u=(0,U.useRef)(0),{isAnimating:d}=(0,U.useContext)(Zz),f=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(l.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=ER(t),s=e===`csv`?DR(a):OR(a),d=new ClipboardItem({"text/plain":new Blob([s],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([d]),c(!0),o(!1),n?.(e),u.current=window.setTimeout(()=>c(!1),i)}catch(e){r?.(e)}};(0,U.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(u.current)}},[]);let p=s?SE:CE;return(0,W.jsxs)(`div`,{className:`relative`,ref:l,children:[(0,W.jsx)(`button`,{className:aR(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:d,onClick:()=>o(!a),title:`Copy table`,type:`button`,children:e??(0,W.jsx)(p,{size:14})}),a&&(0,W.jsxs)(`div`,{className:`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`,children:[(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>f(`csv`),type:`button`,children:`CSV`}),(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>f(`tsv`),type:`button`,children:`TSV`})]})]})},jR=({children:e,className:t,onDownload:n,onError:r})=>{let[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(null),{isAnimating:s}=(0,U.useContext)(Zz),c=e=>{try{let t=(o.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=ER(t),s=e===`csv`?DR(i):kR(i);oR(`table.${e===`csv`?`csv`:`md`}`,s,e===`csv`?`text/csv`:`text/markdown`),a(!1),n?.(e)}catch(e){r?.(e)}};return(0,U.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,W.jsxs)(`div`,{className:`relative`,ref:o,children:[(0,W.jsx)(`button`,{className:aR(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:s,onClick:()=>a(!i),title:`Download table`,type:`button`,children:e??(0,W.jsx)(wE,{size:14})}),i&&(0,W.jsxs)(`div`,{className:`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`,children:[(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>c(`csv`),type:`button`,children:`CSV`}),(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>c(`markdown`),type:`button`,children:`Markdown`})]})]})},MR=/language-([^\s]+)/;function NR(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function PR(e,t){return e.className===t.className&&NR(e.node,t.node)}var FR=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,IR=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},LR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`ol`,{className:aR(`ml-4 list-outside list-decimal whitespace-normal`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>PR(e,t));LR.displayName=`MarkdownOl`;var RR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`li`,{className:aR(`py-1`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&NR(e.node,t.node));RR.displayName=`MarkdownLi`;var zR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`ul`,{className:aR(`ml-4 list-outside list-disc whitespace-normal`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>PR(e,t));zR.displayName=`MarkdownUl`;var BR=(0,U.memo)(({className:e,node:t,...n})=>(0,W.jsx)(`hr`,{className:aR(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>PR(e,t));BR.displayName=`MarkdownHr`;var VR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`span`,{className:aR(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>PR(e,t));VR.displayName=`MarkdownStrong`;var HR=(0,U.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=n===`streamdown:incomplete-link`;return(0,W.jsx)(`a`,{className:aR(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":a,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>PR(e,t)&&e.href===t.href);HR.displayName=`MarkdownA`;var UR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h1`,{className:aR(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>PR(e,t));UR.displayName=`MarkdownH1`;var WR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h2`,{className:aR(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>PR(e,t));WR.displayName=`MarkdownH2`;var GR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h3`,{className:aR(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>PR(e,t));GR.displayName=`MarkdownH3`;var KR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h4`,{className:aR(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>PR(e,t));KR.displayName=`MarkdownH4`;var qR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h5`,{className:aR(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>PR(e,t));qR.displayName=`MarkdownH5`;var JR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h6`,{className:aR(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>PR(e,t));JR.displayName=`MarkdownH6`;var YR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsxs)(`div`,{className:`my-4 flex flex-col space-y-2`,"data-streamdown":`table-wrapper`,children:[FR((0,U.useContext)(Xz),`table`)&&(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,W.jsx)(AR,{}),(0,W.jsx)(jR,{})]}),(0,W.jsx)(`div`,{className:`overflow-x-auto`,children:(0,W.jsx)(`table`,{className:aR(`w-full border-collapse border border-border`,t),"data-streamdown":`table`,...r,children:e})})]}),(e,t)=>PR(e,t));YR.displayName=`MarkdownTable`;var XR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`thead`,{className:aR(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>PR(e,t));XR.displayName=`MarkdownThead`;var ZR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`tbody`,{className:aR(`divide-y divide-border bg-muted/40`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>PR(e,t));ZR.displayName=`MarkdownTbody`;var QR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`tr`,{className:aR(`border-border border-b`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>PR(e,t));QR.displayName=`MarkdownTr`;var $R=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`th`,{className:aR(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>PR(e,t));$R.displayName=`MarkdownTh`;var ez=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`td`,{className:aR(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>PR(e,t));ez.displayName=`MarkdownTd`;var tz=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`blockquote`,{className:aR(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>PR(e,t));tz.displayName=`MarkdownBlockquote`;var nz=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`sup`,{className:aR(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>PR(e,t));nz.displayName=`MarkdownSup`;var rz=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`sub`,{className:aR(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>PR(e,t));rz.displayName=`MarkdownSub`;var iz=(0,U.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,U.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,U.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,U.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,U.isValidElement)(e))return e;if(e.type===LR){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,W.jsx)(`section`,{className:t,...r,children:i}):null}return(0,W.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>PR(e,t));iz.displayName=`MarkdownSection`;var az=(0,U.memo)(({node:e,className:t,children:n,...r})=>{let i=(e?.position)?.start.line===(e?.position)?.end.line,a=(0,U.useContext)(Yz),o=(0,U.useContext)(Xz);if(i)return(0,W.jsx)(`code`,{className:aR(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let s=(t?.match(MR))?.at(1)??``,c=``;if((0,U.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?c=n.props.children:typeof n==`string`&&(c=n),s===`mermaid`){let e=FR(o,`mermaid`),n=IR(o,`download`),r=IR(o,`copy`),i=IR(o,`fullscreen`);return(0,W.jsxs)(`div`,{className:aR(`group relative my-4 h-auto rounded-xl border p-4`,t),"data-streamdown":`mermaid-block`,children:[e&&(n||r||i)&&(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[n&&(0,W.jsx)(gR,{code:c,language:s}),r&&(0,W.jsx)(_R,{code:c}),i&&(0,W.jsx)(wR,{chart:c,config:a})]}),(0,W.jsx)(TR,{chart:c,config:a})]})}let l=FR(o,`code`);return(0,W.jsx)(mR,{className:aR(`overflow-x-auto border-border border-t`,t),code:c,"data-language":s,"data-streamdown":`code-block`,language:s,preClassName:`overflow-x-auto font-mono text-xs p-4 bg-muted/40`,children:l&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(gR,{code:c,language:s}),(0,W.jsx)(_R,{})]})})},(e,t)=>e.className===t.className&&NR(e.node,t.node));az.displayName=`MarkdownCode`;var oz=(0,U.memo)(yR,(e,t)=>e.className===t.className&&NR(e.node,t.node));oz.displayName=`MarkdownImg`;var sz=(0,U.memo)(({children:e,className:t,node:n,...r})=>{let i=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);return i.length===1&&(0,U.isValidElement)(i[0])&&i[0].props.node?.tagName===`img`?(0,W.jsx)(W.Fragment,{children:e}):(0,W.jsx)(`p`,{className:t,...r,children:e})},(e,t)=>PR(e,t));sz.displayName=`MarkdownParagraph`;var cz={ol:LR,li:RR,ul:zR,hr:BR,strong:VR,a:HR,h1:UR,h2:WR,h3:GR,h4:KR,h5:qR,h6:JR,table:YR,thead:XR,tbody:ZR,tr:QR,th:$R,td:ez,blockquote:tz,code:az,img:oz,pre:({children:e})=>e,sup:nz,sub:rz,p:sz,section:iz},lz=/\[\^[^\]\s]{1,200}\](?!:)/,uz=/\[\^[^\]\s]{1,200}\]:/,dz=/<\/(\w+)>/,fz=/<(\w+)[\s>]/,pz=e=>{let t=lz.test(e),n=uz.test(e);if(t||n)return[e];let r=QL.lex(e,{gfm:!0}),i=[],a=[];for(let e of r){let t=e.raw;if(a.length>0){if(i[i.length-1]+=t,e.type===`html`){let e=t.match(dz);if(e){let t=e[1];a.at(-1)===t&&a.pop()}}continue}if(e.type===`html`&&e.block){let e=t.match(fz);if(e){let n=e[1];t.includes(`</${n}>`)||a.push(n)}}if(t.trim()===`$$`&&i.length>0){let e=i.at(-1);if(!e){i.push(t);continue}let n=e.trimStart().startsWith(`$$`),r=(e.match(/\$\$/g)||[]).length;if(n&&r%2==1){i[i.length-1]=e+t;continue}}if(i.length>0&&t.trimEnd().endsWith(`$$`)){let e=i.at(-1);if(!e){i.push(t);continue}let n=e.trimStart().startsWith(`$$`),r=(e.match(/\$\$/g)||[]).length,a=(t.match(/\$\$/g)||[]).length;if(n&&r%2==1&&!t.trimStart().startsWith(`$$`)&&a===1){i[i.length-1]=e+t;continue}}i.push(t)}return i},mz=/(!?\[)([^\]]*?)$/,hz=/(\*\*)([^*]*?)$/,gz=/(__)([^_]*?)$/,_z=/(\*\*\*)([^*]*?)$/,vz=/(\*)([^*]*?)$/,yz=/(_)([^_]*?)$/,bz=/(`)([^`]*?)$/,xz=/(~~)([^~]*?)$/,Sz=/(!?)\[([^\]]+)\]\(([^)]+)$/,Cz=/^[\s_~*`]*$/,wz=/^[\s]*[-*+][\s]+$/,Tz=/[\p{L}\p{N}_]/u,Ez=/\n+$/,Dz=/^```[^`\n]*```?$/,Oz=/^\*{4,}$/,kz=e=>{let t=(e.match(/```/g)||[]).length;return t>0&&t%2==0&&e.includes(`
|
|
297
|
-
`)},Az=e=>{let t=e.match(Sz);if(t){let n=t[1]===`!`,r=t[2],i=t[3],a=e.lastIndexOf(`${n?`!`:``}[${r}](${i}`),o=e.substring(0,a);return n?o:`${o}[${r}](streamdown:incomplete-link)`}let n=e.match(mz);if(n){if(n[1].startsWith(`!`)){let t=e.lastIndexOf(n[1]);return e.substring(0,t)}return`${e}](streamdown:incomplete-link)`}return e},jz=e=>{if(kz(e))return e;let t=e.match(hz);if(t){let n=t[2];if(!n||Cz.test(n))return e;let r=e.lastIndexOf(t[1]),i=e.substring(0,r).lastIndexOf(`
|
|
298
|
-
`),a=i===-1?0:i+1,o=e.substring(a,r);if(wz.test(o)&&n.includes(`
|
|
299
|
-
`))return e;if((e.match(/\*\*/g)||[]).length%2==1)return`${e}**`}return e},Mz=e=>{let t=e.match(gz);if(t){let n=t[2];if(!n||Cz.test(n))return e;let r=e.lastIndexOf(t[1]),i=e.substring(0,r).lastIndexOf(`
|
|
300
|
-
`),a=i===-1?0:i+1,o=e.substring(a,r);if(wz.test(o)&&n.includes(`
|
|
301
|
-
`))return e;if((e.match(/__/g)||[]).length%2==1)return`${e}__`}return e},Nz=e=>e.split(``).reduce((t,n,r)=>{if(n===`*`){let n=e[r-1],i=e[r+1];if(n===`\\`||n&&i&&Tz.test(n)&&Tz.test(i))return t;let a=r;for(let t=r-1;t>=0;t--){if(e[t]===`
|
|
302
|
-
`){a=t+1;break}if(t===0){a=0;break}}if(e.substring(a,r).trim()===``&&(i===` `||i===` `))return t;if(n!==`*`&&i!==`*`)return t+1}return t},0),Pz=e=>{if(kz(e))return e;if(e.match(vz)){let t=-1;for(let n=0;n<e.length;n++)if(e[n]===`*`&&e[n-1]!==`*`&&e[n+1]!==`*`&&e[n-1]!==`\\`){let r=n>0?e[n-1]:``,i=n<e.length-1?e[n+1]:``;if(r&&i&&Tz.test(r)&&Tz.test(i))continue;t=n;break}if(t===-1)return e;let n=e.substring(t+1);if(!n||Cz.test(n))return e;if(Nz(e)%2==1)return`${e}*`}return e},Fz=(e,t)=>{let n=!1,r=!1;for(let i=0;i<e.length&&i<t;i+=1){if(e[i]===`\\`&&e[i+1]===`$`){i+=1;continue}e[i]===`$`&&(e[i+1]===`$`?(r=!r,i+=1,n=!1):r||(n=!n))}return n||r},Iz=e=>e.split(``).reduce((t,n,r)=>{if(n===`_`){let n=e[r-1],i=e[r+1];if(n===`\\`||Fz(e,r)||n&&i&&Tz.test(n)&&Tz.test(i))return t;if(n!==`_`&&i!==`_`)return t+1}return t},0),Lz=e=>{if(kz(e))return e;if(e.match(yz)){let t=-1;for(let n=0;n<e.length;n++)if(e[n]===`_`&&e[n-1]!==`_`&&e[n+1]!==`_`&&e[n-1]!==`\\`&&!Fz(e,n)){let r=n>0?e[n-1]:``,i=n<e.length-1?e[n+1]:``;if(r&&i&&Tz.test(r)&&Tz.test(i))continue;t=n;break}if(t===-1)return e;let n=e.substring(t+1);if(!n||Cz.test(n))return e;if(Iz(e)%2==1){let t=e.match(Ez);return t?`${e.slice(0,-t[0].length)}_${t[0]}`:`${e}_`}}return e},Rz=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},zz=e=>{let t=0;for(let n=0;n<e.length;n+=1)e[n]==="`"&&!Rz(e,n)&&(t+=1);return t},Bz=e=>{if(e.match(Dz)&&!e.includes(`
|
|
303
|
-
`))return e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e;let t=(e.match(/```/g)||[]).length,n=t%2==1;if(t>0&&t%2==0&&e.includes(`
|
|
304
|
-
`)||(e.endsWith("```\n")||e.endsWith("```"))&&t%2==0)return e;let r=e.match(bz);if(r&&!n){let t=r[2];if(!t||Cz.test(t))return e;if(zz(e)%2==1)return`${e}\``}return e},Vz=e=>{let t=e.match(xz);if(t){let n=t[2];if(!n||Cz.test(n))return e;if((e.match(/~~/g)||[]).length%2==1)return`${e}~~`}return e},Hz=e=>{if((e.match(/\$\$/g)||[]).length%2==0)return e;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
305
|
-
`,t)!==-1&&!e.endsWith(`
|
|
306
|
-
`)?`${e}
|
|
307
|
-
$$`:`${e}$$`},Uz=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},Wz=e=>{if(kz(e)||Oz.test(e))return e;let t=e.match(_z);if(t){let n=t[2];if(!n||Cz.test(n))return e;if(Uz(e)%2==1)return`${e}***`}return e},Gz=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=Az(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=Wz(t),t=jz(t),t=Mz(t),t=Pz(t),t=Lz(t),t=Bz(t),t=Vz(t),t=Hz(t),t)},Kz={harden:[Ph,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:dS,katex:[Jb,{errorColor:`var(--color-muted-foreground)`}]},qz={gfm:[tE,{}],math:[pE,{singleDollarTextMath:!1}],cjkFriendly:[$S,{}],cjkFriendlyGfmStrikethrough:[tC,{}]},Jz=(0,U.createContext)([`github-light`,`github-dark`]),Yz=(0,U.createContext)(void 0),Xz=(0,U.createContext)(!0),Zz=(0,U.createContext)({isAnimating:!1}),Qz=(0,U.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,U.useMemo)(()=>typeof e==`string`&&t?Gz(e.trim()):e,[e,t]);return(0,W.jsx)(kh,{...n,children:r})},(e,t)=>e.content===t.content);Qz.displayName=`Block`;var $z=[`github-light`,`github-dark`],eB=(0,U.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(Kz),remarkPlugins:i=Object.values(qz),className:a,shikiTheme:o=$z,mermaidConfig:s,controls:c=!0,isAnimating:l=!1,urlTransform:u=e=>e,BlockComponent:d=Qz,parseMarkdownIntoBlocksFn:f=pz,...p})=>{let m=(0,U.useId)(),h=(0,U.useMemo)(()=>f(typeof e==`string`?e:``),[e,f]);(0,U.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===Jb:e===Jb)&&H(()=>Promise.resolve({}),__vite__mapDeps([125]))},[r]);let g=(0,U.useMemo)(()=>({isAnimating:l}),[l]);return(0,W.jsx)(Jz.Provider,{value:o,children:(0,W.jsx)(Yz.Provider,{value:s,children:(0,W.jsx)(Xz.Provider,{value:c,children:(0,W.jsx)(Zz.Provider,{value:g,children:(0,W.jsx)(`div`,{className:aR(`space-y-4`,a),children:h.map((e,a)=>(0,W.jsx)(d,{components:{...cz,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:u,...p},`${m}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);eB.displayName=`Streamdown`;function tB(e){let t=/@(?:"[^"]*"|[^\s]+)/g,n=[],r=/^ {0,3}```[\s\S]*?^ {0,3}```|^ {0,3}~~~[\s\S]*?^ {0,3}~~~/gm,i=r.exec(e);for(;i!==null;)n.push({start:i.index,end:i.index+i[0].length}),i=r.exec(e);let a=/`[^`\n]+`|``[^`\n]+``/g;for(i=a.exec(e);i!==null;)n.push({start:i.index,end:i.index+i[0].length}),i=a.exec(e);n.sort((e,t)=>e.start-t.start);let o=e=>n.some(t=>e>=t.start&&e<t.end);return e.replace(t,(e,t)=>o(t)?e:`<span style="background-color: rgba(22, 119, 255, 0.15); border-radius: 3px; padding: 0 2px; font-weight: 600;">${e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}</span>`)}var nB=U.memo(({content:e,inline:t=!1,style:n,isStreaming:r=!1,compact:i=!1,showControls:a=!0})=>{let{token:o}=ce.useToken(),c=Array.isArray(e)?e.filter(e=>e.trim()).join(`
|
|
308
|
-
|
|
309
|
-
`):e,l=c;l=tB(l);let u={theme:Jn(o)?`dark`:`default`},d=i?{maxHeight:`200px`,overflowY:`auto`,fontSize:`12px`,lineHeight:`1.5`}:{};return(0,W.jsx)(s,{style:{...n,...d},className:i?`markdown-compact`:void 0,children:(0,W.jsx)(eB,{parseIncompleteMarkdown:r,className:t?`inline-markdown`:`markdown-content`,isAnimating:r,controls:a,mermaidConfig:u,children:l},r?void 0:rB(c))})});nB.displayName=`MarkdownRenderer`;function rB(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function iB(e){return e.split(`/`).map(e=>({title:e}))}var aB=({open:e,onClose:t,title:n,content:r,filePath:i})=>{iB(i);let{showSuccess:a}=mn();return(0,W.jsx)(it,{title:n,open:e,onCancel:t,width:900,styles:{body:{maxHeight:`70vh`,overflowY:`auto`,padding:`24px`}},footer:[(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:async()=>{await cn(i),a(`Path copied to clipboard!`)},children:`Copy Path`},`copy-path`),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(We,{}),onClick:async()=>{await cn(r),a(`Content copied to clipboard!`)},children:`Copy Content`},`copy-content`),(0,W.jsx)(V,{onClick:t,children:`Close`},`close`)],children:(0,W.jsx)(nB,{content:r})})},oB=5e4,sB=(0,U.memo)(({branch:e,client:t})=>{let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),m=(0,U.useRef)(t);m.current=t;let h=(0,U.useRef)(e.branch_id);h.current=e.branch_id;let{showLoading:g,showSuccess:_,showError:v}=mn();(0,U.useEffect)(()=>{if(!t){a(!1);return}(async()=>{try{a(!0),s(null),r(await t.service(`file`).findAll({query:{branch_id:e.branch_id}}))}catch(e){console.error(`Failed to fetch files:`,e),s(e instanceof Error?e.message:String(e))}finally{a(!1)}})()},[t,e.branch_id]);let y=(0,U.useCallback)(async e=>{let t=m.current;if(t)try{g(`Downloading file...`,{key:`download`});let n=await t.service(`file`).get(e.path,{query:{branch_id:h.current}}),r,i=`mimeType`in e?e.mimeType:void 0;if(n.encoding===`base64`){let e=atob(n.content),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);r=new Blob([t],{type:i||`application/octet-stream`})}else r=new Blob([n.content],{type:i||`text/plain`});let a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=e.path.split(`/`).pop()||`download`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a),_(`Downloaded!`,{key:`download`})}catch(e){console.error(`Failed to download file:`,e),v(`Failed to download file`,{key:`download`})}},[g,_,v]),b=(0,U.useCallback)(async e=>{let t=m.current;if(t)if(`isText`in e&&e.isText&&e.size<1024*1024)try{p(!0),d(!0),l(await t.service(`file`).get(e.path,{query:{branch_id:h.current}}))}catch(e){console.error(`Failed to fetch file detail:`,e),v(`Failed to load file`),d(!1)}finally{p(!1)}else y(e)},[y,v]),x=(0,U.useCallback)(()=>{d(!1),l(null)},[]),S=c?.path.endsWith(`.md`),C=n.length>=oB;return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[C&&(0,W.jsx)(I,{type:`warning`,title:`Woah! Big repo alert!`,description:`Only ${oB.toLocaleString()} files were loaded to prevent your browser from crashing. Use git/IDE for full repo browsing.`,showIcon:!0}),!C&&n.length>1e4&&(0,W.jsx)(I,{type:`info`,title:`Large repository: ${n.length.toLocaleString()} files loaded.`,description:`Use search to find files quickly.`,showIcon:!0}),o&&(0,W.jsx)(I,{title:`Error`,description:o,type:`error`,showIcon:!0}),(0,W.jsx)(Al,{files:n,loading:i,onFileClick:b,onDownload:y,emptyMessage:`No files found in branch`}),S?(0,W.jsx)(aB,{open:u,title:c?.title||``,content:c?.content||``,filePath:c?.path||``,onClose:x}):(0,W.jsx)(El,{file:c,open:u,onClose:x,loading:f})]})})},(e,t)=>{let n=e.client===null!=(t.client===null);return e.branch.branch_id===t.branch.branch_id&&!n}),cB=e=>(0,W.jsx)(be,{...e}),lB=e=>typeof e==`string`&&e.trim().length>0?e:void 0,uB=({archived:e,loading:t=!1,onToggle:n,tooltip:r,stopPropagation:i=!0,ariaLabel:a,"aria-label":s,size:c=`small`,type:l=`text`,...u})=>{let d=r??(e?`Archived • Click to unarchive`:`Archive`),f=lB(d),p=s??a;return(0,W.jsx)(o,{title:d,children:(0,W.jsx)(V,{...u,type:l,size:c,icon:(0,W.jsx)(cB,{}),loading:t,"aria-label":p??f,title:u.title??f,onClick:t=>{i&&t.stopPropagation(),n(!e)}})})},dB=({tooltip:e,stopPropagation:t=!0,ariaLabel:n,"aria-label":r,size:i=`small`,type:a=`text`,onClick:s,onMouseEnter:c,onMouseLeave:l,children:u,...d})=>{let f=u==null,p=e??(f?`Archive`:void 0),m=lB(p),h=r??n,g=(0,W.jsx)(V,{...d,type:a,size:i,icon:(0,W.jsx)(cB,{}),"aria-label":h??(f?m:void 0),title:d.title??(f?m:void 0),onMouseEnter:c,onMouseLeave:l,onClick:e=>{t&&e.stopPropagation(),s?.(e)},children:u});return p?(0,W.jsx)(o,{title:p,children:g}):g},{Text:fB}=s,pB=({open:e,branch:t,sessionCount:n=0,environmentRunning:r=!1,initialMetadataAction:i=`archive`,onConfirm:a,onCancel:o})=>{let[s,c]=(0,U.useState)(`cleaned`),[l,u]=(0,U.useState)(i);return(0,U.useEffect)(()=>{e&&u(i)},[i,e]),(0,W.jsx)(it,{title:`Archive or Delete Branch`,open:e,onOk:()=>{a({metadataAction:l,filesystemAction:s})},onCancel:o,okText:l===`archive`?`Archive Branch`:`Delete Permanently`,okButtonProps:l===`delete`?{danger:!0}:{},cancelText:`Cancel`,width:600,children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(fB,{strong:!0,children:`Name: `}),(0,W.jsx)(fB,{code:!0,children:t.name}),(0,W.jsx)(`br`,{}),(0,W.jsx)(fB,{strong:!0,children:`Git ref: `}),(0,W.jsx)(fB,{children:t.ref})]}),r&&(0,W.jsx)(I,{title:`Environment is running and will be stopped`,type:`warning`,showIcon:!0,style:{marginBottom:0}}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(fB,{strong:!0,style:{display:`block`,marginBottom:8},children:`Filesystem`}),(0,W.jsx)(d.Group,{value:s,onChange:e=>c(e.target.value),children:(0,W.jsxs)(z,{orientation:`vertical`,children:[(0,W.jsx)(d,{value:`preserved`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Leave untouched`}),(0,W.jsx)(fB,{type:`secondary`,style:{fontSize:12},children:`No changes to disk`})]})}),(0,W.jsx)(d,{value:`cleaned`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Clean workspace (git clean -fdx)`}),(0,W.jsx)(fB,{type:`secondary`,style:{fontSize:12},children:`Removes node_modules, builds, untracked files`})]})}),(0,W.jsx)(d,{value:`deleted`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Delete completely`}),(0,W.jsx)(fB,{type:`secondary`,style:{fontSize:12},children:`Removes entire branch directory from disk`})]})})]})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(fB,{strong:!0,style:{display:`block`,marginBottom:8},children:`Metadata & Sessions`}),(0,W.jsx)(d.Group,{value:l,onChange:e=>u(e.target.value),children:(0,W.jsxs)(z,{orientation:`vertical`,children:[(0,W.jsx)(d,{value:`archive`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Archive (recommended)`}),(0,W.jsx)(fB,{type:`secondary`,style:{fontSize:12},children:`Hidden from board, data preserved for analytics and history`})]})}),(0,W.jsx)(d,{value:`delete`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Delete permanently`}),(0,W.jsx)(fB,{type:`secondary`,style:{fontSize:12},children:`All data deleted - no undo`})]})})]})})]}),l===`delete`&&(0,W.jsx)(I,{title:`Warning`,description:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsxs)(fB,{children:[`• All `,n,` session(s), messages, and history will be permanently deleted`]}),(0,W.jsx)(fB,{children:`• Token usage data will be lost - prevents analytics and cost tracking`}),(0,W.jsx)(fB,{children:`• Links to issues/PRs will be removed forever`}),(0,W.jsx)(fB,{children:`• This action cannot be undone`}),(0,W.jsx)(fB,{strong:!0,style:{marginTop:8,display:`block`},children:`💡 Consider archiving instead - keeps data for history but hides from board`})]}),type:`error`,showIcon:!0}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(fB,{type:`secondary`,style:{fontSize:12},children:[`Path:`,` `]}),(0,W.jsx)(fB,{code:!0,copyable:!0,style:{fontSize:11},children:t.path})]})]})})},mB=({mcpServers:e,value:t,onChange:n,placeholder:r=`Select MCP servers...`,filterByScope:i,...a})=>(0,W.jsx)(P,{mode:`multiple`,placeholder:r,allowClear:!0,showSearch:!0,optionFilterProp:`label`,value:t,onChange:n,options:(i?e.filter(e=>e.scope===i):e).filter(e=>e.enabled).map(e=>{let t=e.display_name||e.name,n=e.auth?.type===`oauth`?` · OAuth ${e.auth.oauth_mode===`shared`?`(shared)`:`(per-user)`}`:e.auth?.type===`bearer`||e.auth?.token?` · Token`:``;return{label:`${t} (${e.transport})${n}`,value:e.mcp_server_id,disabled:!e.enabled}}).sort((e,t)=>e.label.localeCompare(t.label)),...a}),hB=({mcpServerById:e,showHelpText:t=!1})=>Zo(`mcp_servers`)?(0,W.jsx)(B.Item,{name:`mcpServerIds`,label:`MCP Servers`,help:t?`Select MCP servers to make available in this session`:void 0,children:(0,W.jsx)(mB,{mcpServers:us(e),placeholder:`No MCP servers attached`})}):null,{TextArea:gB}=L,_B=({branch:e,repo:t,sessions:n,boards:r=[],mcpServers:i=[],canEdit:a,state:c,setField:l,onArchiveOrDelete:u})=>{let[d,f]=(0,U.useState)(!1),p=t=>{u?.(e.branch_id,t)},m=dn(e);return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsxs)(R.Item,{label:`Name`,children:[(0,W.jsx)(s.Text,{strong:!0,children:e.name}),e.new_branch&&(0,W.jsx)(tr,{color:`green`,style:{marginLeft:8,fontSize:11},children:`New Branch`})]}),(0,W.jsx)(R.Item,{label:`Repository`,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(de,{}),(0,W.jsx)(s.Text,{children:t.name})]})}),(0,W.jsx)(R.Item,{label:`Branch`,children:(0,W.jsx)(s.Text,{code:!0,children:e.ref})}),e.base_ref&&(0,W.jsx)(R.Item,{label:e.ref_type===`tag`?`Base Tag`:`Base Branch`,children:(0,W.jsxs)(s.Text,{code:!0,children:[e.base_ref,e.base_sha&&` (${e.base_sha.substring(0,7)})`]})}),e.tracking_branch&&(0,W.jsx)(R.Item,{label:`Tracking`,children:(0,W.jsx)(s.Text,{code:!0,children:e.tracking_branch})}),e.last_commit_sha&&(0,W.jsx)(R.Item,{label:`Current SHA`,children:(0,W.jsx)(s.Text,{code:!0,children:e.last_commit_sha.substring(0,7)})}),(0,W.jsx)(R.Item,{label:`Path`,children:(0,W.jsx)(s.Text,{code:!0,style:{fontSize:11},copyable:{text:e.path,tooltips:[`Copy path`,`Copied!`]},children:e.path})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:14,display:`block`,marginBottom:16},children:`Work Context`}),(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,children:[(0,W.jsx)(B.Item,{label:`Board`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(P,{value:c.boardId,onChange:e=>l(`boardId`,e),placeholder:`Select board (optional)...`,allowClear:!0,disabled:!a,options:r.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:e.board_id,label:`${e.icon||`📋`} ${e.name}`}))})}),(0,W.jsx)(B.Item,{label:`Issue`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(L,{value:c.issueUrl,onChange:e=>l(`issueUrl`,e.target.value),placeholder:`https://github.com/user/repo/issues/42`,prefix:(0,W.jsx)(ve,{}),disabled:!a})}),(0,W.jsx)(B.Item,{label:`Pull Request`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(L,{value:c.prUrl,onChange:e=>l(`prUrl`,e.target.value),placeholder:`https://github.com/user/repo/pull/43`,prefix:(0,W.jsx)(ve,{}),disabled:!a})}),!m&&(0,W.jsx)(B.Item,{label:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(`span`,{children:`Notes`}),(0,W.jsx)(o,{title:`Markdown formatting supported (headings, bold, italic, lists, code blocks, etc.)`,children:(0,W.jsx)(`span`,{style:{fontSize:`10px`,fontWeight:`bold`,fontFamily:`monospace`,opacity:.6,cursor:`help`},children:`MD`})})]}),labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(gB,{value:c.notes,onChange:e=>l(`notes`,e.target.value),placeholder:`Freeform notes about this branch...`,rows:4,disabled:!a})}),(0,W.jsx)(B.Item,{label:`MCP Servers`,labelCol:{span:6},wrapperCol:{span:18},extra:`Default MCP servers for new sessions in this branch`,children:(0,W.jsx)(mB,{mcpServers:i,value:c.mcpServerIds,onChange:e=>l(`mcpServerIds`,e),placeholder:`Select default MCP servers...`,disabled:!a})})]})]}),(0,W.jsxs)(R,{column:2,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Created`,children:new Date(e.created_at).toLocaleString()}),(0,W.jsx)(R.Item,{label:`Last Used`,children:e.last_used?new Date(e.last_used).toLocaleString():`Never`})]}),(0,W.jsx)(z,{children:(0,W.jsx)(dB,{tooltip:``,size:`middle`,onClick:()=>f(!0),disabled:!a,children:`Archive or Delete Branch`})}),(0,W.jsx)(pB,{open:d,branch:e,sessionCount:n.length,environmentRunning:e.environment_instance?.status===`running`,onConfirm:e=>{p(e),f(!1)},onCancel:()=>f(!1)})]})})},vB=[{label:`No access`,value:`none`},{label:`Read`,value:`read`},{label:`Write`,value:`write`}],yB=new Set([`write`,`own`]);function bB(){return{memory_path_template:`memory/{{YYYY-MM-DD}}.md`,default_visibility:`public`,global_access:`write`,grants:[]}}function xB(e){return e.namespace_id||e.namespace_slug}function SB(e){let t=e.effective_permission??`unknown`;return`${e.display_name} (${e.slug}) · ${t}`}function CB(e,t){return{custom_context:{[e.custom_context?.assistant?`assistant`:`agent`]:{kb:t}}}}var wB=({branch:e,client:t,canEdit:n})=>{let{showSuccess:r,showError:i}=mn(),a=(0,U.useMemo)(()=>Xt(e),[e]),o=a?.kb,[c,l]=(0,U.useState)(o??bB()),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)([]),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(null);(0,U.useEffect)(()=>{l(o??bB())},[o]),(0,U.useEffect)(()=>{let e=!1;return(async()=>{if(d(null),S(null),t){h(!0);try{let n=await t.service(`kb/namespaces`).find({query:{archived:!1,$limit:1e3}});if(e||p(Array.isArray(n)?n:n.data??[]),c.primary_namespace_id){let n=await t.service(`kb/namespaces`).get(c.primary_namespace_id);e||d(n)}}catch(t){e||S(t instanceof Error?t.message:String(t))}finally{e||h(!1)}}})(),()=>{e=!0}},[t,c.primary_namespace_id]);let C=(0,U.useMemo)(()=>(c.grants??[]).map(e=>({...e,key:xB(e)})),[c.grants]),w=(0,U.useMemo)(()=>new Map(f.map(e=>[String(e.namespace_id),e])),[f]),T=async()=>{if(t){_(!0),S(null);try{let n=await t.service(`branches`).ensureAssistantKnowledgeNamespace({branchId:e.branch_id});d(n.namespace),l(Xt(n.branch)?.kb??c),r(`Assistant Knowledge namespace is ready`)}catch(e){let t=e instanceof Error?e.message:String(e);S(t),i(t)}finally{_(!1)}}},O=async n=>{if(t){b(!0);try{l(Xt(await t.service(`branches`).patch(e.branch_id,CB(e,n)))?.kb??n),r(`Assistant Knowledge policy saved`)}catch(e){i(e instanceof Error?e.message:String(e))}finally{b(!1)}}},k=e=>{let t=w.get(e);t&&(l(e=>({...e,primary_namespace_id:t.namespace_id,primary_namespace_slug:t.slug,default_visibility:t.visibility_default,memory_path_template:e.memory_path_template??`memory/{{YYYY-MM-DD}}.md`})),d(t))},A=(e,t)=>{l(n=>({...n,grants:(n.grants??[]).map(n=>xB(n)===e?{...n,...t}:n)}))},ee=e=>{let t=w.get(e);t&&l(e=>{let n=e.grants??[];return n.some(e=>e.namespace_id===t.namespace_id)?e:{...e,grants:[...n,{namespace_id:t.namespace_id,namespace_slug:t.slug,access:`read`}]}})},j=e=>{l(t=>({...t,grants:(t.grants??[]).filter(t=>xB(t)!==e)}))};if(!a)return(0,W.jsx)(E,{description:`Knowledge memory is only available for assistant branches.`});let M=!u&&(!c.primary_namespace_id||x),N=new Set((c.grants??[]).map(e=>e.namespace_id));return c.primary_namespace_id&&N.add(c.primary_namespace_id),(0,W.jsx)(`div`,{style:{padding:16},children:(0,W.jsxs)(z,{direction:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(I,{type:`info`,showIcon:!0,message:`Assistant Knowledge`,description:`Assistant tools always use the home namespace for memory. Beyond that, this policy controls which Knowledge namespaces assistant-specific MCP tools may search. Effective access is still limited by the current user's namespace permissions.`}),(0,W.jsx)(Me,{title:`Home namespace`,extra:(0,W.jsxs)(z,{children:[u?.slug&&(0,W.jsx)(V,{href:`/kb/${encodeURIComponent(u.slug)}/`,target:`_blank`,children:`Open in Knowledge`}),n&&(0,W.jsx)(V,{onClick:T,loading:g,disabled:!t,children:c.primary_namespace_id?`Repair namespace`:`Create namespace`})]}),children:(0,W.jsxs)(z,{direction:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(s.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`The home namespace is where this assistant stores its memory and where assistant-specific Knowledge tools start by default. Choose a namespace you can write to.`}),n&&(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(P,{showSearch:!0,"aria-label":`Home Knowledge namespace`,placeholder:`Select home Knowledge namespace`,value:c.primary_namespace_id,loading:m,disabled:!t||g,optionFilterProp:`label`,onChange:k,style:{minWidth:360,flex:1},options:f.map(e=>{let t=yB.has(e.effective_permission??`none`);return{label:SB(e),value:e.namespace_id,disabled:!t&&e.namespace_id!==c.primary_namespace_id}})}),(0,W.jsx)(V,{type:`primary`,onClick:()=>O(c),loading:y,disabled:!t||!c.primary_namespace_id,children:`Save home`})]}),m?(0,W.jsx)(Ee,{}):M?(0,W.jsx)(I,{type:`warning`,showIcon:!0,message:`Home namespace is missing or unavailable`,description:x||`namespace for this agent is not set up`}):(0,W.jsxs)(R,{column:1,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Name`,children:u?.display_name}),(0,W.jsx)(R.Item,{label:`Slug`,children:(0,W.jsx)(s.Text,{code:!0,children:u?.slug??c.primary_namespace_slug})}),(0,W.jsx)(R.Item,{label:`Your permission`,children:(0,W.jsx)(v,{children:u?.effective_permission??`unknown`})}),(0,W.jsx)(R.Item,{label:`Default document visibility`,children:(0,W.jsx)(v,{children:u?.visibility_default??c.default_visibility})}),(0,W.jsx)(R.Item,{label:`Others can`,children:(0,W.jsx)(v,{children:u?.others_can??`unknown`})}),(0,W.jsx)(R.Item,{label:`Memory path`,children:(0,W.jsx)(s.Text,{code:!0,children:c.memory_path_template??`memory/{{YYYY-MM-DD}}.md`})})]})]})}),(0,W.jsx)(Me,{title:`Assistant Knowledge access`,extra:n?(0,W.jsx)(V,{type:`primary`,onClick:()=>O(c),loading:y,disabled:!t||!c.primary_namespace_id,children:`Save policy`}):null,children:(0,W.jsxs)(z,{direction:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(s.Text,{strong:!0,children:`Entire Knowledge Base fallback`}),(0,W.jsx)(s.Paragraph,{type:`secondary`,style:{marginBottom:8},children:`Applies to any namespace that is not listed below. Choose none for a locked-down assistant, read for broad context, or write for assistant tools that may update any namespace the current user can write.`}),(0,W.jsx)(P,{value:c.global_access??`write`,options:vB,disabled:!n,style:{width:220},onChange:e=>l(t=>({...t,global_access:e}))})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(s.Text,{strong:!0,children:`Per-namespace overrides`}),(0,W.jsx)(s.Paragraph,{type:`secondary`,style:{marginBottom:8},children:`Add namespaces to narrow or expand the fallback policy for specific spaces. The home namespace is always available to assistant memory tools.`}),n&&(0,W.jsx)(P,{showSearch:!0,placeholder:`Add namespace override`,style:{minWidth:320,marginBottom:12},disabled:!t,value:void 0,optionFilterProp:`label`,onChange:ee,options:f.filter(e=>!N.has(e.namespace_id)).map(e=>({label:`${e.display_name} (${e.slug})`,value:e.namespace_id}))}),(0,W.jsx)(D,{size:`small`,pagination:!1,rowKey:`key`,dataSource:C,locale:{emptyText:`No per-namespace overrides`},columns:[{title:`Namespace`,dataIndex:`namespace_slug`,render:(e,t)=>{let n=w.get(t.namespace_id);return(0,W.jsxs)(z,{direction:`vertical`,size:0,children:[(0,W.jsx)(s.Text,{children:n?.display_name??t.namespace_slug}),(0,W.jsx)(s.Text,{type:`secondary`,code:!0,children:t.namespace_slug})]})}},{title:`Access`,dataIndex:`access`,width:150,render:(e,t)=>(0,W.jsx)(P,{value:t.access,options:vB,disabled:!n,style:{width:130},onChange:e=>A(t.key,{access:e})})},{title:`Effective now`,width:150,render:(e,t)=>(0,W.jsx)(v,{children:w.get(t.namespace_id)?.effective_permission??`unknown`})},{title:``,width:90,render:(e,t)=>n?(0,W.jsx)(V,{type:`link`,danger:!0,onClick:()=>j(t.key),children:`Remove`}):null}]})]})]})})]})})},TB=e=>String(e??``).trim().toLowerCase(),EB=e=>e.filter(Boolean).join(` `).toLowerCase(),DB=e=>{let t=e.name?.trim();return t&&t!==e.email?`${t} (${e.email})`:e.email},OB=e=>{let t=e.slug?.trim();return t&&t!==e.name?`${e.name} (${t})`:e.name},kB=e=>TB(e),AB=e=>{let t=DB(e);return{value:e.user_id,label:t,searchText:kB(t)}},jB=e=>{let t=OB(e);return{value:e.group_id,label:t,searchText:kB(t)}},MB={showSearch:!0,optionFilterProp:`searchText`,optionLabelProp:`label`,filterOption:(e,t)=>{let n=TB(e);if(!n)return!0;let r=typeof t?.label==`string`?t.label:``;return EB([t?.searchText,r]).includes(n)}},NB={none:`No access`,view:`View only`,session:`Create and prompt own sessions`,prompt:`Prompt any session`,all:`Full control`},PB={none:`No filesystem access`,read:`Read-only`,write:`Read/write`},FB=e=>e===`none`?`private`:`shared`,IB=(e,t)=>e===`private`?`none`:t===`none`?`session`:t||`session`,LB=({value:e,onChange:t,allUsers:n,allGroups:r,currentUser:i,canEdit:a,canEditOwners:o=a,canEditGroups:c=a,loadingOwners:l=!1,groupGrantsLoading:u=!1,groupGrantsUnavailable:f=!1,groupGrantsError:p,ownersLoadError:m,ownerHelp:h=`Full access`,groupsHelp:g=`Group access`,visibilityLabel:_=`Visibility`,othersCanLabel:v=`Others Can`,othersFsAccessLabel:y=`Filesystem Access`,showLegacySessionSharing:b=!0})=>{let{showError:x}=mn(),[S,C]=(0,U.useState)(0),w=i?.user_id,T=e.visibility===`shared`,E=e.ownerIds.length===1?`Private (${(e=>{let t=n.find(t=>t.user_id===e),r=t?.name||t?.email||e;return e===w?`${r} (You)`:r})(e.ownerIds[0])})`:`Private`,D=e=>{if(e.length===0){x(`At least one owner is required`),C(e=>e+1);return}t(`ownerIds`,e)},O=n=>{if(t(`visibility`,n),t(`othersCan`,IB(n,e.othersCan)),n===`private`){let n=e.ownerIds.length===1?e.ownerIds[0]:w&&e.ownerIds.includes(w)?w:e.ownerIds[0]||w;n&&t(`ownerIds`,[n]),t(`groupGrants`,[]),t(`othersFsAccess`,`none`),t(`allowSessionSharing`,!1)}};return(0,W.jsxs)(W.Fragment,{children:[m&&(0,W.jsx)(I,{type:`error`,showIcon:!0,message:`Permissions unavailable`,description:`${m.message}. Close and reopen the modal to retry.`,style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:_,labelCol:{span:8},wrapperCol:{span:16},help:T?`Group and fallback access.`:`Owner-only access.`,children:(0,W.jsx)(d.Group,{value:e.visibility,disabled:!a,onChange:e=>O(e.target.value),options:[{value:`private`,label:E},{value:`shared`,label:`Shared`}]})}),T&&(0,W.jsx)(B.Item,{label:`Owners`,labelCol:{span:8},wrapperCol:{span:16},help:h,children:(0,W.jsx)(P,{mode:`multiple`,style:{width:`100%`},placeholder:`Select owners...`,value:e.ownerIds,onChange:D,loading:l,disabled:!o,...MB,options:n.map(e=>{let t=e.user_id===w,n=AB(e),r=t?`${n.label} (You)`:n.label;return{...n,label:r,searchText:kB(r)}}).sort((e,t)=>e.label.localeCompare(t.label)),tagRender:e=>{let t=n.find(t=>t.user_id===e.value)?.user_id===w;return(0,W.jsx)(tr,{...e,color:t?`green`:`default`,closable:e.closable,onClose:e.onClose,style:{marginRight:3},children:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(Be,{style:{fontSize:11}}),(0,W.jsx)(`span`,{children:e.label})]})})}},S)}),T&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Groups`,labelCol:{span:8},wrapperCol:{span:16},help:g,children:(0,W.jsxs)(z,{direction:`vertical`,style:{width:`100%`},children:[f&&(0,W.jsx)(I,{type:`warning`,showIcon:!0,message:`Group permissions unavailable`,description:p?.message?`Group permissions could not be loaded: ${p.message}`:`Group grants may not be enabled.`}),(0,W.jsx)(P,{mode:`multiple`,style:{width:`100%`},placeholder:`Select groups...`,value:e.groupGrants.map(e=>e.group_id),loading:u,disabled:!c,options:r.map(jB).sort((e,t)=>e.label.localeCompare(t.label)),...MB,onChange:n=>{let r=new Map(e.groupGrants.map(e=>[e.group_id,e]));t(`groupGrants`,n.map(e=>r.get(e)||{group_id:e,can:`view`}))}}),e.groupGrants.map(n=>{let i=r.find(e=>e.group_id===n.group_id);return(0,W.jsxs)(z,{style:{width:`100%`,justifyContent:`space-between`},children:[(0,W.jsx)(s.Text,{children:i?.name||n.group_id}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{size:`small`,style:{width:140},value:n.can,disabled:!c,options:[{value:`view`,label:`View`},{value:`session`,label:`Own Sessions`},{value:`prompt`,label:`Prompt`},{value:`all`,label:`All`}],onChange:r=>t(`groupGrants`,e.groupGrants.map(e=>e.group_id===n.group_id?{...e,can:r}:e))}),(0,W.jsx)(P,{size:`small`,style:{width:110},value:n.fs_access||`read`,disabled:!c,options:[{value:`none`,label:`No FS`},{value:`read`,label:`Read FS`},{value:`write`,label:`Write FS`}],onChange:r=>t(`groupGrants`,e.groupGrants.map(e=>e.group_id===n.group_id?{...e,fs_access:r}:e))})]})]},n.group_id)})]})}),(0,W.jsx)(B.Item,{label:v,labelCol:{span:8},wrapperCol:{span:16},help:NB[e.othersCan],children:(0,W.jsx)(P,{value:e.othersCan,onChange:e=>t(`othersCan`,e),disabled:!a,options:[{value:`view`,label:`View`},{value:`session`,label:`Own Sessions`},{value:`prompt`,label:`Prompt`},{value:`all`,label:`All`}]})}),e.othersCan===`prompt`&&(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(I,{type:`warning`,showIcon:!0,icon:(0,W.jsx)(Xe,{}),message:`Unix identity risk`,description:`Allows prompting sessions created by others; use only with trusted collaborators.`})}),(0,W.jsx)(B.Item,{label:y,labelCol:{span:8},wrapperCol:{span:16},help:PB[e.othersFsAccess],children:(0,W.jsx)(P,{value:e.othersFsAccess,onChange:e=>t(`othersFsAccess`,e),disabled:!a,options:[{value:`none`,label:`None`},{value:`read`,label:`Read`},{value:`write`,label:`Write`}]})}),b&&(0,W.jsx)(B.Item,{label:`Allow legacy session sharing`,labelCol:{span:8},wrapperCol:{span:16},help:`When on, spawned/forked sessions keep the original creator's identity.`,children:(0,W.jsx)(ye,{checked:e.allowSessionSharing,onChange:e=>t(`allowSessionSharing`,e),disabled:!a})}),b&&e.allowSessionSharing&&(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(I,{type:`error`,showIcon:!0,icon:(0,W.jsx)(Xe,{}),message:`Dangerous: identity borrowing`,description:`Use only for trusted collaborators or legacy automation.`})})]})]})},RB=({loadingOwners:e,canEdit:t,allUsers:n,allGroups:r=[],groupGrantsStatus:i=`loaded`,groupGrantsError:a,currentUser:o,client:c,board:l,state:u,setField:f,ownersLoadError:p})=>{let[m,h]=(0,U.useState)([]),[g,_]=(0,U.useState)([]),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(null),S=u.permissionSource??`override`,C=t&&S===`override`,w={visibility:FB(u.othersCan),ownerIds:u.selectedOwnerIds,groupGrants:u.groupGrants??[],othersCan:u.othersCan,othersFsAccess:u.othersFsAccess,allowSessionSharing:u.allowSessionSharing},T=(e,t)=>{e===`ownerIds`&&f(`selectedOwnerIds`,t),e===`groupGrants`&&f(`groupGrants`,t),e===`othersCan`&&f(`othersCan`,t),e===`othersFsAccess`&&f(`othersFsAccess`,t),e===`allowSessionSharing`&&f(`allowSessionSharing`,t)};(0,U.useEffect)(()=>{if(!c||!l?.board_id||S!==`board`){h([]),_([]),x(null);return}let e=!1;return y(!0),x(null),Promise.all([c.service(`boards/:id/owners`).find({route:{id:l.board_id}}),c.service(`boards/:id/group-grants`).find({route:{id:l.board_id}})]).then(([t,n])=>{e||(h(t),_(n))}).catch(t=>{e||(h([]),_([]),x(t instanceof Error?t:Error(String(t))))}).finally(()=>{e||y(!1)}),()=>{e=!0}},[c,l?.board_id,S]);let E=m.map(e=>e.name||e.email||e.user_id),D=g.map(e=>{let t=r.find(t=>t.group_id===e.group_id),n=e.group?.name||t?.name||e.group_id,i=e.fs_access?`, FS: ${e.fs_access}`:``;return`${n}: ${e.can}${i}`});return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,children:[(0,W.jsx)(B.Item,{label:`Permission Mode`,labelCol:{span:8},wrapperCol:{span:16},help:S===`board`?`Uses board-level defaults for non-owner access.`:`Uses branch-level permission overrides.`,children:(0,W.jsx)(d.Group,{value:S,disabled:!t,onChange:e=>f(`permissionSource`,e.target.value),options:[{value:`board`,label:`Align with board permissions`},{value:`override`,label:`Override board-level permissions`}]})}),S===`board`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(I,{type:`info`,showIcon:!0,message:`Aligned with board permissions`,description:`This branch inherits board-level visibility, board owners, board groups, and board fallback permissions. Switch to Override to edit branch-level private/shared permissions directly.`})}),(0,W.jsx)(B.Item,{label:`Board defaults`,labelCol:{span:8},wrapperCol:{span:16},children:l?(0,W.jsxs)(R,{size:`small`,column:1,bordered:!0,style:{width:`100%`},children:[(0,W.jsx)(R.Item,{label:`Visibility`,children:l.access_mode===`private`?`Private`:`Shared`}),(0,W.jsx)(R.Item,{label:`Owners`,children:v?`Loading…`:E.length>0?E.join(`, `):`None`}),b&&(0,W.jsx)(R.Item,{label:`Owner/group details`,children:(0,W.jsxs)(s.Text,{type:`danger`,children:[`Could not load: `,b.message]})}),l.access_mode!==`private`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R.Item,{label:`Groups`,children:v?`Loading…`:D.length>0?D.join(`, `):`None`}),(0,W.jsx)(R.Item,{label:`Others can`,children:l.default_others_can||`session`}),(0,W.jsx)(R.Item,{label:`Filesystem access`,children:l.default_others_fs_access||`read`}),(0,W.jsx)(R.Item,{label:`Legacy session sharing`,children:l.default_dangerously_allow_session_sharing?`Allowed`:`Off`})]})]}):(0,W.jsx)(s.Text,{type:`secondary`,children:`Board defaults are unavailable for this branch.`})})]}),S===`override`&&(0,W.jsx)(LB,{value:w,onChange:T,allUsers:n,allGroups:r,currentUser:o,canEdit:C,canEditGroups:C&&i===`loaded`,loadingOwners:e,groupGrantsLoading:i===`loading`,groupGrantsUnavailable:i===`unavailable`,groupGrantsError:a,ownersLoadError:p,groupsHelp:`Grant explicit branch access to user groups`})]})})},zB=function(){return zB=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},zB.apply(this,arguments)};function BB(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function VB(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var HB=[{name:`@yearly`,value:`0 0 1 1 *`},{name:`@annually`,value:`0 0 1 1 *`},{name:`@monthly`,value:`0 0 1 * *`},{name:`@weekly`,value:`0 0 * * 0`},{name:`@daily`,value:`0 0 * * *`},{name:`@midnight`,value:`0 0 * * *`},{name:`@hourly`,value:`0 * * * *`}],UB=[{type:`minutes`,min:0,max:59,total:60},{type:`hours`,min:0,max:23,total:24},{type:`month-days`,min:1,max:31,total:31},{type:`months`,min:1,max:12,total:12,alt:[`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`]},{type:`week-days`,min:0,max:6,total:7,alt:[`SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`]}],WB={everyText:`every`,emptyMonths:`every month`,emptyMonthDays:`every day of the month`,emptyMonthDaysShort:`day of the month`,emptyWeekDays:`every day of the week`,emptyWeekDaysShort:`day of the week`,emptyHours:`every hour`,emptyMinutes:`every minute`,emptyMinutesForHourPeriod:`every`,yearOption:`year`,monthOption:`month`,weekOption:`week`,dayOption:`day`,hourOption:`hour`,minuteOption:`minute`,rebootOption:`reboot`,prefixPeriod:`Every`,prefixMonths:`in`,prefixMonthDays:`on`,prefixWeekDays:`on`,prefixWeekDaysForMonthAndYearPeriod:`and`,prefixHours:`at`,prefixMinutes:`:`,prefixMinutesForHourPeriod:`at`,suffixMinutesForHourPeriod:`minute(s)`,errorInvalidCron:`Invalid cron expression`,clearButtonText:`Clear`,weekDays:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],altWeekDays:[`SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`],altMonths:[`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`]};function GB(e,t){for(var n=[],r=e;r<=t;r++)n.push(r);return n}function KB(e){return e.sort((function(e,t){return e-t})),e}function qB(e){var t=[];return e.forEach((function(e){t.indexOf(e)<0&&t.push(e)})),t}function JB(e){return Object.entries(e).filter((function(e){var t=e[0],n=e[1];return t&&n})).map((function(e){return e[0]})).join(` `)}function YB(e,t){e&&e({type:`invalid_cron`,description:t.errorInvalidCron||WB.errorInvalidCron})}function XB(e){var t=parseInt(e,10),n=Number(e);return t===n?n:NaN}function ZB(e,t,n,r,i,a,o,s,c,l,u,d,f,p){n&&n(void 0),t(!1);var m=!1;if(!e){if(r===`always`||a&&r===`for-default-value`)return;m=!0}if(!m){if(s&&(!0===s||s.includes(e))){if(e===`@reboot`)return void p(`reboot`);var h=HB.find((function(t){return t.name===e}));h&&(e=h.value)}try{var g=nV(e);p(function(e){return e[3].length>0?`year`:e[2].length>0?`month`:e[4].length>0?`week`:e[1].length>0?`day`:e[0].length>0?`hour`:`minute`}(g)),c(g[0]),l(g[1]),u(g[2]),d(g[3]),f(g[4])}catch{m=!0}}m&&(i.current=e,t(!0),YB(n,o))}function QB(e,t,n,r,i,a,o,s){return e===`reboot`?`@reboot`:function(e,t,n){return e.map((function(e,r){var i=UB[r],a=tV(e,i),o=n?.[i.type];return $B(a,i,o?.humanizeValue??t)}))}([e!==`minute`&&a?a:[],e!==`minute`&&e!==`hour`&&i?i:[],e!==`year`&&e!==`month`||!n?[]:n,e===`year`&&t?t:[],e!==`year`&&e!==`month`&&e!==`week`||!r?[]:r],o,s).join(` `)}function $B(e,t,n,r,i){var a=``;if(function(e,t){return e.length===t.max-t.min+1}(e,t)||e.length===0)a=`*`;else{var o=function(e){if(e.length>2){var t=e[1]-e[0];if(t>1)return t}}(e);a=o&&function(e,t){for(var n=1;n<e.length;n++){var r=e[n-1];if(e[n]-r!==t)return!1}return!0}(e,o)?function(e,t,n){var r=aV(e),i=oV(e),a=e.length===(i-r)/n+1;return!!(r===t.min&&i+n>t.max&&a)}(e,t,o)?`*/${o}`:`${eV(aV(e),t,n,r,i)}-${eV(oV(e),t,n,r,i)}/${o}`:function(e){var t=[],n=null;return e.forEach((function(e,r,i){e===i[r+1]-1?n===null&&(n=e):n===null?t.push(e):(t.push([n,e]),n=null)})),t}(e).map((function(e){return Array.isArray(e)?`${eV(e[0],t,n,r,i)}-${eV(e[1],t,n,r,i)}`:eV(e,t,n,r,i)})).join(`,`)}return a}function eV(e,t,n,r,i){var a=e.toString(),o=t.type,s=t.alt,c=t.min,l=r&&(!0===r||r.includes(o));if(n&&o===`week-days`||n&&o===`months`?a=s[e-c]:e<10&&(l||i===`24-hour-clock`&&(o===`hours`||o===`minutes`))&&(a=a.padStart(2,`0`)),o===`hours`&&i===`12-hour-clock`){var u=e>=12?`PM`:`AM`,d=e%12||12;d<10&&l&&(d=d.toString().padStart(2,`0`)),a=`${d}${u}`}return a}function tV(e,t){var n=KB(qB(rV(e,t)));if(n.length===0)return n;var r=iV(n,t);if(r!==void 0)throw Error(`Value "${r}" out of range for ${t.type}`);return n}function nV(e){if(typeof e!=`string`)throw Error(`Invalid cron string`);var t=e.replace(/\s+/g,` `).trim().split(` `);if(t.length===5)return t.map((function(e,t){return function(e,t){if(e===`*`||e===`*/1`)return[];var n=KB(qB(rV(function(e,t,n){if(n){e=e.toUpperCase();for(var r=0;r<n.length;r++)e=e.replace(n[r],`${r+t}`)}return e}(e,t.min,t.alt).split(`,`).map((function(n){var r,i=n.split(`/`);if(i.length>2)throw Error(`Invalid value "${e} for "${t.type}"`);var a=i[0],o=i[1];r=a===`*`?GB(t.min,t.max):function(e,t,n){var r=e.split(`-`);if(r.length===1){var i=XB(r[0]);if(isNaN(i))throw Error(`Invalid value "${t}" for ${n.type}`);return[i]}if(r.length===2){var a=XB(r[0]),o=XB(r[1]);if(isNaN(a)||isNaN(o))throw Error(`Invalid value "${t}" for ${n.type}`);if(o<a)throw Error(`Max range is less than min range in "${e}" for ${n.type}`);return GB(a,o)}throw Error(`Invalid value "${e}" for ${n.type}`)}(a,e,t);var s=function(e,t){if(e!==void 0){var n=XB(e);if(isNaN(n)||n<1)throw Error(`Invalid interval step value "${e}" for ${t.type}`);return n}}(o,t);return function(e,t){if(t){var n=e[0];e=e.filter((function(e){return e%t==n%t||e===n}))}return e}(r,s)})).flat(),t))),r=iV(n,t);if(r!==void 0)throw Error(`Value "${r}" out of range for ${t.type}`);return n.length===t.total?[]:n}(e,UB[t])}));throw Error(`Invalid cron string format`)}function rV(e,t){return t.type===`week-days`&&(e=e.map((function(e){return e===7?0:e}))),e}function iV(e,t){var n=e[0],r=e[e.length-1];return n<t.min?n:r>t.max?r:void 0}function aV(e){return e[0]}function oV(e){return e[e.length-1]}Object.freeze({__proto__:null,setValuesFromCronString:ZB,getCronStringFromValues:QB,partToString:$B,formatValue:eV,parsePartArray:tV,parseCronString:nV});function sV(e){var t=e.value,n=e.grid,r=n===void 0||n,i=e.optionsList,a=e.setValue,o=e.locale,s=e.className,c=e.humanizeLabels,l=e.disabled,u=e.readOnly,d=e.leadingZero,f=e.clockFormat,p=e.period,m=e.unit,h=e.periodicityOnDoubleClick,g=e.mode,_=e.allowClear,v=e.filterOption,y=v===void 0?function(){return!0}:v,b=e.getPopupContainer,x=BB(e,[`value`,`grid`,`optionsList`,`setValue`,`locale`,`className`,`humanizeLabels`,`disabled`,`readOnly`,`leadingZero`,`clockFormat`,`period`,`unit`,`periodicityOnDoubleClick`,`mode`,`allowClear`,`filterOption`,`getPopupContainer`]),S=(0,U.useMemo)((function(){if(t&&Array.isArray(t))return t.map((function(e){return e.toString()}))}),[t]),C=(0,U.useMemo)((function(){return i?i.map((function(e,t){return{value:(m.min===0?t:t+1).toString(),label:e}})).filter(y):VB([],Array(m.total),!0).map((function(e,t){var n=m.min===0?t:t+1;return{value:n.toString(),label:eV(n,m,c,d,f)}})).filter(y)}),[i,d,c,f]),w=(0,U.useCallback)((function(e){var n=e.value;if(!t||t[0]!==Number(n))return(0,W.jsx)(W.Fragment,{});var r=$B(tV(t,m),m,c,d,f),i=r.match(/^\*\/([0-9]+),?/)||[];return(0,W.jsx)(`div`,{children:i[1]?`${o.everyText||WB.everyText} ${i[1]}`:r})}),[t,JSON.stringify(o),c,d,f]),T=(0,U.useCallback)((function(e){var n=Array.isArray(e)?KB(e):[e],r=n;t&&(r=g===`single`?[]:VB([],t,!0),n.forEach((function(e){var n=Number(e);r=t.some((function(e){return e===n}))?r.filter((function(e){return e!==n})):KB(VB(VB([],r,!0),[n],!1))}))),r.length===m.total?a([]):a(r)}),[a,t]),E=(0,U.useCallback)((function(e){if(e!==0&&e!==1){for(var n=m.total+m.min,r=[],i=m.min;i<n;i++)i%e==0&&r.push(i);var o=t&&r&&t.length===r.length&&t.every((function(e,t){return e===r[t]}));a(r.length===C.length||o?[]:r)}else a([])}),[t,C,a]),D=(0,U.useRef)([]),O=(0,U.useCallback)((function(e){if(!u){var t=D.current;t.push({time:new Date().getTime(),value:Number(e)});var n=window.setTimeout((function(){h&&t.length>1&&t[t.length-1].time-t[t.length-2].time<300?t[t.length-1].value===t[t.length-2].value?E(Number(e)):T([t[t.length-2].value,t[t.length-1].value]):T(Number(e)),D.current=[]}),300);return function(){window.clearTimeout(n)}}}),[D,T,E,u,h]),k=(0,U.useCallback)((function(){u||a([])}),[a,u]),A=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})[`${s}-select`]=!!s,e))}),[s]),ee=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-select-dropdown":!0})[`react-js-cron-select-dropdown-${m.type}`]=!0,e[`react-js-cron-custom-select-dropdown`]=!0,e[`react-js-cron-custom-select-dropdown-${m.type}`]=!0,e[`react-js-cron-custom-select-dropdown-minutes-large`]=m.type===`minutes`&&p!==`hour`&&p!==`day`,e[`react-js-cron-custom-select-dropdown-minutes-medium`]=m.type===`minutes`&&(p===`day`||p===`hour`),e[`react-js-cron-custom-select-dropdown-hours-twelve-hour-clock`]=m.type===`hours`&&f===`12-hour-clock`,e[`react-js-cron-custom-select-dropdown-grid`]=!!r,e[`${s}-select-dropdown`]=!!s,e[`${s}-select-dropdown-${m.type}`]=!!s,e))}),[s,r,f,p]);return(0,W.jsx)(P,zB({mode:g!==`single`||h?`multiple`:void 0,allowClear:_??!u,virtual:!1,open:!u&&void 0,value:S,onClear:k,tagRender:w,className:A,popupClassName:ee,options:C,showSearch:!1,suffixIcon:u?null:void 0,menuItemSelectedIcon:null,popupMatchSelectWidth:!1,onSelect:O,onDeselect:O,disabled:l,dropdownAlign:m.type!==`minutes`&&m.type!==`hours`||p===`day`||p===`hour`?void 0:{points:[`tr`,`br`]},"data-testid":`custom-select-${m.type}`,getPopupContainer:b},x))}function cV(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.disabled,o=e.readOnly,s=e.leadingZero,c=e.clockFormat,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-field":!0,"react-js-cron-hours":!0})[`${i}-field`]=!!i,e[`${i}-hours`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,zB({className:h},{children:[r.prefixHours!==``&&(0,W.jsx)(`span`,{children:r.prefixHours||WB.prefixHours}),(0,W.jsx)(sV,{placeholder:r.emptyHours||WB.emptyHours,value:t,unit:UB[1],setValue:n,locale:r,className:i,disabled:a,readOnly:o,leadingZero:s,clockFormat:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m})]}))}function lV(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.disabled,o=e.readOnly,s=e.leadingZero,c=e.clockFormat,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-field":!0,"react-js-cron-minutes":!0})[`${i}-field`]=!!i,e[`${i}-minutes`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,zB({className:h},{children:[l===`hour`?r.prefixMinutesForHourPeriod!==``&&(0,W.jsx)(`span`,{children:r.prefixMinutesForHourPeriod||WB.prefixMinutesForHourPeriod}):r.prefixMinutes!==``&&(0,W.jsx)(`span`,{children:r.prefixMinutes||WB.prefixMinutes}),(0,W.jsx)(sV,{placeholder:l===`hour`?r.emptyMinutesForHourPeriod||WB.emptyMinutesForHourPeriod:r.emptyMinutes||WB.emptyMinutes,value:t,unit:UB[0],setValue:n,locale:r,className:i,disabled:a,readOnly:o,leadingZero:s,clockFormat:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m}),l===`hour`&&r.suffixMinutesForHourPeriod!==``&&(0,W.jsx)(`span`,{children:r.suffixMinutesForHourPeriod||WB.suffixMinutesForHourPeriod})]}))}function uV(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.weekDays,o=e.disabled,s=e.readOnly,c=e.leadingZero,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=!a||a.length===0,g=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!h})[`${i}-field`]=!!i,e[`${i}-month-days`]=!!i,e))}),[i,h]),_=(0,U.useMemo)((function(){return h?r.emptyMonthDays||WB.emptyMonthDays:r.emptyMonthDaysShort||WB.emptyMonthDaysShort}),[h,JSON.stringify(r)]);return!s||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?(0,W.jsxs)(`div`,zB({className:g},{children:[r.prefixMonthDays!==``&&(0,W.jsx)(`span`,{children:r.prefixMonthDays||WB.prefixMonthDays}),(0,W.jsx)(sV,{placeholder:_,value:t,setValue:n,unit:UB[2],locale:r,className:i,disabled:o,readOnly:s,leadingZero:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m})]})):null}function dV(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.humanizeLabels,o=e.disabled,s=e.readOnly,c=e.period,l=e.periodicityOnDoubleClick,u=e.mode,d=e.allowClear,f=e.filterOption,p=e.getPopupContainer,m=r.months||WB.months,h=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-field":!0,"react-js-cron-months":!0})[`${i}-field`]=!!i,e[`${i}-months`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,zB({className:h},{children:[r.prefixMonths!==``&&(0,W.jsx)(`span`,{children:r.prefixMonths||WB.prefixMonths}),(0,W.jsx)(sV,{placeholder:r.emptyMonths||WB.emptyMonths,optionsList:m,grid:!1,value:t,unit:zB(zB({},UB[3]),{alt:r.altMonths||WB.altMonths}),setValue:n,locale:r,className:i,humanizeLabels:a,disabled:o,readOnly:s,period:c,periodicityOnDoubleClick:l,mode:u,allowClear:d,filterOption:f,getPopupContainer:p})]}))}function fV(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.disabled,o=e.readOnly,s=e.shortcuts,c=e.allowedPeriods,l=e.allowClear,u=e.getPopupContainer,d=[];c.includes(`year`)&&d.push({value:`year`,label:r.yearOption||WB.yearOption}),c.includes(`month`)&&d.push({value:`month`,label:r.monthOption||WB.monthOption}),c.includes(`week`)&&d.push({value:`week`,label:r.weekOption||WB.weekOption}),c.includes(`day`)&&d.push({value:`day`,label:r.dayOption||WB.dayOption}),c.includes(`hour`)&&d.push({value:`hour`,label:r.hourOption||WB.hourOption}),c.includes(`minute`)&&d.push({value:`minute`,label:r.minuteOption||WB.minuteOption}),c.includes(`reboot`)&&s&&(!0===s||s.includes(`@reboot`))&&d.push({value:`reboot`,label:r.rebootOption||WB.rebootOption});var f=(0,U.useCallback)((function(e){o||n(e)}),[n,o]),p=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-field":!0,"react-js-cron-period":!0})[`${i}-field`]=!!i,e[`${i}-period`]=!!i,e))}),[i]),m=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===``})[`${i}-select`]=!!i,e))}),[i,r.prefixPeriod]),h=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})[`${i}-select-dropdown`]=!!i,e[`${i}-select-dropdown-period`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,zB({className:p},{children:[r.prefixPeriod!==``&&(0,W.jsx)(`span`,{children:r.prefixPeriod||WB.prefixPeriod}),(0,W.jsx)(P,{defaultValue:t,value:t,onChange:f,options:d,className:m,popupClassName:h,disabled:a,suffixIcon:o?null:void 0,open:!o&&void 0,"data-testid":`select-period`,allowClear:l,getPopupContainer:u},JSON.stringify(r))]}))}function pV(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.humanizeLabels,o=e.monthDays,s=e.disabled,c=e.readOnly,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=r.weekDays||WB.weekDays,g=l===`week`||!o||o.length===0,_=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!g})[`${i}-field`]=!!i,e[`${i}-week-days`]=!!i,e))}),[i,g]),v=(0,U.useMemo)((function(){return g?r.emptyWeekDays||WB.emptyWeekDays:r.emptyWeekDaysShort||WB.emptyWeekDaysShort}),[g,JSON.stringify(r)]),y=l===`week`||!c||t&&t.length>0||(!t||t.length===0)&&(!o||o.length===0),b=!c||o&&o.length>0||(!o||o.length===0)&&(!t||t.length===0);return y?(0,W.jsxs)(`div`,zB({className:_},{children:[r.prefixWeekDays!==``&&(l===`week`||!b)&&(0,W.jsx)(`span`,{children:r.prefixWeekDays||WB.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==``&&l!==`week`&&b&&(0,W.jsx)(`span`,{children:r.prefixWeekDaysForMonthAndYearPeriod||WB.prefixWeekDaysForMonthAndYearPeriod}),(0,W.jsx)(sV,{placeholder:v,optionsList:h,grid:!1,value:t,unit:zB(zB({},UB[4]),{alt:r.altWeekDays||WB.altWeekDays}),setValue:n,locale:r,className:i,humanizeLabels:a,disabled:s,readOnly:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m})]})):null}function mV(e){var t=e.clearButton,n=t===void 0||t,r=e.clearButtonProps,i=r===void 0?{}:r,a=e.clearButtonAction,o=a===void 0?`fill-with-every`:a,s=e.locale,c=s===void 0?WB:s,l=e.value,u=l===void 0?``:l,d=e.setValue,f=e.displayError,p=f===void 0||f,m=e.onError,h=e.className,g=e.defaultPeriod,_=g===void 0?`day`:g,v=e.allowEmpty,y=v===void 0?`for-default-value`:v,b=e.humanizeLabels,x=b===void 0||b,S=e.humanizeValue,C=S!==void 0&&S,w=e.disabled,T=w!==void 0&&w,E=e.readOnly,D=E!==void 0&&E,O=e.leadingZero,k=O!==void 0&&O,A=e.shortcuts,ee=A===void 0?[`@yearly`,`@annually`,`@monthly`,`@weekly`,`@daily`,`@midnight`,`@hourly`]:A,j=e.clockFormat,M=e.periodicityOnDoubleClick,N=M===void 0||M,te=e.mode,P=te===void 0?`multiple`:te,ne=e.allowedDropdowns,re=ne===void 0?[`period`,`months`,`month-days`,`week-days`,`hours`,`minutes`]:ne,ie=e.allowedPeriods,ae=ie===void 0?[`year`,`month`,`week`,`day`,`hour`,`minute`,`reboot`]:ie,oe=e.allowClear,F=e.dropdownsConfig,se=e.getPopupContainer,ce=(0,U.useRef)(u),le=(0,U.useRef)(_),ue=(0,U.useState)(),de=ue[0],fe=ue[1],pe=(0,U.useState)(),me=pe[0],he=pe[1],ge=(0,U.useState)(),_e=ge[0],ve=ge[1],ye=(0,U.useState)(),be=ye[0],I=ye[1],xe=(0,U.useState)(),Se=xe[0],Ce=xe[1],we=(0,U.useState)(),Te=we[0],Ee=we[1],De=(0,U.useState)(!1),L=De[0],Oe=De[1],ke=(0,U.useState)(!1),Ae=ke[0],je=ke[1],Me=function(e){var t=(0,U.useRef)(e);return(0,U.useEffect)((function(){t.current=e}),[e]),t.current}(Ae),R=JSON.stringify(c);(0,U.useEffect)((function(){ZB(u,Oe,m,y,ce,!0,c,ee,Ee,Ce,he,ve,I,fe)}),[]),(0,U.useEffect)((function(){u!==ce.current&&ZB(u,Oe,m,y,ce,!1,c,ee,Ee,Ce,he,ve,I,fe)}),[u,ce,R,y,ee]),(0,U.useEffect)((function(){if(!(de||Te||_e||me||be||Se)||Ae||Me)Ae&&je(!1);else{var e=de||le.current,t=QB(e,_e,me,be,Se,Te,C,F);d(t,{selectedPeriod:e}),ce.current=t,m&&m(void 0),Oe(!1)}}),[de,me,_e,be,Se,Te,C,Ae,F]);var Ne=(0,U.useCallback)((function(){he(void 0),ve(void 0),I(void 0),Ce(void 0),Ee(void 0);var e=``,t=de!==`reboot`&&de?de:le.current;(t!==de&&fe(t),o===`fill-with-every`)&&(e=QB(t,void 0,void 0,void 0,void 0,void 0,void 0,void 0)),d(e,{selectedPeriod:t}),ce.current=e,je(!0),y===`never`&&o===`empty`?(Oe(!0),YB(m,c)):(m&&m(void 0),Oe(!1))}),[de,d,m,o]),Pe=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron":!0,"react-js-cron-error":L&&p,"react-js-cron-disabled":T,"react-js-cron-read-only":D})[`${h}`]=!!h,e[`${h}-error`]=L&&p&&!!h,e[`${h}-disabled`]=T&&!!h,e[`${h}-read-only`]=D&&!!h,e))}),[h,L,p,T,D]),Fe=i.className,Ie=BB(i,[`className`]),Le=(0,U.useMemo)((function(){var e;return JB(((e={"react-js-cron-clear-button":!0})[`${h}-clear-button`]=!!h,e[`${Fe}`]=!!Fe,e))}),[h,Fe]),Re=(0,U.useMemo)((function(){return n&&!D?(0,W.jsx)(V,zB({className:Le,danger:!0,type:`primary`,disabled:T},Ie,{onClick:Ne},{children:c.clearButtonText||WB.clearButtonText})):null}),[n,D,R,Le,T,JSON.stringify(Ie),Ne]),ze=de||le.current;return(0,W.jsxs)(`div`,zB({className:Pe},{children:[re.includes(`period`)&&(0,W.jsx)(fV,{value:ze,setValue:fe,locale:c,className:h,disabled:F?.period?.disabled??T,readOnly:F?.period?.readOnly??D,shortcuts:ee,allowedPeriods:ae,allowClear:F?.period?.allowClear??oe,getPopupContainer:se}),ze===`reboot`?Re:(0,W.jsxs)(W.Fragment,{children:[ze===`year`&&re.includes(`months`)&&(0,W.jsx)(dV,{value:_e,setValue:ve,locale:c,className:h,humanizeLabels:F?.months?.humanizeLabels??x,disabled:F?.months?.disabled??T,readOnly:F?.months?.readOnly??D,period:ze,periodicityOnDoubleClick:F?.months?.periodicityOnDoubleClick??N,mode:F?.months?.mode??P,allowClear:F?.months?.allowClear??oe,filterOption:F?.months?.filterOption,getPopupContainer:se}),(ze===`year`||ze===`month`)&&re.includes(`month-days`)&&(0,W.jsx)(uV,{value:me,setValue:he,locale:c,className:h,weekDays:be,disabled:F?.[`month-days`]?.disabled??T,readOnly:F?.[`month-days`]?.readOnly??D,leadingZero:F?.[`month-days`]?.leadingZero??k,period:ze,periodicityOnDoubleClick:F?.[`month-days`]?.periodicityOnDoubleClick??N,mode:F?.[`month-days`]?.mode??P,allowClear:F?.[`month-days`]?.allowClear??oe,filterOption:F?.[`month-days`]?.filterOption,getPopupContainer:se}),(ze===`year`||ze===`month`||ze===`week`)&&re.includes(`week-days`)&&(0,W.jsx)(pV,{value:be,setValue:I,locale:c,className:h,humanizeLabels:F?.[`week-days`]?.humanizeLabels??x,monthDays:me,disabled:F?.[`week-days`]?.disabled??T,readOnly:F?.[`week-days`]?.readOnly??D,period:ze,periodicityOnDoubleClick:F?.[`week-days`]?.periodicityOnDoubleClick??N,mode:F?.[`week-days`]?.mode??P,allowClear:F?.[`week-days`]?.allowClear??oe,filterOption:F?.[`week-days`]?.filterOption,getPopupContainer:se}),(0,W.jsxs)(`div`,{children:[ze!==`minute`&&ze!==`hour`&&re.includes(`hours`)&&(0,W.jsx)(cV,{value:Se,setValue:Ce,locale:c,className:h,disabled:F?.hours?.disabled??T,readOnly:F?.hours?.readOnly??D,leadingZero:F?.hours?.leadingZero??k,clockFormat:j,period:ze,periodicityOnDoubleClick:F?.hours?.periodicityOnDoubleClick??N,mode:F?.hours?.mode??P,allowClear:F?.hours?.allowClear??oe,filterOption:F?.hours?.filterOption,getPopupContainer:se}),ze!==`minute`&&re.includes(`minutes`)&&(0,W.jsx)(lV,{value:Te,setValue:Ee,locale:c,period:ze,className:h,disabled:F?.minutes?.disabled??T,readOnly:F?.minutes?.readOnly??D,leadingZero:F?.minutes?.leadingZero??k,clockFormat:j,periodicityOnDoubleClick:F?.minutes?.periodicityOnDoubleClick??N,mode:F?.minutes?.mode??P,allowClear:F?.minutes?.allowClear??oe,filterOption:F?.minutes?.filterOption,getPopupContainer:se}),Re]})]})]}))}var hV=({value:e,checked:t,onChange:n,showWarning:r=!0})=>{let i=typeof t==`boolean`?t:!!e;return(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(ye,{checked:i,onChange:n,checkedChildren:(0,W.jsx)(Se,{}),unCheckedChildren:(0,W.jsx)(Se,{})}),(0,W.jsx)(s.Text,{strong:!0,children:`Enable Network Access`}),(0,W.jsx)(s.Text,{type:`secondary`,children:`(workspace-write sandbox only)`})]}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`},children:i?`Allows outbound HTTP/HTTPS requests for package installation and API calls`:`Network access disabled (default, most secure)`}),r&&i&&(0,W.jsx)(I,{title:`Security Warning`,description:(0,W.jsxs)(`div`,{children:[`Enabling network access exposes your environment to:`,(0,W.jsxs)(`ul`,{style:{marginTop:8,marginBottom:0,paddingLeft:20},children:[(0,W.jsx)(`li`,{children:`Prompt injection attacks`}),(0,W.jsx)(`li`,{children:`Data exfiltration of code/secrets`}),(0,W.jsx)(`li`,{children:`Inclusion of malware or vulnerable dependencies`})]}),`Only enable for trusted tasks.`]}),type:`warning`,icon:(0,W.jsx)(Xe,{}),showIcon:!0,style:{marginTop:8}})]})},gV=[{value:`low`,shortLabel:`Lo`,label:`Low`,description:`Minimal thinking, fastest responses`},{value:`medium`,shortLabel:`Md`,label:`Medium`,description:`Moderate thinking`},{value:`high`,shortLabel:`Hi`,label:`High`,description:`Deep reasoning (default)`},{value:`max`,shortLabel:`Mx`,label:`Max`,description:`Maximum effort (Opus only)`}],_V=({value:e=`high`,onChange:t,size:n=`middle`,compact:r=!1,plain:i=!1,fullWidth:a=!1})=>{let{token:c}=ce.useToken();return(0,W.jsx)(o,{title:`Reasoning effort level`,children:(0,W.jsx)(P,{value:e,onChange:t,size:n,style:{width:a?`100%`:r?void 0:160,fontSize:r?c.fontSizeSM:void 0},popupMatchSelectWidth:!1,optionLabelProp:`label`,options:gV.map(e=>({value:e.value,label:i?e.label:r?(0,W.jsxs)(`span`,{style:{fontSize:c.fontSizeSM},children:[(0,W.jsx)(ke,{style:{fontSize:c.fontSizeSM-1,marginRight:2}}),e.shortLabel]}):(0,W.jsxs)(`span`,{children:[(0,W.jsx)(ke,{style:{fontSize:12,marginRight:6}}),e.label,` effort`]})})),optionRender:e=>{let t=gV.find(t=>t.value===e.value);return(0,W.jsxs)(z,{size:6,align:`start`,children:[(0,W.jsx)(ke,{style:{marginTop:3}}),(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:t?.label}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:11},children:t?.description})]})]})}})})};function vV(e,t,n){return!t||e.some(e=>e.id===t)?e:[n(t),...e]}function yV(e,t,n={}){return e===`cursor`?n.cursorDefaultModel||`composer-latest`:e===`copilot`?n.copilotDefaultModel||Zt(e)||`claude-sonnet-4.6`:Zt(e)||t[0]?.id||``}var{Text:bV}=s,xV=({value:e,onChange:t})=>{let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1);(0,U.useEffect)(()=>{(async()=>{try{a(!0),s(null),r((await(await $t(za())).service(`opencode/models`).find()).providers||[])}catch(e){console.error(`Failed to fetch OpenCode models:`,e),s(e instanceof Error?e.message:`Failed to fetch models. Is OpenCode server running?`)}finally{a(!1)}})()},[]),(0,U.useEffect)(()=>{if(!e&&n.length>0&&!c&&t){let e=n[0],r=e.models?.[0];e&&r&&(t({provider:e.id,model:r.id}),l(!0))}},[e,n,c,t]);let u=n.find(t=>t.id===e?.provider),d=u?.models||[],f=e=>{let r=n.find(t=>t.id===e);r&&r.models.length>0&&t&&t({provider:e,model:r.models[0].id})},p=n=>{t&&e?.provider&&t({provider:e.provider,model:n})};return i?(0,W.jsxs)(z,{children:[(0,W.jsx)(Ee,{size:`small`}),(0,W.jsx)(bV,{type:`secondary`,children:`Loading OpenCode models...`})]}):o?(0,W.jsx)(I,{title:`OpenCode Unavailable`,description:o,type:`warning`,showIcon:!0,icon:(0,W.jsx)(he,{}),action:(0,W.jsxs)(bV,{type:`secondary`,style:{fontSize:12},children:[`Start OpenCode server: `,(0,W.jsx)(`code`,{children:`opencode serve --port 4096`})]})}):n.length===0?(0,W.jsx)(I,{title:`No Providers Available`,description:`OpenCode server returned no providers. Check your OpenCode installation.`,type:`info`,showIcon:!0}):(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(bV,{strong:!0,style:{display:`block`,marginBottom:8},children:`Provider`}),(0,W.jsx)(P,{style:{width:`100%`},value:e?.provider,onChange:f,placeholder:`Select provider`,children:[...n].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,W.jsx)(P.Option,{value:e.id,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{children:e.name}),(0,W.jsxs)(bV,{type:`secondary`,style:{fontSize:12},children:[`(`,e.models.length,` models)`]})]})},e.id))})]}),u&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(bV,{strong:!0,style:{display:`block`,marginBottom:8},children:`Model`}),(0,W.jsx)(P,{style:{width:`100%`},value:e?.model,onChange:p,placeholder:`Select model`,showSearch:!0,optionFilterProp:`children`,children:[...d].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,W.jsx)(P.Option,{value:e.id,children:e.name},e.id))})]}),(0,W.jsxs)(bV,{type:`secondary`,style:{fontSize:12},children:[(0,W.jsx)(he,{}),` Models available based on your OpenCode configuration`]})]})},SV=Object.entries(Ft).map(([e,t])=>({id:e,label:t.name,description:t.description})),CV=Object.entries(Ht).map(([e,t])=>({id:e,label:t.name,description:t.description})),wV=Object.entries(Gt).map(([e,t])=>({id:e,label:t.name,description:t.description})),TV=[{id:Cn,label:_n[Cn].displayName,description:_n[Cn].description}];function EV(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?e:[e[n],...e.slice(0,n),...e.slice(n+1)]}var DV=({value:e,onChange:t,agent:n,agentic_tool:r,client:i,compact:a=!1})=>{let{token:s}=ce.useToken(),c=r||n||`claude-code`,[l,u]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(null),[S,C]=(0,U.useState)(xn),[w,T]=(0,U.useState)(Cn);(0,U.useEffect)(()=>{if(c!==`claude-code`&&c!==`claude-code-cli`||!i)return;let e=!1;return(async()=>{try{let t=await i.service(`claude-models`).find();if(e||!t?.models?.length)return;u(t.models.map(e=>({id:e.id,label:e.displayName,description:e.description}))),p(t.source)}catch{}})(),()=>{e=!0}},[c,i]),(0,U.useEffect)(()=>{if(c!==`copilot`||!i)return;let e=!1;return(async()=>{try{let t=await i.service(`copilot-models`).find();if(e||!t?.models?.length)return;let n=t.default||`claude-sonnet-4.6`;h(EV(vV(t.models.map(e=>({id:e.id,label:e.displayName,description:e.description})),n,e=>({id:e,label:e,description:`Default model`})),n)),C(n),_(t.source)}catch{}})(),()=>{e=!0}},[c,i]),(0,U.useEffect)(()=>{if(c!==`cursor`||!i)return;let e=!1;return(async()=>{try{let t=await i.service(`cursor-models`).find();if(e||!t?.models?.length)return;let n=t.default||`composer-latest`;y(EV(vV(t.models.map(e=>({id:e.id,label:e.displayName,description:e.description})),n,e=>({id:e,label:e,description:`Default model`})),n)),T(n),x(t.source)}catch{}})(),()=>{e=!0}},[c,i]);let E=c===`codex`?SV:c===`gemini`?CV:c===`opencode`?[]:c===`copilot`?m??wV:c===`cursor`?EV(v??TV,w):l??yn,D=e?.model?E.some(t=>t.id===e.model):!0,[O,k]=(0,U.useState)(e?.mode||(D?`alias`:`exact`));if(c===`opencode`)return(0,W.jsx)(xV,{value:e?.provider||e?.model?{provider:e.provider||``,model:e.model||``}:void 0,onChange:e=>{t&&t({mode:`exact`,model:e.model,provider:e.provider})}});let A=yV(c,E,{copilotDefaultModel:S,cursorDefaultModel:w}),ee=n=>{k(n),t&&t({...e,mode:n,model:e?.model||A})},j=n=>{t&&t({...e,mode:O,model:n})},M=n=>{t&&t({...e,mode:O,model:e?.model||A,advisorModel:n})};if(a){let t=e?.model||A,n=E.map(e=>({value:e.id,label:e.id}));return t&&!n.some(e=>e.value===t)&&n.unshift({value:t,label:t}),(0,W.jsx)(P,{value:t,onChange:j,size:`small`,showSearch:!0,optionFilterProp:`label`,popupMatchSelectWidth:!1,style:{width:`100%`,fontSize:s.fontSizeSM},options:n})}return(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(d.Group,{value:O,onChange:e=>ee(e.target.value),children:(0,W.jsxs)(z,{orientation:`vertical`,children:[(0,W.jsx)(d,{value:`alias`,children:(0,W.jsxs)(z,{children:[`Use model alias (recommended)`,(0,W.jsx)(o,{title:`Automatically uses the latest version of the model`,children:(0,W.jsx)(he,{})})]})}),O===`alias`&&(0,W.jsxs)(`div`,{style:{marginLeft:24,marginTop:8},children:[(0,W.jsx)(P,{showSearch:!0,optionFilterProp:`label`,value:e?.model||A,onChange:j,style:{width:`100%`,minWidth:400},options:E.map(e=>({value:e.id,label:e.id}))}),(c===`claude-code`||c===`claude-code-cli`)&&f&&(0,W.jsx)(`div`,{style:{marginTop:6,fontSize:12,color:s.colorTextTertiary},children:f===`dynamic`?(0,W.jsx)(W.Fragment,{children:`Live list from the Anthropic Models API.`}):(0,W.jsxs)(W.Fragment,{children:[`Showing static fallback. Set `,(0,W.jsx)(`code`,{children:`ANTHROPIC_API_KEY`}),` to see the live model list.`]})}),c===`copilot`&&g&&(0,W.jsx)(`div`,{style:{marginTop:6,fontSize:12,color:s.colorTextTertiary},children:g===`dynamic`?(0,W.jsxs)(W.Fragment,{children:[`Live list from your Copilot account (via SDK `,(0,W.jsx)(`code`,{children:`listModels()`}),`).`]}):(0,W.jsxs)(W.Fragment,{children:[`Showing static fallback. Set `,(0,W.jsx)(`code`,{children:`COPILOT_GITHUB_TOKEN`}),` on the daemon to see your account's live list (including BYOK models).`]})}),c===`cursor`&&b&&(0,W.jsx)(`div`,{style:{marginTop:6,fontSize:12,color:s.colorTextTertiary},children:b===`dynamic`?(0,W.jsxs)(W.Fragment,{children:[`Live list from your Cursor account (via SDK `,(0,W.jsx)(`code`,{children:`Cursor.models.list()`}),`).`]}):(0,W.jsxs)(W.Fragment,{children:[`Showing static fallback. Set `,(0,W.jsx)(`code`,{children:`CURSOR_API_KEY`}),` to see your account's live Cursor model list.`]})})]}),(0,W.jsx)(d,{value:`exact`,children:(0,W.jsxs)(z,{children:[`Specify exact model ID`,(0,W.jsx)(o,{title:`Pin to a specific model release for reproducibility`,children:(0,W.jsx)(he,{})})]})}),O===`exact`&&(0,W.jsxs)(`div`,{style:{marginLeft:24,marginTop:8},children:[(0,W.jsx)(L,{value:e?.model,onChange:e=>j(e.target.value),placeholder:c===`codex`?`e.g., gpt-5.5`:c===`gemini`?`e.g., gemini-2.5-pro`:c===`copilot`?`e.g., gpt-4o or claude-3.5-sonnet`:c===`cursor`?`e.g., composer-latest`:`e.g., claude-opus-4-20250514`,style:{width:`100%`,minWidth:400}}),(0,W.jsxs)(`div`,{style:{marginTop:8,fontSize:12,color:s.colorTextTertiary},children:[`Enter any model ID to pin to a specific version.`,` `,(0,W.jsx)(`a`,{href:c===`codex`?`https://platform.openai.com/docs/models`:c===`gemini`?`https://ai.google.dev/gemini-api/docs/models`:c===`copilot`?`https://github.com/features/copilot`:c===`cursor`?`https://cursor.com/docs/api/sdk/typescript`:`https://platform.claude.com/docs/en/about-claude/models`,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),style:{fontSize:12,color:`#1677ff`},children:`View available models`})]})]})]})}),(c===`claude-code`||c===`claude-code-cli`)&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(`span`,{children:`Advisor model`}),(0,W.jsx)(o,{title:`Optional Claude Code advisor tool model. Leave unset to use existing Claude settings or disable session-level override.`,children:(0,W.jsx)(he,{})})]}),(0,W.jsx)(P,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`Not set`,value:e?.advisorModel,onChange:M,style:{width:`100%`,minWidth:400,marginTop:8},options:(l??yn).map(e=>({value:e.id,label:e.id}))})]})]})},OV=[{mode:`default`,label:`default`,description:`Prompt for each tool use (most restrictive)`,icon:(0,W.jsx)(c,{}),color:`#f5222d`},{mode:`acceptEdits`,label:`acceptEdits`,description:`Auto-accept file edits, ask for other tools (recommended)`,icon:(0,W.jsx)(ne,{}),color:`#52c41a`},{mode:`auto`,label:`auto`,description:`Model classifier approves/denies prompts, asks only when unsure`,icon:(0,W.jsx)(pt,{}),color:`#13c2c2`},{mode:`bypassPermissions`,label:`bypassPermissions`,description:`Allow all operations without prompting`,icon:(0,W.jsx)(ot,{}),color:`#faad14`},{mode:`plan`,label:`plan`,description:`Generate plan without executing`,icon:(0,W.jsx)(ct,{}),color:`#1890ff`}],kV=[{mode:`ask`,label:`untrusted`,description:`Only run trusted commands (ls, cat, sed) without approval`,icon:(0,W.jsx)(c,{}),color:`#f5222d`},{mode:`auto`,label:`on-request`,description:`Model decides when to ask for approval`,icon:(0,W.jsx)(pt,{}),color:`#52c41a`},{mode:`on-failure`,label:`on-failure`,description:`Run all commands, ask only when they fail`,icon:(0,W.jsx)(ne,{}),color:`#faad14`},{mode:`allow-all`,label:`never`,description:`Never ask for approval, failures returned to model`,icon:(0,W.jsx)(ot,{}),color:`#722ed1`}],AV=[{mode:`default`,label:`default`,description:`Prompt for each tool use (most restrictive)`,icon:(0,W.jsx)(c,{}),color:`#f5222d`},{mode:`autoEdit`,label:`autoEdit`,description:`Auto-approve file edits, ask for shell/web tools`,icon:(0,W.jsx)(ne,{}),color:`#52c41a`},{mode:`yolo`,label:`yolo`,description:`Allow all operations without prompting`,icon:(0,W.jsx)(ot,{}),color:`#faad14`}],jV=[{mode:`default`,label:`default`,description:`Proxy all permission requests to Agor UI for approval`,icon:(0,W.jsx)(c,{}),color:`#f5222d`},{mode:`acceptEdits`,label:`acceptEdits`,description:`Auto-approve read/write operations, ask for shell/MCP (recommended)`,icon:(0,W.jsx)(ne,{}),color:`#52c41a`},{mode:`bypassPermissions`,label:`bypassPermissions`,description:`Auto-approve all operations without prompting`,icon:(0,W.jsx)(ot,{}),color:`#faad14`}],MV=[{mode:`bypassPermissions`,label:`Autonomous`,description:`Cursor SDK runs autonomously; Agor cannot intercept permission requests yet`,icon:(0,W.jsx)(ot,{}),color:`#faad14`}],NV=[{mode:`default`,label:`default`,description:`Prompt for approval before each operation`,icon:(0,W.jsx)(c,{}),color:`#f5222d`},{mode:`autoEdit`,label:`autoEdit`,description:`Auto-approve all operations (recommended)`,icon:(0,W.jsx)(ne,{}),color:`#52c41a`},{mode:`yolo`,label:`yolo`,description:`Fully bypass all permission checks`,icon:(0,W.jsx)(ot,{}),color:`#faad14`}],PV=[{value:`read-only`,label:`read-only`,description:`No filesystem writes`},{value:`workspace-write`,label:`workspace-write`,description:`Workspace files only (blocks .git/)`},{value:`danger-full-access`,label:`full-access`,description:`Full filesystem (including .git/)`}],FV=[{value:`untrusted`,label:`untrusted`,description:`Ask for every operation`},{value:`on-request`,label:`on-request`,description:`Model decides when to ask`},{value:`on-failure`,label:`on-failure`,description:`Ask only on failures`},{value:`never`,label:`never`,description:`Auto-approve everything`}],IV=e=>{switch(e){case`codex`:return kV;case`gemini`:return AV;case`opencode`:return NV;case`copilot`:return jV;case`cursor`:return MV;default:return OV}},LV=({value:e,onChange:t,agentic_tool:n=`claude-code`,compact:r=!1,iconOnly:i=!1,plain:a=!1,fullWidth:c=!1,size:l=`middle`,codexSandboxMode:u,codexApprovalPolicy:f,onCodexChange:p})=>{let{token:m}=ce.useToken(),h=IV(n),g=n===`cursor`?`bypassPermissions`:e||Vt(n),_=Et(g),v=u??_.sandboxMode,y=f??_.approvalPolicy;if(r){if(n===`codex`&&p)return(0,W.jsxs)(z,{size:4,direction:c?`vertical`:`horizontal`,style:{width:`100%`},children:[(0,W.jsx)(P,{value:v,onChange:e=>p(e,y),size:l,placeholder:`Sandbox`,popupMatchSelectWidth:!1,style:{minWidth:70,width:c?`100%`:void 0,fontSize:m.fontSizeSM},optionLabelProp:`label`,options:PV.map(({value:e,label:t,description:n})=>({label:t,value:e,title:n})),optionRender:e=>(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:e.label}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:11},children:e.data.title})]})}),(0,W.jsx)(P,{value:y,onChange:e=>p(v,e),size:l,placeholder:`Approval`,popupMatchSelectWidth:!1,style:{minWidth:70,width:c?`100%`:void 0,fontSize:m.fontSizeSM},optionLabelProp:`label`,options:FV.map(({value:e,label:t,description:n})=>({label:t,value:e,title:n})),optionRender:e=>(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:e.label}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:11},children:e.data.title})]})})]});let e=h.find(e=>e.mode===g);return(0,W.jsx)(o,{title:e?`${e.label} — ${e.description}`:`Permission mode`,children:(0,W.jsx)(P,{value:g,onChange:t,style:{fontSize:m.fontSizeSM,width:c?`100%`:void 0},size:l,popupMatchSelectWidth:!1,optionLabelProp:`label`,options:h.map(({mode:e,label:t,description:n,icon:r,color:o})=>({label:a?t:i?(0,W.jsx)(`span`,{style:{color:o,fontSize:m.fontSizeSM},children:r}):(0,W.jsxs)(z,{size:4,style:{fontSize:m.fontSizeSM},children:[(0,W.jsx)(`span`,{style:{color:o},children:r}),(0,W.jsx)(`span`,{children:t})]}),value:e,title:n,icon:r,color:o})),optionRender:e=>{let t=h.find(t=>t.mode===e.value);return(0,W.jsxs)(z,{size:6,align:`start`,children:[t&&(0,W.jsx)(`span`,{style:{color:t.color},children:t.icon}),(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:t?.label}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:11},children:t?.description})]})]})}})})}return(0,W.jsx)(d.Group,{value:g,onChange:e=>t?.(e.target.value),children:(0,W.jsx)(z,{orientation:`vertical`,style:{width:`100%`},children:h.map(({mode:e,label:t,description:n,icon:r,color:i})=>(0,W.jsx)(d,{value:e,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{style:{color:i},children:r}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(s.Text,{strong:!0,children:t}),(0,W.jsx)(`br`,{}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:n})]})]})},e))})})},RV={codex:`Codex Model`,gemini:`Gemini Model`,opencode:`OpenCode LLM Provider`,copilot:`Copilot Model`,cursor:`Cursor Model`},zV=({agenticTool:e,mcpServerById:t,showHelpText:n=!0,compact:r=!1,hideMcpServers:i=!1,client:a})=>{let o=RV[e]??`Claude Model`,s=e===`codex`&&!r;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{name:`modelConfig`,label:o,help:n&&e===`claude-code`?`Choose which Claude model to use (defaults to ${Lt})`:void 0,children:(0,W.jsx)(DV,{agentic_tool:e,client:a})}),(0,W.jsx)(B.Item,{name:`permissionMode`,label:`Permission Mode`,help:n?`Control how the agent handles tool execution approvals`:void 0,children:(0,W.jsx)(LV,{agentic_tool:e,compact:r})}),(e===`claude-code`||e===`claude-code-cli`)&&(0,W.jsx)(B.Item,{name:`effort`,label:`Reasoning Effort`,help:n?`Control how much reasoning Claude applies (low = fast, high = thorough, max = Opus only)`:void 0,children:(0,W.jsx)(_V,{})}),s&&(0,W.jsx)(B.Item,{name:`codexSandboxMode`,label:`Sandbox Mode`,help:n?`Controls where Codex can write files (workspace vs. full access)`:void 0,children:(0,W.jsx)(P,{placeholder:`Select sandbox mode`,options:PV.map(({value:e,label:t,description:n})=>({value:e,label:`${t} · ${n}`}))})}),s&&(0,W.jsx)(B.Item,{name:`codexApprovalPolicy`,label:`Approval Policy`,help:n?`Controls whether Codex must ask before executing commands`:void 0,children:(0,W.jsx)(P,{placeholder:`Select approval policy`,options:FV.map(({value:e,label:t,description:n})=>({value:e,label:`${t} · ${n}`}))})}),s&&(0,W.jsx)(B.Item,{name:`codexNetworkAccess`,label:`Network Access`,help:n?`Allow outbound HTTP/HTTPS requests (workspace-write sandbox only)`:void 0,valuePropName:`checked`,children:(0,W.jsx)(hV,{showWarning:n})}),!i&&(0,W.jsx)(hB,{mcpServerById:t,showHelpText:n})]})};function BV(e,t){return t?{modelConfig:t.modelConfig,effort:t.modelConfig?.effort,permissionMode:t.permissionMode||Vt(e),mcpServerIds:t.mcpServerIds||[],...e===`codex`&&{codexSandboxMode:t.codexSandboxMode,codexApprovalPolicy:t.codexApprovalPolicy,codexNetworkAccess:t.codexNetworkAccess}}:{permissionMode:Vt(e),mcpServerIds:[]}}function VV(e,t){return{modelConfig:t.modelConfig?{...t.modelConfig,effort:t.effort}:t.effort?{effort:t.effort}:void 0,permissionMode:t.permissionMode,mcpServerIds:t.mcpServerIds,...e===`codex`&&{codexSandboxMode:t.codexSandboxMode,codexApprovalPolicy:t.codexApprovalPolicy,codexNetworkAccess:t.codexNetworkAccess}}}function HV(e){if(e)return{modelConfig:e.model_config,permissionMode:e.permission_mode,mcpServerIds:e.mcp_server_ids,...e.agentic_tool===`codex`&&{codexSandboxMode:e.codex_sandbox_mode,codexApprovalPolicy:e.codex_approval_policy,codexNetworkAccess:e.codex_network_access}}}function UV(e,t,n){let r=VV(e,t);return{...n,agentic_tool:e,permission_mode:r.permissionMode,model_config:r.modelConfig,mcp_server_ids:r.mcpServerIds,context_files:n?.context_files,codex_sandbox_mode:e===`codex`?r.codexSandboxMode:void 0,codex_approval_policy:e===`codex`?r.codexApprovalPolicy:void 0,codex_network_access:e===`codex`?r.codexNetworkAccess:void 0}}function WV(e){return{modelConfig:void 0,effort:void 0,permissionMode:Vt(e),mcpServerIds:[],...e===`codex`&&{codexSandboxMode:void 0,codexApprovalPolicy:void 0,codexNetworkAccess:void 0}}}var{TextArea:GV}=L,{Text:KV}=s,qV=[`America/Los_Angeles`,`America/Denver`,`America/Chicago`,`America/New_York`,`America/Sao_Paulo`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`Asia/Dubai`,`Asia/Kolkata`,`Asia/Shanghai`,`Asia/Tokyo`,`Australia/Sydney`,`Pacific/Auckland`];function JV(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}var YV=`0 * * * *`,XV=({open:e,onClose:t,branchId:n,branchName:r,schedule:i,mcpServerById:a,client:o,onSaved:c})=>{let l=!!i?.schedule_id,{showError:u,showSuccess:f}=mn(),[p]=B.useForm(),[m,h]=(0,U.useState)(i?.agentic_tool_config?.agentic_tool??`claude-code`),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(!1);(0,U.useEffect)(()=>{if(!e)return;let t=i?.agentic_tool_config?.agentic_tool??`claude-code`,n=BV(t,HV(i?.agentic_tool_config));h(t),_(!1),p.resetFields(),p.setFieldsValue({name:i?.name??``,description:i?.description??``,prompt:i?.prompt??``,cron_expression:i?.cron_expression??YV,timezone_mode:i?.timezone_mode??`local`,timezone:i?.timezone??JV(),agenticTool:t,enabled:i?.enabled??!0,retention:i?.retention??5,allow_concurrent_runs:i?.allow_concurrent_runs??!1,...n})},[e,i,p]);let b=e=>{if(e===m)return;h(e);let t=BV(e);p.setFieldsValue({...t,agenticTool:e,...e!==`codex`&&{codexSandboxMode:void 0,codexApprovalPolicy:void 0,codexNetworkAccess:void 0}})},x=B.useWatch(`cron_expression`,p)??YV,S=B.useWatch(`timezone_mode`,p)??`local`,C=(0,U.useMemo)(()=>{try{return Ot(x)}catch{return null}},[x]);return(0,W.jsx)(it,{title:l?`Edit schedule — ${i?.name}`:`New schedule for ${r}`,open:e,onCancel:t,width:760,destroyOnClose:!0,footer:[(0,W.jsx)(V,{onClick:t,disabled:v,children:`Cancel`},`cancel`),(0,W.jsx)(V,{type:`primary`,loading:v,onClick:async()=>{if(!o){u(`Not connected to daemon`);return}let e;try{e=await p.validateFields()}catch{return}if(e.timezone_mode===`local`&&!e.timezone){u(`Timezone is required when mode is 'local'`);return}let r={...p.getFieldsValue(!0),...e};y(!0);try{let e={branch_id:n,name:(r.name??``).trim(),description:r.description?.trim()||void 0,prompt:(r.prompt??``).trim(),cron_expression:r.cron_expression??YV,timezone_mode:r.timezone_mode??`local`,timezone:r.timezone_mode===`local`?r.timezone:void 0,agentic_tool_config:UV(m,{modelConfig:r.modelConfig,effort:r.effort,permissionMode:r.permissionMode,mcpServerIds:r.mcpServerIds,codexSandboxMode:r.codexSandboxMode,codexApprovalPolicy:r.codexApprovalPolicy,codexNetworkAccess:r.codexNetworkAccess},i?.agentic_tool_config),enabled:r.enabled??!0,retention:r.retention??5,allow_concurrent_runs:r.allow_concurrent_runs??!1},a;a=l&&i?.schedule_id?await o.service(`schedules`).patch(i.schedule_id,e):await o.service(`schedules`).create(e),f(l?`Schedule updated`:`Schedule created`),c?.(a),t()}catch(e){u(e instanceof Error?e.message:`Failed to save schedule`)}finally{y(!1)}},children:l?`Save`:`Create`},`save`)],children:(0,W.jsxs)(B,{form:p,layout:`vertical`,preserve:!1,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{name:`enabled`,label:`Enabled`,valuePropName:`checked`,children:(0,W.jsx)(ye,{})}),(0,W.jsx)(B.Item,{name:`name`,label:`Name`,rules:[{required:!0,message:`Name is required`}],children:(0,W.jsx)(L,{placeholder:`Hourly heartbeat`})}),(0,W.jsx)(B.Item,{name:`description`,label:`Description (optional)`,children:(0,W.jsx)(L,{placeholder:`What this schedule does`})}),(0,W.jsx)(B.Item,{name:`prompt`,label:`Prompt template`,rules:[{required:!0,message:`Prompt is required`}],help:(0,W.jsxs)(KV,{type:`secondary`,style:{fontSize:12},children:[`Handlebars: `,(0,W.jsx)(`code`,{children:`{{branch.*}}`}),` `,(0,W.jsx)(`code`,{children:`{{schedule.*}}`})]}),children:(0,W.jsx)(GV,{placeholder:`Review the current state of {{branch.name}} and post a status update.`,rows:6})}),(0,W.jsx)(B.Item,{name:`cron_expression`,label:`Cron expression`,rules:[{required:!0,message:`Cron is required`}],extra:(0,W.jsxs)(W.Fragment,{children:[C&&(0,W.jsxs)(KV,{type:`secondary`,style:{fontSize:12},children:[`ⓘ `,C]}),g&&(0,W.jsx)(`div`,{style:{marginTop:12},children:(0,W.jsx)(mV,{value:x,setValue:e=>p.setFieldValue(`cron_expression`,e),clearButton:!1})})]}),children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L,{value:x,onChange:e=>p.setFieldValue(`cron_expression`,e.target.value),placeholder:`0 * * * *`}),(0,W.jsx)(V,{onClick:()=>_(e=>!e),children:g?`Hide picker`:`Edit visually`})]})}),(0,W.jsx)(B.Item,{name:`timezone_mode`,label:`Timezone mode`,children:(0,W.jsxs)(d.Group,{children:[(0,W.jsx)(d,{value:`local`,children:`Local time`}),(0,W.jsx)(d,{value:`utc`,children:`UTC`})]})}),S===`local`&&(0,W.jsx)(B.Item,{name:`timezone`,label:`Timezone`,rules:[{required:!0,message:`Timezone is required in local mode`}],children:(0,W.jsx)(Ue,{options:qV.map(e=>({value:e,label:e})),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase()),placeholder:`Type or pick an IANA zone (e.g. America/Los_Angeles, Asia/Bangkok)`})}),(0,W.jsx)(B.Item,{label:`Agentic tool`,children:(0,W.jsx)(mr,{agents:gr,selectedAgentId:m,onSelect:e=>b(e),variant:`select`})}),(0,W.jsx)(hB,{mcpServerById:a}),(0,W.jsx)(ue,{ghost:!0,destroyOnHidden:!1,expandIcon:({isActive:e})=>(0,W.jsx)(se,{rotate:e?180:0}),items:[{key:`agentic-tool-config`,label:(0,W.jsx)(s.Text,{strong:!0,children:`Agentic Tool Configuration`}),children:(0,W.jsx)(zV,{agenticTool:m,mcpServerById:a,hideMcpServers:!0,client:o})},{key:`schedule-settings`,label:(0,W.jsx)(s.Text,{strong:!0,children:`Schedule Settings`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{name:`retention`,label:`Retention (sessions to keep; 0 = keep all)`,children:(0,W.jsx)(tt,{min:0})}),(0,W.jsx)(B.Item,{name:`allow_concurrent_runs`,label:`Concurrency`,children:(0,W.jsxs)(d.Group,{children:[(0,W.jsx)(d,{value:!1,children:`Block (default)`}),(0,W.jsx)(d,{value:!0,children:`Allow concurrent runs`})]})})]})}],style:{marginTop:16}}),!l&&(0,W.jsx)(I,{style:{marginTop:16},type:`info`,showIcon:!0,message:`Catchup is disabled by default.`,description:`If the daemon is down when a fire is due, only the most recent missed run within the 2-minute grace window will fire. No backfill.`})]})})},ZV=20,QV=e=>{switch(e){case`completed`:return`green`;case`failed`:case`timed_out`:return`red`;case`running`:case`stopping`:case`awaiting_permission`:case`awaiting_input`:return`blue`;default:return`default`}},$V=e=>e?new Date(e).toLocaleString():`—`,eH=e=>{let t=e.scheduled_run_at,n=e.last_updated?Date.parse(e.last_updated):null;if(!t||!n||n<=t)return`—`;let r=Math.round((n-t)/1e3);return r<60?`${r}s`:`${Math.floor(r/60)}m ${r%60}s`},tH=({open:e,onClose:t,schedule:n,client:r,onOpenSession:i})=>{let[a,o]=(0,U.useState)([]),[s,c]=(0,U.useState)(!1),l=(0,U.useCallback)(async()=>{if(!(!r||!n?.schedule_id)){c(!0);try{let e=await r.service(`sessions`).find({query:{schedule_id:n.schedule_id,$sort:{scheduled_run_at:-1},$limit:ZV}});o(Array.isArray(e)?e:e.data)}catch(e){console.error(`Failed to load schedule runs:`,e)}finally{c(!1)}}},[r,n?.schedule_id]);return(0,U.useEffect)(()=>{e&&l()},[e,l]),(0,W.jsx)(st,{title:n?`Runs — ${n.name}`:`Runs`,open:e,onClose:t,width:640,destroyOnClose:!0,children:s?(0,W.jsx)(Ee,{}):a.length===0?(0,W.jsx)(E,{description:`No runs yet.`}):(0,W.jsx)(D,{rowKey:`session_id`,dataSource:a,columns:[{title:`Scheduled`,key:`scheduled_run_at`,render:e=>$V(e.scheduled_run_at)},{title:`Status`,key:`status`,render:e=>(0,W.jsx)(v,{color:QV(e.status),children:e.status})},{title:`Duration`,key:`duration`,render:e=>eH(e)},{title:``,key:`open`,render:e=>i?(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>i(e.session_id),children:`Open`}):null}],pagination:!1,size:`small`})})},{Text:nH}=s,rH=e=>e?new Date(e).toLocaleString():`—`,iH=e=>{try{return Ot(e)}catch{return e}},aH=({branch:e,client:t,mcpServerById:n=new Map,currentUser:r,userById:i=new Map,onOpenSession:o})=>{let{showError:s,showSuccess:c}=mn(),[l,u]=(0,U.useState)([]),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),x=(0,U.useCallback)(async()=>{if(t){f(!0);try{let n=await t.service(`schedules`).find({query:{branch_id:e.branch_id,$sort:{created_at:-1}}});u(Array.isArray(n)?n:n.data)}catch(e){console.error(`Failed to load schedules:`,e),s(`Failed to load schedules`)}finally{f(!1)}}},[t,e.branch_id,s]);(0,U.useEffect)(()=>{x()},[x]),(0,U.useEffect)(()=>{if(!t)return;let n=t.service(`schedules`),r=t=>t.branch_id===e.branch_id,i=e=>{r(e)&&u(t=>[e,...t])},a=e=>{r(e)&&u(t=>t.map(t=>t.schedule_id===e.schedule_id?e:t))},o=e=>{u(t=>t.filter(t=>t.schedule_id!==e.schedule_id))};return n.on(`created`,i),n.on(`patched`,a),n.on(`removed`,o),()=>{n.off(`created`,i),n.off(`patched`,a),n.off(`removed`,o)}},[t,e.branch_id]);let S=()=>{g(null),m(!0)},C=e=>{g(e),m(!0)},w=async e=>{if(t)try{await t.service(`schedules`).remove(e.schedule_id),c(`Schedule "${e.name}" deleted`)}catch(e){s(e instanceof Error?e.message:`Failed to delete schedule`)}},T=async e=>{if(t){b(e.schedule_id);try{await t.service(`schedules/${e.schedule_id}/run-now`).create({}),c(`Triggered "${e.name}"`)}catch(e){s(e instanceof Error?e.message:`Failed to trigger run`)}finally{b(null)}}},O=async(e,n)=>{if(t)try{await t.service(`schedules`).patch(e.schedule_id,{enabled:n})}catch(e){s(e instanceof Error?e.message:`Failed to update schedule`)}};return(0,W.jsxs)(`div`,{style:{padding:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:12},children:[(0,W.jsxs)(nH,{strong:!0,children:[`Schedules for `,e.name]}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:S,children:`New`})]}),d?(0,W.jsx)(Ee,{}):l.length===0?(0,W.jsx)(E,{description:(0,W.jsx)(`span`,{children:`No schedules yet. Schedule a prompt to fire on a cadence — hourly heartbeats, daily summaries, weekly retros.`}),children:(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:S,children:`New schedule`})}):(0,W.jsx)(D,{rowKey:`schedule_id`,dataSource:l,columns:[{title:`On`,key:`enabled`,width:60,render:e=>(0,W.jsx)(ye,{checked:e.enabled,onChange:t=>O(e,t),size:`small`})},{title:`Name`,key:`name`,render:e=>(0,W.jsx)(V,{type:`link`,onClick:()=>v(e),style:{padding:0},children:e.name})},{title:`When`,key:`cron`,render:e=>(0,W.jsx)(nH,{children:iH(e.cron_expression)})},{title:`Scheduled by / run as`,key:`created_by`,render:e=>{let t=i.get(e.created_by);return t?(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(Nc,{user:t,showName:!0,size:`small`}),r?.user_id===e.created_by&&(0,W.jsx)(nH,{type:`secondary`,children:`(you)`})]}):(0,W.jsx)(nH,{type:`secondary`,children:e.created_by?nn(e.created_by):`—`})}},{title:`Last run`,key:`last_run_at`,render:e=>e.last_run_session_id&&o?(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>o(e.last_run_session_id),children:rH(e.last_run_at)}):rH(e.last_run_at)},{title:`Actions`,key:`actions`,width:160,render:e=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(a,{}),loading:y===e.schedule_id,disabled:y===e.schedule_id,onClick:()=>T(e),title:`Run now`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)($e,{}),onClick:()=>v(e),title:`View runs`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>C(e),title:`Edit`}),(0,W.jsx)(ee,{title:`Delete schedule?`,description:`Are you sure you want to delete "${e.name}"?`,onConfirm:()=>w(e),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0,title:`Delete`})})]})}],pagination:!1,size:`small`}),(0,W.jsx)(XV,{open:p,onClose:()=>m(!1),branchId:e.branch_id,branchName:e.name,schedule:h,mcpServerById:n,client:t,onSaved:()=>x()}),(0,W.jsx)(tH,{open:_!==null,onClose:()=>v(null),schedule:_,client:t,onOpenSession:o})]})};function oH(e){switch(e){case`running`:case`awaiting_input`:return`processing`;case`stopping`:case`awaiting_permission`:case`timed_out`:return`warning`;case`failed`:return`error`;case`completed`:return`success`;default:return`default`}}var sH=({status:e,size:t=16})=>{let{token:n}=ce.useToken(),r={fontSize:t},i=t<=14?`small`:t>=24?`large`:`default`;switch(e){case Bt.COMPLETED:case`completed`:return(0,W.jsx)(Re,{style:{...r,color:n.colorSuccess}});case Bt.RUNNING:case`running`:return(0,W.jsx)(Ee,{size:i});case Bt.STOPPING:case`stopping`:return(0,W.jsx)(C,{style:{...r,color:n.colorWarning}});case Bt.AWAITING_PERMISSION:case`awaiting_permission`:return(0,W.jsx)(F,{style:{...r,color:n.colorWarning}});case Bt.AWAITING_INPUT:case`awaiting_input`:return(0,W.jsx)(Ze,{style:{...r,color:n.colorPrimary}});case Bt.FAILED:case`failed`:return(0,W.jsx)(Ye,{style:{...r,color:n.colorError}});case Bt.STOPPED:return(0,W.jsx)(_,{style:{...r,color:n.colorWarning}});case Bt.TIMED_OUT:case`timed_out`:return(0,W.jsx)(qe,{style:{...r,color:n.colorWarning}});case`idle`:return(0,W.jsx)(qe,{style:{...r,color:n.colorTextDisabled}});default:return(0,W.jsx)(qe,{style:{...r,color:n.colorTextDisabled}})}},cH=({branch:e,sessions:t,client:n,onSessionClick:r})=>{let{token:a}=ce.useToken(),{showSuccess:c,showError:l}=mn(),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(!1),[m,g]=(0,U.useState)([]),[_,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)([]),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(!1),[E,O]=(0,U.useState)(new Set),k=(0,U.useMemo)(()=>t.filter(e=>!e.archived),[t]),A=(0,U.useRef)(n);A.current=n;let ee=(0,U.useCallback)((e,t)=>{let n=e.findIndex(e=>e.session_id===t.session_id);if(n===-1)return[t,...e];if(e[n]===t)return e;let r=[...e];return r[n]=t,r},[]),j=(0,U.useCallback)(async()=>{let t=A.current;if(t){y(!0);try{g(await t.service(`sessions`).findAll({query:{branch_id:e.branch_id,archived:!1,$limit:1e3,$sort:{created_at:-1}}}))}catch{}finally{y(!1)}}},[e.branch_id]),M=(0,U.useCallback)(async()=>{let t=A.current;if(t){T(!0);try{x(await t.service(`sessions`).findAll({query:{branch_id:e.branch_id,archived:!0,$limit:1e3,$sort:{created_at:-1}}})),C(!0)}catch{}finally{T(!1)}}},[e.branch_id]);(0,U.useEffect)(()=>{g(k),y(!1),p(e.archived),x([]),C(!1),T(!1),j()},[k,j,e.archived]),(0,U.useEffect)(()=>{f&&!S&&!w&&M()},[f,S,w,M]),(0,U.useEffect)(()=>{if(!n)return;let t=n.service(`sessions`),r=t=>{t.branch_id===e.branch_id&&(t.archived?x(e=>ee(e,t)):g(e=>ee(e,t)))},i=t=>{t.branch_id===e.branch_id&&(g(e=>e.filter(e=>e.session_id!==t.session_id)),x(e=>e.filter(e=>e.session_id!==t.session_id)),t.archived?x(e=>ee(e,t)):g(e=>ee(e,t)))},a=t=>{t.branch_id===e.branch_id&&(g(e=>e.filter(e=>e.session_id!==t.session_id)),x(e=>e.filter(e=>e.session_id!==t.session_id)))};return t.on(`created`,r),t.on(`patched`,i),t.on(`updated`,i),t.on(`removed`,a),()=>{t.removeListener(`created`,r),t.removeListener(`patched`,i),t.removeListener(`updated`,i),t.removeListener(`removed`,a)}},[n,ee,e.branch_id]);let N=(0,U.useCallback)(async(e,t)=>{let n=A.current;if(n){O(t=>new Set(t).add(e));try{if(await n.service(`sessions`).patch(e,{archived:t,archived_reason:t?`manual`:void 0}),t){let t=m.find(t=>t.session_id===e);t?(g(t=>t.filter(t=>t.session_id!==e)),x(n=>n.some(t=>t.session_id===e)?n:[{...t,archived:!0},...n])):f&&M()}else{let t=b.find(t=>t.session_id===e);t&&g(e=>ee(e,{...t,archived:!1})),x(t=>t.filter(t=>t.session_id!==e))}c(t?`Session archived`:`Session unarchived`)}catch(e){l(e instanceof Error?e.message:`Failed to update session`)}finally{O(t=>{let n=new Set(t);return n.delete(e),n})}}},[m,b,M,f,c,l,ee]),te=(0,U.useMemo)(()=>{if(!f)return m;let e=new Set,t=[];for(let n of m)e.add(n.session_id),t.push(n);for(let n of b)e.has(n.session_id)||t.push(n);return t},[m,b,f]),P=(0,U.useMemo)(()=>{let e=te;if(f||(e=e.filter(e=>!e.archived)),u.trim()){let t=u.toLowerCase();e=e.filter(e=>Ac(e,{includeAgentFallback:!0}).toLowerCase().includes(t)||e.session_id.toLowerCase().includes(t)||e.agentic_tool.toLowerCase().includes(t)||e.status.toLowerCase().includes(t))}return[...e].sort((e,t)=>{let n=+(e.status===`running`||e.status===`stopping`),r=+(t.status===`running`||t.status===`stopping`);return n===r?new Date(t.created_at).getTime()-new Date(e.created_at).getTime():r-n})},[te,f,u]),ne=m.length,ie=b.length;return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,W.jsx)(L,{placeholder:`Search sessions...`,prefix:(0,W.jsx)(re,{}),value:u,onChange:e=>d(e.target.value),allowClear:!0,style:{maxWidth:300}}),(0,W.jsxs)(z,{size:12,children:[(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(h,{count:ne,showZero:!0,style:{backgroundColor:a.colorPrimary}}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`active`})]}),ie>0&&(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(h,{count:ie,showZero:!0,style:{backgroundColor:a.colorTextQuaternary}}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`archived`})]}),(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(ye,{size:`small`,checked:f,onChange:p,loading:w||_,checkedChildren:(0,W.jsx)(le,{}),unCheckedChildren:(0,W.jsx)(i,{})}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Show archived`})]})]})]}),(0,W.jsx)(D,{columns:[{title:`Session`,key:`title`,ellipsis:!0,render:(e,t)=>(0,W.jsxs)(z,{size:8,align:`center`,style:{minWidth:0},children:[(0,W.jsx)(dr,{tool:t.agentic_tool,size:18}),(0,W.jsx)(s.Link,{onClick:e=>{e.stopPropagation(),r?.(t.session_id)},style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`block`},children:Ac(t,{includeAgentFallback:!0})}),t.archived&&(0,W.jsx)(v,{color:`default`,style:{fontSize:10,lineHeight:`16px`,padding:`0 4px`},children:`archived`})]})},{title:`Status`,key:`status`,width:130,render:(e,t)=>(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(sH,{status:t.status,size:14}),(0,W.jsx)(v,{color:oH(t.status),style:{margin:0,fontSize:11},children:t.status})]}),filters:[{text:`Idle`,value:`idle`},{text:`Running`,value:`running`},{text:`Completed`,value:`completed`},{text:`Failed`,value:`failed`},{text:`Awaiting Permission`,value:`awaiting_permission`},{text:`Awaiting Input`,value:`awaiting_input`},{text:`Timed Out`,value:`timed_out`}],onFilter:(e,t)=>t.status===e},{title:`Created`,key:`created_at`,width:150,render:(e,t)=>(0,W.jsx)(o,{title:new Date(t.created_at).toLocaleString(),children:(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:lH(t.created_at)})}),sorter:(e,t)=>new Date(e.created_at).getTime()-new Date(t.created_at).getTime()},{title:``,key:`actions`,width:40,render:(e,t)=>(0,W.jsx)(uB,{archived:t.archived,loading:E.has(t.session_id),tooltip:t.archived?`Archived • Click to unarchive`:`Archive session`,onToggle:e=>N(t.session_id,e)})}],dataSource:P,rowKey:`session_id`,size:`small`,pagination:P.length>20?{pageSize:20,showSizeChanger:!1}:!1,locale:{emptyText:f?`No sessions match your search`:te.length>0?`All sessions are archived. Toggle "Show archived" to see them.`:`No sessions yet`},onRow:e=>({style:{cursor:r?`pointer`:void 0,opacity:e.archived?.6:1},onClick:()=>r?.(e.session_id)})})]})})};function lH(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;let o=Math.floor(a/30);return o<12?`${o}mo ago`:`${Math.floor(a/365)}y ago`}var uH=(0,U.memo)(cH,(e,t)=>{let n=e.client===null!=(t.client===null);return e.branch.branch_id===t.branch.branch_id&&e.sessions===t.sessions&&!n}),dH=e=>({boardId:e?.board_id||void 0,issueUrl:e?.issue_url||``,prUrl:e?.pull_request_url||``,notes:e?.notes||``,mcpServerIds:e?.mcp_server_ids||[]}),fH=e=>{let t=e?Xt(e):null;return{displayName:t?.displayName||``,emoji:t?.emoji||``,description:e?.notes||``}},pH=(e,t)=>({permissionSource:e?.permission_source||`override`,selectedOwnerIds:t.length>0?t.map(e=>e.user_id):e?.created_by?[e.created_by]:[],othersCan:e?.others_can||`session`,othersFsAccess:e?.others_fs_access||`read`,allowSessionSharing:!!e?.dangerously_allow_session_sharing,groupGrants:[]}),mH=e=>JSON.stringify([...e].sort());function hH({branch:e,client:t,currentUser:n,open:r}){let[i,a]=(0,U.useState)([]),[o,s]=(0,U.useState)([]),[c,l]=(0,U.useState)([]),[u,d]=(0,U.useState)(!0),[f,p]=(0,U.useState)(!0),[m,h]=(0,U.useState)(`loading`),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(null),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(()=>dH(e)),[E,D]=(0,U.useState)(()=>fH(e)),[O,k]=(0,U.useState)(()=>pH(e,[])),A=(0,U.useRef)(null),ee=(0,U.useRef)(!1),j=(0,U.useRef)(!1),M=(0,U.useRef)(!1),N=(0,U.useCallback)((e,t)=>{ee.current=!0,T(n=>({...n,[e]:t}))},[]),te=(0,U.useCallback)((e,t)=>{j.current=!0,D(n=>({...n,[e]:t}))},[]),P=(0,U.useCallback)((e,t)=>{M.current=!0,k(n=>({...n,[e]:t}))},[]);(0,U.useEffect)(()=>{if(!r||!e){A.current=null,ee.current=!1,j.current=!1,M.current=!1;return}if(A.current!==e.branch_id){A.current=e.branch_id,ee.current=!1,j.current=!1,M.current=!1,T(dH(e)),D(fH(e)),k(pH(e,[])),a([]),s([]),l([]),d(!0),h(`loading`),_(null),p(!0);return}ee.current||T(dH(e)),j.current||D(fH(e)),M.current||k(t=>({...t,othersCan:e.others_can||`session`,othersFsAccess:e.others_fs_access||`read`,allowSessionSharing:!!e.dangerously_allow_session_sharing}))},[r,e]),(0,U.useEffect)(()=>{if(!r||!t||!e)return;let n=e.branch_id,i=!1;return(async()=>{try{p(!0),x(null),h(`loading`),_(null),y(null);let r=t.service(`branches/:id/effective-access`).find({route:{id:n}}).catch(e=>(console.warn(`Failed to load effective branch access:`,e),null)),o=await t.service(`branches/:id/owners`).find({route:{id:n}});if(i)return;let c=await r;if(i)return;y(c);let u=o;if(a(u),d(!0),!M.current){let t=u.length>0?u.map(e=>e.user_id):e.created_by?[e.created_by]:[];k(e=>({...e,selectedOwnerIds:t}))}try{let e=await t.service(`users`).findAll({});i||s(e)}catch(e){i||console.warn(`Failed to load users for branch permissions:`,e)}i||p(!1);try{let[e,r]=await Promise.all([t.service(`groups`).findAll({query:{archived:!1}}),t.service(`branches/:id/group-grants`).find({route:{id:n}})]);if(i)return;l(e);let a=r.map(e=>({group_id:e.group_id,can:e.can,fs_access:e.fs_access}));h(`loaded`),_(null),M.current||k(e=>({...e,groupGrants:a}))}catch(e){i||(l([]),h(`unavailable`),_(e instanceof Error?e:Error(String(e))),console.warn(`Failed to load branch group permissions:`,e))}}catch(e){if(i)return;if(e?.code===404||e?.message?.includes(`not found`))d(!1),a([]),s([]),l([]),h(`unavailable`),_(e instanceof Error?e:Error(String(e)));else{let t=e instanceof Error?e:Error(String(e));console.error(`Failed to load branch owners:`,t),x(t),l([]),h(`unavailable`),_(t)}}i||p(!1)})(),()=>{i=!0}},[r,t,e]);let ne=e?dn(e):!1,re=(0,U.useMemo)(()=>{if(!e)return!1;let t=!ne&&w.notes!==(e.notes||``);return w.boardId!==(e.board_id||void 0)||w.issueUrl!==(e.issue_url||``)||w.prUrl!==(e.pull_request_url||``)||t||mH(w.mcpServerIds)!==mH(e.mcp_server_ids||[])},[e,w,ne]),ie=(0,U.useMemo)(()=>{if(!e||!ne)return!1;let t=Xt(e);return t?E.displayName.trim()!==t.displayName||E.emoji!==(t.emoji||``)||E.description.trim()!==(e.notes||``):!1},[e,E,ne]),ae=(0,U.useMemo)(()=>{if(!e||!u)return!1;let t=i.map(e=>e.user_id);return O.selectedOwnerIds.length!==t.length||O.selectedOwnerIds.some(e=>!t.includes(e))},[e,u,i,O.selectedOwnerIds]),oe=(0,U.useMemo)(()=>!e||!u?!1:O.othersCan!==(e.others_can||`session`)||O.othersFsAccess!==(e.others_fs_access||`read`)||O.allowSessionSharing!==!!e.dangerously_allow_session_sharing||O.permissionSource!==(e.permission_source||`override`),[e,u,O]),F=!!(e&&u&&m===`loaded`&&M.current),se=ae||oe||F,ce=re||ie||se,le=n?.user_id,ue=St(n?.role,Pt.ADMIN),de=St(n?.role,Pt.SUPERADMIN),fe=i.some(e=>e.user_id===le),pe=e?.created_by===le,me=ue||v?.can===`all`||fe||e?.others_can===`all`||!u&&pe,he=u&&(ue||f||fe),ge=f?de:!u||de||fe,_e=de||!f&&fe,ve=(0,U.useCallback)(()=>{T(dH(e)),D(fH(e)),k(pH(e,i)),ee.current=!1,j.current=!1,M.current=!1},[e,i]);return{general:w,setGeneral:N,generalChanged:re,assistant:E,setAssistant:te,assistantChanged:ie,permissions:O,setPermissions:P,permissionsChanged:se,owners:i,allUsers:o,allGroups:c,groupGrantsStatus:m,groupGrantsError:g,rbacEnabled:u,loadingOwners:f,canViewPermissions:he,ownersLoadError:b,canEditGeneral:ge,canEditPermissions:_e,canControlEnvironment:me,hasChanges:ce,saving:S,save:(0,U.useCallback)(async()=>{if(!e||!t)return{ok:!1,error:Error(`Modal not ready`)};C(!0);try{let n=i.map(e=>e.user_id),r=O.selectedOwnerIds.filter(e=>!n.includes(e)),o=n.filter(e=>!O.selectedOwnerIds.includes(e));if(u&&ae&&O.selectedOwnerIds.length===0)throw Error(`At least one owner is required`);if(u&&O.permissionSource===`override`&&O.othersCan===`none`&&O.selectedOwnerIds.length!==1)throw Error(`Private branches must have exactly one private user`);if(u&&ae&&_e)for(let n of r)await t.service(`branches/:id/owners`).create({user_id:n},{route:{id:e.branch_id}});let s={};if(re&&ge&&(s.board_id=w.boardId||void 0,s.issue_url=w.issueUrl.trim()===``?null:w.issueUrl,s.pull_request_url=w.prUrl.trim()===``?null:w.prUrl,ne||(s.notes=w.notes.trim()===``?null:w.notes),mH(w.mcpServerIds)!==mH(e.mcp_server_ids||[])&&(s.mcp_server_ids=w.mcpServerIds)),ie&&ne&&ge){let t=Xt(e);t&&(s.custom_context={assistant:{...t,kind:`assistant`,displayName:E.displayName.trim(),emoji:E.emoji||void 0}},s.notes=E.description.trim()||null)}if(u&&oe&&_e&&(s.others_can=O.othersCan,s.others_fs_access=O.othersFsAccess,s.dangerously_allow_session_sharing=O.allowSessionSharing,s.permission_source=O.permissionSource),Object.keys(s).length>0&&await t.service(`branches`).patch(e.branch_id,s),u&&_e&&m===`loaded`){let n=await t.service(`branches/:id/group-grants`).find({route:{id:e.branch_id}}),r=O.groupGrants,i=new Set(r.map(e=>e.group_id));for(let i of r){let r=n.find(e=>e.group_id===i.group_id);(!r||r.can!==i.can||(r.fs_access||void 0)!==(i.fs_access||void 0))&&await t.service(`branches/:id/group-grants`).create({group_id:i.group_id,can:i.can,fs_access:i.fs_access},{route:{id:e.branch_id}})}for(let r of n)i.has(r.group_id)||await t.service(`branches/:id/group-grants`).remove(r.group_id,{route:{id:e.branch_id}})}if(u&&ae&&_e)for(let n of o)await t.service(`branches/:id/owners`).remove(n,{route:{id:e.branch_id}});if(ie&&ne&&ge&&e.board_id){let n=Xt(e);if(n&&E.emoji!==(n.emoji||``))try{await t.service(`boards`).patch(e.board_id,{icon:E.emoji||`🤖`})}catch(e){console.error(`Failed to update board icon:`,e)}}if(u&&se)try{let n=await t.service(`branches/:id/owners`).find({route:{id:e.branch_id}});a(n),k(e=>({...e,selectedOwnerIds:n.map(e=>e.user_id)}))}catch(e){console.error(`Failed to reload owners after save:`,e)}return ee.current=!1,j.current=!1,M.current=!1,{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e:Error(String(e))}}finally{C(!1)}},[e,t,u,ae,oe,se,_e,m,i,O,re,ge,w,ne,ie,E]),reset:ve}}var gH=({open:e,onClose:t,branch:n,repo:r,sessions:i,boardById:a=new Map,boardObjects:o=[],mcpServerById:s=new Map,client:c,currentUser:l,onUpdateBranch:u,onUpdateRepo:d,onArchiveOrDelete:f,onOpenSettings:p,onSessionClick:m,onExecuteScheduleNow:g,defaultTab:_})=>{let{token:v}=ce.useToken(),{showSuccess:y,showError:b}=mn(),[x,S]=(0,U.useState)(`general`),C=hH({branch:n,client:c,currentUser:l,open:e}),w=(0,U.useMemo)(()=>new Map(C.allUsers.map(e=>[e.user_id,e])),[C.allUsers]),T=a.get(C.general.boardId||n?.board_id||``);(0,U.useEffect)(()=>{e&&S(_||`general`)},[e,_]),(0,U.useEffect)(()=>{C.ownersLoadError&&b(`Failed to load branch permissions: ${C.ownersLoadError.message}`)},[C.ownersLoadError,b]);let E=n?dn(n):!1,D=(0,U.useMemo)(()=>n?Xt(n):null,[n]);if(!n||!r)return null;let O=E?`Assistant: ${D?.displayName??n.name}`:`Branch: ${n.name}`,k=async()=>{let e=await C.save();e.ok?(y(E?`Assistant updated`:`Branch updated`),t()):b(e.error.message||`Failed to save changes`)},A=[...E?[{key:`assistant`,label:`Assistant`,children:(0,W.jsx)(Kc,{branch:n,canEdit:C.canEditGeneral,state:C.assistant,setField:C.setAssistant})}]:[],{key:`general`,label:`General`,children:(0,W.jsx)(_B,{branch:n,repo:r,sessions:i,boards:us(a),mcpServers:us(s),canEdit:C.canEditGeneral,state:C.general,setField:C.setGeneral,onArchiveOrDelete:f})},{key:`sessions`,label:(0,W.jsxs)(`span`,{children:[`Sessions`,` `,(0,W.jsx)(h,{count:i.length,showZero:!0,size:`small`,style:{backgroundColor:v.colorPrimaryBgHover}})]}),children:(0,W.jsx)(uH,{branch:n,sessions:i,client:c,onSessionClick:e=>{m?.(e),t()}})},{key:`environment`,label:`Environment`,children:(0,W.jsx)(Sl,{branch:n,repo:r,client:c,onUpdateRepo:d,onUpdateBranch:u,canControlEnvironment:C.canControlEnvironment})},{key:`files`,label:`Files`,children:(0,W.jsx)(sB,{branch:n,client:c})},...C.canViewPermissions?[{key:`permissions`,label:`Permissions`,children:(0,W.jsx)(RB,{loadingOwners:C.loadingOwners,canEdit:C.canEditPermissions,allUsers:C.allUsers,allGroups:C.allGroups,groupGrantsStatus:C.groupGrantsStatus,groupGrantsError:C.groupGrantsError,currentUser:l,client:c,board:T,state:C.permissions,setField:C.setPermissions,ownersLoadError:C.ownersLoadError})}]:[],{key:`schedule`,label:`Schedules`,children:(0,W.jsx)(aH,{branch:n,client:c,mcpServerById:s,currentUser:l,userById:w,onOpenSession:e=>{m?.(e),t()}})},...E?[{key:`knowledge`,label:`Knowledge`,children:(0,W.jsx)(wB,{branch:n,client:c,canEdit:C.canEditGeneral})}]:[]],ee=(C.canEditGeneral||C.canEditPermissions)&&C.hasChanges&&!C.saving;return(0,W.jsx)(it,{title:O,open:e,onCancel:t,footer:(0,W.jsxs)(z,{children:[C.hasChanges&&(0,W.jsx)(V,{onClick:C.reset,disabled:C.saving,"aria-label":`Reset changes`,children:`Reset`}),(0,W.jsx)(V,{onClick:t,disabled:C.saving,children:`Close`}),(0,W.jsx)(V,{type:`primary`,onClick:k,loading:C.saving,disabled:!ee,"aria-label":`Save changes`,children:`Save Changes`})]}),width:900,mask:{closable:!1},styles:{body:{padding:0,maxHeight:`80vh`,overflowY:`auto`}},children:(0,W.jsx)(ht,{activeKey:x,onChange:e=>S(e),items:A})})},_H=(0,U.lazy)(()=>H(()=>Promise.resolve().then(()=>Lr).then(e=>({default:e.ParticleBackground})),void 0));function vH(){throw Error(`Crash test: this is a synthetic render-phase error from About → Crash Test. If you're seeing the friendly crash screen, the global ErrorBoundary works.`)}var yH=({client:e,connected:t,connectionError:n,isAdmin:r=!1})=>{let i=za(),[a,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),{capturedSha:p}=ka();return(0,U.useEffect)(()=>{window.AGOR_DAEMON_URL?c(`Runtime injection (window.AGOR_DAEMON_URL)`):typeof window<`u`&&window.location.pathname.startsWith(`/ui`)?c(`Same-host detection (served from /ui)`):c(`Dev mode (explicit port)`),e&&e.service(`health`).find().then(e=>{u(e)}).catch(e=>console.error(`Failed to fetch health info:`,e))},[e]),(0,W.jsxs)(`div`,{style:{position:`relative`,minHeight:500,padding:`24px 0`},children:[(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(_H,{})}),(0,W.jsx)(`div`,{style:{position:`relative`,zIndex:1},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsx)(Me,{title:`Connection Info`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Status`,children:t?(0,W.jsx)(`span`,{style:{color:`#52c41a`},children:`✓ Connected`}):(0,W.jsx)(`span`,{style:{color:`#ff4d4f`},children:`✗ Disconnected`})}),n&&(0,W.jsx)(R.Item,{label:`Error`,children:(0,W.jsx)(s.Text,{type:`danger`,children:n})}),l?.version&&(0,W.jsx)(R.Item,{label:`Version`,children:l.version}),l?.buildSha&&(0,W.jsxs)(R.Item,{label:`Daemon Build`,children:[(0,W.jsx)(`code`,{children:l.buildSha}),l.builtAt&&(0,W.jsxs)(s.Text,{type:`secondary`,style:{marginLeft:8},children:[`built `,l.builtAt]})]}),p&&(0,W.jsxs)(R.Item,{label:`Tab Captured`,children:[(0,W.jsx)(`code`,{children:p}),qo(p,l?.buildSha)&&(0,W.jsx)(s.Text,{type:`warning`,style:{marginLeft:8},children:`⚠️ out of sync — refresh to load the latest UI`})]}),l?.encryption&&(0,W.jsx)(R.Item,{label:`Encryption`,children:l.encryption.enabled?(0,W.jsxs)(`span`,{style:{color:`#52c41a`},children:[`🔐 Enabled (`,l.encryption.method,`)`]}):(0,W.jsx)(`span`,{style:{color:`#faad14`},children:`🔓 Disabled`})})]})}),r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Me,{title:`Daemon Config (Admin Only)`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Daemon URL`,children:(0,W.jsx)(`code`,{children:i})}),(0,W.jsx)(R.Item,{label:`Detection Method`,children:a}),l?.database&&(typeof l.database==`string`?(0,W.jsx)(R.Item,{label:`Database`,children:(0,W.jsx)(`code`,{children:l.database})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R.Item,{label:`Database Type`,children:l.database.dialect===`postgresql`?(0,W.jsx)(`span`,{children:`🐘 PostgreSQL`}):(0,W.jsx)(`span`,{children:`💾 SQLite`})}),l.database.dialect===`postgresql`&&l.database.url&&(0,W.jsx)(R.Item,{label:`Database URL`,children:(0,W.jsx)(`code`,{children:l.database.url})}),l.database.dialect===`sqlite`&&l.database.path&&(0,W.jsx)(R.Item,{label:`Database Path`,children:(0,W.jsx)(`code`,{children:l.database.path})})]})),l?.auth&&(0,W.jsx)(R.Item,{label:`Authentication`,children:`🔐 Required`}),l?.execution&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R.Item,{label:`Branch RBAC`,children:l.execution.branchRbac?(0,W.jsx)(`span`,{style:{color:`#52c41a`},children:`🛡️ Enabled`}):(0,W.jsx)(`span`,{style:{color:`#faad14`},children:`⚠️ Disabled (open access)`})}),(0,W.jsxs)(R.Item,{label:`Unix User Mode`,children:[(0,W.jsx)(`code`,{children:l.execution.unixUserMode}),l.execution.unixUserMode===`simple`&&(0,W.jsx)(s.Text,{type:`secondary`,style:{marginLeft:8},children:`(no OS isolation)`}),l.execution.unixUserMode===`insulated`&&(0,W.jsx)(s.Text,{type:`secondary`,style:{marginLeft:8},children:`(branch groups)`}),l.execution.unixUserMode===`strict`&&(0,W.jsx)(s.Text,{type:`secondary`,style:{marginLeft:8},children:`(per-user impersonation)`})]})]})]})}),l?.security&&(0,W.jsxs)(Me,{title:`Security Headers (Admin Only)`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:[(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsxs)(R.Item,{label:`CSP`,children:[l.security.csp.enabled?l.security.csp.reportOnly?(0,W.jsx)(v,{color:`warning`,children:`Report-Only`}):(0,W.jsx)(v,{color:`success`,children:`Enforced`}):(0,W.jsx)(v,{color:`error`,children:`Disabled`}),l.security.csp.reportUri&&(0,W.jsxs)(s.Text,{type:`secondary`,style:{marginLeft:8},children:[`Reports → `,(0,W.jsx)(`code`,{children:l.security.csp.reportUri})]})]}),(0,W.jsx)(R.Item,{label:`CSP Header`,children:(0,W.jsx)(o,{title:`Full Content-Security-Policy header the daemon is emitting. If a resource is blocked, check which directive matches.`,children:(0,W.jsx)(s.Paragraph,{copyable:{text:l.security.csp.header},style:{margin:0,fontFamily:`monospace`,fontSize:12,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:l.security.csp.header})})}),(0,W.jsxs)(R.Item,{label:`CORS Mode`,children:[(0,W.jsx)(`code`,{children:l.security.cors.mode}),l.security.cors.mode===`wildcard`&&(0,W.jsx)(s.Text,{type:`danger`,style:{marginLeft:8},children:`⚠️ Any origin accepted`}),l.security.cors.mode===`reflect`&&(0,W.jsx)(s.Text,{type:`warning`,style:{marginLeft:8},children:`⚠️ Origin header echoed`})]}),(0,W.jsx)(R.Item,{label:`CORS Credentials`,children:l.security.cors.credentials?(0,W.jsx)(v,{color:`success`,children:`Enabled`}):(0,W.jsx)(v,{color:`default`,children:`Disabled`})}),(0,W.jsxs)(R.Item,{label:`Allowed Origins`,children:[l.security.cors.originCount,` configured`,` `,(0,W.jsxs)(s.Text,{type:`secondary`,children:[`(+ localhost dev ports`,l.security.cors.allowSandpack&&`, + Sandpack`,`)`]})]})]}),(0,W.jsxs)(s.Paragraph,{type:`secondary`,style:{marginTop:12,marginBottom:0,fontSize:12},children:[`Configure via `,(0,W.jsx)(`code`,{children:`security.csp`}),` and `,(0,W.jsx)(`code`,{children:`security.cors`}),` in`,` `,(0,W.jsx)(`code`,{children:`~/.agor/config.yaml`}),`. See`,` `,(0,W.jsx)(`a`,{href:`https://github.com/preset-io/agor/blob/main/context/concepts/security.md`,target:`_blank`,rel:`noopener noreferrer`,children:`context/concepts/security.md`}),`.`]})]}),(0,W.jsx)(Me,{title:`System Debug Info (Admin Only)`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Mode`,children:window.location.pathname.startsWith(`/ui`)?(0,W.jsx)(`span`,{children:`npm package (agor-live)`}):(0,W.jsx)(`span`,{children:`Source code (dev)`})}),(0,W.jsx)(R.Item,{label:`UI Location`,children:(0,W.jsx)(`code`,{children:window.location.href})}),(0,W.jsx)(R.Item,{label:`Origin`,children:(0,W.jsx)(`code`,{children:window.location.origin})}),(0,W.jsx)(R.Item,{label:`Path`,children:(0,W.jsx)(`code`,{children:window.location.pathname})}),(0,W.jsxs)(R.Item,{label:`Crash Test`,children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{danger:!0,size:`small`,onClick:()=>f(!0),children:`Trigger render crash`}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Throws during render to verify the global error boundary. Reload to recover.`})]}),d&&(0,W.jsx)(vH,{})]})]})})]}),(0,W.jsx)(Me,{variant:`borderless`,style:{maxWidth:800,margin:`0 auto`,textAlign:`center`},children:(0,W.jsxs)(z,{size:`large`,children:[(0,W.jsx)(`a`,{href:`https://github.com/preset-io/agor`,target:`_blank`,rel:`noopener noreferrer`,children:`GitHub`}),(0,W.jsx)(`a`,{href:`https://agor.live`,target:`_blank`,rel:`noopener noreferrer`,children:`Documentation`})]})})]})})]})},{Text:bH,Link:xH}=s,SH={"claude-code":[{field:`ANTHROPIC_API_KEY`,label:`Anthropic API Key`,description:`(pay-as-you-go / Console)`,placeholder:`sk-ant-api03-...`,docUrl:`https://platform.claude.com/settings/keys`,helper:(0,W.jsx)(bH,{type:`secondary`,style:{fontSize:12},children:`If you use a Claude subscription, use the Claude Subscription Token below instead.`})},{field:`CLAUDE_CODE_OAUTH_TOKEN`,label:`Claude Subscription Token`,description:`(Pro / Max plan)`,placeholder:`sk-ant-oat01-...`,docUrl:`https://docs.claude.com/en/docs/claude-code/setup`},{field:`ANTHROPIC_AUTH_TOKEN`,label:`Anthropic Auth Token`,description:`(optional — proxy / enterprise)`,placeholder:`token...`},{field:`ANTHROPIC_BASE_URL`,label:`Anthropic Base URL`,description:`(optional — gateway / proxy)`,placeholder:`https://api.anthropic.com`,type:`text`}],codex:[{field:`OPENAI_API_KEY`,label:`OpenAI API Key`,description:`(Codex)`,placeholder:`sk-proj-...`,docUrl:`https://platform.openai.com/api-keys`,helper:(0,W.jsxs)(bH,{type:`secondary`,style:{fontSize:12},children:[`Alternative: on the machine Agor runs sessions on, run`,` `,(0,W.jsx)(bH,{code:!0,style:{fontSize:12},children:`codex login --device-auth`}),` `,`to use Codex CLI account auth without storing an OpenAI key in Agor.`,` `,(0,W.jsx)(xH,{href:`https://agor.live/guide/extended-install#authentication`,target:`_blank`,children:`Learn more →`})]})},{field:`OPENAI_BASE_URL`,label:`OpenAI Base URL`,description:`(optional — gateway / proxy / self-hosted)`,placeholder:`https://api.openai.com/v1`,type:`text`}],gemini:[{field:`GEMINI_API_KEY`,label:`Gemini API Key`,placeholder:`AIza...`,docUrl:`https://aistudio.google.com/app/apikey`}],copilot:[{field:`COPILOT_GITHUB_TOKEN`,label:`GitHub Token`,description:`(Copilot)`,placeholder:`ghp_...`,docUrl:`https://github.com/settings/tokens`}],cursor:[{field:`CURSOR_API_KEY`,label:`Cursor API Key`,description:`(experimental SDK)`,placeholder:`key_...`,docUrl:`https://cursor.com/dashboard/integrations`}],opencode:[],"claude-code-cli":[{field:`ANTHROPIC_API_KEY`,label:`Anthropic API Key`,description:`(pay-as-you-go / Console)`,placeholder:`sk-ant-api03-...`,docUrl:`https://platform.claude.com/settings/keys`,helper:(0,W.jsx)(bH,{type:`secondary`,style:{fontSize:12},children:`If you use a Claude subscription, use the Claude Subscription Token below instead.`})},{field:`CLAUDE_CODE_OAUTH_TOKEN`,label:`Claude Subscription Token`,description:`(Pro / Max plan)`,placeholder:`sk-ant-oat01-...`,docUrl:`https://docs.claude.com/en/docs/claude-code/setup`}]},CH=({tool:e,fieldStatus:t,onSave:n,onClear:r,saving:i={},disabled:a=!1,fields:s,publicValues:c})=>{let{token:l}=ce.useToken(),[u,d]=(0,U.useState)({}),f=s??SH[e]??[],p=async e=>{let t=u[e]?.trim();t&&(await n(e,t),d(t=>({...t,[e]:``})))},m=n=>{let{field:s,label:f,description:m,placeholder:h,docUrl:g,helper:_,type:v=`password`}=n,y=!!t[s],b=v===`password`?L.Password:L,x=v===`text`&&y?c?.[s]:void 0;return(0,W.jsx)(`div`,{style:{marginBottom:l.marginLG},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsxs)(z,{wrap:!0,children:[(0,W.jsx)(bH,{strong:!0,children:f}),m&&(0,W.jsx)(bH,{type:`secondary`,children:m}),(0,W.jsx)(o,{title:(0,W.jsxs)(`span`,{children:[`Passed to the `,e,` SDK as `,(0,W.jsx)(`code`,{children:s})]}),children:(0,W.jsx)(he,{style:{color:l.colorTextSecondary,cursor:`help`}})}),y?(0,W.jsx)(tr,{icon:(0,W.jsx)(Re,{}),color:`success`,children:`Set`}):(0,W.jsx)(tr,{icon:(0,W.jsx)(Ye,{}),color:`default`,children:`Not Set`})]}),y?(0,W.jsxs)(z,{wrap:!0,size:`small`,style:{width:`100%`},children:[x&&(0,W.jsx)(bH,{code:!0,copyable:!0,style:{fontSize:l.fontSizeSM,wordBreak:`break-all`},children:x}),(0,W.jsx)(V,{danger:!0,icon:(0,W.jsx)(ie,{}),onClick:()=>r(s),loading:i[s],disabled:a,children:`Clear`})]}):(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(b,{placeholder:h,value:u[s]||``,onChange:e=>d(t=>({...t,[s]:e.target.value})),onPressEnter:()=>p(s),style:{flex:1},disabled:a}),(0,W.jsx)(V,{type:`primary`,onClick:()=>p(s),loading:i[s],disabled:a||!u[s]?.trim(),children:`Save`})]}),g&&(0,W.jsxs)(bH,{type:`secondary`,style:{fontSize:l.fontSizeSM},children:[`Get your key at:`,` `,(0,W.jsx)(xH,{href:g,target:`_blank`,children:g})]}),_,s===`CLAUDE_CODE_OAUTH_TOKEN`&&!y&&(0,W.jsxs)(bH,{type:`secondary`,style:{fontSize:l.fontSizeSM},children:[`On the machine Agor runs sessions on, run`,` `,(0,W.jsx)(bH,{code:!0,style:{fontSize:l.fontSizeSM},children:`claude setup-token`}),` `,`and paste the printed token here. This uses Claude subscription auth instead of a raw API key.`]}),s===`ANTHROPIC_AUTH_TOKEN`&&(0,W.jsx)(bH,{type:`secondary`,style:{fontSize:l.fontSizeSM},children:`Alternative to the API key for token-based auth (AWS Bedrock, OAuth proxies, custom auth flows). Leave empty unless your gateway requires it.`}),s===`ANTHROPIC_BASE_URL`&&(0,W.jsx)(bH,{type:`secondary`,style:{fontSize:l.fontSizeSM},children:`Override only when routing Claude Code through an internal gateway, proxy, or regional endpoint. Leave empty to use Anthropic's default API.`}),s===`OPENAI_BASE_URL`&&(0,W.jsx)(bH,{type:`secondary`,style:{fontSize:l.fontSizeSM},children:`Point Codex at any OpenAI-compatible endpoint (internal gateway, corporate proxy, or a localhost server like vLLM / Ollama / LM Studio). Leave empty to use OpenAI's default API. The OpenAI API Key above is sent as the bearer token.`}),s===`COPILOT_GITHUB_TOKEN`&&(0,W.jsxs)(bH,{type:`secondary`,style:{fontSize:l.fontSizeSM},children:[`Falls back to`,` `,(0,W.jsx)(bH,{code:!0,style:{fontSize:l.fontSizeSM},children:`GH_TOKEN`}),` `,`/`,` `,(0,W.jsx)(bH,{code:!0,style:{fontSize:l.fontSizeSM},children:`GITHUB_TOKEN`}),` `,`if unset. Set this explicitly to point Copilot at a different account (e.g. one with an active Copilot subscription) or to limit blast radius — the global git token often has broader scopes than Copilot needs.`]})]})},s)};return f.length===0?null:(0,W.jsx)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:f.map(e=>m(e))})},wH={"claude-code":SH[`claude-code`].filter(e=>e.field!==`CLAUDE_CODE_OAUTH_TOKEN`),"claude-code-cli":SH[`claude-code-cli`].filter(e=>e.field!==`CLAUDE_CODE_OAUTH_TOKEN`),codex:SH.codex.filter(e=>e.field!==`OPENAI_BASE_URL`),gemini:SH.gemini,copilot:SH.copilot,cursor:SH.cursor,opencode:SH.opencode},TH=({tool:e,fieldStatus:t,keysError:n,savingKeys:r,onSave:i,onClear:a,onClearError:o})=>{let{token:s}=ce.useToken();return(0,W.jsxs)(`div`,{style:{paddingTop:s.paddingMD},children:[(0,W.jsx)(I,{title:(0,W.jsxs)(`span`,{children:[`This is the `,(0,W.jsx)(`strong`,{children:`global API key`}),` fallback for users without their own credentials. CLI login alternatives are configured on the machine Agor runs sessions on.`,` `,(0,W.jsx)(`a`,{href:`https://agor.live/guide/extended-install#authentication`,target:`_blank`,rel:`noopener noreferrer`,children:`Learn more →`})]}),type:`info`,showIcon:!0,style:{marginBottom:s.marginLG}}),n&&(0,W.jsx)(I,{title:n,type:`error`,icon:(0,W.jsx)(Xe,{}),showIcon:!0,closable:!0,onClose:o,style:{marginBottom:s.marginLG}}),(0,W.jsx)(CH,{tool:e,fields:wH[e],fieldStatus:t,onSave:i,onClear:a,saving:r})]})},EH=({client:e})=>{let{token:t}=ce.useToken(),{showSuccess:n,showError:r}=mn(),[i,a]=(0,U.useState)(!0),[s,c]=(0,U.useState)({}),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)({}),[p]=B.useForm(),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(`http://localhost:4096`),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(!1),[S,w]=(0,U.useState)(!0);(0,U.useEffect)(()=>{e&&(async()=>{try{a(!0),u(null);let t=await e.service(`config`).get(`credentials`),n={};for(let e of Object.values(wH))for(let{field:r}of e)n[r]=!!t?.[r];f(n)}catch(e){console.error(`Failed to load API keys:`,e),u(e instanceof Error?e.message:`Failed to load API keys`)}finally{a(!1)}})()},[e]),(0,U.useEffect)(()=>{e&&(async()=>{try{w(!0);let t=await e.service(`config`).get(`opencode`);t&&(h(t.enabled||!1),_(t.serverUrl||`http://localhost:4096`))}catch(e){console.error(`Failed to load OpenCode config:`,e)}finally{w(!1)}})()},[e]);let T=async(t,n)=>{if(e)try{c(e=>({...e,[t]:!0})),u(null),await e.service(`config`).patch(null,{credentials:{[t]:n}}),f(e=>({...e,[t]:!0}))}catch(e){throw console.error(`Failed to save ${t}:`,e),u(e instanceof Error?e.message:`Failed to save ${t}`),e}finally{c(e=>({...e,[t]:!1}))}},E=async t=>{if(e)try{c(e=>({...e,[t]:!0})),u(null),await e.service(`config`).patch(null,{credentials:{[t]:null}}),f(e=>({...e,[t]:!1}))}catch(e){throw console.error(`Failed to clear ${t}:`,e),u(e instanceof Error?e.message:`Failed to clear ${t}`),e}finally{c(e=>({...e,[t]:!1}))}};return i||S?(0,W.jsx)(`div`,{style:{textAlign:`center`,padding:t.paddingLG},children:(0,W.jsx)(Ee,{size:`large`})}):(0,W.jsx)(`div`,{style:{padding:t.paddingMD},children:(0,W.jsx)(ht,{defaultActiveKey:`claude-code`,items:[{key:`claude-code`,label:`Claude Code`,children:(0,W.jsx)(TH,{tool:`claude-code`,fieldStatus:d,keysError:l,savingKeys:s,onSave:T,onClear:E,onClearError:()=>u(null)})},{key:`codex`,label:`Codex`,children:(0,W.jsx)(TH,{tool:`codex`,fieldStatus:d,keysError:l,savingKeys:s,onSave:T,onClear:E,onClearError:()=>u(null)})},{key:`gemini`,label:`Gemini`,children:(0,W.jsx)(TH,{tool:`gemini`,fieldStatus:d,keysError:l,savingKeys:s,onSave:T,onClear:E,onClearError:()=>u(null)})},{key:`copilot`,label:`GitHub Copilot`,children:(0,W.jsx)(TH,{tool:`copilot`,fieldStatus:d,keysError:l,savingKeys:s,onSave:T,onClear:E,onClearError:()=>u(null)})},{key:`cursor`,label:`Cursor SDK`,children:(0,W.jsx)(TH,{tool:`cursor`,fieldStatus:d,keysError:l,savingKeys:s,onSave:T,onClear:E,onClearError:()=>u(null)})},{key:`opencode`,label:`OpenCode`,children:(0,W.jsxs)(`div`,{style:{paddingTop:t.paddingMD},children:[(0,W.jsx)(I,{title:`OpenCode.ai Integration`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{style:{marginBottom:t.marginXS},children:[`OpenCode provides access to `,(0,W.jsx)(`strong`,{children:`75+ LLM providers`}),` including local models, custom endpoints, and privacy-focused options.`]}),(0,W.jsxs)(`p`,{style:{marginBottom:0},children:[`To use OpenCode sessions, you must run the OpenCode server separately.`,` `,(0,W.jsx)(`a`,{href:`https://agor.live/guide/opencode-setup`,target:`_blank`,rel:`noopener noreferrer`,children:`Setup Guide →`})]})]}),type:`info`,icon:(0,W.jsx)(he,{}),showIcon:!0,style:{marginBottom:t.marginLG}}),(0,W.jsxs)(B,{form:p,layout:`vertical`,children:[(0,W.jsx)(B.Item,{label:`Enable OpenCode Integration`,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(ye,{checked:m,onChange:h,checkedChildren:`Enabled`,unCheckedChildren:`Disabled`}),(0,W.jsx)(`span`,{style:{color:t.colorTextSecondary,fontSize:12},children:`Enable OpenCode as an agentic tool option in Agor`})]})}),m&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`OpenCode Server URL`,help:`URL where OpenCode server is running (started with 'opencode serve')`,children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L,{placeholder:`http://localhost:4096`,value:g,onChange:e=>_(e.target.value)}),(0,W.jsx)(o,{title:`Test connection to OpenCode server`,children:(0,W.jsx)(V,{loading:b,icon:b?(0,W.jsx)(C,{}):void 0,onClick:async()=>{if(e){x(!0);try{y((await e.service(`opencode/health`).find()).connected===!0)}catch(e){console.error(`[OpenCode] Health check error:`,e),y(!1)}finally{x(!1)}}},children:`Test`})})]})}),v!==null&&(0,W.jsx)(I,{title:v?(0,W.jsxs)(z,{children:[(0,W.jsx)(Re,{style:{color:t.colorSuccess}}),(0,W.jsx)(`span`,{children:`Connected to OpenCode server`})]}):(0,W.jsxs)(z,{children:[(0,W.jsx)(Ye,{style:{color:t.colorError}}),(0,W.jsx)(`span`,{children:`Cannot connect to OpenCode server`})]}),type:v?`success`:`error`,showIcon:!1,style:{marginBottom:t.marginLG}}),v===!1&&(0,W.jsx)(I,{title:`Server Not Running`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{style:{marginBottom:t.marginXS},children:`Start OpenCode server in a separate terminal:`}),(0,W.jsx)(`pre`,{style:{background:t.colorBgContainer,padding:t.paddingXS,borderRadius:t.borderRadius,border:`1px solid ${t.colorBorder}`,overflowX:`auto`,marginBottom:t.marginXS,fontSize:12},children:`opencode serve --port 4096`}),(0,W.jsxs)(`p`,{style:{marginBottom:0,fontSize:12},children:[`Don't have OpenCode?`,` `,(0,W.jsx)(`a`,{href:`https://opencode.ai/docs`,target:`_blank`,rel:`noopener noreferrer`,children:`Installation Guide →`})]})]}),type:`warning`,showIcon:!0,style:{marginBottom:t.marginLG}}),v===!0&&(0,W.jsx)(I,{title:`Ready to use!`,description:`You can now create sessions with OpenCode as the agentic tool.`,type:`success`,showIcon:!0,style:{marginBottom:t.marginLG}})]}),(0,W.jsx)(B.Item,{children:(0,W.jsx)(V,{type:`primary`,onClick:async()=>{if(e)try{await e.service(`config`).patch(null,{opencode:{enabled:m,serverUrl:g}}),n(`OpenCode settings saved successfully`)}catch(e){r(e instanceof Error?e.message:`Failed to save OpenCode settings`),console.error(`Failed to save OpenCode settings:`,e)}},children:`Save OpenCode Settings`})})]}),(0,W.jsxs)(`div`,{style:{marginTop:t.marginLG},children:[(0,W.jsx)(`h4`,{children:`About OpenCode`}),(0,W.jsxs)(`ul`,{style:{fontSize:12,lineHeight:1.8,color:t.colorTextSecondary},children:[(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Multi-Provider Support:`}),` Access Claude, GPT-4, Gemini, and 70+ other models`]}),(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Privacy-First:`}),` All code and context stays local - no cloud storage`]}),(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Local Models:`}),` Support for Ollama, LM Studio, and custom endpoints`]}),(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Open Source:`}),` 30K+ GitHub stars, active community`]})]})]})]})}]})})};function DH(e=`/ui/`){return e===`/ui/`?`/ui`:``}function OH(e,t=`/ui/`){return`${DH(t)}${e.startsWith(`/`)?e:`/${e}`}`}function kH(e){return`${e.replace(/\/$/,``)}/`}var AH=new Map;function jH({boardById:e,sessionById:t,branchById:n,artifactById:r}){let i=Jt(),a=hn(),o=Ta(),s=(0,U.useRef)(t??AH);s.current=t??AH;let c=(0,U.useRef)(n??AH);c.current=n??AH;let l=(0,U.useRef)(r??AH);l.current=r??AH;let u=(0,U.useRef)(e);u.current=e;let d=(0,U.useRef)(a.pathname);d.current=a.pathname;let f=(0,U.useCallback)((e,t)=>kH(e)===kH(d.current)?!1:(i(e,{replace:t?.replace??!1}),!0),[i]),p=(0,U.useCallback)((e,t)=>{f(cs(e,u.current),t)},[f]),m=(0,U.useCallback)(e=>{f(`/`,e)},[f]),h=(0,U.useCallback)((e,t)=>{if(!f(Nt(e),t)){let t=s.current.get(e),n=t?.branch_id?c.current.get(t.branch_id):void 0;n?.board_id&&o(n.branch_id,{boardId:n.board_id})}},[f,o]),g=(0,U.useCallback)((e,t)=>{if(!f(At(e),t)){let t=c.current.get(e);t?.board_id&&o(e,{boardId:t.board_id})}},[f,o]),_=(0,U.useCallback)((e,t)=>{if(!f(xt(e),t)){let t=l.current.get(e);t?.board_id&&o(e,{boardId:t.board_id})}},[f,o]);return(0,U.useMemo)(()=>({goToSession:h,goToBranch:g,goToArtifact:_,goToBoard:p,goHome:m}),[h,g,_,p,m])}var MH={react:`cyan`,"react-ts":`blue`,vanilla:`green`,"vanilla-ts":`geekblue`},NH=({artifactById:e,branchById:t,boardById:n,onUpdate:r,onDelete:i,onClose:a})=>{let[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(``),[m]=B.useForm(),_=jH({boardById:n,artifactById:e}),y=(0,U.useCallback)(e=>{a?.(),_.goToArtifact(e.artifact_id)},[a,_]),b=e=>{d(e),m.setFieldsValue({name:e.name,description:e.description||``,board_id:e.board_id}),l(!0)},x=()=>{u&&m.validateFields().then(e=>{let t={},n=e.name,i=e.description||void 0,a=u.description||void 0;n!==u.name&&(t.name=n),i!==a&&(t.description=i),e.board_id&&e.board_id!==u.board_id&&(t.board_id=e.board_id),Object.keys(t).length>0&&r?.(u.artifact_id,t),m.resetFields(),l(!1),d(null)})},S=us(n).slice().sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:e.board_id,label:`${e.icon||`📋`} ${e.name}`})),C=[{title:`Name`,dataIndex:`name`,key:`name`,render:(e,t)=>(0,W.jsxs)(z,{orientation:`vertical`,size:0,children:[(0,W.jsx)(s.Text,{strong:!0,children:(0,W.jsx)(vs,{text:e,query:f})}),t.description&&(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:(0,W.jsx)(vs,{text:t.description,query:f})})]})},{title:`Template`,dataIndex:`template`,key:`template`,width:120,render:e=>(0,W.jsx)(v,{color:MH[e]||`default`,children:(0,W.jsx)(vs,{text:e,query:f})})},{title:`Build`,dataIndex:`build_status`,key:`build_status`,width:110,render:e=>{let t={success:{status:`success`,text:`Success`},error:{status:`error`,text:`Error`},checking:{status:`processing`,text:`Checking`},unknown:{status:`default`,text:`Unknown`}},n=t[e]||t.unknown;return(0,W.jsx)(h,{status:n.status,text:n.text})}},{title:`Branch`,dataIndex:`branch_id`,key:`branch_id`,width:160,render:e=>{if(!e)return(0,W.jsx)(s.Text,{type:`secondary`,children:`—`});let n=t.get(e);return(0,W.jsx)(s.Text,{type:`secondary`,children:(0,W.jsx)(vs,{text:n?.name||nn(e),query:f})})}},{title:`Board`,dataIndex:`board_id`,key:`board_id`,width:160,render:e=>{let t=n.get(e);return(0,W.jsx)(s.Text,{type:`secondary`,children:(0,W.jsx)(vs,{text:t?`${t.icon||``} ${t.name}`.trim():nn(e),query:f})})}},{title:`Created`,dataIndex:`created_at`,key:`created_at`,width:110,render:e=>new Date(e).toLocaleDateString()},{title:`Actions`,key:`actions`,width:150,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[t.board_id&&(0,W.jsx)(o,{title:`Center map on artifact`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(g,{}),onClick:e=>{e.stopPropagation(),y(t)}})}),(0,W.jsx)(o,{title:`Open fullscreen`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(et,{}),href:OH(an(t.artifact_id)),target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation()})}),(0,W.jsx)(o,{title:`Edit artifact`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>b(t)})}),(0,W.jsx)(ee,{title:`Delete artifact?`,description:`This will remove "${t.name}" and its files.`,onConfirm:()=>i?.(t.artifact_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(o,{title:`Delete artifact`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0})})})]})}],w=(0,U.useMemo)(()=>hs(ds(e,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})).filter(e=>!e.archived),f,[e=>e.name,e=>e.description,e=>e.template,e=>e.build_status,e=>e.artifact_id,e=>{let n=e.branch_id?t.get(e.branch_id):void 0;return[n?.name,n?.ref,e.branch_id]},e=>{let t=n.get(e.board_id);return[t?.name,t?.slug,e.board_id]}]),[e,f,t,n]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Live web application artifacts created by agents via MCP tools.`}),(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, description, template, branch, or board`,value:f,onChange:e=>p(e.target.value),style:{width:360}})]}),w.length===0?(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(E,{description:`No artifacts yet`,children:(0,W.jsxs)(s.Text,{type:`secondary`,children:[`Artifacts are created by agents using the `,(0,W.jsx)(`code`,{children:`agor_artifacts_publish`}),` MCP tool.`]})})}):(0,W.jsx)(D,{dataSource:w,columns:C,rowKey:`artifact_id`,pagination:!1,size:`small`}),(0,W.jsx)(it,{title:`Edit Artifact`,open:c,onOk:x,onCancel:()=>{m.resetFields(),l(!1),d(null)},okText:`Save`,children:(0,W.jsxs)(B,{form:m,layout:`vertical`,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{label:`Name`,name:`name`,rules:[{required:!0,message:`Please enter a name`}],children:(0,W.jsx)(L,{placeholder:`My Artifact`})}),(0,W.jsx)(B.Item,{label:`Description`,name:`description`,children:(0,W.jsx)(L.TextArea,{rows:3,placeholder:`Optional description`})}),(0,W.jsx)(B.Item,{label:`Board`,name:`board_id`,tooltip:`Move this artifact to a different board. Its position on the board is preserved.`,rules:[{required:!0,message:`Please select a board`}],children:(0,W.jsx)(P,{showSearch:!0,placeholder:`Select board...`,options:S,filterOption:(e,t)=>(t?.label?.toString()??``).toLowerCase().includes(e.toLowerCase())})})]})})]})};function PH(e){let[t]=B.useForm(),[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(``),s=(0,U.useCallback)(()=>{let n=t.getFieldsValue(),i=!!n.displayName?.trim(),a=!!(n.repoId||e?.repo_id);r(i&&a)},[t,e]);return(0,U.useEffect)(()=>{e&&!t.getFieldValue(`repoId`)&&t.setFieldValue(`repoId`,e.repo_id),s()},[e,t,s]),{form:t,isFormValid:n,setIsFormValid:r,customRepoSelected:i,setCustomRepoSelected:a,validateForm:s,handleDisplayNameChange:(0,U.useCallback)(e=>{let n=e.target.value,r=t.getFieldValue(`name`),i=`private-${Ui(n)}`;(!r||r===o.current)&&(t.setFieldValue(`name`,i),o.current=i),s()},[t,s]),resetForm:(0,U.useCallback)(()=>{t.resetFields(),r(!1),a(!1),o.current=``},[t])}}var FH=12e4;function IH(e,t,{enabled:n=!0}={}){let r=Kr(e),[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{if(r){a(!1),o.current=!1;return}if(!n||!t||o.current)return;o.current=!0,a(!0),Promise.resolve(t({url:Wr,slug:Ur,default_branch:`main`})).catch(()=>{});let e=setTimeout(()=>{a(!1),o.current=!1},FH);return()=>clearTimeout(e)},[r,t,n]),(0,U.useEffect)(()=>{!n&&!r&&(o.current=!1)},[n,r]),{frameworkRepo:r,isCloning:i&&!r}}async function LH(e,t){let n=t.repoById.get(e.repoId),r=e.branchName||`private-${Ui(e.displayName)}`,i=e.sourceBranch||n?.default_branch||`main`;if(!t.client)throw Error(`Not connected`);let a=e.displayName.trim()||`My Assistant`,o=(await t.client.service(`boards`).create({name:`${a}'s Board`,icon:e.emoji||`🤖`})).board_id;await Vi({client:t.client,boardId:o,assistantName:a,assistantEmoji:e.emoji});let s={kind:`assistant`,displayName:e.displayName.trim(),emoji:e.emoji||void 0,frameworkRepo:n?.slug,createdViaOnboarding:!1},c=await t.onCreateBranch(e.repoId,{name:r,ref:r,createBranch:!0,sourceBranch:i,pullLatest:!0,boardId:o,custom_context:{assistant:s},...e.description?.trim()?{notes:e.description.trim()}:{}});return c&&(o&&!c.board_id&&await t.onUpdateBranch(c.branch_id,{board_id:o}),o&&await t.client?.service(`boards`).setPrimaryAssistant({boardId:o,branchId:c.branch_id})),c}var RH=({form:e,repos:t,frameworkRepo:n,isCloning:r,onDisplayNameChange:i,customRepoSelected:a,onCustomRepoChange:c,extraBeforeAdvanced:l})=>{let u=n?`${n.name||n.slug} (default)`:r?`Setting up framework repository...`:`No framework repository found`;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Name`,required:!0,tooltip:`Human-friendly name and icon for this assistant`,children:(0,W.jsxs)(z.Compact,{style:{display:`flex`},children:[(0,W.jsx)(Yi,{form:e,fieldName:`emoji`,defaultEmoji:`🤖`}),(0,W.jsx)(B.Item,{name:`displayName`,noStyle:!0,rules:[{required:!0,message:`Please enter a name`}],children:(0,W.jsx)(L,{placeholder:`e.g. PR Reviewer, Command Center`,autoFocus:!0,onChange:i,style:{flex:1}})})]})}),(0,W.jsx)(B.Item,{name:`description`,label:`Description`,tooltip:`What does this assistant do? Visible to other agents via MCP.`,children:(0,W.jsx)(L.TextArea,{placeholder:`e.g. Reviews PRs and provides feedback, Monitors CI/CD pipelines`,rows:2})}),(0,W.jsx)(I,{type:`info`,showIcon:!1,style:{marginBottom:16},title:(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Each assistant gets a fresh board and becomes that board's primary assistant.`})}),l,r&&!n&&(0,W.jsx)(I,{type:`info`,showIcon:!0,icon:(0,W.jsx)(C,{}),style:{marginBottom:16},title:`Setting up framework repository`,description:(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Cloning preset-io/agor-assistant. This usually takes 10-30 seconds.`})}),(0,W.jsx)(ue,{ghost:!0,size:`small`,destroyOnHidden:!1,expandIcon:({isActive:e})=>(0,W.jsx)(se,{rotate:e?180:0}),items:[{key:`advanced`,label:(0,W.jsxs)(z,{size:6,children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Advanced Assistant Settings`}),(0,W.jsx)(o,{title:`Assistants live in an Agor branch. These settings control the framework repository, branch name, and source branch used to create that assistant branch.`,children:(0,W.jsx)(he,{style:{color:`var(--ant-color-text-tertiary)`}})})]}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{name:`repoId`,label:`Framework Repository`,children:(0,W.jsx)(P,{placeholder:u,allowClear:!0,showSearch:!0,disabled:r&&!n,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(e.toLowerCase()),options:[...t].sort((e,t)=>(e.name||e.slug).localeCompare(t.name||t.slug)).map(e=>({value:e.repo_id,label:`${e.name||e.slug}${e.repo_id===n?.repo_id?` (default)`:``}`})),onChange:e=>{c(!!e&&e!==n?.repo_id)},onClear:()=>c(!1)})}),a&&(0,W.jsx)(I,{type:`warning`,showIcon:!0,icon:(0,W.jsx)(he,{}),style:{marginBottom:16},title:`Custom repository selected`,description:(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`The repository should be preset-io/agor-assistant or a fork/derivative. It contains an OpenClaw-inspired agent framework adapted for Agor that your assistant needs to operate.`})}),(0,W.jsx)(B.Item,{name:`name`,label:`Branch Name`,rules:[{pattern:/^[a-z0-9-]+$/,message:`Only lowercase letters, numbers, and hyphens allowed`}],tooltip:`Auto-generated from display name. Override if needed.`,children:(0,W.jsx)(L,{placeholder:`private-my-assistant`})}),(0,W.jsx)(B.Item,{name:`sourceBranch`,label:`Source Branch`,children:(0,W.jsx)(L,{placeholder:`main`})})]})}]})]})},zH=({branchById:e,repoById:t,boardById:n,sessionsByBranch:r,userById:i,client:a,onArchiveOrDelete:c,onRowClick:l,onCreateBranch:u,onUpdateBranch:d,onCreateRepo:f,onClose:p})=>{let h=us(t),_=jH({boardById:n,branchById:e}),v=(0,U.useCallback)(e=>{p?.(),_.goToBranch(e.branch_id)},[p,_]),{token:y}=ce.useToken(),[b,x]=(0,U.useState)(!1),{frameworkRepo:S,isCloning:C}=IH(h,f,{enabled:b}),{form:w,isFormValid:T,customRepoSelected:O,setCustomRepoSelected:k,validateForm:A,handleDisplayNameChange:ee,resetForm:j}=PH(S),[M,N]=(0,U.useState)(!1),[te,P]=(0,U.useState)(``),[re,ie]=(0,U.useState)(!1),[ae,oe]=(0,U.useState)(null),F=async()=>{try{let e=await w.validateFields();N(!0);let n=e.repoId||S?.repo_id;if(!n){w.setFields([{name:`repoId`,errors:[`Framework repository is still being registered. Please wait a moment and try again.`]}]);return}if(!u||!d)return;let r=await LH({displayName:e.displayName.trim(),description:e.description||void 0,emoji:e.emoji||void 0,repoId:n,branchName:e.name||void 0,sourceBranch:e.sourceBranch||void 0},{client:a,repoById:t,onCreateBranch:u,onUpdateBranch:d});x(!1),j(),r&&(p?.(),_.goToBranch(r.branch_id))}catch(e){console.error(`Assistant creation failed:`,e)}finally{N(!1)}},se=()=>{x(!1),j()},le=(0,U.useMemo)(()=>{let n=te.trim().toLowerCase(),r=Array.from(e.values()).filter(e=>!e.archived&&dn(e)).sort((e,t)=>{let n=Xt(e)?.displayName??e.name,r=Xt(t)?.displayName??t.name;return n.localeCompare(r,void 0,{sensitivity:`base`})});return n?r.filter(e=>{let r=Xt(e),a=t.get(e.repo_id),o=i.get(e.created_by);return[r?.displayName,e.name,e.notes,o?.name,o?.email,a?.name,a?.slug].some(e=>e?.toLowerCase().includes(n))}):r},[e,t,i,te]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(z,{orientation:`vertical`,size:y.sizeUnit*2,style:{marginBottom:y.sizeUnit*2,width:`100%`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Assistants are persistent AI companions backed by a framework repo. They maintain memory, orchestrate work across branches, and run on scheduled heartbeats.`}),(0,W.jsxs)(z,{style:{width:`100%`,display:`flex`,justifyContent:`space-between`},children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search assistants...`,value:te,onChange:e=>P(e.target.value),style:{maxWidth:y.sizeUnit*40}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>x(!0),disabled:!S&&h.length===0,children:`Create Assistant`})]})]}),le.length===0&&!te&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:300},children:(0,W.jsx)(E,{image:(0,W.jsx)(m,{style:{fontSize:48,color:y.colorTextDisabled}}),description:`No assistants yet`,children:(0,W.jsx)(s.Text,{type:`secondary`,children:`Create an assistant to get started, or use the onboarding wizard.`})})}),(le.length>0||te)&&(0,W.jsx)(D,{dataSource:le,columns:[{title:`Assistant`,key:`assistant`,width:220,render:(e,t)=>{let n=Xt(t);return(0,W.jsxs)(z,{children:[n?.emoji?(0,W.jsx)(`span`,{style:{fontSize:18},children:n.emoji}):(0,W.jsx)(m,{style:{color:y.colorInfo}}),(0,W.jsx)(s.Text,{strong:!0,children:(0,W.jsx)(vs,{text:n?.displayName??t.name,query:te})})]})}},{title:`Description`,key:`description`,render:(e,t)=>{let n=(t.notes??``).trim();if(!n)return(0,W.jsx)(s.Text,{type:`secondary`,italic:!0,style:{fontSize:12},children:`No description`});let r=n.split(`
|
|
310
|
-
`).find(e=>e.trim().length>0)??n;return(0,W.jsx)(Ge,{content:(0,W.jsx)(`div`,{className:`markdown-compact`,style:{maxWidth:480,maxHeight:400,overflowY:`auto`,fontSize:12,lineHeight:1.5},children:(0,W.jsx)(nB,{content:n,showControls:!1})}),trigger:`hover`,placement:`topLeft`,mouseEnterDelay:.3,children:(0,W.jsx)(s.Text,{type:`secondary`,ellipsis:!0,style:{display:`block`,maxWidth:480,fontSize:12,cursor:`help`},children:(0,W.jsx)(vs,{text:r,query:te})})})}},{title:`Creator`,key:`creator`,width:160,render:(e,t)=>{let n=i.get(t.created_by);return!n||t.created_by===`anonymous`?(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:t.created_by===`anonymous`?`Anonymous`:`Unknown User`}):(0,W.jsx)(Nc,{user:n,showName:!0,size:`small`})}},{title:`Actions`,key:`actions`,width:130,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[t.board_id&&(0,W.jsx)(o,{title:`Center map on assistant`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(g,{}),onClick:e=>{e.stopPropagation(),v(t)}})}),(0,W.jsx)(o,{title:`Edit assistant`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:e=>{e.stopPropagation(),l?.(t)}})}),(0,W.jsx)(dB,{tooltip:`Archive or delete assistant`,onClick:()=>{oe(t),ie(!0)}})]})}],rowKey:`branch_id`,pagination:{pageSize:10},size:`small`,onRow:e=>({onClick:()=>l?.(e),style:{cursor:l?`pointer`:`default`}})}),(0,W.jsx)(it,{title:`Create Assistant`,open:b,onOk:F,onCancel:se,okText:`Create`,okButtonProps:{disabled:!T,loading:M},children:(0,W.jsx)(B,{form:w,layout:`vertical`,onFieldsChange:A,initialValues:{sourceBranch:`main`},children:(0,W.jsx)(RH,{form:w,repos:h,frameworkRepo:S,isCloning:C,onDisplayNameChange:ee,customRepoSelected:O,onCustomRepoChange:k})})}),ae&&(0,W.jsx)(pB,{open:re,branch:ae,sessionCount:(r.get(ae.branch_id)||[]).length,environmentRunning:ae.environment_instance?.status===`running`,onConfirm:e=>{c?.(ae.branch_id,e),ie(!1),oe(null)},onCancel:()=>{ie(!1),oe(null)}})]})},BH=[{label:`Rainbow (7 colors)`,value:`linear-gradient(to right, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3)`},{label:`Multi-color gradient`,value:`linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3)`},{label:`Pink to blue gradient`,value:`linear-gradient(180deg, #f093fb 0%, #f5576c 25%, #4facfe 50%, #00f2fe 75%, #43e97b 100%)`},{label:`Gold shimmer`,value:`linear-gradient(135deg, #f5af19 0%, #f12711 30%, #f5af19 60%, #f12711 100%)`},{label:`Cyan/magenta grid`,value:`repeating-linear-gradient(0deg, transparent, transparent 2px, #0ff 2px, #0ff 4px), repeating-linear-gradient(90deg, transparent, transparent 2px, #f0f 2px, #f0f 4px), linear-gradient(180deg, #000, #001a1a)`},{label:`Diagonal stripes (colorful)`,value:`repeating-linear-gradient(45deg, #ff006e 0px, #ff006e 10px, #ffbe0b 10px, #ffbe0b 20px, #8338ec 20px, #8338ec 30px, #3a86ff 30px, #3a86ff 40px)`},{label:`Conic gradient (warm colors)`,value:`conic-gradient(from 45deg, #ff0080, #ff8c00, #40e0d0, #ff0080, #ff8c00, #40e0d0, #ff0080)`},{label:`Dark with purple/pink spots`,value:`radial-gradient(ellipse at top, #1b2735 0%, #090a0f 100%), radial-gradient(circle at 20% 50%, rgba(120, 0, 255, 0.3) 0%, transparent 50%), radial-gradient(circle at 80% 80%, rgba(255, 0, 120, 0.3) 0%, transparent 50%)`},{label:`Quadrant blocks (conic)`,value:`repeating-conic-gradient(from 0deg at 50% 50%, #ff006e 0deg 90deg, #8338ec 90deg 180deg, #3a86ff 180deg 270deg, #fb5607 270deg 360deg)`},{label:`RGB stripes`,value:`linear-gradient(90deg, #000 0%, #f00 20%, #000 21%, #0f0 40%, #000 41%, #00f 60%, #000 61%, #fff 80%, #000 81%)`},{label:`Fine diagonal lines (B&W)`,value:`repeating-linear-gradient(45deg, #000, #000 1px, #fff 1px, #fff 2px)`},{label:`Dark with magenta/cyan glow`,value:`radial-gradient(circle at 30% 50%, rgba(255, 0, 255, 0.5), transparent 50%), radial-gradient(circle at 70% 70%, rgba(0, 255, 255, 0.5), transparent 50%), linear-gradient(180deg, #0a0a0a, #1a1a2e)`},{label:`Sunburst (conic)`,value:`conic-gradient(from 0deg, #ffbe0b 0deg, #fb5607 60deg, #ff006e 120deg, #8338ec 180deg, #3a86ff 240deg, #ffbe0b 300deg, #fb5607 360deg)`},{label:`Checkerboard (purple)`,value:`repeating-linear-gradient(45deg, #606dbc, #606dbc 10px, #465298 10px, #465298 20px)`}],VH=[{label:`Slow gradient shift (12s)`,value:`background-size: 400% 400%;
|
|
311
|
-
animation: agorGradientShift 12s ease infinite;
|
|
312
|
-
|
|
313
|
-
@keyframes agorGradientShift {
|
|
314
|
-
0%, 100% { background-position: 0% 50%; }
|
|
315
|
-
50% { background-position: 100% 50%; }
|
|
316
|
-
}`},{label:`Fast gradient shift (4s)`,value:`background-size: 400% 400%;
|
|
317
|
-
animation: agorGradientFast 4s ease infinite;
|
|
318
|
-
|
|
319
|
-
@keyframes agorGradientFast {
|
|
320
|
-
0%, 100% { background-position: 0% 50%; }
|
|
321
|
-
50% { background-position: 100% 50%; }
|
|
322
|
-
}`},{label:`Diagonal sweep (8s)`,value:`background-size: 400% 400%;
|
|
323
|
-
animation: agorDiagonalSweep 8s linear infinite;
|
|
324
|
-
|
|
325
|
-
@keyframes agorDiagonalSweep {
|
|
326
|
-
0% { background-position: 0% 0%; }
|
|
327
|
-
50% { background-position: 100% 100%; }
|
|
328
|
-
100% { background-position: 0% 0%; }
|
|
329
|
-
}`},{label:`Pulse zoom (6s)`,value:`background-size: 200% 200%;
|
|
330
|
-
animation: agorPulse 6s ease-in-out infinite;
|
|
331
|
-
|
|
332
|
-
@keyframes agorPulse {
|
|
333
|
-
0%, 100% { background-size: 200% 200%; background-position: center; }
|
|
334
|
-
50% { background-size: 300% 300%; background-position: center; }
|
|
335
|
-
}`},{label:`Horizontal scroll (20s)`,value:`background-size: 200% 100%;
|
|
336
|
-
animation: agorHScroll 20s linear infinite;
|
|
337
|
-
|
|
338
|
-
@keyframes agorHScroll {
|
|
339
|
-
0% { background-position: 0% 50%; }
|
|
340
|
-
100% { background-position: 200% 50%; }
|
|
341
|
-
}`},{label:`Rotate (conic, 10s)`,value:`animation: agorRotate 10s linear infinite;
|
|
342
|
-
|
|
343
|
-
@keyframes agorRotate {
|
|
344
|
-
0% { filter: hue-rotate(0deg); }
|
|
345
|
-
100% { filter: hue-rotate(360deg); }
|
|
346
|
-
}`}];function HH(e){return e?!e.match(/^#[0-9a-fA-F]{3,8}$/)&&!e.match(/^rgba?\(/):!1}function UH(e){let t=e.getFieldsValue(!0),n=t.background_color;return{name:t.name,icon:t.icon||`📋`,description:t.description,background_color:n?typeof n==`string`?n:n.toHexString():null,custom_css:t.custom_css||null,access_mode:t.access_mode||`shared`,default_others_can:t.access_mode===`private`?`none`:t.default_others_can||`session`,default_others_fs_access:t.default_others_fs_access||`read`,default_dangerously_allow_session_sharing:!!t.default_dangerously_allow_session_sharing,custom_context:t.custom_context?JSON.parse(t.custom_context):null}}var WH=({form:e,autoFocus:t,extra:n,initialCustomCSS:r=!1,rbacEnabled:i=!1,allUsers:a=[],allGroups:o=[]})=>{let[c,l]=(0,U.useState)(r),u=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Name`,required:!0,style:{marginBottom:24},children:(0,W.jsxs)(z.Compact,{style:{display:`flex`},children:[(0,W.jsx)(Yi,{form:e,fieldName:`icon`,defaultEmoji:`📋`}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,rules:[{required:!0,message:`Please enter a board name`}],children:(0,W.jsx)(L,{placeholder:`My Board`,style:{flex:1},autoFocus:t})})]})}),(0,W.jsx)(B.Item,{label:`Description`,name:`description`,children:(0,W.jsx)(L.TextArea,{placeholder:`Optional description...`,rows:3})})]}),d={form:e,preserve:!0},f=B.useWatch(`access_mode`,d)||`shared`,p=B.useWatch(`owner_ids`,d)||[],m=B.useWatch(`board_group_grants`,d)||[],h=B.useWatch(`default_others_can`,d)||`session`,g=B.useWatch(`default_others_fs_access`,d)||`read`,_=!!B.useWatch(`default_dangerously_allow_session_sharing`,d),v={visibility:f,ownerIds:p,groupGrants:m,othersCan:f===`private`?`none`:h,othersFsAccess:g,allowSessionSharing:_},y=(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,component:!1,children:[(0,W.jsx)(I,{type:`info`,showIcon:!0,description:`Default branch permissions apply to new/aligned branches; branch overrides can still share individual branches.`,style:{marginBottom:24}}),(0,W.jsx)(LB,{value:v,onChange:(t,n)=>{t===`visibility`&&e.setFieldsValue({access_mode:n}),t===`ownerIds`&&e.setFieldsValue({owner_ids:n}),t===`groupGrants`&&e.setFieldsValue({board_group_grants:n}),t===`othersCan`&&e.setFieldsValue({default_others_can:n}),t===`othersFsAccess`&&e.setFieldsValue({default_others_fs_access:n}),t===`allowSessionSharing`&&e.setFieldsValue({default_dangerously_allow_session_sharing:n})},allUsers:a,allGroups:o,canEdit:!0,canEditOwners:i,canEditGroups:i,ownerHelp:`Manage board owners`,groupsHelp:`Inherited by aligned branches`,visibilityLabel:`Default branch permissions`,othersCanLabel:`Default others can`,othersFsAccessLabel:`Default filesystem access`}),!i&&(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(s.Text,{type:`secondary`,children:`Enable execution.branch_rbac to manage board owners and group grants.`})})]}),b=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(z,{direction:`vertical`,style:{width:`100%`,marginBottom:16},children:[(0,W.jsx)(vt,{checked:c,onChange:t=>{if(l(t.target.checked),t.target.checked){let t=e.getFieldValue(`background_color`);t&&typeof t!=`string`&&e.setFieldsValue({background_color:t.toHexString()})}},children:`Use custom CSS background`}),c?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(P,{placeholder:`Load a preset...`,style:{width:`100%`,marginBottom:8},allowClear:!0,showSearch:!0,options:BH,onChange:t=>{t&&e.setFieldsValue({background_color:t})}}),(0,W.jsx)(B.Item,{name:`background_color`,noStyle:!0,children:(0,W.jsx)(L.TextArea,{placeholder:`Enter custom CSS background value (gradients, patterns, etc.)`,rows:3,style:{fontFamily:`monospace`,fontSize:`12px`}})})]}):(0,W.jsx)(B.Item,{name:`background_color`,noStyle:!0,children:(0,W.jsx)(Pe,{showText:!0,format:`hex`,allowClear:!0})})]}),c&&(0,W.jsxs)(z,{direction:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:`13px`},children:`Animation CSS`}),(0,W.jsx)(P,{placeholder:`Load an animation preset...`,style:{width:`100%`,marginBottom:8},allowClear:!0,showSearch:!0,options:VH,onChange:t=>{t&&e.setFieldsValue({custom_css:t})}}),(0,W.jsx)(B.Item,{name:`custom_css`,noStyle:!0,children:(0,W.jsx)(L.TextArea,{rows:6,style:{fontFamily:`monospace`,fontSize:`12px`}})})]})]});return(0,W.jsx)(ht,{items:[{key:`general`,label:`General`,children:u},{key:`permissions`,label:`Permissions`,children:y},{key:`css`,label:`CSS`,children:b},...n?[{key:`advanced`,label:`Advanced`,children:n}]:[]]})},GH=({value:e,onChange:t,placeholder:n=`{"key": "value"}`,rows:r=4})=>(0,W.jsx)(sl,{value:e??``,onChange:t,language:`json`,placeholder:n,rows:r}),KH=(e,t)=>{if(!t||t.trim()===``)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch{return Promise.reject(Error(`Invalid JSON`))}},qH=({client:e,boardById:t,sessionsByBranch:n,branchById:r,onCreate:i,onUpdate:a,onDelete:c,onArchive:l,onUnarchive:u})=>{let{modal:d}=M.useApp(),{showSuccess:f,showError:p}=mn(),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)([]),[w,T]=(0,U.useState)([]),[E,O]=(0,U.useState)(`active`),[k,A]=(0,U.useState)(``),[j]=B.useForm(),N=(0,U.useMemo)(()=>{let e=new Map;for(let i of t.values()){let t=[];for(let e of r.values())e.board_id===i.board_id&&t.push(e.branch_id);let a=t.flatMap(e=>n.get(e)||[]).length;e.set(i.board_id,a)}return e},[t,n,r]),te=async t=>{if(!e||!b)return;let n=t,r=j.getFieldsValue(!0),i=r.access_mode===`private`,a=r.owner_ids||[],o=i?[]:r.board_group_grants||[],s=(await e.service(`boards/:id/owners`).find({route:{id:n}})).map(e=>e.user_id);await Promise.all([...a.filter(e=>!s.includes(e)).map(t=>e.service(`boards/:id/owners`).create({user_id:t},{route:{id:n}})),...s.filter(e=>!a.includes(e)).map(t=>e.service(`boards/:id/owners`).remove(t,{route:{id:n}}))]);let c=await e.service(`boards/:id/group-grants`).find({route:{id:n}}),l=new Map(o.map(e=>[e.group_id,e]));await Promise.all([...o.map(t=>e.service(`boards/:id/group-grants`).create(t,{route:{id:n}})),...c.filter(e=>!l.has(e.group_id)).map(t=>e.service(`boards/:id/group-grants`).remove(t.group_id,{route:{id:n}}))])},re=()=>{j.validateFields().then(()=>{i?.(UH(j)),j.resetFields(),h(!1)}).catch(()=>{})},ae=async t=>{y(t);let n=[],r=[];if(e)try{let[i,a,o,s]=await Promise.all([e.service(`users`).findAll({}),e.service(`groups`).findAll({query:{archived:!1}}),e.service(`boards/:id/owners`).find({route:{id:t.board_id}}),e.service(`boards/:id/group-grants`).find({route:{id:t.board_id}})]);x(!0),C(i),T(a),n=o.map(e=>e.user_id),n.length===0&&t.created_by&&(n=[t.created_by]),r=s.map(e=>({group_id:e.group_id,can:e.can,fs_access:e.fs_access}))}catch(e){x(!1),C([]),T([]),console.warn(`Board RBAC metadata unavailable:`,e)}j.setFieldsValue({name:t.name,icon:t.icon,description:t.description,background_color:t.background_color,custom_css:t.custom_css,access_mode:t.access_mode||`shared`,default_others_can:t.default_others_can||`session`,default_others_fs_access:t.default_others_fs_access||`read`,default_dangerously_allow_session_sharing:!!t.default_dangerously_allow_session_sharing,owner_ids:n,board_group_grants:r,custom_context:t.custom_context?JSON.stringify(t.custom_context,null,2):``}),_(!0)},F=()=>{v&&j.validateFields().then(()=>{let e=j.getFieldsValue(!0);if(e.access_mode===`private`&&(e.owner_ids||[]).length!==1){p(`Private boards must have exactly one private user`);return}a?.(v.board_id,UH(j)),te(v.board_id).catch(e=>{p(`Failed to update board permissions: ${e.message}`)}),j.resetFields(),_(!1),y(null)}).catch(()=>{})},se=e=>{c?.(e)},ce=t=>{let n=`${t.name} (Copy)`,r=n;d.confirm({title:`Clone Board`,content:(0,W.jsx)(L,{placeholder:`New board name`,defaultValue:n,onChange:e=>{r=e.target.value},onPressEnter:e=>{e.preventDefault()}}),onOk:()=>e?e.service(`boards`).clone({id:t.board_id,name:r}).then(e=>{f(`Board cloned: ${e.name}`),i?.(e)}).catch(e=>(p(`Clone failed: ${e instanceof Error?e.message:String(e)}`),Promise.reject(e))):(p(`Not connected to daemon`),Promise.reject(Error(`Not connected to daemon`)))})},le=async t=>{if(!e){p(`Not connected to daemon`);return}try{let n=await e.service(`boards`).toYaml({id:t.board_id}),r=new Blob([n],{type:`text/yaml`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${t.slug||t.name.toLowerCase().replace(/\s+/g,`-`)}.agor-board.yaml`,a.click(),URL.revokeObjectURL(i),f(`Board exported`)}catch(e){p(`Export failed: ${e instanceof Error?e.message:String(e)}`)}},ue=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`.yaml,.yml,.json`,e.onchange=e=>de(e.target.files?.[0]),e.click()},de=async t=>{if(!t)return;if(!e){p(`Not connected to daemon`);return}let n=await t.text();try{let r=e.service(`boards`),a;a=t.name.endsWith(`.json`)?await r.fromBlob(JSON.parse(n)):await r.fromYaml({yaml:n}),f(`Board imported: ${a.name}`),i?.(a)}catch(e){p(`Import failed: ${e instanceof Error?e.message:String(e)}`)}},pe=(0,W.jsx)(B.Item,{label:`Custom Context (JSON)`,name:`custom_context`,help:`Add custom fields for use in zone trigger templates (e.g., {{ board.context.yourField }})`,rules:[{validator:KH}],children:(0,W.jsx)(GH,{placeholder:`{"team": "Backend", "sprint": 42}`,rows:4})}),me=(0,U.useMemo)(()=>hs(ds(t,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})).filter(e=>E===`active`?!e.archived:E===`archived`?e.archived:!0),k,[e=>e.name,e=>e.slug,e=>e.description,e=>e.board_id]),[t,E,k]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Create and manage boards for organizing sessions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:E,onChange:e=>O(e),style:{width:120},options:[{value:`active`,label:`Active`},{value:`all`,label:`All`},{value:`archived`,label:`Archived`}]}),(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, slug, description, or ID`,value:k,onChange:e=>A(e.target.value),style:{width:300}}),(0,W.jsx)(V,{icon:(0,W.jsx)(Ae,{}),onClick:ue,children:`Import Board`}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>h(!0),children:`New Board`})]})]}),(0,W.jsx)(D,{dataSource:me,columns:[{title:`Icon`,dataIndex:`icon`,key:`icon`,width:80,render:e=>(0,W.jsx)(`span`,{style:{fontSize:24},children:e||`📋`})},{title:`Name`,dataIndex:`name`,key:`name`,render:e=>(0,W.jsx)(vs,{text:e,query:k})},{title:`Description`,dataIndex:`description`,key:`description`,render:e=>(0,W.jsx)(s.Text,{type:`secondary`,children:e?(0,W.jsx)(vs,{text:e,query:k}):`—`})},{title:`Sessions`,key:`sessions`,width:100,render:(e,t)=>N.get(t.board_id)||0},{title:`Actions`,key:`actions`,width:280,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(uB,{archived:!!t.archived,tooltip:t.archived?`Archived • Click to unarchive`:`Archive board`,stopPropagation:!1,onToggle:e=>{e?l?.(t.board_id):u?.(t.board_id)}}),(0,W.jsx)(o,{title:`Clone board (zones, configuration, and positions only)`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(We,{}),onClick:()=>ce(t)})}),(0,W.jsx)(o,{title:`Export board to YAML (zones, configuration, and positions only)`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(oe,{}),onClick:()=>le(t)})}),(0,W.jsx)(o,{title:`Edit board settings`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>ae(t)})}),(0,W.jsx)(ee,{title:`Delete board?`,description:`Are you sure you want to delete "${t.name}"? Sessions will not be deleted.`,onConfirm:()=>se(t.board_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(o,{title:`Delete board (sessions will not be deleted)`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0})})})]})}],rowKey:`board_id`,pagination:!1,size:`small`,onRow:e=>({style:e.archived?{opacity:.5}:void 0})}),(0,W.jsx)(it,{title:`Create Board`,open:m,width:760,onOk:re,onCancel:()=>{j.resetFields(),h(!1)},okText:`Create`,children:(0,W.jsx)(B,{form:j,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(WH,{form:j,extra:pe})})}),(0,W.jsx)(it,{title:`Edit Board`,open:g,width:760,onOk:F,onCancel:()=>{j.resetFields(),_(!1),y(null)},okText:`Save`,children:(0,W.jsx)(B,{form:j,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(WH,{form:j,extra:pe,initialCustomCSS:HH(v?.background_color)||!!v?.custom_css,rbacEnabled:b,allUsers:S,allGroups:w},v?.board_id)})})]})};function JH(e){return typeof e==`string`&&vn.includes(e)}function YH(e){let t=Array.isArray(e?.allowedModes)?e.allowedModes.filter(JH):[...vn],n=t.length>0?t:[...vn],r=JH(e?.defaultMode)?e.defaultMode:wn;return{defaultMode:n.includes(r)?r:n[0],allowedModes:n}}function XH(e,t){let n=YH(t);return JH(e)&&n.allowedModes.includes(e)?e:n.defaultMode}function ZH(e){return e===`worktree`?`Worktree`:`Clone`}var QH=100,$H=({repoById:e,boardById:t=new Map,selectedRepoId:n,onRepoChange:r,defaultBranch:i,fieldPrefix:a=``,showUrlFields:c=!1,showBoardSelector:l=!1,requireBoard:u=!1,onFormChange:f,useSameBranchName:p,onUseSameBranchNameChange:m,branchStorageConfig:h})=>{let[g,_]=(0,U.useState)(!0),[v,y]=(0,U.useState)(`branch`),b=p??g,x=m??_,S=B.useFormInstance(),C=`${a}storage_mode`,{defaultMode:w,allowedModes:T}=(0,U.useMemo)(()=>YH(h),[h]),E=(0,U.useRef)(void 0);(0,U.useEffect)(()=>{let e=S.getFieldValue(C),t=E.current;(!e||!T.includes(e)||t!==void 0&&e===t&&e!==w)&&S.setFieldValue(C,w),E.current=w},[T,w,S,C]);let D=e=>{x(e),e&&S.setFieldValue(`${a}branchName`,void 0),f?.()};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{name:`${a}repoId`,label:`Repository`,rules:[{required:!0,message:`Please select a repository`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(P,{placeholder:`Select repository...`,showSearch:!0,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(e.toLowerCase()),options:us(e).sort((e,t)=>(e.name||e.slug).localeCompare(t.name||t.slug)).map(e=>({value:e.repo_id,label:e.name||e.slug})),onChange:r})}),l&&(0,W.jsx)(B.Item,{name:`${a}boardId`,label:`Board`,tooltip:`Branches are created on a board and align with that board's default permissions`,rules:u?[{required:!0,message:`Please select a board`}]:void 0,validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(P,{placeholder:`Select board...`,allowClear:!u,showSearch:!0,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(e.toLowerCase()),options:us(t).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:e.board_id,label:`${e.icon||`📋`} ${e.name}`})),onChange:f})}),(0,W.jsx)(B.Item,{name:`${a}refType`,label:`Source Type`,initialValue:`branch`,children:(0,W.jsxs)(d.Group,{onChange:e=>{y(e.target.value),e.target.value===`tag`?S.setFieldValue(`${a}sourceBranch`,void 0):S.setFieldValue(`${a}sourceBranch`,i),f?.()},children:[(0,W.jsx)(d,{value:`branch`,children:`Branch`}),(0,W.jsx)(d,{value:`tag`,children:`Tag`})]})}),(0,W.jsx)(B.Item,{name:`${a}sourceBranch`,label:v===`branch`?`Source Branch`:`Source Tag`,rules:[{required:!0,message:`Please enter source ${v}`}],validateTrigger:[`onBlur`,`onChange`],tooltip:`${v} to use as base for the new branch`,initialValue:i,children:(0,W.jsx)(L,{placeholder:v===`branch`?i:`v1.0.0`})}),(0,W.jsx)(B.Item,{name:`${a}name`,label:`Branch Name`,rules:[{required:!0,message:`Please enter a branch name`},{pattern:/^[a-z0-9-]+$/,message:`Only lowercase letters, numbers, and hyphens allowed`}],validateTrigger:[`onBlur`,`onChange`],tooltip:`URL-friendly name (e.g., 'feat-auth', 'fix-cors')`,children:(0,W.jsx)(L,{placeholder:`feat-auth`,autoFocus:!0})}),(0,W.jsx)(B.Item,{children:(0,W.jsx)(vt,{checked:b,onChange:e=>D(e.target.checked),children:v===`tag`?`Use the same name for the git branch (new branch from tag)`:`Use the same name for the git branch`})}),!b&&(0,W.jsx)(B.Item,{name:`${a}branchName`,label:`Git Branch Name`,rules:[{required:!0,message:`Please enter a git branch name`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(L,{placeholder:`feature/auth`})}),(0,W.jsx)(B.Item,{name:C,label:`Storage`,initialValue:w,tooltip:`How the branch is materialised on disk. "Worktree" uses git's native shared-base model (legacy default). "Clone" gives this branch its own .git/ directory via a real git clone — credentials and config are isolated from sibling branches. See context/explorations/clone-redesign.md.`,extra:T.length===1?`${ZH(T[0])} is the only storage mode enabled on this Agor instance. Administrators configure this with execution.branch_storage.allowed_modes.`:`Default on this Agor instance: ${ZH(w)}.`,children:(0,W.jsx)(d.Group,{onChange:()=>f?.(),children:vn.map(e=>{let t=!T.includes(e),n=e===w?` (default)`:``,r=`${ZH(e)}${n}`;return(0,W.jsx)(o,{title:t?`${ZH(e)} storage is disabled on this Agor instance by execution.branch_storage.allowed_modes.`:void 0,children:(0,W.jsx)(`span`,{children:(0,W.jsx)(d,{value:e,disabled:t,children:r})})},e)})})}),(0,W.jsx)(B.Item,{shouldUpdate:(e,t)=>e[`${a}storage_mode`]!==t[`${a}storage_mode`],noStyle:!0,children:({getFieldValue:e})=>e(`${a}storage_mode`)===`clone`?(0,W.jsx)(B.Item,{name:`${a}clone_depth`,label:`Depth`,initialValue:QH,tooltip:"Number of commits to keep (`git clone --depth N`). Defaults to 100 — usually plenty for a feature branch. Leave empty for a full clone with complete history.",rules:[{validator:(e,t)=>t==null||t===``||Number.isInteger(t)&&t>0?Promise.resolve():Promise.reject(Error(`Depth must be a positive integer, or empty for a full clone`))}],children:(0,W.jsx)(tt,{min:1,placeholder:`100`,style:{width:160},onChange:()=>f?.()})}):null}),c&&(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(B.Item,{name:`${a}issue_url`,label:`Issue URL (optional)`,rules:[{type:`url`,message:`Please enter a valid URL`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(L,{placeholder:`https://github.com/org/repo/issues/123`})}),(0,W.jsx)(B.Item,{name:`${a}pull_request_url`,label:`Pull Request URL (optional)`,rules:[{type:`url`,message:`Please enter a valid URL`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(L,{placeholder:`https://github.com/org/repo/pull/123`})})]}),(0,W.jsxs)(s.Paragraph,{type:`secondary`,style:{marginTop:16},children:[(0,W.jsx)(`strong`,{children:`What will happen:`}),(0,W.jsx)(`br`,{}),`• Fetch latest from origin`,(0,W.jsx)(`br`,{}),`• Create new branch`,` `,(0,W.jsx)(s.Text,{code:!0,children:b?`<name>`:`<git-branch-name>`}),` `,`based on `,v===`tag`?`tag`:`branch`,` `,(0,W.jsx)(s.Text,{code:!0,children:S.getFieldValue(`${a}sourceBranch`)||(v===`tag`?`<tag-name>`:i)}),(0,W.jsx)(`br`,{}),`• Branch location:`,` `,(0,W.jsxs)(s.Text,{code:!0,children:[`~/.agor/worktrees/`,`<repo>`,`/`,(0,W.jsx)(s.Text,{italic:!0,children:`<name>`})]})]})]})};function eU(e){if(e.environment){let t=sn(e.environment,e.environment.default);if(t)return{start:t.start,stop:t.stop,nuke:t.nuke,logs:t.logs,health:t.health,app:t.app,hasConfig:!!(t.start||t.stop)}}let t=e.environment_config;return t?{start:t.up_command,stop:t.down_command,nuke:t.nuke_command,logs:t.logs_command,health:t.health_check?.url_template,app:t.app_url_template,hasConfig:!!(t.up_command||t.down_command)}:{hasConfig:!1}}function tU(e,t){let n=e.environment_instance?.status,r=e.environment_instance?.last_health_check?.status;return!n||n===`stopped`?(0,W.jsx)(o,{title:`Environment stopped`,children:(0,W.jsx)(_,{style:{color:t.colorTextDisabled}})}):n===`starting`||n===`stopping`?(0,W.jsx)(o,{title:`Environment ${n}`,children:(0,W.jsx)(C,{style:{color:t.colorPrimary}})}):n===`error`?(0,W.jsx)(o,{title:`Error: ${e.environment_instance?.last_health_check?.message||`Unknown`}`,children:(0,W.jsx)(Ye,{style:{color:t.colorError}})}):n===`running`?r===`healthy`?(0,W.jsx)(o,{title:`Running (healthy)`,children:(0,W.jsx)(Re,{style:{color:t.colorSuccess}})}):r===`unhealthy`?(0,W.jsx)(o,{title:`Running (unhealthy): ${e.environment_instance?.last_health_check?.message||``}`,children:(0,W.jsx)(Xe,{style:{color:t.colorWarning}})}):(0,W.jsx)(o,{title:`Running`,children:(0,W.jsx)(h,{status:`processing`})}):null}function nU(e,t,n,r){let i=e.environment_instance?.status,o=e.environment_instance?.last_health_check?.status,s=!!(t?eU(t):void 0)?.hasConfig,c=i===`running`||i===`starting`||o===`healthy`,l=e.health_check_url;return(0,W.jsxs)(z,{size:4,children:[tU(e,n),s&&t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(a,{}),disabled:c,onClick:t=>{t.stopPropagation(),r.onStartEnvironment?.(e.branch_id)},style:{padding:`0 4px`}}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ae,{}),onClick:t=>{t.stopPropagation(),r.onStopEnvironment?.(e.branch_id)},style:{padding:`0 4px`}}),l&&(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(Se,{}),onClick:e=>{e.stopPropagation(),window.open(l,`_blank`)},style:{padding:`0 4px`}})]})]})}var rU=({client:e,branchById:t,repoById:n,boardById:r,sessionsByBranch:i,onArchiveOrDelete:a,onUnarchive:c,onCreate:l,onRowClick:u,onStartEnvironment:d,onStopEnvironment:f,onClose:p,branchStorageConfig:h})=>{let _=us(n),v=us(r),{token:y}=ce.useToken(),b=jH({boardById:r,branchById:t}),x=(0,U.useCallback)(e=>{p?.(),b.goToBranch(e.branch_id)},[p,b]),[S,C]=(0,U.useState)(!1),[w]=B.useForm(),[T,O]=(0,U.useState)(!0),[k,A]=(0,U.useState)(null),[ee,j]=(0,U.useState)(!1),[M,N]=(0,U.useState)(``),[te,re]=(0,U.useState)(`active`),[ae,oe]=(0,U.useState)(!1),[F,se]=(0,U.useState)(null),[le,ue]=(0,U.useState)(`archive`),[pe,me]=(0,U.useState)([]),[he,ge]=(0,U.useState)(!1),[_e,ve]=(0,U.useState)(!1),ye=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(te!==`archived`&&te!==`all`||he||ye.current||!e)return;let t=!1;return ye.current=!0,ve(!0),e.service(`branches`).findAll({query:{archived:!0,$limit:1e3,$sort:{created_at:-1}}}).then(e=>{t||(me(e),ge(!0))}).catch(()=>{}).finally(()=>{ye.current=!1,t||ve(!1)}),()=>{t=!0}},[te,he,e]);let be=(0,U.useCallback)(()=>{let e=w.getFieldsValue(),t=!!e.repoId,n=!!e.sourceBranch,r=!!e.name&&/^[a-z0-9-]+$/.test(e.name),i=T||!!e.branchName,a=!!e.boardId;j(t&&n&&r&&i&&a)},[w,T]),I=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(!S){I.current=!1;return}if(I.current||_.length===0)return;I.current=!0;let e=localStorage.getItem(`agor:lastUsedRepoId`),t=localStorage.getItem(`agor:lastUsedBoardId`),n=e&&_.find(t=>t.repo_id===e)?e:_[0].repo_id,r=t&&v.find(e=>e.board_id===t)?t:v.length>0?v[0].board_id:void 0;w.setFieldsValue({repoId:n,boardId:r,sourceBranch:_.find(e=>e.repo_id===n)?.default_branch||`main`}),A(n),be()},[S,_,v,w,be]);let xe=e=>n.get(e)?.name||`Unknown Repo`,Se=()=>k&&_.find(e=>e.repo_id===k)?.default_branch||`main`,Ce=e=>{A(e);let t=_.find(t=>t.repo_id===e)?.default_branch||`main`;w.setFieldValue(`sourceBranch`,t)},we=async(e,n)=>{try{await a?.(e,n)}catch{return}if(n.metadataAction===`archive`){let n=t.get(e)||pe.find(t=>t.branch_id===e);if(n){let t={...n,archived:!0,archived_at:new Date().toISOString()};me(n=>{let r=n.findIndex(t=>t.branch_id===e);if(r===-1)return[t,...n];let i=[...n];return i[r]=t,i})}return}me(t=>t.filter(t=>t.branch_id!==e))},Te=async()=>{try{let e=await w.validateFields(),t=T?e.name:e.branchName;localStorage.setItem(`agor:lastUsedRepoId`,e.repoId),e.boardId&&localStorage.setItem(`agor:lastUsedBoardId`,e.boardId);let n=XH(e.storage_mode,h),r=n===`clone`&&typeof e.clone_depth==`number`&&e.clone_depth>0?e.clone_depth:void 0;l?.(e.repoId,{name:e.name,ref:t,createBranch:!0,sourceBranch:e.sourceBranch,pullLatest:!0,boardId:e.boardId,storage_mode:n,...r===void 0?{}:{clone_depth:r}}),C(!1),w.resetFields(),O(!0),A(null)}catch(e){console.error(`Validation failed:`,e)}},Ee=()=>{C(!1),w.resetFields(),O(!0),A(null),j(!1)},De=[{title:`Name`,dataIndex:`name`,key:`name`,render:(e,t)=>(0,W.jsxs)(z,{children:[dn(t)?(0,W.jsx)(m,{style:{color:y.colorInfo}}):(0,W.jsx)(ft,{}),(0,W.jsx)(s.Text,{strong:!0,children:(0,W.jsx)(vs,{text:e,query:M})})]})},{title:`Env`,key:`env`,width:120,align:`center`,render:(e,t)=>nU(t,_.find(e=>e.repo_id===t.repo_id),y,{onStartEnvironment:d,onStopEnvironment:f})},{title:`Repo`,dataIndex:`repo_id`,key:`repo_id`,render:e=>(0,W.jsxs)(z,{children:[(0,W.jsx)(de,{}),(0,W.jsx)(s.Text,{children:(0,W.jsx)(vs,{text:xe(e),query:M})})]})},{title:`Branch`,dataIndex:`ref`,key:`ref`,render:e=>(0,W.jsx)(s.Text,{code:!0,children:(0,W.jsx)(vs,{text:e,query:M})})},{title:`Sessions`,key:`sessions`,width:100,render:(e,t)=>{let n=(i.get(t.branch_id)||[]).length;return(0,W.jsxs)(s.Text,{type:`secondary`,children:[n,` `,n===1?`session`:`sessions`]})}},{title:`Path`,key:`path`,width:60,align:`center`,render:(e,t)=>(0,W.jsx)(s.Text,{copyable:{text:t.path,tooltips:[`Copy path: ${t.path}`,`Copied!`]}})},{title:`Actions`,key:`actions`,width:160,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[!t.archived&&t.board_id&&(0,W.jsx)(o,{title:`Center map on branch`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(g,{}),onClick:e=>{e.stopPropagation(),x(t)}})}),(0,W.jsx)(uB,{archived:t.archived,onToggle:e=>{if(!e){Promise.resolve(c?.(t.branch_id,t.board_id?{boardId:t.board_id}:void 0)).then(()=>{me(e=>e.map(e=>e.branch_id===t.branch_id?{...e,archived:!1,archived_at:void 0,archived_by:void 0}:e))}).catch(()=>{});return}se(t),ue(`archive`),oe(!0)}}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:e=>{e.stopPropagation(),u?.(t)}}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0,onClick:e=>{e.stopPropagation(),se(t),ue(`delete`),oe(!0)}})]})}],Oe=(0,U.useMemo)(()=>{let e=M.trim().toLowerCase(),r=Array.from(t.values()),i=new Map;for(let e of r)i.set(e.branch_id,e);for(let e of pe)i.has(e.branch_id)||i.set(e.branch_id,e);let a=Array.from(i.values()).sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()),o=a;return te===`active`?o=a.filter(e=>!e.archived):te===`archived`?o=a.filter(e=>e.archived):te===`assistants`&&(o=a.filter(e=>!e.archived&&dn(e))),e?o.filter(t=>{let r=n.get(t.repo_id);return[t.name,t.ref,t.path,String(t.branch_unique_id),r?.name,r?.slug].some(t=>t==null?!1:t.toString().toLowerCase().includes(e))}):o},[te,pe,n,M,t]),ke=t.size>0||pe.length>0;return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(z,{orientation:`vertical`,size:y.sizeUnit*2,style:{marginBottom:y.sizeUnit*2,width:`100%`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Manage git branches for isolated development contexts across sessions.`}),(0,W.jsxs)(z,{style:{width:`100%`,display:`flex`,justifyContent:`space-between`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search by name, repo, slug, path, or ID`,value:M,onChange:e=>N(e.target.value),style:{maxWidth:y.sizeUnit*40}}),(0,W.jsx)(P,{value:te,onChange:e=>re(e),loading:_e&&(te===`archived`||te===`all`),style:{width:120},options:[{value:`active`,label:`Active`},{value:`assistants`,label:`Assistants`},{value:`all`,label:`All`},{value:`archived`,label:`Archived`}]})]}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>C(!0),disabled:_.length===0,children:`Create Branch`})]})]}),_.length===0&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(E,{description:`No repositories configured`,children:(0,W.jsx)(s.Text,{type:`secondary`,children:`Create a repository first in the Repositories tab to enable branches.`})})}),_.length>0&&!ke&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(E,{description:`No branches yet`,children:(0,W.jsx)(s.Text,{type:`secondary`,children:`Branches will appear here once created from sessions or the CLI.`})})}),ke&&(0,W.jsx)(D,{dataSource:Oe,columns:De,rowKey:`branch_id`,pagination:{pageSize:10},size:`small`,onRow:e=>({onClick:()=>u?.(e),style:{cursor:u?`pointer`:`default`}})}),(0,W.jsx)(it,{title:`Create Branch`,open:S,onOk:Te,onCancel:Ee,okText:`Create`,okButtonProps:{disabled:!ee},children:(0,W.jsx)(B,{form:w,layout:`vertical`,onFieldsChange:be,children:(0,W.jsx)($H,{repoById:n,boardById:r,selectedRepoId:k,onRepoChange:Ce,defaultBranch:Se(),showBoardSelector:!0,requireBoard:!0,onFormChange:be,useSameBranchName:T,onUseSameBranchNameChange:O,branchStorageConfig:h})})}),F&&(0,W.jsx)(pB,{open:ae,branch:F,sessionCount:(i.get(F.branch_id)||[]).length,environmentRunning:F.environment_instance?.status===`running`,initialMetadataAction:le,onConfirm:e=>{we(F.branch_id,e),oe(!1),se(null),ue(`archive`)},onCancel:()=>{oe(!1),se(null),ue(`archive`)}})]})};function iU(e){try{let t=new URL(e);return[`http:`,`https:`,`mailto:`].includes(t.protocol)}catch{return!1}}var{TextArea:aU}=L,oU=U.memo(({open:e,card:t,board:n,zoneName:r,zoneColor:i,client:a,onClose:o,onCardUpdated:c,onCardDeleted:l})=>{let{token:d}=ce.useToken(),{showSuccess:f,showError:m}=mn(),[h,g]=(0,U.useState)(!1),[_,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(!1);(0,U.useEffect)(()=>{t&&(x(t.note||``),C(t.description||``),g(!1),y(!1))},[t]);let E=b!==(t?.note||``)||S!==(t?.description||``),D=(0,U.useCallback)(async()=>{if(!(!t||!a||!E)){T(!0);try{let e=await a.service(`cards`).patch(t.card_id,{note:b,description:S});c?.(e),g(!1),y(!1),f(`Card saved`)}catch(e){console.error(`Failed to save card:`,e),m(`Failed to save card`)}finally{T(!1)}}},[t,a,b,S,E,c,f,m]),O=(0,U.useCallback)(async()=>{!t||!a||it.confirm({title:`Archive card?`,content:`This will hide "${t.title}" from the board while preserving its data.`,okText:`Archive`,onOk:async()=>{try{let e=await a.service(`cards`).patch(t.card_id,{archived:!0,archived_at:new Date().toISOString()});c?.(e),o(),f(`Card archived`)}catch(e){console.error(`Failed to archive card:`,e),m(`Failed to archive card`)}}})},[t,a,c,o,f,m]),k=(0,U.useCallback)(async()=>{!t||!a||it.confirm({title:`Delete card?`,content:`This will permanently delete "${t.title}".`,okText:`Delete`,okType:`danger`,onOk:async()=>{try{await a.service(`cards`).remove(t.card_id),l?.(t.card_id),o(),f(`Card deleted`)}catch(e){console.error(`Failed to delete card:`,e),m(`Failed to delete card`)}}})},[t,a,l,o,f,m]);if(!t)return null;let A=t.effective_emoji,ee=t.effective_color||d.colorBorder;return(0,W.jsxs)(it,{open:e,onCancel:o,width:560,footer:(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(dB,{tooltip:``,size:`middle`,onClick:O,children:`Archive`}),(0,W.jsx)(V,{danger:!0,icon:(0,W.jsx)(ie,{}),onClick:k,children:`Delete`})]}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(u,{}),onClick:D,disabled:!E,loading:w,children:`Save`})]}),title:null,styles:{body:{padding:0}},children:[(0,W.jsxs)(`div`,{style:{padding:`16px 24px`,borderBottom:`1px solid ${d.colorBorderSecondary}`,borderLeft:`4px solid ${ee}`,display:`flex`,alignItems:`center`,gap:10},children:[A&&(0,W.jsx)(`span`,{style:{fontSize:20},children:A}),(0,W.jsx)(s.Title,{level:5,style:{margin:0,flex:1},children:t.title}),t.url&&iU(t.url)&&(0,W.jsxs)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,style:{color:d.colorLink},children:[`Open `,(0,W.jsx)(ve,{})]})]}),(0,W.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${d.colorBorderSecondary}`,display:`flex`,flexWrap:`wrap`,gap:8},children:[t.card_type&&(0,W.jsxs)(v,{children:[t.card_type.emoji&&`${t.card_type.emoji} `,t.card_type.name]}),n&&(0,W.jsxs)(v,{children:[n.icon?`${n.icon} `:``,n.name]}),r&&(0,W.jsx)(v,{icon:(0,W.jsx)(p,{style:i?{color:i}:void 0}),children:r})]}),(0,W.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${d.colorBorderSecondary}`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:12,color:d.colorTextSecondary},children:`Note`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>g(!h),children:h?`Preview`:`Edit`})]}),h?(0,W.jsx)(aU,{value:b,onChange:e=>x(e.target.value),placeholder:`Agent's live commentary...`,autoSize:{minRows:2,maxRows:8},style:{background:d.colorFillQuaternary}}):b?(0,W.jsx)(`div`,{style:{background:d.colorFillQuaternary,borderRadius:d.borderRadiusSM,padding:`8px 12px`},children:(0,W.jsx)(nB,{content:b,compact:!0,showControls:!1})}):(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,fontStyle:`italic`},children:`No note`})]}),(0,W.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${d.colorBorderSecondary}`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:12,color:d.colorTextSecondary},children:`Description`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>y(!_),children:_?`Preview`:`Edit`})]}),_?(0,W.jsx)(aU,{value:S,onChange:e=>C(e.target.value),placeholder:`Stable context about this entity...`,autoSize:{minRows:3,maxRows:12}}):S?(0,W.jsx)(nB,{content:S,compact:!0,showControls:!1}):(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,fontStyle:`italic`},children:`No description`})]}),t.data&&Object.keys(t.data).length>0&&(0,W.jsx)(`div`,{style:{padding:`0 24px 12px`},children:(0,W.jsx)(ue,{ghost:!0,items:[{key:`data`,label:(0,W.jsx)(s.Text,{strong:!0,style:{fontSize:12,color:d.colorTextSecondary},children:`Data`}),children:(0,W.jsx)(`pre`,{style:{background:d.colorFillQuaternary,borderRadius:d.borderRadiusSM,padding:`8px 12px`,fontSize:11,overflow:`auto`,maxHeight:300,margin:0},children:JSON.stringify(t.data,null,2)})}]})}),(0,W.jsxs)(`div`,{style:{padding:`8px 24px 12px`,color:d.colorTextTertiary,fontSize:11},children:[t.created_by&&`Created by: ${t.created_by}`,t.created_at&&` • ${new Date(t.created_at).toLocaleString()}`]})]})}),sU=({avatar:e,title:t,description:n,style:r})=>(0,W.jsxs)(`div`,{style:{display:`flex`,flex:1,alignItems:`flex-start`,maxWidth:`100%`,...r},children:[e!=null&&(0,W.jsx)(`div`,{style:{marginInlineEnd:16,flexShrink:0},children:e}),(0,W.jsxs)(`div`,{style:{flex:`1 0`,minWidth:0},children:[t!=null&&(0,W.jsx)(`div`,{style:{marginBottom:4},children:t}),n!=null&&(0,W.jsx)(`div`,{children:n})]})]}),{Sider:cU,Content:lU}=we,uU=({client:e,cardById:t,cardTypeById:n,boardById:r,boardObjects:i})=>{let{token:a}=ce.useToken(),{showSuccess:o,showError:c}=mn(),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w]=B.useForm(),T=(0,U.useMemo)(()=>us(n).sort((e,t)=>e.name.localeCompare(t.name)),[n]),O=(0,U.useMemo)(()=>hs(T,b,[e=>e.name,e=>e.emoji,e=>JSON.stringify(e.json_schema??{})]),[T,b]),k=(0,U.useMemo)(()=>{let e=new Map;if(!i)return e;for(let t of i){if(!t.card_id||!t.zone_id)continue;let n=r.get(t.board_id)?.objects?.[t.zone_id];n&&n.type===`zone`&&e.set(t.card_id,{zoneName:n.label||`Unknown Zone`,zoneColor:n.borderColor||n.color})}return e},[i,r]),A=l?n.get(l)??null:null,j=(0,U.useMemo)(()=>l?hs(us(t).filter(e=>e.card_type_id===l&&!e.archived).sort((e,t)=>e.title.localeCompare(t.title)),S,[e=>e.title,e=>{let t=r.get(e.board_id);return[t?.name,t?.slug,e.board_id]},e=>k.get(e.card_id)?.zoneName,e=>JSON.stringify(e.data??{})]):[],[t,l,S,r,k]),M=async()=>{if(e)try{let t=await w.validateFields(),n=typeof t.color==`string`?t.color:t.color?.toHexString?.()??void 0;await e.service(`card-types`).create({name:t.name,emoji:t.emoji||void 0,color:n||void 0,json_schema:t.json_schema?JSON.parse(t.json_schema):void 0}),w.resetFields(),f(!1),o(`Card type created`)}catch(e){if(e&&typeof e==`object`&&`errorFields`in e)return;console.error(`Failed to create card type:`,e),c(`Failed to create card type`)}},N=async()=>{if(!(!e||!g))try{let t=await w.validateFields(),n=typeof t.color==`string`?t.color:t.color?.toHexString?.()??void 0;await e.service(`card-types`).patch(g.card_type_id,{name:t.name,emoji:t.emoji||void 0,color:n||void 0,json_schema:t.json_schema?JSON.parse(t.json_schema):void 0}),w.resetFields(),h(!1),_(null),o(`Card type updated`)}catch(e){if(e&&typeof e==`object`&&`errorFields`in e)return;console.error(`Failed to update card type:`,e),c(`Failed to update card type`)}},te=async t=>{if(e)try{await e.service(`card-types`).remove(t),l===t&&u(null),o(`Card type deleted`)}catch(e){console.error(`Failed to delete card type:`,e),c(`Failed to delete card type`)}},P=e=>{_(e),w.setFieldsValue({name:e.name,emoji:e.emoji,color:e.color,json_schema:e.json_schema?JSON.stringify(e.json_schema,null,2):``}),h(!0)},re=[{title:`Title`,dataIndex:`title`,key:`title`,render:(e,t)=>(0,W.jsxs)(z,{children:[t.effective_emoji&&(0,W.jsx)(`span`,{children:t.effective_emoji}),(0,W.jsx)(s.Text,{children:(0,W.jsx)(vs,{text:e,query:S})})]})},{title:`Board`,dataIndex:`board_id`,key:`board`,width:180,render:e=>{let t=r.get(e);return(0,W.jsx)(s.Text,{type:`secondary`,children:t?(0,W.jsx)(vs,{text:`${t.icon?`${t.icon} `:``}${t.name}`,query:S}):`—`})}},{title:`Zone`,key:`zone`,width:180,render:(e,t)=>{let n=k.get(t.card_id);return n?(0,W.jsxs)(z,{size:4,children:[n.zoneColor&&(0,W.jsx)(p,{style:{color:n.zoneColor,fontSize:12}}),(0,W.jsx)(s.Text,{style:{fontSize:13},children:(0,W.jsx)(vs,{text:n.zoneName,query:S})})]}):(0,W.jsx)(s.Text,{type:`secondary`,children:`—`})}}],ae=v?r.get(v.board_id)??null:null,oe=e=>{y(e)},F=e=>{y(null)},se=(0,W.jsxs)(B,{form:w,layout:`vertical`,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{label:`Name`,style:{marginBottom:24},children:(0,W.jsxs)(Ve,{gap:8,children:[(0,W.jsx)(B.Item,{name:`emoji`,noStyle:!0,children:(0,W.jsx)(Yi,{form:w,fieldName:`emoji`,defaultEmoji:`📋`})}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,rules:[{required:!0,message:`Name is required`}],children:(0,W.jsx)(L,{placeholder:`e.g. Support Ticket`,style:{flex:1}})})]})}),(0,W.jsx)(B.Item,{name:`color`,label:`Color`,children:(0,W.jsx)(Pe,{showText:!0,format:`hex`,allowClear:!0})}),(0,W.jsx)(B.Item,{name:`json_schema`,label:`JSON Schema (optional)`,help:`Define a JSON Schema to validate card data`,rules:[{validator:KH}],children:(0,W.jsx)(GH,{placeholder:`{"type": "object", "properties": {...}}`,rows:4})})]});return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(s.Title,{level:5,style:{margin:0},children:`Cards`}),(0,W.jsx)(`span`,{style:{fontSize:11,fontWeight:600,padding:`1px 6px`,borderRadius:4,background:a.colorWarningBg,color:a.colorWarningText,border:`1px solid ${a.colorWarningBorder}`},children:`Beta`})]}),(0,W.jsx)(s.Text,{type:`secondary`,children:`Manage card types and view cards across all boards`})]}),(0,W.jsxs)(we,{style:{background:`transparent`,height:`calc(100% - 60px)`,minHeight:400},children:[(0,W.jsxs)(cU,{width:260,style:{background:a.colorBgElevated,borderRadius:a.borderRadiusLG,border:`1px solid ${a.colorBorderSecondary}`,overflow:`auto`,marginRight:16},children:[(0,W.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid ${a.colorBorderSecondary}`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{strong:!0,children:`Card Types`}),(0,W.jsx)(V,{type:`primary`,size:`small`,icon:(0,W.jsx)(fe,{}),onClick:()=>{w.resetFields(),f(!0)},children:`New`})]}),T.length>0&&(0,W.jsx)(`div`,{style:{padding:`8px 12px`},children:(0,W.jsx)(L,{allowClear:!0,size:`small`,placeholder:`Search types`,value:b,onChange:e=>x(e.target.value)})}),T.length===0?(0,W.jsx)(`div`,{style:{padding:24,textAlign:`center`},children:(0,W.jsx)(E,{image:E.PRESENTED_IMAGE_SIMPLE,description:`No card types yet`})}):O.map(e=>(0,W.jsxs)(`div`,{onClick:()=>u(e.card_type_id),style:{padding:`8px 16px`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:16,background:l===e.card_type_id?a.colorBgTextHover:`transparent`,borderLeft:l===e.card_type_id?`3px solid ${e.color||a.colorPrimary}`:`3px solid transparent`},children:[(0,W.jsx)(sU,{avatar:(0,W.jsx)(`span`,{style:{fontSize:18},children:e.emoji||`📋`}),title:(0,W.jsx)(s.Text,{style:{fontSize:13},ellipsis:!0,children:(0,W.jsx)(vs,{text:e.name,query:b})})}),(0,W.jsxs)(z,{size:`small`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:t=>{t.stopPropagation(),P(e)}}),(0,W.jsx)(ee,{title:`Delete card type?`,description:`Cards using this type will become untyped.`,onConfirm:t=>{t?.stopPropagation(),te(e.card_type_id)},onCancel:e=>e?.stopPropagation(),children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0,onClick:e=>e.stopPropagation()})})]})]},e.card_type_id))]}),(0,W.jsx)(lU,{style:{minWidth:0},children:A?(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:12,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{style:{fontSize:20},children:A.emoji||`📋`}),(0,W.jsx)(s.Title,{level:5,style:{margin:0},children:A.name}),(0,W.jsxs)(s.Text,{type:`secondary`,children:[`(`,j.length,` card`,j.length===1?``:`s`,`)`]})]}),(0,W.jsx)(L,{allowClear:!0,placeholder:`Search title, board, zone, or data`,value:S,onChange:e=>C(e.target.value),style:{width:300}})]}),(0,W.jsx)(D,{dataSource:j,columns:re,rowKey:`card_id`,size:`small`,pagination:{pageSize:20,hideOnSinglePage:!0},onRow:e=>({onClick:()=>y(e),style:{cursor:`pointer`}}),locale:{emptyText:(0,W.jsx)(E,{image:E.PRESENTED_IMAGE_SIMPLE,description:`No cards of this type yet`})}})]}):(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,minHeight:300},children:(0,W.jsx)(E,{image:E.PRESENTED_IMAGE_SIMPLE,description:T.length===0?`Create a card type to get started`:`Select a card type to view its cards`})})})]}),(0,W.jsx)(it,{title:`Create Card Type`,open:d,onOk:M,onCancel:()=>{w.resetFields(),f(!1)},okText:`Create`,children:se}),(0,W.jsx)(it,{title:`Edit Card Type`,open:m,onOk:N,onCancel:()=>{w.resetFields(),h(!1),_(null)},okText:`Save`,children:se}),(0,W.jsx)(oU,{open:!!v,card:v,board:ae,client:e,onClose:()=>y(null),onCardUpdated:oe,onCardDeleted:F})]})},dU=({branchById:e,value:t,onChange:n,placeholder:r=`Select a branch`,disabled:i=!1,includeArchivedLabel:a=!0})=>(0,W.jsx)(P,{value:t,onChange:n,placeholder:r,disabled:i,showSearch:!0,optionFilterProp:`label`,options:(0,U.useMemo)(()=>Array.from(e.values()).sort((e,t)=>(e.name||e.ref||e.branch_id).localeCompare(t.name||t.ref||t.branch_id)).map(e=>({value:e.branch_id,label:`${e.name||e.ref||e.branch_id}${a&&e.archived?` (archived)`:``}`})),[a,e])}),fU=[{value:`slack`,label:`Slack`,icon:(0,W.jsx)(_t,{})},{value:`github`,label:`GitHub`,icon:(0,W.jsx)(De,{})},{value:`discord`,label:`Discord`,icon:(0,W.jsx)(T,{})},{value:`whatsapp`,label:`WhatsApp`,icon:(0,W.jsx)(T,{})},{value:`telegram`,label:`Telegram`,icon:(0,W.jsx)(T,{})}];function pU(e){switch(e){case`slack`:return(0,W.jsx)(_t,{});case`github`:return(0,W.jsx)(De,{});default:return(0,W.jsx)(T,{})}}function mU(e){switch(e){case`slack`:return`purple`;case`github`:return`default`;case`discord`:return`blue`;case`whatsapp`:return`green`;case`telegram`:return`cyan`;default:return`default`}}var hU=({icon:e,title:t,subtitle:n})=>(0,W.jsxs)(z,{size:`small`,children:[e,(0,W.jsxs)(`span`,{children:[(0,W.jsx)(s.Text,{strong:!0,children:t}),n&&(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,marginLeft:8},children:n})]})]}),gU=({userById:e,placeholder:t=`Select a user`})=>(0,W.jsx)(P,{placeholder:t,showSearch:!0,optionFilterProp:`children`,children:Array.from(e.values()).sort((e,t)=>(e.name||e.email||e.user_id).localeCompare(t.name||t.email||t.user_id)).map(e=>(0,W.jsx)(P.Option,{value:e.user_id,children:e.name||e.email||e.user_id},e.user_id))}),_U=e=>e?`align users`:`run as selected user`,vU=({alignFieldName:e,alignLabel:t,alignDescription:n,alignUsers:r,alignedContent:i,userById:a})=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Choose which Agor user identity gateway-created sessions run as.`}),(0,W.jsx)(B.Item,{name:e,initialValue:!1,children:(0,W.jsx)(d.Group,{style:{width:`100%`},children:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(d,{value:!0,children:(0,W.jsxs)(z,{orientation:`vertical`,size:0,children:[(0,W.jsx)(s.Text,{children:t}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:n})]})}),(0,W.jsx)(d,{value:!1,children:(0,W.jsxs)(z,{orientation:`vertical`,size:0,children:[(0,W.jsx)(s.Text,{children:`Run as selected user`}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Every message uses one configured Agor user.`})]})})]})})}),r?i:(0,W.jsx)(B.Item,{label:`Run as`,name:`agor_user_id`,rules:[{required:!0,message:`Please select a user`}],tooltip:`All sessions from this channel will run as this Agor user`,children:(0,W.jsx)(gU,{userById:a})})]}),yU=({value:e=[],onChange:t})=>{let n=(0,U.useRef)(0),r=(0,U.useRef)([]);for(;r.current.length<e.length;)r.current.push(n.current++);r.current.length>e.length&&(r.current.length=e.length);let i=()=>{r.current.push(n.current++),t?.([...e,{key:``,value:``,forceOverride:!1}])},a=(n,r,i)=>{let a=e.map((e,t)=>t===n?{...e,[r]:i}:e);t?.(a)},l=n=>{r.current.splice(n,1),t?.(e.filter((e,t)=>t!==n))};return(0,W.jsxs)(`div`,{children:[e.map((e,t)=>(0,W.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:8,alignItems:`flex-start`},children:[(0,W.jsx)(L,{placeholder:`KEY_NAME`,value:e.key,onChange:e=>a(t,`key`,e.target.value),style:{flex:`0 0 160px`,fontFamily:`monospace`,fontSize:12}}),e.value===`••••••••`?(0,W.jsx)(L,{placeholder:`click to replace value`,value:``,onFocus:()=>a(t,`value`,``),readOnly:!0,style:{flex:1,fontFamily:`monospace`,fontSize:12,color:`transparent`,textShadow:`0 0 6px rgba(255,255,255,0.5)`}}):(0,W.jsx)(L.Password,{placeholder:`value`,value:e.value,onChange:e=>a(t,`value`,e.target.value),style:{flex:1,fontFamily:`monospace`,fontSize:12}}),(0,W.jsx)(o,{title:`Force override: always use this value, even if the user has their own`,children:(0,W.jsx)(vt,{checked:e.forceOverride,onChange:e=>a(t,`forceOverride`,e.target.checked),style:{marginTop:5},children:(0,W.jsx)(s.Text,{style:{fontSize:11,whiteSpace:`nowrap`},children:`Force`})})}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0,onClick:()=>l(t),style:{marginTop:2}})]},r.current[t])),(0,W.jsx)(V,{type:`dashed`,size:`small`,icon:(0,W.jsx)(fe,{}),onClick:i,block:!0,children:`Add Variable`}),e.length>0&&(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:8},children:[(0,W.jsx)(c,{style:{marginRight:4}}),(0,W.jsx)(`strong`,{children:`Fallback`}),` (default): used only when the user hasn't set this key.`,` `,(0,W.jsx)(`strong`,{children:`Force`}),`: always overrides the user's value.`]})]})},bU=[{title:`Create App`},{title:`Credentials`},{title:`Configure`}],xU=({form:e,mode:t,channelType:n,onChannelTypeChange:r,branchById:i,userById:a,mcpServerById:o,selectedAgent:l,onAgentChange:u,editingChannel:d,onCopyKey:f,githubStep:p,onGithubStepChange:m,githubSetupParams:h,githubLoading:g,githubError:_})=>{let{showError:v}=mn(),y=B.useWatch(`enable_channels`,e)??!1,b=B.useWatch(`enable_groups`,e)??!1,x=B.useWatch(`enable_mpim`,e)??!1,E=B.useWatch(`require_mention`,e)??!0,D=B.useWatch(`align_slack_users`,e)??!1,O=B.useWatch(`github_align_users`,e)??!1,k=y||b||x;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Channel Type`,name:`channel_type`,initialValue:t===`create`?`slack`:void 0,rules:[{required:!0}],children:(0,W.jsx)(P,{onChange:e=>r(e),children:fU.map(e=>(0,W.jsx)(P.Option,{value:e.value,children:(0,W.jsxs)(z,{children:[e.icon,e.label]})},e.value))})}),(0,W.jsx)(B.Item,{label:`Name`,name:`name`,rules:[{required:!0,message:`Please enter a channel name`}],children:(0,W.jsx)(L,{placeholder:`e.g., Team Slack, Personal Discord`})}),(0,W.jsx)(B.Item,{label:`Target Branch`,name:`target_branch_id`,rules:[{required:!0,message:`Please select a target branch`}],tooltip:t===`create`?`New sessions from this channel will be created in this branch`:void 0,children:(0,W.jsx)(dU,{branchById:i})}),n!==`slack`&&n!==`github`&&(0,W.jsx)(B.Item,{label:`Post messages as`,name:`agor_user_id`,rules:[{required:!0,message:`Please select a user`}],tooltip:`Sessions from this channel will run as this Agor user`,children:(0,W.jsx)(gU,{userById:a})}),(0,W.jsx)(B.Item,{label:`Enabled`,name:`enabled`,valuePropName:`checked`,initialValue:t===`create`?!0:void 0,children:(0,W.jsx)(ye,{})}),n!==`slack`&&n!==`github`&&(0,W.jsx)(I,{title:`${n.charAt(0).toUpperCase()+n.slice(1)} support coming soon`,description:`This platform integration is not yet available. Slack and GitHub are currently supported.`,type:`info`,showIcon:!0,style:{marginBottom:16}}),n===`github`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(w,{current:p,size:`small`,items:bU,style:{marginBottom:24}}),g&&(0,W.jsxs)(`div`,{style:{textAlign:`center`,padding:`24px 0`},children:[(0,W.jsx)(Ee,{indicator:(0,W.jsx)(C,{spin:!0})}),(0,W.jsx)(s.Text,{type:`secondary`,style:{display:`block`,marginTop:8},children:`Loading GitHub App data...`})]}),_&&(0,W.jsx)(I,{type:`error`,showIcon:!0,title:`GitHub Setup Error`,description:_,style:{marginBottom:16}}),p===0&&!g&&t===`create`&&(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(s.Paragraph,{type:`secondary`,style:{fontSize:13},children:`Create a GitHub App to connect Agor to your repositories. This uses GitHub's URL-parameters registration flow — you'll be redirected to GitHub with the form pre-filled, then brought back here to complete setup.`}),(0,W.jsx)(B.Item,{label:`App Name`,name:`github_app_name`,children:(0,W.jsx)(L,{placeholder:`Agor (optional — defaults to 'Agor')`})}),(0,W.jsx)(B.Item,{label:`Target Organization`,name:`github_org`,tooltip:`Leave empty to create the app under your personal GitHub account`,children:(0,W.jsx)(L,{placeholder:`my-org (optional)`})}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(De,{}),block:!0,onClick:async()=>{let t=za(),n=new URLSearchParams,r=e.getFieldValue(`github_app_name`),i=e.getFieldValue(`github_org`);r&&n.set(`name`,r),i&&n.set(`org`,i);try{let e=localStorage.getItem(`agor-access-token`);if(!e){v(`You must be logged in as an admin to install the GitHub App.`);return}let r=await fetch(`${t}/api/github/setup/state`,{method:`POST`,headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`}});if(!r.ok){let e=await r.json().catch(()=>({}));v(typeof e?.error==`string`?e.error:`Failed to start GitHub App install (HTTP ${r.status})`);return}let{state:i}=await r.json();if(!i){v(`Daemon did not return an install state token.`);return}n.set(`state`,i),window.open(`${t}/api/github/setup/new?${n.toString()}`,`_blank`)}catch(e){v(e instanceof Error?e.message:`Failed to initiate GitHub App install`)}},children:`Create GitHub App on GitHub`}),(0,W.jsx)(V,{type:`default`,block:!0,onClick:()=>m(1),style:{marginTop:12},children:`I've created the app — enter credentials`})]}),p>=1&&!g&&(0,W.jsxs)(`div`,{style:{marginBottom:16,display:p===1?void 0:`none`},children:[(0,W.jsx)(I,{type:`info`,showIcon:!0,title:`Enter your GitHub App credentials`,description:(0,W.jsxs)(`span`,{children:[`On your GitHub App's settings page:`,(0,W.jsx)(`br`,{}),`1. Copy the `,(0,W.jsx)(`strong`,{children:`App ID`}),` (shown at the top under "About")`,(0,W.jsx)(`br`,{}),`2. Scroll to "Private keys" and click`,` `,(0,W.jsx)(`strong`,{children:`"Generate a private key"`}),(0,W.jsx)(`br`,{}),`3. Paste the downloaded .pem file contents below`]}),style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:`App ID`,name:`github_app_id`,tooltip:`Found on your GitHub App's settings page (General → About)`,children:(0,W.jsx)(L,{placeholder:`123456`})}),(0,W.jsx)(B.Item,{label:`Private Key (PEM)`,name:`github_private_key`,tooltip:`Generate a private key on your GitHub App's settings page, then paste the .pem file contents`,children:(0,W.jsx)(L.TextArea,{rows:4,placeholder:`-----BEGIN RSA PRIVATE KEY-----
|
|
347
|
-
...`,style:{fontFamily:`monospace`,fontSize:11}})}),(0,W.jsx)(B.Item,{label:`Installation ID`,name:`github_installation_id`,tooltip:`Set automatically via the setup callback, or paste from your GitHub App's installation URL`,children:(0,W.jsx)(L,{placeholder:`123456789`})}),_&&(0,W.jsx)(I,{type:`error`,showIcon:!0,title:_,style:{marginBottom:12}}),(0,W.jsx)(V,{type:`primary`,onClick:()=>{let t=e.getFieldValue(`github_app_id`),n=e.getFieldValue(`github_private_key`);if(!t||!n){let r=[];t||r.push({name:`github_app_id`,errors:[`Enter your GitHub App ID`]}),n||r.push({name:`github_private_key`,errors:[`Paste your GitHub App private key`]}),e.setFields(r);return}m(2)},style:{marginTop:8},children:`Next: Configure Channel`})]}),p===2&&!g&&(0,W.jsx)(ue,{ghost:!0,destroyOnHidden:!1,defaultActiveKey:t===`create`?[`identity`,`github-config`]:[],style:{marginLeft:-16,marginRight:-16},items:[...t===`edit`?[{key:`github-credentials`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(De,{}),title:`App Credentials`,subtitle:d?.config&&d.config.private_key?`configured`:`not set`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`App ID`,name:`github_app_id`,tooltip:`Found on your GitHub App's settings page (General → About)`,children:(0,W.jsx)(L,{placeholder:`123456`})}),(0,W.jsx)(B.Item,{label:`Private Key (PEM)`,name:`github_private_key`,tooltip:`Leave empty to keep the existing key. Paste a new .pem to replace it.`,children:(0,W.jsx)(L.TextArea,{rows:3,placeholder:d?.config&&d.config.private_key?`(private key is set — paste new key to replace)`:`-----BEGIN RSA PRIVATE KEY-----
|
|
348
|
-
...`,style:{fontFamily:`monospace`,fontSize:11}})}),(0,W.jsx)(B.Item,{label:`Installation ID`,name:`github_installation_id`,tooltip:`Set automatically via the setup callback, or paste from your GitHub App's installation URL`,children:(0,W.jsx)(L,{placeholder:`123456789`})})]})}]:[],{key:`github-config`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(De,{}),title:`GitHub Settings`,subtitle:`polling & mentions`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Watch Repos`,name:`github_watch_repos`,rules:[{required:!0,message:`At least one repo is required`}],tooltip:`Repos to watch for @mentions, in owner/repo format`,children:(0,W.jsx)(P,{mode:`tags`,placeholder:`preset-io/agor`,tokenSeparators:[`,`,` `]})}),(0,W.jsx)(B.Item,{label:`Require @mention`,name:`github_require_mention`,valuePropName:`checked`,initialValue:!0,tooltip:`Only respond to PR/issue comments that @mention the bot`,children:(0,W.jsx)(ye,{})}),(0,W.jsx)(B.Item,{label:`Mention Name`,name:`github_mention_name`,tooltip:`The name users type to trigger the bot (e.g., 'agor' for @agor)`,initialValue:`agor`,children:(0,W.jsx)(L,{prefix:`@`,placeholder:`agor`})}),(0,W.jsx)(B.Item,{label:`Poll Interval (seconds)`,name:`github_poll_interval_s`,initialValue:30,tooltip:`How frequently to poll the GitHub API for new mentions`,children:(0,W.jsx)(tt,{min:10,max:300,style:{width:`100%`}})})]})},{key:`identity`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(Be,{}),title:`Identity`,subtitle:_U(O)}),children:(0,W.jsx)(vU,{alignFieldName:`github_align_users`,alignLabel:`Align GitHub users`,alignDescription:`Map GitHub logins to Agor users. Unmapped users are rejected.`,alignUsers:O,userById:a,alignedContent:(0,W.jsx)(B.Item,{label:`User Map`,name:`github_user_map`,tooltip:`JSON object mapping GitHub logins to Agor email addresses`,rules:[{validator:KH}],children:(0,W.jsx)(GH,{rows:4,placeholder:`{
|
|
349
|
-
"octocat": "user@example.com"
|
|
350
|
-
}`})})})},{key:`agentic-tool-config`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(lt,{}),title:`Agent Configuration`,subtitle:l}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Configure which agent and settings to use for sessions created from this channel.`}),(0,W.jsx)(mr,{agents:gr,selectedAgentId:l,onSelect:u,columns:2,showHelperText:!1,showComparisonLink:!1}),(0,W.jsx)(zV,{agenticTool:l,mcpServerById:o,showHelpText:!1})]})},{key:`env-vars`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(c,{}),title:`Environment Variables`,subtitle:`channel-level secrets`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Define environment variables for sessions created from this channel. Useful for service account tokens or API keys for MCP servers.`}),(0,W.jsx)(B.Item,{name:`envVars`,noStyle:!0,children:(0,W.jsx)(yU,{})})]})}]})]}),n===`slack`&&(0,W.jsx)(ue,{ghost:!0,destroyOnHidden:!1,defaultActiveKey:t===`create`?[`identity`,`credentials`]:[],style:{marginLeft:-16,marginRight:-16},items:[{key:`identity`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(Ne,{}),title:`Identity`,subtitle:_U(D)}),children:(0,W.jsx)(vU,{alignFieldName:`align_slack_users`,alignLabel:`Align Slack users`,alignDescription:`Match Slack profile email to an Agor user. Unmatched users are rejected.`,alignUsers:D,userById:a,alignedContent:(0,W.jsx)(I,{type:`info`,showIcon:!0,title:`Requires users:read.email scope`,description:(0,W.jsxs)(`span`,{children:[`Add `,(0,W.jsx)(`code`,{children:`users:read.email`}),` to your Slack app so Agor can match Slack profiles by email.`]}),style:{fontSize:12}})})},{key:`credentials`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(S,{}),title:`Credentials`,subtitle:t===`edit`?`leave blank to keep current`:void 0}),children:(0,W.jsxs)(W.Fragment,{children:[t===`edit`&&d&&(0,W.jsxs)(B.Item,{label:`Channel Key`,children:[(0,W.jsx)(L.Search,{value:d.channel_key,readOnly:!0,enterButton:(0,W.jsx)(We,{}),onSearch:()=>f?.(d.channel_key)}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,marginTop:4,display:`block`},children:`Use this key to authenticate inbound messages from the platform.`})]}),(0,W.jsx)(B.Item,{label:`Bot Token`,name:`bot_token`,rules:t===`create`?[{required:!0,message:`Bot token is required`}]:[],tooltip:`Slack Bot User OAuth Token (xoxb-...)`,children:(0,W.jsx)(L.Password,{placeholder:t===`edit`?`••••••••`:`xoxb-...`})}),(0,W.jsx)(B.Item,{label:`App Token`,name:`app_token`,rules:t===`create`?[{required:!0,message:`App token is required`}]:[],tooltip:`Slack App-Level Token for Socket Mode (xapp-...)`,children:(0,W.jsx)(L.Password,{placeholder:t===`edit`?`••••••••`:`xapp-...`})}),(0,W.jsx)(I,{type:`info`,showIcon:!0,title:`Socket Mode Required`,description:`Enable Socket Mode in your Slack app settings and generate an app-level token with connections:write scope.`,style:{fontSize:12}})]})},{key:`message-sources`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(T,{}),title:`Message Sources`,subtitle:`DMs always enabled`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:16},children:`Choose where the bot listens for messages. Direct messages are always enabled.`}),(0,W.jsx)(B.Item,{label:`Public Channels`,name:`enable_channels`,valuePropName:`checked`,initialValue:!1,tooltip:`Bot will respond to messages in public channels it's added to`,children:(0,W.jsx)(ye,{})}),(0,W.jsx)(B.Item,{label:`Private Channels`,name:`enable_groups`,valuePropName:`checked`,initialValue:!1,tooltip:`Bot will respond to messages in private channels it's added to`,children:(0,W.jsx)(ye,{})}),(0,W.jsx)(B.Item,{label:`Group DMs`,name:`enable_mpim`,valuePropName:`checked`,initialValue:!1,tooltip:`Bot will respond to messages in multi-person direct messages`,children:(0,W.jsx)(ye,{})}),(0,W.jsx)(B.Item,{label:`Require @mention`,name:`require_mention`,valuePropName:`checked`,initialValue:!0,tooltip:`When enabled, bot only responds when explicitly @mentioned (recommended for channels)`,children:(0,W.jsx)(ye,{})}),k&&!E&&(0,W.jsx)(I,{type:`warning`,showIcon:!0,title:`Bot will respond to ALL messages in enabled channels. This can be noisy and expensive.`,style:{marginBottom:12}}),k&&(0,W.jsx)(I,{type:`info`,showIcon:!0,title:`Required Slack Scopes & Events`,description:(0,W.jsxs)(`ul`,{style:{margin:`8px 0 0 0`,paddingLeft:20,fontSize:12},children:[(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`chat:write`}),` (always required)`]}),y&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`channels:history`}),` + `,(0,W.jsx)(`code`,{children:`app_mentions:read`})]}),(0,W.jsxs)(`li`,{children:[`Events: `,(0,W.jsx)(`code`,{children:`message.channels`}),`, `,(0,W.jsx)(`code`,{children:`app_mention`})]})]}),b&&(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`groups:history`}),` + event: `,(0,W.jsx)(`code`,{children:`message.groups`})]}),x&&(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`mpim:history`}),` + event: `,(0,W.jsx)(`code`,{children:`message.mpim`})]})]}),style:{fontSize:12}})]})},{key:`advanced`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(Ke,{}),title:`Advanced`,subtitle:`channel whitelist`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Restrict the bot to specific Slack channels by ID. Leave empty to allow all channels. Find channel IDs: right-click channel → View channel details → scroll to bottom.`}),(0,W.jsx)(B.Item,{name:`allowed_channel_ids`,tooltip:`Slack channel IDs (e.g., C01ABC123XY). Press Enter to add each ID.`,children:(0,W.jsx)(P,{mode:`tags`,placeholder:`Add channel IDs... (e.g., C01ABC123XY)`,style:{width:`100%`},tokenSeparators:[`,`,` `]})})]})},{key:`agentic-tool-config`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(lt,{}),title:`Agent Configuration`,subtitle:l}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Configure which agent and settings to use for sessions created from this channel.`}),(0,W.jsx)(mr,{agents:gr,selectedAgentId:l,onSelect:u,columns:2,showHelperText:!1,showComparisonLink:!1}),(0,W.jsx)(zV,{agenticTool:l,mcpServerById:o,showHelpText:!1})]})},{key:`env-vars`,label:(0,W.jsx)(hU,{icon:(0,W.jsx)(c,{}),title:`Environment Variables`,subtitle:`channel-level secrets`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Define environment variables for sessions created from this channel. Useful for service account tokens or API keys for MCP servers.`}),(0,W.jsx)(B.Item,{name:`envVars`,noStyle:!0,children:(0,W.jsx)(yU,{})})]})}]})]})},SU=({client:e,gatewayChannelById:t,branchById:n,userById:r,mcpServerById:i,currentUser:a,onCreate:o,onUpdate:c,onDelete:l})=>{let{showSuccess:u,showError:d}=mn(),{token:f}=ce.useToken(),[p,m]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(`slack`),[C,w]=(0,U.useState)(`claude-code`),[E,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(null),[j,M]=(0,U.useState)(``),[N]=B.useForm(),[te]=B.useForm(),[P,re]=(0,U.useState)(()=>new Map),ae=(0,U.useRef)(new Set),oe=(0,U.useRef)(new Map),[F,se]=(0,U.useState)(0),[le,ue]=(0,U.useState)(!1),[de,pe]=(0,U.useState)(null),[me,he]=(0,U.useState)(null),ge=hn(),_e=Jt();(0,U.useEffect)(()=>{let e=new URLSearchParams(ge.search).get(`installation_id`);e&&(he({installation_id:e}),S(`github`),se(1),m(!0),_e(`/`,{replace:!0}))},[ge.search,_e]),(0,U.useEffect)(()=>{oe.current=P},[P]),(0,U.useEffect)(()=>{if(!e)return;let r=new Set;for(let e of t.values())e.target_branch_id&&r.add(e.target_branch_id);let i=Array.from(r).filter(e=>!n.has(e)&&!oe.current.has(e));if(i.length===0)return;let a=!1;return Promise.all(i.map(async t=>{if(ae.current.has(t))return null;ae.current.add(t);try{return await e.service(`branches`).get(t)}catch{return null}finally{ae.current.delete(t)}})).then(e=>{if(a)return;let t=e.filter(e=>e!==null);t.length!==0&&re(e=>{let n=new Map(e);for(let e of t)n.set(e.branch_id,e);return n})}),()=>{a=!0}},[e,t,n]);let ve=(0,U.useMemo)(()=>{let e=new Map;for(let t of n.values())e.set(t.branch_id,t);for(let t of P.values())e.has(t.branch_id)||e.set(t.branch_id,t);return e},[P,n]),be=(0,U.useCallback)(()=>{se(0),ue(!1),pe(null),he(null)},[]);(0,U.useEffect)(()=>{let e=a?.default_agentic_config?.[C];e&&(g?te:N).setFieldsValue({permissionMode:e.permissionMode,modelConfig:e.modelConfig,mcpServerIds:e.mcpServerIds,codexSandboxMode:e.codexSandboxMode,codexApprovalPolicy:e.codexApprovalPolicy,codexNetworkAccess:e.codexNetworkAccess})},[C,a,N,te,g]);let Se=(e,t,n)=>{let r=[`bot_token`,`app_token`,`signing_secret`,`private_key`],i={...t||{}};for(let e of r)delete i[e];let a={...i};if(e.channel_type===`github`){if(e.github_app_id&&(a.app_id=Number(e.github_app_id)),e.github_private_key&&(a.private_key=e.github_private_key),e.github_installation_id&&(a.installation_id=Number(e.github_installation_id)),a.watch_repos=e.github_watch_repos??[],a.require_mention=e.github_require_mention??!0,a.mention_name=e.github_mention_name||`agor`,a.poll_interval_ms=(e.github_poll_interval_s??30)*1e3,a.align_github_users=e.github_align_users??!1,e.github_user_map)try{a.user_map=JSON.parse(e.github_user_map)}catch{}}else e.channel_type===`slack`&&(e.bot_token&&(a.bot_token=e.bot_token),e.app_token&&(a.app_token=e.app_token),e.connection_mode&&(a.connection_mode=e.connection_mode),a.enable_channels=e.enable_channels??!1,a.enable_groups=e.enable_groups??!1,a.enable_mpim=e.enable_mpim??!1,a.require_mention=e.require_mention??!0,a.align_slack_users=e.align_slack_users??!1,a.allowed_channel_ids=e.allowed_channel_ids??[]);let o={agent:n||`claude-code`,...e.permissionMode?{permissionMode:e.permissionMode}:{},...e.modelConfig?{modelConfig:e.modelConfig}:{},...e.mcpServerIds?{mcpServerIds:e.mcpServerIds}:{},...e.codexSandboxMode?{codexSandboxMode:e.codexSandboxMode}:{},...e.codexApprovalPolicy?{codexApprovalPolicy:e.codexApprovalPolicy}:{},...e.codexNetworkAccess===void 0?{}:{codexNetworkAccess:e.codexNetworkAccess},...e.envVars===void 0?{}:{envVars:e.envVars.filter(e=>e.key.trim()!==``)}};return{name:e.name,channel_type:e.channel_type,target_branch_id:e.target_branch_id,agor_user_id:e.agor_user_id,config:a,agentic_config:o,enabled:e.enabled??!0}},Ce=async()=>{try{await N.validateFields();let t=N.getFieldsValue(!0),n=Se(t,void 0,C);if(!e){d(`Not connected to server`);return}let r=await e.service(`gateway-channels`).create(n);u(`Gateway channel created!`),A(t.channel_type),O(r.channel_key),N.resetFields(),m(!1),S(`slack`),be()}catch(e){let t=e;t.errorFields?.length?d(t.errorFields[0].errors[0]||`Please fill in required fields`):d(`Failed to create channel: ${t.message||String(e)}`)}},we=e=>{b(e),S(e.channel_type),w(e.agentic_config?.agent||`claude-code`),te.resetFields();let t=e.config,n={name:e.name,channel_type:e.channel_type,target_branch_id:e.target_branch_id,agor_user_id:e.agor_user_id,enabled:e.enabled,permissionMode:e.agentic_config?.permissionMode,modelConfig:e.agentic_config?.modelConfig,mcpServerIds:e.agentic_config?.mcpServerIds,codexSandboxMode:e.agentic_config?.codexSandboxMode,codexApprovalPolicy:e.agentic_config?.codexApprovalPolicy,codexNetworkAccess:e.agentic_config?.codexNetworkAccess,envVars:e.agentic_config?.envVars??[]};if(e.channel_type===`slack`)n.connection_mode=t?.connection_mode||`socket`,n.enable_channels=t?.enable_channels??!1,n.enable_groups=t?.enable_groups??!1,n.enable_mpim=t?.enable_mpim??!1,n.require_mention=t?.require_mention??!0,n.align_slack_users=t?.align_slack_users??!1,n.allowed_channel_ids=t?.allowed_channel_ids??[];else if(e.channel_type===`github`){n.github_app_id=t?.app_id,n.github_installation_id=t?.installation_id,n.github_watch_repos=t?.watch_repos??[],n.github_require_mention=t?.require_mention??!0,n.github_mention_name=t?.mention_name||`agor`,n.github_poll_interval_s=(t?.poll_interval_ms??3e4)/1e3,n.github_align_users=t?.align_github_users??!1;let e=t?.user_map;e&&typeof e==`object`&&Object.keys(e).length>0&&(n.github_user_map=JSON.stringify(e,null,2))}te.setFieldsValue(n),_(!0)},Te=()=>{y&&te.validateFields().then(()=>{let e=Se(te.getFieldsValue(!0),y.config,C);c?.(y.id,e),te.resetFields(),_(!1),b(null),S(`slack`)}).catch(e=>{console.error(`Form validation failed:`,e),e.errorFields?.length>0&&d(e.errorFields[0].errors[0]||`Please fill in required fields`)})},Ee=e=>{c?.(e.id,{enabled:!e.enabled})},De=e=>{l?.(e)},Oe=async e=>{await cn(e)?u(`Channel key copied to clipboard`):d(`Failed to copy to clipboard`)},ke=[{title:``,key:`status`,width:40,render:(e,t)=>(0,W.jsx)(h,{status:t.enabled?`success`:`default`,title:t.enabled?`Enabled`:`Disabled`})},{title:`Name`,dataIndex:`name`,key:`name`,width:180,render:e=>(0,W.jsx)(vs,{text:e,query:j})},{title:`Type`,dataIndex:`channel_type`,key:`channel_type`,width:120,render:e=>(0,W.jsx)(v,{icon:pU(e),color:mU(e),children:e.charAt(0).toUpperCase()+e.slice(1)})},{title:`Target Branch`,dataIndex:`target_branch_id`,key:`target_branch_id`,width:180,render:e=>{let t=ve.get(e);return(0,W.jsx)(s.Text,{type:`secondary`,children:(0,W.jsx)(vs,{text:t?`${t.name||t.ref||e}${t.archived?` (archived)`:``}`:e,query:j})})}},{title:`Last Message`,dataIndex:`last_message_at`,key:`last_message_at`,width:160,render:e=>e?(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:new Date(e).toLocaleString()}):(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Never`})},{title:`Actions`,key:`actions`,width:140,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>we(t),title:`Edit`}),(0,W.jsx)(ye,{size:`small`,checked:t.enabled,onChange:()=>Ee(t),title:t.enabled?`Disable`:`Enable`}),(0,W.jsx)(ee,{title:`Delete gateway channel?`,description:`Are you sure you want to delete "${t.name}"? All thread mappings will be lost.`,onConfirm:()=>De(t.id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0,title:`Delete`})})]})}],Ae=(0,U.useMemo)(()=>hs(ds(t,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),j,[e=>e.name,e=>e.channel_type,e=>e.channel_key,e=>e.enabled?`enabled`:`disabled`,e=>e.last_message_at,e=>{let t=ve.get(e.target_branch_id);return[t?.name,t?.ref,e.target_branch_id]},e=>JSON.stringify(e.config??{})]),[t,j,ve]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Route messages from Slack, GitHub, and other platforms to Agor sessions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, type, target branch, key, or config`,value:j,onChange:e=>M(e.target.value),style:{width:360}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>m(!0),children:`Add Channel`})]})]}),(0,W.jsx)(I,{type:`warning`,showIcon:!0,style:{marginBottom:16},title:`Beta Feature — Security Notice`,description:(0,W.jsxs)(W.Fragment,{children:[`The Message Gateway is a `,(0,W.jsx)(`strong`,{children:`beta feature`}),`. Connecting external messaging platforms grants anyone who can message your bot potential access to Agor sessions and the underlying branch environment.`,` `,(0,W.jsx)(s.Link,{href:`https://agor.live/guide/message-gateway`,target:`_blank`,rel:`noopener noreferrer`,children:`Read the full security guidance`}),` `,`before enabling channels in production.`]})}),Ae.length===0?(0,W.jsxs)(`div`,{style:{padding:`60px 20px`,textAlign:`center`,color:f.colorTextTertiary},children:[(0,W.jsx)(T,{style:{fontSize:48,marginBottom:16,display:`block`}}),(0,W.jsx)(s.Text,{type:`secondary`,style:{display:`block`,marginBottom:8},children:`No channels configured.`}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`Add a channel to route messages from Slack, Discord, or other platforms to Agor sessions.`})]}):(0,W.jsx)(D,{dataSource:Ae,columns:ke,rowKey:`id`,pagination:{pageSize:10,showSizeChanger:!0},size:`small`}),(0,W.jsx)(it,{title:`Add Gateway Channel`,open:p,onOk:Ce,onCancel:()=>{N.resetFields(),m(!1),S(`slack`),w(`claude-code`),be()},okText:`Create`,okButtonProps:{style:x===`github`&&F<2?{display:`none`}:void 0},width:600,children:(0,W.jsx)(B,{form:N,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(xU,{form:N,mode:`create`,channelType:x,onChannelTypeChange:S,branchById:ve,userById:r,mcpServerById:i,selectedAgent:C,onAgentChange:w,githubStep:F,onGithubStepChange:se,githubSetupParams:me,githubLoading:le,githubError:de})})}),(0,W.jsx)(it,{title:`Edit Gateway Channel`,open:g,onOk:Te,onCancel:()=>{te.resetFields(),_(!1),b(null),S(`slack`),w(`claude-code`)},okText:`Save`,width:600,children:(0,W.jsx)(B,{form:te,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(xU,{form:te,mode:`edit`,channelType:x,onChannelTypeChange:S,branchById:ve,userById:r,mcpServerById:i,selectedAgent:C,onAgentChange:w,editingChannel:y,onCopyKey:Oe,githubStep:2,onGithubStepChange:()=>{},githubSetupParams:null,githubLoading:!1,githubError:null})})}),(0,W.jsxs)(it,{title:null,open:E!==null,footer:[(0,W.jsx)(V,{type:`primary`,onClick:()=>{O(null),A(null)},children:`Done`},`done`)],onCancel:()=>{O(null),A(null)},width:560,children:[(0,W.jsx)(xe,{status:`success`,title:`Channel Created`,subTitle:`Your gateway channel has been created. Use the channel key below to configure your platform integration.`}),E&&E!==`pending`&&(0,W.jsxs)(`div`,{style:{padding:`0 24px 16px`},children:[(0,W.jsx)(I,{title:`Channel Key`,description:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(L.Search,{value:E,readOnly:!0,enterButton:(0,W.jsx)(We,{}),onSearch:()=>Oe(E),style:{fontFamily:`monospace`}}),(0,W.jsx)(s.Text,{type:`warning`,style:{fontSize:12},children:`Keep this key secret — it authenticates messages from the platform to Agor.`})]}),type:`warning`,showIcon:!0,style:{marginBottom:16}}),k===`slack`&&(0,W.jsx)(I,{title:`Slack Setup`,description:(0,W.jsxs)(`ol`,{style:{margin:0,paddingLeft:20,fontSize:12},children:[(0,W.jsx)(`li`,{children:`Install the Slack app to your workspace`}),(0,W.jsx)(`li`,{children:`Enable Socket Mode in your Slack app settings`}),(0,W.jsxs)(`li`,{children:[`Add required OAuth scopes: `,(0,W.jsx)(`code`,{children:`chat:write`}),` (and others based on enabled message sources)`]}),(0,W.jsxs)(`li`,{children:[`Subscribe to bot events: `,(0,W.jsx)(`code`,{children:`message.im`}),` (and others based on enabled message sources)`]}),(0,W.jsx)(`li`,{children:`The gateway will automatically connect when the channel is enabled`})]}),type:`info`,showIcon:!0}),k===`github`&&(0,W.jsx)(I,{title:`GitHub Channel Ready`,description:(0,W.jsxs)(`ol`,{style:{margin:0,paddingLeft:20,fontSize:12},children:[(0,W.jsx)(`li`,{children:`The GitHub App is connected and polling will begin automatically`}),(0,W.jsxs)(`li`,{children:[`Use `,(0,W.jsx)(`code`,{children:`@agor`}),` (or your configured mention name) in PR or issue comments to trigger the bot`]}),(0,W.jsx)(`li`,{children:`Agor will create a session for each conversation and respond in-line on GitHub`}),(0,W.jsx)(`li`,{children:`No webhooks needed — Agor polls the GitHub API on the configured interval`})]}),type:`info`,showIcon:!0})]}),E===`pending`&&(0,W.jsx)(`div`,{style:{padding:`0 24px 16px`},children:(0,W.jsx)(I,{title:`Channel key will appear here after the server processes the request.`,type:`info`,showIcon:!0})})]})]})};function CU(e,t){let n=new Set(e),r=new Set(t);return{add:t.filter(e=>!n.has(e)),remove:e.filter(e=>!r.has(e))}}async function wU(e,t,n,r){let i=CU(e,t);await Promise.all([...i.add.map(e=>n(e)),...i.remove.map(e=>r(e))])}async function TU(e,t,n,r){await wU(n,r,n=>e.service(`group-memberships`).create({group_id:t,user_id:n}),n=>e.service(`group-memberships`).remove(n,{query:{group_id:t}}))}async function EU(e,t,n,r){await wU(n,r,n=>e.service(`group-memberships`).create({group_id:n,user_id:t}),n=>e.service(`group-memberships`).remove(t,{query:{group_id:n}}))}var DU=({client:e,currentUser:t,userById:n})=>{let{showError:r,showSuccess:i}=mn(),[a,o]=(0,U.useState)([]),[c,l]=(0,U.useState)([]),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)([]),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(``),[y]=B.useForm(),[b]=B.useForm(),x=(0,U.useRef)(!1),S=(0,U.useRef)(!1),C=St(t?.role,Pt.ADMIN),w=(0,U.useCallback)(async()=>{if(!e||!C){o([]),l([]);return}let[t,n]=await Promise.all([e.service(`groups`).findAll({query:{archived:!1}}),e.service(`group-memberships`).findAll({})]);o(t),l(n)},[e,C]);(0,U.useEffect)(()=>{w().catch(e=>r(`Failed to load groups: ${e instanceof Error?e.message:String(e)}`))},[w,r]);let T=(0,U.useMemo)(()=>{let e=new Map;for(let t of c){let n=e.get(t.group_id)||[];n.push(t.user_id),e.set(t.group_id,n)}return e},[c]),E=async()=>{if(!e)return;let t=await y.validateFields();await e.service(`groups`).create(t),k(),i(`Group created`),await w()},O=()=>{x.current=!1,y.resetFields(),h(!0)},k=()=>{x.current=!1,y.resetFields(),h(!1)},A=e=>{if(Object.hasOwn(e,`slug`)){x.current=!0;return}Object.hasOwn(e,`name`)&&!x.current&&y.setFieldsValue({slug:Ui(e.name||``)})},j=e=>{if(Object.hasOwn(e,`slug`)){S.current=!0;return}Object.hasOwn(e,`name`)&&!S.current&&!b.getFieldValue(`slug`)&&b.setFieldsValue({slug:Ui(e.name||``)})},M=async()=>{if(!e||!u)return;let t=await b.validateFields();await e.service(`groups`).patch(u.group_id,t),await te(u,f),d(null),p([]),i(`Group updated`),await w()},N=async t=>{e&&(await e.service(`groups`).patch(t.group_id,{archived:!0}),i(`Group archived`),await w())},te=async(t,n)=>{e&&await TU(e,t.group_id,T.get(t.group_id)||[],n)},re=async(e,t)=>{await te(e,t),await w()};if(!C)return(0,W.jsx)(s.Text,{type:`secondary`,children:`Only admins can manage groups.`});let ae=ds(n,(e,t)=>e.email.localeCompare(t.email)).map(AB),oe=hs([...a].sort((e,t)=>e.name.localeCompare(t.name)),g,[e=>e.name,e=>e.slug,e=>e.description,e=>(T.get(e.group_id)||[]).map(e=>n.get(e)).filter(e=>!!e).flatMap(e=>[e.name,e.email,e.unix_username])]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Manage groups and user memberships.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, slug, description, or members`,value:g,onChange:e=>_(e.target.value),style:{width:320}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:O,children:`New Group`})]})]}),(0,W.jsx)(D,{rowKey:`group_id`,size:`small`,pagination:!1,dataSource:oe,columns:[{title:`Group`,dataIndex:`name`,render:(e,t)=>(0,W.jsxs)(z,{children:[(0,W.jsx)(Ne,{}),(0,W.jsx)(`span`,{children:(0,W.jsx)(vs,{text:t.name,query:g})}),(0,W.jsx)(v,{children:(0,W.jsx)(vs,{text:t.slug||``,query:g})})]})},{title:`Description`,dataIndex:`description`,render:e=>e?(0,W.jsx)(vs,{text:e,query:g}):`—`},{title:`Members`,render:(e,t)=>(0,W.jsx)(P,{mode:`multiple`,style:{minWidth:320},value:T.get(t.group_id)||[],options:ae,...MB,onChange:e=>re(t,e)})},{title:`Actions`,width:110,render:(e,t)=>(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>{S.current=!1,d(t),p(T.get(t.group_id)||[]),b.setFieldsValue(t)}}),(0,W.jsx)(ee,{title:`Archive group?`,onConfirm:()=>N(t),children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0})})]})}]}),(0,W.jsx)(it,{title:`Create Group`,open:m,onOk:E,onCancel:k,children:(0,W.jsxs)(B,{form:y,layout:`vertical`,onValuesChange:A,children:[(0,W.jsx)(B.Item,{name:`name`,label:`Name`,rules:[{required:!0}],children:(0,W.jsx)(L,{})}),(0,W.jsx)(B.Item,{name:`slug`,label:`Slug`,extra:`Auto-filled from name; editable.`,children:(0,W.jsx)(L,{placeholder:`engineering`})}),(0,W.jsx)(B.Item,{name:`description`,label:`Description`,children:(0,W.jsx)(L.TextArea,{rows:3})})]})}),(0,W.jsx)(it,{title:`Edit Group`,open:!!u,onOk:M,onCancel:()=>{d(null),p([])},children:(0,W.jsxs)(B,{form:b,layout:`vertical`,onValuesChange:j,children:[(0,W.jsx)(B.Item,{name:`name`,label:`Name`,rules:[{required:!0}],children:(0,W.jsx)(L,{})}),(0,W.jsx)(B.Item,{name:`slug`,label:`Slug`,extra:`Editable stable key used in URLs and APIs.`,children:(0,W.jsx)(L,{})}),(0,W.jsx)(B.Item,{name:`description`,label:`Description`,children:(0,W.jsx)(L.TextArea,{rows:3})}),(0,W.jsx)(B.Item,{label:`Members`,children:(0,W.jsx)(P,{mode:`multiple`,style:{width:`100%`},value:f,options:ae,...MB,onChange:p,placeholder:`Select users...`})})]})})]})},OU=({form:e,mode:t,repoMode:n,onRepoModeChange:r})=>{let i=t===`edit`,a=n===`local`;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Repository Type`,children:(0,W.jsxs)(d.Group,{value:n,onChange:r,disabled:i,buttonStyle:`solid`,children:[(0,W.jsx)(d.Button,{value:`remote`,children:`Remote (clone)`}),(0,W.jsx)(d.Button,{value:`local`,children:`Local (existing)`})]})}),!i&&!a&&(0,W.jsx)(B.Item,{label:`Repository URL`,name:`url`,rules:[{required:!0,message:`Please enter a git repository URL`},{pattern:/^((ssh:\/\/)?git@[\w.-]+(:\d+)?[:/][\w./-]+|https?:\/\/[\w.-]+(:\d+)?\/[\w./-]+)$/,message:`Please enter a valid git URL`}],extra:`HTTPS or SSH URL (e.g., git@github.com:org/repo.git)`,children:(0,W.jsx)(L,{placeholder:`https://github.com/apache/superset.git`,onChange:t=>{let n=t.target.value;if(n)try{let t=Kt(n);t&&e.setFieldsValue({slug:t})}catch{}},autoFocus:!0})}),!i&&a&&(0,W.jsx)(B.Item,{label:`Local Repository Path`,name:`path`,rules:[{required:!0,message:`Please enter an absolute path`}],extra:`Absolute path on this machine (supports ~/ expansion)`,children:(0,W.jsx)(L,{placeholder:`~/code/my-app`,onChange:t=>{let n=t.target.value;if(n){let t=Hi(n);t&&e.setFieldsValue({slug:t})}},autoFocus:!0})}),(0,W.jsx)(B.Item,{label:`Repository Slug`,name:`slug`,rules:[{required:!a||i,message:`Please enter a slug`},{pattern:/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/,message:`Slug must be in org/repo format`}],extra:a?`Provide org/repo format (e.g., local/myapp)`:`Auto-detected from URL (editable)`,children:(0,W.jsx)(L,{placeholder:`apache/superset`,disabled:i})}),!a&&(0,W.jsx)(B.Item,{label:`Default Branch`,name:`default_branch`,rules:[{required:!0,message:`Please enter the default branch`}],extra:`The main branch to base new branches on`,children:(0,W.jsx)(L,{placeholder:`main`})}),!i&&(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:a?`Link an existing git clone on this machine.`:`The repository will be cloned to the server.`})]})},kU=({repoById:e,onCreate:t,onCreateLocal:n,onUpdate:r,onDelete:i})=>{let a=(0,U.useMemo)(()=>us(e).sort((e,t)=>e.name.localeCompare(t.name)),[e]),[o,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(`remote`),[h]=B.useForm(),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(null),b=!!d,x=(0,U.useMemo)(()=>hs(a,o,[e=>e.name,e=>e.slug,e=>e.remote_url,e=>e.local_path,e=>e.default_branch,e=>e.repo_type]),[a,o]),S=e=>{y(e),_(!0)},C=e=>{v&&(i?.(v.repo_id,e),_(!1),y(null))},w=()=>{f(null),m(`remote`),h.resetFields(),h.setFieldsValue({default_branch:`main`}),u(!0)},T=e=>{f(e),m(e.repo_type??`remote`),h.setFieldsValue({slug:e.slug,default_branch:e.default_branch||`main`}),u(!0)},D=()=>{h.validateFields().then(e=>{if(b&&d){let t={slug:e.slug};e.default_branch&&(t.default_branch=e.default_branch),r?.(d.repo_id,t)}else p===`local`?n?.({path:e.path,slug:e.slug||void 0}):t?.({url:e.url,slug:e.slug,default_branch:e.default_branch});h.resetFields(),f(null),u(!1)})},O=()=>{h.resetFields(),f(null),m(`remote`),u(!1)},k=e=>{let t=e.target.value;m(t),h.resetFields(),h.setFieldsValue({url:void 0,path:void 0,slug:void 0,default_branch:t===`remote`?`main`:void 0})},A=b?`Edit Repository`:p===`local`?`Add Local Repository`:`Clone Repository`,ee=b?`Save`:p===`local`?`Add`:`Clone`;return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Connect remote or local git repositories for your sessions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, slug, URL, path, type, or branch`,value:o,onChange:e=>c(e.target.value),style:{width:340}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:w,children:`New Repository`})]})]}),a.length===0&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(E,{description:`No repositories yet`,children:(0,W.jsxs)(s.Text,{type:`secondary`,children:[`Click "New Repository" to clone a remote repo or switch to "Local" mode to link an existing clone. You can also run `,(0,W.jsx)(`code`,{children:`agor repo add-local <path>`}),` from the CLI.`]})})}),a.length>0&&(0,W.jsx)(z,{orientation:`vertical`,size:16,style:{width:`100%`},children:x.map(e=>{let t=e.repo_type===`local`,n=t?`green`:`blue`,r=t?`Local`:`Remote`;return(0,W.jsx)(Me,{size:`small`,title:(0,W.jsxs)(z,{children:[(0,W.jsx)(de,{}),(0,W.jsx)(s.Text,{strong:!0,children:(0,W.jsx)(vs,{text:e.name,query:o})}),(0,W.jsx)(tr,{color:n,style:{marginLeft:8},children:(0,W.jsx)(vs,{text:r,query:o})})]}),extra:(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>T(e)}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0,onClick:()=>S(e)})]}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:12},children:[`Slug:`,` `]}),(0,W.jsx)(s.Text,{code:!0,style:{fontSize:12},children:(0,W.jsx)(vs,{text:e.slug,query:o})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:12},children:[`Type:`,` `]}),(0,W.jsx)(s.Text,{code:!0,style:{fontSize:11},children:(0,W.jsx)(vs,{text:r.toLowerCase(),query:o})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:12},children:[`Remote:`,` `]}),(0,W.jsx)(s.Text,{code:!0,style:{fontSize:11},children:e.remote_url?(0,W.jsx)(vs,{text:e.remote_url,query:o}):`—`})]}),e.local_path&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:12},children:[`Path:`,` `]}),(0,W.jsx)(s.Text,{code:!0,style:{fontSize:11},children:(0,W.jsx)(vs,{text:e.local_path,query:o})})]})]})},e.repo_id)})}),(0,W.jsx)(it,{title:A,open:l,onOk:D,onCancel:O,okText:ee,children:(0,W.jsx)(B,{form:h,layout:`vertical`,style:{marginTop:16},children:(0,W.jsx)(OU,{form:h,mode:b?`edit`:`create`,repoMode:p,onRepoModeChange:k})})}),(0,W.jsx)(it,{title:`Delete Repository`,open:g,onCancel:()=>{_(!1),y(null)},footer:null,children:v&&(0,W.jsxs)(z,{orientation:`vertical`,size:16,style:{width:`100%`},children:[(0,W.jsxs)(s.Text,{children:[`How would you like to delete`,` `,(0,W.jsxs)(s.Text,{strong:!0,children:[`"`,v.name,`"`]}),`?`]}),v.repo_type===`local`?(0,W.jsx)(Me,{style:{marginBottom:8},styles:{body:{padding:16}},children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsx)(s.Text,{strong:!0,children:`Remove from Agor`}),(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:12},children:[`Remove this repository from Agor's database only. Your local files at`,` `,(0,W.jsx)(s.Text,{code:!0,children:v.local_path}),` will remain untouched.`]}),(0,W.jsx)(V,{danger:!0,onClick:()=>C(!1),style:{marginTop:8},children:`Remove from Agor`})]})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Me,{style:{marginBottom:8},styles:{body:{padding:16}},children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsx)(s.Text,{strong:!0,children:`Remove from Agor (Keep Files)`}),(0,W.jsxs)(s.Text,{type:`secondary`,style:{fontSize:12},children:[`Remove from database only. Repository and branch directories in`,` `,(0,W.jsx)(s.Text,{code:!0,children:`~/.agor/repos/`}),` and`,` `,(0,W.jsx)(s.Text,{code:!0,children:`~/.agor/worktrees/`}),` will remain on disk.`]}),(0,W.jsx)(V,{onClick:()=>C(!1),style:{marginTop:8},children:`Keep Files`})]})}),(0,W.jsx)(Me,{styles:{body:{padding:16}},children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsx)(s.Text,{strong:!0,children:`Delete Completely (Remove Files)`}),(0,W.jsx)(s.Text,{type:`secondary`,style:{fontSize:12},children:`⚠️ Remove from database AND delete all filesystem directories (repository + branches). This will free up disk space but cannot be undone.`}),(0,W.jsx)(V,{danger:!0,onClick:()=>C(!0),style:{marginTop:8},children:`Delete Files`})]})})]})]})})]})},AU={"gentle-chime":`gentle-chime.mp3`,"notification-bell":`notification-bell.mp3`,"8bit-coin":`8bit-coin.mp3`,"retro-coin":`retro-coin.mp3`,"power-up":`power-up.mp3`,"you-got-mail":`you-got-mail.mp3`,"success-tone":`success-tone.mp3`};function jU(e){let t=e;(e===`bell`||e==="default")&&(t=`notification-bell`),AU[t]||(t=`gentle-chime`);let n=AU[t],r=`/ui/`,i=`${r.endsWith(`/`)?r.slice(0,-1):r}/sounds/${n}`;return typeof window<`u`?new URL(i,window.location.origin).href:i}var MU={enabled:!1,chime:`gentle-chime`,volume:.5,minDurationSeconds:30},NU=!1;function PU(){if(NU)return;let e=()=>{NU=!0,document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e),document.removeEventListener(`touchstart`,e)};document.addEventListener(`click`,e,{once:!0}),document.addEventListener(`keydown`,e,{once:!0}),document.addEventListener(`touchstart`,e,{once:!0})}function FU(){return new Promise(e=>{let t=new Audio(`data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAADhAC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAA4T0rBiNAAAAAAD/+xDEAAPAAAGkAAAAIAAANIAAAARMQU1FMy4xMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+xDEDwPAAAGkAAAAIAAANIAAAARMQU1FMy4xMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+xDEHwPAAAGkAAAAIAAANIAAAARMQU1FMy4xMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==`);t.volume=0;let n=t.play();n===void 0?e(!1):n.then(()=>{t.pause(),e(!1)}).catch(t=>{t instanceof Error&&t.name===`NotAllowedError`?e(!0):e(!1)})})}function IU(e,t){if(t===0)return!0;if(e.duration_ms!=null)return e.duration_ms/1e3>=t;if(e.started_at&&e.completed_at){let n=new Date(e.started_at).getTime();return(new Date(e.completed_at).getTime()-n)/1e3>=t}return!0}async function LU(e,t){let n=t||MU;if(!n.enabled||!IU(e,n.minDurationSeconds)||!Dt(e.status))return;let r=jU(n.chime);if(!r){console.warn(`Unknown chime sound: ${n.chime}`);return}try{let e=new Audio(r);e.volume=Math.max(0,Math.min(1,n.volume));let t=e.play();t!==void 0&&await t}catch(e){if(e instanceof Error){let t=e.name;t===`NotAllowedError`?console.debug(`🔇 Audio chime blocked by browser autoplay policy. User needs to interact with the page first.`):t===`NotSupportedError`?console.warn(`🔇 Audio format not supported:`,r):console.debug(`Could not play task completion chime:`,e)}}}async function RU(e,t=.5){let n=jU(e);if(!n){console.warn(`Unknown chime sound: ${e}`);return}try{let e=n+`?t=${Date.now()}`,r=new Audio(e);r.volume=Math.max(0,Math.min(1,t)),await r.play()}catch(e){throw console.error(`Failed to preview chime:`,e),e}}function zU(e){return{"gentle-chime":`Gentle Chime`,"notification-bell":`Notification Bell`,"8bit-coin":`8-Bit Coin`,"retro-coin":`Retro Coin`,"power-up":`Power Up`,"you-got-mail":`You've Got Mail`,"success-tone":`Success Tone`}[e]||e}function BU(){return[`gentle-chime`,`notification-bell`,`8bit-coin`,`retro-coin`,`power-up`,`you-got-mail`,`success-tone`]}var{Text:VU}=s;function HU(e){return typeof e==`boolean`?{set:e,scope:`global`}:{set:!!e.set,scope:e.scope}}var UU={global:`Global`,session:`Session`,repo:`Repo`,mcp_server:`MCP server`,artifact_feature:`Artifact feature`,executor:`Executor`},WU={global:`blue`,session:`purple`,repo:`default`,mcp_server:`default`,artifact_feature:`default`,executor:`default`},GU=kt.map(e=>({value:e,label:UU[e]})),KU=({envVars:e,onSave:t,onScopeChange:n,onDelete:r,loading:i={},disabled:a=!1})=>{let[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(`global`),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(null),y=async()=>{if(!(!s.trim()||!l.trim()))try{v(null),await t(s.trim(),l.trim(),d),c(``),u(``),f(`global`)}catch(e){v(e instanceof Error?e.message:`Failed to save environment variable`)}},b=async(e,n)=>{if(h.trim())try{v(null),await t(e,h.trim(),n),m(null),g(``)}catch(e){v(e instanceof Error?e.message:`Failed to update environment variable`)}},x=async(e,t)=>{if(n)try{v(null),await n(e,t)}catch(e){v(e instanceof Error?e.message:`Failed to update scope`)}},S=async e=>{try{v(null),await r(e)}catch(e){v(e instanceof Error?e.message:`Failed to delete environment variable`)}},C=[{title:`Variable Name`,dataIndex:`key`,key:`key`,width:`30%`,ellipsis:!0,render:e=>(0,W.jsx)(`code`,{children:e})},{title:`Scope`,dataIndex:`scope`,key:`scope`,width:140,render:(e,t)=>n?(0,W.jsx)(P,{value:e,size:`small`,style:{width:`100%`,minWidth:0},popupMatchSelectWidth:!1,disabled:a||i[t.key],onChange:e=>x(t.key,e),options:GU}):(0,W.jsx)(tr,{color:WU[e],children:UU[e]})},{title:`Value`,dataIndex:`isSet`,key:`value`,render:(e,t)=>p===t.key?(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L.Password,{placeholder:`Enter new value`,value:h,onChange:e=>g(e.target.value),onPressEnter:()=>b(t.key,t.scope),autoFocus:!0,disabled:a,style:{flex:1,minWidth:180}}),(0,W.jsx)(V,{type:`primary`,onClick:()=>b(t.key,t.scope),loading:i[t.key],disabled:a||!h.trim(),children:`Save`}),(0,W.jsx)(V,{onClick:()=>m(null),disabled:a,children:`Cancel`})]}):(0,W.jsxs)(z,{children:[(0,W.jsx)(tr,{color:e?`success`:`default`,children:e?`Set (encrypted)`:`Not Set`}),e&&(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>{m(t.key),g(``)},disabled:a,children:`Update`})]})},{title:`Actions`,key:`actions`,width:72,align:`center`,render:(e,t)=>(0,W.jsx)(o,{title:`Delete`,children:(0,W.jsx)(V,{danger:!0,type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),onClick:()=>S(t.key),loading:i[t.key],disabled:a,"aria-label":`Delete ${t.key}`})})}],w=Object.entries(e).map(([e,t])=>{let n=HU(t);return{key:e,isSet:n.set,scope:n.scope}});return(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsxs)(VU,{type:`secondary`,children:[`Environment variables are encrypted at rest. `,(0,W.jsx)(`b`,{children:`Global`}),` vars are exported to every session you own. `,(0,W.jsx)(`b`,{children:`Session`}),` vars are only exported to sessions where you explicitly select them (configure per-session under Session → Settings → Env vars).`]}),_&&(0,W.jsx)(`div`,{style:{color:`#ff4d4f`,padding:`8px`,borderRadius:`4px`,background:`#fff1f0`},children:(0,W.jsx)(VU,{type:`danger`,children:_})}),(0,W.jsx)(D,{columns:C,dataSource:w,pagination:!1,size:`small`,locale:{emptyText:`No environment variables configured`},style:{width:`100%`}}),(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsx)(VU,{strong:!0,children:`Add New Variable`}),(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L,{placeholder:`Variable name (e.g., GITHUB_TOKEN)`,value:s,onChange:e=>c(e.target.value),onPressEnter:y,style:{width:`30%`},disabled:a}),(0,W.jsx)(P,{value:d,onChange:f,style:{width:140},disabled:a,options:GU}),(0,W.jsx)(L.Password,{placeholder:`Value`,value:l,onChange:e=>u(e.target.value),onPressEnter:y,style:{flex:1},disabled:a}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:y,disabled:a||!s.trim()||!l.trim(),children:`Add`})]})]})]})},{Text:qU,Paragraph:JU}=s,YU=({user:e,form:t})=>{let{showError:n,showWarning:r,showInfo:i}=mn(),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e?.preferences?.audio||MU;(0,U.useEffect)(()=>{FU().then(l)},[]);let p=async()=>{let e=t.getFieldValue(`chime`),r=t.getFieldValue(`volume`);s(!0),d(!1);try{await RU(e,r),l(!1)}catch{l(!0),d(!0),n(`Audio blocked by browser. See instructions below to enable.`)}finally{setTimeout(()=>s(!1),2e3)}};return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsxs)(qU,{strong:!0,style:{fontSize:16},children:[(0,W.jsx)(ze,{}),` Task Completion Chimes`]}),(0,W.jsx)(JU,{type:`secondary`,style:{marginTop:8,marginBottom:0},children:`Play a sound when agent tasks finish executing. Perfect for long-running tasks!`})]}),u&&c&&(0,W.jsx)(I,{type:`warning`,showIcon:!0,icon:(0,W.jsx)(he,{}),title:`Browser Audio Permissions Required`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{style:{marginBottom:8},children:`Your browser is blocking audio playback. To enable chimes:`}),(0,W.jsxs)(`ol`,{style:{marginLeft:16,marginBottom:8},children:[(0,W.jsxs)(`li`,{children:[`Click the `,(0,W.jsx)(`strong`,{children:`lock icon`}),` (🔒) or `,(0,W.jsx)(`strong`,{children:`site info icon`}),` in your browser's address bar`]}),(0,W.jsxs)(`li`,{children:[`Find `,(0,W.jsx)(`strong`,{children:`"Sound"`}),` or `,(0,W.jsx)(`strong`,{children:`"Autoplay"`}),` permissions`]}),(0,W.jsxs)(`li`,{children:[`Change the setting to `,(0,W.jsx)(`strong`,{children:`"Allow"`})]}),(0,W.jsx)(`li`,{children:`Refresh the page and click the Preview button again`})]}),(0,W.jsxs)(`p`,{style:{marginBottom:0,fontSize:`0.9em`,opacity:.8},children:[(0,W.jsx)(`strong`,{children:`Chrome/Edge:`}),` Click lock icon → Site settings → Sound → Allow`,(0,W.jsx)(`br`,{}),(0,W.jsx)(`strong`,{children:`Firefox:`}),` Click lock icon → Permissions → Autoplay → Allow Audio and Video`,(0,W.jsx)(`br`,{}),(0,W.jsx)(`strong`,{children:`Safari:`}),` Safari → Settings for this Website → Auto-Play → Allow All Auto-Play`]})]}),closable:!0,onClose:()=>d(!1),style:{marginBottom:16}}),(0,W.jsxs)(B,{form:t,layout:`vertical`,initialValues:{enabled:f.enabled,chime:f.chime,volume:f.volume,minDurationSeconds:f.minDurationSeconds},children:[(0,W.jsxs)(_e,{gutter:16,children:[(0,W.jsx)(dt,{span:12,children:(0,W.jsx)(B.Item,{name:`enabled`,label:`Enable Chimes`,valuePropName:`checked`,children:(0,W.jsx)(ye,{onChange:async e=>{if(e){let e=await FU();l(e),e?(d(!0),r(`Audio may be blocked. Click Preview to test and grant permissions.`)):i(`Audio notifications enabled. Use the preview button to test.`)}else d(!1)}})})}),(0,W.jsx)(dt,{span:12,children:(0,W.jsx)(B.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.enabled!==t.enabled,children:()=>(0,W.jsx)(B.Item,{name:`volume`,label:`Volume`,children:(0,W.jsx)(Le,{min:0,max:1,step:.1,marks:{0:`0%`,.5:`50%`,1:`100%`},disabled:!t.getFieldValue(`enabled`),tooltip:{formatter:e=>`${Math.round((e||0)*100)}%`}})})})})]}),(0,W.jsxs)(_e,{gutter:16,children:[(0,W.jsx)(dt,{span:12,children:(0,W.jsx)(B.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.enabled!==t.enabled,children:()=>{let e=t.getFieldValue(`enabled`);return(0,W.jsx)(B.Item,{label:`Chime Sound`,tooltip:`Choose your preferred notification sound`,children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(B.Item,{name:`chime`,noStyle:!0,children:(0,W.jsx)(P,{style:{flex:1},disabled:!e,options:BU().map(e=>({label:zU(e),value:e})).sort((e,t)=>e.label.localeCompare(t.label))})}),(0,W.jsx)(V,{icon:(0,W.jsx)(a,{}),onClick:p,disabled:!e||o,loading:o,children:`Preview`})]})})}})}),(0,W.jsx)(dt,{span:12,children:(0,W.jsx)(B.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.enabled!==t.enabled,children:()=>(0,W.jsx)(B.Item,{label:`Minimum Task Duration`,tooltip:`Only play chime for tasks that take longer than this. Set to 0 to always play.`,children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(B.Item,{name:`minDurationSeconds`,noStyle:!0,children:(0,W.jsx)(tt,{min:0,max:300,step:1,style:{width:`100%`},disabled:!t.getFieldValue(`enabled`)})}),(0,W.jsx)(L,{value:`seconds`,disabled:!0,style:{width:80,textAlign:`center`,pointerEvents:`none`}})]})})})})]})]}),(0,W.jsx)(Me,{type:`inner`,size:`small`,style:{marginTop:16},children:(0,W.jsxs)(qU,{type:`secondary`,children:[(0,W.jsx)(`strong`,{children:`Note:`}),` Chimes will only play for tasks that complete naturally (finished or failed), not for tasks you manually stop. Make sure your browser allows audio playback - click the Preview button to test!`]})})]})},XU=({client:e})=>{let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(``),{token:v}=ce.useToken(),{showSuccess:y,showError:b}=mn(),x=(0,U.useCallback)(async()=>{if(e){i(!0);try{n(await e.service(`api/v1/user/api-keys`).findAll({}))}catch(e){console.error(`Failed to fetch API keys:`,e)}finally{i(!1)}}},[e]);(0,U.useEffect)(()=>{x()},[x]);let C=async()=>{if(!(!e||!c.trim())){o(!0);try{p((await e.service(`api/v1/user/api-keys`).create({name:c.trim()})).rawKey),l(``),await x()}catch(e){b(e?.message||`Failed to create API key`)}finally{o(!1)}}},w=async t=>{if(e){h(t);try{await e.service(`api/v1/user/api-keys`).remove(t),y(`API key revoked`),await x()}catch(e){b(e?.message||`Failed to delete API key`)}finally{h(null)}}},T=async e=>{await cn(e)?y(`Copied to clipboard`):b(`Failed to copy to clipboard`)},E=[{title:`Name`,dataIndex:`name`,key:`name`,render:e=>(0,W.jsx)(vs,{text:e,query:g})},{title:`Key`,dataIndex:`prefix`,key:`prefix`,render:e=>(0,W.jsxs)(s.Text,{code:!0,style:{fontSize:12},children:[(0,W.jsx)(vs,{text:e,query:g}),`...`]})},{title:`Created`,dataIndex:`created_at`,key:`created_at`,render:e=>new Date(e).toLocaleDateString()},{title:`Last Used`,dataIndex:`last_used_at`,key:`last_used_at`,render:e=>e?new Date(e).toLocaleDateString():`Never`},{title:``,key:`actions`,width:80,render:(e,t)=>(0,W.jsx)(ee,{title:`Revoke this API key?`,description:`Any applications using this key will lose access.`,onConfirm:()=>w(t.id),okText:`Revoke`,okType:`danger`,children:(0,W.jsx)(V,{type:`text`,danger:!0,size:`small`,icon:(0,W.jsx)(ie,{}),loading:m===t.id})})}],O=(0,U.useMemo)(()=>hs(t,g,[e=>e.name,e=>e.prefix,e=>e.id,e=>e.created_at,e=>e.last_used_at]),[t,g]);return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(s.Paragraph,{type:`secondary`,style:{marginBottom:16},children:`Agor API tokens allow you to authenticate with the Agor API from scripts, CI pipelines, and external tools. Tokens have the same permissions as your user account.`}),(0,W.jsxs)(z,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`},children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, prefix, or dates`,value:g,onChange:e=>_(e.target.value),style:{width:300}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>d(!0),children:`Create New Key`})]}),(0,W.jsx)(D,{dataSource:O,columns:E,rowKey:`id`,loading:r,pagination:!1,size:`small`,locale:{emptyText:`No API keys yet`}}),(0,W.jsxs)(it,{title:`Create API Key`,open:u&&!f,onOk:C,onCancel:()=>{d(!1),l(``)},okText:`Create`,okButtonProps:{disabled:!c.trim(),loading:a},children:[(0,W.jsx)(s.Paragraph,{type:`secondary`,children:`Give your key a descriptive name so you can identify it later.`}),(0,W.jsx)(L,{placeholder:`e.g., CI Pipeline, Local Development`,value:c,onChange:e=>l(e.target.value),onPressEnter:C,maxLength:100,autoFocus:!0})]}),(0,W.jsxs)(it,{title:(0,W.jsxs)(z,{children:[(0,W.jsx)(S,{}),`API Key Created`]}),open:!!f,onOk:()=>{p(null),d(!1)},onCancel:()=>{p(null),d(!1)},okText:`Done`,cancelButtonProps:{style:{display:`none`}},children:[(0,W.jsx)(I,{type:`warning`,showIcon:!0,title:`Copy your API key now`,description:`This is the only time the full key will be shown. Store it securely.`,style:{marginBottom:16}}),(0,W.jsx)(L.TextArea,{value:f||``,readOnly:!0,autoSize:{minRows:2},style:{fontFamily:`monospace`,fontSize:13,marginBottom:8,background:v.colorBgContainer}}),(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:()=>f&&T(f),block:!0,children:`Copy to Clipboard`})]})]})},{Sider:ZU,Content:QU}=we,$U=[`claude-code`,`claude-code-cli`,`codex`,`gemini`,`opencode`,`copilot`,`cursor`],eW=e=>$U.includes(e),tW=({open:e,onClose:t,user:n,mcpServerById:r,client:i,currentUser:a,onUpdate:o,onRestartOnboarding:c})=>{let[l]=B.useForm(),[u,d]=(0,U.useState)(`general`),f=St(a?.role,Pt.ADMIN),[p]=B.useForm(),[h]=B.useForm(),[g]=B.useForm(),[_]=B.useForm(),[y]=B.useForm(),[x]=B.useForm(),[S]=B.useForm(),[C]=B.useForm(),w=(0,U.useMemo)(()=>({"claude-code":p,"claude-code-cli":h,codex:g,gemini:_,opencode:y,copilot:x,cursor:S}),[h,p,g,x,S,_,y]),[T,E]=(0,U.useState)({"claude-code":{},"claude-code-cli":{},codex:{},gemini:{},opencode:{},copilot:{},cursor:{}}),[D,O]=(0,U.useState)({}),[k,A]=(0,U.useState)({}),[j,M]=(0,U.useState)({}),[N,te]=(0,U.useState)([]),[ne,re]=(0,U.useState)([]),[ie,ae]=(0,U.useState)(!1),[oe,F]=(0,U.useState)(!1),se=(0,U.useMemo)(()=>[...N].sort((e,t)=>e.name.localeCompare(t.name)).map(jB),[N]),[le,ue]=(0,U.useState)({"claude-code":!1,"claude-code-cli":!1,codex:!1,gemini:!1,opencode:!1,copilot:!1,cursor:!1}),de=(0,U.useCallback)(e=>{d(`general`),l.setFieldsValue({email:e.email,name:e.name,emoji:e.emoji,role:e.role,unix_username:e.unix_username,groupIds:[],eventStreamEnabled:e.preferences?.eventStream?.enabled??!0,must_change_password:e.must_change_password??!1})},[l]),fe=(0,U.useCallback)(async()=>{if(!i||!n||!f){te([]),re([]),F(!1),l.setFieldValue(`groupIds`,[]);return}ae(!0),F(!1);try{let[e,t]=await Promise.all([i.service(`groups`).findAll({query:{archived:!1}}),i.service(`group-memberships`).findAll({query:{user_id:n.user_id}})]),r=t.map(e=>e.group_id);te(e),re(r),F(!0),l.setFieldValue(`groupIds`,r)}catch(e){console.error(`Failed to load user groups:`,e)}finally{ae(!1)}},[i,l,f,n]);(0,U.useEffect)(()=>{e&&n&&(de(n),fe())},[e,n,de,fe]),(0,U.useEffect)(()=>{if(!(!e||!n)){if(eW(u)){w[u].setFieldsValue(BV(u,n.default_agentic_config?.[u]));return}if(u===`audio`){let e=n.preferences?.audio;C.setFieldsValue({enabled:e?.enabled??MU.enabled,chime:e?.chime??MU.chime,volume:e?.volume??MU.volume,minDurationSeconds:e?.minDurationSeconds??MU.minDurationSeconds})}}},[u,C,w,e,n]),(0,U.useEffect)(()=>{if(!e)return;let t={"claude-code":{},"claude-code-cli":{},codex:{},gemini:{},opencode:{},copilot:{},cursor:{}},r=n?.agentic_tools;if(r)for(let e of Object.keys(t)){let n=r[e];n&&(t[e]={...n})}E(t),n?.env_vars?A(n.env_vars):A({})},[e,n]);let me=()=>{l.resetFields(),te([]),re([]),F(!1),d(`general`),t()},he=async e=>{!i||!n||!f||!oe||(await EU(i,n.user_id,ne,e),re(e))},ge=()=>{n&&l.validateFields([`email`,`name`,`emoji`,`role`,`unix_username`]).then(async()=>{let e=l.getFieldsValue(),t={email:e.email,name:e.name,emoji:e.emoji,role:e.role,unix_username:e.unix_username,preferences:{...n.preferences,eventStream:{enabled:e.eventStreamEnabled??!0}}};e.password?.trim()&&(t.password=e.password),St(a?.role,Pt.ADMIN)&&n.user_id!==a?.user_id&&(t.must_change_password=e.must_change_password),await o?.(n.user_id,t),await he(e.groupIds||[]),me()}).catch(e=>{console.error(`Validation failed:`,e)})},_e=async(e,t,r)=>{if(!n)return;let i=`${e}.${t}`;try{O(e=>({...e,[i]:!0})),await o?.(n.user_id,{agentic_tools:{[e]:{[t]:r}}}),E(n=>({...n,[e]:{...n[e]??{},[t]:!0}}))}catch(n){throw console.error(`Failed to save ${e}.${t}:`,n),n}finally{O(e=>({...e,[i]:!1}))}},ve=async(e,t)=>{if(!n)return;let r=`${e}.${t}`;try{O(e=>({...e,[r]:!0})),await o?.(n.user_id,{agentic_tools:{[e]:{[t]:null}}}),E(n=>{let r={...n[e]??{}};return delete r[t],{...n,[e]:r}})}catch(n){throw console.error(`Failed to clear ${e}.${t}:`,n),n}finally{O(e=>({...e,[r]:!1}))}},be=async(e,t,r)=>{if(n)try{M(t=>({...t,[e]:!0})),await o?.(n.user_id,{env_vars:{[e]:t},env_var_scopes:{[e]:r}}),A(t=>({...t,[e]:{set:!0,scope:r,resource_id:null}}))}catch(t){throw console.error(`Failed to save ${e}:`,t),t}finally{M(t=>({...t,[e]:!1}))}},xe=async(e,t)=>{if(n)try{M(t=>({...t,[e]:!0})),await o?.(n.user_id,{env_var_scopes:{[e]:t}}),A(n=>({...n,[e]:{...n[e]??{set:!0},set:!0,scope:t,resource_id:null}}))}catch(t){throw console.error(`Failed to update scope for ${e}:`,t),t}finally{M(t=>({...t,[e]:!1}))}},Se=async e=>{if(n)try{M(t=>({...t,[e]:!0})),await o?.(n.user_id,{env_vars:{[e]:null}}),A(t=>{let n={...t};return delete n[e],n})}catch(t){throw console.error(`Failed to delete ${e}:`,t),t}finally{M(t=>({...t,[e]:!1}))}},Ce=async e=>{if(n)try{ue(t=>({...t,[e]:!0}));let t=w[e].getFieldsValue(),r={...n.default_agentic_config,[e]:VV(e,t)};await o?.(n.user_id,{default_agentic_config:r}),me()}catch(t){throw console.error(`Failed to save ${e} config:`,t),t}finally{ue(t=>({...t,[e]:!1}))}},Te=e=>{w[e].setFieldsValue(WV(e))},Ee=async()=>{if(!(!n||!o))try{let e=C.getFieldsValue(),t={...n.preferences,audio:{enabled:e.enabled,chime:e.chime,volume:e.volume,minDurationSeconds:e.minDurationSeconds}};o(n.user_id,{preferences:t}),me()}catch(e){console.error(`Failed to save audio settings:`,e)}},De=async()=>{if(n)switch(u){case`general`:ge();break;case`env-vars`:case`personal-api-keys`:me();break;case`groups`:await he(l.getFieldValue(`groupIds`)||[]),me();break;case`audio`:await Ee();break;case`claude-code`:case`claude-code-cli`:case`codex`:case`gemini`:case`opencode`:case`copilot`:case`cursor`:await Ce(u);break}},{token:Oe}=ce.useToken(),ke=[{key:`profile`,label:`Profile`,type:`group`,children:[{key:`general`,label:`General`,icon:(0,W.jsx)(je,{})},{key:`env-vars`,label:`Env Vars`,icon:(0,W.jsx)(lt,{})},{key:`audio`,label:`Audio`,icon:(0,W.jsx)(ze,{})},...f?[{key:`groups`,label:`Groups`,icon:(0,W.jsx)(Ne,{})}]:[],{key:`personal-api-keys`,label:`Agor API Tokens`,icon:(0,W.jsx)(mt,{})}]},{key:`agentic-tools`,label:`Agentic Tools`,type:`group`,children:[{key:`claude-code`,label:`Claude Code`,icon:(0,W.jsx)(m,{})},{key:`codex`,label:`Codex`,icon:(0,W.jsx)(m,{})},{key:`gemini`,label:`Gemini`,icon:(0,W.jsx)(m,{})},{key:`opencode`,label:`OpenCode`,icon:(0,W.jsx)(m,{})},{key:`cursor`,label:`Cursor SDK`,icon:(0,W.jsx)(m,{})},{key:`copilot`,label:`GitHub Copilot`,icon:(0,W.jsx)(m,{})}]}];return(0,W.jsxs)(it,{title:null,open:e,onCancel:me,footer:(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,padding:`12px 24px`,background:Oe.colorBgContainer},children:[(0,W.jsx)(V,{onClick:me,children:`Close`}),(0,W.jsx)(V,{type:`primary`,onClick:De,loading:u in le?le[u]:!1,children:`Save`})]}),closable:!0,width:`min(1050px, calc(100vw - 32px))`,style:{top:40},styles:{wrapper:{padding:0,overflow:`hidden`},container:{padding:0,borderRadius:8,overflow:`hidden`},header:{display:`none`},body:{padding:0,height:`calc(100vh - 280px)`,minHeight:450,maxHeight:650},footer:{padding:0,margin:0,background:Oe.colorBgContainer,borderTop:`1px solid ${Oe.colorBorderSecondary}`}},closeIcon:(0,W.jsx)(b,{}),children:[(0,W.jsxs)(`div`,{hidden:!0,"aria-hidden":`true`,children:[u!==`audio`&&(0,W.jsx)(B,{component:!1,form:C}),$U.map(e=>u===e?null:(0,W.jsx)(B,{component:!1,form:w[e]},e))]}),(0,W.jsxs)(we,{style:{height:`100%`,background:Oe.colorBgContainer},children:[(0,W.jsxs)(ZU,{width:200,style:{background:Oe.colorBgElevated,borderRight:`1px solid ${Oe.colorBorderSecondary}`,overflow:`auto`,padding:`20px 0`},children:[(0,W.jsx)(`div`,{style:{padding:`0 24px 16px`,fontWeight:600,fontSize:18,color:Oe.colorText},children:`User Settings`}),(0,W.jsx)(pe,{mode:`inline`,selectedKeys:[u],onClick:({key:e})=>d(e),items:ke,style:{border:`none`,background:`transparent`}})]}),(0,W.jsxs)(QU,{style:{padding:`24px 32px`,overflow:`auto`},children:[(0,W.jsx)(s.Title,{level:4,style:{marginTop:0,marginBottom:20},children:{general:`General`,"env-vars":`Environment Variables`,audio:`Audio`,groups:`Groups`,"personal-api-keys":`Agor API Tokens`,"claude-code":`Claude Code`,codex:`Codex`,gemini:`Gemini`,opencode:`OpenCode`,cursor:`Cursor SDK`,copilot:`GitHub Copilot`}[u]||`User Settings`}),(()=>{switch(u){case`general`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(B,{form:l,layout:`vertical`,children:[(0,W.jsx)(B.Item,{label:`Name`,style:{marginBottom:24},children:(0,W.jsxs)(Ve,{gap:8,children:[(0,W.jsx)(B.Item,{name:`emoji`,noStyle:!0,children:(0,W.jsx)(Yi,{form:l,fieldName:`emoji`,defaultEmoji:`👤`})}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,style:{flex:1},children:(0,W.jsx)(L,{placeholder:`John Doe`,style:{flex:1}})})]})}),(0,W.jsx)(B.Item,{label:`Email`,name:`email`,rules:[{required:!0,message:`Please enter an email`},{type:`email`,message:`Please enter a valid email`}],children:(0,W.jsx)(L,{placeholder:`user@example.com`})}),(0,W.jsx)(B.Item,{label:`Unix Username`,name:`unix_username`,help:St(a?.role,Pt.ADMIN)?`Unix user for process impersonation (alphanumeric, hyphens, underscores only)`:`Maintained by administrators`,rules:[{pattern:/^[a-z0-9_-]+$/,message:`Only lowercase letters, numbers, hyphens, and underscores allowed`},{max:32,message:`Unix username must be 32 characters or less`}],children:(0,W.jsx)(L,{placeholder:`johnsmith`,maxLength:32,disabled:!St(a?.role,Pt.ADMIN)})}),(0,W.jsx)(B.Item,{label:`Password`,name:`password`,help:`Leave blank to keep current password`,children:(0,W.jsx)(L.Password,{placeholder:`••••••••`})}),(0,W.jsx)(B.Item,{label:(0,W.jsxs)(z,{size:4,children:[`Enable Live Event Stream`,(0,W.jsx)(v,{color:Oe.colorPrimary,style:{fontSize:10,marginLeft:4},children:`BETA`})]}),name:`eventStreamEnabled`,valuePropName:`checked`,tooltip:`Show/hide the event stream icon in the navbar. When enabled, you can view live WebSocket events for debugging.`,children:(0,W.jsx)(ye,{})}),(0,W.jsx)(B.Item,{label:`Role`,name:`role`,rules:[{required:!0,message:`Please select a role`}],help:St(a?.role,Pt.ADMIN)?void 0:`Maintained by administrators`,children:(0,W.jsx)(P,{disabled:!St(a?.role,Pt.ADMIN),options:Tn.map(e=>({value:e.value,label:e.label,title:e.description}))})}),f&&(0,W.jsx)(B.Item,{label:`Groups`,name:`groupIds`,help:`Group memberships affect group-aware branch permissions.`,children:(0,W.jsx)(P,{mode:`multiple`,loading:ie,disabled:!oe&&!ie,placeholder:`Select groups...`,options:se,...MB})}),St(a?.role,Pt.ADMIN)&&n&&n.user_id!==a?.user_id&&(0,W.jsx)(B.Item,{name:`must_change_password`,valuePropName:`checked`,children:(0,W.jsx)(vt,{children:`Force password change on next login`})})]}),c&&n?.user_id===a?.user_id&&(0,W.jsxs)(`div`,{style:{marginTop:24,paddingTop:20,borderTop:`1px solid ${Oe.colorBorderSecondary}`},children:[(0,W.jsx)(s.Title,{level:5,style:{marginTop:0},children:`Onboarding`}),(0,W.jsx)(s.Paragraph,{type:`secondary`,children:`Reopen the assistant setup wizard from the beginning. Existing repos, boards, branches, and credentials stay in place.`}),(0,W.jsx)(ee,{title:`Restart onboarding?`,description:`This clears saved wizard progress and opens onboarding again.`,okText:`Restart`,cancelText:`Cancel`,onConfirm:c,children:(0,W.jsx)(V,{children:`Restart onboarding`})})]})]});case`env-vars`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s.Paragraph,{type:`secondary`,style:{marginBottom:16},children:`Environment variables are encrypted at rest and available to all sessions for this user.`}),(0,W.jsx)(I,{type:`info`,showIcon:!0,style:{marginBottom:16},title:`Looking for SDK credentials?`,description:(0,W.jsxs)(`span`,{children:[`API keys and SDK config (Anthropic, OpenAI, Gemini, Copilot) live under each tool's screen in the `,(0,W.jsx)(`strong`,{children:`Agentic Tools`}),` section. Per-tool config takes precedence over global env vars and is scoped so credentials never leak across SDKs.`]})}),(0,W.jsx)(KU,{envVars:k,onSave:be,onScopeChange:xe,onDelete:Se,loading:j})]});case`audio`:return(0,W.jsx)(YU,{user:n,form:C});case`groups`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s.Paragraph,{type:`secondary`,style:{marginBottom:16},children:`Add or remove this user from admin-managed groups.`}),(0,W.jsx)(B,{form:l,layout:`vertical`,children:(0,W.jsx)(B.Item,{label:`Groups`,name:`groupIds`,help:`Group memberships affect group-aware branch permissions.`,children:(0,W.jsx)(P,{mode:`multiple`,loading:ie,disabled:!oe&&!ie,placeholder:`Select groups...`,options:se,...MB})})})]});case`personal-api-keys`:return(0,W.jsx)(XU,{client:i});case`claude-code`:case`claude-code-cli`:case`codex`:case`gemini`:case`opencode`:case`copilot`:case`cursor`:{let e=u,t=w[e],i={"claude-code":`Claude Code`,"claude-code-cli":`Claude Code CLI`,codex:`Codex`,gemini:`Gemini`,opencode:`OpenCode`,copilot:`Copilot`,cursor:`Cursor SDK`},a=SH[e]??[],o=T[e]??{},c=Object.fromEntries(a.map(t=>[t.field,!!D[`${e}.${t.field}`]])),l=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(s.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Configure default settings for `,i[e],`. These will prepopulate session creation forms.`]}),(0,W.jsx)(B,{form:t,layout:`vertical`,children:(0,W.jsx)(zV,{agenticTool:e,mcpServerById:r,showHelpText:!1})}),(0,W.jsx)(`div`,{style:{marginTop:16},children:(0,W.jsx)(V,{onClick:()=>Te(e),children:`Clear Defaults`})})]});return a.length===0?l:(0,W.jsx)(ht,{defaultActiveKey:`auth`,items:[{key:`auth`,label:`Authentication`,children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(s.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Per-user credentials and config for `,i[e],`. Encrypted at rest; injected into the agent runtime, not the prompt transcript; and preferred over daemon globals and env vars.`]}),(0,W.jsx)(CH,{tool:e,fieldStatus:o,onSave:(t,n)=>_e(e,t,n),onClear:t=>ve(e,t),saving:c,publicValues:n?.agentic_tools_public_values?.[e]})]})},{key:`defaults`,label:`Defaults`,children:l}]})}default:return null}})()]})]})]})},nW=({userById:e,mcpServerById:t,client:n,currentUser:r,onCreate:i,onUpdate:a,onDelete:o})=>{let{showError:c}=mn(),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)([]),[h,g]=(0,U.useState)([]),[_,y]=(0,U.useState)(``),[b]=B.useForm(),x=St(r?.role,Pt.ADMIN),S=(0,U.useCallback)(async()=>{if(!n||!x){m([]),g([]);return}let[e,t]=await Promise.all([n.service(`groups`).findAll({query:{archived:!1}}),n.service(`group-memberships`).findAll({})]);m(e),g(t)},[n,x]);(0,U.useEffect)(()=>{S().catch(e=>c(`Failed to load user groups: ${e instanceof Error?e.message:String(e)}`))},[S,c]);let C=(0,U.useMemo)(()=>{let e=new Map;for(let t of h){let n=e.get(t.user_id)||[];n.push(t.group_id),e.set(t.user_id,n)}return e},[h]),w=(0,U.useMemo)(()=>new Map(p.map(e=>[e.group_id,e])),[p]),T=(0,U.useMemo)(()=>hs(ds(e,(e,t)=>e.email.localeCompare(t.email,void 0,{sensitivity:`base`})),_,[e=>e.email,e=>e.name,e=>e.unix_username,e=>e.role,e=>(C.get(e.user_id)||[]).map(e=>w.get(e)).filter(e=>!!e).flatMap(e=>[e.name,e.slug])]),[e,_,C,w]),E=e=>{o?.(e)},O=()=>{b.validateFields().then(e=>{i?.({email:e.email,password:e.password,name:e.name,emoji:e.emoji||`👤`,role:e.role||Pt.MEMBER,unix_username:e.unix_username,must_change_password:e.must_change_password||!1}),b.resetFields(),u(!1)}).catch(()=>{})},k=e=>{switch(e){case`superadmin`:return`purple`;case`admin`:return`red`;case`member`:return`blue`;case`viewer`:return`default`;default:return`default`}};return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(s.Text,{type:`secondary`,children:`Manage user accounts and permissions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, email, username, role, or groups`,value:_,onChange:e=>y(e.target.value),style:{width:320}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>u(!0),children:`New User`})]})]}),(0,W.jsx)(D,{dataSource:T,columns:[{title:`User`,dataIndex:`email`,key:`email`,render:(e,t)=>(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{style:{fontSize:20},children:t.emoji||`👤`}),(0,W.jsx)(`span`,{children:(0,W.jsx)(vs,{text:e,query:_})})]})},{title:`Name`,dataIndex:`name`,key:`name`,render:e=>(0,W.jsx)(s.Text,{children:e?(0,W.jsx)(vs,{text:e,query:_}):`—`})},{title:`Role`,dataIndex:`role`,key:`role`,width:120,render:e=>(0,W.jsx)(v,{color:k(e),children:e.toUpperCase()})},{title:`Groups`,key:`groups`,width:280,render:(e,t)=>{let n=C.get(t.user_id)||[];return n.length===0?(0,W.jsx)(s.Text,{type:`secondary`,children:`—`}):(0,W.jsx)(z,{size:[4,4],wrap:!0,children:n.map(e=>w.get(e)).filter(e=>!!e).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,W.jsx)(v,{children:(0,W.jsx)(vs,{text:e.name,query:_})},e.group_id))})}},{title:`Actions`,key:`actions`,width:120,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:()=>f(t)}),(0,W.jsx)(ee,{title:`Delete user?`,description:`Are you sure you want to delete user "${t.email}"?`,onConfirm:()=>E(t.user_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),danger:!0})})]})}],rowKey:`user_id`,pagination:!1,size:`small`}),(0,W.jsx)(it,{title:`Create User`,open:l,onOk:O,onCancel:()=>{b.resetFields(),u(!1)},okText:`Create`,width:800,children:(0,W.jsxs)(B,{form:b,layout:`vertical`,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{label:`Name`,style:{marginBottom:24},children:(0,W.jsxs)(Ve,{gap:8,children:[(0,W.jsx)(B.Item,{name:`emoji`,initialValue:`👤`,noStyle:!0,children:(0,W.jsx)(Yi,{form:b,fieldName:`emoji`,defaultEmoji:`👤`})}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,style:{flex:1},children:(0,W.jsx)(L,{placeholder:`John Doe`,style:{flex:1}})})]})}),(0,W.jsx)(B.Item,{label:`Email`,name:`email`,rules:[{required:!0,message:`Please enter an email`},{type:`email`,message:`Please enter a valid email`}],children:(0,W.jsx)(L,{placeholder:`user@example.com`})}),(0,W.jsx)(B.Item,{label:`Unix Username`,name:`unix_username`,help:`Optional. Unix user for process impersonation (alphanumeric, hyphens, underscores only)`,rules:[{pattern:/^[a-z0-9_-]+$/,message:`Only lowercase letters, numbers, hyphens, and underscores allowed`},{max:32,message:`Unix username must be 32 characters or less`}],children:(0,W.jsx)(L,{placeholder:`johnsmith`,maxLength:32})}),(0,W.jsx)(B.Item,{label:`Password`,name:`password`,rules:[{required:!0,message:`Please enter a password`},{min:8,message:`Password must be at least 8 characters`}],children:(0,W.jsx)(L.Password,{placeholder:`••••••••`})}),(0,W.jsx)(B.Item,{label:`Role`,name:`role`,initialValue:Pt.MEMBER,rules:[{required:!0,message:`Please select a role`}],children:(0,W.jsx)(P,{options:Tn.map(e=>({value:e.value,label:e.label,title:e.description}))})}),(0,W.jsx)(B.Item,{name:`must_change_password`,valuePropName:`checked`,initialValue:!1,children:(0,W.jsx)(vt,{children:`Force password change on first login`})})]})}),(0,W.jsx)(tW,{open:!!d,onClose:()=>{f(null),S()},user:d,mcpServerById:t,client:n,currentUser:r,onUpdate:a})]})},{Sider:rW,Content:iW}=we,aW=({open:e,onClose:t,client:n,currentUser:r,boardById:i,boardObjects:a,repoById:o,branchById:s,sessionsByBranch:c,userById:l,mcpServerById:u,cardById:d=new Map,cardTypeById:p=new Map,activeTab:h=`boards`,onTabChange:g,onCreateBoard:_,onUpdateBoard:v,onDeleteBoard:y,onArchiveBoard:x,onUnarchiveBoard:S,onCreateRepo:C,onCreateLocalRepo:w,onUpdateRepo:E,onDeleteRepo:D,onArchiveOrDeleteBranch:O,onUnarchiveBranch:k,onUpdateBranch:A,onCreateBranch:ee,onStartEnvironment:j,onStopEnvironment:M,onCreateUser:N,onUpdateUser:te,onDeleteUser:P,onCreateMCPServer:ne,onDeleteMCPServer:re,gatewayChannelById:ie=new Map,onCreateGatewayChannel:ae,onUpdateGatewayChannel:oe,onDeleteGatewayChannel:F,artifactById:se=new Map,onUpdateArtifact:le,onDeleteArtifact:ue,branchStorageConfig:fe})=>{let[me,ge]=(0,U.useState)(null),[_e,ve]=(0,U.useState)(null),[ye,be]=(0,U.useState)([]),[I,xe]=(0,U.useState)(!1),Se=e=>{ge(e),ve(o.get(e.repo_id)||null),be(c.get(e.branch_id)||[]),xe(!0)},Ce=()=>{xe(!1),ge(null),ve(null),be([])},Te=async(e,t)=>{await O?.(e,t),Ce()},{token:Ee}=ce.useToken(),De=(0,U.useMemo)(()=>new Set($o),[]),L=Xo(`gateway`),Oe=Xo(`mcp_servers`),ke=Xo(`artifacts`),Ae=Xo(`cards`),je=St(r?.role,Pt.ADMIN),Me=(0,U.useMemo)(()=>[{key:`workspace`,label:`Workspace`,type:`group`,children:[{key:`boards`,label:`Boards`,icon:(0,W.jsx)(f,{})},{key:`repos`,label:`Repositories`,icon:(0,W.jsx)(de,{})},{key:`branches`,label:`Branches`,icon:(0,W.jsx)(ft,{})},{key:`assistants`,label:`Assistants`,icon:(0,W.jsx)(m,{})},...Ae?[{key:`cards`,label:(0,W.jsxs)(`span`,{children:[`Cards`,` `,(0,W.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`0 4px`,borderRadius:3,background:Ee.colorWarningBg,color:Ee.colorWarningText,border:`1px solid ${Ee.colorWarningBorder}`,marginLeft:4},children:`Beta`})]}),icon:(0,W.jsx)(Fe,{})}]:[],...ke?[{key:`artifacts`,label:`Artifacts`,icon:(0,W.jsx)(ct,{})}]:[]]},{key:`integrations`,label:`Integrations`,type:`group`,children:[{key:`agentic-tools`,label:`Agentic Tools`,icon:(0,W.jsx)(lt,{})},...Oe&&je?[{key:`mcp`,label:`MCP Servers`,icon:(0,W.jsx)(mt,{})}]:[],...L&&je?[{key:`gateway`,label:`Gateway Channels`,icon:(0,W.jsx)(T,{})}]:[]]},{key:`admin`,label:`Admin`,type:`group`,children:[...je?[{key:`groups`,label:`Groups`,icon:(0,W.jsx)(Ne,{})}]:[],{key:`users`,label:`Users`,icon:(0,W.jsx)(Ne,{})}]},{key:`system`,label:`System`,type:`group`,children:[{key:`about`,label:`About`,icon:(0,W.jsx)(he,{})}]}],[L,Oe,ke,Ae,je,Ee]);return(0,W.jsxs)(it,{title:null,open:e,onCancel:t,footer:null,closable:!0,width:1200,style:{top:40},styles:{wrapper:{padding:0,overflow:`hidden`},container:{padding:0,borderRadius:8,overflow:`hidden`},header:{display:`none`},body:{padding:0,height:`calc(100vh - 200px)`,minHeight:500,maxHeight:800}},closeIcon:(0,W.jsx)(b,{}),children:[(0,W.jsxs)(we,{style:{height:`100%`,background:Ee.colorBgContainer},children:[(0,W.jsxs)(rW,{width:240,style:{background:Ee.colorBgElevated,borderRight:`1px solid ${Ee.colorBorderSecondary}`,overflow:`auto`,padding:`20px 0`},children:[(0,W.jsx)(`div`,{style:{padding:`0 24px 16px`,fontWeight:600,fontSize:18,color:Ee.colorText},children:`Settings`}),(0,W.jsx)(pe,{mode:`inline`,selectedKeys:[h],onClick:({key:e})=>{De.has(e)&&g?.(e)},items:Me,style:{border:`none`,background:`transparent`}})]}),(0,W.jsx)(iW,{style:{padding:`40px 32px 32px`,overflow:`auto`},children:(()=>{switch(h){case`boards`:return(0,W.jsx)(qH,{client:n,boardById:i,sessionsByBranch:c,branchById:s,onCreate:_,onUpdate:v,onDelete:y,onArchive:x,onUnarchive:S});case`repos`:return(0,W.jsx)(kU,{repoById:o,onCreate:C,onCreateLocal:w,onUpdate:E,onDelete:D});case`branches`:return(0,W.jsx)(rU,{client:n,branchById:s,repoById:o,boardById:i,sessionsByBranch:c,onArchiveOrDelete:O,onUnarchive:k,onCreate:ee,onRowClick:Se,onStartEnvironment:j,onStopEnvironment:M,onClose:t,branchStorageConfig:fe});case`assistants`:return(0,W.jsx)(zH,{branchById:s,repoById:o,boardById:i,sessionsByBranch:c,userById:l,client:n,onArchiveOrDelete:O,onRowClick:Se,onCreateBranch:ee,onUpdateBranch:A,onCreateRepo:C,onClose:t});case`cards`:return(0,W.jsx)(uU,{client:n,cardById:d,cardTypeById:p,boardById:i,boardObjects:a});case`artifacts`:return(0,W.jsx)(NH,{artifactById:se,branchById:s,boardById:i,onUpdate:le,onDelete:ue,onClose:t});case`mcp`:return(0,W.jsx)(Gc,{mcpServerById:u,client:n,onCreate:ne,onDelete:re});case`agentic-tools`:return(0,W.jsx)(EH,{client:n});case`gateway`:return(0,W.jsx)(SU,{client:n,gatewayChannelById:ie,branchById:s,userById:l,mcpServerById:u,currentUser:r,onCreate:ae,onUpdate:oe,onDelete:F});case`groups`:return(0,W.jsx)(DU,{client:n,currentUser:r,userById:l});case`users`:return(0,W.jsx)(nW,{userById:l,mcpServerById:u,client:n,currentUser:r,onCreate:N,onUpdate:te,onDelete:P});case`about`:return(0,W.jsx)(yH,{client:n,connected:n?.io?.connected??!1,connectionError:void 0,isAdmin:St(r?.role,Pt.ADMIN)});default:return null}})()})]}),(0,W.jsx)(gH,{open:I,onClose:Ce,branch:me,repo:_e,sessions:ye,boardById:i,boardObjects:a,mcpServerById:u,client:n,currentUser:r,onUpdateBranch:A,onUpdateRepo:E,onArchiveOrDelete:Te,onOpenSettings:t})]})},oW=new Map,sW=({open:e,user:t,client:n,mcpServerById:r=oW,onClose:i,onUpdateUser:a,onRefreshCurrentUser:o,onRestartOnboarding:s})=>(0,W.jsx)(tW,{open:e,onClose:i,user:t,currentUser:t,mcpServerById:r,client:n,onUpdate:async(e,t)=>{await a(e,t),await o()},onRestartOnboarding:s}),cW=e=>e.startsWith(`/`)?e:`/${e}`;function lW(e,t){return qt({path:t,end:!0},cW(e))!==null}function uW(e,t){return e.routePaths.some(e=>lW(t,e))}function dW(e){return e}var fW=[`/knowledge`,`/knowledge/:namespaceSlug/*`,`/kb`,`/kb/:namespaceSlug/*`],pW=dW({id:`knowledge`,label:`Knowledge`,routePaths:fW,startsWorkspaceRuntime:!1,usesDeviceRouter:!1,usesSharedUserSettings:!0}),mW=[`/a/:artifactShortId/fullscreen`],hW=dW({id:`artifact-fullscreen`,label:`Artifact fullscreen`,routePaths:mW,startsWorkspaceRuntime:!1,usesDeviceRouter:!1,usesSharedUserSettings:!0}),gW=dW({id:`demo`,label:`Demo`,routePaths:[`/demo/streamdown`],startsWorkspaceRuntime:!1,usesDeviceRouter:!1,usesSharedUserSettings:!1}),_W=dW({id:`workspace`,label:`Workspace`,routePaths:[`/*`],startsWorkspaceRuntime:!0,usesDeviceRouter:!0,usesSharedUserSettings:!1}),vW=[pW,hW,gW,_W];function yW(e){return vW.find(t=>uW(t,e))??_W}function bW(e){return yW(e).usesDeviceRouter}function xW(e){let t=yW(e),n=t.startsWorkspaceRuntime,[r,i]=(0,U.useState)(n);return(0,U.useEffect)(()=>{n&&i(!0)},[n]),{currentSurface:t,routeRequiresWorkspaceSurface:n,workspaceSurfaceStarted:r,workspaceSurfaceShouldRun:n||r}}function SW(){return typeof window<`u`&&window.innerWidth<768?!0:typeof navigator<`u`?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent):!1}async function CW(e,t,n,r){let i=new Set(n),a=new Set(r);await Promise.all([...r.filter(e=>!i.has(e)).map(n=>e.service(`sessions/${t}/mcp-servers`).create({mcpServerId:n})),...n.filter(e=>!a.has(e)).map(n=>e.service(`sessions/${t}/mcp-servers`).remove(n))])}var wW=new Set;function TW(e,t,n){let r=null;return()=>(r??=t().then(t=>(wW.add(e),n(t))),r)}var EW=TW(`workspace`,()=>H(()=>import(`./App-9s2WHM6S.js`),__vite__mapDeps([126,1,2,3,4,127,128,129,130,131,132,133,104,105,134,135,136,137,138,139])),e=>({default:e.App})),DW=TW(`knowledge`,()=>H(()=>import(`./KnowledgePage-CdftslnF.js`),__vite__mapDeps([140,1,128,129,2,3,4,130,131,132,133,135,136,104,105])),e=>({default:e.KnowledgePage})),OW=TW(`artifact-fullscreen`,()=>H(()=>import(`./ArtifactFullscreenPage-VQxLMCiN.js`),__vite__mapDeps([141,1,2,3,4,134,129,130,135])),e=>({default:e.ArtifactFullscreenPage})),kW=TW(`mobile`,()=>H(()=>import(`./MobileApp-BdBMpnJ1.js`),__vite__mapDeps([142,1,127,128,129,2,3,4,130,131,132,133,104,105])),e=>({default:e.MobileApp})),AW=TW(`demo`,()=>H(()=>import(`./StreamdownDemoPage-B9wbgp2s.js`),__vite__mapDeps([143,3,1,4])),e=>({default:e.StreamdownDemoPage})),jW=(0,U.lazy)(EW),MW=(0,U.lazy)(DW),NW=(0,U.lazy)(OW),PW=(0,U.lazy)(kW),FW=(0,U.lazy)(AW),IW={workspace:EW,knowledge:DW,"artifact-fullscreen":OW,demo:AW,mobile:kW};function LW(e,t){return t.startsWith(`/m`)?`mobile`:e}function RW(e){return wW.has(e)?Promise.resolve():IW[e]()}function zW(){let e=hn(),t=Jt();return(0,U.useEffect)(()=>{if(!bW(e.pathname))return;let n=()=>{let n=SW(),r=e.pathname.startsWith(`/m`);n&&!r?t(`/m`,{replace:!0}):!n&&r&&t(`/`,{replace:!0})};n();let r,i=()=>{clearTimeout(r),r=setTimeout(n,200)};return window.addEventListener(`resize`,i),()=>{window.removeEventListener(`resize`,i),clearTimeout(r)}},[e.pathname,t]),null}function BW(){let{showSuccess:e,showError:t,showWarning:n,showLoading:r,destroy:i}=mn(),a=Jt(),o=hn(),{currentSurface:s,workspaceSurfaceShouldRun:c}=xW(o.pathname),l=s.usesSharedUserSettings,u=LW(s.id,o.pathname),[d,f]=(0,U.useState)(()=>wW.has(u));(0,U.useEffect)(()=>{let e=!1;return wW.has(u)||f(!1),RW(u).catch(()=>{}).finally(()=>{e||f(!0)}),()=>{e=!0}},[u]);let{config:p,instanceConfig:m,onboardingConfig:h,servicesConfig:g,featuresConfig:_,loading:v,error:y}=No(),{user:b,authenticated:x,loading:S,error:C,accessToken:w,login:T,logout:E,reAuthenticate:D}=Mo(),{client:O,connected:k,connecting:A,error:ee,retryConnection:j}=ao({accessToken:x?w:null}),{capturedSha:M,currentSha:N,outOfSync:te}=Jo(O),{sessionById:P,sessionsByBranch:ne,boardById:re,boardObjectById:ie,boardObjectsByBoardId:ae,commentById:oe,cardById:F,cardTypeById:se,repoById:ce,branchById:le,userById:ue,mcpServerById:de,gatewayChannelById:fe,artifactById:pe,sessionMcpServerIds:me,userAuthenticatedMcpServerIds:he,initialLoadItems:ge,initialLoadComplete:_e,loadingStage:ve,loading:ye,error:be}=So(O,{enabled:c&&!b?.must_change_password}),{createSession:xe,forkSession:Se,btwForkSession:Ce,spawnSession:we,updateSession:Te,deleteSession:Ee}=Qo(O),{createBoard:De,updateBoard:L,deleteBoard:Oe,archiveBoard:ke,unarchiveBoard:Ae}=Po(O),[je,Me]=(0,U.useState)(null),[R,Ne]=(0,U.useState)(!1),[Pe,Fe]=(0,U.useState)(!1);(0,U.useEffect)(()=>{o.pathname===`/gateway/github/setup`&&o.search.includes(`installation_id`)&&Me(`gateway`)},[o.pathname,o.search]);let[Ie,Le]=(0,U.useState)(new Map),[Re,ze]=(0,U.useState)(!1);(0,U.useEffect)(()=>{!ye&&!be&&_e&&ze(!0)},[ye,_e,be]);let Be=Lo({connecting:A,loading:ye,dataError:be,mustChangePassword:!!b?.must_change_password,initialLoadComplete:_e&&d}),Ve=(0,W.jsx)(Nr,{phase:Be===`done`?`fading`:Be,connecting:A,loadingStage:ve,items:ge}),He=c?Ve:(0,W.jsx)(Nr,{message:`Loading surface…`}),Ue=b?ue.get(b.user_id)||b:null;(0,U.useEffect)(()=>{vr({buildSha:M,userEmail:Ue?.email??null})},[M,Ue?.email]);let[We,Ge]=(0,U.useState)(!1),[Ke,qe]=(0,U.useState)(0);(0,U.useEffect)(()=>{Ue&&Ue.onboarding_completed===!1&&!Ue.must_change_password&&k&&c&&s.startsWorkspaceRuntime&&!ye&&Ge(!0)},[Ue,k,c,s.startsWorkspaceRuntime,ye]);let Je=async e=>{if(Ge(!1),Ue){if(at(Ue.user_id,{onboarding_completed:!0,preferences:{...Ue.preferences,mainBoardId:e.boardId||Ue.preferences?.mainBoardId,onboarding:{path:e.path,branchId:e.branchId,boardId:e.boardId}}},{silent:!0}).catch(()=>{}),e.path===`assistant`&&O)try{await O.service(`config`).patch(null,{onboarding:{assistantPending:!1}})}catch{}e.sessionId?a(Nt(e.sessionId)):e.boardId?a(rn(e.boardId,re.get(e.boardId)?.slug)):a(`/`)}};if(v)return(0,W.jsx)(Nr,{message:`Loading…`});if(y&&!p)return(0,W.jsx)(`div`,{style:{height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`},children:(0,W.jsx)(I,{type:`warning`,title:`Could not fetch daemon configuration`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:y.message}),(0,W.jsx)(`p`,{children:`Defaulting to requiring authentication. Start the daemon with:`}),(0,W.jsx)(`p`,{children:(0,W.jsx)(`code`,{children:`cd apps/agor-daemon && pnpm dev`})})]}),showIcon:!0})});let Ye=typeof window<`u`&&!!(localStorage.getItem(`agor-access-token`)||localStorage.getItem(`agor-refresh-token`));if(!S&&!x&&!Ye)return(0,W.jsx)(Hr,{onLogin:T,error:C,externalLaunchLoginRedirectUrl:p?.externalLaunch?.enabled?p.externalLaunch.loginRedirectUrl:void 0});if(Ye&&(!k||!x)&&c&&!Re)return(0,W.jsx)(Nr,{message:`Reconnecting to daemon…`});if(S)return(0,W.jsx)(Nr,{message:`Authenticating…`});if(ee)return(0,W.jsx)(`div`,{style:{height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`},children:(0,W.jsx)(I,{type:`error`,title:`Failed to connect to Agor daemon`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:ee}),(0,W.jsxs)(`p`,{children:[`Start the daemon with: `,(0,W.jsx)(`code`,{children:`cd apps/agor-daemon && pnpm dev`})]})]}),showIcon:!0})});if(c&&(Be!==`done`||!d))return Ve;if(c&&be&&!b?.must_change_password)return(0,W.jsx)(`div`,{style:{height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`},children:(0,W.jsx)(I,{type:`error`,title:`Failed to load data`,description:be,showIcon:!0})});let Xe=async(n,r)=>{try{let r=n.branch_id;if(!r)throw Error(`Branch ID is required to create a session`);let i=await xe({...n,branch_id:r});if(i){if(n.mcpServerIds&&n.mcpServerIds.length>0)for(let e of n.mcpServerIds)try{await O?.service(`sessions/${i.session_id}/mcp-servers`).create({mcpServerId:e})}catch(t){console.error(`Failed to associate MCP server ${e}:`,t)}return n.envVarNames&&n.envVarNames.length>0&&await Pt(i.session_id,n.envVarNames),e(`Session created!`),n.initialPrompt?.trim()&&await tt(i.session_id,n.initialPrompt,n.permissionMode),i.session_id}else return t(`Failed to create session`),null}catch(e){return t(`Failed to create session: ${e instanceof Error?e.message:String(e)}`),null}},Ze=(e,t)=>{Le(n=>{let r=new Map(n);return t.trim()?r.set(e,t):r.delete(e),r})},Qe=e=>{Le(t=>{let n=new Map(t);return n.delete(e),n})},$e=async(n,r)=>{try{let t=await Se(n,r);e(`Session forked successfully!`),Ze(t.session_id,r),Qe(n)}catch(e){throw t(`Failed to fork session: ${e instanceof Error?e.message:`Failed to fork session`}`),e}},z=async(n,r)=>{try{let t=await Ce(n,r);e(`Side question sent via btw fork`),Ze(t.session_id,r),Qe(n)}catch(e){throw t(`Failed to create btw fork: ${e instanceof Error?e.message:`Failed to create btw fork`}`),e}},et=async(n,r)=>{let i=typeof r==`string`?{prompt:r}:r;try{let t=await we(n,i);e(`Subsession session spawned successfully!`),i.prompt?.trim()&&Ze(t.session_id,i.prompt),Qe(n)}catch(e){throw t(`Failed to spawn session: ${e instanceof Error?e.message:`Failed to spawn session`}`),e}},tt=async(e,n,r)=>{if(O)try{await O.sessions.prompt(e,n,{permissionMode:r,messageSource:`agor`}),Qe(e)}catch(e){t(`Failed to send prompt: ${e instanceof Error?e.message:String(e)}`),console.error(`Prompt error:`,e)}},nt=async(n,r)=>{await Te(n,r)?e(`Session updated successfully!`):t(`Failed to update session`)},rt=async n=>{await Ee(n)?e(`Session deleted successfully!`):t(`Failed to delete session`)},it=async n=>{if(O)try{await O.service(`users`).create(n),e(`User created successfully!`)}catch(e){t(`Failed to create user: ${e instanceof Error?e.message:String(e)}`)}},at=async(n,r,i={})=>{if(O)try{await O.service(`users`).patch(n,r),i.silent||e(`User updated successfully!`)}catch(e){throw i.silent||t(`Failed to update user: ${e instanceof Error?e.message:String(e)}`),e}},ot=async()=>{if(!Ue)return;let e={...Ue.preferences??{}};delete e.onboarding;try{await at(Ue.user_id,{preferences:e},{silent:!0})}catch(e){t(`Failed to restart onboarding: ${e instanceof Error?e.message:String(e)}`);return}Ne(!1),qe(e=>e+1),Ge(!0)},st=async n=>{if(O)try{await O.service(`users`).remove(n),e(`User deleted successfully!`)}catch(e){t(`Failed to delete user: ${e instanceof Error?e.message:String(e)}`)}},ct=async(t,n)=>{if(!O)throw Error(`Not connected`);await O.service(`users`).patch(t,{password:n}),e(`Password changed successfully!`),await D()},B=async t=>{if(t.board_id)return t;let n=await De(t);return n&&e(`Board created successfully!`),n},lt=async(t,n)=>{await L(t,n)&&e(`Board updated successfully!`)},ut=async t=>{await Oe(t)&&e(`Board deleted successfully!`)},dt=async t=>{await ke(t)&&e(`Board archived successfully!`)},ft=async t=>{await Ae(t)&&e(`Board unarchived successfully!`)},pt=async i=>{if(!O){t(`Not connected to daemon — cannot clone repository`);return}let a=`clone-repo-${i.slug}`;r(`Cloning ${i.slug}...`,{key:a});let o=O.service(`repos`),s=!1,c=()=>{o.removeListener(`created`,l),o.removeListener(`patched`,u),O.io.off(`repo:cloneError`,d),clearTimeout(f)},l=t=>{s||t.slug!==i.slug||t.clone_status!==`cloning`&&(s=!0,e(`Cloned ${i.slug}`,{key:a}),c())},u=n=>{if(!(s||n.slug!==i.slug)){if(n.clone_status===`ready`)s=!0,e(`Cloned ${i.slug}`,{key:a}),c();else if(n.clone_status===`failed`){s=!0;let e=n.clone_error,r=e?.category===`auth_failed`?` — configure GITHUB_TOKEN in Settings → API Keys for private repos`:``;t(`Failed to clone ${i.slug}: ${e?.message??`unknown error`}${r}`,{key:a}),c()}}},d=e=>{s||e.slug!==i.slug&&e.url!==i.url||(s=!0,t(`Failed to clone ${i.slug}: ${e.error??`unknown error`}`,{key:a}),c())},f=setTimeout(()=>{s||(s=!0,t(`Clone of ${i.slug} timed out after 2 minutes. Check daemon logs.`,{key:a}),c())},12e4);o.on(`created`,l),o.on(`patched`,u),O.io.on(`repo:cloneError`,d);try{(await O.service(`repos/clone`).create({url:i.url,slug:i.slug,default_branch:i.default_branch}))?.status===`exists`&&!s&&(s=!0,n(`Repository "${i.slug}" is already added`,{key:a}),c())}catch(e){throw s||(s=!0,t(`Failed to clone repository: ${e instanceof Error?e.message:String(e)}`,{key:a}),c()),e}},V=async n=>{if(!O){t(`Not connected to daemon — cannot add local repository`);return}try{r(`Adding local repository...`,{key:`add-local-repo`}),await O.service(`repos/local`).create({path:n.path,slug:n.slug}),e(`Local repository added successfully!`,{key:`add-local-repo`})}catch(e){throw t(`Failed to add local repository: ${e instanceof Error?e.message:String(e)}`,{key:`add-local-repo`}),e}},mt=async(n,r)=>{if(O)try{await O.service(`repos`).patch(n,r),e(`Repository updated successfully!`)}catch(e){t(`Failed to update repository: ${e instanceof Error?e.message:String(e)}`)}},ht=async(n,r)=>{if(O)try{await O.service(`repos`).remove(n,{query:{cleanup:r}}),e(r?`Repository and files deleted successfully!`:`Repository removed from Agor (files preserved)`)}catch(e){let n=e instanceof Error?e.message:String(e);n.includes(`Partial deletion occurred:`)?t(`⚠️ PARTIAL DELETION: Some files were permanently deleted. ${n}`):n.includes(`No files were deleted`)?t(`Deletion failed, but no files were removed. ${n}`):t(`Failed to delete repository: ${n}`)}},gt=async(n,i)=>{if(!O)throw Error(`Not connected to daemon`);try{let t=i.metadataAction===`archive`?`archived`:`deleted`;r(`${i.metadataAction===`archive`?`Archiving`:`Deleting`} branch...`,{key:`archive-delete`}),await O.service(`branches/${n}/archive-or-delete`).create(i),e(`Branch ${t} successfully!`,{key:`archive-delete`})}catch(e){throw t(`Failed to ${i.metadataAction} branch: ${e instanceof Error?e.message:String(e)}`,{key:`archive-delete`}),e}},_t=async(n,i)=>{if(!O)throw Error(`Not connected to daemon`);try{r(`Unarchiving branch...`,{key:`unarchive`}),await O.service(`branches/${n}/unarchive`).create(i||{}),e(`Branch unarchived successfully!`,{key:`unarchive`})}catch(e){throw t(`Failed to unarchive branch: ${e instanceof Error?e.message:String(e)}`,{key:`unarchive`}),e}},vt=async(n,r,i={})=>{if(O)try{await O.service(`branches`).patch(n,r),i.silent||e(`Branch updated successfully!`)}catch(e){t(`Failed to update branch: ${e instanceof Error?e.message:String(e)}`)}},yt=async(e,n)=>{if(!O)return null;try{r(`Creating branch...`,{key:`create-branch`});let t=await O.service(`repos/${e}/branches`).create({name:n.name,ref:n.ref,refType:n.refType,createBranch:n.createBranch,pullLatest:n.pullLatest,sourceBranch:n.sourceBranch,issue_url:n.issue_url,pull_request_url:n.pull_request_url,boardId:n.boardId,custom_context:n.custom_context,notes:n.notes,position:n.position,storage_mode:n.storage_mode,clone_depth:n.clone_depth});return i(`create-branch`),t}catch(e){return t(`Failed to create branch: ${e instanceof Error?e.message:String(e)}`,{key:`create-branch`}),null}},bt=async n=>{if(O)try{r(`Starting environment...`,{key:`start-env`}),await O.service(`branches/${n}/start`).create({}),e(`Environment started successfully!`,{key:`start-env`})}catch(e){t(`Failed to start environment: ${e instanceof Error?e.message:String(e)}`,{key:`start-env`})}},xt=async n=>{if(O)try{r(`Stopping environment...`,{key:`stop-env`}),await O.service(`branches/${n}/stop`).create({}),e(`Environment stopped successfully!`,{key:`stop-env`})}catch(e){t(`Failed to stop environment: ${e instanceof Error?e.message:String(e)}`,{key:`stop-env`})}},St=async n=>{if(O)try{r(`Nuking environment...`,{key:`nuke-env`}),await O.service(`branches/${n}/nuke`).create({}),e(`Environment nuked successfully!`,{key:`nuke-env`})}catch(e){t(`Failed to nuke environment: ${e instanceof Error?e.message:String(e)}`,{key:`nuke-env`})}},wt=async n=>{if(O)try{r(`Starting scheduled run...`,{key:`execute-now`}),await O.service(`branches/${n}/execute-schedule-now`).create({}),e(`Scheduled run started!`,{key:`execute-now`})}catch(e){throw t(`Failed to start scheduled run: ${e instanceof Error?e.message:String(e)}`,{key:`execute-now`}),e}},Tt=async n=>{if(O)try{await O.service(`mcp-servers`).create(n),e(`MCP server added successfully!`)}catch(e){t(`Failed to add MCP server: ${e instanceof Error?e.message:String(e)}`)}},Et=async n=>{if(O)try{await O.service(`mcp-servers`).remove(n),e(`MCP server deleted successfully!`)}catch(e){t(`Failed to delete MCP server: ${e instanceof Error?e.message:String(e)}`)}},Dt=async n=>{if(O)try{await O.service(`gateway-channels`).create(n),e(`Gateway channel created!`)}catch(e){t(`Failed to create gateway channel: ${e instanceof Error?e.message:String(e)}`)}},Ot=async(n,r)=>{if(O)try{await O.service(`gateway-channels`).patch(n,r),e(`Gateway channel updated!`)}catch(e){t(`Failed to update gateway channel: ${e instanceof Error?e.message:String(e)}`)}},kt=async n=>{if(O)try{await O.service(`gateway-channels`).remove(n),e(`Gateway channel deleted!`)}catch(e){t(`Failed to delete gateway channel: ${e instanceof Error?e.message:String(e)}`)}},At=async(n,r)=>{if(O)try{await O.service(`artifacts`).patch(n,r),e(`Artifact updated!`)}catch(e){t(`Failed to update artifact: ${e instanceof Error?e.message:String(e)}`)}},jt=async n=>{if(O)try{await O.service(`artifacts`).remove(n),e(`Artifact deleted!`)}catch(e){t(`Failed to delete artifact: ${e instanceof Error?e.message:String(e)}`)}},Pt=async(e,n)=>{if(O)try{await O.service(`sessions/${e}/env-selections`).patch(null,{envVarNames:n})}catch(e){t(`Failed to update session env var selections: ${e instanceof Error?e.message:String(e)}`)}},Ft=async(e,n)=>{if(O)try{await CW(O,e,me.get(e)||[],n)}catch(e){t(`Failed to update MCP servers: ${e instanceof Error?e.message:String(e)}`)}},It=async(e,n)=>{if(O)try{await O.service(`board-comments`).create({board_id:e,created_by:b?.user_id||`unknown`,content:n,content_preview:n.slice(0,200)})}catch(e){t(`Failed to send comment: ${e instanceof Error?e.message:String(e)}`)}},Lt=async e=>{if(O)try{let t=oe.get(e);await O.service(`board-comments`).patch(e,{resolved:!t?.resolved})}catch(e){t(`Failed to resolve comment: ${e instanceof Error?e.message:String(e)}`)}},Rt=async n=>{if(O)try{await O.service(`board-comments`).remove(n),e(`Comment deleted`)}catch(e){t(`Failed to delete comment: ${e instanceof Error?e.message:String(e)}`)}},zt=async(e,n)=>{if(O)try{await O.service(`board-comments/${e}/reply`).create({content:n,created_by:b?.user_id||`unknown`})}catch(e){t(`Failed to send reply: ${e instanceof Error?e.message:String(e)}`)}},Bt=async(e,n)=>{if(O)try{await O.service(`board-comments/${e}/toggle-reaction`).create({user_id:b?.user_id||`unknown`,emoji:n})}catch(e){t(`Failed to toggle reaction: ${e instanceof Error?e.message:String(e)}`)}},Vt=Ct(Array.from(ce.values()),Array.from(le.values()));Vt.filter(e=>e.type===`managed-branch`),Vt.filter(e=>e.type===`managed`);let Ht=()=>{Me(null)},Ut=()=>{Ne(!1)},Wt=()=>{Fe(!1)},Gt=(0,W.jsx)(MW,{client:O,currentUser:Ue,userById:ue,onUserSettingsClick:()=>Ne(!0),onLogout:E}),Kt=(0,W.jsx)(NW,{client:O,currentUser:Ue,onUserSettingsClick:()=>Ne(!0),onLogout:E}),qt=(0,W.jsx)(jW,{client:O,user:Ue,connected:k,connecting:A,sessionById:P,sessionsByBranch:ne,availableAgents:gr,boardById:re,boardObjectById:ie,boardObjectsByBoardId:ae,commentById:oe,cardById:F,cardTypeById:se,repoById:ce,branchById:le,userById:ue,mcpServerById:de,sessionMcpServerIds:me,userAuthenticatedMcpServerIds:he,openSettingsTab:je,onSettingsClose:Ht,openUserSettings:R,onUserSettingsClose:Ut,openNewBranchModal:Pe,onNewBranchModalClose:Wt,suppressLeftPanel:We,onCreateSession:Xe,onForkSession:$e,onBtwForkSession:z,onSpawnSession:et,onSendPrompt:tt,onUpdateSession:nt,onDeleteSession:rt,onCreateBoard:B,onUpdateBoard:lt,onDeleteBoard:ut,onArchiveBoard:dt,onUnarchiveBoard:ft,onCreateRepo:pt,onCreateLocalRepo:V,onUpdateRepo:mt,onDeleteRepo:ht,onArchiveOrDeleteBranch:gt,onUnarchiveBranch:_t,onUpdateBranch:vt,onCreateBranch:yt,onStartEnvironment:bt,onStopEnvironment:xt,onNukeEnvironment:St,onExecuteScheduleNow:wt,onCreateUser:it,onUpdateUser:at,onDeleteUser:st,onCreateMCPServer:Tt,onDeleteMCPServer:Et,gatewayChannelById:fe,onCreateGatewayChannel:Dt,onUpdateGatewayChannel:Ot,onDeleteGatewayChannel:kt,artifactById:pe,onUpdateArtifact:At,onDeleteArtifact:jt,onUpdateSessionMcpServers:Ft,onUpdateSessionEnvSelections:Pt,onSendComment:It,onReplyComment:zt,onResolveComment:Lt,onToggleReaction:Bt,onDeleteComment:Rt,onLogout:E,onRetryConnection:j,instanceLabel:m?.label,instanceDescription:m?.description,webTerminalEnabled:_?.webTerminal===!0,branchStorageConfig:_?.branchStorage,onRestartOnboarding:ot});return(0,W.jsx)(ja.Provider,{value:g,children:(0,W.jsxs)(Da,{value:{connected:k,connecting:A,outOfSync:te,capturedSha:M,currentSha:N},children:[(0,W.jsx)(jr,{open:!!Ue?.must_change_password,user:Ue,onChangePassword:ct,onLogout:E}),l&&(0,W.jsx)(sW,{open:R,onClose:()=>Ne(!1),user:Ue,client:O,mcpServerById:de,onUpdateUser:at,onRefreshCurrentUser:D,onRestartOnboarding:ot}),(0,W.jsx)(_a,{open:We,onComplete:Je,repoById:ce,branchById:le,boardById:re,user:Ue,client:O,onCreateRepo:pt,onCreateLocalRepo:V,onCreateBranch:yt,onCreateSession:Xe,onUpdateUser:(e,t)=>at(e,t,{silent:!0}),onUpdateBranch:(e,t)=>vt(e,t,{silent:!0}),onCheckAuth:async(e,t)=>{if(!O)return{authenticated:!1,method:`none`};try{return await O.service(`check-auth`).create({tool:e,apiKey:t})}catch{return{authenticated:!1,method:`none`,hint:`Connection check failed.`}}},assistantPending:h?.assistantPending??h?.persistedAgentPending,frameworkRepoUrl:h?.frameworkRepoUrl},`${Ue?.user_id??`__anon__`}:${Ke}`),(0,W.jsx)(zW,{}),(0,W.jsx)(U.Suspense,{fallback:He,children:(0,W.jsxs)(pn,{children:[(0,W.jsx)(ln,{path:`/demo/streamdown`,element:(0,W.jsx)(FW,{})}),fW.map(e=>(0,W.jsx)(ln,{path:e,element:Gt},e)),mW.map(e=>(0,W.jsx)(ln,{path:e,element:Kt},e)),(0,W.jsx)(ln,{path:`/m/*`,element:(0,W.jsx)(PW,{client:O,user:b,sessionById:P,sessionsByBranch:ne,boardById:re,commentById:oe,repoById:ce,branchById:le,userById:ue,onSendPrompt:tt,onSendComment:It,onReplyComment:zt,onResolveComment:Lt,onToggleReaction:Bt,onDeleteComment:Rt,onLogout:E,promptDrafts:Ie,onUpdateDraft:Ze})}),(0,W.jsx)(ln,{path:`/${Mt.board}/:boardParam/`,element:qt}),(0,W.jsx)(ln,{path:`/${Mt.session}/:sessionShortId/`,element:qt}),(0,W.jsx)(ln,{path:`/${Mt.branch}/:branchShortId/`,element:qt}),(0,W.jsx)(ln,{path:`/${Mt.artifact}/:artifactShortId/`,element:qt}),(0,W.jsx)(ln,{path:`/*`,element:qt})]})})]})})}function VW(){let{getCurrentThemeConfig:e}=Ra();return(0,W.jsx)(ge,{theme:e(),children:(0,W.jsx)(M,{children:(0,W.jsx)(kr,{variant:`global`,children:(0,W.jsx)(ba,{children:(0,W.jsx)(BW,{})})})})})}function HW(){return(0,W.jsx)(tn,{basename:`/ui`,children:(0,W.jsx)(La,{children:(0,W.jsx)(VW,{})})})}function UW(e){return new Promise((t,n)=>{let r=document.createElement(`textarea`);r.value=e,r.style.position=`fixed`,r.style.left=`-999999px`,r.style.top=`-999999px`,document.body.appendChild(r),r.focus(),r.select();try{let e=document.execCommand(`copy`);document.body.removeChild(r),e?t():n(Error(`execCommand copy failed`))}catch(e){document.body.removeChild(r),n(e)}})}function WW(){navigator.clipboard?.writeText||Object.defineProperty(navigator,"clipboard",{value:{writeText:UW,readText:()=>Promise.reject(Error(`Reading clipboard not supported`))},writable:!1,configurable:!0})}WW(),(0,$n.createRoot)(document.getElementById(`root`)).render((0,W.jsx)(HW,{}));export{_c as $,gr as $t,DV as A,Vo as At,Al as B,Oa as Bt,sH as C,us as Ct,FV as D,Qo as Dt,zV as E,es as Et,mB as F,No as Ft,rl as G,Ca as Gt,Cl as H,Aa as Ht,pB as I,Ua as It,Ic as J,Ki as Jt,Wc as K,Sa as Kt,dB as L,Ja as Lt,hV as M,zo as Mt,MB as N,Io as Nt,PV as O,Xo as Ot,hB as P,Fo as Pt,yc as Q,kr as Qt,nB as R,za as Rt,gH as S,vs as St,BV as T,ts as Tt,vl as U,wa as Ut,Tl as V,ka as Vt,gl as W,Ta as Wt,Ac as X,Bi as Xt,Pc as Y,Ui as Yt,jc as Z,Fr as Zt,LH as _,Us as _t,LU as a,Qn as an,Ec as at,jH as b,Is as bt,oU as c,Dc as ct,XH as d,oc as dt,mr as en,gc as et,GH as f,vc as ft,RH as g,Gs as gt,UH as h,qs as ht,PU as i,Zn as in,dc as it,_V as j,Ro as jt,LV as k,Go as kt,eU as l,Oc as lt,WH as m,Js as mt,aW as n,tr as nn,cc as nt,OU as o,xc as ot,KH as p,Ys as pt,Vc as q,qi as qt,tW as r,Xn as rn,rc as rt,sU as s,lc as st,CW as t,dr as tn,kc as tt,$H as u,bc as ut,IH as v,zs as vt,oH as w,ls as wt,OH as x,Rs as xt,PH as y,Fs as yt,iR as z,Ra as zt};
|