@engenty/wizards-runtime 0.20.6 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/apps/runtime/dist/agents/studio-assistant.js +7 -3
- package/apps/runtime/dist/agents/subscription.js +4 -17
- package/apps/runtime/dist/app.js +4 -1
- package/apps/runtime/dist/cli/clients.js +6 -24
- package/apps/runtime/dist/cli/connect.js +2 -1
- package/apps/runtime/dist/cli/environment.js +3 -0
- package/apps/runtime/dist/cli/machine.js +1 -70
- package/apps/runtime/dist/cli/main.js +2 -1
- package/apps/runtime/dist/cli/ollama.js +1 -179
- package/apps/runtime/dist/cli/setup.js +8 -6
- package/apps/runtime/dist/docs/dev/licensing.md +15 -9
- package/apps/runtime/dist/docs/user-guide/command-line.md +3 -0
- package/apps/runtime/dist/elements/outside.js +2 -1
- package/apps/runtime/dist/engine/code-step.js +1 -1
- package/apps/runtime/dist/engine/decide.js +2 -2
- package/apps/runtime/dist/engine/input.js +1 -1
- package/apps/runtime/dist/engine/runner.js +1 -1
- package/apps/runtime/dist/engine/steps.js +27 -8
- package/apps/runtime/dist/engine/surface.js +1 -1
- package/apps/runtime/dist/engine/template.js +1 -1
- package/apps/runtime/dist/env.js +1 -0
- package/apps/runtime/dist/harness/clients.js +10 -1
- package/apps/runtime/dist/harness/index.js +15 -69
- package/apps/runtime/dist/harness/types.js +3 -2
- package/apps/runtime/dist/local-call.js +6 -0
- package/apps/runtime/dist/local-models.js +53 -157
- package/apps/runtime/dist/mcp/bridge.js +12 -55
- package/apps/runtime/dist/mcp/elements.js +39 -4
- package/apps/runtime/dist/mcp/handler.js +12 -0
- package/apps/runtime/dist/mcp/run-pages.js +238 -0
- package/apps/runtime/dist/mcp/run-tasks.js +157 -0
- package/apps/runtime/dist/mcp/runs.js +129 -0
- package/apps/runtime/dist/mcp/tools.js +4 -95
- package/apps/runtime/dist/models.js +74 -27
- package/apps/runtime/dist/prompts/mcp.md +4 -1
- package/apps/runtime/dist/render/downloads.js +1 -1
- package/apps/runtime/dist/render/shaped.js +1 -1
- package/apps/runtime/dist/routes/model-setup.js +77 -0
- package/apps/runtime/dist/routes/studio.js +8 -251
- package/apps/runtime/dist/services/space-categories.js +1 -1
- package/apps/runtime/dist/services/work-ai.js +10 -4
- package/apps/runtime/dist/texts.js +4 -6
- package/apps/runtime/dist/tools/connections.js +3 -0
- package/apps/runtime/dist/tools/harness.js +124 -0
- package/apps/web/dist/assets/AboutDialog-BSdAA4Wi.js +1 -0
- package/apps/web/dist/assets/{BlockEditor-CgjXTWly.js → BlockEditor-0noqMcAl.js} +1 -1
- package/apps/web/dist/assets/Bundle-Ctrq7lHH.js +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-CZlVhBmU.js +2 -0
- package/apps/web/dist/assets/ChangelogDialog-BLCYV4jT.js +1 -0
- package/apps/web/dist/assets/{CodeEditor-2LyHbSre.js → CodeEditor-CpRn9BZq.js} +1 -1
- package/apps/web/dist/assets/ConnectorsSection-B4rRDlFo.js +1 -0
- package/apps/web/dist/assets/EditorPage-CXN-_zzG.js +3 -0
- package/apps/web/dist/assets/FlowPreview-DjQvcWxs.js +1 -0
- package/apps/web/dist/assets/LangSwitch-BuzsLp16.js +1 -0
- package/apps/web/dist/assets/LocalModels-BDfP2v5-.js +1 -0
- package/apps/web/dist/assets/Marketplace-4baBNzEc.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-B_xHm-bI.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-BmZAY4zi.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-fZq3WiTk.js +1 -0
- package/apps/web/dist/assets/ProtocolSection-v9wIxisg.js +1 -0
- package/apps/web/dist/assets/PublicRunner-BCh0VzAT.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-CO3ndR23.js → ReadOnly-13stkvNz.js} +1 -1
- package/apps/web/dist/assets/Results-4gmguYzH.js +1 -0
- package/apps/web/dist/assets/RunDrawer-CeEldWRn.js +1 -0
- package/apps/web/dist/assets/SettingsPage-BsKRRlfP.js +2 -0
- package/apps/web/dist/assets/SetupPage-FgA5Kl8z.js +1 -0
- package/apps/web/dist/assets/SharePage-BlBW4oxl.js +1 -0
- package/apps/web/dist/assets/SkillEditor-9QSskfmY.js +1 -0
- package/apps/web/dist/assets/Skills-DdUAyNhR.js +9 -0
- package/apps/web/dist/assets/SpacePage-CHkNPuqt.js +2 -0
- package/apps/web/dist/assets/StudioHome-BwPD-inc.js +1 -0
- package/apps/web/dist/assets/TableEditor-Du1DhbEC.js +7 -0
- package/apps/web/dist/assets/UpdateCheck-DPr9NXq_.js +2 -0
- package/apps/web/dist/assets/brand-DY3lzrOd.js +2 -0
- package/apps/web/dist/assets/changelog-BSdb22c3.js +1 -0
- package/apps/web/dist/assets/code-editor-Bep_LzQ5.js +2 -0
- package/apps/web/dist/assets/host-DiZQ_uws.js +1 -0
- package/apps/web/dist/assets/host-Dw-sMUSd.js +54 -0
- package/apps/web/dist/assets/i18n-DVrYWJaj.js +55 -0
- package/apps/web/dist/assets/index-C2gxK14s.css +1 -0
- package/apps/web/dist/assets/index-lQ4JYHYQ.js +102 -0
- package/apps/web/dist/assets/oss-credits-BHy69wkx.js +1 -0
- package/apps/web/dist/assets/{read-aloud-CRFt5q6k.js → read-aloud-CBycd8TA.js} +1 -1
- package/apps/web/dist/assets/{session-RDdtfee2.js → session-BYLtgklo.js} +1 -1
- package/apps/web/dist/assets/terminal-DmGdMags.js +16 -0
- package/apps/web/dist/assets/texts-ClKS2xhh.js +1 -0
- package/apps/web/dist/assets/theme-DFDOMsVo.js +14 -0
- package/apps/web/dist/assets/ui-CW2I3ecu.js +1 -0
- package/apps/web/dist/assets/ui-DfVpZYIW.js +16 -0
- package/apps/web/dist/assets/{useMutation-BSffqL6W.js → useMutation-BnkuLlQC.js} +1 -1
- package/apps/web/dist/assets/viewers-C6FfRwG1.js +2 -0
- package/apps/web/dist/index.html +18 -16
- package/apps/web/dist/mcp/flow.html +129 -129
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.js +1 -1
- package/node_modules/@engenty/chatviews/dist/chat/a2ui.d.ts +48 -0
- package/node_modules/@engenty/chatviews/dist/chat/a2ui.js +514 -0
- package/node_modules/@engenty/chatviews/dist/chat/check.d.ts +18 -0
- package/node_modules/@engenty/chatviews/dist/chat/check.js +97 -0
- package/node_modules/@engenty/chatviews/dist/chat/index.d.ts +3 -0
- package/node_modules/@engenty/chatviews/dist/chat/index.js +4 -0
- package/node_modules/@engenty/chatviews/dist/chat/library.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/chat/library.js +314 -0
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.js +1 -1
- package/node_modules/@engenty/chatviews/dist/react/chat.d.ts +33 -0
- package/node_modules/@engenty/chatviews/dist/react/chat.js +150 -0
- package/node_modules/@engenty/chatviews/dist/react/field-looks.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/field-looks.js +47 -0
- package/node_modules/@engenty/chatviews/dist/react/markdown.d.ts +5 -0
- package/node_modules/@engenty/chatviews/dist/react/markdown.js +11 -0
- package/node_modules/@engenty/chatviews/dist/react/no-devtools.d.ts +0 -0
- package/node_modules/@engenty/chatviews/dist/react/no-devtools.js +8 -0
- package/node_modules/@engenty/chatviews/dist/react/surface.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/surface.js +552 -0
- package/node_modules/@engenty/chatviews/dist/react/texts.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/texts.js +42 -0
- package/node_modules/@engenty/chatviews/dist/react/ui.d.ts +112 -0
- package/node_modules/@engenty/chatviews/dist/react/ui.js +212 -0
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.js +1 -1
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.js +1 -1
- package/node_modules/@engenty/chatviews/package.json +19 -0
- package/node_modules/@engenty/decision-model/dist/client.d.ts +76 -0
- package/node_modules/@engenty/decision-model/dist/client.js +188 -0
- package/node_modules/@engenty/decision-model/dist/index.d.ts +6 -0
- package/node_modules/@engenty/decision-model/dist/index.js +5 -0
- package/node_modules/@engenty/decision-model/dist/local.d.ts +11 -0
- package/node_modules/@engenty/decision-model/dist/local.js +116 -0
- package/node_modules/@engenty/decision-model/dist/resolve.d.ts +26 -0
- package/node_modules/@engenty/decision-model/dist/resolve.js +53 -0
- package/node_modules/@engenty/decision-model/dist/types.d.ts +80 -0
- package/node_modules/@engenty/decision-model/dist/types.js +6 -0
- package/node_modules/@engenty/decision-model/dist/validate.d.ts +9 -0
- package/node_modules/@engenty/decision-model/dist/validate.js +50 -0
- package/node_modules/@engenty/decision-model/dist/ways.d.ts +42 -0
- package/node_modules/@engenty/decision-model/dist/ways.js +72 -0
- package/node_modules/@engenty/decision-model/package.json +9 -0
- package/node_modules/@engenty/local-models/dist/bridge/index.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/bridge/index.js +117 -0
- package/node_modules/@engenty/local-models/dist/clients/antigravity.d.ts +37 -0
- package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/antigravity.js +68 -17
- package/node_modules/@engenty/local-models/dist/clients/claude.js +1 -0
- package/node_modules/@engenty/local-models/dist/clients/client.d.ts +3 -1
- package/node_modules/@engenty/local-models/dist/clients/client.js +1 -1
- package/node_modules/@engenty/local-models/dist/clients/codex.js +1 -0
- package/node_modules/@engenty/local-models/dist/clients/cursor.d.ts +2 -0
- package/node_modules/@engenty/local-models/dist/clients/cursor.js +13 -1
- package/node_modules/@engenty/local-models/dist/clients/index.d.ts +2 -1
- package/node_modules/@engenty/local-models/dist/clients/index.js +4 -2
- package/node_modules/@engenty/local-models/dist/clients/model.d.ts +4 -1
- package/node_modules/@engenty/local-models/dist/index.d.ts +2 -1
- package/node_modules/@engenty/local-models/dist/index.js +2 -1
- package/node_modules/@engenty/local-models/dist/lmstudio/api.d.ts +49 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/api.js +101 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/load.d.ts +12 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/load.js +100 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/server.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/server.js +29 -0
- package/node_modules/@engenty/local-models/dist/mlx/helper.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/mlx/helper.js +149 -0
- package/node_modules/@engenty/local-models/dist/mlx/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/mlx/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/mlx/server.d.ts +19 -0
- package/node_modules/@engenty/local-models/dist/mlx/server.js +82 -0
- package/node_modules/@engenty/local-models/dist/mlx/store.d.ts +16 -0
- package/node_modules/@engenty/local-models/dist/mlx/store.js +153 -0
- package/node_modules/@engenty/local-models/dist/ollama/api.d.ts +4 -37
- package/node_modules/@engenty/local-models/dist/ollama/api.js +1 -18
- package/node_modules/@engenty/local-models/dist/ollama/index.d.ts +2 -1
- package/node_modules/@engenty/local-models/dist/ollama/index.js +2 -1
- package/node_modules/@engenty/local-models/dist/ollama/model.d.ts +2 -0
- package/node_modules/@engenty/local-models/dist/ollama/model.js +1 -1
- package/node_modules/@engenty/local-models/dist/ollama/server.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/ollama/server.js +45 -0
- package/node_modules/@engenty/local-models/dist/probe.d.ts +11 -8
- package/node_modules/@engenty/local-models/dist/probe.js +16 -32
- package/node_modules/@engenty/local-models/dist/servers/index.d.ts +6 -0
- package/node_modules/@engenty/local-models/dist/servers/index.js +12 -0
- package/node_modules/@engenty/local-models/dist/servers/server.d.ts +84 -0
- package/node_modules/@engenty/local-models/dist/servers/server.js +38 -0
- package/node_modules/@engenty/local-models/package.json +5 -1
- package/node_modules/@engenty/model-setup/dist/catalog.d.ts +36 -0
- package/node_modules/@engenty/model-setup/dist/catalog.js +81 -0
- package/node_modules/@engenty/model-setup/dist/index.d.ts +3 -0
- package/node_modules/@engenty/model-setup/dist/index.js +3 -0
- package/node_modules/@engenty/model-setup/dist/offered.d.ts +7 -0
- package/node_modules/@engenty/model-setup/dist/offered.js +64 -0
- package/node_modules/@engenty/model-setup/dist/react/client.d.ts +46 -0
- package/node_modules/@engenty/model-setup/dist/react/client.js +147 -0
- package/node_modules/@engenty/model-setup/dist/react/columns.d.ts +78 -0
- package/node_modules/@engenty/model-setup/dist/react/columns.js +99 -0
- package/node_modules/@engenty/model-setup/dist/react/host.d.ts +31 -0
- package/node_modules/@engenty/model-setup/dist/react/host.js +48 -0
- package/node_modules/@engenty/model-setup/dist/react/index.d.ts +7 -0
- package/node_modules/@engenty/model-setup/dist/react/index.js +7 -0
- package/node_modules/@engenty/model-setup/dist/react/keys.d.ts +48 -0
- package/node_modules/@engenty/model-setup/dist/react/keys.js +74 -0
- package/node_modules/@engenty/model-setup/dist/react/local-models.d.ts +23 -0
- package/node_modules/@engenty/model-setup/dist/react/local-models.js +134 -0
- package/node_modules/@engenty/model-setup/dist/react/servers.d.ts +4 -0
- package/node_modules/@engenty/model-setup/dist/react/servers.js +13 -0
- package/node_modules/@engenty/model-setup/dist/react/terminal.d.ts +13 -0
- package/node_modules/@engenty/model-setup/dist/react/terminal.js +79 -0
- package/node_modules/@engenty/model-setup/dist/react/tone.d.ts +13 -0
- package/node_modules/@engenty/model-setup/dist/react/tone.js +66 -0
- package/node_modules/@engenty/model-setup/dist/server/apps.d.ts +12 -0
- package/node_modules/@engenty/model-setup/dist/server/apps.js +22 -0
- package/node_modules/@engenty/model-setup/dist/server/clients.d.ts +55 -0
- package/node_modules/@engenty/model-setup/dist/server/clients.js +96 -0
- package/node_modules/@engenty/model-setup/dist/server/index.d.ts +8 -0
- package/node_modules/@engenty/model-setup/dist/server/index.js +8 -0
- package/node_modules/@engenty/model-setup/dist/server/install.d.ts +24 -0
- package/node_modules/@engenty/model-setup/dist/server/install.js +68 -0
- package/node_modules/@engenty/model-setup/dist/server/lmstudio.d.ts +9 -0
- package/node_modules/@engenty/model-setup/dist/server/lmstudio.js +52 -0
- package/node_modules/@engenty/model-setup/dist/server/local-models.d.ts +47 -0
- package/node_modules/@engenty/model-setup/dist/server/local-models.js +164 -0
- package/node_modules/@engenty/model-setup/dist/server/models.d.ts +12 -0
- package/node_modules/@engenty/model-setup/dist/server/models.js +16 -0
- package/node_modules/@engenty/model-setup/dist/server/ollama.d.ts +22 -0
- package/node_modules/@engenty/model-setup/dist/server/ollama.js +146 -0
- package/node_modules/@engenty/model-setup/dist/server/routes.d.ts +51 -0
- package/node_modules/@engenty/model-setup/dist/server/routes.js +211 -0
- package/node_modules/@engenty/model-setup/dist/server/server-apps.d.ts +14 -0
- package/node_modules/@engenty/model-setup/dist/server/server-apps.js +24 -0
- package/node_modules/@engenty/model-setup/dist/server/terminal.d.ts +43 -0
- package/node_modules/@engenty/model-setup/dist/server/terminal.js +222 -0
- package/node_modules/@engenty/model-setup/dist/texts.d.ts +222 -0
- package/node_modules/@engenty/model-setup/dist/texts.js +222 -0
- package/node_modules/@engenty/model-setup/dist/types.d.ts +111 -0
- package/node_modules/@engenty/model-setup/dist/types.js +2 -0
- package/node_modules/@engenty/model-setup/package.json +12 -0
- package/node_modules/@engenty/search-index/dist/catalog-lexical.d.ts +14 -0
- package/node_modules/@engenty/search-index/dist/catalog-lexical.js +165 -0
- package/node_modules/@engenty/search-index/dist/catalog-rank.d.ts +33 -0
- package/node_modules/@engenty/search-index/dist/catalog-rank.js +99 -0
- package/node_modules/@engenty/search-index/dist/catalog-search.d.ts +40 -0
- package/node_modules/@engenty/search-index/dist/catalog-search.js +161 -0
- package/node_modules/@engenty/search-index/dist/chunks.d.ts +17 -0
- package/node_modules/@engenty/search-index/dist/chunks.js +164 -0
- package/node_modules/@engenty/search-index/dist/contracts.d.ts +135 -0
- package/node_modules/@engenty/search-index/dist/contracts.js +9 -0
- package/node_modules/@engenty/search-index/dist/embedder.d.ts +31 -0
- package/node_modules/@engenty/search-index/dist/embedder.js +82 -0
- package/node_modules/@engenty/search-index/dist/embedders/gemini.d.ts +11 -0
- package/node_modules/@engenty/search-index/dist/embedders/gemini.js +54 -0
- package/node_modules/@engenty/search-index/dist/embedders/index.d.ts +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/index.js +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/ollama.d.ts +12 -0
- package/node_modules/@engenty/search-index/dist/embedders/ollama.js +43 -0
- package/node_modules/@engenty/search-index/dist/embedders/openai.d.ts +11 -0
- package/node_modules/@engenty/search-index/dist/embedders/openai.js +36 -0
- package/node_modules/@engenty/search-index/dist/embedders/shared.d.ts +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/shared.js +26 -0
- package/node_modules/@engenty/search-index/dist/embedders/ways.d.ts +16 -0
- package/node_modules/@engenty/search-index/dist/embedders/ways.js +90 -0
- package/node_modules/@engenty/search-index/dist/index.d.ts +10 -0
- package/node_modules/@engenty/search-index/dist/index.js +10 -0
- package/node_modules/@engenty/search-index/dist/payload.d.ts +13 -0
- package/node_modules/@engenty/search-index/dist/payload.js +51 -0
- package/node_modules/@engenty/search-index/dist/registry.d.ts +25 -0
- package/node_modules/@engenty/search-index/dist/registry.js +56 -0
- package/node_modules/@engenty/search-index/dist/scoring.d.ts +10 -0
- package/node_modules/@engenty/search-index/dist/scoring.js +45 -0
- package/node_modules/@engenty/search-index/dist/strategy.d.ts +6 -0
- package/node_modules/@engenty/search-index/dist/strategy.js +25 -0
- package/node_modules/@engenty/search-index/package.json +10 -0
- package/node_modules/@engenty/tool-harness/dist/harness.d.ts +70 -0
- package/node_modules/@engenty/tool-harness/dist/harness.js +170 -0
- package/node_modules/@engenty/tool-harness/dist/index.d.ts +5 -0
- package/node_modules/@engenty/tool-harness/dist/index.js +5 -0
- package/node_modules/@engenty/tool-harness/dist/judge.d.ts +8 -0
- package/node_modules/@engenty/tool-harness/dist/judge.js +39 -0
- package/node_modules/@engenty/tool-harness/dist/levels.d.ts +18 -0
- package/node_modules/@engenty/tool-harness/dist/levels.js +47 -0
- package/node_modules/@engenty/tool-harness/dist/model.d.ts +6 -0
- package/node_modules/@engenty/tool-harness/dist/model.js +60 -0
- package/node_modules/@engenty/tool-harness/dist/schema.d.ts +26 -0
- package/node_modules/@engenty/tool-harness/dist/schema.js +57 -0
- package/node_modules/@engenty/tool-harness/package.json +9 -0
- package/node_modules/@engenty/wizards-shared/dist/catalog-prompt.js +2 -1
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +10 -10
- package/node_modules/@engenty/wizards-shared/dist/definition.js +4 -4
- package/node_modules/@engenty/wizards-shared/dist/run-schema.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +3 -1
- package/node_modules/@engenty/wizards-shared/dist/run.js +4 -0
- package/node_modules/@engenty/wizards-shared/dist/store.js +2 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-agents.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-agents.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-text.js +2 -2
- package/package.json +11 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/runtime/dist/harness/terminal.js +0 -201
- package/apps/web/dist/assets/AboutDialog-BRUwrfQH.js +0 -1
- package/apps/web/dist/assets/Bundle-C0u5HUZL.js +0 -1
- package/apps/web/dist/assets/CapabilitiesPage-C30knXsS.js +0 -2
- package/apps/web/dist/assets/ChangelogDialog-BkZQOAdl.js +0 -1
- package/apps/web/dist/assets/ConnectorsSection-CmXQD7zu.js +0 -1
- package/apps/web/dist/assets/EditorPage-LEbyNWmG.js +0 -3
- package/apps/web/dist/assets/FlowPreview-BXf4EKjU.js +0 -1
- package/apps/web/dist/assets/LangSwitch-BLB7dDce.js +0 -1
- package/apps/web/dist/assets/Marketplace-B3NoH5Va.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-CSn-9zHr.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-B4wPfClS.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-RawpCO9J.js +0 -1
- package/apps/web/dist/assets/ProtocolSection-s4mEL_pu.js +0 -1
- package/apps/web/dist/assets/PublicRunner-COatyxMi.js +0 -1
- package/apps/web/dist/assets/Results-CC1-mElv.js +0 -1
- package/apps/web/dist/assets/RunDrawer-DkmSXhad.js +0 -1
- package/apps/web/dist/assets/SettingsPage-DKs_fkNL.js +0 -2
- package/apps/web/dist/assets/SetupPage-RvmKCzF2.js +0 -1
- package/apps/web/dist/assets/SharePage-Drntg_oj.js +0 -1
- package/apps/web/dist/assets/SkillEditor-Ca_bzmjD.js +0 -1
- package/apps/web/dist/assets/Skills-BcgxuD15.js +0 -9
- package/apps/web/dist/assets/SpacePage-aZqYFttF.js +0 -2
- package/apps/web/dist/assets/StudioHome-Doua9Lyl.js +0 -1
- package/apps/web/dist/assets/TableEditor-Dbq3HZZS.js +0 -7
- package/apps/web/dist/assets/UpdateCheck-B7etUbUf.js +0 -2
- package/apps/web/dist/assets/brand-BIT7AumL.js +0 -2
- package/apps/web/dist/assets/changelog-BW79cVbx.js +0 -1
- package/apps/web/dist/assets/code-editor-CufyaUFC.js +0 -2
- package/apps/web/dist/assets/host-BXSxBoOH.js +0 -69
- package/apps/web/dist/assets/i18n-WXeVnv7i.js +0 -55
- package/apps/web/dist/assets/index-D1iL3986.css +0 -1
- package/apps/web/dist/assets/index-kDKA6ddy.js +0 -102
- package/apps/web/dist/assets/oss-credits-B3PXhamW.js +0 -1
- package/apps/web/dist/assets/theme-23bNrOQh.js +0 -14
- package/apps/web/dist/assets/ui-DkEhb2Rt.js +0 -16
- package/apps/web/dist/assets/viewers-CmGDpBjn.js +0 -2
- /package/apps/web/dist/assets/{host-BrP-ENHg.css → terminal-BrP-ENHg.css} +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.d.ts +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/qr-scanner.min-Do0JFUkk.js","assets/preload-helper-Cj7BV335.js","assets/pdfmake-D9CKNq4W.js","assets/rolldown-runtime-XKyaHtl9.js","assets/vfs_fonts-BjQxQix9.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v}from"./ui-CW2I3ecu.js";import{n as y,t as b}from"./jsx-runtime-C3cWAN_r.js";import{a as x,c as S,d as C,i as w,l as T,n as E,o as D,r as O,s as k,t as ee,u as A}from"./marked.esm-BfGIZK7F.js";import{$ as j,Bt as M,G as te,It as N,Lt as ne,M as re,Mt as ie,Nt as P,Pt as ae,Q as oe,R as F,Rt as se,Z as ce,_ as I,_t as le,d as ue,f as de,g as fe,gt as pe,h as me,it as L,jt as he,lt as R,m as ge,mt as _e,n as ve,p as ye,s as z,tt as be,u as xe,v as Se,yt as Ce,zt as we}from"./i18n-DVrYWJaj.js";import{n as B,r as Te}from"./texts-ClKS2xhh.js";import{t as Ee}from"./preload-helper-Cj7BV335.js";var V=t(y(),1),H=t(b(),1),De=V.createContext(void 0),Oe=e=>{let t=V.useContext(De);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ke=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,H.jsx)(De.Provider,{value:e,children:t})),Ae={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},je=new class{#e=Ae;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Me(e){setTimeout(e,0)}var Ne=typeof window>`u`||`Deno`in globalThis;function Pe(){}function Fe(e,t){return typeof e==`function`?e(t):e}function Ie(e){return typeof e==`number`&&e>=0&&e!==1/0}function Le(e,t){return Math.max(e+(t||0)-Date.now(),0)}function U(e,t){return typeof e==`function`?e(t):e}function Re(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Be(o,t.options))return!1}else if(!He(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ze(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ve(t.options.mutationKey)!==Ve(a))return!1}else if(!He(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Be(e,t){return(t?.queryKeyHashFn||Ve)(e)}function Ve(e){return JSON.stringify(e,(e,t)=>qe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function He(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!He(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!He(e[r],t[r]))return!1;return!0}return!1}var Ue=Object.prototype.hasOwnProperty;function We(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ke(e)&&Ke(t);if(!r&&!(qe(e)&&qe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Ue.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=We(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ge(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n of Object.keys(e))if(!Ue.call(t,n)||e[n]!==t[n])return!1;return!0}function Ke(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qe(e){if(!Je(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!Je(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function Je(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ye(e){return new Promise(t=>{je.setTimeout(t,e)})}function Xe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:We(e,t)}function Ze(e){return e}function Qe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(-n):r}function $e(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,n):r}var et=Symbol();function tt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===et?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nt(e,t){return typeof e==`function`?e(...t):!!e}var W=Symbol();function rt(e,t,n,r){let i=!1,a;return Object.defineProperties(e,{[W]:{value:r},signal:{enumerable:!0,get:()=>(a??=t(),i||(i=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0})),a)}}),e}var it=()=>Ne,at=()=>it(),ot=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},st=new class extends ot{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ct=Me;function lt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ct,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ut=lt(),dt=new class extends ot{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ft(e){return Math.min(1e3*2**e,3e4)}function pt(e){return(e??`online`)!==`online`||dt.isOnline()}var mt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ht(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Pe);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new mt(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>st.isFocused()&&(e.networkMode===`always`||dt.isOnline())&&e.canRun(),p=()=>pt(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(at()?0:3),a=e.retryDelay??ft,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),Ye(o).then(()=>c()||f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var gt=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ie(this.gcTime)&&(this.#e=je.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(at()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(je.clearTimeout(this.#e),this.#e=void 0)}};function _t(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=t,u=e=>{rt(e,()=>t.signal,()=>n=!0,l[W])},d=tt(t.options,t.fetchOptions),f=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})(),o=await d(a),{maxPages:s}=t.options,c=i?$e:Qe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?yt:vt,n={pages:a,pageParams:o};s=await f(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:vt(r,s);if(c>0&&e==null)break;s=await f(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function vt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function yt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function bt(e,t){return t?vt(e,t)!=null:!1}function xt(e,t){return!t||!e.getPreviousPageParam?!1:yt(e,t)!=null}var St=class extends gt{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Tt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Tt(this.options);e.data!==void 0&&(this.setState(wt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Xe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Pe).catch(Pe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>U(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===et||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>U(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Le(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#o)return this.#a.continueRetry(),this.#o}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperties(e,{[W]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=tt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?_t(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ht({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof mt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),s=(async()=>{try{let e=await o.promise;if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof mt){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ct(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...wt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ut.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ct(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function wt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Tt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Et=class extends ot{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ot(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof U(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ge(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&At(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||U(this.options.enabled,this.#t)!==U(t.enabled,this.#t)||U(this.options.staleTime,this.#t)!==U(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||U(this.options.enabled,this.#t)!==U(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ge(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Pe)),t}#h(e){return!at()&&U(this.options.enabled,this.#t)!==!1&&Ie(e)}#g(){this.#b();let e=U(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Le(this.#r.dataUpdatedAt,e)+1;this.#u=je.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return U(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=je.setInterval(()=>{(this.options.refetchIntervalInBackground||st.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(je.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(je.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ot(e,t),o=i&&At(e,n,t,r);(a||o)&&(l={...l,...Ct(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Xe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Xe(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:jt(e,t),refetch:this.refetch,isEnabled:U(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Ge(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();ut.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Dt(e,t){return U(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||U(t.retryOnMount,e)!==!1)}function Ot(e,t){return Dt(e,t)||e.state.data!==void 0&&kt(e,t,t.refetchOnMount)}function kt(e,t,n){if(U(t.enabled,e)!==!1&&U(t.staleTime,e)!==`static`){let r=U(n,e);return r===`always`||r!==!1&&jt(e,t)}return!1}function At(e,t,n,r){return(e!==t||U(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&jt(e,n)}function jt(e,t){return U(t.enabled,e)!==!1&&e.isStaleByTime(U(t.staleTime,e))}var Mt=V.createContext(!1),Nt=()=>V.useContext(Mt);Mt.Provider;function Pt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ft=V.createContext(Pt()),It=()=>V.useContext(Ft),Lt=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?nt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Rt=e=>{V.useEffect(()=>{e.clearReset()},[e])},zt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||nt(n,[e.error,r])),Bt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Vt=(e,t)=>e?.suspense&&t.isPending,Ht=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ut(e,t,n){let r=Nt(),i=It(),a=Oe(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Bt(o),Lt(o,i,s),Rt(i);let[l]=V.useState(()=>new t(a,o)),u=l.getOptimisticResult(o);V.useEffect(()=>{l.setOptions(o)},[o,l]);let d=!r&&c;if(V.useSyncExternalStore(V.useCallback(e=>{let t=d?l.subscribe(ut.batchCalls(e)):Pe;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Vt(o,u))throw Ht(o,l,i);if(zt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Wt(e,t){return Ut(e,Et,t)}var Gt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Kt=/^[\\/]{2}/;function qt(e,t){return t+e.replace(/\\/g,`/`)}var Jt=`popstate`;function Yt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Xt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return en(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:tn(t)}return rn(t,n,null,e)}function G(e,t){if(e===!1||e==null)throw Error(t)}function Zt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Qt(){return Math.random().toString(36).substring(2,10)}function $t(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function en(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?nn(t):t,state:n,key:t&&t.key||r||Qt(),mask:i}}function tn({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function nn(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function rn(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Yt(e)?e:en(h.location,e,t);n&&n(r,e),l=u()+1;let d=$t(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Yt(e)?e:en(h.location,e,t);n&&n(r,e),l=u();let i=$t(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return an(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Jt,d),c=e,()=>{i.removeEventListener(Jt,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function an(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),G(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:tn(t);return i=i.replace(/ $/,`%20`),!n&&Kt.test(i)&&(i=r+i),new URL(i,r)}function on(e,t,n=`/`){return sn(e,t,n,!1)}function sn(e,t,n,r,i){let a=On((typeof t==`string`?nn(t):t).pathname||`/`,n);if(a==null)return null;let o=i??cn(e),s=null,c=Dn(a);for(let e=0;s==null&&e<o.length;++e)s=Cn(o[e],c,r);return s}function cn(e){let t=ln(e);return dn(t),t}function ln(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;G(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=In([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(G(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ln(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:xn(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=En(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of un(e.path))a(e,t,!0,n)}),t}function un(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=un(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function dn(e){e.sort((e,t)=>e.score===t.score?Sn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var fn=/^:[\w-]+$/,pn=/^:[\w-]+/,mn=3.5,hn=3,gn=2,_n=1,vn=10,yn=-2,bn=e=>e===`*`;function xn(e,t){let n=e.split(`/`),r=n.length;return n.some(bn)&&(r+=yn),t&&(r+=gn),n.filter(e=>!bn(e)).reduce((e,t)=>e+(fn.test(t)?hn:pn.test(t)?mn:t===``?_n:vn),r)}function Sn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Cn(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Tn(u,l,s.matcher,s.compiledParams):wn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=wn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:In([a,d.pathname]),pathnameBase:Rn(In([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=In([a,d.pathnameBase]))}return o}function wn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=En(e.path,e.caseSensitive,e.end);return Tn(e,t,n,r)}function Tn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=Ln(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=Ln(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function En(e,t=!1,n=!0){Zt(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Dn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Zt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function On(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function kn(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?nn(e):e,a;return n?(n=Fn(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?An(n.substring(1),`/`):An(n,t)):a=t,{pathname:a,search:zn(r),hash:Bn(i)}}function An(e,t){let n=Ln(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function jn(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Mn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Nn(e){let t=Mn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Pn(e,t,n,r=!1){let i;typeof e==`string`?i=nn(e):(i={...e},G(!i.pathname||!i.pathname.includes(`?`),jn(`?`,`pathname`,`search`,i)),G(!i.pathname||!i.pathname.includes(`#`),jn(`#`,`pathname`,`hash`,i)),G(!i.search||!i.search.includes(`#`),jn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=kn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Fn=e=>e.replace(/[\\/]{2,}/g,`/`),In=e=>Fn(e.join(`/`));function Ln(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Rn=e=>Ln(e).replace(/^\/*/,`/`),zn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Bn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Vn=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Hn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Un(e){return In(e.map(e=>e.route.path).filter(Boolean))||`/`}var Wn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Gn(e,t){let n=e;if(typeof n!=`string`||!Gt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Wn)try{let e=new URL(window.location.href),r=Kt.test(n)?new URL(qt(n,e.protocol)):new URL(n),a=On(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Zt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var Kn=new URL(`http://localhost`);function qn(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Kn)}catch{return Kn}}function Jn(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Yn(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function Xn(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Jn(i,n),s=!Jn(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Yn(e,i)||!Jn(i,a)))throw Error(`External navigation is not allowed`)}var Zn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Zn);var Qn=[`GET`,...Zn];new Set(Qn);var $n=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function er(e){try{return $n.includes(new URL(e).protocol)}catch{return!1}}var tr=V.createContext(null);tr.displayName=`DataRouter`;var nr=V.createContext(null);nr.displayName=`DataRouterState`;var rr=V.createContext(null);rr.displayName=`DataRouterData`;var ir=V.createContext(null);ir.displayName=`DataRouterNavigation`;var ar=V.createContext(!1);function or(){return V.useContext(ar)}var sr=V.createContext({isTransitioning:!1});sr.displayName=`ViewTransition`;var cr=V.createContext(null);cr.displayName=`Fetchers`;var lr=V.createContext(null);lr.displayName=`Await`;var ur=V.createContext(null);ur.displayName=`Navigation`;var dr=V.createContext(null);dr.displayName=`Location`;var fr=V.createContext({outlet:null,matches:[],isDataRoute:!1});fr.displayName=`Route`;var pr=V.createContext(!1);pr.displayName=`IsDataRoute`;var mr=V.createContext(void 0);mr.displayName=`RouteId`;var hr=V.createContext(null);hr.displayName=`RouteError`;var gr=`REACT_ROUTER_ERROR`,_r=`REDIRECT`,vr=`ROUTE_ERROR_RESPONSE`;function yr(e){if(e.startsWith(`${gr}:${_r}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function br(e){if(e.startsWith(`${gr}:${vr}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Vn(t.status,t.statusText,t.data)}catch{}}function xr(e,{relative:t}={}){G(Sr(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=V.useContext(ur),{hash:i,pathname:a,search:o}=Or(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:In([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Sr(){return V.useContext(dr)!=null}function Cr(){return G(Sr(),`useLocation() may be used only in the context of a <Router> component.`),V.useContext(dr).location}var wr=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Tr(){return V.useContext(pr)?Wr():Er()}function Er(){G(Sr(),`useNavigate() may be used only in the context of a <Router> component.`);let e=V.useContext(tr),{basename:t,navigator:n}=V.useContext(ur),{matches:r}=V.useContext(fr),{pathname:i}=Cr(),a=JSON.stringify(Nn(r)),o=V.useRef(!1);return V.useLayoutEffect(()=>{o.current=!0}),V.useCallback((r,s={})=>{if(Zt(o.current,wr),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Pn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:In([t,c.pathname])),Xn(typeof r==`string`?r:tn(r),n.createHref(c),qn(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}V.createContext(null);function Dr(){let{matches:e}=V.useContext(fr);return e[e.length-1]?.params??{}}function Or(e,{relative:t}={}){let{matches:n}=V.useContext(fr),{pathname:r}=Cr(),i=JSON.stringify(Nn(n));return V.useMemo(()=>Pn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function kr(e,t){return Ar(e,t)}function Ar(e,t,n){G(Sr(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=V.useContext(ur),{matches:i}=V.useContext(fr),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=Cr(),l;if(t){let e=typeof t==`string`?nn(t):t;G(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f;f=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):on(e,{pathname:d});let p=Lr(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:In([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:In([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?V.createElement(dr.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function jr(){let e=Ur(),t=Hn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return V.createElement(V.Fragment,null,V.createElement(`h2`,null,`Unexpected Application Error!`),V.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?V.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Mr=V.createElement(jr,null),Nr=class extends V.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=ar;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=br(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:V.createElement(fr.Provider,{value:this.props.routeContext},V.createElement(pr.Provider,{value:this.props.routeContext.isDataRoute},V.createElement(mr.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},V.createElement(hr.Provider,{value:e,children:this.props.component}))));return this.context?V.createElement(Fr,{error:e},t):t}},Pr=new WeakMap;function Fr({children:e,error:t}){let{basename:n,navigator:r}=V.useContext(ur);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=yr(t.digest);if(e){let i=Pr.get(t);if(i)throw i;let a=Gn(e.location,n),o=a.absoluteURL||a.to;if(Xn(e.location,o,qn(r),`allow-explicit`),er(o))throw Error(`Invalid redirect location`);if(Wn&&!Pr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Pr.set(t,n),n}}return V.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function Ir({routeContext:e,match:t,children:n}){let r=V.useContext(tr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),V.createElement(fr.Provider,{value:e},V.createElement(pr.Provider,{value:e.isDataRoute},V.createElement(mr.Provider,{value:t.route.id},n)))}function Lr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);G(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Un(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Mr,o&&(s<0&&c===0?(Kr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?V.createElement(n.route.Component,null):n.route.element?n.route.element:e,V.createElement(Ir,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?V.createElement(Nr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Rr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zr(e){let t=V.useContext(tr);return G(t,Rr(e)),t}function Br(e){let t=V.useContext(nr);return G(t,Rr(e)),t}function Vr(e){let t=V.useContext(rr);return G(t,Rr(e)),t}function Hr(e){let t=V.useContext(mr);return G(t,`${e} can only be used on routes that contain a unique "id"`),t}function Ur(){let e=V.useContext(hr),t=Vr(`useRouteError`),n=Hr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Wr(){let{router:e}=zr(`useNavigate`),t=Hr(`useNavigate`),n=V.useRef(!1);return V.useLayoutEffect(()=>{n.current=!0}),V.useCallback(async(r,i={})=>{Zt(n.current,wr),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Gr={};function Kr(e,t,n){!t&&!Gr[e]&&(Gr[e]=!0,Zt(!1,n))}function qr(e,t){if(e===!1||e==null)throw Error(t)}function Jr(e,t,n){let r=typeof e==`string`?new URL(e,n??(typeof window>`u`?`server://singlefetch/`:window.location.origin)):new URL(e);return n&&r.origin!==n&&(r=new URL(r.pathname+r.search+r.hash,n)),r.pathname.endsWith(`/`)?r.pathname=`${r.pathname}_.${t}`:r.pathname=`${r.pathname}.${t}`,r}async function Yr(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Xr(e){return e!=null&&typeof e.page==`string`}function Zr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Qr(e,t,n){return ri((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Yr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Zr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function $r(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function ei(e,t,{includeHydrateFallback:n}={}){return ti(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ti(e){return[...new Set(e)]}function ni(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ri(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Xr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ni(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var ii=V.createContext(void 0);ii.displayName=`FrameworkContext`;function ai(){let e=V.useContext(ii);return qr(e,`You must render this element inside a <HydratedRouter> element`),e}function oi(e,t){let n=V.useContext(ii),[r,i]=V.useState(!1),[a,o]=V.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=V.useRef(null);V.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),V.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:si(s,p),onBlur:si(c,m),onMouseEnter:si(l,p),onMouseLeave:si(u,m),onTouchStart:si(d,p)}]:[a,f,{}]:[!1,f,{}]}function si(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ci({page:e,...t}){let n=or(),{nonce:r}=ai(),{router:i}=zr(`PrefetchPageLinks`),a=V.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?V.createElement(ui,{page:e,matches:a,...t}):V.createElement(di,{page:e,matches:a,...t})):null}function li(e){let{manifest:t,routeModules:n}=ai(),[r,i]=V.useState([]);return V.useEffect(()=>{let r=!1;return Qr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ui({page:e,matches:t,...n}){let r=Cr(),{unstable_apiServerOrigin:i}=ai(),a=V.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Jr(e,`rsc`,i),a=!1,o=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?a=!0:o.push(e.route.id);return a&&o.length>0&&n.searchParams.set(`_routes`,o.join(`,`)),[i?n.toString():n.pathname+n.search]},[e,r,t,i]);return V.createElement(V.Fragment,null,a.map(e=>V.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function di({page:e,matches:t,...n}){let r=Cr(),{manifest:i,routeModules:a,unstable_apiServerOrigin:o}=ai(),{matches:s}=Br(`PrefetchPageLinks`),{loaderData:c}=Vr(`PrefetchPageLinks`),l=V.useMemo(()=>$r(e,t,s,i,r,`data`),[e,t,s,i,r]),u=V.useMemo(()=>$r(e,t,s,i,r,`assets`),[e,t,s,i,r]),d=V.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in c&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=Jr(e,`data`,o);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[o?u.toString():u.pathname+u.search]},[c,r,i,l,t,e,a,o]),f=V.useMemo(()=>ei(u,i),[u,i]),p=li(u);return V.createElement(V.Fragment,null,d.map(e=>V.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>V.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),p.map(({key:e,link:t})=>V.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function fi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}V.memo(pi);function pi({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=V.useContext(tr);G(a,`You must render this element inside a <DataRouterContext.Provider> element`);let o=V.useContext(ii)?.routeDiscoveryRuntime;return V.useEffect(()=>{n.initialized&&o?.markReady()},[n.initialized,o]),Ar(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function mi({to:e,replace:t,state:n,relative:r}){G(Sr(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=V.useContext(ur);Zt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=V.useContext(fr),{pathname:s}=Cr(),c=Tr(),l=Pn(e,Nn(o),s,r===`path`);Xn(typeof e==`string`?e:tn(e),a.createHref(l),qn(a),`reject`);let u=JSON.stringify(l);return V.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function hi(e){G(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function gi({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){G(!Sr(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=V.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=nn(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=V.useMemo(()=>{let e=On(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Zt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:V.createElement(ur.Provider,{value:c},V.createElement(dr.Provider,{children:t,value:h}))}function _i({children:e,location:t}){return kr(vi(e),t)}V.Component;function vi(e,t=[]){let n=[];return V.Children.forEach(e,(e,r)=>{if(!V.isValidElement(e))return;let i=[...t,r];if(e.type===V.Fragment){n.push.apply(n,vi(e.props.children,i));return}G(e.type===hi,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;G(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=vi(a.children,i)),n.push(o)}),n}var yi=`application/x-www-form-urlencoded`;function bi(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function xi(e){return bi(e)&&e.tagName.toLowerCase()===`button`}function Si(e){return bi(e)&&e.tagName.toLowerCase()===`form`}function Ci(e){return bi(e)&&e.tagName.toLowerCase()===`input`}function wi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ti(e,t){return e.button===0&&(!t||t===`_self`)&&!wi(e)}function Ei(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Di(e,t){let n=Ei(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Oi=null;function ki(){if(Oi===null)try{new FormData(document.createElement(`form`),0),Oi=!1}catch{Oi=!0}return Oi}var Ai=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ji(e){return e!=null&&!Ai.has(e)?(Zt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yi}"`),null):e}function Mi(e,t){let n,r,i,a,o;if(Si(e)){let o=e.getAttribute(`action`);r=o?On(o,t):null,n=e.getAttribute(`method`)||`get`,i=ji(e.getAttribute(`enctype`))||yi,a=new FormData(e)}else if(xi(e)||Ci(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?On(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=ji(e.getAttribute(`formenctype`))||ji(o.getAttribute(`enctype`))||yi,a=new FormData(o,e),!ki()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(bi(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=yi,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}var Ni=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Ni&&(window.__reactRouterVersion=`8`)}catch{}function Pi({basename:e,children:t,useTransitions:n,window:r}){let i=V.useRef(null);i.current??=Xt({window:r,v5Compat:!0});let a=i.current,[o,s]=V.useState({action:a.action,location:a.location}),c=V.useCallback(e=>{n===!1?s(e):V.startTransition(()=>s(e))},[n]);return V.useLayoutEffect(()=>a.listen(c),[a,c]),V.createElement(gi,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Fi=V.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=V.useContext(ur),v=typeof l==`string`&&Gt.test(l),y=Gn(l,h);l=y.to;let b=xr(l,{relative:r}),x=Cr(),S=null;if(o){let e=Pn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:In([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=oi(n,p),E=Ri(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=V.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:fi(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?V.createElement(V.Fragment,null,k,V.createElement(ci,{page:b})):k});Fi.displayName=`Link`;var Ii=V.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Or(a,{relative:c.relative}),d=Cr(),f=V.useContext(ir),{navigator:p,basename:m}=V.useContext(ur),h=f!=null&&Wi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f?.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=On(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return V.createElement(Fi,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Ii.displayName=`NavLink`;var Li=V.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=V.useContext(ur),g=Hi(),_=Ui(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Gt.test(s);return V.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?V.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Li.displayName=`Form`;function Ri(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Tr(),d=Cr(),f=Or(e,{relative:o});return V.useCallback(p=>{if(Ti(p,t)){p.preventDefault();let t=n===void 0?tn(d)===tn(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?V.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function zi(e){Zt(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=V.useRef(Ei(e)),n=V.useRef(!1),r=Cr(),i=V.useMemo(()=>Di(r.search,n.current?null:t.current),[r.search]),a=Tr();return[i,V.useCallback((e,t)=>{let r=Ei(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Bi=0,Vi=()=>`__${String(++Bi)}__`;function Hi(){let{router:e}=zr(`useSubmit`),{basename:t}=V.useContext(ur),n=Hr(`useSubmit`),r=e.fetch,i=e.navigate;return V.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Mi(e,t);a.navigate===!1?await r(a.fetcherKey||Vi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ui(e,{relative:t}={}){let{basename:n}=V.useContext(ur),r=V.useContext(fr);G(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Or(e||`.`,{relative:t})},o=Cr();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:In([n,a.pathname])),tn(a)}function Wi(e,{relative:t}={}){let n=V.useContext(sr);G(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=zr(`useViewTransitionState`),i=Or(e,{relative:t});if(!n.isTransitioning)return!1;let a=On(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=On(n.nextLocation.pathname,r)||n.nextLocation.pathname;return wn(i.pathname,o)!=null||wn(i.pathname,a)!=null}var Gi={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Gi.node;var Ki=C(Gi),qi={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};qi.node;var Ji=C(qi),Yi={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Yi.node;var Xi=C(Yi),Zi={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Zi.node;var Qi=C(Zi),$i={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};$i.node;var ea=C($i),ta={name:`bell-ring`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]};ta.node;var na=C(ta),ra={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};ra.node;var ia=C(ra),aa={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};aa.node;var oa=C(aa),sa={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};sa.node;var ca=C(sa),la={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};la.node;var ua=C(la),da={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};da.node;var fa=C(da),pa={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};pa.node;var ma=C(pa),ha={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};ha.node;var ga=C(ha),_a={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};_a.node;var va=C(_a),ya={name:`corner-down-left`,size:24,node:[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]};ya.node;var ba=C(ya),xa={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};xa.node;var Sa=C(xa),Ca={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};Ca.node;var wa=C(Ca),Ta={name:`eighth-notes`,size:24,node:[[`path`,{d:`M21 16V3a1 1 0 0 0-1.28-.96l-10 2.917a1 1 0 0 0-.72.96V19`,key:`uy6ho8`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}],[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}]],aliases:[`music`]};Ta.node;var Ea=C(Ta),Da={name:`ellipsis-vertical`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]],aliases:[`more-vertical`]};Da.node;var Oa=C(Da),ka={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};ka.node;var Aa=C(ka),ja={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};ja.node;var Ma=C(ja),Na={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};Na.node;var Pa=C(Na),Fa={name:`flashlight-off`,size:24,node:[[`path`,{d:`M11.652 6H18`,key:`voqkpr`}],[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V6`,key:`dzyf92`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7.649 2H17a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8a4 4 0 0 0-.55 1.007`,key:`1hvcfn`}]]};Fa.node;var Ia=C(Fa),La={name:`flashlight`,size:24,node:[[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M17 2a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8A4 4 0 0 0 16 12v8a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V3a1 1 0 0 1 1-1z`,key:`17vh7j`}],[`path`,{d:`M6 6h12`,key:`n6hhss`}]]};La.node;var Ra=C(La),za={name:`folder-input`,size:24,node:[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]};za.node;var Ba=C(za),Va={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Va.node;var Ha=C(Va),Ua={name:`image-plus`,size:24,node:[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};Ua.node;var Wa=C(Ua),Ga={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Ga.node;var Ka=C(Ga),qa={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};qa.node;var Ja=C(qa),Ya={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Ya.node;var Xa=C(Ya),Za={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Za.node;var Qa=C(Za),$a={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};$a.node;var eo=C($a),to={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};to.node;var no=C(to),ro={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};ro.node;var io=C(ro),ao={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};ao.node;var oo=C(ao),so={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};so.node;var co=C(so),lo={name:`mic`,size:24,node:[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]};lo.node;var uo=C(lo),fo={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};fo.node;var po=C(fo),mo={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};mo.node;var ho=C(mo),go={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};go.node;var _o=C(go),vo={name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]};vo.node;var yo=C(vo),bo={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};bo.node;var xo=C(bo),So={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};So.node;var Co=C(So),wo={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};wo.node;var To=C(wo),Eo={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Eo.node;var Do=C(Eo),Oo={name:`scan-line`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]};Oo.node;var ko=C(Oo),Ao={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ao.node;var jo=C(Ao),Mo={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};Mo.node;var No=C(Mo),Po={name:`share`,size:24,node:[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]};Po.node;var Fo=C(Po),Io={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};Io.node;var Lo=C(Io),Ro={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Ro.node;var zo=C(Ro),Bo={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Bo.node;var Vo=C(Bo),Ho={name:`switch-camera`,size:24,node:[[`path`,{d:`M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5`,key:`mtk2lu`}],[`path`,{d:`M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5`,key:`120jsl`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m18 22-3-3 3-3`,key:`kgdoj7`}],[`path`,{d:`m6 2 3 3-3 3`,key:`1fnbkv`}]]};Ho.node;var Uo=C(Ho),Wo={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};Wo.node;var Go=C(Wo),Ko={name:`triangle-exclamation-point`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`,`triangle-alert`]};Ko.node;var qo=C(Ko),Jo={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};Jo.node;var Yo=C(Jo),Xo={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};Xo.node;var Zo=C(Xo),Qo={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Qo.node;var $o=C(Qo),es=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(es||{}),ts=[0,1],ns=[1,0],rs=[2,3],is=[3,2],as={L:ts,M:ns,Q:rs,H:is},os=/^\d*$/,ss=/^[A-Z0-9 $%*+./:-]*$/,cs=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,ls=1,us=40,ds=3,fs=3,ps=40,ms=10,hs=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],gs=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],_s=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<ls||e>us)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,es.Timing),this.setFunctionModule(e,6,e%2==0,es.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,ys(r,e));this.setFunctionModule(8,7,ys(r,6)),this.setFunctionModule(8,8,ys(r,7)),this.setFunctionModule(7,8,ys(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,ys(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,ys(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,ys(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=ys(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,es.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,es.Alignment)}setFunctionModule(e,t,n,r=es.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Ps(t,n))throw RangeError(`Invalid argument`);let r=gs[n[0]][t],i=hs[n[0]][t],a=Math.floor(Ns(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Fs(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Is(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(Ns(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=ys(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=ds:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*ps),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*ps}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=ds:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*ps),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*ps}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=fs)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*ms,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function vs(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function ys(e,t){return!!(e>>>t&1)}var bs=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},xs=[1,10,12,14],Ss=[2,9,11,13],Cs=[4,8,16,16];function ws(e,t){return e[Math.floor((t+7)/17)+1]}function Ts(e){let t=[];for(let n of e)vs(n,8,t);return new bs(Cs,e.length,t)}function Es(e){if(!ks(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);vs(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new bs(xs,e.length,t)}function Ds(e){if(!As(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=cs.indexOf(e.charAt(n))*45;r+=cs.indexOf(e.charAt(n+1)),vs(r,11,t)}return n<e.length&&vs(cs.indexOf(e.charAt(n)),6,t),new bs(Ss,e.length,t)}function Os(e){return e===``?[]:ks(e)?[Es(e)]:As(e)?[Ds(e)]:[Ts(Ms(e))]}function ks(e){return os.test(e)}function As(e){return ss.test(e)}function js(e,t){let n=0;for(let r of e){let e=ws(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Ms(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function Ns(e){if(e<ls||e>us)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Ps(e,t){return Math.floor(Ns(e)/8)-hs[t[0]][e]*gs[t[0]][e]}function Fs(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=Ls(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Ls(n,2)}return t}function Is(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=Ls(t,e))}return n}function Ls(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function Rs(e,t,n=1,r=40,i=-1,a=!0){if(!(ls<=n&&n<=r&&r<=us)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=Ps(o,t)*8,i=js(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[ns,rs,is])a&&s<=Ps(o,e)*8&&(t=e);let c=[];for(let t of e){vs(t.mode[0],4,c),vs(t.numChars,ws(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Ps(o,t)*8;vs(0,Math.min(4,l-c.length),c),vs(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)vs(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new _s(o,t,u,i)}function zs(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Os(e):Array.isArray(e)?[Ts(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Rs(c,as[n],i,a,o,r),u=Bs({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Bs(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=es.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function Vs(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function Hs(e,t={}){let n=zs(e,t),{pixelSize:r=10,whiteColor:i=`white`,blackColor:a=`black`}=t,o=n.size*r,s=n.size*r,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}">`,l=[];for(let e=0;e<n.size;e++)for(let t=0;t<n.size;t++){let i=t*r,a=e*r;n.data[e][t]&&l.push(`M${i},${a}h${r}v${r}h-${r}z`)}return c+=`<rect fill="${Vs(i)}" width="${s}" height="${o}"/>`,c+=`<path fill="${Vs(a)}" d="${l.join(``)}"/>`,c+=`</svg>`,c}var Us=e=>`${e.slice(0,4)} ${e.slice(4)}`,Ws=e=>Hs(e,{ecc:`M`,border:2,pixelSize:8}),Gs=e=>`${(e.trim()||`wizard`).replace(/[^\p{L}\p{N}]+/gu,`-`).toLowerCase()}-qr`;function Ks(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}async function qs(e,t){let n=new Image,r=URL.createObjectURL(new Blob([e],{type:`image/svg+xml`}));try{n.src=r,await n.decode();let e=document.createElement(`canvas`);e.width=1024,e.height=1024;let i=e.getContext(`2d`);if(!i)return;i.imageSmoothingEnabled=!1,i.drawImage(n,0,0,1024,1024);let a=await new Promise(t=>e.toBlob(t,`image/png`));a&&Ks(a,`${Gs(t)}.png`)}finally{URL.revokeObjectURL(r)}}function Js(e,t){let n=window.open(``,`_blank`,`width=520,height=680`);if(!n)return;let r=n.document;r.title=t;let i=r.createElement(`style`);i.textContent=`body{margin:0;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;font:600 28px system-ui,sans-serif}svg{width:12cm;height:12cm}`,r.head.append(i);let a=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,o=r.createElement(`div`);o.textContent=t,r.body.append(r.importNode(a,!0),o),n.addEventListener(`afterprint`,()=>n.close()),n.focus(),n.print()}function Ys({svg:e,label:t,className:r}){return(0,H.jsx)(`div`,{role:`img`,"aria-label":t,className:n(`overflow-hidden rounded-xl bg-white [&>svg]:size-full`,r),dangerouslySetInnerHTML:{__html:e}})}function Xs({text:e,label:t,className:r}){let i=(0,V.useMemo)(()=>Ws(e),[e]);return(0,H.jsx)(Ys,{svg:i,label:t,className:n(`size-40 p-1`,r)})}function Zs(e,t){this.v=e,this.k=t}function Qs(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $s(e){if(Array.isArray(e))return e}function ec(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function tc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nc(e,t){return $s(e)||ec(e,t)||rc(e,t)||tc()}function rc(e,t){if(e){if(typeof e==`string`)return Qs(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qs(e,t):void 0}}function ic(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Zs;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}ic.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},ic.prototype.next=function(e){return this._invoke(`next`,e)},ic.prototype.throw=function(e){return this._invoke(`throw`,e)},ic.prototype.return=function(e){return this._invoke(`return`,e)};var ac=Object.entries,oc=Object.setPrototypeOf,sc=Object.isFrozen,cc=Object.getPrototypeOf,lc=Object.getOwnPropertyDescriptor,K=Object.freeze,uc=Object.seal,dc=Object.create,fc=typeof Reflect<`u`&&Reflect,pc=fc.apply,mc=fc.construct;K||=function(e){return e},uc||=function(e){return e},pc||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},mc||=function(e){return new e(...[...arguments].slice(1))};var hc=J(Array.prototype.forEach);Array.prototype.indexOf;var gc=J(Array.prototype.lastIndexOf),_c=J(Array.prototype.pop),vc=J(Array.prototype.push),yc=J(Array.prototype.slice),bc=J(Array.prototype.splice),xc=Array.isArray,Sc=Rc(Set),Cc=J(Set.prototype.add),wc=J(Set.prototype.has),Tc=J(String.prototype.toLowerCase),Ec=J(String.prototype.toString),Dc=J(String.prototype.match),Oc=J(String.prototype.replace),kc=J(String.prototype.indexOf),Ac=J(String.prototype.trim),jc=J(Number.prototype.toString),Mc=J(Boolean.prototype.toString),Nc=typeof BigInt>`u`?null:J(BigInt.prototype.toString),Pc=typeof Symbol>`u`?null:J(Symbol.prototype.toString),Fc=J(Object.prototype.hasOwnProperty),Ic=J(Object.prototype.toString),q=J(RegExp.prototype.test),Lc=Rc(TypeError);function J(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return pc(e,t,n)}}function Rc(e){return function(){return mc(e,[...arguments])}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Tc;if(oc&&oc(e,null),!xc(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(sc(t)||(t[r]=e),i=e)}e[i]=!0}return e}function zc(e){for(let t=0;t<e.length;t++)Fc(e,t)||(e[t]=null);return e}function Bc(e){let t=dc(null);for(let r of ac(e)){var n=nc(r,2);let i=n[0],a=n[1];Fc(e,i)&&(t[i]=xc(a)?zc(a):a&&typeof a==`object`&&a.constructor===Object?Bc(a):a)}return t}function Vc(e){switch(typeof e){case`string`:return e;case`number`:return jc(e);case`boolean`:return Mc(e);case`bigint`:return Nc?Nc(e):`0`;case`symbol`:return Pc?Pc(e):`Symbol()`;case`undefined`:return Ic(e);case`function`:case`object`:{if(e===null)return Ic(e);let t=e,n=Hc(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Ic(e)}return Ic(e)}default:return Ic(e)}}function Hc(e,t){for(;e!==null;){let n=lc(e,t);if(n){if(n.get)return J(n.get);if(typeof n.value==`function`)return J(n.value)}e=cc(e)}function n(){return null}return n}function Uc(e,t){for(;e!==null;){let n=lc(e,t);if(n)return n.get?J(n.get):null;e=cc(e)}return null}function Wc(e){try{return q(e,``),!0}catch{return!1}}var Gc=K(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Kc=K(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),qc=K([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Jc=K([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Yc=K(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Xc=K([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Zc=K([`#text`]),Qc=K(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),$c=K(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),el=K(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),tl=K([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),nl=uc(/{{[\w\W]*|^[\w\W]*}}/g),rl=uc(/<%[\w\W]*|^[\w\W]*%>/g),il=uc(/\${[\w\W]*/g),al=uc(/^data-[\-\w.\u00B7-\uFFFF]+$/),ol=uc(/^aria-[\-\w]+$/),sl=uc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cl=uc(/^(?:\w+script|data):/i),ll=uc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ul=uc(/^html$/i),dl=uc(/^[a-z][.\w]*(-[.\w]+)+$/i),fl=uc(/<[/\w!]/g),pl=uc(/<[/\w]/g),ml=uc(/<\/no(script|embed|frames)/i),hl=uc(/\/>/i),X={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},gl=K(Y({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),_l=function(){return typeof window>`u`?null:window},vl=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},yl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},bl=function(e,t,n,r){return Fc(e,t)&&xc(e[t])?Y(r.base?Bc(r.base):{},e[t],r.transform):n},xl=function(e,t,n){let r=Fc(e,t)?e[t]:void 0;return r&&typeof r==`object`?Bc(r):n()};function Sl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_l(),t=e=>Sl(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==X.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Hc(d,`cloneNode`),p=Hc(d,`remove`),m=Hc(d,`removeAttributeNode`),h=Hc(d,`nextSibling`),g=Hc(d,`childNodes`),_=Hc(d,`parentNode`),v=Hc(d,`shadowRoot`),y=Hc(d,`attributes`),b=o&&o.prototype?Hc(o.prototype,`nodeType`):null,x=o&&o.prototype?Hc(o.prototype,`nodeName`):null,S=o&&o.prototype?Hc(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=Uc(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,ee=!1,A=0,j=function(){if(A>0)throw Lc(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},M=function(e){j(),A++;try{return D.createHTML(e)}finally{A--}},te=function(e){j(),A++;try{return D.createScriptURL(e)}finally{A--}},N=function(){return ee||=(k=vl(u,i),!0),k},ne=n,re=ne.implementation,ie=ne.createNodeIterator,P=ne.createDocumentFragment,ae=ne.getElementsByTagName,oe=r.importNode,F=yl();t.isSupported=typeof ac==`function`&&typeof _==`function`&&re&&re.createHTMLDocument!==void 0;let se=nl,ce=rl,I=il,le=al,ue=ol,de=cl,fe=ll,pe=dl,me=sl,L=null,he=Y({},[...Gc,...Kc,...qc,...Yc,...Zc]),R=null,ge=Y({},[...Qc,...$c,...el,...tl]),_e=Object.seal(dc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ve=null,ye=null,z=Object.seal(dc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),be=!0,xe=!0,Se=!1,Ce=!0,we=!1,B=!0,Te=!1,Ee=!1,V=null,H=null,De=!1,Oe=!1,ke=!1,Ae=!1,je=!0,Me=!1,Ne=`user-content-`,Pe=!0,Fe=!1,Ie=null,Le={},U=null,Re=Y({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),ze=null,Be=Y({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ve=null,He=Y({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ue=`http://www.w3.org/1998/Math/MathML`,We=`http://www.w3.org/2000/svg`,Ge=`http://www.w3.org/1999/xhtml`,Ke=Ge,qe=!1,Je=null,Ye=Y({},[Ue,We,Ge],Ec),Xe=K([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ze=Y({},Xe),Qe=K([`annotation-xml`]),$e=Y({},Qe),et=Y({},[`title`,`style`,`font`,`a`,`script`]),tt=null,nt=[`application/xhtml+xml`,`text/html`],W=null,rt=null,it=n.createElement(`form`),at=function(e){return e instanceof RegExp||e instanceof Function},ot=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(rt&&rt===e)return;e&&typeof e==`object`||(e={}),e=Bc(e),tt=nt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=tt===`application/xhtml+xml`?Ec:Tc,L=bl(e,`ALLOWED_TAGS`,he,{transform:W}),R=bl(e,`ALLOWED_ATTR`,ge,{transform:W}),Je=bl(e,`ALLOWED_NAMESPACES`,Ye,{transform:Ec}),Ve=bl(e,`ADD_URI_SAFE_ATTR`,He,{transform:W,base:He}),ze=bl(e,`ADD_DATA_URI_TAGS`,Be,{transform:W,base:Be}),U=bl(e,`FORBID_CONTENTS`,Re,{transform:W}),ve=bl(e,`FORBID_TAGS`,Bc({}),{transform:W}),ye=bl(e,`FORBID_ATTR`,Bc({}),{transform:W}),Le=Fc(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Bc(e.USE_PROFILES):e.USE_PROFILES:!1,be=e.ALLOW_ARIA_ATTR!==!1,xe=e.ALLOW_DATA_ATTR!==!1,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=e.SAFE_FOR_TEMPLATES||!1,B=e.SAFE_FOR_XML!==!1,Te=e.WHOLE_DOCUMENT||!1,Oe=e.RETURN_DOM||!1,ke=e.RETURN_DOM_FRAGMENT||!1,Ae=e.RETURN_TRUSTED_TYPE||!1,De=e.FORCE_BODY||!1,je=e.SANITIZE_DOM!==!1,Me=e.SANITIZE_NAMED_PROPS||!1,Pe=e.KEEP_CONTENT!==!1,Fe=e.IN_PLACE||!1,me=Wc(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:sl,Ke=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ge,Ze=xl(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Y({},Xe)),$e=xl(e,`HTML_INTEGRATION_POINTS`,()=>Y({},Qe));let t=xl(e,`CUSTOM_ELEMENT_HANDLING`,()=>dc(null));if(_e=dc(null),Fc(t,`tagNameCheck`)&&at(t.tagNameCheck)&&(_e.tagNameCheck=t.tagNameCheck),Fc(t,`attributeNameCheck`)&&at(t.attributeNameCheck)&&(_e.attributeNameCheck=t.attributeNameCheck),Fc(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(_e.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),uc(_e),we&&(xe=!1),ke&&(Oe=!0),Le&&(L=Y({},Zc),R=dc(null),Le.html===!0&&(Y(L,Gc),Y(R,Qc)),Le.svg===!0&&(Y(L,Kc),Y(R,$c),Y(R,tl)),Le.svgFilters===!0&&(Y(L,qc),Y(R,$c),Y(R,tl)),Le.mathMl===!0&&(Y(L,Yc),Y(R,el),Y(R,tl))),z.tagCheck=null,z.attributeCheck=null,Fc(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?z.tagCheck=e.ADD_TAGS:xc(e.ADD_TAGS)&&(L===he&&(L=Bc(L)),Y(L,e.ADD_TAGS,W))),Fc(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?z.attributeCheck=e.ADD_ATTR:xc(e.ADD_ATTR)&&(R===ge&&(R=Bc(R)),Y(R,e.ADD_ATTR,W))),Fc(e,`ADD_FORBID_CONTENTS`)&&xc(e.ADD_FORBID_CONTENTS)&&(U===Re&&(U=Bc(U)),Y(U,e.ADD_FORBID_CONTENTS,W)),Pe&&(L[`#text`]=!0),Te&&Y(L,[`html`,`head`,`body`]),L.table&&(Y(L,[`tbody`]),delete ve.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Lc(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Lc(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=M(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=N()),D&&typeof O==`string`&&(O=M(``)));K&&K(e),rt=e},st=Y({},[...Kc,...qc,...Jc]),ct=Y({},[...Yc,...Xc]),lt=function(e,t,n){return t.namespaceURI===Ge?e===`svg`:t.namespaceURI===Ue?e===`svg`&&(n===`annotation-xml`||Ze[n]):!!st[e]},ut=function(e,t,n){return t.namespaceURI===Ge?e===`math`:t.namespaceURI===We?e===`math`&&$e[n]:!!ct[e]},dt=function(e,t,n){return t.namespaceURI===We&&!$e[n]||t.namespaceURI===Ue&&!Ze[n]?!1:!ct[e]&&(et[e]||!st[e])},ft=function(e){let t=E(e),n=Tc(w(e)),r=_(e),i,a;return r&&C(r)===X.element?(i={namespaceURI:E(r)},a=Tc(w(r))):(i={namespaceURI:Ke},a=`template`),Je[t]?t===We?lt(n,i,a):t===Ue?ut(n,i,a):t===Ge?dt(n,i,a):!!(tt===`application/xhtml+xml`&&Je[t]):!1},pt=function(e){vc(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Lc(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},mt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},ht=function(e){yt(e);let t=g(e);t&&hc(yc(t),e=>{try{p(e)}catch{}});let n=C(e)===X.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&mt(e,r,i)}},gt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}vc(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Oe||ke)try{pt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},_t=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||R[W(i)]||mt(e,r,i)}},vt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===X.element){let t=v(e);Pt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},yt=function(e){vt(e,e=>{C(e)===X.element&&_t(e)})},bt=function(e){let t=[];return vt(e,e=>{t.push(e)},!0),t},xt=function(e,t){let n=Sc();hc(bt(e),e=>{C(e)===X.element&&Cc(n,e)}),hc(t,e=>{C(e)===X.element&&!wc(n,e)&&_t(e)})},St=function(e,n){let r=!1;return hc(t.removed,t=>{t.element&&(r||=t.element===e,yt(t.element))}),xt(e,n),r},Ct=function(e,t){let n=Ie,r=null,i=()=>(r||(r=Sc(),hc(t,e=>{Cc(r,e)})),r);for(let t=0;;t++){let r=bt(e),a=[e],o=!1;if(hc(r,e=>{C(e)===X.documentFragment?vc(a,e):!o&&!wc(n,e)&&(o=wc(i(),e))}),!o)return;if(t>=8)throw Lc(`the tree kept changing during in-place sanitization; refusing to return it`);hc(a,(t,n)=>{wt(t,n>0,e,i())})}},wt=function(e,t,n,r){let i=kt(e),a;for(;a=i.nextNode();)wc(r,a)&&!wc(Ie,a)&&(t&&It(F.uponSanitizeShadowNode,a,null),Ht(a,n),Yt(a,n),Pt(a.content)&&Xt(a.content))},Tt=function(e){Ie&&Cc(Ie,e)},Et=function(e,t){return B?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Dt=function(e){B&&vt(e,e=>{let t=C(e);if(t===X.processingInstruction||t===X.comment&&q(pl,e.data)){try{p(e)}catch{}return!1}if(t===X.element){let t=e,n=W(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Et(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Ot=function(e){let t=null,r=null;if(De)e=`<remove></remove>`+e;else{let t=Dc(e,/^[\r\n\t ]+/);r=t&&t[0]}tt===`application/xhtml+xml`&&Ke===Ge&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?M(e):e;if(Ke===Ge)try{t=new l().parseFromString(i,tt)}catch{}if(!t||!t.documentElement){t=re.createDocument(Ke,`template`,null);try{t.documentElement.innerHTML=qe?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ke===Ge?ae.call(t,Te?`html`:`body`)[0]:Te?t.documentElement:a},kt=function(e){let t=S?S(e):e.ownerDocument;return ie.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},At=function(e){return e=Oc(e,se,` `),e=Oc(e,ce,` `),e=Oc(e,I,` `),e},jt=function(e){Mt(e);let t=e.querySelectorAll?.call(e,`template`);t&&hc(t,e=>{Pt(e.content)&&jt(e.content)})},Mt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ie.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=At(r.data),r=n.nextNode()},Nt=function(e){let t=x?x(e):null;return typeof t!=`string`||W(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Pt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===X.documentFragment}catch{return!1}},Ft=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function It(e,n,r){e.length!==0&&hc(e,e=>{e.call(t,n,r,rt)})}let Lt=function(e,t){return!!(B&&e.hasChildNodes()&&!Ft(e.firstElementChild)&&q(fl,e.textContent)&&q(fl,e.innerHTML)||B&&gl[t]&&C(e)===X.element&&E(e)===Ge&&(Ft(e.firstElementChild)||typeof e.textContent==`string`&&q(fl,e.textContent))||e.nodeType===X.processingInstruction||B&&e.nodeType===X.comment&&q(pl,e.data))},Rt=function(e,t){return e instanceof RegExp?q(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},zt=function(e,t,n){if(!ve[t]&&Gt(t)&&Rt(_e.tagNameCheck,t))return!1;if(Pe&&!U[t]&&!U[Tc(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return pt(e),!0},Bt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Bc(t):t},Vt=function(e,t){return e===t||_(e)!==null?!1:(Fe&&yt(e),!0)},Ht=function(e,n){if(Tt(e),It(F.beforeSanitizeElements,e,null),Vt(e,n))return!0;if(Nt(e))return pt(e),!0;let r=W(w(e));if(L=Bt(F.uponSanitizeElement,L,he,V),It(F.uponSanitizeElement,e,{tagName:r,allowedTags:L}),Vt(e,n))return!0;if(Lt(e,r))return pt(e),!0;if(ve[r]||!(z.tagCheck instanceof Function&&z.tagCheck(r))&&!L[r]){let t=zt(e,r,n);return t===!1&&(It(F.afterSanitizeElements,e,null),Vt(e,n))?!0:t}if(C(e)===X.element&&!ft(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&q(ml,e.innerHTML))return pt(e),!0;if(we&&e.nodeType===X.text){let n=At(e.textContent);e.textContent!==n&&(vc(t.removed,{element:e.cloneNode()}),e.textContent=n)}return It(F.afterSanitizeElements,e,null),Vt(e,n)},Ut=function(e,t,r){if(ye[t]||Et(t,e)||je&&(t===`id`||t===`name`)&&(r in n||r in it))return!1;let i=R[t]||z.attributeCheck instanceof Function&&z.attributeCheck(t,e);return xe&&q(le,t)||be&&q(ue,t)?!0:i?Ve[t]||q(me,Oc(r,fe,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&kc(r,`data:`)===0&&ze[e]||Se&&!q(de,Oc(r,fe,``))?!0:!r:Gt(e)&&Rt(_e.tagNameCheck,e)&&Rt(_e.attributeNameCheck,t,e)||t===`is`&&_e.allowCustomizedBuiltInElements&&Rt(_e.tagNameCheck,r)},Wt=Y({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Gt=function(e){return!Wt[Tc(e)]&&q(pe,e)},Kt=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return M(r);case`TrustedScriptURL`:return te(r)}return r},qt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Nt(e)||(pt(e),!1)}catch{return gt(t,e),!1}},Jt=function(e,t){return B&&q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Tc(e)===`attributename`&&Dc(t,`href`)!==null},Yt=function(e,n){if(It(F.beforeSanitizeAttributes,e,null),Vt(e,n))return;let r=e.attributes;if(!r||Nt(e))return;R=Bt(F.uponSanitizeAttribute,R,ge,H);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},a=r.length,o=W(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=W(s),d=l,f=s===`value`?d:Ac(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,It(F.uponSanitizeAttribute,e,i),f=i.attrValue,Me&&(u===`id`||u===`name`)&&kc(f,Ne)!==0&&(gt(s,e,n),f=Ne+f,p=!0),Jt(s,f)?gt(s,e,n):i.forceKeepAttr||(i.keepAttr?!Ce&&q(hl,f)?gt(s,e,n):(we&&(f=At(f)),Ut(o,u,f)?(f=Kt(o,u,c,f),f!==d&&qt(e,s,c,f)&&p&&_c(t.removed)):gt(s,e,n)):gt(s,e,n))}It(F.afterSanitizeAttributes,e,null),Vt(e,n)},Xt=function(e){let t=null,n=kt(e);for(It(F.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(It(F.uponSanitizeShadowNode,t,null),Ht(t,e),Yt(t,e),Pt(t.content)&&Xt(t.content),C(t)===X.element){let e=v(t);Pt(e)&&(G(e),Xt(e))}we&&Mt(e),It(F.afterSanitizeShadowDOM,e,null)},G=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Xt(e.shadow);continue}let n=e.node,r=C(n)===X.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&W(e)===`template`){let e=n.content;Pt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Pt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(qe=!e,qe&&(e=`<!-->`),typeof e!=`string`&&!Ft(e)&&(e=Vc(e),typeof e!=`string`))throw Lc(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ee?(L=V,R=H):ot(n),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(L=Bc(L)),F.uponSanitizeAttribute.length>0&&(R=Bc(R)),t.removed=[];let c=Fe&&typeof e!=`string`&&Ft(e),l=[],u=Ie;if(c){Dt(e);let t=w(e);if(typeof t==`string`){let n=W(t);if(!L[n]||ve[n])throw ht(e),Lc(`root node is forbidden and cannot be sanitized in-place`)}if(Nt(e))throw ht(e),Lc(`root node is clobbered and cannot be sanitized in-place`);l=bt(e),Ie=Sc()}else if(Ft(e))i=Ot(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===X.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),G(i);else{if(!Oe&&!we&&!Te&&e.indexOf(`<`)===-1)return D&&Ae?M(e):e;if(i=Ot(e),!i)return Oe?null:Ae?O:``}i&&De&&pt(i.firstChild);let d=c?e:i;try{c&&G(e);let t=kt(d);for(;o=t.nextNode();)Ht(o,d),Yt(o,d),Pt(o.content)&&Xt(o.content);c&&Ct(e,l)}catch(t){throw c&&(ht(e),St(e,l)),t}finally{Ie=u}if(c){if(St(e,l))throw Lc(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return we&&jt(e),e}if(Oe){if(we&&jt(i),ke)for(s=P.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=oe.call(r,s,!0)),s}let f=Te?i.outerHTML:i.innerHTML;return Te&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&q(ul,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
4
|
+
`+f),we&&(f=At(f)),D&&Ae?M(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ot(e),Ee=!0,V=L,H=R},t.clearConfig=function(){rt=null,Ee=!1,V=null,H=null,D=k,O=``},t.isValidAttribute=function(e,t,n){rt||ot({});let r=W(e),i=W(t);return typeof n==`string`&&(Jt(t,n)||!Ce&&q(hl,n))?!1:Ut(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Fc(F,e)&&vc(F[e],t)},t.removeHook=function(e,t){if(Fc(F,e)){if(t!==void 0){let n=gc(F[e],t);return n===-1?void 0:bc(F[e],n,1)[0]}return _c(F[e])}},t.removeHooks=function(e){Fc(F,e)&&(F[e]=[])},t.removeAllHooks=function(){F=yl()},t}var Cl=Sl();function wl({text:e,className:t}){let r=(0,V.useMemo)(()=>Cl.sanitize(ee.parse(e,{async:!1})),[e]);return(0,H.jsx)(`div`,{className:n(`prose-zen`,t),dangerouslySetInnerHTML:{__html:r}})}var Tl=class extends Error{status;body;constructor(e,t,n){super(e),this.status=t,this.body=n}};function El(e){return e instanceof Tl&&e.status===0}function Dl(e){try{return JSON.parse(e)}catch{return{error:e}}}function Ol(e,t={},n){async function r(r,i,a,o){let s=await fetch(e(i),{method:r,signal:o,credentials:`include`,headers:{"accept-language":de,...t,...a!==void 0&&!(a instanceof FormData)?{"content-type":`application/json`}:{}},body:a===void 0?void 0:a instanceof FormData?a:JSON.stringify(a)}).catch(()=>{throw new Tl(I(`common.offline`),0,null)}),c=await s.text(),l=c?Dl(c):null;if(!s.ok)throw s.status>=500&&n?.(`${r} ${i} answered ${s.status}: ${l?.error??``}`),new Tl(l?.error??l?.message??s.statusText,s.status,l);return l}return{get:(e,t)=>r(`GET`,e,void 0,t),post:(e,t,n)=>r(`POST`,e,t??{},n),put:(e,t)=>r(`PUT`,e,t),patch:(e,t)=>r(`PATCH`,e,t),del:e=>r(`DELETE`,e),upload:(e,t)=>{let n=new FormData;return n.set(`file`,t),r(`POST`,e,n)},keep:(n,r)=>{fetch(e(n),{method:`PUT`,keepalive:!0,credentials:`include`,headers:{"accept-language":de,...t,"content-type":`application/json`},body:JSON.stringify(r)}).catch(()=>void 0)}}}var kl={can:()=>!1,call:e=>Promise.reject(Error(`the app cannot ${e}`)),tell:()=>void 0,download:()=>!1},Al=null;function jl(e){Al=e,Z=Ol(e.withBase,e.headers,e.onServerError),fe(e.lang)}function Ml(){if(!Al)throw Error(`configureRunner() first`);return Al}var Z=Ol(e=>e),Nl=e=>Ml().withBase(e),Pl=e=>Ml().asset(e),Q=e=>Ml().runBase(e),Fl=e=>(Al?.app??kl).can(e),Il=(e,t)=>(Al?.app??kl).call(e,t),Ll=(e,t)=>(Al?.app??kl).tell(e,t),Rl=(e,t,n)=>(Al?.app??kl).download(e,t,n),zl=()=>Al?.standalone===!0,Bl=250;function Vl({runId:e,driving:t,caption:r,action:i,hint:a,className:o,onBroken:s}){let c=(0,V.useRef)(null),l=(0,V.useRef)(null),[u,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(null),_=async t=>{h(null);try{await Z.post(`${Q(e)}/browser/act`,t)}catch(e){h(e.message)}};return(0,V.useEffect)(()=>{t&&l.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[t]),(0,V.useEffect)(()=>{let n=c.current;if(!(n&&t))return;let r=0,i=null,a=t=>{t.preventDefault(),r+=t.deltaY,i??=setTimeout(()=>{i=null;let t=Math.max(-2e3,Math.min(2e3,Math.round(r)));r=0,t&&Z.post(`${Q(e)}/browser/act`,{type:`scroll`,dy:t}).catch(()=>void 0)},Bl)};return n.addEventListener(`wheel`,a,{passive:!1}),()=>{n.removeEventListener(`wheel`,a),i&&clearTimeout(i)}},[t,e]),(0,H.jsxs)(`div`,{className:o,children:[(0,H.jsxs)(`div`,{className:n(`relative aspect-[1280/900] w-full overflow-hidden rounded-xl bg-paper-2 ring-1`,t?`ring-2 ring-ember`:`ring-border-soft`),children:[(0,H.jsx)(`img`,{ref:c,src:Nl(`${Q(e)}/browser/live`),alt:``,draggable:!1,onClick:e=>{if(!t)return;let n=e.currentTarget.getBoundingClientRect();_({type:`click`,fx:Math.min(1,Math.max(0,(e.clientX-n.left)/n.width)),fy:Math.min(1,Math.max(0,(e.clientY-n.top)/n.height))})},onError:s,className:n(`size-full object-cover object-top`,t&&`cursor-pointer`)}),i?(0,H.jsx)(`div`,{className:`absolute top-2 right-2`,children:i}):null,r&&!t?(0,H.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 flex items-center gap-1.5 bg-gradient-to-t from-black/75 to-transparent px-3 pt-8 pb-2 text-[0.8125rem] text-white`,children:[(0,H.jsx)(po,{className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:r})]}):null]}),t?(0,H.jsxs)(`div`,{ref:l,className:`mt-1.5`,children:[a?(0,H.jsx)(`p`,{className:`mb-1.5 text-[0.8125rem] text-ink-3`,children:a}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 rounded-xl bg-card p-2 ring-1 ring-border-soft`,children:[(0,H.jsx)(g,{type:f?`password`:`text`,autoComplete:`off`,value:u,placeholder:I(`ask.typeInto`),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_({type:`type`,text:u}).then(()=>d(``)))},autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`send`,className:`h-9 min-w-[9rem] flex-1 basis-full text-[0.8125rem] sm:basis-0 coarse:h-11`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:n(`h-9 shrink-0 rounded-md px-2.5 text-[0.75rem] coarse:h-11 coarse:px-3.5`,f?`bg-ember-veil text-ink`:`text-ink-3 hover:bg-paper-2`),children:I(`ask.hide`)}),(0,H.jsx)(Hl,{label:`Enter`,onClick:()=>void _({type:`key`,key:`Enter`}),children:(0,H.jsx)(ba,{className:`size-4`})}),(0,H.jsx)(Hl,{label:I(`ask.up`),onClick:()=>void _({type:`scroll`,dy:-500}),children:(0,H.jsx)(Qi,{className:`size-4`})}),(0,H.jsx)(Hl,{label:I(`ask.down`),onClick:()=>void _({type:`scroll`,dy:500}),children:(0,H.jsx)(Ki,{className:`size-4`})})]}),m?(0,H.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:m}):null]}):null]})}function Hl({label:e,onClick:t,children:n}){return(0,H.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,className:`flex size-9 shrink-0 items-center justify-center rounded-md text-ink-3 hover:bg-paper-2 hover:text-ink coarse:size-11`,children:n})}function Ul({runId:e,question:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(!1),[o,c]=(0,V.useState)(null),l=async()=>{a(!0),c(null);try{await Z.post(`${Q(e)}/question`,{answer:n.trim()})}catch(e){c(e.message),a(!1)}};return(0,H.jsxs)(`div`,{className:`animate-rise`,children:[(0,H.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,H.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-ember-tint text-ember-strong`,children:(0,H.jsx)(oo,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:I(`question.asks`)}),(0,H.jsx)(`h2`,{className:`wizard-heading font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t})]})]}),(0,H.jsx)(s,{autoFocus:!0,minRows:4,placeholder:I(`question.placeholder`),value:n,onChange:e=>r(e.target.value)}),(0,H.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-4`,children:I(`question.later`)}),o?(0,H.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:o}):null,(0,H.jsx)(`div`,{className:`action-bar mt-6 flex items-center justify-end gap-3`,children:(0,H.jsxs)(_,{busy:i,disabled:!n.trim(),onClick:()=>void l(),children:[I(`question.send`),(0,H.jsx)(Xi,{className:`size-4`})]})})]})}function Wl({runId:e,ask:t}){return t.kind===`confirm`?(0,H.jsx)(Gl,{runId:e,ask:t}):(0,H.jsx)(Kl,{runId:e,ask:t})}function Gl({runId:e,ask:t}){let[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),l=async n=>{o(!0),c(null);try{await Z.post(`${Q(e)}/ask/${t.id}`,n)}catch(e){c(e.message),o(!1)}},u=t.action.destructive?qo:yo;return(0,H.jsxs)(`div`,{className:`animate-rise`,children:[(0,H.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,H.jsx)(`div`,{className:n(`flex size-10 shrink-0 items-center justify-center rounded-full`,t.action.destructive?`bg-rose-tint text-rose`:`bg-ember-tint text-ember-strong`),children:(0,H.jsx)(u,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:I(t.again?`ask.again`:`ask.wants`,{service:t.service})}),(0,H.jsx)(`h2`,{className:`wizard-heading font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason})]})]}),(0,H.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-paper-2 p-4 text-[0.8125rem] leading-relaxed ring-1 ring-border-soft`,children:t.input}),t.again?(0,H.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-ink-2`,children:I(`ask.againHint`,{service:t.service})}):null,t.once?null:(0,H.jsxs)(`div`,{className:`mt-5 flex items-center gap-4`,children:[(0,H.jsx)(d,{checked:r,onChange:i,label:I(`ask.allowRest`)}),(0,H.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:I(`ask.allowRest`)})]}),s?(0,H.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:s}):null,(0,H.jsxs)(`div`,{className:`action-bar mt-6 flex items-center justify-between gap-3`,children:[(0,H.jsx)(_,{variant:`ghost`,disabled:a,onClick:()=>void l({type:`skip`}),children:I(t.again?`ask.againDeny`:`ask.deny`)}),(0,H.jsx)(_,{busy:a,onClick:()=>void l({type:`done`,remember:r}),children:I(t.again?`ask.againAllow`:`ask.allow`)})]})]})}function Kl({runId:e,ask:t}){let[n,r]=(0,V.useState)({}),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),f=async n=>{c(!0),u(null);try{await Z.post(`${Q(e)}/ask/${t.id}`,n)}catch(e){u(e.message),c(!1)}},p=t.fields.some(e=>n[e.id]);return(0,H.jsxs)(`div`,{className:`animate-rise`,children:[(0,H.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,H.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-ember-tint text-ember-strong`,children:(0,H.jsx)(eo,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`wizard-heading font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason}),(0,H.jsxs)(`p`,{className:`mt-0.5 truncate text-[0.8125rem] text-ink-3`,children:[t.site.host,t.site.title?` · ${t.site.title}`:``]})]})]}),(0,H.jsx)(Vl,{runId:e,driving:!0}),(0,H.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-4`,children:I(`ask.pictureHint`)}),t.fields.length?(0,H.jsxs)(`form`,{className:`mt-5 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),f({type:`fill`,values:n,remember:a})},children:[t.fields.map((e,a)=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(i,{children:e.label}),(0,H.jsx)(g,{autoFocus:a===0,type:e.secret?`password`:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:a===t.fields.length-1?`go`:`next`,value:n[e.id]??``,onChange:t=>r(n=>({...n,[e.id]:t.target.value}))})]},e.id)),(0,H.jsx)(`button`,{type:`submit`,hidden:!0})]}):null,(0,H.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-4`,children:[(0,H.jsx)(d,{checked:a,onChange:o,label:I(`ask.remember`)}),(0,H.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:I(`ask.remember`)})]}),(0,H.jsxs)(`p`,{className:`mt-3 flex items-start gap-2 text-[0.8125rem] text-ink-3`,children:[(0,H.jsx)(Lo,{className:`mt-0.5 size-4 shrink-0 text-moss`}),` `,I(`ask.private`)]}),l?(0,H.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:l}):null,(0,H.jsxs)(`div`,{className:`action-bar mt-6 flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(_,{variant:`ghost`,disabled:s,onClick:()=>void f({type:`skip`}),children:I(`ask.skip`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.fields.length?(0,H.jsx)(_,{variant:`secondary`,disabled:s,onClick:()=>void f({type:`done`,remember:a}),children:I(`ask.done`)}):null,t.fields.length?(0,H.jsx)(_,{busy:s,disabled:!p,onClick:()=>void f({type:`fill`,values:n,remember:a}),children:I(`ask.signIn`)}):(0,H.jsx)(_,{busy:s,onClick:()=>void f({type:`done`,remember:a}),children:I(`ask.done`)})]})]})]})}var ql=typeof window<`u`&&window.matchMedia?.(`(pointer: coarse)`).matches===!0,Jl=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia;function Yl(){(0,V.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{let e=document.activeElement;t.classList.contains(`keyboard-open`)&&e instanceof HTMLElement&&e!==document.body&&requestAnimationFrame(()=>e.scrollIntoView({block:`nearest`}))},r=()=>{let r=e.scale>1.01?0:window.innerHeight-e.height-e.offsetTop,i=r>80,a=i&&!t.classList.contains(`keyboard-open`);t.style.setProperty(`--kb`,i?`${Math.round(r)}px`:`0px`),t.classList.toggle(`keyboard-open`,i),a&&n()};return r(),e.addEventListener(`resize`,r),e.addEventListener(`scroll`,r),document.addEventListener(`focusin`,n),()=>{e.removeEventListener(`resize`,r),e.removeEventListener(`scroll`,r),document.removeEventListener(`focusin`,n),t.style.removeProperty(`--kb`),t.classList.remove(`keyboard-open`)}},[])}function Xl(e){let[t,n]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{if(e&&Fl(`keepAwake`))return Ll(`keepAwake`,!0),n(!0),()=>{Ll(`keepAwake`,!1),n(!1)};if(!e||!(`wakeLock`in navigator))return;let t=null,r=!1,i=async()=>{if(!(r||t||document.visibilityState!==`visible`))try{let e=await navigator.wakeLock.request(`screen`);if(r){e.release().catch(()=>void 0);return}t=e,n(!0),e.addEventListener(`release`,()=>{t===e&&(t=null,n(!1))})}catch{}};return i(),document.addEventListener(`visibilitychange`,i),()=>{r=!0,document.removeEventListener(`visibilitychange`,i),t?.release().catch(()=>void 0),t=null,n(!1)}},[e]),t}var Zl=`wz.notify`,Ql=new Set,$l=null;function eu(){try{return localStorage.getItem(Zl)===`1`}catch{return!1}}function tu(e){try{e?localStorage.setItem(Zl,`1`):localStorage.removeItem(Zl)}catch{}for(let e of Ql)e()}var nu=typeof window<`u`&&`Notification`in window,ru=null;function iu(){return eu()?Fl(`notify`)?ru===!1?`quiet`:`on`:nu&&Notification.permission===`granted`?`on`:`quiet`:`off`}function au(){return(0,V.useSyncExternalStore)(e=>(Ql.add(e),()=>Ql.delete(e)),iu,()=>`off`)}function ou(){return Fl(`notify`)?ru===!1:nu&&Notification.permission===`denied`}async function su(){if(tu(!0),Fl(`notify`)){ru=!Fl(`notifyPermission`)||await Il(`notifyPermission`).catch(()=>!1);for(let e of Ql)e();return iu()}try{$l??=new AudioContext,$l.resume()}catch{$l=null}if(nu&&Notification.permission==="default")try{await Notification.requestPermission()}catch{}if(nu&&Notification.permission===`granted`){let e=Ml().serviceWorker;e&&await navigator.serviceWorker?.register(e).catch(()=>void 0)}for(let e of Ql)e();return iu()}function cu(){tu(!1)}function lu(){let e=$l;if(e?.state!==`running`)return;let t=e.currentTime;for(let[n,r]of[660,880].entries()){let i=e.createOscillator(),a=e.createGain();i.frequency.value=r,a.gain.setValueAtTime(0,t+n*.16),a.gain.linearRampToValueAtTime(.18,t+n*.16+.02),a.gain.exponentialRampToValueAtTime(.001,t+n*.16+.32),i.connect(a).connect(e.destination),i.start(t+n*.16),i.stop(t+n*.16+.34)}}async function uu(e){if(!eu())return;if(Fl(`notify`)){Ll(`notify`,e);return}if(document.visibilityState===`visible`){lu(),navigator.vibrate?.([120,60,120]);return}if(!nu||Notification.permission!==`granted`)return;let t={body:e.body,tag:e.tag,icon:Pl(`icons/icon-192.png`),badge:Pl(`icons/icon-192.png`),data:{url:location.href}};try{let n=await navigator.serviceWorker?.getRegistration();if(n?.active){await n.showNotification(e.title,t);return}}catch{}try{new Notification(e.title,t)}catch{}}function du(){if(typeof navigator>`u`||!navigator.canShare)return!1;try{return navigator.canShare({files:[new File([`x`],`x.pdf`,{type:`application/pdf`})]})}catch{return!1}}async function fu(e,t=2400){if(!/^image\/(jpeg|png|webp)$/.test(e.type)||e.size<12e5)return e;try{let n=await createImageBitmap(e),r=Math.min(1,t/Math.max(n.width,n.height)),i=document.createElement(`canvas`);i.width=Math.round(n.width*r),i.height=Math.round(n.height*r),i.getContext(`2d`)?.drawImage(n,0,0,i.width,i.height);let a=await new Promise(e=>i.toBlob(e,`image/jpeg`,.86));return a&&a.size<e.size?new File([a],`${e.name.replace(/\.[^.]+$/,``)}.jpg`,{type:`image/jpeg`}):e}catch{return e}}function pu(){return new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`)}function mu(e){let t=e?.name;return t===`NotFoundError`||t===`OverconstrainedError`?`missing`:t===`NotReadableError`||t===`AbortError`?`busy`:`denied`}function hu(e){return!!e?.getCapabilities?.()?.torch}function gu(e,t,n=!1){let r=(0,V.useRef)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(1),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{if(!e)return;let r=null,i=!1;s(null),a(null),d(!1),p(!1);let o={facingMode:{ideal:t},width:{ideal:2560},height:{ideal:1440}};return(async()=>{if(!navigator.mediaDevices?.getUserMedia)throw new DOMException(`no camera api`,`NotAllowedError`);try{r=await navigator.mediaDevices.getUserMedia({video:o,audio:n})}catch(e){if(!n)throw e;r=await navigator.mediaDevices.getUserMedia({video:o})}if(i){for(let e of r.getTracks())e.stop();return}a(r);let e=r.getVideoTracks()[0],t=()=>!i&&d(hu(e));t(),setTimeout(t,600);let s=await navigator.mediaDevices.enumerateDevices().catch(()=>[]);i||l(s.filter(e=>e.kind===`videoinput`).length)})().catch(e=>!i&&s(mu(e))),()=>{i=!0;for(let e of r?.getTracks()??[])e.stop()}},[e,t,n]),(0,V.useEffect)(()=>{r.current&&i&&(r.current.srcObject=i)},[i]),{video:r,stream:i,error:o,cameras:c,torchable:u,torch:f,setTorch:async e=>{let t=i?.getVideoTracks()[0];try{await t?.applyConstraints({advanced:[{torch:e}]}),p(e)}catch{d(!1)}},mirrored:i?.getVideoTracks()[0]?.getSettings().facingMode===`user`}}function _u({open:e,onClose:t,label:n,children:r}){let i=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let t=i.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,H.jsx)(`dialog`,{ref:i,onClose:t,"aria-label":n,className:`media-sheet`,children:e?(0,H.jsx)(`div`,{className:`flex h-full flex-col`,children:r}):null})}function vu({label:e,onClick:t,active:r,children:i}){return(0,H.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":r,onClick:t,className:n(`flex size-11 shrink-0 items-center justify-center rounded-full transition`,r?`bg-white text-black`:`bg-white/12 text-white hover:bg-white/20`),children:i})}function yu({title:e,onClose:t,camera:n,onFlip:r}){return(0,H.jsx)(`div`,{className:`safe-top`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,H.jsx)(vu,{label:I(`common.close`),onClick:t,children:(0,H.jsx)(E,{className:`size-5`})}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-center font-medium text-[0.9375rem]`,children:e}),n.torchable?(0,H.jsx)(vu,{label:I(`camera.torch`),active:n.torch,onClick:()=>void n.setTorch(!n.torch),children:n.torch?(0,H.jsx)(Ra,{className:`size-5`}):(0,H.jsx)(Ia,{className:`size-5`})}):null,n.stream&&(n.cameras>1||ql)?(0,H.jsx)(vu,{label:I(`camera.flip`),onClick:r,children:(0,H.jsx)(Uo,{className:`size-5`})}):(0,H.jsx)(`span`,{className:`size-11`})]})})}function bu({camera:e,asking:t,children:r,actions:i}){return(0,H.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,H.jsx)(`video`,{ref:e.video,autoPlay:!0,playsInline:!0,muted:!0,className:n(`absolute inset-0 size-full object-contain`,e.mirrored&&`-scale-x-100`)}),e.error?(0,H.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-5 bg-black px-8 text-center`,children:[(0,H.jsx)(`p`,{className:`max-w-sm text-[0.9375rem] text-white/85 leading-relaxed`,children:I(`camera.${e.error}`)}),i]}):e.stream?r:(0,H.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center text-white/75`,children:[(0,H.jsx)(o,{}),(0,H.jsx)(`p`,{className:`max-w-xs text-[0.875rem] leading-relaxed`,children:t})]})]})}var xu=30;function Su(){if(typeof MediaRecorder<`u`)return[`video/mp4;codecs=avc1.42E01E,mp4a.40.2`,`video/mp4`,`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`].find(e=>MediaRecorder.isTypeSupported(e))}var Cu=!!Su();function wu({open:e,multiple:t,video:r,onClose:i,onCapture:a,onNative:s}){let[c,l]=(0,V.useState)(`environment`),[u,d]=(0,V.useState)(`photo`),[f,p]=(0,V.useState)(0),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(null),v=(0,V.useRef)(null),y=gu(e,c,u===`video`);(0,V.useEffect)(()=>{e&&(p(0),d(`photo`),_(null))},[e]);let b=async e=>{h(!0);try{await a(e),p(e=>e+1),t||i()}finally{h(!1)}},x=async()=>{let e=y.video.current;if(!e?.videoWidth)return;let t=document.createElement(`canvas`);t.width=e.videoWidth,t.height=e.videoHeight,t.getContext(`2d`)?.drawImage(e,0,0);let n=await new Promise(e=>t.toBlob(e,`image/jpeg`,.9));n&&await b(new File([n],`foto-${pu()}.jpg`,{type:`image/jpeg`}))},S=()=>{v.current?.state===`recording`&&v.current.stop()},C=()=>{let e=Su();if(!y.stream||!e)return;let t=[],n=new MediaRecorder(y.stream,{mimeType:e,videoBitsPerSecond:25e5,audioBitsPerSecond:96e3});n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{_(null),v.current=null;let n=e.split(`;`)[0];if(t.length){let e=n===`video/mp4`?`mp4`:`webm`;b(new File(t,`video-${pu()}.${e}`,{type:n}))}},v.current=n,n.start(1e3),_(0)};(0,V.useEffect)(()=>{if(g===null)return;if(g>=xu){v.current?.state===`recording`&&v.current.stop();return}let e=setTimeout(()=>_(e=>e===null?null:e+1),1e3);return()=>clearTimeout(e)},[g]),(0,V.useEffect)(()=>{!e&&v.current&&(v.current.onstop=null,v.current.stop(),v.current=null)},[e]);let w=e=>`0:${String(e).padStart(2,`0`)}`;return(0,H.jsxs)(_u,{open:e,onClose:i,label:I(`camera.title`),children:[(0,H.jsx)(yu,{title:g===null?f?I(`camera.taken`,{n:f}):I(`camera.title`):`${w(g)} / ${w(xu)}`,onClose:i,camera:y,onFlip:()=>l(e=>e===`environment`?`user`:`environment`)}),(0,H.jsx)(bu,{camera:y,asking:I(`camera.asking`),actions:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[s?(0,H.jsxs)(Tu,{onClick:()=>{i(),s()},children:[(0,H.jsx)(ua,{className:`size-4`}),` `,I(ql?`camera.native`:`camera.pick`)]}):null,(0,H.jsx)(Tu,{quiet:!0,onClick:i,children:I(`common.close`)})]})}),(0,H.jsxs)(`div`,{className:n(`safe-bottom px-4 pt-3`,y.error&&`invisible`),children:[r&&Cu&&g===null?(0,H.jsx)(`div`,{className:`mb-3 flex justify-center gap-1 text-[0.8125rem]`,children:[`photo`,`video`].map(e=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":u===e,onClick:()=>d(e),className:n(`h-9 rounded-full px-4 font-medium transition`,u===e?`bg-white text-black`:`text-white/70 hover:text-white`),children:I(e===`photo`?`camera.photo`:`camera.video`)},e))}):null,(0,H.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_1fr] items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`text-[0.8125rem] text-white/70 leading-snug`,children:g===null?u===`video`?I(`camera.clipHint`,{s:xu}):I(t?`camera.hintMany`:`camera.hint`):I(`camera.recording`)}),(0,H.jsx)(`button`,{type:`button`,"aria-label":I(u===`photo`?`camera.shoot`:g===null?`camera.record`:`camera.stop`),disabled:!y.stream||m,onClick:()=>u===`photo`?void x():g===null?C():S(),className:`flex size-[72px] items-center justify-center rounded-full border-4 border-white transition active:scale-95 disabled:opacity-40`,children:m?(0,H.jsx)(o,{className:`text-white`}):u===`photo`?(0,H.jsx)(`span`,{className:`size-[54px] rounded-full bg-white`}):g===null?(0,H.jsx)(`span`,{className:`flex size-[54px] items-center justify-center rounded-full bg-[#e5484d]`,children:(0,H.jsx)(Zo,{className:`size-6 text-white`})}):(0,H.jsx)(`span`,{className:`size-7 rounded-md bg-[#e5484d]`})}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:t&&f&&g===null?(0,H.jsxs)(Tu,{onClick:i,children:[(0,H.jsx)(A,{className:`size-4`}),` `,I(`camera.done`)]}):null})]})]})]})}function Tu({onClick:e,quiet:t,children:r}){return(0,H.jsx)(`button`,{type:`button`,onClick:e,className:n(`inline-flex h-11 items-center justify-center gap-2 rounded-full px-5 font-medium text-[0.875rem] transition`,t?`text-white/75 hover:text-white`:`bg-white text-black hover:bg-white/90`),children:r})}var Eu=`w-full min-w-0 rounded-md bg-transparent px-2 py-1.5 text-[0.875rem] outline-none transition placeholder:text-ink-4 hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring`,Du=`font-medium text-[0.6875rem] text-ink-3 uppercase tracking-[0.08em]`,Ou=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function ku(e,t,n){if(!t.length)return n;let[r,...i]=t;if(Array.isArray(e)){let t=[...e];return t[r]=ku(t[r],i,n),t}let a=e??{};return{...a,[r]:ku(a[r],i,n)}}function Au(e,t){let n=e?.length?e:[...new Set(t.filter(Ou).flatMap(e=>Object.keys(e)))];return{kind:`object`,fields:Object.fromEntries(n.map(e=>[e,{kind:`text`}]))}}var ju=e=>e.kind!==`object`&&e.kind!==`table`&&(e.kind!==`list`||e.of.kind!==`object`)&&!(e.kind===`text`&&e.long),Mu=e=>Object.values(e.fields).every(ju),Nu=e=>Object.values(e.fields).every(e=>e.kind!==`table`&&(e.kind!==`list`||e.of.kind!==`object`));function Pu(e,t){let n=N(e);return n?String(t[n]??``):``}function Fu({text:e}){return(0,H.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e})}function Iu({shape:e,value:t,path:r,ctx:i,cell:a}){switch(e.kind){case`text`:return i.edit?e.long?(0,H.jsx)(`textarea`,{className:n(Eu,`field-sizing-content max-h-60 resize-none`),value:String(t??``),onChange:e=>i.set(r,e.target.value)}):(0,H.jsx)(`input`,{className:Eu,value:String(t??``),onChange:e=>i.set(r,e.target.value)}):(0,H.jsx)(Fu,{text:t==null?``:String(t)});case`number`:return i.edit?(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`input`,{type:`number`,className:n(Eu,`text-right tabular-nums`,a&&`w-20`),value:t==null?``:Number(t),onChange:e=>i.set(r,e.target.value===``?null:Number(e.target.value))}),e.unit?(0,H.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:e.unit}):null]}):(0,H.jsx)(`span`,{className:`tabular-nums`,children:t==null?``:`${t}${e.unit?` ${e.unit}`:``}`});case`yesno`:{let a=t?e.yes??I(`data.yes`):e.no??I(`data.no`);return i.edit?(0,H.jsxs)(`label`,{className:`flex items-center gap-2 px-2 py-1.5 text-[0.8125rem] text-ink-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!t,onChange:e=>i.set(r,e.target.checked),className:`size-4 accent-[var(--second)]`}),a]}):(0,H.jsx)(`span`,{className:n(`inline-flex rounded-full px-2 py-0.5 text-[0.75rem]`,t?`bg-second-tint text-second`:`bg-paper-2 text-ink-3`),children:a})}case`choice`:case`score`:return i.edit?(0,H.jsx)(`select`,{className:Eu,value:String(t??``),onChange:e=>i.set(r,e.target.value),children:[...new Set([String(t??``),...e.options])].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))}):(0,H.jsx)(`span`,{children:String(t??``)});case`ref`:{let n=i.shape.fields[e.to],a=n?.kind===`list`&&n.of.kind===`object`?n.of:{kind:`object`,fields:{}},o=(Array.isArray(i.root[e.to])?i.root[e.to]:[]).filter(Ou),s=o.find(e=>e.id===t);return i.edit?(0,H.jsxs)(`select`,{className:Eu,value:String(t??``),onChange:e=>i.set(r,e.target.value),children:[s?null:(0,H.jsx)(`option`,{value:String(t??``),children:String(t??``)}),o.map(e=>(0,H.jsx)(`option`,{value:String(e.id),children:Pu(a,e)||String(e.id)},String(e.id)))]}):s?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i.open(String(s.id)),className:`inline-flex items-center gap-1 text-left text-ember-strong hover:underline`,children:[(0,H.jsx)(Xa,{className:`size-3.5 shrink-0`}),Pu(a,s)||String(s.id)]}):(0,H.jsx)(`span`,{className:`text-rose`,children:I(`data.missing`,{id:String(t??``)})})}case`table`:{let n=Array.isArray(t)?t:[];return(0,H.jsx)(Bu,{shape:Au(e.columns,n),value:n,path:r,ctx:i})}case`list`:if(e.of.kind===`object`){let n=e.of,a=Mu(n)?Bu:Nu(n)?Vu:Hu;return(0,H.jsx)(a,{shape:n,value:t,path:r,ctx:i})}return(0,H.jsx)(Lu,{value:t,path:r,ctx:i});case`object`:return(0,H.jsx)(Uu,{shape:e,value:t,path:r,ctx:i})}}function Lu({value:e,path:t,ctx:n}){let r=Array.isArray(e)?e.map(String):[],[i,a]=(0,V.useState)(``);return(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1`,children:[r.map((e,i)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-paper-2 px-2 py-0.5 text-[0.75rem]`,children:[e,n.edit?(0,H.jsx)(`button`,{type:`button`,"aria-label":I(`data.remove`),onClick:()=>n.set(t,r.filter((e,t)=>t!==i)),className:`text-ink-3 hover:text-ink`,children:(0,H.jsx)(E,{className:`size-3`})}):null]},`${e}-${i}`)),n.edit?(0,H.jsx)(`input`,{className:`w-20 rounded-full bg-transparent px-2 py-0.5 text-[0.75rem] outline-none ring-1 ring-border-soft focus:ring-ring`,placeholder:`+`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&(e.preventDefault(),n.set(t,[...r,i.trim()]),a(``))}}):null]})}var Ru=e=>(Array.isArray(e)?e:[]).filter(Ou),zu=e=>e.fields.id?{id:`n${Date.now().toString(36)}`}:{};function Bu({shape:e,value:t,path:r,ctx:i}){let a=Ru(t),o=Object.entries(e.fields);return(0,H.jsxs)(`div`,{className:`overflow-x-auto rounded-lg ring-1 ring-border-soft`,children:[(0,H.jsxs)(`table`,{className:`w-full border-collapse text-[0.8125rem]`,children:[(0,H.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,H.jsxs)(`tr`,{children:[o.map(([e,t])=>(0,H.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:P(e,t)},e)),i.edit?(0,H.jsx)(`th`,{className:`w-8`}):null]})}),(0,H.jsx)(`tbody`,{children:a.map((e,t)=>(0,H.jsxs)(`tr`,{className:`group border-border-soft border-t`,children:[o.map(([a,o])=>(0,H.jsx)(`td`,{className:n(`align-top`,i.edit?`p-0.5`:`px-3 py-2`),children:(0,H.jsx)(Iu,{shape:o,value:e[a],path:[...r,t,a],ctx:i,cell:!0})},a)),i.edit?(0,H.jsx)(`td`,{className:`p-0.5 align-middle`,children:(0,H.jsx)(Gu,{onClick:()=>i.set(r,a.filter((e,n)=>n!==t))})}):null]},t))})]}),i.edit?(0,H.jsx)(Ku,{what:e.label,onClick:()=>i.set(r,[...a,zu(e)])}):null]})}function Vu({shape:e,value:t,path:r,ctx:i}){let a=Ru(t),o=Object.entries(e.fields),s=o.filter(([,e])=>e.kind===`text`&&e.long),c=o.filter(([,e])=>!(e.kind===`text`&&e.long));return(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-lg ring-1 ring-border-soft`,children:[(0,H.jsx)(`ol`,{children:a.map((e,t)=>(0,H.jsxs)(`li`,{className:`grid grid-cols-[1.75rem_1fr_auto] items-start gap-2 border-border-soft border-t px-3 py-2 first:border-0`,children:[(0,H.jsx)(`span`,{className:`pt-1.5 font-display font-semibold text-ember-strong tabular-nums`,children:t+1}),(0,H.jsx)(`div`,{className:n(`flex min-w-0 flex-col`,!i.edit&&`pt-1`),children:s.map(([n,a])=>(0,H.jsx)(Iu,{shape:a,value:e[n],path:[...r,t,n],ctx:i},n))}),(0,H.jsxs)(`div`,{className:n(`flex items-center gap-2 text-[0.8125rem] text-ink-3`,!i.edit&&`pt-1`),children:[c.map(([n,a])=>(0,H.jsx)(Iu,{shape:a,value:e[n],path:[...r,t,n],ctx:i,cell:!0},n)),i.edit?(0,H.jsx)(Gu,{onClick:()=>i.set(r,a.filter((e,n)=>n!==t))}):null]})]},t))}),i.edit?(0,H.jsx)(Ku,{what:e.label,onClick:()=>i.set(r,[...a,zu(e)])}):null]})}function Hu({shape:e,value:t,path:n,ctx:r}){let i=Ru(t),a=Object.entries(e.fields),o=N(e),s=a.filter(([e,t])=>e!==o&&e!==`id`&&(t.kind===`text`&&!t.long||t.kind===`number`||t.kind===`choice`)),c=a.filter(([,e])=>e.kind===`list`&&e.of.kind===`object`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map((t,a)=>{let o=typeof t.id==`string`?t.id:void 0;return(0,H.jsxs)(`details`,{id:o?`${r.scope}-${o}`:void 0,className:`group rounded-xl bg-card ring-1 ring-border-soft open:ring-ink-4/40`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-3 [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(ga,{className:`size-4 shrink-0 text-ink-3 transition-transform group-open:rotate-90`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate font-medium text-[0.9375rem]`,children:Pu(e,t)||`${e.label??``} ${a+1}`.trim()}),(0,H.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[0.75rem] text-ink-3`,children:[s.map(([e,n])=>t[e]===void 0||t[e]===``?null:(0,H.jsx)(`span`,{children:n.kind===`number`&&n.unit?`${t[e]} ${n.unit}`:String(t[e])},e)),c.map(([e,n])=>(0,H.jsxs)(`span`,{children:[Array.isArray(t[e])?t[e].length:0,` `,P(e,n)]},e))]})]}),r.edit?(0,H.jsx)(Gu,{onClick:()=>r.set(n,i.filter((e,t)=>t!==a))}):null]}),(0,H.jsx)(`div`,{className:`border-border-soft border-t px-4 py-4`,children:(0,H.jsx)(Uu,{shape:e,value:t,path:[...n,a],ctx:r})})]},a)}),r.edit?(0,H.jsx)(Ku,{what:e.label,onClick:()=>r.set(n,[...i,zu(e)])}):null]})}function Uu({shape:e,value:t,path:n,ctx:r}){let i=Ou(t)?t:{},a=e=>e.kind===`list`||e.kind===`object`||e.kind===`table`||e.kind===`text`&&!!e.long;return(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-x-4 gap-y-4`,children:Object.entries(e.fields).map(([e,t])=>(0,H.jsx)(Wu,{title:P(e,t),wide:a(t),count:Array.isArray(i[e])?i[e].length:null,children:(0,H.jsx)(Iu,{shape:t,value:i[e],path:[...n,e],ctx:r})},e))})}function Wu({title:e,wide:t,count:r,children:i}){return(0,H.jsxs)(`div`,{className:n(`flex min-w-0 flex-col gap-1.5 text-[0.875rem]`,t&&`col-span-full`),children:[(0,H.jsxs)(`span`,{className:Du,children:[e,r===null?null:(0,H.jsx)(`span`,{className:`ml-1 text-ink-4`,children:r})]}),i]})}function Gu({onClick:e}){return(0,H.jsx)(`button`,{type:`button`,"aria-label":I(`data.remove`),onClick:t=>{t.preventDefault(),e()},className:`grid size-7 place-items-center rounded-md text-ink-3 hover:bg-accent hover:text-rose`,children:(0,H.jsx)(O,{className:`size-3.5`})})}function Ku({what:e,onClick:t}){return(0,H.jsxs)(`button`,{type:`button`,onClick:t,className:`flex w-full items-center gap-1.5 border-border-soft border-t px-3 py-2 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,H.jsx)(w,{className:`size-3.5`}),` `,I(`data.add`,{what:e??``}).trim()]})}function qu({shape:e,value:t,onChange:n,mode:r,onMode:i,modes:a=[`view`,`edit`,`json`],start:o}){let s=n?a:a.filter(e=>e!==`edit`),[l,u]=(0,V.useState)(o&&s.includes(o)?o:s[0]??`view`),d=r??l,f=i??u,p=(0,V.useId)().replace(/[^a-zA-Z0-9_-]/g,``),m={root:t,shape:e,edit:d===`edit`&&!!n,scope:p,set:(e,r)=>n?.(ku(t,e,r)),open:e=>{let t=document.getElementById(`${p}-${e}`);t&&(t.open=!0,t.scrollIntoView({behavior:`smooth`,block:`center`}))}},h=Object.entries(e.fields);return(0,H.jsxs)(`div`,{className:`flex flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-border-soft border-b px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1`,children:h.length>1?h.map(([e,n])=>(0,H.jsxs)(`a`,{href:`#${p}-part-${e}`,className:`rounded-full px-2.5 py-1 text-[0.8125rem] text-ink-2 hover:bg-accent`,children:[P(e,n),Array.isArray(t[e])?(0,H.jsx)(`span`,{className:`ml-1 text-ink-4 tabular-nums`,children:t[e].length}):null]},e)):null}),s.length>1?(0,H.jsx)(c,{value:d,onChange:f,label:I(`data.modes`),options:s.map(e=>({id:e,label:I(`data.${e}`)}))}):null]}),d===`json`?(0,H.jsx)(`pre`,{className:`max-h-[36rem] overflow-auto p-4 font-mono text-[0.75rem] text-ink-2 leading-relaxed`,children:JSON.stringify(t,null,2)}):(0,H.jsx)(`div`,{className:`flex flex-col gap-7 p-4 sm:p-5`,children:h.map(([e,n])=>(0,H.jsxs)(`section`,{id:`${p}-part-${e}`,className:`flex scroll-mt-4 flex-col gap-2`,children:[(0,H.jsxs)(`h3`,{className:`flex items-baseline gap-2 font-display font-semibold text-[1rem]`,children:[P(e,n),Array.isArray(t[e])?(0,H.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-4 tabular-nums`,children:t[e].length}):null]}),(0,H.jsx)(`div`,{className:`text-[0.9375rem] leading-relaxed`,children:(0,H.jsx)(Iu,{shape:n,value:t[e],path:[e],ctx:m})})]},e))})]})}function Ju({items:e}){let[t,r]=(0,V.useState)(!1),i=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!t)return;let e=e=>{i.current?.contains(e.target)||r(!1)},n=e=>e.key===`Escape`&&r(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,n)}},[t]),(0,H.jsxs)(`div`,{ref:i,className:`relative`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":I(`data.menu`),title:I(`data.menu`),"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>r(e=>!e),className:n(`grid size-8 place-items-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink coarse:size-11`,t&&`bg-accent text-ink`),children:(0,H.jsx)(Oa,{className:`size-4`})}),t?(0,H.jsx)(`div`,{role:`menu`,className:`absolute top-full right-0 z-50 mt-1 w-60 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 transition hover:bg-accent hover:text-ink`,onClick:()=>{r(!1),e.onClick()},children:[e.icon,e.label]},e.label))}):null]})}function Yu(e){return e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`output`}function Xu({shape:e,title:t,open:n,onClose:r}){let[i,a]=(0,V.useState)(!1),o=n?JSON.stringify(ae(e,t),null,2):``;return(0,H.jsx)(l,{open:n,onClose:r,title:`${I(`data.schema`)} · ${t}`,wide:!0,height:`tall`,children:(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,H.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto rounded-lg bg-paper-2 p-3 font-mono text-[0.75rem] text-ink-2 leading-relaxed`,children:o}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(o),a(!0),setTimeout(()=>a(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[i?(0,H.jsx)(A,{className:`size-3.5`}):(0,H.jsx)(T,{className:`size-3.5`}),I(i?`share.copied`:`data.copy`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let e=URL.createObjectURL(new Blob([o],{type:`application/schema+json`})),n=document.createElement(`a`);n.href=e,n.download=`${Yu(t)}.schema.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[(0,H.jsx)(wa,{className:`size-3.5`}),` `,I(`data.download`)]})]})]})})}function Zu(e){if(!oe(e)||e.type===`tool`)return null;let t=te(e);return t.output.format===`json`&&!t.foreach?t:null}function Qu({runId:e,step:t,output:n,header:r,children:i}){let a=Ce(t),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(null),g=u??(Ou(n.json)?n.json:{}),v=async()=>{if(u){p(!0),h(null);try{await Z.put(`${Q(e)}/outputs/${t.id}`,{json:u}),d(null),s(!1)}catch(e){h(e.message)}finally{p(!1)}}},y=(0,H.jsx)(Ju,{items:[{label:I(o?`data.close`:`data.open`),icon:(0,H.jsx)(Sa,{className:`size-4 shrink-0`}),onClick:()=>{s(e=>!e),d(null)}},{label:I(`data.schema`),icon:(0,H.jsx)(oa,{className:`size-4 shrink-0`}),onClick:()=>l(!0)}]});return(0,H.jsxs)(H.Fragment,{children:[r(y),o?(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:[(0,H.jsx)(qu,{shape:a,value:g,onChange:d}),u?(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-border-soft border-t px-3 py-2`,children:[m?(0,H.jsx)(`span`,{className:`mr-auto text-[0.8125rem] text-rose`,children:m}):null,(0,H.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>d(null),children:I(`common.cancel`)}),(0,H.jsx)(_,{size:`sm`,busy:f,onClick:()=>void v(),children:I(`data.save`)})]}):null]}):i,(0,H.jsx)(Xu,{shape:a,title:t.title,open:c,onClose:()=>l(!1)})]})}var $u=e=>{if(e!=null&&e!==``)return M(e)??void 0},ed=(e,t)=>e===void 0?`–`:`${new Intl.NumberFormat(Te()).format(e)}${t?` ${t}`:``}`,td=e=>Number(e.toFixed(6));function nd({value:e,unit:t,placeholder:n,onChange:r}){let i=(0,H.jsx)(g,{inputMode:`decimal`,autoComplete:`off`,value:e,placeholder:n,onChange:e=>r(e.target.value)});return t?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,(0,H.jsx)(`span`,{className:`shrink-0 text-ink-2 text-sm`,children:t})]}):i}function rd({label:e,value:t,min:n,max:r,increment:i,unit:a,onChange:o}){let s=$u(t);return(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(`div`,{className:`font-display font-semibold text-3xl tabular-nums`,children:ed(s,a)}),(0,H.jsx)(`input`,{type:`range`,"aria-label":e,min:n,max:r,step:i??`any`,value:s??n,onChange:e=>o(Number(e.target.value)),className:`h-11 w-full cursor-pointer accent-ember`}),(0,H.jsxs)(`div`,{className:`flex justify-between text-[0.8125rem] text-ink-3 tabular-nums`,children:[(0,H.jsx)(`span`,{children:ed(n,a)}),(0,H.jsx)(`span`,{children:ed(r,a)})]})]})}function id({value:e,min:t,max:n,increment:r,unit:i,placeholder:a,onChange:o}){let s=$u(e),c=r??1,l=e=>{let r=td(s===void 0?t??0:s+e*c);o(Math.min(n??r,Math.max(t??r,r)))},u=`flex size-11 shrink-0 items-center justify-center rounded-full border border-input bg-card text-ink-2 text-xl transition hover:border-ink-4 hover:text-ink disabled:pointer-events-none disabled:opacity-40`;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":B(`run.less`),className:u,disabled:s!==void 0&&t!==void 0&&s<=t,onClick:()=>l(-1),children:`−`}),(0,H.jsx)(g,{inputMode:`decimal`,autoComplete:`off`,className:`text-center tabular-nums`,value:e==null?``:String(e),placeholder:a,onChange:e=>o(e.target.value)}),i?(0,H.jsx)(`span`,{className:`shrink-0 text-ink-2 text-sm`,children:i}):null,(0,H.jsx)(`button`,{type:`button`,"aria-label":B(`run.more`),className:u,disabled:s!==void 0&&n!==void 0&&s>=n,onClick:()=>l(1),children:`+`})]})}function ad({name:e,value:t,options:r,disabled:i,label:a,onChange:o}){return(0,H.jsx)(`div`,{className:`grid gap-2`,children:r.map(r=>{let s=t===r,c=i.has(r);return(0,H.jsxs)(`label`,{className:n(`flex min-h-11 cursor-pointer items-center gap-3 rounded-xl border px-4 py-2.5 text-[0.9375rem] transition`,s?`border-ember bg-ember-tint text-ink`:`border-input bg-card text-ink-2`,c?`pointer-events-none opacity-60 line-through`:`hover:border-ink-4`),children:[(0,H.jsx)(`input`,{type:`radio`,name:e,checked:s,disabled:c,onChange:()=>o(r),className:`size-[1.125rem] shrink-0 appearance-none rounded-full border border-input bg-card transition-[border] checked:border-[0.3rem] checked:border-ember`}),(0,H.jsx)(`span`,{children:a(r)})]},r)})})}var od=25,sd=9e3;function cd(e){return e.code===e.PERMISSION_DENIED?`denied`:e.code===e.TIMEOUT?`timeout`:`unavailable`}function ld({value:e,base:t,placeholder:n,onChange:r,onBusy:i}){let a=be(e)?e:null,[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(null),d=(0,V.useRef)(!!a?.label),f=(0,V.useRef)(a);f.current=a;let m=a?.lat!==void 0&&a.lng!==void 0,h=typeof navigator<`u`&&`geolocation`in navigator,v=()=>{u.current!==null&&(navigator.geolocation.clearWatch(u.current),u.current=null),s(!1),i?.(!1)};(0,V.useEffect)(()=>()=>{u.current!==null&&navigator.geolocation.clearWatch(u.current)},[]);let y=async(e,n)=>{try{let{label:i}=await Z.post(`${t}/geocode`,{lat:e,lng:n,language:de}),a=f.current;i&&!d.current&&a?.lat===e&&a.lng===n&&r({...a,label:i})}catch{}},b=()=>{l(null),s(!0),i?.(!0);let e=Date.now(),t=1/0;u.current=navigator.geolocation.watchPosition(n=>{let{latitude:i,longitude:a,accuracy:o}=n.coords;if(o<t){t=o;let e=Math.round(i*1e6)/1e6,n=Math.round(a*1e6)/1e6,s=d.current?f.current?.label:void 0,c={lat:e,lng:n,accuracy:Math.round(o),...s?{label:s}:{}};f.current=c,r(c)}if(t<=od||Date.now()-e>sd){v();let e=f.current;e?.lat!==void 0&&e.lng!==void 0&&y(e.lat,e.lng)}},e=>{v(),t===1/0&&l(cd(e))},{enableHighAccuracy:!0,timeout:15e3,maximumAge:1e4})},x=e=>{d.current=e.trim().length>0;let t={...m?a:{},label:e};r(m||e.trim()?t:void 0)};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[m?(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,H.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,H.jsx)(no,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`truncate font-medium text-[0.9375rem] tabular-nums`,children:[a.lat?.toFixed(5),`, `,a.lng?.toFixed(5)]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[0.8125rem] text-ink-3`,children:[(0,H.jsx)(`span`,{children:o?I(`location.refining`):a.accuracy?I(`location.accuracy`,{m:a.accuracy}):null}),(0,H.jsxs)(`a`,{href:`https://www.openstreetmap.org/?mlat=${a.lat}&mlon=${a.lng}#map=17/${a.lat}/${a.lng}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline-offset-2 hover:text-ink hover:underline coarse:-my-3 coarse:min-h-11 coarse:min-w-11`,children:[I(`location.map`),` `,(0,H.jsx)(S,{className:`size-3`})]})]})]}),(0,H.jsx)(p,{label:I(`location.remove`),onClick:()=>{v(),d.current=!1,r(void 0)},children:(0,H.jsx)(E,{className:`size-4`})})]}):h?(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(_,{variant:`secondary`,size:`lg`,busy:o,onClick:b,className:`w-full sm:w-auto`,children:[o?null:(0,H.jsx)(Qa,{className:`size-4`}),I(o?`location.locating`:`location.use`)]}),c?(0,H.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:I(`location.${c}`)}):(0,H.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:I(`location.why`)})]}):null,(0,H.jsx)(g,{value:a?.label??``,placeholder:n??I(m?`location.label`:`location.manual`),autoComplete:`street-address`,enterKeyHint:`done`,"aria-label":I(`location.manual`),onChange:e=>x(e.target.value)})]})}var ud=null;function dd(){return ud??=(async()=>{let e=window.BarcodeDetector;if(e)try{let t=await e.getSupportedFormats();if(t.includes(`qr_code`)){let n=new e({formats:t});return{qrOnly:!1,detect:async e=>(await n.detect(e))[0]?.rawValue||null}}}catch{}let{default:t}=await Ee(async()=>{let{default:e}=await import(`./qr-scanner.min-Do0JFUkk.js`);return{default:e}},__vite__mapDeps([0,1])),n=t.createQrEngine();return{qrOnly:!0,detect:async e=>{try{return(await t.scanImage(e,{qrEngine:n,returnDetailedScanResult:!0})).data||null}catch{return null}}}})(),ud}function fd({open:e,onClose:t,onResult:n}){let r=(0,V.useRef)(n);r.current=n;let i=(0,V.useRef)(t);return i.current=t,(0,V.useEffect)(()=>{e&&Il(`scan`).then(e=>{e&&r.current(e)}).catch(()=>void 0).finally(()=>i.current())},[e]),null}function pd(e){return Fl(`scan`)?(0,H.jsx)(fd,{...e}):(0,H.jsx)(md,{...e})}function md({open:e,onClose:t,onResult:n}){let[r,i]=(0,V.useState)(`environment`),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),l=(0,V.useRef)(null),u=gu(e,r),d=(0,V.useRef)(n);d.current=n;let f=(0,V.useRef)(t);f.current=t,(0,V.useEffect)(()=>{e&&(c(!1),dd().then(e=>o(e.qrOnly)))},[e]),(0,V.useEffect)(()=>{if(!e||!u.stream)return;let t=!1,n,r=async()=>{let e=u.video.current;if(!t&&e&&e.readyState>=2&&e.videoWidth){let n=await(await dd()).detect(e).catch(()=>null);if(n&&!t){navigator.vibrate?.(60),d.current(n),f.current();return}}t||(n=setTimeout(r,200))};return r(),()=>{t=!0,clearTimeout(n)}},[e,u.stream,u.video]);let p=async e=>{if(!e)return;c(!1);let r=await createImageBitmap(e).catch(()=>null),i=r?await(await dd()).detect(r).catch(()=>null):null;i?(n(i),t()):c(!0)};return(0,H.jsxs)(_u,{open:e,onClose:t,label:I(`scan.title`),children:[(0,H.jsx)(yu,{title:I(`scan.title`),onClose:t,camera:u,onFlip:()=>i(e=>e===`environment`?`user`:`environment`)}),(0,H.jsx)(bu,{camera:u,asking:I(`scan.asking`),actions:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(Tu,{onClick:()=>l.current?.click(),children:[(0,H.jsx)(x,{className:`size-4`}),` `,I(`scan.fromPhoto`)]}),(0,H.jsx)(Tu,{quiet:!0,onClick:t,children:I(`scan.typeInstead`)})]}),children:(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,H.jsx)(`div`,{className:`aspect-square w-[min(68%,320px)] rounded-3xl border-2 border-white/90 shadow-[0_0_0_100vmax_rgb(0_0_0/0.35)]`})})}),(0,H.jsxs)(`div`,{className:`safe-bottom flex flex-col items-center gap-3 px-5 pt-3 text-center`,children:[(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-white/75 leading-snug`,children:I(s?`scan.miss`:a?`scan.hintQr`:`scan.hint`)}),u.stream?(0,H.jsxs)(Tu,{quiet:!0,onClick:()=>l.current?.click(),children:[(0,H.jsx)(x,{className:`size-4`}),` `,I(`scan.fromPhoto`)]}):null]}),(0,H.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,onChange:e=>{p(e.target.files?.[0]),e.target.value=``}})]})}var hd=`#1d1a17`,gd={width:1200,height:480};function _d(e,t,n,r,i){e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=hd,e.fillStyle=hd,e.lineWidth=i;for(let a of t){if(a.length===1){e.beginPath(),e.arc(a[0].x*n,a[0].y*r,i/2,0,Math.PI*2),e.fill();continue}e.beginPath(),e.moveTo(a[0].x*n,a[0].y*r);for(let t=1;t<a.length-1;t++){let i=a[t],o=a[t+1];e.quadraticCurveTo(i.x*n,i.y*r,(i.x+o.x)/2*n,(i.y+o.y)/2*r)}let t=a[a.length-1];e.lineTo(t.x*n,t.y*r),e.stroke()}}function vd({strokes:e,onStrokes:t}){let n=(0,V.useRef)(null),r=(0,V.useRef)(null),i=(0,V.useRef)(e);i.current=e;let a=()=>{let e=n.current,t=e?.getContext(`2d`);if(!e||!t)return;let a=window.devicePixelRatio||1,o=Math.round(e.clientWidth*a),s=Math.round(e.clientHeight*a);(e.width!==o||e.height!==s)&&(e.width=o,e.height=s),t.clearRect(0,0,o,s),_d(t,r.current?[...i.current,r.current]:i.current,o,s,2.4*a)};(0,V.useEffect)(()=>{a();let e=n.current;if(!e)return;let t=new ResizeObserver(a);return t.observe(e),()=>t.disconnect()},[e]);let o=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),y:Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))}};return(0,H.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl bg-white ring-1 ring-input`,children:[(0,H.jsx)(`canvas`,{ref:n,"aria-label":I(`sign.pad`),className:`block aspect-[5/2] w-full cursor-crosshair touch-none select-none`,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),r.current=[o(e)],a()},onPointerMove:e=>{r.current&&(r.current.push(o(e)),a())},onPointerUp:()=>{if(r.current){let e=r.current;r.current=null,t([...i.current,e])}},onPointerCancel:()=>{r.current=null,a()}}),(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-x-6 bottom-[22%] border-[#1d1a17]/25 border-b`}),e.length?null:(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-[#1d1a17]/40 text-[0.875rem]`,children:I(`sign.hint`)})]})}async function yd(e){let t=document.createElement(`canvas`);t.width=gd.width,t.height=gd.height;let n=t.getContext(`2d`);if(!n)return null;_d(n,e,gd.width,gd.height,7);let r=await new Promise(e=>t.toBlob(e,`image/png`));return r?new File([r],`unterschrift.png`,{type:`image/png`}):null}function bd({label:e,value:t,base:n,onChange:r}){let[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)([]),[c,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),m=typeof t==`string`&&t?t:null,h=async()=>{u(!0),f(null);try{let e=await yd(o);if(!e)return;r((await Z.upload(`${n}/uploads`,e)).id),a(!1)}catch(e){f(e.message)}finally{u(!1)}};return(0,H.jsxs)(`div`,{children:[m?(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>{s([]),a(!0)},className:`min-w-0 flex-1 rounded-lg bg-white px-3`,"aria-label":I(`sign.again`),children:(0,H.jsx)(`img`,{src:Nl(`${n}/assets/${m}`),alt:e,className:`mx-auto h-20 object-contain`})}),(0,H.jsx)(p,{label:I(`sign.remove`),onClick:()=>r(void 0),children:(0,H.jsx)(E,{className:`size-4`})})]}):(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{s([]),a(!0)},className:`flex w-full flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-4 py-7 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,children:[(0,H.jsx)(_o,{className:`size-6`}),I(`sign.open`)]}),(0,H.jsxs)(l,{open:i,onClose:()=>a(!1),title:e,wide:!0,children:[(0,H.jsx)(vd,{strokes:o,onStrokes:s}),d?(0,H.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:d}):null,(0,H.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,H.jsxs)(_,{variant:`ghost`,disabled:!o.length||c,onClick:()=>s([]),children:[(0,H.jsx)(Aa,{className:`size-4`}),` `,I(`sign.clear`)]}),(0,H.jsx)(_,{busy:c,disabled:!o.length,onClick:()=>void h(),children:I(`sign.accept`)})]})]})]})}var xd=36e5,Sd=6e4,Cd=1e3;function wd(e){return e.fractionDigits===void 0?e.style===`integer`?0:2:e.fractionDigits}function Td(e,t,n=`en`){if(typeof e!=`number`||!Number.isFinite(e))return``;let r=wd(t),i=t.grouping!==!1;return t.style===`percent`?new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,style:`percent`,useGrouping:i}).format(e):t.style===`currency`&&t.currency?new Intl.NumberFormat(n,{currency:t.currency,maximumFractionDigits:r,minimumFractionDigits:r,style:`currency`,useGrouping:i}).format(e):new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,useGrouping:i}).format(e)}function Ed(e,t,n=`en`){if(typeof e!=`string`||e.length===0)return``;if(t.kind===`time`)return Dd(e,t.timePrecision??`minutes`);if(t.dateStyle===`iso`)return t.kind===`date`?e.slice(0,10):e;let r=t.kind===`date`?new Date(`${e}T00:00:00`):new Date(e);if(Number.isNaN(r.getTime()))return e;let i=t.dateStyle??`medium`;if(t.kind===`date`)return new Intl.DateTimeFormat(n,{dateStyle:i}).format(r);let a=t.timePrecision??`minutes`;return new Intl.DateTimeFormat(n,{dateStyle:i,timeStyle:a===`hours`?`short`:`medium`}).format(r)}function Dd(e,t){let[n=`0`,r=`00`,i=`00`]=e.split(`:`);return t===`hours`?`${n.padStart(2,`0`)}:00`:t===`minutes`?`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`:`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}:${i.padStart(2,`0`)}`}function Od(e,t){if(typeof e!=`number`||!Number.isFinite(e))return``;let n=Math.max(0,Math.round(e));if(t.display===`iso`)return kd(n);if(t.display===`minutes`)return`${Math.round(n/Sd)} min`;if(t.display===`hours`)return`${(n/xd).toFixed(2)} h`;if(t.display===`decimal-hours`)return(n/xd).toFixed(2);let r=Math.floor(n/xd),i=Math.floor(n%xd/Sd),a=Math.floor(n%Sd/Cd);return`${r}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function kd(e){let t=Math.floor(e/xd),n=Math.floor(e%xd/Sd),r=Math.floor(e%Sd/Cd);return`${t>=24?`P${Math.floor(t/24)}D`:`P`}T${t%24}H${n}M${r}S`}function Ad(e,t,n=`en`){if(t==null)return``;switch(e.type){case`number`:return Td(t,e.format,n);case`date`:return Ed(t,e.format,n);case`duration`:return Od(t,e.format);case`boolean`:return t===!0?`true`:t===!1?`false`:``;case`select`:return jd(e,t);default:return String(t)}}function jd(e,t){let n=Array.isArray(t)?t:[t],r=e.format.options.reduce((e,t)=>(e[t.id]=t.label,e),{});return n.filter(e=>typeof e==`string`&&e.length>0).map(e=>r[e]??e).join(`, `)}function Md({runId:e,connectionId:t,connector:n,forSpace:r,onCancel:a,onSignedIn:o}){let[s,c]=(0,V.useState)({}),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),p=async()=>{u(!0),f(null);try{await Z.post(`${Q(e)}/connections/${t}/credentials/${n.id}`,{values:s,...r?{forSpace:r}:{}}),o?.()}catch(e){f(e.message)}finally{u(!1)}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-card p-4 ring-1 ring-input`,children:[(n.fields??[]).map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(i,{children:e.label}),(0,H.jsx)(g,{type:e.secret?`password`:`text`,autoComplete:`off`,value:s[e.key]??``,placeholder:e.placeholder,onChange:t=>c(n=>({...n,[e.key]:t.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),p())}})]},e.key)),n.hint?(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:n.hint}):null,d?(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:d}):null,(0,H.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,H.jsx)(_,{variant:`ghost`,size:`sm`,onClick:a,children:I(`common.cancel`)}),(0,H.jsx)(_,{size:`sm`,busy:l,onClick:()=>void p(),children:I(`connect.go`)})]})]})}function Nd({runId:e,connection:t,again:r,center:i,onSignedIn:a}){let[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),m=f?{forSpace:f}:void 0;(0,V.useEffect)(()=>{if(!a)return;let e=e=>{e.data?.type===`wizards:connected`&&e.data.ok&&a()};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[a]);let h=async n=>{if(d(null),l(null),Fl(`signIn`)){try{let{url:r}=await Z.post(`${Q(e)}/connections/${t.id}/oauth/${n.id}`,m);await Il(`signIn`,{url:r}),a?.()}catch(e){d(e.message)}return}let r=window.open(`about:blank`,`wizard-connect`,`width=540,height=700`);try{let{url:i}=await Z.post(`${Q(e)}/connections/${t.id}/oauth/${n.id}`,m);r?r.location.replace(i):l(i)}catch(e){r?.close(),d(e.message)}},g=f?t.connectors.filter(e=>t.forSpace?.includes(e.id)):t.connectors,_=g.find(e=>e.id===o);return t.connectors.length?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:n(`flex flex-wrap gap-2`,i&&`justify-center`),children:g.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>e.auth===`oauth2`?void h(e):s(o===e.id?null:e.id),className:n(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] ring-1 transition`,o===e.id?`bg-ember-veil text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ember`),children:[(0,H.jsx)(Xa,{className:`size-4`}),` `,r?I(`connect.signIn`,{name:e.name}):e.name]},e.id))}),t.forSpace?.length?(0,H.jsxs)(`label`,{className:n(`flex cursor-pointer items-start gap-2.5 text-left text-[0.8125rem] coarse:min-h-11`,i&&`self-center`),children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>{p(e.target.checked),s(null)},className:`mt-0.5 size-4 accent-[var(--ember)]`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`block font-medium text-ink-2`,children:I(`connect.forSpace`)}),(0,H.jsx)(`span`,{className:`block text-ink-3`,children:I(`connect.forSpaceWhy`)})]})]}):null,_?(0,H.jsx)(Md,{runId:e,connectionId:t.id,connector:_,forSpace:f,onCancel:()=>s(null),onSignedIn:a}):null,c?(0,H.jsx)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:`text-[0.875rem] text-ember underline`,children:I(`connect.openLink`)}):null,u?(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:u}):null]}):(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:I(`connect.none`)})}function Pd({view:e,center:t}){let n=e.id,r=(0,V.useCallback)(()=>void Z.post(`${Q(n)}/signed-in`).catch(()=>void 0),[n]),i=e.status===`sleeping`?e.signIn:null;return i&&`connection`in i?(0,H.jsx)(Nd,{runId:n,connection:i.connection,again:!0,center:t,onSignedIn:r}):null}var Fd=e=>e.title??I(`connect.mailbox`);function Id({runId:e,connection:t,onChosen:r}){let[i,a]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=async n=>{c(n.id),u(null);try{await Z.put(`${Q(e)}/connections/${t.id}/choice`,{owner:n.owner,id:n.id}),r?.()}catch(e){u(e.message)}finally{c(null)}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 text-left`,children:[(0,H.jsx)(`ul`,{className:`flex flex-col gap-2`,children:t.candidates.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e.chosen,disabled:s!==null,onClick:()=>void d(e),className:n(`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left ring-1 transition coarse:min-h-11`,e.chosen?`bg-ember-veil ring-ember`:`bg-card ring-input hover:ring-ember disabled:opacity-60`),children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate font-medium text-[0.9375rem]`,children:e.label}),(0,H.jsx)(`span`,{className:`block truncate text-[0.8125rem] text-ink-3`,children:e.owner===`person`?I(`connect.yours`):I(`connect.ofSpace`,{name:e.name??``})})]}),s===e.id?(0,H.jsx)(o,{}):e.chosen?(0,H.jsx)(A,{className:`size-4 shrink-0 text-ember`}):null]})},`${e.owner}:${e.id}`))}),i?(0,H.jsx)(Nd,{runId:e,connection:t,onSignedIn:r}):(0,H.jsxs)(_,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>a(!0),children:[(0,H.jsx)(w,{className:`size-4`}),` `,I(`connect.another`)]}),l?(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:l}):null]})}function Ld({view:e,center:t}){let r=e.id,i=(0,V.useCallback)(()=>void Z.post(`${Q(r)}/signed-in`).catch(()=>void 0),[r]);return(0,H.jsx)(`div`,{className:`flex w-full flex-col gap-8`,children:e.connect.map(e=>(0,H.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:n(t&&`text-center`),children:[(0,H.jsx)(`h3`,{className:`font-medium text-[1.0625rem] text-ink`,children:e.candidates.length?I(`connect.choose`,{name:Fd(e)}):I(`connect.first`,{name:Fd(e)})}),(0,H.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3`,children:e.description??I(`connect.firstWhy`)})]}),e.candidates.length?(0,H.jsx)(Id,{runId:r,connection:e,onChosen:i}):(0,H.jsx)(Nd,{runId:r,connection:e,center:t,onSignedIn:i})]},e.id))})}function Rd({runId:e,connection:t}){if(!t)return null;if(t.account){let n=t.connectors.find(e=>e.id===t.account?.connector)?.name??``;return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,H.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,H.jsx)(A,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate font-medium text-[0.9375rem]`,children:t.account.label}),(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:I(`connect.connected`,{name:n})})]}),(0,H.jsx)(p,{label:I(`connect.disconnect`),onClick:()=>void Z.del(`${Q(e)}/connections/${t.id}`),children:(0,H.jsx)(Yo,{className:`size-4`})})]})}return(0,H.jsx)(Nd,{runId:e,connection:t})}function zd(e){return e==null?``:Array.isArray(e)?e.join(`, `):String(e)}function Bd({column:e,value:t,boxed:r,onCommit:i}){let[a,o]=(0,V.useState)(zd(t));(0,V.useEffect)(()=>o(zd(t)),[t]);let s=n(`w-full min-w-0 rounded-md border border-transparent px-2 text-[0.8125rem] outline-none focus:border-ember focus:bg-card`,r?`h-11 bg-paper-2`:`h-9 bg-transparent hover:bg-paper-2 coarse:h-11`);return e.type===`boolean`?(0,H.jsx)(`label`,{className:`flex size-9 cursor-pointer items-center justify-center coarse:size-11`,children:(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":e.name,checked:t===!0,onChange:e=>i(e.target.checked),className:`size-4 accent-[var(--ember)] coarse:size-6`})}):e.type===`select`&&!e.format.multiple&&!e.format.allowCustom?(0,H.jsxs)(`select`,{value:a,onChange:e=>i(e.target.value||null),className:s,children:[(0,H.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,H.jsx)(`input`,{"aria-label":e.name,type:e.type===`date`&&e.format.kind===`date`?`date`:`text`,inputMode:e.type===`number`?`decimal`:void 0,enterKeyHint:`done`,autoComplete:`off`,value:a,onChange:e=>o(e.target.value),onBlur:()=>{a!==zd(t)&&i(he(e,a))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur())},className:n(s,e.type===`number`&&`text-right tabular-nums`)})}function Vd({runId:e,list:t,editable:r}){let{def:i,rows:a}=t,[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)({}),u=`${Q(e)}/lists/${i.id}/rows`,d=async e=>{s(null);try{await e()}catch(e){s(e instanceof Tl?e.message:String(e))}},f=()=>d(async()=>{await Z.post(u,{cells:c}),l({})}),m=Object.values(c).some(e=>e!=null&&e!==``);if(!a.length&&!r)return(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:I(`list.empty`)});let h=(e,t)=>t===0||e.type===`text`&&e.format?.style===`multiline`,g=(e,t,n)=>void d(()=>Z.patch(`${u}/${e}`,{cells:{[t]:n}}));return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[a.map(e=>(0,H.jsxs)(`div`,{className:`rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:i.columns.map((t,i)=>(0,H.jsxs)(`div`,{className:n(`min-w-0`,h(t,i)&&`col-span-2`),children:[(0,H.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:t.name}),r?(0,H.jsx)(Bd,{boxed:!0,column:t,value:e.cells[t.id],onCommit:n=>g(e.id,t.id,n)}):(0,H.jsx)(`div`,{className:n(`break-words px-1 text-[0.875rem]`,t.type===`number`&&`tabular-nums`),children:Ad(t,e.cells[t.id],de)||`—`})]},t.id))}),r?(0,H.jsx)(`div`,{className:`mt-1 flex justify-end`,children:(0,H.jsx)(p,{label:I(`list.delete`),onClick:()=>void d(()=>Z.del(`${u}/${e.id}`)),children:(0,H.jsx)(O,{className:`size-4`})})}):null]},e.id)),r?(0,H.jsxs)(`div`,{className:`rounded-lg border border-input border-dashed p-2`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:i.columns.map((e,t)=>(0,H.jsxs)(`div`,{className:n(`min-w-0`,h(e,t)&&`col-span-2`),children:[(0,H.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,H.jsx)(Bd,{boxed:!0,column:e,value:c[e.id],onCommit:t=>l(n=>({...n,[e.id]:t}))})]},e.id))}),(0,H.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,H.jsxs)(_,{variant:`secondary`,size:`sm`,onClick:()=>m?void f():void 0,children:[(0,H.jsx)(w,{className:`size-4`}),` `,I(`run.addRow`)]})})]}):null]}),(0,H.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg ring-1 ring-border-soft sm:block`,children:(0,H.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,H.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,H.jsxs)(`tr`,{children:[i.columns.map(e=>(0,H.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:e.name},e.id)),r?(0,H.jsx)(`th`,{className:`w-10`}):null]})}),(0,H.jsxs)(`tbody`,{children:[a.map(e=>(0,H.jsxs)(`tr`,{className:`border-border-soft border-t align-top`,children:[i.columns.map(t=>(0,H.jsx)(`td`,{className:n(`min-w-[7.5rem]`,r?`px-1 py-0.5`:`px-3 py-2`),children:r?(0,H.jsx)(Bd,{column:t,value:e.cells[t.id],onCommit:n=>g(e.id,t.id,n)}):(0,H.jsx)(`span`,{className:n(t.type===`number`&&`tabular-nums`),children:Ad(t,e.cells[t.id],de)})},t.id)),r?(0,H.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,H.jsx)(p,{label:I(`list.delete`),className:`size-9`,onClick:()=>void d(()=>Z.del(`${u}/${e.id}`)),children:(0,H.jsx)(O,{className:`size-3.5`})})}):null]},e.id)),r?(0,H.jsxs)(`tr`,{className:`border-border-soft border-t bg-paper`,children:[i.columns.map(e=>(0,H.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,H.jsx)(Bd,{column:e,value:c[e.id],onCommit:t=>l(n=>({...n,[e.id]:t}))})},e.id)),(0,H.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,H.jsx)(p,{label:I(`run.addRow`),className:`size-9`,onClick:()=>m?void f():void 0,children:(0,H.jsx)(w,{className:`size-4`})})})]}):null]})]})}),o?(0,H.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:o}):null]})}function Hd(e,t,n){let r=t.split(`/`).map(encodeURIComponent).join(`/`);return Nl(`${Q(e)}/store/files/${r}${n?`?inline=1`:``}`)}var Ud=[`bg-paper-3 text-ink-3`,`bg-moss-tint text-moss`,`bg-rose-tint text-rose`,`bg-ember-tint text-ember-strong`];function Wd({runId:e,list:t}){let{def:r,rows:i}=t,a=r.columns.find(e=>e.id===r.check?.file),o=r.columns.find(e=>e.id===r.check?.status),s=o?.type===`select`?o.format.options:[],c=s[0]?.id,l=e=>o?String(e.cells[o.id]??c??``):``,u=e=>!o||l(e)===c,[d,f]=(0,V.useState)(()=>(i.find(u)??i[0])?.id??null),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(null),v=`${Q(e)}/lists/${r.id}/rows`,y=i.find(e=>e.id===d)??i[0],b=p?i.filter(e=>u(e)||e.id===y?.id):i,x=i.filter(e=>!u(e)).length,S=r.columns.filter(e=>e!==a&&e!==o),C=S.filter(e=>e.id!==r.key),w=C.find(e=>e.type===`text`)??C[0],T=C.filter(e=>e!==w),E=async(e,t)=>{g(null);try{await Z.patch(`${v}/${e}`,{cells:t})}catch(e){g(e instanceof Tl?e.message:String(e))}},D=e=>{let t=b.findIndex(e=>e.id===y?.id),n=b[Math.min(b.length-1,Math.max(0,t+e))];n&&f(n.id)},O=async e=>{if(!y||!o)return;let t=i.findIndex(e=>e.id===y.id),n=[...i.slice(t+1),...i.slice(0,t)].find(u);await E(y.id,{[o.id]:e}),n&&e!==c&&f(n.id)},ee=e=>{e.target.closest(`input, textarea, select`)||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),D(e.key===`ArrowDown`?1:-1)):/^[1-9]$/.test(e.key)&&s[Number(e.key)]&&(e.preventDefault(),O(s[Number(e.key)].id)))};if(!i.length)return(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:I(`list.empty`)});let j=a&&y?String(y.cells[a.id]??``).trim():``,M=j.split(`.`).pop()?.toLowerCase()??``,te=e=>Ud[Math.min(Math.max(0,s.findIndex(t=>t.id===l(e))),3)];return(0,H.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(280px,360px)_minmax(0,1fr)]`,onKeyDown:ee,children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:I(`check.progress`,{done:x,total:i.length})}),o?(0,H.jsx)(`button`,{type:`button`,"aria-pressed":p,onClick:()=>m(e=>!e),className:n(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,p?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:I(`check.onlyOpen`)}):null]}),(0,H.jsx)(`ul`,{className:`flex max-h-[38vh] flex-col gap-1.5 overflow-y-auto p-0.5 pr-1 lg:max-h-[calc(100vh-15rem)]`,children:b.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>f(e.id),"aria-current":e.id===y?.id,className:n(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left ring-1 transition`,e.id===y?.id?`bg-card shadow-soft ring-ember`:`bg-paper ring-border-soft hover:bg-card`),children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate font-medium text-[0.875rem]`,children:w&&Ad(w,e.cells[w.id],de)||`—`}),(0,H.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3 tabular-nums`,children:T.slice(0,2).map(t=>Ad(t,e.cells[t.id],de)).filter(Boolean).join(` · `)})]}),o?(0,H.jsx)(`span`,{className:n(`shrink-0 rounded-full px-2 py-0.5 font-medium text-[0.6875rem]`,te(e)),children:s.find(t=>t.id===l(e))?.label??l(e)}):null]})},e.id))})]}),y?(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[s.length>1?(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[s.slice(1).map((e,t)=>(0,H.jsxs)(_,{size:`md`,variant:l(y)===e.id?`primary`:`secondary`,onClick:()=>void O(e.id),children:[l(y)===e.id?(0,H.jsx)(A,{className:`size-4`}):null,e.label,(0,H.jsx)(`kbd`,{className:`ml-1 hidden rounded bg-black/10 px-1.5 text-[0.6875rem] lg:inline`,children:t+1})]},e.id)),l(y)===c?null:(0,H.jsx)(_,{size:`md`,variant:`ghost`,onClick:()=>void O(c??``),children:I(`check.reopen`)})]}):null,(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-border-soft border-b bg-card px-3 py-2 text-[0.8125rem]`,children:[(0,H.jsx)(k,{className:`size-3.5 shrink-0 text-ink-3`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:j.split(`/`).pop()}),(0,H.jsx)(`a`,{href:Hd(e,j,M===`pdf`),target:`_blank`,rel:`noreferrer`,className:`shrink-0 text-ink-2 underline-offset-2 hover:text-ink hover:underline`,children:I(`run.openFull`)})]}),M===`pdf`?(0,H.jsx)(`iframe`,{title:j,src:`${Hd(e,j,!0)}#toolbar=0&navpanes=0&view=FitH`,className:`h-[46vh] w-full border-0 bg-white lg:h-[calc(100vh-27rem)] lg:min-h-[360px]`},j):[`png`,`jpg`,`jpeg`,`webp`].includes(M)?(0,H.jsx)(`div`,{className:`flex max-h-[46vh] justify-center overflow-auto bg-white lg:max-h-[calc(100vh-27rem)]`,children:(0,H.jsx)(`img`,{src:Hd(e,j,!0),alt:j,className:`max-w-full object-contain`},j)}):(0,H.jsx)(`p`,{className:`px-4 py-10 text-center text-[0.875rem] text-ink-3`,children:I(`check.noPreview`)})]}):(0,H.jsx)(`p`,{className:`px-4 py-14 text-center text-[0.875rem] text-ink-3`,children:I(`check.noFile`)})}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3`,children:S.map(e=>(0,H.jsxs)(`div`,{className:n(`min-w-0`,e.type===`text`&&e.format?.style===`multiline`&&`col-span-full`),children:[(0,H.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,H.jsx)(Bd,{boxed:!0,column:e,value:y.cells[e.id],onCommit:t=>void E(y.id,{[e.id]:t})})]},e.id))}),h?(0,H.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:h}):null]}):null]})}var Gd={xlsx:`Excel`,csv:`CSV`,json:`JSON`,md:`Markdown`,zip:`ZIP`};function Kd({runId:e,list:t}){return(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.formats.map(n=>(0,H.jsx)(`a`,{href:Nl(`${Q(e)}/lists/${t.def.id}/download?format=${n}`),className:`inline-flex h-9 items-center rounded-full bg-paper-2 px-3.5 font-medium text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink coarse:h-11 coarse:px-4`,children:Gd[n]??n},n))})}function qd({runId:e,connection:t,onChanged:n}){let[r,i]=(0,V.useState)(!1),a=t.candidates.some(e=>e.chosen),o=t.candidates.length>0||t.connectors.length>0;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Xa,{className:`size-4 shrink-0 text-ink-3`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate`,children:t.account?.label??I(`connect.notChosen`)}),t.candidates.length?(0,H.jsx)(`span`,{className:`block truncate text-[0.8125rem] text-ink-3`,children:Fd(t)}):null]}),o?(0,H.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>i(e=>!e),children:I(`connect.change`)}):null,a?(0,H.jsx)(p,{label:I(`connect.disconnect`),onClick:async()=>{await Z.del(`${Q(e)}/connections/${t.id}`),i(!1),n()},children:(0,H.jsx)(Yo,{className:`size-4`})}):null]}),r?(0,H.jsx)(`div`,{className:`pl-6`,children:(0,H.jsx)(Id,{runId:e,connection:t,onChosen:()=>{i(!1),n()}})}):null]})}function Jd({runId:e}){let[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(null),[a,s]=(0,V.useState)(!1);(0,V.useEffect)(()=>{t&&(s(!1),Z.get(`${Q(e)}/store`).then(i))},[t,e]);let c=r&&!r.files.length&&!r.connections.length&&!r.keepsSignIns&&r.lists.every(e=>!e.rows);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-4 transition hover:text-ink-2 coarse:min-h-11`,children:[(0,H.jsx)(Sa,{className:`size-3.5`}),` `,I(`store.open`)]}),(0,H.jsx)(l,{open:t,onClose:()=>n(!1),title:I(`store.title`),wide:!0,children:r?(0,H.jsxs)(`div`,{className:`flex flex-col gap-5 text-[0.875rem]`,children:[(0,H.jsx)(`p`,{className:`text-ink-3`,children:I(`store.explain`)}),c?(0,H.jsx)(`p`,{className:`text-ink-2`,children:I(`store.empty`)}):null,r.lists.some(e=>e.rows)?(0,H.jsx)(`ul`,{className:`flex flex-col gap-1`,children:r.lists.filter(e=>e.rows).map(e=>(0,H.jsxs)(`li`,{className:`flex justify-between gap-3`,children:[(0,H.jsx)(`span`,{children:e.title}),(0,H.jsx)(`span`,{className:`text-ink-3 tabular-nums`,children:I(`store.rows`,{n:e.rows})})]},e.id))}):null,r.connections.map(t=>(0,H.jsx)(qd,{runId:e,connection:t,onChanged:()=>void Z.get(`${Q(e)}/store`).then(i)},t.id)),r.keepsSignIns?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(A,{className:`size-4 text-ink-3`}),` `,I(`store.signIns`)]}):null,r.files.length?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1 text-ink-3`,children:I(`store.files`,{n:r.files.length,size:se(r.files.reduce((e,t)=>e+t.size,0))})}),(0,H.jsx)(`ul`,{className:`max-h-56 overflow-y-auto rounded-lg ring-1 ring-border-soft`,children:r.files.map(t=>(0,H.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,H.jsxs)(`a`,{href:Nl(`${Q(e)}/store/files/${t.path}`),className:`flex items-center gap-2 px-3 py-2 text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,title:t.source??void 0,children:[(0,H.jsx)(k,{className:`size-3.5 shrink-0 text-ink-3`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,H.jsx)(`span`,{className:`text-ink-4 tabular-nums`,children:se(t.size)})]})},t.path))})]}):null,(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[c?(0,H.jsx)(`span`,{}):a?(0,H.jsxs)(_,{variant:`secondary`,onClick:async()=>{await Z.del(`${Q(e)}/store`),i(await Z.get(`${Q(e)}/store`)),s(!1)},children:[(0,H.jsx)(O,{className:`size-4`}),` `,I(`store.confirmDelete`)]}):(0,H.jsxs)(_,{variant:`ghost`,onClick:()=>s(!0),children:[(0,H.jsx)(O,{className:`size-4`}),` `,I(`store.delete`)]}),(0,H.jsx)(_,{onClick:()=>n(!1),children:I(`common.close`)})]})]}):(0,H.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,H.jsx)(o,{})})})]})}var Yd=300;function Xd(){if(typeof MediaRecorder<`u`)return(Fl(`transcribe`)?[`audio/mp4`,`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`]:[`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`,`audio/ogg;codecs=opus`]).find(e=>MediaRecorder.isTypeSupported(e))}async function Zd(e,t){if(Fl(`transcribe`))try{let n=await Il(`transcribe`,{audio:await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)}),mime:e.type,lang:t});return typeof n?.text==`string`?n.text:void 0}catch{return}}function Qd(e){return`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function $d({value:e,base:t,onChange:n,onBusy:r}){let i=ce(e)?e:null,[a,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(0),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(!1),[g,v]=(0,V.useState)(null),y=(0,V.useRef)(null),b=(0,V.useRef)(null),x=Xd(),S=Jl&&!!x,C=(0,V.useRef)(r);C.current=r,(0,V.useEffect)(()=>()=>{y.current&&(y.current.recorder.onstop=null,y.current.stop(),C.current?.(!1))},[]),(0,V.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g.url)},[g]);let w=async(e,i)=>{d(!0),r?.(!0),p(null);try{let r=await Z.upload(`${t}/uploads`,e);v({asset:r.id,url:URL.createObjectURL(e)});let{lang:a}=Ml(),o=await Zd(e,a);n({asset:r.id,lang:a,...i===void 0?{}:{seconds:i},...o===void 0?{}:{transcript:o}})}catch(e){p(e.message)}finally{d(!1),r?.(!1)}},T=async()=>{p(null),h(!1);let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch{h(!0);return}let t=[],n=new MediaRecorder(e,{mimeType:x,audioBitsPerSecond:48e3}),i=Date.now(),a=new AudioContext,o=a.createAnalyser();o.fftSize=256,a.createMediaStreamSource(e).connect(o);let c=new Uint8Array(o.fftSize),u=0,d=()=>{o.getByteTimeDomainData(c);let e=0;for(let t of c)e=Math.max(e,Math.abs(t-128));l(Math.min(1,e/64)),s((Date.now()-i)/1e3),(Date.now()-i)/1e3>=Yd?f():u=requestAnimationFrame(d)},f=()=>{cancelAnimationFrame(u),n.state!==`inactive`&&n.stop();for(let t of e.getTracks())t.stop();a.close().catch(()=>void 0),y.current=null,s(null),l(0)};n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{let e=(n.mimeType||x||`audio/webm`).split(`;`)[0],a=e===`audio/mp4`?`m4a`:e===`audio/ogg`?`ogg`:`webm`,o=Math.max(1,Math.round((Date.now()-i)/1e3));w(new File(t,`sprachnotiz-${pu()}.${a}`,{type:e}),o),r?.(!1)},y.current={recorder:n,stop:f},r?.(!0),n.start(1e3),u=requestAnimationFrame(d)},E=a!==null,D=(0,H.jsxs)(_,{variant:`secondary`,onClick:()=>b.current?.click(),children:[(0,H.jsx)(Ma,{className:`size-4`}),` `,I(`voice.pick`)]});return(0,H.jsxs)(`div`,{children:[E?(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-ember`,children:[(0,H.jsxs)(`span`,{className:`relative flex size-11 shrink-0 items-center justify-center`,children:[(0,H.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-rose-tint transition-transform duration-75`,style:{transform:`scale(${.7+c*.5})`}}),(0,H.jsx)(`span`,{className:`relative size-3.5 animate-pulse-dot rounded-full bg-rose`})]}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`font-medium text-[0.9375rem] tabular-nums`,children:Qd(a)}),(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:a>270?I(`voice.left`,{s:Math.ceil(Yd-a)}):I(`voice.recording`)})]}),(0,H.jsxs)(_,{onClick:()=>y.current?.stop(),children:[(0,H.jsx)(Vo,{className:`size-3.5 fill-current`}),` `,I(`voice.stop`)]})]}):u?(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-4 text-[0.875rem] text-ink-3 ring-1 ring-input`,children:[(0,H.jsx)(o,{className:`size-4`}),` `,I(`run.uploading`)]}):i?(0,H.jsxs)(`div`,{className:`rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,H.jsx)(`audio`,{controls:!0,preload:`metadata`,src:g?.asset===i.asset?g.url:`${t}/assets/${i.asset}`,className:`h-11 w-full`}),i.transcript?(0,H.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap px-1 text-[0.875rem] text-ink-2 leading-relaxed`,children:i.transcript}):null,(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:i.seconds?Qd(i.seconds):null}),(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[S?(0,H.jsxs)(_,{variant:`ghost`,size:`sm`,onClick:()=>void T(),children:[(0,H.jsx)(Do,{className:`size-3.5`}),` `,I(`voice.again`)]}):null,(0,H.jsx)(_,{variant:`ghost`,size:`sm`,onClick:()=>n(void 0),children:I(`voice.remove`)})]})]})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S?(0,H.jsxs)(_,{variant:`secondary`,size:`lg`,onClick:()=>void T(),className:`w-full sm:w-auto`,children:[(0,H.jsx)(uo,{className:`size-4`}),` `,I(`voice.start`)]}):D,S&&m?D:null]}),m?(0,H.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:I(`voice.denied`)}):(0,H.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:I(S?`voice.why`:`voice.noRecorder`)})]}),(0,H.jsx)(`input`,{ref:b,type:`file`,hidden:!0,accept:`audio/*`,capture:!0,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&w(t,void 0)}}),f?(0,H.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:f}):null]})}function ef({field:e,value:t,values:r,onChange:i}){let a=e.columns??[],o=Array.isArray(t)&&t.length?t:[{}],s=L(e,o,r),c=(e,t,n)=>{i(o.map((r,i)=>i===e?{...r,[t]:n}:r))},l=a.map(e=>e.kind===`text`&&e===a[0]?`minmax(0,3fr)`:`minmax(0,1fr)`).join(` `);return(0,H.jsxs)(`div`,{className:`rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,H.jsx)(`div`,{className:`hidden gap-2 px-2 pt-1 pb-2 text-[0.75rem] text-ink-3 sm:grid`,style:{gridTemplateColumns:`${l} 36px`},children:a.map(e=>(0,H.jsx)(`div`,{className:e.kind===`text`?``:`text-right`,children:e.label},e.id))}),(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:o.map((e,t)=>(0,H.jsxs)(`div`,{className:`grid grid-cols-6 gap-2 rounded-lg bg-paper p-2 sm:bg-transparent sm:p-0 sm:[grid-template-columns:var(--cols)]`,style:{"--cols":`${l} 36px`},children:[a.map((r,i)=>(0,H.jsxs)(`label`,{className:n(`flex min-w-0 flex-col gap-1 sm:col-span-1`,i===0?`col-span-5`:a.length-1<=2?`col-span-3`:`col-span-2`),children:[(0,H.jsx)(`span`,{className:`px-0.5 text-[0.6875rem] text-ink-3 sm:hidden`,children:r.label}),(0,H.jsx)(`input`,{"aria-label":r.label,placeholder:r.label,inputMode:r.kind===`text`?`text`:`decimal`,autoComplete:`off`,value:String(e[r.id]??``),onChange:e=>c(t,r.id,e.target.value),className:n(`h-11 w-full min-w-0 rounded-md border border-transparent bg-paper-2 px-2.5 text-[0.875rem] outline-none placeholder:text-transparent focus:border-focus focus:bg-card sm:placeholder:text-ink-4`,r.kind!==`text`&&`text-right tabular-nums`)})]},r.id)),(0,H.jsx)(p,{label:I(`list.delete`),onClick:()=>i(o.filter((e,n)=>n!==t)),className:`order-first col-start-6 row-start-1 size-11 justify-self-end self-end sm:order-none sm:col-start-auto sm:row-start-auto`,children:(0,H.jsx)(O,{className:`size-4`})})]},t))}),(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-end justify-between gap-3 px-2 pb-1`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i([...o,{}]),className:`inline-flex h-9 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent coarse:h-11`,children:[(0,H.jsx)(w,{className:`size-4`}),` `,I(`run.addRow`)]}),(0,H.jsxs)(`div`,{className:`text-right text-[0.8125rem] tabular-nums`,children:[(0,H.jsxs)(`div`,{className:`text-ink-3`,children:[I(`run.net`),` `,we(s.net,s.currency,de)]}),s.vatRate?(0,H.jsxs)(`div`,{className:`text-ink-3`,children:[I(`run.vat`,{r:s.vatRate}),` `,we(s.vat,s.currency,de)]}):null,(0,H.jsxs)(`div`,{className:`font-semibold text-[0.9375rem] text-ink`,children:[I(`run.total`),` `,we(s.gross,s.currency,de)]})]})]})]})}function tf(e){return!!e?.closest(`input, textarea, [contenteditable='true']`)}function nf({field:e,value:t,base:r,onChange:i,onBusy:a}){let o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),[u,d]=(0,V.useState)(!1),[f,m]=(0,V.useState)({}),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(null),C=(0,V.useRef)(null),w=e=>{C.current=e,S(e)},T=e.kind===`image`,D=!!e.multiple,O=D?e.max??30:1,k=T||!!e.camera||!!e.video,ee=!T&&!!e.video,A=Array.isArray(t)?t:typeof t==`string`&&t?[t]:[],j=(0,V.useRef)(A);j.current=A;let M=A.length<O,te=async e=>{let t=(T?e.filter(e=>e.type.startsWith(`image/`)):e).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0}));if(!t.length)return;let n=O-(D?j.current.length:0);d(!0),a?.(!0),g(t.length>n&&D?I(`run.maxFiles`,{n:O}):null);try{for(let e of t.slice(0,Math.max(0,n))){let t=await fu(e),n=await Z.upload(`${r}/uploads`,t);m(e=>({...e,[n.id]:{name:n.name,mime:n.mime}}));let a=D?[...j.current,n.id]:n.id;j.current=D?a:[n.id],i(a)}}catch(e){g(e.message)}finally{d(!1),a?.(!1)}},N=(0,V.useRef)(te);N.current=te;let ne=e=>{let t=A.filter(t=>t!==e);i(D?t:void 0)},re=(e,t)=>{let n=j.current.indexOf(e),r=Math.min(j.current.length-1,Math.max(0,t));if(n<0||n===r)return;let a=j.current.filter(t=>t!==e);a.splice(r,0,e),j.current=a,i(a)},ie=D&&A.length>1;(0,V.useEffect)(()=>{if(!M)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]),n=o.current;if(!t.length||!n||tf(document.activeElement))return;let r=document.querySelectorAll(`[data-upload-field]`);(n.matches(`:hover`)||n.contains(document.activeElement)||r.length===1)&&(e.preventDefault(),N.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[M]);let P=n(`flex flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-3 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,A.length?`py-4`:`py-8`);return(0,H.jsxs)(`div`,{ref:o,"data-upload-field":``,onDragOver:e=>{M&&(e.preventDefault(),b(!0))},onDragLeave:()=>b(!1),onDrop:e=>{b(!1),M&&(e.preventDefault(),te(Array.from(e.dataTransfer.files)))},children:[A.length?(0,H.jsx)(`div`,{className:`mb-2 flex flex-col gap-2`,children:A.map((e,t)=>{let i=f[e],a=i?.mime??(T?`image/`:``);return(0,H.jsxs)(`div`,{"data-file-id":e,className:n(`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input transition-shadow`,x===e&&`relative z-10 shadow-elevated ring-2 ring-ember`),children:[ie?(0,H.jsxs)(`button`,{type:`button`,"aria-label":I(`run.moveFile`,{n:t+1}),title:I(`run.moveFileHint`),className:n(`-mr-1 flex h-14 w-9 shrink-0 touch-none flex-col items-center justify-center gap-0.5 rounded-lg text-ink-3 hover:bg-paper-2 hover:text-ink`,x===e?`cursor-grabbing`:`cursor-grab`),onPointerDown:t=>{try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}w(e)},onPointerMove:t=>{if(C.current!==e)return;let n=document.elementFromPoint(t.clientX,t.clientY)?.closest(`[data-file-id]`),r=n?.getAttribute(`data-file-id`);r&&r!==e&&o.current?.contains(n??null)&&re(e,j.current.indexOf(r))},onPointerUp:()=>w(null),onPointerCancel:()=>w(null),onKeyDown:n=>{(n.key===`ArrowUp`||n.key===`ArrowDown`)&&(n.preventDefault(),re(e,t+(n.key===`ArrowUp`?-1:1)))},children:[(0,H.jsx)(`span`,{className:`font-medium text-[0.75rem] tabular-nums`,children:t+1}),(0,H.jsx)(Ha,{className:`size-4`})]}):null,a.startsWith(`image/`)?(0,H.jsx)(`img`,{src:Nl(`${r}/assets/${e}`),alt:``,className:`size-14 rounded-lg object-cover`}):(0,H.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg bg-paper-2`,children:a.startsWith(`video/`)?(0,H.jsx)(Pa,{className:`size-5 text-ink-3`}):(0,H.jsx)(ho,{className:`size-5 text-ink-3`})}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:i?.name??`✓`}),(0,H.jsx)(p,{label:I(`run.removeFile`),onClick:()=>ne(e),children:(0,H.jsx)(E,{className:`size-4`})})]},e)})}):null,M?(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>s.current?.click(),className:n(P,`min-w-[9rem] flex-1 px-4`,y&&`border-ember text-ink`),children:[T?(0,H.jsx)(Wa,{className:`size-6`}):(0,H.jsx)(ho,{className:`size-6`}),u?I(`run.uploading`):A.length?I(`run.uploadMore`):I(ql?`run.uploadTouch`:`run.upload`)]}),k?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>Jl?v(!0):c.current?.click(),className:n(P,`w-28`),children:[(0,H.jsx)(ua,{className:`size-6`}),I(`run.camera`)]}):null,ee&&!(Jl&&Cu)?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>l.current?.click(),className:n(P,`w-28`),children:[(0,H.jsx)(Zo,{className:`size-6`}),I(`camera.video`)]}):null]}):null,(0,H.jsx)(`input`,{ref:s,type:`file`,hidden:!0,multiple:D,accept:T?`image/*`:void 0,onChange:e=>{te(Array.from(e.target.files??[])),e.target.value=``}}),(0,H.jsx)(`input`,{ref:c,type:`file`,hidden:!0,accept:`image/*`,capture:`environment`,onChange:e=>{te(Array.from(e.target.files??[])),e.target.value=``}}),ee?(0,H.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`video/*`,capture:`environment`,onChange:e=>{te(Array.from(e.target.files??[])),e.target.value=``}}):null,(0,H.jsx)(wu,{open:_,multiple:D,video:ee,onClose:()=>v(!1),onCapture:e=>te([e]),onNative:()=>c.current?.click()}),D&&(e.min||e.max)?(0,H.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.min&&A.length<e.min?I(`run.filesMin`,{n:A.length,min:e.min}):e.max?I(`run.filesOf`,{n:A.length,max:e.max}):null}):null,h?(0,H.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:h}):null]})}function rf(e){let t=`${e.id} ${e.label}`.toLowerCase();return/telefon|phone|handy|mobil(?!it)|\btel\b|rückruf/.test(t)?{type:`tel`,inputMode:`tel`,autoComplete:`tel`}:/\bplz\b|postleitzahl|postal|zip/.test(t)?{inputMode:`numeric`,autoComplete:`postal-code`}:/iban/.test(t)?{autoCapitalize:`characters`,autoCorrect:`off`,spellCheck:!1}:/vorname|first.?name/.test(t)?{autoComplete:`given-name`,autoCapitalize:`words`}:/nachname|last.?name|surname/.test(t)?{autoComplete:`family-name`,autoCapitalize:`words`}:/firma|unternehmen|company|organi[sz]ation/.test(t)?{autoComplete:`organization`,autoCapitalize:`words`}:/straße|strasse|street|anschrift|adresse|address/.test(t)?{autoComplete:`street-address`,autoCapitalize:`words`}:/\b(ort|stadt|city|town)\b/.test(t)?{autoComplete:`address-level2`,autoCapitalize:`words`}:/\bname\b|ansprechp/.test(t)?{autoComplete:`name`,autoCapitalize:`words`}:{autoCapitalize:`sentences`}}function af({field:e,value:t,onChange:n}){let[r,i]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(g,{value:t,placeholder:e.placeholder,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>n(e.target.value)}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`inline-flex h-11 shrink-0 items-center gap-2 rounded-lg border border-input bg-card px-3.5 font-medium text-[0.875rem] text-ink-2 transition hover:border-ember hover:text-ink`,children:[(0,H.jsx)(ko,{className:`size-4`}),` `,I(`scan.button`)]}),(0,H.jsx)(pd,{open:r,onClose:()=>i(!1),onResult:n})]})}var of=4;function sf(e){let t=new Map,n=e.map(e=>({value:e,slot:le(e)})).filter(e=>e.slot).sort((e,t)=>Date.parse(e.value)-Date.parse(t.value));for(let{value:e,slot:r}of n){if(!r)continue;let n=t.get(r.day)??{label:pe(e,de),times:[]};n.times.push({value:e,time:r.time}),t.set(r.day,n)}return[...t.values()]}function cf({name:e,label:t,options:r,value:i,onChange:a,disabled:o}){let s=sf(r),c=s.findIndex(e=>e.times.some(e=>e.value===i)),[l,u]=(0,V.useState)(c>=of);if(!s.length)return(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:I(`slot.none`)});let d=l?s:s.slice(0,of);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,H.jsx)(`legend`,{className:`sr-only`,children:t}),d.map(t=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3`,children:t.label}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.times.map(r=>(0,H.jsxs)(`label`,{className:`relative`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`slot-${e}`,value:r.value,checked:r.value===i,disabled:o.has(r.value),"aria-label":`${t.label}, ${r.time}`,onChange:()=>a(r.value),className:`peer sr-only`}),(0,H.jsx)(`span`,{className:n(`inline-flex h-10 cursor-pointer items-center rounded-full border px-4 text-sm tabular-nums transition coarse:h-11`,`border-input bg-card text-ink-2 hover:border-ink-4 hover:text-ink`,`peer-checked:border-ember peer-checked:bg-ember-tint peer-checked:text-ink`,`peer-disabled:pointer-events-none peer-disabled:line-through peer-disabled:opacity-60`,`peer-focus-visible:outline-[1.5px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-(--focus-line) peer-focus-visible:outline-solid`),children:r.time})]},r.value))})]},t.label))]}),s.length>d.length?(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(!0),className:`self-start text-[0.8125rem] text-ink-3 underline-offset-4 transition hover:text-ink hover:underline coarse:min-h-11`,children:I(`slot.later`)}):null]})}function lf({cards:e,value:t,multi:r,runId:i,onChange:a,disabled:o}){let s=new Set(r?Array.isArray(t)?t.map(String):[]:t==null||t===``?[]:[String(t)]),c=e=>{a(r?s.has(e)?[...s].filter(t=>t!==e):[...s,e]:s.has(e)?``:e)},l=e=>/^(https?:|data:|\/)/.test(e)?e:Nl(`/api/runs/${i}/assets/${e}`);return(0,H.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr))`},children:e.map(e=>{let t=s.has(e.value),r=o.has(e.value);return(0,H.jsxs)(`div`,{className:n(`flex flex-col overflow-hidden rounded-xl bg-card ring-1 ring-border-soft transition`,t&&`ring-2 ring-ember`,r&&`opacity-50`),children:[e.image?(0,H.jsx)(`img`,{src:l(e.image),alt:``,className:`aspect-square w-full object-cover`}):null,(0,H.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1 p-3`,children:[(0,H.jsx)(`div`,{className:`font-medium text-[0.9375rem] leading-snug`,children:e.label}),e.subtitle?(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:e.subtitle}):null,e.meta?(0,H.jsx)(`div`,{className:`mt-auto pt-1 font-display font-semibold text-[0.9375rem] tabular-nums`,children:e.meta}):null,(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-pressed":t,disabled:r,onClick:()=>c(e.value),className:n(`inline-flex h-9 flex-1 items-center justify-center rounded-full px-3 text-[0.8125rem] transition coarse:h-11`,t?`bg-ember text-ember-on`:`bg-paper-2 text-ink-2 hover:text-ink`),children:I(t?`cards.picked`:`cards.pick`)}),e.link?(0,H.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noopener`,className:`inline-flex h-9 items-center rounded-full px-3 text-[0.8125rem] text-ink-2 ring-1 ring-border-soft hover:text-ink coarse:h-11`,children:I(`cards.open`)}):null]})]})]},e.value)})})}function uf({field:e,value:t,values:n,runId:r,base:o,view:c,onChange:l,onBusy:u,error:f,closed:p}){let h=o??Q(r),_=t==null?``:String(t),y=new Set(p?.values.map(String)),b;switch(e.kind){case`textarea`:b=(0,H.jsx)(s,{value:_,placeholder:e.placeholder,autoCapitalize:`sentences`,enterKeyHint:`enter`,onChange:e=>l(e.target.value)});break;case`number`:b=e.look===`slider`&&e.min!==void 0&&e.max!==void 0?(0,H.jsx)(rd,{label:e.label,value:t,min:e.min,max:e.max,increment:e.increment,unit:e.unit,onChange:l}):e.look===`stepper`?(0,H.jsx)(id,{value:t,min:e.min,max:e.max,increment:e.increment,unit:e.unit,placeholder:e.placeholder,onChange:l}):(0,H.jsx)(nd,{value:_,unit:e.unit,placeholder:e.placeholder,onChange:l});break;case`select`:{let n=e.options??[],i=c?.cards?.[e.id];b=i?.length?(0,H.jsx)(lf,{cards:i,value:t,multi:!1,runId:r,onChange:l,disabled:y}):e.look===`list`?(0,H.jsx)(ad,{name:e.id,value:_,options:n,disabled:y,label:xe,onChange:l}):n.length<=5&&n.every(e=>e.length<=28)?(0,H.jsx)(v,{value:_,options:n,onChange:l,disabled:[...y],label:xe}):(0,H.jsx)(a,{value:_,placeholder:`—`,onChange:l,options:n.map(e=>({value:e,label:xe(e),disabled:y.has(e)}))});break}case`slot`:b=(0,H.jsx)(cf,{name:e.id,label:e.label,options:e.options??[],value:_,onChange:l,disabled:y});break;case`multiselect`:{let n=c?.cards?.[e.id];b=n?.length?(0,H.jsx)(lf,{cards:n,value:t,multi:!0,runId:r,onChange:l,disabled:y}):(0,H.jsx)(v,{multi:!0,value:Array.isArray(t)?t:[],options:e.options??[],onChange:l,label:xe});break}case`date`:b=(0,H.jsx)(g,{type:`date`,value:_,onChange:e=>l(e.target.value),className:`w-full sm:w-56`});break;case`email`:b=(0,H.jsx)(g,{type:`email`,inputMode:`email`,autoComplete:`email`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:_,placeholder:e.placeholder,onChange:e=>l(e.target.value)});break;case`url`:b=(0,H.jsx)(g,{type:`url`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:_,placeholder:e.placeholder??`https://`,onChange:e=>l(e.target.value)});break;case`toggle`:b=(0,H.jsx)(d,{checked:t===!0,onChange:l,label:e.label,disabled:y.has(String(t!==!0))});break;case`color`:b=(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(m,{value:_||`#e0531b`,onChange:e=>l(e.target.value)}),(0,H.jsx)(g,{value:_,placeholder:`#e0531b`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>l(e.target.value),className:`w-36`})]});break;case`image`:case`file`:b=(0,H.jsx)(nf,{field:e,value:t,base:h,onChange:l,onBusy:u});break;case`items`:b=(0,H.jsx)(ef,{field:e,value:t,values:n,onChange:l});break;case`connection`:b=(0,H.jsx)(Rd,{runId:r,connection:c?.connections.find(t=>t.id===e.connection)});break;case`list`:{let t=c?.lists.find(t=>t.def.id===e.list);b=t?(0,H.jsx)(Vd,{runId:r,list:t,editable:!0}):null;break}case`location`:b=(0,H.jsx)(ld,{value:t,base:h,placeholder:e.placeholder,onChange:l,onBusy:u});break;case`audio`:b=p?null:(0,H.jsx)($d,{value:t,base:h,onChange:l,onBusy:u});break;case`signature`:b=(0,H.jsx)(bd,{label:e.label,value:t,base:h,onChange:l});break;default:b=e.scan?(0,H.jsx)(af,{field:e,value:_,onChange:l}):(0,H.jsx)(g,{...rf(e),value:_,placeholder:e.placeholder,onChange:e=>l(e.target.value)})}return(0,H.jsxs)(`div`,{children:[e.kind===`toggle`?(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,H.jsx)(i,{hint:e.help,children:e.label}),b]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(i,{hint:e.help,required:e.required,children:e.label}),b]}),p?(0,H.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:I(`run.closed`,{list:p.classes.map(e=>I(`run.cls.${df(e)}`)).join(`, `)})}):null,f?(0,H.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:f}):null]})}function df(e){return e in ff?ff[e]:e===`account`?`account`:`text`}var ff={classifier:`text`,low:`text`,standard:`text`,high:`text`,image:`image`,video:`video`,speech:`speech`,audio:`audio`},pf=e=>e==null?``:typeof e==`object`?JSON.stringify(e):String(e),mf=`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`;function hf(e,t){if(e?.kind===`object`)return e;let n=[...new Set(t.flatMap(e=>Object.keys(e??{})))];return{kind:`object`,fields:Object.fromEntries(n.map(e=>{let n=t.map(t=>t?.[e]).filter(e=>e!=null),r=n.every(e=>typeof e==`number`)?`number`:n.every(e=>typeof e==`boolean`)?`yesno`:`text`,i=r===`text`&&n.some(e=>String(e).length>80);return[e,r===`text`?{kind:r,long:i}:{kind:r}]}))}}function gf(e){let t=Object.values(e.fields),n=t.filter(e=>e.kind===`number`).length;return n>=3&&n>t.length/2}function _f(e,t,n){if(t==null||t===``)return``;switch(e.kind){case`number`:return`${typeof t==`number`?t.toLocaleString(de):pf(t)}${e.unit?` ${e.unit}`:``}`;case`yesno`:return t?e.yes??I(`run.yes`):e.no??I(`run.no`);case`ref`:{let r=n[e.to],i=Array.isArray(r)?r.find(e=>e&&pf(e.id)===pf(t)):void 0;return pf(i?i.title??i.name??i.label??t:t)}default:return pf(t)}}function vf({items:e}){return(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,H.jsx)(`span`,{className:`rounded-full bg-card px-2.5 py-0.5 text-[0.8125rem] text-ink-2 ring-1 ring-border-soft`,children:e},t))})}function yf({of:e,values:t,root:n}){let r=t.map(t=>_f(e,t,n)).filter(Boolean);return r.every(e=>e.length<=32)?(0,H.jsx)(vf,{items:r}):(0,H.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-[0.9375rem]`,children:r.map((e,t)=>(0,H.jsx)(`li`,{className:`break-words`,children:e},t))})}function bf({shape:e,rows:t,root:r}){let i=Object.entries(e.fields);return(0,H.jsx)(`div`,{className:`overflow-x-auto rounded-lg ring-1 ring-border-soft`,children:(0,H.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,H.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,H.jsx)(`tr`,{children:i.map(([e,t])=>(0,H.jsx)(`th`,{className:n(`whitespace-nowrap px-3 py-2 text-left font-medium`,t.kind===`number`&&`text-right`),children:P(e,t)},e))})}),(0,H.jsx)(`tbody`,{children:t.map((e,t)=>(0,H.jsx)(`tr`,{className:`border-border-soft border-t`,children:i.map(([t,i])=>(0,H.jsx)(`td`,{className:n(`px-3 py-2 tabular-nums`,i.kind===`number`&&`text-right`),children:_f(i,e?.[t],r)},t))},t))})]})})}function xf({shape:e,rows:t,root:r}){let i=Object.entries(e.fields),a=i.find(([,e])=>e.kind===`text`&&e.long)?.[0]??N(e),o=i.filter(([e,t])=>e!==a&&e!==`id`&&t.kind!==`list`),s=!!i.find(([,e])=>e.kind===`text`&&e.long);return(0,H.jsx)(s?`ol`:`ul`,{className:`flex flex-col gap-1.5 text-[0.875rem]`,children:t.map((e,t)=>{let i=[a?pf(e?.[a]):``,...o.map(([t,n])=>_f(n,e?.[t],r))].filter(Boolean);return(0,H.jsxs)(`li`,{className:n(s&&`grid grid-cols-[1.25rem_1fr] gap-1.5`),children:[s?(0,H.jsx)(`span`,{className:`font-semibold text-ember tabular-nums`,children:t+1}):null,(0,H.jsxs)(`span`,{children:[i[0],i.length>1?(0,H.jsxs)(`span`,{className:`text-ink-3`,children:[` · `,i.slice(1).join(` · `)]}):null]})]},t)})})}function Sf({fields:e,entry:t}){let r=e.flatMap(([e,n])=>{if(n.kind!==`yesno`||t[e]===void 0||t[e]===null)return[];let r=t[e]?n.yes??P(e,n):n.no;return r?[{k:e,words:r,on:!!t[e]}]:[]});return r.length?(0,H.jsx)(`span`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:r.map(e=>(0,H.jsx)(`span`,{className:n(`rounded-full px-2 py-0.5 text-[0.75rem]`,e.on?`bg-second-tint text-second`:`bg-ember-tint text-ember-strong`),children:e.words},e.k))}):null}function Cf({shape:e,rows:t,root:n}){let r=Object.entries(e.fields).filter(([e])=>e!==`id`),i=N(e),a=r.filter(([,e])=>e.kind===`yesno`),o=r.filter(([e,t])=>e!==i&&t.kind!==`yesno`);return(0,H.jsx)(`div`,{className:`divide-y divide-border-soft overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:t.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`text-[0.9375rem]`,children:i?pf(e?.[i]):``}),(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:o.map(([t,r])=>_f(r,e?.[t],n)).filter(Boolean).join(` · `)})]}),(0,H.jsx)(Sf,{fields:a,entry:e??{}})]},t))})}function wf({shape:e,entry:t,root:n}){let r=Object.entries(e.fields).filter(([e])=>e!==`id`),i=N(e),a=r.find(([,e])=>e.kind===`text`&&e.long),o=r.filter(([e,t])=>e!==i&&e!==a?.[0]&&(t.kind===`number`||t.kind===`choice`||t.kind===`score`||t.kind===`ref`||t.kind===`text`&&!t.long)),s=r.filter(([,e])=>e.kind===`yesno`),c=r.filter(([e,t])=>t.kind===`text`&&t.long&&e!==a?.[0]),l=r.filter(([,e])=>e.kind===`list`||e.kind===`table`);return(0,H.jsxs)(`article`,{className:`flex flex-col gap-2 rounded-xl bg-card p-4 ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsx)(`h4`,{className:`text-balance font-display font-semibold text-[1.0625rem] leading-snug`,children:i?pf(t[i]):``}),(0,H.jsx)(Sf,{fields:s,entry:t})]}),a?(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3 leading-relaxed`,children:pf(t[a[0]])}):null,o.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(([e,r])=>_f(r,t[e],n)).filter(Boolean).map((e,t)=>(0,H.jsx)(`span`,{className:`rounded-full bg-paper-2 px-2 py-0.5 text-[0.75rem] text-ink-2`,children:e},t))}):null,c.map(([e,n])=>t[e]?(0,H.jsxs)(`p`,{className:`text-[0.875rem] leading-relaxed`,children:[(0,H.jsxs)(`span`,{className:`text-ink-3`,children:[P(e,n),`: `]}),pf(t[e])]},e):null),l.map(([e,r])=>{let i=t[e];return!Array.isArray(i)||!i.length?null:(0,H.jsxs)(`div`,{className:`border-border-soft border-t pt-2`,children:[(0,H.jsx)(`div`,{className:mf,children:P(e,r)}),r.kind===`list`&&r.of.kind!==`object`?(0,H.jsx)(yf,{of:r.of,values:i,root:n}):(0,H.jsx)(xf,{shape:hf(r.kind===`list`?r.of:void 0,i),rows:i,root:n})]},e)})]})}function Tf({of:e,rows:t,root:n}){let r=hf(e,t);return gf(r)?(0,H.jsx)(bf,{shape:r,rows:t,root:n}):Object.values(r.fields).some(e=>e.kind===`list`||e.kind===`table`||e.kind===`text`&&e.long)?(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,16rem),1fr))] gap-3`,children:t.map((e,t)=>(0,H.jsx)(wf,{shape:r,entry:e??{},root:n},t))}):(0,H.jsx)(Cf,{shape:r,rows:t,root:n})}function Ef({step:e,json:t}){if(!t||typeof t!=`object`||Array.isArray(t))return(0,H.jsx)(`pre`,{className:`text-[0.8125rem]`,children:JSON.stringify(t,null,2)});let n=t,r=Ce(e);return(0,H.jsx)(`div`,{className:`flex flex-col gap-5`,children:Object.entries(n).map(([e,t])=>{let i=r.fields[e],a=i?P(e,i):e,o;if(Array.isArray(t)&&t.length&&t.every(e=>e&&typeof e==`object`))o=(0,H.jsx)(Tf,{of:i?.kind===`list`?i.of:void 0,rows:t,root:n});else if(Array.isArray(t))o=(0,H.jsx)(yf,{of:i?.kind===`list`?i.of:{kind:`text`},values:t,root:n});else if(t&&typeof t==`object`)o=(0,H.jsx)(`pre`,{className:`overflow-auto rounded-lg bg-paper-2 p-3 text-[0.75rem]`,children:JSON.stringify(t,null,2)});else{let e=i&&i.kind!==`list`&&i.kind!==`table`?i:{kind:`text`};o=(0,H.jsx)(`div`,{className:`whitespace-pre-wrap text-[0.9375rem] leading-relaxed`,children:_f(e,t,n)})}return(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`div`,{className:mf,children:a}),o]},e)})})}var Df=`#282623`,Of=`#81807e`,kf=`#1a5fb4`,Af=`#dbd9d6`,jf=483.28,Mf={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`,"#39":`'`,nbsp:`\xA0`};function Nf(e){return e.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+\d*);/gi,(e,t)=>{if(t[0]===`#`){let n=t[1]?.toLowerCase()===`x`?Number.parseInt(t.slice(2),16):Number(t.slice(1));return Number.isFinite(n)?String.fromCodePoint(n):e}return Mf[t.toLowerCase()]??e})}function Pf(e){return Nf(e.replace(/<[^>]+>/g,``)).trim()}function Ff(e,t={}){let n=[];for(let r of e??[])switch(r.type){case`text`:{let e=r.tokens;e?.length?n.push(...Ff(e,t)):n.push({...t,text:Nf(r.text)});break}case`escape`:n.push({...t,text:Nf(r.text)});break;case`strong`:n.push(...Ff(r.tokens,{...t,bold:!0}));break;case`em`:n.push(...Ff(r.tokens,{...t,italics:!0}));break;case`del`:n.push(...Ff(r.tokens,{...t,decoration:`lineThrough`}));break;case`codespan`:n.push({...t,text:Nf(r.text),color:`#3d3b38`});break;case`link`:{let e=r;n.push(...Ff(e.tokens,{...t,link:e.href,color:kf,decoration:`underline`}));break}case`image`:n.push({...t,text:r.text});break;case`br`:n.push({...t,text:`
|
|
5
|
+
`});break;case`html`:n.push({...t,text:Pf(r.text)});break;default:`tokens`in r&&Array.isArray(r.tokens)?n.push(...Ff(r.tokens,t)):`text`in r&&typeof r.text==`string`&&n.push({...t,text:Nf(r.text)})}return n}function If(e){let t=zf(e);if(t.length===1&&typeof t[0]==`object`&&`style`in t[0]){let{style:e,...n}=t[0];return n}return t.length===1?t[0]:{stack:t}}function Lf(e,t){return{text:Ff(e.tokens),alignment:e.align??`left`,...t?{style:`th`}:{}}}var Rf={hLineWidth:()=>.5,vLineWidth:()=>0,hLineColor:()=>Af,paddingTop:()=>4,paddingBottom:()=>4};function zf(e){let t=[];for(let n of e)switch(n.type){case`space`:break;case`heading`:{let e=n.depth;t.push({text:Ff(n.tokens),style:e<=1?`h1`:e===2?`h2`:`h3`});break}case`paragraph`:t.push({text:Ff(n.tokens),style:`p`});break;case`text`:t.push({text:Ff([n]),style:`p`});break;case`list`:{let e=n,r=e.items.map(e=>If(e.tokens));t.push(e.ordered?{ol:r,style:`list`,start:Number(e.start)||1}:{ul:r,style:`list`});break}case`table`:{let e=n;if(!e.header.length)break;t.push({table:{headerRows:1,widths:e.header.map(()=>`*`),body:[e.header.map(e=>Lf(e,!0)),...e.rows.map(e=>e.map(e=>Lf(e,!1)))]},layout:Rf,style:`table`});break}case`code`:t.push({text:Nf(n.text),style:`code`,preserveLeadingSpaces:!0});break;case`blockquote`:t.push({stack:zf(n.tokens),style:`quote`});break;case`hr`:t.push({canvas:[{type:`line`,x1:0,y1:0,x2:jf,y2:0,lineWidth:.5,lineColor:Af}],margin:[0,6,0,12]});break;case`html`:{let e=Pf(n.text);e&&t.push({text:e,style:`p`});break}default:`tokens`in n&&Array.isArray(n.tokens)?t.push({text:Ff(n.tokens),style:`p`}):`text`in n&&typeof n.text==`string`&&t.push({text:Nf(n.text),style:`p`})}return t}function Bf(e){return zf(ee.lexer(e))}function Vf(e,t=e=>e){if(!e||typeof e!=`object`)return[{text:JSON.stringify(e,null,2)??``,style:`code`}];let n=[];for(let[r,i]of Object.entries(e))if(n.push({text:t(r),style:`label`}),typeof i==`boolean`)n.push({text:I(i?`run.yes`:`run.no`),style:`p`});else if(typeof i==`string`||typeof i==`number`)n.push({text:String(i),style:`p`});else if(Array.isArray(i)&&i.every(e=>typeof e!=`object`))n.push({ul:i.map(e=>String(e)),style:`list`});else if(Array.isArray(i)&&i.length&&typeof i[0]==`object`){let e=i,t=[...new Set(e.flatMap(e=>Object.keys(e)))];n.push({table:{headerRows:1,widths:t.map(()=>`*`),body:[t.map(e=>({text:e,style:`th`})),...e.map(e=>t.map(t=>({text:e[t]===null||e[t]===void 0?``:String(e[t])})))]},layout:Rf,style:`table`})}else n.push({text:JSON.stringify(i,null,2),style:`code`});return n}function Hf(e){let t=e.json!==void 0&&e.json!==null?Vf(e.json,e.label):Bf(e.text??``),n=e.foot??``;return{info:{title:e.title},pageSize:`A4`,pageMargins:[56,60,56,64],defaultStyle:{font:`Roboto`,fontSize:10.5,lineHeight:1.3,color:Df},styles:{title:{fontSize:20,bold:!0,lineHeight:1.15,margin:[0,0,0,16]},h1:{fontSize:15,bold:!0,margin:[0,14,0,6]},h2:{fontSize:13,bold:!0,margin:[0,12,0,5]},h3:{fontSize:11,bold:!0,margin:[0,10,0,4]},p:{margin:[0,0,0,7]},list:{margin:[0,0,0,7]},table:{margin:[0,2,0,10]},th:{bold:!0,fillColor:`#f3f1ee`},label:{fontSize:8,bold:!0,color:Of,characterSpacing:.6,margin:[0,8,0,2]},code:{fontSize:9,color:`#3d3b38`,margin:[0,0,0,8]},quote:{italics:!0,color:`#5d5b58`,margin:[14,0,0,8]}},content:[{text:e.title,style:`title`},...t],footer:(e,t)=>({columns:[{text:n,color:Of,fontSize:8.5},{text:`${e} / ${t}`,alignment:`right`,color:Of,fontSize:8.5}],margin:[56,26,56,0]})}}var Uf={Roboto:{normal:`Roboto-Regular.ttf`,bold:`Roboto-Medium.ttf`,italics:`Roboto-Italic.ttf`,bolditalics:`Roboto-MediumItalic.ttf`}},Wf=null;function Gf(){return Wf??=Promise.all([Ee(()=>import(`./pdfmake-D9CKNq4W.js`).then(e=>t(e.default,1)),__vite__mapDeps([2,3])),Ee(()=>import(`./vfs_fonts-BjQxQix9.js`).then(e=>t(e.default,1)),__vite__mapDeps([4,3]))]).then(([e,t])=>{let n=e.default;return n.addVirtualFileSystem(t.default),n.addFonts(Uf),n}).catch(e=>{throw Wf=null,e}),Wf}function Kf(e){return e.replace(/[\\/:*?"<>|]+|\p{Cc}+/gu,`-`).replace(/\s+/g,` `).trim()||`result`}async function qf(e){let t=await(await Gf()).createPdf(Hf(e)).getBlob();return new File([t],`${Kf(e.title)}.pdf`,{type:`application/pdf`})}var Jf=(e,t,n)=>ie(e,t,n,Te()),$=e=>e==null?``:typeof e==`boolean`?B(e?`run.yes`:`run.no`):typeof e==`object`?JSON.stringify(e):String(e),Yf=e=>{let t=typeof e==`number`?e:Number(String(e??``).replace(`,`,`.`));return Number.isFinite(t)?t:0};function Xf(e,t){let n=$(e);return n?/^(https?:|data:|\/)/.test(n)?t.chat?null:n:t.assetUrl(n):null}function Zf(e,t,n,r){return Jf(e[t],n.data,r)}function Qf(e,t,n){let r=$(t)||`label`,i=$(n)||`value`;return Array.isArray(e)?e.map(e=>({label:$(e?.[r]),value:Yf(e?.[i])})):[]}function $f({c:e,ctx:t,row:n}){let r=e.children;if(!r)return null;if(Array.isArray(r))return(0,H.jsx)(H.Fragment,{children:r.map(e=>(0,H.jsx)(xp,{id:e,ctx:t,row:n},e))});let i=Jf({path:r.path},t.data,n);return(0,H.jsx)(H.Fragment,{children:(Array.isArray(i)?i:[]).map((e,n)=>(0,H.jsx)(xp,{id:r.componentId,ctx:t,row:e},n))})}var ep={success:`bg-second-tint text-second`,warning:`bg-amber-tint text-ink-2`,accent:`bg-ember-tint text-ember-strong`,default:`bg-paper-2 text-ink-2`},tp=e=>Array.isArray(e)?e:[];function np(e,t){return typeof e!=`object`||!e?t===``?e:void 0:e[t]}function rp(e,t){if(typeof e!=`object`||!e)return $(e);let n=e;return $(t?n[t]:n.label??n.name??n.title??n.text)}function ip(e,t,n){let r=new Map;for(let n of e){let e=$(np(n,t));r.set(e,[...r.get(e)??[],n])}let i=e=>{let t=n.indexOf(e);return t<0?n.length:t};return[...r.entries()].sort((e,t)=>i(e[0])-i(t[0]))}var ap=e=>e?`${$(e)} ${Te()===`de`?`Min`:`min`}`:``;function op({items:e}){return e.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,H.jsx)(`span`,{className:`rounded-full bg-paper-2 px-2 py-0.5 text-[0.75rem] text-ink-2`,children:e},t))}):null}function sp(e,t,n){let r=e.meta;return(Array.isArray(r)?r:[r]).map(e=>$(Jf(e,t.data,n))).filter(Boolean)}function cp({c:e,ctx:t,row:n}){let[r,i]=(0,V.useState)(`0`),a=tp(e.tabs),o=a.map((e,r)=>{let i=Jf(e?.count,t.data,n),a=Array.isArray(i)?i.length:i,o=$(Jf(e?.label,t.data,n));return{id:String(r),label:a==null||a===``?o:`${o} (${$(a)})`}}),s=a[Number(r)]?.child;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`sticky top-2 z-10 max-w-full self-start overflow-x-auto rounded-full`,children:(0,H.jsx)(c,{value:r,onChange:i,options:o})}),typeof s==`string`?(0,H.jsx)(xp,{id:s,ctx:t,row:n}):null]})}function lp({c:e,ctx:t,row:r}){let i=n=>Zf(e,n,t,r),[a,o]=(0,V.useState)(!1),s=tp(i(`items`)),c=$(i(`labelKey`)),l=$(i(`detailKey`))||`amount`,u=$(i(`noteKey`)),d=$(i(`noteFormat`)),f=$(i(`groupKey`)),p=tp(i(`groupOrder`)).map($),m=t.state[e.id]??{},h=(e,t)=>`${t}:${rp(e,c)}`,g=s.filter((e,t)=>m[h(e,t)]).length,_=s.map((e,t)=>({item:e,i:t})),v=f?ip(s,f,p).map(([e])=>[e,_.filter(({item:t})=>$(np(t,f))===e)]):[[``,_]],y=e.detail,b=e=>$(y===void 0?np(e,l):Jf(y,t.data,e)),x=i(`noteMap`),S=e=>{let t=u?np(e,u):void 0;if(typeof t==`boolean`)return $((x&&typeof x==`object`?x[String(t)]:``)??``);let n=Array.isArray(t)?t.map($).join(`, `):$(t);return n&&d?d.replace(`{}`,n):n};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-paper-2`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-second transition-[width] duration-300`,style:{width:`${s.length?g/s.length*100:0}%`}})}),(0,H.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:g===s.length&&s.length?B(`surface.allDone`):B(`surface.done`,{done:g,total:s.length})}),i(`share`)===!1?null:(0,H.jsxs)(`button`,{type:`button`,onClick:async()=>{let e=v.map(([e,t])=>{let n=t.filter(({item:e,i:t})=>!m[h(e,t)]).map(({item:e})=>`☐ ${rp(e,c)}${b(e)?` – ${b(e)}`:``}`);return n.length?[e,...n].filter(Boolean).join(`
|
|
6
|
+
`):``}).filter(Boolean).join(`
|
|
7
|
+
|
|
8
|
+
`);try{navigator.share?await navigator.share({text:e}):(await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1600))}catch{}},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-10`,children:[a?(0,H.jsx)(A,{className:`size-3.5`}):(0,H.jsx)(No,{className:`size-3.5`}),B(a?`share.copied`:`run.share`)]})]}),v.map(([r,i])=>(0,H.jsxs)(`section`,{className:`rounded-xl bg-card px-4 py-1 ring-1 ring-border-soft`,children:[r?(0,H.jsx)(`h4`,{className:`pt-3 pb-1 font-semibold text-[0.6875rem] text-second uppercase tracking-[0.14em]`,children:r}):null,i.map(({item:r,i})=>{let a=h(r,i),o=!!m[a],s=S(r);return(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 border-border-soft border-b border-dashed py-2.5 last:border-0`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:o,onChange:()=>t.setState(e.id,{...m,[a]:!o}),className:`mt-0.5 size-[1.125rem] shrink-0 accent-[var(--second)] coarse:size-6`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:n(`text-[0.9375rem]`,o&&`text-ink-3 line-through`),children:[rp(r,c),b(r)?(0,H.jsxs)(`span`,{className:`text-ink-3`,children:[` · `,b(r)]}):null]}),s?(0,H.jsx)(`span`,{className:`block text-[0.75rem] text-ink-3`,children:s}):null]})]},a)})]},r))]})}function up({data:e}){let t=Math.max(1,...e.map(e=>e.value));return(0,H.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.map((e,n)=>(0,H.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,8rem)_1fr_auto] items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-[0.8125rem] text-ink-2`,children:e.label}),(0,H.jsx)(`span`,{className:`h-2.5 rounded-full bg-paper-2`,children:(0,H.jsx)(`span`,{className:`block h-full rounded-full bg-ember`,style:{width:`${e.value/t*100}%`}})}),(0,H.jsx)(`span`,{className:`text-[0.8125rem] tabular-nums`,children:e.value.toLocaleString(Te())})]},n))})}function dp({data:e}){if(e.length<2)return(0,H.jsx)(up,{data:e});let t=Math.max(...e.map(e=>e.value)),n=Math.min(...e.map(e=>e.value)),r=t-n||1,i=e.map((t,i)=>[i/(e.length-1)*312+4,116-(t.value-n)/r*112]);return(0,H.jsxs)(`figure`,{children:[(0,H.jsxs)(`svg`,{viewBox:`0 0 320 120`,className:`w-full text-ember`,role:`img`,children:[(0,H.jsx)(`polyline`,{points:i.map(([e,t])=>`${e},${t}`).join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinejoin:`round`}),i.map(([t,n],r)=>(0,H.jsx)(`circle`,{cx:t,cy:n,r:`3`,fill:`currentColor`,children:(0,H.jsx)(`title`,{children:`${e[r].label}: ${e[r].value}`})},r))]}),(0,H.jsxs)(`figcaption`,{className:`mt-1 flex justify-between text-[0.75rem] text-ink-3`,children:[(0,H.jsx)(`span`,{children:e[0].label}),(0,H.jsx)(`span`,{children:e.at(-1)?.label})]})]})}var fp=[`var(--color-ember)`,`var(--color-cobalt)`,`var(--color-moss)`,`var(--color-amber)`,`var(--color-ink-3)`];function pp({data:e}){let t=e.reduce((e,t)=>e+Math.max(0,t.value),0)||1,n=0,r=2*Math.PI*40;return(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsx)(`svg`,{viewBox:`0 0 100 100`,className:`size-28 shrink-0 -rotate-90`,role:`img`,children:e.map((e,i)=>{let a=Math.max(0,e.value)/t*r,o=(0,H.jsx)(`circle`,{cx:`50`,cy:`50`,r:40,fill:`none`,stroke:fp[i%fp.length],strokeWidth:`16`,strokeDasharray:`${a} ${r-a}`,strokeDashoffset:-n,children:(0,H.jsx)(`title`,{children:`${e.label}: ${e.value}`})},i);return n+=a,o})}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-1 text-[0.8125rem]`,children:e.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`size-2.5 rounded-full`,style:{background:fp[t%fp.length]}}),(0,H.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:e.value.toLocaleString(Te())})]},t))})]})}function mp(e,t){let n=e.toLowerCase(),r=t.toLowerCase().split(`.`).at(-1)??``;return n===`application/pdf`||r===`pdf`?`pdf`:n.startsWith(`image/`)||[`png`,`jpg`,`jpeg`,`webp`,`gif`,`avif`].includes(r)?`image`:n.startsWith(`video/`)||[`mp4`,`webm`,`mov`].includes(r)?`video`:n.startsWith(`audio/`)||[`mp3`,`m4a`,`wav`,`ogg`,`webm`].includes(r)?`audio`:`other`}function hp({url:e,name:t,mime:n,preview:r}){let i=mp(n,t);return(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:[r&&i===`pdf`?(0,H.jsx)(`iframe`,{src:`${e}#navpanes=0&view=FitH`,title:t,className:`block h-[28rem] w-full bg-paper-2`}):r&&i===`image`?(0,H.jsx)(`img`,{src:e,alt:t,className:`block max-h-[28rem] w-full object-contain`}):null,(0,H.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-3 px-4 py-3 hover:bg-paper-2/70`,children:[(0,H.jsx)(k,{className:`size-5 shrink-0 text-ink-3`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.9375rem]`,children:t||B(`surface.file`)}),(0,H.jsx)(`span`,{className:`shrink-0 text-[0.8125rem] text-ink-3`,children:B(`surface.openFile`)})]})]})}var gp={p:k,t:Go,f:k,chat:co,wizard:$o};function _p({c:e,ctx:t,row:r}){let i=n=>Zf(e,n,t,r),a=$(i(`open`)),o=t.chat?.href(a)??null,s=gp[a.split(`:`)[0]]??k,c=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(s,{className:`size-4 shrink-0 text-ink-3`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-[0.9375rem]`,children:$(i(`title`))}),i(`subtitle`)?(0,H.jsx)(`span`,{className:`block truncate text-[0.8125rem] text-ink-3`,children:$(i(`subtitle`))}):null]}),i(`meta`)?(0,H.jsx)(`span`,{className:`shrink-0 text-[0.8125rem] text-ink-3 tabular-nums`,children:$(i(`meta`))}):null,o?(0,H.jsx)(ga,{className:`size-4 shrink-0 text-ink-3`}):null]}),l=`flex items-center gap-3 rounded-xl bg-card px-4 py-3 ring-1 ring-border-soft`;if(!o)return(0,H.jsx)(`div`,{className:l,children:c});let u=t.chat?.follow;return(0,H.jsx)(`a`,{href:o,onClick:e=>{u&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&(e.preventDefault(),u(o))},className:n(l,`hover:ring-ink-4`),children:c})}function vp({c:e,ctx:t,row:r}){let i=n=>Zf(e,n,t,r),a=$(i(`titleKey`))||`title`,o=$(i(`urlKey`))||`url`,s=tp(i(`items`));return s.length?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[0.8125rem]`,children:[(0,H.jsx)(`span`,{className:`text-ink-3`,children:B(`surface.foundIn`)}),s.map((e,r)=>{let i=$(np(e,a))||rp(e,``),s=$(np(e,o)),c=$(np(e,`open`)),l=/^https?:\/\//.test(s)?s:c?t.chat?.href(c)??null:null,u=`inline-flex max-w-full items-center gap-1 rounded-full bg-paper-2 px-2.5 py-0.5 text-ink-2`;return l?(0,H.jsxs)(`a`,{href:l,target:s?`_blank`:void 0,rel:`noreferrer`,onClick:e=>{let n=t.chat?.follow;!s&&n&&(e.preventDefault(),n(l))},className:n(u,`hover:text-ink`),children:[(0,H.jsx)(`span`,{className:`truncate`,children:i}),s?(0,H.jsx)(S,{className:`size-3 shrink-0`}):null]},r):(0,H.jsx)(`span`,{className:u,children:(0,H.jsx)(`span`,{className:`truncate`,children:i})},r)})]}):null}function yp({title:e,children:t}){return(0,H.jsxs)(`div`,{className:`rounded-xl bg-card p-4 ring-1 ring-border-soft`,children:[e?(0,H.jsx)(`div`,{className:`mb-3 font-medium text-[0.875rem]`,children:e}):null,t]})}function bp({c:e,ctx:t}){let n=e,r=$(n.state),i=(Array.isArray(n.options)?n.options:[]).map(e=>{let t=e;return e&&typeof e==`object`?{label:$(t.label),value:t.value}:{label:$(e),value:e}}),a=t.data[r],o=new Map(i.map(e=>[String(e.value),e.label])),s=e=>t.setState(r,i.find(t=>String(t.value)===String(e))?.value),c=e=>o.get(e)??e,l=i.map(e=>String(e.value)),u=a==null?``:String(a);return n.look===`list`?(0,H.jsx)(ad,{name:e.id,value:u,options:l,disabled:new Set,label:c,onChange:s}):(0,H.jsx)(v,{value:u,options:l,label:c,onChange:s})}function xp({id:e,ctx:t,row:r}){let i=t.slots?.get(e);if(i!==void 0)return(0,H.jsx)(H.Fragment,{children:i});let a=t.byId.get(e);if(!a)return null;let o=e=>Zf(a,e,t,r);switch(a.component){case`Column`:return(0,H.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,H.jsx)($f,{c:a,ctx:t,row:r})});case`Text`:{let e=$(o(`variant`))||`body`;return(0,H.jsx)(`p`,{className:n(e===`h3`&&`font-display font-semibold text-[1.25rem] leading-tight`,e===`h4`&&`font-semibold text-[1rem]`,e===`lead`&&`font-display text-[1.0625rem] text-ink-2 leading-relaxed`,e===`body`&&`text-[0.9375rem] leading-relaxed`,e===`muted`&&`text-[0.8125rem] text-ink-3`),children:$(o(`text`))})}case`List`:return(0,H.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:(0,H.jsx)($f,{c:a,ctx:t,row:r})});case`Row`:{let e=Xf(o(`image`),t),r=$(o(`badge`));return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[e?(0,H.jsx)(`img`,{src:e,alt:``,className:`size-10 shrink-0 rounded-lg object-cover`}):null,(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[0.9375rem]`,children:$(o(`title`))}),o(`subtitle`)?(0,H.jsx)(`div`,{className:`truncate text-[0.8125rem] text-ink-3`,children:$(o(`subtitle`))}):null]}),o(`meta`)?(0,H.jsx)(`span`,{className:`shrink-0 text-[0.8125rem] text-ink-3 tabular-nums`,children:$(o(`meta`))}):null,r?(0,H.jsx)(`span`,{className:n(`shrink-0 rounded-full px-2 py-0.5 text-[0.75rem]`,ep[$(o(`badgeTone`))]??ep.default),children:r}):null]})}case`DetailGrid`:{let e=o(`rows`);return(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 rounded-xl bg-card p-4 text-[0.875rem] ring-1 ring-border-soft`,children:(Array.isArray(e)?e:[]).map((e,n)=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{className:`text-ink-3`,children:$(Jf(e?.label,t.data,r))}),(0,H.jsx)(`dd`,{className:`break-words`,children:$(Jf(e?.value,t.data,r))})]},n))})}case`Badge`:return(0,H.jsx)(`span`,{className:n(`inline-flex w-fit rounded-full px-2.5 py-0.5 text-[0.75rem]`,ep[$(o(`tone`))]??ep.default),children:$(o(`label`))});case`Grid`:{let e=Math.min(4,Math.max(1,Yf(o(`columns`))||2)),n=Math.min(24,Math.max(6,Yf(o(`min`))||(e>2?9:12)));return(0,H.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${n}rem), 1fr))`},children:(0,H.jsx)($f,{c:a,ctx:t,row:r})})}case`Metric`:return(0,H.jsxs)(`div`,{className:`rounded-xl bg-card p-4 ring-1 ring-border-soft`,children:[(0,H.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:$(o(`label`))}),(0,H.jsx)(`div`,{className:`mt-1 font-display font-semibold text-[1.5rem] tabular-nums`,children:$(o(`value`))}),o(`caption`)?(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:$(o(`caption`))}):null]});case`Table`:{let e=o(`rows`),t=Array.isArray(e)?e:[],n=o(`columns`),r=Array.isArray(n)?n.map(e=>({key:$(e?.key),label:$(e?.label??e?.key)})):[...new Set(t.flatMap(e=>Object.keys(e??{})))].map(e=>({key:e,label:e}));return(0,H.jsx)(`div`,{className:`overflow-x-auto rounded-xl ring-1 ring-border-soft`,children:(0,H.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,H.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,H.jsx)(`tr`,{children:r.map(e=>(0,H.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:e.label},e.key))})}),(0,H.jsx)(`tbody`,{children:t.map((e,t)=>(0,H.jsx)(`tr`,{className:`border-border-soft border-t`,children:r.map(t=>(0,H.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:$(e?.[t.key])},t.key))},t))})]})})}case`Image`:{let e=Xf(o(`src`),t);return e?(0,H.jsx)(`img`,{src:e,alt:$(o(`alt`)),className:`w-full rounded-xl`}):null}case`BarChart`:return(0,H.jsx)(yp,{title:$(o(`title`)),children:(0,H.jsx)(up,{data:Qf(o(`points`),o(`labelKey`),o(`valueKey`))})});case`LineChart`:return(0,H.jsx)(yp,{title:$(o(`title`)),children:(0,H.jsx)(dp,{data:Qf(o(`points`),o(`labelKey`),o(`valueKey`))})});case`DonutChart`:return(0,H.jsx)(yp,{title:$(o(`title`)),children:(0,H.jsx)(pp,{data:Qf(o(`slices`),o(`labelKey`),o(`valueKey`))})});case`Actions`:return(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,H.jsx)($f,{c:a,ctx:t,row:r})});case`Button`:{let e=$(o(`action`));return!t.onAction&&e!==`open`?null:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{let n=o(`target`);if(e===`open`){let e=Xf(n,t);e&&window.open(e,`_blank`,`noopener`)}else t.onAction?.({action:e,target:e===`ask`?$(o(`prompt`))||$(o(`label`)):n})},className:`inline-flex h-9 items-center rounded-full bg-paper-2 px-4 text-[0.875rem] text-ink-2 hover:text-ink coarse:h-11`,children:$(o(`label`))})}case`Tabs`:return(0,H.jsx)(cp,{c:a,ctx:t,row:r});case`Card`:{let e=Xf(o(`image`),t),i=$(o(`eyebrow`)),s=$(o(`subtitle`));return(0,H.jsxs)(`article`,{className:`overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:[e?(0,H.jsx)(`img`,{src:e,alt:``,className:`aspect-[16/9] w-full object-cover`}):null,(0,H.jsxs)(`div`,{className:n(`flex flex-col gap-1.5 px-4 py-3.5`,a.children&&`bg-paper-2/60`),children:[i?(0,H.jsx)(`div`,{className:`font-medium text-[0.6875rem] text-ink-3 uppercase tracking-[0.14em]`,children:i}):null,(0,H.jsx)(`h3`,{className:`text-balance font-display font-semibold text-[1.1875rem] leading-snug`,children:$(o(`title`))}),s?(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3 leading-relaxed`,children:s}):null,(0,H.jsx)(op,{items:sp(a,t,r)})]}),a.children?(0,H.jsx)(`div`,{className:`flex flex-col gap-3 border-border-soft border-t px-4 py-3.5 empty:hidden`,children:(0,H.jsx)($f,{c:a,ctx:t,row:r})}):null]})}case`Fold`:return(0,H.jsxs)(`details`,{open:!!o(`open`),className:`group border-border-soft border-t pt-3 first:border-0 first:pt-0`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 font-display font-semibold text-[1rem] [&::-webkit-details-marker]:hidden`,children:[$(o(`title`)),(0,H.jsx)(ga,{className:`size-4 text-ink-3 transition-transform group-open:rotate-90 motion-reduce:transition-none`})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-3 pt-3`,children:(0,H.jsx)($f,{c:a,ctx:t,row:r})})]});case`Group`:{let e=a.children;if(!e||Array.isArray(e))return null;let n=tp(Jf({path:e.path},t.data,r));return(0,H.jsx)(`div`,{className:`flex flex-col gap-5`,children:ip(n,$(o(`by`)),tp(o(`order`)).map($)).map(([n,r])=>(0,H.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[n?(0,H.jsx)(`h4`,{className:`font-semibold text-[0.6875rem] text-second uppercase tracking-[0.14em]`,children:n}):null,r.map((n,r)=>(0,H.jsx)(xp,{id:e.componentId,ctx:t,row:n},r))]},n))})}case`Chips`:{let e=$(o(`labelKey`)),t=$(o(`flagKey`)),r=$(o(`flag`)),i=$(o(`title`));return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i?(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:i}):null,(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:tp(o(`items`)).map((i,a)=>{let o=!!(t&&np(i,t));return(0,H.jsxs)(`span`,{className:n(`rounded-full px-2.5 py-1 text-[0.8125rem]`,o?`bg-amber-tint font-medium text-ink ring-1 ring-amber/60`:`bg-card text-ink-2 ring-1 ring-border-soft`),children:[rp(i,e),o&&r?` · ${r}`:``]},a)})})]})}case`Checklist`:return(0,H.jsx)(lp,{c:a,ctx:t,row:r});case`Steps`:{let e=$(o(`textKey`))||`text`,t=$(o(`minutesKey`))||`minutes`;return(0,H.jsx)(`ol`,{className:`flex flex-col gap-3`,children:tp(o(`items`)).map((n,r)=>{let i=$(typeof n==`object`?np(n,e):n),a=ap(np(n,t));return(0,H.jsxs)(`li`,{className:`grid grid-cols-[1.5rem_1fr] gap-2`,children:[(0,H.jsx)(`span`,{className:`font-display font-semibold text-[1.125rem] text-ember leading-snug`,children:r+1}),(0,H.jsxs)(`span`,{className:`text-[0.9375rem] leading-relaxed`,children:[i,a?(0,H.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-paper-2 px-2 py-0.5 align-[1px] text-[0.75rem] text-ink-2`,children:[(0,H.jsx)(va,{className:`size-3`}),a]}):null]})]},r)})})}case`Link`:{let e=$(o(`key`))||`id`,r=$(o(`value`)),i=tp(o(`items`)).find(t=>$(np(t,e))===r),s=a.view;if(i===void 0)return null;let c=e=>Jf(a[e],t.data,i),l=$(o(`eyebrow`)),u=sp(a,t,i);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>typeof s==`string`&&t.open(s,i),className:n(`group flex w-full items-center gap-3 text-left`,$(o(`look`))===`card`?`rounded-xl bg-card p-4 ring-1 ring-border-soft hover:ring-ink-4`:`-mx-2 w-[calc(100%+1rem)] rounded-lg px-2 py-2 hover:bg-paper-2/70 coarse:py-3`),children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l?(0,H.jsx)(`span`,{className:`block font-semibold text-[0.6875rem] text-second uppercase tracking-[0.14em]`,children:l}):null,(0,H.jsx)(`span`,{className:`block font-display font-semibold text-[1rem] leading-snug group-hover:text-ember`,children:$(c(`title`))}),c(`subtitle`)?(0,H.jsx)(`span`,{className:`block text-[0.8125rem] text-ink-3`,children:$(c(`subtitle`))}):null,u.length?(0,H.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-[0.75rem] text-ink-3`,children:[(0,H.jsx)(va,{className:`size-3`}),u.join(` · `)]}):null]}),(0,H.jsx)(ga,{className:`size-4 shrink-0 text-ink-3`})]})}case`Callout`:{let e=$(o(`tone`))||`tip`,t=$(o(`title`));return(0,H.jsxs)(`div`,{className:n(`flex gap-2.5 rounded-xl px-4 py-3 text-[0.875rem] leading-relaxed`,e===`tip`&&`bg-second-tint`,e===`note`&&`bg-paper-2`,e===`warning`&&`bg-amber-tint`),children:[(0,H.jsx)(Ja,{className:n(`mt-0.5 size-4 shrink-0`,e===`tip`?`text-second`:`text-ink-3`)}),(0,H.jsxs)(`p`,{children:[t?(0,H.jsxs)(`b`,{className:`font-semibold`,children:[t,` `]}):null,$(o(`text`))]})]})}case`Markdown`:return(0,H.jsx)(wl,{text:$(o(`text`)),className:`text-[0.9375rem]`});case`Sources`:return(0,H.jsx)(vp,{c:a,ctx:t,row:r});case`File`:{let e=Xf(o(`file`),t);return e?(0,H.jsx)(hp,{url:e,name:$(o(`name`)),mime:$(o(`mime`)),preview:o(`preview`)!==!1}):null}case`Video`:{let e=Xf(o(`src`),t),n=Xf(o(`poster`),t);return e?(0,H.jsx)(`video`,{src:e,poster:n??void 0,controls:!0,playsInline:!0,preload:`metadata`,className:`w-full rounded-xl bg-paper-2`}):null}case`Audio`:{let e=Xf(o(`src`),t),n=$(o(`title`));return e?(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-card p-3 ring-1 ring-border-soft`,children:[n?(0,H.jsx)(`div`,{className:`text-[0.875rem]`,children:n}):null,(0,H.jsx)(`audio`,{src:e,controls:!0,preload:`metadata`,className:`w-full`})]}):null}case`Gallery`:{let e=$(o(`srcKey`)),n=$(o(`captionKey`)),r=tp(o(`items`)).map(r=>({url:Xf(e?np(r,e):r,t),caption:n?$(np(r,n)):``})).filter(e=>!!e.url);return(0,H.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 9rem), 1fr))`},children:r.map((e,t)=>(0,H.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`group`,children:[(0,H.jsx)(`img`,{src:e.url,alt:e.caption,className:`aspect-square w-full rounded-lg object-cover ring-1 ring-border-soft group-hover:ring-ink-4`}),e.caption?(0,H.jsx)(`span`,{className:`mt-1 block truncate text-[0.75rem] text-ink-3`,children:e.caption}):null]},t))})}case`Ref`:return(0,H.jsx)(_p,{c:a,ctx:t,row:r});case`Form`:return(0,H.jsx)(H.Fragment,{children:t.chat?.form?.(a,t.byId,t.data)});case`Field`:return(0,H.jsx)(H.Fragment,{children:t.field?.($(a.name))});case`Choice`:return(0,H.jsx)(bp,{c:a,ctx:t});case`Toggle`:{let e=$(a.state),n=ne(t.data[e]);return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`text-[0.9375rem]`,children:$(o(`label`))}),(0,H.jsx)(d,{checked:n,onChange:n=>t.setState(e,n)})]})}case`Slider`:{let e=a,n=$(e.state);return(0,H.jsx)(rd,{label:$(o(`label`))||n,value:t.data[n],min:Number(e.min),max:Number(e.max),increment:typeof e.increment==`number`?e.increment:void 0,unit:typeof e.unit==`string`?e.unit:void 0,onChange:e=>t.setState(n,e)})}}return null}function Sp(e,t){let n={};for(let r of e.components){let{state:e,default:i}=r;typeof e==`string`&&(r.component===`Choice`||r.component===`Toggle`||r.component===`Slider`)&&(n[e]=t[e]??i)}return{...e.data,...n}}function Cp({surface:e,assetUrl:t,onAction:n,initial:r,onState:i,chat:a,field:o,slots:s}){let[c,u]=(0,V.useState)(r??{}),[d,f]=(0,V.useState)(null),p={byId:new Map(e.components.map(e=>[e.id,e])),data:Sp(e,c),assetUrl:t,onAction:n,state:c,setState:(e,t)=>{let n={...c,[e]:t};u(n),i?.(n)},open:(e,t)=>f({view:e,row:t}),chat:a,field:o,slots:s};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xp,{id:`root`,ctx:p}),(0,H.jsx)(l,{open:d!==null,onClose:()=>f(null),height:`tall`,children:d?(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(xp,{id:d.view,ctx:p,row:d.row}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(null),className:`h-10 self-center rounded-full bg-paper-2 px-5 text-[0.875rem] text-ink-2 hover:text-ink`,children:B(`surface.close`)})]}):null})]})}var wp=new Set([`image`,`file`,`audio`,`signature`]);function Tp(e,t){let n=e,r=e=>typeof e==`string`?e:void 0;return{id:String(n.name),kind:n.kind,label:String(ie(n.label,t)??``),required:n.required===!0,placeholder:r(n.placeholder),help:r(n.help),options:Array.isArray(n.options)?n.options.map(String):void 0,multiple:n.multiple===!0,camera:n.camera===!0}}var Ep=e=>e==null||e===``||Array.isArray(e)&&e.length===0;function Dp(e,t){if(!wp.has(e)||Ep(t))return[];if(Array.isArray(t))return t.map(String);if(typeof t==`object`){let e=t.asset;return typeof e==`string`?[e]:[]}return[String(t)]}function Op(e,t){if(Ep(t))return`—`;let n=Dp(e,t);if(n.length)return n.length===1?I(`surface.file`):I(`surface.files`,{n:n.length});if(typeof t==`boolean`)return I(t?`run.yes`:`run.no`);if(e===`date`&&typeof t==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(t))return new Date(`${t}T12:00:00`).toLocaleDateString(de,{dateStyle:`medium`});if(Array.isArray(t))return t.join(`, `);if(typeof t==`object`){let e=t;return typeof e.label==`string`&&e.label?e.label:`${e.lat??``}, ${e.lng??``}`}return String(t)}function kp({c:e,byId:t,data:n,chat:r}){let i=(Array.isArray(e.children)?e.children:[]).map(e=>t.get(e)).filter(e=>e?.component===`Field`).map(e=>({field:Tp(e,n),value:e.value})),[a,o]=(0,V.useState)(()=>Object.fromEntries(i.filter(e=>e.value!==void 0).map(e=>[e.field.id,ie(e.value,n)]))),[s,c]=(0,V.useState)(0),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)({}),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),v=String(ie(e.title,n)??``),y=r?.answered??(h?{by:``,values:h}:null);if(!r)return null;if(y)return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-card p-4 ring-1 ring-border-soft`,children:[v?(0,H.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:v}):null,(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-[0.875rem]`,children:i.filter(({field:e})=>!Ep(y.values[e.id])).map(({field:e})=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{className:`text-ink-3`,children:e.label}),(0,H.jsx)(`dd`,{className:`break-words`,children:Op(e.kind,y.values[e.id])})]},e.id))}),y.by?(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:I(`surface.sentBy`,{name:y.by})}):null]});let b=async()=>{let t=Object.fromEntries(i.filter(({field:e})=>e.required&&Ep(a[e.id])).map(({field:e})=>[e.id,I(`surface.required`)]));if(f(t),Object.keys(t).length)return;let n=i.filter(({field:e})=>!Ep(a[e.id])).map(({field:e})=>`${e.label}: ${Op(e.kind,a[e.id])}`);u(!0),m(null);try{await r.submit({form:e.id,values:a,text:[v,...n].filter(Boolean).join(`
|
|
9
|
+
`),files:i.flatMap(({field:e})=>Dp(e.kind,a[e.id]))}),g(a)}catch(e){m(e.message)}finally{u(!1)}};return(0,H.jsxs)(`form`,{className:`flex flex-col gap-4 rounded-xl bg-card p-4 ring-1 ring-border-soft`,onSubmit:e=>{e.preventDefault(),b()},children:[v?(0,H.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:v}):null,i.map(({field:e})=>(0,H.jsx)(uf,{field:e,value:a[e.id],values:a,runId:``,base:r.fieldBase,error:d[e.id],onBusy:e=>c(t=>Math.max(0,t+(e?1:-1))),onChange:t=>o(n=>({...n,[e.id]:t}))},e.id)),p?(0,H.jsx)(`div`,{className:`text-[0.8125rem] text-rose`,children:p}):null,(0,H.jsx)(_,{type:`submit`,className:`self-start`,busy:l,disabled:s>0,children:l?I(`surface.sending`):String(ie(e.submit,n)??``)})]})}function Ap({chat:e,...t}){return(0,H.jsx)(Cp,{...t,chat:e&&{href:t=>e.href(t),follow:e.follow,form:(t,n,r)=>(0,H.jsx)(kp,{c:t,byId:n,data:r,chat:e})}})}function jp({src:e,page:t,height:r,fit:i,flow:a,state:o,onState:s}){let c=(0,V.useRef)(null),[l,u]=(0,V.useState)(r),[d]=(0,V.useState)(()=>o??{}),f=(0,V.useRef)(s);f.current=s,(0,V.useEffect)(()=>{let e=e=>{if(!c.current||e.source!==c.current.contentWindow)return;let t=e.data;if(t?.wizard===`height`&&typeof t.height==`number`)u(Math.min(2e4,Math.max(120,Math.ceil(t.height))));else if(t?.wizard===`state`&&t.state&&typeof t.state==`object`)f.current?.(t.state);else if(t?.wizard===`share`&&typeof t.text==`string`){let e=t.text.slice(0,1e4);navigator.share?navigator.share({text:e}).catch(()=>void 0):navigator.clipboard?.writeText(e).catch(()=>void 0)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]);let p=(0,V.useRef)(null),[m,h]=(0,V.useState)(0);(0,V.useEffect)(()=>{let e=p.current;if(!e)return;let t=new ResizeObserver(()=>h(e.clientWidth));return t.observe(e),h(e.clientWidth),()=>t.disconnect()},[]);let[g,_]=(0,V.useState)(null);(0,V.useEffect)(()=>{let t=!0;return fetch(e,{credentials:`include`}).then(e=>e.ok?e.text():``).then(n=>t&&_({src:e,text:n})),()=>{t=!1}},[e]);let v=a?m||360:t??Math.max(m,900),y=a?1:m?i?m/v:Math.min(1,m/v):1,b=a?l:r,x=a&&g?`<script>window.__WIZARD_STATE=${JSON.stringify(d).replace(/</g,`\\u003c`)}<\/script>${g.text}`:g?.text;return(0,H.jsxs)(`div`,{ref:p,className:n(`relative overflow-hidden`,!a&&`rounded-lg bg-white ring-1 ring-border-soft`),style:{height:b*y},children:[g?.src===e?(0,H.jsx)(`iframe`,{ref:c,title:I(`output.preview`),srcDoc:x,sandbox:`allow-scripts allow-popups allow-popups-to-escape-sandbox`,className:`absolute top-0 left-0 origin-top-left border-0`,style:{width:v,height:b,transform:`scale(${y})`}},e):(0,H.jsx)(`div`,{className:`absolute inset-0 animate-pulse bg-paper-2`}),a?null:(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`absolute top-3 right-3 inline-flex size-9 items-center justify-center rounded-full bg-card/90 text-ink-2 shadow-soft ring-1 ring-border-soft backdrop-blur hover:text-ink coarse:size-11`,"aria-label":I(`run.openFull`),children:(0,H.jsx)(io,{className:`size-4`})})]})}var Mp={disc:{file:`ai`,box:566.93,x:89.28,y:100.72,w:365.49,h:365.49},generated:{file:`ai-generated`,box:1789.84,x:207.3,y:144.36,w:1384.24,h:266.41},edited:{file:`ai-modified`,box:1700.79,x:231.11,y:144.36,w:1230.56,h:266.41}};function Np({icon:e,tone:t,size:r,className:i}){let a=Mp[e],o=r/a.h;return(0,H.jsx)(`img`,{src:Pl(`ai-labels/${a.file}-${t}.svg`),alt:``,draggable:!1,className:n(`pointer-events-none absolute max-w-none select-none`,i),style:{width:a.box*o,height:566.93*o,left:-a.x*o,top:-a.y*o}})}function Pp({ai:e,className:t}){let[r,i]=(0,V.useState)(!1);if(!e)return null;let a=Mp[e],o=t===`static`,s=o?[[`black`,`dark:hidden`],[`white`,`hidden dark:block`]]:[[`white`,``]];return(0,H.jsx)(`button`,{type:`button`,"aria-label":I(e===`edited`?`ai.modified`:`ai.generated`),"aria-expanded":r,"data-open":r,onClick:()=>i(e=>!e),className:n(`group block cursor-default overflow-hidden rounded-full backdrop-blur-md transition-[width] duration-200`,`w-[var(--ai-disc)] hover:w-[var(--ai-long)] focus-visible:w-[var(--ai-long)] data-[open=true]:w-[var(--ai-long)]`,o?`relative`:n(`absolute shadow-[0_1px_3px_rgba(0,0,0,0.25)]`,t??`bottom-2 left-2`)),style:{height:18,"--ai-disc":`18px`,"--ai-long":`${a.w/a.h*18}px`},children:s.map(([t,i])=>(0,H.jsxs)(`span`,{className:i,children:[(0,H.jsx)(Np,{icon:`disc`,tone:t,size:18,className:n(`transition-opacity duration-200`,r?`opacity-0`:`opacity-100 group-hover:opacity-0 group-focus-visible:opacity-0`)}),(0,H.jsx)(Np,{icon:e,tone:t,size:18,className:n(`transition-opacity duration-200`,r?`opacity-100`:`opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100`)})]},t))})}function Fp(e,t){let n=oe(e)?Ce(e).fields[t]:void 0;return n?P(t,n):t}function Ip({text:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[t?(0,H.jsx)(A,{className:`size-3.5`}):(0,H.jsx)(T,{className:`size-3.5`}),I(t?`share.copied`:`run.copy`)]})}function Lp({base:e,step:t,output:r,editable:i,draft:a,onDraft:o,picked:c,onPick:l,onSurfaceAction:u,onView:d}){if(!r)return null;let f=oe(t)?te(t):t,p=t=>Nl(`${e}/assets/${t}`);if(r.surface)return(0,H.jsx)(Ap,{surface:r.surface,assetUrl:p,onAction:u,initial:r.view,onState:d});if(f.type===`widget`||f.type===`motion-graphics`){let e=r.assets?.find(e=>e.kind===`video`);if(e){let t=r.assets?.find(e=>e.kind===`poster`),i=f.type===`motion-graphics`?f.format===`9:16`:(f.size?.height??0)>(f.size?.width??1),a=(0,H.jsxs)(`div`,{className:n(`relative mx-auto`,i?`w-fit`:`w-full`),children:[(0,H.jsx)(`video`,{src:p(e.id),poster:t?p(t.id):void 0,controls:!0,playsInline:!0,className:n(`rounded-lg bg-black ring-1 ring-border-soft`,i?`max-h-[76vh]`:`w-full`)}),(0,H.jsx)(Pp,{ai:e.ai,className:`top-2 right-2`})]});return f.type===`motion-graphics`&&r.text?(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,H.jsx)(wl,{text:r.text,className:`text-[0.875rem] text-ink-2`})]}):a}if(f.type===`motion-graphics`)return null;let t=r.assets?.find(e=>e.mime===`text/html`),i=f.size??{width:1280,height:720};return t?(0,H.jsx)(jp,{src:p(t.id),page:i.width,height:i.height,fit:!0,flow:f.layout===`page`,state:r.view,onState:d}):null}if(f.type===`generate`){let e=r.assets?.[0];if(!e)return null;if(f.asset===`voice`)return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`audio`,{src:p(e.id),controls:!0,className:`w-full`}),(0,H.jsx)(Pp,{ai:e.ai,className:`static`}),r.text?(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:r.text}):null]});if((r.assets?.length??0)>1&&(f.asset===`image`||f.asset===`video`)){let e=f.options?.aspectRatio===`9:16`||f.options?.aspectRatio===`2:3`;return(0,H.jsx)(`div`,{className:n(`grid gap-3`,e?`grid-cols-2 sm:grid-cols-3`:`sm:grid-cols-2`),children:r.assets?.map((e,t)=>{let r=c?.includes(t);return(0,H.jsxs)(`figure`,{className:n(`relative overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,r&&`ring-2 ring-ember`),children:[f.asset===`image`?(0,H.jsx)(`img`,{src:p(e.id),alt:`${f.title} ${t+1}`,className:`w-full`}):(0,H.jsx)(`video`,{src:p(e.id),controls:!0,playsInline:!0,loop:!0,className:`w-full`}),l?(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>l(t),className:n(`absolute top-2 left-2 inline-flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[0.75rem] shadow-soft backdrop-blur coarse:h-11`,r?`bg-ember text-ember-on`:`bg-card/90 text-ink-2 hover:text-ink`),children:[r?(0,H.jsx)(A,{className:`size-3.5`}):null,I(r?`run.pickedItem`:`run.pickItem`,{n:t+1})]}):(0,H.jsx)(`span`,{className:`absolute top-2 left-2 rounded-full bg-card/90 px-2.5 py-1 font-medium text-[0.75rem] text-ink-2`,children:t+1}),(0,H.jsx)(Pp,{ai:e.ai,className:f.asset===`image`?`bottom-2 left-2`:`top-2 right-2`})]},e.id)})})}if(f.asset===`image`)return(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`img`,{src:p(e.id),alt:f.title,className:`w-full rounded-lg bg-paper-2 ring-1 ring-border-soft`}),(0,H.jsx)(Pp,{ai:e.ai})]});if(f.asset===`video`){let t=f.options?.aspectRatio===`9:16`;return(0,H.jsxs)(`div`,{className:n(`relative mx-auto`,t?`w-fit`:`w-full`),children:[(0,H.jsx)(`video`,{src:p(e.id),controls:!0,playsInline:!0,loop:!0,className:n(`rounded-lg bg-black ring-1 ring-border-soft`,t?`max-h-[70vh]`:`w-full`)}),(0,H.jsx)(Pp,{ai:e.ai,className:`top-2 left-2`})]})}return f.asset===`document`?(0,H.jsx)(jp,{src:p(e.id),page:820,height:1100}):(0,H.jsx)(jp,{src:p(e.id),page:null,height:760})}if(f.type===`agent`){let e=r.assets?.filter(e=>e.kind!==`file`&&e.mime.startsWith(`image/`))??[],t=r.assets?.filter(e=>e.kind===`file`)??[];return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f.output.format===`json`&&r.json!==void 0?(0,H.jsx)(Ef,{step:f,json:r.json}):i?(0,H.jsx)(s,{value:a??r.text??``,onChange:e=>o?.(e.target.value),minRows:4,maxRows:24}):f.output.format===`markdown`?(0,H.jsx)(wl,{text:r.text??``}):(0,H.jsx)(`div`,{className:`whitespace-pre-wrap text-[1rem] leading-relaxed`,children:r.text}),e.map(e=>(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`img`,{src:p(e.id),alt:``,className:`w-full rounded-lg ring-1 ring-border-soft`}),(0,H.jsx)(Pp,{ai:e.ai})]},e.id)),t.length?(0,H.jsx)(`ul`,{className:`overflow-hidden rounded-lg ring-1 ring-border-soft`,children:t.map(e=>(0,H.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,H.jsxs)(`a`,{href:p(e.id),download:e.name,onClick:t=>Rl(t,p(e.id),e.name),className:`flex items-center gap-2 px-3 py-2 text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,children:[(0,H.jsx)(k,{className:`size-3.5 shrink-0 text-ink-3`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]})},e.id))}):null,f.output.format!==`json`&&!i&&r.text?(0,H.jsx)(`div`,{children:(0,H.jsx)(Ip,{text:r.text})}):null]})}return null}var Rp={png:`PNG`,mp4:`MP4`,mp3:`MP3`,pdf:`PDF`,docx:`Word`,html:`HTML`,md:`Markdown`,txt:`Text`,csv:`CSV`,xlsx:`Excel`,json:`JSON`,zip:`ZIP`};function zp(e,t){return(e.headers.get(`content-disposition`)??``).match(/filename="([^"]+)"/)?.[1]??t}function Bp(e){let t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=e.name,n.rel=`noopener`,document.body.append(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),6e4)}function Vp({url:e,format:t,title:r,make:i}){let[a,s]=(0,V.useState)(`idle`),c=(0,V.useRef)(null),l=async()=>{if(Fl(`share`)&&!i)s(`busy`),await Il(`share`,{url:new URL(e,location.href).href,title:r}).catch(()=>void 0),s(`idle`);else try{if(!c.current){if(s(`busy`),i)c.current=await i();else{let n=await fetch(e,{credentials:`include`});if(!n.ok)throw Error(String(n.status));let r=await n.blob();c.current=new File([r],zp(n,`download.${t}`),{type:r.type.split(`;`)[0]})}}let n={files:[c.current],title:r};if(!navigator.canShare(n)){i?Bp(c.current):location.href=e,s(`idle`);return}await navigator.share(n),s(`idle`)}catch(e){s(c.current&&e.name===`NotAllowedError`?`ready`:`idle`)}};return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void l(),disabled:a===`busy`,"aria-label":I(`run.shareFile`),title:I(`run.shareFile`),className:n(`inline-flex h-9 items-center gap-1.5 rounded-full px-3 font-medium text-[0.8125rem] transition coarse:h-11 coarse:px-4`,a===`ready`?`bg-ember-tint text-ink ring-1 ring-ember`:`bg-paper-2 text-ink-2 hover:bg-paper-3 hover:text-ink`),children:[a===`busy`?(0,H.jsx)(o,{className:`size-3.5`}):(0,H.jsx)(Fo,{className:`size-3.5`}),I(a===`ready`?`run.shareNow`:`run.share`)]})}var Hp=Fl(`share`)||du();function Up({base:e,stepId:t,formats:r,title:i,step:a,output:s,foot:c}){let l=n=>Nl(`${e}/steps/${t}/download?format=${n}`),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=zl()&&oe(a)&&s&&(s.text||s.json!==void 0)?{title:i??a.title,text:s.text,json:R(a).format===`json`?s.json:void 0,label:e=>Fp(a,e),foot:c}:null,m=async()=>{if(!p)throw Error(`nothing written`);return f.current??=await qf(p),f.current},h=async()=>{d(!0);try{Bp(await m())}catch(e){console.warn(`pdf: ${e.message}`),r.includes(`html`)&&window.open(l(`html`),`_blank`,`noopener`)}finally{d(!1)}},g=e=>n(`inline-flex h-9 items-center gap-1.5 rounded-full px-3.5 font-medium text-[0.8125rem] transition coarse:h-11 coarse:px-4`,e===0?`bg-primary text-primary-foreground hover:brightness-105`:`bg-paper-2 text-ink-2 hover:bg-paper-3 hover:text-ink`),_=e=>e===`pdf`&&p!==null;return(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[r.map((e,t)=>_(e)?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void h(),disabled:u,className:g(t),children:[u?(0,H.jsx)(o,{className:`size-3.5`}):t===0?(0,H.jsx)(wa,{className:`size-3.5`}):null,Rp[e]]},e):e===`html`&&zl()?(0,H.jsxs)(`a`,{href:l(e),target:`_blank`,rel:`noopener`,className:g(t),children:[t===0?(0,H.jsx)(Co,{className:`size-3.5`}):null,I(`run.print`)]},e):(0,H.jsxs)(`a`,{href:l(e),onClick:t=>Rl(t,l(e)),className:g(t),children:[t===0?(0,H.jsx)(wa,{className:`size-3.5`}):null,Rp[e]]},e)),Hp&&r.length?(0,H.jsx)(Vp,{url:l(r[0]),format:r[0],title:i,make:_(r[0])?m:void 0},l(r[0])):null]})}function Wp({view:e}){let t=e.progress.sections;if(t)return(0,H.jsx)(`ol`,{className:`flex w-full gap-1`,children:t.names.map((e,r)=>{let i=r===t.current;return(0,H.jsxs)(`li`,{className:`min-w-0 flex-1`,"aria-current":i?`step`:void 0,children:[(0,H.jsx)(`div`,{className:n(`h-[3px] w-full transition-colors duration-700`,r<=t.current?`bg-ember`:`bg-paper-2`)}),(0,H.jsx)(`div`,{className:n(`truncate px-2 pt-1 text-center text-[0.75rem]`,i?`font-medium text-ink`:`text-ink-3`),children:e})]},e)})});let r=Math.round(Math.min(e.progress.done,e.progress.total)/Math.max(1,e.progress.total)*100);return(0,H.jsx)(`div`,{className:`h-[3px] w-full bg-paper-2`,children:(0,H.jsx)(`div`,{className:`h-full bg-ember transition-[width] duration-700 ease-out`,style:{width:`${r}%`}})})}var Gp=(e,t)=>n=>{Z.put(`${Q(e)}/views/${t}`,{state:n}).catch(()=>void 0)};function Kp({title:e,description:t,kicker:n}){return(0,H.jsxs)(`div`,{className:`kb-title mb-8`,children:[n?(0,H.jsx)(`p`,{className:`kb-hide mb-4 text-[0.9375rem] text-ink-2 leading-relaxed`,children:n}):null,(0,H.jsx)(`h1`,{className:`wizard-title font-display font-semibold text-[1.75rem] leading-[1.15] tracking-tight sm:text-[2rem]`,children:e}),t?(0,H.jsx)(`p`,{className:`kb-hide mt-2 text-[0.9375rem] text-ink-3 leading-relaxed`,children:t}):null]})}function qp(e,t){let n={},r=t.step?.id===e.id?t.unsent??{}:{};for(let i of e.fields)n[i.id]=r[i.id]??t.values[i.id]??t.prefill?.[i.id]??i.default??(i.kind===`multiselect`?[]:void 0);return n}function Jp(e){return Array.from(e.querySelectorAll(`input:not([type="hidden"], [type="file"], [type="checkbox"], [type="color"], [type="range"], [disabled]), textarea:not([disabled])`)).filter(e=>!e.closest(`dialog`)&&e.offsetParent!==null)}var Yp=800;function Xp(e,t,n,r){let i=(0,V.useRef)(n),a=(0,V.useRef)(!1),o=(0,V.useRef)(!0);i.current=n;let s=(0,V.useRef)(e=>{});s.current=n=>{if(!a.current||r.current||zl())return;a.current=!1;let o=`${Q(e)}/pages/${t}/unsent`;n?Z.keep(o,{values:i.current}):Z.put(o,{values:i.current}).catch(()=>{a.current=!0})},(0,V.useEffect)(()=>{if(o.current){o.current=!1;return}a.current=!0;let e=setTimeout(()=>s.current(!1),Yp);return()=>clearTimeout(e)},[n]),(0,V.useEffect)(()=>{let e=()=>{document.visibilityState===`hidden`&&s.current(!0)},t=()=>s.current(!0);return document.addEventListener(`visibilitychange`,e),window.addEventListener(`pagehide`,t),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`pagehide`,t)}},[])}function Zp({view:e,run:t,step:r}){let[i,a]=(0,V.useState)(()=>qp(r,e)),s=(0,V.useRef)(!1);Xp(e.id,r.id,i,s);let[c,l]=(0,V.useState)(new Set),u=(0,V.useRef)(null),d=e.progress.done===0,f=(0,V.useMemo)(()=>r.fields.filter(t=>!j(t)||e.decidedFields?.includes(t.id)).map(t=>e.options?.[t.id]?.length?{...t,options:e.options[t.id]}:t),[r.fields,e.options,e.decidedFields]),p=_e(f,e.known??{},i),m=()=>{s.current=!0,t.submitPage(r.id,i).then(e=>{e||(s.current=!1)})},h=n=>(0,H.jsx)(uf,{field:n,value:i[n.id],values:i,runId:e.id,view:e,error:t.fieldErrors[n.id],closed:e.closed?.[n.id],onChange:e=>a(t=>({...t,[n.id]:e})),onBusy:e=>l(t=>{if(t.has(n.id)===e)return t;let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r})},n.id);return(0,V.useEffect)(()=>{if(!u.current)return;let e=Jp(u.current).filter(e=>e instanceof HTMLInputElement);for(let[t,n]of e.entries())(n.dataset.hint||!n.hasAttribute(`enterkeyhint`))&&(n.dataset.hint=`1`,n.setAttribute(`enterkeyhint`,t===e.length-1?`go`:`next`))}),(0,H.jsxs)(`form`,{ref:u,className:`animate-rise`,onSubmit:e=>{e.preventDefault(),c.size||m()},onKeyDown:e=>{let t=e.target;if(e.key!==`Enter`||e.defaultPrevented||e.nativeEvent.isComposing||!(t instanceof HTMLInputElement)||t.closest(`dialog`))return;let n=Jp(e.currentTarget),r=n[n.indexOf(t)+1];r&&(e.preventDefault(),r.focus())},children:[(0,H.jsx)(Kp,{title:r.title,description:r.description,kicker:d?e.wizard.intro:null}),r.components?(0,H.jsx)(Ap,{surface:{components:r.components,data:{...e.pageData,...i}},assetUrl:t=>Nl(`${Q(e.id)}/assets/${t}`),field:e=>{let t=p.find(t=>t.id===e);return t?h(t):null}}):(0,H.jsx)(`div`,{className:`flex flex-col gap-7`,children:p.map(h)}),(0,H.jsx)(tm,{view:e}),t.saving?(0,H.jsxs)(`p`,{role:`status`,className:n(`mt-6 flex items-center gap-2 text-[0.8125rem]`,t.saving===`offline`?`text-rose`:`text-ink-3`),children:[t.saving===`slow`?(0,H.jsx)(o,{className:`size-3.5`}):null,I(t.saving===`slow`?`run.saving`:`run.notSaved`)]}):null,(0,H.jsx)(Qp,{view:e,run:t,sticky:!0,children:(0,H.jsxs)(_,{type:`submit`,size:`lg`,busy:t.busy,disabled:c.size>0,children:[r.cta||I(`run.next`),` `,(0,H.jsx)(Xi,{className:`size-4`})]})})]})}function Qp({view:e,run:t,sticky:r,children:i}){return(0,H.jsxs)(`div`,{className:n(`mt-10 flex items-center justify-between gap-3`,r&&`action-bar`),children:[e.canBack?(0,H.jsxs)(_,{variant:`ghost`,onClick:()=>void t.back(),disabled:t.busy,children:[(0,H.jsx)(Ji,{className:`size-4`}),` `,I(`run.back`)]}):(0,H.jsx)(`span`,{}),i]})}function $p(){let e=au(),[t,r]=(0,V.useState)(!1),i=e!==`off`;return(0,H.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":i,disabled:t,onClick:async()=>{i?cu():(r(!0),await su(),r(!1))},className:n(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] ring-1 transition`,i?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ink-4`),children:[i?(0,H.jsx)(na,{className:`size-4 text-ember-strong`}):(0,H.jsx)(ia,{className:`size-4`}),I(i?`notify.on`:`notify.ask`)]}),(0,H.jsx)(`p`,{className:`max-w-xs text-[0.75rem] text-ink-4 leading-relaxed`,children:I(e===`off`?`notify.why`:e===`on`?`notify.onHint`:ou()?`notify.blocked`:`notify.quiet`)})]})}function em(e,t,n){if(t?.kind===`credits`)return I(`run.waitsCredits`);if(t?.kind===`sign_in`)return I(n&&`admin`in n?`run.waitsAdminSignIn`:`run.waitsSignIn`,{service:t.service});if(!e)return I(`run.goesOnSoon`);let r=new Date(e),i=ge();return I(t?.kind===`retry`?`run.retryAt`:`run.goesOn`,{date:new Intl.DateTimeFormat(i,{weekday:`long`,day:`numeric`,month:`long`}).format(r),time:new Intl.DateTimeFormat(i,{hour:`numeric`,minute:`2-digit`}).format(r)})}function tm({view:e}){if(e.status!==`waiting_input`||!e.wakeAt)return null;let t=ge(),n=new Date(e.wakeAt);return(0,H.jsx)(`p`,{className:`mt-4 text-[0.8125rem] text-ink-3`,children:I(`run.answerBy`,{date:new Intl.DateTimeFormat(t,{weekday:`long`,day:`numeric`,month:`long`}).format(n),time:new Intl.DateTimeFormat(t,{hour:`numeric`,minute:`2-digit`}).format(n)})})}function nm(e,t){let n=e?I(`run.waitsSignalFrom`,{who:e}):I(`run.waitsSignal`);if(!t)return n;let r=new Intl.DateTimeFormat(ge(),{weekday:`long`,day:`numeric`,month:`long`}).format(new Date(t));return I(`run.waitsAtMost`,{waits:n,date:r})}function rm({view:e,compact:t}){let{Mascot:n}=Ml();return(0,H.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-6 text-center`,children:[(0,H.jsx)(n,{kind:e.wizard.avatar,costume:e.wizard.costume,size:t?130:170}),(0,H.jsx)(`h2`,{className:`wizard-heading mt-4 font-display font-semibold text-[1.375rem] tracking-tight`,children:e.status===`waiting_signal`?nm(e.waitsFor,e.wakeAt):em(e.wakeAt,e.pause,e.signIn)}),e.signIn&&`connection`in e.signIn?(0,H.jsx)(`div`,{className:`mt-5 w-full max-w-md`,children:(0,H.jsx)(Pd,{view:e,center:!0})}):null,(0,H.jsx)(`p`,{className:`mt-4 text-[0.9375rem] text-ink-3`,children:I(`run.leavePage`)})]})}function im({view:e,compact:t}){let{Mascot:n}=Ml();return(0,H.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-6 text-center`,children:[(0,H.jsx)(n,{kind:e.wizard.avatar,costume:e.wizard.costume,size:t?130:170}),(0,H.jsx)(`div`,{className:`mt-6 w-full max-w-md`,children:(0,H.jsx)(Ld,{view:e,center:!0})})]})}function am({view:e,run:t,compact:n}){let{Mascot:r}=Ml(),[i,a]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-6 text-center`,children:[(0,H.jsx)(r,{kind:e.wizard.avatar,costume:e.wizard.costume,size:n?130:170}),(0,H.jsx)(`h2`,{className:`wizard-heading mt-4 font-display font-semibold text-[1.375rem] tracking-tight`,children:I(e.answeredBy===`team`?`run.answeredByTeam`:`run.answeredByOther`)}),(0,H.jsx)(`p`,{className:`mt-2 text-[0.9375rem] text-ink-3`,children:I(`run.leavePage`)}),e.canWithdraw&&t.withdraw?i?(0,H.jsxs)(`div`,{className:`mt-4 flex flex-col items-center gap-2`,children:[(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:I(`run.withdrawAsk`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(_,{variant:`ghost`,onClick:()=>a(!1),children:I(`common.cancel`)}),(0,H.jsx)(_,{variant:`danger`,disabled:t.busy,onClick:()=>void t.withdraw?.(),children:I(`run.withdraw`)})]})]}):(0,H.jsx)(_,{variant:`ghost`,className:`mt-4`,onClick:()=>a(!0),children:I(`run.withdraw`)}):null]})}function om({view:e,compact:t,awake:r}){let i=(0,V.useMemo)(()=>{let t=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id);return t?new Date(t.at).getTime():Date.now()},[e.events,e.step?.id]),[a,o]=(0,V.useState)(Date.now());(0,V.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[]);let s=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id)?.message??e.step?.title??I(`run.working`),c=e.events.filter(e=>(e.type===`tool`||e.type===`info`)&&new Date(e.at).getTime()>=i-500),l=c.slice(-4),{Mascot:u}=Ml(),d=[...new Set(c.map(e=>e.asset).filter(e=>!!e))],f=[...c].reverse().find(e=>e.asset)?.asset;return(0,H.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-6 text-center`,children:[(0,H.jsx)(u,{kind:e.wizard.avatar,costume:e.wizard.costume,size:t?130:170,fluffy:!0}),(0,H.jsx)(`h2`,{className:`wizard-heading mt-4 font-display font-semibold text-[1.375rem] tracking-tight`,children:s}),(0,H.jsx)(`div`,{className:`mt-1 text-[0.8125rem] text-ink-4 tabular-nums`,children:I(`run.elapsed`,{s:Math.max(0,Math.round((a-i)/1e3))})}),d.length?(0,H.jsx)(`div`,{className:`mt-5 flex max-w-full flex-wrap justify-center gap-2`,children:d.slice(-8).map(t=>(0,H.jsx)(`img`,{src:Nl(`${Q(e.id)}/assets/${t}`),alt:``,className:n(`size-16 animate-rise rounded-lg bg-paper-2 object-cover ring-1 ring-border-soft transition sm:size-20`,t===f?`ring-2 ring-ember`:`opacity-70`)},t))}):null,(0,H.jsx)(`div`,{className:`mt-6 flex min-h-[7rem] w-full max-w-sm flex-col gap-1.5`,children:l.map((e,t)=>(0,H.jsxs)(`div`,{className:n(`flex items-center justify-center gap-2 text-[0.8125rem] transition-opacity`,t===l.length-1?`text-ink-2`:`text-ink-4`),children:[t===l.length-1?(0,H.jsx)(zo,{className:`size-3.5 animate-breathe text-ember`}):null,(0,H.jsx)(`span`,{className:`truncate`,children:ue(e)})]},e.id))}),t?null:(0,H.jsx)($p,{}),r?(0,H.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-4`,children:I(`run.awake`)}):null]})}function sm({view:e,compact:t}){let{Mascot:n}=Ml(),r=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id),i=r?new Date(r.at).getTime()-500:0,a=e.events.filter(t=>(t.type===`tool`||t.type===`info`)&&t.stepId===e.step?.id&&new Date(t.at).getTime()>=i&&t.note?.code!==`turnAsked`).slice(-3);return(0,H.jsxs)(`div`,{className:`mb-8 flex animate-rise flex-col items-center text-center`,children:[(0,H.jsx)(n,{kind:e.wizard.avatar,costume:e.wizard.costume,size:t?90:110,fluffy:!0}),(0,H.jsx)(`h2`,{className:`wizard-heading mt-2 font-display font-semibold text-[1.25rem] tracking-tight`,children:e.step?.title}),a.length?(0,H.jsx)(`div`,{className:`mt-3 flex w-full max-w-sm flex-col gap-1`,children:a.map(e=>(0,H.jsx)(`div`,{className:`truncate text-[0.8125rem] text-ink-4`,children:ue(e)},e.id))}):null]})}function cm(e){let t=(0,V.useRef)({running:!1,since:0,ask:null});(0,V.useEffect)(()=>{if(!e)return;let n=t.current,r=e.status===`running`,i=r?n.running?n.since:Date.now():0,a=t=>{document.visibilityState!==`visible`&&!document.title.startsWith(`● `)&&(document.title=`● ${document.title}`),uu({title:e.wizard.title,body:t,tag:e.id})};r&&e.ask&&e.ask.id!==n.ask?a(I(`notify.needsYou`)):!r&&n.running&&e.status!==`sleeping`&&e.status!==`waiting_signal`&&Date.now()-n.since>8e3&&a(e.status===`failed`?I(`run.failed`):e.status===`done`?I(`notify.done`):I(`notify.next`)),t.current={running:r,since:i,ask:e.ask?.id??null}},[e]),(0,V.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&document.title.startsWith(`● `)&&(document.title=document.title.slice(2))};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[])}function lm({view:e,run:t,step:r,studio:i}){let[a,o]=(0,V.useState)({}),[c,l]=(0,V.useState)({}),[u,d]=(0,V.useState)(``),[p,m]=(0,V.useState)(``),h=e.shown.filter(e=>e.output),[g,v]=(0,V.useState)(h.length===1?h[0].step.id:null),[y,b]=(0,V.useState)({}),x=(0,V.useRef)(null),S=h.find(e=>e.step.id===g),C=S?.step.type===`generate`&&(S.output?.assets?.length??0)>1,w=()=>{S&&u.trim()&&t.regenerate(r.id,S.step.id,u.trim(),y[S.step.id])};return(0,H.jsxs)(`div`,{className:`animate-rise`,children:[(0,H.jsx)(Kp,{title:r.title,description:r.description}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.shown.filter(e=>e.kept).map(({step:e,label:t})=>(0,H.jsx)(mm,{title:t??e.title},e.id)),e.shown.filter(e=>e.output).map(({step:t,output:n})=>{let s=Zu(t),u=!!r.edit&&(t.type===`agent`&&t.output.format!==`json`||!!s),d=a[t.id],f=e=>(0,H.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,H.jsx)(`h3`,{className:`font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.06em]`,children:t.title}),(0,H.jsxs)(`div`,{className:`flex items-center`,children:[u&&!c[t.id]?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>({...e,[t.id]:!0})),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent hover:text-ink coarse:h-11`,children:[(0,H.jsx)(xo,{className:`size-3.5`}),` `,I(`run.edit`)]}):null,e]})]}),p=s&&n&&u&&c[t.id]?(0,H.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-card ring-1 ring-border-soft`,children:(0,H.jsx)(qu,{shape:Ce(s),value:d&&typeof d==`object`?d:n.json??{},onChange:e=>o(n=>({...n,[t.id]:e})),start:`edit`})}):(0,H.jsx)(Lp,{base:`${Q(e.id)}`,step:t,output:n,onView:Gp(e.id,t.id),editable:u&&c[t.id]&&!s,draft:typeof d==`string`?d:void 0,onDraft:e=>o(n=>({...n,[t.id]:e})),picked:y[t.id],onPick:r.regenerate?e=>{v(t.id),b(n=>{let r=n[t.id]??[];return{...n,[t.id]:r.includes(e)?r.filter(t=>t!==e):[...r,e]}}),x.current?.focus()}:void 0,onSurfaceAction:r.regenerate?()=>{v(t.id),x.current?.focus()}:void 0});return(0,H.jsx)(`section`,{children:i&&s&&n?(0,H.jsx)(Qu,{runId:e.id,step:s,output:n,header:f,children:p}):(0,H.jsxs)(H.Fragment,{children:[f(null),p]})},t.id)}),e.lists.map(t=>(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`mb-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.06em]`,children:t.def.title}),t.def.check?(0,H.jsx)(Wd,{runId:e.id,list:t}):(0,H.jsx)(Vd,{runId:e.id,list:t,editable:!0})]},t.def.id)),r.regenerate&&h.length?(0,H.jsxs)(f,{className:`p-3`,children:[h.length>1?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 pb-2`,children:[(0,H.jsx)(`span`,{className:`mr-1 text-[0.8125rem] text-ink-3`,children:I(`run.feedbackTarget`)}),h.map(({step:e})=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":g===e.id,onClick:()=>{v(e.id),x.current?.focus()},className:n(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,g===e.id?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:e.title},e.id))]}):null,(0,H.jsx)(s,{ref:x,minRows:2,maxRows:8,value:u,placeholder:I(`run.feedbackPlaceholder`),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),w())},className:`border-0 bg-transparent shadow-none focus:ring-0`}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1 pt-1`,children:[(0,H.jsx)(`span`,{className:`min-w-0 text-[0.75rem] text-ink-3`,children:C?y[S.step.id]?.length?I(`run.regeneratePicked`,{n:[...y[S.step.id]].sort((e,t)=>e-t).map(e=>e+1).join(`, `)}):I(`run.regenerateAll`):!S&&u.trim()?I(`run.feedbackPick`):null}),(0,H.jsxs)(_,{size:`sm`,variant:`secondary`,busy:t.busy,disabled:!u.trim()||!S,onClick:w,children:[(0,H.jsx)(To,{className:`size-3.5`}),` `,I(`run.regenerateGo`)]})]})]}):null]}),r.approve?(0,H.jsx)(s,{minRows:2,maxRows:6,value:p,placeholder:I(`run.decisionNote`),onChange:e=>m(e.target.value),className:`mt-4`}):null,(0,H.jsx)(tm,{view:e}),(0,H.jsxs)(Qp,{view:e,run:t,sticky:!0,children:[r.approve?(0,H.jsx)(_,{size:`lg`,variant:`secondary`,busy:t.busy,onClick:()=>void t.decline(r.id,p.trim()||void 0),children:I(`run.decline`)}):null,(0,H.jsxs)(_,{size:`lg`,busy:t.busy,onClick:()=>void t.accept(r.id,Object.keys(a).length?a:void 0,p.trim()||void 0),children:[I(r.approve?`run.approve`:`run.accept`),` `,(0,H.jsx)(Xi,{className:`size-4`})]})]})]})}function um({view:e,run:t,step:n,onRestart:r,studio:i}){let a=e.shown.filter(e=>e.output),{Mascot:o,ShareResultButton:s,RunEnd:c}=Ml();return(0,H.jsxs)(`div`,{className:`animate-rise`,children:[(0,H.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-x-4 gap-y-5`,children:[(0,H.jsx)(o,{kind:e.wizard.avatar,costume:e.wizard.costume,size:64}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-[12rem]`,children:[(0,H.jsx)(`h1`,{className:`wizard-title text-balance font-display font-semibold text-[1.75rem] leading-tight tracking-tight sm:text-[2rem]`,children:n.title}),n.message?(0,H.jsx)(`p`,{className:`mt-1 text-[0.9375rem] text-ink-3`,children:n.message}):null]}),s&&e.shown.some(e=>e.output)?(0,H.jsx)(`div`,{className:`max-sm:basis-full`,children:(0,H.jsx)(s,{view:e,title:`${n.title} · ${e.wizard.title}`})}):null]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.shown.filter(e=>e.kept).map(({step:e,label:t})=>(0,H.jsx)(mm,{title:t??e.title},e.id)),a.map(({step:n,output:r,formats:a,label:o})=>{let s=Zu(n),c=t=>(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem]`,children:o??n.title}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(Up,{base:`${Q(e.id)}`,stepId:n.id,formats:a,title:o??n.title,step:n,output:r??void 0,foot:`${e.wizard.title} · ${new Date().toLocaleDateString(Ml().lang)}`}),t]})]}),l=(0,H.jsx)(fm,{view:e,run:t,step:n,output:r,onView:Gp(e.id,n.id)});return(0,H.jsxs)(f,{className:`p-4 sm:p-5`,children:[i&&s&&r?(0,H.jsx)(Qu,{runId:e.id,step:s,output:r,header:c,children:l}):(0,H.jsxs)(H.Fragment,{children:[c(null),l]}),r?.assets?.some(e=>e.ai)?(0,H.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-3 leading-relaxed`,children:I(`ai.publish`)}):null]},n.id)}),e.lists.map(t=>(0,H.jsxs)(f,{className:`p-4 sm:p-5`,children:[(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem]`,children:t.label??t.def.title}),(0,H.jsx)(Kd,{runId:e.id,list:t})]}),(0,H.jsx)(Vd,{runId:e.id,list:t,editable:!0})]},t.def.id))]}),c&&!i?(0,H.jsx)(c,{view:e}):null,(0,H.jsx)(Qp,{view:e,run:t,children:r?(0,H.jsxs)(_,{variant:`secondary`,onClick:r,children:[(0,H.jsx)(Do,{className:`size-4`}),` `,I(`run.again`)]}):(0,H.jsx)(`span`,{})})]})}function dm({view:e,run:t}){let{Mascot:n,RunEnd:r}=Ml();return(0,H.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-8 text-center`,children:[(0,H.jsx)(n,{kind:e.wizard.avatar,costume:e.wizard.costume,size:90}),(0,H.jsx)(`h2`,{className:`wizard-heading mt-4 font-display font-semibold text-[1.375rem]`,children:I(`run.failed`)}),(0,H.jsx)(`p`,{className:`mt-2 max-w-md text-[0.9375rem] text-ink-3`,children:(0,H.jsx)(u,{text:e.error??``})}),(0,H.jsxs)(`div`,{className:`mt-8 flex gap-3`,children:[e.canBack?(0,H.jsxs)(_,{variant:`ghost`,onClick:()=>void t.back(),children:[(0,H.jsx)(Ji,{className:`size-4`}),` `,I(`run.back`)]}):null,(0,H.jsxs)(_,{onClick:()=>void t.retry(),busy:t.busy,children:[(0,H.jsx)(Do,{className:`size-4`}),` `,I(`run.retry`)]})]}),r?(0,H.jsx)(r,{view:e,failed:!0}):null]})}function fm({view:e,run:t,step:n,output:r,onView:i}){let[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),l=Q(e.id),u=e.translation?.results[n.id];if(!(e.translation&&r?.text&&t.translateResult))return(0,H.jsx)(Lp,{base:l,step:n,output:r,onView:i});let d=u&&!a?{...r,text:u}:r;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Lp,{base:l,step:n,output:d,onView:i}),(0,H.jsx)(`div`,{className:`mt-3 flex items-center gap-3 text-[0.8125rem] text-ink-3`,children:u?(0,H.jsxs)(H.Fragment,{children:[a?null:(0,H.jsx)(`span`,{children:I(`translation.machine`)}),(0,H.jsx)(`button`,{type:`button`,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,onClick:()=>o(e=>!e),children:I(a?`translation.showTranslated`:`translation.showOriginal`)})]}):(0,H.jsxs)(_,{size:`sm`,variant:`secondary`,busy:s,onClick:async()=>{c(!0),await t.translateResult?.(n.id),c(!1)},children:[(0,H.jsx)(Ka,{className:`size-4`}),` `,I(s?`translation.working`:`result.translate`)]})})]})}function pm({run:e,compact:t,onRestart:r,onView:i,stickyProgress:a,studio:s}){let{view:c}=e;me(c?.translation?.labels),(0,V.useEffect)(()=>{i?.(c)},[c,i]),Yl();let l=Xl(c?.status===`running`&&!c.ask);if(cm(c),e.notFound)return(0,H.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:I(`run.notFound`)});if(!c)return(0,H.jsx)(`div`,{className:`flex justify-center py-24 text-ink-4`,children:(0,H.jsx)(o,{})});let u=c.step,d=null;if(c.answeredBy)d=(0,H.jsx)(am,{view:c,run:e,compact:t});else if(c.connect?.length&&(c.status===`waiting_input`||c.status===`sleeping`))d=(0,H.jsx)(im,{view:c,compact:t});else if(c.status===`running`&&c.ask)d=(0,H.jsx)(Wl,{runId:c.id,ask:c.ask},c.ask.id);else if(c.status===`waiting_input`&&c.question)d=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(sm,{view:c,compact:t}),(0,H.jsx)(Ul,{runId:c.id,question:c.question},c.question)]});else if(c.status===`running`)d=(0,H.jsx)(om,{view:c,compact:t,awake:l});else if(c.status===`sleeping`||c.status===`waiting_signal`)d=(0,H.jsx)(rm,{view:c,compact:t});else if(c.status===`failed`)d=(0,H.jsx)(dm,{view:c,run:e});else if(c.status===`cancelled`)d=(0,H.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:I(`run.cancelled`)});else if(u?.type===`form`)d=(0,H.jsx)(Zp,{view:c,run:e,step:u},u.id);else if(u?.type===`review`){let t=c.shown.map(e=>e.output?.at??``).join(`|`);d=(0,H.jsx)(lm,{view:c,run:e,step:u,studio:s},`${u.id}:${t}`)}else u?.type===`result`&&(d=(0,H.jsx)(um,{view:c,run:e,step:u,onRestart:r,studio:s}));let f=u?.type===`review`&&c.status===`waiting_input`&&c.lists.some(e=>e.def.check);return(0,H.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[a?(0,H.jsx)(`div`,{className:`sticky top-0 z-10`,children:(0,H.jsx)(Wp,{view:c})}):(0,H.jsx)(Wp,{view:c}),(0,H.jsxs)(`div`,{className:n(`safe-x kb-tight mx-auto w-full flex-1`,f?`max-w-[1240px] py-8`:t?`max-w-[620px] py-8`:`max-w-[640px] py-8 sm:py-16`),children:[d,e.error&&c.status!==`failed`?(0,H.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:e.error}):null,c.keeps&&c.status!==`running`?(0,H.jsx)(`div`,{className:`mt-10 flex justify-center`,children:(0,H.jsx)(Jd,{runId:c.id})}):null]})]})}function mm({title:e}){return(0,H.jsxs)(f,{className:`p-4 sm:p-5`,children:[(0,H.jsx)(`h3`,{className:`mb-2 font-display font-semibold text-[1.0625rem]`,children:e}),(0,H.jsx)(`p`,{className:`text-[0.9375rem] text-ink-3 leading-relaxed`,children:ye(Se(`resultKeptInSpace`))})]})}function hm(){if(typeof window>`u`)return null;let e=window.engentyApp;return e&&typeof e.call==`function`&&Array.isArray(e.can)?e:null}var gm=hm(),_m=gm!==null||typeof window<`u`&&new URLSearchParams(window.location.search).get(`app`)===`1`;_m&&typeof document<`u`&&document.documentElement.classList.add(`in-app`);var vm=e=>gm?.can.includes(e)===!0;function ym(e,t){return gm&&vm(e)?gm.call(e,t):Promise.reject(Error(`the app cannot ${e}`))}function bm(e,t){vm(e)&&ym(e,t).catch(()=>void 0)}function xm(e,t,n){return vm(`download`)?(e.preventDefault(),ym(`download`,{url:new URL(t,window.location.href).href,filename:n}).catch(()=>void 0),!0):!1}var Sm=e=>`engenty-wizards://w?url=${encodeURIComponent(e)}`,Cm=``.replace(/\/+$/,``),wm=`${Cm}/studio`,Tm=new Set([``,`new`,`wizards`,`edit`,`space`,`skills`,`capabilities`,`work`,`shared`,`settings`,`account`,`setup`,`start`,`sign-in`]),Em=wm;function Dm(e){Em=e}var Om=(()=>{if(typeof window>`u`)return null;let e=new URL(window.location.href),t=/\/w\/[^/]+\/([^/]+)/.exec(e.pathname)?.[1];if(!t)return null;let n=`wizards.ticket.${t}`,r=e.searchParams.get(`rt`);r&&(e.searchParams.delete(`rt`),window.history.replaceState(window.history.state,``,e));let i=r;try{r?sessionStorage.setItem(n,r):i=sessionStorage.getItem(n)}catch{}return i?{path:`/api/runs/${t}`,ticket:i}:null})(),km=null;function Am(e){km=e?e.replace(/\/+$/,``):null}function jm(){return km??`${window.location.origin}${Cm}`}function Mm(e){if(Om&&(e===Om.path||e.startsWith(`${Om.path}/`))){let t=`${e}${e.includes(`?`)?`&`:`?`}rt=${encodeURIComponent(Om.ticket)}`;return Cm?`${Cm}${t}`:t}return!Cm||!e.startsWith(`/`)||e.startsWith(`//`)||e===Cm||e.startsWith(`${Cm}/`)?e:`${Cm}${e}`}function Nm(e){return`/studio/${e.replace(/^\/+/,``)}`}var Pm=100,Fm=[];function Im(e,t){let n=`${new Date().toISOString().slice(11,19)} ${e} ${String(t).slice(0,1500)}`;Fm.push(n),Fm.length>Pm&&Fm.shift()}var Lm=()=>[...Fm];function Rm(e){return e.replace(/[\w.+-]+@[\w-]+(\.[\w-]+)+/g,`[email]`).replace(/\b[A-Z]{2}\d{2}(?:\s?[A-Z0-9]{4}){2,7}(?:\s?[A-Z0-9]{1,4})?\b/g,`[number]`).replace(/(\?|&)([\w-]+)=[^&\s#"']+/g,`$1$2=…`).replace(/\+?\d[\d\s()/-]{7,}\d/g,`[number]`)}var zm=!1;function Bm(){if(!zm){zm=!0;for(let e of[`error`,`warn`]){let t=console[e].bind(console);console[e]=(...n)=>{Im(e,n.map(e=>e instanceof Error?`${e.message}`:typeof e==`string`?e:Vm(e)).join(` `)),t(...n)}}}}function Vm(e){try{return JSON.stringify(e)?.slice(0,500)??String(e)}catch{return String(e)}}var Hm=new Set,Um=0,Wm=20;function Gm(e,t,n){let r=String(t||``).slice(0,2e3);if(Im(e,r),!r||Um>=Wm||Hm.has(r))return;Hm.add(r),Um++;let i=JSON.stringify({level:e,message:r,stack:n?.slice(0,4e3),url:window.location.href.slice(0,500),agent:navigator.userAgent.slice(0,300)});fetch(Mm(`/api/log`),{method:`POST`,headers:{"content-type":`application/json`},body:i,keepalive:!0,credentials:`include`}).catch(()=>void 0)}function Km(){window.addEventListener(`error`,e=>{let t=e.error;Gm(`error`,e.message||String(e.error),t?.stack)}),window.addEventListener(`unhandledrejection`,e=>{let t=e.reason;Gm(`error`,t?.message??String(e.reason),t?.stack)})}var qm={"x-wizards-client":_m?`app`:`web`},Jm=Ol(Mm,qm,e=>Gm(`error`,e));async function Ym(e,t,n,r){let i=await fetch(Mm(e),{method:`POST`,credentials:`include`,headers:{...qm,"content-type":`application/json`,"accept-language":ve},body:JSON.stringify(t),signal:r});if(!i.ok||!i.body){let e=Dl(await i.text());throw new Tl(e?.error??i.statusText,i.status,e)}let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{done:e,value:t}=await a.read();if(e)break;s+=o.decode(t,{stream:!0});let r=s.indexOf(`
|
|
10
|
+
|
|
11
|
+
`);for(;r!==-1;){let e=s.slice(0,r);s=s.slice(r+2);let t=`message`,i=[];for(let n of e.split(`
|
|
12
|
+
`))n.startsWith(`event:`)?t=n.slice(6).trim():n.startsWith(`data:`)&&i.push(n.slice(5).replace(/^ /,``));n(t,i.join(`
|
|
13
|
+
`)),r=s.indexOf(`
|
|
14
|
+
|
|
15
|
+
`)}}}var Xm={spaces:()=>[`spaces`],wizards:e=>[`wizards`,e],spaceWizards:e=>[`space-wizards`,e],wizard:e=>[`wizard`,e],translations:e=>[`wizard-translations`,e],page:e=>[`space-page`,e],table:e=>[`space-table`,e],spaceData:e=>[`space-data`,e],knowledge:e=>[`knowledge`,e],knowledgeValues:()=>[`knowledge-value`],skills:e=>[`skills`,e],skill:e=>[`skill`,e],files:e=>[`space-files`,e],fileText:e=>[`space-file-text`,e],connectors:e=>[`connectors`,e],themes:e=>[`themes`,e],cloudSync:()=>[`cloud-sync`],presence:(e,t)=>[`presence`,e,t],presentItems:e=>[`presence-all`,e]},Zm=e=>Xm.files(e);function Qm(e){return Wt({queryKey:Zm(e),queryFn:()=>Jm.get(`/api/studio/spaces/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function $m(e,t){return Mm(`/api/studio/spaces/${e}/files/${t}/content`)}function eh(e,t){return Mm(`/api/studio/spaces/${e}/files/${t}/thumb`)}function th(e,t){return Mm(`/api/studio/spaces/${e}/mount-files/${t}/content`)}function nh(e,t){return Mm(`/api/studio/spaces/${e}/mount-files/${t}/thumb`)}function rh(e,t=!1){let n=Oe(),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),s=()=>n.invalidateQueries({queryKey:Zm(e)}),c=async e=>{o(null);try{await e()}catch(e){o(e.message)}finally{await s()}};return{busy:r,error:a,readOnly:t,upload:async(t,n,r)=>{i(!0);let a=[],o=r?`&parent=${encodeURIComponent(r)}`:``;return await c(async()=>{for(let r of n)a.push(await Jm.upload(`/api/studio/spaces/${e}/files?kind=${t}${o}`,r)),await s()}),i(!1),a},fromUrl:async(t,n)=>{let r=await Jm.post(`/api/studio/spaces/${e}/files/url`,{kind:t,url:n});return r.file&&await s(),r},describe:(t,n)=>c(()=>Jm.patch(`/api/studio/spaces/${e}/files/${t}`,{description:n})),remove:t=>c(()=>Jm.del(`/api/studio/spaces/${e}/files/${t}`)),reindex:t=>c(()=>Jm.post(`/api/studio/spaces/${e}/files/${t}/reindex`)),order:(t,n)=>c(()=>Jm.put(`/api/studio/spaces/${e}/files/order`,{kind:t,ids:n}))}}function ih(e,t){let n=`wz.layout.${e}`,[r,i]=(0,V.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function ah(e,t,n=700){let[r,i]=(0,V.useState)(`idle`),[a,o]=(0,V.useState)(null),s=JSON.stringify(e),c=(0,V.useRef)(s),l=(0,V.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,V.useRef)(Promise.resolve()),d=(0,V.useRef)(0),f=(0,V.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),d.current+=1,u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}finally{--d.current}}))},[]);return(0,V.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(f,n);return()=>clearTimeout(e)},[s,n,f]),(0,V.useEffect)(()=>f,[f]),{state:r,error:a,markSaved:(0,V.useCallback)(e=>{c.current=JSON.stringify(e)},[]),saveNow:(0,V.useCallback)(()=>{c.current=``,f()},[f]),pending:(0,V.useCallback)(()=>l.current.json!==c.current||d.current>0,[])}}var oh=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],sh=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,ch=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,lh=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,uh=/^(https?:\/\/|www\.)\S+$/i,dh=/^\+?[\d\s()/.-]{7,20}$/,fh=/^(ja|nein|yes|no|true|false)$/i;function ph(e){let t=e.trim();return t?t.includes(`
|
|
16
|
+
`)||t.length>140?`longtext`:fh.test(t)?`boolean`:lh.test(t)?`email`:uh.test(t)?`url`:sh.test(t)?`date`:ch.test(t)&&!/^(\+|0\d)/.test(t)?`number`:dh.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function mh(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var hh=[`adresse`,`plz`,`ort`,`uid`,`telefon`,`e_mail`,`website`,`iban`],gh={slug:48,title:80,headline:160,intro:600},_h=/^[a-z0-9](?:[a-z0-9-]{0,46}[a-z0-9])?$/;function vh(e){return e.toLowerCase().replace(/['’]/g,``).replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,gh.slug).replace(/-+$/,``)}var yh=[`linear`,`radial`,`conic`];function bh(e){let t=[...e.stops].sort((e,t)=>e.at-t.at).map(e=>`${e.color} ${Math.round(e.at)}%`).join(`, `);return e.type===`radial`?`radial-gradient(circle at center, ${t})`:e.type===`conic`?`conic-gradient(from ${Math.round(e.angle)}deg at center, ${t})`:`linear-gradient(${Math.round(e.angle)}deg, ${t})`}var xh={top:0,"top right":45,right:90,"bottom right":135,bottom:180,"bottom left":225,left:270,"top left":315};function Sh(e){let t=e.trim().match(/^(repeating-)?(linear|radial|conic)-gradient\(\s*([\s\S]*)\)\s*;?$/i);if(!t)return null;let n=t[2].toLowerCase(),r=t[3].split(/,(?![^(]*\))/).map(e=>e.trim()),i=n===`linear`?180:0,a=r[0]??``;if(!/^#|^rgb|^hsl|^oklch/i.test(a)){r.shift();let e=a.match(/(-?[\d.]+)deg/),t=a.match(/^to\s+(.+)$/i)?.[1].toLowerCase();e?i=Number(e[1]):t&&t in xh&&(i=xh[t])}let o=r.map(e=>e.match(/^(#[0-9a-f]{3,8})\b\s*(-?[\d.]+%)?/i)).filter(e=>!!e).map((e,t,n)=>({color:e[1].toLowerCase(),at:e[2]?Number.parseFloat(e[2]):n.length>1?t/(n.length-1)*100:0}));return o.length>=2?{type:n,angle:(i%360+360)%360,stops:o}:null}function Ch(e,t){let n=new Set(t?.flatMap(e=>e.logos));return e.find(e=>!n.has(e.id))??e[0]}var wh=[`bullet`,`do`,`dont`,`question`,`important`,`number`],Th=[`web`,`documents`,`print`,`images`,`video`],Eh=/\.(woff2?|ttf|otf)$/i;function Dh(e){let t=e.family.trim();if(!(t&&e.source))return null;if(`file`in e.source)return{family:t,url:`/api/public/fonts/${e.source.file}`,stylesheet:!1};let n=URL.canParse(e.source.url)?new URL(e.source.url).pathname:``;return{family:t,url:e.source.url,stylesheet:!Eh.test(n)}}function Oh(e){let t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e.trim());return t?[Number.parseInt(t[1],16),Number.parseInt(t[2],16),Number.parseInt(t[3],16)]:null}function kh(e){let t=Oh(e);if(!t)return 1;let[n,r,i]=t.map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return .2126*n+.7152*r+.0722*i}var Ah=[300,400,500,600,700,800],jh={facts:100,colors:32,fonts:6,textStyles:16,logoSections:8,logoRules:16,voiceBlocks:12,voiceText:2e3,links:20,files:{logo:24,asset:100,document:2e3,pattern:24,picture:2e4},gradients:24,bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7,pattern:1e7,picture:8e6}};function Mh({id:e,children:t}){return(0,H.jsx)(`div`,{id:e,"data-assist":e,className:`scroll-mt-6 max-md:scroll-mt-20`,children:t})}function Nh({title:e,onTitle:t,hint:r,save:i,action:a,tabs:s,locked:c,plain:l,page:u,children:d}){return(0,H.jsxs)(`section`,{"data-assist-section":e,className:n(`flex flex-col`,a?`gap-6`:`gap-2.5`),children:[(0,H.jsxs)(`div`,{className:`group/head flex items-start justify-between gap-4 px-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`h2`,{className:n(`min-w-0 font-display font-semibold leading-tight`,u?`text-[1.75rem] tracking-tight`:`text-lg`),children:t?(0,H.jsx)(Jh,{value:e,onSave:t}):e}),i?.state===`saving`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,H.jsx)(o,{className:`size-3`}),` `,z(`space.saving`)]}):i?.state===`saved`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-moss`,children:[(0,H.jsx)(A,{className:`size-3.5`}),` `,z(`settings.saved`)]}):null]}),r?(0,H.jsx)(`div`,{className:n(`mt-1 text-ink-3 leading-snug`,u?`text-[0.8125rem]`:`text-[0.875rem]`),children:r}):null]}),a?(0,H.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),s,l?d:(0,H.jsxs)(f,{className:`p-3.5 sm:p-5`,children:[c?(0,H.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:d}):d,i?.state===`error`&&i.error?(0,H.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:i.error}):null]})]})}function Ph({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(jo,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,H.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-full border border-input bg-card pr-3 pl-9 text-[0.875rem] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,H.jsx)(o,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function Fh({onFiles:e,accept:t,multiple:r=!0,className:i,children:a}){return(0,H.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let n=Array.from(t.dataTransfer.files);n.length&&e(r?n:n.slice(0,1))},className:n(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[0.875rem] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,i),children:[a,(0,H.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:r,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}function Ih({value:e,onChange:t,placeholder:r,maxLength:i,className:a,autoFocus:o,label:s,onEnter:c,fit:l}){let u=(0,H.jsx)(`input`,{value:e,size:l?1:void 0,"aria-label":s,placeholder:r,maxLength:i,autoFocus:o,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c&&(e.preventDefault(),c())},className:n(`-mx-1 block w-[calc(100%+0.5rem)] rounded-md bg-transparent px-1 py-0.5 outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`,l&&`col-start-1 row-start-1 min-w-0`,a)});return l?(0,H.jsxs)(`span`,{className:`inline-grid min-w-0 max-w-full`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:n(`invisible col-start-1 row-start-1 overflow-hidden whitespace-pre`,a),children:e||r}),u]}):u}function Lh(){let[e,t]=(0,V.useState)(!1),n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t(!1)},i=e=>e.key===`Escape`&&t(!1);return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function Rh({entries:e}){let{open:t,setOpen:n,ref:r}=Lh();return(0,H.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,H.jsxs)(_,{variant:`secondary`,size:`sm`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,H.jsx)(w,{className:`size-4`}),` `,z(`space.add`)]}),t?(0,H.jsx)(`div`,{role:`menu`,className:`absolute top-10 right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n(!1),e.onPick()},className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink`,children:[e.icon,e.label]},e.label))}):null]})}var zh=()=>Math.random().toString(36).slice(2,10);function Bh({options:e,value:t,onChange:r,className:i}){return(0,H.jsxs)(`label`,{title:z(`space.sectionMove`),className:n(`relative inline-flex size-8 shrink-0 items-center justify-center rounded-full text-ink-3 transition hover:text-ink coarse:size-11`,i),children:[(0,H.jsx)(Ba,{className:`size-4`}),(0,H.jsx)(`select`,{"aria-label":z(`space.sectionMove`),value:t,onChange:e=>r(e.target.value),className:`absolute inset-0 cursor-pointer opacity-0`,children:e.map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})}function Vh(e){let[t,n]=(0,V.useState)(()=>e.map(e=>({id:zh(),text:e.text,mark:e.mark??`bullet`}))),[r,i]=(0,V.useState)(null);return{rows:t,setRows:n,focus:r,add:(e=t.length-1)=>{if(t.length>=jh.logoRules)return;let r=zh();i(r);let a=t[e]?.mark??`bullet`;n(t=>[...t.slice(0,e+1),{id:r,text:``,mark:a},...t.slice(e+1)])},rules:t.map(({text:e,mark:t})=>t===`bullet`?{text:e}:{text:e,mark:t}),full:t.length>=jh.logoRules}}var Hh={bullet:`space.markBullet`,do:`space.markDo`,dont:`space.markDont`,question:`space.markQuestion`,important:`space.markImportant`,number:`space.markNumber`};function Uh({mark:e,n:t}){let r=`grid size-5 place-items-center rounded-full font-semibold text-[0.6875rem]`;switch(e){case`do`:return(0,H.jsx)(`span`,{className:n(r,`bg-moss-tint text-moss`),children:(0,H.jsx)(A,{className:`size-3`,strokeWidth:3})});case`dont`:return(0,H.jsx)(`span`,{className:n(r,`bg-rose-tint text-rose`),children:(0,H.jsx)(E,{className:`size-3`,strokeWidth:3})});case`question`:return(0,H.jsx)(`span`,{className:n(r,`bg-amber-tint text-ink-2`),children:`?`});case`important`:return(0,H.jsx)(`span`,{className:n(r,`bg-ember-tint text-ember-strong`),children:`!`});case`number`:return(0,H.jsx)(`span`,{className:n(r,`bg-paper-2 text-ink-2 tabular-nums`),children:t});default:return(0,H.jsx)(`span`,{className:`grid size-5 place-items-center`,children:(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-ink-4`})})}}function Wh({mark:e,n:t,onChange:r}){let{open:i,setOpen:a,ref:o}=Lh();return(0,H.jsxs)(`div`,{className:`relative shrink-0`,ref:o,children:[(0,H.jsx)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-label":z(Hh[e]),title:z(Hh[e]),onClick:()=>a(e=>!e),className:`grid size-7 place-items-center rounded-full transition hover:bg-paper-2`,children:(0,H.jsx)(Uh,{mark:e,n:t})}),i?(0,H.jsx)(`div`,{role:`menu`,className:`absolute top-7 left-0 z-50 w-44 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:wh.map(t=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":t===e,onClick:()=>{r(t),a(!1)},className:n(`flex w-full items-center gap-3 rounded-lg px-2.5 py-1.5 text-left text-[0.875rem] hover:bg-accent hover:text-ink`,t===e?`text-ink`:`text-ink-2`),children:[(0,H.jsx)(`span`,{className:`grid size-5 place-items-center`,children:(0,H.jsx)(Uh,{mark:t,n:1})}),z(Hh[t])]},t))}):null]})}function Gh({rules:e,placeholder:t,readOnly:n}){if(!e.rows.length)return null;let r=t=>e.rows.slice(0,t+1).filter(e=>e.mark===`number`).length;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`font-medium text-[0.9375rem]`,children:z(`space.rules`)}),n?null:(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3 leading-snug`,children:z(`space.rulesHint`)}),(0,H.jsx)(`ul`,{className:`mt-2 flex flex-col`,children:e.rows.map((i,a)=>(0,H.jsx)(`li`,{className:`group/rule flex items-center gap-1.5 py-0.5`,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center`,children:(0,H.jsx)(Uh,{mark:i.mark,n:r(a)})}),(0,H.jsx)(`span`,{className:`py-0.5 text-[0.9375rem] text-ink`,children:i.text})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Wh,{mark:i.mark,n:r(a),onChange:t=>e.setRows(e=>e.map(e=>e.id===i.id?{...e,mark:t}:e))}),(0,H.jsx)(Ih,{value:i.text,label:z(`space.rules`),placeholder:t,maxLength:200,autoFocus:i.id===e.focus,onChange:t=>e.setRows(e=>e.map(e=>e.id===i.id?{...e,text:t}:e)),onEnter:()=>e.add(a),className:`text-[0.9375rem] text-ink`}),(0,H.jsx)(p,{label:z(`space.remove`),onClick:()=>e.setRows(e=>e.filter(e=>e.id!==i.id)),className:`size-7 opacity-0 transition focus:opacity-100 group-hover/rule:opacity-100 coarse:opacity-100 hover:text-rose`,children:(0,H.jsx)(O,{className:`size-3.5`})})]})},i.id))}),n||e.full?null:(0,H.jsx)(Kh,{label:z(`space.ruleNew`),onClick:()=>e.add(),className:`mt-1`})]})}function Kh({label:e,onClick:t,className:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:t,className:n(`inline-flex items-center gap-1.5 self-start rounded-full py-1 pr-2 text-[0.875rem] text-ink-3 transition hover:text-ink`,r),children:[(0,H.jsx)(`span`,{className:`grid size-7 place-items-center`,children:(0,H.jsx)(w,{className:`size-4`})}),e]})}function qh({title:e,description:t,titlePlaceholder:n,descriptionPlaceholder:r,kind:i,autoFocus:a,readOnly:o,onChange:s,onRemove:c}){let l=i?(0,H.jsx)(`span`,{role:`img`,"aria-label":i.label,title:i.label,className:`shrink-0 self-center text-ink-4 [&>svg]:size-4`,children:i.icon}):null;return(0,H.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,H.jsx)(`h3`,{className:`min-w-0 truncate font-medium text-[0.9375rem]`,children:e}),l]}),t?(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-3 leading-snug`,children:t}):null]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,H.jsx)(Ih,{fit:!!i,value:e,label:n,placeholder:n,maxLength:80,autoFocus:a,onChange:e=>s({title:e}),className:`font-medium text-[0.9375rem]`}),l]}),r===void 0?null:(0,H.jsx)(Ih,{value:t??``,label:r,placeholder:r,maxLength:400,onChange:e=>s({description:e}),className:`text-[0.875rem] text-ink-3`})]})}),o?null:(0,H.jsx)(p,{label:z(`space.sectionRemove`),onClick:c,className:`opacity-0 transition focus:opacity-100 group-hover/section:opacity-100 coarse:opacity-100 hover:text-rose`,children:(0,H.jsx)(O,{className:`size-4`})})]})}function Jh({value:e,onSave:t}){let[n,r]=(0,V.useState)(e);return(0,V.useEffect)(()=>r(e),[e]),(0,H.jsxs)(`span`,{className:`-ml-1 inline-grid max-w-full align-top`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1 truncate whitespace-pre px-1 pr-2`,children:n||` `}),(0,H.jsx)(`input`,{value:n,maxLength:200,"aria-label":z(`data.title`),onChange:e=>r(e.target.value),onBlur:()=>{let i=n.trim();i&&i!==e?t(i):r(e)},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(r(e),requestAnimationFrame(()=>t.target.blur()))},className:`col-start-1 row-start-1 w-full min-w-0 rounded-md bg-transparent px-1 outline-none transition hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring`})]})}var Yh=!1;function Xh(){if(!(typeof window>`u`||Yh))return window.SpeechRecognition??window.webkitSpeechRecognition}var Zh=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<`u`,Qh=`wizards.dictation`,$h=new Set,eg=(()=>{try{let e=JSON.parse(localStorage.getItem(Qh)??`{}`);return{deviceId:String(e.deviceId??``),hold:e.hold===!0}}catch{return{deviceId:``,hold:!1}}})();function tg(){return[(0,V.useSyncExternalStore)(e=>($h.add(e),()=>$h.delete(e)),()=>eg),(0,V.useCallback)(e=>{eg={...eg,...e};try{localStorage.setItem(Qh,JSON.stringify(eg))}catch{}for(let e of $h)e()},[])]}function ng(){let[e,t]=(0,V.useState)([]),n=(0,V.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await navigator.mediaDevices.enumerateDevices();t(e.filter(e=>e.kind===`audioinput`&&!!e.deviceId&&e.deviceId!=="default"&&e.deviceId!==`communications`).map(e=>({deviceId:e.deviceId,label:e.label})))},[]);return(0,V.useEffect)(()=>(n(),navigator.mediaDevices?.addEventListener?.(`devicechange`,n),()=>navigator.mediaDevices?.removeEventListener?.(`devicechange`,n)),[n]),{devices:e,named:e.some(e=>e.label),allow:async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{return!1}return await n(),!0},refresh:n}}function rg(e,t){let n=e.trimEnd(),r=t.trim();return n&&r?`${n} ${r}`:n||r}function ig(e,t,n={}){let r=n.endpoint===void 0?`/api/studio/transcribe`:n.endpoint,i=Zh&&r!==null,a=n.deviceId??``,[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(null),f=(0,V.useRef)(e);f.current=e;let p=(0,V.useRef)(t);p.current=t;let m=(0,V.useRef)(null),h=(0,V.useRef)(!1),g=(0,V.useRef)(!1);(0,V.useEffect)(()=>()=>m.current?.stop(),[]);let _=async()=>{let e=f.current,t;h.current=!0;try{t=await navigator.mediaDevices.getUserMedia({audio:!a||{deviceId:{exact:a}}})}catch{h.current=!1,g.current=!1,d(`denied`);return}finally{h.current=!1}let n=[],i=new MediaRecorder(t);i.ondataavailable=e=>e.data.size&&n.push(e.data),i.onstop=async()=>{for(let e of t.getTracks())e.stop();m.current=null,s(!1);let a=(i.mimeType||`audio/webm`).split(`;`)[0],o=new File(n,`dictation`,{type:a});if(o.size&&r){l(!0);try{let{text:t}=await Jm.upload(r,o);t.trim()&&p.current(rg(e,t))}catch(e){d(e.message)}finally{l(!1)}}},m.current={stop:()=>i.state!==`inactive`&&i.stop()},i.start(),s(!0),g.current&&(g.current=!1,i.stop())},v=e=>{let t=f.current,n=``,r=new e;r.continuous=!0,r.interimResults=!0,r.lang=F[ve],r.onresult=e=>{let r=``;for(let t=Math.max(0,e.resultIndex);t<e.results.length;t++){let i=e.results[t],a=i[0]?.transcript??``;i.isFinal?n=rg(n,a):r+=a}p.current(rg(t,rg(n,r)))},r.onerror=e=>{e.error!==`aborted`&&e.error!==`no-speech`&&(e.error===`not-allowed`?d(`denied`):(Yh=!0,i&&!n?(r.onend=null,m.current=null,_()):d(e.error)))},r.onend=()=>{m.current=null,s(!1)},m.current={stop:()=>r.stop()},r.start(),s(!0)},y=()=>{if(c||m.current||h.current)return;d(null),g.current=!1;let e=Xh();e&&!(a&&i)?v(e):i&&_()},b=()=>{m.current?m.current.stop():h.current&&(g.current=!0)};return{supported:!!Xh()||i,listening:o,processing:c,error:u,toggle:()=>{m.current?b():y()},start:y,stop:b}}var ag=/\.(md|markdown|txt|csv|tsv|json|ya?ml|xml|log|html?|css|js|ts|tsx|sql)$/i;function og({mime:e,name:t}){return e.startsWith(`image/`)?`image`:e===`application/pdf`||/\.pdf$/i.test(t)?`pdf`:e.startsWith(`video/`)?`video`:e.startsWith(`audio/`)?`audio`:e.startsWith(`text/`)||e===`application/json`||e===`application/xml`||ag.test(t)?`text`:`other`}function sg({mime:e,name:t}){let n=t.lastIndexOf(`.`);return((n>0?t.slice(n+1):e.split(`/`).pop())??``).slice(0,5).toUpperCase()}var cg=e=>[sg(e),e.size===void 0?null:se(e.size)].filter(Boolean).join(` · `),lg={pdf:k,text:k,video:Pa,audio:Ea,other:D};function ug({file:e,large:t}){let r=og(e),i=lg[r===`image`?`other`:r];return(0,H.jsxs)(`span`,{className:n(`flex shrink-0 flex-col items-center justify-center gap-0.5 rounded-lg`,t?`size-12`:`size-10`,r===`pdf`?`bg-rose/15 text-rose`:`bg-paper-2 text-ink-3`),children:[(0,H.jsx)(i,{className:`size-4`}),(0,H.jsx)(`span`,{className:`font-semibold text-[0.5625rem] leading-none tracking-wide`,children:sg(e)})]})}function dg({file:e,onOpen:t,onRemove:r,large:i,imageClassName:a}){let o=og(e)===`image`&&e.url,s=e.url?t:void 0;return(0,H.jsxs)(`li`,{className:`relative max-w-full list-none`,title:e.name,children:[(0,H.jsx)(`button`,{type:`button`,disabled:!s,onClick:s,"aria-label":`${z(`space.preview`)}: ${e.name}`,className:n(`block overflow-hidden text-left ring-1 ring-border transition enabled:cursor-zoom-in enabled:hover:ring-ink-4`,o?i?`max-w-full rounded-xl`:`size-16 rounded-lg`:n(`flex items-center gap-2.5 rounded-xl bg-card p-2 pr-3 enabled:hover:bg-paper-2`,`h-16`,i?`w-64`:`w-56`)),children:o?(0,H.jsx)(`img`,{src:e.url,alt:e.name,className:n(`bg-paper-2`,i?n(`h-auto w-auto max-w-full object-contain`,a??`max-h-[65dvh]`):`size-16 object-cover`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ug,{file:e,large:i}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[0.8125rem] text-ink`,children:e.name}),(0,H.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-3`,children:cg(e)})]})]})}),r?(0,H.jsx)(`button`,{type:`button`,"aria-label":z(`editor.detach`),onClick:r,className:`-top-1.5 -right-1.5 absolute flex size-5 items-center justify-center rounded-full bg-ink text-paper shadow-soft coarse:size-7`,children:(0,H.jsx)(E,{className:`size-3`})}):null]})}var fg=2e5;function pg({url:e}){let[t,n]=(0,V.useState)(null);return(0,V.useEffect)(()=>{let t=!1;return n(null),fetch(e).then(e=>e.text()).then(e=>!t&&n(e.slice(0,fg))).catch(()=>!t&&n(``)),()=>{t=!0}},[e]),t===null?(0,H.jsx)(`div`,{className:`grid h-full place-items-center text-ink-3`,children:(0,H.jsx)(o,{})}):(0,H.jsx)(`pre`,{className:`h-full overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-[0.8125rem] text-ink-2 leading-relaxed`,children:t})}function mg({file:e}){let t=og(e);return t===`image`?(0,H.jsx)(`div`,{className:`grid h-full place-items-center overflow-auto p-4`,children:(0,H.jsx)(`img`,{src:e.url,alt:e.name,className:`max-h-full max-w-full object-contain`})}):t===`pdf`?(0,H.jsx)(`iframe`,{src:e.url,title:e.name,className:`size-full bg-paper-2`}):t===`video`?(0,H.jsx)(`div`,{className:`grid h-full place-items-center bg-black`,children:(0,H.jsx)(`video`,{src:e.url,controls:!0,className:`max-h-full max-w-full`})}):t===`audio`?(0,H.jsx)(`div`,{className:`grid h-full place-items-center p-8`,children:(0,H.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full max-w-md`})}):t===`text`?(0,H.jsx)(pg,{url:e.url}):(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-ink-3`,children:[(0,H.jsx)(ug,{file:e,large:!0}),(0,H.jsx)(`p`,{className:`text-[0.875rem]`,children:z(`files.noPreview`)}),(0,H.jsx)(`a`,{href:e.url,download:e.name,className:`rounded-full bg-paper-2 px-4 py-1.5 font-medium text-[0.8125rem] text-ink hover:bg-paper-3`,children:z(`space.download`)})]})}function hg({files:e,at:t,onAt:n}){let r=e.flatMap((e,t)=>e.url?[t]:[]),i=t===null?void 0:e[t],a=t===null?-1:r.indexOf(t),o=e=>n(r[(a+e+r.length)%r.length]??null),s=r.length>1,c=()=>n(null);return(0,H.jsx)(l,{open:!!i?.url,onClose:c,wide:`full`,bare:!0,children:i?.url?(0,H.jsxs)(`div`,{onKeyDown:e=>{s&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o(e.key===`ArrowLeft`?-1:1))},className:`flex h-[calc(100dvh-48px)] flex-col overflow-hidden rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:rounded-none max-sm:pt-[env(safe-area-inset-top)]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-border-soft border-b py-2 pr-2 pl-4`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`h2`,{className:`truncate font-medium text-[0.9375rem]`,children:i.name}),(0,H.jsxs)(`span`,{className:`text-[0.75rem] text-ink-3`,children:[s?`${a+1} / ${r.length} · `:``,cg(i)]})]}),s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{label:z(`files.previous`),onClick:()=>o(-1),children:(0,H.jsx)(ma,{className:`size-4`})}),(0,H.jsx)(p,{label:z(`files.next`),onClick:()=>o(1),children:(0,H.jsx)(ga,{className:`size-4`})})]}):null,(0,H.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noreferrer`,"aria-label":z(`space.openOriginal`),title:z(`space.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,H.jsx)(S,{className:`size-4`})}),(0,H.jsx)(`a`,{href:i.url,download:i.name,"aria-label":z(`space.download`),title:z(`space.download`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,H.jsx)(wa,{className:`size-4`})}),(0,H.jsx)(p,{label:z(`common.close`),onClick:c,children:(0,H.jsx)(E,{className:`size-4`})})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,H.jsx)(mg,{file:{...i,url:i.url}},i.url)})]}):null})}function gg(e,t){if(e.name&&e.name!==`image.png`)return e;let n=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`,r=new Date().toISOString().slice(0,19).replace(/[-:]/g,``).replace(`T`,`-`);return new File([e],`paste-${r}${t?`-${t+1}`:``}.${n}`,{type:e.type})}function _g(e){let t=e=>e.replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/Ä/g,`Ae`).replace(/Ö/g,`Oe`).replace(/Ü/g,`Ue`).replace(/ß/g,`ss`).normalize(`NFKD`).replace(/[^A-Za-z0-9_-]+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``),n=e.name.lastIndexOf(`.`),r=t(n>0?e.name.slice(0,n):e.name)||`file`,i=n>0?t(e.name.slice(n+1)):``,a=i?`${r}.${i}`:r;return a===e.name?e:new File([e],a,{type:e.type})}function vg({url:e,label:t,children:n}){return(0,H.jsxs)(`div`,{className:`group relative`,title:t,children:[(0,H.jsx)(`img`,{src:e,alt:t,width:64,height:64,className:`size-16 rounded-lg bg-paper-2 object-cover ring-1 ring-border`}),n]})}var yg=200,bg=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?`⌘↩`:`Ctrl+↩`,xg=bg===`⌘↩`?`⌘U`:`Ctrl+U`;function Sg({placeholder:e,disabled:t,busy:r,onStop:i,onSend:a,attach:o=!0,floating:s,bare:c,autoFocus:l,className:u,onTalk:d,effort:f,model:m,chooser:h,buttons:g,plus:_,tall:v,lines:y=4,ref:b}){let[x,S]=(0,V.useState)(``),[C,T]=(0,V.useState)([]),[E,D]=(0,V.useState)([]),[O,k]=(0,V.useState)(!1),[ee,A]=(0,V.useState)(!1),j=(0,V.useRef)(null),M=(0,V.useRef)(null),[te]=tg(),N=ig(x,S,{deviceId:te.deviceId}),ne=e=>T(t=>[...t.filter(t=>!e.some(e=>e.name===t.name)),...e]);(0,V.useImperativeHandle)(b,()=>({add:ne,pick:e=>D(t=>[...t.filter(t=>!e.some(e=>e.id===t.id)),...e]),focus:()=>j.current?.focus(),fill:e=>{S(e),requestAnimationFrame(()=>{let t=j.current;t?.focus(),t?.setSelectionRange(e.length,e.length)})}})),(0,V.useEffect)(()=>{let e=j.current;if(!e)return;let t=()=>{e.style.height=`auto`;let t=Number.parseFloat(getComputedStyle(e).minHeight)||0;e.style.height=x?`${Math.min(e.scrollHeight,yg)}px`:``,A(!!x&&e.scrollHeight>t+1)};t();let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});return r.observe(e),()=>r.disconnect()},[x]);let[re,ie]=(0,V.useState)(new Map),[P,ae]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=new Map(C.map(e=>[e,URL.createObjectURL(e)]));return ie(e),()=>{for(let t of e.values())URL.revokeObjectURL(t)}},[C]);let oe=!!(x.trim()||C.length>0||E.length>0),F=oe&&!t,se=async(e=!1)=>{if(!F)return;N.listening&&N.stop();let t={text:x,files:C,picked:E};S(``),T([]),D([]),await a(t.text.trim(),t.files,e,t.picked)||(S(t.text),T(t.files),D(t.picked))},ce=e=>T(t=>t.filter((t,n)=>n!==e)),I=()=>M.current?.click(),le=o?(0,H.jsxs)(H.Fragment,{children:[f||m||_?.some(e=>e.length)?(0,H.jsx)(Tg,{effort:f,model:m,items:_,onAttach:I,outlined:v}):v?(0,H.jsx)(`button`,{type:`button`,"aria-label":z(`editor.attach`),title:z(`editor.attach`),onClick:I,className:Cg,children:(0,H.jsx)(w,{className:`size-4`})}):(0,H.jsx)(p,{label:z(`editor.attach`),onClick:I,children:(0,H.jsx)(w,{className:`size-4`})}),(0,H.jsx)(`input`,{ref:M,type:`file`,multiple:!0,hidden:!0,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,ne(t)}})]}):null,ue=v?`size-10`:`size-9`,de=r&&i&&!oe?(0,H.jsx)(`button`,{type:`button`,onClick:i,className:n(ue,`inline-flex shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition coarse:size-11`),"aria-label":z(`composer.stop`),title:z(`composer.stop`),children:(0,H.jsx)(Vo,{className:`size-3 fill-current`})}):d&&!(oe||N.listening)?(0,H.jsxs)(`button`,{type:`button`,onClick:d,disabled:t,className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-primary px-3.5 font-medium text-[0.8125rem] text-primary-foreground transition disabled:opacity-50 coarse:h-11`,"aria-label":z(`assistant.talk`),children:[(0,H.jsx)(ea,{className:`size-4`}),` `,z(`assistant.talk`)]}):(0,H.jsx)(`button`,{type:`button`,onClick:()=>void se(),disabled:!F,className:n(ue,`inline-flex shrink-0 items-center justify-center rounded-full transition coarse:size-11`,F?`bg-primary text-primary-foreground`:`bg-paper-2 text-ink-4`),"aria-label":z(`composer.send`),title:r&&i?z(`composer.sendBusy`,{keys:bg}):void 0,children:(0,H.jsx)(Qi,{className:`size-4`})}),fe=[...C.map(e=>({name:e.name,mime:e.type,size:e.size,url:re.get(e)})),...E.map(e=>({name:e.name,mime:e.mime,url:e.url}))],pe=(0,H.jsx)(`textarea`,{ref:j,rows:v?y:1,value:x,autoFocus:l,onChange:e=>S(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);o&&t.length&&(e.preventDefault(),ne(t.map(gg)))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),se(e.metaKey||e.ctrlKey))},placeholder:O?z(`new.dropHint`):N.listening?z(`editor.listening`):e,style:v?{minHeight:`${y*1.5}rem`}:void 0,className:n(`max-h-[200px] resize-none bg-transparent outline-none placeholder:text-ink-4`,v?`w-full px-3 pt-2.5 pb-1 text-[1rem] leading-6`:`min-h-9 flex-1 py-2 text-[0.875rem] leading-5 placeholder:truncate coarse:min-h-11 coarse:py-3`,!v&&(o?`px-1`:`px-3`))});return(0,H.jsxs)(`div`,{className:u,children:[(0,H.jsxs)(`div`,{...o?{onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),k(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||k(!1)},onDrop:e=>{k(!1),e.dataTransfer.files.length&&(e.preventDefault(),e.stopPropagation(),ne(Array.from(e.dataTransfer.files).map(gg)))}}:{},onKeyDown:e=>{o&&(e.metaKey||e.ctrlKey)&&!(e.shiftKey||e.altKey)&&e.key.toLowerCase()===`u`&&(e.preventDefault(),I())},className:n(c?`px-2 py-3`:v?`p-2`:`p-1`,!c&&`bg-card ring-1 ring-border focus-within:ring-focus`,O&&`ring-2 ring-focus`,!c&&(v?`rounded-2xl`:ee||C.length||E.length?`rounded-[1.375rem]`:`rounded-full`),!c&&(s?`shadow-overlay`:v?`shadow-elevated`:`shadow-soft`)),children:[fe.length?(0,H.jsx)(`ul`,{className:`flex flex-wrap gap-2 px-2 pt-2 pb-1`,children:fe.map((e,t)=>(0,H.jsx)(dg,{file:e,onOpen:()=>ae(t),onRemove:()=>t<C.length?ce(t):D(e=>e.filter((e,n)=>n!==t-C.length))},t<C.length?`${e.name}-${t}`:E[t-C.length]?.id))}):null,v?(0,H.jsxs)(H.Fragment,{children:[pe,(0,H.jsxs)(`div`,{className:`flex items-center gap-1 px-1 pb-1`,children:[le,(0,H.jsx)(`span`,{className:`flex-1`}),g,h?(0,H.jsx)(Og,{choice:h}):null,N.supported?(0,H.jsx)(kg,{speech:N}):null,de]})]}):(0,H.jsxs)(`div`,{className:`flex items-end gap-0.5`,children:[le,pe,g,h?(0,H.jsx)(Og,{choice:h}):null,N.supported?(0,H.jsx)(kg,{speech:N}):null,de]})]}),(0,H.jsx)(hg,{files:fe,at:P,onAt:ae}),N.error?(0,H.jsx)(`p`,{className:`mt-2 px-3 text-[0.75rem] text-rose`,children:N.error===`denied`?z(`editor.micDenied`):N.error}):null]})}var Cg=`inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-border text-ink transition hover:bg-paper-2 coarse:size-11`;function wg({model:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`px-3 pt-1.5 pb-0.5 font-medium text-[0.6875rem] text-ink-3 uppercase tracking-wide`,children:z(`composer.model`)}),e.items.map(t=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":t.id===e.value,onClick:()=>e.onChange(t.id),className:n(`flex w-full items-baseline gap-2 rounded-lg px-3 py-2 text-left text-[0.875rem] hover:bg-paper-2`,t.id===e.value&&`bg-ember-tint`),children:[(0,H.jsx)(`span`,{className:`flex-1`,children:t.label}),(0,H.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:t.note}),t.id===e.value?(0,H.jsx)(A,{className:`size-3.5 text-ember-strong`}):null]},t.id))]})}function Tg({effort:e,model:t,items:r,onAttach:i,outlined:a}){let[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(null),p=()=>{s(null),l(null)};(0,V.useEffect)(()=>{if(!o)return;let e=e=>{let t=e.target;d.current?.contains(t)||f.current?.contains(t)||u.current?.contains(t)||(s(null),l(null))},t=e=>{e.key===`Escape`&&(s(null),l(null),u.current?.focus())},n=()=>{s(null),l(null)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[o]);let m=()=>{let e=u.current?.getBoundingClientRect();o||!e?p():s({bottom:window.innerHeight-e.top+8,left:e.left})},h=(e,t)=>{let n=d.current?.getBoundingClientRect(),r=t.getBoundingClientRect();if(!n)return;let i=n.right+4+Eg<=window.innerWidth-16?n.right+4:Math.max(16,n.left-4-Eg);l({label:e,top:r.top-6,left:i})},g=`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-[0.875rem] hover:bg-paper-2 [&>svg:first-child]:size-4 [&>svg:first-child]:text-ink-3`,_=r?.flat().find(e=>e.kind===`menu`&&e.label===c?.label);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:u,type:`button`,"aria-label":z(`composer.more`),title:z(`composer.more`),"aria-haspopup":`menu`,"aria-expanded":!!o,onClick:m,className:a?Cg:`inline-flex size-9 shrink-0 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink coarse:size-11`,children:(0,H.jsx)(w,{className:`size-4`})}),o?(0,H.jsxs)(`div`,{ref:d,role:`menu`,style:{bottom:o.bottom,left:o.left},className:`fixed z-50 w-72 max-w-[calc(100vw-2rem)] rounded-xl bg-card p-1 shadow-overlay ring-1 ring-border`,children:[(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:()=>l(null),onClick:()=>{p(),i()},className:g,children:[(0,H.jsx)(ho,{}),(0,H.jsx)(`span`,{className:`flex-1`,children:z(`composer.upload`)}),(0,H.jsx)(`kbd`,{className:`font-sans text-[0.75rem] text-ink-4`,children:xg})]}),r?.map((e,t)=>e.length?(0,H.jsxs)(`div`,{children:[t>0?(0,H.jsx)(`div`,{className:`mx-2 my-1 border-border-soft border-t`}):null,e.map(e=>e.kind===`menu`?(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":c?.label===e.label,onPointerEnter:t=>h(e.label,t.currentTarget),onClick:t=>c?.label===e.label?l(null):h(e.label,t.currentTarget),className:n(g,c?.label===e.label&&`bg-paper-2`),children:[e.icon,(0,H.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,H.jsx)(ga,{className:`size-4 text-ink-4`})]},e.label):e.kind===`toggle`?(0,H.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":e.on,onPointerEnter:()=>l(null),onClick:()=>e.onChange(!e.on),className:g,children:[e.icon,(0,H.jsx)(`span`,{className:`flex-1`,children:e.label}),e.on?(0,H.jsx)(A,{className:`size-4 text-ember-strong`}):null]},e.label):(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,onPointerEnter:()=>l(null),onClick:()=>{p(),e.onSelect()},className:g,children:[e.icon,e.label]},e.label))]},e.map(e=>e.label).join(`|`)):null),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`mx-2 my-1 border-border-soft border-t`}),(0,H.jsx)(wg,{model:t})]}):null,e?(0,H.jsx)(Dg,{effort:e}):null]}):null,o&&c&&_?.kind===`menu`?(0,H.jsx)(`div`,{ref:f,role:`menu`,"aria-label":_.label,style:{top:c.top,left:c.left,width:Eg,maxHeight:`calc(100vh - ${c.top+16}px)`},className:`fixed z-50 overflow-y-auto rounded-xl bg-card p-1 shadow-overlay ring-1 ring-border`,children:_.choices.length?_.choices.map(e=>(0,H.jsxs)(`button`,{type:`button`,...e.on===void 0?{role:`menuitem`}:{role:`menuitemcheckbox`,"aria-checked":e.on},onClick:()=>{e.on===void 0&&p(),e.onSelect()},className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left hover:bg-paper-2`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate text-[0.875rem]`,children:e.label}),e.hint?(0,H.jsx)(`span`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.hint}):null]}),e.on?(0,H.jsx)(A,{className:`size-4 shrink-0 text-ember-strong`}):null]},e.id)):(0,H.jsx)(`p`,{className:`px-3 py-2 text-[0.8125rem] text-ink-3`,children:_.empty})}):null]})}var Eg=256;function Dg({effort:e}){let t=e.on&&!e.disabled;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`mx-2 my-1 border-border-soft border-t`}),(0,H.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":t,disabled:e.disabled,onClick:()=>e.onChange(!e.on),className:`flex w-full items-start gap-2.5 rounded-lg px-3 py-2 text-left hover:bg-paper-2 disabled:cursor-default disabled:hover:bg-transparent`,children:[(0,H.jsx)(`span`,{className:n(`mt-0.5 flex size-4 shrink-0 items-center justify-center rounded border`,t?`border-primary bg-primary text-primary-foreground`:`border-input`),children:t?(0,H.jsx)(A,{className:`size-3`,strokeWidth:3}):null}),(0,H.jsxs)(`span`,{className:`flex flex-col`,children:[(0,H.jsx)(`span`,{className:n(`text-[0.875rem]`,e.disabled&&`text-ink-3`),children:z(`composer.extra`)}),(0,H.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:e.hint??z(`composer.extraHint`)})]})]})]})}function Og({choice:e}){let[t,r]=(0,V.useState)(null),i=(0,V.useRef)(null),a=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.target;a.current?.contains(t)||i.current?.contains(t)||r(null)},n=e=>{e.key===`Escape`&&(r(null),i.current?.focus())},o=()=>r(null);return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,n),window.addEventListener(`resize`,o),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,n),window.removeEventListener(`resize`,o)}},[t]);let o=()=>{let e=i.current?.getBoundingClientRect();r(t||!e?null:{bottom:window.innerHeight-e.top+8,right:window.innerWidth-e.right})},s=[{on:!1,title:z(`composer.everyday`),model:e.normal,hint:z(`composer.everydayHint`)},{on:!0,title:z(`composer.extra`),model:e.extra,hint:z(`composer.extraHint`)}],c=s.find(t=>t.on===e.on)??s[0];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{ref:i,type:`button`,title:z(`composer.effort`),"aria-haspopup":`menu`,"aria-expanded":!!t,onClick:o,className:n(`inline-flex h-9 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] transition hover:bg-accent hover:text-ink coarse:h-11`,t?`bg-accent text-ink`:`text-ink-3`),children:[c.model??c.title,(0,H.jsx)(fa,{className:n(`size-3.5 transition-transform`,t&&`rotate-180`)})]}),t?(0,H.jsx)(`div`,{ref:a,role:`menu`,"aria-label":z(`composer.effort`),style:{bottom:t.bottom,right:Math.max(16,t.right-8)},className:`fixed z-50 w-72 max-w-[calc(100vw-2rem)] animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:s.map(t=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":t.on===e.on,onClick:()=>{e.onChange(t.on),r(null)},className:`flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left hover:bg-paper-2`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[0.875rem]`,children:[t.title,t.model?(0,H.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:t.model}):null]}),(0,H.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:t.hint})]}),t.on===e.on?(0,H.jsx)(A,{className:`mt-0.5 size-4 shrink-0 text-ember-strong`}):null]},t.title))}):null]})}function kg({speech:e,labelled:t}){let[r,i]=tg(),a=ng(),[s,c]=(0,V.useState)(null),l=(0,V.useRef)(null),u=(0,V.useRef)(null),f=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!s)return;a.refresh();let e=e=>{let t=e.target;f.current?.contains(t)||l.current?.contains(t)||c(null)},t=e=>{e.key===`Escape`&&(c(null),l.current?.focus())},n=()=>c(null);return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[s,a.refresh]);let m=()=>{let e=l.current?.getBoundingClientRect(),n=u.current?.getBoundingClientRect();if(e&&n){let r=window.innerHeight-e.top+8;c(t?{bottom:r,left:n.left}:{bottom:r,right:window.innerWidth-e.right})}},h=e.processing?z(`editor.transcribing`):e.listening?z(`editor.voiceStop`):r.hold?z(`dictation.holdToTalk`):z(`editor.voice`),g=r.hold?{onPointerDown:t=>{t.button===0&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),e.start())},onPointerUp:()=>e.stop(),onPointerCancel:()=>e.stop(),onKeyDown:t=>{t.key!==` `&&t.key!==`Enter`||t.repeat||(t.preventDefault(),e.start())},onKeyUp:t=>{(t.key===` `||t.key===`Enter`)&&e.stop()}}:{onClick:e.toggle},_=[{deviceId:``,label:z(`dictation.default`)},...a.devices.map((e,t)=>({deviceId:e.deviceId,label:e.label||z(`dictation.mic`,{n:t+1})}))],v=_.some(e=>e.deviceId===r.deviceId)?r.deviceId:``,y=e.processing?(0,H.jsx)(o,{className:`size-4`}):e.listening?(0,H.jsx)(Vo,{className:`size-3.5 animate-pulse-dot fill-current`}):(0,H.jsx)(uo,{className:`size-4`});return(0,H.jsxs)(`div`,{ref:u,className:`flex shrink-0 items-center`,children:[t?(0,H.jsxs)(`button`,{type:`button`,title:h,"aria-pressed":e.listening,disabled:e.processing,...g,className:n(`inline-flex h-10 touch-none select-none items-center justify-center gap-2 whitespace-nowrap rounded-full border px-4 font-medium text-sm transition disabled:opacity-60 @max-sm:w-10 @max-sm:px-0 coarse:h-11 @max-sm:coarse:w-11`,e.listening?`border-rose/40 bg-rose-tint text-rose`:`border-border text-ink hover:bg-paper-2`),children:[y,(0,H.jsx)(`span`,{className:`@max-sm:sr-only`,children:e.processing?z(`dictation.writing`):e.listening?z(`dictation.stop`):z(`dictation.speak`)})]}):(0,H.jsx)(p,{label:h,"aria-pressed":e.listening,disabled:e.processing,...g,className:n(`touch-none`,e.listening&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`),children:y}),(0,H.jsx)(`button`,{ref:l,type:`button`,"aria-label":z(`dictation.settings`),title:z(`dictation.settings`),"aria-haspopup":`menu`,"aria-expanded":!!s,onClick:()=>s?c(null):m(),className:n(`inline-flex h-9 w-5 shrink-0 items-center justify-center rounded-full text-ink-4 transition hover:text-ink coarse:h-11`,t?`ml-0.5`:`-ml-1.5`,s&&`text-ink`),children:(0,H.jsx)(fa,{className:n(`size-3.5 transition-transform`,s&&`rotate-180`)})}),s?(0,H.jsxs)(`div`,{ref:f,role:`menu`,"aria-label":z(`dictation.settings`),className:`fixed z-50 w-72 max-w-[calc(100vw-2rem)] animate-rise rounded-xl bg-card p-1.5 text-[0.875rem] shadow-overlay ring-1 ring-border-soft`,style:s.left===void 0?{bottom:s.bottom,right:Math.max(16,(s.right??0)-8)}:{bottom:s.bottom,left:Math.max(16,s.left)},children:[(0,H.jsx)(`p`,{className:`px-2.5 pt-1.5 pb-1 text-[0.75rem] text-ink-3`,children:z(`dictation.microphone`)}),_.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e.deviceId===v,onClick:()=>{i({deviceId:e.deviceId}),c(null)},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left hover:bg-paper-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.deviceId===v?(0,H.jsx)(A,{className:`size-4 shrink-0 text-ember-strong`}):null]},e.deviceId||`default`)),a.named?null:(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void a.allow(),className:`flex w-full rounded-lg px-2.5 py-2 text-left text-ink-3 hover:bg-paper-2 hover:text-ink`,children:z(`dictation.showMics`)}),(0,H.jsx)(`div`,{className:`my-1.5 h-px bg-border-soft`}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2.5 py-1.5`,children:[(0,H.jsx)(`span`,{children:z(`dictation.hold`)}),(0,H.jsx)(d,{checked:r.hold,label:z(`dictation.hold`),onChange:e=>i({hold:e})})]})]}):null]})}var Ag=null,jg=new Set;function Mg(e){Ag=e;for(let e of jg)e()}function Ng(e,t={}){return Ag?.answer(!1),new Promise(n=>{Mg({question:e,detail:t.detail,action:t.action??z(`confirm.delete`),danger:t.danger??!0,answer:e=>{Mg(null),n(e)}})})}function Pg(){let e=(0,V.useSyncExternalStore)(e=>(jg.add(e),()=>jg.delete(e)),()=>Ag);return(0,H.jsx)(l,{open:e!==null,onClose:()=>e?.answer(!1),title:e?.question,children:e?(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.detail?(0,H.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:e.detail}):null,(0,H.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,H.jsx)(_,{variant:`ghost`,onClick:()=>e.answer(!1),children:z(`confirm.cancel`)}),(0,H.jsx)(_,{autoFocus:!0,variant:e.danger?`secondary`:`primary`,className:e.danger?`border-transparent bg-rose text-white hover:bg-rose hover:brightness-95`:void 0,onClick:()=>e.answer(!0),children:e.action})]})]}):null})}var Fg=()=>re[ve],Ig=e=>String(e).padStart(2,`0`),Lg=(e,t,n)=>`${e}-${Ig(t+1)}-${Ig(n)}`,Rg=e=>e.split(`-`).map(Number),zg=e=>{let[t,n,r]=Rg(e);return new Date(Date.UTC(t,n-1,r,12))};function Bg(e,t){let n=zg(e);return n.setUTCDate(n.getUTCDate()+t),n.toISOString().slice(0,10)}function Vg(){let e=new Date;return Lg(e.getFullYear(),e.getMonth(),e.getDate())}var Hg=/^\d{4}-\d{2}-\d{2}$/;function Ug(e,t=!0){return new Intl.DateTimeFormat(Fg(),{...t?{weekday:`short`}:{},day:`numeric`,month:`short`,year:`numeric`,timeZone:`UTC`}).format(zg(e))}function Wg(e,t){return new Intl.DateTimeFormat(Fg(),{day:`numeric`,month:`short`,year:`numeric`,timeZone:`UTC`}).formatRange(zg(e),zg(t))}function Gg(){let[e,t]=(0,V.useState)(!1),n=(0,V.useRef)(null),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(null),o=(0,V.useCallback)(()=>{let e=n.current?.getBoundingClientRect(),t=r.current?.getBoundingClientRect();if(!e)return;let i=t?.height??360,o=t?.width??304,s=e.bottom+6+i<=window.innerHeight-8;a({top:s?e.bottom+6:Math.max(8,e.top-6-i),left:Math.max(8,Math.min(e.left,window.innerWidth-o-8))})},[]);return(0,V.useLayoutEffect)(()=>{if(!e)return;o();let t=()=>o();return window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[e,o]),(0,V.useEffect)(()=>{if(!e)return;let i=e=>{let i=e.target;!r.current?.contains(i)&&!n.current?.contains(i)&&t(!1)};return document.addEventListener(`pointerdown`,i),()=>document.removeEventListener(`pointerdown`,i)},[e]),{open:e,setOpen:t,close:(0,V.useCallback)(()=>{t(!1),n.current?.focus()},[]),anchor:n,panel:r,place:i}}var Kg=`flex h-11 w-full min-w-0 items-center gap-2.5 rounded-lg border border-input bg-card px-3 text-left text-[0.9375rem] text-ink outline-none transition hover:border-ink-4 focus-visible:border-focus focus-visible:ring-4 focus-visible:ring-focus-glow disabled:pointer-events-none disabled:opacity-60`;function qg({anchor:e,open:t,onOpen:r,disabled:i,text:a,placeholder:o,onClear:s,id:c}){return(0,H.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,H.jsxs)(`button`,{ref:e,id:c,type:`button`,disabled:i,"aria-haspopup":`dialog`,"aria-expanded":t,onClick:r,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),r())},className:n(Kg,t&&`border-focus ring-4 ring-focus-glow`,s&&`pr-9`),children:[(0,H.jsx)(ca,{className:`size-4 shrink-0 text-ink-3`}),(0,H.jsx)(`span`,{className:n(`min-w-0 flex-1 truncate tabular-nums`,!a&&`text-ink-4`),children:a??o})]}),s&&!i?(0,H.jsx)(`button`,{type:`button`,"aria-label":z(`date.clear`),onClick:s,className:`-translate-y-1/2 absolute top-1/2 right-2 grid size-6 place-items-center rounded-full text-ink-4 transition hover:bg-paper-2 hover:text-ink`,children:(0,H.jsx)(E,{className:`size-3.5`})}):null]})}function Jg({focus:e,setFocus:t,min:r,max:i,selected:a,preview:o,onHover:s,onPick:c,onClose:l,footer:u}){let d=(0,V.useRef)(null),[f,p]=Rg(e),m=new Date(Date.UTC(f,p-1,1,12)),h=(m.getUTCDay()+6)%7,g=Bg(Lg(f,p-1,1),-h),_=Array.from({length:42},(e,t)=>Bg(g,t)),v=Vg(),y=e=>!!(r&&e<r||i&&e>i),b=Array.from({length:7},(e,t)=>new Intl.DateTimeFormat(Fg(),{weekday:`short`,timeZone:`UTC`}).format(new Date(Date.UTC(2024,0,1+t,12))).replace(`.`,``).slice(0,2)),x=new Intl.DateTimeFormat(Fg(),{month:`long`,year:`numeric`,timeZone:`UTC`}).format(m),S=t=>{let n=zg(e),r=n.getUTCDate();n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let i=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(r,i)),n.toISOString().slice(0,10)},C=a.to??(a.from&&o?o:null),w=a.from&&C?a.from<C?a.from:C:a.from,T=a.from&&C&&a.from<C?C:a.from;return(0,V.useEffect)(()=>{d.current?.querySelector(`[data-day="${e}"]`)?.focus()},[e]),(0,H.jsxs)(`div`,{className:`w-[19rem] max-w-[calc(100vw-16px)] p-3`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 pl-2`,children:[(0,H.jsx)(`span`,{className:`font-display font-semibold text-[0.9375rem] capitalize`,children:x}),(0,H.jsxs)(`span`,{className:`flex gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":z(`date.prev`),onClick:()=>t(S(-1)),className:`grid size-8 place-items-center rounded-full text-ink-3 transition hover:bg-paper-2 hover:text-ink`,children:(0,H.jsx)(ma,{className:`size-4`})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":z(`date.next`),onClick:()=>t(S(1)),className:`grid size-8 place-items-center rounded-full text-ink-3 transition hover:bg-paper-2 hover:text-ink`,children:(0,H.jsx)(ga,{className:`size-4`})})]})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-7 text-center text-[0.6875rem] text-ink-4 uppercase tracking-wide`,children:b.map(e=>(0,H.jsx)(`span`,{className:`py-1.5`,children:e},e))}),(0,H.jsx)(`div`,{ref:d,className:`grid grid-cols-7 gap-y-0.5`,onKeyDown:n=>{let r={ArrowLeft:()=>Bg(e,-1),ArrowRight:()=>Bg(e,1),ArrowUp:()=>Bg(e,-7),ArrowDown:()=>Bg(e,7),PageUp:()=>S(n.shiftKey?-12:-1),PageDown:()=>S(n.shiftKey?12:1),Home:()=>Bg(e,-((zg(e).getUTCDay()+6)%7)),End:()=>Bg(e,6-(zg(e).getUTCDay()+6)%7)};r[n.key]?(n.preventDefault(),t(r[n.key]())):n.key===`Escape`&&(n.preventDefault(),n.stopPropagation(),l())},onPointerLeave:()=>s?.(null),children:_.map(t=>{let r=t.slice(0,7)===e.slice(0,7),i=t===w||t===T,a=!!(w&&T&&t>w&&t<T),o=y(t);return(0,H.jsx)(`div`,{className:n(`relative flex h-9 items-center justify-center`,a&&`bg-ember-tint`,w!==T&&t===w&&`bg-linear-to-r from-transparent from-50% to-ember-tint to-50%`,w!==T&&t===T&&`bg-linear-to-l from-transparent from-50% to-ember-tint to-50%`),children:(0,H.jsxs)(`button`,{type:`button`,"data-day":t,tabIndex:t===e?0:-1,disabled:o,"aria-pressed":i,"aria-current":t===v?`date`:void 0,"aria-label":Ug(t),onClick:()=>c(t),onPointerEnter:()=>s?.(t),className:n(`relative grid size-9 place-items-center rounded-full text-[0.875rem] tabular-nums outline-none transition focus-visible:ring-2 focus-visible:ring-focus coarse:size-10`,i?`bg-primary font-semibold text-primary-foreground`:a?`text-ink hover:bg-card`:r?`text-ink hover:bg-paper-2`:`text-ink-4 hover:bg-paper-2`,t===v&&!i&&`font-semibold text-ember-strong`,o&&`pointer-events-none line-through opacity-35`),children:[Number(t.slice(8)),t===v&&!i?(0,H.jsx)(`span`,{className:`-translate-x-1/2 absolute bottom-1 left-1/2 size-1 rounded-full bg-ember`}):null]})},t)})}),u?(0,H.jsx)(`div`,{className:`mt-2 flex items-center justify-between gap-2 border-border-soft border-t pt-2`,children:u}):null]})}var Yg=`fixed z-50 animate-rise rounded-xl bg-card shadow-overlay ring-1 ring-border-soft`,Xg=`rounded-md px-2 py-1 font-medium text-[0.8125rem] text-ink-2 transition hover:bg-paper-2 hover:text-ink disabled:pointer-events-none disabled:opacity-40`;function Zg({value:e,onChange:t,min:r,max:i,placeholder:a,disabled:o,clearable:s,className:c,id:l}){let u=Gg(),d=Hg.test(e)?e:``,[f,p]=(0,V.useState)(d||r||Vg()),m=Vg(),h=()=>{p(d||(r&&r>m?r:m)),u.setOpen(!0)};return(0,H.jsxs)(`div`,{className:n(`min-w-0`,c),children:[(0,H.jsx)(qg,{id:l,anchor:u.anchor,open:u.open,onOpen:()=>u.open?u.setOpen(!1):h(),disabled:o,text:d?Ug(d):null,placeholder:a??z(`date.pick`),onClear:s&&d?()=>t(``):void 0}),u.open?(0,H.jsx)(`div`,{ref:u.panel,role:`dialog`,className:Yg,style:{top:u.place?.top??-9999,left:u.place?.left??-9999},children:(0,H.jsx)(Jg,{focus:f,setFocus:p,min:r,max:i,selected:{from:d||null,to:d||null},onPick:e=>{t(e),u.close()},onClose:u.close,footer:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:Xg,disabled:!!(r&&m<r||i&&m>i),onClick:()=>{t(m),u.close()},children:z(`date.today`)}),d?(0,H.jsx)(`button`,{type:`button`,className:Xg,onClick:()=>{t(``),u.close()},children:z(`date.clear`)}):null]})})}):null]})}function Qg({from:e,to:t,onChange:r,min:i,max:a,placeholder:o,disabled:s,className:c,id:l}){let u=Gg(),[d,f]=(0,V.useState)(e||i||Vg()),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),_=Hg.test(e),v=Hg.test(t)?t:e,y=_?v===e?Ug(e):Wg(e,v):null,b=()=>{let t=Vg();f(_?e:i&&i>t?i:t),m(null),g(null),u.setOpen(!0)};return(0,H.jsxs)(`div`,{className:n(`min-w-0`,c),children:[(0,H.jsx)(qg,{id:l,anchor:u.anchor,open:u.open,onOpen:()=>u.open?u.setOpen(!1):b(),disabled:s,text:y,placeholder:o??z(`date.pickRange`),onClear:_?()=>r({from:``,to:``}):void 0}),u.open?(0,H.jsx)(`div`,{ref:u.panel,role:`dialog`,className:Yg,style:{top:u.place?.top??-9999,left:u.place?.left??-9999},children:(0,H.jsx)(Jg,{focus:d,setFocus:f,min:i,max:a,selected:p?{from:p,to:null}:{from:_?e:null,to:_?v:null},preview:p?h:null,onHover:g,onPick:e=>{if(!p){m(e);return}let[t,n]=p<=e?[p,e]:[e,p];r({from:t,to:n}),m(null),u.close()},onClose:u.close,footer:(0,H.jsx)(`span`,{className:`px-2 py-1 text-[0.75rem] text-ink-3`,children:z(p?`date.pickEnd`:`date.pickStart`)})})}):null]})}function $g({title:e,entries:t,current:r,footer:i}){let a=t.find(e=>e.entries?.some(e=>e.id===r))??null,o=a?.id??r,s=a?.id??null,[c,l]=(0,V.useState)(s),[u,d]=(0,V.useState)(null);(0,V.useEffect)(()=>{l(e=>(e!==s&&d(s?`deeper`:`back`),s))},[s]);let f=t.find(e=>e.id===c)??null,p=f?.entries??null;return(0,H.jsxs)(`nav`,{"aria-label":e,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 md:hidden`,children:[(0,H.jsx)(e_,{entries:t,current:o}),a?.entries?(0,H.jsx)(e_,{entries:a.entries,current:r,small:!0}):null]}),(0,H.jsxs)(`div`,{className:`max-md:hidden`,children:[(0,H.jsx)(`div`,{className:`mb-2 flex h-9 min-w-0 items-center px-1`,children:f?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>{d(`back`),l(null)},"aria-label":e,className:`-ml-1.5 mr-0.5 grid size-8 place-items-center rounded-lg text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,H.jsx)(Ji,{className:`size-4`})}),(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 font-medium text-[0.875rem]`,children:[f.icon?(0,H.jsx)(f.icon,{className:`size-4 shrink-0 text-ember-strong`}):null,(0,H.jsx)(`span`,{className:`truncate`,children:f.label})]})]}):(0,H.jsx)(`span`,{className:`truncate font-medium text-[0.875rem]`,children:e})}),(0,H.jsx)(`div`,{className:n(u===`deeper`&&`animate-step-deeper`,u===`back`&&`animate-step-back`),children:(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(p??t).map(e=>{let t=p?e.id===r:e.id===o;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(Fi,{to:e.to,"aria-current":t?`page`:void 0,className:n(`group flex items-center gap-2 rounded-lg px-2 py-1 text-[0.875rem] transition`,t?`bg-paper-2 font-medium text-ink`:`text-ink-2 hover:bg-accent hover:text-ink`),children:[(0,H.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center`,children:e.icon?(0,H.jsx)(e.icon,{className:`size-4 transition-transform duration-200 ease-out group-hover:scale-110`}):null}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),!p&&e.entries?.length?(0,H.jsx)(ga,{className:`size-4 text-ink-4`}):null]})},e.id)})})},f?.id??``),i]})]})}function e_({entries:e,current:t,small:r}){return(0,H.jsx)(`div`,{className:n(`-mx-1 flex min-w-0 gap-1 overflow-x-auto px-1 [scrollbar-width:none]`,r?``:`rounded-full bg-paper-2 p-1`),children:e.map(e=>{let i=e.id===t;return(0,H.jsx)(Fi,{to:e.to,"aria-current":i?`page`:void 0,className:n(`inline-flex shrink-0 items-center gap-1.5 rounded-full transition`,r?`h-8 px-3 text-[0.8125rem]`:`h-9 flex-1 justify-center px-3.5 text-[0.875rem]`,i?r?`bg-paper-2 font-medium text-ink`:`bg-card font-medium text-ink shadow-soft`:`text-ink-3 hover:text-ink`),children:e.label},e.id)})})}function t_({menu:e,children:t}){return(0,H.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[10.5rem_minmax(0,1fr)] md:gap-5 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,H.jsx)(`aside`,{className:`min-w-0 md:sticky md:top-6 md:self-start`,children:e}),t]})}var n_=e=>String(e).padStart(2,`0`),r_=/^([01]\d|2[0-3]):([0-5]\d)$/,i_=e=>{let t=r_.exec(e);return t?Number(t[1])*60+Number(t[2]):null},a_=e=>{let t=(e%1440+1440)%1440;return`${n_(Math.floor(t/60))}:${n_(t%60)}`};function o_({value:e,onChange:t,step:r=5,disabled:i,placeholder:a=`--:--`,compact:o,className:s,id:c,label:l}){let{open:u,setOpen:d,close:f,anchor:p,panel:m,place:h}=Gg(),g=i_(e),_=g===null?null:Math.floor(g/60),v=g===null?null:g%60,y=Array.from({length:Math.ceil(60/r)},(e,t)=>t*r);return v!==null&&!y.includes(v)&&(y.push(v),y.sort((e,t)=>e-t)),(0,H.jsxs)(`div`,{className:n(`relative min-w-0`,s),children:[(0,H.jsxs)(`button`,{ref:p,id:c,type:`button`,disabled:i,"aria-label":l?`${l}: ${e||a}`:void 0,"aria-haspopup":`dialog`,"aria-expanded":u,onClick:()=>d(!u),onKeyDown:e=>{if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let n=g??540,i=e.key===`ArrowUp`?r:-r;t(a_(n%r?Math[i>0?`ceil`:`floor`](n/r)*r:n+i))},className:n(`flex w-full min-w-0 items-center rounded-lg border border-input bg-card text-ink tabular-nums outline-none transition hover:border-ink-4 focus-visible:border-focus focus-visible:ring-4 focus-visible:ring-focus-glow disabled:pointer-events-none disabled:opacity-60`,o?`h-9 justify-center px-2 text-[14px] coarse:h-11`:`h-11 gap-2.5 px-3 text-left text-[0.9375rem]`,u&&`border-focus ring-4 ring-focus-glow`),children:[o?null:(0,H.jsx)(va,{className:`size-4 shrink-0 text-ink-3`}),(0,H.jsx)(`span`,{className:n(`min-w-0 truncate`,!e&&`text-ink-4`),children:e||a})]}),u?(0,H.jsxs)(`div`,{ref:m,role:`dialog`,"aria-label":l??z(`time.pick`),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),f())},className:`fixed z-50 flex animate-rise gap-1 rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,style:h?{top:h.top,left:h.left}:{visibility:`hidden`},children:[(0,H.jsx)(s_,{label:z(`time.hour`),items:Array.from({length:24},(e,t)=>t),chosen:_,onPick:e=>t(a_(e*60+(v??0)))}),(0,H.jsx)(`div`,{className:`w-px self-stretch bg-border-soft`}),(0,H.jsx)(s_,{label:z(`time.minute`),items:y,chosen:v,onPick:e=>{t(a_((_??9)*60+e)),f()}})]}):null]})}function s_({label:e,items:t,chosen:r,onPick:i}){let a=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{let e=a.current?.querySelector(`[aria-selected=true]`);e&&a.current&&(a.current.scrollTop=e.offsetTop-a.current.clientHeight/2+e.clientHeight/2)},[]),(0,H.jsx)(`div`,{ref:a,role:`listbox`,"aria-label":e,className:`flex max-h-56 w-14 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,children:t.map(e=>(0,H.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":e===r,onClick:()=>i(e),className:n(`h-8 shrink-0 rounded-md text-[14px] tabular-nums transition`,e===r?`bg-primary font-medium text-primary-foreground`:`text-ink-2 hover:bg-paper-2 hover:text-ink`),children:n_(e)},e))})}var c_=e({AddMenu:()=>Rh,AddRow:()=>Kh,Anchor:()=>Mh,Button:()=>_,Card:()=>f,Chip:()=>h,Composer:()=>Sg,ConfirmHost:()=>Pg,DatePicker:()=>Zg,DateRangePicker:()=>Qg,Dialog:()=>l,DictationButton:()=>kg,Empty:()=>r,IconButton:()=>p,InlineText:()=>Ih,Input:()=>g,LATER_KEYS:()=>bg,Label:()=>i,LinkedText:()=>u,MenuPage:()=>t_,PageMenu:()=>$g,QrCode:()=>Xs,RuleRows:()=>Gh,Section:()=>Nh,Segmented:()=>v,Select:()=>a,Spinner:()=>o,Swatch:()=>m,Switch:()=>d,Tabs:()=>c,Textarea:()=>s,Thumb:()=>vg,TimePicker:()=>o_,askConfirm:()=>Ng,cn:()=>n,dateText:()=>Ug,newId:()=>zh,pastedName:()=>gg,useAutosave:()=>ah,useRuleRows:()=>Vh,workspaceFile:()=>_g});export{Jm as $,hi as $n,Xs as $t,Ah as A,Pa as An,Re as Ar,Ap as At,Ch as B,fa as Bn,Ad as Bt,Nh as C,uo as Cn,st as Cr,qp as Ct,hh as D,Wa as Dn,Be as Dr,Rp as Dt,Vh as E,Xa as En,Ve as Er,Up as Et,ph as F,Sa as Fn,Ge as Fr,Kd as Ft,nh as G,Xi as Gn,Xl as Gt,Sh as H,ia as Hn,Xu as Ht,mh as I,ba as In,nt as Ir,Vd as It,rh as J,Pi as Jn,Vl as Jt,eh as K,Ji as Kn,Wl as Kt,Dh as L,va as Ln,et as Lr,Pd as Lt,gh as M,Oa as Mn,He as Mr,rf as Mt,_h as N,Ea as Nn,We as Nr,Rd as Nt,oh as O,Ha as On,Ze as Or,jp as Ot,jh as P,wa as Pn,U as Pr,Wd as Pt,qm as Q,mi as Qn,wl as Qt,bh as R,ga as Rn,ke as Rr,Ld as Rt,Ph as S,po as Sn,ut as Sr,em as St,zh as T,io as Tn,Fe as Tr,nm as Tt,$m as U,ea as Un,Zu as Ut,vh as V,oa as Vn,Ju as Vt,th as W,Qi as Wn,ql as Wt,Qm as X,Ii as Xn,Tl as Xt,ih as Y,Fi as Yn,jl as Yt,Xm as Z,zi as Zn,El as Zt,Mh as _,Co as _n,bt as _r,vm as _t,Ng as a,$o as an,Wt as ar,Rm as at,Bh as b,_o as bn,ht as br,bm as bt,bg as c,Go as cn,Ht as cr,Tm as ct,hg as d,zo as dn,zt as dr,jm as dt,Ys as en,_i as er,Ym as et,dg as f,Lo as fn,Rt as fr,Am as ft,Kh as g,To as gn,St as gr,ym as gt,Rh as h,Do as hn,Et as hr,_m as ht,Pg as i,Us as in,Dr as ir,Lm as it,yh as j,Aa as jn,Pe as jr,uf as jt,Th as k,Ba as kn,ze as kr,Lp as kt,gg as l,Uo as ln,Vt as lr,Em as lt,tg as m,jo as mn,Nt as mr,Mm as mt,o_ as n,Ws as nn,Cr as nr,Km as nt,Sg as o,Zo as on,Ut as or,Cm as ot,ig as p,No as pn,It as pr,Dm as pt,ah as q,Ki as qn,Ul as qt,Gg as r,qs as rn,Tr as rr,Bm as rt,kg as s,qo as sn,Bt as sr,wm as st,c_ as t,Js as tn,xr as tr,Gm as tt,_g as u,Vo as un,Lt as ur,Nm as ut,Fh as v,xo as vn,xt as vr,xm as vt,qh as w,co as wn,ot as wr,cm as wt,Gh as x,ho as xn,dt as xr,pm as xt,Ih as y,yo as yn,gt as yr,Sm as yt,kh as z,ma as zn,Oe as zr,Jd as zt};
|