@ensocode/server 0.3.3 → 0.3.4
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/README.md +10 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +117 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-MGNURJ72.js +6 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{azure-openai-responses-FSC6BAW3.js → azure-openai-responses-4WDOP7MF.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-4KSTFUIK.js +19 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-4UNPP53I.js +55 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-CCYGJPSU.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-4EYXVSA5.js → chunk-FF6XOTWB.js} +9 -9
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-FMPAMX2W.js +82 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-C2WU32PX.js → chunk-H4W2F2IO.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-EOO47QGR.js → chunk-JLFZH7C6.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-LCB5FO32.js +4 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-GN3QYODH.js → chunk-LQUBM7HF.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-MABPTPMF.js +30 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-MPEFJ3RP.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-EBFHJFEE.js → chunk-PYBKJQVF.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-VKJQ6CME.js +8 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-B46VJEHW.js → chunk-VUPOM3AH.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-3TGLJEWK.js → chunk-WL4TUXY7.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-V6KH5QG4.js → chunk-XM4MQFQV.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-YZKQS34S.js → chunk-Y55SJART.js} +5 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ZKNSXGL5.js +1243 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{cli-MCOUW5WS.js → cli-35W4A75E.js} +7 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{cloudflare-workers-ai-system-one-WLAFJSP6.js → cloudflare-workers-ai-system-one-WKRH5HZA.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/codemode-worker.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{easter-egg-3d-WMBNSJ4M.js → easter-egg-3d-GEVPKQF6.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{execute-4CEBORGZ.js → execute-L2EEDV3L.js} +5 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/github-copilot.js +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-generative-ai-INGKNW72.js → google-generative-ai-VSMFCHJU.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-vertex-IBTX6MBF.js → google-vertex-35UTLZJN.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{llama-cpp-classify-V5U3QKXI.js → llama-cpp-classify-Z3SS4FP4.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{mistral-conversations-S4OWXIXQ.js → mistral-conversations-LWJTUFIM.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-YYIXDJWF.js +10 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-completions-EJNYB6IX.js → openai-completions-X2I4TQ2L.js} +3 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-decisions-IXI34BYG.js → openai-decisions-GG3FBAIF.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-responses-5CX3GG6R.js +4 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openrouter-images-PISKSFMS.js → openrouter-images-WHNK2UQG.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{pi-messages-NORUKF4E.js → pi-messages-5CXWY5I7.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{runtime-FQB7RU7U.js → runtime-J5ZSBGTX.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{typesafe-system-one-CHVC2UUI.js → typesafe-system-one-KA2SBSSD.js} +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-7ZY53V4K.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli-runtime.js +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.js +26 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-login.d.ts +15 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-login.js +232 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-logout.d.ts +14 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-logout.js +57 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-terminal.d.ts +17 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-terminal.js +63 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js +3 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts +5 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +7 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +25 -6
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +139 -50
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +3 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js +3 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/cache-warmer.d.ts +4 -37
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/cache-warmer.js +11 -89
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +2 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +10 -5
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +9 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +28 -6
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts +2 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts +12 -37
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js +42 -121
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts +52 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +20 -19
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts +5 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +11 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts +10 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +50 -5
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/pi-ai-schemas.d.ts +4 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/preferred-providers.d.ts +17 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/preferred-providers.js +24 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +18 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-composer.js +3 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-matching.d.ts +6 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-matching.js +8 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/radius-mcp.d.ts +13 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/radius-mcp.js +29 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/runtime-credentials.d.ts +8 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/runtime-credentials.js +15 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +35 -5
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.d.ts +23 -14
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js +182 -41
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +8 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +82 -36
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts +5 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +87 -75
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +2 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/powershell.js +15 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +8 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +141 -25
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.d.ts +4 -14
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +23 -29
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js +4 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js +34 -12
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/client.d.ts +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/client.js +23 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/ui.js +15 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.d.ts +2 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js +49 -14
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/config.js +4 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js +4 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts +11 -49
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js +56 -319
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js +4 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts +4 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js +7 -5
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts +2 -23
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js +6 -58
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js +18 -6
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/main.js +46 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +12 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +12 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts +5 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js +10 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/diff.js +11 -5
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +9 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +1 -18
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/mermaid.d.ts +2 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/mermaid.js +25 -20
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +14 -6
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +32 -5
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/provider-brand.d.ts +14 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/provider-brand.js +66 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/radius-login-selector.d.ts +1 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/radius-login-selector.js +6 -37
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +12 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts +1 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +19 -10
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +11 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +110 -63
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +4 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js +19 -10
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +53 -23
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +39 -8
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.d.ts +2 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js +12 -6
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +3 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/terminal-question.d.ts +8 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/terminal-question.js +24 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/web-url.d.ts +12 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/utils/web-url.js +20 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/cli.md +14 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +27 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/llama-cpp.md +4 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/models-configuration.md +6 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/models.md +2 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/prompt-templates.md +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/rpc.md +4 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/index.ts +23 -13
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/utils.ts +42 -16
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/README.md +14 -11
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts +392 -171
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
- package/out/node_modules/@earendil-works/pi-coding-agent/examples/tsconfig.json +63 -35
- package/out/node_modules/@earendil-works/pi-coding-agent/package.json +7 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/schemas/models.schema.json +29 -0
- package/out/node_modules/@earendil-works/pi-coding-agent/schemas/settings.schema.json +1 -1
- package/out/phone/assets/{abnfDiagram-VCTEODGH-CLgfII9z.js → abnfDiagram-VCTEODGH-6JYofuK8.js} +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-D7mwyuxS.js +1 -0
- package/out/phone/assets/{architectureDiagram-5GKGNRK7-I2RDn32D.js → architectureDiagram-5GKGNRK7-BeLeAQB1.js} +1 -1
- package/out/phone/assets/{blockDiagram-I7D4REHJ-D5xNQZkS.js → blockDiagram-I7D4REHJ-uXn3vhT2.js} +1 -1
- package/out/phone/assets/{c4Diagram-7LVT6UL2-CRKpzdlA.js → c4Diagram-7LVT6UL2-CjzMFRll.js} +1 -1
- package/out/phone/assets/channel-BsGN1oT0.js +1 -0
- package/out/phone/assets/{chunk-4HAMMTFA-CcezrqKz.js → chunk-4HAMMTFA-BA8HaYy2.js} +1 -1
- package/out/phone/assets/{chunk-75Z2AOVW-DDCXp4y1.js → chunk-75Z2AOVW-BhIfO9es.js} +1 -1
- package/out/phone/assets/{chunk-DU6HZSFF-CjWveEkB.js → chunk-DU6HZSFF-BTLBHwj-.js} +1 -1
- package/out/phone/assets/{chunk-F27PBJKO-Bgl_xI02.js → chunk-F27PBJKO-CUw8NZk8.js} +1 -1
- package/out/phone/assets/{chunk-GMAD6QVW-EmL8nOme.js → chunk-GMAD6QVW-bZOKnRyM.js} +1 -1
- package/out/phone/assets/{chunk-GVQU2GXP-Dox_nphF.js → chunk-GVQU2GXP-B0WIm1dS.js} +1 -1
- package/out/phone/assets/{chunk-IMKFNOWR-BapGpI4S.js → chunk-IMKFNOWR-DWND4rEr.js} +1 -1
- package/out/phone/assets/{chunk-L3NEJ4N5-Cq_UZI8A.js → chunk-L3NEJ4N5-DgMknY3k.js} +1 -1
- package/out/phone/assets/{chunk-OSK3NFVY-2VVlErAd.js → chunk-OSK3NFVY-C5aEouov.js} +1 -1
- package/out/phone/assets/{chunk-P2QGCYS3-Cci-G-p1.js → chunk-P2QGCYS3-D2ID3RxV.js} +1 -1
- package/out/phone/assets/{chunk-POPQ4Y6H-CJ47EOfE.js → chunk-POPQ4Y6H-C1lOuNpV.js} +1 -1
- package/out/phone/assets/{chunk-PWAF6VOD-D9dLdFqC.js → chunk-PWAF6VOD-CfqWQZRE.js} +1 -1
- package/out/phone/assets/{chunk-SHT3W25Y-BlGSiWZn.js → chunk-SHT3W25Y-p37Dlvn4.js} +1 -1
- package/out/phone/assets/{chunk-SVP7TREG-C0zdsa_A.js → chunk-SVP7TREG-CSSqW-zb.js} +1 -1
- package/out/phone/assets/{chunk-TICWLB2K-DAQW8nQU.js → chunk-TICWLB2K-Bse5ne4b.js} +1 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-a1PUvjC2.js +1 -0
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-a1PUvjC2.js +1 -0
- package/out/phone/assets/{cynefin-OW5HDTMX-_zsx5mdV.js → cynefin-OW5HDTMX-BGQqPhYk.js} +1 -1
- package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-Cww-w0ex.js → cynefinDiagram-5FMLGOSQ-Cz3XWaxY.js} +1 -1
- package/out/phone/assets/{dagre-GXQ25YYZ-C0i7DPqX.js → dagre-GXQ25YYZ-CjAF6lSz.js} +1 -1
- package/out/phone/assets/desk-1McWacjU.js +2 -0
- package/out/phone/assets/{diagram-S7CK7UJ4-Bx-G5hYz.js → diagram-S7CK7UJ4-B135cp5a.js} +1 -1
- package/out/phone/assets/{diagram-UQ7AKVKN-DaTblkjV.js → diagram-UQ7AKVKN-C4pCe0fQ.js} +1 -1
- package/out/phone/assets/{diagram-VSXAHHWV-gmN2e1b4.js → diagram-VSXAHHWV-CYkCrin2.js} +1 -1
- package/out/phone/assets/{diagram-VX7I27RA-WYtRtOo8.js → diagram-VX7I27RA-CT_vufh_.js} +1 -1
- package/out/phone/assets/{diagram-Z3DM3KII-Cr6uUB5B.js → diagram-Z3DM3KII-XEkkXu3P.js} +1 -1
- package/out/phone/assets/{ebnfDiagram-PWID7BFC-BCicfvpA.js → ebnfDiagram-PWID7BFC-DfLyeXjw.js} +1 -1
- package/out/phone/assets/{erDiagram-RLTQ6QDP-B3QlJvfQ.js → erDiagram-RLTQ6QDP-pKNbKkAP.js} +1 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-DcUsfQiW.js +1 -0
- package/out/phone/assets/flowDiagram-HODETNUW-sUobw8zi.js +1 -0
- package/out/phone/assets/{ganttDiagram-EL5Y4UJY-LYy2mfCh.js → ganttDiagram-EL5Y4UJY-Df4E50Mj.js} +1 -1
- package/out/phone/assets/{gitGraph-4MIJSDKK-dT22Z2jG.js → gitGraph-4MIJSDKK-CkjzZeFD.js} +1 -1
- package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-DHNdY57l.js → gitGraphDiagram-WWUBYQGX-CBxfRAfy.js} +1 -1
- package/out/phone/assets/{info-A6RAGUB7-nIu8NSOs.js → info-A6RAGUB7-CHFXa2pw.js} +1 -1
- package/out/phone/assets/{infoDiagram-27XIBGKW-DGkWZIMT.js → infoDiagram-27XIBGKW-K0DnZhi4.js} +1 -1
- package/out/phone/assets/{ishikawaDiagram-5VMMS53U-C8EPXru-.js → ishikawaDiagram-5VMMS53U-DTQF2ZuR.js} +1 -1
- package/out/phone/assets/{journeyDiagram-3NMN7TZE-Dyd9L3l3.js → journeyDiagram-3NMN7TZE-wBltkU2i.js} +1 -1
- package/out/phone/assets/{kanban-definition-UXKFOSKX-DehTYcsL.js → kanban-definition-UXKFOSKX-BZpcOajP.js} +1 -1
- package/out/phone/assets/{line-Db4SulF4.js → line-BflnZFgp.js} +1 -1
- package/out/phone/assets/main-CnA1zWP8.css +1 -0
- package/out/phone/assets/main-Crtf_g8h.js +1643 -0
- package/out/phone/assets/{mermaid-parser.core-D7h_8WV8.js → mermaid-parser.core-BiCTmcqa.js} +3 -3
- package/out/phone/assets/{mermaid.core-Dw_E5kj4.js → mermaid.core-D3TwYaLF.js} +4 -4
- package/out/phone/assets/{mindmap-definition-YA3MSWOX-_5Mxqxsy.js → mindmap-definition-YA3MSWOX-Cz0aS_6Y.js} +1 -1
- package/out/phone/assets/{packet-AYTQ26CC-_cgeMDdN.js → packet-AYTQ26CC-DW-djbhd.js} +1 -1
- package/out/phone/assets/{pegDiagram-XKGWAZYB-BhBwaNEr.js → pegDiagram-XKGWAZYB-CE0sZZAE.js} +1 -1
- package/out/phone/assets/{pie-WAS4IAKB-BepY80_0.js → pie-WAS4IAKB-CKGFlXok.js} +1 -1
- package/out/phone/assets/{pieDiagram-E7YTZNPT-CQQgqmI8.js → pieDiagram-E7YTZNPT-BrnQ32_6.js} +1 -1
- package/out/phone/assets/{quadrantDiagram-AXDQQJYC-DEEatC1J.js → quadrantDiagram-AXDQQJYC-BrxDAygB.js} +1 -1
- package/out/phone/assets/{radar-RG4KPBEZ-BqsiI_qQ.js → radar-RG4KPBEZ-Bo2f5QyA.js} +1 -1
- package/out/phone/assets/{railroad-74A4TZTK-C_2pEUjD.js → railroad-74A4TZTK-BZEmm0Ha.js} +1 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-CGiIT1ZV.js +1 -0
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-C85Q3c0J.js +1 -0
- package/out/phone/assets/railroad-peg-WCYAUIDC-8qPPCLgU.js +1 -0
- package/out/phone/assets/{railroadDiagram-O6MQD6OU-B7786u7W.js → railroadDiagram-O6MQD6OU-BvOyUNMC.js} +1 -1
- package/out/phone/assets/{requirementDiagram-BXWQKSXE-Ci3b5uwm.js → requirementDiagram-BXWQKSXE-T42N3TW5.js} +1 -1
- package/out/phone/assets/{sankeyDiagram-P5KCCOFB-PwT2gJjH.js → sankeyDiagram-P5KCCOFB-0us9ErVV.js} +1 -1
- package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-H6sgB5RI.js → sequenceDiagram-WJ2MYXX4-BMcYh2ll.js} +1 -1
- package/out/phone/assets/{stateDiagram-D77RDMKH-BxyRe7OB.js → stateDiagram-D77RDMKH-CgP9dUc3.js} +1 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-WM4CNSf-.js +1 -0
- package/out/phone/assets/storage-CahQ0cyN.js +1 -0
- package/out/phone/assets/{swimlanes-42K2YHIH-DWT3f1Hk.js → swimlanes-42K2YHIH-VnE4ceCW.js} +1 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-65AiMWVp.js +8 -0
- package/out/phone/assets/{timeline-definition-24CTP7MA-D67esSVY.js → timeline-definition-24CTP7MA-tH3izgae.js} +1 -1
- package/out/phone/assets/{treeView-Q6P3EWNA-BTIfu3Qr.js → treeView-Q6P3EWNA-CVFDOC7i.js} +1 -1
- package/out/phone/assets/{treemap-WGGIJYW6-DkPf6LQc.js → treemap-WGGIJYW6-vmikHzt3.js} +1 -1
- package/out/phone/assets/{vennDiagram-4TSXK5OY-DRMRxJ4f.js → vennDiagram-4TSXK5OY-b8ttDCR-.js} +1 -1
- package/out/phone/assets/{wardley-WFR3VGLG-hOvC_8-W.js → wardley-WFR3VGLG-D32vKoC1.js} +1 -1
- package/out/phone/assets/{wardleyDiagram-VM6X3IG4-a5aYRgrw.js → wardleyDiagram-VM6X3IG4-CMkaIPVH.js} +1 -1
- package/out/phone/assets/{xychartDiagram-S5SC5T6Z-DXjoRFDL.js → xychartDiagram-S5SC5T6Z-pLYDcql3.js} +1 -1
- package/out/phone/desk.html +2 -2
- package/out/phone/index.html +3 -3
- package/out/renderer/assets/{abnfDiagram-VCTEODGH-DhskujJf.js → abnfDiagram-VCTEODGH-N6OiVFQx.js} +1 -1
- package/out/renderer/assets/{arc-BcW67t47.js → arc-CXVc3U0J.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-5GKGNRK7-D-x057Ia.js → architectureDiagram-5GKGNRK7-BT5CXpcQ.js} +1 -1
- package/out/renderer/assets/{blockDiagram-I7D4REHJ-DR3sZkhW.js → blockDiagram-I7D4REHJ-C32Vqzip.js} +1 -1
- package/out/renderer/assets/{c4Diagram-7LVT6UL2-CQ4lScWs.js → c4Diagram-7LVT6UL2-qjwL2BP8.js} +1 -1
- package/out/renderer/assets/channel-B1Cv56hA.js +1 -0
- package/out/renderer/assets/{chunk-2Q5K7J3B-CtT0yqF3.js → chunk-2Q5K7J3B-YC6CQiyD.js} +1 -1
- package/out/renderer/assets/{chunk-5VM5RSS4-DlCfddrY.js → chunk-5VM5RSS4-E-kluPz3.js} +1 -1
- package/out/renderer/assets/{chunk-F27PBJKO-BAJ5dGzo.js → chunk-F27PBJKO-Bhx1_P75.js} +1 -1
- package/out/renderer/assets/{chunk-IMKFNOWR-Dlah_YbP.js → chunk-IMKFNOWR-Dgb_730B.js} +1 -1
- package/out/renderer/assets/{chunk-JWPE2WC7-BiXd3nUZ.js → chunk-JWPE2WC7-COQNHw4u.js} +1 -1
- package/out/renderer/assets/{chunk-POPQ4Y6H-Ch86i4EJ.js → chunk-POPQ4Y6H-CQz4hRgP.js} +1 -1
- package/out/renderer/assets/{chunk-SVP7TREG-z3inDV-H.js → chunk-SVP7TREG-DGp9XQFd.js} +1 -1
- package/out/renderer/assets/{chunk-TICWLB2K-B34A2AKD.js → chunk-TICWLB2K-CovR1uHr.js} +1 -1
- package/out/renderer/assets/{chunk-XXDRQBXY-Do_L0wRR.js → chunk-XXDRQBXY-gVmqSU5b.js} +1 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-CDWgELaf.js +1 -0
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-CDWgELaf.js +1 -0
- package/out/renderer/assets/{cose-bilkent-JH36ORCC-BQraKmgl.js → cose-bilkent-JH36ORCC-DD4PEqt_.js} +1 -1
- package/out/renderer/assets/{cynefin-OW5HDTMX-BwixoR4r.js → cynefin-OW5HDTMX-DNsYCrBx.js} +1 -1
- package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-BLTBma3J.js → cynefinDiagram-5FMLGOSQ-CoSzqs25.js} +1 -1
- package/out/renderer/assets/{cytoscape-fcose-BRpJ5tyq.js → cytoscape-fcose-CV0MpCmk.js} +1 -1
- package/out/renderer/assets/{dagre-GXQ25YYZ-aWsjA_wn.js → dagre-GXQ25YYZ-BxpTPeHN.js} +1 -1
- package/out/renderer/assets/{diagram-S7CK7UJ4-Cur2zK4q.js → diagram-S7CK7UJ4-Df_OM1vW.js} +1 -1
- package/out/renderer/assets/{diagram-UQ7AKVKN-DlrY8YcD.js → diagram-UQ7AKVKN-iovjmny_.js} +1 -1
- package/out/renderer/assets/{diagram-VSXAHHWV-BBdjreqR.js → diagram-VSXAHHWV-BMrwlcQx.js} +1 -1
- package/out/renderer/assets/{diagram-VX7I27RA-XiWMdc8S.js → diagram-VX7I27RA-DqLh449X.js} +1 -1
- package/out/renderer/assets/{diagram-Z3DM3KII-CBB5leat.js → diagram-Z3DM3KII-CH_W77UO.js} +1 -1
- package/out/renderer/assets/{ebnfDiagram-PWID7BFC-nl8RPo8j.js → ebnfDiagram-PWID7BFC-yjzodXoL.js} +1 -1
- package/out/renderer/assets/{erDiagram-RLTQ6QDP-C_oaG80x.js → erDiagram-RLTQ6QDP-DXxhvHYS.js} +1 -1
- package/out/renderer/assets/{flowDiagram-HODETNUW-nDoVZFS7.js → flowDiagram-HODETNUW-b2AWCAaB.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-DOrcuM3Q.js → ganttDiagram-EL5Y4UJY-COkyXL3K.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-D_DB3jro.js → gitGraphDiagram-WWUBYQGX-BYPqy5fh.js} +1 -1
- package/out/renderer/assets/globals-DX-8GWfJ.css +1 -0
- package/out/renderer/assets/{globals-D1ocHHQV.js → globals-y5_C1IiJ.js} +182 -176
- package/out/renderer/assets/index-CHJ6mVl2.js +117 -0
- package/out/renderer/assets/{infoDiagram-27XIBGKW-BbBrANxo.js → infoDiagram-27XIBGKW-DNg-VxlH.js} +1 -1
- package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-7UlfWlWV.js → ishikawaDiagram-5VMMS53U-DProTI6a.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-3NMN7TZE-CJP9bosH.js → journeyDiagram-3NMN7TZE-BWhC4n3f.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UXKFOSKX-D772kW7T.js → kanban-definition-UXKFOSKX-CHJRR0qi.js} +1 -1
- package/out/renderer/assets/{layout-BzVfJEvx.js → layout-D8t6q8k0.js} +1 -1
- package/out/renderer/assets/{linear-DBjhr05m.js → linear-Cxb1p4iF.js} +1 -1
- package/out/renderer/assets/{mermaid.core-CJpNSowm.js → mermaid.core-CFNOEUmc.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-YA3MSWOX-C2oqlH5E.js → mindmap-definition-YA3MSWOX-Ba78cyY4.js} +1 -1
- package/out/renderer/assets/{pegDiagram-XKGWAZYB-CcZ8Hae-.js → pegDiagram-XKGWAZYB-C7zqoWMk.js} +1 -1
- package/out/renderer/assets/{pieDiagram-E7YTZNPT-DTw-_k2D.js → pieDiagram-E7YTZNPT-g304yFeX.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-D5eX0DO7.js → quadrantDiagram-AXDQQJYC-Bwn3gGTO.js} +1 -1
- package/out/renderer/assets/{railroadDiagram-O6MQD6OU-DzpBB_Re.js → railroadDiagram-O6MQD6OU-DRetS8pv.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-BXWQKSXE-UbOUXLgl.js → requirementDiagram-BXWQKSXE-CHz0FVZ7.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-jRbXLLsa.js → sankeyDiagram-P5KCCOFB-BYGRDIG9.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-s0WBQQPf.js → sequenceDiagram-WJ2MYXX4-B60RuFFk.js} +1 -1
- package/out/renderer/assets/settings-Cd128yRb.js +34 -0
- package/out/renderer/assets/{sizeCapture-INFHLROL-DvUs5rDx.js → sizeCapture-INFHLROL-CB-i3Fmz.js} +1 -1
- package/out/renderer/assets/{stateDiagram-D77RDMKH-C1_V497y.js → stateDiagram-D77RDMKH-CJOcikAJ.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-BosPi5SR.js +1 -0
- package/out/renderer/assets/{swimlanes-42K2YHIH-BulPeZ6y.js → swimlanes-42K2YHIH-Buap2upT.js} +1 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-B7TQEEbL.js +8 -0
- package/out/renderer/assets/{timeline-definition-24CTP7MA-gQ5OygZn.js → timeline-definition-24CTP7MA-BdQta3QT.js} +1 -1
- package/out/renderer/assets/{vennDiagram-4TSXK5OY-A8QyA5Ix.js → vennDiagram-4TSXK5OY-BynM2l28.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-CfP6E41T.js → wardleyDiagram-VM6X3IG4-FZjDO9FY.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-DTG5UHh7.js → xychartDiagram-S5SC5T6Z-pJPSISxM.js} +1 -1
- package/out/renderer/index.html +3 -3
- package/out/renderer/plugin-view.html +39 -0
- package/out/renderer/settings.html +4 -4
- package/out/renderer/web-preload.js +1 -1
- package/out/server/agent.js +1502 -370
- package/out/server/chunks/{agent-BhQn6jGA.js → agent--Q7N17bY.js} +356 -165
- package/out/server/chunks/{gpuBackendInstall-CdExgjGi.js → gpuBackendInstall-P7COXJlD.js} +6 -5
- package/out/server/chunks/{loadProvider-BnkyjMSW.js → loadProvider-DvvFIF6F.js} +2 -2
- package/out/server/chunks/{manifest-2odvnxjZ.js → manifest-BvEa5QR3.js} +125 -5
- package/out/server/chunks/{workflowPresets-DqSsjOj6.js → workflowPresets-CuLnfQqa.js} +3444 -448
- package/out/server/index.js +2719 -308
- package/out/server/plugin-host.js +7 -3
- package/package.json +7 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-BWGCKOF4.js +0 -6
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-44DLKSKE.js +0 -1234
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-62VOPMLK.js +0 -65
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-7O7QKK6A.js +0 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-CHWNPHIS.js +0 -82
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-NL4X6LBY.js +0 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-NZY7EIPA.js +0 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-R2EGYMOO.js +0 -7
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-VOLAXWGI.js +0 -2
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-QAWLOQSN.js +0 -10
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-responses-MD3562FB.js +0 -4
- package/out/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-O76XM3OB.js +0 -2
- package/out/phone/assets/architecture-7GRP2DOG-CQOPTv6S.js +0 -1
- package/out/phone/assets/channel-DdXebl9x.js +0 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-BCctWEp1.js +0 -1
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-BCctWEp1.js +0 -1
- package/out/phone/assets/desk-mfuEW2n4.js +0 -2
- package/out/phone/assets/eventmodeling-NTZA5JFV-BtfapP6M.js +0 -1
- package/out/phone/assets/flowDiagram-HODETNUW-BsyiyBtD.js +0 -1
- package/out/phone/assets/main-Dv9ve8mT.css +0 -1
- package/out/phone/assets/main-uMMbioCA.js +0 -1638
- package/out/phone/assets/railroad-abnf-HS5TGJTU-TmODpceI.js +0 -1
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-BTCjNR9u.js +0 -1
- package/out/phone/assets/railroad-peg-WCYAUIDC-DjhKNo8j.js +0 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-Cncmf_cL.js +0 -1
- package/out/phone/assets/storage-D9RW_4__.js +0 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-DAahG4fH.js +0 -8
- package/out/renderer/assets/channel-CudRig7z.js +0 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-DL20WkD0.js +0 -1
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-DL20WkD0.js +0 -1
- package/out/renderer/assets/globals-Bkw7iiQG.css +0 -1
- package/out/renderer/assets/index-Cm5iq85v.js +0 -117
- package/out/renderer/assets/settings-DxYo7s4h.js +0 -34
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-C9dfLXR8.js +0 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-LXwy6qGO.js +0 -8
package/out/phone/assets/{sankeyDiagram-P5KCCOFB-PwT2gJjH.js → sankeyDiagram-P5KCCOFB-0us9ErVV.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{p as t}from"./src-oBChb5qS.js";import{H as n,J as r,K as i,U as a,a as o,d as s,s as c,v as l,w as u,x as d,y as f}from"./chunk-DU6HZSFF-CjWveEkB.js";import{t as p}from"./ordinal-BDEzSJ7C.js";function m(e){for(var t=e.length/6|0,n=Array(t),r=0;r<t;)n[r]=`#`+e.slice(r*6,++r*6);return n}var h=m(`4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab`);function g(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function _(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function v(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function y(e){return e.target.depth}function b(e){return e.depth}function x(e,t){return t-1-e.height}function S(e,t){return e.sourceLinks.length?e.depth:t-1}function C(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?_(e.sourceLinks,y)-1:0}function w(e){return function(){return e}}function T(e,t){return D(e.source,t.source)||e.index-t.index}function E(e,t){return D(e.target,t.target)||e.index-t.index}function D(e,t){return e.y0-t.y0}function O(e){return e.value}function k(e){return e.index}function A(e){return e.nodes}function j(e){return e.links}function M(e,t){let n=e.get(t);if(!n)throw Error(`missing: `+t);return n}function N({nodes:e}){for(let t of e){let e=t.y0,n=e;for(let n of t.sourceLinks)n.y0=e+n.width/2,e+=n.width;for(let e of t.targetLinks)e.y1=n+e.width/2,n+=e.width}}function P(){let e=0,t=0,n=1,r=1,i=24,a=8,o,s=k,c=S,l,u,d=A,f=j,p=6;function m(){let e={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return h(e),y(e),b(e),x(e),F(e),N(e),e}m.update=function(e){return N(e),e},m.nodeId=function(e){return arguments.length?(s=typeof e==`function`?e:w(e),m):s},m.nodeAlign=function(e){return arguments.length?(c=typeof e==`function`?e:w(e),m):c},m.nodeSort=function(e){return arguments.length?(l=e,m):l},m.nodeWidth=function(e){return arguments.length?(i=+e,m):i},m.nodePadding=function(e){return arguments.length?(a=o=+e,m):a},m.nodes=function(e){return arguments.length?(d=typeof e==`function`?e:w(e),m):d},m.links=function(e){return arguments.length?(f=typeof e==`function`?e:w(e),m):f},m.linkSort=function(e){return arguments.length?(u=e,m):u},m.size=function(i){return arguments.length?(e=t=0,n=+i[0],r=+i[1],m):[n-e,r-t]},m.extent=function(i){return arguments.length?(e=+i[0][0],n=+i[1][0],t=+i[0][1],r=+i[1][1],m):[[e,t],[n,r]]},m.iterations=function(e){return arguments.length?(p=+e,m):p};function h({nodes:e,links:t}){for(let[t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];let n=new Map(e.map((t,n)=>[s(t,n,e),t]));for(let[e,r]of t.entries()){r.index=e;let{source:t,target:i}=r;typeof t!=`object`&&(t=r.source=M(n,t)),typeof i!=`object`&&(i=r.target=M(n,i)),t.sourceLinks.push(r),i.targetLinks.push(r)}if(u!=null)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(u),n.sort(u)}function y({nodes:e}){for(let t of e)t.value=t.fixedValue===void 0?Math.max(v(t.sourceLinks,O),v(t.targetLinks,O)):t.fixedValue}function b({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.depth=i;for(let{target:t}of e.sourceLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function x({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.height=i;for(let{source:t}of e.targetLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function C({nodes:t}){let r=g(t,e=>e.depth)+1,a=(n-e-i)/(r-1),o=Array(r);for(let n of t){let t=Math.max(0,Math.min(r-1,Math.floor(c.call(null,n,r))));n.layer=t,n.x0=e+t*a,n.x1=n.x0+i,o[t]?o[t].push(n):o[t]=[n]}if(l)for(let e of o)e.sort(l);return o}function P(e){let n=_(e,e=>(r-t-(e.length-1)*o)/v(e,O));for(let i of e){let e=t;for(let t of i){t.y0=e,t.y1=e+t.value*n,e=t.y1+o;for(let e of t.sourceLinks)e.width=e.value*n}e=(r-e+o)/(i.length+1);for(let t=0;t<i.length;++t){let n=i[t];n.y0+=e*(t+1),n.y1+=e*(t+1)}H(i)}}function F(e){let n=C(e);o=Math.min(a,(r-t)/(g(n,e=>e.length)-1)),P(n);for(let e=0;e<p;++e){let t=.99**e,r=Math.max(1-t,(e+1)/p);L(n,t,r),I(n,t,r)}}function I(e,t,n){for(let r=1,i=e.length;r<i;++r){let i=e[r];for(let e of i){let n=0,r=0;for(let{source:t,value:i}of e.targetLinks){let a=i*(e.layer-t.layer);n+=U(t,e)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function L(e,t,n){for(let r=e.length-2;r>=0;--r){let i=e[r];for(let e of i){let n=0,r=0;for(let{target:t,value:i}of e.sourceLinks){let a=i*(t.layer-e.layer);n+=W(e,t)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function R(e,n){let i=e.length>>1,a=e[i];B(e,a.y0-o,i-1,n),z(e,a.y1+o,i+1,n),B(e,r,e.length-1,n),z(e,t,0,n)}function z(e,t,n,r){for(;n<e.length;++n){let i=e[n],a=(t-i.y0)*r;a>1e-6&&(i.y0+=a,i.y1+=a),t=i.y1+o}}function B(e,t,n,r){for(;n>=0;--n){let i=e[n],a=(i.y1-t)*r;a>1e-6&&(i.y0-=a,i.y1-=a),t=i.y0-o}}function V({sourceLinks:e,targetLinks:t}){if(u===void 0){for(let{source:{sourceLinks:e}}of t)e.sort(E);for(let{target:{targetLinks:t}}of e)t.sort(T)}}function H(e){if(u===void 0)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(E),n.sort(T)}function U(e,t){let n=e.y0-(e.sourceLinks.length-1)*o/2;for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n+=i+o}for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n-=i}return n}function W(e,t){let n=t.y0-(t.targetLinks.length-1)*o/2;for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n+=i+o}for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n-=i}return n}return m}var F=Math.PI,I=2*F,L=1e-6,R=I-L;function z(){this._x0=this._y0=this._x1=this._y1=null,this._=``}function B(){return new z}z.prototype=B.prototype={constructor:z,moveTo:function(e,t){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)},lineTo:function(e,t){this._+=`L`+(this._x1=+e)+`,`+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+=`Q`+ +e+`,`+ +t+`,`+(this._x1=+n)+`,`+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,a){this._+=`C`+ +e+`,`+ +t+`,`+ +n+`,`+ +r+`,`+(this._x1=+i)+`,`+(this._y1=+a)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(i<0)throw Error(`negative radius: `+i);if(this._x1===null)this._+=`M`+(this._x1=e)+`,`+(this._y1=t);else if(d>L){if(!(Math.abs(u*s-c*l)>L)||!i)this._+=`L`+(this._x1=e)+`,`+(this._y1=t);else{var f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((F-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>L&&(this._+=`L`+(e+y*l)+`,`+(t+y*u)),this._+=`A`+i+`,`+i+`,0,0,`+ +(u*f>l*p)+`,`+(this._x1=e+b*s)+`,`+(this._y1=t+b*c)}}},arc:function(e,t,n,r,i,a){e=+e,t=+t,n=+n,a=!!a;var o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(n<0)throw Error(`negative radius: `+n);this._x1===null?this._+=`M`+c+`,`+l:(Math.abs(this._x1-c)>L||Math.abs(this._y1-l)>L)&&(this._+=`L`+c+`,`+l),n&&(d<0&&(d=d%I+I),d>R?this._+=`A`+n+`,`+n+`,0,1,`+u+`,`+(e-o)+`,`+(t-s)+`A`+n+`,`+n+`,0,1,`+u+`,`+(this._x1=c)+`,`+(this._y1=l):d>L&&(this._+=`A`+n+`,`+n+`,0,`+ +(d>=F)+`,`+u+`,`+(this._x1=e+n*Math.cos(i))+`,`+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)+`h`+ +n+`v`+ +r+`h`+-n+`Z`},toString:function(){return this._}};function V(e){return function(){return e}}function H(e){return e[0]}function U(e){return e[1]}var W=Array.prototype.slice;function G(e){return e.source}function ee(e){return e.target}function te(e){var t=G,n=ee,r=H,i=U,a=null;function o(){var o,s=W.call(arguments),c=t.apply(this,s),l=n.apply(this,s);if(a||=o=B(),e(a,+r.apply(this,(s[0]=c,s)),+i.apply(this,s),+r.apply(this,(s[0]=l,s)),+i.apply(this,s)),o)return a=null,o+``||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r=typeof e==`function`?e:V(+e),o):r},o.y=function(e){return arguments.length?(i=typeof e==`function`?e:V(+e),o):i},o.context=function(e){return arguments.length?(a=e??null,o):a},o}function ne(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function re(){return te(ne)}function ie(e){return[e.source.x1,e.y0]}function ae(e){return[e.target.x0,e.y1]}function K(){return re().source(ie).target(ae)}var q=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,9],r=[1,10],i=[1,5,10,12],a={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:`error`,4:`SANKEY`,5:`NEWLINE`,10:`EOF`,11:`field[source]`,12:`COMMA`,13:`field[target]`,14:`field[value]`,18:`DQUOTE`,19:`ESCAPED_TEXT`,20:`NON_ESCAPED_TEXT`},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 7:let e=r.findOrCreateNode(a[s-4].trim().replaceAll(`""`,`"`)),t=r.findOrCreateNode(a[s-2].trim().replaceAll(`""`,`"`)),n=parseFloat(a[s].trim());r.addLink(e,t,n);break;case 8:case 9:case 11:this.$=a[s];break;case 10:this.$=a[s-1]}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:r},{1:[2,6],7:11,10:[1,12]},t(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(i,[2,8]),t(i,[2,9]),{19:[1,16]},t(i,[2,11]),{1:[2,1]},{1:[2,5]},t(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:r},{15:18,16:7,17:8,18:n,20:r},{18:[1,19]},t(r,[2,3]),{12:[1,20]},t(i,[2,10]),{15:21,16:7,17:8,18:n,20:r},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{p as t}from"./src-oBChb5qS.js";import{H as n,J as r,K as i,U as a,a as o,d as s,s as c,v as l,w as u,x as d,y as f}from"./chunk-DU6HZSFF-BTLBHwj-.js";import{t as p}from"./ordinal-BDEzSJ7C.js";function m(e){for(var t=e.length/6|0,n=Array(t),r=0;r<t;)n[r]=`#`+e.slice(r*6,++r*6);return n}var h=m(`4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab`);function g(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function _(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function v(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function y(e){return e.target.depth}function b(e){return e.depth}function x(e,t){return t-1-e.height}function S(e,t){return e.sourceLinks.length?e.depth:t-1}function C(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?_(e.sourceLinks,y)-1:0}function w(e){return function(){return e}}function T(e,t){return D(e.source,t.source)||e.index-t.index}function E(e,t){return D(e.target,t.target)||e.index-t.index}function D(e,t){return e.y0-t.y0}function O(e){return e.value}function k(e){return e.index}function A(e){return e.nodes}function j(e){return e.links}function M(e,t){let n=e.get(t);if(!n)throw Error(`missing: `+t);return n}function N({nodes:e}){for(let t of e){let e=t.y0,n=e;for(let n of t.sourceLinks)n.y0=e+n.width/2,e+=n.width;for(let e of t.targetLinks)e.y1=n+e.width/2,n+=e.width}}function P(){let e=0,t=0,n=1,r=1,i=24,a=8,o,s=k,c=S,l,u,d=A,f=j,p=6;function m(){let e={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return h(e),y(e),b(e),x(e),F(e),N(e),e}m.update=function(e){return N(e),e},m.nodeId=function(e){return arguments.length?(s=typeof e==`function`?e:w(e),m):s},m.nodeAlign=function(e){return arguments.length?(c=typeof e==`function`?e:w(e),m):c},m.nodeSort=function(e){return arguments.length?(l=e,m):l},m.nodeWidth=function(e){return arguments.length?(i=+e,m):i},m.nodePadding=function(e){return arguments.length?(a=o=+e,m):a},m.nodes=function(e){return arguments.length?(d=typeof e==`function`?e:w(e),m):d},m.links=function(e){return arguments.length?(f=typeof e==`function`?e:w(e),m):f},m.linkSort=function(e){return arguments.length?(u=e,m):u},m.size=function(i){return arguments.length?(e=t=0,n=+i[0],r=+i[1],m):[n-e,r-t]},m.extent=function(i){return arguments.length?(e=+i[0][0],n=+i[1][0],t=+i[0][1],r=+i[1][1],m):[[e,t],[n,r]]},m.iterations=function(e){return arguments.length?(p=+e,m):p};function h({nodes:e,links:t}){for(let[t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];let n=new Map(e.map((t,n)=>[s(t,n,e),t]));for(let[e,r]of t.entries()){r.index=e;let{source:t,target:i}=r;typeof t!=`object`&&(t=r.source=M(n,t)),typeof i!=`object`&&(i=r.target=M(n,i)),t.sourceLinks.push(r),i.targetLinks.push(r)}if(u!=null)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(u),n.sort(u)}function y({nodes:e}){for(let t of e)t.value=t.fixedValue===void 0?Math.max(v(t.sourceLinks,O),v(t.targetLinks,O)):t.fixedValue}function b({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.depth=i;for(let{target:t}of e.sourceLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function x({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.height=i;for(let{source:t}of e.targetLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function C({nodes:t}){let r=g(t,e=>e.depth)+1,a=(n-e-i)/(r-1),o=Array(r);for(let n of t){let t=Math.max(0,Math.min(r-1,Math.floor(c.call(null,n,r))));n.layer=t,n.x0=e+t*a,n.x1=n.x0+i,o[t]?o[t].push(n):o[t]=[n]}if(l)for(let e of o)e.sort(l);return o}function P(e){let n=_(e,e=>(r-t-(e.length-1)*o)/v(e,O));for(let i of e){let e=t;for(let t of i){t.y0=e,t.y1=e+t.value*n,e=t.y1+o;for(let e of t.sourceLinks)e.width=e.value*n}e=(r-e+o)/(i.length+1);for(let t=0;t<i.length;++t){let n=i[t];n.y0+=e*(t+1),n.y1+=e*(t+1)}H(i)}}function F(e){let n=C(e);o=Math.min(a,(r-t)/(g(n,e=>e.length)-1)),P(n);for(let e=0;e<p;++e){let t=.99**e,r=Math.max(1-t,(e+1)/p);L(n,t,r),I(n,t,r)}}function I(e,t,n){for(let r=1,i=e.length;r<i;++r){let i=e[r];for(let e of i){let n=0,r=0;for(let{source:t,value:i}of e.targetLinks){let a=i*(e.layer-t.layer);n+=U(t,e)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function L(e,t,n){for(let r=e.length-2;r>=0;--r){let i=e[r];for(let e of i){let n=0,r=0;for(let{target:t,value:i}of e.sourceLinks){let a=i*(t.layer-e.layer);n+=W(e,t)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,V(e)}l===void 0&&i.sort(D),R(i,n)}}function R(e,n){let i=e.length>>1,a=e[i];B(e,a.y0-o,i-1,n),z(e,a.y1+o,i+1,n),B(e,r,e.length-1,n),z(e,t,0,n)}function z(e,t,n,r){for(;n<e.length;++n){let i=e[n],a=(t-i.y0)*r;a>1e-6&&(i.y0+=a,i.y1+=a),t=i.y1+o}}function B(e,t,n,r){for(;n>=0;--n){let i=e[n],a=(i.y1-t)*r;a>1e-6&&(i.y0-=a,i.y1-=a),t=i.y0-o}}function V({sourceLinks:e,targetLinks:t}){if(u===void 0){for(let{source:{sourceLinks:e}}of t)e.sort(E);for(let{target:{targetLinks:t}}of e)t.sort(T)}}function H(e){if(u===void 0)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(E),n.sort(T)}function U(e,t){let n=e.y0-(e.sourceLinks.length-1)*o/2;for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n+=i+o}for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n-=i}return n}function W(e,t){let n=t.y0-(t.targetLinks.length-1)*o/2;for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n+=i+o}for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n-=i}return n}return m}var F=Math.PI,I=2*F,L=1e-6,R=I-L;function z(){this._x0=this._y0=this._x1=this._y1=null,this._=``}function B(){return new z}z.prototype=B.prototype={constructor:z,moveTo:function(e,t){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)},lineTo:function(e,t){this._+=`L`+(this._x1=+e)+`,`+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+=`Q`+ +e+`,`+ +t+`,`+(this._x1=+n)+`,`+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,a){this._+=`C`+ +e+`,`+ +t+`,`+ +n+`,`+ +r+`,`+(this._x1=+i)+`,`+(this._y1=+a)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(i<0)throw Error(`negative radius: `+i);if(this._x1===null)this._+=`M`+(this._x1=e)+`,`+(this._y1=t);else if(d>L){if(!(Math.abs(u*s-c*l)>L)||!i)this._+=`L`+(this._x1=e)+`,`+(this._y1=t);else{var f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((F-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>L&&(this._+=`L`+(e+y*l)+`,`+(t+y*u)),this._+=`A`+i+`,`+i+`,0,0,`+ +(u*f>l*p)+`,`+(this._x1=e+b*s)+`,`+(this._y1=t+b*c)}}},arc:function(e,t,n,r,i,a){e=+e,t=+t,n=+n,a=!!a;var o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(n<0)throw Error(`negative radius: `+n);this._x1===null?this._+=`M`+c+`,`+l:(Math.abs(this._x1-c)>L||Math.abs(this._y1-l)>L)&&(this._+=`L`+c+`,`+l),n&&(d<0&&(d=d%I+I),d>R?this._+=`A`+n+`,`+n+`,0,1,`+u+`,`+(e-o)+`,`+(t-s)+`A`+n+`,`+n+`,0,1,`+u+`,`+(this._x1=c)+`,`+(this._y1=l):d>L&&(this._+=`A`+n+`,`+n+`,0,`+ +(d>=F)+`,`+u+`,`+(this._x1=e+n*Math.cos(i))+`,`+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)+`h`+ +n+`v`+ +r+`h`+-n+`Z`},toString:function(){return this._}};function V(e){return function(){return e}}function H(e){return e[0]}function U(e){return e[1]}var W=Array.prototype.slice;function G(e){return e.source}function ee(e){return e.target}function te(e){var t=G,n=ee,r=H,i=U,a=null;function o(){var o,s=W.call(arguments),c=t.apply(this,s),l=n.apply(this,s);if(a||=o=B(),e(a,+r.apply(this,(s[0]=c,s)),+i.apply(this,s),+r.apply(this,(s[0]=l,s)),+i.apply(this,s)),o)return a=null,o+``||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r=typeof e==`function`?e:V(+e),o):r},o.y=function(e){return arguments.length?(i=typeof e==`function`?e:V(+e),o):i},o.context=function(e){return arguments.length?(a=e??null,o):a},o}function ne(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function re(){return te(ne)}function ie(e){return[e.source.x1,e.y0]}function ae(e){return[e.target.x0,e.y1]}function K(){return re().source(ie).target(ae)}var q=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,9],r=[1,10],i=[1,5,10,12],a={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:`error`,4:`SANKEY`,5:`NEWLINE`,10:`EOF`,11:`field[source]`,12:`COMMA`,13:`field[target]`,14:`field[value]`,18:`DQUOTE`,19:`ESCAPED_TEXT`,20:`NON_ESCAPED_TEXT`},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 7:let e=r.findOrCreateNode(a[s-4].trim().replaceAll(`""`,`"`)),t=r.findOrCreateNode(a[s-2].trim().replaceAll(`""`,`"`)),n=parseFloat(a[s].trim());r.addLink(e,t,n);break;case 8:case 9:case 11:this.$=a[s];break;case 10:this.$=a[s-1]}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:r},{1:[2,6],7:11,10:[1,12]},t(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(i,[2,8]),t(i,[2,9]),{19:[1,16]},t(i,[2,11]),{1:[2,1]},{1:[2,5]},t(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:r},{15:18,16:7,17:8,18:n,20:r},{18:[1,19]},t(r,[2,3]),{12:[1,20]},t(i,[2,10]),{15:21,16:7,17:8,18:n,20:r},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};a.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(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},`input`),unput:e(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),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.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(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,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-oBChb5qS.js";import{A as r,F as i,G as a,H as o,K as s,O as c,U as l,a as u,b as d,c as f,i as p,r as m,s as h,v as g,w as _,x as v,y,z as b}from"./chunk-DU6HZSFF-CjWveEkB.js";import{t as x}from"./dist-B_J_HbC0.js";import{g as S,p as C}from"./chunk-75Z2AOVW-DDCXp4y1.js";import{a as w,c as T,i as E,n as D,r as O,s as k}from"./chunk-F27PBJKO-Bgl_xI02.js";import{t as A}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{n as j,t as M}from"./mermaid.core-Dw_E5kj4.js";var N=x(),P=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,2],r=[1,3],i=[1,4],a=[2,4],o=[1,9],s=[1,11],c=[1,12],l=[1,14],u=[1,15],d=[1,17],f=[1,18],p=[1,19],m=[1,25],h=[1,26],g=[1,27],_=[1,28],v=[1,29],y=[1,30],b=[1,31],x=[1,32],S=[1,33],C=[1,34],w=[1,35],T=[1,36],E=[1,37],D=[1,38],O=[1,39],k=[1,40],A=[1,42],j=[1,43],M=[1,44],N=[1,45],P=[1,46],F=[1,47],I=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],ee=[1,74],L=[1,80],R=[1,81],te=[1,82],ne=[1,83],z=[1,84],B=[1,85],V=[1,86],re=[1,87],H=[1,88],U=[1,89],W=[1,90],ie=[1,91],ae=[1,92],oe=[1,93],G=[1,94],se=[1,95],K=[1,96],ce=[1,97],le=[1,98],ue=[1,99],de=[1,100],fe=[1,101],pe=[1,102],me=[1,103],he=[1,104],ge=[1,105],_e=[2,78],ve=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],be=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],xe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Ce=[5,52],q=[70,71,72,73],J=[1,151],we={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:`error`,4:`SPACE`,5:`NEWLINE`,6:`SD`,10:`INVALID`,14:`create`,15:`box`,16:`restOfLine`,17:`end`,19:`autonumber`,20:`NUM`,21:`off`,22:`activate`,24:`deactivate`,30:`title`,31:`legacy_title`,32:`acc_title`,33:`acc_title_value`,34:`acc_descr`,35:`acc_descr_value`,36:`acc_descr_multiline_value`,37:`loop`,38:`rect`,39:`opt`,40:`alt`,42:`par`,44:`par_over`,45:`critical`,47:`break`,48:`option`,49:`and`,50:`else`,51:`participant`,52:`AS`,53:`participant_actor`,54:`destroy`,56:`note`,59:`over`,61:`links`,62:`link`,63:`properties`,64:`details`,66:`,`,67:`left_of`,68:`right_of`,70:`+`,71:`-`,72:`()`,73:`ACTOR`,75:`CONFIG_START`,76:`CONFIG_CONTENT`,77:`CONFIG_END`,78:`SOLID_OPEN_ARROW`,79:`DOTTED_OPEN_ARROW`,80:`SOLID_ARROW`,81:`SOLID_ARROW_TOP`,82:`SOLID_ARROW_BOTTOM`,83:`STICK_ARROW_TOP`,84:`STICK_ARROW_BOTTOM`,85:`SOLID_ARROW_TOP_DOTTED`,86:`SOLID_ARROW_BOTTOM_DOTTED`,87:`STICK_ARROW_TOP_DOTTED`,88:`STICK_ARROW_BOTTOM_DOTTED`,89:`SOLID_ARROW_TOP_REVERSE`,90:`SOLID_ARROW_BOTTOM_REVERSE`,91:`STICK_ARROW_TOP_REVERSE`,92:`STICK_ARROW_BOTTOM_REVERSE`,93:`SOLID_ARROW_TOP_REVERSE_DOTTED`,94:`SOLID_ARROW_BOTTOM_REVERSE_DOTTED`,95:`STICK_ARROW_TOP_REVERSE_DOTTED`,96:`STICK_ARROW_BOTTOM_REVERSE_DOTTED`,97:`BIDIRECTIONAL_SOLID_ARROW`,98:`DOTTED_ARROW`,99:`BIDIRECTIONAL_DOTTED_ARROW`,100:`SOLID_CROSS`,101:`DOTTED_CROSS`,102:`SOLID_POINT`,103:`DOTTED_POINT`,104:`TXT`},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return r.apply(a[s]),a[s];case 4:case 10:this.$=[];break;case 5:case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 6:case 7:case 12:case 13:this.$=a[s];break;case 8:case 9:case 14:this.$=[];break;case 16:a[s].type=`createParticipant`,this.$=a[s];break;case 17:a[s-1].unshift({type:`boxStart`,boxData:r.parseBoxData(a[s-2])}),a[s-1].push({type:`boxEnd`,boxText:a[s-2]}),this.$=a[s-1];break;case 19:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:`sequenceIndex`,sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:`sequenceIndex`,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor};break;case 24:this.$={type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1].actor};break;case 30:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 31:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 32:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 33:case 34:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:a[s-1].unshift({type:`loopStart`,loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:`loopEnd`,loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:`rectStart`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:`rectEnd`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:`optStart`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:`optEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:`altStart`,altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:`altEnd`,signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 40:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_OVER_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 41:a[s-1].unshift({type:`criticalStart`,criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:`criticalEnd`,signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 42:a[s-1].unshift({type:`breakStart`,breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:`breakEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 44:this.$=a[s-3].concat([{type:`option`,optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 46:this.$=a[s-3].concat([{type:`and`,parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 48:this.$=a[s-3].concat([{type:`else`,altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 49:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 50:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 51:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 52:case 57:a[s-1].draw=`actor`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 53:a[s-1].type=`destroyParticipant`,this.$=a[s-1];break;case 54:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 55:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 56:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 58:this.$=[a[s-1],{type:`addNote`,placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 59:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:`addNote`,placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 60:this.$=[a[s-1],{type:`addLinks`,actor:a[s-1].actor,text:a[s]}];break;case 61:this.$=[a[s-1],{type:`addALink`,actor:a[s-1].actor,text:a[s]}];break;case 62:this.$=[a[s-1],{type:`addProperties`,actor:a[s-1].actor,text:a[s]}];break;case 63:this.$=[a[s-1],{type:`addDetails`,actor:a[s-1].actor,text:a[s]}];break;case 66:this.$=[a[s-2],a[s]];break;case 67:this.$=a[s];break;case 68:this.$=r.PLACEMENT.LEFTOF;break;case 69:this.$=r.PLACEMENT.RIGHTOF;break;case 70:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0},{type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor}];break;case 71:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4].actor}];break;case 72:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor}];break;case 73:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s],activate:!1,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-4].actor}];break;case 74:this.$=[a[s-5],a[s-1],{type:`addMessage`,from:a[s-5].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-5].actor}];break;case 75:this.$=[a[s-3],a[s-1],{type:`addMessage`,from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 76:this.$={type:`addParticipant`,actor:a[s-1],config:a[s]};break;case 77:this.$=a[s-1].trim();break;case 78:this.$={type:`addParticipant`,actor:a[s]};break;case 79:this.$=r.LINETYPE.SOLID_OPEN;break;case 80:this.$=r.LINETYPE.DOTTED_OPEN;break;case 81:this.$=r.LINETYPE.SOLID;break;case 82:this.$=r.LINETYPE.SOLID_TOP;break;case 83:this.$=r.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=r.LINETYPE.STICK_TOP;break;case 85:this.$=r.LINETYPE.STICK_BOTTOM;break;case 86:this.$=r.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=r.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=r.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=r.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=r.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=r.LINETYPE.DOTTED;break;case 100:this.$=r.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=r.LINETYPE.SOLID_CROSS;break;case 102:this.$=r.LINETYPE.DOTTED_CROSS;break;case 103:this.$=r.LINETYPE.SOLID_POINT;break;case 104:this.$=r.LINETYPE.DOTTED_POINT;break;case 105:this.$=r.parseMessage(a[s].trim().substring(1))}},`anonymous`),table:[{3:1,4:n,5:r,6:i},{1:[3]},{3:5,4:n,5:r,6:i},{3:6,4:n,5:r,6:i},t([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],a,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,15]),{13:49,51:D,53:O,54:k},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:F},{23:56,73:F},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},t(I,[2,30]),t(I,[2,31]),{33:[1,62]},{35:[1,63]},t(I,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:ee},{23:75,55:76,73:ee},{23:77,73:F},{69:78,72:[1,79],78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:F},{23:111,73:F},{23:112,73:F},{23:113,73:F},t([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],_e),t(I,[2,6]),t(I,[2,16]),t(ve,[2,10],{11:114}),t(I,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},t(I,[2,22]),{5:[1,118]},{5:[1,119]},t(I,[2,25]),t(I,[2,26]),t(I,[2,27]),t(I,[2,28]),t(I,[2,29]),t(I,[2,32]),t(I,[2,33]),t(ye,a,{7:120}),t(ye,a,{7:121}),t(ye,a,{7:122}),t(be,a,{41:123,7:124}),t(xe,a,{43:125,7:126}),t(xe,a,{7:126,43:127}),t(Se,a,{46:128,7:129}),t(ye,a,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},t(Ce,_e,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:F},{69:146,78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},t(q,[2,79]),t(q,[2,80]),t(q,[2,81]),t(q,[2,82]),t(q,[2,83]),t(q,[2,84]),t(q,[2,85]),t(q,[2,86]),t(q,[2,87]),t(q,[2,88]),t(q,[2,89]),t(q,[2,90]),t(q,[2,91]),t(q,[2,92]),t(q,[2,93]),t(q,[2,94]),t(q,[2,95]),t(q,[2,96]),t(q,[2,97]),t(q,[2,98]),t(q,[2,99]),t(q,[2,100]),t(q,[2,101]),t(q,[2,102]),t(q,[2,103]),t(q,[2,104]),{23:147,73:F},{23:149,60:148,73:F},{73:[2,68]},{73:[2,69]},{58:150,104:J},{58:152,104:J},{58:153,104:J},{58:154,104:J},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:D,53:O,54:k},{5:[1,160]},t(I,[2,20]),t(I,[2,21]),t(I,[2,23]),t(I,[2,24]),{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,161],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,162],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,163],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,164]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,47],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,50:[1,165],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,166]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,45],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,49:[1,167],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,168]},{17:[1,169]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,43],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,48:[1,170],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,171],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{16:[1,172]},t(I,[2,50]),{16:[1,173]},t(I,[2,55]),t(Ce,[2,76]),{76:[1,174]},{16:[1,175]},t(I,[2,52]),{16:[1,176]},t(I,[2,57]),t(I,[2,53]),{23:177,73:F},{23:178,73:F},{23:179,73:F},{58:180,104:J},{23:181,72:[1,182],73:F},{58:183,104:J},{58:184,104:J},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},t(I,[2,17]),t(ve,[2,11]),{13:186,51:D,53:O,54:k},t(ve,[2,13]),t(ve,[2,14]),t(I,[2,19]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(I,[2,38]),{16:[1,187]},t(I,[2,39]),{16:[1,188]},t(I,[2,40]),t(I,[2,41]),{16:[1,189]},t(I,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:J},{58:196,104:J},{58:197,104:J},{5:[2,75]},{58:198,104:J},{23:199,73:F},{5:[2,58]},{5:[2,59]},{23:200,73:F},t(ve,[2,12]),t(be,a,{7:124,41:201}),t(xe,a,{7:126,43:202}),t(Se,a,{7:129,46:203}),t(I,[2,49]),t(I,[2,54]),t(Ce,[2,77]),t(I,[2,51]),t(I,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:J},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-oBChb5qS.js";import{A as r,F as i,G as a,H as o,K as s,O as c,U as l,a as u,b as d,c as f,i as p,r as m,s as h,v as g,w as _,x as v,y,z as b}from"./chunk-DU6HZSFF-BTLBHwj-.js";import{t as x}from"./dist-B_J_HbC0.js";import{g as S,p as C}from"./chunk-75Z2AOVW-BhIfO9es.js";import{a as w,c as T,i as E,n as D,r as O,s as k}from"./chunk-F27PBJKO-CUw8NZk8.js";import{t as A}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{n as j,t as M}from"./mermaid.core-D3TwYaLF.js";var N=x(),P=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,2],r=[1,3],i=[1,4],a=[2,4],o=[1,9],s=[1,11],c=[1,12],l=[1,14],u=[1,15],d=[1,17],f=[1,18],p=[1,19],m=[1,25],h=[1,26],g=[1,27],_=[1,28],v=[1,29],y=[1,30],b=[1,31],x=[1,32],S=[1,33],C=[1,34],w=[1,35],T=[1,36],E=[1,37],D=[1,38],O=[1,39],k=[1,40],A=[1,42],j=[1,43],M=[1,44],N=[1,45],P=[1,46],F=[1,47],I=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],ee=[1,74],L=[1,80],R=[1,81],te=[1,82],ne=[1,83],z=[1,84],B=[1,85],V=[1,86],re=[1,87],H=[1,88],U=[1,89],W=[1,90],ie=[1,91],ae=[1,92],oe=[1,93],G=[1,94],se=[1,95],K=[1,96],ce=[1,97],le=[1,98],ue=[1,99],de=[1,100],fe=[1,101],pe=[1,102],me=[1,103],he=[1,104],ge=[1,105],_e=[2,78],ve=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],be=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],xe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Ce=[5,52],q=[70,71,72,73],J=[1,151],we={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:`error`,4:`SPACE`,5:`NEWLINE`,6:`SD`,10:`INVALID`,14:`create`,15:`box`,16:`restOfLine`,17:`end`,19:`autonumber`,20:`NUM`,21:`off`,22:`activate`,24:`deactivate`,30:`title`,31:`legacy_title`,32:`acc_title`,33:`acc_title_value`,34:`acc_descr`,35:`acc_descr_value`,36:`acc_descr_multiline_value`,37:`loop`,38:`rect`,39:`opt`,40:`alt`,42:`par`,44:`par_over`,45:`critical`,47:`break`,48:`option`,49:`and`,50:`else`,51:`participant`,52:`AS`,53:`participant_actor`,54:`destroy`,56:`note`,59:`over`,61:`links`,62:`link`,63:`properties`,64:`details`,66:`,`,67:`left_of`,68:`right_of`,70:`+`,71:`-`,72:`()`,73:`ACTOR`,75:`CONFIG_START`,76:`CONFIG_CONTENT`,77:`CONFIG_END`,78:`SOLID_OPEN_ARROW`,79:`DOTTED_OPEN_ARROW`,80:`SOLID_ARROW`,81:`SOLID_ARROW_TOP`,82:`SOLID_ARROW_BOTTOM`,83:`STICK_ARROW_TOP`,84:`STICK_ARROW_BOTTOM`,85:`SOLID_ARROW_TOP_DOTTED`,86:`SOLID_ARROW_BOTTOM_DOTTED`,87:`STICK_ARROW_TOP_DOTTED`,88:`STICK_ARROW_BOTTOM_DOTTED`,89:`SOLID_ARROW_TOP_REVERSE`,90:`SOLID_ARROW_BOTTOM_REVERSE`,91:`STICK_ARROW_TOP_REVERSE`,92:`STICK_ARROW_BOTTOM_REVERSE`,93:`SOLID_ARROW_TOP_REVERSE_DOTTED`,94:`SOLID_ARROW_BOTTOM_REVERSE_DOTTED`,95:`STICK_ARROW_TOP_REVERSE_DOTTED`,96:`STICK_ARROW_BOTTOM_REVERSE_DOTTED`,97:`BIDIRECTIONAL_SOLID_ARROW`,98:`DOTTED_ARROW`,99:`BIDIRECTIONAL_DOTTED_ARROW`,100:`SOLID_CROSS`,101:`DOTTED_CROSS`,102:`SOLID_POINT`,103:`DOTTED_POINT`,104:`TXT`},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return r.apply(a[s]),a[s];case 4:case 10:this.$=[];break;case 5:case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 6:case 7:case 12:case 13:this.$=a[s];break;case 8:case 9:case 14:this.$=[];break;case 16:a[s].type=`createParticipant`,this.$=a[s];break;case 17:a[s-1].unshift({type:`boxStart`,boxData:r.parseBoxData(a[s-2])}),a[s-1].push({type:`boxEnd`,boxText:a[s-2]}),this.$=a[s-1];break;case 19:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:`sequenceIndex`,sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:`sequenceIndex`,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor};break;case 24:this.$={type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1].actor};break;case 30:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 31:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 32:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 33:case 34:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:a[s-1].unshift({type:`loopStart`,loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:`loopEnd`,loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:`rectStart`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:`rectEnd`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:`optStart`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:`optEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:`altStart`,altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:`altEnd`,signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 40:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_OVER_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 41:a[s-1].unshift({type:`criticalStart`,criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:`criticalEnd`,signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 42:a[s-1].unshift({type:`breakStart`,breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:`breakEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 44:this.$=a[s-3].concat([{type:`option`,optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 46:this.$=a[s-3].concat([{type:`and`,parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 48:this.$=a[s-3].concat([{type:`else`,altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 49:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 50:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 51:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 52:case 57:a[s-1].draw=`actor`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 53:a[s-1].type=`destroyParticipant`,this.$=a[s-1];break;case 54:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 55:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 56:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 58:this.$=[a[s-1],{type:`addNote`,placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 59:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:`addNote`,placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 60:this.$=[a[s-1],{type:`addLinks`,actor:a[s-1].actor,text:a[s]}];break;case 61:this.$=[a[s-1],{type:`addALink`,actor:a[s-1].actor,text:a[s]}];break;case 62:this.$=[a[s-1],{type:`addProperties`,actor:a[s-1].actor,text:a[s]}];break;case 63:this.$=[a[s-1],{type:`addDetails`,actor:a[s-1].actor,text:a[s]}];break;case 66:this.$=[a[s-2],a[s]];break;case 67:this.$=a[s];break;case 68:this.$=r.PLACEMENT.LEFTOF;break;case 69:this.$=r.PLACEMENT.RIGHTOF;break;case 70:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0},{type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor}];break;case 71:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4].actor}];break;case 72:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor}];break;case 73:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s],activate:!1,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-4].actor}];break;case 74:this.$=[a[s-5],a[s-1],{type:`addMessage`,from:a[s-5].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-5].actor}];break;case 75:this.$=[a[s-3],a[s-1],{type:`addMessage`,from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 76:this.$={type:`addParticipant`,actor:a[s-1],config:a[s]};break;case 77:this.$=a[s-1].trim();break;case 78:this.$={type:`addParticipant`,actor:a[s]};break;case 79:this.$=r.LINETYPE.SOLID_OPEN;break;case 80:this.$=r.LINETYPE.DOTTED_OPEN;break;case 81:this.$=r.LINETYPE.SOLID;break;case 82:this.$=r.LINETYPE.SOLID_TOP;break;case 83:this.$=r.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=r.LINETYPE.STICK_TOP;break;case 85:this.$=r.LINETYPE.STICK_BOTTOM;break;case 86:this.$=r.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=r.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=r.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=r.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=r.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=r.LINETYPE.DOTTED;break;case 100:this.$=r.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=r.LINETYPE.SOLID_CROSS;break;case 102:this.$=r.LINETYPE.DOTTED_CROSS;break;case 103:this.$=r.LINETYPE.SOLID_POINT;break;case 104:this.$=r.LINETYPE.DOTTED_POINT;break;case 105:this.$=r.parseMessage(a[s].trim().substring(1))}},`anonymous`),table:[{3:1,4:n,5:r,6:i},{1:[3]},{3:5,4:n,5:r,6:i},{3:6,4:n,5:r,6:i},t([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],a,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,15]),{13:49,51:D,53:O,54:k},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:F},{23:56,73:F},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},t(I,[2,30]),t(I,[2,31]),{33:[1,62]},{35:[1,63]},t(I,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:ee},{23:75,55:76,73:ee},{23:77,73:F},{69:78,72:[1,79],78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:F},{23:111,73:F},{23:112,73:F},{23:113,73:F},t([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],_e),t(I,[2,6]),t(I,[2,16]),t(ve,[2,10],{11:114}),t(I,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},t(I,[2,22]),{5:[1,118]},{5:[1,119]},t(I,[2,25]),t(I,[2,26]),t(I,[2,27]),t(I,[2,28]),t(I,[2,29]),t(I,[2,32]),t(I,[2,33]),t(ye,a,{7:120}),t(ye,a,{7:121}),t(ye,a,{7:122}),t(be,a,{41:123,7:124}),t(xe,a,{43:125,7:126}),t(xe,a,{7:126,43:127}),t(Se,a,{46:128,7:129}),t(ye,a,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},t(Ce,_e,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:F},{69:146,78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},t(q,[2,79]),t(q,[2,80]),t(q,[2,81]),t(q,[2,82]),t(q,[2,83]),t(q,[2,84]),t(q,[2,85]),t(q,[2,86]),t(q,[2,87]),t(q,[2,88]),t(q,[2,89]),t(q,[2,90]),t(q,[2,91]),t(q,[2,92]),t(q,[2,93]),t(q,[2,94]),t(q,[2,95]),t(q,[2,96]),t(q,[2,97]),t(q,[2,98]),t(q,[2,99]),t(q,[2,100]),t(q,[2,101]),t(q,[2,102]),t(q,[2,103]),t(q,[2,104]),{23:147,73:F},{23:149,60:148,73:F},{73:[2,68]},{73:[2,69]},{58:150,104:J},{58:152,104:J},{58:153,104:J},{58:154,104:J},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:D,53:O,54:k},{5:[1,160]},t(I,[2,20]),t(I,[2,21]),t(I,[2,23]),t(I,[2,24]),{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,161],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,162],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,163],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,164]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,47],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,50:[1,165],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,166]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,45],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,49:[1,167],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,168]},{17:[1,169]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,43],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,48:[1,170],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,171],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{16:[1,172]},t(I,[2,50]),{16:[1,173]},t(I,[2,55]),t(Ce,[2,76]),{76:[1,174]},{16:[1,175]},t(I,[2,52]),{16:[1,176]},t(I,[2,57]),t(I,[2,53]),{23:177,73:F},{23:178,73:F},{23:179,73:F},{58:180,104:J},{23:181,72:[1,182],73:F},{58:183,104:J},{58:184,104:J},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},t(I,[2,17]),t(ve,[2,11]),{13:186,51:D,53:O,54:k},t(ve,[2,13]),t(ve,[2,14]),t(I,[2,19]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(I,[2,38]),{16:[1,187]},t(I,[2,39]),{16:[1,188]},t(I,[2,40]),t(I,[2,41]),{16:[1,189]},t(I,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:J},{58:196,104:J},{58:197,104:J},{5:[2,75]},{58:198,104:J},{23:199,73:F},{5:[2,58]},{5:[2,59]},{23:200,73:F},t(ve,[2,12]),t(be,a,{7:124,41:201}),t(xe,a,{7:126,43:202}),t(Se,a,{7:129,46:203}),t(I,[2,49]),t(I,[2,54]),t(Ce,[2,77]),t(I,[2,51]),t(I,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:J},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};we.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(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},`input`),unput:e(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),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.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(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,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
package/out/phone/assets/{stateDiagram-D77RDMKH-BxyRe7OB.js → stateDiagram-D77RDMKH-CgP9dUc3.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-oBChb5qS.js";import{O as r,c as i,s as a,x as o}from"./chunk-DU6HZSFF-CjWveEkB.js";import{et as s,g as c}from"./chunk-75Z2AOVW-DDCXp4y1.js";import{t as l}from"./line-Db4SulF4.js";import"./chunk-PWAF6VOD-D9dLdFqC.js";import"./chunk-GMAD6QVW-EmL8nOme.js";import"./chunk-P2QGCYS3-Cci-G-p1.js";import"./chunk-4HAMMTFA-CcezrqKz.js";import"./chunk-GVQU2GXP-Dox_nphF.js";import"./chunk-OSK3NFVY-2VVlErAd.js";import{t as u}from"./graphlib-DS17s2tU.js";import{t as d}from"./dagre-PrKaheQc.js";import"./chunk-F27PBJKO-Bgl_xI02.js";import"./chunk-XXDRQBXY-BvKO0v-W.js";import"./chunk-POPQ4Y6H-CJ47EOfE.js";import"./chunk-L3NEJ4N5-Cq_UZI8A.js";import{i as f,n as p,t as m}from"./chunk-IMKFNOWR-BapGpI4S.js";import"./mermaid.core-Dw_E5kj4.js";var h=e(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit).attr(`cy`,o().state.padding+o().state.sizeUnit),`drawStartState`),g=e(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,o().state.textHeight).attr(`class`,`divider`).attr(`x2`,o().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),_=e((e,t)=>{let n=e.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+2*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,r.width+2*o().state.padding).attr(`height`,r.height+2*o().state.padding).attr(`rx`,o().state.radius),n},`drawSimpleState`),v=e((t,n)=>{let r=e(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*o().state.padding).text(t);n||r.attr(`dy`,o().state.textHeight)},`addTspan`),i=t.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+1.3*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(n.descriptions[0]).node().getBBox(),a=i.height,s=t.append(`text`).attr(`x`,o().state.padding).attr(`y`,a+o().state.padding*.4+o().state.dividerMargin+o().state.textHeight).attr(`class`,`state-description`),c=!0,l=!0;n.descriptions.forEach(function(e){c||(r(s,e,l),l=!1),c=!1});let u=t.append(`line`).attr(`x1`,o().state.padding).attr(`y1`,o().state.padding+a+o().state.dividerMargin/2).attr(`y2`,o().state.padding+a+o().state.dividerMargin/2).attr(`class`,`descr-divider`),d=s.node().getBBox(),f=Math.max(d.width,i.width);return u.attr(`x2`,f+3*o().state.padding),t.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,f+2*o().state.padding).attr(`height`,d.height+a+2*o().state.padding).attr(`rx`,o().state.radius),t},`drawDescrState`),y=e((e,t,n)=>{let r=o().state.padding,i=2*o().state.padding,a=e.node().getBBox(),s=a.width,c=a.x,l=e.append(`text`).attr(`x`,0).attr(`y`,o().state.titleShift).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),u=l.node().getBBox().width+i,d=Math.max(u,s);d===s&&(d+=i);let f,p=e.node().getBBox();t.doc,f=c-r,u>s&&(f=(s-d)/2+r),Math.abs(c-p.x)<r&&u>s&&(f=c-(u-s)/2);let m=1-o().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,d).attr(`height`,p.height+o().state.textHeight+o().state.titleShift+1).attr(`rx`,`0`),l.attr(`x`,f+r),u<=s&&l.attr(`x`,c+(d-i)/2-u/2+r),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,o().state.textHeight*3).attr(`rx`,o().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,p.height+3+2*o().state.textHeight).attr(`rx`,o().state.radius),e},`addTitleAndBox`),b=e(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,o().state.sizeUnit+o().state.miniPadding).attr(`cx`,o().state.padding+o().state.sizeUnit+o().state.miniPadding).attr(`cy`,o().state.padding+o().state.sizeUnit+o().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit+2).attr(`cy`,o().state.padding+o().state.sizeUnit+2)),`drawEndState`),x=e((e,t)=>{let n=o().state.forkWidth,r=o().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,o().state.padding).attr(`y`,o().state.padding)},`drawForkJoinState`),S=e((e,t,n,r)=>{let i=0,s=r.append(`text`);s.style(`text-anchor`,`start`),s.attr(`class`,`noteText`);let c=e.replace(/\r\n/g,`<br/>`);c=c.replace(/\n/g,`<br/>`);let l=c.split(a.lineBreakRegex),u=1.25*o().state.noteMargin;for(let e of l){let r=e.trim();if(r.length>0){let e=s.append(`tspan`);if(e.text(r),u===0){let t=e.node().getBBox();u+=t.height}i+=u,e.attr(`x`,t+o().state.noteMargin),e.attr(`y`,n+i+1.25*o().state.noteMargin)}}return{textWidth:s.node().getBBox().width,textHeight:i}},`_drawLongText`),C=e((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,o().state.padding),{textWidth:r,textHeight:i}=S(e,0,0,t.append(`g`));return n.attr(`height`,i+2*o().state.noteMargin),n.attr(`width`,r+o().state.noteMargin*2),n},`drawNote`),w=e(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&h(i),t.type===`end`&&b(i),(t.type===`fork`||t.type===`join`)&&x(i,t),t.type===`note`&&C(t.note.text,i),t.type===`divider`&&g(i),t.type==="default"&&t.descriptions.length===0&&_(i,t),t.type==="default"&&t.descriptions.length>0&&v(i,t);let a=i.node().getBBox();return r.width=a.width+2*o().state.padding,r.height=a.height+2*o().state.padding,r},`drawState`),T=0,E=e(function(n,i,u){let d=e(function(e){switch(e){case m.relationType.AGGREGATION:return`aggregation`;case m.relationType.EXTENSION:return`extension`;case m.relationType.COMPOSITION:return`composition`;case m.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);i.points=i.points.filter(e=>!Number.isNaN(e.y));let f=i.points,p=l().x(function(e){return e.x}).y(function(e){return e.y}).curve(s),h=n.append(`path`).attr(`d`,p(f)).attr(`id`,`edge`+T).attr(`class`,`transition`),g=``;if(o().state.arrowMarkerAbsolute&&(g=r(!0)),h.attr(`marker-end`,`url(`+g+`#`+d(m.relationType.DEPENDENCY)+`End)`),u.title!==void 0){let e=n.append(`g`).attr(`class`,`stateLabel`),{x:r,y:s}=c.calcLabelPosition(i.points),l=a.getRows(u.title),d=0,f=[],p=0,m=0;for(let n=0;n<=l.length;n++){let i=e.append(`text`).attr(`text-anchor`,`middle`).text(l[n]).attr(`x`,r).attr(`y`,s+d),a=i.node().getBBox();p=Math.max(p,a.width),m=Math.min(m,a.x),t.info(a.x,r,s+d),d===0&&(d=i.node().getBBox().height,t.info(`Title height`,d,s)),f.push(i)}let h=d*l.length;if(l.length>1){let e=(l.length-1)*d*.5;f.forEach((t,n)=>t.attr(`y`,s+n*d-e)),h=d*l.length}let g=e.node().getBBox();e.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,r-p/2-o().state.padding/2).attr(`y`,s-h/2-o().state.padding/2-3.5).attr(`width`,p+o().state.padding).attr(`height`,h+o().state.padding),t.info(g)}T++},`drawEdge`),D,O={},k=e(function(){},`setConf`),A=e(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),j=e(function(e,r,a,s){D=o().state;let c=o().securityLevel,l;c===`sandbox`&&(l=n(`#i`+r));let u=n(c===`sandbox`?l.nodes()[0].contentDocument.body:`body`),d=c===`sandbox`?l.nodes()[0].contentDocument:document;t.debug(`Rendering diagram `+e);let f=u.select(`[id='${r}']`);A(f),N(s.db.getRootDoc(),f.append(`g`).attr(`id`,r+`-root`),void 0,!1,u,d,s);let p=D.padding,m=f.node().getBBox(),h=m.width+p*2,g=m.height+p*2,_=h*1.75;i(f,g,_,D.useMaxWidth),f.attr(`viewBox`,`${m.x-D.padding} ${m.y-D.padding} `+h+` `+g)},`draw`),M=e(e=>e?e.length*D.fontSizeFactor:1,`getLabelWidth`),N=e((e,n,r,i,o,s,c)=>{let l=new u({compound:!0,multigraph:!0}),f,p=!0;for(f=0;f<e.length;f++)if(e[f].stmt===`relation`){p=!1;break}r?l.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,isMultiGraph:!0}):l.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,ranker:`tight-tree`,isMultiGraph:!0}),l.setDefaultEdgeLabel(function(){return{}});let m=c.db.getStates(),h=c.db.getRelations(),g=Object.keys(m);for(let e of g){let t=m[e];r&&(t.parentId=r);let a;if(t.doc){let e=n.append(`g`).attr(`id`,t.id).attr(`class`,`stateGroup`);a=N(t.doc,e,t.id,!i,o,s,c);{e=y(e,t,i);let n=e.node().getBBox();a.width=n.width,a.height=n.height+D.padding/2,O[t.id]={y:D.compositTitleSize}}}else a=w(n,t,l);if(t.note){let e=w(n,{descriptions:[],id:t.id+`-note`,note:t.note,type:`note`},l);t.note.position===`left of`?(l.setNode(a.id+`-note`,e),l.setNode(a.id,a)):(l.setNode(a.id,a),l.setNode(a.id+`-note`,e)),l.setParent(a.id,a.id+`-group`),l.setParent(a.id+`-note`,a.id+`-group`)}else l.setNode(a.id,a)}t.debug(`Count=`,l.nodeCount(),l);let _=0;h.forEach(function(e){_++,t.debug(`Setting edge`,e),l.setEdge(e.id1,e.id2,{relation:e,width:M(e.title),height:D.labelHeight*a.getRows(e.title).length,labelpos:`c`},`id`+_)}),d(l),t.debug(`Graph after layout`,l.nodes());let v=n.node();l.nodes().forEach(function(e){e!==void 0&&l.node(e)!==void 0?(t.warn(`Node `+e+`: `+JSON.stringify(l.node(e))),o.select(`#`+v.id+` #`+e).attr(`transform`,`translate(`+(l.node(e).x-l.node(e).width/2)+`,`+(l.node(e).y+(O[e]?O[e].y:0)-l.node(e).height/2)+` )`),o.select(`#`+v.id+` #`+e).attr(`data-x-shift`,l.node(e).x-l.node(e).width/2),s.querySelectorAll(`#`+v.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):t.debug(`No Node `+e+`: `+JSON.stringify(l.node(e)))});let b=v.getBBox();l.edges().forEach(function(e){e!==void 0&&l.edge(e)!==void 0&&(t.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(l.edge(e))),E(n,l.edge(e),l.edge(e).relation))}),b=v.getBBox();let x={id:r||`root`,label:r||`root`,width:0,height:0};return x.width=b.width+2*D.padding,x.height=b.height+2*D.padding,t.debug(`Doc rendered`,x,l),x},`renderDoc`),P={parser:p,get db(){return new m(1)},renderer:{setConf:k,draw:j},styles:f,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{P as diagram};
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-oBChb5qS.js";import{O as r,c as i,s as a,x as o}from"./chunk-DU6HZSFF-BTLBHwj-.js";import{et as s,g as c}from"./chunk-75Z2AOVW-BhIfO9es.js";import{t as l}from"./line-BflnZFgp.js";import"./chunk-PWAF6VOD-CfqWQZRE.js";import"./chunk-GMAD6QVW-bZOKnRyM.js";import"./chunk-P2QGCYS3-D2ID3RxV.js";import"./chunk-4HAMMTFA-BA8HaYy2.js";import"./chunk-GVQU2GXP-B0WIm1dS.js";import"./chunk-OSK3NFVY-C5aEouov.js";import{t as u}from"./graphlib-DS17s2tU.js";import{t as d}from"./dagre-PrKaheQc.js";import"./chunk-F27PBJKO-CUw8NZk8.js";import"./chunk-XXDRQBXY-BvKO0v-W.js";import"./chunk-POPQ4Y6H-C1lOuNpV.js";import"./chunk-L3NEJ4N5-DgMknY3k.js";import{i as f,n as p,t as m}from"./chunk-IMKFNOWR-DWND4rEr.js";import"./mermaid.core-D3TwYaLF.js";var h=e(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit).attr(`cy`,o().state.padding+o().state.sizeUnit),`drawStartState`),g=e(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,o().state.textHeight).attr(`class`,`divider`).attr(`x2`,o().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),_=e((e,t)=>{let n=e.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+2*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,r.width+2*o().state.padding).attr(`height`,r.height+2*o().state.padding).attr(`rx`,o().state.radius),n},`drawSimpleState`),v=e((t,n)=>{let r=e(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*o().state.padding).text(t);n||r.attr(`dy`,o().state.textHeight)},`addTspan`),i=t.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+1.3*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(n.descriptions[0]).node().getBBox(),a=i.height,s=t.append(`text`).attr(`x`,o().state.padding).attr(`y`,a+o().state.padding*.4+o().state.dividerMargin+o().state.textHeight).attr(`class`,`state-description`),c=!0,l=!0;n.descriptions.forEach(function(e){c||(r(s,e,l),l=!1),c=!1});let u=t.append(`line`).attr(`x1`,o().state.padding).attr(`y1`,o().state.padding+a+o().state.dividerMargin/2).attr(`y2`,o().state.padding+a+o().state.dividerMargin/2).attr(`class`,`descr-divider`),d=s.node().getBBox(),f=Math.max(d.width,i.width);return u.attr(`x2`,f+3*o().state.padding),t.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,f+2*o().state.padding).attr(`height`,d.height+a+2*o().state.padding).attr(`rx`,o().state.radius),t},`drawDescrState`),y=e((e,t,n)=>{let r=o().state.padding,i=2*o().state.padding,a=e.node().getBBox(),s=a.width,c=a.x,l=e.append(`text`).attr(`x`,0).attr(`y`,o().state.titleShift).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),u=l.node().getBBox().width+i,d=Math.max(u,s);d===s&&(d+=i);let f,p=e.node().getBBox();t.doc,f=c-r,u>s&&(f=(s-d)/2+r),Math.abs(c-p.x)<r&&u>s&&(f=c-(u-s)/2);let m=1-o().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,d).attr(`height`,p.height+o().state.textHeight+o().state.titleShift+1).attr(`rx`,`0`),l.attr(`x`,f+r),u<=s&&l.attr(`x`,c+(d-i)/2-u/2+r),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,o().state.textHeight*3).attr(`rx`,o().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,p.height+3+2*o().state.textHeight).attr(`rx`,o().state.radius),e},`addTitleAndBox`),b=e(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,o().state.sizeUnit+o().state.miniPadding).attr(`cx`,o().state.padding+o().state.sizeUnit+o().state.miniPadding).attr(`cy`,o().state.padding+o().state.sizeUnit+o().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit+2).attr(`cy`,o().state.padding+o().state.sizeUnit+2)),`drawEndState`),x=e((e,t)=>{let n=o().state.forkWidth,r=o().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,o().state.padding).attr(`y`,o().state.padding)},`drawForkJoinState`),S=e((e,t,n,r)=>{let i=0,s=r.append(`text`);s.style(`text-anchor`,`start`),s.attr(`class`,`noteText`);let c=e.replace(/\r\n/g,`<br/>`);c=c.replace(/\n/g,`<br/>`);let l=c.split(a.lineBreakRegex),u=1.25*o().state.noteMargin;for(let e of l){let r=e.trim();if(r.length>0){let e=s.append(`tspan`);if(e.text(r),u===0){let t=e.node().getBBox();u+=t.height}i+=u,e.attr(`x`,t+o().state.noteMargin),e.attr(`y`,n+i+1.25*o().state.noteMargin)}}return{textWidth:s.node().getBBox().width,textHeight:i}},`_drawLongText`),C=e((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,o().state.padding),{textWidth:r,textHeight:i}=S(e,0,0,t.append(`g`));return n.attr(`height`,i+2*o().state.noteMargin),n.attr(`width`,r+o().state.noteMargin*2),n},`drawNote`),w=e(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&h(i),t.type===`end`&&b(i),(t.type===`fork`||t.type===`join`)&&x(i,t),t.type===`note`&&C(t.note.text,i),t.type===`divider`&&g(i),t.type==="default"&&t.descriptions.length===0&&_(i,t),t.type==="default"&&t.descriptions.length>0&&v(i,t);let a=i.node().getBBox();return r.width=a.width+2*o().state.padding,r.height=a.height+2*o().state.padding,r},`drawState`),T=0,E=e(function(n,i,u){let d=e(function(e){switch(e){case m.relationType.AGGREGATION:return`aggregation`;case m.relationType.EXTENSION:return`extension`;case m.relationType.COMPOSITION:return`composition`;case m.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);i.points=i.points.filter(e=>!Number.isNaN(e.y));let f=i.points,p=l().x(function(e){return e.x}).y(function(e){return e.y}).curve(s),h=n.append(`path`).attr(`d`,p(f)).attr(`id`,`edge`+T).attr(`class`,`transition`),g=``;if(o().state.arrowMarkerAbsolute&&(g=r(!0)),h.attr(`marker-end`,`url(`+g+`#`+d(m.relationType.DEPENDENCY)+`End)`),u.title!==void 0){let e=n.append(`g`).attr(`class`,`stateLabel`),{x:r,y:s}=c.calcLabelPosition(i.points),l=a.getRows(u.title),d=0,f=[],p=0,m=0;for(let n=0;n<=l.length;n++){let i=e.append(`text`).attr(`text-anchor`,`middle`).text(l[n]).attr(`x`,r).attr(`y`,s+d),a=i.node().getBBox();p=Math.max(p,a.width),m=Math.min(m,a.x),t.info(a.x,r,s+d),d===0&&(d=i.node().getBBox().height,t.info(`Title height`,d,s)),f.push(i)}let h=d*l.length;if(l.length>1){let e=(l.length-1)*d*.5;f.forEach((t,n)=>t.attr(`y`,s+n*d-e)),h=d*l.length}let g=e.node().getBBox();e.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,r-p/2-o().state.padding/2).attr(`y`,s-h/2-o().state.padding/2-3.5).attr(`width`,p+o().state.padding).attr(`height`,h+o().state.padding),t.info(g)}T++},`drawEdge`),D,O={},k=e(function(){},`setConf`),A=e(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),j=e(function(e,r,a,s){D=o().state;let c=o().securityLevel,l;c===`sandbox`&&(l=n(`#i`+r));let u=n(c===`sandbox`?l.nodes()[0].contentDocument.body:`body`),d=c===`sandbox`?l.nodes()[0].contentDocument:document;t.debug(`Rendering diagram `+e);let f=u.select(`[id='${r}']`);A(f),N(s.db.getRootDoc(),f.append(`g`).attr(`id`,r+`-root`),void 0,!1,u,d,s);let p=D.padding,m=f.node().getBBox(),h=m.width+p*2,g=m.height+p*2,_=h*1.75;i(f,g,_,D.useMaxWidth),f.attr(`viewBox`,`${m.x-D.padding} ${m.y-D.padding} `+h+` `+g)},`draw`),M=e(e=>e?e.length*D.fontSizeFactor:1,`getLabelWidth`),N=e((e,n,r,i,o,s,c)=>{let l=new u({compound:!0,multigraph:!0}),f,p=!0;for(f=0;f<e.length;f++)if(e[f].stmt===`relation`){p=!1;break}r?l.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,isMultiGraph:!0}):l.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,ranker:`tight-tree`,isMultiGraph:!0}),l.setDefaultEdgeLabel(function(){return{}});let m=c.db.getStates(),h=c.db.getRelations(),g=Object.keys(m);for(let e of g){let t=m[e];r&&(t.parentId=r);let a;if(t.doc){let e=n.append(`g`).attr(`id`,t.id).attr(`class`,`stateGroup`);a=N(t.doc,e,t.id,!i,o,s,c);{e=y(e,t,i);let n=e.node().getBBox();a.width=n.width,a.height=n.height+D.padding/2,O[t.id]={y:D.compositTitleSize}}}else a=w(n,t,l);if(t.note){let e=w(n,{descriptions:[],id:t.id+`-note`,note:t.note,type:`note`},l);t.note.position===`left of`?(l.setNode(a.id+`-note`,e),l.setNode(a.id,a)):(l.setNode(a.id,a),l.setNode(a.id+`-note`,e)),l.setParent(a.id,a.id+`-group`),l.setParent(a.id+`-note`,a.id+`-group`)}else l.setNode(a.id,a)}t.debug(`Count=`,l.nodeCount(),l);let _=0;h.forEach(function(e){_++,t.debug(`Setting edge`,e),l.setEdge(e.id1,e.id2,{relation:e,width:M(e.title),height:D.labelHeight*a.getRows(e.title).length,labelpos:`c`},`id`+_)}),d(l),t.debug(`Graph after layout`,l.nodes());let v=n.node();l.nodes().forEach(function(e){e!==void 0&&l.node(e)!==void 0?(t.warn(`Node `+e+`: `+JSON.stringify(l.node(e))),o.select(`#`+v.id+` #`+e).attr(`transform`,`translate(`+(l.node(e).x-l.node(e).width/2)+`,`+(l.node(e).y+(O[e]?O[e].y:0)-l.node(e).height/2)+` )`),o.select(`#`+v.id+` #`+e).attr(`data-x-shift`,l.node(e).x-l.node(e).width/2),s.querySelectorAll(`#`+v.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):t.debug(`No Node `+e+`: `+JSON.stringify(l.node(e)))});let b=v.getBBox();l.edges().forEach(function(e){e!==void 0&&l.edge(e)!==void 0&&(t.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(l.edge(e))),E(n,l.edge(e),l.edge(e).relation))}),b=v.getBBox();let x={id:r||`root`,label:r||`root`,width:0,height:0};return x.width=b.width+2*D.padding,x.height=b.height+2*D.padding,t.debug(`Doc rendered`,x,l),x},`renderDoc`),P={parser:p,get db(){return new m(1)},renderer:{setConf:k,draw:j},styles:f,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{P as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-oBChb5qS.js";import"./chunk-DU6HZSFF-BTLBHwj-.js";import"./chunk-75Z2AOVW-BhIfO9es.js";import"./chunk-PWAF6VOD-CfqWQZRE.js";import"./chunk-GMAD6QVW-bZOKnRyM.js";import"./chunk-P2QGCYS3-D2ID3RxV.js";import"./chunk-4HAMMTFA-BA8HaYy2.js";import"./chunk-GVQU2GXP-B0WIm1dS.js";import"./chunk-OSK3NFVY-C5aEouov.js";import"./chunk-F27PBJKO-CUw8NZk8.js";import"./chunk-XXDRQBXY-BvKO0v-W.js";import"./chunk-POPQ4Y6H-C1lOuNpV.js";import"./chunk-L3NEJ4N5-DgMknY3k.js";import{i as t,n,r,t as i}from"./chunk-IMKFNOWR-DWND4rEr.js";import"./mermaid.core-D3TwYaLF.js";var a={parser:n,get db(){return new i(2)},renderer:r,styles:t,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t,t as n}from"./rolldown-runtime-Dd_uD5pT.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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),i=n(((e,t)=>{t.exports=r()})),a=n(((e,t)=>{t.exports={}})),o=e(n(((e,n)=>{(function(e){var n=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},r=function(){throw Error(`no PRNG`)},i=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=n(),c=n([1]),l=n([56129,1]),u=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=r&255}function g(e,t,n,r,i){var a,o=0;for(a=0;a<i;a++)o|=e[t+a]^n[r+a];return(1&o-1>>>8)-1}function _(e,t,n,r){return g(e,t,n,r,16)}function v(e,t,n,r){return g(e,t,n,r,32)}function y(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,L=0;L<20;L+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;b=b+i|0,x=x+a|0,S=S+o|0,C=C+s|0,w=w+c|0,T=T+l|0,E=E+u|0,D=D+d|0,O=O+f|0,k=k+p|0,A=A+m|0,j=j+h|0,M=M+g|0,N=N+_|0,P=P+v|0,F=F+y|0,e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=C>>>0&255,e[13]=C>>>8&255,e[14]=C>>>16&255,e[15]=C>>>24&255,e[16]=w>>>0&255,e[17]=w>>>8&255,e[18]=w>>>16&255,e[19]=w>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=E>>>0&255,e[25]=E>>>8&255,e[26]=E>>>16&255,e[27]=E>>>24&255,e[28]=D>>>0&255,e[29]=D>>>8&255,e[30]=D>>>16&255,e[31]=D>>>24&255,e[32]=O>>>0&255,e[33]=O>>>8&255,e[34]=O>>>16&255,e[35]=O>>>24&255,e[36]=k>>>0&255,e[37]=k>>>8&255,e[38]=k>>>16&255,e[39]=k>>>24&255,e[40]=A>>>0&255,e[41]=A>>>8&255,e[42]=A>>>16&255,e[43]=A>>>24&255,e[44]=j>>>0&255,e[45]=j>>>8&255,e[46]=j>>>16&255,e[47]=j>>>24&255,e[48]=M>>>0&255,e[49]=M>>>8&255,e[50]=M>>>16&255,e[51]=M>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}function b(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,L=0;L<20;L+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=T>>>0&255,e[5]=T>>>8&255,e[6]=T>>>16&255,e[7]=T>>>24&255,e[8]=A>>>0&255,e[9]=A>>>8&255,e[10]=A>>>16&255,e[11]=A>>>24&255,e[12]=F>>>0&255,e[13]=F>>>8&255,e[14]=F>>>16&255,e[15]=F>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=D>>>0&255,e[21]=D>>>8&255,e[22]=D>>>16&255,e[23]=D>>>24&255,e[24]=O>>>0&255,e[25]=O>>>8&255,e[26]=O>>>16&255,e[27]=O>>>24&255,e[28]=k>>>0&255,e[29]=k>>>8&255,e[30]=k>>>16&255,e[31]=k>>>24&255}function x(e,t,n,r){y(e,t,n,r)}function S(e,t,n,r){b(e,t,n,r)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,n,r,i,a,o){var s=new Uint8Array(16),c=new Uint8Array(64),l,u;for(u=0;u<16;u++)s[u]=0;for(u=0;u<8;u++)s[u]=a[u];for(;i>=64;){for(x(c,s,o,C),u=0;u<64;u++)e[t+u]=n[r+u]^c[u];for(l=1,u=8;u<16;u++)l=l+(s[u]&255)|0,s[u]=l&255,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(x(c,s,o,C),u=0;u<i;u++)e[t+u]=n[r+u]^c[u];return 0}function T(e,t,n,r,i){var a=new Uint8Array(16),o=new Uint8Array(64),s,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=r[c];for(;n>=64;){for(x(o,a,i,C),c=0;c<64;c++)e[t+c]=o[c];for(s=1,c=8;c<16;c++)s=s+(a[c]&255)|0,a[c]=s&255,s>>>=8;n-=64,t+=64}if(n>0)for(x(o,a,i,C),c=0;c<n;c++)e[t+c]=o[c];return 0}function E(e,t,n,r,i){var a=new Uint8Array(32);S(a,r,i,C);for(var o=new Uint8Array(8),s=0;s<8;s++)o[s]=r[s+16];return T(e,t,n,o,a)}function D(e,t,n,r,i,a,o){var s=new Uint8Array(32);S(s,a,o,C);for(var c=new Uint8Array(8),l=0;l<8;l++)c[l]=a[l+16];return w(e,t,n,r,i,c,s)}var O=function(e){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t=e[0]&255|(e[1]&255)<<8,n,r,i,a,o,s,c;this.r[0]=t&8191,n=e[2]&255|(e[3]&255)<<8,this.r[1]=(t>>>13|n<<3)&8191,r=e[4]&255|(e[5]&255)<<8,this.r[2]=(n>>>10|r<<6)&7939,i=e[6]&255|(e[7]&255)<<8,this.r[3]=(r>>>7|i<<9)&8191,a=e[8]&255|(e[9]&255)<<8,this.r[4]=(i>>>4|a<<12)&255,this.r[5]=a>>>1&8190,o=e[10]&255|(e[11]&255)<<8,this.r[6]=(a>>>14|o<<2)&8191,s=e[12]&255|(e[13]&255)<<8,this.r[7]=(o>>>11|s<<5)&8065,c=e[14]&255|(e[15]&255)<<8,this.r[8]=(s>>>8|c<<8)&8191,this.r[9]=c>>>5&127,this.pad[0]=e[16]&255|(e[17]&255)<<8,this.pad[1]=e[18]&255|(e[19]&255)<<8,this.pad[2]=e[20]&255|(e[21]&255)<<8,this.pad[3]=e[22]&255|(e[23]&255)<<8,this.pad[4]=e[24]&255|(e[25]&255)<<8,this.pad[5]=e[26]&255|(e[27]&255)<<8,this.pad[6]=e[28]&255|(e[29]&255)<<8,this.pad[7]=e[30]&255|(e[31]&255)<<8};O.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C=this.h[0],w=this.h[1],T=this.h[2],E=this.h[3],D=this.h[4],O=this.h[5],k=this.h[6],A=this.h[7],j=this.h[8],M=this.h[9],N=this.r[0],P=this.r[1],F=this.r[2],I=this.r[3],L=this.r[4],R=this.r[5],z=this.r[6],B=this.r[7],V=this.r[8],H=this.r[9];n>=16;)i=e[t+0]&255|(e[t+1]&255)<<8,C+=i&8191,a=e[t+2]&255|(e[t+3]&255)<<8,w+=(i>>>13|a<<3)&8191,o=e[t+4]&255|(e[t+5]&255)<<8,T+=(a>>>10|o<<6)&8191,s=e[t+6]&255|(e[t+7]&255)<<8,E+=(o>>>7|s<<9)&8191,c=e[t+8]&255|(e[t+9]&255)<<8,D+=(s>>>4|c<<12)&8191,O+=c>>>1&8191,l=e[t+10]&255|(e[t+11]&255)<<8,k+=(c>>>14|l<<2)&8191,u=e[t+12]&255|(e[t+13]&255)<<8,A+=(l>>>11|u<<5)&8191,d=e[t+14]&255|(e[t+15]&255)<<8,j+=(u>>>8|d<<8)&8191,M+=d>>>5|r,f=0,p=f,p+=C*N,p+=5*H*w,p+=5*V*T,p+=5*B*E,p+=5*z*D,f=p>>>13,p&=8191,p+=5*R*O,p+=5*L*k,p+=5*I*A,p+=5*F*j,p+=5*P*M,f+=p>>>13,p&=8191,m=f,m+=C*P,m+=w*N,m+=5*H*T,m+=5*V*E,m+=5*B*D,f=m>>>13,m&=8191,m+=5*z*O,m+=5*R*k,m+=5*L*A,m+=5*I*j,m+=5*F*M,f+=m>>>13,m&=8191,h=f,h+=C*F,h+=w*P,h+=T*N,h+=5*H*E,h+=5*V*D,f=h>>>13,h&=8191,h+=5*B*O,h+=5*z*k,h+=5*R*A,h+=5*L*j,h+=5*I*M,f+=h>>>13,h&=8191,g=f,g+=C*I,g+=w*F,g+=T*P,g+=E*N,g+=5*H*D,f=g>>>13,g&=8191,g+=5*V*O,g+=5*B*k,g+=5*z*A,g+=5*R*j,g+=5*L*M,f+=g>>>13,g&=8191,_=f,_+=C*L,_+=w*I,_+=T*F,_+=E*P,_+=D*N,f=_>>>13,_&=8191,_+=5*H*O,_+=5*V*k,_+=5*B*A,_+=5*z*j,_+=5*R*M,f+=_>>>13,_&=8191,v=f,v+=C*R,v+=w*L,v+=T*I,v+=E*F,v+=D*P,f=v>>>13,v&=8191,v+=O*N,v+=5*H*k,v+=5*V*A,v+=5*B*j,v+=5*z*M,f+=v>>>13,v&=8191,y=f,y+=C*z,y+=w*R,y+=T*L,y+=E*I,y+=D*F,f=y>>>13,y&=8191,y+=O*P,y+=k*N,y+=5*H*A,y+=5*V*j,y+=5*B*M,f+=y>>>13,y&=8191,b=f,b+=C*B,b+=w*z,b+=T*R,b+=E*L,b+=D*I,f=b>>>13,b&=8191,b+=O*F,b+=k*P,b+=A*N,b+=5*H*j,b+=5*V*M,f+=b>>>13,b&=8191,x=f,x+=C*V,x+=w*B,x+=T*z,x+=E*R,x+=D*L,f=x>>>13,x&=8191,x+=O*I,x+=k*F,x+=A*P,x+=j*N,x+=5*H*M,f+=x>>>13,x&=8191,S=f,S+=C*H,S+=w*V,S+=T*B,S+=E*z,S+=D*R,f=S>>>13,S&=8191,S+=O*L,S+=k*I,S+=A*F,S+=j*P,S+=M*N,f+=S>>>13,S&=8191,f=(f<<2)+f|0,f=f+p|0,p=f&8191,f>>>=13,m+=f,C=p,w=m,T=h,E=g,D=_,O=v,k=y,A=b,j=x,M=S,t+=16,n-=16;this.h[0]=C,this.h[1]=w,this.h[2]=T,this.h[3]=E,this.h[4]=D,this.h[5]=O,this.h[6]=k,this.h[7]=A,this.h[8]=j,this.h[9]=M},O.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,a,o;if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,o=1;o<10;o++)n[o]=this.h[o]+r,r=n[o]>>>13,n[o]&=8191;for(n[9]-=8192,i=(r^1)-1,o=0;o<10;o++)n[o]&=i;for(i=~i,o=0;o<10;o++)this.h[o]=this.h[o]&i|n[o];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,a=this.h[0]+this.pad[0],this.h[0]=a&65535,o=1;o<8;o++)a=(this.h[o]+this.pad[o]|0)+(a>>>16)|0,this.h[o]=a&65535;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},O.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r<i;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};function k(e,t,n,r,i,a){var o=new O(a);return o.update(n,r,i),o.finish(e,t),0}function A(e,t,n,r,i,a){var o=new Uint8Array(16);return k(o,0,n,r,i,a),_(e,t,o,0)}function j(e,t,n,r,i){var a;if(n<32)return-1;for(D(e,0,t,0,n,r,i),k(e,16,e,32,n-32,e),a=0;a<16;a++)e[a]=0;return 0}function M(e,t,n,r,i){var a,o=new Uint8Array(32);if(n<32||(E(o,0,32,r,i),A(t,16,t,32,n-32,o)!==0))return-1;for(D(e,0,t,0,n,r,i),a=0;a<32;a++)e[a]=0;return 0}function N(e,t){var n;for(n=0;n<16;n++)e[n]=t[n]|0}function P(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-r*65536;e[0]+=r-1+37*(r-1)}function F(e,t,n){for(var r,i=~(n-1),a=0;a<16;a++)r=i&(e[a]^t[a]),e[a]^=r,t[a]^=r}function I(e,t){var r,i,a,o=n(),s=n();for(r=0;r<16;r++)s[r]=t[r];for(P(s),P(s),P(s),i=0;i<2;i++){for(o[0]=s[0]-65517,r=1;r<15;r++)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),a=o[15]>>16&1,o[14]&=65535,F(s,o,1-a)}for(r=0;r<16;r++)e[2*r]=s[r]&255,e[2*r+1]=s[r]>>8}function L(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return I(n,e),I(r,t),v(n,0,r,0)}function R(e){var t=new Uint8Array(32);return I(t,e),t[0]&1}function z(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function B(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function V(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function H(e,t,n){var r,i,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,A=0,j=0,M=0,N=0,P=0,F=0,I=n[0],L=n[1],R=n[2],z=n[3],B=n[4],V=n[5],H=n[6],U=n[7],W=n[8],G=n[9],K=n[10],q=n[11],J=n[12],ee=n[13],Y=n[14],te=n[15];r=t[0],a+=r*I,o+=r*L,s+=r*R,c+=r*z,l+=r*B,u+=r*V,d+=r*H,f+=r*U,p+=r*W,m+=r*G,h+=r*K,g+=r*q,_+=r*J,v+=r*ee,y+=r*Y,b+=r*te,r=t[1],o+=r*I,s+=r*L,c+=r*R,l+=r*z,u+=r*B,d+=r*V,f+=r*H,p+=r*U,m+=r*W,h+=r*G,g+=r*K,_+=r*q,v+=r*J,y+=r*ee,b+=r*Y,x+=r*te,r=t[2],s+=r*I,c+=r*L,l+=r*R,u+=r*z,d+=r*B,f+=r*V,p+=r*H,m+=r*U,h+=r*W,g+=r*G,_+=r*K,v+=r*q,y+=r*J,b+=r*ee,x+=r*Y,S+=r*te,r=t[3],c+=r*I,l+=r*L,u+=r*R,d+=r*z,f+=r*B,p+=r*V,m+=r*H,h+=r*U,g+=r*W,_+=r*G,v+=r*K,y+=r*q,b+=r*J,x+=r*ee,S+=r*Y,C+=r*te,r=t[4],l+=r*I,u+=r*L,d+=r*R,f+=r*z,p+=r*B,m+=r*V,h+=r*H,g+=r*U,_+=r*W,v+=r*G,y+=r*K,b+=r*q,x+=r*J,S+=r*ee,C+=r*Y,w+=r*te,r=t[5],u+=r*I,d+=r*L,f+=r*R,p+=r*z,m+=r*B,h+=r*V,g+=r*H,_+=r*U,v+=r*W,y+=r*G,b+=r*K,x+=r*q,S+=r*J,C+=r*ee,w+=r*Y,T+=r*te,r=t[6],d+=r*I,f+=r*L,p+=r*R,m+=r*z,h+=r*B,g+=r*V,_+=r*H,v+=r*U,y+=r*W,b+=r*G,x+=r*K,S+=r*q,C+=r*J,w+=r*ee,T+=r*Y,E+=r*te,r=t[7],f+=r*I,p+=r*L,m+=r*R,h+=r*z,g+=r*B,_+=r*V,v+=r*H,y+=r*U,b+=r*W,x+=r*G,S+=r*K,C+=r*q,w+=r*J,T+=r*ee,E+=r*Y,D+=r*te,r=t[8],p+=r*I,m+=r*L,h+=r*R,g+=r*z,_+=r*B,v+=r*V,y+=r*H,b+=r*U,x+=r*W,S+=r*G,C+=r*K,w+=r*q,T+=r*J,E+=r*ee,D+=r*Y,O+=r*te,r=t[9],m+=r*I,h+=r*L,g+=r*R,_+=r*z,v+=r*B,y+=r*V,b+=r*H,x+=r*U,S+=r*W,C+=r*G,w+=r*K,T+=r*q,E+=r*J,D+=r*ee,O+=r*Y,k+=r*te,r=t[10],h+=r*I,g+=r*L,_+=r*R,v+=r*z,y+=r*B,b+=r*V,x+=r*H,S+=r*U,C+=r*W,w+=r*G,T+=r*K,E+=r*q,D+=r*J,O+=r*ee,k+=r*Y,A+=r*te,r=t[11],g+=r*I,_+=r*L,v+=r*R,y+=r*z,b+=r*B,x+=r*V,S+=r*H,C+=r*U,w+=r*W,T+=r*G,E+=r*K,D+=r*q,O+=r*J,k+=r*ee,A+=r*Y,j+=r*te,r=t[12],_+=r*I,v+=r*L,y+=r*R,b+=r*z,x+=r*B,S+=r*V,C+=r*H,w+=r*U,T+=r*W,E+=r*G,D+=r*K,O+=r*q,k+=r*J,A+=r*ee,j+=r*Y,M+=r*te,r=t[13],v+=r*I,y+=r*L,b+=r*R,x+=r*z,S+=r*B,C+=r*V,w+=r*H,T+=r*U,E+=r*W,D+=r*G,O+=r*K,k+=r*q,A+=r*J,j+=r*ee,M+=r*Y,N+=r*te,r=t[14],y+=r*I,b+=r*L,x+=r*R,S+=r*z,C+=r*B,w+=r*V,T+=r*H,E+=r*U,D+=r*W,O+=r*G,k+=r*K,A+=r*q,j+=r*J,M+=r*ee,N+=r*Y,P+=r*te,r=t[15],b+=r*I,x+=r*L,S+=r*R,C+=r*z,w+=r*B,T+=r*V,E+=r*H,D+=r*U,O+=r*W,k+=r*G,A+=r*K,j+=r*q,M+=r*J,N+=r*ee,P+=r*Y,F+=r*te,a+=38*x,o+=38*S,s+=38*C,c+=38*w,l+=38*T,u+=38*E,d+=38*D,f+=38*O,p+=38*k,m+=38*A,h+=38*j,g+=38*M,_+=38*N,v+=38*P,y+=38*F,i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),e[0]=a,e[1]=o,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=m,e[10]=h,e[11]=g,e[12]=_,e[13]=v,e[14]=y,e[15]=b}function U(e,t){H(e,t,t)}function W(e,t){var r=n(),i;for(i=0;i<16;i++)r[i]=t[i];for(i=253;i>=0;i--)U(r,r),i!==2&&i!==4&&H(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function G(e,t){var r=n(),i;for(i=0;i<16;i++)r[i]=t[i];for(i=250;i>=0;i--)U(r,r),i!==1&&H(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function K(e,t,r){var i=new Uint8Array(32),a=new Float64Array(80),o,s,c=n(),u=n(),d=n(),f=n(),p=n(),m=n();for(s=0;s<31;s++)i[s]=t[s];for(i[31]=t[31]&127|64,i[0]&=248,z(a,r),s=0;s<16;s++)u[s]=a[s],f[s]=c[s]=d[s]=0;for(c[0]=f[0]=1,s=254;s>=0;--s)o=i[s>>>3]>>>(s&7)&1,F(c,u,o),F(d,f,o),B(p,c,d),V(c,c,d),B(d,u,f),V(u,u,f),U(f,p),U(m,c),H(c,d,c),H(d,u,p),B(p,c,d),V(c,c,d),U(u,c),V(d,f,m),H(c,d,l),B(c,c,f),H(d,d,c),H(c,f,m),H(f,u,a),U(u,p),F(c,u,o),F(d,f,o);for(s=0;s<16;s++)a[s+16]=c[s],a[s+32]=d[s],a[s+48]=u[s],a[s+64]=f[s];var h=a.subarray(32),g=a.subarray(16);return W(h,h),H(g,g,h),I(e,g),0}function q(e,t){return K(e,t,o)}function J(e,t){return r(t,32),q(e,t)}function ee(e,t,n){var r=new Uint8Array(32);return K(r,n,t),S(e,i,r,C)}var Y=j,te=M;function ne(e,t,n,r,i,a){var o=new Uint8Array(32);return ee(o,i,a),Y(e,t,n,r,o)}function re(e,t,n,r,i,a){var o=new Uint8Array(32);return ee(o,i,a),te(e,t,n,r,o)}var ie=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ae(e,t,n,r){for(var i=new Int32Array(16),a=new Int32Array(16),o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=e[0],N=e[1],P=e[2],F=e[3],I=e[4],L=e[5],R=e[6],z=e[7],B=t[0],V=t[1],H=t[2],U=t[3],W=t[4],G=t[5],K=t[6],q=t[7],J=0;r>=128;){for(w=0;w<16;w++)T=8*w+J,i[w]=n[T+0]<<24|n[T+1]<<16|n[T+2]<<8|n[T+3],a[w]=n[T+4]<<24|n[T+5]<<16|n[T+6]<<8|n[T+7];for(w=0;w<80;w++)if(o=M,s=N,c=P,l=F,u=I,d=L,f=R,p=z,m=B,h=V,g=H,_=U,v=W,y=G,b=K,x=q,E=z,D=q,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(I>>>14|W<<18)^(I>>>18|W<<14)^(W>>>9|I<<23),D=(W>>>14|I<<18)^(W>>>18|I<<14)^(I>>>9|W<<23),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=I&L^~I&R,D=W&G^~W&K,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=ie[w*2],D=ie[w*2+1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=i[w%16],D=a[w%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,S=A&65535|j<<16,C=O&65535|k<<16,E=S,D=C,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(M>>>28|B<<4)^(B>>>2|M<<30)^(B>>>7|M<<25),D=(B>>>28|M<<4)^(M>>>2|B<<30)^(M>>>7|B<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=M&N^M&P^N&P,D=B&V^B&H^V&H,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,p=A&65535|j<<16,x=O&65535|k<<16,E=l,D=_,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=S,D=C,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,l=A&65535|j<<16,_=O&65535|k<<16,N=o,P=s,F=c,I=l,L=u,R=d,z=f,M=p,V=m,H=h,U=g,W=_,G=v,K=y,q=b,B=x,w%16==15)for(T=0;T<16;T++)E=i[T],D=a[T],O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=i[(T+9)%16],D=a[(T+9)%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+1)%16],C=a[(T+1)%16],E=(S>>>1|C<<31)^(S>>>8|C<<24)^S>>>7,D=(C>>>1|S<<31)^(C>>>8|S<<24)^(C>>>7|S<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+14)%16],C=a[(T+14)%16],E=(S>>>19|C<<13)^(C>>>29|S<<3)^S>>>6,D=(C>>>19|S<<13)^(S>>>29|C<<3)^(C>>>6|S<<26),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,i[T]=A&65535|j<<16,a[T]=O&65535|k<<16;E=M,D=B,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[0],D=t[0],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[0]=M=A&65535|j<<16,t[0]=B=O&65535|k<<16,E=N,D=V,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[1],D=t[1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[1]=N=A&65535|j<<16,t[1]=V=O&65535|k<<16,E=P,D=H,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[2],D=t[2],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[2]=P=A&65535|j<<16,t[2]=H=O&65535|k<<16,E=F,D=U,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[3],D=t[3],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[3]=F=A&65535|j<<16,t[3]=U=O&65535|k<<16,E=I,D=W,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[4],D=t[4],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[4]=I=A&65535|j<<16,t[4]=W=O&65535|k<<16,E=L,D=G,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[5],D=t[5],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[5]=L=A&65535|j<<16,t[5]=G=O&65535|k<<16,E=R,D=K,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[6],D=t[6],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[6]=R=A&65535|j<<16,t[6]=K=O&65535|k<<16,E=z,D=q,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[7],D=t[7],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[7]=z=A&65535|j<<16,t[7]=q=O&65535|k<<16,J+=128,r-=128}return r}function oe(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),a=new Uint8Array(256),o,s=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,ae(r,i,t,n),n%=128,o=0;o<n;o++)a[o]=t[s-n+o];for(a[n]=128,n=256-128*(n<112),a[n-9]=0,h(a,n-8,s/536870912|0,s<<3),ae(r,i,a,n),o=0;o<8;o++)h(e,8*o,r[o],i[o]);return 0}function se(e,t){var r=n(),i=n(),a=n(),o=n(),s=n(),c=n(),l=n(),u=n(),f=n();V(r,e[1],e[0]),V(f,t[1],t[0]),H(r,r,f),B(i,e[0],e[1]),B(f,t[0],t[1]),H(i,i,f),H(a,e[3],t[3]),H(a,a,d),H(o,e[2],t[2]),B(o,o,o),V(s,i,r),V(c,o,a),B(l,o,a),B(u,i,r),H(e[0],s,c),H(e[1],u,l),H(e[2],l,c),H(e[3],s,u)}function ce(e,t,n){var r;for(r=0;r<4;r++)F(e[r],t[r],n)}function le(e,t){var r=n(),i=n(),a=n();W(a,t[2]),H(r,t[0],a),H(i,t[1],a),I(e,i),e[31]^=R(r)<<7}function ue(e,t,n){var r,i;for(N(e[0],s),N(e[1],c),N(e[2],c),N(e[3],s),i=255;i>=0;--i)r=n[i/8|0]>>(i&7)&1,ce(e,t,r),se(t,e),se(e,e),ce(e,t,r)}function de(e,t){var r=[n(),n(),n(),n()];N(r[0],f),N(r[1],p),N(r[2],c),H(r[3],f,p),ue(e,r,t)}function fe(e,t,i){var a=new Uint8Array(64),o=[n(),n(),n(),n()],s;for(i||r(t,32),oe(a,t,32),a[0]&=248,a[31]&=127,a[31]|=64,de(o,a),le(e,o),s=0;s<32;s++)t[s+32]=e[s];return 0}var pe=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function me(e,t){var n,r,i,a;for(r=63;r>=32;--r){for(n=0,i=r-32,a=r-12;i<a;++i)t[i]+=n-16*t[r]*pe[i-(r-32)],n=Math.floor((t[i]+128)/256),t[i]-=n*256;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*pe[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*pe[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function he(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;me(e,t)}function ge(e,t,r,i){var a=new Uint8Array(64),o=new Uint8Array(64),s=new Uint8Array(64),c,l,u=new Float64Array(64),d=[n(),n(),n(),n()];oe(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=r+64;for(c=0;c<r;c++)e[64+c]=t[c];for(c=0;c<32;c++)e[32+c]=a[32+c];for(oe(s,e.subarray(32),r+32),he(s),de(d,s),le(e,d),c=32;c<64;c++)e[c]=i[c];for(oe(o,e,r+64),he(o),c=0;c<64;c++)u[c]=0;for(c=0;c<32;c++)u[c]=s[c];for(c=0;c<32;c++)for(l=0;l<32;l++)u[c+l]+=o[c]*a[l];return me(e.subarray(32),u),f}function _e(e,t){var r=n(),i=n(),a=n(),o=n(),l=n(),d=n(),f=n();return N(e[2],c),z(e[1],t),U(a,e[1]),H(o,a,u),V(a,a,e[2]),B(o,e[2],o),U(l,o),U(d,l),H(f,d,l),H(r,f,a),H(r,r,o),G(r,r),H(r,r,a),H(r,r,o),H(r,r,o),H(e[0],r,o),U(i,e[0]),H(i,i,o),L(i,a)&&H(e[0],e[0],m),U(i,e[0]),H(i,i,o),L(i,a)?-1:(R(e[0])===t[31]>>7&&V(e[0],s,e[0]),H(e[3],e[0],e[1]),0)}function ve(e,t,r,i){var a,o=new Uint8Array(32),s=new Uint8Array(64),c=[n(),n(),n(),n()],l=[n(),n(),n(),n()];if(r<64||_e(l,i))return-1;for(a=0;a<r;a++)e[a]=t[a];for(a=0;a<32;a++)e[a+32]=i[a];if(oe(s,e,r),he(s),ue(c,l,s),de(l,t.subarray(32)),se(c,l),le(o,c),r-=64,v(t,0,o,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=t[a+64];return r}var ye=32,be=24,xe=32,Se=16,Ce=32,we=32,Te=32,Ee=32,De=32,Oe=be,ke=xe,Ae=Se,je=64,Me=32,Ne=64,Pe=32,Fe=64;e.lowlevel={crypto_core_hsalsa20:S,crypto_stream_xor:D,crypto_stream:E,crypto_stream_salsa20_xor:w,crypto_stream_salsa20:T,crypto_onetimeauth:k,crypto_onetimeauth_verify:A,crypto_verify_16:_,crypto_verify_32:v,crypto_secretbox:j,crypto_secretbox_open:M,crypto_scalarmult:K,crypto_scalarmult_base:q,crypto_box_beforenm:ee,crypto_box_afternm:Y,crypto_box:ne,crypto_box_open:re,crypto_box_keypair:J,crypto_hash:oe,crypto_sign:ge,crypto_sign_keypair:fe,crypto_sign_open:ve,crypto_secretbox_KEYBYTES:ye,crypto_secretbox_NONCEBYTES:be,crypto_secretbox_ZEROBYTES:xe,crypto_secretbox_BOXZEROBYTES:Se,crypto_scalarmult_BYTES:Ce,crypto_scalarmult_SCALARBYTES:we,crypto_box_PUBLICKEYBYTES:Te,crypto_box_SECRETKEYBYTES:Ee,crypto_box_BEFORENMBYTES:De,crypto_box_NONCEBYTES:Oe,crypto_box_ZEROBYTES:ke,crypto_box_BOXZEROBYTES:Ae,crypto_sign_BYTES:je,crypto_sign_PUBLICKEYBYTES:Me,crypto_sign_SECRETKEYBYTES:Ne,crypto_sign_SEEDBYTES:Pe,crypto_hash_BYTES:Fe,gf:n,D:u,L:pe,pack25519:I,unpack25519:z,M:H,A:B,S:U,Z:V,pow2523:G,add:se,set25519:N,modL:me,scalarmult:ue,scalarbase:de};function Ie(e,t){if(e.length!==ye)throw Error(`bad key size`);if(t.length!==be)throw Error(`bad nonce size`)}function Le(e,t){if(e.length!==Te)throw Error(`bad public key size`);if(t.length!==Ee)throw Error(`bad secret key size`)}function Re(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw TypeError(`unexpected type, use Uint8Array`)}function ze(e){for(var t=0;t<e.length;t++)e[t]=0}e.randomBytes=function(e){var t=new Uint8Array(e);return r(t,e),t},e.secretbox=function(e,t,n){Re(e,t,n),Ie(n,t);for(var r=new Uint8Array(xe+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+xe]=e[a];return j(i,r,r.length,t,n),i.subarray(Se)},e.secretbox.open=function(e,t,n){Re(e,t,n),Ie(n,t);for(var r=new Uint8Array(Se+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+Se]=e[a];return r.length<32||M(i,r,r.length,t,n)!==0?null:i.subarray(xe)},e.secretbox.keyLength=ye,e.secretbox.nonceLength=be,e.secretbox.overheadLength=Se,e.scalarMult=function(e,t){if(Re(e,t),e.length!==we)throw Error(`bad n size`);if(t.length!==Ce)throw Error(`bad p size`);var n=new Uint8Array(Ce);return K(n,e,t),n},e.scalarMult.base=function(e){if(Re(e),e.length!==we)throw Error(`bad n size`);var t=new Uint8Array(Ce);return q(t,e),t},e.scalarMult.scalarLength=we,e.scalarMult.groupElementLength=Ce,e.box=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox(t,n,a)},e.box.before=function(e,t){Re(e,t),Le(e,t);var n=new Uint8Array(De);return ee(n,e,t),n},e.box.after=e.secretbox,e.box.open=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox.open(t,n,a)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(Te),t=new Uint8Array(Ee);return J(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(Re(e),e.length!==Ee)throw Error(`bad secret key size`);var t=new Uint8Array(Te);return q(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=Te,e.box.secretKeyLength=Ee,e.box.sharedKeyLength=De,e.box.nonceLength=Oe,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(Re(e,t),t.length!==Ne)throw Error(`bad secret key size`);var n=new Uint8Array(je+e.length);return ge(n,e,e.length,t),n},e.sign.open=function(e,t){if(Re(e,t),t.length!==Me)throw Error(`bad public key size`);var n=new Uint8Array(e.length),r=ve(n,e,e.length,t);if(r<0)return null;for(var i=new Uint8Array(r),a=0;a<i.length;a++)i[a]=n[a];return i},e.sign.detached=function(t,n){for(var r=e.sign(t,n),i=new Uint8Array(je),a=0;a<i.length;a++)i[a]=r[a];return i},e.sign.detached.verify=function(e,t,n){if(Re(e,t,n),t.length!==je)throw Error(`bad signature size`);if(n.length!==Me)throw Error(`bad public key size`);var r=new Uint8Array(je+e.length),i=new Uint8Array(je+e.length),a;for(a=0;a<je;a++)r[a]=t[a];for(a=0;a<e.length;a++)r[a+je]=e[a];return ve(i,r,r.length,n)>=0},e.sign.keyPair=function(){var e=new Uint8Array(Me),t=new Uint8Array(Ne);return fe(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Re(e),e.length!==Ne)throw Error(`bad secret key size`);for(var t=new Uint8Array(Me),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(Re(e),e.length!==Pe)throw Error(`bad seed size`);for(var t=new Uint8Array(Me),n=new Uint8Array(Ne),r=0;r<32;r++)n[r]=e[r];return fe(t,n,!0),{publicKey:t,secretKey:n}},e.sign.publicKeyLength=Me,e.sign.secretKeyLength=Ne,e.sign.seedLength=Pe,e.sign.signatureLength=je,e.hash=function(e){Re(e);var t=new Uint8Array(Fe);return oe(t,e,e.length),t},e.hash.hashLength=Fe,e.verify=function(e,t){return Re(e,t),e.length===0||t.length===0||e.length!==t.length?!1:g(e,0,t,0,e.length)===0},e.setPRNG=function(e){r=e},(function(){var n=typeof self<`u`?self.crypto||self.msCrypto:null;if(n&&n.getRandomValues){var r=65536;e.setPRNG(function(e,t){var i,a=new Uint8Array(t);for(i=0;i<t;i+=r)n.getRandomValues(a.subarray(i,i+Math.min(t-i,r)));for(i=0;i<t;i++)e[i]=a[i];ze(a)})}else t!==void 0&&(n=a(),n&&n.randomBytes&&e.setPRNG(function(e,t){var r,i=n.randomBytes(t);for(r=0;r<t;r++)e[r]=i[r];ze(i)}))})()})(n!==void 0&&n.exports?n.exports:self.nacl=self.nacl||{})}))(),1),s=class extends Error{constructor(e){super(e),this.name=`PairCryptoError`}},c=1,l=12,u=32,d=new TextEncoder,f=new TextDecoder;function p(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function m(){return o.default.randomBytes(u)}function h(e,t){let n=o.default.box.keyPair(),r=o.default.randomBytes(o.default.box.nonceLength),i=o.default.box(e,r,t,n.secretKey);return{ephPublicKey:n.publicKey,nonce:r,boxed:i}}async function g(e){if(e.length!==u)throw new s(`contentKey must be ${u} bytes`);return crypto.subtle.importKey(`raw`,p(e),`AES-GCM`,!1,[`encrypt`,`decrypt`])}async function _(e,t,n=crypto.getRandomValues(new Uint8Array(l))){let r=await g(e);if(n.length!==l)throw new s(`nonce must be 12 bytes`);let i=d.encode(JSON.stringify(t)),a=new Uint8Array(await crypto.subtle.encrypt({name:`AES-GCM`,iv:p(n)},r,p(i))),o=new Uint8Array(13+a.length);return o[0]=c,o.set(n,1),o.set(a,13),o}async function v(e,t){if(t.length<29)throw new s(`frame too short`);if(t[0]!==c)throw new s(`unsupported frame version ${t[0]}`);let n=t.subarray(1,13),r=t.subarray(13),i=await g(e),a;try{a=await crypto.subtle.decrypt({name:`AES-GCM`,iv:p(n)},i,p(r))}catch{throw new s(`decrypt failed: wrong key or tampered frame`)}try{return JSON.parse(f.decode(new Uint8Array(a)))}catch{throw new s(`decrypt ok but payload is not valid JSON`)}}function y(){return typeof RTCPeerConnection>`u`?null:e=>b(e)}function b(e){let t=new RTCPeerConnection({iceServers:e,iceTransportPolicy:`all`}),n=null,r=!1,i=!1,a=!1,o=[],s=[],c=[],l=[],u=[],d=()=>{if(!(r||i)){i=!0;for(let e of u)e()}},f=e=>{n=e,e.binaryType=`arraybuffer`,e.onopen=()=>{if(!r)for(let e of c)e()},e.onmessage=e=>{if(r)return;let t=e.data,n=typeof t==`string`?new TextEncoder().encode(t):new Uint8Array(t);for(let e of l)e(n)},e.onclose=d,e.onerror=d};t.onicecandidate=e=>{if(!(r||!e.candidate?.candidate))for(let t of s)t({candidate:e.candidate.candidate,sdpMid:e.candidate.sdpMid})},t.onconnectionstatechange=()=>{let e=t.connectionState;(e===`disconnected`||e===`failed`||e===`closed`)&&d()},t.ondatachannel=e=>{r||f(e.channel)};let p=async()=>{a=!0;for(let e of o.splice(0))try{await t.addIceCandidate(e)}catch{}};return{async createOffer(){f(t.createDataChannel(`pair`,{ordered:!0}));let e=await t.createOffer();return await t.setLocalDescription(e),e.sdp??``},async acceptOffer(e){await t.setRemoteDescription({type:`offer`,sdp:e});let n=await t.createAnswer();return await t.setLocalDescription(n),await p(),n.sdp??``},async acceptAnswer(e){await t.setRemoteDescription({type:`answer`,sdp:e}),await p()},async addIceCandidate(e){if(!a){o.push(e);return}await t.addIceCandidate(e)},onIceCandidate(e){return s.push(e),()=>void s.splice(s.indexOf(e),1)},onOpen(e){return c.push(e),()=>void c.splice(c.indexOf(e),1)},onMessage(e){return l.push(e),()=>void l.splice(l.indexOf(e),1)},onClose(e){return u.push(e),()=>void u.splice(u.indexOf(e),1)},send(e){if(r||n?.readyState!==`open`||n.bufferedAmount>1048576)return!1;try{return n.send(e.slice().buffer),!0}catch{return!1}},buffered:()=>n&&!r?n.bufferedAmount:0,close(){if(!r){r=!0;try{n?.close()}catch{}try{t.close()}catch{}}}}}var x=16384,S=0,C=1;function w(e){let t=[],n=0;do{let r=Math.min(e.byteLength,n+x),i=new Uint8Array(1+r-n);i[0]=r>=e.byteLength?C:S,i.set(e.subarray(n,r),1),t.push(i),n=r}while(n<e.byteLength);return t}function T(){let e=[],t=0,n=!1,r=()=>{e=[],t=0};return{push(i){let a=i[0];if(a!==S&&a!==C)return r(),n=!1,null;if(n)return a===C&&(n=!1),null;let o=i.subarray(1);if(t+=o.byteLength,t>1048576)return r(),n=a===S,null;if(e.push(o),a===S)return null;let s=new Uint8Array(t),c=0;for(let t of e)s.set(t,c),c+=t.byteLength;return r(),s}}}var E=15e3;function D(e){return{role:e,phase:`idle`,gen:0,attempt:0,capable:!1,peerOnline:!1,preferRelay:!1}}var O=e=>({state:e,actions:[]});function k(e){if(e.phase===`idle`||e.phase===`cooldown`)return[];let t=[{type:`destroy-peer`}];return e.phase===`connected`&&t.push({type:`switch`,transport:`relay`},{type:`resync`}),t}function A(e){let t=e.gen+1;return{state:{...e,phase:`negotiating`,gen:t},actions:[{type:`create-offer`,gen:t},{type:`start-timeout`,gen:t}]}}function j(e,t){if(e.preferRelay)return{state:{...e,phase:`idle`},actions:t};if(e.capable&&e.peerOnline){let n=A(e);return{state:n.state,actions:[...t,...n.actions]}}return{state:{...e,phase:`idle`},actions:t}}function M(e,t){let n=t=>t===e.gen;switch(t.type){case`peer-capable`:{if(!t.capable)return{state:{...e,capable:!1,preferRelay:!1,phase:`idle`},actions:k(e)};let n={...e,capable:!0};return e.phase===`idle`?j(n,[]):O(n)}case`peer-online`:{let n={...e,peerOnline:t.online};return t.online&&e.phase===`idle`?j(n,[]):O(n)}case`answer`:return e.phase===`negotiating`&&n(t.gen)?{state:e,actions:[{type:`apply-answer`,gen:t.gen}]}:O(e);case`ice`:return(e.phase===`negotiating`||e.phase===`connected`)&&n(t.gen)?{state:e,actions:[{type:`apply-ice`,gen:t.gen}]}:O(e);case`dc-open`:return e.phase===`negotiating`&&n(t.gen)?{state:{...e,phase:`connected`,attempt:0},actions:[{type:`switch`,transport:`direct`},{type:`resync`}]}:O(e);case`negotiate-timeout`:{if(e.phase!==`negotiating`||!n(t.gen))return O(e);let r=e.attempt+1;return{state:{...e,phase:`cooldown`,attempt:r},actions:[{type:`send-close`,gen:t.gen},{type:`destroy-peer`},{type:`schedule-retry`,attempt:r}]}}case`dc-close`:{if(!n(t.gen))return O(e);let r=e.attempt+1;return e.phase===`connected`?{state:{...e,phase:`cooldown`,attempt:r},actions:[...k(e),{type:`schedule-retry`,attempt:r}]}:e.phase===`negotiating`?{state:{...e,phase:`cooldown`,attempt:r},actions:[{type:`send-close`,gen:t.gen},{type:`destroy-peer`},{type:`schedule-retry`,attempt:r}]}:O(e)}case`cooldown-elapsed`:return e.phase===`cooldown`?j(e,[]):O(e);case`network-change`:{let t=e.phase===`negotiating`||e.phase===`connected`?[{type:`send-close`,gen:e.gen},...k(e)]:[];return j({...e,attempt:0,preferRelay:!1},t)}case`peer-gone`:{let t=k(e).filter(e=>e.type!==`resync`);return{state:{...e,phase:`idle`,attempt:0,capable:!1,peerOnline:!1,preferRelay:!1},actions:t}}case`prefer-relay`:return e.phase===`idle`||e.phase===`cooldown`?{state:{...e,preferRelay:!0,phase:`idle`},actions:[]}:{state:{...e,phase:`idle`,preferRelay:!0,attempt:0},actions:[{type:`send-close`,gen:e.gen},...k(e)]};default:return O(e)}}function N(e,t){let n=t=>t===e.gen,r=()=>({state:{...e,phase:`idle`},actions:k(e)});switch(t.type){case`peer-online`:return O({...e,peerOnline:t.online});case`offer`:{let n=t.gen===1&&e.gen===1&&e.phase===`negotiating`;return!(t.gen===1&&e.gen>=1&&!n)&&t.gen<=e.gen?O(e):{state:{...e,phase:`negotiating`,gen:t.gen},actions:[...k(e),{type:`accept-offer`,gen:t.gen},{type:`start-timeout`,gen:t.gen}]}}case`ice`:return(e.phase===`negotiating`||e.phase===`connected`)&&n(t.gen)?{state:e,actions:[{type:`apply-ice`,gen:t.gen}]}:O(e);case`dc-open`:return e.phase===`negotiating`&&n(t.gen)?{state:{...e,phase:`connected`},actions:[{type:`switch`,transport:`direct`},{type:`resync`}]}:O(e);case`dc-close`:case`negotiate-timeout`:case`remote-close`:return n(t.gen)&&e.phase!==`idle`?r():O(e);case`network-change`:return r();case`peer-gone`:return{state:{...e,phase:`idle`,peerOnline:!1},actions:k(e)};default:return O(e)}}function P(e,t){return e.role===`guest`?M(e,t):N(e,t)}function F(e,t=Math.random){let n=Math.min(3e5,1e3*2**Math.max(0,e));return Math.round(n*(.7+t()*.6))}function I(e){return e.startsWith(`a=`)?e.slice(2):e}function L(e){let t=/\styp\s+(\S+)/.exec(I(e))?.[1];return t===`host`||t===`srflx`}function R(e){let t=I(e).split(/\s+/),n=t.indexOf(`typ`);if(n<5||!t[n+1])return null;let r=t.indexOf(`raddr`),i=t.indexOf(`rport`);return{typ:t[n+1],address:t[4],port:t[5],base:r>0&&i>0?`${t[r+1]}:${t[i+1]}`:null}}function z(e){let t=new Map;for(let n of e){let e=R(n);if(e?.typ!==`srflx`||!e.base)continue;let r=t.get(e.base)??new Set;r.add(`${e.address}:${e.port}`),t.set(e.base,r)}if(t.size===0)return`none`;for(let e of t.values())if(e.size>1)return`symmetric`;return`cone`}function B(e){let t=new Map,n=!1;for(let r of e){let e=R(r);e&&(t.set(e.typ,(t.get(e.typ)??0)+1),e.address.includes(`:`)&&(n=!0))}if(t.size===0)return`none`;let r=[...t].map(([e,t])=>`${e}×${t}`);return n&&r.push(`v6`),r.push(`nat=${z(e)}`),r.join(` `)}var V=40,H=1.25,U=1e3;function W(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<0||t<0?!1:e>=t+V&&e>=t*H}var G=2,K=3,q=25e3,J=1e4,ee=class{deps;state;peer=null;peerGen=0;dcOpen=!1;iceServers;reassembler=T();negotiateTimer=null;retryTimer=null;heartbeatTimer=null;heartbeatDeadline=null;pingSentAt=null;closed=!1;qualityGen=null;qualityTimer=null;lastDirectRtt=null;lastRelayRtt=null;constructor(e){this.deps=e,this.state=D(e.role),this.iceServers=e.iceServers??[]}hostInfo(e){e.iceServers&&(this.iceServers=e.iceServers);let t=this.deps.factory!==null&&(e.capabilities??[]).includes(`direct-v1`);this.dispatch({type:`peer-capable`,capable:t})}peerOnline(e){this.dispatch({type:`peer-online`,online:e})}handleSignal(e){switch(e.type){case`direct-offer`:this.pendingOffer=e.sdp,this.dispatch({type:`offer`,gen:e.gen});break;case`direct-answer`:this.pendingAnswer=e.sdp,this.dispatch({type:`answer`,gen:e.gen});break;case`direct-ice`:e.gen===this.state.gen&&this.remoteCandidates.push(e.candidate),this.pendingIce={candidate:e.candidate,sdpMid:e.sdpMid},this.dispatch({type:`ice`,gen:e.gen});break;case`direct-close`:this.dispatch({type:`remote-close`,gen:e.gen})}}networkChange(){this.dispatch({type:`network-change`})}noteRelayRtt(e){!Number.isFinite(e)||e<0||(this.lastRelayRtt=e,this.maybeFinishQuality())}peerGone(){this.dispatch({type:`peer-gone`})}close(){this.closed||(this.dispatch({type:`peer-gone`}),this.closed=!0,this.clearRetry(),this.destroyPeer())}transport(){return this.state.phase===`connected`&&this.dcOpen?`direct`:`relay`}send(e){if(this.transport()!==`direct`||!this.peer||(this.peer.buffered?.()??0)+e.byteLength>1048576)return!1;let t=w(e);for(let e=0;e<t.length;e++)if(!this.peer.send(t[e]))return e>0&&this.failGen(this.peerGen),!1;return!0}pendingOffer=``;pendingAnswer=``;pendingIce=null;localCandidates=[];remoteCandidates=[];dispatch(e){if(this.closed)return;let t=this.state,{state:n,actions:r}=P(this.state,e);this.state=n,this.diagnose(t,e);for(let e of r)this.run(e)}diagnose(e,t){if(!this.deps.onDiagnostic||e.phase!==`negotiating`)return;let n=this.state.phase===`connected`?`open`:t.type===`negotiate-timeout`||t.type===`dc-close`?`failed`:null;n&&this.deps.onDiagnostic(`direct ${n} gen=${e.gen} local[${B(this.localCandidates)}] remote[${B(this.remoteCandidates)}]`)}run(e){switch(e.type){case`create-offer`:this.spawnPeer(e.gen,t=>t.createOffer().then(t=>{this.peerGen===e.gen&&!this.closed&&this.deps.sendSignal({type:`direct-offer`,gen:e.gen,sdp:t})}));break;case`accept-offer`:{let t=this.pendingOffer;this.spawnPeer(e.gen,n=>n.acceptOffer(t).then(t=>{this.peerGen===e.gen&&!this.closed&&this.deps.sendSignal({type:`direct-answer`,gen:e.gen,sdp:t})}));break}case`apply-answer`:this.peer?.acceptAnswer(this.pendingAnswer).catch(()=>this.failGen(e.gen));break;case`apply-ice`:this.pendingIce&&this.peer?.addIceCandidate(this.pendingIce).catch(()=>{});break;case`start-timeout`:if(this.clearNegotiateTimer(),!this.peer)break;this.negotiateTimer=setTimeout(()=>{this.negotiateTimer=null,this.dispatch({type:`negotiate-timeout`,gen:e.gen})},E);break;case`destroy-peer`:this.destroyPeer();break;case`send-close`:this.deps.sendSignal({type:`direct-close`,gen:e.gen});break;case`switch`:this.deps.onTransportChange(e.transport);break;case`resync`:this.deps.onResync();break;case`schedule-retry`:this.clearRetry(),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.dispatch({type:`cooldown-elapsed`})},F(e.attempt))}}spawnPeer(e,t){this.destroyPeer();let n=this.deps.factory?.(this.iceServers)??null;if(!n){this.deps.role===`guest`?this.dispatch({type:`peer-capable`,capable:!1}):this.dispatch({type:`dc-close`,gen:e});return}this.peer=n,this.peerGen=e,this.reassembler=T(),this.localCandidates=[],this.remoteCandidates=[],n.onIceCandidate(t=>{this.peerGen===e&&(this.localCandidates.push(t.candidate),L(t.candidate)&&this.deps.sendSignal({type:`direct-ice`,gen:e,candidate:I(t.candidate),sdpMid:t.sdpMid}))}),n.onOpen(()=>{if(this.peerGen===e){if(this.dcOpen=!0,this.clearNegotiateTimer(),this.startHeartbeat(n,e),this.deps.role===`guest`&&this.deps.onNeedRelayProbe){this.beginQuality(e);return}this.dispatch({type:`dc-open`,gen:e})}}),n.onMessage(t=>{if(this.peerGen!==e)return;if(this.alive(),t.byteLength===1&&t[0]===G){n.send(new Uint8Array([K]));return}if(t.byteLength===1&&t[0]===K){if(this.pingSentAt!==null){let e=Date.now()-this.pingSentAt;this.deps.onRtt?.(e),this.lastDirectRtt=e,this.pingSentAt=null,this.maybeFinishQuality()}return}let r=this.reassembler.push(t);r&&this.deps.onFrame(r)}),n.onClose(()=>{this.peerGen===e&&this.dispatch({type:`dc-close`,gen:e})}),t(n).catch(()=>this.failGen(e))}failGen(e){(this.peerGen===e||this.state.gen===e)&&this.dispatch({type:`dc-close`,gen:e})}destroyPeer(){this.clearNegotiateTimer(),this.clearQuality(),this.stopHeartbeat(),this.dcOpen=!1;let e=this.peer;this.peer=null,this.peerGen=-1;try{e?.close()}catch{}}startHeartbeat(e,t){this.stopHeartbeat();let n=()=>{this.peerGen===t&&(this.pingSentAt=Date.now(),e.send(new Uint8Array([G])),this.heartbeatDeadline??=setTimeout(()=>{this.heartbeatDeadline=null,this.peerGen===t&&this.dispatch({type:`dc-close`,gen:t})},J))};n(),this.heartbeatTimer=setInterval(n,q)}alive(){this.heartbeatDeadline&&clearTimeout(this.heartbeatDeadline),this.heartbeatDeadline=null}stopHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=null,this.pingSentAt=null,this.alive()}clearNegotiateTimer(){this.negotiateTimer&&clearTimeout(this.negotiateTimer),this.negotiateTimer=null}clearRetry(){this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=null}beginQuality(e){this.clearQuality(),this.qualityGen=e,this.lastDirectRtt=null,this.lastRelayRtt=null,this.deps.onNeedRelayProbe?.(),this.qualityTimer=setTimeout(()=>this.finishQuality(e),U)}maybeFinishQuality(){this.qualityGen!==null&&this.qualityGen===this.peerGen&&this.lastDirectRtt!==null&&this.lastRelayRtt!==null&&this.finishQuality(this.qualityGen)}finishQuality(e){if(this.qualityGen===e&&(this.clearQuality(),!(this.peerGen!==e||!this.dcOpen))){if(this.lastDirectRtt!==null&&this.lastRelayRtt!==null&&W(this.lastDirectRtt,this.lastRelayRtt)){this.deps.onDiagnostic?.(`direct slower than relay ${Math.round(this.lastDirectRtt)}ms>${Math.round(this.lastRelayRtt)}ms, stay relay`),this.dispatch({type:`prefer-relay`});return}this.dispatch({type:`dc-open`,gen:e})}}clearQuality(){this.qualityTimer&&clearTimeout(this.qualityTimer),this.qualityTimer=null,this.qualityGen=null}};function Y(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function te(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4==0?``:`=`.repeat(4-t.length%4),r=atob(t+n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i}function ne(e){let t=e.trim(),n=/^enso:\/\/pair\?(.*)$/.exec(t);if(n)return re(new URLSearchParams(n[1]));if(/^https?:\/\//i.test(t)){let e=new URL(t);return re(new URLSearchParams(e.hash.replace(/^#/,``)||e.search),e.origin)}throw Error(`not an enso pair uri`)}function re(e,t){let n=e.get(`relay`)??t,r=e.get(`pk`);if(!n||!r)throw Error(`pair uri missing relay or pk`);return{relay:n,publicKey:te(r)}}function ie(e){return e.trim().replace(/\/+$/,``).replace(/^http/,`ws`)}function ae(e){return e.trim().replace(/\/+$/,``)}function oe(e){if(e<=0)return 0;let t=Math.min(3e4,1e3*2**(e-1));return Math.round(t*(.7+Math.random()*.6))}function se(e){return[Y(e.ephPublicKey),Y(e.nonce),Y(e.boxed)].join(`.`)}async function ce(e,t){let n;for(let r=0;r<2;r++)try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(1e4)}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error??`relay ${n.status}`);return r}catch(e){if(n=e,!(e instanceof TypeError||e?.name===`TimeoutError`))throw e}throw n}async function le(e,t,n){let r=ae(e),i=m(),a=h(i,t),o=await ce(`${r}/v1/pair/claim`,{publicKey:Y(t),boxedKey:se(a),deviceName:n});return{pairId:o.pairId,deviceToken:o.deviceToken,contentKey:i}}async function ue(e,t,n){let r=`${ae(e)}/v1/pair/${encodeURIComponent(t)}?token=${encodeURIComponent(n)}`;await fetch(r,{method:`DELETE`})}var de=15e3,fe=8e3;function pe(e,t,n){let r=null,i=null,a=()=>{r&&clearTimeout(r),r=null},o=(n=fe)=>{if(e.readyState===1){i=Date.now();try{e.send(`ping`)}catch{}r&&clearTimeout(r),r=setTimeout(t,n)}},s=e=>{a(),e.data===`pong`&&i!==null&&(n?.(Date.now()-i),i=null)};e.addEventListener(`message`,s);let c=()=>o();e.addEventListener(`open`,c),e.readyState===1&&o();let l=setInterval(o,de);return{probe:o,stop(){clearInterval(l),a(),i=null,e.removeEventListener(`message`,s),e.removeEventListener(`open`,c)}}}var me=24e4,he=1024;function ge(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var _e=ge;function ve(e,t,n=me){let r=JSON.stringify(e);if(r.length<=n)return[e];let i=Math.ceil(r.length/n);if(i>he)throw Error(`remote frame too large: ${r.length} chars`);let a=t();return Array.from({length:i},(e,t)=>({type:`part`,pid:a,index:t,total:i,data:r.slice(t*n,(t+1)*n)}))}function ye(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`part`&&typeof t.pid==`string`&&t.pid.length>0&&t.pid.length<=64&&Number.isInteger(t.index)&&Number.isInteger(t.total)&&t.total>0&&t.total<=he&&t.index>=0&&t.index<t.total&&typeof t.data==`string`&&t.data.length<=24e4}var be=new Set([`rpc-ready`,`rpc-result`,`rpc-event`,`asset`,`gzip`,`part`]);function xe(e){return be.has(e.type)}async function Se(e,t){let n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function Ce(e){try{let t=await Se(ge(e.data),new DecompressionStream(`gzip`));return JSON.parse(new TextDecoder().decode(t))}catch{return null}}function we(e={}){let t=e.ttlMs??12e4,n=e.maxPending??16,r=e.now??Date.now,i=new Map,a=()=>{let e=r();for(let[n,r]of i)e-r.at>t&&i.delete(n)};return{push(e){a();let t=i.get(e.pid);if(t&&t.total!==e.total)return i.delete(e.pid),null;if(!t){if(i.size>=n){let e=i.keys().next().value;e!==void 0&&i.delete(e)}t={total:e.total,parts:Array(e.total),got:0,at:r()},i.set(e.pid,t)}if(t.parts[e.index]===void 0&&(t.parts[e.index]=e.data,t.got++),t.at=r(),t.got<t.total)return null;i.delete(e.pid);try{return JSON.parse(t.parts.join(``))}catch{return null}},clear(){i.clear()}}}function Te(e={}){let t=e.maxHeld??4096,n=new Map,r=0,i=!1;return{push(e,a){if(e===void 0)return[a];if(e<=r||n.has(e))return[];n.set(e,a),n.size>t&&(i=!0);let o=[];for(let e=n.get(r+1);e!==void 0;e=n.get(r+1))n.delete(r+1),r++,o.push(e);return o},get applied(){return r},get gap(){return n.size>0},get overflowed(){return i}}}var Ee=8,De=12,Oe=64;function ke(e){return typeof e==`object`&&!!e&&e.type===`replay-hello`}function Ae(e=_,t=v){let n=Le(Ee),r=0,i=Le(Ee),a=null,o=!1,c=!1,l=null,u=0,d=!1,f=0n;function p(){i=Le(Ee),a=null,o=!1,c=!1,l=null,u=0,d=!1,f=0n}function m(){let e={p:Y(n),c:Y(i)};return a&&(e.e=Y(a)),e}function h(e){if(e<=0||e>4294967295)return!1;if(u===0)return u=e,f=1n,!0;if(e>u){let t=BigInt(e-u);return f=t>=BigInt(Oe)?1n:(f<<t|1n)&(1n<<BigInt(Oe))-1n,u=e,!0}let t=u-e;if(t>=Oe)return!1;let n=1n<<BigInt(t);return f&n?!1:(f|=n,!0)}return{peerReset:p,async seal(t,i){let a=je(i,m());if(!o)return e(t,a);if(r===4294967295)throw new s(`replay counter exhausted`);r+=1;let c=new Uint8Array(De);return c.set(n,0),c[8]=r>>>24,c[9]=r>>>16&255,c[10]=r>>>8&255,c[11]=r&255,e(t,a,c)},async open(e,n){let r=await t(e,n),s=Ne(r);s&&(!a||!Ie(a,s.c))&&(a=s.c,o=!0,d=!0);let p=n.subarray(1,13);if(s?.e&&Ie(s.e,i)&&Ie(p.subarray(0,Ee),s.p))return(!c||!l||!Ie(l,s.p))&&(c=!0,l=s.p,u=0,f=0n),h(Fe(p))?Me(r):void 0;if(!c||l&&Ie(p.subarray(0,Ee),l)&&h(Fe(p)))return Me(r)},takeHello(){return d?(d=!1,!0):!1}}}function je(e,t){return typeof e!=`object`||!e||Array.isArray(e)?e:{...e,replay:t}}function Me(e){if(typeof e!=`object`||!e||!(`replay`in e))return e;let{replay:t,...n}=e;return n}function Ne(e){if(typeof e!=`object`||!e||!(`replay`in e))return null;let t=e.replay;if(typeof t!=`object`||!t)return null;let n=t,r=Pe(n.p),i=Pe(n.c);if(!r||!i)return null;if(n.e===void 0)return{p:r,c:i};let a=Pe(n.e);return a?{p:r,c:i,e:a}:null}function Pe(e){if(typeof e!=`string`)return null;try{let t=te(e);return t.length===Ee?t:null}catch{return null}}function Fe(e){return(e[8]<<24|e[9]<<16|e[10]<<8|e[11])>>>0}function Ie(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Le(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}function Re(e,t,n=null){return!t||n!==null&&n!==1||e===`network-change`||e===`online`}var ze=2e3;function Be(e,t=ze){return e>=t}var Ve=8e3;function He(e,t,n=Ve){return e===0&&t>=n}var Ue=512,We=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ge=e=>typeof e==`string`&&e.length>0&&e.length<=Ue,Ke=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,qe=(e,t)=>Object.keys(e).length===t.length&&Object.keys(e).every(e=>t.includes(e));function Je(e){return We(e)&&qe(e,[`epoch`,`seq`])&&Ge(e.epoch)&&Ke(e.seq)}function Ye(e,t){if(!We(e)||e.type!==`snapshot`||!Array.isArray(e.sessions)||e.sessions.length!==1)return!1;let n=e.sessions[0];return!(!We(n)||n.sessionId!==t||!Array.isArray(n.messages)||!Ke(n.baseIndex)||n.identity!==void 0&&(!We(n.identity)||n.identity.sessionId!==t))}function Xe(e){return!We(e)||e.type!==`session-sync`||!Ge(e.sessionId)||!Ge(e.requestId)||!Je(e.cursor)?null:e.mode===`snapshot`?qe(e,[`type`,`sessionId`,`requestId`,`cursor`,`mode`,`snapshot`])&&Ye(e.snapshot,e.sessionId)?e:null:e.mode!==`replay`||!qe(e,[`type`,`sessionId`,`requestId`,`cursor`,`mode`,`fromSeq`,`events`])||!Ke(e.fromSeq)||!Array.isArray(e.events)||e.fromSeq>e.cursor.seq||e.events.length!==e.cursor.seq-e.fromSeq?null:e.events.every(t=>We(t)&&Ge(t.type)&&t.sessionId===e.sessionId)?e:null}var Ze=192e3;function Qe(e,t=Ze){let n=[];for(let r=0;r<e.length;r+=t){let i=Math.min(e.length,r+t),a=new Uint8Array((i-r)*2),o=new DataView(a.buffer);for(let t=r;t<i;t++){let n=Math.max(-1,Math.min(1,e[t]||0));o.setInt16((t-r)*2,Math.round(n<0?n*32768:n*32767),!0)}n.push(Y(a))}return n}function $e(e,t,n=Date.now()){switch(t.type){case`turn-retry`:{let{attempt:r,maxAttempts:i,delayMs:a,error:o}=t;return typeof r!=`number`||typeof i!=`number`||typeof a!=`number`||typeof o!=`string`||o.length===0?e:{attempt:r,maxAttempts:i,delayMs:a,error:o,at:n}}case`status`:case`turn-completed`:case`turn-failed`:return;default:return e}}function et(e,t){switch(t.type){case`task-started`:{let n=t.task;return!n||typeof n.taskId!=`string`?null:e.tasks.some(e=>e.taskId===n.taskId)?e:{...e,tasks:[...e.tasks,n]}}case`task-output`:{let n=t.taskId;return n?{...e,tasks:e.tasks.map(e=>e.taskId===n?{...e,tail:t.tail,status:t.status}:e)}:null}case`task-ended`:{let n=t.taskId;return n?{...e,tasks:e.tasks.map(e=>e.taskId===n?{...e,status:t.status,exitCode:t.exitCode}:e)}:null}case`background-tasks-level`:return Array.isArray(t.tasks)?{...e,tasks:t.tasks}:null;case`subagent-update`:{let n=t.agent;if(!n||typeof n.id!=`string`)return null;let r=e.subagents.some(e=>e.id===n.id);return{...e,subagents:r?e.subagents.map(e=>e.id===n.id?n:e):[...e.subagents,n]}}default:return null}}function tt(e,t){if(t===void 0)return;let n=0;for(let r of e)r<t&&(n+=1);return n}function nt(){return{messages:new Map,status:`idle`,approvals:[],asks:[],tasks:[],subagents:[]}}var rt=e=>e.size?Math.max(...e.keys()):-1;function it(e,t,n){let r={...e,messages:new Map(e.messages)};r.retry=$e(r.retry,t,n?.now);let i=et({tasks:r.tasks,subagents:r.subagents},t);if(i)return{view:{...r,...i}};switch(t.type){case`message-upsert`:{let e=t.index;return r.messages.set(e,t.message),{view:r,lastIndex:rt(r.messages)}}case`messages-truncated`:{let e=t.length;for(let t of r.messages.keys())t>=e&&r.messages.delete(t);return{view:r,lastIndex:e-1}}case`status`:r.status=t.status;break;case`turn-completed`:r.status=`idle`;break;case`turn-failed`:r.status=`failed`;break;case`approval-request`:{let e=t.request??t;r.approvals=[...r.approvals,e];break}case`approval-resolved`:r.approvals=r.approvals.filter(e=>e.requestId!==t.requestId);break;case`ask-request`:{let e=t.ask??t;r.asks=[...r.asks,e];break}case`ask-resolved`:r.asks=r.asks.filter(e=>e.requestId!==t.requestId);break;case`compaction`:{let e=t.state;r.compaction=e===`queued`?`queued`:e===`start`?`running`:void 0,e===`end`&&!t.error&&!t.abandoned&&(r.compactionNoticeAt=rt(r.messages)+1);break}}return{view:r}}function at(e,t){let n=[];for(let r of t.sessions??[]){let t=r.sessionId??r.identity?.sessionId;if(!t)continue;let i=r.baseIndex??0,a=e.get(t)?.messages,o=a?.size?Math.max(...a.keys()):-1,s=a&&i<=o+1?new Map(a):new Map,c=r.messages??[];for(let e of s.keys())e>=i+c.length&&s.delete(e);for(let[e,t]of c.entries())s.set(i+e,t);n.push({id:t,view:{messages:s,status:r.status??`idle`,approvals:r.pendingApprovals??[],asks:r.pendingAsks??[],tasks:r.backgroundTasks??[],subagents:r.subagents??[],compaction:r.compaction,compactionNoticeAt:r.compactionNoticeAt??e.get(t)?.compactionNoticeAt},lastIndex:i+c.length-1})}return n}function ot(e,t){if(t.messages.length===0)return e;let n=new Map(e.messages);for(let[e,r]of t.messages.entries())n.set(t.baseIndex+e,r);return{...e,messages:n}}function st(e){let t=new Map;for(let[n,r]of e)t.set(n,{...r,status:`failed`,messages:new Map(r.messages)});return t}var ct={"openai-completions":`https://api.openai.com/v1`,"openai-responses":`https://api.openai.com/v1`,"anthropic-messages":`https://api.anthropic.com`,"google-generative-ai":`https://generativelanguage.googleapis.com/v1beta`,ollama:`http://127.0.0.1:11434`,"typesafe-system-one":`https://api.typesafe.ai/v1/`};ct[`google-generative-ai`],ct[`typesafe-system-one`],ct.ollama;var lt=`local-image`,ut=`__ensoRemoteLocalImagePrefix`;function dt(e){let t=globalThis[ut];return typeof t==`string`?`${t}${encodeURIComponent(e)}`:e}var ft=`posix`,pt=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`,`jfif`,`avif`],mt=[`mp4`,`webm`,`ogg`,`ogv`,`mov`];[...pt,...mt];function ht(e){let t=e.split(/[?#]/)[0]??``,n=t.lastIndexOf(`.`);return n<0?``:t.slice(n+1).toLowerCase()}function gt(e){let t=e.replace(/\\/g,`/`);if(t.startsWith(`//`)){let[e,...n]=t.slice(2).split(`/`).filter(Boolean);return dt(`${lt}://${e}/${n.map(encodeURIComponent).join(`/`)}`)}let n=/^([a-zA-Z]):\/(.*)$/.exec(t);if(n){let e=n[2].split(`/`).filter(Boolean).map(encodeURIComponent);return dt(`${lt}://${n[1].toLowerCase()}/${e.join(`/`)}`)}return dt(`${lt}://${ft}/${t.split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`)}`)}new Set(pt);var _t=[`system`,`user`,`tool_result`,`tool_args`,`assistant`,`tools`],vt=class{hits=new Map;blocked=!1;restored=0;add(e,t=1){let n=`${e.kind}\0${e.rule}\0${e.action}\0${e.where}\0${e.token}`,r=this.hits.get(n);r?r.count+=t:this.hits.set(n,{...e,count:t})}get empty(){return this.hits.size===0&&this.restored===0}build(){return{hits:[...this.hits.values()].map(e=>({...e})),blocked:this.blocked,restored:this.restored}}};new Set(_t);function yt(e,t){if(!e)return t;let n=new vt;for(let r of[...e.hits,...t.hits])n.add(r,r.count);return n.blocked=e.blocked||t.blocked,n.restored=e.restored+t.restored,n.build()}function bt(e){let t=new Map;for(let n of e){let e=`${n.action}\0${n.kind}\0${n.where}`,r=t.get(e);r?(r.tokens.add(n.token),r.count+=n.count):t.set(e,{action:n.action,kind:n.kind,where:n.where,values:0,count:n.count,preview:n.preview,tokens:new Set([n.token])})}return[...t.values()].map(({tokens:e,...t})=>({...t,values:e.size}))}var xt={mask:1,warn:2,block:3};function St(e){let t;for(let n of e.hits)(!t||xt[n.action]>xt[t])&&(t=n.action);return t}var Ct={enabled:!1,secrets:{enabled:!0,action:`mask`,shape:!1},personal:{enabled:!1,action:`mask`,kinds:[`email`,`phone`,`idCard`,`bankCard`]},custom:{words:[],rules:[],action:`mask`},allow:[]},wt=15e3;Object.freeze({yieldDefaultMs:45e3,yieldBuildMs:18e4,yieldServerMs:1e4,quietMs:wt,taskWaitMaxMs:3e4,maxTasks:20,logMaxBytes:268435456,killGraceMs:5e3});var Tt=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Et=e=>Number.isInteger(e)&&e>=0,Dt=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function Ot(e){if(!Tt(e)||!Et(e.inputTokens)||!Et(e.outputTokens))return;let t={inputTokens:e.inputTokens,outputTokens:e.outputTokens};for(let n of[`cacheHitPercent`,`ttftAvgMs`,`tokensPerSecond`]){let r=e[n];if(r!==void 0){if(!Dt(r))return;t[n]=r}}return t}var kt=e(i(),1),At=e=>typeof e==`string`&&e.length>0,jt=e=>!!e&&typeof e==`object`&&At(e.data)&&At(e.mimeType);function Mt(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r;if(!At(e.deliveryId)||!At(e.chatId)||typeof e.text!=`string`||typeof e.createdAt!=`number`||t.has(e.deliveryId)||e.images!==void 0&&!(Array.isArray(e.images)&&e.images.every(jt)))continue;t.add(e.deliveryId);let i=e.status===`failed`;n.push({deliveryId:e.deliveryId,chatId:e.chatId,text:e.text,...e.images?{images:e.images}:{},createdAt:e.createdAt,status:i?`failed`:`pending`,...i&&typeof e.error==`string`?{error:e.error}:{}})}return n}var Nt=class{storage;pairId;items=[];listeners=new Set;writing=Promise.resolve();newId;now;durable=new Set;sentAt=new Map;loadFailed=!1;loading;constructor(e,t,n={}){this.storage=e,this.pairId=t,this.newId=n.newId??(()=>crypto.randomUUID()),this.now=n.now??Date.now}async restore(){let e=this.loadExisting();this.loading=e;try{await e}finally{this.loading===e&&(this.loading=void 0)}}async loadExisting(){let e;try{e=Mt(await this.storage.load(this.pairId)),this.loadFailed=!1}catch(e){throw this.loadFailed=!0,e}let t=new Set(this.items.map(e=>e.deliveryId)),n=e.filter(e=>!t.has(e.deliveryId));if(n.length!==0){this.items=[...n,...this.items];for(let e of n)this.durable.add(e.deliveryId);for(let e of this.listeners)e([...this.items])}}list(e){return e?this.items.filter(t=>t.chatId===e):[...this.items]}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}enqueue(e){let t={deliveryId:this.newId(),chatId:e.chatId,text:e.text,...e.images?.length?{images:e.images}:{},createdAt:this.now(),status:`pending`};return this.items=[...this.items,t],this.changed(),t}drain(){let e=this.items.filter(e=>e.status===`pending`&&this.durable.has(e.deliveryId));if(e.length===0)return[];let t=new Set(e.map(e=>e.deliveryId));for(let e of t)this.sentAt.set(e,this.now());return this.update(e=>t.has(e.deliveryId)?{...e,status:`sending`}:e),e}interrupted(){this.sentAt.clear(),this.items.some(e=>e.status===`sending`)&&this.update(e=>e.status===`sending`?{...e,status:`pending`}:e)}settle(e,t,n){if(this.sentAt.delete(e),this.items.some(t=>t.deliveryId===e)){if(t){this.durable.delete(e),this.items=this.items.filter(t=>t.deliveryId!==e),this.changed();return}this.update(t=>t.deliveryId===e?{...t,status:`failed`,...n?{error:n}:{}}:t)}}retry(e){this.durable.delete(e),this.update(t=>{if(t.deliveryId!==e||t.status!==`failed`)return t;let{error:n,...r}=t;return{...r,status:`pending`}})}async discard(e){if(!this.items.some(t=>t.deliveryId===e))return;this.durable.delete(e),this.sentAt.delete(e),this.items=this.items.map(t=>t.deliveryId===e?{...t,status:`failed`,error:`outbox-discarding`}:t);for(let e of this.listeners)e([...this.items]);let t=this.writing.then(async()=>{try{await this.loading,this.loadFailed&&await this.loadExisting(),await this.storage.save(this.pairId,this.items.filter(t=>t.deliveryId!==e)),this.items=this.items.filter(t=>t.deliveryId!==e)}catch{this.items=this.items.map(t=>t.deliveryId===e?{...t,status:`failed`,error:`outbox-discard`}:t),await this.storage.save(this.pairId,this.items).catch(()=>{})}for(let e of this.listeners)e([...this.items])});return this.writing=t,t}flushed(){return this.writing}expire(e=this.now()){for(let[t,n]of this.sentAt)e-n>=6e4&&this.settle(t,!1,`delivery-unconfirmed`)}update(e){this.items=this.items.map(e),this.changed()}changed(){for(let e of this.listeners)e([...this.items]);this.writing=this.writing.then(async()=>{let e=[...this.items];try{await this.loading,this.loadFailed&&await this.loadExisting(),e=[...this.items],await this.storage.save(this.pairId,e);let t=!1;for(let n of e){let e=this.items.find(e=>e.deliveryId===n.deliveryId);!e||this.durable.has(n.deliveryId)||(this.durable.add(n.deliveryId),e.status===`pending`&&(t=!0))}if(t)for(let e of this.listeners)e([...this.items])}catch{this.items=this.items.map(t=>t.status!==`pending`||!e.includes(t)?t:(this.durable.delete(t.deliveryId),{...t,status:`failed`,error:`outbox-storage`}));for(let e of this.listeners)e([...this.items])}})}},Pt=`enso-phone-outbox`,Ft=`outbox`;function It(e=globalThis.indexedDB){let t=null,n=()=>e?(t??=new Promise((t,n)=>{let r=e.open(Pt,1);r.onupgradeneeded=()=>{r.result.objectStoreNames.contains(Ft)||r.result.createObjectStore(Ft)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)}).catch(e=>{throw t=null,e}),t):Promise.reject(Error(`IndexedDB unavailable`)),r=async(e,t)=>{let r=await n();return new Promise((n,i)=>{let a=r.transaction(Ft,e),o=t(a.objectStore(Ft));a.oncomplete=()=>n(o.result),a.onabort=()=>i(a.error??Error(`Outbox transaction aborted`)),a.onerror=()=>i(a.error),o.onerror=()=>i(o.error)})};return{load:e=>r(`readonly`,t=>t.get(e)),save:async(e,t)=>{await r(`readwrite`,n=>t.length>0?n.put(t,e):n.delete(e))},remove:async e=>{await r(`readwrite`,t=>t.delete(e))}}}var Lt=It();function Rt(e){return{expandLiveReasoning:e.expandLiveReasoning!==!1,autoCollapseTurns:e.autoCollapseTurns===!0,collapseCompletedActivity:e.collapseCompletedActivity!==!1,collapseLiveActivity:e.collapseLiveActivity===!0,pinUnfinishedTodos:e.pinUnfinishedTodos!==!1}}var zt={language:`system`,theme:`system`,terminalTheme:``,terminalFontFamily:``,syncTerminalTheme:!1,providers:[],projects:[],skills:[],presets:[],agentTypes:[],loadLocalSkills:!0,compactReadOnlyTools:!0,expandLiveEdits:!0,...Rt({}),keybindings:{},privacyMasking:Ct,contextMenuOpen:[]},Bt=new Set;function Vt(e){let t=zt;zt={...zt,...e};for(let e of Bt)e(zt,t)}var Ht;function Ut(e,t){Ht=e,Vt({terminalTheme:e?`host`:``,terminalFontFamily:t??``})}function Wt(e){zt.compactReadOnlyTools!==e&&Vt({compactReadOnlyTools:e})}function Gt(e){zt.expandLiveEdits!==e&&Vt({expandLiveEdits:e})}function Kt(e){Object.keys(e).some(t=>zt[t]!==e[t])&&Vt(e)}function qt(e,t){(zt.theme!==e||zt.syncTerminalTheme!==t)&&Vt({theme:e,syncTerminalTheme:t})}function Jt(){return Ht}var Yt=e=>(Bt.add(e),()=>{Bt.delete(e)});function Xt(e){return(0,kt.useSyncExternalStore)(Yt,()=>e(zt))}Xt.getState=()=>zt,Xt.subscribe=Yt;var Zt=16e3,Qt=`default`,$t={background:`#1e1e1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`,cursorAccent:`#1e1e1e`,selectionBackground:`#264f78`,selectionForeground:`#ffffff`,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 en(e){return Jt()}function tn(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/i.exec(e.trim());return t?{r:Number.parseInt(t[1],16),g:Number.parseInt(t[2],16),b:Number.parseInt(t[3],16)}:null}function nn(e,t,n){return`#${[e,t,n].map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`}function rn(e,t,n){let r=tn(e),i=tn(t);if(!r||!i)return e;let a=Math.max(0,Math.min(1,n));return nn(r.r*(1-a)+i.r*a,r.g*(1-a)+i.g*a,r.b*(1-a)+i.b*a)}function an(e){let t=tn(e);if(!t)return 0;let[n,r,i]=[t.r,t.g,t.b].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*n+.7152*r+.0722*i}function on(e){let t=en();return!t||an(t.background)<.5}var sn=[`--background`,`--foreground`,`--card`,`--card-foreground`,`--popover`,`--popover-foreground`,`--primary`,`--primary-foreground`,`--secondary`,`--secondary-foreground`,`--muted`,`--muted-foreground`,`--accent`,`--accent-foreground`,`--destructive`,`--destructive-foreground`,`--success`,`--success-foreground`,`--warning`,`--warning-foreground`,`--info`,`--info-foreground`,`--border`,`--input`,`--ring`];function cn(e,t=!0){let n=en();if(!n)return;let r=document.documentElement,i=an(n.background)<.5;t&&r.classList.toggle(`dark`,i),r.style.setProperty(`--background`,n.background),r.style.setProperty(`--foreground`,n.foreground),r.style.setProperty(`--card`,n.background),r.style.setProperty(`--card-foreground`,n.foreground),r.style.setProperty(`--popover`,n.background),r.style.setProperty(`--popover-foreground`,n.foreground),r.style.setProperty(`--primary`,n.foreground),r.style.setProperty(`--primary-foreground`,n.background);let a=i?rn(n.background,n.brightBlack,.5):rn(n.background,n.black,.1);r.style.setProperty(`--secondary`,a),r.style.setProperty(`--secondary-foreground`,n.foreground);let o=i?rn(n.background,n.brightBlack,.4):rn(n.background,n.black,.08),s=i?rn(n.foreground,n.background,.4):rn(n.foreground,n.background,.3);r.style.setProperty(`--muted`,o),r.style.setProperty(`--muted-foreground`,s);let c=i?n.brightBlue:n.blue,l=rn(n.background,c,.3);r.style.setProperty(`--accent`,l),r.style.setProperty(`--accent-foreground`,an(l)<.5?`#ffffff`:`#000000`),r.style.setProperty(`--destructive`,n.red),r.style.setProperty(`--destructive-foreground`,`#ffffff`),r.style.setProperty(`--success`,n.green),r.style.setProperty(`--success-foreground`,`#ffffff`),r.style.setProperty(`--warning`,n.yellow),r.style.setProperty(`--warning-foreground`,i?n.background:`#000000`),r.style.setProperty(`--info`,n.blue),r.style.setProperty(`--info-foreground`,`#ffffff`);let u=i?rn(n.background,n.foreground,.15):rn(n.background,n.foreground,.12);r.style.setProperty(`--border`,u),r.style.setProperty(`--input`,u),r.style.setProperty(`--ring`,i?n.brightBlue:n.blue)}function ln(){for(let e of sn)document.documentElement.style.removeProperty(e)}var un={state:`synced`,knownIds:new Set};function dn(e,t,n){return{...e,state:t&&!n?.fresh?`syncing`:`synced`}}function fn(e,t,n){return!t||!n.includes(t)?e:{...e,state:`synced`}}function pn(e,t,n){let r=t!==null&&e.knownIds.has(t)&&!n.includes(t);return{tracking:{state:r?`synced`:e.state,knownIds:new Set(n)},ghost:r}}var mn=1,hn=`enso-phone-session-cache`,gn=`pairs`,_n=2,vn=8e3,yn={ttlMs:6048e5,maxSessions:5,maxMessages:200,maxDeviceBytes:4194304,maxRecords:8,maxTotalBytes:16777216},X=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Z=e=>typeof e==`string`,bn=e=>typeof e==`boolean`,Q=e=>typeof e==`number`&&Number.isFinite(e)&&Math.abs(e)<=2**53-1,xn=e=>Q(e)&&Number.isSafeInteger(e)&&e>=0,$=(e,t,n)=>e[t]===void 0||n(e[t]);function Sn(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){let e=t(r);if(e===null)return null;n.push(e)}return n}function Cn(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){let e=t(r);e&&n.push(e)}return n}function wn(e){let t=new Set,n=[];for(let r of e)t.has(r.id)||(t.add(r.id),n.push(r));return n}function Tn(e){return new Set(e).size===e.length}function En(e){if(!X(e)||!Z(e.id)||!Z(e.title)||!Z(e.projectId)||!Z(e.status)||!$(e,`projectName`,Z)||!$(e,`cwd`,Z)||!$(e,`unread`,bn)||!$(e,`pendingAskCount`,xn)||!$(e,`pendingApprovalCount`,xn)||!$(e,`parentId`,Z)||!$(e,`updatedAt`,xn)||!$(e,`pinned`,bn)||!$(e,`archived`,bn)||!$(e,`providerId`,Z)||!$(e,`modelId`,Z)||!$(e,`reasoningEnabled`,bn))return null;let t=e.queued===void 0?void 0:Cn(e.queued,e=>!X(e)||!Z(e.id)||!Z(e.text)||!$(e,`hasImages`,bn)?null:{id:e.id,text:e.text,...typeof e.hasImages==`boolean`?{hasImages:e.hasImages}:{}}),n;if(e.goal!==void 0){if(!X(e.goal)||!Z(e.goal.text)||!xn(e.goal.autoTurns)||!$(e.goal,`note`,Z))return null;let t=e.goal.status;if(t!==`active`&&t!==`paused`&&t!==`completed`&&t!==`blocked`&&t!==`waiting`)return null;n={text:e.goal.text,status:t,autoTurns:e.goal.autoTurns,...typeof e.goal.note==`string`?{note:e.goal.note}:{}}}let r=e.slashCommands===void 0?void 0:Cn(e.slashCommands,e=>X(e)&&Z(e.name)&&Z(e.description)?{name:e.name,description:e.description}:null),i={id:e.id,title:e.title,projectName:Z(e.projectName)?e.projectName:``,projectId:e.projectId,status:e.status};typeof e.cwd==`string`&&(i.cwd=e.cwd),typeof e.unread==`boolean`&&(i.unread=e.unread),typeof e.pendingAskCount==`number`&&(i.pendingAskCount=e.pendingAskCount),typeof e.pendingApprovalCount==`number`&&(i.pendingApprovalCount=e.pendingApprovalCount),typeof e.parentId==`string`&&(i.parentId=e.parentId),typeof e.updatedAt==`number`&&(i.updatedAt=e.updatedAt),typeof e.pinned==`boolean`&&(i.pinned=e.pinned),typeof e.archived==`boolean`&&(i.archived=e.archived),typeof e.providerId==`string`&&(i.providerId=e.providerId),typeof e.modelId==`string`&&(i.modelId=e.modelId),typeof e.reasoningEnabled==`boolean`&&(i.reasoningEnabled=e.reasoningEnabled),(e.thinkingLevel===`minimal`||e.thinkingLevel===`low`||e.thinkingLevel===`medium`||e.thinkingLevel===`high`||e.thinkingLevel===`xhigh`||e.thinkingLevel===`max`)&&(i.thinkingLevel=e.thinkingLevel),t&&(i.queued=t),n&&(i.goal=n),r&&(i.slashCommands=r);let a=Dn(e.context);a&&(i.context=a);let o=Ot(e.usageTotals);return o&&(i.usageTotals=o),i}function Dn(e){if(!(!X(e)||!xn(e.used)||!$(e,`window`,xn)))return typeof e.window==`number`?{used:e.used,window:e.window}:{used:e.used}}function On(e){return!X(e)||!Z(e.id)||!Z(e.name)||!$(e,`path`,Z)||!$(e,`alias`,Z)||!$(e,`sshConnectionName`,Z)||!$(e,`sshHost`,Z)||!$(e,`groupId`,Z)||e.kind!==void 0&&e.kind!==`local`&&e.kind!==`ssh`||e.archived!==void 0&&e.archived!==!0?null:{id:e.id,name:e.name,path:Z(e.path)?e.path:``,...typeof e.alias==`string`?{alias:e.alias}:{},...e.kind===`local`||e.kind===`ssh`?{kind:e.kind}:{},...typeof e.sshConnectionName==`string`?{sshConnectionName:e.sshConnectionName}:{},...typeof e.sshHost==`string`?{sshHost:e.sshHost}:{},...e.archived===!0?{archived:!0}:{},...typeof e.groupId==`string`?{groupId:e.groupId}:{}}}function kn(e){return!X(e)||!Z(e.id)||!Z(e.name)||!Q(e.order)||!$(e,`emoji`,Z)||!$(e,`color`,Z)?null:{id:e.id,name:e.name,order:e.order,...typeof e.emoji==`string`?{emoji:e.emoji}:{},...typeof e.color==`string`?{color:e.color}:{}}}function An(e){if(!X(e)||!Z(e.id)||!Z(e.name))return null;let t=Cn(e.models,e=>!X(e)||!Z(e.id)||!$(e,`label`,Z)?null:{id:e.id,...typeof e.label==`string`?{label:e.label}:{}});return t?{id:e.id,name:e.name,models:wn(t)}:null}var jn={ok:!1};function Mn(e,t={nodes:0,seen:new WeakSet},n=0){if(t.nodes+=1,t.nodes>2e5||n>32)return jn;if(e===null||Z(e)||bn(e)||Q(e))return{ok:!0,value:e};if(Array.isArray(e)){if(t.seen.has(e))return jn;t.seen.add(e);let r=[];for(let i of e){let e=Mn(i,t,n+1);if(!e.ok)return jn;r.push(e.value)}return t.seen.delete(e),{ok:!0,value:r}}if(!X(e))return jn;let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null||t.seen.has(e))return jn;t.seen.add(e);let i={};for(let[r,a]of Object.entries(e)){if(a===void 0)continue;let e=Mn(a,t,n+1);if(!e.ok)return jn;Object.defineProperty(i,r,{value:e.value,enumerable:!0,configurable:!0,writable:!0})}return t.seen.delete(e),{ok:!0,value:i}}function Nn(e){if(!X(e))return null;switch(e.type){case`text`:return Z(e.text)?{type:`text`,text:e.text}:null;case`thinking`:return Z(e.text)?{type:`thinking`,text:e.text}:null;case`toolCall`:{if(!Z(e.id)||!Z(e.name))return null;if(e.arguments===void 0)return{type:`toolCall`,id:e.id,name:e.name};let t=Mn(e.arguments);return t.ok?{type:`toolCall`,id:e.id,name:e.name,arguments:t.value}:null}case`image`:return Z(e.data)&&Z(e.mimeType)?{type:`image`,data:e.data,mimeType:e.mimeType}:null;case`unknown`:return{type:`unknown`};default:return null}}function Pn(e){return!X(e)||!Q(e.input)||!Q(e.output)||!Q(e.cacheRead)||!Q(e.cacheWrite)?null:{input:e.input,output:e.output,cacheRead:e.cacheRead,cacheWrite:e.cacheWrite}}function Fn(e){return!X(e)||!Q(e.stepStartMs)||!$(e,`firstTokenMs`,Q)||!$(e,`thinkingEndMs`,Q)||!$(e,`completedMs`,Q)?null:{stepStartMs:e.stepStartMs,...typeof e.firstTokenMs==`number`?{firstTokenMs:e.firstTokenMs}:{},...typeof e.thinkingEndMs==`number`?{thinkingEndMs:e.thinkingEndMs}:{},...typeof e.completedMs==`number`?{completedMs:e.completedMs}:{}}}function In(e){if(!X(e)||!Z(e.role))return null;let t=Sn(e.content,Nn);if(!t||!$(e,`toolName`,Z)||!$(e,`toolCallId`,Z)||!$(e,`isError`,bn)||!$(e,`stopReason`,Z)||!$(e,`errorMessage`,Z)||!$(e,`timestamp`,Q)||!$(e,`ttft`,Q)||!$(e,`duration`,Q)||!$(e,`toolDurationMs`,Q)||!$(e,`tokensBefore`,Q)||!$(e,`verified`,bn)||!$(e,`memory`,bn))return null;let n=e.usage===void 0?void 0:Pn(e.usage),r=e.timing===void 0?void 0:Fn(e.timing);if(e.usage!==void 0&&!n||e.timing!==void 0&&!r)return null;let i=e.todos===void 0?void 0:Sn(e.todos,e=>!X(e)||!Z(e.content)||e.status!==`pending`&&e.status!==`in_progress`&&e.status!==`completed`?null:{content:e.content,status:e.status});if(e.todos!==void 0&&!i)return null;let a;if(e.subagentMeta!==void 0){if(!X(e.subagentMeta)||!$(e.subagentMeta,`modelId`,Z)||!$(e.subagentMeta,`outputTokens`,Q)||!$(e.subagentMeta,`steps`,Q))return null;a={...typeof e.subagentMeta.modelId==`string`?{modelId:e.subagentMeta.modelId}:{},...typeof e.subagentMeta.outputTokens==`number`?{outputTokens:e.subagentMeta.outputTokens}:{},...typeof e.subagentMeta.steps==`number`?{steps:e.subagentMeta.steps}:{}}}let o;if(e.editDiff!==void 0){if(!X(e.editDiff)||!Z(e.editDiff.oldText)||!Z(e.editDiff.newText))return null;o={oldText:e.editDiff.oldText,newText:e.editDiff.newText}}let s=e.fileChanges===void 0?void 0:Sn(e.fileChanges,e=>!X(e)||!Z(e.path)||!Z(e.oldText)||!Z(e.newText)||e.type!==`add`&&e.type!==`update`&&e.type!==`delete`||e.truncated!==void 0&&e.truncated!==!0?null:{path:e.path,oldText:e.oldText,newText:e.newText,type:e.type,...e.truncated===!0?{truncated:!0}:{}});if(e.fileChanges!==void 0&&!s)return null;let c;if(e.applyPatchOutcome!==void 0){let t=e.applyPatchOutcome;if(!X(t)||t.status!==`success`&&t.status!==`partial`&&t.status!==`failed`||!$(t,`error`,Z)||!$(t,`input`,Z)||t.errorTruncated!==void 0&&t.errorTruncated!==!0||t.inputTruncated!==void 0&&t.inputTruncated!==!0)return null;let n=Sn(t.applied,e=>Z(e)?e:null),r=Sn(t.failed,e=>Z(e)?e:null),i=Sn(t.unattempted,e=>Z(e)?e:null),a=Sn(t.uncertain,e=>Z(e)?e:null);if(!n||!r||!i||!a)return null;c={status:t.status,applied:n,failed:r,unattempted:i,uncertain:a,...typeof t.error==`string`?{error:t.error}:{},...t.errorTruncated===!0?{errorTruncated:!0}:{},...typeof t.input==`string`?{input:t.input}:{},...t.inputTruncated===!0?{inputTruncated:!0}:{}}}let l={role:e.role,content:t};return typeof e.toolName==`string`&&(l.toolName=e.toolName),typeof e.toolCallId==`string`&&(l.toolCallId=e.toolCallId),typeof e.isError==`boolean`&&(l.isError=e.isError),typeof e.stopReason==`string`&&(l.stopReason=e.stopReason),typeof e.errorMessage==`string`&&(l.errorMessage=e.errorMessage),typeof e.timestamp==`number`&&(l.timestamp=e.timestamp),n&&(l.usage=n),typeof e.ttft==`number`&&(l.ttft=e.ttft),typeof e.duration==`number`&&(l.duration=e.duration),r&&(l.timing=r),i&&(l.todos=i),typeof e.toolDurationMs==`number`&&(l.toolDurationMs=e.toolDurationMs),a&&(l.subagentMeta=a),o&&(l.editDiff=o),s&&(l.fileChanges=s),c&&(l.applyPatchOutcome=c),typeof e.tokensBefore==`number`&&(l.tokensBefore=e.tokensBefore),typeof e.verified==`boolean`&&(l.verified=e.verified),typeof e.memory==`boolean`&&(l.memory=e.memory),l}function Ln(e){return Sn(e,e=>!X(e)||!Z(e.requestId)||!Z(e.tool)||!Z(e.summary)||!$(e,`toolCallId`,Z)||e.phase!==void 0&&e.phase!==`reviewing`||e.kind!==`command`&&e.kind!==`file-edit`&&e.kind!==`file-write`&&e.kind!==`mcp`?null:{requestId:e.requestId,tool:e.tool,kind:e.kind,summary:e.summary,...typeof e.toolCallId==`string`?{toolCallId:e.toolCallId}:{},...e.phase===`reviewing`?{phase:`reviewing`}:{},...typeof e.expiresAt==`number`?{expiresAt:e.expiresAt}:{}})}function Rn(e){return Sn(e,e=>{if(!X(e)||!Z(e.requestId)||!Z(e.question))return null;let t=e.options===void 0?void 0:Sn(e.options,e=>Z(e)?e:null);return e.options!==void 0&&!t?null:{requestId:e.requestId,question:e.question,...t?{options:t}:{},...typeof e.expiresAt==`number`?{expiresAt:e.expiresAt}:{}}})}function zn(e){return Sn(e,e=>!X(e)||!Z(e.taskId)||!Z(e.command)||!Z(e.tail)||!Q(e.startedAt)||!$(e,`exitCode`,Q)||e.status!==`running`&&e.status!==`done`&&e.status!==`failed`?null:{taskId:e.taskId,command:e.command,status:e.status,tail:e.tail,startedAt:e.startedAt,...typeof e.exitCode==`number`?{exitCode:e.exitCode}:{}})}function Bn(e){return Sn(e,e=>{if(!X(e)||!Z(e.id)||!Z(e.description)||!Q(e.steps)||!Z(e.currentActivity)||!Q(e.startedAt)||!$(e,`detailsPruned`,bn)||!$(e,`resultText`,Z)||!$(e,`modelId`,Z)||!$(e,`agentType`,Z)||!$(e,`outputTokens`,Q)||e.status!==`running`&&e.status!==`done`&&e.status!==`failed`)return null;let t=e.activityLog===void 0?void 0:Sn(e.activityLog,e=>Z(e)?e:null),n=e.activities===void 0?void 0:Sn(e.activities,e=>!X(e)||!Z(e.id)?null:e.type===`assistant`&&Z(e.text)&&bn(e.streaming)?{id:e.id,type:`assistant`,text:e.text,streaming:e.streaming}:e.type===`tool`&&Z(e.toolName)&&Z(e.argumentsText)&&$(e,`outputText`,Z)&&(e.status===`running`||e.status===`done`||e.status===`failed`||e.status===`aborted`)?{id:e.id,type:`tool`,toolName:e.toolName,argumentsText:e.argumentsText,status:e.status,...typeof e.outputText==`string`?{outputText:e.outputText}:{}}:null);return e.activityLog!==void 0&&!t||e.activities!==void 0&&!n?null:{id:e.id,description:e.description,status:e.status,steps:e.steps,currentActivity:e.currentActivity,startedAt:e.startedAt,...t?{activityLog:t}:{},...n?{activities:n}:{},...typeof e.detailsPruned==`boolean`?{detailsPruned:e.detailsPruned}:{},...typeof e.resultText==`string`?{resultText:e.resultText}:{},...typeof e.modelId==`string`?{modelId:e.modelId}:{},...typeof e.agentType==`string`?{agentType:e.agentType}:{},...typeof e.outputTokens==`number`?{outputTokens:e.outputTokens}:{}}})}function Vn(e,t){if(!X(e)||!Z(e.status))return null;let n=Ln(e.approvals),r=Rn(e.asks),i=zn(e.tasks),a=Bn(e.subagents);if(!n||!r||!i||!a)return null;let o;if(e.retry!==void 0){if(!X(e.retry)||!xn(e.retry.attempt)||!xn(e.retry.maxAttempts)||!xn(e.retry.delayMs)||!Z(e.retry.error)||!Q(e.retry.at))return null;o={attempt:e.retry.attempt,maxAttempts:e.retry.maxAttempts,delayMs:e.retry.delayMs,error:e.retry.error,at:e.retry.at}}return e.compaction!==void 0&&e.compaction!==`queued`&&e.compaction!==`running`||!$(e,`compactionNoticeAt`,xn)?null:{messages:t,status:e.status,approvals:n,asks:r,tasks:i,subagents:a,...o?{retry:o}:{},...e.compaction===`queued`||e.compaction===`running`?{compaction:e.compaction}:{},...typeof e.compactionNoticeAt==`number`?{compactionNoticeAt:e.compactionNoticeAt}:{}}}function Hn(e){return X(e)&&Z(e.epoch)&&e.epoch.length>0&&xn(e.seq)?{epoch:e.epoch,seq:e.seq}:null}function Un(e,t){if(!X(e)||!Z(e.id)||!X(e.view)||!(e.view.messages instanceof Map))return null;let n=[...e.view.messages.entries()];if(n.some(([e])=>!xn(e)))return null;n.sort((e,t)=>e[0]-t[0]);let r=Math.max(0,n.length-1);for(;r>0&&n[r-1][0]===n[r][0]-1;)--r;let i=n.slice(Math.max(r,n.length-t));if(n.length>0&&i.length===0)return null;let a=[];for(let[e,t]of i){let n=In(t);n&&a.push([e,n])}let o=Vn(e.view,new Map(a));if(!o)return null;let s=e.cursor===void 0?void 0:Hn(e.cursor);return e.cursor!==void 0&&!s?null:{id:e.id,view:{...o,messages:a},...s?{cursor:s}:{}}}function Wn(e,t){if(!X(e)||!Z(e.id)||!X(e.view))return null;let n=e.view.messages;if(!Array.isArray(n)||n.length>t.maxMessages)return null;let r=new Map,i;for(let e of n){if(!Array.isArray(e)||e.length!==2||!xn(e[0])||i!==void 0&&e[0]<=i)return null;let t=In(e[1]);if(!t||r.has(e[0]))return null;r.set(e[0],t),i=e[0]}let a=Vn(e.view,r);if(!a)return null;let o=e.cursor===void 0?void 0:Hn(e.cursor);return e.cursor!==void 0&&!o?null:{id:e.id,view:a,...o?{cursor:o}:{}}}function Gn(e){if(!X(e))return null;let t=Cn(e.catalog,En)??[],n=Cn(e.pinnedOrder,e=>Z(e)?e:null)??[],r=Cn(e.projects,On)??[],i=Cn(e.projectGroups,kn)??[],a=Cn(e.providers,An)??[],o=[...new Set(n)];return{catalog:wn(t),pinnedOrder:o,projects:wn(r),projectGroups:wn(i),providers:wn(a)}}function Kn(e){try{let t=JSON.stringify(e);return t===void 0?null:new TextEncoder().encode(t).byteLength}catch{return null}}function qn(e,t){if(!X(e)||!Array.isArray(e.sessions))return console.warn(`[pair] cache encode skipped`),null;let n=Gn(e)??{catalog:[],pinnedOrder:[],projects:[],projectGroups:[],providers:[]},r=[],i=t.maxSessions===0?[]:e.sessions.slice(-t.maxSessions);for(let e of i){let n=Un(e,t.maxMessages);n&&r.push(n)}if(!Tn(r.map(e=>e.id)))return null;let a={...n,sessions:r},o=Kn(a);if(o===null)return null;for(;o>t.maxDeviceBytes&&a.sessions.length>1;)if(a.sessions.shift(),o=Kn(a),o===null)return null;if(o<=t.maxDeviceBytes)return a;let s=a.sessions[0];if(s?.view.messages.length){let e=s.view.messages,n=1,r=e.length-1,i=-1;for(;n<=r;){let o=Math.floor((n+r)/2);s.view.messages=e.slice(o);let c=Kn(a);c!==null&&c<=t.maxDeviceBytes?(i=o,r=o-1):n=o+1}if(i>=0)return s.view.messages=e.slice(i),a}return a.sessions=[],o=Kn(a),o!==null&&o<=t.maxDeviceBytes?a:null}function Jn(e,t){let n=Gn(e);if(!n||!X(e)||!Array.isArray(e.sessions)||e.sessions.length>t.maxSessions)return null;let r=Sn(e.sessions,e=>Wn(e,t));return!r||!Tn(r.map(e=>e.id))?null:{...n,sessions:r}}function Yn(e,t,n,r){if(!X(e)||!xn(r)||e.schema!==mn||e.pairId!==t||!xn(e.updatedAt)||!xn(e.accessedAt)||!xn(e.bytes)||r-e.updatedAt>n.ttlMs)return null;let i=Kn(e.data),a=Kn(e);if(i===null||i!==e.bytes||i>n.maxDeviceBytes||a===null||a>n.maxDeviceBytes)return null;let o=Jn(e.data,n);if(!o)return null;let s=Xn(t,e.updatedAt,n.maxDeviceBytes),c=qn(o,{...n,maxDeviceBytes:s}),l=c?Kn(c):null;return!c||l===null?null:{data:o,record:{pairId:t,schema:mn,updatedAt:e.updatedAt,accessedAt:e.accessedAt,bytes:l,data:c}}}function Xn(e,t,n){let r=Kn({pairId:e,schema:mn,updatedAt:t,accessedAt:t,bytes:n,data:null});return r===null?0:Math.max(0,n-(r-4))}function Zn(e,t,n){let r=[],i=[];for(let t of e){let e=t.value,n=Kn(e);if(!X(e)||e.schema!==mn||e.pairId!==t.key||!xn(e.accessedAt)||n===null){r.push(t.key);continue}i.push({key:t.key,accessedAt:e.accessedAt,bytes:n})}i.sort((e,t)=>t.accessedAt-e.accessedAt||Number(t.key===n)-Number(e.key===n)||e.key.localeCompare(t.key));let a=0,o=0;for(let e of i)o>=t.maxRecords||a+e.bytes>t.maxTotalBytes?r.push(e.key):(o+=1,a+=e.bytes);return[...new Set(r)]}var Qn=class{factory;timeoutMs;opening=null;constructor(e,t){this.factory=e,this.timeoutMs=t}database(){if(!this.opening){let e=this.open();this.opening=e,e.catch(()=>{this.opening===e&&(this.opening=null)})}return this.opening}open(){return new Promise((e,t)=>{let n;try{n=this.factory.open(hn,_n)}catch(e){t(e);return}let r=!1,i=(n,i)=>{if(r){n?.close();return}r=!0,clearTimeout(a),n?e(n):t(i??Error(`IndexedDB unavailable`))},a=setTimeout(()=>i(null,Error(`IndexedDB open timeout`)),this.timeoutMs);n.onupgradeneeded=()=>{try{n.result.objectStoreNames.contains(gn)||n.result.createObjectStore(gn)}catch(e){try{n.transaction?.abort()}catch{}i(null,e)}},n.onsuccess=()=>{n.result.onversionchange=()=>n.result.close(),i(n.result)},n.onerror=()=>i(null,n.error),n.onblocked=()=>{}})}async read(e){let t=await this.database();return new Promise((n,r)=>{let i;try{i=t.transaction(gn,`readonly`)}catch(e){r(e);return}let a,o=!1,s=(e,t)=>{o||(o=!0,clearTimeout(c),t?r(t):n(e))},c=setTimeout(()=>{try{i.abort()}catch{}s(null,Error(`IndexedDB transaction timeout`))},this.timeoutMs),l=i.objectStore(gn).get(e);l.onsuccess=()=>{a=l.result},i.oncomplete=()=>s(a),i.onabort=()=>s(null,i.error??Error(`IndexedDB aborted`)),i.onerror=()=>{}})}async write(e,t,n){let r=await this.database();return new Promise((i,a)=>{let o;try{o=r.transaction(gn,`readwrite`)}catch(e){a(e);return}let s=!1,c=e=>{s||(s=!0,clearTimeout(l),e?a(e):i())},l=setTimeout(()=>{try{o.abort()}catch{}c(Error(`IndexedDB transaction timeout`))},this.timeoutMs),u=o.objectStore(gn),d=u.getAll(),f=u.getAllKeys(),p=!1,m=!1,h=()=>{if(!(!p||!m))try{let r=[];for(let t=0;t<f.result.length;t+=1){let n=f.result[t];typeof n==`string`&&n!==e&&r.push({key:n,value:d.result[t]})}r.push({key:e,value:t}),u.put(t,e);for(let e of n(r))u.delete(e)}catch(e){try{o.abort()}catch{}c(e)}};d.onsuccess=()=>{p=!0,h()},f.onsuccess=()=>{m=!0,h()},o.oncomplete=()=>c(),o.onabort=()=>c(o.error??Error(`IndexedDB aborted`)),o.onerror=()=>{}})}async remove(e){let t=await this.database();return new Promise((n,r)=>{let i;try{i=t.transaction(gn,`readwrite`),i.objectStore(gn).delete(e)}catch(e){r(e);return}let a=!1,o=e=>{a||(a=!0,clearTimeout(s),e?r(e):n())},s=setTimeout(()=>{try{i.abort()}catch{}o(Error(`IndexedDB transaction timeout`))},this.timeoutMs);i.oncomplete=()=>o(),i.onabort=()=>o(i.error??Error(`IndexedDB aborted`)),i.onerror=()=>{}})}};function $n(e){let t={...yn};if(!e)return t;for(let n of Object.keys(t)){let r=e[n];typeof r==`number`&&Number.isSafeInteger(r)&&r>=0&&(t[n]=r)}return t}function er(e={}){let t=$n(e.limits),n=typeof e.openTimeoutMs==`number`&&e.openTimeoutMs>0?e.openTimeoutMs:vn,r=`indexedDB`in e?e.indexedDB:`indexedDB`in globalThis?globalThis.indexedDB:void 0,i=e.backend??(r?new Qn(r,n):null),a=e.now??Date.now,o=new Map,s=(e,t,n)=>{if(!e||e.length>512)return Promise.resolve(t);let r=(o.get(e)??Promise.resolve()).then(n).catch(()=>t),i=r.then(()=>void 0,()=>void 0);return o.set(e,i),i.then(()=>{o.get(e)===i&&o.delete(e)}),r};return{load(e){return s(e,null,async()=>{if(!i)return null;let n=a(),r=await i.read(e);if(r===void 0)return null;let o=Yn(r,e,t,n);if(!o){try{await i.remove(e)}catch{}return null}if(o.record.accessedAt!==n&&xn(n)){let r=qn(o.data,{...t,maxDeviceBytes:Xn(e,n,t.maxDeviceBytes)}),a=r?Kn(r):null;if(r&&a!==null){let s={...o.record,accessedAt:n,bytes:a,data:r};try{await i.write(e,s,n=>Zn(n,t,e))}catch{}}}return o.data})},save(e,n){return s(e,void 0,async()=>{if(!i)return;let r=a(),o=xn(r)?qn(n,{...t,maxDeviceBytes:Xn(e,r,t.maxDeviceBytes)}):null;if(!o||!xn(r))return;let s=Kn(o);if(s===null)return;let c={pairId:e,schema:mn,updatedAt:r,accessedAt:r,bytes:s,data:o};try{await i.write(e,c,n=>Zn(n,t,e))}catch(e){console.warn(`[pair] cache write failed`,e)}})},clear(e){return s(e,void 0,async()=>{i&&await i.remove(e)})}}}var tr=er();function nr(e){let t=document.querySelector(`meta[name="theme-color"]`);if(t?.content===e&&!t.media)return;for(let e of document.querySelectorAll(`meta[name="theme-color"]`))e.remove();let n=document.createElement(`meta`);n.name=`theme-color`,n.content=e,document.head.prepend(n)}function rr(e){if(e.startsWith(`rgb`)||e.startsWith(`#`))return e;try{let t=document.createElement(`canvas`);t.width=1,t.height=1;let n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)return e;n.fillStyle=e,n.fillRect(0,0,1,1);let[r,i,a]=n.getImageData(0,0,1,1).data;return`rgb(${r}, ${i}, ${a})`}catch{return e}}function ir(e,t){return e===`auto`?{theme:t,syncTerminalTheme:t===`sync-terminal`}:{theme:e,syncTerminalTheme:!1}}var ar=`enso-phone-theme`,or=`system`,sr=ur(),cr=window.matchMedia(`(prefers-color-scheme: dark)`),lr=new Set;function ur(){let e=localStorage.getItem(ar);return e===`light`||e===`dark`?e:`auto`}function dr(){requestAnimationFrame(()=>{let e=getComputedStyle(document.body).backgroundColor;e&&nr(rr(e))})}function fr(){if(sr!==`auto`)ln(),document.documentElement.classList.toggle(`dark`,sr===`dark`);else if(or===`sync-terminal`)cn(void 0,!0);else{ln();let e=or===`system`?cr.matches:or===`dark`;document.documentElement.classList.toggle(`dark`,e)}for(let e of lr)e();dr();let e=ir(sr,or);qt(e.theme,e.syncTerminalTheme)}function pr(e){or=e,fr()}function mr(){return sr}function hr(e){sr=e,e===`auto`?localStorage.removeItem(ar):localStorage.setItem(ar,e),fr()}function gr(e){return lr.add(e),()=>lr.delete(e)}function _r(){fr(),cr.addEventListener(`change`,fr)}var vr=6e4,yr=Zt/5,br=[`disabled`,`not-ready`,`invalid-audio`,`failed`],xr=class{device;events;cache;ws=null;heartbeat=null;contentKey;replay=Ae(_,v);attempt=0;timer=null;closed=!1;revoked=!1;subscribedId=null;sessions=new Map;historyPending=new Set;sync=un;direct;cursors=new Map;baselines=new Set;pendingSync=null;freshSessionId=null;syncTimer=null;receiveQueue=Promise.resolve();sendQueue=Promise.resolve();cacheReady=!1;cacheLoading=!1;cacheTimer=null;cacheDirty=!1;roomPrimed=!1;hiddenAt=null;pendingDirectRestart=!1;probeNonce=0;probeSentAt=null;voiceInput=!1;voices=new Map;metadata={catalog:[],pinnedOrder:[],projects:[],projectGroups:[],providers:[]};constructor(e,t,n=y(),r=tr){this.device=e,this.events=t,this.cache=r,this.contentKey=te(e.contentKey),this.direct=new ee({role:`guest`,factory:n,sendSignal:e=>this.sendViaRelay(e),onFrame:e=>this.enqueueFrame(e),onTransportChange:e=>{e===`relay`&&this.ws?.readyState!==1&&!this.revoked&&!this.closed&&(this.events.onState(`offline`),this.dropVoice()),this.events.onTransport?.(e)},onResync:()=>{this.roomPrimed=!1,this.primeRoom()},onDiagnostic:e=>console.info(`[pair] ${e}`),onRtt:e=>this.events.onRtt?.(e),onNeedRelayProbe:()=>this.sendRelayProbe()})}transport(){return this.direct.transport()}connect(){if(this.closed||this.revoked||this.cacheLoading||this.ws&&this.ws.readyState<2)return;if(this.replay.peerReset(),!this.cacheReady){this.cacheLoading=!0,this.cache.load(this.device.pairId).then(e=>{if(!e||this.closed||this.revoked)return;let{sessions:t,...n}=e;this.metadata=n,this.sync={...this.sync,knownIds:new Set(n.catalog.map(e=>e.id))},this.events.onCatalog(n.catalog,n.pinnedOrder),this.events.onProjects(n.projects,n.projectGroups),this.events.onProviders(n.providers);for(let{id:e,view:n,cursor:r}of t)this.sessions.set(e,n),this.baselines.add(e),r&&this.cursors.set(e,r),this.events.onSession(e,{...n,messages:new Map(n.messages)})}).catch(()=>{}).finally(()=>{this.cacheReady=!0,this.cacheLoading=!1,this.connect()});return}this.events.onState(`connecting`);let e=`${ie(this.device.relayUrl)}/v1/pair/${encodeURIComponent(this.device.pairId)}?role=guest&token=${encodeURIComponent(this.device.token)}`,t;try{t=new WebSocket(e)}catch{this.scheduleReconnect();return}t.binaryType=`arraybuffer`,this.ws=t,this.roomPrimed=!1;let n=!1,r,i=e=>{if(!n&&(n=!0,r&&clearTimeout(r),this.ws===t)){if(this.heartbeat?.stop(),this.heartbeat=null,this.ws=null,this.roomPrimed=!1,e===1008||this.revoked){this.revoke();return}this.closed||(this.direct.transport()!==`direct`&&(this.events.onState(`offline`),this.dropVoice()),this.scheduleReconnect())}};this.heartbeat=pe(t,()=>{try{t.close()}catch{}i(null)},e=>{this.direct.transport()===`relay`&&this.events.onRtt?.(e)}),r=setTimeout(()=>{if(He(t.readyState,8e3)){try{t.close()}catch{}i(null)}},Ve),t.onopen=()=>{this.closed||this.revoked||this.ws!==t||(clearTimeout(r),this.attempt=0,this.primeRoom())},t.onmessage=e=>{if(!(this.closed||this.revoked||this.ws!==t)){if(typeof e.data==`string`){try{let t=JSON.parse(e.data);t.type===`host-online`?(this.replay.peerReset(),this.events.onState(`online`),this.direct.peerOnline(!0),this.flushDirectRestart(),this.primeRoom()):t.type===`host-offline`?(this.events.onState(`host-offline`),this.direct.peerOnline(!1),this.roomPrimed=!1,this.dropVoice()):t.type===`revoked`&&this.revoke()}catch{}return}this.enqueueFrame(new Uint8Array(e.data),t)}},t.onclose=e=>i(e.code),t.onerror=()=>{try{t.close()}catch{}}}nudge(e=`visibility`){if(this.closed||this.revoked)return;if(this.ws?.readyState===0){(e===`online`||e===`network-change`)&&(this.pendingDirectRestart=!0);return}let t=this.hiddenAt===null?0:Date.now()-this.hiddenAt;this.hiddenAt=null;let n=(e===`visibility`||e===`resume`)&&Be(t),r=n||Re(e,this.ws!==null,this.ws?.readyState??null);if((e===`online`||e===`network-change`||n)&&(r?this.pendingDirectRestart=!0:this.direct.networkChange()),r){this.replaceRelay();return}this.heartbeat?.probe(e===`visibility`||e===`resume`?500:void 0)}flushDirectRestart(){this.pendingDirectRestart&&(this.pendingDirectRestart=!1,this.direct.networkChange())}conceal(){this.hiddenAt??=Date.now()}close(){this.flushCache(),this.closed=!0,this.pendingDirectRestart=!1,this.stopSyncRetry(),this.timer&&clearTimeout(this.timer),this.direct.close(),this.heartbeat?.stop(),this.heartbeat=null;try{this.ws?.close()}catch{}this.dropVoice()}scheduleReconnect(){this.closed||this.revoked||(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),oe(this.attempt++)))}replaceRelay(){this.timer&&clearTimeout(this.timer),this.timer=null,this.attempt=0;let e=this.ws;if(e){this.heartbeat?.stop(),this.heartbeat=null,this.ws=null,this.roomPrimed=!1;try{e.close()}catch{}}this.connect()}enqueueFrame(e,t){this.receiveQueue=this.receiveQueue.then(async()=>{this.closed||this.revoked||t&&t!==this.ws||await this.handleFrame(e,t)}).catch(()=>{})}async handleFrame(e,t){let n;try{let t=await this.replay.open(this.contentKey,e);if(t===void 0)return;n=t}catch{return}if(!(this.closed||this.revoked||t&&t!==this.ws)&&(this.replay.takeHello()&&this.send({type:`replay-hello`}),!ke(n))){if(xe(n)){this.events.onRemoteFrame?.(n);return}switch(n.type){case`catalog`:{let{tracking:e,ghost:t}=pn(this.sync,this.subscribedId,n.entries.map(e=>e.id)),r=t?this.subscribedId:null,i=new Set(n.entries.map(e=>e.id));for(let e of this.sync.knownIds)i.has(e)||(this.sessions.delete(e),this.baselines.delete(e),this.cursors.delete(e));this.setSync(e),r&&this.subscribe(null),r&&this.events.onGhostSession?.(r),this.metadata.catalog=n.entries,this.metadata.pinnedOrder=n.pinnedOrder??[],this.events.onCatalog(n.entries,n.pinnedOrder),this.scheduleCache();break}case`projects`:this.metadata.projects=n.projects,this.metadata.projectGroups=n.groups??[],this.events.onProjects(n.projects,n.groups),this.scheduleCache();break;case`providers`:this.metadata.providers=n.providers,this.events.onProviders(n.providers),this.scheduleCache();break;case`appearance`:Ut(n.terminal,n.terminalFontFamily),pr(n.theme),Wt(n.compactReadOnlyTools!==!1),Gt(n.expandLiveEdits!==!1),Kt(Rt(n));break;case`agent-event`:this.acceptAgentEvent(n.event,n.cursor);break;case`session-sync`:{let e=Xe(n);e?this.applySessionSync(e):console.warn(`[pair] dropped invalid session-sync`);break}case`push-config`:this.events.onPushConfig?.(n.vapidPublicKey);break;case`host-info`:this.direct.hostInfo(n),this.setVoiceInput(n.voiceInput===!0),this.events.onReadOnly?.(n.readOnly===!0),this.events.onRemoteDesktop?.(n.remoteDesktop===!0);break;case`voice-result`:{let{error:e}=n;this.voices.get(n.requestId)?.settle(e===void 0?{ok:!0,text:typeof n.text==`string`?n.text:``}:{ok:!1,error:br.includes(e)?e:`failed`});break}case`voice-partial`:this.voices.get(n.requestId)?.onPartial(n.text,n.correcting===!0);break;case`direct-answer`:case`direct-ice`:this.direct.handleSignal(n);break;case`probe-ack`:n.nonce===this.probeNonce&&this.probeSentAt!==null&&(this.direct.noteRelayRtt(Date.now()-this.probeSentAt),this.probeSentAt=null);break;case`history`:{if(!this.historyPending.has(n.sessionId))break;this.historyPending.delete(n.sessionId),this.events.onHistoryPending?.(n.sessionId,!1);let e=this.sessions.get(n.sessionId);if(!e)break;let t=ot(e,n);if(t===e)break;this.sessions.set(n.sessionId,t),this.events.onSession(n.sessionId,{...t,messages:new Map(t.messages)}),this.scheduleCache();break}case`bot-catalog`:Array.isArray(n.bots)&&this.events.onBotCatalog?.(n.enabled===!0,n.bots,n.newSession===!0,n.threads===!0);break;case`bot-chats`:Array.isArray(n.chats)&&this.events.onBotChats?.(n.chats,Array.isArray(n.threads)?n.threads:[]);break;case`group-timeline`:typeof n.chatId==`string`&&Array.isArray(n.entries)&&this.events.onGroupTimeline?.(n);break;case`bot-event`:typeof n.event==`object`&&n.event!==null&&this.events.onBotEvent?.(n.event);break;case`bot-chat-state`:typeof n.chatId==`string`&&this.events.onBotChatState?.(n);break;case`bot-send-result`:typeof n.deliveryId==`string`&&this.events.onBotSendResult?.(n);break;case`bot-new-session-result`:typeof n.chatId==`string`&&typeof n.requestId==`string`&&typeof n.ok==`boolean`&&this.events.onBotNewSessionResult?.(n);break;case`bot-thread-result`:typeof n.chatId==`string`&&typeof n.requestId==`string`&&typeof n.ok==`boolean`&&this.events.onBotThreadResult?.(n);break;case`bot-retry-result`:typeof n.chatId==`string`&&typeof n.entryId==`string`&&this.events.onBotRetryResult?.(n);break;case`bot-inbox`:Array.isArray(n.items)&&this.events.onBotInbox?.(n.items);break;case`bot-activity`:Array.isArray(n.items)&&typeof n.now==`number`&&this.events.onBotActivity?.(n.items,Date.now()-n.now);break;case`bot-artifacts`:typeof n.target==`object`&&n.target!==null&&this.events.onBotArtifacts?.(n);break;case`bot-artifact-image`:typeof n.requestId==`string`&&this.events.onBotArtifactImage?.(n);break;case`command-rejected`:typeof n.command==`string`&&this.events.onCommandRejected?.(n.command,n.error)}}}applySessionSync(e){if(this.pendingSync?.requestId!==e.requestId||this.pendingSync.sessionId!==e.sessionId)return;let t=e.sessionId;this.stopSyncRetry();let n=this.sessions.get(t);if(e.mode===`snapshot`)n=at(this.cursors.get(t)?.epoch===e.cursor.epoch?this.sessions:new Map,e.snapshot)[0]?.view,n&&=this.keepCachedMessages(t,n);else{let r=this.cursors.get(t);if(!n||r?.epoch!==e.cursor.epoch||r.seq!==e.fromSeq){this.cursors.delete(t),this.subscribe(t);return}for(let r of e.events){let e=r;if(this.truncatesBeforeCache(n,e)){this.cursors.delete(t),this.subscribe(t);return}n=it(n,e).view}}if(!n)return;this.sessions.set(t,n),this.baselines.add(t),this.cursors.set(t,e.cursor);let r=this.pendingSync.observed;this.pendingSync=null,r&&(r===`mixed`||r.epoch!==e.cursor.epoch||r.seq>e.cursor.seq)?this.subscribe(t):this.setSync({...this.sync,state:`synced`}),this.events.onSession(t,{...n,messages:new Map(n.messages)}),this.scheduleCache()}acceptAgentEvent(e,t){let n=typeof e.sessionId==`string`?e.sessionId:void 0;if(t!==void 0){if(!n||!Je(t))return;if(this.pendingSync?.sessionId===n){let e=this.pendingSync.observed;this.pendingSync.observed=e?e===`mixed`||e.epoch!==t.epoch?`mixed`:{epoch:t.epoch,seq:Math.max(e.seq,t.seq)}:t;return}let r=this.cursors.get(n);if(r?.epoch===t.epoch&&t.seq<=r.seq)return;if(!r||t.epoch!==r.epoch||t.seq!==r.seq+1){n===this.subscribedId?(this.freshSessionId===n&&(this.freshSessionId=null),this.subscribe(n)):this.cursors.delete(n);return}let i=this.sessions.get(n);if(i&&this.truncatesBeforeCache(i,e)){this.cursors.delete(n),n===this.subscribedId&&this.subscribe(n);return}this.applyAgentEvent(e),this.cursors.set(n,t)}else n&&this.cursors.delete(n),this.applyAgentEvent(e);this.scheduleCache()}truncatesBeforeCache(e,t){return t.type===`messages-truncated`&&typeof t.length==`number`&&t.length>0&&(e.messages.size===0||Math.min(...e.messages.keys())>=t.length)}keepCachedMessages(e,t){if(t.messages.size>0)return t;let n=this.sessions.get(e);return!n||n.messages.size===0?t:{...t,messages:new Map(n.messages)}}applyAgentEvent(e){let t=e.sessionId,n=e.type;if(n===`worker-exited`){this.cursors.clear(),this.sessions=st(this.sessions);for(let[e,t]of this.sessions)this.events.onSession(e,{...t,messages:new Map(t.messages)});return}if(n===`snapshot`){let t=(e.sessions??[]).map(e=>e.sessionId??e.identity?.sessionId).filter(e=>typeof e==`string`);this.setSync(fn(this.sync,this.subscribedId,t));for(let{id:t,view:n}of at(this.sessions,e)){let e=this.keepCachedMessages(t,n);this.cursors.delete(t),this.baselines.add(t),t===this.pendingSync?.sessionId&&(this.pendingSync=null,this.stopSyncRetry()),this.sessions.set(t,e),this.events.onSession(t,{...e,messages:new Map(e.messages)})}return}if(!t)return;let{view:r}=it(this.sessions.get(t)??nt(),e);this.sessions.set(t,r),this.events.onSession(t,{...r,messages:new Map(r.messages)})}getSession(e){return this.sessions.get(e)}startVoice(e){let t=crypto.randomUUID(),n=Zt*300,r=new Float32Array(yr),i=0,a=0,o=0,s=!1,c=null,l=null,u=null,d,f=e=>{l||(l=e,clearTimeout(d),this.voices.delete(t),u?.(e))},p=(e,n)=>{if(!this.canSend()){f({ok:!1,error:`failed`});return}let[r]=Qe(e,e.length);this.send({type:`voice-chunk`,requestId:t,index:a++,data:r,...n?{last:!0}:{}})},m=e=>{a>0&&!l&&this.send({type:`voice-cancel`,requestId:t}),f(e)};return this.voices.set(t,{onPartial:e,settle:f}),{push:e=>{if(l||c||s)return;if(o+e.length>n){s=!0;return}o+=e.length;let t=0;for(;t<e.length&&!l;){let n=Math.min(e.length-t,yr-i);r.set(e.subarray(t,t+n),i),i+=n,t+=n,!(i<yr)&&(p(r,!1),r=new Float32Array(yr),i=0)}},finish:()=>(c||(c=l?Promise.resolve(l):new Promise(e=>{u=e}),l)||(s?m({ok:!1,error:`invalid-audio`}):o===0?f({ok:!1,error:`invalid-audio`}):(p(i>0?r.subarray(0,i):new Float32Array(Zt/100),!0),l||(d=setTimeout(()=>f({ok:!1,error:`failed`}),vr)))),c),cancel:()=>m({ok:!1,error:`failed`})}}setVoiceInput(e){this.voiceInput!==e&&(this.voiceInput=e,this.events.onVoiceInput?.(e))}dropVoice(){this.setVoiceInput(!1);for(let e of[...this.voices.values()])e.settle({ok:!1,error:`failed`})}canSend(){return!this.closed&&!this.revoked&&(this.direct.transport()===`direct`||this.ws?.readyState===1)}send(e,t){if(this.canSend()){if(t?.bulk&&this.ws?.readyState===1){this.sendViaRelay(e);return}this.sendQueue=this.sendQueue.then(async()=>{if(this.closed||this.revoked)return;let t=await this.replay.seal(this.contentKey,e);this.closed||this.revoked||this.direct.send(t)||this.sendFrameViaRelay(t)}).catch(()=>{})}}sendFrameViaRelay(e){this.ws?.readyState===1&&this.ws.send(e.slice().buffer)}sendRelayProbe(){this.probeNonce=this.probeNonce+1>>>0,this.probeSentAt=Date.now(),this.sendViaRelay({type:`probe`,nonce:this.probeNonce})}sendViaRelay(e){this.sendQueue=this.sendQueue.then(async()=>{if(this.closed||this.revoked)return;let t=await this.replay.seal(this.contentKey,e);!this.closed&&!this.revoked&&this.sendFrameViaRelay(t)}).catch(()=>{})}setSync(e){let t=e.state!==this.sync.state;this.sync=e,t&&this.events.onSync?.(e.state)}primeRoom(){this.closed||this.revoked||this.roomPrimed||this.ws?.readyState===1&&(this.roomPrimed=!0,this.send({type:`snapshot`}),this.subscribedId&&this.subscribe(this.subscribedId))}subscribe(e,t){if(this.closed||this.revoked||(this.stopSyncRetry(),this.subscribedId=e,t?.fresh?this.freshSessionId=e:(e!==this.freshSessionId||e&&this.baselines.has(e))&&(this.freshSessionId=null),!this.cacheReady))return;let n=e!==null&&e===this.freshSessionId;if(this.pendingSync=e&&!n?{sessionId:e,requestId:crypto.randomUUID()}:null,this.historyPending.size>0){let e=[...this.historyPending];this.historyPending.clear();for(let t of e)this.events.onHistoryPending?.(t,!1)}if(this.setSync(dn(this.sync,e,{fresh:n})),!e){this.send({type:`subscribe`,sessionId:null});return}let r=this.sessions.get(e),i=this.baselines.has(e)&&r?r.messages.size?Math.max(...r.messages.keys()):-1:void 0;r&&(this.sessions.delete(e),this.sessions.set(e,r));let a={type:`subscribe`,sessionId:e,...this.pendingSync?{sync:{requestId:this.pendingSync.requestId,cursor:this.cursors.get(e)}}:typeof i==`number`?{sinceIndex:i}:{}};this.send(a),this.pendingSync&&this.armSyncRetry(a,this.pendingSync.requestId)}armSyncRetry(e,t){this.syncTimer=setTimeout(()=>{this.closed||this.revoked||this.pendingSync?.requestId!==t||(this.send(e),this.armSyncRetry(e,t))},1e4)}stopSyncRetry(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=null}scheduleCache(){this.closed||this.revoked||(this.cacheDirty=!0,!this.cacheTimer&&(this.cacheTimer=setTimeout(()=>this.flushCache(),500)))}flushCache(){if(this.cacheTimer&&clearTimeout(this.cacheTimer),this.cacheTimer=null,!this.cacheReady||!this.cacheDirty||this.closed||this.revoked)return;this.cacheDirty=!1;let e=[...this.sessions].filter(([e])=>this.baselines.has(e)).map(([e,t])=>({id:e,view:t,cursor:this.cursors.get(e)}));this.cache.save(this.device.pairId,{...this.metadata,sessions:e}).catch(()=>{})}revoke(){this.revoked=!0,this.pendingDirectRestart=!1,this.stopSyncRetry(),this.timer&&clearTimeout(this.timer),this.cacheTimer&&clearTimeout(this.cacheTimer),this.cacheTimer=null,this.direct.close(),this.heartbeat?.stop(),this.sessions.clear(),this.cursors.clear(),this.baselines.clear(),this.cache.clear(this.device.pairId).catch(()=>{}),this.dropVoice(),this.events.onState(`unauthorized`)}hasOlder(e){let t=this.sessions.get(e);return!t||t.messages.size===0?!1:Math.min(...t.messages.keys())>0}requestHistory(e){if(this.pendingSync||this.subscribedId!==e||this.historyPending.has(e)||!this.hasOlder(e))return;let t=this.sessions.get(e);t&&(this.historyPending.add(e),this.events.onHistoryPending?.(e,!0),this.send({type:`history`,sessionId:e,beforeIndex:Math.min(...t.messages.keys())}))}};function Sr(e,t){if(e)try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}if(t)try{let e=JSON.parse(t);return e?.pairId?[{...e,label:Cr([])}]:[]}catch{return[]}return[]}function Cr(e){let t=new Set(e.map(e=>e.label));for(let e=1;;e++){let n=`电脑 ${e}`;if(!t.has(n))return n}}function wr(e,t){return e.find(e=>e.pairId===t.pairId)?e.map(e=>e.pairId===t.pairId?{...t,label:e.label}:e):[...e,{...t,label:Cr(e)}]}function Tr(e,t){return e.filter(e=>e.pairId!==t)}function Er(e,t,n){let r=n.trim();return r?e.map(e=>e.pairId===t?{...e,label:r}:e):[...e]}function Dr(e,t){return e.find(e=>e.pairId===t)??e[0]??null}var Or=`enso-phone-launch`,kr=`/__open-session`,Ar=200,jr=/^[\w.:-]+$/;function Mr(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>Ar||!jr.test(t)?null:t}function Nr(e){if(typeof e!=`string`||!e)return null;let t=e.startsWith(`?`)?e.slice(1):e;return Mr(new URLSearchParams(t).get(`session`))}async function Pr(e=typeof caches>`u`?void 0:caches){if(!e)return null;try{let t=await e.open(Or),n=await t.match(kr);return await t.delete(kr),n?Mr(await n.text()):null}catch{return null}}var Fr=`enso-phone-push`;function Ir(e){return e.matchMedia(`(display-mode: standalone)`).matches||e.navigator.standalone===!0}function Lr(){if(Ir(window))return!0;try{return window.top!=null&&window.top!==window&&Ir(window.top)}catch{return!1}}function Rr(){return`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}function zr(){return Rr()?`ok`:/iphone|ipad|ipod/i.test(navigator.userAgent)&&!Lr()?`needs-install`:`unsupported`}async function Br(){if(!(`serviceWorker`in navigator))return null;try{return await navigator.serviceWorker.register(`/sw.js`)}catch{return null}}function Vr(e){let t=e+`=`.repeat((4-e.length%4)%4),n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(n,e=>e.charCodeAt(0))}function Hr(e){return e===`AbortError`?`service-unreachable`:e===`NotAllowedError`?`permission-denied`:`subscribe-failed`}async function Ur(e){if(!Rr())return{ok:!1,reason:`unsupported`};if(await Notification.requestPermission()!==`granted`)return{ok:!1,reason:`permission-denied`};let t=await navigator.serviceWorker.ready;try{let n=(await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Vr(e)})).toJSON();return!n.endpoint||!n.keys?.p256dh||!n.keys?.auth?{ok:!1,reason:`subscribe-failed`}:{ok:!0,subscription:{endpoint:n.endpoint,keys:{p256dh:n.keys.p256dh,auth:n.keys.auth}}}}catch(e){return{ok:!1,reason:Hr(e instanceof Error?e.name:``)}}}async function Wr(){if(`serviceWorker`in navigator)try{await(await(await navigator.serviceWorker.ready).pushManager.getSubscription())?.unsubscribe()}catch{}}var Gr=`enso-phone-ui-mode`,Kr=`/?mode=phone`;function qr(){return localStorage.getItem(`enso-phone-ui-mode`)===`desk`?`desk`:`phone`}function Jr(e){localStorage.setItem(Gr,e)}function Yr(e){return`/desk?device=${encodeURIComponent(e)}`}function Xr(e,t,n,r){if(t!==`desk`)return null;let i=new URLSearchParams(e);if(i.get(`mode`)===`phone`)return null;let a=Dr(n,r);if(!a||a.scope===`read`)return null;let o=Mr(i.get(`session`)),s=new URLSearchParams({device:a.pairId});return o&&s.set(`session`,o),`/desk?${s}`}var Zr=`enso-phone-pairing`,Qr=`enso-phone-devices`,$r=`enso-phone-active-device`,ei=`enso-phone-cursors`,ti=`enso-phone-last-session`,ni=e=>`enso-phone-cursors:${e}`,ri=e=>`enso-phone-last-session:${e}`,ii=e=>`enso-phone-last-bot-chat:${e}`;function ai(){let e=localStorage.getItem(Zr),t=Sr(localStorage.getItem(Qr),e);if(e&&t.length>0){oi(t),localStorage.removeItem(Zr);let e=t[0].pairId,n=localStorage.getItem(ei);n&&(localStorage.setItem(ni(e),n),localStorage.removeItem(ei));let r=localStorage.getItem(ti);r&&(localStorage.setItem(ri(e),r),localStorage.removeItem(ti)),localStorage.getItem($r)||ci(e)}return t}function oi(e){localStorage.setItem(Qr,JSON.stringify(e))}function si(){return localStorage.getItem($r)}function ci(e){e?localStorage.setItem($r,e):localStorage.removeItem($r)}function li(e){tr.clear(e),Lt.remove?.(e).catch(()=>{}),localStorage.removeItem(ni(e)),localStorage.removeItem(ri(e)),localStorage.removeItem(ii(e))}function ui(e){return localStorage.getItem(ri(e))}function di(e,t){t?localStorage.setItem(ri(e),t):localStorage.removeItem(ri(e))}function fi(e,t=null){return{activeId:t??(e?ui(e):null),botChatId:!t&&e?Mr(localStorage.getItem(ii(e))):null}}function pi(e,t){di(e,t.activeId),t.botChatId?localStorage.setItem(ii(e),t.botChatId):localStorage.removeItem(ii(e))}export{_e as $,hr as A,Nt as B,Dr as C,xr as D,wr as E,en as F,St as G,wt as H,on as I,gt as J,pt as K,Zt as L,nr as M,rr as N,mr as O,$t as P,we as Q,Qt as R,Pr as S,Er as T,bt as U,Lt as V,yt as W,tt as X,nt as Y,Te as Z,Br as _,ci as a,ue as at,Nr as b,Kr as c,i as ct,qr as d,Ce as et,Jr as f,zr as g,Lr as h,fi as i,le as it,gr as j,_r as k,Yr as l,Rr as m,si as n,ye as nt,oi as o,ae as ot,Fr as p,ht as q,ai as r,ve as rt,pi as s,ne as st,li as t,xe as tt,Xr as u,Ur as v,Tr as w,Mr as x,Wr as y,Xt as z};
|